@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
@@ -1,9 +1,10 @@
1
- import { describe, expect, it } from "vitest";
2
1
  import { CostRunsTable, matchesCostRunFilter } from "@zaip-ai/dashboard-cost-monitor/react";
2
+ import { describe, expect, it } from "vitest";
3
3
  import {
4
4
  adaptSqliteCompactLifecyclePage,
5
5
  adaptSqliteCostRun,
6
6
  loadSqliteCostGroupPage,
7
+ loadSqliteCostRunPage,
7
8
  } from "./use-app-cost-loaders.js";
8
9
 
9
10
  describe("daily Cost Monitor continuous pagination", () => {
@@ -19,7 +20,16 @@ describe("daily Cost Monitor continuous pagination", () => {
19
20
  total_count: 35,
20
21
  has_more: true,
21
22
  rows: [{ period_key: "2026-08-17" }, { period_key: "2026-07-19" }],
22
- totals: { task_count: 916, prd_count: 13, spec_count: 59, total_run_count: 238, total_duration: 619_920_000, total_tokens: 7_300_000_000, total_cost_usd: 8_731.92, total_cost_brl: 47_589 },
23
+ totals: {
24
+ task_count: 916,
25
+ prd_count: 13,
26
+ spec_count: 59,
27
+ total_run_count: 238,
28
+ total_duration: 619_920_000,
29
+ total_tokens: 7_300_000_000,
30
+ total_cost_usd: 8_731.92,
31
+ total_cost_brl: 47_589,
32
+ },
23
33
  };
24
34
  }
25
35
  return {
@@ -27,12 +37,35 @@ describe("daily Cost Monitor continuous pagination", () => {
27
37
  limit: 30,
28
38
  total_count: 35,
29
39
  has_more: false,
30
- rows: [{ period_key: "2026-07-18", task_count: 2, total_tokens: 10 }, { period_key: "2026-07-14", task_count: 2, total_tokens: 10 }],
31
- totals: { task_count: 916, prd_count: 13, spec_count: 59, total_run_count: 238, total_duration: 619_920_000, total_tokens: 7_300_000_000, total_cost_usd: 8_731.92, total_cost_brl: 47_589 },
40
+ rows: [
41
+ { period_key: "2026-07-18", task_count: 2, total_tokens: 10 },
42
+ { period_key: "2026-07-14", task_count: 2, total_tokens: 10 },
43
+ ],
44
+ totals: {
45
+ task_count: 916,
46
+ prd_count: 13,
47
+ spec_count: 59,
48
+ total_run_count: 238,
49
+ total_duration: 619_920_000,
50
+ total_tokens: 7_300_000_000,
51
+ total_cost_usd: 8_731.92,
52
+ total_cost_brl: 47_589,
53
+ },
32
54
  };
33
55
  },
34
56
  };
35
- const filters = { query: "", provider: "", model: "", agent: "", phase: "", status: "", origin: "", workType: "", priority: "", risk: "" } as never;
57
+ const filters = {
58
+ query: "",
59
+ provider: "",
60
+ model: "",
61
+ agent: "",
62
+ phase: "",
63
+ status: "",
64
+ origin: "",
65
+ workType: "",
66
+ priority: "",
67
+ risk: "",
68
+ } as never;
36
69
  const firstPage = await loadSqliteCostGroupPage(api as never, {
37
70
  view: "daily",
38
71
  from: "2026-07-14",
@@ -51,8 +84,16 @@ describe("daily Cost Monitor continuous pagination", () => {
51
84
  });
52
85
 
53
86
  expect(calls).toEqual([
54
- { view: "cost_monitor_daily", range: { from: "2026-07-14", to: "2026-08-17" }, page: { offset: 0, limit: 30 } },
55
- { view: "cost_monitor_daily", range: { from: "2026-07-14", to: "2026-08-17" }, page: { offset: 30, limit: 30 } },
87
+ {
88
+ view: "cost_monitor_daily",
89
+ range: { from: "2026-07-14", to: "2026-08-17" },
90
+ page: { offset: 0, limit: 30 },
91
+ },
92
+ {
93
+ view: "cost_monitor_daily",
94
+ range: { from: "2026-07-14", to: "2026-08-17" },
95
+ page: { offset: 30, limit: 30 },
96
+ },
56
97
  ]);
57
98
  expect(firstPage).toMatchObject({
58
99
  offset: 0,
@@ -60,7 +101,13 @@ describe("daily Cost Monitor continuous pagination", () => {
60
101
  total_count: 35,
61
102
  has_more: true,
62
103
  rows: [{ key: "2026-08-17" }, { key: "2026-07-19" }],
63
- totals: { task_count: 916, prd_count: 13, spec_count: 59, total_tokens: 7_300_000_000, estimated_brl: 47_589 },
104
+ totals: {
105
+ task_count: 916,
106
+ prd_count: 13,
107
+ spec_count: 59,
108
+ total_tokens: 7_300_000_000,
109
+ estimated_brl: 47_589,
110
+ },
64
111
  });
65
112
  expect(secondPage).toMatchObject({
66
113
  offset: 30,
@@ -102,10 +149,12 @@ describe("adaptSqliteCostRun", () => {
102
149
  currency: "BRL",
103
150
  locale: "pt-BR",
104
151
  });
105
- const multiplier = (table.props.columns as Array<{
106
- key: string;
107
- render: (row: typeof run) => unknown;
108
- }>).find((column) => column.key === "contextMultiplier");
152
+ const multiplier = (
153
+ table.props.columns as Array<{
154
+ key: string;
155
+ render: (row: typeof run) => unknown;
156
+ }>
157
+ ).find((column) => column.key === "contextMultiplier");
109
158
  expect(multiplier?.render(run)).toBe("Indisponível");
110
159
  expect(
111
160
  matchesCostRunFilter(run, {
@@ -157,6 +206,53 @@ describe("adaptSqliteCostRun", () => {
157
206
  });
158
207
  });
159
208
 
209
+ describe("agent invocation remote pagination", () => {
210
+ it("forwards the requested ten-row page instead of expanding it to one hundred", async () => {
211
+ const calls: Array<{ view: string; range: unknown; page: Record<string, unknown> }> = [];
212
+ const api = {
213
+ sqliteViewPage: async (view: string, range: unknown, page: Record<string, unknown>) => {
214
+ calls.push({ view, range, page });
215
+ return {
216
+ offset: 10,
217
+ limit: 10,
218
+ total_count: 24,
219
+ has_more: true,
220
+ rows: [],
221
+ };
222
+ },
223
+ };
224
+
225
+ const loaded = await loadSqliteCostRunPage(api as never, {
226
+ currency: "BRL",
227
+ from: "2026-08-01",
228
+ to: "2026-08-25",
229
+ offset: 10,
230
+ limit: 10,
231
+ filters: {
232
+ query: "agent-builder",
233
+ provider: "openai",
234
+ model: "",
235
+ agent: "",
236
+ phase: "",
237
+ status: "",
238
+ origin: "",
239
+ workType: "",
240
+ priority: "",
241
+ risk: "",
242
+ },
243
+ });
244
+
245
+ expect(calls).toEqual([
246
+ {
247
+ view: "cost_monitor_agent_invocations",
248
+ range: { from: "2026-08-01", to: "2026-08-25" },
249
+ page: { offset: 10, limit: 10, query: "agent-builder", provider: "openai" },
250
+ },
251
+ ]);
252
+ expect(loaded.run_page).toEqual({ offset: 10, limit: 10, total: 24, has_more: true });
253
+ });
254
+ });
255
+
160
256
  describe("adaptSqliteCompactLifecyclePage", () => {
161
257
  it("keeps identical server subtotals on page two for all compact lifecycle views", () => {
162
258
  const sqlitePage = {
@@ -165,22 +261,40 @@ describe("adaptSqliteCompactLifecyclePage", () => {
165
261
  limit: 50,
166
262
  total_count: 270,
167
263
  has_more: true,
168
- totals: { entity_count: 270, invocation_count: 270, total_duration: 270_000, total_tokens: 540, total_cost_usd: 270, total_cost_brl: 1_350 },
169
- rows: Array.from({ length: 50 }, (_, index) => ({ task_id: `TASK-${index}`, invocation_count: 1, total_duration: 1_000, total_tokens: 2, total_cost_brl: 5 })),
264
+ totals: {
265
+ entity_count: 270,
266
+ invocation_count: 270,
267
+ total_duration: 270_000,
268
+ total_tokens: 540,
269
+ total_cost_usd: 270,
270
+ total_cost_brl: 1_350,
271
+ },
272
+ rows: Array.from({ length: 50 }, (_, index) => ({
273
+ task_id: `TASK-${index}`,
274
+ invocation_count: 1,
275
+ total_duration: 1_000,
276
+ total_tokens: 2,
277
+ total_cost_brl: 5,
278
+ })),
170
279
  } as const;
171
- for (const [kind, view] of [["tasks", "cost_monitor_tasks"], ["specs", "cost_monitor_specs"], ["prds", "cost_monitor_prds"], ["conversations", "cost_monitor_conversations"]] as const) {
280
+ for (const [kind, view] of [
281
+ ["tasks", "cost_monitor_tasks"],
282
+ ["specs", "cost_monitor_specs"],
283
+ ["prds", "cost_monitor_prds"],
284
+ ["conversations", "cost_monitor_conversations"],
285
+ ] as const) {
172
286
  const page = adaptSqliteCompactLifecyclePage(kind, { ...sqlitePage, view });
173
287
  expect(page.rows).toHaveLength(50);
174
288
  expect(page.offset).toBe(50);
175
289
  expect(page.subtotal).toEqual({
176
- entity_count: 270,
177
- run_count: { known_sum: 270, unknown: 0, complete: true, coverage_ratio: 1 },
178
- metrics: {
179
- duration: { known_sum: 270_000, unknown: 0, complete: true, coverage_ratio: 1 },
180
- total_tokens: { known_sum: 540, unknown: 0, complete: true, coverage_ratio: 1 },
181
- cost_brl: { known_sum: 1_350, unknown: 0, complete: true, coverage_ratio: 1 },
182
- cost_usd: { known_sum: 270, unknown: 0, complete: true, coverage_ratio: 1 },
183
- },
290
+ entity_count: 270,
291
+ run_count: { known_sum: 270, unknown: 0, complete: true, coverage_ratio: 1 },
292
+ metrics: {
293
+ duration: { known_sum: 270_000, unknown: 0, complete: true, coverage_ratio: 1 },
294
+ total_tokens: { known_sum: 540, unknown: 0, complete: true, coverage_ratio: 1 },
295
+ cost_brl: { known_sum: 1_350, unknown: 0, complete: true, coverage_ratio: 1 },
296
+ cost_usd: { known_sum: 270, unknown: 0, complete: true, coverage_ratio: 1 },
297
+ },
184
298
  });
185
299
  }
186
300
  });
@@ -1,43 +1,153 @@
1
+ import type { CostMonitorProjection } from "@zaip-ai/dashboard-cost-monitor/contracts";
1
2
  import type {
2
- LoadCompactCostPage,
3
3
  CompactLifecycleCostPage,
4
+ LoadCompactCostPage,
4
5
  LoadCostMonitorDetail,
5
6
  LoadCostRunPage,
6
7
  } from "@zaip-ai/dashboard-cost-monitor/react";
7
8
  import { useCallback } from "react";
8
- import type { CostMonitorProjection } from "@zaip-ai/dashboard-cost-monitor/contracts";
9
9
  export type LoadCostGroupPage = import("@zaip-ai/dashboard-cost-monitor/react").LoadCostGroupPage;
10
+
10
11
  import type { DashboardApiClient, SqliteViewPage } from "./dashboard-api.js";
11
- import { costGroupDuration, legacyKnownMetric, nullableSqlNumber, requiredSqlNumber } from "./sqlite-cost-adapters.js";
12
+ import {
13
+ costGroupDuration,
14
+ legacyKnownMetric,
15
+ nullableSqlNumber,
16
+ requiredSqlNumber,
17
+ } from "./sqlite-cost-adapters.js";
12
18
 
13
19
  type CostGroupLoadRequest = Parameters<LoadCostGroupPage>[0];
20
+ type CostRunLoadRequest = Parameters<LoadCostRunPage>[0];
14
21
 
15
22
  function costGroupQueryOptions(request: CostGroupLoadRequest, offset: number, limit: number) {
16
23
  const { filters, query } = request;
17
- return { offset, limit, ...(query === undefined || query === "" ? {} : { query }), ...(filters.provider ? { provider: filters.provider } : {}), ...(filters.model ? { model: filters.model } : {}), ...(filters.agent ? { agent: filters.agent } : {}), ...(filters.phase ? { phase: filters.phase } : {}), ...(filters.status ? { status: filters.status } : {}), ...(filters.origin ? { origin: filters.origin } : {}), ...(filters.workType ? { workType: filters.workType } : {}), ...(filters.priority ? { priority: filters.priority } : {}), ...(filters.risk ? { risk: filters.risk } : {}) };
24
+ return {
25
+ offset,
26
+ limit,
27
+ ...(query === undefined || query === "" ? {} : { query }),
28
+ ...(filters.provider ? { provider: filters.provider } : {}),
29
+ ...(filters.model ? { model: filters.model } : {}),
30
+ ...(filters.agent ? { agent: filters.agent } : {}),
31
+ ...(filters.phase ? { phase: filters.phase } : {}),
32
+ ...(filters.status ? { status: filters.status } : {}),
33
+ ...(filters.origin ? { origin: filters.origin } : {}),
34
+ ...(filters.workType ? { workType: filters.workType } : {}),
35
+ ...(filters.priority ? { priority: filters.priority } : {}),
36
+ ...(filters.risk ? { risk: filters.risk } : {}),
37
+ };
18
38
  }
19
39
 
20
40
  function adaptSqliteCostGroup(row: Record<string, unknown>) {
21
41
  const duration = costGroupDuration(row);
22
42
  const durationUnknown = Number(row.duration_unknown ?? (duration === null ? 1 : 0));
23
43
  const durationKnown = nullableSqlNumber(row.duration_known) ?? duration ?? 0;
24
- return { key: String(row.key ?? row.period_key ?? "total"), label: String(row.label ?? row.key ?? row.period_key ?? ""), latest_started_at: typeof row.latest_started_at === "string" ? row.latest_started_at : "", persona: typeof row.persona === "string" ? row.persona : null, job: typeof row.job === "string" ? row.job : null, run_count: Number(row.total_run_count ?? row.invocation_count ?? 0), task_count: nullableSqlNumber(row.task_count), prd_count: Number(row.prd_count ?? 0), spec_count: Number(row.spec_count ?? 0), evidence_count: Number(row.evidence_count ?? 0), test_count: Number(row.validation_count ?? 0), event_count: Number(row.source_event_count ?? 0), total_tokens: nullableSqlNumber(row.total_tokens), estimated_usd: nullableSqlNumber(row.total_cost_usd), estimated_brl: nullableSqlNumber(row.total_cost_brl), duration_ms: duration, duration: { known_sum: durationKnown, unknown: durationUnknown, complete: durationUnknown === 0, coverage_ratio: durationUnknown === 0 ? 1 : 0 }, coverage: { events: 0, tokens: 0, usd: 0, brl: 0 } };
44
+ return {
45
+ key: String(row.key ?? row.period_key ?? "total"),
46
+ label: String(row.label ?? row.key ?? row.period_key ?? ""),
47
+ latest_started_at: typeof row.latest_started_at === "string" ? row.latest_started_at : "",
48
+ persona: typeof row.persona === "string" ? row.persona : null,
49
+ job: typeof row.job === "string" ? row.job : null,
50
+ run_count: Number(row.total_run_count ?? row.invocation_count ?? 0),
51
+ task_count: nullableSqlNumber(row.task_count),
52
+ prd_count: Number(row.prd_count ?? 0),
53
+ spec_count: Number(row.spec_count ?? 0),
54
+ evidence_count: Number(row.evidence_count ?? 0),
55
+ test_count: Number(row.validation_count ?? 0),
56
+ event_count: Number(row.source_event_count ?? 0),
57
+ total_tokens: nullableSqlNumber(row.total_tokens),
58
+ estimated_usd: nullableSqlNumber(row.total_cost_usd),
59
+ estimated_brl: nullableSqlNumber(row.total_cost_brl),
60
+ duration_ms: duration,
61
+ duration: {
62
+ known_sum: durationKnown,
63
+ unknown: durationUnknown,
64
+ complete: durationUnknown === 0,
65
+ coverage_ratio: durationUnknown === 0 ? 1 : 0,
66
+ },
67
+ coverage: { events: 0, tokens: 0, usd: 0, brl: 0 },
68
+ };
25
69
  }
26
70
 
27
- export async function loadSqliteCostGroupPage(api: DashboardApiClient, request: CostGroupLoadRequest) {
71
+ export async function loadSqliteCostGroupPage(
72
+ api: DashboardApiClient,
73
+ request: CostGroupLoadRequest,
74
+ ) {
28
75
  const { from, limit, offset, signal, to, view } = request;
29
76
  const selectedRange = from === undefined || to === undefined ? undefined : { from, to };
30
77
  if (view === "daily") {
31
- const page = await api.sqliteViewPage("cost_monitor_daily", selectedRange, costGroupQueryOptions(request, offset, limit), signal);
32
- return { offset: page.offset, limit: page.limit, total_count: page.total_count, has_more: page.has_more, rows: page.rows.map(adaptSqliteCostGroup), ...(page.totals === undefined ? {} : { totals: adaptSqliteCostGroup(page.totals) }) };
78
+ const page = await api.sqliteViewPage(
79
+ "cost_monitor_daily",
80
+ selectedRange,
81
+ costGroupQueryOptions(request, offset, limit),
82
+ signal,
83
+ );
84
+ return {
85
+ offset: page.offset,
86
+ limit: page.limit,
87
+ total_count: page.total_count,
88
+ has_more: page.has_more,
89
+ rows: page.rows.map(adaptSqliteCostGroup),
90
+ ...(page.totals === undefined ? {} : { totals: adaptSqliteCostGroup(page.totals) }),
91
+ };
33
92
  }
34
- const sqlView = ({ monthly: "cost_monitor_monthly", annual: "cost_monitor_annual", agents: "cost_monitor_zaip_agents", models: "cost_monitor_models", providers: "cost_monitor_providers" } as const)[view];
35
- const page = await api.sqliteViewPage(sqlView, selectedRange, costGroupQueryOptions(request, offset, limit), signal);
36
- return { offset: page.offset, limit: page.limit, total_count: page.total_count, has_more: page.has_more, rows: page.rows.map(adaptSqliteCostGroup), ...(page.totals === undefined ? {} : { totals: adaptSqliteCostGroup(page.totals) }) };
93
+ const sqlView = (
94
+ {
95
+ monthly: "cost_monitor_monthly",
96
+ annual: "cost_monitor_annual",
97
+ agents: "cost_monitor_zaip_agents",
98
+ models: "cost_monitor_models",
99
+ providers: "cost_monitor_providers",
100
+ } as const
101
+ )[view];
102
+ const page = await api.sqliteViewPage(
103
+ sqlView,
104
+ selectedRange,
105
+ costGroupQueryOptions(request, offset, limit),
106
+ signal,
107
+ );
108
+ return {
109
+ offset: page.offset,
110
+ limit: page.limit,
111
+ total_count: page.total_count,
112
+ has_more: page.has_more,
113
+ rows: page.rows.map(adaptSqliteCostGroup),
114
+ ...(page.totals === undefined ? {} : { totals: adaptSqliteCostGroup(page.totals) }),
115
+ };
116
+ }
117
+
118
+ export async function loadSqliteCostRunPage(api: DashboardApiClient, request: CostRunLoadRequest) {
119
+ const { filters, from, limit = 10, offset, signal, to } = request;
120
+ const page = await api.sqliteViewPage(
121
+ "cost_monitor_agent_invocations",
122
+ from === undefined || to === undefined ? undefined : { from, to },
123
+ {
124
+ offset,
125
+ limit,
126
+ ...(filters?.query ? { query: filters.query } : {}),
127
+ ...(filters?.provider ? { provider: filters.provider } : {}),
128
+ ...(filters?.model ? { model: filters.model } : {}),
129
+ ...(filters?.agent ? { agent: filters.agent } : {}),
130
+ ...(filters?.phase ? { phase: filters.phase } : {}),
131
+ ...(filters?.status ? { status: filters.status } : {}),
132
+ },
133
+ signal,
134
+ );
135
+ return {
136
+ page_only: true as const,
137
+ runs: page.rows.map(adaptSqliteCostRun),
138
+ run_page: {
139
+ offset: page.offset,
140
+ limit: page.limit,
141
+ total: page.total_count,
142
+ has_more: page.has_more,
143
+ },
144
+ };
37
145
  }
38
146
 
39
147
  /** Adapts a sparse SQLite invocation row to the complete CostRunRow contract. */
40
- export function adaptSqliteCostRun(row: Record<string, unknown>): CostMonitorProjection["runs"][number] {
148
+ export function adaptSqliteCostRun(
149
+ row: Record<string, unknown>,
150
+ ): CostMonitorProjection["runs"][number] {
41
151
  const text = (value: unknown, fallback: string) => (typeof value === "string" ? value : fallback);
42
152
  const nullableNumber = (value: unknown) => (typeof value === "number" ? value : null);
43
153
  const invocationId = text(row.agent_invocation_id, "unavailable");
@@ -46,8 +156,10 @@ export function adaptSqliteCostRun(row: Record<string, unknown>): CostMonitorPro
46
156
  const prdId = typeof row.prd_id === "string" ? row.prd_id : null;
47
157
  const phase = text(row.phase, "execution");
48
158
  const durationProvenance =
49
- row.duration_provenance === "observed" || row.duration_provenance === "reconciled" ||
50
- row.duration_provenance === "estimated" || row.duration_provenance === "legacy_inferred"
159
+ row.duration_provenance === "observed" ||
160
+ row.duration_provenance === "reconciled" ||
161
+ row.duration_provenance === "estimated" ||
162
+ row.duration_provenance === "legacy_inferred"
51
163
  ? row.duration_provenance
52
164
  : "unavailable";
53
165
  const calculatedUsd = Object.hasOwn(row, "calculated_cost_usd")
@@ -80,7 +192,8 @@ export function adaptSqliteCostRun(row: Record<string, unknown>): CostMonitorPro
80
192
  spec_id: specId,
81
193
  prd_id: prdId,
82
194
  change_id: typeof row.change_id === "string" ? row.change_id : null,
83
- parent_run_id: typeof row.parent_agent_invocation_id === "string" ? row.parent_agent_invocation_id : null,
195
+ parent_run_id:
196
+ typeof row.parent_agent_invocation_id === "string" ? row.parent_agent_invocation_id : null,
84
197
  run_role: row.invocation_kind === "subagent" ? "subagent" : "orchestrator",
85
198
  run_kind: row.run_kind === "subrun" ? "subrun" : "run",
86
199
  run_purpose: "execution",
@@ -92,12 +205,14 @@ export function adaptSqliteCostRun(row: Record<string, unknown>): CostMonitorPro
92
205
  model: text(row.model, "unavailable"),
93
206
  requested_model: text(row.requested_model, "unavailable"),
94
207
  reasoning_effort: typeof row.reasoning_effort === "string" ? row.reasoning_effort : null,
95
- effective_reasoning_effort: typeof row.effective_reasoning_effort === "string" ? row.effective_reasoning_effort : null,
208
+ effective_reasoning_effort:
209
+ typeof row.effective_reasoning_effort === "string" ? row.effective_reasoning_effort : null,
96
210
  service_tier: typeof row.service_tier === "string" ? row.service_tier : null,
97
211
  call_count: nullableNumber(row.llm_call_count),
98
212
  status: text(row.status, "completed"),
99
213
  phase,
100
- origin: prdId !== null ? "prd" : specId !== null ? "spec" : taskId !== null ? "task" : "conversation",
214
+ origin:
215
+ prdId !== null ? "prd" : specId !== null ? "spec" : taskId !== null ? "task" : "conversation",
101
216
  work_type: row.work_type === "rework" ? "rework" : "new",
102
217
  started_at: text(row.occurred_at, ""),
103
218
  finished_at: typeof row.finished_at === "string" ? row.finished_at : null,
@@ -146,9 +261,18 @@ export function adaptSqliteCompactLifecyclePage(
146
261
  const totals = page.totals;
147
262
  const subtotalMetric = (key: string) => legacyKnownMetric(totals?.[key]);
148
263
  return {
149
- data_source: "lifecycle_daily_read_models", snapshot_id: null, source_latest_at: null, kind, offset: page.offset, limit: page.limit, total: page.total_count, has_more: page.has_more, next_cursor: null,
264
+ data_source: "lifecycle_daily_read_models",
265
+ snapshot_id: null,
266
+ source_latest_at: null,
267
+ kind,
268
+ offset: page.offset,
269
+ limit: page.limit,
270
+ total: page.total_count,
271
+ has_more: page.has_more,
272
+ next_cursor: null,
150
273
  subtotal: {
151
- entity_count: typeof totals?.entity_count === "number" ? totals.entity_count : page.total_count,
274
+ entity_count:
275
+ typeof totals?.entity_count === "number" ? totals.entity_count : page.total_count,
152
276
  run_count: subtotalMetric("invocation_count"),
153
277
  metrics: {
154
278
  duration: subtotalMetric("total_duration"),
@@ -157,34 +281,104 @@ export function adaptSqliteCompactLifecyclePage(
157
281
  cost_usd: subtotalMetric("total_cost_usd"),
158
282
  },
159
283
  },
160
- rows: page.rows.map((row) => ({ id: String(row.task_id ?? row.spec_id ?? row.prd_id ?? row.execution_id ?? row.conversation_id ?? row.id ?? "unavailable"), title: String(row.title ?? row.task_id ?? row.spec_id ?? row.prd_id ?? row.execution_id ?? row.conversation_id ?? "Unavailable"), kind: kind === "tasks" ? "task" : kind === "specs" ? "spec" : kind === "prds" ? "prd" : kind === "executions" ? "execution" : "conversation", status: typeof row.status === "string" ? row.status : null, risk: typeof row.risk === "string" ? row.risk : null, occurred_at: typeof row.occurred_at === "string" ? row.occurred_at : typeof row.started_at === "string" ? row.started_at : typeof row.last_day === "string" ? `${row.last_day}T12:00:00.000Z` : "", parent_id: null, run_count: Number(row.invocation_count ?? 0), cost_currency: "BRL", metrics: { duration: legacyKnownMetric(row.total_duration), total_tokens: legacyKnownMetric(row.total_tokens), cost: legacyKnownMetric(row.total_cost_brl) } })),
284
+ rows: page.rows.map((row) => ({
285
+ id: String(
286
+ row.task_id ??
287
+ row.spec_id ??
288
+ row.prd_id ??
289
+ row.execution_id ??
290
+ row.conversation_id ??
291
+ row.id ??
292
+ "unavailable",
293
+ ),
294
+ title: String(
295
+ row.title ??
296
+ row.task_id ??
297
+ row.spec_id ??
298
+ row.prd_id ??
299
+ row.execution_id ??
300
+ row.conversation_id ??
301
+ "Unavailable",
302
+ ),
303
+ kind:
304
+ kind === "tasks"
305
+ ? "task"
306
+ : kind === "specs"
307
+ ? "spec"
308
+ : kind === "prds"
309
+ ? "prd"
310
+ : kind === "executions"
311
+ ? "execution"
312
+ : "conversation",
313
+ status: typeof row.status === "string" ? row.status : null,
314
+ risk: typeof row.risk === "string" ? row.risk : null,
315
+ occurred_at:
316
+ typeof row.occurred_at === "string"
317
+ ? row.occurred_at
318
+ : typeof row.started_at === "string"
319
+ ? row.started_at
320
+ : typeof row.last_day === "string"
321
+ ? `${row.last_day}T12:00:00.000Z`
322
+ : "",
323
+ parent_id: null,
324
+ run_count: Number(row.invocation_count ?? 0),
325
+ cost_currency: "BRL",
326
+ metrics: {
327
+ duration: legacyKnownMetric(row.total_duration),
328
+ total_tokens: legacyKnownMetric(row.total_tokens),
329
+ cost: legacyKnownMetric(row.total_cost_brl),
330
+ },
331
+ })),
161
332
  };
162
333
  }
163
334
 
164
335
  export function useAppCostLoaders(api: DashboardApiClient) {
165
- const loadCostDetail = useCallback<LoadCostMonitorDetail>(
166
- async () => { throw new Error("SQLite Cost Monitor loads the selected paginated view; full detail is disabled."); },
167
- [api],
168
- );
336
+ const loadCostDetail = useCallback<LoadCostMonitorDetail>(async () => {
337
+ throw new Error(
338
+ "SQLite Cost Monitor loads the selected paginated view; full detail is disabled.",
339
+ );
340
+ }, []);
169
341
  const loadCostReadModelPage = useCallback<LoadCompactCostPage>(
170
342
  async ({ filters, from, kind, limit, offset, query, signal, to }) => {
171
- const view = ({ tasks: "cost_monitor_tasks", specs: "cost_monitor_specs", prds: "cost_monitor_prds", executions: "cost_monitor_executions", conversations: "cost_monitor_conversations" } as const)[kind];
172
- const page = await api.sqliteViewPage(view, from === undefined || to === undefined ? undefined : { from, to }, { offset, limit, ...(query === undefined || query === "" ? {} : { query }), ...(filters.provider ? { provider: filters.provider } : {}), ...(filters.model ? { model: filters.model } : {}), ...(filters.agent ? { agent: filters.agent } : {}), ...(filters.phase ? { phase: filters.phase } : {}), ...(filters.status ? { status: filters.status } : {}), ...(filters.origin ? { origin: filters.origin } : {}), ...(filters.workType ? { workType: filters.workType } : {}), ...(filters.priority ? { priority: filters.priority } : {}), ...(filters.risk ? { risk: filters.risk } : {}) }, signal);
343
+ const view = (
344
+ {
345
+ tasks: "cost_monitor_tasks",
346
+ specs: "cost_monitor_specs",
347
+ prds: "cost_monitor_prds",
348
+ executions: "cost_monitor_executions",
349
+ conversations: "cost_monitor_conversations",
350
+ } as const
351
+ )[kind];
352
+ const page = await api.sqliteViewPage(
353
+ view,
354
+ from === undefined || to === undefined ? undefined : { from, to },
355
+ {
356
+ offset,
357
+ limit,
358
+ ...(query === undefined || query === "" ? {} : { query }),
359
+ ...(filters.provider ? { provider: filters.provider } : {}),
360
+ ...(filters.model ? { model: filters.model } : {}),
361
+ ...(filters.agent ? { agent: filters.agent } : {}),
362
+ ...(filters.phase ? { phase: filters.phase } : {}),
363
+ ...(filters.status ? { status: filters.status } : {}),
364
+ ...(filters.origin ? { origin: filters.origin } : {}),
365
+ ...(filters.workType ? { workType: filters.workType } : {}),
366
+ ...(filters.priority ? { priority: filters.priority } : {}),
367
+ ...(filters.risk ? { risk: filters.risk } : {}),
368
+ },
369
+ signal,
370
+ );
173
371
  return adaptSqliteCompactLifecyclePage(kind, page);
174
372
  },
175
373
  [api],
176
374
  );
177
375
  const loadCostRunPage = useCallback<LoadCostRunPage>(
178
- async ({ filters, from, offset, signal, to }) => {
179
- const page = await api.sqliteViewPage("cost_monitor_agent_invocations", from === undefined || to === undefined ? undefined : { from, to }, { offset, limit: 100, ...(filters?.query ? { query: filters.query } : {}), ...(filters?.provider ? { provider: filters.provider } : {}), ...(filters?.model ? { model: filters.model } : {}), ...(filters?.agent ? { agent: filters.agent } : {}), ...(filters?.phase ? { phase: filters.phase } : {}), ...(filters?.status ? { status: filters.status } : {}) }, signal);
180
- return {
181
- page_only: true,
182
- runs: page.rows.map(adaptSqliteCostRun),
183
- run_page: { offset: page.offset, limit: page.limit, total: page.total_count, has_more: page.has_more },
184
- };
185
- },
376
+ (request) => loadSqliteCostRunPage(api, request),
377
+ [api],
378
+ );
379
+ const loadCostGroupPage = useCallback<LoadCostGroupPage>(
380
+ (request) => loadSqliteCostGroupPage(api, request),
186
381
  [api],
187
382
  );
188
- const loadCostGroupPage = useCallback<LoadCostGroupPage>((request) => loadSqliteCostGroupPage(api, request), [api]);
189
383
  return { loadCostDetail, loadCostReadModelPage, loadCostRunPage, loadCostGroupPage };
190
384
  }
@@ -1,6 +1,12 @@
1
1
  import type { CostCurrency, CostLocale } from "@zaip-ai/dashboard-cost-monitor/react";
2
2
  import type { OperationsProjection } from "@zaip-ai/dashboard-operations/contracts";
3
- import { type Dispatch, type MutableRefObject, type SetStateAction, useEffect } from "react";
3
+ import {
4
+ type Dispatch,
5
+ type MutableRefObject,
6
+ type SetStateAction,
7
+ useEffect,
8
+ useRef,
9
+ } from "react";
4
10
  import { pricingSetupPath, projectSetupPath } from "./AppSetupRoutes.js";
5
11
  import { currencyKey, localeKey } from "./app-preferences.js";
6
12
  import type { DashboardView } from "./DashboardCapabilityNav.js";
@@ -10,6 +16,24 @@ import {
10
16
  shouldHydrateOperationsDetails,
11
17
  } from "./operations-detail-hydration.js";
12
18
 
19
+ export const projectionRefreshDebounceMs = 5_000;
20
+
21
+ export function shouldRefreshVisibleProjection({
22
+ inFlight,
23
+ lastRefreshAt,
24
+ now,
25
+ visibilityState,
26
+ }: {
27
+ inFlight: boolean;
28
+ lastRefreshAt: number;
29
+ now: number;
30
+ visibilityState: DocumentVisibilityState;
31
+ }): boolean {
32
+ return (
33
+ visibilityState === "visible" && !inFlight && now - lastRefreshAt >= projectionRefreshDebounceMs
34
+ );
35
+ }
36
+
13
37
  export function useAppEffects({
14
38
  api,
15
39
  costLocale,
@@ -40,13 +64,19 @@ export function useAppEffects({
40
64
  operationsPageAbortRef: MutableRefObject<AbortController | null>;
41
65
  pathname: string;
42
66
  pricing: PricingCatalog | null;
43
- refresh: (visible?: boolean, reconcileOpenWork?: boolean) => Promise<void>;
67
+ refresh: (
68
+ visible?: boolean,
69
+ reconcileOpenWork?: boolean,
70
+ refreshProjection?: boolean,
71
+ ) => Promise<void>;
44
72
  refreshVersion: MutableRefObject<number>;
45
73
  setError: Dispatch<SetStateAction<string | null>>;
46
74
  setFxRate: Dispatch<SetStateAction<Awaited<ReturnType<DashboardApiClient["fxRate"]>> | null>>;
47
75
  setPathname: Dispatch<SetStateAction<string>>;
48
76
  setPricing: Dispatch<SetStateAction<PricingCatalog | null>>;
49
77
  }) {
78
+ const projectionRefreshInFlight = useRef(false);
79
+ const lastProjectionRefreshAt = useRef(0);
50
80
  useEffect(() => {
51
81
  void refresh();
52
82
  return () => {
@@ -66,6 +96,34 @@ export function useAppEffects({
66
96
  refreshVersion,
67
97
  ]);
68
98
 
99
+ useEffect(() => {
100
+ const refreshVisibleProjection = () => {
101
+ const now = Date.now();
102
+ // Focus and visibilitychange commonly arrive together. Coalesce them
103
+ // rather than polling or rebuilding during ordinary navigation.
104
+ if (
105
+ !shouldRefreshVisibleProjection({
106
+ inFlight: projectionRefreshInFlight.current,
107
+ lastRefreshAt: lastProjectionRefreshAt.current,
108
+ now,
109
+ visibilityState: document.visibilityState,
110
+ })
111
+ )
112
+ return;
113
+ lastProjectionRefreshAt.current = now;
114
+ projectionRefreshInFlight.current = true;
115
+ void refresh(false, false, true).finally(() => {
116
+ projectionRefreshInFlight.current = false;
117
+ });
118
+ };
119
+ window.addEventListener("focus", refreshVisibleProjection);
120
+ document.addEventListener("visibilitychange", refreshVisibleProjection);
121
+ return () => {
122
+ window.removeEventListener("focus", refreshVisibleProjection);
123
+ document.removeEventListener("visibilitychange", refreshVisibleProjection);
124
+ };
125
+ }, [refresh]);
126
+
69
127
  useEffect(() => {
70
128
  if (
71
129
  !shouldHydrateOperationsDetails(
@@ -93,11 +151,7 @@ export function useAppEffects({
93
151
  useEffect(() => window.localStorage.setItem(currencyKey, currency), [currency]);
94
152
 
95
153
  useEffect(() => {
96
- if (
97
- !["/", pricingSetupPath, projectSetupPath].includes(
98
- window.location.pathname,
99
- )
100
- ) {
154
+ if (!["/", pricingSetupPath, projectSetupPath].includes(window.location.pathname)) {
101
155
  window.history.replaceState(null, "", `/${window.location.search}${window.location.hash}`);
102
156
  setPathname("/");
103
157
  }