opencode-dev-framework 1.9.1 → 1.9.4

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.
@@ -1,6 +1,12 @@
1
1
  import type { HookState } from "./registry.js";
2
- import type { RuntimeStatus } from "./runtime-status.js";
2
+ import type { RuntimeStatus, TemplateState } from "./runtime-status.js";
3
3
  import type { ResolvedConfig } from "./types.js";
4
+ /**
5
+ * One-line template drift state for `/df-runtime`: up to date, drifted
6
+ * (run `/df-update`), or nothing installed (run `/df-init`). Absent
7
+ * state (older snapshot) renders as unknown, never as current.
8
+ */
9
+ export declare function renderTemplateState(templates: TemplateState | undefined): string;
4
10
  /**
5
11
  * Render the config-only portion of the status summary.
6
12
  *
@@ -21,8 +27,9 @@ export declare function renderHelp(): string;
21
27
  export declare function renderStatus(config: ResolvedConfig, state?: HookState | null): string;
22
28
  /**
23
29
  * Render the runtime snapshot for the TUI `/df-runtime` command: plugin
24
- * version, which session-hook method the core accepted, and dispatch
25
- * history. A null snapshot (server hasn't reported yet) renders as such —
26
- * never as a negative claim about the hook.
30
+ * version, which session-hook method the core accepted, dispatch
31
+ * history, and template drift state. A null snapshot (server hasn't
32
+ * reported yet) renders as such — never as a negative claim about the
33
+ * hook. A snapshot without template state (older server) says unknown.
27
34
  */
28
35
  export declare function renderRuntimeStatus(snapshot: RuntimeStatus | null): string;
