@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
package/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { makeHttpTransport, makeStdioTransport } from "./acp-server";
2
+ import type { AgentDefinition } from "./definition";
3
+
4
+ const exampleAgent: AgentDefinition = {
5
+ model: "claude-sonnet-4-5-20250929",
6
+ systemPrompt: "You are a helpful assistant.",
7
+ tools: ["todo_write", "get_weather", "web_search"],
8
+ mcps: [],
9
+ };
10
+
11
+ // Parse transport type from command line argument
12
+ const transport = process.argv[2] || "stdio";
13
+
14
+ if (transport === "http") {
15
+ makeHttpTransport(exampleAgent);
16
+ } else if (transport === "stdio") {
17
+ makeStdioTransport(exampleAgent);
18
+ } else {
19
+ console.error(`Invalid transport: ${transport}`);
20
+ console.error("Usage: bun run index.ts [stdio|http]");
21
+ process.exit(1);
22
+ }
package/package.json CHANGED
@@ -1,49 +1,22 @@
1
1
  {
2
2
  "name": "@townco/agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
5
  "module": "index.ts",
8
- "bin": {
9
- "town-agent": "./dist/bin.js"
10
- },
11
- "exports": {
12
- ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
15
- },
16
- "./acp-server": {
17
- "import": "./dist/acp-server/index.js",
18
- "types": "./dist/acp-server/index.d.ts"
19
- },
20
- "./definition": {
21
- "import": "./dist/definition/index.js",
22
- "types": "./dist/definition/index.d.ts"
23
- },
24
- "./runner": {
25
- "import": "./dist/runner/index.js",
26
- "types": "./dist/runner/index.d.ts"
27
- },
28
- "./scaffold": {
29
- "import": "./dist/scaffold/index.js",
30
- "types": "./dist/scaffold/index.d.ts"
31
- },
32
- "./storage": {
33
- "import": "./dist/storage/index.js",
34
- "types": "./dist/storage/index.d.ts"
35
- }
36
- },
37
6
  "files": [
38
7
  "dist",
39
8
  "templates",
9
+ "bin.ts",
10
+ "index.ts",
40
11
  "README.md"
41
12
  ],
42
13
  "repository": {
43
14
  "type": "git",
44
15
  "url": "git+https://github.com/federicoweber/agent_hub.git"
45
16
  },
46
- "author": "Federico Weber",
17
+ "bin": {
18
+ "town-agent": "./bin.ts"
19
+ },
47
20
  "scripts": {
48
21
  "build": "tsc",
49
22
  "check": "tsc --noEmit",
@@ -57,7 +30,7 @@
57
30
  "@langchain/core": "^1.0.3",
58
31
  "@langchain/exa": "^0.1.0",
59
32
  "@langchain/mcp-adapters": "^1.0.0",
60
- "@townco/tsconfig": "^0.1.0",
33
+ "@townco/tsconfig": "workspace:*",
61
34
  "exa-js": "^2.0.0",
62
35
  "hono": "^4.10.4",
63
36
  "langchain": "^1.0.3",
@@ -22,24 +22,23 @@ export function getTemplateVars(
22
22
  };
23
23
  }
24
24
 
25
- export function generatePackageJson(
26
- vars: TemplateVars,
27
- useLocalDeps = true,
28
- ): string {
29
- // For local development, use link: protocol to reference monorepo packages
30
- // After npm publish, users will use the published versions
31
- const dependencies: Record<string, string> = useLocalDeps
32
- ? {
33
- "@townco/agent": "link:../../../../agent_hub/packages/agent",
34
- "@townco/ui": "link:../../../../agent_hub/packages/ui",
35
- }
36
- : {
37
- "@townco/agent": "^0.1.0",
38
- "@townco/ui": "^0.1.0",
39
- };
25
+ export function generatePackageJson(vars: TemplateVars): string {
26
+ // Include all dependencies since the bundled lib/runner includes all tool implementations
27
+ const dependencies: Record<string, string> = {
28
+ "@agentclientprotocol/sdk": "^0.5.1",
29
+ "@langchain/anthropic": "^1.0.0",
30
+ "@langchain/core": "^1.0.3",
31
+ "@langchain/exa": "^0.1.0",
32
+ "@langchain/mcp-adapters": "^1.0.0",
33
+ "exa-js": "^2.0.0",
34
+ langchain: "^1.0.3",
35
+ hono: "^4.10.4",
36
+ "@electric-sql/pglite": "^0.2.15",
37
+ zod: "^4.1.12",
38
+ };
40
39
 
41
40
  const pkg = {
42
- name: `@townco/agent-${vars.name}`,
41
+ name: `@town/agent-${vars.name}`,
43
42
  version: "0.0.1",
44
43
  type: "module",
45
44
  module: "index.ts",
@@ -61,8 +60,8 @@ export function generatePackageJson(
61
60
  export function generateIndexTs(): string {
62
61
  return `import { readFileSync } from "node:fs";
63
62
  import { join } from "node:path";
64
- import { makeHttpTransport, makeStdioTransport } from "@townco/agent/acp-server";
65
- import type { AgentDefinition } from "@townco/agent/definition";
63
+ import { makeHttpTransport, makeStdioTransport } from "./lib/acp-server/index.js";
64
+ import type { AgentDefinition } from "./lib/definition/index.js";
66
65
 
67
66
  // Load agent definition from JSON file
68
67
  const configPath = join(import.meta.dir, "agent.json");