pantheon-opencode 1.5.0-beta.9 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/AGENTS.md +14 -63
  2. package/CHANGELOG.md +326 -0
  3. package/README.md +77 -29
  4. package/README.pt-BR.md +5 -6
  5. package/commands/pantheon.md +1 -35
  6. package/package.json +2 -3
  7. package/plugin.json +1 -1
  8. package/pyproject.toml +3 -5
  9. package/scripts/doctor.mjs +260 -5
  10. package/scripts/install/plugin.mjs +9 -12
  11. package/scripts/mcp_persistence_server.py +1 -1
  12. package/scripts/sync-tui.mjs +8 -11
  13. package/src/agents/apollo.md +1 -0
  14. package/src/agents/gaia.md +1 -0
  15. package/src/agents/mnemosyne.md +11 -1
  16. package/src/agents/zeus.md +10 -52
  17. package/src/instructions/memory-protocol.instructions.md +6 -3
  18. package/src/instructions/zeus-anti-stall.instructions.md +2 -4
  19. package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
  20. package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
  21. package/src/mcp/mcp_persistence_server.py +1 -1
  22. package/src/mcp/memory_mcp_server.py +81 -27
  23. package/src/pantheon/background-job-board.ts +4 -4
  24. package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
  25. package/src/pantheon/cost-command.ts +1 -2
  26. package/src/pantheon/delegation-enforce.ts +59 -14
  27. package/src/pantheon/goal-loop.ts +1 -1
  28. package/src/pantheon/goal-store.ts +1 -1
  29. package/src/pantheon/idle-continuation.ts +4 -6
  30. package/src/pantheon/model-command.ts +1 -2
  31. package/src/pantheon/native-task-status.ts +2 -2
  32. package/src/pantheon/presets.d.mts +0 -20
  33. package/src/pantheon/presets.mjs +0 -64
  34. package/src/pantheon/session-guard.ts +2 -2
  35. package/src/pantheon/session-id.ts +30 -0
  36. package/src/pantheon/task-result-guard.ts +2 -3
  37. package/src/pantheon/todo-enforcer.ts +3 -3
  38. package/src/pantheon/tool-context.ts +23 -0
  39. package/src/pantheon/v2-bridge.ts +1 -4
  40. package/src/plugin-v2.ts +8 -21
  41. package/src/plugin.ts +61 -245
  42. package/src/plugins/pantheon-hooks.ts +2 -2
  43. package/src/plugins/tui/dist/tui.d.ts +229 -103
  44. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  45. package/src/plugins/tui/dist/tui.js +495 -333
  46. package/src/plugins/tui/package-lock.json +5 -2
  47. package/src/plugins/tui/package.json +5 -2
  48. package/src/plugins/tui/src/index.tsx +710 -409
  49. package/src/routing.yml +0 -16
  50. package/src/skills/context-compression/SKILL.md +1 -1
  51. package/scripts/generate-preset-docs.mjs +0 -300
  52. package/scripts/generate-prompts.sh +0 -222
  53. package/scripts/hash_verify.py +0 -192
  54. package/scripts/install/component.mjs +0 -24
  55. package/scripts/install/migrate-config.mjs +0 -302
  56. package/scripts/test-context-compression.sh +0 -169
  57. package/src/mcp/toon_codec.py +0 -491
  58. package/src/pantheon/auto-wake.ts +0 -85
  59. package/src/pantheon/chat-reminders.ts +0 -9
  60. package/src/pantheon/comment-checker.ts +0 -48
  61. package/src/pantheon/compaction-assert.ts +0 -160
  62. package/src/pantheon/compaction-handoff.ts +0 -304
  63. package/src/pantheon/cost-tracker.ts +0 -108
  64. package/src/pantheon/delegate-manager.ts +0 -766
  65. package/src/pantheon/delegation-classifier.ts +0 -307
  66. package/src/pantheon/delegation-finalize.ts +0 -406
  67. package/src/pantheon/delegation-notify.ts +0 -212
  68. package/src/pantheon/delegation-toast.ts +0 -73
  69. package/src/pantheon/delegation.ts +0 -1337
  70. package/src/pantheon/dispatch-guard.ts +0 -109
  71. package/src/pantheon/native-probe.ts +0 -234
  72. package/src/pantheon/permission-eval.ts +0 -284
  73. package/src/pantheon/preemptive-compact.ts +0 -76
  74. package/src/pantheon/provider-capabilities.ts +0 -221
  75. package/src/pantheon/provider-stream-tracker.ts +0 -182
  76. package/src/pantheon/retry-policy.ts +0 -212
  77. package/src/pantheon/step-cap.ts +0 -110
  78. package/src/pantheon/token-opt.ts +0 -689
  79. package/src/pantheon/toon-codec.ts +0 -481
  80. package/src/pantheon/v2-events.ts +0 -148
  81. package/src/pantheon/v2-hooks.ts +0 -287
  82. package/src/pantheon/v2-tool-definitions.ts +0 -331
  83. package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
  84. package/src/plugins/tui/dist/tui.tsx +0 -2853
