@zaip-ai/cli 3.2.0 → 3.4.0
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/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +5 -3
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/agent-catalog-upgrade.d.ts +3 -0
- package/dist/services/agent-catalog-upgrade.d.ts.map +1 -0
- package/dist/services/agent-catalog-upgrade.js +35 -0
- package/dist/services/agent-catalog-upgrade.js.map +1 -0
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +22 -22
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/install-template-policy.d.ts +3 -0
- package/dist/services/install-template-policy.d.ts.map +1 -0
- package/dist/services/install-template-policy.js +21 -0
- package/dist/services/install-template-policy.js.map +1 -0
- package/dist/services/logger.js +24 -8
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +33 -6
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/sqlite-bootstrap.d.ts +1 -0
- package/dist/services/sqlite-bootstrap.d.ts.map +1 -1
- package/dist/services/sqlite-bootstrap.js +10 -1
- package/dist/services/sqlite-bootstrap.js.map +1 -1
- package/package.json +2 -2
- package/templates/.agents/README-ENG.md +2 -1
- package/templates/.agents/README.md +2 -1
- package/templates/.agents/config/agents/catalog.yaml +1 -0
- package/templates/.agents/config/agents/discovery.json +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +2 -2
- package/templates/.agents/dashboard/.zaip-managed.json +278 -126
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-CEDZjl4V.js → CostCalculationGuidePage-C5NgEcVh.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-BzaUTZDx.js → DashboardHelpDialog-CCMVnkkI.js} +4 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-21cCJik-.js → PricingSettingsDialog-CGYcJ5EB.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-BAvLPAee.js → ProjectSettingsPage-DVCPPV75.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-wqW52uCx.js → TraceabilityWorkspace-CqK3Psfy.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{cost-monitor-PoJA2PI1.css → cost-monitor-BsMfGfQi.css} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-j3aUYH5G.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-BkAm8-h4.js → dashboard-localization-jvdDfNKs.js} +2 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DEmo6Tn2.js → icons-vendor-x8xxL9yW.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Cl5EWx8R.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Cwylbh_N.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CadYsm83.js → react-vendor-CNOXIJHN.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-BzKK8kK3.js → traceability-CcpbpT1s.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/src/App.tsx +12 -1
- package/templates/.agents/dashboard/apps/frontend/src/WorkspaceStatus.test.tsx +33 -0
- package/templates/.agents/dashboard/apps/frontend/src/WorkspaceStatus.tsx +58 -0
- package/templates/.agents/dashboard/apps/frontend/src/app-work-board-options.ts +41 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-runtime-status.ts +25 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +5 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.test.ts +140 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.ts +28 -41
- package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.ts +38 -0
- package/templates/.agents/dashboard/apps/frontend/src/workspace-status.css +33 -0
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +25 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +17 -19
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +13 -167
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +2 -9
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +8 -8
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +29 -52
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.test.ts +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +2 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +4 -27
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.test.ts +2 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/MacroCostTable.tsx +4 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/agent-model-presentation.test.ts +26 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-embedded.css +7 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-loaders.ts +173 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-props.ts +47 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-selectors.ts +1 -7
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-page-range.ts +3 -9
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +44 -83
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +11 -111
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +47 -181
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +63 -91
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/cost-monitor-unavailable.test.ts +55 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/cost-summary-duration.test.ts +189 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsEntityFilters.tsx +82 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +4 -1
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +5 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +22 -31
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.test.tsx +13 -1
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.tsx +16 -3
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +11 -27
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +44 -193
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportColumns.ts +186 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/excel-agent-participations.test.ts +28 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/export/xlsx-runtime-e2e.test.ts +55 -31
- package/templates/.agents/dashboard/modules/operations/src/react/operations-export-duration.ts +13 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-filter-panel.css +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/use-operation-filter-feedback.ts +18 -0
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +11 -0
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +10 -2
- package/templates/.agents/dashboard/modules/operations/src/work-board-model.ts +1 -1
- 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/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +406 -332
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +352 -280
- package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +4 -2
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +406 -332
- package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.test.ts +95 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +102 -12
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +75 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server-costs-routes.ts +10 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-lifecycle-diagnostics.ts +50 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-macro-population.test.ts +165 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-page-filters.ts +65 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.test.ts +111 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-pages.ts +53 -63
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-runs-route.ts +19 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.test.ts +19 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.ts +11 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/server-read-projections.ts +19 -12
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.test.ts +46 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +10 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +4 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +43 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +46 -11
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-filter-matrix.test.ts +188 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-summary-details.test.ts +85 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-summary-details.ts +147 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.test.ts +94 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.ts +96 -55
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-force-canonical.test.ts +58 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-macro-classification.test.ts +172 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-projections.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-projection.ts +4 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.test.ts +7 -7
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.ts +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-period-averages.ts +10 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-agent-dimension.ts +18 -82
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-cached-cost-page.ts +169 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-developer.ts +205 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.ts +13 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts +22 -23
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-financial.ts +42 -209
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-model-dimension.ts +18 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts +9 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +76 -83
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +25 -161
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical.ts +18 -45
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +15 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +16 -16
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +47 -22
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +16 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +13 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-rebuild-result.ts +15 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +4 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +19 -42
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-macro-classification.ts +48 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-summary-cursor.ts +15 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-token-active-allocation.ts +46 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-work-stages.ts +60 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-history.mjs +5 -1
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-claims.test.mjs +7 -1
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +17 -2
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-ownership.mjs +65 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-ownership.test.mjs +72 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-processes.mjs +32 -9
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +39 -45
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +5 -2
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/scripts/qualify-macro-overview.mjs +50 -0
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +1 -18
- package/templates/.agents/dashboard/tests/e2e/specs/export-row-identity.spec.ts +20 -0
- package/templates/.agents/dashboard/tests/e2e/specs/export-row-identity.ts +20 -0
- package/templates/.agents/design/.zaip-managed.json +82 -74
- package/templates/.agents/design/apps/catalog/dist/assets/index-0W0Gj_Gs.css +1 -0
- package/templates/.agents/design/apps/catalog/dist/assets/index-32GZO95T.js +72 -0
- package/templates/.agents/design/apps/catalog/dist/assets/{index-D_lfqoyx.js → index-BP8IxOxt.js} +3 -3
- package/templates/.agents/design/apps/catalog/dist/assets/{index-BOjCcUaU.js → index-QJsgr9Ht.js} +3 -3
- package/templates/.agents/design/apps/catalog/dist/index.html +2 -2
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/CatalogShell-CvaciY0C.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{Color-6AOWCN3U-Cm-yJJz_.js → Color-6AOWCN3U-DwBV1A1Y.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-3dqK5g3e.js +142 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-2OCgtT0I.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{DocsRenderer-JROSPFPF-Belk4jRr.js → DocsRenderer-JROSPFPF-CODg0rSl.js} +4 -4
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Primitives-BmeKjJW4.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{WithTooltip-7X4HQR7L-DoPvjkS1.js → WithTooltip-7X4HQR7L-C5MI-3uZ.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/WorkspaceStatus.stories-Tb_iQqVK.js +17 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/WorkspaceStatusSpecimen-CD54pw0-.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-DRQKCCAG-B1itKXEN.js → chunk-DRQKCCAG-KSn75jcy.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-W22LQPXL-C-Eb5SPY.js → chunk-W22LQPXL-C4LS1Thf.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{components-DnyKLwhj.js → components-DV1BRgMY.js} +5 -5
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-BU_68im1.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-0W0Gj_Gs.css +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{iframe-DcXBsFPz.js → iframe-CBbPFx5G.js} +4 -4
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{react-18-CRM89QRf.js → react-18-C9IPGXtb.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-CEv2qkJT.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{syntaxhighlighter-YFXUGROL-B03jQGTF.js → syntaxhighlighter-YFXUGROL-ZgDQjyWI.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/{theming-4ZyufAga.js → theming-Cx9-gH6l.js} +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/iframe.html +2 -2
- package/templates/.agents/design/apps/catalog/dist/storybook/index.json +1 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +3 -3
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +4 -4
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +60 -60
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/apps/catalog/src/components/DashboardFiltersSpecimen.tsx +61 -0
- package/templates/.agents/design/apps/catalog/src/components/Primitives.tsx +24 -0
- package/templates/.agents/design/apps/catalog/src/components/WorkspaceStatusSpecimen.tsx +26 -0
- package/templates/.agents/design/apps/catalog/src/design-contract.test.ts +27 -13
- package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +38 -0
- package/templates/.agents/design/apps/catalog/src/pages/DesignSystemPage.tsx +15 -1
- package/templates/.agents/design/apps/catalog/src/stories/Components.stories.tsx +18 -0
- package/templates/.agents/design/apps/catalog/src/stories/DashboardFilters.stories.tsx +7 -0
- package/templates/.agents/design/apps/catalog/src/stories/WorkspaceStatus.stories.tsx +9 -0
- package/templates/.agents/design/apps/catalog/src/styles/components.css +83 -2
- package/templates/.agents/design/apps/catalog/src/styles.css +2 -0
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/design/tokens.json +32 -0
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.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 +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 +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +18 -4
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/autonomy-decision.md +1 -0
- package/templates/.agents/rules/workflow.md +1 -1
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +28 -26
- package/templates/.agents/runtime/checksums.sha256 +5 -5
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/provenance.json +4 -4
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/skills/zaip-aios/SKILL.md +0 -1
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-config/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +13 -0
- package/templates/.agents/skills/zaip-skill-execution/references/autonomous-continuation.md +17 -0
- package/templates/.agents/skills/zaip-skill-execution/references/correction-cycle.md +2 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +4 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +4 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +2 -2
- package/templates/.agents/skills/zaip-skill-github-setup/SKILL.md +2 -2
- package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +15 -8
- package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +13 -12
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +50 -13
- package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +2 -2
- package/templates/.agents/skills/zaip-skill-update-version-doc/SKILL.md +39 -0
- package/templates/.agents/skills/zaip-skill-update-version-doc/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-update-version-doc/scripts/update-version-doc.mjs +21 -0
- package/templates/.agents/skills/zaip-skill-update-version-doc/scripts/update-version-doc.test.mjs +32 -0
- package/templates/.agents/zaip-aios/README.md +2 -1
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +7 -3
- package/templates/template-manifest.json +436 -256
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-06__WZco.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Cmlx8OYH.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DqZKJS8y.js +0 -2
- package/templates/.agents/design/apps/catalog/dist/assets/index-BEmIE7WE.css +0 -1
- package/templates/.agents/design/apps/catalog/dist/assets/index-BJV597iq.js +0 -72
- package/templates/.agents/design/apps/catalog/dist/assets/index-B_WhrCZe.js +0 -72
- package/templates/.agents/design/apps/catalog/dist/assets/index-CqqYWY2f.js +0 -9
- package/templates/.agents/design/apps/catalog/dist/assets/index-CqtYXZfV.js +0 -72
- package/templates/.agents/design/apps/catalog/dist/assets/index-D9pj7Jlf.js +0 -9
- package/templates/.agents/design/apps/catalog/dist/assets/index-i_PO2k9R.js +0 -9
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/CatalogShell-Cstn1UwA.js +0 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-D1WopB2L.js +0 -137
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-DQ9PJ3N3.js +0 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-D0OSgxWz.js +0 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-BEmIE7WE.css +0 -1
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-C3tkVMIp.js +0 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { isDateOnlyCostPage, readDateOnlyCostDimensionPage } from "./sqlite-cost-agent-page.js";
|
|
2
|
-
import { filterCostInvocationProjection } from "./sqlite-cost-invocation-page.js";
|
|
3
2
|
import {
|
|
4
3
|
attachOperationsWorkListDevelopers,
|
|
5
4
|
operationsWorkListPayloadPage,
|
|
6
5
|
operationsWorkListSqlPage,
|
|
7
6
|
} from "./sqlite-operations-work-list.js";
|
|
8
7
|
import { readAgentDimension } from "./sqlite-query-agent-dimension.js";
|
|
8
|
+
import {
|
|
9
|
+
readCachedCostViewPage,
|
|
10
|
+
type SqliteViewPageInput,
|
|
11
|
+
} from "./sqlite-query-cached-cost-page.js";
|
|
9
12
|
import type { SqliteQueryContext, SqliteViewPage } from "./sqlite-query-context.js";
|
|
10
13
|
import { readEntityGroup } from "./sqlite-query-entity-group.js";
|
|
11
14
|
import { readFilteredDimension } from "./sqlite-query-filtered-dimension.js";
|
|
@@ -17,164 +20,10 @@ import { type SqliteViewName, sqliteViewMetadata } from "./sqlite-read-model-typ
|
|
|
17
20
|
export function queryUncachedViewPage(
|
|
18
21
|
context: SqliteQueryContext,
|
|
19
22
|
view: SqliteViewName,
|
|
20
|
-
input:
|
|
21
|
-
from?: string | null;
|
|
22
|
-
to?: string | null;
|
|
23
|
-
query?: string;
|
|
24
|
-
status?: string;
|
|
25
|
-
risk?: string;
|
|
26
|
-
provider?: string;
|
|
27
|
-
model?: string;
|
|
28
|
-
agent?: string;
|
|
29
|
-
phase?: string;
|
|
30
|
-
origin?: string;
|
|
31
|
-
workType?: string;
|
|
32
|
-
priority?: string;
|
|
33
|
-
kind?: "all" | "all-tasks" | "task" | "standalone-task" | "prd" | "spec";
|
|
34
|
-
offset?: number;
|
|
35
|
-
limit?: number;
|
|
36
|
-
},
|
|
23
|
+
input: SqliteViewPageInput,
|
|
37
24
|
): SqliteViewPage {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
!input.to &&
|
|
41
|
-
!input.query &&
|
|
42
|
-
!input.status &&
|
|
43
|
-
!input.risk &&
|
|
44
|
-
!input.provider &&
|
|
45
|
-
!input.model &&
|
|
46
|
-
!input.agent &&
|
|
47
|
-
!input.phase &&
|
|
48
|
-
!input.origin &&
|
|
49
|
-
!input.workType &&
|
|
50
|
-
!input.priority;
|
|
51
|
-
const isDateOnlyCostInvocationPage =
|
|
52
|
-
view === "cost_monitor_agent_invocations" &&
|
|
53
|
-
!input.query &&
|
|
54
|
-
!input.status &&
|
|
55
|
-
!input.risk &&
|
|
56
|
-
!input.provider &&
|
|
57
|
-
!input.model &&
|
|
58
|
-
!input.agent &&
|
|
59
|
-
!input.phase &&
|
|
60
|
-
!input.origin &&
|
|
61
|
-
!input.workType &&
|
|
62
|
-
!input.priority;
|
|
63
|
-
if (isDateOnlyCostInvocationPage) {
|
|
64
|
-
const projection = filterCostInvocationProjection(
|
|
65
|
-
context.technicalPayloadRows("cost_agent_invocation_projection_v1"),
|
|
66
|
-
input,
|
|
67
|
-
);
|
|
68
|
-
if (projection.length > 0) {
|
|
69
|
-
const limit = Math.min(200, Math.max(1, input.limit ?? 100));
|
|
70
|
-
const offset = Math.max(0, input.offset ?? 0);
|
|
71
|
-
const rows = projection.slice(offset, offset + limit);
|
|
72
|
-
return {
|
|
73
|
-
data_source: "sqlite_read_model" as const,
|
|
74
|
-
view,
|
|
75
|
-
offset,
|
|
76
|
-
limit,
|
|
77
|
-
total_count: projection.length,
|
|
78
|
-
has_more: offset + rows.length < projection.length,
|
|
79
|
-
rows,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const remoteAggregateDimensions: Partial<Record<SqliteViewName, string>> = {
|
|
84
|
-
cost_monitor_zaip_agents: "agent",
|
|
85
|
-
cost_monitor_executions: "execution",
|
|
86
|
-
cost_monitor_tasks: "task",
|
|
87
|
-
cost_monitor_conversations: "conversation",
|
|
88
|
-
};
|
|
89
|
-
const remoteAggregateDimension = remoteAggregateDimensions[view];
|
|
90
|
-
if (isUnfilteredAllTimeCostPage && remoteAggregateDimension !== undefined) {
|
|
91
|
-
const projection = context
|
|
92
|
-
.technicalPayloadRows("cost_dimension_aggregate_v1")
|
|
93
|
-
.filter((row) => row.dimension === remoteAggregateDimension);
|
|
94
|
-
const rows = projection
|
|
95
|
-
.filter((row) => row.row_kind === "row")
|
|
96
|
-
.map((row) =>
|
|
97
|
-
view === "cost_monitor_zaip_agents"
|
|
98
|
-
? {
|
|
99
|
-
key: row.key,
|
|
100
|
-
label: row.label,
|
|
101
|
-
persona: row.persona,
|
|
102
|
-
job: row.job,
|
|
103
|
-
latest_started_at: row.latest_started_at,
|
|
104
|
-
invocation_count: row.invocation_count,
|
|
105
|
-
task_count: row.task_count,
|
|
106
|
-
total_duration: row.total_duration,
|
|
107
|
-
duration_unknown: row.duration_unknown,
|
|
108
|
-
duration_known: row.duration_known,
|
|
109
|
-
source_event_count: row.source_event_count,
|
|
110
|
-
total_tokens: row.total_tokens,
|
|
111
|
-
total_cost_usd: row.total_cost_usd,
|
|
112
|
-
total_cost_brl: row.total_cost_brl,
|
|
113
|
-
}
|
|
114
|
-
: {
|
|
115
|
-
id: row.id,
|
|
116
|
-
key: row.key,
|
|
117
|
-
title: row.title,
|
|
118
|
-
status: row.status,
|
|
119
|
-
risk: row.risk,
|
|
120
|
-
first_day: row.first_day,
|
|
121
|
-
last_day: row.last_day,
|
|
122
|
-
occurred_at: row.occurred_at,
|
|
123
|
-
invocation_count: row.invocation_count,
|
|
124
|
-
llm_call_count: row.llm_call_count,
|
|
125
|
-
total_duration: row.total_duration,
|
|
126
|
-
total_input_tokens: row.total_input_tokens,
|
|
127
|
-
total_cached_input_tokens: row.total_cached_input_tokens,
|
|
128
|
-
total_output_tokens: row.total_output_tokens,
|
|
129
|
-
total_reasoning_tokens: row.total_reasoning_tokens,
|
|
130
|
-
total_tokens: row.total_tokens,
|
|
131
|
-
total_cost_usd: row.total_cost_usd,
|
|
132
|
-
total_cost_brl: row.total_cost_brl,
|
|
133
|
-
},
|
|
134
|
-
)
|
|
135
|
-
.sort(
|
|
136
|
-
(left, right) =>
|
|
137
|
-
Number(right.total_cost_brl ?? -1) - Number(left.total_cost_brl ?? -1) ||
|
|
138
|
-
String(left.key ?? "").localeCompare(String(right.key ?? "")),
|
|
139
|
-
) as Array<Record<string, unknown>>;
|
|
140
|
-
const totals = projection.find((row) => row.row_kind === "totals");
|
|
141
|
-
if (rows.length > 0 && totals !== undefined) {
|
|
142
|
-
const limit = Math.min(200, Math.max(1, input.limit ?? 50));
|
|
143
|
-
const offset = Math.max(0, input.offset ?? 0);
|
|
144
|
-
const page = rows.slice(offset, offset + limit);
|
|
145
|
-
const publicTotals =
|
|
146
|
-
view !== "cost_monitor_zaip_agents"
|
|
147
|
-
? {
|
|
148
|
-
entity_count: totals.entity_count,
|
|
149
|
-
invocation_count: totals.invocation_count,
|
|
150
|
-
total_duration: totals.total_duration,
|
|
151
|
-
total_tokens: totals.total_tokens,
|
|
152
|
-
total_cost_usd: totals.total_cost_usd,
|
|
153
|
-
total_cost_brl: totals.total_cost_brl,
|
|
154
|
-
}
|
|
155
|
-
: {
|
|
156
|
-
invocation_count: totals.invocation_count,
|
|
157
|
-
task_count: totals.task_count,
|
|
158
|
-
total_duration: totals.total_duration,
|
|
159
|
-
duration_unknown: totals.duration_unknown,
|
|
160
|
-
duration_known: totals.duration_known,
|
|
161
|
-
source_event_count: totals.source_event_count,
|
|
162
|
-
total_tokens: totals.total_tokens,
|
|
163
|
-
total_cost_usd: totals.total_cost_usd,
|
|
164
|
-
total_cost_brl: totals.total_cost_brl,
|
|
165
|
-
};
|
|
166
|
-
return {
|
|
167
|
-
data_source: "sqlite_read_model" as const,
|
|
168
|
-
view,
|
|
169
|
-
offset,
|
|
170
|
-
limit,
|
|
171
|
-
total_count: rows.length,
|
|
172
|
-
has_more: offset + page.length < rows.length,
|
|
173
|
-
totals: publicTotals,
|
|
174
|
-
rows: page,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
25
|
+
const cachedCostPage = readCachedCostViewPage(context, view, input);
|
|
26
|
+
if (cachedCostPage !== null) return cachedCostPage;
|
|
178
27
|
const cacheableUnfilteredViews: readonly SqliteViewName[] = [
|
|
179
28
|
"operations_work_kanban",
|
|
180
29
|
"operations_executions",
|
|
@@ -239,7 +88,20 @@ export function queryUncachedViewPage(
|
|
|
239
88
|
};
|
|
240
89
|
exact("i.zaip_agent", input.agent);
|
|
241
90
|
exact("i.phase", input.phase);
|
|
242
|
-
exact("i.status", input.status);
|
|
91
|
+
exact("COALESCE(t.status, i.status)", input.status);
|
|
92
|
+
exact("t.priority", input.priority);
|
|
93
|
+
exact("t.risk", input.risk);
|
|
94
|
+
exact("i.work_type", input.workType);
|
|
95
|
+
if (input.origin)
|
|
96
|
+
clauses.push(
|
|
97
|
+
input.origin === "prd"
|
|
98
|
+
? "i.prd_id IS NOT NULL"
|
|
99
|
+
: input.origin === "spec"
|
|
100
|
+
? "i.prd_id IS NULL AND i.spec_id IS NOT NULL"
|
|
101
|
+
: input.origin === "task"
|
|
102
|
+
? "i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL"
|
|
103
|
+
: "i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL",
|
|
104
|
+
);
|
|
243
105
|
const usageSegmentClauses: string[] = [];
|
|
244
106
|
if (input.provider) {
|
|
245
107
|
if (input.provider === "unavailable") {
|
|
@@ -275,13 +137,15 @@ export function queryUncachedViewPage(
|
|
|
275
137
|
const total_count = Number(
|
|
276
138
|
(
|
|
277
139
|
context.database
|
|
278
|
-
.prepare(
|
|
140
|
+
.prepare(
|
|
141
|
+
`SELECT COUNT(*) AS count FROM cost_monitor_agent_invocations i LEFT JOIN tasks t ON t.id=i.task_id WHERE ${where}`,
|
|
142
|
+
)
|
|
279
143
|
.get(...values) as { count: number }
|
|
280
144
|
).count,
|
|
281
145
|
);
|
|
282
146
|
const rows = context.database
|
|
283
147
|
.prepare(
|
|
284
|
-
`SELECT i
|
|
148
|
+
`SELECT i.*, t.priority, t.risk, t.status AS task_status, t.title AS task_title FROM cost_monitor_agent_invocations i LEFT JOIN tasks t ON t.id=i.task_id WHERE ${where} ORDER BY i.occurred_at DESC, i.agent_invocation_id DESC LIMIT ? OFFSET ?`,
|
|
285
149
|
)
|
|
286
150
|
.all(...values, limit, offset) as Array<Record<string, unknown>>;
|
|
287
151
|
return {
|
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { taskWorkStage } from "@zaip-ai/dashboard-operations/work-board-model";
|
|
1
2
|
import {
|
|
2
3
|
consolidatedValue,
|
|
3
4
|
frontMatterRecord,
|
|
@@ -57,7 +58,9 @@ export type CanonicalEntity = {
|
|
|
57
58
|
status: string | null;
|
|
58
59
|
stage: string | null;
|
|
59
60
|
risk: string | null;
|
|
61
|
+
priority: string | null;
|
|
60
62
|
specId: string | null;
|
|
63
|
+
prdId: string | null;
|
|
61
64
|
changeId: string | null;
|
|
62
65
|
occurredAt: string | null;
|
|
63
66
|
creationRunId: string | null;
|
|
@@ -233,9 +236,19 @@ export function readCanonicalEntities(
|
|
|
233
236
|
id,
|
|
234
237
|
title: scalar("title"),
|
|
235
238
|
status: scalar("status"),
|
|
236
|
-
stage:
|
|
239
|
+
stage:
|
|
240
|
+
kind === "task"
|
|
241
|
+
? taskWorkStage({
|
|
242
|
+
status: scalar("status") as Parameters<typeof taskWorkStage>[0]["status"],
|
|
243
|
+
spec_id: scalar("spec_id"),
|
|
244
|
+
started_at: scalar("started_at"),
|
|
245
|
+
attempt_count: Number(scalar("attempt_count") ?? 0),
|
|
246
|
+
})
|
|
247
|
+
: scalar("stage"),
|
|
237
248
|
risk: scalar("risk"),
|
|
249
|
+
priority: scalar("priority"),
|
|
238
250
|
specId: scalar("spec_id"),
|
|
251
|
+
prdId: scalar("prd_id"),
|
|
239
252
|
changeId: scalar("change_id"),
|
|
240
253
|
occurredAt: scalar("created_at") ?? scalar("started_at") ?? scalar("recorded_at"),
|
|
241
254
|
creationRunId: scalar("creation_run_id"),
|
|
@@ -694,50 +707,10 @@ export function usagePricingAudit(
|
|
|
694
707
|
};
|
|
695
708
|
}
|
|
696
709
|
|
|
697
|
-
export
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
* boundary. Each elementary segment is divided equally among the token-active
|
|
702
|
-
* activities covering it, making the materialized fact additive by activity,
|
|
703
|
-
* day, and every parent dimension.
|
|
704
|
-
*/
|
|
705
|
-
export function allocateAttributedTokenActiveMs(intervals: readonly TemporalInterval[]) {
|
|
706
|
-
const boundaries = new Set<number>();
|
|
707
|
-
for (const interval of intervals) {
|
|
708
|
-
boundaries.add(interval.startMs);
|
|
709
|
-
boundaries.add(interval.endMs);
|
|
710
|
-
for (let cursor = interval.startMs; cursor < interval.endMs; ) {
|
|
711
|
-
const nextDay =
|
|
712
|
-
Date.parse(`${saoPauloDay(new Date(cursor).toISOString())}T03:00:00.000Z`) + 86_400_000;
|
|
713
|
-
if (nextDay >= interval.endMs) break;
|
|
714
|
-
boundaries.add(nextDay);
|
|
715
|
-
cursor = nextDay;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
const points = [...boundaries].sort((left, right) => left - right);
|
|
719
|
-
const allocated = new Map<string, { activityRowId: string; day: string; value: number }>();
|
|
720
|
-
for (let index = 0; index < points.length - 1; index += 1) {
|
|
721
|
-
const startMs = points[index]!;
|
|
722
|
-
const endMs = points[index + 1]!;
|
|
723
|
-
const active = intervals.filter(
|
|
724
|
-
(interval) => interval.startMs < endMs && interval.endMs > startMs,
|
|
725
|
-
);
|
|
726
|
-
if (active.length === 0 || endMs <= startMs) continue;
|
|
727
|
-
const share = (endMs - startMs) / active.length;
|
|
728
|
-
const day = saoPauloDay(new Date(startMs).toISOString());
|
|
729
|
-
for (const interval of active) {
|
|
730
|
-
const key = `${interval.activityRowId}:${day}`;
|
|
731
|
-
const previous = allocated.get(key);
|
|
732
|
-
allocated.set(key, {
|
|
733
|
-
activityRowId: interval.activityRowId,
|
|
734
|
-
day,
|
|
735
|
-
value: (previous?.value ?? 0) + share,
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
return [...allocated.values()];
|
|
740
|
-
}
|
|
710
|
+
export {
|
|
711
|
+
allocateAttributedTokenActiveMs,
|
|
712
|
+
type TemporalInterval,
|
|
713
|
+
} from "./sqlite-token-active-allocation.js";
|
|
741
714
|
|
|
742
715
|
/** A dashboard API boundary can be a date or an ISO instant. Normalize both
|
|
743
716
|
* to the same Sao Paulo calendar key used by Cost Monitor SQL buckets. */
|
|
@@ -262,6 +262,19 @@ describe("SQLite dashboard read model", () => {
|
|
|
262
262
|
total_cost_brl: null,
|
|
263
263
|
}),
|
|
264
264
|
);
|
|
265
|
+
// Period-scoped macro cards are read from operations_work_projection.
|
|
266
|
+
// Keep structural classification fields in that physical projection; a
|
|
267
|
+
// missing column would make every selected SPEC/PRD appear empty.
|
|
268
|
+
expect(
|
|
269
|
+
filesystem.canonicalWorkPage("spec", { from: null, to: null }, 0, 50).rows,
|
|
270
|
+
).toContainEqual(
|
|
271
|
+
expect.objectContaining({ id: "SPEC-NO-RUN", task_count: 0, rework_run_count: 0 }),
|
|
272
|
+
);
|
|
273
|
+
expect(
|
|
274
|
+
filesystem.canonicalWorkPage("prd", { from: null, to: null }, 0, 50).rows,
|
|
275
|
+
).toContainEqual(
|
|
276
|
+
expect.objectContaining({ id: "PRD-NO-RUN", task_count: 0, rework_run_count: 0 }),
|
|
277
|
+
);
|
|
265
278
|
const allTime = filesystem.firstFoldAllTime();
|
|
266
279
|
expectPersistedFirstFoldCaches(root, allTime, filesystem.firstFoldBoardAllTime());
|
|
267
280
|
expect(allTime.aggregate).toMatchObject({
|
|
@@ -649,8 +662,8 @@ describe("SQLite dashboard read model", () => {
|
|
|
649
662
|
});
|
|
650
663
|
}
|
|
651
664
|
expect(filesystem.viewPage("cost_monitor_tasks", { workType: "new", limit: 1 })).toMatchObject({
|
|
652
|
-
total_count:
|
|
653
|
-
rows: [],
|
|
665
|
+
total_count: 2,
|
|
666
|
+
rows: [expect.objectContaining({ id: "TASK-B", total_tokens: 4 })],
|
|
654
667
|
});
|
|
655
668
|
expect(filesystem.firstFoldAllTime()).toBe(allTime);
|
|
656
669
|
filesystem.close();
|
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { attachAgentProductivity } from "./sqlite-agent-productivity.js";
|
|
|
5
5
|
import {
|
|
6
6
|
readFirstFoldAllTime,
|
|
7
7
|
readFirstFoldBoardAllTime,
|
|
8
|
+
readFirstFoldMacroMetrics,
|
|
8
9
|
readFirstFoldMonthlyQuick,
|
|
9
10
|
readFirstFoldTopTasksAllTime,
|
|
10
11
|
readFirstFoldViewport,
|
|
@@ -45,6 +46,7 @@ import {
|
|
|
45
46
|
sqliteViewMetadata,
|
|
46
47
|
} from "./sqlite-read-model-types.js";
|
|
47
48
|
import { installLegacyViewAliases } from "./sqlite-snapshot-cache.js";
|
|
49
|
+
import { encodeSummaryCursor, parseSummaryCursor } from "./sqlite-summary-cursor.js";
|
|
48
50
|
export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
49
51
|
private readonly executionDurationCache = new Map<string, Map<string, number>>();
|
|
50
52
|
private dailyAggregateRowsCache: Array<Record<string, number | string | null>> | null = null;
|
|
@@ -305,6 +307,10 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
305
307
|
return this.firstFoldAllTimeCache;
|
|
306
308
|
}
|
|
307
309
|
|
|
310
|
+
firstFoldMacroMetrics(): SqliteFirstFoldAllTime["macro_metrics"] {
|
|
311
|
+
return this.firstFoldAllTimeCache?.macro_metrics ?? readFirstFoldMacroMetrics(this.database);
|
|
312
|
+
}
|
|
313
|
+
|
|
308
314
|
firstFoldBoardAllTime(): SqliteFirstFoldAllTimeBoard {
|
|
309
315
|
if (this.firstFoldAllTimeBoardCache !== null) return this.firstFoldAllTimeBoardCache;
|
|
310
316
|
this.firstFoldAllTimeBoardCache = readFirstFoldBoardAllTime(this.database, () => {
|
|
@@ -438,6 +444,7 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
438
444
|
}
|
|
439
445
|
|
|
440
446
|
invocationCostRows(filter: {
|
|
447
|
+
query?: string;
|
|
441
448
|
from: string | null;
|
|
442
449
|
to: string | null;
|
|
443
450
|
providers?: readonly string[];
|
|
@@ -450,6 +457,10 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
450
457
|
prds?: readonly string[];
|
|
451
458
|
executions?: readonly string[];
|
|
452
459
|
changes?: readonly string[];
|
|
460
|
+
priorities?: readonly string[];
|
|
461
|
+
risks?: readonly string[];
|
|
462
|
+
origins?: readonly string[];
|
|
463
|
+
workTypes?: readonly string[];
|
|
453
464
|
}) {
|
|
454
465
|
return queryInvocationCostRows(this.queryContext(), filter);
|
|
455
466
|
}
|
|
@@ -471,6 +482,7 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
471
482
|
|
|
472
483
|
/** Complete canonical Run population for global Cost Monitor aggregates. */
|
|
473
484
|
activityCostRows(filter: {
|
|
485
|
+
query?: string;
|
|
474
486
|
from: string | null;
|
|
475
487
|
to: string | null;
|
|
476
488
|
providers?: readonly string[];
|
|
@@ -483,6 +495,10 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
483
495
|
prds?: readonly string[];
|
|
484
496
|
executions?: readonly string[];
|
|
485
497
|
changes?: readonly string[];
|
|
498
|
+
priorities?: readonly string[];
|
|
499
|
+
risks?: readonly string[];
|
|
500
|
+
origins?: readonly string[];
|
|
501
|
+
workTypes?: readonly string[];
|
|
486
502
|
}) {
|
|
487
503
|
return queryActivityCostRows(this.queryContext(), filter);
|
|
488
504
|
}
|
|
@@ -744,19 +760,3 @@ export class SqliteReadModelFileSystem extends WorkspaceFileSystem {
|
|
|
744
760
|
};
|
|
745
761
|
}
|
|
746
762
|
}
|
|
747
|
-
|
|
748
|
-
function encodeSummaryCursor(occurredAt: string, id: string): string {
|
|
749
|
-
return encodeURIComponent(JSON.stringify([occurredAt, id]));
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
function parseSummaryCursor(cursor: string | null): [string, string] | null {
|
|
753
|
-
if (cursor === null) return null;
|
|
754
|
-
try {
|
|
755
|
-
const parsed = JSON.parse(decodeURIComponent(cursor));
|
|
756
|
-
return Array.isArray(parsed) && typeof parsed[0] === "string" && typeof parsed[1] === "string"
|
|
757
|
-
? [parsed[0], parsed[1]]
|
|
758
|
-
: null;
|
|
759
|
-
} catch {
|
|
760
|
-
return null;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
@@ -4,6 +4,7 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { DatabaseSync } from "node:sqlite";
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
6
|
import { rebuildSqliteReadModel, SqliteReadModelFileSystem } from "./sqlite-read-model.js";
|
|
7
|
+
import { readModelSchemaVersion } from "./sqlite-read-model-schema.js";
|
|
7
8
|
|
|
8
9
|
const roots: string[] = [];
|
|
9
10
|
const sqliteTestTempRoot = join(
|
|
@@ -210,7 +211,7 @@ describe("SQLite dashboard read model", () => {
|
|
|
210
211
|
snapshot
|
|
211
212
|
.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key='schema_version'")
|
|
212
213
|
.get(),
|
|
213
|
-
).toEqual({ value:
|
|
214
|
+
).toEqual({ value: readModelSchemaVersion });
|
|
214
215
|
} finally {
|
|
215
216
|
snapshot.close();
|
|
216
217
|
}
|
|
@@ -247,7 +247,7 @@ describe("SQLite dashboard read model multi-provider", () => {
|
|
|
247
247
|
validation_count: null,
|
|
248
248
|
evidence_count: null,
|
|
249
249
|
});
|
|
250
|
-
expect(filesystem.viewPage(view, { workType: "new" }).total_count).
|
|
250
|
+
expect(filesystem.viewPage(view, { workType: "new" }).total_count).toBeGreaterThan(0);
|
|
251
251
|
}
|
|
252
252
|
expect(filesystem.viewPage("cost_monitor_zaip_agents", { priority: "high" })).toMatchObject({
|
|
253
253
|
total_count: 0,
|
|
@@ -30,31 +30,25 @@ import {
|
|
|
30
30
|
validateSqliteReadModelSchema,
|
|
31
31
|
} from "./sqlite-read-model-schema.js";
|
|
32
32
|
import { sourceFingerprint } from "./sqlite-read-model-source-fingerprint.js";
|
|
33
|
+
import type { SqliteRebuildResult } from "./sqlite-rebuild-result.js";
|
|
33
34
|
import { readSnapshotFileCount } from "./sqlite-snapshot-cache.js";
|
|
35
|
+
import { deriveCanonicalWorkStages } from "./sqlite-work-stages.js";
|
|
34
36
|
export async function rebuildSqliteReadModel(
|
|
35
37
|
workspaceRoot: string,
|
|
36
38
|
options: { forceCanonical?: boolean; preferExisting?: boolean } = {},
|
|
37
|
-
): Promise<{
|
|
38
|
-
files: number;
|
|
39
|
-
path: string;
|
|
40
|
-
cache: "generation" | "seed" | "stale_seed" | "rebuilt";
|
|
41
|
-
fingerprint_ms: number;
|
|
42
|
-
materialize_ms: number;
|
|
43
|
-
refresh: {
|
|
44
|
-
reused_sources: number;
|
|
45
|
-
processed_sources: number;
|
|
46
|
-
added_sources: number;
|
|
47
|
-
changed_sources: number;
|
|
48
|
-
removed_sources: number;
|
|
49
|
-
canonical_runs_refolded: number;
|
|
50
|
-
};
|
|
51
|
-
}> {
|
|
39
|
+
): Promise<SqliteRebuildResult> {
|
|
52
40
|
const path = sqliteReadModelPath(workspaceRoot);
|
|
53
|
-
//
|
|
54
|
-
//
|
|
41
|
+
// A reusable snapshot still has to match its canonical fingerprint. This
|
|
42
|
+
// avoids advertising every launch as stale while preserving the stale seed
|
|
43
|
+
// path for a changed source or an incompatible database.
|
|
55
44
|
if (options.preferExisting && !options.forceCanonical) {
|
|
56
45
|
try {
|
|
57
46
|
validateSqliteReadModelSchema(path);
|
|
47
|
+
const fingerprintStartedAt = performance.now();
|
|
48
|
+
const sourceSnapshot = await sourceFingerprint(workspaceRoot, {
|
|
49
|
+
previous: persistedSourceCheckpoint(path),
|
|
50
|
+
});
|
|
51
|
+
const fingerprint = `${sourceSnapshot.fingerprint}\ncurrent_day=${saoPauloDay(new Date().toISOString())}`;
|
|
58
52
|
const database = new DatabaseSync(path, { readOnly: true });
|
|
59
53
|
try {
|
|
60
54
|
if (hasReusableSnapshotPayloads(database)) {
|
|
@@ -63,15 +57,38 @@ export async function rebuildSqliteReadModel(
|
|
|
63
57
|
"SELECT value FROM zaip_vw_read_model_metadata WHERE key = 'source_file_count'",
|
|
64
58
|
)
|
|
65
59
|
.get() as { value: string };
|
|
60
|
+
const files = readSnapshotFileCount(
|
|
61
|
+
path,
|
|
62
|
+
fingerprint,
|
|
63
|
+
readModelSchemaVersion,
|
|
64
|
+
hasReusableSnapshotPayloads,
|
|
65
|
+
);
|
|
66
|
+
if (files !== null) {
|
|
67
|
+
return {
|
|
68
|
+
files,
|
|
69
|
+
path,
|
|
70
|
+
cache: "generation",
|
|
71
|
+
fingerprint_ms: Math.round(performance.now() - fingerprintStartedAt),
|
|
72
|
+
materialize_ms: 0,
|
|
73
|
+
refresh: {
|
|
74
|
+
reused_sources: sourceSnapshot.reusedFiles,
|
|
75
|
+
processed_sources: sourceSnapshot.hashedFiles,
|
|
76
|
+
added_sources: 0,
|
|
77
|
+
changed_sources: 0,
|
|
78
|
+
removed_sources: 0,
|
|
79
|
+
canonical_runs_refolded: 0,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
66
83
|
return {
|
|
67
84
|
files: Number(row.value),
|
|
68
85
|
path,
|
|
69
86
|
cache: "stale_seed",
|
|
70
|
-
fingerprint_ms:
|
|
87
|
+
fingerprint_ms: Math.round(performance.now() - fingerprintStartedAt),
|
|
71
88
|
materialize_ms: 0,
|
|
72
89
|
refresh: {
|
|
73
|
-
reused_sources:
|
|
74
|
-
processed_sources:
|
|
90
|
+
reused_sources: sourceSnapshot.reusedFiles,
|
|
91
|
+
processed_sources: sourceSnapshot.hashedFiles,
|
|
75
92
|
added_sources: 0,
|
|
76
93
|
changed_sources: 0,
|
|
77
94
|
removed_sources: 0,
|
|
@@ -397,7 +414,7 @@ export async function rebuildSqliteReadModel(
|
|
|
397
414
|
CREATE TEMP TABLE files (path TEXT PRIMARY KEY, content TEXT NOT NULL, mtime_ms REAL NOT NULL, size_bytes INTEGER NOT NULL, content_sha256 TEXT NOT NULL, artifact_kind TEXT, artifact_id TEXT, artifact_occurred_at TEXT, artifact_occurred_day_sp TEXT, artifact_task_id TEXT, artifact_change_id TEXT, artifact_run_id TEXT);
|
|
398
415
|
CREATE TEMP TABLE read_model_source_state (source_path TEXT PRIMARY KEY, source_hash TEXT NOT NULL, mtime_ms TEXT NOT NULL, ctime_ms TEXT NOT NULL, size_bytes INTEGER NOT NULL, file_identity TEXT NOT NULL, source_kind TEXT NOT NULL, last_processed_at TEXT NOT NULL);
|
|
399
416
|
CREATE TEMP TABLE read_model_metadata (key TEXT PRIMARY KEY, value TEXT NOT NULL);
|
|
400
|
-
CREATE TEMP TABLE canonical_work_items (entity_kind TEXT NOT NULL, id TEXT NOT NULL, title TEXT, status TEXT, stage TEXT, risk TEXT, spec_id TEXT, change_id TEXT, creation_run_id TEXT, completed_run_id TEXT, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, PRIMARY KEY(entity_kind, id));
|
|
417
|
+
CREATE TEMP TABLE canonical_work_items (entity_kind TEXT NOT NULL, id TEXT NOT NULL, title TEXT, status TEXT, stage TEXT, risk TEXT, priority TEXT, spec_id TEXT, prd_id TEXT, change_id TEXT, creation_run_id TEXT, completed_run_id TEXT, occurred_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, PRIMARY KEY(entity_kind, id));
|
|
401
418
|
CREATE TEMP TABLE canonical_executions (id TEXT PRIMARY KEY, status TEXT, kind TEXT, origin_type TEXT, origin_id TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, finished_at TEXT, source_path TEXT NOT NULL);
|
|
402
419
|
CREATE TEMP TABLE canonical_changes (id TEXT PRIMARY KEY, title TEXT NOT NULL, status TEXT NOT NULL, risk TEXT NOT NULL, source_type TEXT NOT NULL, source_id TEXT NOT NULL, source_spec_id TEXT, source_prd_id TEXT, requirement_ids_json TEXT NOT NULL, acceptance_ids_json TEXT NOT NULL, task_ids_json TEXT NOT NULL, result TEXT, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
|
|
403
420
|
CREATE TEMP TABLE canonical_decisions (id TEXT PRIMARY KEY, title TEXT NOT NULL, origin TEXT NOT NULL, scope_type TEXT NOT NULL, scope_id TEXT NOT NULL, created_at TEXT NOT NULL, occurred_day_sp TEXT NOT NULL, source_path TEXT NOT NULL);
|
|
@@ -599,7 +616,7 @@ export async function rebuildSqliteReadModel(
|
|
|
599
616
|
if (entity.creationRunId) changedCreationRunIds.add(entity.creationRunId);
|
|
600
617
|
reportLaunchProgress("projection_entities", 75, "Entidades canônicas interpretadas.");
|
|
601
618
|
const insertCanonicalWorkItem = database.prepare(
|
|
602
|
-
"INSERT INTO canonical_work_items(entity_kind, id, title, status, stage, risk, spec_id, change_id, creation_run_id, completed_run_id, occurred_at, occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
619
|
+
"INSERT INTO canonical_work_items(entity_kind, id, title, status, stage, risk, priority, spec_id, prd_id, change_id, creation_run_id, completed_run_id, occurred_at, occurred_day_sp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
603
620
|
);
|
|
604
621
|
for (const entity of canonicalEntities.values()) {
|
|
605
622
|
if (
|
|
@@ -615,7 +632,9 @@ export async function rebuildSqliteReadModel(
|
|
|
615
632
|
entity.status,
|
|
616
633
|
entity.stage,
|
|
617
634
|
entity.risk,
|
|
635
|
+
entity.priority,
|
|
618
636
|
entity.specId,
|
|
637
|
+
entity.prdId,
|
|
619
638
|
entity.changeId,
|
|
620
639
|
entity.creationRunId,
|
|
621
640
|
entity.completedRunId,
|
|
@@ -700,6 +719,12 @@ export async function rebuildSqliteReadModel(
|
|
|
700
719
|
entity.sourcePath,
|
|
701
720
|
);
|
|
702
721
|
reportLaunchProgress("projection_runs_started", 77, "Construindo fatos das invocações.");
|
|
722
|
+
deriveCanonicalWorkStages(canonicalEntities, canonicalLifecycle.changes);
|
|
723
|
+
const updateWorkStage = database.prepare(
|
|
724
|
+
"UPDATE canonical_work_items SET stage=? WHERE entity_kind=? AND id=?",
|
|
725
|
+
);
|
|
726
|
+
for (const entity of canonicalEntities.values())
|
|
727
|
+
updateWorkStage.run(entity.stage, entity.kind, entity.id);
|
|
703
728
|
const runMaterialization = materializeCanonicalRuns({
|
|
704
729
|
database,
|
|
705
730
|
previousActivities,
|
|
@@ -4,9 +4,10 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
4
4
|
import { hasRequiredFirstFoldPayloads } from "./sqlite-first-fold-persistence.js";
|
|
5
5
|
import type { SqliteReadModelSourceCheckpoint } from "./sqlite-read-model-source-fingerprint.js";
|
|
6
6
|
export const dbRelativePath = ".local/sqlite/zaip-aios-dashboard.sqlite";
|
|
7
|
-
// Schema
|
|
7
|
+
// Schema 83 adds canonical priority, Run work type and reconciled macro stages.
|
|
8
8
|
// Old snapshots must rebuild even when their canonical hashes still match.
|
|
9
|
-
|
|
9
|
+
// Refresh persisted first-fold summaries after factual duration/coverage semantics change.
|
|
10
|
+
export const readModelSchemaVersion = "84";
|
|
10
11
|
export const requiredPersistedTables = [
|
|
11
12
|
"zaip_aios_activities",
|
|
12
13
|
"zaip_dim_llm_model",
|
|
@@ -151,6 +152,19 @@ export function validateSqliteReadModelSchema(path: string): {
|
|
|
151
152
|
throw new Error(
|
|
152
153
|
`SQLite schema ${readModelSchemaVersion} requires the complete persisted table contract; found ${tables.join(", ") || "none"}`,
|
|
153
154
|
);
|
|
155
|
+
const projectionColumns = database
|
|
156
|
+
.prepare("PRAGMA table_info(operations_work_projection)")
|
|
157
|
+
.all() as Array<{ name?: unknown }>;
|
|
158
|
+
const projectionColumnNames = new Set(
|
|
159
|
+
projectionColumns.flatMap((column) => (typeof column.name === "string" ? [column.name] : [])),
|
|
160
|
+
);
|
|
161
|
+
const missingProjectionColumns = ["task_count", "rework_run_count"].filter(
|
|
162
|
+
(column) => !projectionColumnNames.has(column),
|
|
163
|
+
);
|
|
164
|
+
if (missingProjectionColumns.length > 0)
|
|
165
|
+
throw new Error(
|
|
166
|
+
`SQLite schema ${readModelSchemaVersion} requires operations_work_projection columns: ${missingProjectionColumns.join(", ")}`,
|
|
167
|
+
);
|
|
154
168
|
const names = new Set(objects.map((object) => object.name));
|
|
155
169
|
const missingViews = requiredViews.filter((view) => !names.has(view));
|
|
156
170
|
if (missingViews.length > 0)
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
SqliteReadModelFileSystem,
|
|
9
9
|
sourceFingerprint,
|
|
10
10
|
} from "./sqlite-read-model.js";
|
|
11
|
+
import { readModelSchemaVersion } from "./sqlite-read-model-schema.js";
|
|
11
12
|
|
|
12
13
|
const roots: string[] = [];
|
|
13
14
|
const sqliteTestTempRoot = join(
|
|
@@ -86,6 +87,17 @@ describe("SQLite dashboard read model", () => {
|
|
|
86
87
|
filesystem.close();
|
|
87
88
|
}
|
|
88
89
|
});
|
|
90
|
+
it("reuses an unchanged verified fingerprint as the current generation", async () => {
|
|
91
|
+
const root = await createSqliteTestRoot();
|
|
92
|
+
roots.push(root);
|
|
93
|
+
await mkdir(join(root, ".agents/config"), { recursive: true });
|
|
94
|
+
await writeFile(join(root, ".agents/config/project.yaml"), "zaip:\n enabled: true\n");
|
|
95
|
+
vi.spyOn(Date, "now").mockReturnValue(Date.now() + 5_000);
|
|
96
|
+
await rebuildSqliteReadModel(root);
|
|
97
|
+
await expect(rebuildSqliteReadModel(root, { preferExisting: true })).resolves.toMatchObject({
|
|
98
|
+
cache: "generation",
|
|
99
|
+
});
|
|
100
|
+
});
|
|
89
101
|
it("rolls back a failed refresh including first-fold payloads while a reader remains open", async () => {
|
|
90
102
|
const root = await createSqliteTestRoot();
|
|
91
103
|
roots.push(root);
|
|
@@ -177,7 +189,7 @@ describe("SQLite dashboard read model", () => {
|
|
|
177
189
|
metadata
|
|
178
190
|
.prepare("SELECT value FROM zaip_vw_read_model_metadata WHERE key='schema_version'")
|
|
179
191
|
.get(),
|
|
180
|
-
).toEqual({ value:
|
|
192
|
+
).toEqual({ value: readModelSchemaVersion });
|
|
181
193
|
} finally {
|
|
182
194
|
metadata.close();
|
|
183
195
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SqliteRebuildResult = {
|
|
2
|
+
files: number;
|
|
3
|
+
path: string;
|
|
4
|
+
cache: "generation" | "seed" | "stale_seed" | "rebuilt";
|
|
5
|
+
fingerprint_ms: number;
|
|
6
|
+
materialize_ms: number;
|
|
7
|
+
refresh: {
|
|
8
|
+
reused_sources: number;
|
|
9
|
+
processed_sources: number;
|
|
10
|
+
added_sources: number;
|
|
11
|
+
changed_sources: number;
|
|
12
|
+
removed_sources: number;
|
|
13
|
+
canonical_runs_refolded: number;
|
|
14
|
+
};
|
|
15
|
+
};
|