@supertools-ai/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/dist/__tests__/protocol.test.d.ts +0 -5
- package/dist/__tests__/protocol.test.d.ts.map +0 -1
- package/dist/__tests__/security.test.d.ts +0 -5
- package/dist/__tests__/security.test.d.ts.map +0 -1
- package/dist/__tests__/tool.test.d.ts +0 -5
- package/dist/__tests__/tool.test.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -64
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.mts +0 -183
- package/dist/index.mjs +0 -937
- package/dist/mcp/client.d.ts +0 -48
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/index.d.ts +0 -9
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/schema.d.ts +0 -20
- package/dist/mcp/schema.d.ts.map +0 -1
- package/dist/mcp/types.d.ts +0 -96
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/relay/protocol.d.ts +0 -84
- package/dist/relay/protocol.d.ts.map +0 -1
- package/dist/relay/security.d.ts +0 -4
- package/dist/relay/security.d.ts.map +0 -1
- package/dist/relay/server.d.ts +0 -15
- package/dist/relay/server.d.ts.map +0 -1
- package/dist/relay/utils/token.d.ts +0 -4
- package/dist/relay/utils/token.d.ts.map +0 -1
- package/dist/type-hints.d.ts +0 -3
- package/dist/type-hints.d.ts.map +0 -1
- package/dist/utils/sandbox-pool.d.ts +0 -63
- package/dist/utils/sandbox-pool.d.ts.map +0 -1
package/dist/mcp/client.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
package/dist/mcp/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/mcp/index.d.ts
DELETED
package/dist/mcp/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/mcp/schema.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
package/dist/mcp/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/mcp/types.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
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
|
package/dist/mcp/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ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AAK,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,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"}
|
package/dist/relay/protocol.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,cA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AAO,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"}
|
package/dist/relay/security.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/relay/server.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/type-hints.d.ts
DELETED
package/dist/type-hints.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-hints.d.ts","sourceRoot":"","sources":["../src/type-hints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAqBnC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAKhE"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox Pool
|
|
3
|
-
*
|
|
4
|
-
* Pre-warms sandboxes to eliminate cold start latency.
|
|
5
|
-
* Sandboxes are created in advance and reused.
|
|
6
|
-
*/
|
|
7
|
-
import { Sandbox } from '@e2b/code-interpreter';
|
|
8
|
-
export interface SandboxPoolOptions {
|
|
9
|
-
/** Number of sandboxes to keep warm (default: 1) */
|
|
10
|
-
readonly size?: number;
|
|
11
|
-
/** E2B API key (default: E2B_API_KEY env) */
|
|
12
|
-
readonly apiKey?: string;
|
|
13
|
-
/** Sandbox timeout in ms (default: 300000) */
|
|
14
|
-
readonly timeoutMs?: number;
|
|
15
|
-
/** Template name (default: 'supertools-bun') */
|
|
16
|
-
readonly template?: string;
|
|
17
|
-
/** Enable debug logging */
|
|
18
|
-
readonly debug?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare class SandboxPool {
|
|
21
|
-
private readonly pool;
|
|
22
|
-
private readonly size;
|
|
23
|
-
private readonly apiKey?;
|
|
24
|
-
private readonly timeoutMs;
|
|
25
|
-
private readonly template;
|
|
26
|
-
private readonly debug;
|
|
27
|
-
private warming;
|
|
28
|
-
private closed;
|
|
29
|
-
constructor(options?: SandboxPoolOptions);
|
|
30
|
-
private log;
|
|
31
|
-
/**
|
|
32
|
-
* Pre-warm the pool with sandboxes.
|
|
33
|
-
* Call this once at startup for optimal performance.
|
|
34
|
-
*/
|
|
35
|
-
warmup(): Promise<void>;
|
|
36
|
-
private doWarmup;
|
|
37
|
-
private createSandbox;
|
|
38
|
-
/**
|
|
39
|
-
* Acquire a sandbox from the pool.
|
|
40
|
-
* If pool is empty, creates a new one.
|
|
41
|
-
* The sandbox is removed from the pool and must be returned or killed.
|
|
42
|
-
*/
|
|
43
|
-
acquire(): Promise<Sandbox>;
|
|
44
|
-
private refillInBackground;
|
|
45
|
-
/**
|
|
46
|
-
* Return a sandbox to the pool for reuse.
|
|
47
|
-
* Only call if the sandbox is still healthy.
|
|
48
|
-
*/
|
|
49
|
-
release(sandbox: Sandbox): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Close the pool and kill all sandboxes.
|
|
52
|
-
*/
|
|
53
|
-
close(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Get current pool size.
|
|
56
|
-
*/
|
|
57
|
-
get available(): number;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Create a new sandbox pool.
|
|
61
|
-
*/
|
|
62
|
-
export declare function createSandboxPool(options?: SandboxPoolOptions): SandboxPool;
|
|
63
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