@orkastery/cli 0.5.3 → 0.6.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/adapters/README.md +18 -0
- package/adapters/claude-code/.claude-plugin/plugin.json +1 -0
- package/adapters/claude-code/README.md +195 -5
- package/adapters/claude-code/agents/ork-check.md +1 -0
- package/adapters/claude-code/agents/ork-go.md +1 -0
- package/adapters/claude-code/agents/ork-goal.md +1 -0
- package/adapters/claude-code/agents/ork-master.md +1 -0
- package/adapters/claude-code/agents/ork-plan.md +1 -0
- package/adapters/claude-code/agents/ork-ship.md +1 -0
- package/adapters/claude-code/hooks/hooks.json +2 -1
- package/adapters/claude-code/hooks/ork-guard.js +15 -1
- package/adapters/claude-code/hooks/ork-resposta.js +91 -0
- package/adapters/claude-code/hooks/ork-sensor.js +18 -2
- package/adapters/claude-code/hooks/quota-signal.js +14 -0
- package/adapters/claude-code/mods/autoridade.json +56 -0
- package/adapters/claude-code/mods/ork-clima/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-clima/hooks/contas.ts +283 -0
- package/adapters/claude-code/mods/ork-clima/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-clima/hooks/previsao.ts +393 -0
- package/adapters/claude-code/mods/ork-clima/hooks/register.ts +205 -0
- package/adapters/claude-code/mods/ork-clima/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-clima/types/index.d.ts +80 -0
- package/adapters/claude-code/mods/ork-freio/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-freio/hooks/carga.ts +160 -0
- package/adapters/claude-code/mods/ork-freio/hooks/conferencia.ts +309 -0
- package/adapters/claude-code/mods/ork-freio/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-freio/hooks/lote.ts +270 -0
- package/adapters/claude-code/mods/ork-freio/hooks/register.ts +285 -0
- package/adapters/claude-code/mods/ork-freio/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-freio/types/index.d.ts +127 -0
- package/adapters/claude-code/mods/ork-mensageiro/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-mensageiro/hooks/caixa.ts +215 -0
- package/adapters/claude-code/mods/ork-mensageiro/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-mensageiro/hooks/painel.tsx +165 -0
- package/adapters/claude-code/mods/ork-mensageiro/hooks/recepcao.ts +256 -0
- package/adapters/claude-code/mods/ork-mensageiro/hooks/register.tsx +481 -0
- package/adapters/claude-code/mods/ork-mensageiro/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-mensageiro/types/index.d.ts +85 -0
- package/adapters/claude-code/mods/ork-mesa/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/cartoes.tsx +246 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/decidir.ts +110 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/fila.ts +253 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/obvia.ts +98 -0
- package/adapters/claude-code/mods/ork-mesa/hooks/register.tsx +493 -0
- package/adapters/claude-code/mods/ork-mesa/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-mesa/types/index.d.ts +131 -0
- package/adapters/claude-code/mods/ork-pista/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-pista/hooks/acoes.ts +71 -0
- package/adapters/claude-code/mods/ork-pista/hooks/ci.ts +121 -0
- package/adapters/claude-code/mods/ork-pista/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-pista/hooks/pista.tsx +356 -0
- package/adapters/claude-code/mods/ork-pista/hooks/register.tsx +439 -0
- package/adapters/claude-code/mods/ork-pista/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-pista/types/index.d.ts +85 -0
- package/adapters/claude-code/mods/ork-ponte/.claude-plugin/plugin.json +13 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/faixa.tsx +57 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/guarda.ts +410 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/mostrado.ts +55 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/nucleo.ts +157 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/papel.ts +42 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/register.ts +331 -0
- package/adapters/claude-code/mods/ork-ponte/hooks/vigia.ts +76 -0
- package/adapters/claude-code/mods/ork-ponte/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-ponte/types/index.d.ts +178 -0
- package/adapters/claude-code/mods/ork-portao/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-portao/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-portao/hooks/lease.ts +201 -0
- package/adapters/claude-code/mods/ork-portao/hooks/plano.ts +304 -0
- package/adapters/claude-code/mods/ork-portao/hooks/register.ts +339 -0
- package/adapters/claude-code/mods/ork-portao/hooks/verify.ts +152 -0
- package/adapters/claude-code/mods/ork-portao/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-portao/types/index.d.ts +60 -0
- package/adapters/claude-code/mods/ork-radar/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-radar/hooks/colisao.ts +420 -0
- package/adapters/claude-code/mods/ork-radar/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-radar/hooks/mapa.tsx +322 -0
- package/adapters/claude-code/mods/ork-radar/hooks/register.tsx +470 -0
- package/adapters/claude-code/mods/ork-radar/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-radar/types/index.d.ts +72 -0
- package/adapters/claude-code/mods/ork-ritual/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-ritual/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-ritual/hooks/nota.ts +88 -0
- package/adapters/claude-code/mods/ork-ritual/hooks/register.tsx +494 -0
- package/adapters/claude-code/mods/ork-ritual/hooks/replay.tsx +271 -0
- package/adapters/claude-code/mods/ork-ritual/hooks/ritual.ts +218 -0
- package/adapters/claude-code/mods/ork-ritual/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-ritual/types/index.d.ts +106 -0
- package/adapters/claude-code/mods/ork-sentinela/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-sentinela/hooks/alertas.ts +85 -0
- package/adapters/claude-code/mods/ork-sentinela/hooks/despacho.ts +156 -0
- package/adapters/claude-code/mods/ork-sentinela/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-sentinela/hooks/register.ts +511 -0
- package/adapters/claude-code/mods/ork-sentinela/hooks/vigia.ts +186 -0
- package/adapters/claude-code/mods/ork-sentinela/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-sentinela/types/index.d.ts +65 -0
- package/adapters/claude-code/mods/ork-torre/.claude-plugin/plugin.json +14 -0
- package/adapters/claude-code/mods/ork-torre/hooks/agenda.ts +60 -0
- package/adapters/claude-code/mods/ork-torre/hooks/detalhe.tsx +236 -0
- package/adapters/claude-code/mods/ork-torre/hooks/frases.ts +42 -0
- package/adapters/claude-code/mods/ork-torre/hooks/hooks.json +3 -0
- package/adapters/claude-code/mods/ork-torre/hooks/painel.tsx +344 -0
- package/adapters/claude-code/mods/ork-torre/hooks/rede.ts +97 -0
- package/adapters/claude-code/mods/ork-torre/hooks/register.tsx +437 -0
- package/adapters/claude-code/mods/ork-torre/orkastery-mod.json +5 -0
- package/adapters/claude-code/mods/ork-torre/types/index.d.ts +108 -0
- package/adapters/codex/skills/ork/SKILL.md +2 -0
- package/adapters/hermes/README.md +64 -1
- package/adapters/hermes/bin/ork-conhecimento-colecoes.sh +14 -0
- package/adapters/hermes/bin/ork-conhecimento-listar.sh +15 -0
- package/adapters/hermes/bin/ork-conhecimento-mostrar.sh +16 -0
- package/adapters/hermes/bin/ork-conhecimento-verificar.sh +15 -0
- package/adapters/hermes/bin/ork-vigia-batida.py +127 -0
- package/adapters/hermes/hermes.plugin.json +4 -0
- package/adapters/hermes/hitl-ingress/__init__.py +101 -8
- package/adapters/hermes/skills/orkastery-devmaster/SKILL.md +3 -3
- package/adapters/openclaw/README.md +83 -10
- package/adapters/openclaw/bin/ork-vigia-batida.js +86 -0
- package/adapters/openclaw/dist/hitl-ingress.js +106 -9
- package/adapters/openclaw/dist/index.js +86 -0
- package/adapters/openclaw/openclaw.plugin.json +34 -4
- package/adapters/openclaw/package.json +2 -2
- package/adapters/openclaw/src/hitl-ingress.ts +103 -9
- package/adapters/openclaw/src/index.ts +94 -0
- package/assets/adapters-en/claude-code/README.md +403 -0
- package/assets/adapters-en/claude-code/agents/ork-check.md +33 -0
- package/assets/adapters-en/claude-code/agents/ork-go.md +33 -0
- package/assets/adapters-en/claude-code/agents/ork-goal.md +34 -0
- package/assets/adapters-en/claude-code/agents/ork-master.md +35 -0
- package/assets/adapters-en/claude-code/agents/ork-plan.md +33 -0
- package/assets/adapters-en/claude-code/agents/ork-ship.md +33 -0
- package/assets/adapters-en/claude-code/commands/check.md +46 -0
- package/assets/adapters-en/claude-code/commands/go.md +46 -0
- package/assets/adapters-en/claude-code/commands/goal.md +55 -0
- package/assets/adapters-en/claude-code/commands/master.md +54 -0
- package/assets/adapters-en/claude-code/commands/onboarding.md +22 -0
- package/assets/adapters-en/claude-code/commands/ork.md +126 -0
- package/assets/adapters-en/claude-code/commands/plan.md +47 -0
- package/assets/adapters-en/claude-code/commands/ship.md +45 -0
- package/assets/adapters-en/codex/skills/ork/SKILL.md +85 -0
- package/assets/adapters-en/hermes/README.md +273 -0
- package/assets/adapters-en/hermes/skills/orkastery-devmaster/SKILL.md +169 -0
- package/assets/docs-en/markdownlint-cli2.jsonc +22 -0
- package/assets/docs-en/padroes/documentacao-de-produto.md +135 -0
- package/assets/docs-en/padroes/roadmap-de-produto.md +100 -0
- package/assets/docs-en/produto/README.md +14 -0
- package/assets/docs-en/produto/_modelo-feature.md +62 -0
- package/assets/docs-en/roadmap/README.md +14 -0
- package/assets/docs-en/roadmap/_modelo-item.md +75 -0
- package/assets/references-en/README.md +25 -0
- package/assets/references-en/code-review-axes.md +82 -0
- package/assets/references-en/definition-of-done.md +74 -0
- package/assets/references-en/performance-checklist.md +53 -0
- package/assets/references-en/security-checklist.md +101 -0
- package/assets/references-en/testing-patterns.md +51 -0
- package/assets/security-scan/defaults/.golangci.yml +2 -0
- package/assets/security-scan/defaults/eslint.config.mjs +11 -0
- package/assets/security-scan/defaults/gitleaks.toml +3 -0
- package/assets/security-scan/defaults/ruff.toml +1 -0
- package/assets/security-scan/tools-agil.json +87 -0
- package/assets/security-scan/tools.json +625 -0
- package/assets/skills-en/core/onboarding/SKILL.md +58 -0
- package/assets/skills-en/core/orkastery-bootstrap/SKILL.md +119 -0
- package/assets/skills-en/core/thread-state/SKILL.md +88 -0
- package/assets/skills-en/governance/decision-triage/SKILL.md +65 -0
- package/assets/skills-en/governance/narrative-guardian/SKILL.md +66 -0
- package/assets/skills-en/governance/roadmap-keeper/SKILL.md +60 -0
- package/assets/skills-en/governance/scope-check-capability-map/SKILL.md +71 -0
- package/assets/skills-en/observability/thread-tracing/SKILL.md +63 -0
- package/assets/skills-en/phases/check-quality/SKILL.md +103 -0
- package/assets/skills-en/phases/go-implementation/SKILL.md +78 -0
- package/assets/skills-en/phases/goal-definition/SKILL.md +69 -0
- package/assets/skills-en/phases/master-metrics/SKILL.md +72 -0
- package/assets/skills-en/phases/plan-specification/SKILL.md +67 -0
- package/assets/skills-en/phases/security-remediation/SKILL.md +70 -0
- package/assets/skills-en/phases/ship-release/SKILL.md +71 -0
- package/assets/skills-en/reviewers/code-reviewer/SKILL.md +61 -0
- package/assets/skills-en/reviewers/security-auditor/SKILL.md +93 -0
- package/assets/skills-en/reviewers/test-engineer/SKILL.md +66 -0
- package/assets/skills-en/reviewers/web-performance-auditor/SKILL.md +63 -0
- package/dist/adapters/claude-bg.js +193 -15
- package/dist/adapters/codex-controller-worker.js +12 -5
- package/dist/adapters/codex-events.js +16 -4
- package/dist/adapters/codex.js +13 -2
- package/dist/agents-md.js +24 -15
- package/dist/atualizar-branch.js +245 -0
- package/dist/auditoria.js +13 -11
- package/dist/auditrun.js +68 -48
- package/dist/autorizacao-duravel.js +327 -0
- package/dist/board.js +98 -43
- package/dist/branch-de-estado.js +39 -9
- package/dist/busca-semantica.js +7 -5
- package/dist/catalogo.js +35 -1
- package/dist/changelog-reconciliacao.js +290 -0
- package/dist/check-agil.js +500 -0
- package/dist/check-modo.js +41 -0
- package/dist/check-paralelo.js +183 -0
- package/dist/ci.js +255 -46
- package/dist/ciclos.js +8 -6
- package/dist/claim-lint.js +12 -8
- package/dist/claims-conferir.js +350 -0
- package/dist/claims.js +13 -10
- package/dist/company-brain-client.js +45 -3
- package/dist/company-brain-journal.js +2 -1
- package/dist/company-brain-migration.js +47 -6
- package/dist/conducao-batida.js +759 -0
- package/dist/conducao-sentinela.js +405 -0
- package/dist/conducao-texto.js +12 -18
- package/dist/conducao.js +206 -59
- package/dist/conhecimento-consulta.js +270 -0
- package/dist/conhecimento.js +514 -0
- package/dist/conta-esgotada.js +127 -0
- package/dist/dado-privado.js +816 -0
- package/dist/decisao-autonoma.js +5 -4
- package/dist/demo.js +14 -12
- package/dist/dependencias-da-worktree.js +25 -0
- package/dist/divida.js +38 -36
- package/dist/docs.js +103 -82
- package/dist/doctor-forja.js +345 -0
- package/dist/doctor-pulse-cron.js +294 -27
- package/dist/doctor-rede.js +18 -17
- package/dist/doctor.js +278 -116
- package/dist/dsn-da-memoria.js +417 -0
- package/dist/entrega-por-mod.js +503 -0
- package/dist/entrega-pr.js +158 -57
- package/dist/escopo-escrita.js +10 -1
- package/dist/esgotamentos.js +13 -11
- package/dist/estado-thread.js +42 -17
- package/dist/evalrunner.js +35 -32
- package/dist/experiencia-instalacao.js +45 -25
- package/dist/fabrica-batida.js +323 -0
- package/dist/fabrica-estado.js +49 -16
- package/dist/fabrica-publicar.js +3 -1
- package/dist/fila-pesada.js +444 -0
- package/dist/fix.js +24 -21
- package/dist/forja/adaptador.js +6 -0
- package/dist/forja/ambiente-de-ci.js +27 -0
- package/dist/forja/api.js +256 -0
- package/dist/forja/cache.js +89 -0
- package/dist/forja/cli.js +60 -0
- package/dist/forja/contrato.js +9 -0
- package/dist/forja/endereco.js +43 -0
- package/dist/forja/estado.js +22 -0
- package/dist/forja/executor.js +73 -0
- package/dist/forja/github/ci.js +95 -0
- package/dist/forja/github/dono-da-rede.js +18 -0
- package/dist/forja/github/metadados.js +15 -0
- package/dist/forja/github/pedidos.js +200 -0
- package/dist/forja/gitlab/ci.js +141 -0
- package/dist/forja/gitlab/consultas.js +59 -0
- package/dist/forja/gitlab/dono-da-rede.js +43 -0
- package/dist/forja/gitlab/metadados.js +15 -0
- package/dist/forja/gitlab/pedidos-abertos.js +158 -0
- package/dist/forja/gitlab/pedidos.js +141 -0
- package/dist/forja/produtor.js +32 -0
- package/dist/forja/registro.js +31 -0
- package/dist/forja/resolver.js +121 -0
- package/dist/forja/texto.js +13 -0
- package/dist/forja/versao.js +71 -0
- package/dist/forja.js +124 -81
- package/dist/gates.js +3 -28
- package/dist/handoff.js +33 -19
- package/dist/hitl-contract.js +46 -43
- package/dist/hitl-curto.js +37 -25
- package/dist/hitl-gates.js +13 -11
- package/dist/hitl-local-receipt.js +53 -0
- package/dist/hitl-local.js +11 -2
- package/dist/hitl-lock.js +5 -11
- package/dist/hitl-public-receipt.js +11 -0
- package/dist/hitl-resumo.js +72 -3
- package/dist/hitl-sessions.js +62 -9
- package/dist/hitl-tempo-parado.js +4 -4
- package/dist/hitl-texto-livre.js +7 -4
- package/dist/hitl.js +63 -64
- package/dist/horario.js +30 -7
- package/dist/hosts.js +155 -134
- package/dist/impedimento.js +108 -14
- package/dist/index.js +1421 -1019
- package/dist/indice-vetorial.js +14 -12
- package/dist/indice.js +7 -1
- package/dist/init.js +54 -49
- package/dist/instabilidade.js +144 -0
- package/dist/integracoes-locais.js +4 -0
- package/dist/intelligence-graph-cli.js +213 -88
- package/dist/intelligence-graph-contexto.js +56 -17
- package/dist/intelligence-graph-contract.js +2 -1
- package/dist/intelligence-graph-extract-md.js +56 -4
- package/dist/intelligence-graph-extract-ts.js +71 -3
- package/dist/intelligence-graph-query.js +96 -34
- package/dist/leases.js +19 -18
- package/dist/ledger-stats.js +17 -16
- package/dist/ledger.js +46 -2
- package/dist/licoes.js +12 -11
- package/dist/liveness.js +6 -3
- package/dist/locale-accounts.js +220 -0
- package/dist/locale-adapter.js +291 -0
- package/dist/locale-ajuda.js +833 -0
- package/dist/locale-audit.js +199 -0
- package/dist/locale-claims.js +213 -0
- package/dist/locale-conducao.js +138 -0
- package/dist/locale-conhecimento.js +181 -0
- package/dist/locale-decisao.js +205 -0
- package/dist/locale-docs.js +230 -0
- package/dist/locale-estado.js +101 -0
- package/dist/locale-forja.js +290 -0
- package/dist/locale-gerados.js +165 -0
- package/dist/locale-grafo.js +129 -0
- package/dist/locale-master.js +182 -0
- package/dist/locale-network.js +524 -0
- package/dist/locale-onboarding.js +92 -0
- package/dist/locale-operacao-restante.js +931 -0
- package/dist/locale-phase.js +151 -0
- package/dist/locale-projetos.js +100 -0
- package/dist/locale-prompts.js +194 -0
- package/dist/locale-pulse.js +349 -0
- package/dist/locale-reservas.js +87 -0
- package/dist/locale-retry.js +524 -0
- package/dist/locale-roadmap.js +102 -0
- package/dist/locale-security-scan.js +69 -0
- package/dist/locale-setup.js +192 -0
- package/dist/locale-ship.js +597 -0
- package/dist/locale-thread.js +421 -0
- package/dist/locale-verify.js +201 -0
- package/dist/locale-worktree.js +246 -0
- package/dist/locale.js +1258 -0
- package/dist/maestro-runtime.js +22 -3
- package/dist/manifest.js +415 -13
- package/dist/maquina-ociosa.js +211 -0
- package/dist/maquina.js +31 -7
- package/dist/master-digest.js +6 -1
- package/dist/master-nota-local.js +200 -0
- package/dist/master-nota.js +14 -8
- package/dist/master.js +139 -65
- package/dist/mcp-artifacts.js +11 -2
- package/dist/mcp-conhecimento.js +52 -0
- package/dist/mcp-experiencia.js +26 -5
- package/dist/mcp-git.js +23 -6
- package/dist/mcp-grafo.js +7 -4
- package/dist/mcp-install.js +73 -8
- package/dist/mcp-noctum.js +101 -0
- package/dist/mcp-server.js +90 -16
- package/dist/mcp-ship-transporte.js +977 -0
- package/dist/mcp-ship.js +71 -25
- package/dist/mcp-transportes.js +17 -0
- package/dist/mcp-verify.js +6 -1
- package/dist/memoria.js +63 -58
- package/dist/modos-migracao.js +8 -6
- package/dist/modos.js +20 -24
- package/dist/network-roadmap.js +90 -51
- package/dist/noctum-aceite.js +789 -0
- package/dist/noctum-arco.js +1418 -0
- package/dist/noctum-capacidade.js +141 -0
- package/dist/noctum-changelog.js +399 -0
- package/dist/noctum-cli.js +482 -0
- package/dist/noctum-coordenacao.js +1225 -0
- package/dist/noctum-entrega.js +1169 -0
- package/dist/noctum-envelope.js +1046 -0
- package/dist/noctum-execucao.js +376 -0
- package/dist/noctum-fechamento.js +405 -0
- package/dist/noctum-fila.js +314 -0
- package/dist/noctum-guarda.js +256 -0
- package/dist/noctum-integracao.js +507 -0
- package/dist/noctum-maquinas.js +383 -0
- package/dist/noctum-medicao.js +450 -0
- package/dist/noctum-modo.js +362 -0
- package/dist/noctum-pergunta-canal.js +96 -0
- package/dist/noctum-pergunta.js +115 -0
- package/dist/noctum-provas.js +838 -0
- package/dist/noctum-reconciliacao.js +591 -0
- package/dist/noctum-registro.js +215 -0
- package/dist/noctum-relatorio.js +827 -0
- package/dist/noctum-resposta.js +207 -0
- package/dist/noctum-sessoes-em-voo.js +93 -0
- package/dist/noctum-supervisao.js +649 -0
- package/dist/noctum-terminal.js +459 -0
- package/dist/noctum-transporte.js +655 -0
- package/dist/noctum-vigia.js +639 -0
- package/dist/ocupacao.js +32 -3
- package/dist/onboarding.js +56 -26
- package/dist/orkmind.js +48 -25
- package/dist/orquestracao.js +44 -47
- package/dist/parado-no-condutor.js +174 -127
- package/dist/phase.js +144 -63
- package/dist/policies.js +37 -4
- package/dist/portfolio.js +4 -2
- package/dist/postura-local.js +235 -0
- package/dist/preflight.js +11 -10
- package/dist/procedencia.js +220 -0
- package/dist/projeto-alvo.js +186 -24
- package/dist/prompts.js +140 -42
- package/dist/prova-minima.js +5 -6
- package/dist/pulse-cadencia.js +5 -4
- package/dist/pulse-consentimento.js +53 -1
- package/dist/pulse-delivery.js +151 -24
- package/dist/pulse-resposta.js +368 -4
- package/dist/pulse.js +188 -22
- package/dist/ratelimit.js +16 -6
- package/dist/recall.js +14 -13
- package/dist/redacao-saida.js +63 -0
- package/dist/rede-adesao.js +13 -8
- package/dist/rede-forja.js +108 -24
- package/dist/rede-status.js +66 -47
- package/dist/rede.js +86 -46
- package/dist/retomada-checkpoint.js +101 -0
- package/dist/retry.js +451 -212
- package/dist/roadmap-reservas.js +45 -28
- package/dist/roadmap-status.js +129 -33
- package/dist/runtime-ambiente.js +5 -0
- package/dist/runtime-context.js +284 -32
- package/dist/runtime-escada.js +423 -0
- package/dist/runtime-profiles.js +103 -46
- package/dist/runtimes.js +2 -1
- package/dist/saida-segura.js +3 -2
- package/dist/security-scan/agil.js +355 -0
- package/dist/security-scan/cli.js +76 -0
- package/dist/security-scan/compare.js +149 -0
- package/dist/security-scan/config.js +93 -0
- package/dist/security-scan/detect.js +97 -0
- package/dist/security-scan/executor.js +188 -0
- package/dist/security-scan/guard.js +180 -0
- package/dist/security-scan/imagem-de-lint.js +96 -0
- package/dist/security-scan/normalize/actionlint.js +12 -0
- package/dist/security-scan/normalize/eslint.js +12 -0
- package/dist/security-scan/normalize/gitleaks.js +13 -0
- package/dist/security-scan/normalize/golangci-lint.js +13 -0
- package/dist/security-scan/normalize/govulncheck.js +36 -0
- package/dist/security-scan/normalize/index.js +25 -0
- package/dist/security-scan/normalize/npm-audit.js +30 -0
- package/dist/security-scan/normalize/osv-scanner.js +32 -0
- package/dist/security-scan/normalize/oxlint.js +51 -0
- package/dist/security-scan/normalize/pip-audit.js +16 -0
- package/dist/security-scan/normalize/ruff.js +12 -0
- package/dist/security-scan/normalize/semgrep.js +20 -0
- package/dist/security-scan/normalize/trivy.js +33 -0
- package/dist/security-scan/normalize/util.js +204 -0
- package/dist/security-scan/normalize/zizmor.js +19 -0
- package/dist/security-scan/report.js +156 -0
- package/dist/security-scan/run.js +448 -0
- package/dist/security-scan/tools.js +62 -0
- package/dist/security-scan/trabalhador.js +74 -0
- package/dist/security-scan/types.js +15 -0
- package/dist/session-events.js +26 -5
- package/dist/session-watcher-claude.js +81 -20
- package/dist/session-watcher.js +340 -42
- package/dist/sessoes-contas.js +10 -1
- package/dist/sessoes-inventario.js +1 -1
- package/dist/sessoes.js +25 -23
- package/dist/setup.js +59 -58
- package/dist/ship-publicar.js +971 -0
- package/dist/ship.js +243 -97
- package/dist/steal.js +77 -0
- package/dist/superficie.js +14 -11
- package/dist/thread-close.js +12 -11
- package/dist/thread.js +274 -100
- package/dist/tokens.js +15 -11
- package/dist/trabalho-thread.js +297 -0
- package/dist/transporte-do-canal.js +189 -0
- package/dist/types.js +12 -1
- package/dist/util.js +13 -3
- package/dist/varredura-acoes.js +507 -0
- package/dist/verify.js +608 -76
- package/dist/vida-da-thread.js +254 -0
- package/dist/worktree-local.js +167 -0
- package/dist/worktree.js +99 -83
- package/dist/yaml.js +27 -8
- package/eval/casos/check-quality.json +77 -0
- package/eval/casos/security-auditor.json +148 -0
- package/eval/casos/security-remediation.json +161 -0
- package/eval/fixtures/security-scan/README.md +8 -0
- package/eval/fixtures/security-scan/go/.github/workflows/ci.yml +12 -0
- package/eval/fixtures/security-scan/go/Dockerfile +4 -0
- package/eval/fixtures/security-scan/go/README.md +4 -0
- package/eval/fixtures/security-scan/go/config.go +4 -0
- package/eval/fixtures/security-scan/go/go.mod +5 -0
- package/eval/fixtures/security-scan/go/go.sum +2 -0
- package/eval/fixtures/security-scan/go/main.go +31 -0
- package/eval/fixtures/security-scan/js/.github/workflows/ci.yml +12 -0
- package/eval/fixtures/security-scan/js/Dockerfile +3 -0
- package/eval/fixtures/security-scan/js/README.md +4 -0
- package/eval/fixtures/security-scan/js/package-lock.json +844 -0
- package/eval/fixtures/security-scan/js/package.json +10 -0
- package/eval/fixtures/security-scan/js/src/config.js +4 -0
- package/eval/fixtures/security-scan/js/src/server.js +17 -0
- package/eval/fixtures/security-scan/js/src/util.ts +4 -0
- package/eval/fixtures/security-scan/js/tsconfig.json +4 -0
- package/eval/fixtures/security-scan/python/.github/workflows/ci.yml +12 -0
- package/eval/fixtures/security-scan/python/Dockerfile +3 -0
- package/eval/fixtures/security-scan/python/README.md +4 -0
- package/eval/fixtures/security-scan/python/app/__init__.py +0 -0
- package/eval/fixtures/security-scan/python/app/config.py +2 -0
- package/eval/fixtures/security-scan/python/app/main.py +19 -0
- package/eval/fixtures/security-scan/python/requirements.txt +1 -0
- package/package.json +9 -4
- package/references/security-checklist.md +3 -3
- package/schemas/code-artifact-graph.v1.schema.json +2 -1
- package/skills/README.md +1 -0
- package/skills/core/orkastery-bootstrap/SKILL.md +2 -2
- package/skills/phases/check-quality/SKILL.md +16 -0
- package/skills/phases/go-implementation/SKILL.md +6 -0
- package/skills/phases/security-remediation/SKILL.md +70 -0
- package/skills/reviewers/security-auditor/SKILL.md +25 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-auditor
|
|
3
|
+
description: "Security auditor for CHECK: goes through security-checklist.md on the diff, the branch history and the thread artifacts, with the hard condition of zero blockers. Never prints the secret it finds."
|
|
4
|
+
bucket: reviewers
|
|
5
|
+
roteia: "ork verify <thread> | references/security-checklist.md"
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Security Auditor
|
|
10
|
+
|
|
11
|
+
## What this skill is
|
|
12
|
+
|
|
13
|
+
A thin router that applies [security-checklist.md](../../../references/security-checklist.md) to the
|
|
14
|
+
thread's scope. The pass condition is hard: **zero security blockers, in any conduction
|
|
15
|
+
mode, including `#Auto`.**
|
|
16
|
+
|
|
17
|
+
## How to route
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git diff <base>...HEAD # a arvore de trabalho
|
|
21
|
+
git log -p <base>..HEAD # o historico atras da branch
|
|
22
|
+
ork phase list <thread> # policies e gates ja registrados
|
|
23
|
+
ork doctor # provider e ambiente da maquina
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Scope and conduct
|
|
27
|
+
|
|
28
|
+
1. **The scope is declared before the findings:** which directories, which history range,
|
|
29
|
+
which artifacts. An audit without a declared scope does not count as evidence.
|
|
30
|
+
2. **Test fixtures and example configs are in scope.** A credential in a test is a leaked
|
|
31
|
+
credential, made worse by the fact that nobody looks there; `SEC 1` includes `.env`, fixtures and examples.
|
|
32
|
+
3. **History is in scope.** A secret committed and then deleted is still leaked; the audit
|
|
33
|
+
reads the range, not only the tree.
|
|
34
|
+
4. **The report does not print credentials.** The finding names the pattern, the file and the line, in redacted
|
|
35
|
+
form. **A leak report that prints the secret is a second leak.**
|
|
36
|
+
5. **Absence is asserted as a result**, with what was examined: "nothing found" without a scope is
|
|
37
|
+
different from "audited and clean", and the difference is written down.
|
|
38
|
+
|
|
39
|
+
## With `verify.security_scan` declared
|
|
40
|
+
|
|
41
|
+
Without `verify.security_scan`, this skill does what it always did: the whole checklist by reading, and the manual pass remains valid. With the key declared, the scan report (`.orkastery/security-scan/<sha>/report.json`, in the main tree) is the evidence for `SEC 1`, `SEC 2` and `SEC 10`, and the triage below applies.
|
|
42
|
+
|
|
43
|
+
1. **Declare the scan scope:** `base`, `head`, the stacks and each tool with its state (`ran`, `failed` or `unavailable`) and the `reason`.
|
|
44
|
+
2. **A tool `unavailable` or `failed` never counts as clean.** Declare it as such; its `SEC` items fall back to manual reading, marked as such. The manual pass is only valid with the scan declared `unavailable`.
|
|
45
|
+
3. **Triage: one verdict per `new` finding of the loop** (`loop`), none without a verdict:
|
|
46
|
+
- **real:** type B correction, with the rule, `arquivo:linha`, the real output **redacted (never the secret value; only the rule, `arquivo:linha` and `fingerprint`)**, the `SEC n` and the reach (`reachable` from govulncheck); the way back is the `security-remediation` skill;
|
|
47
|
+
- **false positive:** type A correction, `acrescentar <fingerprint> ao .ork-security/dismissals.json, motivo <m>`, plus `ork decisao registrar`;
|
|
48
|
+
- **inconclusive:** no correction; the short question goes into the report, the verdict is not PASSOU and the finding stays open until the owner answers through `ork gate request` (the path is in the `check-quality` skill).
|
|
49
|
+
4. **The verdict reaches GO-FIX as a CHECK claim, one per finding.** `ork fix open` derives the GO-FIX spec only from `ork verify`, and verify re-runs the claims: each failed claim becomes a correction carrying its text.
|
|
50
|
+
- real: `ork claims add <thread> <arquivo> --fase CHECK --claim "<veredito>" --verificar "<comando de verify.security_scan>"`; the command fails on HEAD and the correction is born type B (`claims.failed`). The claim fails and passes with the whole scan, not with this finding (the `fingerprint` stays in the text), costs one extra HEAD scan per claim at every verify and goes into the `.ork-ci` bundle with the other claims;
|
|
51
|
+
- false positive: `ork claims add <thread> .ork-security/dismissals.json --fase CHECK --claim "<veredito>"`, without `--verificar`; the claim with no command is born type A (`claims.unverifiable`). A claim the core reads as negative fails with no command and becomes type B without warning: `ehAlegacaoNegativa` in `core/src/claims.ts` looks, without accents and even inside words, for `nenhum`, `nenhuma`, `nunca`, `sempre`, `zero`, `todos`, `todas`, `nao ha`, `nao existe`, `nao resta`, `sem nenhum`, `100%`, `totalmente`, `completamente` (`metodos` contains `todos`). Check the `ork claims add` output: the false positive only holds with the `negativa` line at `nao` and the `estado` line at `nao-verificavel` (pt-BR output; in the `en` locale, the `negative` line at `no` and the `state` line at `unverifiable`); otherwise, `ork claims retirar <thread> <claim> --motivo "<motivo>"` and register it again with neutral wording;
|
|
52
|
+
- the `<veredito>` carries the finding id, the tool, the rule, `arquivo:linha`, the `fingerprint`, the type and the correction, and for a false positive the reason and the `eventId` of `ork decisao registrar`;
|
|
53
|
+
- the owner's answer to an inconclusive finding becomes a claim the same way, registered by whoever conducts or by a new CHECK, before `ork fix open`.
|
|
54
|
+
5. **The auditor does not edit:** neither code nor `.ork-security/dismissals.json`. It returns the verdict, and whoever writes the fix is GO.
|
|
55
|
+
6. **Secret material never goes to the session output.** With a `new` Gitleaks finding, the finding's line and the content of the commit that brought it do not go to the output through any tool: Read, `sed`, `head`, `grep -n`, editor, `git log -p`, `git show`, `cat`, diff. The output goes to the transcript and to the provider, and it is a second leak. **A `secret` finding gets no context reading at all:** not the line, not its neighbours, not the file, because a multi-line secret (a PEM key) gets past any single-line mask. Its verdict uses only the report's `rule`, `arquivo:linha` and `fingerprint`, and comparing the value with another is done by hash (`sha256sum`), printing neither. Context without the finding's line (`awk -v n=<linha> 'NR>=n-5 && NR<=n+5 && NR!=n' <arquivo>`) applies only to the other categories (`sast`, `dependency`, `iac`, `workflow`).
|
|
56
|
+
7. `existing` and `dismissed` go in the report as declared debt, never as a new blocker.
|
|
57
|
+
|
|
58
|
+
## What the core checks for you
|
|
59
|
+
|
|
60
|
+
The `segredo_em_prompt` policy runs at the `phase.dispatch` gate **before the prompt is written to
|
|
61
|
+
disk**: a rejected prompt never comes to exist as a file. The `provider` policy blocks dispatch
|
|
62
|
+
through a paid provider under `subscription-only`, and `push_direto_na_base` blocks a delivery without a thread
|
|
63
|
+
branch. All three reject in any mode.
|
|
64
|
+
|
|
65
|
+
## Racionalizacoes comuns (Common rationalizations)
|
|
66
|
+
|
|
67
|
+
| Excuse | Reality |
|
|
68
|
+
|---|---|
|
|
69
|
+
| "The key is only in the test fixture" | Fixtures are in the scope of `SEC 1`. A credential in a test is a leaked credential, made worse by the fact that nobody looks there. |
|
|
70
|
+
| "I deleted the commit that had the token" | Deleting from the tree does not delete from history. A blocker until the credential is rotated and the rotation verified, not promised. |
|
|
71
|
+
| "I will paste the snippet in the report so the team can see it" | A leak report that prints the secret is a second leak. Name the pattern and the line, redacted. |
|
|
72
|
+
| "This blocker is theoretical, nobody would exploit it" | Zero blockers is a hard condition, not negotiable by a probability estimated by eye. |
|
|
73
|
+
| "The thread is `#Auto`, the audit can be lighter" | The mode loosens the pause, never the verification. The list is the same; what changes is who waits for the verdict. |
|
|
74
|
+
| "Since I found it, I will fix it right here" | The auditor does not edit. An auditor who fixes ends up auditing its own work; the verdict goes to GO and the fix comes back through CHECK. |
|
|
75
|
+
|
|
76
|
+
## Bandeiras vermelhas (Red flags)
|
|
77
|
+
|
|
78
|
+
- A security report with no scope and no history range.
|
|
79
|
+
- A real secret pasted into the report or the ledger.
|
|
80
|
+
- A finding without the `SEC n` it violates.
|
|
81
|
+
- "Nothing found" without saying what was examined.
|
|
82
|
+
- A new dependency without justification in the PLAN.
|
|
83
|
+
- A Gitleaks secret value pasted in the correction, the verdict or the ledger.
|
|
84
|
+
- A `new` loop finding without a verdict, or a `failed` tool counted as clean.
|
|
85
|
+
- The line or commit of a `new` Gitleaks finding in the session output, through any tool (Read, `sed`, `grep -n`, `git log -p`, `git show`, `cat`, diff).
|
|
86
|
+
- File context read for a `secret` finding, even without the finding's line.
|
|
87
|
+
- A verdict on a `new` scan finding only in the report, without the CHECK claim that carries it to `ork fix open`.
|
|
88
|
+
|
|
89
|
+
## Verification before leaving the audit
|
|
90
|
+
|
|
91
|
+
Scope declared, tree and history scanned, thread artifacts read, each finding with a category
|
|
92
|
+
and `SEC n`, no credential printed, and zero blockers for the PASSOU (passed) verdict. See `SEC 15` to
|
|
93
|
+
`SEC 17` and `DoD 9`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-engineer
|
|
3
|
+
description: "Test reviewer for CHECK: applies testing-patterns.md to the thread's suite, confirms that the green suite was earned and not loosened, and reports coverage with a declared source."
|
|
4
|
+
bucket: reviewers
|
|
5
|
+
roteia: "ork verify <thread> | ork verify <thread> --baseline | references/testing-patterns.md"
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Test Engineer
|
|
10
|
+
|
|
11
|
+
## What this skill is
|
|
12
|
+
|
|
13
|
+
A thin router that applies [testing-patterns.md](../../../references/testing-patterns.md) to the
|
|
14
|
+
thread's suite. It does not write the missing test: it shows which one is missing and why, and that becomes a
|
|
15
|
+
GO task. **A green suite must be earned, not declared.**
|
|
16
|
+
|
|
17
|
+
## How to route
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ork verify <thread> --baseline # gravada ANTES do GO
|
|
21
|
+
ork verify <thread> # reexecucao no HEAD real, comparada com a baseline
|
|
22
|
+
git diff <base>...HEAD -- '*test*' # o que aconteceu com os testes no caminho
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Scope and conduct
|
|
26
|
+
|
|
27
|
+
1. **Compare against the baseline.** Without a baseline, a failure cannot tell a regression from
|
|
28
|
+
pre-existing debt, and the report turns into an argument about blame.
|
|
29
|
+
2. **Look for the loosening**, not only the red: a removed test, a test marked to skip,
|
|
30
|
+
an assertion swapped for the value the code produces today. **Adjusting the expected to the observed is the
|
|
31
|
+
most common way to turn a defect into a contract.**
|
|
32
|
+
3. **Require the test that reproduces the defect** in every fix request, and require that it failed
|
|
33
|
+
before the fix.
|
|
34
|
+
4. **Report numbers with their source:** `runtime_reported`, `estimated` or `unavailable`. A gap is
|
|
35
|
+
published as a gap, never as zero.
|
|
36
|
+
|
|
37
|
+
## What the core checks for you
|
|
38
|
+
|
|
39
|
+
`ork verify` re-runs the manifest commands and the claims on the real HEAD and stamps the commit.
|
|
40
|
+
A command that passed in the baseline and fails now comes out as `verify.regression`; what already failed comes out
|
|
41
|
+
as declared debt, with the command name.
|
|
42
|
+
|
|
43
|
+
## Racionalizacoes comuns (Common rationalizations)
|
|
44
|
+
|
|
45
|
+
| Excuse | Reality |
|
|
46
|
+
|---|---|
|
|
47
|
+
| "That test was flaky, I marked it to skip" | Skipping a test is a recorded scope change. Without a record, it is the defect slipping out the back door. |
|
|
48
|
+
| "I adjusted the assertion to the right value" | Right according to whom? If the expected value changed, the reason is in the PLAN. Adjusting the expected to the observed turns a defect into a contract. |
|
|
49
|
+
| "The bug is obvious, the reproduction test is redundant" | A fix whose defect was never reproduced does not prove it fixed anything. |
|
|
50
|
+
| "Coverage is at about 80 percent" | A number without a source does not go in. Without a tool, coverage comes out `unavailable`, with the reason. |
|
|
51
|
+
| "The happy path alone is enough, the rest is unlikely" | A suite that only exercises success measures optimism. The failure path is where the user meets the product. |
|
|
52
|
+
| "I ran it locally and it passed" | A reported pass is not a pass. What counts is the real output of the re-run on HEAD. |
|
|
53
|
+
|
|
54
|
+
## Bandeiras vermelhas (Red flags)
|
|
55
|
+
|
|
56
|
+
- A test removed in the same commit as the fix.
|
|
57
|
+
- A new `skip` without a record.
|
|
58
|
+
- An assertion changed without a written reason.
|
|
59
|
+
- Coverage reported as a round number with no tool on the machine.
|
|
60
|
+
- No baseline recorded before GO.
|
|
61
|
+
|
|
62
|
+
## Verification before leaving the review
|
|
63
|
+
|
|
64
|
+
Baseline in place, suite re-run on the real HEAD, test diff read in search of loosening,
|
|
65
|
+
a reproduction test present in the fixes, and every number with a declared source. See `TEST 1` to
|
|
66
|
+
`TEST 12` and `DoD 7`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-performance-auditor
|
|
3
|
+
description: "Performance auditor for CHECK: a conditional audit that runs when the target has a latency-sensitive surface and, when it does not, is waived by a written contract. Does not assert performance without measurement."
|
|
4
|
+
bucket: reviewers
|
|
5
|
+
roteia: "references/performance-checklist.md | ork verify <thread>"
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Web Performance Auditor
|
|
10
|
+
|
|
11
|
+
## What this skill is
|
|
12
|
+
|
|
13
|
+
A thin router that applies
|
|
14
|
+
[performance-checklist.md](../../../references/performance-checklist.md) to the thread's target. It is
|
|
15
|
+
**conditional and never absent**: when the target has no latency-sensitive surface, the section
|
|
16
|
+
exists and contains the written waiver, with the reason.
|
|
17
|
+
|
|
18
|
+
## How to route
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
ork verify <thread> # a suite, e o tempo real que ela leva
|
|
22
|
+
git diff <base>...HEAD # os lacos e o I/O que o diff introduziu
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Scope and conduct
|
|
26
|
+
|
|
27
|
+
1. **Decide and record applicability.** A written waiver is a result; a missing audit with no
|
|
28
|
+
line at all is a gap.
|
|
29
|
+
2. **Measure before asserting.** Every performance statement carries a number, a unit and how the number
|
|
30
|
+
was obtained. **"It got faster" without a measurement is opinion, and opinion does not pass a gate.**
|
|
31
|
+
3. **Compare on the same machine and under the same conditions**, with enough repetition to separate signal from
|
|
32
|
+
noise. A single run becomes `estimated`, never `runtime_reported`.
|
|
33
|
+
4. **Measure the user's path**, not the convenient microbenchmark.
|
|
34
|
+
5. **Declare the source of every number**, and what was not measured comes out `unavailable` with the reason, never
|
|
35
|
+
as zero.
|
|
36
|
+
|
|
37
|
+
## What the core checks for you
|
|
38
|
+
|
|
39
|
+
The same discipline as the `ork` token gate, which would rather say "not measurable" than invent a
|
|
40
|
+
window occupancy: `runtime_reported`, `estimated`, `informada`, `unavailable`. The source is part
|
|
41
|
+
of the data, not decoration on the report.
|
|
42
|
+
|
|
43
|
+
## Racionalizacoes comuns (Common rationalizations)
|
|
44
|
+
|
|
45
|
+
| Excuse | Reality |
|
|
46
|
+
|---|---|
|
|
47
|
+
| "It got visibly faster" | Without a number, a unit and a method, it is opinion. Opinion does not pass a performance gate. |
|
|
48
|
+
| "I measured on my machine, it came out better than on CI" | Comparing different machines compares machines, not code. Same hardware, same conditions, or no comparison. |
|
|
49
|
+
| "I ran it once and could already see it" | One run becomes `estimated`. Without repetition there is no way to separate gain from noise. |
|
|
50
|
+
| "There is no web interface, so I skip the section" | The section always exists. With no sensitive surface, it contains the waiver and the reason. |
|
|
51
|
+
| "I put zero where I could not measure" | Zero is a data point, and a false one. What was not measured comes out `unavailable` with the reason. |
|
|
52
|
+
|
|
53
|
+
## Bandeiras vermelhas (Red flags)
|
|
54
|
+
|
|
55
|
+
- A CHECK report with no performance section, not even with the waiver.
|
|
56
|
+
- A gain asserted with no number and no method.
|
|
57
|
+
- A number without a declared source.
|
|
58
|
+
- A comparison across different machines or conditions presented as before and after.
|
|
59
|
+
|
|
60
|
+
## Verification before leaving the audit
|
|
61
|
+
|
|
62
|
+
Applicability decided and written down, measurements with method and repetition when there is something to measure, the user's
|
|
63
|
+
path covered, and every number with its source. See `PERF 1` to `PERF 10` and `DoD 9`.
|
|
@@ -42,11 +42,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
42
42
|
};
|
|
43
43
|
})();
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.JANELA_CURTA_MAX_MS = exports.NOME_ADAPTER = void 0;
|
|
45
|
+
exports.DAEMON_DO_CLAUDE = exports.PRAZO_DO_DAEMON_MS = exports.JANELA_CURTA_MAX_MS = exports.MOD_DA_ENTREGA = exports.MOD_DOS_TETOS = exports.MINIMO_DA_API_DE_MODS = exports.NOME_ADAPTER = void 0;
|
|
46
46
|
exports.ambienteDoPerfil = ambienteDoPerfil;
|
|
47
47
|
exports.semContextoDeDespacho = semContextoDeDespacho;
|
|
48
48
|
exports.disponivel = disponivel;
|
|
49
49
|
exports.versao = versao;
|
|
50
|
+
exports.modsParaOClaude = modsParaOClaude;
|
|
51
|
+
exports.agentTeamsDoDespacho = agentTeamsDoDespacho;
|
|
52
|
+
exports.entradaDoDespacho = entradaDoDespacho;
|
|
50
53
|
exports.montarComando = montarComando;
|
|
51
54
|
exports.extrairSessionId = extrairSessionId;
|
|
52
55
|
exports.listarSessoes = listarSessoes;
|
|
@@ -57,6 +60,7 @@ exports.despachar = despachar;
|
|
|
57
60
|
exports.parseRateLimit = parseRateLimit;
|
|
58
61
|
exports.naturezaDoLimite = naturezaDoLimite;
|
|
59
62
|
exports.parseFalhaDeConta = parseFalhaDeConta;
|
|
63
|
+
exports.cotaExpostaDoAuth = cotaExpostaDoAuth;
|
|
60
64
|
exports.conferirAuth = conferirAuth;
|
|
61
65
|
exports.comandoAttach = comandoAttach;
|
|
62
66
|
exports.limparAnsi = limparAnsi;
|
|
@@ -66,6 +70,9 @@ exports.parar = parar;
|
|
|
66
70
|
exports.pararAchada = pararAchada;
|
|
67
71
|
exports.acharSessaoNasContas = acharSessaoNasContas;
|
|
68
72
|
exports.ocupacaoDeContexto = ocupacaoDeContexto;
|
|
73
|
+
exports.lerStatusDoDaemon = lerStatusDoDaemon;
|
|
74
|
+
exports.sondarDaemon = sondarDaemon;
|
|
75
|
+
exports.derrubarDaemon = derrubarDaemon;
|
|
69
76
|
const horario_1 = require("../horario");
|
|
70
77
|
const util_1 = require("../util");
|
|
71
78
|
const runtime_ambiente_1 = require("../runtime-ambiente");
|
|
@@ -73,6 +80,7 @@ const path = __importStar(require("node:path"));
|
|
|
73
80
|
const runtime_context_1 = require("../runtime-context");
|
|
74
81
|
const runtime_profiles_1 = require("../runtime-profiles");
|
|
75
82
|
const mcp_grafo_1 = require("../mcp-grafo");
|
|
83
|
+
const locale_1 = require("../locale");
|
|
76
84
|
function exec(cmd, args, cwd, timeoutMs, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)()) {
|
|
77
85
|
return (0, util_1.exec)(cmd, args, cwd, timeoutMs, ambiente);
|
|
78
86
|
}
|
|
@@ -138,6 +146,78 @@ function versao() {
|
|
|
138
146
|
}
|
|
139
147
|
/** Ferramentas de arquivo negadas no PLAN: o plano sai pelo núcleo, não pelo disco. */
|
|
140
148
|
const ESCRITA_DE_ARQUIVO = ['Edit', 'Write', 'NotebookEdit'];
|
|
149
|
+
/** O contexto do despacho conferido para o host Claude Code (D4 do RM-037: o host errado recusa antes de tudo). */
|
|
150
|
+
function validarDoClaude(contexto, cwd) {
|
|
151
|
+
if (contexto.host !== 'claude-code')
|
|
152
|
+
throw Error('runtime.context.invalid: host Claude esperado');
|
|
153
|
+
return (0, runtime_context_1.validarContextoRuntime)(contexto, cwd);
|
|
154
|
+
}
|
|
155
|
+
/** RM-059 (T0.7, D2): a API de mods saiu no Claude Code 2.1.287; nenhum mod vai a um `claude` mais velho. */
|
|
156
|
+
exports.MINIMO_DA_API_DE_MODS = '2.1.287';
|
|
157
|
+
/** `2.1.296 (Claude Code)` vira `[2, 1, 296]`; texto sem versao vira `null`. */
|
|
158
|
+
function versaoNumerica(texto) {
|
|
159
|
+
const m = /(\d+)\.(\d+)\.(\d+)/.exec(texto ?? '');
|
|
160
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
161
|
+
}
|
|
162
|
+
function atende(versao, minimo) {
|
|
163
|
+
const i = versao.findIndex((parte, j) => parte !== minimo[j]);
|
|
164
|
+
return i < 0 || versao[i] > minimo[i];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* RM-059 (T0.7, D2): os mods de fase que este `claude` carrega. O mod que pede versao mais nova fica de
|
|
168
|
+
* fora e o despacho segue, porque o nucleo nao depende de mod; versao ilegivel nao leva mod nenhum. Mod
|
|
169
|
+
* cuja dependencia ficou de fora (por versao, ou por ser so de papel `dono`) tambem fica: sem ela, ele
|
|
170
|
+
* carregaria pela metade na sessao de fase.
|
|
171
|
+
*/
|
|
172
|
+
function modsParaOClaude(mods, versao) {
|
|
173
|
+
const atual = versaoNumerica(versao);
|
|
174
|
+
if (!atual)
|
|
175
|
+
return [];
|
|
176
|
+
const piso = versaoNumerica(exports.MINIMO_DA_API_DE_MODS);
|
|
177
|
+
let vao = mods.filter((m) => atende(atual, piso) && atende(atual, versaoNumerica(m.claudeCodeMinimo) ?? piso));
|
|
178
|
+
for (;;) {
|
|
179
|
+
const nomes = new Set(vao.map((m) => m.nome));
|
|
180
|
+
const sobram = vao.filter((m) => m.dependencias.every((d) => nomes.has(d)));
|
|
181
|
+
if (sobram.length === vao.length)
|
|
182
|
+
return vao;
|
|
183
|
+
vao = sobram;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** RM-059 (T10.4): o mod que aplica os tetos de agent teams dentro da sessao de fase. */
|
|
187
|
+
exports.MOD_DOS_TETOS = 'ork-portao';
|
|
188
|
+
/**
|
|
189
|
+
* RM-059 (T10.4, D11 da thread ork-rm059portao): o que o despacho acrescenta ao `--settings` para agent teams no
|
|
190
|
+
* piloto, e so quando o contexto validado trouxe os tetos (manifesto ligado, GO no bloco) e o Portao de Tarefas esta
|
|
191
|
+
* entre os mods que vao de fato a sessao: sem ele, ninguem aplicaria os tetos. A sessao de fundo nao tem `tmux`, entao
|
|
192
|
+
* os teammates rodam no mesmo processo (`teammateMode` `in-process`).
|
|
193
|
+
*/
|
|
194
|
+
function agentTeamsDoDespacho(tetos, mods) {
|
|
195
|
+
if (!tetos || !mods.some((m) => m.nome === exports.MOD_DOS_TETOS))
|
|
196
|
+
return null;
|
|
197
|
+
return {
|
|
198
|
+
env: {
|
|
199
|
+
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
|
|
200
|
+
ORK_AGENT_TEAMS_TEAMMATES: String(tetos.teammates),
|
|
201
|
+
ORK_AGENT_TEAMS_CUSTO_USD: String(tetos.custo_usd),
|
|
202
|
+
},
|
|
203
|
+
teammateMode: 'in-process',
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/** RM-059 (fatia F9): o mod que confere, na sessao de fase, a resposta do dono que chega de outra sessao. */
|
|
207
|
+
exports.MOD_DA_ENTREGA = 'ork-mensageiro';
|
|
208
|
+
/**
|
|
209
|
+
* RM-059 (T9.4, D14 da thread ork-rm059mensag): o que o despacho acrescenta ao `--settings` para a sessao de fase
|
|
210
|
+
* receber a resposta do dono pelo Mensageiro de Sessoes. `crossSessionInbound: accept` entrega a mensagem de outra
|
|
211
|
+
* sessao do mesmo usuario sem a paridade de modo, que numa sessao sem pessoa vence o prazo e descarta; por isso so
|
|
212
|
+
* vai com o Mensageiro entre os mods que vao de fato a sessao (sem ele, ninguem confere o que chega) e so na sessao
|
|
213
|
+
* despachada (`ORK_DISPATCH_ID` no env do despacho). Sem um dos dois, o `--settings` sai como antes.
|
|
214
|
+
*/
|
|
215
|
+
function entradaDoDespacho(mods, env) {
|
|
216
|
+
if (!mods.some((m) => m.nome === exports.MOD_DA_ENTREGA))
|
|
217
|
+
return null;
|
|
218
|
+
const despacho = env?.[runtime_ambiente_1.ENV_IDENTIDADE_DE_DESPACHO];
|
|
219
|
+
return typeof despacho === 'string' && despacho.trim() !== '' ? { crossSessionInbound: 'accept' } : null;
|
|
220
|
+
}
|
|
141
221
|
/** Monta a linha de comando exata do despacho (usada tambem pelo `--dry-run`). */
|
|
142
222
|
function montarComando(pedido) {
|
|
143
223
|
const args = ['--bg', pedido.prompt, '--name', pedido.nome];
|
|
@@ -153,13 +233,19 @@ function montarComando(pedido) {
|
|
|
153
233
|
// O `claude --bg` entrega a sessao a um processo reserva do daemon da conta, e o daemon guarda o
|
|
154
234
|
// ambiente de quem o iniciou: pelo ambiente, a sessao nascia com a identidade de outro despacho.
|
|
155
235
|
// Medido em 28/09/2026 (2.1.284): o `env` de `--settings` chega ao Bash da sessao e vence o herdado.
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
236
|
+
const contexto = pedido.contextoRuntime ? validarDoClaude(pedido.contextoRuntime, pedido.cwd) : null;
|
|
237
|
+
// RM-059 (T0.7): cada mod de fase conferido entra com o proprio --plugin-dir, depois do plugin do Orkastery.
|
|
238
|
+
const mods = !contexto || contexto.modsDeFase.length === 0 ? []
|
|
239
|
+
: modsParaOClaude(contexto.modsDeFase, pedido.versaoClaude !== undefined ? pedido.versaoClaude : versao());
|
|
240
|
+
// RM-059 (T10.4): agent teams so no piloto, com os tetos no env e o Portao na sessao; sem eles, o --settings de antes.
|
|
241
|
+
const teams = agentTeamsDoDespacho(contexto?.agentTeams, mods);
|
|
242
|
+
// RM-059 (T9.4): a resposta do dono pelo Mensageiro so na sessao despachada e com ele na sessao.
|
|
243
|
+
const entrada = entradaDoDespacho(mods, pedido.ambienteExtra);
|
|
244
|
+
const doDespacho = { ...(pedido.ambienteExtra ?? {}), ...(teams ? teams.env : {}) };
|
|
245
|
+
if (Object.keys(doDespacho).length) {
|
|
246
|
+
args.push('--settings', JSON.stringify({ env: doDespacho, ...(teams ? { teammateMode: teams.teammateMode } : {}), ...(entrada ?? {}) }));
|
|
247
|
+
}
|
|
248
|
+
if (contexto) {
|
|
163
249
|
const consultas = [...CONSULTAS_MCP, ...(contexto.grafoMcp ? consultasDoGrafoMcp() : [])];
|
|
164
250
|
// Somente o servidor gerado: nao mesclar MCP de outros escopos nesta sessao filha.
|
|
165
251
|
const permissoes = contexto.permissoesFilho === 'worktree'
|
|
@@ -169,7 +255,7 @@ function montarComando(pedido) {
|
|
|
169
255
|
const allow = plano ? [...consultas, 'mcp__orkastery__ork_artifact_write', 'mcp__orkastery__ork_decision_record']
|
|
170
256
|
: permissoes?.allow ?? consultas;
|
|
171
257
|
const deny = [...(plano ? ESCRITA_DE_ARQUIVO : []), ...(permissoes?.deny ?? [])];
|
|
172
|
-
args.push('--plugin-dir', contexto.instalacao, '--strict-mcp-config', '--mcp-config', JSON.stringify({ mcpServers: { orkastery: contexto.servidor } }), '--allowedTools', allow.join(','));
|
|
258
|
+
args.push('--plugin-dir', contexto.instalacao, ...mods.flatMap((m) => ['--plugin-dir', m.dir]), '--strict-mcp-config', '--mcp-config', JSON.stringify({ mcpServers: { orkastery: contexto.servidor } }), '--allowedTools', allow.join(','));
|
|
173
259
|
if (deny.length)
|
|
174
260
|
args.push('--disallowedTools', deny.join(','));
|
|
175
261
|
}
|
|
@@ -203,15 +289,15 @@ function listarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.amb
|
|
|
203
289
|
* falha aqui (o observador e o pulse não concluem nada dele); só o inventário o trata como fonte
|
|
204
290
|
* ausente, com a correção.
|
|
205
291
|
*/
|
|
206
|
-
function consultarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)()) {
|
|
292
|
+
function consultarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)(), prazoMs = 60000) {
|
|
207
293
|
const args = ['agents', '--json'];
|
|
208
294
|
if (todas)
|
|
209
295
|
args.push('--all');
|
|
210
|
-
const r = exec('claude', args, undefined,
|
|
296
|
+
const r = exec('claude', args, undefined, prazoMs, ambiente);
|
|
211
297
|
if (r.error === 'ENOENT')
|
|
212
|
-
return { ok: false, ausente: true, sessoes: [], detalhe:
|
|
298
|
+
return { ok: false, ausente: true, sessoes: [], detalhe: (0, locale_1.textoDoCatalogo)((m) => m.pulse.claudeForaDoPath) };
|
|
213
299
|
if (!r.ok)
|
|
214
|
-
return { ok: false, sessoes: [], detalhe:
|
|
300
|
+
return { ok: false, sessoes: [], detalhe: (0, locale_1.textoDoCatalogo)((m) => m.pulse.claudeAgentsFalhou(r.code)) };
|
|
215
301
|
let dados;
|
|
216
302
|
try {
|
|
217
303
|
const bruto = JSON.parse(r.stdout);
|
|
@@ -601,6 +687,7 @@ exports.JANELA_CURTA_MAX_MS = 15 * 60 * 1000;
|
|
|
601
687
|
const FRASES_DE_ESGOTAMENTO = [
|
|
602
688
|
/\busage_limit_exceeded\b/i,
|
|
603
689
|
/\busage_limit_reached\b/i,
|
|
690
|
+
/seu limite de uso foi atingido/i,
|
|
604
691
|
/\bout of credits\b/i,
|
|
605
692
|
/\binsufficient_quota\b/i,
|
|
606
693
|
/exceeded your current quota/i,
|
|
@@ -684,6 +771,37 @@ function parseFalhaDeConta(saida, agoraMs = Date.now()) {
|
|
|
684
771
|
const ampla = FRASES_AMPLAS_DE_AUTH.find((r) => r.test(texto));
|
|
685
772
|
return ampla ? { motivo: 'runtime.auth-missing', resetEm: null, fonte: 'sem-horario', trecho: trechoDa(texto, ampla) } : null;
|
|
686
773
|
}
|
|
774
|
+
const objeto = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
775
|
+
const numeroFinito = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : null;
|
|
776
|
+
/** Formatos estruturados aceitos quando `auth status --json` traz uso; chaves alheias não viram medida. */
|
|
777
|
+
function cotaExpostaDoAuth(dados) {
|
|
778
|
+
if (!objeto(dados))
|
|
779
|
+
return null;
|
|
780
|
+
const candidato = ['quota', 'usage', 'rateLimit'].map((k) => dados[k]).find(objeto);
|
|
781
|
+
if (!candidato)
|
|
782
|
+
return null;
|
|
783
|
+
let limite = numeroFinito(candidato.limit ?? candidato.total ?? candidato.max);
|
|
784
|
+
let usada = numeroFinito(candidato.used ?? candidato.consumed ?? candidato.current);
|
|
785
|
+
const restanteInformada = numeroFinito(candidato.remaining);
|
|
786
|
+
const percentual = numeroFinito(candidato.percentUsed ?? candidato.utilization);
|
|
787
|
+
let emPercentual = false;
|
|
788
|
+
if (limite === null && percentual !== null && percentual <= 100) {
|
|
789
|
+
limite = 100;
|
|
790
|
+
usada = percentual;
|
|
791
|
+
emPercentual = true;
|
|
792
|
+
}
|
|
793
|
+
if (limite !== null && usada === null && restanteInformada !== null)
|
|
794
|
+
usada = Math.max(0, limite - restanteInformada);
|
|
795
|
+
if (limite === null || usada === null || limite <= 0 || usada > limite)
|
|
796
|
+
return null;
|
|
797
|
+
const unidadeBruta = candidato.unit ?? candidato.unidade;
|
|
798
|
+
// O nome da unidade que o runtime não informa é texto de quem lê: sai do catálogo, não daqui.
|
|
799
|
+
const informada = typeof unidadeBruta === 'string' ? unidadeBruta.replace(/[^a-zA-Z0-9%._-]/g, '').slice(0, 24) : '';
|
|
800
|
+
const unidade = informada || (emPercentual ? '%' : null);
|
|
801
|
+
const resetBruto = candidato.resetsAt ?? candidato.resetAt ?? candidato.resetEm;
|
|
802
|
+
const resetEm = typeof resetBruto === 'string' && Number.isFinite(Date.parse(resetBruto)) ? resetBruto : null;
|
|
803
|
+
return { usada, limite, restante: Math.max(0, limite - usada), unidade, resetEm, fonte: 'runtime' };
|
|
804
|
+
}
|
|
687
805
|
/** Campo textual do `auth status`, sem controle e curto, para o detalhe legivel. */
|
|
688
806
|
const campoDeAuth = (v) => typeof v === 'string' ? v.replace(/[^a-zA-Z0-9_.-]/g, '').slice(0, 32) : '';
|
|
689
807
|
/**
|
|
@@ -695,11 +813,12 @@ const campoDeAuth = (v) => typeof v === 'string' ? v.replace(/[^a-zA-Z0-9_.-]/g,
|
|
|
695
813
|
*/
|
|
696
814
|
function conferirAuth(perfil) {
|
|
697
815
|
let ambiente;
|
|
816
|
+
// RM-061 (F3b, GO-FIX 1): o erro do catalogo fica registrado, e a impressao o remonta.
|
|
698
817
|
try {
|
|
699
818
|
ambiente = ambienteDoPerfil(perfil);
|
|
700
819
|
}
|
|
701
820
|
catch (e) {
|
|
702
|
-
return { ok: false, detalhe: e
|
|
821
|
+
return { ok: false, detalhe: (0, locale_1.textoDoErro)(e) };
|
|
703
822
|
}
|
|
704
823
|
const r = exec('claude', ['auth', 'status', '--json'], undefined, 30000, ambiente);
|
|
705
824
|
// A14: sem codigo de saida (timeout, sinal ou binario ausente) ou sem JSON, a conferencia e inconclusiva.
|
|
@@ -724,7 +843,8 @@ function conferirAuth(perfil) {
|
|
|
724
843
|
...(provedor && provedor !== 'firstParty' ? [`apiProvider ${provedor}`] : [])];
|
|
725
844
|
return { ok: false, pago: true, detalhe: `claude auth status: provider pago (${partes.join(', ')}); so a assinatura claude.ai despacha` };
|
|
726
845
|
}
|
|
727
|
-
|
|
846
|
+
const cota = cotaExpostaDoAuth(dados);
|
|
847
|
+
return { ok: true, detalhe: `claude auth status: loggedIn (${metodo})`, ...(cota ? { cota } : {}) };
|
|
728
848
|
}
|
|
729
849
|
/**
|
|
730
850
|
* Comando de anexar a sessao (precisa de TTY, entao o CLI imprime em vez de executar). RM-037
|
|
@@ -882,3 +1002,61 @@ function ocupacaoDeContexto(chave) {
|
|
|
882
1002
|
void chave;
|
|
883
1003
|
return null;
|
|
884
1004
|
}
|
|
1005
|
+
/** O `status` e o `stop` do daemon nao esperam um daemon travado por minutos. */
|
|
1006
|
+
exports.PRAZO_DO_DAEMON_MS = 20_000;
|
|
1007
|
+
const linhaCurta = (texto) => texto.replace(/\p{Cc}/gu, ' ').replace(/\s+/g, ' ').trim().slice(0, 160);
|
|
1008
|
+
/**
|
|
1009
|
+
* A saida do `claude daemon status` (medida em 12/10/2026 na 2.1.296): `pid:` com o daemon de pe ou `not running`,
|
|
1010
|
+
* e a linha `control.sock: reachable` ou `control.sock: unreachable (...)`. O daemon de pe com o socket que nao
|
|
1011
|
+
* responde e o travado do incidente; sem daemon, o `claude --bg` sobe um sob demanda. Saida fora dessa forma e
|
|
1012
|
+
* `nao-lido`: sem prova, nada e derrubado.
|
|
1013
|
+
*/
|
|
1014
|
+
function lerStatusDoDaemon(saida, codigo) {
|
|
1015
|
+
const texto = String(saida ?? '').replace(/\r/g, '');
|
|
1016
|
+
const sock = /^\s*control\.sock:\s*(.+)$/m.exec(texto)?.[1]?.trim() ?? '';
|
|
1017
|
+
const dePe = /^\s*pid:\s*\d+/m.test(texto);
|
|
1018
|
+
const parado = /^\s*not running\b/im.test(texto);
|
|
1019
|
+
const detalhe = sock ? linhaCurta(`control.sock: ${sock}`) : linhaCurta(texto.split('\n').find((l) => l.trim()) ?? '');
|
|
1020
|
+
if (codigo !== 0 || !sock || dePe === parado) {
|
|
1021
|
+
return { estado: 'nao-lido', detalhe: `claude daemon status sem a forma conhecida (codigo ${codigo ?? '?'})${detalhe ? `: ${detalhe}` : ''}` };
|
|
1022
|
+
}
|
|
1023
|
+
if (/^reachable\b/i.test(sock))
|
|
1024
|
+
return dePe ? { estado: 'responde', detalhe } : { estado: 'nao-lido', detalhe };
|
|
1025
|
+
if (/^unreachable\b/i.test(sock))
|
|
1026
|
+
return { estado: dePe ? 'nao-responde' : 'parado', detalhe };
|
|
1027
|
+
return { estado: 'nao-lido', detalhe };
|
|
1028
|
+
}
|
|
1029
|
+
/** `claude daemon status` com o ambiente do perfil do despacho: a conta certa, o daemon certo. */
|
|
1030
|
+
function sondarDaemon(perfil) {
|
|
1031
|
+
let ambiente;
|
|
1032
|
+
try {
|
|
1033
|
+
ambiente = ambienteDoPerfil(perfil);
|
|
1034
|
+
}
|
|
1035
|
+
catch (e) {
|
|
1036
|
+
return { estado: 'nao-lido', detalhe: linhaCurta(e.message) };
|
|
1037
|
+
}
|
|
1038
|
+
const r = exec('claude', ['daemon', 'status'], undefined, exports.PRAZO_DO_DAEMON_MS, ambiente);
|
|
1039
|
+
if (r.error === 'ENOENT')
|
|
1040
|
+
return { estado: 'nao-lido', detalhe: 'binario `claude` nao encontrado no PATH' };
|
|
1041
|
+
if (r.error || r.signal)
|
|
1042
|
+
return { estado: 'nao-lido', detalhe: `claude daemon status nao terminou em ${exports.PRAZO_DO_DAEMON_MS / 1000} s` };
|
|
1043
|
+
return lerStatusDoDaemon(`${r.stdout}\n${r.stderr}`, r.code);
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* `claude daemon stop --any --keep-workers`: derruba o supervisor transitorio da conta (o que o `claude --bg` subiu
|
|
1047
|
+
* sob demanda) e deixa as sessoes destacadas rodando. O proximo `claude --bg` sobe outro.
|
|
1048
|
+
*/
|
|
1049
|
+
function derrubarDaemon(perfil) {
|
|
1050
|
+
let ambiente;
|
|
1051
|
+
try {
|
|
1052
|
+
ambiente = ambienteDoPerfil(perfil);
|
|
1053
|
+
}
|
|
1054
|
+
catch (e) {
|
|
1055
|
+
return { ok: false, detalhe: linhaCurta(e.message) };
|
|
1056
|
+
}
|
|
1057
|
+
const r = exec('claude', ['daemon', 'stop', '--any', '--keep-workers'], undefined, exports.PRAZO_DO_DAEMON_MS, ambiente);
|
|
1058
|
+
const primeira = linhaCurta(`${r.stdout}\n${r.stderr}`.split('\n').find((l) => l.trim()) ?? '');
|
|
1059
|
+
return { ok: r.ok, detalhe: r.ok ? primeira || 'daemon parado' : `saiu ${r.error ?? r.code}${primeira ? `: ${primeira}` : ''}` };
|
|
1060
|
+
}
|
|
1061
|
+
/** O daemon do claude-bg que a escada usa quando ninguem injeta outro. */
|
|
1062
|
+
exports.DAEMON_DO_CLAUDE = { sondar: sondarDaemon, derrubar: derrubarDaemon };
|
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.interromperTurnoAtivo = interromperTurnoAtivo;
|
|
36
37
|
/** Dono exclusivo do stdin app-server. IPC local autenticado pelo uid/diretório 0700. */
|
|
37
38
|
const fs = __importStar(require("node:fs"));
|
|
38
39
|
const net = __importStar(require("node:net"));
|
|
@@ -42,6 +43,16 @@ const node_crypto_1 = require("node:crypto");
|
|
|
42
43
|
const codex_question_1 = require("./codex-question");
|
|
43
44
|
const runtime_context_1 = require("../runtime-context");
|
|
44
45
|
const codex_controller_1 = require("./codex-controller");
|
|
46
|
+
/** RM-064: interrupção nativa testável sem descobrir PID, sessão ou turno fora do controller vinculado. */
|
|
47
|
+
async function interromperTurnoAtivo(state, sessao, perguntaAtiva, enviar, esperar) {
|
|
48
|
+
const bloqueioDivergente = state.estado === 'blocked' && (!perguntaAtiva || sessao.bloqueio !== state.bloqueio);
|
|
49
|
+
if (!['working', 'blocked'].includes(state.estado) || sessao.estado !== state.estado || !state.turno ||
|
|
50
|
+
sessao.sessionId !== state.sessionId || sessao.instancia !== state.instancia || sessao.cwd !== state.cwd ||
|
|
51
|
+
bloqueioDivergente)
|
|
52
|
+
throw new Error('runtime.unavailable: sessão não está ativa nesta instância');
|
|
53
|
+
await enviar('turn/interrupt', { threadId: state.sessionId, turnId: state.turno });
|
|
54
|
+
await esperar(() => state.estado === 'stopped');
|
|
55
|
+
}
|
|
45
56
|
function gravar(nome, valor) {
|
|
46
57
|
const tmp = `${nome}.${(0, node_crypto_1.randomUUID)()}.tmp`;
|
|
47
58
|
fs.writeFileSync(tmp, JSON.stringify(valor), { flag: 'wx', mode: 0o600 });
|
|
@@ -246,11 +257,7 @@ async function servidor() {
|
|
|
246
257
|
}
|
|
247
258
|
else if (r.operacao === 'parar') {
|
|
248
259
|
const s = r.dados;
|
|
249
|
-
|
|
250
|
-
s.cwd !== state.cwd || s.bloqueio !== state.bloqueio)
|
|
251
|
-
throw new Error('runtime.unavailable: sessão não está bloqueada nesta instância');
|
|
252
|
-
await rpc('turn/interrupt', { threadId: state.sessionId, turnId: state.turno });
|
|
253
|
-
await aguardar(() => state.estado === 'stopped');
|
|
260
|
+
await interromperTurnoAtivo(state, s, !!pergunta, rpc, aguardar);
|
|
254
261
|
resultado = true;
|
|
255
262
|
}
|
|
256
263
|
else
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParserCodex = exports.LIMITE_LINHA_CODEX = void 0;
|
|
3
|
+
exports.ParserCodex = exports.LIMITE_RESPOSTA_CODEX = exports.LIMITE_LINHA_CODEX = void 0;
|
|
4
4
|
exports.falhaDeContaDoErroCodex = falhaDeContaDoErroCodex;
|
|
5
5
|
exports.classificarMensagem = classificarMensagem;
|
|
6
6
|
/** D4/D5: stream e rollout são observações de turno, nunca aprovação de CHECK. */
|
|
@@ -84,6 +84,15 @@ function tokens(v, fonte, escopo) {
|
|
|
84
84
|
output: Number(output), total: Number(total), unidade: 'tokens', escopo, fonte };
|
|
85
85
|
}
|
|
86
86
|
exports.LIMITE_LINHA_CODEX = 1024 * 1024;
|
|
87
|
+
exports.LIMITE_RESPOSTA_CODEX = 256 * 1024;
|
|
88
|
+
function limitarResposta(texto) {
|
|
89
|
+
if (typeof texto !== 'string' || !texto.trim())
|
|
90
|
+
return null;
|
|
91
|
+
const bruto = Buffer.from(texto, 'utf8');
|
|
92
|
+
if (bruto.byteLength <= exports.LIMITE_RESPOSTA_CODEX)
|
|
93
|
+
return texto;
|
|
94
|
+
return bruto.subarray(0, exports.LIMITE_RESPOSTA_CODEX).toString('utf8').replace(/\uFFFD$/, '');
|
|
95
|
+
}
|
|
87
96
|
class ParserCodex {
|
|
88
97
|
pendente = Buffer.alloc(0);
|
|
89
98
|
descartando = false;
|
|
@@ -154,6 +163,7 @@ class ParserCodex {
|
|
|
154
163
|
this.estado.turnId = daFonte ?? `stream-${this.estado.turnos}`;
|
|
155
164
|
this.estado.turnIdOrigem = daFonte === null ? 'gerado' : 'explicito';
|
|
156
165
|
this.estado.mensagem = null;
|
|
166
|
+
this.estado.mensagemTexto = null;
|
|
157
167
|
this.estado.tokens = indisponivel();
|
|
158
168
|
this.eventosValidos++;
|
|
159
169
|
return null;
|
|
@@ -177,6 +187,7 @@ class ParserCodex {
|
|
|
177
187
|
p.type === 'agent_message' ? p.message : undefined);
|
|
178
188
|
if (mensagem !== undefined) {
|
|
179
189
|
this.estado.mensagem = classificarMensagem(mensagem);
|
|
190
|
+
this.estado.mensagemTexto = limitarResposta(mensagem);
|
|
180
191
|
this.eventosValidos++;
|
|
181
192
|
return null;
|
|
182
193
|
}
|
|
@@ -189,8 +200,8 @@ class ParserCodex {
|
|
|
189
200
|
const falhou = p.type === 'turn.failed' || p.type === 'task_failed' || comErro;
|
|
190
201
|
const conta = comErro ? falhaDeContaDoErroCodex(p.error, agoraMs) : null;
|
|
191
202
|
const explicito = motivo(p.motivo ?? p.reason);
|
|
192
|
-
const
|
|
193
|
-
|
|
203
|
+
const textoFinal = limitarResposta(p.last_agent_message) ?? this.estado.mensagemTexto ?? null;
|
|
204
|
+
const mensagemFinal = textoFinal !== null ? classificarMensagem(textoFinal) : this.estado.mensagem ?? sucesso();
|
|
194
205
|
const classificacao = this.estado.invalido ? falha()
|
|
195
206
|
: conta ? { classificacao: 'gate_blocked', motivo: conta.motivo } : explicito ??
|
|
196
207
|
(mensagemFinal.classificacao !== 'fase_concluida' ? mensagemFinal : falhou ? falha() : sucesso());
|
|
@@ -201,7 +212,8 @@ class ParserCodex {
|
|
|
201
212
|
numeroTurno: this.estado.turnos, timestampFonte: e.timestamp ? 'evento' : 'observacao',
|
|
202
213
|
fonte: e.type === 'event_msg' ? `rollout.${p.type}` : `stream.${p.type}`,
|
|
203
214
|
tokens: structuredClone(this.estado.tokens),
|
|
204
|
-
duracaoMs: Number.isFinite(p.duration_ms) && p.duration_ms >= 0 ? p.duration_ms : null
|
|
215
|
+
duracaoMs: Number.isFinite(p.duration_ms) && p.duration_ms >= 0 ? p.duration_ms : null,
|
|
216
|
+
...(textoFinal !== null ? { respostaFinal: textoFinal } : {}) };
|
|
205
217
|
}
|
|
206
218
|
}
|
|
207
219
|
exports.ParserCodex = ParserCodex;
|