pantheon-opencode 1.6.1 → 1.6.2-beta.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 (99) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +16 -0
  4. package/README.md +91 -19
  5. package/README.pt-BR.md +14 -9
  6. package/bin/pantheon-init.mjs +106 -19
  7. package/package.json +3 -2
  8. package/plugin.json +1 -1
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +1 -1
  11. package/scripts/doctor.mjs +213 -45
  12. package/scripts/install/agents-md.mjs +2 -1
  13. package/scripts/install/config-migration.mjs +344 -393
  14. package/scripts/install/config-paths.mjs +15 -0
  15. package/scripts/install/mcp-permissions.mjs +164 -0
  16. package/scripts/install/opencode-version.mjs +31 -13
  17. package/scripts/install/opencode-wildcard.mjs +106 -0
  18. package/scripts/install/opencode.mjs +240 -69
  19. package/scripts/install/plan-artifact.mjs +12 -1
  20. package/scripts/install/plugin.mjs +17 -1
  21. package/scripts/install/v2-capabilities.mjs +5 -6
  22. package/scripts/package-evidence.mjs +1 -0
  23. package/scripts/sandbox-env.sh +174 -0
  24. package/scripts/setup-v2-config.mjs +1703 -0
  25. package/scripts/setup.mjs +415 -0
  26. package/scripts/sync-tui.mjs +9 -1
  27. package/scripts/test-opencode-v2-sandbox.sh +438 -151
  28. package/scripts/update-skills-lock.mjs +30 -0
  29. package/skills-lock.json +10 -10
  30. package/src/agents/aphrodite.md +5 -2
  31. package/src/agents/apollo.md +5 -0
  32. package/src/agents/athena.md +6 -1
  33. package/src/agents/demeter.md +5 -1
  34. package/src/agents/gaia.md +4 -0
  35. package/src/agents/hephaestus.md +6 -1
  36. package/src/agents/hermes.md +6 -3
  37. package/src/agents/iris.md +5 -1
  38. package/src/agents/mnemosyne.md +20 -50
  39. package/src/agents/nyx.md +5 -1
  40. package/src/agents/prometheus.md +4 -0
  41. package/src/agents/talos.md +4 -0
  42. package/src/agents/themis.md +4 -0
  43. package/src/agents/zeus.md +9 -3
  44. package/src/instructions/agent-return-format.instructions.md +1 -1
  45. package/src/instructions/memory-protocol.instructions.md +3 -3
  46. package/src/instructions/test-economy.instructions.md +6 -6
  47. package/src/mcp/pantheon_vision.py +37 -36
  48. package/src/pantheon/v2-vision.ts +34 -29
  49. package/src/pantheon/vision.ts +43 -10
  50. package/src/plugin-v2.ts +30 -53
  51. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  52. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  53. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  54. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  55. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  56. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  57. package/src/plugins/tui/dist/quota-cli.js +184 -0
  58. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  59. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +390 -0
  60. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +1 -0
  61. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  62. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  63. package/src/plugins/tui/dist/server-v2.js +673 -0
  64. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  65. package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
  66. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  67. package/src/plugins/tui/dist/tui-v2.js +2492 -529
  68. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  69. package/src/plugins/tui/dist/tui.js +1 -1
  70. package/src/plugins/tui/index-v2.ts +3 -6
  71. package/src/plugins/tui/package-lock.json +2 -2
  72. package/src/plugins/tui/package.json +3 -2
  73. package/src/plugins/tui/src/context-gauge.ts +59 -0
  74. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  75. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  76. package/src/plugins/tui/src/index-v2.tsx +199 -240
  77. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  78. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  79. package/src/plugins/tui/src/quota-cli.ts +237 -0
  80. package/src/plugins/tui/src/quota-rpc.ts +209 -0
  81. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  82. package/src/plugins/tui/src/quota-v2.tsx +986 -0
  83. package/src/plugins/tui/src/server-v2.ts +841 -0
  84. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  85. package/src/plugins/tui/tsconfig.typecheck.json +1 -1
  86. package/src/plugins/tui/tsdown.config.ts +8 -1
  87. package/src/routing.yml +72 -13
  88. package/src/skills/README.md +4 -0
  89. package/src/skills/agent-coordination/SKILL.md +0 -3
  90. package/src/skills/artifact-management/SKILL.md +0 -3
  91. package/src/skills/auto-continue/SKILL.md +0 -3
  92. package/src/skills/code-review-checklist/SKILL.md +0 -3
  93. package/src/skills/context-compression/SKILL.md +0 -3
  94. package/src/skills/memory-bank/SKILL.md +6 -28
  95. package/src/skills/session-goal/SKILL.md +0 -3
  96. package/src/skills/simplify/SKILL.md +5 -4
  97. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  98. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  99. package/src/pantheon/memory-context.ts +0 -1017
