@lannguyensi/harness 0.52.0 → 0.54.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/cli/delegate/index.d.ts +15 -2
  3. package/dist/cli/delegate/index.js +128 -4
  4. package/dist/cli/delegate/index.js.map +1 -1
  5. package/dist/cli/doctor/bypass-without-auto-approve.d.ts +38 -0
  6. package/dist/cli/doctor/bypass-without-auto-approve.js +95 -0
  7. package/dist/cli/doctor/bypass-without-auto-approve.js.map +1 -0
  8. package/dist/cli/doctor/format.js +7 -0
  9. package/dist/cli/doctor/format.js.map +1 -1
  10. package/dist/cli/doctor/index.js +17 -0
  11. package/dist/cli/doctor/index.js.map +1 -1
  12. package/dist/cli/doctor/types.d.ts +11 -0
  13. package/dist/cli/doctor/types.js.map +1 -1
  14. package/dist/cli/doctor/ug-auto-approvals.js +18 -43
  15. package/dist/cli/doctor/ug-auto-approvals.js.map +1 -1
  16. package/dist/cli/dry-run.js +32 -1
  17. package/dist/cli/dry-run.js.map +1 -1
  18. package/dist/cli/gc/index.d.ts +13 -2
  19. package/dist/cli/gc/index.js +203 -1
  20. package/dist/cli/gc/index.js.map +1 -1
  21. package/dist/cli/index.js +57 -11
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/cli/init/composer.js +9 -0
  24. package/dist/cli/init/composer.js.map +1 -1
  25. package/dist/cli/init/profiles.d.ts +2 -2
  26. package/dist/cli/init/profiles.js +100 -8
  27. package/dist/cli/init/profiles.js.map +1 -1
  28. package/dist/cli/init/templates.d.ts +1 -1
  29. package/dist/cli/init/templates.js +174 -3
  30. package/dist/cli/init/templates.js.map +1 -1
  31. package/dist/cli/pack/hook-pre-tool-use.js +219 -115
  32. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  33. package/dist/cli/pack/index.d.ts +1 -0
  34. package/dist/cli/pack/index.js +1 -0
  35. package/dist/cli/pack/index.js.map +1 -1
  36. package/dist/cli/pack/upgrade.d.ts +32 -0
  37. package/dist/cli/pack/upgrade.js +273 -0
  38. package/dist/cli/pack/upgrade.js.map +1 -0
  39. package/dist/cli/record/index.d.ts +8 -0
  40. package/dist/cli/record/index.js +55 -7
  41. package/dist/cli/record/index.js.map +1 -1
  42. package/dist/cli/validate/checks.js +61 -9
  43. package/dist/cli/validate/checks.js.map +1 -1
  44. package/dist/io/extract.d.ts +29 -0
  45. package/dist/io/extract.js +36 -0
  46. package/dist/io/extract.js.map +1 -1
  47. package/dist/io/read-json-dir-entries.d.ts +36 -0
  48. package/dist/io/read-json-dir-entries.js +38 -0
  49. package/dist/io/read-json-dir-entries.js.map +1 -0
  50. package/dist/policies/index.d.ts +1 -1
  51. package/dist/policies/index.js +1 -1
  52. package/dist/policies/index.js.map +1 -1
  53. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +35 -0
  54. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +86 -0
  55. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +1 -0
  56. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +51 -0
  57. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +55 -1
  58. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +1 -1
  59. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +3 -1
  60. package/dist/policy-packs/builtin/understanding-before-execution/index.js +18 -1
  61. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
  62. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +71 -0
  63. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +175 -0
  64. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +1 -0
  65. package/dist/runtime/destructive-shell-floor.d.ts +19 -0
  66. package/dist/runtime/destructive-shell-floor.js +597 -0
  67. package/dist/runtime/destructive-shell-floor.js.map +1 -0
  68. package/dist/runtime/git-context.js +7 -1
  69. package/dist/runtime/git-context.js.map +1 -1
  70. package/dist/runtime/intercept.d.ts +10 -7
  71. package/dist/runtime/intercept.js +108 -9
  72. package/dist/runtime/intercept.js.map +1 -1
  73. package/dist/runtime/read-only-bash.d.ts +21 -0
  74. package/dist/runtime/read-only-bash.js +484 -0
  75. package/dist/runtime/read-only-bash.js.map +1 -1
  76. package/dist/runtime/risk-classifier.js +68 -13
  77. package/dist/runtime/risk-classifier.js.map +1 -1
  78. package/dist/runtime/when-eval.d.ts +18 -5
  79. package/dist/runtime/when-eval.js +64 -11
  80. package/dist/runtime/when-eval.js.map +1 -1
  81. package/dist/runtime/workflow-policies.d.ts +43 -1
  82. package/dist/runtime/workflow-policies.js +158 -1
  83. package/dist/runtime/workflow-policies.js.map +1 -1
  84. package/dist/schema/extract.d.ts +4 -0
  85. package/dist/schema/extract.js +64 -1
  86. package/dist/schema/extract.js.map +1 -1
  87. package/dist/schema/index.d.ts +13 -0
  88. package/dist/schema/policies.d.ts +19 -0
  89. package/dist/schema/policies.js +17 -1
  90. package/dist/schema/policies.js.map +1 -1
  91. package/package.json +1 -1
