@poe-platform/safe-js 0.1.805 → 0.1.806
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 +17 -1
- package/dist/agent-harness-tools/execution-env.d.ts +1 -1
- package/dist/agent-harness-tools/harness-dashboard.d.ts +2 -1
- package/dist/agent-harness-tools/poe-command-execution.d.ts +5 -3
- package/dist/agent-harness-tools/runner.d.ts +1 -1
- package/dist/agent-harness-tools/workspace-transfer.d.ts +2 -2
- package/dist/poe-acp-client/acp-transport.d.ts +1 -1
- package/dist/poe-code-config/memory.d.ts +1 -0
- package/dist/poe-code-config/runtime.d.ts +5 -2
- package/dist/process-runner/types.d.ts +1 -1
- package/dist/process-runner/workspace-transfer.d.ts +6 -5
- package/dist/safe-js/chunks/{chunk-KMBCLXER.js → chunk-2IYZK337.js} +1 -1
- package/dist/safe-js/chunks/{chunk-WNCT5WTP.js → chunk-3W4JJFK6.js} +1 -1
- package/dist/safe-js/chunks/{chunk-GJPD4ALZ.js → chunk-425IYA26.js} +1 -1
- package/dist/safe-js/chunks/{chunk-2LI4AP6C.js → chunk-5FPEN6AM.js} +8 -7
- package/dist/safe-js/chunks/{chunk-NOS76GMS.js → chunk-5ZVTZBH2.js} +1 -1
- package/dist/safe-js/chunks/{chunk-N3EL5B4L.js → chunk-7RGEML7S.js} +5 -4
- package/dist/safe-js/chunks/{chunk-VQKUOXQ2.js → chunk-BEA7FA5M.js} +9 -2
- package/dist/safe-js/chunks/{chunk-WZ27FAD3.js → chunk-C5NG3LHQ.js} +3 -3
- package/dist/safe-js/chunks/{chunk-HFCSCNZN.js → chunk-E7V44LSN.js} +54 -47
- package/dist/safe-js/chunks/{chunk-VVOPJZRG.js → chunk-H25SH6HQ.js} +3 -1
- package/dist/safe-js/chunks/{chunk-AN6Z3R6M.js → chunk-MJH5AYEK.js} +1 -1
- package/dist/safe-js/chunks/{chunk-JQ5QJV5Q.js → chunk-P5Y4UF4L.js} +2 -2
- package/dist/safe-js/chunks/{chunk-JVE54EBX.js → chunk-ROIZEQTS.js} +7 -4
- package/dist/safe-js/chunks/{chunk-HR3HSM26.js → chunk-SAYUBVHD.js} +2 -2
- package/dist/safe-js/chunks/{chunk-IRCZI6HL.js → chunk-SV37HEM5.js} +4 -4
- package/dist/safe-js/chunks/{chunk-RPGCF4KE.js → chunk-TG7TRXYG.js} +49 -2
- package/dist/safe-js/chunks/{chunk-ECMGBHAB.js → chunk-XQOJJA4C.js} +11 -65
- package/dist/safe-js/chunks/{cli-runtime-6EBUM6AL.js → cli-runtime-EV4DQ7UW.js} +16 -16
- package/dist/safe-js/chunks/{dump-S6HOPYA6.js → dump-OX7M4C56.js} +3 -3
- package/dist/safe-js/chunks/{harness-GQGDTZ5P.js → harness-4BETCNJY.js} +3 -3
- package/dist/safe-js/chunks/mcp-DSJET2K4.js +12 -0
- package/dist/safe-js/chunks/{migration-file-BJVZMCID.js → migration-file-6LFFQLZN.js} +5 -5
- package/dist/safe-js/chunks/{restore-GU6CISV6.js → restore-BFVCW6H4.js} +4 -4
- package/dist/safe-js/chunks/{run-STNASYDW.js → run-PWX3SVTF.js} +7 -7
- package/dist/safe-js/chunks/{runtime-modules-5MQCTIB5.js → runtime-modules-UOVJSSD7.js} +3 -3
- package/dist/safe-js/chunks/{source-files-A2WSOO6G.js → source-files-QT24SQTE.js} +3 -3
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.d.ts +3 -0
- package/dist/safe-js/core.js +19 -13
- package/dist/safe-js/host-context.d.ts +5 -0
- package/dist/safe-js/index.d.ts +1 -0
- package/dist/safe-js/index.js +22 -20
- package/dist/safe-js/interp/host-bridge.d.ts +2 -0
- package/dist/safe-js/interp/resources.d.ts +23 -0
- package/dist/safe-js/modules/fs-config.d.ts +1 -1
- package/dist/safe-js/modules/fs.js +4 -4
- package/dist/safe-js/modules/mcp-transport.d.ts +1 -1
- package/dist/safe-js/modules/registry.d.ts +2 -0
- package/dist/safe-js/platform/context.js +19 -8
- package/dist/safe-js/platform/node.d.ts +1 -0
- package/dist/safe-js/platform/node.js +1 -0
- package/dist/safe-js/platform/workerd.d.ts +1 -0
- package/dist/safe-js/platform/workerd.js +1 -0
- package/dist/safe-js/portable/chunks/{chunk-W6MZOTYR.js → chunk-LCUQNFD2.js} +17 -7
- package/dist/safe-js/portable/chunks/{chunk-NLGXLZCK.js → chunk-MKRVEJD6.js} +1 -1
- package/dist/safe-js/portable/chunks/{chunk-OCBLPMJE.js → chunk-OCBYWLKS.js} +7 -4
- package/dist/safe-js/portable/chunks/{source-files-AEDWESAJ.js → source-files-HMG6KJLP.js} +2 -2
- package/dist/safe-js/portable/core.js +56 -4
- package/dist/safe-js/portable/modules/fs.js +2 -2
- package/dist/safe-js/workerd.d.ts +1 -2
- package/dist/safe-js/workerd.js +11645 -831
- package/package.json +2 -2
- package/dist/safe-js/chunks/mcp-MILSUBPS.js +0 -11
package/README.md
CHANGED
|
@@ -10,6 +10,20 @@ Complete ECMAScript conformance has not been established; see
|
|
|
10
10
|
|
|
11
11
|
Under `workerd` and `browser` conditions, the standalone root and `/core` exports select the portable interpreter with parsing (`parse`, `parseModule`, `parseSourceModule`), checkpoints (`dump`, `restore`), sandbox copy helpers, error classes, `declareHostOperation`, `makeFsModule`, `makeEnvModule`, `makeTimeModule`, `makeFailModule`, `makeMetricModule`, and `makeHarnessModule`. The `/modules/fs` entry is also portable; supply a filesystem adapter for host file access.
|
|
12
12
|
|
|
13
|
+
Worker hosts must supply trusted data, native built-ins, callbacks, and ordinary native Promises. Do not pass untrusted host Proxies or Promise constructor/species accessors into the interpreter: portable proxy checks recognize interpreter-tracked proxies, and native Promise probes may consult constructor/species properties. Guest code remains interpreted; this host contract does not make arbitrary native JavaScript a sandboxed input.
|
|
14
|
+
|
|
15
|
+
Without host-provided asynchronous context storage, portable context is stack-scoped. Call `captureHostContext()` inside a host operation before awaiting or scheduling work, then use its returned function around each context-sensitive continuation. Captures keep concurrent operations isolated and preserve disabled-context retirement; they do not automatically propagate through further native `await` expressions. Release captured functions when the operation finishes.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { captureHostContext } from "@poe-platform/safe-js";
|
|
19
|
+
|
|
20
|
+
async function hostOperation(callback) {
|
|
21
|
+
const resume = captureHostContext();
|
|
22
|
+
const value = await externalWork();
|
|
23
|
+
return resume(() => callback(value));
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
13
27
|
## Quickstart
|
|
14
28
|
|
|
15
29
|
Install the public ESM package. Its declared Node.js minimum is 18.18+, but
|
|
@@ -551,7 +565,9 @@ Factories return exports to register in `modules`; calling a factory alone does
|
|
|
551
565
|
|
|
552
566
|
`spawn.retry(definition, options, retryOptions)` and `defaultRetry` use `{ maxAttempts, backoffMs, isErrorRetryable?, isRetryable? }`. `spawn.parallel(calls, options?)` accepts definition/options tuples or spawn-handle factories; options are `check`, `maxConcurrent`, `failFast`, and `signal`. Usage helpers are `createSpawnUsageAccumulator()` and `runWithSpawnUsageAccumulator(accumulator, operation)`.
|
|
553
567
|
|
|
554
|
-
|
|
568
|
+
The `./workerd` entrypoint exposes the same SDK exports as the Node entrypoint, including HTTP MCP and snapshot migration. Use an explicit process adapter for stdio MCP on Workers.
|
|
569
|
+
|
|
570
|
+
**Config files.** `parseMcpConfig(json, directory)` accepts `servers` and the three numeric MCP limits, resolving stdio paths against `directory`. `parseFsConfig(json)` accepts `{ adapter: { type, options }, root?, cwd?, readFileMaxBytes?, hostReadMemoryLimit? }`; `resolveFsConfig(config, { registry? })` constructs the adapter for `makeFsModule`. Node built-in types are `memory` and `real`; `real` requires an absolute host `options.root`. The `./core` and `./workerd` entrypoints also expose these filesystem config helpers. Under Worker conditions, the default registry contains only `memory`; pass other adapters explicitly through `registry`. Outer `root`/`cwd` are absolute virtual paths. Custom registry descriptors supply `validateOptions` and `create`. `maxSymlinkFollows` optionally bounds dangling-symlink canonicalization for rooted filesystem modules; it defaults to `Infinity` and accepts the same finite values through filesystem JSON configuration. Actual symlink cycles still fail. Signals and injected functions are SDK options, not JSON fields.
|
|
555
571
|
|
|
556
572
|
</details>
|
|
557
573
|
|
|
@@ -34,7 +34,7 @@ export interface OpenSpec {
|
|
|
34
34
|
stderr?: RunSpec["stderr"];
|
|
35
35
|
env?: RunSpec["env"];
|
|
36
36
|
tty?: boolean;
|
|
37
|
-
input?: string |
|
|
37
|
+
input?: string | Uint8Array;
|
|
38
38
|
captureOutput?: boolean;
|
|
39
39
|
/** Keep stdout callbacks and draining, without retaining its full text when false. */
|
|
40
40
|
captureStdout?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { dashboard, Dashboard, DashboardOptions } from "../toolcraft-design/index.js";
|
|
2
2
|
import type { RunQueue } from "./run-queue.js";
|
|
3
3
|
/** One view for an entire harness sequence, including work added while it runs. */
|
|
4
4
|
export declare function createHarnessDashboard(options: {
|
|
@@ -8,6 +8,7 @@ export declare function createHarnessDashboard(options: {
|
|
|
8
8
|
cwd: string;
|
|
9
9
|
queue: RunQueue;
|
|
10
10
|
validatePlan?: (path: string) => Promise<string>;
|
|
11
|
+
dashboardFactory?: (options: DashboardOptions) => Dashboard;
|
|
11
12
|
}): {
|
|
12
13
|
dashboard: dashboard.Dashboard;
|
|
13
14
|
start(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FileSystem } from "@poe-platform/safe-fs/contracts";
|
|
2
|
+
import type { RunnerScope, ResolvedConfig, StateManager } from "../poe-code-config/core.js";
|
|
2
3
|
import { selectExecutionEnv, type OpenSpec } from "./execution-env.js";
|
|
3
4
|
export type RuntimeOverrideOptions = {
|
|
4
5
|
runtime?: "host" | "docker";
|
|
@@ -18,14 +19,15 @@ export declare function resolvePoeCommandExecution(input: {
|
|
|
18
19
|
context?: {
|
|
19
20
|
homeDir?: string;
|
|
20
21
|
state?: StateManager;
|
|
22
|
+
fs?: Pick<FileSystem, "readFile" | "stat" | "realpath">;
|
|
21
23
|
};
|
|
22
24
|
openSpec?: Partial<Pick<OpenSpec, "execution" | "shellSpec">>;
|
|
23
|
-
}): {
|
|
25
|
+
}): Promise<{
|
|
24
26
|
factory: ReturnType<typeof selectExecutionEnv>;
|
|
25
27
|
openSpec: OpenSpec;
|
|
26
28
|
detach: boolean;
|
|
27
29
|
state: StateManager;
|
|
28
|
-
}
|
|
30
|
+
}>;
|
|
29
31
|
/** Raised when a requested runner capability is not offered by the resolved execution env. */
|
|
30
32
|
export declare class UnsupportedRuntimeCapabilityError extends Error {
|
|
31
33
|
constructor(message: string);
|
|
@@ -5,7 +5,7 @@ export interface WorkflowFileStat {
|
|
|
5
5
|
mtimeMs: number;
|
|
6
6
|
}
|
|
7
7
|
export interface WorkflowFileSystem {
|
|
8
|
-
readFile(path: string, encoding:
|
|
8
|
+
readFile(path: string, encoding: "utf8"): Promise<string>;
|
|
9
9
|
mkdir(path: string, options?: {
|
|
10
10
|
recursive?: boolean;
|
|
11
11
|
}): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { downloadWorkspace, uploadWorkspace } from "../process-runner/
|
|
2
|
-
export type { WorkspaceDownloadOptions, WorkspaceTransferDirent, WorkspaceTransferEnv, WorkspaceTransferFileSystem, WorkspaceTransferOptions, WorkspaceTransferRunnerOptions, WorkspaceTransferStats } from "../process-runner/
|
|
1
|
+
export { downloadWorkspace, uploadWorkspace } from "../process-runner/workspace-transfer.js";
|
|
2
|
+
export type { WorkspaceDownloadOptions, WorkspaceTransferDirent, WorkspaceTransferEnv, WorkspaceTransferFileSystem, WorkspaceTransferOptions, WorkspaceTransferRunnerOptions, WorkspaceTransferStats } from "../process-runner/workspace-transfer.js";
|
|
3
3
|
export type { DownloadResult, UploadResult } from "./execution-env.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChildProcessWithoutNullStreams, SpawnOptionsWithoutStdio } from "node:child_process";
|
|
2
2
|
import { type JsonRpcNotificationHandler, type JsonRpcRequestHandler, type JsonRpcRequestOptions } from "./jsonrpc-message-layer.js";
|
|
3
3
|
import type { AuthenticateRequest, AuthenticateResponse, CancelNotification, CreateTerminalRequest, CreateTerminalResponse, InitializeRequest, InitializeResponse, KillTerminalCommandRequest, KillTerminalCommandResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, ReleaseTerminalRequest, ReleaseTerminalResponse, RequestId, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, TerminalOutputRequest, TerminalOutputResponse, WaitForTerminalExitRequest, WaitForTerminalExitResponse, WriteTextFileRequest, WriteTextFileResponse } from "./types.js";
|
|
4
4
|
interface AcpRequestShape<TParams, TResult> {
|
|
@@ -12,3 +12,4 @@ export declare function configuredTimeout(options: MemoryConfigOptions): Promise
|
|
|
12
12
|
export declare function cacheEnabled(options: MemoryConfigOptions): Promise<boolean>;
|
|
13
13
|
export declare function mcpWritesAllowed(options: MemoryConfigOptions): Promise<boolean>;
|
|
14
14
|
export declare function defaultQueryBudget(options: MemoryConfigOptions): Promise<number>;
|
|
15
|
+
export { readMergedDocumentReadonly } from "./store.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FileSystem } from "@poe-platform/safe-fs/contracts";
|
|
1
2
|
import type { ResolvedConfig } from "./types.js";
|
|
2
3
|
export interface RuntimeMount {
|
|
3
4
|
source: string;
|
|
@@ -38,6 +39,7 @@ export interface RuntimeResolveResult {
|
|
|
38
39
|
dockerfilePath: string | null;
|
|
39
40
|
buildContext: string | null;
|
|
40
41
|
}
|
|
42
|
+
type RuntimeFileSystem = Pick<FileSystem, "stat" | "realpath">;
|
|
41
43
|
export declare const runtimeConfigScope: {
|
|
42
44
|
scope: string;
|
|
43
45
|
schema: {
|
|
@@ -104,10 +106,11 @@ export declare const runtimeConfigScope: {
|
|
|
104
106
|
};
|
|
105
107
|
export declare function parseRunner(raw: unknown): RunnerScope;
|
|
106
108
|
export declare function parseRuntime(raw: unknown): RuntimeConfig;
|
|
107
|
-
export declare function resolveRuntime({ cwd, config }: {
|
|
109
|
+
export declare function resolveRuntime({ cwd, config, fs }: {
|
|
108
110
|
cwd: string;
|
|
109
111
|
config: Pick<ResolvedConfig, "runtime">;
|
|
110
|
-
|
|
112
|
+
fs?: RuntimeFileSystem;
|
|
113
|
+
}): Promise<RuntimeResolveResult>;
|
|
111
114
|
declare function parseBuildArgs(value: unknown): Record<string, string>;
|
|
112
115
|
declare function parseMounts(value: unknown): RuntimeMount[];
|
|
113
116
|
declare function parseOptionalStringArray(value: unknown, key?: string): string[] | undefined;
|
|
@@ -59,7 +59,7 @@ export interface OpenSpec {
|
|
|
59
59
|
stderr?: RunSpec["stderr"];
|
|
60
60
|
env?: RunSpec["env"];
|
|
61
61
|
tty?: boolean;
|
|
62
|
-
input?: string |
|
|
62
|
+
input?: string | Uint8Array;
|
|
63
63
|
captureOutput?: boolean;
|
|
64
64
|
/** Keep stdout callbacks and draining, without retaining its full text when false. */
|
|
65
65
|
captureStdout?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FileSystem } from "@poe-platform/safe-fs/contracts";
|
|
1
2
|
import type { DownloadResult, UploadResult } from "./types.js";
|
|
2
3
|
export type { DownloadResult, UploadResult } from "./types.js";
|
|
3
4
|
export interface WorkspaceTransferDirent {
|
|
@@ -19,9 +20,9 @@ export interface WorkspaceTransferFileSystem {
|
|
|
19
20
|
readdir(path: string, options: {
|
|
20
21
|
withFileTypes: true;
|
|
21
22
|
}): Promise<WorkspaceTransferDirent[]>;
|
|
22
|
-
readFile(path: string): Promise<
|
|
23
|
-
readFile(path: string, encoding:
|
|
24
|
-
writeFile(path: string, data: string |
|
|
23
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
24
|
+
readFile(path: string, encoding: "utf8"): Promise<string>;
|
|
25
|
+
writeFile(path: string, data: string | Uint8Array, options?: {
|
|
25
26
|
flag?: string;
|
|
26
27
|
mode?: number;
|
|
27
28
|
}): Promise<void>;
|
|
@@ -39,8 +40,8 @@ export interface WorkspaceTransferEnv {
|
|
|
39
40
|
cwd: string;
|
|
40
41
|
uploadDir: string;
|
|
41
42
|
workspaceDir?: string;
|
|
42
|
-
fs?: WorkspaceTransferFileSystem;
|
|
43
|
-
remoteFs?: WorkspaceTransferFileSystem;
|
|
43
|
+
fs?: WorkspaceTransferFileSystem | FileSystem;
|
|
44
|
+
remoteFs?: WorkspaceTransferFileSystem | FileSystem;
|
|
44
45
|
}
|
|
45
46
|
export interface WorkspaceTransferOptions {
|
|
46
47
|
runner?: WorkspaceTransferRunnerOptions;
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
} from "./chunk-ONWFPHUI.js";
|
|
8
8
|
import {
|
|
9
9
|
restore
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SAYUBVHD.js";
|
|
11
11
|
import {
|
|
12
12
|
hashParsedAst,
|
|
13
13
|
hashSource
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MJH5AYEK.js";
|
|
15
15
|
import {
|
|
16
16
|
attachDumpController,
|
|
17
17
|
createDumpController
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3W4JJFK6.js";
|
|
19
19
|
import {
|
|
20
20
|
DUMP_FORMAT_VERSION,
|
|
21
21
|
EXECUTION_SEMANTICS,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
wrapCallerInjectedBindings,
|
|
108
108
|
wrapCancelableBindings,
|
|
109
109
|
wrapHostConstructor
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-ROIZEQTS.js";
|
|
111
111
|
import {
|
|
112
112
|
Budget,
|
|
113
113
|
CompileScope,
|
|
@@ -125,13 +125,13 @@ import {
|
|
|
125
125
|
} from "./chunk-EQUBWQJN.js";
|
|
126
126
|
import {
|
|
127
127
|
dirname
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-2IYZK337.js";
|
|
129
129
|
import {
|
|
130
130
|
AsyncLocalStorage,
|
|
131
131
|
createHostCallbackContext,
|
|
132
132
|
hostFs,
|
|
133
133
|
types
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-H25SH6HQ.js";
|
|
135
135
|
|
|
136
136
|
// packages/safe-js/src/modules/source-graph.ts
|
|
137
137
|
var ambiguous = /* @__PURE__ */ Symbol("ambiguous module export");
|
|
@@ -801,6 +801,7 @@ var RealmState = class {
|
|
|
801
801
|
nestedDepth = 0;
|
|
802
802
|
failure;
|
|
803
803
|
bridgeOptions = () => ({
|
|
804
|
+
resources: this.resources,
|
|
804
805
|
budget: this.budget,
|
|
805
806
|
compileOwner: this.lease.owner,
|
|
806
807
|
signal: this.controller.signal,
|
|
@@ -2339,7 +2340,7 @@ function run(source, options = {}) {
|
|
|
2339
2340
|
throw new TypeError("Source resolution requires sourceType: 'module'.");
|
|
2340
2341
|
if (options.sourceRoot !== void 0) {
|
|
2341
2342
|
if (options.sourceResolver !== void 0) throw new TypeError("Specify sourceRoot or sourceResolver, not both.");
|
|
2342
|
-
const { createRootedSourceResolver } = await import("./source-files-
|
|
2343
|
+
const { createRootedSourceResolver } = await import("./source-files-QT24SQTE.js");
|
|
2343
2344
|
const { sourceRoot, ...resolved } = options;
|
|
2344
2345
|
const sourceResolver = await createRootedSourceResolver(sourceRoot);
|
|
2345
2346
|
return runWithExtensions(source, { ...resolved, filename: await sourceResolver.entryId(options.filename), sourceResolver }, jobs);
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
McpError,
|
|
3
3
|
connectMcpTransport,
|
|
4
4
|
normalizeMcpOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E7V44LSN.js";
|
|
6
6
|
import {
|
|
7
7
|
declareHostOperation,
|
|
8
8
|
runResources
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ROIZEQTS.js";
|
|
10
10
|
import {
|
|
11
11
|
hostErrorData
|
|
12
12
|
} from "./chunk-EQUBWQJN.js";
|
|
@@ -34,13 +34,14 @@ function makeMcpModule(connectMcp) {
|
|
|
34
34
|
return current.ready;
|
|
35
35
|
};
|
|
36
36
|
const invoke = async (operation) => {
|
|
37
|
+
const scope = runResources.getStore();
|
|
37
38
|
try {
|
|
38
39
|
const result = await operation(await connection());
|
|
39
|
-
|
|
40
|
+
scope?.signal.throwIfAborted();
|
|
40
41
|
options.signal?.throwIfAborted();
|
|
41
42
|
return result;
|
|
42
43
|
} catch (error) {
|
|
43
|
-
|
|
44
|
+
scope?.signal.throwIfAborted();
|
|
44
45
|
options.signal?.throwIfAborted();
|
|
45
46
|
if (error instanceof McpError) {
|
|
46
47
|
hostErrorData.set(error, {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
restore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SAYUBVHD.js";
|
|
4
4
|
import {
|
|
5
5
|
createSeededRandom,
|
|
6
6
|
deepCopyFromSandbox
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ROIZEQTS.js";
|
|
8
8
|
import {
|
|
9
9
|
parse,
|
|
10
10
|
parseModule,
|
|
11
11
|
parseSourceModule
|
|
12
12
|
} from "./chunk-EQUBWQJN.js";
|
|
13
|
+
import {
|
|
14
|
+
AsyncLocalStorage
|
|
15
|
+
} from "./chunk-H25SH6HQ.js";
|
|
13
16
|
|
|
14
17
|
// packages/safe-js/src/parse.ts
|
|
15
18
|
var parse2 = parse;
|
|
16
19
|
|
|
20
|
+
// packages/safe-js/src/host-context.ts
|
|
21
|
+
var captureHostContext = AsyncLocalStorage.snapshot;
|
|
22
|
+
|
|
17
23
|
// packages/safe-js/src/modules/time.ts
|
|
18
24
|
function makeTimeModule(options = {}) {
|
|
19
25
|
const hasDeterministicRandom = options.random !== void 0 || options.seed !== void 0;
|
|
@@ -92,6 +98,7 @@ var restore2 = restore;
|
|
|
92
98
|
var deepCopyFromSandbox2 = deepCopyFromSandbox;
|
|
93
99
|
|
|
94
100
|
export {
|
|
101
|
+
captureHostContext,
|
|
95
102
|
parse2 as parse,
|
|
96
103
|
makeTimeModule,
|
|
97
104
|
parseModule2 as parseModule,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
declareBudgetedHostOperation,
|
|
9
9
|
declareHostOperation
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ROIZEQTS.js";
|
|
11
11
|
import {
|
|
12
12
|
basename,
|
|
13
13
|
dirname,
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
relative,
|
|
16
16
|
resolve,
|
|
17
17
|
sep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2IYZK337.js";
|
|
19
19
|
import {
|
|
20
20
|
accessDeniedSystemError,
|
|
21
21
|
constants,
|
|
22
22
|
hostFs,
|
|
23
23
|
hostPlatform,
|
|
24
24
|
inspect
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-H25SH6HQ.js";
|
|
26
26
|
|
|
27
27
|
// packages/safe-js/src/modules/fs.ts
|
|
28
28
|
import { createFsBridge } from "@poe-platform/safe-fs/core";
|