@zaip-ai/cli 1.0.8 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/README.md +1 -1
  2. package/dist/services/adapters.d.ts +1 -1
  3. package/dist/services/adapters.js +1 -1
  4. package/dist/services/agent-adapters.js +3 -3
  5. package/dist/services/agent-adapters.js.map +1 -1
  6. package/dist/services/agent-adapters.test.js +7 -1
  7. package/dist/services/agent-adapters.test.js.map +1 -1
  8. package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
  9. package/dist/services/codex-pre-tool-hook-template.js +89 -7
  10. package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
  11. package/dist/services/codex-rules.d.ts +1 -1
  12. package/dist/services/codex-rules.d.ts.map +1 -1
  13. package/dist/services/codex-rules.js +7 -0
  14. package/dist/services/codex-rules.js.map +1 -1
  15. package/dist/services/install-agents-template.d.ts.map +1 -1
  16. package/dist/services/install-agents-template.js +1 -0
  17. package/dist/services/install-agents-template.js.map +1 -1
  18. package/dist/services/logger.test.js +2 -2
  19. package/dist/services/runtime-template.test.js +31 -7
  20. package/dist/services/runtime-template.test.js.map +1 -1
  21. package/dist/services/template-manifest.d.ts.map +1 -1
  22. package/dist/services/template-manifest.js +12 -3
  23. package/dist/services/template-manifest.js.map +1 -1
  24. package/package.json +1 -1
  25. package/templates/.agents/architecture/software-architecture.md +131 -0
  26. package/templates/.agents/branding/brandbook.docx +0 -0
  27. package/templates/.agents/branding/brandbook.md +60 -0
  28. package/templates/.agents/config/agents/catalog.yaml +7 -7
  29. package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
  30. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
  31. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
  32. package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +8 -8
  33. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +1 -1
  34. package/templates/.agents/dashboard/.tmp-run-list.json +254 -0
  35. package/templates/.agents/dashboard/.zaip-managed.json +457 -173
  36. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-Z60df2r-.js → CostCalculationGuidePage-ovxurkIk.js} +1 -1
  37. package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-BgVgrfhQ.js +2310 -0
  38. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-Coc6pA-1.js → PricingSettingsDialog-vSvvOHQp.js} +1 -1
  39. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BomxqCBU.css +1 -0
  40. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-zH758vfs.js +3 -0
  41. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-DLn-Mz2M.js +1 -0
  42. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-CaKwQP43.css → TraceabilityWorkspace-DvvavDLY.css} +1 -1
  43. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DKwP1stV.js +68 -0
  44. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-PoJA2PI1.css +1 -0
  45. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DFBuc_qp.js → icons-vendor-B_lDDHn1.js} +1 -1
  46. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-B31GMG5O.css +1 -0
  47. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-CZQlsLV9.js +2 -0
  48. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CCQOHdVI.js → react-vendor-B3TJrD4O.js} +1 -1
  49. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-pC2_0J8x.js → traceability-7f1j5wx3.js} +1 -1
  50. package/templates/.agents/dashboard/apps/frontend/dist/index.html +7 -7
  51. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  52. package/templates/.agents/dashboard/apps/frontend/playwright.dom.config.ts +32 -0
  53. package/templates/.agents/dashboard/apps/frontend/src/App.tsx +199 -140
  54. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +0 -21
  55. package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +20 -11
  56. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +14 -7
  57. package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +4 -2
  58. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.dom.e2e.ts +56 -0
  59. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +21 -2
  60. package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +89 -19
  61. package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +19 -4
  62. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +49 -3
  63. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +29 -10
  64. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +4 -4
  65. package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +4 -2
  66. package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +36 -26
  67. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
  68. package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +47 -6
  69. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +59 -9
  70. package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.test.ts +32 -0
  71. package/templates/.agents/dashboard/apps/frontend/src/sqlite-page-export.ts +21 -0
  72. package/templates/.agents/dashboard/apps/frontend/src/styles.css +19 -0
  73. package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.test.ts +32 -0
  74. package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.ts +36 -0
  75. package/templates/.agents/dashboard/apps/frontend/src/traceability-workspace.css +6 -2
  76. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +137 -23
  77. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +229 -35
  78. package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +61 -7
  79. package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +3 -6
  80. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +7 -1
  81. package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.test.ts +163 -0
  82. package/templates/.agents/dashboard/apps/frontend/src/use-app-work-list-page.ts +136 -0
  83. package/templates/.agents/dashboard/apps/frontend/src/use-operations-detail-export.ts +76 -0
  84. package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.test.ts +23 -0
  85. package/templates/.agents/dashboard/apps/frontend/src/work-list-load-dedup.ts +27 -0
  86. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +39 -15
  87. package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +3 -4
  88. package/templates/.agents/dashboard/apps/frontend/vite.config.ts +4 -1
  89. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  90. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +89 -19
  91. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +31 -16
  92. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +43 -14
  93. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +5 -5
  94. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionPanel.tsx +60 -0
  95. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionTable.tsx +191 -0
  96. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.loading.test.ts +14 -0
  97. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.run-page.test.ts +18 -0
  98. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.tsx +18 -3
  99. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +1 -1
  100. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +75 -44
  101. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorLoadErrors.tsx +35 -0
  102. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +162 -40
  103. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +221 -79
  104. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.test.ts +132 -0
  105. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableLoading.tsx +70 -0
  106. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +203 -155
  107. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +164 -125
  108. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-copy.ts +2 -0
  109. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-views.ts +3 -1
  110. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +5 -2
  111. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-page-range.ts +35 -0
  112. package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +2 -2
  113. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +2 -1
  114. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +32 -9
  115. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.test.ts +37 -2
  116. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +131 -9
  117. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +34 -17
  118. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +0 -24
  119. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +225 -424
  120. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +24 -15
  121. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +6 -1
  122. package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-monitor-projection-agents.test.ts +31 -0
  123. package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-summary-projection-duration.test.ts +414 -0
  124. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  125. package/templates/.agents/dashboard/modules/operations/src/contracts.ts +46 -26
  126. package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.test.ts +54 -0
  127. package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.tsx +247 -0
  128. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +31 -11
  129. package/templates/.agents/dashboard/modules/operations/src/react/OperationsMainContent.tsx +39 -13
  130. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +107 -2
  131. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.macro-metrics.test.ts +55 -0
  132. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +23 -29
  133. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +211 -184
  134. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.tsx +127 -0
  135. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +60 -51
  136. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +1 -4
  137. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +3 -0
  138. package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.test.tsx +43 -0
  139. package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.tsx +181 -0
  140. package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +32 -10
  141. package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +9 -3
  142. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +13 -5
  143. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +16 -6
  144. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +14 -4
  145. package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +1 -2
  146. package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.test.ts +18 -0
  147. package/templates/.agents/dashboard/modules/operations/src/react/developer-identities.ts +30 -0
  148. package/templates/.agents/dashboard/modules/operations/src/react/execution-metrics.ts +1 -0
  149. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +393 -4
  150. package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +484 -61
  151. package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +23 -1
  152. package/templates/.agents/dashboard/modules/operations/src/react/export/xlsx-runtime-e2e.test.ts +248 -0
  153. package/templates/.agents/dashboard/modules/operations/src/react/index.ts +1 -0
  154. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +4 -4
  155. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +6 -4
  156. package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +4 -3
  157. package/templates/.agents/dashboard/modules/operations/src/react/operations-date-filters.css +1 -1
  158. package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +4 -1
  159. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +22 -12
  160. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.css +4 -0
  161. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +1 -1
  162. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +53 -6
  163. package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +2 -4
  164. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +82 -6
  165. package/templates/.agents/dashboard/modules/operations/src/react/period-summary.ts +1 -0
  166. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +2 -1
  167. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +1 -1
  168. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +19 -7
  169. package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +4 -1
  170. package/templates/.agents/dashboard/modules/operations/src/server/metric-coverage.ts +1 -0
  171. package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +11 -5
  172. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  173. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  174. package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
  175. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  176. package/templates/.agents/dashboard/packages/contracts/src/index.ts +1 -0
  177. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  178. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +533 -338
  179. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +506 -311
  180. package/templates/.agents/dashboard/packages/local-runtime/gitignore.template +2 -0
  181. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  182. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +15 -7
  183. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +44 -13
  184. package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +8 -3
  185. package/templates/.agents/dashboard/packages/local-runtime/scripts/source-size-runtime-scripts/sqlite-read-model-fixture.mjs +397 -0
  186. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +472 -145
  187. package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +15 -3
  188. package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +141 -33
  189. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +533 -338
  190. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +6 -2
  191. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +3 -3
  192. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +89 -16
  193. package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +33 -16
  194. package/templates/.agents/dashboard/packages/local-runtime/src/server-classification-page.test.ts +87 -0
  195. package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.test.ts +44 -0
  196. package/templates/.agents/dashboard/packages/local-runtime/src/server-period-macro-metric.ts +125 -0
  197. package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +66 -0
  198. package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.test.ts +61 -0
  199. package/templates/.agents/dashboard/packages/local-runtime/src/server-request-authority.ts +18 -0
  200. package/templates/.agents/dashboard/packages/local-runtime/src/server-run-projections.test.ts +42 -0
  201. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +97 -0
  202. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +22 -5
  203. package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-task-trace.ts +91 -0
  204. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +7 -3
  205. package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +36 -0
  206. package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +230 -132
  207. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +224 -182
  208. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-artifact-counts.ts +28 -0
  209. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.test.ts +63 -0
  210. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-agent-page.ts +109 -0
  211. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-aggregates.ts +497 -0
  212. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-fast-page-parity.test-support.ts +65 -0
  213. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.test.ts +176 -0
  214. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-page.ts +119 -0
  215. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.ts +41 -0
  216. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.test.ts +16 -0
  217. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.ts +29 -0
  218. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.ts +355 -0
  219. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-persistence.ts +121 -0
  220. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-timing.ts +27 -0
  221. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +16 -2
  222. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-projection.ts +15 -0
  223. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.test.ts +223 -0
  224. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-operations-work-list.ts +304 -0
  225. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-cache.test-support.ts +23 -0
  226. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +89 -0
  227. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider-fixture.ts +227 -0
  228. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +691 -0
  229. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +81 -0
  230. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1655 -567
  231. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +2168 -1268
  232. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-cache.ts +129 -0
  233. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.test.ts +26 -0
  234. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-install.ts +28 -0
  235. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-seed.test.ts +116 -0
  236. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +146 -0
  237. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.test.mjs +165 -0
  238. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-refresh.mjs +140 -0
  239. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +255 -289
  240. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +94 -88
  241. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  242. package/templates/.agents/dashboard/packages/windows-launcher/Program.cs +5 -2
  243. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  244. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
  245. package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-loading.spec.ts +142 -0
  246. package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-pagination.spec.ts +232 -0
  247. package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +743 -0
  248. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +189 -214
  249. package/templates/.agents/dashboard/zaip-dashboard-windows.exe +0 -0
  250. package/templates/.agents/design/.zaip-managed.json +3 -3
  251. package/templates/.agents/design/apps/catalog/package.json +1 -1
  252. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  253. package/templates/.agents/growth/estrategia-bootstrap-90-dias.md +169 -0
  254. package/templates/.agents/growth/strategy.md +27 -0
  255. package/templates/.agents/marketing/estrategia-marketing-zaip-90-dias.md +197 -0
  256. package/templates/.agents/marketing/strategy.md +29 -0
  257. package/templates/.agents/requirements/autonomous-assurance.md +6 -6
  258. package/templates/.agents/requirements/comparative-audit.md +1 -1
  259. package/templates/.agents/requirements/context-engine.md +1 -1
  260. package/templates/.agents/requirements/cost-observability.md +1 -1
  261. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  262. package/templates/.agents/requirements/data-export.md +1 -1
  263. package/templates/.agents/requirements/design-system.md +1 -1
  264. package/templates/.agents/requirements/execution-engine.md +3 -3
  265. package/templates/.agents/requirements/kanban-dashboard.md +10 -2
  266. package/templates/.agents/requirements/model-orchestration.md +1 -1
  267. package/templates/.agents/requirements/public-distribution.md +1 -1
  268. package/templates/.agents/requirements/software-architecture.md +1 -1
  269. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  270. package/templates/.agents/requirements/work-lifecycle.md +4 -4
  271. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  272. package/templates/.agents/rules/dashboard-ui-consistency.md +14 -0
  273. package/templates/.agents/rules/frontend-lite.md +4 -4
  274. package/templates/.agents/rules/run-lifecycle-closure.md +4 -4
  275. package/templates/.agents/runtime/VERSION +1 -1
  276. package/templates/.agents/runtime/bin/zaip.mjs +1142 -1041
  277. package/templates/.agents/runtime/checksums.sha256 +6 -6
  278. package/templates/.agents/runtime/manifest.json +1 -1
  279. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
  280. package/templates/.agents/runtime/provenance.json +5 -5
  281. package/templates/.agents/runtime/sbom.cdx.json +3 -3
  282. package/templates/.agents/sales/playbook.md +32 -0
  283. package/templates/.agents/sales/roteiro-comercial-zaip.md +252 -0
  284. package/templates/.agents/skills/criar-pasta-obsidian/scripts/generate-obsidian-vault.test.mjs +20 -16
  285. package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
  286. package/templates/.agents/skills/zaip-skill-agent-catalog/SKILL.md +22 -0
  287. package/templates/.agents/skills/zaip-skill-agent-catalog/agents/openai.yaml +4 -0
  288. package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +3 -2
  289. package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +49 -0
  290. package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
  291. package/templates/.agents/skills/zaip-skill-author-skills/scripts/run-skill-tests.mjs +37 -0
  292. package/templates/.agents/skills/zaip-skill-backend/SKILL.md +1 -0
  293. package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +9 -2
  294. package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-framework.md +39 -0
  295. package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +1 -1
  296. package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
  297. package/templates/.agents/skills/zaip-skill-change/references/observable-evidence.md +83 -0
  298. package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/SKILL.md +22 -0
  299. package/templates/.agents/skills/zaip-skill-dashboard-diagnostics/agents/openai.yaml +4 -0
  300. package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +2 -0
  301. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
  302. package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -3
  303. package/templates/.agents/skills/zaip-skill-frontend/agents/openai.yaml +2 -2
  304. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +10 -10
  305. package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +6 -0
  306. package/templates/.agents/skills/zaip-skill-lifecycle-closure/SKILL.md +27 -0
  307. package/templates/.agents/skills/zaip-skill-lifecycle-closure/agents/openai.yaml +4 -0
  308. package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +6 -0
  309. package/templates/.agents/skills/zaip-skill-prd/SKILL.md +4 -0
  310. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +111 -104
  311. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-explicit-recovery.mjs +223 -0
  312. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +55 -9
  313. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +145 -14
  314. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +19 -9
  315. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +82 -5
  316. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/source-size-telemetry/model-identity-reconciliation.mjs +77 -0
  317. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +20 -0
  318. package/templates/.agents/skills/zaip-skill-release-qualification/agents/openai.yaml +4 -0
  319. package/templates/.agents/skills/zaip-skill-review/SKILL.md +5 -0
  320. package/templates/.agents/skills/zaip-skill-rules/SKILL.md +1 -1
  321. package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +6 -0
  322. package/templates/.agents/skills/zaip-skill-spec/SKILL.md +4 -0
  323. package/templates/.agents/skills/zaip-skill-sqlite-read-model/SKILL.md +22 -90
  324. package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +28 -5
  325. package/templates/.agents/zaip-aios/INDEX.md +57 -22
  326. package/templates/.agents/zaip-aios/README.md +24 -13
  327. package/templates/.agents/zaip-aios/VERSION +1 -1
  328. package/templates/.agents/zaip-aios/guides/02-requirements.md +5 -0
  329. package/templates/.agents/zaip-aios/guides/06-execucao.md +13 -4
  330. package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +7 -0
  331. package/templates/.agents/zaip-aios/guides/10-seguranca.md +23 -0
  332. package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +6 -6
  333. package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +3 -0
  334. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +12 -3
  335. package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +5 -5
  336. package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +76 -0
  337. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +95 -0
  338. package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +366 -0
  339. package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +46 -0
  340. package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +74 -0
  341. package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +483 -0
  342. package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +85 -0
  343. package/templates/.agents/zaip-aios/guides/25-fontes-de-precos-openai.md +19 -0
  344. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +111 -0
  345. package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +172 -0
  346. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +149 -0
  347. package/templates/.agents/zaip-aios/guides/assets/diagrams/lifecycles-task-spec-prd.png +0 -0
  348. package/templates/.agents/zaip-aios/guides/assets/diagrams/prd-lifecycle.png +0 -0
  349. package/templates/.agents/zaip-aios/guides/assets/diagrams/spec-lifecycle.png +0 -0
  350. package/templates/.agents/zaip-aios/guides/assets/diagrams/task-lifecycle.png +0 -0
  351. package/templates/template-manifest.json +756 -235
  352. package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-Cs6dzDmW.js +0 -1505
  353. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-QE1k9yZB.css +0 -1
  354. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-_Pf5DA_A.js +0 -3
  355. package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BVlz3DLZ.js +0 -1
  356. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-BZ5WdaMN.css +0 -1
  357. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Cf9ctPVt.js +0 -68
  358. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8A4DcNXM.js +0 -2
  359. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DK_enB5Z.css +0 -1
  360. package/templates/.agents/dashboard/apps/frontend/src/use-idle-cost-prefetch.ts +0 -45
