fix(workbench): gate session switch detail projection
This commit is contained in:
@@ -247,6 +247,10 @@ function createScenarioState(scenarioId: string): ScenarioState {
|
||||
sessions.unshift(submitSplitSession());
|
||||
traces.trc_submit_split = submitSplitTrace();
|
||||
}
|
||||
if (id === "session-switch-delayed-detail-frame") {
|
||||
markSessionText(sessions, "ses_running", "SESSION_A_ONLY", "SESSION_A_ONLY running source session");
|
||||
markSessionText(sessions, "ses_completed", "SESSION_B_ONLY", "SESSION_B_ONLY completed target session");
|
||||
}
|
||||
if (id === "session-rail-many") {
|
||||
for (let index = 0; index < 46; index += 1) sessions.push(manyRailSession(index));
|
||||
}
|
||||
@@ -285,7 +289,7 @@ function createScenarioState(scenarioId: string): ScenarioState {
|
||||
chatRequests: [],
|
||||
listOmitSelected: id === "selected-missing-from-list",
|
||||
sessionDelayMs: id === "loading" ? 2_500 : 0,
|
||||
sessionDetailDelayMs: id === "legacy-cnv-deeplink-canonical" ? 1_500 : 0,
|
||||
sessionDetailDelayMs: id === "legacy-cnv-deeplink-canonical" ? 1_500 : id === "session-switch-delayed-detail-frame" ? 900 : 0,
|
||||
chatDelayMs: id === "submit-authority-race" ? 1_000 : 0,
|
||||
terminalScript: id === "event-replay" || id === "running-to-terminal" || id === "stale-submit-restore",
|
||||
terminalFailureScript: id === "stale-submit-restore",
|
||||
@@ -295,6 +299,17 @@ function createScenarioState(scenarioId: string): ScenarioState {
|
||||
};
|
||||
}
|
||||
|
||||
function markSessionText(sessions: SessionRecord[], sessionId: string, userText: string, agentText: string): void {
|
||||
const session = sessions.find((item) => item.sessionId === sessionId);
|
||||
if (!session) return;
|
||||
session.firstUserMessagePreview = userText;
|
||||
session.messages = (session.messages ?? []).map((message) => {
|
||||
if (message.role === "user") return { ...message, text: userText };
|
||||
if (message.role === "agent") return { ...message, text: agentText };
|
||||
return message;
|
||||
});
|
||||
}
|
||||
|
||||
function createManualSession(body: JsonRecord): SessionRecord {
|
||||
const now = new Date().toISOString();
|
||||
const token = state.scenarioId === "server-authoritative-create" ? "server_created" : Date.now().toString(36);
|
||||
|
||||
Reference in New Issue
Block a user