pantheon-opencode 1.6.0 → 1.6.2-beta.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 (115) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +45 -0
  4. package/README.md +122 -6
  5. package/README.pt-BR.md +14 -9
  6. package/bin/pantheon-init.mjs +255 -39
  7. package/package.json +8 -6
  8. package/plugin.json +1 -1
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +1 -1
  11. package/scripts/doctor.mjs +231 -46
  12. package/scripts/install/agents-md.mjs +2 -1
  13. package/scripts/install/config-migration.mjs +344 -393
  14. package/scripts/install/config-paths.mjs +15 -0
  15. package/scripts/install/interactive.mjs +30 -9
  16. package/scripts/install/interrupt.mjs +78 -0
  17. package/scripts/install/mcp-permissions.mjs +164 -0
  18. package/scripts/install/opencode-state.mjs +91 -0
  19. package/scripts/install/opencode-version.mjs +31 -13
  20. package/scripts/install/opencode-wildcard.mjs +106 -0
  21. package/scripts/install/opencode.mjs +508 -108
  22. package/scripts/install/plan-artifact.mjs +12 -1
  23. package/scripts/install/plugin.mjs +17 -1
  24. package/scripts/install/run-record.mjs +115 -0
  25. package/scripts/install/strings.mjs +35 -6
  26. package/scripts/install/v2-capabilities.mjs +204 -0
  27. package/scripts/package-evidence.mjs +1 -0
  28. package/scripts/release-gates.mjs +7 -2
  29. package/scripts/sandbox-env.sh +174 -0
  30. package/scripts/setup-v2-config.mjs +1703 -0
  31. package/scripts/setup.mjs +415 -0
  32. package/scripts/sync-tui.mjs +9 -1
  33. package/scripts/test-opencode-v2-sandbox.sh +438 -151
  34. package/scripts/update-skills-lock.mjs +30 -0
  35. package/skills-lock.json +10 -10
  36. package/src/agents/aphrodite.md +5 -2
  37. package/src/agents/apollo.md +5 -0
  38. package/src/agents/athena.md +6 -1
  39. package/src/agents/demeter.md +5 -1
  40. package/src/agents/gaia.md +4 -0
  41. package/src/agents/hephaestus.md +6 -1
  42. package/src/agents/hermes.md +6 -3
  43. package/src/agents/iris.md +5 -1
  44. package/src/agents/mnemosyne.md +20 -50
  45. package/src/agents/nyx.md +5 -1
  46. package/src/agents/prometheus.md +4 -0
  47. package/src/agents/talos.md +4 -0
  48. package/src/agents/themis.md +4 -0
  49. package/src/agents/zeus.md +9 -3
  50. package/src/instructions/agent-return-format.instructions.md +1 -1
  51. package/src/instructions/memory-protocol.instructions.md +3 -3
  52. package/src/instructions/test-economy.instructions.md +6 -6
  53. package/src/mcp/pantheon_vision.py +37 -36
  54. package/src/mcp/requirements-mcp.txt +1 -1
  55. package/src/mcp/requirements-vision.txt +1 -1
  56. package/src/pantheon/cost-command.ts +127 -40
  57. package/src/pantheon/delegation-enforce.ts +160 -23
  58. package/src/pantheon/guard-path.ts +162 -0
  59. package/src/pantheon/v2-bounded-read.ts +15 -1
  60. package/src/pantheon/v2-bridge.ts +27 -0
  61. package/src/pantheon/v2-shell-hooks.ts +260 -0
  62. package/src/pantheon/v2-unsupported.mjs +32 -4
  63. package/src/pantheon/v2-vision.ts +34 -29
  64. package/src/pantheon/vision.ts +49 -11
  65. package/src/plugin-v2.ts +413 -60
  66. package/src/plugin.ts +22 -2
  67. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  68. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  69. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  70. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  71. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  72. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  73. package/src/plugins/tui/dist/quota-cli.js +184 -0
  74. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  75. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +390 -0
  76. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +1 -0
  77. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  78. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  79. package/src/plugins/tui/dist/server-v2.js +673 -0
  80. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  81. package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
  82. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  83. package/src/plugins/tui/dist/tui-v2.js +2492 -529
  84. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  85. package/src/plugins/tui/dist/tui.js +1 -1
  86. package/src/plugins/tui/index-v2.ts +3 -6
  87. package/src/plugins/tui/package-lock.json +11 -11
  88. package/src/plugins/tui/package.json +6 -4
  89. package/src/plugins/tui/src/context-gauge.ts +59 -0
  90. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  91. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  92. package/src/plugins/tui/src/index-v2.tsx +199 -240
  93. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  94. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  95. package/src/plugins/tui/src/quota-cli.ts +237 -0
  96. package/src/plugins/tui/src/quota-rpc.ts +209 -0
  97. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  98. package/src/plugins/tui/src/quota-v2.tsx +986 -0
  99. package/src/plugins/tui/src/server-v2.ts +841 -0
  100. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  101. package/src/plugins/tui/tsconfig.typecheck.json +1 -1
  102. package/src/plugins/tui/tsdown.config.ts +8 -1
  103. package/src/routing.yml +72 -13
  104. package/src/skills/README.md +4 -0
  105. package/src/skills/agent-coordination/SKILL.md +0 -3
  106. package/src/skills/artifact-management/SKILL.md +0 -3
  107. package/src/skills/auto-continue/SKILL.md +0 -3
  108. package/src/skills/code-review-checklist/SKILL.md +0 -3
  109. package/src/skills/context-compression/SKILL.md +0 -3
  110. package/src/skills/memory-bank/SKILL.md +6 -28
  111. package/src/skills/session-goal/SKILL.md +0 -3
  112. package/src/skills/simplify/SKILL.md +5 -4
  113. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  114. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  115. package/src/pantheon/memory-context.ts +0 -1017
