@telora/daemon 0.23.29 → 0.23.46

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 (221) hide show
  1. package/build-info.json +10 -3
  2. package/dist/backends/claude/one-shot-model.d.ts.map +1 -1
  3. package/dist/backends/claude/one-shot-model.js +1 -0
  4. package/dist/backends/claude/one-shot-model.js.map +1 -1
  5. package/dist/completion/completion-event/event.d.ts +12 -0
  6. package/dist/completion/completion-event/event.d.ts.map +1 -1
  7. package/dist/completion/completion-event/event.js +1 -0
  8. package/dist/completion/completion-event/event.js.map +1 -1
  9. package/dist/completion/completion-event/unfinished-work.d.ts +134 -0
  10. package/dist/completion/completion-event/unfinished-work.d.ts.map +1 -0
  11. package/dist/completion/completion-event/unfinished-work.js +140 -0
  12. package/dist/completion/completion-event/unfinished-work.js.map +1 -0
  13. package/dist/completion/team-outcome/apply-turn.d.ts.map +1 -1
  14. package/dist/completion/team-outcome/apply-turn.js +18 -0
  15. package/dist/completion/team-outcome/apply-turn.js.map +1 -1
  16. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts +16 -0
  17. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts.map +1 -1
  18. package/dist/completion/team-outcome/decide-turn-entry-rows.js +75 -11
  19. package/dist/completion/team-outcome/decide-turn-entry-rows.js.map +1 -1
  20. package/dist/completion/team-outcome/decide-turn-work-rows.d.ts.map +1 -1
  21. package/dist/completion/team-outcome/decide-turn-work-rows.js +10 -1
  22. package/dist/completion/team-outcome/decide-turn-work-rows.js.map +1 -1
  23. package/dist/completion/team-outcome/decide.d.ts.map +1 -1
  24. package/dist/completion/team-outcome/decide.js +1 -0
  25. package/dist/completion/team-outcome/decide.js.map +1 -1
  26. package/dist/completion/team-outcome/exit-action-roles.d.ts.map +1 -1
  27. package/dist/completion/team-outcome/exit-action-roles.js +2 -0
  28. package/dist/completion/team-outcome/exit-action-roles.js.map +1 -1
  29. package/dist/completion/team-outcome/exit-actions.d.ts +4 -0
  30. package/dist/completion/team-outcome/exit-actions.d.ts.map +1 -1
  31. package/dist/completion/team-outcome/exit-limits.d.ts +8 -0
  32. package/dist/completion/team-outcome/exit-limits.d.ts.map +1 -1
  33. package/dist/completion/team-outcome/exit-limits.js +9 -0
  34. package/dist/completion/team-outcome/exit-limits.js.map +1 -1
  35. package/dist/completion/team-outcome/exit-pipeline-state.d.ts +7 -0
  36. package/dist/completion/team-outcome/exit-pipeline-state.d.ts.map +1 -1
  37. package/dist/completion/team-outcome/exit-pipeline-state.js +1 -0
  38. package/dist/completion/team-outcome/exit-pipeline-state.js.map +1 -1
  39. package/dist/completion/team-outcome/team-outcome.d.ts.map +1 -1
  40. package/dist/completion/team-outcome/team-outcome.js +2 -1
  41. package/dist/completion/team-outcome/team-outcome.js.map +1 -1
  42. package/dist/completion/team-teardown/session-hold-bounds.d.ts +13 -1
  43. package/dist/completion/team-teardown/session-hold-bounds.d.ts.map +1 -1
  44. package/dist/completion/team-teardown/session-hold-bounds.js +15 -0
  45. package/dist/completion/team-teardown/session-hold-bounds.js.map +1 -1
  46. package/dist/completion/team-teardown/session-hold.d.ts.map +1 -1
  47. package/dist/completion/team-teardown/session-hold.js +4 -0
  48. package/dist/completion/team-teardown/session-hold.js.map +1 -1
  49. package/dist/composition/completion-event-context.d.ts.map +1 -1
  50. package/dist/composition/completion-event-context.js +8 -0
  51. package/dist/composition/completion-event-context.js.map +1 -1
  52. package/dist/composition/daemon-contexts.d.ts.map +1 -1
  53. package/dist/composition/daemon-contexts.js +3 -1
  54. package/dist/composition/daemon-contexts.js.map +1 -1
  55. package/dist/composition/qa-author-pass-context.d.ts +7 -0
  56. package/dist/composition/qa-author-pass-context.d.ts.map +1 -0
  57. package/dist/composition/qa-author-pass-context.js +68 -0
  58. package/dist/composition/qa-author-pass-context.js.map +1 -0
  59. package/dist/composition/runtime-poll-context.d.ts +32 -4
  60. package/dist/composition/runtime-poll-context.d.ts.map +1 -1
  61. package/dist/composition/runtime-poll-context.js +61 -5
  62. package/dist/composition/runtime-poll-context.js.map +1 -1
  63. package/dist/composition/spawn-pass-deps.d.ts +1 -1
  64. package/dist/composition/spawn-pass-deps.d.ts.map +1 -1
  65. package/dist/composition/verification-context.js +1 -1
  66. package/dist/composition/verify-rework-context.d.ts +12 -3
  67. package/dist/composition/verify-rework-context.d.ts.map +1 -1
  68. package/dist/composition/verify-rework-context.js +27 -10
  69. package/dist/composition/verify-rework-context.js.map +1 -1
  70. package/dist/config/live-daemon-config.js +1 -1
  71. package/dist/daemon-state/focus-team-state.js +1 -1
  72. package/dist/daemon-state/provider-window.d.ts.map +1 -1
  73. package/dist/daemon-state/provider-window.js +1 -0
  74. package/dist/daemon-state/provider-window.js.map +1 -1
  75. package/dist/delivery/advance-hold.d.ts +25 -0
  76. package/dist/delivery/advance-hold.d.ts.map +1 -1
  77. package/dist/delivery/advance-hold.js +52 -1
  78. package/dist/delivery/advance-hold.js.map +1 -1
  79. package/dist/delivery/delivery-reconciler.d.ts +17 -2
  80. package/dist/delivery/delivery-reconciler.d.ts.map +1 -1
  81. package/dist/delivery/delivery-reconciler.js +54 -30
  82. package/dist/delivery/delivery-reconciler.js.map +1 -1
  83. package/dist/delivery/recorded-concerns.d.ts.map +1 -1
  84. package/dist/delivery/recorded-concerns.js +1 -0
  85. package/dist/delivery/recorded-concerns.js.map +1 -1
  86. package/dist/directive/directive-queue.d.ts +27 -0
  87. package/dist/directive/directive-queue.d.ts.map +1 -1
  88. package/dist/directive/directive-queue.js +36 -1
  89. package/dist/directive/directive-queue.js.map +1 -1
  90. package/dist/focus/daemon-contexts.d.ts +3 -0
  91. package/dist/focus/daemon-contexts.d.ts.map +1 -1
  92. package/dist/focus/daemon-contexts.js +1 -1
  93. package/dist/focus/daemon-contexts.js.map +1 -1
  94. package/dist/focus/failed-head-wedge.d.ts +42 -13
  95. package/dist/focus/failed-head-wedge.d.ts.map +1 -1
  96. package/dist/focus/failed-head-wedge.js +45 -10
  97. package/dist/focus/failed-head-wedge.js.map +1 -1
  98. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  99. package/dist/focus/focus-loop-registry.js +21 -0
  100. package/dist/focus/focus-loop-registry.js.map +1 -1
  101. package/dist/focus/focus-poller-spawn.js +1 -1
  102. package/dist/focus/focus-poller-state.js +1 -1
  103. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -1
  104. package/dist/focus/pending-spawn-review-next-step.js +9 -1
  105. package/dist/focus/pending-spawn-review-next-step.js.map +1 -1
  106. package/dist/focus/uncommitted-work-backstop.d.ts +115 -0
  107. package/dist/focus/uncommitted-work-backstop.d.ts.map +1 -0
  108. package/dist/focus/uncommitted-work-backstop.js +259 -0
  109. package/dist/focus/uncommitted-work-backstop.js.map +1 -0
  110. package/dist/focus/verify-routing-passes.d.ts +5 -1
  111. package/dist/focus/verify-routing-passes.d.ts.map +1 -1
  112. package/dist/focus/verify-routing-passes.js +1 -0
  113. package/dist/focus/verify-routing-passes.js.map +1 -1
  114. package/dist/git/index.d.ts.map +1 -1
  115. package/dist/git/index.js +2 -1
  116. package/dist/git/index.js.map +1 -1
  117. package/dist/git/review-window-commits.d.ts.map +1 -1
  118. package/dist/git/review-window-commits.js +1 -0
  119. package/dist/git/review-window-commits.js.map +1 -1
  120. package/dist/git/types.d.ts.map +1 -1
  121. package/dist/git/types.js +1 -19
  122. package/dist/git/types.js.map +1 -1
  123. package/dist/prompt-sections/qa-author-section.d.ts +58 -0
  124. package/dist/prompt-sections/qa-author-section.d.ts.map +1 -0
  125. package/dist/prompt-sections/qa-author-section.js +226 -0
  126. package/dist/prompt-sections/qa-author-section.js.map +1 -0
  127. package/dist/qa/qa-author-faithfulness.d.ts +139 -0
  128. package/dist/qa/qa-author-faithfulness.d.ts.map +1 -0
  129. package/dist/qa/qa-author-faithfulness.js +323 -0
  130. package/dist/qa/qa-author-faithfulness.js.map +1 -0
  131. package/dist/qa/qa-author-mode.d.ts +34 -0
  132. package/dist/qa/qa-author-mode.d.ts.map +1 -0
  133. package/dist/qa/qa-author-mode.js +29 -0
  134. package/dist/qa/qa-author-mode.js.map +1 -0
  135. package/dist/qa/qa-author-output.d.ts +26 -0
  136. package/dist/qa/qa-author-output.d.ts.map +1 -0
  137. package/dist/qa/qa-author-output.js +66 -0
  138. package/dist/qa/qa-author-output.js.map +1 -0
  139. package/dist/qa/qa-author-pass.d.ts +63 -0
  140. package/dist/qa/qa-author-pass.d.ts.map +1 -0
  141. package/dist/qa/qa-author-pass.js +164 -0
  142. package/dist/qa/qa-author-pass.js.map +1 -0
  143. package/dist/qa/qa-author-runner.d.ts +60 -0
  144. package/dist/qa/qa-author-runner.d.ts.map +1 -0
  145. package/dist/qa/qa-author-runner.js +180 -0
  146. package/dist/qa/qa-author-runner.js.map +1 -0
  147. package/dist/qa/qa-focus-changes.d.ts +32 -0
  148. package/dist/qa/qa-focus-changes.d.ts.map +1 -0
  149. package/dist/qa/qa-focus-changes.js +59 -0
  150. package/dist/qa/qa-focus-changes.js.map +1 -0
  151. package/dist/queries/api-client/shared.d.ts +1 -0
  152. package/dist/queries/api-client/shared.d.ts.map +1 -1
  153. package/dist/queries/api-client/shared.js +14 -1
  154. package/dist/queries/api-client/shared.js.map +1 -1
  155. package/dist/queries/deliveries/deliveries.d.ts +15 -27
  156. package/dist/queries/deliveries/deliveries.d.ts.map +1 -1
  157. package/dist/queries/deliveries/deliveries.js +6 -57
  158. package/dist/queries/deliveries/deliveries.js.map +1 -1
  159. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts +8 -3
  160. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts.map +1 -1
  161. package/dist/queries/delivery-gate-state/delivery-gate-state.js +1 -1
  162. package/dist/queries/escalations/escalations.d.ts.map +1 -1
  163. package/dist/queries/escalations/escalations.js +1 -0
  164. package/dist/queries/escalations/escalations.js.map +1 -1
  165. package/dist/queries/index.d.ts +1 -1
  166. package/dist/queries/index.d.ts.map +1 -1
  167. package/dist/queries/index.js +1 -1
  168. package/dist/queries/index.js.map +1 -1
  169. package/dist/queries/qa-packets/qa-packets.d.ts +156 -0
  170. package/dist/queries/qa-packets/qa-packets.d.ts.map +1 -0
  171. package/dist/queries/qa-packets/qa-packets.js +105 -0
  172. package/dist/queries/qa-packets/qa-packets.js.map +1 -0
  173. package/dist/supervision/escalation-filing.js +1 -1
  174. package/dist/supervision/spawn-cooldown.js +1 -1
  175. package/dist/supervision/stop-registry.d.ts +5 -0
  176. package/dist/supervision/stop-registry.d.ts.map +1 -1
  177. package/dist/supervision/stop-rows-team-session.d.ts +6 -1
  178. package/dist/supervision/stop-rows-team-session.d.ts.map +1 -1
  179. package/dist/supervision/stop-rows-team-session.js +34 -1
  180. package/dist/supervision/stop-rows-team-session.js.map +1 -1
  181. package/dist/supervision/team-work.d.ts.map +1 -1
  182. package/dist/supervision/team-work.js +1 -0
  183. package/dist/supervision/team-work.js.map +1 -1
  184. package/dist/testing/fixtures/api-client.js +1 -1
  185. package/dist/testing/fixtures/approved-head-inert-deps.js +1 -1
  186. package/dist/testing/fixtures/approved-head-inert-deps.js.map +1 -1
  187. package/dist/testing/fixtures/completion-event-deps.d.ts +2 -1
  188. package/dist/testing/fixtures/completion-event-deps.d.ts.map +1 -1
  189. package/dist/testing/fixtures/completion-event-deps.js +5 -1
  190. package/dist/testing/fixtures/completion-event-deps.js.map +1 -1
  191. package/dist/testing/fixtures/index.js +1 -1
  192. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -1
  193. package/dist/testing/fixtures/pending-spawn-world.js +2 -1
  194. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  195. package/dist/testing/fixtures/review-exit-deps.js +2 -2
  196. package/dist/testing/fixtures/review-exit-deps.js.map +1 -1
  197. package/dist/types/index.js +1 -1
  198. package/dist/types/qa-packet.d.ts +39 -0
  199. package/dist/types/qa-packet.d.ts.map +1 -0
  200. package/dist/types/qa-packet.js +50 -0
  201. package/dist/types/qa-packet.js.map +1 -0
  202. package/dist/verify/attribution/rework-attribution.d.ts +50 -111
  203. package/dist/verify/attribution/rework-attribution.d.ts.map +1 -1
  204. package/dist/verify/attribution/rework-attribution.js +215 -71
  205. package/dist/verify/attribution/rework-attribution.js.map +1 -1
  206. package/dist/verify/gate-verdicts/commit-verdict-record.d.ts +9 -0
  207. package/dist/verify/gate-verdicts/commit-verdict-record.d.ts.map +1 -1
  208. package/dist/verify/gate-verdicts/commit-verdict-record.js +27 -1
  209. package/dist/verify/gate-verdicts/commit-verdict-record.js.map +1 -1
  210. package/dist/verify/gate-verdicts/judged-ancestor.d.ts.map +1 -1
  211. package/dist/verify/gate-verdicts/judged-ancestor.js +2 -1
  212. package/dist/verify/gate-verdicts/judged-ancestor.js.map +1 -1
  213. package/dist/verify/outcome-routing/gate-rework-reopen.d.ts +30 -0
  214. package/dist/verify/outcome-routing/gate-rework-reopen.d.ts.map +1 -0
  215. package/dist/verify/outcome-routing/gate-rework-reopen.js +37 -0
  216. package/dist/verify/outcome-routing/gate-rework-reopen.js.map +1 -0
  217. package/dist/verify/outcome-routing/verification-rework-issue.d.ts +114 -25
  218. package/dist/verify/outcome-routing/verification-rework-issue.d.ts.map +1 -1
  219. package/dist/verify/outcome-routing/verification-rework-issue.js +147 -88
  220. package/dist/verify/outcome-routing/verification-rework-issue.js.map +1 -1
  221. package/package.json +3 -3
