pantheon-opencode 1.6.2-beta.1 → 1.6.2-beta.10

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 (144) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/README.md +236 -60
  3. package/README.pt-BR.md +19 -1
  4. package/bin/pantheon-init.mjs +195 -13
  5. package/package.json +11 -3
  6. package/plugin.json +1 -1
  7. package/prompts/README.md +58 -0
  8. package/prompts/debug-issue.prompt.md +46 -0
  9. package/prompts/dynamic/agora-generated.txt +38 -0
  10. package/prompts/dynamic/orchestrate-generated.txt +51 -0
  11. package/prompts/focus.prompt.md +42 -0
  12. package/prompts/implement-feature.prompt.md +39 -0
  13. package/prompts/optimize-database.prompt.md +58 -0
  14. package/prompts/orchestrate-with-zeus.prompt.md +441 -0
  15. package/prompts/plan-architecture.prompt.md +59 -0
  16. package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
  17. package/prompts/quick-plan-large-feature.prompt.md +197 -0
  18. package/prompts/semantic-summarize.md +50 -0
  19. package/prompts/sketch.prompt.md +91 -0
  20. package/prompts/subtask.prompt.md +131 -0
  21. package/pyproject.toml +1 -1
  22. package/scripts/decision-router-budget.mjs +780 -0
  23. package/scripts/decision-router-v2-budget.mjs +218 -0
  24. package/scripts/decision-router-v2-egress.mjs +272 -0
  25. package/scripts/decision-router.mjs +758 -0
  26. package/scripts/docs-check-changelog.mjs +5 -3
  27. package/scripts/install/component-selection.mjs +9 -4
  28. package/scripts/install/decision-layer-preview.mjs +376 -0
  29. package/scripts/install/decision-router-config.mjs +560 -0
  30. package/scripts/install/health-check.mjs +20 -11
  31. package/scripts/install/interactive.mjs +103 -14
  32. package/scripts/install/interrupt.mjs +4 -3
  33. package/scripts/install/migrate.mjs +123 -72
  34. package/scripts/install/opencode.mjs +178 -122
  35. package/scripts/install/plan.mjs +8 -1
  36. package/scripts/install/plugin.mjs +4 -3
  37. package/scripts/install/state.mjs +12 -0
  38. package/scripts/install/strings.mjs +22 -0
  39. package/scripts/install/venv.mjs +34 -17
  40. package/scripts/mcp_resources.py +11 -9
  41. package/scripts/release-notes.mjs +30 -7
  42. package/scripts/restore.mjs +22 -10
  43. package/scripts/sync-tui.mjs +3 -3
  44. package/scripts/test-opencode-v2-sandbox.sh +10 -6
  45. package/scripts/versioning.mjs +41 -5
  46. package/src/agents/aphrodite.md +6 -1
  47. package/src/agents/apollo.md +1 -0
  48. package/src/agents/athena.md +1 -0
  49. package/src/agents/demeter.md +1 -1
  50. package/src/agents/gaia.md +1 -0
  51. package/src/agents/hephaestus.md +1 -1
  52. package/src/agents/hermes.md +8 -10
  53. package/src/agents/iris.md +1 -1
  54. package/src/agents/mnemosyne.md +1 -0
  55. package/src/agents/nyx.md +1 -1
  56. package/src/agents/prometheus.md +1 -1
  57. package/src/agents/talos.md +6 -1
  58. package/src/agents/themis.md +1 -1
  59. package/src/agents/zeus.md +52 -62
  60. package/src/mcp/eval_store.py +11 -4
  61. package/src/mcp/mcp_resources.py +11 -9
  62. package/src/mcp/memory_mcp.py +293 -150
  63. package/src/pantheon/cost-command.ts +30 -133
  64. package/src/pantheon/jev-decision-tool.ts +347 -0
  65. package/src/pantheon/jev-decisions.ts +625 -0
  66. package/src/pantheon/local-decision-agents.ts +170 -0
  67. package/src/pantheon/local-decision-budget.ts +1046 -0
  68. package/src/pantheon/local-decision-egress-gate.ts +144 -0
  69. package/src/pantheon/local-decision-prompt.ts +256 -0
  70. package/src/pantheon/local-decision-provider-matrix.ts +44 -0
  71. package/src/pantheon/local-decision-router.ts +225 -0
  72. package/src/pantheon/local-decision-skills.ts +281 -0
  73. package/src/pantheon/local-decision-tool.ts +160 -0
  74. package/src/pantheon/local-decision-turn.ts +101 -0
  75. package/src/pantheon/local-decision-usage-evidence.internal.ts +168 -0
  76. package/src/pantheon/local-orchestration.ts +322 -0
  77. package/src/pantheon/model-pricing.ts +1 -536
  78. package/src/pantheon/pantheon-decision-catalog.ts +101 -0
  79. package/src/pantheon/v2-decision-budget.ts +456 -0
  80. package/src/pantheon/v2-decision-contracts.ts +300 -0
  81. package/src/pantheon/v2-decision-egress.ts +203 -0
  82. package/src/pantheon/v2-decision-events.ts +180 -0
  83. package/src/pantheon/v2-decision-heuristic.ts +121 -0
  84. package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
  85. package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
  86. package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
  87. package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
  88. package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
  89. package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
  90. package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
  91. package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
  92. package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
  93. package/src/pantheon/v2-decision-points/p8-guardrail.ts +367 -0
  94. package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
  95. package/src/pantheon/v2-decision-points.ts +242 -0
  96. package/src/pantheon/v2-decision-policy.ts +166 -0
  97. package/src/pantheon/v2-decision-premises.ts +146 -0
  98. package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
  99. package/src/pantheon/v2-decision-rank.ts +91 -0
  100. package/src/pantheon/v2-decision-registry.ts +391 -0
  101. package/src/pantheon/v2-decision-resource-ids.ts +127 -0
  102. package/src/pantheon/v2-decision-shadow.ts +123 -0
  103. package/src/pantheon/v2-decision-telemetry.ts +214 -0
  104. package/src/pantheon/v2-decision-verify.ts +51 -0
  105. package/src/pantheon/v2-hook-engine.ts +307 -0
  106. package/src/pantheon/v2-native-decisions.ts +365 -0
  107. package/src/pantheon/v2-shell-hooks.ts +66 -2
  108. package/src/pantheon/v2-tools.ts +38 -15
  109. package/src/plugin-v2.ts +419 -26
  110. package/src/plugin.ts +4 -0
  111. package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
  112. package/src/plugins/tui/dist/server-v2.d.ts +19 -11
  113. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
  114. package/src/plugins/tui/dist/server-v2.js +19 -666
  115. package/src/plugins/tui/dist/server-v2.js.map +1 -1
  116. package/src/plugins/tui/dist/tui-v2.d.ts +11 -203
  117. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  118. package/src/plugins/tui/dist/tui-v2.js +187 -1917
  119. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  120. package/src/plugins/tui/dist/tui.js +1 -1
  121. package/src/plugins/tui/package-lock.json +17 -2
  122. package/src/plugins/tui/package.json +4 -2
  123. package/src/plugins/tui/src/cost-data.ts +607 -0
  124. package/src/plugins/tui/src/index-v2.tsx +213 -54
  125. package/src/plugins/tui/src/model-pricing.ts +536 -0
  126. package/src/plugins/tui/src/server-v2.ts +18 -838
  127. package/src/plugins/tui/tsdown.config.ts +28 -6
  128. package/src/plugins/tui/dist/quota-adapters.d.ts +0 -89
  129. package/src/plugins/tui/dist/quota-adapters.d.ts.map +0 -1
  130. package/src/plugins/tui/dist/quota-adapters.js +0 -1142
  131. package/src/plugins/tui/dist/quota-adapters.js.map +0 -1
  132. package/src/plugins/tui/dist/quota-cli.d.ts +0 -17
  133. package/src/plugins/tui/dist/quota-cli.d.ts.map +0 -1
  134. package/src/plugins/tui/dist/quota-cli.js +0 -184
  135. package/src/plugins/tui/dist/quota-cli.js.map +0 -1
  136. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +0 -390
  137. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +0 -1
  138. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +0 -100
  139. package/src/plugins/tui/src/go-key-diagnostic.ts +0 -125
  140. package/src/plugins/tui/src/quota-adapters.ts +0 -1598
  141. package/src/plugins/tui/src/quota-cli.ts +0 -237
  142. package/src/plugins/tui/src/quota-rpc.ts +0 -209
  143. package/src/plugins/tui/src/quota-v2-model.ts +0 -1032
  144. package/src/plugins/tui/src/quota-v2.tsx +0 -986