@@ -2126,6 +2126,16 @@ function syntheticHistoryPart(message: VisionHistoryMessage, text: string): Text
2126
2126
  }
2127
2127
  }
2128
2128
 
2129
+ /**
2130
+ * Result of a recursive sanitize pass: the (possibly rebuilt) value plus
2131
+ * whether anything at or below it actually changed. Unchanged subtrees keep
2132
+ * the ORIGINAL value by reference so host-owned instances (objects carrying
2133
+ * methods like `.inline()`, class instances, etc.) are never replaced by
2134
+ * plain-object copies — deep-copying them strips prototypes and crashes the
2135
+ * host when it later calls methods on what should still be its own objects.
2136
+ */
2137
+ type SanitizeResult = { value: unknown; changed: boolean }
2138
+
2129
2139
  /**
2130
2140
  * Remove image-bearing parts before a provider serializer can turn them into
2131
2141
  * image_url content. This hook is deliberately synchronous in spirit: it only
@@ -2144,33 +2154,61 @@ export function sanitizeVisionHistory(
2144
2154
  const sessionID = historyMessage.info?.sessionID ?? historyMessage.sessionID ?? ''
2145
2155
  if (nativeVisionSessions.has(sessionID)) continue
2146
2156
  const descriptions = sessionVisionText.get(sessionID)
2147
- const sanitize = (value: unknown, inParts: boolean): unknown => {
2148
- if (Array.isArray(value)) return value.map((item) => sanitize(item, inParts))
2149
- if (!value || typeof value !== 'object') return value
2157
+ const sanitize = (value: unknown, inParts: boolean): SanitizeResult => {
2158
+ // Lazily-copied array: the original array is returned by reference
2159
+ // until the first changed child forces a rebuild.
2160
+ if (Array.isArray(value)) {
2161
+ let items: unknown[] | null = null
2162
+ for (let i = 0; i < value.length; i++) {
2163
+ const result = sanitize(value[i], inParts)
2164
+ if (!result.changed && !items) continue
2165
+ items ??= value.slice(0, i)
2166
+ items.push(result.value)
2167
+ }
2168
+ return items ? { value: items, changed: true } : { value, changed: false }
2169
+ }
2170
+ if (!value || typeof value !== 'object') return { value, changed: false }
2150
2171
 
2151
2172
  const raw = value as { type?: unknown; id?: unknown; mime?: unknown }
2152
2173
  const isImageUrl = raw.type === 'image_url'
2174
+ // AI-SDK provider-bound parts use `{ type: 'image', ... }` rather than
2175
+ // the `image_url`/`file` shapes; without this branch such a part reached
2176
+ // the provider untouched, which is the failure this sanitizer exists to
2177
+ // prevent.
2178
+ const isImagePart = raw.type === 'image'
2153
2179
  const isImageFile =
2154
2180
  raw.type === 'file' &&
2155
2181
  typeof raw.mime === 'string' &&
2156
2182
  raw.mime.toLowerCase().startsWith('image/')
2157
- if (isImageUrl || isImageFile) {
2183
+ if (isImageUrl || isImagePart || isImageFile) {
2158
2184
  const partID = typeof raw.id === 'string' ? raw.id : ''
2159
2185
  const text =
2160
2186
  descriptions?.get(partID) ??
2161
2187
  'Imagem removida do histórico antes do envio ao provedor textual.'
2162
- return inParts ? syntheticHistoryPart(historyMessage, text) : { type: 'text', text }
2188
+ return {
2189
+ value: inParts ? syntheticHistoryPart(historyMessage, text) : { type: 'text', text },
2190
+ changed: true,
2191
+ }
2163
2192
  }
2164
2193
 
2165
- const copy: Record<string, unknown> = {}
2166
- for (const [key, child] of Object.entries(value)) {
2167
- copy[key] = sanitize(child, key === 'parts')
2194
+ // Lazily-copied object: untouched subtrees keep their original value —
2195
+ // including host class instances and objects with methods — so nothing
2196
+ // loses its prototype unless a nested image part must be replaced.
2197
+ const entries = Object.entries(value)
2198
+ let copy: Record<string, unknown> | null = null
2199
+ for (let i = 0; i < entries.length; i++) {
2200
+ const [key, child] = entries[i] as [string, unknown]
2201
+ const result = sanitize(child, key === 'parts')
2202
+ if (!result.changed && !copy) continue
2203
+ copy ??= Object.fromEntries(entries.slice(0, i))
2204
+ copy[key] = result.value
2168
2205
  }
2169
- return copy
2206
+ return copy ? { value: copy, changed: true } : { value, changed: false }
2170
2207
  }
2171
2208
 
2172
- const sanitized = sanitize(historyMessage, false) as VisionHistoryMessage
2173
- for (const [key, value] of Object.entries(sanitized)) {
2209
+ const sanitized = sanitize(historyMessage, false)
2210
+ if (!sanitized.changed) continue
2211
+ for (const [key, value] of Object.entries(sanitized.value as VisionHistoryMessage)) {
2174
2212
  historyMessage[key] = value
2175
2213
  }
2176
2214
  }