@dzhechkov/harness-core 0.8.10 → 0.8.20

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 (251) hide show
  1. package/.dz-manifest.json +490 -170
  2. package/LICENSE +13 -0
  3. package/README.md +420 -6
  4. package/dist/agents-policy.d.ts +15 -1
  5. package/dist/agents-policy.d.ts.map +1 -1
  6. package/dist/agents-policy.js +27 -1
  7. package/dist/agents-policy.js.map +1 -1
  8. package/dist/amendment-trace.d.ts +72 -0
  9. package/dist/amendment-trace.d.ts.map +1 -1
  10. package/dist/amendment-trace.js +385 -17
  11. package/dist/amendment-trace.js.map +1 -1
  12. package/dist/backlog-public.d.ts +153 -0
  13. package/dist/backlog-public.d.ts.map +1 -0
  14. package/dist/backlog-public.js +415 -0
  15. package/dist/backlog-public.js.map +1 -0
  16. package/dist/backlog-transitions.d.ts +48 -0
  17. package/dist/backlog-transitions.d.ts.map +1 -0
  18. package/dist/backlog-transitions.js +64 -0
  19. package/dist/backlog-transitions.js.map +1 -0
  20. package/dist/backlog.d.ts.map +1 -1
  21. package/dist/backlog.js +13 -0
  22. package/dist/backlog.js.map +1 -1
  23. package/dist/claim-check.d.ts.map +1 -1
  24. package/dist/claim-check.js +24 -2
  25. package/dist/claim-check.js.map +1 -1
  26. package/dist/claude-hooks-assets.d.ts +93 -0
  27. package/dist/claude-hooks-assets.d.ts.map +1 -0
  28. package/dist/claude-hooks-assets.js +208 -0
  29. package/dist/claude-hooks-assets.js.map +1 -0
  30. package/dist/clean-room-smoke.d.ts +83 -0
  31. package/dist/clean-room-smoke.d.ts.map +1 -0
  32. package/dist/clean-room-smoke.js +138 -0
  33. package/dist/clean-room-smoke.js.map +1 -0
  34. package/dist/cmd-usage.d.ts.map +1 -1
  35. package/dist/cmd-usage.js +36 -6
  36. package/dist/cmd-usage.js.map +1 -1
  37. package/dist/codex-hooks-assets.d.ts +25 -7
  38. package/dist/codex-hooks-assets.d.ts.map +1 -1
  39. package/dist/codex-hooks-assets.js +138 -30
  40. package/dist/codex-hooks-assets.js.map +1 -1
  41. package/dist/codex-hooks.d.ts +21 -1
  42. package/dist/codex-hooks.d.ts.map +1 -1
  43. package/dist/codex-hooks.js +21 -1
  44. package/dist/codex-hooks.js.map +1 -1
  45. package/dist/codex-invoke.d.ts +73 -0
  46. package/dist/codex-invoke.d.ts.map +1 -0
  47. package/dist/codex-invoke.js +80 -0
  48. package/dist/codex-invoke.js.map +1 -0
  49. package/dist/course-staleness.d.ts +19 -0
  50. package/dist/course-staleness.d.ts.map +1 -0
  51. package/dist/course-staleness.js +95 -0
  52. package/dist/course-staleness.js.map +1 -0
  53. package/dist/destructive-guard-hook.d.ts +40 -0
  54. package/dist/destructive-guard-hook.d.ts.map +1 -0
  55. package/dist/destructive-guard-hook.js +109 -0
  56. package/dist/destructive-guard-hook.js.map +1 -0
  57. package/dist/destructive-guard.d.ts +27 -0
  58. package/dist/destructive-guard.d.ts.map +1 -0
  59. package/dist/destructive-guard.js +2808 -0
  60. package/dist/destructive-guard.js.map +1 -0
  61. package/dist/discrimination-gate.d.ts +88 -3
  62. package/dist/discrimination-gate.d.ts.map +1 -1
  63. package/dist/discrimination-gate.js +173 -16
  64. package/dist/discrimination-gate.js.map +1 -1
  65. package/dist/event-chain.d.ts +30 -0
  66. package/dist/event-chain.d.ts.map +1 -1
  67. package/dist/event-chain.js +24 -0
  68. package/dist/event-chain.js.map +1 -1
  69. package/dist/feature-adr-routing.d.ts +95 -1
  70. package/dist/feature-adr-routing.d.ts.map +1 -1
  71. package/dist/feature-adr-routing.js +193 -27
  72. package/dist/feature-adr-routing.js.map +1 -1
  73. package/dist/guard.d.ts +98 -0
  74. package/dist/guard.d.ts.map +1 -1
  75. package/dist/guard.js +308 -0
  76. package/dist/guard.js.map +1 -1
  77. package/dist/harness-core-location.d.ts +18 -0
  78. package/dist/harness-core-location.d.ts.map +1 -0
  79. package/dist/harness-core-location.js +42 -0
  80. package/dist/harness-core-location.js.map +1 -0
  81. package/dist/index.d.ts +32 -11
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +32 -7
  84. package/dist/index.js.map +1 -1
  85. package/dist/lead-shift-gate.d.ts +95 -0
  86. package/dist/lead-shift-gate.d.ts.map +1 -0
  87. package/dist/lead-shift-gate.js +100 -0
  88. package/dist/lead-shift-gate.js.map +1 -0
  89. package/dist/ledger-backfill.d.ts +11 -1
  90. package/dist/ledger-backfill.d.ts.map +1 -1
  91. package/dist/ledger-backfill.js +19 -0
  92. package/dist/ledger-backfill.js.map +1 -1
  93. package/dist/loop-blobs.generated.d.ts +1 -1
  94. package/dist/loop-blobs.generated.d.ts.map +1 -1
  95. package/dist/loop-blobs.generated.js +12 -3
  96. package/dist/loop-blobs.generated.js.map +1 -1
  97. package/dist/loop-lint.d.ts.map +1 -1
  98. package/dist/loop-lint.js +56 -7
  99. package/dist/loop-lint.js.map +1 -1
  100. package/dist/loop-plan-graph.d.ts +1 -3
  101. package/dist/loop-plan-graph.d.ts.map +1 -1
  102. package/dist/loop-plan-graph.js +70 -1
  103. package/dist/loop-plan-graph.js.map +1 -1
  104. package/dist/loop-trace.d.ts.map +1 -1
  105. package/dist/loop-trace.js +16 -2
  106. package/dist/loop-trace.js.map +1 -1
  107. package/dist/managed-hooks.d.ts +5 -6
  108. package/dist/managed-hooks.d.ts.map +1 -1
  109. package/dist/managed-hooks.js +2 -2
  110. package/dist/managed-hooks.js.map +1 -1
  111. package/dist/model-recommender.d.ts.map +1 -1
  112. package/dist/model-recommender.js +14 -3
  113. package/dist/model-recommender.js.map +1 -1
  114. package/dist/mutation-gate.d.ts +39 -36
  115. package/dist/mutation-gate.d.ts.map +1 -1
  116. package/dist/mutation-gate.js +111 -5
  117. package/dist/mutation-gate.js.map +1 -1
  118. package/dist/operations.d.ts.map +1 -1
  119. package/dist/operations.js +90 -5
  120. package/dist/operations.js.map +1 -1
  121. package/dist/patterns.d.ts +23 -0
  122. package/dist/patterns.d.ts.map +1 -1
  123. package/dist/patterns.js +10 -0
  124. package/dist/patterns.js.map +1 -1
  125. package/dist/plugin.d.ts.map +1 -1
  126. package/dist/plugin.js +27 -5
  127. package/dist/plugin.js.map +1 -1
  128. package/dist/publish.d.ts +11 -0
  129. package/dist/publish.d.ts.map +1 -1
  130. package/dist/publish.js +16 -2
  131. package/dist/publish.js.map +1 -1
  132. package/dist/recommend.d.ts +4 -5
  133. package/dist/recommend.d.ts.map +1 -1
  134. package/dist/recommend.js +110 -45
  135. package/dist/recommend.js.map +1 -1
  136. package/dist/registry.d.ts +32 -1
  137. package/dist/registry.d.ts.map +1 -1
  138. package/dist/registry.js +168 -11
  139. package/dist/registry.js.map +1 -1
  140. package/dist/run-records.d.ts +3 -0
  141. package/dist/run-records.d.ts.map +1 -1
  142. package/dist/run-records.js +18 -0
  143. package/dist/run-records.js.map +1 -1
  144. package/dist/score.d.ts +95 -0
  145. package/dist/score.d.ts.map +1 -1
  146. package/dist/score.js +289 -6
  147. package/dist/score.js.map +1 -1
  148. package/dist/session-retro.d.ts +121 -2
  149. package/dist/session-retro.d.ts.map +1 -1
  150. package/dist/session-retro.js +454 -11
  151. package/dist/session-retro.js.map +1 -1
  152. package/dist/setup.d.ts +28 -0
  153. package/dist/setup.d.ts.map +1 -1
  154. package/dist/setup.js +223 -6
  155. package/dist/setup.js.map +1 -1
  156. package/dist/sign.d.ts.map +1 -1
  157. package/dist/sign.js +18 -1
  158. package/dist/sign.js.map +1 -1
  159. package/dist/skill-selection.d.ts +72 -0
  160. package/dist/skill-selection.d.ts.map +1 -0
  161. package/dist/skill-selection.js +76 -0
  162. package/dist/skill-selection.js.map +1 -0
  163. package/dist/skills-verify.d.ts +34 -1
  164. package/dist/skills-verify.d.ts.map +1 -1
  165. package/dist/skills-verify.js +82 -0
  166. package/dist/skills-verify.js.map +1 -1
  167. package/dist/stage-line.d.ts +68 -0
  168. package/dist/stage-line.d.ts.map +1 -0
  169. package/dist/stage-line.js +129 -0
  170. package/dist/stage-line.js.map +1 -0
  171. package/dist/statusline.d.ts +99 -0
  172. package/dist/statusline.d.ts.map +1 -1
  173. package/dist/statusline.js +310 -44
  174. package/dist/statusline.js.map +1 -1
  175. package/dist/stem.d.ts +12 -0
  176. package/dist/stem.d.ts.map +1 -0
  177. package/dist/stem.js +89 -0
  178. package/dist/stem.js.map +1 -0
  179. package/dist/store-counts.d.ts +26 -0
  180. package/dist/store-counts.d.ts.map +1 -0
  181. package/dist/store-counts.js +125 -0
  182. package/dist/store-counts.js.map +1 -0
  183. package/dist/store-guard.d.ts +106 -0
  184. package/dist/store-guard.d.ts.map +1 -0
  185. package/dist/store-guard.js +294 -0
  186. package/dist/store-guard.js.map +1 -0
  187. package/dist/swarm-brief.d.ts +95 -0
  188. package/dist/swarm-brief.d.ts.map +1 -0
  189. package/dist/swarm-brief.js +660 -0
  190. package/dist/swarm-brief.js.map +1 -0
  191. package/dist/telemetry-vocabulary.d.ts +7 -0
  192. package/dist/telemetry-vocabulary.d.ts.map +1 -1
  193. package/dist/telemetry-vocabulary.js +29 -0
  194. package/dist/telemetry-vocabulary.js.map +1 -1
  195. package/dist/trace-bundle.d.ts +8 -0
  196. package/dist/trace-bundle.d.ts.map +1 -1
  197. package/dist/trace-bundle.js +11 -0
  198. package/dist/trace-bundle.js.map +1 -1
  199. package/package.json +10 -9
  200. package/sbom.json +1033 -233
  201. package/src/agents-policy.ts +46 -2
  202. package/src/amendment-trace.ts +441 -19
  203. package/src/backlog-public.ts +503 -0
  204. package/src/backlog-transitions.ts +77 -0
  205. package/src/backlog.ts +12 -0
  206. package/src/claim-check.ts +25 -2
  207. package/src/claude-hooks-assets.ts +227 -0
  208. package/src/clean-room-smoke.ts +195 -0
  209. package/src/cmd-usage.ts +29 -5
  210. package/src/codex-hooks-assets.ts +140 -30
  211. package/src/codex-hooks.ts +21 -1
  212. package/src/codex-invoke.ts +138 -0
  213. package/src/course-staleness.ts +125 -0
  214. package/src/destructive-guard-hook.ts +151 -0
  215. package/src/destructive-guard.ts +3027 -0
  216. package/src/discrimination-gate.ts +262 -19
  217. package/src/event-chain.ts +41 -0
  218. package/src/feature-adr-routing.ts +220 -22
  219. package/src/guard.ts +358 -0
  220. package/src/harness-core-location.ts +44 -0
  221. package/src/index.ts +121 -7
  222. package/src/lead-shift-gate.ts +145 -0
  223. package/src/ledger-backfill.ts +20 -1
  224. package/src/loop-blobs.generated.ts +12 -3
  225. package/src/loop-lint.ts +52 -7
  226. package/src/loop-plan-graph.ts +66 -1
  227. package/src/loop-trace.ts +13 -1
  228. package/src/managed-hooks.ts +5 -6
  229. package/src/model-recommender.ts +14 -3
  230. package/src/mutation-gate.ts +165 -5
  231. package/src/operations.ts +83 -5
  232. package/src/patterns.ts +33 -0
  233. package/src/plugin.ts +27 -5
  234. package/src/publish.ts +27 -2
  235. package/src/recommend.ts +116 -46
  236. package/src/registry.ts +147 -13
  237. package/src/run-records.ts +23 -0
  238. package/src/score.ts +377 -7
  239. package/src/session-retro.ts +466 -11
  240. package/src/setup.ts +246 -9
  241. package/src/sign.ts +18 -1
  242. package/src/skill-selection.ts +111 -0
  243. package/src/skills-verify.ts +99 -1
  244. package/src/stage-line.ts +151 -0
  245. package/src/statusline.ts +396 -47
  246. package/src/stem.ts +87 -0
  247. package/src/store-counts.ts +154 -0
  248. package/src/store-guard.ts +388 -0
  249. package/src/swarm-brief.ts +661 -0
  250. package/src/telemetry-vocabulary.ts +36 -0
  251. package/src/trace-bundle.ts +10 -0
