吸收数字员工诊断成本审计

This commit is contained in:
baiyanyun
2026-06-12 10:52:35 +08:00
parent 3a159e2f5a
commit 9011b91dba
9 changed files with 343 additions and 57 deletions

View File

@@ -174,18 +174,41 @@ function checkDigitalDiagnosticAuditProjection() {
const adapterPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "lib", "qimingclawAdapter.ts");
const typesPath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "types", "api.ts");
const pagePath = path.join(packageRoot, "embedded", "sgrobot-digital", "src", "pages", "digital", "CommandDeck.tsx");
const syncServicePath = path.join(packageRoot, "src", "main", "services", "digitalEmployee", "syncService.ts");
const adapter = fs.readFileSync(adapterPath, "utf8");
const types = fs.readFileSync(typesPath, "utf8");
const page = fs.readFileSync(pagePath, "utf8");
const syncService = fs.readFileSync(syncServicePath, "utf8");
const requiredSnippets = [
[syncService, "sandboxAuditBusinessView", "sandbox audit sync business view"],
[syncService, "tokenCostBusinessView", "token/cost sync business view"],
[syncService, "toolCallAuditBusinessView", "tool call sync business view"],
[syncService, "sandbox_audit", "sandbox audit business category"],
[syncService, "token_cost", "token cost business category"],
[syncService, "tool_call_audit", "tool call business category"],
[syncService, "estimated_cost_usd", "safe estimated cost field"],
[syncService, "total_tokens", "safe total token field"],
[syncService, "input_length", "sensitive input length redaction"],
[adapter, "'audits'", "audit business view kind"],
[adapter, "buildDiagnosticSummary", "diagnostic summary builder"],
[adapter, "buildCostSummary", "cost summary builder"],
[adapter, "costSampleFromPayload", "runtime token/cost aggregation"],
[adapter, "diagnosticAuditPayload", "diagnostic audit payload redaction"],
[adapter, "sandbox_audit", "sandbox audit row category"],
[adapter, "token_cost", "token cost row category"],
[adapter, "tool_call_audit", "tool call row category"],
[adapter, "estimated_cost_usd", "audit estimated cost field"],
[adapter, "total_tokens", "audit total token field"],
[adapter, "filterAuditRows", "audit filters"],
[adapter, "diagnosticNotifications", "diagnostic notifications"],
[adapter, "auditNotifications", "audit notifications"],
[types, "DigitalEmployeeDiagnosticSummary", "diagnostic summary type"],
[types, "diagnostic_summary?: DigitalEmployeeDiagnosticSummary", "workday diagnostic field"],
[types, "estimated_cost_usd", "diagnostic summary estimated cost type"],
[types, "total_tokens", "diagnostic summary token type"],
[page, "de-diagnostic-summary-strip", "dashboard diagnostic strip"],
[page, "Token", "dashboard Token metric"],
[page, "估算成本", "dashboard estimated cost metric"],
];
const missing = requiredSnippets
.filter(([content, snippet]) => !content.includes(snippet))