pantheon-opencode 1.6.0-beta.9 → 1.6.1

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 (140) hide show
  1. package/AGENTS.global.md +118 -0
  2. package/AGENTS.md +18 -168
  3. package/CHANGELOG.md +144 -365
  4. package/README.md +124 -607
  5. package/README.pt-BR.md +120 -345
  6. package/bin/pantheon-init.mjs +504 -141
  7. package/commands/pantheon-deepwork.md +14 -3
  8. package/commands/pantheon-vision.md +61 -12
  9. package/package.json +22 -13
  10. package/plugin.json +1 -1
  11. package/pyproject.toml +6 -2
  12. package/scripts/_pantheon_paths.py +24 -0
  13. package/scripts/build-agents-md.mjs +368 -69
  14. package/scripts/changelog-merge.mjs +161 -0
  15. package/scripts/check-plugin-v2-coverage.mjs +11 -8
  16. package/scripts/docs-check-changelog.mjs +204 -0
  17. package/scripts/docs-link-check.mjs +314 -0
  18. package/scripts/docs-media.mjs +157 -0
  19. package/scripts/doctor.mjs +850 -45
  20. package/scripts/install/agents-md.mjs +2 -2
  21. package/scripts/install/backup.mjs +648 -0
  22. package/scripts/install/cli-ui.mjs +303 -72
  23. package/scripts/install/component-selection.mjs +61 -0
  24. package/scripts/install/config-migration.mjs +583 -27
  25. package/scripts/install/exit-codes.mjs +26 -0
  26. package/scripts/install/file-inventory.mjs +555 -0
  27. package/scripts/install/health-check.mjs +31 -25
  28. package/scripts/install/interactive.mjs +99 -383
  29. package/scripts/install/interrupt.mjs +78 -0
  30. package/scripts/install/migrate.mjs +49 -25
  31. package/scripts/install/model-picker.mjs +218 -250
  32. package/scripts/install/opencode-state.mjs +91 -0
  33. package/scripts/install/opencode-version.mjs +83 -21
  34. package/scripts/install/opencode.mjs +1675 -187
  35. package/scripts/install/plan-artifact.mjs +517 -0
  36. package/scripts/install/plan.mjs +475 -0
  37. package/scripts/install/plugin.mjs +214 -27
  38. package/scripts/install/prompt-result.mjs +2 -0
  39. package/scripts/install/run-record.mjs +115 -0
  40. package/scripts/install/shared.mjs +256 -99
  41. package/scripts/install/state.mjs +63 -8
  42. package/scripts/install/strings.mjs +93 -8
  43. package/scripts/install/v2-capabilities.mjs +205 -0
  44. package/scripts/install/venv.mjs +90 -47
  45. package/scripts/install/verify.mjs +128 -0
  46. package/scripts/install/vision-prompt.mjs +173 -0
  47. package/scripts/install-mcp.mjs +2 -2
  48. package/scripts/manifest-inventory.mjs +49 -3
  49. package/scripts/mcp_persistence.py +1535 -1050
  50. package/scripts/memory_mcp.py +12 -843
  51. package/scripts/node-engine-policy.mjs +85 -0
  52. package/scripts/package-evidence.mjs +10 -2
  53. package/scripts/postinstall.mjs +26 -26
  54. package/scripts/probe-pantheon-cost.mjs +118 -19
  55. package/scripts/prune.mjs +9 -3
  56. package/scripts/reconcile.mjs +325 -0
  57. package/scripts/release-gates.mjs +687 -0
  58. package/scripts/restore.mjs +222 -0
  59. package/scripts/run-node-tests.mjs +24 -8
  60. package/scripts/sync-artifacts.mjs +19 -7
  61. package/scripts/sync-tui.mjs +5 -1
  62. package/scripts/test-opencode-v2-sandbox.sh +36 -123
  63. package/scripts/uninstall.mjs +369 -34
  64. package/scripts/update.mjs +164 -0
  65. package/scripts/validate-node-engine-policy.mjs +13 -0
  66. package/scripts/version-check.mjs +34 -1
  67. package/scripts/versioning.mjs +23 -3
  68. package/scripts/vision-status.mjs +682 -0
  69. package/skills-lock.json +8 -8
  70. package/src/agents/aphrodite.md +13 -10
  71. package/src/agents/apollo.md +4 -5
  72. package/src/agents/athena.md +74 -46
  73. package/src/agents/demeter.md +10 -7
  74. package/src/agents/gaia.md +0 -1
  75. package/src/agents/hephaestus.md +4 -3
  76. package/src/agents/hermes.md +10 -9
  77. package/src/agents/iris.md +6 -1
  78. package/src/agents/mnemosyne.md +10 -4
  79. package/src/agents/nyx.md +4 -4
  80. package/src/agents/prometheus.md +12 -11
  81. package/src/agents/talos.md +6 -0
  82. package/src/agents/zeus.md +84 -56
  83. package/src/instructions/agent-return-format.instructions.md +12 -41
  84. package/src/instructions/memory-protocol.instructions.md +5 -11
  85. package/src/instructions/test-economy.instructions.md +12 -0
  86. package/src/instructions/yagni.instructions.md +6 -15
  87. package/src/instructions/zeus-anti-stall.instructions.md +6 -6
  88. package/src/instructions/zeus-communication-rules.instructions.md +6 -6
  89. package/src/instructions/zeus-council-synthesis.instructions.md +11 -12
  90. package/src/instructions/zeus-memory-operations.instructions.md +13 -7
  91. package/src/instructions/zeus-timeout-retry.instructions.md +36 -10
  92. package/src/mcp/_pantheon_paths.py +24 -0
  93. package/src/mcp/mcp_codemap_module.py +86 -18
  94. package/src/mcp/mcp_persistence.py +1535 -1050
  95. package/src/mcp/memory_mcp.py +444 -94
  96. package/src/mcp/pantheon_vision.py +285 -41
  97. package/src/mcp/requirements-mcp.txt +6 -1
  98. package/src/mcp/requirements-vision.txt +1 -1
  99. package/src/pantheon/context-pruner.ts +541 -0
  100. package/src/pantheon/cost-command.ts +901 -60
  101. package/src/pantheon/delegation-enforce.ts +160 -23
  102. package/src/pantheon/goal-loop.ts +11 -8
  103. package/src/pantheon/guard-path.ts +162 -0
  104. package/src/pantheon/memory-context.ts +1017 -0
  105. package/src/pantheon/model-agents.ts +19 -0
  106. package/src/pantheon/model-command.ts +218 -56
  107. package/src/pantheon/model-pricing.ts +536 -0
  108. package/src/pantheon/presets.mjs +2 -0
  109. package/src/pantheon/task-result-guard.ts +50 -14
  110. package/src/pantheon/v2-bounded-read.ts +654 -0
  111. package/src/pantheon/v2-bridge.ts +27 -0
  112. package/src/pantheon/v2-delegation-enforce.ts +133 -6
  113. package/src/pantheon/v2-execute-after.ts +135 -24
  114. package/src/pantheon/v2-model-overrides.ts +275 -0
  115. package/src/pantheon/v2-shell-hooks.ts +260 -0
  116. package/src/pantheon/v2-tools.ts +89 -35
  117. package/src/pantheon/v2-unsupported.mjs +34 -7
  118. package/src/pantheon/v2-vision.ts +622 -0
  119. package/src/pantheon/vision-local.ts +531 -0
  120. package/src/pantheon/vision.ts +1166 -116
  121. package/src/plugin-v2.ts +1039 -171
  122. package/src/plugin.ts +37 -13
  123. package/src/plugins/tui/dist/tui-v2.d.ts +1029 -2
  124. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  125. package/src/plugins/tui/dist/tui-v2.js +3742 -85
  126. package/src/plugins/tui/dist/tui.js +1 -1
  127. package/src/plugins/tui/package-lock.json +15 -15
  128. package/src/plugins/tui/package.json +7 -5
  129. package/src/plugins/tui/src/index-v2.tsx +4314 -50
  130. package/src/plugins/tui/tsconfig.typecheck.json +5 -0
  131. package/src/routing.yml +50 -5
  132. package/src/skills/agent-coordination/SKILL.md +7 -2
  133. package/src/skills/artifact-management/SKILL.md +5 -1
  134. package/src/skills/auto-continue/SKILL.md +14 -6
  135. package/src/skills/codemap/SKILL.md +1 -1
  136. package/src/skills/memory-bank/SKILL.md +21 -13
  137. package/src/skills/session-goal/SKILL.md +12 -22
  138. package/src/skills/spec-driven-development/SKILL.md +3 -1
  139. package/src/skills/worktrees/SKILL.md +30 -11
  140. package/scripts/probe-context-rehydrate.mjs +0 -263
