pantheon-opencode 1.5.0-beta.2 → 1.5.0-beta.20

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 (107) hide show
  1. package/.pantheon/code-mode/manifest.json +21 -0
  2. package/AGENTS.md +14 -63
  3. package/CHANGELOG.md +1260 -0
  4. package/README.md +162 -23
  5. package/README.pt-BR.md +104 -19
  6. package/bin/pantheon-init.mjs +178 -21
  7. package/commands/pantheon.md +1 -35
  8. package/package.json +23 -15
  9. package/plugin.json +1 -1
  10. package/pyproject.toml +62 -0
  11. package/scripts/code_mode_server.py +431 -55
  12. package/scripts/doctor.mjs +207 -9
  13. package/scripts/install/cli-ui.mjs +17 -11
  14. package/scripts/install/config-migration.mjs +4 -6
  15. package/scripts/install/opencode.mjs +137 -35
  16. package/scripts/install/plugin.mjs +12 -45
  17. package/scripts/install/shared.mjs +43 -2
  18. package/scripts/install/strings.mjs +129 -0
  19. package/scripts/install-mcp.mjs +1 -0
  20. package/scripts/manifest-inventory.mjs +410 -0
  21. package/scripts/mcp_persistence_server.py +536 -164
  22. package/scripts/package-evidence.mjs +242 -0
  23. package/scripts/probe-pantheon-cost.mjs +10 -1
  24. package/scripts/release-beta-version.mjs +56 -60
  25. package/scripts/sync-artifacts.mjs +169 -0
  26. package/scripts/sync-tui.mjs +129 -64
  27. package/scripts/test-opencode-v1-v2-sandbox.sh +79 -161
  28. package/scripts/validation-policy.mjs +7 -7
  29. package/scripts/version-check.mjs +113 -108
  30. package/scripts/versioning.mjs +230 -86
  31. package/src/agents/apollo.md +1 -0
  32. package/src/agents/gaia.md +1 -0
  33. package/src/agents/mnemosyne.md +1 -1
  34. package/src/agents/zeus.md +11 -54
  35. package/src/instructions/memory-protocol.instructions.md +6 -3
  36. package/src/instructions/zeus-anti-stall.instructions.md +2 -4
  37. package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
  38. package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
  39. package/src/mcp/code_mode_server.py +431 -55
  40. package/src/mcp/mcp_persistence_server.py +536 -164
  41. package/src/mcp/toon_codec.py +2 -4
  42. package/src/pantheon/background-job-board.ts +47 -5
  43. package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
  44. package/src/pantheon/cost-command.ts +309 -44
  45. package/src/pantheon/delegation-enforce.ts +59 -14
  46. package/src/pantheon/file-persistence-salvage.ts +64 -0
  47. package/src/pantheon/file-persistence.ts +194 -45
  48. package/src/pantheon/goal-loop.ts +1 -1
  49. package/src/pantheon/goal-store.ts +1 -1
  50. package/src/pantheon/idle-continuation.ts +4 -6
  51. package/src/pantheon/model-command.ts +1 -2
  52. package/src/pantheon/native-task-status.ts +139 -0
  53. package/src/pantheon/presets.d.mts +0 -20
  54. package/src/pantheon/presets.mjs +0 -64
  55. package/src/pantheon/session-guard.ts +2 -2
  56. package/src/pantheon/session-id.ts +30 -0
  57. package/src/pantheon/shared-board.ts +37 -0
  58. package/src/pantheon/task-result-guard.ts +106 -0
  59. package/src/pantheon/todo-enforcer.ts +3 -3
  60. package/src/pantheon/tool-ceiling.ts +159 -0
  61. package/src/pantheon/tool-context.ts +23 -0
  62. package/src/pantheon/v2-bridge.ts +1 -4
  63. package/src/plugin-v2.ts +8 -21
  64. package/src/plugin.ts +83 -251
  65. package/src/plugins/pantheon-hooks.ts +51 -0
  66. package/src/plugins/tui/dist/server.d.ts +1 -1
  67. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  68. package/src/plugins/tui/dist/server.js +1 -1
  69. package/src/plugins/tui/dist/server.js.map +1 -1
  70. package/src/plugins/tui/dist/tui.d.ts +261 -77
  71. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  72. package/src/plugins/tui/dist/tui.js +640 -234
  73. package/src/plugins/tui/dist/tui.js.map +1 -1
  74. package/src/plugins/tui/package-lock.json +2 -2
  75. package/src/plugins/tui/package.json +2 -2
  76. package/src/plugins/tui/src/index.tsx +872 -226
  77. package/src/routing.yml +0 -16
  78. package/src/skills/context-compression/SKILL.md +1 -1
  79. package/scripts/generate-preset-docs.mjs +0 -300
  80. package/scripts/generate-prompts.sh +0 -222
  81. package/scripts/hash_verify.py +0 -192
  82. package/scripts/install/component.mjs +0 -24
  83. package/scripts/install/migrate-config.mjs +0 -302
  84. package/scripts/test-context-compression.sh +0 -169
  85. package/src/pantheon/auto-wake.ts +0 -89
  86. package/src/pantheon/chat-reminders.ts +0 -9
  87. package/src/pantheon/comment-checker.ts +0 -48
  88. package/src/pantheon/compaction-assert.ts +0 -160
  89. package/src/pantheon/cost-tracker.ts +0 -108
  90. package/src/pantheon/delegate-manager.ts +0 -669
  91. package/src/pantheon/delegation-classifier.ts +0 -307
  92. package/src/pantheon/delegation-finalize.ts +0 -374
  93. package/src/pantheon/delegation-notify.ts +0 -212
  94. package/src/pantheon/delegation-toast.ts +0 -73
  95. package/src/pantheon/delegation.ts +0 -1120
  96. package/src/pantheon/dispatch-guard.ts +0 -109
  97. package/src/pantheon/permission-eval.ts +0 -284
  98. package/src/pantheon/preemptive-compact.ts +0 -76
  99. package/src/pantheon/retry-policy.ts +0 -212
  100. package/src/pantheon/step-cap.ts +0 -110
  101. package/src/pantheon/token-opt.ts +0 -781
  102. package/src/pantheon/toon-codec.ts +0 -481
  103. package/src/pantheon/v2-events.ts +0 -131
  104. package/src/pantheon/v2-hooks.ts +0 -287
  105. package/src/pantheon/v2-tool-definitions.ts +0 -331
  106. package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
  107. package/src/plugins/tui/dist/tui.tsx +0 -2605
