@poe-platform/safe-js 0.1.720 → 0.1.722
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 +50 -7
- package/dist/config-mutations/types.d.ts +3 -1
- package/dist/safe-js/chunks/{chunk-B2SQLK4O.js → chunk-3QQYJ4RQ.js} +3 -2
- package/dist/safe-js/chunks/chunk-3QQYJ4RQ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-OP3H3ZDN.js → chunk-55RIIUGG.js} +23 -7
- package/dist/safe-js/chunks/chunk-55RIIUGG.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-NJM2Q74Z.js → chunk-7SBQ7WTV.js} +10 -11
- package/dist/safe-js/chunks/chunk-7SBQ7WTV.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-KP6I45ET.js → chunk-BNIEPGDU.js} +9885 -8523
- package/dist/safe-js/chunks/{chunk-KP6I45ET.js.map → chunk-BNIEPGDU.js.map} +4 -4
- package/dist/safe-js/chunks/{chunk-HYD4K4HN.js → chunk-D3GC5QPZ.js} +63 -1
- package/dist/safe-js/chunks/chunk-D3GC5QPZ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-KK5NCR5R.js → chunk-EH5A2EQI.js} +501 -150
- package/dist/safe-js/chunks/chunk-EH5A2EQI.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-APKV5Y6T.js → chunk-FA5CQO6V.js} +2 -2
- package/dist/safe-js/chunks/{chunk-RML35GIF.js → chunk-GCOLKRMY.js} +4 -4
- package/dist/safe-js/chunks/{chunk-U6KZ2DQ2.js → chunk-K3ZRBAG5.js} +3 -3
- package/dist/safe-js/chunks/{chunk-BGJXQN4A.js → chunk-QL2ALAE6.js} +4 -4
- package/dist/safe-js/chunks/{chunk-IDQ67DY2.js → chunk-RYVHEOHM.js} +1131 -101
- package/dist/safe-js/chunks/chunk-RYVHEOHM.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-A7CADQAD.js → chunk-S2GFVXSI.js} +3 -3
- package/dist/safe-js/chunks/{chunk-XMA6FOJU.js → chunk-WF7HYDJ4.js} +4 -5
- package/dist/safe-js/chunks/{chunk-XMA6FOJU.js.map → chunk-WF7HYDJ4.js.map} +2 -2
- package/dist/safe-js/chunks/{chunk-NEJ44T4Y.js → chunk-XHSOM5CG.js} +2 -2
- package/dist/safe-js/chunks/{cli-runtime-PO6DQDHP.js → cli-runtime-6QPGM3TX.js} +14 -14
- package/dist/safe-js/chunks/{dump-TRGFSCJ7.js → dump-TU6SYRFD.js} +4 -4
- package/dist/safe-js/chunks/{fs-4T5MZW5J.js → fs-HTZT32MQ.js} +4 -4
- package/dist/safe-js/chunks/harness-RYAMI444.js +10 -0
- package/dist/safe-js/chunks/mcp-DO2IRFGQ.js +11 -0
- package/dist/safe-js/chunks/migration-file-K7UH5ZG6.js +12 -0
- package/dist/safe-js/chunks/restore-7LRP4BM3.js +13 -0
- package/dist/safe-js/chunks/run-6SETM7SV.js +17 -0
- package/dist/safe-js/chunks/runtime-modules-MCQS2SHQ.js +10 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +7 -7
- package/dist/safe-js/extensions.d.ts +3 -1
- package/dist/safe-js/index.js +14 -14
- package/dist/safe-js/interp/async.d.ts +4 -1
- package/dist/safe-js/interp/budget.d.ts +15 -6
- package/dist/safe-js/interp/collection-iterator.d.ts +1 -1
- package/dist/safe-js/interp/host-bridge.d.ts +1 -0
- package/dist/safe-js/interp/host-capabilities.d.ts +13 -4
- package/dist/safe-js/interp/interpreter.d.ts +5 -1
- package/dist/safe-js/interp/intl-numberformat.d.ts +2 -2
- package/dist/safe-js/interp/jobs.d.ts +8 -0
- package/dist/safe-js/interp/scope.d.ts +13 -3
- package/dist/safe-js/interp/typed-array.d.ts +5 -2
- package/dist/safe-js/interp/values.d.ts +1 -0
- package/dist/safe-js/modules/registry.d.ts +4 -1
- package/dist/safe-js/modules/source-graph.d.ts +19 -1
- package/dist/safe-js/parse/compact-spans.d.ts +18 -0
- package/dist/safe-js/parse/dynamic-source.d.ts +3 -1
- package/dist/safe-js/parse/function-source.d.ts +1 -1
- package/dist/safe-js/parse/parser.d.ts +8 -3
- package/dist/safe-js/parse/tokenizer.d.ts +4 -0
- package/dist/safe-js/realm.d.ts +17 -3
- package/dist/safe-js/restore.d.ts +1 -0
- package/dist/safe-js/run.d.ts +10 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +1 -0
- package/dist/toolcraft-design/prompts/primitives/note.d.ts +1 -1
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-B2SQLK4O.js.map +0 -7
- package/dist/safe-js/chunks/chunk-HYD4K4HN.js.map +0 -7
- package/dist/safe-js/chunks/chunk-IDQ67DY2.js.map +0 -7
- package/dist/safe-js/chunks/chunk-KK5NCR5R.js.map +0 -7
- package/dist/safe-js/chunks/chunk-NJM2Q74Z.js.map +0 -7
- package/dist/safe-js/chunks/chunk-OP3H3ZDN.js.map +0 -7
- package/dist/safe-js/chunks/harness-DLEQ2Z3O.js +0 -10
- package/dist/safe-js/chunks/mcp-TNVEFJ6K.js +0 -11
- package/dist/safe-js/chunks/migration-file-IDIUFLKY.js +0 -12
- package/dist/safe-js/chunks/restore-P27AUZR2.js +0 -13
- package/dist/safe-js/chunks/run-KGAEHYMV.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-KICK45EE.js +0 -10
- /package/dist/safe-js/chunks/{chunk-APKV5Y6T.js.map → chunk-FA5CQO6V.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-RML35GIF.js.map → chunk-GCOLKRMY.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-U6KZ2DQ2.js.map → chunk-K3ZRBAG5.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-BGJXQN4A.js.map → chunk-QL2ALAE6.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-A7CADQAD.js.map → chunk-S2GFVXSI.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-NEJ44T4Y.js.map → chunk-XHSOM5CG.js.map} +0 -0
- /package/dist/safe-js/chunks/{cli-runtime-PO6DQDHP.js.map → cli-runtime-6QPGM3TX.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-TRGFSCJ7.js.map → dump-TU6SYRFD.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-4T5MZW5J.js.map → fs-HTZT32MQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-DLEQ2Z3O.js.map → harness-RYAMI444.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-TNVEFJ6K.js.map → mcp-DO2IRFGQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-IDIUFLKY.js.map → migration-file-K7UH5ZG6.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-P27AUZR2.js.map → restore-7LRP4BM3.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-KGAEHYMV.js.map → run-6SETM7SV.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-KICK45EE.js.map → runtime-modules-MCQS2SHQ.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deepCopyToSandbox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BNIEPGDU.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/modules/harness.ts
|
|
6
6
|
function makeHarnessModule(frontmatter, meta) {
|
|
@@ -52,4 +52,4 @@ ${prompt}`;
|
|
|
52
52
|
export {
|
|
53
53
|
makeHarnessModule
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-XHSOM5CG.js.map
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
parseFsConfig,
|
|
13
13
|
resolveFsConfig,
|
|
14
14
|
splitFrontmatter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WF7HYDJ4.js";
|
|
16
16
|
import {
|
|
17
17
|
parseMcpConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-D3GC5QPZ.js";
|
|
19
19
|
import {
|
|
20
20
|
lint
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3QQYJ4RQ.js";
|
|
22
22
|
import {
|
|
23
23
|
createBrokenPipeState,
|
|
24
24
|
createSafeOutputStream,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
parseModule,
|
|
35
35
|
parseSourceModule,
|
|
36
36
|
replaceErrorStack
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RYVHEOHM.js";
|
|
38
38
|
import "./chunk-4YIDX44G.js";
|
|
39
39
|
|
|
40
40
|
// packages/safe-js/src/cli-runtime.ts
|
|
@@ -55,7 +55,7 @@ async function runCli(argv, options, usage) {
|
|
|
55
55
|
async () => {
|
|
56
56
|
try {
|
|
57
57
|
if (argv[0] === "migrate") {
|
|
58
|
-
const { migrateSnapshotFile } = await import("./migration-file-
|
|
58
|
+
const { migrateSnapshotFile } = await import("./migration-file-K7UH5ZG6.js");
|
|
59
59
|
const result = await migrateSnapshotFile({
|
|
60
60
|
...parseMigrationArgs(argv.slice(1)),
|
|
61
61
|
cwd: options.cwd ?? readCurrentWorkingDirectory()
|
|
@@ -272,12 +272,12 @@ async function assertHarnessFile(input) {
|
|
|
272
272
|
}
|
|
273
273
|
async function runScriptFile(filepath, parsed, options) {
|
|
274
274
|
const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([
|
|
275
|
-
import("./run-
|
|
276
|
-
import("./restore-
|
|
277
|
-
import("./dump-
|
|
278
|
-
import("./runtime-modules-
|
|
279
|
-
import("./fs-
|
|
280
|
-
import("./mcp-
|
|
275
|
+
import("./run-6SETM7SV.js"),
|
|
276
|
+
import("./restore-7LRP4BM3.js"),
|
|
277
|
+
import("./dump-TU6SYRFD.js"),
|
|
278
|
+
import("./runtime-modules-MCQS2SHQ.js"),
|
|
279
|
+
import("./fs-HTZT32MQ.js"),
|
|
280
|
+
import("./mcp-DO2IRFGQ.js")
|
|
281
281
|
]);
|
|
282
282
|
const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
|
|
283
283
|
const meta = {
|
|
@@ -513,8 +513,8 @@ async function createRuntime(frontmatter, meta, options) {
|
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
515
|
const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([
|
|
516
|
-
import("./harness-
|
|
517
|
-
import("./fs-
|
|
516
|
+
import("./harness-RYAMI444.js"),
|
|
517
|
+
import("./fs-HTZT32MQ.js")
|
|
518
518
|
]);
|
|
519
519
|
const state = {
|
|
520
520
|
metricCalls: /* @__PURE__ */ new Map(),
|
|
@@ -704,4 +704,4 @@ export {
|
|
|
704
704
|
exitCodeForError,
|
|
705
705
|
runCli
|
|
706
706
|
};
|
|
707
|
-
//# sourceMappingURL=cli-runtime-
|
|
707
|
+
//# sourceMappingURL=cli-runtime-6QPGM3TX.js.map
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
dump,
|
|
5
5
|
dumpCurrent,
|
|
6
6
|
serializeRunSnapshot
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-S2GFVXSI.js";
|
|
8
|
+
import "./chunk-BNIEPGDU.js";
|
|
9
|
+
import "./chunk-RYVHEOHM.js";
|
|
10
10
|
import "./chunk-4YIDX44G.js";
|
|
11
11
|
export {
|
|
12
12
|
attachDumpController,
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
dumpCurrent,
|
|
16
16
|
serializeRunSnapshot
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=dump-
|
|
18
|
+
//# sourceMappingURL=dump-TU6SYRFD.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FS_OPTION_SURFACE,
|
|
3
3
|
makeFsModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-55RIIUGG.js";
|
|
5
5
|
import "./chunk-SJZWSPWD.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-BNIEPGDU.js";
|
|
7
|
+
import "./chunk-RYVHEOHM.js";
|
|
8
8
|
import "./chunk-4YIDX44G.js";
|
|
9
9
|
export {
|
|
10
10
|
FS_OPTION_SURFACE,
|
|
11
11
|
makeFsModule
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=fs-
|
|
13
|
+
//# sourceMappingURL=fs-HTZT32MQ.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makeMcpModule
|
|
3
|
+
} from "./chunk-GCOLKRMY.js";
|
|
4
|
+
import "./chunk-D3GC5QPZ.js";
|
|
5
|
+
import "./chunk-BNIEPGDU.js";
|
|
6
|
+
import "./chunk-RYVHEOHM.js";
|
|
7
|
+
import "./chunk-4YIDX44G.js";
|
|
8
|
+
export {
|
|
9
|
+
makeMcpModule
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=mcp-DO2IRFGQ.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
migrateSnapshotFile
|
|
3
|
+
} from "./chunk-QL2ALAE6.js";
|
|
4
|
+
import "./chunk-SJZWSPWD.js";
|
|
5
|
+
import "./chunk-K3ZRBAG5.js";
|
|
6
|
+
import "./chunk-BNIEPGDU.js";
|
|
7
|
+
import "./chunk-RYVHEOHM.js";
|
|
8
|
+
import "./chunk-4YIDX44G.js";
|
|
9
|
+
export {
|
|
10
|
+
migrateSnapshotFile
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=migration-file-K7UH5ZG6.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SnapshotMismatchError,
|
|
3
|
+
restore
|
|
4
|
+
} from "./chunk-7SBQ7WTV.js";
|
|
5
|
+
import "./chunk-K3ZRBAG5.js";
|
|
6
|
+
import "./chunk-BNIEPGDU.js";
|
|
7
|
+
import "./chunk-RYVHEOHM.js";
|
|
8
|
+
import "./chunk-4YIDX44G.js";
|
|
9
|
+
export {
|
|
10
|
+
SnapshotMismatchError,
|
|
11
|
+
restore
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=restore-7LRP4BM3.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UnhandledRejectionError,
|
|
3
|
+
run
|
|
4
|
+
} from "./chunk-EH5A2EQI.js";
|
|
5
|
+
import "./chunk-U7ZNMTSQ.js";
|
|
6
|
+
import "./chunk-7SBQ7WTV.js";
|
|
7
|
+
import "./chunk-S2GFVXSI.js";
|
|
8
|
+
import "./chunk-SJZWSPWD.js";
|
|
9
|
+
import "./chunk-K3ZRBAG5.js";
|
|
10
|
+
import "./chunk-BNIEPGDU.js";
|
|
11
|
+
import "./chunk-RYVHEOHM.js";
|
|
12
|
+
import "./chunk-4YIDX44G.js";
|
|
13
|
+
export {
|
|
14
|
+
UnhandledRejectionError,
|
|
15
|
+
run
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=run-6SETM7SV.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLintModulesFromRuntimeRegistry
|
|
3
|
+
} from "./chunk-FA5CQO6V.js";
|
|
4
|
+
import "./chunk-BNIEPGDU.js";
|
|
5
|
+
import "./chunk-RYVHEOHM.js";
|
|
6
|
+
import "./chunk-4YIDX44G.js";
|
|
7
|
+
export {
|
|
8
|
+
createLintModulesFromRuntimeRegistry
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=runtime-modules-MCQS2SHQ.js.map
|
package/dist/safe-js/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
async function runCli(argv, options = {}) {
|
|
15
15
|
if (!argv.includes("--help") && !argv.includes("-h")) {
|
|
16
|
-
const runtime = await import("./chunks/cli-runtime-
|
|
16
|
+
const runtime = await import("./chunks/cli-runtime-6QPGM3TX.js");
|
|
17
17
|
return runtime.runCli(argv, options, createUsage());
|
|
18
18
|
}
|
|
19
19
|
const brokenPipe = createBrokenPipeState();
|
|
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
|
|
|
32
32
|
stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
33
33
|
`);
|
|
34
34
|
if (brokenPipe.closed) return 0;
|
|
35
|
-
const { exitCodeForError } = await import("./chunks/cli-runtime-
|
|
35
|
+
const { exitCodeForError } = await import("./chunks/cli-runtime-6QPGM3TX.js");
|
|
36
36
|
return exitCodeForError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/dist/safe-js/core.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
lint
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-3QQYJ4RQ.js";
|
|
4
4
|
import {
|
|
5
5
|
createRealm,
|
|
6
6
|
createReplayableRandom,
|
|
7
7
|
run
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-EH5A2EQI.js";
|
|
9
9
|
import "./chunks/chunk-U7ZNMTSQ.js";
|
|
10
|
-
import "./chunks/chunk-
|
|
11
|
-
import "./chunks/chunk-
|
|
10
|
+
import "./chunks/chunk-7SBQ7WTV.js";
|
|
11
|
+
import "./chunks/chunk-S2GFVXSI.js";
|
|
12
12
|
import "./chunks/chunk-SJZWSPWD.js";
|
|
13
|
-
import "./chunks/chunk-
|
|
13
|
+
import "./chunks/chunk-K3ZRBAG5.js";
|
|
14
14
|
import {
|
|
15
15
|
admitNativePromiseProperties,
|
|
16
16
|
defineExtension
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-BNIEPGDU.js";
|
|
18
18
|
import {
|
|
19
19
|
Budget
|
|
20
|
-
} from "./chunks/chunk-
|
|
20
|
+
} from "./chunks/chunk-RYVHEOHM.js";
|
|
21
21
|
import "./chunks/chunk-4YIDX44G.js";
|
|
22
22
|
export {
|
|
23
23
|
Budget,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HostObjectDefinition, HostObject } from "./interp/host-capabilities.js";
|
|
1
|
+
import type { HostObjectDefinition, HostObject, GuestReference } from "./interp/host-capabilities.js";
|
|
2
2
|
import type { ModuleRegistry } from "./modules/registry.js";
|
|
3
3
|
import type { CallerInjectedBinding } from "./interp/host-bridge.js";
|
|
4
4
|
export type CallbackOptions = {
|
|
@@ -28,6 +28,8 @@ export type ExtensionContext = {
|
|
|
28
28
|
onCleanup(cleanup: () => void | Promise<void>): void;
|
|
29
29
|
chargeWork(units?: number): void;
|
|
30
30
|
createHostObject(definition: HostObjectDefinition): HostObject;
|
|
31
|
+
/** Explicit realm-owned live fixed buffer; default host ingress still copies. */
|
|
32
|
+
createArrayBufferReference(buffer: ArrayBuffer): GuestReference;
|
|
31
33
|
startCallback(callback: unknown, options?: CallbackOptions): CallbackInvocation;
|
|
32
34
|
invokeCallback(callback: unknown, options?: CallbackOptions): Promise<unknown>;
|
|
33
35
|
releaseCallback(callback: unknown): void;
|
package/dist/safe-js/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLintModulesFromRuntimeRegistry
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-FA5CQO6V.js";
|
|
4
4
|
import {
|
|
5
5
|
makeFsModule
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-55RIIUGG.js";
|
|
7
7
|
import {
|
|
8
8
|
makeHarnessModule
|
|
9
|
-
} from "./chunks/chunk-
|
|
9
|
+
} from "./chunks/chunk-XHSOM5CG.js";
|
|
10
10
|
import {
|
|
11
11
|
makeMcpModule
|
|
12
|
-
} from "./chunks/chunk-
|
|
12
|
+
} from "./chunks/chunk-GCOLKRMY.js";
|
|
13
13
|
import {
|
|
14
14
|
AgentSpawnError,
|
|
15
15
|
EnvAccessError,
|
|
@@ -30,13 +30,13 @@ import {
|
|
|
30
30
|
runWithSpawnUsageAccumulator,
|
|
31
31
|
splitFrontmatter,
|
|
32
32
|
supportsSpawnMode
|
|
33
|
-
} from "./chunks/chunk-
|
|
33
|
+
} from "./chunks/chunk-WF7HYDJ4.js";
|
|
34
34
|
import {
|
|
35
35
|
parseMcpConfig
|
|
36
|
-
} from "./chunks/chunk-
|
|
36
|
+
} from "./chunks/chunk-D3GC5QPZ.js";
|
|
37
37
|
import {
|
|
38
38
|
lint
|
|
39
|
-
} from "./chunks/chunk-
|
|
39
|
+
} from "./chunks/chunk-3QQYJ4RQ.js";
|
|
40
40
|
import "./chunks/chunk-OZLTLIHX.js";
|
|
41
41
|
import {
|
|
42
42
|
createRootedSourceResolver
|
|
@@ -46,23 +46,23 @@ import {
|
|
|
46
46
|
createRealm,
|
|
47
47
|
createReplayableRandom,
|
|
48
48
|
run
|
|
49
|
-
} from "./chunks/chunk-
|
|
49
|
+
} from "./chunks/chunk-EH5A2EQI.js";
|
|
50
50
|
import "./chunks/chunk-U7ZNMTSQ.js";
|
|
51
51
|
import {
|
|
52
52
|
restore
|
|
53
|
-
} from "./chunks/chunk-
|
|
53
|
+
} from "./chunks/chunk-7SBQ7WTV.js";
|
|
54
54
|
import {
|
|
55
55
|
dump
|
|
56
|
-
} from "./chunks/chunk-
|
|
56
|
+
} from "./chunks/chunk-S2GFVXSI.js";
|
|
57
57
|
import {
|
|
58
58
|
inspectSnapshotMigration,
|
|
59
59
|
migrateSnapshot,
|
|
60
60
|
migrateSnapshotFile
|
|
61
|
-
} from "./chunks/chunk-
|
|
61
|
+
} from "./chunks/chunk-QL2ALAE6.js";
|
|
62
62
|
import {
|
|
63
63
|
hasOwnErrorCode
|
|
64
64
|
} from "./chunks/chunk-SJZWSPWD.js";
|
|
65
|
-
import "./chunks/chunk-
|
|
65
|
+
import "./chunks/chunk-K3ZRBAG5.js";
|
|
66
66
|
import {
|
|
67
67
|
HostCallResumabilityError,
|
|
68
68
|
HostOperationResumePolicyError,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
deepCopyToSandbox,
|
|
75
75
|
defineExtension,
|
|
76
76
|
registerPendingHostCallPolicy
|
|
77
|
-
} from "./chunks/chunk-
|
|
77
|
+
} from "./chunks/chunk-BNIEPGDU.js";
|
|
78
78
|
import {
|
|
79
79
|
Budget,
|
|
80
80
|
SandboxError,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
parse,
|
|
83
83
|
parseModule,
|
|
84
84
|
parseSourceModule
|
|
85
|
-
} from "./chunks/chunk-
|
|
85
|
+
} from "./chunks/chunk-RYVHEOHM.js";
|
|
86
86
|
import "./chunks/chunk-4YIDX44G.js";
|
|
87
87
|
|
|
88
88
|
// packages/safe-js/src/parse.ts
|
|
@@ -5,7 +5,7 @@ import { type Budget } from "./budget.js";
|
|
|
5
5
|
import { type EvaluationResult } from "./exceptions.js";
|
|
6
6
|
import type { InterpreterError, InterpreterSnapshot, LoopIterationSnapshot } from "./interpreter.js";
|
|
7
7
|
import { CompileScope } from "./regex/compile-guard.js";
|
|
8
|
-
import type
|
|
8
|
+
import { type Scope } from "./scope.js";
|
|
9
9
|
import { type SandboxCallContext, type SandboxClosure, type SandboxGenerator, type SandboxObject, type SandboxPromise, type SandboxValue } from "./values.js";
|
|
10
10
|
export type InterpreterYieldPoint = {
|
|
11
11
|
kind: "await" | "generator-yield" | "loop-iteration";
|
|
@@ -19,6 +19,9 @@ type ResumeBreakpoint = Omit<InterpreterYieldPoint, "snapshot">;
|
|
|
19
19
|
export type AsyncInterpreterError = InterpreterError;
|
|
20
20
|
export type AsyncEvaluationResult = EvaluationResult<AsyncInterpreterError>;
|
|
21
21
|
export type AsyncEvaluationContext = {
|
|
22
|
+
sourceReference?: Readonly<{
|
|
23
|
+
referrer: string;
|
|
24
|
+
}>;
|
|
22
25
|
scriptScope?: Scope;
|
|
23
26
|
evalCompletion?: boolean;
|
|
24
27
|
callee?: SandboxClosure;
|
|
@@ -4,15 +4,16 @@ export type BudgetOptions = {
|
|
|
4
4
|
deadline?: number | Date;
|
|
5
5
|
maxCallDepth?: number;
|
|
6
6
|
stringLength?: number;
|
|
7
|
+
regexSourceLength?: number;
|
|
8
|
+
regexCompileAllocations?: number;
|
|
7
9
|
arrayLength?: number;
|
|
8
10
|
dataSize?: number;
|
|
9
11
|
};
|
|
10
|
-
export declare const REGEX_STEP_LIMIT = 2000;
|
|
11
12
|
export declare const REGEX_COMPILE_LIMITS: Readonly<{
|
|
12
|
-
sourceLength:
|
|
13
|
-
flagsLength:
|
|
14
|
-
depth:
|
|
15
|
-
allocations:
|
|
13
|
+
sourceLength: number;
|
|
14
|
+
flagsLength: number;
|
|
15
|
+
depth: number;
|
|
16
|
+
allocations: number;
|
|
16
17
|
}>;
|
|
17
18
|
export declare class SandboxError extends Error {
|
|
18
19
|
readonly code: "aborted" | "budgetExceeded" | "reentry";
|
|
@@ -31,6 +32,8 @@ type BudgetLimits = {
|
|
|
31
32
|
maxSteps?: number;
|
|
32
33
|
maxCallDepth?: number;
|
|
33
34
|
stringLength?: number;
|
|
35
|
+
regexSourceLength?: number;
|
|
36
|
+
regexCompileAllocations?: number;
|
|
34
37
|
arrayLength?: number;
|
|
35
38
|
dataSize?: number;
|
|
36
39
|
};
|
|
@@ -44,6 +47,8 @@ export type CompileTicket = {
|
|
|
44
47
|
};
|
|
45
48
|
export declare class Budget {
|
|
46
49
|
private accounting;
|
|
50
|
+
private realmView;
|
|
51
|
+
private realmLease;
|
|
47
52
|
constructor(options?: BudgetOptions);
|
|
48
53
|
get deadline(): number | undefined;
|
|
49
54
|
get limits(): Readonly<BudgetLimits>;
|
|
@@ -57,14 +62,19 @@ export declare class Budget {
|
|
|
57
62
|
set peakDataSize(value: number);
|
|
58
63
|
get currentCallDepth(): number;
|
|
59
64
|
set currentCallDepth(value: number);
|
|
65
|
+
acquireDeadline(deadline: number, onExceeded?: (reason: SandboxError) => void): () => void;
|
|
60
66
|
forkRealm(): Budget;
|
|
67
|
+
acquireRealmOwner(): ReturnType<Budget["acquireCompileOwner"]>;
|
|
61
68
|
visitNode(units?: number): void;
|
|
62
69
|
allocateString(value: string): string;
|
|
70
|
+
allocateStringLength(length: number): void;
|
|
63
71
|
allocateArrayLength(length: number): void;
|
|
64
72
|
allocateCollectionEntries(count: number): void;
|
|
65
73
|
reconcileDataUsage(usage: number): void;
|
|
66
74
|
setRetainedDataUsage(owner: object, usage: number): void;
|
|
67
75
|
setRetainedValues(owner: object, values: (() => Iterable<unknown> | undefined) | undefined): void;
|
|
76
|
+
get reconciliationDeferred(): boolean;
|
|
77
|
+
deferReconciliation(): () => void;
|
|
68
78
|
retainedValues(): Iterable<unknown>;
|
|
69
79
|
acquireCompileOwner(reset?: boolean, owner?: CompileOwner): {
|
|
70
80
|
owner: CompileOwner;
|
|
@@ -87,5 +97,4 @@ export declare class Budget {
|
|
|
87
97
|
private checkSampledDeadline;
|
|
88
98
|
private enterDepth;
|
|
89
99
|
}
|
|
90
|
-
export declare function allocateRegexSteps(steps: number): void;
|
|
91
100
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Budget } from "./budget.js";
|
|
2
2
|
import type { SandboxMap, SandboxSet, SandboxValue, SandboxObject } from "./values.js";
|
|
3
|
-
export declare const collectionIteratorPrototypes: WeakMap<Budget, Partial<Record<"
|
|
3
|
+
export declare const collectionIteratorPrototypes: WeakMap<Budget, Partial<Record<"map" | "set", SandboxObject>>>;
|
|
4
4
|
declare const collectionIteratorBrand: unique symbol;
|
|
5
5
|
export type SandboxCollectionIterator = {
|
|
6
6
|
readonly [collectionIteratorBrand]: true;
|
|
@@ -37,6 +37,7 @@ export type CallerInjectedBinding = SandboxValue | CallerInjectedFunction | read
|
|
|
37
37
|
};
|
|
38
38
|
export declare function declareHostOperation<TFunction extends CallerInjectedFunction>(operation: TFunction, policy: PendingHostCallPolicyMode, options?: {
|
|
39
39
|
onReplay?: (args: readonly unknown[], outcome: HostCallOutcome) => void;
|
|
40
|
+
awaitResult?: boolean;
|
|
40
41
|
}): TFunction;
|
|
41
42
|
export declare function readHostOperationPolicy(operation: CallerInjectedFunction): PendingHostCallPolicyMode | undefined;
|
|
42
43
|
export declare function wrapCallerInjectedBindings(bindings: Record<string, CallerInjectedBinding>, options: HostBridgeOptions): Record<string, SandboxValue>;
|
|
@@ -19,6 +19,11 @@ export type HostObjectIndexedDefinition = {
|
|
|
19
19
|
maxLength: number;
|
|
20
20
|
};
|
|
21
21
|
export type HostObjectDefinition = {
|
|
22
|
+
expandos?: {
|
|
23
|
+
maxKeys: number;
|
|
24
|
+
maxKeyCodeUnits: number;
|
|
25
|
+
assertActive?: () => void;
|
|
26
|
+
};
|
|
22
27
|
indexed?: HostObjectIndexedDefinition;
|
|
23
28
|
named?: HostObjectNamedDefinition;
|
|
24
29
|
properties?: Record<string, {
|
|
@@ -40,6 +45,7 @@ export type HostObjectController = {
|
|
|
40
45
|
owner: object;
|
|
41
46
|
assertActive(): void;
|
|
42
47
|
chargeWork(units?: number): void;
|
|
48
|
+
chargeGuestData(units: number): void;
|
|
43
49
|
checkLength(length: number): void;
|
|
44
50
|
checkString(value: string): void;
|
|
45
51
|
checkTemporaryDataSize(size: number): void;
|
|
@@ -64,11 +70,14 @@ export declare function registerGuestCallback(callback: HostOperation, state: Gu
|
|
|
64
70
|
export declare function readGuestCallback(callback: unknown, owner: object): SandboxClosure;
|
|
65
71
|
export declare function revokeGuestCallback(callback: object, owner: object): void;
|
|
66
72
|
export declare function revokeHostObject(value: HostObject, owner: object): void;
|
|
67
|
-
export declare function getHostObjectMember(value: SandboxObject, key: string): SandboxValue;
|
|
68
|
-
export declare function setHostObjectMember(value: SandboxObject, key: string, entry: SandboxValue): void;
|
|
69
|
-
export declare function deleteHostObjectMember(value: SandboxObject, key: string): boolean;
|
|
73
|
+
export declare function getHostObjectMember(value: SandboxObject, key: string | symbol): SandboxValue;
|
|
74
|
+
export declare function setHostObjectMember(value: SandboxObject, key: string | symbol, entry: SandboxValue): void;
|
|
75
|
+
export declare function deleteHostObjectMember(value: SandboxObject, key: string | symbol): boolean;
|
|
70
76
|
export declare function getHostObjectKeys(value: SandboxObject): string[];
|
|
71
|
-
export declare function hasHostObjectMember(value: SandboxObject, key: string, enumerableOnly?: boolean): boolean;
|
|
77
|
+
export declare function hasHostObjectMember(value: SandboxObject, key: string | symbol, enumerableOnly?: boolean): boolean;
|
|
72
78
|
export declare function measureHostObjectData(value: SandboxObject): number;
|
|
73
79
|
export declare function getHostObjectIterator(value: SandboxObject): SandboxIterator | undefined;
|
|
80
|
+
export declare function getHostObjectSymbolKeys(value: SandboxObject): symbol[];
|
|
81
|
+
export declare function hostObjectGuestRoot(value: HostObject | SandboxObject): SandboxObject | undefined;
|
|
82
|
+
export declare function hostObjectGuestRoots(value: HostObject | SandboxObject): SandboxValue[];
|
|
74
83
|
export {};
|
|
@@ -22,7 +22,7 @@ export type LoopIterationSnapshot = number | {
|
|
|
22
22
|
index: number;
|
|
23
23
|
values: InterpreterValue[];
|
|
24
24
|
};
|
|
25
|
-
export type InterpreterErrorCode = "LABEL_NOT_FOUND" | "UNBOUND_IDENTIFIER" | "UNSUPPORTED_NODE";
|
|
25
|
+
export type InterpreterErrorCode = "LABEL_NOT_FOUND" | "UNBOUND_IDENTIFIER" | "UNSUPPORTED_NODE" | "UNCAUGHT_EXCEPTION";
|
|
26
26
|
export type InterpreterError = {
|
|
27
27
|
code: InterpreterErrorCode;
|
|
28
28
|
message: string;
|
|
@@ -44,7 +44,10 @@ export type InterpreterResult = {
|
|
|
44
44
|
stats: InterpreterStats;
|
|
45
45
|
};
|
|
46
46
|
export type InterpretOptions = {
|
|
47
|
+
sourceReference?: AsyncEvaluationContext["sourceReference"];
|
|
47
48
|
modulePhase?: "link" | "evaluate";
|
|
49
|
+
/** Skip unused public bindings; retained data is still reconciled. */
|
|
50
|
+
captureSnapshot?: boolean;
|
|
48
51
|
script?: {
|
|
49
52
|
strict: boolean;
|
|
50
53
|
};
|
|
@@ -61,6 +64,7 @@ export type InterpretOptions = {
|
|
|
61
64
|
scope?: Scope;
|
|
62
65
|
signal?: AbortSignal;
|
|
63
66
|
surfaceUnhandledThrows?: boolean;
|
|
67
|
+
reportUnhandledThrows?: boolean;
|
|
64
68
|
useScopeDirectly?: boolean;
|
|
65
69
|
generatorYield?: (value?: SandboxValue, yieldNodeId?: number, yieldedResult?: SandboxValue) => Promise<GeneratorCompletion>;
|
|
66
70
|
asyncGenerator?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Budget } from "./budget.js";
|
|
2
2
|
import { createNumberFormatter } from "./numberformat-backend.js";
|
|
3
3
|
import type { SandboxCallContext, SandboxClosure, SandboxObject, SandboxValue } from "./values.js";
|
|
4
4
|
export type NumberFormatOptions = Record<string, string | number | boolean>;
|
|
@@ -10,4 +10,4 @@ export declare function numberFormatState(value: unknown): {
|
|
|
10
10
|
format?: SandboxClosure;
|
|
11
11
|
};
|
|
12
12
|
export declare function numberFormatValue(value: SandboxValue, budget: Budget, context?: SandboxCallContext): Promise<number | bigint | string>;
|
|
13
|
-
export declare function formatNumberValue(receiver: unknown, method: "format" | "formatToParts" | "formatRange" | "formatRangeToParts", values: Array<number | bigint | string
|
|
13
|
+
export declare function formatNumberValue(receiver: unknown, method: "format" | "formatToParts" | "formatRange" | "formatRangeToParts", values: Array<number | bigint | string>, budget: Budget): SandboxValue;
|
|
@@ -7,17 +7,23 @@ export type ExecutionControl = {
|
|
|
7
7
|
type ExecutionJob = {
|
|
8
8
|
queue: SandboxJobQueue;
|
|
9
9
|
ownsExecution: boolean;
|
|
10
|
+
attribution?: ReadonlyMap<object, object | undefined>;
|
|
10
11
|
prefixParent?: ExecutionJob;
|
|
11
12
|
keptTargets?: Map<Budget, Set<object | symbol>>;
|
|
12
13
|
};
|
|
14
|
+
export declare function getJobAttribution(key: object): object | undefined;
|
|
15
|
+
export declare function withJobAttribution<Result>(key: object, value: object | undefined, task: () => Result): Result;
|
|
16
|
+
export declare function captureJobAttribution(): <Result>(task: () => Result) => Result;
|
|
13
17
|
export declare class SandboxJobQueue {
|
|
14
18
|
private running;
|
|
15
19
|
private pending;
|
|
16
20
|
private ready;
|
|
17
21
|
private readonly idle;
|
|
22
|
+
private readonly unsettled;
|
|
18
23
|
private generation;
|
|
19
24
|
private controlled;
|
|
20
25
|
private nodesUntilHostTurn;
|
|
26
|
+
private lastHostTurn;
|
|
21
27
|
private pauseRequest?;
|
|
22
28
|
private finished;
|
|
23
29
|
private interruption?;
|
|
@@ -33,6 +39,8 @@ export declare class SandboxJobQueue {
|
|
|
33
39
|
acquire(job: ExecutionJob): Promise<void>;
|
|
34
40
|
release(job: ExecutionJob): void;
|
|
35
41
|
run<T>(task: () => T | Promise<T>): Promise<T>;
|
|
42
|
+
track<T>(pending: Promise<T>): Promise<T>;
|
|
43
|
+
settle(): Promise<void>;
|
|
36
44
|
drain(): Promise<void>;
|
|
37
45
|
private advance;
|
|
38
46
|
}
|
|
@@ -2,7 +2,7 @@ import type { VariableDeclarationKind } from "../parse.js";
|
|
|
2
2
|
import type { PrivateName } from "./private-state.js";
|
|
3
3
|
import type { InterpreterSnapshot, InterpreterValue } from "./interpreter.js";
|
|
4
4
|
import type { ResourceScopeState } from "./resource-management.js";
|
|
5
|
-
import type { SandboxObject } from "./values.js";
|
|
5
|
+
import type { SandboxClosure, SandboxObject, SandboxValue } from "./values.js";
|
|
6
6
|
import type { ModuleEnvironment } from "../modules/registry.js";
|
|
7
7
|
type ScopeLookupResult = {
|
|
8
8
|
found: true;
|
|
@@ -25,6 +25,7 @@ export type BindingReference = {
|
|
|
25
25
|
name: string;
|
|
26
26
|
object: SandboxObject;
|
|
27
27
|
withEnvironment: boolean;
|
|
28
|
+
globalEnvironment?: Scope;
|
|
28
29
|
};
|
|
29
30
|
export type BindingOperations = {
|
|
30
31
|
has(object: SandboxObject, name: string): boolean | Promise<boolean>;
|
|
@@ -39,6 +40,7 @@ type ScopeOptions = {
|
|
|
39
40
|
export type ScopeFrame = {
|
|
40
41
|
simpleCatchParameter?: string;
|
|
41
42
|
globalEnvironment?: boolean;
|
|
43
|
+
globalVarNames?: string[];
|
|
42
44
|
moduleEnvironment?: ModuleEnvironment;
|
|
43
45
|
objectEnvironment?: SandboxObject;
|
|
44
46
|
withObject?: SandboxObject;
|
|
@@ -75,7 +77,7 @@ export declare class Scope {
|
|
|
75
77
|
constructor(bindings?: Record<string, InterpreterValue>, parent?: Scope | undefined, importMeta?: InterpreterValue, options?: ScopeOptions, restoredBindings?: Record<string, InterpreterValue>);
|
|
76
78
|
child(bindings?: Record<string, InterpreterValue>, options?: ScopeOptions): Scope;
|
|
77
79
|
withObject(object: SandboxObject): Scope;
|
|
78
|
-
resolveBinding(name: string, operations: BindingOperations): BindingReference | Promise<BindingReference>;
|
|
80
|
+
resolveBinding(name: string, operations: BindingOperations, globalEnvironment?: Scope): BindingReference | Promise<BindingReference>;
|
|
79
81
|
private resolveObjectBinding;
|
|
80
82
|
declarePrivateName(description: string): PrivateName;
|
|
81
83
|
resolvePrivateName(description: string): PrivateName;
|
|
@@ -88,6 +90,7 @@ export declare class Scope {
|
|
|
88
90
|
};
|
|
89
91
|
hasOwnBinding(name: string): boolean;
|
|
90
92
|
deleteBinding(name: string): boolean;
|
|
93
|
+
deleteGlobalBinding(name: string): boolean;
|
|
91
94
|
getOwnBindingKind(name: string): VariableDeclarationKind | undefined;
|
|
92
95
|
isFunctionBoundary(): boolean;
|
|
93
96
|
iterationChild(names: readonly string[]): Scope;
|
|
@@ -96,11 +99,14 @@ export declare class Scope {
|
|
|
96
99
|
lookupModuleId(): string;
|
|
97
100
|
lookupModuleEnvironment(): ModuleEnvironment | undefined;
|
|
98
101
|
retainedValues(): InterpreterValue[];
|
|
99
|
-
retainedDataRoots(): InterpreterValue[];
|
|
102
|
+
retainedDataRoots(append?: (values: InterpreterValue[]) => void): InterpreterValue[];
|
|
103
|
+
static captureDataRoots(scope: Scope, append: (values: InterpreterValue[]) => void): InterpreterValue[];
|
|
104
|
+
static visitDataRoots(scope: Scope, append: (value: InterpreterValue) => void): void;
|
|
100
105
|
declare(name: string, kind: VariableDeclarationKind, value: InterpreterValue, options?: {
|
|
101
106
|
silentImmutable: true;
|
|
102
107
|
}): void;
|
|
103
108
|
declareImport(name: string, target: Scope, targetName: string): void;
|
|
109
|
+
declareDeferredFunction(name: string, kind: VariableDeclarationKind, create: () => SandboxClosure, collect: (append: (value: SandboxValue) => void) => void): void;
|
|
104
110
|
declareAlias(name: string, target: string): void;
|
|
105
111
|
declareVar(name: string, options?: {
|
|
106
112
|
functionValue?: InterpreterValue;
|
|
@@ -121,8 +127,12 @@ export declare class Scope {
|
|
|
121
127
|
hydrateFrame(frame: ScopeFrame): void;
|
|
122
128
|
copyInitializedBindingsFrom(source: Scope, names: readonly string[]): void;
|
|
123
129
|
private writeBindingValue;
|
|
130
|
+
private readBindingValue;
|
|
124
131
|
private resolveScope;
|
|
125
132
|
private trackReplacement;
|
|
126
133
|
private requireInitializedBinding;
|
|
127
134
|
}
|
|
135
|
+
export declare const captureScopeDataRoots: typeof Scope.captureDataRoots;
|
|
136
|
+
export declare const visitScopeDataRoots: typeof Scope.visitDataRoots;
|
|
137
|
+
export declare function appendScopeDataRoots(values: InterpreterValue[], captured: Iterable<InterpreterValue>, index?: number): number;
|
|
128
138
|
export {};
|