@parcha/agentrun-dsl 0.1.0-beta.277 → 0.1.0-beta.279

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.
@@ -220,6 +220,11 @@ export declare function openRecovery(store: RecoveryStore, workflow: Workflow, o
220
220
  * continuation identity, whatever fires again. */
221
221
  escalate(row: Omit<EscalationRow, "tail" | "revision">): Promise<EscalationRow>;
222
222
  escalation(): EscalationRow | undefined;
223
+ /** The run failed: its frame is committed once more, so the journal holds every node the run began and never
224
+ * committed. A node's start is otherwise durable only with the next commit, and a step that failed before anything
225
+ * under it was written (a read of a state path no node wrote) would leave no trace of where the run failed. A
226
+ * stopped driver, or one whose commit failed, writes nothing; a failed write is thrown, as `flush` throws it. */
227
+ failed(): Promise<void>;
223
228
  /** The driver's frame as it stands, serialized: what a host shows of a live run while its store is held. */
224
229
  pinJson(): string;
225
230
  /** How many effects the driver admitted. */
@@ -1209,6 +1209,16 @@ export async function openRecovery(store, workflow, options) {
1209
1209
  return snapshot.escalation;
1210
1210
  },
1211
1211
  escalation() { return snapshot.escalation; },
1212
+ /** The run failed: its frame is committed once more, so the journal holds every node the run began and never
1213
+ * committed. A node's start is otherwise durable only with the next commit, and a step that failed before anything
1214
+ * under it was written (a read of a state path no node wrote) would leave no trace of where the run failed. A
1215
+ * stopped driver, or one whose commit failed, writes nothing; a failed write is thrown, as `flush` throws it. */
1216
+ async failed() {
1217
+ if (fatal || stopping)
1218
+ return;
1219
+ void save();
1220
+ await flush();
1221
+ },
1212
1222
  /** The driver's frame as it stands, serialized: what a host shows of a live run while its store is held. */
1213
1223
  pinJson() { return JSON.stringify(snapshot.pin); },
1214
1224
  /** How many effects the driver admitted. */
package/dist/workflow.js CHANGED
@@ -1971,13 +1971,17 @@ export function isItemFailure(error) {
1971
1971
  }
1972
1972
  /** The failure a structure reports when several of its branches (a parallel's, a stopping map's items) fail at once: the
1973
1973
  * first, unless that is an item failure and another is not, whichever came first. An item failure never hides a failure a
1974
- * collecting map must stop on. A sibling that ended on the structure's own stop (its reason, an abort, or a decision its
1975
- * provider reports `aborted`, as Jev and OpenRouter report a request cancelled in flight) is not one: a run's own cancel
1976
- * still stops a collecting map, which checks its signal first. */
1974
+ * collecting map must stop on. A sibling that ended on the structure's own stop (its reason, an abort, a decision its
1975
+ * provider reports `aborted`, as Jev and OpenRouter report a request cancelled in flight, an effect cut before it
1976
+ * settled, whose outcome is unknown, or a structure in it that failed so: withSiblingUncertainty counts their effects)
1977
+ * is not one: a run's own cancel still stops a collecting map, which checks its signal first. */
1977
1978
  function reportedFailure(first, others) {
1978
1979
  if (!isItemFailure(first))
1979
1980
  return first;
1980
- const stopped = (error) => error?.name === "AbortError" || (error instanceof DecisionProviderError && error.code === "aborted");
1981
+ const stopped = (error) => error?.name === "AbortError" || (error instanceof DecisionProviderError && error.code === "aborted")
1982
+ || (error instanceof EffectOutcomeUnknownError && error.interruption === "cancelled")
1983
+ // A structure inside a sibling that the stop cut fails by what it cut, with its uncertain effects beside it.
1984
+ || (error instanceof AggregateError && siblingFailures.has(error) && stopped(error.cause));
1981
1985
  return others.find((error) => error !== first && !stopped(error) && !isItemFailure(error)) ?? first;
1982
1986
  }
1983
1987
  /** The label of the step an error failed in, set as the error leaves the innermost step and prefixed by every child
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-dsl",
3
- "version": "0.1.0-beta.277",
3
+ "version": "0.1.0-beta.279",
4
4
  "description": "Composable, typed workflows for agents",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",