@@ -0,0 +1,129 @@
1
+ /**
2
+ * stage-line-before-dispatch — the two-phase stage announcement renderer used by feature-adr
3
+ * dispatch points (historical feature name `stage-line-before-dispatch`, ADR-001). The workflow's
4
+ * sole dispatch seam prints an intent line before the runtime call and a distinct final outcome
5
+ * line after the same attempt settles.
6
+ *
7
+ * WHY this file is standalone and import-free: the workflow script runs in a sandbox with no
8
+ * imports, so this module is projected into `.claude/workflows/feature-adr.js` VERBATIM by
9
+ * `scripts/gen-loop-blobs.mjs` (blob `stage-line`) and byte-checked there by
10
+ * `loop-blobs-regen.test.ts`. The generator FAILS CLOSED on any cross-file import, so the decision
11
+ * shape below is declared STRUCTURALLY here rather than imported from `feature-adr-routing.ts`.
12
+ *
13
+ * The line is PURE TEXT ASSEMBLY: every field comes from the decision the resolver returned or from
14
+ * the constant label table below. No model ever writes a word of it (AC-6), it reads nothing, and it
15
+ * prints nothing — the caller does the printing (AC-3).
16
+ *
17
+ * DESIGN CONSTRAINT (shared with feature-adr-routing.ts): the Workflow parser is stricter than
18
+ * `node --check` — string `+` concatenation only, explicit `if`/`return`, object-literal tables.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+ /** Blob version stamp read by scripts/gen-loop-blobs.mjs; bump on any semantic change here. */
23
+ export const STAGE_LINE_BLOB_VERSION = '2.0.0';
24
+ /**
25
+ * Human signature per resolver branch — a CLOSED table over `StageDecisionReason`. A reason with no
26
+ * entry is a hole, and `stage-line.test.ts` proves the table has none: a newcomer reading `· ` and
27
+ * then a raw enum token learns nothing, which is the whole failure this feature exists to prevent.
28
+ */
29
+ export const STAGE_LINE_REASON_LABELS = {
30
+ 'usage-override': 'usage override (Claude limit pressure)',
31
+ 'explicit-models': 'explicit args.models',
32
+ 'routing-not-requested': 'routing not requested',
33
+ 'coder-knob-codex': 'coder knob = codex',
34
+ 'planner-knob-codex': 'planner knob = codex',
35
+ 'qe-cross-family': 'cross-family QE (the coder never self-reviews)',
36
+ 'budget-table-cell': 'budget table cell',
37
+ 'default-models': 'default models table',
38
+ 'codex-id-substituted': 'unknown codex id — substituted',
39
+ 'spec-unrecognised': 'unrecognised spec — session-inherited',
40
+ // dispatch-level (11-20): what the runtime or current fallback selection did.
41
+ 'coder-fallback': 'coder fallback ladder',
42
+ 'codex-unsupported-at-dispatch': 'codex unsupported at this dispatch — Claude',
43
+ 'fallback-after-no-deliverable': 'fallback — the previous rung delivered nothing',
44
+ 'precision-second-pass': 'independent precision second pass',
45
+ 'auto-cost': 'learned-cost routing',
46
+ 'qe-same-family-degraded': 'same-family QE — cross-family review NOT obtained',
47
+ 'challenge-panel': 'adversarial plan-gate panel',
48
+ 'codex-probe-failed': 'codex probe found no usable id — Claude',
49
+ 'codex-refused-before-dispatch': 'codex refused before dispatching — nothing ran',
50
+ 'fallback-rung': 'fallback rung (prior outcome reported separately)',
51
+ };
52
+ /** Stages that write an artifact FILE out of band when they resolve to Codex, and therefore wait on
53
+ * the Codex-landed barrier before their consumer runs. Naming it in the line tells the reader why
54
+ * the run is about to sit still.
55
+ *
56
+ * The four DESIGN stages belong here too (R4-F5, cross-family review round 3): `designStage` runs an
57
+ * out-of-band artifact probe for any codex-resolved design stage, exactly as code and plan do, so a
58
+ * roster of only {code, plan} left the line silent about a barrier that was actually engaged. QE is
59
+ * deliberately absent — its codex path is a synchronous `codex exec`, not the wrapper — and so is
60
+ * delivery, whose planes never run on codex at all. */
61
+ export const STAGE_LINE_BARRIER_STAGES = {
62
+ code: 1,
63
+ plan: 1,
64
+ requirements: 1,
65
+ adr: 1,
66
+ ideation: 1,
67
+ architecture: 1,
68
+ };
69
+ /**
70
+ * One deterministic line: `▸ <stage> · <model or "session"> · <branch signature>`, plus
71
+ * ` · landed barrier` when this stage resolved to Codex AND uses the barrier.
72
+ *
73
+ * PURE: reads nothing, prints nothing, and depends on no state beyond its two arguments (AC-3).
74
+ */
75
+ function renderStagePrefix(stage, decision) {
76
+ let model = 'session';
77
+ if (decision && decision.spec)
78
+ model = decision.spec;
79
+ return '▸ ' + stage + ' · ' + model;
80
+ }
81
+ /** Timely statement of what the workflow is about to try. It is explicitly not proof of dispatch. */
82
+ export function renderStageIntentLine(stage, decision) {
83
+ let signature = '';
84
+ if (decision) {
85
+ const labelled = STAGE_LINE_REASON_LABELS[decision.reason];
86
+ if (labelled)
87
+ signature = labelled;
88
+ }
89
+ // An unlabelled reason must be VISIBLE, never silently blank: print the raw token so the hole is
90
+ // reportable from a real run instead of reading as "no reason at all".
91
+ if (!signature) {
92
+ signature = 'unlabelled branch';
93
+ if (decision && decision.reason)
94
+ signature = 'unlabelled branch: ' + decision.reason;
95
+ }
96
+ let line = renderStagePrefix(stage, decision) + ' · ' + signature;
97
+ if (STAGE_LINE_BARRIER_STAGES[stage] && decision && decision.opts && decision.opts.agentType === 'codex:codex-rescue') {
98
+ line = line + ' · landed barrier';
99
+ }
100
+ return line + ' · intent';
101
+ }
102
+ /**
103
+ * Final fact for one rung. It deliberately ignores the selection reason: the outcome owns only
104
+ * this rung's state and refusal detail, so another rung's reason cannot leak into it.
105
+ */
106
+ export function renderStageOutcomeLine(stage, decision, outcome) {
107
+ let model = 'session';
108
+ if (decision && decision.spec)
109
+ model = decision.spec;
110
+ let label = 'dispatched';
111
+ if (outcome && outcome.state === 'probe-failed')
112
+ label = 'probe found no usable model';
113
+ else if (outcome && outcome.state === 'refused-before-dispatch')
114
+ label = 'refused before dispatch';
115
+ let line = '◆ ' + stage + ' · ' + model + ' · outcome: ' + label;
116
+ if (outcome && outcome.state === 'refused-before-dispatch' && outcome.reason === 'codex-unsupported-at-dispatch') {
117
+ line = line + ' · codex agent type unsupported';
118
+ }
119
+ else if (outcome && outcome.state === 'refused-before-dispatch' && outcome.reason) {
120
+ line = line + ' · reason: ' + outcome.reason;
121
+ }
122
+ return line;
123
+ }
124
+ /** One-release compatibility alias: the historical renderer is now explicitly the intent half. */
125
+ export function renderStageLine(stage, decision) {
126
+ const intent = renderStageIntentLine(stage, decision);
127
+ return intent.slice(0, intent.length - ' · intent'.length);
128
+ }
129
+ //# sourceMappingURL=stage-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage-line.js","sourceRoot":"","sources":["../src/stage-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAqB/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,gBAAgB,EAAE,wCAAwC;IAC1D,iBAAiB,EAAE,sBAAsB;IACzC,uB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IAAI,GAAG,iCAAiC,CAAC;IAClD,CAAC;SAAM,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,yBAAyB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpF,IAAI,GAAG,IAAI,GAAG,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAA2B;IACxE,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC"}
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * @packageDocumentation
15
15
  */
