@zaip-ai/cli 5.0.0 → 5.2.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 (109) hide show
  1. package/dist/services/adapters.d.ts +1 -1
  2. package/dist/services/adapters.js +1 -1
  3. package/dist/services/codex-native-tool-authority-template.d.ts.map +1 -1
  4. package/dist/services/codex-native-tool-authority-template.js +19 -12
  5. package/dist/services/codex-native-tool-authority-template.js.map +1 -1
  6. package/dist/services/codex-pre-tool-hook-template.js +6 -6
  7. package/dist/services/codex-pre-tool-host-context-template.d.ts.map +1 -1
  8. package/dist/services/codex-pre-tool-host-context-template.js +34 -3
  9. package/dist/services/codex-pre-tool-host-context-template.js.map +1 -1
  10. package/dist/services/codex-pre-tool-support-template.d.ts.map +1 -1
  11. package/dist/services/codex-pre-tool-support-template.js +24 -0
  12. package/dist/services/codex-pre-tool-support-template.js.map +1 -1
  13. package/dist/services/codex-windows-hook-command.d.ts.map +1 -1
  14. package/dist/services/codex-windows-hook-command.js +21 -2
  15. package/dist/services/codex-windows-hook-command.js.map +1 -1
  16. package/package.json +1 -1
  17. package/templates/.agents/README-ENG.md +19 -0
  18. package/templates/.agents/README.md +20 -0
  19. package/templates/.agents/config/agents/discovery.json +1 -1
  20. package/templates/.agents/dashboard/.zaip-managed.json +98 -58
  21. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-w6pjt4OM.js → CostCalculationGuidePage-uR-asJv_.js} +1 -1
  22. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-DhlntQcR.js → DashboardHelpDialog-CDUKVlrH.js} +23 -3
  23. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-BHoZT2an.js → PricingSettingsDialog-Czs55K79.js} +1 -1
  24. package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-IcncIZ9Y.js → ProjectSettingsPage-DhpaKwjC.js} +1 -1
  25. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-C6rORjpr.js → TraceabilityWorkspace-DPxfH469.js} +1 -1
  26. package/templates/.agents/dashboard/apps/frontend/dist/assets/{cost-monitor-uPnOBShc.js → cost-monitor-B0Jwz_rk.js} +4 -4
  27. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-DWXjEIgc.js → dashboard-localization-BE_Zqtym.js} +19 -0
  28. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-Hc9fp_gs.js → icons-vendor-CjGGux6h.js} +1 -1
  29. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-D5HmMZ27.js +2 -0
  30. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-C9ta_O10.js → react-vendor-B9jZSAKf.js} +1 -1
  31. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-IcefoTOv.js → traceability-DFpwb0TN.js} +1 -1
  32. package/templates/.agents/dashboard/apps/frontend/dist/index.html +5 -5
  33. package/templates/.agents/dashboard/apps/frontend/package.json +2 -2
  34. package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +3 -0
  35. package/templates/.agents/dashboard/apps/frontend/src/AppOverlays.tsx +16 -7
  36. package/templates/.agents/dashboard/apps/frontend/src/__tests__/app-composition-support.ts +1 -0
  37. package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +1 -1
  38. package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +2 -0
  39. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.navigation.test.tsx +125 -0
  40. package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-documents.ts +67 -9
  41. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +15 -15
  42. package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-locale.ts +18 -0
  43. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  44. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  45. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +4 -39
  46. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.navigation.test.tsx +150 -0
  47. package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewTopPanel.tsx +7 -3
  48. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +4 -7
  49. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageOverview.tsx +3 -0
  50. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-contract.ts +51 -0
  51. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +5 -1
  52. package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +1 -0
  53. package/templates/.agents/dashboard/modules/operations/src/react/use-operations-default-range.ts +16 -0
  54. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  55. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  56. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  57. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  58. package/templates/.agents/dashboard/packages/local-runtime/dashboard-build-fingerprint.mjs +87 -0
  59. package/templates/.agents/dashboard/packages/local-runtime/dashboard-build-fingerprint.test.mjs +48 -0
  60. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +160 -160
  61. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +110 -110
  62. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  63. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-frontend.mjs +29 -0
  64. package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +5 -0
  65. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +163 -163
  66. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-build.mjs +12 -5
  67. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-paths.mjs +8 -0
  68. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +1 -1
  69. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  70. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  71. package/templates/.agents/dashboard/tests/e2e/qualify-top-five-trace.mjs +53 -0
  72. package/templates/.agents/dashboard/tests/e2e/verify-top-five-served.mjs +78 -0
  73. package/templates/.agents/design/.zaip-managed.json +14 -6
  74. package/templates/.agents/design/apps/catalog/dist/assets/index-BGxXxXTo.js +72 -0
  75. package/templates/.agents/design/apps/catalog/dist/index.html +1 -1
  76. package/templates/.agents/design/apps/catalog/package.json +1 -1
  77. package/templates/.agents/design/apps/catalog/src/components/TopEntitiesSpecimen.tsx +45 -0
  78. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +3 -1
  79. package/templates/.agents/design/apps/catalog/src/stories/Components.stories.tsx +2 -0
  80. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  81. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  82. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  83. package/templates/.agents/requirements/comparative-audit.md +1 -1
  84. package/templates/.agents/requirements/context-engine.md +1 -1
  85. package/templates/.agents/requirements/cost-observability.md +1 -1
  86. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  87. package/templates/.agents/requirements/data-export.md +1 -1
  88. package/templates/.agents/requirements/design-system.md +1 -1
  89. package/templates/.agents/requirements/execution-engine.md +1 -1
  90. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  91. package/templates/.agents/requirements/model-orchestration.md +1 -1
  92. package/templates/.agents/requirements/public-distribution.md +1 -1
  93. package/templates/.agents/requirements/software-architecture.md +1 -1
  94. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  95. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  96. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  97. package/templates/.agents/runtime/VERSION +1 -1
  98. package/templates/.agents/runtime/bin/zaip.mjs +118 -56
  99. package/templates/.agents/runtime/checksums.sha256 +6 -6
  100. package/templates/.agents/runtime/manifest.json +1 -1
  101. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
  102. package/templates/.agents/runtime/provenance.json +5 -5
  103. package/templates/.agents/runtime/sbom.cdx.json +1 -1
  104. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract-cli.test.mjs +53 -0
  105. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.test.mjs +1 -32
  106. package/templates/.agents/zaip-aios/VERSION +1 -1
  107. package/templates/.agents/zaip-aios/guides/10-seguranca.md +2 -2
  108. package/templates/template-manifest.json +149 -97
  109. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-BqeOEZW5.js +0 -2
@@ -8,6 +8,22 @@ English | [Português](README.md)
8
8
 
9
9
  ## Quick overview
10
10
 
