@zaip-ai/cli 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/services/agent-adapters.js +1 -1
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-adapters.test.js +2 -1
- package/dist/services/agent-adapters.test.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.js +89 -7
- package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
- package/dist/services/codex-rules.d.ts +1 -1
- package/dist/services/codex-rules.d.ts.map +1 -1
- package/dist/services/codex-rules.js +7 -0
- package/dist/services/codex-rules.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +1 -0
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/runtime-template.test.js +31 -7
- package/dist/services/runtime-template.test.js.map +1 -1
- package/dist/services/template-manifest.d.ts.map +1 -1
- package/dist/services/template-manifest.js +7 -3
- package/dist/services/template-manifest.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/config/agents/catalog.yaml +7 -7
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +8 -8
- package/templates/.agents/dashboard/.zaip-managed.json +373 -205
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-DxR_pgSV.js → CostCalculationGuidePage-ovxurkIk.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-4jZLTWE_.js → DashboardHelpDialog-BXy6nti1.js} +268 -86
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-CKcsqb-r.js → PricingSettingsDialog-vSvvOHQp.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-DmmJD2Th.js → ProjectSettingsPage-zH758vfs.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-CTH2wDs5.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-CaKwQP43.css → TraceabilityWorkspace-DvvavDLY.css} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DKwP1stV.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-PoJA2PI1.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-C0fj2uU9.js → icons-vendor-B_lDDHn1.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-B31GMG5O.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-CuMcoUni.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-BEsJ-FYH.js → react-vendor-B3TJrD4O.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-B6y6Gw12.js → traceability-7f1j5wx3.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +7 -7
- package/templates/.agents/dashboard/apps/frontend/playwright.dom.config.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +132 -245
- package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +0 -21
- package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +9 -0
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.dom.e2e.ts +56 -0
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +18 -1
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +75 -8
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +25 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +7 -9
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +4 -4
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +7 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +20 -8
- package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.test.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.ts +21 -0
- package/templates/.agents/dashboard/apps/frontend/src/styles.css +19 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.test.ts +32 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +6 -2
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +48 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +31 -27
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +7 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.test.ts +163 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.ts +136 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-operations-detail-export.ts +76 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.test.ts +23 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.ts +27 -0
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +38 -14
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionPanel.tsx +60 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionTable.tsx +191 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.loading.test.ts +14 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.run-page.test.ts +18 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +18 -3
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +8 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorLoadErrors.tsx +35 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +47 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +50 -58
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.test.ts +132 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.tsx +70 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +128 -138
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +17 -67
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +2 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +3 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-page-range.ts +35 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +16 -4
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +37 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +44 -8
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +6 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +20 -3
- package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.test.ts +54 -0
- package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.tsx +247 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +39 -13
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +107 -2
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.macro-metrics.test.ts +55 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +20 -28
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +162 -165
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.tsx +127 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +13 -46
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +3 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.test.tsx +43 -0
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.tsx +181 -0
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +4 -2
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +13 -0
- package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.test.ts +18 -0
- package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.ts +30 -0
- package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +8 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +3 -0
- package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +14 -5
- package/templates/.agents/dashboard/modules/operations/src/react/index.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +4 -3
- package/templates/.agents/dashboard/modules/operations/src/react/operations-date-filters.css +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +21 -11
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.css +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +8 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +1 -0
- package/templates/.agents/dashboard/modules/operations/src/server/metric-coverage.ts +1 -0
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +527 -335
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +501 -309
- package/templates/.agents/dashboard/packages/local-runtime/gitignore.template +2 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +3 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +3 -3
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +25 -15
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +527 -335
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +34 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +15 -8
- package/templates/.agents/dashboard/packages/local-runtime/src/server-classification-page.test.ts +87 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.test.ts +44 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.ts +125 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +66 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.test.ts +61 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.ts +18 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-run-projections.test.ts +42 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +97 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +3 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-task-trace.ts +91 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +36 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +98 -123
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +111 -135
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-artifact-counts.ts +28 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.test.ts +63 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.ts +109 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-aggregates.ts +497 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-fast-page-parity.test-support.ts +65 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.test.ts +176 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.ts +119 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.ts +41 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.test.ts +16 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.ts +29 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.ts +355 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-persistence.ts +121 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-timing.ts +27 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-projection.ts +15 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.test.ts +293 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.ts +371 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-cache.test-support.ts +23 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +89 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider-fixture.ts +227 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +691 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +81 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +440 -863
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +1120 -1086
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-cache.ts +129 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.test.ts +26 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.ts +28 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-seed.test.ts +116 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +146 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.test.mjs +165 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-refresh.mjs +140 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +188 -299
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +51 -70
- package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +5 -2
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
- package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-loading.spec.ts +142 -0
- package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-pagination.spec.ts +232 -0
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +743 -0
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +183 -210
- package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
- package/templates/.agents/requirements/autonomous-assurance.md +6 -6
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +3 -3
- package/templates/.agents/requirements/kanban-dashboard.md +10 -2
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +4 -4
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/dashboard-ui-consistency.md +14 -0
- package/templates/.agents/rules/frontend-lite.md +4 -4
- package/templates/.agents/rules/run-lifecycle-closure.md +4 -4
- package/templates/.agents/runtime/bin/zaip.mjs +1137 -1037
- package/templates/.agents/runtime/checksums.sha256 +2 -2
- package/templates/.agents/runtime/provenance.json +2 -2
- package/templates/.agents/skills/criar-pasta-obsidian/scripts/generate-obsidian-vault.test.mjs +20 -16
- package/templates/.agents/skills/zaip-skill-agent-catalog/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-agent-catalog/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +3 -2
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +49 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/run-skill-tests.mjs +37 -0
- package/templates/.agents/skills/zaip-skill-backend/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-change/references/observable-evidence.md +83 -0
- package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -3
- package/templates/.agents/skills/zaip-skill-frontend/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +10 -10
- package/templates/.agents/skills/zaip-skill-lifecycle-closure/SKILL.md +27 -0
- package/templates/.agents/skills/zaip-skill-lifecycle-closure/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +72 -22
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-explicit-recovery.mjs +223 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +42 -1
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +101 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +53 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +5 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +22 -90
- package/templates/.agents/zaip-aios/INDEX.md +57 -32
- package/templates/.agents/zaip-aios/README.md +22 -12
- package/templates/.agents/zaip-aios/guides/02-requirements.md +5 -0
- package/templates/.agents/zaip-aios/guides/06-execucao.md +13 -4
- package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +7 -0
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +23 -0
- package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +6 -6
- package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +3 -0
- package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +12 -3
- package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +5 -5
- package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +23 -0
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +44 -8
- package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +8 -14
- package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +5 -0
- package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +6 -6
- package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +8 -8
- package/templates/.agents/zaip-aios/guides/25-fontes-de-precos-openai.md +3 -2
- package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +92 -10
- package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +8 -3
- package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +5 -0
- package/templates/template-manifest.json +555 -170
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BwtitWa_.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-N5Csr0RP.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-C4aIB1PV.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +0 -45
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs.metafile.json +0 -7333
|
@@ -48,6 +48,18 @@ export function isCurrentCostGroupPage(resolvedKey: string | null, requestKey: s
|
|
|
48
48
|
return resolvedKey === requestKey;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* A changed offset may keep its own tab's data visible, but switching tabs,
|
|
53
|
+
* ranges, or filters must never briefly render a different table schema.
|
|
54
|
+
*/
|
|
55
|
+
export function isSameCostGroupSurface(resolvedKey: string | null, requestKey: string): boolean {
|
|
56
|
+
if (resolvedKey === null) return false;
|
|
57
|
+
return (
|
|
58
|
+
resolvedKey.slice(0, resolvedKey.lastIndexOf("\u0000")) ===
|
|
59
|
+
requestKey.slice(0, requestKey.lastIndexOf("\u0000"))
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
export function costGroupPageLabel({
|
|
52
64
|
locale,
|
|
53
65
|
page,
|
|
@@ -80,15 +92,19 @@ export function reconcileCostGroupTotalsWithCards(
|
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
export function useCostGroupPage({
|
|
95
|
+
active = true,
|
|
83
96
|
view,
|
|
84
97
|
range,
|
|
85
98
|
globalQuery,
|
|
99
|
+
limit = 50,
|
|
86
100
|
filters,
|
|
87
101
|
load,
|
|
88
102
|
}: {
|
|
103
|
+
active?: boolean;
|
|
89
104
|
view: "daily" | "monthly" | "annual" | "agents" | "models" | "providers";
|
|
90
105
|
range?: { from: string; to: string };
|
|
91
106
|
globalQuery: string;
|
|
107
|
+
limit?: number;
|
|
92
108
|
filters: CostGroupFilters;
|
|
93
109
|
load?: LoadCostGroupPage;
|
|
94
110
|
}) {
|
|
@@ -96,31 +112,42 @@ export function useCostGroupPage({
|
|
|
96
112
|
const [page, setPage] = useState<CostGroupPage | null>(null);
|
|
97
113
|
const [resolvedKey, setResolvedKey] = useState<string | null>(null);
|
|
98
114
|
const [loading, setLoading] = useState(false);
|
|
115
|
+
const [error, setError] = useState<string | null>(null);
|
|
116
|
+
const [attempt, setAttempt] = useState(0);
|
|
99
117
|
const generation = useRef(0);
|
|
100
118
|
const loader = useRef(load);
|
|
101
119
|
loader.current = load;
|
|
102
120
|
const query = effectiveCostGroupQuery(filters, globalQuery);
|
|
103
121
|
const filterKey = `${Object.values(filters).join("\u0000")}\u0000${query}`;
|
|
104
|
-
const paginationKey = `${view}\u0000${range?.from ?? ""}\u0000${range?.to ?? ""}\u0000${filterKey}`;
|
|
122
|
+
const paginationKey = `${view}\u0000${limit}\u0000${range?.from ?? ""}\u0000${range?.to ?? ""}\u0000${filterKey}`;
|
|
105
123
|
const requestKey = `${paginationKey}\u0000${offset}`;
|
|
106
|
-
const requestInputRef = useRef({ filters, query, range, view });
|
|
107
|
-
requestInputRef.current = { filters, query, range, view };
|
|
124
|
+
const requestInputRef = useRef({ filters, limit, query, range, view });
|
|
125
|
+
requestInputRef.current = { filters, limit, query, range, view };
|
|
108
126
|
useEffect(() => {
|
|
109
127
|
void paginationKey;
|
|
110
128
|
setOffset(0);
|
|
111
129
|
}, [paginationKey]);
|
|
112
130
|
useEffect(() => {
|
|
113
|
-
|
|
114
|
-
|
|
131
|
+
void attempt;
|
|
132
|
+
// Increment before the inactive branch so an aborted group request cannot
|
|
133
|
+
// publish or clear state after the user switches to a non-group tab.
|
|
115
134
|
const current = ++generation.current;
|
|
135
|
+
if (!active || !loader.current) {
|
|
136
|
+
setPage(null);
|
|
137
|
+
setResolvedKey(null);
|
|
138
|
+
setError(null);
|
|
139
|
+
setLoading(false);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const controller = new AbortController();
|
|
116
143
|
const requestInput = requestInputRef.current;
|
|
117
|
-
const limit = requestInput.view === "daily" ? 30 : 50;
|
|
118
144
|
setLoading(true);
|
|
145
|
+
setError(null);
|
|
119
146
|
void loader
|
|
120
147
|
.current({
|
|
121
148
|
view: requestInput.view,
|
|
122
149
|
offset,
|
|
123
|
-
limit,
|
|
150
|
+
limit: requestInput.limit,
|
|
124
151
|
...(requestInput.query ? { query: requestInput.query } : {}),
|
|
125
152
|
filters: requestInput.filters,
|
|
126
153
|
...(requestInput.range ?? {}),
|
|
@@ -132,15 +159,24 @@ export function useCostGroupPage({
|
|
|
132
159
|
setResolvedKey(requestKey);
|
|
133
160
|
}
|
|
134
161
|
})
|
|
162
|
+
.catch((cause: unknown) => {
|
|
163
|
+
if (!controller.signal.aborted && current === generation.current)
|
|
164
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
165
|
+
})
|
|
135
166
|
.finally(() => {
|
|
136
167
|
if (!controller.signal.aborted && current === generation.current) setLoading(false);
|
|
137
168
|
});
|
|
138
169
|
return () => controller.abort();
|
|
139
|
-
}, [offset, requestKey]);
|
|
170
|
+
}, [active, attempt, offset, requestKey]);
|
|
140
171
|
return {
|
|
172
|
+
error,
|
|
141
173
|
page: isCurrentCostGroupPage(resolvedKey, requestKey) ? page : null,
|
|
174
|
+
// Keep the preceding page only while moving within its own tab. A tab,
|
|
175
|
+
// range, or filter change may have a different row schema.
|
|
176
|
+
stalePage: isSameCostGroupSurface(resolvedKey, requestKey) ? page : null,
|
|
142
177
|
loading,
|
|
143
178
|
offset,
|
|
179
|
+
retry: () => setAttempt((value) => value + 1),
|
|
144
180
|
setOffset,
|
|
145
181
|
};
|
|
146
182
|
}
|
|
@@ -10,6 +10,7 @@ export function useCostRunPage({
|
|
|
10
10
|
currency,
|
|
11
11
|
filters,
|
|
12
12
|
globalQuery,
|
|
13
|
+
limit = 10,
|
|
13
14
|
range,
|
|
14
15
|
refresh,
|
|
15
16
|
load,
|
|
@@ -19,6 +20,7 @@ export function useCostRunPage({
|
|
|
19
20
|
currency: CostCurrency;
|
|
20
21
|
filters: CostFilterState;
|
|
21
22
|
globalQuery: string;
|
|
23
|
+
limit?: number;
|
|
22
24
|
range: { from: string; to: string } | undefined;
|
|
23
25
|
refresh: string | null;
|
|
24
26
|
load: typeof loadCostMonitorRunPage | undefined;
|
|
@@ -35,7 +37,7 @@ export function useCostRunPage({
|
|
|
35
37
|
const rangeTo = range?.to;
|
|
36
38
|
const effectiveFilters = { ...filters, query: filters.query || globalQuery };
|
|
37
39
|
const paginationKey = `${Object.values(effectiveFilters).join("\u0000")}\u0000${rangeFrom ?? ""}\u0000${rangeTo ?? ""}`;
|
|
38
|
-
const requestKey = `${view}\u0000${eligible}\u0000${currency}\u0000${paginationKey}\u0000${refresh ?? ""}`;
|
|
40
|
+
const requestKey = `${view}\u0000${eligible}\u0000${currency}\u0000${limit}\u0000${paginationKey}\u0000${refresh ?? ""}`;
|
|
39
41
|
const requestInputRef = useRef({
|
|
40
42
|
view,
|
|
41
43
|
eligible,
|
|
@@ -44,6 +46,7 @@ export function useCostRunPage({
|
|
|
44
46
|
rangeFrom,
|
|
45
47
|
rangeTo,
|
|
46
48
|
refresh,
|
|
49
|
+
limit,
|
|
47
50
|
});
|
|
48
51
|
requestInputRef.current = {
|
|
49
52
|
view,
|
|
@@ -53,6 +56,7 @@ export function useCostRunPage({
|
|
|
53
56
|
rangeFrom,
|
|
54
57
|
rangeTo,
|
|
55
58
|
refresh,
|
|
59
|
+
limit,
|
|
56
60
|
};
|
|
57
61
|
useEffect(() => {
|
|
58
62
|
void paginationKey;
|
|
@@ -79,6 +83,7 @@ export function useCostRunPage({
|
|
|
79
83
|
? {}
|
|
80
84
|
: { from: requestInput.rangeFrom, to: requestInput.rangeTo }),
|
|
81
85
|
offset,
|
|
86
|
+
limit: requestInput.limit,
|
|
82
87
|
refresh: requestInput.refresh,
|
|
83
88
|
signal: controller.signal,
|
|
84
89
|
})
|
|
@@ -153,7 +153,12 @@ export interface UsageProjection {
|
|
|
153
153
|
rework: UsageMetricProjection;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
export type MetricProvenance =
|
|
156
|
+
export type MetricProvenance =
|
|
157
|
+
| "observed"
|
|
158
|
+
| "reconciled"
|
|
159
|
+
| "legacy_inferred"
|
|
160
|
+
| "shared_creation_allocation"
|
|
161
|
+
| "estimated";
|
|
157
162
|
|
|
158
163
|
export interface MetricCoverageProjection {
|
|
159
164
|
population: number;
|
|
@@ -231,7 +236,13 @@ export interface MacroProjection {
|
|
|
231
236
|
unknown_runs: number;
|
|
232
237
|
coverage_ratio: number;
|
|
233
238
|
};
|
|
234
|
-
duration_provenance?:
|
|
239
|
+
duration_provenance?:
|
|
240
|
+
| "observed"
|
|
241
|
+
| "reconciled"
|
|
242
|
+
| "legacy_inferred"
|
|
243
|
+
| "shared_creation_allocation"
|
|
244
|
+
| "estimated"
|
|
245
|
+
| "unavailable";
|
|
235
246
|
lifecycle_duration_coverage?: NonNullable<MacroProjection["duration_coverage"]>;
|
|
236
247
|
lifecycle_duration_provenance?: MacroProjection["duration_provenance"];
|
|
237
248
|
estimation_basis?: string | null;
|
|
@@ -380,7 +391,13 @@ export interface RunProjection {
|
|
|
380
391
|
finished_at: string | null;
|
|
381
392
|
duration_ms: number | null;
|
|
382
393
|
duration_started_at?: string | null;
|
|
383
|
-
duration_provenance?:
|
|
394
|
+
duration_provenance?:
|
|
395
|
+
| "observed"
|
|
396
|
+
| "reconciled"
|
|
397
|
+
| "legacy_inferred"
|
|
398
|
+
| "shared_creation_allocation"
|
|
399
|
+
| "estimated"
|
|
400
|
+
| "unavailable";
|
|
384
401
|
estimation_basis?: string | null;
|
|
385
402
|
source_started_at?: string | null;
|
|
386
403
|
source_finished_at?: string | null;
|
package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.test.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import {
|
|
6
|
+
type DeveloperAttributionRow,
|
|
7
|
+
DeveloperAttributionTable,
|
|
8
|
+
} from "./DeveloperAttributionPanel.js";
|
|
9
|
+
|
|
10
|
+
const row = (account_id: string): DeveloperAttributionRow => ({
|
|
11
|
+
account_id,
|
|
12
|
+
login_snapshot: `developer-${account_id}`,
|
|
13
|
+
status_counts: { executing: 1 },
|
|
14
|
+
type_counts: { task: 1 },
|
|
15
|
+
risk_counts: { standard: 1 },
|
|
16
|
+
task_count: 1,
|
|
17
|
+
completed_task_count: 0,
|
|
18
|
+
total_duration_ms: 1,
|
|
19
|
+
total_tokens: 1,
|
|
20
|
+
total_cost_brl: 1,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe("DeveloperAttributionPanel", () => {
|
|
24
|
+
it("renders the canonical ui-table and its pagination for more than ten developers", () => {
|
|
25
|
+
const rows = Array.from({ length: 11 }, (_, index) => row(String(index + 1)));
|
|
26
|
+
const markup = renderToStaticMarkup(
|
|
27
|
+
createElement(DeveloperAttributionTable, { locale: "pt-BR", rows }),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
expect(markup).toContain('class="ui-table"');
|
|
31
|
+
expect(markup).toContain('class="ui-table-pagination"');
|
|
32
|
+
expect(markup).toContain("Página 1 / 2");
|
|
33
|
+
expect(markup).toContain("Desenvolvedor");
|
|
34
|
+
expect(markup).toContain("Tarefas Concluídas");
|
|
35
|
+
expect(markup).toContain("Status");
|
|
36
|
+
expect(markup).toContain("Tipo");
|
|
37
|
+
expect(markup).toContain("Risco");
|
|
38
|
+
expect(markup).not.toContain("Origem");
|
|
39
|
+
expect(markup).not.toContain("Cobertura");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("keeps one accessible shared table with factual columns and explicit states", () => {
|
|
43
|
+
const panel = readFileSync(new URL("./DeveloperAttributionPanel.tsx", import.meta.url), "utf8");
|
|
44
|
+
|
|
45
|
+
expect(panel).toContain("/api/v2/operations/developers");
|
|
46
|
+
expect(panel).toContain("<DataTable");
|
|
47
|
+
expect(panel).toContain("pageSize={10}");
|
|
48
|
+
expect(panel).toContain('role="status"');
|
|
49
|
+
expect(panel).toContain('role="alert"');
|
|
50
|
+
expect(panel).toContain("scrollLabel={copy.caption}");
|
|
51
|
+
expect(panel).toContain("status_counts");
|
|
52
|
+
expect(panel).toContain("completed_task_count");
|
|
53
|
+
});
|
|
54
|
+
});
|
package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.tsx
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { DataTable, formatCompactNumber, formatCurrency } from "@zaip-ai/dashboard-ui";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { formatOperationDuration } from "./operation-duration.js";
|
|
4
|
+
|
|
5
|
+
export type DeveloperAttributionRow = {
|
|
6
|
+
account_id: string;
|
|
7
|
+
login_snapshot: string | null;
|
|
8
|
+
status_counts: Record<string, number> | null;
|
|
9
|
+
type_counts: Record<string, number> | null;
|
|
10
|
+
risk_counts: Record<string, number> | null;
|
|
11
|
+
task_count: number;
|
|
12
|
+
completed_task_count: number;
|
|
13
|
+
total_duration_ms: number | null;
|
|
14
|
+
total_tokens: number | null;
|
|
15
|
+
total_cost_brl: number | null;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type DeveloperCopy = {
|
|
19
|
+
caption: string;
|
|
20
|
+
status: string;
|
|
21
|
+
type: string;
|
|
22
|
+
risk: string;
|
|
23
|
+
loading: string;
|
|
24
|
+
empty: string;
|
|
25
|
+
error: string;
|
|
26
|
+
developer: string;
|
|
27
|
+
cost: string;
|
|
28
|
+
tasks: string;
|
|
29
|
+
completedTasks: string;
|
|
30
|
+
duration: string;
|
|
31
|
+
tokens: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function developerCopy(locale: "pt-BR" | "en-US"): DeveloperCopy {
|
|
35
|
+
return locale === "pt-BR"
|
|
36
|
+
? {
|
|
37
|
+
caption: "Custos e entregas por desenvolvedor",
|
|
38
|
+
loading: "Carregando desenvolvedores…",
|
|
39
|
+
empty: "Nenhum dado disponível.",
|
|
40
|
+
error: "Não foi possível carregar desenvolvedores.",
|
|
41
|
+
developer: "Desenvolvedor",
|
|
42
|
+
status: "Status",
|
|
43
|
+
type: "Tipo",
|
|
44
|
+
risk: "Risco",
|
|
45
|
+
tasks: "Tarefas",
|
|
46
|
+
completedTasks: "Tarefas Concluídas",
|
|
47
|
+
duration: "Tempo",
|
|
48
|
+
tokens: "Tokens",
|
|
49
|
+
cost: "Custo",
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
caption: "Cost and delivery by developer",
|
|
53
|
+
loading: "Loading developers…",
|
|
54
|
+
empty: "No data available.",
|
|
55
|
+
error: "Could not load developers.",
|
|
56
|
+
developer: "Developer",
|
|
57
|
+
status: "Status",
|
|
58
|
+
type: "Type",
|
|
59
|
+
risk: "Risk",
|
|
60
|
+
tasks: "Tasks",
|
|
61
|
+
completedTasks: "Completed Tasks",
|
|
62
|
+
duration: "Time",
|
|
63
|
+
tokens: "Tokens",
|
|
64
|
+
cost: "Cost",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function distributionLabel(value: Record<string, number> | null, locale: "pt-BR" | "en-US") {
|
|
69
|
+
if (value === null || Object.keys(value).length === 0)
|
|
70
|
+
return locale === "pt-BR" ? "Indisponível" : "Unavailable";
|
|
71
|
+
const labels: Record<string, string> =
|
|
72
|
+
locale === "pt-BR"
|
|
73
|
+
? {
|
|
74
|
+
task: "Tarefa",
|
|
75
|
+
"standalone-task": "Tarefa avulsa",
|
|
76
|
+
standard: "Padrão",
|
|
77
|
+
critical: "Crítico",
|
|
78
|
+
lite: "Leve",
|
|
79
|
+
}
|
|
80
|
+
: {
|
|
81
|
+
task: "Task",
|
|
82
|
+
"standalone-task": "Standalone task",
|
|
83
|
+
standard: "Standard",
|
|
84
|
+
critical: "Critical",
|
|
85
|
+
lite: "Lite",
|
|
86
|
+
};
|
|
87
|
+
return Object.entries(value)
|
|
88
|
+
.map(([key, count]) => `${labels[key] ?? key}: ${count}`)
|
|
89
|
+
.join(" · ");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Operations-only table. Distributions are canonical work-item facts, never defaults. */
|
|
93
|
+
export function DeveloperAttributionTable({
|
|
94
|
+
locale,
|
|
95
|
+
rows,
|
|
96
|
+
}: {
|
|
97
|
+
locale: "pt-BR" | "en-US";
|
|
98
|
+
rows: readonly DeveloperAttributionRow[];
|
|
99
|
+
}) {
|
|
100
|
+
const copy = developerCopy(locale);
|
|
101
|
+
return (
|
|
102
|
+
<div className="developer-attribution-table">
|
|
103
|
+
<DataTable
|
|
104
|
+
columns={[
|
|
105
|
+
{
|
|
106
|
+
key: "developer",
|
|
107
|
+
label: copy.developer,
|
|
108
|
+
render: (row) => (
|
|
109
|
+
<>
|
|
110
|
+
<strong>{row.login_snapshot ?? row.account_id}</strong>
|
|
111
|
+
<br />
|
|
112
|
+
<small>#{row.account_id}</small>
|
|
113
|
+
</>
|
|
114
|
+
),
|
|
115
|
+
sortValue: (row) => row.login_snapshot ?? row.account_id,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "status",
|
|
119
|
+
label: copy.status,
|
|
120
|
+
render: (row) => distributionLabel(row.status_counts, locale),
|
|
121
|
+
sortValue: (row) => distributionLabel(row.status_counts, locale),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: "type",
|
|
125
|
+
label: copy.type,
|
|
126
|
+
render: (row) => distributionLabel(row.type_counts, locale),
|
|
127
|
+
sortValue: (row) => distributionLabel(row.type_counts, locale),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "risk",
|
|
131
|
+
label: copy.risk,
|
|
132
|
+
render: (row) => distributionLabel(row.risk_counts, locale),
|
|
133
|
+
sortValue: (row) => distributionLabel(row.risk_counts, locale),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
key: "tasks",
|
|
137
|
+
label: copy.tasks,
|
|
138
|
+
align: "right",
|
|
139
|
+
render: (row) => row.task_count,
|
|
140
|
+
sortValue: (row) => row.task_count,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
key: "completed-tasks",
|
|
144
|
+
label: copy.completedTasks,
|
|
145
|
+
align: "right",
|
|
146
|
+
render: (row) => row.completed_task_count,
|
|
147
|
+
sortValue: (row) => row.completed_task_count,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "duration",
|
|
151
|
+
label: copy.duration,
|
|
152
|
+
align: "right",
|
|
153
|
+
render: (row) => formatOperationDuration(row.total_duration_ms, locale),
|
|
154
|
+
sortValue: (row) => row.total_duration_ms,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: "tokens",
|
|
158
|
+
label: copy.tokens,
|
|
159
|
+
align: "right",
|
|
160
|
+
render: (row) =>
|
|
161
|
+
row.total_tokens === null
|
|
162
|
+
? locale === "pt-BR"
|
|
163
|
+
? "Indisponível"
|
|
164
|
+
: "Unavailable"
|
|
165
|
+
: formatCompactNumber(row.total_tokens, locale),
|
|
166
|
+
sortValue: (row) => row.total_tokens,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
key: "cost",
|
|
170
|
+
label: copy.cost,
|
|
171
|
+
align: "right",
|
|
172
|
+
render: (row) =>
|
|
173
|
+
row.total_cost_brl === null
|
|
174
|
+
? locale === "pt-BR"
|
|
175
|
+
? "Indisponível"
|
|
176
|
+
: "Unavailable"
|
|
177
|
+
: formatCurrency(row.total_cost_brl, "BRL", locale),
|
|
178
|
+
sortValue: (row) => row.total_cost_brl,
|
|
179
|
+
},
|
|
180
|
+
]}
|
|
181
|
+
defaultSort={{ key: "cost", direction: "desc" }}
|
|
182
|
+
emptyMessage={copy.empty}
|
|
183
|
+
locale={locale}
|
|
184
|
+
pageSize={10}
|
|
185
|
+
rowKey={(row) => row.account_id}
|
|
186
|
+
rows={rows}
|
|
187
|
+
scrollLabel={copy.caption}
|
|
188
|
+
sortable
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function DeveloperAttributionPanel({
|
|
195
|
+
from,
|
|
196
|
+
to,
|
|
197
|
+
locale,
|
|
198
|
+
}: {
|
|
199
|
+
from?: string | undefined;
|
|
200
|
+
to?: string | undefined;
|
|
201
|
+
locale: "pt-BR" | "en-US";
|
|
202
|
+
}) {
|
|
203
|
+
const [state, setState] = useState<{
|
|
204
|
+
loading: boolean;
|
|
205
|
+
error: string | null;
|
|
206
|
+
rows: readonly DeveloperAttributionRow[];
|
|
207
|
+
}>({ loading: true, error: null, rows: [] });
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
const controller = new AbortController();
|
|
210
|
+
const params = new URLSearchParams();
|
|
211
|
+
if (from) params.set("from", from);
|
|
212
|
+
if (to) params.set("to", to);
|
|
213
|
+
setState((previous) => ({ ...previous, loading: true, error: null }));
|
|
214
|
+
fetch(`/api/v2/operations/developers${params.size ? `?${params}` : ""}`, {
|
|
215
|
+
signal: controller.signal,
|
|
216
|
+
})
|
|
217
|
+
.then(async (response) => {
|
|
218
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
219
|
+
return response.json() as Promise<{ rows?: DeveloperAttributionRow[] }>;
|
|
220
|
+
})
|
|
221
|
+
.then((payload) => setState({ loading: false, error: null, rows: payload.rows ?? [] }))
|
|
222
|
+
.catch((error: unknown) => {
|
|
223
|
+
if ((error as { name?: string }).name !== "AbortError") {
|
|
224
|
+
setState({
|
|
225
|
+
loading: false,
|
|
226
|
+
error: error instanceof Error ? error.message : "unknown",
|
|
227
|
+
rows: [],
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return () => controller.abort();
|
|
232
|
+
}, [from, to]);
|
|
233
|
+
const copy = developerCopy(locale);
|
|
234
|
+
if (state.loading)
|
|
235
|
+
return (
|
|
236
|
+
<p className="operations-empty" role="status">
|
|
237
|
+
{copy.loading}
|
|
238
|
+
</p>
|
|
239
|
+
);
|
|
240
|
+
if (state.error)
|
|
241
|
+
return (
|
|
242
|
+
<p className="operations-empty" role="alert">
|
|
243
|
+
{copy.error} {state.error}
|
|
244
|
+
</p>
|
|
245
|
+
);
|
|
246
|
+
return <DeveloperAttributionTable locale={locale} rows={state.rows} />;
|
|
247
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "./EntityTables.js";
|
|
10
10
|
import { OperationsEntityPager } from "./OperationsPageNavigation.js";
|
|
11
11
|
import type { OperationsView } from "./operations-page-filters.js";
|
|
12
|
+
import { PagedWorkList, type PagedWorkListRow } from "./PagedWorkList.js";
|
|
12
13
|
import { PeriodSummaryTable } from "./PeriodSummaryTable.js";
|
|
13
14
|
import type { OperationsLocale } from "./status-labels.js";
|
|
14
15
|
import { UnifiedWorkBoard } from "./UnifiedWorkBoard.js";
|
|
@@ -43,6 +44,7 @@ export interface OperationsMainContentProps {
|
|
|
43
44
|
onEntityPageChange?: ((offset: number) => void) | undefined;
|
|
44
45
|
onLoadMoreBoard?: ((stage: WorkStage) => void) | undefined;
|
|
45
46
|
onWorkListTypeChange?: ((kind: WorkTypeFilter) => void) | undefined;
|
|
47
|
+
onWorkListPageChange?: ((offset: number) => void) | undefined;
|
|
46
48
|
onOpenDocument: WorkBoardProps["onOpenDocument"];
|
|
47
49
|
onOpenTask: WorkBoardProps["onOpenTask"];
|
|
48
50
|
onPriorityChange: WorkBoardProps["onPriorityChange"];
|
|
@@ -52,6 +54,18 @@ export interface OperationsMainContentProps {
|
|
|
52
54
|
specs: WorkBoardProps["specs"];
|
|
53
55
|
summaryPopulation: ComponentProps<typeof PeriodSummaryTable>["data"];
|
|
54
56
|
tasks: WorkBoardProps["tasks"];
|
|
57
|
+
workListPage?:
|
|
58
|
+
| {
|
|
59
|
+
offset: number;
|
|
60
|
+
limit: number;
|
|
61
|
+
total: number | null;
|
|
62
|
+
hasMore: boolean;
|
|
63
|
+
typeFilter: WorkTypeFilter;
|
|
64
|
+
rows: readonly PagedWorkListRow[];
|
|
65
|
+
loading: boolean;
|
|
66
|
+
error: string | null;
|
|
67
|
+
}
|
|
68
|
+
| undefined;
|
|
55
69
|
view: OperationsView;
|
|
56
70
|
}
|
|
57
71
|
|
|
@@ -73,6 +87,7 @@ export function OperationsMainContent({
|
|
|
73
87
|
onEntityPageChange,
|
|
74
88
|
onLoadMoreBoard,
|
|
75
89
|
onWorkListTypeChange,
|
|
90
|
+
onWorkListPageChange,
|
|
76
91
|
onOpenDocument,
|
|
77
92
|
onOpenTask,
|
|
78
93
|
onPriorityChange,
|
|
@@ -82,6 +97,7 @@ export function OperationsMainContent({
|
|
|
82
97
|
specs,
|
|
83
98
|
summaryPopulation,
|
|
84
99
|
tasks,
|
|
100
|
+
workListPage,
|
|
85
101
|
view,
|
|
86
102
|
}: OperationsMainContentProps) {
|
|
87
103
|
return (
|
|
@@ -108,19 +124,29 @@ export function OperationsMainContent({
|
|
|
108
124
|
/>
|
|
109
125
|
) : null}
|
|
110
126
|
{view === "work-list" ? (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
workListPage ? (
|
|
128
|
+
<PagedWorkList
|
|
129
|
+
loading={workListPage.loading}
|
|
130
|
+
locale={locale}
|
|
131
|
+
onPageChange={(offset) => onWorkListPageChange?.(offset)}
|
|
132
|
+
onTypeChange={(kind) => onWorkListTypeChange?.(kind)}
|
|
133
|
+
page={workListPage}
|
|
134
|
+
/>
|
|
135
|
+
) : (
|
|
136
|
+
<UnifiedWorkList
|
|
137
|
+
allSpecs={data.specs}
|
|
138
|
+
allTasks={data.tasks}
|
|
139
|
+
changes={data.changes}
|
|
140
|
+
locale={locale}
|
|
141
|
+
onOpenDocument={onOpenDocument}
|
|
142
|
+
onOpenTask={onOpenTask}
|
|
143
|
+
prds={prds}
|
|
144
|
+
runs={data.runs}
|
|
145
|
+
specs={specs}
|
|
146
|
+
tasks={tasks}
|
|
147
|
+
onTypeChange={onWorkListTypeChange}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
124
150
|
) : null}
|
|
125
151
|
{view === "changes" ? <ChangeTable locale={locale} rows={changes} /> : null}
|
|
126
152
|
{view === "executions" ? (
|