package/AGENTS.md CHANGED
@@ -301,7 +301,9 @@ memory_store({
301
301
  agreements: ["point1", "point2"],
302
302
  divergences: [{"issue": "...", "resolution": "..."}],
303
303
  response_rate: "X of Y",
304
- themis_audit: "approved|issues"
304
+ themis_audit: "approved|issues",
305
+ precedent_used: false,
306
+ timestamp: "<ISO-8601>"
305
307
  },
306
308
  metadata: {
307
309
  type: "council_decision",
@@ -310,6 +312,7 @@ memory_store({
310
312
  }
311
313
  })
312
314
  ```
315
+ `value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
313
316
 
314
317
  ### Read Path (Precedent Fast-Path)
315
318
  Before dispatching a new council, Zeus runs:
@@ -320,8 +323,8 @@ memory_search(question, top_k=2, namespace="council_decisions")
320
323
  Result interpretation:
321
324
  | Score | Age | Action |
322
325
  |-------|-----|--------|
323
- | > 0.85 | < 30 days | Return precedent as fast-path answer. Skip council dispatch entirely. |
324
- | > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou" + proceed with council |
326
+ | > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ Decisão de [data] — reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
327
+ | > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou — decisão tem mais de 30 dias" + proceed with council |
325
328
  | 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
326
329
  | < 0.5 | Any | Ignore, proceed with fresh council |
327
330
 
@@ -371,7 +374,7 @@ You MUST self-monitor for these stall conditions:
371
374
  | Symptom | Detection Rule | Recovery Action |
372
375
  |---------|---------------|-----------------|
373
376
  | Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
374
- | Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, dispatch to fallback agent, report to user |
377
+ | Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
375
378
  | Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
376
379
  | Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
377
380
  | Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
@@ -397,9 +400,7 @@ When a delegation fails (timeout, empty response, error):
397
400
 
398
401
  2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
399
402
 
400
- 3. **If retry also fails** → DO NOT retry a third time blindly. Instead:
401
- - Dispatch to fallback agent (from routing.yml)
402
- - If no fallback, escalate to user with: "Task [X] failed after retry. Options: (a) simplify, (b) different agent, (c) manual intervention."
403
+ 3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
403
404
 
404
405
  ## Progress Checkpoint
405
406
 
@@ -564,10 +565,7 @@ sequenceDiagram
564
565
  ## Dispatch Sequence (9-Step Protocol)
565
566
 
566
567
  ### Step 0 — Precedent Fast-Path (Fase 1)
567
- Before any dispatch: `memory_search(query, top_k=2, namespace="council_decisions")`
568
- - Score > 0.85 AND age < 30 days → return precedent verbatim with note "⚠️ Decisão de [data] — reavaliar se contexto mudou". SKIP entire dispatch.
569
- - Score > 0.85 AND age > 30 days → return precedent with ⚠️ "Reavaliar se contexto mudou — decisão tem mais de 30 dias"
570
- - Else → proceed to Step 0b
568
+ Run the precedent read path defined in `## Memory Protocol > Council Decisions Namespace` (`memory_search(query, top_k=2, namespace="council_decisions")`). If no precedent applies, proceed to Step 0b.
571
569
 
572
570
  ### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
573
571
  If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
@@ -669,33 +667,11 @@ task(subagent_type: "themis", prompt: "Audit this council synthesis for fidelity
669
667
  - If issues → fix each issue before delivering to user
670
668
 
671
669
  ### Step 9 — Persist & Reconcile (Fase 1)
672
- ```
673
- memory_store({
674
- namespace: "council_decisions",
675
- key: "council:<yyyy-mm-dd>:<slug>",
676
- value: JSON.stringify({
677
- question, specialists, recommendation, confidence,
678
- agreements, divergences, precedent_used, timestamp
679
- }),
680
- metadata: {type: "council_decision", specialist_count: N}
681
- })
682
- board.markReconciled("<task-id>")
683
- ```
670
+ Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
684
671
 
685
672
  ## Specialist Output Format (Fase 1 — machine-parseable structured fields)
686
673
 
687
- Specialists MUST return these structured fields in their response:
688
-
689
- ```
690
- ## specialist_response
691
- **position:** <clear one-sentence position>
692
- **reasoning:** <2-4 sentences>
693
- **trade_offs:** <what's gained vs lost>
694
- **risks:** <what could go wrong>
695
- **confidence:** High | Medium | Low
696
- **agreement_signals:** agree: @agent1, @agent2 on [issue] | disagree: @agent3 on [issue]
697
- **specific_claims:** <count of specific factual claims in response>
698
- ```
674
+ Specialists MUST return the structured `## specialist_response` format (position, reasoning, trade_offs, risks, confidence, agreement_signals, specific_claims) defined in `## Agent Return Format > Council Specialist Response Format`.
699
675
 
700
676
  ## Domain-to-Specialist Mapping
701
677
 
@@ -928,39 +904,14 @@ ANY NO → full task (IMPL artifact + Themis review mandatory)
928
904
  3. **No Themis dependency** — output doesn't feed into a phase that requires review
929
905
 
930
906
  ## Subtask Return Format
931
- Expect a `subtask_summary` response with:
932
- ```
933
- ## subtask_summary
934
- **files_changed:** [paths]
935
- **summary:** What was done
936
- **tests:** ✅ or N/A
937
- **status:** complete | partial | escalated
938
- ```
907
+ Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
939
908
 
940
909
  ## Timeout Parcial (Partial Results)
941
910
 
942
- Timeout parcial is ONLY for read-only, independent agents:
943
- - ✅ @apollo — can return partial file list ("found 7 of 12 files before timeout")
944
- - ✅ @gaia — can return partial literature findings
945
-
946
- - ✅ @talos — can confirm progress if hotfix times out
947
- - ❌ Never for implementers or reviewers — must complete or fail
948
-
949
- When dispatching with partial-OK, set expectation:
950
- ```
951
- @apollo Search for auth files. Timeout parcial OK — return whatever you have.
952
- ```
911
+ Only agents marked ✅ in the Timeout Behavior table above may return partial results: @apollo (partial file list, e.g. "found 7 of 12 files before timeout"), @gaia (partial literature findings) and @talos (confirm progress if a hotfix times out). Never for implementers or reviewers — they must complete or fail. When dispatching with partial-OK, set the expectation: `@apollo Search for auth files. Timeout parcial OK — return whatever you have.`
953
912
 
954
913
  ---
955
914
 
956
915
  # 📊 TIMEOUT TRACKING
957
916
 
958
- Maintain awareness of in-flight delegations:
959
-
960
- | Agent | Timeout | Status | Partial OK? |
961
- |-------|---------|--------|-------------|
962
- | @apollo | 60s | ✅ complete | ✅ |
963
- | @hermes | 180s | ⏳ in progress | ❌ |
964
- | @themis | 120s | ⏳ in progress | ❌ |
965
-
966
- Log timeouts to `/memories/session/timeout-log.md` for later analysis.
917
+ Track in-flight delegations against the Timeout Behavior table above. Log timeouts to `/memories/session/timeout-log.md` for later analysis.
package/CHANGELOG.md CHANGED
@@ -18,6 +18,332 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
18
18
 
19
19
  ## ✅ Closed Issues
20
20
 
21
+ ## [v1.5.1] - 2026-09-22
22
+
23
+ ## 🐞 Fixed
24
+ - **agents** — declare explicit read: allow for zeus
25
+ - **ci** — drop fastembed from CI, keep pytest collection green (#163)
26
+ - **plugin** — detect registered-plugin version drift after pantheon_delegate removal (#169)
27
+ - **config** — correct node floor and warn on unsupported runtime (#168)
28
+ - **mcp** — degrade gracefully when fastembed import fails (#165)
29
+ - **mcp** — drop dead toon_codec module from published package (#167)
30
+ - **tui** — remove dead pantheon_delegate refs after v1.5.0 V1 removal (#166)
31
+ - **mnemosyne** — grant scoped write to memory-bank and deepwork paths (#164)
32
+
33
+ ## ✅ Closed Issues
34
+ - #94 - drop fastembed from CI, keep pytest collection green (#163)
35
+ - #158 - detect registered-plugin version drift after pantheon_delegate removal (#169)
36
+ - #114 - correct node floor and warn on unsupported runtime (#168)
37
+ - #160 - correct node floor and warn on unsupported runtime (#168)
38
+ - #159 - degrade gracefully when fastembed import fails (#165)
39
+ - #162 - drop dead toon_codec module from published package (#167)
40
+ - #161 - remove dead pantheon_delegate refs after v1.5.0 V1 removal (#166)
41
+ - #111 - grant scoped write to memory-bank and deepwork paths (#164)
42
+
43
+ ## [v1.5.0] - 2026-09-16
44
+
45
+ ### 🆕 What's New
46
+
47
+ - **Delegação nativa**: `task()` é agora o único canal de delegação — motor legado
48
+ de dispatch removido por completo, simplificando o fluxo de subagents.
49
+ - **Painel Delegations (TUI)**: painel funcional com status em tempo real, cores
50
+ por estado (running/completed/failed), janela de recência 24h, ordenação
51
+ newest-first e spinner fluido com timer independente (80ms/frame).
52
+ - **Read-only enforcement**: sessões read-only bloqueiam `write`, `edit`,
53
+ `pantheon_delegate` e qualquer mutação — garantindo sandboxing efetivo.
54
+ - **CI/CD**: Dependabot alerts, CodeQL analysis, SHA pins em actions, gitleaks
55
+ v3 para detecção de secrets, e workflow de release dispatch-only.
56
+
57
+ ### 🐞 Fixed
58
+
59
+ - **Painel Delegations vazio (crítico)**: canal `session.children` da TUI
60
+ chamava API com shape v1 num cliente v2 — placeholder `{sessionID}` não era
61
+ substituído, causando ~181k erros/s e painel vazio. Corrigido
62
+ `safeSessionPath`/`buildChildrenPath`.
63
+ - **Stale busy**: children com status `busy` stale (>30min sem atualização)
64
+ agora são classificadas como `completed` (não `running`).
65
+ - **Board corruption**: testes que importam o plugin sem isolamento agora fazem
66
+ `chdir` para projeto temporário — sem mais entradas fantasma no board real.
67
+ - **Signal leak**: timer independente do spinner separado do poll de dados,
68
+ evitando bloqueio visual durante operações longas.
69
+
70
+ ### ✅ Closed Issues
71
+
72
+ - 38% dos testes consolidados (de ~1200 para ~744) com cobertura mantida.
73
+ - 17 módulos mortos removidos, reduzindo superfície de manutenção.
74
+ - OWASP Top 10 audit e input validation em todos os endpoints.
75
+
76
+ ## [v1.5.0-beta.20] - 2026-09-16
77
+
78
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
79
+ move this section to a versioned entry and reset the template below. --&gt;
80
+
81
+ ## 🐞 Fixed
82
+
83
+ - **Fixed — painel Delegations**: children com status `busy` stale (>30min sem
84
+ atualização) agora são classificadas como `completed` (não `running`). O
85
+ opencode mantém entradas `busy` no mapa de status para sessões já concluídas;
86
+ o TUI agora detecta e marca como done.
87
+ ## [v1.5.0-beta.19] - 2026-09-16
88
+
89
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
90
+ move this section to a versioned entry and reset the template below. --&gt;
91
+
92
+ ## 🆕 What's New
93
+
94
+ - **Improved — painel Delegations**: status ausente de children antigas agora é
95
+ `done` (não `running`); grace 60s para sessões recém-criadas; janela de
96
+ recência 24h (filtra histórico); ordenação newest-first; ceiling esconde
97
+ antigos.
98
+ - **Improved — animação**: spinner ⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏ agora tem timer
99
+ independente (80ms/frame), separado do poll de dados — fluido, não mais
100
+ "travado".
101
+ ## [v1.5.0-beta.18] - 2026-09-16
102
+
103
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
104
+ move this section to a versioned entry and reset the template below. --&gt;
105
+
106
+ ## 🐞 Fixed
107
+
108
+ - **Painel Delegations voltou a funcionar (crítico):** o canal
109
+ `session.children` da TUI chamava a API com a shape v1 (`{ path: { id } }`)
110
+ num cliente **v2** que espera `{ sessionID }`; o placeholder não era
111
+ substituído (`/session/%7BsessionID%7D/children`), o host rejeitava cada
112
+ poll (~181k erros/s) e o painel ficava vazio ("No delegations"). Corrigido
113
+ `safeSessionPath`/`buildChildrenPath` para `{ sessionID }`, removidos os
114
+ `as any` que escondiam o mismatch, + teste de regressão exato. Auditoria
115
+ confirmou que só a TUI (v2) estava errada (o `plugin.ts` usa SDK v1 de
116
+ propósito).
117
+ - **Higiene de testes:** testes que importam o plugin sem isolamento agora
118
+ fazem `chdir` para um projeto temporário antes do import — não criam mais
119
+ entradas no board real (fim dos estados fantasma em desenvolvimento).
120
+
121
+ ## [v1.5.0-beta.17] - 2026-09-15
122
+
123
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
124
+ move this section to a versioned entry and reset the template below. --&gt;
125
+
126
+ ## 🆕 What's New
127
+
128
+ - **Delegação nativa no host:** o motor `pantheon_delegate` foi removido
129
+ (~3,9k linhas) junto com as tools `pantheon_delegate`,
130
+ `pantheon_delegation_read` e `pantheon_delegation_list`; a delegação agora usa
131
+ o **`task()` nativo** do host (child sessions). 16 arquivos de teste obsoletos
132
+ removidos.
133
+ - **TUI — painel Delegations lê a sessão nativa:** o painel passa a derivar de
134
+ `session.children` + `session.status` + md (o arquivo de board deixou de ser
135
+ fonte). Mantidas as cores de status, retenção, ceiling, filtro de sessão e
136
+ guards.
137
+ - **Camada fina preservada:** `task-result-guard` (verified completion de child
138
+ vazio), `native-task-status` e guards de enforcement.
139
+
140
+ ## 🐞 Fixed
141
+
142
+ - **Read-only enforcement re-apontado para sessões nativas:** aplicado no
143
+ público via hook `chat.params` e `hashline_edit` bloqueado para `apollo`/`gaia`,
144
+ fechando o bypass aberto após a remoção do motor de delegação.
145
+ - **Docs/comentários limpos:** referências aos módulos removidos atualizadas,
146
+ incluindo nits de comentário em `tests/pantheon/tui-delegations.test.ts` e
147
+ `src/pantheon/session-id.ts`.
148
+
149
+ ## [v1.5.0-beta.16] - 2026-09-15
150
+
151
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
152
+ move this section to a versioned entry and reset the template below. --&gt;
153
+
154
+ ## 🆕 What's New
155
+
156
+ - **Modernização CI/supply-chain:** 22 actions SHA-pinadas; `gitleaks-action` v3
157
+ (fix crítico — a v2 morria com Node 20 em 2026-09-16) com CLI 8.30.1; cache
158
+ npm/pip; Dependabot; CodeQL `+python` e `codeql-config`; permissões reduzidas
159
+ no `docs.yml`; job `version-check` fundido no `validate`; `upload-artifact` v7
160
+ e `download-artifact` v8.
161
+ - **Lean:** ~17 módulos mortos removidos de `src/pantheon/`, docs/scripts
162
+ obsoletos, `teste/`/`testes/`, `Dockerfile`/`docker-compose` (de outro projeto)
163
+ e caches; ~38% dos arquivos de teste removidos/consolidados; testes mínimos
164
+ readicionados para os módulos vivos (tool-ceiling, native-probe).
165
+ - **Instructions:** deduplicação das instruções compartilhadas — contexto menor
166
+ sem perder nenhuma regra.
167
+
168
+ ## 🐞 Fixed
169
+
170
+ - **2 flakes determinísticos eliminados:** TTL do MCP persistence
171
+ (`test_ttl_expiry_real_time`) e `logger.test.mjs` deixaram de depender de
172
+ timing/carga do host.
173
+ - **Refs stale corrigidas:** referências de versão/ambiente atualizadas para
174
+ Node 22+.
175
+
176
+ ## [v1.5.0-beta.15] - 2026-09-15
177
+
178
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
179
+ move this section to a versioned entry and reset the template below. --&gt;
180
+
181
+ ## 🆕 What's New
182
+
183
+ - **Delegation `read` devolve o relatório completo:** o retorno de `read` passa a
184
+ ler o relatório integral do disco (com cap configurável e marker explícito de
185
+ truncamento) em vez do recibo resumido — o conteúdo é o mesmo tanto no caminho
186
+ nativo quanto no legado, com paridade garantida entre eles.
187
+ - **`sanitizeReceiptText` UTF-8-safe:** a sanitização de recibos deixou de corromper
188
+ caracteres multibyte; acentuação e demais codepoints UTF-8 são preservados no
189
+ caminho nativo e no legado.
190
+ - **TUI — cor de status na row inteira:** cada linha do painel Delegations passa a
191
+ ser pintada pelo estado — vermelho = falha, verde = concluído, amarelo = em
192
+ andamento — com o glyph mantido como canal redundante para acessibilidade.
193
+
194
+ ## 🐞 Fixed
195
+
196
+ - **TUI — painel Delegations só da sessão ativa:** o painel deixa de renderizar
197
+ rows cross-session/órfãs que causavam "Session not found" ao clicar; a lista
198
+ agora cobre apenas a sessão ativa, mantendo a retenção de concluídas (2 min)
199
+ e falhas (10 min).
200
+ - **Guards de estado e navegação órfã:** transições prematuras para `done` são
201
+ bloqueadas e a navegação defensiva ignora alvos órfãos, evitando seleção
202
+ inválida no painel.
203
+ - **Isolamento do board nos testes:** testes que importam o plugin real agora
204
+ isolam o BackgroundJobBoard, eliminando o fantasma "preserve this running
205
+ delegation"; o board real foi limpo.
206
+ - **Lean no core:** 17 módulos mortos de `src/pantheon/` removidos, ~38% dos
207
+ arquivos de teste removidos/consolidados e docs/scripts órfãos limpos, com
208
+ testes mínimos readicionados para os módulos vivos (tool-ceiling, native-probe).
209
+ - **Flake de TTL determinístico:** `test_ttl_expiry_real_time` deixou de competir
210
+ com a truncagem de microssegundos do SQLite — o teste agora espera o início de
211
+ um segundo limpo antes do store e usa margem sobre o TTL, eliminando o flake
212
+ dependente de carga (test-only).
213
+
214
+ ## [v1.5.0-beta.14] - 2026-09-14
215
+
216
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
217
+ move this section to a versioned entry and reset the template below. --&gt;
218
+
219
+ ## 🆕 What's New
220
+
221
+ - **Ordenação active-first:** delegações ativas aparecem antes das concluídas,
222
+ falhas e canceladas no painel TUI.
223
+ - **Overflow active:** quando há mais delegações ativas que o teto visível, o
224
+ excedente ativo permanece representado na linha de overflow.
225
+
226
+ ## 🐞 Fixed
227
+
228
+ - **Retenção visual:** concluídas permanecem visíveis por 2 min e falhas por
229
+ 10 min antes de saírem do painel; canceladas seguem a retenção configurada.
230
+
231
+ ## ⚠️ Known Issues
232
+
233
+ - **Stale running warning:** jobs em estado `running` além do limite esperado
234
+ recebem um aviso visual de stale no painel.
235
+ ## [v1.5.0-beta.13] - 2026-09-14
236
+
237
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
238
+ move this section to a versioned entry and reset the template below. --&gt;
239
+
240
+ ## 🆕 What's New
241
+
242
+ - **TUI status-only — rows simplificadas:** cada linha do painel Delegations passa
243
+ a ser `{glyph} {alias} {elapsed}` + `desc` muted — um glyph de status, uma única
244
+ identidade e o tempo decorrido, com a descrição em tom muted. São 4 glyphs
245
+ (running animado, completed, error, cancelled/retry), sem toggle
246
+ `[Sessão]`/`[Tudo]`, sem prefixos `nat:`/`pan:` e sem losango ◇/◆.
247
+ - **Header `active`/`done`/`failed`:** o cabeçalho do painel resume apenas esses
248
+ três contadores sobre a lista completa (todas as sessões), sem `nat:`/`pan:`.
249
+ - **Ceiling 8:** no máximo 8 linhas visíveis (live-first); o excedente colapsa em
250
+ uma única linha `… +N more`.
251
+ - **Board read (jobs de todas as sessões):** o painel lê o BackgroundJobBoard
252
+ (`.pantheon/board/state.json`), então jobs `pantheon_delegate` de qualquer
253
+ sessão aparecem — não só os filhos nativos da sessão focada.
254
+ - **118 testes TUI delegations:** `tests/pantheon/tui-delegations.test.ts` com
255
+ 118/118 passando, cobrindo rows status-only, header active/done/failed, ceiling
256
+ e board read cross-session.
257
+
258
+ ## 🐞 Fixed
259
+
260
+ - **Sanitização de dead code:** removidos helpers, tipos e estado órfãos do
261
+ painel Delegations (toggle de escopo `[Sessão]`/`[Tudo]`, prefixos curtos
262
+ `nat:`/`pan:`, glyphs por estado e paginação de arquivo morto) que sobraram do
263
+ refactor status-only.
264
+ - **Board merge preserva sessão conhecida:** um record do board com
265
+ `parentSessionID` vazio não sobrescreve mais a sessão já atribuída à linha.
266
+ ## [v1.5.0-beta.12] - 2026-09-14
267
+
268
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
269
+ move this section to a versioned entry and reset the template below. --&gt;
270
+
271
+ ## 🆕 What's New
272
+
273
+ - **TUI lê o board (4º canal):** o painel Delegations passa a ler o
274
+ BackgroundJobBoard via `readBoardState()` — jobs `pantheon_delegate` de todas
275
+ as sessões aparecem, não só os filhos nativos da sessão focada.
276
+ - **Toggle [Sessão]/[Tudo] + chips:** `[Sessão]` (default) mostra só a sessão
277
+ focada, `[Tudo]` mostra jobs de todas as sessões; chips clicáveis no header.
278
+ - **Raw `dist/tui.tsx` removido (bundle-only):** o dist passa a carregar só o
279
+ bundle compilado (`tui.js`); o fonte raw sai do pacote publicado.
280
+ - **117 testes TUI delegations:** `tests/pantheon/tui-delegations.test.ts` com
281
+ 117/117 passando, cobrindo board-read, split ativo/recente e toggle de escopo.
282
+ ## [v1.5.0-beta.11] - 2026-09-14
283
+
284
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
285
+ move this section to a versioned entry and reset the template below. --&gt;
286
+
287
+ ## 🆕 What's New
288
+
289
+ - **Glyphs da FSM real no painel Delegations:** cada estado do BackgroundJobBoard
290
+ tem agora um glifo Unicode geométrico próprio — `⠋` running (spinner 1s),
291
+ `⟳` retry, `⚠` stale/startup, `✓` completed, `✕` error, `−` cancelled. Forma e
292
+ cor são canais independentes: as linhas seguem legíveis sem cor e sem Nerd Font.
293
+ - **Prefixo `nat:` / `pan:` documentado:** `docs/INSTALLATION.md` passa a
294
+ descrever os prefixos curtos das linhas nativas (`nat:<agent>`) e do board
295
+ (`pan:<alias>`) e o par de glyphs ◇/◆.
296
+ - **`scripts/dev-tui.sh` (dev local sem publish):** instala, builda e registra o
297
+ caminho absoluto do repo em `.opencode/tui.json` (gitignored) com hint de
298
+ restart — sem tocar `opencode.json` e sem publicar.
299
+ - **104 testes TUI delegations:** `tests/pantheon/tui-delegations.test.ts` com
300
+ 104/104 passando, cobrindo glifos/marker/tone dos estados reais da FSM.
301
+
302
+ ## 🐞 Fixed
303
+
304
+ - **Doctor F.2 (`hasUsableScripts`):** a resolução do diretório code-mode agora
305
+ exige um `.py`/`.sh` regular (paridade com `_has_usable_scripts` do MCP), então
306
+ um overlay de projeto vazio não mascara mais uma instalação que traz scripts.
307
+ - **`publish:next` órfão removido:** nenhum workflow usava o script (o release
308
+ publica via `--tag beta`); removido do `package.json` para eliminar o dist-tag
309
+ `next` obsoleto da linha de publicação.
310
+ ## [v1.5.0-beta.10] - 2026-09-14
311
+
312
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
313
+ move this section to a versioned entry and reset the template below. --&gt;
314
+
315
+ ## 🆕 What's New
316
+
317
+ - **TUI delegations com prefixos curtos `nat:` / `pan:`:** cada linha do painel passa
318
+ a usar `nat:<agent>` para child nativo do `task()` (sem report no board) ou
319
+ `pan:<alias>` para linha `pantheon_delegate` (ex. `pan:apo-1`) — os prefixos curtos
320
+ liberam largura no sidebar estreito.
321
+ - **Glyph de 2 canais (◇/◆):** ◇ vazado (info/cyan) para child nativo e ◆ preenchido
322
+ (cor de estado) para linha do board — forma e cor são canais independentes, então o
323
+ split segue legível mesmo sem cor.
324
+ - **Header resumido:** `(N active · M done · nat:K pan:M)` calculado sobre a lista
325
+ completa (active + recent + archived), no lugar do antigo `(N native + M pantheon)`.
326
+ - **Elapsed em caixa fixa:** rótulo alinhado à direita em largura 8 e SEMPRE
327
+ renderizado, então um job ativo sem descrição nunca perde o timer.
328
+ - **100 testes TUI delegations:** `tests/pantheon/tui-delegations.test.ts` com 100/100
329
+ passando (tsc + biome OK), acima dos 93 da beta.9.
330
+
331
+ ## 🐞 Fixed
332
+
333
+ - **`appendFile` sem import (log do painel volta a escrever):** o log em arquivo do
334
+ painel parou de escrever silenciosamente porque `appendFile` era chamado sem import
335
+ (ReferenceError engolido pelo `catch` vazio); o import foi restaurado e o `catch`
336
+ agora reporta a falha (gated por echo) em vez de sumir.
337
+ - **Truncamento grapheme-safe:** descrições truncam em fronteiras de grapheme
338
+ (`Intl.Segmenter` com fallback `Array.from`) em 44 graphemes, sem cortar emoji ou
339
+ sequências ZWJ ao meio (mojibake).
340
+ - **Linhas stale-running ficam em Active:** um job stale ainda é um job vivo (estado do
341
+ backend inalterado), então não é mais arquivado — o que escondia a linha lançada.
342
+ - **Spinner/animação de 140ms → 1000ms:** o tick rápido piscava sem adicionar informação.
343
+ - **Dead code removido:** conectores de árvore (`isNestedDelegation` /
344
+ `delegationTreePrefix`) e campos `parentTaskID`/`childCount` removidos —
345
+ `session.children` só devolve filhos diretos, então nenhuma linha nested era
346
+ produzida (BACKLOG).
21
347
  ## [v1.5.0-beta.9] - 2026-09-14
22
348
 
23
349
  <!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
package/README.md CHANGED
@@ -30,7 +30,15 @@ way to plan work, make progress, check results, and keep useful project context.
30
30
 
31
31
  ## Start in 2 minutes
32
32
 
33
- Requirements: [OpenCode 1.18.4+](https://opencode.ai/docs/) and Node.js 22+.
33
+ Requirements: [OpenCode 1.18.4+](https://opencode.ai/docs/) and Node.js
34
+ 22.22.2+ (or 24.15.0+ / 26+).
35
+
36
+ Pantheon declares `engines.node` as `^22.22.2 || ^24.15.0 || >=26.0.0`. The
37
+ floor reflects what the dependency tree actually needs — the transitive
38
+ `ini@7` rejects earlier 22.x/24.x builds with `EBADENGINE` — and odd-numbered
39
+ Node releases (23, 25) are out of range. The `pantheon_cost` tool also needs
40
+ `node:sqlite`, which requires Node >= 22.5; `doctor` warns when the running
41
+ runtime cannot load it.
34
42
 
35
43
  From the project where you want to use Pantheon:
36
44
 
@@ -76,25 +84,14 @@ availability and configuration of OpenCode and any optional services you choose
76
84
  to use. Check the [releases](https://github.com/ils15/pantheon-opencode/releases)
77
85
  and [changelog](CHANGELOG.md) for the latest published changes.
78
86
 
79
- ## Delegation engines (legacy default, native opt-in)
80
-
81
- Pantheon exposes two delegation engines behind one tool surface:
82
-
83
- - **Legacy (default)** — `pantheon_delegate`, the original engine registered by
84
- the V1 plugin. No configuration is required.
85
- - **Native (opt-in, experimental)** — OpenCode's native `task()` child-session
86
- engine, selected with `PANTHEON_DELEGATE_MODE=native`. Native is strict: it
87
- does not use foreground fallback, model failover, or retry; it performs a
88
- lazy capability probe on the first dispatch and includes the resulting
89
- status in the delegation receipt.
87
+ ## Delegation (native `task()`)
90
88
 
91
- Legacy stays the default for v1.5.x; native is not promoted to default until
92
- v1.6. See [ADR-0011](.pantheon/memory-bank/adr/0011-delegation-engine-contract.md)
93
- (Proposed) for the engine contract, rationale, and migration prerequisites.
94
-
95
- **Kill-switch:** set `PANTHEON_DELEGATION=off` (case-insensitive) to disable
96
- delegation entirely. The switch covers **both** engines — the legacy
97
- `pantheon_delegate`/read/list tools throw, and the native manager throws too.
89
+ Pantheon delegates exclusively through OpenCode's native `task()` child-session
90
+ engine. The former custom `pantheon_delegate` tool and the V1 delegation engine
91
+ (`delegation.ts`, `delegate-manager.ts` and supporting modules) were removed;
92
+ there is no Pantheon-specific delegation tool surface to configure. See
93
+ [ADR-0011](.pantheon/memory-bank/adr/0011-delegation-engine-contract.md) for the
94
+ historical engine contract.
98
95
 
99
96
  ## Cost tool backend
100
97
 
@@ -172,8 +169,7 @@ script's SHA-256 without regenerating it.
172
169
  covering OpenCode V1/V2 side by side — see
173
170
  [Sandbox validation](#sandbox-validation-v1v2).
174
171
  - Beta2 agent-economy policy: direct native delegation, bounded compaction
175
- carry-forward, compact context encoding, and quality floors — see
176
- [Beta2 agent economy policy](docs/ws3-token-opt-measurements.md#beta2-agent-economy-policy).
172
+ carry-forward, compact context encoding, and quality floors.
177
173
  - A `--prompts` installer flag is planned for a future release.
178
174
 
179
175
  ## OpenCode V1/V2 — Dual Version (1.5.0-beta.2)
@@ -186,23 +182,22 @@ per installation; V1 and V2 Pantheon plugins must never be registered together.
186
182
  |---|---|---|
187
183
  | OpenCode config key | singular `plugin` | plural `plugins` |
188
184
  | Pantheon registration | `src/plugin.ts` plus `src/plugins/pantheon-hooks.ts` | `<installed>/src/plugin-v2` directory (`index.ts` re-exports `src/plugin-v2.ts`) |
189
- | Runtime contract | Legacy Pantheon plugin, including `pantheon_delegate`, read/list tools, event/tool hooks and V1 compaction handling | Full V2 plugin: 9 orchestration tools, 4 event subscriptions, session hooks (`prompt`, `context`), tool hooks (`execute.before`/`after`), plus configuration transforms |
185
+ | Runtime contract | Pantheon V1 plugin: 6 tools (`hashline_edit`, the 3 goal tools, `pantheon_cost`, `pantheon_model`), event/tool hooks and V1 compaction handling | Full V2 plugin: 6 orchestration tools, 4 event subscriptions, session hooks (`prompt`, `context`), tool hooks (`execute.before`/`after`), plus configuration transforms |
190
186
  | V1 APIs | Registered | Own tool definitions via `ctx.tool.transform()` — not the V1 plugin path |
191
187
 
192
- The V2 plugin provides 9 orchestration tools (`pantheon_delegate`,
193
- `pantheon_delegation_read`, `pantheon_delegation_list`, `hashline_edit`,
188
+ The V2 plugin provides 6 orchestration tools (`hashline_edit`,
194
189
  `pantheon_goal_create`, `pantheon_goal_get`, `pantheon_goal_update`,
195
190
  `pantheon_cost`, `pantheon_model`), 4 event subscriptions (`session.created`,
196
191
  `session.idle`, `session.error`, `session.compacted`), session hooks (`prompt`,
197
192
  `context`), and tool hooks (`execute.before`, `execute.after`). The only
198
- unsupported V2 feature is `legacy-hooks` (the V1-specific delegate API surface).
193
+ unsupported V2 feature is `legacy-hooks` (the V1-specific hook surface).
199
194
 
200
195
  The package exposes both contracts as importable exports: `pantheon-opencode/plugin`
201
196
  (V1), `pantheon-opencode/plugin-v2` (V2) and `pantheon-opencode/v2-bridge`
202
197
  (optional interop), so a host can load either contract explicitly.
203
198
 
204
199
  The V1→V2 bridge (`src/pantheon/v2-bridge.ts`) enables optional interop:
205
- V1 infrastructure singletons (BackgroundJobBoard, DelegationClient, GoalStore,
200
+ V1 infrastructure singletons (BackgroundJobBoard, GoalStore,
206
201
  TodoEnforcer, VisionHandler) are passed through V2 `ctx.options`. The bridge is
207
202
  optional — V2 works standalone with graceful degradation.
208
203
 
@@ -259,7 +254,12 @@ Two freshness guarantees back it up:
259
254
  re-run `init` just for file copies.
260
255
  - **Drift detection** — the installer stamps the installed version in
261
256
  `.pantheon/install-state.json` and `doctor` warns when the package is newer
262
- than the last sync, pointing at `update`.
257
+ than the last sync, pointing at `update`. `doctor` also detects **plugin
258
+ version drift** (issue #158): when `opencode.json` registers a plugin path
259
+ inside a `node_modules/pantheon-opencode` copy whose `package.json` version
260
+ differs from the running package, it warns that the registered tool surface
261
+ is stale. Re-running `init`/`update` realigns the registration onto the
262
+ current package.
263
263
 
264
264
  `init` also gained `--components agents,skills,...` (narrow install),
265
265
  `--clean` (alias of `--force`), `--opencode-version auto`, atomic config
@@ -269,6 +269,42 @@ the install completes but MCP entries are omitted (with a warning) instead of
269
269
  pointing at a broken interpreter. Installer messages auto-detect pt-BR via
270
270
  `LANG`/`LC_ALL`.
271
271
 
272
+ ## Migrating to 1.5.x (from 1.4.x)
273
+
274
+ 1.5.0 removed the custom `pantheon_delegate` tool (and the V1 delegation
275
+ engine) in favor of OpenCode's native `task()`; see
276
+ [Delegation (native `task()`)](#delegation-native-task). Two things change on
277
+ an existing install:
278
+
279
+ 1. **The tool disappears from the plugin surface.** `pantheon_delegate` is no
280
+ longer registered by `src/plugin.ts` or `src/plugin-v2.ts`. Agents now
281
+ delegate through `task()` only — no configuration is needed.
282
+ 2. **A lockfile-pinned copy can keep the old tool alive.** `npm install` is
283
+ lockfile-authoritative: a `package-lock.json` pinned to `1.4.1` (which
284
+ satisfies `^1.4.1`) is never re-resolved, so a project's
285
+ `node_modules/pantheon-opencode` can stay on 1.4.x while the published
286
+ package moved on. The plugin path your `opencode.json` registers keeps
287
+ pointing at that stale copy, and you keep running the obsolete tool surface
288
+ — including `pantheon_delegate` — with no warning.
289
+
290
+ The fix is a realignment + a detector:
291
+
292
+ ```bash
293
+ # Realign the registered plugin path onto the current package (rewrites any
294
+ # node_modules/pantheon-opencode reference in opencode.json):
295
+ npx pantheon-opencode@latest init --yes --headless
296
+ # or, with a global install:
297
+ pantheon-opencode update
298
+
299
+ # Then verify no drift remains:
300
+ npx pantheon-opencode@latest doctor
301
+ ```
302
+
303
+ `doctor` now reports a **Plugin Version Drift** warning (section H3) when the
304
+ registered plugin points into an installed copy whose version differs from the
305
+ running package, naming both versions and the removal (`pantheon_delegate` in
306
+ 1.5.0). A healthy install reports no warning.
307
+
272
308
  ## Releases
273
309
 
274
310
  Publication is authorized **only** by an explicit `workflow_dispatch` of the
@@ -340,8 +376,20 @@ child session returns an empty or missing result. Instead of surfacing a silent
340
376
  `completed` with no payload (which confuses the orchestrator), the guard now
341
377
  raises an explicit error. This catches the common free-tier failure mode where a
342
378
  child session exceeds the uncached-prefill token budget (`BackendAdmissionRejected`)
343
- and returns nothing. For large payloads, prefer `pantheon_delegate` over native
344
- `task()` — the delegation layer has better timeout and error handling.
379
+ and returns nothing. Prefer `background=true` dispatches with an explicit
380
+ `task_status(wait=true)` fan-in so large payloads are collected deterministically.
381
+
382
+
383
+ ## Configuration (environment variables)
384
+
385
+ | Variable | Default | Description |
386
+ |---|---|---|
387
+ | `PANTHEON_MEMORY_EMBED` | `on` | `off` (also `0`, `false`, `no`) disables the `pantheon-memory` embedding/vector pipeline — search runs in FTS5-only mode with no model download and no `sqlite-vec` writes. Also forced `off` automatically when `fastembed` fails to import, so a broken embedding install never takes the server down (issue #159). |
388
+
389
+ The memory MCP degrades gracefully: when `fastembed` or `sqlite-vec` are
390
+ unavailable (network failure, incompatible wheel), the server still starts,
391
+ answers the MCP `initialize` handshake, and serves keyword search — only the
392
+ semantic vector ranking is unavailable.
345
393
 
346
394
 
347
395
  ## Documentation