bigtool-ts 0.1.1 → 0.1.2

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 (40) hide show
  1. package/dist/adapters/agent-protocol.d.ts +8 -141
  2. package/dist/adapters/agent-protocol.d.ts.map +1 -1
  3. package/dist/adapters/agent-protocol.js +9 -125
  4. package/dist/adapters/agent-protocol.js.map +1 -1
  5. package/dist/adapters/index.d.ts +12 -3
  6. package/dist/adapters/index.d.ts.map +1 -1
  7. package/dist/adapters/index.js +14 -4
  8. package/dist/adapters/index.js.map +1 -1
  9. package/dist/adapters/inngest.d.ts +3 -4
  10. package/dist/adapters/inngest.d.ts.map +1 -1
  11. package/dist/adapters/inngest.js +9 -8
  12. package/dist/adapters/inngest.js.map +1 -1
  13. package/dist/adapters/mastra.d.ts +45 -9
  14. package/dist/adapters/mastra.d.ts.map +1 -1
  15. package/dist/adapters/mastra.js +5 -1
  16. package/dist/adapters/mastra.js.map +1 -1
  17. package/dist/adapters/rest-handler.d.ts +154 -0
  18. package/dist/adapters/rest-handler.d.ts.map +1 -0
  19. package/dist/adapters/rest-handler.js +128 -0
  20. package/dist/adapters/rest-handler.js.map +1 -0
  21. package/dist/adapters/schema-utils.d.ts +44 -0
  22. package/dist/adapters/schema-utils.d.ts.map +1 -0
  23. package/dist/adapters/schema-utils.js +163 -0
  24. package/dist/adapters/schema-utils.js.map +1 -0
  25. package/dist/adapters/vercel-ai.d.ts +13 -8
  26. package/dist/adapters/vercel-ai.d.ts.map +1 -1
  27. package/dist/adapters/vercel-ai.js +13 -7
  28. package/dist/adapters/vercel-ai.js.map +1 -1
  29. package/dist/graph/agent.d.ts.map +1 -1
  30. package/dist/graph/agent.js +13 -2
  31. package/dist/graph/agent.js.map +1 -1
  32. package/dist/graph/index.d.ts +1 -1
  33. package/dist/graph/index.d.ts.map +1 -1
  34. package/dist/graph/index.js +1 -1
  35. package/dist/graph/index.js.map +1 -1
  36. package/dist/graph/nodes.d.ts +13 -1
  37. package/dist/graph/nodes.d.ts.map +1 -1
  38. package/dist/graph/nodes.js +35 -2
  39. package/dist/graph/nodes.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,149 +1,16 @@
