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
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- "*"
- '*'
pull_request:
branches:
- main
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pnpm install
pnpm build

# Run locally built cli in interactive mode
pnpm -f mycoder -i
pnpm cli -i
```

## 📦 Packages
Expand Down
84 changes: 42 additions & 42 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
// eslint.config.js
import js from "@eslint/js";
import pluginImport from "eslint-plugin-import";
import prettierRecommended from "eslint-plugin-prettier/recommended";
import pluginPromise from "eslint-plugin-promise";
import pluginUnusedImports from "eslint-plugin-unused-imports";
import ts from "typescript-eslint";
import js from '@eslint/js';
import pluginImport from 'eslint-plugin-import';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import pluginPromise from 'eslint-plugin-promise';
import pluginUnusedImports from 'eslint-plugin-unused-imports';
import ts from 'typescript-eslint';

export default ts.config(
js.configs.recommended,
ts.configs.recommended,
prettierRecommended,
pluginPromise.configs["flat/recommended"],
pluginPromise.configs['flat/recommended'],
{
plugins: {
import: pluginImport,
"unused-imports": pluginUnusedImports,
'unused-imports': pluginUnusedImports,
},
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "off", // turned off in favor of unused-imports/no-unused-vars
"@typescript-eslint/no-require-imports": "warn",
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': 'off', // turned off in favor of unused-imports/no-unused-vars
'@typescript-eslint/no-require-imports': 'warn',

// Remove unused imports
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],

// Import organization
"import/order": [
"error",
'import/order': [
'error',
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
"newlines-between": "always",
alphabetize: { order: "asc", caseInsensitive: true },
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
warnOnUnassignedImports: true,
},
],
"import/no-duplicates": "error",
'import/no-duplicates': 'error',
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
"import/resolver": {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ["./packages/*/tsconfig.json"],
project: ['./packages/*/tsconfig.json'],
},
},
},
},
{
ignores: [
"**/dist",
"**/_doNotUse",
"**/node_modules",
"**/.vinxi",
"**/.output",
"**/pnpm-lock.yaml",
"**/routeTree.gen.ts",
'**/dist',
'**/_doNotUse',
'**/node_modules',
'**/.vinxi',
'**/.output',
'**/pnpm-lock.yaml',
'**/routeTree.gen.ts',
],
},
);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"gcloud-setup": "gcloud auth application-default login && gcloud config set account \"[email protected]\" && gcloud config set project drivecore-primary && gcloud config set run/region us-central1",
"changeset": "changeset",
"version": "changeset version",
"release": "changeset publish"
"release": "changeset publish",
"cli": "cd packages/cli && node --no-deprecation bin/cli.js"
},
"dependencies": {
"rimraf": "^6.0.1"
Expand Down
14 changes: 7 additions & 7 deletions packages/agent/src/core/executeToolCall.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logger } from "../utils/logger.js";
import { Logger } from '../utils/logger.js';

import { Tool, ToolCall } from "./types.js";
import { Tool, ToolCall } from './types.js';

const OUTPUT_LIMIT = 12 * 1024; // 10KB limit

Expand Down Expand Up @@ -29,7 +29,7 @@ export const executeToolCall = async (
if (tool.logParameters) {
tool.logParameters(toolCall.input, toolContext);
} else {
logger.info("Parameters:");
logger.info('Parameters:');
Object.entries(toolCall.input).forEach(([name, value]) => {
logger.info(` - ${name}: ${JSON.stringify(value).substring(0, 60)}`);
});
Expand All @@ -45,18 +45,18 @@ export const executeToolCall = async (
if (tool.logReturns) {
tool.logReturns(output, toolContext);
} else {
logger.info("Results:");
if (typeof output === "string") {
logger.info('Results:');
if (typeof output === 'string') {
logger.info(` - ${output}`);
} else if (typeof output === "object") {
} else if (typeof output === 'object') {
Object.entries(output).forEach(([name, value]) => {
logger.info(` - ${name}: ${JSON.stringify(value).substring(0, 60)}`);
});
}
}

const toolOutput =
typeof output === "string" ? output : JSON.stringify(output, null, 2);
typeof output === 'string' ? output : JSON.stringify(output, null, 2);
return toolOutput.length > OUTPUT_LIMIT
? `${toolOutput.slice(0, OUTPUT_LIMIT)}...(truncated)`
: toolOutput;
Expand Down
34 changes: 17 additions & 17 deletions packages/agent/src/core/toolAgent.respawn.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { describe, it, expect, vi, beforeEach } from 'vitest';

import { toolAgent } from "../../src/core/toolAgent.js";
import { getTools } from "../../src/tools/getTools.js";
import { Logger } from "../../src/utils/logger.js";
import { toolAgent } from '../../src/core/toolAgent.js';
import { getTools } from '../../src/tools/getTools.js';
import { Logger } from '../../src/utils/logger.js';

// Mock Anthropic SDK
vi.mock("@anthropic-ai/sdk", () => {
vi.mock('@anthropic-ai/sdk', () => {
return {
default: vi.fn().mockImplementation(() => ({
messages: {
Expand All @@ -14,10 +14,10 @@ vi.mock("@anthropic-ai/sdk", () => {
.mockResolvedValueOnce({
content: [
{
type: "tool_use",
name: "respawn",
id: "test-id",
input: { respawnContext: "new context" },
type: 'tool_use',
name: 'respawn',
id: 'test-id',
input: { respawnContext: 'new context' },
},
],
usage: { input_tokens: 10, output_tokens: 10 },
Expand All @@ -31,26 +31,26 @@ vi.mock("@anthropic-ai/sdk", () => {
};
});

describe("toolAgent respawn functionality", () => {
const mockLogger = new Logger({ name: "test" });
describe('toolAgent respawn functionality', () => {
const mockLogger = new Logger({ name: 'test' });
const tools = getTools();

beforeEach(() => {
process.env.ANTHROPIC_API_KEY = "test-key";
process.env.ANTHROPIC_API_KEY = 'test-key';
vi.clearAllMocks();
});

it("should handle respawn tool calls", async () => {
const result = await toolAgent("initial prompt", tools, mockLogger, {
it('should handle respawn tool calls', async () => {
const result = await toolAgent('initial prompt', tools, mockLogger, {
maxIterations: 2, // Need at least 2 iterations for respawn + empty response
model: "test-model",
model: 'test-model',
maxTokens: 100,
temperature: 0,
getSystemPrompt: () => "test system prompt",
getSystemPrompt: () => 'test system prompt',
});

expect(result.result).toBe(
"Maximum sub-agent iterations reach without successful completion",
'Maximum sub-agent iterations reach without successful completion',
);
});
});
Loading