@zaip-ai/cli 2.6.0 → 3.1.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 (312) hide show
  1. package/README.md +36 -13
  2. package/dist/services/adapters.d.ts +1 -1
  3. package/dist/services/adapters.d.ts.map +1 -1
  4. package/dist/services/adapters.js +5 -2
  5. package/dist/services/adapters.js.map +1 -1
  6. package/dist/services/agent-adapters.js +12 -9
  7. package/dist/services/agent-adapters.js.map +1 -1
  8. package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
  9. package/dist/services/codex-conversation-lifecycle-hook.js +32 -21
  10. package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
  11. package/dist/services/install-agents-template.js +9 -1
  12. package/dist/services/install-agents-template.js.map +1 -1
  13. package/dist/services/runtime-template.test.js +25 -2
  14. package/dist/services/runtime-template.test.js.map +1 -1
  15. package/dist/services/transactional-files.d.ts.map +1 -1
  16. package/dist/services/transactional-files.js +59 -14
  17. package/dist/services/transactional-files.js.map +1 -1
  18. package/package.json +1 -1
  19. package/templates/.agents/README-ENG.md +75 -10
  20. package/templates/.agents/README.md +76 -10
  21. package/templates/.agents/config/agents/catalog.yaml +3 -0
  22. package/templates/.agents/config/agents/discovery.json +2 -2
  23. package/templates/.agents/config/clients/codex/agents/zaip-agent-analyst.toml +1 -1
  24. package/templates/.agents/config/clients/codex/agents/zaip-agent-auditor.toml +1 -1
  25. package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +1 -1
  26. package/templates/.agents/config/clients/codex/agents/zaip-agent-brand-strategist.toml +1 -1
  27. package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +1 -1
  28. package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +1 -1
  29. package/templates/.agents/config/clients/codex/agents/zaip-agent-data-analyst.toml +1 -1
  30. package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +1 -1
  31. package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +2 -2
  32. package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +1 -1
  33. package/templates/.agents/config/clients/codex/agents/zaip-agent-general-operations.toml +1 -1
  34. package/templates/.agents/config/clients/codex/agents/zaip-agent-governance-compliance.toml +1 -1
  35. package/templates/.agents/config/clients/codex/agents/zaip-agent-growth-strategist.toml +1 -1
  36. package/templates/.agents/config/clients/codex/agents/zaip-agent-integrator.toml +1 -1
  37. package/templates/.agents/config/clients/codex/agents/zaip-agent-marketing-analyst.toml +1 -1
  38. package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +13 -10
  39. package/templates/.agents/config/clients/codex/agents/zaip-agent-refactoring-specialist.toml +1 -1
  40. package/templates/.agents/config/clients/codex/agents/zaip-agent-reviewer.toml +1 -1
  41. package/templates/.agents/config/clients/codex/agents/zaip-agent-sales-specialist.toml +1 -1
  42. package/templates/.agents/config/clients/codex/agents/zaip-agent-security-auditor.toml +1 -1
  43. package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +1 -1
  44. package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +1 -1
  45. package/templates/.agents/config/clients/codex/agents/zaip-agent-writer.toml +1 -1
  46. package/templates/.agents/config/project.yaml +10 -1
  47. package/templates/.agents/dashboard/.zaip-managed.json +274 -138
  48. package/templates/.agents/dashboard/README.md +16 -0
  49. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-CGxeQak4.js → CostCalculationGuidePage-CEDZjl4V.js} +1 -1
  50. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-tzS7YxYB.js → DashboardHelpDialog-DIWDmvAS.js} +930 -550
  51. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-DEbCi1gP.js → PricingSettingsDialog-BBRBKaHa.js} +1 -1
  52. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-B9GWkEyN.css +1 -0
  53. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BAvLPAee.js +3 -0
  54. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-t1Om0Abw.js → TraceabilityWorkspace-C9dDhj34.js} +1 -1
  55. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-06__WZco.js +68 -0
  56. package/templates/.agents/dashboard/apps/frontend/dist/assets/dashboard-localization-CoAVMZN6.js +828 -0
  57. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DiGC-dsJ.js → icons-vendor-DEmo6Tn2.js} +1 -1
  58. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-BVzw_Wux.js +2 -0
  59. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-kPO6yNed.js → react-vendor-CadYsm83.js} +1 -1
  60. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-BzKK8kK3.js +1 -0
  61. package/templates/.agents/dashboard/apps/frontend/dist/index.html +5 -5
  62. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  63. package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +10 -5
  64. package/templates/.agents/dashboard/apps/frontend/src/AutonomySettings.tsx +82 -0
  65. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.dom.test.ts +38 -7
  66. package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +164 -171
  67. package/templates/.agents/dashboard/apps/frontend/src/__tests__/app-composition-support.ts +6 -1
  68. package/templates/.agents/dashboard/apps/frontend/src/cost-monitor-population.test.tsx +149 -0
  69. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-settings.ts +2 -1
  70. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +19 -0
  71. package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +22 -1
  72. package/templates/.agents/dashboard/apps/frontend/src/dashboard-cost-facts.test.ts +54 -0
  73. package/templates/.agents/dashboard/apps/frontend/src/dashboard-cost-facts.ts +20 -2
  74. package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.test.ts +37 -43
  75. package/templates/.agents/dashboard/apps/frontend/src/dashboard-localization.ts +9 -251
  76. package/templates/.agents/dashboard/apps/frontend/src/dashboard-project-overview.ts +34 -7
  77. package/templates/.agents/dashboard/apps/frontend/src/dashboard-view-actions.test.ts +51 -0
  78. package/templates/.agents/dashboard/apps/frontend/src/dashboard-view-actions.ts +3 -1
  79. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +35 -0
  80. package/templates/.agents/dashboard/apps/frontend/src/operations-period.test.ts +19 -4
  81. package/templates/.agents/dashboard/apps/frontend/src/operations-period.ts +5 -3
  82. package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.test.ts +112 -23
  83. package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.ts +49 -12
  84. package/templates/.agents/dashboard/apps/frontend/src/project-settings-copy.ts +181 -0
  85. package/templates/.agents/dashboard/apps/frontend/src/project-settings-model.ts +11 -1
  86. package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +34 -51
  87. package/templates/.agents/dashboard/apps/frontend/src/project-settings-state.css +55 -0
  88. package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +12 -0
  89. package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +1 -1
  90. package/templates/.agents/dashboard/apps/frontend/src/traceability-task-pagination.ts +1 -2
  91. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +6 -0
  92. package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +2 -0
  93. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +3 -1
  94. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-task-pagination.ts +4 -15
  95. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +2 -2
  96. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  97. package/templates/.agents/dashboard/modules/cost-monitor/src/complete-cost-average.test.ts +73 -0
  98. package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +9 -0
  99. package/templates/.agents/dashboard/modules/cost-monitor/src/period-averages.ts +60 -0
  100. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +8 -22
  101. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +2 -3
  102. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostPeriodAverageCards.tsx +32 -8
  103. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-summary.ts +3 -2
  104. package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +1 -42
  105. package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +2 -1
  106. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +3 -2
  107. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +8 -2
  108. package/templates/.agents/dashboard/modules/cost-monitor/src/server/index.ts +1 -0
  109. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  110. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview-keeps-structure-classes-mutually-exclusive.test.ts +4 -3
  111. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.helpers.tsx +66 -3
  112. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +71 -1
  113. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +36 -30
  114. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +5 -14
  115. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +3 -0
  116. package/templates/.agents/dashboard/modules/operations/src/react/OverviewCostKpi.tsx +46 -0
  117. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +28 -1
  118. package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +11 -4
  119. package/templates/.agents/dashboard/modules/operations/src/react/index.ts +1 -0
  120. package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +2 -2
  121. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +28 -8
  122. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +19 -2
  123. package/templates/.agents/dashboard/modules/operations/src/react/overview-cost-card.test.tsx +89 -0
  124. package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +3 -3
  125. package/templates/.agents/dashboard/modules/operations/src/work-board-model.ts +2 -1
  126. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  127. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  128. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  129. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  130. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +279 -245
  131. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +247 -215
  132. package/templates/.agents/dashboard/packages/local-runtime/package.json +2 -2
  133. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +15 -25
  134. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +279 -245
  135. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +1 -1
  136. package/templates/.agents/dashboard/packages/local-runtime/src/project-installation-summary.test.ts +142 -0
  137. package/templates/.agents/dashboard/packages/local-runtime/src/project-installation-summary.ts +190 -0
  138. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +65 -0
  139. package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +67 -66
  140. package/templates/.agents/dashboard/packages/local-runtime/src/server-browser-lease.test.ts +91 -0
  141. package/templates/.agents/dashboard/packages/local-runtime/src/server-browser-lease.ts +24 -4
  142. package/templates/.agents/dashboard/packages/local-runtime/src/server-hono-security.test.ts +17 -0
  143. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +21 -2
  144. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.test.ts +94 -2
  145. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.ts +62 -12
  146. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +26 -0
  147. package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +4 -1
  148. package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-task-trace.test.ts +97 -0
  149. package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-task-trace.ts +10 -13
  150. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +2 -10
  151. package/templates/.agents/dashboard/packages/local-runtime/src/server-traceability-index.test.ts +84 -0
  152. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +15 -1
  153. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-calendar.ts +17 -0
  154. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cold-parse.test.ts +78 -0
  155. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-dimension-facts.test.ts +12 -1
  156. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.test.ts +94 -0
  157. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-group-projection.ts +5 -5
  158. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-duration-lookup.test.ts +59 -0
  159. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-entity-label-views.test.ts +72 -0
  160. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-file-index.test.ts +69 -0
  161. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-first-fold-cache.ts +3 -1
  162. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-force-canonical.test.ts +3 -1
  163. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-incremental-refresh.test.ts +2 -0
  164. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-projections.ts +9 -0
  165. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-runs.ts +4 -5
  166. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-period-averages.ts +46 -0
  167. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-provider-alias-parity.test.ts +50 -0
  168. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.test.ts +171 -0
  169. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.ts +36 -16
  170. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts +13 -2
  171. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +25 -7
  172. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-temporal-dimension.ts +2 -0
  173. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical-parsing.ts +7 -0
  174. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical.ts +5 -15
  175. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +34 -10
  176. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +17 -3
  177. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +1 -1
  178. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +11 -0
  179. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +5 -4
  180. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.test.ts +54 -1
  181. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-source-fingerprint.ts +7 -3
  182. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +4 -1
  183. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-risk-population.test.ts +98 -0
  184. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +29 -16
  185. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +2 -1
  186. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-snapshot-seed.test.ts +2 -0
  187. package/templates/.agents/dashboard/packages/local-runtime/src/verify-project-settings.mjs +57 -0
  188. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  189. package/templates/.agents/dashboard/scripts/qualify-observability.mjs +130 -0
  190. package/templates/.agents/dashboard/scripts/verify-autonomy-settings.mjs +175 -0
  191. package/templates/.agents/dashboard/scripts/verify-observability.mjs +254 -0
  192. package/templates/.agents/dashboard/scripts/verify-project-setup.mjs +64 -0
  193. package/templates/.agents/dashboard/tests/e2e/lease-global-setup.ts +37 -0
  194. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  195. package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +5 -3
  196. package/templates/.agents/dashboard/tests/e2e/specs/cost-monitor-period-transition.spec.ts +22 -1
  197. package/templates/.agents/dashboard/tests/e2e/specs/dashboard-performance-matrix.spec.ts +17 -8
  198. package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +47 -6
  199. package/templates/.agents/dashboard/tests/e2e/specs/lease-lifetime.spec.ts +14 -0
  200. package/templates/.agents/dashboard/tests/observability-fixture.mjs +200 -0
  201. package/templates/.agents/design/.zaip-managed.json +84 -40
  202. package/templates/.agents/design/apps/catalog/dist/assets/index-BJV597iq.js +72 -0
  203. package/templates/.agents/design/apps/catalog/dist/assets/index-BOjCcUaU.js +72 -0
  204. package/templates/.agents/design/apps/catalog/dist/assets/index-B_WhrCZe.js +72 -0
  205. package/templates/.agents/design/apps/catalog/dist/assets/index-CqtYXZfV.js +72 -0
  206. package/templates/.agents/design/apps/catalog/dist/assets/index-D_lfqoyx.js +72 -0
  207. package/templates/.agents/design/apps/catalog/dist/assets/index-i_PO2k9R.js +9 -0
  208. package/templates/.agents/design/apps/catalog/dist/index.html +1 -1
  209. package/templates/.agents/design/apps/catalog/dist/storybook/assets/CatalogShell-Cstn1UwA.js +1 -0
  210. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{Color-6AOWCN3U-B-kAgAjB.js → Color-6AOWCN3U-Cm-yJJz_.js} +1 -1
  211. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-D1WopB2L.js +137 -0
  212. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-DQ9PJ3N3.js +1 -0
  213. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{DocsRenderer-JROSPFPF-BVN7xHtv.js → DocsRenderer-JROSPFPF-Belk4jRr.js} +4 -4
  214. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{WithTooltip-7X4HQR7L-CDHtKYkz.js → WithTooltip-7X4HQR7L-DoPvjkS1.js} +1 -1
  215. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-DRQKCCAG-D6AsDkMK.js → chunk-DRQKCCAG-B1itKXEN.js} +1 -1
  216. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{chunk-W22LQPXL-B4m5uloN.js → chunk-W22LQPXL-C-Eb5SPY.js} +1 -1
  217. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{components-CN8YyTUg.js → components-DnyKLwhj.js} +5 -5
  218. package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-D0OSgxWz.js +1 -0
  219. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{iframe-9yZfIsdT.js → iframe-DcXBsFPz.js} +3 -3
  220. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{react-18-BoCSnq6H.js → react-18-CRM89QRf.js} +1 -1
  221. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-C3tkVMIp.js +1 -0
  222. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{syntaxhighlighter-YFXUGROL-Bnn_nMwJ.js → syntaxhighlighter-YFXUGROL-B03jQGTF.js} +1 -1
  223. package/templates/.agents/design/apps/catalog/dist/storybook/assets/{theming-DS_ue2sb.js → theming-4ZyufAga.js} +1 -1
  224. package/templates/.agents/design/apps/catalog/dist/storybook/iframe.html +1 -1
  225. package/templates/.agents/design/apps/catalog/dist/storybook/index.json +1 -1
  226. package/templates/.agents/design/apps/catalog/package.json +2 -2
  227. package/templates/.agents/design/apps/catalog/src/components/AutonomySpecimen.tsx +15 -0
  228. package/templates/.agents/design/apps/catalog/src/components/CostPopulationSpecimen.test.tsx +19 -0
  229. package/templates/.agents/design/apps/catalog/src/components/CostPopulationSpecimen.tsx +45 -0
  230. package/templates/.agents/design/apps/catalog/src/components/EstimatedCostSpecimen.tsx +48 -0
  231. package/templates/.agents/design/apps/catalog/src/components/ProjectStatusSpecimen.tsx +169 -0
  232. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +55 -0
  233. package/templates/.agents/design/apps/catalog/src/stories/Components.stories.tsx +60 -0
  234. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  235. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  236. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  237. package/templates/.agents/requirements/comparative-audit.md +1 -1
  238. package/templates/.agents/requirements/context-engine.md +1 -1
  239. package/templates/.agents/requirements/cost-observability.md +1 -1
  240. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  241. package/templates/.agents/requirements/data-export.md +1 -1
  242. package/templates/.agents/requirements/design-system.md +1 -1
  243. package/templates/.agents/requirements/execution-engine.md +1 -1
  244. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  245. package/templates/.agents/requirements/model-orchestration.md +1 -1
  246. package/templates/.agents/requirements/public-distribution.md +1 -1
  247. package/templates/.agents/requirements/software-architecture.md +1 -1
  248. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  249. package/templates/.agents/requirements/work-lifecycle.md +5 -5
  250. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  251. package/templates/.agents/rules/astra-diagnostic.md +3 -1
  252. package/templates/.agents/rules/autonomy-decision.md +10 -2
  253. package/templates/.agents/rules/core.md +12 -1
  254. package/templates/.agents/rules/run-lifecycle-closure.md +8 -6
  255. package/templates/.agents/rules/workflow.md +2 -2
  256. package/templates/.agents/runtime/VERSION +1 -1
  257. package/templates/.agents/runtime/bin/zaip.mjs +383 -350
  258. package/templates/.agents/runtime/checksums.sha256 +6 -6
  259. package/templates/.agents/runtime/manifest.json +1 -1
  260. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
  261. package/templates/.agents/runtime/provenance.json +5 -5
  262. package/templates/.agents/runtime/sbom.cdx.json +3 -3
  263. package/templates/.agents/skills/zaip-skill-dev-environment/SKILL.md +2 -0
  264. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +28 -5
  265. package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +17 -3
  266. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +8 -9
  267. package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +10 -6
  268. package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +17 -12
  269. package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +2 -0
  270. package/templates/.agents/skills/zaip-skill-prd/SKILL.md +2 -0
  271. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +21 -23
  272. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +37 -13
  273. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +2 -0
  274. package/templates/.agents/skills/zaip-skill-tool-setup/SKILL.md +2 -0
  275. package/templates/.agents/zaip-aios/INDEX.md +9 -1
  276. package/templates/.agents/zaip-aios/README.md +24 -2
  277. package/templates/.agents/zaip-aios/VERSION +1 -1
  278. package/templates/.agents/zaip-aios/guides/01-primeiros-passos.md +5 -1
  279. package/templates/.agents/zaip-aios/guides/03-tasks.md +15 -2
  280. package/templates/.agents/zaip-aios/guides/04-specs.md +13 -0
  281. package/templates/.agents/zaip-aios/guides/05-prds.md +13 -0
  282. package/templates/.agents/zaip-aios/guides/06-execucao.md +19 -4
  283. package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +14 -0
  284. package/templates/.agents/zaip-aios/guides/08-contexto-e-tokens.md +4 -3
  285. package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +17 -9
  286. package/templates/.agents/zaip-aios/guides/10-seguranca.md +9 -0
  287. package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +69 -0
  288. package/templates/.agents/zaip-aios/guides/12-instalacao-e-upgrade.md +9 -4
  289. package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +7 -1
  290. package/templates/.agents/zaip-aios/guides/14-troubleshooting.md +18 -0
  291. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +54 -3
  292. package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +10 -2
  293. package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +186 -5
  294. package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +21 -15
  295. package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +18 -2
  296. package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +14 -2
  297. package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +190 -489
  298. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +72 -13
  299. package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +18 -0
  300. package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +18 -1
  301. package/templates/template-manifest.json +454 -274
  302. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-1L7Qw-Gq.js +0 -3
  303. package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-EInWr641.css +0 -1
  304. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-B6aZfo5f.js +0 -68
  305. package/templates/.agents/dashboard/apps/frontend/dist/assets/dashboard-localization-CLJ0lT9v.js +0 -231
  306. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DgTmNHN5.js +0 -2
  307. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DQpKX9c1.js +0 -1
  308. package/templates/.agents/design/apps/catalog/dist/storybook/assets/CatalogShell-BWY-80s4.js +0 -1
  309. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-Be2mDUQj.js +0 -27
  310. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-DRx9blDs.js +0 -1
  311. package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-EwuTh8Zk.js +0 -1
  312. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-DyL61NPT.js +0 -1
