@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
@@ -59,11 +59,16 @@ export function TaskDetailsDialog({
59
59
  {!summary || hasSummarySpecId ? (
60
60
  <Detail label="SPEC" value={detail.task.spec_id ?? "Task-first"} />
61
61
  ) : null}
62
- {!summary || hasChangeId ? <Detail label="Change" value={detail.task.change_id} /> : null}
62
+ {!summary || hasChangeId ? (
63
+ <Detail label="Change" value={detail.task.change_id} />
64
+ ) : null}
63
65
  {!summary || summaryRunCount !== null ? (
64
66
  <Detail label="Runs" value={String(summary ? summaryRunCount : runs.length)} />
65
67
  ) : null}
66
- <Detail label={copy.duration} value={formatOperationDuration(telemetry.durationMs, locale)} />
68
+ <Detail
69
+ label={copy.duration}
70
+ value={formatOperationDuration(telemetry.durationMs, locale)}
71
+ />
67
72
  <Detail
68
73
  label="Tokens"
69
74
  value={
@@ -137,7 +142,8 @@ function recoverExactTelemetry(runs: readonly OperationsProjection["runs"][numbe
137
142
  );
138
143
  return {
139
144
  durationMs:
140
- rootExecutionRuns.length === 0 || rootExecutionRuns.some((run) => operationalDurationMs(run) === null)
145
+ rootExecutionRuns.length === 0 ||
146
+ rootExecutionRuns.some((run) => operationalDurationMs(run) === null)
141
147
  ? null
142
148
  : rootExecutionRuns.reduce((total, run) => total + (operationalDurationMs(run) ?? 0), 0),
143
149
  tokens:
@@ -13,8 +13,8 @@ import { formatCardCreatedAt } from "./format-card-created-at.js";
13
13
  import { formatRoundedDuration } from "./format-rounded-duration.js";
14
14
  import { MacroPlanningDialog } from "./MacroPlanningDialog.js";
15
15
  import { type OperationsLocale, riskLabel } from "./status-labels.js";
16
- import { TaskDetailsDialog } from "./TaskDetailsDialog.js";
17
16
  import { taskTotals } from "./TaskBoard.js";
17
+ import { TaskDetailsDialog } from "./TaskDetailsDialog.js";
18
18
  import { taskOrigin } from "./task-origin.js";
19
19
  import { useCurrentTime } from "./use-current-time.js";
20
20
  import { useInfiniteColumn } from "./use-infinite-column.js";
@@ -60,7 +60,12 @@ export function UnifiedWorkBoard({
60
60
  allTasks: readonly DashboardTaskProjection[];
61
61
  boardTotals?: Partial<Record<WorkStage, number>> | undefined;
62
62
  boardKindTotals?:
63
- | Partial<Record<WorkStage, { all: number; task: number; prd: number; spec: number }>>
63
+ | Partial<
64
+ Record<
65
+ WorkStage,
66
+ { all: number; task: number; "standalone-task": number; prd: number; spec: number }
67
+ >
68
+ >
64
69
  | undefined;
65
70
  boardStates?: Partial<Record<WorkStage, { loading: boolean; error: string | null }>> | undefined;
66
71
  changes: readonly ChangeProjection[];
@@ -166,7 +171,10 @@ export function UnifiedWorkBoard({
166
171
  totalItems={
167
172
  typeFilter === "all"
168
173
  ? (boardKindTotals?.[stage]?.all ?? boardTotals?.[stage] ?? rows.length)
169
- : typeFilter === "task" || typeFilter === "prd" || typeFilter === "spec"
174
+ : typeFilter === "task" ||
175
+ typeFilter === "standalone-task" ||
176
+ typeFilter === "prd" ||
177
+ typeFilter === "spec"
170
178
  ? (boardKindTotals?.[stage]?.[typeFilter] ?? rows.length)
171
179
  : rows.length
172
180
  }
@@ -244,7 +252,7 @@ export function WorkTypeFilters({
244
252
  all: "Tudo",
245
253
  prd: "PRDs",
246
254
  spec: "SPECs",
247
- "standalone-task": "Tarefas Avulsas",
255
+ "standalone-task": "Tarefa Avulsa",
248
256
  }
249
257
  : {
250
258
  task: "Tasks",
@@ -253,7 +261,7 @@ export function WorkTypeFilters({
253
261
  spec: "SPECs",
254
262
  "standalone-task": "Standalone Tasks",
255
263
  };
256
- const filterOrder: readonly WorkTypeFilter[] = ["all", "task", "prd", "spec"];
264
+ const filterOrder: readonly WorkTypeFilter[] = ["all", "task", "standalone-task", "prd", "spec"];
257
265
  return (
258
266
  <nav
259
267
  aria-label={locale === "pt-BR" ? "Filtrar tipo de trabalho" : "Filter work type"}
@@ -1,6 +1,6 @@
1
- import { describe, expect, it } from "vitest";
2
1
  import { readFileSync } from "node:fs";
3
2
  import { fileURLToPath } from "node:url";
3
+ import { describe, expect, it } from "vitest";
4
4
  import type { DashboardTaskProjection, MacroProjection, RunProjection } from "../contracts.js";
5
5
  import { buildWorkListRows, formatWorkListDuration } from "./UnifiedWorkList.js";
6
6
 
@@ -11,14 +11,18 @@ describe("buildWorkListRows", () => {
11
11
  expect(formatWorkListDuration(0, "cancelled", "pt-BR")).toBe("0 seg");
12
12
  });
13
13
 
14
- it("keeps the operational list to its eight standard columns", () => {
15
- const source = readFileSync(fileURLToPath(new URL("./UnifiedWorkList.tsx", import.meta.url)), "utf8");
14
+ it("keeps the operational list columns including factual developers", () => {
15
+ const source = readFileSync(
16
+ fileURLToPath(new URL("./UnifiedWorkList.tsx", import.meta.url)),
17
+ "utf8",
18
+ );
16
19
  const keys = [...source.matchAll(/key: "([^"]+)"/g)].map((match) => match[1]);
17
- expect(keys.slice(0, 8)).toEqual([
20
+ expect(keys.slice(0, 9)).toEqual([
18
21
  "item",
19
22
  "status",
20
23
  "type",
21
24
  "risk",
25
+ "developers",
22
26
  "progress",
23
27
  "time",
24
28
  "tokens",
@@ -28,16 +32,22 @@ describe("buildWorkListRows", () => {
28
32
  expect(source).toContain('label: "Status"');
29
33
  expect(source).toContain('label: locale === "pt-BR" ? "Tipo" : "Type"');
30
34
  expect(source).toContain('label: locale === "pt-BR" ? "Risco" : "Risk"');
35
+ expect(source).toContain('label: locale === "pt-BR" ? "Desenvolvedor" : "Developer"');
31
36
  expect(source).toContain('label: locale === "pt-BR" ? "Progresso" : "Progress"');
32
37
  expect(source).toContain('label: locale === "pt-BR" ? "Tempo" : "Time"');
33
38
  expect(source).toContain('label: "Tokens"');
34
39
  expect(source).toContain('label: locale === "pt-BR" ? "Custo" : "Cost"');
35
- expect(keys).not.toEqual(expect.arrayContaining(["runs", "lifecycleElapsed", "executions", "tasks", "duration"]));
40
+ expect(keys).not.toEqual(
41
+ expect.arrayContaining(["runs", "lifecycleElapsed", "executions", "tasks", "duration"]),
42
+ );
36
43
  expect(source).not.toContain("taskOriginLabel");
37
44
  });
38
45
 
39
46
  it("propagates the selected type so the server can fetch that canonical collection", () => {
40
- const source = readFileSync(fileURLToPath(new URL("./UnifiedWorkList.tsx", import.meta.url)), "utf8");
47
+ const source = readFileSync(
48
+ fileURLToPath(new URL("./UnifiedWorkList.tsx", import.meta.url)),
49
+ "utf8",
50
+ );
41
51
  expect(source).toContain("onTypeChange?.(kind)");
42
52
  });
43
53
 
@@ -6,12 +6,10 @@ import type {
6
6
  MacroProjection,
7
7
  RunProjection,
8
8
  } from "../contracts.js";
9
+ import { formatDeveloperIdentities } from "./developer-identities.js";
9
10
  import { formatRoundedDuration } from "./format-rounded-duration.js";
10
11
  import { MacroPlanningDialog } from "./MacroPlanningDialog.js";
11
- import {
12
- formatDisplayedDuration,
13
- operationalDurationMs,
14
- } from "./operation-duration.js";
12
+ import { formatDisplayedDuration, operationalDurationMs } from "./operation-duration.js";
15
13
  import { type OperationsLocale, riskLabel } from "./status-labels.js";
16
14
  import { WorkTypeFilters } from "./UnifiedWorkBoard.js";
17
15
  import {
@@ -133,6 +131,18 @@ export function UnifiedWorkList({
133
131
  ),
134
132
  sortValue: ({ risk }) => risk,
135
133
  },
134
+ {
135
+ key: "developers",
136
+ label: locale === "pt-BR" ? "Desenvolvedor" : "Developer",
137
+ render: ({ item }) =>
138
+ formatDeveloperIdentities(
139
+ (item.row as unknown as { developers?: unknown }).developers,
140
+ ),
141
+ sortValue: ({ item }) =>
142
+ formatDeveloperIdentities(
143
+ (item.row as unknown as { developers?: unknown }).developers,
144
+ ),
145
+ },
136
146
  {
137
147
  key: "progress",
138
148
  label: locale === "pt-BR" ? "Progresso" : "Progress",
@@ -40,8 +40,7 @@ export function buildConversationRows(
40
40
  // retain the root conversation_id but legitimately have a Task
41
41
  // entrypoint/task_id and a delivery Execution. Link by the
42
42
  // conversation ID so that continuation is not dropped.
43
- (run) =>
44
- run.conversation_id === id || executionIds.has(run.execution_id ?? ""),
43
+ (run) => run.conversation_id === id || executionIds.has(run.execution_id ?? ""),
45
44
  )
46
45
  .map((run) => [run.id, run]),
47
46
  ).values(),
@@ -0,0 +1,18 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { formatDeveloperIdentities } from "./developer-identities.js";
3
+
4
+ describe("formatDeveloperIdentities", () => {
5
+ it("renders factual multiple identities without coercing objects", () => {
6
+ expect(
7
+ formatDeveloperIdentities([
8
+ { account_id: "199126185", login_snapshot: "zaip-ai" },
9
+ { account_id: "200", login_snapshot: null },
10
+ ]),
11
+ ).toBe("zaip-ai (199126185); 200");
12
+ });
13
+
14
+ it("keeps missing or malformed developer data explicit", () => {
15
+ expect(formatDeveloperIdentities(undefined)).toBe("—");
16
+ expect(formatDeveloperIdentities([{ account_id: 1, login_snapshot: "wrong" }])).toBe("—");
17
+ });
18
+ });
@@ -0,0 +1,30 @@
1
+ export type DeveloperIdentity = Readonly<{
2
+ account_id: string;
3
+ login_snapshot: string | null;
4
+ }>;
5
+
6
+ function isDeveloperIdentity(value: unknown): value is DeveloperIdentity {
7
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
8
+ const row = value as Record<string, unknown>;
9
+ return (
10
+ typeof row.account_id === "string" &&
11
+ (typeof row.login_snapshot === "string" || row.login_snapshot === null)
12
+ );
13
+ }
14
+
15
+ /**
16
+ * The projection preserves the server's factual, account-ordered identities.
17
+ * It deliberately does not fall back to task.owner, which has different semantics.
18
+ */
19
+ export function formatDeveloperIdentities(value: unknown): string {
20
+ if (!Array.isArray(value)) return "—";
21
+ const identities = value.filter(isDeveloperIdentity);
22
+ if (identities.length === 0) return "—";
23
+ return identities
24
+ .map(({ account_id, login_snapshot }) =>
25
+ login_snapshot === null || login_snapshot.length === 0
26
+ ? account_id
27
+ : `${login_snapshot} (${account_id})`,
28
+ )
29
+ .join("; ");
30
+ }
@@ -12,6 +12,7 @@ export interface ExecutionMetricRun {
12
12
  | "observed"
13
13
  | "reconciled"
14
14
  | "legacy_inferred"
15
+ | "shared_creation_allocation"
15
16
  | "estimated"
16
17
  | "unavailable"
17
18
  | undefined;
@@ -1,9 +1,20 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import {
3
+ AGENT_INVOCATION_EXPORT_COLUMNS,
4
+ COMPACT_LIFECYCLE_EXPORT_COLUMNS,
5
+ COST_GROUP_EXPORT_COLUMNS,
6
+ EXECUTION_EXPORT_COLUMNS,
3
7
  EXPORT_SUCCESS_TOAST_MS,
4
- KANBAN_EXPORT_COLUMNS,
8
+ exportAgentInvocationRows,
9
+ exportCompactLifecycleRows,
10
+ exportCostGroupRows,
11
+ exportExecutionRows,
12
+ exportHeadersForView,
5
13
  exportPageSourceRows,
6
14
  exportRowsWithDurationHours,
15
+ exportWorkRows,
16
+ KANBAN_EXPORT_COLUMNS,
17
+ WORK_EXPORT_COLUMNS,
7
18
  } from "./ExcelExportAction.js";
8
19
 
9
20
  describe("ExcelExportAction duration mapper", () => {
@@ -26,6 +37,83 @@ describe("ExcelExportAction duration mapper", () => {
26
37
  },
27
38
  ]);
28
39
  });
40
+
41
+ it("maps populated monthly facts to fixed XLSX columns and retains unavailable values as null", () => {
42
+ expect(
43
+ exportRowsWithDurationHours([
44
+ {
45
+ key: "2026-07",
46
+ prds: 12,
47
+ specs: 58,
48
+ tasksCreated: 648,
49
+ runs: 1419,
50
+ tests: 2,
51
+ evidences: 547,
52
+ durationMs: 7_200_000,
53
+ tokens: 5_490_000_000,
54
+ costBrl: 36_925.24,
55
+ },
56
+ { key: "2026-08", durationMs: null, costBrl: null },
57
+ ]),
58
+ ).toEqual([
59
+ {
60
+ key: "2026-07",
61
+ prds: 12,
62
+ specs: 58,
63
+ tasks: 648,
64
+ runs: 1419,
65
+ tests: 2,
66
+ evidences: 547,
67
+ duration_hours: 2,
68
+ tokens: 5_490_000_000,
69
+ cost: 36_925.24,
70
+ },
71
+ {
72
+ key: "2026-08",
73
+ prds: undefined,
74
+ specs: undefined,
75
+ tasks: undefined,
76
+ runs: undefined,
77
+ tests: undefined,
78
+ evidences: undefined,
79
+ duration_hours: null,
80
+ tokens: undefined,
81
+ cost: null,
82
+ },
83
+ ]);
84
+ });
85
+
86
+ it("maps the canonical annual SQLite aliases into populated period columns", () => {
87
+ expect(
88
+ exportRowsWithDurationHours([
89
+ {
90
+ period_key: "2026",
91
+ prd_count: 13,
92
+ spec_count: 59,
93
+ task_count: 920,
94
+ total_run_count: 1_751,
95
+ validation_count: 17,
96
+ evidence_count: 648,
97
+ operations_total_duration: 619_958_763,
98
+ total_tokens: 7_342_609_361,
99
+ total_cost_brl: 47_588.9452,
100
+ },
101
+ ]),
102
+ ).toEqual([
103
+ {
104
+ key: "2026",
105
+ prds: 13,
106
+ specs: 59,
107
+ tasks: 920,
108
+ runs: 1_751,
109
+ tests: 17,
110
+ evidences: 648,
111
+ duration_hours: 172.2107675,
112
+ tokens: 7_342_609_361,
113
+ cost: 47_588.9452,
114
+ },
115
+ ]);
116
+ });
29
117
  });
30
118
 
31
119
  it("exports every paginated row once instead of only the visible page", async () => {
@@ -52,6 +140,30 @@ it("exports every paginated row once instead of only the visible page", async ()
52
140
  ]);
53
141
  });
54
142
 
143
+ it("exports a complete paginated annual snapshot with factual numeric duration hours", async () => {
144
+ const exported: Record<string, unknown>[] = [];
145
+ for await (const page of exportPageSourceRows({
146
+ totalRows: 3,
147
+ pages: async function* () {
148
+ yield [
149
+ { key: "2026", run_count: 2, duration_ms: 7_200_000 },
150
+ { key: "2025", run_count: 1, duration_ms: null },
151
+ ];
152
+ yield [
153
+ { key: "2025", run_count: 1, duration_ms: null },
154
+ { key: "2024", run_count: 3, duration_ms: 3_600_000 },
155
+ ];
156
+ },
157
+ }))
158
+ exported.push(...exportRowsWithDurationHours(page));
159
+
160
+ expect(exported).toEqual([
161
+ expect.objectContaining({ key: "2026", runs: 2, duration_hours: 2 }),
162
+ expect.objectContaining({ key: "2025", runs: 1, duration_hours: null }),
163
+ expect.objectContaining({ key: "2024", runs: 3, duration_hours: 1 }),
164
+ ]);
165
+ });
166
+
55
167
  it("keeps success feedback duration at four seconds", () => {
56
168
  expect(EXPORT_SUCCESS_TOAST_MS).toBe(4_000);
57
169
  });
@@ -70,12 +182,289 @@ it("uses a prepared total when rows continue beyond the visible first fold", asy
70
182
  expect(prepared.totalRows).toBe(3);
71
183
  });
72
184
 
73
- it("keeps the complete Kanban schema when the visible page has only tasks", () => {
74
- expect(KANBAN_EXPORT_COLUMNS).toEqual(
75
- expect.arrayContaining(["kind", "id", "lifecycle_status", "status", "task_ids", "spec_id"]),
185
+ it("uses the compact work schema for Kanban and Work List", () => {
186
+ expect(KANBAN_EXPORT_COLUMNS).toEqual(WORK_EXPORT_COLUMNS);
187
+ expect(WORK_EXPORT_COLUMNS).toEqual([
188
+ "type",
189
+ "id",
190
+ "title",
191
+ "status",
192
+ "risk",
193
+ "developers",
194
+ "occurred_at",
195
+ "duration_hours",
196
+ "tokens",
197
+ "cost_brl",
198
+ ]);
199
+ });
200
+
201
+ it("normalizes Tasks and macros into the same populated work columns", () => {
202
+ expect(
203
+ exportWorkRows([
204
+ {
205
+ kind: "task",
206
+ id: "TASK-1",
207
+ title: "Export Task",
208
+ status: "executing",
209
+ risk: "standard",
210
+ occurred_at: "2026-08-21T00:00:00.000Z",
211
+ developers: [
212
+ { account_id: "199126185", login_snapshot: "zaip-ai" },
213
+ { account_id: "200", login_snapshot: null },
214
+ ],
215
+ telemetry: { duration_ms: 3_600_000, tokens: 123, cost_brl: 4.5 },
216
+ },
217
+ {
218
+ kind: "spec",
219
+ id: "SPEC-1",
220
+ title: "Export Spec",
221
+ work_status: "planning",
222
+ occurred_at: "2026-08-20T00:00:00.000Z",
223
+ total_duration: 7_200_000,
224
+ total_tokens: 456,
225
+ total_cost_brl: 7.5,
226
+ },
227
+ {
228
+ kind: "prd",
229
+ id: "PRD-1",
230
+ title: "Export PRD",
231
+ status: "ready",
232
+ occurred_at: "2026-08-19T00:00:00.000Z",
233
+ metrics: {
234
+ duration: { known_sum: 10_800_000 },
235
+ total_tokens: { known_sum: 789 },
236
+ cost: { known_sum: 9.5 },
237
+ },
238
+ },
239
+ ]),
240
+ ).toEqual([
241
+ {
242
+ type: "task",
243
+ id: "TASK-1",
244
+ title: "Export Task",
245
+ status: "executing",
246
+ risk: "standard",
247
+ developers: "zaip-ai (199126185); 200",
248
+ occurred_at: "2026-08-21T00:00:00.000Z",
249
+ duration_hours: 1,
250
+ tokens: 123,
251
+ cost_brl: 4.5,
252
+ },
253
+ {
254
+ type: "spec",
255
+ id: "SPEC-1",
256
+ title: "Export Spec",
257
+ status: "planning",
258
+ risk: null,
259
+ developers: "—",
260
+ occurred_at: "2026-08-20T00:00:00.000Z",
261
+ duration_hours: 2,
262
+ tokens: 456,
263
+ cost_brl: 7.5,
264
+ },
265
+ {
266
+ type: "prd",
267
+ id: "PRD-1",
268
+ title: "Export PRD",
269
+ status: "ready",
270
+ risk: null,
271
+ developers: "—",
272
+ occurred_at: "2026-08-19T00:00:00.000Z",
273
+ duration_hours: 3,
274
+ tokens: 789,
275
+ cost_brl: 9.5,
276
+ },
277
+ ]);
278
+ });
279
+
280
+ it("uses populated entity columns for executions instead of period-summary columns", () => {
281
+ expect(EXECUTION_EXPORT_COLUMNS).toEqual([
282
+ "id",
283
+ "kind",
284
+ "status",
285
+ "origin",
286
+ "task_id",
287
+ "conversation_id",
288
+ "created_at",
289
+ "finished_at",
290
+ "duration_hours",
291
+ "tokens",
292
+ "cost_brl",
293
+ "invocations",
294
+ ]);
295
+ expect(
296
+ exportExecutionRows([
297
+ {
298
+ execution_id: "EXEC-42",
299
+ execution_kind: "delivery",
300
+ status: "completed",
301
+ origin_type: "task",
302
+ task_id: "TASK-42",
303
+ started_at: "2026-08-21T00:00:00.000Z",
304
+ finished_at: "2026-08-21T01:00:00.000Z",
305
+ duration_ms: 3_600_000,
306
+ total_tokens: 123,
307
+ total_cost_brl: 4.5,
308
+ invocation_count: 2,
309
+ },
310
+ ]),
311
+ ).toEqual([
312
+ {
313
+ id: "EXEC-42",
314
+ kind: "delivery",
315
+ status: "completed",
316
+ origin: "task",
317
+ task_id: "TASK-42",
318
+ conversation_id: null,
319
+ created_at: "2026-08-21T00:00:00.000Z",
320
+ finished_at: "2026-08-21T01:00:00.000Z",
321
+ duration_hours: 1,
322
+ tokens: 123,
323
+ cost_brl: 4.5,
324
+ invocations: 2,
325
+ },
326
+ ]);
327
+ });
328
+
329
+ it("exports Agent Invocations with populated fields instead of the result fallback", () => {
330
+ expect(AGENT_INVOCATION_EXPORT_COLUMNS).not.toContain("result");
331
+ expect(
332
+ exportAgentInvocationRows([
333
+ {
334
+ run_id: "RUN-42",
335
+ execution_id: "EXEC-42",
336
+ task_id: "TASK-42",
337
+ origin: "task",
338
+ run_role: "orchestrator",
339
+ run_purpose: "execution",
340
+ phase: "execution",
341
+ status: "completed",
342
+ agent: "zaip-agent-task-executor",
343
+ provider: "openai",
344
+ model: "gpt-5.6-terra",
345
+ started_at: "2026-08-21T00:00:00.000Z",
346
+ duration_ms: 3_600_000,
347
+ total_tokens: 123,
348
+ estimated_usd: 0.1,
349
+ estimated_brl: 0.5,
350
+ },
351
+ ]),
352
+ ).toEqual([
353
+ expect.objectContaining({
354
+ run_id: "RUN-42",
355
+ duration_hours: 1,
356
+ total_tokens: 123,
357
+ estimated_usd: 0.1,
358
+ estimated_brl: 0.5,
359
+ }),
360
+ ]);
361
+ });
362
+
363
+ it("exports compact Task, SPEC, PRD, and Conversation rows with entity columns", () => {
364
+ expect(COMPACT_LIFECYCLE_EXPORT_COLUMNS).toEqual([
365
+ "id",
366
+ "title",
367
+ "status",
368
+ "occurred_at",
369
+ "invocations",
370
+ "duration_hours",
371
+ "tokens",
372
+ "cost_brl",
373
+ ]);
374
+ expect(
375
+ exportCompactLifecycleRows([
376
+ {
377
+ id: "TASK-42",
378
+ title: "Export",
379
+ kind: "task",
380
+ status: "completed",
381
+ risk: "standard",
382
+ occurred_at: "2026-08-21T00:00:00.000Z",
383
+ parent_id: null,
384
+ run_count: 2,
385
+ metrics: {
386
+ duration: { known_sum: 3_600_000 },
387
+ total_tokens: { known_sum: 123 },
388
+ cost: { known_sum: 4.5 },
389
+ },
390
+ },
391
+ ]),
392
+ ).toEqual([
393
+ {
394
+ id: "TASK-42",
395
+ title: "Export",
396
+ status: "completed",
397
+ occurred_at: "2026-08-21T00:00:00.000Z",
398
+ invocations: 2,
399
+ duration_hours: 1,
400
+ tokens: 123,
401
+ cost_brl: 4.5,
402
+ },
403
+ ]);
404
+ });
405
+
406
+ it("keeps cost-executions headers and exported row keys in the compact lifecycle schema", () => {
407
+ const source = {
408
+ id: "RUN-42",
409
+ title: "Cost execution",
410
+ status: "completed",
411
+ occurred_at: "2026-08-21T00:00:00.000Z",
412
+ parent_id: "raw-parent-must-not-export",
413
+ raw_duration_ms: 99_999,
414
+ metrics: {
415
+ duration: { known_sum: 3_600_000 },
416
+ total_tokens: { known_sum: 123 },
417
+ cost: { known_sum: 4.5 },
418
+ },
419
+ };
420
+ const rows = exportCompactLifecycleRows([source]);
421
+ expect(exportHeadersForView("cost-executions", [source])).toEqual(
422
+ COMPACT_LIFECYCLE_EXPORT_COLUMNS,
423
+ );
424
+ expect(Object.keys(rows[0] ?? {})).toEqual(COMPACT_LIFECYCLE_EXPORT_COLUMNS);
425
+ });
426
+
427
+ it("does not append raw keys to any explicitly schema-bound Cost view", () => {
428
+ const raw = [{ id: "ROW-1", internal_only: "must-not-be-a-header" }];
429
+ expect(exportHeadersForView("cost-tasks", raw)).toEqual(COMPACT_LIFECYCLE_EXPORT_COLUMNS);
430
+ expect(exportHeadersForView("cost-specs", raw)).toEqual(COMPACT_LIFECYCLE_EXPORT_COLUMNS);
431
+ expect(exportHeadersForView("cost-prds", raw)).toEqual(COMPACT_LIFECYCLE_EXPORT_COLUMNS);
432
+ expect(exportHeadersForView("cost-conversations", raw)).toEqual(COMPACT_LIFECYCLE_EXPORT_COLUMNS);
433
+ expect(exportHeadersForView("cost-agents", raw)).toEqual(COST_GROUP_EXPORT_COLUMNS);
434
+ expect(exportHeadersForView("cost-agent-calls", raw)).toEqual(AGENT_INVOCATION_EXPORT_COLUMNS);
435
+ expect(exportHeadersForView("operations-conversations", raw)).toEqual(
436
+ expect.not.arrayContaining(["internal_only"]),
76
437
  );
77
438
  });
78
439
 
440
+ it("exports model, provider, and ZAIP Agent groups with their populated metrics", () => {
441
+ expect(COST_GROUP_EXPORT_COLUMNS).not.toContain("result");
442
+ expect(
443
+ exportCostGroupRows([
444
+ {
445
+ key: "gpt-5.6-terra",
446
+ label: "gpt-5.6-terra",
447
+ run_count: 3,
448
+ task_count: 1,
449
+ prd_count: 1,
450
+ spec_count: 1,
451
+ total_tokens: 123,
452
+ estimated_usd: 0.1,
453
+ estimated_brl: 0.5,
454
+ duration_ms: 3_600_000,
455
+ },
456
+ ]),
457
+ ).toEqual([
458
+ expect.objectContaining({
459
+ key: "gpt-5.6-terra",
460
+ invocations: 3,
461
+ tokens: 123,
462
+ cost_brl: 0.5,
463
+ duration_hours: 1,
464
+ }),
465
+ ]);
466
+ });
467
+
79
468
  it("clears pending success when a new export starts", () => {
80
469
  expect("running").not.toBe("completed");
81
470
  });