pantheon-opencode 1.6.1 → 1.6.2-beta.2

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 (115) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +29 -0
  4. package/README.md +100 -19
  5. package/README.pt-BR.md +27 -11
  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/cost-command.ts +30 -133
  49. package/src/pantheon/model-pricing.ts +1 -536
  50. package/src/pantheon/v2-vision.ts +34 -29
  51. package/src/pantheon/vision.ts +43 -10
  52. package/src/plugin-v2.ts +30 -53
  53. package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
  54. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +749 -0
  55. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +1 -0
  56. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  57. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  58. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  59. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  60. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  61. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  62. package/src/plugins/tui/dist/quota-cli.js +184 -0
  63. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  64. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js +684 -0
  65. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
  66. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  67. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  68. package/src/plugins/tui/dist/server-v2.js +796 -0
  69. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  70. package/src/plugins/tui/dist/tui-v2.d.ts +375 -53
  71. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  72. package/src/plugins/tui/dist/tui-v2.js +5876 -530
  73. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  74. package/src/plugins/tui/dist/tui.js +1 -1
  75. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +118 -0
  76. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +1 -0
  77. package/src/plugins/tui/dist/usage-history-worker.js +25 -0
  78. package/src/plugins/tui/dist/usage-history-worker.js.map +1 -0
  79. package/src/plugins/tui/index-v2.ts +3 -6
  80. package/src/plugins/tui/package-lock.json +17 -2
  81. package/src/plugins/tui/package.json +6 -3
  82. package/src/plugins/tui/src/context-gauge.ts +59 -0
  83. package/src/plugins/tui/src/cost-data.ts +607 -0
  84. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  85. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  86. package/src/plugins/tui/src/index-v2.tsx +231 -240
  87. package/src/plugins/tui/src/model-pricing.ts +536 -0
  88. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  89. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  90. package/src/plugins/tui/src/quota-cli.ts +237 -0
  91. package/src/plugins/tui/src/quota-rpc.ts +373 -0
  92. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  93. package/src/plugins/tui/src/quota-v2.tsx +1238 -0
  94. package/src/plugins/tui/src/server-v2.ts +985 -0
  95. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  96. package/src/plugins/tui/src/usage-history-contract.ts +217 -0
  97. package/src/plugins/tui/src/usage-history-validation.ts +104 -0
  98. package/src/plugins/tui/src/usage-history-view.tsx +236 -0
  99. package/src/plugins/tui/src/usage-history-worker.ts +25 -0
  100. package/src/plugins/tui/src/usage-view-model.ts +272 -0
  101. package/src/plugins/tui/tsconfig.typecheck.json +6 -1
  102. package/src/plugins/tui/tsdown.config.ts +44 -5
  103. package/src/routing.yml +72 -13
  104. package/src/skills/README.md +4 -0
  105. package/src/skills/agent-coordination/SKILL.md +0 -3
  106. package/src/skills/artifact-management/SKILL.md +0 -3
  107. package/src/skills/auto-continue/SKILL.md +0 -3
  108. package/src/skills/code-review-checklist/SKILL.md +0 -3
  109. package/src/skills/context-compression/SKILL.md +0 -3
  110. package/src/skills/memory-bank/SKILL.md +6 -28
  111. package/src/skills/session-goal/SKILL.md +0 -3
  112. package/src/skills/simplify/SKILL.md +5 -4
  113. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  114. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  115. 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,35 @@ 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.2] - 2026-10-28
14
+
15
+ ### Added
16
+
17
+ - **TUI** — `/quota` adds recorded usage history for 7, 15, 30 days, and Total, with daily and per-model token summaries plus a clearly non-billable catalog estimate.
18
+ - **quota** — OpenCode Go usage uses the canonical endpoint and falls back to the configured API key when its Console OAuth request fails.
19
+
20
+ ### Fixed
21
+
22
+ - **quota** — Future-dated usage rows are excluded from rolling windows and Total.
23
+
24
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
25
+ move this section to a versioned entry and reset the template below. --&gt;
26
+ ## [v1.6.2-beta.1] - 2026-10-27
27
+
28
+ ### Changed
29
+
30
+ - **agents** — V2 compiles declared skills into per-agent allowlists; metadata, routing, and installed skills are checked for drift.
31
+ - **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.
32
+ - **prompts** — Manual prompt templates use named `{{UPPER_SNAKE_CASE}}` inputs; slash commands keep OpenCode's native `$ARGUMENTS` expansion.
33
+ - **install** — V2 MCP entries use the native `disabled` field and migrate legacy `enabled` values.
34
+ - **install** — Existing native V2 permission arrays remain authoritative; legacy defaults are seeded only when no V2 array exists.
35
+
36
+ ### Removed
37
+
38
+ - **plugin** — Removed ambient V2 memory injection and its debug environment variable; the legacy `memory_injection` option is ignored if preserved in an existing config.
39
+
40
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
41
+ move this section to a versioned entry and reset the template below. --&gt;
13
42
  ## [v1.6.1] - 2026-10-24
