@supertools-ai/core 0.1.0

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 (61) hide show
  1. package/README.md +379 -0
  2. package/dist/__tests__/protocol.test.d.ts +5 -0
  3. package/dist/__tests__/protocol.test.d.ts.map +1 -0
  4. package/dist/__tests__/security.test.d.ts +5 -0
  5. package/dist/__tests__/security.test.d.ts.map +1 -0
  6. package/dist/__tests__/tool.test.d.ts +5 -0
  7. package/dist/__tests__/tool.test.d.ts.map +1 -0
  8. package/dist/errors.d.ts +64 -0
  9. package/dist/errors.d.ts.map +1 -0
  10. package/dist/executor.d.ts +38 -0
  11. package/dist/executor.d.ts.map +1 -0
  12. package/dist/index.d.mts +183 -0
  13. package/dist/index.d.ts +48 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +14556 -0
  16. package/dist/index.mjs +937 -0
  17. package/dist/mcp/client.d.ts +48 -0
  18. package/dist/mcp/client.d.ts.map +1 -0
  19. package/dist/mcp/index.d.ts +9 -0
  20. package/dist/mcp/index.d.ts.map +1 -0
  21. package/dist/mcp/schema.d.ts +20 -0
  22. package/dist/mcp/schema.d.ts.map +1 -0
  23. package/dist/mcp/types.d.ts +96 -0
  24. package/dist/mcp/types.d.ts.map +1 -0
  25. package/dist/prompts.d.ts +7 -0
  26. package/dist/prompts.d.ts.map +1 -0
  27. package/dist/providers/anthropic.d.ts +63 -0
  28. package/dist/providers/anthropic.d.ts.map +1 -0
  29. package/dist/relay/client.d.ts +46 -0
  30. package/dist/relay/client.d.ts.map +1 -0
  31. package/dist/relay/index.d.ts +11 -0
  32. package/dist/relay/index.d.ts.map +1 -0
  33. package/dist/relay/protocol.d.ts +84 -0
  34. package/dist/relay/protocol.d.ts.map +1 -0
  35. package/dist/relay/security.d.ts +4 -0
  36. package/dist/relay/security.d.ts.map +1 -0
  37. package/dist/relay/server.d.ts +15 -0
  38. package/dist/relay/server.d.ts.map +1 -0
  39. package/dist/relay/types.d.ts +16 -0
  40. package/dist/relay/types.d.ts.map +1 -0
  41. package/dist/relay/utils/protocol.d.ts +92 -0
  42. package/dist/relay/utils/protocol.d.ts.map +1 -0
  43. package/dist/relay/utils/token.d.ts +4 -0
  44. package/dist/relay/utils/token.d.ts.map +1 -0
  45. package/dist/supertools.d.ts +90 -0
  46. package/dist/supertools.d.ts.map +1 -0
  47. package/dist/tool.d.ts +66 -0
  48. package/dist/tool.d.ts.map +1 -0
  49. package/dist/type-hints.d.ts +3 -0
  50. package/dist/type-hints.d.ts.map +1 -0
  51. package/dist/types.d.ts +85 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/utils/errors.d.ts +50 -0
  54. package/dist/utils/errors.d.ts.map +1 -0
  55. package/dist/utils/sandbox-pool.d.ts +63 -0
  56. package/dist/utils/sandbox-pool.d.ts.map +1 -0
  57. package/dist/utils/string.d.ts +5 -0
  58. package/dist/utils/string.d.ts.map +1 -0
  59. package/dist/utils/type-hints.d.ts +3 -0
  60. package/dist/utils/type-hints.d.ts.map +1 -0
  61. package/package.json +77 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * MCP Client
