pantheon-opencode 1.6.2-beta.2 → 1.6.2-beta.3

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 (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +18 -15
  3. package/bin/pantheon-init.mjs +51 -13
  4. package/package.json +2 -1
  5. package/plugin.json +1 -1
  6. package/prompts/README.md +58 -0
  7. package/prompts/debug-issue.prompt.md +46 -0
  8. package/prompts/dynamic/agora-generated.txt +38 -0
  9. package/prompts/dynamic/orchestrate-generated.txt +51 -0
  10. package/prompts/focus.prompt.md +42 -0
  11. package/prompts/implement-feature.prompt.md +39 -0
  12. package/prompts/optimize-database.prompt.md +58 -0
  13. package/prompts/orchestrate-with-zeus.prompt.md +441 -0
  14. package/prompts/plan-architecture.prompt.md +59 -0
  15. package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
  16. package/prompts/quick-plan-large-feature.prompt.md +197 -0
  17. package/prompts/semantic-summarize.md +50 -0
  18. package/prompts/sketch.prompt.md +91 -0
  19. package/prompts/subtask.prompt.md +131 -0
  20. package/pyproject.toml +1 -1
  21. package/scripts/install/component-selection.mjs +9 -4
  22. package/scripts/install/health-check.mjs +20 -11
  23. package/scripts/install/interactive.mjs +9 -16
  24. package/scripts/install/interrupt.mjs +4 -3
  25. package/scripts/install/migrate.mjs +123 -72
  26. package/scripts/install/opencode.mjs +150 -114
  27. package/scripts/install/plan.mjs +8 -1
  28. package/scripts/install/state.mjs +7 -0
  29. package/scripts/install/strings.mjs +6 -0
  30. package/scripts/install/venv.mjs +34 -17
  31. package/scripts/restore.mjs +22 -10
  32. package/scripts/test-opencode-v2-sandbox.sh +10 -6
  33. package/src/plugins/tui/dist/tui-v2.js +3 -3
  34. package/src/plugins/tui/dist/tui.js +1 -1
  35. package/src/plugins/tui/package-lock.json +2 -2
  36. package/src/plugins/tui/package.json +1 -1
@@ -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
  // ---------------------------------------------------------------------------
@@ -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() {
@@ -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
@@ -5022,7 +5022,7 @@ function QuotaPluginDetails(props) {
5022
5022
  setProp(_el$58, "paddingTop", 1);
5023
5023
  insertNode(_el$59, createTextNode(`Plugin`));
5024
5024
  setProp(_el$59, "attributes", 1);
5025
- insert(_el$61, `Pantheon TUI v1.6.2-beta.2`);
5025
+ insert(_el$61, `Pantheon TUI v1.6.2-beta.3`);
5026
5026
  insertNode(_el$62, createTextNode(`Status de conexão consultado pelo OpenCode; segredos não são exibidos.`));
5027
5027
  insert(_el$64, () => `Status da quota: ${quotaSnapshotStatusLabel(props.snapshot.status, props.snapshot.error)}`);
5028
5028
  insert(_el$58, createComponent(Show, {
@@ -8300,7 +8300,7 @@ function Sidebar(props) {
8300
8300
  setProp(_el$12, "width", "100%");
8301
8301
  setProp(_el$12, "padding", 1);
8302
8302
  setProp(_el$13, "attributes", 1);
8303
- insert(_el$13, `Pantheon v1.6.2-beta.2`);
8303
+ insert(_el$13, `Pantheon v1.6.2-beta.3`);
8304
8304
  insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
8305
8305
  insert(_el$12, createComponent(Show, {
8306
8306
  get when() {
@@ -9027,7 +9027,7 @@ function HomeStatus(props) {
9027
9027
  const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
9028
9028
  return (() => {
9029
9029
  var _el$72 = createElement("text");
9030
- insert(_el$72, () => `Pantheon v1.6.2-beta.2${preset().name ? ` ▸ ${preset().name}` : ""}`);
9030
+ insert(_el$72, () => `Pantheon v1.6.2-beta.3${preset().name ? ` ▸ ${preset().name}` : ""}`);
9031
9031
  effect((_$p) => setProp(_el$72, "fg", muted(), _$p));
9032
9032
  return _el$72;
9033
9033
  })();
@@ -167,7 +167,7 @@ async function detectVersion(api) {
167
167
  if (ver) return ver;
168
168
  }
169
169
  } catch {}
170
- return "1.6.2-beta.2";
170
+ return "1.6.2-beta.3";
171
171
  }
172
172
  /**
173
173
  * usage-bar — AI subscription usage gauge for the opencode TUI.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "1.6.2-beta.2",
3
+ "version": "1.6.2-beta.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "1.6.2-beta.2",
9
+ "version": "1.6.2-beta.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode-ai/plugin": "1.18.33",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "1.6.2-beta.2",
4
+ "version": "1.6.2-beta.3",
5
5
  "description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {