Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: opencode

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]

permissions:
id-token: write
contents: read
pull-requests: read
issues: read
id-token: write
contents: read
pull-requests: read
issues: read

jobs:
opencode:
if: |
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
opencode:
if: |
contains(github.event.comment.body, ' /opencode') ||
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
startsWith(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Run opencode
uses: anomalyco/opencode/github@latest
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
model: opencode/grok-code
- name: Run opencode
uses: anomalyco/opencode/github@latest
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
model: opencode/grok-code
162 changes: 161 additions & 1 deletion app/chat/components/agent-tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,31 @@ import {
BatchWebScraperTool,
SiteMapExtractorTool,
LinkExtractorTool,
FinancialQuoteCard,
FinancialChart,
CompanyProfileCard,
RepositoryCard,
PullRequestList,
IssueCard,
CommitHistoryList,
WeatherCard,
ForecastView,
ArxivPaperCard,

type WebScraperUITool,
type BatchWebScraperUITool,
type SiteMapExtractorUITool,
type LinkExtractorUITool
type LinkExtractorUITool,
type FinnhubQuotesUITool,
type PolygonStockQuotesUITool,
type ChartSupervisorUITool,
type ListRepositoriesUITool,
type ListPullRequestsUITool,
type GetIssueUITool,
type ListCommitsUITool,
type WeatherUITool, // Assuming this exists for WeatherCard and ForecastView
type ArxivUITool,

} from "@/src/components/ai-elements/tools"

function getProgressMessage(tool: ToolInvocationState | DynamicToolUIPart): string | null {
Expand Down Expand Up @@ -143,6 +164,145 @@ export function AgentTools({ tools, className }: AgentToolsProps) {
)
}

if ((toolName === "finnhub-quotes" || toolName === "polygon-stock-quotes") && hasOutput) {
return (
<FinancialQuoteCard
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as FinnhubQuotesUITool["input"]}
output={latest.output as FinnhubQuotesUITool["output"]}
errorText={errorText}
/>
)
}

if (toolName === "chart-supervisor" && hasOutput) {
return (
<FinancialChart
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as ChartSupervisorUITool["input"]}
output={latest.output as ChartSupervisorUITool["output"]}
errorText={errorText}
/>
)
}

if (toolName === "github-list-repositories" && hasOutput) {
return (
<RepositoryCard
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as ListRepositoriesUITool["input"]}
output={latest.output as ListRepositoriesUITool["output"]}
errorText={errorText}
/>
)
}

if (toolName === "github-list-pull-requests" && hasOutput) {
return (
<PullRequestList
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as ListPullRequestsUITool["input"]}
output={latest.output as ListPullRequestsUITool["output"]}
errorText={errorText}
/>
)
}

if (toolName === "github-get-issue" && hasOutput) {
return (
<IssueCard
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as GetIssueUITool["input"]}
output={latest.output as GetIssueUITool["output"]}
errorText={errorText}
/>
)
}

if ((toolName === "finnhub-company" || toolName === "polygon-stock-fundamentals") && hasOutput) {
return (
<CompanyProfileCard
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as any}
output={latest.output as any}
errorText={errorText}
/>
)
}

if (toolName === "github-list-commits" && hasOutput) {
return (
<CommitHistoryList
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as any}
output={latest.output as any}
errorText={errorText}
/>
)
}

if (toolName === "weatherTool" && hasOutput) {
return (
<div key={`${id}-${toolName}-${toolState}-${groupIdx}`} className="space-y-2">
<WeatherCard
toolCallId={id}
input={latest.input as { location: string }}
output={latest.output as any}
errorText={errorText}
/>
<ForecastView
toolCallId={id}
input={latest.input as { location: string }}
output={latest.output as any}
errorText={errorText}
/>
</div>
)
}

if ((toolName === "serpapi-news-trends" || toolName === "finnhub-company-news") && hasOutput) {
return (
<NewsCarousel
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as any}
output={latest.output as any}
errorText={errorText}
/>
)
}

