@zaip-ai/cli 3.5.0 → 3.7.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.
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.js +1 -1
- package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
- package/dist/services/codex-conversation-lifecycle-hook.js +37 -6
- package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
- package/dist/services/stack-install.d.ts.map +1 -1
- package/dist/services/stack-install.js +19 -9
- package/dist/services/stack-install.js.map +1 -1
- package/dist/services/stack-node.d.ts.map +1 -1
- package/dist/services/stack-node.js +1 -1
- package/dist/services/stack-node.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/config/agents/discovery.json +1 -1
- package/templates/.agents/dashboard/.zaip-managed.json +47 -43
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-DRI_XwUf.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-OulA4CoX.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-BKBpJyLh.js → TraceabilityWorkspace-Ckxk_izu.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-CqfSgtk9.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-CxrG_wRI.css → index-OBJXZOwe.css} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +2 -2
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +0 -2
- package/templates/.agents/dashboard/apps/frontend/src/DashboardGlobalSettings.tsx +7 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsCard.tsx +15 -2
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/cost-calculation-guide.css +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-help-dialog.css +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/operations-entity-page-projection.ts +4 -1
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-contract.test.ts +20 -9
- package/templates/.agents/dashboard/apps/frontend/src/pricing-settings-dialog.css +5 -5
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.test.ts +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsEntityFilters.tsx +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/PagedWorkList.tsx +2 -2
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +122 -122
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +2 -2
- package/templates/.agents/dashboard/packages/local-runtime/package.json +2 -2
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +124 -124
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +3 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-refresh.test.ts +2 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-filter-matrix.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-pricing-provenance.test.ts +49 -13
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +4 -6
- package/templates/.agents/dashboard/tests/e2e/specs/work-board-hydration.ts +38 -0
- package/templates/.agents/design/.zaip-managed.json +11 -7
- package/templates/.agents/design/apps/catalog/dist/assets/index-Cv4VfxTQ.js +72 -0
- package/templates/.agents/design/apps/catalog/dist/index.html +1 -1
- package/templates/.agents/design/apps/catalog/package.json +2 -2
- package/templates/.agents/design/apps/catalog/src/components/DashboardFiltersSpecimen.tsx +26 -21
- package/templates/.agents/design/apps/catalog/src/components/StackVersionFieldSpecimen.tsx +1 -5
- package/templates/.agents/design/apps/catalog/src/styles/stack-version-field.css +75 -13
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +58 -27
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +144 -162
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +3 -1
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/template-manifest.json +89 -81
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-Je5nK-Et.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-D46WWIKr.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-Bas2TVju.js +0 -2
- /package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-CCMVnkkI.js → DashboardHelpDialog-BDQR0U4a.js} +0 -0
package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-D46WWIKr.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,_ as n,v as r,w as i,y as a}from"./cost-monitor-j3aUYH5G.js";import{t as o}from"./index-Bas2TVju.js";var s=e(t(),1),c=[{id:`primary_language`,defaultName:`TypeScript`,scope:`backend`},{id:`backend_runtime`,defaultName:`Node.js`,scope:`backend`},{id:`backend_api`,defaultName:`Hono`,scope:`backend`},{id:`query_builder`,defaultName:`Kysely`,scope:`backend`},{id:`database`,defaultName:`PostgreSQL via Supabase`,scope:`backend`},{id:`auth_storage`,defaultName:`Supabase Auth + Storage`,scope:`backend`},{id:`cache_messaging`,defaultName:`Redis`,scope:`backend`},{id:`async_queue`,defaultName:`BullMQ`,scope:`backend`},{id:`backend_infrastructure`,defaultName:`Terraform`,scope:`backend`},{id:`backend_hosting`,defaultName:`Hostinger VPS`,scope:`backend`},{id:`web_framework`,defaultName:`React`,scope:`frontend`},{id:`web_language`,defaultName:`TypeScript`,scope:`frontend`},{id:`web_build`,defaultName:`Vite`,scope:`frontend`},{id:`frontend_hosting`,defaultName:`Cloudflare Pages`,scope:`frontend`},{id:`site_framework`,defaultName:`Astro`,scope:`site`},{id:`site_language`,defaultName:`TypeScript`,scope:`site`},{id:`site_islands`,defaultName:`React Islands`,scope:`site`},{id:`site_build`,defaultName:`Vite`,scope:`site`},{id:`site_hosting`,defaultName:`Cloudflare Pages`,scope:`site`},{id:`prometheus`,defaultName:`Prometheus`,scope:`observability`},{id:`grafana`,defaultName:`Grafana`,scope:`observability`},{id:`uptime_kuma`,defaultName:`Uptime Kuma`,scope:`observability`},{id:`cadvisor`,defaultName:`cAdvisor`,scope:`observability`},{id:`node_exporter`,defaultName:`node-exporter`,scope:`observability`},{id:`redis_exporter`,defaultName:`Redis Exporter`,scope:`observability`},{id:`k6`,defaultName:`k6`,scope:`testing`},{id:`autocannon`,defaultName:`autocannon`,scope:`testing`}],l=new Set([`database`,`auth_storage`,`backend_hosting`,`frontend_hosting`,`site_hosting`]);function u(e){return l.has(e)}function d(e){let{languages:t,components:n,...r}=e.stack.overrides,i=b(n)?n:{};return{components:Object.fromEntries(c.map(e=>{let t=i[e.id],n=b(t)?t:{};return[e.id,{name:y(n.name)||e.defaultName,version:y(n.version),reference:y(n.reference)}]})),otherOverrides:JSON.stringify(r,null,2)}}function f(e,t){let n=new Map(t.filter(e=>e.installation===`installed`&&e.version!==null).map(e=>[e.name.toLowerCase(),e.version]));return Object.fromEntries(c.map(t=>{let r=e[t.id],i=n.get(_(t.id));return[t.id,r.version!==``||i===void 0?r:{...r,version:i}]}))}function p(e,t,n){if(e.autonomy?.version===1&&e.execution&&e.execution.runtime!==`manual`&&e.execution.autonomous.provider!==`codex`)throw Error(`Autonomy-v1 exige Codex na execução gerenciada / requires Codex for managed execution. Selecione Codex; conversas diretas continuam disponíveis.`);let r=JSON.parse(n);if(!b(r))throw Error(`Demais overrides deve ser um objeto JSON.`);let{languages:i,components:a,...o}=r;for(let e of c){let n=t[e.id].version.trim();if(n!==``&&!u(e.id)&&!/^\d+\.\d+(?:\.\d+)?(?:[-+][0-9A-Za-z.-]+)?$/.test(n))throw Error(`A versão de ${t[e.id].name||e.defaultName} deve ser exata, como 22.16.0 ou 17.6, sem ^, ~, >= ou latest.`);if(u(e.id)&&(n.length>120||/[\r\n]/.test(n)))throw Error(`A referência de ${t[e.id].name||e.defaultName} deve ter uma única linha com até 120 caracteres.`)}let s=Object.fromEntries(c.map(e=>[e.id,{name:t[e.id].name.trim()||e.defaultName,version:t[e.id].version.trim(),reference:t[e.id].reference.trim()}])),l=b(e.stack.overrides.components)?e.stack.overrides.components:{};return{...e,stack:{...e.stack,overrides:{...o,components:{...l,...s},languages:{frontend:v(s,`frontend`),backend:v(s,`backend`),site:v(s,`site`)}}}}}function m(e){return[...new Set(e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean))]}function h(){return{runtime:`autonomous`,autonomous:{provider:`codex`,model:`gpt-5.6-terra`,max_parallelism:1,lease_ms:6e4}}}function g(e){let t=e?.match(/^v?(\d+)\.(\d+)\.\d+(?:[-+][0-9A-Za-z.-]+)?$/);return t?`v${t[1]}.${t[2]}`:null}function _(e){return e===`backend_runtime`?`node.js`:e===`backend_api`?`hono`:e===`site_framework`?`astro`:e===`cache_messaging`?`redis`:e===`async_queue`?`bullmq`:e===`web_framework`||e===`site_islands`?`react`:e===`web_build`||e===`site_build`?`vite`:e===`primary_language`||e===`web_language`||e===`site_language`?`typescript`:``}function v(e,t){return[...new Set(c.filter(e=>e.scope===t).map(t=>e[t.id].name.trim()).filter(Boolean))]}function y(e){return typeof e==`string`?e:``}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var x=i(),S={primary_language:{pt:`Linguagem principal`,en:`Primary language`},backend_runtime:{pt:`Runtime backend`,en:`Backend runtime`},backend_api:{pt:`Framework backend / API`,en:`Backend framework / API`},query_builder:{pt:`Query builder`,en:`Query builder`},database:{pt:`Banco de dados`,en:`Database`},auth_storage:{pt:`Autenticação e Storage`,en:`Authentication and Storage`},cache_messaging:{pt:`Cache e mensageria`,en:`Cache and messaging`},async_queue:{pt:`Filas e processamento assíncrono`,en:`Queues and async processing`},backend_infrastructure:{pt:`Infraestrutura backend`,en:`Backend infrastructure`},backend_hosting:{pt:`Hospedagem do backend`,en:`Backend hosting`},web_framework:{pt:`Framework do Web App`,en:`Web App framework`},web_language:{pt:`Linguagem do Web App`,en:`Web App language`},web_build:{pt:`Build do Web App`,en:`Web App build`},frontend_hosting:{pt:`Hospedagem do frontend`,en:`Frontend hosting`},site_framework:{pt:`Framework do site`,en:`Site framework`},site_language:{pt:`Linguagem do site`,en:`Site language`},site_islands:{pt:`Componentes interativos`,en:`Interactive components`},site_build:{pt:`Build do site`,en:`Site build`},site_hosting:{pt:`Hospedagem do site`,en:`Site hosting`},prometheus:{pt:`Coleta de métricas`,en:`Metrics collection`},grafana:{pt:`Dashboards`,en:`Dashboards`},uptime_kuma:{pt:`Monitoramento de disponibilidade`,en:`Availability monitoring`},cadvisor:{pt:`Métricas de containers`,en:`Container metrics`},node_exporter:{pt:`Métricas de host`,en:`Host metrics`},redis_exporter:{pt:`Métricas do Redis`,en:`Redis metrics`},k6:{pt:`Teste de carga`,en:`Load testing`},autocannon:{pt:`Teste HTTP de carga`,en:`HTTP load testing`}};function C({components:e,locale:t,onChange:n,referenceHint:r,versionHint:i}){let a=[{scope:`backend`,title:t===`pt-BR`?`Backend e dados`:`Backend and data`},{scope:`frontend`,title:`Web App`},{scope:`site`,title:t===`pt-BR`?`Site e landing pages`:`Site and landing pages`},{scope:`observability`,title:t===`pt-BR`?`Observabilidade`:`Observability`},{scope:`testing`,title:t===`pt-BR`?`Testes sob demanda`:`On-demand testing`}],o=(t,r,i)=>n({...e,[t]:{...e[t],[r]:i}});return(0,x.jsxs)(`div`,{className:`project-stack-editor`,children:[a.map(n=>(0,x.jsxs)(`section`,{children:[(0,x.jsx)(`h3`,{children:n.title}),(0,x.jsxs)(`div`,{className:`project-stack-table`,children:[(0,x.jsxs)(`div`,{className:`project-stack-table-head`,"aria-hidden":`true`,children:[(0,x.jsx)(`span`,{children:`Item`}),(0,x.jsx)(`span`,{children:t===`pt-BR`?`Tecnologia`:`Technology`}),(0,x.jsx)(`span`,{children:t===`pt-BR`?`Versão atual / referência`:`Current version / reference`}),(0,x.jsx)(`span`,{children:t===`pt-BR`?`Pacote / imagem / serviço`:`Package / image / service`})]}),c.filter(e=>e.scope===n.scope).map(n=>(0,x.jsxs)(`div`,{className:`project-stack-row`,children:[(0,x.jsx)(`strong`,{children:S[n.id][t===`pt-BR`?`pt`:`en`]}),(0,x.jsx)(`input`,{"aria-label":`${S[n.id].pt}: tecnologia`,value:e[n.id].name,onChange:e=>o(n.id,`name`,e.target.value)}),(0,x.jsx)(`input`,{"aria-label":`${S[n.id].pt}: ${u(n.id)?`versão atual ou referência`:`versão exata`}`,className:u(n.id)?`is-reference-value`:void 0,inputMode:u(n.id)?`text`:`decimal`,placeholder:u(n.id)?t===`pt-BR`?`Serviço em nuvem`:`Cloud service`:`x.y.z`,title:u(n.id)?e[n.id].version:void 0,value:e[n.id].version,onChange:e=>o(n.id,`version`,e.target.value)}),(0,x.jsx)(`input`,{"aria-label":`${S[n.id].pt}: referência`,placeholder:`npm:pacote ou service:nome`,value:e[n.id].reference,onChange:e=>o(n.id,`reference`,e.target.value)})]},n.id))]})]},n.scope)),(0,x.jsxs)(`div`,{className:`project-stack-format-help`,children:[(0,x.jsxs)(`p`,{children:[(0,x.jsx)(`strong`,{children:t===`pt-BR`?`Formato da versão:`:`Version format:`}),` `,i]}),(0,x.jsxs)(`p`,{children:[(0,x.jsx)(`strong`,{children:t===`pt-BR`?`Formato da referência:`:`Reference format:`}),` `,r]})]})]})}function w({components:e,showTitle:t=!0,text:n}){return e.length===0?null:(0,x.jsxs)(`section`,{className:`project-stack-versions`,"aria-label":n.versions,children:[t?(0,x.jsx)(`h3`,{children:n.versions}):null,(0,x.jsx)(`div`,{children:e.map(e=>(0,x.jsxs)(`article`,{children:[(0,x.jsxs)(`div`,{className:`project-stack-version-identity`,children:[(0,x.jsx)(`strong`,{children:e.name}),(0,x.jsxs)(`code`,{children:[n.current,`: `,e.version??n.versionUnavailable]}),e.configured_version!==null&&e.configured_version!==e.version?(0,x.jsxs)(`code`,{children:[n.configured,`: `,e.configured_version]}):null]}),(0,x.jsx)(`span`,{className:`is-${e.verification}`,children:e.installation===`runtime`?n.runtime:e.installation===`installed`?n.installed:e.installation===`bundled`?n.bundled:n.missing}),e.source?(0,x.jsx)(`small`,{children:e.source}):null]},e.name))})]})}function T({children:e,className:t=``,title:n}){return(0,x.jsxs)(`section`,{className:`project-settings-card ${t}`,children:[(0,x.jsx)(`h2`,{children:n}),(0,x.jsx)(`div`,{className:`project-settings-fields`,children:e})]})}function E({children:e,className:t=``,hint:n,label:r}){return(0,x.jsxs)(`div`,{className:`project-settings-field ${t}`,children:[(0,x.jsx)(`span`,{children:r}),e,n?(0,x.jsx)(`small`,{children:n}):null]})}function D(e){return{health:e.health??{state:`unknown`,scope:`settings_runtime`},dependencies:O(e.dependencies,e.dependencies?.installed),documentation:O(e.documentation,e.documentation?.available),profile:e.installation_profile??null,hasMissingDependencies:(k(e.dependencies?.missing)??0)>0}}function O(e,t){let n=e?.state??`unknown`,r=k(e?.percent);return{completed:k(t),total:k(e?.applicable),percentage:(n===`complete`||n===`incomplete`)&&r!==null&&r<=100?r:null,state:n}}function k(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}function A(e){return e.filter(e=>![`database`,`installation`].includes(e.id))}var j={"pt-BR":{eyebrow:`Configurações`,title:`Configuração do projeto`,intro:`Edite o arquivo central do projeto com validação do schema antes da gravação.`,loading:`Carregando…`,loadError:`Não foi possível carregar as configurações do projeto.`,retry:`Tentar novamente`,back:`Voltar ao dashboard`,save:`Salvar configurações`,saving:`Validando e salvando…`,saved:`Configurações salvas e validadas.`,framework:`Framework ZAIP-AIOS`,frameworkHint:`Ativa ou desativa o framework para este projeto.`,identity:`Identidade do projeto`,workspacePath:`Caminho do projeto`,workspacePathHint:`Pasta local usada por esta instância do Dashboard.`,workspacePathLoading:`Identificando caminho…`,workspacePathUnavailable:`Caminho indisponível`,stack:`Stack e linguagens`,execution:`Execução`,assurance:`Assurance`,executionToggleHint:`Grava ou remove o bloco execution. Sem ele, o projeto usa execução manual.`,runtimeHint:`Managed gerencia PRDs/SPECs e mantém avulsas diretas. Manual não inicia provider; autonomous permite execução gerenciada também para Task avulsa por comando explícito.`,providerHint:`Provider que inicia os agentes da execução autônoma: Codex ou Claude.`,autonomyProviderHint:`Autonomy-v1 exige Codex para execução gerenciada. Claude continua disponível em conversas diretas ou no protocolo legado.`,executionModelHint:`Modelo-base do runtime autônomo. A política automática de PRD/SPEC ainda pode selecionar um modelo permitido por agente.`,parallelismHint:`Teto de agentes simultâneos. O valor efetivo é o menor limite entre projeto, DAG, provider e squad.`,leaseHint:`Tempo de lease configurado para o coordenador autônomo.`,assuranceToggleHint:`Ativa ou remove os gates de evidência, revisão e qualidade do projeto. Recomenda-se manter ativo.`,assuranceVersionHint:`Versão do contrato de assurance. É fixa e somente leitura.`,assuranceDepthHint:`Auto ajusta o rigor ao escopo; base exige o conjunto padrão; elevated amplia validações para mudanças mais abrangentes.`,finalCommitHint:`Exige que as evidências comprovem o commit final integrado. Sinais de produção ou migração ainda podem exigir isso mesmo quando desativado.`,context:`Contexto`,overview:`Visão geral do projeto`,metricLabels:{agents:`Agentes`,squads:`Squads`,skills:`Skills`,rules:`Rules`,hooks:`Hooks`},areaLabels:{brandbook:`Brandbook`,design_system:`Design System`,software_architecture:`Arquitetura de Software`,growth_strategy:`Estratégia de Growth`,marketing_strategy:`Estratégia de Marketing`,sales_playbook:`Playbook de Sales`},available:`Criado`,artifactUnavailable:`Ainda não criado`,componentGuide:`Preencha cada responsabilidade separadamente. Use a versão exata do software e, para serviços em nuvem ou hospedagem, informe Serviço em nuvem.`,versionHint:`Software: 22.16.0 ou 17.6, sem prefixos (^, ~, >=). Serviço gerenciado: Serviço em nuvem. Hospedagem: Serviço em nuvem.`,referenceHint:`Ex.: npm:hono, docker:node:22.16.0-bookworm-slim, service:supabase ou provider:cloudflare-pages.`,overrides:`Opções avançadas (JSON)`,overridesHint:`Use apenas fatos técnicos transversais confirmados. Deixe vazio quando não houver exceções.`,versions:`Versões detectadas no workspace`,exact:`Verificada`,constraint:`Requisito`,versionUnavailable:`Não encontrada`,runtime:`Runtime do Dashboard`,installed:`Instalado no projeto`,missing:`Ausente no projeto`,bundled:`Empacotado no Dashboard`,current:`Atual`,configured:`Configurado`,health:`Saúde`,dependencies:`Dependências técnicas`,documentation:`Documentação`,unknown:`Desconhecido`,unavailable:`Indisponível`,notApplicable:`Não aplicável`,complete:`Completo`,incomplete:`Incompleto`,incompleteInstallation:`Há dependências técnicas locais ausentes neste computador.`,dismiss:`Fechar aviso`,contextGuide:`O contexto começa pelas fontes canônicas e inclui somente arquivos relevantes para a tarefa. Saídas geradas são consultadas apenas em setup, release ou checagem de paridade.`,contextDomains:`Branding, Marketing, Growth e Sales são usados sob demanda pelos respectivos especialistas, quando houver uma tarefa e artefatos desses domínios. Não os adicione aqui apenas por existirem como capacidades.`},"en-US":{eyebrow:`Settings`,title:`Project settings`,intro:`Edit the central project file with schema validation before writing.`,loading:`Loading…`,loadError:`Project settings could not be loaded.`,retry:`Try again`,back:`Back to dashboard`,save:`Save settings`,saving:`Validating and saving…`,saved:`Settings saved and validated.`,framework:`ZAIP-AIOS framework`,frameworkHint:`Enable or disable the framework for this project.`,identity:`Project identity`,workspacePath:`Project path`,workspacePathHint:`Local folder used by this Dashboard instance.`,workspacePathLoading:`Identifying path…`,workspacePathUnavailable:`Path unavailable`,stack:`Stack and languages`,execution:`Execution`,assurance:`Assurance`,executionToggleHint:`Writes or removes the execution block. Without it, the project uses manual execution.`,runtimeHint:`Managed runs PRDs/SPECs while standalone Tasks stay direct. Manual never starts a provider; autonomous also permits explicitly commanded managed standalone execution.`,providerHint:`Provider that starts autonomous execution agents: Codex or Claude.`,autonomyProviderHint:`Autonomy-v1 requires Codex for managed execution. Claude remains available for direct conversations or the legacy protocol.`,executionModelHint:`Base model for the autonomous runtime. PRD/SPEC automatic policy may still select an allowed model per agent.`,parallelismHint:`Maximum simultaneous agents. Effective parallelism is the smallest project, DAG, provider, and squad limit.`,leaseHint:`Lease duration configured for the autonomous coordinator.`,assuranceToggleHint:`Enables or removes project evidence, review, and quality gates. Keeping it enabled is recommended.`,assuranceVersionHint:`Assurance contract version. It is fixed and read-only.`,assuranceDepthHint:`Auto adapts rigor to scope; base uses the standard set; elevated expands validation for broader changes.`,finalCommitHint:`Requires evidence for the final integrated commit. Production or migration signals may still require it when disabled.`,context:`Context`,overview:`Project overview`,metricLabels:{agents:`Agents`,squads:`Squads`,skills:`Skills`,rules:`Rules`,hooks:`Hooks`},areaLabels:{brandbook:`Brandbook`,design_system:`Design System`,software_architecture:`Software Architecture`,growth_strategy:`Growth Strategy`,marketing_strategy:`Marketing Strategy`,sales_playbook:`Sales Playbook`},available:`Created`,artifactUnavailable:`Not created yet`,componentGuide:`Fill each responsibility separately. Use an exact software version and, for cloud services or hosting, enter Cloud service.`,versionHint:`Software: 22.16.0 or 17.6, without prefixes (^, ~, >=). Managed service: Cloud service. Hosting: Cloud service.`,referenceHint:`E.g. npm:hono, docker:node:22.16.0-bookworm-slim, service:supabase, or provider:cloudflare-pages.`,overrides:`Advanced options (JSON)`,overridesHint:`Use only confirmed cross-cutting technical facts. Leave empty when there are no exceptions.`,versions:`Versions detected in the workspace`,exact:`Verified`,constraint:`Requirement`,versionUnavailable:`Not found`,runtime:`Dashboard runtime`,installed:`Installed in project`,missing:`Missing from project`,bundled:`Bundled in Dashboard`,current:`Current`,configured:`Configured`,health:`Health`,dependencies:`Technical dependencies`,documentation:`Documentation`,unknown:`Unknown`,unavailable:`Unavailable`,notApplicable:`Not applicable`,complete:`Complete`,incomplete:`Incomplete`,incompleteInstallation:`Some local technical dependencies are missing on this computer.`,dismiss:`Dismiss notification`,contextGuide:`Context starts from canonical sources and includes only files relevant to the task. Generated outputs are consulted only for setup, release, or parity checks.`,contextDomains:`Branding, Marketing, Growth, and Sales are used on demand by their respective specialists when there is a task and artifacts in those domains. Do not add them here merely because they exist as capabilities.`}},M=`autonomy-v1`,N=n([`essential`,`balanced`,`persistent`]),P=a({version:r(1),preset:N}).strict(),F=Object.freeze({essential:Object.freeze({label:`Essencial`,attempts:4,replans:1,automatic_astra:!1}),balanced:Object.freeze({label:`Equilibrado`,attempts:10,replans:3,automatic_astra:!0}),persistent:Object.freeze({label:`Persistente — ilimitado`,attempts:null,replans:null,automatic_astra:!0})});function I(e){let t=P.parse(e??{version:1,preset:`balanced`});return Object.freeze({version:M,preset:t.preset,...F[t.preset],repairs_per_replan:3})}function L({value:e,onChange:t,disabled:n=!1,locale:r=`pt-BR`}){let i=(0,s.useId)(),a=I(e),o=r===`pt-BR`;return(0,x.jsxs)(`div`,{children:[!e&&(0,x.jsx)(`p`,{children:o?`Projeto legado: selecione e salve um perfil para adotar os novos controles nas novas Tasks.`:`Legacy project: select and save a preset to adopt the new controls for new Tasks.`}),(0,x.jsxs)(`label`,{className:`project-settings-field`,htmlFor:i,children:[(0,x.jsx)(`strong`,{children:o?`Perfil de autonomia`:`Autonomy preset`}),(0,x.jsx)(`select`,{id:i,"aria-describedby":`${i}-detail`,disabled:n,value:a.preset,onChange:e=>t({version:1,preset:N.parse(e.target.value)}),children:N.options.map(e=>(0,x.jsx)(`option`,{value:e,children:o?F[e].label:{essential:`Essential`,balanced:`Balanced`,persistent:`Persistent — unlimited`}[e]},e))})]}),(0,x.jsx)(`p`,{id:`${i}-detail`,role:`status`,children:a.attempts===null?o?`Sem limite de tentativas ou replanejamentos. Pode continuar indefinidamente e consumir créditos até você cancelar.`:`No attempt or replanning limit. May continue indefinitely and consume credits until you cancel.`:o?`${a.attempts} execuções por Task (1 inicial + ${a.attempts-1} reparações), até ${a.replans} replanejamento(s). Sem abandono por tempo.`:`${a.attempts} executions per Task (1 initial + ${a.attempts-1} repairs), up to ${a.replans} replan(s). No time-based abandonment.`}),(0,x.jsx)(`p`,{children:a.automatic_astra?o?`Replanejamento: Sol/high no primeiro, Astra/high a partir do segundo. Astra/high pode executar a partir do terceiro.`:`Replanning: Sol/high first, Astra/high from the second. Astra/high may execute from the third.`:o?`Nunca usa Astra automaticamente. Exceção: agente principal de tarefa avulsa com Astra selecionado por você no Codex.`:`Never selects Astra automatically. Exception: a standalone principal with Astra manually selected in Codex.`}),(0,x.jsx)(`p`,{children:o?`A mudança vale para novas Tasks; as iniciadas conservam o perfil e o histórico. Tarefas avulsas priorizam execução direta. Ao delegar, a ZAIP informa que modelo e esforço dos subagentes podem mudar. Critérios de aceite e permissões não são reduzidos.`:`Changes apply to new Tasks; started Tasks retain their preset and history. Standalone work prefers direct execution. Delegation discloses that subagent model and effort may differ. Acceptance criteria and permissions are not reduced.`})]})}function R({api:e,locale:t,onClose:n}){let r=j[t],[i,a]=(0,s.useState)(null),[c,l]=(0,s.useState)(null),[u,_]=(0,s.useState)(null),[v,y]=(0,s.useState)(`{}`),[b,S]=(0,s.useState)(!1),[O,k]=(0,s.useState)(!0),[M,N]=(0,s.useState)(null),[P,F]=(0,s.useState)(null),[I,R]=(0,s.useState)(!1),z=o(),V=c===null?null:D(c),H=(0,s.useCallback)(async()=>{k(!0),N(null);try{let[t,n]=await Promise.all([e.projectSettings(),e.projectOverview()]),r=d(t);a(t),l(n),_(f(r.components,n.stack_components)),y(r.otherOverrides)}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,s.useEffect)(()=>{H()},[H]),(0,s.useEffect)(()=>{R(c!==null&&D(c).hasMissingDependencies)},[c]);async function K(t){if(t.preventDefault(),i!==null){S(!0),N(null),F(null);try{let t=await e.saveProjectSettings(p(i,u??d(i).components,v)),n=await e.projectOverview(),o=d(t);a(t),l(n),_(o.components),y(o.otherOverrides),F(r.saved)}catch(e){N(e instanceof Error?e.message:String(e))}finally{S(!1)}}}if(i===null){let e=O&&M===null;return(0,x.jsx)(`main`,{"aria-busy":e,className:`project-settings-state`,children:(0,x.jsxs)(`div`,{"aria-live":e?`polite`:`assertive`,className:`project-settings-state-card`,role:e?`status`:`alert`,children:[e?(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`project-settings-loader`}):null,(0,x.jsx)(`p`,{children:r.eyebrow}),(0,x.jsx)(`h1`,{children:M?r.loadError:r.loading}),M?(0,x.jsx)(`p`,{className:`project-settings-state-error`,children:M}):null,M?(0,x.jsx)(`button`,{onClick:()=>void H(),type:`button`,children:r.retry}):null,(0,x.jsxs)(`button`,{onClick:n,type:`button`,children:[`← `,r.back]})]})})}return(0,x.jsxs)(`main`,{className:`project-settings-page`,children:[(0,x.jsxs)(`form`,{onSubmit:K,children:[(0,x.jsxs)(`header`,{className:`project-settings-header`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{children:r.eyebrow}),(0,x.jsx)(`h1`,{children:r.title}),(0,x.jsx)(`span`,{children:r.intro})]}),(0,x.jsxs)(`button`,{className:`project-settings-back`,onClick:n,type:`button`,children:[`← `,r.back]})]}),M?(0,x.jsx)(`div`,{className:`project-settings-message is-error`,role:`alert`,children:M}):null,P?(0,x.jsx)(`div`,{className:`project-settings-message is-success`,role:`status`,children:P}):null,(0,x.jsxs)(`section`,{className:`project-settings-feature`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h2`,{children:[r.framework,g(c?.framework_version)?` - ${g(c?.framework_version)}`:``]}),(0,x.jsx)(`p`,{children:r.frameworkHint})]}),(0,x.jsx)(U,{checked:i.zaip?.enabled===!0,label:t===`pt-BR`?`Framework ativo`:`Framework enabled`,onChange:e=>a({...i,zaip:{enabled:e}})})]}),(0,x.jsxs)(`section`,{className:`project-settings-summary`,"aria-label":r.overview,children:[c&&A(c.metrics).map(e=>(0,x.jsxs)(`div`,{className:`project-settings-metric`,children:[(0,x.jsx)(`strong`,{children:e.value}),(0,x.jsx)(`span`,{children:r.metricLabels[e.id]})]},e.id)),V?(0,x.jsx)(B,{installation:V,locale:t}):null]}),(0,x.jsx)(T,{className:`is-wide`,title:r.overview,children:(0,x.jsx)(`div`,{className:`project-overview`,"aria-live":`polite`,children:c?.areas.map(e=>(0,x.jsxs)(`div`,{className:`project-overview-item`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:r.areaLabels[e.id]}),(0,x.jsx)(`code`,{children:e.artifact})]}),(0,x.jsx)(`span`,{className:e.available?`is-available`:`is-unavailable`,children:e.available===!0?r.available:e.available===!1?r.artifactUnavailable:r.unavailable})]},e.id))})}),(0,x.jsx)(T,{className:`is-wide project-detected-versions`,title:r.versions,children:(0,x.jsx)(w,{components:c?.stack_components??[],text:r,showTitle:!1})}),(0,x.jsxs)(`div`,{className:`project-settings-grid`,children:[(0,x.jsxs)(T,{className:`is-wide project-identity-card`,title:r.identity,children:[(0,x.jsx)(E,{className:`project-settings-workspace-field`,hint:r.workspacePathHint,label:r.workspacePath,children:(0,x.jsx)(`code`,{className:`project-settings-workspace-path`,children:z.status?.workspace??(z.unavailable?r.workspacePathUnavailable:r.workspacePathLoading)})}),(0,x.jsx)(E,{label:`Schema`,children:(0,x.jsx)(`input`,{readOnly:!0,value:i.schema_version})}),(0,x.jsx)(E,{label:t===`pt-BR`?`ID do projeto`:`Project ID`,children:(0,x.jsx)(`input`,{required:!0,value:i.project.id,onChange:e=>a({...i,project:{...i.project,id:e.target.value}})})}),(0,x.jsx)(E,{label:t===`pt-BR`?`Nome do projeto`:`Project name`,children:(0,x.jsx)(`input`,{required:!0,value:i.project.name,onChange:e=>a({...i,project:{...i.project,name:e.target.value}})})}),(0,x.jsx)(E,{label:`Timezone IANA`,children:(0,x.jsx)(`input`,{required:!0,value:i.project.timezone,onChange:e=>a({...i,project:{...i.project,timezone:e.target.value}})})})]}),(0,x.jsxs)(T,{className:`is-wide`,title:r.stack,children:[(0,x.jsx)(`p`,{className:`project-stack-guide`,children:r.componentGuide}),u?(0,x.jsx)(C,{components:u,locale:t,onChange:_,referenceHint:r.referenceHint,versionHint:r.versionHint}):null,(0,x.jsxs)(`details`,{className:`project-settings-advanced`,children:[(0,x.jsx)(`summary`,{children:r.overrides}),(0,x.jsx)(E,{hint:r.overridesHint,label:`Overrides`,children:(0,x.jsx)(`textarea`,{rows:7,value:v,onChange:e=>y(e.target.value)})})]})]}),(0,x.jsxs)(T,{title:r.execution,children:[(0,x.jsx)(W,{checked:i.execution!==void 0,hint:r.executionToggleHint,label:t===`pt-BR`?`Incluir configuração de execução`:`Include execution configuration`,onChange:e=>a({...i,execution:e?{...h(),runtime:`managed`}:void 0})}),i.execution?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E,{hint:r.runtimeHint,label:`Runtime`,children:(0,x.jsxs)(`select`,{value:i.execution.runtime,"aria-label":`Runtime`,onChange:e=>a({...i,execution:e.target.value===`manual`?{runtime:`manual`}:{...h(),runtime:e.target.value===`managed`?`managed`:`autonomous`}}),children:[(0,x.jsx)(`option`,{value:`manual`,children:`manual`}),(0,x.jsx)(`option`,{value:`managed`,children:`managed (PRD/SPEC)`}),(0,x.jsx)(`option`,{value:`autonomous`,children:`autonomous`})]})}),i.execution.runtime===`manual`?null:(0,x.jsx)(G,{config:i,setConfig:a,text:r})]}):null]}),(0,x.jsx)(T,{title:t===`pt-BR`?`Autonomia e recuperação`:`Autonomy and recovery`,children:(0,x.jsx)(L,{value:i.autonomy,disabled:b,locale:t,onChange:e=>a({...i,autonomy:e})})}),(0,x.jsxs)(T,{title:r.assurance,children:[(0,x.jsx)(W,{checked:i.assurance!==void 0,hint:r.assuranceToggleHint,label:t===`pt-BR`?`Incluir assurance`:`Include assurance`,onChange:e=>a({...i,assurance:e?{version:1,standard_depth:`auto`,require_final_commit:!0}:void 0})}),i.assurance?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E,{hint:r.assuranceVersionHint,label:t===`pt-BR`?`Versão`:`Version`,children:(0,x.jsx)(`input`,{readOnly:!0,value:i.assurance.version})}),(0,x.jsx)(E,{hint:r.assuranceDepthHint,label:t===`pt-BR`?`Profundidade padrão`:`Standard depth`,children:(0,x.jsxs)(`select`,{value:i.assurance.standard_depth,onChange:e=>a({...i,assurance:{...i.assurance??{version:1,standard_depth:`auto`,require_final_commit:!0},standard_depth:e.target.value}}),children:[(0,x.jsx)(`option`,{value:`auto`,children:`auto`}),(0,x.jsx)(`option`,{value:`base`,children:`base`}),(0,x.jsx)(`option`,{value:`elevated`,children:`elevated`})]})}),(0,x.jsx)(U,{checked:i.assurance.require_final_commit,hint:r.finalCommitHint,label:t===`pt-BR`?`Exigir commit final`:`Require final commit`,onChange:e=>a({...i,assurance:{...i.assurance??{version:1,standard_depth:`auto`,require_final_commit:!0},require_final_commit:e}})})]}):null]}),(0,x.jsxs)(T,{className:`is-wide`,title:r.context,children:[(0,x.jsx)(W,{checked:i.context!==void 0,label:t===`pt-BR`?`Incluir raízes de contexto`:`Include context roots`,onChange:e=>a({...i,context:e?{canonical_roots:[`packages`],projection_roots:[]}:void 0})}),i.context?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`project-settings-guidance`,children:[(0,x.jsx)(`p`,{children:r.contextGuide}),(0,x.jsx)(`p`,{children:r.contextDomains})]}),(0,x.jsxs)(`div`,{className:`project-settings-fields two-columns`,children:[(0,x.jsx)(E,{hint:t===`pt-BR`?`Uma pasta por linha. Estas são as fontes principais do projeto.`:`One folder per line. These are the project's primary sources.`,label:t===`pt-BR`?`Fontes canônicas`:`Canonical sources`,children:(0,x.jsx)(`textarea`,{required:!0,rows:5,value:i.context.canonical_roots.join(`
|
|
2
|
-
`),onChange:e=>a({...i,context:{...i.context??{canonical_roots:[`packages`],projection_roots:[]},canonical_roots:m(e.target.value)}})})}),(0,x.jsx)(E,{hint:t===`pt-BR`?`Uma pasta por linha. São saídas geradas, não fontes de contexto normal.`:`One folder per line. These are generated outputs, not normal context sources.`,label:t===`pt-BR`?`Saídas geradas/publicadas`:`Generated/published outputs`,children:(0,x.jsx)(`textarea`,{rows:5,value:i.context.projection_roots.join(`
|
|
3
|
-
`),onChange:e=>a({...i,context:{...i.context??{canonical_roots:[`packages`],projection_roots:[]},projection_roots:m(e.target.value)}})})})]})]}):null]})]}),(0,x.jsxs)(`footer`,{className:`project-settings-footer`,children:[(0,x.jsx)(`span`,{children:`.agents/config/project.yaml`}),(0,x.jsx)(`button`,{disabled:b,type:`submit`,children:b?r.saving:r.save})]})]}),I&&V?.hasMissingDependencies?(0,x.jsxs)(`div`,{"aria-live":`assertive`,className:`project-installation-toast`,role:`alert`,children:[(0,x.jsx)(`span`,{children:r.incompleteInstallation}),(0,x.jsx)(`button`,{"aria-label":r.dismiss,onClick:()=>R(!1),type:`button`,children:`×`})]}):null]})}function z(e,t){return`${new Intl.NumberFormat(t,{maximumFractionDigits:2}).format(e)}%`}function B({installation:e,locale:t}){let n=j[t];return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`project-installation-health`,children:[n.health,`:`,` `,e.health.state===`healthy`?t===`pt-BR`?`Saudável`:`Healthy`:e.health.state===`degraded`?t===`pt-BR`?`Degradada`:`Degraded`:n.unknown]}),(0,x.jsx)(V,{dimension:e.dependencies,label:n.dependencies,locale:t}),(0,x.jsx)(V,{dimension:e.documentation,label:n.documentation,locale:t})]})}function V({dimension:e,label:t,locale:n}){let r=j[n],i=e.state===`not_applicable`?r.notApplicable:e.percentage===null?r.unknown:z(e.percentage,n),a=H(e.state,n);return(0,x.jsxs)(`div`,{className:`project-settings-metric installation-metric is-${e.state}`,children:[(0,x.jsx)(`strong`,{children:i}),(0,x.jsx)(`span`,{children:e.total===null||e.completed===null?t:`${t} · ${e.completed}/${e.total}`}),(0,x.jsx)(`small`,{children:a})]})}function H(e,t){let n=j[t];return e===`complete`?n.complete:e===`incomplete`?n.incomplete:e===`not_applicable`?n.notApplicable:e===`unavailable`?n.unavailable:n.unknown}function U({checked:e,hint:t,label:n,onChange:r}){return(0,x.jsxs)(`div`,{className:`project-settings-toggle-field`,children:[(0,x.jsxs)(`label`,{className:`project-settings-toggle`,children:[(0,x.jsx)(`input`,{checked:e,onChange:e=>r(e.target.checked),type:`checkbox`}),(0,x.jsx)(`span`,{"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:n})]}),t?(0,x.jsx)(`small`,{children:t}):null]})}function W(e){return(0,x.jsx)(U,{...e})}function G({config:e,setConfig:t,text:n}){let r=e.execution&&e.execution.runtime!==`manual`?e.execution:h(),i=n=>t({...e,execution:{runtime:r.runtime,autonomous:n}});return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E,{hint:e.autonomy?.version===1?n.autonomyProviderHint:n.providerHint,label:`Provider`,children:(0,x.jsxs)(`select`,{value:r.autonomous.provider,"aria-label":`Provider`,onChange:e=>i({...r.autonomous,provider:e.target.value}),children:[(0,x.jsx)(`option`,{value:`codex`,children:`codex`}),(0,x.jsx)(`option`,{value:`claude`,disabled:e.autonomy?.version===1,children:`claude`})]})}),(0,x.jsx)(E,{hint:n.executionModelHint,label:`Model`,children:(0,x.jsx)(`input`,{required:!0,value:r.autonomous.model,onChange:e=>i({...r.autonomous,model:e.target.value})})}),(0,x.jsx)(E,{hint:n.parallelismHint,label:`Max parallelism`,children:(0,x.jsx)(`input`,{max:8,min:1,type:`number`,value:r.autonomous.max_parallelism,onChange:e=>i({...r.autonomous,max_parallelism:Number(e.target.value)})})}),(0,x.jsx)(E,{hint:n.leaseHint,label:`Lease (ms)`,children:(0,x.jsx)(`input`,{max:36e5,min:5e3,step:1e3,type:`number`,value:r.autonomous.lease_ms,onChange:e=>i({...r.autonomous,lease_ms:Number(e.target.value)})})})]})}export{R as ProjectSettingsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-CCMVnkkI.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-j3aUYH5G.js","assets/cost-monitor-BsMfGfQi.css","assets/dashboard-localization-jvdDfNKs.js","assets/DashboardHelpDialog-Je5nK-Et.css","assets/PricingSettingsDialog-CGYcJ5EB.js","assets/ProjectSettingsPage-D46WWIKr.js","assets/ProjectSettingsPage-CQMhvzvJ.css","assets/CostCalculationGuidePage-C5NgEcVh.js","assets/TraceabilityWorkspace-BKBpJyLh.js","assets/traceability-CcpbpT1s.js","assets/icons-vendor-x8xxL9yW.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-j3aUYH5G.js";import{t as d}from"./react-vendor-CNOXIJHN.js";import{n as f,t as p}from"./traceability-CcpbpT1s.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var m=e(t(),1),h=d(),g=u();function _({locale:e}){let t=e===`pt-BR`?[`Definição`,`Planejamento`,`Pronto para Executar`,`Execução`,`Verificação`]:[`Definition`,`Planning`,`Ready to Execute`,`Execution`,`Verification`];return(0,g.jsxs)(`main`,{"aria-busy":`true`,"aria-live":`polite`,"aria-label":e===`pt-BR`?`Preparando dashboard`:`Preparing dashboard`,className:`app-skeleton`,role:`status`,children:[(0,g.jsxs)(`header`,{className:`app-skeleton-header`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,g.jsx)(`h1`,{children:`Dashboard Zaip AIOS`})]}),(0,g.jsxs)(`div`,{className:`app-skeleton-actions`,children:[(0,g.jsx)(`span`,{}),(0,g.jsx)(`span`,{}),(0,g.jsx)(`span`,{})]})]}),(0,g.jsx)(`section`,{className:`app-skeleton-kpis`,"aria-hidden":`true`,children:Array.from({length:4},(e,t)=>`skeleton-kpi-${t}`).map(e=>(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,g.jsx)(`span`,{className:`app-skeleton-value`}),(0,g.jsx)(`span`,{className:`app-skeleton-line`})]},e))}),(0,g.jsxs)(`section`,{className:`app-skeleton-panels`,"aria-hidden":`true`,children:[(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`div`,{className:`app-skeleton-chart`})]}),(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`div`,{className:`app-skeleton-chart app-skeleton-chart-small`})]})]}),(0,g.jsx)(`section`,{className:`app-skeleton-board`,"aria-hidden":`true`,children:t.map((e,t)=>(0,g.jsxs)(`article`,{children:[(0,g.jsx)(`h2`,{children:e}),Array.from({length:t%2==0?2:1},(t,n)=>`${e}-${n}`).map(e=>(0,g.jsxs)(`div`,{className:`app-skeleton-card`,children:[(0,g.jsx)(`span`,{className:`app-skeleton-line`}),(0,g.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,g.jsx)(`span`,{className:`app-skeleton-pill`})]},e))]},e))})]})}function v(e,t){let n=t===`pt-BR`;return e===`costs`?n?{title:`Carregando Monitor de Custos…`,detail:`Isso costuma levar poucos segundos.`}:{title:`Loading Cost Monitor…`,detail:`This usually takes a few seconds.`}:e===`traceability`?n?{title:`Carregando Rastreabilidade…`,detail:`Estamos preparando as 6 etapas da task.`}:{title:`Loading Traceability…`,detail:`Preparing the task's 6 stages.`}:n?{title:`Atualizando dados do dashboard…`,detail:`Você pode continuar navegando.`}:{title:`Refreshing dashboard data…`,detail:`You can keep navigating.`}}function y({area:e,locale:t}){let n=v(e,t);return(0,g.jsxs)(`section`,{"aria-busy":`true`,"aria-live":`polite`,className:`app-loading-panel`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:n.title}),(0,g.jsx)(`span`,{children:n.detail})]})]})}function b({area:e,locale:t}){let n=v(e,t);return(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:n.title}),(0,g.jsx)(`span`,{children:n.detail})]})]})}function x({locale:e,onRetry:t}){return(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-loading-panel app-loading-panel-error`,role:`status`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:e===`pt-BR`?`Não foi possível carregar os custos`:`Couldn't load costs`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`A tela continua disponível. Tente novamente quando quiser.`:`The dashboard remains available. Try again whenever you want.`})]}),(0,g.jsx)(`button`,{onClick:t,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Try again`})]})}function S({costsLoaded:e,currency:t,snapshotCurrency:n}){return!e||n!==t}function C({aborted:e,currentCurrency:t,currentPeriod:n,currentRequestVersion:r,requestVersion:i,requestedCurrency:a,requestedPeriod:o}){return!e&&i===r&&a===t&&o.from===n.from&&o.to===n.to}function w(e,t){return e===t}function T(e,t,n,r){return w(e,t)&&n.from===r.from&&n.to===r.to}function E(e){return e instanceof DOMException&&e.name===`AbortError`}function D(e,t){return e===t}function O(e,t,n){return w(e,t)&&!n.aborted}function k(e,t){let n=e=>[...new Map(e.map(e=>[e.id,e])).values()];return{...e,prds:n([...e.prds,...t.flatMap(e=>e.prds)]),specs:n([...e.specs,...t.flatMap(e=>e.specs)]),tasks:n([...e.tasks,...t.flatMap(e=>e.tasks)]),changes:n([...e.changes,...t.flatMap(e=>e.changes)])}}function ee(){let e=(0,m.useRef)(null);return(0,m.useEffect)(()=>{e.current?.focus()},[]),(0,g.jsx)(`div`,{"aria-busy":`true`,"aria-live":`polite`,className:`period-transition-overlay`,onKeyDownCapture:e=>e.preventDefault(),ref:e,role:`status`,tabIndex:-1,children:(0,g.jsxs)(`div`,{className:`period-transition-overlay__content`,children:[(0,g.jsx)(`i`,{"aria-hidden":`true`,className:`period-transition-overlay__spinner`}),(0,g.jsx)(`span`,{className:`period-transition-overlay__label`,children:`Carregando...`})]})})}function te({pending:e,children:t}){return(0,g.jsx)(`div`,{"aria-hidden":e||void 0,inert:e,children:t})}var A={"pt-BR":{action:`Tentar novamente`,guidance:`Abra a pasta dashboard dentro de .agents e dê dois cliques novamente no arquivo executável.`,title:`Não foi possível carregar o dashboard`},"en-US":{action:`Try again`,guidance:`Open the dashboard folder inside .agents, then double-click the executable file again.`,title:`Unable to load the dashboard`}};function ne({children:e,error:t,globalLoadingPending:n,locale:r,onRefresh:i,operations:a,snapshotNotice:o,setupRoute:s}){if(s!==null)return s;if(t&&a===null){let e=A[r];return(0,g.jsx)(`main`,{className:`app-loading-boundary`,"aria-labelledby":`dashboard-load-error-title`,children:(0,g.jsxs)(`section`,{className:`app-loading-boundary__card`,role:`alert`,children:[(0,g.jsx)(`div`,{"aria-hidden":`true`,className:`app-loading-boundary__status-icon`,children:(0,g.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,g.jsx)(`path`,{d:`M12 8v4m0 4h.01M10.29 3.86 2.82 16.5A2 2 0 0 0 4.54 19.5h14.92a2 2 0 0 0 1.72-3L13.71 3.86a2 2 0 0 0-3.42 0Z`})})}),(0,g.jsxs)(`div`,{className:`app-loading-boundary__content`,children:[(0,g.jsx)(`p`,{className:`app-loading-boundary__eyebrow`,children:r===`pt-BR`?`Dashboard indisponível`:`Dashboard unavailable`}),(0,g.jsx)(`h1`,{id:`dashboard-load-error-title`,children:e.title}),(0,g.jsx)(`p`,{children:e.guidance})]}),(0,g.jsx)(`button`,{onClick:i,type:`button`,children:e.action})]})})}return a===null?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(_,{locale:r}),o,n?(0,g.jsx)(ee,{}):null]}):e}var j=`modulepreload`,M=function(e){return`/`+e},N={},P=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=M(t,n),t=s(t),t in N)return;N[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:j,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},re=(0,m.lazy)(async()=>({default:(await P(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-CCMVnkkI.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function ie({costLocale:e,documentDetail:t,helpOpen:n,loadingArea:i,operations:a,reconciliationResult:c,refreshDialog:l,showTrace:u,trace:d,traceLink:h,traceLoadingTaskId:_,closeDocument:v,onCloseHelp:y,onCloseTrace:x,onDismissReconciliation:S,onOpenDocument:C,onOpenTrace:w,onOpenTraceChange:T,onOpenTraceMacro:E,onRefreshCancel:D,onRefreshFromDialog:O,setTraceLink:k}){return(0,g.jsxs)(g.Fragment,{children:[u?null:_?(0,g.jsx)(p,{locale:e,taskId:_}):d?(0,g.jsx)(f,{locale:e,onClose:x,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),trace:d}):null,h?.kind===`change`?(0,g.jsx)(r,{details:{kind:`change`,row:h.row},locale:e,onClose:()=>k(null)}):null,h?.kind===`macro`?(0,g.jsx)(s,{label:h.label,locale:e,onClose:()=>k(null),onOpenDocument:C,onOpenTrace:e=>{k(null),w(e)},row:h.row,runs:a.runs,specs:a.specs,tasks:a.tasks}):null,t?(0,g.jsx)(o,{detail:t.detail,error:t.error,label:t.label,locale:e,loading:!t.detail&&!t.error,onClose:v,onRetry:()=>C(t.kind,t.preview.id),preview:t.preview}):null,n?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(re,{locale:e,onClose:y})}):null,l===`choose`?(0,g.jsx)(`div`,{className:`app-refresh-dialog-backdrop`,children:(0,g.jsxs)(`section`,{"aria-label":`Atualizar dashboard`,"aria-modal":`true`,className:`app-refresh-dialog`,role:`dialog`,children:[(0,g.jsx)(`h2`,{children:e===`pt-BR`?`Atualizar dashboard`:`Refresh dashboard`}),(0,g.jsx)(`p`,{children:e===`pt-BR`?`Escolha uma atualização rápida ou reconcilie os itens que ainda estão em aberto.`:`Choose a quick refresh or reconcile work items that are still open.`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`button`,{onClick:()=>O(!1),type:`button`,children:e===`pt-BR`?`Apenas atualizar dados`:`Refresh data only`}),(0,g.jsx)(`button`,{onClick:()=>O(!0),type:`button`,children:e===`pt-BR`?`Reconciliar itens abertos`:`Reconcile open work`})]}),(0,g.jsx)(`button`,{className:`app-refresh-cancel`,onClick:D,type:`button`,children:e===`pt-BR`?`Cancelar`:`Cancel`})]})}):null,l===`refreshing`||l===`reconciling`?(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,g.jsx)(`i`,{}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:l===`reconciling`?e===`pt-BR`?`Reconciliando itens em aberto…`:`Reconciling open work…`:e===`pt-BR`?`Atualizando dados…`:`Refreshing data…`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`Você pode continuar usando o dashboard.`:`You can keep using the dashboard.`})]})]}):null,c!==null&&l===null?(0,g.jsxs)(`section`,{"aria-live":`polite`,className:`app-reconciliation-result`,role:`status`,children:[(0,g.jsx)(`strong`,{children:e===`pt-BR`?`Resultado da reconciliação manual`:`Manual reconciliation result`}),(0,g.jsx)(`span`,{children:e===`pt-BR`?`${c.reconciled_ids.length} item(ns) reconciliado(s).`:`${c.reconciled_ids.length} item(s) reconciled.`}),c.reconciled_ids.length>0?(0,g.jsx)(`p`,{children:c.reconciled_ids.join(`, `)}):null,c.blocked.length>0?(0,g.jsxs)(`p`,{children:[e===`pt-BR`?`Bloqueados: `:`Blocked: `,c.blocked.map(e=>`${e.id}${e.reason===null?``:` (${e.reason})`}`).join(`; `)]}):null,c.not_reconciled.length>0?(0,g.jsxs)(`p`,{children:[e===`pt-BR`?`Não reconciliados: `:`Not reconciled: `,c.not_reconciled.map(e=>`${e.id}${e.reason===null?``:` (${e.reason})`}`).join(`; `)]}):null,(0,g.jsx)(`button`,{onClick:S,type:`button`,children:e===`pt-BR`?`Fechar`:`Dismiss`})]}):null,i!==null&&i!==`operations`&&l===null?(0,g.jsx)(b,{area:i,locale:e}):null]})}var ae=(0,m.lazy)(async()=>({default:(await P(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-CGYcJ5EB.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),F=(0,m.lazy)(async()=>({default:(await P(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-D46WWIKr.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),oe=(0,m.lazy)(async()=>({default:(await P(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-C5NgEcVh.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),se=`/setup-pricing`,ce=`/setup-project`,I=`/cost-calculation-guide`;function le(e){let{api:t,costLocale:n,fxRate:r,navigate:i,pathname:a,pricing:o,refresh:s,setFxRate:c,setPricing:l}=e;return a===`/setup-pricing`?o===null?(0,g.jsxs)(`main`,{className:`app-state`,children:[(0,g.jsx)(`p`,{children:n===`pt-BR`?`Configuração do projeto`:`Project settings`}),(0,g.jsx)(`h1`,{children:n===`pt-BR`?`Carregando catálogo de preços…`:`Loading pricing catalog…`}),(0,g.jsx)(`button`,{onClick:()=>i(`/`),type:`button`,children:n===`pt-BR`?`Voltar ao dashboard`:`Back to dashboard`})]}):(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(ae,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`),onSave:async e=>{l(await t.savePricing(e)),await s()},onSaveFxRate:async e=>{c(await t.saveFxRate(e)),await s()}})}):a===`/cost-calculation-guide`&&o!==null?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(oe,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,g.jsx)(m.Suspense,{fallback:null,children:(0,g.jsx)(F,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var ue=(0,m.lazy)(async()=>({default:(await P(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-BKBpJyLh.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function de({costs:e,costLocale:t,currency:n,dashboardView:r,failedArea:i,lastUpdatedAt:a,loadCostDetail:o,loadCostReadModelPage:s,loadCostRunPage:c,loadCostGroupPage:u,loadingArea:d,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:h,onLocaleChange:_,onOpenTrace:v,onLoadMoreTraceTasks:b,onRefresh:S,onRetry:C,onSelectTraceTask:w,onOpenTraceChange:T,onOpenTraceMacro:E,operations:D,selectedTraceTaskId:O,trace:k,traceLoadingTaskId:ee,traceTasksHasMore:te,traceTasksLoading:A,traceTasks:ne}){return r===`cost-monitor`?e===null?()=>i===`costs`?(0,g.jsx)(x,{locale:t,onRetry:C}):(0,g.jsx)(y,{area:`costs`,locale:t}):r=>(0,g.jsx)(m.Suspense,{fallback:(0,g.jsx)(y,{area:`costs`,locale:t}),children:(0,g.jsx)(l,{currency:n,data:e,embedded:!0,globalFilters:r,lastUpdatedAt:a,locale:t,loading:d===`costs`,loadDetail:o,loadReadModelPage:s,loadRunPage:c,loadGroupPage:u,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:h,onLocaleChange:_,onOpenTrace:v,onRefresh:S,operations:D})}):r===`traceability`?()=>(0,g.jsx)(m.Suspense,{fallback:(0,g.jsx)(y,{area:`operations`,locale:t}),children:(0,g.jsx)(ue,{loadingTaskId:ee,locale:t,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),onLoadMoreTasks:b,onSelectTask:w,selectedTaskId:O,tasks:ne.length>0?ne:D.tasks,hasMoreTasks:te,isLoadingTasks:A,trace:k})}):r===null?(0,g.jsx)(`span`,{"aria-hidden":`true`,hidden:!0}):void 0}function fe({currency:e,locale:t,onCurrencyChange:n,onHelpOpen:r,onNavigate:i,pricingSetupPath:a,projectSetupPath:o,costCalculationGuidePath:s}){return(0,g.jsxs)(`div`,{className:`dashboard-global-settings`,children:[(0,g.jsxs)(`label`,{children:[(0,g.jsx)(`span`,{children:t===`pt-BR`?`Moeda`:`Currency`}),(0,g.jsxs)(`select`,{"aria-label":t===`pt-BR`?`Moeda`:`Currency`,onChange:e=>n(e.target.value),value:e,children:[(0,g.jsx)(`option`,{value:`BRL`,children:`BRL · Real brasileiro`}),(0,g.jsx)(`option`,{value:`USD`,children:`USD · US Dollar`})]})]}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:r,type:`button`,children:t===`pt-BR`?`Central de Ajuda`:`Open help and guides`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(a),type:`button`,children:t===`pt-BR`?`Configurar preços e câmbio`:`Configure pricing and FX`}),(0,g.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(o),type:`button`,children:t===`pt-BR`?`Configurar projeto`:`Configure project`})]})}var pe={preset:`all`,range:a(`this-month`)};function L(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function R(e,t){let n=L(e),r=L(t);return n.from===r.from&&n.to===r.to}function me({model:e}){let{operations:t,error:n,globalLoadingPending:r,costLocale:i,refresh:a,snapshotNotice:o,setupRoute:s,failedArea:l,retryLastLoad:u,costs:d,currency:f,dashboardView:p,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:_,loadCostRunPage:v,loadCostGroupPage:y,loadingArea:b,setDisplayedCosts:x,setCurrency:S,setCostSurfaceLoading:C,changeDashboardLocale:w,loadMoreTraceTasks:T,openTrace:E,setRefreshDialog:D,setSelectedTraceTaskId:O,openTraceChange:k,openTraceMacro:A,renderedOperations:j,selectedTraceTaskId:M,trace:N,traceLoadingTaskId:P,traceTasksHasMore:re,traceTasksLoading:ae,traceTasks:F,capabilityNavigation:oe,boardTotals:le,boardKindTotals:ue,boardExportSource:pe,detailExportSource:L,boardStates:me,operationsPeriod:he,entityPage:ge,dashboardIdentity:_e,operationsLoading:ve,factualCostFact:ye,factualCostPeriods:be,setOperationsSurfaceLoading:xe,currentCostByRun:Se,loadOperationsEntityPage:Ce,loadOperationsLifecyclePage:we,loadOperationsDetails:Te,entityPageKind:z,loadFilteredOperationsPage:Ee,loadFilteredBoard:De,loadWorkListFilters:Oe,loadWorkListPage:B,workListFiltersRef:ke,boardFiltersRef:Ae,workListPage:je,overviewStatusPages:Me,loadOverviewStatusPage:Ne,overviewClassificationPages:Pe,loadOverviewClassificationPage:V,openDocument:Fe,api:Ie,setError:Le,operationsPeriodRef:Re,setOperationsPeriod:ze,operationsDetailLoadedRef:Be,operationsDetailCancelRef:Ve,operationsDetailAbortRef:He,operationsPageAbortRef:Ue,resetWorkListPage:We,operationsPageRequestVersionRef:Ge,resetBoard:Ke,refreshVersion:H,costSummaryAbortRef:U,costSummaryRequestVersion:qe,setEntityPage:W,costsLoadedRef:Je,setCosts:G,setPeriodTransitionPending:Ye,periodTransitionVersionRef:Xe,setLoadingArea:Ze,navigate:Qe,setHelpOpen:$e,closeDocument:et,documentDetail:tt,helpOpen:nt,reconciliationResult:rt,setReconciliationResult:it,refreshDialog:at,setTrace:ot,traceLink:st,setTraceLoadingTaskId:ct,setTraceLink:lt,refreshFromDialog:ut}=e,{loadMoreBoard:dt,overviewStatusPageKey:ft,overviewClassificationPageKey:K,boardRequestVersionRef:pt,boardAbortControllersRef:q,boardInFlightRef:mt,boardInitialPageRef:ht,boardLoadedRef:gt,setBoardTotals:_t,setBoardKindTotals:vt,setBoardStates:yt,setOverviewStatusPages:bt,setOverviewClassificationPages:xt,setOperationsLoading:St}=e;return(0,g.jsxs)(ne,{error:n,globalLoadingPending:r,locale:i,onRefresh:()=>void a(),operations:t,snapshotNotice:o,setupRoute:s,children:[(0,g.jsxs)(te,{pending:r,children:[n?(0,g.jsxs)(`div`,{"aria-live":`assertive`,className:`app-warning app-error`,role:`alert`,children:[(0,g.jsx)(`span`,{children:n}),l?(0,g.jsx)(`button`,{onClick:u,type:`button`,children:i===`pt-BR`?`Tentar novamente`:`Try again`}):null,(0,g.jsx)(`button`,{"aria-label":i===`pt-BR`?`Fechar erro`:`Dismiss error`,onClick:()=>Le(null),type:`button`,children:`×`})]}):null,(0,g.jsx)(c,{alternateContent:de({costs:d,costLocale:i,currency:f,dashboardView:p,failedArea:l,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:_,loadCostRunPage:v,loadCostGroupPage:y,loadingArea:b,onActiveDataChange:x,onCurrencyChange:S,onLoadingChange:C,onLocaleChange:w,onLoadMoreTraceTasks:T,onOpenTrace:e=>void E(e),onRefresh:()=>D(`choose`),onRetry:u,onSelectTraceTask:e=>{O(e),E(e)},onOpenTraceChange:k,onOpenTraceMacro:A,operations:j,selectedTraceTaskId:M,trace:N,traceLoadingTaskId:P,traceTasksHasMore:re,traceTasksLoading:ae,traceTasks:F}),capabilityNavigation:oe,boardTotals:le,boardKindTotals:ue,boardExportSource:pe,detailExportSource:L,boardStates:me,data:j,lastUpdatedAt:m,datePreset:he.preset,dateRange:he.range,entityPage:ge,dashboardTitle:_e.title,repositoryName:_e.repositoryName,loading:ve,locale:i,currency:f,factualCostFact:ye,factualCostPeriods:be,onLoadingChange:xe,resolveRunCost:d===null?void 0:e=>Se.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():Ce(t)},onLoadMacroMetrics:()=>{t?.summary.overview_metrics?.macro_metrics===void 0&&Te()},onEntityPageChange:e=>{z===`changes`||z===`decisions`?we(z,e):Ce(z,e)},onEntityFiltersChange:Ee,onBoardFiltersChange:De,onWorkListFiltersChange:Oe,onWorkListPageChange:e=>void B(ke.current,e),onBoardTypeChange:e=>De({...Ae.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void B({...ke.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void dt(e),workListPage:je,statusPage:(e,t)=>Me[ft(e,t)],onLoadStatusPage:(e,t,n)=>void Ne(e,t,n),classificationPage:(e,t)=>Pe[K(e,t)],onLoadClassificationPage:(e,t,n)=>void V(e,t,n),onOpenDocument:(e,t)=>void Fe(e,t),onOpenTask:E,onPriorityChange:async e=>{try{await Ie.saveWorkPriority(e)}catch(e){throw Le(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(R(Re.current,n)){ze(n);return}Be.current=!1,Ve.current?.(),Ve.current=null,He.current?.abort(),He.current=null,Ue.current?.abort(),Ue.current=null,We(),++Ge.current,pt.current+=1;for(let e of q.current.values())e.abort();q.current.clear(),mt.current.clear(),ht.current.clear(),gt.current={},_t({}),vt({}),yt({}),bt({}),xt({}),++H.current,U.current?.abort(),U.current=null,++qe.current,W({offset:0,total:null,loading:!1,error:null}),Je.current=!1,G(null),x(null),St(!0),Xe.current+=1,Ye(!0),Ze(`operations`),ze(n)},onRefresh:()=>D(`choose`),settings:(0,g.jsx)(fe,{costCalculationGuidePath:I,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>$e(!0),onNavigate:Qe,pricingSetupPath:se,projectSetupPath:ce})}),(0,g.jsx)(ie,{closeDocument:et,costLocale:i,documentDetail:tt,helpOpen:nt,loadingArea:p===`cost-monitor`&&d===null?null:b,operations:j,reconciliationResult:rt,refreshDialog:at,showTrace:p===`traceability`,trace:N,traceLink:st,traceLoadingTaskId:P,onCloseHelp:()=>$e(!1),onCloseTrace:()=>ot(null),onDismissReconciliation:()=>it(null),onOpenDocument:(e,t)=>void Fe(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:A,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void ut(e),setTraceLink:e=>lt(e)})]}),r?(0,g.jsx)(ee,{}):null]})}var he=(e,t)=>`${e}:${t}`,ge=(e,t)=>`${e}:${t}`,_e=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],ve=`/zaip-cost-monitor`,ye=`zaip-dashboard-session-token`,be=`zaip-dashboard-locale`,xe=`zaip-dashboard-currency`;function Se(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function Ce(e){return e.replace(/\/+$/,``)===ve?`cost-monitor`:null}function we(){let e=new URL(window.location.href),t=e.searchParams.get(`token`)??window.localStorage.getItem(`zaip-dashboard-session-token`)??window.sessionStorage.getItem(`zaip-dashboard-session-token`)??``;return t&&(window.localStorage.setItem(ye,t),window.sessionStorage.setItem(ye,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var Te=class{token;constructor(e){this.token=e}ready(){return this.get(`/api/v2/ready`)}dashboardIdentity(){return this.get(`/api/v2/dashboard-identity`)}operations(e,t=`detail`,n,r=!1){let a=`${i.operations}?scope=${t}${r?`&fresh=1`:``}`;return this.get(B(a,e),n)}sqliteViewPage(e,t,n={},r){let i=new URLSearchParams({view:e,offset:String(n.offset??0)});return n.limit!==void 0&&i.set(`limit`,String(n.limit)),n.query&&i.set(`query`,n.query),n.status&&i.set(`status`,n.status),n.risk&&i.set(`risk`,n.risk),n.provider&&i.set(`provider`,n.provider),n.model&&i.set(`model`,n.model),n.agent&&i.set(`agent`,n.agent),n.phase&&i.set(`phase`,n.phase),n.origin&&i.set(`origin`,n.origin),n.workType&&i.set(`workType`,n.workType),n.priority&&i.set(`priority`,n.priority),n.kind&&i.set(`kind`,n.kind),this.get(B(`/api/v2/sqlite-views?${i.toString()}`,t),r)}operationsBoard(e,t,n=0,r,a,o=4){let s=new URLSearchParams({scope:`board`,stage:t,offset:String(n),limit:String(o)});return r?.query&&s.set(`query`,r.query),r?.status&&s.set(`status`,r.status),r?.risk&&s.set(`risk`,r.risk),r?.origin&&s.set(`origin`,r.origin),r?.kind&&s.set(`kind`,r.kind),this.get(B(`${i.operations}?${s.toString()}`,e),a)}traceabilityTasks(e=0,t=10){let n=new URLSearchParams({scope:`traceability`,offset:String(e),limit:String(t)});return this.get(`${i.operations}?${n}`)}operationsClassification(e,t,n,r=0,a,o=50){let s=new URLSearchParams({scope:`classification`,kind:t,classification:n,offset:String(r),limit:String(o)});return this.get(B(`${i.operations}?${s.toString()}`,e),a)}operationsEntityPage(e,t,n=0,r,a){let o=z(t,n,r);return this.get(B(`${i.operations}/runs?${o}`,e),a)}operationsLifecyclePage(e,t,n=0,r,a){let o=z(t,n,r);return this.get(B(`${i.operations}/entities?${o}`,e),a)}operationsReadModelPage(e,t,n=0,r=50,a=``,o){let s=new URLSearchParams({kind:t,offset:String(n),limit:String(r)});return a&&s.set(`query`,a),this.get(B(`${i.operations}/read-models?${s.toString()}`,e),o)}costMonitor(e=`BRL`,t,n=`detail`,r,a,o=!1){let s=new URLSearchParams({currency:e,scope:n});o&&s.set(`fresh`,`1`);for(let[e,t]of Object.entries(a??{}))t&&s.set(e,t);return this.get(B(`${i.costMonitor}?${s.toString()}`,t),r)}costMonitorRuns(e=`BRL`,t,n,r=100,a,o){let s=new URLSearchParams({currency:e,scope:`runs`,offset:String(n),limit:String(r)});for(let[e,t]of Object.entries(o??{}))t&&s.set(e,t);return this.get(B(`${i.costMonitor}?${s.toString()}`,t),a)}snapshot(e=`BRL`,t){return this.get(B(`${i.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(B(`${i.reconcileOpenWork}?currency=${e}`,t),De)}refreshProjection(e=`BRL`,t){return this.post(B(`${i.refreshProjection}?currency=${e}`,t),De)}task(e){return this.get(i.task(e))}prd(e){return this.get(i.prd(e))}spec(e){return this.get(i.spec(e))}taskTrace(e,t){return this.get(i.taskTrace(e),t)}pricing(){return this.get(`/api/v2/pricing`)}async savePricing(e){let t=await fetch(`/api/v2/pricing`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok)throw Error(`Pricing update failed with HTTP ${t.status}`);return await t.json()}fxRate(){return this.get(`/api/v2/fx-rate`)}agentCatalog(){return this.get(i.agentCatalog)}agentPortraitUrl(e){return`/api/v2/agent-catalog-assets/${encodeURIComponent(e)}?token=${encodeURIComponent(this.token)}`}projectSettings(){return this.get(i.projectSettings)}projectOverview(){return this.get(`${i.projectSettings}/overview`)}async saveWorkPriority(e){let t=await fetch(i.workPriority,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({item_ids:e})});if(!t.ok)throw Error(`Work priority update failed with HTTP ${t.status}`);return await t.json()}async saveProjectSettings(e){let t=await fetch(i.projectSettings,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Project settings update failed with HTTP ${t.status}`)}return await t.json()}async saveAgentCatalog(e){let t=e.map(({nickname_candidates:e,...t})=>t),n=await fetch(i.agentCatalog,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({agents:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Agent catalog update failed with HTTP ${n.status}`)}return await n.json()}async saveFxRate(e){let t=await fetch(`/api/v2/fx-rate`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({rate:e})});if(!t.ok)throw Error(`FX update failed with HTTP ${t.status}`);return await t.json()}async get(e,t){let n=await Oe(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},Ee,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=Ee){let n=await Oe(e,{method:`POST`,headers:{"x-zaip-session":this.token}},t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}};function z(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 Ee=6e4,De=18e4;async function Oe(e,t,n=Ee,r){let i=new AbortController,a=()=>i.abort();r?.addEventListener(`abort`,a,{once:!0}),r?.aborted&&i.abort();let o=window.setTimeout(()=>i.abort(),n);try{return await fetch(e,{...t,signal:i.signal})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`A leitura demorou mais de ${Math.ceil(n/1e3)} segundos. Tente novamente.`):e}finally{window.clearTimeout(o),r?.removeEventListener(`abort`,a)}}function B(e,t){if(t===void 0)return e;let n=new URL(e,`http://dashboard.local`);return t.from!==null&&n.searchParams.set(`from`,t.from),t.to!==null&&n.searchParams.set(`to`,t.to),`${n.pathname}${n.search}`}function ke(e){return e.projection_refresh_completed}function Ae(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&ke(e)}}var je={"pt-BR":{label:`Áreas do dashboard`,operations:`Operação`,operationsHint:`Trabalho em andamento e priorização`,costs:`Monitor de Custos`,costsHint:`Tempo, tokens e custo`,traceability:`Rastreabilidade`,traceabilityHint:`Ciclo completo em 6 etapas`},"en-US":{label:`Dashboard areas`,operations:`Operations`,operationsHint:`Lifecycle and work in progress`,costs:`Cost Monitor`,costsHint:`Time, tokens, and cost`,traceability:`Traceability`,traceabilityHint:`Complete 6-stage lifecycle`}};function Me({activeView:e,locale:t,onChange:n}){let r=je[t],i=e=>{n(e),window.requestAnimationFrame(()=>{document.querySelector(`.dashboard-global-controls`)?.scrollIntoView({behavior:`smooth`,block:`start`})})};return(0,g.jsxs)(`nav`,{"aria-label":r.label,className:`dashboard-capability-nav`,children:[(0,g.jsxs)(`button`,{"aria-current":e===`cost-monitor`?`page`:void 0,className:e===`cost-monitor`?`is-active`:void 0,onClick:()=>i(`cost-monitor`),type:`button`,children:[(0,g.jsx)(Pe,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.costs}),(0,g.jsx)(`small`,{children:r.costsHint})]})]}),(0,g.jsxs)(`button`,{"aria-current":e===`operations`?`page`:void 0,className:e===`operations`?`is-active`:void 0,onClick:()=>i(`operations`),type:`button`,children:[(0,g.jsx)(Ne,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.operations}),(0,g.jsx)(`small`,{children:r.operationsHint})]})]}),(0,g.jsxs)(`button`,{"aria-current":e===`traceability`?`page`:void 0,className:e===`traceability`?`is-active`:void 0,onClick:()=>i(`traceability`),type:`button`,children:[(0,g.jsx)(V,{}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{children:r.traceability}),(0,g.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function Ne(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-square-kanban`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`rect`,{height:`18`,rx:`2`,width:`18`,x:`3`,y:`3`}),(0,g.jsx)(`path`,{d:`M8 7v7`}),(0,g.jsx)(`path`,{d:`M12 7v4`}),(0,g.jsx)(`path`,{d:`M16 7v9`})]})}function Pe(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-circle-dollar-sign`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,g.jsx)(`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}),(0,g.jsx)(`path`,{d:`M12 18V6`})]})}function V(){return(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-route`,viewBox:`0 0 24 24`,children:[(0,g.jsx)(`circle`,{cx:`6`,cy:`19`,r:`3`}),(0,g.jsx)(`path`,{d:`M9 19h6.5a3.5 3.5 0 0 0 0-7h-7a3.5 3.5 0 0 1 0-7H18`}),(0,g.jsx)(`circle`,{cx:`18`,cy:`5`,r:`3`})]})}function Fe(e){m.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Ie(e,t,n){return(0,g.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,g.jsx)(Me,{activeView:e,locale:t,onChange:n})})}function Le(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function Re(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function ze(e,t,n){let r=t??e;if(r?.currency!==n)return{fact:{state:`unavailable`,knownSum:null,coverage:null},periods:void 0};let i=r.overview.coverage[n===`USD`?`usd`:`brl`],a=n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,o={known:i,total:r.overview.run_count};return{fact:a===null?{state:`unavailable`,knownSum:null,coverage:o}:i<r.overview.run_count?{state:`partial`,knownSum:a,coverage:o}:{state:`complete`,knownSum:a,coverage:o},periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}}var Be={title:`Dashboard Zaip AIOS`,repositoryName:``};function Ve(e,t){let n=typeof t.title==`string`?t.title.trim():``,r=typeof t.repository_name==`string`?t.repository_name.trim():``;return{title:n||e.title,repositoryName:r}}function He(e,t,n,r,i,a,o,s){s(null),e===`costs`?r():e===`traceability`&&t?i(t):e===`operations`&&n!==null?a():o()}function Ue(e,t,n,r,i,a,o,s,c){return le({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function We(e){return async t=>{if(e.setDashboardView(t),window.scrollTo({left:0,top:0}),t===`cost-monitor`?S({costsLoaded:e.costsLoadedRef.current,currency:e.currency,snapshotCurrency:e.costs?.currency})&&(e.costSummaryAbortRef.current===null||e.costSummaryAbortRef.current.signal.aborted)&&e.loadCostSummary():e.costSummaryAbortRef.current?.abort(),t===`traceability`){let t=e.traceTasks;if(t.length===0){let n=e.boardRequestVersionRef.current;if(t=await e.loadMoreTraceTasks(!1,!0),n!==e.boardRequestVersionRef.current)return;e.setTraceTasks(t)}let n=t.toSorted((e,t)=>Date.parse(t.finished_at??t.updated_at)-Date.parse(e.finished_at??e.updated_at)),r=n.find(e=>e.status===`completed`)??n[0];r&&(e.setSelectedTraceTaskId(r.id),e.openTrace(r.id));return}e.setTrace(null),e.setTraceLoadingTaskId(null)}}function Ge(e,t=new Date){return e.preset===`custom`?e:e.preset===`all`?{...e,range:a(`this-month`,t)}:{...e,range:a(e.preset,t)}}function Ke(e=new Date){let t=n(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let r=e.getTime(),i=r+1800*60*1e3;for(;n(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-r>1;){let e=Math.floor((r+i)/2);n(new Date(e).toISOString(),`day`)===t?r=e:i=e}return Math.max(1,i-e.getTime()+25)}function H(e){return typeof e==`number`?e:null}function U(e){return typeof e==`number`?{known_sum:e,unknown:0,complete:!0,coverage_ratio:1}:{known_sum:0,unknown:1,complete:!1,coverage_ratio:0}}function qe(e){return Object.hasOwn(e,`total_duration`)?H(e.total_duration):H(e.cost_monitor_total_duration)}function W(e,t,n){let{filters:r,query:i}=e;return{offset:t,limit:n,...i===void 0||i===``?{}:{query:i},...r.provider?{provider:r.provider}:{},...r.model?{model:r.model}:{},...r.agent?{agent:r.agent}:{},...r.phase?{phase:r.phase}:{},...r.status?{status:r.status}:{},...r.origin?{origin:r.origin}:{},...r.workType?{workType:r.workType}:{},...r.priority?{priority:r.priority}:{},...r.risk?{risk:r.risk}:{}}}function Je(e){let t=qe(e),n=Number(e.duration_unknown??+(t===null)),r=t??H(e.duration_known)??0;return{key:String(e.key??e.period_key??`total`),label:String(e.label??e.key??e.period_key??``),latest_started_at:typeof e.latest_started_at==`string`?e.latest_started_at:``,persona:typeof e.persona==`string`?e.persona:null,job:typeof e.job==`string`?e.job:null,run_count:Number(e.total_run_count??e.invocation_count??0),task_count:H(e.task_count),conversation_count:Number(e.conversation_count??0),prd_count:H(e.prd_count),spec_count:H(e.spec_count),evidence_count:H(e.evidence_count),test_count:H(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:H(e.total_tokens),estimated_usd:H(e.total_cost_usd),estimated_brl:H(e.total_cost_brl),duration_ms:t,duration:{known_sum:r,unknown:n,complete:n===0,coverage_ratio:+(n===0)},coverage:{events:0,tokens:0,usd:0,brl:0}}}async function G(e,t){let{from:n,limit:r,offset:i,signal:a,to:o,view:s}=t,c=n===void 0||o===void 0?void 0:{from:n,to:o};if(s===`daily`){let n=await e.sqliteViewPage(`cost_monitor_daily`,c,W(t,i,r),a);return{offset:n.offset,limit:n.limit,total_count:n.total_count,has_more:n.has_more,rows:n.rows.map(Je),...n.period_averages===void 0?{}:{period_averages:n.period_averages},...n.totals===void 0?{}:{totals:Je(n.totals)}}}let l={monthly:`cost_monitor_monthly`,annual:`cost_monitor_annual`,agents:`cost_monitor_zaip_agents`,models:`cost_monitor_models`,providers:`cost_monitor_providers`}[s],u=await e.sqliteViewPage(l,c,W(t,i,r),a);return{offset:u.offset,limit:u.limit,total_count:u.total_count,has_more:u.has_more,rows:u.rows.map(Je),...u.period_averages===void 0?{}:{period_averages:u.period_averages},...u.totals===void 0?{}:{totals:Je(u.totals)}}}async function Ye(e,t){let{filters:n,from:r,limit:i=10,offset:a,signal:o,to:s}=t,c=await e.sqliteViewPage(`cost_monitor_agent_invocations`,r===void 0||s===void 0?void 0:{from:r,to:s},{offset:a,limit:i,...n?.query?{query:n.query}:{},...n?.provider?{provider:n.provider}:{},...n?.model?{model:n.model}:{},...n?.agent?{agent:n.agent}:{},...n?.phase?{phase:n.phase}:{},...n?.status?{status:n.status}:{},...n?.priority?{priority:n.priority}:{},...n?.risk?{risk:n.risk}:{},...n?.origin?{origin:n.origin}:{},...n?.workType?{workType:n.workType}:{}},o);return{page_only:!0,runs:c.rows.map(Xe),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function Xe(e){let t=(e,t)=>typeof e==`string`?e:t,n=e=>typeof e==`number`?e:null,r=t(e.agent_invocation_id,`unavailable`),i=typeof e.task_id==`string`?e.task_id:null,a=typeof e.spec_id==`string`?e.spec_id:null,o=typeof e.prd_id==`string`?e.prd_id:null,s=t(e.phase,`execution`),c=e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`estimated`||e.duration_provenance===`legacy_inferred`?e.duration_provenance:`unavailable`,l=Object.hasOwn(e,`calculated_cost_usd`)?n(e.calculated_cost_usd):n(e.cost_usd),u=n(e.current_fx_rate)??n(e.fx_rate),d=n(e.recorded_cost_usd)??n(e.recorded_usd),f=Object.hasOwn(e,`recorded_fx_rate`)?n(e.recorded_fx_rate):n(e.fx_rate),p=n(e.recorded_brl)??(!Object.hasOwn(e,`recorded_brl`)&&d!==null?n(e.cost_brl):null),m=l!==null&&u!==null?Math.round(l*u*1e6)/1e6:null;return{run_id:r,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:t(e.run_id,r),task_id:i,task_title:t(e.task_title,i??`Tarefa avulsa`),task_status:t(e.task_status,`unavailable`),priority:t(e.priority,`unavailable`),risk:t(e.risk,`unavailable`),spec_id:a,prd_id:o,change_id:typeof e.change_id==`string`?e.change_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_role:e.invocation_kind===`subagent`?`subagent`:`orchestrator`,run_kind:e.run_kind===`subrun`?`subrun`:`run`,run_purpose:`execution`,requires_finalizer:!1,client:t(e.client,`unavailable`),agent:t(e.zaip_agent,`unavailable`),agent_name:t(e.zaip_agent,`unavailable`),provider:typeof e.provider==`string`?e.provider:null,model:t(e.model,`unavailable`),requested_model:t(e.requested_model,`unavailable`),reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,effective_reasoning_effort:typeof e.effective_reasoning_effort==`string`?e.effective_reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,call_count:n(e.llm_call_count),status:t(e.status,`completed`),phase:s,origin:o===null?a===null?i===null?`conversation`:`task`:`spec`:`prd`,work_type:e.work_type===`rework`?`rework`:`new`,started_at:t(e.occurred_at,``),finished_at:typeof e.finished_at==`string`?e.finished_at:null,duration_ms:n(e.duration_ms),duration_provenance:c,estimation_basis:typeof e.estimation_basis==`string`?e.estimation_basis:null,source_started_at:typeof e.source_started_at==`string`?e.source_started_at:null,source_finished_at:typeof e.source_finished_at==`string`?e.source_finished_at:null,capture_lag_ms:n(e.capture_lag_ms),event_count:n(e.source_event_count),input_tokens:n(e.input_tokens),cached_input_tokens:n(e.cached_input_tokens),output_tokens:n(e.output_tokens),reasoning_tokens:n(e.reasoning_tokens),total_tokens:n(e.total_tokens),uncached_input_tokens:n(e.uncached_input_tokens),visible_output_tokens:n(e.visible_output_tokens),input_rate_usd_per_million:n(e.input_rate_usd_per_million),cached_input_rate_usd_per_million:n(e.cached_input_rate_usd_per_million),output_rate_usd_per_million:n(e.output_rate_usd_per_million),reasoning_rate_usd_per_million:n(e.reasoning_rate_usd_per_million),context_input_multiplier:n(e.context_input_multiplier),context_output_multiplier:n(e.context_output_multiplier),speed_cost_multiplier:n(e.speed_cost_multiplier),standard_cost_usd:n(e.standard_cost_usd),speed_uplift_usd:n(e.speed_uplift_usd),input_cost_usd:n(e.input_cost_usd),cached_input_cost_usd:n(e.cached_input_cost_usd),output_cost_usd:n(e.output_cost_usd),reasoning_cost_usd:n(e.reasoning_cost_usd),fx_rate:u,estimated_usd:l,estimated_brl:m,recorded_usd:d,recorded_brl:p,recorded_fx_rate:f,coverage:{events:0,tokens:0,usd:0,brl:0},artifact_path:`.agents/records/runs/${r}`}}function Ze(e,t){let n=t.totals,r=e=>U(n?.[e]);return{data_source:`lifecycle_daily_read_models`,snapshot_id:null,source_latest_at:null,kind:e,offset:t.offset,limit:t.limit,total:t.total_count,has_more:t.has_more,next_cursor:null,subtotal:{entity_count:typeof n?.entity_count==`number`?n.entity_count:t.total_count,run_count:r(`invocation_count`),metrics:{duration:r(`total_duration`),total_tokens:r(`total_tokens`),cost_brl:r(`total_cost_brl`),cost_usd:r(`total_cost_usd`)}},rows:t.rows.map(t=>({id:String(t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??t.id??`unavailable`),title:String(t.title??t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??`Unavailable`),kind:e===`tasks`?`task`:e===`specs`?`spec`:e===`prds`?`prd`:e===`executions`?`execution`:`conversation`,status:typeof t.status==`string`?t.status:null,risk:typeof t.risk==`string`?t.risk:null,occurred_at:typeof t.occurred_at==`string`?t.occurred_at:typeof t.started_at==`string`?t.started_at:typeof t.last_day==`string`?`${t.last_day}T12:00:00.000Z`:``,parent_id:null,run_count:Number(t.invocation_count??0),cost_currency:`BRL`,metrics:{duration:U(t.total_duration),total_tokens:U(t.total_tokens),cost:U(t.total_cost_brl)}}))}}function Qe(e){return{loadCostDetail:(0,m.useCallback)(async()=>{throw Error(`SQLite Cost Monitor loads the selected paginated view; full detail is disabled.`)},[]),loadCostReadModelPage:(0,m.useCallback)(async({filters:t,from:n,kind:r,limit:i,offset:a,query:o,signal:s,to:c})=>{let l={tasks:`cost_monitor_tasks`,specs:`cost_monitor_specs`,prds:`cost_monitor_prds`,executions:`cost_monitor_executions`,conversations:`cost_monitor_conversations`}[r];return Ze(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...t.query||o?{query:t.query||o}:{},...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.agent?{agent:t.agent}:{},...t.phase?{phase:t.phase}:{},...t.status?{status:t.status}:{},...t.origin?{origin:t.origin}:{},...t.workType?{workType:t.workType}:{},...t.priority?{priority:t.priority}:{},...t.risk?{risk:t.risk}:{}},s))},[e]),loadCostRunPage:(0,m.useCallback)(t=>Ye(e,t),[e]),loadCostGroupPage:(0,m.useCallback)(t=>G(e,t),[e])}}function $e(e,t){return!1}function et(e,t=window,n=0){let r=!1,i=!1,a=new AbortController,o=t.setTimeout(()=>{r||i||(i=!0,e(a.signal))},n);return()=>{r||(r=!0,a.abort(),t.clearTimeout(o))}}var tt=2e3,nt=5e3,rt=1e4,it=3e4,at=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function ot(e,t){return e&&t<90}function st(e,t){return e===`visible`?nt:t>0?it:rt}function ct(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function lt(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function ut({observedRevision:e,pendingRevision:t,requestedRevision:n,succeeded:r}){return r?{observedRevision:n,pendingRevision:t===n?null:t}:{observedRevision:e,pendingRevision:t}}function dt({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function ft({api:e,costLocale:t,currency:n,dashboardView:r,loadOperationsDetails:i,operations:a,operationsDetailAbortRef:o,operationsDetailCancelRef:s,operationsPageAbortRef:c,pathname:l,pricing:u,refresh:d,refreshVersion:f,snapshotUpdating:p,setSnapshotUpdating:h,setError:g,setFxRate:_,setPathname:v,setPricing:y}){let b=(0,m.useRef)(!1),x=(0,m.useRef)(0),S=(0,m.useRef)(null),C=(0,m.useRef)(!1),w=(0,m.useRef)(null);(0,m.useEffect)(()=>(d(),()=>{s.current?.(),s.current=null,o.current?.abort(),o.current=null,c.current?.abort(),c.current=null,++f.current}),[o,s,c,d,f]),(0,m.useEffect)(()=>{let e=()=>{let e=Date.now();dt({inFlight:b.current,lastRefreshAt:x.current,now:e,visibilityState:document.visibilityState})&&(x.current=e,b.current=!0,d(!1,!1,!0).finally(()=>{b.current=!1}))};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[d]),(0,m.useEffect)(()=>{if(!p)return;let t=!1,n=0,r=null,i=async()=>{if(!(t||!ot(!0,n))){n+=1;try{let n=await e.ready();if(t)return;if(n.snapshot_state===`current`){h(!1),await d(!1,!1,!1,!0);return}}catch{}if(!t){if(ot(!0,n)){r=window.setTimeout(()=>void i(),tt);return}h(!1),g(at)}}};return i(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,g,h,p]),(0,m.useEffect)(()=>{let t=!1,n=0,r=null,i=()=>{if(t||C.current)return;let e=w.current;e!==null&&(C.current=!0,d(!1,!1,!1,!0).then(t=>{t&&h(!1);let n=ut({observedRevision:S.current,pendingRevision:w.current,requestedRevision:e,succeeded:t});S.current=n.observedRevision,w.current=n.pendingRevision}).finally(()=>{C.current=!1,w.current!==e&&i()}))},a=async()=>{try{let r=await e.ready();if(t)return;n=0;let a=S.current;lt(r.snapshot_state,r.snapshot_revision)&&(a===null&&(S.current=r.snapshot_revision),ct(a,r.snapshot_revision)&&(w.current=r.snapshot_revision,i()))}catch{n+=1}t||(r=window.setTimeout(()=>void a(),st(document.visibilityState,n)))};return a(),()=>{t=!0,r!==null&&window.clearTimeout(r)}},[e,d,h]),(0,m.useEffect)(()=>{if(!$e(r,a?.summary.overview_metrics?.partial===!0))return;let e=et(async e=>{await i(e)});return s.current=e,()=>{s.current===e&&(s.current=null),e()}},[r,i,a?.summary.overview_metrics?.partial,s]),(0,m.useEffect)(()=>window.localStorage.setItem(be,t),[t]),(0,m.useEffect)(()=>window.localStorage.setItem(xe,n),[n]),(0,m.useEffect)(()=>{[`/`,`/setup-pricing`,`/setup-project`].includes(window.location.pathname)||(window.history.replaceState(null,``,`/${window.location.search}${window.location.hash}`),v(`/`))},[v]),(0,m.useEffect)(()=>{let e=()=>v(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,m.useEffect)(()=>{l!==`/setup-pricing`||u!==null||Promise.all([e.pricing(),e.fxRate()]).then(([e,t])=>{y(e),_(t)}).catch(e=>g(String(e)))},[e,l,u,g,_,y])}var K={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}};function pt(e,t,n){let r=e=>e===`intake`||e===`orchestration`||e===`execution`||e===`review`||e===`audit`||e===`finalization`?e:`execution`,i=n.rows.map(e=>({id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status===`running`||e.status===`failed`||e.status===`cancelled`?e.status:`completed`,phase:e.phase??`execution`,entrypoint:e.conversation_id===null?`task`:`conversation`,work_type:`new`,run_role:e.run_kind===`subrun`?`subagent`:`orchestrator`,run_kind:e.run_kind??`run`,run_purpose:r(e.run_purpose),requires_finalizer:!1,parent_run_id:e.parent_run_id,client:e.client??`unknown`,agent:e.agent??`unknown`,agent_name:e.agent??`unknown`,agent_persona:e.agent_persona??null,agent_job:e.agent_job??null,provider:e.provider??null,model:e.model??`unknown`,reasoning_effort:e.reasoning_effort??null,effective_model:e.model??null,effective_reasoning_effort:e.reasoning_effort??null,effective_config_mixed:e.pricing_mixed??!1,service_tier:e.service_tier??null,call_count:e.llm_call_count??null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:null,prd_id:null,change_id:null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms===void 0?e.duration_ms:e.source_duration_ms,duration_provenance:e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`legacy_inferred`||e.duration_provenance===`estimated`?e.duration_provenance:`unavailable`,llm_call_count:e.llm_call_count??null,input_tokens:e.input_tokens??null,cached_input_tokens:e.cached_input_tokens??null,uncached_input_tokens:e.uncached_input_tokens??null,output_tokens:e.output_tokens??null,reasoning_tokens:e.reasoning_tokens??null,visible_output_tokens:e.visible_output_tokens??null,input_rate_usd_per_million:e.input_rate_usd_per_million??null,cached_input_rate_usd_per_million:e.cached_input_rate_usd_per_million??null,output_rate_usd_per_million:e.output_rate_usd_per_million??null,reasoning_rate_usd_per_million:e.reasoning_rate_usd_per_million??null,context_input_multiplier:e.context_input_multiplier??null,context_output_multiplier:e.context_output_multiplier??null,speed_cost_multiplier:e.speed_cost_multiplier??null,pricing_scenario:e.pricing_scenario??null,standard_cost_usd:e.standard_cost_usd??null,speed_uplift_usd:e.speed_uplift_usd??null,input_cost_usd:e.input_cost_usd??null,cached_input_cost_usd:e.cached_input_cost_usd??null,output_cost_usd:e.output_cost_usd??null,reasoning_cost_usd:e.reasoning_cost_usd??null,calculated_cost_usd:e.calculated_cost_usd??null,recorded_cost_usd:e.recorded_cost_usd??null,cost_variance_usd:e.cost_variance_usd??null,cost_usd:e.cost_usd??null,cost_brl:e.currency===`BRL`?e.cost:null,fx_rate:e.fx_rate??null,pricing_segment_count:e.pricing_segment_count??null,pricing_mixed:e.pricing_mixed??!1,pricing_model:e.pricing_model??null,pricing_source:e.pricing_source??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},usage:{conversation:K,planning:K,execution:{...K,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},total:{...K,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},new_work:K,rework:K}}));return{...e,runs:i,executions:t===`executions`||t===`conversations`?n.rows.map((e,n)=>{let r=i[n],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 q(e){if(typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function mt({api:e,entityFiltersRef:t,operationsPageAbortRef:n,operationsPageRequestVersionRef:r,operationsPeriod:i,operationsPeriodRef:a,refreshVersion:o,setEntityPage:s,setEntityPageKind:c,setOperations:l}){return{loadOperationsEntityPage:(0,m.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=L(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,L(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t={runs:`operations_agent_invocations`,executions:`operations_executions`,conversations:`operations_conversations`}[u],n=await e.sqliteViewPage(t,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),r={kind:u,offset:n.offset,limit:n.limit,total:n.total_count,aggregation:`canonical_entity`,rows:n.rows.map(e=>({id:String(e.agent_invocation_id??e.execution_id??e.conversation_id??e.id),started_at:String(e.occurred_at??e.started_at??`1970-01-01T00:00:00.000Z`),finished_at:typeof e.finished_at==`string`?e.finished_at:null,task_id:typeof e.task_id==`string`?e.task_id:null,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:typeof e.conversation_id==`string`?e.conversation_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_kind:e.invocation_kind===`delegated`||e.invocation_kind===`subagent`?`subrun`:e.invocation_kind===`orchestrator`?`run`:null,run_purpose:typeof e.purpose==`string`?e.purpose:null,phase:typeof e.phase==`string`?e.phase:null,status:typeof e.status==`string`?e.status:null,agent:typeof e.zaip_agent==`string`?e.zaip_agent:null,agent_persona:typeof e.zaip_agent_persona==`string`?e.zaip_agent_persona:null,agent_job:typeof e.zaip_agent_job==`string`?e.zaip_agent_job:null,client:typeof e.client==`string`?e.client:null,provider:typeof e.provider==`string`?e.provider:null,model:typeof e.model==`string`?e.model:null,reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,duration_ms:typeof e.duration_ms==`number`?e.duration_ms:typeof e.total_duration==`number`?e.total_duration:null,source_duration_ms:typeof e.source_duration_ms==`number`?e.source_duration_ms:null,duration_provenance:typeof e.duration_provenance==`string`?e.duration_provenance:null,llm_call_count:typeof e.llm_call_count==`number`?e.llm_call_count:null,input_tokens:typeof e.input_tokens==`number`?e.input_tokens:null,cached_input_tokens:typeof e.cached_input_tokens==`number`?e.cached_input_tokens:null,uncached_input_tokens:typeof e.uncached_input_tokens==`number`?e.uncached_input_tokens:null,output_tokens:typeof e.output_tokens==`number`?e.output_tokens:null,reasoning_tokens:typeof e.reasoning_tokens==`number`?e.reasoning_tokens:null,visible_output_tokens:typeof e.visible_output_tokens==`number`?e.visible_output_tokens:null,total_tokens:typeof e.total_tokens==`number`?e.total_tokens:null,input_rate_usd_per_million:typeof e.input_rate_usd_per_million==`number`?e.input_rate_usd_per_million:null,cached_input_rate_usd_per_million:typeof e.cached_input_rate_usd_per_million==`number`?e.cached_input_rate_usd_per_million:null,output_rate_usd_per_million:typeof e.output_rate_usd_per_million==`number`?e.output_rate_usd_per_million:null,reasoning_rate_usd_per_million:typeof e.reasoning_rate_usd_per_million==`number`?e.reasoning_rate_usd_per_million:null,context_input_multiplier:typeof e.context_input_multiplier==`number`?e.context_input_multiplier:null,context_output_multiplier:typeof e.context_output_multiplier==`number`?e.context_output_multiplier:null,speed_cost_multiplier:typeof e.speed_cost_multiplier==`number`?e.speed_cost_multiplier:null,pricing_scenario:typeof e.pricing_scenario==`string`?e.pricing_scenario:null,standard_cost_usd:typeof e.standard_cost_usd==`number`?e.standard_cost_usd:null,speed_uplift_usd:typeof e.speed_uplift_usd==`number`?e.speed_uplift_usd:null,input_cost_usd:typeof e.input_cost_usd==`number`?e.input_cost_usd:null,cached_input_cost_usd:typeof e.cached_input_cost_usd==`number`?e.cached_input_cost_usd:null,output_cost_usd:typeof e.output_cost_usd==`number`?e.output_cost_usd:null,reasoning_cost_usd:typeof e.reasoning_cost_usd==`number`?e.reasoning_cost_usd:null,calculated_cost_usd:typeof e.calculated_cost_usd==`number`?e.calculated_cost_usd:null,recorded_cost_usd:typeof e.recorded_cost_usd==`number`?e.recorded_cost_usd:null,cost_variance_usd:typeof e.cost_variance_usd==`number`?e.cost_variance_usd:null,cost_usd:typeof e.cost_usd==`number`?e.cost_usd:null,fx_rate:typeof e.fx_rate==`number`?e.fx_rate:null,pricing_segment_count:typeof e.pricing_segment_count==`number`?e.pricing_segment_count:null,pricing_mixed:e.pricing_mixed===1||e.pricing_mixed===!0,pricing_model:typeof e.audit_pricing_model==`string`?e.audit_pricing_model:typeof e.pricing_model==`string`?e.pricing_model:null,pricing_source:typeof e.audit_pricing_source==`string`?e.audit_pricing_source:typeof e.pricing_source==`string`?e.pricing_source:null,cost:typeof e.total_cost_brl==`number`?e.total_cost_brl:typeof e.cost_brl==`number`?e.cost_brl:null,currency:`BRL`}))};if(!_())return;l(e=>e===null?e:pt(e,u,r)),s({offset:r.offset,total:r.total,loading:!1,error:null,aggregation:r.aggregation})}catch(e){if(!_()||E(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l]),loadOperationsLifecyclePage:(0,m.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=L(i),_=()=>O(m,r.current,p.signal)&&T(h,o.current,g,L(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t=await e.sqliteViewPage(u===`changes`?`operations_changes`:`operations_decisions`,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),n=u===`changes`?t.rows.map(e=>{let t=String(e.source_type),n=String(e.source_id);return{id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:null,status:typeof e.status==`string`?e.status:`unclassified`,risk:typeof e.risk==`string`?e.risk:`unclassified`,source:t===`spec`?{type:`spec`,spec_id:n}:t===`prd`?{type:`prd`,prd_id:n,spec_id:null}:{type:`task`,task_id:n},requirement_ids:q(e.requirement_ids_json),acceptance_ids:q(e.acceptance_ids_json),task_ids:q(e.task_ids_json),result:typeof e.result==`string`?e.result:null,artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id)}}):t.rows.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),origin:e.origin===`human`?`human`:`agent`,scope_type:e.scope_type===`execution`?`execution`:`change`,scope_id:String(e.scope_id),artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:`1970-01-01T00:00:00.000Z`})),r={kind:u,offset:t.offset,limit:t.limit,total:t.total_count,rows:n};if(!_())return;l(e=>e===null?e:{...e,...u===`changes`?{changes:r.rows}:{decisions:r.rows}}),s({offset:r.offset,total:r.total,loading:!1,error:null})}catch(e){if(!_()||E(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l])}}function ht({api:e,operations:t,setError:n,setFailedArea:r,setLoadingArea:i}){let[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)([]),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(0),h=(0,m.useRef)(0),g=(0,m.useRef)(null),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(``);async function x(a){let c=++h.current;g.current?.abort();let l=new AbortController;g.current=l,n(null),r(null),o(null),v(a),i(`traceability`),await new Promise(e=>window.requestAnimationFrame(()=>e()));try{let n=await e.taskTrace(a,l.signal);if(h.current!==c)return!1;let r=s.find(e=>e.id===a)??t?.tasks.find(e=>e.id===a);return o({...n,task_title:r?.title||n.task_title||a,task_risk:r?.risk||n.task_risk||null,task_created_at:r?.created_at||n.task_created_at||null,task_progress:n.task_progress??r?.progress??0}),!0}catch(e){return l.signal.aborted||h.current!==c?!1:(n(e instanceof Error?e.message:String(e)),r(`traceability`),!1)}finally{h.current===c&&(g.current===l&&(g.current=null),v(null),i(e=>e===`traceability`?null:e))}}function S(e){let n=t?.changes.find(t=>t.id===e);n!==void 0&&(o(null),f({kind:`change`,row:n}))}function C(e,n){let r=(e===`PRD`?t?.prds:t?.specs)?.find(e=>e.id===n);r!==void 0&&(o(null),f({kind:`macro`,label:e,row:r}))}async function w(n,r){let i=(n===`prd`?t?.prds:t?.specs)?.find(e=>e.id===r);if(!i)return;let a=++p.current,o=n===`prd`?`PRD`:`SPEC`;u({kind:n,label:o,preview:i});try{let t=n===`prd`?await e.prd(r):await e.spec(r);if(p.current!==a)return;u({kind:n,label:o,preview:i,detail:t})}catch(e){if(p.current!==a)return;u({kind:n,label:o,preview:i,error:e instanceof Error?e.message:String(e)})}}function T(){p.current+=1,u(null)}return{closeDocument:T,documentDetail:l,openDocument:w,openTrace:x,openTraceChange:S,openTraceMacro:C,selectedTraceTaskId:y,setSelectedTraceTaskId:b,setTrace:o,setTraceLink:f,setTraceLoadingTaskId:v,setTraceTasks:c,trace:a,traceLink:d,traceLoadingTaskId:_,traceTasks:s}}function gt({cursor:e,page:t,tasks:n}){let r=new Map(n.map(e=>[e.id,e]));for(let e of t.tasks)r.set(e.id,e);let i=e.offset+t.tasks.length;return{tasks:[...r.values()],cursor:t.tasks.length===0||i>=t.total?{offset:0,stageIndex:e.stageIndex+1}:{...e,offset:i}}}function _t(e,t,n){return Math.min(t,e+n)}function vt(e,t,n){let r=(0,m.useRef)(t),i=(0,m.useRef)({offset:0,stageIndex:0}),a=(0,m.useRef)(!1),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{r.current=t},[t]),{loadMoreTraceTasks:(0,m.useCallback)(async(t=!1,o=!1)=>{if(a.current||(o&&(i.current={offset:0,stageIndex:0},r.current=[],n([]),s(!0)),i.current.stageIndex>=1))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=await e.traceabilityTasks(a.offset,10),s=gt({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 yt({api:e,boardAbortControllersRef:t,boardFilterKeyRef:n,boardFiltersRef:r,boardInFlightRef:i,boardInitialPageRef:a,boardLoadedRef:o,boardRequestVersionRef:s,dashboardView:c,operations:l,operationsPeriod:u,operationsPeriodRef:d,overviewStatusInFlightRef:f,quickOverviewMetricsRef:p,setBoardKindTotals:h,setBoardStates:g,setBoardTotals:_,setOperations:v,setOverviewClassificationPages:y,setOverviewStatusPages:b}){let x=(0,m.useCallback)(()=>{s.current+=1;for(let e of t.current.values())e.abort();t.current.clear(),i.current.clear(),a.current.clear(),o.current={},_({}),h({}),g({}),b({}),y({})},[t,i,a,o,s,h,g,_,y,b]),S=(0,m.useCallback)(async n=>{if(l===null||i.current.has(n))return;i.current.add(n),t.current.get(n)?.abort();let a=new AbortController;t.current.set(n,a);let c=s.current,f=L(u);g(e=>({...e,[n]:{loading:!0,error:null}}));let p=o.current[n]??0;try{let t=await e.operationsBoard(f,n,p,r.current,a.signal,10);if(a.signal.aborted||c!==s.current||f.from!==L(d.current).from||f.to!==L(d.current).to)return;v(e=>e===null?e:{...k(e,[t]),summary:e.summary}),_(e=>({...e,[n]:t.total})),h(e=>({...e,[n]:t.totals_by_kind})),o.current={...o.current,[n]:p+t.prds.length+t.specs.length+t.tasks.length}}catch(e){if(a.signal.aborted||c!==s.current||E(e))return;g(t=>({...t,[n]:{loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{c===s.current&&(i.current.delete(n),t.current.get(n)===a&&t.current.delete(n),g(e=>e[n]?.error===null?{...e,[n]:{loading:!1,error:null}}:e))}},[e,t,r,i,o,s,l,u,d,h,g,_,v]),C=(0,m.useCallback)(e=>{let t={...e,kind:e.kind??r.current.kind??``},i=`${t.query}|${t.status}|${t.risk}|${t.origin??``}|${t.kind}`;i!==n.current&&(n.current=i,r.current=t,x(),v(e=>e===null?e:{...e,prds:[],specs:[],tasks:[],changes:[],summary:i===`||||`&&p.current!==void 0?{...e.summary,overview_metrics:p.current}:e.summary}))},[n,r,p,x,v]),w=(0,m.useCallback)(async(t,n,r)=>{let i=he(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=L(u);b(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsBoard(c,t,r,{kind:n===`task`?`all-tasks`:n});if(o!==s.current||c.from!==L(d.current).from||c.to!==L(d.current).to)return;let l=n===`task`?a.tasks:n===`spec`?a.specs:a.prds;b(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||E(e))return;b(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,b]),T=(0,m.useCallback)(async(t,n,r)=>{let i=ge(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=L(u);y(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsClassification(c,t,n,r);if(o!==s.current||c.from!==L(d.current).from||c.to!==L(d.current).to)return;let l=t===`task`?a.tasks:t===`spec`?a.specs:a.prds;y(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||E(e))return;y(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,y]),D=(0,m.useCallback)(t=>{let n={...r.current,...t},i=L(u);return{prepare:async()=>{let t=await Promise.all(_e.map(t=>e.operationsBoard(i,t,0,n))),r=e=>[...e.prds.map(({kind:e,...t})=>({kind:`prd`,...t})),...e.specs.map(({kind:e,...t})=>({kind:`spec`,...t})),...e.tasks.map(e=>({kind:`task`,...e}))];return{totalRows:t.reduce((e,t)=>e+t.total,0),pages:async function*(){for(let a of t){let t=a,o=0;for(;;){let a=r(t);if(a.length===0||(o+=a.length,yield a,o>=t.total))break;t=await e.operationsBoard(i,t.stage,o,n)}}}}}}},[e,r,u]);return(0,m.useEffect)(()=>{if(c!==`operations`||l===null)return;let e=!1,t=s.current,n=()=>!e&&t===s.current,r=async()=>{if(!n())return;let e=_e.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let t=0;t<e.length&&n();t+=3){let r=e.slice(t,t+3);if(!n())return;for(let e of r)a.current.add(e);await Promise.all(r.map(e=>S(e)))}},o=window.setTimeout(()=>void r(),0);return()=>{e=!0,window.clearTimeout(o)}},[i,a,s,c,S,l]),{boardExportSource:D,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function bt(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function xt(e,t,n){return e===`explicit`||t!==n}function St(e,t){return{...e,kind:e.kind??t.kind??``}}var Ct={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function wt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,m.useState)(Ct),a=(0,m.useRef)({query:``,status:``,risk:``}),o=(0,m.useRef)(null),s=(0,m.useRef)(0),c=(0,m.useRef)(null),l=(0,m.useCallback)(async(r,l=0,u=`explicit`)=>{let d=L(t),f=St(r,a.current),p=bt(f,d);if(!xt(u,p,c.current))return;o.current?.abort();let m=new AbortController;o.current=m;let h=++s.current;a.current=f,c.current=p;let g=f.kind||`all`;i(e=>({...e,offset:l,typeFilter:g,loading:!0,error:null}));try{let t=await e.sqliteViewPage(`operations_work_list`,d,{offset:l,limit:10,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{},...f.origin?{origin:f.origin}:{},...g===`all`?{}:{kind:g}},m.signal);if(m.signal.aborted||h!==s.current||d.from!==L(n.current).from||d.to!==L(n.current).to)return;i({offset:t.offset,limit:t.limit,total:t.total_count,hasMore:t.has_more,typeFilter:g,rows:t.rows,loading:!1,error:null})}catch(e){if(m.signal.aborted||h!==s.current)return;c.current===p&&(c.current=null),i(t=>({...t,offset:l,typeFilter:g,loading:!1,error:e instanceof Error?e.message:String(e)}))}finally{o.current===m&&(o.current=null)}},[e,t,n]),u=(0,m.useCallback)(()=>{o.current?.abort(),o.current=null,++s.current,c.current=null,i(Ct)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,m.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}async function*Tt(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 Et({api:e,operationsPeriod:t}){return(0,m.useCallback)((n,r)=>{let i=L(t);if(n===`work-kanban`)return;let a={"work-list":`operations_work_list`,changes:`operations_changes`,decisions:`operations_decisions`,executions:`operations_executions`,runs:`operations_agent_invocations`,conversations:`operations_conversations`,daily:`operations_daily`,monthly:`operations_monthly`,yearly:`operations_annual`}[n];if(a===void 0)return;let o=e=>({offset:e,limit:100,...r.query?{query:r.query}:{},...r.status?{status:r.status}:{},...r.risk?{risk:r.risk}:{},...r.origin?{origin:r.origin}:{},...a===`operations_work_list`&&r.kind?{kind:r.kind}:{}});return{prepare:async()=>{let t=await e.sqliteViewPage(a,i,o(0));return{totalRows:t.total_count,pages:()=>Tt(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var J=1500;function Dt({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function Ot(e,t,n){let[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!e||!t||r){o(!1);return}let n=window.setTimeout(()=>o(!0),J);return()=>window.clearTimeout(n)},[t,r,e]),Dt({snapshotUpdating:e,initialDataPending:t,dismissed:r,delayElapsed:a})?(0,g.jsxs)(`div`,{"aria-live":`polite`,className:`app-notice app-snapshot-status`,role:`status`,children:[(0,g.jsx)(`span`,{children:`Exibindo o último snapshot local validado. Os dados canônicos estão sendo atualizados em segundo plano e estarão atuais na próxima abertura.`}),(0,g.jsx)(`button`,{"aria-label":n===`pt-BR`?`Fechar aviso de atualização do snapshot`:`Dismiss snapshot update notice`,onClick:()=>i(!0),type:`button`,children:`×`})]}):null}function kt(){Fe(we());let[e,t]=(0,m.useState)(!1),n=(0,m.useMemo)(we,[]),r=(0,m.useMemo)(()=>new Te(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=Qe(r),[c,l]=(0,m.useState)(()=>Ce(window.location.pathname)),u=(0,m.useRef)(c);u.current=c;let[d,f]=(0,m.useState)(null),[p,h]=(0,m.useState)({offset:0,total:null,loading:!1,error:null}),[g,_]=(0,m.useState)(`runs`),v=(0,m.useRef)({query:``,status:``,risk:``}),[y,b]=(0,m.useState)({}),[x,O]=(0,m.useState)({}),[k,ee]=(0,m.useState)({}),[te,A]=(0,m.useState)({}),[ne,j]=(0,m.useState)({}),[M,N]=(0,m.useState)(null),[P,re]=(0,m.useState)(null),[ie,ae]=(0,m.useState)(Se),[F,oe]=(0,m.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),se=(0,m.useRef)(F);se.current=F;let ce=(0,m.useCallback)(e=>{ae(e),oe(e===`en-US`?`USD`:`BRL`)},[]),[I,le]=(0,m.useState)(()=>pe),ue=I.preset===`all`?null:I.range.start,de=I.preset===`all`?null:I.range.end,fe=(0,m.useMemo)(()=>({from:ue,to:de}),[ue,de]),R=(0,m.useRef)(I);R.current=I;let me=(0,m.useRef)(null),[_e,ve]=(0,m.useState)(!1),[ye,be]=(0,m.useState)(null),[xe,z]=(0,m.useState)(null),[Ee,De]=(0,m.useState)(window.location.pathname),[Oe,B]=(0,m.useState)(!0),[,ke]=(0,m.useState)(!1),[,je]=(0,m.useState)(!1),[Me,Ne]=(0,m.useState)(!1),[Pe,V]=(0,m.useState)(`operations`),[H,U]=(0,m.useState)(null),[qe,W]=(0,m.useState)(null);(0,m.useEffect)(()=>{r.ready().then(e=>t(e.snapshot_state===`updating`)).catch(()=>{})},[r]);let[Je,G]=(0,m.useState)(null),[Ye,Xe]=(0,m.useState)(null),[Ze,$e]=(0,m.useState)(null),[et,tt]=(0,m.useState)(Be),nt=(0,m.useCallback)(e=>{tt(t=>Ve(t,e))},[]);(0,m.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||nt(t)}).catch(()=>{}),()=>{e=!0}},[r,nt]);let{closeDocument:rt,documentDetail:it,openDocument:at,openTrace:ot,openTraceChange:st,openTraceMacro:ct,selectedTraceTaskId:lt,setSelectedTraceTaskId:ut,setTrace:dt,setTraceLink:K,setTraceLoadingTaskId:pt,setTraceTasks:q,trace:gt,traceLink:_t,traceLoadingTaskId:bt,traceTasks:xt}=ht({api:r,operations:d,setError:G,setFailedArea:U,setLoadingArea:V}),{loadMoreTraceTasks:St,traceTasksHasMore:Ct,traceTasksLoading:Tt}=vt(r,xt,q),J=(0,m.useRef)(0),Dt=(0,m.useRef)(0),kt=(0,m.useRef)(!1),Y=(0,m.useRef)(0),At=(0,m.useRef)(0),X=(0,m.useRef)(null),Z=(0,m.useRef)(!1),Q=(0,m.useRef)(!1),jt=(0,m.useRef)(null),$=(0,m.useRef)(null),Mt=(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}=wt({api:r,operationsPeriod:I,operationsPeriodRef:R}),Jt=(0,m.useRef)(!1),Yt=(0,m.useCallback)(async(e=!0,n=!1,i=!1,a=!1)=>{jt.current?.(),jt.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({}),ee({}),A({}),j({});let o=++J.current,s=Dt.current,c=u.current,l=fe,d=()=>w(o,J.current)&&T(o,J.current,l,L(R.current));e&&(B(!0),V(`operations`)),G(null),U(null);try{if(n){let e=await r.reconcileOpenWork(F,l),n=Ae(e,d());if(Xe(n.reconciliation),n.dismissProgressDialog&&W(null),!n.applySnapshotState)return!1;if(t(e.snapshot_state===`updating`),n.reloadQuickProjection){let e=await r.operations(l,`quick`,void 0,!0);if(!d())return!1;Jt.current=!1,f(e),Ht.current=e.summary.overview_metrics,Q.current=!1,$e(e.summary.latest_token_collected_at??null)}}else if(i){let e;if(e=await r.refreshProjection(F,l),!d())return!1;f(e.operations),Ht.current=e.operations.summary.overview_metrics,Q.current=!0,N(e.costs),Z.current=!0,re(null);let t=e.dashboard;t&&tt(e=>Ve(e,t)),$e(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,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&&(N(t),Z.current=!1,re(null)),$e(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(G(e instanceof Error?e.message:String(e)),U(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&D(s,Dt.current)&&Ne(!1),e&&d()&&(B(!1),V(e=>e===`operations`?null:e))}},[r,F,fe]),Xt=(0,m.useCallback)(async e=>{if(Q.current||kt.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),kt.current=!0,Y.current+=1,V(`costs`),U(null);try{let e=++J.current,t=L(I),i=()=>w(e,J.current)&&T(e,J.current,t,L(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),kt.current=!1,Y.current=Math.max(0,Y.current-1),Y.current===0&&V(e=>e===`costs`?null:e)}},[r,I]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=mt({api:r,entityFiltersRef:v,operationsPageAbortRef:Mt,operationsPageRequestVersionRef:Nt,operationsPeriod:I,operationsPeriodRef:R,refreshVersion:J,setEntityPage:h,setEntityPageKind:_,setOperations:f}),$t=(0,m.useCallback)((e,t)=>{v.current=t,e===`changes`||e===`decisions`?Qt(e,0,t):Zt(e,0,t)},[Zt,Qt]),{boardExportSource:en,loadFilteredBoard:tn,loadMoreBoard:nn,loadOverviewClassificationPage:rn,loadOverviewStatusPage:an,resetBoard:on}=yt({api:r,boardAbortControllersRef: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:ee,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:j,setOverviewStatusPages:A}),sn=Et({api:r,operationsPeriod:I}),cn=async e=>{e&&Xe(null),W(e?`reconciling`:`refreshing`);try{await Yt(!1,e,!e)}finally{W(null)}};(0,m.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{le(e=>{let t=Ge(e);return t!==e&&(me.current=t),t}),t()},Ke())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,m.useEffect)(()=>{me.current===I&&(me.current=null,Yt(!1,!1,!0,!0))},[I,Yt]),ft({api:r,costLocale:ie,currency:F,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:$,operationsDetailCancelRef:jt,operationsPageAbortRef:Mt,pathname:Ee,pricing:ye,refresh:Yt,refreshVersion:J,setSnapshotUpdating:t,setError:G,setFxRate:z,setPathname:De,setPricing:be,snapshotUpdating:e});let ln=Le(De),un=(0,m.useCallback)(async()=>{X.current?.abort();let e=new AbortController;X.current=e;let t=++At.current,n=L(I);Y.current+=1,V(`costs`),G(null),U(null);try{let i=await r.costMonitor(F,n,`summary`,e.signal),a=L(R.current);if(!C({aborted:e.signal.aborted,currentCurrency:se.current,currentPeriod:a,currentRequestVersion:At.current,requestVersion:t,requestedCurrency:F,requestedPeriod:n}))return;N(i),Z.current=!0,re(null)}catch(n){if(e.signal.aborted||t!==At.current)return;G(n instanceof Error?n.message:String(n)),U(`costs`)}finally{Y.current=Math.max(0,Y.current-1),Y.current===0&&V(e=>e===`costs`?null:e),X.current===e&&(X.current=null)}},[r,F,I]);(0,m.useEffect)(()=>{F!==`USD`||M?.currency===F||un()},[M?.currency,F,un]),(0,m.useEffect)(()=>{c!==`cost-monitor`&&I.preset!==`all`||X.current!==null||S({costsLoaded:Z.current,currency:F,snapshotCurrency:M?.currency})&&un()},[M?.currency,F,c,un,I.preset]);let dn=We({setDashboardView:l,costsLoadedRef:Z,currency:F,costs:M,loadCostSummary:un,costSummaryAbortRef:X,traceTasks:xt,boardRequestVersionRef:Vt,loadMoreTraceTasks:St,setTraceTasks:q,setSelectedTraceTaskId:ut,openTrace:ot,setTrace:dt,setTraceLoadingTaskId:pt}),fn=Re(M,P,F),{fact:pn,periods:mn}=ze(M,P,F),hn=()=>He(H,lt,d,un,ot,Xt,Yt,G),gn=Ue(r,ie,xe,ln,Ee,ye,Yt,z,be);return{loadMoreBoard:nn,overviewStatusPageKey:he,overviewClassificationPageKey:ge,boardRequestVersionRef:Vt,boardAbortControllersRef:It,boardInFlightRef:Ft,boardInitialPageRef:Rt,boardLoadedRef:Pt,setBoardTotals:b,setBoardKindTotals:O,setBoardStates:ee,setOverviewStatusPages:A,setOverviewClassificationPages:j,setOperationsLoading:B,operations:d,error:Je,globalLoadingPending:Me||F===`USD`&&M?.currency!==F,costLocale:ie,refresh:async()=>{await Yt()},snapshotNotice:Ot(e,d===null&&Oe,ie),setupRoute:gn,failedArea:H,retryLastLoad:hn,costs:M,currency:F,dashboardView:c,lastUpdatedAt:Ze,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:Pe,setDisplayedCosts:re,setCurrency:oe,setCostSurfaceLoading:je,changeDashboardLocale:ce,loadMoreTraceTasks:St,openTrace:ot,setRefreshDialog:W,setSelectedTraceTaskId:ut,openTraceChange:st,openTraceMacro:ct,selectedTraceTaskId:lt,trace:gt,traceLoadingTaskId:bt,traceTasksHasMore:Ct,traceTasksLoading:Tt,traceTasks:xt,capabilityNavigation:Ie(c,ie,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:k,operationsPeriod:I,entityPage:p,dashboardIdentity:et,operationsLoading:Oe,factualCostFact:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:ke,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:te,loadOverviewStatusPage:an,overviewClassificationPages:ne,loadOverviewClassificationPage:rn,openDocument:at,api:r,setError:G,operationsPeriodRef:R,setOperationsPeriod:le,operationsDetailLoadedRef:Q,operationsDetailCancelRef:jt,operationsDetailAbortRef:$,operationsPageAbortRef:Mt,resetWorkListPage:qt,operationsPageRequestVersionRef:Nt,resetBoard:on,refreshVersion:J,costSummaryAbortRef:X,costSummaryRequestVersion:At,setEntityPage:h,costsLoadedRef:Z,setCosts:N,setPeriodTransitionPending:Ne,periodTransitionVersionRef:Dt,setLoadingArea:V,navigate:ln,setHelpOpen:ve,closeDocument:rt,documentDetail:it,helpOpen:_e,reconciliationResult:Ye,setReconciliationResult:Xe,refreshDialog:qe,setTrace:dt,traceLink:_t,setTraceLoadingTaskId:pt,setTraceLink:K,refreshFromDialog:cn,renderedOperations:d}}async function Y(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 At(){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 Y(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 X({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 Z(){let e=kt(),t=At();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(X,{...t}),t.status?.lifecycle_manifest_state===`initialized`?(0,g.jsx)(me,{model:e}):null]})}var Q=document.getElementById(`root`);if(!Q)throw Error(`Elemento #root não encontrado`);(0,h.createRoot)(Q).render((0,g.jsx)(m.StrictMode,{children:(0,g.jsx)(Z,{})}));export{_t as n,At as t};
|