吸收数字员工运营预览台

This commit is contained in:
baiyanyun
2026-06-12 19:57:38 +08:00
parent 871bd715c4
commit 1a8e0fb51f
23 changed files with 3344 additions and 277 deletions

View File

@@ -848,6 +848,43 @@ function checkDigitalArtifactCleanup() {
console.log("[DigitalEmployeeCheck] artifact cleanup execution hooks OK");
}
function checkDigitalArtifactBatchGovernance() {
console.log("\n[DigitalEmployeeCheck] Verify artifact batch governance hooks");
const adapterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "qimingclawAdapter.ts");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const adapter = fs.readFileSync(adapterPath, "utf8");
const api = fs.readFileSync(apiPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const businessViewPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "BusinessView.tsx");
const businessView = fs.existsSync(businessViewPath) ? fs.readFileSync(businessViewPath, "utf8") : "";
const dailyReportPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DailyReport.tsx");
const dailyReport = fs.readFileSync(dailyReportPath, "utf8");
const docs = fs.readFileSync(path.join(packageRoot, "..", "..", "docs", "digital-employee-frontend-integration-plan.md"), "utf8");
const requiredSnippets = [
[adapter, "handleArtifactRetentionBatch", "adapter artifact retention batch handler"],
[adapter, "/retention/batch", "adapter artifact retention batch endpoint"],
[adapter, "artifactGroupRows", "adapter artifact aggregate rows"],
[adapter, "/artifact-groups", "adapter artifact groups endpoint"],
[api, "setArtifactRetentionBatch", "embedded artifact retention batch API"],
[types, "artifact-groups", "business view artifact groups kind"],
[types, "artifact_count", "artifact aggregate count type field"],
[types, "device_count", "artifact aggregate device count type field"],
[businessView, "产物聚合", "business view artifact groups tab"],
[businessView, "批量保留", "business view batch retention UI"],
[dailyReport, "批量标记到期", "daily report batch retention action"],
[docs, "保留策略批量治理", "docs artifact batch governance absorption"],
[docs, "跨设备聚合视图", "docs artifact aggregate view absorption"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))
.map(([, , label]) => label);
if (missing.length > 0) {
throw new Error(`Missing artifact batch governance hooks: ${missing.join(", ")}`);
}
console.log("[DigitalEmployeeCheck] artifact batch governance hooks OK");
}
function checkDigitalBusinessViewUi() {
console.log("\n[DigitalEmployeeCheck] Verify management business view UI hooks");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
@@ -892,6 +929,226 @@ function checkDigitalBusinessViewUi() {
console.log("[DigitalEmployeeCheck] management business view UI hooks OK");
}
function checkDigitalInterventionWorkbench() {
console.log("\n[DigitalEmployeeCheck] Verify intervention workbench hooks");
const adapterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "qimingclawAdapter.ts");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const shellPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DigitalEmployeeShell.tsx");
const commandDeckPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "CommandDeck.tsx");
const workbenchPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "InterventionWorkbench.tsx");
const adapter = fs.readFileSync(adapterPath, "utf8");
const api = fs.readFileSync(apiPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const shell = fs.readFileSync(shellPath, "utf8");
const commandDeck = fs.readFileSync(commandDeckPath, "utf8");
const workbench = fs.existsSync(workbenchPath) ? fs.readFileSync(workbenchPath, "utf8") : "";
const docs = fs.readFileSync(path.join(packageRoot, "..", "..", "docs", "digital-employee-frontend-integration-plan.md"), "utf8");
const requiredSnippets = [
[adapter, "interventionWorkbenchRows", "adapter intervention workbench projection"],
[adapter, "/api/digital-employee/interventions/workbench", "adapter intervention workbench endpoint"],
[adapter, "handleApprovalConflictResolutionBatch", "adapter approval conflict batch handler"],
[adapter, "batch_accept_remote_disabled", "adapter approval batch safety guard"],
[adapter, "handleRouteInterventionsBatch", "adapter route intervention batch handler"],
[api, "getDigitalEmployeeInterventionWorkbench", "embedded intervention workbench API"],
[api, "resolveApprovalConflictsBatch", "embedded approval conflict batch API"],
[api, "decideRouteInterventionsBatch", "embedded route intervention batch API"],
[types, "DigitalEmployeeInterventionRow", "intervention row type"],
[types, "DigitalEmployeeInterventionWorkbenchResponse", "intervention response type"],
[shell, "InterventionWorkbench", "intervention shell component"],
[shell, "介入台", "intervention tab label"],
[commandDeck, "打开介入台", "command deck intervention entry"],
[workbench, "批量保留本地", "workbench keep local batch UI"],
[workbench, "批量标记复核", "workbench mark reviewed batch UI"],
[workbench, "批量忽略", "workbench route dismiss batch UI"],
[docs, "跨设备批量冲突排查", "docs approval intervention absorption"],
[docs, "批量干预入口", "docs route intervention absorption"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))
.map(([, , label]) => label);
if (missing.length > 0) {
throw new Error(`Missing intervention workbench hooks: ${missing.join(", ")}`);
}
console.log("[DigitalEmployeeCheck] intervention workbench hooks OK");
}
function checkDigitalMemoryGovernanceAudit() {
console.log("\n[DigitalEmployeeCheck] Verify memory governance and skill audit hooks");
const adapterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "qimingclawAdapter.ts");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const shellPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DigitalEmployeeShell.tsx");
const skillLibraryPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "SkillLibrary.tsx");
const commandDeckPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "CommandDeck.tsx");
const memoryGovernancePath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "MemoryGovernance.tsx");
const skillAuditPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "SkillAuditWorkbench.tsx");
const adapter = fs.readFileSync(adapterPath, "utf8");
const api = fs.readFileSync(apiPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const shell = fs.readFileSync(shellPath, "utf8");
const skillLibrary = fs.readFileSync(skillLibraryPath, "utf8");
const commandDeck = fs.readFileSync(commandDeckPath, "utf8");
const memoryGovernance = fs.existsSync(memoryGovernancePath) ? fs.readFileSync(memoryGovernancePath, "utf8") : "";
const skillAudit = fs.existsSync(skillAuditPath) ? fs.readFileSync(skillAuditPath, "utf8") : "";
const docs = fs.readFileSync(path.join(packageRoot, "..", "..", "docs", "digital-employee-frontend-integration-plan.md"), "utf8");
const requiredSnippets = [
[adapter, "memoryGovernanceRows", "adapter memory governance projection"],
[adapter, "/api/digital-employee/memory-governance", "adapter memory governance endpoint"],
[adapter, "/api/digital-employee/memory-governance/status/batch", "adapter memory governance batch endpoint"],
[adapter, "skillAuditWorkbenchRows", "adapter skill audit workbench projection"],
[adapter, "/api/digital-employee/skill-audit-workbench", "adapter skill audit workbench endpoint"],
[api, "getDigitalEmployeeMemoryGovernance", "embedded memory governance API"],
[api, "setMemoryGovernanceStatus", "embedded memory governance batch API"],
[api, "getDigitalEmployeeSkillAuditWorkbench", "embedded skill audit API"],
[types, "DigitalEmployeeMemoryGovernanceRow", "memory governance row type"],
[types, "DigitalEmployeeSkillAuditWorkbenchRow", "skill audit row type"],
[shell, "MemoryGovernance", "memory governance shell component"],
[shell, "SkillAuditWorkbench", "skill audit shell component"],
[shell, "记忆治理", "memory governance tab label"],
[shell, "技能审计", "skill audit tab label"],
[skillLibrary, "技能审计", "skill library audit entry"],
[commandDeck, "打开技能审计", "home skill audit entry"],
[memoryGovernance, "批量归档", "memory governance archive UI"],
[memoryGovernance, "批量恢复", "memory governance restore UI"],
[memoryGovernance, "重复候选", "memory governance duplicate candidate UI"],
[skillAudit, "技能审计", "skill audit workbench title"],
[docs, "记忆归档/恢复 UI", "docs memory governance absorption"],
[docs, "管理端调用审计视图", "docs skill audit absorption"],
[docs, "管理端正式审计视图预览", "docs audit preview absorption"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))
.map(([, , label]) => label);
if (missing.length > 0) {
throw new Error(`Missing memory governance and skill audit hooks: ${missing.join(", ")}`);
}
console.log("[DigitalEmployeeCheck] memory governance and skill audit hooks OK");
}
function checkDigitalOpsNotificationReportWorkbenches() {
console.log("\n[DigitalEmployeeCheck] Verify ops, notification and daily report workbench hooks");
const adapterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "qimingclawAdapter.ts");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const shellPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DigitalEmployeeShell.tsx");
const commandDeckPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "CommandDeck.tsx");
const businessViewPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "BusinessView.tsx");
const opsWorkbenchPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "OpsWorkbench.tsx");
const notificationWorkbenchPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "NotificationWorkbench.tsx");
const dailyReportWorkbenchPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DailyReportWorkbench.tsx");
const adapter = fs.readFileSync(adapterPath, "utf8");
const api = fs.readFileSync(apiPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const shell = fs.readFileSync(shellPath, "utf8");
const commandDeck = fs.readFileSync(commandDeckPath, "utf8");
const businessView = fs.readFileSync(businessViewPath, "utf8");
const opsWorkbench = fs.existsSync(opsWorkbenchPath) ? fs.readFileSync(opsWorkbenchPath, "utf8") : "";
const notificationWorkbench = fs.existsSync(notificationWorkbenchPath) ? fs.readFileSync(notificationWorkbenchPath, "utf8") : "";
const dailyReportWorkbench = fs.existsSync(dailyReportWorkbenchPath) ? fs.readFileSync(dailyReportWorkbenchPath, "utf8") : "";
const docs = fs.readFileSync(path.join(packageRoot, "..", "..", "docs", "digital-employee-frontend-integration-plan.md"), "utf8");
const requiredSnippets = [
[adapter, "opsWorkbenchRows", "adapter ops workbench projection"],
[adapter, "/api/digital-employee/ops-workbench", "adapter ops workbench endpoint"],
[adapter, "/api/digital-employee/ops-workbench/actions/batch", "adapter ops batch endpoint"],
[adapter, "safe_restart_service", "adapter safe restart action"],
[adapter, "ops_workbench_action_recorded", "adapter ops audit action"],
[adapter, "/api/digital-employee/notifications/workbench", "adapter notification workbench endpoint"],
[adapter, "/api/digital-employee/notifications/actions/batch", "adapter notification batch endpoint"],
[adapter, "notification_workbench_action_recorded", "adapter notification audit action"],
[adapter, "/api/digital-employee/daily-reports/workbench", "adapter daily report workbench endpoint"],
[adapter, "daily_report_workbench_action_recorded", "adapter daily report audit action"],
[api, "getDigitalEmployeeOpsWorkbench", "embedded ops workbench API"],
[api, "runDigitalEmployeeOpsBatchAction", "embedded ops batch API"],
[api, "getDigitalEmployeeNotificationWorkbench", "embedded notification workbench API"],
[api, "runDigitalEmployeeNotificationBatchAction", "embedded notification batch API"],
[api, "getDigitalEmployeeDailyReportWorkbench", "embedded daily report workbench API"],
[types, "DigitalEmployeeOpsWorkbenchRow", "ops workbench row type"],
[types, "DigitalEmployeeNotificationWorkbenchRow", "notification workbench row type"],
[types, "DigitalEmployeeDailyReportWorkbenchRow", "daily report workbench row type"],
[shell, "OpsWorkbench", "ops workbench shell component"],
[shell, "NotificationWorkbench", "notification workbench shell component"],
[shell, "DailyReportWorkbench", "daily report workbench shell component"],
[shell, "处置台", "ops workbench tab label"],
[shell, "通知运营", "notification workbench tab label"],
[shell, "日报运营", "daily report workbench tab label"],
[commandDeck, "打开处置台", "home ops entry"],
[commandDeck, "打开通知运营", "home notification entry"],
[commandDeck, "打开日报运营", "home daily report entry"],
[businessView, "打开处置台", "business view ops related link"],
[opsWorkbench, "安全重启", "ops safe restart UI"],
[opsWorkbench, "策略重拉", "ops policy retry UI"],
[notificationWorkbench, "批量已读", "notification batch read UI"],
[notificationWorkbench, "打开系统设置", "notification settings UI"],
[dailyReportWorkbench, "请求审批", "daily report approval UI"],
[dailyReportWorkbench, "确认回执", "daily report confirmation UI"],
[docs, "完整人机介入入口", "docs managed service ops absorption"],
[docs, "真实管理端通知页面预览", "docs notification workbench absorption"],
[docs, "诊断修复动作预览", "docs diagnostic repair absorption"],
[docs, "管理端正式日报页面预览", "docs daily report workbench absorption"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))
.map(([, , label]) => label);
if (missing.length > 0) {
throw new Error(`Missing ops/notification/daily report workbench hooks: ${missing.join(", ")}`);
}
console.log("[DigitalEmployeeCheck] ops, notification and daily report workbench hooks OK");
}
function checkDigitalPolicySchedulerWorkbenches() {
console.log("\n[DigitalEmployeeCheck] Verify policy center and scheduler workbench hooks");
const apiPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "api.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const shellPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "DigitalEmployeeShell.tsx");
const commandDeckPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "CommandDeck.tsx");
const opsSettingsPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "OpsSettings.tsx");
const policyCenterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "PolicyCenter.tsx");
const schedulerWorkbenchPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "SchedulerWorkbench.tsx");
const api = fs.readFileSync(apiPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const shell = fs.readFileSync(shellPath, "utf8");
const commandDeck = fs.readFileSync(commandDeckPath, "utf8");
const opsSettings = fs.readFileSync(opsSettingsPath, "utf8");
const policyCenter = fs.existsSync(policyCenterPath) ? fs.readFileSync(policyCenterPath, "utf8") : "";
const schedulerWorkbench = fs.existsSync(schedulerWorkbenchPath) ? fs.readFileSync(schedulerWorkbenchPath, "utf8") : "";
const docs = fs.readFileSync(path.join(packageRoot, "..", "..", "docs", "digital-employee-frontend-integration-plan.md"), "utf8");
const requiredSnippets = [
[api, "getDigitalEmployeePolicyCenter", "embedded policy center API"],
[api, "pullDigitalEmployeePoliciesBatch", "embedded policy batch pull API"],
[api, "getDigitalEmployeeSchedulerWorkbench", "embedded scheduler workbench API"],
[types, "DigitalEmployeePolicyCenterRow", "policy center row type"],
[types, "DigitalEmployeePolicyCenterResponse", "policy center response type"],
[types, "DigitalEmployeeSchedulerWorkbenchRow", "scheduler workbench row type"],
[types, "DigitalEmployeeSchedulerWorkbenchResponse", "scheduler workbench response type"],
[types, "DigitalEmployeePolicyPullBatchResult", "policy pull batch result type"],
[shell, "PolicyCenter", "policy center shell component"],
[shell, "SchedulerWorkbench", "scheduler workbench shell component"],
[shell, "策略中心", "policy center tab label"],
[shell, "调度运营", "scheduler workbench tab label"],
[commandDeck, "打开策略中心", "home policy center entry"],
[commandDeck, "打开调度运营", "home scheduler workbench entry"],
[opsSettings, "策略中心", "settings policy center hint"],
[policyCenter, "批量拉取策略", "policy center batch pull UI"],
[policyCenter, "max_per_sweep", "policy center dispatch policy field"],
[policyCenter, "auto_dispatch_ready_steps", "policy center auto dispatch field"],
[policyCenter, "auto_reject_actions", "policy center risk reject field"],
[schedulerWorkbench, "立即检查调度", "scheduler immediate check UI"],
[schedulerWorkbench, "catch_up_on_startup", "scheduler catch up setting UI"],
[schedulerWorkbench, "max_run_history", "scheduler history setting UI"],
[docs, "派发策略管理 UI", "docs dispatch policy UI absorption"],
[docs, "多调度并发策略 UI", "docs scheduler policy UI absorption"],
[docs, "管理端正式路由 UI 预览", "docs route policy preview absorption"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))
.map(([, , label]) => label);
if (missing.length > 0) {
throw new Error(`Missing policy center and scheduler workbench hooks: ${missing.join(", ")}`);
}
console.log("[DigitalEmployeeCheck] policy center and scheduler workbench hooks OK");
}
function checkLocalDatabaseSchema() {
console.log("\n[DigitalEmployeeCheck] Verify local SQLite digital schema");
const dbPath = path.join(os.homedir(), ".qimingclaw", "qimingclaw.db");
@@ -944,7 +1201,12 @@ function main() {
checkDigitalRouteDecisionPolicy();
checkDigitalDailyReportDelivery();
checkDigitalArtifactCleanup();
checkDigitalArtifactBatchGovernance();
checkDigitalBusinessViewUi();
checkDigitalInterventionWorkbench();
checkDigitalMemoryGovernanceAudit();
checkDigitalOpsNotificationReportWorkbenches();
checkDigitalPolicySchedulerWorkbenches();
checkLocalDatabaseSchema();
console.log("\n[DigitalEmployeeCheck] All checks passed");
} catch (error) {