@@ -1,231 +0,0 @@
1
- var e={"01-primeiros-passos.md":`# Getting started
2
-
3
- 1. Read \`.agents/config/project.yaml\` and \`.agents/rules/zaip/core.md\`.
4
- 2. Consult \`.agents/records/lifecycle/\` to discover the current state.
5
- 3. Classify the work as a Task, SPEC, or PRD.
6
- 4. Load only the applicable Rules, Requirements, and skills.
7
- 5. Define verifiable acceptance before editing.
8
- 6. Execute, test, and record evidence in the active lifecycle.
9
-
10
- Do not scan \`.agents/records/\`; open a record only when you have its ID.`,"02-requirements.md":`# Requirements
11
-
12
- Use a Requirement for a durable, testable obligation.
13
-
14
- 1. Describe the outcome and boundary, not the preferred implementation.
15
- 2. Create observable acceptance criteria.
16
- 3. Record risks, dependencies, and negative cases.
17
- 4. Connect every criterion to a test or evidence.
18
- 5. Version changes without erasing the previous intent.
19
- 6. Promote only after consistency and traceability are validated.
20
-
21
- A good criterion answers unambiguously: did it pass or fail?`,"03-tasks.md":`# Tasks
22
-
23
- Use a Task for a small, independent delivery with a clear result.
24
-
25
- 1. State the objective, scope, and out-of-scope items.
26
- 2. Link applicable Requirements.
27
- 3. List likely files or components without freezing the solution.
28
- 4. Define checks proportional to risk.
29
- 5. Execute in the associated Run and attach evidence.
30
- 6. Close only when acceptance is satisfied or a blocker is proven.`,"04-specs.md":`# SPECs
31
-
32
- Use a SPEC when delivery requires multiple Tasks or dependency ordering.
33
-
34
- 1. Turn the desired result into verifiable capabilities.
35
- 2. Resolve the project stack from \`stack.id\` and \`stack.overrides\`.
36
- 3. Record the stack profile, overrides, concise description, exact versions, and workspace-verifiable sources.
37
- 4. Split delivery into small Tasks with their own acceptance.
38
- 5. Model dependencies as a DAG and avoid artificial sequences.
39
- 6. Identify critical paths, risks, and rollback.
40
- 7. Map every Requirement to Tasks and evidence.
41
- 8. Validate the SPEC before execution and block missing or inconsistent stack data.
42
-
43
- A SPEC plans delivery; it does not authorize external changes by itself.`,"05-prds.md":`# PRDs
44
-
45
- Use a PRD for a product initiative with multiple capabilities or SPECs.
46
-
47
- 1. Record the problem, audience, outcome, and metrics.
48
- 2. Define scope, constraints, and non-goals.
49
- 3. Keep the PRD independent of language, framework, database, infrastructure, and vendor.
50
- 4. Specify functional and non-functional requirements.
51
- 5. Convert capabilities into independent SPECs where the technical stack is resolved.
52
- 6. Cover risks, rollout, observability, and rollback.
53
- 7. Build the DAG and confirm that every acceptance criterion has planned evidence.`,"06-execucao.md":`# Execution
54
-
55
- 1. Confirm the lifecycle ID and governing acceptance criteria.
56
- 2. Inspect the diff and preserve unrelated changes.
57
- 3. Implement the smallest coherent increment.
58
- 4. Run focused checks after each increment.
59
- 5. Record consequential decisions, evidence, and deviations.
60
- 6. Run final gates and document rollback.
61
-
62
- Do not mark work complete because effort was spent; complete it because the outcome is verifiable.`,"07-revisao-e-validacao.md":`# Review and validation
63
-
64
- 1. Review Requirements and acceptance criteria.
65
- 2. Examine the diff, architecture boundaries, and error paths.
66
- 3. Run focused tests, then all applicable gates.
67
- 4. Verify security, compatibility, documentation, and rollback.
68
- 5. Rank findings by impact and cite concrete evidence.
69
- 6. Record the result without changing the implementation during a read-only review.`,"08-contexto-e-tokens.md":`# Context and tokens
70
-
71
- 1. Start with \`project.yaml\`, \`core.md\`, and runtime projections.
72
- 2. Load only the triggered Rule, Requirement, or skill.
73
- 3. Prefer indexes, summaries, and targeted search over full files.
74
- 4. Open records only by a known lifecycle ID.
75
- 5. Summarize stable facts and preserve literal text only when normative.
76
- 6. Remove superseded results and non-actionable detail from context.
77
-
78
- For tools, read \`catalog.yaml\`, choose an ID, and open only its manifest.`,"09-agentes-e-squads.md":`# Agents and squads
79
-
80
- 1. Delegate only concrete, independent subtasks.
81
- 2. Give each agent an objective, boundaries, inputs, and output format.
82
- 3. Avoid two agents editing the same files.
83
- 4. Centralize architecture decisions and integration in the responsible agent.
84
- 5. Require evidence, not only completion claims.
85
- 6. Use parallelism only when it shortens the critical path without increasing conflict.`,"10-seguranca.md":`# Security with danger-full-access
86
-
87
- The security profile treats unrestricted filesystem access as a technical capability, never as blanket authorization. User intent, repository scope, lifecycle write scopes, and explicit approval remain the governing boundaries.
88
-
89
- ## Trust model
90
-
91
- The user controls global opt-in and trusted projects. Repository instructions may narrow authority but cannot silently expand it. Missing or ambiguous authorization fails closed for destructive, external, credential-related, or irreversible operations.
92
-
93
- ## Security layers
94
-
95
- 1. **Global opt-in and trusted project** — unrestricted execution is enabled only by explicit user configuration in a trusted workspace.
96
- 2. **No-prompt is not authorization** — suppressing approval prompts does not grant new scope.
97
- 3. **Fail-closed hooks** — pre-tool controls reject operations that cannot be classified safely.
98
- 4. **Filesystem boundary** — writes remain inside authorized workspace roots and lifecycle scopes.
99
- 5. **Secrets protection** — credentials, tokens, environment files, and private keys are not exposed or committed.
100
- 6. **Inline execution controls** — evasive shell composition and hidden payload execution are blocked.
101
- 7. **Allowlisted egress** — external access is limited to required, trusted destinations.
102
- 8. **Destructive operations** — recursive deletion, destructive Git commands, and irreversible mutations require explicit authority.
103
- 9. **Codex forbidden rules** — known dangerous command patterns are denied before execution.
104
- 10. **Bounded GitHub deployment** — setup never implies push, and deployment is limited to the requested repository and branch.
105
- 11. **Apps, MCPs, and external tools** — integrations follow least privilege, read-only defaults, and explicit activation.
106
- 12. **Lifecycle and traceability** — Tasks, Changes, Executions, Runs, write scopes, tests, and evidence make mutations auditable.
107
- 13. **Autonomous runtime opt-in** — autonomous execution requires explicit project configuration and isolated worktrees.
108
- 14. **Integrity and regression tests** — managed files, adapters, configuration, and security rules are validated continuously.
109
-
110
- ## Residual limits
111
-
112
- No policy can eliminate risk from compromised dependencies, trusted binaries, operating-system vulnerabilities, or a user intentionally authorizing a dangerous operation. Least privilege, backups, reviewable diffs, isolated credentials, and reversible rollout remain necessary.
113
-
114
- ## Safe operation
115
-
116
- - Inspect the target and resolved path before recursive file operations.
117
- - Keep credentials outside tracked files.
118
- - Prefer focused, reversible commands.
119
- - Review diffs before commit or deployment.
120
- - Run doctor, integrity, and security checks after configuration changes.
121
- - Stop when required authority or a safe rollback path is missing.
122
-
123
- ## Rollout and rollback
124
-
125
- Roll out security changes in stages, validate on representative repositories, and preserve the previous known-good configuration. Rollback means restoring the prior managed policy, rebuilding adapters, rerunning integrity checks, and confirming that the workspace remains within its intended trust boundary.`,"11-observabilidade-e-custos.md":`# Observability and costs
126
-
127
- 1. Select the Run by ID.
128
- 2. Check duration, tokens, cost, retries, and rework.
129
- 3. Compare planned acceptance with produced evidence.
130
- 4. Identify slow gates, excessive context, and repeated calls.
131
- 5. Aggregate trends without exposing sensitive prompts or secrets.
132
- 6. Turn recurring findings into a Rule, Requirement, or skill improvement.`,"12-instalacao-e-upgrade.md":`# Installation and upgrade
133
-
134
- 1. Check the current version and whether local changes are clean or intentionally preserved.
135
- 2. Run doctor and integrity checks before changing anything.
136
- 3. Run a dry-run of installation, migration, or upgrade.
137
- 4. Review managed, public, and preserved files.
138
- 5. Apply the change, validate adapters, and run gates.
139
- 6. Test rollback and confirm the final version.
140
-
141
- \`framework.lock.yaml\` is relevant to this flow; do not load it during ordinary work.`,"13-boas-praticas.md":`# Best practices
142
-
143
- - Start from the outcome and acceptance criteria, not the tool.
144
- - Keep the domain independent from infrastructure.
145
- - Make changes small, reversible, and traceable.
146
- - Validate early with deterministic, focused tests.
147
- - Prefer explicit configuration over hidden conventions.
148
- - Load context on demand and preserve the token budget.
149
- - Treat documentation, observability, and rollback as part of delivery.`,"14-troubleshooting.md":`# Troubleshooting
150
-
151
- 1. Reproduce the problem with the smallest possible command.
152
- 2. Read the complete message and identify the first causal error.
153
- 3. Run doctor, focused validators, and \`git diff --check\`.
154
- 4. Check versions, paths, encoding, variables, and managed files.
155
- 5. Compare against runtime projections without scanning records.
156
- 6. Fix the cause, repeat the reproduction, and then run the full applicable gates.
157
-
158
- For installation or integrity problems, consult \`framework.lock.yaml\`.`,"15-tools-e-codex.md":`# Tools and Codex setup
159
-
160
- 1. Ask the agent to list or activate a tool; it uses the tool-setup skill.
161
- 2. The skill reads only the applicable catalog and manifest.
162
- 3. A trusted MCP is registered disabled and validated before activation.
163
- 4. An API without a trusted MCP uses the API-to-MCP workflow to generate a secure adapter.
164
- 5. Secrets are never pasted into chat; names belong in \`.agents/.env.example\` and values in ignored local storage.
165
- 6. Configuration changes must be reversible and preserve existing preferences.
166
-
167
- Enable public, read-only, unauthenticated integrations by default, such as official documentation. Browser automation must be an explicit development-profile choice because it starts processes and expands the operational surface.
168
-
169
- ## Local MCP generated from an API
170
-
171
- Model an \`adapter.yaml\` from official documentation, scaffold the local MCP, run its doctor, test read-only calls, generate a Codex preview, and apply only after review. The generated server uses STDIO, does not open a port, and blocks writes without explicit approval.
172
-
173
- ## OpenAI documentation
174
-
175
- The default profile enables official OpenAI developer documentation without credentials and in read-only mode. Questions about OpenAI APIs, models, SDKs, Codex, or MCP should use the OpenAI docs skill and cite the consulted page.`};function t(t,r,i){let a=Object.entries(i).map(([r,i])=>{let a=r.split(`/`).at(-1)??r,o=t===`en-US`?e[a]??i:i;return{id:r,title:n(o,a),content:o}}).sort((e,n)=>e.title.localeCompare(n.title,t));return[{id:`readme`,title:`README · ZAIP-AIOS`,content:t===`en-US`?`# ZAIP-AIOS
176
-
177
- ZAIP-AIOS is a Git-native operating system for autonomous software engineering with Codex. It turns a request into structured, traceable work by defining requirements, preparing a plan, coordinating execution, running tests and reviews, and only considering a result complete when verifiable evidence exists.
178
-
179
- ## From conversation to executable work
180
-
181
- Work can start with a **Task**, a **PRD** (Product Requirements Document), or a **SPEC**. A PRD describes the problem, expected outcome, product context, and acceptance criteria. A SPEC turns that intent into a technical scope, solution, acceptance criteria, Changes, and a DAG of executable Tasks.
182
-
183
- ZAIP-AIOS does not require a VPS, a competing runtime, or mandatory API model routing. Codex remains the execution host while ZAIP-AIOS adds method, operational memory, governance, traceability, and observability to the repository.
184
-
185
- ## Six-stage method
186
-
187
- 1. **Definition** — capture PRDs, Requirements, and acceptance criteria.
188
- 2. **Planning** — prepare SPECs, Changes, dependencies, and rollback.
189
- 3. **Ready to execute** — confirm that scoped work is actionable.
190
- 4. **Execution** — implement Tasks and record Runs.
191
- 5. **Verification** — run tests, review the diff, and collect evidence.
192
- 6. **Completion** — close the lifecycle only after acceptance is satisfied.
193
-
194
- Small, independent frontend changes may use a task-first lite flow and begin directly in execution without definition or planning evidence.
195
-
196
- ## Operational dashboard
197
-
198
- The dashboard provides three complementary views:
199
-
200
- - **Operations** follows PRDs, SPECs, Tasks, Changes, Executions, Runs, and conversations.
201
- - **Cost Monitor** aggregates time, tokens, models, providers, and estimated cost.
202
- - **Traceability** connects each delivered result to its requirements, changes, runs, tests, and evidence.
203
-
204
- ## Engineering principles
205
-
206
- - Start from an observable outcome and explicit acceptance criteria.
207
- - Keep domain logic independent from infrastructure and vendors.
208
- - Prefer small, reversible, traceable changes.
209
- - Load only the context required for the active work.
210
- - Preserve unrelated changes in a dirty worktree.
211
- - Treat tests, evidence, observability, and rollback as part of delivery.
212
- - Never infer external authorization from technical capability.
213
-
214
- ## Installation and development
215
-
216
- Use the repository setup command documented for the current release, then run the doctor and integrity checks. The framework source lives in this repository; generated public and consumer artifacts are validated for release parity.
217
-
218
- The main local quality gates cover type checking, focused tests, architecture boundaries, generated text, framework integrity, and release parity. Use focused checks while implementing and the applicable final gates before completion.
219
-
220
- ## Repository structure
221
-
222
- - \`.agents/config/\` — project-owned configuration.
223
- - \`.agents/rules/\` — operational and architectural rules.
224
- - \`.agents/requirements/\` — durable Requirements and acceptance criteria.
225
- - \`.agents/skills/\` — reusable workflows.
226
- - \`.agents/records/\` — lifecycle records addressed by explicit ID.
227
- - \`.agents/records/lifecycle/\` — canonical lifecycle manifests, chunks, indexes, and summaries.
228
- - \`.agents/dashboard/\` — dashboard applications and modules.
229
- - \`.agents/runtime/\` — runtime and CLI distributable.
230
-
231
- Read runtime projections for discovery. Open lifecycle records only when you already have their ID.`:r},...a]}function n(e,t){return e.match(/^#\s+(.+)$/m)?.[1]?.trim()??t.replace(/\.md$/i,``)}var r={"pt-BR":{eyebrow:`CONFIGURAÇÃO DO PROJETO`,title:`Preços e cotação`,description:`Valores em USD por 1 milhão de tokens. Ao salvar, o dashboard recalcula todos os valores com o catálogo vigente.`,back:`Voltar ao dashboard`,fxTitle:`Cotação utilizada no dashboard`,fxDescription:`Ao salvar, todos os valores em BRL são recalculados. Os valores em USD e a telemetria de tokens permanecem inalterados.`,fxLabel:`Cotação USD/BRL`,fxAriaLabel:`Cotação USD BRL`,catalog:`Catálogo de modelos`,pricesPerMillion:`Preços em USD por 1 milhão de tokens`,models:`modelos`,model:`Modelo`,provider:`Provider`,input:`Entrada (USD/1M)`,cache:`Cache (USD/1M)`,output:`Saída (USD/1M)`,reasoning:`Raciocínio (USD/1M)`,priorityInput:`Priority entrada (USD/1M)`,priorityCache:`Priority cache (USD/1M)`,priorityOutput:`Priority saída (USD/1M)`,priorityReasoning:`Priority raciocínio (USD/1M)`,contextLimit:`Limite contexto`,inputMultiplier:`Mult. entrada`,outputMultiplier:`Mult. saída`,noAliases:`sem aliases`,removeModel:`Remover modelo`,addModel:`Adicionar modelo`,cancel:`Cancelar`,saving:`Salvando…`,save:`Salvar e recalcular`,newModel:`novo-modelo`,manualOverride:`Substituição manual pelo dashboard`,editedNote:`Editado no dashboard`},"en-US":{eyebrow:`PROJECT SETTINGS`,title:`Pricing and exchange rate`,description:`Prices in USD per 1 million tokens. When saved, the dashboard recalculates all values using the current catalog.`,back:`Back to dashboard`,fxTitle:`Exchange rate used by the dashboard`,fxDescription:`When saved, all BRL values are recalculated. USD values and token telemetry remain unchanged.`,fxLabel:`USD/BRL exchange rate`,fxAriaLabel:`USD BRL exchange rate`,catalog:`Model catalog`,pricesPerMillion:`Prices in USD per 1 million tokens`,models:`models`,model:`Model`,provider:`Provider`,input:`Input (USD/1M)`,cache:`Cache (USD/1M)`,output:`Output (USD/1M)`,reasoning:`Reasoning (USD/1M)`,priorityInput:`Priority input (USD/1M)`,priorityCache:`Priority cache (USD/1M)`,priorityOutput:`Priority output (USD/1M)`,priorityReasoning:`Priority reasoning (USD/1M)`,contextLimit:`Context limit`,inputMultiplier:`Input multiplier`,outputMultiplier:`Output multiplier`,noAliases:`no aliases`,removeModel:`Remove model`,addModel:`Add model`,cancel:`Cancel`,saving:`Saving…`,save:`Save and recalculate`,newModel:`new-model`,manualOverride:`Dashboard manual override`,editedNote:`Edited in dashboard`}};export{r as n,t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-tzS7YxYB.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-B6aZfo5f.js","assets/cost-monitor-PoJA2PI1.css","assets/dashboard-localization-CLJ0lT9v.js","assets/DashboardHelpDialog-Je5nK-Et.css","assets/PricingSettingsDialog-DEbCi1gP.js","assets/ProjectSettingsPage-1L7Qw-Gq.js","assets/ProjectSettingsPage-EInWr641.css","assets/CostCalculationGuidePage-CGxeQak4.js","assets/TraceabilityWorkspace-t1Om0Abw.js","assets/traceability-DQpKX9c1.js","assets/icons-vendor-DiGC-dsJ.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{C as t,_ as n,a as r,g as i,i as a,n as o,o as s,r as c,t as l,x as u}from"./cost-monitor-B6aZfo5f.js";import{t as d}from"./react-vendor-kPO6yNed.js";import{n as f,t as p}from"./traceability-DQpKX9c1.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]}):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)})},F=(0,m.lazy)(async()=>({default:(await P(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-tzS7YxYB.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function re({costLocale:e,documentDetail:t,helpOpen:r,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)(n,{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,r?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(F,{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&&i!==`operations`&&l===null?(0,g.jsx)(b,{area:i,locale:e}):null]})}var ie=(0,m.lazy)(async()=>({default:(await P(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-DEbCi1gP.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),I=(0,m.lazy)(async()=>({default:(await P(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-1L7Qw-Gq.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),ae=(0,m.lazy)(async()=>({default:(await P(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-CGxeQak4.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),oe=`/setup-pricing`,se=`/setup-project`,L=`/cost-calculation-guide`;function ce(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)(ie,{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)(ae,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(I,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var le=(0,m.lazy)(async()=>({default:(await P(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-t1Om0Abw.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function ue({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)(le,{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 de({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`})]})}var fe={preset:`all`,range:a(`this-month`)};function R(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function z(e,t){return e.preset===`all`&&t.preset===`all`}function pe({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:F,traceTasksLoading:ie,traceTasks:I,capabilityNavigation:ae,boardTotals:ce,boardKindTotals:le,boardExportSource:fe,detailExportSource:R,boardStates:pe,operationsPeriod:me,entityPage:he,dashboardIdentity:ge,operationsLoading:B,factualCostTotal:_e,factualCostPeriods:ve,setOperationsSurfaceLoading:ye,currentCostByRun:be,loadOperationsEntityPage:xe,loadOperationsLifecyclePage:Se,loadOperationsDetails:Ce,entityPageKind:we,loadFilteredOperationsPage:Te,loadFilteredBoard:V,loadWorkListFilters:Ee,loadWorkListPage:H,workListFiltersRef:U,boardFiltersRef:De,workListPage:Oe,overviewStatusPages:ke,loadOverviewStatusPage:Ae,overviewClassificationPages:je,loadOverviewClassificationPage:W,openDocument:Me,api:Ne,setError:Pe,operationsPeriodRef:Fe,setOperationsPeriod:Ie,operationsDetailLoadedRef:Le,operationsDetailCancelRef:Re,operationsDetailAbortRef:ze,operationsPageAbortRef:Be,resetWorkListPage:Ve,operationsPageRequestVersionRef:He,resetBoard:Ue,refreshVersion:We,costSummaryAbortRef:G,costSummaryRequestVersion:K,setEntityPage:Ge,costsLoadedRef:Ke,setCosts:q,setPeriodTransitionPending:qe,periodTransitionVersionRef:Je,setLoadingArea:Ye,navigate:Xe,setHelpOpen:Ze,closeDocument:Qe,documentDetail:$e,helpOpen:et,reconciliationResult:tt,setReconciliationResult:nt,refreshDialog:rt,setTrace:it,traceLink:at,setTraceLoadingTaskId:ot,setTraceLink:st,refreshFromDialog:ct}=e,{loadMoreBoard:lt,overviewStatusPageKey:ut,overviewClassificationPageKey:dt,boardRequestVersionRef:J,boardAbortControllersRef:ft,boardInFlightRef:pt,boardInitialPageRef:mt,boardLoadedRef:ht,setBoardTotals:gt,setBoardKindTotals:_t,setBoardStates:vt,setOverviewStatusPages:yt,setOverviewClassificationPages:bt,setOperationsLoading:xt}=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:()=>Pe(null),type:`button`,children:`×`})]}):null,(0,g.jsx)(c,{alternateContent:ue({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:F,traceTasksLoading:ie,traceTasks:I}),capabilityNavigation:ae,boardTotals:ce,boardKindTotals:le,boardExportSource:fe,detailExportSource:R,boardStates:pe,data:j,lastUpdatedAt:m,datePreset:me.preset,dateRange:me.range,entityPage:he,dashboardTitle:ge.title,repositoryName:ge.repositoryName,loading:B,locale:i,currency:f,factualCostTotal:_e,factualCostPeriods:ve,onLoadingChange:ye,resolveRunCost:d===null?void 0:e=>be.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`?Se(e):Ce():xe(t)},onLoadMacroMetrics:()=>void Ce(),onEntityPageChange:e=>{we===`changes`||we===`decisions`?Se(we,e):xe(we,e)},onEntityFiltersChange:Te,onBoardFiltersChange:V,onWorkListFiltersChange:Ee,onWorkListPageChange:e=>void H(U.current,e),onBoardTypeChange:e=>V({...De.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void H({...U.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void lt(e),workListPage:Oe,statusPage:(e,t)=>ke[ut(e,t)],onLoadStatusPage:(e,t,n)=>void Ae(e,t,n),classificationPage:(e,t)=>je[dt(e,t)],onLoadClassificationPage:(e,t,n)=>void W(e,t,n),onOpenDocument:(e,t)=>void Me(e,t),onOpenTask:E,onPriorityChange:async e=>{try{await Ne.saveWorkPriority(e)}catch(e){throw Pe(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(z(Fe.current,n)){Ie(n);return}Le.current=!1,Re.current?.(),Re.current=null,ze.current?.abort(),ze.current=null,Be.current?.abort(),Be.current=null,Ve(),++He.current,J.current+=1;for(let e of ft.current.values())e.abort();ft.current.clear(),pt.current.clear(),mt.current.clear(),ht.current={},gt({}),_t({}),vt({}),yt({}),bt({}),++We.current,G.current?.abort(),G.current=null,++K.current,Ge({offset:0,total:null,loading:!1,error:null}),Ke.current=!1,q(null),x(null),xt(!0),Je.current+=1,qe(!0),Ye(`operations`),Ie(n)},onRefresh:()=>D(`choose`),settings:(0,g.jsx)(de,{costCalculationGuidePath:L,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>Ze(!0),onNavigate:Xe,pricingSetupPath:oe,projectSetupPath:se})}),(0,g.jsx)(re,{closeDocument:Qe,costLocale:i,documentDetail:$e,helpOpen:et,loadingArea:p===`cost-monitor`&&d===null?null:b,operations:j,reconciliationResult:tt,refreshDialog:rt,showTrace:p===`traceability`,trace:N,traceLink:at,traceLoadingTaskId:P,onCloseHelp:()=>Ze(!1),onCloseTrace:()=>it(null),onDismissReconciliation:()=>nt(null),onOpenDocument:(e,t)=>void Me(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:A,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void ct(e),setTraceLink:e=>st(e)})]}),r?(0,g.jsx)(ee,{}):null]})}var me=(e,t)=>`${e}:${t}`,he=(e,t)=>`${e}:${t}`,ge=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],B=[`completed`,`executing`,`ready`,`blocked`,`verifying`,`failed`,`cancelled`,`planning`,`definition`],_e=`/zaip-cost-monitor`,ve=`zaip-dashboard-session-token`,ye=`zaip-dashboard-locale`,be=`zaip-dashboard-currency`;function xe(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function Se(e){return e.replace(/\/+$/,``)===_e?`cost-monitor`:null}function Ce(){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(ve,t),window.sessionStorage.setItem(ve,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var we=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(U(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(U(`/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(U(`${i.operations}?${s.toString()}`,e),a)}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(U(`${i.operations}?${s.toString()}`,e),a)}operationsEntityPage(e,t,n=0,r,a){let o=Te(t,n,r);return this.get(U(`${i.operations}/runs?${o}`,e),a)}operationsLifecyclePage(e,t,n=0,r,a){let o=Te(t,n,r);return this.get(U(`${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(U(`${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(U(`${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(U(`${i.costMonitor}?${s.toString()}`,t),a)}snapshot(e=`BRL`,t){return this.get(U(`${i.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(U(`${i.reconcileOpenWork}?currency=${e}`,t),Ee)}refreshProjection(e=`BRL`,t){return this.post(U(`${i.refreshProjection}?currency=${e}`,t),Ee)}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 H(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},V,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=V){let n=await H(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 Te(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 V=6e4,Ee=18e4;async function H(e,t,n=V,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 U(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 De(e){return e.projection_refresh_completed}function Oe(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&De(e)}}var ke={"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 Ae({activeView:e,locale:t,onChange:n}){let r=ke[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)(W,{}),(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)(je,{}),(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)(Me,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.traceability}),(0,g.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function je(){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 W(){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 Me(){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 Ne(e){m.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Pe(e,t,n){return(0,g.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,g.jsx)(Ae,{activeView:e,locale:t,onChange:n})})}function Fe(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function Ie(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function Le(e,t,n){let r=t??e;return r?.currency===n?{total:n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}:{total:null,periods:void 0}}var Re={title:`Dashboard Zaip AIOS`,repositoryName:``};function ze(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 Be(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 Ve(e,t,n,r,i,a,o,s,c){return ce({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function He(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.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 Ue(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 We(e=new Date){let t=r(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let n=e.getTime(),i=n+1800*60*1e3;for(;r(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-n>1;){let e=Math.floor((n+i)/2);r(new Date(e).toISOString(),`day`)===t?n=e:i=e}return Math.max(1,i-e.getTime()+25)}function G(e){return typeof e==`number`?e:null}function K(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 Ge(e){return Object.hasOwn(e,`total_duration`)?G(e.total_duration):G(e.cost_monitor_total_duration)}function Ke(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 q(e){let t=Ge(e),n=Number(e.duration_unknown??+(t===null)),r=t??G(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:G(e.task_count),conversation_count:Number(e.conversation_count??0),prd_count:G(e.prd_count),spec_count:G(e.spec_count),evidence_count:G(e.evidence_count),test_count:G(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:G(e.total_tokens),estimated_usd:G(e.total_cost_usd),estimated_brl:G(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 qe(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,Ke(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(q),...n.totals===void 0?{}:{totals:q(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,Ke(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(q),...u.totals===void 0?{}:{totals:q(u.totals)}}}async function Je(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}:{}},o);return{page_only:!0,runs:c.rows.map(Ye),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function Ye(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 Xe(e,t){let n=t.totals,r=e=>K(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:K(t.total_duration),total_tokens:K(t.total_tokens),cost:K(t.total_cost_brl)}}))}}function Ze(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 Xe(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...o===void 0||o===``?{}:{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=>Je(e,t),[e]),loadCostGroupPage:(0,m.useCallback)(t=>qe(e,t),[e])}}function Qe(e,t){return!1}function $e(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 et=2e3,tt=5e3,nt=1e4,rt=3e4,it=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function at(e,t){return e&&t<90}function ot(e,t){return e===`visible`?tt:t>0?rt:nt}function st(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function ct(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function lt({observedRevision:e,pendingRevision:t,requestedRevision:n,succeeded:r}){return r?{observedRevision:n,pendingRevision:t===n?null:t}:{observedRevision:e,pendingRevision:t}}function ut({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function dt({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();ut({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||!at(!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(at(!0,n)){r=window.setTimeout(()=>void i(),et);return}h(!1),g(it)}}};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=lt({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;ct(r.snapshot_state,r.snapshot_revision)&&(a===null&&(S.current=r.snapshot_revision),st(a,r.snapshot_revision)&&(w.current=r.snapshot_revision,i()))}catch{n+=1}t||(r=window.setTimeout(()=>void a(),ot(document.visibilityState,n)))};return a(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,h]),(0,m.useEffect)(()=>{if(!Qe(r,a?.summary.overview_metrics?.partial===!0))return;let e=$e(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(ye,t),[t]),(0,m.useEffect)(()=>window.localStorage.setItem(be,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 J={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 ft(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:J,planning:J,execution:{...J,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:{...J,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:J,rework:J}}));return{...e,runs:i,executions:t===`executions`||t===`conversations`?n.rows.map((e,n)=>{let r=i[n],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 pt(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 mt({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=R(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,R(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:ft(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=R(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,R(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:pt(e.requirement_ids_json),acceptance_ids:pt(e.acceptance_ids_json),task_ids:pt(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 ht({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:r?.progress??n.task_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 gt({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 _t(e,t,n){return Math.min(t,e+n)}function vt(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>=B.length))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=B[a.stageIndex];if(o===void 0)break;let s=await e.operationsBoard({from:null,to:null},o,a.offset,{kind:`all-tasks`},void 0,10),c=gt({cursor:a,page:s,tasks:r.current});if(r.current=c.tasks,n(r.current),i.current=c.cursor,s.tasks.length>0&&!t)break}while(i.current.stageIndex<B.length);return s(i.current.stageIndex<B.length),r.current}finally{a.current=!1,l(!1)}},[e,n]),traceTasksHasMore:o,traceTasksLoading:c}}function yt({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=R(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!==R(d.current).from||f.to!==R(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=me(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(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!==R(d.current).from||c.to!==R(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=he(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(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!==R(d.current).from||c.to!==R(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=R(u);return{prepare:async()=>{let t=await Promise.all(ge.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=async()=>{let t=ge.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let n=0;n<t.length&&!e;n+=3){let e=t.slice(n,n+3);for(let t of e)a.current.add(t);await Promise.all(e.map(e=>S(e)))}},n=typeof window.requestIdleCallback==`function`?{kind:`idle`,id:window.requestIdleCallback(()=>void t())}:{kind:`timeout`,id:window.setTimeout(()=>void t(),0)};return()=>{e=!0,n.kind===`idle`?window.cancelIdleCallback(n.id):window.clearTimeout(n.id)}},[i,a,c,S,l]),{boardExportSource:D,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function bt(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function xt(e,t,n){return e===`explicit`||t!==n}function St(e,t){return{...e,kind:e.kind??t.kind??``}}var Ct={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function wt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,m.useState)(Ct),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=R(t),f=St(r,a.current),p=bt(f,d);if(!xt(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!==R(n.current).from||d.to!==R(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(Ct)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,m.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}async function*Y(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 Tt({api:e,operationsPeriod:t}){return(0,m.useCallback)((n,r)=>{let i=R(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:()=>Y(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var Et=1500;function Dt({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function Ot(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),Et);return()=>window.clearTimeout(n)},[t,r,e]),Dt({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 X(){Ne(Ce());let[e,t]=(0,m.useState)(!1),n=(0,m.useMemo)(Ce,[]),r=(0,m.useMemo)(()=>new we(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=Ze(r),[c,l]=(0,m.useState)(()=>Se(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,F]=(0,m.useState)(null),[re,ie]=(0,m.useState)(xe),[I,ae]=(0,m.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),oe=(0,m.useRef)(I);oe.current=I;let se=(0,m.useCallback)(e=>{ie(e),ae(e===`en-US`?`USD`:`BRL`)},[]),[L,ce]=(0,m.useState)(()=>fe),le=L.preset===`all`?null:L.range.start,ue=L.preset===`all`?null:L.range.end,de=(0,m.useMemo)(()=>({from:le,to:ue}),[le,ue]),z=(0,m.useRef)(L);z.current=L;let pe=(0,m.useRef)(null),[ge,B]=(0,m.useState)(!1),[_e,ve]=(0,m.useState)(null),[ye,be]=(0,m.useState)(null),[Te,V]=(0,m.useState)(window.location.pathname),[Ee,H]=(0,m.useState)(!0),[,U]=(0,m.useState)(!1),[,De]=(0,m.useState)(!1),[ke,Ae]=(0,m.useState)(!1),[je,W]=(0,m.useState)(`operations`),[Me,G]=(0,m.useState)(null),[K,Ge]=(0,m.useState)(null);(0,m.useEffect)(()=>{r.ready().then(e=>t(e.snapshot_state===`updating`)).catch(()=>{})},[r]);let[Ke,q]=(0,m.useState)(null),[qe,Je]=(0,m.useState)(null),[Ye,Xe]=(0,m.useState)(null),[Qe,$e]=(0,m.useState)(Re),et=(0,m.useCallback)(e=>{$e(t=>ze(t,e))},[]);(0,m.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||et(t)}).catch(()=>{}),()=>{e=!0}},[r,et]);let{closeDocument:tt,documentDetail:nt,openDocument:rt,openTrace:it,openTraceChange:at,openTraceMacro:ot,selectedTraceTaskId:st,setSelectedTraceTaskId:ct,setTrace:lt,setTraceLink:ut,setTraceLoadingTaskId:J,setTraceTasks:ft,trace:pt,traceLink:gt,traceLoadingTaskId:_t,traceTasks:bt}=ht({api:r,operations:d,setError:q,setFailedArea:G,setLoadingArea:W}),{loadMoreTraceTasks:xt,traceTasksHasMore:St,traceTasksLoading:Ct}=vt(r,bt,ft),Y=(0,m.useRef)(0),Et=(0,m.useRef)(0),Dt=(0,m.useRef)(!1),X=(0,m.useRef)(0),kt=(0,m.useRef)(0),Z=(0,m.useRef)(null),At=(0,m.useRef)(!1),jt=(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}=wt({api:r,operationsPeriod:L,operationsPeriodRef:z}),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=++Y.current,s=Et.current,c=u.current,l=de,d=()=>w(o,Y.current)&&T(o,Y.current,l,R(z.current));e&&(H(!0),W(`operations`)),q(null),G(null);try{if(n){let e=await r.reconcileOpenWork(I,l),n=Oe(e,d());if(Je(n.reconciliation),n.dismissProgressDialog&&Ge(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,jt.current=!1,Xe(e.summary.latest_token_collected_at??null)}}else if(i){let e;if(e=await r.refreshProjection(I,l),!d())return!1;f(e.operations),Ut.current=e.operations.summary.overview_metrics,jt.current=!0,N(e.costs),At.current=!0,F(null);let t=e.dashboard;t&&$e(e=>ze(e,t)),Xe(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,Yt.current),I===`USD`||a?r.costMonitor(I,l,`summary`):Promise.resolve(null)]);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,jt.current=!1,t!==null&&(N(t),At.current=!1,F(null)),Xe(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(q(e instanceof Error?e.message:String(e)),G(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&D(s,Et.current)&&Ae(!1),e&&d()&&(H(!1),W(e=>e===`operations`?null:e))}},[r,I,de]),Xt=(0,m.useCallback)(async e=>{if(jt.current||Dt.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),Dt.current=!0,X.current+=1,W(`costs`),G(null);try{let e=++Y.current,t=R(L),i=()=>w(e,Y.current)&&T(e,Y.current,t,R(z.current)),a=await r.operations(t,`detail`,n);return i()?(f(a),jt.current=!0,a):null}catch(e){return n.aborted||E(e)?null:(q(e instanceof Error?e.message:String(e)),G(`operations`),null)}finally{t!==null&&Q.current===t&&(Q.current=null),Dt.current=!1,X.current=Math.max(0,X.current-1),X.current===0&&W(e=>e===`costs`?null:e)}},[r,L]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=mt({api:r,entityFiltersRef:v,operationsPageAbortRef:Nt,operationsPageRequestVersionRef:Pt,operationsPeriod:L,operationsPeriodRef:z,refreshVersion:Y,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}=yt({api:r,boardAbortControllersRef:Lt,boardFilterKeyRef:Vt,boardFiltersRef:Bt,boardInFlightRef:It,boardInitialPageRef:zt,boardLoadedRef:Ft,boardRequestVersionRef:Ht,dashboardView:c,operations:d,operationsPeriod:L,operationsPeriodRef:z,overviewStatusInFlightRef:Rt,quickOverviewMetricsRef:Ut,setBoardKindTotals:O,setBoardStates:ee,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:j,setOverviewStatusPages:A}),sn=Tt({api:r,operationsPeriod:L}),cn=async e=>{e&&Je(null),Ge(e?`reconciling`:`refreshing`);try{await $(!1,e,!e)}finally{Ge(null)}};(0,m.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{ce(e=>{let t=Ue(e);return t!==e&&(pe.current=t),t}),t()},We())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,m.useEffect)(()=>{pe.current===L&&(pe.current=null,$(!1,!1,!0,!0))},[L,$]),dt({api:r,costLocale:re,currency:I,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:Q,operationsDetailCancelRef:Mt,operationsPageAbortRef:Nt,pathname:Te,pricing:_e,refresh:$,refreshVersion:Y,setSnapshotUpdating:t,setError:q,setFxRate:be,setPathname:V,setPricing:ve,snapshotUpdating:e});let ln=Fe(V),un=(0,m.useCallback)(async()=>{Z.current?.abort();let e=new AbortController;Z.current=e;let t=++kt.current,n=R(L);X.current+=1,W(`costs`),q(null),G(null);try{let i=await r.costMonitor(I,n,`summary`,e.signal),a=R(z.current);if(!C({aborted:e.signal.aborted,currentCurrency:oe.current,currentPeriod:a,currentRequestVersion:kt.current,requestVersion:t,requestedCurrency:I,requestedPeriod:n}))return;N(i),At.current=!0,F(null)}catch(n){if(e.signal.aborted||t!==kt.current)return;q(n instanceof Error?n.message:String(n)),G(`costs`)}finally{X.current=Math.max(0,X.current-1),X.current===0&&W(e=>e===`costs`?null:e),Z.current===e&&(Z.current=null)}},[r,I,L]);(0,m.useEffect)(()=>{I!==`USD`||M?.currency===I||un()},[M?.currency,I,un]),(0,m.useEffect)(()=>{c!==`cost-monitor`&&L.preset!==`all`||Z.current!==null||S({costsLoaded:At.current,currency:I,snapshotCurrency:M?.currency})&&un()},[M?.currency,I,c,un,L.preset]);let dn=He({setDashboardView:l,costsLoadedRef:At,currency:I,costs:M,loadCostSummary:un,costSummaryAbortRef:Z,traceTasks:bt,boardRequestVersionRef:Ht,loadMoreTraceTasks:xt,setTraceTasks:ft,setSelectedTraceTaskId:ct,openTrace:it,setTrace:lt,setTraceLoadingTaskId:J}),fn=Ie(M,P,I),{total:pn,periods:mn}=Le(M,P,I),hn=()=>Be(Me,st,d,un,it,Xt,$,q),gn=Ve(r,re,ye,ln,Te,_e,$,be,ve);return{loadMoreBoard:nn,overviewStatusPageKey:me,overviewClassificationPageKey:he,boardRequestVersionRef:Ht,boardAbortControllersRef:Lt,boardInFlightRef:It,boardInitialPageRef:zt,boardLoadedRef:Ft,setBoardTotals:b,setBoardKindTotals:O,setBoardStates:ee,setOverviewStatusPages:A,setOverviewClassificationPages:j,setOperationsLoading:H,operations:d,error:Ke,globalLoadingPending:ke||I===`USD`&&M?.currency!==I,costLocale:re,refresh:async()=>{await $()},snapshotNotice:Ot(e,d===null&&Ee,re),setupRoute:gn,failedArea:Me,retryLastLoad:hn,costs:M,currency:I,dashboardView:c,lastUpdatedAt:Ye,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:je,setDisplayedCosts:F,setCurrency:ae,setCostSurfaceLoading:De,changeDashboardLocale:se,loadMoreTraceTasks:xt,openTrace:it,setRefreshDialog:Ge,setSelectedTraceTaskId:ct,openTraceChange:at,openTraceMacro:ot,selectedTraceTaskId:st,trace:pt,traceLoadingTaskId:_t,traceTasksHasMore:St,traceTasksLoading:Ct,traceTasks:bt,capabilityNavigation:Pe(c,re,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:k,operationsPeriod:L,entityPage:p,dashboardIdentity:Qe,operationsLoading:Ee,factualCostTotal:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:U,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:rt,api:r,setError:q,operationsPeriodRef:z,setOperationsPeriod:ce,operationsDetailLoadedRef:jt,operationsDetailCancelRef:Mt,operationsDetailAbortRef:Q,operationsPageAbortRef:Nt,resetWorkListPage:Jt,operationsPageRequestVersionRef:Pt,resetBoard:on,refreshVersion:Y,costSummaryAbortRef:Z,costSummaryRequestVersion:kt,setEntityPage:h,costsLoadedRef:At,setCosts:N,setPeriodTransitionPending:Ae,periodTransitionVersionRef:Et,setLoadingArea:W,navigate:ln,setHelpOpen:B,closeDocument:tt,documentDetail:nt,helpOpen:ge,reconciliationResult:qe,setReconciliationResult:Je,refreshDialog:K,setTrace:lt,traceLink:gt,setTraceLoadingTaskId:J,setTraceLink:ut,refreshFromDialog:cn,renderedOperations:d}}function kt(){return(0,g.jsx)(pe,{model:X()})}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)(kt,{})}));export{_t as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{C as t,b as n,c as r,d as i,f as a,l as o,m as s,p as c,s as l,u,v as d,x as f,y as p}from"./cost-monitor-B6aZfo5f.js";import{a as m,c as h,d as g,f as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D}from"./icons-vendor-DiGC-dsJ.js";var O=e(t(),1),k=f();function A({ariaLabel:e,closeLabel:t,document:n,onClose:r}){return(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-document`,role:`dialog`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`small`,{children:n.path}),(0,k.jsx)(`h2`,{children:n.title})]}),(0,k.jsx)(`button`,{"aria-label":t,className:`trace-close-button`,onClick:r,type:`button`,children:(0,k.jsx)(l,{"aria-hidden":`true`,size:20,strokeWidth:2})})]}),(0,k.jsx)(`pre`,{children:n.content})]})}function j({stage:e,stageRecord:t,documents:n,stageCopy:r,stageArtifacts:i,copy:a,onBack:o,onOpenDocument:l,onStageChange:u}){let d=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],f=d.indexOf(e),p=d[f-1],h=d[f+1],g=n.filter(e=>e.kind===`evidence`).length,_=new Set(n.map(e=>e.kind)).size,v=new Map;for(let e of n)v.set(e.kind,[...v.get(e.kind)??[],e]);let y=t?.last_recorded_at??a.pending;return(0,k.jsxs)(`section`,{className:`trace-stage-detail`,children:[(0,k.jsx)(`header`,{children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`p`,{children:r[e].label}),(0,k.jsx)(`h3`,{children:i[e]}),(0,k.jsx)(`small`,{children:y})]})}),(0,k.jsxs)(`div`,{className:`trace-stage-metrics`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.documents}),(0,k.jsx)(`strong`,{children:n.length})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.types}),(0,k.jsx)(`strong`,{children:_})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.evidenceMetric}),(0,k.jsx)(`strong`,{children:g})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-documents`,children:n.length===0?(0,k.jsx)(`p`,{className:`trace-stage-empty`,children:a.empty}):[...v].map(([e,t])=>(0,k.jsxs)(`section`,{className:`trace-document-group`,children:[(0,k.jsxs)(`h4`,{children:[e,` `,(0,k.jsx)(`small`,{children:t.length})]}),t.map(e=>(0,k.jsxs)(`button`,{onClick:()=>l(e),type:`button`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`small`,{children:e.path})]},e.id))]},e))}),(0,k.jsxs)(`nav`,{"aria-label":a.navigation,className:`trace-stage-navigation`,children:[(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-previous`,disabled:f===0,onClick:()=>u(d[f-1]),type:`button`,children:[(0,k.jsx)(s,{"aria-hidden":`true`,size:18,strokeWidth:1.9}),(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.previous}),(0,k.jsx)(`strong`,{children:p?r[p].label.split(` (`)[0]:`—`})]})]}),(0,k.jsxs)(`div`,{className:`trace-navigation-center`,children:[(0,k.jsx)(`div`,{"aria-hidden":`true`,className:`trace-navigation-progress`,children:d.map((t,n)=>(0,k.jsx)(`span`,{"data-active":t===e,"data-passed":n<f},t))}),(0,k.jsxs)(`small`,{children:[f+1,` `,a.of,` `,d.length]}),(0,k.jsxs)(`button`,{className:`trace-all-stages-button`,onClick:o,type:`button`,children:[(0,k.jsx)(m,{"aria-hidden":`true`,size:15,strokeWidth:1.9}),a.back]})]}),(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-next`,disabled:f===d.length-1,onClick:()=>u(d[f+1]),type:`button`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.next}),(0,k.jsx)(`strong`,{children:h?r[h].label.split(` (`)[0]:`—`})]}),(0,k.jsx)(c,{"aria-hidden":`true`,size:18,strokeWidth:1.9})]})]})]})}function M({ariaLabel:e,children:t,closeLabel:n,onClose:r}){return(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,k.jsxs)(`div`,{className:`trace-stage-dialog-backdrop`,role:`presentation`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-backdrop-dismiss`,onClick:r,type:`button`}),(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-stage-dialog`,role:`dialog`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-close`,onClick:r,type:`button`,children:(0,k.jsx)(l,{"aria-hidden":`true`,size:22})}),t]})]})}var N=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],P=[`task`,`change`,`spec`,`prd`],F=[`coverage`,`documents`,`evidence`,`links`],I={"pt-BR":{lite:`Leve`,standard:`Padrão`,critical:`Crítico`},"en-US":{lite:`Lite`,standard:`Standard`,critical:`Critical`}},L={definition:D,planning:u,execution:w,decisions:S,verification:x,evidence:h},R={definition:`PRD · Requisitos`,planning:`SPEC · Change`,execution:`Tarefas · DAG · Runs · arquivos`,decisions:`Decisões do planejamento e da execução`,verification:`Testes · revisões · evals · checks`,evidence:`Evidências · resultados · rastreabilidade`},z={definition:`PRD · Requirements`,planning:`SPEC · Change`,execution:`Tasks · DAG · Runs · files`,decisions:`Planning and execution decisions`,verification:`Tests · reviews · evals · checks`,evidence:`Evidence · results · traceability`};function B(e,t){return[{label:`Task`,value:e.task_id,onOpen:void 0},{label:`Change`,value:e.change_id,onOpen:t.onOpenChange},{label:`SPEC`,value:e.spec_id,onOpen:t.onOpenSpec},{label:`PRD`,value:e.prd_id,onOpen:t.onOpenPrd}]}var V={definition:{label:`Definição (PRD + Requisitos)`,description:`Objetivo, contexto e critérios que definem o trabalho.`},planning:{label:`Planejamento (SPEC + Change)`,description:`Escopo, solução e mudanças previstas antes da execução.`},execution:{label:`Execução (Tarefas ou DAG)`,description:`Tarefas, dependências da DAG, Runs e arquivos produzidos.`},decisions:{label:`Decisões (Plano e Execução)`,description:`Decisões humanas e da IA tomadas no planejamento e na execução.`},verification:{label:`Verificação (Testes + Revisões)`,description:`Testes, revisões, evals e checks comparam o resultado aos Critérios de Aceite.`},evidence:{label:`Evidências (Resultados + Rastreabilidade)`,description:`Provas reproduzíveis vinculadas às Tasks, Changes, Runs e Critérios de Aceite.`}},H={definition:{label:`Definition (PRD + Requirements)`,description:`Objective, context, and criteria that define the work.`},planning:{label:`Planning (SPEC + Change)`,description:`Scope, solution, and changes planned before execution.`},execution:{label:`Execution (Tasks or DAG)`,description:`Tasks, DAG dependencies, Runs, and produced files.`},decisions:{label:`Decisions (Plan and Execution)`,description:`Human and AI decisions made during planning and execution.`},verification:{label:`Verification (Tests + Reviews)`,description:`Tests, reviews, evals, and checks compare results with acceptance criteria.`},evidence:{label:`Evidence (Results + Traceability)`,description:`Reproducible proof linked to Tasks, Changes, Runs, and acceptance criteria.`}},U={"pt-BR":{aria:`Rastreabilidade da task`,coverage:`etapas rastreadas`,evidence:`evidências`,close:`Fechar`,empty:`Nenhum documento relacionado.`,closeDocument:`Fechar documento`,back:`Voltar às etapas`,previous:`Anterior`,next:`Próxima`,documents:`Documentos`,types:`Tipos`,evidenceMetric:`Evidências`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copiar ID`,copied:`ID copiado`,unlinked:`Não vinculado`,recorded:`Registrada em`,pending:`Pendente`,missingTimestamp:`Sem data/hora`,tests:`testes registrados`,time:`Tempo`,tokens:`Tokens`,cost:`Custo`,measuredRuns:`Runs medidas`,items:`itens`,navigation:`Navegação entre etapas`,of:`de`,stageDetails:`Detalhes da etapa`,document:`Documento`},"en-US":{aria:`Task traceability`,coverage:`tracked stages`,evidence:`evidence items`,close:`Close`,empty:`No related document.`,closeDocument:`Close document`,back:`Back to stages`,previous:`Previous`,next:`Next`,documents:`Documents`,types:`Types`,evidenceMetric:`Evidence`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copy ID`,copied:`ID copied`,unlinked:`Not linked`,recorded:`Recorded at`,pending:`Pending`,missingTimestamp:`Missing date/time`,tests:`recorded tests`,time:`Time`,tokens:`Tokens`,cost:`Cost`,measuredRuns:`measured Runs`,items:`items`,navigation:`Stage navigation`,of:`of`,stageDetails:`Stage details`,document:`Document`}};function W({taskId:e,locale:t=`pt-BR`}){let n=t===`pt-BR`;return(0,k.jsx)(`div`,{className:`trace-backdrop`,children:(0,k.jsxs)(`section`,{"aria-busy":`true`,"aria-label":n?`Carregando rastreabilidade`:`Loading traceability`,"aria-live":`polite`,className:`trace-panel trace-loading-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon trace-loading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(o,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`h2`,{children:n?`Carregando rastreabilidade`:`Loading traceability`}),(0,k.jsx)(`p`,{children:e})]})]}),(0,k.jsxs)(`span`,{className:`trace-loading-status`,children:[(0,k.jsx)(o,{"aria-hidden":`true`,size:15,strokeWidth:2}),n?`Preparando trace`:`Preparing trace`]})]}),(0,k.jsx)(`div`,{className:`trace-loading-identifiers`,"aria-hidden":`true`,children:P.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-metrics`,"aria-hidden":`true`,children:F.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-stages`,"aria-hidden":`true`,children:N.map(e=>(0,k.jsx)(`span`,{},e))})]})})}function G({trace:e,locale:t=`pt-BR`,onClose:n,onOpenChange:o,onOpenPrd:s,onOpenSpec:u,embedded:d=!1}){let[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(null),[S,w]=(0,O.useState)(!1),D=U[t],P=t===`en-US`?H:V,F=t===`en-US`?z:R,W=(0,O.useMemo)(()=>new Map(N.map(t=>[t,e.documents.filter(e=>e.stage===t)])),[e.documents]),G=(0,O.useMemo)(()=>new Map(e.stages.map(e=>[e.stage,e])),[e.stages]),q=Math.round(e.coverage.stages_with_timestamps/e.coverage.total_stages*100),X=[e.task_id,e.change_id,e.spec_id,e.prd_id].filter(Boolean).length,Z=B(e,{onOpenChange:o,onOpenPrd:s,onOpenSpec:u}),Q=J(e.task_created_at,t),$=Y(e.task_created_at,t),ee=async()=>{try{await navigator.clipboard.writeText(e.task_id),w(!0),window.setTimeout(()=>w(!1),2e3)}catch{w(!1)}};return(0,k.jsxs)(`div`,{className:d?`trace-embedded`:`trace-backdrop`,children:[(0,k.jsxs)(`section`,{"aria-label":D.aria,"aria-modal":d?void 0:`true`,className:`trace-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(r,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`div`,{className:`trace-heading-title`,children:(0,k.jsxs)(`h2`,{children:[(0,k.jsx)(`span`,{className:`trace-title-prefix`,children:`Trace:`}),` `,e.task_title||e.task_id]})}),(0,k.jsx)(`p`,{children:t===`pt-BR`?`Visão completa do ciclo de desenvolvimento`:`Complete development lifecycle view`})]})]}),(0,k.jsxs)(`div`,{className:`trace-header-actions`,children:[(0,k.jsx)(K,{copy:D,locale:t,usage:e.usage}),d?null:(0,k.jsx)(`button`,{className:`trace-close-button`,"aria-label":D.close,onClick:n,type:`button`,children:(0,k.jsx)(l,{"aria-hidden":`true`,size:20,strokeWidth:2})})]})]}),(0,k.jsxs)(`section`,{className:`trace-task-summary`,"aria-label":t===`pt-BR`?`Resumo da tarefa`:`Task summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(C,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Criada em`:`Created at`}),(0,k.jsx)(`strong`,{children:Q})]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(i,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Desde a criação`:`Since creation`}),(0,k.jsx)(`strong`,{children:$})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-progress`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content trace-task-progress-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Progresso`:`Progress`}),(0,k.jsxs)(`strong`,{children:[e.task_progress,`%`]}),(0,k.jsx)(`progress`,{max:100,value:e.task_progress})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-classification`,children:[(0,k.jsx)(b,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Classificação`:`Classification`}),(0,k.jsxs)(`div`,{className:`trace-task-badges`,children:[(0,k.jsxs)(`span`,{className:`trace-mode-badge`,children:[(0,k.jsx)(E,{"aria-hidden":`true`,size:12,strokeWidth:2}),e.spec_id===null?D.taskFirst:D.specDriven]}),e.task_risk?(0,k.jsxs)(`span`,{className:`trace-risk-badge`,"data-risk":e.task_risk,children:[(0,k.jsx)(x,{"aria-hidden":`true`,size:12,strokeWidth:2}),I[t][e.task_risk]]}):null]})]})]})]}),(0,k.jsx)(`section`,{className:`trace-overview trace-lineage`,"aria-label":t===`pt-BR`?`Identificadores vinculados`:`Linked identifiers`,children:Z.map(({label:e,value:n,onOpen:r})=>{let i=n!==null&&r!==void 0,a=e===`Task`&&n!==null,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`trace-identifier-content`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(v,{"aria-hidden":`true`,size:11,strokeWidth:2}),e]}),(0,k.jsx)(`strong`,{title:n??D.unlinked,children:n??D.unlinked})]}),a?(0,k.jsx)(`button`,{"aria-label":S?t===`pt-BR`?`ID da tarefa copiado`:`Task ID copied`:t===`pt-BR`?`Copiar ID da tarefa`:`Copy task ID`,className:`trace-identifier-copy`,onClick:()=>void ee(),title:S?t===`pt-BR`?`Copiado`:`Copied`:void 0,type:`button`,children:S?(0,k.jsx)(_,{"aria-hidden":`true`,size:15}):(0,k.jsx)(y,{"aria-hidden":`true`,size:15})}):null,i?(0,k.jsx)(c,{"aria-hidden":`true`,size:15,strokeWidth:1.9}):null]});return(0,k.jsx)(`article`,{"data-empty":n===null,"data-linked":n!==null,"data-navigable":i,children:i?(0,k.jsx)(`button`,{"aria-label":`${t===`pt-BR`?`Abrir`:`Open`} ${e}: ${n}`,className:`trace-identifier-navigation`,onClick:()=>r(n),type:`button`,children:o}):(0,k.jsx)(`div`,{className:`trace-identifier-static`,children:o})},e)})}),(0,k.jsxs)(`section`,{className:`trace-metrics`,"aria-label":t===`pt-BR`?`Resumo da rastreabilidade`:`Traceability summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(r,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`strong`,{children:[q,`%`]}),(0,k.jsx)(`span`,{children:D.coverage})]}),(0,k.jsxs)(`small`,{children:[e.coverage.stages_with_timestamps,` `,D.of,` `,e.coverage.total_stages]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(T,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.documents.length}),(0,k.jsx)(`span`,{children:D.documents})]}),(0,k.jsx)(`small`,{children:t===`pt-BR`?`no ciclo completo`:`in the full lifecycle`})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(b,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.coverage.evidence_count}),(0,k.jsx)(`span`,{children:D.evidenceMetric})]}),(0,k.jsxs)(`small`,{children:[e.coverage.test_count,` `,D.tests]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(v,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:X}),(0,k.jsx)(`span`,{children:t===`pt-BR`?`Vínculos`:`Links`})]}),(0,k.jsx)(`small`,{children:`Task · Change · SPEC · PRD`})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-menu`,children:N.map((e,n)=>{let r=L[e],i=(W.get(e)??[]).length;return(0,k.jsxs)(`button`,{className:`trace-stage-menu-button`,"data-stage":e,onClick:()=>h(e),type:`button`,children:[(0,k.jsx)(`span`,{className:`trace-stage-number`,children:String(n+1).padStart(2,`0`)}),(0,k.jsx)(r,{className:`trace-stage-icon`,"aria-hidden":`true`,size:22,strokeWidth:1.8}),(0,k.jsx)(`strong`,{children:P[e].label}),(0,k.jsx)(`em`,{children:P[e].description}),(0,k.jsxs)(`span`,{className:`trace-stage-action`,children:[(0,k.jsxs)(`small`,{children:[(0,k.jsx)(a,{"aria-hidden":`true`,size:13}),` `,i,` `,D.items]}),(0,k.jsxs)(`span`,{children:[t===`pt-BR`?`Ver etapa`:`View stage`,(0,k.jsx)(c,{"aria-hidden":`true`,size:13,strokeWidth:2})]})]})]},e)})})]}),m?(0,k.jsx)(M,{ariaLabel:D.stageDetails,closeLabel:t===`pt-BR`?`Fechar detalhes da etapa`:`Close stage details`,onClose:()=>h(null),children:(0,k.jsx)(j,{copy:D,documents:W.get(m)??[],locale:t,onBack:()=>h(null),onOpenDocument:p,onStageChange:h,stage:m,stageArtifacts:F,stageRecord:G.get(m),stageCopy:P})}):null,f?(0,k.jsx)(A,{ariaLabel:`${D.document} ${f.title}`,closeLabel:D.closeDocument,document:f,onClose:()=>p(null)}):null]})}function K({usage:e,locale:t,copy:n}){let r=[{label:n.time,metric:e.duration_ms,value:q(e.duration_ms.value,t)},{label:n.tokens,metric:e.total_tokens,value:e.total_tokens.value===null?`—`:d(e.total_tokens.value,t)},{label:n.cost,metric:e.cost,value:e.cost.value===null||e.cost.currency===null?`—`:p(e.cost.value,e.cost.currency,t)}];return(0,k.jsx)(`section`,{"aria-label":t===`pt-BR`?`Uso agregado da Task`:`Aggregated Task usage`,children:(0,k.jsx)(`dl`,{className:`trace-usage-strip`,children:r.map(({label:t,metric:r,value:i})=>{let a=Math.round(r.coverage_ratio*100),o=`${r.known_runs}/${e.run_count} ${n.measuredRuns} · ${a}%`;return(0,k.jsxs)(`div`,{title:o,children:[(0,k.jsxs)(`dt`,{children:[t,(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`trace-usage-coverage`,"data-complete":r.unknown_runs===0}),(0,k.jsx)(`span`,{className:`trace-usage-sr-only`,children:o})]}),(0,k.jsx)(`dd`,{children:i})]},t)})})})}function q(e,t){return e===null?`—`:n(e,t)}function J(e,t){if(e===null)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`short`}).format(n)}function Y(e,t){if(e===null)return`—`;let n=Date.parse(e);if(!Number.isFinite(n))return`—`;let r=Math.max(0,Date.now()-n),i=Math.max(1,Math.round(r/6e4)),a;if(i<60)a=`${i}m`;else{let e=Math.round(i/60);if(e<24)a=`${e}h`;else{let n=Math.round(e/24);if(n<7)a=`${n}d`;else{let e=Math.round(n/7);a=t===`pt-BR`?`${e}sem`:`${e}w`}}}return t===`pt-BR`?`Há ${a}`:`${a} ago`}export{G as n,W as t};
@@ -1 +0,0 @@
1
- import{i as e,s as t}from"./preload-helper-BdFrVu1K.js";import{D as n}from"./iframe-9yZfIsdT.js";import{t as r}from"./jsx-runtime-f3rHp9ZU.js";function i(e){e?.focus()}function a(e,t,n,r){if(e.key===`Escape`){e.preventDefault(),r();return}if(e.key!==`Tab`||t.length===0)return;let i=t.indexOf(n),a=e.shiftKey?i<=0?t.length-1:i-1:i<0||i===t.length-1?0:i+1;e.preventDefault(),t[a]?.focus()}var o=e((()=>{}));function s({variant:e=`primary`,className:t=``,...n}){return(0,b.jsx)(`button`,{className:`button button-${e} ${t}`.trim(),type:`button`,...n})}function c({children:e,tone:t=`neutral`}){return(0,b.jsx)(`span`,{className:`badge badge-${t}`,children:e})}function l({children:e,accent:t=!1}){return(0,b.jsx)(`article`,{className:t?`card card-accent`:`card`,children:e})}function u({label:e,value:t,change:n}){return(0,b.jsxs)(l,{children:[(0,b.jsx)(`p`,{className:`metric-label`,children:e}),(0,b.jsx)(`strong`,{className:`metric-value`,children:t}),(0,b.jsx)(`p`,{className:`metric-change`,children:n})]})}function d({label:e,hint:t,error:n,...r}){let i=`${r.id??r.name??`field`}-description`;return(0,b.jsxs)(`label`,{className:`field`,children:[(0,b.jsx)(`span`,{children:e}),t?(0,b.jsx)(`small`,{children:t}):null,(0,b.jsx)(`input`,{"aria-describedby":t||n?i:void 0,"aria-invalid":!!n,...r}),n?(0,b.jsx)(`em`,{id:i,children:n}):t?(0,b.jsx)(`i`,{id:i,children:t}):null]})}function f({label:e,children:t,...n}){return(0,b.jsxs)(`label`,{className:`field`,children:[(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`select`,{...n,children:t})]})}function p(){return(0,b.jsx)(l,{children:(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsx)(`span`,{className:`empty-icon`,"aria-hidden":`true`,children:`◇`}),(0,b.jsx)(`h3`,{children:`Nenhum item ainda`}),(0,b.jsx)(`p`,{children:`Crie o primeiro registro para começar a acompanhar esta área.`}),(0,b.jsx)(s,{children:`Adicionar item`})]})})}function m(){return(0,b.jsx)(`div`,{className:`table-wrap`,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`caption`,{className:`sr-only`,children:`Exemplo de execuções recentes`}),(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Execução`}),(0,b.jsx)(`th`,{children:`Status`}),(0,b.jsx)(`th`,{className:`number`,children:`Tokens`}),(0,b.jsx)(`th`,{className:`number`,children:`Custo`})]})}),(0,b.jsxs)(`tbody`,{children:[(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`strong`,{children:`SPEC Checkout`}),(0,b.jsx)(`small`,{children:`há 12 min`})]}),(0,b.jsx)(`td`,{children:(0,b.jsx)(c,{tone:`success`,children:`Concluída`})}),(0,b.jsx)(`td`,{className:`number`,children:`82.410`}),(0,b.jsx)(`td`,{className:`number`,children:`R$ 18,42`})]}),(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`strong`,{children:`Task Ajustar login`}),(0,b.jsx)(`small`,{children:`há 48 min`})]}),(0,b.jsx)(`td`,{children:(0,b.jsx)(c,{tone:`warning`,children:`Validando`})}),(0,b.jsx)(`td`,{className:`number`,children:`14.820`}),(0,b.jsx)(`td`,{className:`number`,children:`R$ 3,17`})]})]})]})})}function h(){return(0,b.jsxs)(`form`,{className:`filter-form`,onSubmit:e=>e.preventDefault(),children:[(0,b.jsxs)(f,{"aria-label":`Filtrar por status`,label:`Status`,defaultValue:`all`,children:[(0,b.jsx)(`option`,{value:`all`,children:`Todos os status`}),(0,b.jsx)(`option`,{value:`executing`,children:`Em execução`}),(0,b.jsx)(`option`,{value:`completed`,children:`Concluído`})]}),(0,b.jsx)(d,{label:`Buscar trabalho`,placeholder:`Task, SPEC ou PRD`,type:`search`}),(0,b.jsx)(s,{type:`submit`,children:`Aplicar filtros`}),(0,b.jsx)(s,{type:`reset`,variant:`ghost`,children:`Limpar`})]})}function g(){return(0,b.jsxs)(l,{children:[(0,b.jsxs)(`div`,{className:`chart-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`metric-label`,children:`Tokens por execução`}),(0,b.jsx)(`strong`,{children:`Últimas 6 execuções`})]}),(0,b.jsx)(c,{tone:`accent`,children:`+12%`})]}),(0,b.jsx)(`div`,{"aria-label":`Gráfico de barras: uso de tokens cresce de 34 para 91 unidades nas últimas seis execuções.`,className:`bar-chart`,role:`img`,children:[34,56,43,78,62,91].map((e,t)=>(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`bar-chart-column`,style:{"--bar-size":`${e}%`},children:(0,b.jsx)(`i`,{})},`${e}-${t}`))}),(0,b.jsx)(`p`,{className:`chart-caption`,children:`O resumo textual preserva o significado fora da cor e da forma.`})]})}function _(){let[e,t]=(0,y.useState)(!1),n=(0,y.useRef)(null),r=(0,y.useRef)(null),o=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!e)return;i(o.current);let s=e=>{a(e,Array.from(r.current?.querySelectorAll(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)??[]),document.activeElement,()=>t(!1))};return window.addEventListener(`keydown`,s),()=>{window.removeEventListener(`keydown`,s),i(n.current)}},[e]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(l,{children:[(0,b.jsx)(`p`,{className:`metric-label`,children:`Dialog / popup`}),(0,b.jsx)(`h3`,{children:`Detalhe com foco explícito`}),(0,b.jsx)(`p`,{children:`Use para decisões focadas, com título, descrição e saída sempre disponíveis.`}),(0,b.jsx)(s,{onClick:()=>t(!0),ref:n,children:`Abrir exemplo`})]}),e?(0,b.jsx)(`div`,{className:`dialog-backdrop`,onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,b.jsxs)(`section`,{"aria-describedby":`catalog-dialog-description`,"aria-labelledby":`catalog-dialog-title`,"aria-modal":`true`,className:`dialog-panel`,ref:r,role:`dialog`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`metric-label`,children:`Task em verificação`}),(0,b.jsx)(`h3`,{id:`catalog-dialog-title`,children:`Revisar evidências`})]}),(0,b.jsx)(`button`,{"aria-label":`Fechar diálogo`,className:`dialog-close`,onClick:()=>t(!1),ref:o,type:`button`,children:`×`})]}),(0,b.jsx)(`p`,{id:`catalog-dialog-description`,children:`Confirme os artefatos associados antes de concluir a etapa.`}),(0,b.jsxs)(`footer`,{children:[(0,b.jsx)(s,{onClick:()=>t(!1),variant:`secondary`,children:`Voltar`}),(0,b.jsx)(s,{onClick:()=>t(!1),children:`Confirmar revisão`})]})]})}):null]})}function v(){return(0,b.jsxs)(`div`,{className:`state-grid`,children:[(0,b.jsx)(l,{children:(0,b.jsxs)(`div`,{"aria-busy":`true`,"aria-live":`polite`,className:`state-panel`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`loading-spinner`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Carregando projeção`}),(0,b.jsx)(`p`,{children:`Aguarde enquanto os dados locais são consolidados.`})]})]})}),(0,b.jsx)(p,{}),(0,b.jsx)(l,{children:(0,b.jsxs)(`div`,{className:`state-panel state-error`,role:`alert`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`state-symbol`,children:`!`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Não foi possível atualizar`}),(0,b.jsx)(`p`,{children:`Verifique a sessão e tente novamente sem perder os filtros.`}),(0,b.jsx)(s,{variant:`secondary`,children:`Tentar novamente`})]})]})})]})}var y,b,x=e((()=>{y=t(n(),1),o(),b=r(),s.__docgenInfo={description:``,methods:[],displayName:`Button`,props:{variant:{required:!1,tsType:{name:`union`,raw:`"primary" | "secondary" | "ghost"`,elements:[{name:`literal`,value:`"primary"`},{name:`literal`,value:`"secondary"`},{name:`literal`,value:`"ghost"`}]},description:``,defaultValue:{value:`"primary"`,computed:!1}},className:{defaultValue:{value:`""`,computed:!1},required:!1}}},c.__docgenInfo={description:``,methods:[],displayName:`Badge`,props:{children:{required:!0,tsType:{name:`ReactNode`},description:``},tone:{required:!1,tsType:{name:`union`,raw:`"neutral" | "accent" | "success" | "warning" | "error"`,elements:[{name:`literal`,value:`"neutral"`},{name:`literal`,value:`"accent"`},{name:`literal`,value:`"success"`},{name:`literal`,value:`"warning"`},{name:`literal`,value:`"error"`}]},description:``,defaultValue:{value:`"neutral"`,computed:!1}}}},l.__docgenInfo={description:``,methods:[],displayName:`Card`,props:{children:{required:!0,tsType:{name:`ReactNode`},description:``},accent:{required:!1,tsType:{name:`boolean`},description:``,defaultValue:{value:`false`,computed:!1}}}},u.__docgenInfo={description:``,methods:[],displayName:`Metric`,props:{label:{required:!0,tsType:{name:`string`},description:``},value:{required:!0,tsType:{name:`string`},description:``},change:{required:!0,tsType:{name:`string`},description:``}}},d.__docgenInfo={description:``,methods:[],displayName:`Field`,props:{label:{required:!0,tsType:{name:`string`},description:``},hint:{required:!1,tsType:{name:`string`},description:``},error:{required:!1,tsType:{name:`string`},description:``}}},f.__docgenInfo={description:``,methods:[],displayName:`SelectField`,props:{label:{required:!0,tsType:{name:`string`},description:``},children:{required:!0,tsType:{name:`ReactNode`},description:``}}},p.__docgenInfo={description:``,methods:[],displayName:`EmptyState`},m.__docgenInfo={description:``,methods:[],displayName:`DataTable`},h.__docgenInfo={description:``,methods:[],displayName:`FilterForm`},g.__docgenInfo={description:``,methods:[],displayName:`ChartPanel`},_.__docgenInfo={description:``,methods:[],displayName:`DialogSpecimen`},v.__docgenInfo={description:``,methods:[],displayName:`StateGallery`}}));function S({children:e,page:t}){let[n,r]=(0,T.useState)(!1);return(0,E.jsxs)(`div`,{className:`catalog-shell${n?` theme-dark`:``}`,children:[(0,E.jsxs)(`header`,{className:`topbar`,children:[(0,E.jsxs)(`a`,{className:`brand`,href:`#/design-system`,"aria-label":`ZAIP Design System`,children:[(0,E.jsx)(`img`,{className:`brand-logo`,src:`logo_novo_azul.png`,alt:`ZAIP`}),(0,E.jsx)(`span`,{className:`brand-product`,children:`Design system`})]}),(0,E.jsxs)(`div`,{className:`topbar-actions`,children:[(0,E.jsxs)(`nav`,{"aria-label":`Catálogo visual`,children:[(0,E.jsx)(`a`,{"aria-current":t===`design-system`?`page`:void 0,href:`#/design-system`,children:`Design system`}),(0,E.jsx)(`a`,{"aria-current":t===`components`?`page`:void 0,href:`#/components`,children:`Components`})]}),(0,E.jsxs)(`button`,{className:`theme-toggle`,type:`button`,"aria-pressed":n,onClick:()=>r(e=>!e),children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,children:n?`☀`:`☾`}),n?`Light mode`:`Dark mode`]})]})]}),(0,E.jsx)(`main`,{children:e}),(0,E.jsxs)(`footer`,{children:[(0,E.jsx)(`span`,{children:`Fonte canônica: .agents/design/DESIGN.md`}),(0,E.jsx)(`span`,{children:`ZAIP-AIOS · catálogo local`})]})]})}function C({eyebrow:e,title:t,description:n}){return(0,E.jsxs)(`section`,{className:`page-intro`,children:[(0,E.jsx)(`p`,{className:`eyebrow`,children:e}),(0,E.jsx)(`h1`,{children:t}),(0,E.jsx)(`p`,{className:`lede`,children:n})]})}function w({title:e,description:t,children:n}){return(0,E.jsxs)(`section`,{className:`catalog-section`,children:[(0,E.jsxs)(`div`,{className:`section-heading`,children:[(0,E.jsx)(`h2`,{children:e}),t?(0,E.jsx)(`p`,{children:t}):null]}),n]})}var T,E,D=e((()=>{T=t(n(),1),E=r(),S.__docgenInfo={description:``,methods:[],displayName:`CatalogShell`,props:{children:{required:!0,tsType:{name:`ReactNode`},description:``},page:{required:!0,tsType:{name:`string`},description:``}}},C.__docgenInfo={description:``,methods:[],displayName:`PageIntro`,props:{eyebrow:{required:!0,tsType:{name:`string`},description:``},title:{required:!0,tsType:{name:`string`},description:``},description:{required:!0,tsType:{name:`string`},description:``}}},w.__docgenInfo={description:``,methods:[],displayName:`Section`,props:{title:{required:!0,tsType:{name:`string`},description:``},description:{required:!1,tsType:{name:`string`},description:``},children:{required:!0,tsType:{name:`ReactNode`},description:``}}}}));export{s as a,m as c,h as d,u as f,x as h,c as i,_ as l,v as m,w as n,l as o,f as p,D as r,g as s,C as t,d as u};
@@ -1,27 +0,0 @@
1
- import{i as e}from"./preload-helper-BdFrVu1K.js";import{a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./CatalogShell-BWY-80s4.js";import{t as g}from"./jsx-runtime-f3rHp9ZU.js";function _(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(m,{eyebrow:`Documentação executável`,title:`Components`,description:`Famílias reais do dashboard representadas por espécimes compartilhados com o Storybook. O catálogo documenta o contrato; os componentes de negócio continuam em seus módulos.`}),(0,v.jsx)(l,{title:`Dialogs e popups`,description:`Superfícies focadas com nome acessível, contexto, Escape e ação de fechamento.`,children:(0,v.jsx)(s,{})}),(0,v.jsx)(l,{title:`Cards e métricas`,description:`Cards agrupam uma ideia; métricas mantêm unidade, período e comparação.`,children:(0,v.jsxs)(`div`,{className:`metric-grid`,children:[(0,v.jsx)(i,{label:`Tokens totais`,value:`1,28M`,change:`+8,4% no período`}),(0,v.jsx)(i,{label:`Custo de execução`,value:`R$ 284`,change:`62% do custo total`}),(0,v.jsx)(i,{label:`Assertividade`,value:`94,2%`,change:`+3,1 p.p.`})]})}),(0,v.jsx)(l,{title:`Tabelas`,description:`Cabeçalhos semânticos, alinhamento numérico e contêiner responsivo.`,children:(0,v.jsx)(n,{})}),(0,v.jsxs)(l,{title:`Filtros e formulários`,description:`Filtros frequentes ficam compactos; edição mantém labels, ajuda e erro acionável.`,children:[(0,v.jsx)(r,{}),(0,v.jsx)(u,{children:(0,v.jsxs)(`div`,{className:`form-grid`,children:[(0,v.jsx)(h,{label:`Nome`,placeholder:`Ex.: Checkout B2B`}),(0,v.jsx)(h,{label:`Identificador`,hint:`Somente letras minúsculas e hífen.`,defaultValue:`checkout-b2b`}),(0,v.jsxs)(d,{label:`Risco`,defaultValue:`standard`,children:[(0,v.jsx)(`option`,{value:`lite`,children:`Lite`}),(0,v.jsx)(`option`,{value:`standard`,children:`Standard`}),(0,v.jsx)(`option`,{value:`critical`,children:`Critical`})]}),(0,v.jsx)(h,{label:`Responsável`,defaultValue:``,error:`Selecione uma pessoa responsável.`})]})})]}),(0,v.jsx)(l,{title:`Badges e ações`,description:`Sinais curtos permanecem legíveis em texto; ações expõem hierarquia e estado.`,children:(0,v.jsxs)(u,{children:[(0,v.jsxs)(`div`,{className:`specimen-row`,children:[(0,v.jsx)(o,{tone:`accent`,children:`Em execução`}),(0,v.jsx)(o,{tone:`success`,children:`Concluída`}),(0,v.jsx)(o,{tone:`warning`,children:`Em verificação`}),(0,v.jsx)(o,{tone:`error`,children:`Falhou`}),(0,v.jsx)(o,{children:`Planejada`})]}),(0,v.jsxs)(`div`,{className:`specimen-row`,children:[(0,v.jsx)(t,{children:`Primário`}),(0,v.jsx)(t,{variant:`secondary`,children:`Secundário`}),(0,v.jsx)(t,{variant:`ghost`,children:`Ghost`}),(0,v.jsx)(t,{disabled:!0,children:`Desabilitado`})]})]})}),(0,v.jsx)(l,{title:`Gráficos`,description:`Visualizações possuem título descritivo, comparação consistente e alternativa textual.`,children:(0,v.jsx)(p,{})}),(0,v.jsx)(l,{title:`Carregando, vazio e erro`,description:`Estados assíncronos explicam o que ocorre e oferecem recuperação quando possível.`,children:(0,v.jsx)(c,{})}),(0,v.jsx)(l,{title:`Mapa para o dashboard`,description:`Famílias documentadas aqui correspondem a padrões reais, sem acoplar o catálogo ao produto.`,children:(0,v.jsx)(`div`,{className:`table-wrap`,children:(0,v.jsxs)(`table`,{children:[(0,v.jsx)(`caption`,{className:`sr-only`,children:`Famílias de componentes e referências no dashboard`}),(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:`Família`}),(0,v.jsx)(`th`,{children:`Referência de produto`}),(0,v.jsx)(`th`,{children:`Contrato`})]})}),(0,v.jsx)(`tbody`,{children:y.map(([e,t,n])=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:(0,v.jsx)(`strong`,{children:e})}),(0,v.jsx)(`td`,{children:(0,v.jsx)(`code`,{children:t})}),(0,v.jsx)(`td`,{children:n})]},e))})]})})})]})}var v,y,b=e((()=>{f(),a(),v=g(),y=[[`Dialogs e popups`,`TaskDetailsDialog, TraceStageDialog`,`Foco, contexto e saída explícita`],[`Cards e métricas`,`TaskBoard, CostSummary`,`Agrupamento, valor, unidade e tendência`],[`Tabelas`,`DataTable, CostTables`,`Cabeçalhos, densidade e alinhamento numérico`],[`Filtros e formulários`,`CostFilters, PricingSettingsDialog`,`Labels, ajuda e erro acionável`],[`Badges`,`task-origin-badge, status badges`,`Estado legível sem depender apenas de cor`],[`Gráficos`,`CostCharts`,`Título, resumo textual e escala comparável`],[`Estados`,`App, TraceabilityWorkspace`,`Carregando, vazio e erro recuperável`]],_.__docgenInfo={description:``,methods:[],displayName:`ComponentsPage`}})),x,S,C,w,T,E,D,O,k,A,j;e((()=>{a(),b(),x=g(),S={title:`ZAIP/Components`,component:_,parameters:{layout:`fullscreen`}},C={},w={render:()=>(0,x.jsx)(s,{})},T={render:()=>(0,x.jsxs)(`div`,{className:`metric-grid`,children:[(0,x.jsx)(i,{label:`Tokens totais`,value:`1,28M`,change:`+8,4% no período`}),(0,x.jsx)(i,{label:`Custo`,value:`R$ 284`,change:`62% do total`}),(0,x.jsx)(i,{label:`Assertividade`,value:`94,2%`,change:`+3,1 p.p.`})]})},E={render:()=>(0,x.jsx)(n,{})},D={render:()=>(0,x.jsx)(r,{})},O={render:()=>(0,x.jsx)(u,{children:(0,x.jsxs)(`div`,{className:`specimen-row`,children:[(0,x.jsx)(o,{tone:`accent`,children:`Em execução`}),(0,x.jsx)(o,{tone:`success`,children:`Concluída`}),(0,x.jsx)(o,{tone:`warning`,children:`Em verificação`}),(0,x.jsx)(o,{tone:`error`,children:`Falhou`}),(0,x.jsx)(o,{children:`Planejada`})]})})},k={render:()=>(0,x.jsx)(p,{})},A={render:()=>(0,x.jsx)(c,{})},C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{}`,...C.parameters?.docs?.source}}},w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
2
- render: () => <DialogSpecimen />
3
- }`,...w.parameters?.docs?.source}}},T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
4
- render: () => <div className="metric-grid">\r
5
- <Metric label="Tokens totais" value="1,28M" change="+8,4% no período" />\r
6
- <Metric label="Custo" value="R$ 284" change="62% do total" />\r
7
- <Metric label="Assertividade" value="94,2%" change="+3,1 p.p." />\r
8
- </div>
9
- }`,...T.parameters?.docs?.source}}},E.parameters={...E.parameters,docs:{...E.parameters?.docs,source:{originalSource:`{
10
- render: () => <DataTable />
11
- }`,...E.parameters?.docs?.source}}},D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`{
12
- render: () => <FilterForm />
13
- }`,...D.parameters?.docs?.source}}},O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`{
14
- render: () => <Card>\r
15
- <div className="specimen-row">\r
16
- <Badge tone="accent">Em execução</Badge>\r
17
- <Badge tone="success">Concluída</Badge>\r
18
- <Badge tone="warning">Em verificação</Badge>\r
19
- <Badge tone="error">Falhou</Badge>\r
20
- <Badge>Planejada</Badge>\r
21
- </div>\r
22
- </Card>
23
- }`,...O.parameters?.docs?.source}}},k.parameters={...k.parameters,docs:{...k.parameters?.docs,source:{originalSource:`{
24
- render: () => <ChartPanel />
25
- }`,...k.parameters?.docs?.source}}},A.parameters={...A.parameters,docs:{...A.parameters?.docs,source:{originalSource:`{
26
- render: () => <StateGallery />
27
- }`,...A.parameters?.docs?.source}}},j=[`Catalog`,`DialogsAndPopups`,`CardsAndMetrics`,`Tables`,`FiltersAndForms`,`Badges`,`Charts`,`LoadingEmptyAndError`]}))();export{O as Badges,T as CardsAndMetrics,C as Catalog,k as Charts,w as DialogsAndPopups,D as FiltersAndForms,A as LoadingEmptyAndError,E as Tables,j as __namedExportsOrder,S as default};
@@ -1 +0,0 @@
1
- import{i as e}from"./preload-helper-BdFrVu1K.js";import{a as t,h as n,i as r,n as i,o as a,r as o,t as s,u as c}from"./CatalogShell-BWY-80s4.js";import{t as l}from"./jsx-runtime-f3rHp9ZU.js";function u({colors:e}){return(0,f.jsx)(`div`,{className:`swatch-grid`,children:e.map(([e,t,n])=>(0,f.jsxs)(`article`,{className:`swatch`,children:[(0,f.jsx)(`div`,{style:{background:t}}),(0,f.jsx)(`strong`,{children:e}),(0,f.jsx)(`code`,{children:t}),(0,f.jsx)(`small`,{children:n})]},e))})}function d(){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{eyebrow:`Fundação visual`,title:`Design system`,description:`Tokens, linguagem e decisões visuais compartilhadas pelas interfaces do repositório. Cada amostra abaixo aplica o contrato central em uma superfície real.`}),(0,f.jsx)(i,{title:`Cores primárias`,description:`O ciano é a assinatura ZAIP e fica reservado para identidade, foco e ações prioritárias.`,children:(0,f.jsx)(u,{colors:p})}),(0,f.jsx)(i,{title:`Cores secundárias`,description:`A família navy cria profundidade e sustenta superfícies escuras sem competir com o ciano.`,children:(0,f.jsx)(u,{colors:m})}),(0,f.jsx)(i,{title:`Neutras`,description:`A escala neutra organiza texto, bordas e superfícies com contraste previsível.`,children:(0,f.jsx)(u,{colors:h})}),(0,f.jsx)(i,{title:`Cores semânticas`,description:`Success, warning e danger comunicam estado; elas não substituem as cores da marca.`,children:(0,f.jsx)(`div`,{className:`semantic-grid`,children:g.map(([e,t,n,r])=>(0,f.jsxs)(`article`,{className:`semantic-card semantic-${r}`,children:[(0,f.jsx)(`span`,{className:`semantic-dot`,style:{background:t},"aria-hidden":`true`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:e}),(0,f.jsx)(`p`,{children:n}),(0,f.jsx)(`code`,{children:t})]})]},e))})}),(0,f.jsx)(i,{title:`Tipografia`,description:`Hierarquia compacta para produto e escala expressiva para superfícies públicas.`,children:(0,f.jsxs)(a,{children:[(0,f.jsxs)(`div`,{className:`type-sample type-display`,children:[(0,f.jsx)(`span`,{children:`Display`}),`Agentes que entregam com evidência.`]}),(0,f.jsxs)(`div`,{className:`type-sample type-heading`,children:[(0,f.jsx)(`span`,{children:`Heading`}),`Clareza antes de complexidade`]}),(0,f.jsxs)(`div`,{className:`type-sample type-body`,children:[(0,f.jsx)(`span`,{children:`Body`}),`Uma linguagem visual consistente reduz decisões repetidas e ajuda agentes e pessoas a reutilizarem o caminho certo.`]})]})}),(0,f.jsx)(i,{title:`Superfícies e ações`,description:`Tokens precisam aparecer em componentes reais, não apenas em tabelas de cores.`,children:(0,f.jsxs)(`div`,{className:`two-column`,children:[(0,f.jsxs)(a,{accent:!0,children:[(0,f.jsx)(r,{tone:`accent`,children:`Contrato ativo`}),(0,f.jsx)(`h3`,{children:`Uma fonte canônica`}),(0,f.jsx)(`p`,{children:`O DESIGN.md orienta intenção; tokens e stories mantêm a documentação executável.`}),(0,f.jsxs)(`div`,{className:`row`,children:[(0,f.jsx)(t,{children:`Executar agora`}),(0,f.jsx)(t,{variant:`secondary`,children:`Ver detalhes`})]})]}),(0,f.jsxs)(a,{children:[(0,f.jsx)(c,{label:`Nome do fluxo`,hint:`Use um nome curto e orientado ao resultado.`,defaultValue:`Onboarding autônomo`}),(0,f.jsxs)(`div`,{className:`row`,children:[(0,f.jsx)(r,{tone:`success`,children:`Pronto`}),(0,f.jsx)(r,{tone:`warning`,children:`Revisão`}),(0,f.jsx)(r,{tone:`error`,children:`Falhou`})]})]})]})}),(0,f.jsx)(i,{title:`Dark mode na prática`,description:`O tema troca canvas, superfícies, texto e bordas, preservando o ciano como foco e ação. Use o controle no topo para aplicar o tema à página inteira.`,children:(0,f.jsxs)(`div`,{className:`dark-specimen`,children:[(0,f.jsxs)(`div`,{className:`dark-specimen-copy`,children:[(0,f.jsx)(r,{tone:`accent`,children:`Tema escuro`}),(0,f.jsx)(`p`,{className:`eyebrow`,children:`Automação ativa`}),(0,f.jsx)(`h3`,{children:`Decisões claras, mesmo com menos luz.`}),(0,f.jsx)(`p`,{children:`Superfícies navy reduzem brilho, enquanto texto, bordas e estados preservam contraste e hierarquia.`}),(0,f.jsxs)(`div`,{className:`row`,children:[(0,f.jsx)(t,{children:`Executar agora`}),(0,f.jsx)(t,{variant:`secondary`,children:`Ver detalhes`})]})]}),(0,f.jsxs)(`div`,{className:`dark-metric-card`,children:[(0,f.jsx)(`span`,{className:`metric-label`,children:`Execuções saudáveis`}),(0,f.jsx)(`strong`,{children:`98,7%`}),(0,f.jsxs)(`div`,{className:`dark-status-row`,children:[(0,f.jsx)(r,{tone:`success`,children:`Pronto`}),(0,f.jsx)(r,{tone:`warning`,children:`Revisão`}),(0,f.jsx)(r,{tone:`error`,children:`Falhou`})]})]})]})}),(0,f.jsx)(i,{title:`Escala`,description:`Espaçamento e raios previsíveis evitam microdecisões a cada tela.`,children:(0,f.jsxs)(`div`,{className:`scale-grid`,children:[[`4`,`8`,`16`,`24`,`40`,`64`].map(e=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{style:{width:`${e}px`}}),(0,f.jsxs)(`code`,{children:[e,`px`]})]},e)),[`8`,`16`,`24`,`999`].map(e=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`i`,{style:{borderRadius:`${e}px`}}),(0,f.jsxs)(`code`,{children:[`radius `,e,`px`]})]},`r-${e}`))]})})]})}var f,p,m,h,g,_=e((()=>{o(),n(),f=l(),p=[[`Primary`,`#00B0F0`,`Ação, foco e identidade`],[`Primary strong`,`#018abb`,`Hover e ênfase reforçada`],[`Primary ink`,`#006b91`,`Texto e ícones sobre fundos claros`]],m=[[`Secondary`,`#0a0e17`,`Navy profundo da identidade`],[`Secondary surface`,`#111827`,`Superfície elevada no tema escuro`],[`Secondary muted`,`#334155`,`Apoio visual de menor contraste`]],h=[[`Text primary`,`#0f172a`,`--zaip-ink`],[`Text secondary`,`#475569`,`--zaip-copy`],[`Text muted`,`#94a3b8`,`--zaip-muted`],[`Border`,`#e2e8f0`,`--zaip-border`],[`Surface muted`,`#f8fafc`,`--zaip-surface-muted`],[`Canvas`,`#f5f7fb`,`--zaip-bg`],[`White`,`#ffffff`,`--zaip-surface`]],g=[[`Success`,`#16a34a`,`Operação concluída`,`success`],[`Warning`,`#d97706`,`Atenção ou revisão`,`warning`],[`Danger`,`#dc2626`,`Erro ou ação destrutiva`,`danger`]],d.__docgenInfo={description:``,methods:[],displayName:`DesignSystemPage`}})),v,y,b;e((()=>{_(),v={title:`ZAIP/Design System`,component:d,parameters:{layout:`fullscreen`}},y={},y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{}`,...y.parameters?.docs?.source}}},b=[`Overview`]}))();export{y as Overview,b as __namedExportsOrder,v as default};
@@ -1 +0,0 @@
1
- import{i as e}from"./preload-helper-BdFrVu1K.js";import{_ as t,d as n,f as r,g as i}from"./iframe-9yZfIsdT.js";import{n as a,t as o}from"./chunk-DRQKCCAG-D6AsDkMK.js";var s;e((()=>{o(),t(),r(),s=(0,n(a(),1).default)(2)(async(e,t)=>e===!1?t:i(t))}))();export{s as formatter};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./DocsRenderer-JROSPFPF-BVN7xHtv.js";t();export{e as MDXProvider};