Enforce runtime report contracts and recoverable session exports
This commit is contained in:
@@ -388,6 +388,7 @@ async function openRunDialog(pipeline) {
|
||||
prompt: "",
|
||||
workspace: String(state.workspace ?? "").startsWith("/") ? state.workspace : "",
|
||||
notifyMode: "auto",
|
||||
outputFormat: "",
|
||||
directories: [],
|
||||
loading: true,
|
||||
sending: false,
|
||||
@@ -445,6 +446,7 @@ async function startRun() {
|
||||
prompt,
|
||||
workspace: start.workspace,
|
||||
notifyMode: start.notifyMode,
|
||||
outputFormat: start.outputFormat,
|
||||
title: "",
|
||||
});
|
||||
}
|
||||
@@ -545,6 +547,18 @@ function renderRunStartDialog() {
|
||||
notifyField.append(notify);
|
||||
panel.append(notifyField);
|
||||
|
||||
const outputField = h("label", { class: "run-start-field", for: "runOutputFormat" });
|
||||
outputField.append(h("span", { class: "run-start-label", text: "Report format" }));
|
||||
const outputFormat = h("select", { id: "runOutputFormat", onchange: (event) => { start.outputFormat = event.target.value; } });
|
||||
for (const [value, label] of [["", "No report requirement"], ["html", "HTML report"], ["markdown", "Markdown report"]]) {
|
||||
const option = h("option", { value, text: label });
|
||||
option.selected = start.outputFormat === value;
|
||||
outputFormat.append(option);
|
||||
}
|
||||
outputField.append(outputFormat);
|
||||
outputField.append(h("span", { class: "run-start-helper muted", text: "Requires a nonempty server-written report before success. Structure only; facts are not verified." }));
|
||||
panel.append(outputField);
|
||||
|
||||
if (start.loading) panel.append(h("div", { class: "run-start-helper muted", text: "Loading directories…" }));
|
||||
if (start.error) panel.append(h("div", { class: "run-start-error", role: "alert", text: start.error }));
|
||||
|
||||
|
||||
@@ -1294,8 +1294,21 @@ function artifactAction(kind, label, disabled, onclick) {
|
||||
function renderSessionExport(step) {
|
||||
const file = sessionExportArtifact(step);
|
||||
const wrap = h("div", { class: "session-export" });
|
||||
for (const repair of step?.session_export_repairs || []) {
|
||||
const row = h("div", { class: "session-export-repair" });
|
||||
row.append(h("span", { text: `Repair: ${repair.status || "partial"} · ${repair.messages || 0} messages. ${repair.diagnostic || ""}` }));
|
||||
const repaired = sessionExportArtifact({ ...step, session_export: repair });
|
||||
const repairedHref = repaired && resolvedArtifactUrl(repaired, state.url);
|
||||
if (repairedHref) row.append(h("a", { href: repairedHref, target: "_blank", rel: "noreferrer", text: "Open repaired export" }));
|
||||
wrap.append(row);
|
||||
}
|
||||
const evidence = step?.session_export;
|
||||
const incomplete = evidence && (evidence.status && evidence.status !== "complete" || !evidence.messages || evidence.truncated || evidence.diagnostic);
|
||||
if (incomplete) {
|
||||
wrap.append(h("span", { class: "muted", text: `Session recorded, but export ${evidence.status || (!evidence.messages ? "empty" : "partial")}. Full session evidence was not captured.${evidence.diagnostic ? ` ${evidence.diagnostic}` : ""}` }));
|
||||
}
|
||||
if (!file) {
|
||||
wrap.append(h("span", { class: "muted", text: "No session was exported for this visit." }));
|
||||
if (!incomplete) wrap.append(h("span", { class: "muted", text: step?.session_id ? "Session recorded, but export failed or was not captured." : "No session was exported for this visit." }));
|
||||
return wrap;
|
||||
}
|
||||
const href = resolvedArtifactUrl(file, state.url);
|
||||
|
||||
Reference in New Issue
Block a user