@townco/agent 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.ts +3 -0
- package/dist/acp-server/adapter.d.ts +14 -10
- package/dist/acp-server/adapter.js +73 -72
- package/dist/acp-server/cli.d.ts +3 -1
- package/dist/acp-server/cli.js +9 -5
- package/dist/acp-server/http.d.ts +3 -1
- package/dist/acp-server/http.js +173 -163
- package/dist/definition/index.d.ts +2 -0
- package/dist/definition/index.js +1 -0
- package/dist/definition/mcp.js +0 -1
- package/dist/definition/tools/todo.d.ts +48 -32
- package/dist/definition/tools/todo.js +16 -13
- package/dist/definition/tools/web_search.d.ts +1 -1
- package/dist/definition/tools/web_search.js +21 -18
- package/dist/example.js +11 -12
- package/dist/index.js +12 -13
- package/dist/runner/agent-runner.d.ts +1 -0
- package/dist/runner/agent-runner.js +4 -4
- package/dist/runner/index.d.ts +3 -1
- package/dist/runner/index.js +18 -14
- package/dist/runner/langchain/index.d.ts +18 -7
- package/dist/runner/langchain/index.js +2 -1
- package/dist/runner/langchain/tools/todo.d.ts +48 -32
- package/dist/runner/langchain/tools/todo.js +16 -13
- package/dist/runner/langchain/tools/web_search.d.ts +1 -1
- package/dist/runner/langchain/tools/web_search.js +21 -18
- package/dist/runner/tools.d.ts +7 -1
- package/dist/runner/tools.js +3 -3
- package/dist/scaffold/bundle.d.ts +1 -1
- package/dist/scaffold/bundle.js +1 -1
- package/dist/scaffold/copy-gui.js +5 -7
- package/dist/scaffold/index.d.ts +10 -8
- package/dist/scaffold/index.js +90 -82
- package/dist/storage/index.js +23 -24
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.js +17 -15
- package/dist/test-script.js +12 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +22 -0
- package/package.json +7 -34
- package/templates/index.ts +17 -18
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const todoItemSchema: z.ZodObject<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
export declare const todoItemSchema: z.ZodObject<
|
|
3
|
+
{
|
|
4
|
+
content: z.ZodString;
|
|
5
|
+
status: z.ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
in_progress: "in_progress";
|
|
8
|
+
completed: "completed";
|
|
9
|
+
}>;
|
|
10
|
+
activeForm: z.ZodString;
|
|
11
|
+
},
|
|
12
|
+
z.core.$strip
|
|
13
|
+
>;
|
|
14
|
+
export declare const todoWrite: import("langchain").DynamicStructuredTool<
|
|
15
|
+
z.ZodObject<
|
|
16
|
+
{
|
|
17
|
+
todos: z.ZodArray<
|
|
18
|
+
z.ZodObject<
|
|
19
|
+
{
|
|
20
|
+
content: z.ZodString;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
pending: "pending";
|
|
23
|
+
in_progress: "in_progress";
|
|
24
|
+
completed: "completed";
|
|
25
|
+
}>;
|
|
26
|
+
activeForm: z.ZodString;
|
|
27
|
+
},
|
|
28
|
+
z.core.$strip
|
|
29
|
+
>
|
|
30
|
+
>;
|
|
31
|
+
},
|
|
32
|
+
z.core.$strip
|
|
33
|
+
>,
|
|
34
|
+
{
|
|
35
|
+
todos: {
|
|
36
|
+
content: string;
|
|
37
|
+
status: "pending" | "in_progress" | "completed";
|
|
38
|
+
activeForm: string;
|
|
39
|
+
}[];
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
todos: {
|
|
43
|
+
content: string;
|
|
44
|
+
status: "pending" | "in_progress" | "completed";
|
|
45
|
+
activeForm: string;
|
|
46
|
+
}[];
|
|
47
|
+
},
|
|
48
|
+
string
|
|
49
|
+
>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { tool } from "langchain";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export const todoItemSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
content: z.string().min(1),
|
|
5
|
+
status: z.enum(["pending", "in_progress", "completed"]),
|
|
6
|
+
activeForm: z.string().min(1),
|
|
7
7
|
});
|
|
8
|
-
export const todoWrite = tool(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const todoWrite = tool(
|
|
9
|
+
({ todos }) => {
|
|
10
|
+
// Simple implementation that confirms the todos were written
|
|
11
|
+
return `Successfully updated todo list with ${todos.length} items`;
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "todo_write",
|
|
15
|
+
description: `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
14
16
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
15
17
|
|
|
16
18
|
## When to Use This Tool
|
|
@@ -71,7 +73,8 @@ NOTE that you should not use this tool if there is only one trivial task to do.
|
|
|
71
73
|
- activeForm: "Fixing authentication bug"
|
|
72
74
|
|
|
73
75
|
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.`,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
76
|
+
schema: z.object({
|
|
77
|
+
todos: z.array(todoItemSchema),
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
);
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { ExaSearchResults } from "@langchain/exa";
|
|
2
2
|
import Exa from "exa-js";
|
|
3
|
+
|
|
3
4
|
let _webSearchInstance = null;
|
|
4
5
|
export function makeWebSearchTool() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
if (_webSearchInstance) {
|
|
7
|
+
return _webSearchInstance;
|
|
8
|
+
}
|
|
9
|
+
const apiKey = process.env.EXA_API_KEY;
|
|
10
|
+
if (!apiKey) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"EXA_API_KEY environment variable is required to use the web_search tool. " +
|
|
13
|
+
"Please set it to your Exa API key from https://exa.ai",
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
const client = new Exa(apiKey);
|
|
17
|
+
_webSearchInstance = new ExaSearchResults({
|
|
18
|
+
client,
|
|
19
|
+
searchArgs: {
|
|
20
|
+
numResults: 5,
|
|
21
|
+
type: "auto",
|
|
22
|
+
text: true,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return _webSearchInstance;
|
|
23
26
|
}
|
package/dist/example.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { makeHttpTransport, makeStdioTransport } from "./acp-server/index.js";
|
|
3
|
+
|
|
3
4
|
const exampleAgent = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
model: "claude-sonnet-4-5-20250929",
|
|
6
|
+
systemPrompt: "You are a helpful assistant.",
|
|
7
|
+
tools: ["todo_write", "get_weather", "web_search"],
|
|
7
8
|
};
|
|
8
9
|
// Parse transport type from command line argument
|
|
9
10
|
const transport = process.argv[2] || "stdio";
|
|
10
11
|
if (transport === "http") {
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.error("Usage: bun run example.ts [stdio|http]");
|
|
19
|
-
process.exit(1);
|
|
12
|
+
makeHttpTransport(exampleAgent);
|
|
13
|
+
} else if (transport === "stdio") {
|
|
14
|
+
makeStdioTransport(exampleAgent);
|
|
15
|
+
} else {
|
|
16
|
+
console.error(`Invalid transport: ${transport}`);
|
|
17
|
+
console.error("Usage: bun run example.ts [stdio|http]");
|
|
18
|
+
process.exit(1);
|
|
20
19
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { makeHttpTransport, makeStdioTransport } from "./acp-server";
|
|
2
|
+
|
|
2
3
|
const exampleAgent = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
model: "claude-sonnet-4-5-20250929",
|
|
5
|
+
systemPrompt: "You are a helpful assistant.",
|
|
6
|
+
tools: ["todo_write", "get_weather", "web_search"],
|
|
7
|
+
mcps: [],
|
|
7
8
|
};
|
|
8
9
|
// Parse transport type from command line argument
|
|
9
10
|
const transport = process.argv[2] || "stdio";
|
|
10
11
|
if (transport === "http") {
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.error("Usage: bun run index.ts [stdio|http]");
|
|
19
|
-
process.exit(1);
|
|
12
|
+
makeHttpTransport(exampleAgent);
|
|
13
|
+
} else if (transport === "stdio") {
|
|
14
|
+
makeStdioTransport(exampleAgent);
|
|
15
|
+
} else {
|
|
16
|
+
console.error(`Invalid transport: ${transport}`);
|
|
17
|
+
console.error("Usage: bun run index.ts [stdio|http]");
|
|
18
|
+
process.exit(1);
|
|
20
19
|
}
|
|
@@ -13,6 +13,7 @@ export declare const zAgentRunnerParams: z.ZodObject<{
|
|
|
13
13
|
name: z.ZodString;
|
|
14
14
|
transport: z.ZodLiteral<"http">;
|
|
15
15
|
url: z.ZodString;
|
|
16
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
17
|
}, z.core.$strip>]>>>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
export type CreateAgentRunnerParams = z.infer<typeof zAgentRunnerParams>;
|
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
import { McpConfigSchema } from "../definition";
|
|
3
3
|
import { zToolType } from "./tools";
|
|
4
4
|
export const zAgentRunnerParams = z.object({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
systemPrompt: z.string().nullable(),
|
|
6
|
+
model: z.string(),
|
|
7
|
+
tools: z.array(zToolType).optional(),
|
|
8
|
+
mcps: z.array(McpConfigSchema).optional(),
|
|
9
9
|
});
|
package/dist/runner/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { AgentDefinition } from "../definition";
|
|
2
2
|
import { type AgentRunner } from "./agent-runner";
|
|
3
3
|
export type { AgentRunner };
|
|
4
|
-
export declare const makeRunnerFromDefinition: (
|
|
4
|
+
export declare const makeRunnerFromDefinition: (
|
|
5
|
+
definition: AgentDefinition,
|
|
6
|
+
) => AgentRunner;
|
package/dist/runner/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { zAgentRunnerParams } from "./agent-runner";
|
|
2
2
|
import { LangchainAgent } from "./langchain";
|
|
3
3
|
export const makeRunnerFromDefinition = (definition) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const agentRunnerParams = zAgentRunnerParams.safeParse(definition);
|
|
5
|
+
if (!agentRunnerParams.success) {
|
|
6
|
+
throw new Error(
|
|
7
|
+
`Invalid agent definition: ${agentRunnerParams.error.message}`,
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
switch (definition.harnessImplementation) {
|
|
11
|
+
case undefined:
|
|
12
|
+
case "langchain": {
|
|
13
|
+
return new LangchainAgent(agentRunnerParams.data);
|
|
14
|
+
}
|
|
15
|
+
default: {
|
|
16
|
+
const _exhaustiveCheck = definition.harnessImplementation;
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Unsupported harness implementation: ${definition.harnessImplementation}`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
18
22
|
};
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
PromptResponse,
|
|
3
|
+
SessionNotification,
|
|
4
|
+
} from "@agentclientprotocol/sdk";
|
|
2
5
|
import { type DynamicStructuredTool, type Tool } from "langchain";
|
|
3
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
AgentRunner,
|
|
8
|
+
CreateAgentRunnerParams,
|
|
9
|
+
InvokeRequest,
|
|
10
|
+
} from "../agent-runner";
|
|
4
11
|
import type { ToolType } from "../tools";
|
|
5
12
|
type LangchainTool = DynamicStructuredTool | Tool;
|
|
6
13
|
/** Lazily-loaded langchain tools */
|
|
7
14
|
type LazyLangchainTool = MakeLazy<LangchainTool>;
|
|
8
15
|
type MakeLazy<T> = T extends LangchainTool ? () => T : never;
|
|
9
|
-
export declare const TOOL_REGISTRY: Record<
|
|
16
|
+
export declare const TOOL_REGISTRY: Record<
|
|
17
|
+
ToolType,
|
|
18
|
+
LangchainTool | LazyLangchainTool
|
|
19
|
+
>;
|
|
10
20
|
export declare class LangchainAgent implements AgentRunner {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
definition: CreateAgentRunnerParams;
|
|
22
|
+
constructor(params: CreateAgentRunnerParams);
|
|
23
|
+
invoke(
|
|
24
|
+
req: InvokeRequest,
|
|
25
|
+
): AsyncGenerator<SessionNotification["update"], PromptResponse, undefined>;
|
|
14
26
|
}
|
|
15
|
-
export {};
|
|
@@ -198,6 +198,7 @@ const makeMcpToolsClient = (mcpConfigs) => {
|
|
|
198
198
|
config.name,
|
|
199
199
|
{
|
|
200
200
|
url: config.url,
|
|
201
|
+
headers: config.headers,
|
|
201
202
|
},
|
|
202
203
|
];
|
|
203
204
|
}
|
|
@@ -206,7 +207,7 @@ const makeMcpToolsClient = (mcpConfigs) => {
|
|
|
206
207
|
{
|
|
207
208
|
transport: "stdio",
|
|
208
209
|
command: config.command,
|
|
209
|
-
args: config.args,
|
|
210
|
+
args: config.args ?? [],
|
|
210
211
|
},
|
|
211
212
|
];
|
|
212
213
|
});
|
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const todoItemSchema: z.ZodObject<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
export declare const todoItemSchema: z.ZodObject<
|
|
3
|
+
{
|
|
4
|
+
content: z.ZodString;
|
|
5
|
+
status: z.ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
in_progress: "in_progress";
|
|
8
|
+
completed: "completed";
|
|
9
|
+
}>;
|
|
10
|
+
activeForm: z.ZodString;
|
|
11
|
+
},
|
|
12
|
+
z.core.$strip
|
|
13
|
+
>;
|
|
14
|
+
export declare const todoWrite: import("langchain").DynamicStructuredTool<
|
|
15
|
+
z.ZodObject<
|
|
16
|
+
{
|
|
17
|
+
todos: z.ZodArray<
|
|
18
|
+
z.ZodObject<
|
|
19
|
+
{
|
|
20
|
+
content: z.ZodString;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
pending: "pending";
|
|
23
|
+
in_progress: "in_progress";
|
|
24
|
+
completed: "completed";
|
|
25
|
+
}>;
|
|
26
|
+
activeForm: z.ZodString;
|
|
27
|
+
},
|
|
28
|
+
z.core.$strip
|
|
29
|
+
>
|
|
30
|
+
>;
|
|
31
|
+
},
|
|
32
|
+
z.core.$strip
|
|
33
|
+
>,
|
|
34
|
+
{
|
|
35
|
+
todos: {
|
|
36
|
+
content: string;
|
|
37
|
+
status: "pending" | "in_progress" | "completed";
|
|
38
|
+
activeForm: string;
|
|
39
|
+
}[];
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
todos: {
|
|
43
|
+
content: string;
|
|
44
|
+
status: "pending" | "in_progress" | "completed";
|
|
45
|
+
activeForm: string;
|
|
46
|
+
}[];
|
|
47
|
+
},
|
|
48
|
+
string
|
|
49
|
+
>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { tool } from "langchain";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export const todoItemSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
content: z.string().min(1),
|
|
5
|
+
status: z.enum(["pending", "in_progress", "completed"]),
|
|
6
|
+
activeForm: z.string().min(1),
|
|
7
7
|
});
|
|
8
|
-
export const todoWrite = tool(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const todoWrite = tool(
|
|
9
|
+
({ todos }) => {
|
|
10
|
+
// Simple implementation that confirms the todos were written
|
|
11
|
+
return `Successfully updated todo list with ${todos.length} items`;
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "todo_write",
|
|
15
|
+
description: `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
14
16
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
15
17
|
|
|
16
18
|
## When to Use This Tool
|
|
@@ -71,7 +73,8 @@ NOTE that you should not use this tool if there is only one trivial task to do.
|
|
|
71
73
|
- activeForm: "Fixing authentication bug"
|
|
72
74
|
|
|
73
75
|
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.`,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
76
|
+
schema: z.object({
|
|
77
|
+
todos: z.array(todoItemSchema),
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
);
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { ExaSearchResults } from "@langchain/exa";
|
|
2
2
|
import Exa from "exa-js";
|
|
3
|
+
|
|
3
4
|
let _webSearchInstance = null;
|
|
4
5
|
export function makeWebSearchTool() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
if (_webSearchInstance) {
|
|
7
|
+
return _webSearchInstance;
|
|
8
|
+
}
|
|
9
|
+
const apiKey = process.env.EXA_API_KEY;
|
|
10
|
+
if (!apiKey) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"EXA_API_KEY environment variable is required to use the web_search tool. " +
|
|
13
|
+
"Please set it to your Exa API key from https://exa.ai",
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
const client = new Exa(apiKey);
|
|
17
|
+
_webSearchInstance = new ExaSearchResults({
|
|
18
|
+
client,
|
|
19
|
+
searchArgs: {
|
|
20
|
+
numResults: 5,
|
|
21
|
+
type: "auto",
|
|
22
|
+
text: true,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return _webSearchInstance;
|
|
23
26
|
}
|
package/dist/runner/tools.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const zToolType: z.ZodUnion<
|
|
2
|
+
export declare const zToolType: z.ZodUnion<
|
|
3
|
+
readonly [
|
|
4
|
+
z.ZodLiteral<"todo_write">,
|
|
5
|
+
z.ZodLiteral<"get_weather">,
|
|
6
|
+
z.ZodLiteral<"web_search">,
|
|
7
|
+
]
|
|
8
|
+
>;
|
|
3
9
|
export type ToolType = z.infer<typeof zToolType>;
|
package/dist/runner/tools.js
CHANGED
package/dist/scaffold/bundle.js
CHANGED
|
@@ -10,7 +10,7 @@ function getAgentPackageDir() {
|
|
|
10
10
|
return join(dirname(currentFile), "..");
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Copy necessary files from @
|
|
13
|
+
* Copy necessary files from @town/agent to the agent directory
|
|
14
14
|
*/
|
|
15
15
|
export async function bundleAgentDependencies(agentPath) {
|
|
16
16
|
const sourceDir = getAgentPackageDir();
|
|
@@ -6,18 +6,16 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
*/
|
|
7
7
|
function getGuiSourceDir() {
|
|
8
8
|
const currentFile = fileURLToPath(import.meta.url);
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
return join(dirname(currentFile), "..", "..", "..", "..", "apps", "gui");
|
|
9
|
+
// scaffold/copy-gui.ts -> scaffold -> packages/agent -> packages -> root -> apps/gui
|
|
10
|
+
return join(dirname(currentFile), "..", "..", "..", "apps", "gui");
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* Get the source packages/ui directory
|
|
15
14
|
*/
|
|
16
15
|
function getUiSourceDir() {
|
|
17
16
|
const currentFile = fileURLToPath(import.meta.url);
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
return join(dirname(currentFile), "..", "..", "..", "ui");
|
|
17
|
+
// scaffold/copy-gui.ts -> scaffold -> packages/agent -> packages -> ui
|
|
18
|
+
return join(dirname(currentFile), "..", "..", "ui");
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* Copy GUI app to the agent directory
|
|
@@ -85,7 +83,7 @@ export default defineConfig({
|
|
|
85
83
|
plugins: [react()],
|
|
86
84
|
resolve: {
|
|
87
85
|
alias: {
|
|
88
|
-
"@
|
|
86
|
+
"@town/ui": resolve(__dirname, "./ui/src"),
|
|
89
87
|
// Exclude Node.js-only modules from browser bundle
|
|
90
88
|
"node:child_process": resolve(__dirname, "./polyfills/child_process.js"),
|
|
91
89
|
"node:stream": resolve(__dirname, "./polyfills/stream.js"),
|
package/dist/scaffold/index.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { AgentDefinition } from "../definition";
|
|
2
2
|
export interface ScaffoldOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
name: string;
|
|
4
|
+
definition: AgentDefinition;
|
|
5
|
+
overwrite?: boolean;
|
|
6
|
+
includeGui?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface ScaffoldResult {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
success: boolean;
|
|
10
|
+
path: string;
|
|
11
|
+
error?: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Scaffold a new agent package
|
|
15
15
|
*/
|
|
16
|
-
export declare function scaffoldAgent(
|
|
16
|
+
export declare function scaffoldAgent(
|
|
17
|
+
options: ScaffoldOptions,
|
|
18
|
+
): Promise<ScaffoldResult>;
|