14
43
 
15
44
  ### 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,66 @@ 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. The `/quota` panel has **Usage, Limits,
104
+ Plugin, and Settings** tabs. Usage charts cover 7, 15, 30 days, or Total and
105
+ plot recorded daily token usage and model totals rather than filling gaps with
106
+ invented data. The panel identifies the active chat model; a partial-data
107
+ warning appears only when the quota snapshot is actually partial.
108
+ Session-reported spend is shown separately. The active context estimate uses
109
+ the active model's input price times pre-cache context tokens, applies no cache
110
+ discount, and is explicitly not billable.
111
+ Quota windows show text amounts and status, not provider progress gauges. They
112
+ show a local countdown and the provider-reported reset date/time in UTC when
113
+ valid timing is available; missing timing is not inferred. After expiry the UI
114
+ shows “aguardando atualização” until refreshed data arrives.
115
+ When a quota status request fails, the UI preserves the last valid
116
+ snapshot, marks it stale, and shows the failure cause as `Erro: <causa>`
117
+ in the sidebar and `/quota` panel (plus a `Último erro` line) instead
118
+ of a blind "Status indisponível"; the cause is logged as
119
+ `[pantheon-tui quota]`.
120
+ Usage severity uses warning color from 60% consumed and error color above 85%.
121
+ Session costs, provider balances and selected-key usage retain their distinct
122
+ labels and reported periods. Long values and states continue onto additional
123
+ lines within the sidebar's fixed 34-column content budget.
124
+ The installer selects the `plugins` component by default; in interactive setup
125
+ you can change the component selection. A component-scoped install includes
126
+ the TUI only when `plugins` is selected.
127
+ The V2 quota RPC shows providers when OpenCode lists an active supported
128
+ connection and Pantheon can locally resolve a nonblank credential. OpenCode
129
+ Go also supports `OPENCODE_API_KEY` and effective `opencode-go`/`opencode`
130
+ provider settings. This is not proof that the provider accepted the
131
+ credential; failed requests and unsupported adapters can remain visible as
132
+ unavailable. OpenCode Go checks a selected Console OAuth login first when
133
+ available, then uses the first available API key if no Console login exists
134
+ or its request fails; a Console 404 or a successful response without an
135
+ access object reports no Go subscription and does not fall back.
136
+ The API-key route follows OpenCode Quota's supported Go usage endpoint. See
137
+ the
138
+ [quota provider coverage table](docs/tui-v2-quota-providers.md) for limits and
139
+ troubleshooting.
140
+ `/quota-go-check` is a separate manual, confirmation-gated diagnostic: one
141
+ GET to `https://opencode.ai/zen/go/v1/usage` with the configured Go API key
142
+ (not OAuth), at most one attempt per plugin runtime. It never refreshes quota,
143
+ follows redirects or retries. Only HTTP 401 bodies are inspected, up to 4096
144
+ bytes, for an own top-level JSON `error` property; its value is never inspected.
145
+ Results contain only a safe category, optional HTTP status, coarse content type,
146
+ and (for 401) whether that structure is present, absent, or unavailable.
147
+ No error code, type, message, body, request ID, or byte count is displayed;
148
+ a 401 rejection's cause remains unknown. `success` means
149
+ HTTP success only—not a stable quota contract or parsed quota correctness.
150
+ Require Themis security review before using this diagnostic.
151
+
152
+ Vision requests to OpenCode Zen require a valid active session and are rejected
153
+ before image fetching or model-catalog lookup when the session is missing or
154
+ invalid. The Python vision MCP keeps its local metadata/OCR fallback when no
155
+ gateway credential is configured. In the V2 plugin, an explicit Vision model
156
+ pin that is unavailable or ineligible returns an actionable error rather than
157
+ silently switching models; remove the pin to use automatic model discovery.
78
158
 
79
159
  Memory is used selectively: the coordinator searches once only when project
80
160
  history could affect a task, then passes relevant results to specialists. Store
@@ -90,12 +170,11 @@ contract and targets OpenCode 2 only.
90
170
  The support policy, the known-broken exception, and the verified-version
91
171
  evidence have exactly one home: [Compatibility](docs/COMPATIBILITY.md).
92
172
 
93
- ### V2 plugin options (opt-in features)
173
+ ### V2 plugin options
94
174
 
95
175
  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:
