@zaip-ai/cli 1.0.8 → 1.3.1
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 +1 -1
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.js +1 -1
- package/dist/services/agent-adapters.js +3 -3
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-adapters.test.js +7 -1
- package/dist/services/agent-adapters.test.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.js +89 -7
- package/dist/services/codex-pre-tool-hook-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 +7 -0
- package/dist/services/codex-rules.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +1 -0
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.test.js +2 -2
- package/dist/services/runtime-template.test.js +31 -7
- 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 +12 -3
- package/dist/services/template-manifest.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/architecture/software-architecture.md +131 -0
- package/templates/.agents/branding/brandbook.docx +0 -0
- package/templates/.agents/branding/brandbook.md +60 -0
- package/templates/.agents/config/agents/catalog.yaml +7 -7
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +8 -8
- package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +1 -1
- package/templates/.agents/dashboard/.tmp-run-list.json +254 -0
- package/templates/.agents/dashboard/.zaip-managed.json +457 -173
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-Z60df2r-.js → CostCalculationGuidePage-ovxurkIk.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-BgVgrfhQ.js +2310 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-Coc6pA-1.js → PricingSettingsDialog-vSvvOHQp.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BomxqCBU.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-zH758vfs.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-DLn-Mz2M.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-CaKwQP43.css → TraceabilityWorkspace-DvvavDLY.css} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DKwP1stV.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-PoJA2PI1.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DFBuc_qp.js → icons-vendor-B_lDDHn1.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-B31GMG5O.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-CZQlsLV9.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CCQOHdVI.js → react-vendor-B3TJrD4O.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-pC2_0J8x.js → traceability-7f1j5wx3.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +7 -7
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/playwright.dom.config.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +199 -140
- package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +0 -21
- package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +20 -11
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +14 -7
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +4 -2
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.dom.e2e.ts +56 -0
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +21 -2
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +89 -19
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +19 -4
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +49 -3
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +29 -10
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +4 -4
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +4 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +36 -26
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +47 -6
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +59 -9
- package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.test.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.ts +21 -0
- package/templates/.agents/dashboard/apps/frontend/src/styles.css +19 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.test.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +6 -2
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +137 -23
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +229 -35
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +61 -7
- package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +3 -6
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +7 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.test.ts +163 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.ts +136 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-operations-detail-export.ts +76 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.test.ts +23 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.ts +27 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +39 -15
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +3 -4
- package/templates/.agents/dashboard/apps/frontend/vite.config.ts +4 -1
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +89 -19
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +31 -16
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +43 -14
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +5 -5
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionPanel.tsx +60 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionTable.tsx +191 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.loading.test.ts +14 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.run-page.test.ts +18 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +18 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +75 -44
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorLoadErrors.tsx +35 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +162 -40
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +221 -79
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.test.ts +132 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.tsx +70 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +203 -155
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +164 -125
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +2 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +3 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +5 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-page-range.ts +35 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +2 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +2 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +32 -9
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +37 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +131 -9
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +34 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +0 -24
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +225 -424
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +24 -15
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +6 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-monitor-projection-agents.test.ts +31 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-summary-projection-duration.test.ts +414 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +46 -26
- package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.test.ts +54 -0
- package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.tsx +247 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +31 -11
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +39 -13
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +107 -2
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.macro-metrics.test.ts +55 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +23 -29
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +211 -184
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.tsx +127 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +60 -51
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +1 -4
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +3 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.test.tsx +43 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.tsx +181 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +32 -10
- package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +9 -3
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +13 -5
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +16 -6
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +14 -4
- package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +1 -2
- package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.test.ts +18 -0
- package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.ts +30 -0
- package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +393 -4
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +484 -61
- package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +23 -1
- package/templates/.agents/dashboard/modules/operations/src/react/export/xlsx-runtime-e2e.test.ts +248 -0
- package/templates/.agents/dashboard/modules/operations/src/react/index.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +4 -4
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +6 -4
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +4 -3
- package/templates/.agents/dashboard/modules/operations/src/react/operations-date-filters.css +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +4 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +22 -12
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.css +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +53 -6
- package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +2 -4
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +82 -6
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +19 -7
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +4 -1
- package/templates/.agents/dashboard/modules/operations/src/server/metric-coverage.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +11 -5
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -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 +533 -338
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +506 -311
- package/templates/.agents/dashboard/packages/local-runtime/gitignore.template +2 -0
- package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +15 -7
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +44 -13
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +8 -3
- package/templates/.agents/dashboard/packages/local-runtime/scripts/source-size-runtime-scripts/sqlite-read-model-fixture.mjs +397 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +472 -145
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +15 -3
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +141 -33
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +533 -338
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +6 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +3 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +89 -16
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +33 -16
- package/templates/.agents/dashboard/packages/local-runtime/src/server-classification-page.test.ts +87 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.test.ts +44 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.ts +125 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +66 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.test.ts +61 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.ts +18 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-run-projections.test.ts +42 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +97 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +22 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-task-trace.ts +91 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +7 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +36 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +230 -132
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +224 -182
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-artifact-counts.ts +28 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.test.ts +63 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.ts +109 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-aggregates.ts +497 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-fast-page-parity.test-support.ts +65 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.test.ts +176 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.ts +119 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.ts +41 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.test.ts +16 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.ts +29 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.ts +355 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-persistence.ts +121 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-timing.ts +27 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +16 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-projection.ts +15 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.test.ts +223 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.ts +304 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-cache.test-support.ts +23 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +89 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider-fixture.ts +227 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +691 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +81 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1655 -567
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +2168 -1268
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-cache.ts +129 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.test.ts +26 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.ts +28 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-seed.test.ts +116 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +146 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.test.mjs +165 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-refresh.mjs +140 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +255 -289
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +94 -88
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +5 -2
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
- package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-loading.spec.ts +142 -0
- package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-pagination.spec.ts +232 -0
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +743 -0
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +189 -214
- 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/growth/estrategia-bootstrap-90-dias.md +169 -0
- package/templates/.agents/growth/strategy.md +27 -0
- package/templates/.agents/marketing/estrategia-marketing-zaip-90-dias.md +197 -0
- package/templates/.agents/marketing/strategy.md +29 -0
- package/templates/.agents/requirements/autonomous-assurance.md +6 -6
- 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 +1 -1
- 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 +3 -3
- package/templates/.agents/requirements/kanban-dashboard.md +10 -2
- 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 +4 -4
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/dashboard-ui-consistency.md +14 -0
- package/templates/.agents/rules/frontend-lite.md +4 -4
- package/templates/.agents/rules/run-lifecycle-closure.md +4 -4
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +1142 -1041
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +3 -3
- package/templates/.agents/sales/playbook.md +32 -0
- package/templates/.agents/sales/roteiro-comercial-zaip.md +252 -0
- package/templates/.agents/skills/criar-pasta-obsidian/scripts/generate-obsidian-vault.test.mjs +20 -16
- package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-agent-catalog/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-agent-catalog/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +3 -2
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +49 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/run-skill-tests.mjs +37 -0
- package/templates/.agents/skills/zaip-skill-backend/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +9 -2
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-framework.md +39 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +1 -1
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-change/references/observable-evidence.md +83 -0
- package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -3
- package/templates/.agents/skills/zaip-skill-frontend/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +10 -10
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-lifecycle-closure/SKILL.md +27 -0
- package/templates/.agents/skills/zaip-skill-lifecycle-closure/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +111 -104
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-explicit-recovery.mjs +223 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +55 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +145 -14
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +19 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +82 -5
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/source-size-telemetry/model-identity-reconciliation.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +5 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +22 -90
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +28 -5
- package/templates/.agents/zaip-aios/INDEX.md +57 -22
- package/templates/.agents/zaip-aios/README.md +24 -13
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/02-requirements.md +5 -0
- package/templates/.agents/zaip-aios/guides/06-execucao.md +13 -4
- package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +7 -0
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +23 -0
- package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +6 -6
- package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +3 -0
- package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +12 -3
- package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +5 -5
- package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +76 -0
- package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +95 -0
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +366 -0
- package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +46 -0
- package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +74 -0
- package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +483 -0
- package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +85 -0
- package/templates/.agents/zaip-aios/guides/25-fontes-de-precos-openai.md +19 -0
- package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +111 -0
- package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +172 -0
- package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +149 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/lifecycles-task-spec-prd.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/prd-lifecycle.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/spec-lifecycle.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/task-lifecycle.png +0 -0
- package/templates/template-manifest.json +756 -235
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-Cs6dzDmW.js +0 -1505
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-QE1k9yZB.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-_Pf5DA_A.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BVlz3DLZ.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Cf9ctPVt.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8A4DcNXM.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +0 -45
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "@zaip-ai/dashboard-ui";
|
|
7
7
|
import type { CostGroupRow, CostRunRow, DurationCoverage } from "../contracts.js";
|
|
8
8
|
import { MoreVerticalIcon } from "./CostTableIcons.js";
|
|
9
|
+
import { type CostRunPagination, CostRunServerPagination } from "./CostTableLoading.js";
|
|
9
10
|
import type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
|
10
|
-
import type { CostGroupTotals } from "./use-cost-group-page.js";
|
|
11
11
|
import {
|
|
12
12
|
agentRunModelPresentation,
|
|
13
13
|
formatApiSpeedScenario,
|
|
@@ -29,7 +29,12 @@ import {
|
|
|
29
29
|
formatUsd,
|
|
30
30
|
isCompactRunColumnVisible,
|
|
31
31
|
} from "./cost-table-presentation.js";
|
|
32
|
+
import type { CostGroupTotals } from "./use-cost-group-page.js";
|
|
32
33
|
|
|
34
|
+
export {
|
|
35
|
+
type CostDeveloperAttributionRow,
|
|
36
|
+
CostDeveloperAttributionTable,
|
|
37
|
+
} from "./CostDeveloperAttributionTable.js";
|
|
33
38
|
export { CostModelsAuditTable } from "./CostModelsAuditTable.js";
|
|
34
39
|
|
|
35
40
|
export {
|
|
@@ -61,7 +66,9 @@ export {
|
|
|
61
66
|
export function displayCostGroupLabel(label: string, locale: CostLocale): string {
|
|
62
67
|
const normalized = label.trim().toLowerCase();
|
|
63
68
|
return normalized.length === 0 || normalized === "unknown"
|
|
64
|
-
?
|
|
69
|
+
? locale === "pt-BR"
|
|
70
|
+
? "Sem modelo/provedor atribuído"
|
|
71
|
+
: "No model/provider assigned"
|
|
65
72
|
: label;
|
|
66
73
|
}
|
|
67
74
|
|
|
@@ -97,8 +104,7 @@ const formatInvocationDuration = (value: number | null, locale: CostLocale) =>
|
|
|
97
104
|
formatAuditableDuration(value, locale);
|
|
98
105
|
const formatInvocationRate = (value: number | null, locale: CostLocale) =>
|
|
99
106
|
formatRate(value, locale);
|
|
100
|
-
const formatInvocationUsd = (value: number | null, locale: CostLocale) =>
|
|
101
|
-
formatUsd(value, locale);
|
|
107
|
+
const formatInvocationUsd = (value: number | null, locale: CostLocale) => formatUsd(value, locale);
|
|
102
108
|
const formatInvocationBrlRate = (value: number | null, locale: CostLocale) =>
|
|
103
109
|
formatBrlRate(value, locale);
|
|
104
110
|
const formatInvocationMultiplierPair = (
|
|
@@ -113,30 +119,99 @@ function invocationMetricDescription(locale: CostLocale, metric: string): string
|
|
|
113
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."
|
|
114
120
|
: "Value from this Agent Invocation's SQLite/API projection. A null canonical fact remains unavailable and is not converted to zero.";
|
|
115
121
|
const details: Record<string, readonly [string, string]> = {
|
|
116
|
-
duration: [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
+
],
|
|
138
210
|
};
|
|
139
|
-
const detail = details[metric] ?? [
|
|
211
|
+
const detail = details[metric] ?? [
|
|
212
|
+
"Métrica numérica desta invocação.",
|
|
213
|
+
"Numeric metric for this invocation.",
|
|
214
|
+
];
|
|
140
215
|
return `${detail[locale === "pt-BR" ? 0 : 1]} ${source}`;
|
|
141
216
|
}
|
|
142
217
|
|
|
@@ -199,16 +274,7 @@ export function CostRunsTable({
|
|
|
199
274
|
currency: CostCurrency;
|
|
200
275
|
locale: CostLocale;
|
|
201
276
|
compact?: boolean;
|
|
202
|
-
pagination?:
|
|
203
|
-
offset: number;
|
|
204
|
-
limit: number;
|
|
205
|
-
total: number | null;
|
|
206
|
-
has_more: boolean;
|
|
207
|
-
loading: boolean;
|
|
208
|
-
error: string | null;
|
|
209
|
-
onChange: (offset: number) => void;
|
|
210
|
-
onRetry: () => void;
|
|
211
|
-
};
|
|
277
|
+
pagination?: CostRunPagination;
|
|
212
278
|
}) {
|
|
213
279
|
const footerLabel = costRunsFooterLabel(locale, pagination !== undefined);
|
|
214
280
|
const total = (key: keyof CostRunRow) => sumNumbers(rows.map((row) => row[key]));
|
|
@@ -332,13 +398,8 @@ export function CostRunsTable({
|
|
|
332
398
|
key: "totalTokens",
|
|
333
399
|
label: locale === "pt-BR" ? "Total tokens" : "Total tokens",
|
|
334
400
|
description: invocationMetricDescription(locale, "totalTokens"),
|
|
335
|
-
render: (row) =>
|
|
336
|
-
|
|
337
|
-
inclusiveTokenTotal(row),
|
|
338
|
-
locale,
|
|
339
|
-
),
|
|
340
|
-
sortValue: (row) =>
|
|
341
|
-
inclusiveTokenTotal(row),
|
|
401
|
+
render: (row) => formatInvocationNumber(inclusiveTokenTotal(row), locale),
|
|
402
|
+
sortValue: (row) => inclusiveTokenTotal(row),
|
|
342
403
|
align: "right",
|
|
343
404
|
footer: formatInvocationNumber(totalTokens, locale),
|
|
344
405
|
},
|
|
@@ -534,63 +595,6 @@ function inclusiveTokenTotal(
|
|
|
534
595
|
: row.total_tokens;
|
|
535
596
|
}
|
|
536
597
|
|
|
537
|
-
function CostRunServerPagination({
|
|
538
|
-
locale,
|
|
539
|
-
pagination,
|
|
540
|
-
}: {
|
|
541
|
-
locale: CostLocale;
|
|
542
|
-
pagination: NonNullable<Parameters<typeof CostRunsTable>[0]["pagination"]>;
|
|
543
|
-
}) {
|
|
544
|
-
const first = pagination.total === 0 ? 0 : pagination.offset + 1;
|
|
545
|
-
const last =
|
|
546
|
-
pagination.total === null
|
|
547
|
-
? pagination.offset + pagination.limit
|
|
548
|
-
: Math.min(pagination.offset + pagination.limit, pagination.total);
|
|
549
|
-
const previous = Math.max(0, pagination.offset - pagination.limit);
|
|
550
|
-
const next = pagination.offset + pagination.limit;
|
|
551
|
-
return (
|
|
552
|
-
<nav
|
|
553
|
-
aria-label={locale === "pt-BR" ? "Paginação das invocações" : "Invocation pagination"}
|
|
554
|
-
className="ui-table-pagination"
|
|
555
|
-
>
|
|
556
|
-
<button
|
|
557
|
-
disabled={pagination.loading || pagination.offset === 0}
|
|
558
|
-
onClick={() => pagination.onChange(previous)}
|
|
559
|
-
type="button"
|
|
560
|
-
>
|
|
561
|
-
{locale === "pt-BR" ? "Anterior" : "Previous"}
|
|
562
|
-
</button>
|
|
563
|
-
<span aria-live="polite">
|
|
564
|
-
{pagination.loading
|
|
565
|
-
? locale === "pt-BR"
|
|
566
|
-
? "Carregando invocações…"
|
|
567
|
-
: "Loading invocations…"
|
|
568
|
-
: pagination.total === null
|
|
569
|
-
? `${first}–${last}${pagination.has_more ? "+" : ""}`
|
|
570
|
-
: `${first}–${last} ${locale === "pt-BR" ? "de" : "of"} ${pagination.total}`}
|
|
571
|
-
</span>
|
|
572
|
-
<button
|
|
573
|
-
disabled={
|
|
574
|
-
pagination.loading ||
|
|
575
|
-
(!pagination.has_more && (pagination.total === null || next >= pagination.total))
|
|
576
|
-
}
|
|
577
|
-
onClick={() => pagination.onChange(next)}
|
|
578
|
-
type="button"
|
|
579
|
-
>
|
|
580
|
-
{locale === "pt-BR" ? "Próxima" : "Next"}
|
|
581
|
-
</button>
|
|
582
|
-
{pagination.error ? (
|
|
583
|
-
<span role="status">
|
|
584
|
-
{pagination.error}{" "}
|
|
585
|
-
<button onClick={pagination.onRetry} type="button">
|
|
586
|
-
{locale === "pt-BR" ? "Tentar novamente" : "Retry"}
|
|
587
|
-
</button>
|
|
588
|
-
</span>
|
|
589
|
-
) : null}
|
|
590
|
-
</nav>
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
598
|
function costPeriodHeading(period: "daily" | "monthly" | "annual", locale: CostLocale): string {
|
|
595
599
|
if (locale === "en-US") {
|
|
596
600
|
return period === "daily" ? "Day" : period === "monthly" ? "Month" : "Year";
|
|
@@ -610,6 +614,7 @@ export function CostGroupsTable({
|
|
|
610
614
|
dateHeading,
|
|
611
615
|
labelHeading,
|
|
612
616
|
totals: suppliedTotals,
|
|
617
|
+
loading = false,
|
|
613
618
|
}: {
|
|
614
619
|
rows: readonly CostGroupRow[];
|
|
615
620
|
currency: CostCurrency;
|
|
@@ -622,6 +627,7 @@ export function CostGroupsTable({
|
|
|
622
627
|
dateHeading?: string;
|
|
623
628
|
labelHeading?: string;
|
|
624
629
|
totals?: CostGroupTotals;
|
|
630
|
+
loading?: boolean;
|
|
625
631
|
}) {
|
|
626
632
|
const pageTotals = {
|
|
627
633
|
runs: rows.reduce((sum, row) => sum + row.run_count, 0),
|
|
@@ -636,19 +642,22 @@ export function CostGroupsTable({
|
|
|
636
642
|
usd: sumNumbers(rows.map((row) => row.estimated_usd)),
|
|
637
643
|
brl: sumNumbers(rows.map((row) => row.estimated_brl)),
|
|
638
644
|
};
|
|
639
|
-
const totals =
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
645
|
+
const totals =
|
|
646
|
+
suppliedTotals === undefined
|
|
647
|
+
? pageTotals
|
|
648
|
+
: {
|
|
649
|
+
runs: suppliedTotals.run_count,
|
|
650
|
+
tasks: suppliedTotals.task_count ?? 0,
|
|
651
|
+
prds: suppliedTotals.prd_count,
|
|
652
|
+
specs: suppliedTotals.spec_count,
|
|
653
|
+
evidences: suppliedTotals.evidence_count,
|
|
654
|
+
tests: suppliedTotals.test_count,
|
|
655
|
+
durationKnownMs: suppliedTotals.duration.known_sum,
|
|
656
|
+
durationPartial: !suppliedTotals.duration.complete,
|
|
657
|
+
tokens: suppliedTotals.total_tokens,
|
|
658
|
+
usd: suppliedTotals.estimated_usd,
|
|
659
|
+
brl: suppliedTotals.estimated_brl,
|
|
660
|
+
};
|
|
652
661
|
const totalDurationDisplay = formatDurationCoverage(
|
|
653
662
|
suppliedTotals?.duration ?? {
|
|
654
663
|
known_sum: totals.durationKnownMs,
|
|
@@ -686,8 +695,16 @@ export function CostGroupsTable({
|
|
|
686
695
|
},
|
|
687
696
|
...(showAgentIdentity
|
|
688
697
|
? [
|
|
689
|
-
{
|
|
690
|
-
|
|
698
|
+
{
|
|
699
|
+
key: "persona",
|
|
700
|
+
label: locale === "pt-BR" ? "Persona" : "Persona",
|
|
701
|
+
render: (row: CostGroupRow) => row.persona ?? "",
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
key: "job",
|
|
705
|
+
label: locale === "pt-BR" ? "Cargo" : "Job",
|
|
706
|
+
render: (row: CostGroupRow) => row.job ?? "",
|
|
707
|
+
},
|
|
691
708
|
]
|
|
692
709
|
: []),
|
|
693
710
|
{
|
|
@@ -724,14 +741,21 @@ export function CostGroupsTable({
|
|
|
724
741
|
...(showAgentIdentity
|
|
725
742
|
? []
|
|
726
743
|
: [
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
744
|
+
{
|
|
745
|
+
key: "tasks",
|
|
746
|
+
label:
|
|
747
|
+
showAgentIdentity || showInvocationTasks
|
|
748
|
+
? locale === "pt-BR"
|
|
749
|
+
? "Tarefas com invocação"
|
|
750
|
+
: "Tasks with invocations"
|
|
751
|
+
: locale === "pt-BR"
|
|
752
|
+
? "Tarefas criadas"
|
|
753
|
+
: "Tasks created",
|
|
754
|
+
render: (row: CostGroupRow) => row.task_count ?? 0,
|
|
755
|
+
align: "right" as const,
|
|
756
|
+
footer: totals.tasks,
|
|
757
|
+
},
|
|
758
|
+
]),
|
|
735
759
|
]
|
|
736
760
|
: [
|
|
737
761
|
{
|
|
@@ -835,8 +859,23 @@ export function CostGroupsTable({
|
|
|
835
859
|
]
|
|
836
860
|
: []),
|
|
837
861
|
]}
|
|
838
|
-
defaultSort={
|
|
862
|
+
defaultSort={
|
|
863
|
+
showAgentIdentity
|
|
864
|
+
? { key: "cost", direction: "desc" }
|
|
865
|
+
: period === undefined
|
|
866
|
+
? null
|
|
867
|
+
: { key: "label", direction: "desc" }
|
|
868
|
+
}
|
|
839
869
|
locale={locale}
|
|
870
|
+
emptyMessage={
|
|
871
|
+
loading
|
|
872
|
+
? locale === "pt-BR"
|
|
873
|
+
? "Carregando…"
|
|
874
|
+
: "Loading…"
|
|
875
|
+
: locale === "pt-BR"
|
|
876
|
+
? "Nenhum dado disponível."
|
|
877
|
+
: "No data available."
|
|
878
|
+
}
|
|
840
879
|
pageSize={100}
|
|
841
880
|
rowKey={(row) => row.key}
|
|
842
881
|
onRowClick={onOpenTrace === undefined ? undefined : (row) => onOpenTrace(row.key)}
|
|
@@ -37,6 +37,7 @@ export const costCopy = {
|
|
|
37
37
|
daily: "Diário",
|
|
38
38
|
monthly: "Mensal",
|
|
39
39
|
annual: "Anual",
|
|
40
|
+
developers: "Desenvolvedores",
|
|
40
41
|
},
|
|
41
42
|
},
|
|
42
43
|
"en-US": {
|
|
@@ -73,6 +74,7 @@ export const costCopy = {
|
|
|
73
74
|
daily: "Daily",
|
|
74
75
|
monthly: "Monthly",
|
|
75
76
|
annual: "Annual",
|
|
77
|
+
developers: "Developers",
|
|
76
78
|
},
|
|
77
79
|
},
|
|
78
80
|
} as const;
|
|
@@ -11,7 +11,8 @@ export type CostView =
|
|
|
11
11
|
| "models"
|
|
12
12
|
| "daily"
|
|
13
13
|
| "monthly"
|
|
14
|
-
| "annual"
|
|
14
|
+
| "annual"
|
|
15
|
+
| "developers";
|
|
15
16
|
|
|
16
17
|
export const DEFAULT_COST_VIEW: CostView = "daily";
|
|
17
18
|
|
|
@@ -19,6 +20,7 @@ export const COST_VIEW_ORDER: readonly CostView[] = [
|
|
|
19
20
|
"daily",
|
|
20
21
|
"monthly",
|
|
21
22
|
"annual",
|
|
23
|
+
"developers",
|
|
22
24
|
"overview",
|
|
23
25
|
"executions",
|
|
24
26
|
"agentCalls",
|
|
@@ -237,14 +237,17 @@
|
|
|
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)
|
|
240
|
+
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual)
|
|
241
|
+
.cost-page-controls {
|
|
241
242
|
display: flex;
|
|
242
243
|
align-items: center;
|
|
243
244
|
justify-content: flex-end;
|
|
244
245
|
gap: 10px;
|
|
245
246
|
margin-top: 12px;
|
|
246
247
|
}
|
|
247
|
-
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual)
|
|
248
|
+
.cost-content:is(.cost-content-daily, .cost-content-monthly, .cost-content-annual)
|
|
249
|
+
.cost-page-controls
|
|
250
|
+
output {
|
|
248
251
|
min-width: 8.5rem;
|
|
249
252
|
color: var(--muted);
|
|
250
253
|
font-size: 0.78rem;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type CostPeriod, defaultCostPeriod } from "./CostFilters.js";
|
|
2
|
+
|
|
3
|
+
export type CostPageDateRange = { from: string; to: string };
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Embedded pages use the host's all-time atomic snapshot until an explicit
|
|
7
|
+
* period, date range, or local Cost filter narrows the population.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveCostGroupPageRange({
|
|
10
|
+
embedded,
|
|
11
|
+
globalDateRange,
|
|
12
|
+
hasLocalCostFilters,
|
|
13
|
+
period,
|
|
14
|
+
runPageRange,
|
|
15
|
+
}: {
|
|
16
|
+
embedded: boolean;
|
|
17
|
+
globalDateRange: { start: string; end: string } | undefined;
|
|
18
|
+
hasLocalCostFilters: boolean;
|
|
19
|
+
period: CostPeriod;
|
|
20
|
+
runPageRange: CostPageDateRange | undefined;
|
|
21
|
+
}): CostPageDateRange | undefined {
|
|
22
|
+
if (
|
|
23
|
+
embedded &&
|
|
24
|
+
globalDateRange === undefined &&
|
|
25
|
+
period === defaultCostPeriod &&
|
|
26
|
+
!hasLocalCostFilters
|
|
27
|
+
)
|
|
28
|
+
return undefined;
|
|
29
|
+
return runPageRange;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Compact lifecycle tables share the same embedded snapshot contract. */
|
|
33
|
+
export function resolveCompactCostPageRange(args: Parameters<typeof resolveCostGroupPageRange>[0]) {
|
|
34
|
+
return resolveCostGroupPageRange(args);
|
|
35
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export type { CompactLifecycleCostPage } from "./CompactLifecycleCostTable.js";
|
|
1
2
|
export * from "./CostMonitorPage.js";
|
|
2
3
|
export { CostRunsTable } from "./CostTables.js";
|
|
3
|
-
export type { CompactLifecycleCostPage } from "./CompactLifecycleCostTable.js";
|
|
4
|
-
export { matches as matchesCostRunFilter } from "./cost-monitor-row-filters.js";
|
|
5
4
|
export type { CostCurrency, CostLocale } from "./cost-monitor-copy.js";
|
|
5
|
+
export { matches as matchesCostRunFilter } from "./cost-monitor-row-filters.js";
|
|
@@ -127,7 +127,8 @@ export function summarizeCostPeriodAverages(
|
|
|
127
127
|
): CostPeriodAverages {
|
|
128
128
|
const divisor = rows.length;
|
|
129
129
|
return {
|
|
130
|
-
tasks:
|
|
130
|
+
tasks:
|
|
131
|
+
divisor === 0 ? null : rows.reduce((sum, row) => sum + (row.task_count ?? 0), 0) / divisor,
|
|
131
132
|
specs: divisor === 0 ? null : rows.reduce((sum, row) => sum + row.spec_count, 0) / divisor,
|
|
132
133
|
prds: divisor === 0 ? null : rows.reduce((sum, row) => sum + row.prd_count, 0) / divisor,
|
|
133
134
|
durationMs: averagePerPeriod(
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
type CompactLifecycleCostPage,
|
|
4
4
|
withTokenBackedCompactDuration,
|
|
5
5
|
} from "./CompactLifecycleCostTable.js";
|
|
6
|
-
import type { CostView } from "./cost-monitor-views.js";
|
|
7
6
|
import type { CostFilterState } from "./CostFilters.js";
|
|
7
|
+
import type { CostView } from "./cost-monitor-views.js";
|
|
8
8
|
|
|
9
9
|
type CompactReadModelKind = CompactLifecycleCostPage["kind"];
|
|
10
10
|
export type LoadCompactCostPage = (request: {
|
|
@@ -28,21 +28,33 @@ export function compactReadModelKind(view: CostView): CompactReadModelKind | nul
|
|
|
28
28
|
: null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** A page fallback is valid only for the same compact table surface. */
|
|
32
|
+
export function isSameCompactCostSurface(resolvedKey: string | null, requestKey: string): boolean {
|
|
33
|
+
if (resolvedKey === null) return false;
|
|
34
|
+
return (
|
|
35
|
+
resolvedKey.slice(0, resolvedKey.lastIndexOf("\u0000")) ===
|
|
36
|
+
requestKey.slice(0, requestKey.lastIndexOf("\u0000"))
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
export function useCompactCostPage({
|
|
32
41
|
view,
|
|
33
42
|
load,
|
|
43
|
+
limit = 50,
|
|
34
44
|
range,
|
|
35
45
|
query,
|
|
36
46
|
filters,
|
|
37
47
|
}: {
|
|
38
48
|
view: CostView;
|
|
39
49
|
load: LoadCompactCostPage | undefined;
|
|
50
|
+
limit?: number;
|
|
40
51
|
range: { from: string; to: string } | undefined;
|
|
41
52
|
query: string | undefined;
|
|
42
53
|
filters: CostFilterState;
|
|
43
54
|
}) {
|
|
44
55
|
const [offset, setOffset] = useState(0);
|
|
45
56
|
const [page, setPage] = useState<CompactLifecycleCostPage | null>(null);
|
|
57
|
+
const [resolvedKey, setResolvedKey] = useState<string | null>(null);
|
|
46
58
|
const [loading, setLoading] = useState(false);
|
|
47
59
|
const [error, setError] = useState<string | null>(null);
|
|
48
60
|
const [attempt, setAttempt] = useState(0);
|
|
@@ -53,7 +65,10 @@ export function useCompactCostPage({
|
|
|
53
65
|
const rangeFrom = range?.from;
|
|
54
66
|
const rangeTo = range?.to;
|
|
55
67
|
const filterKey = Object.values(filters).join("\u0000");
|
|
56
|
-
const paginationKey = `${view}\u0000${query ?? ""}\u0000${rangeFrom ?? ""}\u0000${rangeTo ?? ""}\u0000${filterKey}`;
|
|
68
|
+
const paginationKey = `${view}\u0000${limit}\u0000${query ?? ""}\u0000${rangeFrom ?? ""}\u0000${rangeTo ?? ""}\u0000${filterKey}`;
|
|
69
|
+
const requestKey = `${paginationKey}\u0000${offset}`;
|
|
70
|
+
const requestInputRef = useRef({ filters, limit, query, rangeFrom, rangeTo });
|
|
71
|
+
requestInputRef.current = { filters, limit, query, rangeFrom, rangeTo };
|
|
57
72
|
useEffect(() => {
|
|
58
73
|
void paginationKey;
|
|
59
74
|
setOffset(0);
|
|
@@ -73,18 +88,23 @@ export function useCompactCostPage({
|
|
|
73
88
|
setError(null);
|
|
74
89
|
const loadPage = loadRef.current;
|
|
75
90
|
if (loadPage === undefined) return;
|
|
91
|
+
const requestInput = requestInputRef.current;
|
|
76
92
|
void loadPage({
|
|
77
93
|
kind,
|
|
78
94
|
offset,
|
|
79
|
-
limit:
|
|
80
|
-
...(rangeFrom === undefined || rangeTo === undefined
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
limit: requestInput.limit,
|
|
96
|
+
...(requestInput.rangeFrom === undefined || requestInput.rangeTo === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: { from: requestInput.rangeFrom, to: requestInput.rangeTo }),
|
|
99
|
+
...(requestInput.query ? { query: requestInput.query } : {}),
|
|
100
|
+
filters: requestInput.filters,
|
|
83
101
|
signal: controller.signal,
|
|
84
102
|
})
|
|
85
103
|
.then((next) => {
|
|
86
|
-
if (!controller.signal.aborted && generation === generationRef.current)
|
|
104
|
+
if (!controller.signal.aborted && generation === generationRef.current) {
|
|
87
105
|
setPage({ ...next, rows: next.rows.map(withTokenBackedCompactDuration) });
|
|
106
|
+
setResolvedKey(requestKey);
|
|
107
|
+
}
|
|
88
108
|
})
|
|
89
109
|
.catch((cause: unknown) => {
|
|
90
110
|
if (!controller.signal.aborted && generation === generationRef.current)
|
|
@@ -96,11 +116,14 @@ export function useCompactCostPage({
|
|
|
96
116
|
return () => controller.abort();
|
|
97
117
|
// App supplies an inline loader. Its identity changes after state updates;
|
|
98
118
|
// retaining it here would abort/restart this exact request forever.
|
|
99
|
-
}, [attempt,
|
|
119
|
+
}, [attempt, hasLoad, offset, requestKey, view]);
|
|
100
120
|
return {
|
|
101
121
|
compactPageOffset: offset,
|
|
102
122
|
setCompactPageOffset: setOffset,
|
|
103
|
-
|
|
123
|
+
// A response for another tab, range, filter, or offset must never occupy
|
|
124
|
+
// this view while the next request is in flight.
|
|
125
|
+
compactPage: resolvedKey === requestKey ? page : null,
|
|
126
|
+
staleCompactPage: isSameCompactCostSurface(resolvedKey, requestKey) ? page : null,
|
|
104
127
|
compactPageLoading: loading,
|
|
105
128
|
compactPageError: error,
|
|
106
129
|
retryCompactPage: () => setAttempt((value) => value + 1),
|
package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
+
import { isSameCompactCostSurface } from "./use-compact-cost-page.js";
|
|
4
|
+
import { isCurrentCostGroupPage, isSameCostGroupSurface } from "./use-cost-group-page.js";
|
|
3
5
|
|
|
4
|
-
describe("
|
|
6
|
+
describe("useCostGroupPage loading lifecycle", () => {
|
|
5
7
|
it("masks a resolved monthly page while the annual request is pending", () => {
|
|
6
8
|
const monthly = "monthly\u0000\u0000\u0000\u0000\u00000";
|
|
7
9
|
const annual = "annual\u0000\u0000\u0000\u0000\u00000";
|
|
@@ -9,4 +11,37 @@ describe("Cost group page request identity", () => {
|
|
|
9
11
|
expect(isCurrentCostGroupPage(monthly, annual)).toBe(false);
|
|
10
12
|
expect(isCurrentCostGroupPage(annual, annual)).toBe(true);
|
|
11
13
|
});
|
|
14
|
+
|
|
15
|
+
it("never reuses rows from another tab while its slow request is pending", () => {
|
|
16
|
+
const daily = "daily\u000010\u00002026-08-01\u00002026-08-25\u0000\u00000";
|
|
17
|
+
const models = "models\u000010\u00002026-08-01\u00002026-08-25\u0000\u00000";
|
|
18
|
+
const executions = "executions\u000010\u0000\u00002026-08-01\u00002026-08-25\u0000\u00000";
|
|
19
|
+
const tasks = "tasks\u000010\u0000\u00002026-08-01\u00002026-08-25\u0000\u00000";
|
|
20
|
+
|
|
21
|
+
expect(isSameCostGroupSurface(daily, models)).toBe(false);
|
|
22
|
+
expect(isSameCompactCostSurface(executions, tasks)).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("keeps previous rows only while the next page of the same tab is pending", () => {
|
|
26
|
+
const firstPage = "daily\u000010\u00002026-08-01\u00002026-08-25\u0000\u00000";
|
|
27
|
+
const secondPage = "daily\u000010\u00002026-08-01\u00002026-08-25\u0000\u000010";
|
|
28
|
+
|
|
29
|
+
expect(isSameCostGroupSurface(firstPage, secondPage)).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("invalidates an aborted request before clearing an inactive group view", () => {
|
|
33
|
+
const source = readFileSync(new URL("./use-cost-group-page.ts", import.meta.url), "utf8");
|
|
34
|
+
|
|
35
|
+
expect(source).toContain("const current = ++generation.current;");
|
|
36
|
+
expect(source).toContain("if (!active || !loader.current)");
|
|
37
|
+
expect(source).toContain("setLoading(false);");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("handles loader failures instead of leaving a rejected promise", () => {
|
|
41
|
+
const source = readFileSync(new URL("./use-cost-group-page.ts", import.meta.url), "utf8");
|
|
42
|
+
|
|
43
|
+
expect(source).toContain(".catch((cause: unknown) => {");
|
|
44
|
+
expect(source).toContain("setError(cause instanceof Error ? cause.message : String(cause));");
|
|
45
|
+
expect(source).toContain("retry: () => setAttempt");
|
|
46
|
+
});
|
|
12
47
|
});
|