@execbox/core 0.4.1 → 0.6.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/README.md +10 -7
- package/dist/errors-B9ADBuDH.d.cts +29 -0
- package/dist/errors-B9ADBuDH.d.cts.map +1 -0
- package/dist/{errors-BXpyBhCI.js → errors-DdWVEGU8.js} +1 -1
- package/dist/{errors-BXpyBhCI.js.map → errors-DdWVEGU8.js.map} +1 -1
- package/dist/errors-DlbJQYs7.d.ts +29 -0
- package/dist/errors-DlbJQYs7.d.ts.map +1 -0
- package/dist/{errors-BGSgVV40.cjs → errors-xD8r6fCf.cjs} +1 -1
- package/dist/{errors-BGSgVV40.cjs.map → errors-xD8r6fCf.cjs.map} +1 -1
- package/dist/{executor-_CO7E1U7.d.ts → executor-B7q7K_27.d.ts} +2 -2
- package/dist/{executor-_CO7E1U7.d.ts.map → executor-B7q7K_27.d.ts.map} +1 -1
- package/dist/{executor-CEXp0gYP.d.cts → executor-BsE5nF-j.d.cts} +1 -1
- package/dist/{executor-CEXp0gYP.d.cts.map → executor-BsE5nF-j.d.cts.map} +1 -1
- package/dist/index.cjs +3 -24
- package/dist/index.d.cts +4 -38
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/mcp/index.cjs +2 -2
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +2 -2
- package/dist/protocol/index.cjs +3 -3
- package/dist/protocol/index.cjs.map +1 -1
- package/dist/protocol/index.d.cts +2 -2
- package/dist/protocol/index.d.ts +3 -3
- package/dist/protocol/index.js +3 -3
- package/dist/protocol/index.js.map +1 -1
- package/dist/{resolveProvider-BHuwOGBm.js → resolveProvider-Bfj27oYs.js} +3 -3
- package/dist/{resolveProvider-BHuwOGBm.js.map → resolveProvider-Bfj27oYs.js.map} +1 -1
- package/dist/{resolveProvider-DfcSnwnp.cjs → resolveProvider-CszBWDOY.cjs} +2 -44
- package/dist/{resolveProvider-DfcSnwnp.cjs.map → resolveProvider-CszBWDOY.cjs.map} +1 -1
- package/dist/{runner-nUCF59Au.js → runner-BqYkAnOm.js} +2 -2
- package/dist/{runner-nUCF59Au.js.map → runner-BqYkAnOm.js.map} +1 -1
- package/dist/{runner-FSGSGEpx.d.ts → runner-ClFrFnz9.d.ts} +1 -1
- package/dist/{runner-FSGSGEpx.d.ts.map → runner-ClFrFnz9.d.ts.map} +1 -1
- package/dist/{runner-BxbJ5eWb.cjs → runner-CsrfDub-.cjs} +2 -2
- package/dist/{runner-BxbJ5eWb.cjs.map → runner-CsrfDub-.cjs.map} +1 -1
- package/dist/runtime.cjs +90 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +65 -0
- package/dist/runtime.d.cts.map +1 -0
- package/dist/runtime.d.ts +65 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +74 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +7 -7
- package/dist/_internal/index.cjs +0 -45
- package/dist/_internal/index.cjs.map +0 -1
- package/dist/_internal/index.d.cts +0 -21
- package/dist/_internal/index.d.cts.map +0 -1
- package/dist/_internal/index.d.ts +0 -22
- package/dist/_internal/index.d.ts.map +0 -1
- package/dist/_internal/index.js +0 -30
- package/dist/_internal/index.js.map +0 -1
- package/dist/errors-B3IY3ID-.d.cts +0 -69
- package/dist/errors-B3IY3ID-.d.cts.map +0 -1
- package/dist/errors-BbUru7ko.d.ts +0 -69
- package/dist/errors-BbUru7ko.d.ts.map +0 -1
- package/dist/normalize-B80ZCnxe.cjs +0 -54
- package/dist/normalize-B80ZCnxe.cjs.map +0 -1
- package/dist/normalize-dfQC7HWx.js +0 -48
- package/dist/normalize-dfQC7HWx.js.map +0 -1
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const require_resolveProvider = require('./resolveProvider-CszBWDOY.cjs');
|
|
2
|
+
const require_errors = require('./errors-xD8r6fCf.cjs');
|
|
3
|
+
const require_runner = require('./runner-CsrfDub-.cjs');
|
|
4
|
+
let acorn = require("acorn");
|
|
5
|
+
|
|
6
|
+
//#region src/normalize.ts
|
|
7
|
+
function stripCodeFences(source) {
|
|
8
|
+
const match = source.match(/^\s*```[^\n]*\n([\s\S]*?)\n?```\s*$/);
|
|
9
|
+
return match ? match[1] : source;
|
|
10
|
+
}
|
|
11
|
+
function wrapAsync(body) {
|
|
12
|
+
if (body.trim().length === 0) return "async () => {}";
|
|
13
|
+
return `async () => {\n${body}\n}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
17
|
+
*/
|
|
18
|
+
function normalizeCode(source) {
|
|
19
|
+
const normalizedSource = stripCodeFences(source).trim();
|
|
20
|
+
if (normalizedSource.length === 0) return "async () => {}";
|
|
21
|
+
try {
|
|
22
|
+
const program = (0, acorn.parse)(normalizedSource, {
|
|
23
|
+
ecmaVersion: "latest",
|
|
24
|
+
sourceType: "module"
|
|
25
|
+
});
|
|
26
|
+
if (program.body?.length === 1) {
|
|
27
|
+
const [statement] = program.body;
|
|
28
|
+
if (statement.type === "FunctionDeclaration" && statement.id?.name) return wrapAsync(`${normalizedSource}\nreturn ${statement.id.name}();`);
|
|
29
|
+
if (statement.type === "ExpressionStatement" && statement.expression) {
|
|
30
|
+
if (statement.expression.type === "ArrowFunctionExpression" && statement.expression.async) return normalizedSource;
|
|
31
|
+
return wrapAsync(`return (${normalizedSource});`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const lastStatement = (program.body ?? []).at(-1);
|
|
35
|
+
if (lastStatement?.type === "ExpressionStatement" && lastStatement.expression) {
|
|
36
|
+
const bodyPrefix = normalizedSource.slice(0, lastStatement.start).trimEnd();
|
|
37
|
+
const expressionSource = normalizedSource.slice(lastStatement.expression.start, lastStatement.expression.end);
|
|
38
|
+
const lines = [];
|
|
39
|
+
if (bodyPrefix.length > 0) lines.push(bodyPrefix);
|
|
40
|
+
lines.push(`return (${expressionSource});`);
|
|
41
|
+
return wrapAsync(lines.join("\n"));
|
|
42
|
+
}
|
|
43
|
+
return wrapAsync(normalizedSource);
|
|
44
|
+
} catch {
|
|
45
|
+
return wrapAsync(normalizedSource);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/runtimeOptions.ts
|
|
51
|
+
/**
|
|
52
|
+
* Default runtime limits shared across the built-in executor implementations.
|
|
53
|
+
*/
|
|
54
|
+
const DEFAULT_EXECUTOR_RUNTIME_OPTIONS = {
|
|
55
|
+
maxLogChars: 64e3,
|
|
56
|
+
maxLogLines: 100,
|
|
57
|
+
memoryLimitBytes: 64 * 1024 * 1024,
|
|
58
|
+
timeoutMs: 5e3
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
62
|
+
* base options object and finally the shared defaults.
|
|
63
|
+
*/
|
|
64
|
+
function resolveExecutorRuntimeOptions(options = {}, overrides = {}) {
|
|
65
|
+
return {
|
|
66
|
+
maxLogChars: overrides.maxLogChars ?? options.maxLogChars ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,
|
|
67
|
+
maxLogLines: overrides.maxLogLines ?? options.maxLogLines ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,
|
|
68
|
+
memoryLimitBytes: overrides.memoryLimitBytes ?? options.memoryLimitBytes ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,
|
|
69
|
+
timeoutMs: overrides.timeoutMs ?? options.timeoutMs ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.DEFAULT_EXECUTOR_RUNTIME_OPTIONS = DEFAULT_EXECUTOR_RUNTIME_OPTIONS;
|
|
75
|
+
exports.ExecuteFailure = require_errors.ExecuteFailure;
|
|
76
|
+
exports.createExecutionContext = require_runner.createExecutionContext;
|
|
77
|
+
exports.createTimeoutExecuteResult = require_runner.createTimeoutExecuteResult;
|
|
78
|
+
exports.createToolCallDispatcher = require_runner.createToolCallDispatcher;
|
|
79
|
+
exports.extractProviderManifests = require_runner.extractProviderManifests;
|
|
80
|
+
exports.formatConsoleLine = require_runner.formatConsoleLine;
|
|
81
|
+
exports.getExecutionTimeoutMessage = require_runner.getExecutionTimeoutMessage;
|
|
82
|
+
exports.isExecuteFailure = require_errors.isExecuteFailure;
|
|
83
|
+
exports.isJsonSerializable = require_errors.isJsonSerializable;
|
|
84
|
+
exports.isKnownExecuteErrorCode = require_runner.isKnownExecuteErrorCode;
|
|
85
|
+
exports.normalizeCode = normalizeCode;
|
|
86
|
+
exports.normalizeThrownMessage = require_runner.normalizeThrownMessage;
|
|
87
|
+
exports.normalizeThrownName = require_runner.normalizeThrownName;
|
|
88
|
+
exports.resolveExecutorRuntimeOptions = resolveExecutorRuntimeOptions;
|
|
89
|
+
exports.truncateLogs = require_runner.truncateLogs;
|
|
90
|
+
//# sourceMappingURL=runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":["DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions"],"sources":["../src/normalize.ts","../src/runtimeOptions.ts"],"sourcesContent":["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 type { ExecutorRuntimeOptions } from \"./runner.ts\";\n\n/**\n * Fully resolved executor runtime limits after defaults and overrides apply.\n */\nexport type ResolvedExecutorRuntimeOptions = Readonly<\n Required<ExecutorRuntimeOptions>\n>;\n\n/**\n * Default runtime limits shared across the built-in executor implementations.\n */\nconst DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions = {\n maxLogChars: 64_000,\n maxLogLines: 100,\n memoryLimitBytes: 64 * 1024 * 1024,\n timeoutMs: 5000,\n};\n\nexport { DEFAULT_EXECUTOR_RUNTIME_OPTIONS };\n\n/**\n * Resolves executor runtime limits by applying explicit overrides on top of a\n * base options object and finally the shared defaults.\n */\nexport function resolveExecutorRuntimeOptions(\n options: ExecutorRuntimeOptions = {},\n overrides: ExecutorRuntimeOptions = {},\n): Required<ExecutorRuntimeOptions> {\n return {\n maxLogChars:\n overrides.maxLogChars ??\n options.maxLogChars ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,\n maxLogLines:\n overrides.maxLogLines ??\n options.maxLogLines ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,\n memoryLimitBytes:\n overrides.memoryLimitBytes ??\n options.memoryLimitBytes ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,\n timeoutMs:\n overrides.timeoutMs ??\n options.timeoutMs ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs,\n };\n}\n"],"mappings":";;;;;;AAcA,SAAS,gBAAgB,QAAwB;CAC/C,MAAM,QAAQ,OAAO,MAAM,sCAAsC;AACjE,QAAO,QAAQ,MAAM,KAAK;;AAG5B,SAAS,UAAU,MAAsB;AACvC,KAAI,KAAK,MAAM,CAAC,WAAW,EACzB,QAAO;AAGT,QAAO,kBAAkB,KAAK;;;;;AAMhC,SAAgB,cAAc,QAAwB;CACpD,MAAM,mBAAmB,gBAAgB,OAAO,CAAC,MAAM;AAEvD,KAAI,iBAAiB,WAAW,EAC9B,QAAO;AAGT,KAAI;EACF,MAAM,2BAAgB,kBAAkB;GACtC,aAAa;GACb,YAAY;GACb,CAAC;AAEF,MAAI,QAAQ,MAAM,WAAW,GAAG;GAC9B,MAAM,CAAC,aAAa,QAAQ;AAE5B,OAAI,UAAU,SAAS,yBAAyB,UAAU,IAAI,KAC5D,QAAO,UAAU,GAAG,iBAAiB,WAAW,UAAU,GAAG,KAAK,KAAK;AAGzE,OAAI,UAAU,SAAS,yBAAyB,UAAU,YAAY;AACpE,QACE,UAAU,WAAW,SAAS,6BAC9B,UAAU,WAAW,MAErB,QAAO;AAGT,WAAO,UAAU,WAAW,iBAAiB,IAAI;;;EAKrD,MAAM,iBADO,QAAQ,QAAQ,EAAE,EACJ,GAAG,GAAG;AAEjC,MACE,eAAe,SAAS,yBACxB,cAAc,YACd;GACA,MAAM,aAAa,iBAChB,MAAM,GAAG,cAAc,MAAM,CAC7B,SAAS;GACZ,MAAM,mBAAmB,iBAAiB,MACxC,cAAc,WAAW,OACzB,cAAc,WAAW,IAC1B;GAED,MAAM,QAAQ,EAAE;AAEhB,OAAI,WAAW,SAAS,EACtB,OAAM,KAAK,WAAW;AAGxB,SAAM,KAAK,WAAW,iBAAiB,IAAI;AAE3C,UAAO,UAAU,MAAM,KAAK,KAAK,CAAC;;AAGpC,SAAO,UAAU,iBAAiB;SAC5B;AACN,SAAO,UAAU,iBAAiB;;;;;;;;;AC9EtC,MAAMA,mCAAmE;CACvE,aAAa;CACb,aAAa;CACb,kBAAkB,KAAK,OAAO;CAC9B,WAAW;CACZ;;;;;AAQD,SAAgB,8BACd,UAAkC,EAAE,EACpC,YAAoC,EAAE,EACJ;AAClC,QAAO;EACL,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,kBACE,UAAU,oBACV,QAAQ,oBACR,iCAAiC;EACnC,WACE,UAAU,aACV,QAAQ,aACR,iCAAiC;EACpC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
+
*/
|
|
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 { t as Executor } from "./executor-BsE5nF-j.cjs";
|
|
7
|
+
import { n as isExecuteFailure, r as isJsonSerializable, t as ExecuteFailure } from "./errors-B9ADBuDH.cjs";
|
|
8
|
+
|
|
9
|
+
//#region src/executor/shared.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Returns whether the value is one of execbox's stable execution error codes.
|
|
12
|
+
*/
|
|
13
|
+
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the stable timeout message used across executor implementations.
|
|
16
|
+
*/
|
|
17
|
+
declare function getExecutionTimeoutMessage(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
20
|
+
*/
|
|
21
|
+
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes an unknown thrown value into a human-readable message.
|
|
24
|
+
*/
|
|
25
|
+
declare function normalizeThrownMessage(error: unknown): string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the thrown error name when one is available.
|
|
28
|
+
*/
|
|
29
|
+
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
32
|
+
*/
|
|
33
|
+
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
34
|
+
/**
|
|
35
|
+
* Truncates captured logs to the configured line and character limits.
|
|
36
|
+
*/
|
|
37
|
+
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Formats guest console arguments into a single host-side log line.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatConsoleLine(values: unknown[]): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/normalize.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
46
|
+
*/
|
|
47
|
+
declare function normalizeCode(source: string): string;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/runtimeOptions.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* Fully resolved executor runtime limits after defaults and overrides apply.
|
|
52
|
+
*/
|
|
53
|
+
type ResolvedExecutorRuntimeOptions = Readonly<Required<ExecutorRuntimeOptions>>;
|
|
54
|
+
/**
|
|
55
|
+
* Default runtime limits shared across the built-in executor implementations.
|
|
56
|
+
*/
|
|
57
|
+
declare const DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
60
|
+
* base options object and finally the shared defaults.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveExecutorRuntimeOptions(options?: ExecutorRuntimeOptions, overrides?: ExecutorRuntimeOptions): Required<ExecutorRuntimeOptions>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedExecutorRuntimeOptions, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
65
|
+
//# sourceMappingURL=runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.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AAA,MAAA;;AAEa,OAAA,CAAA,QAAA,CFkFG,YAAA,CElFH,IAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,CAAA,MAAA,CAAA,CAAA,WAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA;;;;iBFgIG,iBAAA;;;;;;iBC7HA,aAAA;;;;;;KCzBJ,8BAAA,CAAA,CAAA,CAAiC,SAC3C,SAAS;AFmBX,CAAA,CAAA;AASA,CAAA,CAAA,CAAA,OAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,CAAA,EAAA,CAAA,QAAA,CAAA,eAAA;AAOA,CAAA,CAAA;AAeA,OAAA,CAAA,KAAA,CE5CM,gCF4CgC,CAAA,CE5CE,8BF4CF;AAoCtC,CAAA,CAAA;AAiBA,CAAA,CAAA,CAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,MAAA,CAAA,EAAA,CAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA;AA8CA,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA,CAAA,MAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,QAAA;;iBElIgB,6BAAA,WACL,oCACE,yBACV,SAAS"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
+
*/
|
|
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-ClFrFnz9.js";
|
|
6
|
+
import { t as Executor } from "./executor-B7q7K_27.js";
|
|
7
|
+
import { n as isExecuteFailure, r as isJsonSerializable, t as ExecuteFailure } from "./errors-DlbJQYs7.js";
|
|
8
|
+
|
|
9
|
+
//#region src/executor/shared.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Returns whether the value is one of execbox's stable execution error codes.
|
|
12
|
+
*/
|
|
13
|
+
declare function isKnownExecuteErrorCode(value: unknown): value is ExecuteErrorCode;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the stable timeout message used across executor implementations.
|
|
16
|
+
*/
|
|
17
|
+
declare function getExecutionTimeoutMessage(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates the canonical timeout failure result used for preflight cancellation.
|
|
20
|
+
*/
|
|
21
|
+
declare function createTimeoutExecuteResult(durationMs?: number): ExecuteResult;
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes an unknown thrown value into a human-readable message.
|
|
24
|
+
*/
|
|
25
|
+
declare function normalizeThrownMessage(error: unknown): string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the thrown error name when one is available.
|
|
28
|
+
*/
|
|
29
|
+
declare function normalizeThrownName(error: unknown): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Builds the standard tool execution context passed to resolved tool wrappers.
|
|
32
|
+
*/
|
|
33
|
+
declare function createExecutionContext(signal: AbortSignal, providerName: string, safeToolName: string, originalToolName: string): ToolExecutionContext;
|
|
34
|
+
/**
|
|
35
|
+
* Truncates captured logs to the configured line and character limits.
|
|
36
|
+
*/
|
|
37
|
+
declare function truncateLogs(logs: string[], maxLogLines: number, maxLogChars: number): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Formats guest console arguments into a single host-side log line.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatConsoleLine(values: unknown[]): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/normalize.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
46
|
+
*/
|
|
47
|
+
declare function normalizeCode(source: string): string;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/runtimeOptions.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* Fully resolved executor runtime limits after defaults and overrides apply.
|
|
52
|
+
*/
|
|
53
|
+
type ResolvedExecutorRuntimeOptions = Readonly<Required<ExecutorRuntimeOptions>>;
|
|
54
|
+
/**
|
|
55
|
+
* Default runtime limits shared across the built-in executor implementations.
|
|
56
|
+
*/
|
|
57
|
+
declare const DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
60
|
+
* base options object and finally the shared defaults.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveExecutorRuntimeOptions(options?: ExecutorRuntimeOptions, overrides?: ExecutorRuntimeOptions): Required<ExecutorRuntimeOptions>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedExecutorRuntimeOptions, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
65
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":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a,OAAA,CAAA,QAAA,CFkFG,YAAA,CElFH,IAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,CAAA,MAAA,CAAA,CAAA,WAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA;;;;iBFgIG,iBAAA;;;;;;iBC7HA,aAAA;;;;;;KCzBJ,8BAAA,CAAA,CAAA,CAAiC,SAC3C,SAAS;AFmBX,CAAA,CAAA;AASA,CAAA,CAAA,CAAA,OAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,CAAA,EAAA,CAAA,QAAA,CAAA,eAAA;AAOA,CAAA,CAAA;AAeA,OAAA,CAAA,KAAA,CE5CM,gCF4CgC,CAAA,CE5CE,8BF4CF;AAoCtC,CAAA,CAAA;AAiBA,CAAA,CAAA,CAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,MAAA,CAAA,EAAA,CAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA;AA8CA,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA,CAAA,MAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,QAAA;;iBElIgB,6BAAA,WACL,oCACE,yBACV,SAAS"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { n as isExecuteFailure, r as isJsonSerializable, t as ExecuteFailure } from "./errors-DdWVEGU8.js";
|
|
2
|
+
import { a as formatConsoleLine, c as normalizeThrownMessage, i as createTimeoutExecuteResult, l as normalizeThrownName, n as extractProviderManifests, o as getExecutionTimeoutMessage, r as createExecutionContext, s as isKnownExecuteErrorCode, t as createToolCallDispatcher, u as truncateLogs } from "./runner-BqYkAnOm.js";
|
|
3
|
+
import { parse } from "acorn";
|
|
4
|
+
|
|
5
|
+
//#region src/normalize.ts
|
|
6
|
+
function stripCodeFences(source) {
|
|
7
|
+
const match = source.match(/^\s*```[^\n]*\n([\s\S]*?)\n?```\s*$/);
|
|
8
|
+
return match ? match[1] : source;
|
|
9
|
+
}
|
|
10
|
+
function wrapAsync(body) {
|
|
11
|
+
if (body.trim().length === 0) return "async () => {}";
|
|
12
|
+
return `async () => {\n${body}\n}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes model-produced JavaScript into an executable async function body.
|
|
16
|
+
*/
|
|
17
|
+
function normalizeCode(source) {
|
|
18
|
+
const normalizedSource = stripCodeFences(source).trim();
|
|
19
|
+
if (normalizedSource.length === 0) return "async () => {}";
|
|
20
|
+
try {
|
|
21
|
+
const program = parse(normalizedSource, {
|
|
22
|
+
ecmaVersion: "latest",
|
|
23
|
+
sourceType: "module"
|
|
24
|
+
});
|
|
25
|
+
if (program.body?.length === 1) {
|
|
26
|
+
const [statement] = program.body;
|
|
27
|
+
if (statement.type === "FunctionDeclaration" && statement.id?.name) return wrapAsync(`${normalizedSource}\nreturn ${statement.id.name}();`);
|
|
28
|
+
if (statement.type === "ExpressionStatement" && statement.expression) {
|
|
29
|
+
if (statement.expression.type === "ArrowFunctionExpression" && statement.expression.async) return normalizedSource;
|
|
30
|
+
return wrapAsync(`return (${normalizedSource});`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const lastStatement = (program.body ?? []).at(-1);
|
|
34
|
+
if (lastStatement?.type === "ExpressionStatement" && lastStatement.expression) {
|
|
35
|
+
const bodyPrefix = normalizedSource.slice(0, lastStatement.start).trimEnd();
|
|
36
|
+
const expressionSource = normalizedSource.slice(lastStatement.expression.start, lastStatement.expression.end);
|
|
37
|
+
const lines = [];
|
|
38
|
+
if (bodyPrefix.length > 0) lines.push(bodyPrefix);
|
|
39
|
+
lines.push(`return (${expressionSource});`);
|
|
40
|
+
return wrapAsync(lines.join("\n"));
|
|
41
|
+
}
|
|
42
|
+
return wrapAsync(normalizedSource);
|
|
43
|
+
} catch {
|
|
44
|
+
return wrapAsync(normalizedSource);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/runtimeOptions.ts
|
|
50
|
+
/**
|
|
51
|
+
* Default runtime limits shared across the built-in executor implementations.
|
|
52
|
+
*/
|
|
53
|
+
const DEFAULT_EXECUTOR_RUNTIME_OPTIONS = {
|
|
54
|
+
maxLogChars: 64e3,
|
|
55
|
+
maxLogLines: 100,
|
|
56
|
+
memoryLimitBytes: 64 * 1024 * 1024,
|
|
57
|
+
timeoutMs: 5e3
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
61
|
+
* base options object and finally the shared defaults.
|
|
62
|
+
*/
|
|
63
|
+
function resolveExecutorRuntimeOptions(options = {}, overrides = {}) {
|
|
64
|
+
return {
|
|
65
|
+
maxLogChars: overrides.maxLogChars ?? options.maxLogChars ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,
|
|
66
|
+
maxLogLines: overrides.maxLogLines ?? options.maxLogLines ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,
|
|
67
|
+
memoryLimitBytes: overrides.memoryLimitBytes ?? options.memoryLimitBytes ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,
|
|
68
|
+
timeoutMs: overrides.timeoutMs ?? options.timeoutMs ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, ExecuteFailure, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
74
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions"],"sources":["../src/normalize.ts","../src/runtimeOptions.ts"],"sourcesContent":["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 type { ExecutorRuntimeOptions } from \"./runner.ts\";\n\n/**\n * Fully resolved executor runtime limits after defaults and overrides apply.\n */\nexport type ResolvedExecutorRuntimeOptions = Readonly<\n Required<ExecutorRuntimeOptions>\n>;\n\n/**\n * Default runtime limits shared across the built-in executor implementations.\n */\nconst DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions = {\n maxLogChars: 64_000,\n maxLogLines: 100,\n memoryLimitBytes: 64 * 1024 * 1024,\n timeoutMs: 5000,\n};\n\nexport { DEFAULT_EXECUTOR_RUNTIME_OPTIONS };\n\n/**\n * Resolves executor runtime limits by applying explicit overrides on top of a\n * base options object and finally the shared defaults.\n */\nexport function resolveExecutorRuntimeOptions(\n options: ExecutorRuntimeOptions = {},\n overrides: ExecutorRuntimeOptions = {},\n): Required<ExecutorRuntimeOptions> {\n return {\n maxLogChars:\n overrides.maxLogChars ??\n options.maxLogChars ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,\n maxLogLines:\n overrides.maxLogLines ??\n options.maxLogLines ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,\n memoryLimitBytes:\n overrides.memoryLimitBytes ??\n options.memoryLimitBytes ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,\n timeoutMs:\n overrides.timeoutMs ??\n options.timeoutMs ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs,\n };\n}\n"],"mappings":";;;;;AAcA,SAAS,gBAAgB,QAAwB;CAC/C,MAAM,QAAQ,OAAO,MAAM,sCAAsC;AACjE,QAAO,QAAQ,MAAM,KAAK;;AAG5B,SAAS,UAAU,MAAsB;AACvC,KAAI,KAAK,MAAM,CAAC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AAiC;EACnC,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,kBACE,UAAU,oBACV,QAAQ,oBACR,iCAAiC;EACnC,WACE,UAAU,aACV,QAAQ,aACR,iCAAiC;EACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@execbox/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Core execution contract, provider resolution, and MCP adapters.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"import": "./dist/protocol/index.js",
|
|
39
39
|
"require": "./dist/protocol/index.cjs"
|
|
40
40
|
},
|
|
41
|
-
"./
|
|
42
|
-
"source": "./src/
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"source": "./src/runtime.ts",
|
|
43
43
|
"types": {
|
|
44
|
-
"import": "./dist/
|
|
45
|
-
"require": "./dist/
|
|
44
|
+
"import": "./dist/runtime.d.ts",
|
|
45
|
+
"require": "./dist/runtime.d.cts"
|
|
46
46
|
},
|
|
47
|
-
"import": "./dist/
|
|
48
|
-
"require": "./dist/
|
|
47
|
+
"import": "./dist/runtime.js",
|
|
48
|
+
"require": "./dist/runtime.cjs"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
package/dist/_internal/index.cjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_runner = require('../runner-BxbJ5eWb.cjs');
|
|
2
|
-
const require_normalize = require('../normalize-B80ZCnxe.cjs');
|
|
3
|
-
const require_errors = require('../errors-BGSgVV40.cjs');
|
|
4
|
-
|
|
5
|
-
//#region src/runtimeOptions.ts
|
|
6
|
-
/**
|
|
7
|
-
* Default runtime limits shared across the built-in executor implementations.
|
|
8
|
-
*/
|
|
9
|
-
const DEFAULT_EXECUTOR_RUNTIME_OPTIONS = {
|
|
10
|
-
maxLogChars: 64e3,
|
|
11
|
-
maxLogLines: 100,
|
|
12
|
-
memoryLimitBytes: 64 * 1024 * 1024,
|
|
13
|
-
timeoutMs: 5e3
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
17
|
-
* base options object and finally the shared defaults.
|
|
18
|
-
*/
|
|
19
|
-
function resolveExecutorRuntimeOptions(options = {}, overrides = {}) {
|
|
20
|
-
return {
|
|
21
|
-
maxLogChars: overrides.maxLogChars ?? options.maxLogChars ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,
|
|
22
|
-
maxLogLines: overrides.maxLogLines ?? options.maxLogLines ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,
|
|
23
|
-
memoryLimitBytes: overrides.memoryLimitBytes ?? options.memoryLimitBytes ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,
|
|
24
|
-
timeoutMs: overrides.timeoutMs ?? options.timeoutMs ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.DEFAULT_EXECUTOR_RUNTIME_OPTIONS = DEFAULT_EXECUTOR_RUNTIME_OPTIONS;
|
|
30
|
-
exports.ExecuteFailure = require_errors.ExecuteFailure;
|
|
31
|
-
exports.createExecutionContext = require_runner.createExecutionContext;
|
|
32
|
-
exports.createTimeoutExecuteResult = require_runner.createTimeoutExecuteResult;
|
|
33
|
-
exports.createToolCallDispatcher = require_runner.createToolCallDispatcher;
|
|
34
|
-
exports.extractProviderManifests = require_runner.extractProviderManifests;
|
|
35
|
-
exports.formatConsoleLine = require_runner.formatConsoleLine;
|
|
36
|
-
exports.getExecutionTimeoutMessage = require_runner.getExecutionTimeoutMessage;
|
|
37
|
-
exports.isExecuteFailure = require_errors.isExecuteFailure;
|
|
38
|
-
exports.isJsonSerializable = require_errors.isJsonSerializable;
|
|
39
|
-
exports.isKnownExecuteErrorCode = require_runner.isKnownExecuteErrorCode;
|
|
40
|
-
exports.normalizeCode = require_normalize.normalizeCode;
|
|
41
|
-
exports.normalizeThrownMessage = require_runner.normalizeThrownMessage;
|
|
42
|
-
exports.normalizeThrownName = require_runner.normalizeThrownName;
|
|
43
|
-
exports.resolveExecutorRuntimeOptions = resolveExecutorRuntimeOptions;
|
|
44
|
-
exports.truncateLogs = require_runner.truncateLogs;
|
|
45
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions"],"sources":["../../src/runtimeOptions.ts"],"sourcesContent":["import type { ExecutorRuntimeOptions } from \"./runner.ts\";\n\ntype ResolvedExecutorRuntimeOptions = Readonly<\n Required<ExecutorRuntimeOptions>\n>;\n\n/**\n * Default runtime limits shared across the built-in executor implementations.\n */\nconst DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions = {\n maxLogChars: 64_000,\n maxLogLines: 100,\n memoryLimitBytes: 64 * 1024 * 1024,\n timeoutMs: 5000,\n};\n\nexport { DEFAULT_EXECUTOR_RUNTIME_OPTIONS };\n\n/**\n * Resolves executor runtime limits by applying explicit overrides on top of a\n * base options object and finally the shared defaults.\n */\nexport function resolveExecutorRuntimeOptions(\n options: ExecutorRuntimeOptions = {},\n overrides: ExecutorRuntimeOptions = {},\n): Required<ExecutorRuntimeOptions> {\n return {\n maxLogChars:\n overrides.maxLogChars ??\n options.maxLogChars ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,\n maxLogLines:\n overrides.maxLogLines ??\n options.maxLogLines ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,\n memoryLimitBytes:\n overrides.memoryLimitBytes ??\n options.memoryLimitBytes ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,\n timeoutMs:\n overrides.timeoutMs ??\n options.timeoutMs ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs,\n };\n}\n"],"mappings":";;;;;;;;AASA,MAAMA,mCAAmE;CACvE,aAAa;CACb,aAAa;CACb,kBAAkB,KAAK,OAAO;CAC9B,WAAW;CACZ;;;;;AAQD,SAAgB,8BACd,UAAkC,EAAE,EACpC,YAAoC,EAAE,EACJ;AAClC,QAAO;EACL,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,kBACE,UAAU,oBACV,QAAQ,oBACR,iCAAiC;EACnC,WACE,UAAU,aACV,QAAQ,aACR,iCAAiC;EACpC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
-
*/
|
|
5
|
-
import { c as extractProviderManifests, n as ExecutorRuntimeOptions, s as createToolCallDispatcher } 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
|
-
|
|
8
|
-
//#region src/runtimeOptions.d.ts
|
|
9
|
-
type ResolvedExecutorRuntimeOptions = Readonly<Required<ExecutorRuntimeOptions>>;
|
|
10
|
-
/**
|
|
11
|
-
* Default runtime limits shared across the built-in executor implementations.
|
|
12
|
-
*/
|
|
13
|
-
declare const DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
16
|
-
* base options object and finally the shared defaults.
|
|
17
|
-
*/
|
|
18
|
-
declare function resolveExecutorRuntimeOptions(options?: ExecutorRuntimeOptions, overrides?: ExecutorRuntimeOptions): Required<ExecutorRuntimeOptions>;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, ExecuteFailure, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
21
|
-
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/runtimeOptions.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAEK,8BAAA,CAAA,CAAA,CAAiC,SACpC,SAAS;;;AAH+C,CAAA,CAAA;cASpD,gCANK,CAAA,CAM6B,8BAN7B;;;AADmC,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA,CAAA,MAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,QAAA;AAoB9C,CAAA,CAAA;AACW,OAAA,CAAA,QAAA,CADK,6BAAA,CACL,OAAA,CAAA,CAAA,CAAA,sBAAA,CAAA,CAAA,SAAA,CAAA,CAAA,CACE,sBADF,CAAA,CAAA,CAER,QAFQ,CAEC,sBAFD,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
-
*/
|
|
5
|
-
import { c as extractProviderManifests, n as ExecutorRuntimeOptions, s as createToolCallDispatcher } 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 "../executor-_CO7E1U7.js";
|
|
8
|
-
|
|
9
|
-
//#region src/runtimeOptions.d.ts
|
|
10
|
-
type ResolvedExecutorRuntimeOptions = Readonly<Required<ExecutorRuntimeOptions>>;
|
|
11
|
-
/**
|
|
12
|
-
* Default runtime limits shared across the built-in executor implementations.
|
|
13
|
-
*/
|
|
14
|
-
declare const DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions;
|
|
15
|
-
/**
|
|
16
|
-
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
17
|
-
* base options object and finally the shared defaults.
|
|
18
|
-
*/
|
|
19
|
-
declare function resolveExecutorRuntimeOptions(options?: ExecutorRuntimeOptions, overrides?: ExecutorRuntimeOptions): Required<ExecutorRuntimeOptions>;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, ExecuteFailure, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/runtimeOptions.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAEK,8BAAA,CAAA,CAAA,CAAiC,SACpC,SAAS;;;;AAH+C,OAAA,CAAA,KAAA,CASpD,gCAP6B,CAAA,CAOK,8BAPL;;;;AAAW,CAAA,CAAA;AAoB9B,OAAA,CAAA,QAAA,CAAA,6BAAA,CAA6B,OAAA,CAAA,CAAA,CAClC,sBADkC,CAAA,CAAA,SAAA,CAAA,CAAA,CAEhC,sBAFgC,CAAA,CAAA,CAG1C,QAH0C,CAGjC,sBAHiC,CAAA"}
|
package/dist/_internal/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { a as formatConsoleLine, c as normalizeThrownMessage, i as createTimeoutExecuteResult, l as normalizeThrownName, n as extractProviderManifests, o as getExecutionTimeoutMessage, r as createExecutionContext, s as isKnownExecuteErrorCode, t as createToolCallDispatcher, u as truncateLogs } from "../runner-nUCF59Au.js";
|
|
2
|
-
import { t as normalizeCode } from "../normalize-dfQC7HWx.js";
|
|
3
|
-
import { n as isExecuteFailure, r as isJsonSerializable, t as ExecuteFailure } from "../errors-BXpyBhCI.js";
|
|
4
|
-
|
|
5
|
-
//#region src/runtimeOptions.ts
|
|
6
|
-
/**
|
|
7
|
-
* Default runtime limits shared across the built-in executor implementations.
|
|
8
|
-
*/
|
|
9
|
-
const DEFAULT_EXECUTOR_RUNTIME_OPTIONS = {
|
|
10
|
-
maxLogChars: 64e3,
|
|
11
|
-
maxLogLines: 100,
|
|
12
|
-
memoryLimitBytes: 64 * 1024 * 1024,
|
|
13
|
-
timeoutMs: 5e3
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
17
|
-
* base options object and finally the shared defaults.
|
|
18
|
-
*/
|
|
19
|
-
function resolveExecutorRuntimeOptions(options = {}, overrides = {}) {
|
|
20
|
-
return {
|
|
21
|
-
maxLogChars: overrides.maxLogChars ?? options.maxLogChars ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,
|
|
22
|
-
maxLogLines: overrides.maxLogLines ?? options.maxLogLines ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,
|
|
23
|
-
memoryLimitBytes: overrides.memoryLimitBytes ?? options.memoryLimitBytes ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,
|
|
24
|
-
timeoutMs: overrides.timeoutMs ?? options.timeoutMs ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { DEFAULT_EXECUTOR_RUNTIME_OPTIONS, ExecuteFailure, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveExecutorRuntimeOptions, truncateLogs };
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions"],"sources":["../../src/runtimeOptions.ts"],"sourcesContent":["import type { ExecutorRuntimeOptions } from \"./runner.ts\";\n\ntype ResolvedExecutorRuntimeOptions = Readonly<\n Required<ExecutorRuntimeOptions>\n>;\n\n/**\n * Default runtime limits shared across the built-in executor implementations.\n */\nconst DEFAULT_EXECUTOR_RUNTIME_OPTIONS: ResolvedExecutorRuntimeOptions = {\n maxLogChars: 64_000,\n maxLogLines: 100,\n memoryLimitBytes: 64 * 1024 * 1024,\n timeoutMs: 5000,\n};\n\nexport { DEFAULT_EXECUTOR_RUNTIME_OPTIONS };\n\n/**\n * Resolves executor runtime limits by applying explicit overrides on top of a\n * base options object and finally the shared defaults.\n */\nexport function resolveExecutorRuntimeOptions(\n options: ExecutorRuntimeOptions = {},\n overrides: ExecutorRuntimeOptions = {},\n): Required<ExecutorRuntimeOptions> {\n return {\n maxLogChars:\n overrides.maxLogChars ??\n options.maxLogChars ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,\n maxLogLines:\n overrides.maxLogLines ??\n options.maxLogLines ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,\n memoryLimitBytes:\n overrides.memoryLimitBytes ??\n options.memoryLimitBytes ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,\n timeoutMs:\n overrides.timeoutMs ??\n options.timeoutMs ??\n DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs,\n };\n}\n"],"mappings":";;;;;;;;AASA,MAAMA,mCAAmE;CACvE,aAAa;CACb,aAAa;CACb,kBAAkB,KAAK,OAAO;CAC9B,WAAW;CACZ;;;;;AAQD,SAAgB,8BACd,UAAkC,EAAE,EACpC,YAAoC,EAAE,EACJ;AAClC,QAAO;EACL,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,aACE,UAAU,eACV,QAAQ,eACR,iCAAiC;EACnC,kBACE,UAAU,oBACV,QAAQ,oBACR,iCAAiC;EACnC,WACE,UAAU,aACV,QAAQ,aACR,iCAAiC;EACpC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
-
*/
|
|
5
|
-
import { d as ExecuteResult, g as ToolExecutionContext, u as ExecuteErrorCode } from "./runner-DSgvu6Ad.cjs";
|
|
6
|
-
|
|
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
|
-
//#region src/normalize.d.ts
|
|
43
|
-
/**
|
|
44
|
-
* Normalizes model-produced JavaScript into an executable async function body.
|
|
45
|
-
*/
|
|
46
|
-
declare function normalizeCode(source: string): string;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/errors.d.ts
|
|
49
|
-
/**
|
|
50
|
-
* Structured failure used internally to propagate executor and tool errors.
|
|
51
|
-
*/
|
|
52
|
-
declare class ExecuteFailure extends Error {
|
|
53
|
-
code: ExecuteErrorCode;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a structured failure with a trusted executor or tool error code.
|
|
56
|
-
*/
|
|
57
|
-
constructor(code: ExecuteErrorCode, message: string);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
61
|
-
*/
|
|
62
|
-
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
63
|
-
/**
|
|
64
|
-
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
65
|
-
*/
|
|
66
|
-
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
67
|
-
//#endregion
|
|
68
|
-
export { createExecutionContext as a, getExecutionTimeoutMessage as c, normalizeThrownName as d, truncateLogs as f, normalizeCode as i, isKnownExecuteErrorCode as l, isExecuteFailure as n, createTimeoutExecuteResult as o, isJsonSerializable as r, formatConsoleLine as s, ExecuteFailure as t, normalizeThrownMessage as u };
|
|
69
|
-
//# sourceMappingURL=errors-B3IY3ID-.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-B3IY3ID-.d.cts","names":[],"sources":["../src/executor/shared.ts","../src/normalize.ts","../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAyBA,CAAA,CAAA;AASgB,OAAA,CAAA,QAAA,CATA,uBAAA,CAS0B,KAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,KAAA,CAAA,EAAA,CAP9B,gBAO8B;AAO1C,CAAA,CAAA;AAeA,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,OAAA,CAAA,OAAA,CAAA,IAAA,CAAA,MAAA,CAAA,QAAA,CAAA,eAAA;AAkBA,CAAA,CAAA;AAkBgB,OAAA,CAAA,QAAA,CA1DA,0BAAA,CAAA,CA2DN,CAAA,CAIP,MAAA;AAYH,CAAA,CAAA;AA8CA,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,SAAA,CAAA,OAAA,CAAA,OAAA,CAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CAAA,SAAA,CAAA,YAAA;;iBAlHgB,0BAAA,uBAA4C;;ACX5D,CAAA,CAAA,CAAA,UAAA,CAAA,EAAA,CAAA,OAAA,CAAA,MAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA,CAAA,KAAA,CAAA,QAAA,CAAA,OAAA;;iBD0BgB,sBAAA;;AEnDhB,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,KAAA,CAAA,IAAA,CAAA,IAAA,CAAA,GAAA,CA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