3
+ *
4
+ * Connects to MCP servers and fetches tool schemas.
5
+ * Uses the official MCP SDK for E2B Gateway connections.
6
+ */
7
+ import type { MCPServerConfig, MCPServerE2BConfig, MCPConnection, MCPTool } from './types';
8
+ /**
9
+ * E2B MCP Gateway client
10
+ *
11
+ * Connects to E2B's built-in MCP Gateway to access external MCP servers
12
+ * like Browserbase, Exa, etc.
13
+ *
14
+ * Uses the official MCP SDK for proper protocol handling.
15
+ */
16
+ export declare class E2BMCPClient implements MCPConnection {
17
+ readonly config: MCPServerE2BConfig;
18
+ readonly tools: MCPTool[];
19
+ private readonly mcpUrl;
20
+ private readonly mcpToken;
21
+ private client;
22
+ private transport;
23
+ constructor(config: MCPServerE2BConfig, mcpUrl: string, mcpToken: string);
24
+ /**
25
+ * Connect to MCP gateway and fetch available tools
26
+ */
27
+ fetchTools(): Promise<void>;
28
+ /**
29
+ * Call an MCP tool via the gateway
30
+ *
31
+ * Automatically unwraps MCP responses from { content: [...] } format
32
+ * to the actual data (parsed JSON or raw text).
33
+ */
34
+ callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
35
+ disconnect(): Promise<void>;
36
+ }
37
+ /**
38
+ * Create MCP connections for the given server configs
39
+ *
40
+ * Note: The sandbox must be created with MCP configuration to have
41
+ * getMcpUrl() and getMcpToken() methods available.
42
+ */
43
+ export declare function connectMCPServers(configs: readonly MCPServerConfig[], sandbox: unknown): Promise<MCPConnection[]>;
44
+ /**
45
+ * Disconnect all MCP connections
46
+ */
47
+ export declare function disconnectMCPServers(connections: readonly MCPConnection[]): Promise<void>;
48
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,OAAO,EACR,MAAM,SAAS,CAAC;AA0DjB;;;;;;;GAOG;AACH,qBAAa,YAAa,YAAW,aAAa;IAChD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAA8C;gBAG7D,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM;IAOlB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAsCjC;;;;;OAKG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IASvE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAOlC;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,EAAE,CAAC,CAmC1B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP (Model Context Protocol) Support
3
+ *
4
+ * Enables programmatic calling of MCP tools via E2B sandbox.
5
+ */
6
+ export * from './types';
7
+ export * from './schema';
8
+ export * from './client';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * MCP Schema Converter
3
+ *
4
+ * Converts MCP tool definitions (JSON Schema) to Supertools NormalizedTool format.
5
+ */
6
+ import type { NormalizedTool } from '../tool';
7
+ import type { MCPTool, MCPConnection } from './types';
8
+ /**
9
+ * Convert an MCP tool to NormalizedTool format
10
+ */
11
+ export declare function mcpToolToNormalized(tool: MCPTool, connection: MCPConnection): NormalizedTool;
12
+ /**
13
+ * Convert all tools from an MCP connection to NormalizedTool array
14
+ */
15
+ export declare function mcpToolsToNormalized(connection: MCPConnection): NormalizedTool[];
16
+ /**
17
+ * Generate TypeScript type hint for an MCP tool (for LLM prompt)
18
+ */
19
+ export declare function generateMCPTypeHint(tool: MCPTool): string;
20
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/mcp/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAsB,MAAM,SAAS,CAAC;AA2D1E;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,aAAa,GACxB,cAAc,CAahB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,cAAc,EAAE,CAEhF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CA4BzD"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * MCP (Model Context Protocol) type definitions
3
+ *
4
+ * These types match the MCP specification for tools.
5
+ * @see https://modelcontextprotocol.io/specification/2025-06-18
6
+ */
7
+ /**
8
+ * JSON Schema property definition
9
+ */
10
+ export interface JsonSchemaProperty {
11
+ readonly type?: string | readonly string[];
12
+ readonly description?: string;
13
+ readonly enum?: readonly unknown[];
14
+ readonly items?: JsonSchemaProperty;
15
+ readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;
16
+ readonly required?: readonly string[];
17
+ readonly default?: unknown;
18
+ readonly minLength?: number;
19
+ readonly maxLength?: number;
20
+ readonly minimum?: number;
21
+ readonly maximum?: number;
22
+ }
23
+ /**
24
+ * JSON Schema for tool input parameters
25
+ */
26
+ export interface JsonSchema {
27
+ readonly type: 'object';
28
+ readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;
29
+ readonly required?: readonly string[];
30
+ }
31
+ /**
32
+ * MCP Tool definition as returned by tools/list
33
+ */
34
+ export interface MCPTool {
35
+ readonly name: string;
36
+ readonly description: string;
37
+ readonly inputSchema: JsonSchema;
38
+ }
39
+ /**
40
+ * MCP tools/list response
41
+ */
42
+ export interface MCPToolsListResponse {
43
+ readonly tools: readonly MCPTool[];
44
+ }
45
+ /**
46
+ * MCP tool call request
47
+ */
48
+ export interface MCPToolCallRequest {
49
+ readonly name: string;
50
+ readonly arguments?: Readonly<Record<string, unknown>>;
51
+ }
52
+ /**
53
+ * MCP tool call response
54
+ */
55
+ export interface MCPToolCallResponse {
56
+ readonly content: readonly MCPToolContent[];
57
+ readonly isError?: boolean;
58
+ }
59
+ export interface MCPToolContent {
60
+ readonly type: 'text' | 'image' | 'resource';
61
+ readonly text?: string;
62
+ readonly data?: string;
63
+ readonly mimeType?: string;
64
+ }
65
+ /**
66
+ * MCP Server configuration
67
+ */
68
+ export type MCPServerConfig = MCPServerStdioConfig | MCPServerSSEConfig | MCPServerE2BConfig;
69
+ export interface MCPServerStdioConfig {
70
+ readonly transport: 'stdio';
71
+ readonly command: string;
72
+ readonly args?: readonly string[];
73
+ readonly env?: Readonly<Record<string, string>>;
74
+ }
75
+ export interface MCPServerSSEConfig {
76
+ readonly transport: 'sse';
77
+ readonly url: string;
78
+ readonly headers?: Readonly<Record<string, string>>;
79
+ }
80
+ export interface MCPServerE2BConfig {
81
+ readonly transport: 'e2b';
82
+ /** MCP server name from E2B's gateway (e.g., 'browserbase', 'exa') */
83
+ readonly name: string;
84
+ /** API key for the MCP server (if required) */
85
+ readonly apiKey?: string;
86
+ }
87
+ /**
88
+ * Connected MCP server with tools
89
+ */
90
+ export interface MCPConnection {
91
+ readonly config: MCPServerConfig;
92
+ readonly tools: readonly MCPTool[];
93
+ callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
94
+ disconnect(): Promise<void>;
95
+ }
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,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,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * System prompt template for code generation.
3
+ * Uses XML structure for clear parsing by LLMs.
4
+ */
5
+ export declare function buildSystemPrompt(toolDefinitions: string, additionalInstructions?: string): string;
6
+ export declare function extractCode(response: string): string;
7
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAkDlG;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqBpD"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Anthropic Provider
3
+ *
4
+ * Wraps the Anthropic SDK with programmatic tool execution.
5
+ * Every request generates code that runs in a secure E2B sandbox.
6
+ */
7
+ import { type AnyTool } from '../tool';
8
+ import type { SupertoolsConfig } from '../supertools';
9
+ interface AnthropicClient {
10
+ messages: {
11
+ create(params: MessageCreateParams): Promise<Message>;
12
+ };
13
+ }
14
+ interface SystemContentBlock {
15
+ type: 'text';
16
+ text: string;
17
+ cache_control?: {
18
+ type: 'ephemeral';
19
+ };
20
+ }
21
+ interface MessageCreateParams {
22
+ model: string;
23
+ messages: MessageParam[];
24
+ max_tokens: number;
25
+ system?: string | SystemContentBlock[];
26
+ [key: string]: unknown;
27
+ }
28
+ interface MessageParam {
29
+ role: 'user' | 'assistant';
30
+ content: string | ContentBlock[];
31
+ }
32
+ interface ContentBlock {
33
+ type: string;
34
+ text?: string;
35
+ [key: string]: unknown;
36
+ }
37
+ interface Message {
38
+ id: string;
39
+ type: 'message';
40
+ role: 'assistant';
41
+ content: ContentBlock[];
42
+ model: string;
43
+ stop_reason: string | null;
44
+ stop_sequence: string | null;
45
+ usage: {
46
+ input_tokens: number;
47
+ output_tokens: number;
48
+ };
49
+ }
50
+ /**
51
+ * Check if a client is an Anthropic SDK instance
52
+ */
53
+ export declare function isAnthropicClient(client: unknown): client is AnthropicClient;
54
+ /**
55
+ * Wrap an Anthropic client with programmatic tool execution.
56
+ *
57
+ * Every request is converted to code that executes in a sandbox.
58
+ * This is optimized for tool-heavy workflows with complex logic,
59
+ * loops, and multiple interdependent tool calls.
60
+ */
61
+ export declare function wrapAnthropicClient<T extends AnthropicClient>(client: T, tools: readonly AnyTool[], config: SupertoolsConfig): T;
62
+ export {};
63
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItD,UAAU,eAAe;IACvB,QAAQ,EAAE;QACR,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACvD,CAAC;CACH;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC;CACvC;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;CAClC;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,eAAe,CAO5E;AAmCD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,eAAe,EAC3D,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,MAAM,EAAE,gBAAgB,GACvB,CAAC,CA2FH"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Relay Client - uses WebSocket to communicate with Relay Server to handle tool calls.
3
+ */
4
+ import type { NormalizedTool } from '../tool';
5
+ import type { ExecutionEvent } from '../types';
6
+ export interface RelayClientConfig {
7
+ url: string;
8
+ token: string;
9
+ tools: Map<string, NormalizedTool>;
10
+ debug?: boolean;
11
+ timeout?: number;
12
+ reconnect?: boolean;
13
+ maxRetries?: number;
14
+ onEvent?: (event: ExecutionEvent) => void;
15
+ }
16
+ export declare class RelayClient {
17
+ private ws;
18
+ private retryCount;
19
+ private closing;
20
+ private readonly config;
21
+ private readonly log;
22
+ private readonly emit;
23
+ private readonly startTime;
24
+ private executionState;
25
+ /** Reset state before each execution to allow client reuse */
26
+ private resetExecutionState;
27
+ private ts;
28
+ constructor(config: RelayClientConfig);
29
+ get connected(): boolean;
30
+ connect(): Promise<void>;
31
+ disconnect(): Promise<void>;
32
+ private createConnection;
33
+ private reconnect;
34
+ private onMessage;
35
+ private handleToolCall;
36
+ private send;
37
+ /** Send code to relay for direct execution */
38
+ execute(code: string, remoteTools: string[], localTools?: Record<string, string>): void;
39
+ /** Wait for result or error from execution (event-driven, no polling) */
40
+ waitForResult(timeoutMs: number): Promise<{
41
+ success: boolean;
42
+ error?: string;
43
+ }>;
44
+ }
45
+ export declare function createRelayClient(config: RelayClientConfig): RelayClient;
46
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/relay/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC3C;AAWD,qBAAa,WAAW;IACtB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoF;IAC3G,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkC;IACvD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IAExC,OAAO,CAAC,cAAc,CAIpB;IAEF,8DAA8D;IAC9D,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,EAAE;gBAIE,MAAM,EAAE,iBAAiB;IAerC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BjC,OAAO,CAAC,gBAAgB;YAwCV,SAAS;IA2BvB,OAAO,CAAC,SAAS;YAgEH,cAAc;IA4B5B,OAAO,CAAC,IAAI;IAaZ,8CAA8C;IAC9C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,IAAI;IAW3F,yEAAyE;IACzE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAsBhF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAExE"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Relay Module
3
+ * WebSocket communication between host and E2B sandbox.
4
+ */
5
+ export type { RelayConfig } from './types';
6
+ export { DEFAULT_RELAY_CONFIG } from './types';
7
+ export { parseMessage, parseToolCall, parseToolResult, validateOutgoing, safeParse, ProtocolError, } from './utils/protocol';
8
+ export type { ToolCallMessage, ToolResultMessage, ErrorMessage, PingMessage, PongMessage, ResultMessage, Message, } from './utils/protocol';
9
+ export { RelayClient, createRelayClient } from './client';
10
+ export type { RelayClientConfig } from './client';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,aAAa,EACb,OAAO,GACR,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+ import { OPTError } from '../errors';
3
+ export type ProtocolErrorCode = 'INVALID_JSON' | 'INVALID_MESSAGE' | 'UNEXPECTED_TYPE';
4
+ export declare class ProtocolError extends OPTError {
5
+ readonly protocolCode: ProtocolErrorCode;
6
+ readonly zodError?: z.ZodError;
7
+ constructor(message: string, code: ProtocolErrorCode, zodError?: z.ZodError);
8
+ toJSON(): {
9
+ protocolCode: ProtocolErrorCode;
10
+ issues: z.core.$ZodIssue[] | undefined;
11
+ name: string;
12
+ code: import("../errors").ErrorCode;
13
+ message: string;
14
+ cause: string | undefined;
15
+ };
16
+ }
17
+ export declare const toolCallSchema: z.ZodObject<{
18
+ type: z.ZodLiteral<"tool_call">;
19
+ id: z.ZodString;
20
+ tool: z.ZodString;
21
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
22
+ }, z.core.$strict>;
23
+ export declare const toolResultSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"tool_result">;
25
+ id: z.ZodString;
26
+ success: z.ZodBoolean;
27
+ result: z.ZodOptional<z.ZodUnknown>;
28
+ error: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ export declare const errorSchema: z.ZodObject<{
31
+ type: z.ZodLiteral<"error">;
32
+ id: z.ZodString;
33
+ error: z.ZodString;
34
+ code: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strict>;
36
+ export declare const pingSchema: z.ZodObject<{
37
+ type: z.ZodLiteral<"ping">;
38
+ id: z.ZodString;
39
+ }, z.core.$strict>;
40
+ export declare const pongSchema: z.ZodObject<{
41
+ type: z.ZodLiteral<"pong">;
42
+ id: z.ZodString;
43
+ }, z.core.$strict>;
44
+ export declare const messageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
+ type: z.ZodLiteral<"tool_call">;
46
+ id: z.ZodString;
47
+ tool: z.ZodString;
48
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
49
+ }, z.core.$strict>, z.ZodObject<{
50
+ type: z.ZodLiteral<"tool_result">;
51
+ id: z.ZodString;
52
+ success: z.ZodBoolean;
53
+ result: z.ZodOptional<z.ZodUnknown>;
54
+ error: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strict>, z.ZodObject<{
56
+ type: z.ZodLiteral<"error">;
57
+ id: z.ZodString;
58
+ error: z.ZodString;
59
+ code: z.ZodOptional<z.ZodString>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ type: z.ZodLiteral<"ping">;
62
+ id: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ type: z.ZodLiteral<"pong">;
65
+ id: z.ZodString;
66
+ }, z.core.$strict>], "type">;
67
+ export type ToolCallMessage = z.infer<typeof toolCallSchema>;
68
+ export type ToolResultMessage = z.infer<typeof toolResultSchema>;
69
+ export type ErrorMessage = z.infer<typeof errorSchema>;
70
+ export type PingMessage = z.infer<typeof pingSchema>;
71
+ export type PongMessage = z.infer<typeof pongSchema>;
72
+ export type Message = z.infer<typeof messageSchema>;
73
+ export declare function parseMessage(input: unknown): Message;
74
+ export declare function parseToolCall(input: unknown): ToolCallMessage;
75
+ export declare function parseToolResult(input: unknown): ToolResultMessage;
76
+ export declare function validateOutgoing(message: unknown): void;
77
+ export declare function safeParse(input: unknown): {
78
+ ok: true;
79
+ data: Message;
80
+ } | {
81
+ ok: false;
82
+ error: ProtocolError;
83
+ };
84
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/relay/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEvF,qBAAa,aAAc,SAAQ,QAAQ;IACzC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ;IAOlE,MAAM;;;;;;;;CAOhB;AAKD,eAAO,MAAM,cAAc;;;;;kBAKhB,CAAC;AAEZ,eAAO,MAAM,gBAAgB;;;;;;kBAMlB,CAAC;AAEZ,eAAO,MAAM,WAAW;;;;;kBAKb,CAAC;AAEZ,eAAO,MAAM,UAAU;;;kBAAgE,CAAC;AACxF,eAAO,MAAM,UAAU;;;kBAAgE,CAAC;AAExF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;4BAMxB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAM7D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAMjE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEvD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAS3G"}
@@ -0,0 +1,4 @@
1
+ export declare function generateToken(): string;
2
+ export declare function verifyToken(provided: string, expected: string): void;
3
+ export declare function isTokenValid(provided: string, expected: string): boolean;
4
+ //# sourceMappingURL=security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/relay/security.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOpE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOxE"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generates client-side code injected into user's sandbox script.
3
+ * Provides tool functions and sendResult() for structured output.
4
+ * Uses Unix socket for fast IPC with HTTP fallback.
5
+ * Pure JavaScript (no TS) for fastest execution.
6
+ */
7
+ export declare function generateToolFunctions(tools: readonly {
8
+ name: string;
9
+ }[]): string;
10
+ export declare function generateClientCode(config: {
11
+ port: number;
12
+ }, tools: readonly {
13
+ name: string;
14
+ }[]): string;
15
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/relay/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAIhF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAiFvG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Relay configuration and constants
3
+ */
4
+ export interface RelayConfig {
5
+ readonly port: number;
6
+ readonly token: string;
7
+ readonly timeout: number;
8
+ readonly debug: boolean;
9
+ }
10
+ /**
11
+ * Default relay config.
12
+ * Note: token is empty by default - callers should generate a secure random token
13
+ * using crypto.randomUUID() or similar before connecting.
14
+ */
15
+ export declare const DEFAULT_RELAY_CONFIG: RelayConfig;
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/relay/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAKzB,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ import { OPTError } from '../../utils/errors';
3
+ export type ProtocolErrorCode = 'INVALID_JSON' | 'INVALID_MESSAGE' | 'UNEXPECTED_TYPE';
4
+ export declare class ProtocolError extends OPTError {
5
+ readonly protocolCode: ProtocolErrorCode;
6
+ readonly zodError?: z.ZodError;
7
+ constructor(message: string, code: ProtocolErrorCode, zodError?: z.ZodError);
8
+ toJSON(): {
9
+ protocolCode: ProtocolErrorCode;
10
+ issues: z.core.$ZodIssue[] | undefined;
11
+ name: string;
12
+ code: import("../../utils/errors").ErrorCode;
13
+ message: string;
14
+ cause: string | undefined;
15
+ };
16
+ }
17
+ export declare const toolCallSchema: z.ZodObject<{
18
+ type: z.ZodLiteral<"tool_call">;
19
+ id: z.ZodString;
20
+ tool: z.ZodString;
21
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
22
+ }, z.core.$strict>;
23
+ export declare const toolResultSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"tool_result">;
25
+ id: z.ZodString;
26
+ success: z.ZodBoolean;
27
+ result: z.ZodOptional<z.ZodUnknown>;
28
+ error: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ export declare const errorSchema: z.ZodObject<{
31
+ type: z.ZodLiteral<"error">;
32
+ id: z.ZodOptional<z.ZodString>;
33
+ error: z.ZodString;
34
+ code: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strict>;
36
+ export declare const pingSchema: z.ZodObject<{
37
+ type: z.ZodLiteral<"ping">;
38
+ id: z.ZodString;
39
+ }, z.core.$strict>;
40
+ export declare const pongSchema: z.ZodObject<{
41
+ type: z.ZodLiteral<"pong">;
42
+ id: z.ZodString;
43
+ }, z.core.$strict>;
44
+ export declare const resultSchema: z.ZodObject<{
45
+ type: z.ZodLiteral<"result">;
46
+ data: z.ZodUnknown;
47
+ }, z.core.$strict>;
48
+ export declare const messageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
49
+ type: z.ZodLiteral<"tool_call">;
50
+ id: z.ZodString;
51
+ tool: z.ZodString;
52
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ type: z.ZodLiteral<"tool_result">;
55
+ id: z.ZodString;
56
+ success: z.ZodBoolean;
57
+ result: z.ZodOptional<z.ZodUnknown>;
58
+ error: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ type: z.ZodLiteral<"error">;
61
+ id: z.ZodOptional<z.ZodString>;
62
+ error: z.ZodString;
63
+ code: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strict>, z.ZodObject<{
65
+ type: z.ZodLiteral<"ping">;
66
+ id: z.ZodString;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ type: z.ZodLiteral<"pong">;
69
+ id: z.ZodString;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ type: z.ZodLiteral<"result">;
72
+ data: z.ZodUnknown;
73
+ }, z.core.$strict>], "type">;
74
+ export type ToolCallMessage = z.infer<typeof toolCallSchema>;
75
+ export type ToolResultMessage = z.infer<typeof toolResultSchema>;
76
+ export type ErrorMessage = z.infer<typeof errorSchema>;
77
+ export type PingMessage = z.infer<typeof pingSchema>;
78
+ export type PongMessage = z.infer<typeof pongSchema>;
79
+ export type ResultMessage = z.infer<typeof resultSchema>;
80
+ export type Message = z.infer<typeof messageSchema>;
81
+ export declare function parseMessage(input: unknown): Message;
82
+ export declare function parseToolCall(input: unknown): ToolCallMessage;
83
+ export declare function parseToolResult(input: unknown): ToolResultMessage;
84
+ export declare function validateOutgoing(message: unknown): void;
85
+ export declare function safeParse(input: unknown): {
86
+ ok: true;
87
+ data: Message;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K,CAAC,OAAO,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACzD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAM7D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAMjE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEvD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAS3G"}
@@ -0,0 +1,4 @@
1
+ export declare function generateToken(): string;
2
+ export declare function verifyToken(provided: string, expected: string): void;
3
+ export declare function isTokenValid(provided: string, expected: string): boolean;
4
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/relay/utils/token.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOpE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOxE"}