@zaip-ai/cli 3.7.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +5 -5
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +6 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/services/adapters.d.ts +1 -1
  6. package/dist/services/adapters.d.ts.map +1 -1
  7. package/dist/services/adapters.js +22 -4
  8. package/dist/services/adapters.js.map +1 -1
  9. package/dist/services/adapters.test.js +24 -0
  10. package/dist/services/adapters.test.js.map +1 -1
  11. package/dist/services/agent-adapters.js +1 -1
  12. package/dist/services/agent-adapters.js.map +1 -1
  13. package/dist/services/backup-gitignore.d.ts +9 -0
  14. package/dist/services/backup-gitignore.d.ts.map +1 -0
  15. package/dist/services/backup-gitignore.js +66 -0
  16. package/dist/services/backup-gitignore.js.map +1 -0
  17. package/dist/services/backup-gitignore.test.d.ts +2 -0
  18. package/dist/services/backup-gitignore.test.d.ts.map +1 -0
  19. package/dist/services/backup-gitignore.test.js +27 -0
  20. package/dist/services/backup-gitignore.test.js.map +1 -0
  21. package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
  22. package/dist/services/codex-conversation-lifecycle-hook.js +15 -7
  23. package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
  24. package/dist/services/install-agents-template.d.ts.map +1 -1
  25. package/dist/services/install-agents-template.js +43 -127
  26. package/dist/services/install-agents-template.js.map +1 -1
  27. package/dist/services/install-template-policy.d.ts.map +1 -1
  28. package/dist/services/install-template-policy.js +2 -0
  29. package/dist/services/install-template-policy.js.map +1 -1
  30. package/dist/services/legacy-records-migration.d.ts +15 -0
  31. package/dist/services/legacy-records-migration.d.ts.map +1 -0
  32. package/dist/services/legacy-records-migration.js +109 -0
  33. package/dist/services/legacy-records-migration.js.map +1 -0
  34. package/dist/services/local-state-migration.d.ts +8 -1
  35. package/dist/services/local-state-migration.d.ts.map +1 -1
  36. package/dist/services/local-state-migration.js +67 -32
  37. package/dist/services/local-state-migration.js.map +1 -1
  38. package/dist/services/logger.d.ts.map +1 -1
  39. package/dist/services/logger.js +2 -0
  40. package/dist/services/logger.js.map +1 -1
  41. package/dist/services/project-model-migration.d.ts +3 -0
  42. package/dist/services/project-model-migration.d.ts.map +1 -0
  43. package/dist/services/project-model-migration.js +163 -0
  44. package/dist/services/project-model-migration.js.map +1 -0
  45. package/dist/services/project-model-migration.test.d.ts +2 -0
  46. package/dist/services/project-model-migration.test.d.ts.map +1 -0
  47. package/dist/services/project-model-migration.test.js +62 -0
  48. package/dist/services/project-model-migration.test.js.map +1 -0
  49. package/dist/services/sqlite-bootstrap.d.ts.map +1 -1
  50. package/dist/services/sqlite-bootstrap.js +9 -1
  51. package/dist/services/sqlite-bootstrap.js.map +1 -1
  52. package/dist/services/template-manifest.d.ts.map +1 -1
  53. package/dist/services/template-manifest.js +2 -0
  54. package/dist/services/template-manifest.js.map +1 -1
  55. package/dist/services/transactional-files.d.ts +1 -0
  56. package/dist/services/transactional-files.d.ts.map +1 -1
  57. package/dist/services/transactional-files.js +3 -0
  58. package/dist/services/transactional-files.js.map +1 -1
  59. package/dist/types.d.ts +1 -0
  60. package/dist/types.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/templates/.agents/README-ENG.md +90 -34
  63. package/templates/.agents/README.md +59 -32
  64. package/templates/.agents/config/agents/catalog.yaml +23 -23
  65. package/templates/.agents/config/agents/discovery.json +2 -2
  66. package/templates/.agents/config/clients/codex/agents/zaip-agent-analyst.toml +2 -2
  67. package/templates/.agents/config/clients/codex/agents/zaip-agent-auditor.toml +2 -2
  68. package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
  69. package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +2 -2
  70. package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +2 -2
  71. package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +2 -2
  72. package/templates/.agents/config/clients/codex/agents/zaip-agent-data-analyst.toml +2 -2
  73. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
  74. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +2 -2
  75. package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +2 -2
  76. package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +2 -2
  77. package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +2 -2
  78. package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +2 -2
  79. package/templates/.agents/config/clients/codex/agents/zaip-agent-integrator.toml +2 -2
  80. package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +2 -2
  81. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +3 -3
  82. package/templates/.agents/config/clients/codex/agents/zaip-agent-refactoring-specialist.toml +2 -2
  83. package/templates/.agents/config/clients/codex/agents/zaip-agent-reviewer.toml +2 -2
  84. package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +2 -2
  85. package/templates/.agents/config/clients/codex/agents/zaip-agent-security-auditor.toml +2 -2
  86. package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +2 -2
  87. package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +2 -2
  88. package/templates/.agents/config/clients/codex/agents/zaip-agent-writer.toml +2 -2
  89. package/templates/.agents/config/clients.yaml +1 -1
  90. package/templates/.agents/config/pricing/models.json +57 -1
  91. package/templates/.agents/config/project.yaml +21 -7
  92. package/templates/.agents/dashboard/.zaip-managed.json +195 -115
  93. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-C5NgEcVh.js → CostCalculationGuidePage-f4ZGJRg3.js} +1 -1
  94. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-BDQR0U4a.js → DashboardHelpDialog-DlN5EMmD.js} +249 -136
  95. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-CGYcJ5EB.js → PricingSettingsDialog-v9zGRTlk.js} +1 -1
  96. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BRdoeTWk.js +3 -0
  97. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-Ckxk_izu.js → TraceabilityWorkspace-B_5u4Xnp.js} +1 -1
  98. package/templates/.agents/dashboard/apps/frontend/dist/assets/{cost-monitor-BsMfGfQi.css → cost-monitor-C2AFYBu_.css} +1 -1
  99. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-D7PrDZy9.js +68 -0
  100. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-jvdDfNKs.js → dashboard-localization-CF7B1Hjn.js} +90 -34
  101. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-x8xxL9yW.js → icons-vendor-Cv3WBFIF.js} +1 -1
  102. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-C4rLXrz_.js +2 -0
  103. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CNOXIJHN.js → react-vendor-mHgsmxb6.js} +1 -1
  104. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-CcpbpT1s.js → traceability-B0CPyEVq.js} +1 -1
  105. package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
  106. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  107. package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +11 -1
  108. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingBoundary.tsx +3 -2
  109. package/templates/.agents/dashboard/apps/frontend/src/AppLoadingPanels.tsx +1 -1
  110. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +1 -1
  111. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +9 -13
  112. package/templates/.agents/dashboard/apps/frontend/src/cost-monitor-population.test.tsx +4 -2
  113. package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +9 -5
  114. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-settings.ts +3 -2
  115. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +2 -2
  116. package/templates/.agents/dashboard/apps/frontend/src/dashboard-identity.test.ts +3 -3
  117. package/templates/.agents/dashboard/apps/frontend/src/dashboard-identity.ts +1 -1
  118. package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.test.ts +2 -1
  119. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +40 -3
  120. package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +12 -1
  121. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +19 -0
  122. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +1 -1
  123. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +3 -1
  124. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +14 -23
  125. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  126. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +3 -3
  127. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +2 -3
  128. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperAttributionTable.tsx +2 -6
  129. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.period-values.test.tsx +66 -0
  130. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +29 -34
  131. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +2 -2
  132. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.embedded.test.ts +11 -0
  133. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +1 -13
  134. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostPeriodAverageCards.test.tsx +23 -0
  135. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostPeriodAverageCards.tsx +2 -1
  136. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTableDisplay.ts +6 -11
  137. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +6 -6
  138. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +10 -12
  139. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-group-page-totals.ts +23 -0
  140. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-group-period-values.tsx +34 -0
  141. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-embedded.css +0 -7
  142. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-formatters.ts +4 -9
  143. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-presentation.ts +2 -3
  144. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  145. package/templates/.agents/dashboard/modules/operations/src/react/DeveloperAttributionPanel.tsx +2 -12
  146. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +2 -2
  147. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +1 -6
  148. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +34 -36
  149. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewCharts.tsx +12 -3
  150. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.tsx +12 -14
  151. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +4 -4
  152. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +23 -4
  153. package/templates/.agents/dashboard/modules/operations/src/react/OverviewCostKpi.tsx +30 -2
  154. package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +2 -13
  155. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.priority.test.ts +8 -1
  156. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +8 -16
  157. package/templates/.agents/dashboard/modules/operations/src/react/WorkColumnState.tsx +34 -0
  158. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +1 -1
  159. package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +1 -1
  160. package/templates/.agents/dashboard/modules/operations/src/react/operations-average-unmeasured.test.ts +10 -0
  161. package/templates/.agents/dashboard/modules/operations/src/react/operations-content-visibility.ts +3 -0
  162. package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +4 -3
  163. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +12 -1
  164. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +1 -0
  165. package/templates/.agents/dashboard/modules/operations/src/react/operations-skeleton.css +80 -0
  166. package/templates/.agents/dashboard/modules/operations/src/react/operations.css +2 -11
  167. package/templates/.agents/dashboard/modules/operations/src/react/overview-cost-card.test.tsx +36 -0
  168. package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-format.test.ts +11 -0
  169. package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-format.ts +28 -3
  170. package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-stats.ts +44 -0
  171. package/templates/.agents/dashboard/modules/operations/src/react/work-card-label.ts +5 -0
  172. package/templates/.agents/dashboard/modules/operations/src/react/work-column-state.ts +11 -0
  173. package/templates/.agents/dashboard/modules/operations/src/react/work-item-filter.ts +13 -0
  174. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  175. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  176. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  177. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  178. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +173 -173
  179. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +120 -120
  180. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  181. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +173 -173
  182. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.test.ts +31 -0
  183. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +74 -1
  184. package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +15 -15
  185. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +2 -2
  186. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +1 -1
  187. package/templates/.agents/dashboard/packages/local-runtime/src/server-identity.test.ts +1 -1
  188. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +25 -3
  189. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +51 -16
  190. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +1 -1
  191. package/templates/.agents/dashboard/packages/local-runtime/src/server-ui-security.ts +37 -0
  192. package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +1 -1
  193. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +11 -33
  194. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +12 -13
  195. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.test.ts +71 -1
  196. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +141 -25
  197. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-worktree-sources.test.ts +60 -0
  198. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-rebuild-fingerprint-options.ts +13 -0
  199. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.mjs +26 -2
  200. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-launch-page.test.mjs +5 -0
  201. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  202. package/templates/.agents/dashboard/packages/ui/src/DashboardHeader.test.mjs +5 -0
  203. package/templates/.agents/dashboard/packages/ui/src/DashboardHeader.tsx +4 -4
  204. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  205. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -0
  206. package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +15 -23
  207. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +1 -1
  208. package/templates/.agents/dashboard/tests/e2e/specs/performance-matrix-types.ts +15 -0
  209. package/templates/.agents/dashboard/tests/e2e/specs/performance-observability.ts +30 -0
  210. package/templates/.agents/dashboard/tests/e2e/specs/performance-work-row-identity.ts +6 -0
  211. package/templates/.agents/design/.zaip-managed.json +13 -9
  212. package/templates/.agents/design/apps/catalog/dist/assets/index-DkpQYoyC.js +72 -0
  213. package/templates/.agents/design/apps/catalog/dist/index.html +1 -1
  214. package/templates/.agents/design/apps/catalog/package.json +1 -1
  215. package/templates/.agents/design/apps/catalog/src/components/CostPopulationSpecimen.test.tsx +8 -4
  216. package/templates/.agents/design/apps/catalog/src/components/CostPopulationSpecimen.tsx +10 -3
  217. package/templates/.agents/design/apps/catalog/src/components/DashboardFiltersSpecimen.tsx +0 -15
  218. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +3 -3
  219. package/templates/.agents/design/apps/catalog/src/stories/DashboardFilters.stories.tsx +0 -1
  220. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  221. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  222. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  223. package/templates/.agents/requirements/comparative-audit.md +1 -1
  224. package/templates/.agents/requirements/context-engine.md +1 -1
  225. package/templates/.agents/requirements/cost-observability.md +1 -1
  226. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  227. package/templates/.agents/requirements/data-export.md +1 -1
  228. package/templates/.agents/requirements/design-system.md +1 -1
  229. package/templates/.agents/requirements/execution-engine.md +1 -1
  230. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  231. package/templates/.agents/requirements/model-orchestration.md +6 -6
  232. package/templates/.agents/requirements/public-distribution.md +1 -1
  233. package/templates/.agents/requirements/software-architecture.md +1 -1
  234. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  235. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  236. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  237. package/templates/.agents/rules/autonomy-decision.md +2 -2
  238. package/templates/.agents/rules/workflow.md +1 -1
  239. package/templates/.agents/runtime/VERSION +1 -1
  240. package/templates/.agents/runtime/bin/zaip.mjs +73 -64
  241. package/templates/.agents/runtime/checksums.sha256 +5 -5
  242. package/templates/.agents/runtime/manifest.json +1 -1
  243. package/templates/.agents/runtime/provenance.json +4 -4
  244. package/templates/.agents/runtime/sbom.cdx.json +1 -1
  245. package/templates/.agents/skills/zaip-skill-adapters/SKILL.md +1 -1
  246. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/SKILL.md +7 -7
  247. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.mjs +32 -7
  248. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-fence.test.mjs +134 -1
  249. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/ready-queue-lease.mjs +57 -0
  250. package/templates/.agents/skills/zaip-skill-executar-fila-pronta/scripts/scheduled-ready-queue-contract.test.mjs +9 -6
  251. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
  252. package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +2 -2
  253. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +5 -5
  254. package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +2 -2
  255. package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +5 -3
  256. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +40 -5
  257. package/templates/.agents/skills/zaip-skill-instalar-agendamento/SKILL.md +2 -2
  258. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +6 -0
  259. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +54 -6
  260. package/templates/.agents/zaip-aios/README.md +4 -4
  261. package/templates/.agents/zaip-aios/VERSION +1 -1
  262. package/templates/.agents/zaip-aios/guides/01-primeiros-passos.md +4 -3
  263. package/templates/.agents/zaip-aios/guides/03-tasks.md +5 -4
  264. package/templates/.agents/zaip-aios/guides/04-specs.md +4 -1
  265. package/templates/.agents/zaip-aios/guides/05-prds.md +7 -3
  266. package/templates/.agents/zaip-aios/guides/06-execucao.md +9 -4
  267. package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +9 -5
  268. package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +10 -2
  269. package/templates/.agents/zaip-aios/guides/12-instalacao-e-upgrade.md +10 -5
  270. package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +12 -1
  271. package/templates/.agents/zaip-aios/guides/14-troubleshooting.md +3 -1
  272. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +12 -7
  273. package/templates/.agents/zaip-aios/guides/17-como-o-custo-e-calculado.md +1 -1
  274. package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +5 -1
  275. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +19 -15
  276. package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +13 -9
  277. package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +4 -3
  278. package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +9 -7
  279. package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +40 -25
  280. package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +8 -8
  281. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +14 -5
  282. package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +6 -0
  283. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +129 -11
  284. package/templates/template-manifest.json +310 -218
  285. package/templates/tsconfig.base.json +22 -0
  286. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-OulA4CoX.js +0 -3
  287. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-j3aUYH5G.js +0 -68
  288. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-CqfSgtk9.js +0 -2
@@ -8,6 +8,17 @@ English | [Português](README.md)
8
8
 
9
9
  ## Quick overview
10
10
 
