展示 INI 面板 shell workflow session readiness

This commit is contained in:
2026-06-16 06:52:38 +08:00
parent 68ff2fb5d6
commit eb50e6b455
6 changed files with 120 additions and 14 deletions

View File

@@ -293,8 +293,8 @@ the expected handoff status fields as a structured ready/blocked result. Use
`createIniPanelShellSessionHandoffWorkflowSummary()` or
`linuxCncIniPanelLaunchApi.getShellSessionHandoffWorkflowSummary()` when an
outer shell needs one stable end-to-end summary that combines mount workflow,
control-page mount workflow, readonly status result, and current blocking
reasons into display rows. Use
control-page mount workflow, readonly status result, machine-session
ready/blocked state, and current blocking reasons into display rows. Use
`createIniPanelShellSessionHandoffWorkflowDisplayViewModel()` or
`linuxCncIniPanelLaunchApi.getShellSessionHandoffWorkflowDisplayViewModel()`
when an outer shell needs that end-to-end summary compressed into stable

View File

@@ -1427,6 +1427,15 @@ export function createIniPanelShellSessionHandoffWorkflowSummary({
missingStatusFields: [],
},
} = {}) {
const sessionReadiness = readonlyStatusResult?.readonlyStatus?.sessionReadiness ?? null;
const sessionReadinessMissing = Array.isArray(sessionReadiness?.missing)
? [...sessionReadiness.missing]
: [];
const sessionReadinessValue = sessionReadiness
? `${sessionReadiness.ready ? "ready" : "blocked"}${
sessionReadinessMissing.length > 0 ? `: ${sessionReadinessMissing.join(", ")}` : ""
}`
: "missing";
const blockingReasons = [];
if (mountWorkflow?.ready !== true) {
blockingReasons.push(`mount:${mountWorkflow?.phase ?? "blocked"}`);
@@ -1472,6 +1481,13 @@ export function createIniPanelShellSessionHandoffWorkflowSummary({
? [...readonlyStatusResult.missingStatusFields]
: [],
},
sessionReadiness: sessionReadiness
? {
phase: sessionReadiness.phase ?? (sessionReadiness.ready ? "ready" : "blocked"),
ready: sessionReadiness.ready === true,
missing: sessionReadinessMissing,
}
: null,
blockingReasons,
rows: [
{
@@ -1489,6 +1505,11 @@ export function createIniPanelShellSessionHandoffWorkflowSummary({
label: "Readonly status workflow",
value: readonlyStatusResult?.statusLine ?? "missing",
},
{
id: "session-readiness",
label: "Session readiness",
value: sessionReadinessValue,
},
{
id: "readonly-status-missing-fields",
label: "Readonly missing fields",

View File

@@ -548,6 +548,16 @@ TOOL_TABLE = browser-shell-tool.tbl
);
assertEqual(workflowSummaryResult.phase, "ready", "shell handoff workflow summary phase");
assertEqual(workflowSummaryResult.ready, true, "shell handoff workflow summary readiness");
assertEqual(
workflowSummaryResult.sessionReadiness.ready,
true,
"shell handoff workflow summary session readiness",
);
assertEqual(
workflowRenderState.rows.some((row) => row.id === "session-readiness" && row.value === "ready"),
true,
"shell handoff workflow render-state session readiness row",
);
assertEqual(workflowSummaryResult.blockingReasons.join(","), "", "shell handoff workflow summary blocking reasons");
assertEqual(workflowDisplayResult.phase, "ready", "shell handoff workflow display phase");
assertEqual(workflowDisplayResult.statusText, "Ready", "shell handoff workflow display status");
@@ -557,7 +567,7 @@ TOOL_TABLE = browser-shell-tool.tbl
assertEqual(workflowRenderState.dataset.handoffScope, "workflow", "shell handoff workflow render-state scope");
assertEqual(externalWorkflowDomReadiness.ready, true, "shell handoff workflow DOM readiness");
assertEqual(workflowDomMountResult.phase, "ready", "shell handoff workflow DOM mount phase");
assertEqual(workflowDomMountResult.renderResult.rowCount, 5, "shell handoff workflow DOM mount rows");
assertEqual(workflowDomMountResult.renderResult.rowCount, 6, "shell handoff workflow DOM mount rows");
assertEqual(
document.querySelector("[data-external-shell-workflow]").dataset.handoffScope,
"workflow",

View File

@@ -1045,7 +1045,11 @@ const readonlyStatusResult = readIniPanelShellSessionHandoffStatusFromControlPag
handoffSummary: shellViewModel.shellSessionHandoffSummary,
readonlyStatus: createMachineSessionReadonlyStatus({
stateBundle: { overview: { phase: "loaded" } },
workflowStatus: { lastAction: "load-session", run: { status: "not-run" } },
workflowStatus: {
lastAction: "load-session",
run: { status: "not-run" },
sessionReadiness: { phase: "ready", ready: true, missing: [] },
},
controlView: { sections: [] },
}),
});
@@ -1099,7 +1103,13 @@ assert.equal(workflowSummaryResult.apiName, "ini-panel-shell-session-handoff-wor
assert.equal(workflowSummaryResult.summaryVersion, 1);
assert.equal(workflowSummaryResult.phase, "blocked");
assert.equal(workflowSummaryResult.ready, false);
assert.equal(workflowSummaryResult.rows.length, 5);
assert.deepEqual(workflowSummaryResult.sessionReadiness, {
phase: "ready",
ready: true,
missing: [],
});
assert.equal(workflowSummaryResult.rows.find(({ id }) => id === "session-readiness")?.value, "ready");
assert.equal(workflowSummaryResult.rows.length, 6);
assert.equal(workflowSummaryResult.blockingReasons[0], "mount:blocked");
const readyWorkflowSummaryResult = createIniPanelShellSessionHandoffWorkflowSummary({
mountWorkflow: {
@@ -1120,7 +1130,7 @@ assert.equal(workflowDisplayViewModel.phase, "blocked");
assert.equal(workflowDisplayViewModel.title, "Shell handoff workflow");
assert.equal(workflowDisplayViewModel.statusText, "Blocked");
assert.equal(workflowDisplayViewModel.detailText, "mount:blocked");
assert.equal(workflowDisplayViewModel.rows.length, 5);
assert.equal(workflowDisplayViewModel.rows.length, 6);
const readyWorkflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
readyWorkflowSummaryResult,
);
@@ -1135,7 +1145,7 @@ assert.equal(workflowRenderState.renderStateVersion, 1);
assert.equal(workflowRenderState.phase, "blocked");
assert.equal(workflowRenderState.statusLine, "Blocked: mount:blocked");
assert.equal(workflowRenderState.dataset.handoffScope, "workflow");
assert.equal(workflowRenderState.rows.length, 5);
assert.equal(workflowRenderState.rows.length, 6);
const readyWorkflowRenderState = createIniPanelShellSessionHandoffWorkflowRenderState(
readyWorkflowDisplayViewModel,
);
@@ -1178,11 +1188,12 @@ assert.deepEqual(
{
rendered: true,
statusLine: "Blocked: mount:blocked",
rowCount: 5,
rowCount: 6,
rowIds: [
"mount-workflow",
"control-page-mount-workflow",
"readonly-status-workflow",
"session-readiness",
"readonly-status-missing-fields",
"blocking-reasons",
],
@@ -1204,7 +1215,7 @@ assert.equal(workflowDomMountResult.apiName, "ini-panel-shell-session-handoff-wo
assert.equal(workflowDomMountResult.workflowVersion, 1);
assert.equal(workflowDomMountResult.phase, "blocked");
assert.equal(workflowDomMountResult.ready, false);
assert.equal(workflowDomMountResult.renderResult.rowCount, 5);
assert.equal(workflowDomMountResult.renderResult.rowCount, 6);
assert.equal(workflowDomMountResult.renderResult.dataset.handoffScope, "workflow");
assert.deepEqual(createIniPanelShellWorkflowOverviewContract(), shellViewModel.shellWorkflowOverviewContract);
assert.deepEqual(createIniPanelShellWorkflowOverviewReadiness(), {
@@ -1251,7 +1262,7 @@ assert.equal(workflowOverviewEmbedding.apiName, "ini-panel-shell-workflow-overvi
assert.equal(workflowOverviewEmbedding.embeddingVersion, 1);
assert.equal(workflowOverviewEmbedding.ready, false);
assert.equal(workflowOverviewEmbedding.renderState.statusLine, "Blocked: mount:blocked");
assert.equal(workflowOverviewEmbedding.mountResult.renderResult.rowCount, 5);
assert.equal(workflowOverviewEmbedding.mountResult.renderResult.rowCount, 6);
assert.equal(workflowOverviewEmbedding.error, null);
const workflowOverviewEmbeddingReport = createIniPanelShellWorkflowOverviewEmbeddingReport(workflowOverviewEmbedding);
assert.deepEqual(workflowOverviewEmbeddingReport, {
@@ -1267,7 +1278,7 @@ assert.deepEqual(workflowOverviewEmbeddingReport, {
contract: shellViewModel.shellWorkflowOverviewContract,
missingMethods: [],
mountPhase: "blocked",
renderRowCount: 5,
renderRowCount: 6,
error: null,
blockingReasons: ["embedding:blocked", "mount:blocked"],
rows: [
@@ -1294,7 +1305,7 @@ assert.deepEqual(workflowOverviewEmbeddingReport, {
{
id: "render-row-count",
label: "Render row count",
value: "5",
value: "6",
},
{
id: "error",