Skip to content

Commit a46da37

Browse files
committed
update format
1 parent e19e066 commit a46da37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6556
-6555
lines changed

biome.json

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3-
"vcs": {
4-
"enabled": true,
5-
"clientKind": "git",
6-
"useIgnoreFile": true
7-
},
8-
"files": {
9-
"ignoreUnknown": false
10-
},
11-
"formatter": {
12-
"enabled": true,
13-
"indentStyle": "tab"
14-
},
15-
"linter": {
16-
"enabled": true,
17-
"rules": {
18-
"recommended": true
19-
}
20-
},
21-
"javascript": {
22-
"formatter": {
23-
"quoteStyle": "double"
24-
}
25-
},
26-
"assist": {
27-
"enabled": true,
28-
"actions": {
29-
"source": {
30-
"organizeImports": "on"
31-
}
32-
}
33-
}
2+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "space",
14+
"indentWidth": 2
15+
},
16+
"linter": {
17+
"enabled": true,
18+
"rules": {
19+
"recommended": true
20+
}
21+
},
22+
"javascript": {
23+
"formatter": {
24+
"quoteStyle": "double"
25+
}
26+
},
27+
"assist": {
28+
"enabled": true,
29+
"actions": {
30+
"source": {
31+
"organizeImports": "on"
32+
}
33+
}
34+
}
3435
}

conductor.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"scripts": {
3-
"setup": "./conductor-setup.sh"
4-
}
2+
"scripts": {
3+
"setup": "./conductor-setup.sh"
4+
}
55
}

package.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
{
2-
"name": "open-harness",
3-
"module": "src/index.ts",
4-
"type": "module",
5-
"private": true,
6-
"bin": {
7-
"deep-agent": "./src/cli/index.ts"
8-
},
9-
"exports": {
10-
".": "./src/index.ts",
11-
"./agent": "./src/agent/index.ts",
12-
"./cli": "./src/cli/index.ts",
13-
"./tui": "./src/tui/index.tsx"
14-
},
15-
"scripts": {
16-
"dev": "bun run src/cli/index.ts",
17-
"typecheck": "tsc --noEmit",
18-
"format": "biome format --write"
19-
},
20-
"devDependencies": {
21-
"@ai-sdk/devtools": "^0.0.2",
22-
"@biomejs/biome": "2.3.11",
23-
"@types/bun": "latest",
24-
"@types/node": "^22"
25-
},
26-
"peerDependencies": {
27-
"typescript": "^5"
28-
},
29-
"dependencies": {
30-
"@ai-sdk/anthropic": "^3.0.1",
31-
"@ai-sdk/react": "^3.0.3",
32-
"@types/react": "^19.2.7",
33-
"@vercel/sandbox": "^1.1.2",
34-
"ai": "^6.0.3",
35-
"cli-highlight": "^2.1.11",
36-
"ink": "^6.6.0",
37-
"ink-spinner": "^5.0.0",
38-
"ink-text-input": "^6.0.0",
39-
"marked": "^17.0.1",
40-
"react": "^19.2.3",
41-
"zod": "^3.24.0"
42-
}
2+
"name": "open-harness",
3+
"module": "src/index.ts",
4+
"type": "module",
5+
"private": true,
6+
"bin": {
7+
"deep-agent": "./src/cli/index.ts"
8+
},
9+
"exports": {
10+
".": "./src/index.ts",
11+
"./agent": "./src/agent/index.ts",
12+
"./cli": "./src/cli/index.ts",
13+
"./tui": "./src/tui/index.tsx"
14+
},
15+
"scripts": {
16+
"dev": "bun run src/cli/index.ts",
17+
"typecheck": "tsc --noEmit",
18+
"format": "biome format --write"
19+
},
20+
"devDependencies": {
21+
"@ai-sdk/devtools": "^0.0.2",
22+
"@biomejs/biome": "2.3.11",
23+
"@types/bun": "latest",
24+
"@types/node": "^22"
25+
},
26+
"peerDependencies": {
27+
"typescript": "^5"
28+
},
29+
"dependencies": {
30+
"@ai-sdk/anthropic": "^3.0.1",
31+
"@ai-sdk/react": "^3.0.3",
32+
"@types/react": "^19.2.7",
33+
"@vercel/sandbox": "^1.1.2",
34+
"ai": "^6.0.3",
35+
"cli-highlight": "^2.1.11",
36+
"ink": "^6.6.0",
37+
"ink-spinner": "^5.0.0",
38+
"ink-text-input": "^6.0.0",
39+
"marked": "^17.0.1",
40+
"react": "^19.2.3",
41+
"zod": "^3.24.0"
42+
}
4343
}