package/AGENTS.global.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- pantheon:generated:begin — Pantheon-managed region; regenerated on install/upgrade, never edit inside -->
2
2
  <!-- Generated by scripts/build-agents-md.mjs — do not edit directly. -->
3
3
  <!-- Source of truth: src/instructions/*.instructions.md + the static sections in this script. -->
4
- <!-- pantheon:agents-md v2 artifact=global generated-at=2026-10-22T13:57:53-03:00 sha=ceade5f -->
4
+ <!-- pantheon:agents-md v2 artifact=global generated-at=2026-10-27T08:34:01-03:00 sha=0a6a8e2 -->
5
5
 
6
6
  # Pantheon Agent System — OpenCode
7
7
 
@@ -32,7 +32,7 @@ Shared rules from `src/instructions/*.instructions.md`, identical for OpenCode V
32
32
  <!-- Source: src/instructions/agent-return-format.instructions.md -->
33
33
  ## Agent Return Format
34
34
 
35
- Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
35
+ All agents check each result against the request and evidence; remove unrelated work, generic filler, unsupported claims, and unnecessary complexity; state uncertainty and preserve safety constraints. Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
36
36
 
37
37
  ## subtask_summary
38
38
  **files_changed:** [list of file paths, one per line]
@@ -76,21 +76,21 @@ Required: position, reasoning, trade_offs, risks, confidence. Optional `agreemen
76
76
  - Use a targeted query (`top_k=2`) and ignore weak matches; missing or irrelevant results never block current work.
77
77
 
78
78
  ### Persistence
79
- - Use only tools granted in the active session: Zeus has `memory_search` and temporary `context_save`/`context_get` checkpoints but no durable writes; Mnemosyne has `memory_store` and other durable tools.
80
- - Store at most one concise, reusable top-level result; never persist routine child summaries, phase updates, test logs, or temporary state. Confirm a successful write before claiming persistence. Never store secrets, credentials, or tokens; `memory_store` does not guarantee redaction, so omit or redact sensitive content first.
81
- - If no write tool is available or the write did not succeed, say the information was not persisted; never imply automatic storage or recovery. Add ADRs to the memory bank only when explicitly requested.
79
+ - Use only granted tools: Zeus has `memory_search` and temporary `context_save/get` checkpoints, but no durable writes; Mnemosyne has `memory_store` and other durable tools.
80
+ - Let native OpenCode compaction summarize active context. Use `context_save/get` only for cross-session resume; keep the goal, phase, progress, next step, decisions, blockers, and uncertain outcomes — no transcripts or routine logs.
81
+ - Store at most one concise, reusable top-level result only on explicit request. Never persist child summaries, test logs, or temporary state. Never store secrets, credentials, or tokens; confirm writes and state failures. Create ADRs only on request.
82
82
 
83
83
  <!-- Source: src/instructions/test-economy.instructions.md -->
84
84
  ## Test Economy
85
85
 
86
86
 
87
- Write the smallest test that proves the behavior: one behavior → one focused test; never duplicate coverage across suites or files.
87
+ Write one focused test per behavior; do not duplicate coverage.
88
88
 
89
- - No E2E, full-install, or network-dependent tests unless the change alters that end-to-end path; prefer unit or integration tests.
90
- - No assertions on copy/format strings, and none that only restate the implementation ("test the test").
91
- - Heavy or slow suites (real install/E2E) MUST be opt-in via a separate tier, never per edit or phase; respect a per-phase time budget and reserve the full suites for release gates.
92
- - Fixing a bug: one targeted regression test, not a broad new suite.
93
- - This economy rule does NOT weaken stronger gates: auth, security, data-integrity, and required coverage thresholds stay mandatory.
89
+ - Prefer unit/integration checks; use E2E, install, or network tests only when a change affects that path.
90
+ - Avoid assertions on copy/formatting or tests that merely restate the implementation.
91
+ - Default to focused tests; run the full suite only for scope, risk, or CI/release gates. Bug fixes need one regression test unless existing coverage catches them.
92
+ - Keep slow install/E2E suites opt-in, never per edit or phase; reserve them for release gates.
93
+ - Test economy does NOT weaken stronger gates: auth, security, data-integrity, and required coverage.
94
94
 
95
95
  <!-- Source: src/instructions/yagni.instructions.md -->
96
96
  ## YAGNI Anti-overengineering
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- pantheon:generated:begin — Pantheon-managed region; regenerated on install/upgrade, never edit inside -->
2
2
  <!-- Generated by scripts/build-agents-md.mjs — do not edit directly. -->
3
3
  <!-- Source of truth: project sections in scripts/build-agents-md.mjs. -->
4
- <!-- pantheon:agents-md v2 artifact=project generated-at=2026-10-22T13:57:53-03:00 sha=ceade5f -->
4
+ <!-- pantheon:agents-md v2 artifact=project generated-at=2026-10-27T08:34:01-03:00 sha=0a6a8e2 -->
5
5
 
6
6
  # Pantheon — Repository Setup
7
7
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  Setup: [INSTALLATION.md](docs/INSTALLATION.md).
11
11
 
12
- - Build/Test: `npm test`
12
+ - Test: focused checks by default; `npm test` for CI/release or broad/high-risk changes
13
13
  - Lint: `npm run lint`
14
14
 
15
15
  ## Teste de Instalação Global (sandbox)
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
10
10
  <!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
11
11
  move this section to a versioned entry and reset the template below. -->
12
12
 
13
+ ## [v1.6.2-beta.1] - 2026-10-27
14
+
15
+ ### Changed
16
+
17
+ - **agents** — V2 compiles declared skills into per-agent allowlists; metadata, routing, and installed skills are checked for drift.
18
+ - **memory** — Recall stays an explicit `memory_search` MCP call, session checkpoints are reserved for cross-session handoff, and native OpenCode compaction owns active-history summarization.
19
+ - **prompts** — Manual prompt templates use named `{{UPPER_SNAKE_CASE}}` inputs; slash commands keep OpenCode's native `$ARGUMENTS` expansion.
20
+ - **install** — V2 MCP entries use the native `disabled` field and migrate legacy `enabled` values.
21
+ - **install** — Existing native V2 permission arrays remain authoritative; legacy defaults are seeded only when no V2 array exists.
22
+
23
+ ### Removed
24
+
25
+ - **plugin** — Removed ambient V2 memory injection and its debug environment variable; the legacy `memory_injection` option is ignored if preserved in an existing config.
26
+
27
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
28
+ move this section to a versioned entry and reset the template below. --&gt;
13
29
  ## [v1.6.1] - 2026-10-24
14
30
 
15
31
  ### Added
package/README.md CHANGED
@@ -28,10 +28,10 @@ charge of every decision and every merge.
28
28
  collaborators.
29
29
  - **You stay in charge:** Pantheon supports your judgment; it does not replace
30
30
  it.
31
- - **Right-sized coordination:** bounded work goes to one specialist; planning,
32
- discovery, parallel work, and review are added when scope and risk call for
33
- them. `/pantheon-deepwork` remains the checkpointed workflow for heavy
34
- multi-phase work.
31
+ - **Right-sized coordination:** bounded work goes to one specialist, who
32
+ gathers the needed context. Planning, separate discovery, parallel work, and
33
+ review are added when scope and risk call for them. `/pantheon-deepwork`
34
+ remains the checkpointed workflow for heavy multi-phase work.
35
35
 
36
36
  ## Start in 2 minutes
37
37
 
@@ -46,6 +46,27 @@ npx pantheon-opencode init
46
46
  opencode
47
47
  ```
48
48
 
49
+ For the optional full setup flow, run `npm run setup`. On detected OpenCode V2,
50
+ it reviews the global config before installer init: legacy permission rules can
51
+ be migrated after explicit review. Verified Pantheon plugin/MCP entries are
52
+ reported; JSONC entries move only when order and overrides stay safe, otherwise
53
+ the user must choose to keep them in place or abort. Config migration and
54
+ installer changes are preflighted before one final authorization; `--yes` alone
55
+ does not authorize writes. Overlapping MCP wildcard policies that could allow
56
+ an action after a denial are blocked, and ineffective MCP `ask` rules matching
57
+ configured or installer-seeded servers require an explicit outcome.
58
+ Existing native V2 `permissions` arrays stay authoritative; Pantheon does not
59
+ append legacy default grants to them.
60
+ Flat third-party MCP entries in `opencode.jsonc` block V2 setup until manually
61
+ converted to `mcp.servers` or removed; nested third-party servers are preserved.
62
+ Headless/CI/non-TTY runs are preview-only and do not invoke writing init (V1
63
+ included). See the [installation guide](docs/INSTALLATION.md) for layer handling,
64
+ conflict choices, backups, and recovery.
65
+
66
+ Global `init` and `setup` use `$XDG_CONFIG_HOME/opencode` when
67
+ `XDG_CONFIG_HOME` is absolute; otherwise they use `~/.config/opencode`.
68
+ Relative `XDG_CONFIG_HOME` values are rejected before writes.
69
+
49
70
  Then describe the outcome you want:
50
71
 
51
72
  ```text
@@ -74,7 +95,57 @@ see [Quick Start](docs/QUICKSTART.md).
74
95
  - **5 local MCP servers** for project memory, persistence, resources, confined
75
96
  script execution, and vision.
76
97
  - **An optional TUI** with a dispatch sidebar block and a full-width
77
- `/dispatch` panel.
98
+ `/dispatch` panel. The V2 TUI also provides a quota overview in the
99
+ sidebar/footer and a `/quota` details panel. Quota display is enabled by
100
+ default; the sidebar keeps Todo and places quota immediately after Dispatch
101
+ (header/version → Session → Context → Git → Todo → Dispatch → quota).
102
+ Status stays in the native sidebar footer. Use `E` to disable quota or `M`
103
+ to switch between remaining and used. Quota windows show a local countdown and
104
+ the provider-reported reset date/time in UTC when valid timing is available;
105
+ missing timing is not inferred. After expiry the UI shows “aguardando
106
+ atualização” until refreshed data arrives. Empty quota gauges use a visible
107
+ track even when no usage is reported.
108
+ When a quota status request fails, the UI preserves the last valid
109
+ snapshot, marks it stale, and shows the failure cause as `Erro: <causa>`
110
+ in the sidebar and `/quota` panel (plus a `Último erro` line) instead
111
+ of a blind "Status indisponível"; the cause is logged as
112
+ `[pantheon-tui quota]`.
113
+ Usage severity uses warning color from 60% consumed and error color above 85%.
114
+ Session costs, provider balances and selected-key usage retain their distinct
115
+ labels and reported periods. Long values and states continue onto additional
116
+ lines within the sidebar's fixed 34-column content budget.
117
+ The installer selects the `plugins` component by default; in interactive setup
118
+ you can change the component selection. A component-scoped install includes
119
+ the TUI only when `plugins` is selected.
120
+ The V2 quota RPC shows providers only when OpenCode lists an active supported
121
+ connection and Pantheon can locally resolve a nonblank credential. This is
122
+ not proof that the provider accepted the credential; failed requests and
123
+ unsupported adapters can remain visible as unavailable. OpenCode Go checks
124
+ the selected Console OAuth login first, then uses an active OpenCode Go API
125
+ key (or its legacy OpenCode key alias) only when the Console request fails; a
126
+ Console 404 or a successful response without an access object reports no Go
127
+ subscription and does not fall back.
128
+ The route contract remains unofficial; see the
129
+ [quota provider coverage table](docs/tui-v2-quota-providers.md) for limits and
130
+ troubleshooting.
131
+ `/quota-go-check` is a separate manual, confirmation-gated diagnostic: one
132
+ GET to `https://opencode.ai/zen/go/v1/usage` with the configured Go API key
133
+ (not OAuth), at most one attempt per plugin runtime. It never refreshes quota,
134
+ follows redirects or retries. Only HTTP 401 bodies are inspected, up to 4096
135
+ bytes, for an own top-level JSON `error` property; its value is never inspected.
136
+ Results contain only a safe category, optional HTTP status, coarse content type,
137
+ and (for 401) whether that structure is present, absent, or unavailable.
138
+ No error code, type, message, body, request ID, or byte count is displayed;
139
+ a 401 rejection's cause remains unknown. `success` means
140
+ HTTP success only—not a stable quota contract or parsed quota correctness.
141
+ Require Themis security review before using this diagnostic.
142
+
143
+ Vision requests to OpenCode Zen require a valid active session and are rejected
144
+ before image fetching or model-catalog lookup when the session is missing or
145
+ invalid. The Python vision MCP keeps its local metadata/OCR fallback when no
146
+ gateway credential is configured. In the V2 plugin, an explicit Vision model
147
+ pin that is unavailable or ineligible returns an actionable error rather than
148
+ silently switching models; remove the pin to use automatic model discovery.
78
149
 
79
150
  Memory is used selectively: the coordinator searches once only when project
80
151
  history could affect a task, then passes relevant results to specialists. Store
@@ -90,12 +161,11 @@ contract and targets OpenCode 2 only.
90
161
  The support policy, the known-broken exception, and the verified-version
91
162
  evidence have exactly one home: [Compatibility](docs/COMPATIBILITY.md).
92
163
 
93
- ### V2 plugin options (opt-in features)
164
+ ### V2 plugin options
94
165
 
95
166
  The OpenCode V2 host hands a plugin its `options` only from the object form of
96
- the entry, and two features — per-request context pruning and ambient memory
97
- injection — read exactly that bag. `init` therefore writes the object form, so
98
- enabling them is one edit away and nothing is on by default:
167
+ the entry. `init` writes that form for the optional per-request context pruner;
168
+ memory retrieval stays an explicit `memory_search` MCP call.
99
169
 
100
170
  ```json
101
171
  {
@@ -103,30 +173,28 @@ enabling them is one edit away and nothing is on by default:
103
173
  {
104
174
  "package": "/path/to/pantheon-opencode/src/plugin-v2",
105
175
  "options": {
106
- "context_pruner": { "enabled": true },
107
- "memory_injection": { "enabled": true }
176
+ "context_pruner": { "enabled": true }
108
177
  }
109
178
  }
110
179
  ]
111
180
  }
112
181
  ```
113
182
 
114
- Keep the `package` value `init` wrote and add keys inside `options`; any key you
115
- add by hand survives a re-run. Both features are off unless `enabled` is
183
+ Keep the `package` value `init` wrote and add keys inside `options`; custom
184
+ options survive a re-run. The context pruner is off unless `enabled` is
116
185
  literally `true`.
117
186
 
118
187
  | Option | Default | Effect |
119
188
  |---|---|---|
120
189
  | `options.context_pruner.enabled` | `false` | Prune old turns from the request payload and at compaction. Off by default because per-request pruning invalidates the provider prompt cache. |
121
- | `options.memory_injection.enabled` | `false` | Ride the most relevant memory entries along on the session's first request, bounded by `maxEntries`/`maxChars`. |
122
190
 
123
191
  `context_pruner` also accepts `keepTurns`, `purgeAfterTurns`, `protectedTools`,
124
- `minSavingsTokens` and `charsPerToken`; `memory_injection` accepts `maxEntries`,
125
- `maxChars` and `namespace`. Unknown keys are ignored with a one-time warning in
126
- the hook log, so a typo cannot silently change behaviour. Run
192
+ `minSavingsTokens` and `charsPerToken`. Unknown keys are ignored with a
193
+ one-time warning in the hook log, so a typo cannot silently change behaviour. Run
127
194
  `npx pantheon-opencode doctor` to see whether the installed entry can receive
128
- options at all. Full rules: [OpenCode V2](docs/opencode-v2.md) and
129
- [Memory](docs/MEMORY.md).
195
+ options at all. An old `memory_injection` option may remain in an existing
196
+ config because user options are preserved, but the plugin no longer reads it.
197
+ Full rules: [OpenCode V2](docs/opencode-v2.md) and [Memory](docs/MEMORY.md).
130
198
 
131
199
  ## Delegation
132
200
 
@@ -189,6 +257,10 @@ welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull
189
257
  request. That file also defines the documentation rule: one home per fact, with
190
258
  a short list of facts that must not be duplicated.
191
259
 
260
+ For code changes, run the smallest relevant check and expand it to match the
261
+ change's risk. `npm test` is the full repository suite; see
262
+ [CONTRIBUTING.md](CONTRIBUTING.md) for when to use it.
263
+
192
264
  ## Citation and DOI
193
265
 
194
266
  Pantheon is released under the [MIT License](LICENSE). Cite the
package/README.pt-BR.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- synced-from: README.md @ 7359e4f -->
1
+ <!-- synced-from: README.md @ 0a6a8e2 -->
2
2
  # Pantheon
3
3
 
4
4
  **Uma forma mais clara de trabalhar com OpenCode em projetos de software
@@ -29,10 +29,10 @@ o que importou. Você continua no controle de cada decisão e de cada merge.
29
29
  - **Um ponto de partida repetível:** o mesmo setup entre projetos e
30
30
  colaboradores.
31
31
  - **Você no comando:** o Pantheon apoia seu julgamento; não o substitui.
32
- - **Coordenação na medida:** trabalho limitado vai para um especialista;
33
- planejamento, descoberta, trabalho paralelo e revisão entram quando escopo e
34
- risco pedem. `/pantheon-deepwork` continua sendo o fluxo com checkpoints para
35
- trabalho pesado em várias fases.
32
+ - **Coordenação na medida:** trabalho delimitado vai para um especialista, que
33
+ reúne o contexto necessário. Planejamento, descoberta separada, paralelismo e
34
+ revisão entram quando escopo e risco pedem. `/pantheon-deepwork` continua sendo
35
+ o fluxo com checkpoints para trabalho pesado em várias fases.
36
36
 
37
37
  ## Comece em 2 minutos
38
38
 
@@ -78,10 +78,11 @@ apenas — `init` → reiniciar → `/dispatch` → primeiro resultado — veja
78
78
  - **Uma TUI opcional**, com bloco de dispatch na sidebar e painel `/dispatch`
79
79
  em largura total.
80
80
 
81
- A memória é usada seletivamente: o coordenador busca uma vez apenas quando o
82
- histórico do projeto pode afetar a tarefa e repassa os resultados relevantes aos
83
- especialistas. Grave um resultado conciso e reutilizável ao concluir a tarefa
84
- quando ele for importar depois; resumos rotineiros de filhos ficam no handoff.
81
+ A memória MCP fica disponível para busca explícita: o coordenador consulta o
82
+ histórico uma vez quando ele pode mudar a tarefa e repassa apenas resultados
83
+ úteis. Checkpoints de sessão servem para retomadas entre sessões; memória
84
+ durável só é gravada quando solicitada ou autorizada. A compactação nativa do
85
+ OpenCode resume a conversa atual, sem salvar cada fase em outro MCP.
85
86
  Veja [Memória](docs/MEMORY.md).
86
87
 
87
88
  ## Compatibilidade
@@ -155,6 +156,10 @@ bem-vindos. Leia o [CONTRIBUTING.md](CONTRIBUTING.md) antes de abrir uma issue o
155
156
  pull request. Esse arquivo também define a regra de documentação: um único lar
156
157
  por fato, com uma lista curta de fatos que não devem ser duplicados.
157
158
 
159
+ Em mudanças de código, comece pela verificação relevante mais pequena e amplie
160
+ conforme o risco. `npm test` executa a suíte completa do repositório; veja o
161
+ [CONTRIBUTING.md](CONTRIBUTING.md) para saber quando usá-la.
162
+
158
163
  ## Citação e DOI
159
164
 
160
165
  O Pantheon é distribuído sob a [Licença MIT](LICENSE). Cite o
@@ -21,16 +21,18 @@
21
21
  * (scripts/install/opencode-state.mjs).
22
22
  */
