poe-code 8.0.1 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/harness.js +28 -3
- package/dist/cli/commands/harness.js.map +1 -1
- package/dist/index.js +1516 -711
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/chunk-4YIDX44G.js +40 -0
- package/packages/safejs/dist/chunks/chunk-4YIDX44G.js.map +7 -0
- package/packages/safejs/dist/chunks/chunk-55ZK3CR7.js +7802 -0
- package/packages/safejs/dist/chunks/chunk-55ZK3CR7.js.map +7 -0
- package/packages/safejs/dist/chunks/{chunk-ME5BTAZT.js → chunk-GQBEEFVQ.js} +150 -19
- package/packages/safejs/dist/chunks/{chunk-ME5BTAZT.js.map → chunk-GQBEEFVQ.js.map} +4 -4
- package/packages/safejs/dist/chunks/chunk-NI4WFFTL.js +5701 -0
- package/packages/safejs/dist/chunks/chunk-NI4WFFTL.js.map +7 -0
- package/packages/safejs/dist/chunks/inMemory-RLZ4QGDZ.js +48 -0
- package/packages/safejs/dist/chunks/inMemory-RLZ4QGDZ.js.map +7 -0
- package/packages/safejs/dist/chunks/server-3SNT3RE2.js +12518 -0
- package/packages/safejs/dist/chunks/server-3SNT3RE2.js.map +7 -0
- package/packages/safejs/dist/chunks/types-BTF37PZ6.js +348 -0
- package/packages/safejs/dist/chunks/types-BTF37PZ6.js.map +7 -0
- package/packages/safejs/dist/cli.d.ts +2 -0
- package/packages/safejs/dist/cli.js +26 -2
- package/packages/safejs/dist/cli.js.map +2 -2
- package/packages/safejs/dist/core.js +2 -1
- package/packages/safejs/dist/index.d.ts +3 -0
- package/packages/safejs/dist/index.js +6 -287
- package/packages/safejs/dist/index.js.map +4 -4
- package/packages/safejs/dist/interp/host-bridge.d.ts +2 -0
- package/packages/safejs/dist/interp/host-bridge.js +20 -9
- package/packages/safejs/dist/interp/host-call.d.ts +5 -0
- package/packages/safejs/dist/interp/host-call.js +48 -3
- package/packages/safejs/dist/interp/resources.d.ts +7 -0
- package/packages/safejs/dist/interp/resources.js +36 -0
- package/packages/safejs/dist/modules/mcp-transport.d.ts +26 -0
- package/packages/safejs/dist/modules/mcp-transport.js +259 -0
- package/packages/safejs/dist/modules/mcp.d.ts +15 -1
- package/packages/safejs/dist/modules/mcp.js +107 -0
- package/packages/safejs/dist/run.js +6 -3
- package/packages/safejs/dist/snapshot/dump-format.d.ts +1 -1
- package/packages/safejs/dist/snapshot/dump-format.js +1 -1
- package/packages/safejs/dist/snapshot/replay-data.d.ts +1 -0
- package/packages/safejs/dist/snapshot/replay-data.js +3 -1
- package/packages/safejs/dist/snapshot/replay-inputs.d.ts +2 -2
- package/packages/safejs/dist/snapshot/replay-inputs.js +2 -1
- package/packages/safejs/dist/chunks/chunk-AVDRLE3Y.js +0 -3461
- package/packages/safejs/dist/chunks/chunk-AVDRLE3Y.js.map +0 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hashSource } from "./parse/hash.js";
|
|
2
|
+
import { withRunResources } from "./interp/resources.js";
|
|
2
3
|
import { createReplayableRandom } from "./random.js";
|
|
3
4
|
import { attachErrorSpan, describeThrownValue, materializeWrappedErrorCause, replaceErrorStack } from "./error/shape.js";
|
|
4
5
|
import { parseExecutableModule } from "./parse/parser.js";
|
|
@@ -43,7 +44,7 @@ export function run(source, options = {}) {
|
|
|
43
44
|
const lifecycle = { hostCallbackDepth: 0 };
|
|
44
45
|
const dumpController = createDumpController(lifecycle);
|
|
45
46
|
const promiseTracker = createSandboxPromiseRejectionTracker();
|
|
46
|
-
const
|
|
47
|
+
const execute = async () => {
|
|
47
48
|
const promiseReplay = new PromiseReplay(options.snapshot?.promiseReplay);
|
|
48
49
|
return promiseReplayContext.run(promiseReplay, async () => {
|
|
49
50
|
const deactivateOtelSink = activateOtelSink(options.otelSink);
|
|
@@ -140,7 +141,8 @@ export function run(source, options = {}) {
|
|
|
140
141
|
if (!isSandboxClosure(binding))
|
|
141
142
|
throw new TypeError("Invalid initial promise operation.");
|
|
142
143
|
return binding.call([]);
|
|
143
|
-
});
|
|
144
|
+
}, hostCalls.rebindHostCapability.bind(hostCalls));
|
|
145
|
+
hostCalls.validateHostCapabilities();
|
|
144
146
|
budget.setRetainedDataUsage(initialInputs, measureSandboxData([
|
|
145
147
|
...Object.values(initialInputs.values.bindings),
|
|
146
148
|
...Object.values(initialInputs.values.imports),
|
|
@@ -310,7 +312,8 @@ export function run(source, options = {}) {
|
|
|
310
312
|
deactivateOtelSink();
|
|
311
313
|
}
|
|
312
314
|
});
|
|
313
|
-
}
|
|
315
|
+
};
|
|
316
|
+
const result = withRunResources(options.signal, () => withSandboxPromiseRejectionTracker(promiseTracker, execute));
|
|
314
317
|
return attachDumpController(result, dumpController);
|
|
315
318
|
}
|
|
316
319
|
async function throwIfReturnedPromiseRejected(result) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DUMP_FORMAT_VERSION = 1;
|
|
2
|
-
export const EXECUTION_SEMANTICS = "jobs-
|
|
2
|
+
export const EXECUTION_SEMANTICS = "jobs-v5";
|
|
3
3
|
import { assertSnapshotGraphDepth } from "../graph-depth.js";
|
|
4
4
|
import { sandboxErrorTypes } from "../error/shape.js";
|
|
5
5
|
import { getSandboxArgumentEntries, isSandboxArguments } from "../interp/arguments.js";
|
|
@@ -61,5 +61,6 @@ export declare function encodeReplayData(value: SandboxValue, options?: {
|
|
|
61
61
|
export declare function decodeReplayData(input: unknown, options?: {
|
|
62
62
|
resolveCapability?: (id: string) => SandboxClosure | undefined;
|
|
63
63
|
resolvePromise?: (id: string) => SandboxPromise | undefined;
|
|
64
|
+
onCapabilityRestored?: (original: SandboxClosure, restored: SandboxClosure) => void;
|
|
64
65
|
}): SandboxValue;
|
|
65
66
|
export {};
|
|
@@ -185,7 +185,7 @@ export function decodeReplayData(input, options = {}) {
|
|
|
185
185
|
restored.set(id, capability);
|
|
186
186
|
return capability;
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
const copy = createSandboxClosure({
|
|
189
189
|
...capability,
|
|
190
190
|
boundTarget: capability.boundTarget,
|
|
191
191
|
cancellationSignal: capability.cancellationSignal,
|
|
@@ -202,6 +202,8 @@ export function decodeReplayData(input, options = {}) {
|
|
|
202
202
|
return properties;
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
|
+
options.onCapabilityRestored?.(capability, copy);
|
|
206
|
+
return copy;
|
|
205
207
|
}
|
|
206
208
|
if (kind === "map") {
|
|
207
209
|
const result = createSandboxMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SandboxPromise, type SandboxValue } from "../interp/values.js";
|
|
1
|
+
import { type SandboxClosure, type SandboxPromise, type SandboxValue } from "../interp/values.js";
|
|
2
2
|
import { type ReplayData } from "./replay-data.js";
|
|
3
3
|
export type ReplayInputs = {
|
|
4
4
|
bindings: Record<string, SandboxValue>;
|
|
@@ -6,7 +6,7 @@ export type ReplayInputs = {
|
|
|
6
6
|
entryPointArgs: SandboxValue[] | undefined;
|
|
7
7
|
importMeta: SandboxValue;
|
|
8
8
|
};
|
|
9
|
-
export declare function prepareReplayInputs(current: ReplayInputs, saved?: unknown, preparePromise?: (promise: SandboxPromise | undefined, id: string) => SandboxPromise): {
|
|
9
|
+
export declare function prepareReplayInputs(current: ReplayInputs, saved?: unknown, preparePromise?: (promise: SandboxPromise | undefined, id: string) => SandboxPromise, onCapabilityRestored?: (original: SandboxClosure, restored: SandboxClosure) => void): {
|
|
10
10
|
values: ReplayInputs;
|
|
11
11
|
snapshot: ReplayData;
|
|
12
12
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSandboxPromise, isSandboxClosure, isSandboxMap, isSandboxSet, isSandboxPromise } from "../interp/values.js";
|
|
2
2
|
import { decodeReplayData, encodeReplayData } from "./replay-data.js";
|
|
3
3
|
const validationPromise = createSandboxPromise(Promise.resolve(undefined));
|
|
4
|
-
export function prepareReplayInputs(current, saved, preparePromise) {
|
|
4
|
+
export function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored) {
|
|
5
5
|
const identities = new WeakMap();
|
|
6
6
|
const capabilities = new Map();
|
|
7
7
|
const promises = new Map();
|
|
@@ -81,6 +81,7 @@ export function prepareReplayInputs(current, saved, preparePromise) {
|
|
|
81
81
|
assertReplayInputShape(validated);
|
|
82
82
|
const restored = decodeReplayData(saved, {
|
|
83
83
|
resolveCapability,
|
|
84
|
+
onCapabilityRestored,
|
|
84
85
|
resolvePromise: (id) => {
|
|
85
86
|
const value = readCapability(id);
|
|
86
87
|
if (!promises.has(id) && preparePromise !== undefined)
|