pantheon-opencode 1.5.0-beta.15 → 1.5.0-beta.17

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 (54) hide show
  1. package/AGENTS.md +14 -63
  2. package/CHANGELOG.md +55 -0
  3. package/README.md +14 -27
  4. package/README.pt-BR.md +5 -6
  5. package/commands/pantheon.md +1 -35
  6. package/package.json +1 -1
  7. package/plugin.json +1 -1
  8. package/pyproject.toml +1 -1
  9. package/scripts/mcp_persistence_server.py +1 -1
  10. package/src/agents/apollo.md +1 -0
  11. package/src/agents/gaia.md +1 -0
  12. package/src/agents/zeus.md +8 -29
  13. package/src/instructions/memory-protocol.instructions.md +6 -3
  14. package/src/instructions/zeus-anti-stall.instructions.md +2 -4
  15. package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
  16. package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
  17. package/src/mcp/mcp_persistence_server.py +1 -1
  18. package/src/mcp/toon_codec.py +2 -4
  19. package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
  20. package/src/pantheon/cost-command.ts +1 -2
  21. package/src/pantheon/delegation-enforce.ts +59 -14
  22. package/src/pantheon/goal-loop.ts +1 -1
  23. package/src/pantheon/goal-store.ts +1 -1
  24. package/src/pantheon/idle-continuation.ts +4 -6
  25. package/src/pantheon/model-command.ts +1 -2
  26. package/src/pantheon/native-task-status.ts +2 -2
  27. package/src/pantheon/session-id.ts +30 -0
  28. package/src/pantheon/task-result-guard.ts +2 -3
  29. package/src/pantheon/todo-enforcer.ts +3 -3
  30. package/src/pantheon/tool-context.ts +23 -0
  31. package/src/pantheon/v2-bridge.ts +1 -4
  32. package/src/plugin-v2.ts +4 -15
  33. package/src/plugin.ts +61 -245
  34. package/src/plugins/tui/dist/tui.d.ts +33 -64
  35. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  36. package/src/plugins/tui/dist/tui.js +30 -177
  37. package/src/plugins/tui/package-lock.json +2 -2
  38. package/src/plugins/tui/package.json +1 -1
  39. package/src/plugins/tui/src/index.tsx +67 -277
  40. package/src/skills/context-compression/SKILL.md +1 -1
  41. package/scripts/dev-tui.sh +0 -48
  42. package/scripts/generate-preset-docs.mjs +0 -300
  43. package/scripts/generate-prompts.sh +0 -222
  44. package/scripts/install/component.mjs +0 -24
  45. package/scripts/install/migrate-config.mjs +0 -302
  46. package/src/pantheon/delegate-manager.ts +0 -851
  47. package/src/pantheon/delegation-classifier.ts +0 -306
  48. package/src/pantheon/delegation-finalize.ts +0 -468
  49. package/src/pantheon/delegation-notify.ts +0 -212
  50. package/src/pantheon/delegation-toast.ts +0 -73
  51. package/src/pantheon/delegation.ts +0 -1349
  52. package/src/pantheon/native-probe.ts +0 -234
  53. package/src/pantheon/step-cap.ts +0 -110
  54. package/src/pantheon/toon-codec.ts +0 -481
