@telora/daemon 0.23.32 → 0.23.47

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 (200) hide show
  1. package/build-info.json +4 -3
  2. package/dist/completion/completion-event/event.d.ts +12 -0
  3. package/dist/completion/completion-event/event.d.ts.map +1 -1
  4. package/dist/completion/completion-event/event.js +1 -0
  5. package/dist/completion/completion-event/event.js.map +1 -1
  6. package/dist/completion/completion-event/unfinished-work.d.ts +134 -0
  7. package/dist/completion/completion-event/unfinished-work.d.ts.map +1 -0
  8. package/dist/completion/completion-event/unfinished-work.js +140 -0
  9. package/dist/completion/completion-event/unfinished-work.js.map +1 -0
  10. package/dist/completion/team-outcome/apply-turn.d.ts.map +1 -1
  11. package/dist/completion/team-outcome/apply-turn.js +18 -0
  12. package/dist/completion/team-outcome/apply-turn.js.map +1 -1
  13. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts +16 -0
  14. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts.map +1 -1
  15. package/dist/completion/team-outcome/decide-turn-entry-rows.js +75 -11
  16. package/dist/completion/team-outcome/decide-turn-entry-rows.js.map +1 -1
  17. package/dist/completion/team-outcome/decide-turn-work-rows.d.ts.map +1 -1
  18. package/dist/completion/team-outcome/decide-turn-work-rows.js +10 -1
  19. package/dist/completion/team-outcome/decide-turn-work-rows.js.map +1 -1
  20. package/dist/completion/team-outcome/decide.d.ts.map +1 -1
  21. package/dist/completion/team-outcome/decide.js +1 -0
  22. package/dist/completion/team-outcome/decide.js.map +1 -1
  23. package/dist/completion/team-outcome/exit-action-roles.d.ts.map +1 -1
  24. package/dist/completion/team-outcome/exit-action-roles.js +2 -0
  25. package/dist/completion/team-outcome/exit-action-roles.js.map +1 -1
  26. package/dist/completion/team-outcome/exit-actions.d.ts +4 -0
  27. package/dist/completion/team-outcome/exit-actions.d.ts.map +1 -1
  28. package/dist/completion/team-outcome/exit-limits.d.ts +8 -0
  29. package/dist/completion/team-outcome/exit-limits.d.ts.map +1 -1
  30. package/dist/completion/team-outcome/exit-limits.js +9 -0
  31. package/dist/completion/team-outcome/exit-limits.js.map +1 -1
  32. package/dist/completion/team-outcome/exit-pipeline-state.d.ts +7 -0
  33. package/dist/completion/team-outcome/exit-pipeline-state.d.ts.map +1 -1
  34. package/dist/completion/team-outcome/exit-pipeline-state.js +1 -0
  35. package/dist/completion/team-outcome/exit-pipeline-state.js.map +1 -1
  36. package/dist/completion/team-outcome/team-outcome.d.ts.map +1 -1
  37. package/dist/completion/team-outcome/team-outcome.js +2 -1
  38. package/dist/completion/team-outcome/team-outcome.js.map +1 -1
  39. package/dist/completion/team-teardown/session-hold-bounds.d.ts +13 -1
  40. package/dist/completion/team-teardown/session-hold-bounds.d.ts.map +1 -1
  41. package/dist/completion/team-teardown/session-hold-bounds.js +15 -0
  42. package/dist/completion/team-teardown/session-hold-bounds.js.map +1 -1
  43. package/dist/completion/team-teardown/session-hold.d.ts.map +1 -1
  44. package/dist/completion/team-teardown/session-hold.js +4 -0
  45. package/dist/completion/team-teardown/session-hold.js.map +1 -1
  46. package/dist/composition/completion-event-context.d.ts.map +1 -1
  47. package/dist/composition/completion-event-context.js +8 -0
  48. package/dist/composition/completion-event-context.js.map +1 -1
  49. package/dist/composition/daemon-contexts.js +1 -1
  50. package/dist/composition/focus-activity-live-sources.d.ts.map +1 -1
  51. package/dist/composition/focus-activity-live-sources.js +1 -0
  52. package/dist/composition/focus-activity-live-sources.js.map +1 -1
  53. package/dist/composition/runtime-heartbeat-context.d.ts.map +1 -1
  54. package/dist/composition/runtime-heartbeat-context.js +6 -3
  55. package/dist/composition/runtime-heartbeat-context.js.map +1 -1
  56. package/dist/composition/runtime-poll-context.d.ts +32 -4
  57. package/dist/composition/runtime-poll-context.d.ts.map +1 -1
  58. package/dist/composition/runtime-poll-context.js +61 -5
  59. package/dist/composition/runtime-poll-context.js.map +1 -1
  60. package/dist/composition/team-liveness-phase-sources.d.ts.map +1 -1
  61. package/dist/composition/team-liveness-phase-sources.js +1 -0
  62. package/dist/composition/team-liveness-phase-sources.js.map +1 -1
  63. package/dist/composition/verification-context.js +1 -1
  64. package/dist/composition/verify-rework-context.d.ts +12 -3
  65. package/dist/composition/verify-rework-context.d.ts.map +1 -1
  66. package/dist/composition/verify-rework-context.js +27 -10
  67. package/dist/composition/verify-rework-context.js.map +1 -1
  68. package/dist/config/live-daemon-config.js +1 -1
  69. package/dist/daemon-state/focus-team-state.js +1 -1
  70. package/dist/delivery/advance-hold.d.ts +25 -0
  71. package/dist/delivery/advance-hold.d.ts.map +1 -1
  72. package/dist/delivery/advance-hold.js +52 -1
  73. package/dist/delivery/advance-hold.js.map +1 -1
  74. package/dist/delivery/delivery-reconciler.d.ts +17 -2
  75. package/dist/delivery/delivery-reconciler.d.ts.map +1 -1
  76. package/dist/delivery/delivery-reconciler.js +54 -30
  77. package/dist/delivery/delivery-reconciler.js.map +1 -1
  78. package/dist/delivery/recorded-concerns.d.ts.map +1 -1
  79. package/dist/delivery/recorded-concerns.js +1 -0
  80. package/dist/delivery/recorded-concerns.js.map +1 -1
  81. package/dist/directive/directive-queue.d.ts +27 -0
  82. package/dist/directive/directive-queue.d.ts.map +1 -1
  83. package/dist/directive/directive-queue.js +36 -1
  84. package/dist/directive/directive-queue.js.map +1 -1
  85. package/dist/focus/daemon-contexts.js +1 -1
  86. package/dist/focus/failed-head-wedge.d.ts +42 -13
  87. package/dist/focus/failed-head-wedge.d.ts.map +1 -1
  88. package/dist/focus/failed-head-wedge.js +45 -10
  89. package/dist/focus/failed-head-wedge.js.map +1 -1
  90. package/dist/focus/focus-poller-spawn.js +1 -1
  91. package/dist/focus/focus-poller-state.js +1 -1
  92. package/dist/focus/heartbeat-metadata.d.ts +24 -0
  93. package/dist/focus/heartbeat-metadata.d.ts.map +1 -1
  94. package/dist/focus/heartbeat-metadata.js +31 -1
  95. package/dist/focus/heartbeat-metadata.js.map +1 -1
  96. package/dist/focus/heartbeat.d.ts.map +1 -1
  97. package/dist/focus/heartbeat.js +7 -1
  98. package/dist/focus/heartbeat.js.map +1 -1
  99. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -1
  100. package/dist/focus/pending-spawn-review-next-step.js +9 -1
  101. package/dist/focus/pending-spawn-review-next-step.js.map +1 -1
  102. package/dist/focus/uncommitted-work-backstop.d.ts +115 -0
  103. package/dist/focus/uncommitted-work-backstop.d.ts.map +1 -0
  104. package/dist/focus/uncommitted-work-backstop.js +259 -0
  105. package/dist/focus/uncommitted-work-backstop.js.map +1 -0
  106. package/dist/focus/verify-routing-passes.d.ts +5 -1
  107. package/dist/focus/verify-routing-passes.d.ts.map +1 -1
  108. package/dist/focus/verify-routing-passes.js +1 -0
  109. package/dist/focus/verify-routing-passes.js.map +1 -1
  110. package/dist/git/index.d.ts.map +1 -1
  111. package/dist/git/index.js +2 -1
  112. package/dist/git/index.js.map +1 -1
  113. package/dist/git/review-window-commits.d.ts.map +1 -1
  114. package/dist/git/review-window-commits.js +1 -0
  115. package/dist/git/review-window-commits.js.map +1 -1
  116. package/dist/git/types.d.ts.map +1 -1
  117. package/dist/git/types.js +1 -20
  118. package/dist/git/types.js.map +1 -1
  119. package/dist/prompt-sections/qa-author-section.d.ts +7 -3
  120. package/dist/prompt-sections/qa-author-section.d.ts.map +1 -1
  121. package/dist/prompt-sections/qa-author-section.js +52 -15
  122. package/dist/prompt-sections/qa-author-section.js.map +1 -1
  123. package/dist/qa/qa-author-faithfulness.d.ts +86 -14
  124. package/dist/qa/qa-author-faithfulness.d.ts.map +1 -1
  125. package/dist/qa/qa-author-faithfulness.js +213 -47
  126. package/dist/qa/qa-author-faithfulness.js.map +1 -1
  127. package/dist/qa/qa-author-output.d.ts +6 -3
  128. package/dist/qa/qa-author-output.d.ts.map +1 -1
  129. package/dist/qa/qa-author-output.js.map +1 -1
  130. package/dist/qa/qa-author-pass.d.ts +8 -5
  131. package/dist/qa/qa-author-pass.d.ts.map +1 -1
  132. package/dist/qa/qa-author-pass.js +4 -3
  133. package/dist/qa/qa-author-pass.js.map +1 -1
  134. package/dist/qa/qa-author-runner.d.ts.map +1 -1
  135. package/dist/qa/qa-author-runner.js +15 -10
  136. package/dist/qa/qa-author-runner.js.map +1 -1
  137. package/dist/queries/deliveries/deliveries.d.ts.map +1 -1
  138. package/dist/queries/deliveries/deliveries.js +1 -20
  139. package/dist/queries/deliveries/deliveries.js.map +1 -1
  140. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts +8 -3
  141. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts.map +1 -1
  142. package/dist/queries/delivery-gate-state/delivery-gate-state.js +1 -1
  143. package/dist/queries/escalations/escalations.d.ts.map +1 -1
  144. package/dist/queries/escalations/escalations.js +1 -0
  145. package/dist/queries/escalations/escalations.js.map +1 -1
  146. package/dist/queries/qa-packets/qa-packets.d.ts +74 -1
  147. package/dist/queries/qa-packets/qa-packets.d.ts.map +1 -1
  148. package/dist/queries/qa-packets/qa-packets.js +28 -2
  149. package/dist/queries/qa-packets/qa-packets.js.map +1 -1
  150. package/dist/queries/sessions/daemon-connection.d.ts.map +1 -1
  151. package/dist/queries/sessions/daemon-connection.js +1 -0
  152. package/dist/queries/sessions/daemon-connection.js.map +1 -1
  153. package/dist/supervision/escalation-filing.js +1 -1
  154. package/dist/supervision/spawn-cooldown.js +1 -1
  155. package/dist/supervision/stop-registry.d.ts +5 -0
  156. package/dist/supervision/stop-registry.d.ts.map +1 -1
  157. package/dist/supervision/stop-rows-team-session.d.ts +6 -1
  158. package/dist/supervision/stop-rows-team-session.d.ts.map +1 -1
  159. package/dist/supervision/stop-rows-team-session.js +34 -1
  160. package/dist/supervision/stop-rows-team-session.js.map +1 -1
  161. package/dist/supervision/team-work.d.ts.map +1 -1
  162. package/dist/supervision/team-work.js +1 -0
  163. package/dist/supervision/team-work.js.map +1 -1
  164. package/dist/testing/fixtures/approved-head-inert-deps.js +1 -1
  165. package/dist/testing/fixtures/approved-head-inert-deps.js.map +1 -1
  166. package/dist/testing/fixtures/completion-event-deps.d.ts +2 -1
  167. package/dist/testing/fixtures/completion-event-deps.d.ts.map +1 -1
  168. package/dist/testing/fixtures/completion-event-deps.js +5 -1
  169. package/dist/testing/fixtures/completion-event-deps.js.map +1 -1
  170. package/dist/testing/fixtures/index.js +1 -1
  171. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -1
  172. package/dist/testing/fixtures/pending-spawn-world.js +2 -1
  173. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  174. package/dist/testing/fixtures/review-exit-deps.js +2 -2
  175. package/dist/testing/fixtures/review-exit-deps.js.map +1 -1
  176. package/dist/types/index.js +1 -1
  177. package/dist/types/qa-packet.d.ts +15 -4
  178. package/dist/types/qa-packet.d.ts.map +1 -1
  179. package/dist/types/qa-packet.js +18 -4
  180. package/dist/types/qa-packet.js.map +1 -1
  181. package/dist/verify/attribution/rework-attribution.d.ts +50 -111
  182. package/dist/verify/attribution/rework-attribution.d.ts.map +1 -1
  183. package/dist/verify/attribution/rework-attribution.js +215 -71
  184. package/dist/verify/attribution/rework-attribution.js.map +1 -1
  185. package/dist/verify/gate-verdicts/commit-verdict-record.d.ts +9 -0
  186. package/dist/verify/gate-verdicts/commit-verdict-record.d.ts.map +1 -1
  187. package/dist/verify/gate-verdicts/commit-verdict-record.js +27 -1
  188. package/dist/verify/gate-verdicts/commit-verdict-record.js.map +1 -1
  189. package/dist/verify/gate-verdicts/judged-ancestor.d.ts.map +1 -1
  190. package/dist/verify/gate-verdicts/judged-ancestor.js +2 -1
  191. package/dist/verify/gate-verdicts/judged-ancestor.js.map +1 -1
  192. package/dist/verify/outcome-routing/gate-rework-reopen.d.ts +30 -0
  193. package/dist/verify/outcome-routing/gate-rework-reopen.d.ts.map +1 -0
  194. package/dist/verify/outcome-routing/gate-rework-reopen.js +37 -0
  195. package/dist/verify/outcome-routing/gate-rework-reopen.js.map +1 -0
  196. package/dist/verify/outcome-routing/verification-rework-issue.d.ts +114 -25
  197. package/dist/verify/outcome-routing/verification-rework-issue.d.ts.map +1 -1
  198. package/dist/verify/outcome-routing/verification-rework-issue.js +147 -88
  199. package/dist/verify/outcome-routing/verification-rework-issue.js.map +1 -1
  200. package/package.json +3 -3