@@ -9,6 +9,7 @@
9
9
  * {
10
10
  * "schema_version": 2,
11
11
  * "pantheon_version": "1.1.1",
12
+ * "migration_schema_version": "3.19.2",
12
13
  * "previous_version": "1.1.0",
13
14
  * "updated_at": "2026-07-26T10:30:00Z",
14
15
  * "migration_checkpoint": null,
@@ -30,10 +31,12 @@
30
31
 
31
32
  import { existsSync, mkdirSync, readFileSync } from 'node:fs'
32
33
  import { join, resolve } from 'node:path'
34
+ import { migrateDecisionRouterConfig } from './decision-router-config.mjs'
33
35
  import { assertNoSymlinkAncestors, writeFileAtomically } from './verify.mjs'
34
36
 
35
37
  const STATE_FILE = 'install-state.json'
36
38
  const STATE_DIR = '.pantheon'
39
+ export const MIGRATION_SCHEMA_VERSION = '3.19.2'
37
40
 
38
41
  function emptyFileInventory(legacyUnknown = true) {
39
42
  return {
@@ -69,6 +72,7 @@ export function createInitialState(version, updatedAt = new Date().toISOString()
69
72
  return {
70
73
  schema_version: 2,
71
74
  pantheon_version: version || '0.0.0',
75
+ migration_schema_version: MIGRATION_SCHEMA_VERSION,
72
76
  previous_version: null,
73
77
  updated_at: updatedAt,
74
78
  migration_checkpoint: null,
@@ -79,6 +83,7 @@ export function createInitialState(version, updatedAt = new Date().toISOString()
79
83
  plugins: { version: 1, status: 'pending' },
80
84
  runtime: { version: 1, status: 'pending' },
81
85
  },
86
+ decision_router: migrateDecisionRouterConfig(undefined),
82
87
  file_inventory: emptyFileInventory(false),
83
88
  }
84
89
  }
@@ -122,6 +127,7 @@ export function upgradeStateV1toV2(state) {
122
127
  return {
123
128
  schema_version: 2,
124
129
  pantheon_version: state.pantheon_version || state.version || 'unknown',
130
+ migration_schema_version: state.migration_schema_version ?? null,
125
131
  previous_version: state.previous_version || null,
126
132
  updated_at: state.updated_at || now,
127
133
  migration_checkpoint: null,
@@ -135,6 +141,7 @@ export function upgradeStateV1toV2(state) {
135
141
  plugins: { version: 1, status: 'unknown' },
136
142
  runtime: { version: 1, status: 'unknown' },
137
143
  },
144
+ decision_router: migrateDecisionRouterConfig(state.decision_router),
138
145
  file_inventory: normalizeFileInventory(state),
139
146
  }
140
147
  }
@@ -153,6 +160,7 @@ export function upgradeStateV1toV2(state) {
153
160
  * @returns {object} the same state object with required collections present
154
161
  */
155
162
  function ensureV2Shape(state) {
163
+ if (!Object.hasOwn(state, 'migration_schema_version')) state.migration_schema_version = null
156
164
  if (!Array.isArray(state.applied_migrations)) state.applied_migrations = []
157
165
  if (
158
166
  !state.components ||
@@ -169,6 +177,7 @@ function ensureV2Shape(state) {
169
177
  ) {
170
178
  state.file_inventory = invalidFileInventory()
171
179
  }
180
+ state.decision_router = migrateDecisionRouterConfig(state.decision_router)
172
181
  return state
173
182
  }
174
183
 
@@ -199,6 +208,9 @@ export function writeState(target, state, options = {}) {
199
208
  assertNoSymlinkAncestors(stateFile)
200
209
  state.updated_at = options.updatedAt ?? new Date().toISOString()
201
210
  state.schema_version = 2
211
+ if (!Object.hasOwn(state, 'migration_schema_version')) state.migration_schema_version = null
212
+ if (!Array.isArray(state.applied_migrations)) state.applied_migrations = []
213
+ state.decision_router = migrateDecisionRouterConfig(state.decision_router)
202
214
  if (!Object.hasOwn(state, 'file_inventory')) {
203
215
  state.file_inventory = emptyFileInventory(true)
204
216
  } else if (
@@ -21,6 +21,8 @@ const TABLE = {
21
21
  cancelPoints: {
22
22
  components: 'component selection',
23
23
  target: 'install location',
24
+ decisionRouter: 'decision router selection',
25
+ egressConsent: 'external data-sharing consent',
24
26
  confirmation: 'pre-install confirmation',
25
27
  review: 'review prompt',
26
28
  interrupt: 'interrupt (Ctrl-C)',
@@ -30,6 +32,9 @@ const TABLE = {
30
32
  // stronger claim would be false.
31
33
  canceledAt: (point) =>
32
34
  `Installation canceled at ${point} — nothing was applied; no configuration was changed.`,
35
+ interruptedAfterWrite: (backupDir) =>
36
+ `Installation interrupted at Ctrl-C — changes may be partially applied; no automatic rollback was attempted. ` +
37
+ `The backup is preserved${backupDir ? ` at ${backupDir}` : ''}; inspect it and restore manually if needed.`,
33
38
  declinedAt: (point) =>
34
39
  `Installation declined at ${point} — nothing was applied; no configuration was changed; ` +
35
40
  're-run init to review the plan again.',
@@ -51,6 +56,12 @@ const TABLE = {
51
56
  nextLaunch: '2. Launch OpenCode',
52
57
  nextAgents: '3. Invoke agents with @agent-name in chat',
53
58
  nextProject: '4. For project-local install:\n npx pantheon-opencode init --project',
59
+ nextJev:
60
+ '5. Jev decision model (optional, off by default):\n npx pantheon-opencode decision-router setup-model opencode-console-jev/jev-1.13 --monthly-usd 5 --per-decision-usd 0.10\n npx pantheon-opencode decision-router doctor',
61
+ jevConfigured: (target) =>
62
+ `Jev decision model configured: ${target} (consent + caps + period; verify with decision-router doctor)`,
63
+ jevConfigureFailed: (msg) => `Decision-model configuration failed: ${msg}`,
64
+ jevDryRun: (target) => `[DRY-RUN] decision model would be configured: ${target}`,
54
65
  // install steps
55
66
  globalLayout:
56
67
  'Global config directory detected — using flat layout (agents/, skills/, commands/)',
@@ -111,12 +122,17 @@ const TABLE = {
111
122
  cancelPoints: {
112
123
  components: 'seleção de componentes',
113
124
  target: 'local da instalação',
125
+ decisionRouter: 'seleção do roteador decisório',
126
+ egressConsent: 'consentimento de compartilhamento externo',
114
127
  confirmation: 'confirmação antes de instalar',
115
128
  review: 'prompt de revisão',
116
129
  interrupt: 'interrupção (Ctrl-C)',
117
130
  },
118
131
  canceledAt: (point) =>
119
132
  `Instalação cancelada em ${point} — nada foi aplicado; nenhuma configuração foi alterada.`,
133
+ interruptedAfterWrite: (backupDir) =>
134
+ `Instalação interrompida por Ctrl-C — alterações podem ter sido aplicadas parcialmente; nenhum rollback automático foi feito. ` +
135
+ `O backup foi preservado${backupDir ? ` em ${backupDir}` : ''}; revise e restaure manualmente se necessário.`,
120
136
  declinedAt: (point) =>
121
137
  `Instalação recusada em ${point} — nada foi aplicado; nenhuma configuração foi alterada; ` +
122
138
  'rode init de novo para revisar o plano.',
@@ -138,6 +154,12 @@ const TABLE = {
138
154
  nextLaunch: '2. Abra o OpenCode',
139
155
  nextAgents: '3. Invoc agentes com @nome-do-agente no chat',
140
156
  nextProject: '4. Para instalar no projeto:\n npx pantheon-opencode init --project',
157
+ nextJev:
158
+ '5. Modelo de decisão Jev (opcional, desligado por padrão):\n npx pantheon-opencode decision-router setup-model opencode-console-jev/jev-1.13 --monthly-usd 5 --per-decision-usd 0.10\n npx pantheon-opencode decision-router doctor',
159
+ jevConfigured: (target) =>
160
+ `Modelo de decisão Jev configurado: ${target} (consentimento + limites + período; verifique com decision-router doctor)`,
161
+ jevConfigureFailed: (msg) => `Falha ao configurar o modelo de decisão: ${msg}`,
162
+ jevDryRun: (target) => `[DRY-RUN] o modelo de decisão seria configurado: ${target}`,
141
163
  // install steps
142
164
  globalLayout:
143
165
  'Diretório de config global detectado — layout plano (agents/, skills/, commands/)',
@@ -43,8 +43,8 @@ export function venvPythonPath(target) {
43
43
  * Set up a Python virtual environment and install MCP dependencies.
44
44
  *
45
45
  * @param {string} target - Target installation directory (e.g. ~/.config/opencode)
46
- * @param {{ dryRun?: boolean, skipInstall?: boolean, force?: boolean, recorder?: (change: object) => void, reviewedRemovals?: Set<string>|null, reviewedSnapshots?: Map<string, object>|null }} [options]
47
- * @returns {{ venvPath: string, python: string }}
46
+ * @param {{ dryRun?: boolean, skipInstall?: boolean, force?: boolean, verbose?: boolean, recorder?: (change: object) => void, reviewedRemovals?: Set<string>|null, reviewedSnapshots?: Map<string, object>|null }} [options]
47
+ * @returns {{ venvPath: string, python: string, runtimeEffects: { venv: 'create'|'reuse'|'recreate', dependencies: 'install'|'skip' } }}
48
48
  */
49
49
  export function setupVenv(
50
50
  target,
@@ -52,6 +52,7 @@ export function setupVenv(
52
52
  dryRun = false,
53
53
  skipInstall = false,
54
54
  force = false,
55
+ verbose = false,
55
56
  recorder = null,
56
57
  reviewedRemovals = null,
57
58
  reviewedSnapshots = null,
@@ -59,9 +60,13 @@ export function setupVenv(
59
60
  ) {
60
61
  const venvPath = join(target, '.venv')
61
62
  const pythonBin = venvPythonPath(target)
63
+ const hadVenv = existsSync(venvPath)
64
+ const recreateVenv = force && hadVenv
65
+ const hadPython = existsSync(pythonBin)
66
+ const venvAction = recreateVenv ? 'recreate' : hadPython ? 'reuse' : 'create'
62
67
 
63
68
  // Step 1: Force recreate venv if --force
64
- if (force && existsSync(venvPath)) {
69
+ if (recreateVenv) {
65
70
  if (dryRun) {
66
71
  recordRemovalTree(venvPath, recorder)
67
72
  info('.venv would be removed (--force)')
@@ -74,7 +79,7 @@ export function setupVenv(
74
79
  }
75
80
 
76
81
  // Step 1b: Create venv if not exists
77
- const venvExists = existsSync(pythonBin)
82
+ const venvExists = !recreateVenv && hadPython
78
83
  if (!venvExists) {
79
84
  if (dryRun) {
80
85
  // Never claim a directory was created by a run that writes nothing.
@@ -116,12 +121,12 @@ export function setupVenv(
116
121
  // Ensure PIP_USER=0 to install into venv, not user site-packages
117
122
  const pipEnv = { ...process.env, PIP_USER: '0' }
118
123
 
119
- // stdio is 'ignore' (pip is noisy here), so the step marker is the ONLY
120
- // evidence this ran — report both start and outcome instead of a silent
121
- // 30s pause.
124
+ // Inherit pip output while the step marker makes the upgrade's start
125
+ // and outcome explicit.
122
126
  const pipUpgradeStep = step('Upgrading pip')
123
- const pipUpgrade = spawnSync(pip, ['install', '--upgrade', 'pip'], {
124
- stdio: 'ignore',
127
+ const pipVerbosity = verbose ? ['--verbose'] : ['--quiet']
128
+ const pipUpgrade = spawnSync(pip, ['install', ...pipVerbosity, '--upgrade', 'pip'], {
129
+ stdio: 'inherit',
125
130
  timeout: 30_000,
126
131
  env: pipEnv,
127
132
  })
@@ -129,8 +134,9 @@ export function setupVenv(
129
134
  pipUpgradeStep(upgraded)
130
135
  if (!upgraded) warning('pip upgrade failed — continuing with the bundled version')
131
136
 
132
- // Install requirements — attempt 1: normal
133
- const r = spawnSync(pip, ['install', '-r', reqFile], {
137
+ // Pip's quiet mode keeps normal init output concise while preserving
138
+ // stderr and its non-zero status; --verbose retains resolver detail.
139
+ const r = spawnSync(pip, ['install', ...pipVerbosity, '-r', reqFile], {
134
140
  stdio: 'inherit',
135
141
  timeout: 120_000,
136
142
  env: pipEnv,
@@ -139,11 +145,15 @@ export function setupVenv(
139
145
  if (r.status !== 0) {
140
146
  // Attempt 2: --break-system-packages (PEP 668 / externally-managed)
141
147
  warning('First attempt failed, retrying with --break-system-packages...')
142
- const r2 = spawnSync(pip, ['install', '-r', reqFile, '--break-system-packages'], {
143
- stdio: 'inherit',
144
- timeout: 120_000,
145
- env: pipEnv,
146
- })
148
+ const r2 = spawnSync(
149
+ pip,
150
+ ['install', ...pipVerbosity, '-r', reqFile, '--break-system-packages'],
151
+ {
152
+ stdio: 'inherit',
153
+ timeout: 120_000,
154
+ env: pipEnv,
155
+ },
156
+ )
147
157
  if (r2.status !== 0) {
148
158
  throw new Error(
149
159
  'Failed to install MCP dependencies. ' +
@@ -169,7 +179,14 @@ export function setupVenv(
169
179
  info('Dependency install skipped (--skip-install)')
170
180
  }
171
181
 
172
- return { venvPath, python: pythonBin }
182
+ return {
183
+ venvPath,
184
+ python: pythonBin,
185
+ runtimeEffects: {
186
+ venv: venvAction,
187
+ dependencies: skipInstall ? 'skip' : 'install',
188
+ },
189
+ }
173
190
  }
174
191
 
175
192
  // ---------------------------------------------------------------------------
@@ -23,7 +23,6 @@ from fastmcp import FastMCP
23
23
 
24
24
  # ── Path Resolution ──────────────────────────────────────────────────────────
25
25
  _PANTHEON_HOME: Path = pantheon_home()
26
- _PANTHEON_PROJECT: Path | None = pantheon_project()
27
26
 
28
27
 
29
28
  def _within(path: Path, parent: Path) -> bool:
@@ -68,12 +67,13 @@ def _resource_root(name: str) -> Path | None:
68
67
  preserves the global fallback while preventing symlink escapes.
69
68
  """
70
69
  candidates: list[tuple[Path, Path]] = []
71
- if _PANTHEON_PROJECT is not None:
70
+ project = pantheon_project()
71
+ if project is not None:
72
72
  if name in {"agents", "skills"}:
73
- local = _PANTHEON_PROJECT / ".opencode"
73
+ local = project / ".opencode"
74
74
  candidates.append((local / name, local))
75
75
  elif name in {"deepwork", "memory-bank"}:
76
- local = _PANTHEON_PROJECT / ".pantheon"
76
+ local = project / ".pantheon"
77
77
  candidates.append((local / name, local))
78
78
  candidates.append((_PANTHEON_HOME / name, _PANTHEON_HOME))
79
79
  for root, parent in candidates:
@@ -86,9 +86,10 @@ def _resource_root(name: str) -> Path | None:
86
86
  def _resource_roots(name: str) -> list[Path]:
87
87
  """Return safe resource roots in local-first precedence order."""
88
88
  roots: list[Path] = []
89
- if _PANTHEON_PROJECT is not None:
89
+ project = pantheon_project()
90
+ if project is not None:
90
91
  base_name = ".opencode" if name in {"agents", "skills"} else ".pantheon"
91
- base = _PANTHEON_PROJECT / base_name
92
+ base = project / base_name
92
93
  local = _safe_root(base / name, base)
93
94
  if local is not None:
94
95
  roots.append(local)
@@ -208,9 +209,10 @@ async def list_skills() -> str:
208
209
  async def get_routing() -> str:
209
210
  """Return the full content of routing.yml."""
210
211
  routing_file = _safe_child(_PANTHEON_HOME, "routing.yml")
211
- if routing_file is None and _PANTHEON_PROJECT:
212
- routing_file = _safe_child(_PANTHEON_PROJECT / "src", "routing.yml")
213
- if routing_file is None or not routing_file.exists():
212
+ project = pantheon_project()
213
+ if (routing_file is None or not routing_file.is_file()) and project:
214
+ routing_file = _safe_child(project / "src", "routing.yml")
215
+ if routing_file is None or not routing_file.is_file():
214
216
  return "routing.yml not found."
215
217
  return routing_file.read_text(encoding="utf-8")
216
218
 
@@ -19,8 +19,8 @@
19
19
  * bullet `- #N - <subject>` per referenced issue
20
20
  * (deduped); the group is OMITTED when no refs exist
21
21
  *
22
- * Omitted (internal, never user-facing): chore | refactor | test | ci |
23
- * build | style | revert (unknown conventional types too).
22
+ * Omitted (internal, never user-facing): release scope and chore | refactor |
23
+ * test | ci | build | style | revert (unknown conventional types too).
24
24
  *
25
25
  * Breaking: `BREAKING CHANGE` footer or `type!:` / `type(scope)!:` — the
26
26
  * commit keeps its type bucket and the bullet is prefixed with 💥
@@ -126,6 +126,27 @@ function parseIssueRefs(body) {
126
126
  return [...body.matchAll(/\b(?:Closes|Fixes|Resolves)\s+#(\d+)\b/gi)].map((m) => Number(m[1]))
127
127
  }
128
128
 
129
+ /**
130
+ * Detect the documented BREAKING CHANGE trailer in the final body paragraph.
131
+ * The marker must be a trailer line, not a phrase embedded in body prose.
132
+ *
133
+ * @param {string} body
134
+ * @returns {boolean}
135
+ */
136
+ function hasBreakingFooter(body) {
137
+ const footerLines = body
138
+ .trimEnd()
139
+ .split(/\r?\n(?:[ \t]*\r?\n)+/)
140
+ .at(-1)
141
+ .split(/\r?\n/)
142
+ const isTrailerLine = /^[A-Za-z][A-Za-z-]*(?: [A-Za-z][A-Za-z-]*)*:[ \t]+\S/
143
+
144
+ return (
145
+ isTrailerLine.test(footerLines[0]) &&
146
+ footerLines.some((line) => /^BREAKING CHANGE:[ \t]+\S.*$/i.test(line))
147
+ )
148
+ }
149
+
129
150
  /**
130
151
  * Parse one "subject|body" record into a conventional-commit entry.
131
152
  * Returns null for records that must be skipped: merge commits ("Merge ..."),
@@ -151,7 +172,7 @@ export function parseCommitLine(line) {
151
172
  type: type.toLowerCase(),
152
173
  scope: scope || null,
153
174
  subject: cleanSubject,
154
- breaking: Boolean(bang) || /BREAKING CHANGE/i.test(body),
175
+ breaking: Boolean(bang) || hasBreakingFooter(body),
155
176
  refs: parseIssueRefs(body),
156
177
  }
157
178
  }
@@ -159,7 +180,8 @@ export function parseCommitLine(line) {
159
180
  /**
160
181
  * Conventional type → final release-note group. Types missing from this map
161
182
  * (chore, refactor, test, ci, build, style, revert, unknown) are internal
162
- * and omitted from the notes.
183
+ * and omitted from the notes. The maintainer-only `release` scope is also
184
+ * omitted, including its issue references.
163
185
  */
164
186
  const TYPE_GROUPS = {
165
187
  feat: 'whatsNew',
@@ -172,8 +194,9 @@ const TYPE_GROUPS = {
172
194
  /**
173
195
  * Group parsed commits into the final release-note sections. Breaking
174
196
  * commits keep their type bucket (the 💥 marker is applied at render time);
175
- * internal types are dropped; issue refs from ANY commit body feed
176
- * closedIssues (deduped, first occurrence wins). Entries keep git log order.
197
+ * internal types and the `release` scope are dropped; issue refs from remaining
198
+ * commit bodies feed closedIssues (deduped, first occurrence wins). Entries
199
+ * keep git log order.
177
200
  *
178
201
  * @param {Array<ReturnType<typeof parseCommitLine>>} entries
179
202
  * @param {{knownIssues?: string[]|string|null}} [options]
@@ -192,7 +215,7 @@ export function groupCommits(entries, options = {}) {
192
215
  }
193
216
  const seenRefs = new Set()
194
217
  for (const entry of entries) {
195
- if (!entry) continue
218
+ if (!entry || entry.scope === 'release') continue
196
219
  const bucket = TYPE_GROUPS[entry.type]
197
220
  if (bucket) groups[bucket].push(entry)
198
221
  for (const ref of entry.refs) {
@@ -35,6 +35,7 @@ import {
35
35
  restoreBackupSet,
36
36
  verifyBackupSet,
37
37
  } from './install/backup.mjs'
38
+ import { PROMPT_CANCELED } from './install/prompt-result.mjs'
38
39
 
39
40
  /**
40
41
  * Resolve the config dir whose `opencode.json` the installer manages.
@@ -122,9 +123,16 @@ export function pickBackupSet(configDir, from) {
122
123
  * @param {string} opts.backupDir
123
124
  * @param {boolean} [opts.dryRun]
124
125
  * @param {boolean} [opts.yes]
125
- * @returns {Promise<{ ok: boolean, code: number, entries?: object[] }>}
126
+ * @param {(message: string, options: object) => Promise<unknown>} [opts.promptReview]
127
+ * @returns {Promise<{ ok: boolean, code: number, reason?: string, entries?: object[] }>}
126
128
  */
127
- export async function runRestore({ configDir, backupDir, dryRun = false, yes = false }) {
129
+ export async function runRestore({
130
+ configDir,
131
+ backupDir,
132
+ dryRun = false,
133
+ yes = false,
134
+ promptReview: injectedPromptReview = null,
135
+ }) {
128
136
  const verify = verifyBackupSet(backupDir)
129
137
  if (!verify.ok) {
130
138
  console.error(
@@ -155,22 +163,26 @@ export async function runRestore({ configDir, backupDir, dryRun = false, yes = f
155
163
 
156
164
  if (dryRun) {
157
165
  console.log(' (dry-run) No files were written.')
158
- return { ok: true, code: 0, entries: plan.entries }
166
+ return { ok: true, code: 0, reason: 'preview', entries: plan.entries }
159
167
  }
160
168
 
161
- if (!yes) {
169
+ if (yes !== true) {
162
170
  // Reuse the shared confirm semantics (default NO). An interactive TTY may
163
171
  // authorize without --yes; a non-TTY run must never proceed silently.
164
172
  const tty = Boolean(process.stdin.isTTY && process.stdout.isTTY)
165
- if (!tty) {
173
+ if (!tty && typeof injectedPromptReview !== 'function') {
166
174
  console.error('❌ Refusing to restore without authorization. Re-run with --yes.')
167
- return { ok: false, code: 1 }
175
+ return { ok: false, code: 1, reason: 'not-authorized', entries: plan.entries }
168
176
  }
169
- const { promptReview } = await import('./install/interactive.mjs')
177
+ const promptReview =
178
+ injectedPromptReview ?? (await import('./install/interactive.mjs')).promptReview
170
179
  const accepted = await promptReview('Restore these changes?', { default: false })
171
- if (!accepted) {
180
+ if (accepted === PROMPT_CANCELED) {
181
+ return { ok: false, code: 130, reason: 'canceled', entries: plan.entries }
182
+ }
183
+ if (accepted !== true) {
172
184
  console.log(' Nothing restored.')
173
- return { ok: true, code: 0, entries: plan.entries }
185
+ return { ok: true, code: 0, reason: 'declined', entries: plan.entries }
174
186
  }
175
187
  }
176
188
 
@@ -189,7 +201,7 @@ export async function runRestore({ configDir, backupDir, dryRun = false, yes = f
189
201
 
190
202
  restoreBackupSet(backupDir, configDir, { dryRun: false })
191
203
  console.log(` ✅ Restored ${plan.entries.length} path(s).`)
192
- return { ok: true, code: 0, entries: plan.entries }
204
+ return { ok: true, code: 0, reason: 'restored', entries: plan.entries }
193
205
  }
194
206
 
195
207
  async function main() {
@@ -95,9 +95,9 @@ export function copyPluginFiles(srcDir, dstDir, version) {
95
95
  }
96
96
  // Mirror of scripts/install/plugin.mjs: the OpenCode host resolves the
97
97
  // plugin server through the `./server` export. In the V2 copy it must
98
- // point at the V2 server bundle so V2-only RPCs (pantheon.quota) are
99
- // registered; otherwise the host loads the V1 server and the quota
100
- // status stays "unavailable".
98
+ // point at the V2 server entry so the host attaches the copy's V2 server
99
+ // half (the TUI reactive channel depends on it); otherwise the host loads
100
+ // the V1 server stub of the previous generation's payload.
101
101
  if (version === 'v2' && packageJson.exports?.['./server-v2']) {
102
102
  packageJson.exports['./server'] = packageJson.exports['./server-v2']
103
103
  }
@@ -17,8 +17,9 @@
17
17
  #
18
18
  # Modes (run sequentially; a failure stops later checks):
19
19
  # --prepare Build tarball, install pantheon-opencode + the OpenCode V2
20
- # binary in the sandbox prefix, headless init, and generate
21
- # the project config and sandbox run-test.sh.
20
+ # binary in the sandbox prefix, headless init with the
21
+ # default components plus opt-in runtime, and generate the
22
+ # project config and sandbox run-test.sh.
22
23
  # --run v2 Base validation: opencode mcp list + doctor (config is
23
24
  # regenerated first).
24
25
  # --prompts Prompt battery via `opencode run --format json`.
@@ -1043,7 +1044,8 @@ npm install -g "$TGZ"
1043
1044
  if ! git -C "$REPO_DIR" ls-files --error-unmatch -- "$TGZ" >/dev/null 2>&1; then rm -f -- "$TGZ"; fi
1044
1045
 
1045
1046
  echo "--- Init (headless) ---"
1046
- pantheon-opencode init --headless -y
1047
+ pantheon-opencode init --headless -y \
1048
+ --components agents,skills,instructions,commands,plugins,runtime
1047
1049
  rewrite_v2_mcp_config
1048
1050
  if ! node "$REPO_DIR/scripts/validate-sandbox-install.mjs" \
1049
1051
  --repo "$REPO_DIR" \
@@ -1436,7 +1438,7 @@ prepare_project() {
1436
1438
  pan="$(sandbox_bin_for "pantheon-opencode")" \
1437
1439
  || die "pantheon-opencode not installed in sandbox prefix — run $0 --prepare first"
1438
1440
  log "--- Regenerating config in $dir ---"
1439
- (cd "$dir" && "$pan" init --project --version "$TARGET_VERSION" --model "$PANTHEON_SANDBOX_MODEL" -y) \
1441
+ (cd "$dir" && "$pan" init --project --version "$TARGET_VERSION" --model "$PANTHEON_SANDBOX_MODEL" --components agents,skills,instructions,commands,plugins,runtime -y) \
1440
1442
  || die "sandbox project initialization failed"
1441
1443
  rewrite_v2_mcp_config
1442
1444
  validate_sandbox_install
@@ -1550,8 +1552,10 @@ cmd_prepare() {
1550
1552
  local pan
1551
1553
  pan="$(sandbox_bin_for "pantheon-opencode")" \
1552
1554
  || die "pantheon-opencode not found in sandbox prefix after install"
1553
- log "--- Headless init (global venv + runtime) ---"
1554
- "$pan" init --headless -y --model "$PANTHEON_SANDBOX_MODEL" \
1555
+ log "--- Headless init (default components + runtime) ---"
1556
+ "$pan" init --headless -y \
1557
+ --components agents,skills,instructions,commands,plugins,runtime \
1558
+ --model "$PANTHEON_SANDBOX_MODEL" \
1555
1559
  || die "pantheon-opencode init --headless failed"
1556
1560
  prepare_project
1557
1561
  write_extract_py
@@ -61,6 +61,29 @@ function getLatestTag() {
61
61
  return tags.at(-1) || 'v0.0.0'
62
62
  }
63
63
 
64
+ function getLatestBetaTag() {
65
+ const tags = runGit(['tag', '-l', 'v*'])
66
+ .split('\n')
67
+ .filter((tag) => /^v\d+\.\d+\.\d+-beta\.\d+$/.test(tag))
68
+ tags.sort((left, right) => {
69
+ const a = left
70
+ .slice(1)
71
+ .match(/^(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/)
72
+ .slice(1)
73
+ .map(Number)
74
+ const b = right
75
+ .slice(1)
76
+ .match(/^(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/)
77
+ .slice(1)
78
+ .map(Number)
79
+ for (let index = 0; index < a.length; index += 1) {
80
+ if (a[index] !== b[index]) return a[index] - b[index]
81
+ }
82
+ return 0
83
+ })
84
+ return tags.at(-1) || null
85
+ }
86
+
64
87
  function getCurrentVersion() {
65
88
  return validateInventory(ROOT).sourceVersion
66
89
  }
@@ -400,9 +423,9 @@ switch (command) {
400
423
  const useBeta = command === 'beta' || args.includes('--beta')
401
424
 
402
425
  // Beta: advance the committed X.Y.Z-beta.N line and promote the
403
- // [Unreleased] CHANGELOG section into [vX.Y.Z-beta.N], exactly like the
404
- // stable path. The committed manifest is the single source of truth — no
405
- // npm lookup, no git lookup, and no runtime version computation.
426
+ // [Unreleased] CHANGELOG section into [vX.Y.Z-beta.N]. Optional --notes
427
+ // uses commits since the latest beta tag; without it, the manual
428
+ // [Unreleased] body is preserved.
406
429
  if (useBeta) {
407
430
  if (!contentHasUnreleased())
408
431
  throw new Error('CHANGELOG.md is missing the [Unreleased] section')
@@ -410,7 +433,18 @@ switch (command) {
410
433
  const newVersion = nextBetaVersion(current)
411
434
  const date = new Date().toISOString().slice(0, 10)
412
435
  console.log(`Bumping ${current} → ${newVersion} (beta)`)
413
- const changelogPlan = prepareUnreleased(newVersion, date)
436
+ let notesBody = null
437
+ if (useNotes) {
438
+ const since = getLatestBetaTag()
439
+ if (!since) throw new Error('cannot generate beta release notes: no prior beta tag found')
440
+ const raw = collectEntries({ since })
441
+ notesBody = renderChangelog(groupCommits(raw.map(parseCommitLine)))
442
+ if (!notesBody) {
443
+ throw new Error(`cannot generate beta release notes: no generated notes since ${since}`)
444
+ }
445
+ console.log(` --notes generated from ${raw.length} commits since ${since}`)
446
+ }
447
+ const changelogPlan = prepareUnreleased(newVersion, date, notesBody)
414
448
  const manifestPlan = prepareManifests(newVersion)
415
449
  commitPreparedRelease(
416
450
  { ...manifestPlan, version: newVersion },
@@ -508,9 +542,11 @@ Commands:
508
542
  apply [type] Bump manifests + move [Unreleased] → [vX.Y.Z]
509
543
  type: patch | minor | major | auto (default: auto)
510
544
  --notes: pre-fill the promoted entry with release
511
- notes generated from conventional commits
545
+ notes since the latest stable tag
512
546
  --beta: advance the committed X.Y.Z-beta.N line and
513
547
  promote [Unreleased] → [vX.Y.Z-beta.N] in CHANGELOG
548
+ --beta --notes: generate notes since the latest beta tag
549
+ (fails without a beta baseline or non-empty notes)
514
550
  beta Alias for 'apply --beta'
515
551
  changelog [version] Promote [Unreleased], or merge into an existing version section
516
552
 
@@ -8,7 +8,7 @@ permission:
8
8
  grep: allow
9
9
  edit: allow
10
10
  vision_describe: allow
11
- bash: allow
11
+ shell: allow
12
12
  webfetch: allow
13
13
  glob: allow
14
14
  question: allow
@@ -30,6 +30,11 @@ mcp_tools:
30
30
  pantheon-vision: [vision_describe, vision_ocr, vision_analyze]
31
31
  ---
32
32
 
33
+ ## Verification Tiers
34
+
35
+ Small bounded fix → change + one targeted proof, no ceremony. Material change → full test discipline. Match the tier to the change.
36
+
37
+
33
38
  ## When NOT to Use Aphrodite
34
39
  - For backend API implementation — that's @hermes
35
40
  - For database schema changes — that's @demeter
@@ -13,6 +13,7 @@ permission:
13
13
  webfetch: allow
14
14
  edit: deny
15
15
  hashline_edit: deny
16
+ shell: deny
16
17
  bash: deny
17
18
  task:
18
19
  "*": deny
@@ -20,6 +20,7 @@ skills:
20
20
  permission:
21
21
  edit: deny
22
22
  hashline_edit: deny
23
+ shell: deny
23
24
  bash: deny
24
25
  read: allow
25
26
  grep: allow
@@ -7,7 +7,7 @@ permission:
7
7
  read: allow
8
8
  grep: allow
9
9
  edit: allow
10
- bash: allow
10
+ shell: allow
11
11
  webfetch: allow
12
12
  task:
13
13
  "*": deny
@@ -12,6 +12,7 @@ permission:
12
12
  webfetch: allow
13
13
  edit: deny
14
14
  hashline_edit: deny
15
+ shell: deny
15
16
  bash: deny
16
17
  task:
17
18
  "*": deny
@@ -7,7 +7,7 @@ permission:
7
7
  read: allow
8
8
  grep: allow
9
9
  edit: allow
10
- bash: allow
10
+ shell: allow
11
11
  webfetch: allow
12
12
  task:
13
13
  "*": deny