@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.
Files changed (41) hide show
  1. package/bin.ts +3 -0
  2. package/dist/acp-server/adapter.d.ts +14 -10
  3. package/dist/acp-server/adapter.js +73 -72
  4. package/dist/acp-server/cli.d.ts +3 -1
  5. package/dist/acp-server/cli.js +9 -5
  6. package/dist/acp-server/http.d.ts +3 -1
  7. package/dist/acp-server/http.js +173 -163
  8. package/dist/definition/index.d.ts +2 -0
  9. package/dist/definition/index.js +1 -0
  10. package/dist/definition/mcp.js +0 -1
  11. package/dist/definition/tools/todo.d.ts +48 -32
  12. package/dist/definition/tools/todo.js +16 -13
  13. package/dist/definition/tools/web_search.d.ts +1 -1
  14. package/dist/definition/tools/web_search.js +21 -18
  15. package/dist/example.js +11 -12
  16. package/dist/index.js +12 -13
  17. package/dist/runner/agent-runner.d.ts +1 -0
  18. package/dist/runner/agent-runner.js +4 -4
  19. package/dist/runner/index.d.ts +3 -1
  20. package/dist/runner/index.js +18 -14
  21. package/dist/runner/langchain/index.d.ts +18 -7
  22. package/dist/runner/langchain/index.js +2 -1
  23. package/dist/runner/langchain/tools/todo.d.ts +48 -32
  24. package/dist/runner/langchain/tools/todo.js +16 -13
  25. package/dist/runner/langchain/tools/web_search.d.ts +1 -1
  26. package/dist/runner/langchain/tools/web_search.js +21 -18
  27. package/dist/runner/tools.d.ts +7 -1
  28. package/dist/runner/tools.js +3 -3
  29. package/dist/scaffold/bundle.d.ts +1 -1
  30. package/dist/scaffold/bundle.js +1 -1
  31. package/dist/scaffold/copy-gui.js +5 -7
  32. package/dist/scaffold/index.d.ts +10 -8
  33. package/dist/scaffold/index.js +90 -82
  34. package/dist/storage/index.js +23 -24
  35. package/dist/templates/index.d.ts +1 -1
  36. package/dist/templates/index.js +17 -15
  37. package/dist/test-script.js +12 -11
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/index.ts +22 -0
  40. package/package.json +7 -34
  41. package/templates/index.ts +17 -18
@@ -1,33 +1,49 @@
1
1
  import { z } from "zod";
2
- export declare const todoItemSchema: z.ZodObject<{
3
- content: z.ZodString;
4
- status: z.ZodEnum<{
5
- pending: "pending";
6
- in_progress: "in_progress";
7
- completed: "completed";
8
- }>;
9
- activeForm: z.ZodString;
10
- }, z.core.$strip>;
11
- export declare const todoWrite: import("langchain").DynamicStructuredTool<z.ZodObject<{
12
- todos: z.ZodArray<z.ZodObject<{
13
- content: z.ZodString;
14
- status: z.ZodEnum<{
15
- pending: "pending";
16
- in_progress: "in_progress";
17
- completed: "completed";
18
- }>;
19
- activeForm: z.ZodString;
20
- }, z.core.$strip>>;
21
- }, z.core.$strip>, {
22
- todos: {
23
- content: string;
24
- status: "pending" | "in_progress" | "completed";
25
- activeForm: string;
26
- }[];
27
- }, {
28
- todos: {
29
- content: string;
30
- status: "pending" | "in_progress" | "completed";
31
- activeForm: string;
32
- }[];
33
- }, string>;
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
- content: z.string().min(1),
5
- status: z.enum(["pending", "in_progress", "completed"]),
6
- activeForm: z.string().min(1),
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(({ todos }) => {
9
- // Simple implementation that confirms the todos were written
10
- return `Successfully updated todo list with ${todos.length} items`;
11
- }, {
12
- name: "todo_write",
13
- 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.
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
- schema: z.object({
75
- todos: z.array(todoItemSchema),
76
- }),
77
- });
76
+ schema: z.object({
77
+ todos: z.array(todoItemSchema),
78
+ }),
79
+ },
80
+ );
@@ -1,4 +1,4 @@
1
1
  import { ExaSearchResults } from "@langchain/exa";
2
2
  export declare function makeWebSearchTool(): ExaSearchResults<{
3
- text: true;
3
+ text: true;
4
4
  }>;
