poe-code 14.0.60 → 14.0.61

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": "14.0.60",
3
+ "version": "14.0.61",
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-MKJBQPBH.js";
30
+ } from "./chunk-ZTGKRKQH.js";
31
31
  import {
32
32
  createFileSystem,
33
33
  createNodeFileSystemAdapterRegistry,
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-C7UCTQDN.js.map
8248
+ //# sourceMappingURL=chunk-VAYQP2VZ.js.map
@@ -8267,7 +8267,7 @@ function isCounter(value) {
8267
8267
  }
8268
8268
 
8269
8269
  // packages/safe-js/src/interp/cancel.ts
8270
- import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
8270
+ import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
8271
8271
 
8272
8272
  // packages/safe-js/src/interp/builtin-call.ts
8273
8273
  async function invokeBuiltinClosure(closure, args, budget, context, thisValue, construct = false) {
@@ -8627,6 +8627,55 @@ function toMatchArray(match, input) {
8627
8627
  return result;
8628
8628
  }
8629
8629
 
8630
+ // packages/safe-js/src/interp/resources.ts
8631
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
8632
+ var runResources = new AsyncLocalStorage3();
8633
+ function retainValues(budget, values) {
8634
+ const retained = {};
8635
+ budget.setRetainedValues(retained, values);
8636
+ const pending = runResources.getStore()?.referenceReleases;
8637
+ const release = () => {
8638
+ budget.setRetainedValues(retained, void 0);
8639
+ pending?.delete(release);
8640
+ };
8641
+ pending?.add(release);
8642
+ return release;
8643
+ }
8644
+ async function withRunResources(signal, execute) {
8645
+ const controller = new AbortController();
8646
+ const cancel = () => controller.abort(signal?.reason);
8647
+ const cleanups = /* @__PURE__ */ new Set();
8648
+ const resources = {
8649
+ signal: controller.signal,
8650
+ referenceReleases: /* @__PURE__ */ new Set(),
8651
+ add(close) {
8652
+ cleanups.add(close);
8653
+ }
8654
+ };
8655
+ signal?.addEventListener("abort", cancel, { once: true });
8656
+ if (signal?.aborted) cancel();
8657
+ let result;
8658
+ let failure;
8659
+ let errors = [];
8660
+ try {
8661
+ result = await runResources.run(resources, execute);
8662
+ } catch (error) {
8663
+ failure = { reason: error };
8664
+ } finally {
8665
+ signal?.removeEventListener("abort", cancel);
8666
+ controller.abort(new Error("SafeJS run finished."));
8667
+ for (const release of resources.referenceReleases) release();
8668
+ resources.referenceReleases.clear();
8669
+ const outcomes = await Promise.allSettled(
8670
+ [...cleanups].map((close) => Promise.resolve().then(close))
8671
+ );
8672
+ errors = outcomes.flatMap((outcome) => outcome.status === "rejected" ? [outcome.reason] : []);
8673
+ }
8674
+ if (failure !== void 0) throw failure.reason;
8675
+ if (errors.length > 0) throw new AggregateError(errors, "SafeJS resource cleanup failed.");
8676
+ return result;
8677
+ }
8678
+
8630
8679
  // packages/safe-js/src/interp/string-coercion.ts
8631
8680
  var defaultStringHook = /* @__PURE__ */ Symbol("defaultStringHook");
8632
8681
  var defaultValueHook = /* @__PURE__ */ Symbol("defaultValueHook");
@@ -8713,9 +8762,10 @@ async function defaultToString(value, budget, context, joining) {
8713
8762
  }
8714
8763
  if (joining.has(value)) return "";
8715
8764
  joining.add(value);
8765
+ let text = "";
8766
+ const release = retainValues(budget, () => [text]);
8716
8767
  try {
8717
8768
  const length = isFloat32Array(value) ? float32Storage(value).length : value.length;
8718
- let text = "";
8719
8769
  for (let index = 0; index < length; index++) {
8720
8770
  budget.visitNode();
8721
8771
  const element = ownDataValue(value, String(index));
@@ -8724,15 +8774,21 @@ async function defaultToString(value, budget, context, joining) {
8724
8774
  }
8725
8775
  return text;
8726
8776
  } finally {
8777
+ release();
8727
8778
  joining.delete(value);
8728
8779
  }
8729
8780
  }
8730
8781
  if (sandboxErrorTypes.has(value)) {
8731
8782
  const nameValue = ownDataValue(value, "name");
8732
8783
  const name = nameValue === void 0 ? "Error" : await sandboxString(nameValue, budget, context, joining);
8733
- const messageValue = ownDataValue(value, "message");
8734
- const message = messageValue === void 0 ? "" : await sandboxString(messageValue, budget, context, joining);
8735
- return name === "" ? message : message === "" ? name : `${name}: ${message}`;
8784
+ const release = retainValues(budget, () => [name]);
8785
+ try {
8786
+ const messageValue = ownDataValue(value, "message");
8787
+ const message = messageValue === void 0 ? "" : await sandboxString(messageValue, budget, context, joining);
8788
+ return name === "" ? message : message === "" ? name : `${name}: ${message}`;
8789
+ } finally {
8790
+ release();
8791
+ }
8736
8792
  }
8737
8793
  return isSandboxPromise(value) ? "[object Promise]" : "[object Object]";
8738
8794
  }
@@ -9342,8 +9398,8 @@ function syncIterator(iterator) {
9342
9398
  }
9343
9399
 
9344
9400
  // packages/safe-js/src/interp/jobs.ts
9345
- import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
9346
- var activeJob = new AsyncLocalStorage3();
9401
+ import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
9402
+ var activeJob = new AsyncLocalStorage4();
9347
9403
  var SandboxJobQueue = class {
9348
9404
  running = false;
9349
9405
  pending = [];
@@ -10172,7 +10228,7 @@ function isPromiseLike(value) {
10172
10228
  }
10173
10229
 
10174
10230
  // packages/safe-js/src/interp/cancel.ts
10175
- var activeCancellation = new AsyncLocalStorage4();
10231
+ var activeCancellation = new AsyncLocalStorage5();
10176
10232
  var sandboxPromises = /* @__PURE__ */ new WeakSet();
10177
10233
  var cancelableOutcomes = /* @__PURE__ */ new WeakMap();
10178
10234
  function withCancellationSignal(signal, task) {
@@ -23890,44 +23946,6 @@ function hoistVarDeclarations(node, scope) {
23890
23946
  }
23891
23947
  }
23892
23948
 
23893
- // packages/safe-js/src/interp/resources.ts
23894
- import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
23895
- var runResources = new AsyncLocalStorage5();
23896
- async function withRunResources(signal, execute) {
23897
- const controller = new AbortController();
23898
- const cancel = () => controller.abort(signal?.reason);
23899
- const cleanups = /* @__PURE__ */ new Set();
23900
- const resources = {
23901
- signal: controller.signal,
23902
- referenceReleases: /* @__PURE__ */ new Set(),
23903
- add(close) {
23904
- cleanups.add(close);
23905
- }
23906
- };
23907
- signal?.addEventListener("abort", cancel, { once: true });
23908
- if (signal?.aborted) cancel();
23909
- let result;
23910
- let failure;
23911
- let errors = [];
23912
- try {
23913
- result = await runResources.run(resources, execute);
23914
- } catch (error) {
23915
- failure = { reason: error };
23916
- } finally {
23917
- signal?.removeEventListener("abort", cancel);
23918
- controller.abort(new Error("SafeJS run finished."));
23919
- for (const release of resources.referenceReleases) release();
23920
- resources.referenceReleases.clear();
23921
- const outcomes = await Promise.allSettled(
23922
- [...cleanups].map((close) => Promise.resolve().then(close))
23923
- );
23924
- errors = outcomes.flatMap((outcome) => outcome.status === "rejected" ? [outcome.reason] : []);
23925
- }
23926
- if (failure !== void 0) throw failure.reason;
23927
- if (errors.length > 0) throw new AggregateError(errors, "SafeJS resource cleanup failed.");
23928
- return result;
23929
- }
23930
-
23931
23949
  // packages/safe-js/src/interp/methods/array.ts
23932
23950
  var arrayLikeSources = /* @__PURE__ */ new WeakMap();
23933
23951
  var activeArrayCallbacks = /* @__PURE__ */ new WeakMap();
@@ -25074,6 +25092,9 @@ function isStringMethodName(property) {
25074
25092
  function validateStringMethodArguments(_methodName, _args) {
25075
25093
  }
25076
25094
  function callStringMethod(value, methodName, args, budget, callClosure = async (closure, closureArgs) => await closure.call(closureArgs), parent, context) {
25095
+ if (methodName === "concat" && args.some((argument) => argument !== null && typeof argument === "object")) {
25096
+ return callConcat(value, args, budget, context);
25097
+ }
25077
25098
  if (methodName === "isWellFormed") {
25078
25099
  for (let index = 0; index < value.length; index++) {
25079
25100
  const codeUnit = value.charCodeAt(index);
@@ -25229,6 +25250,19 @@ function callStringMethod(value, methodName, args, budget, callClosure = async (
25229
25250
  operation.release();
25230
25251
  }
25231
25252
  }
25253
+ async function callConcat(value, args, budget, context) {
25254
+ let result = budget.allocateString(value);
25255
+ const release = retainValues(budget, () => [result]);
25256
+ try {
25257
+ for (const argument of args) {
25258
+ const text = sandboxString(argument, budget, context);
25259
+ result = budget.allocateString(result + (typeof text === "string" ? text : await text));
25260
+ }
25261
+ return result;
25262
+ } finally {
25263
+ release();
25264
+ }
25265
+ }
25232
25266
  function callReplaceLikeMethod(value, methodName, args, budget, callClosure, context) {
25233
25267
  const search = args[0];
25234
25268
  const replacement = args[1];
@@ -26689,14 +26723,18 @@ function isObjectPrototypeSetterProperty(property, key) {
26689
26723
  }
26690
26724
  async function evaluateTemplateLiteral(node, context) {
26691
26725
  let value = context.budget.allocateString(node.quasis[0]?.value.cooked ?? "");
26692
- const release = retainValues(context.budget, () => [value]);
26726
+ let input = void 0;
26727
+ const release = retainValues(context.budget, () => [value, input]);
26693
26728
  try {
26694
26729
  for (let index = 0; index < node.expressions.length; index += 1) {
26695
26730
  const expression = await evaluateNode(node.expressions[index], context);
26696
26731
  if (expression.kind !== "normal") {
26697
26732
  return expression;
26698
26733
  }
26699
- const expressionText = context.budget.allocateString(String(expression.value));
26734
+ input = expression.value;
26735
+ const text = sandboxString(input, context.budget, createCoercionContext(context));
26736
+ const expressionText = typeof text === "string" ? text : await text;
26737
+ input = void 0;
26700
26738
  value = context.budget.allocateString(value + expressionText);
26701
26739
  const quasiText = context.budget.allocateString(node.quasis[index + 1]?.value.cooked ?? "");
26702
26740
  value = context.budget.allocateString(value + quasiText);
@@ -28143,17 +28181,6 @@ async function evaluateMemberAccess(node, context, consume) {
28143
28181
  release();
28144
28182
  }
28145
28183
  }
28146
- function retainValues(budget, values) {
28147
- const retained = {};
28148
- budget.setRetainedValues(retained, values);
28149
- const pending = runResources.getStore()?.referenceReleases;
28150
- const release = () => {
28151
- budget.setRetainedValues(retained, void 0);
28152
- pending?.delete(release);
28153
- };
28154
- pending?.add(release);
28155
- return release;
28156
- }
28157
28184
  async function evaluateMemberProperty(node, context) {
28158
28185
  const property = await evaluateNode(node, context);
28159
28186
  if (property.kind !== "normal") {
@@ -33445,6 +33472,7 @@ export {
33445
33472
  HostOperationResumePolicyError,
33446
33473
  registerPendingHostCallPolicy,
33447
33474
  HostCallResumabilityError,
33475
+ runResources,
33448
33476
  assertSnapshotInactive,
33449
33477
  isSandboxClosure,
33450
33478
  deepCopyToSandbox,
@@ -33461,7 +33489,6 @@ export {
33461
33489
  validateSnapshotMigration,
33462
33490
  restore,
33463
33491
  lint,
33464
- runResources,
33465
33492
  declareHostOperation,
33466
33493
  createSeededRandom,
33467
33494
  createReplayableRandom,
@@ -33473,4 +33500,4 @@ export {
33473
33500
  FileSnapshotBackend,
33474
33501
  run
33475
33502
  };
33476
- //# sourceMappingURL=chunk-MKJBQPBH.js.map
33503
+ //# sourceMappingURL=chunk-ZTGKRKQH.js.map