@@ -7,8 +7,12 @@
7
7
  * product's QA target, so the prompt asks for UI-facing cases only, each tied
8
8
  * to one acceptance criterion quoted verbatim, with a path relative to the QA
9
9
  * target's base URL -- or an explicit no-UI-surface marker. On a re-entry after
10
- * a QA fail it lists the cases the human failed and REQUIRES a retest case for
11
- * each one whose criterion still applies. Both rules are checked
10
+ * a QA fail it lists EVERY case of the previous packet with the result a
11
+ * person recorded for it (failed, passed, not run) and REQUIRES, for each one
12
+ * whose criterion still applies, a case that quotes that criterion and names
13
+ * the previous case with priorCaseId. The author names the case and nothing
14
+ * more: what the carried case is (a retest, previously passed, needs a run) is
15
+ * marked from the recorded result. Both rules are checked
12
16
  * (qa/qa-author-faithfulness.ts, and the edge on the write); an answer that
13
17
  * breaks them is re-asked ONCE with buildQaAuthorCorrection appended -- the
14
18
  * same text whatever engine runs it.
@@ -20,7 +24,7 @@
20
24
  * (one fenced json block, last in the answer) is parsed by
21
25
  * qa/qa-author-output.ts.
22
26
  */
23
- import type { QaPacketCandidate } from '../queries/qa-packets/qa-packets.js';
27
+ import { type QaPacketCandidate } from '../queries/qa-packets/qa-packets.js';
24
28
  import { type QaAuthorMode } from '../types/qa-packet.js';
