@execbox/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +11 -10
  2. package/dist/errors-CTel18cM.cjs +79 -0
  3. package/dist/errors-CTel18cM.cjs.map +1 -0
  4. package/dist/errors-CgBwm39w.js +61 -0
  5. package/dist/errors-CgBwm39w.js.map +1 -0
  6. package/dist/executor-B-Qe_q5_.d.ts +29 -0
  7. package/dist/executor-B-Qe_q5_.d.ts.map +1 -0
  8. package/dist/executor-C7YjuD7r.d.cts +29 -0
  9. package/dist/executor-C7YjuD7r.d.cts.map +1 -0
  10. package/dist/index.cjs +16 -186
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +6 -2
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.ts +6 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -173
  17. package/dist/index.js.map +1 -1
  18. package/dist/mcp/index.cjs +2 -1
  19. package/dist/mcp/index.cjs.map +1 -1
  20. package/dist/mcp/index.d.cts +7 -3
  21. package/dist/mcp/index.d.cts.map +1 -1
  22. package/dist/mcp/index.d.ts +7 -3
  23. package/dist/mcp/index.d.ts.map +1 -1
  24. package/dist/mcp/index.js +2 -1
  25. package/dist/mcp/index.js.map +1 -1
  26. package/dist/protocol/index.cjs +345 -0
  27. package/dist/protocol/index.cjs.map +1 -0
  28. package/dist/protocol/index.d.cts +169 -0
  29. package/dist/protocol/index.d.cts.map +1 -0
  30. package/dist/protocol/index.d.ts +169 -0
  31. package/dist/protocol/index.d.ts.map +1 -0
  32. package/dist/protocol/index.js +341 -0
  33. package/dist/protocol/index.js.map +1 -0
  34. package/dist/{resolveProvider-CixOjPKp.cjs → resolveProvider-D__uEvDj.cjs} +17 -85
  35. package/dist/resolveProvider-D__uEvDj.cjs.map +1 -0
  36. package/dist/{resolveProvider-CUxAvFCK.js → resolveProvider-TuOLZT2_.js} +13 -63
  37. package/dist/resolveProvider-TuOLZT2_.js.map +1 -0
  38. package/dist/runner-8eVWfKxh.js +176 -0
  39. package/dist/runner-8eVWfKxh.js.map +1 -0
  40. package/dist/{executor-B_S-ZRgM.d.ts → runner-BJu1lZFi.d.cts} +6 -22
  41. package/dist/runner-BJu1lZFi.d.cts.map +1 -0
  42. package/dist/{executor-CLQwhiIE.d.cts → runner-CbC-ncVb.d.ts} +6 -22
  43. package/dist/runner-CbC-ncVb.d.ts.map +1 -0
  44. package/dist/runner-Dt--9M2r.cjs +235 -0
  45. package/dist/runner-Dt--9M2r.cjs.map +1 -0
  46. package/package.json +20 -3
  47. package/dist/executor-B_S-ZRgM.d.ts.map +0 -1
  48. package/dist/executor-CLQwhiIE.d.cts.map +0 -1
  49. package/dist/resolveProvider-CUxAvFCK.js.map +0 -1
  50. package/dist/resolveProvider-CixOjPKp.cjs.map +0 -1