@@ -0,0 +1,226 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/prompt-sections/qa-author-section.test.ts,
3
+ // packages/daemon/src/qa/qa-author-unfaithful-answer.test.ts
4
+ // PINNED-BY-END
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';
33
+ /** The system prompt every QA-author call runs under (a resumed session may keep its recorded one). */
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 ' +
35
+ 'QA environment. You never edit files and never run a command that changes anything. You end every ' +
36
+ 'answer with exactly one fenced json block.';
37
+ /** The heading the prompt opens with -- the anchor tests and logs name it by. */
38
+ export const QA_AUTHOR_HEADING = '# WRITE THE UI TEST PACKET FOR THIS FOCUS';
39
+ function verbatim(text, none) {
40
+ const t = (text ?? '').trim();
41
+ return t ? ['```text', t, '```'] : [none];
42
+ }
43
+ function isRecord(value) {
44
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
45
+ }
46
+ /** The armed baseline criteria, each quoted as the arm stamped it. */
47
+ function armedBaselineLines(criteria) {
48
+ if (criteria === null || criteria === undefined)
49
+ return ['(the arm stamped no criteria)'];
50
+ if (!Array.isArray(criteria))
51
+ return ['```json', JSON.stringify(criteria, null, 2), '```'];
52
+ const lines = [];
53
+ for (const entry of criteria) {
54
+ if (isRecord(entry) && typeof entry.criterion === 'string' && entry.criterion.trim()) {
55
+ lines.push(...verbatim(entry.criterion, ''));
56
+ if (entry.drafted === true)
57
+ lines.push('(machine-drafted, accepted at the arm)');
58
+ }
59
+ else {
60
+ lines.push('```json', JSON.stringify(entry), '```');
61
+ }
62
+ }
63
+ return lines.length > 0 ? lines : ['(the arm stamped no criteria)'];
64
+ }
65
+ function targetLines(candidate, reviewedSha) {
66
+ const { environment, baseUrl, accessNote } = candidate.qaTarget;
67
+ return [
68
+ '## The QA target',
69
+ `- Environment: ${environment?.trim() || '(not set)'}`,
70
+ baseUrl?.trim()
71
+ ? `- Base URL: ${baseUrl.trim()}`
72
+ : '- Base URL: (not set) -- write every path relative anyway; the human resolves it against the environment they test in.',
73
+ `- Access: ${accessNote?.trim() || '(no access note)'}`,
74
+ `- The packet describes commit \`${reviewedSha}\`.`,
75
+ '',
76
+ 'Every case\'s `path` is RELATIVE to the base URL (for example `/settings?tab=billing`). Never write a scheme, a host, or `..`.',
77
+ ];
78
+ }
79
+ function criteriaLines(candidate) {
80
+ const lines = [
81
+ '## The acceptance criteria -- quote them VERBATIM',
82
+ 'Each case names ONE of the criteria below in its `criterion` field, copied EXACTLY: one whole line of a criteria ' +
83
+ 'block (without its leading bullet or number) or one whole block. A paraphrase, a summary, a fragment or two ' +
84
+ 'criteria merged into one is REFUSED. Only the focus\'s acceptance criteria, the armed baseline criteria and each ' +
85
+ 'delivery\'s "Acceptance criteria" count -- a description is not a criterion.',
86
+ '',
87
+ `### Focus "${candidate.focusName}"`,
88
+ ...verbatim(candidate.focusAcceptanceCriteria, '(the focus declares no acceptance criteria)'),
89
+ '',
90
+ '### Armed baseline criteria (what the human held this focus to when they armed it)',
91
+ ...armedBaselineLines(candidate.armedBaselineCriteria),
92
+ ];
93
+ for (const d of candidate.deliveries) {
94
+ lines.push('', `### Delivery "${d.name}" (${d.executionStatus ?? 'status unknown'})`);
95
+ if (d.description?.trim())
96
+ lines.push(...verbatim(d.description, ''));
97
+ lines.push('Acceptance criteria:', ...verbatim(d.acceptanceCriteria, '(none declared)'));
98
+ }
99
+ return lines;
100
+ }
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)
111
+ return [];
112
+ const lines = [
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.',
121
+ ];
122
+ for (const c of previous) {
123
+ lines.push(`- \`${c.id}\` -- ${PRIOR_RESULT_WORDS[c.result]} -- criterion: ${JSON.stringify(c.criterion)}; path \`${c.path}\`; ` +
124
+ `steps: ${JSON.stringify(c.steps)}; expected: ${JSON.stringify(c.expected)}`);
125
+ }
126
+ return lines;
127
+ }
128
+ function knowledgeLines(candidate, mode, fresh) {
129
+ if (mode === QA_AUTHOR_MODE.RESUMED) {
130
+ return [
131
+ '## What you know',
132
+ 'You built this focus: this conversation is the coding session that built it, and the review has passed. ' +
133
+ 'Describe what you built in your own words. You may read files in the working directory (Read, Grep, Glob) ' +
134
+ 'to confirm a route, a label or a button name. Change nothing.',
135
+ ];
136
+ }
137
+ const lines = [
138
+ '## What was built',
139
+ 'You did not build this focus. Work from its deliveries above, the review summary, its commits and its diff below.',
140
+ '',
141
+ '### Review summary',
142
+ ...verbatim(candidate.latestReviewSummary, '(no review summary was recorded)'),
143
+ '',
144
+ '### Commits',
145
+ ...verbatim(fresh?.commitLog, '(no commits could be listed)'),
146
+ '',
147
+ '### Diff',
148
+ ];
149
+ if (fresh?.note)
150
+ lines.push(`(${fresh.note})`);
151
+ lines.push(...(fresh?.diff.trim() ? ['```diff', fresh.diff, '```'] : ['(no diff could be read)']));
152
+ if (fresh?.truncated)
153
+ lines.push('(The diff was cut at its size cap; the rest of the change is not shown.)');
154
+ return lines;
155
+ }
156
+ const RULE_LINES = [
157
+ '## The rules',
158
+ '- Write ONLY UI-facing cases: something a person opens, clicks or types into in the browser and sees the result of. ' +
159
+ 'No API calls, CLI commands, database queries, log reading or code inspection.',
160
+ '- One case per behavior a person can observe, tied to ONE criterion. A criterion nothing in the UI can show gets no case.',
161
+ '- `id`: short and unique within the packet (c1, c2, ...).',
162
+ '- `criterion`: that criterion, copied exactly from the list above -- one line without its bullet, or one whole block.',
163
+ '- `built`: what was built for it, in a sentence or two.',
164
+ '- `path`: where to start, relative to the base URL.',
165
+ '- `steps`: click-level actions in order, one action each ("Click **Save**").',
166
+ '- `expected`: what the person should see when the criterion is met.',
167
+ '- If nothing in this focus changes anything a person can click or see, answer with the no-UI-surface marker instead of cases.',
168
+ '- Do not ask questions. Do not edit files. Do not run git or any command that writes.',
169
+ ];
170
+ const OUTPUT_LINES = [
171
+ '## Your answer',
172
+ 'End your answer with exactly ONE fenced json block and nothing after it. Either the cases:',
173
+ '```json',
174
+ '{"cases": [{"id": "c1", "criterion": "<verbatim criterion>", "built": "<what was built>", "path": "/relative/path", ' +
175
+ '"steps": ["<step 1>", "<step 2>"], "expected": "<what the person sees>"}]}',
176
+ '```',
177
+ 'or, when nothing in the focus has a UI surface:',
178
+ '```json',
179
+ '{"noUiSurface": true}',
180
+ '```',
181
+ 'Add `"priorCaseId": "<previous case id>"` only to a case that carries a case of the previous QA cycle forward.',
182
+ ];
183
+ /** The heading a corrective attempt's addition opens with. */
184
+ export const QA_AUTHOR_CORRECTION_HEADING = '## YOUR PREVIOUS ANSWER WAS REFUSED';
185
+ /**
186
+ * What a corrective attempt appends to the prompt: the rules the previous
187
+ * answer broke, one per line, and the instruction to write the whole packet
188
+ * again. Pure; the same text for every engine.
189
+ */
190
+ export function buildQaAuthorCorrection(violations) {
191
+ return [
192
+ QA_AUTHOR_CORRECTION_HEADING,
193
+ 'You answered this once already, and that packet was refused because it broke these rules:',
194
+ ...violations.map((v) => `- ${v}`),
195
+ '',
196
+ 'Write the WHOLE packet again, following every rule above: copy each `criterion` exactly from the criteria ' +
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.',
199
+ ].join('\n') + '\n';
200
+ }
201
+ /**
202
+ * The QA-author prompt for one candidate. `reviewedSha` is the commit the
203
+ * packet is pinned to; `fresh` carries the change for a fresh pass (ignored
204
+ * when resumed). Pure: the same inputs give the same text.
205
+ */
206
+ export function buildQaAuthorPrompt(candidate, mode, reviewedSha, fresh = null) {
207
+ const intro = [
208
+ QA_AUTHOR_HEADING,
209
+ `The team's work on the focus "${candidate.focusName}" is finished and reviewed. A HUMAN will now check it by hand: ` +
210
+ 'they open the product in a web browser at the QA target below and run the test packet you write, case by case. ' +
211
+ 'Write that packet.',
212
+ ];
213
+ if (candidate.focusDescription?.trim())
214
+ intro.push('', 'The focus:', ...verbatim(candidate.focusDescription, ''));
215
+ const sections = [
216
+ intro,
217
+ targetLines(candidate, reviewedSha),
218
+ criteriaLines(candidate),
219
+ previousCaseLines(candidate),
220
+ knowledgeLines(candidate, mode, fresh),
221
+ [...RULE_LINES],
222
+ [...OUTPUT_LINES],
223
+ ].filter((s) => s.length > 0);
224
+ return sections.map((s) => s.join('\n')).join('\n\n') + '\n';
225
+ }
226
+ //# sourceMappingURL=qa-author-section.js.map
@@ -0,0 +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;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,eAAe,EAA0B,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAwC,MAAM,uBAAuB,CAAC;AAE7G,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,S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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"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Is a QA-author answer FAITHFUL to its focus? Every case quotes one of the
3
+ * criteria the pass was shown (the focus's acceptance criteria, each
4
+ * non-cancelled delivery's, each armed baseline criterion -- normalized, never
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.
16
+ *
17
+ * The daemon runs this BEFORE it asks for the ready write, so an unfaithful
18
+ * answer can be re-asked (qa-author-runner.ts) instead of only refused. The
19
+ * authoritative rule is the edge's: checkQaPacketFaithful in
20
+ * src/lib/qa/qa-packet.ts (mirrored to supabase/functions/_shared), which
21
+ * daemon_qa_packet_write applies before a ready or no_ui_surface write. The
22
+ * daemon cannot import src/lib, so this is its own copy; qa-author-
23
+ * faithfulness.test.ts runs the SAME conformance tables
24
+ * (src/lib/qa/__fixtures__/qa-faithfulness-cases.json) the canonical vitest
25
+ * runs, so the two cannot drift.
26
+ */
27
+ import { type QaPacketCandidate } from '../queries/qa-packets/qa-packets.js';
28
+ import { type QaCaseResult } from '../types/qa-packet.js';
29
+ /** What the rule reads of one case. */
30
+ export interface QaFaithfulnessCase {
31
+ id: string;
32
+ criterion: string;
33
+ retest?: boolean;
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;
53
+ }
54
+ /** What the rule reads of a packet and its focus. */
55
+ export interface QaPacketFaithfulnessInput {
56
+ /** The packet's cases as they will be written -- after stampQaPriorResults ([] for a no-UI-surface packet). */
57
+ cases: readonly QaFaithfulnessCase[];
58
+ noUiSurface: boolean;
59
+ /** The quotable criteria (qaCriteriaFromTexts); normalized again here. */
60
+ criteria: readonly string[];
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;
69
+ }
70
+ /**
71
+ * The one normalization both sides of a criterion comparison get. Pure and
72
+ * idempotent: trim; strip surrounding quotes and a leading list marker, one
73
+ * layer at a time until neither is left; collapse whitespace runs to one
74
+ * space. Case, punctuation and wording are kept.
75
+ */
76
+ export declare function normalizeQaCriterion(text: string): string;
77
+ /** Every whole text block and each of its non-empty lines, normalized and de-duplicated. Pure. */
78
+ export declare function qaCriteriaFromTexts(texts: ReadonlyArray<string | null | undefined>): string[];
79
+ /** The criterion strings of an armed_baseline_criteria array; anything else yields none. Pure. */
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[];
95
+ /**
96
+ * Is the packet faithful? Pure. One human-readable line per violation; [] is
97
+ * faithful. Rules: (1) every criterion is one of `criteria`; (2) every
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
101
+ * retestOf, naming a failed case, and quotes the criterion that case tested;
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.
109
+ */
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
+ }
120
+ /**
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.
125
+ */
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: {
134
+ kind: 'cases';
135
+ cases: readonly unknown[];
136
+ } | {
137
+ kind: 'no_ui_surface';
138
+ }): string[];
139
+ //# sourceMappingURL=qa-author-faithfulness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qa-author-faithfulness.d.ts","sourceRoot":"","sources":["../../src/qa/qa-author-faithfulness.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1E,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC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