@lannguyensi/harness 0.51.0 → 0.53.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 (95) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/dist/cli/approve/understanding.d.ts +46 -0
  3. package/dist/cli/approve/understanding.js +50 -22
  4. package/dist/cli/approve/understanding.js.map +1 -1
  5. package/dist/cli/audit.d.ts +29 -0
  6. package/dist/cli/audit.js +130 -17
  7. package/dist/cli/audit.js.map +1 -1
  8. package/dist/cli/delegate/index.d.ts +63 -0
  9. package/dist/cli/delegate/index.js +313 -0
  10. package/dist/cli/delegate/index.js.map +1 -0
  11. package/dist/cli/doctor/auto-approve-mode.d.ts +37 -0
  12. package/dist/cli/doctor/auto-approve-mode.js +80 -0
  13. package/dist/cli/doctor/auto-approve-mode.js.map +1 -0
  14. package/dist/cli/doctor/bypass-without-auto-approve.d.ts +38 -0
  15. package/dist/cli/doctor/bypass-without-auto-approve.js +89 -0
  16. package/dist/cli/doctor/bypass-without-auto-approve.js.map +1 -0
  17. package/dist/cli/doctor/codex-config-drift.d.ts +28 -0
  18. package/dist/cli/doctor/codex-config-drift.js +240 -0
  19. package/dist/cli/doctor/codex-config-drift.js.map +1 -0
  20. package/dist/cli/doctor/format.js +39 -1
  21. package/dist/cli/doctor/format.js.map +1 -1
  22. package/dist/cli/doctor/index.js +68 -7
  23. package/dist/cli/doctor/index.js.map +1 -1
  24. package/dist/cli/doctor/settings-drift.d.ts +6 -0
  25. package/dist/cli/doctor/settings-drift.js +20 -6
  26. package/dist/cli/doctor/settings-drift.js.map +1 -1
  27. package/dist/cli/doctor/types.d.ts +54 -0
  28. package/dist/cli/doctor/types.js.map +1 -1
  29. package/dist/cli/doctor/ug-auto-approvals.js +18 -43
  30. package/dist/cli/doctor/ug-auto-approvals.js.map +1 -1
  31. package/dist/cli/doctor/ug-delegations.d.ts +26 -0
  32. package/dist/cli/doctor/ug-delegations.js +112 -0
  33. package/dist/cli/doctor/ug-delegations.js.map +1 -0
  34. package/dist/cli/doctor/understanding-mode-env.d.ts +2 -0
  35. package/dist/cli/doctor/understanding-mode-env.js +5 -2
  36. package/dist/cli/doctor/understanding-mode-env.js.map +1 -1
  37. package/dist/cli/gc/index.d.ts +13 -2
  38. package/dist/cli/gc/index.js +203 -1
  39. package/dist/cli/gc/index.js.map +1 -1
  40. package/dist/cli/index.js +133 -7
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/cli/init/composer.js +9 -0
  43. package/dist/cli/init/composer.js.map +1 -1
  44. package/dist/cli/init/profiles.d.ts +2 -2
  45. package/dist/cli/init/profiles.js +11 -0
  46. package/dist/cli/init/profiles.js.map +1 -1
  47. package/dist/cli/init/templates.d.ts +1 -1
  48. package/dist/cli/init/templates.js +11 -0
  49. package/dist/cli/init/templates.js.map +1 -1
  50. package/dist/cli/pack/approve-escape.js +16 -7
  51. package/dist/cli/pack/approve-escape.js.map +1 -1
  52. package/dist/cli/pack/auto-approve-path.d.ts +17 -0
  53. package/dist/cli/pack/auto-approve-path.js +56 -3
  54. package/dist/cli/pack/auto-approve-path.js.map +1 -1
  55. package/dist/cli/pack/hook-pre-tool-use.d.ts +25 -0
  56. package/dist/cli/pack/hook-pre-tool-use.js +335 -3
  57. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  58. package/dist/cli/pack/index.d.ts +1 -0
  59. package/dist/cli/pack/index.js +1 -0
  60. package/dist/cli/pack/index.js.map +1 -1
  61. package/dist/cli/pack/transcript-report-scan.d.ts +71 -0
  62. package/dist/cli/pack/transcript-report-scan.js +359 -0
  63. package/dist/cli/pack/transcript-report-scan.js.map +1 -0
  64. package/dist/cli/pack/upgrade.d.ts +32 -0
  65. package/dist/cli/pack/upgrade.js +273 -0
  66. package/dist/cli/pack/upgrade.js.map +1 -0
  67. package/dist/cli/smoke/index.d.ts +18 -1
  68. package/dist/cli/smoke/index.js +54 -0
  69. package/dist/cli/smoke/index.js.map +1 -1
  70. package/dist/io/read-json-dir-entries.d.ts +36 -0
  71. package/dist/io/read-json-dir-entries.js +38 -0
  72. package/dist/io/read-json-dir-entries.js.map +1 -0
  73. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +35 -0
  74. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +86 -0
  75. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +1 -0
  76. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +76 -2
  77. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +139 -2
  78. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +1 -1
  79. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +237 -0
  80. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +647 -0
  81. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +1 -0
  82. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +4 -1
  83. package/dist/policy-packs/builtin/understanding-before-execution/index.js +26 -1
  84. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
  85. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +71 -0
  86. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +169 -0
  87. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +1 -0
  88. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +19 -0
  89. package/dist/policy-packs/builtin/understanding-before-execution.js +29 -0
  90. package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
  91. package/dist/runtime/approval-signing.js +28 -0
  92. package/dist/runtime/approval-signing.js.map +1 -1
  93. package/dist/runtime/git-context.js +7 -1
  94. package/dist/runtime/git-context.js.map +1 -1
  95. package/package.json +1 -1
