@zaip-ai/cli 1.0.7 → 1.0.8
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 +6 -4
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +15 -5
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/adapters.test.js +1 -1
- package/dist/services/agent-adapters.d.ts +9 -0
- package/dist/services/agent-adapters.d.ts.map +1 -1
- package/dist/services/agent-adapters.js +38 -3
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-adapters.test.js +8 -1
- package/dist/services/agent-adapters.test.js.map +1 -1
- package/dist/services/codex-config-template.d.ts +2 -1
- package/dist/services/codex-config-template.d.ts.map +1 -1
- package/dist/services/codex-config-template.js +13 -2
- 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 +31 -7
- package/dist/services/codex-rules.js.map +1 -1
- package/dist/services/codex-subagent-hook-template.d.ts +1 -1
- package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
- package/dist/services/codex-subagent-hook-template.js +4 -1
- package/dist/services/codex-subagent-hook-template.js.map +1 -1
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +3 -1
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/global-codex-config.d.ts +6 -3
- package/dist/services/global-codex-config.d.ts.map +1 -1
- package/dist/services/global-codex-config.js +82 -13
- package/dist/services/global-codex-config.js.map +1 -1
- package/dist/services/global-codex-config.test.js +57 -10
- package/dist/services/global-codex-config.test.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +15 -2
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.js +1 -1
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +3 -3
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/runtime-template.test.js +21 -5
- package/dist/services/runtime-template.test.js.map +1 -1
- package/dist/services/template-manifest.d.ts.map +1 -1
- package/dist/services/template-manifest.js +2 -0
- package/dist/services/template-manifest.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/config/agents/catalog.yaml +310 -10
- package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +30 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +5 -5
- package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
- package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +30 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +30 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +30 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +8 -8
- package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +5 -3
- package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +30 -0
- package/templates/.agents/config/project.yaml +1 -1
- package/templates/.agents/dashboard/.zaip-managed.json +659 -163
- package/templates/.agents/dashboard/DATA-DICTIONARY.md +2227 -0
- package/templates/.agents/dashboard/README.md +48 -97
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-Z60df2r-.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-Cv-JcoxP.js → DashboardHelpDialog-Cs6dzDmW.js} +294 -109
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-Coc6pA-1.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-QE1k9yZB.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-_Pf5DA_A.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BVlz3DLZ.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-CaKwQP43.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Cf9ctPVt.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-C98LGC-Q.js → dashboard-localization-CLJ0lT9v.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/icons-vendor-DFBuc_qp.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8A4DcNXM.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/react-vendor-CCQOHdVI.js +9 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DFY7ZDlu.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-pC2_0J8x.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +9 -2
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +952 -595
- package/templates/.agents/dashboard/apps/frontend/src/AppLoadingBoundary.tsx +48 -0
- package/templates/.agents/dashboard/apps/frontend/src/AppLoadingPanels.tsx +2 -0
- package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +247 -0
- package/templates/.agents/dashboard/apps/frontend/src/AppRequestGuards.tsx +95 -0
- package/templates/.agents/dashboard/apps/frontend/src/AppSetupRoutes.tsx +87 -0
- package/templates/.agents/dashboard/apps/frontend/src/CostCalculationGuidePage.tsx +641 -0
- package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +159 -0
- package/templates/.agents/dashboard/apps/frontend/src/DashboardCapabilityNav.tsx +13 -13
- package/templates/.agents/dashboard/apps/frontend/src/DashboardGlobalSettings.tsx +56 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +257 -313
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +149 -0
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +35 -0
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +111 -12
- package/templates/.agents/dashboard/apps/frontend/src/app-preferences.ts +15 -0
- package/templates/.agents/dashboard/apps/frontend/src/app-session-token.ts +20 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.css +267 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.test.ts +69 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +70 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +111 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +432 -13
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.ts +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/main.tsx +1 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.test.ts +55 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-detail-hydration.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.test.ts +126 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.ts +181 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-contract.test.ts +138 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +105 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period.test.ts +6 -3
- package/templates/.agents/dashboard/apps/frontend/src/operations-period.ts +9 -5
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +24 -0
- package/templates/.agents/dashboard/apps/frontend/src/period-transition-overlay.css +44 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +121 -62
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +471 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +84 -17
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +44 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +196 -39
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-notice.ts +15 -0
- package/templates/.agents/dashboard/apps/frontend/src/sqlite-cost-adapters.ts +26 -0
- package/templates/.agents/dashboard/apps/frontend/src/styles.css +14 -2
- package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +38 -2
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +187 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +190 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +121 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +398 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +141 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +45 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +46 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +37 -0
- package/templates/.agents/dashboard/apps/frontend/vite.config.ts +55 -5
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +47 -6
- package/templates/.agents/dashboard/modules/cost-monitor/src/duration-estimate.ts +13 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +64 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +275 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +100 -15
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +131 -40
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +137 -19
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.test.ts +2 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +13 -10
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +303 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +226 -6
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +479 -402
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostSummary.tsx +5 -13
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +312 -72
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +373 -321
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.test.ts +17 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.tsx +25 -6
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +0 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-helpers.ts +17 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-responsive.css +6 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-row-filters.ts +123 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-summary.ts +8 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +32 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +52 -14
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-presentation.ts +121 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +3 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.test.ts +68 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +32 -5
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +108 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +12 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +60 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +106 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.test.ts +2 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.ts +5 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-pricing-fallback.test.ts +53 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.basics.test.ts +34 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +168 -137
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +188 -29
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +956 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +775 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +95 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/index.ts +1 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/refactor-map-xr9l.json +61 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.test.ts +41 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/task-cost-groups.ts +55 -11
- package/templates/.agents/dashboard/modules/operations/package.json +2 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +182 -0
- package/templates/.agents/dashboard/modules/operations/src/duration-population.test.ts +63 -1
- package/templates/.agents/dashboard/modules/operations/src/duration-population.ts +60 -5
- package/templates/.agents/dashboard/modules/operations/src/react/EntityDetailsDialog.tsx +14 -3
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.test.ts +44 -1
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +325 -18
- package/templates/.agents/dashboard/modules/operations/src/react/MacroPlanningDialog.tsx +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.test.ts +9 -5
- package/templates/.agents/dashboard/modules/operations/src/react/OperationDateFilters.tsx +2 -2
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +168 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +95 -6
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +365 -14
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +532 -131
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +314 -358
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +68 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +169 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +51 -8
- package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +32 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.tsx +62 -6
- package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.test.ts +55 -0
- package/templates/.agents/dashboard/modules/operations/src/react/TaskBoard.tsx +27 -19
- package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +99 -42
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.priority.test.ts +19 -0
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +255 -34
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +163 -8
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +101 -68
- package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.test.ts +72 -1
- package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +78 -16
- package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +6 -4
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +50 -1
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +143 -9
- package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +29 -4
- package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog-content.css +49 -0
- package/templates/.agents/dashboard/modules/operations/src/react/macro-planning-dialog.css +93 -50
- package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +82 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.test.ts +29 -2
- package/templates/.agents/dashboard/modules/operations/src/react/operation-date-range.ts +22 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +77 -4
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +65 -5
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +54 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +19 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +149 -12
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +27 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +136 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.test.ts +160 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-period-scope.ts +47 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-query.ts +10 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-responsive.css +3 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-view-labels.ts +28 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +24 -7
- package/templates/.agents/dashboard/modules/operations/src/react/operations.css +42 -0
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.test.ts +54 -0
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary-population.ts +32 -0
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +165 -6
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +148 -6
- package/templates/.agents/dashboard/modules/operations/src/react/popup-localization.test.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css +132 -0
- package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.css.test.ts +13 -0
- package/templates/.agents/dashboard/modules/operations/src/react/unified-work-board.header.test.ts +16 -0
- package/templates/.agents/dashboard/modules/operations/src/react/use-infinite-column.ts +11 -5
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +5 -3
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +4 -83
- package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.test.ts +291 -15
- package/templates/.agents/dashboard/modules/operations/src/server/build-operations-projection.ts +182 -472
- package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.test.ts +40 -0
- package/templates/.agents/dashboard/modules/operations/src/server/canonical-compat.ts +19 -6
- package/templates/.agents/dashboard/modules/operations/src/server/canonical-run-projection.ts +31 -6
- package/templates/.agents/dashboard/modules/operations/src/server/daily-duration-projection.ts +220 -0
- package/templates/.agents/dashboard/modules/operations/src/server/execution-duration-projection.ts +28 -0
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +27 -2
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +22 -13
- package/templates/.agents/dashboard/modules/operations/src/server/filter.test.ts +3 -3
- package/templates/.agents/dashboard/modules/operations/src/server/filter.ts +7 -2
- package/templates/.agents/dashboard/modules/operations/src/server/index.ts +3 -0
- package/templates/.agents/dashboard/modules/operations/src/server/macro.ts +3 -12
- package/templates/.agents/dashboard/modules/operations/src/server/manifest-usage.ts +65 -0
- package/templates/.agents/dashboard/modules/operations/src/server/operations-projection-aggregates.ts +297 -0
- package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +324 -0
- package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.test.ts +505 -0
- package/templates/.agents/dashboard/modules/operations/src/server/quick-operations-projection.ts +609 -0
- package/templates/.agents/dashboard/modules/operations/src/server/runs.ts +18 -19
- package/templates/.agents/dashboard/modules/operations/src/work-board-model.ts +76 -0
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/modules/traceability/src/server/build-task-trace.ts +3 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/contracts/src/index.ts +1 -0
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +1756 -0
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1608 -0
- package/templates/.agents/dashboard/packages/local-runtime/package.json +8 -3
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +12 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +83 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +28 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +262 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +41 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +105 -0
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1643 -107
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-adapter-sync.ts +30 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +3 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.ts +5 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/manifest-runs.ts +72 -33
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +335 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +392 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/runtime.mjs +5 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +71 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +179 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-cross-layer-parity.test.ts +245 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models-route.ts +64 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.test.ts +204 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-daily-read-models.ts +194 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.test.ts +163 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.ts +354 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.test.ts +74 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.ts +113 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-overview.test.ts +68 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period.ts +47 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-projections.ts +483 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-settings.test.ts +5 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +163 -84
- package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +145 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +551 -266
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +1145 -308
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +53 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +708 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +2232 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +6151 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +33 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-history.mjs +41 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-processes.mjs +210 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +437 -190
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +299 -24
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/packages/windows-launcher/LauncherVerificationBehaviorTests.cs +206 -0
- package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +95 -8
- package/templates/.agents/dashboard/packages/windows-launcher/build-dashboard-launcher.ps1 +2 -2
- package/templates/.agents/dashboard/packages/windows-launcher/run-launcher-verification-tests.ps1 +22 -0
- package/templates/.agents/dashboard/read-model.dbml +2201 -0
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +1 -1
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +214 -41
- package/templates/.agents/dashboard/work-priority.json +34 -0
- package/templates/.agents/dashboard/zaip-dashboard-linux.sh +45 -0
- package/templates/.agents/dashboard/zaip-dashboard-mac.command +3 -0
- package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
- package/templates/.agents/design/.zaip-managed.json +3 -3
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- 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 +24 -0
- 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 +4 -3
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +9 -6
- 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 +9 -3
- package/templates/.agents/requirements/zaip-strategic-95.md +4 -4
- package/templates/.agents/rules/autonomy-decision.md +15 -0
- package/templates/.agents/rules/core.md +1 -1
- package/templates/.agents/rules/run-lifecycle-closure.md +1 -1
- package/templates/.agents/rules/specialist-routing.md +19 -0
- package/templates/.agents/rules/workflow.md +1 -1
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +114 -64
- package/templates/.agents/runtime/checksums.sha256 +6 -4
- package/templates/.agents/runtime/manifest.json +3 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -0
- package/templates/.agents/runtime/provenance.json +11 -0
- package/templates/.agents/runtime/sbom.cdx.json +1929 -39
- package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +30 -0
- package/templates/.agents/skills/zaip-skill-dashboard-sqlite/SKILL.md +25 -0
- package/templates/.agents/skills/zaip-skill-dashboard-sqlite/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-executar-fila-pronta/SKILL.md +18 -0
- package/templates/.agents/skills/zaip-skill-executar-fila-pronta/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.mjs +71 -0
- package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.test.mjs +60 -0
- package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/scheduled-ready-queue-contract.test.mjs +111 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +2 -2
- package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +3 -1
- package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-general-operations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +9 -7
- package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +11 -38
- package/templates/.agents/skills/zaip-skill-governance-compliance/SKILL.md +12 -0
- package/templates/.agents/skills/zaip-skill-governance-compliance/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/references/growth-revops-framework.md +25 -0
- package/templates/.agents/skills/zaip-skill-instalar-agendamento/SKILL.md +17 -0
- package/templates/.agents/skills/zaip-skill-instalar-agendamento/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +76 -27
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +128 -24
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +122 -4
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +66 -19
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +193 -7
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-sales-methodology/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-sales-methodology/references/sales-process-framework.md +77 -0
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +5 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +96 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +18 -0
- package/templates/.agents/zaip-aios/INDEX.md +1 -0
- package/templates/.agents/zaip-aios/README.md +37 -8
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +43 -6
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +21 -7
- package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +32 -0
- package/templates/template-manifest.json +945 -214
- package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-CLYIi7Vo.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/AgentCatalogSettingsPage-DTDNVQGX.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-CzEggcRb.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-05YKn6Z4.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-YO3yqtgV.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8AzCnl3a.js +0 -77
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DdBYQ_8D.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/src/AgentCatalogSettingsPage.tsx +0 -617
- package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings-page.css +0 -660
- package/templates/.agents/dashboard/apps/frontend/src/agent-catalog-settings.test.ts +0 -249
- package/templates/.agents/dashboard/dashboard.config.json +0 -4
- package/templates/.agents/dashboard/zaip-dashboard.exe +0 -0
|
@@ -32,6 +32,23 @@ describe("macroCostDuration", () => {
|
|
|
32
32
|
expect(operationalMacroDuration({ duration_ms: 2_686_869 } as never)).toBeNull();
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
it("accepts factual values and estimates a tokenized Run without lifecycle elapsed time", () => {
|
|
36
|
+
expect(
|
|
37
|
+
macroCostDuration({
|
|
38
|
+
source_duration_ms: null,
|
|
39
|
+
duration_ms: 2_105_284,
|
|
40
|
+
duration_provenance: "legacy_inferred",
|
|
41
|
+
} as never),
|
|
42
|
+
).toBe(2_105_284);
|
|
43
|
+
expect(
|
|
44
|
+
macroCostDuration({
|
|
45
|
+
source_duration_ms: null,
|
|
46
|
+
duration_ms: null,
|
|
47
|
+
usage: { total: { tokens: { total: 4_000_000 } } },
|
|
48
|
+
} as never),
|
|
49
|
+
).toBe(3_600_000);
|
|
50
|
+
});
|
|
51
|
+
|
|
35
52
|
it("uses only the root execution analytical duration, never lifecycle elapsed time or a subrun", () => {
|
|
36
53
|
const macro = { id: "PRD-1", kind: "prd", run_ids: [] } as never;
|
|
37
54
|
const root = {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
formatPercent,
|
|
12
12
|
} from "@zaip-ai/dashboard-ui";
|
|
13
13
|
import { useState } from "react";
|
|
14
|
+
import { estimatedDurationMs } from "../duration-estimate.js";
|
|
14
15
|
import { formatDateTime, sortCostValue } from "./CostTables.js";
|
|
15
16
|
import type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
|
16
17
|
|
|
@@ -19,19 +20,23 @@ export function MacroCostTable({
|
|
|
19
20
|
currency,
|
|
20
21
|
details,
|
|
21
22
|
locale,
|
|
23
|
+
totalDurationMs,
|
|
22
24
|
onOpenTrace,
|
|
23
25
|
}: {
|
|
24
26
|
rows: readonly MacroProjection[];
|
|
25
27
|
currency: CostCurrency;
|
|
26
28
|
details?: Pick<OperationsProjection, "runs" | "specs" | "tasks">;
|
|
27
29
|
locale: CostLocale;
|
|
30
|
+
totalDurationMs?: number | null;
|
|
28
31
|
onOpenTrace: (taskId: string) => void;
|
|
29
32
|
}) {
|
|
30
33
|
const [selectedRow, setSelectedRow] = useState<MacroProjection | null>(null);
|
|
31
34
|
const openRow = (row: MacroProjection) => setSelectedRow(row);
|
|
32
35
|
const totalTasks = rows.reduce((sum, row) => sum + row.task_count, 0);
|
|
33
36
|
const totalRuns = rows.reduce((sum, row) => sum + row.run_count, 0);
|
|
34
|
-
const durations = rows.map(
|
|
37
|
+
const durations = rows.map(
|
|
38
|
+
(row) => row.duration_ms ?? operationalMacroDuration(row, details?.runs ?? []),
|
|
39
|
+
);
|
|
35
40
|
const totalDuration = sumObserved(durations);
|
|
36
41
|
const totalTokens = rows.reduce((sum, row) => sum + (row.usage.total.tokens.total ?? 0), 0);
|
|
37
42
|
const totalCost = rows.reduce(
|
|
@@ -79,12 +84,17 @@ export function MacroCostTable({
|
|
|
79
84
|
key: "duration",
|
|
80
85
|
label: locale === "pt-BR" ? "Tempo" : "Time",
|
|
81
86
|
render: (row) => {
|
|
82
|
-
const duration =
|
|
83
|
-
|
|
87
|
+
const duration =
|
|
88
|
+
row.duration_ms ?? operationalMacroDuration(row, details?.runs ?? []);
|
|
89
|
+
return duration === null || duration === 0 ? "0" : formatDurationMs(duration, locale);
|
|
84
90
|
},
|
|
85
91
|
align: "right",
|
|
86
92
|
footer:
|
|
87
|
-
|
|
93
|
+
totalDurationMs !== null && totalDurationMs !== undefined
|
|
94
|
+
? formatDurationMs(totalDurationMs, locale)
|
|
95
|
+
: totalDuration === null || totalDuration === 0
|
|
96
|
+
? "0"
|
|
97
|
+
: formatDurationMs(totalDuration, locale),
|
|
88
98
|
},
|
|
89
99
|
{
|
|
90
100
|
key: "tokens",
|
|
@@ -183,9 +193,18 @@ export function operationalMacroDuration(
|
|
|
183
193
|
}
|
|
184
194
|
|
|
185
195
|
export function macroCostDuration(
|
|
186
|
-
run: Pick<
|
|
196
|
+
run: Pick<
|
|
197
|
+
OperationsProjection["runs"][number],
|
|
198
|
+
"source_duration_ms" | "duration_ms" | "duration_provenance" | "usage"
|
|
199
|
+
>,
|
|
187
200
|
): number | null {
|
|
188
|
-
|
|
201
|
+
if (typeof run.source_duration_ms === "number") return run.source_duration_ms;
|
|
202
|
+
if (
|
|
203
|
+
(run.duration_provenance === "legacy_inferred" || run.duration_provenance === "reconciled") &&
|
|
204
|
+
typeof run.duration_ms === "number"
|
|
205
|
+
)
|
|
206
|
+
return run.duration_ms;
|
|
207
|
+
return estimatedDurationMs(run.usage?.total.tokens.total ?? null);
|
|
189
208
|
}
|
|
190
209
|
|
|
191
210
|
export function macroCoverageProvenanceLabel(
|
|
@@ -22,7 +22,6 @@ export const costCopy = {
|
|
|
22
22
|
last30: "Últimos 30 dias",
|
|
23
23
|
last90: "Últimos 90 dias",
|
|
24
24
|
thisMonth: "Este mês",
|
|
25
|
-
observed: "cobertura observada",
|
|
26
25
|
noData: "Sem dados no filtro atual.",
|
|
27
26
|
tabs: {
|
|
28
27
|
overview: "Visão geral",
|
|
@@ -59,7 +58,6 @@ export const costCopy = {
|
|
|
59
58
|
last30: "Last 30 days",
|
|
60
59
|
last90: "Last 90 days",
|
|
61
60
|
thisMonth: "This month",
|
|
62
|
-
observed: "observed coverage",
|
|
63
61
|
noData: "No data for the current filter.",
|
|
64
62
|
tabs: {
|
|
65
63
|
overview: "Overview",
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-helpers.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function findRunDetails<T extends { id: string }>(
|
|
2
|
+
runs: readonly T[],
|
|
3
|
+
runId: string,
|
|
4
|
+
): T | null {
|
|
5
|
+
return runs.find((run) => run.id === runId) ?? null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function isCurrentCostRunPageGeneration(request: number, current: number): boolean {
|
|
9
|
+
return request === current;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function selectDimensionalCostRows<T>(
|
|
13
|
+
summaryRows: readonly T[],
|
|
14
|
+
detailRows: readonly T[] | undefined,
|
|
15
|
+
): readonly T[] {
|
|
16
|
+
return detailRows ?? summaryRows;
|
|
17
|
+
}
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-responsive.css
CHANGED
|
@@ -102,6 +102,12 @@
|
|
|
102
102
|
align-items: stretch;
|
|
103
103
|
flex-direction: column;
|
|
104
104
|
}
|
|
105
|
+
.cost-tabs-bar {
|
|
106
|
+
grid-template-columns: 1fr;
|
|
107
|
+
}
|
|
108
|
+
.cost-tab-export {
|
|
109
|
+
justify-content: flex-end;
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
@media (max-width: 500px) {
|
|
@@ -117,7 +123,4 @@
|
|
|
117
123
|
.cost-nav-actions button {
|
|
118
124
|
grid-column: span 2;
|
|
119
125
|
}
|
|
120
|
-
.cost-coverage-note {
|
|
121
|
-
flex-direction: column;
|
|
122
|
-
}
|
|
123
126
|
}
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-row-filters.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { saoPauloPeriodKey } from "@zaip-ai/dashboard-operations/contracts";
|
|
2
|
+
import {
|
|
3
|
+
aggregateDurationCoverage,
|
|
4
|
+
type CostGroupRow,
|
|
5
|
+
type CostRunRow,
|
|
6
|
+
sumKnown,
|
|
7
|
+
} from "../contracts.js";
|
|
8
|
+
import { normalizeCostProvider } from "../provider.js";
|
|
9
|
+
import type { CostFilterState } from "./CostFilters.js";
|
|
10
|
+
import { durationContributors } from "./cost-duration.js";
|
|
11
|
+
|
|
12
|
+
export function matches(row: CostRunRow, filter: CostFilterState): boolean {
|
|
13
|
+
const query = filter.query.trim().toLowerCase();
|
|
14
|
+
return (
|
|
15
|
+
(!query ||
|
|
16
|
+
[row.run_id, row.task_title, row.model, row.requested_model, row.agent, row.agent_name].some(
|
|
17
|
+
(value) => value.toLowerCase().includes(query),
|
|
18
|
+
)) &&
|
|
19
|
+
(!filter.provider || normalizeCostProvider(row.provider) === filter.provider) &&
|
|
20
|
+
(!filter.agent || row.agent_name === filter.agent) &&
|
|
21
|
+
(!filter.model || row.model === filter.model) &&
|
|
22
|
+
(!filter.status || row.task_status === filter.status) &&
|
|
23
|
+
(!filter.priority || row.priority === filter.priority) &&
|
|
24
|
+
(!filter.risk || row.risk === filter.risk) &&
|
|
25
|
+
(!filter.phase || row.phase === filter.phase) &&
|
|
26
|
+
(!filter.origin || row.origin === filter.origin) &&
|
|
27
|
+
(!filter.workType || row.work_type === filter.workType)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function matchesGlobalFilters(
|
|
32
|
+
row: CostRunRow,
|
|
33
|
+
filters: { query: string; dateRange?: { start: string; end: string } } | undefined,
|
|
34
|
+
): boolean {
|
|
35
|
+
if (!filters) return true;
|
|
36
|
+
const query = filters.query.trim().toLocaleLowerCase();
|
|
37
|
+
const matchesQuery =
|
|
38
|
+
!query ||
|
|
39
|
+
[
|
|
40
|
+
row.run_id,
|
|
41
|
+
row.task_id,
|
|
42
|
+
row.task_title,
|
|
43
|
+
row.provider,
|
|
44
|
+
row.agent,
|
|
45
|
+
row.agent_name,
|
|
46
|
+
row.model,
|
|
47
|
+
row.requested_model,
|
|
48
|
+
row.phase,
|
|
49
|
+
].some((value) => value?.toLocaleLowerCase().includes(query));
|
|
50
|
+
if (filters.dateRange === undefined) return matchesQuery;
|
|
51
|
+
const startedDate = saoPauloPeriodKey(row.started_at, "day") ?? row.started_at.slice(0, 10);
|
|
52
|
+
return (
|
|
53
|
+
startedDate >= filters.dateRange.start && startedDate <= filters.dateRange.end && matchesQuery
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function groupRows(
|
|
58
|
+
rows: readonly CostRunRow[],
|
|
59
|
+
select: (row: CostRunRow) => string,
|
|
60
|
+
label: (row: CostRunRow) => string = select,
|
|
61
|
+
durationScope: "root_execution" | "all_execution" | "all_invocations" = "all_invocations",
|
|
62
|
+
): CostGroupRow[] {
|
|
63
|
+
const contributors = durationContributors(rows, durationScope);
|
|
64
|
+
const groups = new Map<string, CostRunRow[]>();
|
|
65
|
+
for (const row of rows) groups.set(select(row), [...(groups.get(select(row)) ?? []), row]);
|
|
66
|
+
return [...groups]
|
|
67
|
+
.map(([key, items]) => {
|
|
68
|
+
const duration = aggregateDurationCoverage(
|
|
69
|
+
contributors.filter((candidate) => items.includes(candidate)),
|
|
70
|
+
durationScope === "all_execution" ? "all_execution" : "all_invocations",
|
|
71
|
+
);
|
|
72
|
+
const taskCount = new Set(items.flatMap((row) => (row.task_id ? [row.task_id] : []))).size;
|
|
73
|
+
return {
|
|
74
|
+
duration_ms: duration.complete ? duration.known_sum : null,
|
|
75
|
+
duration,
|
|
76
|
+
key,
|
|
77
|
+
label: label(items[0] as CostRunRow),
|
|
78
|
+
latest_started_at: items.reduce(
|
|
79
|
+
(latest, row) => (row.started_at > latest ? row.started_at : latest),
|
|
80
|
+
items[0]?.started_at ?? "",
|
|
81
|
+
),
|
|
82
|
+
run_count: items.length,
|
|
83
|
+
task_count: taskCount,
|
|
84
|
+
tasksActive: taskCount,
|
|
85
|
+
taskDaysActive: taskCount,
|
|
86
|
+
prd_count: 0,
|
|
87
|
+
spec_count: 0,
|
|
88
|
+
evidence_count: 0,
|
|
89
|
+
test_count: 0,
|
|
90
|
+
event_count: items.reduce((sum, row) => sum + (row.event_count ?? 0), 0),
|
|
91
|
+
total_tokens: sumKnown(items.map((row) => row.total_tokens)),
|
|
92
|
+
estimated_usd: sumKnown(items.map((row) => row.estimated_usd)),
|
|
93
|
+
estimated_brl: sumKnown(items.map((row) => row.estimated_brl)),
|
|
94
|
+
coverage: items.reduce(
|
|
95
|
+
(sum, row) => ({
|
|
96
|
+
events: sum.events + row.coverage.events,
|
|
97
|
+
tokens: sum.tokens + row.coverage.tokens,
|
|
98
|
+
usd: sum.usd + row.coverage.usd,
|
|
99
|
+
brl: sum.brl + row.coverage.brl,
|
|
100
|
+
}),
|
|
101
|
+
{ events: 0, tokens: 0, usd: 0, brl: 0 },
|
|
102
|
+
),
|
|
103
|
+
};
|
|
104
|
+
})
|
|
105
|
+
.sort((a, b) => b.latest_started_at.localeCompare(a.latest_started_at));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function matchesPeriodEntity(
|
|
109
|
+
entity: { id?: string; title?: string; created_at: string | null },
|
|
110
|
+
filters: { query: string; dateRange?: { start: string; end: string } } | undefined,
|
|
111
|
+
): boolean {
|
|
112
|
+
if (filters === undefined) return true;
|
|
113
|
+
const query = filters.query.trim().toLowerCase();
|
|
114
|
+
if (
|
|
115
|
+
query &&
|
|
116
|
+
![entity.id ?? "", entity.title ?? ""].some((value) => value.toLowerCase().includes(query))
|
|
117
|
+
)
|
|
118
|
+
return false;
|
|
119
|
+
if (filters.dateRange === undefined) return true;
|
|
120
|
+
if (entity.created_at === null) return false;
|
|
121
|
+
const date = saoPauloPeriodKey(entity.created_at, "day") ?? entity.created_at.slice(0, 10);
|
|
122
|
+
return date >= filters.dateRange.start && date <= filters.dateRange.end;
|
|
123
|
+
}
|
|
@@ -17,10 +17,12 @@ export function applyLegacyPeriodGroups(
|
|
|
17
17
|
rows: readonly CostRunRow[],
|
|
18
18
|
granularity: "day" | "month" | "year",
|
|
19
19
|
legacy: { cutoff: string; duration_ms: number } | null,
|
|
20
|
+
range?: { start: string; end: string },
|
|
20
21
|
): CostGroupRow[] {
|
|
21
22
|
if (legacy === null) return groups;
|
|
22
23
|
const byKey = new Map(groups.map((group) => [group.key, group]));
|
|
23
24
|
for (const day of Object.keys(LEGACY_EFFORT_DAILY_MS)) {
|
|
25
|
+
if (range !== undefined && (day < range.start || day > range.end)) continue;
|
|
24
26
|
const key = saoPauloPeriodKey(`${day}T12:00:00.000Z`, granularity);
|
|
25
27
|
if (key !== null && !byKey.has(key))
|
|
26
28
|
byKey.set(key, {
|
|
@@ -55,7 +57,10 @@ export function applyLegacyPeriodGroups(
|
|
|
55
57
|
const duration = aggregateDurationCoverage(post, "all_invocations");
|
|
56
58
|
const legacyDuration = Object.entries(LEGACY_EFFORT_DAILY_MS).reduce(
|
|
57
59
|
(sum, [day, value]) =>
|
|
58
|
-
|
|
60
|
+
(range === undefined || (day >= range.start && day <= range.end)) &&
|
|
61
|
+
saoPauloPeriodKey(`${day}T12:00:00.000Z`, granularity) === group.key
|
|
62
|
+
? sum + value
|
|
63
|
+
: sum,
|
|
59
64
|
0,
|
|
60
65
|
);
|
|
61
66
|
const known_sum = duration.known_sum + legacyDuration;
|
|
@@ -101,7 +106,7 @@ export function summarizeCostRows(
|
|
|
101
106
|
);
|
|
102
107
|
const knownRows = rows.filter((row) => row.total_tokens !== null);
|
|
103
108
|
const knownTokens = knownRows.reduce((sum, row) => sum + (row.total_tokens ?? 0), 0);
|
|
104
|
-
const knownCycles = knownRows.reduce((sum, row) => sum + row.event_count, 0);
|
|
109
|
+
const knownCycles = knownRows.reduce((sum, row) => sum + (row.event_count ?? 0), 0);
|
|
105
110
|
const top10Tokens = [...knownRows]
|
|
106
111
|
.sort((left, right) => (right.total_tokens ?? 0) - (left.total_tokens ?? 0))
|
|
107
112
|
.slice(0, 10)
|
|
@@ -109,7 +114,7 @@ export function summarizeCostRows(
|
|
|
109
114
|
return {
|
|
110
115
|
task_count: new Set(rows.flatMap((row) => (row.task_id ? [row.task_id] : []))).size,
|
|
111
116
|
run_count: rows.length,
|
|
112
|
-
event_count: rows.reduce((sum, row) => sum + row.event_count, 0),
|
|
117
|
+
event_count: rows.reduce((sum, row) => sum + (row.event_count ?? 0), 0),
|
|
113
118
|
total_tokens: sumKnown(rows.map((row) => row.total_tokens)),
|
|
114
119
|
estimated_usd: sumKnown(rows.map((row) => row.estimated_usd)),
|
|
115
120
|
estimated_brl: sumKnown(rows.map((row) => row.estimated_brl)),
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type CostView =
|
|
2
|
+
| "overview"
|
|
3
|
+
| "agentCalls"
|
|
4
|
+
| "executions"
|
|
5
|
+
| "conversations"
|
|
6
|
+
| "tasks"
|
|
7
|
+
| "prds"
|
|
8
|
+
| "specs"
|
|
9
|
+
| "providers"
|
|
10
|
+
| "agents"
|
|
11
|
+
| "models"
|
|
12
|
+
| "daily"
|
|
13
|
+
| "monthly"
|
|
14
|
+
| "annual";
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_COST_VIEW: CostView = "daily";
|
|
17
|
+
|
|
18
|
+
export const COST_VIEW_ORDER: readonly CostView[] = [
|
|
19
|
+
"daily",
|
|
20
|
+
"monthly",
|
|
21
|
+
"annual",
|
|
22
|
+
"overview",
|
|
23
|
+
"executions",
|
|
24
|
+
"agentCalls",
|
|
25
|
+
"agents",
|
|
26
|
+
"models",
|
|
27
|
+
"providers",
|
|
28
|
+
"tasks",
|
|
29
|
+
"specs",
|
|
30
|
+
"prds",
|
|
31
|
+
"conversations",
|
|
32
|
+
];
|
|
@@ -237,6 +237,20 @@
|
|
|
237
237
|
min-width: 0;
|
|
238
238
|
table-layout: fixed;
|
|
239
239
|
}
|
|
240
|
+
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual) .cost-page-controls {
|
|
241
|
+
display: flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
justify-content: flex-end;
|
|
244
|
+
gap: 10px;
|
|
245
|
+
margin-top: 12px;
|
|
246
|
+
}
|
|
247
|
+
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual) .cost-page-controls output {
|
|
248
|
+
min-width: 8.5rem;
|
|
249
|
+
color: var(--muted);
|
|
250
|
+
font-size: 0.78rem;
|
|
251
|
+
text-align: center;
|
|
252
|
+
font-variant-numeric: tabular-nums;
|
|
253
|
+
}
|
|
240
254
|
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual)
|
|
241
255
|
.ui-table-heading {
|
|
242
256
|
width: 100%;
|
|
@@ -398,18 +412,6 @@
|
|
|
398
412
|
text-overflow: ellipsis;
|
|
399
413
|
white-space: nowrap;
|
|
400
414
|
}
|
|
401
|
-
.cost-coverage-note {
|
|
402
|
-
display: flex;
|
|
403
|
-
justify-content: space-between;
|
|
404
|
-
gap: 16px;
|
|
405
|
-
margin: 12px 2px 0;
|
|
406
|
-
color: #8295ad;
|
|
407
|
-
font-size: 0.72rem;
|
|
408
|
-
}
|
|
409
|
-
.cost-coverage-note span {
|
|
410
|
-
color: #00b0f0;
|
|
411
|
-
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
|
412
|
-
}
|
|
413
415
|
.cost-filters {
|
|
414
416
|
display: grid;
|
|
415
417
|
grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr));
|
|
@@ -441,16 +443,23 @@
|
|
|
441
443
|
.cost-filters > button {
|
|
442
444
|
align-self: end;
|
|
443
445
|
}
|
|
446
|
+
.cost-tabs-bar {
|
|
447
|
+
display: grid;
|
|
448
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
449
|
+
align-items: start;
|
|
450
|
+
gap: 12px;
|
|
451
|
+
padding: 2px 2px 12px;
|
|
452
|
+
}
|
|
444
453
|
.cost-tabs {
|
|
445
454
|
display: flex;
|
|
446
455
|
flex-wrap: wrap;
|
|
447
456
|
gap: 6px;
|
|
448
457
|
overflow-x: visible;
|
|
449
|
-
padding: 2px 2px 12px;
|
|
450
458
|
}
|
|
451
459
|
.cost-tabs button {
|
|
452
460
|
flex: 0 0 auto;
|
|
453
|
-
min-height:
|
|
461
|
+
min-height: 44px;
|
|
462
|
+
border-radius: 999px;
|
|
454
463
|
padding-inline: 10px;
|
|
455
464
|
font-size: 0.82rem;
|
|
456
465
|
}
|
|
@@ -459,6 +468,35 @@
|
|
|
459
468
|
background: var(--accent-soft);
|
|
460
469
|
color: var(--accent);
|
|
461
470
|
}
|
|
471
|
+
.cost-tab-export {
|
|
472
|
+
display: flex;
|
|
473
|
+
justify-content: flex-end;
|
|
474
|
+
}
|
|
475
|
+
.cost-tab-export .excel-export-action {
|
|
476
|
+
min-height: 44px;
|
|
477
|
+
border: 1px solid transparent;
|
|
478
|
+
border-radius: 999px;
|
|
479
|
+
gap: 6px;
|
|
480
|
+
padding: 0 10px;
|
|
481
|
+
background: linear-gradient(135deg, #00b0f0 0%, #72f4fb 100%);
|
|
482
|
+
color: #042330;
|
|
483
|
+
font-size: 0.82rem;
|
|
484
|
+
font-weight: 650;
|
|
485
|
+
}
|
|
486
|
+
.cost-tab-export .excel-export-action svg {
|
|
487
|
+
width: 14px;
|
|
488
|
+
height: 14px;
|
|
489
|
+
}
|
|
490
|
+
.cost-tab-export .excel-export-action:hover:not(:disabled) {
|
|
491
|
+
border-color: rgba(114, 244, 251, 0.72);
|
|
492
|
+
background: linear-gradient(135deg, #00b0f0 0%, #72f4fb 100%);
|
|
493
|
+
color: #042330;
|
|
494
|
+
}
|
|
495
|
+
.cost-tabs button:focus-visible,
|
|
496
|
+
.cost-tab-export .excel-export-action:focus-visible {
|
|
497
|
+
outline: 3px solid #00b0f0;
|
|
498
|
+
outline-offset: 2px;
|
|
499
|
+
}
|
|
462
500
|
.cost-run-kind-toolbar {
|
|
463
501
|
display: flex;
|
|
464
502
|
gap: 8px;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { CostRunRow } from "../contracts.js";
|
|
2
|
+
import { durationContributors } from "./cost-duration.js";
|
|
3
|
+
import type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
|
4
|
+
import { sumNumbers } from "./cost-table-metrics.js";
|
|
5
|
+
|
|
6
|
+
export const costRunsDurationTotal = (rows: readonly CostRunRow[]) =>
|
|
7
|
+
sumNumbers(durationContributors(rows).map((row) => row.duration_ms));
|
|
8
|
+
export const isCompactRunColumnVisible = (
|
|
9
|
+
rows: readonly CostRunRow[],
|
|
10
|
+
select: (row: CostRunRow) => number | string | null,
|
|
11
|
+
) =>
|
|
12
|
+
rows.some((row) => {
|
|
13
|
+
const value = select(row);
|
|
14
|
+
return value !== null && value !== 0 && value !== "";
|
|
15
|
+
});
|
|
16
|
+
export const formatRate = (value: number | null, locale: CostLocale) =>
|
|
17
|
+
new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(
|
|
18
|
+
value ?? 0,
|
|
19
|
+
);
|
|
20
|
+
export const formatBrlRate = (value: number | null, locale: CostLocale) =>
|
|
21
|
+
`R$ ${formatRate(value, locale)}`;
|
|
22
|
+
export const formatUsd = (value: number | null, locale: CostLocale) =>
|
|
23
|
+
new Intl.NumberFormat(locale, {
|
|
24
|
+
style: "currency",
|
|
25
|
+
currency: "USD",
|
|
26
|
+
minimumFractionDigits: 2,
|
|
27
|
+
maximumFractionDigits: 2,
|
|
28
|
+
}).format(value ?? 0);
|
|
29
|
+
|
|
30
|
+
const normalized = (value: string | null) => {
|
|
31
|
+
const result = value?.trim() ?? "";
|
|
32
|
+
return result === "" || result.toLowerCase() === "unknown" ? null : result;
|
|
33
|
+
};
|
|
34
|
+
const detail = (value: string, _kind: "effort" | "speed", locale: CostLocale) => {
|
|
35
|
+
if (locale !== "pt-BR") return value;
|
|
36
|
+
return (
|
|
37
|
+
{
|
|
38
|
+
low: "Leve",
|
|
39
|
+
medium: "M\u00e9dio",
|
|
40
|
+
high: "Alto",
|
|
41
|
+
xhigh: "Extra alto",
|
|
42
|
+
max: "Ultra",
|
|
43
|
+
default: "Padr\u00e3o",
|
|
44
|
+
priority: "R\u00e1pido",
|
|
45
|
+
}[value] ?? value
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const formatMultiplierPair = (
|
|
50
|
+
input: number | null,
|
|
51
|
+
output: number | null,
|
|
52
|
+
locale: CostLocale,
|
|
53
|
+
) => {
|
|
54
|
+
if (input === null || output === null)
|
|
55
|
+
return locale === "pt-BR" ? "Indispon\u00edvel" : "Unavailable";
|
|
56
|
+
return `${input.toLocaleString("en-US", { maximumFractionDigits: 3 })}\u00d7 / ${output.toLocaleString("en-US", { maximumFractionDigits: 3 })}\u00d7`;
|
|
57
|
+
};
|
|
58
|
+
export const formatReasoningEffort = (
|
|
59
|
+
effective: string | null,
|
|
60
|
+
requested: string | null,
|
|
61
|
+
locale: CostLocale,
|
|
62
|
+
) => {
|
|
63
|
+
const actual = normalized(effective);
|
|
64
|
+
if (actual !== null) return detail(actual, "effort", locale);
|
|
65
|
+
const asked = normalized(requested);
|
|
66
|
+
if (asked === null) return "-";
|
|
67
|
+
const label = detail(asked, "effort", locale);
|
|
68
|
+
return locale === "pt-BR"
|
|
69
|
+
? `${label} (solicitado; efetivo -)`
|
|
70
|
+
: `${label} (requested; effective -)`;
|
|
71
|
+
};
|
|
72
|
+
export const formatServiceTier = (value: string | null, locale: CostLocale) => {
|
|
73
|
+
const tier = normalized(value);
|
|
74
|
+
return tier === null
|
|
75
|
+
? locale === "pt-BR"
|
|
76
|
+
? "Padr\u00e3o"
|
|
77
|
+
: "Standard"
|
|
78
|
+
: detail(tier, "speed", locale);
|
|
79
|
+
};
|
|
80
|
+
export const costRunsScrollLabel = (locale: CostLocale) =>
|
|
81
|
+
locale === "pt-BR"
|
|
82
|
+
? "Tabela de custos por invoca\u00e7\u00e3o com rolagem horizontal"
|
|
83
|
+
: "Agent invocation costs table with horizontal scrolling";
|
|
84
|
+
export const costGroupsScrollLabel = (locale: CostLocale) =>
|
|
85
|
+
locale === "pt-BR"
|
|
86
|
+
? "Tabela de custos agrupados com rolagem horizontal"
|
|
87
|
+
: "Grouped costs table with horizontal scrolling";
|
|
88
|
+
export const formatDateTime = (value: string, locale: CostLocale) =>
|
|
89
|
+
!value || Number.isNaN(Date.parse(value))
|
|
90
|
+
? "\u2014"
|
|
91
|
+
: new Intl.DateTimeFormat(locale, { dateStyle: "short", timeStyle: "medium" }).format(
|
|
92
|
+
new Date(value),
|
|
93
|
+
);
|
|
94
|
+
export const formatCostPeriodLabel = (
|
|
95
|
+
value: string,
|
|
96
|
+
period: "daily" | "monthly" | "annual",
|
|
97
|
+
locale: CostLocale,
|
|
98
|
+
) => {
|
|
99
|
+
if (period === "annual") return value.slice(0, 4);
|
|
100
|
+
if (period === "monthly") return value.slice(0, 7);
|
|
101
|
+
const date = new Date(`${value}T12:00:00.000Z`);
|
|
102
|
+
return Number.isNaN(date.getTime())
|
|
103
|
+
? value
|
|
104
|
+
: new Intl.DateTimeFormat(locale, { dateStyle: "short", timeZone: "UTC" }).format(date);
|
|
105
|
+
};
|
|
106
|
+
export const costPeriodTotalAriaLabel = ({
|
|
107
|
+
locale,
|
|
108
|
+
duration,
|
|
109
|
+
tokens,
|
|
110
|
+
cost,
|
|
111
|
+
currency,
|
|
112
|
+
}: {
|
|
113
|
+
locale: CostLocale;
|
|
114
|
+
duration: string;
|
|
115
|
+
tokens: string;
|
|
116
|
+
cost: string;
|
|
117
|
+
currency: CostCurrency;
|
|
118
|
+
}) =>
|
|
119
|
+
locale === "pt-BR"
|
|
120
|
+
? `Total geral \u2014 Tempo: ${duration}; Tokens: ${tokens}; ${currency}: ${cost}`
|
|
121
|
+
: `Grand total \u2014 Time: ${duration}; Tokens: ${tokens}; Cost (${currency}): ${cost}`;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export * from "./CostMonitorPage.js";
|
|
2
|
+
export { CostRunsTable } from "./CostTables.js";
|
|
3
|
+
export type { CompactLifecycleCostPage } from "./CompactLifecycleCostTable.js";
|
|
4
|
+
export { matches as matchesCostRunFilter } from "./cost-monitor-row-filters.js";
|
|
2
5
|
export type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.test.ts
CHANGED
|
@@ -76,6 +76,74 @@ describe("enrichPeriodCostGroups", () => {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
+
it("counts typed Evidence by observed month and de-duplicates legacy references", () => {
|
|
80
|
+
const rows = enrichPeriodCostGroups(
|
|
81
|
+
[],
|
|
82
|
+
{
|
|
83
|
+
prds: [],
|
|
84
|
+
specs: [],
|
|
85
|
+
tasks: [
|
|
86
|
+
{
|
|
87
|
+
created_at: "2026-07-31T12:00:00.000Z",
|
|
88
|
+
result: { evidence_ids: ["EVD-TYPED", "EVD-LEGACY"] },
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
evidences: [{ id: "EVD-TYPED", observed_at: "2026-08-01T12:00:00.000Z" }],
|
|
92
|
+
},
|
|
93
|
+
"monthly",
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect(rows.map((row) => [row.key, row.evidence_count])).toEqual([
|
|
97
|
+
["2026-08", 1],
|
|
98
|
+
["2026-07", 1],
|
|
99
|
+
]);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("counts typed Validation by execution month instead of Task creation month", () => {
|
|
103
|
+
const rows = enrichPeriodCostGroups(
|
|
104
|
+
[],
|
|
105
|
+
{
|
|
106
|
+
prds: [],
|
|
107
|
+
specs: [],
|
|
108
|
+
tasks: [
|
|
109
|
+
{
|
|
110
|
+
created_at: "2026-07-31T12:00:00.000Z",
|
|
111
|
+
result: null,
|
|
112
|
+
test_count: 99,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
validations: [{ id: "TEST-TYPED", executed_at: "2026-08-01T12:00:00.000Z" }],
|
|
116
|
+
},
|
|
117
|
+
"monthly",
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
expect(rows.map((row) => [row.key, row.test_count])).toEqual([
|
|
121
|
+
["2026-08", 1],
|
|
122
|
+
["2026-07", 0],
|
|
123
|
+
]);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("uses created Tasks instead of financially active Tasks in the period total", () => {
|
|
127
|
+
const base = runGroups.at(0);
|
|
128
|
+
if (base === undefined) throw new Error("Expected base period group");
|
|
129
|
+
const rows = enrichPeriodCostGroups(
|
|
130
|
+
[{ ...base, key: "2026-08", run_count: 74, task_count: 74 }],
|
|
131
|
+
{
|
|
132
|
+
prds: [],
|
|
133
|
+
specs: [],
|
|
134
|
+
tasks: Array.from({ length: 89 }, () => ({
|
|
135
|
+
created_at: "2026-08-02T12:00:00.000Z",
|
|
136
|
+
result: null,
|
|
137
|
+
})),
|
|
138
|
+
},
|
|
139
|
+
"monthly",
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect(rows).toMatchObject([
|
|
143
|
+
{ key: "2026-08", run_count: 74, task_count: 89, tasksCreated: 89 },
|
|
144
|
+
]);
|
|
145
|
+
});
|
|
146
|
+
|
|
79
147
|
it("divides total duration by every day in the period", () => {
|
|
80
148
|
const rows = [
|
|
81
149
|
runGroups[0] as CostGroupRow,
|