feat: reopen platform agent detail after mutations
Some checks failed
StoryForge CI / Baseline checks (push) Has been cancelled
StoryForge CI / Backend tests (push) Has been cancelled
StoryForge CI / Web tests (push) Has been cancelled

This commit is contained in:
kris
2026-04-04 08:49:57 +08:00
parent fe9a6c7cc1
commit 4ef0b3e805
3 changed files with 31 additions and 0 deletions

View File

@@ -9533,6 +9533,12 @@ async function openSystemPlatformPolicyHistoryAction(platform, preferredVersionI
});
}
function reopenPlatformAgentDetailSoon(platform) {
setTimeout(() => {
void openPlatformAgentDetailAction(platform);
}, 0);
}
function openPlatformAgentProfileAction(platform) {
const project = requireSelectedProject();
const agents = safeArray(appState.platformAgents);
@@ -9572,6 +9578,7 @@ function openPlatformAgentProfileAction(platform) {
appState.platformAgents = safeArray(appState.platformAgents).filter((item) => item.platform !== platform).concat(saved).sort((a, b) => String(a.platform).localeCompare(String(b.platform)));
rememberAction("平台 Agent 已保存", `已更新 ${platformLabel(platform)} Agent当前版本 ${saved.current_version?.version_no || 1}`, "green", saved);
renderAll();
reopenPlatformAgentDetailSoon(platform);
}
});
}
@@ -9609,6 +9616,7 @@ async function openPlatformAgentProfileHistoryAction(platform, preferredVersionI
appState.platformAgents = safeArray(appState.platformAgents).filter((item) => item.platform !== normalizedPlatform).concat(saved).sort((a, b) => String(a.platform).localeCompare(String(b.platform)));
rememberAction(`${platformLabel(normalizedPlatform)} Agent 已回滚`, `已回滚到版本 ${saved.current_version?.version_no || "所选版本"}`, "green", saved);
renderAll();
reopenPlatformAgentDetailSoon(normalizedPlatform);
}
});
}
@@ -9647,6 +9655,7 @@ function openPlatformAgentMemoryAction(platform) {
rememberAction("平台记忆已保存", `已把这条方法沉淀到 ${platformLabel(platform)} Agent 记忆中。`, "green", saved);
await loadAgentControlSurfaces(project.id);
renderAll();
reopenPlatformAgentDetailSoon(platform);
}
});
}
@@ -9685,6 +9694,7 @@ function openPlatformAgentSkillAction(platform) {
rememberAction("平台技能已保存", `已把方法固化到 ${platformLabel(platform)} Agent 技能中。`, "green", saved);
await loadAgentControlSurfaces(project.id);
renderAll();
reopenPlatformAgentDetailSoon(platform);
}
});
}
@@ -9860,6 +9870,7 @@ function openPlatformSkillReviewAction(platform, skillId, accepted) {
);
await loadAgentControlSurfaces(project.id);
renderAll();
reopenPlatformAgentDetailSoon(normalizedPlatform);
}
});
}
@@ -9897,6 +9908,7 @@ function openPlatformSkillRollbackAction(platform, skillId, versionId) {
rememberAction("技能已回滚", `已回滚到版本 ${payload.rollback_from_version?.version_no || "指定版本"}`, "green", payload);
await loadAgentControlSurfaces(project.id);
renderAll();
reopenPlatformAgentDetailSoon(normalizedPlatform);
}
});
}

View File

@@ -790,21 +790,34 @@ test("main agent runtime and platform recent execution preserve structured follo
test("platform agent profiles expose history, rollback, and execution version context", () => {
const actions = extractBetween(APP, "document.addEventListener(\"click\", async (event) => {", "document.addEventListener(\"submit\", async (event) => {");
const reopenHelper = extractBetween(APP, "function reopenPlatformAgentDetailSoon(platform) {", "function openPlatformAgentProfileAction(platform) {");
const profileEditor = extractBetween(APP, "function openPlatformAgentProfileAction(platform)", "async function openPlatformAgentProfileHistoryAction(platform, preferredVersionId = \"\")");
const profileHistory = extractBetween(APP, "async function openPlatformAgentProfileHistoryAction(platform, preferredVersionId = \"\")", "function openPlatformAgentMemoryAction(platform)");
const memoryEditor = extractBetween(APP, "function openPlatformAgentMemoryAction(platform)", "function openPlatformAgentSkillAction(platform)");
const skillEditor = extractBetween(APP, "function openPlatformAgentSkillAction(platform)", "async function openPlatformAgentDetailAction(platform)");
const panel = extractBetween(APP, "function renderPlatformAgentPanel()", "function renderAdminOpsPanel()");
const detail = extractBetween(APP, "async function openPlatformAgentDetailAction(platform)", "function openPlatformSkillReviewAction(platform, skillId, accepted)");
const skillReview = extractBetween(APP, "function openPlatformSkillReviewAction(platform, skillId, accepted)", "function openPlatformSkillRollbackAction(platform, skillId, versionId)");
const skillRollback = extractBetween(APP, "function openPlatformSkillRollbackAction(platform, skillId, versionId)", "function openActionRegistryEditAction(actionKey)");
const execution = extractBetween(APP, "function renderOneLinerExecutionPayloadHtml(payload)", "function parseOneLinerActionPayloadValue(value)");
assert.match(reopenHelper, /setTimeout/);
assert.match(reopenHelper, /openPlatformAgentDetailAction/);
assert.match(profileEditor, /renderPolicyVersionSummary\(current,/);
assert.match(profileEditor, /name: "reason"/);
assert.match(profileEditor, /saved\.current_version\?\.version_no/);
assert.match(profileEditor, /reopenPlatformAgentDetailSoon\(platform\)/);
assert.match(profileHistory, /\/v2\/platform-agents\/\$\{encodeURIComponent\(normalizedPlatform\)\}\/profile\/versions/);
assert.match(profileHistory, /\/v2\/platform-agents\/\$\{encodeURIComponent\(normalizedPlatform\)\}\/profile\/audits/);
assert.match(profileHistory, /\/v2\/platform-agents\/\$\{encodeURIComponent\(normalizedPlatform\)\}\/profile\/rollback/);
assert.match(profileHistory, /renderPolicyVersionsHtml/);
assert.match(profileHistory, /renderPolicyAuditsHtml/);
assert.match(profileHistory, /reopenPlatformAgentDetailSoon\(normalizedPlatform\)/);
assert.match(memoryEditor, /reopenPlatformAgentDetailSoon\(platform\)/);
assert.match(skillEditor, /reopenPlatformAgentDetailSoon\(platform\)/);
assert.match(skillReview, /reopenPlatformAgentDetailSoon\(normalizedPlatform\)/);
assert.match(skillRollback, /reopenPlatformAgentDetailSoon\(normalizedPlatform\)/);
assert.match(panel, /open-platform-agent-profile-history/);
assert.match(detail, /open-platform-agent-profile-history/);