@@ -0,0 +1,273 @@
1
+ // `harness pack upgrade <name>`: text-level insertion of a pack's
2
+ // missing default config block into an existing manifest, WITHOUT
3
+ // parsing and reserializing the operator's YAML (unlike `pack add` /
4
+ // `pack reseed`, which both mutate via the `yaml` Document API). Task
5
+ // 8f637efd: the one upgrade this ships is `auto_approve` for
6
+ // `understanding-before-execution` (D-004,
7
+ // docs/decisions/2026-08-27-ug-auto-mode-approval.md, "Amendment:
8
+ // install default").
9
+ //
10
+ // WHY TEXT-LEVEL, NOT DOCUMENT-LEVEL. The `yaml` package's Document API
11
+ // (`withDocument`, used by `pack reseed`) round-trips comments
12
+ // reasonably well for a single field REPLACEMENT, but this upgrade
13
+ // INSERTS a brand-new key with its own multi-line comment block into an
14
+ // operator manifest that may carry hand edits `pack add` / `reseed`
15
+ // never touch (custom producers, an extra top-level key, a reordered
16
+ // field). Re-serializing the whole document risks reformatting content
17
+ // this verb has no business touching. Insertion by line position,
18
+ // guided by indentation, keeps every byte outside the inserted block
19
+ // untouched.
20
+ //
21
+ // IDEMPOTENT. If `auto_approve:` already exists anywhere inside the
22
+ // pack's `config:` mapping (any indentation), this is a no-op: the
23
+ // output is byte-identical to the input. An operator who already
24
+ // hand-applied the workaround (the ADR's own "Workaround, bereits
25
+ // angewendet" paragraph) gets nothing rewritten out from under them.
26
+ //
27
+ // REFUSES ON AMBIGUITY. Zero or more than one
28
+ // `understanding-before-execution` pack block, more than one `config:`
29
+ // key inside it, or no `config:` key found at all, is a refusal
30
+ // (non-zero exit, a clear message), never a guess at where to insert.
31
+ import * as fs from "node:fs";
32
+ import * as path from "node:path";
33
+ import { parse as parseYaml } from "yaml";
34
+ import { atomicWriteFile } from "../../io/atomic-write.js";
35
+ import { unifiedDiff } from "../../io/patch.js";
36
+ import { withFileLock } from "../../io/lock.js";
37
+ import { formatValidationErrors, validateBeforeWrite, } from "../../io/validate-before-write.js";
38
+ import { resolveHomeDir } from "../../runtime/home-dir.js";
39
+ import { renderAutoApproveSnippet } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
40
+ import { EX_FAIL, EX_NOINPUT, HarnessExitError } from "../exit-codes.js";
41
+ const DEFAULT_BASENAME = "harness.yaml";
42
+ const LOCK_BASENAME = ".harness.lock";
43
+ function resolveTargetPath(opts) {
44
+ if (opts.configPath)
45
+ return path.resolve(opts.configPath);
46
+ return path.join(resolveHomeDir({ ...(opts.homeDir !== undefined ? { homeDir: opts.homeDir } : {}) }).path, DEFAULT_BASENAME);
47
+ }
48
+ function countLeadingSpaces(line) {
49
+ return line.length - line.trimStart().length;
50
+ }
51
+ /**
52
+ * Text-level insertion of the `auto_approve` default snippet into the
53
+ * `understanding-before-execution` pack's `config:` mapping. Pure: text
54
+ * in, text (+ a change flag) out, or an error string on ambiguity.
55
+ * Exported for direct unit testing without going through the CLI/file
56
+ * layer.
57
+ */
58
+ /**
59
+ * The line ending most of `text` uses, so an insertion into a CRLF
60
+ * manifest does not mix in bare-LF lines (task 8f637efd review round 2
61
+ * F6): counts `\r\n` occurrences against LF-only ones (every `\n` not
62
+ * part of a `\r\n` pair) and picks whichever is more common, defaulting
63
+ * to `\n` on a tie or an all-LF file.
64
+ */
65
+ function detectDominantEol(text) {
66
+ const crlfCount = (text.match(/\r\n/g) ?? []).length;
67
+ const totalLf = (text.match(/\n/g) ?? []).length;
68
+ const lfOnlyCount = totalLf - crlfCount;
69
+ return crlfCount > lfOnlyCount ? "\r\n" : "\n";
70
+ }
71
+ export function applyAutoApproveUpgrade(original) {
72
+ const eol = detectDominantEol(original);
73
+ // Split on either line ending so every line in `lines` is `\r`-free
74
+ // (its own trailing `\r`, if any, is consumed by the delimiter, not
75
+ // left dangling on the line content); the array is rejoined with the
76
+ // detected `eol` below, so a CRLF manifest stays CRLF end to end
77
+ // instead of picking up bare-LF lines from the inserted snippet.
78
+ const lines = original.split(/\r\n|\n/);
79
+ // Accepts a bare, double-quoted, or single-quoted scalar for the pack
80
+ // name (task 8f637efd review round 2 F4): `- name: understanding-before-execution`,
81
+ // `- name: "understanding-before-execution"`, and
82
+ // `- name: 'understanding-before-execution'` are all schema-valid YAML
83
+ // for the same value; the bare-only form previously refused the
84
+ // quoted spellings with "could not find a ... entry".
85
+ const packNameRe = /^(\s*)-\s*name:\s*(?:"understanding-before-execution"|'understanding-before-execution'|understanding-before-execution)\s*(#.*)?$/;
86
+ const packMatches = [];
87
+ for (let i = 0; i < lines.length; i++) {
88
+ const m = packNameRe.exec(lines[i] ?? "");
89
+ if (m)
90
+ packMatches.push({ index: i, indent: (m[1] ?? "").length });
91
+ }
92
+ if (packMatches.length === 0) {
93
+ return {
94
+ ok: false,
95
+ error: "could not find a `- name: understanding-before-execution` policy_packs entry in this manifest",
96
+ };
97
+ }
98
+ if (packMatches.length > 1) {
99
+ return {
100
+ ok: false,
101
+ error: `found ${packMatches.length} \`understanding-before-execution\` policy_packs entries; refusing (ambiguous)`,
102
+ };
103
+ }
104
+ const pack = packMatches[0];
105
+ const itemIndent = pack.indent;
106
+ function findBoundary(startIdx, indentThreshold) {
107
+ for (let i = startIdx; i < lines.length; i++) {
108
+ const line = lines[i] ?? "";
109
+ if (line.trim() === "")
110
+ continue;
111
+ if (countLeadingSpaces(line) <= indentThreshold)
112
+ return i;
113
+ }
114
+ return lines.length;
115
+ }
116
+ const packEnd = findBoundary(pack.index + 1, itemIndent);
117
+ const configIndent = itemIndent + 2;
118
+ const configRe = /^config:\s*(#.*)?$/;
119
+ let configIdx = -1;
120
+ for (let i = pack.index + 1; i < packEnd; i++) {
121
+ const line = lines[i] ?? "";
122
+ if (line.trim() === "")
123
+ continue;
124
+ if (countLeadingSpaces(line) === configIndent && configRe.test(line.trim())) {
125
+ if (configIdx !== -1) {
126
+ return {
127
+ ok: false,
128
+ error: "found more than one `config:` key in the understanding-before-execution pack block; refusing (ambiguous)",
129
+ };
130
+ }
131
+ configIdx = i;
132
+ }
133
+ }
134
+ if (configIdx === -1) {
135
+ return {
136
+ ok: false,
137
+ error: "could not find a `config:` key in the understanding-before-execution pack block",
138
+ };
139
+ }
140
+ let lastContentIdx = configIdx;
141
+ let autoApprovePresent = false;
142
+ for (let i = configIdx + 1; i < packEnd; i++) {
143
+ const line = lines[i] ?? "";
144
+ const trimmed = line.trim();
145
+ if (trimmed === "")
146
+ continue;
147
+ const indent = countLeadingSpaces(line);
148
+ if (indent <= configIndent)
149
+ break;
150
+ lastContentIdx = i;
151
+ // Review round 3, F3: any line whose trimmed form starts with
152
+ // `auto_approve:` counts as "already present", not only the exact
153
+ // bare-key spelling `auto_approve:` with nothing else on the line.
154
+ // That exact-equality check missed a hand-applied flow-style value
155
+ // (`auto_approve: {when: [bypassPermissions], ...}`) and a bare key
156
+ // with a trailing comment (`auto_approve: # already configured`):
157
+ // both are schema-valid YAML for the same key, but neither passed
158
+ // `trimmed === "auto_approve:"`, so this verb would insert a SECOND
159
+ // `auto_approve` key and `parseYaml` below would throw "Map keys
160
+ // must be unique" uncaught (exit 70, a raw YAML message) instead of
161
+ // recognizing the upgrade as already applied.
162
+ // Known limit: a line starting with `auto_approve:` inside a block scalar
163
+ // under another key would also count as present; the verb then no-ops
164
+ // (fail-safe, never a corrupted manifest) rather than inserting twice.
165
+ if (trimmed.startsWith("auto_approve:"))
166
+ autoApprovePresent = true;
167
+ }
168
+ if (autoApprovePresent) {
169
+ return { ok: true, text: original, changed: false };
170
+ }
171
+ const snippetLines = renderAutoApproveSnippet(configIndent + 2).split("\n");
172
+ const insertAt = lastContentIdx + 1;
173
+ const next = [...lines.slice(0, insertAt), ...snippetLines, ...lines.slice(insertAt)];
174
+ return { ok: true, text: next.join(eol), changed: true };
175
+ }
176
+ /**
177
+ * `parseYaml`, but a parse failure on the PROPOSED (post-insertion) text
178
+ * surfaces as this verb's own refusal (`HarnessExitError`, `EX_FAIL`,
179
+ * naming the pack and that the proposed text did not parse) rather than
180
+ * an uncaught exception (review round 3, F3: before this wrapper, a
181
+ * proposal `applyAutoApproveUpgrade` mis-recognized as a genuine
182
+ * insertion (e.g. a duplicate key under a different quoting style this
183
+ * heuristic does not special-case) reached the operator as a raw
184
+ * "Map keys must be unique" crash at exit 70 instead of a normal
185
+ * refusal). `original` is never passed here: it is the operator's own
186
+ * file, already on disk, and is not re-validated by this verb.
187
+ */
188
+ function parseProposedYamlOrRefuse(text, name, context) {
189
+ try {
190
+ return parseYaml(text);
191
+ }
192
+ catch (err) {
193
+ throw new HarnessExitError(`harness pack upgrade: proposed manifest for pack ${JSON.stringify(name)} did not parse as YAML (${context}): ${err instanceof Error ? err.message : String(err)}`, EX_FAIL);
194
+ }
195
+ }
196
+ /**
197
+ * `harness pack upgrade <name>` implementation. `name` is validated
198
+ * against the (currently one-entry) set of known upgrades before any
199
+ * file I/O; an unknown name refuses with `EX_FAIL` rather than silently
200
+ * doing nothing.
201
+ */
202
+ export async function packUpgrade(name, opts = {}) {
203
+ if (name !== "understanding-before-execution") {
204
+ throw new HarnessExitError(`harness pack upgrade does not support ${JSON.stringify(name)} yet; only "understanding-before-execution" (auto_approve default, task 8f637efd) is wired.`, EX_FAIL);
205
+ }
206
+ const target = resolveTargetPath(opts);
207
+ if (!fs.existsSync(target)) {
208
+ throw new HarnessExitError(`harness manifest not found at ${target}; run \`harness init\` first`, EX_NOINPUT);
209
+ }
210
+ const original = fs.readFileSync(target, "utf8");
211
+ const result = applyAutoApproveUpgrade(original);
212
+ if (!result.ok) {
213
+ throw new HarnessExitError(`harness pack upgrade: ${result.error}`, EX_FAIL);
214
+ }
215
+ const diff = unifiedDiff({
216
+ fileName: path.basename(target),
217
+ oldText: original,
218
+ newText: result.text,
219
+ oldHeader: "current",
220
+ newHeader: "proposed",
221
+ });
222
+ if (!result.changed) {
223
+ return { path: target, name, diff, applied: false, alreadyPresent: true };
224
+ }
225
+ // Schema gate before ever touching disk, mirroring `pack add` / `pack
226
+ // reseed`: catches an insertion that would somehow produce an invalid
227
+ // manifest (e.g. a config: key this heuristic mis-located) before it
228
+ // reaches the operator's file.
229
+ const schemaResult = validateBeforeWrite(parseProposedYamlOrRefuse(result.text, name, "post-insertion validation"));
230
+ if (!schemaResult.ok) {
231
+ throw new HarnessExitError(`proposed manifest fails schema validation:\n${formatValidationErrors(schemaResult.errors)}`, EX_FAIL);
232
+ }
233
+ if (opts.dryRun) {
234
+ return { path: target, name, diff, applied: false, alreadyPresent: false };
235
+ }
236
+ const lockPath = path.join(path.dirname(target), LOCK_BASENAME);
237
+ // Review round 3, F4: whether the locked callback actually WROTE is
238
+ // tracked here rather than assumed. The pre-lock read above can be
239
+ // stale by the time the lock is acquired: if a concurrent writer
240
+ // already inserted the block, the callback below returns early
241
+ // (`recomputed.changed === false`) without writing anything, and the
242
+ // result reported to the caller/CLI must say so (`applied: false,
243
+ // alreadyPresent: true`, so `harness pack upgrade` prints the
244
+ // "already carries this upgrade" message) instead of the hardcoded
245
+ // `applied: true` this used to return unconditionally.
246
+ let wroteUnderLock = false;
247
+ await withFileLock(lockPath, () => {
248
+ // Re-read and recompute under the lock (mirrors `pack add`): a
249
+ // concurrent writer may have inserted the block (or changed the
250
+ // file entirely) between the pre-lock read above and now.
251
+ const current = fs.readFileSync(target, "utf8");
252
+ const recomputed = applyAutoApproveUpgrade(current);
253
+ if (!recomputed.ok) {
254
+ throw new HarnessExitError(`harness pack upgrade: ${recomputed.error}`, EX_FAIL);
255
+ }
256
+ if (!recomputed.changed)
257
+ return; // raced: someone else already inserted it
258
+ const recheck = validateBeforeWrite(parseProposedYamlOrRefuse(recomputed.text, name, "post-insertion validation after lock acquisition"));
259
+ if (!recheck.ok) {
260
+ throw new HarnessExitError(`proposed manifest fails schema validation after lock acquisition:\n${formatValidationErrors(recheck.errors)}`, EX_FAIL);
261
+ }
262
+ atomicWriteFile(target, recomputed.text);
263
+ wroteUnderLock = true;
264
+ });
265
+ return {
266
+ path: target,
267
+ name,
268
+ diff,
269
+ applied: wroteUnderLock,
270
+ alreadyPresent: !wroteUnderLock,
271
+ };
272
+ }
273
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/pack/upgrade.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAClE,qEAAqE;AACrE,sEAAsE;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,CACjC,yBAAyB,CACvB,UAAU,CAAC,IAAI,EACf,IAAI,EACJ,kDAAkD,CACnD,CACF,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,gBAAgB,CACxB,sEAAsE,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAC9G,OAAO,CACR,CAAC;QACJ,CAAC;QACD,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,IAAI;QACJ,OAAO,EAAE,cAAc;QACvB,cAAc,EAAE,CAAC,cAAc;KAChC,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { apply } from "../apply/index.js";
2
+ import { issueDelegation } from "../delegate/index.js";
2
3
  import { type AssertionFailure, type SmokeExpectations } from "./assertions.js";
3
4
  import { type RunClaudeOptions } from "./runner.js";
4
5
  import { type StreamSummary } from "./stream-parser.js";
@@ -23,11 +24,27 @@ export interface SmokeOptions {
23
24
  spawn?: RunClaudeOptions["spawn"];
24
25
  /** Test seam for the manifest-apply step. Defaults to the real `apply`. */
25
26
  applyImpl?: typeof apply;
26
- /** Override cwd for the spawned claude. Defaults to `outputDir`. */
27
+ /**
28
+ * Override cwd for the spawned claude. Defaults to the parent
29
+ * process's own cwd: when unset, `runOpts.cwd` is left unset below
30
+ * and `runClaude` leaves `cwd` unset on the spawn options too, so
31
+ * Node inherits this process's cwd exactly like an unset `cwd` always
32
+ * does.
33
+ */
27
34
  spawnCwd?: string;
28
35
  /** Stdout/stderr writers (defaults to process.stdout / stderr). */
29
36
  stdout?: (s: string) => void;
30
37
  stderr?: (s: string) => void;
38
+ /**
39
+ * Skip the slice-3 pre-spawn delegation (ADR
40
+ * docs/decisions/2026-08-27-ug-auto-mode-approval.md, "TTL, cwd, and
41
+ * subagents": the smoke runner is the delegation's first consumer).
42
+ * Default: false (delegate). Set for launchers that want the
43
+ * pre-slice-3 shape, or when the caller issues its own delegation.
44
+ */
45
+ noDelegate?: boolean;
46
+ /** Test seam for the delegation step. Defaults to the real `issueDelegation`. */
47
+ issueDelegationImpl?: typeof issueDelegation;
31
48
  }
32
49
  export interface SmokeResult {
33
50
  /** EX_OK on green, EX_FAIL on an assertion miss, EX_UNAVAILABLE on missing claude. */
@@ -13,6 +13,7 @@ import { randomUUID } from "node:crypto";
13
13
  import * as fs from "node:fs";
14
14
  import * as path from "node:path";
15
15
  import { apply, SETTINGS_BASENAME } from "../apply/index.js";
16
+ import { issueDelegation } from "../delegate/index.js";
16
17
  import { EX_FAIL, EX_UNAVAILABLE, EX_USAGE, HarnessExitError } from "../exit-codes.js";
17
18
  import { evaluateExpectations, formatFailures, } from "./assertions.js";
18
19
  import { runClaude } from "./runner.js";
@@ -99,6 +100,59 @@ export async function runSmoke(opts) {
99
100
  }
100
101
  const sessionId = opts.sessionId ?? randomUUID();
101
102
  const timeoutMs = opts.timeoutMs ?? 60_000;
103
+ // Slice 3 delegation (ADR docs/decisions/2026-08-27-ug-auto-mode-
104
+ // approval.md, "TTL, cwd, and subagents": "The harness smoke runner
105
+ // ... is the natural first consumer"). Issued for the session id
106
+ // this run already chose, bound to the cwd the child actually spawns
107
+ // into (`opts.spawnCwd`, defaulting to this process's own cwd exactly
108
+ // like `runClaude`'s own unset-cwd default does), no task. Parent
109
+ // resolves through `issueDelegation`'s own precedence chain (flag >
110
+ // env > staged `.pending-approval`), this runner never overrides it,
111
+ // so the delegation is always issued on behalf of whatever session
112
+ // actually invoked `harness smoke`.
113
+ //
114
+ // TTL is the run's own wall-clock budget plus one minute of slack
115
+ // (`Math.ceil(timeoutMs / 1000) + 60`), never `issueDelegation`'s own
116
+ // one-hour default: a 60s smoke run has no business minting a
117
+ // pre-authorization that outlives the run by an hour. If that value
118
+ // exceeds the applied pack's own ceiling, `issueDelegationImpl`
119
+ // refuses with `ttl-above-max-age`, which prints exactly like any
120
+ // other refusal below; nothing here special-cases it.
121
+ //
122
+ // Never blocks the run: every refusal (no parent marker, no signing
123
+ // key, an unresolved parent session id, an over-ceiling TTL) AND
124
+ // every thrown error (e.g. `resolvePaths`'s real-home-dir guard when
125
+ // neither `--config` nor a home dir is set outside the real
126
+ // `harness` binary) prints one line and the run proceeds exactly as
127
+ // it did before this delegation step existed, the same shape
128
+ // `--no-delegate` opts back into explicitly.
129
+ const stdoutWrite = opts.stdout ?? ((s) => process.stdout.write(s));
130
+ if (!opts.noDelegate) {
131
+ const issueDelegationImpl = opts.issueDelegationImpl ?? issueDelegation;
132
+ const childCwd = opts.spawnCwd ?? process.cwd();
133
+ const delegationOpts = {
134
+ childSessionId: sessionId,
135
+ cwd: childCwd,
136
+ ttlSeconds: Math.ceil(timeoutMs / 1000) + 60,
137
+ };
138
+ if (opts.configPath)
139
+ delegationOpts.configPath = opts.configPath;
140
+ if (opts.project)
141
+ delegationOpts.project = opts.project;
142
+ try {
143
+ const delegationResult = await issueDelegationImpl(delegationOpts);
144
+ if (delegationResult.ok) {
145
+ stdoutWrite(`delegation: ✓ ${delegationResult.filePath} (child ${delegationResult.childSessionId}, parent ${delegationResult.parentSessionId}, expires ${delegationResult.expiresAt})\n`);
146
+ }
147
+ else {
148
+ stdoutWrite(`delegation: skipped (${delegationResult.reason}: ${delegationResult.detail})\n`);
149
+ }
150
+ }
151
+ catch (err) {
152
+ const message = err instanceof Error ? err.message : String(err);
153
+ stdoutWrite(`delegation: skipped (error: ${message})\n`);
154
+ }
155
+ }
102
156
  const runOpts = {
103
157
  claudeBin,
104
158
  prompt: opts.prompt,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/smoke/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,qEAAqE;AACrE,sEAAsE;AACtE,8DAA8D;AAC9D,EAAE;A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AAC;IACxG,KAAK,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAClD,KAAK,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,IAAI,iBAAiB,EAAE,CAAC,CAAC;IACtF,KAAK,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAI,CAAC,sBAAsB,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,IAAI,mBAAmB,EAAE,CAAC,CAAC;IAC3F,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,qBAAqB,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Shared read-and-classify loop for a directory of small JSON marker/record
3
+ * files, used by every doctor/observation reader that scans one file per
4
+ * session and tolerates missing/corrupt entries rather than throwing
5
+ * (extracted from `ug-auto-approvals.ts` and `permission-mode-observations.ts`,
6
+ * which had the same 15-line loop verbatim: readdir, reject symlink /
7
+ * non-regular / raced-away entries silently, count a read failure as
8
+ * unreadable, `safeJsonParse` the body, hand it to the caller's own
9
+ * validator/transform).
10
+ *
11
+ * A missing directory resolves to `{ dirPresent: false, entries: [],
12
+ * unreadableCount: 0 }` rather than throwing: every caller here is a
13
+ * best-effort read for a doctor listing or an audit surface, never a gate
14
+ * decision.
15
+ */
16
+ export interface ReadJsonDirEntriesResult<T> {
17
+ dirPresent: boolean;
18
+ entries: T[];
19
+ unreadableCount: number;
20
+ }
21
+ export interface ReadJsonDirEntriesOptions<T> {
22
+ /**
23
+ * Return true to silently skip an entry (not counted as unreadable) before
24
+ * it is even read. Used to exclude filenames that are not this reader's
25
+ * kind of marker at all (a differently-prefixed sibling marker in the
26
+ * same directory), as distinct from a marker that IS this reader's kind
27
+ * but fails to parse.
28
+ */
29
+ skip?: (name: string) => boolean;
30
+ /**
31
+ * Parse and validate the file's already-`safeJsonParse`d body. Return the
32
+ * value to keep, or null to count the entry as unreadable.
33
+ */
34
+ parse: (raw: unknown, name: string) => T | null;
35
+ }
36
+ export declare function readJsonDirEntriesRejectingSymlinks<T>(dir: string, opts: ReadJsonDirEntriesOptions<T>): ReadJsonDirEntriesResult<T>;
@@ -0,0 +1,38 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { readRegularFileRejectingSymlink } from "./read-regular-file.js";
4
+ import { safeJsonParse } from "./safe-json-parse.js";
5
+ export function readJsonDirEntriesRejectingSymlinks(dir, opts) {
6
+ let dirents;
7
+ try {
8
+ dirents = fs.readdirSync(dir, { withFileTypes: true });
9
+ }
10
+ catch {
11
+ return { dirPresent: false, entries: [], unreadableCount: 0 };
12
+ }
13
+ const entries = [];
14
+ let unreadableCount = 0;
15
+ for (const d of dirents) {
16
+ const name = d.name;
17
+ if (opts.skip?.(name))
18
+ continue;
19
+ const full = path.join(dir, name);
20
+ const read = readRegularFileRejectingSymlink(full);
21
+ if (read.kind === "symlink" || read.kind === "not-regular" || read.kind === "missing") {
22
+ continue;
23
+ }
24
+ if (read.kind === "unreadable") {
25
+ unreadableCount++;
26
+ continue;
27
+ }
28
+ const parsed = safeJsonParse(read.content);
29
+ const value = opts.parse(parsed, name);
30
+ if (value === null) {
31
+ unreadableCount++;
32
+ continue;
33
+ }
34
+ entries.push(value);
35
+ }
36
+ return { dirPresent: true, entries, unreadableCount };
37
+ }
38
+ //# sourceMappingURL=read-json-dir-entries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-json-dir-entries.js","sourceRoot":"","sources":["../../src/io/read-json-dir-entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAuCrD,MAAM,UAAU,mCAAmC,CACjD,GAAW,EACX,IAAkC;IAElC,IAAI,OAAoB,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,IAAI,eAAe,GAAG,CAAC,CAAC;IAExB,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACpB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YAAE,SAAS;QAEhC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACtF,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC/B,eAAe,EAAE,CAAC;YAClB,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,eAAe,EAAE,CAAC;YAClB,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** `auto_approve.when` value this default ships. */
2
+ export declare const AUTO_APPROVE_DEFAULT_WHEN: readonly string[];
3
+ /** `auto_approve.harnesses` value this default ships. */
4
+ export declare const AUTO_APPROVE_DEFAULT_HARNESSES: readonly string[];
5
+ export interface AutoApproveDefaultConfig {
6
+ when: string[];
7
+ harnesses: string[];
8
+ require_report: true;
9
+ }
10
+ /**
11
+ * The parsed-YAML shape of the shipped default, for structural equality
12
+ * assertions against a template's parsed `config.auto_approve` (mirrors
13
+ * how `defaultUx()` / `defaultProducers()` are consumed by
14
+ * `tests/cli/init-templates-ux-parity.test.ts`).
15
+ */
16
+ export declare function defaultAutoApproveConfig(): AutoApproveDefaultConfig;
17
+ /**
18
+ * Explanatory comment lines rendered above the `auto_approve:` mapping,
19
+ * WITHOUT the leading `# ` marker or indentation: callers supply both,
20
+ * since the same lines render at different indents in `harness init`
21
+ * templates vs. the `pack upgrade` text-level insertion. Deliberately
22
+ * short: what the block does, that `bypassPermissions` is the
23
+ * operator's own launch choice, and that deleting the block restores
24
+ * the manual prompt.
25
+ */
26
+ export declare const AUTO_APPROVE_COMMENT_LINES: readonly string[];
27
+ /**
28
+ * Render the full snippet (comment block + `auto_approve:` mapping) so
29
+ * that `auto_approve:` itself sits at `indent` spaces, matching the
30
+ * indentation of its sibling `config:` keys (`mode:`,
31
+ * `approval_lifecycle:`, ...). Each line is independently indented, no
32
+ * trailing newline, so callers can join it directly into a YAML
33
+ * document with no further reformatting.
34
+ */
35
+ export declare function renderAutoApproveSnippet(indent: number): string;
@@ -0,0 +1,86 @@
1
+ // Canonical shipped default for `auto_approve` (D-004, task 8f637efd,
2
+ // docs/decisions/2026-08-27-ug-auto-mode-approval.md, "Amendment: install
3
+ // default"). One source of truth for the exact shape and wording that
4
+ // three surfaces need to agree on byte-for-byte:
5
+ //
6
+ // - `harness init` (FULL_TEMPLATE, SOLO_TEMPLATE, TEAM_TEMPLATE): the
7
+ // block a fresh manifest ships with.
8
+ // - `harness pack upgrade understanding-before-execution`: the block
9
+ // it inserts into an existing manifest that predates this default.
10
+ // - `harness doctor`'s "bypassPermissions observed, auto_approve
11
+ // missing" finding: the snippet it prints as the remediation.
12
+ //
13
+ // Keeping these as one importable source (rather than three hand-synced
14
+ // literals) means a future wording or shape change cannot land in one
15
+ // surface without the other two, the same failure class task 68b9ad9c
16
+ // fixed for `config.ux` / `config.producers` via `defaultUx()` /
17
+ // `defaultProducers()` in the sibling `understanding-before-execution.ts`.
18
+ //
19
+ // Rationale for shipping this ACTIVE (not commented out) by default:
20
+ // under `bypassPermissions` the permission system is off by the
21
+ // operator's own launch choice (`--dangerously-skip-permissions` /
22
+ // `--permission-mode bypassPermissions`); a human approval prompt there
23
+ // is exactly the friction that mode exists to remove. `require_report:
24
+ // true` is unchanged (it is the only schema-valid value), and every
25
+ // template that carries this block also ships `mode: grill_me`, so the
26
+ // report the auto path consumes was actually checked, not merely
27
+ // present. The opt-in stays a visible, deletable config key: an
28
+ // existing install is never changed silently, only through the
29
+ // explicit `pack upgrade` verb.
30
+ import { CLAUDE_CODE_HARNESS } from "./auto-approve.js";
31
+ /** `auto_approve.when` value this default ships. */
32
+ export const AUTO_APPROVE_DEFAULT_WHEN = ["bypassPermissions"];
33
+ /** `auto_approve.harnesses` value this default ships. */
34
+ export const AUTO_APPROVE_DEFAULT_HARNESSES = [CLAUDE_CODE_HARNESS];
35
+ /**
36
+ * The parsed-YAML shape of the shipped default, for structural equality
37
+ * assertions against a template's parsed `config.auto_approve` (mirrors
38
+ * how `defaultUx()` / `defaultProducers()` are consumed by
39
+ * `tests/cli/init-templates-ux-parity.test.ts`).
40
+ */
41
+ export function defaultAutoApproveConfig() {
42
+ return {
43
+ when: [...AUTO_APPROVE_DEFAULT_WHEN],
44
+ harnesses: [...AUTO_APPROVE_DEFAULT_HARNESSES],
45
+ require_report: true,
46
+ };
47
+ }
48
+ /**
49
+ * Explanatory comment lines rendered above the `auto_approve:` mapping,
50
+ * WITHOUT the leading `# ` marker or indentation: callers supply both,
51
+ * since the same lines render at different indents in `harness init`
52
+ * templates vs. the `pack upgrade` text-level insertion. Deliberately
53
+ * short: what the block does, that `bypassPermissions` is the
54
+ * operator's own launch choice, and that deleting the block restores
55
+ * the manual prompt.
56
+ */
57
+ export const AUTO_APPROVE_COMMENT_LINES = [
58
+ "auto_approve (shipped default): a session started with",
59
+ "bypassPermissions gets its Understanding Report approved by the",
60
+ "hook's signed auto path instead of a human `harness approve",
61
+ "understanding` prompt; the report itself stays mandatory.",
62
+ "bypassPermissions is the operator's own launch choice",
63
+ "(--dangerously-skip-permissions / --permission-mode",
64
+ "bypassPermissions). Delete this block to restore the manual prompt.",
65
+ ];
66
+ /**
67
+ * Render the full snippet (comment block + `auto_approve:` mapping) so
68
+ * that `auto_approve:` itself sits at `indent` spaces, matching the
69
+ * indentation of its sibling `config:` keys (`mode:`,
70
+ * `approval_lifecycle:`, ...). Each line is independently indented, no
71
+ * trailing newline, so callers can join it directly into a YAML
72
+ * document with no further reformatting.
73
+ */
74
+ export function renderAutoApproveSnippet(indent) {
75
+ const pad = " ".repeat(indent);
76
+ const childPad = " ".repeat(indent + 2);
77
+ const lines = [];
78
+ for (const c of AUTO_APPROVE_COMMENT_LINES)
79
+ lines.push(`${pad}# ${c}`);
80
+ lines.push(`${pad}auto_approve:`);
81
+ lines.push(`${childPad}when: [${AUTO_APPROVE_DEFAULT_WHEN.join(", ")}]`);
82
+ lines.push(`${childPad}harnesses: [${AUTO_APPROVE_DEFAULT_HARNESSES.join(", ")}]`);
83
+ lines.push(`${childPad}require_report: true`);
84
+ return lines.join("\n");
85
+ }
86
+ //# sourceMappingURL=auto-approve-default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-approve-default.js","sourceRoot":"","sources":["../../../../src/policy-packs/builtin/understanding-before-execution/auto-approve-default.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0EAA0E;AAC1E,sEAAsE;AACtE,iDAAiD;AACjD,EAAE;AACF,wEAAwE;AACxE,yCAAyC;AACzC,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,iEAAiE;AACjE,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,gEAAgE;AAChE,mEAAmE;AACnE,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,iEAAiE;AACjE,gEAAgE;AAChE,+DAA+D;AAC/D,gCAAgC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,oDAAoD;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAsB,CAAC,mBAAmB,CAAC,CAAC;AAElF,yDAAyD;AACzD,MAAM,CAAC,MAAM,8BAA8B,GAAsB,CAAC,mBAAmB,CAAC,CAAC;AAQvF;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,IAAI,EAAE,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