@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,10 +1,5 @@
|
|
|
1
|
-
import { developerArtifactCountsCte } from "./sqlite-artifact-counts.js";
|
|
2
1
|
import type { SqliteQueryContext } from "./sqlite-query-context.js";
|
|
3
|
-
import {
|
|
4
|
-
costMonitorFilterDay,
|
|
5
|
-
saoPauloDay,
|
|
6
|
-
sumKnownDeveloperMetric,
|
|
7
|
-
} from "./sqlite-read-model-canonical.js";
|
|
2
|
+
import { costMonitorFilterDay, saoPauloDay } from "./sqlite-read-model-canonical.js";
|
|
8
3
|
import type { SqliteReadModelFileSystem } from "./sqlite-read-model-filesystem.js";
|
|
9
4
|
export function queryInvocationTotals(
|
|
10
5
|
context: SqliteQueryContext,
|
|
@@ -289,12 +284,48 @@ export function queryCostMonitorFinancialActivityRows(
|
|
|
289
284
|
};
|
|
290
285
|
add("zaip_agent", filter.agents);
|
|
291
286
|
add("phase", filter.phases);
|
|
292
|
-
|
|
287
|
+
if (filter.statuses?.length) {
|
|
288
|
+
clauses.push(`COALESCE((SELECT t.status FROM canonical_work_items t
|
|
289
|
+
WHERE t.entity_kind='task' AND t.id=a.task_id), a.status)
|
|
290
|
+
IN (${filter.statuses.map(() => "?").join(",")})`);
|
|
291
|
+
values.push(...filter.statuses);
|
|
292
|
+
}
|
|
293
293
|
add("task_id", filter.tasks);
|
|
294
294
|
add("spec_id", filter.specs);
|
|
295
295
|
add("prd_id", filter.prds);
|
|
296
296
|
add("execution_id", filter.executions);
|
|
297
297
|
add("change_id", filter.changes);
|
|
298
|
+
add("work_type", filter.workTypes);
|
|
299
|
+
for (const [column, items] of [
|
|
300
|
+
["priority", filter.priorities],
|
|
301
|
+
["risk", filter.risks],
|
|
302
|
+
] as const) {
|
|
303
|
+
if (!items?.length) continue;
|
|
304
|
+
clauses.push(`EXISTS (SELECT 1 FROM canonical_work_items t
|
|
305
|
+
WHERE t.entity_kind='task' AND t.id=a.task_id AND t.${column} IN (${items.map(() => "?").join(",")}))`);
|
|
306
|
+
values.push(...items);
|
|
307
|
+
}
|
|
308
|
+
if (filter.origins?.length) {
|
|
309
|
+
clauses.push(
|
|
310
|
+
`(${filter.origins
|
|
311
|
+
.map((origin) =>
|
|
312
|
+
origin === "prd"
|
|
313
|
+
? "a.prd_id IS NOT NULL"
|
|
314
|
+
: origin === "spec"
|
|
315
|
+
? "a.prd_id IS NULL AND a.spec_id IS NOT NULL"
|
|
316
|
+
: origin === "task"
|
|
317
|
+
? "a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL"
|
|
318
|
+
: "a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL",
|
|
319
|
+
)
|
|
320
|
+
.join(" OR ")})`,
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (filter.query) {
|
|
324
|
+
clauses.push(
|
|
325
|
+
"(a.agent_run_id LIKE ? OR a.execution_id LIKE ? OR a.task_id LIKE ? OR a.spec_id LIKE ? OR a.prd_id LIKE ? OR a.conversation_id LIKE ? OR a.zaip_agent LIKE ? OR a.purpose LIKE ?)",
|
|
326
|
+
);
|
|
327
|
+
values.push(...Array(8).fill(`%${filter.query}%`));
|
|
328
|
+
}
|
|
298
329
|
if (providers.length > 0 || models.length > 0) {
|
|
299
330
|
const usageClauses: string[] = [];
|
|
300
331
|
if (providers.length > 0) {
|
|
@@ -343,205 +374,7 @@ export function queryCostMonitorFinancialActivityRows(
|
|
|
343
374
|
FROM activities a WHERE ${clauses.join(" AND ")} ORDER BY a.occurred_at`)
|
|
344
375
|
.all(...values) as Array<Record<string, unknown>>;
|
|
345
376
|
}
|
|
346
|
-
export
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
to: string | null;
|
|
351
|
-
accountIds?: readonly string[];
|
|
352
|
-
},
|
|
353
|
-
) {
|
|
354
|
-
const from = costMonitorFilterDay(filter.from);
|
|
355
|
-
const to = costMonitorFilterDay(filter.to);
|
|
356
|
-
const clauses = [
|
|
357
|
-
"a.developer_account_id IS NOT NULL",
|
|
358
|
-
"(? IS NULL OR a.occurred_day_sp >= ?)",
|
|
359
|
-
"(? IS NULL OR a.occurred_day_sp <= ?)",
|
|
360
|
-
];
|
|
361
|
-
const values: Array<string | null> = [from, from, to, to];
|
|
362
|
-
if (filter.accountIds !== undefined && filter.accountIds.length > 0) {
|
|
363
|
-
clauses.push(`a.developer_account_id IN (${filter.accountIds.map(() => "?").join(",")})`);
|
|
364
|
-
values.push(...filter.accountIds);
|
|
365
|
-
}
|
|
366
|
-
const where = clauses.join(" AND ");
|
|
367
|
-
const rows = context.database
|
|
368
|
-
.prepare(`
|
|
369
|
-
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where}), completed AS (
|
|
370
|
-
SELECT a.developer_account_id, COUNT(DISTINCT w.id) AS completed_task_count
|
|
371
|
-
FROM zaip_vw_canonical_work_items w JOIN selected a ON a.run_id=w.completed_run_id
|
|
372
|
-
WHERE w.entity_kind='task' AND w.status='completed' GROUP BY a.developer_account_id
|
|
373
|
-
) ${developerArtifactCountsCte()}
|
|
374
|
-
SELECT a.developer_account_id AS account_id, MAX(a.developer_login) AS login_snapshot,
|
|
375
|
-
CASE WHEN COUNT(DISTINCT a.developer_attribution_source)=1 THEN MAX(a.developer_attribution_source) ELSE 'mixed' END AS attribution_source,
|
|
376
|
-
COUNT(DISTINCT a.prd_id) AS prd_count, COUNT(DISTINCT a.spec_id) AS spec_count,
|
|
377
|
-
COUNT(DISTINCT a.task_id) AS task_count, COUNT(*) AS run_count,
|
|
378
|
-
COALESCE(artifacts.test_count, 0) AS test_count,
|
|
379
|
-
COALESCE(artifacts.evidence_count, 0) AS evidence_count,
|
|
380
|
-
SUM(a.attributed_token_active_ms) AS total_duration_ms,
|
|
381
|
-
COUNT(a.attributed_token_active_ms) AS duration_covered_runs,
|
|
382
|
-
SUM(a.source_event_count) AS source_event_count,
|
|
383
|
-
SUM(a.total_tokens) AS total_tokens, SUM(a.cost_usd) AS total_cost_usd, SUM(a.cost_brl) AS total_cost_brl,
|
|
384
|
-
COUNT(a.total_tokens) AS token_covered_runs, COUNT(a.cost_usd) AS usd_covered_runs, COUNT(a.cost_brl) AS brl_covered_runs,
|
|
385
|
-
COALESCE(completed.completed_task_count, 0) AS completed_task_count
|
|
386
|
-
FROM selected a
|
|
387
|
-
LEFT JOIN completed USING(developer_account_id)
|
|
388
|
-
LEFT JOIN artifacts USING(developer_account_id)
|
|
389
|
-
GROUP BY a.developer_account_id ORDER BY total_cost_brl DESC, account_id`)
|
|
390
|
-
.all(...values, from, from, to, to) as Array<Record<string, unknown>>;
|
|
391
|
-
// A delivery is factual only when the canonical Task points at the exact
|
|
392
|
-
// completed Run. Contributors are the distinct attributed GitHub accounts
|
|
393
|
-
// on that same Run; no timestamp, commit, or deployment inference enters.
|
|
394
|
-
const delivered = context.database
|
|
395
|
-
.prepare(`
|
|
396
|
-
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where})
|
|
397
|
-
SELECT selected.developer_account_id AS delivered_by_account_id, w.id, w.title, w.status, w.completed_run_id,
|
|
398
|
-
GROUP_CONCAT(DISTINCT contributor.developer_account_id || char(31) || COALESCE(contributor.developer_login, '')) AS contributor_pairs
|
|
399
|
-
FROM zaip_vw_canonical_work_items w
|
|
400
|
-
JOIN selected ON selected.run_id=w.completed_run_id
|
|
401
|
-
LEFT JOIN zaip_vw_activities contributor ON contributor.task_id=w.id
|
|
402
|
-
AND contributor.developer_account_id IS NOT NULL
|
|
403
|
-
WHERE w.entity_kind='task' AND w.status='completed'
|
|
404
|
-
GROUP BY selected.developer_account_id, w.id, w.title, w.status, w.completed_run_id
|
|
405
|
-
ORDER BY w.id`)
|
|
406
|
-
.all(...values) as Array<Record<string, unknown>>;
|
|
407
|
-
const deliveriesByAccount = new Map<string, Array<Record<string, unknown>>>();
|
|
408
|
-
for (const task of delivered) {
|
|
409
|
-
const accountId = String(task.delivered_by_account_id);
|
|
410
|
-
const list = deliveriesByAccount.get(accountId) ?? [];
|
|
411
|
-
list.push({
|
|
412
|
-
id: task.id,
|
|
413
|
-
title: task.title,
|
|
414
|
-
status: task.status,
|
|
415
|
-
completed_run_id: task.completed_run_id,
|
|
416
|
-
delivered_by: { account_id: accountId },
|
|
417
|
-
contributors: String(task.contributor_pairs ?? "")
|
|
418
|
-
.split(",")
|
|
419
|
-
.filter(Boolean)
|
|
420
|
-
.map((pair) => {
|
|
421
|
-
const [account_id, login_snapshot] = pair.split(String.fromCharCode(31));
|
|
422
|
-
return { account_id, login_snapshot: login_snapshot || null };
|
|
423
|
-
}),
|
|
424
|
-
});
|
|
425
|
-
deliveriesByAccount.set(accountId, list);
|
|
426
|
-
}
|
|
427
|
-
const qualificationForSource: Record<
|
|
428
|
-
string,
|
|
429
|
-
"verified" | "cached_fallback" | "human_assigned" | "mixed"
|
|
430
|
-
> = {
|
|
431
|
-
verified_local_account: "verified",
|
|
432
|
-
cached_fallback: "cached_fallback",
|
|
433
|
-
human_assigned: "human_assigned",
|
|
434
|
-
mixed: "mixed",
|
|
435
|
-
};
|
|
436
|
-
for (const row of rows) {
|
|
437
|
-
row.completed_tasks = deliveriesByAccount.get(String(row.account_id)) ?? [];
|
|
438
|
-
row.qualification = qualificationForSource[String(row.attribution_source)] ?? "unqualified";
|
|
439
|
-
}
|
|
440
|
-
return {
|
|
441
|
-
data_source: "sqlite_read_model" as const,
|
|
442
|
-
filters: { from, to, account_ids: filter.accountIds ?? [] },
|
|
443
|
-
rows,
|
|
444
|
-
totals: {
|
|
445
|
-
run_count: rows.reduce((sum, row) => sum + Number(row.run_count ?? 0), 0),
|
|
446
|
-
completed_task_count: rows.reduce(
|
|
447
|
-
(sum, row) => sum + Number(row.completed_task_count ?? 0),
|
|
448
|
-
0,
|
|
449
|
-
),
|
|
450
|
-
total_cost_usd: sumKnownDeveloperMetric(rows, "total_cost_usd"),
|
|
451
|
-
total_cost_brl: sumKnownDeveloperMetric(rows, "total_cost_brl"),
|
|
452
|
-
},
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
export function queryOperationsDeveloperAggregate(
|
|
456
|
-
context: SqliteQueryContext,
|
|
457
|
-
filter: {
|
|
458
|
-
from: string | null;
|
|
459
|
-
to: string | null;
|
|
460
|
-
accountIds?: readonly string[];
|
|
461
|
-
},
|
|
462
|
-
) {
|
|
463
|
-
const from = costMonitorFilterDay(filter.from);
|
|
464
|
-
const to = costMonitorFilterDay(filter.to);
|
|
465
|
-
const clauses = [
|
|
466
|
-
"a.developer_account_id IS NOT NULL",
|
|
467
|
-
"(? IS NULL OR a.occurred_day_sp >= ?)",
|
|
468
|
-
"(? IS NULL OR a.occurred_day_sp <= ?)",
|
|
469
|
-
];
|
|
470
|
-
const values: Array<string | null> = [from, from, to, to];
|
|
471
|
-
if (filter.accountIds !== undefined && filter.accountIds.length > 0) {
|
|
472
|
-
clauses.push(`a.developer_account_id IN (${filter.accountIds.map(() => "?").join(",")})`);
|
|
473
|
-
values.push(...filter.accountIds);
|
|
474
|
-
}
|
|
475
|
-
const where = clauses.join(" AND ");
|
|
476
|
-
const rows = context.database
|
|
477
|
-
.prepare(`
|
|
478
|
-
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where}),
|
|
479
|
-
developer_tasks AS (
|
|
480
|
-
SELECT DISTINCT developer_account_id AS account_id, task_id
|
|
481
|
-
FROM selected WHERE task_id IS NOT NULL
|
|
482
|
-
), canonical_task_facts AS (
|
|
483
|
-
SELECT developer_tasks.account_id, work.status, work.entity_kind, work.risk
|
|
484
|
-
FROM developer_tasks JOIN zaip_vw_canonical_work_items work
|
|
485
|
-
ON work.entity_kind='task' AND work.id=developer_tasks.task_id
|
|
486
|
-
), status_counts AS (
|
|
487
|
-
SELECT account_id, json_group_object(status, task_count) AS status_counts_json
|
|
488
|
-
FROM (SELECT account_id, status, COUNT(*) AS task_count FROM canonical_task_facts
|
|
489
|
-
WHERE status IS NOT NULL GROUP BY account_id, status) GROUP BY account_id
|
|
490
|
-
), type_counts AS (
|
|
491
|
-
SELECT account_id, json_group_object(entity_kind, task_count) AS type_counts_json
|
|
492
|
-
FROM (SELECT account_id, entity_kind, COUNT(*) AS task_count FROM canonical_task_facts
|
|
493
|
-
WHERE entity_kind IS NOT NULL GROUP BY account_id, entity_kind) GROUP BY account_id
|
|
494
|
-
), risk_counts AS (
|
|
495
|
-
SELECT account_id, json_group_object(risk, task_count) AS risk_counts_json
|
|
496
|
-
FROM (SELECT account_id, risk, COUNT(*) AS task_count FROM canonical_task_facts
|
|
497
|
-
WHERE risk IS NOT NULL GROUP BY account_id, risk) GROUP BY account_id
|
|
498
|
-
), completed AS (
|
|
499
|
-
SELECT account_id, COUNT(*) AS completed_task_count
|
|
500
|
-
FROM canonical_task_facts WHERE status='completed'
|
|
501
|
-
GROUP BY account_id
|
|
502
|
-
)
|
|
503
|
-
-- task_count is the distinct, observed Task-id population attributed
|
|
504
|
-
-- to this developer in the selected period. Canonical records do not
|
|
505
|
-
-- retain a creator identity, so this projection never infers one.
|
|
506
|
-
SELECT selected.developer_account_id AS account_id, MAX(selected.developer_login) AS login_snapshot,
|
|
507
|
-
COUNT(DISTINCT selected.task_id) AS task_count,
|
|
508
|
-
COALESCE(completed.completed_task_count, 0) AS completed_task_count,
|
|
509
|
-
SUM(selected.attributed_token_active_ms) AS total_duration_ms,
|
|
510
|
-
SUM(selected.total_tokens) AS total_tokens,
|
|
511
|
-
SUM(selected.cost_brl) AS total_cost_brl,
|
|
512
|
-
status_counts.status_counts_json, type_counts.type_counts_json, risk_counts.risk_counts_json
|
|
513
|
-
FROM selected
|
|
514
|
-
LEFT JOIN completed ON completed.account_id=selected.developer_account_id
|
|
515
|
-
LEFT JOIN status_counts ON status_counts.account_id=selected.developer_account_id
|
|
516
|
-
LEFT JOIN type_counts ON type_counts.account_id=selected.developer_account_id
|
|
517
|
-
LEFT JOIN risk_counts ON risk_counts.account_id=selected.developer_account_id
|
|
518
|
-
GROUP BY selected.developer_account_id
|
|
519
|
-
ORDER BY total_cost_brl DESC, account_id`)
|
|
520
|
-
.all(...values) as Array<Record<string, unknown>>;
|
|
521
|
-
const distribution = (value: unknown): Record<string, number> | null => {
|
|
522
|
-
if (typeof value !== "string") return null;
|
|
523
|
-
try {
|
|
524
|
-
const parsed = JSON.parse(value) as Record<string, unknown>;
|
|
525
|
-
return Object.fromEntries(
|
|
526
|
-
Object.entries(parsed).flatMap(([key, count]) =>
|
|
527
|
-
typeof count === "number" && Number.isFinite(count) ? [[key, count]] : [],
|
|
528
|
-
),
|
|
529
|
-
);
|
|
530
|
-
} catch {
|
|
531
|
-
return null;
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
for (const row of rows) {
|
|
535
|
-
row.status_counts = distribution(row.status_counts_json);
|
|
536
|
-
row.type_counts = distribution(row.type_counts_json);
|
|
537
|
-
row.risk_counts = distribution(row.risk_counts_json);
|
|
538
|
-
delete row.status_counts_json;
|
|
539
|
-
delete row.type_counts_json;
|
|
540
|
-
delete row.risk_counts_json;
|
|
541
|
-
}
|
|
542
|
-
return {
|
|
543
|
-
data_source: "sqlite_read_model" as const,
|
|
544
|
-
filters: { from, to, account_ids: filter.accountIds ?? [] },
|
|
545
|
-
rows,
|
|
546
|
-
};
|
|
547
|
-
}
|
|
377
|
+
export {
|
|
378
|
+
queryDeveloperCostAggregate,
|
|
379
|
+
queryOperationsDeveloperAggregate,
|
|
380
|
+
} from "./sqlite-query-developer.js";
|
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-model-dimension.ts
CHANGED
|
@@ -35,10 +35,17 @@ export function readModelDimension(
|
|
|
35
35
|
values.push(input.phase);
|
|
36
36
|
}
|
|
37
37
|
if (input.status) {
|
|
38
|
-
clauses.push("i.status = ?");
|
|
38
|
+
clauses.push("COALESCE(t.status, i.status) = ?");
|
|
39
39
|
values.push(input.status);
|
|
40
40
|
}
|
|
41
|
-
if (input.priority
|
|
41
|
+
if (input.priority) {
|
|
42
|
+
clauses.push("t.priority = ?");
|
|
43
|
+
values.push(input.priority);
|
|
44
|
+
}
|
|
45
|
+
if (input.workType) {
|
|
46
|
+
clauses.push("i.work_type = ?");
|
|
47
|
+
values.push(input.workType);
|
|
48
|
+
}
|
|
42
49
|
if (input.risk) {
|
|
43
50
|
clauses.push("t.risk = ?");
|
|
44
51
|
values.push(input.risk);
|
|
@@ -95,10 +102,17 @@ export function readModelDimension(
|
|
|
95
102
|
activityValues.push(input.phase);
|
|
96
103
|
}
|
|
97
104
|
if (input.status) {
|
|
98
|
-
activityClauses.push("a.status = ?");
|
|
105
|
+
activityClauses.push("COALESCE(activity_task.status, a.status) = ?");
|
|
99
106
|
activityValues.push(input.status);
|
|
100
107
|
}
|
|
101
|
-
if (input.priority
|
|
108
|
+
if (input.priority) {
|
|
109
|
+
activityClauses.push("activity_task.priority = ?");
|
|
110
|
+
activityValues.push(input.priority);
|
|
111
|
+
}
|
|
112
|
+
if (input.workType) {
|
|
113
|
+
activityClauses.push("a.work_type = ?");
|
|
114
|
+
activityValues.push(input.workType);
|
|
115
|
+
}
|
|
102
116
|
if (input.risk) {
|
|
103
117
|
activityClauses.push("activity_task.risk = ?");
|
|
104
118
|
activityValues.push(input.risk);
|
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts
CHANGED
|
@@ -31,10 +31,17 @@ export function readProviderDimension(
|
|
|
31
31
|
values.push(input.phase);
|
|
32
32
|
}
|
|
33
33
|
if (input.status) {
|
|
34
|
-
clauses.push("i.status = ?");
|
|
34
|
+
clauses.push("COALESCE(t.status, i.status) = ?");
|
|
35
35
|
values.push(input.status);
|
|
36
36
|
}
|
|
37
|
-
if (input.priority
|
|
37
|
+
if (input.priority) {
|
|
38
|
+
clauses.push("t.priority = ?");
|
|
39
|
+
values.push(input.priority);
|
|
40
|
+
}
|
|
41
|
+
if (input.workType) {
|
|
42
|
+
clauses.push("i.work_type = ?");
|
|
43
|
+
values.push(input.workType);
|
|
44
|
+
}
|
|
38
45
|
if (input.risk) {
|
|
39
46
|
clauses.push("t.risk = ?");
|
|
40
47
|
values.push(input.risk);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CostSummarySource } from "@zaip-ai/dashboard-cost-monitor/server";
|
|
2
2
|
import { artifactStructuralRowsSql } from "./sqlite-artifact-counts.js";
|
|
3
|
+
import { buildCostSummaryDetails } from "./sqlite-cost-summary-details.js";
|
|
3
4
|
import type { SqliteQueryContext } from "./sqlite-query-context.js";
|
|
4
5
|
import { costMonitorFilterDay } from "./sqlite-read-model-canonical.js";
|
|
5
6
|
import type { SqliteReadModelFileSystem } from "./sqlite-read-model-filesystem.js";
|
|
@@ -22,6 +23,7 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
22
23
|
return structuredClone(value);
|
|
23
24
|
};
|
|
24
25
|
const unfilteredAllTime =
|
|
26
|
+
!filter.query &&
|
|
25
27
|
sourceFrom === null &&
|
|
26
28
|
sourceTo === null &&
|
|
27
29
|
[
|
|
@@ -35,6 +37,10 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
35
37
|
filter.prds,
|
|
36
38
|
filter.executions,
|
|
37
39
|
filter.changes,
|
|
40
|
+
filter.priorities,
|
|
41
|
+
filter.risks,
|
|
42
|
+
filter.origins,
|
|
43
|
+
filter.workTypes,
|
|
38
44
|
].every((values) => values === undefined || values.length === 0);
|
|
39
45
|
if (unfilteredAllTime) {
|
|
40
46
|
const cached = context.database
|
|
@@ -42,10 +48,15 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
42
48
|
"SELECT payload_json FROM zaip_aios_activities WHERE payload_type='cost_monitor_summary_cache' ORDER BY recorded_at DESC LIMIT 1",
|
|
43
49
|
)
|
|
44
50
|
.get() as { payload_json?: string } | undefined;
|
|
45
|
-
if (typeof cached?.payload_json === "string")
|
|
46
|
-
|
|
51
|
+
if (typeof cached?.payload_json === "string") {
|
|
52
|
+
const summary = JSON.parse(cached.payload_json) as CostSummarySource;
|
|
53
|
+
// Old compact cache payloads predate filter dimensions. Reusing one
|
|
54
|
+
// would keep every selector empty after the runtime has been upgraded.
|
|
55
|
+
if (summary.filters_available !== undefined) return remember(summary);
|
|
56
|
+
}
|
|
47
57
|
}
|
|
48
58
|
if (
|
|
59
|
+
!filter.query &&
|
|
49
60
|
sourceFrom !== null &&
|
|
50
61
|
sourceTo !== null &&
|
|
51
62
|
[
|
|
@@ -59,6 +70,10 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
59
70
|
filter.prds,
|
|
60
71
|
filter.executions,
|
|
61
72
|
filter.changes,
|
|
73
|
+
filter.priorities,
|
|
74
|
+
filter.risks,
|
|
75
|
+
filter.origins,
|
|
76
|
+
filter.workTypes,
|
|
62
77
|
].every((values) => values === undefined || values.length === 0)
|
|
63
78
|
) {
|
|
64
79
|
const cached = context.database
|
|
@@ -72,7 +87,11 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
72
87
|
to: string;
|
|
73
88
|
aggregate: CostSummarySource;
|
|
74
89
|
};
|
|
75
|
-
if (
|
|
90
|
+
if (
|
|
91
|
+
payload.from === sourceFrom &&
|
|
92
|
+
payload.to === sourceTo &&
|
|
93
|
+
payload.aggregate.filters_available !== undefined
|
|
94
|
+
)
|
|
76
95
|
return remember(payload.aggregate);
|
|
77
96
|
}
|
|
78
97
|
}
|
|
@@ -92,12 +111,54 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
92
111
|
};
|
|
93
112
|
add("zaip_agent", filter.agents);
|
|
94
113
|
add("phase", filter.phases);
|
|
95
|
-
|
|
114
|
+
if (filter.statuses !== undefined && filter.statuses.length > 0) {
|
|
115
|
+
clauses.push(
|
|
116
|
+
`COALESCE((SELECT task.status FROM canonical_work_items task
|
|
117
|
+
WHERE task.entity_kind='task' AND task.id=a.task_id), a.status)
|
|
118
|
+
IN (${filter.statuses.map(() => "?").join(",")})`,
|
|
119
|
+
);
|
|
120
|
+
values.push(...filter.statuses);
|
|
121
|
+
}
|
|
96
122
|
add("task_id", filter.tasks);
|
|
97
123
|
add("spec_id", filter.specs);
|
|
98
124
|
add("prd_id", filter.prds);
|
|
99
125
|
add("execution_id", filter.executions);
|
|
100
126
|
add("change_id", filter.changes);
|
|
127
|
+
add("work_type", filter.workTypes);
|
|
128
|
+
if (filter.query) {
|
|
129
|
+
clauses.push(
|
|
130
|
+
"(a.task_id LIKE ? OR a.spec_id LIKE ? OR a.prd_id LIKE ? OR a.execution_id LIKE ? OR a.conversation_id LIKE ? OR a.zaip_agent LIKE ? OR a.model LIKE ? OR a.run_id LIKE ? OR a.agent_run_id LIKE ? OR EXISTS (SELECT 1 FROM canonical_work_items task WHERE task.id=a.task_id AND task.title LIKE ?))",
|
|
131
|
+
);
|
|
132
|
+
values.push(...Array(10).fill(`%${filter.query}%`));
|
|
133
|
+
}
|
|
134
|
+
if (filter.priorities !== undefined && filter.priorities.length > 0) {
|
|
135
|
+
clauses.push(
|
|
136
|
+
`EXISTS (SELECT 1 FROM canonical_work_items task
|
|
137
|
+
WHERE task.entity_kind='task' AND task.id=a.task_id
|
|
138
|
+
AND task.priority IN (${filter.priorities.map(() => "?").join(",")}))`,
|
|
139
|
+
);
|
|
140
|
+
values.push(...filter.priorities);
|
|
141
|
+
}
|
|
142
|
+
if (filter.risks !== undefined && filter.risks.length > 0) {
|
|
143
|
+
clauses.push(
|
|
144
|
+
`EXISTS (SELECT 1 FROM canonical_work_items task
|
|
145
|
+
WHERE task.entity_kind='task' AND task.id=a.task_id
|
|
146
|
+
AND task.risk IN (${filter.risks.map(() => "?").join(",")}))`,
|
|
147
|
+
);
|
|
148
|
+
values.push(...filter.risks);
|
|
149
|
+
}
|
|
150
|
+
if (filter.origins !== undefined && filter.origins.length > 0) {
|
|
151
|
+
const originClauses = filter.origins.map((origin) =>
|
|
152
|
+
origin === "prd"
|
|
153
|
+
? "a.prd_id IS NOT NULL"
|
|
154
|
+
: origin === "spec"
|
|
155
|
+
? "a.prd_id IS NULL AND a.spec_id IS NOT NULL"
|
|
156
|
+
: origin === "task"
|
|
157
|
+
? "a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NOT NULL"
|
|
158
|
+
: "a.prd_id IS NULL AND a.spec_id IS NULL AND a.task_id IS NULL",
|
|
159
|
+
);
|
|
160
|
+
clauses.push(`(${originClauses.join(" OR ")})`);
|
|
161
|
+
}
|
|
101
162
|
if (providers.length > 0 || models.length > 0) {
|
|
102
163
|
const usageClauses: string[] = [];
|
|
103
164
|
const directClauses: string[] = [];
|
|
@@ -128,11 +189,12 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
128
189
|
);
|
|
129
190
|
values.push(...directValues, ...usageValues);
|
|
130
191
|
}
|
|
131
|
-
const selected = `WITH selected AS (
|
|
192
|
+
const selected = `WITH selected AS MATERIALIZED (
|
|
132
193
|
SELECT ${sourceDay} AS day,
|
|
133
194
|
CASE WHEN a.phase='conversation' THEN 'conversation'
|
|
134
195
|
WHEN a.phase='planning' THEN 'planning' ELSE 'execution' END AS phase_key,
|
|
135
|
-
a.task_id, a.
|
|
196
|
+
a.task_id, a.spec_id, a.prd_id, a.model, a.provider, a.agent_run_id, a.zaip_agent,
|
|
197
|
+
a.entrypoint, a.status, a.phase, a.activity_source_kind, a.work_type AS work_key,
|
|
136
198
|
a.source_event_count AS event_count,
|
|
137
199
|
a.attributed_token_active_ms AS duration_ms,
|
|
138
200
|
a.input_tokens, a.cached_input_tokens, a.output_tokens, a.reasoning_tokens,
|
|
@@ -398,83 +460,13 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
398
460
|
];
|
|
399
461
|
}),
|
|
400
462
|
);
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
SELECT agent_invocation_id, SUM(total_tokens) AS total_tokens,
|
|
409
|
-
SUM(cost_usd) AS cost_usd, SUM(cost_brl) AS cost_brl
|
|
410
|
-
FROM cost_invocation_dimension_facts
|
|
411
|
-
WHERE total_tokens IS NOT NULL OR cost_usd IS NOT NULL OR cost_brl IS NOT NULL
|
|
412
|
-
GROUP BY agent_invocation_id
|
|
413
|
-
), components AS (
|
|
414
|
-
-- Agent facts can contain several observed models. Attribute their
|
|
415
|
-
-- financial components to the model segment, never to a mixed parent.
|
|
416
|
-
SELECT CASE WHEN f.model IS NULL OR trim(f.model) = '' OR lower(f.model) IN ('unavailable', 'unknown', 'mixed')
|
|
417
|
-
THEN 'unavailable' ELSE f.model END AS key,
|
|
418
|
-
SUM(f.total_tokens) AS total_tokens, SUM(f.cost_usd) AS total_cost_usd,
|
|
419
|
-
SUM(f.cost_brl) AS total_cost_brl
|
|
420
|
-
FROM selected s JOIN cost_invocation_dimension_facts f
|
|
421
|
-
ON f.agent_invocation_id=s.agent_run_id
|
|
422
|
-
WHERE s.agent_run_id IS NOT NULL
|
|
423
|
-
GROUP BY key
|
|
424
|
-
UNION ALL
|
|
425
|
-
-- Non-agent financial facts have no invocation segments, so their
|
|
426
|
-
-- observed model remains the only factual dimension.
|
|
427
|
-
SELECT CASE WHEN model IS NULL OR trim(model) = '' OR lower(model) IN ('unavailable', 'unknown', 'mixed')
|
|
428
|
-
THEN 'unavailable' ELSE model END AS key,
|
|
429
|
-
SUM(total_tokens), SUM(cost_usd), SUM(cost_brl)
|
|
430
|
-
FROM selected WHERE agent_run_id IS NULL GROUP BY key
|
|
431
|
-
UNION ALL
|
|
432
|
-
-- Preserve any consolidated invocation remainder as Sem dimensão so
|
|
433
|
-
-- the model chart reconciles to the same financial population.
|
|
434
|
-
SELECT 'unavailable' AS key,
|
|
435
|
-
SUM(s.total_tokens - COALESCE(st.total_tokens, 0)),
|
|
436
|
-
SUM(s.cost_usd - COALESCE(st.cost_usd, 0)),
|
|
437
|
-
SUM(s.cost_brl - COALESCE(st.cost_brl, 0))
|
|
438
|
-
FROM selected s LEFT JOIN segment_totals st ON st.agent_invocation_id=s.agent_run_id
|
|
439
|
-
WHERE s.agent_run_id IS NOT NULL
|
|
440
|
-
AND (s.total_tokens <> COALESCE(st.total_tokens, 0)
|
|
441
|
-
OR s.cost_usd <> COALESCE(st.cost_usd, 0)
|
|
442
|
-
OR s.cost_brl <> COALESCE(st.cost_brl, 0))
|
|
443
|
-
)
|
|
444
|
-
SELECT key, 0 AS invocation_count, NULL AS task_count,
|
|
445
|
-
NULL AS total_duration, 0 AS duration_unknown, 0 AS duration_known,
|
|
446
|
-
0 AS source_event_count, SUM(total_tokens) AS total_tokens,
|
|
447
|
-
SUM(total_cost_usd) AS total_cost_usd, SUM(total_cost_brl) AS total_cost_brl
|
|
448
|
-
FROM components GROUP BY key ORDER BY total_cost_brl DESC, key`)
|
|
449
|
-
.all(...values) as Array<Record<string, unknown>>;
|
|
450
|
-
const model_groups = summaryModelRows.map((row) => {
|
|
451
|
-
const duration = nullable(row.total_duration);
|
|
452
|
-
const durationUnknown = number(row.duration_unknown);
|
|
453
|
-
const durationKnown = nullable(row.duration_known) ?? duration ?? 0;
|
|
454
|
-
return {
|
|
455
|
-
key: String(row.key ?? "unavailable"),
|
|
456
|
-
label: String(row.label ?? row.key ?? "unavailable"),
|
|
457
|
-
latest_started_at: "",
|
|
458
|
-
run_count: number(row.invocation_count),
|
|
459
|
-
task_count: nullable(row.task_count),
|
|
460
|
-
prd_count: 0,
|
|
461
|
-
spec_count: 0,
|
|
462
|
-
evidence_count: 0,
|
|
463
|
-
test_count: 0,
|
|
464
|
-
event_count: number(row.source_event_count),
|
|
465
|
-
total_tokens: nullable(row.total_tokens),
|
|
466
|
-
estimated_usd: nullable(row.total_cost_usd),
|
|
467
|
-
estimated_brl: nullable(row.total_cost_brl),
|
|
468
|
-
duration_ms: duration,
|
|
469
|
-
duration: {
|
|
470
|
-
known_sum: durationKnown,
|
|
471
|
-
unknown: durationUnknown,
|
|
472
|
-
complete: durationUnknown === 0,
|
|
473
|
-
coverage_ratio: durationUnknown === 0 ? 1 : 0,
|
|
474
|
-
},
|
|
475
|
-
coverage: { events: 0, tokens: 0, usd: 0, brl: 0 },
|
|
476
|
-
};
|
|
477
|
-
});
|
|
463
|
+
const { model_groups, filters_available } = buildCostSummaryDetails(
|
|
464
|
+
context,
|
|
465
|
+
selected,
|
|
466
|
+
values,
|
|
467
|
+
number,
|
|
468
|
+
nullable,
|
|
469
|
+
);
|
|
478
470
|
return remember({
|
|
479
471
|
periods: { daily: periods },
|
|
480
472
|
aggregate_usage: {
|
|
@@ -486,6 +478,7 @@ export function queryCostMonitorSummaryAggregate(
|
|
|
486
478
|
rework,
|
|
487
479
|
},
|
|
488
480
|
task_count: number(totalRow?.task_count),
|
|
481
|
+
filters_available,
|
|
489
482
|
model_groups,
|
|
490
483
|
cost_monitor_daily_duration: durations,
|
|
491
484
|
daily_rows: compactDailyRows,
|