23
23
  import fs from 'node:fs'
24
- import os from 'node:os'
25
24
  import path from 'node:path'
26
25
  import { fileURLToPath } from 'node:url'
27
26
  import { configure as configureUi, endGaugeLine, tag } from '../scripts/install/cli-ui.mjs'
28
27
  import { resolveComponentSelection } from '../scripts/install/component-selection.mjs'
28
+ import { resolveGlobalConfigDirectory } from '../scripts/install/config-paths.mjs'
29
29
  import { resolveInstallExitCode } from '../scripts/install/exit-codes.mjs'
30
30
  import { createInterruptHandler } from '../scripts/install/interrupt.mjs'
31
+ import { parseOpenCodeVersion } from '../scripts/install/opencode-version.mjs'
31
32
  import {
32
33
  createPlanArtifact,
33
34
  loadPlanArtifact,
35
+ planArtifactDigest,
34
36
  savePlanArtifact,
35
37
  } from '../scripts/install/plan-artifact.mjs'
36
38
  import { PROMPT_CANCELED } from '../scripts/install/prompt-result.mjs'
@@ -239,9 +241,7 @@ async function main() {
239
241
  }
240
242
  }
241
243
 
242
- const presetDir = isProject
243
- ? process.cwd()
244
- : path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'opencode')
244
+ const presetDir = isProject ? process.cwd() : resolveGlobalConfigDirectory(process.env)
245
245
  const filePath = path.join(presetDir, '.pantheon', 'active-preset.json')
