feat: refocus admin governance mutations
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
- 前端现在会在动作完成后自动重开对应的平台 Agent 详情工作区,让用户立刻看到最新记忆、技能、最近执行和配置版本,不用自己再点回去确认结果。
|
||||
- 这条行为已经补进前端回归,锁住平台 Agent 相关变更必须能顺着同一个详情视图继续做下一步。
|
||||
|
||||
### 管理员治理保存后回到 Agent 治理区
|
||||
|
||||
- `系统主 Agent 策略`、`系统平台策略`、`OneLiner 动作注册表` 在管理员配置台里保存成功后,现在会自动回到 `管理员配置台 -> Agent 治理`。
|
||||
- 同时会尽量滚到最相关的区块:
|
||||
- 系统主 Agent / 系统平台策略回到治理摘要区
|
||||
- 动作注册表回到动作注册表区
|
||||
- 这样管理员连续调策略时,不需要每次保存后再自己切 tab 和找区块。
|
||||
|
||||
### 主 Agent 完成态保留精确对象上下文
|
||||
|
||||
- 主 Agent run 在创建时会把 `target_account_id / tracked_account_id / job_id / review_id / source_id / assistant_id` 这类对象上下文固化进执行计划,不再只记一个泛化的来源页面。
|
||||
|
||||
@@ -4058,7 +4058,7 @@ function renderOneLinerActionRegistryPanel() {
|
||||
const items = safeArray(appState.onelinerActionRegistry);
|
||||
if (!items.length) {
|
||||
return `
|
||||
<div class="panel pad">
|
||||
<div class="panel pad" id="admin-action-registry-anchor">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<h3>OneLiner 动作注册表</h3>
|
||||
@@ -4083,7 +4083,7 @@ function renderOneLinerActionRegistryPanel() {
|
||||
return acc;
|
||||
}, {});
|
||||
return `
|
||||
<div class="panel pad">
|
||||
<div class="panel pad" id="admin-action-registry-anchor">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<h3>OneLiner 动作注册表</h3>
|
||||
@@ -4516,7 +4516,7 @@ function renderPlatformAgentPanel() {
|
||||
`;
|
||||
}
|
||||
return `
|
||||
<div class="panel pad">
|
||||
<div class="panel pad" id="admin-governance-anchor">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<h3>平台 Agent</h3>
|
||||
@@ -9263,6 +9263,14 @@ async function openUserPlatformPolicyHistoryAction(platform, preferredVersionId
|
||||
});
|
||||
}
|
||||
|
||||
function focusAdminGovernanceAgentsWorkspace(anchorId = "admin-governance-anchor") {
|
||||
appState.adminWorkbenchTab = "agents";
|
||||
setScreen("admin-workbench");
|
||||
setTimeout(() => {
|
||||
document.getElementById(anchorId)?.scrollIntoView({ block: "start", behavior: "smooth" });
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function openSystemMainPolicyAction() {
|
||||
if (!ensureAdminGovernanceAccess()) return;
|
||||
const projectId = getOneLinerProjectId();
|
||||
@@ -9293,6 +9301,7 @@ function openSystemMainPolicyAction() {
|
||||
await loadAgentControlSurfaces(projectId);
|
||||
rememberAction("系统主 Agent 策略已保存", `已发布版本 ${saved.current_version?.version_no || 1}。`, "green", saved);
|
||||
renderAll();
|
||||
focusAdminGovernanceAgentsWorkspace("admin-governance-anchor");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -9331,6 +9340,7 @@ function openSystemPlatformPolicyAction(platform) {
|
||||
await loadAgentControlSurfaces(projectId);
|
||||
rememberAction(`${platformLabel(normalizedPlatform)} 系统平台策略已保存`, `已发布版本 ${saved.current_version?.version_no || 1}。`, "green", saved);
|
||||
renderAll();
|
||||
focusAdminGovernanceAgentsWorkspace("admin-governance-anchor");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -9949,6 +9959,7 @@ function openActionRegistryEditAction(actionKey) {
|
||||
rememberAction("动作已更新", `OneLiner 动作「${saved.label || saved.action_key}」已保存。`, "green", saved);
|
||||
await loadAgentControlSurfaces(project.id);
|
||||
renderAll();
|
||||
focusAdminGovernanceAgentsWorkspace("admin-action-registry-anchor");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -697,15 +697,23 @@ test("admin governance history actions stay read-only when there are no versions
|
||||
|
||||
test("admin governance actions apply local permission and empty-directory guards before mutating", () => {
|
||||
const helpers = extractBetween(APP, "function ensureAdminGovernanceAccess()", "function openUserGlobalPolicyAction()");
|
||||
const adminFocusHelper = extractBetween(APP, "function focusAdminGovernanceAgentsWorkspace(anchorId = \"admin-governance-anchor\") {", "function openSystemMainPolicyAction() {");
|
||||
const targetPicker = extractBetween(APP, "async function openAdminOverrideTargetAction()", "function openAdminOverridePolicyAction()");
|
||||
const systemMain = extractBetween(APP, "function openSystemMainPolicyAction()", "function openSystemPlatformPolicyAction(platform)");
|
||||
const systemPlatform = extractBetween(APP, "function openSystemPlatformPolicyAction(platform)", "async function openAdminOverrideTargetAction()");
|
||||
const actionRegistry = extractBetween(APP, "function openActionRegistryEditAction(actionKey)", "function openTenantQuotaAction()");
|
||||
|
||||
assert.match(helpers, /function ensureAdminGovernanceAccess\(\)/);
|
||||
assert.match(helpers, /function ensureAdminOverrideTargetReady\(target\)/);
|
||||
assert.match(adminFocusHelper, /appState\.adminWorkbenchTab = "agents"/);
|
||||
assert.match(adminFocusHelper, /setScreen\("admin-workbench"\)/);
|
||||
assert.match(adminFocusHelper, /scrollIntoView/);
|
||||
assert.match(targetPicker, /hideSubmit:\s*!directoryItems\.length/);
|
||||
assert.match(systemMain, /if \(!ensureAdminGovernanceAccess\(\)\) return;/);
|
||||
assert.match(systemPlatform, /if \(!ensureAdminGovernanceAccess\(\)\) return;/);
|
||||
assert.match(systemMain, /focusAdminGovernanceAgentsWorkspace\("admin-governance-anchor"\)/);
|
||||
assert.match(systemPlatform, /focusAdminGovernanceAgentsWorkspace\("admin-governance-anchor"\)/);
|
||||
assert.match(actionRegistry, /focusAdminGovernanceAgentsWorkspace\("admin-action-registry-anchor"\)/);
|
||||
});
|
||||
|
||||
test("user governance UI exposes personal history and rollback entrypoints", () => {
|
||||
|
||||
Reference in New Issue
Block a user