@@ -1,3 +1,21 @@
1
+ /**
2
+ * One-line template drift state for `/df-runtime`: up to date, drifted
3
+ * (run `/df-update`), or nothing installed (run `/df-init`). Absent
4
+ * state (older snapshot) renders as unknown, never as current.
5
+ */
6
+ export function renderTemplateState(templates) {
7
+ if (templates === undefined) {
8
+ return "Templates: state unknown (no report yet)";
9
+ }
10
+ if (templates.state === "empty") {
11
+ return "Templates: not installed — run /df-init";
12
+ }
13
+ if (templates.state === "current") {
14
+ return `Templates: up to date (${templates.current}/${templates.total} match)`;
15
+ }
16
+ return (`Templates: drifted (${templates.refresh} to refresh, ${templates.add} to add) ` +
17
+ "— run /df-update");
18
+ }
1
19
  function formatCommandMap(map, indent) {
2
20
  if (map === undefined) {
3
21
  return `${indent}(not configured)`;
@@ -159,9 +177,10 @@ export function renderStatus(config, state) {
159
177
  }
160
178
  /**
161
179
  * Render the runtime snapshot for the TUI `/df-runtime` command: plugin
162
- * version, which session-hook method the core accepted, and dispatch
163
- * history. A null snapshot (server hasn't reported yet) renders as such —
164
- * never as a negative claim about the hook.
180
+ * version, which session-hook method the core accepted, dispatch
181
+ * history, and template drift state. A null snapshot (server hasn't
182
+ * reported yet) renders as such — never as a negative claim about the
183
+ * hook. A snapshot without template state (older server) says unknown.
165
184
  */
166
185
  export function renderRuntimeStatus(snapshot) {
167
186
  const lines = ["dev-framework runtime", ""];
@@ -171,6 +190,7 @@ export function renderRuntimeStatus(snapshot) {
171
190
  return lines.join("\n");
172
191
  }
173
192
  lines.push(`Framework: v${snapshot.frameworkVersion} (snapshot as of ${snapshot.updatedAt})`);
193
+ lines.push(renderTemplateState(snapshot.templates));
174
194
  lines.push(snapshot.idleHookVia === "none"
175
195
  ? "Idle hook: not registered — event-subscribe fallback only"
176
196
  : `Idle hook: registered via ${snapshot.idleHookVia}`);
package/dist/harness.d.ts CHANGED
@@ -26,6 +26,21 @@ import type { ResolvedConfig } from "./types.js";
26
26
  import { type EnforceableSnapshot } from "./weakening.js";
27
27
  /** Project-relative path of the peer-review artifact the agent must produce. */
28
28
  export declare const REVIEW_ARTIFACT_REL = ".opencode/opencode-dev-framework/review.md";
29
+ /**
30
+ * True when a tool-call target is the review artifact. Normalizes like the
31
+ * guardrail path matcher (absolute paths resolve against the project
32
+ * directory) plus `normalize`, so non-canonical spellings (`a/../b`,
33
+ * `././x`) compare by where they resolve, not how they are spelled.
34
+ * Matches the exact artifact only — never a prefix or a similarly-named
35
+ * file.
36
+ */
37
+ export declare function isReviewArtifact(filePath: string, directory?: string): boolean;
38
+ /**
39
+ * Shared denial text for the child-session artifact guard (plan 23): one
40
+ * spelling, referenced from both enforcement layers so a wording fix can
41
+ * never update one site and miss the other.
42
+ */
43
+ export declare function childArtifactDenial(): string;
29
44
  /** Project-relative path of the pre-flight artifact the agent must produce. */
30
45
  export declare const PREFLIGHT_ARTIFACT_REL = ".opencode/opencode-dev-framework/preflight.md";
31
46
  /**
package/dist/harness.js CHANGED
@@ -17,13 +17,38 @@
17
17
  * synthetic continuation) and the `session.idle` event net (re-prompt).
18
18
  */
19
19
  import { readFile, stat } from "node:fs/promises";
20
- import { join } from "node:path";
20
+ import { isAbsolute, join, normalize, relative } from "node:path";
21
21
  import { runGate, summarizeGate } from "./gate.js";
22
22
  import { assessReviewContent, findUncoveredFiles, normalizeReviewPath, staleReviewMessage, templateReviewMessage, thinReviewMessage, } from "./review.js";
23
23
  import { RUNTIME_STATUS_DIR, RUNTIME_STATUS_FILE } from "./runtime-status.js";
24
24
  import { diffWeakening } from "./weakening.js";
25
25
  /** Project-relative path of the peer-review artifact the agent must produce. */
26
26
  export const REVIEW_ARTIFACT_REL = ".opencode/opencode-dev-framework/review.md";
27
+ /**
28
+ * True when a tool-call target is the review artifact. Normalizes like the
29
+ * guardrail path matcher (absolute paths resolve against the project
30
+ * directory) plus `normalize`, so non-canonical spellings (`a/../b`,
31
+ * `././x`) compare by where they resolve, not how they are spelled.
32
+ * Matches the exact artifact only — never a prefix or a similarly-named
33
+ * file.
34
+ */
35
+ export function isReviewArtifact(filePath, directory) {
36
+ let candidate = filePath;
37
+ if (directory !== undefined && isAbsolute(filePath)) {
38
+ candidate = relative(directory, filePath);
39
+ }
40
+ return normalize(candidate) === normalize(REVIEW_ARTIFACT_REL);
41
+ }
42
+ /**
43
+ * Shared denial text for the child-session artifact guard (plan 23): one
44
+ * spelling, referenced from both enforcement layers so a wording fix can
45
+ * never update one site and miss the other.
46
+ */
47
+ export function childArtifactDenial() {
48
+ return (`child sessions never write ${REVIEW_ARTIFACT_REL}: the review duty belongs ` +
49
+ `to the top-level session — report back as text and let the orchestrator ` +
50
+ `write the artifact`);
51
+ }
27
52
  /** Project-relative path of the pre-flight artifact the agent must produce. */
28
53
  export const PREFLIGHT_ARTIFACT_REL = ".opencode/opencode-dev-framework/preflight.md";
29
54
  /**
package/dist/index.js CHANGED
@@ -25,22 +25,22 @@
25
25
  * docs/plans/12-idle-hook-cutover.md). The `event.subscribe` idle net
26
26
  * stays as a deduped fallback for the boundaries the hook skips.
27
27
  */
28
- import { Plugin } from "@opencode/plugin";
29
28
  import { stat } from "node:fs/promises";
30
29
  import { join } from "node:path";
30
+ import { Plugin } from "@opencode/plugin";
31
31
  import { createBlockStore, createStuckSnapshotStore, } from "./block-store.js";
32
32
  import { clearConfigCache, loadConfig } from "./config.js";
33
33
  import { createChangedFileTracker } from "./gate.js";
34
- import { artifactState, createPassCache, evaluateCompletion, PREFLIGHT_ARTIFACT_REL, preflightBlockReason, } from "./harness.js";
34
+ import { artifactState, childArtifactDenial, createPassCache, evaluateCompletion, isReviewArtifact, PREFLIGHT_ARTIFACT_REL, preflightBlockReason, } from "./harness.js";
35
35
  import { runCommand } from "./host.js";
36
36
  import { createLintLimiter, detectPreCommitAvailability, isLintFailure, lintFile, summarizeLint, } from "./lint.js";
37
37
  import { createLogger } from "./logger.js";
38
- import { checkToolCall, extractFilePath, FILE_TOOLS, toPermissionGuard } from "./protect.js";
39
- import { constitutionPresent, loadConstitution } from "./rules.js";
40
- import { clearSessionDirectory, hasSeenSessionStart, markSessionStartSeen } from "./registry.js";
38
+ import { checkToolCall, extractCommand, extractFilePath, extractRedirectTargets, FILE_TOOLS, SHELL_TOOLS, toPermissionGuard, } from "./protect.js";
39
+ import { clearSessionDirectory, hasSeenSessionStart, markSessionStartSeen, resolveIsChildSession, resolveSessionDepth, } from "./registry.js";
41
40
  import { findRosterIndex, renderDutyRoster, rosterPresent } from "./roster.js";
41
+ import { constitutionPresent, loadConstitution } from "./rules.js";
42
42
  import { writeRuntimeStatus } from "./runtime-status.js";
43
- import { checkTemplateUpdates, driftMentionLine } from "./update.js";
43
+ import { checkTemplateUpdates, driftMentionLine, summarizeDrift } from "./update.js";
44
44
  import { snapshotEnforceable } from "./weakening.js";
45
45
  let activeState = null;
46
46
  let fallbackLog = async () => { };
@@ -180,6 +180,21 @@ function runCompletion(state, sessionID) {
180
180
  log: (level, message, extra) => safeLog(state, level, message, extra),
181
181
  });
182
182
  }
183
+ /**
184
+ * Build the host session lookup for child detection, defensively: older
185
+ * cores (and stub contexts in tests) may not expose `session.get`, in
186
+ * which case every session reads as top-level and behavior is unchanged.
187
+ * The lookup is cached per sessionID inside `resolveIsChildSession`, so the
188
+ * steady state pays one call per session lifetime.
189
+ */
190
+ function childSessionGetter(ctx) {
191
+ const session = ctx.session;
192
+ if (typeof session.get !== "function")
193
+ return undefined;
194
+ // Called as a method so the receiver is preserved (a detached `get`
195
+ // could throw on `this`-dependent adapters and fail open to top-level).
196
+ return (id) => session.get({ sessionID: id });
197
+ }
183
198
  /**
184
199
  * Record a completed idle-hook evaluation for the dedup map. Stamp ONLY on
185
200
  * the completed-evaluation paths (pass, blocked-admitted, standdown);
@@ -188,6 +203,22 @@ function runCompletion(state, sessionID) {
188
203
  function stampIdleHandled(state, sessionID) {
189
204
  state.lastIdleHandled.set(sessionID, Date.now());
190
205
  }
206
+ /**
207
+ * Best-effort runtime snapshot for `/df-runtime`: hook state plus template
208
+ * drift, fire-and-forget (never throws, never blocks the caller).
209
+ */
210
+ function stampRuntimeStatus(directory, idleHookVia, continuation) {
211
+ void (async () => {
212
+ let templates;
213
+ try {
214
+ templates = summarizeDrift(await checkTemplateUpdates(directory));
215
+ }
216
+ catch {
217
+ // Best-effort: the snapshot renders without template state.
218
+ }
219
+ await writeRuntimeStatus(directory, { idleHookVia, continuation, templates });
220
+ })();
221
+ }
191
222
  /**
192
223
  * True when the idle hook completed an evaluation for this session inside
193
224
  * `windowMs`. The hook itself uses a short window (same-boundary
@@ -306,6 +337,10 @@ const plugin = Plugin.define({
306
337
  lastIdleHandled: new Map(),
307
338
  };
308
339
  activeState = state;
340
+ // Child-session detection for the review-duty guard (plan 23 phase 1):
341
+ // one cached host lookup per session lifetime; undefined on older
342
+ // cores, where every session reads as top-level (behavior unchanged).
343
+ const sessionGetter = childSessionGetter(ctx);
309
344
  // Surface a broken storage backend early (best-effort, never thrown).
310
345
  // With the stop-level hydration gone there is no setup-time storage
311
346
  // read left, so this rarely fires here — the store still degrades
@@ -436,6 +471,22 @@ const plugin = Plugin.define({
436
471
  getEventSessionID(event);
437
472
  if (!sessionID)
438
473
  return;
474
+ // Child sessions owe no review duty (plan 23 phase 1): the review
475
+ // artifact belongs to the top-level session, so a child idling on
476
+ // a dirty tree must never be blocked or told to write it. Skip
477
+ // before any gate work; both levers share this predicate.
478
+ if (await resolveIsChildSession(sessionID, sessionGetter)) {
479
+ // Tripwire (plan 24): log the chain depth on every child-gated
480
+ // decision. Depth 1 is the entire world at core's default
481
+ // `experimental.subagent_depth`; anything deeper means nesting
482
+ // arrived via a raised limit or a non-tool creation path.
483
+ const depth = await resolveSessionDepth(sessionID, sessionGetter);
484
+ await safeLog(state, "debug", "completion gate skipped: child session owes no review duty", {
485
+ sessionID,
486
+ depth,
487
+ });
488
+ return;
489
+ }
439
490
  await reloadConfigIfChanged(state);
440
491
  if (state.config.profile === "off")
441
492
  return;
@@ -455,7 +506,7 @@ const plugin = Plugin.define({
455
506
  // Pass/stand-down: completed evaluation, nothing to admit.
456
507
  stampIdleHandled(state, sessionID);
457
508
  state.continuationLevel = "idle";
458
- void writeRuntimeStatus(state.directory, { idleHookVia, continuation: "idle" });
509
+ stampRuntimeStatus(state.directory, idleHookVia, "idle");
459
510
  return;
460
511
  }
461
512
  // Blocked: admit a synthetic continuation (same execution).
@@ -470,7 +521,7 @@ const plugin = Plugin.define({
470
521
  await ctx.session.synthetic({ sessionID, text: message });
471
522
  stampIdleHandled(state, sessionID);
472
523
  state.continuationLevel = "idle";
473
- void writeRuntimeStatus(state.directory, { idleHookVia, continuation: "idle" });
524
+ stampRuntimeStatus(state.directory, idleHookVia, "idle");
474
525
  await safeLog(state, "info", `completion gate continued session ${sessionID} via idle hook`, {
475
526
  sessionID,
476
527
  blockCount: verdict.blockCount,
@@ -503,7 +554,7 @@ const plugin = Plugin.define({
503
554
  }
504
555
  // Record the registration outcome for `/df-runtime` even before the
505
556
  // first dispatch: "armed" is a real state, not a missing one.
506
- void writeRuntimeStatus(state.directory, { idleHookVia, continuation: "armed" });
557
+ stampRuntimeStatus(state.directory, idleHookVia, "armed");
507
558
  await safeLog(state, "info", "registered experimental.idle hook (+ idle alias); gate failures continue the same execution via synthetic");
508
559
  // 2a) Native permission layer (Phase 25): `permission.evaluate` fires
509
560
  // with `{action, resources, effect}` (shapes recorded in the 25.1 spike,
@@ -565,6 +616,36 @@ const plugin = Plugin.define({
565
616
  return;
566
617
  }
567
618
  }
619
+ // Child sessions never write the parent's review artifact (plan 23
620
+ // phase 1, defense-in-depth behind execute.before). Checked before
621
+ // guardrails so the specific duty message wins and a future
622
+ // pipeline reorder cannot strand this check behind a guardrail
623
+ // early-return. Consulted only for artifact targets.
624
+ {
625
+ let resourceHitsArtifact = false;
626
+ if (action === "edit") {
627
+ resourceHitsArtifact = event.resources.some((r) => r !== undefined && isReviewArtifact(r, state.directory));
628
+ }
629
+ else if (action === "shell" && event.resources[0] !== undefined) {
630
+ resourceHitsArtifact = extractRedirectTargets(event.resources[0]).some((t) => isReviewArtifact(t, state.directory));
631
+ }
632
+ if (resourceHitsArtifact) {
633
+ const childID = typeof event.sessionID === "string" ? event.sessionID : "";
634
+ if (await resolveIsChildSession(childID, sessionGetter)) {
635
+ const reason = childArtifactDenial();
636
+ const depth = await resolveSessionDepth(childID, sessionGetter);
637
+ if (state.config.profile === "advisory") {
638
+ await safeLog(state, "debug", reason, { ...baseExtra, depth });
639
+ }
640
+ else {
641
+ event.effect = "deny";
642
+ event.message = reason;
643
+ await safeLog(state, "error", reason, { ...baseExtra, depth });
644
+ }
645
+ return;
646
+ }
647
+ }
648
+ }
568
649
  const verdict = toPermissionGuard(state.config, action, event.resources, state.directory);
569
650
  if (verdict === null) {
570
651
  await safeLog(state, "debug", `permission.evaluate action=${action} effect=${event.effect} (no guardrail verdict; engine default wins)`, { ...baseExtra, effect: event.effect });
@@ -608,6 +689,32 @@ const plugin = Plugin.define({
608
689
  const toolName = event.tool;
609
690
  const input = event.input;
610
691
  const sessionID = event.sessionID;
692
+ // Child sessions never write the parent's review artifact (plan 23
693
+ // phase 1). Checked only for artifact targets so ordinary calls pay
694
+ // zero lookup cost. Covers edit tools by target path and shell tools
695
+ // by redirect/`tee` target: a bare mention of the path in a command
696
+ // (grep, cat without redirect) is not a write and stays allowed.
697
+ const editTarget = extractFilePath(input);
698
+ const writesArtifact = (editTarget !== undefined &&
699
+ FILE_TOOLS.has(toolName) &&
700
+ isReviewArtifact(editTarget, state.directory)) ||
701
+ (SHELL_TOOLS.has(toolName) &&
702
+ extractRedirectTargets(extractCommand(input) ?? "").some((t) => isReviewArtifact(t, state.directory)));
703
+ if (writesArtifact) {
704
+ const childID = typeof sessionID === "string" ? sessionID : "";
705
+ if (await resolveIsChildSession(childID, sessionGetter)) {
706
+ const reason = childArtifactDenial();
707
+ const depth = await resolveSessionDepth(childID, sessionGetter);
708
+ const extra = { tool: toolName, sessionID, depth };
709
+ if (state.config.profile === "advisory") {
710
+ await safeLog(state, "warn", reason, extra);
711
+ }
712
+ else {
713
+ await safeLog(state, "error", reason, extra);
714
+ throw new Error(`[opencode-dev-framework] ${reason}`);
715
+ }
716
+ }
717
+ }
611
718
  // Pre-flight harness: when `preflight:` tasks are configured, file
612
719
  // edits are denied (standard/strict) until the pre-flight artifact
613
720
  // exists. This is a true hard gate — it runs before the edit lands.
@@ -874,7 +981,7 @@ const plugin = Plugin.define({
874
981
  "(teardown or reload raced the command); retry /df-init.");
875
982
  }
876
983
  const { runInitCommand } = await import("./init.js");
877
- await runInitCommand({
984
+ const delivered = await runInitCommand({
878
985
  directory: state.directory,
879
986
  run: state.run,
880
987
  delivery: invocation.delivery,
@@ -913,6 +1020,9 @@ const plugin = Plugin.define({
913
1020
  await safeLog(state, level, message, extra);
914
1021
  },
915
1022
  });
1023
+ if (!delivered) {
1024
+ await safeLog(state, "info", "df-init: already configured and clean, staying silent (no handoff)");
1025
+ }
916
1026
  },
917
1027
  });
918
1028
  }));
@@ -939,7 +1049,7 @@ const plugin = Plugin.define({
939
1049
  "(teardown or reload raced the command); retry /df-update.");
940
1050
  }
941
1051
  const { runUpdateCommand } = await import("./update.js");
942
- await runUpdateCommand({
1052
+ const delivered = await runUpdateCommand({
943
1053
  directory: state.directory,
944
1054
  delivery: invocation.delivery,
945
1055
  checkAlive: () => {
@@ -956,6 +1066,9 @@ const plugin = Plugin.define({
956
1066
  });
957
1067
  },
958
1068
  });
1069
+ if (!delivered) {
1070
+ await safeLog(state, "info", "df-update: templates current, staying silent (no handoff)");
1071
+ }
959
1072
  },
960
1073
  });
961
1074
  }));
@@ -1029,6 +1142,13 @@ const plugin = Plugin.define({
1029
1142
  const sessionID = getEventSessionID(event);
1030
1143
  if (!sessionID)
1031
1144
  continue;
1145
+ // Same child-session skip as the hook lever above: no duty, no
1146
+ // verdict, no re-prompt — the parent answers for the tree.
1147
+ if (await resolveIsChildSession(sessionID, sessionGetter)) {
1148
+ const depth = await resolveSessionDepth(sessionID, sessionGetter);
1149
+ await safeLog(state, "debug", "completion gate skipped: child session owes no review duty", { sessionID, depth });
1150
+ continue;
1151
+ }
1032
1152
  // The §1b hook completed an evaluation for this boundary — one
1033
1153
  // boundary, one gate run. (Deliberately not stamped here: only
1034
1154
  // the hook stamps, so a hook that never fires can never be
@@ -1038,7 +1158,7 @@ const plugin = Plugin.define({
1038
1158
  const verdict = await runCompletion(state, sessionID);
1039
1159
  if (state.continuationLevel === undefined) {
1040
1160
  state.continuationLevel = "fallback";
1041
- void writeRuntimeStatus(state.directory, { idleHookVia, continuation: "fallback" });
1161
+ stampRuntimeStatus(state.directory, idleHookVia, "fallback");
1042
1162
  }
1043
1163
  const message = await actOnVerdict(state, verdict);
1044
1164
  if (message === null)
package/dist/init.d.ts CHANGED
@@ -25,6 +25,15 @@ export interface InitScaffold {
25
25
  /** True when this run changed anything (templates or config). */
26
26
  fresh: boolean;
27
27
  }
