poe-code 12.0.8 → 12.0.10

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/README.md CHANGED
@@ -323,6 +323,34 @@ Full browser SafeJS SDK/runtime support remains pending. Guest codec integration
323
323
  portable SDK declaration closure and shared host-call policy/replay metadata
324
324
  require separate integration; a browser filesystem build does not prove them.
325
325
 
326
+ #### Host-operation recovery policy
327
+
328
+ The Node SafeJS SDK selects recovery policy when a host call is issued:
329
+ `declareHostOperation(function, policy)` takes precedence, otherwise the exact
330
+ journaled module/operation pair registered with `registerPendingHostCallPolicy`
331
+ supplies the default, otherwise the call is `re-issue`. Named registration is not
332
+ limited to legacy snapshot reconciliation. Caller bindings use module ID
333
+ `<bindings>`. Registration affects subsequent calls, not previously captured
334
+ history; a changed policy on replay fails closed rather than downgrading a
335
+ captured side effect.
336
+
337
+ A restored invocation identity conflict rejects with the actual
338
+ `HostCallResumabilityError` class and `action: "reset"`. Native engine errors
339
+ retain their identity across synchronous and asynchronous host-error paths;
340
+ guest catch/finally handlers cannot turn them into successful recovery. Names,
341
+ action fields and copied prototypes do not grant engine-error identity. Ordinary
342
+ guest/host errors and cancellation retain their separate conversion rules.
343
+
344
+ Recorded outcomes are reused. A pending `read-side-effect` call requires a
345
+ matching external reconciliation proof and is not blindly invoked again;
346
+ `re-issue` permits another invocation. Neither registration nor checkpointing
347
+ makes arbitrary external effects exactly-once. Shared function aliases retain
348
+ their existing canonical journal identity, so declare the function itself when
349
+ its aliases must share an effect policy. See the
350
+ [host-policy contract](packages/safe-js/CHECKPOINT_REPLAY.md#host-operation-policy-selection)
351
+ for registration lifetime, naming and reconciliation requirements. This changes
352
+ no CLI flags and adds no browser SafeJS runtime support.
353
+
326
354
  ## Building from Source
327
355
 
328
356
  Run `npm run build` to compile the workspace and generate the published bundles.
package/dist/index.js CHANGED
@@ -137803,6 +137803,9 @@ function registerPendingHostCallPolicy(registration) {
137803
137803
  MODULE_PENDING_HOST_CALL_POLICIES[moduleId] ??= /* @__PURE__ */ Object.create(null);
137804
137804
  MODULE_PENDING_HOST_CALL_POLICIES[moduleId][operation] = policy;
137805
137805
  }
137806
+ function readRegisteredPendingHostCallPolicy(moduleId, operation) {
137807
+ return MODULE_PENDING_HOST_CALL_POLICIES[moduleId]?.[operation];
137808
+ }
137806
137809
  function pendingHostCallResumeIdentityMatches(expected, actual) {
137807
137810
  return actual.callId === expected.callId && actual.sourceHash === expected.sourceHash && actual.moduleId === expected.moduleId && actual.operation === expected.operation && actual.argumentDigest === expected.argumentDigest;
137808
137811
  }
@@ -138071,9 +138074,13 @@ var init_host_call = __esm({
138071
138074
  init_validation();
138072
138075
  init_policy();
138073
138076
  HostCallResumabilityError = class extends Error {
138077
+ #nativeInstance = true;
138074
138078
  action;
138075
138079
  callId;
138076
138080
  lifecycle;
138081
+ static [Symbol.hasInstance](value) {
138082
+ return typeof value === "object" && value !== null && #nativeInstance in value && Function.prototype[Symbol.hasInstance].call(this, value);
138083
+ }
138077
138084
  constructor(record2, action, message2) {
138078
138085
  super(message2);
138079
138086
  this.name = "HostCallResumabilityError";
@@ -138503,6 +138510,9 @@ function isCapturedException(value) {
138503
138510
  return typeof value === "object" && value !== null && capturedExceptionBrand in value;
138504
138511
  }
138505
138512
  function coerceThrownValue(reason, budget, stackFrames, span, sandbox = false) {
138513
+ if (reason instanceof HostCallResumabilityError) {
138514
+ throw reason;
138515
+ }
138506
138516
  if (isSubsetErrorValue(reason)) {
138507
138517
  attachErrorSpan(reason, readErrorSpan(reason) ?? span);
138508
138518
  return reason;
@@ -141684,10 +141694,10 @@ function wrapCallerInjectedFunction(name, value, options, state) {
141684
141694
  const hostArgs = deepCopyFromSandbox([...args], {
141685
141695
  wrapClosure: (closure) => wrapSandboxClosureForHost(closure, stackFrames, options.budget, callbacks)
141686
141696
  });
141687
- const policy = readHostOperationPolicy(value) ?? "re-issue";
141688
141697
  const hostCalls = options.hostCalls;
141689
141698
  const operation = options.operation ?? bindingName;
141690
141699
  const moduleId = options.moduleId ?? "<bindings>";
141700
+ const policy = readHostOperationPolicy(value) ?? readRegisteredPendingHostCallPolicy(moduleId, operation) ?? "re-issue";
141691
141701
  if (hostCalls === void 0) {
141692
141702
  return copyHostResultToSandbox(
141693
141703
  invokeHostCallback(() => Reflect.apply(callable, void 0, hostArgs), options),
@@ -141888,6 +141898,9 @@ function executeHostCall(record2, restored, invoke2, stackFrames, options, span,
141888
141898
  try {
141889
141899
  result = invoke2();
141890
141900
  } catch (error3) {
141901
+ if (error3 instanceof HostCallResumabilityError) {
141902
+ throw error3;
141903
+ }
141891
141904
  const reason = createHostErrorValue(error3, stackFrames, options.budget, span);
141892
141905
  hostCalls.settle(record2, { status: "rejected", reason });
141893
141906
  throw error3;
@@ -142515,6 +142528,7 @@ var init_host_bridge = __esm({
142515
142528
  init_float32();
142516
142529
  init_exceptions();
142517
142530
  init_otel2();
142531
+ init_policy();
142518
142532
  init_host_call();
142519
142533
  init_values();
142520
142534
  init_running_state();
@@ -156452,7 +156466,7 @@ var init_package2 = __esm({
156452
156466
  "package.json"() {
156453
156467
  package_default2 = {
156454
156468
  name: "poe-code",
156455
- version: "12.0.8",
156469
+ version: "12.0.10",
156456
156470
  description: "CLI tool to configure Poe API for developer workflows.",
156457
156471
  license: "MIT",
156458
156472
  type: "module",