@townco/agent 0.1.117 → 0.1.119
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/adapter.d.ts +3 -3
- package/dist/acp-server/adapter.js +101 -79
- package/dist/acp-server/http.js +28 -1
- package/dist/acp-server/session-storage.d.ts +27 -1
- package/dist/acp-server/session-storage.js +19 -1
- package/dist/definition/index.d.ts +4 -1
- package/dist/definition/models.d.ts +6 -0
- package/dist/definition/models.js +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +83 -0
- package/dist/runner/hooks/predefined/compaction-tool.js +13 -1
- package/dist/runner/hooks/predefined/mid-turn-compaction.js +13 -1
- package/dist/runner/hooks/types.d.ts +6 -0
- package/dist/runner/index.d.ts +2 -66
- package/dist/runner/langchain/index.js +4 -4
- package/dist/runner/langchain/tools/artifacts.d.ts +68 -0
- package/dist/runner/langchain/tools/artifacts.js +474 -0
- package/dist/runner/langchain/tools/conversation_search.d.ts +22 -0
- package/dist/runner/langchain/tools/conversation_search.js +137 -0
- package/dist/runner/langchain/tools/generate_image.d.ts +47 -0
- package/dist/runner/langchain/tools/generate_image.js +175 -0
- package/dist/runner/langchain/tools/port-utils.d.ts +8 -0
- package/dist/runner/langchain/tools/port-utils.js +35 -0
- package/dist/runner/langchain/tools/subagent-connections.d.ts +2 -0
- package/dist/runner/langchain/tools/subagent.js +230 -3
- package/dist/templates/index.d.ts +5 -1
- package/dist/templates/index.js +22 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -7
- package/templates/index.ts +31 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.119",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"files": [
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"./logger": {
|
|
47
47
|
"import": "./dist/logger.js",
|
|
48
48
|
"types": "./dist/logger.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./mcp": {
|
|
51
|
+
"import": "./dist/mcp/index.js",
|
|
52
|
+
"types": "./dist/mcp/index.d.ts"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"scripts": {
|
|
@@ -79,12 +83,12 @@
|
|
|
79
83
|
"@opentelemetry/sdk-trace-base": "^1.28.0",
|
|
80
84
|
"@opentelemetry/sdk-trace-node": "^1.28.0",
|
|
81
85
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
82
|
-
"@townco/apiclient": "0.0.
|
|
83
|
-
"@townco/core": "0.0.
|
|
84
|
-
"@townco/gui-template": "0.1.
|
|
85
|
-
"@townco/tsconfig": "0.1.
|
|
86
|
-
"@townco/tui-template": "0.1.
|
|
87
|
-
"@townco/ui": "0.1.
|
|
86
|
+
"@townco/apiclient": "0.0.31",
|
|
87
|
+
"@townco/core": "0.0.89",
|
|
88
|
+
"@townco/gui-template": "0.1.108",
|
|
89
|
+
"@townco/tsconfig": "0.1.108",
|
|
90
|
+
"@townco/tui-template": "0.1.108",
|
|
91
|
+
"@townco/ui": "0.1.111",
|
|
88
92
|
"exa-js": "^2.0.0",
|
|
89
93
|
"hono": "^4.10.4",
|
|
90
94
|
"langchain": "^1.0.3",
|
package/templates/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as prettier from "prettier";
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { AgentDefinition, McpConfigSchema } from "../definition";
|
|
4
|
+
|
|
5
|
+
type McpConfig = z.infer<typeof McpConfigSchema>;
|
|
3
6
|
|
|
4
7
|
export interface TemplateVars {
|
|
5
8
|
name: string;
|
|
@@ -20,6 +23,7 @@ export interface TemplateVars {
|
|
|
20
23
|
schema: unknown;
|
|
21
24
|
}
|
|
22
25
|
>;
|
|
26
|
+
mcps?: McpConfig[];
|
|
23
27
|
systemPrompt: string | null;
|
|
24
28
|
hasWebSearch: boolean;
|
|
25
29
|
hasGenerateImage: boolean;
|
|
@@ -75,6 +79,9 @@ export function getTemplateVars(
|
|
|
75
79
|
if (definition.suggestedPrompts) {
|
|
76
80
|
result.suggestedPrompts = definition.suggestedPrompts;
|
|
77
81
|
}
|
|
82
|
+
if (definition.mcps && definition.mcps.length > 0) {
|
|
83
|
+
result.mcps = definition.mcps;
|
|
84
|
+
}
|
|
78
85
|
|
|
79
86
|
return result;
|
|
80
87
|
}
|
|
@@ -134,21 +141,33 @@ export async function generateIndexTs(vars: TemplateVars): Promise<string> {
|
|
|
134
141
|
agentDef.systemPrompt = vars.systemPrompt;
|
|
135
142
|
agentDef.tools = vars.tools;
|
|
136
143
|
|
|
144
|
+
if (vars.mcps && vars.mcps.length > 0) {
|
|
145
|
+
agentDef.mcps = vars.mcps;
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
if (vars.hooks) {
|
|
138
149
|
agentDef.hooks = vars.hooks;
|
|
139
150
|
}
|
|
140
151
|
|
|
141
152
|
return prettier.format(
|
|
142
|
-
`import {
|
|
143
|
-
import type { AgentDefinition } from "@townco/agent/definition";
|
|
144
|
-
import { createLogger } from "@townco/agent/logger";
|
|
145
|
-
import { basename } from "node:path";
|
|
153
|
+
`import type { AgentDefinition } from "@townco/agent/definition";
|
|
146
154
|
|
|
147
|
-
const logger = createLogger("agent-index");
|
|
148
|
-
|
|
149
|
-
// Load agent definition from JSON file
|
|
150
155
|
const agent: AgentDefinition = ${JSON.stringify(agentDef)};
|
|
151
156
|
|
|
157
|
+
export default agent;
|
|
158
|
+
`,
|
|
159
|
+
{ parser: "typescript" },
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function generateBinTs(): string {
|
|
164
|
+
return `#!/usr/bin/env bun
|
|
165
|
+
import { basename } from "node:path";
|
|
166
|
+
import { makeHttpTransport, makeStdioTransport } from "@townco/agent/acp-server";
|
|
167
|
+
import { createLogger } from "@townco/agent/logger";
|
|
168
|
+
import agent from "./index";
|
|
169
|
+
|
|
170
|
+
const logger = createLogger("agent-index");
|
|
152
171
|
const transport = process.argv[2] || "stdio";
|
|
153
172
|
|
|
154
173
|
// Get agent directory and name for session storage
|
|
@@ -158,21 +177,13 @@ const agentName = basename(agentDir);
|
|
|
158
177
|
logger.info("Configuration", { transport, agentDir, agentName });
|
|
159
178
|
|
|
160
179
|
if (transport === "http") {
|
|
161
|
-
|
|
180
|
+
makeHttpTransport(agent, agentDir, agentName);
|
|
162
181
|
} else if (transport === "stdio") {
|
|
163
|
-
|
|
182
|
+
makeStdioTransport(agent);
|
|
164
183
|
} else {
|
|
165
|
-
|
|
166
|
-
|
|
184
|
+
logger.error(\`Invalid transport: \${transport}\`);
|
|
185
|
+
process.exit(1);
|
|
167
186
|
}
|
|
168
|
-
`,
|
|
169
|
-
{ parser: "typescript" },
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function generateBinTs(): string {
|
|
174
|
-
return `#!/usr/bin/env bun
|
|
175
|
-
import "./index.ts";
|
|
176
187
|
`;
|
|
177
188
|
}
|
|
178
189
|
|