16
+ import { type StoreHealthVerdict } from './store-guard.js';
16
17
  /**
17
18
  * Live learning state for one in-flight `/feature-adr` run — the per-run visibility panel
18
19
  * that surfaces the Pattern memory loop (POOL learned, RECALLED for this run, STORED this run).
@@ -36,13 +37,31 @@ export interface FeatureAdrState {
36
37
  readonly reinforced?: number;
37
38
  /** ISO timestamp of the write — drives the freshness window on the render path. */
38
39
  readonly ts: string;
40
+ /** Identity of one pipeline invocation. The monotonic guard never crosses two distinct runs. */
41
+ readonly runId?: string;
39
42
  /** Optional run mode (e.g. "reference", "full-qe", "full-qe-extended"). */
40
43
  readonly mode?: string;
44
+ /** Complexity tier of the run (S/M/L/XL) — drives done/total on the phase line. Carried forward
45
+ * by the write path when a later record omits it. */
46
+ readonly tier?: string;
47
+ /** ISO timestamp of the CURRENT phase's start — reset by the write path when the step label
48
+ * changes, carried forward while it stays the same. Drives the phase line's elapsed minutes. */
49
+ readonly phaseStartTs?: string;
41
50
  }
42
51
  /** A snapshot of dz's self-learning state for one project (all fields best-effort). */