if (toolName === "arxiv-search" && hasOutput) {
return (
<ArxivPaperCard
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as any}
output={latest.output as any}
errorText={errorText}
/>
)
}

if (toolName === "serpapi-search" && hasOutput) {
return (
<SearchResultList
key={`${id}-${toolName}-${toolState}-${groupIdx}`}
toolCallId={id}
input={latest.input as any}
output={latest.output as any}
errorText={errorText}
/>
)
}
Comment on lines +227 to +304

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Several components are being passed props cast to any, which undermines the benefits of TypeScript and can lead to runtime errors. You have already imported specific UI tool types at the top of the file, which should be used to ensure type safety.

Specifically, the following components are affected:

  • CompanyProfileCard (lines 232-233)
  • CommitHistoryList (lines 244-245)
  • WeatherCard and ForecastView (output on lines 257, 263)
  • NewsCarousel (lines 275-276)
  • ArxivPaperCard (lines 287-288)
  • SearchResultList (lines 299-300)

If tools have slightly different input/output shapes, you can use a union type to handle them correctly.

For example, for CompanyProfileCard:

// Assuming PolygonStockFundamentalsUITool type is available
input={latest.input as FinnhubCompanyUITool['input'] | PolygonStockFundamentalsUITool['input']}
output={latest.output as FinnhubCompanyUITool['output'] | PolygonStockFundamentalsUITool['output']}

Applying this pattern to all the listed components will significantly improve type safety and code quality.