28
+ /**
29
+ * Whether the scaffold result needs an agent handoff (a turn). Fresh
30
+ * scaffolds do (the agent must resolve the brief); re-runs with warnings
31
+ * do (reload/trial failures the user came to fix must be relayed). A clean
32
+ * re-run stays silent: the server command API returns void, so any
33
+ * delivery costs a full agent turn, and an "already configured" turn is
34
+ * pure waste.
35
+ */
36
+ export declare function initNeedsHandoff(scaffold: InitScaffold, warnings?: string[]): boolean;
28
37
  export declare function runInitScaffold(directory: string, run: RunCommand, options?: InitScaffoldOptions): Promise<InitScaffold>;
29
38
  export declare function scaffoldReportLines(scaffold: InitScaffold, directory: string): string[];
30
39
  /**
@@ -53,10 +62,14 @@ export interface InitCommandDeps {
53
62
  * Execute the `/df-init` command with injected dependencies (pure policy,
54
63
  * testable without a plugin context). Scaffold first, re-check liveness
55
64
  * across the long await (file IO + trial-runs), reload the just-written
56
- * config, then deliver the handoff. A reload failure degrades to a
65
+ * config, then deliver the handoff — but only when it needs an agent
66
+ * handoff (fresh scaffold, or warnings). A clean re-run returns `false`
67
+ * without delivering: the server command API returns void, so any
68
+ * delivery costs a full agent turn. A reload failure degrades to a
57
69
  * warning inside the prompt — `/df-init` is the command you run to fix
58
70
  * a broken setup, so it must not fail on exactly the broken setups.
59
71
  * A delivery failure throws: the scaffold succeeded, only the handoff
60
- * back failed, and the message says how to recover.
72
+ * back failed, and the message says how to recover. Returns whether the
73
+ * handoff was delivered.
61
74
  */
