@zaip-ai/cli 1.3.8 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -3
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +17 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/services/adapters.js +4 -4
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/codex-config-template.d.ts +2 -2
- package/dist/services/codex-config-template.d.ts.map +1 -1
- package/dist/services/codex-config-template.js +3 -3
- package/dist/services/codex-config-template.js.map +1 -1
- package/dist/services/codex-rules.d.ts +1 -1
- package/dist/services/codex-rules.d.ts.map +1 -1
- package/dist/services/codex-rules.js +9 -24
- package/dist/services/codex-rules.js.map +1 -1
- package/dist/services/delivery-git-preflight.d.ts +23 -0
- package/dist/services/delivery-git-preflight.d.ts.map +1 -0
- package/dist/services/delivery-git-preflight.js +69 -0
- package/dist/services/delivery-git-preflight.js.map +1 -0
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +13 -1
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +22 -28
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/install-profile.d.ts +8 -0
- package/dist/services/install-profile.d.ts.map +1 -0
- package/dist/services/install-profile.js +56 -0
- package/dist/services/install-profile.js.map +1 -0
- package/dist/services/logger.d.ts.map +1 -1
- package/dist/services/logger.js +6 -5
- package/dist/services/logger.js.map +1 -1
- package/dist/services/stack-git.d.ts +9 -0
- package/dist/services/stack-git.d.ts.map +1 -0
- package/dist/services/stack-git.js +188 -0
- package/dist/services/stack-git.js.map +1 -0
- package/dist/services/stack-plan.d.ts +3 -1
- package/dist/services/stack-plan.d.ts.map +1 -1
- package/dist/services/stack-plan.js +15 -1
- package/dist/services/stack-plan.js.map +1 -1
- package/dist/services/stack-terraform.d.ts +13 -0
- package/dist/services/stack-terraform.d.ts.map +1 -0
- package/dist/services/stack-terraform.js +274 -0
- package/dist/services/stack-terraform.js.map +1 -0
- package/dist/services/template-manifest.d.ts.map +1 -1
- package/dist/services/template-manifest.js +14 -1
- package/dist/services/template-manifest.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/.env.example +34 -0
- package/templates/{README.md → .agents/README.md} +124 -60
- package/templates/.agents/config/agents/catalog.yaml +23 -23
- package/templates/.agents/config/clients/codex/agents/zaip-agent-analyst.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-auditor.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +5 -4
- package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +10 -7
- package/templates/.agents/config/clients/codex/agents/zaip-agent-data-analyst.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +5 -4
- package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-integrator.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +5 -4
- package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-refactoring-specialist.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-reviewer.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-security-auditor.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +1 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +5 -4
- package/templates/.agents/config/clients/codex/agents/zaip-agent-writer.toml +1 -0
- package/templates/.agents/config/pricing/models.json +25 -1
- package/templates/.agents/config/project.yaml +2 -0
- package/templates/.agents/dashboard/.zaip-managed.json +208 -88
- package/templates/.agents/dashboard/DATA-DICTIONARY.md +1 -1
- package/templates/.agents/dashboard/README.md +58 -19
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-DwVZOmMV.js → CostCalculationGuidePage-snUCQYTC.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-VcLx9iOO.js → DashboardHelpDialog-oZVlf-l5.js} +72 -8
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-CyjMXkm8.js → PricingSettingsDialog-BPtVUGgs.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-3Awyaovx.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-DFZwIXSC.js → TraceabilityWorkspace-BYjVOHI_.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DbaLbU2q.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DXBOtWNI.js → icons-vendor-TPUT2IUt.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Cmlx8OYH.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-ZJFXmK7m.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-DaNXQPyk.js → react-vendor-Ct48XHGL.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-I4AKqVDX.js → traceability-BDe4_Ubl.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +73 -67
- package/templates/.agents/dashboard/apps/frontend/src/AppLoadingBoundary.tsx +35 -7
- package/templates/.agents/dashboard/apps/frontend/src/AppWorkBoard.ts +55 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +11 -0
- package/templates/.agents/dashboard/apps/frontend/src/app-loading-boundary.css +98 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +5 -5
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-reconciliation.ts +33 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +75 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +7 -8
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +14 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +35 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +78 -2
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +28 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +8 -5
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +180 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +7 -4
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +13 -7
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +14 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableDisplay.ts +211 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +152 -157
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +155 -142
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/InvocationManifestQuery.test.ts +145 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +7 -5
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +4 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +4 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +4 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +4 -4
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +79 -1
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +105 -11
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +482 -332
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +430 -285
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +14 -2
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +6 -26
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/verify-persistent-launch.mjs +268 -0
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +482 -332
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +90 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +112 -22
- package/templates/.agents/dashboard/packages/local-runtime/src/server-agent-assets.ts +39 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-browser-lease.ts +33 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +148 -11
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-result.test.ts +68 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.test.ts +19 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +39 -43
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-revision.test.ts +42 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-revision.ts +26 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +34 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-startup.ts +30 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.test.ts +89 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.ts +88 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +68 -7
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +11 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +129 -99
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-agent-productivity.test.ts +111 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-agent-productivity.ts +140 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.test.ts +127 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.ts +145 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-aggregates.ts +156 -23
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.ts +18 -9
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-projection.ts +52 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-persistence.ts +35 -13
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-force-canonical.test.ts +56 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-incremental-cache.test.ts +29 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-incremental-cache.ts +136 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-incremental-refresh.test.ts +251 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-projection.ts +22 -7
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-cache.test-support.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical-parsing.ts +42 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical.ts +793 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider-duration.test.ts +270 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider-fixture.ts +3 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +18 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.test.ts +87 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +105 -16
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +131 -59
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +1000 -1115
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-cache.ts +13 -92
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-claims.test.mjs +79 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +27 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-lifecycle.mjs +6 -6
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-prerequisites.mjs +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-refresh.mjs +2 -10
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.mjs +36 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.test.mjs +63 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-server.mjs +142 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +262 -267
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +18 -29
- package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +6 -0
- package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +47 -0
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +2 -2
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/autonomy-decision.md +1 -1
- package/templates/.agents/rules/cloud-hostinger-autonomy.md +21 -0
- package/templates/.agents/rules/core.md +5 -4
- package/templates/.agents/rules/local-sqlite-storage.md +18 -0
- package/templates/.agents/rules/meta-mcp.md +21 -0
- package/templates/.agents/rules/workflow.md +1 -0
- package/templates/.agents/runtime/bin/zaip.mjs +305 -137
- package/templates/.agents/runtime/checksums.sha256 +2 -2
- package/templates/.agents/runtime/provenance.json +2 -2
- package/templates/.agents/skills/zaip-skill-api-to-mcp/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +25 -9
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-framework.md +2 -2
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +2 -2
- package/templates/.agents/skills/zaip-skill-change/references/observable-evidence.md +15 -0
- package/templates/.agents/skills/zaip-skill-dashboard-sqlite/SKILL.md +13 -5
- package/templates/.agents/skills/zaip-skill-data-analyst/SKILL.md +10 -5
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +5 -4
- package/templates/.agents/skills/zaip-skill-frontend-launcher/SKILL.md +4 -3
- package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +5 -3
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +5 -5
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +78 -13
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.test.mjs +59 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/yaml-parser.mjs +157 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +11 -6
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/SKILL.md +17 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/agents/openai.yaml +7 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/autonomous-cloud-inputs.example.json +41 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/autonomous-runner.md +84 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/operational-contract.md +19 -0
- package/templates/.agents/skills/zaip-skill-local-credentials/SKILL.md +43 -0
- package/templates/.agents/skills/zaip-skill-local-credentials/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-local-credentials/references/dotenv-resolution.md +47 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +8 -3
- package/templates/.agents/skills/zaip-skill-meta-ads/SKILL.md +16 -0
- package/templates/.agents/skills/zaip-skill-meta-ads/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-ads/references/setup.md +3 -0
- package/templates/.agents/skills/zaip-skill-meta-ads-setup/SKILL.md +24 -0
- package/templates/.agents/skills/zaip-skill-meta-ads-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-ads-setup/references/diagnostics.md +13 -0
- package/templates/.agents/skills/zaip-skill-meta-ads-setup/references/official-sources.md +10 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-health/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-health/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-health/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-health/references/upstream.md +77 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-integration/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-integration/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-integration/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-api-integration/references/upstream.md +126 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-health-check/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-health-check/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-health-check/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-health-check/references/upstream.md +67 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-review-prep/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-review-prep/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-review-prep/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-app-review-prep/references/upstream.md +69 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-compliance-check/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-compliance-check/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-compliance-check/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-compliance-check/references/upstream.md +79 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-access-token/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-access-token/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-access-token/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-access-token/references/upstream.md +144 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-webhooks/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-webhooks/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-webhooks/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-debug-webhooks/references/upstream.md +83 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-search-docs/SKILL.md +10 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-search-docs/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-search-docs/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-search-docs/references/setup.md +11 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-search-docs/references/upstream.md +55 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-webhook-setup/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-webhook-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-webhook-setup/references/LICENSE +21 -0
- package/templates/.agents/skills/zaip-skill-meta-devtools-webhook-setup/references/upstream.md +56 -0
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +12 -7
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +11 -4
- package/templates/.agents/skills/zaip-skill-tool-setup/SKILL.md +6 -4
- package/templates/.agents/skills/zaip-skill-tool-setup/references/codex-config.md +4 -2
- package/templates/.agents/skills/zaip-skill-tool-setup/references/secrets.md +1 -0
- package/templates/.agents/tools/catalog.yaml +6 -0
- package/templates/.agents/tools/cloud-runner-dns.mjs +28 -0
- package/templates/.agents/tools/cloud-runner-terraform.mjs +212 -0
- package/templates/.agents/tools/cloud-runner.integration.test.mjs +239 -0
- package/templates/.agents/tools/cloud-runner.mjs +786 -0
- package/templates/.agents/tools/cloud-runner.test.mjs +534 -0
- package/templates/.agents/tools/cloud-terraform-plan-policy.mjs +262 -0
- package/templates/.agents/tools/mcp/development/meta-devtools/README.md +14 -0
- package/templates/.agents/tools/mcp/development/meta-devtools/manifest.yaml +28 -0
- package/templates/.agents/tools/mcp/infra/cloudflare/manifest.yaml +2 -3
- package/templates/.agents/tools/mcp/infra/hostinger/manifest.yaml +1 -3
- package/templates/.agents/tools/mcp/marketing/meta-ads/README.md +15 -13
- package/templates/.agents/tools/mcp/marketing/meta-ads/manifest.yaml +15 -10
- package/templates/.agents/tools/profiles/development.yaml +3 -0
- package/templates/infra/terraform/.terraform.lock.hcl +42 -0
- package/templates/infra/terraform/README.md +31 -0
- package/templates/infra/terraform/backend.tf.json +13 -0
- package/templates/infra/terraform/deployment-inputs.example.yaml +22 -0
- package/templates/infra/terraform/fixtures/approved-targets.json +32 -0
- package/templates/infra/terraform/fixtures/plan-approved.json +67 -0
- package/templates/infra/terraform/main.tf +77 -0
- package/templates/infra/terraform/outputs.tf +20 -0
- package/templates/infra/terraform/terraform.tfvars.example +26 -0
- package/templates/infra/terraform/variables.tf +91 -0
- package/templates/infra/terraform/versions.tf +18 -0
- package/templates/scripts/validate-cloud-hostinger-contract.mjs +89 -0
- package/templates/scripts/validate-cloud-terraform-plan.mjs +1 -0
- package/templates/template-manifest.json +607 -167
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BwnJpl02.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-C09KmlSw.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Dyo_wpL4.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-hPPfVGQv.css +0 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-stale-seed.ts +0 -50
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
formatDurationMs,
|
|
6
6
|
} from "@zaip-ai/dashboard-ui";
|
|
7
7
|
import type { CostGroupRow, CostRunRow, DurationCoverage } from "../contracts.js";
|
|
8
|
+
import { invocationMetricDescription } from "./CostTableDisplay.js";
|
|
8
9
|
import { MoreVerticalIcon } from "./CostTableIcons.js";
|
|
9
10
|
import { type CostRunPagination, CostRunServerPagination } from "./CostTableLoading.js";
|
|
10
11
|
import type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
|
@@ -76,6 +77,14 @@ export function formatAuditableNumber(value: number | null, locale: CostLocale):
|
|
|
76
77
|
return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(value ?? 0);
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
function formatFactualCount(value: number | null, locale: CostLocale): string {
|
|
81
|
+
return value === null
|
|
82
|
+
? locale === "pt-BR"
|
|
83
|
+
? "Indisponível"
|
|
84
|
+
: "Unavailable"
|
|
85
|
+
: formatAuditableNumber(value, locale);
|
|
86
|
+
}
|
|
87
|
+
|
|
79
88
|
export function formatAuditableCompactNumber(value: number | null, locale: CostLocale): string {
|
|
80
89
|
return formatCompactNumber(value ?? 0, locale);
|
|
81
90
|
}
|
|
@@ -85,7 +94,8 @@ export function formatAuditableCurrency(
|
|
|
85
94
|
currency: CostCurrency,
|
|
86
95
|
locale: CostLocale,
|
|
87
96
|
): string {
|
|
88
|
-
|
|
97
|
+
if (value === null) return locale === "pt-BR" ? "Indispon\u00edvel" : "Unavailable";
|
|
98
|
+
return formatCurrency(value, currency, locale);
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
export function formatAuditableDuration(value: number | null, locale: CostLocale): string {
|
|
@@ -113,108 +123,6 @@ const formatInvocationMultiplierPair = (
|
|
|
113
123
|
locale: CostLocale,
|
|
114
124
|
) => formatMultiplierPair(input, output, locale);
|
|
115
125
|
|
|
116
|
-
function invocationMetricDescription(locale: CostLocale, metric: string): string {
|
|
117
|
-
const source =
|
|
118
|
-
locale === "pt-BR"
|
|
119
|
-
? "Valor da projeção SQLite/API desta Invocação de Agente. Fato canônico nulo permanece indisponível e não é convertido em zero."
|
|
120
|
-
: "Value from this Agent Invocation's SQLite/API projection. A null canonical fact remains unavailable and is not converted to zero.";
|
|
121
|
-
const details: Record<string, readonly [string, string]> = {
|
|
122
|
-
duration: [
|
|
123
|
-
"Tempo factual da invocação, quando capturado ou reconciliado.",
|
|
124
|
-
"Factual invocation duration, when captured or reconciled.",
|
|
125
|
-
],
|
|
126
|
-
inputTokens: [
|
|
127
|
-
"Input total informado pela fonte; inclui a parcela de cache.",
|
|
128
|
-
"Source-reported total input; includes the cached portion.",
|
|
129
|
-
],
|
|
130
|
-
cachedInputTokens: [
|
|
131
|
-
"Parcela de cache já incluída no input total.",
|
|
132
|
-
"Cached portion already included in total input.",
|
|
133
|
-
],
|
|
134
|
-
outputTokens: [
|
|
135
|
-
"Output total informado pela fonte; inclui a parcela de raciocínio.",
|
|
136
|
-
"Source-reported total output; includes the reasoning portion.",
|
|
137
|
-
],
|
|
138
|
-
reasoningTokens: [
|
|
139
|
-
"Parcela de raciocínio já incluída no output total.",
|
|
140
|
-
"Reasoning portion already included in total output.",
|
|
141
|
-
],
|
|
142
|
-
totalTokens: [
|
|
143
|
-
"Soma de entrada e saída quando ambas são conhecidas; caso contrário, total informado pela fonte.",
|
|
144
|
-
"Input plus output when both are known; otherwise the source-reported total.",
|
|
145
|
-
],
|
|
146
|
-
inputRate: [
|
|
147
|
-
"Tarifa efetiva de entrada em USD por milhão de tokens.",
|
|
148
|
-
"Effective input rate in USD per million tokens.",
|
|
149
|
-
],
|
|
150
|
-
cacheRate: [
|
|
151
|
-
"Tarifa efetiva de entrada em cache em USD por milhão de tokens.",
|
|
152
|
-
"Effective cached-input rate in USD per million tokens.",
|
|
153
|
-
],
|
|
154
|
-
outputRate: [
|
|
155
|
-
"Tarifa efetiva de saída em USD por milhão de tokens.",
|
|
156
|
-
"Effective output rate in USD per million tokens.",
|
|
157
|
-
],
|
|
158
|
-
reasoningRate: [
|
|
159
|
-
"Tarifa efetiva de raciocínio em USD por milhão de tokens.",
|
|
160
|
-
"Effective reasoning rate in USD per million tokens.",
|
|
161
|
-
],
|
|
162
|
-
contextMultiplier: [
|
|
163
|
-
"Multiplicadores de contexto de entrada/saída aplicados aos segmentos internos.",
|
|
164
|
-
"Input/output context multipliers applied to internal segments.",
|
|
165
|
-
],
|
|
166
|
-
inputCost: [
|
|
167
|
-
"Custo USD de entrada calculado com tokens e tarifa efetiva.",
|
|
168
|
-
"Input USD cost calculated from tokens and the effective rate.",
|
|
169
|
-
],
|
|
170
|
-
cacheCost: [
|
|
171
|
-
"Custo USD da entrada em cache calculado com tokens e tarifa efetiva.",
|
|
172
|
-
"Cached-input USD cost calculated from tokens and the effective rate.",
|
|
173
|
-
],
|
|
174
|
-
outputCost: [
|
|
175
|
-
"Custo USD de saída calculado com tokens e tarifa efetiva.",
|
|
176
|
-
"Output USD cost calculated from tokens and the effective rate.",
|
|
177
|
-
],
|
|
178
|
-
reasoningCost: [
|
|
179
|
-
"Custo USD de raciocínio calculado com tokens e tarifa efetiva.",
|
|
180
|
-
"Reasoning USD cost calculated from tokens and the effective rate.",
|
|
181
|
-
],
|
|
182
|
-
standardCost: [
|
|
183
|
-
"Custo USD no cenário Standard, antes do acréscimo de velocidade.",
|
|
184
|
-
"USD cost in the Standard scenario, before the speed uplift.",
|
|
185
|
-
],
|
|
186
|
-
speedUplift: [
|
|
187
|
-
"Acréscimo USD do cenário Priority/Fast, já incluído no custo efetivo.",
|
|
188
|
-
"USD uplift from the Priority/Fast scenario, already included in the effective cost.",
|
|
189
|
-
],
|
|
190
|
-
finalUsd: [
|
|
191
|
-
"Custo final estimado da API em USD, somando os componentes de custo desta invocação.",
|
|
192
|
-
"Estimated final API cost in USD, summing this invocation's cost components.",
|
|
193
|
-
],
|
|
194
|
-
fxRate: [
|
|
195
|
-
"Câmbio BRL/USD atual aplicado para converter o custo final atual.",
|
|
196
|
-
"Current BRL/USD exchange rate used to convert the current final cost.",
|
|
197
|
-
],
|
|
198
|
-
recordedFxRate: [
|
|
199
|
-
"Câmbio BRL/USD registrado no período da atividade.",
|
|
200
|
-
"BRL/USD exchange rate recorded for the activity period.",
|
|
201
|
-
],
|
|
202
|
-
recordedBrl: [
|
|
203
|
-
"Custo final BRL registrado no período, preservado para auditoria histórica.",
|
|
204
|
-
"Final BRL cost recorded in the period, retained for historical audit.",
|
|
205
|
-
],
|
|
206
|
-
cost: [
|
|
207
|
-
"Custo final atual: USD estimado ou sua conversão BRL pelo câmbio atual selecionado.",
|
|
208
|
-
"Current final cost: estimated USD or its BRL conversion at the selected current exchange rate.",
|
|
209
|
-
],
|
|
210
|
-
};
|
|
211
|
-
const detail = details[metric] ?? [
|
|
212
|
-
"Métrica numérica desta invocação.",
|
|
213
|
-
"Numeric metric for this invocation.",
|
|
214
|
-
];
|
|
215
|
-
return `${detail[locale === "pt-BR" ? 0 : 1]} ${source}`;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
126
|
export function formatDurationCoverage(value: DurationCoverage, locale: CostLocale): string {
|
|
219
127
|
// `known_sum` is a factual elapsed-time observation even when another
|
|
220
128
|
// activity in the population is unavailable. Keep completeness and the
|
|
@@ -611,6 +519,7 @@ export function CostGroupsTable({
|
|
|
611
519
|
showDateTime = true,
|
|
612
520
|
showAgentIdentity = false,
|
|
613
521
|
showInvocationTasks = false,
|
|
522
|
+
showModelLifecycleDetails = false,
|
|
614
523
|
dateHeading,
|
|
615
524
|
labelHeading,
|
|
616
525
|
totals: suppliedTotals,
|
|
@@ -624,18 +533,37 @@ export function CostGroupsTable({
|
|
|
624
533
|
showDateTime?: boolean;
|
|
625
534
|
showAgentIdentity?: boolean;
|
|
626
535
|
showInvocationTasks?: boolean;
|
|
536
|
+
showModelLifecycleDetails?: boolean;
|
|
627
537
|
dateHeading?: string;
|
|
628
538
|
labelHeading?: string;
|
|
629
539
|
totals?: CostGroupTotals;
|
|
630
540
|
loading?: boolean;
|
|
631
541
|
}) {
|
|
542
|
+
const displayCount = (value: number | null) =>
|
|
543
|
+
formatFactualCount(
|
|
544
|
+
showAgentIdentity || showModelLifecycleDetails ? (value ?? 0) : value,
|
|
545
|
+
locale,
|
|
546
|
+
);
|
|
547
|
+
const displayDuration = (value: DurationCoverage) =>
|
|
548
|
+
(showAgentIdentity || showModelLifecycleDetails) && value.known_sum <= 0
|
|
549
|
+
? "0"
|
|
550
|
+
: formatDurationCoverage(value, locale);
|
|
551
|
+
const displayCurrency = (value: number | null) =>
|
|
552
|
+
formatAuditableCurrency(
|
|
553
|
+
showAgentIdentity || showModelLifecycleDetails ? (value ?? 0) : value,
|
|
554
|
+
currency,
|
|
555
|
+
locale,
|
|
556
|
+
);
|
|
557
|
+
const conversationCount = (row: unknown): number | null =>
|
|
558
|
+
(row as { conversation_count?: number | null }).conversation_count ?? null;
|
|
632
559
|
const pageTotals = {
|
|
633
560
|
runs: rows.reduce((sum, row) => sum + row.run_count, 0),
|
|
634
|
-
tasks: rows.
|
|
635
|
-
prds: rows.
|
|
636
|
-
specs: rows.
|
|
637
|
-
evidences: rows.
|
|
638
|
-
tests: rows.
|
|
561
|
+
tasks: sumNumbers(rows.map((row) => row.task_count)),
|
|
562
|
+
prds: sumNumbers(rows.map((row) => row.prd_count)),
|
|
563
|
+
specs: sumNumbers(rows.map((row) => row.spec_count)),
|
|
564
|
+
evidences: sumNumbers(rows.map((row) => row.evidence_count)),
|
|
565
|
+
tests: sumNumbers(rows.map((row) => row.test_count)),
|
|
566
|
+
conversations: sumNumbers(rows.map(conversationCount)),
|
|
639
567
|
durationKnownMs: rows.reduce((sum, row) => sum + row.duration.known_sum, 0),
|
|
640
568
|
durationPartial: rows.some((row) => !row.duration.complete),
|
|
641
569
|
tokens: sumNumbers(rows.map((row) => row.total_tokens)),
|
|
@@ -647,18 +575,19 @@ export function CostGroupsTable({
|
|
|
647
575
|
? pageTotals
|
|
648
576
|
: {
|
|
649
577
|
runs: suppliedTotals.run_count,
|
|
650
|
-
tasks: suppliedTotals.task_count
|
|
578
|
+
tasks: suppliedTotals.task_count,
|
|
651
579
|
prds: suppliedTotals.prd_count,
|
|
652
580
|
specs: suppliedTotals.spec_count,
|
|
653
581
|
evidences: suppliedTotals.evidence_count,
|
|
654
582
|
tests: suppliedTotals.test_count,
|
|
583
|
+
conversations: conversationCount(suppliedTotals) ?? pageTotals.conversations,
|
|
655
584
|
durationKnownMs: suppliedTotals.duration.known_sum,
|
|
656
585
|
durationPartial: !suppliedTotals.duration.complete,
|
|
657
586
|
tokens: suppliedTotals.total_tokens,
|
|
658
587
|
usd: suppliedTotals.estimated_usd,
|
|
659
588
|
brl: suppliedTotals.estimated_brl,
|
|
660
589
|
};
|
|
661
|
-
const totalDurationDisplay =
|
|
590
|
+
const totalDurationDisplay = displayDuration(
|
|
662
591
|
suppliedTotals?.duration ?? {
|
|
663
592
|
known_sum: totals.durationKnownMs,
|
|
664
593
|
unknown: totals.durationPartial ? 1 : 0,
|
|
@@ -667,14 +596,12 @@ export function CostGroupsTable({
|
|
|
667
596
|
// factual known sum. Individual rows retain their original provenance.
|
|
668
597
|
coverage_ratio: totals.durationPartial ? 0 : 1,
|
|
669
598
|
},
|
|
670
|
-
locale,
|
|
671
599
|
);
|
|
672
|
-
const totalTokensDisplay = formatAuditableCompactNumber(
|
|
673
|
-
|
|
674
|
-
currency === "BRL" ? totals.brl : totals.usd,
|
|
675
|
-
currency,
|
|
600
|
+
const totalTokensDisplay = formatAuditableCompactNumber(
|
|
601
|
+
showModelLifecycleDetails ? (totals.tokens ?? 0) : totals.tokens,
|
|
676
602
|
locale,
|
|
677
603
|
);
|
|
604
|
+
const totalCostDisplay = displayCurrency(currency === "BRL" ? totals.brl : totals.usd);
|
|
678
605
|
const totalAriaLabel = costPeriodTotalAriaLabel({
|
|
679
606
|
locale,
|
|
680
607
|
duration: totalDurationDisplay,
|
|
@@ -729,7 +656,7 @@ export function CostGroupsTable({
|
|
|
729
656
|
sortValue: (row) => row.key,
|
|
730
657
|
footer: showDateTime ? undefined : <output aria-label={totalLabel}>Total</output>,
|
|
731
658
|
},
|
|
732
|
-
...(period === undefined
|
|
659
|
+
...(period === undefined && !showAgentIdentity && !showModelLifecycleDetails
|
|
733
660
|
? [
|
|
734
661
|
{
|
|
735
662
|
key: "runs",
|
|
@@ -761,79 +688,165 @@ export function CostGroupsTable({
|
|
|
761
688
|
{
|
|
762
689
|
key: "prds",
|
|
763
690
|
label: "PRDs",
|
|
764
|
-
render: (row: CostGroupRow) => row.prd_count,
|
|
691
|
+
render: (row: CostGroupRow) => displayCount(row.prd_count),
|
|
692
|
+
sortValue: (row: CostGroupRow) => row.prd_count ?? 0,
|
|
765
693
|
align: "right" as const,
|
|
766
|
-
footer: totals.prds,
|
|
694
|
+
footer: displayCount(totals.prds),
|
|
695
|
+
description: localizedDescription(
|
|
696
|
+
locale,
|
|
697
|
+
showAgentIdentity
|
|
698
|
+
? "PRDs com criação atribuída ao agente por Run registrado. Conta apenas vínculos observados, sem duplicar IDs."
|
|
699
|
+
: "PRDs criados por vínculo canônico com um único modelo financeiro observado. Sem essa prova, o indicador exibido é 0.",
|
|
700
|
+
"PRDs created through a canonical link to one observed financial model. Without that evidence, the displayed indicator is 0.",
|
|
701
|
+
),
|
|
767
702
|
},
|
|
768
703
|
{
|
|
769
704
|
key: "specs",
|
|
770
705
|
label: "SPECs",
|
|
771
|
-
render: (row: CostGroupRow) => row.spec_count,
|
|
706
|
+
render: (row: CostGroupRow) => displayCount(row.spec_count),
|
|
707
|
+
sortValue: (row: CostGroupRow) => row.spec_count ?? 0,
|
|
772
708
|
align: "right" as const,
|
|
773
|
-
footer: totals.specs,
|
|
709
|
+
footer: displayCount(totals.specs),
|
|
710
|
+
description: localizedDescription(
|
|
711
|
+
locale,
|
|
712
|
+
showAgentIdentity
|
|
713
|
+
? "SPECs com criação atribuída ao agente por Run registrado. Conta apenas vínculos observados, sem duplicar IDs."
|
|
714
|
+
: "SPECs criadas por vínculo canônico com um único modelo financeiro observado. Sem essa prova, o indicador exibido é 0.",
|
|
715
|
+
"SPECs created through a canonical link to one observed financial model. Without that evidence, the displayed indicator is 0.",
|
|
716
|
+
),
|
|
774
717
|
},
|
|
775
718
|
{
|
|
776
719
|
key: "tasks",
|
|
777
|
-
label:
|
|
778
|
-
|
|
720
|
+
label: showAgentIdentity
|
|
721
|
+
? locale === "pt-BR"
|
|
722
|
+
? "Tarefas"
|
|
723
|
+
: "Tasks"
|
|
724
|
+
: showModelLifecycleDetails
|
|
725
|
+
? "Tasks"
|
|
726
|
+
: locale === "pt-BR"
|
|
727
|
+
? "Tarefas criadas"
|
|
728
|
+
: "Tasks created",
|
|
729
|
+
render: (row: CostGroupRow) => displayCount(row.task_count),
|
|
730
|
+
sortValue: (row: CostGroupRow) => row.task_count ?? 0,
|
|
779
731
|
align: "right" as const,
|
|
780
|
-
footer: totals.tasks,
|
|
732
|
+
footer: displayCount(totals.tasks),
|
|
733
|
+
description: localizedDescription(
|
|
734
|
+
locale,
|
|
735
|
+
showAgentIdentity
|
|
736
|
+
? "Tasks distintas em que o agente participou no período. Uma Task pode contar em vários agentes; o total soma essas participações entre agentes. Sem participação, mostra 0."
|
|
737
|
+
: "Tasks contam apenas quando creation_run_id tem um único modelo financeiro observável. Participação posterior não é criação; ausência ou multi-modelo exibe 0.",
|
|
738
|
+
"Tasks count only when creation_run_id has one observed financial model. Later participation is not creation; missing or multi-model linkage displays 0.",
|
|
739
|
+
),
|
|
781
740
|
},
|
|
741
|
+
...(showModelLifecycleDetails
|
|
742
|
+
? [
|
|
743
|
+
{
|
|
744
|
+
key: "conversations",
|
|
745
|
+
label: "Conversations",
|
|
746
|
+
render: (row: CostGroupRow) => displayCount(conversationCount(row)),
|
|
747
|
+
sortValue: (row: CostGroupRow) => conversationCount(row) ?? 0,
|
|
748
|
+
align: "right" as const,
|
|
749
|
+
footer: displayCount(totals.conversations),
|
|
750
|
+
description: localizedDescription(
|
|
751
|
+
locale,
|
|
752
|
+
"Conversas canônicas, incluindo turns unassisted legados. Cada ID conta uma vez por modelo; um modelo múltiplo pode repetir. Run com Task e conversa de origem não cria Task adicional.",
|
|
753
|
+
"Canonical conversations, including legacy unassisted turns. Each ID counts once per model; a multi-model conversation may repeat. A Run with a Task and source conversation does not create an additional Task.",
|
|
754
|
+
),
|
|
755
|
+
},
|
|
756
|
+
]
|
|
757
|
+
: []),
|
|
782
758
|
{
|
|
783
759
|
key: "runs",
|
|
784
760
|
label: "Runs",
|
|
785
761
|
render: (row: CostGroupRow) => row.run_count,
|
|
762
|
+
sortValue: (row: CostGroupRow) => row.run_count,
|
|
786
763
|
align: "right" as const,
|
|
787
764
|
footer: totals.runs,
|
|
765
|
+
description: localizedDescription(
|
|
766
|
+
locale,
|
|
767
|
+
showAgentIdentity
|
|
768
|
+
? "Chamadas observadas atribuídas ao agente no período selecionado."
|
|
769
|
+
: "Runs financeiros observados neste modelo, sem distribuir ou duplicar custo, tokens e tempo entre modelos.",
|
|
770
|
+
"Observed financial Runs for this model, without allocating or duplicating cost, tokens, or time across models.",
|
|
771
|
+
),
|
|
788
772
|
},
|
|
789
773
|
{
|
|
790
774
|
key: "tests",
|
|
791
775
|
label: locale === "pt-BR" ? "Testes" : "Tests",
|
|
792
|
-
render: (row: CostGroupRow) => row.test_count,
|
|
776
|
+
render: (row: CostGroupRow) => displayCount(row.test_count),
|
|
777
|
+
sortValue: (row: CostGroupRow) => row.test_count ?? 0,
|
|
793
778
|
align: "right" as const,
|
|
794
|
-
footer: totals.tests,
|
|
779
|
+
footer: displayCount(totals.tests),
|
|
780
|
+
description: localizedDescription(
|
|
781
|
+
locale,
|
|
782
|
+
showAgentIdentity
|
|
783
|
+
? "Registros de testes distintos vinculados ao Run do agente no período. Revisões e outras validações não são contadas como testes."
|
|
784
|
+
: "Validações canônicas cuja artifact_run_id coincide com a Run registradora deste modelo; ausência de prova exibe 0.",
|
|
785
|
+
"Canonical validations whose artifact_run_id matches this model's registering Run; missing evidence displays 0.",
|
|
786
|
+
),
|
|
795
787
|
},
|
|
796
788
|
{
|
|
797
789
|
key: "evidences",
|
|
798
790
|
label: locale === "pt-BR" ? "Evidências" : "Evidence",
|
|
799
|
-
render: (row: CostGroupRow) => row.evidence_count,
|
|
791
|
+
render: (row: CostGroupRow) => displayCount(row.evidence_count),
|
|
792
|
+
sortValue: (row: CostGroupRow) => row.evidence_count ?? 0,
|
|
800
793
|
align: "right" as const,
|
|
801
|
-
footer: totals.evidences,
|
|
794
|
+
footer: displayCount(totals.evidences),
|
|
795
|
+
description: localizedDescription(
|
|
796
|
+
locale,
|
|
797
|
+
showAgentIdentity
|
|
798
|
+
? "Evidências distintas vinculadas ao Run do agente no período. Conta apenas vínculos registrados."
|
|
799
|
+
: "Evidências canônicas cuja artifact_run_id coincide com a Run registradora deste modelo; o total não duplica a mesma evidência. Sem prova, exibe 0.",
|
|
800
|
+
"Canonical evidence whose artifact_run_id matches this model's registering Run; the total does not duplicate the same evidence. Missing proof displays 0.",
|
|
801
|
+
),
|
|
802
802
|
},
|
|
803
803
|
]),
|
|
804
804
|
{
|
|
805
805
|
key: "duration",
|
|
806
806
|
label: "Tempo",
|
|
807
|
-
render: (row) =>
|
|
808
|
-
sortValue: (row) =>
|
|
807
|
+
render: (row) => displayDuration(row.duration),
|
|
808
|
+
sortValue: (row) =>
|
|
809
|
+
hasKnownDuration(row.duration)
|
|
810
|
+
? row.duration.known_sum
|
|
811
|
+
: showModelLifecycleDetails
|
|
812
|
+
? 0
|
|
813
|
+
: null,
|
|
809
814
|
align: "right",
|
|
810
815
|
footer: <output aria-label={totalAriaLabel}>{totalDurationDisplay}</output>,
|
|
811
816
|
},
|
|
812
817
|
{
|
|
813
818
|
key: "tokens",
|
|
814
819
|
label: "Tokens",
|
|
815
|
-
render: (row) =>
|
|
816
|
-
|
|
820
|
+
render: (row) =>
|
|
821
|
+
formatAuditableCompactNumber(
|
|
822
|
+
showModelLifecycleDetails ? (row.total_tokens ?? 0) : row.total_tokens,
|
|
823
|
+
locale,
|
|
824
|
+
),
|
|
825
|
+
sortValue: (row) =>
|
|
826
|
+
showModelLifecycleDetails ? (row.total_tokens ?? 0) : row.total_tokens,
|
|
817
827
|
align: "right",
|
|
818
828
|
footer: <output aria-label={totalAriaLabel}>{totalTokensDisplay}</output>,
|
|
819
829
|
},
|
|
820
830
|
{
|
|
821
831
|
key: "cost",
|
|
822
832
|
label:
|
|
823
|
-
period
|
|
833
|
+
showAgentIdentity || showModelLifecycleDetails || period !== undefined
|
|
824
834
|
? locale === "pt-BR"
|
|
825
|
-
? "Custo"
|
|
826
|
-
: "Cost"
|
|
827
|
-
: locale === "pt-BR"
|
|
828
835
|
? "Custos"
|
|
829
|
-
: "Costs"
|
|
836
|
+
: "Costs"
|
|
837
|
+
: period === undefined
|
|
838
|
+
? locale === "pt-BR"
|
|
839
|
+
? "Custo"
|
|
840
|
+
: "Cost"
|
|
841
|
+
: locale === "pt-BR"
|
|
842
|
+
? "Custos"
|
|
843
|
+
: "Costs",
|
|
830
844
|
render: (row) =>
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
sortValue: (row) => sortCostValue(currency, row.estimated_brl, row.estimated_usd),
|
|
845
|
+
displayCurrency(currency === "BRL" ? row.estimated_brl : row.estimated_usd),
|
|
846
|
+
sortValue: (row) =>
|
|
847
|
+
showModelLifecycleDetails
|
|
848
|
+
? (sortCostValue(currency, row.estimated_brl, row.estimated_usd) ?? 0)
|
|
849
|
+
: sortCostValue(currency, row.estimated_brl, row.estimated_usd),
|
|
837
850
|
align: "right",
|
|
838
851
|
footer: <output aria-label={totalAriaLabel}>{totalCostDisplay}</output>,
|
|
839
852
|
},
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/InvocationManifestQuery.test.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { queryInvocationManifestPeriod } from "@zaip-ai/costs";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
|
|
5
|
+
describe("manifest-first invocation query", () => {
|
|
6
|
+
it("opens only intersecting monthly manifests and candidate chunks", async () => {
|
|
7
|
+
const inRange = signedSummary({
|
|
8
|
+
agent_invocation_id: "RUN-JULY-OPENAI",
|
|
9
|
+
occurred_at: "2026-07-10T12:00:00.000Z",
|
|
10
|
+
provider: "openai",
|
|
11
|
+
});
|
|
12
|
+
const outOfRange = signedSummary({
|
|
13
|
+
agent_invocation_id: "RUN-JULY-ANTHROPIC",
|
|
14
|
+
occurred_at: "2026-07-20T12:00:00.000Z",
|
|
15
|
+
provider: "anthropic",
|
|
16
|
+
});
|
|
17
|
+
const firstChunk = `${JSON.stringify(inRange)}\n`;
|
|
18
|
+
const secondChunk = `${JSON.stringify(outOfRange)}\n`;
|
|
19
|
+
const manifest = signedManifest({
|
|
20
|
+
period: { year: 2026, month: 7 },
|
|
21
|
+
from: "2026-07-10T12:00:00.000Z",
|
|
22
|
+
to: "2026-07-20T12:00:00.000Z",
|
|
23
|
+
chunks: [
|
|
24
|
+
{
|
|
25
|
+
path: ".agents/records/telemetry/2026/07/chunk-openai.jsonl",
|
|
26
|
+
content_sha256: digest(firstChunk),
|
|
27
|
+
summary_count: 1,
|
|
28
|
+
from: inRange.occurred_at,
|
|
29
|
+
to: inRange.occurred_at,
|
|
30
|
+
summary_hashes: [inRange.summary_hash],
|
|
31
|
+
dimensions: dimensions({ providers: ["openai"] }),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: ".agents/records/telemetry/2026/07/chunk-anthropic.jsonl",
|
|
35
|
+
content_sha256: digest(secondChunk),
|
|
36
|
+
summary_count: 1,
|
|
37
|
+
from: outOfRange.occurred_at,
|
|
38
|
+
to: outOfRange.occurred_at,
|
|
39
|
+
summary_hashes: [outOfRange.summary_hash],
|
|
40
|
+
dimensions: dimensions({ providers: ["anthropic"] }),
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
const reads: string[] = [];
|
|
45
|
+
const openaiChunkPath = manifest.chunks[0]?.path;
|
|
46
|
+
const anthropicChunkPath = manifest.chunks[1]?.path;
|
|
47
|
+
if (openaiChunkPath === undefined || anthropicChunkPath === undefined)
|
|
48
|
+
throw new Error("Expected two manifest chunks");
|
|
49
|
+
const files = new Map<string, string>([
|
|
50
|
+
[".agents/records/telemetry/2026/07/manifest.json", JSON.stringify(manifest)],
|
|
51
|
+
[openaiChunkPath, firstChunk],
|
|
52
|
+
[anthropicChunkPath, secondChunk],
|
|
53
|
+
]);
|
|
54
|
+
const result = await queryInvocationManifestPeriod(
|
|
55
|
+
{
|
|
56
|
+
exists: async (path) => files.has(path),
|
|
57
|
+
readText: async (path) => {
|
|
58
|
+
reads.push(path);
|
|
59
|
+
const value = files.get(path);
|
|
60
|
+
if (value === undefined) throw new Error(`Missing fixture: ${path}`);
|
|
61
|
+
return value;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{ from: "2026-07-09", to: "2026-07-11", filters: { providers: ["openai"] } },
|
|
65
|
+
);
|
|
66
|
+
expect(result.summaries.map((summary) => summary.agent_invocation_id)).toEqual([
|
|
67
|
+
"RUN-JULY-OPENAI",
|
|
68
|
+
]);
|
|
69
|
+
expect(result.manifest_count).toBe(1);
|
|
70
|
+
expect(result.chunk_count).toBe(1);
|
|
71
|
+
expect(result.source_latest_at).toBe("2026-07-20T12:00:00.000Z");
|
|
72
|
+
expect(result.lag_ms).toBe(10);
|
|
73
|
+
expect(reads).toEqual([".agents/records/telemetry/2026/07/manifest.json", openaiChunkPath]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
function digest(value: string): string {
|
|
78
|
+
return createHash("sha256").update(value).digest("hex");
|
|
79
|
+
}
|
|
80
|
+
function dimensions(overrides: Partial<Record<string, readonly string[]>> = {}) {
|
|
81
|
+
return {
|
|
82
|
+
providers: [],
|
|
83
|
+
models: [],
|
|
84
|
+
zaip_agents: [],
|
|
85
|
+
phases: [],
|
|
86
|
+
purposes: [],
|
|
87
|
+
statuses: [],
|
|
88
|
+
executions: [],
|
|
89
|
+
tasks: [],
|
|
90
|
+
specs: [],
|
|
91
|
+
prds: [],
|
|
92
|
+
changes: [],
|
|
93
|
+
...overrides,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function signedSummary(input: {
|
|
97
|
+
agent_invocation_id: string;
|
|
98
|
+
occurred_at: string;
|
|
99
|
+
provider: string;
|
|
100
|
+
}) {
|
|
101
|
+
const unsigned = {
|
|
102
|
+
schema_version: 1,
|
|
103
|
+
agent_invocation_id: input.agent_invocation_id,
|
|
104
|
+
occurred_at: input.occurred_at,
|
|
105
|
+
coverage: "complete",
|
|
106
|
+
usage_segments: [{ provider: input.provider, model: "gpt-5.6-terra" }],
|
|
107
|
+
};
|
|
108
|
+
return { ...unsigned, summary_hash: digest(JSON.stringify(unsigned)) };
|
|
109
|
+
}
|
|
110
|
+
function signedManifest(input: {
|
|
111
|
+
period: { year: number; month: number };
|
|
112
|
+
from: string;
|
|
113
|
+
to: string;
|
|
114
|
+
chunks: Array<{
|
|
115
|
+
path: string;
|
|
116
|
+
content_sha256: string;
|
|
117
|
+
summary_count: number;
|
|
118
|
+
from: string;
|
|
119
|
+
to: string;
|
|
120
|
+
summary_hashes: string[];
|
|
121
|
+
dimensions: ReturnType<typeof dimensions>;
|
|
122
|
+
}>;
|
|
123
|
+
}) {
|
|
124
|
+
const unsigned = {
|
|
125
|
+
schema_version: 1,
|
|
126
|
+
period: input.period,
|
|
127
|
+
summary_count: input.chunks.reduce((sum, chunk) => sum + chunk.summary_count, 0),
|
|
128
|
+
chunk_count: input.chunks.length,
|
|
129
|
+
from: input.from,
|
|
130
|
+
to: input.to,
|
|
131
|
+
source_latest_at: input.to,
|
|
132
|
+
lag_ms: 10,
|
|
133
|
+
coverage: { complete: 2, partial: 0, unavailable: 0 },
|
|
134
|
+
chunks: input.chunks,
|
|
135
|
+
dimensions: dimensions(),
|
|
136
|
+
aggregates: { daily: {}, monthly: {}, annual: {} },
|
|
137
|
+
integrity: {
|
|
138
|
+
status: "verified",
|
|
139
|
+
algorithm: "sha256",
|
|
140
|
+
chunk_count: input.chunks.length,
|
|
141
|
+
summary_count: input.chunks.reduce((sum, chunk) => sum + chunk.summary_count, 0),
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
return { ...unsigned, manifest_hash: digest(JSON.stringify(unsigned)) };
|
|
145
|
+
}
|
|
@@ -78,18 +78,19 @@ export function enrichPeriodCostGroups(
|
|
|
78
78
|
|
|
79
79
|
for (const prd of entities.prds) {
|
|
80
80
|
const bucket = bucketFor(prd.created_at);
|
|
81
|
-
if (bucket !== null) bucket.prd_count
|
|
81
|
+
if (bucket !== null) bucket.prd_count = (bucket.prd_count ?? 0) + 1;
|
|
82
82
|
}
|
|
83
83
|
for (const spec of entities.specs) {
|
|
84
84
|
const bucket = bucketFor(spec.created_at);
|
|
85
|
-
if (bucket !== null) bucket.spec_count
|
|
85
|
+
if (bucket !== null) bucket.spec_count = (bucket.spec_count ?? 0) + 1;
|
|
86
86
|
}
|
|
87
87
|
for (const task of entities.tasks) {
|
|
88
88
|
const bucket = bucketFor(task.created_at);
|
|
89
89
|
if (bucket === null) continue;
|
|
90
90
|
bucket.task_count = (bucket.task_count ?? 0) + 1;
|
|
91
91
|
bucket.tasksCreated = (bucket.tasksCreated ?? 0) + 1;
|
|
92
|
-
if (entities.validations === undefined)
|
|
92
|
+
if (entities.validations === undefined)
|
|
93
|
+
bucket.test_count = (bucket.test_count ?? 0) + (task.test_count ?? 0);
|
|
93
94
|
const ids = evidenceIds.get(bucket.key) ?? new Set<string>();
|
|
94
95
|
for (const evidenceId of task.result?.evidence_ids ?? [])
|
|
95
96
|
if (!typedEvidenceIds.has(evidenceId)) ids.add(evidenceId);
|
|
@@ -129,8 +130,9 @@ export function summarizeCostPeriodAverages(
|
|
|
129
130
|
return {
|
|
130
131
|
tasks:
|
|
131
132
|
divisor === 0 ? null : rows.reduce((sum, row) => sum + (row.task_count ?? 0), 0) / divisor,
|
|
132
|
-
specs:
|
|
133
|
-
|
|
133
|
+
specs:
|
|
134
|
+
divisor === 0 ? null : rows.reduce((sum, row) => sum + (row.spec_count ?? 0), 0) / divisor,
|
|
135
|
+
prds: divisor === 0 ? null : rows.reduce((sum, row) => sum + (row.prd_count ?? 0), 0) / divisor,
|
|
134
136
|
durationMs: averagePerPeriod(
|
|
135
137
|
rows.map((row) => row.duration_ms),
|
|
136
138
|
divisor,
|
|
@@ -44,6 +44,7 @@ export function useCompactCostPage({
|
|
|
44
44
|
range,
|
|
45
45
|
query,
|
|
46
46
|
filters,
|
|
47
|
+
revision,
|
|
47
48
|
}: {
|
|
48
49
|
view: CostView;
|
|
49
50
|
load: LoadCompactCostPage | undefined;
|
|
@@ -51,6 +52,8 @@ export function useCompactCostPage({
|
|
|
51
52
|
range: { from: string; to: string } | undefined;
|
|
52
53
|
query: string | undefined;
|
|
53
54
|
filters: CostFilterState;
|
|
55
|
+
/** Changes when the host promotes a new immutable dashboard snapshot. */
|
|
56
|
+
revision: number;
|
|
54
57
|
}) {
|
|
55
58
|
const [offset, setOffset] = useState(0);
|
|
56
59
|
const [page, setPage] = useState<CompactLifecycleCostPage | null>(null);
|
|
@@ -66,7 +69,7 @@ export function useCompactCostPage({
|
|
|
66
69
|
const rangeTo = range?.to;
|
|
67
70
|
const filterKey = Object.values(filters).join("\u0000");
|
|
68
71
|
const paginationKey = `${view}\u0000${limit}\u0000${query ?? ""}\u0000${rangeFrom ?? ""}\u0000${rangeTo ?? ""}\u0000${filterKey}`;
|
|
69
|
-
const requestKey = `${paginationKey}\u0000${offset}`;
|
|
72
|
+
const requestKey = `${paginationKey}\u0000${offset}\u0000${revision}`;
|
|
70
73
|
const requestInputRef = useRef({ filters, limit, query, rangeFrom, rangeTo });
|
|
71
74
|
requestInputRef.current = { filters, limit, query, rangeFrom, rangeTo };
|
|
72
75
|
useEffect(() => {
|
|
@@ -98,6 +98,7 @@ export function useCostGroupPage({
|
|
|
98
98
|
globalQuery,
|
|
99
99
|
limit = 50,
|
|
100
100
|
filters,
|
|
101
|
+
revision,
|
|
101
102
|
load,
|
|
102
103
|
}: {
|
|
103
104
|
active?: boolean;
|
|
@@ -106,6 +107,8 @@ export function useCostGroupPage({
|
|
|
106
107
|
globalQuery: string;
|
|
107
108
|
limit?: number;
|
|
108
109
|
filters: CostGroupFilters;
|
|
110
|
+
/** Changes when the host promotes a new immutable dashboard snapshot. */
|
|
111
|
+
revision: number;
|
|
109
112
|
load?: LoadCostGroupPage;
|
|
110
113
|
}) {
|
|
111
114
|
const [offset, setOffset] = useState(0);
|
|
@@ -120,7 +123,7 @@ export function useCostGroupPage({
|
|
|
120
123
|
const query = effectiveCostGroupQuery(filters, globalQuery);
|
|
121
124
|
const filterKey = `${Object.values(filters).join("\u0000")}\u0000${query}`;
|
|
122
125
|
const paginationKey = `${view}\u0000${limit}\u0000${range?.from ?? ""}\u0000${range?.to ?? ""}\u0000${filterKey}`;
|
|
123
|
-
const requestKey = `${paginationKey}\u0000${offset}`;
|
|
126
|
+
const requestKey = `${paginationKey}\u0000${offset}\u0000${revision}`;
|
|
124
127
|
const requestInputRef = useRef({ filters, limit, query, range, view });
|
|
125
128
|
requestInputRef.current = { filters, limit, query, range, view };
|
|
126
129
|
useEffect(() => {
|