1
1
  /**
2
2
  * Agent Protocol adapter for bigtool-ts.
3
3
  *
4
- * IMPORTANT: Agent Protocol is a task/step-oriented specification, NOT a tool-oriented one.
5
- * The protocol defines Tasks (high-level goals) and Steps (actions), with no native tool endpoints.
4
+ * @deprecated This module is misnamed. It provides a REST API for tools,
5
+ * NOT an Agent Protocol implementation. Agent Protocol defines task/step
6
+ * endpoints, not tool endpoints.
6
7
  *
7
- * This adapter provides a framework-agnostic handler interface that maps bigtool-ts
8
- * tool operations to a REST-like API. It can be used with any HTTP framework
9
- * (Express, Fastify, Hono, etc.) or integrated with the Agent Protocol SDK.
8
+ * Use `createToolRestHandler` from './rest-handler.js' instead.
10
9
  *
11
- * @see https://github.com/AI-Engineers-Foundation/agent-protocol
12
- * @module adapters/agent-protocol
13
- */
14
- import type { AdapterConfig } from './types.js';
15
- /**
16
- * Tool representation in Agent Protocol wire format.
17
- *
18
- * Uses JSON Schema for parameters (not Zod) as required by REST APIs.
19
- */
20
- export interface AgentTool {
21
- /** Unique tool identifier */
22
- name: string;
23
- /** Human-readable description */
24
- description: string;
25
- /** JSON Schema for tool parameters */
26
- parameters: Record<string, unknown>;
27
- }
28
- /**
29
- * Result from tool execution.
30
- */
31
- export interface ToolExecutionResult {
32
- /** Unique identifier for this tool call */
33
- tool_call_id: string;
34
- /** Output from the tool (serialized to string) */
35
- output: string;
36
- }
37
- /**
38
- * Error response structure.
39
- */
40
- export interface ToolError {
41
- /** Error code for programmatic handling */
42
- code: 'TOOL_NOT_FOUND' | 'EXECUTION_ERROR';
43
- /** Human-readable error message */
44
- message: string;
45
- }
46
- /**
47
- * Result type for operations that can fail.
48
- */
49
- export type ToolResult<T> = {
50
- success: true;
51
- data: T;
52
- } | {
53
- success: false;
54
- error: ToolError;
55
- };
56
- /**
57
- * Framework-agnostic handler for Agent Protocol tool operations.
58
- *
59
- * This interface provides the core operations that can be exposed via any
60
- * HTTP framework or integrated with the Agent Protocol SDK's step mechanism.
10
+ * All exports from this module are re-exported with deprecation notices
11
+ * for backwards compatibility.
61
12
  *
62
- * @example Express integration
63
- * ```typescript
64
- * import express from 'express';
65
- * import { createAgentProtocolHandler } from '@repo/bigtool-ts/adapters';
66
- *
67
- * const handler = createAgentProtocolHandler({ catalog, loader, searchIndex });
68
- * const app = express();
69
- *
70
- * app.get('/tools', async (req, res) => {
71
- * const tools = await handler.listTools();
72
- * res.json(tools);
73
- * });
74
- *
75
- * app.post('/tools/search', async (req, res) => {
76
- * const { query, limit } = req.body;
77
- * const tools = await handler.searchTools(query, limit);
78
- * res.json(tools);
79
- * });
80
- *
81
- * app.post('/tools/execute', async (req, res) => {
82
- * const { name, args } = req.body;
83
- * const result = await handler.executeTool(name, args);
84
- * if (result.success) {
85
- * res.json(result.data);
86
- * } else {
87
- * res.status(400).json(result.error);
88
- * }
89
- * });
90
- * ```
91
- */
92
- export interface AgentProtocolHandler {
93
- /**
94
- * List all available tools.
95
- *
96
- * @returns Array of tools in Agent Protocol format
97
- */
98
- listTools(): Promise<AgentTool[]>;
99
- /**
100
- * Search for tools matching a query.
101
- *
102
- * @param query - Natural language search query
103
- * @param limit - Maximum number of results (default: 5)
104
- * @returns Array of matching tools, sorted by relevance
105
- */
106
- searchTools(query: string, limit?: number): Promise<AgentTool[]>;
107
- /**
108
- * Execute a tool with the given arguments.
109
- *
110
- * @param name - Tool name to execute
111
- * @param args - Arguments to pass to the tool
112
- * @returns Result containing output or error
113
- */
114
- executeTool(name: string, args: Record<string, unknown>): Promise<ToolResult<ToolExecutionResult>>;
115
- }
116
- /**
117
- * Creates a framework-agnostic Agent Protocol handler.
118
- *
119
- * The handler provides three core operations for tool management:
120
- * - `listTools()`: Get all available tools
121
- * - `searchTools()`: Find tools by natural language query
122
- * - `executeTool()`: Run a specific tool with arguments
123
- *
124
- * @param config - Adapter configuration with catalog, loader, and search index
125
- * @returns Handler instance with tool operations
126
- *
127
- * @example Basic usage
128
- * ```typescript
129
- * const handler = createAgentProtocolHandler({
130
- * catalog,
131
- * loader,
132
- * searchIndex,
133
- * });
134
- *
135
- * // List all tools
136
- * const tools = await handler.listTools();
137
- *
138
- * // Search for specific tools
139
- * const githubTools = await handler.searchTools('github pull request', 5);
140
- *
141
- * // Execute a tool
142
- * const result = await handler.executeTool('create_pr', {
143
- * title: 'My PR',
144
- * body: 'Description',
145
- * });
146
- * ```
13
+ * @module adapters/agent-protocol
147
14
  */
148
- export declare function createAgentProtocolHandler(config: AdapterConfig): AgentProtocolHandler;
15
+ export { createToolRestHandler as createAgentProtocolHandler, type ToolRestHandler as AgentProtocolHandler, type RestTool as AgentTool, type RestToolExecutionResult as ToolExecutionResult, type RestToolError as ToolError, type RestToolResult as ToolResult, } from './rest-handler.js';
149
16
  //# sourceMappingURL=agent-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-protocol.d.ts","sourceRoot":"","sources":["../../src/adapters/agent-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMhD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IAC3C,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IACpB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAMzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAElC;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEjE;;;;;;OAMG;IACH,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC7C;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,aAAa,GACpB,oBAAoB,CA2EtB"}
