@easynet/agent-tool-hub 1.0.16 → 1.0.17

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 (56) hide show
  1. package/README.md +32 -27
  2. package/dist/N8nLocalAdapter-2O65XSVJ.cjs +13 -0
  3. package/dist/{N8nLocalAdapter-OFIRXYGD.cjs.map → N8nLocalAdapter-2O65XSVJ.cjs.map} +1 -1
  4. package/dist/N8nLocalAdapter-RG5OEB6H.js +4 -0
  5. package/dist/{N8nLocalAdapter-XIDYGB5X.js.map → N8nLocalAdapter-RG5OEB6H.js.map} +1 -1
  6. package/dist/ToolRegistry-B4MF95IR.d.cts +100 -0
  7. package/dist/ToolRegistry-BBDRAr__.d.ts +100 -0
  8. package/dist/{ToolRegistry-CN_IXOCr.d.cts → ToolSpec-Be_To9dT.d.cts} +1 -98
  9. package/dist/{ToolRegistry-CN_IXOCr.d.ts → ToolSpec-Be_To9dT.d.ts} +1 -98
  10. package/dist/{chunk-Q6EXJZUA.js → chunk-4UWNCO4Q.js} +3 -3
  11. package/dist/{chunk-Q6EXJZUA.js.map → chunk-4UWNCO4Q.js.map} +1 -1
  12. package/dist/{chunk-5G4CDDRH.cjs → chunk-6QHFRQIS.cjs} +90 -14
  13. package/dist/chunk-6QHFRQIS.cjs.map +1 -0
  14. package/dist/{chunk-O5DW6I5O.js → chunk-DKZK47TK.js} +90 -14
  15. package/dist/chunk-DKZK47TK.js.map +1 -0
  16. package/dist/{chunk-FR75LUSN.cjs → chunk-F6WKFAD3.cjs} +8 -8
  17. package/dist/{chunk-FR75LUSN.cjs.map → chunk-F6WKFAD3.cjs.map} +1 -1
  18. package/dist/{chunk-PS6OEVSD.cjs → chunk-LKGMAARM.cjs} +4 -4
  19. package/dist/chunk-LKGMAARM.cjs.map +1 -0
  20. package/dist/{chunk-4GETODZZ.js → chunk-VF2LGUDP.js} +4 -4
  21. package/dist/chunk-VF2LGUDP.js.map +1 -0
  22. package/dist/cli.cjs +5 -5
  23. package/dist/cli.js +1 -1
  24. package/dist/index.cjs +60 -65
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +7 -5
  27. package/dist/index.d.ts +7 -5
  28. package/dist/index.js +3 -4
  29. package/dist/index.js.map +1 -1
  30. package/dist/langchain-tools.cjs +3 -3
  31. package/dist/langchain-tools.d.cts +4 -3
  32. package/dist/langchain-tools.d.ts +4 -3
  33. package/dist/langchain-tools.js +2 -2
  34. package/dist/llm-export.d.cts +2 -1
  35. package/dist/llm-export.d.ts +2 -1
  36. package/dist/n8n-local-BXVNhMrX.d.cts +102 -0
  37. package/dist/n8n-local-HcHZhSBQ.d.ts +102 -0
  38. package/dist/n8n-local.cjs +13 -0
  39. package/dist/n8n-local.cjs.map +1 -0
  40. package/dist/n8n-local.d.cts +2 -0
  41. package/dist/n8n-local.d.ts +2 -0
  42. package/dist/n8n-local.js +4 -0
  43. package/dist/n8n-local.js.map +1 -0
  44. package/dist/{toolhub-runtime-BfcrjPFr.d.ts → toolhub-runtime-D5w54n-9.d.ts} +4 -80
  45. package/dist/{toolhub-runtime-DEyMoDfB.d.cts → toolhub-runtime-DL2_uw8W.d.cts} +4 -80
  46. package/dist/toolhub-runtime.cjs +9 -9
  47. package/dist/toolhub-runtime.d.cts +4 -3
  48. package/dist/toolhub-runtime.d.ts +4 -3
  49. package/dist/toolhub-runtime.js +2 -2
  50. package/package.json +19 -6
  51. package/dist/N8nLocalAdapter-OFIRXYGD.cjs +0 -13
  52. package/dist/N8nLocalAdapter-XIDYGB5X.js +0 -4
  53. package/dist/chunk-4GETODZZ.js.map +0 -1
  54. package/dist/chunk-5G4CDDRH.cjs.map +0 -1
  55. package/dist/chunk-O5DW6I5O.js.map +0 -1
  56. package/dist/chunk-PS6OEVSD.cjs.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Agent Tool Hub
2
2
 
