poe-code 10.0.2 → 10.0.3

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.
@@ -14,7 +14,7 @@ import {
14
14
  safeEndSpan,
15
15
  safeRecordException,
16
16
  safeStartSpan
17
- } from "./chunk-RSK47E4C.js";
17
+ } from "./chunk-A2XBEN3H.js";
18
18
 
19
19
  // packages/safejs/src/error/format.ts
20
20
  var DEFAULT_MAX_MESSAGE_LENGTH = 1e4;
@@ -7886,4 +7886,4 @@ export {
7886
7886
  parseMcpConfig,
7887
7887
  makeMcpModule
7888
7888
  };
7889
- //# sourceMappingURL=chunk-EUCMIR4E.js.map
7889
+ //# sourceMappingURL=chunk-MRH5YDMR.js.map
@@ -18,7 +18,7 @@ import {
18
18
  parseMcpConfig,
19
19
  splitFrontmatter,
20
20
  withBrokenPipeGuard
21
- } from "./chunks/chunk-EUCMIR4E.js";
21
+ } from "./chunks/chunk-MRH5YDMR.js";
22
22
  import {
23
23
  Budget,
24
24
  SandboxError,
@@ -30,7 +30,7 @@ import {
30
30
  replaceErrorStack,
31
31
  restore,
32
32
  run
33
- } from "./chunks/chunk-RSK47E4C.js";
33
+ } from "./chunks/chunk-A2XBEN3H.js";
34
34
  import "./chunks/chunk-4YIDX44G.js";
35
35
 
36
36
  // packages/safejs/src/cli.ts
@@ -3,7 +3,7 @@ import {
3
3
  createReplayableRandom,
4
4
  lint,
5
5
  run
6
- } from "./chunks/chunk-RSK47E4C.js";
6
+ } from "./chunks/chunk-A2XBEN3H.js";
7
7
  import "./chunks/chunk-4YIDX44G.js";
8
8
  export {
9
9
  Budget,
@@ -23,7 +23,7 @@ import {
23
23
  runWithSpawnUsageAccumulator,
24
24
  splitFrontmatter,
25
25
  supportsSpawnMode
26
- } from "./chunks/chunk-EUCMIR4E.js";
26
+ } from "./chunks/chunk-MRH5YDMR.js";
27
27
  import {
28
28
  Budget,
29
29
  FileSnapshotBackend,
@@ -45,7 +45,7 @@ import {
45
45
  registerPendingHostCallPolicy,
46
46
  restore,
47
47
  run
48
- } from "./chunks/chunk-RSK47E4C.js";
48
+ } from "./chunks/chunk-A2XBEN3H.js";
49
49
  import "./chunks/chunk-4YIDX44G.js";
50
50
 
51
51
  // packages/safejs/src/runner/run-harness.ts
@@ -44,6 +44,7 @@ export function run(source, options = {}) {
44
44
  const lifecycle = { hostCallbackDepth: 0 };
45
45
  const dumpController = createDumpController(lifecycle);
46
46
  const promiseTracker = createSandboxPromiseRejectionTracker();
47
+ let completedSnapshot;
47
48
  const execute = async () => {
48
49
  const promiseReplay = new PromiseReplay(options.snapshot?.promiseReplay);
49
50
  return promiseReplayContext.run(promiseReplay, async () => {
@@ -289,6 +290,7 @@ export function run(source, options = {}) {
289
290
  if (replayError !== undefined)
290
291
  snapshot.replayError = replayError;
291
292
  dumpController.finalize(snapshot);
293
+ completedSnapshot = snapshot;
292
294
  return {
293
295
  ...result,
294
296
  snapshot
@@ -327,7 +329,18 @@ export function run(source, options = {}) {
327
329
  }
328
330
  });
329
331
  };
330
- const result = withRunResources(options.signal, () => withSandboxPromiseRejectionTracker(promiseTracker, execute));
332
+ const result = withRunResources(options.signal, () => withSandboxPromiseRejectionTracker(promiseTracker, execute)).catch(async (error) => {
333
+ if (completedSnapshot !== undefined) {
334
+ try {
335
+ await createSnapshotScheduler(options).write(completedSnapshot);
336
+ }
337
+ catch (snapshotError) {
338
+ console.warn("Failed to write failure snapshot.", snapshotError);
339
+ }
340
+ }
341
+ dumpController.fail(error);
342
+ throw error;
343
+ });
331
344
  return attachDumpController(result, dumpController);
332
345
  }
333
346
  async function throwIfReturnedPromiseRejected(result) {