pantheon-opencode 1.1.3-beta.0 → 1.2.0-beta.9.7bef03e

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 (38) hide show
  1. package/README.md +74 -1
  2. package/bin/pantheon-init.mjs +79 -0
  3. package/commands/pantheon-vision.md +67 -0
  4. package/opencode.json +12 -41
  5. package/package.json +5 -1
  6. package/scripts/doctor.mjs +4 -2
  7. package/scripts/install/health-check.mjs +101 -1
  8. package/scripts/install/model-picker.mjs +118 -0
  9. package/scripts/install/opencode.mjs +98 -17
  10. package/scripts/install-mcp.mjs +98 -13
  11. package/scripts/mcp_persistence_server.py +331 -1
  12. package/scripts/secret-scan.mjs +76 -0
  13. package/scripts/validate-routing.mjs +15 -0
  14. package/src/agents/aphrodite.md +7 -0
  15. package/src/agents/demeter.md +7 -0
  16. package/src/agents/hephaestus.md +7 -0
  17. package/src/agents/hermes.md +7 -0
  18. package/src/agents/zeus.md +31 -18
  19. package/src/instructions/agent-return-format.instructions.md +1 -0
  20. package/src/instructions/zeus-anti-stall.instructions.md +43 -5
  21. package/src/instructions/zeus-timeout-retry.instructions.md +47 -10
  22. package/src/mcp/install-mcp.mjs +6 -913
  23. package/src/mcp/mcp_persistence_server.py +332 -0
  24. package/src/mcp/pantheon_vision_server.py +495 -0
  25. package/src/mcp/requirements-vision.txt +3 -0
  26. package/src/pantheon/auto-wake.ts +91 -0
  27. package/src/pantheon/background-job-board.ts +568 -0
  28. package/src/pantheon/file-persistence.ts +95 -0
  29. package/src/pantheon/presets.d.mts +99 -0
  30. package/src/pantheon/presets.mjs +491 -0
  31. package/src/pantheon/vision.ts +1340 -0
  32. package/src/plugin.ts +40 -25
  33. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  34. package/src/plugins/tui/dist/tui.js +806 -222
  35. package/src/plugins/tui/dist/tui.tsx +866 -121
  36. package/src/plugins/tui/package.json +2 -2
  37. package/src/plugins/tui/src/index.tsx +866 -121
  38. package/src/routing.yml +179 -0
package/src/plugin.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import type { Plugin, PluginInput } from '@opencode-ai/plugin'
1
2
  import type { PluginConfig } from 'opencode'
2
3
  import { BackgroundJobBoard } from './pantheon/background-job-board.ts'
3
4
  import { FilePersistenceAdapter } from './pantheon/file-persistence.ts'
5
+ import { createVisionHandler } from './pantheon/vision.ts'
4
6
 
5
7
  // ─── Background Job Board Singleton ────────────────────────────────────
6
8
 
@@ -8,17 +10,11 @@ const board = new BackgroundJobBoard({
8
10
  maxConcurrentPerAgent: 3,
9
11
  signalDir: '.pantheon/deepwork/board-signals',
10
12
  })
11
-
12
- // Wire up file-based persistence and recover orphaned jobs from crashes
13
13
  const persistence = new FilePersistenceAdapter('.pantheon/board/state.json')
14
14
  board.setPersistence(persistence)
15
-
16
- // Recover on startup — any jobs left in "running" state become "error"
17
- board.recoverRunningJobs().catch((err) =>
18
- console.error('[Pantheon Plugin] Failed to recover running jobs:', err),
19
- )
20
-
21
- // Log board state changes to console for observability
15
+ board
16
+ .recoverRunningJobs()
17
+ .catch((err) => console.error('[Pantheon Plugin] Failed to recover running jobs:', err))
22
18
  board.onTerminal((taskID: string) => {
23
19
  const job = board.get(taskID)
24
20
  if (job) {
@@ -29,29 +25,48 @@ board.onTerminal((taskID: string) => {
29
25
  })
30
26
 
31
27
  /**
32
- * Get the global BackgroundJobBoard singleton.
28
+ * Pantheon plugin for OpenCode. Pasted images are intercepted via the
29
+ * `chat.message` hook (proven to fire in opencode 1.18.11). When a provider
30
+ * key is available — env PANTHEON_OPENCODE_API_KEY / OPENCODE_API_KEY, or the
31
+ * opencode auth store for `opencode auth login` users — the image is
32
+ * described NATIVELY by the multimodal model via the opencode Zen
33
+ * OpenAI-compatible endpoint, and replaced with the text description — no MCP
34
+ * tool required. Without a key the legacy pattern applies: the image is
35
+ * replaced with a text instruction telling the model to call a vision MCP tool
36
+ * (default `pantheon_vision_vision_describe`). Either way the image never reaches
37
+ * the main provider, so text-only models cannot fail with an `image_url` error.
33
38
  *
34
- * All modules (Zeus, auto-wake, etc.) should access the board through this
35
- * function to ensure a single consistent state machine across the plugin.
39
+ * The canonical `pantheon-vision` MCP owns the standalone describe/OCR/analyze
40
+ * tools. The installed OpenCode plugin API exposes no stable pre-provider
41
+ * message hook (1.18.11 only exposes the experimental history transform), so
42
+ * that transform is retained as the runtime-compatible fallback. If a stable
43
+ * provider-bound hook is added, register the same sanitizer there instead of
44
+ * assuming this experimental hook is guaranteed to run.
45
+ *
46
+ * IMPORTANT (OpenCode 1.18.11 legacy loader): this module must export EXACTLY
47
+ * ONE function-valued export — the default plugin. The legacy loader does
48
+ * `Object.values(mod)` and invokes every function export as a plugin factory;
49
+ * any named function export (e.g. a re-exported helper like
50
+ * generateInjectionPrompt) is called with a PluginInput object and can throw.
51
+ * Helpers live in src/pantheon/vision.ts and are imported from there directly.
36
52
  */
37
- export function getBackgroundJobBoard(): BackgroundJobBoard {
38
- return board
39
- }
53
+ const plugin: Plugin = async (input: PluginInput) => {
54
+ const vision = createVisionHandler(input)
40
55
 
41
- export default {
42
- name: 'pantheon',
43
- version: '5.0.0',
44
- description: 'Pantheon multi-agent orchestration platform',
45
-
46
- hooks: {
56
+ return {
47
57
  config: async (config: PluginConfig) => {
48
58
  config.agentsPath = config.agentsPath ?? []
49
59
  config.agentsPath.push(new URL('./agents', import.meta.url).pathname)
50
-
51
60
  config.skillsPaths = config.skillsPaths ?? []
52
61
  config.skillsPaths.push(new URL('./skills', import.meta.url).pathname)
53
62
 
54
- return config
63
+ // Do not mutate OpenCode's model/provider defaults here. Presets are
64
+ // explicit CLI/configuration concerns, not a per-turn routing policy.
55
65
  },
56
- },
57
- } satisfies PluginConfig
66
+ 'chat.message': vision.chatMessage,
67
+ 'experimental.chat.messages.transform': vision.messagesTransform,
68
+ event: vision.event,
69
+ }
70
+ }
71
+
72
+ export default plugin
@@ -1 +1 @@
1
- {"version":3,"file":"tui.d.ts","names":[],"sources":["../src/index.tsx"],"mappings":";;cAsbM,QAAQ;EAAoB"}
1
+ {"version":3,"file":"tui.d.ts","names":[],"sources":["../src/index.tsx"],"mappings":";;cA+pCM,QAAQ;EAAoB"}