poe-code 13.0.1 → 13.0.2

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": "13.0.1",
3
+ "version": "13.0.2",
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-DALBPQDZ.js";
30
+ } from "./chunk-RIQRHKCB.js";
31
31
  import {
32
32
  createFileSystem,
33
33
  createNodeFileSystemAdapterRegistry,
@@ -8183,4 +8183,4 @@ export {
8183
8183
  parseMcpConfig,
8184
8184
  makeMcpModule
8185
8185
  };
8186
- //# sourceMappingURL=chunk-EL23VF23.js.map
8186
+ //# sourceMappingURL=chunk-JP474LP7.js.map
@@ -24158,6 +24158,85 @@ function assertStructuredCloneable(value, seen) {
24158
24158
  }
24159
24159
  }
24160
24160
 
24161
+ // packages/safe-js/src/interp/string-coercion.ts
24162
+ function sandboxString(value, budget, context, joining = /* @__PURE__ */ new Set()) {
24163
+ if (value === null || typeof value !== "object") {
24164
+ if (typeof value === "function") throw new TypeError("Expected a sandbox value.");
24165
+ return budget.allocateString(String(value));
24166
+ }
24167
+ return stringifyObject2(value, budget, context, joining);
24168
+ }
24169
+ async function stringifyObject2(value, budget, context, joining) {
24170
+ const leaveCall = budget.enterCall();
24171
+ try {
24172
+ budget.visitNode();
24173
+ for (const name of ["toString", "valueOf"]) {
24174
+ const descriptor = Object.getOwnPropertyDescriptor(value, name);
24175
+ let result;
24176
+ if (descriptor === void 0) {
24177
+ if (name === "valueOf") continue;
24178
+ result = await defaultToString(value, budget, context, joining);
24179
+ } else {
24180
+ const hook = ownDataValue(value, name);
24181
+ if (!isSandboxClosure(hook)) continue;
24182
+ if (context?.invokeClosure === void 0) {
24183
+ throw new TypeError("String hooks require a sandbox call context.");
24184
+ }
24185
+ result = await context.invokeClosure(hook, [], value);
24186
+ }
24187
+ if (result === null || typeof result !== "object") {
24188
+ return sandboxString(result, budget, context, joining);
24189
+ }
24190
+ }
24191
+ throw new TypeError("Cannot convert object to primitive value");
24192
+ } finally {
24193
+ leaveCall();
24194
+ }
24195
+ }
24196
+ async function defaultToString(value, budget, context, joining) {
24197
+ if (Array.isArray(value) || isFloat32Array(value)) {
24198
+ if (Object.hasOwn(value, "join")) {
24199
+ const join = ownDataValue(value, "join");
24200
+ if (!isSandboxClosure(join))
24201
+ return isFloat32Array(value) ? "[object Float32Array]" : "[object Array]";
24202
+ if (context?.invokeClosure === void 0) {
24203
+ throw new TypeError("String hooks require a sandbox call context.");
24204
+ }
24205
+ return context.invokeClosure(join, [], value);
24206
+ }
24207
+ if (joining.has(value)) return "";
24208
+ joining.add(value);
24209
+ try {
24210
+ const length = isFloat32Array(value) ? float32Storage(value).length : value.length;
24211
+ let text = "";
24212
+ for (let index = 0; index < length; index++) {
24213
+ budget.visitNode();
24214
+ const element = ownDataValue(value, String(index));
24215
+ const part = element === null || element === void 0 ? "" : await sandboxString(element, budget, context, joining);
24216
+ text = budget.allocateString(text + (index === 0 ? "" : ",") + part);
24217
+ }
24218
+ return text;
24219
+ } finally {
24220
+ joining.delete(value);
24221
+ }
24222
+ }
24223
+ if (sandboxErrorTypes.has(value)) {
24224
+ const nameValue = ownDataValue(value, "name");
24225
+ const name = nameValue === void 0 ? "Error" : await sandboxString(nameValue, budget, context, joining);
24226
+ const messageValue = ownDataValue(value, "message");
24227
+ const message = messageValue === void 0 ? "" : await sandboxString(messageValue, budget, context, joining);
24228
+ return name === "" ? message : message === "" ? name : `${name}: ${message}`;
24229
+ }
24230
+ return isSandboxPromise(value) ? "[object Promise]" : "[object Object]";
24231
+ }
24232
+ function ownDataValue(value, name) {
24233
+ const descriptor = Object.getOwnPropertyDescriptor(value, name);
24234
+ if (descriptor !== void 0 && !Object.hasOwn(descriptor, "value")) {
24235
+ throw new TypeError("String conversion requires sandbox data properties.");
24236
+ }
24237
+ return descriptor?.value;
24238
+ }
24239
+
24161
24240
  // packages/safe-js/src/interp/globals/object-array.ts
24162
24241
  function createObjectArrayGlobals(options) {
24163
24242
  return {
@@ -24253,9 +24332,7 @@ function createObjectArrayGlobals(options) {
24253
24332
  }),
24254
24333
  String: createSandboxClosure({
24255
24334
  sandbox: true,
24256
- call: ([value]) => options.budget.allocateString(
24257
- typeof value === "object" && value !== null && sandboxErrorTypes.has(value) && !Object.hasOwn(value, "toString") ? Error.prototype.toString.call(value) : String(value)
24258
- ),
24335
+ call: (args, context) => sandboxString(args.length === 0 ? "" : args[0], options.budget, context),
24259
24336
  name: "String",
24260
24337
  properties: {
24261
24338
  raw: createSandboxClosure({
@@ -28712,6 +28789,7 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
28712
28789
  {
28713
28790
  stack,
28714
28791
  thisValue,
28792
+ invokeClosure: (closure, argumentsList, receiver) => invokeSandboxClosure(closure, argumentsList, context, stack, span, receiver),
28715
28793
  ...span === void 0 ? {} : { span }
28716
28794
  }
28717
28795
  ]);
@@ -29763,4 +29841,4 @@ export {
29763
29841
  FileSnapshotBackend,
29764
29842
  run
29765
29843
  };
29766
- //# sourceMappingURL=chunk-DALBPQDZ.js.map
29844
+ //# sourceMappingURL=chunk-RIQRHKCB.js.map