@promptdriven/runtime-client 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime/agent-chat.mjs +55 -8
- package/src/runtime/index.mjs +32 -1
- package/src/runtime/live-local-bridge.mjs +178 -0
- package/src/runtime/live-local.mjs +181 -0
- package/src/runtime/run-program.mjs +797 -0
- package/src/runtime/runtime-bindings.mjs +22 -12
- package/src/runtime/runtime-check-plan.mjs +1 -1
- package/src/runtime/runtime-client.mjs +2009 -218
- package/src/runtime/runtime-outcome.mjs +63 -2
- package/src/runtime/runtime-output.mjs +46 -8
- package/src/runtime/runtime-preflight.mjs +793 -79
- package/src/runtime/runtime-slots.mjs +75 -4
- package/src/runtime/scenario-json.mjs +167 -1
- package/src/runtime/secret-redaction.mjs +3 -2
- package/src/runtime/try-doors.mjs +425 -59
- package/src/runtime/try-http.mjs +40 -14
- package/src/runtime/try-update-policy.mjs +43 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from prompts/cli/runtime-outcome.prompt.md (sha256:
|
|
1
|
+
// Generated from prompts/cli/runtime-outcome.prompt.md (sha256: 98302ea9052a277f10fe8dec361bc72e0825fc2d5d6d031def30bcc5eb1d67f2).
|
|
2
2
|
// What happened to one selected test: the one place that turns a server answer into an outcome.
|
|
3
3
|
export const PROVIDER_TEXT = 'the AI provider failed during the run. It is not a failed check. Do not send it again yet.';
|
|
4
4
|
export const CHECK_STATES = Object.freeze(['waiting', 'sent', 'passed', 'failed', 'refused', 'partial', 'not run']);
|
|
@@ -27,6 +27,7 @@ export function resultOutcome(row = {}) {
|
|
|
27
27
|
if (row.unsent && row.refusals?.length) { code='broken-test'; state='not run'; }
|
|
28
28
|
if (code === 'broken-test') state = 'not run';
|
|
29
29
|
if (state === 'not run' && (row.retryable === true || row.busy_display) && !['timeout-flag', 'deadline', 'interrupted'].includes(code)) code = 'server-busy';
|
|
30
|
+
if (state === 'passed' && row.diagnostic_subset === true && !row.sample_subset) return {state:'partial',reason:{code:'diagnostic-subset',message:'diagnostic subset, not a full Story pass'}};
|
|
30
31
|
if (state === 'passed') return { state, reason: null };
|
|
31
32
|
const defaults = { waiting: ['awaiting-admission', 'Waiting for admission.'], sent: ['awaiting-server-verdict', 'Sent; waiting for a server verdict.'],
|
|
32
33
|
failed: ['check-failed', 'A check failed.'], refused: ['admission-refused', 'Admission was refused.'],
|
|
@@ -58,12 +59,72 @@ const appMapRefused = (refusals, extra = {}) => {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
// Module function: one outcome for one selected test from one server answer.
|
|
61
|
-
export function outcomeFor(answer, { test, steps = [], appMaps, kind = answer?.command, timeLimit = false, sourceFiles, capacityUncertain = false } = {}) {
|
|
62
|
+
export function outcomeFor(answer, { test, steps = [], appMaps, kind = answer?.command, timeLimit = false, sourceFiles, capacityUncertain = false, sampleEvidence: evidenceView = 'full' } = {}) {
|
|
62
63
|
const outcome = answerOutcome(answer, { test, steps, appMaps, kind, timeLimit, sourceFiles, capacityUncertain });
|
|
63
64
|
if (outcome.state !== 'passed' && !outcome.code) outcome.code = timeLimit ? 'deadline' : resultOutcome(outcome).reason.code;
|
|
65
|
+
if (kind === 'check') Object.assign(outcome, sampleEvidence(answer?.result?.report));
|
|
66
|
+
if (evidenceView === 'flat' && outcome.sample_divergence) {
|
|
67
|
+
const {differences, ...summary} = outcome.sample_divergence;
|
|
68
|
+
outcome.sample_divergence = summary;
|
|
69
|
+
outcome.sample_differences = differences;
|
|
70
|
+
}
|
|
64
71
|
return kind === 'lint' ? { ...outcome, compatibility: selectedCompatibility(answer, test, sourceFiles) } : outcome;
|
|
65
72
|
}
|
|
66
73
|
|
|
74
|
+
// Compare semantic snapshots, never their sibling execution metadata.
|
|
75
|
+
function sampleEvidence(report) {
|
|
76
|
+
if (!report || typeof report !== 'object') return {};
|
|
77
|
+
const evidence = Object.hasOwn(report, 'field_agreement') ? { field_agreement: report.field_agreement } : {};
|
|
78
|
+
const raw = objects(report.samples), requested = Number.isSafeInteger(report.requested_samples) && report.requested_samples > 0
|
|
79
|
+
? report.requested_samples : raw.length;
|
|
80
|
+
if (!(requested > 1 || raw.length > 1)) return evidence;
|
|
81
|
+
const targets = ['result', 'error', 'world', 'calls'], ids = new Set(), order = [];
|
|
82
|
+
let complete = raw.length === requested;
|
|
83
|
+
const samples = raw.map((sample, index) => {
|
|
84
|
+
const id = Number.isSafeInteger(sample.sample) && sample.sample > 0 ? sample.sample : index + 1;
|
|
85
|
+
if (ids.has(id) || id > requested) complete = false;
|
|
86
|
+
ids.add(id);
|
|
87
|
+
const steps = new Map();
|
|
88
|
+
for (const step of objects(sample.steps)) {
|
|
89
|
+
if (typeof step.step_id !== 'string' || !step.step_id || steps.has(step.step_id)) { complete = false; continue; }
|
|
90
|
+
steps.set(step.step_id, step);
|
|
91
|
+
if (!order.includes(step.step_id)) order.push(step.step_id);
|
|
92
|
+
if (!targets.every(target => Object.hasOwn(step, target)) || ['queued', 'running', 'not_run'].includes(step.verdict)) complete = false;
|
|
93
|
+
}
|
|
94
|
+
return { id, steps };
|
|
95
|
+
});
|
|
96
|
+
if (!order.length || samples.some(sample => sample.steps.size !== order.length || order.some(id => !sample.steps.has(id)))) complete = false;
|
|
97
|
+
const differences = [], pointer = key => String(key).replace(/~/g, '~0').replace(/\//g, '~1');
|
|
98
|
+
const equal = values => values.every(value => value.present === values[0].present && (!value.present || canonical(value.value) === canonical(values[0].value)));
|
|
99
|
+
const visit = (step_id, target, path, values) => {
|
|
100
|
+
if (values.length < 2 || equal(values)) return;
|
|
101
|
+
// Recurse through matching containers; unlike objects, array indices retain order.
|
|
102
|
+
if (values.every(item => item.present && object(item.value)) || values.every(item => item.present && Array.isArray(item.value))) {
|
|
103
|
+
const keys = [...new Set(values.flatMap(item => Object.keys(item.value)))].sort();
|
|
104
|
+
for (const key of keys) visit(step_id, target, `${path}/${pointer(key)}`, values.map(item => ({ sample: item.sample,
|
|
105
|
+
present: Object.hasOwn(item.value, key), value: Object.hasOwn(item.value, key) ? item.value[key] : null })));
|
|
106
|
+
} else differences.push({ step_id, target, path, values });
|
|
107
|
+
};
|
|
108
|
+
for (const step_id of order) for (const target of targets) {
|
|
109
|
+
const start = differences.length;
|
|
110
|
+
visit(step_id, target, '', samples.filter(sample => sample.steps.has(step_id)).map(sample => {
|
|
111
|
+
const step = sample.steps.get(step_id), present = Object.hasOwn(step, target);
|
|
112
|
+
return { sample: sample.id, present, value: present ? step[target] : null };
|
|
113
|
+
}));
|
|
114
|
+
const sorted = differences.splice(start).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
115
|
+
differences.push(...sorted);
|
|
116
|
+
}
|
|
117
|
+
let varied = false;
|
|
118
|
+
for (const row of objects(report.field_agreement)) {
|
|
119
|
+
if (row.unavailable_samples > 0 || row.fields_truncated === true || row.fields_truncated > 0 || row.result_samples < row.requested_samples) complete = false;
|
|
120
|
+
for (const field of objects(row.fields)) {
|
|
121
|
+
varied ||= field.status === 'varied';
|
|
122
|
+
if (['incomplete', 'redacted', 'truncated', 'single-sample'].includes(field.status) || field.missing_samples > 0 || field.other_samples > 0) complete = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { ...evidence, sample_divergence: { advisory: true, divergent: differences.length > 0 || varied, complete, samples: requested, differences } };
|
|
126
|
+
}
|
|
127
|
+
|
|
67
128
|
function answerOutcome(answer, { test, steps, appMaps, kind, timeLimit, sourceFiles, capacityUncertain }) {
|
|
68
129
|
const result = answer?.result, report = result?.report;
|
|
69
130
|
if (timeLimit) return { state: 'unknown', reason: 'The step was stopped at its time limit.' };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from prompts/cli/runtime-output.prompt.md (sha256:
|
|
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
4
|
import { failedCheckCount, hasProgress, outcomeFor, outcomeText, progressText, providerText, resultOutcome, PROVIDER_TEXT } from './runtime-outcome.mjs';
|
|
@@ -22,6 +22,20 @@ export function progressTicker(stream, now, everyMs = 15_000) {
|
|
|
22
22
|
}
|
|
23
23
|
// The real reason of a tool or server error: its first line, without control characters, secrets or tokens.
|
|
24
24
|
const TOKENS = /\b(?:gh[pousr]_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|sk-[A-Za-z0-9_-]{12,})\b|Bearer\s+\S+/g;
|
|
25
|
+
// Advisory strings are semantic JSON evidence; tabs, CR/LF and spaces remain data.
|
|
26
|
+
function cleanEvidenceString(value, secrets = []) {
|
|
27
|
+
let text = String(value ?? '')
|
|
28
|
+
.replace(/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)/g, '')
|
|
29
|
+
.replace(/(?:\x1b[P^_]|[\x90\x98\x9e\x9f])[\s\S]*?(?:\x1b\\|\x9c|$)/g, '')
|
|
30
|
+
.replace(/(?:\x1b\[|\x9b)[0-?]*[ -/]*[@-~]/g, '').replace(/\x1b[ -/]*[@-~]/g, '')
|
|
31
|
+
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, ' ');
|
|
32
|
+
for (const secret of secrets) if (secret) text = text.split(secret).join('[secret]');
|
|
33
|
+
return text.replace(TOKENS, '[secret]');
|
|
34
|
+
}
|
|
35
|
+
const evidenceLabel = (value, secrets) => {
|
|
36
|
+
const text = cleanEvidenceString(value, secrets);
|
|
37
|
+
return /\s/.test(text) ? JSON.stringify(text) : text;
|
|
38
|
+
};
|
|
25
39
|
export const causeText = (value, secrets = []) => (String(value ?? '').split(/\r?\n/).map(text => cleanField(text, secrets)).find(Boolean) ?? '')
|
|
26
40
|
.replace(TOKENS, '[secret]').slice(0, 300);
|
|
27
41
|
const shown = (value, secrets) => cleanField(JSON.stringify(value) ?? 'nothing', secrets);
|
|
@@ -146,9 +160,12 @@ function predecessorErrors(refusal, report, steps, secrets) {
|
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
// The parts of a server answer that pdd shows.
|
|
149
|
-
export function projectAnswer(answer, { origin, secrets = [], steps: authoredSteps = [], criterionTexts = {}, test, sourceFiles, capacityUncertain = false } = {}) {
|
|
163
|
+
export function projectAnswer(answer, { origin, secrets = [], steps: authoredSteps = [], criterionTexts = {}, test, sourceFiles, capacityUncertain = false, sampleEvidence = 'full' } = {}) {
|
|
150
164
|
const result = answer?.result ?? null, report = result?.report ?? null, time_limit = stepTimeLimit(answer, { steps: authoredSteps, secrets });
|
|
151
|
-
const outcome = outcomeFor(answer, { test, steps: authoredSteps, timeLimit: !!time_limit, sourceFiles, capacityUncertain });
|
|
165
|
+
const outcome = outcomeFor(answer, { test, steps: authoredSteps, timeLimit: !!time_limit, sourceFiles, capacityUncertain, sampleEvidence });
|
|
166
|
+
const safeEvidence = value => typeof value === 'string' ? cleanEvidenceString(value, secrets)
|
|
167
|
+
: Array.isArray(value) ? value.map(safeEvidence)
|
|
168
|
+
: isObjectLike(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [cleanEvidenceString(key, secrets), safeEvidence(item)])) : value;
|
|
152
169
|
const safeCompatibility = (value, key = '') => typeof value === 'string'
|
|
153
170
|
? /^(?:path|prompt_path|target_path)$/.test(key) && /^(?:\/|[A-Za-z]:[\\/])/.test(value) ? '<server path>' : cleanText(value, secrets).replace(TOKENS, '[secret]')
|
|
154
171
|
: Array.isArray(value) ? value.map(item => safeCompatibility(item, key))
|
|
@@ -257,6 +274,9 @@ export function projectAnswer(answer, { origin, secrets = [], steps: authoredSte
|
|
|
257
274
|
const tokens = tokenUsageOf(answer, { incomplete });
|
|
258
275
|
return {
|
|
259
276
|
...(compatibility ? { compatibility, client_advice } : {}),
|
|
277
|
+
...(Object.hasOwn(outcome, 'field_agreement') ? { field_agreement: safeEvidence(outcome.field_agreement) } : {}),
|
|
278
|
+
...(outcome.sample_divergence ? { sample_divergence: safeEvidence(outcome.sample_divergence) } : {}),
|
|
279
|
+
...(Object.hasOwn(outcome, 'sample_differences') ? { sample_differences: safeEvidence(outcome.sample_differences) } : {}),
|
|
260
280
|
busy_display: busyRefusal ? { max_wait_seconds: busyRefusal.max_wait_seconds } : null,
|
|
261
281
|
state: outcome.state, ...(outcome.progress ? { progress: { ...outcome.progress, ...(typeof outcome.progress.step === 'string' ? { step: cleanText(outcome.progress.step, secrets) } : {}) } } : {}),
|
|
262
282
|
...(outcome.ahead !== undefined ? { ahead: outcome.ahead } : {}),
|
|
@@ -387,7 +407,7 @@ export function jsonRow(row) {
|
|
|
387
407
|
if (typeof input_tokens === 'number' && typeof cached_input_tokens === 'number' && cached_input_tokens > input_tokens) return unknownTokens();
|
|
388
408
|
return { input_tokens, cached_input_tokens, output_tokens, cached_input_share: shareOf(input_tokens, cached_input_tokens) };
|
|
389
409
|
})();
|
|
390
|
-
return { story: row.story, title: row.title, test: row.test, ...(row.native_only?.length ? {native_only:row.native_only} : {}), ...resultOutcome(row), ...(row.unsent ? {unsent:true} : {}), ...(row.not_checked?.length ? {not_checked:row.not_checked} : {}), ...(row.binding_plan ? {binding_plan:row.binding_plan,binding_diagnostics:bindingRefusals(row.binding_plan,row.compatibility)} : {}), ...(row.compatibility ? { compatibility: row.compatibility, client_advice: row.client_advice } : {}), criterion_coverage: criterionCoverage(row), ...(row.progress ? { progress: row.progress } : {}), ...(row.ahead !== undefined && row.ahead !== null ? { ahead: row.ahead } : {}), checks: row.checks ?? null, criteria: row.criteria ?? null,
|
|
410
|
+
return { story: row.story, title: row.title, test: row.test, ...(row.diagnostic_subset === true ? {diagnostic_subset:true,selected_steps:row.selected_steps ?? []} : {}), ...(row.native_only?.length ? {native_only:row.native_only} : {}), ...resultOutcome(row), ...(row.unsent ? {unsent:true} : {}), ...(row.not_checked?.length ? {not_checked:row.not_checked} : {}), ...(row.binding_plan ? {binding_plan:row.binding_plan,binding_diagnostics:bindingRefusals(row.binding_plan,row.compatibility)} : {}), ...(row.compatibility ? { compatibility: row.compatibility, client_advice: row.client_advice } : {}), criterion_coverage: criterionCoverage(row), ...(row.progress ? { progress: row.progress } : {}), ...(row.ahead !== undefined && row.ahead !== null ? { ahead: row.ahead } : {}), checks: row.checks ?? null, criteria: row.criteria ?? null,
|
|
391
411
|
failed_checks: publicChecks(row.failed_checks), refusals: (row.refusals ?? []).map(item => ({ code: item.code, ...(item.path ? { path: item.path } : {}), field: item.field ?? null, section: item.section ?? null,
|
|
392
412
|
message: item.message ?? null, engine_message: item.engine_message ?? null, hint: item.hint ?? null, reason: item.reason ?? null, fix: item.fix ?? null,
|
|
393
413
|
where: item.where ?? null, cause: item.cause ?? null,
|
|
@@ -398,6 +418,10 @@ export function jsonRow(row) {
|
|
|
398
418
|
request_id: row.request_ids?.at(-1) ?? null, draft: !!row.draft, busy: !!row.busy, can_retry: !!row.can_retry, time_limit: row.time_limit ?? null,
|
|
399
419
|
why: row.why ?? null, who: row.who ?? null, next_step: row.next_step ?? null,
|
|
400
420
|
rerun: row.rerun ?? null, ...(typeof row.cache_reason === 'string' ? { cache_reason: row.cache_reason } : {}), ...(row.cached ? { cached: true, passed_at: row.passed_at } : {}),
|
|
421
|
+
...(Object.hasOwn(row, 'field_agreement') ? { field_agreement: row.field_agreement } : {}),
|
|
422
|
+
...(row.sample_divergence ? { sample_divergence: row.sample_divergence } : {}),
|
|
423
|
+
...(Object.hasOwn(row, 'sample_differences') ? { sample_differences: row.sample_differences } : {}),
|
|
424
|
+
...(row.diagnostic || row.diagnostic_subset ? { diagnostic: true, diagnostic_subset: true, selected_steps: row.selected_steps ?? [] } : {}),
|
|
401
425
|
...resultOutcome(row) };
|
|
402
426
|
}
|
|
403
427
|
|
|
@@ -416,7 +440,8 @@ export function renderJson({ batch = null, repo, sourceSha256 = null, coverage,
|
|
|
416
440
|
line = line ?? summaryLine(rows, null, ports);
|
|
417
441
|
const perStory = new Map(storyLines(rows, ports).map(([story, text]) => [story, text]));
|
|
418
442
|
const publicRows = rows.map(row => ({ ...jsonRow(row), summary_line: perStory.get(row.story) ?? null }));
|
|
419
|
-
|
|
443
|
+
const diagnostic = rows.filter(row=>row.diagnostic_subset === true);
|
|
444
|
+
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),
|
|
420
445
|
token_usage: batchTokenUsage(publicRows), rows: publicRows, warnings };
|
|
421
446
|
}
|
|
422
447
|
|
|
@@ -451,8 +476,10 @@ export function summaryLine(rows, story = null, ports = {}) {
|
|
|
451
476
|
const labels = rows.filter(row => row.state !== 'passed').map(row => outcomeText({ ...row, progress: undefined, ahead: undefined }));
|
|
452
477
|
const others = [...new Set(labels)].map(label => `${labels.filter(value => value === label).length} ${label}`);
|
|
453
478
|
// A cross for any failed row or failed check; a check without failures that still runs or has no verdict says so (cli 12b).
|
|
479
|
+
const diagnostic = rows.some(row=>row.diagnostic_subset === true);
|
|
454
480
|
const mark = rows.some(row => row.state === 'failed' || failedCheckCount(row) > 0) ? '✗'
|
|
455
|
-
:
|
|
481
|
+
: diagnostic ? 'diagnostic subset, not a full Story pass ·'
|
|
482
|
+
: rows.length && rows.every(row => row.state === 'passed' && !row.diagnostic && !row.diagnostic_subset) ? '✓'
|
|
456
483
|
: rows.some(row => OPEN_STATES.has(row.state)) ? 'running ·'
|
|
457
484
|
: rows.some(row => row.busy && ['not_run', 'not run'].includes(row.state)) && rows.every(row => row.state === 'passed' || (row.busy && ['not_run', 'not run'].includes(row.state))) ? 'busy ·' : 'no verdict ·';
|
|
458
485
|
const rerunShare = rerunCalls ? `${rerunCalls} for reruns` : '';
|
|
@@ -460,7 +487,7 @@ export function summaryLine(rows, story = null, ports = {}) {
|
|
|
460
487
|
const skipped = rows.some(row => row.cached) ? [count(new Set(rows.filter(row => row.cached).map(row => row.story_path ?? row.story)).size, 'Story').replace('Storys', 'Stories') + ' skipped'] : [];
|
|
461
488
|
const broken = rows.filter(row=>row.unsent).length, unchecked = rows.reduce((n,row)=>n+(row.not_checked?.length??0),0);
|
|
462
489
|
return [`${labelText}${story ? ` (${story})` : ''}${rows.some(row => row.draft) ? ' (DRAFT)' : ''}: ${mark} ${criteriaText}`,
|
|
463
|
-
`${checks.passed}/${checks.total} checks`, ...(extraFailed > 0 ? [`${extraFailed} failed`] : []), ...(broken ? [`${broken} tests could not run`] : []), ...(unchecked ? [`${unchecked} criteria not checked; the Story is not a full pass`] : []), ...(progress ? [progress] : []), ...others, ...skipped, ...(progress && !sent.length ? [] : [`${usage}${unknownCalls ? ` + ${unknownCalls} unknown` : ''}`])].join(' · ');
|
|
490
|
+
...(diagnostic ? [`selected steps: ${[...new Set(rows.flatMap(row=>row.selected_steps ?? []))].join(', ')}`, ...(mark.startsWith('diagnostic') ? [] : ['diagnostic subset, not a full Story pass'])] : []), `${checks.passed}/${checks.total} checks`, ...(extraFailed > 0 ? [`${extraFailed} failed`] : []), ...(broken ? [`${broken} tests could not run`] : []), ...(unchecked ? [`${unchecked} criteria not checked; the Story is not a full pass`] : []), ...(progress ? [progress] : []), ...others, ...skipped, ...(progress && !sent.length ? [] : [`${usage}${unknownCalls ? ` + ${unknownCalls} unknown` : ''}`])].join(' · ');
|
|
464
491
|
}
|
|
465
492
|
|
|
466
493
|
const shellWord = word => /^[A-Za-z0-9_./:@%+=,-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
|
|
@@ -643,6 +670,17 @@ export function renderText({ batch, rows, coverage, warnings = [], details = fal
|
|
|
643
670
|
out.push(`UNKNOWN ${row.title}: ${providerText(row)}`, ` ${row.provider.code}${row.provider.detail ? ` (${row.provider.detail})` : ''}${row.report_url ? ` Report: ${row.report_url}` : ''}`,
|
|
644
671
|
...(row.next_step ? [] : [' To try again, run `pdd test` again (a new request).']), ...serverAdvice(row, secrets));
|
|
645
672
|
}
|
|
673
|
+
for (const row of rows.filter(row => row.sample_divergence)) {
|
|
674
|
+
const evidence = row.sample_divergence;
|
|
675
|
+
if (evidence.divergent) {
|
|
676
|
+
out.push(`Sample divergence (advisory): ${cleanText(row.title, secrets)}`);
|
|
677
|
+
for (const difference of evidence.differences) out.push(` ${evidenceLabel(difference.step_id, secrets)} ${difference.target} ${evidenceLabel(difference.path, secrets) || '""'}`,
|
|
678
|
+
` ${difference.values.map(item => `Sample ${item.sample}: ${item.present ? shown(item.value, secrets) : 'missing'}`).join('; ')}`);
|
|
679
|
+
for (const agreement of row.field_agreement ?? []) for (const field of agreement.fields ?? []) if (field.status === 'varied') out.push(
|
|
680
|
+
` ${evidenceLabel(agreement.step_id, secrets)} result ${evidenceLabel(field.path, secrets) || '""'}: ${field.buckets.map(bucket => `${shown(bucket.value, secrets)} (${bucket.count})`).join('; ')}`);
|
|
681
|
+
}
|
|
682
|
+
if (!evidence.complete) out.push('Sample comparison incomplete; agreement is unknown.');
|
|
683
|
+
}
|
|
646
684
|
if (details) for (const row of rows.filter(row => row.all_checks?.length || !row.cached && formatPromptCacheTokens(row))) {
|
|
647
685
|
const tokenText = !row.cached ? formatPromptCacheTokens(row) : null;
|
|
648
686
|
out.push(`Checks for ${row.title} (${row.test}):`,
|
|
@@ -665,7 +703,7 @@ export function renderText({ batch, rows, coverage, warnings = [], details = fal
|
|
|
665
703
|
}).text.split('\n'));
|
|
666
704
|
if (coverage) out.push(coverageText(coverage, {busy: rows.some(row => row.busy_display || row.busy) && rows.every(row => row.state === 'passed' || row.busy_display || row.busy)}));
|
|
667
705
|
const models = [...new Set(rows.map(row => row.requested_model).filter(Boolean))];
|
|
668
|
-
out.push(`${rows.filter(row => row.state === 'passed').length} of ${rows.length} stories passed.${models.length ? ` Model asked for: ${models.join(', ')}.` : ''}`);
|
|
706
|
+
out.push(`${rows.filter(row => resultOutcome(row).state === 'passed').length} of ${rows.length} stories passed.${models.length ? ` Model asked for: ${models.join(', ')}.` : ''}`);
|
|
669
707
|
const activeRows = rows.filter(row => !row.cached);
|
|
670
708
|
const cacheRows = activeRows.filter(row => formatPromptCacheTokens(row) !== null);
|
|
671
709
|
if (cacheRows.length) {
|