src/agent/deep-agent.ts

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ToolLoopAgent, stepCountIs, type TypedToolResult } from "ai";
22
import { z } from "zod";
33
import {
4-
todoWriteTool,
5-
readFileTool,
6-
writeFileTool,
7-
editFileTool,
8-
grepTool,
9-
globTool,
10-
bashTool,
11-
taskTool,
4+
todoWriteTool,
5+
readFileTool,
6+
writeFileTool,
7+
editFileTool,
8+
grepTool,
9+
globTool,
10+
bashTool,
11+
taskTool,
1212
} from "./tools";
1313
import { buildSystemPrompt } from "./system-prompt";
1414
import type { TodoItem, AgentMode, ApprovalRule } from "./types";
@@ -21,88 +21,88 @@ const agentModeSchema = z.enum(["interactive", "background"]);
2121
const autoApproveSchema = z.enum(["off", "edits", "all"]);
2222

2323
const callOptionsSchema = z.object({
24-
workingDirectory: z.string(),
25-
mode: agentModeSchema.optional(),
26-
customInstructions: z.string().optional(),
27-
sandbox: z.custom<Sandbox>().optional(),
28-
autoApprove: autoApproveSchema.optional(),
29-
approvalRules: z.array(approvalRuleSchema).optional(),
24+
workingDirectory: z.string(),
25+
mode: agentModeSchema.optional(),
26+
customInstructions: z.string().optional(),
27+
sandbox: z.custom<Sandbox>().optional(),
28+
autoApprove: autoApproveSchema.optional(),
29+
approvalRules: z.array(approvalRuleSchema).optional(),
3030
});
3131

3232
export type DeepAgentCallOptions = z.infer<typeof callOptionsSchema>;
3333

3434
const model = gateway("anthropic/claude-haiku-4.5", {
35-
devtools: true,
35+
devtools: true,
3636
});
3737

3838
export const deepAgentModelId = model.modelId;
3939

