@fro.bot/systematic 3.21.6 → 3.21.8

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/dist/index.js CHANGED
@@ -8381,8 +8381,9 @@ function parseReadback(input) {
8381
8381
  "resourceRevisionIdentity",
8382
8382
  "pullRequest",
8383
8383
  "checkState",
8384
- "reviewDecision"
8385
- ])) || !isBoundedString(input.workspaceIdentity) || input.operation !== undefined && !isOperation4(input.operation)) {
8384
+ "reviewDecision",
8385
+ "propagate"
8386
+ ])) || !isBoundedString(input.workspaceIdentity) || input.operation !== undefined && !isOperation4(input.operation) || input.propagate !== undefined && typeof input.propagate !== "boolean") {
8386
8387
  return;
8387
8388
  }
8388
8389
  const after = parseLegacyReadbackAfter({
@@ -8408,7 +8409,8 @@ function parseReadback(input) {
8408
8409
  resourceRevisionIdentity: after.resourceRevisionIdentity,
8409
8410
  pullRequest: after.pullRequest,
8410
8411
  checkState: after.checkState,
8411
- reviewDecision: after.reviewDecision
8412
+ reviewDecision: after.reviewDecision,
8413
+ ...input.propagate === undefined ? {} : { propagate: input.propagate }
8412
8414
  };
8413
8415
  }
8414
8416
  function parseLegacyReadbackAfter(input) {
@@ -8845,7 +8847,7 @@ function createWorkflowGuard(options) {
8845
8847
  const expected = unit ? currentResource(unit, readback.operation) : currentResourceIdentities.get(readback.operation);
8846
8848
  const changed = readback.resourceIdentity !== expected;
8847
8849
  currentResourceIdentities.set(readback.operation, readback.resourceIdentity);
8848
- if (readback.operation === "pr-creation" && unit) {
8850
+ if (readback.operation === "pr-creation" && unit && readback.propagate !== false) {
8849
8851
  propagatePullRequestScope(unit, readback.resourceIdentity);
8850
8852
  }
8851
8853
  return changed;
@@ -10192,6 +10194,9 @@ function createWorkflowGuard(options) {
10192
10194
  currentOperationContext() {
10193
10195
  return currentOperationContext();
10194
10196
  },
10197
+ hasResourceBaseline(operation) {
10198
+ return epoch?.unit ? currentResource(epoch.unit, operation) !== undefined : false;
10199
+ },
10195
10200
  status() {
10196
10201
  return projection();
10197
10202
  },
@@ -10317,6 +10322,7 @@ var REASON_CODES = new Set([
10317
10322
  "no-op-operation",
10318
10323
  "operation-not-required",
10319
10324
  "operation-target-mismatch",
10325
+ "readback-timeout",
10320
10326
  "receipt-mismatch",
10321
10327
  "rejected-operation",
10322
10328
  "resource-mismatch",
@@ -10354,14 +10360,55 @@ function isWorkflowGuardBlockedError(value) {
10354
10360
  return false;
10355
10361
  return typeof candidate.reasonCode === "string" && REASON_CODES.has(candidate.reasonCode);
10356
10362
  }
10363
+ function defaultTargetObserver(targetDirectory) {
10364
+ return createOpencodeOperationObserver({ targetDirectory });
10365
+ }
10366
+ function unconfirmedReadback(probe) {
10367
+ return { probe, reasonCode: "command-timeout" };
10368
+ }
10357
10369
  function initializationCause(kind) {
10358
10370
  return { site: "initialize-session", kind, timedOut: false };
10359
10371
  }
10360
- var OBSERVER_READBACK_FAILED_CAUSE = Object.freeze({
10361
- site: "refresh-readback",
10362
- kind: "observer-readback-failed",
10363
- timedOut: false
10364
- });
10372
+ function observerReadbackFailedCause(reasonCode, site = "refresh-readback") {
10373
+ return {
10374
+ site,
10375
+ kind: "observer-readback-failed",
10376
+ ...reasonCode !== undefined ? { reasonCode } : {},
10377
+ timedOut: reasonCode === "command-timeout"
10378
+ };
10379
+ }
10380
+ function remoteFailureReason(result) {
10381
+ if (result?.status === "missing-resource")
10382
+ return "missing-resource";
10383
+ if (result?.status === "unavailable")
10384
+ return result.reasonCode;
10385
+ return;
10386
+ }
10387
+ async function readSnapshot(observer, expectedTargetIdentity) {
10388
+ let result;
10389
+ try {
10390
+ result = await observer.snapshot();
10391
+ } catch {
10392
+ return { status: "fatal" };
10393
+ }
10394
+ if (isProbeTimeout(result))
10395
+ return { status: "timeout" };
10396
+ if (result.status === "unavailable") {
10397
+ return { status: "fatal", reasonCode: result.reasonCode };
10398
+ }
10399
+ if (expectedTargetIdentity !== undefined && result.snapshot.targetDigest !== expectedTargetIdentity) {
10400
+ return { status: "fatal" };
10401
+ }
10402
+ return { status: "ok", value: result.snapshot };
10403
+ }
10404
+ function isProbeTimeout(result) {
10405
+ if (result === undefined)
10406
+ return false;
10407
+ if (result.status !== "unavailable" && result.status !== "error") {
10408
+ return false;
10409
+ }
10410
+ return result.reasonCode === "command-timeout";
10411
+ }
10365
10412
  var startToolShape = {
10366
10413
  expected_operations: array(_enum(OPERATIONS)).optional(),
10367
10414
  resource_scopes: record(string(), string()).optional()
@@ -10846,14 +10893,16 @@ function isSuccessfulAfter(output) {
10846
10893
  function isSuccessfulSkillAfter(output) {
10847
10894
  return parseHostOutput(output, { maxOutputLength: Number.POSITIVE_INFINITY }) !== undefined;
10848
10895
  }
10849
- function statusForTool(status, unavailableCause) {
10896
+ function statusForTool(status, unavailableCause, seedDeferrals = [], unconfirmedReadbacks = []) {
10850
10897
  return JSON.stringify({
10851
10898
  state: status.state,
10852
10899
  reasonCode: status.reasonCode,
10853
10900
  ...status.repair ? { repair: status.repair } : {},
10854
10901
  satisfiedOperations: status.satisfiedOperations,
10855
10902
  missingOperations: status.missingOperations,
10856
- ...unavailableCause && status.state === "unavailable" ? { firstUnavailableCause: unavailableCause } : {}
10903
+ ...unavailableCause && status.state === "unavailable" ? { firstUnavailableCause: unavailableCause } : {},
10904
+ ...seedDeferrals.length > 0 ? { seedDeferrals } : {},
10905
+ ...unconfirmedReadbacks.length > 0 ? { unconfirmedReadbacks } : {}
10857
10906
  });
10858
10907
  }
10859
10908
  function markerStatusRank(state) {
@@ -11039,10 +11088,15 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11039
11088
  const blockedQuestionCalls = new Map;
11040
11089
  const consumedQuestionTargets = new Set;
11041
11090
  let firstUnavailableCause;
11091
+ let seedDeferralRecord;
11092
+ let unitStartGeneration = 0;
11042
11093
  function startFreshUnit(input, policy) {
11043
11094
  const result = guard.startUnit(input, policy);
11044
- if (result.status === "started")
11095
+ if (result.status === "started") {
11096
+ unitStartGeneration += 1;
11045
11097
  firstUnavailableCause = undefined;
11098
+ seedDeferralRecord = undefined;
11099
+ }
11046
11100
  return result;
11047
11101
  }
11048
11102
  function recordUnavailable(target, cause) {
@@ -11096,34 +11150,48 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11096
11150
  return;
11097
11151
  return parentObserverRegistration();
11098
11152
  }
11099
- function effectiveOperationObserver() {
11153
+ function resolveEffectiveObserver() {
11100
11154
  const parentObserver = options.observer;
11101
11155
  if (!parentObserver)
11102
- return;
11156
+ return { status: "fatal" };
11103
11157
  const pinnedTargetIdentity = guard.status().unit?.pinnedOperationTargetIdentity;
11104
11158
  if (pinnedTargetIdentity === undefined || pinnedTargetIdentity === options.workspaceIdentity) {
11105
11159
  return {
11106
- observer: parentObserver,
11107
- targetIdentity: options.workspaceIdentity,
11108
- pinned: false
11160
+ status: "ok",
11161
+ value: {
11162
+ observer: parentObserver,
11163
+ targetIdentity: options.workspaceIdentity,
11164
+ pinned: false
11165
+ }
11109
11166
  };
11110
11167
  }
11111
11168
  const registration = operationObserverRegistration(pinnedTargetIdentity);
11112
11169
  if (!registration)
11113
- return;
11170
+ return { status: "fatal" };
11171
+ return resolvePinnedObserver(parentObserver, registration, pinnedTargetIdentity);
11172
+ }
11173
+ function resolvePinnedObserver(parentObserver, registration, pinnedTargetIdentity) {
11114
11174
  let validation;
11115
11175
  try {
11116
11176
  validation = parentObserver.validateRegisteredWorktree(registration.targetRoot);
11117
11177
  } catch {
11118
- return;
11178
+ return { status: "fatal" };
11119
11179
  }
11120
- if (validation.status !== "ok" || validation.targetRoot !== registration.targetRoot || registeredWorktreeIdentity(validation) !== registration.registeredWorktreeIdentity || registration.observer.targetDigest !== pinnedTargetIdentity) {
11121
- return;
11180
+ if (isProbeTimeout(validation))
11181
+ return { status: "timeout" };
11182
+ if (validation.status !== "ok") {
11183
+ return { status: "fatal", reasonCode: validation.reasonCode };
11184
+ }
11185
+ if (validation.targetRoot !== registration.targetRoot || registeredWorktreeIdentity(validation) !== registration.registeredWorktreeIdentity || registration.observer.targetDigest !== pinnedTargetIdentity) {
11186
+ return { status: "fatal" };
11122
11187
  }
11123
11188
  return {
11124
- observer: registration.observer,
11125
- targetIdentity: pinnedTargetIdentity,
11126
- pinned: true
11189
+ status: "ok",
11190
+ value: {
11191
+ observer: registration.observer,
11192
+ targetIdentity: pinnedTargetIdentity,
11193
+ pinned: true
11194
+ }
11127
11195
  };
11128
11196
  }
11129
11197
  function questionResource(target) {
@@ -11807,51 +11875,76 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11807
11875
  function observerReadbackApplies() {
11808
11876
  return options.observer !== undefined && guard.status().epoch !== null;
11809
11877
  }
11878
+ function skippedWithRemoteTail(head) {
11879
+ return [
11880
+ unconfirmedReadback(head),
11881
+ ...guard.status().satisfiedOperations.filter(remoteOperation).map((operation) => unconfirmedReadback(operation))
11882
+ ];
11883
+ }
11810
11884
  async function refreshReadback() {
11811
11885
  if (!observerReadbackApplies())
11812
- return;
11813
- const effective = effectiveOperationObserver();
11814
- if (!effective) {
11815
- markUnavailable(OBSERVER_READBACK_FAILED_CAUSE);
11816
- return;
11886
+ return [];
11887
+ const lookup = resolveEffectiveObserver();
11888
+ if (lookup.status === "timeout")
11889
+ return skippedWithRemoteTail("pinned");
11890
+ if (lookup.status === "fatal") {
11891
+ markUnavailable(observerReadbackFailedCause(lookup.reasonCode));
11892
+ return [];
11817
11893
  }
11818
- let result;
11819
- try {
11820
- result = await effective.observer.snapshot();
11821
- } catch {
11822
- markUnavailable(OBSERVER_READBACK_FAILED_CAUSE);
11823
- return;
11894
+ const effective = lookup.value;
11895
+ const read = await readSnapshot(effective.observer, effective.targetIdentity);
11896
+ if (read.status === "timeout") {
11897
+ return skippedWithRemoteTail(effective.pinned ? "pinned" : "local");
11824
11898
  }
11825
- if (result.status === "unavailable" || result.snapshot.targetDigest !== effective.targetIdentity) {
11826
- markUnavailable(OBSERVER_READBACK_FAILED_CAUSE);
11827
- return;
11899
+ if (read.status === "fatal") {
11900
+ markUnavailable(observerReadbackFailedCause(read.reasonCode));
11901
+ return [];
11828
11902
  }
11903
+ return applyReadbackAndProbeRemote(effective, read.value);
11904
+ }
11905
+ async function applyReadbackAndProbeRemote(effective, snapshot) {
11829
11906
  const observed = guard.observeReadback({
11830
11907
  workspaceIdentity: options.workspaceIdentity,
11831
- repositoryIdentity: result.snapshot.repositoryRevisionDigest,
11832
- worktreeIdentity: result.snapshot.worktreeRevisionDigest,
11908
+ repositoryIdentity: snapshot.repositoryRevisionDigest,
11909
+ worktreeIdentity: snapshot.worktreeRevisionDigest,
11833
11910
  ...effective.pinned ? { operationTargetIdentity: effective.targetIdentity } : {}
11834
11911
  });
11835
- if (observed.status === "rejected" && observed.reasonCode === "workspace-mismatch" || !await refreshRemoteReadbacks(effective.observer, result.snapshot)) {
11836
- markUnavailable(OBSERVER_READBACK_FAILED_CAUSE);
11912
+ if (observed.status === "rejected" && observed.reasonCode === "workspace-mismatch") {
11913
+ markUnavailable(observerReadbackFailedCause());
11914
+ return [];
11915
+ }
11916
+ const remote = await refreshRemoteReadbacks(effective.observer, snapshot);
11917
+ if (remote.kind === "fatal") {
11918
+ markUnavailable(observerReadbackFailedCause(remote.reasonCode));
11837
11919
  }
11920
+ return remote.unconfirmed;
11838
11921
  }
11839
11922
  async function refreshRemoteReadbacks(observer, local) {
11840
11923
  const remoteOperations = guard.status().satisfiedOperations.filter(remoteOperation);
11841
11924
  if (remoteOperations.length === 0)
11842
- return true;
11925
+ return { kind: "ok", unconfirmed: [] };
11843
11926
  const remoteSnapshot = observer.remoteSnapshot;
11844
11927
  if (!remoteSnapshot)
11845
- return false;
11928
+ return { kind: "fatal", unconfirmed: [] };
11929
+ const unconfirmed = [];
11846
11930
  for (const operation of remoteOperations) {
11847
11931
  const result = await readRemoteScope(remoteSnapshot, operation);
11848
- if (result?.status !== "available")
11849
- return false;
11932
+ if (isProbeTimeout(result)) {
11933
+ unconfirmed.push(unconfirmedReadback(operation));
11934
+ continue;
11935
+ }
11936
+ if (result?.status !== "available") {
11937
+ return {
11938
+ kind: "fatal",
11939
+ unconfirmed,
11940
+ reasonCode: remoteFailureReason(result)
11941
+ };
11942
+ }
11850
11943
  const observed = guard.observeReadback(remoteReadbackInput(operation, local, options.workspaceIdentity, result.snapshot));
11851
11944
  if (observed.status === "rejected")
11852
- return false;
11945
+ return { kind: "fatal", unconfirmed };
11853
11946
  }
11854
- return true;
11947
+ return { kind: "ok", unconfirmed };
11855
11948
  }
11856
11949
  function currentMarkerSource() {
11857
11950
  const status = guard.status();
@@ -12114,10 +12207,11 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12114
12207
  if (!remoteSnapshot)
12115
12208
  return { operation: classification.category };
12116
12209
  try {
12117
- return {
12118
- operation: classification.category,
12119
- before: await remoteSnapshot(classification.category, "before")
12120
- };
12210
+ let before = await remoteSnapshot(classification.category, "before");
12211
+ if (before.status === "unavailable" && before.reasonCode === "command-timeout" && deferredSeedFor(classification.category)) {
12212
+ before = await remoteSnapshot(classification.category, "before");
12213
+ }
12214
+ return { operation: classification.category, before };
12121
12215
  } catch {
12122
12216
  return { operation: classification.category };
12123
12217
  }
@@ -12125,6 +12219,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12125
12219
  async function prepareOperation(host, args2) {
12126
12220
  if (!options.observer || !isLocalOperationTool(host.tool))
12127
12221
  return;
12222
+ const initiator = currentInitiator();
12128
12223
  const { parentTargetRoot, sessionLocation } = effectiveTargetContext();
12129
12224
  const fingerprint = argsFingerprint(ledger, host.tool, args2, sessionLocation);
12130
12225
  if (!fingerprint) {
@@ -12161,9 +12256,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12161
12256
  markUnavailable();
12162
12257
  return;
12163
12258
  }
12164
- const operationObserver = target.targetRoot === canonicalParentTargetRoot ? options.observer : [...operationObservers.values()].find((registration) => registration.targetRoot === target.targetRoot)?.observer ?? createOpencodeOperationObserver({
12165
- targetDirectory: target.targetRoot
12166
- });
12259
+ const operationObserver = target.targetRoot === canonicalParentTargetRoot ? options.observer : [...operationObservers.values()].find((registration) => registration.targetRoot === target.targetRoot)?.observer ?? (options.createTargetObserver ?? defaultTargetObserver)(target.targetRoot);
12167
12260
  let result;
12168
12261
  try {
12169
12262
  result = await operationObserver.snapshot();
@@ -12185,6 +12278,9 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12185
12278
  observer: operationObserver
12186
12279
  });
12187
12280
  const remote = await remoteIntentForOperation(host, args2, operationObserver);
12281
+ if (remote) {
12282
+ bindDeferredBaseline(remote.operation, remote.before, operationObserver, initiator);
12283
+ }
12188
12284
  pendingOperations.set(callDigest, {
12189
12285
  callID: host.callID,
12190
12286
  tool: host.tool,
@@ -12194,6 +12290,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12194
12290
  registeredWorktreeIdentity: registeredIdentity,
12195
12291
  observer: operationObserver,
12196
12292
  before: result.snapshot,
12293
+ ...initiator ? { initiator } : {},
12197
12294
  ...remote ? { remoteOperation: remote.operation, remoteBefore: remote.before } : {}
12198
12295
  });
12199
12296
  }
@@ -12323,52 +12420,151 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12323
12420
  timedOut: local.reasonCode === "command-timeout"
12324
12421
  };
12325
12422
  }
12326
- for (const operation of remoteOperations) {
12327
- const cause = await seedRemoteScope(remoteSnapshot, operation, local.snapshot);
12328
- if (cause)
12329
- return cause;
12423
+ return seedEachRemoteScope(remoteOperations, remoteSnapshot, local.snapshot);
12424
+ }
12425
+ async function seedEachRemoteScope(operations, reader, local) {
12426
+ for (const operation of operations) {
12427
+ const outcome = await seedRemoteScope(reader, operation, local);
12428
+ if (outcome.kind === "fatal")
12429
+ return outcome.cause;
12430
+ if (outcome.kind === "deferred") {
12431
+ recordSeedDeferral(operation, outcome.reasonCode);
12432
+ }
12330
12433
  }
12331
12434
  return;
12332
12435
  }
12436
+ function recordSeedDeferral(operation, reasonCode) {
12437
+ if (guard.hasResourceBaseline(operation))
12438
+ return;
12439
+ const observer = options.observer;
12440
+ if (!observer)
12441
+ return;
12442
+ seedDeferralEntries(true).push({
12443
+ operation,
12444
+ reasonCode,
12445
+ observer,
12446
+ targetIdentity: observer.targetDigest
12447
+ });
12448
+ }
12449
+ function seedDeferralEntries(reset = false) {
12450
+ const unitId = guard.status().unit?.unitId;
12451
+ if (!unitId)
12452
+ return [];
12453
+ if (seedDeferralRecord?.unitId === unitId)
12454
+ return seedDeferralRecord.entries;
12455
+ if (!reset)
12456
+ return [];
12457
+ seedDeferralRecord = { unitId, entries: [] };
12458
+ return seedDeferralRecord.entries;
12459
+ }
12460
+ function deferredSeedFor(operation) {
12461
+ return seedDeferralEntries().find((entry) => entry.operation === operation);
12462
+ }
12463
+ function clearSeedDeferral(operation) {
12464
+ if (!seedDeferralRecord)
12465
+ return;
12466
+ const index = seedDeferralRecord.entries.findIndex((entry) => entry.operation === operation);
12467
+ if (index !== -1)
12468
+ seedDeferralRecord.entries.splice(index, 1);
12469
+ }
12470
+ function bindDeferredBaseline(operation, before, observer, initiator) {
12471
+ if (!initiator || !isCurrentInitiator(initiator))
12472
+ return;
12473
+ const deferred = deferredSeedFor(operation);
12474
+ if (!deferred)
12475
+ return;
12476
+ if (guard.hasResourceBaseline(operation)) {
12477
+ clearSeedDeferral(operation);
12478
+ return;
12479
+ }
12480
+ if (!before || !sameSeedObserver(deferred, observer))
12481
+ return;
12482
+ bindFromBeforeRead(operation, before);
12483
+ }
12484
+ function bindFromBeforeRead(operation, before) {
12485
+ if (before.status === "missing-resource") {
12486
+ if (operation === "pr-creation")
12487
+ clearSeedDeferral(operation);
12488
+ return;
12489
+ }
12490
+ if (before.status !== "available")
12491
+ return;
12492
+ const observed = guard.observeReadback(deferredBaselineReadback(operation, before.snapshot));
12493
+ if (observed.status !== "rejected")
12494
+ clearSeedDeferral(operation);
12495
+ }
12496
+ function currentInitiator() {
12497
+ const current = guard.status();
12498
+ return current.epoch && current.unit ? {
12499
+ epochId: current.epoch.epochId,
12500
+ unitId: current.unit.unitId,
12501
+ generation: unitStartGeneration
12502
+ } : undefined;
12503
+ }
12504
+ function isCurrentInitiator(initiator) {
12505
+ const current = currentInitiator();
12506
+ return current !== undefined && current.epochId === initiator.epochId && current.unitId === initiator.unitId && current.generation === initiator.generation;
12507
+ }
12508
+ function sameSeedObserver(deferred, observer) {
12509
+ return observer === deferred.observer && observer.targetDigest === deferred.targetIdentity;
12510
+ }
12511
+ function deferredBaselineReadback(operation, snapshot) {
12512
+ return {
12513
+ operation,
12514
+ workspaceIdentity: options.workspaceIdentity,
12515
+ resourceIdentity: snapshot.resourceIdentity,
12516
+ ...operation === "push" ? { resourceRevisionIdentity: snapshot.resourceRevisionIdentity } : {},
12517
+ ...operation === "pr-creation" ? { propagate: false } : {}
12518
+ };
12519
+ }
12520
+ function currentSeedDeferrals() {
12521
+ return seedDeferralEntries().map(({ operation, reasonCode }) => ({
12522
+ operation,
12523
+ reasonCode
12524
+ }));
12525
+ }
12526
+ function fatalSeed(cause) {
12527
+ return { kind: "fatal", cause };
12528
+ }
12333
12529
  async function seedRemoteScope(reader, operation, local) {
12334
12530
  const result = await readRemoteScope(reader, operation, "before");
12335
12531
  if (!result) {
12336
- return {
12532
+ return fatalSeed({
12337
12533
  site: "seed-remote-scope",
12338
12534
  kind: "remote-scope-unreadable",
12339
12535
  operation,
12340
12536
  timedOut: false
12341
- };
12537
+ });
12342
12538
  }
12343
12539
  if (result.status === "missing-resource") {
12344
- const allowed = operation === "pr-creation" || operation === "check-readback" || operation === "review-readback";
12345
- return allowed ? undefined : {
12346
- site: "seed-remote-scope",
12347
- kind: "remote-scope-missing-resource",
12348
- operation,
12349
- timedOut: false
12350
- };
12540
+ if (operation === "push") {
12541
+ return { kind: "deferred", reasonCode: "missing-resource" };
12542
+ }
12543
+ return { kind: "tolerated" };
12351
12544
  }
12352
12545
  if (result.status !== "available") {
12353
- return {
12546
+ if (result.reasonCode === "command-timeout") {
12547
+ return { kind: "deferred", reasonCode: "command-timeout" };
12548
+ }
12549
+ return fatalSeed({
12354
12550
  site: "seed-remote-scope",
12355
12551
  kind: "remote-scope-unavailable",
12356
12552
  operation,
12357
12553
  reasonCode: result.reasonCode,
12358
- timedOut: result.reasonCode === "command-timeout"
12359
- };
12554
+ timedOut: false
12555
+ });
12360
12556
  }
12361
12557
  const observed = guard.observeReadback(remoteReadbackInput(operation, local, options.workspaceIdentity, result.snapshot, operation !== "pr-creation"));
12362
12558
  if (observed.status === "rejected") {
12363
- return {
12559
+ return fatalSeed({
12364
12560
  site: "seed-remote-scope",
12365
12561
  kind: "remote-readback-rejected",
12366
12562
  operation,
12367
12563
  reasonCode: observed.reasonCode,
12368
12564
  timedOut: false
12369
- };
12565
+ });
12370
12566
  }
12371
- return;
12567
+ return { kind: "seeded" };
12372
12568
  }
12373
12569
  async function finishSkill(host, output) {
12374
12570
  const callDigest = digestCall(ledger, host.callID);
@@ -12570,99 +12766,89 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12570
12766
  abandonedCompletes.set(callDigest, pending.target);
12571
12767
  }
12572
12768
  async function completionReadbacks() {
12573
- if (!options.observer)
12769
+ const observer = options.observer;
12770
+ if (!observer)
12574
12771
  return { status: "none" };
12575
- let parentResult;
12576
- try {
12577
- parentResult = await options.observer.snapshot();
12578
- } catch {
12579
- return { status: "unavailable" };
12580
- }
12581
- if (parentResult.status === "unavailable" || parentResult.snapshot.targetDigest !== options.workspaceIdentity) {
12582
- return { status: "unavailable" };
12583
- }
12584
- const effective = effectiveOperationObserver();
12585
- if (!effective)
12586
- return { status: "unavailable" };
12587
- let effectiveSnapshot = parentResult.snapshot;
12772
+ const parent = await readSnapshot(observer, options.workspaceIdentity);
12773
+ if (parent.status !== "ok")
12774
+ return parent;
12775
+ const lookup = resolveEffectiveObserver();
12776
+ if (lookup.status !== "ok")
12777
+ return lookup;
12778
+ const effective = lookup.value;
12779
+ let initialEffective = parent.value;
12588
12780
  if (effective.pinned) {
12589
- let pinnedResult;
12590
- try {
12591
- pinnedResult = await effective.observer.snapshot();
12592
- } catch {
12593
- return { status: "unavailable" };
12594
- }
12595
- if (pinnedResult.status === "unavailable" || pinnedResult.snapshot.targetDigest !== effective.targetIdentity) {
12596
- return { status: "unavailable" };
12597
- }
12598
- effectiveSnapshot = pinnedResult.snapshot;
12599
- }
12600
- const initialEffectiveSnapshot = effectiveSnapshot;
12601
- const remoteReadbacks = await completionRemoteReadbacks(effective.observer);
12602
- if (!remoteReadbacks)
12603
- return { status: "unavailable" };
12604
- let finalParentResult;
12605
- try {
12606
- finalParentResult = await options.observer.snapshot();
12607
- } catch {
12608
- return { status: "unavailable" };
12609
- }
12610
- if (finalParentResult.status === "unavailable" || finalParentResult.snapshot.targetDigest !== parentResult.snapshot.targetDigest || finalParentResult.snapshot.repositoryRevisionDigest !== parentResult.snapshot.repositoryRevisionDigest || finalParentResult.snapshot.worktreeRevisionDigest !== parentResult.snapshot.worktreeRevisionDigest) {
12611
- return { status: "unavailable" };
12612
- }
12613
- let finalEffective = effective;
12614
- if (effective.pinned) {
12615
- const revalidated = effectiveOperationObserver();
12616
- if (!revalidated)
12617
- return { status: "unavailable" };
12618
- finalEffective = revalidated;
12619
- if (finalEffective.observer !== effective.observer || finalEffective.targetIdentity !== effective.targetIdentity || !finalEffective.pinned) {
12620
- return { status: "unavailable" };
12621
- }
12622
- let pinnedResult;
12623
- try {
12624
- pinnedResult = await finalEffective.observer.snapshot();
12625
- } catch {
12626
- return { status: "unavailable" };
12627
- }
12628
- if (pinnedResult.status === "unavailable" || pinnedResult.snapshot.targetDigest !== finalEffective.targetIdentity) {
12629
- return { status: "unavailable" };
12630
- }
12631
- effectiveSnapshot = pinnedResult.snapshot;
12632
- if (effectiveSnapshot.repositoryRevisionDigest !== initialEffectiveSnapshot.repositoryRevisionDigest || effectiveSnapshot.worktreeRevisionDigest !== initialEffectiveSnapshot.worktreeRevisionDigest) {
12633
- return { status: "unavailable" };
12634
- }
12635
- } else {
12636
- effectiveSnapshot = finalParentResult.snapshot;
12637
- }
12781
+ const pinned = await readSnapshot(effective.observer, effective.targetIdentity);
12782
+ if (pinned.status !== "ok")
12783
+ return pinned;
12784
+ initialEffective = pinned.value;
12785
+ }
12786
+ const remote = await completionRemoteReadbacks(effective.observer);
12787
+ if (remote.status !== "ready")
12788
+ return remote;
12789
+ const finalParent = await readSnapshot(observer);
12790
+ if (finalParent.status !== "ok")
12791
+ return finalParent;
12792
+ if (completionParentDrifted(parent.value, finalParent.value)) {
12793
+ return { status: "fatal" };
12794
+ }
12795
+ const final = effective.pinned ? await revalidatePinnedCompletion(effective, initialEffective) : { status: "ready", effective, snapshot: finalParent.value };
12796
+ if (final.status !== "ready")
12797
+ return final;
12638
12798
  return {
12639
12799
  status: "ready",
12640
12800
  readbacks: [
12641
12801
  {
12642
12802
  workspaceIdentity: options.workspaceIdentity,
12643
- repositoryIdentity: effectiveSnapshot.repositoryRevisionDigest,
12644
- worktreeIdentity: effectiveSnapshot.worktreeRevisionDigest,
12645
- operationTargetIdentity: finalEffective.targetIdentity
12803
+ repositoryIdentity: final.snapshot.repositoryRevisionDigest,
12804
+ worktreeIdentity: final.snapshot.worktreeRevisionDigest,
12805
+ operationTargetIdentity: final.effective.targetIdentity
12646
12806
  },
12647
- ...remoteReadbacks.map(({ operation, snapshot }) => remoteReadbackInput(operation, effectiveSnapshot, options.workspaceIdentity, snapshot))
12807
+ ...remote.readbacks.map(({ operation, snapshot }) => remoteReadbackInput(operation, final.snapshot, options.workspaceIdentity, snapshot))
12648
12808
  ]
12649
12809
  };
12650
12810
  }
12811
+ function completionParentDrifted(initial, final) {
12812
+ return final.targetDigest !== initial.targetDigest || final.repositoryRevisionDigest !== initial.repositoryRevisionDigest || final.worktreeRevisionDigest !== initial.worktreeRevisionDigest;
12813
+ }
12814
+ async function revalidatePinnedCompletion(effective, initial) {
12815
+ const lookup = resolveEffectiveObserver();
12816
+ if (lookup.status !== "ok")
12817
+ return lookup;
12818
+ const revalidated = lookup.value;
12819
+ if (revalidated.observer !== effective.observer || revalidated.targetIdentity !== effective.targetIdentity || !revalidated.pinned) {
12820
+ return { status: "fatal" };
12821
+ }
12822
+ const pinned = await readSnapshot(revalidated.observer, revalidated.targetIdentity);
12823
+ if (pinned.status !== "ok")
12824
+ return pinned;
12825
+ if (pinned.value.repositoryRevisionDigest !== initial.repositoryRevisionDigest || pinned.value.worktreeRevisionDigest !== initial.worktreeRevisionDigest) {
12826
+ return { status: "fatal" };
12827
+ }
12828
+ return {
12829
+ status: "ready",
12830
+ effective: revalidated,
12831
+ snapshot: pinned.value
12832
+ };
12833
+ }
12651
12834
  async function completionRemoteReadbacks(observer) {
12652
12835
  const remoteOperations = guard.status().satisfiedOperations.filter(remoteOperation);
12653
12836
  if (remoteOperations.length === 0)
12654
- return [];
12837
+ return { status: "ready", readbacks: [] };
12655
12838
  const remoteSnapshot = observer.remoteSnapshot;
12656
12839
  if (!remoteSnapshot)
12657
- return;
12840
+ return { status: "fatal" };
12658
12841
  const readbacks = [];
12659
12842
  for (const operation of remoteOperations) {
12660
12843
  const result = await readRemoteScope(remoteSnapshot, operation);
12661
- if (result?.status !== "available")
12662
- return;
12844
+ if (isProbeTimeout(result))
12845
+ return { status: "timeout" };
12846
+ if (result?.status !== "available") {
12847
+ return { status: "fatal", reasonCode: remoteFailureReason(result) };
12848
+ }
12663
12849
  readbacks.push({ operation, snapshot: result.snapshot });
12664
12850
  }
12665
- return readbacks;
12851
+ return { status: "ready", readbacks };
12666
12852
  }
12667
12853
  function finishMismatchedTarget(callDigest, pending, output) {
12668
12854
  abandonComplete(callDigest, pending, true);
@@ -12678,11 +12864,34 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12678
12864
  markUnavailable();
12679
12865
  writeAbandonedCompletionResult(output, finalTarget, "guard-unavailable");
12680
12866
  }
12681
- function finishUnavailableReadback(callDigest, pending, output) {
12867
+ function finishUnavailableReadback(callDigest, pending, output, reasonCode) {
12682
12868
  abandonComplete(callDigest, pending, true);
12683
- markUnavailable();
12869
+ terminalCompletes.set(callDigest, {
12870
+ target: pending.target,
12871
+ status: "unavailable",
12872
+ reasonCode: "finalization-failed"
12873
+ });
12874
+ markUnavailable(observerReadbackFailedCause(reasonCode, "complete-readback"));
12684
12875
  writeAbandonedCompletionResult(output, pending.target, "finalization-failed");
12685
12876
  }
12877
+ function finishReadbackTimeout(callDigest, pending, output) {
12878
+ if (guard.status().state === "unavailable") {
12879
+ finishUnavailableReadback(callDigest, pending, output, "command-timeout");
12880
+ } else {
12881
+ finishRetryableReadback(callDigest, pending, output);
12882
+ }
12883
+ }
12884
+ function finishRetryableReadback(callDigest, pending, output) {
12885
+ abandonComplete(callDigest, pending, true);
12886
+ const terminal = {
12887
+ target: pending.target,
12888
+ status: "rejected",
12889
+ reasonCode: "readback-timeout",
12890
+ title: "Workflow readback timed out"
12891
+ };
12892
+ terminalCompletes.set(callDigest, terminal);
12893
+ writeTerminalCompletionResult(output, terminal, pending.target, terminal.title);
12894
+ }
12686
12895
  async function finishComplete(host, output) {
12687
12896
  const callDigest = digestCall(ledger, host.callID);
12688
12897
  const pending = pendingCompletes.get(callDigest);
@@ -12697,13 +12906,13 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12697
12906
  finishUnreplayableComplete(finalTarget, output);
12698
12907
  return;
12699
12908
  }
12700
- if (!options.observer) {
12701
- finalizeComplete(callDigest, pending, output);
12909
+ const readbacks = await completionReadbacks();
12910
+ if (readbacks.status === "fatal") {
12911
+ finishUnavailableReadback(callDigest, pending, output, readbacks.reasonCode);
12702
12912
  return;
12703
12913
  }
12704
- const readbacks = await completionReadbacks();
12705
- if (readbacks.status === "unavailable") {
12706
- finishUnavailableReadback(callDigest, pending, output);
12914
+ if (readbacks.status === "timeout") {
12915
+ finishReadbackTimeout(callDigest, pending, output);
12707
12916
  return;
12708
12917
  }
12709
12918
  finalizeComplete(callDigest, pending, output, readbacks.status === "ready" ? readbacks.readbacks : undefined);
@@ -12788,8 +12997,8 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12788
12997
  tool: host.tool,
12789
12998
  ...command ? { command } : {},
12790
12999
  context: {
12791
- epochId: current.epoch.epochId,
12792
- unitId: current.unit.unitId,
13000
+ epochId: pending.initiator?.epochId ?? current.epoch.epochId,
13001
+ unitId: pending.initiator?.unitId ?? current.unit.unitId,
12793
13002
  workspaceIdentity: options.workspaceIdentity,
12794
13003
  repositoryIdentity: pending.before.repositoryRevisionDigest,
12795
13004
  worktreeIdentity: pending.before.worktreeRevisionDigest,
@@ -12797,7 +13006,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12797
13006
  ...pending.remoteBefore?.status === "available" ? {
12798
13007
  resourceIdentity: pending.remoteBefore.snapshot.resourceIdentity,
12799
13008
  resourceRevisionIdentity: pending.remoteBefore.snapshot.resourceRevisionIdentity
12800
- } : operation === "pr-creation" && remoteAfter ? { resourceIdentity: remoteAfter.resourceIdentity } : {}
13009
+ } : operation === "pr-creation" && remoteAfter && pending.remoteBefore?.status === "missing-resource" ? { resourceIdentity: remoteAfter.resourceIdentity } : {}
12801
13010
  },
12802
13011
  after: {
12803
13012
  workspaceIdentity: options.workspaceIdentity,
@@ -12850,13 +13059,24 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12850
13059
  return;
12851
13060
  }
12852
13061
  }
13062
+ function ownsOperation(pending) {
13063
+ return !pending.initiator || isCurrentInitiator(pending.initiator);
13064
+ }
13065
+ function sealLostOperation(callDigest, pending) {
13066
+ sealOperation(callDigest, pending, true);
13067
+ return { status: "ignored" };
13068
+ }
12853
13069
  async function completeOperationObservation(callDigest, host, pending, output) {
13070
+ if (!ownsOperation(pending))
13071
+ return sealLostOperation(callDigest, pending);
12854
13072
  const parsedOutput = parseHostOutput(output);
12855
13073
  if (!parsedOutput) {
12856
13074
  sealOperation(callDigest, pending, true);
12857
13075
  return { status: "unavailable" };
12858
13076
  }
12859
13077
  const afterSnapshot = await captureAfterOperation(pending);
13078
+ if (!ownsOperation(pending))
13079
+ return sealLostOperation(callDigest, pending);
12860
13080
  if (!afterSnapshot) {
12861
13081
  sealOperation(callDigest, pending, true);
12862
13082
  return { status: "unavailable" };
@@ -12867,6 +13087,8 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12867
13087
  return { status: "ignored" };
12868
13088
  }
12869
13089
  const classification = await classifyLocalObservation(observation);
13090
+ if (!ownsOperation(pending))
13091
+ return sealLostOperation(callDigest, pending);
12870
13092
  if (classification.status !== "ready") {
12871
13093
  sealOperation(callDigest, pending, true);
12872
13094
  return { status: classification.status };
@@ -12874,6 +13096,9 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12874
13096
  let finalObservation = classification.observation;
12875
13097
  if (remoteOperation(finalObservation.operation)) {
12876
13098
  const remoteAfter = await captureRemoteAfter(finalObservation.operation, pending.observer);
13099
+ if (!ownsOperation(pending)) {
13100
+ return sealLostOperation(callDigest, pending);
13101
+ }
12877
13102
  if (!remoteAfter) {
12878
13103
  sealOperation(callDigest, pending, true);
12879
13104
  return { status: "unavailable" };
@@ -12884,7 +13109,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12884
13109
  return { status: "ignored" };
12885
13110
  }
12886
13111
  finalObservation = rebuilt;
12887
- if (finalObservation.operation === "pr-creation" && pending.remoteBefore?.status !== "available") {
13112
+ if (finalObservation.operation === "pr-creation" && pending.remoteBefore?.status === "missing-resource") {
12888
13113
  const seeded = guard.observeReadback({
12889
13114
  operation: "pr-creation",
12890
13115
  workspaceIdentity: options.workspaceIdentity,
@@ -12899,6 +13124,8 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12899
13124
  }
12900
13125
  }
12901
13126
  }
13127
+ if (!ownsOperation(pending))
13128
+ return sealLostOperation(callDigest, pending);
12902
13129
  const observed = await observeClassifiedOperation(finalObservation);
12903
13130
  if (!observed) {
12904
13131
  sealOperation(callDigest, pending, true);
@@ -13045,6 +13272,7 @@ ${marker}` : marker;
13045
13272
  },
13046
13273
  readStatus,
13047
13274
  unavailableCause: () => firstUnavailableCause,
13275
+ seedDeferrals: currentSeedDeferrals,
13048
13276
  refreshReadback,
13049
13277
  observeReceipt: (input) => {
13050
13278
  ensureSynchronousRuntime();
@@ -13161,10 +13389,10 @@ function createOpencodeWorkflowGuard(options) {
13161
13389
  output: unavailableToolResult()
13162
13390
  }),
13163
13391
  systematic_workflow_status: makeWorkflowTool("Read the bounded guarded workflow status.", statusToolShape, sessionRuntimeFor, async (runtime, input) => {
13164
- await runtime.refreshReadback();
13392
+ const unconfirmed = await runtime.refreshReadback();
13165
13393
  return {
13166
13394
  title: "Workflow guard status",
13167
- output: statusToolSchema.safeParse(input).success ? statusForTool(runtime.readStatus(), runtime.unavailableCause()) : unavailableToolResult()
13395
+ output: statusToolSchema.safeParse(input).success ? statusForTool(runtime.readStatus(), runtime.unavailableCause(), runtime.seedDeferrals(), unconfirmed) : unavailableToolResult()
13168
13396
  };
13169
13397
  }),
13170
13398
  systematic_workflow_complete: makeWorkflowTool("Request completion of a guarded workflow unit or epoch.", completeToolShape, sessionRuntimeFor, (_runtime, input) => completeToolSchema.safeParse(input).success ? {
@@ -30,6 +30,12 @@ export interface OpencodeWorkflowGuardOptions {
30
30
  readonly sessionLocation?: string;
31
31
  /** Injectable clock (epoch milliseconds); defaults to `Date.now`. */
32
32
  readonly now?: () => number;
33
+ /**
34
+ * Injectable factory for the observer of a registered linked-worktree target;
35
+ * defaults to `createOpencodeOperationObserver`. A test seam: it lets tests
36
+ * control a pinned worktree observer's snapshots.
37
+ */
38
+ readonly createTargetObserver?: (targetDirectory: string) => OpencodeOperationObserver;
33
39
  }
34
40
  export interface OpencodeWorkflowChildSession {
35
41
  readonly sessionId: string;
@@ -6,7 +6,7 @@ export type WorkflowState = 'protected' | 'waiting' | 'rejected' | 'disabled' |
6
6
  export type RepairKind = 'fresh-readback' | 'rerun-operation' | 'question-attestation';
7
7
  export type TransitionTarget = 'unit' | 'epoch';
8
8
  export type EpochFamily = 'work' | 'shipping';
9
- export type WorkflowReasonCode = 'abandoned-transition' | 'call-context-conflict' | 'cancelled-operation' | 'consumed-receipt' | 'disabled' | 'epoch-completed' | 'epoch-mismatch' | 'failed-operation' | 'family-conflict' | 'finalization-failed' | 'foreign-registration' | 'forbidden-field' | 'guard-unavailable' | 'incompatible-receipt' | 'invalid-configuration' | 'invalid-control' | 'invalid-receipt' | 'invalid-transition' | 'missing-evidence' | 'no-supported-repair' | 'no-active-epoch' | 'no-active-unit' | 'no-op-operation' | 'operation-not-required' | 'operation-target-mismatch' | 'receipt-mismatch' | 'rejected-operation' | 'resource-mismatch' | 'running-operation' | 'stale-receipt' | 'transition-finalized' | 'transition-terminal' | 'transition-replayed' | 'unattributed-operation' | 'unit-active' | 'unit-completed' | 'unit-incomplete' | 'unit-mismatch' | 'unit-ready' | 'workspace-mismatch' | 'runtime-scope-conflict' | 'invalid-recovery' | 'recovery-conflict' | 'fork-copy-not-lineage';
9
+ export type WorkflowReasonCode = 'abandoned-transition' | 'call-context-conflict' | 'cancelled-operation' | 'consumed-receipt' | 'disabled' | 'epoch-completed' | 'epoch-mismatch' | 'failed-operation' | 'family-conflict' | 'finalization-failed' | 'foreign-registration' | 'forbidden-field' | 'guard-unavailable' | 'incompatible-receipt' | 'invalid-configuration' | 'invalid-control' | 'invalid-receipt' | 'invalid-transition' | 'missing-evidence' | 'no-supported-repair' | 'no-active-epoch' | 'no-active-unit' | 'no-op-operation' | 'operation-not-required' | 'operation-target-mismatch' | 'readback-timeout' | 'receipt-mismatch' | 'rejected-operation' | 'resource-mismatch' | 'running-operation' | 'stale-receipt' | 'transition-finalized' | 'transition-terminal' | 'transition-replayed' | 'unattributed-operation' | 'unit-active' | 'unit-completed' | 'unit-incomplete' | 'unit-mismatch' | 'unit-ready' | 'workspace-mismatch' | 'runtime-scope-conflict' | 'invalid-recovery' | 'recovery-conflict' | 'fork-copy-not-lineage';
10
10
  export interface WorkflowGuardOptions {
11
11
  ledger: ReceiptLedger;
12
12
  classifier?: ReceiptClassifier;
@@ -141,6 +141,12 @@ export interface WorkflowGuard {
141
141
  observeTrustedRecoveredOperation(input: unknown): Promise<EvidenceObservationResult>;
142
142
  observeReadback(input: unknown): ReadbackObservationResult;
143
143
  currentOperationContext(): CurrentOperationContext;
144
+ /**
145
+ * Read-only: whether the active unit already has a resource baseline for
146
+ * `operation` (declared on the unit, seeded, or propagated from PR
147
+ * creation). False when there is no active unit.
148
+ */
149
+ hasResourceBaseline(operation: ReceiptOperation): boolean;
144
150
  status(): WorkflowStatus;
145
151
  prepareTransition(input: unknown): TransitionPrepareResult;
146
152
  finalizeTransition(input: unknown): TransitionFinalizeResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.21.6",
3
+ "version": "3.21.8",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -18,19 +18,6 @@ var __export = (target, all) => {
18
18
  })
19
19
  }
20
20
 
21
- // node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
22
- var exports_iso = {}
23
- __export(exports_iso, {
24
- ZodISODate: () => ZodISODate,
25
- ZodISODateTime: () => ZodISODateTime,
26
- ZodISODuration: () => ZodISODuration,
27
- ZodISOTime: () => ZodISOTime,
28
- date: () => date2,
29
- datetime: () => datetime2,
30
- duration: () => duration2,
31
- time: () => time2,
32
- })
33
-
34
21
  // src/ce-review-validator.ts
35
22
  import fs3 from 'node:fs'
36
23
  import { fileURLToPath } from 'node:url'
@@ -6299,6 +6286,17 @@ function superRefine(fn, params) {
6299
6286
  return _superRefine(fn, params)
6300
6287
  }
6301
6288
  // node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
6289
+ var exports_iso = {}
6290
+ __export(exports_iso, {
6291
+ ZodISODate: () => ZodISODate,
6292
+ ZodISODateTime: () => ZodISODateTime,
6293
+ ZodISODuration: () => ZodISODuration,
6294
+ ZodISOTime: () => ZodISOTime,
6295
+ date: () => date2,
6296
+ datetime: () => datetime2,
6297
+ duration: () => duration2,
6298
+ time: () => time2,
6299
+ })
6302
6300
  function datetime2(params) {
6303
6301
  return _isoDateTime(ZodISODateTime, params)
6304
6302
  }
@@ -114,4 +114,4 @@ The bootstrap inlines the active harness profile naming the exact mechanisms for
114
114
 
115
115
  When a mechanism is unavailable, present numbered options in chat and wait for questions, maintain a visible list for task tracking, and dispatch delegation sequentially or do the work inline.
116
116
 
117
- Check the workflow guard availability once per execution unit. Guard state is per session; a child session starts `inactive`. `inactive` (reason `no-active-epoch`) means no guarded workflow has started in this session. It is not unavailable and not terminal: load a guarded skill to begin, and do not call `systematic_workflow_start` or `systematic_workflow_complete` before one is active. If the guard reports `unavailable` or `guard-unavailable`, treat it as terminal for that unit: do not retry `systematic_workflow_start` or `systematic_workflow_complete`. Use the documented unguarded fallback only when authorized, and report the unavailable state once.
117
+ Check the workflow guard availability once per execution unit. Guard state is per session; a child session starts `inactive`. `inactive` (reason `no-active-epoch`) means no guarded workflow has started in this session. It is not unavailable and not terminal: load a guarded skill to begin, and do not call `systematic_workflow_start` or `systematic_workflow_complete` before one is active. A completion rejected with `readback-timeout` is retryable: call `systematic_workflow_complete` again at most twice, then report it to the user. Probes listed in `unconfirmedReadbacks` on status output (`local`, `pinned`, or an operation name) are unverified until a later status call confirms them. If the guard reports `unavailable` or `guard-unavailable`, treat it as terminal for that unit: do not retry `systematic_workflow_start` or `systematic_workflow_complete`. Use the documented unguarded fallback only when authorized, and report the unavailable state once.