// Default rendering for other tools
return (
<Tool
Expand Down
23 changes: 23 additions & 0 deletions conductor/code_styleguides/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# General Code Style Principles

This document outlines general coding principles that apply across all languages and frameworks used in this project.

## Readability
- Code should be easy to read and understand by humans.
- Avoid overly clever or obscure constructs.

## Consistency
- Follow existing patterns in the codebase.
- Maintain consistent formatting, naming, and structure.

## Simplicity
- Prefer simple solutions over complex ones.
- Break down complex problems into smaller, manageable parts.

## Maintainability
- Write code that is easy to modify and extend.
- Minimize dependencies and coupling.

## Documentation
- Document *why* something is done, not just *what*.
- Keep documentation up-to-date with code changes.
49 changes: 49 additions & 0 deletions conductor/code_styleguides/html-css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Google HTML/CSS Style Guide Summary

This document summarizes key rules and best practices from the Google HTML/CSS Style Guide.

## 1. General Rules
- **Protocol:** Use HTTPS for all embedded resources.
- **Indentation:** Indent by 2 spaces. Do not use tabs.
- **Capitalization:** Use only lowercase for all code (element names, attributes, selectors, properties).
- **Trailing Whitespace:** Remove all trailing whitespace.
- **Encoding:** Use UTF-8 (without a BOM). Specify `<meta charset="utf-8">` in HTML.

## 2. HTML Style Rules
- **Document Type:** Use `<!doctype html>`.
- **HTML Validity:** Use valid HTML.
- **Semantics:** Use HTML elements according to their intended purpose (e.g., use `<p>` for paragraphs, not for spacing).
- **Multimedia Fallback:** Provide `alt` text for images and transcripts/captions for audio/video.
- **Separation of Concerns:** Strictly separate structure (HTML), presentation (CSS), and behavior (JavaScript). Link to CSS and JS from external files.
- **`type` Attributes:** Omit `type` attributes for stylesheets (`<link>`) and scripts (`<script>`).

## 3. HTML Formatting Rules
- **General:** Use a new line for every block, list, or table element, and indent its children.
- **Quotation Marks:** Use double quotation marks (`""`) for attribute values.

## 4. CSS Style Rules
- **CSS Validity:** Use valid CSS.
- **Class Naming:** Use meaningful, generic names. Separate words with a hyphen (`-`).
- **Good:** `.video-player`, `.site-navigation`
- **Bad:** `.vid`, `.red-text`
- **ID Selectors:** Avoid using ID selectors for styling. Prefer class selectors.
- **Shorthand Properties:** Use shorthand properties where possible (e.g., `padding`, `font`).
- **`0` and Units:** Omit units for `0` values (e.g., `margin: 0;`).
- **Leading `0`s:** Always include leading `0`s for decimal values (e.g., `font-size: 0.8em;`).
- **Hexadecimal Notation:** Use 3-character hex notation where possible (e.g., `#fff`).
- **`!important`:** Avoid using `!important`.

## 5. CSS Formatting Rules
- **Declaration Order:** Alphabetize declarations within a rule.
- **Indentation:** Indent all block content.
- **Semicolons:** Use a semicolon after every declaration.
- **Spacing:**
- Use a space after a property name's colon (`font-weight: bold;`).
- Use a space between the last selector and the opening brace (`.foo {`).
- Start a new line for each selector and declaration.
- **Rule Separation:** Separate rules with a new line.
- **Quotation Marks:** Use single quotes (`''`) for attribute selectors and property values (e.g., `[type='text']`).

**BE CONSISTENT.** When editing code, match the existing style.

*Source: [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html)*
51 changes: 51 additions & 0 deletions conductor/code_styleguides/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Google JavaScript Style Guide Summary

This document summarizes key rules and best practices from the Google JavaScript Style Guide.

## 1. Source File Basics
- **File Naming:** All lowercase, with underscores (`_`) or dashes (`-`). Extension must be `.js`.
- **File Encoding:** UTF-8.
- **Whitespace:** Use only ASCII horizontal spaces (0x20). Tabs are forbidden for indentation.

## 2. Source File Structure
- New files should be ES modules (`import`/`export`).
- **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
- **Imports:** Do not use line-wrapped imports. The `.js` extension in import paths is mandatory.

## 3. Formatting
- **Braces:** Required for all control structures (`if`, `for`, `while`, etc.), even single-line blocks. Use K&R style ("Egyptian brackets").
- **Indentation:** +2 spaces for each new block.
- **Semicolons:** Every statement must be terminated with a semicolon.
- **Column Limit:** 80 characters.
- **Line-wrapping:** Indent continuation lines at least +4 spaces.
- **Whitespace:** Use single blank lines between methods. No trailing whitespace.

## 4. Language Features
- **Variable Declarations:** Use `const` by default, `let` if reassignment is needed. **`var` is forbidden.**
- **Array Literals:** Use trailing commas. Do not use the `Array` constructor.
- **Object Literals:** Use trailing commas and shorthand properties. Do not use the `Object` constructor.
- **Classes:** Do not use JavaScript getter/setter properties (`get name()`). Provide ordinary methods instead.
- **Functions:** Prefer arrow functions for nested functions to preserve `this` context.
- **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for multi-line strings or complex interpolation.
- **Control Structures:** Prefer `for-of` loops. `for-in` loops should only be used on dict-style objects.
- **`this`:** Only use `this` in class constructors, methods, or in arrow functions defined within them.
- **Equality Checks:** Always use identity operators (`===` / `!==`).

## 5. Disallowed Features
- `with` keyword.
- `eval()` or `Function(...string)`.
- Automatic Semicolon Insertion.
- Modifying builtin objects (`Array.prototype.foo = ...`).

## 6. Naming
- **Classes:** `UpperCamelCase`.
- **Methods & Functions:** `lowerCamelCase`.
- **Constants:** `CONSTANT_CASE` (all uppercase with underscores).
- **Non-constant Fields & Variables:** `lowerCamelCase`.

## 7. JSDoc
- JSDoc is used on all classes, fields, and methods.
- Use `@param`, `@return`, `@override`, `@deprecated`.
- Type annotations are enclosed in braces (e.g., `/** @param {string} userName */`).

*Source: [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)*
Loading
Loading