1
+ {"version":3,"file":"agent-protocol.d.ts","sourceRoot":"","sources":["../../src/adapters/agent-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,qBAAqB,IAAI,0BAA0B,EACnD,KAAK,eAAe,IAAI,oBAAoB,EAC5C,KAAK,QAAQ,IAAI,SAAS,EAC1B,KAAK,uBAAuB,IAAI,mBAAmB,EACnD,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,cAAc,IAAI,UAAU,GAClC,MAAM,mBAAmB,CAAC"}
@@ -1,133 +1,17 @@
1
1
  /**
2
2
  * Agent Protocol adapter for bigtool-ts.
3
3
  *
4
- * IMPORTANT: Agent Protocol is a task/step-oriented specification, NOT a tool-oriented one.
5
- * The protocol defines Tasks (high-level goals) and Steps (actions), with no native tool endpoints.
4
+ * @deprecated This module is misnamed. It provides a REST API for tools,
5
+ * NOT an Agent Protocol implementation. Agent Protocol defines task/step
6
+ * endpoints, not tool endpoints.
6
7
  *
7
- * This adapter provides a framework-agnostic handler interface that maps bigtool-ts
8
- * tool operations to a REST-like API. It can be used with any HTTP framework
9
- * (Express, Fastify, Hono, etc.) or integrated with the Agent Protocol SDK.
8
+ * Use `createToolRestHandler` from './rest-handler.js' instead.
10
9
  *
11
- * @see https://github.com/AI-Engineers-Foundation/agent-protocol
12
- * @module adapters/agent-protocol
13
- */
14
- // ═══════════════════════════════════════════════════════════════════
15
- // IMPLEMENTATION
16
- // ═══════════════════════════════════════════════════════════════════
17
- /**
18
- * Convert bigtool-ts metadata to Agent Protocol wire format.
19
- *
20
- * This is a pure function that transforms internal metadata to the
21
- * external API representation.
22
- */
23
- function toAgentTool(metadata) {
24
- return {
25
- name: metadata.name,
26
- description: metadata.description,
27
- parameters: metadata.parameters ?? {},
28
- };
29
- }
30
- /**
31
- * Generate a unique tool call ID.
10
+ * All exports from this module are re-exported with deprecation notices
11
+ * for backwards compatibility.
32
12
  *
33
- * Uses timestamp + random suffix for uniqueness without external dependencies.
34
- */
35
- function generateToolCallId() {
36
- const timestamp = Date.now().toString(36);
37
- const random = Math.random().toString(36).substring(2, 8);
38
- return `call_${timestamp}_${random}`;
39
- }
40
- /**
41
- * Creates a framework-agnostic Agent Protocol handler.
42
- *
43
- * The handler provides three core operations for tool management:
44
- * - `listTools()`: Get all available tools
45
- * - `searchTools()`: Find tools by natural language query
46
- * - `executeTool()`: Run a specific tool with arguments
47
- *
48
- * @param config - Adapter configuration with catalog, loader, and search index
49
- * @returns Handler instance with tool operations
50
- *
51
- * @example Basic usage
52
- * ```typescript
53
- * const handler = createAgentProtocolHandler({
54
- * catalog,
55
- * loader,
56
- * searchIndex,
57
- * });
58
- *
59
- * // List all tools
60
- * const tools = await handler.listTools();
61
- *
62
- * // Search for specific tools
63
- * const githubTools = await handler.searchTools('github pull request', 5);
64
- *
65
- * // Execute a tool
66
- * const result = await handler.executeTool('create_pr', {
67
- * title: 'My PR',
68
- * body: 'Description',
69
- * });
70
- * ```
13
+ * @module adapters/agent-protocol
71
14
  */
72
- export function createAgentProtocolHandler(config) {
73
- const { catalog, loader, searchIndex } = config;
74
- return {
75
- async listTools() {
76
- const metadata = catalog.getAllMetadata();
77
- return metadata.map(toAgentTool);
78
- },
79
- async searchTools(query, limit = 5) {
80
- const results = await searchIndex.search(query, { limit });
81
- // Map search results to agent tools
82
- // Filter out nulls in case metadata was removed between search and lookup
83
- const tools = [];
84
- for (const result of results) {
85
- const metadata = catalog.getMetadata(result.toolId);
86
- if (metadata !== null) {
87
- tools.push(toAgentTool(metadata));
88
- }
89
- }
90
- return tools;
91
- },
92
- async executeTool(name, args) {
93
- // Find tool by name (search through metadata)
94
- const allMetadata = catalog.getAllMetadata();
95
- const metadata = allMetadata.find((m) => m.name === name);
96
- if (metadata === undefined) {
97
- return {
98
- success: false,
99
- error: {
100
- code: 'TOOL_NOT_FOUND',
101
- message: `Tool not found: ${name}`,
102
- },
103
- };
104
- }
105
- // Load and execute the tool
106
- const tool = await loader.load(metadata.id);
107
- // Attempt execution with error handling
108
- const toolCallId = generateToolCallId();
109
- try {
110
- const rawResult = await tool.invoke(args);
111
- const output = typeof rawResult === 'string' ? rawResult : JSON.stringify(rawResult);
112
- return {
113
- success: true,
114
- data: {
115
- tool_call_id: toolCallId,
116
- output,
117
- },
118
- };
119
- }
120
- catch (error) {
121
- const message = error instanceof Error ? error.message : 'Unknown execution error';
122
- return {
123
- success: false,
124
- error: {
125
- code: 'EXECUTION_ERROR',
126
- message,
127
- },
128
- };
129
- }
130
- },
131
- };
132
- }
15
+ // Re-export everything from rest-handler with original names for backwards compatibility
16
+ export { createToolRestHandler as createAgentProtocolHandler, } from './rest-handler.js';
133
17
  //# sourceMappingURL=agent-protoc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C;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;gBAErE,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACL,IAAI,EAAE,iBAAiB;wBACvB,OAAO;qBACR;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"agent-protocol.js","sourceRoot":"","sources":["../../src/adapters/agent-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,OAAO,EACL,qBAAqB,IAAI,0BAA0B,GAMpD,MAAM,mBAAmB,CAAC"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @example Inngest AgentKit
11
11
  * ```typescript
12
- * import { createInngestAdapter } from '@repo/bigtool-ts/adapters';
12
+ * import { createInngestAdapter } from 'bigtool-ts/adapters';
13
13
  *
14
14
  * const adapter = createInngestAdapter({ catalog, loader, searchIndex });
15
15
  * const tools = await adapter.getTools(['github:create_pr']);
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * @example Vercel AI SDK
19
19
  * ```typescript
20
- * import { createVercelAdapter } from '@repo/bigtool-ts/adapters';
20
+ * import { createVercelAdapter } from 'bigtool-ts/adapters';
21
21
  *
22
22
  * const adapter = createVercelAdapter({ catalog, loader, searchIndex });
23
23
  * const tools = await adapter.getToolsAsRecord(['github:create_pr']);
@@ -25,14 +25,23 @@
25
25
  *
26
26
  * @example Mastra
27
27
  * ```typescript
28
- * import { createMastraAdapter } from '@repo/bigtool-ts/adapters';
28
+ * import { createMastraAdapter } from 'bigtool-ts/adapters';
29
29
  *
30
30
  * const adapter = createMastraAdapter({ catalog, loader, searchIndex });
31
31
  * const tools = await adapter.getToolsAsRecord(['github:create_pr']);
32
32
  * ```
33
+ *
34
+ * @example REST API Handler
35
+ * ```typescript
36
+ * import { createToolRestHandler } from 'bigtool-ts/adapters';
37
+ *
38
+ * const handler = createToolRestHandler({ catalog, loader, searchIndex });
39
+ * app.get('/tools', async (req, res) => res.json(await handler.listTools()));
40
+ * ```
33
41
  */
34
42
  export type { AdapterConfig, SearchToolOptions, ToolAdapter } from './types.js';
35
43
  export { InngestAdapter, createInngestAdapter, type InngestTool, type InngestToolOptions, type InngestNetworkRun, type InngestStep, type SearchToolResult, } from './inngest.js';
44
+ export { createToolRestHandler, type ToolRestHandler, type RestTool, type RestToolExecutionResult, type RestToolError, type RestToolResult, } from './rest-handler.js';
36
45
  export { createAgentProtocolHandler, type AgentProtocolHandler, type AgentTool, type ToolExecutionResult, type ToolError, type ToolResult, } from './agent-protocol.js';
37
46
  export { VercelAIAdapter, createVercelAdapter, } from './vercel-ai.js';
38
47
  export { MastraAdapter, createMastraAdapter, type MastraTool, type MastraToolContext, } from './mastra.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGhF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGhF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @example Inngest AgentKit
11
11
  * ```typescript
12
- * import { createInngestAdapter } from '@repo/bigtool-ts/adapters';
12
+ * import { createInngestAdapter } from 'bigtool-ts/adapters';
13
13
  *
14
14
  * const adapter = createInngestAdapter({ catalog, loader, searchIndex });
15
15
  * const tools = await adapter.getTools(['github:create_pr']);
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * @example Vercel AI SDK
19
19
  * ```typescript
20
- * import { createVercelAdapter } from '@repo/bigtool-ts/adapters';
20
+ * import { createVercelAdapter } from 'bigtool-ts/adapters';
21
21
  *
22
22
  * const adapter = createVercelAdapter({ catalog, loader, searchIndex });
23
23
  * const tools = await adapter.getToolsAsRecord(['github:create_pr']);
@@ -25,15 +25,25 @@
25
25
  *
26
26
  * @example Mastra
27
27
  * ```typescript
28
- * import { createMastraAdapter } from '@repo/bigtool-ts/adapters';
28
+ * import { createMastraAdapter } from 'bigtool-ts/adapters';
29
29
  *
30
30
  * const adapter = createMastraAdapter({ catalog, loader, searchIndex });
31
31
  * const tools = await adapter.getToolsAsRecord(['github:create_pr']);
32
32
  * ```
33
+ *
34
+ * @example REST API Handler
35
+ * ```typescript
36
+ * import { createToolRestHandler } from 'bigtool-ts/adapters';
37
+ *
38
+ * const handler = createToolRestHandler({ catalog, loader, searchIndex });
39
+ * app.get('/tools', async (req, res) => res.json(await handler.listTools()));
40
+ * ```
33
41
  */
34
42
  // Inngest AgentKit adapter
35
43
  export { InngestAdapter, createInngestAdapter, } from './inngest.js';
36
- // Agent Protocol adapter
44
+ // REST API handler (preferred)
45
+ export { createToolRestHandler, } from './rest-handler.js';
46
+ // Agent Protocol (deprecated - re-exports from rest-handler)
37
47
  export { createAgentProtocolHandler, } from './agent-protocol.js';
38
48
  // Vercel AI SDK adapter
39
49
  export { VercelAIAdapter, createVercelAdapter, } from './vercel-ai.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,2BAA2B;AAC3B,OAAO,EACL,cAAc,EACd,oBAAoB,GAMrB,MAAM,cAAc,CAAC;AAEtB,yBAAyB;AACzB,OAAO,EACL,0BAA0B,GAM3B,MAAM,qBAAqB,CAAC;AAE7B,wBAAwB;AACxB,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,iBAAiB;AACjB,OAAO,EACL,aAAa,EACb,mBAAmB,GAGpB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAKH,2BAA2B;AAC3B,OAAO,EACL,cAAc,EACd,oBAAoB,GAMrB,MAAM,cAAc,CAAC;AAEtB,+BAA+B;AAC/B,OAAO,EACL,qBAAqB,GAMtB,MAAM,mBAAmB,CAAC;AAE3B,6DAA6D;AAC7D,OAAO,EACL,0BAA0B,GAM3B,MAAM,qBAAqB,CAAC;AAE7B,wBAAwB;AACxB,OAAO,EACL,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,iBAAiB;AACjB,OAAO,EACL,aAAa,EACb,mBAAmB,GAGpB,MAAM,aAAa,CAAC"}
@@ -121,10 +121,9 @@ export declare class InngestAdapter implements ToolAdapter<InngestTool> {
121
121
  * The resulting tool wraps the bigtool-ts loader and automatically
122
122
  * uses step.run() for durable execution when available.
123
123
  *
124
- * **Note:** Parameter schemas are not converted from ToolMetadata to Zod.
125
- * The underlying bigtool-ts tool handles its own input validation.
126
- * If you need Inngest-side schema validation, provide tools with Zod
127
- * schemas directly rather than using the adapter.
124
+ * Parameter schemas are converted from JSON Schema to Zod using a
125
+ * simplified converter. For complex schemas, provide tools with Zod
126
+ * schemas directly.
128
127
  *
129
128
  * @param metadata - Tool metadata from the catalog
130
129
  * @returns Inngest-compatible tool
@@ -1 +1 @@
1
- {"version":3,"file":"inngest.d.ts","sourceRoot":"","sources":["../../src/adapters/inngest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMhF;;;;;GAKG;AACH,MAAM,WAAW,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D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,cAAe,YAAW,WAAW,CAAC,WAAW,CAAC;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;gBAE/C,MAAM,EAAE,aAAa;IAMjC;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW;IA2BpD;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAazD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAK3C;;;;;OAKG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAQtE;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,WAAW;IA8C9D;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,IAAI,WAAW;CAuClC;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAE1E"}
@@ -25,6 +25,7 @@
25
25
  * ```
26
26
  */
27
27
  import { z } from 'zod';
28
+ import { jsonSchemaToZod } from './schema-utils.js';
28
29
  // ═══════════════════════════════════════════════════════════════════
29
30
  // ADAPTER IMPLEMENTATION
30
31
  // ═══════════════════════════════════════════════════════════════════
@@ -67,23 +68,23 @@ export class InngestAdapter {
67
68
  * The resulting tool wraps the bigtool-ts loader and automatically
68
69
  * uses step.run() for durable execution when available.
69
70
  *
70
- * **Note:** Parameter schemas are not converted from ToolMetadata to Zod.
71
- * The underlying bigtool-ts tool handles its own input validation.
72
- * If you need Inngest-side schema validation, provide tools with Zod
73
- * schemas directly rather than using the adapter.
71
+ * Parameter schemas are converted from JSON Schema to Zod using a
72
+ * simplified converter. For complex schemas, provide tools with Zod
73
+ * schemas directly.
74
74
  *
75
75
  * @param metadata - Tool metadata from the catalog
76
76
  * @returns Inngest-compatible tool
77
77
  */
78
78
  toFrameworkTool(metadata) {
79
79
  const loader = this.loader;
80
- // Note: We don't convert metadata.parameters (JSON Schema) to Zod because
81
- // the conversion is complex and error-prone. The underlying tool validates
82
- // its own input. If Zod schemas are needed, use createTool directly.
80
+ // Convert JSON Schema parameters to Zod for AgentKit validation
81
+ const parameters = metadata.parameters
82
+ ? jsonSchemaToZod(metadata.parameters)
83
+ : undefined;
83
84
  return {
84
85
  name: metadata.name,
85
86
  description: metadata.description,
86
- parameters: undefined,
87
+ parameters,
87
88
  handler: async (input, opts) => {
88
89
  const execute = async () => {
89
90
  const tool = await loader.load(metadata.id);
@@ -1 +1 @@
1
- {"version":3,"file":"inngest.js","sourceRoot":"","sources":["../../src/adapters/inngest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsExB,sEAAsE;AACtE,yBAAyB;AACzB,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,cAAc;IACR,OAAO,CAA2B;IAClC,MAAM,CAA0B;IAChC,WAAW,CAA+B;IAE3D,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,WAAW,GA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;AAkBD,sEAAsE;AACtE,mBAAmB;AACnB,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAqB;IACxD,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
@@ -31,10 +31,11 @@ import type { AdapterConfig, ToolAdapter, SearchToolOptions } from './types.js';
31
31
  /**
32
32
  * Mastra tool execution context.
33
33
  *
34
+ * Matches `ToolExecutionContext` from `@mastra/core/tools` (v0.24+).
34
35
  * Provides access to Mastra runtime services during tool execution.
35
36
  * All properties are optional to handle various execution contexts.
36
37
  */
37
- export interface MastraToolContext {
38
+ export interface MastraToolContext<TSuspend = unknown, TResume = unknown> {
38
39
  /** Mastra runtime instance for accessing services */
39
40
  mastra?: unknown;
40
41
  /** Request context for HTTP-triggered executions */
@@ -43,22 +44,53 @@ export interface MastraToolContext {
43
44
  tracingContext?: unknown;
44
45
  /** Abort signal for cancellation support */
45
46
  abortSignal?: AbortSignal;
46
- /** Agent-specific context (suspend/resume support) */
47
- agent?: unknown;
48
- /** Workflow-specific context */
49
- workflow?: unknown;
47
+ /** Agent-specific context (when called from agent) */
48
+ agent?: {
49
+ /** ID of the tool call from the LLM */
50
+ toolCallId: string;
51
+ /** Conversation messages */
52
+ messages: unknown[];
53
+ /** Suspend execution and wait for input */
54
+ suspend?: (payload: TSuspend, options?: unknown) => Promise<void>;
55
+ /** Thread identifier for memory */
56
+ threadId?: string;
57
+ /** Resource identifier */
58
+ resourceId?: string;
59
+ /** Data from previous suspend (if resuming) */
60
+ resumeData?: TResume;
61
+ };
62
+ /** Workflow-specific context (when called from workflow) */
63
+ workflow?: {
64
+ /** Workflow run identifier */
65
+ runId: string;
66
+ /** Workflow definition identifier */
67
+ workflowId: string;
68
+ /** Current workflow state */
69
+ state: unknown;
70
+ /** Update workflow state */
71
+ setState: (state: unknown) => void;
72
+ /** Suspend workflow and wait for input */
73
+ suspend?: (payload: TSuspend, options?: unknown) => Promise<void>;
74
+ /** Data from previous suspend (if resuming) */
75
+ resumeData?: TResume;
76
+ };
77
+ /** MCP-specific context (when called via Model Context Protocol) */
78
+ mcp?: {
79
+ /** MCP protocol extra context */
80
+ extra: unknown;
81
+ };
50
82
  }
51
83
  /**
52
84
  * Mastra tool definition shape.
53
85
  *
54
- * This matches the output of `createTool()` from `@mastra/core/tools`.
86
+ * Matches the output of `createTool()` from `@mastra/core/tools` (v0.24+).
55
87
  *
56
88
  * Key differences from other frameworks:
57
89
  * - Uses `id` only (no `name` property)
58
90
  * - Execute signature: `(inputData, context?)` NOT `({ input })`
59
- * - Context is optional second parameter
91
+ * - Context is optional second parameter with agent/workflow context
60
92
  */
61
- export interface MastraTool<TInput = unknown, TOutput = unknown> {
93
+ export interface MastraTool<TInput = unknown, TOutput = unknown, TSuspend = unknown, TResume = unknown> {
62
94
  /** Unique identifier for the tool */
63
95
  id: string;
64
96
  /** Description of what the tool does */
@@ -68,7 +100,9 @@ export interface MastraTool<TInput = unknown, TOutput = unknown> {
68
100
  /** Zod schema for output validation (null if not specified) */
69
101
  outputSchema: z.ZodSchema<TOutput> | undefined;
70
102
  /** Tool execution function */
71
- execute: (inputData: TInput, context?: MastraToolContext) => Promise<TOutput>;
103
+ execute: (inputData: TInput, context?: MastraToolContext<TSuspend, TResume>) => Promise<TOutput>;
104
+ /** Whether tool requires human approval before execution */
105
+ requireApproval?: boolean;
72
106
  }
73
107
  /**
74
108
  * Adapter for converting bigtool-ts tools to Mastra format.
@@ -99,6 +133,8 @@ export declare class MastraAdapter implements ToolAdapter<MastraTool> {
99
133
  * Creates a Mastra-compatible tool definition that lazily loads
100
134
  * and executes the underlying bigtool-ts tool implementation.
101
135
  *
136
+ * Supports abort signal propagation for cancellation.
137
+ *
102
138
  * @param metadata - Tool metadata from the catalog
103
139
  * @returns Mastra tool definition
104
140
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mastra.d.ts","sourceRoot":"","sources":["../../src/adapters/mastra.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aAAa,GAAG,aAAa,CAExE"}
@@ -62,6 +62,8 @@ export class MastraAdapter {
62
62
  * Creates a Mastra-compatible tool definition that lazily loads
63
63
  * and executes the underlying bigtool-ts tool implementation.
64
64
  *
65
+ * Supports abort signal propagation for cancellation.
66
+ *
65
67
  * @param metadata - Tool metadata from the catalog
66
68
  * @returns Mastra tool definition
67
69
  */
@@ -74,7 +76,9 @@ export class MastraAdapter {
74
76
  description: metadata.description,
75
77
  inputSchema,
76
78
  outputSchema: undefined,
77
- execute: async (inputData) => {
79
+ execute: async (inputData, context) => {
80
+ // Fail fast on abort before expensive loader call
81
+ context?.abortSignal?.throwIfAborted();
78
82
  const tool = await loader.load(metadata.id);
79
83
  return tool.invoke(inputData);
80
84
  },