poe-code 10.0.4 → 11.0.1

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": "10.0.4",
3
+ "version": "11.0.1",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,7 +57,7 @@
57
57
  "codegen:python-types": "tsx scripts/generate-agent-spawn-py-types.ts",
58
58
  "codegen:check:python-types": "tsx scripts/generate-agent-spawn-py-types.ts --check",
59
59
  "install:py-poe-spawn": "pip install -e packages/py-poe-spawn",
60
- "predev": "turbo run build --output-logs=errors-only --log-prefix=none --verbosity=0",
60
+ "predev": "turbo run build --output-logs=errors-only --log-prefix=none --verbosity=0 && node scripts/bundle.mjs",
61
61
  "dev": "tsx --import ./scripts/register-template-loader.mjs src/index.ts",
62
62
  "start": "node dist/bin.cjs",
63
63
  "dev:bundle": "npm run build && node dist/bin.cjs",
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-JLYBD3E6.js";
30
+ } from "./chunk-DKXGPEOM.js";
31
31
 
32
32
  // packages/safejs/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8048,4 +8048,4 @@ export {
8048
8048
  parseMcpConfig,
8049
8049
  makeMcpModule
8050
8050
  };
8051
- //# sourceMappingURL=chunk-SA7XBTIL.js.map
8051
+ //# sourceMappingURL=chunk-ARFGEQTM.js.map
@@ -16919,7 +16919,7 @@ function serializeArguments(value, serializeValue) {
16919
16919
 
16920
16920
  // packages/safejs/src/snapshot/dump-format.ts
16921
16921
  var DUMP_FORMAT_VERSION = 1;
16922
- var EXECUTION_SEMANTICS = "jobs-v5";
16922
+ var EXECUTION_SEMANTICS = "jobs-v6";
16923
16923
  var SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
16924
16924
  function serializeSafeJSSnapshot(snapshot) {
16925
16925
  const replayError = Object.getOwnPropertyDescriptor(snapshot, "replayError");
@@ -17413,9 +17413,6 @@ function validateGenericValue(value, path, depth, state) {
17413
17413
  if (typeof value === "string") {
17414
17414
  requireString(value, path, state.limits);
17415
17415
  state.dataSize += value.length;
17416
- } else if (typeof value === "number") {
17417
- if (Number.isInteger(value) && !Number.isSafeInteger(value))
17418
- fail("invalidValue", path, "integer must be safe");
17419
17416
  } else if (Array.isArray(value)) {
17420
17417
  if (value.length > state.limits.maxEntries) fail("budgetExceeded", path, "array is too large");
17421
17418
  if (state.dataPropertiesOnly) {
@@ -21215,9 +21212,9 @@ function shouldIncludeTemplateRaw(record2, key, includeTemplateRaw) {
21215
21212
 
21216
21213
  // packages/safejs/src/snapshot/migration.ts
21217
21214
  function validateMigrationSemantics(value) {
21218
- if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5"].includes(value))
21215
+ if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6"].includes(value))
21219
21216
  throw new TypeError(
21220
- "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v5)."
21217
+ "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v6)."
21221
21218
  );
21222
21219
  }
21223
21220
  function validateMigrationJournal(sourceHash, replay, hostCalls = []) {
@@ -25423,15 +25420,15 @@ var Scope = class _Scope {
25423
25420
  throw new ReferenceError(`Cannot assign to undeclared binding '${name}'.`);
25424
25421
  }
25425
25422
  const binding = scope.#bindings.get(name);
25426
- if (binding?.kind === "const") {
25427
- throw new TypeError(`Cannot assign to const binding '${name}'.`);
25428
- }
25429
25423
  if (binding === void 0) {
25430
25424
  throw new ReferenceError(`Cannot assign to undeclared binding '${name}'.`);
25431
25425
  }
25432
25426
  if (binding.value === uninitialized) {
25433
25427
  throw new ReferenceError(`Cannot access '${name}' before initialization.`);
25434
25428
  }
25429
+ if (binding.kind === "const") {
25430
+ throw new TypeError(`Cannot assign to const binding '${name}'.`);
25431
+ }
25435
25432
  scope.#bindings.set(name, {
25436
25433
  kind: binding.kind,
25437
25434
  value
@@ -25951,39 +25948,37 @@ async function evaluateAssignmentExpression(node, context) {
25951
25948
  )
25952
25949
  };
25953
25950
  }
25954
- const binding = context.scope.lookup(node.left.name);
25955
- if (!binding.found) {
25951
+ const binding = node.operator === "=" ? void 0 : context.scope.lookup(node.left.name);
25952
+ if (binding?.found === false) {
25956
25953
  throw new ReferenceError(`Cannot assign to undeclared binding '${node.left.name}'.`);
25957
25954
  }
25958
- if (binding.kind === "const") {
25959
- throw new TypeError(`Cannot assign to const '${node.left.name}'`);
25960
- }
25961
- if (node.operator === "&&=" && !isTruthy(binding.value)) {
25955
+ const current = binding?.value;
25956
+ if (node.operator === "&&=" && !isTruthy(current)) {
25962
25957
  return {
25963
25958
  kind: "normal",
25964
25959
  hasValue: true,
25965
- value: binding.value
25960
+ value: current
25966
25961
  };
25967
25962
  }
25968
- if (node.operator === "||=" && isTruthy(binding.value)) {
25963
+ if (node.operator === "||=" && isTruthy(current)) {
25969
25964
  return {
25970
25965
  kind: "normal",
25971
25966
  hasValue: true,
25972
- value: binding.value
25967
+ value: current
25973
25968
  };
25974
25969
  }
25975
- if (node.operator === "??=" && binding.value !== null && binding.value !== void 0) {
25970
+ if (node.operator === "??=" && current !== null && current !== void 0) {
25976
25971
  return {
25977
25972
  kind: "normal",
25978
25973
  hasValue: true,
25979
- value: binding.value
25974
+ value: current
25980
25975
  };
25981
25976
  }
25982
25977
  const right = await evaluateNode(node.right, context);
25983
25978
  if (right.kind !== "normal") {
25984
25979
  return right;
25985
25980
  }
25986
- const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : applyCompoundAssignmentOperator(node.operator, binding.value, right.value, context);
25981
+ const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
25987
25982
  context.scope.assign(node.left.name, value);
25988
25983
  return {
25989
25984
  kind: "normal",
@@ -26005,45 +26000,33 @@ async function evaluateMemberAssignmentExpression(node, context) {
26005
26000
  if (member.kind === "nullish") {
26006
26001
  throw new TypeError("Cannot assign properties of null or undefined.");
26007
26002
  }
26008
- if (isSandboxRegex(member.object)) {
26009
- if (node.operator !== "=") {
26010
- throw new TypeError("RegExp properties only support direct assignment.");
26011
- }
26012
- const right2 = await evaluateNode(node.right, context);
26013
- if (right2.kind !== "normal") return right2;
26014
- setRegexMember(member.object, member.property, right2.value);
26015
- return { kind: "normal", hasValue: true, value: right2.value };
26016
- }
26017
- if (!isIndexableSandboxValue(member.object)) {
26018
- throw new TypeError("Assignment expressions require a sandbox object property.");
26019
- }
26020
- if (node.operator === "&&=" && !isTruthy(getMemberValue(member.object, member.property, context))) {
26003
+ const current = node.operator === "=" ? void 0 : getPropertyValue(member.object, member.property, context);
26004
+ if (node.operator === "&&=" && !isTruthy(current)) {
26021
26005
  return {
26022
26006
  kind: "normal",
26023
26007
  hasValue: true,
26024
- value: getMemberValue(member.object, member.property, context)
26008
+ value: current
26025
26009
  };
26026
26010
  }
26027
- if (node.operator === "||=" && isTruthy(getMemberValue(member.object, member.property, context))) {
26011
+ if (node.operator === "||=" && isTruthy(current)) {
26028
26012
  return {
26029
26013
  kind: "normal",
26030
26014
  hasValue: true,
26031
- value: getMemberValue(member.object, member.property, context)
26015
+ value: current
26032
26016
  };
26033
26017
  }
26034
- if (node.operator === "??=" && getMemberValue(member.object, member.property, context) !== null && getMemberValue(member.object, member.property, context) !== void 0) {
26018
+ if (node.operator === "??=" && current !== null && current !== void 0) {
26035
26019
  return {
26036
26020
  kind: "normal",
26037
26021
  hasValue: true,
26038
- value: getMemberValue(member.object, member.property, context)
26022
+ value: current
26039
26023
  };
26040
26024
  }
26041
26025
  const right = await evaluateNode(node.right, context);
26042
26026
  if (right.kind !== "normal") {
26043
26027
  return right;
26044
26028
  }
26045
- const current = getMemberValue(member.object, member.property, context);
26046
- const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : applyCompoundAssignmentOperator(node.operator, current, right.value, context);
26029
+ const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
26047
26030
  setSandboxProperty(member.object, member.property, value);
26048
26031
  return {
26049
26032
  kind: "normal",
@@ -27010,10 +26993,7 @@ async function evaluateIdentifierUpdateExpression(node, context) {
27010
26993
  )
27011
26994
  };
27012
26995
  }
27013
- if (binding.kind === "const") {
27014
- throw new TypeError(`Cannot assign to const '${node.argument.name}'`);
27015
- }
27016
- const current = Number(binding.value);
26996
+ const current = toNumber(await toNumericPrimitive(binding.value, context));
27017
26997
  const next = node.operator === "++" ? current + 1 : current - 1;
27018
26998
  context.scope.assign(node.argument.name, next);
27019
26999
  return {
@@ -27036,10 +27016,9 @@ async function evaluateMemberUpdateExpression(node, context) {
27036
27016
  if (member.kind === "nullish") {
27037
27017
  throw new TypeError("Cannot update properties of null or undefined.");
27038
27018
  }
27039
- if (!isIndexableSandboxValue(member.object)) {
27040
- throw new TypeError("Update expressions require a sandbox object property.");
27041
- }
27042
- const current = Number(getMemberValue(member.object, member.property, context));
27019
+ const current = toNumber(
27020
+ await toNumericPrimitive(getPropertyValue(member.object, member.property, context), context)
27021
+ );
27043
27022
  const next = node.operator === "++" ? current + 1 : current - 1;
27044
27023
  setSandboxProperty(member.object, member.property, next);
27045
27024
  return {
@@ -27050,94 +27029,33 @@ async function evaluateMemberUpdateExpression(node, context) {
27050
27029
  }
27051
27030
  async function evaluateMemberExpression(node, context) {
27052
27031
  const member = await evaluateMemberAccess(node, context);
27053
- if (member.kind === "error") {
27054
- return member;
27055
- }
27056
- if (member.kind === "completion") {
27057
- return member.result;
27058
- }
27032
+ if (member.kind === "error") return member;
27033
+ if (member.kind === "completion") return member.result;
27059
27034
  if (member.kind === "nullish") {
27060
- if (node.optional) {
27061
- return {
27062
- kind: "normal",
27063
- hasValue: true,
27064
- value: void 0
27065
- };
27066
- }
27035
+ if (node.optional) return { kind: "normal", hasValue: true, value: void 0 };
27067
27036
  throw new TypeError("Cannot read properties of null or undefined.");
27068
27037
  }
27069
- if (typeof member.object === "string") {
27070
- return {
27071
- kind: "normal",
27072
- hasValue: true,
27073
- value: getStringMember(member.object, member.property, context.budget)
27074
- };
27075
- }
27076
- if (typeof member.object === "number") {
27077
- return {
27078
- kind: "normal",
27079
- hasValue: true,
27080
- value: getNumberMember(member.object, member.property, context.budget)
27081
- };
27082
- }
27083
- if (Array.isArray(member.object)) {
27084
- return {
27085
- kind: "normal",
27086
- hasValue: true,
27087
- value: getArrayMemberValue(member.object, member.property, context)
27088
- };
27089
- }
27090
- if (isSandboxMap(member.object)) {
27091
- return {
27092
- kind: "normal",
27093
- hasValue: true,
27094
- value: getMapMember(member.object, member.property, createMapMethodOptions(context))
27095
- };
27096
- }
27097
- if (isSandboxSet(member.object)) {
27098
- return {
27099
- kind: "normal",
27100
- hasValue: true,
27101
- value: getSetMember(member.object, member.property, createSetMethodOptions(context))
27102
- };
27103
- }
27104
- if (isSandboxGenerator(member.object)) {
27105
- return {
27106
- kind: "normal",
27107
- hasValue: true,
27108
- value: getGeneratorMember(member.object, member.property, context.budget)
27109
- };
27110
- }
27111
- if (isSandboxClosure(member.object)) {
27112
- return {
27113
- kind: "normal",
27114
- hasValue: true,
27115
- value: getClosureMemberValue(member.object, member.property, context)
27116
- };
27117
- }
27118
- if (isSandboxPromise(member.object)) {
27119
- return {
27120
- kind: "normal",
27121
- hasValue: true,
27122
- value: getPromiseMember(member.property, context.budget)
27123
- };
27124
- }
27125
- if (isSandboxRegex(member.object)) {
27126
- return {
27127
- kind: "normal",
27128
- hasValue: true,
27129
- value: getRegexMember(member.object, member.property)
27130
- };
27131
- }
27132
- if (!isIndexableSandboxValue(member.object)) {
27133
- throw new TypeError("Attempted to read a property from a non-object value.");
27134
- }
27135
27038
  return {
27136
27039
  kind: "normal",
27137
27040
  hasValue: true,
27138
- value: getMemberValue(member.object, member.property, context)
27041
+ value: getPropertyValue(member.object, member.property, context)
27139
27042
  };
27140
27043
  }
27044
+ function getPropertyValue(target, property, context) {
27045
+ if (typeof target === "string") return getStringMember(target, property, context.budget);
27046
+ if (typeof target === "number") return getNumberMember(target, property, context.budget);
27047
+ if (typeof target === "boolean") return void 0;
27048
+ if (isSandboxMap(target)) return getMapMember(target, property, createMapMethodOptions(context));
27049
+ if (isSandboxSet(target)) return getSetMember(target, property, createSetMethodOptions(context));
27050
+ if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
27051
+ if (isSandboxClosure(target)) return getClosureMemberValue(target, property, context);
27052
+ if (isSandboxPromise(target)) return getPromiseMember(property, context.budget);
27053
+ if (isSandboxRegex(target)) return getRegexMember(target, property);
27054
+ if (!isIndexableSandboxValue(target)) {
27055
+ throw new TypeError("Attempted to read a property from a non-object value.");
27056
+ }
27057
+ return getMemberValue(target, property, context);
27058
+ }
27141
27059
  async function evaluateCallExpression(node, context) {
27142
27060
  if (node.callee.type === "MemberExpression") {
27143
27061
  context.budget.visitNode();
@@ -27613,7 +27531,9 @@ function applyBinaryOperator(node, left, right, context) {
27613
27531
  throw createError("UNSUPPORTED_NODE", node, "Binary operator 'in' is not supported.");
27614
27532
  }
27615
27533
  }
27616
- function applyCompoundAssignmentOperator(operator, left, right, context) {
27534
+ async function applyCompoundAssignmentOperator(operator, left, right, context) {
27535
+ left = await toNumericPrimitive(left, context);
27536
+ right = await toNumericPrimitive(right, context);
27617
27537
  switch (operator) {
27618
27538
  case "+=":
27619
27539
  return applyAdditionOperator(left, right, context);
@@ -27740,6 +27660,9 @@ async function toNumericPrimitive(value, context) {
27740
27660
  if (isIndexableSandboxValue(value)) {
27741
27661
  for (const methodName of ["valueOf", "toString"]) {
27742
27662
  const method = getMemberValue(value, methodName, context);
27663
+ if (methodName === "toString" && method === void 0 && !Object.hasOwn(value, methodName)) {
27664
+ return toString(value);
27665
+ }
27743
27666
  if (!isSandboxClosure(method)) {
27744
27667
  continue;
27745
27668
  }
@@ -27755,6 +27678,7 @@ async function toNumericPrimitive(value, context) {
27755
27678
  return result;
27756
27679
  }
27757
27680
  }
27681
+ throw new TypeError("Cannot convert object to primitive value.");
27758
27682
  }
27759
27683
  return toString(value);
27760
27684
  }
@@ -27809,17 +27733,30 @@ function getArrayMemberValue(target, property, context) {
27809
27733
  return getArrayMember(target, property, createArrayMethodOptions(context));
27810
27734
  }
27811
27735
  function setSandboxProperty(target, property, value) {
27736
+ if (isSandboxRegex(target)) {
27737
+ setRegexMember(target, property, value);
27738
+ return;
27739
+ }
27740
+ if (!isIndexableSandboxValue(target)) {
27741
+ throw new TypeError("Assignment expressions require a sandbox object property.");
27742
+ }
27743
+ const key = String(property);
27812
27744
  if (Array.isArray(target)) {
27813
27745
  assertCollectionMutable(target);
27814
- const key = String(property);
27815
27746
  if (key === "length" || isArrayIndexKey3(key)) {
27816
27747
  target[key] = value;
27817
27748
  return;
27818
27749
  }
27750
+ }
27751
+ const descriptor = Object.getOwnPropertyDescriptor(target, key);
27752
+ if (descriptor !== void 0) {
27753
+ if (descriptor.writable !== true) {
27754
+ throw new TypeError(`Cannot assign to read only property '${key}'.`);
27755
+ }
27756
+ Object.defineProperty(target, key, { value });
27757
+ } else {
27819
27758
  defineSandboxProperty(target, key, value);
27820
- return;
27821
27759
  }
27822
- defineSandboxProperty(target, String(property), value);
27823
27760
  }
27824
27761
  function deleteSandboxProperty(target, property) {
27825
27762
  if (Array.isArray(target)) {
@@ -28939,4 +28876,4 @@ export {
28939
28876
  FileSnapshotBackend,
28940
28877
  run
28941
28878
  };
28942
- //# sourceMappingURL=chunk-JLYBD3E6.js.map
28879
+ //# sourceMappingURL=chunk-DKXGPEOM.js.map