11
+ > **Approved v4 target, not a shipped guarantee:** the Codex-native intake,
12
+ > subagent, scheduling, replanning, closure, and numeric display rules below
13
+ > still require implementation and qualification in the exact candidate and
14
+ > installed npm package. The [v4 lifecycle guide](.agents/zaip-aios/guides/28-lifecycle-completo.md#contrato-aprovado-para-a-v4-a-implementar-e-qualificar)
15
+ > distinguishes this target from current behavior and lists observable gates.
16
+
17
+ The [Codex-native compatibility contract](.agents/zaip-aios/guides/28-lifecycle-completo.md#fronteiras-nativas-e-prova-de-compatibilidade)
18
+ separates subagents, hooks, scheduling, and installer requirements. An abrupt
19
+ interruption can leave an attempt pending until the next observable host
20
+ event; a Stop hook cannot guarantee execution after the app stops.
21
+
11
22
  ZAIP-AIOS is an operating system for autonomous work performed by AI agents. It coordinates 23 specialized agents, organized into six squads, within Codex.
12
23
 
13
24
  Agents plan, execute, review, test, and validate work under the orchestrator's coordination. Authorized execution continues until acceptance or an evidence- and budget-based blocked/failed outcome. Persistent permits indefinite execution by explicit choice; other presets have per-Task quotas. No preset guarantees success or expands authority for external actions.
@@ -124,11 +135,11 @@ After installation, consult the [operational index](.agents/zaip-aios/INDEX.md)
124
135
 
125
136
  | Type | Name | Responsibility |
126
137
  | --- | --- | --- |
127
- | **AI Model** | **GPT-5.6 (default)** | Main model for reasoning, programming, tool use, agent coordination, and complex task execution. Configuration remains open to testing, comparison, and substitution by other models. |
138
+ | **AI Model** | **GPT-6 Sol (default)** | Main model for reasoning, programming, tool use, agent coordination, and complex task execution. Configuration remains open to testing, comparison, and substitution by other models. |
128
139
  | **AI Harness** | **Codex (default)** | Official harness connecting the LLM to the terminal, tools, subagents, worktrees, sandbox, hooks, skills, and browser. Its alignment with the model's training provides greater optimization, predictability, and use of model capabilities. |
129
140
  | **AI Coding methodology** | **ZAIP-AIOS** | Git-native autonomous, multi-agent engineering system. It turns PRDs and SPECs into executable Tasks, DAGs, and Changes; automates tests and reviews; and keeps decisions, executions, evidence, costs, and changes traceable in Git. |
130
141
 
131
- The model provides intelligence, Codex provides the official execution environment, and ZAIP-AIOS adds method, governance, and verifiable memory. Together they define **what must be done, how work is organized, which rules apply, and which proof permits it to be declared complete**. The reference experience is optimized for GPT-5.6 and Codex, while alternate models and hosts remain available for comparison and compatibility through portable artifacts.
142
+ The model provides intelligence, Codex provides the official execution environment, and ZAIP-AIOS adds method, governance, and verifiable memory. Together they define **what must be done, how work is organized, which rules apply, and which proof permits it to be declared complete**. The reference experience uses GPT-6 Sol and Codex, while alternate models and hosts remain available for comparison and compatibility through portable artifacts.
132
143
 
133
144
  ## Agent personas and routing
134
145
 
@@ -204,7 +215,7 @@ The Work (Kanban) and Work (List) views switch between stage reading and detaile
204
215
 
205
216
  ### Cost Monitor
206
217
 
207
- It consolidates tokens, duration, estimated equivalent cost, and coverage by period and work unit without turning missing telemetry into zero.
218
+ It consolidates tokens, duration, estimated equivalent cost, and coverage by period and work unit without turning missing telemetry into a **canonical** zero. In the v4 visual contract, loaded numeric cards and table cells display \`0\` rather than “Unavailable” when no measurement exists, with explicit “not measured” coverage; loading displays a skeleton. Records, APIs, exports, and calculations keep \`null\` for missing values.
208
219
 
209
220
  <img src=".agents/config/src/dashboard_pt_3_monitor_custos.png" alt="ZAIP-AIOS Dashboard, Cost Monitor" width="100%">
210
221
 
@@ -232,16 +243,17 @@ Platform configuration shows ZAIP-AIOS activation state and a summary of agents,
232
243
 
233
244
  <img src=".agents/config/src/dashboard_pt_configuracao_plataforma.png" alt="ZAIP-AIOS Dashboard, platform configuration" width="100%">
234
245
 
235
- ### v3 autonomy presets
246
+ ### Autonomy presets: approved v4 target
236
247
 
237
- The sources being prepared for v3 add a per-Task preset, separate from
238
- installation and assurance:
248
+ The per-Task preset is separate from installation and assurance. The route
249
+ below is approved for v4, but it does not describe the effective behavior of
250
+ every current Codex-native call until implementation and qualification:
239
251
 
240
252
  | Preset | Product executions per Task | Replans | Replanning models |
241
253
  | --- | --- | --- | --- |
242
254
  | Essential (\`essential\`) | 4: 1 initial + 3 repairs | 1 | Sol/high; never automatic Astra |
243
- | Balanced (\`balanced\`, new default) | 10: 1 initial + 9 repairs | 3 | Sol/high → Astra/high → Astra/high |
244
- | Persistent (\`persistent\`, opt-in) | Unlimited | Unlimited | Sol/high first; Astra/high thereafter |
255
+ | Balanced (\`balanced\`, v4 default) | 10: 1 initial + 9 repairs | 3 | Sol/high → Sol/high → Astra/high |
256
+ | Persistent (\`persistent\`, opt-in) | Unlimited | Unlimited | Sol/high for the first two; Astra/high from the third onward |
245
257
 
246
258
  Merge into \`.agents/config/project.yaml\`, or select **Autonomy preset** in
247
259
  Dashboard **Project settings** and save:
@@ -263,10 +275,13 @@ Missing verification/safe conclusion ends as \`blocked\`; a proven technical
263
275
  impediment ends as \`failed\`. Independent branches remain eligible.
264
276
 
265
277
  **Current boundary:** counters are enforced in the managed runtime, not on
266
- external \`spawn_agent\` calls made directly by Codex. New projects use
267
- \`execution.runtime: managed\`: managed PRDs/SPECs and direct standalone Tasks.
268
- Saving a preset does not invoke a provider. Legacy Tasks need explicit migration
269
- without resetting consumption. See [autonomy and its guarantees](.agents/zaip-aios/guides/19-assurance-e-autonomia.md).
278
+ every native \`spawn_agent\` call made directly by Codex. The v4 target makes
279
+ native Codex delegation the default even for standalone Tasks: reserve before
280
+ dispatch, capture observed events, and block when the required model, effort,
281
+ or tool cannot be confirmed. Current templates still use
282
+ \`execution.runtime: managed\`; saving a preset does not invoke a provider.
283
+ Legacy Tasks need explicit migration without resetting consumption. See
284
+ [autonomy and its guarantees](.agents/zaip-aios/guides/19-assurance-e-autonomia.md).
270
285
 
271
286
  ### Development stack
272
287
 
@@ -297,6 +312,13 @@ When they say **“Create a PRD”**, the AI asks up to five important questions
297
312
  - a \`PreparedPlan\`
298
313
  - a summarized list of Tasks
299
314
 
315
+ “Create and execute this PRD/SPEC” may complete both phases in one Codex turn:
316
+ creation remains an \`interaction\` Run and implementation uses a separate,
317
+ linked \`delivery\` Run. “Create” alone remains \`draft\`; “make ready”
318
+ materializes work without running it; “execute” may start directly without a
319
+ temporary Ready to Execute transition. A critical standalone request may
320
+ recommend a PRD/SPEC without creating or promoting one implicitly.
321
+
300
322
  Technical decisions that can be delegated are made and recorded by the AI.
301
323
 
302
324
  **Planning, decomposition, and command details**
@@ -327,14 +349,20 @@ When capabilities depend on one another, work must remain in the same SPEC. Proj
327
349
 
328
350
  ### Command behavior
329
351
 
330
- The \`implemente\` (“implement”) command considers the current work state:
352
+ The \`implemente\` (“implement”) command considers intent, target, and state:
331
353
 
332
- * with no defined target, it opens a planning Conversation
333
- * in \`draft\`, it completes the plan
354
+ * an independent action request without an explicit PRD/SPEC creates and
355
+ executes a standalone Task; a reference to an existing macro needs an
356
+ unambiguous target
357
+ * a \`draft\` PRD/SPEC executes only when the user explicitly asks to execute
358
+ that macro; otherwise it remains in planning without promotion
334
359
  * in \`ready\`, it starts execution
335
360
  * in active or failed states, it continues, resumes, or starts rework
336
361
 
337
- The \`desenvolva\`, \`melhore\`, and \`aprimore\` (“develop”, “improve”, and “enhance”) commands always return to planning or rework.
362
+ The \`desenvolva\`, \`melhore\`, and \`aprimore\` (“develop”, “improve”, and “enhance”)
363
+ commands preserve intent: an independent action is a standalone Task, while
364
+ refining an existing PRD/SPEC without an execution request remains in
365
+ planning or rework.
338
366
 
339
367
  A canceled PRD cannot be changed. When necessary, a new rework PRD is created, preserving the link and audit history.
340
368
 
@@ -348,10 +376,12 @@ Overview retains the compact **Estimated cost** card. When coverage is incomplet
348
376
  the accessible description and tooltip explain coverage without an icon. The
349
377
  subtitle allocates known spend across the selected task count and recorded hours;
350
378
  these are estimated allocation rates, not averages of complete per-task costs.
351
- Missing costs are not imputed. Each rate independently displays \`—\` only when its
352
- denominator is unavailable or zero, without hiding the other valid rate.
353
- The subtotal is not the full account cost or a bill. Observed
354
- zero remains zero, while missing measurements remain unavailable. Unexecuted Task
379
+ Missing costs are not imputed. Under the v4 visual contract, loaded numeric
380
+ cards and cells display \`0\` with “not measured” coverage when the base is
381
+ missing; loading uses a skeleton. A valid rate is not hidden because another
382
+ rate is unmeasured. The subtotal is not the full account cost or a bill.
383
+ Observed zero and absent measurement share a numeral in the UI but remain
384
+ distinct in coverage and canonical data (\`0\` versus \`null\`). Unexecuted Task
355
385
  drafts remain in the work list, outside the executable Kanban stages and operational
356
386
  indicators that exclude drafts.
357
387
 
@@ -498,25 +528,51 @@ This progression allows a simple start, adding planning only when breadth, depen
498
528
 
499
529
  **Technical execution and assurance policies**
500
530
 
501
- Conversation and standalone Task principals preserve manual host selection and prefer direct work. When delegation is necessary, disclose that children may use different models/efforts under ZAIP policy; they need not inherit the principal. Model and effort remain fixed per Run, with observed configuration separate from planned selection. Automatic selection requests \`standard\`; unobserved host capabilities cannot be assumed. See the [model policy](.agents/zaip-aios/guides/23-orquestracao-de-modelos.md).
531
+ A read-only Conversation preserves manual host selection and does not use
532
+ subagents. In the v4 target, every standalone Task uses native Codex
533
+ subagents; ZAIP chooses each child's model and effort by role, risk, and phase
534
+ without necessarily inheriting the principal's selection. Standalone product
535
+ work is sequential; only a planned PRD/SPEC DAG with independent scopes can
536
+ parallelize it. Planned and observed model/effort remain separate. If the
537
+ required host setting cannot be dispatched or verified, block rather than
538
+ claim a prompt changed it. See the [model policy](.agents/zaip-aios/guides/23-orquestracao-de-modelos.md).
502
539
 
503
540
  ### Astra policy
504
541
 
505
- Essential never selects Astra automatically, including children or fallback. Its sole exception is a standalone principal with Astra selected manually by the user. Balanced replans use Sol/high, Astra/high, and Astra/high; in the third block Astra/high may also execute repairs without expanding the quota. Persistent retains that progression without an overall cap.
506
-
507
- Replanners are isolated and do not edit product files; executor, reviewer, and Gui are distinct roles. Automatic Astra uses only \`high\`, never replaces review/finalization, and depends on managed dispatch. The old cap of three read-only Astra diagnoses remains only in the legacy contract without \`autonomy\`; it does not limit Persistent. Context and assurance follow the domain: content needs sources/briefing, engineering needs verified behavior. Real savings must be measured, not inferred from a preset.
508
-
509
- Intake correlates the observable turn with the Execution. \`prepare\` validates the plan without authorizing implementation; \`ready\` materializes prepared work and \`execute\` starts authorized delivery. Every delivery and delegated interaction requires an eligible executor (or authorized direct Task root) and \`zaip-agent-finalizer\` last. A read-only interaction without descendants ends after the response, without that circuit. Purely Git publication is an exception: it does not materialize lifecycle records. SPEC/PRD remain active between child Runs and are delivered only through parent gates.
542
+ Essential never selects Astra automatically, including children or fallback.
543
+ Balanced's approved v4 route uses Sol/high, Sol/high, then Astra/high for
544
+ three replans; in the third block Astra/high may also execute an eligible
545
+ repair without expanding the quota. Persistent keeps the progression without
546
+ an overall cap. The native host configuration and ledger still need evidence.
547
+
548
+ Replanners are isolated and do not edit product files; executor, reviewer, and
549
+ Gui are distinct roles. Automatic Astra uses only \`high\` and never replaces
550
+ review/finalization. Its preventive control currently depends on managed
551
+ dispatch; the Codex-native target needs preflight before each child spawn.
552
+ The old cap of three read-only Astra diagnoses belongs only to the legacy
553
+ contract without \`autonomy\`. Real savings must be measured, not inferred.
554
+
555
+ Intake correlates the observable turn with the Execution. \`prepare\` validates
556
+ the plan without authorizing implementation; \`ready\` materializes prepared
557
+ work and \`execute\` starts authorized delivery. “Create and execute PRD/SPEC”
558
+ uses separate linked definition and delivery Runs in one Codex turn. Delivery
559
+ uses an eligible executor and \`zaip-agent-finalizer\` last; authorized direct
560
+ Task roots remain a legacy compatibility route. A read-only interaction
561
+ without descendants ends after the response. Purely Git publication is an
562
+ exception. SPEC/PRD reach a terminal decision only after every DAG Task is
563
+ terminal and their parent gates are evaluated.
510
564
 
511
565
  Each Task attempt has exactly one responsible orchestrator. Gui is its last
512
566
  direct child, a sibling of executors, not a finalizer for every worker.
513
567
  The host persists the real decision before canonical Stop; it may relay an
514
- already-terminal Gui while the responsible Run is open, without requiring
515
- receipt polling. No decision means no approval. Direct standalone work uses an
516
- observed Task root with explicit direct authorization; no invented executor,
517
- and no waiver of Evidence or Gui. See [closure and recovery](.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md).
568
+ already-terminal Gui while the responsible Run is open. No decision means no
569
+ approval. A trusted fallback must persist \`blocked\` with a reason when the
570
+ finalizer cannot run; the current CLI does not yet prove that path for every
571
+ native Stop or interruption. Direct standalone work with explicit direct
572
+ authorization is a legacy route, not the v4 default. See
573
+ [closure and recovery](.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md).
518
574
 
519
- Proof depth is adaptive: a standalone \`lite\` Task requires at least one typed validation and one Evidence, normally one of each, but accepts legitimate additional proof. \`standard\` requires two or three validations according to \`verification_scope\` and at least one consolidated Evidence; \`critical\` requires three or more, independent review, and persisted risk signals determining additional controls. SPEC and PRD deliveries add a parent matrix, at least three validations and three Evidences, real integration, and independent review. New projects default to managed PRDs/SPECs and direct standalone Tasks; Codex or Claude execution requires an explicit request, isolated in worktrees, and limited by write scopes, commits, budgets, and typed gates. See [Adaptive assurance and opt-in autonomy](.agents/zaip-aios/guides/19-assurance-e-autonomia.md).
575
+ Proof depth is adaptive: a standalone \`lite\` Task requires at least one typed validation and one Evidence, normally one of each, but accepts legitimate additional proof. \`standard\` requires two or three validations according to \`verification_scope\` and at least one consolidated Evidence; \`critical\` requires three or more, independent review, and persisted risk signals determining additional controls. SPEC and PRD deliveries add a parent matrix, at least three validations and three Evidences, real integration, and independent review. Current templates use managed PRDs/SPECs and direct standalone Tasks; after implementation and installer qualification, v4 targets Codex-native as the operational default. Worktrees, write scopes, budgets, commits, and typed gates still apply where relevant. See [Adaptive assurance and opt-in autonomy](.agents/zaip-aios/guides/19-assurance-e-autonomia.md).
520
576
 
521
577
  ## Autonomous engineering principles
522
578
 
@@ -543,7 +599,7 @@ Intake captures once per observable turn and reuses valid focus in continuations
543
599
 
544
600
  This autonomy remains governed: Dave coordinates, each executor receives only the necessary scope, Nanda performs independent review, additional specialists join when objective signals exist, and Gui closes the flow last. The result is a team tailored to the request without unnecessarily multiplying agents and cost.
545
601
 
546
- **Loop Engineering** uses the Task's frozen preset to reserve execution and replanning before the provider, record the result, and choose a corrected route. Balanced allows 1 + 9 executions and three plans: Sol/high → Astra/high → Astra/high; Essential never escalates to Astra, Persistent has no cap. Models never change silently within a Run. A standalone principal's manual preference does not require children to use the same configuration.
602
+ **Loop Engineering** uses the Task's frozen preset to reserve execution and replanning before dispatch, record the result, and choose a corrected route. The Balanced v4 target allows 1 + 9 executions and three plans: Sol/high → Sol/high → Astra/high; Essential never escalates to Astra, Persistent has no cap. Models never change silently within a Run. ZAIP selects child models subject to host capability.
547
603
 
548
604
  ### Summary flow
549
605
 
@@ -555,7 +611,7 @@ Complete scenarios are in the [flows and routing guide](.agents/zaip-aios/guides
555
611
 
556
612
  The lifecycle follows **Definition → Planning → Ready to Execute → Execution → Verification → Completed**. Blocked, Failed, and Canceled are alternative outcomes.
557
613
 
558
- Task, SPEC, and PRD retain independent flows; Conversation uses an interaction Execution and creates no artificial Task. A direct Task starts immediately, while a prepared one awaits execute.
614
+ Task, SPEC, and PRD retain independent flows; Conversation uses an interaction Execution and creates no artificial Task. Under the v4 target, a standalone action starts a Task with native subagents; a merely prepared Task awaits execute. Each physical Task attempt needs a terminal result before its responsible Run closes. SPEC/PRD terminalization waits for every DAG Task and the applicable parent gates.
559
615
 
560
616
  ![Task, SPEC, and PRD lifecycles](.agents/zaip-aios/guides/assets/diagrams/lifecycles-task-spec-prd.png)
561
617
 
@@ -805,7 +861,7 @@ The [complete ZAIP-AIOS permission-profile security guide](.agents/zaip-aios/gui
805
861
 
806
862
  In Codex Desktop, hourly ready-queue scheduling is configured by the \`$zaip-skill-instalar-agendamento\` skill in a single conversation in the local checkout. The skill uses native scheduled-task automation to create or update one standalone task with a stable name; it does not duplicate records and fails closed if \`automation_update\` is unavailable. The scheduled task explicitly calls \`$zaip-skill-executar-fila-pronta\` each hour.
807
863
 
808
- Each round processes the eligible snapshot sequentially: ready PRDs first, then independent ready SPECs, then standalone Tasks materialized in **Ready to Execute**. Descendant, active, blocked, failed, and terminal items stay out. In **Dashboard > Work (Kanban) > Ready to Execute**, priority is set top to bottom within the PRD/SPEC/Task tier and persists for the scheduler in \`.agents/dashboard/work-priority.json\`. Accessible ordering controls update that numbering, and items without a number go last through deterministic fallback. A local lock/lease prevents overlapping rounds.
864
+ Under the approved v4 target, each hourly round claims **one** eligible top-level item: ready PRDs first, then independent ready SPECs, then standalone Tasks in **Ready to Execute**. The visual route is Dashboard > Work (Kanban) > Ready to Execute. Descendants and active or terminal items are ineligible. Within each class, the Dashboard's up/down priority persists in \`.agents/dashboard/work-priority.json\`; items without a number use a deterministic fallback. A lock/lease prevents overlapping claims. The current executor still walks the whole eligible snapshot, so do not claim this one-item rule is implemented yet.
809
865
 
810
866
  The repository versions this contract but does not install a clock in each clone. The scheduled task belongs to the machine/user who created it and depends on the machine being on, Codex Desktop running, and native automation being available; without them the skill fails closed and does not promise future execution.
811
867
 
@@ -1 +1 @@
1
- import{h as e}from"./cost-monitor-j3aUYH5G.js";var t=e(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),r=e(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),i=e(`CircleGauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),a=e(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),o=e(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),s=e(`FileCheck2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m3 15 2 2 4-4`,key:`1lhrkk`}]]),c=e(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),l=e(`Gavel`,[[`path`,{d:`m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8`,key:`15492f`}],[`path`,{d:`m16 16 6-6`,key:`vzrcl6`}],[`path`,{d:`m8 8 6-6`,key:`18bi4p`}],[`path`,{d:`m9 7 8 8`,key:`5jnvq1`}],[`path`,{d:`m21 11-8-8`,key:`z4y7zo`}]]),u=e(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),d=e(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),f=e(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),p=e(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),m=e(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);export{u as a,s as c,i as d,r as f,d as i,o as l,t as m,p as n,l as o,n as p,f as r,c as s,m as t,a as u};
1
+ import{h as e}from"./cost-monitor-D7PrDZy9.js";var t=e(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),r=e(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),i=e(`CircleGauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),a=e(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),o=e(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),s=e(`FileCheck2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m3 15 2 2 4-4`,key:`1lhrkk`}]]),c=e(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),l=e(`Gavel`,[[`path`,{d:`m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8`,key:`15492f`}],[`path`,{d:`m16 16 6-6`,key:`vzrcl6`}],[`path`,{d:`m8 8 6-6`,key:`18bi4p`}],[`path`,{d:`m9 7 8 8`,key:`5jnvq1`}],[`path`,{d:`m21 11-8-8`,key:`z4y7zo`}]]),u=e(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),d=e(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),f=e(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),p=e(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),m=e(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);export{u as a,s as c,i as d,r as f,d as i,o as l,t as m,p as n,l as o,n as p,f as r,c as s,m as t,a as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-DlN5EMmD.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-D7PrDZy9.js","assets/cost-monitor-C2AFYBu_.css","assets/dashboard-localization-CF7B1Hjn.js","assets/DashboardHelpDialog-DRI_XwUf.css","assets/PricingSettingsDialog-v9zGRTlk.js","assets/ProjectSettingsPage-BRdoeTWk.js","assets/ProjectSettingsPage-CQMhvzvJ.css","assets/CostCalculationGuidePage-f4ZGJRg3.js","assets/TraceabilityWorkspace-B_5u4Xnp.js","assets/traceability-B0CPyEVq.js","assets/icons-vendor-Cv3WBFIF.js","assets/traceability-DFY7ZDlu.css","assets/TraceabilityWorkspace-DvvavDLY.css"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,a as n,b as r,g as i,i as a,n as o,o as s,r as c,t as l,w as u}from"./cost-monitor-D7PrDZy9.js";import{t as d}from"./react-vendor-mHgsmxb6.js";import{n as f,t as p}from"./traceability-B0CPyEVq.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var m=e(t(),1),h=d(),g=u();function _({locale:e}){let t=e===`pt-BR`?[`Definição`,`Planejamento`,`Pronto para Executar`,`Execução`,`Verificação`]:[`Definition`,`Planning`,`Ready to Execute`,`Execution`,`Verification`];return(0,g.jsxs)(`main`,{"aria-busy":`true`,"aria-live":`polite`,"aria-label":e===`pt-BR`?`Preparando dashboard`:`Preparing dashboard`,className:`app-skeleton`,role:`status`,children:[(0,g.jsxs)(`header`,{className:`app-skeleton-header`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,g.jsx)(`h1`,{children:`Dashboard ZAIP AIOS`})]}),(0,g.jsxs)(`div`,{className:`app-skeleton-actions`,children:[(0,g.jsx)(`span`,{}),(0,g.jsx)(`span`,{}),(0,g.jsx)(`span`,{})]})]}),(0,g.jsx)(`section`,{className:`app-skeleton-kpis`,"aria-hidden":`true`,children:Array.from({length:4},(e,t)=>`skeleton-kpi-${t}`).map(e=>(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,g.jsx)(`span`,{className:`app-skeleton-value`}),(0,g.jsx)(`span`,{className:`app-skeleton-line`})]},e))}),(0,g.jsxs)(`section`,{className:`app-skeleton-panels`,"aria-hidden":`true`,children:[(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`div`,{className:`app-skeleton-chart`})]}),(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`div`,{className:`app-skeleton-chart app-skeleton-chart-small`})]})]}),(0,g.jsx)(`section`,{className:`app-skeleton-board`,"aria-hidden":`true`,children:t.map((e,t)=>(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`h2`,{children:e}),Array.from({length:t%2==0?2:1},(t,n)=>`${e}-${n}`).map(e=>(0,g.jsxs)(`div`,{className:`app-skeleton-card`,children:[(0,g.jsx)(`span`,{className:`app-skeleton-line`}),(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`span`,{className:`app-skeleton-pill`})]},e))]},e))})]})}function v(e,t){let n=t===`pt-BR`;return e===`costs`?n?{title:`Carregando Monitor de Custos…`,detail:`Isso costuma levar poucos segundos.`}:{title:`Loading Cost Monitor…`,detail:`This usually takes a few seconds.`}:e===`traceability`?n?{title:`Carregando Rastreabilidade…`,detail:`Estamos preparando as 6 etapas da task.`}:{title:`Loading Traceability…`,detail:`Preparing the task's 6 stages.`}:n?{title:`Atualizando dados do dashboard…`,detail:`Você pode continuar navegando.`}:{title:`Refreshing dashboard data…`,detail:`You can keep navigating.`}}function y({area:e,locale:t}){let n=v(e,t);return(0,g.jsxs)(`section`,{"aria-busy":`true`,"aria-live":`polite`,className:`app-loading-panel`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:n.title}),(0,g.jsx)(`span`,{children:n.detail})]})]})}function b({area:e,locale:t}){let n=v(e,t);return(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:n.title}),(0,g.jsx)(`span`,{children:n.detail})]})]})}function x({locale:e,onRetry:t}){return(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-loading-panel app-loading-panel-error`,role:`status`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:e===`pt-BR`?`Não foi possível carregar os custos`:`Couldn't load costs`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`A tela continua disponível. Tente novamente quando quiser.`:`The dashboard remains available. Try again whenever you want.`})]}),(0,g.jsx)(`button`,{onClick:t,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Try again`})]})}function S({costsLoaded:e,currency:t,snapshotCurrency:n}){return!e||n!==t}function C({aborted:e,currentCurrency:t,currentPeriod:n,currentRequestVersion:r,requestVersion:i,requestedCurrency:a,requestedPeriod:o}){return!e&&i===r&&a===t&&o.from===n.from&&o.to===n.to}function w(e,t){return e===t}function T(e,t,n,r){return w(e,t)&&n.from===r.from&&n.to===r.to}function E(e){return e instanceof DOMException&&e.name===`AbortError`}function D(e,t){return e===t}function O(e,t,n){return w(e,t)&&!n.aborted}function k(e,t){let n=e=>[...new Map(e.map(e=>[e.id,e])).values()];return{...e,prds:n([...e.prds,...t.flatMap(e=>e.prds)]),specs:n([...e.specs,...t.flatMap(e=>e.specs)]),tasks:n([...e.tasks,...t.flatMap(e=>e.tasks)]),changes:n([...e.changes,...t.flatMap(e=>e.changes)])}}function ee(){let e=(0,m.useRef)(null);return(0,m.useEffect)(()=>{e.current?.focus()},[]),(0,g.jsx)(`div`,{"aria-busy":`true`,"aria-live":`polite`,className:`period-transition-overlay`,onKeyDownCapture:e=>e.preventDefault(),ref:e,role:`status`,tabIndex:-1,children:(0,g.jsxs)(`div`,{className:`period-transition-overlay__content`,children:[(0,g.jsx)(`i`,{"aria-hidden":`true`,className:`period-transition-overlay__spinner`}),(0,g.jsx)(`span`,{className:`period-transition-overlay__label`,children:`Carregando...`})]})})}function te({pending:e,children:t}){return(0,g.jsx)(`div`,{"aria-hidden":e||void 0,inert:e,children:t})}var A={"pt-BR":{action:`Tentar novamente`,guidance:`Abra a pasta dashboard dentro de .agents e dê dois cliques novamente no arquivo executável.`,title:`Não foi possível carregar o dashboard`},"en-US":{action:`Try again`,guidance:`Open the dashboard folder inside .agents, then double-click the executable file again.`,title:`Unable to load the dashboard`}};function ne({children:e,error:t,globalLoadingPending:n,locale:r,onRefresh:i,operations:a,snapshotNotice:o,setupRoute:s}){if(s!==null)return s;if(t&&a===null){let e=A[r];return(0,g.jsx)(`main`,{className:`app-loading-boundary`,"aria-labelledby":`dashboard-load-error-title`,children:(0,g.jsxs)(`section`,{className:`app-loading-boundary__card`,role:`alert`,children:[(0,g.jsx)(`div`,{"aria-hidden":`true`,className:`app-loading-boundary__status-icon`,children:(0,g.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,g.jsx)(`path`,{d:`M12 8v4m0 4h.01M10.29 3.86 2.82 16.5A2 2 0 0 0 4.54 19.5h14.92a2 2 0 0 0 1.72-3L13.71 3.86a2 2 0 0 0-3.42 0Z`})})}),(0,g.jsxs)(`div`,{className:`app-loading-boundary__content`,children:[(0,g.jsx)(`p`,{className:`app-loading-boundary__eyebrow`,children:r===`pt-BR`?`Dashboard indisponível`:`Dashboard unavailable`}),(0,g.jsx)(`h1`,{id:`dashboard-load-error-title`,children:e.title}),(0,g.jsx)(`p`,{children:e.guidance})]}),(0,g.jsx)(`button`,{onClick:i,type:`button`,children:e.action})]})})}return a===null?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(_,{locale:r}),o,n?(0,g.jsx)(ee,{}):null,(0,g.jsx)(b,{area:`operations`,locale:r})]}):e}var j=`modulepreload`,M=function(e){return`/`+e},N={},P=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=M(t,n),t=s(t),t in N)return;N[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:j,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},re=(0,m.lazy)(async()=>({default:(await P(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-DlN5EMmD.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function ie({costLocale:e,documentDetail:t,helpOpen:n,loadingArea:i,operations:a,reconciliationResult:c,refreshDialog:l,showTrace:u,trace:d,traceLink:h,traceLoadingTaskId:_,closeDocument:v,onCloseHelp:y,onCloseTrace:x,onDismissReconciliation:S,onOpenDocument:C,onOpenTrace:w,onOpenTraceChange:T,onOpenTraceMacro:E,onRefreshCancel:D,onRefreshFromDialog:O,setTraceLink:k}){return(0,g.jsxs)(g.Fragment,{children:[u?null:_?(0,g.jsx)(p,{locale:e,taskId:_}):d?(0,g.jsx)(f,{locale:e,onClose:x,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),trace:d}):null,h?.kind===`change`?(0,g.jsx)(r,{details:{kind:`change`,row:h.row},locale:e,onClose:()=>k(null)}):null,h?.kind===`macro`?(0,g.jsx)(s,{label:h.label,locale:e,onClose:()=>k(null),onOpenDocument:C,onOpenTrace:e=>{k(null),w(e)},row:h.row,runs:a.runs,specs:a.specs,tasks:a.tasks}):null,t?(0,g.jsx)(o,{detail:t.detail,error:t.error,label:t.label,locale:e,loading:!t.detail&&!t.error,onClose:v,onRetry:()=>C(t.kind,t.preview.id),preview:t.preview}):null,n?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(re,{locale:e,onClose:y})}):null,l===`choose`?(0,g.jsx)(`div`,{className:`app-refresh-dialog-backdrop`,children:(0,g.jsxs)(`section`,{"aria-label":`Atualizar dashboard`,"aria-modal":`true`,className:`app-refresh-dialog`,role:`dialog`,children:[(0,g.jsx)(`h2`,{children:e===`pt-BR`?`Atualizar dashboard`:`Refresh dashboard`}),(0,g.jsx)(`p`,{children:e===`pt-BR`?`Escolha uma atualização rápida ou reconcilie os itens que ainda estão em aberto.`:`Choose a quick refresh or reconcile work items that are still open.`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`button`,{onClick:()=>O(!1),type:`button`,children:e===`pt-BR`?`Apenas atualizar dados`:`Refresh data only`}),(0,g.jsx)(`button`,{onClick:()=>O(!0),type:`button`,children:e===`pt-BR`?`Reconciliar itens abertos`:`Reconcile open work`})]}),(0,g.jsx)(`button`,{className:`app-refresh-cancel`,onClick:D,type:`button`,children:e===`pt-BR`?`Cancelar`:`Cancel`})]})}):null,l===`refreshing`||l===`reconciling`?(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:l===`reconciling`?e===`pt-BR`?`Reconciliando itens em aberto…`:`Reconciling open work…`:e===`pt-BR`?`Atualizando dados…`:`Refreshing data…`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`Você pode continuar usando o dashboard.`:`You can keep using the dashboard.`})]})]}):null,c!==null&&l===null?(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-reconciliation-result`,role:`status`,children:[(0,g.jsx)(`strong`,{children:e===`pt-BR`?`Resultado da reconciliação manual`:`Manual reconciliation result`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`${c.reconciled_ids.length} item(ns) reconciliado(s).`:`${c.reconciled_ids.length} item(s) reconciled.`}),c.reconciled_ids.length>0?(0,g.jsx)(`p`,{children:c.reconciled_ids.join(`, `)}):null,c.blocked.length>0?(0,g.jsxs)(`p`,{children:[e===`pt-BR`?`Bloqueados: `:`Blocked: `,c.blocked.map(e=>`${e.id}${e.reason===null?``:` (${e.reason})`}`).join(`; `)]}):null,c.not_reconciled.length>0?(0,g.jsxs)(`p`,{children:[e===`pt-BR`?`Não reconciliados: `:`Not reconciled: `,c.not_reconciled.map(e=>`${e.id}${e.reason===null?``:` (${e.reason})`}`).join(`; `)]}):null,(0,g.jsx)(`button`,{onClick:S,type:`button`,children:e===`pt-BR`?`Fechar`:`Dismiss`})]}):null,i!==null&&l===null?(0,g.jsx)(b,{area:i,locale:e}):null]})}var ae=(0,m.lazy)(async()=>({default:(await P(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-v9zGRTlk.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),F=(0,m.lazy)(async()=>({default:(await P(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-BRdoeTWk.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),oe=(0,m.lazy)(async()=>({default:(await P(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-f4ZGJRg3.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),se=`/setup-pricing`,ce=`/setup-project`,I=`/cost-calculation-guide`;function le(e){let{api:t,costLocale:n,fxRate:r,navigate:i,pathname:a,pricing:o,refresh:s,setFxRate:c,setPricing:l}=e;return a===`/setup-pricing`?o===null?(0,g.jsxs)(`main`,{className:`app-state`,children:[(0,g.jsx)(`p`,{children:n===`pt-BR`?`Configuração do projeto`:`Project settings`}),(0,g.jsx)(`h1`,{children:n===`pt-BR`?`Carregando catálogo de preços…`:`Loading pricing catalog…`}),(0,g.jsx)(`button`,{onClick:()=>i(`/`),type:`button`,children:n===`pt-BR`?`Voltar ao dashboard`:`Back to dashboard`})]}):(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(ae,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`),onSave:async e=>{l(await t.savePricing(e)),await s()},onSaveFxRate:async e=>{c(await t.saveFxRate(e)),await s()}})}):a===`/cost-calculation-guide`&&o!==null?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(oe,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(F,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var ue=(0,m.lazy)(async()=>({default:(await P(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-B_5u4Xnp.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function de({costs:e,costLocale:t,currency:n,dashboardView:r,failedArea:i,lastUpdatedAt:a,loadCostDetail:o,loadCostReadModelPage:s,loadCostRunPage:c,loadCostGroupPage:u,loadingArea:d,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:h,onLocaleChange:_,onOpenTrace:v,onLoadMoreTraceTasks:b,onRefresh:S,onRetry:C,onSelectTraceTask:w,onOpenTraceChange:T,onOpenTraceMacro:E,operations:D,selectedTraceTaskId:O,trace:k,traceLoadingTaskId:ee,traceTasksHasMore:te,traceTasksLoading:A,traceTasks:ne}){return r===`cost-monitor`?e===null?()=>i===`costs`?(0,g.jsx)(x,{locale:t,onRetry:C}):(0,g.jsx)(y,{area:`costs`,locale:t}):r=>(0,g.jsx)(m.Suspense,{fallback:(0,g.jsx)(y,{area:`costs`,locale:t}),children:(0,g.jsx)(l,{currency:n,data:e,embedded:!0,globalFilters:r,lastUpdatedAt:a,locale:t,loading:d===`costs`,loadDetail:o,loadReadModelPage:s,loadRunPage:c,loadGroupPage:u,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:h,onLocaleChange:_,onOpenTrace:v,onRefresh:S,operations:D})}):r===`traceability`?()=>(0,g.jsx)(m.Suspense,{fallback:(0,g.jsx)(y,{area:`operations`,locale:t}),children:(0,g.jsx)(ue,{loadingTaskId:ee,locale:t,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),onLoadMoreTasks:b,onSelectTask:w,selectedTaskId:O,tasks:ne.length>0?ne:D.tasks,hasMoreTasks:te,isLoadingTasks:A,trace:k})}):r===null?(0,g.jsx)(`span`,{"aria-hidden":`true`,hidden:!0}):void 0}function fe({currency:e,locale:t,onCurrencyChange:n,onHelpOpen:r,onNavigate:i,pricingSetupPath:a,projectSetupPath:o,costCalculationGuidePath:s}){return(0,g.jsxs)(`div`,{className:`dashboard-global-settings`,children:[(0,g.jsxs)(`label`,{children:[(0,g.jsx)(`span`,{children:t===`pt-BR`?`Moeda`:`Currency`}),(0,g.jsxs)(`select`,{"aria-label":t===`pt-BR`?`Moeda`:`Currency`,onChange:e=>n(e.target.value),value:e,children:[(0,g.jsx)(`option`,{value:`BRL`,children:`BRL · Real brasileiro`}),(0,g.jsx)(`option`,{value:`USD`,children:`USD · US Dollar`})]})]}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:r,type:`button`,children:t===`pt-BR`?`Central de Ajuda`:`Open help and guides`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(a),type:`button`,children:t===`pt-BR`?`Configurar preços e câmbio`:`Configure pricing and FX`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(o),type:`button`,children:t===`pt-BR`?`Configurar projeto`:`Configure project`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(s),type:`button`,children:t===`pt-BR`?`Guia de cálculo de custos`:`Cost calculation guide`})]})}var pe={preset:`all`,range:a(`this-month`)};function L(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function R(e,t){let n=L(e),r=L(t);return n.from===r.from&&n.to===r.to}function me({model:e}){let{operations:t,error:n,globalLoadingPending:r,costLocale:i,refresh:a,snapshotNotice:o,setupRoute:s,failedArea:l,retryLastLoad:u,costs:d,currency:f,dashboardView:p,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:_,loadCostRunPage:v,loadCostGroupPage:y,loadingArea:b,setDisplayedCosts:x,setCurrency:S,setCostSurfaceLoading:C,changeDashboardLocale:w,loadMoreTraceTasks:T,openTrace:E,setRefreshDialog:D,setSelectedTraceTaskId:O,openTraceChange:k,openTraceMacro:A,renderedOperations:j,selectedTraceTaskId:M,trace:N,traceLoadingTaskId:P,traceTasksHasMore:re,traceTasksLoading:ae,traceTasks:F,capabilityNavigation:oe,boardTotals:le,boardKindTotals:ue,boardExportSource:pe,detailExportSource:L,boardStates:me,operationsPeriod:he,entityPage:ge,dashboardIdentity:_e,operationsLoading:ve,factualCostFact:ye,factualCostPeriods:be,setOperationsSurfaceLoading:xe,operationsSurfaceLoading:Se,currentCostByRun:Ce,loadOperationsEntityPage:we,loadOperationsLifecyclePage:Te,loadOperationsDetails:Ee,entityPageKind:z,loadFilteredOperationsPage:De,loadFilteredBoard:Oe,loadWorkListFilters:B,loadWorkListPage:ke,workListFiltersRef:Ae,boardFiltersRef:je,workListPage:Me,overviewStatusPages:Ne,loadOverviewStatusPage:Pe,overviewClassificationPages:V,loadOverviewClassificationPage:Fe,openDocument:Ie,api:Le,setError:Re,operationsPeriodRef:ze,setOperationsPeriod:Be,operationsDetailLoadedRef:Ve,operationsDetailCancelRef:He,operationsDetailAbortRef:Ue,operationsPageAbortRef:We,resetWorkListPage:Ge,operationsPageRequestVersionRef:Ke,refreshVersion:H,costSummaryAbortRef:U,costSummaryRequestVersion:qe,setEntityPage:W,costsLoadedRef:Je,setCosts:G,setPeriodTransitionPending:Ye,periodTransitionVersionRef:Xe,setLoadingArea:Ze,navigate:Qe,setHelpOpen:$e,closeDocument:et,documentDetail:tt,helpOpen:nt,reconciliationResult:rt,setReconciliationResult:it,refreshDialog:at,setTrace:ot,traceLink:st,setTraceLink:ct,refreshFromDialog:lt}=e,{loadMoreBoard:ut,overviewStatusPageKey:dt,overviewClassificationPageKey:ft,boardRequestVersionRef:K,boardAbortControllersRef:pt,boardInFlightRef:mt,boardInitialPageRef:ht,boardLoadedRef:gt,setBoardTotals:_t,setBoardKindTotals:vt,setBoardStates:yt,setOverviewStatusPages:bt,setOverviewClassificationPages:xt,setOperationsLoading:St}=e;return(0,g.jsxs)(ne,{error:n,globalLoadingPending:r,locale:i,onRefresh:()=>void a(),operations:t,snapshotNotice:o,setupRoute:s,children:[(0,g.jsxs)(te,{pending:r,children:[n?(0,g.jsxs)(`div`,{"aria-live":`assertive`,className:`app-warning app-error`,role:`alert`,children:[(0,g.jsx)(`span`,{children:n}),l?(0,g.jsx)(`button`,{onClick:u,type:`button`,children:i===`pt-BR`?`Tentar novamente`:`Try again`}):null,(0,g.jsx)(`button`,{"aria-label":i===`pt-BR`?`Fechar erro`:`Dismiss error`,onClick:()=>Re(null),type:`button`,children:`×`})]}):null,(0,g.jsx)(c,{alternateContent:de({costs:d,costLocale:i,currency:f,dashboardView:p,failedArea:l,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:_,loadCostRunPage:v,loadCostGroupPage:y,loadingArea:b,onActiveDataChange:x,onCurrencyChange:S,onLoadingChange:C,onLocaleChange:w,onLoadMoreTraceTasks:T,onOpenTrace:e=>void E(e),onRefresh:()=>D(`choose`),onRetry:u,onSelectTraceTask:e=>{O(e),E(e)},onOpenTraceChange:k,onOpenTraceMacro:A,operations:j,selectedTraceTaskId:M,trace:N,traceLoadingTaskId:P,traceTasksHasMore:re,traceTasksLoading:ae,traceTasks:F}),capabilityNavigation:oe,boardTotals:le,boardKindTotals:ue,boardExportSource:pe,detailExportSource:L,boardStates:me,data:j,lastUpdatedAt:m,datePreset:he.preset,dateRange:he.range,entityPage:ge,dashboardTitle:_e.title,repositoryName:_e.repositoryName,loading:ve,locale:i,currency:f,factualCostFact:ye,costLoading:d===null&&l!==`costs`,factualCostPeriods:be,onLoadingChange:xe,resolveRunCost:d===null?void 0:e=>Ce.get(e)??null,onLocaleChange:w,onDetailDataRequest:e=>{let t=e===`conversations`?`conversations`:e===`executions`?`executions`:e===`runs`?`runs`:null;t===null?e===`changes`||e===`decisions`?Te(e):Ee():we(t)},onLoadMacroMetrics:()=>{t?.summary.overview_metrics?.macro_metrics===void 0&&Ee()},onEntityPageChange:e=>{z===`changes`||z===`decisions`?Te(z,e):we(z,e)},onEntityFiltersChange:De,onBoardFiltersChange:Oe,onWorkListFiltersChange:B,onWorkListPageChange:e=>void ke(Ae.current,e),onBoardTypeChange:e=>Oe({...je.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void ke({...Ae.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void ut(e),workListPage:Me,statusPage:(e,t)=>Ne[dt(e,t)],onLoadStatusPage:(e,t,n)=>void Pe(e,t,n),classificationPage:(e,t)=>V[ft(e,t)],onLoadClassificationPage:(e,t,n)=>void Fe(e,t,n),onOpenDocument:(e,t)=>void Ie(e,t),onOpenTask:E,onPriorityChange:async e=>{try{await Le.saveWorkPriority(e)}catch(e){throw Re(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(R(ze.current,n)){Be(n);return}Ve.current=!1,He.current?.(),He.current=null,Ue.current?.abort(),Ue.current=null,We.current?.abort(),We.current=null,Ge(),++Ke.current,K.current+=1;for(let e of pt.current.values())e.abort();pt.current.clear(),mt.current.clear(),ht.current.clear(),gt.current={},_t({}),vt({}),yt({}),bt({}),xt({}),++H.current,U.current?.abort(),U.current=null,++qe.current,W({offset:0,total:null,loading:!1,error:null}),Je.current=!1,G(null),x(null),St(!0),Xe.current+=1,Ye(!0),Ze(`operations`),Be(n)},onRefresh:()=>D(`choose`),settings:(0,g.jsx)(fe,{costCalculationGuidePath:I,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>$e(!0),onNavigate:Qe,pricingSetupPath:se,projectSetupPath:ce})}),(0,g.jsx)(ie,{closeDocument:et,costLocale:i,documentDetail:tt,helpOpen:nt,loadingArea:b??(d===null&&l!==`costs`?`costs`:Se||Object.values(me).some(e=>e.loading)?`operations`:null),operations:j,reconciliationResult:rt,refreshDialog:at,showTrace:p===`traceability`,trace:N,traceLink:st,traceLoadingTaskId:P,onCloseHelp:()=>$e(!1),onCloseTrace:()=>ot(null),onDismissReconciliation:()=>it(null),onOpenDocument:(e,t)=>void Ie(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:A,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void lt(e),setTraceLink:e=>ct(e)})]}),r?(0,g.jsx)(ee,{}):null]})}var he=(e,t)=>`${e}:${t}`,ge=(e,t)=>`${e}:${t}`,_e=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],ve=`/zaip-cost-monitor`,ye=`zaip-dashboard-session-token`,be=`zaip-dashboard-locale`,xe=`zaip-dashboard-currency`;function Se(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function Ce(e){return e.replace(/\/+$/,``)===ve?`cost-monitor`:null}function we(){let e=new URL(window.location.href),t=e.searchParams.get(`token`)??window.localStorage.getItem(`zaip-dashboard-session-token`)??window.sessionStorage.getItem(`zaip-dashboard-session-token`)??``;return t&&(window.localStorage.setItem(ye,t),window.sessionStorage.setItem(ye,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var Te=class{token;constructor(e){this.token=e}ready(){return this.get(`/api/v2/ready`)}dashboardIdentity(){return this.get(`/api/v2/dashboard-identity`)}operations(e,t=`detail`,n,r=!1){let a=`${i.operations}?scope=${t}${r?`&fresh=1`:``}`;return this.get(B(a,e),n)}sqliteViewPage(e,t,n={},r){let i=new URLSearchParams({view:e,offset:String(n.offset??0)});return n.limit!==void 0&&i.set(`limit`,String(n.limit)),n.query&&i.set(`query`,n.query),n.status&&i.set(`status`,n.status),n.risk&&i.set(`risk`,n.risk),n.provider&&i.set(`provider`,n.provider),n.model&&i.set(`model`,n.model),n.agent&&i.set(`agent`,n.agent),n.phase&&i.set(`phase`,n.phase),n.origin&&i.set(`origin`,n.origin),n.workType&&i.set(`workType`,n.workType),n.priority&&i.set(`priority`,n.priority),n.kind&&i.set(`kind`,n.kind),this.get(B(`/api/v2/sqlite-views?${i.toString()}`,t),r)}operationsBoard(e,t,n=0,r,a,o=4){let s=new URLSearchParams({scope:`board`,stage:t,offset:String(n),limit:String(o)});return r?.query&&s.set(`query`,r.query),r?.status&&s.set(`status`,r.status),r?.risk&&s.set(`risk`,r.risk),r?.origin&&s.set(`origin`,r.origin),r?.kind&&s.set(`kind`,r.kind),this.get(B(`${i.operations}?${s.toString()}`,e),a)}traceabilityTasks(e=0,t=10){let n=new URLSearchParams({scope:`traceability`,offset:String(e),limit:String(t)});return this.get(`${i.operations}?${n}`)}operationsClassification(e,t,n,r=0,a,o=50){let s=new URLSearchParams({scope:`classification`,kind:t,classification:n,offset:String(r),limit:String(o)});return this.get(B(`${i.operations}?${s.toString()}`,e),a)}operationsEntityPage(e,t,n=0,r,a){let o=Ee(t,n,r);return this.get(B(`${i.operations}/runs?${o}`,e),a)}operationsLifecyclePage(e,t,n=0,r,a){let o=Ee(t,n,r);return this.get(B(`${i.operations}/entities?${o}`,e),a)}operationsReadModelPage(e,t,n=0,r=50,a=``,o){let s=new URLSearchParams({kind:t,offset:String(n),limit:String(r)});return a&&s.set(`query`,a),this.get(B(`${i.operations}/read-models?${s.toString()}`,e),o)}costMonitor(e=`BRL`,t,n=`detail`,r,a,o=!1){let s=new URLSearchParams({currency:e,scope:n});o&&s.set(`fresh`,`1`);for(let[e,t]of Object.entries(a??{}))t&&s.set(e,t);return this.get(B(`${i.costMonitor}?${s.toString()}`,t),r)}costMonitorRuns(e=`BRL`,t,n,r=100,a,o){let s=new URLSearchParams({currency:e,scope:`runs`,offset:String(n),limit:String(r)});for(let[e,t]of Object.entries(o??{}))t&&s.set(e,t);return this.get(B(`${i.costMonitor}?${s.toString()}`,t),a)}snapshot(e=`BRL`,t){return this.get(B(`${i.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(B(`${i.reconcileOpenWork}?currency=${e}`,t),De)}refreshProjection(e=`BRL`,t){return this.post(B(`${i.refreshProjection}?currency=${e}`,t),De)}task(e){return this.get(i.task(e))}prd(e){return this.get(i.prd(e))}spec(e){return this.get(i.spec(e))}taskTrace(e,t){return this.get(i.taskTrace(e),t)}pricing(){return this.get(`/api/v2/pricing`)}async savePricing(e){let t=await fetch(`/api/v2/pricing`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok)throw Error(`Pricing update failed with HTTP ${t.status}`);return await t.json()}fxRate(){return this.get(`/api/v2/fx-rate`)}agentCatalog(){return this.get(i.agentCatalog)}agentPortraitUrl(e){return`/api/v2/agent-catalog-assets/${encodeURIComponent(e)}?token=${encodeURIComponent(this.token)}`}projectSettings(){return this.get(i.projectSettings)}projectOverview(){return this.get(`${i.projectSettings}/overview`)}async saveWorkPriority(e){let t=await fetch(i.workPriority,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({item_ids:e})});if(!t.ok)throw Error(`Work priority update failed with HTTP ${t.status}`);return await t.json()}async saveProjectSettings(e){let t=await fetch(i.projectSettings,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Project settings update failed with HTTP ${t.status}`)}return await t.json()}async saveAgentCatalog(e){let t=e.map(({nickname_candidates:e,...t})=>t),n=await fetch(i.agentCatalog,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({agents:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Agent catalog update failed with HTTP ${n.status}`)}return await n.json()}async saveFxRate(e){let t=await fetch(`/api/v2/fx-rate`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({rate:e})});if(!t.ok)throw Error(`FX update failed with HTTP ${t.status}`);return await t.json()}async get(e,t){let n=await Oe(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},z,t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}async post(e,t=z){let n=await Oe(e,{method:`POST`,headers:{"x-zaip-session":this.token}},t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}};function Ee(e,t,n){let r=new URLSearchParams({kind:e,offset:String(t),limit:`100`});return n?.query&&r.set(`query`,n.query),n?.status&&r.set(`status`,n.status),n?.risk&&r.set(`risk`,n.risk),r.toString()}var z=6e4,De=18e4;async function Oe(e,t,n=z,r){let i=new AbortController,a=()=>i.abort();r?.addEventListener(`abort`,a,{once:!0}),r?.aborted&&i.abort();let o=window.setTimeout(()=>i.abort(),n);try{return await fetch(e,{...t,signal:i.signal})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`A leitura demorou mais de ${Math.ceil(n/1e3)} segundos. Tente novamente.`):e}finally{window.clearTimeout(o),r?.removeEventListener(`abort`,a)}}function B(e,t){if(t===void 0)return e;let n=new URL(e,`http://dashboard.local`);return t.from!==null&&n.searchParams.set(`from`,t.from),t.to!==null&&n.searchParams.set(`to`,t.to),`${n.pathname}${n.search}`}function ke(e){return e.projection_refresh_completed}function Ae(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&ke(e)}}var je={"pt-BR":{label:`Áreas do dashboard`,operations:`Operação`,operationsHint:`Trabalho em andamento e priorização`,costs:`Monitor de Custos`,costsHint:`Tempo, tokens e custo`,traceability:`Rastreabilidade`,traceabilityHint:`Ciclo completo em 6 etapas`},"en-US":{label:`Dashboard areas`,operations:`Operations`,operationsHint:`Lifecycle and work in progress`,costs:`Cost Monitor`,costsHint:`Time, tokens, and cost`,traceability:`Traceability`,traceabilityHint:`Complete 6-stage lifecycle`}};function Me({activeView:e,locale:t,onChange:n}){let r=je[t],i=e=>{n(e),window.requestAnimationFrame(()=>{document.querySelector(`.dashboard-global-controls`)?.scrollIntoView({behavior:`smooth`,block:`start`})})};return(0,g.jsxs)(`nav`,{"aria-label":r.label,className:`dashboard-capability-nav`,children:[(0,g.jsxs)(`button`,{"aria-current":e===`cost-monitor`?`page`:void 0,className:e===`cost-monitor`?`is-active`:void 0,onClick:()=>i(`cost-monitor`),type:`button`,children:[(0,g.jsx)(Pe,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.costs}),(0,g.jsx)(`small`,{children:r.costsHint})]})]}),(0,g.jsxs)(`button`,{"aria-current":e===`operations`?`page`:void 0,className:e===`operations`?`is-active`:void 0,onClick:()=>i(`operations`),type:`button`,children:[(0,g.jsx)(Ne,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.operations}),(0,g.jsx)(`small`,{children:r.operationsHint})]})]}),(0,g.jsxs)(`button`,{"aria-current":e===`traceability`?`page`:void 0,className:e===`traceability`?`is-active`:void 0,onClick:()=>i(`traceability`),type:`button`,children:[(0,g.jsx)(V,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.traceability}),(0,g.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function Ne(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-square-kanban`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`rect`,{height:`18`,rx:`2`,width:`18`,x:`3`,y:`3`}),(0,g.jsx)(`path`,{d:`M8 7v7`}),(0,g.jsx)(`path`,{d:`M12 7v4`}),(0,g.jsx)(`path`,{d:`M16 7v9`})]})}function Pe(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-circle-dollar-sign`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,g.jsx)(`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}),(0,g.jsx)(`path`,{d:`M12 18V6`})]})}function V(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-route`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`circle`,{cx:`6`,cy:`19`,r:`3`}),(0,g.jsx)(`path`,{d:`M9 19h6.5a3.5 3.5 0 0 0 0-7h-7a3.5 3.5 0 0 1 0-7H18`}),(0,g.jsx)(`circle`,{cx:`18`,cy:`5`,r:`3`})]})}function Fe(e){m.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Ie(e,t,n){return(0,g.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,g.jsx)(Me,{activeView:e,locale:t,onChange:n})})}function Le(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function Re(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function ze(e,t,n){let r=t??e;if(r?.currency!==n)return{fact:{state:`unavailable`,knownSum:null,coverage:null},periods:void 0};let i=r.overview.coverage[n===`USD`?`usd`:`brl`],a=n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,o={known:i,total:r.overview.run_count};return{fact:a===null?{state:`unavailable`,knownSum:null,coverage:o}:i<r.overview.run_count?{state:`partial`,knownSum:a,coverage:o}:{state:`complete`,knownSum:a,coverage:o},periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}}var Be={title:`Dashboard ZAIP AIOS`,repositoryName:``};function Ve(e,t){let n=typeof t.title==`string`?t.title.trim():``,r=typeof t.repository_name==`string`?t.repository_name.trim():``;return{title:n||e.title,repositoryName:r}}function He(e,t,n,r,i,a,o,s){s(null),e===`costs`?r():e===`traceability`&&t?i(t):e===`operations`&&n!==null?a():o()}function Ue(e,t,n,r,i,a,o,s,c){return le({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function We(e){return async t=>{if(e.setDashboardView(t),window.scrollTo({left:0,top:0}),t===`cost-monitor`?S({costsLoaded:e.costsLoadedRef.current,currency:e.currency,snapshotCurrency:e.costs?.currency})&&(e.costSummaryAbortRef.current===null||e.costSummaryAbortRef.current.signal.aborted)&&e.loadCostSummary():e.costSummaryAbortRef.current?.abort(),t===`traceability`){let t=e.traceTasks;if(t.length===0){let n=e.boardRequestVersionRef.current;if(t=await e.loadMoreTraceTasks(!1,!0),n!==e.boardRequestVersionRef.current)return;e.setTraceTasks(t)}let n=t.toSorted((e,t)=>Date.parse(t.finished_at??t.updated_at)-Date.parse(e.finished_at??e.updated_at)),r=n.find(e=>e.status===`completed`)??n[0];r&&(e.setSelectedTraceTaskId(r.id),e.openTrace(r.id));return}e.setTrace(null),e.setTraceLoadingTaskId(null)}}function Ge(e,t=new Date){return e.preset===`custom`?e:e.preset===`all`?{...e,range:a(`this-month`,t)}:{...e,range:a(e.preset,t)}}function Ke(e=new Date){let t=n(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let r=e.getTime(),i=r+1800*60*1e3;for(;n(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-r>1;){let e=Math.floor((r+i)/2);n(new Date(e).toISOString(),`day`)===t?r=e:i=e}return Math.max(1,i-e.getTime()+25)}function H(e){return typeof e==`number`?e:null}function U(e){return typeof e==`number`?{known_sum:e,unknown:0,complete:!0,coverage_ratio:1}:{known_sum:0,unknown:1,complete:!1,coverage_ratio:0}}function qe(e){return Object.hasOwn(e,`total_duration`)?H(e.total_duration):H(e.cost_monitor_total_duration)}function W(e,t,n){let{filters:r,query:i}=e;return{offset:t,limit:n,...i===void 0||i===``?{}:{query:i},...r.provider?{provider:r.provider}:{},...r.model?{model:r.model}:{},...r.agent?{agent:r.agent}:{},...r.phase?{phase:r.phase}:{},...r.status?{status:r.status}:{},...r.origin?{origin:r.origin}:{},...r.workType?{workType:r.workType}:{},...r.priority?{priority:r.priority}:{},...r.risk?{risk:r.risk}:{}}}function Je(e){let t=qe(e),n=Number(e.duration_unknown??+(t===null)),r=t??H(e.duration_known)??0;return{key:String(e.key??e.period_key??`total`),label:String(e.label??e.key??e.period_key??``),latest_started_at:typeof e.latest_started_at==`string`?e.latest_started_at:``,persona:typeof e.persona==`string`?e.persona:null,job:typeof e.job==`string`?e.job:null,run_count:Number(e.total_run_count??e.invocation_count??0),task_count:H(e.task_count),conversation_count:Number(e.conversation_count??0),prd_count:H(e.prd_count),spec_count:H(e.spec_count),evidence_count:H(e.evidence_count),test_count:H(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:H(e.total_tokens),estimated_usd:H(e.total_cost_usd),estimated_brl:H(e.total_cost_brl),duration_ms:t,duration:{known_sum:r,unknown:n,complete:n===0,coverage_ratio:+(n===0)},coverage:{events:0,tokens:0,usd:0,brl:0}}}async function G(e,t){let{from:n,limit:r,offset:i,signal:a,to:o,view:s}=t,c=n===void 0||o===void 0?void 0:{from:n,to:o};if(s===`daily`){let n=await e.sqliteViewPage(`cost_monitor_daily`,c,W(t,i,r),a);return{offset:n.offset,limit:n.limit,total_count:n.total_count,has_more:n.has_more,rows:n.rows.map(Je),...n.period_averages===void 0?{}:{period_averages:n.period_averages},...n.totals===void 0?{}:{totals:Je(n.totals)}}}let l={monthly:`cost_monitor_monthly`,annual:`cost_monitor_annual`,agents:`cost_monitor_zaip_agents`,models:`cost_monitor_models`,providers:`cost_monitor_providers`}[s],u=await e.sqliteViewPage(l,c,W(t,i,r),a);return{offset:u.offset,limit:u.limit,total_count:u.total_count,has_more:u.has_more,rows:u.rows.map(Je),...u.period_averages===void 0?{}:{period_averages:u.period_averages},...u.totals===void 0?{}:{totals:Je(u.totals)}}}async function Ye(e,t){let{filters:n,from:r,limit:i=10,offset:a,signal:o,to:s}=t,c=await e.sqliteViewPage(`cost_monitor_agent_invocations`,r===void 0||s===void 0?void 0:{from:r,to:s},{offset:a,limit:i,...n?.query?{query:n.query}:{},...n?.provider?{provider:n.provider}:{},...n?.model?{model:n.model}:{},...n?.agent?{agent:n.agent}:{},...n?.phase?{phase:n.phase}:{},...n?.status?{status:n.status}:{},...n?.priority?{priority:n.priority}:{},...n?.risk?{risk:n.risk}:{},...n?.origin?{origin:n.origin}:{},...n?.workType?{workType:n.workType}:{}},o);return{page_only:!0,runs:c.rows.map(Xe),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function Xe(e){let t=(e,t)=>typeof e==`string`?e:t,n=e=>typeof e==`number`?e:null,r=t(e.agent_invocation_id,`unavailable`),i=typeof e.task_id==`string`?e.task_id:null,a=typeof e.spec_id==`string`?e.spec_id:null,o=typeof e.prd_id==`string`?e.prd_id:null,s=t(e.phase,`execution`),c=e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`estimated`||e.duration_provenance===`legacy_inferred`?e.duration_provenance:`unavailable`,l=Object.hasOwn(e,`calculated_cost_usd`)?n(e.calculated_cost_usd):n(e.cost_usd),u=n(e.current_fx_rate)??n(e.fx_rate),d=n(e.recorded_cost_usd)??n(e.recorded_usd),f=Object.hasOwn(e,`recorded_fx_rate`)?n(e.recorded_fx_rate):n(e.fx_rate),p=n(e.recorded_brl)??(!Object.hasOwn(e,`recorded_brl`)&&d!==null?n(e.cost_brl):null),m=l!==null&&u!==null?Math.round(l*u*1e6)/1e6:null;return{run_id:r,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:t(e.run_id,r),task_id:i,task_title:t(e.task_title,i??`Tarefa avulsa`),task_status:t(e.task_status,`unavailable`),priority:t(e.priority,`unavailable`),risk:t(e.risk,`unavailable`),spec_id:a,prd_id:o,change_id:typeof e.change_id==`string`?e.change_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_role:e.invocation_kind===`subagent`?`subagent`:`orchestrator`,run_kind:e.run_kind===`subrun`?`subrun`:`run`,run_purpose:`execution`,requires_finalizer:!1,client:t(e.client,`unavailable`),agent:t(e.zaip_agent,`unavailable`),agent_name:t(e.zaip_agent,`unavailable`),provider:typeof e.provider==`string`?e.provider:null,model:t(e.model,`unavailable`),requested_model:t(e.requested_model,`unavailable`),reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,effective_reasoning_effort:typeof e.effective_reasoning_effort==`string`?e.effective_reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,call_count:n(e.llm_call_count),status:t(e.status,`completed`),phase:s,origin:o===null?a===null?i===null?`conversation`:`task`:`spec`:`prd`,work_type:e.work_type===`rework`?`rework`:`new`,started_at:t(e.occurred_at,``),finished_at:typeof e.finished_at==`string`?e.finished_at:null,duration_ms:n(e.duration_ms),duration_provenance:c,estimation_basis:typeof e.estimation_basis==`string`?e.estimation_basis:null,source_started_at:typeof e.source_started_at==`string`?e.source_started_at:null,source_finished_at:typeof e.source_finished_at==`string`?e.source_finished_at:null,capture_lag_ms:n(e.capture_lag_ms),event_count:n(e.source_event_count),input_tokens:n(e.input_tokens),cached_input_tokens:n(e.cached_input_tokens),output_tokens:n(e.output_tokens),reasoning_tokens:n(e.reasoning_tokens),total_tokens:n(e.total_tokens),uncached_input_tokens:n(e.uncached_input_tokens),visible_output_tokens:n(e.visible_output_tokens),input_rate_usd_per_million:n(e.input_rate_usd_per_million),cached_input_rate_usd_per_million:n(e.cached_input_rate_usd_per_million),output_rate_usd_per_million:n(e.output_rate_usd_per_million),reasoning_rate_usd_per_million:n(e.reasoning_rate_usd_per_million),context_input_multiplier:n(e.context_input_multiplier),context_output_multiplier:n(e.context_output_multiplier),speed_cost_multiplier:n(e.speed_cost_multiplier),standard_cost_usd:n(e.standard_cost_usd),speed_uplift_usd:n(e.speed_uplift_usd),input_cost_usd:n(e.input_cost_usd),cached_input_cost_usd:n(e.cached_input_cost_usd),output_cost_usd:n(e.output_cost_usd),reasoning_cost_usd:n(e.reasoning_cost_usd),fx_rate:u,estimated_usd:l,estimated_brl:m,recorded_usd:d,recorded_brl:p,recorded_fx_rate:f,coverage:{events:0,tokens:0,usd:0,brl:0},artifact_path:`.agents/records/runs/${r}`}}function Ze(e,t){let n=t.totals,r=e=>U(n?.[e]);return{data_source:`lifecycle_daily_read_models`,snapshot_id:null,source_latest_at:null,kind:e,offset:t.offset,limit:t.limit,total:t.total_count,has_more:t.has_more,next_cursor:null,subtotal:{entity_count:typeof n?.entity_count==`number`?n.entity_count:t.total_count,run_count:r(`invocation_count`),metrics:{duration:r(`total_duration`),total_tokens:r(`total_tokens`),cost_brl:r(`total_cost_brl`),cost_usd:r(`total_cost_usd`)}},rows:t.rows.map(t=>({id:String(t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??t.id??`unavailable`),title:String(t.title??t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??`Unavailable`),kind:e===`tasks`?`task`:e===`specs`?`spec`:e===`prds`?`prd`:e===`executions`?`execution`:`conversation`,status:typeof t.status==`string`?t.status:null,risk:typeof t.risk==`string`?t.risk:null,occurred_at:typeof t.occurred_at==`string`?t.occurred_at:typeof t.started_at==`string`?t.started_at:typeof t.last_day==`string`?`${t.last_day}T12:00:00.000Z`:``,parent_id:null,run_count:Number(t.invocation_count??0),cost_currency:`BRL`,metrics:{duration:U(t.total_duration),total_tokens:U(t.total_tokens),cost:U(t.total_cost_brl)}}))}}function Qe(e){return{loadCostDetail:(0,m.useCallback)(async()=>{throw Error(`SQLite Cost Monitor loads the selected paginated view; full detail is disabled.`)},[]),loadCostReadModelPage:(0,m.useCallback)(async({filters:t,from:n,kind:r,limit:i,offset:a,query:o,signal:s,to:c})=>{let l={tasks:`cost_monitor_tasks`,specs:`cost_monitor_specs`,prds:`cost_monitor_prds`,executions:`cost_monitor_executions`,conversations:`cost_monitor_conversations`}[r];return Ze(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...t.query||o?{query:t.query||o}:{},...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.agent?{agent:t.agent}:{},...t.phase?{phase:t.phase}:{},...t.status?{status:t.status}:{},...t.origin?{origin:t.origin}:{},...t.workType?{workType:t.workType}:{},...t.priority?{priority:t.priority}:{},...t.risk?{risk:t.risk}:{}},s))},[e]),loadCostRunPage:(0,m.useCallback)(t=>Ye(e,t),[e]),loadCostGroupPage:(0,m.useCallback)(t=>G(e,t),[e])}}function $e(e,t){return!1}function et(e,t=window,n=0){let r=!1,i=!1,a=new AbortController,o=t.setTimeout(()=>{r||i||(i=!0,e(a.signal))},n);return()=>{r||(r=!0,a.abort(),t.clearTimeout(o))}}var tt=2e3,nt=5e3,rt=1e4,it=3e4,at=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function ot(e,t){return e&&t<90}function st(e,t){return e===`visible`?nt:t>0?it:rt}function ct(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function lt(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function ut({observedRevision:e,pendingRevision:t,requestedRevision:n,succeeded:r}){return r?{observedRevision:n,pendingRevision:t===n?null:t}:{observedRevision:e,pendingRevision:t}}function dt({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function ft({api:e,costLocale:t,currency:n,dashboardView:r,loadOperationsDetails:i,operations:a,operationsDetailAbortRef:o,operationsDetailCancelRef:s,operationsPageAbortRef:c,pathname:l,pricing:u,refresh:d,refreshVersion:f,snapshotUpdating:p,setSnapshotUpdating:h,setError:g,setFxRate:_,setPathname:v,setPricing:y}){let b=(0,m.useRef)(!1),x=(0,m.useRef)(0),S=(0,m.useRef)(null),C=(0,m.useRef)(!1),w=(0,m.useRef)(null);(0,m.useEffect)(()=>(d(),()=>{s.current?.(),s.current=null,o.current?.abort(),o.current=null,c.current?.abort(),c.current=null,++f.current}),[o,s,c,d,f]),(0,m.useEffect)(()=>{let e=()=>{let e=Date.now();dt({inFlight:b.current,lastRefreshAt:x.current,now:e,visibilityState:document.visibilityState})&&(x.current=e,b.current=!0,d(!1,!1,!0).finally(()=>{b.current=!1}))};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[d]),(0,m.useEffect)(()=>{if(!p)return;let t=!1,n=0,r=null,i=async()=>{if(!(t||!ot(!0,n))){n+=1;try{let n=await e.ready();if(t)return;if(n.snapshot_state===`current`){h(!1),await d(!1,!1,!1,!0);return}}catch{}if(!t){if(ot(!0,n)){r=window.setTimeout(()=>void i(),tt);return}h(!1),g(at)}}};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,g,h,p]),(0,m.useEffect)(()=>{let t=!1,n=0,r=null,i=()=>{if(t||C.current)return;let e=w.current;e!==null&&(C.current=!0,d(!1,!1,!1,!0).then(t=>{t&&h(!1);let n=ut({observedRevision:S.current,pendingRevision:w.current,requestedRevision:e,succeeded:t});S.current=n.observedRevision,w.current=n.pendingRevision}).finally(()=>{C.current=!1,w.current!==e&&i()}))},a=async()=>{try{let r=await e.ready();if(t)return;n=0;let a=S.current;lt(r.snapshot_state,r.snapshot_revision)&&(a===null&&(S.current=r.snapshot_revision),ct(a,r.snapshot_revision)&&(w.current=r.snapshot_revision,i()))}catch{n+=1}t||(r=window.setTimeout(()=>void a(),st(document.visibilityState,n)))};return a(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,h]),(0,m.useEffect)(()=>{if(!$e(r,a?.summary.overview_metrics?.partial===!0))return;let e=et(async e=>{await i(e)});return s.current=e,()=>{s.current===e&&(s.current=null),e()}},[r,i,a?.summary.overview_metrics?.partial,s]),(0,m.useEffect)(()=>window.localStorage.setItem(be,t),[t]),(0,m.useEffect)(()=>window.localStorage.setItem(xe,n),[n]),(0,m.useEffect)(()=>{[`/`,`/setup-pricing`,`/setup-project`].includes(window.location.pathname)||(window.history.replaceState(null,``,`/${window.location.search}${window.location.hash}`),v(`/`))},[v]),(0,m.useEffect)(()=>{let e=()=>v(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,m.useEffect)(()=>{l!==`/setup-pricing`||u!==null||Promise.all([e.pricing(),e.fxRate()]).then(([e,t])=>{y(e),_(t)}).catch(e=>g(String(e)))},[e,l,u,g,_,y])}var K={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}};function pt(e,t,n){let r=e=>e===`intake`||e===`orchestration`||e===`execution`||e===`review`||e===`audit`||e===`finalization`?e:`execution`,i=n.rows.map(e=>({id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status===`running`||e.status===`failed`||e.status===`cancelled`?e.status:`completed`,phase:e.phase??`execution`,entrypoint:e.conversation_id===null?`task`:`conversation`,work_type:`new`,run_role:e.run_kind===`subrun`?`subagent`:`orchestrator`,run_kind:e.run_kind??`run`,run_purpose:r(e.run_purpose),requires_finalizer:!1,parent_run_id:e.parent_run_id,client:e.client??`unknown`,agent:e.agent??`unknown`,agent_name:e.agent??`unknown`,agent_persona:e.agent_persona??null,agent_job:e.agent_job??null,provider:e.provider??null,model:e.model??`unknown`,reasoning_effort:e.reasoning_effort??null,effective_model:e.model??null,effective_reasoning_effort:e.reasoning_effort??null,effective_config_mixed:e.pricing_mixed??!1,service_tier:e.service_tier??null,call_count:e.llm_call_count??null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:null,prd_id:null,change_id:null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms===void 0?e.duration_ms:e.source_duration_ms,duration_provenance:e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`legacy_inferred`||e.duration_provenance===`estimated`?e.duration_provenance:`unavailable`,llm_call_count:e.llm_call_count??null,input_tokens:e.input_tokens??null,cached_input_tokens:e.cached_input_tokens??null,uncached_input_tokens:e.uncached_input_tokens??null,output_tokens:e.output_tokens??null,reasoning_tokens:e.reasoning_tokens??null,visible_output_tokens:e.visible_output_tokens??null,input_rate_usd_per_million:e.input_rate_usd_per_million??null,cached_input_rate_usd_per_million:e.cached_input_rate_usd_per_million??null,output_rate_usd_per_million:e.output_rate_usd_per_million??null,reasoning_rate_usd_per_million:e.reasoning_rate_usd_per_million??null,context_input_multiplier:e.context_input_multiplier??null,context_output_multiplier:e.context_output_multiplier??null,speed_cost_multiplier:e.speed_cost_multiplier??null,pricing_scenario:e.pricing_scenario??null,standard_cost_usd:e.standard_cost_usd??null,speed_uplift_usd:e.speed_uplift_usd??null,input_cost_usd:e.input_cost_usd??null,cached_input_cost_usd:e.cached_input_cost_usd??null,output_cost_usd:e.output_cost_usd??null,reasoning_cost_usd:e.reasoning_cost_usd??null,calculated_cost_usd:e.calculated_cost_usd??null,recorded_cost_usd:e.recorded_cost_usd??null,cost_variance_usd:e.cost_variance_usd??null,cost_usd:e.cost_usd??null,cost_brl:e.currency===`BRL`?e.cost:null,fx_rate:e.fx_rate??null,pricing_segment_count:e.pricing_segment_count??null,pricing_mixed:e.pricing_mixed??!1,pricing_model:e.pricing_model??null,pricing_source:e.pricing_source??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},usage:{conversation:K,planning:K,execution:{...K,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},total:{...K,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},new_work:K,rework:K}}));return{...e,runs:i,executions:t===`executions`||t===`conversations`?n.rows.map((e,n)=>{let r=i[n];if(r===void 0)throw Error(`Operations entity page must have a projected run for every row.`);let a=r.execution_id??r.conversation_id,o=e.status??`unavailable`;return{id:a,kind:t===`conversations`?`interaction`:`delivery`,created_at:r.started_at,status:o,work_status:o,origin:t===`conversations`?{type:`interaction`,conversation_id:r.conversation_id}:{type:`task`,task_id:r.task_id??`unavailable`},dag:{nodes:[],topological_order:[]},result:null,artifact_path:`.agents/records/executions/${a}`,agent_call_count:0,orchestrator_run_count:0,subagent_run_count:0,finalizer_run_count:0,finalized_task_count:0,llm_call_count:0,llm_call_count_complete:!1,task_count:0,spec_count:0,prd_count:0,duration_ms:r.source_duration_ms??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},total_tokens:r.usage.total.tokens.total,cost_brl:r.usage.total.cost.brl}}):e.executions}}function mt(e){if(typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function ht({api:e,entityFiltersRef:t,operationsPageAbortRef:n,operationsPageRequestVersionRef:r,operationsPeriod:i,operationsPeriodRef:a,refreshVersion:o,setEntityPage:s,setEntityPageKind:c,setOperations:l}){return{loadOperationsEntityPage:(0,m.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=L(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,L(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t={runs:`operations_agent_invocations`,executions:`operations_executions`,conversations:`operations_conversations`}[u],n=await e.sqliteViewPage(t,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),r={kind:u,offset:n.offset,limit:n.limit,total:n.total_count,aggregation:`canonical_entity`,rows:n.rows.map(e=>({id:String(e.agent_invocation_id??e.execution_id??e.conversation_id??e.id),started_at:String(e.occurred_at??e.started_at??`1970-01-01T00:00:00.000Z`),finished_at:typeof e.finished_at==`string`?e.finished_at:null,task_id:typeof e.task_id==`string`?e.task_id:null,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:typeof e.conversation_id==`string`?e.conversation_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_kind:e.invocation_kind===`delegated`||e.invocation_kind===`subagent`?`subrun`:e.invocation_kind===`orchestrator`?`run`:null,run_purpose:typeof e.purpose==`string`?e.purpose:null,phase:typeof e.phase==`string`?e.phase:null,status:typeof e.status==`string`?e.status:null,agent:typeof e.zaip_agent==`string`?e.zaip_agent:null,agent_persona:typeof e.zaip_agent_persona==`string`?e.zaip_agent_persona:null,agent_job:typeof e.zaip_agent_job==`string`?e.zaip_agent_job:null,client:typeof e.client==`string`?e.client:null,provider:typeof e.provider==`string`?e.provider:null,model:typeof e.model==`string`?e.model:null,reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,duration_ms:typeof e.duration_ms==`number`?e.duration_ms:typeof e.total_duration==`number`?e.total_duration:null,source_duration_ms:typeof e.source_duration_ms==`number`?e.source_duration_ms:null,duration_provenance:typeof e.duration_provenance==`string`?e.duration_provenance:null,llm_call_count:typeof e.llm_call_count==`number`?e.llm_call_count:null,input_tokens:typeof e.input_tokens==`number`?e.input_tokens:null,cached_input_tokens:typeof e.cached_input_tokens==`number`?e.cached_input_tokens:null,uncached_input_tokens:typeof e.uncached_input_tokens==`number`?e.uncached_input_tokens:null,output_tokens:typeof e.output_tokens==`number`?e.output_tokens:null,reasoning_tokens:typeof e.reasoning_tokens==`number`?e.reasoning_tokens:null,visible_output_tokens:typeof e.visible_output_tokens==`number`?e.visible_output_tokens:null,total_tokens:typeof e.total_tokens==`number`?e.total_tokens:null,input_rate_usd_per_million:typeof e.input_rate_usd_per_million==`number`?e.input_rate_usd_per_million:null,cached_input_rate_usd_per_million:typeof e.cached_input_rate_usd_per_million==`number`?e.cached_input_rate_usd_per_million:null,output_rate_usd_per_million:typeof e.output_rate_usd_per_million==`number`?e.output_rate_usd_per_million:null,reasoning_rate_usd_per_million:typeof e.reasoning_rate_usd_per_million==`number`?e.reasoning_rate_usd_per_million:null,context_input_multiplier:typeof e.context_input_multiplier==`number`?e.context_input_multiplier:null,context_output_multiplier:typeof e.context_output_multiplier==`number`?e.context_output_multiplier:null,speed_cost_multiplier:typeof e.speed_cost_multiplier==`number`?e.speed_cost_multiplier:null,pricing_scenario:typeof e.pricing_scenario==`string`?e.pricing_scenario:null,standard_cost_usd:typeof e.standard_cost_usd==`number`?e.standard_cost_usd:null,speed_uplift_usd:typeof e.speed_uplift_usd==`number`?e.speed_uplift_usd:null,input_cost_usd:typeof e.input_cost_usd==`number`?e.input_cost_usd:null,cached_input_cost_usd:typeof e.cached_input_cost_usd==`number`?e.cached_input_cost_usd:null,output_cost_usd:typeof e.output_cost_usd==`number`?e.output_cost_usd:null,reasoning_cost_usd:typeof e.reasoning_cost_usd==`number`?e.reasoning_cost_usd:null,calculated_cost_usd:typeof e.calculated_cost_usd==`number`?e.calculated_cost_usd:null,recorded_cost_usd:typeof e.recorded_cost_usd==`number`?e.recorded_cost_usd:null,cost_variance_usd:typeof e.cost_variance_usd==`number`?e.cost_variance_usd:null,cost_usd:typeof e.cost_usd==`number`?e.cost_usd:null,fx_rate:typeof e.fx_rate==`number`?e.fx_rate:null,pricing_segment_count:typeof e.pricing_segment_count==`number`?e.pricing_segment_count:null,pricing_mixed:e.pricing_mixed===1||e.pricing_mixed===!0,pricing_model:typeof e.audit_pricing_model==`string`?e.audit_pricing_model:typeof e.pricing_model==`string`?e.pricing_model:null,pricing_source:typeof e.audit_pricing_source==`string`?e.audit_pricing_source:typeof e.pricing_source==`string`?e.pricing_source:null,cost:typeof e.total_cost_brl==`number`?e.total_cost_brl:typeof e.cost_brl==`number`?e.cost_brl:null,currency:`BRL`}))};if(!_())return;l(e=>e===null?e:pt(e,u,r)),s({offset:r.offset,total:r.total,loading:!1,error:null,aggregation:r.aggregation})}catch(e){if(!_()||E(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l]),loadOperationsLifecyclePage:(0,m.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=L(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,L(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t=await e.sqliteViewPage(u===`changes`?`operations_changes`:`operations_decisions`,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),n=u===`changes`?t.rows.map(e=>{let t=String(e.source_type),n=String(e.source_id);return{id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:null,status:typeof e.status==`string`?e.status:`unclassified`,risk:typeof e.risk==`string`?e.risk:`unclassified`,source:t===`spec`?{type:`spec`,spec_id:n}:t===`prd`?{type:`prd`,prd_id:n,spec_id:null}:{type:`task`,task_id:n},requirement_ids:mt(e.requirement_ids_json),acceptance_ids:mt(e.acceptance_ids_json),task_ids:mt(e.task_ids_json),result:typeof e.result==`string`?e.result:null,artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id)}}):t.rows.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),origin:e.origin===`human`?`human`:`agent`,scope_type:e.scope_type===`execution`?`execution`:`change`,scope_id:String(e.scope_id),artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:`1970-01-01T00:00:00.000Z`})),r={kind:u,offset:t.offset,limit:t.limit,total:t.total_count,rows:n};if(!_())return;l(e=>e===null?e:{...e,...u===`changes`?{changes:r.rows}:{decisions:r.rows}}),s({offset:r.offset,total:r.total,loading:!1,error:null})}catch(e){if(!_()||E(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l])}}function gt({api:e,operations:t,setError:n,setFailedArea:r,setLoadingArea:i}){let[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)([]),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(0),h=(0,m.useRef)(0),g=(0,m.useRef)(null),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(``);async function x(a){let c=++h.current;g.current?.abort();let l=new AbortController;g.current=l,n(null),r(null),o(null),v(a),i(`traceability`),await new Promise(e=>window.requestAnimationFrame(()=>e()));try{let n=await e.taskTrace(a,l.signal);if(h.current!==c)return!1;let r=s.find(e=>e.id===a)??t?.tasks.find(e=>e.id===a);return o({...n,task_title:r?.title||n.task_title||a,task_risk:r?.risk||n.task_risk||null,task_created_at:r?.created_at||n.task_created_at||null,task_progress:n.task_progress??r?.progress??0}),!0}catch(e){return l.signal.aborted||h.current!==c?!1:(n(e instanceof Error?e.message:String(e)),r(`traceability`),!1)}finally{h.current===c&&(g.current===l&&(g.current=null),v(null),i(e=>e===`traceability`?null:e))}}function S(e){let n=t?.changes.find(t=>t.id===e);n!==void 0&&(o(null),f({kind:`change`,row:n}))}function C(e,n){let r=(e===`PRD`?t?.prds:t?.specs)?.find(e=>e.id===n);r!==void 0&&(o(null),f({kind:`macro`,label:e,row:r}))}async function w(n,r){let i=(n===`prd`?t?.prds:t?.specs)?.find(e=>e.id===r);if(!i)return;let a=++p.current,o=n===`prd`?`PRD`:`SPEC`;u({kind:n,label:o,preview:i});try{let t=n===`prd`?await e.prd(r):await e.spec(r);if(p.current!==a)return;u({kind:n,label:o,preview:i,detail:t})}catch(e){if(p.current!==a)return;u({kind:n,label:o,preview:i,error:e instanceof Error?e.message:String(e)})}}function T(){p.current+=1,u(null)}return{closeDocument:T,documentDetail:l,openDocument:w,openTrace:x,openTraceChange:S,openTraceMacro:C,selectedTraceTaskId:y,setSelectedTraceTaskId:b,setTrace:o,setTraceLink:f,setTraceLoadingTaskId:v,setTraceTasks:c,trace:a,traceLink:d,traceLoadingTaskId:_,traceTasks:s}}function _t({cursor:e,page:t,tasks:n}){let r=new Map(n.map(e=>[e.id,e]));for(let e of t.tasks)r.set(e.id,e);let i=e.offset+t.tasks.length;return{tasks:[...r.values()],cursor:t.tasks.length===0||i>=t.total?{offset:0,stageIndex:e.stageIndex+1}:{...e,offset:i}}}function vt(e,t,n){return Math.min(t,e+n)}function yt(e,t,n){let r=(0,m.useRef)(t),i=(0,m.useRef)({offset:0,stageIndex:0}),a=(0,m.useRef)(!1),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{r.current=t},[t]),{loadMoreTraceTasks:(0,m.useCallback)(async(t=!1,o=!1)=>{if(a.current||(o&&(i.current={offset:0,stageIndex:0},r.current=[],n([]),s(!0)),i.current.stageIndex>=1))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=await e.traceabilityTasks(a.offset,10),s=_t({cursor:a,page:o,tasks:r.current});if(r.current=s.tasks,n(r.current),i.current=s.cursor,o.tasks.length>0&&!t)break}while(i.current.stageIndex<1);return s(i.current.stageIndex<1),r.current}finally{a.current=!1,l(!1)}},[e,n]),traceTasksHasMore:o,traceTasksLoading:c}}function bt({api:e,boardAbortControllersRef:t,boardFilterKeyRef:n,boardFiltersRef:r,boardInFlightRef:i,boardInitialPageRef:a,boardLoadedRef:o,boardRequestVersionRef:s,dashboardView:c,operations:l,operationsPeriod:u,operationsPeriodRef:d,overviewStatusInFlightRef:f,quickOverviewMetricsRef:p,setBoardKindTotals:h,setBoardStates:g,setBoardTotals:_,setOperations:v,setOverviewClassificationPages:y,setOverviewStatusPages:b}){let x=(0,m.useCallback)(()=>{s.current+=1;for(let e of t.current.values())e.abort();t.current.clear(),i.current.clear(),a.current.clear(),o.current={},_({}),h({}),g({}),b({}),y({})},[t,i,a,o,s,h,g,_,y,b]),S=(0,m.useCallback)(async n=>{if(l===null||i.current.has(n))return;i.current.add(n),t.current.get(n)?.abort();let a=new AbortController;t.current.set(n,a);let c=s.current,f=L(u);g(e=>({...e,[n]:{loading:!0,error:null}}));let p=o.current[n]??0;try{let t=await e.operationsBoard(f,n,p,r.current,a.signal,10);if(a.signal.aborted||c!==s.current||f.from!==L(d.current).from||f.to!==L(d.current).to)return;v(e=>e===null?e:{...k(e,[t]),summary:e.summary}),_(e=>({...e,[n]:t.total})),h(e=>({...e,[n]:t.totals_by_kind})),o.current={...o.current,[n]:p+t.prds.length+t.specs.length+t.tasks.length}}catch(e){if(a.signal.aborted||c!==s.current||E(e))return;g(t=>({...t,[n]:{loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{c===s.current&&(i.current.delete(n),t.current.get(n)===a&&t.current.delete(n),g(e=>e[n]?.error===null?{...e,[n]:{loading:!1,error:null}}:e))}},[e,t,r,i,o,s,l,u,d,h,g,_,v]),C=(0,m.useCallback)(e=>{let t={...e,kind:e.kind??r.current.kind??``},i=`${t.query}|${t.status}|${t.risk}|${t.origin??``}|${t.kind}`;i!==n.current&&(n.current=i,r.current=t,x(),v(e=>e===null?e:{...e,prds:[],specs:[],tasks:[],changes:[],summary:i===`||||`&&p.current!==void 0?{...e.summary,overview_metrics:p.current}:e.summary}))},[n,r,p,x,v]),w=(0,m.useCallback)(async(t,n,r)=>{let i=he(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=L(u);b(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsBoard(c,t,r,{kind:n===`task`?`all-tasks`:n});if(o!==s.current||c.from!==L(d.current).from||c.to!==L(d.current).to)return;let l=n===`task`?a.tasks:n===`spec`?a.specs:a.prds;b(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||E(e))return;b(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,b]),T=(0,m.useCallback)(async(t,n,r)=>{let i=ge(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=L(u);y(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsClassification(c,t,n,r);if(o!==s.current||c.from!==L(d.current).from||c.to!==L(d.current).to)return;let l=t===`task`?a.tasks:t===`spec`?a.specs:a.prds;y(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||E(e))return;y(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,y]),D=(0,m.useCallback)(t=>{let n={...r.current,...t},i=L(u);return{prepare:async()=>{let t=await Promise.all(_e.map(t=>e.operationsBoard(i,t,0,n))),r=e=>[...e.prds.map(({kind:e,...t})=>({kind:`prd`,...t})),...e.specs.map(({kind:e,...t})=>({kind:`spec`,...t})),...e.tasks.map(e=>({kind:`task`,...e}))];return{totalRows:t.reduce((e,t)=>e+t.total,0),pages:async function*(){for(let a of t){let t=a,o=0;for(;;){let a=r(t);if(a.length===0||(o+=a.length,yield a,o>=t.total))break;t=await e.operationsBoard(i,t.stage,o,n)}}}}}}},[e,r,u]);return(0,m.useEffect)(()=>{if(c!==`operations`||l===null)return;let e=!1,t=s.current,n=()=>!e&&t===s.current,r=async()=>{if(!n())return;let e=_e.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let t=0;t<e.length&&n();t+=3){let r=e.slice(t,t+3);if(!n())return;for(let e of r)a.current.add(e);await Promise.all(r.map(e=>S(e)))}},o=window.setTimeout(()=>void r(),0);return()=>{e=!0,window.clearTimeout(o)}},[i,a,s,c,S,l]),{boardExportSource:D,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function xt(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function St(e,t,n){return e===`explicit`||t!==n}function Ct(e,t){return{...e,kind:e.kind??t.kind??``}}var wt={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function Tt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,m.useState)(wt),a=(0,m.useRef)({query:``,status:``,risk:``}),o=(0,m.useRef)(null),s=(0,m.useRef)(0),c=(0,m.useRef)(null),l=(0,m.useCallback)(async(r,l=0,u=`explicit`)=>{let d=L(t),f=Ct(r,a.current),p=xt(f,d);if(!St(u,p,c.current))return;o.current?.abort();let m=new AbortController;o.current=m;let h=++s.current;a.current=f,c.current=p;let g=f.kind||`all`;i(e=>({...e,offset:l,typeFilter:g,loading:!0,error:null}));try{let t=await e.sqliteViewPage(`operations_work_list`,d,{offset:l,limit:10,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{},...f.origin?{origin:f.origin}:{},...g===`all`?{}:{kind:g}},m.signal);if(m.signal.aborted||h!==s.current||d.from!==L(n.current).from||d.to!==L(n.current).to)return;i({offset:t.offset,limit:t.limit,total:t.total_count,hasMore:t.has_more,typeFilter:g,rows:t.rows,loading:!1,error:null})}catch(e){if(m.signal.aborted||h!==s.current)return;c.current===p&&(c.current=null),i(t=>({...t,offset:l,typeFilter:g,loading:!1,error:e instanceof Error?e.message:String(e)}))}finally{o.current===m&&(o.current=null)}},[e,t,n]),u=(0,m.useCallback)(()=>{o.current?.abort(),o.current=null,++s.current,c.current=null,i(wt)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,m.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}async function*Et(e,t){let n=e;for(;;){if(n.rows.length===0)return;yield n.rows;let e=n.offset+n.rows.length;if(!n.has_more||e>=n.total_count)return;n=await t(e)}}function Dt({api:e,operationsPeriod:t}){return(0,m.useCallback)((n,r)=>{let i=L(t);if(n===`work-kanban`)return;let a={"work-list":`operations_work_list`,changes:`operations_changes`,decisions:`operations_decisions`,executions:`operations_executions`,runs:`operations_agent_invocations`,conversations:`operations_conversations`,daily:`operations_daily`,monthly:`operations_monthly`,yearly:`operations_annual`}[n];if(a===void 0)return;let o=e=>({offset:e,limit:100,...r.query?{query:r.query}:{},...r.status?{status:r.status}:{},...r.risk?{risk:r.risk}:{},...r.origin?{origin:r.origin}:{},...a===`operations_work_list`&&r.kind?{kind:r.kind}:{}});return{prepare:async()=>{let t=await e.sqliteViewPage(a,i,o(0));return{totalRows:t.total_count,pages:()=>Et(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var q=1500;function Ot({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function kt(e,t,n){let[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!e||!t||r){o(!1);return}let n=window.setTimeout(()=>o(!0),q);return()=>window.clearTimeout(n)},[t,r,e]),Ot({snapshotUpdating:e,initialDataPending:t,dismissed:r,delayElapsed:a})?(0,g.jsxs)(`div`,{"aria-live":`polite`,className:`app-notice app-snapshot-status`,role:`status`,children:[(0,g.jsx)(`span`,{children:`Exibindo o último snapshot local validado. Os dados canônicos estão sendo atualizados em segundo plano e estarão atuais na próxima abertura.`}),(0,g.jsx)(`button`,{"aria-label":n===`pt-BR`?`Fechar aviso de atualização do snapshot`:`Dismiss snapshot update notice`,onClick:()=>i(!0),type:`button`,children:`×`})]}):null}function At(){Fe(we());let[e,t]=(0,m.useState)(!1),n=(0,m.useMemo)(we,[]),r=(0,m.useMemo)(()=>new Te(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=Qe(r),[c,l]=(0,m.useState)(()=>Ce(window.location.pathname)),u=(0,m.useRef)(c);u.current=c;let[d,f]=(0,m.useState)(null),[p,h]=(0,m.useState)({offset:0,total:null,loading:!1,error:null}),[g,_]=(0,m.useState)(`runs`),v=(0,m.useRef)({query:``,status:``,risk:``}),[y,b]=(0,m.useState)({}),[x,O]=(0,m.useState)({}),[k,ee]=(0,m.useState)({}),[te,A]=(0,m.useState)({}),[ne,j]=(0,m.useState)({}),[M,N]=(0,m.useState)(null),[P,re]=(0,m.useState)(null),[ie,ae]=(0,m.useState)(Se),[F,oe]=(0,m.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),se=(0,m.useRef)(F);se.current=F;let ce=(0,m.useCallback)(e=>{ae(e),oe(e===`en-US`?`USD`:`BRL`)},[]),[I,le]=(0,m.useState)(()=>pe),ue=I.preset===`all`?null:I.range.start,de=I.preset===`all`?null:I.range.end,fe=(0,m.useMemo)(()=>({from:ue,to:de}),[ue,de]),R=(0,m.useRef)(I);R.current=I;let me=(0,m.useRef)(null),[_e,ve]=(0,m.useState)(!1),[ye,be]=(0,m.useState)(null),[xe,Ee]=(0,m.useState)(null),[z,De]=(0,m.useState)(window.location.pathname),[Oe,B]=(0,m.useState)(!0),[ke,je]=(0,m.useState)(!1),[,Me]=(0,m.useState)(!1),[,Ne]=(0,m.useState)(!1),[Pe,V]=(0,m.useState)(`operations`),[H,U]=(0,m.useState)(null),[qe,W]=(0,m.useState)(null);(0,m.useEffect)(()=>{r.ready().then(e=>t(e.snapshot_state===`updating`)).catch(()=>{})},[r]);let[Je,G]=(0,m.useState)(null),[Ye,Xe]=(0,m.useState)(null),[Ze,$e]=(0,m.useState)(null),[et,tt]=(0,m.useState)(Be),nt=(0,m.useCallback)(e=>{tt(t=>Ve(t,e))},[]);(0,m.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||nt(t)}).catch(()=>{}),()=>{e=!0}},[r,nt]);let{closeDocument:rt,documentDetail:it,openDocument:at,openTrace:ot,openTraceChange:st,openTraceMacro:ct,selectedTraceTaskId:lt,setSelectedTraceTaskId:ut,setTrace:dt,setTraceLink:K,setTraceLoadingTaskId:pt,setTraceTasks:mt,trace:_t,traceLink:vt,traceLoadingTaskId:xt,traceTasks:St}=gt({api:r,operations:d,setError:G,setFailedArea:U,setLoadingArea:V}),{loadMoreTraceTasks:Ct,traceTasksHasMore:wt,traceTasksLoading:Et}=yt(r,St,mt),q=(0,m.useRef)(0),Ot=(0,m.useRef)(0),At=(0,m.useRef)(!1),J=(0,m.useRef)(0),jt=(0,m.useRef)(0),Y=(0,m.useRef)(null),X=(0,m.useRef)(!1),Z=(0,m.useRef)(!1),Mt=(0,m.useRef)(null),Q=(0,m.useRef)(null),Nt=(0,m.useRef)(null),Pt=(0,m.useRef)(0),Ft=(0,m.useRef)({}),It=(0,m.useRef)(new Set),Lt=(0,m.useRef)(new Map),Rt=(0,m.useRef)(new Set),zt=(0,m.useRef)(new Set),Bt=(0,m.useRef)({query:``,status:``,risk:``,origin:``,kind:``}),Vt=(0,m.useRef)(`||||`),Ht=(0,m.useRef)(0),Ut=(0,m.useRef)(void 0),{workListPage:Wt,workListFiltersRef:Gt,loadWorkListFilters:Kt,loadWorkListPage:qt,resetWorkListPage:Jt}=Tt({api:r,operationsPeriod:I,operationsPeriodRef:R}),Yt=(0,m.useRef)(!1),$=(0,m.useCallback)(async(e=!0,n=!1,i=!1,a=!1)=>{Mt.current?.(),Mt.current=null,Q.current?.abort(),Q.current=null,Ht.current+=1;for(let e of Lt.current.values())e.abort();Lt.current.clear(),It.current.clear(),zt.current.clear(),Ft.current={},b({}),O({}),ee({}),A({}),j({});let o=++q.current,s=Ot.current,c=u.current,l=fe,d=()=>w(o,q.current)&&T(o,q.current,l,L(R.current));e&&(B(!0),V(`operations`)),G(null),U(null);try{if(n){let e=await r.reconcileOpenWork(F,l),n=Ae(e,d());if(Xe(n.reconciliation),n.dismissProgressDialog&&W(null),!n.applySnapshotState)return!1;if(t(e.snapshot_state===`updating`),n.reloadQuickProjection){let e=await r.operations(l,`quick`,void 0,!0);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,Z.current=!1,$e(e.summary.latest_token_collected_at??null)}}else if(i){let e=await r.refreshProjection(F,l);if(!d())return!1;f(e.operations),Ut.current=e.operations.summary.overview_metrics,Z.current=!0,N(e.costs),X.current=!0,re(null);let t=e.dashboard;t&&tt(e=>Ve(e,t)),$e(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,Yt.current),F===`USD`||a?r.costMonitor(F,l,`summary`):Promise.resolve(null)]);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,Z.current=!1,t!==null&&(N(t),X.current=!1,re(null)),$e(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(G(e instanceof Error?e.message:String(e)),U(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&D(s,Ot.current)&&Ne(!1),e&&d()&&(B(!1),V(e=>e===`operations`?null:e))}},[r,F,fe]),Xt=(0,m.useCallback)(async e=>{if(Z.current||At.current||e?.aborted)return null;Q.current?.abort();let t=e===void 0?new AbortController:null,n=e??t?.signal;if(n===void 0)return null;t!==null&&(Q.current=t),At.current=!0,J.current+=1,V(`costs`),U(null);try{let e=++q.current,t=L(I),i=()=>w(e,q.current)&&T(e,q.current,t,L(R.current)),a=await r.operations(t,`detail`,n);return i()?(f(a),Z.current=!0,a):null}catch(e){return n.aborted||E(e)?null:(G(e instanceof Error?e.message:String(e)),U(`operations`),null)}finally{t!==null&&Q.current===t&&(Q.current=null),At.current=!1,J.current=Math.max(0,J.current-1),J.current===0&&V(e=>e===`costs`?null:e)}},[r,I]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=ht({api:r,entityFiltersRef:v,operationsPageAbortRef:Nt,operationsPageRequestVersionRef:Pt,operationsPeriod:I,operationsPeriodRef:R,refreshVersion:q,setEntityPage:h,setEntityPageKind:_,setOperations:f}),$t=(0,m.useCallback)((e,t)=>{v.current=t,e===`changes`||e===`decisions`?Qt(e,0,t):Zt(e,0,t)},[Zt,Qt]),{boardExportSource:en,loadFilteredBoard:tn,loadMoreBoard:nn,loadOverviewClassificationPage:rn,loadOverviewStatusPage:an,resetBoard:on}=bt({api:r,boardAbortControllersRef:Lt,boardFilterKeyRef:Vt,boardFiltersRef:Bt,boardInFlightRef:It,boardInitialPageRef:zt,boardLoadedRef:Ft,boardRequestVersionRef:Ht,dashboardView:c,operations:d,operationsPeriod:I,operationsPeriodRef:R,overviewStatusInFlightRef:Rt,quickOverviewMetricsRef:Ut,setBoardKindTotals:O,setBoardStates:ee,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:j,setOverviewStatusPages:A}),sn=Dt({api:r,operationsPeriod:I}),cn=async e=>{e&&Xe(null),W(e?`reconciling`:`refreshing`);try{await $(!1,e,!e)}finally{W(null)}};(0,m.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{le(e=>{let t=Ge(e);return t!==e&&(me.current=t),t}),t()},Ke())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,m.useEffect)(()=>{me.current===I&&(me.current=null,$(!1,!1,!0,!0))},[I,$]),ft({api:r,costLocale:ie,currency:F,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:Q,operationsDetailCancelRef:Mt,operationsPageAbortRef:Nt,pathname:z,pricing:ye,refresh:$,refreshVersion:q,setSnapshotUpdating:t,setError:G,setFxRate:Ee,setPathname:De,setPricing:be,snapshotUpdating:e});let ln=Le(De),un=(0,m.useCallback)(async()=>{Y.current?.abort();let e=new AbortController;Y.current=e;let t=++jt.current,n=L(I);J.current+=1,V(`costs`),G(null),U(null);try{let i=await r.costMonitor(F,n,`summary`,e.signal),a=L(R.current);if(!C({aborted:e.signal.aborted,currentCurrency:se.current,currentPeriod:a,currentRequestVersion:jt.current,requestVersion:t,requestedCurrency:F,requestedPeriod:n}))return;N(i),X.current=!0,re(null)}catch(n){if(e.signal.aborted||t!==jt.current)return;G(n instanceof Error?n.message:String(n)),U(`costs`)}finally{J.current=Math.max(0,J.current-1),J.current===0&&V(e=>e===`costs`?null:e),Y.current===e&&(Y.current=null)}},[r,F,I]);(0,m.useEffect)(()=>{F!==`USD`||M?.currency===F||un()},[M?.currency,F,un]),(0,m.useEffect)(()=>{d===null||H===`costs`||Y.current!==null||S({costsLoaded:X.current,currency:F,snapshotCurrency:M?.currency})&&un()},[M?.currency,F,H,un,d]);let dn=We({setDashboardView:l,costsLoadedRef:X,currency:F,costs:M,loadCostSummary:un,costSummaryAbortRef:Y,traceTasks:St,boardRequestVersionRef:Ht,loadMoreTraceTasks:Ct,setTraceTasks:mt,setSelectedTraceTaskId:ut,openTrace:ot,setTrace:dt,setTraceLoadingTaskId:pt}),fn=Re(M,P,F),{fact:pn,periods:mn}=ze(M,P,F),hn=()=>He(H,lt,d,un,ot,Xt,$,G),gn=Ue(r,ie,xe,ln,z,ye,$,Ee,be);return{loadMoreBoard:nn,overviewStatusPageKey:he,overviewClassificationPageKey:ge,boardRequestVersionRef:Ht,boardAbortControllersRef:Lt,boardInFlightRef:It,boardInitialPageRef:zt,boardLoadedRef:Ft,setBoardTotals:b,setBoardKindTotals:O,setBoardStates:ee,setOverviewStatusPages:A,setOverviewClassificationPages:j,setOperationsLoading:B,operations:d,error:Je,globalLoadingPending:F===`USD`&&M?.currency!==F,costLocale:ie,refresh:async()=>{await $()},snapshotNotice:kt(e,d===null&&Oe,ie),setupRoute:gn,failedArea:H,retryLastLoad:hn,costs:M,currency:F,dashboardView:c,lastUpdatedAt:Ze,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:Pe,setDisplayedCosts:re,setCurrency:oe,setCostSurfaceLoading:Me,changeDashboardLocale:ce,loadMoreTraceTasks:Ct,openTrace:ot,setRefreshDialog:W,setSelectedTraceTaskId:ut,openTraceChange:st,openTraceMacro:ct,selectedTraceTaskId:lt,trace:_t,traceLoadingTaskId:xt,traceTasksHasMore:wt,traceTasksLoading:Et,traceTasks:St,capabilityNavigation:Ie(c,ie,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:k,operationsPeriod:I,entityPage:p,dashboardIdentity:et,operationsLoading:Oe,factualCostFact:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:je,operationsSurfaceLoading:ke,currentCostByRun:fn,loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt,loadOperationsDetails:Xt,entityPageKind:g,loadFilteredOperationsPage:$t,loadFilteredBoard:tn,loadWorkListPage:qt,loadWorkListFilters:Kt,workListFiltersRef:Gt,boardFiltersRef:Bt,workListPage:Wt,overviewStatusPages:te,loadOverviewStatusPage:an,overviewClassificationPages:ne,loadOverviewClassificationPage:rn,openDocument:at,api:r,setError:G,operationsPeriodRef:R,setOperationsPeriod:le,operationsDetailLoadedRef:Z,operationsDetailCancelRef:Mt,operationsDetailAbortRef:Q,operationsPageAbortRef:Nt,resetWorkListPage:Jt,operationsPageRequestVersionRef:Pt,resetBoard:on,refreshVersion:q,costSummaryAbortRef:Y,costSummaryRequestVersion:jt,setEntityPage:h,costsLoadedRef:X,setCosts:N,setPeriodTransitionPending:Ne,periodTransitionVersionRef:Ot,setLoadingArea:V,navigate:ln,setHelpOpen:ve,closeDocument:rt,documentDetail:it,helpOpen:_e,reconciliationResult:Ye,setReconciliationResult:Xe,refreshDialog:qe,setTrace:dt,traceLink:vt,setTraceLoadingTaskId:pt,setTraceLink:K,refreshFromDialog:cn,renderedOperations:d}}async function J(e){let t=await(await fetch(`/api/v2/health`,{cache:`no-store`,signal:e})).json();if(t?.kind!==`zaip-dashboard-sqlite-runtime`||typeof t.workspace!=`string`||typeof t.workspace_name!=`string`||![`initialized`,`missing`,`invalid`].includes(t.lifecycle_manifest_state))throw Error(`Identidade do Dashboard indisponível`);return t}function jt(){let[e,t]=(0,m.useState)(null),[n,r]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=!1,n,i;async function a(){i=new AbortController;let o=setTimeout(()=>i.abort(),4e3);try{let n=await J(i.signal);e||(t(n),r(!1))}catch{e||r(!0)}finally{clearTimeout(o),e||(n=setTimeout(a,5e3))}}return a(),()=>{e=!0,clearTimeout(n),i?.abort()}},[]),{status:e,unavailable:n}}function Y({status:e,unavailable:t=!1}){let n=e?.lifecycle_manifest_state;return n===`initialized`&&e?.status===`ok`&&!t?null:(0,g.jsx)(`aside`,{className:`workspace-status`,"aria-label":`Saúde do Dashboard`,children:n===`missing`||n===`invalid`?(0,g.jsxs)(`div`,{className:`workspace-status__warning`,role:`alert`,children:[(0,g.jsx)(`strong`,{children:n===`missing`?`Lifecycle não inicializado`:`Manifesto do lifecycle inválido`}),(0,g.jsx)(`p`,{children:`Os dados deste workspace estão indisponíveis. Na pasta do projeto, execute:`}),(0,g.jsx)(`code`,{children:`node .agents/runtime/bin/zaip.mjs manifest rebuild --confirm-full-scan`})]}):e?.status===`degraded`||t?(0,g.jsx)(`p`,{className:`workspace-status__warning`,role:`status`,children:t?`Não foi possível consultar a saúde do Dashboard. Tentando novamente…`:`Dashboard degradado: a atualização dos dados ou da telemetria requer atenção.`}):(0,g.jsx)(`p`,{className:`workspace-status__warning`,role:`status`,children:`Identificando a saúde do Dashboard…`})})}function X(){let e=At(),t=jt();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Y,{...t}),t.status?.lifecycle_manifest_state===`initialized`?(0,g.jsx)(me,{model:e}):null]})}var Z=document.getElementById(`root`);if(!Z)throw Error(`Elemento #root não encontrado`);(0,h.createRoot)(Z).render((0,g.jsx)(m.StrictMode,{children:(0,g.jsx)(X,{})}));export{vt as n,jt as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-j3aUYH5G.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
1
+ import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-D7PrDZy9.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
3
  `+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`