11
+ The [rework prevention guide](docs/quality/v51-eficiencia-e-publicacao.md)
12
+ documents complete checks before finalization, bounded Run reads, conservative
13
+ test reuse, content-based Dashboard builds and separate npm confirmation.
14
+ Authorized maintenance suspends governance while keeping telemetry active;
15
+ governance is restored and hooks are checked when maintenance ends.
16
+
17
+ The [hook repair guide](docs/quality/hooks-leitura-e-orcamento.md) describes
18
+ permitted Git read sequences, validation time budgets, and retained protections.
19
+ Git read sequences use \`git --no-pager -c core.fsmonitor=false\` and the documented
20
+ safe options; Git mutations still require separate commands.
21
+
22
+ The [v5.2 reliability plan](docs/quality/v52-confiabilidade-e-eficiencia.md)
23
+ records bounded Git discovery in the Windows launcher, observation recovery
24
+ after maintenance, thread-scoped Run queries, and validation cache measurements.
25
+ Evidence distinguishes local tests, independent review, and package publication.
26
+
11
27
  > **Source, candidate, and publication:** this README describes the checkout's
12
28
  > contracts and features. The [evolution matrix](docs/quality/v50-documentacao-editorial.md)
13
29
  > identifies implementation and evidence. Local qualification, consumer hook
@@ -924,4 +940,7 @@ A branch holds a commit history; a worktree is another checkout directory. A sta
924
940
  \`.agents/config/release-cycle.json\` defines the executable release. Future PRDs/SPECs may remain draft; starting requires the current cycle. Publication reconciles active work, freezes and audits the exact candidate, runs local checks, pushes only \`main\`, and waits for successful CI on that SHA before Release. No remote candidate branch is created. Tag, GitHub Release, npm, and any applicable provider deployment have separate evidence.
925
941
 
926
942
  The release coordinator may remain active during publication and cycle advance only through supported modes: an integrated root with explicit frozen IDs and \`release_mode: integrated_task\`, or delegated SPEC coordination with verified ancestry. Other current Tasks must be terminal. The gate verifies candidate records; the coordinator completes Evidence, applicable review, and Gui after publication proof. Simple coordination must finish before audit. See the [release contracts and commands](.agents/zaip-aios/guides/26-qualidade-e-release.md#ciclo-corrente-limpeza-e-ci-da-main-antes-da-release). Do not mark a Task completed before its finalizer just to publish.
943
+ ## Operational note after v5.0 publication
944
+
945
+ Publisher recovery, explicit parental validation timeouts, and recognition of parental Evidence at the final barrier are documented in [v5.0 publisher recovery](docs/quality/v50-publisher-recovery.md). The v5.0 SPEC is delivered with all ten Tasks completed. These are subsequent operational fixes on main; the npm 5.0.0 package and v5.0 tag remain immutable.
927
946
  `:n},...i]}function t(e,t){return e.match(/^#\s+(.+)$/m)?.[1]?.trim()??t.replace(/\.md$/i,``)}var n={"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{n,e as t};
@@ -1 +1 @@
1
- import{h as e}from"./cost-monitor-uPnOBShc.js";var t=e(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),r=e(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),i=e(`CircleGauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),a=e(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),o=e(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),s=e(`FileCheck2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m3 15 2 2 4-4`,key:`1lhrkk`}]]),c=e(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),l=e(`Gavel`,[[`path`,{d:`m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8`,key:`15492f`}],[`path`,{d:`m16 16 6-6`,key:`vzrcl6`}],[`path`,{d:`m8 8 6-6`,key:`18bi4p`}],[`path`,{d:`m9 7 8 8`,key:`5jnvq1`}],[`path`,{d:`m21 11-8-8`,key:`z4y7zo`}]]),u=e(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),d=e(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),f=e(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),p=e(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),m=e(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);export{u as a,s as c,i as d,r as f,d as i,o as l,t as m,p as n,l as o,n as p,f as r,c as s,m as t,a as u};
1
+ import{h as e}from"./cost-monitor-B0Jwz_rk.js";var t=e(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),r=e(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),i=e(`CircleGauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),a=e(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),o=e(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),s=e(`FileCheck2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m3 15 2 2 4-4`,key:`1lhrkk`}]]),c=e(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),l=e(`Gavel`,[[`path`,{d:`m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8`,key:`15492f`}],[`path`,{d:`m16 16 6-6`,key:`vzrcl6`}],[`path`,{d:`m8 8 6-6`,key:`18bi4p`}],[`path`,{d:`m9 7 8 8`,key:`5jnvq1`}],[`path`,{d:`m21 11-8-8`,key:`z4y7zo`}]]),u=e(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),d=e(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),f=e(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),p=e(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),m=e(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]);export{u as a,s as c,i as d,r as f,d as i,o as l,t as m,p as n,l as o,n as p,f as r,c as s,m as t,a as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-CDUKVlrH.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-B0Jwz_rk.js","assets/cost-monitor-C2AFYBu_.css","assets/dashboard-localization-BE_Zqtym.js","assets/DashboardHelpDialog-DRI_XwUf.css","assets/PricingSettingsDialog-Czs55K79.js","assets/ProjectSettingsPage-DhpaKwjC.js","assets/ProjectSettingsPage-CQMhvzvJ.css","assets/CostCalculationGuidePage-uR-asJv_.js","assets/TraceabilityWorkspace-DPxfH469.js","assets/traceability-DFpwb0TN.js","assets/icons-vendor-CjGGux6h.js","assets/traceability-DFY7ZDlu.css","assets/TraceabilityWorkspace-DvvavDLY.css"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,a as n,b as r,g as i,i as a,n as o,o as s,r as c,t as l,w as u}from"./cost-monitor-B0Jwz_rk.js";import{t as d}from"./react-vendor-B9jZSAKf.js";import{n as f,t as p}from"./traceability-DFpwb0TN.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 A(){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 ee({pending:e,children:t}){return(0,g.jsx)(`div`,{"aria-hidden":e||void 0,inert:e,children:t})}var j={"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 te({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=j[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)(A,{}):null,(0,g.jsx)(b,{area:`operations`,locale:r})]}):e}function ne(e){let t=new Set(e.blocked.map(e=>e.id));return{reconciled:e.reconciled_ids.filter(e=>!t.has(e)).length,blocked:e.blocked.length,notReconciled:e.not_reconciled.length}}function M(e){let t=new Set(e.blocked.map(e=>e.id));return e.reconciled_ids.filter(e=>!t.has(e)).map(t=>{let n=e.outcomes?.find(e=>e.id===t);return{id:t,reason:n?.reason??null,status:n?.status??null}})}function re(e,t){return e===null?``:t===`pt-BR`?{completed:`Concluído`,delivered:`Entregue`,failed:`Falha técnica`,blocked:`Bloqueado`,cancelled:`Cancelado`}[e]??e:e}var ie={"Invocation is still running":`A invocação ainda está em execução. Foi preservada intencionalmente; isso não indica falha do comando.`,"Host terminated without delivery evidence":`O host encerrou sem evidências de entrega.`,"Host interrupted":`O host foi interrompido.`,"Child attempt stopped":`A tentativa do subagente foi encerrada.`,"Execution orphaned after the reconciliation grace period":`A execução ficou sem orquestrador ativo após o período de tolerância da reconciliação.`};function N(e,t){if(e===null)return t===`pt-BR`?`Motivo não informado.`:`No reason provided.`;if(t===`en-US`)return e;let n=e.match(/^Explicit orphan reconciliation found no active host invocation or terminal work outcome; repair is required before resuming \(Run (\S+)\)\.$/);if(n)return`A Run ${n[1]} ficou sem invocação ativa do host e sem evidência de um desfecho de entrega. A reconciliação registrou a interrupção; a entrega exige reparo e validação antes de retomar.`;let r=e.match(/^Execution (\S+) has no active orchestrator agent call after the reconciliation grace period\.?$/);return r?`A execução ${r[1]} não tem uma chamada de agente orquestrador ativa após o período de tolerância da reconciliação.`:ie[e.trim().replace(/\.$/,``)]??e}function P({result:e,locale:t,onDismiss:n}){let[r,i]=(0,m.useState)(!1),a=(0,m.useRef)(null),o=t===`pt-BR`,s=ne(e),c=o?`Resultado da reconciliação manual`:`Manual reconciliation result`,l={reconciled:o?`Outros estados registrados`:`Other recorded outcomes`,blocked:o?`Desfechos bloqueados`:`Blocked outcomes`,notReconciled:o?`Não reconciliados`:`Not reconciled`},u=`${l.reconciled}: ${s.reconciled} · ${l.blocked}: ${s.blocked} · ${l.notReconciled}: ${s.notReconciled}`;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`section`,{className:`app-reconciliation-result`,"aria-label":c,children:[(0,g.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,g.jsx)(`strong`,{children:c}),(0,g.jsx)(`p`,{children:u})]}),(0,g.jsxs)(`div`,{className:`app-reconciliation-actions`,children:[(0,g.jsx)(`button`,{ref:a,type:`button`,"aria-haspopup":`dialog`,onClick:()=>i(!0),children:o?`Veja mais`:`View details`}),(0,g.jsx)(`button`,{type:`button`,onClick:n,children:o?`Fechar`:`Dismiss`})]})]}),r?(0,g.jsx)(F,{result:e,locale:t,title:c,summary:u,labels:l,onClose:()=>i(!1),restoreFocus:()=>a.current?.focus({preventScroll:!0})}):null]})}function F({result:e,locale:t,title:n,summary:r,labels:i,onClose:a,restoreFocus:o}){let s=(0,m.useRef)(null),c=(0,m.useRef)(o),l=(0,m.useId)(),u=t===`pt-BR`;(0,m.useEffect)(()=>{let e=s.current;if(!e)return;let t=document.body.style.overflow;return e.showModal(),document.body.style.overflow=`hidden`,()=>{e.close(),document.body.style.overflow=t,c.current()}},[]);let d=[{label:i.reconciled,items:M(e),reasons:!0},{label:i.blocked,items:e.blocked,reasons:!0},{label:i.notReconciled,items:e.not_reconciled,reasons:!0}];return(0,g.jsxs)(`dialog`,{ref:s,className:`app-reconciliation-dialog`,"aria-labelledby":l,"aria-modal":`true`,onCancel:e=>{e.preventDefault(),a()},onKeyDown:e=>{if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not(:disabled), summary, [tabindex="0"]`)).filter(e=>e.getClientRects().length>0),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},children:[(0,g.jsxs)(`header`,{children:[(0,g.jsx)(`h2`,{id:l,children:n}),(0,g.jsx)(`button`,{type:`button`,onClick:a,children:u?`Fechar detalhes`:`Close details`})]}),(0,g.jsxs)(`section`,{className:`app-reconciliation-details`,tabIndex:0,"aria-label":u?`Itens da reconciliação`:`Reconciliation items`,children:[(0,g.jsx)(`p`,{children:r}),(0,g.jsx)(`p`,{children:u?`A reconciliação registra o estado real de cada item. Desfechos bloqueados aparecem somente na categoria de bloqueios; um estado registrado não significa entrega concluída.`:`Reconciliation records each item's actual state. Blocked outcomes appear only in the blocked category; a recorded state does not imply completed delivery.`}),(0,g.jsx)(`p`,{children:u?`Última telemetria indica a coleta de tokens medidos. Registrar estados ou atualizar o snapshot sem novos tokens não altera esse horário.`:`Last telemetry means measured token collection. Recording states or refreshing the snapshot without new tokens does not change that time.`}),e.diagnostics?(0,g.jsxs)(`p`,{children:[u?`Reconciliação executada em`:`Reconciliation executed at`,` `,new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(e.diagnostics.completed_at)),` · Job: `,(0,g.jsx)(`code`,{children:e.diagnostics.job_id}),` · `,`Logs`,`: `,(0,g.jsx)(`code`,{children:e.diagnostics.log_directory})]}):null,(0,g.jsx)(`p`,{children:u?`Invocações ainda em execução são preservadas intencionalmente. Permanecer não reconciliado por esse motivo não indica falha do comando.`:`Invocations that are still running are intentionally preserved. Remaining unreconciled for this reason does not indicate a command failure.`}),d.map(e=>(0,g.jsxs)(`section`,{"aria-label":e.label,children:[(0,g.jsxs)(`h3`,{children:[e.label,` (`,e.items.length,`)`]}),e.items.length===0?(0,g.jsx)(`p`,{children:u?`Nenhum item nesta categoria.`:`No items in this category.`}):(0,g.jsx)(`ul`,{children:ae(e.items).map(({item:n,key:r})=>(0,g.jsxs)(`li`,{children:[(0,g.jsx)(`code`,{children:n.id}),`status`in n&&typeof n.status==`string`?(0,g.jsx)(`p`,{children:re(n.status,t)}):null,e.reasons?(0,g.jsx)(`p`,{children:N(n.reason,t)}):null,e.reasons&&n.reason!==null&&N(n.reason,t)!==n.reason?(0,g.jsxs)(`details`,{children:[(0,g.jsx)(`summary`,{children:u?`Motivo original`:`Original reason`}),(0,g.jsx)(`p`,{children:n.reason})]}):null]},r))})]},e.label))]})]})}function ae(e){let t=new Map;return e.map(e=>{let n=JSON.stringify([e.id,e.reason]),r=(t.get(n)??0)+1;return t.set(n,r),{item:e,key:`${n}:${r}`}})}var oe=`modulepreload`,se=function(e){return`/`+e},I={},L=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=se(t,n),t=s(t),t in I)return;I[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`:oe,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)})},ce=(0,m.lazy)(async()=>({default:(await L(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-CDUKVlrH.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function le({costLocale:e,documentDetail:t,helpOpen:n,loadingArea:i,reconciliationResult:a,refreshDialog:c,showTrace:l,trace:u,traceLink:d,traceMacroLoading: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:[l?null:_?(0,g.jsx)(p,{locale:e,taskId:_}):u?(0,g.jsx)(f,{locale:e,onClose:x,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),trace:u}):null,d?.kind===`change`?(0,g.jsx)(r,{details:{kind:`change`,row:d.row},locale:e,onClose:()=>k(null)}):null,d?.kind===`macro`?(0,g.jsx)(s,{label:d.label,locale:e,onClose:()=>k(null),onOpenDocument:C,onOpenTrace:e=>{k(null),w(e)},row:d.row,runs:d.projection.runs,specs:d.projection.specs,tasks:d.projection.tasks}):null,t?(0,g.jsx)(o,{detail:t.detail,error:t.error,label:t.label,locale:e,loading:!t.detail&&!t.error,onClose:v,onRetry:()=>C(t.kind,t.preview.id),preview:t.preview}):null,n?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(ce,{locale:e,onClose:y})}):null,c===`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,c===`refreshing`||c===`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:c===`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,a!==null&&c===null?(0,g.jsx)(P,{result:a,locale:e,onDismiss:S}):null,(i!==null||h!==null)&&c===null?(0,g.jsx)(b,{area:h===null?i??`operations`:`operations`,locale:e}):null]})}var ue=(0,m.lazy)(async()=>({default:(await L(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-Czs55K79.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),R=(0,m.lazy)(async()=>({default:(await L(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-DhpaKwjC.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),de=(0,m.lazy)(async()=>({default:(await L(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-uR-asJv_.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),fe=`/setup-pricing`,pe=`/setup-project`,me=`/cost-calculation-guide`;function he(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)(ue,{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)(de,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(R,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var ge=(0,m.lazy)(async()=>({default:(await L(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-DPxfH469.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function _e({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:A,traceTasksHasMore:ee,traceTasksLoading:j,traceTasks:te}){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)(ge,{loadingTaskId:A,locale:t,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),onLoadMoreTasks:b,onSelectTask:w,selectedTaskId:O,tasks:te.length>0?te:D.tasks,hasMoreTasks:ee,isLoadingTasks:j,trace:k})}):r===null?(0,g.jsx)(`span`,{"aria-hidden":`true`,hidden:!0}):void 0}function ve({currency:e,locale:t,onCurrencyChange:n,onHelpOpen:r,onNavigate:i,pricingSetupPath:a,projectSetupPath:o,costCalculationGuidePath:s}){return(0,g.jsxs)(`div`,{className:`dashboard-global-settings`,children:[(0,g.jsxs)(`label`,{children:[(0,g.jsx)(`span`,{children:t===`pt-BR`?`Moeda`:`Currency`}),(0,g.jsxs)(`select`,{"aria-label":t===`pt-BR`?`Moeda`:`Currency`,onChange:e=>n(e.target.value),value:e,children:[(0,g.jsx)(`option`,{value:`BRL`,children:`BRL · Real brasileiro`}),(0,g.jsx)(`option`,{value:`USD`,children:`USD · US Dollar`})]})]}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:r,type:`button`,children:t===`pt-BR`?`Central de Ajuda`:`Open help and guides`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(a),type:`button`,children:t===`pt-BR`?`Configurar preços e câmbio`:`Configure pricing and FX`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(o),type:`button`,children:t===`pt-BR`?`Configurar projeto`:`Configure project`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(s),type:`button`,children:t===`pt-BR`?`Guia de cálculo de custos`:`Cost calculation guide`})]})}var ye={preset:`all`,range:a(`this-month`)};function z(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function be(e,t){let n=z(e),r=z(t);return n.from===r.from&&n.to===r.to}function xe({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:j,renderedOperations:ne,selectedTraceTaskId:M,trace:re,traceLoadingTaskId:ie,traceMacroLoading:N,traceTasksHasMore:P,traceTasksLoading:F,traceTasks:ae,capabilityNavigation:oe,boardTotals:se,boardKindTotals:I,boardExportSource:L,detailExportSource:ce,boardStates:ue,operationsPeriod:R,entityPage:de,dashboardIdentity:he,operationsLoading:ge,factualCostFact:ye,factualCostPeriods:z,setOperationsSurfaceLoading:xe,operationsSurfaceLoading:Se,currentCostByRun:Ce,loadOperationsEntityPage:B,loadOperationsLifecyclePage:we,loadOperationsDetails:Te,entityPageKind:Ee,loadFilteredOperationsPage:De,loadFilteredBoard:Oe,loadWorkListFilters:ke,loadWorkListPage:Ae,workListFiltersRef:je,boardFiltersRef:V,workListPage:H,overviewStatusPages:U,loadOverviewStatusPage:Me,overviewClassificationPages:W,loadOverviewClassificationPage:Ne,openDocument:Pe,api:G,setError:Fe,operationsPeriodRef:Ie,setOperationsPeriod:Le,operationsDetailLoadedRef:Re,operationsDetailCancelRef:ze,operationsDetailAbortRef:Be,operationsPageAbortRef:Ve,resetWorkListPage:He,operationsPageRequestVersionRef:Ue,refreshVersion:We,costSummaryAbortRef:Ge,costSummaryRequestVersion:Ke,setEntityPage:qe,costsLoadedRef:Je,setCosts:Ye,setPeriodTransitionPending:Xe,periodTransitionVersionRef:K,setLoadingArea:Ze,navigate:Qe,setHelpOpen:q,closeDocument:$e,documentDetail:et,helpOpen:tt,reconciliationResult:nt,setReconciliationResult:rt,refreshDialog:it,setTrace:at,traceLink:ot,setTraceLink:st,refreshFromDialog:ct}=e,{loadMoreBoard:lt,overviewStatusPageKey:ut,overviewClassificationPageKey:dt,boardRequestVersionRef:ft,boardAbortControllersRef:pt,boardInFlightRef:mt,boardInitialPageRef:ht,boardLoadedRef:gt,setBoardTotals:_t,setBoardKindTotals:vt,setBoardStates:J,setOverviewStatusPages:yt,setOverviewClassificationPages:Y,setOperationsLoading:bt}=e;return(0,g.jsxs)(te,{error:n,globalLoadingPending:r,locale:i,onRefresh:()=>void a(),operations:t,snapshotNotice:o,setupRoute:s,children:[(0,g.jsxs)(ee,{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:()=>Fe(null),type:`button`,children:`×`})]}):null,(0,g.jsx)(c,{alternateContent:_e({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:j,operations:ne,selectedTraceTaskId:M,trace:re,traceLoadingTaskId:ie,traceTasksHasMore:P,traceTasksLoading:F,traceTasks:ae}),capabilityNavigation:oe,boardTotals:se,boardKindTotals:I,boardExportSource:L,detailExportSource:ce,boardStates:ue,data:ne,lastUpdatedAt:m,datePreset:R.preset,dateRange:R.range,entityPage:de,dashboardTitle:he.title,repositoryName:he.repositoryName,loading:ge,locale:i,currency:f,factualCostFact:ye,costLoading:d===null&&l!==`costs`,factualCostPeriods:z,onLoadingChange:xe,resolveRunCost:d===null?void 0:e=>Ce.get(e)??null,onLocaleChange:w,onDetailDataRequest:e=>{let t=e===`conversations`?`conversations`:e===`executions`?`executions`:e===`runs`?`runs`:null;t===null?e===`changes`||e===`decisions`?we(e):Te():B(t)},onLoadMacroMetrics:()=>{t?.summary.overview_metrics?.macro_metrics===void 0&&Te()},onEntityPageChange:e=>{Ee===`changes`||Ee===`decisions`?we(Ee,e):B(Ee,e)},onEntityFiltersChange:De,onBoardFiltersChange:Oe,onWorkListFiltersChange:ke,onWorkListPageChange:e=>void Ae(je.current,e),onBoardTypeChange:e=>Oe({...V.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void Ae({...je.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void lt(e),workListPage:H,statusPage:(e,t)=>U[ut(e,t)],onLoadStatusPage:(e,t,n)=>void Me(e,t,n),classificationPage:(e,t)=>W[dt(e,t)],onLoadClassificationPage:(e,t,n)=>void Ne(e,t,n),onOpenDocument:(e,t)=>void Pe(e,t),onOpenMacro:(e,t)=>void j(e===`prd`?`PRD`:`SPEC`,t),onOpenTask:E,onPriorityChange:async e=>{try{await G.saveWorkPriority(e)}catch(e){throw Fe(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(be(Ie.current,n)){Le(n);return}Re.current=!1,ze.current?.(),ze.current=null,Be.current?.abort(),Be.current=null,Ve.current?.abort(),Ve.current=null,He(),++Ue.current,ft.current+=1;for(let e of pt.current.values())e.abort();pt.current.clear(),mt.current.clear(),ht.current.clear(),gt.current={},_t({}),vt({}),J({}),yt({}),Y({}),++We.current,Ge.current?.abort(),Ge.current=null,++Ke.current,qe({offset:0,total:null,loading:!1,error:null}),Je.current=!1,Ye(null),x(null),bt(!0),K.current+=1,Xe(!0),Ze(`operations`),Le(n)},onRefresh:()=>D(`choose`),settings:(0,g.jsx)(ve,{costCalculationGuidePath:me,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>q(!0),onNavigate:Qe,pricingSetupPath:fe,projectSetupPath:pe})}),(0,g.jsx)(le,{closeDocument:$e,costLocale:i,documentDetail:et,helpOpen:tt,loadingArea:b??(d===null&&l!==`costs`?`costs`:Se||Object.values(ue).some(e=>e.loading)?`operations`:null),operations:ne,reconciliationResult:nt,refreshDialog:it,showTrace:p===`traceability`,trace:re,traceLink:ot,traceMacroLoading:N,traceLoadingTaskId:ie,onCloseHelp:()=>q(!1),onCloseTrace:()=>at(null),onDismissReconciliation:()=>rt(null),onOpenDocument:(e,t)=>void Pe(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:j,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void ct(e),setTraceLink:e=>st(e)})]}),r?(0,g.jsx)(A,{}):null]})}var Se=(e,t)=>`${e}:${t}`,Ce=(e,t)=>`${e}:${t}`,B=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],we=`/zaip-cost-monitor`,Te=`zaip-dashboard-session-token`,Ee=`zaip-dashboard-locale`,De=`zaip-dashboard-currency`;function Oe(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function ke(e){return e.replace(/\/+$/,``)===we?`cost-monitor`:null}function Ae(){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(Te,t),window.sessionStorage.setItem(Te,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var je=class{token;constructor(e){this.token=e}ready(){return this.get(`/api/v2/ready`)}captureTelemetry(){return this.post(`/api/v2/capture-telemetry`)}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(W(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(W(`/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(W(`${i.operations}?${s.toString()}`,e),a)}traceabilityTasks(e=0,t=10){let n=new URLSearchParams({scope:`traceability`,offset:String(e),limit:String(t)});return this.get(`${i.operations}?${n}`)}operationsClassification(e,t,n,r=0,a,o=50){let s=new URLSearchParams({scope:`classification`,kind:t,classification:n,offset:String(r),limit:String(o)});return this.get(W(`${i.operations}?${s.toString()}`,e),a)}operationsEntityPage(e,t,n=0,r,a){let o=V(t,n,r);return this.get(W(`${i.operations}/runs?${o}`,e),a)}operationsLifecyclePage(e,t,n=0,r,a){let o=V(t,n,r);return this.get(W(`${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(W(`${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(W(`${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(W(`${i.costMonitor}?${s.toString()}`,t),a)}snapshot(e=`BRL`,t){return this.get(W(`${i.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(W(`${i.reconcileOpenWork}?currency=${e}`,t),U)}refreshProjection(e=`BRL`,t){return this.post(W(`${i.refreshProjection}?currency=${e}`,t),U)}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 Me(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},H,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=H){let n=await Me(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 V(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 H=6e4,U=18e4;async function Me(e,t,n=H,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 W(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 Ne(e){return e.projection_refresh_completed}function Pe(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&Ne(e)}}var G={"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 Fe({activeView:e,locale:t,onChange:n}){let r=G[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)(Le,{}),(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)(Ie,{}),(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)(Re,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.traceability}),(0,g.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function Ie(){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 Le(){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 Re(){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 ze(e){m.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Be(e,t,n){return(0,g.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,g.jsx)(Fe,{activeView:e,locale:t,onChange:n})})}function Ve(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function He(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function Ue(e,t,n){let r=t??e;if(r?.currency!==n)return{fact:{state:`unavailable`,knownSum:null,coverage:null},periods:void 0};let i=r.overview.coverage[n===`USD`?`usd`:`brl`],a=n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,o={known:i,total:r.overview.run_count};return{fact:a===null?{state:`unavailable`,knownSum:null,coverage:o}:i<r.overview.run_count?{state:`partial`,knownSum:a,coverage:o}:{state:`complete`,knownSum:a,coverage:o},periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}}var We={title:`Dashboard ZAIP AIOS`,repositoryName:``};function Ge(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 Ke(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 qe(e,t,n,r,i,a,o,s,c){return he({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function Je(e){return async t=>{if(e.setDashboardView(t),window.scrollTo({left:0,top:0}),t===`cost-monitor`?S({costsLoaded:e.costsLoadedRef.current,currency:e.currency,snapshotCurrency:e.costs?.currency})&&(e.costSummaryAbortRef.current===null||e.costSummaryAbortRef.current.signal.aborted)&&e.loadCostSummary():e.costSummaryAbortRef.current?.abort(),t===`traceability`){let t=e.traceTasks;if(t.length===0){let n=e.boardRequestVersionRef.current;if(t=await e.loadMoreTraceTasks(!1,!0),n!==e.boardRequestVersionRef.current)return;e.setTraceTasks(t)}let n=t.toSorted((e,t)=>Date.parse(t.finished_at??t.updated_at)-Date.parse(e.finished_at??e.updated_at)),r=n.find(e=>e.status===`completed`)??n[0];r&&(e.setSelectedTraceTaskId(r.id),e.openTrace(r.id));return}e.setTrace(null),e.setTraceLoadingTaskId(null)}}function Ye(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 Xe(e=new Date){let t=n(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let r=e.getTime(),i=r+1800*60*1e3;for(;n(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-r>1;){let e=Math.floor((r+i)/2);n(new Date(e).toISOString(),`day`)===t?r=e:i=e}return Math.max(1,i-e.getTime()+25)}function K(e){return typeof e==`number`?e:null}function Ze(e){return typeof e==`number`?{known_sum:e,unknown:0,complete:!0,coverage_ratio:1}:{known_sum:0,unknown:1,complete:!1,coverage_ratio:0}}function Qe(e){return Object.hasOwn(e,`total_duration`)?K(e.total_duration):K(e.cost_monitor_total_duration)}function q(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 $e(e){let t=Qe(e),n=Number(e.duration_unknown??+(t===null)),r=t??K(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:K(e.task_count),conversation_count:Number(e.conversation_count??0),prd_count:K(e.prd_count),spec_count:K(e.spec_count),evidence_count:K(e.evidence_count),test_count:K(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:K(e.total_tokens),estimated_usd:K(e.total_cost_usd),estimated_brl:K(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 et(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,q(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($e),...n.period_averages===void 0?{}:{period_averages:n.period_averages},...n.totals===void 0?{}:{totals:$e(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,q(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($e),...u.period_averages===void 0?{}:{period_averages:u.period_averages},...u.totals===void 0?{}:{totals:$e(u.totals)}}}async function tt(e,t){let{filters:n,from:r,limit:i=10,offset:a,signal:o,to:s}=t,c=await e.sqliteViewPage(`cost_monitor_agent_invocations`,r===void 0||s===void 0?void 0:{from:r,to:s},{offset:a,limit:i,...n?.query?{query:n.query}:{},...n?.provider?{provider:n.provider}:{},...n?.model?{model:n.model}:{},...n?.agent?{agent:n.agent}:{},...n?.phase?{phase:n.phase}:{},...n?.status?{status:n.status}:{},...n?.priority?{priority:n.priority}:{},...n?.risk?{risk:n.risk}:{},...n?.origin?{origin:n.origin}:{},...n?.workType?{workType:n.workType}:{}},o);return{page_only:!0,runs:c.rows.map(nt),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function nt(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 rt(e,t){let n=t.totals,r=e=>Ze(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:Ze(t.total_duration),total_tokens:Ze(t.total_tokens),cost:Ze(t.total_cost_brl)}}))}}function it(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 rt(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...t.query||o?{query:t.query||o}:{},...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.agent?{agent:t.agent}:{},...t.phase?{phase:t.phase}:{},...t.status?{status:t.status}:{},...t.origin?{origin:t.origin}:{},...t.workType?{workType:t.workType}:{},...t.priority?{priority:t.priority}:{},...t.risk?{risk:t.risk}:{}},s))},[e]),loadCostRunPage:(0,m.useCallback)(t=>tt(e,t),[e]),loadCostGroupPage:(0,m.useCallback)(t=>et(e,t),[e])}}function at(e,t){return!1}function ot(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 st=2e3,ct=5e3,lt=1e4,ut=3e4,dt=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function ft(e,t){return e&&t<90}function pt(e,t){return e===`visible`?ct:t>0?ut:lt}function mt(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function ht(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function gt({observedRevision:e,pendingRevision:t,requestedRevision:n,succeeded:r}){return r?{observedRevision:n,pendingRevision:t===n?null:t}:{observedRevision:e,pendingRevision:t}}function _t({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function vt({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();_t({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||!ft(!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(ft(!0,n)){r=window.setTimeout(()=>void i(),st);return}h(!1),g(dt)}}};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=gt({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;ht(r.snapshot_state,r.snapshot_revision)&&(a===null&&(S.current=r.snapshot_revision),mt(a,r.snapshot_revision)&&(w.current=r.snapshot_revision,i()))}catch{n+=1}t||(r=window.setTimeout(()=>void a(),pt(document.visibilityState,n)))};return a(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,h]),(0,m.useEffect)(()=>{if(!at(r,a?.summary.overview_metrics?.partial===!0))return;let e=ot(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(Ee,t),[t]),(0,m.useEffect)(()=>window.localStorage.setItem(De,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 yt(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];if(r===void 0)throw Error(`Operations entity page must have a projected run for every row.`);let a=r.execution_id??r.conversation_id,o=e.status??`unavailable`;return{id:a,kind:t===`conversations`?`interaction`:`delivery`,created_at:r.started_at,status:o,work_status:o,origin:t===`conversations`?{type:`interaction`,conversation_id:r.conversation_id}:{type:`task`,task_id:r.task_id??`unavailable`},dag:{nodes:[],topological_order:[]},result:null,artifact_path:`.agents/records/executions/${a}`,agent_call_count:0,orchestrator_run_count:0,subagent_run_count:0,finalizer_run_count:0,finalized_task_count:0,llm_call_count:0,llm_call_count_complete:!1,task_count:0,spec_count:0,prd_count:0,duration_ms:r.source_duration_ms??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},total_tokens:r.usage.total.tokens.total,cost_brl:r.usage.total.cost.brl}}):e.executions}}function Y(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 bt({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=z(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,z(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:yt(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=z(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,z(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:Y(e.requirement_ids_json),acceptance_ids:Y(e.acceptance_ids_json),task_ids:Y(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 xt({api:e,operations:t,isOperationsDetailLoaded:n,setError:r,setFailedArea:i,setLoadingArea:a}){let[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)([]),[u,d]=(0,m.useState)(null),[f,p]=(0,m.useState)(null),h=(0,m.useRef)(0),g=(0,m.useRef)(0),_=(0,m.useRef)(0),v=(0,m.useRef)(null),[y,b]=(0,m.useState)(null),x=(0,m.useRef)(null),[S,C]=(0,m.useState)(null),[w,T]=(0,m.useState)(``);async function E(n){_.current+=1,v.current?.abort(),b(null),p(null);let o=++g.current;x.current?.abort();let l=new AbortController;x.current=l,r(null),i(null),s(null),C(n),a(`traceability`),await new Promise(e=>window.requestAnimationFrame(()=>e()));try{let r=await e.taskTrace(n,l.signal);if(g.current!==o)return!1;let i=c.find(e=>e.id===n)??t?.tasks.find(e=>e.id===n);return s({...r,task_title:i?.title||r.task_title||n,task_risk:i?.risk||r.task_risk||null,task_created_at:i?.created_at||r.task_created_at||null,task_progress:r.task_progress??i?.progress??0}),!0}catch(e){return l.signal.aborted||g.current!==o?!1:(r(e instanceof Error?e.message:String(e)),i(`traceability`),!1)}finally{g.current===o&&(x.current===l&&(x.current=null),C(null),a(e=>e===`traceability`?null:e))}}function D(e){let n=t?.changes.find(t=>t.id===e);n!==void 0&&(s(null),p({kind:`change`,row:n}))}async function O(o,c){let l=++_.current;v.current?.abort(),v.current=null,g.current+=1,x.current?.abort(),x.current=null,C(null),a(e=>e===`traceability`?null:e),r(null),i(null),s(null),p(null);let u=(o===`PRD`?t?.prds:t?.specs)?.find(e=>e.id===c&&e.kind===o.toLowerCase());if(u&&t&&n()){b(null),p({kind:`macro`,label:o,row:u,projection:t});return}let d=new AbortController;v.current=d,b({label:o,id:c});try{let t=await e.operations(void 0,`detail`,d.signal);if(l!==_.current||d.signal.aborted)return;let n=(o===`PRD`?t.prds:t.specs).find(e=>e.id===c&&e.kind===o.toLowerCase());if(!n)throw Error(`${o} ${c} not found`);p({kind:`macro`,label:o,row:n,projection:t})}catch(e){if(l!==_.current||d.signal.aborted)return;r(e instanceof Error?e.message:String(e))}finally{l===_.current&&(v.current===d&&(v.current=null),b(null))}}async function k(n,r){let i=(n===`prd`?t?.prds:t?.specs)?.find(e=>e.id===r)??(f?.kind===`macro`?(n===`prd`?f.projection.prds:f.projection.specs).find(e=>e.id===r):void 0);if(!i)return;let a=++h.current,o=n===`prd`?`PRD`:`SPEC`;d({kind:n,label:o,preview:i});try{let t=n===`prd`?await e.prd(r):await e.spec(r);if(h.current!==a)return;d({kind:n,label:o,preview:i,detail:t})}catch(e){if(h.current!==a)return;d({kind:n,label:o,preview:i,error:e instanceof Error?e.message:String(e)})}}function A(){h.current+=1,d(null)}return{closeDocument:A,documentDetail:u,openDocument:k,openTrace:E,openTraceChange:D,openTraceMacro:O,selectedTraceTaskId:w,setSelectedTraceTaskId:T,setTrace:s,setTraceLink:p,setTraceLoadingTaskId:C,setTraceTasks:l,trace:o,traceLink:f,traceMacroLoading:y,traceLoadingTaskId:S,traceTasks:c}}function St({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 Ct(e,t,n){return Math.min(t,e+n)}function wt(e,t,n){let r=(0,m.useRef)(t),i=(0,m.useRef)({offset:0,stageIndex:0}),a=(0,m.useRef)(!1),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{r.current=t},[t]),{loadMoreTraceTasks:(0,m.useCallback)(async(t=!1,o=!1)=>{if(a.current||(o&&(i.current={offset:0,stageIndex:0},r.current=[],n([]),s(!0)),i.current.stageIndex>=1))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=await e.traceabilityTasks(a.offset,10),s=St({cursor:a,page:o,tasks:r.current});if(r.current=s.tasks,n(r.current),i.current=s.cursor,o.tasks.length>0&&!t)break}while(i.current.stageIndex<1);return s(i.current.stageIndex<1),r.current}finally{a.current=!1,l(!1)}},[e,n]),traceTasksHasMore:o,traceTasksLoading:c}}function Tt({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=z(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!==z(d.current).from||f.to!==z(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=Se(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=z(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!==z(d.current).from||c.to!==z(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=Ce(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=z(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!==z(d.current).from||c.to!==z(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=z(u);return{prepare:async()=>{let t=await Promise.all(B.map(t=>e.operationsBoard(i,t,0,n))),r=e=>[...e.prds.map(({kind:e,...t})=>({kind:`prd`,...t})),...e.specs.map(({kind:e,...t})=>({kind:`spec`,...t})),...e.tasks.map(e=>({kind:`task`,...e}))];return{totalRows:t.reduce((e,t)=>e+t.total,0),pages:async function*(){for(let a of t){let t=a,o=0;for(;;){let a=r(t);if(a.length===0||(o+=a.length,yield a,o>=t.total))break;t=await e.operationsBoard(i,t.stage,o,n)}}}}}}},[e,r,u]);return(0,m.useEffect)(()=>{if(c!==`operations`||l===null)return;let e=!1,t=s.current,n=()=>!e&&t===s.current,r=async()=>{if(!n())return;let e=B.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let t=0;t<e.length&&n();t+=3){let r=e.slice(t,t+3);if(!n())return;for(let e of r)a.current.add(e);await Promise.all(r.map(e=>S(e)))}},o=window.setTimeout(()=>void r(),0);return()=>{e=!0,window.clearTimeout(o)}},[i,a,s,c,S,l]),{boardExportSource:D,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function X(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function Et(e,t,n){return e===`explicit`||t!==n}function Z(e,t){return{...e,kind:e.kind??t.kind??``}}var Q={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function Dt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,m.useState)(Q),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=z(t),f=Z(r,a.current),p=X(f,d);if(!Et(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!==z(n.current).from||d.to!==z(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(Q)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,m.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}function Ot(){let[e,t]=(0,m.useState)(Oe),[n,r]=(0,m.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),i=(0,m.useRef)(n);return i.current=n,{costLocale:e,currency:n,setCurrency:r,currencyRef:i,changeDashboardLocale:(0,m.useCallback)(e=>{t(e),r(e===`en-US`?`USD`:`BRL`)},[])}}async function*kt(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 At({api:e,operationsPeriod:t}){return(0,m.useCallback)((n,r)=>{let i=z(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:()=>kt(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var $=1500;function jt({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function Mt(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),$);return()=>window.clearTimeout(n)},[t,r,e]),jt({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 Nt(){ze(Ae());let[e,t]=(0,m.useState)(!1),n=(0,m.useMemo)(Ae,[]),r=(0,m.useMemo)(()=>new je(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=it(r),[c,l]=(0,m.useState)(()=>ke(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,A]=(0,m.useState)({}),[ee,j]=(0,m.useState)({}),[te,ne]=(0,m.useState)({}),[M,re]=(0,m.useState)(null),[ie,N]=(0,m.useState)(null),{costLocale:P,currency:F,setCurrency:ae,currencyRef:oe,changeDashboardLocale:se}=Ot(),[I,L]=(0,m.useState)(()=>ye),ce=I.preset===`all`?null:I.range.start,le=I.preset===`all`?null:I.range.end,ue=(0,m.useMemo)(()=>({from:ce,to:le}),[ce,le]),R=(0,m.useRef)(I);R.current=I;let de=(0,m.useRef)(null),[fe,pe]=(0,m.useState)(!1),[me,he]=(0,m.useState)(null),[ge,_e]=(0,m.useState)(null),[ve,be]=(0,m.useState)(window.location.pathname),[xe,B]=(0,m.useState)(!0),[we,Te]=(0,m.useState)(!1),[,Ee]=(0,m.useState)(!1),[,De]=(0,m.useState)(!1),[Oe,V]=(0,m.useState)(`operations`),[H,U]=(0,m.useState)(null),[Me,W]=(0,m.useState)(null);(0,m.useEffect)(()=>{r.captureTelemetry().then(()=>r.ready()).then(e=>t(e.snapshot_state===`updating`)).catch(()=>{})},[r]);let[Ne,G]=(0,m.useState)(null),[Fe,Ie]=(0,m.useState)(null),[Le,Re]=(0,m.useState)(null),[K,Ze]=(0,m.useState)(We),Qe=(0,m.useCallback)(e=>{Ze(t=>Ge(t,e))},[]);(0,m.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||Qe(t)}).catch(()=>{}),()=>{e=!0}},[r,Qe]);let q=(0,m.useRef)(!1),{closeDocument:$e,documentDetail:et,openDocument:tt,openTrace:nt,openTraceChange:rt,openTraceMacro:at,traceMacroLoading:ot,selectedTraceTaskId:st,setSelectedTraceTaskId:ct,setTrace:lt,setTraceLink:ut,setTraceLoadingTaskId:dt,setTraceTasks:ft,trace:pt,traceLink:mt,traceLoadingTaskId:ht,traceTasks:gt}=xt({api:r,operations:d,isOperationsDetailLoaded:()=>q.current,setError:G,setFailedArea:U,setLoadingArea:V}),{loadMoreTraceTasks:_t,traceTasksHasMore:J,traceTasksLoading:yt}=wt(r,gt,ft),Y=(0,m.useRef)(0),St=(0,m.useRef)(0),Ct=(0,m.useRef)(!1),X=(0,m.useRef)(0),Et=(0,m.useRef)(0),Z=(0,m.useRef)(null),Q=(0,m.useRef)(!1),kt=(0,m.useRef)(null),$=(0,m.useRef)(null),jt=(0,m.useRef)(null),Nt=(0,m.useRef)(0),Pt=(0,m.useRef)({}),Ft=(0,m.useRef)(new Set),It=(0,m.useRef)(new Map),Lt=(0,m.useRef)(new Set),Rt=(0,m.useRef)(new Set),zt=(0,m.useRef)({query:``,status:``,risk:``,origin:``,kind:``}),Bt=(0,m.useRef)(`||||`),Vt=(0,m.useRef)(0),Ht=(0,m.useRef)(void 0),{workListPage:Ut,workListFiltersRef:Wt,loadWorkListFilters:Gt,loadWorkListPage:Kt,resetWorkListPage:qt}=Dt({api:r,operationsPeriod:I,operationsPeriodRef:R}),Jt=(0,m.useRef)(!1),Yt=(0,m.useCallback)(async(e=!0,n=!1,i=!1,a=!1)=>{kt.current?.(),kt.current=null,$.current?.abort(),$.current=null,Vt.current+=1;for(let e of It.current.values())e.abort();It.current.clear(),Ft.current.clear(),Rt.current.clear(),Pt.current={},b({}),O({}),A({}),j({}),ne({});let o=++Y.current,s=St.current,c=u.current,l=ue,d=()=>w(o,Y.current)&&T(o,Y.current,l,z(R.current));e&&(B(!0),V(`operations`)),G(null),U(null);try{if(n){let e=await r.reconcileOpenWork(F,l),n=Pe(e,d());if(Ie(n.reconciliation),n.dismissProgressDialog&&W(null),!n.applySnapshotState)return!1;if(t(e.snapshot_state===`updating`),n.reloadQuickProjection){let e=await r.operations(l,`quick`,void 0,!0);if(!d())return!1;Jt.current=!1,f(e),Ht.current=e.summary.overview_metrics,q.current=!1,Re(e.summary.latest_token_collected_at??null)}}else if(i){let e=await r.refreshProjection(F,l);if(!d())return!1;f(e.operations),Ht.current=e.operations.summary.overview_metrics,q.current=!0,re(e.costs),Q.current=!0,N(null);let t=e.dashboard;t&&Ze(e=>Ge(e,t)),Re(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,Jt.current),F===`USD`||a?r.costMonitor(F,l,`summary`):Promise.resolve(null)]);if(!d())return!1;Jt.current=!1,f(e),Ht.current=e.summary.overview_metrics,q.current=!1,t!==null&&(re(t),Q.current=!1,N(null)),Re(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(G(e instanceof Error?e.message:String(e)),U(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&D(s,St.current)&&De(!1),e&&d()&&(B(!1),V(e=>e===`operations`?null:e))}},[r,F,ue]),Xt=(0,m.useCallback)(async e=>{if(q.current||Ct.current||e?.aborted)return null;$.current?.abort();let t=e===void 0?new AbortController:null,n=e??t?.signal;if(n===void 0)return null;t!==null&&($.current=t),Ct.current=!0,X.current+=1,V(`costs`),U(null);try{let e=++Y.current,t=z(I),i=()=>w(e,Y.current)&&T(e,Y.current,t,z(R.current)),a=await r.operations(t,`detail`,n);return i()?(f(a),q.current=!0,a):null}catch(e){return n.aborted||E(e)?null:(G(e instanceof Error?e.message:String(e)),U(`operations`),null)}finally{t!==null&&$.current===t&&($.current=null),Ct.current=!1,X.current=Math.max(0,X.current-1),X.current===0&&V(e=>e===`costs`?null:e)}},[r,I]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=bt({api:r,entityFiltersRef:v,operationsPageAbortRef:jt,operationsPageRequestVersionRef:Nt,operationsPeriod:I,operationsPeriodRef:R,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}=Tt({api:r,boardAbortControllersRef:It,boardFilterKeyRef:Bt,boardFiltersRef:zt,boardInFlightRef:Ft,boardInitialPageRef:Rt,boardLoadedRef:Pt,boardRequestVersionRef:Vt,dashboardView:c,operations:d,operationsPeriod:I,operationsPeriodRef:R,overviewStatusInFlightRef:Lt,quickOverviewMetricsRef:Ht,setBoardKindTotals:O,setBoardStates:A,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:ne,setOverviewStatusPages:j}),sn=At({api:r,operationsPeriod:I}),cn=async e=>{e&&Ie(null),W(e?`reconciling`:`refreshing`);try{await Yt(!1,e,!e)}finally{W(null)}};(0,m.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{L(e=>{let t=Ye(e);return t!==e&&(de.current=t),t}),t()},Xe())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,m.useEffect)(()=>{de.current===I&&(de.current=null,Yt(!1,!1,!0,!0))},[I,Yt]),vt({api:r,costLocale:P,currency:F,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:$,operationsDetailCancelRef:kt,operationsPageAbortRef:jt,pathname:ve,pricing:me,refresh:Yt,refreshVersion:Y,setSnapshotUpdating:t,setError:G,setFxRate:_e,setPathname:be,setPricing:he,snapshotUpdating:e});let ln=Ve(be),un=(0,m.useCallback)(async()=>{Z.current?.abort();let e=new AbortController;Z.current=e;let t=++Et.current,n=z(I);X.current+=1,V(`costs`),G(null),U(null);try{let i=await r.costMonitor(F,n,`summary`,e.signal),a=z(R.current);if(!C({aborted:e.signal.aborted,currentCurrency:oe.current,currentPeriod:a,currentRequestVersion:Et.current,requestVersion:t,requestedCurrency:F,requestedPeriod:n}))return;re(i),Q.current=!0,N(null)}catch(n){if(e.signal.aborted||t!==Et.current)return;G(n instanceof Error?n.message:String(n)),U(`costs`)}finally{X.current=Math.max(0,X.current-1),X.current===0&&V(e=>e===`costs`?null:e),Z.current===e&&(Z.current=null)}},[r,F,I,oe]);(0,m.useEffect)(()=>{F!==`USD`||M?.currency===F||un()},[M?.currency,F,un]),(0,m.useEffect)(()=>{d===null||H===`costs`||Z.current!==null||S({costsLoaded:Q.current,currency:F,snapshotCurrency:M?.currency})&&un()},[M?.currency,F,H,un,d]);let dn=Je({setDashboardView:l,costsLoadedRef:Q,currency:F,costs:M,loadCostSummary:un,costSummaryAbortRef:Z,traceTasks:gt,boardRequestVersionRef:Vt,loadMoreTraceTasks:_t,setTraceTasks:ft,setSelectedTraceTaskId:ct,openTrace:nt,setTrace:lt,setTraceLoadingTaskId:dt}),fn=He(M,ie,F),{fact:pn,periods:mn}=Ue(M,ie,F),hn=()=>Ke(H,st,d,un,nt,Xt,Yt,G),gn=qe(r,P,ge,ln,ve,me,Yt,_e,he);return{loadMoreBoard:nn,overviewStatusPageKey:Se,overviewClassificationPageKey:Ce,boardRequestVersionRef:Vt,boardAbortControllersRef:It,boardInFlightRef:Ft,boardInitialPageRef:Rt,boardLoadedRef:Pt,setBoardTotals:b,setBoardKindTotals:O,setBoardStates:A,setOverviewStatusPages:j,setOverviewClassificationPages:ne,setOperationsLoading:B,operations:d,error:Ne,globalLoadingPending:F===`USD`&&M?.currency!==F,costLocale:P,refresh:async()=>{await Yt()},snapshotNotice:Mt(e,d===null&&xe,P),setupRoute:gn,failedArea:H,retryLastLoad:hn,costs:M,currency:F,dashboardView:c,lastUpdatedAt:Le,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:Oe,setDisplayedCosts:N,setCurrency:ae,setCostSurfaceLoading:Ee,changeDashboardLocale:se,loadMoreTraceTasks:_t,openTrace:nt,setRefreshDialog:W,setSelectedTraceTaskId:ct,openTraceChange:rt,openTraceMacro:at,selectedTraceTaskId:st,traceMacroLoading:ot,trace:pt,traceLoadingTaskId:ht,traceTasksHasMore:J,traceTasksLoading:yt,traceTasks:gt,capabilityNavigation:Be(c,P,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:k,operationsPeriod:I,entityPage:p,dashboardIdentity:K,operationsLoading:xe,factualCostFact:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:Te,operationsSurfaceLoading:we,currentCostByRun:fn,loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt,loadOperationsDetails:Xt,entityPageKind:g,loadFilteredOperationsPage:$t,loadFilteredBoard:tn,loadWorkListPage:Kt,loadWorkListFilters:Gt,workListFiltersRef:Wt,boardFiltersRef:zt,workListPage:Ut,overviewStatusPages:ee,loadOverviewStatusPage:an,overviewClassificationPages:te,loadOverviewClassificationPage:rn,openDocument:tt,api:r,setError:G,operationsPeriodRef:R,setOperationsPeriod:L,operationsDetailLoadedRef:q,operationsDetailCancelRef:kt,operationsDetailAbortRef:$,operationsPageAbortRef:jt,resetWorkListPage:qt,operationsPageRequestVersionRef:Nt,resetBoard:on,refreshVersion:Y,costSummaryAbortRef:Z,costSummaryRequestVersion:Et,setEntityPage:h,costsLoadedRef:Q,setCosts:re,setPeriodTransitionPending:De,periodTransitionVersionRef:St,setLoadingArea:V,navigate:ln,setHelpOpen:pe,closeDocument:$e,documentDetail:et,helpOpen:fe,reconciliationResult:Fe,setReconciliationResult:Ie,refreshDialog:Me,setTrace:lt,traceLink:mt,setTraceLoadingTaskId:dt,setTraceLink:ut,refreshFromDialog:cn,renderedOperations:d}}async function Pt(e){let t=await(await fetch(`/api/v2/health`,{cache:`no-store`,signal:e})).json();if(t?.kind!==`zaip-dashboard-sqlite-runtime`||typeof t.workspace!=`string`||typeof t.workspace_name!=`string`||![`initialized`,`missing`,`invalid`].includes(t.lifecycle_manifest_state))throw Error(`Identidade do Dashboard indisponível`);return t}function Ft(){let[e,t]=(0,m.useState)(null),[n,r]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=!1,n,i;async function a(){i=new AbortController;let o=setTimeout(()=>i.abort(),4e3);try{let n=await Pt(i.signal);e||(t(n),r(!1))}catch{e||r(!0)}finally{clearTimeout(o),e||(n=setTimeout(a,5e3))}}return a(),()=>{e=!0,clearTimeout(n),i?.abort()}},[]),{status:e,unavailable:n}}function It({status:e,unavailable:t=!1}){let n=e?.lifecycle_manifest_state;return n===`initialized`&&e?.status===`ok`&&!t?null:(0,g.jsx)(`aside`,{className:`workspace-status`,"aria-label":`Saúde do Dashboard`,children:n===`missing`||n===`invalid`?(0,g.jsxs)(`div`,{className:`workspace-status__warning`,role:`alert`,children:[(0,g.jsx)(`strong`,{children:n===`missing`?`Lifecycle não inicializado`:`Manifesto do lifecycle inválido`}),(0,g.jsx)(`p`,{children:`Os dados deste workspace estão indisponíveis. Na pasta do projeto, execute:`}),(0,g.jsx)(`code`,{children:`node .agents/runtime/bin/zaip.mjs manifest rebuild --confirm-full-scan`})]}):e?.status===`degraded`||t?(0,g.jsx)(`p`,{className:`workspace-status__warning`,role:`status`,children:t?`Não foi possível consultar a saúde do Dashboard. Tentando novamente…`:`Dashboard degradado: a atualização dos dados ou da telemetria requer atenção.`}):(0,g.jsx)(`p`,{className:`workspace-status__warning`,role:`status`,children:`Identificando a saúde do Dashboard…`})})}function Lt(){let e=Nt(),t=Ft();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(It,{...t}),t.status?.lifecycle_manifest_state===`initialized`?(0,g.jsx)(xe,{model:e}):null]})}var Rt=document.getElementById(`root`);if(!Rt)throw Error(`Elemento #root não encontrado`);(0,h.createRoot)(Rt).render((0,g.jsx)(m.StrictMode,{children:(0,g.jsx)(Lt,{})}));export{Ct as n,Ft as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-uPnOBShc.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
1
+ import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-B0Jwz_rk.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
3
  `+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{C as t,E as n,S as r,c as i,d as a,f as o,l as s,m as c,p as l,s as u,u as d,w as f,x as p}from"./cost-monitor-uPnOBShc.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-Hc9fp_gs.js";var O=e(n(),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)(u,{"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:s,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:()=>s(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)(c,{"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)(l,{"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)(u,{"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:d,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)(s,{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)(s,{"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:r,onOpenPrd:s,onOpenSpec:c,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:r,onOpenPrd:s,onOpenSpec:c}),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)(i,{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)(u,{"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)(a,{"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)(l,{"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)(i,{"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)(o,{"aria-hidden":`true`,size:13}),` `,i,` `,D.items]}),(0,k.jsxs)(`span`,{children:[t===`pt-BR`?`Ver etapa`:`View stage`,(0,k.jsx)(l,{"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 i=[{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?`—`:p(e.total_tokens.value,t)},{label:n.cost,metric:e.cost,value:e.cost.value===null||e.cost.currency===null?`—`:r(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:i.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,n){return e===null?`—`:t(e,n)}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
+ import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{C as t,E as n,S as r,c as i,d as a,f as o,l as s,m as c,p as l,s as u,u as d,w as f,x as p}from"./cost-monitor-B0Jwz_rk.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-CjGGux6h.js";var O=e(n(),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)(u,{"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:s,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:()=>s(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)(c,{"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)(l,{"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)(u,{"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:d,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)(s,{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)(s,{"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:r,onOpenPrd:s,onOpenSpec:c,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:r,onOpenPrd:s,onOpenSpec:c}),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)(i,{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)(u,{"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)(a,{"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)(l,{"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)(i,{"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)(o,{"aria-hidden":`true`,size:13}),` `,i,` `,D.items]}),(0,k.jsxs)(`span`,{children:[t===`pt-BR`?`Ver etapa`:`View stage`,(0,k.jsx)(l,{"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 i=[{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?`—`:p(e.total_tokens.value,t)},{label:n.cost,metric:e.cost,value:e.cost.value===null||e.cost.currency===null?`—`:r(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:i.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,n){return e===null?`—`:t(e,n)}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};
@@ -6,12 +6,12 @@
6
6
  <meta name="color-scheme" content="dark light" />
7
7
  <link rel="icon" type="image/png" href="/icon_zaip.png" />
8
8
  <title>Dashboard Zaip AIOS</title>
9
- <script type="module" crossorigin src="/assets/index-BqeOEZW5.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-D5HmMZ27.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Bh1tDfsg.js">
11
- <link rel="modulepreload" crossorigin href="/assets/cost-monitor-uPnOBShc.js">
12
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-C9ta_O10.js">
13
- <link rel="modulepreload" crossorigin href="/assets/icons-vendor-Hc9fp_gs.js">
14
- <link rel="modulepreload" crossorigin href="/assets/traceability-IcefoTOv.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/cost-monitor-B0Jwz_rk.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-B9jZSAKf.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/icons-vendor-CjGGux6h.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/traceability-DFpwb0TN.js">
15
15
  <link rel="stylesheet" crossorigin href="/assets/cost-monitor-C2AFYBu_.css">
16
16
  <link rel="stylesheet" crossorigin href="/assets/traceability-DFY7ZDlu.css">
17
17
  <link rel="stylesheet" crossorigin href="/assets/index-DZhppOIk.css">
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-frontend",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "build": "vite build && node ../../../../scripts/normalize-generated-text.mjs dist",
7
+ "build": "node ../../packages/local-runtime/scripts/build-frontend.mjs",
8
8
  "clean": "node ../../../../scripts/clean.mjs",
9
9
  "dev": "vite --host 127.0.0.1 --port 5173 --strictPort",
10
10
  "test": "vitest run --passWithNoTests",
@@ -45,6 +45,7 @@ export function AppDashboardContent({ model }: AppDashboardContentProps) {
45
45
  selectedTraceTaskId,
46
46
  trace,
47
47
  traceLoadingTaskId,
48
+ traceMacroLoading,
48
49
  traceTasksHasMore,
49
50
  traceTasksLoading,
50
51
  traceTasks,
@@ -272,6 +273,7 @@ export function AppDashboardContent({ model }: AppDashboardContentProps) {
272
273
  void loadOverviewClassificationPage(kind, classification, offset)
273
274
  }
274
275
  onOpenDocument={(kind, id) => void openDocument(kind, id)}
276
+ onOpenMacro={(kind, id) => void openTraceMacro(kind === "prd" ? "PRD" : "SPEC", id)}
275
277
  onOpenTask={openTrace}
276
278
  onPriorityChange={async (itemIds) => {
277
279
  try {
@@ -357,6 +359,7 @@ export function AppDashboardContent({ model }: AppDashboardContentProps) {
357
359
  showTrace={dashboardView === "traceability"}
358
360
  trace={trace}
359
361
  traceLink={traceLink}
362
+ traceMacroLoading={traceMacroLoading}
360
363
  traceLoadingTaskId={traceLoadingTaskId}
361
364
  onCloseHelp={() => setHelpOpen(false)}
362
365
  onCloseTrace={() => setTrace(null)}
@@ -35,12 +35,12 @@ export function AppOverlays({
35
35
  documentDetail,
36
36
  helpOpen,
37
37
  loadingArea,
38
- operations,
39
38
  reconciliationResult,
40
39
  refreshDialog,
41
40
  showTrace,
42
41
  trace,
43
42
  traceLink,
43
+ traceMacroLoading,
44
44
  traceLoadingTaskId,
45
45
  closeDocument,
46
46
  onCloseHelp,
@@ -65,8 +65,14 @@ export function AppOverlays({
65
65
  trace: TaskTrace | null;
66
66
  traceLink:
67
67
  | { kind: "change"; row: ChangeProjection }
68
- | { kind: "macro"; label: "PRD" | "SPEC"; row: MacroProjection }
68
+ | {
69
+ kind: "macro";
70
+ label: "PRD" | "SPEC";
71
+ row: MacroProjection;
72
+ projection: OperationsProjection;
73
+ }
69
74
  | null;
75
+ traceMacroLoading: { label: "PRD" | "SPEC"; id: string } | null;
70
76
  traceLoadingTaskId: string | null;
71
77
  closeDocument: () => void;
72
78
  onCloseHelp: () => void;
@@ -112,9 +118,9 @@ export function AppOverlays({
112
118
  onOpenTrace(taskId);
113
119
  }}
114
120
  row={traceLink.row}
115
- runs={operations.runs}
116
- specs={operations.specs}
117
- tasks={operations.tasks}
121
+ runs={traceLink.projection.runs}
122
+ specs={traceLink.projection.specs}
123
+ tasks={traceLink.projection.tasks}
118
124
  />
119
125
  ) : null}
120
126
  {documentDetail ? (
@@ -190,8 +196,11 @@ export function AppOverlays({
190
196
  onDismiss={onDismissReconciliation}
191
197
  />
192
198
  ) : null}
193
- {loadingArea !== null && refreshDialog === null ? (
194
- <DashboardLoadingNotice area={loadingArea} locale={costLocale} />
199
+ {(loadingArea !== null || traceMacroLoading !== null) && refreshDialog === null ? (
200
+ <DashboardLoadingNotice
201
+ area={traceMacroLoading === null ? (loadingArea ?? "operations") : "operations"}
202
+ locale={costLocale}
203
+ />
195
204
  ) : null}
196
205
  </>
197
206
  );
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
3
3
  export function readAppCompositionSource(): string {
4
4
  return [
5
5
  "use-dashboard-app-model.tsx",
6
+ "use-dashboard-locale.ts",
6
7
  "AppDashboardContent.tsx",
7
8
  "use-app-work-board.ts",
8
9
  "dashboard-cost-facts.ts",
@@ -73,7 +73,7 @@ describe("Cost period refresh", () => {
73
73
  expect(activeCostReload).toContain(
74
74
  "[costs?.currency, currency, failedArea, loadCostSummary, operations]",
75
75
  );
76
- expect(app).toContain("}, [api, currency, operationsPeriod]);");
76
+ expect(app).toContain("}, [api, currency, operationsPeriod, currencyRef]);");
77
77
  expect(app).toContain("costsLoadedRef.current = false;");
78
78
  });
79
79
 
@@ -37,6 +37,7 @@ function renderPeriod(preset: "today" | "yesterday", loading = false) {
37
37
  onDateChange: vi.fn(),
38
38
  onLocaleChange: vi.fn(),
39
39
  onOpenDocument: vi.fn(),
40
+ onOpenMacro: vi.fn(),
40
41
  onOpenTask: vi.fn(async () => false),
41
42
  onPriorityChange: vi.fn(async () => undefined),
42
43
  onRefresh: vi.fn(),
@@ -92,6 +93,7 @@ describe("App-owned Operations period render", () => {
92
93
  onDateChange: vi.fn(),
93
94
  onLocaleChange: vi.fn(),
94
95
  onOpenDocument: vi.fn(),
96
+ onOpenMacro: vi.fn(),
95
97
  onOpenTask: vi.fn(async () => false),
96
98
  onPriorityChange: vi.fn(async () => undefined),
97
99
  onRefresh: vi.fn(),