@fro.bot/systematic 3.18.9 → 3.19.0

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/cli.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  findCommandsInDir,
34
34
  findSkillsInDir,
35
35
  discoverSkills
36
- } from "./index-fpq5hwdt.js";
36
+ } from "./index-mf76ybyr.js";
37
37
  var __defProp = Object.defineProperty;
38
38
  var __returnValue = (v) => v;
39
39
  function __exportSetter(name, newValue) {
@@ -8451,6 +8451,9 @@ var NO_PROFILE_SELECTION = {
8451
8451
  bundleSource: null
8452
8452
  };
8453
8453
  function resolveProfileSelector(input) {
8454
+ const envProfile = process.env.SYSTEMATIC_PROFILE?.trim();
8455
+ if (envProfile)
8456
+ return { value: envProfile, source: "environment" };
8454
8457
  const candidates = [
8455
8458
  ["custom", input.customConfig?.profile],
8456
8459
  ["project", input.projectConfig?.profile],
@@ -8481,6 +8484,9 @@ function trustedDefaultProfileName(input) {
8481
8484
  const userDefault = input.userConfig?.profile;
8482
8485
  return typeof userDefault === "string" ? userDefault : undefined;
8483
8486
  }
8487
+ function selectorSourceLabel(source) {
8488
+ return source === "environment" ? "SYSTEMATIC_PROFILE" : `${source} config`;
8489
+ }
8484
8490
  function resolveActiveProfile(input) {
8485
8491
  const selection = resolveProfileSelector(input);
8486
8492
  if (selection === null)
@@ -8508,7 +8514,7 @@ function resolveActiveProfile(input) {
8508
8514
  const trustedDefault = trustedDefaultProfileName(input);
8509
8515
  const fallbackLookup = trustedDefault !== undefined && trustedDefault !== requested ? lookupProfileBundle(input, trustedDefault) : undefined;
8510
8516
  if (fallbackLookup !== undefined && trustedDefault !== undefined) {
8511
- input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}" (selected by ${selection.source} config) is not defined in \`profiles\`; falling back to your default profile "${sanitizeDiagnosticText(trustedDefault)}". See ${PROFILE_DOCS_URL} for how to define a profile.`);
8517
+ input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}" (selected by ${selectorSourceLabel(selection.source)}) is not defined in \`profiles\`; falling back to your default profile "${sanitizeDiagnosticText(trustedDefault)}". See ${PROFILE_DOCS_URL} for how to define a profile.`);
8512
8518
  return {
8513
8519
  activeProfile: trustedDefault,
8514
8520
  profileSelectorSource: selection.source,
@@ -8517,7 +8523,7 @@ function resolveActiveProfile(input) {
8517
8523
  bundleSource: fallbackLookup.definingSource
8518
8524
  };
8519
8525
  }
8520
- const sourceNote = selection.source === "user" ? "" : ` (selected by ${selection.source} config)`;
8526
+ const sourceNote = selection.source === "user" ? "" : ` (selected by ${selectorSourceLabel(selection.source)})`;
8521
8527
  const alsoMissingNote = trustedDefault !== undefined && trustedDefault !== requested ? ` Your default profile "${sanitizeDiagnosticText(trustedDefault)}" is also not defined in \`profiles\`.` : trustedDefault === undefined ? " No default profile is configured (`profile` in your user config)." : "";
8522
8528
  input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}"${sourceNote} is not defined in \`profiles\`; using base configuration (no profile).${alsoMissingNote} See ${PROFILE_DOCS_URL} for how to define a profile.`);
8523
8529
  return {
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  extractCommandFrontmatter,
20
20
  findSkillsInDir,
21
21
  discoverSkills
22
- } from "./index-fpq5hwdt.js";
22
+ } from "./index-mf76ybyr.js";
23
23
 
24
24
  // src/index.ts
25
25
  import { createHash as createHash4 } from "crypto";
@@ -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 ? {
@@ -44,12 +44,14 @@ export interface ConfigProtectedFieldMetadata {
44
44
  * The source kind that supplied the winning `profile` selector value, or
45
45
  * `null` when no source set `profile` at all (case 1 of the selection table
46
46
  * in plan 2026-09-04-002-feat-model-config-profiles, Unit 2). This names
47
- * whichever source's value won the `custom ?? project ?? user` selector
48
- * lookup -- including when that value turned out to name a missing bundle
49
- * and the loader fell back to the user's own default (see
50
- * {@link ConfigObservationMetadata.profileFallback}).
47
+ * whichever source's value won the `SYSTEMATIC_PROFILE ?? custom ?? project
48
+ * ?? user` selector lookup -- including when that value turned out to name
49
+ * a missing bundle and the loader fell back to the user's own default (see
50
+ * {@link ConfigObservationMetadata.profileFallback}). `'environment'` is
51
+ * distinct from `ConfigSourceKind` deliberately: it names an env var
52
+ * override, never a config file, and must never be mistaken for one.
51
53
  */
52
- export type ProfileSelectorSource = ConfigSourceKind | null;
54
+ export type ProfileSelectorSource = ConfigSourceKind | 'environment' | null;
53
55
  /**
54
56
  * Present when the winning `profile` selector named a bundle absent from
55
57
  * the user source's `profiles` map. `usedDefault` names the user's own
package/dist/pi.js CHANGED
@@ -10318,6 +10318,9 @@ var NO_PROFILE_SELECTION = {
10318
10318
  bundleSource: null
10319
10319
  };
10320
10320
  function resolveProfileSelector(input) {
10321
+ const envProfile = process.env.SYSTEMATIC_PROFILE?.trim();
10322
+ if (envProfile)
10323
+ return { value: envProfile, source: "environment" };
10321
10324
  const candidates = [
10322
10325
  ["custom", input.customConfig?.profile],
10323
10326
  ["project", input.projectConfig?.profile],
@@ -10348,6 +10351,9 @@ function trustedDefaultProfileName(input) {
10348
10351
  const userDefault = input.userConfig?.profile;
10349
10352
  return typeof userDefault === "string" ? userDefault : undefined;
10350
10353
  }
10354
+ function selectorSourceLabel(source) {
10355
+ return source === "environment" ? "SYSTEMATIC_PROFILE" : `${source} config`;
10356
+ }
10351
10357
  function resolveActiveProfile(input) {
10352
10358
  const selection = resolveProfileSelector(input);
10353
10359
  if (selection === null)
@@ -10375,7 +10381,7 @@ function resolveActiveProfile(input) {
10375
10381
  const trustedDefault = trustedDefaultProfileName(input);
10376
10382
  const fallbackLookup = trustedDefault !== undefined && trustedDefault !== requested ? lookupProfileBundle(input, trustedDefault) : undefined;
10377
10383
  if (fallbackLookup !== undefined && trustedDefault !== undefined) {
10378
- input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}" (selected by ${selection.source} config) is not defined in \`profiles\`; falling back to your default profile "${sanitizeDiagnosticText(trustedDefault)}". See ${PROFILE_DOCS_URL} for how to define a profile.`);
10384
+ input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}" (selected by ${selectorSourceLabel(selection.source)}) is not defined in \`profiles\`; falling back to your default profile "${sanitizeDiagnosticText(trustedDefault)}". See ${PROFILE_DOCS_URL} for how to define a profile.`);
10379
10385
  return {
10380
10386
  activeProfile: trustedDefault,
10381
10387
  profileSelectorSource: selection.source,
@@ -10384,7 +10390,7 @@ function resolveActiveProfile(input) {
10384
10390
  bundleSource: fallbackLookup.definingSource
10385
10391
  };
10386
10392
  }
10387
- const sourceNote = selection.source === "user" ? "" : ` (selected by ${selection.source} config)`;
10393
+ const sourceNote = selection.source === "user" ? "" : ` (selected by ${selectorSourceLabel(selection.source)})`;
10388
10394
  const alsoMissingNote = trustedDefault !== undefined && trustedDefault !== requested ? ` Your default profile "${sanitizeDiagnosticText(trustedDefault)}" is also not defined in \`profiles\`.` : trustedDefault === undefined ? " No default profile is configured (`profile` in your user config)." : "";
10389
10395
  input.warningSink(`[systematic] profile "${sanitizeDiagnosticText(requested)}"${sourceNote} is not defined in \`profiles\`; using base configuration (no profile).${alsoMissingNote} See ${PROFILE_DOCS_URL} for how to define a profile.`);
10390
10396
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.18.9",
3
+ "version": "3.19.0",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -97,7 +97,7 @@
97
97
  }
98
98
  },
99
99
  "devDependencies": {
100
- "@biomejs/biome": "2.5.13",
100
+ "@biomejs/biome": "2.5.14",
101
101
  "@earendil-works/pi-coding-agent": "0.83.0",
102
102
  "@opencode-ai/plugin": "1.18.31",
103
103
  "@opencode-ai/sdk": "1.18.31",
@@ -114,7 +114,7 @@
114
114
  "rimraf": "6.1.3",
115
115
  "semantic-release": "25.0.9",
116
116
  "semantic-release-export-data": "1.2.0",
117
- "typebox": "1.3.31",
117
+ "typebox": "1.3.32",
118
118
  "typescript": "7.0.2"
119
119
  },
120
120
  "dependencies": {