@@ -1,302 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * migrate-config.mjs — Standalone migration CLI with checkpoint crash recovery
4
- *
5
- * Runs configuration migrations with an atomic checkpoint system.
6
- * If the process crashes mid-migration, the checkpoint file persists
7
- * so that --resume picks up where it left off.
8
- *
9
- * Usage:
10
- * node scripts/install/migrate-config.mjs --from=1.1.0 --to=1.1.1 --target=~/.config/opencode
11
- * node scripts/install/migrate-config.mjs --resume --target=~/.config/opencode
12
- * node scripts/install/migrate-config.mjs --list --target=~/.config/opencode
13
- * node scripts/install/migrate-config.mjs --dry-run --from=1.1.0 --to=1.1.1
14
- */
15
-
16
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
17
- import { join } from 'node:path'
18
- import {
19
- advanceCheckpoint,
20
- listAppliedMigrations,
21
- readCheckpoint,
22
- removeCheckpoint,
23
- resumePendingMigration,
24
- writeCheckpoint,
25
- } from './migrate.mjs'
26
- import {
27
- addMigrationRecord,
28
- createInitialState,
29
- readState,
30
- updateVersion,
31
- writeState,
32
- } from './state.mjs'
33
-
34
- // ---------------------------------------------------------------------------
35
- // Migration step definitions
36
- // Each step is an idempotent function(target, state, { dryRun }) => void
37
- // ---------------------------------------------------------------------------
38
-
39
- const MIGRATION_STEPS = {
40
- /**
41
- * migrate_state_v2: Upgrade install-state.json from schema v1 to v2.
42
- * Adds schema_version field, components tracking, and migration history.
43
- */
44
- migrate_state_v2: (target, state, { dryRun }) => {
45
- if (state.schema_version && state.schema_version >= 2) {
46
- return
47
- }
48
- if (!dryRun) {
49
- state.schema_version = 2
50
- state.components = state.components || {
51
- agents: { version: 1, status: 'pending' },
52
- skills: { version: 1, status: 'pending' },
53
- plugins: { version: 1, status: 'pending' },
54
- runtime: { version: 1, status: 'pending' },
55
- }
56
- state.applied_migrations = state.applied_migrations || []
57
- state.migration_checkpoint = null
58
- }
59
- },
60
-
61
- /**
62
- * update_schema: Ensure all v2 schema fields exist with defaults.
63
- */
64
- update_schema: (target, state, { dryRun }) => {
65
- if (!dryRun) {
66
- if (!state.components) {
67
- state.components = {
68
- agents: { version: 1, status: 'pending' },
69
- skills: { version: 1, status: 'pending' },
70
- plugins: { version: 1, status: 'pending' },
71
- runtime: { version: 1, status: 'pending' },
72
- }
73
- }
74
- for (const key of ['agents', 'skills', 'plugins', 'runtime']) {
75
- if (!state.components[key]) {
76
- state.components[key] = { version: 1, status: 'pending' }
77
- }
78
- }
79
- state.applied_migrations = state.applied_migrations || []
80
- if (state.migration_checkpoint === undefined) {
81
- state.migration_checkpoint = null
82
- }
83
- }
84
- },
85
-
86
- /**
87
- * migrate_plugins: Normalize plugin component tracking.
88
- */
89
- migrate_plugins: (target, state, { dryRun }) => {
90
- if (!dryRun) {
91
- if (!state.components) state.components = {}
92
- const p = state.components.plugins || { version: 1, status: 'pending' }
93
- p.version = Math.max(p.version || 0, 1)
94
- state.components.plugins = p
95
- }
96
- },
97
- }
98
-
99
- // ---------------------------------------------------------------------------
100
- // Migration step ordering (a step runs ONLY after all predecessors complete)
101
- // ---------------------------------------------------------------------------
102
-
103
- const STEP_ORDER = Object.keys(MIGRATION_STEPS)
104
-
105
- /**
106
- * Resolve which steps to run based on from/to version comparison.
107
- * For now, runs all steps. In the future this can be gated by version.
108
- * @param {string} fromVersion
109
- * @param {string} toVersion
110
- * @returns {string[]} Ordered list of step names
111
- */
112
- function resolveSteps(fromVersion, toVersion) {
113
- return [...STEP_ORDER]
114
- }
115
-
116
- // ---------------------------------------------------------------------------
117
- // CLI
118
- // ---------------------------------------------------------------------------
119
-
120
- function parseArgs() {
121
- const args = process.argv.slice(2)
122
- const result = {
123
- from: null,
124
- to: null,
125
- target: process.cwd(),
126
- dryRun: false,
127
- resume: false,
128
- list: false,
129
- help: false,
130
- }
131
-
132
- for (let i = 0; i < args.length; i++) {
133
- const arg = args[i]
134
- if (arg === '--dry-run') result.dryRun = true
135
- else if (arg === '--resume') result.resume = true
136
- else if (arg === '--list') result.list = true
137
- else if (arg === '--help' || arg === '-h') result.help = true
138
- else if (arg.startsWith('--from=')) result.from = arg.split('=', 2)[1]
139
- else if (arg.startsWith('--to=')) result.to = arg.split('=', 2)[1]
140
- else if (arg.startsWith('--target=')) result.target = arg.split('=', 2)[1]
141
- else if (arg === '--from') result.from = args[++i]
142
- else if (arg === '--to') result.to = args[++i]
143
- else if (arg === '--target') result.target = args[++i]
144
- }
145
-
146
- return result
147
- }
148
-
149
- function showHelp() {
150
- console.log(`
151
- migrate-config.mjs — Pantheon configuration migration CLI
152
-
153
- Usage:
154
- node scripts/install/migrate-config.mjs --from=1.1.0 --to=1.1.1 --target=~/.config/opencode
155
- node scripts/install/migrate-config.mjs --resume --target=~/.config/opencode
156
- node scripts/install/migrate-config.mjs --list --target=~/.config/opencode
157
- node scripts/install/migrate-config.mjs --dry-run --from=1.1.0 --to=1.1.1
158
- node scripts/install/migrate-config.mjs --help
159
-
160
- Options:
161
- --from=<version> Source version (required for new migrations)
162
- --to=<version> Target version (required for new migrations)
163
- --target=<path> Installation directory (default: cwd)
164
- --dry-run Preview without writing
165
- --resume Resume from pending checkpoint (crash recovery)
166
- --list Show applied migration history
167
- --help Show this help
168
-
169
- Crash Recovery:
170
- If the process is interrupted mid-migration, a checkpoint file is left
171
- at .pantheon/.migration-checkpoint. Run with --resume to continue.
172
- `)
173
- }
174
-
175
- function main() {
176
- const config = parseArgs()
177
-
178
- if (config.help) {
179
- showHelp()
180
- return
181
- }
182
-
183
- // ── List mode ──
184
- if (config.list) {
185
- const history = listAppliedMigrations(config.target)
186
- if (!history.currentVersion) {
187
- console.log(' \u2139\uFE0F No install state found in: ' + config.target)
188
- return
189
- }
190
- console.log(` Current version: ${history.currentVersion}`)
191
- console.log(` Previous version: ${history.previousVersion || 'N/A'}`)
192
- console.log(` Applied migrations: ${history.migrations.length}`)
193
- for (const m of history.migrations) {
194
- const icon =
195
- m.status === 'completed'
196
- ? '\u2705'
197
- : m.status === 'rolled_back'
198
- ? '\u{1F504}'
199
- : '\u26A0\uFE0F'
200
- console.log(` ${icon} ${m.from} \u2192 ${m.to} [${m.status}] (${m.applied_at})`)
201
- }
202
- return
203
- }
204
-
205
- // ── Resume mode ──
206
- if (config.resume) {
207
- const cp = resumePendingMigration(config.target)
208
- if (!cp) {
209
- console.log(' \u23ED\uFE0F No pending checkpoint found — nothing to resume')
210
- return
211
- }
212
- config.from = cp.from
213
- config.to = cp.to
214
- } else {
215
- if (!config.from || !config.to) {
216
- console.error('\u274C --from and --to are required (or use --resume)')
217
- showHelp()
218
- process.exit(1)
219
- }
220
- }
221
-
222
- // ── Read state ──
223
- let state = readState(config.target)
224
- if (!state) {
225
- state = createInitialState(config.from)
226
- console.log(` \u{1F4DD} Creating new install state (v${state.schema_version})`)
227
- if (!config.dryRun) writeState(config.target, state)
228
- } else {
229
- console.log(
230
- ` \u{1F4CB} Current state: v${state.schema_version}, version ${state.pantheon_version}`,
231
- )
232
- }
233
-
234
- // ── Resolve checkpoint ──
235
- let cp = readCheckpoint(config.target)
236
-
237
- if (!cp) {
238
- const steps = resolveSteps(config.from, config.to)
239
- cp = writeCheckpoint(config.target, config.from, config.to, steps)
240
- console.log(` \u{1F4DD} Checkpoint written: ${config.from} \u2192 ${config.to}`)
241
- } else {
242
- console.log(
243
- ` \u{1F504} Resuming from checkpoint (${cp.steps_completed.length} steps done, ${cp.steps_pending.length} remaining)`,
244
- )
245
- }
246
-
247
- // ── Run pending steps ──
248
- const stepsToRun = [...cp.steps_pending]
249
- let failed = false
250
-
251
- for (const step of stepsToRun) {
252
- const stepFn = MIGRATION_STEPS[step]
253
- if (!stepFn) {
254
- console.warn(` \u26A0\uFE0F Unknown migration step: ${step} — skipping`)
255
- if (!config.dryRun) {
256
- advanceCheckpoint(config.target, step)
257
- }
258
- continue
259
- }
260
-
261
- console.log(` \u25B6\uFE0F Running: ${step}`)
262
- try {
263
- stepFn(config.target, state, { dryRun: config.dryRun })
264
-
265
- if (!config.dryRun) {
266
- advanceCheckpoint(config.target, step)
267
- writeState(config.target, state)
268
- console.log(` \u2705 ${step} completed`)
269
- } else {
270
- console.log(` \u2705 ${step} would complete (dry-run)`)
271
- }
272
- } catch (err) {
273
- console.error(` \u274C ${step} failed: ${err.message}`)
274
- failed = true
275
- break
276
- }
277
- }
278
-
279
- // ── Finalize ──
280
- if (failed) {
281
- console.error(`\n \u274C Migration failed at checkpoint.`)
282
- console.error(
283
- ` Resume with: node scripts/install/migrate-config.mjs --resume --target=${config.target}`,
284
- )
285
- process.exit(1)
286
- }
287
-
288
- if (!config.dryRun) {
289
- updateVersion(state, config.to)
290
- addMigrationRecord(state, config.from, config.to, 'completed')
291
- removeCheckpoint(config.target)
292
- writeState(config.target, state)
293
- console.log(`\n \u2705 Migration complete: ${config.from} \u2192 ${config.to}`)
294
- console.log(` State written to: ${join(config.target, '.pantheon', 'install-state.json')}`)
295
- } else {
296
- console.log(`\n \u2705 Migration would complete (dry-run): ${config.from} \u2192 ${config.to}`)
297
- }
298
- }
299
-
300
- if (process.argv[1] && import.meta.url === `file://${process.argv[1]}`) {
301
- main()
302
- }