package/README.md CHANGED
@@ -8,7 +8,7 @@ want useful structure without giving up control of their code.
8
8
  [Português (Brasil)](README.pt-BR.md) ·
9
9
  [Repository](https://github.com/ils15/pantheon-opencode) · [MIT License](LICENSE)
10
10
 
11
- [![Version](https://img.shields.io/github/v/release/ils15/pantheon-opencode?label=version)](https://github.com/ils15/pantheon-opencode/releases/tag/v1.5.0)
11
+ [![Version](https://img.shields.io/github/v/release/ils15/pantheon-opencode?label=version)](https://github.com/ils15/pantheon-opencode/releases/latest)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/ils15/pantheon-opencode/ci.yml?branch=main&label=CI)](https://github.com/ils15/pantheon-opencode/actions)
13
13
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22306637.svg)](https://doi.org/10.5281/zenodo.22306637)
14
14
 
@@ -30,7 +30,7 @@ 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 18+.
33
+ Requirements: [OpenCode 1.18.4+](https://opencode.ai/docs/) and Node.js 22+.
34
34
 
35
35
  From the project where you want to use Pantheon:
36
36
 
@@ -70,13 +70,83 @@ clear handoff between stages of work.
70
70
 
71
71
  ## Status
72
72
 
73
- Current release: **v1.5.0**. Pantheon is designed for OpenCode and depends on
74
- the availability and configuration of OpenCode and any optional services you
75
- choose to use. Check the [releases](https://github.com/ils15/pantheon-opencode/releases)
76
- and [changelog](CHANGELOG.md) for the latest changes.
73
+ Operational checkout version: **v1.5.0-beta.2** (candidate; publication is not
74
+ asserted here). Pantheon is designed for OpenCode and depends on the
75
+ availability and configuration of OpenCode and any optional services you choose
76
+ to use. Check the [releases](https://github.com/ils15/pantheon-opencode/releases)
77
+ and [changelog](CHANGELOG.md) for the latest published changes.
78
+
79
+ ## Delegation (native `task()`)
80
+
81
+ Pantheon delegates exclusively through OpenCode's native `task()` child-session
82
+ engine. The former custom `pantheon_delegate` tool and the V1 delegation engine
83
+ (`delegation.ts`, `delegate-manager.ts` and supporting modules) were removed;
84
+ there is no Pantheon-specific delegation tool surface to configure. See
85
+ [ADR-0011](.pantheon/memory-bank/adr/0011-delegation-engine-contract.md) for the
86
+ historical engine contract.
87
+
88
+ ## Cost tool backend
89
+
90
+ `pantheon_cost` prefers a read-only `node:sqlite` backend against the selected
91
+ `opencode.db`. When `node:sqlite` is unavailable in the host runtime (for
92
+ example under Bun), the tool falls back to spawning `node scripts/cost.mjs` as
93
+ a read-only subprocess. The fallback resolves a real Node.js binary —
94
+ `PANTHEON_NODE` first, then `node` on `PATH` — verifies it supports
95
+ `node:sqlite` (Node.js >= 22.5), and runs the script with an argument array,
96
+ never a shell. If neither source resolves, the tool returns `status:
97
+ UNSUPPORTED`. Database failures return a contract status such as `UNAVAILABLE`
98
+ or `CORRUPT_DATA` and include diagnostic detail, including captured stderr when
99
+ available.
77
100
 
101
+ | Variable | Default | Purpose |
102
+ |----------|---------|---------|
103
+ | `PANTHEON_NODE` | `node` from `PATH` | Path to a Node.js >= 22.5 binary used by the CLI fallback; an explicit path must exist and be executable, otherwise the tool fails fast instead of ignoring the override |
104
+
105
+
106
+ ## Code-mode execution (explicit opt-in)
107
+
108
+ Scripts run through the `pantheon-code-mode` MCP server (`execute_code_script`)
109
+ only when they are explicitly approved. Approval is recorded in
110
+ `.pantheon/code-mode/manifest.json` with the SHA-256 of each script:
111
+
112
+ ```json
113
+ {
114
+ "version": 1,
115
+ "scripts": {
116
+ "example-sync.sh": "<sha256>"
117
+ }
118
+ }
119
+ ```
120
+
121
+ - **No manifest → nothing executes.** A missing manifest returns
122
+ `INVALID_STATE`; scripts are never run implicitly.
123
+ - **Not listed → `CONFLICT`.** The script must be approved first.
124
+ - **Hash mismatch → `CORRUPT_DATA`.** The SHA-256 of the file on disk must
125
+ match the manifest entry, so edits after approval are detected.
126
+
127
+ Approve or re-approve a script with the `approve_code_script` MCP tool:
128
+
129
+ ```
130
+ approve_code_script("checkpoint-session.sh")
131
+ ```
132
+
133
+ The installer seeds the manifest with the SHA-256 of every bundled script, so
134
+ shipped scripts stay approved across installs. Re-run `approve_code_script`
135
+ after intentionally editing a script. Status codes follow the shared nine-code
136
+ contract (`OK`, `UNSUPPORTED`, `UNAVAILABLE`, `INVALID_INPUT`, `INVALID_STATE`,
137
+ `CONFLICT`, `CORRUPT_DATA`, `TIMEOUT`, `ESCALATE`); with `json_output=true`,
138
+ results carry a `status` field.
78
139
 
79
- ## What's new in 1.5.0
140
+ Code-mode resolves project-first: `.opencode/.pantheon/code-mode` is preferred,
141
+ then `.pantheon/code-mode`. `PANTHEON_PROJECT` overrides the working directory,
142
+ and the installed MCP uses `cwd: "."` so OpenCode supplies the workspace. A
143
+ global directory is used only when no usable project directory is available;
144
+ once a project directory is selected, a missing or corrupt manifest fails
145
+ closed instead of falling back. `doctor` validates the manifest and every
146
+ script's SHA-256 without regenerating it.
147
+
148
+
149
+ ## What's new in 1.5.0-beta.2
80
150
 
81
151
  - OpenCode-only installer: platform guides consolidated into a single
82
152
  [OpenCode guide](docs/platforms/opencode.md).
@@ -91,11 +161,10 @@ and [changelog](CHANGELOG.md) for the latest changes.
91
161
  covering OpenCode V1/V2 side by side — see
92
162
  [Sandbox validation](#sandbox-validation-v1v2).
93
163
  - Beta2 agent-economy policy: direct native delegation, bounded compaction
94
- carry-forward, compact context encoding, and quality floors — see
95
- [Beta2 agent economy policy](docs/ws3-token-opt-measurements.md#beta2-agent-economy-policy).
164
+ carry-forward, compact context encoding, and quality floors.
96
165
  - A `--prompts` installer flag is planned for a future release.
97
166
 
98
- ## OpenCode V1/V2 — Dual Version (1.5.0)
167
+ ## OpenCode V1/V2 — Dual Version (1.5.0-beta.2)
99
168
 
100
169
  Pantheon has two **exclusive** OpenCode plugin contracts. Ordinary OpenCode
101
170
  configuration may be shared, but the Pantheon plugin registration is selected
@@ -105,23 +174,22 @@ per installation; V1 and V2 Pantheon plugins must never be registered together.
105
174
  |---|---|---|
106
175
  | OpenCode config key | singular `plugin` | plural `plugins` |
107
176
  | Pantheon registration | `src/plugin.ts` plus `src/plugins/pantheon-hooks.ts` | `<installed>/src/plugin-v2` directory (`index.ts` re-exports `src/plugin-v2.ts`) |
108
- | 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 |
177
+ | 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 |
109
178
  | V1 APIs | Registered | Own tool definitions via `ctx.tool.transform()` — not the V1 plugin path |
110
179
 
111
- The V2 plugin provides 9 orchestration tools (`pantheon_delegate`,
112
- `pantheon_delegation_read`, `pantheon_delegation_list`, `hashline_edit`,
180
+ The V2 plugin provides 6 orchestration tools (`hashline_edit`,
113
181
  `pantheon_goal_create`, `pantheon_goal_get`, `pantheon_goal_update`,
114
182
  `pantheon_cost`, `pantheon_model`), 4 event subscriptions (`session.created`,
115
183
  `session.idle`, `session.error`, `session.compacted`), session hooks (`prompt`,
116
184
  `context`), and tool hooks (`execute.before`, `execute.after`). The only
117
- unsupported V2 feature is `legacy-hooks` (the V1-specific delegate API surface).
185
+ unsupported V2 feature is `legacy-hooks` (the V1-specific hook surface).
118
186
 
119
187
  The package exposes both contracts as importable exports: `pantheon-opencode/plugin`
120
188
  (V1), `pantheon-opencode/plugin-v2` (V2) and `pantheon-opencode/v2-bridge`
121
189
  (optional interop), so a host can load either contract explicitly.
122
190
 
123
191
  The V1→V2 bridge (`src/pantheon/v2-bridge.ts`) enables optional interop:
124
- V1 infrastructure singletons (BackgroundJobBoard, DelegationClient, GoalStore,
192
+ V1 infrastructure singletons (BackgroundJobBoard, GoalStore,
125
193
  TodoEnforcer, VisionHandler) are passed through V2 `ctx.options`. The bridge is
126
194
  optional — V2 works standalone with graceful degradation.
127
195
 
@@ -153,9 +221,56 @@ The installer still writes the compatibility settings required by the selected
153
221
  OpenCode host, such as `experimental.subagent_depth`; this does not convert a
154
222
  V1 plugin into V2 or provide V2 with V1 hooks.
155
223
 
156
- ## Beta releases
224
+ ## Updating between releases (beta.5+)
225
+
226
+ One command keeps an existing installation current:
227
+
228
+ ```bash
229
+ # Without a global install, ALWAYS pin the dist-tag — plain `npx
230
+ # pantheon-opencode` resolves `latest`, which is the stable release (1.4.3):
231
+ npx pantheon-opencode@beta update # npm beta channel + config refresh
232
+ npx pantheon-opencode@beta update --stable # stable channel instead
233
+
234
+ # With a global install, use the global bin (defaults to the beta channel):
235
+ pantheon-opencode update
236
+ ```
157
237
 
158
- A pull request labeled exactly `release:beta` triggers the beta release path. See [docs/RELEASING.md](docs/RELEASING.md) for validation and recovery details.
238
+ `update` compares your installed version with the npm dist-tag, runs
239
+ `npm install -g pantheon-opencode@<channel>`, then re-runs `init --yes
240
+ --headless` so config merges, the venv and MCP entries match the new package.
241
+ Two freshness guarantees back it up:
242
+
243
+ - **Postinstall artifact sync** — after any `npm install`, copy-only artifacts
244
+ (agents, skills, AGENTS.md, commands, MCP scripts, code-mode payload) are
245
+ refreshed into the existing config dir automatically; you never have to
246
+ re-run `init` just for file copies.
247
+ - **Drift detection** — the installer stamps the installed version in
248
+ `.pantheon/install-state.json` and `doctor` warns when the package is newer
249
+ than the last sync, pointing at `update`.
250
+
251
+ `init` also gained `--components agents,skills,...` (narrow install),
252
+ `--clean` (alias of `--force`), `--opencode-version auto`, atomic config
253
+ writes with an `opencode.json.bak` backup, preflight checks for python3/npm
254
+ before any file is written, and a non-fatal Python runtime: if the venv fails,
255
+ the install completes but MCP entries are omitted (with a warning) instead of
256
+ pointing at a broken interpreter. Installer messages auto-detect pt-BR via
257
+ `LANG`/`LC_ALL`.
258
+
259
+ ## Releases
260
+
261
+ Publication is authorized **only** by an explicit `workflow_dispatch` of the
262
+ `Release` workflow (`release_channel` input selects beta or stable). PR labels,
263
+ pushes, merges, and tags never publish anything, and every validation gate is
264
+ fail-closed: only an explicit PASS authorizes release evidence. See
265
+ [docs/RELEASING.md](docs/RELEASING.md) for validation and recovery details.
266
+
267
+ Release validation keeps each manifest with its lockfile: the root
268
+ `package.json` + `package-lock.json` and the TUI
269
+ `src/plugins/tui/package.json` + `src/plugins/tui/package-lock.json`. Both use
270
+ `npm ci --ignore-scripts`; an `npm ci` failure blocks the run and there is no
271
+ `npm install` fallback. A release carries one `.tgz` tarball, computes the
272
+ SHA-256 of that same artifact, and binds the tarball and GitHub release to the
273
+ full `TARGET_SHA`; a second pack is not interchangeable.
159
274
 
160
275
  ## Sandbox validation (V1/V2)
161
276
 
@@ -164,9 +279,9 @@ package as a real user inside an isolated sandbox (own `HOME`, npm prefix and
164
279
  venv) — never the dev environment. It checks OpenCode V1 (`opencode`) and V2
165
280
  (`opencode2`) side by side: binaries, MCP connectivity, `doctor`, and — with
166
281
  `--prompts` — a prompt battery covering the `pantheon://agents` resource,
167
- memory store/recall, filesystem writes and agent delegation. Environmental
168
- failures (network, provider auth, Docker) are classified as `AMBIENTAL` and
169
- never fail the run; only real failures do.
282
+ memory store/recall, filesystem writes and agent delegation. The gate is
283
+ fail-closed: every required check must return an explicit PASS; timeouts,
284
+ auth/network/provider failures and missing prerequisites block the run.
170
285
 
171
286
  ```bash
172
287
  scripts/test-opencode-v1-v2-sandbox.sh --prepare # tarball + install + init in the sandbox
@@ -180,6 +295,9 @@ Modes are combinable (e.g. `--prepare --run v1 --prompts`). Binaries are
180
295
  resolved strictly inside the sandbox npm prefix — a non-prepared sandbox fails
181
296
  fast instead of silently testing the host installation.
182
297
 
298
+ This validates the prepared isolated sandbox only. A PASS is not proof of
299
+ support for every real host or for host configurations that were not exercised.
300
+
183
301
  Env overrides:
184
302
 
185
303
  | Variable | Default | Purpose |
@@ -193,6 +311,26 @@ Env overrides:
193
311
  Exit codes: `0` no real failures · `1` real failure (see `prompts-report.md`
194
312
  in the sandbox root) · `2` usage error · `3` sandbox not prepared.
195
313
 
314
+ ### Intentional memory MCP divergence
315
+
316
+ `scripts/memory_mcp_server.py` and `src/mcp/memory_mcp_server.py` are
317
+ intentionally different. The standalone `scripts/` copy keeps the lightweight
318
+ `memory_*` contract; the installed `src/mcp/` copy additionally exposes the
319
+ optional codemap schema and `code_index`, `code_query`, and `code_neighbors`.
320
+ The other shared MCP copies remain identical. Do not overwrite one memory copy
321
+ with the other.
322
+
323
+ ### Task-result guard
324
+
325
+ A `task-result-guard` intercepts calls to the native `task()` tool where the
326
+ child session returns an empty or missing result. Instead of surfacing a silent
327
+ `completed` with no payload (which confuses the orchestrator), the guard now
328
+ raises an explicit error. This catches the common free-tier failure mode where a
329
+ child session exceeds the uncached-prefill token budget (`BackendAdmissionRejected`)
330
+ and returns nothing. Prefer `background=true` dispatches with an explicit
331
+ `task_status(wait=true)` fan-in so large payloads are collected deterministically.
332
+
333
+
196
334
  ## Documentation
197
335
 
198
336
  - [Installation](docs/INSTALLATION.md) · [Quick start](docs/QUICKSTART.md)
@@ -210,9 +348,10 @@ or pull request.
210
348
 
211
349
  ## Citation and DOI
212
350
 
213
- Pantheon is released under the [MIT License](LICENSE). For the published v1.4.3
214
- record, use the [Zenodo DOI](https://doi.org/10.5281/zenodo.22306637); citation
215
- metadata is also available in [CITATION.cff](CITATION.cff).
351
+ Pantheon is released under the [MIT License](LICENSE). For the historical
352
+ published v1.4.3 record only, use the [Zenodo DOI](https://doi.org/10.5281/zenodo.22306637);
353
+ it is not the current operational version. Citation metadata is also available
354
+ in [CITATION.cff](CITATION.cff).
216
355
 
217
356
  Canonical repository: <https://github.com/ils15/pantheon-opencode>
218
357
 
package/README.pt-BR.md CHANGED
@@ -8,7 +8,7 @@ e equipes que querem mais estrutura sem perder o controle do próprio código.
8
8
  [English](README.md) ·
9
9
  [Repositório](https://github.com/ils15/pantheon-opencode) · [Licença MIT](LICENSE)
10
10
 
11
- [![Versão](https://img.shields.io/github/v/release/ils15/pantheon-opencode?label=versão)](https://github.com/ils15/pantheon-opencode/releases/tag/v1.5.0)
11
+ [![Versão](https://img.shields.io/github/v/release/ils15/pantheon-opencode?label=versão)](https://github.com/ils15/pantheon-opencode/releases/latest)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/ils15/pantheon-opencode/ci.yml?branch=main&label=CI)](https://github.com/ils15/pantheon-opencode/actions)
13
13
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22306637.svg)](https://doi.org/10.5281/zenodo.22306637)
14
14
 
@@ -31,7 +31,7 @@ de planejar o trabalho, avançar, conferir resultados e preservar o contexto
31
31
 
32
32
  ## Comece em 2 minutos
33
33
 
34
- Requisitos: [OpenCode 1.18.4+](https://opencode.ai/docs/) e Node.js 18+.
34
+ Requisitos: [OpenCode 1.18.4+](https://opencode.ai/docs/) e Node.js 22+.
35
35
 
36
36
  No projeto em que você quer usar o Pantheon:
37
37
 
@@ -71,13 +71,39 @@ verificações repetíveis e passagens claras entre etapas do trabalho.
71
71
 
72
72
  ## Status
73
73
 
74
- Versão atual: **v1.5.0**. O Pantheon foi feito para OpenCode e depende da
74
+ Versão operacional neste checkout: **v1.5.0-beta.2** (candidata; esta página
75
+ não afirma publicação). O Pantheon foi feito para OpenCode e depende da
75
76
  disponibilidade e da configuração do OpenCode e dos serviços opcionais que você
76
77
  escolher. Veja as [releases](https://github.com/ils15/pantheon-opencode/releases)
77
- e o [changelog](CHANGELOG.md) para acompanhar as mudanças.
78
+ e o [changelog](CHANGELOG.md) para acompanhar as mudanças publicadas.
78
79
 
79
80
 
80
- ## Novidades da 1.5.0
81
+ ## Execução code-mode (opt-in explícito)
82
+
83
+ Scripts executados pelo MCP server `pantheon-code-mode` (`execute_code_script`)
84
+ só rodam quando aprovados explicitamente. A aprovação fica em
85
+ `.pantheon/code-mode/manifest.json` com o SHA-256 de cada script.
86
+
87
+ - **Sem manifest → nada executa** (`INVALID_STATE`); nunca há execução implícita.
88
+ - **Script fora do manifest → `CONFLICT`**; é preciso aprovar antes.
89
+ - **Hash divergente → `CORRUPT_DATA`**; edições após a aprovação são detectadas.
90
+
91
+ Aprove (ou reaprove) um script com a tool `approve_code_script`. O instalador
92
+ semeia o manifest com o hash de todos os scripts empacotados. Os resultados
93
+ seguem o contrato de nove códigos (`OK`, `UNSUPPORTED`, `UNAVAILABLE`,
94
+ `INVALID_INPUT`, `INVALID_STATE`, `CONFLICT`, `CORRUPT_DATA`, `TIMEOUT`,
95
+ `ESCALATE`) e, com `json_output=true`, incluem o campo `status`.
96
+
97
+ O code-mode resolve primeiro o projeto: `.opencode/.pantheon/code-mode` vem
98
+ antes de `.pantheon/code-mode`. `PANTHEON_PROJECT` sobrescreve o diretório de
99
+ trabalho, e o MCP instalado usa `cwd: "."` para receber o workspace do
100
+ OpenCode. O diretório global só é usado sem um diretório de projeto utilizável;
101
+ depois de selecionar um diretório de projeto, manifest ausente ou corrompido
102
+ falha fechado, sem fallback silencioso. O `doctor` valida o manifest e o
103
+ SHA-256 de cada script sem regenerá-lo.
104
+
105
+
106
+ ## Novidades da 1.5.0-beta.2
81
107
 
82
108
  - Instalador exclusivo para OpenCode: guias de plataformas consolidados em um
83
109
  único [guia OpenCode](docs/platforms/opencode.md).
@@ -93,7 +119,7 @@ e o [changelog](CHANGELOG.md) para acompanhar as mudanças.
93
119
  lado — veja [Validação em sandbox](#validação-em-sandbox-v1v2).
94
120
  - A flag `--prompts` do instalador está planejada para uma release futura.
95
121
 
96
- ## OpenCode V1/V2 — Versão dupla (1.5.0)
122
+ ## OpenCode V1/V2 — Versão dupla (1.5.0-beta.2)
97
123
 
98
124
  O Pantheon tem dois contratos de plugin OpenCode **exclusivos**. A configuração
99
125
  comum do OpenCode pode ser compartilhada, mas o registro do plugin Pantheon é
@@ -104,16 +130,15 @@ registrados juntos.
104
130
  |---|---|---|
105
131
  | Chave de config do OpenCode | `plugin` singular | `plugins` plural |
106
132
  | Registro Pantheon | `src/plugin.ts` mais `src/plugins/pantheon-hooks.ts` | `pantheon-opencode/plugin-v2` (`src/plugin-v2.ts`) |
107
- | Contrato de runtime | Plugin Pantheon legado, incluindo `pantheon_delegate`, ferramentas read/list, hooks de evento/ferramenta e tratamento de compactação V1 | Plugin V2 completo: 9 ferramentas de orquestração, 4 assinaturas de eventos, session hooks (`prompt`, `context`), tool hooks (`execute.before`/`after`), além de transforms de configuração |
133
+ | Contrato de runtime | Plugin Pantheon V1: 6 ferramentas (`hashline_edit`, as 3 ferramentas de goal, `pantheon_cost`, `pantheon_model`), hooks de evento/ferramenta e tratamento de compactação V1 | Plugin V2 completo: 6 ferramentas de orquestração, 4 assinaturas de eventos, session hooks (`prompt`, `context`), tool hooks (`execute.before`/`after`), além de transforms de configuração |
108
134
  | APIs V1 | Registradas | Definições próprias de ferramentas via `ctx.tool.transform()` — não pelo caminho do plugin V1 |
109
135
 
110
- O plugin V2 fornece 9 ferramentas de orquestração (`pantheon_delegate`,
111
- `pantheon_delegation_read`, `pantheon_delegation_list`, `hashline_edit`,
136
+ O plugin V2 fornece 6 ferramentas de orquestração (`hashline_edit`,
112
137
  `pantheon_goal_create`, `pantheon_goal_get`, `pantheon_goal_update`,
113
138
  `pantheon_cost`, `pantheon_model`), 4 assinaturas de eventos (`session.created`,
114
139
  `session.idle`, `session.error`, `session.compacted`), session hooks (`prompt`,
115
140
  `context`) e tool hooks (`execute.before`, `execute.after`). O único recurso V2
116
- sem suporte é `legacy-hooks` (a superfície de API de delegate específica do V1).
141
+ sem suporte é `legacy-hooks` (a superfície de hooks específica do V1).
117
142
 
118
143
  O pacote expõe os dois contratos como exports importáveis:
119
144
  `pantheon-opencode/plugin` (V1), `pantheon-opencode/plugin-v2` (V2) e
@@ -121,7 +146,7 @@ O pacote expõe os dois contratos como exports importáveis:
121
146
  explicitamente o contrato desejado.
122
147
 
123
148
  A ponte V1→V2 (`src/pantheon/v2-bridge.ts`) habilita interop opcional:
124
- singletons de infraestrutura V1 (BackgroundJobBoard, DelegationClient,
149
+ singletons de infraestrutura V1 (BackgroundJobBoard,
125
150
  GoalStore, TodoEnforcer, VisionHandler) são repassados via `ctx.options` do V2.
126
151
  A ponte é opcional — o V2 funciona standalone com degradação graciosa.
127
152
 
@@ -141,7 +166,7 @@ instalador remove referências Pantheon das duas formas de config antes de
141
166
  gravar apenas o registro Pantheon selecionado. Entradas de terceiros não são
142
167
  convertidas nem reivindicadas por essa regra.
143
168
 
144
- O relatório `pantheon_cost` (apenas V1) pode selecionar o banco com
169
+ O relatório `pantheon_cost`, disponível nos plugins V1 e V2, pode selecionar o banco com
145
170
  `PANTHEON_OPENCODE_VERSION=v1` ou `v2` (`opencode.db` ou `opencode-v2.db`).
146
171
  `PANTHEON_COST_DB=/caminho/absoluto/para/opencode.db` tem precedência sobre o
147
172
  seletor de versão, e um `dbPath` explícito fornecido pelo chamador da
@@ -153,9 +178,55 @@ O instalador continua gravando as configurações de compatibilidade exigidas
153
178
  pelo host OpenCode selecionado, como `experimental.subagent_depth`; isso não
154
179
  converte um plugin V1 em V2 nem dá hooks V1 ao V2.
155
180
 
156
- ## Releases beta
181
+ ## Atualizando entre releases (beta.5+)
182
+
183
+ Um comando mantém uma instalação existente em dia:
157
184
 
158
- Um pull request com o label exato `release:beta` aciona o fluxo de release beta. Consulte [docs/RELEASING.md](docs/RELEASING.md) para detalhes de validação e recuperação.
185
+ ```bash
186
+ # Sem instalação global, SEMPRE fixe o dist-tag — `npx pantheon-opencode`
187
+ # puro resolve a tag `latest`, que é o release estável (1.4.3):
188
+ npx pantheon-opencode@beta update # canal beta do npm + refresh do config
189
+ npx pantheon-opencode@beta update --stable # canal estável
190
+
191
+ # Com instalação global, use o bin global (o padrão é o canal beta):
192
+ pantheon-opencode update
193
+ ```
194
+
195
+ O `update` compara a versão instalada com o dist-tag do npm, roda
196
+ `npm install -g pantheon-opencode@<canal>` e re-executa `init --yes
197
+ --headless` para alinhar merge de config, venv e entradas de MCP com o novo
198
+ pacote. Duas garantias de freshness sustentam isso:
199
+
200
+ - **Sync de artifacts no postinstall** — depois de qualquer `npm install`, os
201
+ artefatos de cópia (agents, skills, AGENTS.md, commands, scripts MCP,
202
+ payload code-mode) são atualizados automaticamente no config dir existente;
203
+ você nunca precisa re-rodar `init` só para atualizar arquivos.
204
+ - **Detecção de drift** — o instalador grava a versão instalada em
205
+ `.pantheon/install-state.json` e o `doctor` avisa quando o pacote é mais
206
+ novo que o último sync, apontando para o `update`.
207
+
208
+ O `init` também ganhou `--components agents,skills,...` (instalação enxuta),
209
+ `--clean` (alias de `--force`), `--opencode-version auto`, escrita atômica do
210
+ config com backup em `opencode.json.bak`, pré-checagens de python3/npm antes
211
+ de escrever qualquer arquivo e runtime Python não-fatal: se a venv falha, a
212
+ instalação completa mas as entradas MCP ficam de fora (com aviso) em vez de
213
+ apontar para um interpretador quebrado.
214
+
215
+ ## Releases
216
+
217
+ A publicação é autorizada **somente** por um `workflow_dispatch` explícito do
218
+ workflow `Release` (o input `release_channel` escolhe beta ou stable). Labels
219
+ de PR, push, merge e tag nunca publicam nada, e todos os gates de validação são
220
+ fail-closed: somente um PASS explícito autoriza release evidence. Consulte
221
+ [docs/RELEASING.md](docs/RELEASING.md) para detalhes de validação e recuperação.
222
+
223
+ A validação mantém cada manifest junto do seu lockfile: o root
224
+ `package.json` + `package-lock.json` e o TUI
225
+ `src/plugins/tui/package.json` + `src/plugins/tui/package-lock.json`. Ambos usam
226
+ `npm ci --ignore-scripts`; uma falha em `npm ci` bloqueia a execução e não há
227
+ fallback para `npm install`. Uma release carrega um único tarball `.tgz`, calcula
228
+ o SHA-256 desse mesmo artefato e vincula o tarball e o GitHub Release ao
229
+ `TARGET_SHA` completo; um segundo pack não é intercambiável.
159
230
 
160
231
  ## Validação em sandbox (V1/V2)
161
232
 
@@ -165,8 +236,9 @@ prefix npm e venv próprios) — nunca o ambiente de desenvolvimento. Ele verifi
165
236
  OpenCode V1 (`opencode`) e V2 (`opencode2`) lado a lado: binários, conectividade
166
237
  MCP, `doctor` e — com `--prompts` — uma bateria de prompts cobrindo o recurso
167
238
  `pantheon://agents`, memory store/recall, escrita no filesystem e delegação de
168
- agente. Falhas ambientais (rede, auth de provider, Docker) são classificadas
169
- como `AMBIENTAL` e nunca falham a execução; apenas falhas reais falham.
239
+ agente. O gate é fail-closed: todo check obrigatório precisa terminar em PASS
240
+ explícito; timeout, falha de auth/rede/provider e pré-requisitos ausentes
241
+ bloqueiam a execução.
170
242
 
171
243
  ```bash
172
244
  scripts/test-opencode-v1-v2-sandbox.sh --prepare # tarball + install + init no sandbox
@@ -180,6 +252,9 @@ Os modos são combináveis (ex.: `--prepare --run v1 --prompts`). Os binários s
180
252
  resolvidos estritamente dentro do prefix npm do sandbox — um sandbox não
181
253
  preparado falha rápido em vez de testar silenciosamente a instalação do host.
182
254
 
255
+ Isso valida somente o sandbox isolado e preparado. Um PASS não prova suporte
256
+ para todo host real nem para configurações de host que não foram exercitadas.
257
+
183
258
  Variáveis de ambiente:
184
259
 
185
260
  | Variável | Padrão | Finalidade |
@@ -194,6 +269,15 @@ Códigos de saída: `0` sem falhas reais · `1` falha real (veja
194
269
  `prompts-report.md` na raiz do sandbox) · `2` erro de uso · `3` sandbox não
195
270
  preparado.
196
271
 
272
+ ### Divergência intencional do memory MCP
273
+
274
+ `scripts/memory_mcp_server.py` e `src/mcp/memory_mcp_server.py` são
275
+ intencionalmente diferentes. A cópia independente em `scripts/` mantém o
276
+ contrato leve de `memory_*`; a cópia instalada em `src/mcp/` também expõe o
277
+ schema opcional de codemap e `code_index`, `code_query` e `code_neighbors`. As
278
+ outras cópias compartilhadas permanecem idênticas. Não sobrescreva uma cópia de
279
+ memória com a outra.
280
+
197
281
  ## Documentação
198
282
 
199
283
  - [Instalação](docs/INSTALLATION.md) · [Início rápido](docs/QUICKSTART.md)
@@ -211,9 +295,10 @@ uma issue ou pull request.
211
295
 
212
296
  ## Citação e DOI
213
297
 
214
- O Pantheon é distribuído sob a [Licença MIT](LICENSE). Para o registro publicado
215
- da v1.4.3, use o [DOI do Zenodo](https://doi.org/10.5281/zenodo.22306637); os
216
- metadados de citação também estão em [CITATION.cff](CITATION.cff).
298
+ O Pantheon é distribuído sob a [Licença MIT](LICENSE). Para o registro histórico
299
+ publicado da v1.4.3 apenas, use o [DOI do Zenodo](https://doi.org/10.5281/zenodo.22306637);
300
+ essa não é a versão operacional atual. Os metadados de citação também estão em
301
+ [CITATION.cff](CITATION.cff).
217
302
 
218
303
  Repositório canônico: <https://github.com/ils15/pantheon-opencode>
219
304