@@ -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
+ });
@@ -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
+ }
@@ -143,7 +143,9 @@ export function ExecutionTable({
143
143
  {
144
144
  durationMs: row.duration_ms,
145
145
  provenance:
146
- row.duration_ms === null && row.status === "running" ? "in_progress" : "factual",
146
+ row.duration_ms === null && row.status === "running"
147
+ ? "in_progress"
148
+ : "factual",
147
149
  },
148
150
  locale,
149
151
  ),
@@ -282,13 +284,21 @@ export function RunTable({
282
284
  value === null || value === undefined ? "—" : formatCurrency(value, "USD", locale);
283
285
  const provenance = (value: RunProjection["duration_provenance"]) =>
284
286
  value === "observed"
285
- ? locale === "pt-BR" ? "Observada" : "Observed"
287
+ ? locale === "pt-BR"
288
+ ? "Observada"
289
+ : "Observed"
286
290
  : value === "reconciled"
287
- ? locale === "pt-BR" ? "Reconciliada" : "Reconciled"
291
+ ? locale === "pt-BR"
292
+ ? "Reconciliada"
293
+ : "Reconciled"
288
294
  : value === "estimated"
289
- ? locale === "pt-BR" ? "Estimada por tokens" : "Token-estimated"
295
+ ? locale === "pt-BR"
296
+ ? "Estimada por tokens"
297
+ : "Token-estimated"
290
298
  : value === "legacy_inferred"
291
- ? locale === "pt-BR" ? "Inferida histórica" : "Legacy inferred"
299
+ ? locale === "pt-BR"
300
+ ? "Inferida histórica"
301
+ : "Legacy inferred"
292
302
  : "—";
293
303
  return (
294
304
  <>
@@ -351,7 +361,9 @@ export function RunTable({
351
361
  render: (row) => (
352
362
  <>
353
363
  <strong>{displayedRunAgent(row)}</strong>
354
- <small>{[row.agent_persona, row.agent_job].filter(Boolean).join(" · ") || "—"}</small>
364
+ <small>
365
+ {[row.agent_persona, row.agent_job].filter(Boolean).join(" · ") || "—"}
366
+ </small>
355
367
  </>
356
368
  ),
357
369
  },
@@ -384,7 +396,7 @@ export function RunTable({
384
396
  ? locale === "pt-BR"
385
397
  ? "Em andamento"
386
398
  : "In progress"
387
- : provenance(row.duration_provenance);
399
+ : provenance(row.duration_provenance);
388
400
  },
389
401
  },
390
402
  {
@@ -462,7 +474,8 @@ export function RunTable({
462
474
  {
463
475
  key: "context_multiplier",
464
476
  label: locale === "pt-BR" ? "Mult. contexto E/S" : "Context mult. I/O",
465
- render: (row) => `${multiplier(row.context_input_multiplier)} / ${multiplier(row.context_output_multiplier)}`,
477
+ render: (row) =>
478
+ `${multiplier(row.context_input_multiplier)} / ${multiplier(row.context_output_multiplier)}`,
466
479
  },
467
480
  {
468
481
  key: "speed_multiplier",
@@ -477,7 +490,7 @@ export function RunTable({
477
490
  ? locale === "pt-BR"
478
491
  ? "Standard (contexto longo)"
479
492
  : "Standard (long context)"
480
- : row.pricing_scenario ?? "—",
493
+ : (row.pricing_scenario ?? "—"),
481
494
  },
482
495
  {
483
496
  key: "input_cost",
@@ -521,7 +534,12 @@ export function RunTable({
521
534
  render: (row) => usd(row.cost_variance_usd),
522
535
  align: "right",
523
536
  },
524
- { key: "fx_rate", label: "USD/BRL", render: (row) => number(row.fx_rate), align: "right" },
537
+ {
538
+ key: "fx_rate",
539
+ label: "USD/BRL",
540
+ render: (row) => number(row.fx_rate),
541
+ align: "right",
542
+ },
525
543
  {
526
544
  key: "cost",
527
545
  label: locale === "pt-BR" ? "Custo total BRL" : "Total cost BRL",
@@ -608,7 +626,9 @@ export function ConversationTable({
608
626
  {
609
627
  durationMs: row.duration_ms,
610
628
  provenance:
611
- row.duration_ms === null && row.status === "running" ? "in_progress" : row.duration_provenance,
629
+ row.duration_ms === null && row.status === "running"
630
+ ? "in_progress"
631
+ : row.duration_provenance,
612
632
  },
613
633
  locale,
614
634
  ),
@@ -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
- <UnifiedWorkList
112
- allSpecs={data.specs}
113
- allTasks={data.tasks}
114
- changes={data.changes}
115
- locale={locale}
116
- onOpenDocument={onOpenDocument}
117
- onOpenTask={onOpenTask}
118
- prds={prds}
119
- runs={data.runs}
120
- specs={specs}
121
- tasks={tasks}
122
- onTypeChange={onWorkListTypeChange}
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" ? (
@@ -36,6 +36,13 @@ export function averageObserved(values: readonly (number | null)[]): number | nu
36
36
  : observed.reduce((total, value) => total + value, 0) / observed.length;
37
37
  }
38
38
 
39
+ export function sumKnownOverviewMetric(values: readonly (number | null)[]): number | null {
40
+ return values.reduce<number | null>(
41
+ (total, value) => (value === null ? total : (total ?? 0) + value),
42
+ null,
43
+ );
44
+ }
45
+
39
46
  export function overviewMetricAverages(
40
47
  totals: { durationMs: number | null; tokens: number | null; costBrl: number | null },
41
48
  selectedCount: number | null,
@@ -50,6 +57,13 @@ export function overviewMetricAverages(
50
57
  };
51
58
  }
52
59
 
60
+ export function taskMetricAverages(
61
+ totals: { durationMs: number | null; tokens: number | null; costBrl: number | null },
62
+ taskCount: number | null,
63
+ ) {
64
+ return overviewMetricAverages(totals, taskCount);
65
+ }
66
+
53
67
  export function findLatestTaskCreatedAt(
54
68
  tasks: readonly Pick<OperationsProjection["tasks"][number], "created_at">[],
55
69
  ): string | null {
@@ -298,7 +312,13 @@ export interface EntityMetric {
298
312
  id: string;
299
313
  title: string;
300
314
  durationMs: number | null;
301
- durationProvenance?: "observed" | "reconciled" | "legacy_inferred" | "estimated" | "unavailable";
315
+ durationProvenance?:
316
+ | "observed"
317
+ | "reconciled"
318
+ | "legacy_inferred"
319
+ | "shared_creation_allocation"
320
+ | "estimated"
321
+ | "unavailable";
302
322
  durationEligible?: number | null;
303
323
  durationKnown?: number | null;
304
324
  tokens: number | null;
@@ -306,6 +326,90 @@ export interface EntityMetric {
306
326
  runCount: number;
307
327
  }
308
328
 
329
+ type OverviewView = "tasks" | "specs" | "prds";
330
+
331
+ export function selectedOverviewCount(
332
+ view: OverviewView,
333
+ overviewMetrics: OperationsProjection["summary"]["overview_metrics"] | undefined,
334
+ fallback: number,
335
+ ): number | null {
336
+ if (view === "specs") return overviewMetrics?.selected_counts?.specs ?? fallback;
337
+ if (view === "prds") return overviewMetrics?.selected_counts?.prds ?? fallback;
338
+ return overviewMetrics?.task_count ?? fallback;
339
+ }
340
+
341
+ export function selectedMacroMetricTotals(entityMetrics: readonly EntityMetric[]) {
342
+ return {
343
+ durationMs: sumKnownOverviewMetric(entityMetrics.map((entity) => entity.durationMs)),
344
+ tokens: sumKnownOverviewMetric(entityMetrics.map((entity) => entity.tokens)),
345
+ costBrl: sumKnownOverviewMetric(entityMetrics.map((entity) => entity.costBrl)),
346
+ };
347
+ }
348
+
349
+ export function scopedOverviewMetric(
350
+ view: OverviewView,
351
+ macroValue: number | null | undefined,
352
+ taskValue: number | null,
353
+ ): number | null {
354
+ return view === "tasks" ? taskValue : (macroValue ?? null);
355
+ }
356
+
357
+ export function canonicalMacroMetric(
358
+ hasCanonicalAggregate: boolean,
359
+ canonicalValue: number | null | undefined,
360
+ fallbackValue: number | null,
361
+ ): number | null {
362
+ return hasCanonicalAggregate ? (canonicalValue ?? null) : fallbackValue;
363
+ }
364
+
365
+ /** Selects currency totals without treating Operations' BRL aggregate as USD. */
366
+ export function resolveOverviewCostTotal({
367
+ currency,
368
+ factualSnapshotTotal,
369
+ macroCostTotal,
370
+ overviewView,
371
+ resolvedRunTotal,
372
+ operationsBrlTotal,
373
+ }: {
374
+ currency: "BRL" | "USD";
375
+ factualSnapshotTotal: number | null | undefined;
376
+ macroCostTotal?: number | null | undefined;
377
+ overviewView?: OverviewView;
378
+ resolvedRunTotal: number | null;
379
+ operationsBrlTotal: number | null;
380
+ }): number | null {
381
+ if (overviewView !== undefined && overviewView !== "tasks") return macroCostTotal ?? null;
382
+ if (factualSnapshotTotal !== null && factualSnapshotTotal !== undefined)
383
+ return factualSnapshotTotal;
384
+ if (resolvedRunTotal !== null) return resolvedRunTotal;
385
+ return currency === "BRL" ? operationsBrlTotal : null;
386
+ }
387
+
388
+ export function partialOverviewMetrics(data: OperationsProjection) {
389
+ return data.summary.overview_metrics;
390
+ }
391
+
392
+ export function runsForOverviewView(
393
+ view: OverviewView,
394
+ tasks: OperationsProjection["tasks"],
395
+ macros: OperationsProjection["specs"] | OperationsProjection["prds"],
396
+ runs: OperationsProjection["runs"],
397
+ ): OperationsProjection["runs"] {
398
+ if (view === "tasks") {
399
+ const taskIds = new Set(tasks.map((task) => task.id));
400
+ return runs.filter((run) => run.task_id !== null && taskIds.has(run.task_id));
401
+ }
402
+ const macroIds = new Set(macros.map((macro) => macro.id));
403
+ const declaredRunIds = new Set(macros.flatMap((macro) => macro.run_ids));
404
+ return runs.filter(
405
+ (run) =>
406
+ declaredRunIds.has(run.id) ||
407
+ (view === "specs"
408
+ ? run.spec_id !== null && macroIds.has(run.spec_id)
409
+ : run.prd_id !== null && macroIds.has(run.prd_id)),
410
+ );
411
+ }
412
+
309
413
  export function summarizeTopTaskMetrics(
310
414
  topTasks: readonly { id: string; durationMs: number | null }[],
311
415
  runs: readonly {
@@ -416,9 +520,10 @@ export function overviewText(locale: OperationsLocale) {
416
520
  } as const;
417
521
  }
418
522
 
419
- export function countExecutionDays(runs: readonly { started_at: string }[]): number {
523
+ export function countExecutionDays(runs: readonly { started_at?: string }[]): number {
420
524
  const days = new Set<string>();
421
525
  for (const run of runs) {
526
+ if (run.started_at === undefined) continue;
422
527
  const date = new Date(run.started_at);
423
528
  if (Number.isNaN(date.getTime())) continue;
424
529
  days.add(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`);