176
+ the entry. `init` writes that form for the optional per-request context pruner;
177
+ memory retrieval stays an explicit `memory_search` MCP call.
99
178
 
100
179
  ```json
101
180
  {
@@ -103,30 +182,28 @@ enabling them is one edit away and nothing is on by default:
103
182
  {
104
183
  "package": "/path/to/pantheon-opencode/src/plugin-v2",
105
184
  "options": {
106
- "context_pruner": { "enabled": true },
107
- "memory_injection": { "enabled": true }
185
+ "context_pruner": { "enabled": true }
108
186
  }
109
187
  }
110
188
  ]
111
189
  }
112
190
  ```
113
191
 
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
192
+ Keep the `package` value `init` wrote and add keys inside `options`; custom
193
+ options survive a re-run. The context pruner is off unless `enabled` is
116
194
  literally `true`.
117
195
 
118
196
  | Option | Default | Effect |
119
197
  |---|---|---|
120
198
  | `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
199
 
123
200
  `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
201
+ `minSavingsTokens` and `charsPerToken`. Unknown keys are ignored with a
202
+ one-time warning in the hook log, so a typo cannot silently change behaviour. Run
127
203
  `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).
204
+ options at all. An old `memory_injection` option may remain in an existing
205
+ config because user options are preserved, but the plugin no longer reads it.
206
+ Full rules: [OpenCode V2](docs/opencode-v2.md) and [Memory](docs/MEMORY.md).
130
207
 
131
208
  ## Delegation
132
209
 
@@ -189,6 +266,10 @@ welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull
189
266
  request. That file also defines the documentation rule: one home per fact, with
190
267
  a short list of facts that must not be duplicated.
191
268
 
269
+ For code changes, run the smallest relevant check and expand it to match the
270
+ change's risk. `npm test` is the full repository suite; see
271
+ [CONTRIBUTING.md](CONTRIBUTING.md) for when to use it.
272
+
192
273
  ## Citation and DOI
193
274
 
194
275
  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
 
@@ -76,12 +76,24 @@ apenas — `init` → reiniciar → `/dispatch` → primeiro resultado — veja
76
76
  - **5 servidores MCP locais** para memória de projeto, persistência, recursos,
77
77
  execução confinada de scripts e visão.
78
78
  - **Uma TUI opcional**, com bloco de dispatch na sidebar e painel `/dispatch`
79
- em largura total.
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.
79
+ em largura total. A TUI V2 também inclui um resumo de quota na sidebar/rodapé
80
+ e o painel `/quota`, com abas Usage, Limits, Plugin e Settings. Usage mostra
81
+ gráficos de tokens registrados e totais por modelo em períodos de 7, 15, 30
82
+ dias ou Total, sem inventar dados para preencher lacunas. O painel identifica
83
+ o modelo ativo da conversa; o aviso de dados parciais só aparece quando a
84
+ resposta de quota é realmente parcial. O gasto reportado da sessão fica
85
+ separado da estimativa de contexto pré-cache, calculada com o preço de entrada
86
+ do modelo ativo, sem desconto de cache e sem representar uma cobrança. As
87
+ quotas aparecem como valores e status em texto, sem medidores de progresso;
88
+ quando há horário válido, mostram contagem regressiva local e o reset informado
89
+ pelo provedor em UTC. Horários ausentes não são inferidos. Use `E` para
90
+ desativar a quota e `M` para alternar entre restante e usado.
91
+
92
+ A memória MCP fica disponível para busca explícita: o coordenador consulta o
93
+ histórico uma vez quando ele pode mudar a tarefa e repassa apenas resultados
94
+ úteis. Checkpoints de sessão servem para retomadas entre sessões; memória
95
+ durável só é gravada quando solicitada ou autorizada. A compactação nativa do
96
+ OpenCode resume a conversa atual, sem salvar cada fase em outro MCP.
85
97
  Veja [Memória](docs/MEMORY.md).
86
98
 
87
99
  ## Compatibilidade
@@ -155,6 +167,10 @@ bem-vindos. Leia o [CONTRIBUTING.md](CONTRIBUTING.md) antes de abrir uma issue o
155
167
  pull request. Esse arquivo também define a regra de documentação: um único lar
156
168
  por fato, com uma lista curta de fatos que não devem ser duplicados.
157
169
 
170
+ Em mudanças de código, comece pela verificação relevante mais pequena e amplie
171
+ conforme o risco. `npm test` executa a suíte completa do repositório; veja o
172
+ [CONTRIBUTING.md](CONTRIBUTING.md) para saber quando usá-la.
173
+
158
174
  ## Citação e DOI
159
175
 
160
176
  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.2",
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.2",
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.2"
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)