package/src/plugin.ts CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  zeusReadGuard,
19
19
  } from './pantheon/delegation-enforce.ts'
20
20
  import { GOAL_LOOP_DEFAULTS, GoalLoop, GoalStore } from './pantheon/goal-loop.ts'
21
+ import { createGuardPathResolver } from './pantheon/guard-path.ts'
21
22
  import { createReadEnhancer } from './pantheon/hashline/read-enhancer.ts'
22
23
  import { createHashlineEditTool } from './pantheon/hashline/tool.ts'
23
24
  import { createIdleDispatcher } from './pantheon/idle-continuation.ts'
@@ -37,6 +38,7 @@ import {
37
38
  import { TodoPreserver } from './pantheon/todo-preserve.ts'
38
39
  import { handleToolCeilingEvent, type ToolCeilingResult } from './pantheon/tool-ceiling.ts'
39
40
  import { checkTuiVersionStaleness } from './pantheon/tui-version-check.ts'
41
+ import { createV2Bridge, registerV2Bridge } from './pantheon/v2-bridge.ts'
40
42
  import { activePresetCandidates, createVisionHandler } from './pantheon/vision.ts'
41
43
 
42
44
  // ─── Background Job Board Singleton ────────────────────────────────────
@@ -238,15 +240,18 @@ function adaptTodoEnforcerClient(client: PluginInput['client']): TodoEnforcerCli
238
240
 
239
241
  /**
240
242
  * Pantheon plugin for OpenCode. Pasted images are intercepted via the
241
- * `chat.message` hook (proven to fire in opencode 1.18.11). When a provider
242
- * key is available — env PANTHEON_OPENCODE_API_KEY / OPENCODE_API_KEY, or the
243
- * opencode auth store for `opencode auth login` users — the image is
244
- * described NATIVELY by the multimodal model via the opencode Zen
245
- * OpenAI-compatible endpoint, and replaced with the text description — no MCP
246
- * tool required. Without a key the legacy pattern applies: the image is
247
- * replaced with a text instruction telling the model to call a vision MCP tool
248
- * (default `pantheon_vision_vision_describe`). Either way the image never reaches
249
- * the main provider, so text-only models cannot fail with an `image_url` error.
243
+ * `chat.message` hook (proven to fire in opencode 1.18.11). Credentials follow
244
+ * the endpoint: a Zen endpoint (`opencode` / `opencode-go*`) may use the shared
245
+ * `PANTHEON_OPENCODE_API_KEY` / `OPENCODE_API_KEY` env keys and the legacy
246
+ * `opencode-go` / `opencode` auth-store entries, while a non-Zen endpoint uses
247
+ * ONLY its own auth-store entry (never the Zen env keys or legacy entries).
248
+ * When a credential is available the image is described NATIVELY by the
249
+ * multimodal model via the endpoint's OpenAI-compatible API, and replaced with
250
+ * the text description — no MCP tool required. Without a credential the legacy
251
+ * pattern applies: the image is replaced with a text instruction telling the
252
+ * model to call a vision MCP tool (default `pantheon_vision_vision_describe`).
253
+ * Either way the image never reaches the main provider, so text-only models
254
+ * cannot fail with an `image_url` error.
250
255
  *
251
256
  * The canonical `pantheon-vision` MCP owns the standalone describe/OCR/analyze
252
257
  * tools. The installed OpenCode plugin API exposes no stable pre-provider
@@ -276,6 +281,14 @@ const plugin: Plugin = async (input: PluginInput) => {
276
281
  // Runtime TUI version staleness check — warns if the copied TUI plugin
277
282
  // is older than the installed package. Runs once, fail-open, no auto-sync.
278
283
  checkTuiVersionStaleness((msg) => log.warn(msg))
284
+ // Symlink resolution for the Zeus read guard (#272). The guard predicate is
285
+ // pure and synchronous, so the filesystem work happens here instead: one
286
+ // resolver per plugin instance, rooted at the project directory the host
287
+ // reported. `docs/link → ../src` must not read `src/` just because the
288
+ // string path looks harmless.
289
+ const resolveGuardPath = createGuardPathResolver(
290
+ input.directory || input.worktree || process.cwd(),
291
+ )
279
292
  const vision = createVisionHandler(input)
280
293
  // Wave 1 (PR #46): TODO continuation enforcer for root sessions. The event
281
294
  // hook routes `session.idle` events here; an active goal owns the idle
@@ -297,8 +310,9 @@ const plugin: Plugin = async (input: PluginInput) => {
297
310
  client: adaptTodoEnforcerClient(input.client),
298
311
  })
299
312
 
300
- // Wave 3 (PR #46): full-auto goal loop — opt-in (`full_auto.enabled:
301
- // false` default, mirrored by GOAL_LOOP_DEFAULTS). File-based GoalStore
313
+ // Wave 3 (PR #46): goal loop. The plugin uses hard-coded GOAL_LOOP_DEFAULTS;
314
+ // routing.yml documents defaults/guards but no runtime config enables the
315
+ // loop in this build. File-based GoalStore
302
316
  // (`.pantheon/goals/<sessionID>.json` — the plugin layer cannot reach MCP
303
317
  // KV). Idle routing: an active goal owns the idle (goal loop); otherwise
304
318
  // the todo enforcer gets it (see idle-continuation.ts).
@@ -312,6 +326,14 @@ const plugin: Plugin = async (input: PluginInput) => {
312
326
  const goalTools = goalLoop.tools()
313
327
  const idleDispatcher = createIdleDispatcher({ goalLoop, todoEnforcer })
314
328
 
329
+ // Cross-generation bridge (issue #265 review): publish THESE singletons so a
330
+ // V2 plugin loaded in the same process reuses this enforcer instead of
331
+ // building a second one. Two enforcers would answer one `session.idle` twice
332
+ // — V1's dispatcher below and V2's `onSessionIdle` would each inject a
333
+ // continuation prompt. Registration is a no-op on a V1-only install: nothing
334
+ // in this process reads the registry unless a V2 entry resolves it.
335
+ registerV2Bridge(createV2Bridge({ board, todoEnforcer }))
336
+
315
337
  // Wave 2 (PR #46): hashline — tag-anchored edits. The read enhancer
316
338
  // (tool.execute.after) augments `read` output with per-line sha256 tags
317
339
  // (`12#XJ|content`); hashline_edit anchors edits to those refs. Additive —
@@ -474,8 +496,10 @@ const plugin: Plugin = async (input: PluginInput) => {
474
496
  // read-only enforcement guard (denies mutating tools in read-only
475
497
  // sessions), then release-134 Phase 3 rewrites the first
476
498
  // post-compaction `todowrite` with the captured todo snapshot. All are
477
- // no-ops for non-matching sessions/tools.
478
- zeusReadGuard(input.tool, output?.args, sessionAgents.get(input.sessionID))
499
+ // no-ops for non-matching sessions/tools. The read guard also checks the
500
+ // SYMLINK-RESOLVED form of every target path (#272), so a link into a
501
+ // denied root cannot pass on its string spelling.
502
+ zeusReadGuard(input.tool, output?.args, sessionAgents.get(input.sessionID), resolveGuardPath)
479
503
  await enforcementGuard(input, output)
480
504
  await commandNormalizer(input, output)
481
505
  await todoPreserver.beforeTodoWrite(input, output)