62
- export declare function runInitCommand(deps: InitCommandDeps): Promise<void>;
75
+ export declare function runInitCommand(deps: InitCommandDeps): Promise<boolean>;
package/dist/init.js CHANGED
@@ -11,6 +11,17 @@
11
11
  */
12
12
  import { detectProject } from "./detect.js";
13
13
  import { buildWizardBrief, formatBriefSkipped, formatTrialRun, formatWizardBrief, installTemplates, trialRunDetectedCommands, writeDetectedConfig, } from "./installer.js";
14
+ /**
15
+ * Whether the scaffold result needs an agent handoff (a turn). Fresh
16
+ * scaffolds do (the agent must resolve the brief); re-runs with warnings
17
+ * do (reload/trial failures the user came to fix must be relayed). A clean
18
+ * re-run stays silent: the server command API returns void, so any
19
+ * delivery costs a full agent turn, and an "already configured" turn is
20
+ * pure waste.
21
+ */
22
+ export function initNeedsHandoff(scaffold, warnings = []) {
23
+ return scaffold.fresh || warnings.length > 0;
24
+ }
14
25
  export async function runInitScaffold(directory, run, options = {}) {
15
26
  const overwrite = options.overwrite ?? false;
16
27
  const io = { overwriteExisting: overwrite, skipExisting: !overwrite };
@@ -110,11 +121,15 @@ export function composeInitPrompt(scaffold, directory, warnings = []) {
110
121
  * Execute the `/df-init` command with injected dependencies (pure policy,
111
122
  * testable without a plugin context). Scaffold first, re-check liveness
112
123
  * across the long await (file IO + trial-runs), reload the just-written
113
- * config, then deliver the handoff. A reload failure degrades to a
124
+ * config, then deliver the handoff — but only when it needs an agent
125
+ * handoff (fresh scaffold, or warnings). A clean re-run returns `false`
126
+ * without delivering: the server command API returns void, so any
127
+ * delivery costs a full agent turn. A reload failure degrades to a
114
128
  * warning inside the prompt — `/df-init` is the command you run to fix
115
129
  * a broken setup, so it must not fail on exactly the broken setups.
116
130
  * A delivery failure throws: the scaffold succeeded, only the handoff
117
- * back failed, and the message says how to recover.
131
+ * back failed, and the message says how to recover. Returns whether the
132
+ * handoff was delivered.
118
133
  */
119
134
  export async function runInitCommand(deps) {
120
135
  const scaffold = await runInitScaffold(deps.directory, deps.run, { wizard: true });
@@ -131,6 +146,9 @@ export async function runInitCommand(deps) {
131
146
  error: detail,
132
147
  });
133
148
  }
149
+ if (!initNeedsHandoff(scaffold, warnings)) {
150
+ return false;
151
+ }
134
152
  const text = composeInitPrompt(scaffold, deps.directory, warnings);
135
153
  try {
136
154
  await deps.deliver(text, deps.delivery);
@@ -140,4 +158,5 @@ export async function runInitCommand(deps) {
140
158
  throw new Error(`df-init scaffolded ${scaffold.created.length} file(s) (config ${scaffold.configAction}) ` +
141
159
  `but the handoff back to the session failed (${detail}); retry /df-init — a re-run reports status without touching anything.`);
142
160
  }
161
+ return true;
143
162
  }
package/dist/installer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { promises as fs } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
3
  import { createInterface } from "node:readline";
4
+ import { fileURLToPath } from "node:url";
5
5
  import { splitCommand } from "./command-utils.js";
6
6
  import { checkConfigEnforceable, DEFAULT_PROTECT, resolveConfig } from "./config.js";
7
7
  import { detectProject } from "./detect.js";
package/dist/protect.d.ts CHANGED
@@ -26,6 +26,16 @@ export declare const DANGEROUS_COMMANDS: DangerousCommand[];
26
26
  export declare function extractFilePath(args: unknown): string | undefined;
27
27
  /** Extract the shell command from tool args, if present. */
28
28
  export declare function extractCommand(args: unknown): string | undefined;
29
+ /**
30
+ * Extract probable file-write targets from a shell command: filenames after
31
+ * output redirections (`>`, `>>`, with optional fd/`&` prefixes, glued or
32
+ * spaced) and operands of `tee` in command position. Heredocs (`<<`) and
33
+ * herestrings (`<<<`) carry input, never a target, so they are ignored.
34
+ * Token-based and deliberately over-collecting within a command tail: that
35
+ * is harmless because callers only act on exact artifact matches, while a
36
+ * false negative would reopen a write path. Quote-aware.
37
+ */
38
+ export declare function extractRedirectTargets(command: string): string[];
29
39
  /**
30
40
  * Check a file path against the protected globs. Returns the matching
31
41
  * pattern, or undefined. Patterns without a slash also match basenames at
package/dist/protect.js CHANGED
@@ -52,6 +52,97 @@ export function extractCommand(args) {
52
52
  }
53
53
  return undefined;
54
54
  }
55
+ /**
56
+ * Extract probable file-write targets from a shell command: filenames after
57
+ * output redirections (`>`, `>>`, with optional fd/`&` prefixes, glued or
58
+ * spaced) and operands of `tee` in command position. Heredocs (`<<`) and
59
+ * herestrings (`<<<`) carry input, never a target, so they are ignored.
60
+ * Token-based and deliberately over-collecting within a command tail: that
61
+ * is harmless because callers only act on exact artifact matches, while a
62
+ * false negative would reopen a write path. Quote-aware.
63
+ */
64
+ export function extractRedirectTargets(command) {
65
+ const targets = [];
66
+ // Operators and separators stay visible as tokens so `tee` is only
67
+ // honored in command position (not inside quoted prose).
68
+ const tokens = [];
69
+ const tokenRe = /"([^"]*)"|'([^']*)'|&&|\|\||[;|&()!<>]+|[^\s;|&<>()!]+/g;
70
+ for (let m = tokenRe.exec(command); m !== null; m = tokenRe.exec(command)) {
71
+ tokens.push(m[1] ?? m[2] ?? m[0]);
72
+ }
73
+ const isSeparator = (t) => /^(?:&&|\|\||[;|&()!<>]+)$/.test(t);
74
+ const isBareRedirect = (t) => /^(?:\d*>>?\|?|&>>?\|?)$/.test(t);
75
+ // Wrappers that pass through to the real command: `sudo tee`, `env A=B
76
+ // tee`, `VAR=val tee`, `/usr/bin/tee`. A bare `tee` elsewhere (prose,
77
+ // array contents) is not a command.
78
+ const isWrapper = (t) => /^(?:sudo|command|env|nice|nohup|stdbuf|time|xargs)$/.test(t) ||
79
+ /^[A-Za-z_][A-Za-z0-9_]*=/.test(t);
80
+ const cmdBase = (t) => t.split("/").pop() ?? t;
81
+ // A few shell commands take plain argv paths as write targets (no
82
+ // redirect involved): `cp`/`mv`/`install` write their last operand,
83
+ // `sed -i` rewrites every file operand, `ed`/`ex` edit their first.
84
+ const ARG_WRITERS_LAST = new Set(["cp", "mv", "install"]);
85
+ const ARG_WRITERS_FIRST = new Set(["ed", "ex"]);
86
+ const collectOperands = (from) => {
87
+ const operands = [];
88
+ for (let j = from; j < tokens.length; j++) {
89
+ const next = tokens[j];
90
+ if (isSeparator(next) || isBareRedirect(next))
91
+ break;
92
+ if (!next.startsWith("-") && next !== "")
93
+ operands.push(next);
94
+ }
95
+ return operands;
96
+ };
97
+ for (let i = 0; i < tokens.length; i++) {
98
+ const token = tokens[i];
99
+ const atCommand = i === 0 || isSeparator(tokens[i - 1]) || isBareRedirect(tokens[i - 1]);
100
+ const base = cmdBase(token);
101
+ if (base === "tee" && (atCommand || isWrapper(tokens[i - 1] ?? ""))) {
102
+ // `tee` writes every non-flag operand that follows it.
103
+ for (const next of collectOperands(i + 1)) {
104
+ if (next === "tee")
105
+ break;
106
+ targets.push(next);
107
+ }
108
+ continue;
109
+ }
110
+ if (atCommand && (ARG_WRITERS_LAST.has(base) || ARG_WRITERS_FIRST.has(base))) {
111
+ const operands = collectOperands(i + 1);
112
+ const pick = ARG_WRITERS_LAST.has(base) ? operands.at(-1) : operands[0];
113
+ if (pick !== undefined)
114
+ targets.push(pick);
115
+ continue;
116
+ }
117
+ if (atCommand &&
118
+ base === "sed" &&
119
+ tokens.some((t, k) => k > i && (t === "-i" || t === "--in-place" || /^-i./.test(t)))) {
120
+ // First non-flag operand is the script; the rest are files.
121
+ let skippedScript = false;
122
+ for (const next of collectOperands(i + 1)) {
123
+ if (!skippedScript) {
124
+ skippedScript = true;
125
+ continue;
126
+ }
127
+ targets.push(next);
128
+ }
129
+ continue;
130
+ }
131
+ if (isBareRedirect(token)) {
132
+ const next = tokens[i + 1];
133
+ if (next !== undefined && next !== "" && !isSeparator(next))
134
+ targets.push(next);
135
+ continue;
136
+ }
137
+ // Glued forms: `2>file`, `>file`, `&>>file`. Exclude `<<`/`<<<`.
138
+ if (token.includes(">") && !token.includes("<")) {
139
+ const after = token.replace(/^.*?(?:\d*>>?|&>>?)/, "").replace(/^["']|["']$/g, "");
140
+ if (after !== "")
141
+ targets.push(after);
142
+ }
143
+ }
144
+ return targets;
145
+ }
55
146
  /**
56
147
  * Check a file path against the protected globs. Returns the matching
57
148
  * pattern, or undefined. Patterns without a slash also match basenames at
@@ -45,6 +45,32 @@ export declare function setHookState(directory: string, state: HookState): void;
45
45
  export declare function getHookState(directoryHint?: string): HookState | null;
46
46
  export declare function getStateForSession(sessionID: string | undefined): HookState | null;
47
47
  export declare function updateHookState(directory: string, updates: Partial<HookState>): HookState | null;
48
+ /** Structural parent link returned by the host session lookup. */
49
+ export interface SessionParentInfo {
50
+ parentID?: string | null | undefined;
51
+ }
52
+ /**
53
+ * True when the session is a child (subagent): its host record carries a
54
+ * parentID. Results are cached per sessionID. Fails closed to `false`
55
+ * (top-level): a missing getter (older core), an empty sessionID, or a
56
+ * lookup throw preserves the pre-guard behavior exactly — the session is
57
+ * gated and may write, as before. Never throws.
58
+ */
59
+ export declare function resolveIsChildSession(sessionID: string, getSession?: (id: string) => Promise<SessionParentInfo | null | undefined>): Promise<boolean>;
60
+ /**
61
+ * Best-effort session-tree depth for the plan-24 tripwire: the number of
62
+ * `parentID` hops from the session to its top-level root (0 = top-level).
63
+ * Logged on child-gated decisions so the first real nesting shows up in
64
+ * the log instead of passing silently. Uncapped by policy — the visited
65
+ * set only guards against a pathological cycle, which the core API cannot
66
+ * currently produce (no `parentID` mutation; creation with an unknown
67
+ * parent is rejected). Never throws and never caches: an empty sessionID
68
+ * or missing getter yields null (unknown), any lookup failure abandons
69
+ * the walk and yields null rather than a misleading partial count, and
70
+ * the call sites are rare (idle boundaries, artifact writes) so
71
+ * freshness beats memoization.
72
+ */
73
+ export declare function resolveSessionDepth(sessionID: string, getSession?: (id: string) => Promise<SessionParentInfo | null | undefined>): Promise<number | null>;
48
74
  export declare function setSessionDirectory(sessionID: string, directory: string): void;
49
75
  export declare function getDirectoryForSession(sessionID: string): string | null;
50
76
  /** Forget a session's directory mapping (called on `session.deleted`). */
package/dist/registry.js CHANGED
@@ -48,6 +48,80 @@ export function updateHookState(directory, updates) {
48
48
  /** Map session IDs to their project directory so hooks that only receive a
49
49
  * session ID can still find their state. */
50
50
  const sessionToDirectory = new Map();
51
+ /**
52
+ * Child-session verdicts: sessionID → true when the session has a parent
53
+ * (i.e. it is a subagent and never owns review duty). Populated lazily via
54
+ * `resolveIsChildSession` and cleared with everything else in
55
+ * `resetRegistry`. Memory-only like the directory map.
56
+ */
57
+ const childSessionCache = new Map();
58
+ /**
59
+ * True when the session is a child (subagent): its host record carries a
60
+ * parentID. Results are cached per sessionID. Fails closed to `false`
61
+ * (top-level): a missing getter (older core), an empty sessionID, or a
62
+ * lookup throw preserves the pre-guard behavior exactly — the session is
63
+ * gated and may write, as before. Never throws.
64
+ */
65
+ export async function resolveIsChildSession(sessionID, getSession) {
66
+ if (sessionID === "")
67
+ return false;
68
+ const cached = childSessionCache.get(sessionID);
69
+ if (cached !== undefined)
70
+ return cached;
71
+ let isChild = false;
72
+ if (getSession === undefined)
73
+ return false;
74
+ try {
75
+ const info = await getSession(sessionID);
76
+ // Cache only successful lookups that actually resolved a session:
77
+ // a throw or a nullish info (unknown to the host) returns top-level
78
+ // WITHOUT caching, so one transient failure can never permanently pin
79
+ // a child as top-level (which would re-enable the original bug).
80
+ if (info !== null && info !== undefined) {
81
+ const parent = info.parentID;
82
+ isChild = typeof parent === "string" && parent !== "";
83
+ childSessionCache.set(sessionID, isChild);
84
+ }
85
+ return isChild;
86
+ }
87
+ catch {
88
+ return false;
89
+ }
90
+ }
91
+ /**
92
+ * Best-effort session-tree depth for the plan-24 tripwire: the number of
93
+ * `parentID` hops from the session to its top-level root (0 = top-level).
94
+ * Logged on child-gated decisions so the first real nesting shows up in
95
+ * the log instead of passing silently. Uncapped by policy — the visited
96
+ * set only guards against a pathological cycle, which the core API cannot
97
+ * currently produce (no `parentID` mutation; creation with an unknown
98
+ * parent is rejected). Never throws and never caches: an empty sessionID
99
+ * or missing getter yields null (unknown), any lookup failure abandons
100
+ * the walk and yields null rather than a misleading partial count, and
101
+ * the call sites are rare (idle boundaries, artifact writes) so
102
+ * freshness beats memoization.
103
+ */
104
+ export async function resolveSessionDepth(sessionID, getSession) {
105
+ if (sessionID === "" || getSession === undefined)
106
+ return null;
107
+ const seen = new Set([sessionID]);
108
+ let depth = 0;
109
+ let current = sessionID;
110
+ try {
111
+ while (true) {
112
+ const parent = (await getSession(current))?.parentID;
113
+ if (typeof parent !== "string" || parent === "" || seen.has(parent))
114
+ break;
115
+ seen.add(parent);
116
+ depth++;
117
+ current = parent;
118
+ }
119
+ return depth;
120
+ }
121
+ catch {
122
+ return null;
123
+ }
124
+ }
51
125
  export function setSessionDirectory(sessionID, directory) {
52
126
  sessionToDirectory.set(sessionID, directory);
53
127
  }
@@ -61,6 +135,11 @@ const sessionStartSeen = new Set();
61
135
  export function clearSessionDirectory(sessionID) {
62
136
  sessionToDirectory.delete(sessionID);
63
137
  sessionStartSeen.delete(sessionID);
138
+ // A deleted session's verdict must never outlive it: IDs are unique per
139
+ // session, so this is just hygiene against unbounded growth — but a stale
140
+ // `true` here would wrongly exempt, and a stale `false` wrongly gate, a
141
+ // hypothetical ID reuse. Match the existing per-session eviction contract.
142
+ childSessionCache.delete(sessionID);
64
143
  }
65
144
  export function hasSeenSessionStart(sessionID) {
66
145
  return sessionStartSeen.has(sessionID);
@@ -74,6 +153,7 @@ export function markSessionStartSeen(sessionID) {
74
153
  export function resetRegistry() {
75
154
  sessionToDirectory.clear();
76
155
  sessionStartSeen.clear();
156
+ childSessionCache.clear();
77
157
  hookRegistry.clear();
78
158
  activeDirectory = null;
79
159
  }
@@ -15,15 +15,31 @@ export declare const RUNTIME_STATUS_FILE = "runtime-status.json";
15
15
  export type IdleHookVia = "experimental.idle" | "idle" | "none";
16
16
  /** Dispatch history this session: hook-fired, net-fired, or neither yet. */
17
17
  export type ContinuationState = "idle" | "fallback" | "armed";
18
+ /** Template drift state for the TUI `/df-runtime` command: up to date,
19
+ * drifted (run `/df-update`), or nothing installed (run `/df-init`). */
20
+ export interface TemplateState {
21
+ state: "current" | "drifted" | "empty";
22
+ /** Shipped files matching the deployed set. */
23
+ current: number;
24
+ /** Total shipped files. */
25
+ total: number;
26
+ /** Deployed files differing from shipped (refresh candidates). */
27
+ refresh: number;
28
+ /** Shipped files absent (add candidates). */
29
+ add: number;
30
+ }
18
31
  export interface RuntimeStatus {
19
32
  frameworkVersion: string;
20
33
  idleHookVia: IdleHookVia;
21
34
  continuation: ContinuationState;
35
+ /** Absent on snapshots written before template reporting existed. */
36
+ templates?: TemplateState;
22
37
  updatedAt: string;
23
38
  }
24
39
  export declare function snapshotPath(directory: string): string;
25
40
  export declare function writeRuntimeStatus(directory: string, partial: {
26
41
  idleHookVia: IdleHookVia;
27
42
  continuation: ContinuationState;
43
+ templates?: TemplateState;
28
44
  }): Promise<void>;
29
45
  export declare function readRuntimeStatus(directory: string): Promise<RuntimeStatus | null>;
@@ -56,6 +56,16 @@ function isIdleHookVia(value) {
56
56
  function isContinuationState(value) {
57
57
  return value === "idle" || value === "fallback" || value === "armed";
58
58
  }
59
+ function isTemplateState(value) {
60
+ if (typeof value !== "object" || value === null)
61
+ return false;
62
+ const t = value;
63
+ return ((t.state === "current" || t.state === "drifted" || t.state === "empty") &&
64
+ typeof t.current === "number" &&
65
+ typeof t.total === "number" &&
66
+ typeof t.refresh === "number" &&
67
+ typeof t.add === "number");
68
+ }
59
69
  export async function readRuntimeStatus(directory) {
60
70
  try {
61
71
  const parsed = JSON.parse(await readFile(snapshotPath(directory), "utf8"));
@@ -66,6 +76,7 @@ export async function readRuntimeStatus(directory) {
66
76
  frameworkVersion: parsed.frameworkVersion,
67
77
  idleHookVia: isIdleHookVia(parsed.idleHookVia) ? parsed.idleHookVia : "none",
68
78
  continuation: isContinuationState(parsed.continuation) ? parsed.continuation : "armed",
79
+ ...(isTemplateState(parsed.templates) ? { templates: parsed.templates } : {}),
69
80
  updatedAt: parsed.updatedAt,
70
81
  };
71
82
  }
package/dist/update.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * path by construction. The user config (`.opencode-dev-framework.yml`) is
9
9
  * structurally out of scope: it was never in the template set.
10
10
  */
11
+ import type { TemplateState } from "./runtime-status.js";
11
12
  export interface TemplateDrift {
12
13
  /** Shipped files present and identical. */
13
14
  current: string[];
@@ -26,6 +27,22 @@ export declare function checkTemplateUpdates(directory: string): Promise<Templat
26
27
  * standing instructions (present per file, apply only what is approved).
27
28
  */
28
29
  export declare function composeUpdatePrompt(drift: TemplateDrift, directory: string): string;
30
+ /**
31
+ * Summarize drift for the runtime snapshot (`/df-runtime` renders one of
32
+ * three states: up to date, drifted, nothing installed). Pure; counts
33
+ * only, no file lists.
34
+ */
35
+ export declare function summarizeDrift(drift: TemplateDrift): TemplateState;
36
+ /**
37
+ * Whether the drift needs an agent handoff (a turn). Drifted trees do
38
+ * (the agent must diff, present per file, and get approval), and empty
39
+ * trees do too (the `/df-init` redirect guides someone who just invoked
40
+ * the command while exploring — silence would leave zero feedback that
41
+ * anything ran). Current trees ("nothing to do") stay silent: an empty
42
+ * tree's missing files already read as `add`, so the two length checks
43
+ * below cover all three cases with no special-casing.
44
+ */
45
+ export declare function needsAgentHandoff(drift: TemplateDrift): boolean;
29
46
  /**
30
47
  * One-line startup mention for template drift, or null when there is
31
48
  * nothing to say. Installed-but-current and empty trees stay silent: the
@@ -44,7 +61,11 @@ export interface UpdateCommandDeps {
44
61
  /**
45
62
  * Execute the `/df-update` command with injected dependencies (pure policy,
46
63
  * testable without a plugin context). Check, re-check liveness across the
47
- * await, then deliver. A delivery failure throws: the check succeeded, only
48
- * the handoff back failed, and the message says how to recover.
64
+ * await, then deliver — but only when the drift needs an agent handoff.
65
+ * A current tree returns `false` without delivering: the server command
66
+ * API returns void, so any delivery costs a full agent turn, and a
67
+ * "nothing to do" turn is pure waste. A delivery failure throws: the check
68
+ * succeeded, only the handoff back failed, and the message says how to
69
+ * recover. Returns whether the handoff was delivered.
49
70
  */
50
- export declare function runUpdateCommand(deps: UpdateCommandDeps): Promise<void>;
71
+ export declare function runUpdateCommand(deps: UpdateCommandDeps): Promise<boolean>;
package/dist/update.js CHANGED
@@ -58,6 +58,39 @@ export function composeUpdatePrompt(drift, directory) {
58
58
  "Report what was applied and what was left alone.");
59
59
  return lines.join("\n");
60
60
  }
61
+ /**
62
+ * Summarize drift for the runtime snapshot (`/df-runtime` renders one of
63
+ * three states: up to date, drifted, nothing installed). Pure; counts
64
+ * only, no file lists.
65
+ */
66
+ export function summarizeDrift(drift) {
67
+ const total = drift.current.length + drift.refresh.length + drift.add.length;
68
+ if (drift.empty) {
69
+ return { state: "empty", current: 0, total, refresh: 0, add: drift.add.length };
70
+ }
71
+ if (drift.refresh.length === 0 && drift.add.length === 0) {
72
+ return { state: "current", current: drift.current.length, total, refresh: 0, add: 0 };
73
+ }
74
+ return {
75
+ state: "drifted",
76
+ current: drift.current.length,
77
+ total,
78
+ refresh: drift.refresh.length,
79
+ add: drift.add.length,
80
+ };
81
+ }
82
+ /**
83
+ * Whether the drift needs an agent handoff (a turn). Drifted trees do
84
+ * (the agent must diff, present per file, and get approval), and empty
85
+ * trees do too (the `/df-init` redirect guides someone who just invoked
86
+ * the command while exploring — silence would leave zero feedback that
87
+ * anything ran). Current trees ("nothing to do") stay silent: an empty
88
+ * tree's missing files already read as `add`, so the two length checks
89
+ * below cover all three cases with no special-casing.
90
+ */
91
+ export function needsAgentHandoff(drift) {
92
+ return drift.refresh.length > 0 || drift.add.length > 0;
93
+ }
61
94
  /**
62
95
  * One-line startup mention for template drift, or null when there is
63
96
  * nothing to say. Installed-but-current and empty trees stay silent: the
@@ -81,12 +114,19 @@ export function driftMentionLine(drift) {
81
114
  /**
82
115
  * Execute the `/df-update` command with injected dependencies (pure policy,
83
116
  * testable without a plugin context). Check, re-check liveness across the
84
- * await, then deliver. A delivery failure throws: the check succeeded, only
85
- * the handoff back failed, and the message says how to recover.
117
+ * await, then deliver — but only when the drift needs an agent handoff.
118
+ * A current tree returns `false` without delivering: the server command
119
+ * API returns void, so any delivery costs a full agent turn, and a
120
+ * "nothing to do" turn is pure waste. A delivery failure throws: the check
121
+ * succeeded, only the handoff back failed, and the message says how to
122
+ * recover. Returns whether the handoff was delivered.
86
123
  */
87
124
  export async function runUpdateCommand(deps) {
88
125
  const drift = await checkTemplateUpdates(deps.directory);
89
126
  deps.checkAlive();
127
+ if (!needsAgentHandoff(drift)) {
128
+ return false;
129
+ }
90
130
  const text = composeUpdatePrompt(drift, deps.directory);
91
131
  try {
92
132
  await deps.deliver(text, deps.delivery);
@@ -96,4 +136,5 @@ export async function runUpdateCommand(deps) {
96
136
  throw new Error(`df-update detected drift (${drift.refresh.length} to refresh, ${drift.add.length} to add) ` +
97
137
  `but the handoff back to the session failed (${detail}); retry /df-update — it only reads, never writes.`);
98
138
  }
139
+ return true;
99
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-dev-framework",
3
- "version": "1.9.1",
3
+ "version": "1.9.4",
4
4
  "description": "OpenCode plugin that enforces project-specific quality gates during AI coding sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,8 @@
39
39
  "pretest": "npm run build",
40
40
  "lint": "biome lint .",
41
41
  "lint:fix": "biome lint --write .",
42
+ "check": "biome check .",
43
+ "check:fix": "biome check --write .",
42
44
  "format:check": "biome format .",
43
45
  "format:fix": "biome format --write .",
44
46
  "lint:md": "markdownlint-cli2 \"**/*.md\"",