@promptdriven/runtime-client 1.1.2 → 1.1.4
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.
- package/package.json +1 -1
- package/src/runtime/contract-refs.mjs +4 -0
- package/src/runtime/index.mjs +27 -0
- package/src/runtime/prompt-clauses.mjs +290 -0
- package/src/runtime/run-program.mjs +13 -8
- package/src/runtime/runtime-binding-plan.mjs +116 -15
- package/src/runtime/runtime-bindings.mjs +11 -5
- package/src/runtime/runtime-check-plan.mjs +40 -14
- package/src/runtime/runtime-client.mjs +559 -154
- package/src/runtime/runtime-markdown.mjs +95 -41
- package/src/runtime/runtime-outcome.mjs +156 -5
- package/src/runtime/runtime-output.mjs +54 -9
- package/src/runtime/runtime-preflight.mjs +1176 -39
- package/src/runtime/try-doors.mjs +105 -23
- package/src/runtime/try-http.mjs +232 -10
- package/src/runtime/try-mcp.mjs +7 -1
|
@@ -74,6 +74,49 @@ function markdownContainerLine(line, containers) {
|
|
|
74
74
|
return { line, matched };
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
const THEMATIC_RE = /^ {0,3}(?:(?:\* *){3,}|(?:- *){3,}|(?:_ *){3,})$/;
|
|
78
|
+
const ITEM_RE = /^ {0,3}([-+*]|[0-9]{1,9}[.)]) +(\S.*)$/;
|
|
79
|
+
const FENCE_START_RE = /^ {0,3}(`{3,}|~{3,})(.*)$/;
|
|
80
|
+
const HTML_START_1_RE = /^ {0,3}<(?:!--|\?|![A-Z]|!\[CDATA\[|(?:pre|script|style|textarea)(?=[\t >]|$))/i;
|
|
81
|
+
const HTML_START_2_RE = /^ {0,3}<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?=[\t >]|\/>|$)/i;
|
|
82
|
+
const QUOTE_OR_HEADING_RE = /^ {0,3}(?:>|#{1,6}(?: |$))/;
|
|
83
|
+
const SETEXT_RE = /^ {0,3}(?:=+|-+) *$/;
|
|
84
|
+
const FENCE_CLOSE_RE = /^ {0,3}(`{3,}|~{3,}) *$/;
|
|
85
|
+
const QUOTE_PREFIX_RE = /^ {0,3}> ?/;
|
|
86
|
+
const LIST_PREFIX_RE = /^( {0,3})([-+*]|[0-9]{1,9}[.)])( +|$)/;
|
|
87
|
+
const COMMENT_START_RE = /^ {0,3}<!--/;
|
|
88
|
+
const DEF_START_RE = /^ {0,3}\[[^\]]+\]:/;
|
|
89
|
+
const HEADING_OR_SETEXT_EQ_RE = /^ {0,3}(?:#{1,6}(?: |$)|=+ *$)/;
|
|
90
|
+
const INDENT_4_RE = /^ {4}/;
|
|
91
|
+
const DIGIT_START_RE = /^[0-9]/;
|
|
92
|
+
const ONE_MARKER_RE = /^1[.)]$/;
|
|
93
|
+
|
|
94
|
+
function expandTabs(line) {
|
|
95
|
+
if (!line.includes('\t')) return line;
|
|
96
|
+
let out = '', column = 0, from = 0;
|
|
97
|
+
for (let idx = line.indexOf('\t'); idx >= 0; idx = line.indexOf('\t', from)) {
|
|
98
|
+
const seg = line.slice(from, idx);
|
|
99
|
+
out += seg;
|
|
100
|
+
column += seg.length;
|
|
101
|
+
const width = 4 - (column % 4);
|
|
102
|
+
out += ' '.repeat(width);
|
|
103
|
+
column += width;
|
|
104
|
+
from = idx + 1;
|
|
105
|
+
}
|
|
106
|
+
return out + line.slice(from);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function findClosingBackticks(text, from, scopeEnd, count) {
|
|
110
|
+
let idx = text.indexOf('`', from);
|
|
111
|
+
while (idx >= 0 && idx < scopeEnd) {
|
|
112
|
+
let runEnd = idx + 1;
|
|
113
|
+
while (runEnd < text.length && text.charCodeAt(runEnd) === 96) runEnd++;
|
|
114
|
+
if (runEnd - idx === count) return runEnd <= scopeEnd ? runEnd : -1;
|
|
115
|
+
idx = text.indexOf('`', runEnd);
|
|
116
|
+
}
|
|
117
|
+
return -1;
|
|
118
|
+
}
|
|
119
|
+
|
|
77
120
|
// Discovery sees prose only; preserve offsets and newlines without changing captured bytes.
|
|
78
121
|
export function markdownSectionText(text) {
|
|
79
122
|
const parts = [], inline = /`+|<!--|</g;
|
|
@@ -81,13 +124,22 @@ export function markdownSectionText(text) {
|
|
|
81
124
|
let containers = [], fence = null, comment = false, indented = false, copied = 0, paragraph = false;
|
|
82
125
|
let scopeStart = null, scopeEnd = 0;
|
|
83
126
|
const mask = (start, end) => {
|
|
84
|
-
|
|
127
|
+
if (end <= start) return;
|
|
128
|
+
parts.push(text.slice(copied, start));
|
|
129
|
+
const slice = text.slice(start, end);
|
|
130
|
+
parts.push(!slice.includes('\n') && !slice.includes('\r') ? ' '.repeat(end - start) : slice.replace(/[^\r\n]/g, ' '));
|
|
85
131
|
copied = end;
|
|
86
132
|
};
|
|
87
133
|
// Inline parsing belongs to one leaf block. A matching run in a later
|
|
88
134
|
// paragraph, heading or container cannot turn intervening prose into code.
|
|
89
135
|
const flush = () => {
|
|
90
136
|
if (scopeStart === null) return;
|
|
137
|
+
const firstTick = text.indexOf('`', scopeStart);
|
|
138
|
+
const firstComment = text.indexOf('<!--', scopeStart);
|
|
139
|
+
if ((firstTick < 0 || firstTick >= scopeEnd) && (firstComment < 0 || firstComment >= scopeEnd)) {
|
|
140
|
+
scopeStart = null;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
91
143
|
inline.lastIndex = scopeStart;
|
|
92
144
|
for (let match; (match = inline.exec(text)) && match.index < scopeEnd;) {
|
|
93
145
|
let tokenStart = match.index, token = match[0], slashes = 0;
|
|
@@ -110,53 +162,55 @@ export function markdownSectionText(text) {
|
|
|
110
162
|
if (close < 0 || close + 3 > scopeEnd) continue;
|
|
111
163
|
closeEnd = close + 3;
|
|
112
164
|
} else {
|
|
113
|
-
const closing = new RegExp('(?<!`)`{' + token.length + '}(?!`)', 'g');
|
|
114
|
-
closing.lastIndex = inline.lastIndex;
|
|
115
|
-
const close = closing.exec(text);
|
|
116
|
-
if (!close || close.index + close[0].length > scopeEnd) continue;
|
|
117
165
|
// Backslashes have no escape meaning inside an actual code span.
|
|
118
|
-
closeEnd =
|
|
166
|
+
closeEnd = findClosingBackticks(text, inline.lastIndex, scopeEnd, token.length);
|
|
167
|
+
if (closeEnd < 0) continue;
|
|
119
168
|
}
|
|
120
169
|
mask(tokenStart, closeEnd);
|
|
121
170
|
inline.lastIndex = closeEnd;
|
|
122
171
|
}
|
|
123
172
|
scopeStart = null;
|
|
124
173
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
174
|
+
const len = text.length;
|
|
175
|
+
for (let pos = 0; pos < len;) {
|
|
176
|
+
let end = pos;
|
|
177
|
+
while (end < len) {
|
|
178
|
+
const ch = text.charCodeAt(end);
|
|
179
|
+
if (ch === 10 || ch === 13) break;
|
|
180
|
+
end++;
|
|
181
|
+
}
|
|
182
|
+
const start = pos;
|
|
183
|
+
const original = text.slice(start, end);
|
|
184
|
+
if (end < len) {
|
|
185
|
+
pos = (text.charCodeAt(end) === 13 && end + 1 < len && text.charCodeAt(end + 1) === 10) ? end + 2 : end + 1;
|
|
186
|
+
} else {
|
|
187
|
+
pos = len;
|
|
188
|
+
}
|
|
129
189
|
{
|
|
130
190
|
// Tabs affect Markdown indentation only. This view is never captured.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
let { line, matched } = markdownContainerLine(expanded, containers);
|
|
138
|
-
const thematic = /^ {0,3}(?:(?:\* *){3,}|(?:- *){3,}|(?:_ *){3,})$/;
|
|
139
|
-
const item = /^ {0,3}([-+*]|[0-9]{1,9}[.)]) +(\S.*)$/.exec(line);
|
|
140
|
-
const fenceStart = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(line);
|
|
191
|
+
const expanded = expandTabs(original);
|
|
192
|
+
let { line, matched } = containers.length ? markdownContainerLine(expanded, containers) : { line: expanded, matched: 0 };
|
|
193
|
+
const trimmed = line.trim();
|
|
194
|
+
const item = ITEM_RE.exec(line);
|
|
195
|
+
const fenceStart = FENCE_START_RE.exec(line);
|
|
141
196
|
const validFence = fenceStart && !(fenceStart[1][0] === '`' && fenceStart[2].includes('`'));
|
|
142
197
|
// Only HTML block types that can interrupt a paragraph split its inline
|
|
143
198
|
// scope; ordinary angle prose and custom inline tags do not.
|
|
144
|
-
const htmlStart =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|| (item && (!paragraph || !/^[0-9]/.test(item[1]) || /^1[.)]$/.test(item[1])
|
|
199
|
+
const htmlStart = line.includes('<') && (HTML_START_1_RE.test(line) || HTML_START_2_RE.test(line));
|
|
200
|
+
const startsBlock = QUOTE_OR_HEADING_RE.test(line) || validFence || htmlStart || THEMATIC_RE.test(line)
|
|
201
|
+
|| (item && (!paragraph || !DIGIT_START_RE.test(item[1]) || ONE_MARKER_RE.test(item[1])
|
|
148
202
|
|| (matched < containers.length && containers[matched] !== '>')));
|
|
149
203
|
// Lazy paragraph continuation keeps its parent containers available for a
|
|
150
204
|
// later indented fence. Code itself never permits lazy continuation.
|
|
151
|
-
const lazy = matched < containers.length && !fence && !comment && !indented && paragraph &&
|
|
152
|
-
const boundary = !
|
|
205
|
+
const lazy = matched < containers.length && !fence && !comment && !indented && paragraph && trimmed && !startsBlock;
|
|
206
|
+
const boundary = !trimmed || startsBlock || SETEXT_RE.test(line)
|
|
153
207
|
|| (!lazy && matched < containers.length);
|
|
154
208
|
if (boundary) flush();
|
|
155
209
|
if (!lazy && matched < containers.length) { fence = null; comment = false; indented = false; paragraph = false; }
|
|
156
210
|
if (!lazy) containers = containers.slice(0, matched);
|
|
157
211
|
if (fence) {
|
|
158
212
|
mask(start, end);
|
|
159
|
-
const close =
|
|
213
|
+
const close = FENCE_CLOSE_RE.exec(line);
|
|
160
214
|
if (close && close[1][0] === fence[0] && close[1].length >= fence.length) fence = null;
|
|
161
215
|
continue;
|
|
162
216
|
}
|
|
@@ -171,45 +225,45 @@ export function markdownSectionText(text) {
|
|
|
171
225
|
}
|
|
172
226
|
// Code starts only at a leaf boundary. Its indentation belongs to the
|
|
173
227
|
// existing container; markup inside it cannot open another container.
|
|
174
|
-
if ((indented && !
|
|
228
|
+
if ((indented && !trimmed) || (!paragraph && INDENT_4_RE.test(line))) {
|
|
175
229
|
indented = true; mask(start, end); continue;
|
|
176
230
|
}
|
|
177
231
|
indented = false;
|
|
178
232
|
// Start containers only outside code; a list's continuation width belongs
|
|
179
233
|
// to its item, so a sibling marker or dedent ends an unclosed example.
|
|
180
234
|
for (; !lazy;) {
|
|
181
|
-
const quote =
|
|
235
|
+
const quote = QUOTE_PREFIX_RE.exec(line);
|
|
182
236
|
if (quote) { containers.push('>'); line = line.slice(quote[0].length); paragraph = false; continue; }
|
|
183
|
-
const list =
|
|
184
|
-
if (!list ||
|
|
237
|
+
const list = LIST_PREFIX_RE.exec(line);
|
|
238
|
+
if (!list || THEMATIC_RE.test(line)) break;
|
|
185
239
|
const rest = line.slice(list[0].length);
|
|
186
|
-
if (paragraph && (!rest.trim() || (
|
|
240
|
+
if (paragraph && (!rest.trim() || (DIGIT_START_RE.test(list[2]) && !ONE_MARKER_RE.test(list[2])))) break;
|
|
187
241
|
const padding = rest.trim() && list[3].length <= 4 ? list[3].length : 1;
|
|
188
242
|
const indent = list[1].length + list[2].length + padding;
|
|
189
243
|
containers.push(indent); line = line.slice(indent); paragraph = false;
|
|
190
244
|
}
|
|
191
|
-
if (!paragraph &&
|
|
245
|
+
if (!paragraph && INDENT_4_RE.test(line)) {
|
|
192
246
|
indented = true; mask(start, end); continue;
|
|
193
247
|
}
|
|
194
|
-
const opening =
|
|
248
|
+
const opening = FENCE_START_RE.exec(line);
|
|
195
249
|
if (!lazy && opening && !(opening[1][0] === '`' && opening[2].includes('`'))) {
|
|
196
250
|
fence = opening[1]; paragraph = false; mask(start, end); continue;
|
|
197
251
|
}
|
|
198
|
-
if (
|
|
199
|
-
const
|
|
200
|
-
mask(start +
|
|
252
|
+
if (line.includes('<!--') && COMMENT_START_RE.test(line)) {
|
|
253
|
+
const openingIdx = original.indexOf('<!--'), close = original.indexOf('-->', openingIdx + 4);
|
|
254
|
+
mask(start + openingIdx, close < 0 ? end : start + close + 3);
|
|
201
255
|
comment = close < 0; paragraph = false;
|
|
202
256
|
if (!comment) { scopeStart = start + close + 3; scopeEnd = end; flush(); }
|
|
203
257
|
continue;
|
|
204
258
|
}
|
|
205
|
-
const definition = !paragraph &&
|
|
206
|
-
paragraph = Boolean(line.trim()) && !
|
|
207
|
-
&&
|
|
259
|
+
const definition = !paragraph && DEF_START_RE.test(line);
|
|
260
|
+
paragraph = Boolean(line.trim()) && !THEMATIC_RE.test(line) && !definition && !htmlStart
|
|
261
|
+
&& !HEADING_OR_SETEXT_EQ_RE.test(line);
|
|
208
262
|
}
|
|
209
263
|
if (scopeStart === null) scopeStart = start;
|
|
210
264
|
scopeEnd = end;
|
|
211
265
|
if (!paragraph) flush();
|
|
212
266
|
}
|
|
213
267
|
flush();
|
|
214
|
-
return parts.join('') + text.slice(copied);
|
|
268
|
+
return parts.length ? parts.join('') + text.slice(copied) : text;
|
|
215
269
|
}
|
|
@@ -167,12 +167,149 @@ function normalizeMapProblem(item, mapPath) {
|
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
//
|
|
170
|
+
// Cold lazy-interfaces lint legitimately defers capability analysis until check/try
|
|
171
|
+
// synthesis; only accept capabilities_complete: false when lint itself completed cleanly
|
|
172
|
+
// and every incomplete capability report is an unknown placeholder backed by
|
|
173
|
+
// lazy_interface_pending prompts.
|
|
174
|
+
export function isLazyPendingOnlyCapabilities(answer) {
|
|
175
|
+
const result = answer?.result, report = result?.report;
|
|
176
|
+
const prompts = objects(report?.program?.prompts);
|
|
177
|
+
const hasLazyPending = prompts.some(p => (p.admission_state ?? p.state) === 'missing' && p.lazy_interface_pending === true);
|
|
178
|
+
if (!hasLazyPending) return false;
|
|
179
|
+
const topCaps = objects(result?.capabilities).map(item => item.report).filter(object);
|
|
180
|
+
const legacyCaps = objects(report?.lint?.tests).map(item => item.capabilities).filter(object);
|
|
181
|
+
const caps = topCaps.length ? topCaps : legacyCaps;
|
|
182
|
+
if (!caps.length) return objects(report?.lint?.tests).length === 0 && objects(result?.tests).length === 0;
|
|
183
|
+
return caps.every(cap => cap.complete === true || (cap.complete === false && cap.verdict === 'unknown'));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Fail-closed assessment of a remote lint response: a refusal, blocking error problem,
|
|
187
|
+
// lint-incomplete marker, lint.complete === false, or non-lazy capabilities_complete === false
|
|
188
|
+
// never collapses to a pass even if the payload also reports passed: true or passing rows.
|
|
189
|
+
// When `scope` ({ test, applicableMaps, testPassed, reachedChecked }) is supplied for an
|
|
190
|
+
// individual selected test, refusals/problems strictly targeting an unrelated test or
|
|
191
|
+
// non-applicable app map do not fail closed on this passing test.
|
|
192
|
+
export function lintFailClosed(answer, extraProblems = [], scope = null) {
|
|
193
|
+
if (!object(answer)) return null;
|
|
194
|
+
const result = answer.result, report = result?.report;
|
|
195
|
+
const rawRefusals = objects(result?.refusals);
|
|
196
|
+
if (object(report?.refusal) && !rawRefusals.some(item => item.code === report.refusal.code
|
|
197
|
+
&& (item.file ?? item.path ?? null) === (report.refusal.file ?? report.refusal.path ?? null))) {
|
|
198
|
+
rawRefusals.push(report.refusal);
|
|
199
|
+
}
|
|
200
|
+
const canonicalProblems = objects(result?.problems).length ? objects(result.problems) : objects(report?.problems);
|
|
201
|
+
const allProblems = [...canonicalProblems, ...objects(extraProblems)];
|
|
202
|
+
const refusedPrompts = objects(report?.program?.refused_prompts);
|
|
203
|
+
|
|
204
|
+
const targetOf = item => nonEmpty(item?.file, item?.path);
|
|
205
|
+
let refusals = rawRefusals;
|
|
206
|
+
let scopedProblems = allProblems;
|
|
207
|
+
let scopedRefusedPrompts = refusedPrompts;
|
|
208
|
+
let hasUnrelatedRefusal = false;
|
|
209
|
+
|
|
210
|
+
if (scope && typeof scope.test === 'string') {
|
|
211
|
+
const testPath = scope.test;
|
|
212
|
+
const applicableSet = new Set(Array.isArray(scope.applicableMaps) ? scope.applicableMaps : []);
|
|
213
|
+
const otherListedTests = new Set([
|
|
214
|
+
...objects(result?.tests),
|
|
215
|
+
...objects(report?.lint?.tests),
|
|
216
|
+
].map(item => item.path).filter(p => typeof p === 'string' && p !== testPath));
|
|
217
|
+
const otherAppMaps = new Set([
|
|
218
|
+
...objects(result?.app_maps),
|
|
219
|
+
...objects(report?.lint?.app_maps),
|
|
220
|
+
].map(item => item.path).filter(p => typeof p === 'string' && !applicableSet.has(p)));
|
|
221
|
+
const isUnrelatedTarget = item => {
|
|
222
|
+
if (item?.code === 'lint-incomplete') return false;
|
|
223
|
+
const target = targetOf(item);
|
|
224
|
+
if (!target || target === testPath || applicableSet.has(target)) return false;
|
|
225
|
+
return otherListedTests.has(target)
|
|
226
|
+
|| otherAppMaps.has(target)
|
|
227
|
+
|| /(?:^|\/)tests?\/[^/].*\.json$/.test(target)
|
|
228
|
+
|| /(?:^|\/)(?:app-map|[^/]*-map)\.json$/.test(target)
|
|
229
|
+
|| /(?:^|\/)maps\/[^/].*\.json$/.test(target);
|
|
230
|
+
};
|
|
231
|
+
refusals = rawRefusals.filter(item => !isUnrelatedTarget(item));
|
|
232
|
+
scopedProblems = allProblems.filter(item => !isUnrelatedTarget(item));
|
|
233
|
+
if (scope.reachedChecked) scopedRefusedPrompts = [];
|
|
234
|
+
hasUnrelatedRefusal = refusals.length < rawRefusals.length
|
|
235
|
+
|| scopedProblems.length < allProblems.length
|
|
236
|
+
|| (scope.reachedChecked && refusedPrompts.length > 0)
|
|
237
|
+
|| objects(result?.tests).some(t => t.path !== testPath && t.verdict === 'refused')
|
|
238
|
+
|| objects(report?.lint?.tests).some(t => t.path !== testPath && t.verdict === 'refused')
|
|
239
|
+
|| [...objects(result?.app_maps), ...objects(report?.lint?.app_maps)].some(m => !applicableSet.has(m.path) && m.verdict === 'refused');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const errorProblems = scopedProblems.filter(item => item.severity !== 'warning');
|
|
243
|
+
const lintIncompleteProblem = allProblems.find(item => item.code === 'lint-incomplete') ?? null;
|
|
244
|
+
const lintIncompleteRefusal = rawRefusals.find(item => item.code === 'lint-incomplete') ?? null;
|
|
245
|
+
|
|
246
|
+
const envelopeRefused = scope
|
|
247
|
+
? (answer.state === 'refused'
|
|
248
|
+
&& !(scope.testPassed && !hasUnrelatedRefusal && !report?.verdict && !report?.refusal && !rawRefusals.length && !allProblems.some(item => item.severity !== 'warning')))
|
|
249
|
+
: (answer.state === 'refused' || answer.state === 'failed');
|
|
250
|
+
const reportRefused = report?.verdict === 'refused' || report?.verdict === 'failed';
|
|
251
|
+
const answerRefused = (scope ? ((envelopeRefused || reportRefused) && !hasUnrelatedRefusal) : (answer.state === 'refused' || answer.state === 'failed' || reportRefused))
|
|
252
|
+
|| refusals.length > 0;
|
|
253
|
+
const hasErrorProblems = errorProblems.length > 0 || scopedRefusedPrompts.length > 0;
|
|
254
|
+
const lintCompleteFalse = report?.lint?.complete === false || result?.problems_complete === false;
|
|
255
|
+
const anyCapabilitiesFalse = result?.capabilities_complete === false || report?.lint?.capabilities_complete === false;
|
|
256
|
+
const capabilitiesIncomplete = anyCapabilitiesFalse && !isLazyPendingOnlyCapabilities(answer);
|
|
257
|
+
|
|
258
|
+
if (answerRefused || hasErrorProblems) {
|
|
259
|
+
const blockingRefusals = [...refusals, ...errorProblems, ...scopedRefusedPrompts];
|
|
260
|
+
const primary = lintIncompleteRefusal ?? refusals[0] ?? lintIncompleteProblem ?? errorProblems[0] ?? scopedRefusedPrompts[0] ?? null;
|
|
261
|
+
const code = nonEmpty(primary?.code)
|
|
262
|
+
?? (lintCompleteFalse ? 'lint-incomplete' : capabilitiesIncomplete ? 'capabilities-incomplete' : 'lint-refused');
|
|
263
|
+
const message = nonEmpty(
|
|
264
|
+
primary?.message,
|
|
265
|
+
[primary?.reason, primary?.fix].filter(Boolean).join(' '),
|
|
266
|
+
primary?.engine_message,
|
|
267
|
+
lintCompleteFalse ? 'Lint checking did not finish. No pass was established.' : null,
|
|
268
|
+
capabilitiesIncomplete ? 'Capability analysis did not complete.' : null,
|
|
269
|
+
'The interpreter refused lint.',
|
|
270
|
+
);
|
|
271
|
+
return {
|
|
272
|
+
kind: 'refused',
|
|
273
|
+
code,
|
|
274
|
+
message,
|
|
275
|
+
answerRefused,
|
|
276
|
+
lintIncomplete: lintCompleteFalse || !!lintIncompleteProblem || !!lintIncompleteRefusal,
|
|
277
|
+
capabilitiesIncomplete,
|
|
278
|
+
refusals: blockingRefusals.length ? blockingRefusals : [{ code, message }],
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
if (lintCompleteFalse || capabilitiesIncomplete || lintIncompleteProblem) {
|
|
282
|
+
const code = lintIncompleteProblem
|
|
283
|
+
? 'lint-incomplete'
|
|
284
|
+
: lintCompleteFalse
|
|
285
|
+
? 'lint-incomplete'
|
|
286
|
+
: 'capabilities-incomplete';
|
|
287
|
+
const message = nonEmpty(
|
|
288
|
+
lintIncompleteProblem?.message,
|
|
289
|
+
[lintIncompleteProblem?.reason, lintIncompleteProblem?.fix].filter(Boolean).join(' '),
|
|
290
|
+
lintCompleteFalse ? 'Lint did not finish. No pass was established.' : 'Capability analysis did not complete.',
|
|
291
|
+
);
|
|
292
|
+
return {
|
|
293
|
+
kind: 'incomplete',
|
|
294
|
+
code,
|
|
295
|
+
message,
|
|
296
|
+
answerRefused: false,
|
|
297
|
+
lintIncomplete: lintCompleteFalse || !!lintIncompleteProblem,
|
|
298
|
+
capabilitiesIncomplete,
|
|
299
|
+
refusals: [],
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// A selected test passes lint on its own evidence: a passing per-test verdict and passing applicable app maps,
|
|
306
|
+
// and the lint response itself must not be refused, incomplete, or carrying blocking error problems.
|
|
171
307
|
// An ended lint that gives a test or applicable app map no verdict leaves it not run; only a lint that has not ended is unknown.
|
|
172
308
|
function lintOutcome(answer, refusals, test, steps, appMaps, sourceFiles) {
|
|
173
309
|
const result = answer?.result, report = result?.report, program = report?.program;
|
|
174
310
|
if (!['passed', 'failed', 'refused'].includes(answer?.state)) return { state: 'unknown', reason: 'no lint verdict' };
|
|
175
|
-
const complete = report?.lint && typeof report.lint === 'object' ? report.lint.complete === true : result?.problems_complete === true
|
|
311
|
+
const complete = (report?.lint && typeof report.lint === 'object' ? report.lint.complete === true : result?.problems_complete === true)
|
|
312
|
+
&& result?.problems_complete !== false;
|
|
176
313
|
const entries = list => objects(list).filter(item => item.path === test);
|
|
177
314
|
const listed = entries(result?.tests).length ? entries(result.tests) : entries(report?.lint?.tests);
|
|
178
315
|
const verdict = listed.length && listed.every(item => item.verdict === listed[0].verdict) ? listed[0].verdict : null;
|
|
@@ -285,6 +422,12 @@ function lintOutcome(answer, refusals, test, steps, appMaps, sourceFiles) {
|
|
|
285
422
|
}
|
|
286
423
|
}
|
|
287
424
|
const notRun = (reason, code = !complete || notChecked ? 'deadline' : 'no-server-verdict') => ({ state: 'not_run', code, retryable: false, reason, draft });
|
|
425
|
+
const failClosed = lintFailClosed(answer, [], {
|
|
426
|
+
test,
|
|
427
|
+
applicableMaps,
|
|
428
|
+
testPassed: verdict === 'passed',
|
|
429
|
+
reachedChecked: Array.isArray(program?.prompts) || Array.isArray(program?.refused_prompts),
|
|
430
|
+
});
|
|
288
431
|
if (own.some(item => refusals.includes(item))) return refused(own, { draft });
|
|
289
432
|
if (reachedProblem) return refused([reachedProblem], { draft });
|
|
290
433
|
if (appMapRefusals.length) return appMapRefused(appMapRefusals, { draft });
|
|
@@ -299,14 +442,22 @@ function lintOutcome(answer, refusals, test, steps, appMaps, sourceFiles) {
|
|
|
299
442
|
section: row.selection.step_id, message: `${row.verdict}: ${row.reason_code}` }))
|
|
300
443
|
: [{ code: compatibility.state, message: compatibility.state }], { draft });
|
|
301
444
|
}
|
|
302
|
-
if (
|
|
445
|
+
if (failClosed?.kind === 'refused') return refused(failClosed.refusals, { draft });
|
|
446
|
+
if (compatibility.state === 'supported' && compatibility.reported.complete) {
|
|
447
|
+
if (failClosed?.kind === 'incomplete') return notRun(failClosed.message, failClosed.code);
|
|
448
|
+
return { state: 'passed', draft };
|
|
449
|
+
}
|
|
303
450
|
if (lazyPending && complete && !own.length && compatibility.state === 'unknown' && compatibility.reported?.complete === false) {
|
|
451
|
+
if (failClosed?.kind === 'incomplete') return notRun(failClosed.message, failClosed.code);
|
|
304
452
|
return { state: 'passed', draft };
|
|
305
453
|
}
|
|
454
|
+
} else if (failClosed?.kind === 'refused') {
|
|
455
|
+
return refused(failClosed.refusals, { draft });
|
|
306
456
|
}
|
|
307
|
-
return notRun(compatibility.issue ?? 'selected compatibility is unknown or incomplete', compatibility.issue ?? 'no-server-verdict');
|
|
457
|
+
return notRun(compatibility.issue ?? failClosed?.message ?? 'selected compatibility is unknown or incomplete', compatibility.issue ?? failClosed?.code ?? 'no-server-verdict');
|
|
308
458
|
}
|
|
309
|
-
// A job refusal refuses a selected test that has no verdict of its own.
|
|
459
|
+
// A job refusal or blocking lint error refuses a selected test that has no verdict of its own.
|
|
460
|
+
if (failClosed?.kind === 'refused') return refused(failClosed.refusals, { draft });
|
|
310
461
|
if (!listed.length && (answer.state === 'refused' || report?.verdict === 'refused' || refusals.length))
|
|
311
462
|
return refused(refusals.length ? refusals : [{ code: 'lint-refused', message: 'The interpreter refused lint.' }], { draft });
|
|
312
463
|
return notRun(!complete || unlisted || notChecked ? 'lint did not finish' : !appMapsPassed ? 'lint gave no verdict for this app map' : 'lint gave no verdict for this test');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated from prompts/cli/runtime-output.prompt.md (sha256: 6e4117a1364be9328834407e8b6dd8feb5dbacee947193f1a32476c4bb894457).
|
|
2
2
|
import { bindingRefusals } from './runtime-binding-plan.mjs';
|
|
3
3
|
import { describeCompatibility } from './lint-compatibility-display.mjs';
|
|
4
|
+
import { indexClauseTable, validateStepClauses } from './prompt-clauses.mjs';
|
|
4
5
|
import { failedCheckCount, hasProgress, outcomeFor, outcomeText, progressText, providerText, resultOutcome, PROVIDER_TEXT } from './runtime-outcome.mjs';
|
|
5
6
|
export const OPEN_STATES = new Set(['queued', 'running', 'sent']);
|
|
6
7
|
|
|
@@ -160,9 +161,10 @@ function predecessorErrors(refusal, report, steps, secrets) {
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
// The parts of a server answer that pdd shows.
|
|
163
|
-
export function projectAnswer(answer, { origin, secrets = [], steps: authoredSteps = [], criterionTexts = {}, test, sourceFiles, capacityUncertain = false, sampleEvidence = 'full' } = {}) {
|
|
164
|
+
export function projectAnswer(answer, { origin, secrets = [], steps: authoredSteps = [], criterionTexts = {}, test, sourceFiles, capacityUncertain = false, sampleEvidence = 'full', clauseTable = null } = {}) {
|
|
164
165
|
const result = answer?.result ?? null, report = result?.report ?? null, time_limit = stepTimeLimit(answer, { steps: authoredSteps, secrets });
|
|
165
166
|
const outcome = outcomeFor(answer, { test, steps: authoredSteps, timeLimit: !!time_limit, sourceFiles, capacityUncertain, sampleEvidence });
|
|
167
|
+
const clauseIndex = indexClauseTable(clauseTable);
|
|
166
168
|
const safeEvidence = value => typeof value === 'string' ? cleanEvidenceString(value, secrets)
|
|
167
169
|
: Array.isArray(value) ? value.map(safeEvidence)
|
|
168
170
|
: isObjectLike(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [cleanEvidenceString(key, secrets), safeEvidence(item)])) : value;
|
|
@@ -187,6 +189,16 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
187
189
|
: [...(compatibility.reported?.operations ?? []), ...(compatibility.reported?.edges ?? [])].find(row => row.verdict === compatibility.state)?.reason_code)) : null;
|
|
188
190
|
const sampleSteps = (Array.isArray(report?.samples) ? report.samples : [])
|
|
189
191
|
.flatMap(sample => (Array.isArray(sample?.steps) ? sample.steps : []).map((step, index) => ({ step, index })));
|
|
192
|
+
const flatSteps = !sampleSteps.length && Array.isArray(report?.steps) ? report.steps.filter(isObjectLike) : [];
|
|
193
|
+
const flatStepById = new Map(flatSteps.filter(step => typeof step.step_id === 'string' && step.step_id).map(step => [step.step_id, step]));
|
|
194
|
+
const stepClauseResults = new WeakMap();
|
|
195
|
+
let droppedClauseCount = 0;
|
|
196
|
+
for (const step of [...sampleSteps.map(entry => entry.step), ...flatSteps].filter(isObjectLike)) {
|
|
197
|
+
if (stepClauseResults.has(step)) continue;
|
|
198
|
+
const validated = validateStepClauses(step.clauses, clauseIndex);
|
|
199
|
+
stepClauseResults.set(step, validated);
|
|
200
|
+
droppedClauseCount += validated.dropped;
|
|
201
|
+
}
|
|
190
202
|
const nonNegativeInt = value => Number.isSafeInteger(value) && value >= 0 ? value : undefined;
|
|
191
203
|
const rerunStep = item => ({
|
|
192
204
|
step_id: cleanField(item.step_id, secrets) || null,
|
|
@@ -259,6 +271,12 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
259
271
|
return undefined;
|
|
260
272
|
})() : undefined;
|
|
261
273
|
const stepIndex = Number.isInteger(index) && index >= 0 ? index : Number.isInteger(check?.step_number) && check.step_number >= 1 ? check.step_number - 1 : undefined;
|
|
274
|
+
const effectiveStep = step ?? (typeof check?.step_id === 'string' ? flatStepById.get(check.step_id) : null) ?? null;
|
|
275
|
+
let stepClauses = effectiveStep && stepClauseResults.has(effectiveStep) ? stepClauseResults.get(effectiveStep) : { present: false, valid: [], dropped: 0 };
|
|
276
|
+
if (!stepClauses.present && Array.isArray(check?.clauses)) {
|
|
277
|
+
stepClauses = validateStepClauses(check.clauses, clauseIndex);
|
|
278
|
+
droppedClauseCount += stepClauses.dropped;
|
|
279
|
+
}
|
|
262
280
|
return { criterion_id,
|
|
263
281
|
step_id: cleanField(step?.step_id ?? check?.step_id, secrets) || (stepIndex !== undefined ? cleanField(authoredSteps[stepIndex]?.step_id, secrets) : '') || null,
|
|
264
282
|
criterion_text: typeof criterionTexts[criterion_id] === 'string' && criterionTexts[criterion_id].length <= 160 ? cleanField(criterionTexts[criterion_id], secrets) : null,
|
|
@@ -269,6 +287,7 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
269
287
|
expected: cleanValues(check?.expected, secrets),
|
|
270
288
|
actual: cleanValues(check?.actual, secrets), passed: check?.passed === true,
|
|
271
289
|
normal_result: step ? Object.prototype.hasOwnProperty.call(step, 'result') && !step.error : false,
|
|
290
|
+
...(stepClauses.present ? { clauses: stepClauses.valid } : {}),
|
|
272
291
|
...(diff_summary ? { diff_summary } : {}),
|
|
273
292
|
...(diagnosis ? { diagnosis } : {}) };
|
|
274
293
|
};
|
|
@@ -354,6 +373,9 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
354
373
|
const busyRefusal = outcome.state === 'not_run' && outcome.retryable === true && answer?.command === 'check'
|
|
355
374
|
? rawRefusals.find(item => item?.retryable === true || item?.details?.retryable === true) : null;
|
|
356
375
|
const tokens = tokenUsageOf(answer, { incomplete });
|
|
376
|
+
const clause_warnings = droppedClauseCount > 0
|
|
377
|
+
? [`Warning: dropped ${droppedClauseCount} unknown clause ${droppedClauseCount === 1 ? 'citation' : 'citations'} from the interpreter.`]
|
|
378
|
+
: [];
|
|
357
379
|
return {
|
|
358
380
|
...(compatibility ? { compatibility, client_advice } : {}),
|
|
359
381
|
...(Object.hasOwn(outcome, 'field_agreement') ? { field_agreement: safeEvidence(outcome.field_agreement) } : {}),
|
|
@@ -366,6 +388,7 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
366
388
|
time_limit, checks,
|
|
367
389
|
criteria: results.length ? { passed: results.filter(item => item?.status === 'passed').length, total: results.length } : null,
|
|
368
390
|
all_checks: all, failed_checks, refusals,
|
|
391
|
+
...(droppedClauseCount > 0 ? { dropped_clause_citations: droppedClauseCount, clause_warnings } : {}),
|
|
369
392
|
...(step_details.length && sampleEvidence !== 'flat' && (outcome.state === 'failed' || failed_checks.length > 0 || primarySteps.some(step => typeof step?.verdict === 'string' || Array.isArray(step?.checks))) ? { step_details } : {}),
|
|
370
393
|
...(draft_interfaces.length ? { draft_interfaces } : {}),
|
|
371
394
|
calls: !incomplete ? usageCalls : 'unknown',
|
|
@@ -404,7 +427,14 @@ export function tokenUsageOf(answer, { incomplete = false } = {}) {
|
|
|
404
427
|
const topReport = isObjectLike(answer?.report) ? answer.report : null;
|
|
405
428
|
const surfaces = [answer, usage, result, report, topReport].filter(isObjectLike);
|
|
406
429
|
if (incomplete || surfaces.some(s => Object.hasOwn(s, 'accounting_complete') && s.accounting_complete !== true)) return unknownTokens();
|
|
407
|
-
|
|
430
|
+
const hasPreDispatch = surfaces.some(s => s.dispatch === 'pre-dispatch' || s.dispatch_state === 'pre-dispatch');
|
|
431
|
+
const hasCompleteZeroNotStarted = !hasPreDispatch
|
|
432
|
+
&& surfaces.some(s => s.dispatch === 'not_started')
|
|
433
|
+
&& surfaces.some(s => s.accounting_complete === true)
|
|
434
|
+
&& usage.calls === 0
|
|
435
|
+
&& (usage.unknown_calls === undefined || usage.unknown_calls === 0)
|
|
436
|
+
&& ['passed', 'failed', 'refused'].includes(answer?.state);
|
|
437
|
+
if (hasPreDispatch || (surfaces.some(s => s.dispatch === 'not_started') && !hasCompleteZeroNotStarted)) return unknownTokens();
|
|
408
438
|
if (['input_tokens', 'cached_input_tokens', 'output_tokens'].some(key => malformedToken(usage[key]))) return unknownTokens();
|
|
409
439
|
const uIn = tokenInt(usage.input_tokens), uCached = tokenInt(usage.cached_input_tokens), uOut = tokenInt(usage.output_tokens);
|
|
410
440
|
if (uIn !== undefined && uCached !== undefined && uCached > uIn) return unknownTokens();
|
|
@@ -461,7 +491,7 @@ export function tokenUsageOf(answer, { incomplete = false } = {}) {
|
|
|
461
491
|
muOut = tOut ?? (tIn === 0 && usage.calls === 0 ? 0 : undefined);
|
|
462
492
|
} else return unknownTokens();
|
|
463
493
|
} else if (['passed', 'failed', 'refused'].includes(answer?.state) && usage.calls === 0
|
|
464
|
-
&& uIn === undefined && uCached === undefined && uOut === undefined) {
|
|
494
|
+
&& (uIn === undefined || uIn === 0) && (uCached === undefined || uCached === 0) && (uOut === undefined || uOut === 0)) {
|
|
465
495
|
return { input_tokens: 0, cached_input_tokens: 0, output_tokens: 0, cached_input_share: null };
|
|
466
496
|
}
|
|
467
497
|
const input_tokens = muIn ?? uIn ?? 'unknown';
|
|
@@ -489,7 +519,11 @@ function criterionCoverage(row) {
|
|
|
489
519
|
|
|
490
520
|
export function jsonRow(row) {
|
|
491
521
|
const publicChecks = checks => (checks ?? []).map(({ normal_result, ...check }) => check);
|
|
492
|
-
const
|
|
522
|
+
const unsentZeroTokens = !sentRow(row)
|
|
523
|
+
&& row.input_tokens === undefined && row.cached_input_tokens === undefined && row.output_tokens === undefined
|
|
524
|
+
&& row.accounting_complete !== false && row.state !== 'unknown'
|
|
525
|
+
&& (row.calls === undefined || row.calls === 0);
|
|
526
|
+
const rowTokens = row.cached || unsentZeroTokens
|
|
493
527
|
? { input_tokens: 0, cached_input_tokens: 0, output_tokens: 0, cached_input_share: null }
|
|
494
528
|
: (() => {
|
|
495
529
|
const input_tokens = tokenInt(row.input_tokens) ?? 'unknown';
|
|
@@ -537,8 +571,15 @@ export function renderJson({ batch = null, repo, sourceSha256 = null, coverage,
|
|
|
537
571
|
summary_line: perStory.get(row.story) ?? null,
|
|
538
572
|
}));
|
|
539
573
|
const diagnostic = rows.filter(row=>row.diagnostic_subset === true);
|
|
574
|
+
const mergedWarnings = [...warnings];
|
|
575
|
+
for (const row of rows) {
|
|
576
|
+
for (const text of row.clause_warnings ?? []) {
|
|
577
|
+
const prefixed = row.test ? `${row.test}: ${text}` : text;
|
|
578
|
+
if (!mergedWarnings.includes(text) && !mergedWarnings.includes(prefixed)) mergedWarnings.push(prefixed);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
540
581
|
return { batch, repo, ...(diagnostic.length ? {diagnostic_subset:true,selected_steps:[...new Set(diagnostic.flatMap(row=>row.selected_steps ?? []))]} : {}), ...(coverage ? { coverage } : {}), source_sha256: sourceSha256, exit_code: exitCode, summary_line: line, draft: rows.some(row => row.draft),
|
|
541
|
-
token_usage: batchTokenUsage(publicRows), rows: publicRows, warnings };
|
|
582
|
+
token_usage: batchTokenUsage(publicRows), rows: publicRows, warnings: mergedWarnings };
|
|
542
583
|
}
|
|
543
584
|
|
|
544
585
|
const count = (number, word) => `${number} ${word}${number === 1 ? '' : 's'}`;
|
|
@@ -708,11 +749,15 @@ function checkLines(check, secrets) {
|
|
|
708
749
|
&& (check.normal_result === true || ['no-error', 'needs-tool'].includes(check.diagnosis?.kind));
|
|
709
750
|
const actualValue = noError ? 'no error (a normal result)' : check.actual, actualDisplay = noError ? actualValue : shown(actualValue, secrets);
|
|
710
751
|
const criterion = check.criterion_text ? [` Criterion: ${plainLine(check.criterion_text, secrets)}`] : [];
|
|
752
|
+
const clauseLines = !check.passed && Array.isArray(check.clauses)
|
|
753
|
+
? check.clauses.filter(clause => isObjectLike(clause) && typeof clause.path === 'string' && Number.isSafeInteger(clause.line) && typeof clause.text === 'string')
|
|
754
|
+
.map(clause => ` Prompt (cited by the interpreter): ${cleanField(clause.path, secrets)}:${clause.line} ${plainLine(clause.text, secrets)}`)
|
|
755
|
+
: [];
|
|
711
756
|
const diffLines = diffSummaryLines(check.diff_summary, secrets);
|
|
712
757
|
const refLabel = check.ref_target && check.ref_path !== undefined
|
|
713
758
|
? `${check.op ? `${check.op} ` : ''}${check.ref_target} ${check.ref_path || '/'}${check.ref_json_path ? ` (${check.ref_json_path})` : ''}` : null;
|
|
714
759
|
const fits = [check.expected, check.actual].every(value => oneLine(value) && shown(value, secrets).length <= 80);
|
|
715
|
-
if (fits) return [`${head} expected ${refLabel ? `${refLabel} (${shown(check.expected, secrets)})` : shown(check.expected, secrets)}, got ${actualDisplay}`, ...criterion, ...diffLines];
|
|
760
|
+
if (fits) return [`${head} expected ${refLabel ? `${refLabel} (${shown(check.expected, secrets)})` : shown(check.expected, secrets)}, got ${actualDisplay}`, ...criterion, ...clauseLines, ...diffLines];
|
|
716
761
|
const expected = valueLines(check.expected), actual = valueLines(actualValue);
|
|
717
762
|
// Start 2 lines before the first line where two strings differ, when it is past the first 20.
|
|
718
763
|
const differ = typeof check.expected === 'string' && typeof check.actual === 'string' ? expected.findIndex((text, index) => text !== actual[index]) : -1;
|
|
@@ -721,7 +766,7 @@ function checkLines(check, secrets) {
|
|
|
721
766
|
...lines.slice(from, from + VALUE_LINES).map(text => ` ${plainLine(text, secrets)}`),
|
|
722
767
|
...(lines.length > from + VALUE_LINES ? [` … ${lines.length - from - VALUE_LINES} more lines in the report`] : []),
|
|
723
768
|
...(typeof value === 'string' && value.endsWith('\n') ? [' (ends with a line break)'] : [])];
|
|
724
|
-
return [head, ...criterion, ...diffLines, ...block(refLabel ? `expected (${refLabel})` : 'expected', check.expected, expected), ...block('got', check.actual, actual)];
|
|
769
|
+
return [head, ...criterion, ...clauseLines, ...diffLines, ...block(refLabel ? `expected (${refLabel})` : 'expected', check.expected, expected), ...block('got', check.actual, actual)];
|
|
725
770
|
}
|
|
726
771
|
// With a plain reason (#379): the reason, where and the fix; an AI service failure is not a problem in the test.
|
|
727
772
|
function refusalLines(item, serverNext = false) {
|
|
@@ -827,7 +872,7 @@ export function renderText({ batch, rows, coverage, warnings = [], details = fal
|
|
|
827
872
|
}
|
|
828
873
|
}
|
|
829
874
|
if (reruns.some(item => item.key === null)) lines.push(reruns.find(item => item.key === null).line);
|
|
830
|
-
if (fullFailure) lines.push(...(row.warnings ?? []).map(text => ` ${text}`));
|
|
875
|
+
if (fullFailure) lines.push(...[...new Set([...(row.warnings ?? []), ...(row.clause_warnings ?? [])])].map(text => ` ${text}`));
|
|
831
876
|
const diagnosed = failed.some(check => check.diagnosis?.why || check.diagnosis?.next_step);
|
|
832
877
|
if (!diagnosed && fullFailure && row.next_step && row.why) lines.push(` Why: ${row.why}`);
|
|
833
878
|
if (!diagnosed && fullFailure && row.next_step) lines.push(` Next: ${row.next_step}`);
|
|
@@ -925,7 +970,7 @@ export function renderText({ batch, rows, coverage, warnings = [], details = fal
|
|
|
925
970
|
const width = Math.max(...linked.map(row => row.story.length));
|
|
926
971
|
out.push('Reports (anyone with a link can open it):', ...linked.map(row => ` ${row.story.padEnd(width)} ${row.report_url}${row.draft ? ' (DRAFT)' : ''}`));
|
|
927
972
|
}
|
|
928
|
-
const rest = [...warnings, ...rows.filter(row => row.state !== 'failed').flatMap(row => (row.warnings ?? []).map(text => `${text} (${row.test})`))];
|
|
973
|
+
const rest = [...warnings, ...rows.filter(row => row.state !== 'failed').flatMap(row => [...new Set([...(row.warnings ?? []), ...(row.clause_warnings ?? [])])].map(text => `${text} (${row.test})`))];
|
|
929
974
|
out.push(...rest);
|
|
930
975
|
return `${out.join('\n')}\n`;
|
|
931
976
|
}
|