@fro.bot/systematic 3.18.9 → 3.18.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.
Files changed (2) hide show
  1. package/dist/index.js +86 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10847,13 +10847,14 @@ function remoteReadbackInput(operation, local, workspaceIdentity, snapshot, incl
10847
10847
  function isSuccessfulAfter(output) {
10848
10848
  return parseHostOutput(output) !== undefined;
10849
10849
  }
10850
- function statusForTool(status) {
10850
+ function statusForTool(status, unavailableCause) {
10851
10851
  return JSON.stringify({
10852
10852
  state: status.state,
10853
10853
  reasonCode: status.reasonCode,
10854
10854
  ...status.repair ? { repair: status.repair } : {},
10855
10855
  satisfiedOperations: status.satisfiedOperations,
10856
- missingOperations: status.missingOperations
10856
+ missingOperations: status.missingOperations,
10857
+ ...unavailableCause && status.state === "unavailable" ? { firstUnavailableCause: unavailableCause } : {}
10857
10858
  });
10858
10859
  }
10859
10860
  function markerStatusRank(state) {
@@ -11036,6 +11037,13 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11036
11037
  const pendingQuestionChallenges = new Map;
11037
11038
  const blockedQuestionCalls = new Map;
11038
11039
  const consumedQuestionTargets = new Set;
11040
+ let firstUnavailableCause;
11041
+ function startFreshUnit(input, policy) {
11042
+ const result = guard.startUnit(input, policy);
11043
+ if (result.status === "started")
11044
+ firstUnavailableCause = undefined;
11045
+ return result;
11046
+ }
11039
11047
  function effectiveTargetContext() {
11040
11048
  const parentTargetRoot = options.targetDirectory ?? process.cwd();
11041
11049
  return {
@@ -11627,10 +11635,13 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11627
11635
  rolledUpChildren.add(rollupKey);
11628
11636
  }
11629
11637
  let runtimePolicy = trustedSkillPolicy("unknown", options.runtimeRequiredOperations ?? []);
11630
- function markUnavailable() {
11638
+ function markUnavailable(cause) {
11631
11639
  if (options.config.mode === "disabled")
11632
11640
  return;
11633
- guard.setMode({ mode: "unavailable" });
11641
+ const result = guard.setMode({ mode: "unavailable" });
11642
+ if (cause && result.status === "changed" && !firstUnavailableCause) {
11643
+ firstUnavailableCause = cause;
11644
+ }
11634
11645
  }
11635
11646
  function bindCall(callDigest, kind, fingerprint) {
11636
11647
  const existing = callBindings.get(callDigest);
@@ -12169,36 +12180,79 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12169
12180
  async function seedRemoteScopes(operations) {
12170
12181
  const remoteOperations = operations.filter(remoteOperation);
12171
12182
  if (remoteOperations.length === 0)
12172
- return true;
12183
+ return;
12173
12184
  const remoteSnapshot = options.observer?.remoteSnapshot;
12174
- if (!remoteSnapshot || !options.observer)
12175
- return false;
12185
+ if (!remoteSnapshot || !options.observer) {
12186
+ return {
12187
+ site: "seed-remote-scopes",
12188
+ kind: "observer-not-configured",
12189
+ timedOut: false
12190
+ };
12191
+ }
12176
12192
  let local;
12177
12193
  try {
12178
12194
  local = await options.observer.snapshot();
12179
12195
  } catch {
12180
- return false;
12196
+ return {
12197
+ site: "seed-remote-scopes",
12198
+ kind: "local-snapshot-error",
12199
+ timedOut: false
12200
+ };
12201
+ }
12202
+ if (local.status === "unavailable") {
12203
+ return {
12204
+ site: "seed-remote-scopes",
12205
+ kind: "local-snapshot-unavailable",
12206
+ reasonCode: local.reasonCode,
12207
+ timedOut: local.reasonCode === "command-timeout"
12208
+ };
12181
12209
  }
12182
- if (local.status === "unavailable")
12183
- return false;
12184
12210
  for (const operation of remoteOperations) {
12185
- if (!await seedRemoteScope(remoteSnapshot, operation, local.snapshot)) {
12186
- return false;
12187
- }
12211
+ const cause = await seedRemoteScope(remoteSnapshot, operation, local.snapshot);
12212
+ if (cause)
12213
+ return cause;
12188
12214
  }
12189
- return true;
12215
+ return;
12190
12216
  }
12191
12217
  async function seedRemoteScope(reader, operation, local) {
12192
12218
  const result = await readRemoteScope(reader, operation, "before");
12193
- if (!result)
12194
- return false;
12219
+ if (!result) {
12220
+ return {
12221
+ site: "seed-remote-scope",
12222
+ kind: "remote-scope-unreadable",
12223
+ operation,
12224
+ timedOut: false
12225
+ };
12226
+ }
12195
12227
  if (result.status === "missing-resource") {
12196
- return operation === "pr-creation" || operation === "check-readback" || operation === "review-readback";
12228
+ const allowed = operation === "pr-creation" || operation === "check-readback" || operation === "review-readback";
12229
+ return allowed ? undefined : {
12230
+ site: "seed-remote-scope",
12231
+ kind: "remote-scope-missing-resource",
12232
+ operation,
12233
+ timedOut: false
12234
+ };
12235
+ }
12236
+ if (result.status !== "available") {
12237
+ return {
12238
+ site: "seed-remote-scope",
12239
+ kind: "remote-scope-unavailable",
12240
+ operation,
12241
+ reasonCode: result.reasonCode,
12242
+ timedOut: result.reasonCode === "command-timeout"
12243
+ };
12197
12244
  }
12198
- if (result.status !== "available")
12199
- return false;
12200
12245
  const observed = guard.observeReadback(remoteReadbackInput(operation, local, options.workspaceIdentity, result.snapshot, operation !== "pr-creation"));
12201
- return observed.status !== "rejected";
12246
+ if (observed.status === "rejected") {
12247
+ return {
12248
+ site: "seed-remote-scope",
12249
+ kind: "remote-readback-rejected",
12250
+ operation,
12251
+ reasonCode: observed.reasonCode,
12252
+ timedOut: false
12253
+ };
12254
+ }
12255
+ return;
12202
12256
  }
12203
12257
  async function finishSkill(host, output) {
12204
12258
  const callDigest = digestCall(ledger, host.callID);
@@ -12254,10 +12308,10 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12254
12308
  runtimePolicy = trustedSkillPolicy(skill, options.runtimeRequiredOperations ?? []);
12255
12309
  const status = guard.status();
12256
12310
  if (!status.unit || status.unit.status === "completed") {
12257
- guard.startUnit({}, runtimePolicy);
12258
- if (!await seedRemoteScopes(runtimePolicy.requiredOperations ?? [])) {
12259
- markUnavailable();
12260
- }
12311
+ startFreshUnit({}, runtimePolicy);
12312
+ const cause = await seedRemoteScopes(runtimePolicy.requiredOperations ?? []);
12313
+ if (cause)
12314
+ markUnavailable(cause);
12261
12315
  }
12262
12316
  }
12263
12317
  }
@@ -12276,12 +12330,14 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12276
12330
  }
12277
12331
  if (!isSuccessfulAfter(output))
12278
12332
  return;
12279
- const result = guard.startUnit(pending.input, runtimePolicy);
12333
+ const result = startFreshUnit(pending.input, runtimePolicy);
12280
12334
  if (result.status === "rejected" && (result.reasonCode === "guard-unavailable" || result.reasonCode === "invalid-configuration")) {
12281
12335
  markUnavailable();
12282
12336
  }
12283
- if (result.status === "started" && !await seedRemoteScopes(runtimePolicy.requiredOperations ?? [])) {
12284
- markUnavailable();
12337
+ if (result.status === "started") {
12338
+ const cause = await seedRemoteScopes(runtimePolicy.requiredOperations ?? []);
12339
+ if (cause)
12340
+ markUnavailable(cause);
12285
12341
  }
12286
12342
  if (result.status === "started") {
12287
12343
  const startedStatus = guard.status();
@@ -12869,6 +12925,7 @@ ${marker}` : marker;
12869
12925
  return initialized ? guard.status() : unavailableWorkflowStatus();
12870
12926
  },
12871
12927
  readStatus,
12928
+ unavailableCause: () => firstUnavailableCause,
12872
12929
  refreshReadback,
12873
12930
  observeReceipt: (input) => {
12874
12931
  ensureSynchronousRuntime();
@@ -12880,7 +12937,7 @@ ${marker}` : marker;
12880
12937
  },
12881
12938
  startUnit: (input, policy) => {
12882
12939
  ensureSynchronousRuntime();
12883
- return initialized ? guard.startUnit(input, policy) : { status: "rejected", reasonCode: "guard-unavailable" };
12940
+ return initialized ? startFreshUnit(input, policy) : { status: "rejected", reasonCode: "guard-unavailable" };
12884
12941
  },
12885
12942
  control,
12886
12943
  markUnavailable,
@@ -12987,7 +13044,7 @@ function createOpencodeWorkflowGuard(options) {
12987
13044
  await runtime.refreshReadback();
12988
13045
  return {
12989
13046
  title: "Workflow guard status",
12990
- output: statusToolSchema.safeParse(input).success ? statusForTool(runtime.readStatus()) : unavailableToolResult()
13047
+ output: statusToolSchema.safeParse(input).success ? statusForTool(runtime.readStatus(), runtime.unavailableCause()) : unavailableToolResult()
12991
13048
  };
12992
13049
  }),
12993
13050
  systematic_workflow_complete: makeWorkflowTool("Request completion of a guarded workflow unit or epoch.", completeToolShape, sessionRuntimeFor, (_runtime, input) => completeToolSchema.safeParse(input).success ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.18.9",
3
+ "version": "3.18.10",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",