poe-code 11.0.23 → 11.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "11.0.23",
3
+ "version": "11.0.25",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-3627FMJF.js";
30
+ } from "./chunk-DXJLYASS.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-LRGHMX22.js.map
8058
+ //# sourceMappingURL=chunk-BGO2B5YI.js.map
@@ -16961,7 +16961,7 @@ function serializeArray(value, serializeValue) {
16961
16961
 
16962
16962
  // packages/safejs/src/snapshot/dump-format.ts
16963
16963
  var DUMP_FORMAT_VERSION = 1;
16964
- var EXECUTION_SEMANTICS = "jobs-v6";
16964
+ var EXECUTION_SEMANTICS = "jobs-v7";
16965
16965
  var SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
16966
16966
  function serializeSafeJSSnapshot(snapshot) {
16967
16967
  const replayError = Object.getOwnPropertyDescriptor(snapshot, "replayError");
@@ -21309,9 +21309,11 @@ function shouldIncludeTemplateRaw(record2, key, includeTemplateRaw) {
21309
21309
 
21310
21310
  // packages/safejs/src/snapshot/migration.ts
21311
21311
  function validateMigrationSemantics(value) {
21312
- if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6"].includes(value))
21312
+ if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6", "jobs-v7"].includes(
21313
+ value
21314
+ ))
21313
21315
  throw new TypeError(
21314
- "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v6)."
21316
+ "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v7)."
21315
21317
  );
21316
21318
  }
21317
21319
  function validateMigrationJournal(sourceHash, replay, hostCalls = []) {
@@ -21408,7 +21410,7 @@ function restore(snapshot, options) {
21408
21410
  assertSnapshotInactive(snapshot);
21409
21411
  validateDumpEnvelope(snapshot);
21410
21412
  validateSnapshotMigration(snapshot.migration, snapshot.sourceHash);
21411
- if (snapshot.executionSemantics !== EXECUTION_SEMANTICS && (snapshot.executionSemantics !== void 0 || snapshot.promiseReplay !== void 0 || snapshot.replay !== void 0 || snapshot.initialInputs !== void 0)) {
21413
+ if (snapshot.executionSemantics !== EXECUTION_SEMANTICS && snapshot.executionSemantics !== "jobs-v6" && (snapshot.executionSemantics !== void 0 || snapshot.promiseReplay !== void 0 || snapshot.replay !== void 0 || snapshot.initialInputs !== void 0)) {
21412
21414
  throw new SnapshotValidationError(
21413
21415
  "unsupportedVersion",
21414
21416
  "$.executionSemantics",
@@ -23942,7 +23944,7 @@ function isAssignableSandboxTarget(value) {
23942
23944
  return typeof value === "object" && value !== null && !isSandboxClosure(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isSandboxPromise(value) && !isSandboxRegex(value);
23943
23945
  }
23944
23946
  async function arrayFromSandboxValues(args, budget) {
23945
- const [items, mapFn] = args;
23947
+ const [items, mapFn, thisValue] = args;
23946
23948
  const iterator = getSandboxIterator(items);
23947
23949
  const values = iterator === void 0 ? Reflect.apply(Array.from, Array, [items]) : await collectIteratorValues(iterator);
23948
23950
  if (mapFn === void 0 || !isSandboxClosure(mapFn)) {
@@ -23953,7 +23955,7 @@ async function arrayFromSandboxValues(args, budget) {
23953
23955
  }
23954
23956
  const mappedValues = [];
23955
23957
  for (const [index, value] of values.entries()) {
23956
- const result = await mapFn.call([value, index]);
23958
+ const result = await mapFn.call([value, index], { stack: [], thisValue });
23957
23959
  if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) {
23958
23960
  await result.synchronousPrefix;
23959
23961
  }
@@ -24116,17 +24118,17 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
24116
24118
  switch (methodName) {
24117
24119
  case "map":
24118
24120
  return budgetProducedValue(
24119
- await mapArray(value, getRequiredCallback(methodName, args[0]), options, stack),
24121
+ await mapArray(value, getRequiredCallback(methodName, args[0]), options, stack, args[1]),
24120
24122
  options.budget
24121
24123
  );
24122
24124
  case "filter":
24123
24125
  return budgetProducedValue(
24124
- await filterArray(value, getRequiredCallback(methodName, args[0]), options, stack),
24126
+ await filterArray(value, getRequiredCallback(methodName, args[0]), options, stack, args[1]),
24125
24127
  options.budget
24126
24128
  );
24127
24129
  case "find":
24128
24130
  return budgetProducedValue(
24129
- await findInArray(value, getRequiredCallback(methodName, args[0]), options, stack),
24131
+ await findInArray(value, getRequiredCallback(methodName, args[0]), options, stack, args[1]),
24130
24132
  options.budget
24131
24133
  );
24132
24134
  case "findIndex":
@@ -24134,11 +24136,18 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
24134
24136
  value,
24135
24137
  getRequiredCallback(methodName, args[0]),
24136
24138
  options,
24137
- stack
24139
+ stack,
24140
+ args[1]
24138
24141
  );
24139
24142
  case "findLast":
24140
24143
  return budgetProducedValue(
24141
- await findLastInArray(value, getRequiredCallback(methodName, args[0]), options, stack),
24144
+ await findLastInArray(
24145
+ value,
24146
+ getRequiredCallback(methodName, args[0]),
24147
+ options,
24148
+ stack,
24149
+ args[1]
24150
+ ),
24142
24151
  options.budget
24143
24152
  );
24144
24153
  case "findLastIndex":
@@ -24146,12 +24155,25 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
24146
24155
  value,
24147
24156
  getRequiredCallback(methodName, args[0]),
24148
24157
  options,
24149
- stack
24158
+ stack,
24159
+ args[1]
24150
24160
  );
24151
24161
  case "some":
24152
- return await someInArray(value, getRequiredCallback(methodName, args[0]), options, stack);
24162
+ return await someInArray(
24163
+ value,
24164
+ getRequiredCallback(methodName, args[0]),
24165
+ options,
24166
+ stack,
24167
+ args[1]
24168
+ );
24153
24169
  case "every":
24154
- return await everyInArray(value, getRequiredCallback(methodName, args[0]), options, stack);
24170
+ return await everyInArray(
24171
+ value,
24172
+ getRequiredCallback(methodName, args[0]),
24173
+ options,
24174
+ stack,
24175
+ args[1]
24176
+ );
24155
24177
  case "reduce":
24156
24178
  return budgetProducedValue(
24157
24179
  await reduceArray(
@@ -24177,11 +24199,17 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
24177
24199
  options.budget
24178
24200
  );
24179
24201
  case "forEach":
24180
- await forEachArray(value, getRequiredCallback(methodName, args[0]), options, stack);
24202
+ await forEachArray(value, getRequiredCallback(methodName, args[0]), options, stack, args[1]);
24181
24203
  return void 0;
24182
24204
  case "flatMap":
24183
24205
  return budgetProducedValue(
24184
- await flatMapArray(value, getRequiredCallback(methodName, args[0]), options, stack),
24206
+ await flatMapArray(
24207
+ value,
24208
+ getRequiredCallback(methodName, args[0]),
24209
+ options,
24210
+ stack,
24211
+ args[1]
24212
+ ),
24185
24213
  options.budget
24186
24214
  );
24187
24215
  case "flat":
@@ -24318,83 +24346,91 @@ function getRequiredCallback(methodName, value) {
24318
24346
  }
24319
24347
  return value;
24320
24348
  }
24321
- async function mapArray(value, callback, options, stack) {
24349
+ async function mapArray(value, callback, options, stack, thisValue) {
24322
24350
  const length = value.length;
24323
24351
  const result = new Array(length);
24324
24352
  for (let index = 0; index < length; index += 1) {
24325
24353
  if (!(index in value)) {
24326
24354
  continue;
24327
24355
  }
24328
- result[index] = await callArrayCallback(callback, value[index], index, value, options, stack);
24356
+ result[index] = await callArrayCallback(
24357
+ callback,
24358
+ value[index],
24359
+ index,
24360
+ value,
24361
+ options,
24362
+ stack,
24363
+ thisValue
24364
+ );
24329
24365
  }
24330
24366
  return result;
24331
24367
  }
24332
- async function filterArray(value, callback, options, stack) {
24368
+ async function filterArray(value, callback, options, stack, thisValue) {
24333
24369
  const length = value.length;
24334
24370
  const result = [];
24335
24371
  for (let index = 0; index < length; index += 1) {
24336
24372
  if (!(index in value)) {
24337
24373
  continue;
24338
24374
  }
24339
- if (await callArrayCallback(callback, value[index], index, value, options, stack)) {
24375
+ if (await callArrayCallback(callback, value[index], index, value, options, stack, thisValue)) {
24340
24376
  result.push(value[index]);
24341
24377
  }
24342
24378
  }
24343
24379
  return result;
24344
24380
  }
24345
- async function findInArray(value, callback, options, stack) {
24346
- const index = await findIndexInArray(value, callback, options, stack);
24381
+ async function findInArray(value, callback, options, stack, thisValue) {
24382
+ const index = await findIndexInArray(value, callback, options, stack, thisValue);
24347
24383
  return index < 0 ? void 0 : value[index];
24348
24384
  }
24349
- async function findIndexInArray(value, callback, options, stack) {
24385
+ async function findIndexInArray(value, callback, options, stack, thisValue) {
24350
24386
  const length = value.length;
24351
24387
  for (let index = 0; index < length; index += 1) {
24352
24388
  const entry = index in value ? value[index] : void 0;
24353
- if (await callArrayCallback(callback, entry, index, value, options, stack)) {
24389
+ if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24354
24390
  return index;
24355
24391
  }
24356
24392
  }
24357
24393
  return -1;
24358
24394
  }
24359
- async function findLastInArray(value, callback, options, stack) {
24395
+ async function findLastInArray(value, callback, options, stack, thisValue) {
24360
24396
  const length = value.length;
24361
24397
  for (let index = length - 1; index >= 0; index -= 1) {
24362
24398
  const entry = index in value ? value[index] : void 0;
24363
- if (await callArrayCallback(callback, entry, index, value, options, stack)) {
24399
+ if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24364
24400
  return entry;
24365
24401
  }
24366
24402
  }
24367
24403
  return void 0;
24368
24404
  }
24369
- async function findLastIndexInArray(value, callback, options, stack) {
24405
+ async function findLastIndexInArray(value, callback, options, stack, thisValue) {
24370
24406
  const length = value.length;
24371
24407
  for (let index = length - 1; index >= 0; index -= 1) {
24372
24408
  const entry = index in value ? value[index] : void 0;
24373
- if (await callArrayCallback(callback, entry, index, value, options, stack)) {
24409
+ if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24374
24410
  return index;
24375
24411
  }
24376
24412
  }
24377
24413
  return -1;
24378
24414
  }
24379
- async function someInArray(value, callback, options, stack) {
24415
+ async function someInArray(value, callback, options, stack, thisValue) {
24380
24416
  const length = value.length;
24381
24417
  for (let index = 0; index < length; index += 1) {
24382
24418
  if (!(index in value)) {
24383
24419
  continue;
24384
24420
  }
24385
- if (await callArrayCallback(callback, value[index], index, value, options, stack)) {
24421
+ if (await callArrayCallback(callback, value[index], index, value, options, stack, thisValue)) {
24386
24422
  return true;
24387
24423
  }
24388
24424
  }
24389
24425
  return false;
24390
24426
  }
24391
- async function everyInArray(value, callback, options, stack) {
24427
+ async function everyInArray(value, callback, options, stack, thisValue) {
24392
24428
  const length = value.length;
24393
24429
  for (let index = 0; index < length; index += 1) {
24394
24430
  if (!(index in value)) {
24395
24431
  continue;
24396
24432
  }
24397
- if (!await callArrayCallback(callback, value[index], index, value, options, stack)) {
24433
+ if (!await callArrayCallback(callback, value[index], index, value, options, stack, thisValue)) {
24398
24434
  return false;
24399
24435
  }
24400
24436
  }
@@ -24442,23 +24478,31 @@ async function reduceFromRight(value, callback, accumulator, startIndex, length,
24442
24478
  }
24443
24479
  return current;
24444
24480
  }
24445
- async function forEachArray(value, callback, options, stack) {
24481
+ async function forEachArray(value, callback, options, stack, thisValue) {
24446
24482
  const length = value.length;
24447
24483
  for (let index = 0; index < length; index += 1) {
24448
24484
  if (!(index in value)) {
24449
24485
  continue;
24450
24486
  }
24451
- await callArrayCallback(callback, value[index], index, value, options, stack);
24487
+ await callArrayCallback(callback, value[index], index, value, options, stack, thisValue);
24452
24488
  }
24453
24489
  }
24454
- async function flatMapArray(value, callback, options, stack) {
24490
+ async function flatMapArray(value, callback, options, stack, thisValue) {
24455
24491
  const length = value.length;
24456
24492
  const result = [];
24457
24493
  for (let index = 0; index < length; index += 1) {
24458
24494
  if (!(index in value)) {
24459
24495
  continue;
24460
24496
  }
24461
- const mapped = await callArrayCallback(callback, value[index], index, value, options, stack);
24497
+ const mapped = await callArrayCallback(
24498
+ callback,
24499
+ value[index],
24500
+ index,
24501
+ value,
24502
+ options,
24503
+ stack,
24504
+ thisValue
24505
+ );
24462
24506
  if (Array.isArray(mapped)) {
24463
24507
  for (let mappedIndex = 0; mappedIndex < mapped.length; mappedIndex += 1) {
24464
24508
  if (!(mappedIndex in mapped)) {
@@ -24530,8 +24574,8 @@ async function compareEntries(left, right, comparator, options, stack) {
24530
24574
  const result = Number(await options.callClosure(comparator, [left, right], stack));
24531
24575
  return Number.isNaN(result) ? 0 : result;
24532
24576
  }
24533
- async function callArrayCallback(callback, value, index, array, options, stack) {
24534
- return options.callClosure(callback, [value, index, array], stack);
24577
+ async function callArrayCallback(callback, value, index, array, options, stack, thisValue) {
24578
+ return options.callClosure(callback, [value, index, array], stack, thisValue);
24535
24579
  }
24536
24580
  function findNextDefinedIndex(value, startIndex, direction, length) {
24537
24581
  for (let index = startIndex; direction > 0 ? index < length : index >= 0; index += direction) {
@@ -24721,7 +24765,7 @@ async function callMapMethod(target, methodName, args, options, stack = []) {
24721
24765
  const entries = [...target.entries];
24722
24766
  for (let index = 0; index < entries.length; index += 1) {
24723
24767
  const [key, value] = entries[index];
24724
- await options.callClosure(callback, [value, key, target], stack);
24768
+ await options.callClosure(callback, [value, key, target], stack, args[1]);
24725
24769
  }
24726
24770
  } finally {
24727
24771
  leaveCallback();
@@ -25490,7 +25534,7 @@ async function callSetMethod(target, methodName, args, options, stack = []) {
25490
25534
  const values = [...target.values];
25491
25535
  for (let index = 0; index < values.length; index += 1) {
25492
25536
  const value = values[index];
25493
- await options.callClosure(callback, [value, value, target], stack);
25537
+ await options.callClosure(callback, [value, value, target], stack, args[1]);
25494
25538
  }
25495
25539
  } finally {
25496
25540
  leaveCallback();
@@ -28069,19 +28113,19 @@ async function evaluateNumberMethodCall(node, target, methodName, context) {
28069
28113
  function createArrayMethodOptions(context) {
28070
28114
  return {
28071
28115
  budget: context.budget,
28072
- callClosure: (closure, args, stack) => invokeSandboxClosure(closure, args, context, stack)
28116
+ callClosure: (closure, args, stack, thisValue) => invokeSandboxClosure(closure, args, context, stack, void 0, thisValue)
28073
28117
  };
28074
28118
  }
28075
28119
  function createMapMethodOptions(context) {
28076
28120
  return {
28077
28121
  budget: context.budget,
28078
- callClosure: (closure, args, stack) => invokeSandboxClosure(closure, args, context, stack)
28122
+ callClosure: (closure, args, stack, thisValue) => invokeSandboxClosure(closure, args, context, stack, void 0, thisValue)
28079
28123
  };
28080
28124
  }
28081
28125
  function createSetMethodOptions(context) {
28082
28126
  return {
28083
28127
  budget: context.budget,
28084
- callClosure: (closure, args, stack) => invokeSandboxClosure(closure, args, context, stack)
28128
+ callClosure: (closure, args, stack, thisValue) => invokeSandboxClosure(closure, args, context, stack, void 0, thisValue)
28085
28129
  };
28086
28130
  }
28087
28131
  function createFunctionMethodOptions(context) {
@@ -28609,6 +28653,8 @@ function run(source, options = {}) {
28609
28653
  options.signal?.addEventListener("abort", captureCancellationSnapshot, { once: true });
28610
28654
  try {
28611
28655
  const restoredSnapshot = options.snapshot === void 0 ? void 0 : restore(options.snapshot, { source });
28656
+ const executionSemantics = restoredSnapshot?.executionSemantics === "jobs-v6" ? "jobs-v6" : EXECUTION_SEMANTICS;
28657
+ const convertInitialInput = (convert) => executionSemantics === "jobs-v6" ? convert() : promiseReplayContext.exit(convert);
28612
28658
  if (restoredSnapshot !== void 0) {
28613
28659
  leaveSnapshotRun = enterSnapshotRun(restoredSnapshot);
28614
28660
  }
@@ -28634,13 +28680,15 @@ function run(source, options = {}) {
28634
28680
  ...restoredSnapshot,
28635
28681
  resumeNodeId: restoredSnapshot.pendingAwaits?.[0]?.nodeId
28636
28682
  } : void 0;
28637
- const callerBindings = options.bindings === void 0 ? {} : wrapCallerInjectedBindings(options.bindings, {
28638
- budget,
28639
- hostCalls,
28640
- moduleId: "<bindings>",
28641
- signal: options.signal,
28642
- lifecycle
28643
- });
28683
+ const callerBindings = convertInitialInput(
28684
+ () => options.bindings === void 0 ? {} : wrapCallerInjectedBindings(options.bindings, {
28685
+ budget,
28686
+ hostCalls,
28687
+ moduleId: "<bindings>",
28688
+ signal: options.signal,
28689
+ lifecycle
28690
+ })
28691
+ );
28644
28692
  const builtinBindings = {
28645
28693
  ...createConsoleJsonGlobals({
28646
28694
  budget,
@@ -28665,7 +28713,9 @@ function run(source, options = {}) {
28665
28713
  }),
28666
28714
  ...createRegexGlobals()
28667
28715
  };
28668
- const importMeta = deepCopyToSandbox(options.importMeta ?? {});
28716
+ const importMeta = convertInitialInput(
28717
+ () => deepCopyToSandbox(options.importMeta ?? {})
28718
+ );
28669
28719
  if (restoredSnapshot?.migration !== void 0) {
28670
28720
  if (Object.hasOwn(importMeta, "migration"))
28671
28721
  throw new TypeError("import.meta.migration is reserved for migrated checkpoint state.");
@@ -28679,13 +28729,17 @@ function run(source, options = {}) {
28679
28729
  const initialInputs = prepareReplayInputs(
28680
28730
  {
28681
28731
  bindings: callerBindings,
28682
- imports: resolveModuleImports(module, options.modules, {
28683
- budget,
28684
- hostCalls,
28685
- signal: options.signal,
28686
- allowMissing: restoredSnapshot?.initialInputs !== void 0
28687
- }),
28688
- entryPointArgs: options.entryPointArgs === void 0 ? void 0 : deepCopyToSandbox([...options.entryPointArgs]),
28732
+ imports: convertInitialInput(
28733
+ () => resolveModuleImports(module, options.modules, {
28734
+ budget,
28735
+ hostCalls,
28736
+ signal: options.signal,
28737
+ allowMissing: restoredSnapshot?.initialInputs !== void 0
28738
+ })
28739
+ ),
28740
+ entryPointArgs: convertInitialInput(
28741
+ () => options.entryPointArgs === void 0 ? void 0 : deepCopyToSandbox([...options.entryPointArgs])
28742
+ ),
28689
28743
  importMeta
28690
28744
  },
28691
28745
  restoredSnapshot?.initialInputs,
@@ -28751,6 +28805,7 @@ function run(source, options = {}) {
28751
28805
  });
28752
28806
  snapshotScheduler = activeSnapshotScheduler;
28753
28807
  createFailureSnapshot = () => createRunSnapshot({
28808
+ executionSemantics,
28754
28809
  migration: restoredSnapshot?.migration,
28755
28810
  bindings: executionScope.snapshot().bindings,
28756
28811
  clock: options.clock,
@@ -28777,6 +28832,7 @@ function run(source, options = {}) {
28777
28832
  }
28778
28833
  const interpreterSnapshot2 = yieldPoint.snapshot();
28779
28834
  snapshot2 = createRunSnapshot({
28835
+ executionSemantics,
28780
28836
  migration: restoredSnapshot?.migration,
28781
28837
  bindings: interpreterSnapshot2.bindings,
28782
28838
  clock: options.clock,
@@ -28819,6 +28875,7 @@ function run(source, options = {}) {
28819
28875
  }
28820
28876
  const interpreterSnapshot2 = yieldPoint.snapshot();
28821
28877
  snapshot2 = createRunSnapshot({
28878
+ executionSemantics,
28822
28879
  migration: restoredSnapshot?.migration,
28823
28880
  bindings: interpreterSnapshot2.bindings,
28824
28881
  clock: options.clock,
@@ -28853,6 +28910,7 @@ function run(source, options = {}) {
28853
28910
  replayError = error.message;
28854
28911
  }
28855
28912
  const snapshot = createRunSnapshot({
28913
+ executionSemantics,
28856
28914
  migration: restoredSnapshot?.migration,
28857
28915
  bindings: executionScope.snapshot().bindings,
28858
28916
  clock: options.clock,
@@ -29022,7 +29080,7 @@ function createExecutableNode(module) {
29022
29080
  function createRunSnapshot(input) {
29023
29081
  return {
29024
29082
  version: DUMP_FORMAT_VERSION,
29025
- executionSemantics: EXECUTION_SEMANTICS,
29083
+ executionSemantics: input.executionSemantics,
29026
29084
  sourceHash: input.sourceHash,
29027
29085
  ...input.migration === void 0 ? {} : { migration: structuredClone(input.migration) },
29028
29086
  bindings: input.bindings,
@@ -29135,4 +29193,4 @@ export {
29135
29193
  FileSnapshotBackend,
29136
29194
  run
29137
29195
  };
29138
- //# sourceMappingURL=chunk-3627FMJF.js.map
29196
+ //# sourceMappingURL=chunk-DXJLYASS.js.map