@execbox/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.
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/executor-C0lf5vWT.d.ts +182 -0
- package/dist/executor-C0lf5vWT.d.ts.map +1 -0
- package/dist/executor-DcnjQGwA.d.cts +182 -0
- package/dist/executor-DcnjQGwA.d.cts.map +1 -0
- package/dist/index.cjs +242 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +105 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +221 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.cjs +234 -0
- package/dist/mcp/index.cjs.map +1 -0
- package/dist/mcp/index.d.cts +77 -0
- package/dist/mcp/index.d.cts.map +1 -0
- package/dist/mcp/index.d.ts +77 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +230 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/resolveProvider-CUxAvFCK.js +338 -0
- package/dist/resolveProvider-CUxAvFCK.js.map +1 -0
- package/dist/resolveProvider-CixOjPKp.cjs +456 -0
- package/dist/resolveProvider-CixOjPKp.cjs.map +1 -0
- package/package.json +54 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
const require_resolveProvider = require('./resolveProvider-CixOjPKp.cjs');
|
|
2
|
+
let acorn = require("acorn");
|
|
3
|
+
|
|
4
|
+
//#region src/executor/shared.ts
|
|
5
|
+
const EXECUTION_TIMEOUT_MESSAGE = "Execution timed out";
|
|
6
|
+
/**
|
|
7
|
+
* Canonical error codes that may safely cross trusted executor boundaries.
|
|
8
|
+
*/
|
|
9
|
+
const KNOWN_EXECUTE_ERROR_CODES = new Set([
|
|
10
|
+
"timeout",
|
|
11
|
+
"memory_limit",
|
|
12
|
+
"validation_error",
|
|
13
|
+
"tool_error",
|
|
14
|
+
"runtime_error",
|
|
15
|
+
"serialization_error",
|
|
16
|
+
"internal_error"
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Returns whether the value is one of execbox's stable execution error codes.
|
|
20
|
+
*/
|
|
21
|
+
function isKnownExecuteErrorCode(value) {
|
|
22
|
+
return KNOWN_EXECUTE_ERROR_CODES.has(value);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the stable timeout message used across executor implementations.
|
|
26
|
+
*/
|
|
27
|
+
function getExecutionTimeoutMessage() {
|
|
28
|
+
return EXECUTION_TIMEOUT_MESSAGE;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
32
|
+
*/
|
|
33
|
+
function createTimeoutExecuteResult(durationMs = 0) {
|
|
34
|
+
return {
|
|
35
|
+
durationMs,
|
|
36
|
+
error: {
|
|
37
|
+
code: "timeout",
|
|
38
|
+
message: getExecutionTimeoutMessage()
|
|
39
|
+
},
|
|
40
|
+
logs: [],
|
|
41
|
+
ok: false
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes an unknown thrown value into a human-readable message.
|
|
46
|
+
*/
|
|
47
|
+
function normalizeThrownMessage(error) {
|
|
48
|
+
if (error instanceof Error) return error.message;
|
|
49
|
+
if (typeof error === "object" && error !== null && "message" in error) {
|
|
50
|
+
const message = error.message;
|
|
51
|
+
if (typeof message === "string") return message;
|
|
52
|
+
}
|
|
53
|
+
return String(error);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the thrown error name when one is available.
|
|
57
|
+
*/
|
|
58
|
+
function normalizeThrownName(error) {
|
|
59
|
+
if (error instanceof Error) return error.name;
|
|
60
|
+
if (typeof error === "object" && error !== null && "name" in error) {
|
|
61
|
+
const name = error.name;
|
|
62
|
+
if (typeof name === "string") return name;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
67
|
+
*/
|
|
68
|
+
function createExecutionContext(signal, providerName, safeToolName, originalToolName) {
|
|
69
|
+
return {
|
|
70
|
+
originalToolName,
|
|
71
|
+
providerName,
|
|
72
|
+
safeToolName,
|
|
73
|
+
signal
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Truncates captured logs to the configured line and character limits.
|
|
78
|
+
*/
|
|
79
|
+
function truncateLogs(logs, maxLogLines, maxLogChars) {
|
|
80
|
+
const limitedLines = logs.slice(0, maxLogLines);
|
|
81
|
+
let remainingChars = maxLogChars;
|
|
82
|
+
const truncated = [];
|
|
83
|
+
for (const line of limitedLines) {
|
|
84
|
+
if (remainingChars <= 0) break;
|
|
85
|
+
if (line.length <= remainingChars) {
|
|
86
|
+
truncated.push(line);
|
|
87
|
+
remainingChars -= line.length;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
truncated.push(line.slice(0, remainingChars));
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return truncated;
|
|
94
|
+
}
|
|
95
|
+
function formatLogValue(value) {
|
|
96
|
+
if (typeof value === "string") return value;
|
|
97
|
+
if (value === void 0) return "undefined";
|
|
98
|
+
try {
|
|
99
|
+
return JSON.stringify(value);
|
|
100
|
+
} catch {
|
|
101
|
+
return String(value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Formats guest console arguments into a single host-side log line.
|
|
106
|
+
*/
|
|
107
|
+
function formatConsoleLine(values) {
|
|
108
|
+
return values.map((value) => formatLogValue(value)).join(" ");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/normalize.ts
|
|
113
|
+
function stripCodeFences(source) {
|
|
114
|
+
const match = source.match(/^\s*```[^\n]*\n([\s\S]*?)\n?```\s*$/);
|
|
115
|
+
return match ? match[1] : source;
|
|
116
|
+
}
|
|
117
|
+
function wrapAsync(body) {
|
|
118
|
+
if (body.trim().length === 0) return "async () => {}";
|
|
119
|
+
return `async () => {\n${body}\n}`;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
123
|
+
*/
|
|
124
|
+
function normalizeCode(source) {
|
|
125
|
+
const normalizedSource = stripCodeFences(source).trim();
|
|
126
|
+
if (normalizedSource.length === 0) return "async () => {}";
|
|
127
|
+
try {
|
|
128
|
+
const program = (0, acorn.parse)(normalizedSource, {
|
|
129
|
+
ecmaVersion: "latest",
|
|
130
|
+
sourceType: "module"
|
|
131
|
+
});
|
|
132
|
+
if (program.body?.length === 1) {
|
|
133
|
+
const [statement] = program.body;
|
|
134
|
+
if (statement.type === "FunctionDeclaration" && statement.id?.name) return wrapAsync(`${normalizedSource}\nreturn ${statement.id.name}();`);
|
|
135
|
+
if (statement.type === "ExpressionStatement" && statement.expression) {
|
|
136
|
+
if (statement.expression.type === "ArrowFunctionExpression" && statement.expression.async) return normalizedSource;
|
|
137
|
+
return wrapAsync(`return (${normalizedSource});`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const lastStatement = (program.body ?? []).at(-1);
|
|
141
|
+
if (lastStatement?.type === "ExpressionStatement" && lastStatement.expression) {
|
|
142
|
+
const bodyPrefix = normalizedSource.slice(0, lastStatement.start).trimEnd();
|
|
143
|
+
const expressionSource = normalizedSource.slice(lastStatement.expression.start, lastStatement.expression.end);
|
|
144
|
+
const lines = [];
|
|
145
|
+
if (bodyPrefix.length > 0) lines.push(bodyPrefix);
|
|
146
|
+
lines.push(`return (${expressionSource});`);
|
|
147
|
+
return wrapAsync(lines.join("\n"));
|
|
148
|
+
}
|
|
149
|
+
return wrapAsync(normalizedSource);
|
|
150
|
+
} catch {
|
|
151
|
+
return wrapAsync(normalizedSource);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/runner.ts
|
|
157
|
+
function toTrustedExecuteError(error) {
|
|
158
|
+
if (require_resolveProvider.isExecuteFailure(error)) return {
|
|
159
|
+
code: error.code,
|
|
160
|
+
message: error.message
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
code: "tool_error",
|
|
164
|
+
message: normalizeThrownMessage(error)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Converts resolved providers into manifest metadata that reveals only namespace details.
|
|
169
|
+
*/
|
|
170
|
+
function extractProviderManifests(providers) {
|
|
171
|
+
return providers.map((provider) => ({
|
|
172
|
+
name: provider.name,
|
|
173
|
+
tools: Object.fromEntries(Object.entries(provider.tools).map(([safeToolName, descriptor]) => [safeToolName, {
|
|
174
|
+
description: descriptor.description,
|
|
175
|
+
originalName: descriptor.originalName,
|
|
176
|
+
safeName: descriptor.safeName
|
|
177
|
+
}])),
|
|
178
|
+
types: provider.types
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a host-side dispatcher for runner-emitted tool calls.
|
|
183
|
+
*/
|
|
184
|
+
function createToolCallDispatcher(providers, signal) {
|
|
185
|
+
const providerMap = new Map(providers.map((provider) => [provider.name, provider]));
|
|
186
|
+
return async (call) => {
|
|
187
|
+
const provider = providerMap.get(call.providerName);
|
|
188
|
+
const descriptor = provider?.tools[call.safeToolName];
|
|
189
|
+
if (!provider || !descriptor) return {
|
|
190
|
+
error: {
|
|
191
|
+
code: "internal_error",
|
|
192
|
+
message: `Unknown tool ${call.providerName}.${call.safeToolName}`
|
|
193
|
+
},
|
|
194
|
+
ok: false
|
|
195
|
+
};
|
|
196
|
+
try {
|
|
197
|
+
if (signal.aborted) return {
|
|
198
|
+
error: {
|
|
199
|
+
code: "timeout",
|
|
200
|
+
message: getExecutionTimeoutMessage()
|
|
201
|
+
},
|
|
202
|
+
ok: false
|
|
203
|
+
};
|
|
204
|
+
const result = await descriptor.execute(call.input, createExecutionContext(signal, provider.name, descriptor.safeName, descriptor.originalName));
|
|
205
|
+
if (result !== void 0 && !require_resolveProvider.isJsonSerializable(result)) throw new require_resolveProvider.ExecuteFailure("serialization_error", "Host value is not JSON-serializable");
|
|
206
|
+
return {
|
|
207
|
+
ok: true,
|
|
208
|
+
result
|
|
209
|
+
};
|
|
210
|
+
} catch (error) {
|
|
211
|
+
return {
|
|
212
|
+
error: toTrustedExecuteError(error),
|
|
213
|
+
ok: false
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
exports.ExecuteFailure = require_resolveProvider.ExecuteFailure;
|
|
221
|
+
exports.assertValidIdentifier = require_resolveProvider.assertValidIdentifier;
|
|
222
|
+
exports.createExecutionContext = createExecutionContext;
|
|
223
|
+
exports.createTimeoutExecuteResult = createTimeoutExecuteResult;
|
|
224
|
+
exports.createToolCallDispatcher = createToolCallDispatcher;
|
|
225
|
+
exports.extractProviderManifests = extractProviderManifests;
|
|
226
|
+
exports.formatConsoleLine = formatConsoleLine;
|
|
227
|
+
exports.generateTypesFromJsonSchema = require_resolveProvider.generateTypesFromJsonSchema;
|
|
228
|
+
exports.getExecutionTimeoutMessage = getExecutionTimeoutMessage;
|
|
229
|
+
exports.isExecuteFailure = require_resolveProvider.isExecuteFailure;
|
|
230
|
+
exports.isJsonSerializable = require_resolveProvider.isJsonSerializable;
|
|
231
|
+
exports.isKnownExecuteErrorCode = isKnownExecuteErrorCode;
|
|
232
|
+
exports.isReservedWord = require_resolveProvider.isReservedWord;
|
|
233
|
+
exports.isValidIdentifier = require_resolveProvider.isValidIdentifier;
|
|
234
|
+
exports.normalizeCode = normalizeCode;
|
|
235
|
+
exports.normalizeThrownMessage = normalizeThrownMessage;
|
|
236
|
+
exports.normalizeThrownName = normalizeThrownName;
|
|
237
|
+
exports.resolveProvider = require_resolveProvider.resolveProvider;
|
|
238
|
+
exports.sanitizeIdentifier = require_resolveProvider.sanitizeIdentifier;
|
|
239
|
+
exports.sanitizeToolName = require_resolveProvider.sanitizeToolName;
|
|
240
|
+
exports.serializePropertyName = require_resolveProvider.serializePropertyName;
|
|
241
|
+
exports.truncateLogs = truncateLogs;
|
|
242
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["truncated: string[]","isExecuteFailure","isJsonSerializable","ExecuteFailure"],"sources":["../src/executor/shared.ts","../src/normalize.ts","../src/runner.ts"],"sourcesContent":["import type {\n ExecuteError,\n ExecuteErrorCode,\n ExecuteResult,\n ToolExecutionContext,\n} from \"../types\";\n\nconst EXECUTION_TIMEOUT_MESSAGE = \"Execution timed out\";\n\n/**\n * Canonical error codes that may safely cross trusted executor boundaries.\n */\nconst KNOWN_EXECUTE_ERROR_CODES = new Set<ExecuteErrorCode>([\n \"timeout\",\n \"memory_limit\",\n \"validation_error\",\n \"tool_error\",\n \"runtime_error\",\n \"serialization_error\",\n \"internal_error\",\n]);\n\n/**\n * Returns whether the value is one of execbox's stable execution error codes.\n */\nexport function isKnownExecuteErrorCode(\n value: unknown,\n): value is ExecuteErrorCode {\n return KNOWN_EXECUTE_ERROR_CODES.has(value as ExecuteErrorCode);\n}\n\n/**\n * Returns the stable timeout message used across executor implementations.\n */\nexport function getExecutionTimeoutMessage(): string {\n return EXECUTION_TIMEOUT_MESSAGE;\n}\n\n/**\n * Creates the canonical timeout failure result used for preflight cancellation.\n */\nexport function createTimeoutExecuteResult(durationMs = 0): ExecuteResult {\n return {\n durationMs,\n error: {\n code: \"timeout\",\n message: getExecutionTimeoutMessage(),\n } satisfies ExecuteError,\n logs: [],\n ok: false,\n };\n}\n\n/**\n * Normalizes an unknown thrown value into a human-readable message.\n */\nexport function normalizeThrownMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n const message = (error as { message?: unknown }).message;\n if (typeof message === \"string\") {\n return message;\n }\n }\n\n return String(error);\n}\n\n/**\n * Returns the thrown error name when one is available.\n */\nexport function normalizeThrownName(error: unknown): string | undefined {\n if (error instanceof Error) {\n return error.name;\n }\n\n if (typeof error === \"object\" && error !== null && \"name\" in error) {\n const name = (error as { name?: unknown }).name;\n if (typeof name === \"string\") {\n return name;\n }\n }\n\n return undefined;\n}\n\n/**\n * Builds the standard tool execution context passed to resolved tool wrappers.\n */\nexport function createExecutionContext(\n signal: AbortSignal,\n providerName: string,\n safeToolName: string,\n originalToolName: string,\n): ToolExecutionContext {\n return {\n originalToolName,\n providerName,\n safeToolName,\n signal,\n };\n}\n\n/**\n * Truncates captured logs to the configured line and character limits.\n */\nexport function truncateLogs(\n logs: string[],\n maxLogLines: number,\n maxLogChars: number,\n): string[] {\n const limitedLines = logs.slice(0, maxLogLines);\n let remainingChars = maxLogChars;\n const truncated: string[] = [];\n\n for (const line of limitedLines) {\n if (remainingChars <= 0) {\n break;\n }\n\n if (line.length <= remainingChars) {\n truncated.push(line);\n remainingChars -= line.length;\n continue;\n }\n\n truncated.push(line.slice(0, remainingChars));\n break;\n }\n\n return truncated;\n}\n\nfunction formatLogValue(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n\n if (value === undefined) {\n return \"undefined\";\n }\n\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/**\n * Formats guest console arguments into a single host-side log line.\n */\nexport function formatConsoleLine(values: unknown[]): string {\n return values.map((value) => formatLogValue(value)).join(\" \");\n}\n","import { parse } from \"acorn\";\nimport type { Node } from \"acorn\";\n\ntype PositionedNode = Node & {\n end: number;\n start: number;\n body?: PositionedNode[];\n expression?: PositionedNode;\n async?: boolean;\n id?: {\n name: string;\n };\n};\n\nfunction stripCodeFences(source: string): string {\n const match = source.match(/^\\s*```[^\\n]*\\n([\\s\\S]*?)\\n?```\\s*$/);\n return match ? match[1] : source;\n}\n\nfunction wrapAsync(body: string): string {\n if (body.trim().length === 0) {\n return \"async () => {}\";\n }\n\n return `async () => {\\n${body}\\n}`;\n}\n\n/**\n * Normalizes model-produced JavaScript into an executable async function body.\n */\nexport function normalizeCode(source: string): string {\n const normalizedSource = stripCodeFences(source).trim();\n\n if (normalizedSource.length === 0) {\n return \"async () => {}\";\n }\n\n try {\n const program = parse(normalizedSource, {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n }) as PositionedNode;\n\n if (program.body?.length === 1) {\n const [statement] = program.body;\n\n if (statement.type === \"FunctionDeclaration\" && statement.id?.name) {\n return wrapAsync(`${normalizedSource}\\nreturn ${statement.id.name}();`);\n }\n\n if (statement.type === \"ExpressionStatement\" && statement.expression) {\n if (\n statement.expression.type === \"ArrowFunctionExpression\" &&\n statement.expression.async\n ) {\n return normalizedSource;\n }\n\n return wrapAsync(`return (${normalizedSource});`);\n }\n }\n\n const body = program.body ?? [];\n const lastStatement = body.at(-1);\n\n if (\n lastStatement?.type === \"ExpressionStatement\" &&\n lastStatement.expression\n ) {\n const bodyPrefix = normalizedSource\n .slice(0, lastStatement.start)\n .trimEnd();\n const expressionSource = normalizedSource.slice(\n lastStatement.expression.start,\n lastStatement.expression.end,\n );\n\n const lines = [];\n\n if (bodyPrefix.length > 0) {\n lines.push(bodyPrefix);\n }\n\n lines.push(`return (${expressionSource});`);\n\n return wrapAsync(lines.join(\"\\n\"));\n }\n\n return wrapAsync(normalizedSource);\n } catch {\n return wrapAsync(normalizedSource);\n }\n}\n","import {\n createExecutionContext,\n getExecutionTimeoutMessage,\n normalizeThrownMessage,\n} from \"./executor/shared.ts\";\nimport {\n ExecuteFailure,\n isExecuteFailure,\n isJsonSerializable,\n} from \"./errors.ts\";\nimport type { ExecuteError, ResolvedToolProvider } from \"./types.ts\";\n\n/**\n * Transport-safe metadata for one exposed tool.\n */\nexport interface ProviderToolManifest {\n description?: string;\n originalName: string;\n safeName: string;\n}\n\n/**\n * Namespace manifest shared with runner implementations.\n */\nexport interface ProviderManifest {\n name: string;\n tools: Record<string, ProviderToolManifest>;\n types: string;\n}\n\n/**\n * Execution limits forwarded to runner implementations.\n */\nexport interface ExecutorRuntimeOptions {\n maxLogChars?: number;\n maxLogLines?: number;\n memoryLimitBytes?: number;\n timeoutMs?: number;\n}\n\n/**\n * Public execution options accepted by executors per call.\n */\nexport interface ExecutionOptions extends ExecutorRuntimeOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Tool invocation request emitted from a runner.\n */\nexport interface ToolCall {\n input: unknown;\n providerName: string;\n safeToolName: string;\n}\n\n/**\n * Trusted host response to a tool invocation request.\n */\nexport type ToolCallResult =\n | {\n ok: true;\n result: unknown;\n }\n | {\n error: ExecuteError;\n ok: false;\n };\n\nfunction toTrustedExecuteError(error: unknown): ExecuteError {\n if (isExecuteFailure(error)) {\n return {\n code: error.code,\n message: error.message,\n };\n }\n\n return {\n code: \"tool_error\",\n message: normalizeThrownMessage(error),\n };\n}\n\n/**\n * Converts resolved providers into manifest metadata that reveals only namespace details.\n */\nexport function extractProviderManifests(\n providers: ResolvedToolProvider[],\n): ProviderManifest[] {\n return providers.map((provider) => ({\n name: provider.name,\n tools: Object.fromEntries(\n Object.entries(provider.tools).map(([safeToolName, descriptor]) => [\n safeToolName,\n {\n description: descriptor.description,\n originalName: descriptor.originalName,\n safeName: descriptor.safeName,\n },\n ]),\n ),\n types: provider.types,\n }));\n}\n\n/**\n * Creates a host-side dispatcher for runner-emitted tool calls.\n */\nexport function createToolCallDispatcher(\n providers: ResolvedToolProvider[],\n signal: AbortSignal,\n): (call: ToolCall) => Promise<ToolCallResult> {\n const providerMap = new Map(\n providers.map((provider) => [provider.name, provider] as const),\n );\n\n return async (call) => {\n const provider = providerMap.get(call.providerName);\n const descriptor = provider?.tools[call.safeToolName];\n\n if (!provider || !descriptor) {\n return {\n error: {\n code: \"internal_error\",\n message: `Unknown tool ${call.providerName}.${call.safeToolName}`,\n },\n ok: false,\n };\n }\n\n try {\n if (signal.aborted) {\n return {\n error: {\n code: \"timeout\",\n message: getExecutionTimeoutMessage(),\n },\n ok: false,\n };\n }\n\n const result = await descriptor.execute(\n call.input,\n createExecutionContext(\n signal,\n provider.name,\n descriptor.safeName,\n descriptor.originalName,\n ),\n );\n\n if (result !== undefined && !isJsonSerializable(result)) {\n throw new ExecuteFailure(\n \"serialization_error\",\n \"Host value is not JSON-serializable\",\n );\n }\n\n return {\n ok: true,\n result,\n };\n } catch (error) {\n return {\n error: toTrustedExecuteError(error),\n ok: false,\n };\n }\n };\n}\n"],"mappings":";;;;AAOA,MAAM,4BAA4B;;;;AAKlC,MAAM,4BAA4B,IAAI,IAAsB;CAC1D;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,SAAgB,wBACd,OAC2B;AAC3B,QAAO,0BAA0B,IAAI,MAA0B;;;;;AAMjE,SAAgB,6BAAqC;AACnD,QAAO;;;;;AAMT,SAAgB,2BAA2B,aAAa,GAAkB;AACxE,QAAO;EACL;EACA,OAAO;GACL,MAAM;GACN,SAAS,4BAA4B;GACtC;EACD,MAAM,EAAE;EACR,IAAI;EACL;;;;;AAMH,SAAgB,uBAAuB,OAAwB;AAC7D,KAAI,iBAAiB,MACnB,QAAO,MAAM;AAGf,KAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa,OAAO;EACrE,MAAM,UAAW,MAAgC;AACjD,MAAI,OAAO,YAAY,SACrB,QAAO;;AAIX,QAAO,OAAO,MAAM;;;;;AAMtB,SAAgB,oBAAoB,OAAoC;AACtE,KAAI,iBAAiB,MACnB,QAAO,MAAM;AAGf,KAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,OAAO;EAClE,MAAM,OAAQ,MAA6B;AAC3C,MAAI,OAAO,SAAS,SAClB,QAAO;;;;;;AAUb,SAAgB,uBACd,QACA,cACA,cACA,kBACsB;AACtB,QAAO;EACL;EACA;EACA;EACA;EACD;;;;;AAMH,SAAgB,aACd,MACA,aACA,aACU;CACV,MAAM,eAAe,KAAK,MAAM,GAAG,YAAY;CAC/C,IAAI,iBAAiB;CACrB,M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,IAAI;GACL;AAGH,MAAI;AACF,OAAI,OAAO,QACT,QAAO;IACL,OAAO;KACL,MAAM;KACN,SAAS,4BAA4B;KACtC;IACD,IAAI;IACL;GAGH,MAAM,SAAS,MAAM,WAAW,QAC9B,KAAK,OACL,uBACE,QACA,SAAS,MACT,WAAW,UACX,WAAW,aACZ,CACF;AAED,OAAI,WAAW,UAAa,CAACC,2CAAmB,OAAO,CACrD,OAAM,IAAIC,uCACR,uBACA,sCACD;AAGH,UAAO;IACL,IAAI;IACJ;IACD;WACM,OAAO;AACd,UAAO;IACL,OAAO,sBAAsB,MAAM;IACnC,IAAI;IACL"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { _ as ToolExecutionContext, a as ProviderToolManifest, b as TypegenToolDescriptor, c as createToolCallDispatcher, d as ExecuteErrorCode, f as ExecuteResult, g as ToolDescriptor, h as ResolvedToolProvider, i as ProviderManifest, l as extractProviderManifests, m as ResolvedToolDescriptor, n as ExecutionOptions, o as ToolCall, p as JsonSchema, r as ExecutorRuntimeOptions, s as ToolCallResult, t as Executor, u as ExecuteError, v as ToolProvider, y as ToolSchema } from "./executor-DcnjQGwA.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/executor/shared.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns whether the value is one of execbox's stable execution error codes.
|
|
7
|
+
*/
|
|
8
|
+
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the stable timeout message used across executor implementations.
|
|
11
|
+
*/
|
|
12
|
+
declare function getExecutionTimeoutMessage(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
15
|
+
*/
|
|
16
|
+
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes an unknown thrown value into a human-readable message.
|
|
19
|
+
*/
|
|
20
|
+
declare function normalizeThrownMessage(error: unknown): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the thrown error name when one is available.
|
|
23
|
+
*/
|
|
24
|
+
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
27
|
+
*/
|
|
28
|
+
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
29
|
+
/**
|
|
30
|
+
* Truncates captured logs to the configured line and character limits.
|
|
31
|
+
*/
|
|
32
|
+
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Formats guest console arguments into a single host-side log line.
|
|
35
|
+
*/
|
|
36
|
+
declare function formatConsoleLine(values: unknown[]): string;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/identifier.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* Returns whether the value is a valid JavaScript identifier.
|
|
41
|
+
*/
|
|
42
|
+
declare function isValidIdentifier(value: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether the identifier is reserved in JavaScript source.
|
|
45
|
+
*/
|
|
46
|
+
declare function isReservedWord(value: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Throws when the value cannot be used as a bare JavaScript identifier.
|
|
49
|
+
*/
|
|
50
|
+
declare function assertValidIdentifier(value: string, label?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Converts a raw identifier-like value into a safe JavaScript identifier.
|
|
53
|
+
*/
|
|
54
|
+
declare function sanitizeIdentifier(value: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Renders the name as a bare identifier when possible, otherwise as a string literal.
|
|
57
|
+
*/
|
|
58
|
+
declare function serializePropertyName(name: string): string;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/normalize.d.ts
|
|
61
|
+
/**
|
|
62
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
63
|
+
*/
|
|
64
|
+
declare function normalizeCode(source: string): string;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/sanitize.d.ts
|
|
67
|
+
/**
|
|
68
|
+
* Converts a raw tool name into a safe JavaScript identifier.
|
|
69
|
+
*/
|
|
70
|
+
declare function sanitizeToolName(name: string): string;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/errors.d.ts
|
|
73
|
+
/**
|
|
74
|
+
* Structured failure used internally to propagate executor and tool errors.
|
|
75
|
+
*/
|
|
76
|
+
declare class ExecuteFailure extends Error {
|
|
77
|
+
code: ExecuteErrorCode;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a structured failure with a trusted executor or tool error code.
|
|
80
|
+
*/
|
|
81
|
+
constructor(code: ExecuteErrorCode, message: string);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
85
|
+
*/
|
|
86
|
+
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
87
|
+
/**
|
|
88
|
+
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
89
|
+
*/
|
|
90
|
+
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/provider/resolveProvider.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
|
95
|
+
*/
|
|
96
|
+
declare function resolveProvider(provider: ToolProvider): ResolvedToolProvider;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/typegen/jsonSchema.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Generates a namespace declaration for a provider's tool schemas.
|
|
101
|
+
*/
|
|
102
|
+
declare function generateTypesFromJsonSchema(providerName: string, tools: Record<string, TypegenToolDescriptor>): string;
|
|
103
|
+
//#endregion
|
|
104
|
+
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, assertValidIdentifier, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, generateTypesFromJsonSchema, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, isReservedWord, isValidIdentifier, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveProvider, sanitizeIdentifier, sanitizeToolName, serializePropertyName, truncateLogs };
|
|
105
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/executor/shared.ts","../src/identifier.ts","../src/normalize.ts","../src/sanitize.ts","../src/errors.ts","../src/provider/resolveProvider.ts","../src/typegen/jsonSchema.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;AASgB,iBATA,uBAAA,CAS0B,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAP9B,gBAO8B;AAO1C;AAeA;AAkBA;AAkBgB,iBA1DA,0BAAA,CAAA,CA2DN,EAIP,MAAA;AAYH;AA8CA;;iBAlHgB,0BAAA,uBAA4C;;ACG5D;AAOA;AAOgB,iBDFA,sBAAA,CCEqB,KAAA,EAAA,OAAA,CAAA,EAAA,MAAA;AAYrC;AAsBA;;iBDlBgB,mBAAA;;AE5ChB;;iBF8DgB,sBAAA,SACN,oFAIP;;AG5FH;;iBHwGgB,YAAA;;AIxGhB;;AAMoB,iBJgJJ,iBAAA,CIhJI,MAAA,EAAA,OAAA,EAAA,CAAA,EAAA,MAAA;;;;;;AJcJ,iBCmBA,iBAAA,CDjBJ,KAAA,EAAA,MAAA,CAAA,EAAA,OAAgB;AAO5B;AAOA;AAeA;AAkBgB,iBCvBA,cAAA,CDuBmB,KAAA,EAAA,MAAA,CAAA,EAAA,OAAA;AAkBnC;AAiBA;AA8CA;iBCjGgB,qBAAA;;;AAdhB;AAOgB,iBAmBA,kBAAA,CAnBc,KAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAO9B;AAYA;AAsBA;iBAAgB,qBAAA;;;;;;ADnEA,iBEKA,aAAA,CFLuB,MAE3B,EAAA,MAAA,CAAA,EAAA,MAAgB;;;;;;AAFZ,iBGpBA,gBAAA,CHoBuB,IAE3B,EAAA,MAAA,CAAA,EAAA,MAAgB;;;;;AAF5B;AASgB,cI7BH,cAAA,SAAuB,KAAA,CJ6BM;EAO1B,IAAA,EInCR,gBJmCQ;EAeA;AAkBhB;AAkBA;EAiBgB,WAAA,CAAA,IAAY,EIlGR,gBJkGQ,EAAA,OAAA,EAAA,MAAA;AA8C5B;;;;AC/GgB,iBGvBA,gBAAA,CHuBiB,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IGvB0B,cHuB1B;AAOjC;AAOA;AAYA;AAsBgB,iBGhEA,kBAAA,CHgEqB,KAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EG9D7B,GH8D6B,CAAA,MAAA,CAAA,EAAA,IAAA,CAAA,EG7D/B,OH6D+B,CAAA,MAAA,CAAA,CAAA,EAAA,OAAA;;;;;ADnErC;AASgB,iBKUA,eAAA,CLV0B,QAAA,EKUA,YLVA,CAAA,EKUe,oBLVf;;;AAsB1C;AAkBA;AAkBA;AAiBgB,iBMLA,2BAAA,CNKY,YAAA,EAAA,MAAA,EAAA,KAAA,EMHnB,MNGmB,CAAA,MAAA,EMHJ,qBNGI,CAAA,CAAA,EAAA,MAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { _ as ToolExecutionContext, a as ProviderToolManifest, b as TypegenToolDescriptor, c as createToolCallDispatcher, d as ExecuteErrorCode, f as ExecuteResult, g as ToolDescriptor, h as ResolvedToolProvider, i as ProviderManifest, l as extractProviderManifests, m as ResolvedToolDescriptor, n as ExecutionOptions, o as ToolCall, p as JsonSchema, r as ExecutorRuntimeOptions, s as ToolCallResult, t as Executor, u as ExecuteError, v as ToolProvider, y as ToolSchema } from "./executor-C0lf5vWT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/executor/shared.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns whether the value is one of execbox's stable execution error codes.
|
|
7
|
+
*/
|
|
8
|
+
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the stable timeout message used across executor implementations.
|
|
11
|
+
*/
|
|
12
|
+
declare function getExecutionTimeoutMessage(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
15
|
+
*/
|
|
16
|
+
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes an unknown thrown value into a human-readable message.
|
|
19
|
+
*/
|
|
20
|
+
declare function normalizeThrownMessage(error: unknown): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the thrown error name when one is available.
|
|
23
|
+
*/
|
|
24
|
+
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
27
|
+
*/
|
|
28
|
+
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
29
|
+
/**
|
|
30
|
+
* Truncates captured logs to the configured line and character limits.
|
|
31
|
+
*/
|
|
32
|
+
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Formats guest console arguments into a single host-side log line.
|
|
35
|
+
*/
|
|
36
|
+
declare function formatConsoleLine(values: unknown[]): string;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/identifier.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* Returns whether the value is a valid JavaScript identifier.
|
|
41
|
+
*/
|
|
42
|
+
declare function isValidIdentifier(value: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether the identifier is reserved in JavaScript source.
|
|
45
|
+
*/
|
|
46
|
+
declare function isReservedWord(value: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Throws when the value cannot be used as a bare JavaScript identifier.
|
|
49
|
+
*/
|
|
50
|
+
declare function assertValidIdentifier(value: string, label?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Converts a raw identifier-like value into a safe JavaScript identifier.
|
|
53
|
+
*/
|
|
54
|
+
declare function sanitizeIdentifier(value: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Renders the name as a bare identifier when possible, otherwise as a string literal.
|
|
57
|
+
*/
|
|
58
|
+
declare function serializePropertyName(name: string): string;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/normalize.d.ts
|
|
61
|
+
/**
|
|
62
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
63
|
+
*/
|
|
64
|
+
declare function normalizeCode(source: string): string;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/sanitize.d.ts
|
|
67
|
+
/**
|
|
68
|
+
* Converts a raw tool name into a safe JavaScript identifier.
|
|
69
|
+
*/
|
|
70
|
+
declare function sanitizeToolName(name: string): string;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/errors.d.ts
|
|
73
|
+
/**
|
|
74
|
+
* Structured failure used internally to propagate executor and tool errors.
|
|
75
|
+
*/
|
|
76
|
+
declare class ExecuteFailure extends Error {
|
|
77
|
+
code: ExecuteErrorCode;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a structured failure with a trusted executor or tool error code.
|
|
80
|
+
*/
|
|
81
|
+
constructor(code: ExecuteErrorCode, message: string);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
85
|
+
*/
|
|
86
|
+
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
87
|
+
/**
|
|
88
|
+
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
89
|
+
*/
|
|
90
|
+
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/provider/resolveProvider.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
|
95
|
+
*/
|
|
96
|
+
declare function resolveProvider(provider: ToolProvider): ResolvedToolProvider;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/typegen/jsonSchema.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Generates a namespace declaration for a provider's tool schemas.
|
|
101
|
+
*/
|
|
102
|
+
declare function generateTypesFromJsonSchema(providerName: string, tools: Record<string, TypegenToolDescriptor>): string;
|
|
103
|
+
//#endregion
|
|
104
|
+
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, assertValidIdentifier, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, generateTypesFromJsonSchema, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, isReservedWord, isValidIdentifier, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveProvider, sanitizeIdentifier, sanitizeToolName, serializePropertyName, truncateLogs };
|
|
105
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/executor/shared.ts","../src/identifier.ts","../src/normalize.ts","../src/sanitize.ts","../src/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