43
52
  export interface StatuslineData {
44
53
  /** Count of learned patterns in the project's unified memory store. */
45
54
  readonly patterns: number;
55
+ /** Exact lexical-tier availability split; omitted when the enhanced readonly count cannot be established. */
56
+ readonly patternBreakdown?: {
57
+ readonly source: 'lexical';
58
+ readonly active: number;
59
+ readonly quarantined: number;
60
+ /** True once quarantine contains at least one third of the lexical pool. */
61
+ readonly attention: boolean;
62
+ /** Absolute lexical/vector quarantine-label delta, present only above the tolerated drift threshold. */
63
+ readonly tierDelta?: number;
64
+ };
46
65
  /** Count of learned patterns that the live recall hook has actually injected at least once. */
47
66
  readonly usedPatterns?: number;
48
67
  /** Number of sources registered in the durable cross-project knowledge brain. */
@@ -51,6 +70,18 @@ export interface StatuslineData {
51
70
  readonly consolidatedAgeH?: number;
52
71
  /** Live `/feature-adr` learning state — present ONLY when a fresh run is in flight. */
53
72
  readonly featureAdr?: FeatureAdrState;
73
+ /** Persistent owner-facing store warning; healthy/no-mark/error paths omit it. */
74
+ readonly storeHealth?: StatuslineStoreHealth;
75
+ }
76
+ /** Render-ready details for a non-healthy store verdict. */
77
+ export interface StatuslineStoreHealth {
78
+ readonly verdict: Exclude<StoreHealthVerdict, 'ok' | 'no-mark'>;
79
+ /** Previous maximum for the affected store tier. */
80
+ readonly previousMax?: number;
81
+ /** Snapshot directory used by cold-start recovery guidance. */
82
+ readonly snapshotPath?: string;
83
+ /** Basenames of store files whose readonly count failed. */
84
+ readonly unreadableFiles?: readonly string[];
54
85
  }
55
86
  /** Directory of the per-slug live `/feature-adr` learning-state slots. */
56
87
  export declare function featureAdrStateDir(projectRoot: string): string;
@@ -82,6 +113,44 @@ export interface WriteFeatureAdrStateInput {
82
113
  readonly stored: number;
83
114
  readonly reinforced?: number;
84
115
  readonly mode?: string;
116
+ /** Identity of one pipeline invocation. Empty strings are not identities. */
117
+ readonly runId?: string;
118
+ /** Complexity tier (S/M/L/XL). Invalid/absent → the previous slot's tier is carried forward. */
119
+ readonly tier?: string;
120
+ /**
121
+ * TEST-ONLY seam (ADR-002 C2 RED half): run the slot transaction WITHOUT the
122
+ * `fa-phase-slot` named lock, so `statusline-phase-lock.test.ts` can reproduce the lost update
123
+ * the lock prevents. Never set by any shipped caller — `statusline-phase-lock.test.ts` asserts
124
+ * `grep -c _unsafeSkipLock` on the CLI source is 0, so this cannot be reached from `dz`.
125
+ */
126
+ readonly _unsafeSkipLock?: boolean;
127
+ /**
128
+ * TEST-ONLY seam, the twin of `_unsafeSkipLock`: busy-hold this many ms INSIDE the transition,
129
+ * between reading the previous slot and writing the new one. Without it the read-modify-write
130
+ * window is sub-millisecond and the RED half would be reproducing a race by LUCK — a flaky test
131
+ * is not a proof. With it the interleaving is deterministic in both halves: unlocked, two writers
132
+ * provably observe the same previous slot; locked, they provably do not. Never set by any shipped
133
+ * caller (same grep assertion as `_unsafeSkipLock`).
134
+ */
135
+ readonly _unsafeHoldMs?: number;
136
+ /**
137
+ * TEST-ONLY seam: fail after phase telemetry has been appended but before the slot is written.
138
+ * This makes the partial-write receipt deterministic without fabricating a phase row from a
139
+ * missing previous slot. Never set by a shipped caller.
140
+ */
141
+ readonly _unsafeFailSlotWrite?: boolean;
142
+ }
143
+ /**
144
+ * The outcome of a slot write. `state` is the slot as written; `refused` is a SHORT machine-ish
145
+ * reason when the operation did not complete. `refusedEffect` says whether no disk effect is known
146
+ * (`none`, callback never began) or a partial effect is possible (`unknown`, callback began).
147
+ * Exactly one of `state` and `refused` is present. The CLI prints `refused` on stderr.
148
+ */
149
+ export interface WriteFeatureAdrStateResult {
150
+ readonly state?: FeatureAdrState;
151
+ readonly refused?: string;
152
+ /** Known disk effect of a refusal: `none` before the transaction, `unknown` once it began. */
153
+ readonly refusedEffect?: 'none' | 'unknown';
85
154
  }
86
155
  /**
87
156
  * Record the live `/feature-adr` learning state — called by the pipeline at Steps 0/8/9. Computes
@@ -92,6 +161,13 @@ export interface WriteFeatureAdrStateInput {
92
161
  * @param now Injectable clock (epoch ms) for the write timestamp — defaults to `Date.now()`.
93
162
  */
94
163
  export declare function writeFeatureAdrState(projectRoot: string, input: WriteFeatureAdrStateInput, now?: number): FeatureAdrState | undefined;
164
+ /**
165
+ * The same write as {@link writeFeatureAdrState}, but it SAYS WHY it did not complete and what is
166
+ * known about its disk effect. A refusal before the transition returns `refusedEffect:'none'`; once
167
+ * the callback begins, a refusal returns `refusedEffect:'unknown'` because an append or slot write
168
+ * may already have landed. The pipeline still never breaks — the caller decides, this never throws.
169
+ */
170
+ export declare function writeFeatureAdrStateDetailed(projectRoot: string, input: WriteFeatureAdrStateInput, now?: number): WriteFeatureAdrStateResult;
95
171
  /**
96
172
  * Gather dz's self-learning counts for one project. FAST + best-effort: every read
97
173
  * is guarded so a missing/corrupt `.dz`, absent native module, or locked store
@@ -101,4 +177,27 @@ export declare function writeFeatureAdrState(projectRoot: string, input: WriteFe
101
177
  * @param now Injectable clock (epoch ms) for the consolidation age — defaults to `Date.now()`.
102
178
  */
103
179
  export declare function statuslineData(projectRoot: string, now?: number): StatuslineData;
180
+ /**
181
+ * Render the /feature-adr PHASE line (line format B, fa-phase-statusline ADR-001) — the second
182
+ * status-bar line:
183
+ *
184
+ * `📐 <slug> [<tier>] <done>/<total> ▶ <step label> · <N>м/—`
185
+ *
186
+ * States, in precedence order:
187
+ * - `undefined` (no line): a loop slot, the terminal label `done`, or ≥90 min of slot silence;
188
+ * - `⚠ <N>м без отчёта` from 30 min of slot silence (counted from the last report `ts`);
189
+ * - a label starting `⛔` or `⏸` replaces the `▶ <label>` portion VERBATIM (failure/waiting states
190
+ * are reported by the pipeline through the label itself, never synthesised here);
191
+ * - otherwise `▶ <label>` with elapsed minutes counted from the PHASE start (`phaseStartTs`).
192
+ *
193
+ * done/total is the label's step-number position in its tier's active-step list; an unknown tier,
194
+ * an unparseable label, or a number outside the list renders `?/?` — the panel never guesses.
195
+ * The estimate slot is fixed-width at the tail: v1 defers estimates entirely, so it is always `/—`
196
+ * (a future median would be computed on the WRITE path and stored in the slot as a ready number —
197
+ * this render path stays a pure function over the slot, no DB, no subprocess, no features/* sweep).
198
+ *
199
+ * @param state A fresh slot from {@link readFeatureAdrState} (the ONLY source of "in progress").
200
+ * @param now Injectable clock (epoch ms) — defaults to `Date.now()`.
201
+ */
202
+ export declare function renderFeatureAdrPhaseLine(state: FeatureAdrState, now?: number): string | undefined;
104
203
  //# sourceMappingURL=statusline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"statusline.d.ts","sourceRoot":"","sources":["../src/statusline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,gGAAgG;IAChG,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;IACvC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,uFAAuF;IACvF,QAAQ,CAAC,UAAU,CAAC,EAAE,eA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