@townco/agent 0.1.42 → 0.1.44
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/dist/acp-server/cli.d.ts +1 -3
- package/dist/acp-server/test-acp-summarize.d.ts +7 -0
- package/dist/acp-server/test-acp-summarize.js +127 -0
- package/dist/acp-server/test-summarizer.d.ts +7 -0
- package/dist/acp-server/test-summarizer.js +170 -0
- package/dist/acp-server/tool-summarizer.d.ts +125 -0
- package/dist/acp-server/tool-summarizer.js +182 -0
- package/dist/bin.js +0 -0
- package/dist/definition/index.d.ts +2 -0
- package/dist/definition/index.js +2 -0
- package/dist/definition/mcp.js +1 -0
- package/dist/runner/agent-runner.d.ts +6 -1
- package/dist/runner/index.d.ts +1 -3
- package/dist/runner/langchain/index.js +16 -2
- package/dist/runner/langchain/tools/filesystem.js +6 -0
- package/dist/runner/langchain/tools/todo.js +2 -0
- package/dist/runner/langchain/tools/web_search.js +4 -0
- package/dist/runner/tool-loader.d.ts +4 -0
- package/dist/runner/tool-loader.js +2 -0
- package/dist/runner/tools.d.ts +4 -0
- package/dist/runner/tools.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/tool.d.ts +2 -0
- package/dist/utils/tool.js +2 -0
- package/package.json +5 -5
- package/dist/definition/tools/todo.d.ts +0 -49
- package/dist/definition/tools/todo.js +0 -80
- package/dist/definition/tools/web_search.d.ts +0 -4
- package/dist/definition/tools/web_search.js +0 -26
- package/dist/dev-agent/index.d.ts +0 -2
- package/dist/dev-agent/index.js +0 -18
- package/dist/example.d.ts +0 -2
- package/dist/example.js +0 -19
package/dist/utils/tool.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type DirectTool = {
|
|
|
11
11
|
description: string;
|
|
12
12
|
fn: (input: unknown) => unknown | Promise<unknown>;
|
|
13
13
|
schema: z.ZodTypeAny;
|
|
14
|
+
prettyName?: string;
|
|
15
|
+
icon?: string;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Transforms an imported custom tool module into a DirectTool that can be
|
package/dist/utils/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"files": [
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@langchain/google-genai": "^1.0.3",
|
|
57
57
|
"@langchain/google-vertexai": "^1.0.3",
|
|
58
58
|
"@langchain/mcp-adapters": "^1.0.0",
|
|
59
|
-
"@townco/core": "0.0.
|
|
60
|
-
"@townco/gui-template": "0.1.
|
|
61
|
-
"@townco/tsconfig": "0.1.
|
|
62
|
-
"@townco/ui": "0.1.
|
|
59
|
+
"@townco/core": "0.0.17",
|
|
60
|
+
"@townco/gui-template": "0.1.36",
|
|
61
|
+
"@townco/tsconfig": "0.1.36",
|
|
62
|
+
"@townco/ui": "0.1.39",
|
|
63
63
|
"exa-js": "^2.0.0",
|
|
64
64
|
"hono": "^4.10.4",
|
|
65
65
|
"langchain": "^1.0.3",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
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,80 +0,0 @@
|
|
|
1
|
-
import { tool } from "langchain";
|
|
2
|
-
import { z } from "zod";
|
|
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),
|
|
7
|
-
});
|
|
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.
|
|
16
|
-
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
17
|
-
|
|
18
|
-
## When to Use This Tool
|
|
19
|
-
Use this tool proactively in these scenarios:
|
|
20
|
-
|
|
21
|
-
1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
|
|
22
|
-
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
|
|
23
|
-
3. User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
24
|
-
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
25
|
-
5. After receiving new instructions - Immediately capture user requirements as todos
|
|
26
|
-
6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
|
|
27
|
-
7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
|
|
28
|
-
|
|
29
|
-
## When NOT to Use This Tool
|
|
30
|
-
|
|
31
|
-
Skip using this tool when:
|
|
32
|
-
1. There is only a single, straightforward task
|
|
33
|
-
2. The task is trivial and tracking it provides no organizational benefit
|
|
34
|
-
3. The task can be completed in less than 3 trivial steps
|
|
35
|
-
4. The task is purely conversational or informational
|
|
36
|
-
|
|
37
|
-
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
38
|
-
|
|
39
|
-
## Task States and Management
|
|
40
|
-
|
|
41
|
-
1. **Task States**: Use these states to track progress:
|
|
42
|
-
- pending: Task not yet started
|
|
43
|
-
- in_progress: Currently working on (limit to ONE task at a time)
|
|
44
|
-
- completed: Task finished successfully
|
|
45
|
-
|
|
46
|
-
**IMPORTANT**: Task descriptions must have two forms:
|
|
47
|
-
- content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
|
|
48
|
-
- activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
|
|
49
|
-
|
|
50
|
-
2. **Task Management**:
|
|
51
|
-
- Update task status in real-time as you work
|
|
52
|
-
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
|
|
53
|
-
- Exactly ONE task must be in_progress at any time (not less, not more)
|
|
54
|
-
- Complete current tasks before starting new ones
|
|
55
|
-
- Remove tasks that are no longer relevant from the list entirely
|
|
56
|
-
|
|
57
|
-
3. **Task Completion Requirements**:
|
|
58
|
-
- ONLY mark a task as completed when you have FULLY accomplished it
|
|
59
|
-
- If you encounter errors, blockers, or cannot finish, keep the task as in_progress
|
|
60
|
-
- When blocked, create a new task describing what needs to be resolved
|
|
61
|
-
- Never mark a task as completed if:
|
|
62
|
-
- Tests are failing
|
|
63
|
-
- Implementation is partial
|
|
64
|
-
- You encountered unresolved errors
|
|
65
|
-
- You couldn't find necessary files or dependencies
|
|
66
|
-
|
|
67
|
-
4. **Task Breakdown**:
|
|
68
|
-
- Create specific, actionable items
|
|
69
|
-
- Break complex tasks into smaller, manageable steps
|
|
70
|
-
- Use clear, descriptive task names
|
|
71
|
-
- Always provide both forms:
|
|
72
|
-
- content: "Fix authentication bug"
|
|
73
|
-
- activeForm: "Fixing authentication bug"
|
|
74
|
-
|
|
75
|
-
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.`,
|
|
76
|
-
schema: z.object({
|
|
77
|
-
todos: z.array(todoItemSchema),
|
|
78
|
-
}),
|
|
79
|
-
},
|
|
80
|
-
);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ExaSearchResults } from "@langchain/exa";
|
|
2
|
-
import Exa from "exa-js";
|
|
3
|
-
|
|
4
|
-
let _webSearchInstance = null;
|
|
5
|
-
export function makeWebSearchTool() {
|
|
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;
|
|
26
|
-
}
|
package/dist/dev-agent/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { makeHttpTransport, makeStdioTransport } from "../acp-server/index";
|
|
5
|
-
// Load agent definition from JSON file
|
|
6
|
-
const configPath = join(import.meta.dir, "agent.json");
|
|
7
|
-
const agent = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
8
|
-
const transport = process.argv[2] || "stdio";
|
|
9
|
-
if (transport === "http") {
|
|
10
|
-
makeHttpTransport(agent);
|
|
11
|
-
}
|
|
12
|
-
else if (transport === "stdio") {
|
|
13
|
-
makeStdioTransport(agent);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
console.error(`Invalid transport: ${transport}`);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
package/dist/example.d.ts
DELETED
package/dist/example.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import { makeHttpTransport, makeStdioTransport } from "./acp-server/index.js";
|
|
3
|
-
|
|
4
|
-
const exampleAgent = {
|
|
5
|
-
model: "claude-sonnet-4-5-20250929",
|
|
6
|
-
systemPrompt: "You are a helpful assistant.",
|
|
7
|
-
tools: ["todo_write", "get_weather", "web_search"],
|
|
8
|
-
};
|
|
9
|
-
// Parse transport type from command line argument
|
|
10
|
-
const transport = process.argv[2] || "stdio";
|
|
11
|
-
if (transport === "http") {
|
|
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);
|
|
19
|
-
}
|