246
246
  const bakPath = path.join(presetDir, '.pantheon', 'active-preset.json.bak')
247
247
 
@@ -329,7 +329,24 @@ async function main() {
329
329
  }
330
330
  }
331
331
  const isProject = reviewedPlan ? reviewedPlan.options.isProject : args.includes('--project')
332
+ const setupTarget = !reviewedPlan ? process.env.PANTHEON_SETUP_TARGET : undefined
333
+ if (setupTarget !== undefined) {
334
+ const expectedGlobalTarget = path.resolve(resolveGlobalConfigDirectory(process.env))
335
+ if (isProject || path.resolve(setupTarget) !== expectedGlobalTarget) {
336
+ console.error(
337
+ '❌ Invalid setup target; it must match the selected global OpenCode config directory',
338
+ )
339
+ process.exit(1)
340
+ }
341
+ }
332
342
  const isDryRun = reviewedPlan ? false : args.includes('--dry-run')
343
+ const setupConfigPreview = args.includes('--setup-config-preview-stdin')
344
+ const setupPlanJson = args.includes('--setup-plan-json')
345
+ const setupApprovedPlanInput = args.includes('--setup-approved-plan-stdin')
346
+ if (setupConfigPreview && !isDryRun) {
347
+ console.error('❌ Setup config previews are accepted only by init --dry-run')
348
+ process.exit(1)
349
+ }
333
350
  // --clean is an alias of --force (both wipe component dirs + recreate venv).