@@ -14,12 +14,47 @@
14
14
  // <reportsDir> terminal-status reports (approved / expired)
15
15
  // <reportsDir>/../parse-errors parse-error logs
16
16
  // <generatedDir>/.approvals session / task / branch-protection markers
17
+ // <generatedDir>/.delegations signed delegation markers (slice 3)
18
+ // <generatedDir>/.delegation-adoptions once-per-session adoption ledgers
19
+ // <generatedDir>/.permission-mode-observations per-session PreToolUse
20
+ // permission_mode observations (task 8f637efd)
17
21
  // The evidence ledger (grounding-mcp) and solution-acceptance
18
22
  // verdict dirs (producer-owned) are out of scope by design.
19
23
  // - Deletion failures are surfaced loudly per file, never swallowed.
24
+ //
25
+ // DELEGATIONS SWEEP (task 3ece079d, follow-up from UG auto-mode slice 3,
26
+ // agent-tasks 37ad0b05): a delegation marker is refused once expired
27
+ // (`verifyDelegation`'s "expired" reason), but nothing ever removed the
28
+ // FILE, so `.delegations/` grows the same way `.approvals/` used to. The
29
+ // adoption ledger at `.delegation-adoptions/<sid>` is worse: it is
30
+ // appended to once per captured transcript entry and never cleared at
31
+ // all, delegation expiry or not. Both sweep under one `"delegation"`
32
+ // category, on the SAME retention/grace window as everything else in this
33
+ // file (`retentionDays` / `cutoffMs`): a delegation marker is a candidate
34
+ // once its own `expires` segment (read via `parseDelegationApprovedBy`,
35
+ // no signature check needed for a retention decision) is older than
36
+ // `cutoffMs`, and its ledger sibling is a candidate once the marker for
37
+ // that session id is gone or itself a candidate. A marker whose content
38
+ // cannot be parsed is never a deletion candidate (fail closed, same as a
39
+ // pending report): it is surfaced separately in `GcResult.unparseable` so
40
+ // an operator can see it, but `--apply` never touches it, and its ledger
41
+ // sibling (if any) stays too, since "this delegation is dead" cannot be
42
+ // established for one gc cannot read.
43
+ //
44
+ // PERMISSION-MODE OBSERVATIONS SWEEP (task 8f637efd review round 2 F5):
45
+ // `.permission-mode-observations/` (one small per-session file, see
46
+ // permission-mode-observations.ts) grows the same way `.approvals/` and
47
+ // `.delegations/` do (nothing else ever removes an entry), and gc had
48
+ // not been taught about it. Swept under its own `"permission-mode-
49
+ // observation"` category by mtime, same `staleFilesByMtime` helper and
50
+ // `retentionDays` window every mtime-aged category here already uses (no
51
+ // signed `expires` to key off, unlike the delegation sweep: this is a
52
+ // plain observation record, not an approval artifact).
20
53
  import * as fs from "node:fs";
21
54
  import * as path from "node:path";