25
29
  /** The system prompt every QA-author call runs under (a resumed session may keep its recorded one). */
26
30
  export declare const QA_AUTHOR_SYSTEM_PROMPT: string;
@@ -1 +1 @@
1
- {"version":3,"file":"qa-author-section.d.ts","sourceRoot":"","sources":["../../src/prompt-sections/qa-author-section.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1E,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,QAGU,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,8CAA8C,CAAC;AAE7E,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AA4ID,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,wCAAwC,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAS7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,oBAAoB,GAAG,IAAW,GACxC,MAAM,CAkBR"}
1
+ {"version":3,"file":"qa-author-section.d.ts","sourceRoot":"","sources":["../../src/prompt-sections/qa-author-section.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAkC,KAAK,YAAY,EAAqB,MAAM,uBAAuB,CAAC;AAE7G,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,QAGU,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,8CAA8C,CAAC;AAE7E,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAsJD,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,wCAAwC,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAU7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,oBAAoB,GAAG,IAAW,GACxC,MAAM,CAkBR"}
@@ -2,7 +2,34 @@
2
2
  // Pinned by: packages/daemon/src/prompt-sections/qa-author-section.test.ts,
3
3
  // packages/daemon/src/qa/qa-author-unfaithful-answer.test.ts
4
4
  // PINNED-BY-END
5
- import { QA_AUTHOR_MODE } from '../types/qa-packet.js';
5
+ /**
6
+ * The QA-author prompt: what the pass that writes a focus's UI test packet is
7
+ * told, once its team has finished and the focus waits in its product's QA
8
+ * queue (qa/qa-author-pass.ts runs it).
9
+ *
10
+ * The packet is for a HUMAN who runs it by hand in a browser against the
11
+ * product's QA target, so the prompt asks for UI-facing cases only, each tied
12
+ * to one acceptance criterion quoted verbatim, with a path relative to the QA
13
+ * target's base URL -- or an explicit no-UI-surface marker. On a re-entry after
14
+ * a QA fail it lists EVERY case of the previous packet with the result a
15
+ * person recorded for it (failed, passed, not run) and REQUIRES, for each one
16
+ * whose criterion still applies, a case that quotes that criterion and names
17
+ * the previous case with priorCaseId. The author names the case and nothing
18
+ * more: what the carried case is (a retest, previously passed, needs a run) is
19
+ * marked from the recorded result. Both rules are checked
20
+ * (qa/qa-author-faithfulness.ts, and the edge on the write); an answer that
21
+ * breaks them is re-asked ONCE with buildQaAuthorCorrection appended -- the
22
+ * same text whatever engine runs it.
23
+ *
24
+ * ONE text whatever runs it: the prompt takes no engine, so the two modes
25
+ * differ only in what the model is told it already knows -- resumed (it holds
26
+ * the coding session that built the focus) or fresh (it is handed the delivery
27
+ * summaries, the commit log and the size-capped diff). The output contract
28
+ * (one fenced json block, last in the answer) is parsed by
29
+ * qa/qa-author-output.ts.
30
+ */
31
+ import { qaPreviousCases } from '../queries/qa-packets/qa-packets.js';
32
+ import { QA_AUTHOR_MODE, QA_CASE_RESULT } from '../types/qa-packet.js';
6
33
  /** The system prompt every QA-author call runs under (a resumed session may keep its recorded one). */
7
34
  export const QA_AUTHOR_SYSTEM_PROMPT = 'You write UI test packets: click-level test cases a person runs by hand in a web browser against a ' +
8
35
  'QA environment. You never edit files and never run a command that changes anything. You end every ' +
@@ -71,20 +98,29 @@ function criteriaLines(candidate) {
71
98
  }
72
99
  return lines;
73
100
  }
74
- function retestLines(candidate) {
75
- const failed = candidate.previousPacket?.failedCases ?? [];
76
- if (failed.length === 0)
101
+ /** The result a person recorded for a previous case, in the words the prompt lists it under. */
102
+ const PRIOR_RESULT_WORDS = {
103
+ [QA_CASE_RESULT.FAILED]: 'FAILED (re-test it)',
104
+ [QA_CASE_RESULT.PASSED]: 'passed',
105
+ [QA_CASE_RESULT.NOT_RUN]: 'not run',
106
+ };
107
+ /** On a re-entry: every case of the previous packet with its recorded result, and the duty to carry each forward. */
108
+ function previousCaseLines(candidate) {
109
+ const previous = qaPreviousCases(candidate);
110
+ if (previous.length === 0)
77
111
  return [];
78
112
  const lines = [
79
- '## Re-test: the previous QA cycle FAILED',
80
- 'A human failed these cases when they ran the previous packet. For each one whose criterion is still among the ' +
81
- 'criteria above, a case with `"retest": true` and `"retestOf": "<its id>"` that quotes THAT SAME criterion is ' +
82
- 'REQUIRED -- the packet is refused without it, and a retest quoting another criterion does not count. Drop one ' +
83
- 'only when its criterion is no longer listed above. While any of them still applies, the no-UI-surface marker is ' +
84
- 'refused too.',
113
+ '## Re-entry: the previous QA cycle FAILED -- carry its cases forward',
114
+ 'A person ran the previous packet and recorded a result for each case listed below. For EACH one whose criterion ' +
115
+ 'is still among the criteria above, a case that quotes THAT SAME criterion and names it with ' +
116
+ '`"priorCaseId": "<its id>"` is REQUIRED -- the packet is refused without it, and a case quoting another ' +
117
+ 'criterion does not count. You do NOT write the result or a retest flag: the packet is marked from the recorded ' +
118
+ 'results (failed -> retest, passed -> previously passed, not run -> needs a run). A case that carries a FAILED ' +
119
+ 'one must exercise what failed. Drop one only when its criterion is no longer listed above. While any of them ' +
120
+ 'still applies, the no-UI-surface marker is refused too.',
85
121
  ];
86
- for (const c of failed) {
87
- lines.push(`- \`${c.id}\` -- criterion: ${JSON.stringify(c.criterion)}; path \`${c.path}\`; ` +
122
+ for (const c of previous) {
123
+ lines.push(`- \`${c.id}\` -- ${PRIOR_RESULT_WORDS[c.result]} -- criterion: ${JSON.stringify(c.criterion)}; path \`${c.path}\`; ` +
88
124
  `steps: ${JSON.stringify(c.steps)}; expected: ${JSON.stringify(c.expected)}`);
89
125
  }
90
126
  return lines;
@@ -142,7 +178,7 @@ const OUTPUT_LINES = [
142
178
  '```json',
143
179
  '{"noUiSurface": true}',
144
180
  '```',
145
- 'Add `"retest": true, "retestOf": "<previous case id>"` only to a case that re-tests a previously failed one.',
181
+ 'Add `"priorCaseId": "<previous case id>"` only to a case that carries a case of the previous QA cycle forward.',
146
182
  ];
147
183
  /** The heading a corrective attempt's addition opens with. */
148
184
  export const QA_AUTHOR_CORRECTION_HEADING = '## YOUR PREVIOUS ANSWER WAS REFUSED';
@@ -158,7 +194,8 @@ export function buildQaAuthorCorrection(violations) {
158
194
  ...violations.map((v) => `- ${v}`),
159
195
  '',
160
196
  'Write the WHOLE packet again, following every rule above: copy each `criterion` exactly from the criteria ' +
161
- 'listed, and add every required retest case. End with exactly one fenced json block.',
197
+ 'listed, and carry forward every case of the previous QA cycle that still applies, naming it with ' +
198
+ '`priorCaseId`. End with exactly one fenced json block.',
162
199
  ].join('\n') + '\n';
163
200
  }
164
201
  /**
@@ -179,7 +216,7 @@ export function buildQaAuthorPrompt(candidate, mode, reviewedSha, fresh = null)
179
216
  intro,
180
217
  targetLines(candidate, reviewedSha),
181
218
  criteriaLines(candidate),
182
- retestLines(candidate),
219
+ previousCaseLines(candidate),
183
220
  knowledgeLines(candidate, mode, fresh),
184
221
  [...RULE_LINES],
185
222
  [...OUTPUT_LINES],
@@ -1 +1 @@
1
- {"version":3,"file":"qa-author-section.js","sourceRoot":"","sources":["../../src/prompt-sections/qa-author-section.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,4EAA4E;AAC5E,+DAA+D;AAC/D,gBAAgB;AA0BhB,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAE1E,uGAAuG;AACvG,MAAM,CAAC,MAAM,uBAAuB,GAClC,qGAAqG;IACrG,oGAAoG;IACpG,4CAA4C,CAAC;AAE/C,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,2CAA2C,CAAC;AAc7E,SAAS,QAAQ,CAAC,IAA+B,EAAE,IAAY;IAC7D,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,sEAAsE;AACtE,SAAS,kBAAkB,CAAC,QAAiB;IAC3C,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC1F,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAa,EAA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AAiB;QACjB,iCAAiC,SAAS,CAAC,SAAS,iEAAiE;YACnH,iHAAiH;YACjH,oBAAoB;KACvB,CAAC;IACF,IAAI,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC;IAClH,MAAM,QAAQ,GAAG;QACf,KAAK;QACL,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC;QACnC,aAAa,CAAC,SAAS,CAAC;QACxB,iBAAiB,CAAC,SAAS,CAAC;QAC5B,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC;QACtC,CAAC,GAAG,UAAU,CAAC;QACf,CAAC,GAAG,YAAY,CAAC;KAClB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAC/D,CAAC"}
@@ -2,8 +2,17 @@
2
2
  * Is a QA-author answer FAITHFUL to its focus? Every case quotes one of the
3
3
  * criteria the pass was shown (the focus's acceptance criteria, each
4
4
  * non-cancelled delivery's, each armed baseline criterion -- normalized, never
5
- * paraphrased), and on a re-entry after a QA fail every failed case whose
6
- * criterion still applies is re-tested (retest: true, retestOf: <its id>).
5
+ * paraphrased), and on a re-entry after a QA fail every case of the previous
6
+ * packet whose criterion still applies is carried forward: a case names it
7
+ * with priorCaseId and quotes the criterion it tested.
8
+ *
9
+ * What a carried case IS comes from the record, not from the answer:
10
+ * stampQaPriorResults marks it from the result a person recorded for the case
11
+ * it carries (failed: a retest, with retest: true and retestOf; passed:
12
+ * previously passed; not run: needs a run), and removes a mark the model wrote
13
+ * that the record does not bear out. judgeQaAnswer stamps an answer once and
14
+ * checks the stamped cases, so the cases the pass writes are the cases that
15
+ * were judged.
7
16
  *
8
17
  * The daemon runs this BEFORE it asks for the ready write, so an unfaithful
9
18
  * answer can be re-asked (qa-author-runner.ts) instead of only refused. The
@@ -11,27 +20,52 @@
11
20
  * src/lib/qa/qa-packet.ts (mirrored to supabase/functions/_shared), which
12
21
  * daemon_qa_packet_write applies before a ready or no_ui_surface write. The
13
22
  * daemon cannot import src/lib, so this is its own copy; qa-author-
14
- * faithfulness.test.ts runs the SAME conformance table
23
+ * faithfulness.test.ts runs the SAME conformance tables
15
24
  * (src/lib/qa/__fixtures__/qa-faithfulness-cases.json) the canonical vitest
16
25
  * runs, so the two cannot drift.
17
26
  */
18
- import type { QaPacketCandidate } from '../queries/qa-packets/qa-packets.js';
27
+ import { type QaPacketCandidate } from '../queries/qa-packets/qa-packets.js';
28
+ import { type QaCaseResult } from '../types/qa-packet.js';
19
29
  /** What the rule reads of one case. */
20
30
  export interface QaFaithfulnessCase {
21
31
  id: string;
22
32
  criterion: string;
23
33
  retest?: boolean;
24
34
  retestOf?: string;
35
+ priorCaseId?: string;
36
+ }
37
+ /** A case of the previous QA cycle with the result a person recorded for it. */
38
+ export interface QaPreviousCase {
39
+ id: string;
40
+ criterion: string;
41
+ result: QaCaseResult;
42
+ }
43
+ /**
44
+ * The fields stamping reads and rewrites on a case. Loosely typed: the cases
45
+ * of a model's answer are still untyped JSON; every other field of the case is
46
+ * carried through untouched.
47
+ */
48
+ export interface QaStampableCase {
49
+ priorCaseId?: unknown;
50
+ priorResult?: unknown;
51
+ retest?: unknown;
52
+ retestOf?: unknown;
25
53
  }
26
54
  /** What the rule reads of a packet and its focus. */
27
55
  export interface QaPacketFaithfulnessInput {
28
- /** The packet's cases ([] for a no-UI-surface packet). */
56
+ /** The packet's cases as they will be written -- after stampQaPriorResults ([] for a no-UI-surface packet). */
29
57
  cases: readonly QaFaithfulnessCase[];
30
58
  noUiSurface: boolean;
31
59
  /** The quotable criteria (qaCriteriaFromTexts); normalized again here. */
32
60
  criteria: readonly string[];
33
- /** The cases a human failed in the previous QA cycle ([] when it did not fail). */
34
- previousFailedCases: ReadonlyArray<Pick<QaFaithfulnessCase, 'id' | 'criterion'>>;
61
+ /** The previous QA cycle's cases, each with the result a person recorded ([] when that cycle did not fail). */
62
+ previousCases: readonly QaPreviousCase[];
63
+ /**
64
+ * True when the writer was told to carry EVERY previous case forward; false
65
+ * holds it to the failed cases only (the edge reads a write that does not
66
+ * say so that way).
67
+ */
68
+ carriesPriorResults: boolean;
35
69
  }
36
70
  /**
37
71
  * The one normalization both sides of a criterion comparison get. Pure and
@@ -44,21 +78,59 @@ export declare function normalizeQaCriterion(text: string): string;
44
78
  export declare function qaCriteriaFromTexts(texts: ReadonlyArray<string | null | undefined>): string[];
45
79
  /** The criterion strings of an armed_baseline_criteria array; anything else yields none. Pure. */
46
80
  export declare function qaArmedBaselineCriterionTexts(value: unknown): string[];
81
+ /**
82
+ * Mark each case that carries a previous case forward, from the result a
83
+ * person RECORDED for that case -- never from what the writer claimed. Pure:
84
+ * returns new objects and leaves its input untouched.
85
+ *
86
+ * A case names the previous case it carries with priorCaseId (or with retestOf
87
+ * alone). It names a previous case: priorCaseId and priorResult are set from
88
+ * the record; a recorded failure also sets retest: true and retestOf, and any
89
+ * other result REMOVES both. It names none: a priorResult the writer supplied
90
+ * is removed and the case is otherwise left alone. It names a case the
91
+ * previous cycle did not have: priorResult is removed and the rest stays as
92
+ * written, for checkQaPacketFaithful to report.
93
+ */
94
+ export declare function stampQaPriorResults<C extends QaStampableCase>(cases: readonly C[], previousCases: readonly QaPreviousCase[]): C[];
47
95
  /**
48
96
  * Is the packet faithful? Pure. One human-readable line per violation; [] is
49
97
  * faithful. Rules: (1) every criterion is one of `criteria`; (2) every
50
- * previously failed case whose criterion still applies is re-tested by a case
51
- * quoting that same criterion; (3) a retest case carries both flag and
98
+ * previously FAILED case whose criterion still applies is re-tested by a case
99
+ * (retest: true, retestOf: its id) quoting that same criterion, whatever
100
+ * `carriesPriorResults` says; (3) a retest case carries both flag and
52
101
  * retestOf, naming a failed case, and quotes the criterion that case tested;
53
- * (4) no UI surface while a retest is owed is refused.
102
+ * (4) no UI surface is refused while a retest is owed -- and, when
103
+ * `carriesPriorResults`, while ANY previous case still applies; (5) a case
104
+ * naming a priorCaseId names a case of the previous cycle, quotes the
105
+ * criterion it tested, and names the same case in any retestOf; (6) ONLY when
106
+ * `carriesPriorResults`: every previous case that passed or was not run, and
107
+ * whose criterion still applies, is carried forward by a case whose
108
+ * priorCaseId is its id, quoting that same criterion.
54
109
  */
55
110
  export declare function checkQaPacketFaithful(input: QaPacketFaithfulnessInput): string[];
111
+ /** What the rule and the stamp read of a candidate -- the same inputs daemon_qa_packet_write checks the write against. */
112
+ export type QaAnswerCandidate = Pick<QaPacketCandidate, 'focusAcceptanceCriteria' | 'deliveries' | 'armedBaselineCriteria' | 'previousPacket'>;
113
+ /** One parsed answer as the pass would write it, and what it violates. */
114
+ export interface QaAnswerJudgement {
115
+ /** The answer's cases, marked from the previous cycle's RECORDED results ([] for a no-UI-surface answer). */
116
+ cases: Array<Record<string, unknown>>;
117
+ /** One line per faithfulness violation of those cases; [] is faithful. */
118
+ violations: string[];
119
+ }
56
120
  /**
57
- * The violations of one parsed answer against what the candidate read handed
58
- * the author -- the same inputs daemon_qa_packet_write checks the write
59
- * against. Pure.
121
+ * Judge one parsed answer against what the candidate read handed the author:
122
+ * stamp its cases from the previous cycle's recorded results, then check the
123
+ * STAMPED cases as a writer that carries every previous case forward. Pure.
124
+ * The one place an answer is stamped: the cases returned are the cases checked.
60
125
  */
61
- export declare function qaAnswerFaithfulnessViolations(candidate: Pick<QaPacketCandidate, 'focusAcceptanceCriteria' | 'deliveries' | 'armedBaselineCriteria' | 'previousPacket'>, answer: {
126
+ export declare function judgeQaAnswer(candidate: QaAnswerCandidate, answer: {
127
+ kind: 'cases';
128
+ cases: readonly unknown[];
129
+ } | {
130
+ kind: 'no_ui_surface';
131
+ }): QaAnswerJudgement;
132
+ /** The violations of one parsed answer (judgeQaAnswer, without the stamped cases). Pure. */
133
+ export declare function qaAnswerFaithfulnessViolations(candidate: QaAnswerCandidate, answer: {
62
134
  kind: 'cases';
63
135
  cases: readonly unknown[];
64
136
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"qa-author-faithfulness.d.ts","sourceRoot":"","sources":["../../src/qa/qa-author-faithfulness.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACxC,0DAA0D;IAC1D,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,mFAAmF;IACnF,mBAAmB,EAAE,aAAa,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC;CAClF;AAsBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQzD;AAED,kGAAkG;AAClG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,CAU7F;AAMD,kGAAkG;AAClG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAOtE;AAqCD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CA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