package/README.md CHANGED
@@ -5,6 +5,8 @@ Executor-agnostic core for guest JavaScript that can call host tools directly or
5
5
  [![npm version](https://img.shields.io/npm/v/%40execbox%2Fcore?style=flat-square)](https://www.npmjs.com/package/@execbox/core)
6
6
  [![License](https://img.shields.io/github/license/aallam/execbox?style=flat-square)](https://github.com/aallam/execbox/blob/main/LICENSE)
7
7
 
8
+ Docs: https://execbox.aallam.com
9
+
8
10
  ## What You Get
9
11
 
10
12
  - Resolve host tools into deterministic guest namespaces with name sanitization.
@@ -16,13 +18,11 @@ Executor-agnostic core for guest JavaScript that can call host tools directly or
16
18
 
17
19
  `@execbox/core` does not execute code on its own. Pair it with one of the executor packages:
18
20
 
19
- | Package | Best for |
20
- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------- |
21
- | [`@execbox/quickjs`](https://www.npmjs.com/package/@execbox/quickjs) | Easiest setup, no native addon, good default backend |
22
- | [`@execbox/remote`](https://www.npmjs.com/package/@execbox/remote) | Same executor API, but with a caller-supplied remote boundary |
23
- | [`@execbox/process`](https://www.npmjs.com/package/@execbox/process) | QuickJS execution in a child process with a stronger lifecycle split |
24
- | [`@execbox/worker`](https://www.npmjs.com/package/@execbox/worker) | QuickJS execution on a worker thread with a message boundary |
25
- | [`@execbox/isolated-vm`](https://www.npmjs.com/package/@execbox/isolated-vm) | Native `isolated-vm` backend when you specifically want that runtime |
21
+ | Package | Best for |
22
+ | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
23
+ | [`@execbox/quickjs`](https://www.npmjs.com/package/@execbox/quickjs) | Easiest setup, no native addon, with inline, worker, and process host modes |
24
+ | [`@execbox/remote`](https://www.npmjs.com/package/@execbox/remote) | Same executor API, but with a caller-supplied remote boundary |
25
+ | [`@execbox/isolated-vm`](https://www.npmjs.com/package/@execbox/isolated-vm) | Native `isolated-vm` backend when you specifically want that runtime |
26
26
 
27
27
  ## Examples
28
28
 
@@ -42,17 +42,18 @@ npm install @execbox/core @execbox/quickjs
42
42
  ```
43
43
 
44
44
  Swap in `@execbox/isolated-vm` when you want the native executor instead.
45
- Swap in `@execbox/process` when you want the QuickJS runtime to live in a fresh child process.
45
+ Set `host: "process"` on `QuickJsExecutor` when you want the QuickJS runtime to live in a fresh child process.
46
+ Set `host: "worker"` on `QuickJsExecutor` when you want QuickJS off the main thread with pooled worker shells.
46
47
  Swap in `@execbox/remote` when you want the same API but a caller-managed remote transport boundary.
47
48
 
48
49
  ## Security Posture
49
50
 
50
51
  - Execbox gives you fresh execution state, JSON-only tool boundaries, schema validation, timeout handling, memory limits, and bounded logs.
51
- - Execbox does not give you a hard security boundary for hostile code by itself. The actual boundary depends on which executor you pair it with.
52
+ - Hard isolation depends on the executor and deployment boundary you pair with `@execbox/core`.
52
53
  - Providers are explicit capability grants. Every tool you expose is authority you are handing to guest code.
53
54
  - In the default deployment model, provider and MCP tool definitions are controlled by the application, not by the end user.
54
55
  - Third-party MCP integrations should be reviewed as dependency-trust decisions, not folded into the primary end-user attacker model.
55
- - If the code source is hostile, prefer stronger isolation such as `@execbox/process`, `@execbox/remote`, a container, or a VM.
56
+ - If the code source is hostile, prefer stronger isolation such as `QuickJsExecutor` with `host: "process"`, `@execbox/remote`, a container, or a VM.
56
57
 
57
58
  ## Architecture Docs
58
59
 
@@ -0,0 +1,79 @@
1
+
2
+ //#region src/errors.ts
3
+ /**
4
+ * Structured failure used internally to propagate executor and tool errors.
5
+ */
6
+ var ExecuteFailure = class extends Error {
7
+ code;
8
+ /**
9
+ * Creates a structured failure with a trusted executor or tool error code.
10
+ */
11
+ constructor(code, message) {
12
+ super(message);
13
+ this.code = code;
14
+ this.name = "ExecuteFailure";
15
+ }
16
+ };
17
+ /**
18
+ * Returns whether a thrown value is an {@link ExecuteFailure}.
19
+ */
20
+ function isExecuteFailure(value) {
21
+ return value instanceof ExecuteFailure;
22
+ }
23
+ /**
24
+ * Returns whether a value can be serialized through the JSON-only host/guest boundary.
25
+ */
26
+ function isJsonSerializable(value, active = /* @__PURE__ */ new Set(), memo = /* @__PURE__ */ new WeakSet()) {
27
+ if (value === null) return true;
28
+ switch (typeof value) {
29
+ case "string":
30
+ case "boolean": return true;
31
+ case "number": return Number.isFinite(value);
32
+ case "bigint":
33
+ case "function":
34
+ case "symbol":
35
+ case "undefined": return false;
36
+ case "object": {
37
+ const objectValue = value;
38
+ if (memo.has(objectValue)) return true;
39
+ if (active.has(objectValue)) return false;
40
+ active.add(objectValue);
41
+ let isSerializable = false;
42
+ try {
43
+ if (Array.isArray(value)) {
44
+ isSerializable = value.every((item) => isJsonSerializable(item, active, memo));
45
+ return isSerializable;
46
+ }
47
+ const prototype = Object.getPrototypeOf(value);
48
+ if (prototype !== Object.prototype && prototype !== null) return false;
49
+ isSerializable = Object.values(value).every((item) => isJsonSerializable(item, active, memo));
50
+ return isSerializable;
51
+ } finally {
52
+ active.delete(objectValue);
53
+ if (isSerializable) memo.add(objectValue);
54
+ }
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+
60
+ //#endregion
61
+ Object.defineProperty(exports, 'ExecuteFailure', {
62
+ enumerable: true,
63
+ get: function () {
64
+ return ExecuteFailure;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, 'isExecuteFailure', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return isExecuteFailure;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, 'isJsonSerializable', {
74
+ enumerable: true,
75
+ get: function () {
76
+ return isJsonSerializable;
77
+ }
78
+ });
79
+ //# sourceMappingURL=errors-CTel18cM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CTel18cM.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import type { ExecuteErrorCode } from \"./types\";\n\n/**\n * Structured failure used internally to propagate executor and tool errors.\n */\nexport class ExecuteFailure extends Error {\n code: ExecuteErrorCode;\n\n /**\n * Creates a structured failure with a trusted executor or tool error code.\n */\n constructor(code: ExecuteErrorCode, message: string) {\n super(message);\n this.code = code;\n this.name = \"ExecuteFailure\";\n }\n}\n\n/**\n * Returns whether a thrown value is an {@link ExecuteFailure}.\n */\nexport function isExecuteFailure(value: unknown): value is ExecuteFailure {\n return value instanceof ExecuteFailure;\n}\n\n/**\n * Returns whether a value can be serialized through the JSON-only host/guest boundary.\n */\nexport function isJsonSerializable(\n value: unknown,\n active = new Set<object>(),\n memo = new WeakSet<object>(),\n): boolean {\n if (value === null) {\n return true;\n }\n\n switch (typeof value) {\n case \"string\":\n case \"boolean\":\n return true;\n case \"number\":\n return Number.isFinite(value);\n case \"bigint\":\n case \"function\":\n case \"symbol\":\n case \"undefined\":\n return false;\n case \"object\": {\n const objectValue = value as object;\n\n if (memo.has(objectValue)) {\n return true;\n }\n\n if (active.has(objectValue)) {\n return false;\n }\n\n active.add(objectValue);\n let isSerializable = false;\n\n try {\n if (Array.isArray(value)) {\n isSerializable = value.every((item) =>\n isJsonSerializable(item, active, memo),\n );\n return isSerializable;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return false;\n }\n\n isSerializable = Object.values(value).every((item) =>\n isJsonSerializable(item, active, memo),\n );\n return isSerializable;\n } finally {\n active.delete(objectValue);\n if (isSerializable) {\n memo.add(objectValue);\n }\n }\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;AAKA,IAAa,iBAAb,cAAoC,MAAM;CACxC;;;;CAKA,YAAY,MAAwB,SAAiB;AACnD,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;;AAOhB,SAAgB,iBAAiB,OAAyC;AACxE,QAAO,iBAAiB;;;;;AAM1B,SAAgB,mBACd,OACA,yBAAS,IAAI,KAAa,EAC1B,uBAAO,IAAI,SAAiB,EACnB;AACT,KAAI,UAAU,KACZ,QAAO;AAGT,SAAQ,OAAO,OAAf;EACE,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,SACH,QAAO,OAAO,SAAS,MAAM;EAC/B,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,YACH,QAAO;EACT,KAAK,UAAU;GACb,MAAM,cAAc;AAEpB,OAAI,KAAK,IAAI,YAAY,CACvB,QAAO;AAGT,OAAI,OAAO,IAAI,YAAY,CACzB,QAAO;AAGT,UAAO,IAAI,YAAY;GACvB,IAAI,iBAAiB;AAErB,OAAI;AACF,QAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,sBAAiB,MAAM,OAAO,SAC5B,mBAAmB,MAAM,QAAQ,KAAK,CACvC;AACD,YAAO;;IAGT,MAAM,YAAY,OAAO,eAAe,MAAM;AAC9C,QAAI,cAAc,OAAO,aAAa,cAAc,KAClD,QAAO;AAGT,qBAAiB,OAAO,OAAO,MAAM,CAAC,OAAO,SAC3C,mBAAmB,MAAM,QAAQ,KAAK,CACvC;AACD,WAAO;aACC;AACR,WAAO,OAAO,YAAY;AAC1B,QAAI,eACF,MAAK,IAAI,YAAY;;;;AAM7B,QAAO"}
@@ -0,0 +1,61 @@
1
+ //#region src/errors.ts
2
+ /**
3
+ * Structured failure used internally to propagate executor and tool errors.
4
+ */
5
+ var ExecuteFailure = class extends Error {
6
+ code;
7
+ /**
8
+ * Creates a structured failure with a trusted executor or tool error code.
9
+ */
10
+ constructor(code, message) {
11
+ super(message);
12
+ this.code = code;
13
+ this.name = "ExecuteFailure";
14
+ }
15
+ };
16
+ /**
17
+ * Returns whether a thrown value is an {@link ExecuteFailure}.
18
+ */
19
+ function isExecuteFailure(value) {
20
+ return value instanceof ExecuteFailure;
21
+ }
22
+ /**
23
+ * Returns whether a value can be serialized through the JSON-only host/guest boundary.
24
+ */
25
+ function isJsonSerializable(value, active = /* @__PURE__ */ new Set(), memo = /* @__PURE__ */ new WeakSet()) {
26
+ if (value === null) return true;
27
+ switch (typeof value) {
28
+ case "string":
29
+ case "boolean": return true;
30
+ case "number": return Number.isFinite(value);
31
+ case "bigint":
32
+ case "function":
33
+ case "symbol":
34
+ case "undefined": return false;
35
+ case "object": {
36
+ const objectValue = value;
37
+ if (memo.has(objectValue)) return true;
38
+ if (active.has(objectValue)) return false;
39
+ active.add(objectValue);
40
+ let isSerializable = false;
41
+ try {
42
+ if (Array.isArray(value)) {
43
+ isSerializable = value.every((item) => isJsonSerializable(item, active, memo));
44
+ return isSerializable;
45
+ }
46
+ const prototype = Object.getPrototypeOf(value);
47
+ if (prototype !== Object.prototype && prototype !== null) return false;
48
+ isSerializable = Object.values(value).every((item) => isJsonSerializable(item, active, memo));
49
+ return isSerializable;
50
+ } finally {
51
+ active.delete(objectValue);
52
+ if (isSerializable) memo.add(objectValue);
53
+ }
54
+ }
55
+ }
56
+ return false;
57
+ }
58
+
59
+ //#endregion
60
+ export { isExecuteFailure as n, isJsonSerializable as r, ExecuteFailure as t };
61
+ //# sourceMappingURL=errors-CgBwm39w.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CgBwm39w.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import type { ExecuteErrorCode } from \"./types\";\n\n/**\n * Structured failure used internally to propagate executor and tool errors.\n */\nexport class ExecuteFailure extends Error {\n code: ExecuteErrorCode;\n\n /**\n * Creates a structured failure with a trusted executor or tool error code.\n */\n constructor(code: ExecuteErrorCode, message: string) {\n super(message);\n this.code = code;\n this.name = \"ExecuteFailure\";\n }\n}\n\n/**\n * Returns whether a thrown value is an {@link ExecuteFailure}.\n */\nexport function isExecuteFailure(value: unknown): value is ExecuteFailure {\n return value instanceof ExecuteFailure;\n}\n\n/**\n * Returns whether a value can be serialized through the JSON-only host/guest boundary.\n */\nexport function isJsonSerializable(\n value: unknown,\n active = new Set<object>(),\n memo = new WeakSet<object>(),\n): boolean {\n if (value === null) {\n return true;\n }\n\n switch (typeof value) {\n case \"string\":\n case \"boolean\":\n return true;\n case \"number\":\n return Number.isFinite(value);\n case \"bigint\":\n case \"function\":\n case \"symbol\":\n case \"undefined\":\n return false;\n case \"object\": {\n const objectValue = value as object;\n\n if (memo.has(objectValue)) {\n return true;\n }\n\n if (active.has(objectValue)) {\n return false;\n }\n\n active.add(objectValue);\n let isSerializable = false;\n\n try {\n if (Array.isArray(value)) {\n isSerializable = value.every((item) =>\n isJsonSerializable(item, active, memo),\n );\n return isSerializable;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return false;\n }\n\n isSerializable = Object.values(value).every((item) =>\n isJsonSerializable(item, active, memo),\n );\n return isSerializable;\n } finally {\n active.delete(objectValue);\n if (isSerializable) {\n memo.add(objectValue);\n }\n }\n }\n }\n\n return false;\n}\n"],"mappings":";;;;AAKA,IAAa,iBAAb,cAAoC,MAAM;CACxC;;;;CAKA,YAAY,MAAwB,SAAiB;AACnD,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;;AAOhB,SAAgB,iBAAiB,OAAyC;AACxE,QAAO,iBAAiB;;;;;AAM1B,SAAgB,mBACd,OACA,yBAAS,IAAI,KAAa,EAC1B,uBAAO,IAAI,SAAiB,EACnB;AACT,KAAI,UAAU,KACZ,QAAO;AAGT,SAAQ,OAAO,OAAf;EACE,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,SACH,QAAO,OAAO,SAAS,MAAM;EAC/B,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,YACH,QAAO;EACT,KAAK,UAAU;GACb,MAAM,cAAc;AAEpB,OAAI,KAAK,IAAI,YAAY,CACvB,QAAO;AAGT,OAAI,OAAO,IAAI,YAAY,CACzB,QAAO;AAGT,UAAO,IAAI,YAAY;GACvB,IAAI,iBAAiB;AAErB,OAAI;AACF,QAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,sBAAiB,MAAM,OAAO,SAC5B,mBAAmB,MAAM,QAAQ,KAAK,CACvC;AACD,YAAO;;IAGT,MAAM,YAAY,OAAO,eAAe,MAAM;AAC9C,QAAI,cAAc,OAAO,aAAa,cAAc,KAClD,QAAO;AAGT,qBAAiB,OAAO,OAAO,MAAM,CAAC,OAAO,SAC3C,mBAAmB,MAAM,QAAQ,KAAK,CACvC;AACD,WAAO;aACC;AACR,WAAO,OAAO,YAAY;AAC1B,QAAI,eACF,MAAK,IAAI,YAAY;;;;AAM7B,QAAO"}
@@ -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-CbC-ncVb.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-B-Qe_q5_.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor-B-Qe_q5_.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"}
@@ -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-BJu1lZFi.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-C7YjuD7r.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor-C7YjuD7r.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"}
package/dist/index.cjs CHANGED
@@ -1,114 +1,8 @@
1
- const require_resolveProvider = require('./resolveProvider-CixOjPKp.cjs');
1
+ const require_resolveProvider = require('./resolveProvider-D__uEvDj.cjs');
2
+ const require_runner = require('./runner-Dt--9M2r.cjs');
3
+ const require_errors = require('./errors-CTel18cM.cjs');
2
4
  let acorn = require("acorn");
3
5
 
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
6
  //#region src/normalize.ts
113
7
  function stripCodeFences(source) {
114
8
  const match = source.match(/^\s*```[^\n]*\n([\s\S]*?)\n?```\s*$/);
@@ -153,90 +47,26 @@ function normalizeCode(source) {
153
47
  }
154
48
 
155
49
  //#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;
50
+ exports.ExecuteFailure = require_errors.ExecuteFailure;
221
51
  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;
52
+ exports.createExecutionContext = require_runner.createExecutionContext;
53
+ exports.createTimeoutExecuteResult = require_runner.createTimeoutExecuteResult;
54
+ exports.createToolCallDispatcher = require_runner.createToolCallDispatcher;
55
+ exports.extractProviderManifests = require_runner.extractProviderManifests;
56
+ exports.formatConsoleLine = require_runner.formatConsoleLine;
227
57
  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;
58
+ exports.getExecutionTimeoutMessage = require_runner.getExecutionTimeoutMessage;
59
+ exports.isExecuteFailure = require_errors.isExecuteFailure;
60
+ exports.isJsonSerializable = require_errors.isJsonSerializable;
61
+ exports.isKnownExecuteErrorCode = require_runner.isKnownExecuteErrorCode;
232
62
  exports.isReservedWord = require_resolveProvider.isReservedWord;
233
63
  exports.isValidIdentifier = require_resolveProvider.isValidIdentifier;
234
64
  exports.normalizeCode = normalizeCode;
235
- exports.normalizeThrownMessage = normalizeThrownMessage;
236
- exports.normalizeThrownName = normalizeThrownName;
65
+ exports.normalizeThrownMessage = require_runner.normalizeThrownMessage;
66
+ exports.normalizeThrownName = require_runner.normalizeThrownName;
237
67
  exports.resolveProvider = require_resolveProvider.resolveProvider;
238
68
  exports.sanitizeIdentifier = require_resolveProvider.sanitizeIdentifier;
239
69
  exports.sanitizeToolName = require_resolveProvider.sanitizeToolName;
240
70
  exports.serializePropertyName = require_resolveProvider.serializePropertyName;
241
- exports.truncateLogs = truncateLogs;
71
+ exports.truncateLogs = require_runner.truncateLogs;
242
72
  //# sourceMappingURL=index.cjs.map
@@ -1 +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;E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M,KAAK;AAExC,MAAI,CAAC,YAAY,CAAC,WAChB,QAAO;GACL,OAAO;IACL,MAAM;IACN,SAAS,gBAAgB,KAAK,aAAa,GAAG,KAAK;IACpD;GACD,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"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/normalize.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"],"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"}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,11 @@
1
- import { _ as ToolDescriptor, a as ProviderManifest, b as ToolSchema, c as ToolCallResult, d as ExecuteError, f as ExecuteErrorCode, g as ResolvedToolProvider, h as ResolvedToolDescriptor, i as ExecutorRuntimeOptions, l as createToolCallDispatcher, m as JsonSchema, n as ExecutorPoolOptions, o as ProviderToolManifest, p as ExecuteResult, r as ExecutionOptions, s as ToolCall, t as Executor, u as extractProviderManifests, v as ToolExecutionContext, x as TypegenToolDescriptor, y as ToolProvider } from "./executor-CLQwhiIE.cjs";
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-BJu1lZFi.cjs";
6
+ import { n as ExecutorPoolOptions, t as Executor } from "./executor-C7YjuD7r.cjs";
2
7
 
3
8
  //#region src/executor/shared.d.ts
4
-
5
9
  /**
6
10
  * Returns whether the value is one of execbox's stable execution error codes.
7
11
  */
@@ -1 +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,EAAgB,OAAA;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,CHsBJ,IAAA,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"}
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":";;;;;;;;;;;AAyBgB,OAAA,CAAA,QAAA,CAAA,uBAAA,CAEJ,KAAA,CAAA,CAAA,OAAgB,CAAA,CAAA,CAAA,KAAA,CAAA,EAAA,CAAhB,gBAAgB;AAO5B,CAAA,CAAA;AAOA,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAAA,CAAA,OAAA,CAAA,OAAA,CAAA,IAAA,CAAA,MAAA,CAAA,QAAA,CAAA,eAAA;AAeA,CAAA,CAAA;AAkBgB,OAAA,CAAA,QAAA,CAxCA,0BAAA,CAAA,CAwCmB,CAAA,CAAA,MAAA;AAkBnC,CAAA,CAAA;AAiBA,CAAA,CAAA,CAA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A,CAAA;AAYgB,OAAA,CAAA,QAAA,CG3DA,kBAAA,CH2DkB,KAAA,CAAA,CAAA,OAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CGzD1B,GHyD0B,CAAA,MAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CGxD5B,OHwD4B,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,OAAA;;;;;;AD9DlB,OAAA,CAAA,QAAA,CKmBA,eAAA,CLnBuB,QAE3B,CAAA,CKiB8B,YLjBd,CAAA,CAAA,CKiB6B,oBLjB7B;;;AAc5B,CAAA,CAAA;AAeA,CAAA,CAAA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,IAAA,CAAA,OAAA;AAkBA,CAAA,CAAA;AAkBgB,OAAA,CAAA,QAAA,CMYA,2BAAA,CNXN,YAIP,CAAA,CAAA,MAAA,CAAA,CAAoB,KAAA,CAAA,CMSd,MNTc,CAAA,MAAA,CAAA,CMSC,qBNTD,CAAA,CAAA,CAAA,CAAA,MAAA"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- import { _ as ToolDescriptor, a as ProviderManifest, b as ToolSchema, c as ToolCallResult, d as ExecuteError, f as ExecuteErrorCode, g as ResolvedToolProvider, h as ResolvedToolDescriptor, i as ExecutorRuntimeOptions, l as createToolCallDispatcher, m as JsonSchema, n as ExecutorPoolOptions, o as ProviderToolManifest, p as ExecuteResult, r as ExecutionOptions, s as ToolCall, t as Executor, u as extractProviderManifests, v as ToolExecutionContext, x as TypegenToolDescriptor, y as ToolProvider } from "./executor-B_S-ZRgM.js";
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-CbC-ncVb.js";
6
+ import { n as ExecutorPoolOptions, t as Executor } from "./executor-B-Qe_q5_.js";
2
7
 
3
8
  //#region src/executor/shared.d.ts
4
-
5
9
  /**
6
10
  * Returns whether the value is one of execbox's stable execution error codes.
7
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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"}
1
+ {"version":3,"file":"index.d.ts","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":";;;;;;;;;;;AAyBgB,OAAA,CAAA,QAAA,CAAA,uBAAA,CAEJ,KAAA,CAAA,CAAA,OAAgB,CAAA,CAAA,CAAA,KAAA,CAAA,EAAA,CAAhB,gBAAgB;AAO5B,CAAA,CAAA;AAOA,CAAA,CAAA,CAAA,OAAA,CAAA,GAAA,CAAA,MAA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