@@ -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
- if (_webSearchInstance) {
6
- return _webSearchInstance;
7
- }
8
- const apiKey = process.env.EXA_API_KEY;
9
- if (!apiKey) {
10
- throw new Error("EXA_API_KEY environment variable is required to use the web_search tool. " +
11
- "Please set it to your Exa API key from https://exa.ai");
12
- }
13
- const client = new Exa(apiKey);
14
- _webSearchInstance = new ExaSearchResults({
15
- client,
16
- searchArgs: {
17
- numResults: 5,
18
- type: "auto",
19
- text: true,
20
- },
21
- });
22
- return _webSearchInstance;
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
- model: "claude-sonnet-4-5-20250929",
5
- systemPrompt: "You are a helpful assistant.",
6
- tools: ["todo_write", "get_weather", "web_search"],
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
- makeHttpTransport(exampleAgent);
12
- }
13
- else if (transport === "stdio") {
14
- makeStdioTransport(exampleAgent);
15
- }
16
- else {
17
- console.error(`Invalid transport: ${transport}`);
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
- model: "claude-sonnet-4-5-20250929",
4
- systemPrompt: "You are a helpful assistant.",
5
- tools: ["todo_write", "get_weather", "web_search"],
6
- mcps: [],
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
- makeHttpTransport(exampleAgent);
12
- }
13
- else if (transport === "stdio") {
14
- makeStdioTransport(exampleAgent);
15
- }
16
- else {
17
- console.error(`Invalid transport: ${transport}`);
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
- systemPrompt: z.string().nullable(),
6
- model: z.string(),
7
- tools: z.array(zToolType).optional(),
8
- mcps: z.array(McpConfigSchema).optional(),
5
+ systemPrompt: z.string().nullable(),
6
+ model: z.string(),
7
+ tools: z.array(zToolType).optional(),
8
+ mcps: z.array(McpConfigSchema).optional(),
9
9
  });
@@ -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: (definition: AgentDefinition) => AgentRunner;
4
+ export declare const makeRunnerFromDefinition: (
5
+ definition: AgentDefinition,
6
+ ) => AgentRunner;
@@ -1,18 +1,22 @@
1
1
  import { zAgentRunnerParams } from "./agent-runner";
2
2
  import { LangchainAgent } from "./langchain";
