poe-code 11.0.13 → 11.0.14
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/index.js +16 -1
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-GTX2EXKD.js → chunk-DZH7JZC4.js} +16 -1
- package/packages/safejs/dist/chunks/chunk-DZH7JZC4.js.map +7 -0
- package/packages/safejs/dist/chunks/{chunk-EV4BL6HH.js → chunk-X745DTOB.js} +2 -2
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/async.js +3 -1
- package/packages/safejs/dist/interp/methods/function.js +4 -0
- package/packages/safejs/dist/interp/values.d.ts +2 -0
- package/packages/safejs/dist/interp/values.js +3 -0
- package/packages/safejs/dist/parse/bindings.d.ts +2 -1
- package/packages/safejs/dist/parse/bindings.js +4 -0
- package/packages/safejs/dist/snapshot/restore.js +2 -0
- package/packages/safejs/dist/chunks/chunk-GTX2EXKD.js.map +0 -7
- /package/packages/safejs/dist/chunks/{chunk-EV4BL6HH.js.map → chunk-X745DTOB.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-DZH7JZC4.js";
|
|
31
31
|
|
|
32
32
|
// packages/safejs/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8055,4 +8055,4 @@ export {
|
|
|
8055
8055
|
parseMcpConfig,
|
|
8056
8056
|
makeMcpModule
|
|
8057
8057
|
};
|
|
8058
|
-
//# sourceMappingURL=chunk-
|
|
8058
|
+
//# sourceMappingURL=chunk-X745DTOB.js.map
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
parseMcpConfig,
|
|
21
21
|
splitFrontmatter,
|
|
22
22
|
withBrokenPipeGuard
|
|
23
|
-
} from "./chunks/chunk-
|
|
23
|
+
} from "./chunks/chunk-X745DTOB.js";
|
|
24
24
|
import {
|
|
25
25
|
Budget,
|
|
26
26
|
SandboxError,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
replaceErrorStack,
|
|
33
33
|
restore,
|
|
34
34
|
run
|
|
35
|
-
} from "./chunks/chunk-
|
|
35
|
+
} from "./chunks/chunk-DZH7JZC4.js";
|
|
36
36
|
import "./chunks/chunk-4YIDX44G.js";
|
|
37
37
|
|
|
38
38
|
// packages/safejs/src/cli.ts
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
runWithSpawnUsageAccumulator,
|
|
28
28
|
splitFrontmatter,
|
|
29
29
|
supportsSpawnMode
|
|
30
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-X745DTOB.js";
|
|
31
31
|
import {
|
|
32
32
|
Budget,
|
|
33
33
|
FileSnapshotBackend,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
registerPendingHostCallPolicy,
|
|
50
50
|
restore,
|
|
51
51
|
run
|
|
52
|
-
} from "./chunks/chunk-
|
|
52
|
+
} from "./chunks/chunk-DZH7JZC4.js";
|
|
53
53
|
import "./chunks/chunk-4YIDX44G.js";
|
|
54
54
|
|
|
55
55
|
// packages/safejs/src/runner/run-harness.ts
|
|
@@ -5,7 +5,7 @@ import { getThenable, resolveSandboxValue } from "./promise.js";
|
|
|
5
5
|
import { runAsyncPrefix, suspendJob } from "./jobs.js";
|
|
6
6
|
import { awaitSandboxValue } from "./cancel.js";
|
|
7
7
|
import { hoistVarDeclarations } from "./var-hoist.js";
|
|
8
|
-
import { boundIdentifiers, containsParameterExpression, hoistedVarDeclarations } from "../parse/bindings.js";
|
|
8
|
+
import { boundIdentifiers, containsParameterExpression, getFunctionLength, hoistedVarDeclarations } from "../parse/bindings.js";
|
|
9
9
|
import { createSandboxArguments, createSandboxClosure, createSandboxGenerator, createSandboxPromise, allocateProducedSandboxValue, isSandboxPromise } from "./values.js";
|
|
10
10
|
export function emitResumeBreakpoint(context, breakpoint) {
|
|
11
11
|
context.onYield?.({
|
|
@@ -55,6 +55,7 @@ export function createInterpretedClosure(node, context, evaluateNode) {
|
|
|
55
55
|
: undefined;
|
|
56
56
|
return createSandboxClosure({
|
|
57
57
|
sandbox: true,
|
|
58
|
+
length: getFunctionLength(node.params),
|
|
58
59
|
...(node.async ? { async: true } : {}),
|
|
59
60
|
...(node.type === "FunctionDeclaration" || node.type === "FunctionExpression"
|
|
60
61
|
? node.id === undefined
|
|
@@ -102,6 +103,7 @@ export function createInterpretedClosure(node, context, evaluateNode) {
|
|
|
102
103
|
function createGeneratorClosure(node, context, evaluateNode) {
|
|
103
104
|
return createSandboxClosure({
|
|
104
105
|
sandbox: true,
|
|
106
|
+
length: getFunctionLength(node.params),
|
|
105
107
|
...(node.id === undefined ? {} : { name: node.id.name }),
|
|
106
108
|
retainedValues: () => context.scope.retainedValues(),
|
|
107
109
|
call: async (args, callContext) => {
|
|
@@ -5,6 +5,9 @@ export function getFunctionMember(target, property, options) {
|
|
|
5
5
|
if (propertyValue !== undefined || Object.hasOwn(target.properties ?? {}, String(property))) {
|
|
6
6
|
return propertyValue;
|
|
7
7
|
}
|
|
8
|
+
if (property === "length") {
|
|
9
|
+
return target.length;
|
|
10
|
+
}
|
|
8
11
|
if (!isFunctionMethodName(property)) {
|
|
9
12
|
return undefined;
|
|
10
13
|
}
|
|
@@ -24,6 +27,7 @@ function callFunctionMethod(target, methodName, args, options, stack) {
|
|
|
24
27
|
return createSandboxClosure({
|
|
25
28
|
sandbox: true,
|
|
26
29
|
name: `bound ${target.name ?? ""}`,
|
|
30
|
+
length: target.length === undefined ? undefined : Math.max(0, target.length - boundArgs.length),
|
|
27
31
|
boundTarget: target,
|
|
28
32
|
retainedValues: () => [target, thisValue, ...boundArgs],
|
|
29
33
|
call: (callArgs, context) => options.callClosure(target, [...boundArgs, ...callArgs], context?.stack ?? [], thisValue),
|
|
@@ -56,6 +56,7 @@ export type SandboxClosure = {
|
|
|
56
56
|
readonly boundTarget?: SandboxClosure;
|
|
57
57
|
readonly cancellationSignal?: AbortSignal;
|
|
58
58
|
readonly kind: "fn";
|
|
59
|
+
readonly length?: number;
|
|
59
60
|
readonly name?: string;
|
|
60
61
|
readonly properties?: SandboxObject;
|
|
61
62
|
readonly call: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
@@ -91,6 +92,7 @@ export declare function createSandboxClosure(input: {
|
|
|
91
92
|
call: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
92
93
|
construct?: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
93
94
|
name?: string;
|
|
95
|
+
length?: number;
|
|
94
96
|
properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
|
|
95
97
|
retainedValues?: () => Iterable<SandboxValue>;
|
|
96
98
|
}): SandboxClosure;
|
|
@@ -35,6 +35,9 @@ export function createSandboxClosure(input) {
|
|
|
35
35
|
if (input.sandbox === true) {
|
|
36
36
|
Object.defineProperty(closure, "sandbox", { value: true });
|
|
37
37
|
}
|
|
38
|
+
if (input.length !== undefined) {
|
|
39
|
+
Object.defineProperty(closure, "length", { value: input.length });
|
|
40
|
+
}
|
|
38
41
|
if (input.boundTarget !== undefined) {
|
|
39
42
|
Object.defineProperty(closure, "boundTarget", { value: input.boundTarget });
|
|
40
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ArrayPattern, AssignmentPattern, Identifier, MemberExpression, ObjectPattern, ParseResult, RestElement, VariableDeclaration } from "./parser.js";
|
|
1
|
+
import type { ArrowFunctionExpression, ArrayPattern, AssignmentPattern, Identifier, MemberExpression, ObjectPattern, ParseResult, RestElement, VariableDeclaration } from "./parser.js";
|
|
2
2
|
type BindingPattern = Identifier | ArrayPattern | ObjectPattern | AssignmentPattern | RestElement | MemberExpression;
|
|
3
|
+
export declare function getFunctionLength(params: ArrowFunctionExpression["params"]): number;
|
|
3
4
|
export declare function boundIdentifiers(pattern: BindingPattern): Iterable<Identifier>;
|
|
4
5
|
export declare function containsParameterExpression(pattern: BindingPattern): boolean;
|
|
5
6
|
export declare function hoistedVarDeclarations(nodes: readonly ParseResult[]): Iterable<VariableDeclaration>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export function getFunctionLength(params) {
|
|
2
|
+
const firstOptional = params.findIndex((param) => param.type === "AssignmentPattern" || param.type === "RestElement");
|
|
3
|
+
return firstOptional === -1 ? params.length : firstOptional;
|
|
4
|
+
}
|
|
1
5
|
export function* boundIdentifiers(pattern) {
|
|
2
6
|
switch (pattern.type) {
|
|
3
7
|
case "Identifier":
|
|
@@ -6,6 +6,7 @@ import { wrapCallerInjectedBindings } from "../interp/host-bridge.js";
|
|
|
6
6
|
import { createSandboxArguments, createSandboxClosure, createSandboxGenerator, createSandboxMap, createSandboxPromise, createSandboxRegex, createSandboxSet, measureSandboxData } from "../interp/values.js";
|
|
7
7
|
import { createGeneratorChannel, restoreGeneratorChannel } from "../interp/generator.js";
|
|
8
8
|
import { hashSource } from "../parse/hash.js";
|
|
9
|
+
import { getFunctionLength } from "../parse/bindings.js";
|
|
9
10
|
import { parseModule } from "../parse/parser.js";
|
|
10
11
|
import { createUnknownModuleMessage } from "../modules/registry.js";
|
|
11
12
|
import { interpret } from "../interp/interpreter.js";
|
|
@@ -386,6 +387,7 @@ function restoreClosureValue(astNodeId, capturedScopeId, state) {
|
|
|
386
387
|
}
|
|
387
388
|
const baseClosure = createSandboxClosure({
|
|
388
389
|
async: true,
|
|
390
|
+
length: getFunctionLength(node.params),
|
|
389
391
|
...(node.type !== "ArrowFunctionExpression" &&
|
|
390
392
|
!(node.type === "FunctionExpression" && node.method === true) &&
|
|
391
393
|
!node.async
|