22
- import { APPROVAL_MARKER_DIRNAME, defaultReportsDir, listPersistedReports, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
55
+ import { readRegularFileRejectingSymlink } from "../../io/read-regular-file.js";
56
+ import { safeJsonParse } from "../../io/safe-json-parse.js";
57
+ import { ADOPTION_LEDGER_DIRNAME, APPROVAL_MARKER_DIRNAME, DELEGATION_MARKER_DIRNAME, PERMISSION_MODE_OBSERVATION_DIRNAME, defaultReportsDir, listPersistedReports, parseDelegationApprovedBy, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
23
58
  import { resolveGeneratedDir } from "../../runtime/pending-approval.js";
24
59
  import { resolvePaths } from "../loader.js";
25
60
  export const DEFAULT_RETENTION_DAYS = 30;
@@ -66,6 +101,158 @@ function staleFilesByMtime(dir, cutoffMs, nowMs, category) {
66
101
  }
67
102
  return { candidates, kept };
68
103
  }
104
+ /**
105
+ * A delegation filename is always a session id (mirrors
106
+ * `doctor/ug-delegations.ts`'s own filter and rationale): filtering on
107
+ * this shape before reading keeps filesystem debris that happens to sit
108
+ * next to `.delegations/` or `.delegation-adoptions/` (macOS's
109
+ * `.DS_Store`, a stray dotfile) from ever becoming an "unparseable"
110
+ * candidate gc reports on. Not shared code with that module (see its own
111
+ * header for why); `check:duplication` is the backstop if that stops
112
+ * being a coincidence.
113
+ */
114
+ const SESSION_ID_BASENAME_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
115
+ /**
116
+ * Read a `.delegations/<sid>` marker and classify it against `cutoffMs`,
117
+ * WITHOUT verifying its signature: gc is deciding whether to delete a
118
+ * file, not whether to trust it as an approval, and `parseDelegationApprovedBy`
119
+ * is the same reader `harness doctor`'s delegations metric uses read-only.
120
+ * Any failure to read the file, parse it as JSON, or parse its
121
+ * `approvedBy`/`expires` segment is `unparseable`, never `expired`: a
122
+ * marker gc cannot understand is never deleted (mutation probe M2).
123
+ */
124
+ function readDelegationStatus(filePath, cutoffMs, nowMs) {
125
+ const read = readRegularFileRejectingSymlink(filePath);
126
+ if (read.kind !== "ok") {
127
+ return { kind: "unparseable", reason: `could not read ${filePath} (${read.kind})` };
128
+ }
129
+ const parsed = safeJsonParse(read.content);
130
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
131
+ return { kind: "unparseable", reason: "not a JSON object" };
132
+ }
133
+ const segments = parseDelegationApprovedBy(parsed["approvedBy"]);
134
+ if (!segments.ok) {
135
+ return { kind: "unparseable", reason: segments.reason };
136
+ }
137
+ const expiresMs = Date.parse(segments.value.expiresAt);
138
+ if (!Number.isFinite(expiresMs)) {
139
+ return {
140
+ kind: "unparseable",
141
+ reason: `expires segment is not a valid instant: ${JSON.stringify(segments.value.expiresAt)}`,
142
+ };
143
+ }
144
+ // The expiry comparison itself: mutation probe M1 skips this and treats
145
+ // every parseable marker as expired, which flips a "valid delegation is
146
+ // kept" test red.
147
+ if (expiresMs < cutoffMs) {
148
+ return {
149
+ kind: "expired",
150
+ reason: `expired ${ageDays(nowMs, expiresMs)}d ago (past the ${ageDays(nowMs, cutoffMs)}d grace)`,
151
+ };
152
+ }
153
+ return { kind: "valid" };
154
+ }
155
+ /**
156
+ * Sweep `.delegations/` (expired markers) and `.delegation-adoptions/`
157
+ * (ledgers orphaned once their marker is gone or expired). One shared
158
+ * category (`"delegation"`), mirroring the approval-marker sweep's
159
+ * dry-run/candidate/kept shape but keyed off the marker's OWN `expires`
160
+ * segment instead of file mtime, since a delegation's age on disk and its
161
+ * validity window are two different things.
162
+ */
163
+ function sweepDelegations(generatedDir, cutoffMs, nowMs) {
164
+ const delegationsDir = path.join(generatedDir, DELEGATION_MARKER_DIRNAME);
165
+ const ledgerDir = path.join(generatedDir, ADOPTION_LEDGER_DIRNAME);
166
+ const candidates = [];
167
+ const unparseable = [];
168
+ let kept = 0;
169
+ // Session id -> status, for every delegation marker actually present
170
+ // and session-id-shaped, so the ledger pass below can tell "expired"
171
+ // from "absent" from "still valid" without re-reading the file.
172
+ const statusBySessionId = new Map();
173
+ let delegationNames;
174
+ try {
175
+ delegationNames = fs.readdirSync(delegationsDir);
176
+ }
177
+ catch {
178
+ delegationNames = [];
179
+ }
180
+ for (const name of delegationNames) {
181
+ if (!SESSION_ID_BASENAME_RE.test(name))
182
+ continue;
183
+ const full = path.join(delegationsDir, name);
184
+ const status = readDelegationStatus(full, cutoffMs, nowMs);
185
+ statusBySessionId.set(name, status);
186
+ if (status.kind === "expired") {
187
+ candidates.push({ filePath: full, category: "delegation", reason: status.reason });
188
+ }
189
+ else if (status.kind === "unparseable") {
190
+ unparseable.push({ filePath: full, category: "delegation", reason: status.reason });
191
+ kept += 1;
192
+ }
193
+ else {
194
+ kept += 1;
195
+ }
196
+ }
197
+ let ledgerNames;
198
+ try {
199
+ ledgerNames = fs.readdirSync(ledgerDir);
200
+ }
201
+ catch {
202
+ ledgerNames = [];
203
+ }
204
+ for (const name of ledgerNames) {
205
+ if (!SESSION_ID_BASENAME_RE.test(name))
206
+ continue;
207
+ const full = path.join(ledgerDir, name);
208
+ let stat;
209
+ try {
210
+ stat = fs.statSync(full);
211
+ }
212
+ catch {
213
+ continue;
214
+ }
215
+ if (!stat.isFile()) {
216
+ kept += 1;
217
+ continue;
218
+ }
219
+ const status = statusBySessionId.get(name);
220
+ if (status === undefined) {
221
+ // No marker for this session id at all: only a candidate once the
222
+ // LEDGER's own age clears the cutoff. Without this check a ledger
223
+ // written seconds ago (its marker legitimately not written yet, or
224
+ // already cleaned up by something else) would be swept regardless
225
+ // of age, contradicting the "older than the retention window"
226
+ // posture documented on the command and the listing header; it
227
+ // also closes the TOCTOU window between the two readdir calls
228
+ // above, since a ledger written between them is newer than cutoff.
229
+ if (stat.mtimeMs < cutoffMs) {
230
+ candidates.push({
231
+ filePath: full,
232
+ category: "delegation",
233
+ reason: "orphaned adoption ledger (no delegation marker for this session)",
234
+ });
235
+ }
236
+ else {
237
+ kept += 1;
238
+ }
239
+ }
240
+ else if (status.kind === "expired") {
241
+ candidates.push({
242
+ filePath: full,
243
+ category: "delegation",
244
+ reason: `orphaned adoption ledger (delegation ${status.reason})`,
245
+ });
246
+ }
247
+ else {
248
+ // Marker still valid, or unparseable (gc cannot prove it is dead):
249
+ // keep the ledger either way, same fail-closed posture as the
250
+ // marker itself.
251
+ kept += 1;
252
+ }
253
+ }
254
+ return { candidates, unparseable, kept };
255
+ }
69
256
  export function gc(opts = {}) {
70
257
  const retentionDays = opts.retentionDays ?? DEFAULT_RETENTION_DAYS;
71
258
  if (!Number.isFinite(retentionDays) || retentionDays < 1) {
@@ -92,7 +279,11 @@ export function gc(opts = {}) {
92
279
  manifestPath: manifestBase(),
93
280
  });
94
281
  const approvalsDir = path.join(generatedDir, APPROVAL_MARKER_DIRNAME);
282
+ const delegationsDir = path.join(generatedDir, DELEGATION_MARKER_DIRNAME);
283
+ const adoptionLedgerDir = path.join(generatedDir, ADOPTION_LEDGER_DIRNAME);
284
+ const permissionModeObservationsDir = path.join(generatedDir, PERMISSION_MODE_OBSERVATION_DIRNAME);
95
285
  const candidates = [];
286
+ const unparseable = [];
96
287
  let keptCount = 0;
97
288
  // Reports: only terminal statuses age out. A pending report is never
98
289
  // deleted regardless of age; since the C1 fix, stale pending leftovers
@@ -119,6 +310,13 @@ export function gc(opts = {}) {
119
310
  const markers = staleFilesByMtime(approvalsDir, cutoffMs, nowMs, "approval-marker");
120
311
  candidates.push(...markers.candidates);
121
312
  keptCount += markers.kept;
313
+ const delegations = sweepDelegations(generatedDir, cutoffMs, nowMs);
314
+ candidates.push(...delegations.candidates);
315
+ unparseable.push(...delegations.unparseable);
316
+ keptCount += delegations.kept;
317
+ const permissionModeObservations = staleFilesByMtime(permissionModeObservationsDir, cutoffMs, nowMs, "permission-mode-observation");
318
+ candidates.push(...permissionModeObservations.candidates);
319
+ keptCount += permissionModeObservations.kept;
122
320
  const removed = [];
123
321
  const failures = [];
124
322
  if (opts.apply === true) {
@@ -138,7 +336,11 @@ export function gc(opts = {}) {
138
336
  reportsDir,
139
337
  parseErrorsDir,
140
338
  approvalsDir,
339
+ delegationsDir,
340
+ adoptionLedgerDir,
341
+ permissionModeObservationsDir,
141
342
  candidates,
343
+ unparseable,
142
344
  removed,
143
345
  failures,
144
346
  keptCount,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/gc/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,iEAAiE;AACjE,sEAAsE;AACtE,oEAAoE;AACpE,kEAAkE;AAClE,sEAAsE;AACtE,gEAAgE;AAChE,0CAA0C;AAC1C,EA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CAAC,WAAW,EAAE;QAC3C,UAAU;QACV,cAAc;QACd,YAAY;QACZ,UAAU;QACV,OAAO;QACP,QAAQ;QACR,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI;KAC7B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/gc/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,iEAAiE;AACjE,sEAAsE;AACtE,oEAAoE;AACpE,kEAAkE;AAClE,sEAAsE;AACtE,gEAAgE;AAChE,0CAA0C;AAC1C,EAAE;AACF,yDAAyD;AACzD,6CAA6C;AAC7C,+DAA+D;AAC/D,6EAA6E;AAC7E,wDAAwD;AACxD,kFAAkF;AAClF,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,wFAAwF;AACxF,kEAAkE;AAClE,gEAAgE;AAChE,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,mEAAmE;AACnE,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,sCAAsC;AACtC,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,wEAAwE;AACxE,sEAAsE;AACtE,mEAAmE;AACnE,uEAAuE;AACvE,yEAAyE;AACzE,sEAAsE;AACtE,uDAAuD;AAEvD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBA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C;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa;QACb,SAAS,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;QAC3C,UAAU;QACV,cAAc;QACd,YAAY;QACZ,cAAc;QACd,iBAAiB;QACjB,6BAA6B;QAC7B,UAAU;QACV,WAAW;QACX,OAAO;QACP,QAAQ;QACR,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI;KAC7B,CAAC;AACJ,CAAC"}
package/dist/cli/index.js CHANGED
@@ -27,7 +27,7 @@ import { add } from "./add/index.js";
27
27
  import { adopt } from "./adopt/index.js";
28
28
  import { apply, CODEX_CONFIG_BASENAME, DRIFT_HINT_MESSAGE, formatNextSteps, OPENCODE_CONFIG_BASENAME, SETTINGS_BASENAME, } from "./apply/index.js";
29
29
  import { isRemoveType, KNOWN_REMOVE_TYPES, remove } from "./remove/index.js";
30
- import { packAdd, packList, packRemove, packReseed } from "./pack/index.js";
30
+ import { packAdd, packList, packRemove, packReseed, packUpgrade } from "./pack/index.js";
31
31
  import { runPackHookPreToolUseCli } from "./pack/hook-pre-tool-use.js";
32
32
  import { runPackHookPostToolUseCli } from "./pack/hook-post-tool-use.js";
33
33
  import { runPackHookTrackActiveClaimCli } from "./pack/hook-track-active-claim.js";
@@ -862,6 +862,35 @@ export function buildProgram(opts = {}) {
862
862
  }
863
863
  stdout(`reseeded ${result.fieldsChanged.map((f) => `config.${f}`).join(", ")} for policy_packs entry ${JSON.stringify(result.name)} in ${result.path}\n`);
864
864
  });
865
+ // `harness pack upgrade <name>` (task 8f637efd, D-004): text-level
866
+ // insertion of a pack's missing default config block into an existing
867
+ // manifest, idempotent, never rewrites content outside the inserted
868
+ // block. Today's only wired upgrade is `understanding-before-
869
+ // execution`'s `auto_approve` default; see upgrade.ts's module header
870
+ // for why this is text-level rather than a Document-API mutation like
871
+ // `add` / `reseed`.
872
+ packCmd
873
+ .command("upgrade <name>")
874
+ .description("Insert a pack's missing default config block into an existing manifest (today: " +
875
+ "understanding-before-execution's auto_approve default). Idempotent; " +
876
+ "refuses on ambiguity rather than guessing where to insert.")
877
+ .option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
878
+ .option("--dry-run", "print the unified diff and exit without writing")
879
+ .action(async (name, options) => {
880
+ const result = await packUpgrade(name, {
881
+ configPath: options.config,
882
+ dryRun: options.dryRun,
883
+ });
884
+ if (result.alreadyPresent) {
885
+ stdout(`policy_packs entry ${JSON.stringify(result.name)} already carries this upgrade; nothing to insert (${result.path} unchanged).\n`);
886
+ return;
887
+ }
888
+ if (options.dryRun) {
889
+ stdout(result.diff);
890
+ return;
891
+ }
892
+ stdout(`upgraded policy_packs entry ${JSON.stringify(result.name)} in ${result.path}\n`);
893
+ });
865
894
  // `harness pack hook` runtime sub-tree (Phase 6 #4): wired by the
866
895
  // pack's PreToolUse hook contribution; reads PreToolUse JSON from
867
896
  // stdin, consults the signed approval marker (the persisted report and
@@ -1530,13 +1559,16 @@ export function buildProgram(opts = {}) {
1530
1559
  .description("Issue a signed delegation for a headless `claude -p` child session, bound to " +
1531
1560
  "an already-approved parent session (pre-authorization, not an approval: the " +
1532
1561
  "child still writes and gets its own Understanding Report checked). Writes " +
1533
- "harness.generated/.delegations/<child-sid>, never .approvals/. See " +
1534
- "docs/decisions/2026-08-27-ug-auto-mode-approval.md.")
1562
+ "harness.generated/.delegations/<child-sid>, never .approvals/. Consumption is " +
1563
+ "Claude Code only: the Codex adapter has no delegation consumer, so a Codex " +
1564
+ "session cannot be the delegated child. A Codex session CAN be the delegating " +
1565
+ "parent today (parent resolution reads $CODEX_SESSION_ID and accepts any " +
1566
+ "validly signed marker). See docs/decisions/2026-08-27-ug-auto-mode-approval.md.")
1535
1567
  .requiredOption("--child-session <uuid>", "session id of the claude -p child this delegation authorizes (UUID)")
1536
1568
  .option("--cwd <path>", "bind the delegation to this working directory; at least one of --cwd/--task is required")
1537
1569
  .option("--task <id>", "bind the delegation to this agent-tasks task id; at least one of --cwd/--task is required")
1538
1570
  .option("--ttl <duration>", "delegation lifetime (e.g. 30m, 1h); default: the pack's approval_lifecycle.max_age when set, else 1h")
1539
- .option("--report <path>", "fallback shape: bind the child's Understanding Report by content + path hash at spawn time; not yet consumed by the child hook, see the pack doc")
1571
+ .option("--report <path>", "fallback shape: copy the child's Understanding Report to harness.generated/.delegation-reports/<child-sid>.md and bind it by content + that conventional path's hash at spawn time; the child's PreToolUse hook reads it back from there, see the pack doc")
1540
1572
  .option("--session-id <id>", "explicit parent session id (default: $CLAUDE_CODE_SESSION_ID, then $CLAUDE_SESSION_ID, then $CODEX_SESSION_ID, then staged .pending-approval)")
1541
1573
  .option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
1542
1574
  .option("--project <name>", "apply per-project overrides")
@@ -1952,8 +1984,9 @@ export function buildProgram(opts = {}) {
1952
1984
  "Interactive verbs (not hooks): a failure exits non-zero.");
1953
1985
  recordCmd
1954
1986
  .command("review <summary>")
1955
- .description("Record a review:${PR_NUMBER} + review:${BRANCH} (+ review:${BASE}) fact for the " +
1956
- "review-before-merge / review-before-merge-bash gates.")
1987
+ .description("Record a review:${PR_NUMBER} + review:${BRANCH} (+ review:${BASE}, + review:${TASK_ID} " +
1988
+ "with --task) fact for the review-before-merge / review-before-merge-bash / " +
1989
+ "review-before-task-merge / review-before-task-finish-automerge gates.")
1957
1990
  .option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
1958
1991
  .option("--project <name>", "apply per-project overrides")
1959
1992
  .requiredOption("--pr <number>", "PR number the review:${PR_NUMBER} tag is namespaced by")
@@ -1961,6 +1994,8 @@ export function buildProgram(opts = {}) {
1961
1994
  "refs/remotes/origin/HEAD (packed-refs fallback included); omitted with a stderr warning " +
1962
1995
  "when neither resolves. No `gh` shell-out.")
1963
1996
  .option("--branch <name>", "explicit branch override for review:${BRANCH} (default: current git branch)")
1997
+ .option("--task <id>", "agent-tasks task id for the review:${TASK_ID} tag the task_merge / task_finish(autoMerge) gates read. " +
1998
+ "Optional; pass it and one recorded review satisfies all four merge surfaces.")
1964
1999
  .option("--session <id>", "explicit session id (default: $CLAUDE_CODE_SESSION_ID, then $CLAUDE_SESSION_ID, then newest Claude Code transcript)")
1965
2000
  .option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
1966
2001
  .action(async (summary, options) => {
@@ -1973,6 +2008,8 @@ export function buildProgram(opts = {}) {
1973
2008
  cliOpts.base = options.base;
1974
2009
  if (options.branch)
1975
2010
  cliOpts.branch = options.branch;
2011
+ if (options.task !== undefined)
2012
+ cliOpts.task = options.task;
1976
2013
  if (options.session)
1977
2014
  cliOpts.session = options.session;
1978
2015
  applyLedgerTimeout(options.ledgerTimeout, cliOpts);
@@ -2256,11 +2293,13 @@ export function buildProgram(opts = {}) {
2256
2293
  program
2257
2294
  .command("gc")
2258
2295
  .description("Retention-based cleanup of harness-owned gate state: terminal " +
2259
- "(approved/expired) understanding-gate reports, parse-error logs, and " +
2260
- "approval markers older than the retention window. Pending reports and " +
2261
- "anything outside the enumerated harness-owned dirs are never touched " +
2262
- "(the evidence ledger and solution-acceptance verdict dirs are owned by " +
2263
- "their producers). Dry-run by default; pass --apply to delete.")
2296
+ "(approved/expired) understanding-gate reports, parse-error logs, " +
2297
+ "approval markers, expired delegation markers, orphaned delegation " +
2298
+ "adoption ledgers, and stale permission-mode observations older than " +
2299
+ "the retention window. Pending reports and anything outside the " +
2300
+ "enumerated harness-owned dirs are never touched (the evidence " +
2301
+ "ledger and solution-acceptance verdict dirs are owned by their " +
2302
+ "producers). Dry-run by default; pass --apply to delete.")
2264
2303
  .option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
2265
2304
  .option("--retention-days <n>", `delete artifacts older than this many days (default: ${DEFAULT_RETENTION_DAYS})`)
2266
2305
  .option("--apply", "delete the listed artifacts (default: dry-run listing only)")
@@ -2283,10 +2322,17 @@ export function buildProgram(opts = {}) {
2283
2322
  result.reportsDir,
2284
2323
  ...(result.parseErrorsDir !== null ? [result.parseErrorsDir] : []),
2285
2324
  result.approvalsDir,
2325
+ result.delegationsDir,
2326
+ result.adoptionLedgerDir,
2327
+ result.permissionModeObservationsDir,
2286
2328
  ];
2287
2329
  if (result.parseErrorsDir === null) {
2288
2330
  stderr("gc: skipping the parse-errors sweep (reports dir does not have the conventional .understanding-gate/reports shape)\n");
2289
2331
  }
2332
+ if (result.unparseable.length > 0) {
2333
+ stderr(`gc: ${result.unparseable.length} delegation file(s) could not be parsed and were left in place:\n` +
2334
+ result.unparseable.map((u) => ` [${u.category}] ${u.filePath} (${u.reason})\n`).join(""));
2335
+ }
2290
2336
  if (result.candidates.length === 0) {
2291
2337
  stdout(`gc: nothing older than ${result.retentionDays}d (cutoff ${result.cutoffIso}) under\n` +
2292
2338
  sweptDirs.map((d) => ` ${d}\n`).join("") +