3
3
  export const makeRunnerFromDefinition = (definition) => {
4
- const agentRunnerParams = zAgentRunnerParams.safeParse(definition);
5
- if (!agentRunnerParams.success) {
6
- throw new Error(`Invalid agent definition: ${agentRunnerParams.error.message}`);
7
- }
8
- switch (definition.harnessImplementation) {
9
- case undefined:
10
- case "langchain": {
11
- return new LangchainAgent(agentRunnerParams.data);
12
- }
13
- default: {
14
- const _exhaustiveCheck = definition.harnessImplementation;
15
- throw new Error(`Unsupported harness implementation: ${definition.harnessImplementation}`);
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 { PromptResponse, SessionNotification } from "@agentclientprotocol/sdk";
1
+ import type {
2
+ PromptResponse,
3
+ SessionNotification,
4
+ } from "@agentclientprotocol/sdk";
2
5
  import { type DynamicStructuredTool, type Tool } from "langchain";
3
- import type { AgentRunner, CreateAgentRunnerParams, InvokeRequest } from "../agent-runner";
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<ToolType, LangchainTool | LazyLangchainTool>;
16
+ export declare const TOOL_REGISTRY: Record<
17
+ ToolType,
18
+ LangchainTool | LazyLangchainTool
19
+ >;
10
20
  export declare class LangchainAgent implements AgentRunner {
11
- definition: CreateAgentRunnerParams;
12
- constructor(params: CreateAgentRunnerParams);
13
- invoke(req: InvokeRequest): AsyncGenerator<SessionNotification["update"], PromptResponse, undefined>;
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
- content: z.ZodString;
4
- status: z.ZodEnum<{
5
- pending: "pending";
6
- in_progress: "in_progress";
7
- completed: "completed";
8
- }>;
9
- activeForm: z.ZodString;
10
- }, z.core.$strip>;
11
- export declare const todoWrite: import("langchain").DynamicStructuredTool<z.ZodObject<{
12
- todos: z.ZodArray<z.ZodObject<{
13
- content: z.ZodString;
14
- status: z.ZodEnum<{
15
- pending: "pending";
16
- in_progress: "in_progress";
17
- completed: "completed";
18
- }>;
19
- activeForm: z.ZodString;
20
- }, z.core.$strip>>;
21
- }, z.core.$strip>, {
22
- todos: {
23
- content: string;
24
- status: "pending" | "in_progress" | "completed";
25
- activeForm: string;
26
- }[];
27
- }, {
28
- todos: {
29
- content: string;
30
- status: "pending" | "in_progress" | "completed";
31
- activeForm: string;
32
- }[];
33
- }, string>;
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
- content: z.string().min(1),
5
- status: z.enum(["pending", "in_progress", "completed"]),
6
- activeForm: z.string().min(1),
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(({ todos }) => {
9
- // Simple implementation that confirms the todos were written
10
- return `Successfully updated todo list with ${todos.length} items`;
11
- }, {
12
- name: "todo_write",
13
- 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.
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
- schema: z.object({
75
- todos: z.array(todoItemSchema),
76
- }),
77
- });
76
+ schema: z.object({
77
+ todos: z.array(todoItemSchema),
78
+ }),
79
+ },
80
+ );
@@ -1,4 +1,4 @@
1
1
  import { ExaSearchResults } from "@langchain/exa";
2
2
  export declare function makeWebSearchTool(): ExaSearchResults<{
3
- text: true;
3
+ text: true;
4
4
  }>;
@@ -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
- if (_webSearchInstance) {
6
- return _webSearchInstance;
7
- }
8
- const apiKey = process.env.EXA_API_KEY;
9
- if (!apiKey) {
10
- throw new Error("EXA_API_KEY environment variable is required to use the web_search tool. " +
11
- "Please set it to your Exa API key from https://exa.ai");
12
- }
13
- const client = new Exa(apiKey);
14
- _webSearchInstance = new ExaSearchResults({
15
- client,
16
- searchArgs: {
17
- numResults: 5,
18
- type: "auto",
19
- text: true,
20
- },
21
- });
22
- return _webSearchInstance;
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
  }
@@ -1,3 +1,9 @@
1
1
  import { z } from "zod";
2
- export declare const zToolType: z.ZodUnion<readonly [z.ZodLiteral<"todo_write">, z.ZodLiteral<"get_weather">, z.ZodLiteral<"web_search">]>;
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>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export const zToolType = z.union([
3
- z.literal("todo_write"),
4
- z.literal("get_weather"),
5
- z.literal("web_search"),
3
+ z.literal("todo_write"),
4
+ z.literal("get_weather"),
5
+ z.literal("web_search"),
6
6
  ]);
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Copy necessary files from @townco/agent to the agent directory
2
+ * Copy necessary files from @town/agent to the agent directory
3
3
  */
4
4
  export declare function bundleAgentDependencies(agentPath: string): Promise<void>;
@@ -10,7 +10,7 @@ function getAgentPackageDir() {
10
10
  return join(dirname(currentFile), "..");
11
11
  }
12
12
  /**
13
- * Copy necessary files from @townco/agent to the agent directory
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
- // When running from compiled dist:
10
- // dist/scaffold/copy-gui.js -> dist/scaffold -> dist -> packages/agent -> packages -> root -> apps/gui
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
- // When running from compiled dist:
19
- // dist/scaffold/copy-gui.js -> dist/scaffold -> dist -> packages/agent -> packages -> ui
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
- "@townco/ui": resolve(__dirname, "./ui/src"),
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"),
@@ -1,16 +1,18 @@
1
1
  import type { AgentDefinition } from "../definition";
2
2
  export interface ScaffoldOptions {
3
- name: string;
4
- definition: AgentDefinition;
5
- overwrite?: boolean;
6
- includeGui?: boolean;
3
+ name: string;
4
+ definition: AgentDefinition;
5
+ overwrite?: boolean;
6
+ includeGui?: boolean;
7
7
  }
8
8
  export interface ScaffoldResult {
9
- success: boolean;
10
- path: string;
11
- error?: string;
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(options: ScaffoldOptions): Promise<ScaffoldResult>;
16
+ export declare function scaffoldAgent(
17
+ options: ScaffoldOptions,
18
+ ): Promise<ScaffoldResult>;