@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
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-cached-cost-page.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { filterCostInvocationProjection } from "./sqlite-cost-invocation-page.js";
|
|
2
|
+
import type { SqliteQueryContext, SqliteViewPage } from "./sqlite-query-context.js";
|
|
3
|
+
import type { SqliteViewName } from "./sqlite-read-model-types.js";
|
|
4
|
+
|
|
5
|
+
export type SqliteViewPageInput = {
|
|
6
|
+
from?: string | null;
|
|
7
|
+
to?: string | null;
|
|
8
|
+
query?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
risk?: string;
|
|
11
|
+
provider?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
agent?: string;
|
|
14
|
+
phase?: string;
|
|
15
|
+
origin?: string;
|
|
16
|
+
workType?: string;
|
|
17
|
+
priority?: string;
|
|
18
|
+
kind?: "all" | "all-tasks" | "task" | "standalone-task" | "prd" | "spec";
|
|
19
|
+
offset?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function readCachedCostViewPage(
|
|
24
|
+
context: SqliteQueryContext,
|
|
25
|
+
view: SqliteViewName,
|
|
26
|
+
input: SqliteViewPageInput,
|
|
27
|
+
): SqliteViewPage | null {
|
|
28
|
+
const isUnfilteredAllTimeCostPage =
|
|
29
|
+
!input.from &&
|
|
30
|
+
!input.to &&
|
|
31
|
+
!input.query &&
|
|
32
|
+
!input.status &&
|
|
33
|
+
!input.risk &&
|
|
34
|
+
!input.provider &&
|
|
35
|
+
!input.model &&
|
|
36
|
+
!input.agent &&
|
|
37
|
+
!input.phase &&
|
|
38
|
+
!input.origin &&
|
|
39
|
+
!input.workType &&
|
|
40
|
+
!input.priority;
|
|
41
|
+
const isDateOnlyCostInvocationPage =
|
|
42
|
+
view === "cost_monitor_agent_invocations" &&
|
|
43
|
+
!input.query &&
|
|
44
|
+
!input.status &&
|
|
45
|
+
!input.risk &&
|
|
46
|
+
!input.provider &&
|
|
47
|
+
!input.model &&
|
|
48
|
+
!input.agent &&
|
|
49
|
+
!input.phase &&
|
|
50
|
+
!input.origin &&
|
|
51
|
+
!input.workType &&
|
|
52
|
+
!input.priority;
|
|
53
|
+
if (isDateOnlyCostInvocationPage) {
|
|
54
|
+
const projection = filterCostInvocationProjection(
|
|
55
|
+
context.technicalPayloadRows("cost_agent_invocation_projection_v1"),
|
|
56
|
+
input,
|
|
57
|
+
);
|
|
58
|
+
if (projection.length > 0) {
|
|
59
|
+
const limit = Math.min(200, Math.max(1, input.limit ?? 100));
|
|
60
|
+
const offset = Math.max(0, input.offset ?? 0);
|
|
61
|
+
const rows = projection.slice(offset, offset + limit);
|
|
62
|
+
return {
|
|
63
|
+
data_source: "sqlite_read_model" as const,
|
|
64
|
+
view,
|
|
65
|
+
offset,
|
|
66
|
+
limit,
|
|
67
|
+
total_count: projection.length,
|
|
68
|
+
has_more: offset + rows.length < projection.length,
|
|
69
|
+
rows,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const remoteAggregateDimensions: Partial<Record<SqliteViewName, string>> = {
|
|
74
|
+
cost_monitor_zaip_agents: "agent",
|
|
75
|
+
cost_monitor_executions: "execution",
|
|
76
|
+
cost_monitor_tasks: "task",
|
|
77
|
+
cost_monitor_conversations: "conversation",
|
|
78
|
+
};
|
|
79
|
+
const remoteAggregateDimension = remoteAggregateDimensions[view];
|
|
80
|
+
if (isUnfilteredAllTimeCostPage && remoteAggregateDimension !== undefined) {
|
|
81
|
+
const projection = context
|
|
82
|
+
.technicalPayloadRows("cost_dimension_aggregate_v1")
|
|
83
|
+
.filter((row) => row.dimension === remoteAggregateDimension);
|
|
84
|
+
const rows = projection
|
|
85
|
+
.filter((row) => row.row_kind === "row")
|
|
86
|
+
.map((row) =>
|
|
87
|
+
view === "cost_monitor_zaip_agents"
|
|
88
|
+
? {
|
|
89
|
+
key: row.key,
|
|
90
|
+
label: row.label,
|
|
91
|
+
persona: row.persona,
|
|
92
|
+
job: row.job,
|
|
93
|
+
latest_started_at: row.latest_started_at,
|
|
94
|
+
invocation_count: row.invocation_count,
|
|
95
|
+
task_count: row.task_count,
|
|
96
|
+
total_duration: row.total_duration,
|
|
97
|
+
duration_unknown: row.duration_unknown,
|
|
98
|
+
duration_known: row.duration_known,
|
|
99
|
+
source_event_count: row.source_event_count,
|
|
100
|
+
total_tokens: row.total_tokens,
|
|
101
|
+
total_cost_usd: row.total_cost_usd,
|
|
102
|
+
total_cost_brl: row.total_cost_brl,
|
|
103
|
+
}
|
|
104
|
+
: {
|
|
105
|
+
id: row.id,
|
|
106
|
+
key: row.key,
|
|
107
|
+
title: row.title,
|
|
108
|
+
status: row.status,
|
|
109
|
+
risk: row.risk,
|
|
110
|
+
first_day: row.first_day,
|
|
111
|
+
last_day: row.last_day,
|
|
112
|
+
occurred_at: row.occurred_at,
|
|
113
|
+
invocation_count: row.invocation_count,
|
|
114
|
+
llm_call_count: row.llm_call_count,
|
|
115
|
+
total_duration: row.total_duration,
|
|
116
|
+
total_input_tokens: row.total_input_tokens,
|
|
117
|
+
total_cached_input_tokens: row.total_cached_input_tokens,
|
|
118
|
+
total_output_tokens: row.total_output_tokens,
|
|
119
|
+
total_reasoning_tokens: row.total_reasoning_tokens,
|
|
120
|
+
total_tokens: row.total_tokens,
|
|
121
|
+
total_cost_usd: row.total_cost_usd,
|
|
122
|
+
total_cost_brl: row.total_cost_brl,
|
|
123
|
+
},
|
|
124
|
+
)
|
|
125
|
+
.sort(
|
|
126
|
+
(left, right) =>
|
|
127
|
+
Number(right.total_cost_brl ?? -1) - Number(left.total_cost_brl ?? -1) ||
|
|
128
|
+
String(left.key ?? "").localeCompare(String(right.key ?? "")),
|
|
129
|
+
) as Array<Record<string, unknown>>;
|
|
130
|
+
const totals = projection.find((row) => row.row_kind === "totals");
|
|
131
|
+
if (rows.length > 0 && totals !== undefined) {
|
|
132
|
+
const limit = Math.min(200, Math.max(1, input.limit ?? 50));
|
|
133
|
+
const offset = Math.max(0, input.offset ?? 0);
|
|
134
|
+
const page = rows.slice(offset, offset + limit);
|
|
135
|
+
const publicTotals =
|
|
136
|
+
view !== "cost_monitor_zaip_agents"
|
|
137
|
+
? {
|
|
138
|
+
entity_count: totals.entity_count,
|
|
139
|
+
invocation_count: totals.invocation_count,
|
|
140
|
+
total_duration: totals.total_duration,
|
|
141
|
+
total_tokens: totals.total_tokens,
|
|
142
|
+
total_cost_usd: totals.total_cost_usd,
|
|
143
|
+
total_cost_brl: totals.total_cost_brl,
|
|
144
|
+
}
|
|
145
|
+
: {
|
|
146
|
+
invocation_count: totals.invocation_count,
|
|
147
|
+
task_count: totals.task_count,
|
|
148
|
+
total_duration: totals.total_duration,
|
|
149
|
+
duration_unknown: totals.duration_unknown,
|
|
150
|
+
duration_known: totals.duration_known,
|
|
151
|
+
source_event_count: totals.source_event_count,
|
|
152
|
+
total_tokens: totals.total_tokens,
|
|
153
|
+
total_cost_usd: totals.total_cost_usd,
|
|
154
|
+
total_cost_brl: totals.total_cost_brl,
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
data_source: "sqlite_read_model" as const,
|
|
158
|
+
view,
|
|
159
|
+
offset,
|
|
160
|
+
limit,
|
|
161
|
+
total_count: rows.length,
|
|
162
|
+
has_more: offset + page.length < rows.length,
|
|
163
|
+
totals: publicTotals,
|
|
164
|
+
rows: page,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { developerArtifactCountsCte } from "./sqlite-artifact-counts.js";
|
|
2
|
+
import type { SqliteQueryContext } from "./sqlite-query-context.js";
|
|
3
|
+
import { costMonitorFilterDay, sumKnownDeveloperMetric } from "./sqlite-read-model-canonical.js";
|
|
4
|
+
export function queryDeveloperCostAggregate(
|
|
5
|
+
context: SqliteQueryContext,
|
|
6
|
+
filter: {
|
|
7
|
+
from: string | null;
|
|
8
|
+
to: string | null;
|
|
9
|
+
accountIds?: readonly string[];
|
|
10
|
+
},
|
|
11
|
+
) {
|
|
12
|
+
const from = costMonitorFilterDay(filter.from);
|
|
13
|
+
const to = costMonitorFilterDay(filter.to);
|
|
14
|
+
const clauses = [
|
|
15
|
+
"a.developer_account_id IS NOT NULL",
|
|
16
|
+
"(? IS NULL OR a.occurred_day_sp >= ?)",
|
|
17
|
+
"(? IS NULL OR a.occurred_day_sp <= ?)",
|
|
18
|
+
];
|
|
19
|
+
const values: Array<string | null> = [from, from, to, to];
|
|
20
|
+
if (filter.accountIds !== undefined && filter.accountIds.length > 0) {
|
|
21
|
+
clauses.push(`a.developer_account_id IN (${filter.accountIds.map(() => "?").join(",")})`);
|
|
22
|
+
values.push(...filter.accountIds);
|
|
23
|
+
}
|
|
24
|
+
const where = clauses.join(" AND ");
|
|
25
|
+
const rows = context.database
|
|
26
|
+
.prepare(`
|
|
27
|
+
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where}), completed AS (
|
|
28
|
+
SELECT a.developer_account_id, COUNT(DISTINCT w.id) AS completed_task_count
|
|
29
|
+
FROM zaip_vw_canonical_work_items w JOIN selected a ON a.run_id=w.completed_run_id
|
|
30
|
+
WHERE w.entity_kind='task' AND w.status='completed' GROUP BY a.developer_account_id
|
|
31
|
+
) ${developerArtifactCountsCte()}
|
|
32
|
+
SELECT a.developer_account_id AS account_id, MAX(a.developer_login) AS login_snapshot,
|
|
33
|
+
CASE WHEN COUNT(DISTINCT a.developer_attribution_source)=1 THEN MAX(a.developer_attribution_source) ELSE 'mixed' END AS attribution_source,
|
|
34
|
+
COUNT(DISTINCT a.prd_id) AS prd_count, COUNT(DISTINCT a.spec_id) AS spec_count,
|
|
35
|
+
COUNT(DISTINCT a.task_id) AS task_count, COUNT(*) AS run_count,
|
|
36
|
+
COALESCE(artifacts.test_count, 0) AS test_count,
|
|
37
|
+
COALESCE(artifacts.evidence_count, 0) AS evidence_count,
|
|
38
|
+
SUM(a.attributed_token_active_ms) AS total_duration_ms,
|
|
39
|
+
COUNT(a.attributed_token_active_ms) AS duration_covered_runs,
|
|
40
|
+
SUM(a.source_event_count) AS source_event_count,
|
|
41
|
+
SUM(a.total_tokens) AS total_tokens, SUM(a.cost_usd) AS total_cost_usd, SUM(a.cost_brl) AS total_cost_brl,
|
|
42
|
+
COUNT(a.total_tokens) AS token_covered_runs, COUNT(a.cost_usd) AS usd_covered_runs, COUNT(a.cost_brl) AS brl_covered_runs,
|
|
43
|
+
COALESCE(completed.completed_task_count, 0) AS completed_task_count
|
|
44
|
+
FROM selected a
|
|
45
|
+
LEFT JOIN completed USING(developer_account_id)
|
|
46
|
+
LEFT JOIN artifacts USING(developer_account_id)
|
|
47
|
+
GROUP BY a.developer_account_id ORDER BY total_cost_brl DESC, account_id`)
|
|
48
|
+
.all(...values, from, from, to, to) as Array<Record<string, unknown>>;
|
|
49
|
+
// A delivery is factual only when the canonical Task points at the exact
|
|
50
|
+
// completed Run. Contributors are the distinct attributed GitHub accounts
|
|
51
|
+
// on that same Run; no timestamp, commit, or deployment inference enters.
|
|
52
|
+
const delivered = context.database
|
|
53
|
+
.prepare(`
|
|
54
|
+
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where})
|
|
55
|
+
SELECT selected.developer_account_id AS delivered_by_account_id, w.id, w.title, w.status, w.completed_run_id,
|
|
56
|
+
GROUP_CONCAT(DISTINCT contributor.developer_account_id || char(31) || COALESCE(contributor.developer_login, '')) AS contributor_pairs
|
|
57
|
+
FROM zaip_vw_canonical_work_items w
|
|
58
|
+
JOIN selected ON selected.run_id=w.completed_run_id
|
|
59
|
+
LEFT JOIN zaip_vw_activities contributor ON contributor.task_id=w.id
|
|
60
|
+
AND contributor.developer_account_id IS NOT NULL
|
|
61
|
+
WHERE w.entity_kind='task' AND w.status='completed'
|
|
62
|
+
GROUP BY selected.developer_account_id, w.id, w.title, w.status, w.completed_run_id
|
|
63
|
+
ORDER BY w.id`)
|
|
64
|
+
.all(...values) as Array<Record<string, unknown>>;
|
|
65
|
+
const deliveriesByAccount = new Map<string, Array<Record<string, unknown>>>();
|
|
66
|
+
for (const task of delivered) {
|
|
67
|
+
const accountId = String(task.delivered_by_account_id);
|
|
68
|
+
const list = deliveriesByAccount.get(accountId) ?? [];
|
|
69
|
+
list.push({
|
|
70
|
+
id: task.id,
|
|
71
|
+
title: task.title,
|
|
72
|
+
status: task.status,
|
|
73
|
+
completed_run_id: task.completed_run_id,
|
|
74
|
+
delivered_by: { account_id: accountId },
|
|
75
|
+
contributors: String(task.contributor_pairs ?? "")
|
|
76
|
+
.split(",")
|
|
77
|
+
.filter(Boolean)
|
|
78
|
+
.map((pair) => {
|
|
79
|
+
const [account_id, login_snapshot] = pair.split(String.fromCharCode(31));
|
|
80
|
+
return { account_id, login_snapshot: login_snapshot || null };
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
deliveriesByAccount.set(accountId, list);
|
|
84
|
+
}
|
|
85
|
+
const qualificationForSource: Record<
|
|
86
|
+
string,
|
|
87
|
+
"verified" | "cached_fallback" | "human_assigned" | "mixed"
|
|
88
|
+
> = {
|
|
89
|
+
verified_local_account: "verified",
|
|
90
|
+
cached_fallback: "cached_fallback",
|
|
91
|
+
human_assigned: "human_assigned",
|
|
92
|
+
mixed: "mixed",
|
|
93
|
+
};
|
|
94
|
+
for (const row of rows) {
|
|
95
|
+
row.completed_tasks = deliveriesByAccount.get(String(row.account_id)) ?? [];
|
|
96
|
+
row.qualification = qualificationForSource[String(row.attribution_source)] ?? "unqualified";
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
data_source: "sqlite_read_model" as const,
|
|
100
|
+
filters: { from, to, account_ids: filter.accountIds ?? [] },
|
|
101
|
+
rows,
|
|
102
|
+
totals: {
|
|
103
|
+
run_count: rows.reduce((sum, row) => sum + Number(row.run_count ?? 0), 0),
|
|
104
|
+
completed_task_count: rows.reduce(
|
|
105
|
+
(sum, row) => sum + Number(row.completed_task_count ?? 0),
|
|
106
|
+
0,
|
|
107
|
+
),
|
|
108
|
+
total_cost_usd: sumKnownDeveloperMetric(rows, "total_cost_usd"),
|
|
109
|
+
total_cost_brl: sumKnownDeveloperMetric(rows, "total_cost_brl"),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function queryOperationsDeveloperAggregate(
|
|
114
|
+
context: SqliteQueryContext,
|
|
115
|
+
filter: {
|
|
116
|
+
from: string | null;
|
|
117
|
+
to: string | null;
|
|
118
|
+
accountIds?: readonly string[];
|
|
119
|
+
},
|
|
120
|
+
) {
|
|
121
|
+
const from = costMonitorFilterDay(filter.from);
|
|
122
|
+
const to = costMonitorFilterDay(filter.to);
|
|
123
|
+
const clauses = [
|
|
124
|
+
"a.developer_account_id IS NOT NULL",
|
|
125
|
+
"(? IS NULL OR a.occurred_day_sp >= ?)",
|
|
126
|
+
"(? IS NULL OR a.occurred_day_sp <= ?)",
|
|
127
|
+
];
|
|
128
|
+
const values: Array<string | null> = [from, from, to, to];
|
|
129
|
+
if (filter.accountIds !== undefined && filter.accountIds.length > 0) {
|
|
130
|
+
clauses.push(`a.developer_account_id IN (${filter.accountIds.map(() => "?").join(",")})`);
|
|
131
|
+
values.push(...filter.accountIds);
|
|
132
|
+
}
|
|
133
|
+
const where = clauses.join(" AND ");
|
|
134
|
+
const rows = context.database
|
|
135
|
+
.prepare(`
|
|
136
|
+
WITH selected AS (SELECT * FROM zaip_vw_activities a WHERE ${where}),
|
|
137
|
+
developer_tasks AS (
|
|
138
|
+
SELECT DISTINCT developer_account_id AS account_id, task_id
|
|
139
|
+
FROM selected WHERE task_id IS NOT NULL
|
|
140
|
+
), canonical_task_facts AS (
|
|
141
|
+
SELECT developer_tasks.account_id, work.status, work.entity_kind, work.risk
|
|
142
|
+
FROM developer_tasks JOIN zaip_vw_canonical_work_items work
|
|
143
|
+
ON work.entity_kind='task' AND work.id=developer_tasks.task_id
|
|
144
|
+
), status_counts AS (
|
|
145
|
+
SELECT account_id, json_group_object(status, task_count) AS status_counts_json
|
|
146
|
+
FROM (SELECT account_id, status, COUNT(*) AS task_count FROM canonical_task_facts
|
|
147
|
+
WHERE status IS NOT NULL GROUP BY account_id, status) GROUP BY account_id
|
|
148
|
+
), type_counts AS (
|
|
149
|
+
SELECT account_id, json_group_object(entity_kind, task_count) AS type_counts_json
|
|
150
|
+
FROM (SELECT account_id, entity_kind, COUNT(*) AS task_count FROM canonical_task_facts
|
|
151
|
+
WHERE entity_kind IS NOT NULL GROUP BY account_id, entity_kind) GROUP BY account_id
|
|
152
|
+
), risk_counts AS (
|
|
153
|
+
SELECT account_id, json_group_object(risk, task_count) AS risk_counts_json
|
|
154
|
+
FROM (SELECT account_id, risk, COUNT(*) AS task_count FROM canonical_task_facts
|
|
155
|
+
WHERE risk IS NOT NULL GROUP BY account_id, risk) GROUP BY account_id
|
|
156
|
+
), completed AS (
|
|
157
|
+
SELECT account_id, COUNT(*) AS completed_task_count
|
|
158
|
+
FROM canonical_task_facts WHERE status='completed'
|
|
159
|
+
GROUP BY account_id
|
|
160
|
+
)
|
|
161
|
+
-- task_count is the distinct, observed Task-id population attributed
|
|
162
|
+
-- to this developer in the selected period. Canonical records do not
|
|
163
|
+
-- retain a creator identity, so this projection never infers one.
|
|
164
|
+
SELECT selected.developer_account_id AS account_id, MAX(selected.developer_login) AS login_snapshot,
|
|
165
|
+
COUNT(DISTINCT selected.task_id) AS task_count,
|
|
166
|
+
COALESCE(completed.completed_task_count, 0) AS completed_task_count,
|
|
167
|
+
SUM(selected.attributed_token_active_ms) AS total_duration_ms,
|
|
168
|
+
SUM(selected.total_tokens) AS total_tokens,
|
|
169
|
+
SUM(selected.cost_brl) AS total_cost_brl,
|
|
170
|
+
status_counts.status_counts_json, type_counts.type_counts_json, risk_counts.risk_counts_json
|
|
171
|
+
FROM selected
|
|
172
|
+
LEFT JOIN completed ON completed.account_id=selected.developer_account_id
|
|
173
|
+
LEFT JOIN status_counts ON status_counts.account_id=selected.developer_account_id
|
|
174
|
+
LEFT JOIN type_counts ON type_counts.account_id=selected.developer_account_id
|
|
175
|
+
LEFT JOIN risk_counts ON risk_counts.account_id=selected.developer_account_id
|
|
176
|
+
GROUP BY selected.developer_account_id
|
|
177
|
+
ORDER BY total_cost_brl DESC, account_id`)
|
|
178
|
+
.all(...values) as Array<Record<string, unknown>>;
|
|
179
|
+
const distribution = (value: unknown): Record<string, number> | null => {
|
|
180
|
+
if (typeof value !== "string") return null;
|
|
181
|
+
try {
|
|
182
|
+
const parsed = JSON.parse(value) as Record<string, unknown>;
|
|
183
|
+
return Object.fromEntries(
|
|
184
|
+
Object.entries(parsed).flatMap(([key, count]) =>
|
|
185
|
+
typeof count === "number" && Number.isFinite(count) ? [[key, count]] : [],
|
|
186
|
+
),
|
|
187
|
+
);
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
for (const row of rows) {
|
|
193
|
+
row.status_counts = distribution(row.status_counts_json);
|
|
194
|
+
row.type_counts = distribution(row.type_counts_json);
|
|
195
|
+
row.risk_counts = distribution(row.risk_counts_json);
|
|
196
|
+
delete row.status_counts_json;
|
|
197
|
+
delete row.type_counts_json;
|
|
198
|
+
delete row.risk_counts_json;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
data_source: "sqlite_read_model" as const,
|
|
202
|
+
filters: { from, to, account_ids: filter.accountIds ?? [] },
|
|
203
|
+
rows,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
@@ -170,7 +170,11 @@ export function readEntityGroup(
|
|
|
170
170
|
values.push(input.phase);
|
|
171
171
|
}
|
|
172
172
|
if (input.status) {
|
|
173
|
-
clauses.push(
|
|
173
|
+
clauses.push(
|
|
174
|
+
entity === "specs" || entity === "prds"
|
|
175
|
+
? "COALESCE(entity.status, i.status) = ?"
|
|
176
|
+
: "COALESCE(task_entity.status, i.status) = ?",
|
|
177
|
+
);
|
|
174
178
|
values.push(input.status);
|
|
175
179
|
}
|
|
176
180
|
if (input.risk) {
|
|
@@ -187,9 +191,14 @@ export function readEntityGroup(
|
|
|
187
191
|
? "i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NOT NULL"
|
|
188
192
|
: "i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL",
|
|
189
193
|
);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
if (input.workType) {
|
|
195
|
+
clauses.push("i.work_type = ?");
|
|
196
|
+
values.push(input.workType);
|
|
197
|
+
}
|
|
198
|
+
if (input.priority) {
|
|
199
|
+
clauses.push("task_entity.priority = ?");
|
|
200
|
+
values.push(input.priority);
|
|
201
|
+
}
|
|
193
202
|
const segment: string[] = [];
|
|
194
203
|
if (input.provider) {
|
|
195
204
|
if (input.provider === "unavailable")
|
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts
CHANGED
|
@@ -13,21 +13,6 @@ export function readFilteredDimension(
|
|
|
13
13
|
let periodAverages: ReturnType<typeof sqlitePeriodAverages> | undefined;
|
|
14
14
|
let periodTotals: ReturnType<typeof sqlitePeriodTotals> | undefined;
|
|
15
15
|
|
|
16
|
-
if (temporalCostGroup && input.workType) {
|
|
17
|
-
// No canonical work_type exists at invocation grain, including for
|
|
18
|
-
// duration/Run completion backfills. Do not emit unrelated buckets.
|
|
19
|
-
return {
|
|
20
|
-
data_source: "sqlite_read_model" as const,
|
|
21
|
-
view,
|
|
22
|
-
offset: Math.max(0, input.offset ?? 0),
|
|
23
|
-
limit: Math.min(200, Math.max(1, input.limit ?? 50)),
|
|
24
|
-
total_count: 0,
|
|
25
|
-
has_more: false,
|
|
26
|
-
period_averages: sqlitePeriodAverages([]),
|
|
27
|
-
totals: sqlitePeriodTotals([]),
|
|
28
|
-
rows: [],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
16
|
const groupExpression =
|
|
32
17
|
filteredCostGroup === "day"
|
|
33
18
|
? "date(COALESCE(i.source_started_at, i.source_occurred_at, i.occurred_at), '-3 hours')"
|
|
@@ -87,13 +72,12 @@ export function readFilteredDimension(
|
|
|
87
72
|
values.push(input.phase);
|
|
88
73
|
}
|
|
89
74
|
if (input.status) {
|
|
90
|
-
clauses.push("i.status = ?");
|
|
75
|
+
clauses.push("COALESCE(i.task_status, i.status) = ?");
|
|
91
76
|
values.push(input.status);
|
|
92
77
|
}
|
|
93
78
|
if (input.priority) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
clauses.push("0");
|
|
79
|
+
clauses.push("i.task_priority = ?");
|
|
80
|
+
values.push(input.priority);
|
|
97
81
|
}
|
|
98
82
|
if (input.risk) {
|
|
99
83
|
clauses.push("i.task_risk = ?");
|
|
@@ -110,8 +94,10 @@ export function readFilteredDimension(
|
|
|
110
94
|
: "i.prd_id IS NULL AND i.spec_id IS NULL AND i.task_id IS NULL",
|
|
111
95
|
);
|
|
112
96
|
}
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
if (input.workType) {
|
|
98
|
+
clauses.push("i.work_type = ?");
|
|
99
|
+
values.push(input.workType);
|
|
100
|
+
}
|
|
115
101
|
if (input.query) {
|
|
116
102
|
const pattern = `%${input.query}%`;
|
|
117
103
|
clauses.push(
|
|
@@ -132,7 +118,8 @@ export function readFilteredDimension(
|
|
|
132
118
|
-- Agent Runs, usage_rollup remains available for provider/model
|
|
133
119
|
-- same-segment filtering; historical facts keep their own recorded
|
|
134
120
|
-- provider/model attributes.
|
|
135
|
-
SELECT v.*, v.agent_run_id AS agent_invocation_id, t.risk AS task_risk,
|
|
121
|
+
SELECT v.*, v.agent_run_id AS agent_invocation_id, t.risk AS task_risk, t.status AS task_status,
|
|
122
|
+
t.priority AS task_priority,
|
|
136
123
|
u.provider_group, u.model_group, u.input_tokens, u.cached_input_tokens,
|
|
137
124
|
u.output_tokens, u.reasoning_tokens
|
|
138
125
|
FROM activities v
|
|
@@ -171,7 +158,14 @@ export function readFilteredDimension(
|
|
|
171
158
|
agents: input.agent ? [input.agent] : [],
|
|
172
159
|
phases: input.phase ? [input.phase] : [],
|
|
173
160
|
statuses: input.status ? [input.status] : [],
|
|
161
|
+
priorities: input.priority ? [input.priority] : [],
|
|
162
|
+
risks: input.risk ? [input.risk] : [],
|
|
163
|
+
origins: input.origin ? [input.origin] : [],
|
|
164
|
+
workTypes: input.workType ? [input.workType] : [],
|
|
165
|
+
...(input.query ? { query: input.query } : {}),
|
|
174
166
|
};
|
|
167
|
+
// Duration uses the same canonical Task and Run dimensions as financial
|
|
168
|
+
// facts, preserving measured time when a priority/origin/work filter is set.
|
|
175
169
|
const factualDuration = context.costMonitorFactualDurationByDay(canonicalFilter);
|
|
176
170
|
// Lifecycle counts are canonical facts keyed by their own occurrence
|
|
177
171
|
// date. They deliberately do not inherit financial dimensions.
|
|
@@ -269,9 +263,14 @@ export function readFilteredDimension(
|
|
|
269
263
|
total_run_count: Number(financial.invocation_count ?? 0),
|
|
270
264
|
total_duration:
|
|
271
265
|
durationMatches.length === 0 ||
|
|
272
|
-
durationMatches.
|
|
266
|
+
durationMatches.every(([, duration]) => duration.known_runs === 0)
|
|
273
267
|
? null
|
|
274
268
|
: durationMatches.reduce((sum, [, duration]) => sum + duration.known_sum, 0),
|
|
269
|
+
duration_known: durationMatches.reduce((sum, [, duration]) => sum + duration.known_sum, 0),
|
|
270
|
+
duration_unknown: durationMatches.reduce(
|
|
271
|
+
(sum, [, duration]) => sum + duration.eligible_runs - duration.known_runs,
|
|
272
|
+
0,
|
|
273
|
+
),
|
|
275
274
|
};
|
|
276
275
|
});
|
|
277
276
|
total_count = allRows.length;
|