poe-code 12.0.8 → 12.0.10
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 +28 -0
- package/dist/index.js +16 -2
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-JGTN4U7F.js → chunk-5TMXWUAL.js} +15 -2
- package/packages/safe-js/dist/chunks/{chunk-JGTN4U7F.js.map → chunk-5TMXWUAL.js.map} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-PY5NKSTP.js → chunk-HEFYUEBF.js} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/exceptions.js +3 -0
- package/packages/safe-js/dist/interp/host-bridge.d.ts +1 -1
- package/packages/safe-js/dist/interp/host-bridge.js +7 -1
- package/packages/safe-js/dist/interp/host-call.d.ts +2 -0
- package/packages/safe-js/dist/interp/host-call.js +7 -0
- package/packages/safe-js/dist/snapshot/policy.d.ts +1 -0
- package/packages/safe-js/dist/snapshot/policy.js +4 -1
- /package/packages/safe-js/dist/chunks/{chunk-PY5NKSTP.js.map → chunk-HEFYUEBF.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-5TMXWUAL.js";
|
|
31
31
|
import {
|
|
32
32
|
createFileSystem,
|
|
33
33
|
createNodeFileSystemAdapterRegistry,
|
|
@@ -8183,4 +8183,4 @@ export {
|
|
|
8183
8183
|
parseMcpConfig,
|
|
8184
8184
|
makeMcpModule
|
|
8185
8185
|
};
|
|
8186
|
-
//# sourceMappingURL=chunk-
|
|
8186
|
+
//# sourceMappingURL=chunk-HEFYUEBF.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-HEFYUEBF.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
replaceErrorStack,
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-5TMXWUAL.js";
|
|
38
38
|
import "./chunks/chunk-F7NY24BF.js";
|
|
39
39
|
import "./chunks/chunk-YBQUQPZV.js";
|
|
40
40
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
runWithSpawnUsageAccumulator,
|
|
30
30
|
splitFrontmatter,
|
|
31
31
|
supportsSpawnMode
|
|
32
|
-
} from "./chunks/chunk-
|
|
32
|
+
} from "./chunks/chunk-HEFYUEBF.js";
|
|
33
33
|
import {
|
|
34
34
|
Budget,
|
|
35
35
|
FileSnapshotBackend,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
registerPendingHostCallPolicy,
|
|
52
52
|
restore,
|
|
53
53
|
run
|
|
54
|
-
} from "./chunks/chunk-
|
|
54
|
+
} from "./chunks/chunk-5TMXWUAL.js";
|
|
55
55
|
import "./chunks/chunk-F7NY24BF.js";
|
|
56
56
|
import "./chunks/chunk-YBQUQPZV.js";
|
|
57
57
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -66,6 +66,9 @@ export function isCapturedException(value) {
|
|
|
66
66
|
return typeof value === "object" && value !== null && capturedExceptionBrand in value;
|
|
67
67
|
}
|
|
68
68
|
export function coerceThrownValue(reason, budget, stackFrames, span, sandbox = false) {
|
|
69
|
+
if (reason instanceof HostCallResumabilityError) {
|
|
70
|
+
throw reason;
|
|
71
|
+
}
|
|
69
72
|
if (isSubsetErrorValue(reason)) {
|
|
70
73
|
attachErrorSpan(reason, readErrorSpan(reason) ?? span);
|
|
71
74
|
return reason;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Budget } from "./budget.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type PendingHostCallPolicyMode } from "../snapshot/policy.js";
|
|
3
3
|
import { type HostCallJournal, type HostCallOutcome } from "./host-call.js";
|
|
4
4
|
import { type SandboxClosure, type SandboxValue } from "./values.js";
|
|
5
5
|
import type { RunLifecycle } from "../snapshot/dump.js";
|
|
@@ -4,6 +4,7 @@ import { SandboxError } from "./budget.js";
|
|
|
4
4
|
import { checkFloat32Allocation, copyFloat32Storage, float32DataProperties, float32Storage, isFloat32Array } from "./float32.js";
|
|
5
5
|
import { createSubsetErrorValue } from "./exceptions.js";
|
|
6
6
|
import { bindOtelSpan, getBoundOtelSpan } from "../observability/otel.js";
|
|
7
|
+
import { readRegisteredPendingHostCallPolicy } from "../snapshot/policy.js";
|
|
7
8
|
import { digestHostCallArguments, HostCallResumabilityError, UnresolvedReplayCapabilityError } from "./host-call.js";
|
|
8
9
|
import { createSandboxClosure, createSandboxMap, createSandboxPromise, createSandboxSet, deepCopyFromSandbox, deepCopyToSandbox, defineOwnDataProperty, isArrayIndexKey, isSandboxClosure, isSandboxPromise, measureSandboxData } from "./values.js";
|
|
9
10
|
import { enterRunningState } from "./running-state.js";
|
|
@@ -68,10 +69,12 @@ function wrapCallerInjectedFunction(name, value, options, state) {
|
|
|
68
69
|
const hostArgs = deepCopyFromSandbox([...args], {
|
|
69
70
|
wrapClosure: (closure) => wrapSandboxClosureForHost(closure, stackFrames, options.budget, callbacks)
|
|
70
71
|
});
|
|
71
|
-
const policy = readHostOperationPolicy(value) ?? "re-issue";
|
|
72
72
|
const hostCalls = options.hostCalls;
|
|
73
73
|
const operation = options.operation ?? bindingName;
|
|
74
74
|
const moduleId = options.moduleId ?? "<bindings>";
|
|
75
|
+
const policy = readHostOperationPolicy(value) ??
|
|
76
|
+
readRegisteredPendingHostCallPolicy(moduleId, operation) ??
|
|
77
|
+
"re-issue";
|
|
75
78
|
if (hostCalls === undefined) {
|
|
76
79
|
return copyHostResultToSandbox(invokeHostCallback(() => Reflect.apply(callable, undefined, hostArgs), options), stackFrames, options);
|
|
77
80
|
}
|
|
@@ -256,6 +259,9 @@ function executeHostCall(record, restored, invoke, stackFrames, options, span, c
|
|
|
256
259
|
result = invoke();
|
|
257
260
|
}
|
|
258
261
|
catch (error) {
|
|
262
|
+
if (error instanceof HostCallResumabilityError) {
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
259
265
|
const reason = createHostErrorValue(error, stackFrames, options.budget, span);
|
|
260
266
|
hostCalls.settle(record, { status: "rejected", reason });
|
|
261
267
|
throw error;
|
|
@@ -62,9 +62,11 @@ export type HostCallResumeRequest = Omit<HostCallRecord, "id" | "outcome"> & {
|
|
|
62
62
|
};
|
|
63
63
|
export type HostCallResumeProvider = (request: HostCallResumeRequest, context?: HostCallResumeContext) => HostCallResumeProof | Promise<HostCallResumeProof>;
|
|
64
64
|
export declare class HostCallResumabilityError extends Error {
|
|
65
|
+
#private;
|
|
65
66
|
readonly action: "reset" | "external-reconciliation";
|
|
66
67
|
readonly callId: string;
|
|
67
68
|
readonly lifecycle: HostCallLifecycle;
|
|
69
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
68
70
|
constructor(record: HostCallRecord, action: "reset" | "external-reconciliation", message: string);
|
|
69
71
|
}
|
|
70
72
|
export declare class UnresolvedReplayCapabilityError extends TypeError {
|
|
@@ -5,9 +5,16 @@ import { decodeReplayData, encodeReplayData } from "../snapshot/replay-data.js";
|
|
|
5
5
|
import { validateSnapshotData } from "../snapshot/validation.js";
|
|
6
6
|
import { pendingHostCallResumeIdentityMatches } from "../snapshot/policy.js";
|
|
7
7
|
export class HostCallResumabilityError extends Error {
|
|
8
|
+
#nativeInstance = true;
|
|
8
9
|
action;
|
|
9
10
|
callId;
|
|
10
11
|
lifecycle;
|
|
12
|
+
static [Symbol.hasInstance](value) {
|
|
13
|
+
return (typeof value === "object" &&
|
|
14
|
+
value !== null &&
|
|
15
|
+
#nativeInstance in value &&
|
|
16
|
+
Function.prototype[Symbol.hasInstance].call(this, value));
|
|
17
|
+
}
|
|
11
18
|
constructor(record, action, message) {
|
|
12
19
|
super(message);
|
|
13
20
|
this.name = "HostCallResumabilityError";
|
|
@@ -36,6 +36,7 @@ export declare class HostOperationResumePolicyError extends Error {
|
|
|
36
36
|
constructor(moduleId: string, operation: string);
|
|
37
37
|
}
|
|
38
38
|
export declare function registerPendingHostCallPolicy(registration: PendingHostCallPolicyRegistration): void;
|
|
39
|
+
export declare function readRegisteredPendingHostCallPolicy(moduleId: string, operation: string): PendingHostCallPolicyMode | undefined;
|
|
39
40
|
export declare function resolvePendingHostCallIssuePolicy(call: PendingHostCallDescriptor): PendingHostCallIssuePolicy;
|
|
40
41
|
export declare function tagPendingHostCallAtIssue<TCall extends PendingHostCallDescriptor>(call: TCall): TCall & {
|
|
41
42
|
sideEffectTag?: PendingHostCallSideEffectTag;
|
|
@@ -31,6 +31,9 @@ export function registerPendingHostCallPolicy(registration) {
|
|
|
31
31
|
MODULE_PENDING_HOST_CALL_POLICIES[moduleId] ??= Object.create(null);
|
|
32
32
|
MODULE_PENDING_HOST_CALL_POLICIES[moduleId][operation] = policy;
|
|
33
33
|
}
|
|
34
|
+
export function readRegisteredPendingHostCallPolicy(moduleId, operation) {
|
|
35
|
+
return MODULE_PENDING_HOST_CALL_POLICIES[moduleId]?.[operation];
|
|
36
|
+
}
|
|
34
37
|
export function resolvePendingHostCallIssuePolicy(call) {
|
|
35
38
|
const mode = readPendingHostCallPolicyMode(call);
|
|
36
39
|
if (mode === "re-issue") {
|
|
@@ -96,7 +99,7 @@ function readPendingHostCallPolicyMode(call) {
|
|
|
96
99
|
operation.length === 0) {
|
|
97
100
|
return DEFAULT_PENDING_HOST_CALL_POLICY;
|
|
98
101
|
}
|
|
99
|
-
const policy =
|
|
102
|
+
const policy = readRegisteredPendingHostCallPolicy(moduleId, operation);
|
|
100
103
|
if (policy === undefined) {
|
|
101
104
|
throw new HostOperationResumePolicyError(moduleId, operation);
|
|
102
105
|
}
|
|
File without changes
|