@execbox/core 0.3.1 → 0.4.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 +52 -85
- package/dist/_internal/index.cjs +45 -0
- package/dist/_internal/index.cjs.map +1 -0
- package/dist/_internal/index.d.cts +21 -0
- package/dist/_internal/index.d.cts.map +1 -0
- package/dist/_internal/index.d.ts +22 -0
- package/dist/_internal/index.d.ts.map +1 -0
- package/dist/_internal/index.js +30 -0
- package/dist/_internal/index.js.map +1 -0
- package/dist/errors-B3IY3ID-.d.cts +69 -0
- package/dist/errors-B3IY3ID-.d.cts.map +1 -0
- package/dist/errors-BGSgVV40.cjs +79 -0
- package/dist/errors-BGSgVV40.cjs.map +1 -0
- package/dist/errors-BXpyBhCI.js +61 -0
- package/dist/errors-BXpyBhCI.js.map +1 -0
- package/dist/errors-BbUru7ko.d.ts +69 -0
- package/dist/errors-BbUru7ko.d.ts.map +1 -0
- package/dist/executor-CEXp0gYP.d.cts +29 -0
- package/dist/executor-CEXp0gYP.d.cts.map +1 -0
- package/dist/executor-_CO7E1U7.d.ts +29 -0
- package/dist/executor-_CO7E1U7.d.ts.map +1 -0
- package/dist/index.cjs +18 -233
- package/dist/index.d.cts +3 -62
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -62
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -220
- package/dist/mcp/index.cjs +2 -1
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.cts +2 -2
- package/dist/mcp/index.d.cts.map +1 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/normalize-B80ZCnxe.cjs +54 -0
- package/dist/normalize-B80ZCnxe.cjs.map +1 -0
- package/dist/normalize-dfQC7HWx.js +48 -0
- package/dist/normalize-dfQC7HWx.js.map +1 -0
- package/dist/protocol/index.cjs +345 -0
- package/dist/protocol/index.cjs.map +1 -0
- package/dist/protocol/index.d.cts +169 -0
- package/dist/protocol/index.d.cts.map +1 -0
- package/dist/protocol/index.d.ts +169 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +341 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/{resolveProvider-Cqe2G7Dc.js → resolveProvider-BHuwOGBm.js} +3 -61
- package/dist/resolveProvider-BHuwOGBm.js.map +1 -0
- package/dist/{resolveProvider-Dt30Su4V.cjs → resolveProvider-DfcSnwnp.cjs} +7 -83
- package/dist/resolveProvider-DfcSnwnp.cjs.map +1 -0
- package/dist/runner-BxbJ5eWb.cjs +235 -0
- package/dist/runner-BxbJ5eWb.cjs.map +1 -0
- package/dist/{executor-DgNzFGsH.d.ts → runner-DSgvu6Ad.d.cts} +2 -22
- package/dist/runner-DSgvu6Ad.d.cts.map +1 -0
- package/dist/{executor-B_GaIEgz.d.cts → runner-FSGSGEpx.d.ts} +2 -22
- package/dist/runner-FSGSGEpx.d.ts.map +1 -0
- package/dist/runner-nUCF59Au.js +176 -0
- package/dist/runner-nUCF59Au.js.map +1 -0
- package/package.json +21 -1
- package/dist/executor-B_GaIEgz.d.cts.map +0 -1
- package/dist/executor-DgNzFGsH.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/resolveProvider-Cqe2G7Dc.js.map +0 -1
- package/dist/resolveProvider-Dt30Su4V.cjs.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
+
*/
|
|
5
|
+
import { d as ExecuteResult, m as ResolvedToolProvider, t as ExecutionOptions } from "./runner-DSgvu6Ad.cjs";
|
|
6
|
+
|
|
7
|
+
//#region src/executor/executor.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optional pooling controls for executor implementations that can reuse
|
|
11
|
+
* host-side shells while still creating a fresh guest runtime per execution.
|
|
12
|
+
*/
|
|
13
|
+
interface ExecutorPoolOptions {
|
|
14
|
+
idleTimeoutMs?: number;
|
|
15
|
+
maxSize: number;
|
|
16
|
+
minSize?: number;
|
|
17
|
+
prewarm?: boolean | number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Executes JavaScript against one or more resolved tool providers.
|
|
21
|
+
*/
|
|
22
|
+
interface Executor {
|
|
23
|
+
execute(code: string, providers: ResolvedToolProvider[], options?: ExecutionOptions): Promise<ExecuteResult>;
|
|
24
|
+
dispose?(): Promise<void> | void;
|
|
25
|
+
prewarm?(count?: number): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ExecutorPoolOptions as n, Executor as t };
|
|
29
|
+
//# sourceMappingURL=executor-CEXp0gYP.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-CEXp0gYP.d.cts","names":[],"sources":["../src/executor/executor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAOA,CAAA,CAAA,CAAA,QAAA,CAAA,OAAA,CAAA,QAAA,CAAA,GAAA,CAAA,QAAA,CAAA,eAAA,CAAA,IAAA,CAAA,GAAA,CAAA;AAUA,CAAA,CAAA,CAAA,IAAA,CAAA,IAAA,CAAA,MAAA,CAAA,KAAA,CAAA,KAAA,CAAA,QAAA,CAAA,CAAA,CAAA,KAAA,CAAA,KAAA,CAAA,OAAA,CAAA,GAAA,CAAA,SAAA;;AAIc,SAAA,CAdG,mBAAA,CAcH;EACD,aAAA,CAAA,CAAA,CAAA,MAAA;EAAR,OAAA,CAAA,CAAA,MAAA;EACS,OAAA,CAAA,CAAA,CAAA,MAAA;EACc,OAAA,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,MAAA;;;;;UAPX,QAAA;mCAGF,kCACD,mBACT,QAAQ;cACC;4BACc"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
+
*/
|
|
5
|
+
import { d as ExecuteResult, m as ResolvedToolProvider, t as ExecutionOptions } from "./runner-FSGSGEpx.js";
|
|
6
|
+
|
|
7
|
+
//#region src/executor/executor.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optional pooling controls for executor implementations that can reuse
|
|
11
|
+
* host-side shells while still creating a fresh guest runtime per execution.
|
|
12
|
+
*/
|
|
13
|
+
interface ExecutorPoolOptions {
|
|
14
|
+
idleTimeoutMs?: number;
|
|
15
|
+
maxSize: number;
|
|
16
|
+
minSize?: number;
|
|
17
|
+
prewarm?: boolean | number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Executes JavaScript against one or more resolved tool providers.
|
|
21
|
+
*/
|
|
22
|
+
interface Executor {
|
|
23
|
+
execute(code: string, providers: ResolvedToolProvider[], options?: ExecutionOptions): Promise<ExecuteResult>;
|
|
24
|
+
dispose?(): Promise<void> | void;
|
|
25
|
+
prewarm?(count?: number): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ExecutorPoolOptions as n, Executor as t };
|
|
29
|
+
//# sourceMappingURL=executor-_CO7E1U7.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-_CO7E1U7.d.ts","names":[],"sources":["../src/executor/executor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAOA,CAAA,CAAA,CAAA,QAAA,CAAA,OAAA,CAAA,QAAA,CAAA,GAAA,CAAA,QAAA,CAAA,eAAA,CAAA,IAAA,CAAA,GAAA,CAAA;AAUA,CAAA,CAAA,CAAA,IAAA,CAAA,IAAA,CAAA,MAAA,CAAA,KAAA,CAAA,KAAA,CAAA,QAAA,CAAA,CAAA,CAAA,KAAA,CAAA,KAAA,CAAA,OAAA,CAAA,GAAA,CAAA,SAAA;;AAIc,SAAA,CAdG,mBAAA,CAcH;EACD,aAAA,CAAA,CAAA,CAAA,MAAA;EAAR,OAAA,CAAA,CAAA,MAAA;EACS,OAAA,CAAA,CAAA,CAAA,MAAA;EACc,OAAA,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,MAAA;;;;;UAPX,QAAA;mCAGF,kCACD,mBACT,QAAQ;cACC;4BACc"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,242 +1,27 @@
|
|
|
1
|
-
const require_resolveProvider = require('./resolveProvider-
|
|
2
|
-
|
|
1
|
+
const require_resolveProvider = require('./resolveProvider-DfcSnwnp.cjs');
|
|
2
|
+
const require_runner = require('./runner-BxbJ5eWb.cjs');
|
|
3
|
+
const require_normalize = require('./normalize-B80ZCnxe.cjs');
|
|
4
|
+
const require_errors = require('./errors-BGSgVV40.cjs');
|
|
3
5
|
|
|
4
|
-
|
|
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;
|
|
6
|
+
exports.ExecuteFailure = require_errors.ExecuteFailure;
|
|
221
7
|
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;
|
|
8
|
+
exports.createExecutionContext = require_runner.createExecutionContext;
|
|
9
|
+
exports.createTimeoutExecuteResult = require_runner.createTimeoutExecuteResult;
|
|
10
|
+
exports.createToolCallDispatcher = require_runner.createToolCallDispatcher;
|
|
11
|
+
exports.extractProviderManifests = require_runner.extractProviderManifests;
|
|
12
|
+
exports.formatConsoleLine = require_runner.formatConsoleLine;
|
|
227
13
|
exports.generateTypesFromJsonSchema = require_resolveProvider.generateTypesFromJsonSchema;
|
|
228
|
-
exports.getExecutionTimeoutMessage = getExecutionTimeoutMessage;
|
|
229
|
-
exports.isExecuteFailure =
|
|
230
|
-
exports.isJsonSerializable =
|
|
231
|
-
exports.isKnownExecuteErrorCode = isKnownExecuteErrorCode;
|
|
14
|
+
exports.getExecutionTimeoutMessage = require_runner.getExecutionTimeoutMessage;
|
|
15
|
+
exports.isExecuteFailure = require_errors.isExecuteFailure;
|
|
16
|
+
exports.isJsonSerializable = require_errors.isJsonSerializable;
|
|
17
|
+
exports.isKnownExecuteErrorCode = require_runner.isKnownExecuteErrorCode;
|
|
232
18
|
exports.isReservedWord = require_resolveProvider.isReservedWord;
|
|
233
19
|
exports.isValidIdentifier = require_resolveProvider.isValidIdentifier;
|
|
234
|
-
exports.normalizeCode = normalizeCode;
|
|
235
|
-
exports.normalizeThrownMessage = normalizeThrownMessage;
|
|
236
|
-
exports.normalizeThrownName = normalizeThrownName;
|
|
20
|
+
exports.normalizeCode = require_normalize.normalizeCode;
|
|
21
|
+
exports.normalizeThrownMessage = require_runner.normalizeThrownMessage;
|
|
22
|
+
exports.normalizeThrownName = require_runner.normalizeThrownName;
|
|
237
23
|
exports.resolveProvider = require_resolveProvider.resolveProvider;
|
|
238
24
|
exports.sanitizeIdentifier = require_resolveProvider.sanitizeIdentifier;
|
|
239
25
|
exports.sanitizeToolName = require_resolveProvider.sanitizeToolName;
|
|
240
26
|
exports.serializePropertyName = require_resolveProvider.serializePropertyName;
|
|
241
|
-
exports.truncateLogs = truncateLogs;
|
|
242
|
-
//# sourceMappingURL=index.cjs.map
|
|
27
|
+
exports.truncateLogs = require_runner.truncateLogs;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,43 +2,10 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { _ as
|
|
5
|
+
import { _ as ToolProvider, a as ToolCall, c as extractProviderManifests, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, h as ToolDescriptor, i as ProviderToolManifest, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, o as ToolCallResult, p as ResolvedToolDescriptor, r as ProviderManifest, s as createToolCallDispatcher, t as ExecutionOptions, u as ExecuteErrorCode, v as ToolSchema, y as TypegenToolDescriptor } from "./runner-DSgvu6Ad.cjs";
|
|
6
|
+
import { a as createExecutionContext, c as getExecutionTimeoutMessage, d as normalizeThrownName, f as truncateLogs, i as normalizeCode, l as isKnownExecuteErrorCode, n as isExecuteFailure, o as createTimeoutExecuteResult, r as isJsonSerializable, s as formatConsoleLine, t as ExecuteFailure, u as normalizeThrownMessage } from "./errors-B3IY3ID-.cjs";
|
|
7
|
+
import { n as ExecutorPoolOptions, t as Executor } from "./executor-CEXp0gYP.cjs";
|
|
6
8
|
|
|
7
|
-
//#region src/executor/shared.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Returns whether the value is one of execbox's stable execution error codes.
|
|
11
|
-
*/
|
|
12
|
-
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the stable timeout message used across executor implementations.
|
|
15
|
-
*/
|
|
16
|
-
declare function getExecutionTimeoutMessage(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
19
|
-
*/
|
|
20
|
-
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
21
|
-
/**
|
|
22
|
-
* Normalizes an unknown thrown value into a human-readable message.
|
|
23
|
-
*/
|
|
24
|
-
declare function normalizeThrownMessage(error: unknown): string;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the thrown error name when one is available.
|
|
27
|
-
*/
|
|
28
|
-
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
31
|
-
*/
|
|
32
|
-
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
33
|
-
/**
|
|
34
|
-
* Truncates captured logs to the configured line and character limits.
|
|
35
|
-
*/
|
|
36
|
-
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
37
|
-
/**
|
|
38
|
-
* Formats guest console arguments into a single host-side log line.
|
|
39
|
-
*/
|
|
40
|
-
declare function formatConsoleLine(values: unknown[]): string;
|
|
41
|
-
//#endregion
|
|
42
9
|
//#region src/identifier.d.ts
|
|
43
10
|
/**
|
|
44
11
|
* Returns whether the value is a valid JavaScript identifier.
|
|
@@ -61,38 +28,12 @@ declare function sanitizeIdentifier(value: string): string;
|
|
|
61
28
|
*/
|
|
62
29
|
declare function serializePropertyName(name: string): string;
|
|
63
30
|
//#endregion
|
|
64
|
-
//#region src/normalize.d.ts
|
|
65
|
-
/**
|
|
66
|
-
* Normalizes model-produced JavaScript into an executable async function body.
|
|
67
|
-
*/
|
|
68
|
-
declare function normalizeCode(source: string): string;
|
|
69
|
-
//#endregion
|
|
70
31
|
//#region src/sanitize.d.ts
|
|
71
32
|
/**
|
|
72
33
|
* Converts a raw tool name into a safe JavaScript identifier.
|
|
73
34
|
*/
|
|
74
35
|
declare function sanitizeToolName(name: string): string;
|
|
75
36
|
//#endregion
|
|
76
|
-
//#region src/errors.d.ts
|
|
77
|
-
/**
|
|
78
|
-
* Structured failure used internally to propagate executor and tool errors.
|
|
79
|
-
*/
|
|
80
|
-
declare class ExecuteFailure extends Error {
|
|
81
|
-
code: ExecuteErrorCode;
|
|
82
|
-
/**
|
|
83
|
-
* Creates a structured failure with a trusted executor or tool error code.
|
|
84
|
-
*/
|
|
85
|
-
constructor(code: ExecuteErrorCode, message: string);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
89
|
-
*/
|
|
90
|
-
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
91
|
-
/**
|
|
92
|
-
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
93
|
-
*/
|
|
94
|
-
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
95
|
-
//#endregion
|
|
96
37
|
//#region src/provider/resolveProvider.d.ts
|
|
97
38
|
/**
|
|
98
39
|
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/identifier.ts","../src/sanitize.ts","../src/provider/resolveProvider.ts","../src/typegen/jsonSchema.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBA6DgB,iBAAA;;AAAhB,CAAA,CAAA,CAAA,OAAA,CAAA,OAAA,CAAA,GAAA,CAAA,UAAA,CAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA;AAOA,CAAA,CAAA;AAOgB,OAAA,CAAA,QAAA,CAPA,cAAA,CAOqB,KAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,OAAA;AAYrC,CAAA,CAAA;AAqBA,CAAA,CAAA,CAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CAAA,KAAA,CAAA,MAAA,CAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,UAAA;;iBAjCgB,qBAAA;;ACtEhB,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,GAAA,CAAA,UAAA,CAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,UAAA;;iBDkFgB,kBAAA;;AE3ChB,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,IAAA,CAAA,QAAA,CAAA,CAAA,SAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,OAAA;;iBFgEgB,qBAAA;;;;;;iBCvGA,gBAAA;;;;;;iBCuCA,eAAA,WAA0B,eAAe;;;AFwBzD,CAAA,CAAA;AAOA,CAAA,CAAA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA;AAYA,CAAA,CAAA;AAqBgB,OAAA,CAAA,QAAA,CGJA,2BAAA,CHIqB,YAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CGF5B,MHE4B,CAAA,MAAA,CAAA,CGFb,qBHEa,CAAA,CAAA,CAAA,CAAA,MAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,43 +2,10 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { _ as
|
|
5
|
+
import { _ as ToolProvider, a as ToolCall, c as extractProviderManifests, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, h as ToolDescriptor, i as ProviderToolManifest, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, o as ToolCallResult, p as ResolvedToolDescriptor, r as ProviderManifest, s as createToolCallDispatcher, t as ExecutionOptions, u as ExecuteErrorCode, v as ToolSchema, y as TypegenToolDescriptor } from "./runner-FSGSGEpx.js";
|
|
6
|
+
import { a as createExecutionContext, c as getExecutionTimeoutMessage, d as normalizeThrownName, f as truncateLogs, i as normalizeCode, l as isKnownExecuteErrorCode, n as isExecuteFailure, o as createTimeoutExecuteResult, r as isJsonSerializable, s as formatConsoleLine, t as ExecuteFailure, u as normalizeThrownMessage } from "./errors-BbUru7ko.js";
|
|
7
|
+
import { n as ExecutorPoolOptions, t as Executor } from "./executor-_CO7E1U7.js";
|
|
6
8
|
|
|
7
|
-
//#region src/executor/shared.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Returns whether the value is one of execbox's stable execution error codes.
|
|
11
|
-
*/
|
|
12
|
-
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the stable timeout message used across executor implementations.
|
|
15
|
-
*/
|
|
16
|
-
declare function getExecutionTimeoutMessage(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
19
|
-
*/
|
|
20
|
-
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
21
|
-
/**
|
|
22
|
-
* Normalizes an unknown thrown value into a human-readable message.
|
|
23
|
-
*/
|
|
24
|
-
declare function normalizeThrownMessage(error: unknown): string;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the thrown error name when one is available.
|
|
27
|
-
*/
|
|
28
|
-
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
31
|
-
*/
|
|
32
|
-
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
33
|
-
/**
|
|
34
|
-
* Truncates captured logs to the configured line and character limits.
|
|
35
|
-
*/
|
|
36
|
-
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
37
|
-
/**
|
|
38
|
-
* Formats guest console arguments into a single host-side log line.
|
|
39
|
-
*/
|
|
40
|
-
declare function formatConsoleLine(values: unknown[]): string;
|
|
41
|
-
//#endregion
|
|
42
9
|
//#region src/identifier.d.ts
|
|
43
10
|
/**
|
|
44
11
|
* Returns whether the value is a valid JavaScript identifier.
|
|
@@ -61,38 +28,12 @@ declare function sanitizeIdentifier(value: string): string;
|
|
|
61
28
|
*/
|
|
62
29
|
declare function serializePropertyName(name: string): string;
|
|
63
30
|
//#endregion
|
|
64
|
-
//#region src/normalize.d.ts
|
|
65
|
-
/**
|
|
66
|
-
* Normalizes model-produced JavaScript into an executable async function body.
|
|
67
|
-
*/
|
|
68
|
-
declare function normalizeCode(source: string): string;
|
|
69
|
-
//#endregion
|
|
70
31
|
//#region src/sanitize.d.ts
|
|
71
32
|
/**
|
|
72
33
|
* Converts a raw tool name into a safe JavaScript identifier.
|
|
73
34
|
*/
|
|
74
35
|
declare function sanitizeToolName(name: string): string;
|
|
75
36
|
//#endregion
|
|
76
|
-
//#region src/errors.d.ts
|
|
77
|
-
/**
|
|
78
|
-
* Structured failure used internally to propagate executor and tool errors.
|
|
79
|
-
*/
|
|
80
|
-
declare class ExecuteFailure extends Error {
|
|
81
|
-
code: ExecuteErrorCode;
|
|
82
|
-
/**
|
|
83
|
-
* Creates a structured failure with a trusted executor or tool error code.
|
|
84
|
-
*/
|
|
85
|
-
constructor(code: ExecuteErrorCode, message: string);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
89
|
-
*/
|
|
90
|
-
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
91
|
-
/**
|
|
92
|
-
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
93
|
-
*/
|
|
94
|
-
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
95
|
-
//#endregion
|
|
96
37
|
//#region src/provider/resolveProvider.d.ts
|
|
97
38
|
/**
|
|
98
39
|
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/identifier.ts","../src/sanitize.ts","../src/provider/resolveProvider.ts","../src/typegen/jsonSchema.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBA6DgB,iBAAA;;AAAhB,CAAA,CAAA,CAAA,OAAA,CAAA,OAAA,CAAA,GAAA,CAAA,UAAA,CAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA;AAOA,CAAA,CAAA;AAOgB,OAAA,CAAA,QAAA,CAPA,cAAA,CAOqB,KAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,OAAA;AAYrC,CAAA,CAAA;AAqBA,CAAA,CAAA,CAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CAAA,KAAA,CAAA,MAAA,CAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,UAAA;;iBAjCgB,qBAAA;;ACtEhB,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,GAAA,CAAA,UAAA,CAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,UAAA;;iBDkFgB,kBAAA;;AE3ChB,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,IAAA,CAAA,QAAA,CAAA,CAAA,SAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,OAAA;;iBFgEgB,qBAAA;;;;;;iBCvGA,gBAAA;;;;;;iBCuCA,eAAA,WAA0B,eAAe;;;AFwBzD,CAAA,CAAA;AAOA,CAAA,CAAA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA;AAYA,CAAA,CAAA;AAqBgB,OAAA,CAAA,QAAA,CGJA,2BAAA,CHIqB,YAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CGF5B,MHE4B,CAAA,MAAA,CAAA,CGFb,qBHEa,CAAA,CAAA,CAAA,CAAA,MAAA"}
|