3
- **One registry, many protocols** — discover and run tools from MCP, LangChain, n8n, and SKILL through a single PTC runtime. [Source](https://github.com/easynet-world/agent-tool-hub)
4
-
5
- Define tools with simple, familiar formats: drop a folder under a configured root and use the protocol you like. One tool can be exposed in multiple protocols in the same folder.
3
+ **One registry, many protocols** — MCP, LangChain, n8n, SKILL in one PTC runtime. [Source](https://github.com/easynet-world/agent-tool-hub) Drop a folder under a root; one tool can expose multiple protocols.
6
4
 
7
5
  ---
8
6
 
@@ -19,27 +17,31 @@ Define tools with simple, familiar formats: drop a folder under a configured roo
19
17
 
20
18
  ## Install
21
19
 
20
+ Node 18+.
21
+
22
+ **Default** — MCP / LangChain / SKILL only (~tens of MB):
23
+
22
24
  ```bash
23
25
  npm install @easynet/agent-tool-hub
24
26
  ```
25
27
 
26
- Node 18+ required.
28
+ **+ n8n** — workflows / stock example (~1.3GB):
29
+
30
+ ```bash
31
+ npm install @easynet/agent-tool-hub @easynet/n8n-local
32
+ ```
27
33
 
28
34
  ---
29
35
 
30
36
  ## Run the stock research example
31
37
 
32
- End-to-end demo: **ReAct agent** + **yahoo-finance SKILL tools** + **HTML report**. After [installing](#install), run (examples are bundled; no clone needed):
38
+ ReAct + yahoo-finance SKILL + HTML report. After [install](#install):
33
39
 
34
40
  ```bash
35
41
  npx agent-toolhub-react-stock GOOGL
36
42
  ```
37
43
 
38
- Pass the ticker symbol (e.g. `GOOGL`, `AAPL`, `MSFT`). **Configure your own LLM** — point the example to your OpenAI-compatible API (base URL and API key) in [examples/agent-toolhub-react-stock.mjs](examples/agent-toolhub-react-stock.mjs) or via env (e.g. `OPENAI_API_KEY`, `OPENAI_BASE_URL`). The bundled example uses placeholder values; replace them with your model endpoint.
39
-
40
- Output: console step-by-step progress + an HTML report (e.g. `GOOGL-research-report.html`) in the current directory. See a sample report: [easynet-world.github.io/agent-tool-hub/AAPL-research-report.html](https://easynet-world.github.io/agent-tool-hub/AAPL-research-report.html).
41
-
42
- **Agent Run Report** — The generated HTML report is a highlight: it shows system/user prompts, the rendered Markdown report, and a Debug tab with step-by-step execution and token usage.
44
+ Ticker: `GOOGL`, `AAPL`, `MSFT`. Set LLM in [examples/agent-toolhub-react-stock.mjs](examples/agent-toolhub-react-stock.mjs) or env (`OPENAI_API_KEY`, `OPENAI_BASE_URL`). Output: console + `GOOGL-research-report.html`. [Sample report](https://easynet-world.github.io/agent-tool-hub/AAPL-research-report.html).
43
45
 
44
46
  | Report | Debug |
45
47
  |--------|-------|
@@ -49,9 +51,7 @@ Output: console step-by-step progress + an HTML report (e.g. `GOOGL-research-rep
49
51
 
50
52
  ## Use
51
53
 
52
- ### Embed in LangChain (minimal)
53
-
54
- Initialize the runtime, then pass the tools to your agent:
54
+ ### Embed in LangChain
55
55
 
56
56
  ```ts
57
57
  import { createAgentToolHub } from "@easynet/agent-tool-hub/langchain-tools";
@@ -71,33 +71,38 @@ const stream = await agent.stream(/* your messages */);
71
71
  await toolHub.shutdown();
72
72
  ```
73
73
 
74
- **Tracking & reports** — Optional: `formatStepProgress(step)` for console; `writeReportFromStream(stream, { htmlReportPath, onStep })` for an HTML report.
74
+ Optional: `formatStepProgress(step)` for console; `writeReportFromStream(stream, { htmlReportPath, onStep })` for HTML report.
75
75
 
76
76
  ---
77
77
 
78
78
  ## Code reference
79
79
 
80
- Full examples for each tool type: [SKILL](#skill) · [LangChain](#langchain) · [MCP](#mcp) · [n8n](#n8n).
80
+ [SKILL](#skill) · [LangChain](#langchain) · [MCP](#mcp) · [n8n](#n8n).
81
81
 
82
82
  ### SKILL
83
83
 
84
- Markdown spec + JS handler. Put under `skill/`. Full spec compliance and implementation details: [docs/AGENT_SKILLS_SPEC.md](docs/AGENT_SKILLS_SPEC.md).
84
+ Markdown (SKILL.md) under `skill/`. Progressive disclosure:
85
85
 
86
- ```yaml
86
+ - **Level 1** = frontmatter (name, description)
87
+ - **Level 2** = body (instructions)
88
+ - **Level 3** = resources (e.g. `references/`, `scripts/`, `assets/`) — scanned from the skill dir, exposed as resource list; agents can reference them by path
89
+
90
+ [Spec & impl](docs/AGENT_SKILLS_SPEC.md).
91
+
92
+ ```markdown
87
93
  # skill/SKILL.md
88
94
  ---
89
95
  name: my-tool
90
96
  description: What your tool does.
91
97
  ---
92
- ```
93
98
 
94
- ```js
95
- // skill/handler.js
96
- async function handler(args) {
97
- const { x, y } = args ?? {};
98
- return { result: { sum: Number(x) + Number(y) } };
99
- }
100
- export default handler;
99
+ # Instructions (Level 2)
100
+
101
+ Steps the agent should follow when using this skill.
102
+
103
+ # Level 3 (resources)
104
+
105
+ Put files under the skill dir (e.g. `references/REFERENCE.md`, `scripts/`, `assets/`). They appear in the resource list and can be read by path.
101
106
  ```
102
107
 
103
108
  ### LangChain
@@ -122,7 +127,7 @@ export default new CalculatorTool();
122
127
 
123
128
  ### MCP
124
129
 
125
- We do **not** provide MCP server implementation—we provide an **MCP client** that connects to existing MCP servers. Put a Cursor-style `mcp.json` under `mcp/`. To implement an MCP server, we recommend [**easy-mcp-server**](https://www.npmjs.com/package/easy-mcp-server).
130
+ MCP **client** only; put Cursor-style `mcp.json` under `mcp/`. MCP servers: [easy-mcp-server](https://www.npmjs.com/package/easy-mcp-server).
126
131
 
127
132
  ```json
128
133
  // mcp/mcp.json
@@ -138,7 +143,7 @@ We do **not** provide MCP server implementation—we provide an **MCP client** t
138
143
 
139
144
  ### n8n
140
145
 
141
- Drop an n8n workflow JSON under `n8n/`. We run a local n8n server ([**@easynet/n8n-local**](https://www.npmjs.com/package/@easynet/n8n-local)) and call the instance directly—no API.
146
+ Workflow JSON under `n8n/`; local server via [@easynet/n8n-local](https://www.npmjs.com/package/@easynet/n8n-local). Optional: `npm install @easynet/n8n-local`.
142
147
 
143
148
  ```json
144
149
  // n8n/workflow.json
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var chunk6QHFRQIS_cjs = require('./chunk-6QHFRQIS.cjs');
4
+ require('./chunk-NTTBDQUF.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "N8nLocalAdapter", {
9
+ enumerable: true,
10
+ get: function () { return chunk6QHFRQIS_cjs.N8nLocalAdapter; }
11
+ });
12
+ //# sourceMappingURL=N8nLocalAdapter-2O65XSVJ.cjs.map
13
+ //# sourceMappingURL=N8nLocalAdapter-2O65XSVJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-OFIRXYGD.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-2O65XSVJ.cjs"}
@@ -0,0 +1,4 @@
1
+ export { N8nLocalAdapter } from './chunk-DKZK47TK.js';
2
+ import './chunk-YSYEED4K.js';
3
+ //# sourceMappingURL=N8nLocalAdapter-RG5OEB6H.js.map
4
+ //# sourceMappingURL=N8nLocalAdapter-RG5OEB6H.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-XIDYGB5X.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-RG5OEB6H.js"}
@@ -0,0 +1,100 @@
1
+ import { T as ToolSpec, a as ToolKind, C as Capability } from './ToolSpec-Be_To9dT.cjs';
2
+
3
+ /**
4
+ * Evidence attached to a tool result for audit trail.
5
+ */
6
+ interface Evidence {
7
+ type: "tool" | "file" | "url" | "text" | "metric";
8
+ ref: string;
9
+ summary: string;
10
+ createdAt: string;
11
+ }
12
+ /**
13
+ * Error information in a tool result.
14
+ */
15
+ interface ToolError {
16
+ kind?: "TOOL_NOT_FOUND" | "INPUT_SCHEMA_INVALID" | "POLICY_DENIED" | "BUDGET_EXCEEDED" | "TIMEOUT" | "UPSTREAM_ERROR" | "OUTPUT_SCHEMA_INVALID" | "PATH_OUTSIDE_SANDBOX" | "FILE_TOO_LARGE" | "HTTP_DISALLOWED_HOST" | "HTTP_TIMEOUT" | "HTTP_TOO_LARGE";
17
+ message: string;
18
+ details?: unknown;
19
+ }
20
+ /**
21
+ * Unified tool result returned to agent-orchestra.
22
+ * Always structured, never throws raw exceptions.
23
+ */
24
+ interface ToolResult {
25
+ ok: boolean;
26
+ result?: unknown;
27
+ evidence: Evidence[];
28
+ error?: ToolError;
29
+ /** Raw response for debugging (can be disabled in production) */
30
+ raw?: unknown;
31
+ }
32
+
33
+ /**
34
+ * Search query for tools.
35
+ */
36
+ interface ToolSearchQuery {
37
+ /** Text search in name/description/tags */
38
+ text?: string;
39
+ /** Filter by tool kind */
40
+ kind?: ToolKind;
41
+ /** Filter by required capabilities */
42
+ capabilities?: Capability[];
43
+ /** Filter by tags */
44
+ tags?: string[];
45
+ }
46
+ /**
47
+ * Tool Registry: manages tool registration, lookup, and search.
48
+ * Supports both static registration and dynamic discovery via adapters.
49
+ */
50
+ declare class ToolRegistry {
51
+ private readonly tools;
52
+ private readonly tagIndex;
53
+ private readonly kindIndex;
54
+ /**
55
+ * Register a single tool spec.
56
+ * Overwrites if same name already exists.
57
+ */
58
+ register(spec: ToolSpec): void;
59
+ /**
60
+ * Register multiple tool specs at once.
61
+ */
62
+ bulkRegister(specs: ToolSpec[]): void;
63
+ /**
64
+ * Unregister a tool by name.
65
+ */
66
+ unregister(name: string): boolean;
67
+ /**
68
+ * Get a tool spec by name.
69
+ */
70
+ get(name: string): ToolSpec | undefined;
71
+ /**
72
+ * Check if a tool exists.
73
+ */
74
+ has(name: string): boolean;
75
+ /**
76
+ * Search tools by query.
77
+ */
78
+ search(query: ToolSearchQuery): ToolSpec[];
79
+ /**
80
+ * List all registered tool names.
81
+ */
82
+ list(): string[];
83
+ /**
84
+ * Get count of registered tools.
85
+ */
86
+ get size(): number;
87
+ /**
88
+ * Export a snapshot of all registered tools (for debugging/routing).
89
+ */
90
+ snapshot(): ToolSpec[];
91
+ /**
92
+ * Clear all registered tools.
93
+ */
94
+ clear(): void;
95
+ private validateSpec;
96
+ private indexTool;
97
+ private deindexTool;
98
+ }
99
+
100
+ export { type Evidence as E, type ToolResult as T, type ToolError as a, ToolRegistry as b, type ToolSearchQuery as c };
@@ -0,0 +1,100 @@
1
+ import { T as ToolSpec, a as ToolKind, C as Capability } from './ToolSpec-Be_To9dT.js';
2
+
3
+ /**
4
+ * Evidence attached to a tool result for audit trail.
5
+ */
6
+ interface Evidence {
7
+ type: "tool" | "file" | "url" | "text" | "metric";
8
+ ref: string;
9
+ summary: string;
10
+ createdAt: string;
11
+ }
12
+ /**
13
+ * Error information in a tool result.
14
+ */
15
+ interface ToolError {
16
+ kind?: "TOOL_NOT_FOUND" | "INPUT_SCHEMA_INVALID" | "POLICY_DENIED" | "BUDGET_EXCEEDED" | "TIMEOUT" | "UPSTREAM_ERROR" | "OUTPUT_SCHEMA_INVALID" | "PATH_OUTSIDE_SANDBOX" | "FILE_TOO_LARGE" | "HTTP_DISALLOWED_HOST" | "HTTP_TIMEOUT" | "HTTP_TOO_LARGE";
17
+ message: string;
18
+ details?: unknown;
19
+ }
20
+ /**
21
+ * Unified tool result returned to agent-orchestra.
22
+ * Always structured, never throws raw exceptions.
23
+ */
24
+ interface ToolResult {
25
+ ok: boolean;
26
+ result?: unknown;
27
+ evidence: Evidence[];
28
+ error?: ToolError;
29
+ /** Raw response for debugging (can be disabled in production) */
30
+ raw?: unknown;
31
+ }
32
+
33
+ /**
34
+ * Search query for tools.
35
+ */
36
+ interface ToolSearchQuery {
37
+ /** Text search in name/description/tags */
38
+ text?: string;
39
+ /** Filter by tool kind */
40
+ kind?: ToolKind;
41
+ /** Filter by required capabilities */
42
+ capabilities?: Capability[];
43
+ /** Filter by tags */
44
+ tags?: string[];
45
+ }
46
+ /**
47
+ * Tool Registry: manages tool registration, lookup, and search.
48
+ * Supports both static registration and dynamic discovery via adapters.
49
+ */
50
+ declare class ToolRegistry {
51
+ private readonly tools;
52
+ private readonly tagIndex;
53
+ private readonly kindIndex;
54
+ /**
55
+ * Register a single tool spec.
56
+ * Overwrites if same name already exists.
57
+ */
58
+ register(spec: ToolSpec): void;
59
+ /**
60
+ * Register multiple tool specs at once.
61
+ */
62
+ bulkRegister(specs: ToolSpec[]): void;
63
+ /**
64
+ * Unregister a tool by name.
65
+ */
66
+ unregister(name: string): boolean;
67
+ /**
68
+ * Get a tool spec by name.
69
+ */
70
+ get(name: string): ToolSpec | undefined;
71
+ /**
72
+ * Check if a tool exists.
73
+ */
74
+ has(name: string): boolean;
75
+ /**
76
+ * Search tools by query.
77
+ */
78
+ search(query: ToolSearchQuery): ToolSpec[];
79
+ /**
80
+ * List all registered tool names.
81
+ */
82
+ list(): string[];
83
+ /**
84
+ * Get count of registered tools.
85
+ */
86
+ get size(): number;
87
+ /**
88
+ * Export a snapshot of all registered tools (for debugging/routing).
89
+ */
90
+ snapshot(): ToolSpec[];
91
+ /**
92
+ * Clear all registered tools.
93
+ */
94
+ clear(): void;
95
+ private validateSpec;
96
+ private indexTool;
97
+ private deindexTool;
98
+ }
99
+
100
+ export { type Evidence as E, type ToolResult as T, type ToolError as a, ToolRegistry as b, type ToolSearchQuery as c };
@@ -96,101 +96,4 @@ interface ToolAdapter {
96
96
  }>;
97
97
  }
98
98
 
99
- /**
100
- * Evidence attached to a tool result for audit trail.
101
- */
102
- interface Evidence {
103
- type: "tool" | "file" | "url" | "text" | "metric";
104
- ref: string;
105
- summary: string;
106
- createdAt: string;
107
- }
108
- /**
109
- * Error information in a tool result.
110
- */
111
- interface ToolError {
112
- kind?: "TOOL_NOT_FOUND" | "INPUT_SCHEMA_INVALID" | "POLICY_DENIED" | "BUDGET_EXCEEDED" | "TIMEOUT" | "UPSTREAM_ERROR" | "OUTPUT_SCHEMA_INVALID" | "PATH_OUTSIDE_SANDBOX" | "FILE_TOO_LARGE" | "HTTP_DISALLOWED_HOST" | "HTTP_TIMEOUT" | "HTTP_TOO_LARGE";
113
- message: string;
114
- details?: unknown;
115
- }
116
- /**
117
- * Unified tool result returned to agent-orchestra.
118
- * Always structured, never throws raw exceptions.
119
- */
120
- interface ToolResult {
121
- ok: boolean;
122
- result?: unknown;
123
- evidence: Evidence[];
124
- error?: ToolError;
125
- /** Raw response for debugging (can be disabled in production) */
126
- raw?: unknown;
127
- }
128
-
129
- /**
130
- * Search query for tools.
131
- */
132
- interface ToolSearchQuery {
133
- /** Text search in name/description/tags */
134
- text?: string;
135
- /** Filter by tool kind */
136
- kind?: ToolKind;
137
- /** Filter by required capabilities */
138
- capabilities?: Capability[];
139
- /** Filter by tags */
140
- tags?: string[];
141
- }
142
- /**
143
- * Tool Registry: manages tool registration, lookup, and search.
144
- * Supports both static registration and dynamic discovery via adapters.
145
- */
146
- declare class ToolRegistry {
147
- private readonly tools;
148
- private readonly tagIndex;
149
- private readonly kindIndex;
150
- /**
151
- * Register a single tool spec.
152
- * Overwrites if same name already exists.
153
- */
154
- register(spec: ToolSpec): void;
155
- /**
156
- * Register multiple tool specs at once.
157
- */
158
- bulkRegister(specs: ToolSpec[]): void;
159
- /**
160
- * Unregister a tool by name.
161
- */
162
- unregister(name: string): boolean;
163
- /**
164
- * Get a tool spec by name.
165
- */
166
- get(name: string): ToolSpec | undefined;
167
- /**
168
- * Check if a tool exists.
169
- */
170
- has(name: string): boolean;
171
- /**
172
- * Search tools by query.
173
- */
174
- search(query: ToolSearchQuery): ToolSpec[];
175
- /**
176
- * List all registered tool names.
177
- */
178
- list(): string[];
179
- /**
180
- * Get count of registered tools.
181
- */
182
- get size(): number;
183
- /**
184
- * Export a snapshot of all registered tools (for debugging/routing).
185
- */
186
- snapshot(): ToolSpec[];
187
- /**
188
- * Clear all registered tools.
189
- */
190
- clear(): void;
191
- private validateSpec;
192
- private indexTool;
193
- private deindexTool;
194
- }
195
-
196
- export { type BudgetConfig as B, type Capability as C, type Evidence as E, type ToolSpec as T, type ToolResult as a, type ToolError as b, type ExecContext as c, ToolRegistry as d, type ToolAdapter as e, type ToolIntent as f, type ToolKind as g, type CostHints as h, type ToolSearchQuery as i };
99
+ export type { BudgetConfig as B, Capability as C, ExecContext as E, ToolSpec as T, ToolKind as a, ToolAdapter as b, ToolIntent as c, CostHints as d };
@@ -96,101 +96,4 @@ interface ToolAdapter {
96
96
  }>;
97
97
  }
98
98
 
99
- /**
100
- * Evidence attached to a tool result for audit trail.
101
- */
102
- interface Evidence {
103
- type: "tool" | "file" | "url" | "text" | "metric";
104
- ref: string;
105
- summary: string;
106
- createdAt: string;
107
- }
108
- /**
109
- * Error information in a tool result.
110
- */
111
- interface ToolError {
112
- kind?: "TOOL_NOT_FOUND" | "INPUT_SCHEMA_INVALID" | "POLICY_DENIED" | "BUDGET_EXCEEDED" | "TIMEOUT" | "UPSTREAM_ERROR" | "OUTPUT_SCHEMA_INVALID" | "PATH_OUTSIDE_SANDBOX" | "FILE_TOO_LARGE" | "HTTP_DISALLOWED_HOST" | "HTTP_TIMEOUT" | "HTTP_TOO_LARGE";
113
- message: string;
114
- details?: unknown;
115
- }
116
- /**
117
- * Unified tool result returned to agent-orchestra.
118
- * Always structured, never throws raw exceptions.
119
- */
120
- interface ToolResult {
121
- ok: boolean;
122
- result?: unknown;
123
- evidence: Evidence[];
124
- error?: ToolError;
125
- /** Raw response for debugging (can be disabled in production) */
126
- raw?: unknown;
127
- }
128
-
129
- /**
130
- * Search query for tools.
131
- */
132
- interface ToolSearchQuery {
133
- /** Text search in name/description/tags */
134
- text?: string;
135
- /** Filter by tool kind */
136
- kind?: ToolKind;
137
- /** Filter by required capabilities */
138
- capabilities?: Capability[];
139
- /** Filter by tags */
140
- tags?: string[];
141
- }
142
- /**
143
- * Tool Registry: manages tool registration, lookup, and search.
144
- * Supports both static registration and dynamic discovery via adapters.
145
- */
146
- declare class ToolRegistry {
147
- private readonly tools;
148
- private readonly tagIndex;
149
- private readonly kindIndex;
150
- /**
151
- * Register a single tool spec.
152
- * Overwrites if same name already exists.
153
- */
154
- register(spec: ToolSpec): void;
155
- /**
156
- * Register multiple tool specs at once.
157
- */
158
- bulkRegister(specs: ToolSpec[]): void;
159
- /**
160
- * Unregister a tool by name.
161
- */
162
- unregister(name: string): boolean;
163
- /**
164
- * Get a tool spec by name.
165
- */
166
- get(name: string): ToolSpec | undefined;
167
- /**
168
- * Check if a tool exists.
169
- */
170
- has(name: string): boolean;
171
- /**
172
- * Search tools by query.
173
- */
174
- search(query: ToolSearchQuery): ToolSpec[];
175
- /**
176
- * List all registered tool names.
177
- */
178
- list(): string[];
179
- /**
180
- * Get count of registered tools.
181
- */
182
- get size(): number;
183
- /**
184
- * Export a snapshot of all registered tools (for debugging/routing).
185
- */
186
- snapshot(): ToolSpec[];
187
- /**
188
- * Clear all registered tools.
189
- */
190
- clear(): void;
191
- private validateSpec;
192
- private indexTool;
193
- private deindexTool;
194
- }
195
-
196
- export { type BudgetConfig as B, type Capability as C, type Evidence as E, type ToolSpec as T, type ToolResult as a, type ToolError as b, type ExecContext as c, ToolRegistry as d, type ToolAdapter as e, type ToolIntent as f, type ToolKind as g, type CostHints as h, type ToolSearchQuery as i };
99
+ export type { BudgetConfig as B, Capability as C, ExecContext as E, ToolSpec as T, ToolKind as a, ToolAdapter as b, ToolIntent as c, CostHints as d };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_CONFIG_FILE, loadToolHubConfig, createToolHub } from './chunk-4GETODZZ.js';
1
+ import { DEFAULT_CONFIG_FILE, loadToolHubConfig, createToolHub } from './chunk-VF2LGUDP.js';
2
2
  import path from 'path';
3
3
 
4
4
  var AgentToolHub = class {
@@ -91,5 +91,5 @@ async function createAgentToolHub(configPath) {
91
91
  }
92
92
 
93
93
  export { AgentToolHub, createAgentToolHub, createToolHubAndInit, createToolHubAndInitFromConfig };
94
- //# sourceMappingURL=chunk-Q6EXJZUA.js.map
95
- //# sourceMappingURL=chunk-Q6EXJZUA.js.map
94
+ //# sourceMappingURL=chunk-4UWNCO4Q.js.map
95
+ //# sourceMappingURL=chunk-4UWNCO4Q.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/toolhub-runtime.ts"],"names":[],"mappings":";;;AA+BO,IAAM,eAAN,MAAmB;AAAA,EACP,UAAA;AAAA,EACT,GAAA,GAAsB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9B,YAAY,UAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA,GACd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AAEA,eAAsB,+BAA+B,UAAA,EAAoB;AACvE,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,MAAM,kBAAkB,UAAU,CAAA;AACtD,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC;AAMA,eAAsB,mBAAmB,UAAA,EAA2C;AAClF,EAAA,MAAM,GAAA,GAAM,IAAI,YAAA,CAAa,UAAU,CAAA;AACvC,EAAA,MAAM,IAAI,IAAA,EAAK;AACf,EAAA,OAAO,GAAA;AACT","file":"chunk-Q6EXJZUA.js","sourcesContent":["import path from \"node:path\";\nimport { ToolHub, createToolHub } from \"./tool-hub/ToolHub.js\";\nimport { loadToolHubConfig } from \"./config/ToolHubConfig.js\";\nimport { DEFAULT_CONFIG_FILE } from \"./config/ToolHubConfig.js\";\nimport type {\n ToolHubInitOptions,\n ToolMetadata,\n ToolDescription,\n InvokeOptions,\n} from \"./tool-hub/ToolHub.js\";\nimport type { ToolSpec } from \"./types/ToolSpec.js\";\nimport type { ToolIntent } from \"./types/ToolIntent.js\";\nimport type { ExecContext } from \"./types/ToolIntent.js\";\nimport type { ToolResult } from \"./types/ToolResult.js\";\nimport type { ToolRegistry } from \"./registry/ToolRegistry.js\";\nimport type { PTCRuntime } from \"./core/PTCRuntime.js\";\n\nexport { ToolHub, createToolHub };\nexport { createMCPClientFromConfig } from \"./adapters/createMCPClientFromConfig.js\";\nexport type { CreateMCPClientResult } from \"./adapters/createMCPClientFromConfig.js\";\nexport type { ToolHubInitOptions, InvokeOptions } from \"./tool-hub/ToolHub.js\";\n\n/**\n * High-level facade for initializing and using the tool hub from a config file.\n * Supports two constructor forms:\n * - `new AgentToolHub()` — uses default config path (toolhub.yaml in cwd).\n * - `new AgentToolHub(configPath)` — uses the given config file path.\n *\n * Call `await toolHub.init()` after construction to load config and discover tools.\n * Then use the same API as ToolHub (invokeTool, listToolMetadata, etc.).\n */\nexport class AgentToolHub {\n private readonly configPath: string;\n private hub: ToolHub | null = null;\n\n /**\n * @param configPath Optional path to toolhub config (YAML). If omitted, uses\n * default \"toolhub.yaml\" resolved from process.cwd().\n */\n constructor(configPath?: string) {\n this.configPath = configPath\n ? path.resolve(process.cwd(), configPath)\n : path.resolve(process.cwd(), DEFAULT_CONFIG_FILE);\n }\n\n /**\n * Load config from the path given at construction, create the underlying ToolHub,\n * and initialize all tools. Must be called before using invokeTool, listToolMetadata, etc.\n */\n async init(): Promise<ToolSpec[]> {\n const { options } = await loadToolHubConfig(this.configPath);\n this.hub = createToolHub(options);\n return this.hub.initAllTools();\n }\n\n private requireHub(): ToolHub {\n if (!this.hub) {\n throw new Error(\n \"AgentToolHub not initialized. Call await toolHub.init() first.\",\n );\n }\n return this.hub;\n }\n\n listToolMetadata(): ToolMetadata[] {\n return this.requireHub().listToolMetadata();\n }\n\n getToolDescription(toolName: string): ToolDescription {\n return this.requireHub().getToolDescription(toolName);\n }\n\n async invokeTool(\n toolName: string,\n args: unknown,\n options: InvokeOptions = {},\n ): Promise<ToolResult> {\n return this.requireHub().invokeTool(toolName, args, options);\n }\n\n async invokeIntent(intent: ToolIntent, ctx: ExecContext): Promise<ToolResult> {\n return this.requireHub().invokeIntent(intent, ctx);\n }\n\n getRegistry(): ToolRegistry {\n return this.requireHub().getRegistry();\n }\n\n getRuntime(): PTCRuntime {\n return this.requireHub().getRuntime();\n }\n\n async syncMCPToolsFromAdapter(): Promise<ToolSpec[]> {\n return this.requireHub().syncMCPToolsFromAdapter();\n }\n\n async refreshTools(): Promise<ToolSpec[]> {\n return this.requireHub().refreshTools();\n }\n\n async addRoots(\n roots: Array<string | { path: string; namespace?: string }>,\n refresh = true,\n ): Promise<ToolSpec[] | void> {\n return this.requireHub().addRoots(roots, refresh);\n }\n\n async setRoots(\n roots: Array<string | { path: string; namespace?: string }>,\n refresh = true,\n ): Promise<ToolSpec[] | void> {\n return this.requireHub().setRoots(roots, refresh);\n }\n\n watchRoots(options: { debounceMs?: number; persistent?: boolean } = {}): void {\n this.requireHub().watchRoots(options);\n }\n\n unwatchRoots(): void {\n this.requireHub().unwatchRoots();\n }\n\n async shutdown(): Promise<void> {\n if (this.hub) {\n await this.hub.shutdown();\n this.hub = null;\n }\n }\n\n /** Config path used for init (resolved absolute path). */\n getConfigPath(): string {\n return this.configPath;\n }\n}\n\nexport async function createToolHubAndInit(\n options: ToolHubInitOptions,\n) {\n const hub = createToolHub(options);\n await hub.initAllTools();\n return hub;\n}\n\nexport async function createToolHubAndInitFromConfig(configPath: string) {\n const { options } = await loadToolHubConfig(configPath);\n return createToolHubAndInit(options);\n}\n\n/**\n * Create an AgentToolHub from a config path, run init(), and return the instance.\n * Equivalent to: `const hub = new AgentToolHub(configPath); await hub.init(); return hub;`\n */\nexport async function createAgentToolHub(configPath: string): Promise<AgentToolHub> {\n const hub = new AgentToolHub(configPath);\n await hub.init();\n return hub;\n}\n"]}
1
+ {"version":3,"sources":["../src/toolhub-runtime.ts"],"names":[],"mappings":";;;AA+BO,IAAM,eAAN,MAAmB;AAAA,EACP,UAAA;AAAA,EACT,GAAA,GAAsB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9B,YAAY,UAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA,GACd,IAAA,CAAK,OAAA,CAAQ,QAAQ,GAAA,EAAI,EAAG,UAAU,CAAA,GACtC,IAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,GAAA,IAAO,mBAAmB,CAAA;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAA,GAA4B;AAChC,IAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,MAAM,iBAAA,CAAkB,KAAK,UAAU,CAAA;AAC3D,IAAA,IAAA,CAAK,GAAA,GAAM,cAAc,OAAO,CAAA;AAChC,IAAA,OAAO,IAAA,CAAK,IAAI,YAAA,EAAa;AAAA,EAC/B;AAAA,EAEQ,UAAA,GAAsB;AAC5B,IAAA,IAAI,CAAC,KAAK,GAAA,EAAK;AACb,MAAA,MAAM,IA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,EACA,OAAA,GAAU,IAAA,EACkB;AAC5B,IAAA,OAAO,IAAA,CAAK,UAAA,EAAW,CAAE,QAAA,CAAS,OAAO,OAAO,CAAA;AAAA,EAClD;AAAA,EAEA,UAAA,CAAW,OAAA,GAAyD,EAAC,EAAS;AAC5E,IAAA,IAAA,CAAK,UAAA,EAAW,CAAE,UAAA,CAAW,OAAO,CAAA;AAAA,EACtC;AAAA,EAEA,YAAA,GAAqB;AACnB,IAAA,IAAA,CAAK,UAAA,GAAa,YAAA,EAAa;AAAA,EACjC;AAAA,EAEA,MAAM,QAAA,GAA0B;AAC9B,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,MAAM,IAAA,CAAK,IAAI,QAAA,EAAS;AACxB,MAAA,IAAA,CAAK,GAAA,GAAM,IAAA;AAAA,IACb;AAAA,EACF;AAAA;AAAA,EAGA,aAAA,GAAwB;AACtB,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACd;AACF;AAEA,eAAsB,qBACpB,OAAA,EACA;AACA,EAAA,MAAM,GAAA,GAAM,cAAc,OAAO,CAAA;AACjC,EAAA,MAAM,IAAI,YAAA,EAAa;AACvB,EAAA,OAAO,GAAA;AACT;AAEA,eAAsB,+BAA+B,UAAA,EAAoB;AACvE,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,MAAM,kBAAkB,UAAU,CAAA;AACtD,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC;AAMA,eAAsB,mBAAmB,UAAA,EAA2C;AAClF,EAAA,MAAM,GAAA,GAAM,IAAI,YAAA,CAAa,UAAU,CAAA;AACvC,EAAA,MAAM,IAAI,IAAA,EAAK;AACf,EAAA,OAAO,GAAA;AACT","file":"chunk-4UWNCO4Q.js","sourcesContent":["import path from \"node:path\";\nimport { ToolHub, createToolHub } from \"./tool-hub/ToolHub.js\";\nimport { loadToolHubConfig } from \"./config/ToolHubConfig.js\";\nimport { DEFAULT_CONFIG_FILE } from \"./config/ToolHubConfig.js\";\nimport type {\n ToolHubInitOptions,\n ToolMetadata,\n ToolDescription,\n InvokeOptions,\n} from \"./tool-hub/ToolHub.js\";\nimport type { ToolSpec } from \"./types/ToolSpec.js\";\nimport type { ToolIntent } from \"./types/ToolIntent.js\";\nimport type { ExecContext } from \"./types/ToolIntent.js\";\nimport type { ToolResult } from \"./types/ToolResult.js\";\nimport type { ToolRegistry } from \"./registry/ToolRegistry.js\";\nimport type { PTCRuntime } from \"./core/PTCRuntime.js\";\n\nexport { ToolHub, createToolHub };\nexport { createMCPClientFromConfig } from \"./adapters/createMCPClientFromConfig.js\";\nexport type { CreateMCPClientResult } from \"./adapters/createMCPClientFromConfig.js\";\nexport type { ToolHubInitOptions, InvokeOptions } from \"./tool-hub/ToolHub.js\";\n\n/**\n * High-level facade for initializing and using the tool hub from a config file.\n * Supports two constructor forms:\n * - `new AgentToolHub()` — uses default config path (toolhub.yaml in cwd).\n * - `new AgentToolHub(configPath)` — uses the given config file path.\n *\n * Call `await toolHub.init()` after construction to load config and discover tools.\n * Then use the same API as ToolHub (invokeTool, listToolMetadata, etc.).\n */\nexport class AgentToolHub {\n private readonly configPath: string;\n private hub: ToolHub | null = null;\n\n /**\n * @param configPath Optional path to toolhub config (YAML). If omitted, uses\n * default \"toolhub.yaml\" resolved from process.cwd().\n */\n constructor(configPath?: string) {\n this.configPath = configPath\n ? path.resolve(process.cwd(), configPath)\n : path.resolve(process.cwd(), DEFAULT_CONFIG_FILE);\n }\n\n /**\n * Load config from the path given at construction, create the underlying ToolHub,\n * and initialize all tools. Must be called before using invokeTool, listToolMetadata, etc.\n */\n async init(): Promise<ToolSpec[]> {\n const { options } = await loadToolHubConfig(this.configPath);\n this.hub = createToolHub(options);\n return this.hub.initAllTools();\n }\n\n private requireHub(): ToolHub {\n if (!this.hub) {\n throw new Error(\n \"AgentToolHub not initialized. Call await toolHub.init() first.\",\n );\n }\n return this.hub;\n }\n\n listToolMetadata(): ToolMetadata[] {\n return this.requireHub().listToolMetadata();\n }\n\n getToolDescription(toolName: string): ToolDescription {\n return this.requireHub().getToolDescription(toolName);\n }\n\n async invokeTool(\n toolName: string,\n args: unknown,\n options: InvokeOptions = {},\n ): Promise<ToolResult> {\n return this.requireHub().invokeTool(toolName, args, options);\n }\n\n async invokeIntent(intent: ToolIntent, ctx: ExecContext): Promise<ToolResult> {\n return this.requireHub().invokeIntent(intent, ctx);\n }\n\n getRegistry(): ToolRegistry {\n return this.requireHub().getRegistry();\n }\n\n getRuntime(): PTCRuntime {\n return this.requireHub().getRuntime();\n }\n\n async syncMCPToolsFromAdapter(): Promise<ToolSpec[]> {\n return this.requireHub().syncMCPToolsFromAdapter();\n }\n\n async refreshTools(): Promise<ToolSpec[]> {\n return this.requireHub().refreshTools();\n }\n\n async addRoots(\n roots: Array<string | { path: string; namespace?: string }>,\n refresh = true,\n ): Promise<ToolSpec[] | void> {\n return this.requireHub().addRoots(roots, refresh);\n }\n\n async setRoots(\n roots: Array<string | { path: string; namespace?: string }>,\n refresh = true,\n ): Promise<ToolSpec[] | void> {\n return this.requireHub().setRoots(roots, refresh);\n }\n\n watchRoots(options: { debounceMs?: number; persistent?: boolean } = {}): void {\n this.requireHub().watchRoots(options);\n }\n\n unwatchRoots(): void {\n this.requireHub().unwatchRoots();\n }\n\n async shutdown(): Promise<void> {\n if (this.hub) {\n await this.hub.shutdown();\n this.hub = null;\n }\n }\n\n /** Config path used for init (resolved absolute path). */\n getConfigPath(): string {\n return this.configPath;\n }\n}\n\nexport async function createToolHubAndInit(\n options: ToolHubInitOptions,\n) {\n const hub = createToolHub(options);\n await hub.initAllTools();\n return hub;\n}\n\nexport async function createToolHubAndInitFromConfig(configPath: string) {\n const { options } = await loadToolHubConfig(configPath);\n return createToolHubAndInit(options);\n}\n\n/**\n * Create an AgentToolHub from a config path, run init(), and return the instance.\n * Equivalent to: `const hub = new AgentToolHub(configPath); await hub.init(); return hub;`\n */\nexport async function createAgentToolHub(configPath: string): Promise<AgentToolHub> {\n const hub = new AgentToolHub(configPath);\n await hub.init();\n return hub;\n}\n"]}