334
351
  const forceReinstall = reviewedPlan
335
352
  ? reviewedPlan.options.clean
@@ -339,6 +356,17 @@ async function main() {
339
356
  const forceHeadless = args.includes('--headless')
340
357
  let autoYes = args.includes('--yes') || args.includes('-y')
341
358
  const isJson = args.includes('--json')
359
+ if (setupPlanJson && (!isDryRun || !isJson || reviewedPlan)) {
360
+ console.error('❌ Setup plan output is available only with init --dry-run --json')
361
+ process.exit(1)
362
+ }
363
+ if (
364
+ setupApprovedPlanInput &&
365
+ (isDryRun || !autoYes || !forceHeadless || reviewedPlan || setupConfigPreview)
366
+ ) {
367
+ console.error('❌ An approved setup plan is accepted only by authorized headless init')
368
+ process.exit(1)
369
+ }
342
370
  const savePlanIndex = args.indexOf('--save-plan')
343
371
  const inlineSavePlan = args.find((arg) => arg.startsWith('--save-plan='))
344
372
  const savePlanPath =
@@ -400,6 +428,9 @@ async function main() {
400
428
  '--yes',
401
429
  '-y',
402
430
  '--json',
431
+ '--setup-config-preview-stdin',
432
+ '--setup-plan-json',
433
+ '--setup-approved-plan-stdin',
403
434
  '--verbose',
404
435
  ].includes(bare)
405
436
  ) {
@@ -440,16 +471,7 @@ async function main() {
440
471
  // --version v1|v2|auto labels the install target. `auto` resolves the
441
472
  // generation from the opencode binary at install time (see
442
473
  // scripts/install/opencode-version.mjs). Invalid values fail fast.
443
- const versionIndex = args.indexOf('--version')
444
- const legacyVersionIndex = args.indexOf('--opencode-version')
445
- const inlineVersion = args.find((arg) => arg.startsWith('--opencode-version='))
446
- const versionOpt = reviewedPlan
447
- ? reviewedPlan.options.version
448
- : versionIndex >= 0
449
- ? (args[versionIndex + 1] ?? null)
450
- : legacyVersionIndex >= 0
451
- ? (args[legacyVersionIndex + 1] ?? null)
452
- : (inlineVersion?.split('=', 2)[1] ?? null)
474
+ const versionOpt = reviewedPlan ? reviewedPlan.options.version : parseOpenCodeVersion(args)
453
475
  if (
454
476
  versionOpt !== null &&
455
477
  versionOpt !== 'v1' &&
@@ -502,9 +524,7 @@ async function main() {
502
524
  // interactive prompts can cancel before a location is chosen. Mirrors the
503
525
  // installer's own default (`~/.config/opencode`), so the record lands next
504
526
  // to the config the next run will read.
505
- const fallbackTarget = isProject
506
- ? process.cwd()
507
- : path.join(os.homedir(), '.config', 'opencode')
527
+ const fallbackTarget = isProject ? process.cwd() : resolveGlobalConfigDirectory(process.env)
508
528
  /**
509
529
  * Persist the one-line record of this run. Bookkeeping is best-effort: a
510
530
  * failure is reported, never fatal, and never changes the exit code.
@@ -608,7 +628,49 @@ async function main() {
608
628
  let installError = null
609
629
  try {
610
630
  const { installOpenCode } = await import('../scripts/install/opencode.mjs')
611
- const target = reviewedPlan ? reviewedPlan.target.path : isProject ? process.cwd() : undefined
631
+ let configPreview = null
632
+ let setupApprovedPlan = null
633
+ if (setupConfigPreview) {
634
+ try {
635
+ configPreview = fs.readFileSync(0, 'utf8')
636
+ if (configPreview.length === 0) throw new Error('empty')
637
+ } catch {
638
+ throw new Error('The setup config preview input is invalid.')
639
+ }
640
+ }
641
+ if (setupApprovedPlanInput) {
642
+ try {
643
+ const envelope = JSON.parse(fs.readFileSync(0, 'utf8'))
644
+ if (
645
+ envelope?.schema_version !== 1 ||
646
+ !envelope.plan ||
647
+ !Array.isArray(envelope.configPreconditions) ||
648
+ typeof envelope.digest !== 'string' ||
649
+ planArtifactDigest(envelope.plan) !== envelope.digest
650
+ ) {
651
+ throw new Error('invalid setup plan envelope')
652
+ }
653
+ if (envelope.configPreconditions.length > 0) {
654
+ const { verifyConfigPreconditions } = await import('../scripts/setup-v2-config.mjs')
655
+ if (
656
+ !verifyConfigPreconditions(envelope.configPreconditions, {
657
+ configDir: setupTarget,
658
+ stage: 'expected',
659
+ })
660
+ ) {
661
+ throw new Error('reviewed config inputs changed')
662
+ }
663
+ }
664
+ setupApprovedPlan = envelope
665
+ } catch {
666
+ throw new Error('The approved setup plan or config snapshots are invalid or drifted.')
667
+ }
668
+ }
669
+ const target = reviewedPlan
670
+ ? reviewedPlan.target.path
671
+ : isProject
672
+ ? process.cwd()
673
+ : setupTarget
612
674
  result = await installOpenCode(target, isDryRun, forceReinstall, components, {
613
675
  interactive: forceInteractive,
614
676
  headless: reviewedPlan ? true : forceHeadless,
@@ -618,12 +680,14 @@ async function main() {
618
680
  preset: presetOpt,
619
681
  version: versionOpt ?? 'auto',
620
682
  mergeDevConfig: mergeDevConfigOpt,
621
- expectedPlan: reviewedPlan,
683
+ expectedPlan: reviewedPlan ?? setupApprovedPlan?.plan ?? null,
684
+ isProject,
622
685
  requestedComponents: requestedComponentsForPrompt,
623
686
  noMcp: skipMCP,
624
687
  planTimestamp,
625
688
  quiet: isJson,
626
689
  verbose: args.includes('--verbose') && !isJson,
690
+ configPreview,
627
691
  })
628
692
  } catch (err) {
629
693
  installError = err
@@ -700,6 +764,26 @@ async function main() {
700
764
  if (Object.hasOwn(totals, file.action)) totals[file.action] += 1
701
765
  }
702
766
  const mcpServers = result.mcpServers ?? []
767
+ const setupPlan = setupPlanJson
768
+ ? createPlanArtifact({
769
+ target: result.target,
770
+ packageRoot: ROOT,
771
+ packageVersion: version,
772
+ plannedAt: planTimestamp,
773
+ options: {
774
+ clean: forceReinstall,
775
+ components,
776
+ version: result.openCodeVersion,
777
+ isProject,
778
+ model: modelOpt,
779
+ smallModel: smallModelOpt,
780
+ preset: presetOpt,
781
+ mergeDevConfig: mergeDevConfigOpt,
782
+ },
783
+ files: result.files,
784
+ snapshots: result.snapshots,
785
+ })
786
+ : null
703
787
  process.stdout.write(
704
788
  `${JSON.stringify({
705
789
  schema_version: 1,
@@ -734,6 +818,9 @@ async function main() {
734
818
  bytes,
735
819
  })),
736
820
  saved_plan: savePlanPath ? path.resolve(savePlanPath) : null,
821
+ ...(setupPlan
822
+ ? { setup_plan: setupPlan, setup_plan_digest: planArtifactDigest(setupPlan) }
823
+ : {}),
737
824
  })}\n`,
738
825
  )
739
826
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.1",
3
+ "version": "1.6.2-beta.1",
4
4
  "description": "Multi-agent orchestration for OpenCode — 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -18,8 +18,9 @@
18
18
  "scripts": {
19
19
  "postinstall": "node scripts/postinstall.mjs && node scripts/sync-tui.mjs",
20
20
  "prepare": "husky",
21
- "setup": "node bin/pantheon-init.mjs init --yes",
21
+ "setup": "node scripts/setup.mjs",
22
22
  "build:agents-md": "node scripts/build-agents-md.mjs",
23
+ "skills:lock": "node scripts/update-skills-lock.mjs",
23
24
  "setup:lite": "node bin/pantheon-init.mjs init --yes --clean --components agents,skills,instructions",
24
25
  "doctor": "node scripts/doctor.mjs",
25
26
  "prune": "node scripts/prune.mjs",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.1",
4
+ "version": "1.6.2-beta.1",
5
5
  "displayName": "Pantheon",
6
6
  "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
7
7
  "agents": "./src/agents",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
4
4
 
5
5
  [project]
6
6
  name = "pantheon"
7
- version = "1.6.1"
7
+ version = "1.6.2-beta.1"
8
8
  description = "Multi-agent orchestration framework"
9
9
  requires-python = ">=3.11"
10
10
  # Python sources under src/mcp/ import fastmcp/pydantic at runtime, but those
@@ -133,7 +133,7 @@ const PROJECT_HEADER = `# Pantheon — Repository Setup
133
133
 
134
134
  Setup: [INSTALLATION.md](docs/INSTALLATION.md).
135
135
 
136
- - Build/Test: \`npm test\`
136
+ - Test: focused checks by default; \`npm test\` for CI/release or broad/high-risk changes
137
137
  - Lint: \`npm run lint\`
138
138
 
139
139
  ## Teste de Instalação Global (sandbox)