@@ -147,31 +139,108 @@ export function GoalSourceStrategies({goalId, originalGoalId, sourceUrl, zh, sel
: null}
{!items.length ?
{zh ? "原 Goal 没有保留策略记录。" : "The original Goal has no retained strategy records."}
: !selected && selection !== "all" ?
{zh ? "原来源中找不到所选版本。可选择其他记录。" : "The selected version is absent from this source. Other records remain readable."}
: null}
- {selected ?
- · {selected.agent_id}
- {prose(zh ? "当时的目标" : "Goal at the time", patch.vision_summary)}
- {prose(zh ? "验收条件" : "Acceptance", patch.acceptance_summary)}
- {prose(zh ? "原先的判断" : "Prior assumption", path.prior_assumption)}
- {prose(zh ? "当时观察" : "Recorded observation", path.observed_reality)}
- {list(zh ? "改变" : "Changed", path.changed)}
- {list(zh ? "保留" : "Retained", path.retained)}
- {list(zh ? "停止" : "Stopped", path.stopped)}
- {list(zh ? "未解问题" : "Unresolved questions", path.unresolved_questions)}
- {prose(zh ? "再次进入的条件" : "Reentry condition", path.reentry_condition)}
- {Object.keys(probe).length ? {zh ? "当时的后续计划" : "Recorded next plan"}
{Object.entries(nextLabels).map(([key, label]) => typeof probe[key] === "string" && probe[key]
- ? : null)}
: null}
- {prose(zh ? "对上轮的记录性回顾" : "Recorded review of the previous decision", review.lesson)}
- {list(zh ? "依据引用" : "Evidence references", path.evidence_refs)}
- {zh ? "完整原始记录与来源" : "Complete original record and source"}
-
-
- {JSON.stringify(selected, null, 2)}
-
- : null}
+ {selected ?
: null}
> : null}
;
}
+/** Read-only rendering shared by strategy history and native execution records. */
+export function GoalStrategyDocument({value, recordedAt, agentId, version, originalGoalId, namespace, zh, originalRecord, executionRecord = false}: {
+ originalRecord?: unknown; executionRecord?: boolean;
+ value: Record; recordedAt: string; agentId?: string; version: string;
+ originalGoalId: string; namespace: string; zh: boolean;
+}) {
+ const additional = {...value};
+ const time = (stamp: string) => Number.isFinite(Date.parse(stamp))
+ ? new Intl.DateTimeFormat(zh ? "zh-CN" : "en", {dateStyle: "medium", timeStyle: "medium"}).format(new Date(stamp))
+ : (zh ? "时间未记录" : "Time not recorded");
+ const prose = (label: string, fields: Record, key: string) => {
+ const text = readDecisionText(fields, key);
+ return text ? : null;
+ };
+ const list = (label: string, fields: Record, key: string) => {
+ const items = fields[key];
+ if (!Array.isArray(items) || !items.length) return null;
+ delete fields[key];
+ return {label}
{items.map((item, i) => -
+ {typeof item === "string" ? :
{JSON.stringify(item, null, 2)}}
+ )}
;
+ };
+ const nextLabels = zh ? {scope: "范围", prediction: "预期", adoption_criterion: "采用条件", cost_bound: "成本边界", minimum_evidence: "所需依据"}
+ : {scope: "Scope", prediction: "Prediction", adoption_criterion: "Adoption criterion", cost_bound: "Cost bound", minimum_evidence: "Required evidence"};
+ const objectives = readDecisionSection(additional, "vision_patch", patch => <>
+ {prose(zh ? "当时的目标" : "Goal at the time", patch, "vision_summary")}
+ {prose(zh ? "验收条件" : "Acceptance", patch, "acceptance_summary")}
+ >);
+ const path = readDecisionSection(additional, "path_delta", path => <>
+ {prose(zh ? "原先的判断" : "Prior assumption", path, "prior_assumption")}
+ {prose(zh ? "当时观察" : "Recorded observation", path, "observed_reality")}
+ {list(zh ? "改变" : "Changed", path, "changed")}
+ {list(zh ? "保留" : "Retained", path, "retained")}
+ {list(zh ? "停止" : "Stopped", path, "stopped")}
+ {list(zh ? "未解问题" : "Unresolved questions", path, "unresolved_questions")}
+ {prose(zh ? "再次进入的条件" : "Reentry condition", path, "reentry_condition")}
+ {list(zh ? "依据引用" : "Evidence references", path, "evidence_refs")}
+ >);
+ const stride = readDecisionSection(additional, "stride_decision", stride => <>
+ {readDecisionSection(stride, "next_probe", probe => {
+ const rows = Object.entries(nextLabels).flatMap(([key, label]) => {
+ const text = readDecisionText(probe, key);
+ return text ? [] : [];
+ });
+ return rows.length ? {zh ? "当时的后续计划" : "Recorded next plan"}
{rows}
: null;
+ })}
+ {readDecisionSection(stride, "previous_review", review =>
+ prose(zh ? "对上轮的记录性回顾" : "Recorded review of the previous decision", review, "lesson"))}
+ >);
+ return
+ {agentId ? ` · ${agentId}` : ""}
+ {objectives}
+ {path}
+ {stride}
+ {Object.keys(additional).length ? {zh ? "其他决策字段" : "Additional decision fields"}
+
+ : null}
+ {zh ? "完整原始记录与来源" : "Complete original record and source"}
+
+
+ {JSON.stringify(originalRecord ?? value, null, 2)}
+
+ ;
+}
+
+function readDecisionText(fields: Record, key: string) {
+ const text = fields[key];
+ if (typeof text !== "string" || !text) return null;
+ delete fields[key];
+ return text;
+}
+
+// The structured view consumes fields from a private copy. Keep unsupported
+// shapes and unrendered keys in the disclosure without changing the source record.
+function readDecisionSection(fields: Record, key: string,
+ render: (section: Record) => ReactNode) {
+ const section = {...record(fields[key])};
+ const hasFields = Object.keys(section).length > 0;
+ const content = render(section);
+ if (hasFields) {
+ if (Object.keys(section).length) fields[key] = section;
+ else delete fields[key];
+ }
+ return content;
+}
+
+// Unknown optional fields remain readable without treating them as executable markup.
+function NativeDecisionFields({value}: {value: unknown}) {
+ if (typeof value === "string") return ;
+ if (Array.isArray(value)) return {value.map((item, index) => )}
;
+ if (value !== null && typeof value === "object") return {Object.entries(value).map(([key, item]) =>
+ - {key}
)}
;
+ return {value === null ? "null" : String(value)};
+}
+
function FragmentField({label, value}: {label: string; value: string}) {
return {label}{value};
}
diff --git a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx
index 71e75b04b5..382758adf0 100644
--- a/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx
+++ b/apps/presentation/dashboard/src/features/personal-workspace/i18n.tsx
@@ -380,6 +380,16 @@ const en = {
"drawer.completedAt": "Completed at",
"drawer.validationRevisionActor": "Revised by",
"drawer.noExecutionHistory": "No execution history yet.",
+ "drawer.sourceRunHistory": "Historical executions",
+ "drawer.sourceRunDecisionUnavailable": "No complete decision was retained in this execution record.",
+ "drawer.sourceRunRecent": "{shown} recent records",
+ "drawer.sourceRunCount": "Showing {shown} recent records of {count}",
+ "drawer.sourceRunOriginalGoal": "Original Goal",
+ "drawer.sourceRunOriginalTurn": "Original turn",
+ "drawer.sourceRunRecordType": "Record type",
+ "drawer.sourceRunCheckpoint": "Strategy checkpoint",
+ "drawer.sourceRunUnrecorded": "Unrecorded",
+ "drawer.sourceRunUnavailable": "Historical execution records are unavailable.",
"drawer.noRun": "Execution Session has not started",
"drawer.noRunDescription": "Run records will appear here after an Agent starts execution.",
"drawer.notAssigned": "Unassigned",
@@ -2007,6 +2017,16 @@ const zhCN: Record = {
"drawer.completedAt": "完成时间",
"drawer.validationRevisionActor": "修订者",
"drawer.noExecutionHistory": "暂无执行记录。",
+ "drawer.sourceRunHistory": "历史执行",
+ "drawer.sourceRunDecisionUnavailable": "这条执行记录未保留完整决策正文。",
+ "drawer.sourceRunRecent": "最近 {shown} 条记录",
+ "drawer.sourceRunCount": "显示最近 {shown} 条,共 {count} 条",
+ "drawer.sourceRunOriginalGoal": "原 Goal",
+ "drawer.sourceRunOriginalTurn": "原回合",
+ "drawer.sourceRunRecordType": "记录类型",
+ "drawer.sourceRunCheckpoint": "策略检查点",
+ "drawer.sourceRunUnrecorded": "未记录",
+ "drawer.sourceRunUnavailable": "原始执行记录暂不可读。",
"drawer.noRun": "尚未启动执行 Session",
"drawer.noRunDescription": "Agent 开始执行后,运行记录会稳定显示在这里。",
"drawer.notAssigned": "未分配",
diff --git a/apps/presentation/dashboard/src/features/personal-workspace/native-decision-read.test.mjs b/apps/presentation/dashboard/src/features/personal-workspace/native-decision-read.test.mjs
new file mode 100644
index 0000000000..b02a187bd4
--- /dev/null
+++ b/apps/presentation/dashboard/src/features/personal-workspace/native-decision-read.test.mjs
@@ -0,0 +1,126 @@
+import assert from "node:assert/strict";
+import React from "react";
+import {renderToStaticMarkup} from "react-dom/server";
+import {runRecordSchema} from "../../data/status";
+import {ContextDrawer} from "./context-drawer";
+import {GoalStrategyDocument} from "./goal-source-strategies";
+import {WorkspaceI18nProvider} from "./i18n";
+import {projectGoalSourceStatus} from "../../../../../../loopx/control_plane/presentation/goal_source_links.ts";
+const base = {goal_id:"archived", generated_at:"2026-01-01T00:00:00Z"};
+for (const agent_vision of [undefined, null, [], "invalid", 42]) {
+ assert.equal(runRecordSchema.parse({...base, agent_vision}).agent_vision ?? null, null);
+}
+const value = {vision_patch:{vision_summary:"Retain the independently verified baseline", future_context:"Preserve the recorded caveat"},
+ path_delta:{observed_reality:"The new route failed", unresolved_questions:["Cost remains unknown"]},
+ stride_decision:{
+ axes:{work_slice:{plan:"Compare before replacing",reason:"Preserve the counterexample"}},
+ next_probe:{scope:"Compare both original routes", future_scope:{seen:0, accepted:false}},
+ previous_review:{lesson:"The earlier record did not verify adoption", future_review:"Retain the limitation"},
+ },
+ future_field:{unknown_key:"Keep future evidence readable"}};
+const parsed = runRecordSchema.parse({...base, agent_vision:value});
+assert.deepEqual(parsed.agent_vision,value);
+for (const zh of [true,false]) {
+ const html = renderToStaticMarkup(React.createElement(GoalStrategyDocument, {
+ value:parsed.agent_vision,recordedAt:base.generated_at,version:"retained-version",
+ originalGoalId:"original-goal",namespace:"source-a",zh,
+ }));
+ for (const text of ["Retain the independently verified baseline","The new route failed","Compare before replacing",
+ "Preserve the counterexample","Keep future evidence readable","original-goal","source-a","retained-version"]) assert.ok(html.includes(text),text);
+ const [reading, raw] = html.split('');
+ for (const text of [value.vision_patch.vision_summary, value.path_delta.observed_reality,
+ value.path_delta.unresolved_questions[0], value.stride_decision.next_probe.scope, value.stride_decision.previous_review.lesson]) {
+ assert.equal(reading.split(text).length - 1, 1, `Repeat-free reading for ${text}`);
+ assert.ok(raw.includes(text), `Complete original record for ${text}`);
+ }
+ const extraFields = reading.match(/(?:其他决策字段|Additional decision fields)<\/summary>(.*?)<\/details>/s)?.[1] ?? "";
+ for (const text of ["Preserve the recorded caveat","Compare before replacing","Retain the limitation","Keep future evidence readable"]) {
+ assert.ok(extraFields.includes(text), `Additional native field remains readable: ${text}`);
+ }
+ assert.match(extraFields, /seen<\/dt>0<\/span>/);
+ assert.match(extraFields, /accepted<\/dt>false<\/span>/);
+ assert.deepEqual(parsed.agent_vision, value, "Reading the document does not mutate the decision");
+}
+const structuredOnly = renderToStaticMarkup(React.createElement(GoalStrategyDocument, {
+ value:{vision_patch:{vision_summary:"An entirely structured decision"}},
+ recordedAt:base.generated_at,version:"retained-version",originalGoalId:"original-goal",namespace:"source-a",zh:false,
+}));
+assert.equal((structuredOnly.match(/ renderToStaticMarkup(
+ React.createElement(WorkspaceI18nProvider, null, React.createElement(ContextDrawer, {
+ agents: [], callbacks: {}, goals, onClose: () => {}, selection,
+ })),
+);
+const diagnosticsTrigger = /