@execbox/quickjs 0.1.1 → 0.2.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 +2 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/runner/index.cjs +1 -1
- package/dist/runner/index.d.cts +4 -1
- package/dist/runner/index.d.cts.map +1 -1
- package/dist/runner/index.d.ts +4 -1
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +1 -1
- package/dist/runner/protocolEndpoint.cjs +38 -1
- package/dist/runner/protocolEndpoint.cjs.map +1 -1
- package/dist/runner/protocolEndpoint.d.cts.map +1 -1
- package/dist/runner/protocolEndpoint.d.ts.map +1 -1
- package/dist/runner/protocolEndpoint.js +38 -1
- package/dist/runner/protocolEndpoint.js.map +1 -1
- package/dist/{runner-DVOLiGt4.js → runner-B4UG88h1.js} +16 -2
- package/dist/runner-B4UG88h1.js.map +1 -0
- package/dist/{runner-CYXIVOmJ.cjs → runner-DhOZH9xz.cjs} +16 -2
- package/dist/runner-DhOZH9xz.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/runner-CYXIVOmJ.cjs.map +0 -1
- package/dist/runner-DVOLiGt4.js.map +0 -1
|
@@ -5395,10 +5395,23 @@ function injectProviders(context, providers, signal, trustedHostErrorKey, onTool
|
|
|
5395
5395
|
function createToolHandle(context, providerName, safeToolName, signal, trustedHostErrorKey, onToolCall) {
|
|
5396
5396
|
return context.newFunction(safeToolName, (...args) => {
|
|
5397
5397
|
const deferred = context.newPromise();
|
|
5398
|
-
const input = args[0] === void 0 ? void 0 : context.dump(args[0]);
|
|
5399
5398
|
const disposeDeferred = () => {
|
|
5400
5399
|
if (context.alive && deferred.alive) deferred.dispose();
|
|
5401
5400
|
};
|
|
5401
|
+
let input;
|
|
5402
|
+
try {
|
|
5403
|
+
input = args[0] === void 0 ? void 0 : fromGuestHandle(context, args[0]);
|
|
5404
|
+
} catch (error) {
|
|
5405
|
+
const executeError = isExecuteFailure(error) ? error : new ExecuteFailure("serialization_error", "Guest code passed a non-serializable tool input");
|
|
5406
|
+
const errorHandle = createGuestErrorHandle(context, executeError.code, executeError.message, trustedHostErrorKey);
|
|
5407
|
+
try {
|
|
5408
|
+
deferred.reject(errorHandle);
|
|
5409
|
+
return deferred.handle;
|
|
5410
|
+
} finally {
|
|
5411
|
+
errorHandle.dispose();
|
|
5412
|
+
queueMicrotask(disposeDeferred);
|
|
5413
|
+
}
|
|
5414
|
+
}
|
|
5402
5415
|
const onAbort = () => {
|
|
5403
5416
|
signal.removeEventListener("abort", onAbort);
|
|
5404
5417
|
if (!context.alive || !deferred.alive) {
|
|
@@ -5467,6 +5480,7 @@ function createToolHandle(context, providerName, safeToolName, signal, trustedHo
|
|
|
5467
5480
|
*/
|
|
5468
5481
|
async function runQuickJsSession(request, options = {}) {
|
|
5469
5482
|
const loadModule = async () => {
|
|
5483
|
+
if (options.module) return options.module;
|
|
5470
5484
|
return options.loadModule ? await options.loadModule() : await loadDefaultModule();
|
|
5471
5485
|
};
|
|
5472
5486
|
const maxLogChars = options.maxLogChars ?? DEFAULT_MAX_LOG_CHARS;
|
|
@@ -5559,4 +5573,4 @@ Object.defineProperty(exports, 'runQuickJsSession', {
|
|
|
5559
5573
|
return runQuickJsSession;
|
|
5560
5574
|
}
|
|
5561
5575
|
});
|
|
5562
|
-
//# sourceMappingURL=runner-
|
|
5576
|
+
//# sourceMappingURL=runner-DhOZH9xz.cjs.map
|