4040
export const deepAgent = new ToolLoopAgent({
41-
model,
42-
instructions: buildSystemPrompt({}),
43-
tools: addCacheControl({
44-
tools: {
45-
todo_write: todoWriteTool,
46-
read: readFileTool(),
47-
write: writeFileTool({ needsApproval: true }),
48-
edit: editFileTool({ needsApproval: true }),
49-
grep: grepTool(),
50-
glob: globTool(),
51-
bash: bashTool({ needsApproval: true }),
52-
task: taskTool,
53-
},
54-
model,
55-
}),
56-
stopWhen: stepCountIs(50),
57-
callOptionsSchema,
58-
prepareStep: ({ messages, model, steps }) => ({
59-
messages: addCacheControl({
60-
messages: compactContext({ messages, steps }),
61-
model,
62-
}),
63-
}),
64-
prepareCall: ({ options, model, ...settings }) => {
65-
const workingDirectory = options?.workingDirectory ?? process.cwd();
66-
const mode: AgentMode = options?.mode ?? "interactive";
67-
const autoApprove = options?.autoApprove ?? "off";
68-
const approvalRules: ApprovalRule[] = options?.approvalRules ?? [];
41+
model,
42+
instructions: buildSystemPrompt({}),
43+
tools: addCacheControl({
44+
tools: {
45+
todo_write: todoWriteTool,
46+
read: readFileTool(),
47+
write: writeFileTool({ needsApproval: true }),
48+
edit: editFileTool({ needsApproval: true }),
49+
grep: grepTool(),
50+
glob: globTool(),
51+
bash: bashTool({ needsApproval: true }),
52+
task: taskTool,
53+
},
54+
model,
55+
}),
56+
stopWhen: stepCountIs(50),
57+
callOptionsSchema,
58+
prepareStep: ({ messages, model, steps }) => ({
59+
messages: addCacheControl({
60+
messages: compactContext({ messages, steps }),
61+
model,
62+
}),
63+
}),
64+
prepareCall: ({ options, model, ...settings }) => {
65+
const workingDirectory = options?.workingDirectory ?? process.cwd();
66+
const mode: AgentMode = options?.mode ?? "interactive";
67+
const autoApprove = options?.autoApprove ?? "off";
68+
const approvalRules: ApprovalRule[] = options?.approvalRules ?? [];
6969

70-
const customInstructions = options?.customInstructions;
70+
const customInstructions = options?.customInstructions;
7171

72-
// Use provided sandbox, or create a local sandbox with the working directory
73-
const sandbox = options?.sandbox ?? createLocalSandbox(workingDirectory);
72+
// Use provided sandbox, or create a local sandbox with the working directory
73+
const sandbox = options?.sandbox ?? createLocalSandbox(workingDirectory);
7474

75-
return {
76-
...settings,
77-
model,
78-
instructions: buildSystemPrompt({
79-
cwd: sandbox.workingDirectory,
80-
mode,
81-
currentBranch: sandbox.currentBranch,
82-
customInstructions,
83-
}),
84-
experimental_context: { sandbox, mode, autoApprove, approvalRules },
85-
};
86-
},
87-
onFinish: async ({ experimental_context }) => {
88-
try {
89-
const sandbox = getSandbox(experimental_context);
90-
await sandbox.stop();
91-
} catch {
92-
// Sandbox not available, nothing to clean up
93-
}
94-
},
75+
return {
76+
...settings,
77+
model,
78+
instructions: buildSystemPrompt({
79+
cwd: sandbox.workingDirectory,
80+
mode,
81+
currentBranch: sandbox.currentBranch,
82+
customInstructions,
83+
}),
84+
experimental_context: { sandbox, mode, autoApprove, approvalRules },
85+
};
86+
},
87+
onFinish: async ({ experimental_context }) => {
88+
try {
89+
const sandbox = getSandbox(experimental_context);
90+
await sandbox.stop();
91+
} catch {
92+
// Sandbox not available, nothing to clean up
93+
}
94+
},
9595
});
9696

9797
export function extractTodosFromStep(
98-
toolResults: Array<TypedToolResult<typeof deepAgent.tools>>,
98+
toolResults: Array<TypedToolResult<typeof deepAgent.tools>>,
9999
): TodoItem[] | null {
100-
for (const result of toolResults) {
101-
if (!result.dynamic && result.toolName === "todo_write" && result.output) {
102-
return result.output.todos;
103-
}
104-
}
105-
return null;
100+
for (const result of toolResults) {
101+
if (!result.dynamic && result.toolName === "todo_write" && result.output) {
102+
return result.output.todos;
103+
}
104+
}
105+
return null;
106106
}
107107

108108
export type DeepAgent = typeof deepAgent;

src/agent/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export { deepAgent, extractTodosFromStep } from "./deep-agent";
22
export type { DeepAgentCallOptions } from "./deep-agent";
33
export type {
4-
TodoItem,
5-
TodoStatus,
6-
AgentMode,
4+
TodoItem,
5+
TodoStatus,
6+
AgentMode,
77
} from "./types";
88
export { DEEP_AGENT_SYSTEM_PROMPT, buildSystemPrompt } from "./system-prompt";
99
export type { BuildSystemPromptOptions } from "./system-prompt";

src/agent/sandbox/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type { Sandbox, SandboxStats, ExecResult } from "./interface";
22
export { LocalSandbox, createLocalSandbox } from "./local";
33
export {
4-
VercelSandbox,
5-
createVercelSandbox,
6-
type VercelSandboxConfig,
4+
VercelSandbox,
5+
createVercelSandbox,
6+
type VercelSandboxConfig,
77
} from "./vercel";

0 commit comments

Comments
 (0)