@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/README.md
CHANGED
|
@@ -9,18 +9,16 @@ Core execution contract for execbox. Use it to resolve host tools into callable
|
|
|
9
9
|
## Use `@execbox/core` When
|
|
10
10
|
|
|
11
11
|
- you want to expose host capabilities to guest code through explicit tool providers
|
|
12
|
-
- you want one execution contract across
|
|
12
|
+
- you want one execution contract across inline and worker-hosted QuickJS
|
|
13
13
|
- you want to wrap MCP servers or clients into callable namespaces instead of exposing raw tool loops
|
|
14
14
|
|
|
15
15
|
## Pair It With an Executor
|
|
16
16
|
|
|
17
17
|
`@execbox/core` defines the provider and tool boundary, but it does not execute guest code on its own.
|
|
18
18
|
|
|
19
|
-
| Package
|
|
20
|
-
|
|
|
21
|
-
| [`@execbox/quickjs`](https://www.npmjs.com/package/@execbox/quickjs)
|
|
22
|
-
| [`@execbox/remote`](https://www.npmjs.com/package/@execbox/remote) | Your runtime already lives behind an application-owned transport boundary. |
|
|
23
|
-
| [`@execbox/isolated-vm`](https://www.npmjs.com/package/@execbox/isolated-vm) | You explicitly want the `isolated-vm` runtime and can support its constraints. |
|
|
19
|
+
| Package | Start here when |
|
|
20
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
21
|
+
| [`@execbox/quickjs`](https://www.npmjs.com/package/@execbox/quickjs) | You want the default path with inline or worker-hosted QuickJS. |
|
|
24
22
|
|
|
25
23
|
## Install
|
|
26
24
|
|
|
@@ -30,7 +28,12 @@ Most users start with QuickJS:
|
|
|
30
28
|
npm install @execbox/core @execbox/quickjs
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
## Runtime Implementer Surface
|
|
32
|
+
|
|
33
|
+
Most application code can skip this section.
|
|
34
|
+
|
|
35
|
+
Application code should usually import from `@execbox/core` or `@execbox/core/mcp`.
|
|
36
|
+
The `@execbox/core/protocol` and `@execbox/core/runtime` subpaths exist for execbox-owned runtime packages. `@execbox/core/protocol` carries the worker-hosted QuickJS message contract, while `@execbox/core/runtime` contains the manifest dispatcher, runtime option defaults, timeout helpers, log formatting, code normalization, and error normalization used to keep runtime implementations aligned.
|
|
34
37
|
|
|
35
38
|
## Smallest Working Usage
|
|
36
39
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Public TypeScript declarations for this package entrypoint.
|
|
4
|
+
*/
|
|
5
|
+
import { u as ExecuteErrorCode } from "./runner-DSgvu6Ad.cjs";
|
|
6
|
+
|
|
7
|
+
//#region src/errors.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Structured failure used internally to propagate executor and tool errors.
|
|
11
|
+
*/
|
|
12
|
+
declare class ExecuteFailure extends Error {
|
|
13
|
+
code: ExecuteErrorCode;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a structured failure with a trusted executor or tool error code.
|
|
16
|
+
*/
|
|
17
|
+
constructor(code: ExecuteErrorCode, message: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
21
|
+
*/
|
|
22
|
+
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
23
|
+
/**
|
|
24
|
+
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
25
|
+
*/
|
|
26
|
+
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { isExecuteFailure as n, isJsonSerializable as r, ExecuteFailure as t };
|
|
29
|
+
//# sourceMappingURL=errors-B9ADBuDH.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-B9ADBuDH.d.cts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAKA,CAAA,CAAA;AACQ,OAAA,CAAA,KAAA,CADK,cAAA,CAAA,OAAA,CAAuB,KAAA,CAC5B;EAKY,IAAA,CAAA,CALZ,gBAKY;EANgB,CAAA,CAAA;;AAgBpC,CAAA,CAAA,CAAA,CAAA;EAOgB,WAAA,CAAA,IAAA,CAAA,CAjBI,gBAmBZ,CAAA,CAAA,OACF,CAAA,CAAA,MAAA,CAAA;;;;;iBAVU,gBAAA,2BAA2C;;;;iBAO3C,kBAAA,0BAER,oBACF"}
|
|
@@ -58,4 +58,4 @@ function isJsonSerializable(value, active = /* @__PURE__ */ new Set(), memo = /*
|
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
60
|
export { isExecuteFailure as n, isJsonSerializable as r, ExecuteFailure as t };
|
|
61
|
-
//# sourceMappingURL=errors-
|
|
61
|
+
//# sourceMappingURL=errors-DdWVEGU8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-DdWVEGU8.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 { u as ExecuteErrorCode } from "./runner-ClFrFnz9.js";
|
|
6
|
+
|
|
7
|
+
//#region src/errors.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Structured failure used internally to propagate executor and tool errors.
|
|
11
|
+
*/
|
|
12
|
+
declare class ExecuteFailure extends Error {
|
|
13
|
+
code: ExecuteErrorCode;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a structured failure with a trusted executor or tool error code.
|
|
16
|
+
*/
|
|
17
|
+
constructor(code: ExecuteErrorCode, message: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether a thrown value is an {@link ExecuteFailure}.
|
|
21
|
+
*/
|
|
22
|
+
declare function isExecuteFailure(value: unknown): value is ExecuteFailure;
|
|
23
|
+
/**
|
|
24
|
+
* Returns whether a value can be serialized through the JSON-only host/guest boundary.
|
|
25
|
+
*/
|
|
26
|
+
declare function isJsonSerializable(value: unknown, active?: Set<object>, memo?: WeakSet<object>): boolean;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { isExecuteFailure as n, isJsonSerializable as r, ExecuteFailure as t };
|
|
29
|
+
//# sourceMappingURL=errors-DlbJQYs7.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-DlbJQYs7.d.ts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAKA,CAAA,CAAA;AACQ,OAAA,CAAA,KAAA,CADK,cAAA,CAAA,OAAA,CAAuB,KAAA,CAC5B;EAKY,IAAA,CAAA,CALZ,gBAKY;EANgB,CAAA,CAAA;;AAgBpC,CAAA,CAAA,CAAA,CAAA;EAOgB,WAAA,CAAA,IAAA,CAAA,CAjBI,gBAmBZ,CAAA,CAAA,OACF,CAAA,CAAA,MAAA,CAAA;;;;;iBAVU,gBAAA,2BAA2C;;;;iBAO3C,kBAAA,0BAER,oBACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-xD8r6fCf.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"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { d as ExecuteResult, m as ResolvedToolProvider, t as ExecutionOptions } from "./runner-
|
|
5
|
+
import { d as ExecuteResult, m as ResolvedToolProvider, t as ExecutionOptions } from "./runner-ClFrFnz9.js";
|
|
6
6
|
|
|
7
7
|
//#region src/executor/executor.d.ts
|
|
8
8
|
|
|
@@ -26,4 +26,4 @@ interface Executor {
|
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ExecutorPoolOptions as n, Executor as t };
|
|
29
|
-
//# sourceMappingURL=executor-
|
|
29
|
+
//# sourceMappingURL=executor-B7q7K_27.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-
|
|
1
|
+
{"version":3,"file":"executor-B7q7K_27.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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-
|
|
1
|
+
{"version":3,"file":"executor-BsE5nF-j.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,27 +1,6 @@
|
|
|
1
|
-
const require_resolveProvider = require('./resolveProvider-
|
|
2
|
-
const
|
|
3
|
-
const require_normalize = require('./normalize-B80ZCnxe.cjs');
|
|
4
|
-
const require_errors = require('./errors-BGSgVV40.cjs');
|
|
1
|
+
const require_resolveProvider = require('./resolveProvider-CszBWDOY.cjs');
|
|
2
|
+
const require_errors = require('./errors-xD8r6fCf.cjs');
|
|
5
3
|
|
|
6
4
|
exports.ExecuteFailure = require_errors.ExecuteFailure;
|
|
7
|
-
exports.assertValidIdentifier = require_resolveProvider.assertValidIdentifier;
|
|
8
|
-
exports.createExecutionContext = require_runner.createExecutionContext;
|
|
9
|
-
exports.createTimeoutExecuteResult = require_runner.createTimeoutExecuteResult;
|
|
10
|
-
exports.createToolCallDispatcher = require_runner.createToolCallDispatcher;
|
|
11
|
-
exports.extractProviderManifests = require_runner.extractProviderManifests;
|
|
12
|
-
exports.formatConsoleLine = require_runner.formatConsoleLine;
|
|
13
|
-
exports.generateTypesFromJsonSchema = require_resolveProvider.generateTypesFromJsonSchema;
|
|
14
|
-
exports.getExecutionTimeoutMessage = require_runner.getExecutionTimeoutMessage;
|
|
15
5
|
exports.isExecuteFailure = require_errors.isExecuteFailure;
|
|
16
|
-
exports.
|
|
17
|
-
exports.isKnownExecuteErrorCode = require_runner.isKnownExecuteErrorCode;
|
|
18
|
-
exports.isReservedWord = require_resolveProvider.isReservedWord;
|
|
19
|
-
exports.isValidIdentifier = require_resolveProvider.isValidIdentifier;
|
|
20
|
-
exports.normalizeCode = require_normalize.normalizeCode;
|
|
21
|
-
exports.normalizeThrownMessage = require_runner.normalizeThrownMessage;
|
|
22
|
-
exports.normalizeThrownName = require_runner.normalizeThrownName;
|
|
23
|
-
exports.resolveProvider = require_resolveProvider.resolveProvider;
|
|
24
|
-
exports.sanitizeIdentifier = require_resolveProvider.sanitizeIdentifier;
|
|
25
|
-
exports.sanitizeToolName = require_resolveProvider.sanitizeToolName;
|
|
26
|
-
exports.serializePropertyName = require_resolveProvider.serializePropertyName;
|
|
27
|
-
exports.truncateLogs = require_runner.truncateLogs;
|
|
6
|
+
exports.resolveProvider = require_resolveProvider.resolveProvider;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,49 +2,15 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { _ as ToolProvider,
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
5
|
+
import { _ as ToolProvider, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, h as ToolDescriptor, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, p as ResolvedToolDescriptor, t as ExecutionOptions, u as ExecuteErrorCode, v as ToolSchema } from "./runner-DSgvu6Ad.cjs";
|
|
6
|
+
import { n as ExecutorPoolOptions, t as Executor } from "./executor-BsE5nF-j.cjs";
|
|
7
|
+
import { n as isExecuteFailure, t as ExecuteFailure } from "./errors-B9ADBuDH.cjs";
|
|
8
8
|
|
|
9
|
-
//#region src/identifier.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Returns whether the value is a valid JavaScript identifier.
|
|
12
|
-
*/
|
|
13
|
-
declare function isValidIdentifier(value: string): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Returns whether the identifier is reserved in JavaScript source.
|
|
16
|
-
*/
|
|
17
|
-
declare function isReservedWord(value: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Throws when the value cannot be used as a bare JavaScript identifier.
|
|
20
|
-
*/
|
|
21
|
-
declare function assertValidIdentifier(value: string, label?: string): void;
|
|
22
|
-
/**
|
|
23
|
-
* Converts a raw identifier-like value into a safe JavaScript identifier.
|
|
24
|
-
*/
|
|
25
|
-
declare function sanitizeIdentifier(value: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Renders the name as a bare identifier when possible, otherwise as a string literal.
|
|
28
|
-
*/
|
|
29
|
-
declare function serializePropertyName(name: string): string;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/sanitize.d.ts
|
|
32
|
-
/**
|
|
33
|
-
* Converts a raw tool name into a safe JavaScript identifier.
|
|
34
|
-
*/
|
|
35
|
-
declare function sanitizeToolName(name: string): string;
|
|
36
|
-
//#endregion
|
|
37
9
|
//#region src/provider/resolveProvider.d.ts
|
|
38
10
|
/**
|
|
39
11
|
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
|
40
12
|
*/
|
|
41
13
|
declare function resolveProvider(provider: ToolProvider): ResolvedToolProvider;
|
|
42
14
|
//#endregion
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Generates a namespace declaration for a provider's tool schemas.
|
|
46
|
-
*/
|
|
47
|
-
declare function generateTypesFromJsonSchema(providerName: string, tools: Record<string, TypegenToolDescriptor>): string;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorPoolOptions, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, assertValidIdentifier, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, generateTypesFromJsonSchema, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, isReservedWord, isValidIdentifier, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveProvider, sanitizeIdentifier, sanitizeToolName, serializePropertyName, truncateLogs };
|
|
15
|
+
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorPoolOptions, type ExecutorRuntimeOptions, type JsonSchema, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, isExecuteFailure, resolveProvider };
|
|
50
16
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/provider/resolveProvider.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBA4CgB,eAAA,WAA0B,eAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,49 +2,15 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { _ as ToolProvider,
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
5
|
+
import { _ as ToolProvider, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, h as ToolDescriptor, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, p as ResolvedToolDescriptor, t as ExecutionOptions, u as ExecuteErrorCode, v as ToolSchema } from "./runner-ClFrFnz9.js";
|
|
6
|
+
import { n as ExecutorPoolOptions, t as Executor } from "./executor-B7q7K_27.js";
|
|
7
|
+
import { n as isExecuteFailure, t as ExecuteFailure } from "./errors-DlbJQYs7.js";
|
|
8
8
|
|
|
9
|
-
//#region src/identifier.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Returns whether the value is a valid JavaScript identifier.
|
|
12
|
-
*/
|
|
13
|
-
declare function isValidIdentifier(value: string): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Returns whether the identifier is reserved in JavaScript source.
|
|
16
|
-
*/
|
|
17
|
-
declare function isReservedWord(value: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Throws when the value cannot be used as a bare JavaScript identifier.
|
|
20
|
-
*/
|
|
21
|
-
declare function assertValidIdentifier(value: string, label?: string): void;
|
|
22
|
-
/**
|
|
23
|
-
* Converts a raw identifier-like value into a safe JavaScript identifier.
|
|
24
|
-
*/
|
|
25
|
-
declare function sanitizeIdentifier(value: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Renders the name as a bare identifier when possible, otherwise as a string literal.
|
|
28
|
-
*/
|
|
29
|
-
declare function serializePropertyName(name: string): string;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/sanitize.d.ts
|
|
32
|
-
/**
|
|
33
|
-
* Converts a raw tool name into a safe JavaScript identifier.
|
|
34
|
-
*/
|
|
35
|
-
declare function sanitizeToolName(name: string): string;
|
|
36
|
-
//#endregion
|
|
37
9
|
//#region src/provider/resolveProvider.d.ts
|
|
38
10
|
/**
|
|
39
11
|
* Resolves a tool provider into the validated, sanitized shape consumed by executors.
|
|
40
12
|
*/
|
|
41
13
|
declare function resolveProvider(provider: ToolProvider): ResolvedToolProvider;
|
|
42
14
|
//#endregion
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Generates a namespace declaration for a provider's tool schemas.
|
|
46
|
-
*/
|
|
47
|
-
declare function generateTypesFromJsonSchema(providerName: string, tools: Record<string, TypegenToolDescriptor>): string;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorPoolOptions, type ExecutorRuntimeOptions, type JsonSchema, type ProviderManifest, type ProviderToolManifest, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolCall, type ToolCallResult, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, type TypegenToolDescriptor, assertValidIdentifier, createExecutionContext, createTimeoutExecuteResult, createToolCallDispatcher, extractProviderManifests, formatConsoleLine, generateTypesFromJsonSchema, getExecutionTimeoutMessage, isExecuteFailure, isJsonSerializable, isKnownExecuteErrorCode, isReservedWord, isValidIdentifier, normalizeCode, normalizeThrownMessage, normalizeThrownName, resolveProvider, sanitizeIdentifier, sanitizeToolName, serializePropertyName, truncateLogs };
|
|
15
|
+
export { type ExecuteError, type ExecuteErrorCode, ExecuteFailure, type ExecuteResult, type ExecutionOptions, type Executor, type ExecutorPoolOptions, type ExecutorRuntimeOptions, type JsonSchema, type ResolvedToolDescriptor, type ResolvedToolProvider, type ToolDescriptor, type ToolExecutionContext, type ToolProvider, type ToolSchema, isExecuteFailure, resolveProvider };
|
|
50
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/provider/resolveProvider.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBA4CgB,eAAA,WAA0B,eAAe"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as normalizeCode } from "./normalize-dfQC7HWx.js";
|
|
4
|
-
import { n as isExecuteFailure, r as isJsonSerializable, t as ExecuteFailure } from "./errors-BXpyBhCI.js";
|
|
1
|
+
import { n as isExecuteFailure, t as ExecuteFailure } from "./errors-DdWVEGU8.js";
|
|
2
|
+
import { t as resolveProvider } from "./resolveProvider-Bfj27oYs.js";
|
|
5
3
|
|
|
6
|
-
export { ExecuteFailure,
|
|
4
|
+
export { ExecuteFailure, isExecuteFailure, resolveProvider };
|
package/dist/mcp/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_resolveProvider = require('../resolveProvider-
|
|
2
|
-
require('../errors-
|
|
1
|
+
const require_resolveProvider = require('../resolveProvider-CszBWDOY.cjs');
|
|
2
|
+
require('../errors-xD8r6fCf.cjs');
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
zod = require_resolveProvider.__toESM(zod);
|
|
5
5
|
let __modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
|
package/dist/mcp/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
5
|
import { d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, p as ResolvedToolDescriptor, t as ExecutionOptions, u as ExecuteErrorCode } from "../runner-DSgvu6Ad.cjs";
|
|
6
|
-
import { t as Executor } from "../executor-
|
|
6
|
+
import { t as Executor } from "../executor-BsE5nF-j.cjs";
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
8
|
import { Implementation } from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, p as ResolvedToolDescriptor, t as ExecutionOptions, u as ExecuteErrorCode } from "../runner-
|
|
6
|
-
import { t as Executor } from "../executor-
|
|
5
|
+
import { d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, p as ResolvedToolDescriptor, t as ExecutionOptions, u as ExecuteErrorCode } from "../runner-ClFrFnz9.js";
|
|
6
|
+
import { t as Executor } from "../executor-B7q7K_27.js";
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
8
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
9
9
|
import { Implementation } from "@modelcontextprotocol/sdk/types.js";
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
1
|
+
import "../errors-DdWVEGU8.js";
|
|
2
|
+
import { i as renderNamespaceDeclaration, n as schemaToType, r as renderDocComment, t as resolveProvider } from "../resolveProvider-Bfj27oYs.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
package/dist/protocol/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
require('../
|
|
1
|
+
require('../errors-xD8r6fCf.cjs');
|
|
2
|
+
const require_runner = require('../runner-CsrfDub-.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages.ts
|
|
5
5
|
function isRecord(value) {
|
|
@@ -213,7 +213,7 @@ const SOURCE_MODE_EXEC_ARGV = [
|
|
|
213
213
|
"tsx"
|
|
214
214
|
];
|
|
215
215
|
/**
|
|
216
|
-
* Returns the extra Node flags needed to launch transport-backed
|
|
216
|
+
* Returns the extra Node flags needed to launch transport-backed worker entries
|
|
217
217
|
* directly from source during local development and tests.
|
|
218
218
|
*/
|
|
219
219
|
function getNodeTransportExecArgv(moduleUrl) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getExecutionTimeoutMessage","createToolCallDispatcher","forceTerminateTimer: NodeJS.Timeout | undefined","extractProviderManifests","available: PoolEntry<T>[]","waiters: Array<{\n reject: (error: Error) => void;\n resolve: (lease: ResourcePoolLease<T>) => void;\n }>"],"sources":["../../src/protocol/messages.ts","../../src/protocol/hostSession.ts","../../src/protocol/nodeBootstrap.ts","../../src/protocol/resourcePool.ts"],"sourcesContent":["import type {\n ExecutorRuntimeOptions,\n ProviderManifest,\n ToolCall,\n ToolCallResult,\n} from \"../runner.ts\";\nimport type { ExecuteResult } from \"../types.ts\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value);\n}\n\nfunction isRuntimeOptions(value: unknown): value is ExecutorRuntimeOptions {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n isFiniteNumber(value.maxLogChars) &&\n isFiniteNumber(value.maxLogLines) &&\n isFiniteNumber(value.memoryLimitBytes) &&\n isFiniteNumber(value.timeoutMs)\n );\n}\n\nfunction isProviderManifest(value: unknown): value is ProviderManifest {\n if (!isRecord(value) || typeof value.name !== \"string\") {\n return false;\n }\n\n if (!isRecord(value.tools) || typeof value.types !== \"string\") {\n return false;\n }\n\n return Object.values(value.tools).every(\n (tool) =>\n isRecord(tool) &&\n typeof tool.originalName === \"string\" &&\n typeof tool.safeName === \"string\" &&\n (tool.description === undefined || typeof tool.description === \"string\"),\n );\n}\n\nfunction isExecuteError(\n value: unknown,\n): value is { code: string; message: string } {\n return (\n isRecord(value) &&\n typeof value.code === \"string\" &&\n typeof value.message === \"string\"\n );\n}\n\nfunction isDonePayload(value: unknown): value is DoneMessage {\n if (!isRecord(value) || !isFiniteNumber(value.durationMs)) {\n return false;\n }\n\n if (\n !Array.isArray(value.logs) ||\n !value.logs.every((log) => typeof log === \"string\")\n ) {\n return false;\n }\n\n if (typeof value.ok !== \"boolean\") {\n return false;\n }\n\n return value.ok ? true : isExecuteError(value.error);\n}\n\n/**\n * Message sent from dispatcher to runner to start one execution session.\n */\nexport interface ExecuteMessage {\n code: string;\n id: string;\n options: ExecutorRuntimeOptions;\n providers: ProviderManifest[];\n type: \"execute\";\n}\n\n/**\n * Message sent from dispatcher to request prompt cancellation.\n */\nexport interface CancelMessage {\n id: string;\n type: \"cancel\";\n}\n\n/**\n * Message sent from a runner when guest code invokes a host tool.\n */\nexport interface ToolCallMessage extends ToolCall {\n callId: string;\n type: \"tool_call\";\n}\n\n/**\n * Message carrying a trusted host tool result back to the runner.\n */\nexport type ToolResultMessage = {\n callId: string;\n type: \"tool_result\";\n} & ToolCallResult;\n\n/**\n * Message indicating the runner has finished bootstrapping guest execution timing.\n */\nexport interface StartedMessage {\n id: string;\n type: \"started\";\n}\n\n/**\n * Final successful execution result returned by a runner.\n *\n * Node IPC can omit `undefined` fields during serialization, so `result`\n * remains optional at the protocol boundary and is normalized by the host.\n */\nexport type DoneSuccessMessage<T = unknown> = {\n durationMs: number;\n id: string;\n logs: string[];\n ok: true;\n result?: T;\n type: \"done\";\n};\n\n/**\n * Final failed execution result returned by a runner.\n */\nexport type DoneFailureMessage = {\n id: string;\n type: \"done\";\n} & Extract<ExecuteResult, { ok: false }>;\n\n/**\n * Final execution result returned by a runner.\n */\nexport type DoneMessage = DoneSuccessMessage | DoneFailureMessage;\n\n/**\n * Messages accepted by a runner transport endpoint.\n */\nexport type DispatcherMessage =\n | CancelMessage\n | ExecuteMessage\n | ToolResultMessage;\n\n/**\n * Messages emitted by a runner transport endpoint.\n */\nexport type RunnerMessage = DoneMessage | StartedMessage | ToolCallMessage;\n\n/**\n * Returns whether an unknown value is a dispatcher-to-runner message.\n */\nexport function isDispatcherMessage(\n value: unknown,\n): value is DispatcherMessage {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n switch (value.type) {\n case \"cancel\":\n return typeof value.id === \"string\";\n case \"execute\":\n return (\n typeof value.code === \"string\" &&\n typeof value.id === \"string\" &&\n isRuntimeOptions(value.options) &&\n Array.isArray(value.providers) &&\n value.providers.every(isProviderManifest)\n );\n case \"tool_result\":\n if (typeof value.callId !== \"string\" || typeof value.ok !== \"boolean\") {\n return false;\n }\n\n if (value.ok) {\n return \"result\" in value;\n }\n\n return isExecuteError(value.error);\n default:\n return false;\n }\n}\n\n/**\n * Returns whether an unknown value is a runner-to-dispatcher message.\n */\nexport function isRunnerMessage(value: unknown): value is RunnerMessage {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n switch (value.type) {\n case \"started\":\n return typeof value.id === \"string\";\n case \"tool_call\":\n return (\n typeof value.callId === \"string\" &&\n typeof value.providerName === \"string\" &&\n typeof value.safeToolName === \"string\" &&\n \"input\" in value\n );\n case \"done\":\n return typeof value.id === \"string\" && isDonePayload(value);\n default:\n return false;\n }\n}\n","import {\n createToolCallDispatcher,\n extractProviderManifests,\n type ExecutorRuntimeOptions,\n} from \"../runner.ts\";\nimport { getExecutionTimeoutMessage } from \"../executor/shared.ts\";\nimport type { ExecuteResult, ResolvedToolProvider } from \"../types.ts\";\n\nimport type {\n DispatcherMessage,\n DoneMessage,\n RunnerMessage,\n ToolCallMessage,\n} from \"./messages.ts\";\nimport { isRunnerMessage } from \"./messages.ts\";\n\nconst DEFAULT_CANCEL_GRACE_MS = 25;\nconst HOST_TIMEOUT_BACKSTOP_MS = 100;\n\n/**\n * Describes an unexpected transport shutdown reported to the host session.\n */\nexport interface TransportCloseReason {\n code?: number | null;\n message: string;\n signal?: NodeJS.Signals | null;\n}\n\n/**\n * Minimal parent-side transport contract for worker/process-backed execution.\n */\nexport interface HostTransport {\n dispose(): Promise<void> | void;\n onClose(handler: (reason?: TransportCloseReason) => void): () => void;\n onError(handler: (error: Error) => void): () => void;\n onMessage(handler: (message: RunnerMessage) => void): () => void;\n send(message: DispatcherMessage): Promise<void> | void;\n terminate(): Promise<void> | void;\n}\n\n/**\n * Configuration for one transport-backed execution session.\n */\nexport interface HostTransportSessionOptions {\n cancelGraceMs?: number;\n code: string;\n executionId: string;\n onSettled?: (result: ExecuteResult) => Promise<void> | void;\n providers: ResolvedToolProvider[];\n runtimeOptions: Required<ExecutorRuntimeOptions>;\n signal?: AbortSignal;\n transport: HostTransport;\n}\n\nfunction toFailureResult(\n startedAt: number,\n timeoutTriggered: boolean,\n message: string,\n): ExecuteResult {\n return {\n durationMs: Date.now() - startedAt,\n error: {\n code: timeoutTriggered ? \"timeout\" : \"internal_error\",\n message: timeoutTriggered ? getExecutionTimeoutMessage() : message,\n },\n logs: [],\n ok: false,\n };\n}\n\nfunction normalizeDoneMessage(message: DoneMessage): ExecuteResult {\n if (!message.ok) {\n return {\n durationMs: message.durationMs,\n error: message.error,\n logs: message.logs,\n ok: false,\n };\n }\n\n return {\n durationMs: message.durationMs,\n logs: message.logs,\n ok: true,\n result: message.result,\n };\n}\n\n/**\n * Runs one host-side transport session, including timeout, cancellation,\n * tool-call dispatch, and result settlement.\n */\nexport async function runHostTransportSession(\n options: HostTransportSessionOptions,\n): Promise<ExecuteResult> {\n const startedAt = Date.now();\n const abortController = new AbortController();\n const dispatchToolCall = createToolCallDispatcher(\n options.providers,\n abortController.signal,\n );\n const abortSignal = options.signal;\n\n return await new Promise<ExecuteResult>((resolve) => {\n let finished = false;\n let timeoutTriggered = false;\n let cancellationStarted = false;\n let forceTerminateTimer: NodeJS.Timeout | undefined;\n const cancelGraceMs = options.cancelGraceMs ?? DEFAULT_CANCEL_GRACE_MS;\n\n const cleanup = () => {\n finished = true;\n abortController.abort();\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n if (forceTerminateTimer) {\n clearTimeout(forceTerminateTimer);\n }\n offClose();\n offError();\n offMessage();\n abortSignal?.removeEventListener(\"abort\", onAbortSignal);\n };\n\n const finish = (result: ExecuteResult) => {\n if (finished) {\n return;\n }\n\n cleanup();\n void Promise.resolve(options.onSettled?.(result))\n .catch(() => {})\n .finally(() => {\n void Promise.resolve(options.transport.dispose()).catch(() => {});\n });\n resolve(result);\n };\n\n const fail = (message: string) => {\n finish(toFailureResult(startedAt, timeoutTriggered, message));\n };\n\n const send = (message: DispatcherMessage) => {\n if (finished) {\n return;\n }\n\n try {\n const pendingSend = options.transport.send(message);\n void Promise.resolve(pendingSend).catch((error) => {\n if (finished) {\n return;\n }\n\n fail(error instanceof Error ? error.message : String(error));\n });\n } catch (error) {\n fail(error instanceof Error ? error.message : String(error));\n }\n };\n\n const startCancellation = () => {\n if (finished || cancellationStarted) {\n return;\n }\n\n cancellationStarted = true;\n timeoutTriggered = true;\n abortController.abort();\n send({\n id: options.executionId,\n type: \"cancel\",\n });\n forceTerminateTimer = setTimeout(() => {\n if (finished) {\n return;\n }\n\n void Promise.resolve(options.transport.terminate())\n .catch(() => {})\n .finally(() => {\n if (finished) {\n return;\n }\n\n finish(\n toFailureResult(startedAt, true, getExecutionTimeoutMessage()),\n );\n });\n }, cancelGraceMs);\n };\n\n const timeoutTimer = setTimeout(() => {\n startCancellation();\n }, options.runtimeOptions.timeoutMs + HOST_TIMEOUT_BACKSTOP_MS);\n\n const onMessage = (message: RunnerMessage) => {\n if (finished) {\n return;\n }\n\n if (!isRunnerMessage(message)) {\n return;\n }\n\n if (\"id\" in message && message.id !== options.executionId) {\n return;\n }\n\n if (message.type === \"started\") {\n return;\n }\n\n if (message.type === \"tool_call\") {\n void dispatchToolCall(message as ToolCallMessage)\n .then((result) => {\n send({\n ...result,\n callId: message.callId,\n type: \"tool_result\",\n });\n })\n .catch((error) => {\n send({\n callId: message.callId,\n error: {\n code: \"internal_error\",\n message: error instanceof Error ? error.message : String(error),\n },\n ok: false,\n type: \"tool_result\",\n });\n });\n return;\n }\n\n finish(normalizeDoneMessage(message));\n };\n\n const onError = (error: Error) => {\n fail(error.message);\n };\n\n const onClose = (reason?: TransportCloseReason) => {\n fail(reason?.message ?? \"Transport closed unexpectedly\");\n };\n\n const onAbortSignal = () => {\n startCancellation();\n };\n\n const offMessage = options.transport.onMessage(onMessage);\n const offError = options.transport.onError(onError);\n const offClose = options.transport.onClose(onClose);\n abortSignal?.addEventListener(\"abort\", onAbortSignal, { once: true });\n\n if (abortSignal?.aborted) {\n startCancellation();\n return;\n }\n\n send({\n code: options.code,\n id: options.executionId,\n options: options.runtimeOptions,\n providers: extractProviderManifests(options.providers),\n type: \"execute\",\n });\n });\n}\n","const SOURCE_MODE_EXEC_ARGV = [\"--conditions=source\", \"--import\", \"tsx\"];\n\n/**\n * Returns the extra Node flags needed to launch transport-backed child entries\n * directly from source during local development and tests.\n */\nexport function getNodeTransportExecArgv(\n moduleUrl: string,\n): string[] | undefined {\n return moduleUrl.endsWith(\".ts\") ? [...SOURCE_MODE_EXEC_ARGV] : undefined;\n}\n","/**\n * One checked-out pooled resource plus its release hook.\n */\nexport interface ResourcePoolLease<T> {\n release(reusable?: boolean): Promise<void>;\n value: T;\n}\n\n/**\n * Configuration for a reusable async resource pool.\n */\nexport interface ResourcePoolOptions<T> {\n create: () => Promise<T> | T;\n destroy: (value: T) => Promise<void> | void;\n idleTimeoutMs?: number;\n maxSize: number;\n minSize?: number;\n}\n\n/**\n * Minimal async pool contract used by the pooled executors.\n */\nexport interface ResourcePool<T> {\n acquire(): Promise<ResourcePoolLease<T>>;\n dispose(): Promise<void>;\n prewarm(count?: number): Promise<void>;\n}\n\ninterface PoolEntry<T> {\n idleTimer: NodeJS.Timeout | undefined;\n value: T;\n}\n\nfunction clampTarget(value: number, maxSize: number): number {\n return Math.max(0, Math.min(value, maxSize));\n}\n\n/**\n * Creates a bounded async resource pool with optional idle eviction.\n */\nexport function createResourcePool<T>(\n options: ResourcePoolOptions<T>,\n): ResourcePool<T> {\n const available: PoolEntry<T>[] = [];\n const waiters: Array<{\n reject: (error: Error) => void;\n resolve: (lease: ResourcePoolLease<T>) => void;\n }> = [];\n const inUse = new Set<PoolEntry<T>>();\n let disposed = false;\n let totalSize = 0;\n\n const minSize = clampTarget(options.minSize ?? 0, options.maxSize);\n\n const createEntry = async (): Promise<PoolEntry<T>> => {\n totalSize += 1;\n\n try {\n return {\n idleTimer: undefined,\n value: await options.create(),\n };\n } catch (error) {\n totalSize -= 1;\n throw error;\n }\n };\n\n const removeAvailableEntry = (entry: PoolEntry<T>): void => {\n const index = available.indexOf(entry);\n\n if (index >= 0) {\n available.splice(index, 1);\n }\n };\n\n const clearIdleTimer = (entry: PoolEntry<T>): void => {\n if (entry.idleTimer) {\n clearTimeout(entry.idleTimer);\n entry.idleTimer = undefined;\n }\n };\n\n const queueAvailableEntry = (entry: PoolEntry<T>): void => {\n available.push(entry);\n\n if ((options.idleTimeoutMs ?? 0) > 0) {\n entry.idleTimer = setTimeout(() => {\n if (disposed) {\n return;\n }\n\n if (available.includes(entry) && totalSize > minSize) {\n void destroyEntry(entry);\n }\n }, options.idleTimeoutMs);\n }\n };\n\n const destroyEntry = async (entry: PoolEntry<T>): Promise<void> => {\n clearIdleTimer(entry);\n removeAvailableEntry(entry);\n inUse.delete(entry);\n totalSize -= 1;\n await options.destroy(entry.value);\n };\n\n const leaseEntry = (entry: PoolEntry<T>): ResourcePoolLease<T> => {\n clearIdleTimer(entry);\n removeAvailableEntry(entry);\n inUse.add(entry);\n\n return {\n release: async (reusable = true) => {\n if (!inUse.has(entry)) {\n return;\n }\n\n inUse.delete(entry);\n\n if (disposed || !reusable) {\n await destroyEntry(entry);\n await fillWaiters();\n return;\n }\n\n const waiter = waiters.shift();\n if (waiter) {\n waiter.resolve(leaseEntry(entry));\n return;\n }\n\n queueAvailableEntry(entry);\n },\n value: entry.value,\n };\n };\n\n const fillWaiters = async (): Promise<void> => {\n while (!disposed && waiters.length > 0 && totalSize < options.maxSize) {\n const waiter = waiters.shift();\n if (!waiter) {\n return;\n }\n\n try {\n waiter.resolve(leaseEntry(await createEntry()));\n } catch (error) {\n waiter.reject(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }\n };\n\n return {\n acquire: async () => {\n if (disposed) {\n throw new Error(\"Resource pool is disposed\");\n }\n\n const entry = available.pop();\n if (entry) {\n return leaseEntry(entry);\n }\n\n if (totalSize < options.maxSize) {\n return leaseEntry(await createEntry());\n }\n\n return await new Promise<ResourcePoolLease<T>>((resolve, reject) => {\n waiters.push({ reject, resolve });\n });\n },\n dispose: async () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n\n while (waiters.length > 0) {\n waiters.shift()?.reject(new Error(\"Resource pool is disposed\"));\n }\n\n const idleEntries = [...available];\n available.length = 0;\n await Promise.all(idleEntries.map((entry) => destroyEntry(entry)));\n },\n prewarm: async (count) => {\n if (disposed) {\n throw new Error(\"Resource pool is disposed\");\n }\n\n const target = clampTarget(count ?? minSize, options.maxSize);\n const missing = target - totalSize;\n\n if (missing <= 0) {\n return;\n }\n\n const created = await Promise.all(\n Array.from({ length: missing }, async () => await createEntry()),\n );\n\n for (const entry of created) {\n queueAvailableEntry(entry);\n }\n },\n };\n}\n"],"mappings":";;;;AAQA,SAAS,SAAS,OAAkD;AAClE,QAAO,OAAO,UAAU,YAAY,UAAU;;AAGhD,SAAS,eAAe,OAAiC;AACvD,QAAO,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM;;AAG5D,SAAS,iBAAiB,OAAiD;AACzE,KAAI,CAAC,SAAS,MAAM,CAClB,QAAO;AAGT,QACE,eAAe,MAAM,YAAY,IACjC,eAAe,MAAM,YAAY,IACjC,eAAe,MAAM,iBAAiB,IACtC,eAAe,MAAM,UAAU;;AAInC,SAAS,mBAAmB,OAA2C;AACrE,KAAI,CAAC,SAAS,MAAM,IAAI,OAAO,MAAM,SAAS,SAC5C,QAAO;AAGT,KAAI,CAAC,SAAS,MAAM,MAAM,IAAI,OAAO,MAAM,UAAU,SACnD,QAAO;AAGT,QAAO,OAAO,OAAO,MAAM,MAAM,CAAC,OAC/B,SACC,SAAS,KAAK,IACd,OAAO,KAAK,iBAAiB,YAC7B,OAAO,KAAK,aAAa,aACxB,KAAK,gBAAgB,UAAa,OAAO,KAAK,gBAAgB,UAClE;;AAGH,SAAS,eACP,OAC4C;AAC5C,QACE,SAAS,MAAM,IACf,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,YAAY;;AAI7B,SAAS,cAAc,OAAsC;AAC3D,KAAI,CAAC,SAAS,MAAM,IAAI,CAAC,eAAe,MAAM,W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AAM;AAG1B,OAAI,YAAY,QAAQ,QACtB,QAAO,WAAW,MAAM,aAAa,CAAC;AAGxC,UAAO,MAAM,IAAI,SAA+B,SAAS,WAAW;AAClE,YAAQ,KAAK;KAAE;KAAQ;KAAS,CAAC;KACjC;;EAEJ,SAAS,YAAY;AACnB,OAAI,SACF;AAGF,cAAW;AAEX,UAAO,QAAQ,SAAS,EACtB,SAAQ,OAAO,EAAE,uBAAO,IAAI,MAAM,4BAA4B,CAAC;GAGjE,MAAM,cAAc,CAAC,GAAG,UAAU;AAClC,aAAU,SAAS;AACnB,SAAM,QAAQ,IAAI,YAAY,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;;EAEpE,SAAS,OAAO,UAAU;AACxB,OAAI,SACF,OAAM,IAAI,MAAM,4BAA4B;GAI9C,MAAM,UADS,YAAY,SAAS,SAAS,QAAQ,QAAQ,GACpC;AAEzB,OAAI,WAAW,EACb;GAGF,MAAM,UAAU,MAAM,QAAQ,IAC5B,MAAM,KAAK,EAAE,QAAQ,SAAS,EAAE,YAAY,MAAM,aAAa,CAAC,CACjE;AAED,QAAK,MAAM,SAAS,QAClB,qBAAoB,MAAM;;EAG/B"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getExecutionTimeoutMessage","createToolCallDispatcher","forceTerminateTimer: NodeJS.Timeout | undefined","extractProviderManifests","available: PoolEntry<T>[]","waiters: Array<{\n reject: (error: Error) => void;\n resolve: (lease: ResourcePoolLease<T>) => void;\n }>"],"sources":["../../src/protocol/messages.ts","../../src/protocol/hostSession.ts","../../src/protocol/nodeBootstrap.ts","../../src/protocol/resourcePool.ts"],"sourcesContent":["import type {\n ExecutorRuntimeOptions,\n ProviderManifest,\n ToolCall,\n ToolCallResult,\n} from \"../runner.ts\";\nimport type { ExecuteResult } from \"../types.ts\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value);\n}\n\nfunction isRuntimeOptions(value: unknown): value is ExecutorRuntimeOptions {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n isFiniteNumber(value.maxLogChars) &&\n isFiniteNumber(value.maxLogLines) &&\n isFiniteNumber(value.memoryLimitBytes) &&\n isFiniteNumber(value.timeoutMs)\n );\n}\n\nfunction isProviderManifest(value: unknown): value is ProviderManifest {\n if (!isRecord(value) || typeof value.name !== \"string\") {\n return false;\n }\n\n if (!isRecord(value.tools) || typeof value.types !== \"string\") {\n return false;\n }\n\n return Object.values(value.tools).every(\n (tool) =>\n isRecord(tool) &&\n typeof tool.originalName === \"string\" &&\n typeof tool.safeName === \"string\" &&\n (tool.description === undefined || typeof tool.description === \"string\"),\n );\n}\n\nfunction isExecuteError(\n value: unknown,\n): value is { code: string; message: string } {\n return (\n isRecord(value) &&\n typeof value.code === \"string\" &&\n typeof value.message === \"string\"\n );\n}\n\nfunction isDonePayload(value: unknown): value is DoneMessage {\n if (!isRecord(value) || !isFiniteNumber(value.durationMs)) {\n return false;\n }\n\n if (\n !Array.isArray(value.logs) ||\n !value.logs.every((log) => typeof log === \"string\")\n ) {\n return false;\n }\n\n if (typeof value.ok !== \"boolean\") {\n return false;\n }\n\n return value.ok ? true : isExecuteError(value.error);\n}\n\n/**\n * Message sent from dispatcher to runner to start one execution session.\n */\nexport interface ExecuteMessage {\n code: string;\n id: string;\n options: ExecutorRuntimeOptions;\n providers: ProviderManifest[];\n type: \"execute\";\n}\n\n/**\n * Message sent from dispatcher to request prompt cancellation.\n */\nexport interface CancelMessage {\n id: string;\n type: \"cancel\";\n}\n\n/**\n * Message sent from a runner when guest code invokes a host tool.\n */\nexport interface ToolCallMessage extends ToolCall {\n callId: string;\n type: \"tool_call\";\n}\n\n/**\n * Message carrying a trusted host tool result back to the runner.\n */\nexport type ToolResultMessage = {\n callId: string;\n type: \"tool_result\";\n} & ToolCallResult;\n\n/**\n * Message indicating the runner has finished bootstrapping guest execution timing.\n */\nexport interface StartedMessage {\n id: string;\n type: \"started\";\n}\n\n/**\n * Final successful execution result returned by a runner.\n *\n * Node IPC can omit `undefined` fields during serialization, so `result`\n * remains optional at the protocol boundary and is normalized by the host.\n */\nexport type DoneSuccessMessage<T = unknown> = {\n durationMs: number;\n id: string;\n logs: string[];\n ok: true;\n result?: T;\n type: \"done\";\n};\n\n/**\n * Final failed execution result returned by a runner.\n */\nexport type DoneFailureMessage = {\n id: string;\n type: \"done\";\n} & Extract<ExecuteResult, { ok: false }>;\n\n/**\n * Final execution result returned by a runner.\n */\nexport type DoneMessage = DoneSuccessMessage | DoneFailureMessage;\n\n/**\n * Messages accepted by a runner transport endpoint.\n */\nexport type DispatcherMessage =\n | CancelMessage\n | ExecuteMessage\n | ToolResultMessage;\n\n/**\n * Messages emitted by a runner transport endpoint.\n */\nexport type RunnerMessage = DoneMessage | StartedMessage | ToolCallMessage;\n\n/**\n * Returns whether an unknown value is a dispatcher-to-runner message.\n */\nexport function isDispatcherMessage(\n value: unknown,\n): value is DispatcherMessage {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n switch (value.type) {\n case \"cancel\":\n return typeof value.id === \"string\";\n case \"execute\":\n return (\n typeof value.code === \"string\" &&\n typeof value.id === \"string\" &&\n isRuntimeOptions(value.options) &&\n Array.isArray(value.providers) &&\n value.providers.every(isProviderManifest)\n );\n case \"tool_result\":\n if (typeof value.callId !== \"string\" || typeof value.ok !== \"boolean\") {\n return false;\n }\n\n if (value.ok) {\n return \"result\" in value;\n }\n\n return isExecuteError(value.error);\n default:\n return false;\n }\n}\n\n/**\n * Returns whether an unknown value is a runner-to-dispatcher message.\n */\nexport function isRunnerMessage(value: unknown): value is RunnerMessage {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n switch (value.type) {\n case \"started\":\n return typeof value.id === \"string\";\n case \"tool_call\":\n return (\n typeof value.callId === \"string\" &&\n typeof value.providerName === \"string\" &&\n typeof value.safeToolName === \"string\" &&\n \"input\" in value\n );\n case \"done\":\n return typeof value.id === \"string\" && isDonePayload(value);\n default:\n return false;\n }\n}\n","import {\n createToolCallDispatcher,\n extractProviderManifests,\n type ExecutorRuntimeOptions,\n} from \"../runner.ts\";\nimport { getExecutionTimeoutMessage } from \"../executor/shared.ts\";\nimport type { ExecuteResult, ResolvedToolProvider } from \"../types.ts\";\n\nimport type {\n DispatcherMessage,\n DoneMessage,\n RunnerMessage,\n ToolCallMessage,\n} from \"./messages.ts\";\nimport { isRunnerMessage } from \"./messages.ts\";\n\nconst DEFAULT_CANCEL_GRACE_MS = 25;\nconst HOST_TIMEOUT_BACKSTOP_MS = 100;\n\n/**\n * Describes an unexpected transport shutdown reported to the host session.\n */\nexport interface TransportCloseReason {\n code?: number | null;\n message: string;\n signal?: NodeJS.Signals | null;\n}\n\n/**\n * Minimal parent-side transport contract for transport-backed execution.\n */\nexport interface HostTransport {\n dispose(): Promise<void> | void;\n onClose(handler: (reason?: TransportCloseReason) => void): () => void;\n onError(handler: (error: Error) => void): () => void;\n onMessage(handler: (message: RunnerMessage) => void): () => void;\n send(message: DispatcherMessage): Promise<void> | void;\n terminate(): Promise<void> | void;\n}\n\n/**\n * Configuration for one transport-backed execution session.\n */\nexport interface HostTransportSessionOptions {\n cancelGraceMs?: number;\n code: string;\n executionId: string;\n onSettled?: (result: ExecuteResult) => Promise<void> | void;\n providers: ResolvedToolProvider[];\n runtimeOptions: Required<ExecutorRuntimeOptions>;\n signal?: AbortSignal;\n transport: HostTransport;\n}\n\nfunction toFailureResult(\n startedAt: number,\n timeoutTriggered: boolean,\n message: string,\n): ExecuteResult {\n return {\n durationMs: Date.now() - startedAt,\n error: {\n code: timeoutTriggered ? \"timeout\" : \"internal_error\",\n message: timeoutTriggered ? getExecutionTimeoutMessage() : message,\n },\n logs: [],\n ok: false,\n };\n}\n\nfunction normalizeDoneMessage(message: DoneMessage): ExecuteResult {\n if (!message.ok) {\n return {\n durationMs: message.durationMs,\n error: message.error,\n logs: message.logs,\n ok: false,\n };\n }\n\n return {\n durationMs: message.durationMs,\n logs: message.logs,\n ok: true,\n result: message.result,\n };\n}\n\n/**\n * Runs one host-side transport session, including timeout, cancellation,\n * tool-call dispatch, and result settlement.\n */\nexport async function runHostTransportSession(\n options: HostTransportSessionOptions,\n): Promise<ExecuteResult> {\n const startedAt = Date.now();\n const abortController = new AbortController();\n const dispatchToolCall = createToolCallDispatcher(\n options.providers,\n abortController.signal,\n );\n const abortSignal = options.signal;\n\n return await new Promise<ExecuteResult>((resolve) => {\n let finished = false;\n let timeoutTriggered = false;\n let cancellationStarted = false;\n let forceTerminateTimer: NodeJS.Timeout | undefined;\n const cancelGraceMs = options.cancelGraceMs ?? DEFAULT_CANCEL_GRACE_MS;\n\n const cleanup = () => {\n finished = true;\n abortController.abort();\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n if (forceTerminateTimer) {\n clearTimeout(forceTerminateTimer);\n }\n offClose();\n offError();\n offMessage();\n abortSignal?.removeEventListener(\"abort\", onAbortSignal);\n };\n\n const finish = (result: ExecuteResult) => {\n if (finished) {\n return;\n }\n\n cleanup();\n void Promise.resolve(options.onSettled?.(result))\n .catch(() => {})\n .finally(() => {\n void Promise.resolve(options.transport.dispose()).catch(() => {});\n });\n resolve(result);\n };\n\n const fail = (message: string) => {\n finish(toFailureResult(startedAt, timeoutTriggered, message));\n };\n\n const send = (message: DispatcherMessage) => {\n if (finished) {\n return;\n }\n\n try {\n const pendingSend = options.transport.send(message);\n void Promise.resolve(pendingSend).catch((error) => {\n if (finished) {\n return;\n }\n\n fail(error instanceof Error ? error.message : String(error));\n });\n } catch (error) {\n fail(error instanceof Error ? error.message : String(error));\n }\n };\n\n const startCancellation = () => {\n if (finished || cancellationStarted) {\n return;\n }\n\n cancellationStarted = true;\n timeoutTriggered = true;\n abortController.abort();\n send({\n id: options.executionId,\n type: \"cancel\",\n });\n forceTerminateTimer = setTimeout(() => {\n if (finished) {\n return;\n }\n\n void Promise.resolve(options.transport.terminate())\n .catch(() => {})\n .finally(() => {\n if (finished) {\n return;\n }\n\n finish(\n toFailureResult(startedAt, true, getExecutionTimeoutMessage()),\n );\n });\n }, cancelGraceMs);\n };\n\n const timeoutTimer = setTimeout(() => {\n startCancellation();\n }, options.runtimeOptions.timeoutMs + HOST_TIMEOUT_BACKSTOP_MS);\n\n const onMessage = (message: RunnerMessage) => {\n if (finished) {\n return;\n }\n\n if (!isRunnerMessage(message)) {\n return;\n }\n\n if (\"id\" in message && message.id !== options.executionId) {\n return;\n }\n\n if (message.type === \"started\") {\n return;\n }\n\n if (message.type === \"tool_call\") {\n void dispatchToolCall(message as ToolCallMessage)\n .then((result) => {\n send({\n ...result,\n callId: message.callId,\n type: \"tool_result\",\n });\n })\n .catch((error) => {\n send({\n callId: message.callId,\n error: {\n code: \"internal_error\",\n message: error instanceof Error ? error.message : String(error),\n },\n ok: false,\n type: \"tool_result\",\n });\n });\n return;\n }\n\n finish(normalizeDoneMessage(message));\n };\n\n const onError = (error: Error) => {\n fail(error.message);\n };\n\n const onClose = (reason?: TransportCloseReason) => {\n fail(reason?.message ?? \"Transport closed unexpectedly\");\n };\n\n const onAbortSignal = () => {\n startCancellation();\n };\n\n const offMessage = options.transport.onMessage(onMessage);\n const offError = options.transport.onError(onError);\n const offClose = options.transport.onClose(onClose);\n abortSignal?.addEventListener(\"abort\", onAbortSignal, { once: true });\n\n if (abortSignal?.aborted) {\n startCancellation();\n return;\n }\n\n send({\n code: options.code,\n id: options.executionId,\n options: options.runtimeOptions,\n providers: extractProviderManifests(options.providers),\n type: \"execute\",\n });\n });\n}\n","const SOURCE_MODE_EXEC_ARGV = [\"--conditions=source\", \"--import\", \"tsx\"];\n\n/**\n * Returns the extra Node flags needed to launch transport-backed worker entries\n * directly from source during local development and tests.\n */\nexport function getNodeTransportExecArgv(\n moduleUrl: string,\n): string[] | undefined {\n return moduleUrl.endsWith(\".ts\") ? [...SOURCE_MODE_EXEC_ARGV] : undefined;\n}\n","/**\n * One checked-out pooled resource plus its release hook.\n */\nexport interface ResourcePoolLease<T> {\n release(reusable?: boolean): Promise<void>;\n value: T;\n}\n\n/**\n * Configuration for a reusable async resource pool.\n */\nexport interface ResourcePoolOptions<T> {\n create: () => Promise<T> | T;\n destroy: (value: T) => Promise<void> | void;\n idleTimeoutMs?: number;\n maxSize: number;\n minSize?: number;\n}\n\n/**\n * Minimal async pool contract used by the pooled executors.\n */\nexport interface ResourcePool<T> {\n acquire(): Promise<ResourcePoolLease<T>>;\n dispose(): Promise<void>;\n prewarm(count?: number): Promise<void>;\n}\n\ninterface PoolEntry<T> {\n idleTimer: NodeJS.Timeout | undefined;\n value: T;\n}\n\nfunction clampTarget(value: number, maxSize: number): number {\n return Math.max(0, Math.min(value, maxSize));\n}\n\n/**\n * Creates a bounded async resource pool with optional idle eviction.\n */\nexport function createResourcePool<T>(\n options: ResourcePoolOptions<T>,\n): ResourcePool<T> {\n const available: PoolEntry<T>[] = [];\n const waiters: Array<{\n reject: (error: Error) => void;\n resolve: (lease: ResourcePoolLease<T>) => void;\n }> = [];\n const inUse = new Set<PoolEntry<T>>();\n let disposed = false;\n let totalSize = 0;\n\n const minSize = clampTarget(options.minSize ?? 0, options.maxSize);\n\n const createEntry = async (): Promise<PoolEntry<T>> => {\n totalSize += 1;\n\n try {\n return {\n idleTimer: undefined,\n value: await options.create(),\n };\n } catch (error) {\n totalSize -= 1;\n throw error;\n }\n };\n\n const removeAvailableEntry = (entry: PoolEntry<T>): void => {\n const index = available.indexOf(entry);\n\n if (index >= 0) {\n available.splice(index, 1);\n }\n };\n\n const clearIdleTimer = (entry: PoolEntry<T>): void => {\n if (entry.idleTimer) {\n clearTimeout(entry.idleTimer);\n entry.idleTimer = undefined;\n }\n };\n\n const queueAvailableEntry = (entry: PoolEntry<T>): void => {\n available.push(entry);\n\n if ((options.idleTimeoutMs ?? 0) > 0) {\n entry.idleTimer = setTimeout(() => {\n if (disposed) {\n return;\n }\n\n if (available.includes(entry) && totalSize > minSize) {\n void destroyEntry(entry);\n }\n }, options.idleTimeoutMs);\n }\n };\n\n const destroyEntry = async (entry: PoolEntry<T>): Promise<void> => {\n clearIdleTimer(entry);\n removeAvailableEntry(entry);\n inUse.delete(entry);\n totalSize -= 1;\n await options.destroy(entry.value);\n };\n\n const leaseEntry = (entry: PoolEntry<T>): ResourcePoolLease<T> => {\n clearIdleTimer(entry);\n removeAvailableEntry(entry);\n inUse.add(entry);\n\n return {\n release: async (reusable = true) => {\n if (!inUse.has(entry)) {\n return;\n }\n\n inUse.delete(entry);\n\n if (disposed || !reusable) {\n await destroyEntry(entry);\n await fillWaiters();\n return;\n }\n\n const waiter = waiters.shift();\n if (waiter) {\n waiter.resolve(leaseEntry(entry));\n return;\n }\n\n queueAvailableEntry(entry);\n },\n value: entry.value,\n };\n };\n\n const fillWaiters = async (): Promise<void> => {\n while (!disposed && waiters.length > 0 && totalSize < options.maxSize) {\n const waiter = waiters.shift();\n if (!waiter) {\n return;\n }\n\n try {\n waiter.resolve(leaseEntry(await createEntry()));\n } catch (error) {\n waiter.reject(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }\n };\n\n return {\n acquire: async () => {\n if (disposed) {\n throw new Error(\"Resource pool is disposed\");\n }\n\n const entry = available.pop();\n if (entry) {\n return leaseEntry(entry);\n }\n\n if (totalSize < options.maxSize) {\n return leaseEntry(await createEntry());\n }\n\n return await new Promise<ResourcePoolLease<T>>((resolve, reject) => {\n waiters.push({ reject, resolve });\n });\n },\n dispose: async () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n\n while (waiters.length > 0) {\n waiters.shift()?.reject(new Error(\"Resource pool is disposed\"));\n }\n\n const idleEntries = [...available];\n available.length = 0;\n await Promise.all(idleEntries.map((entry) => destroyEntry(entry)));\n },\n prewarm: async (count) => {\n if (disposed) {\n throw new Error(\"Resource pool is disposed\");\n }\n\n const target = clampTarget(count ?? minSize, options.maxSize);\n const missing = target - totalSize;\n\n if (missing <= 0) {\n return;\n }\n\n const created = await Promise.all(\n Array.from({ length: miss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AC,GAAG,UAAU;AAClC,aAAU,SAAS;AACnB,SAAM,QAAQ,IAAI,YAAY,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;;EAEpE,SAAS,OAAO,UAAU;AACxB,OAAI,SACF,OAAM,IAAI,MAAM,4BAA4B;GAI9C,MAAM,UADS,YAAY,SAAS,SAAS,QAAQ,QAAQ,GACpC;AAEzB,OAAI,WAAW,EACb;GAGF,MAAM,UAAU,MAAM,QAAQ,IAC5B,MAAM,KAAK,EAAE,QAAQ,SAAS,EAAE,YAAY,MAAM,aAAa,CAAC,CACjE;AAED,QAAK,MAAM,SAAS,QAClB,qBAAoB,MAAM;;EAG/B"}
|
|
@@ -98,7 +98,7 @@ interface TransportCloseReason {
|
|
|
98
98
|
signal?: NodeJS.Signals | null;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Minimal parent-side transport contract for
|
|
101
|
+
* Minimal parent-side transport contract for transport-backed execution.
|
|
102
102
|
*/
|
|
103
103
|
interface HostTransport {
|
|
104
104
|
dispose(): Promise<void> | void;
|
|
@@ -129,7 +129,7 @@ declare function runHostTransportSession(options: HostTransportSessionOptions):
|
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region src/protocol/nodeBootstrap.d.ts
|
|
131
131
|
/**
|
|
132
|
-
* Returns the extra Node flags needed to launch transport-backed
|
|
132
|
+
* Returns the extra Node flags needed to launch transport-backed worker entries
|
|
133
133
|
* directly from source during local development and tests.
|
|
134
134
|
*/
|
|
135
135
|
declare function getNodeTransportExecArgv(moduleUrl: string): string[] | undefined;
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Public TypeScript declarations for this package entrypoint.
|
|
4
4
|
*/
|
|
5
|
-
import { a as ToolCall, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, i as ProviderToolManifest, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, o as ToolCallResult, p as ResolvedToolDescriptor, r as ProviderManifest, u as ExecuteErrorCode } from "../runner-
|
|
5
|
+
import { a as ToolCall, d as ExecuteResult, f as JsonSchema, g as ToolExecutionContext, i as ProviderToolManifest, l as ExecuteError, m as ResolvedToolProvider, n as ExecutorRuntimeOptions, o as ToolCallResult, p as ResolvedToolDescriptor, r as ProviderManifest, u as ExecuteErrorCode } from "../runner-ClFrFnz9.js";
|
|
6
6
|
|
|
7
7
|
//#region src/protocol/messages.d.ts
|
|
8
8
|
|
|
@@ -98,7 +98,7 @@ interface TransportCloseReason {
|
|
|
98
98
|
signal?: NodeJS.Signals | null;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Minimal parent-side transport contract for
|
|
101
|
+
* Minimal parent-side transport contract for transport-backed execution.
|
|
102
102
|
*/
|
|
103
103
|
interface HostTransport {
|
|
104
104
|
dispose(): Promise<void> | void;
|
|
@@ -129,7 +129,7 @@ declare function runHostTransportSession(options: HostTransportSessionOptions):
|
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region src/protocol/nodeBootstrap.d.ts
|
|
131
131
|
/**
|
|
132
|
-
* Returns the extra Node flags needed to launch transport-backed
|
|
132
|
+
* Returns the extra Node flags needed to launch transport-backed worker entries
|
|
133
133
|
* directly from source during local development and tests.
|
|
134
134
|
*/
|
|
135
135
|
declare function getNodeTransportExecArgv(moduleUrl: string): string[] | undefined;
|