pantheon-opencode 1.6.0-beta.1 → 1.6.0-beta.11

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 (133) hide show
  1. package/AGENTS.global.md +206 -0
  2. package/AGENTS.md +10 -891
  3. package/CHANGELOG.md +350 -0
  4. package/README.md +561 -52
  5. package/README.pt-BR.md +285 -20
  6. package/bin/pantheon-init.mjs +70 -4
  7. package/commands/pantheon-audit.md +7 -1
  8. package/commands/pantheon-consolidate.md +1 -1
  9. package/commands/pantheon-deepwork.md +14 -3
  10. package/commands/pantheon-focus.md +17 -0
  11. package/commands/pantheon-vision.md +61 -12
  12. package/package.json +24 -17
  13. package/plugin.json +2 -2
  14. package/pyproject.toml +8 -6
  15. package/scripts/build-agents-md.mjs +428 -56
  16. package/scripts/changelog-merge.mjs +161 -0
  17. package/scripts/{code_mode_server.py → code_mode.py} +3 -3
  18. package/scripts/cost.mjs +244 -41
  19. package/scripts/doctor.mjs +151 -1
  20. package/scripts/install/agents-md.mjs +4 -4
  21. package/scripts/install/backup.mjs +475 -0
  22. package/scripts/install/cli-ui.mjs +6 -1
  23. package/scripts/install/config-migration.mjs +317 -4
  24. package/scripts/install/exit-codes.mjs +26 -0
  25. package/scripts/install/health-check.mjs +21 -19
  26. package/scripts/install/interactive.mjs +16 -2
  27. package/scripts/install/migrate.mjs +41 -22
  28. package/scripts/install/opencode-version.mjs +246 -4
  29. package/scripts/install/opencode.mjs +1175 -215
  30. package/scripts/install/plan.mjs +287 -0
  31. package/scripts/install/plugin.mjs +62 -14
  32. package/scripts/install/shared.mjs +190 -48
  33. package/scripts/install/strings.mjs +20 -0
  34. package/scripts/install/venv.mjs +13 -3
  35. package/scripts/install/vision-prompt.mjs +171 -0
  36. package/scripts/install-mcp.mjs +28 -9
  37. package/scripts/{mcp_persistence_server.py → mcp_persistence.py} +52 -17
  38. package/{src/mcp/mcp_resources_server.py → scripts/mcp_resources.py} +2 -2
  39. package/scripts/{memory_mcp_server.py → memory_mcp.py} +2 -2
  40. package/scripts/probe-context-rehydrate.mjs +8 -2
  41. package/scripts/probe-pantheon-cost.mjs +71 -15
  42. package/scripts/prune.mjs +9 -3
  43. package/scripts/restore.mjs +222 -0
  44. package/scripts/run-node-tests.mjs +189 -0
  45. package/scripts/sync-artifacts.mjs +26 -13
  46. package/scripts/sync-tui.mjs +24 -3
  47. package/scripts/test-opencode-v2-sandbox.sh +180 -26
  48. package/scripts/validate-routing.mjs +3 -3
  49. package/scripts/validate-sandbox-install.mjs +138 -0
  50. package/scripts/versioning.mjs +13 -1
  51. package/scripts/vision-status.mjs +682 -0
  52. package/skills-lock.json +8 -8
  53. package/src/agents/aphrodite.md +20 -37
  54. package/src/agents/apollo.md +7 -3
  55. package/src/agents/athena.md +63 -35
  56. package/src/agents/demeter.md +8 -28
  57. package/src/agents/gaia.md +1 -1
  58. package/src/agents/hephaestus.md +10 -21
  59. package/src/agents/hermes.md +15 -38
  60. package/src/agents/iris.md +7 -1
  61. package/src/agents/mnemosyne.md +18 -54
  62. package/src/agents/nyx.md +1 -1
  63. package/src/agents/prometheus.md +16 -20
  64. package/src/agents/talos.md +10 -2
  65. package/src/agents/themis.md +5 -5
  66. package/src/agents/zeus.md +99 -172
  67. package/src/instructions/agent-return-format.instructions.md +34 -17
  68. package/src/instructions/backend-standards.instructions.md +2 -0
  69. package/src/instructions/frontend-standards.instructions.md +3 -1
  70. package/src/instructions/memory-protocol.instructions.md +12 -110
  71. package/src/instructions/test-economy.instructions.md +21 -0
  72. package/src/instructions/zeus-anti-stall.instructions.md +20 -67
  73. package/src/instructions/zeus-communication-rules.instructions.md +0 -1
  74. package/src/instructions/zeus-council-synthesis.instructions.md +31 -260
  75. package/src/instructions/zeus-memory-operations.instructions.md +30 -0
  76. package/src/instructions/zeus-timeout-retry.instructions.md +61 -89
  77. package/src/mcp/{code_mode_server.py → code_mode.py} +3 -3
  78. package/src/mcp/eval_store.py +2 -2
  79. package/src/mcp/{mcp_persistence_server.py → mcp_persistence.py} +52 -17
  80. package/{scripts/mcp_resources_server.py → src/mcp/mcp_resources.py} +2 -2
  81. package/src/mcp/{memory_mcp_server.py → memory_mcp.py} +2 -2
  82. package/src/mcp/{pantheon_vision_server.py → pantheon_vision.py} +286 -42
  83. package/src/mcp/requirements-mcp.txt +6 -4
  84. package/src/mcp/requirements-vision.txt +2 -2
  85. package/src/pantheon/cost-command.ts +403 -102
  86. package/src/pantheon/delegation-enforce.ts +10 -1
  87. package/src/pantheon/model-agents.ts +19 -0
  88. package/src/pantheon/model-command.ts +218 -56
  89. package/src/pantheon/presets.d.mts +0 -8
  90. package/src/pantheon/presets.mjs +5 -32
  91. package/src/pantheon/v2-bounded-read.ts +640 -0
  92. package/src/pantheon/v2-delegation-enforce.ts +214 -0
  93. package/src/pantheon/v2-execute-after.ts +186 -0
  94. package/src/pantheon/v2-model-overrides.ts +275 -0
  95. package/src/pantheon/v2-tools.ts +418 -0
  96. package/src/pantheon/v2-unsupported.d.mts +11 -0
  97. package/src/pantheon/v2-unsupported.mjs +90 -0
  98. package/src/pantheon/v2-vision.ts +622 -0
  99. package/src/pantheon/vision-local.ts +531 -0
  100. package/src/pantheon/vision.ts +1160 -115
  101. package/src/plugin-v2.ts +1158 -219
  102. package/src/plugin.ts +12 -9
  103. package/src/plugins/tui/dist/server.d.ts +1 -2
  104. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  105. package/src/plugins/tui/dist/tui-v2.d.ts +154 -0
  106. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
  107. package/src/plugins/tui/dist/tui-v2.js +659 -0
  108. package/src/plugins/tui/dist/tui-v2.js.map +1 -0
  109. package/src/plugins/tui/dist/tui.d.ts +85 -82
  110. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  111. package/src/plugins/tui/dist/tui.js +72 -59
  112. package/src/plugins/tui/index-v2.ts +6 -0
  113. package/src/plugins/tui/package-lock.json +5516 -1353
  114. package/src/plugins/tui/package.json +22 -12
  115. package/src/plugins/tui/src/index-v2.tsx +734 -0
  116. package/src/plugins/tui/src/index.tsx +106 -85
  117. package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
  118. package/src/plugins/tui/tsconfig.build.json +5 -0
  119. package/src/plugins/tui/tsconfig.typecheck.json +5 -0
  120. package/src/plugins/tui/tsdown.config.ts +22 -2
  121. package/src/plugins/tui/tui-v2.ts +2 -0
  122. package/src/plugins/tui/tui.ts +3 -0
  123. package/src/routing.yml +11 -21
  124. package/src/skills/README.md +3 -3
  125. package/src/skills/agent-coordination/SKILL.md +7 -2
  126. package/src/skills/artifact-management/SKILL.md +12 -5
  127. package/src/skills/auto-continue/SKILL.md +52 -35
  128. package/src/skills/code-review-checklist/SKILL.md +5 -5
  129. package/src/skills/context-compression/SKILL.md +26 -879
  130. package/src/skills/session-goal/SKILL.md +14 -5
  131. package/src/skills/spec-driven-development/SKILL.md +3 -1
  132. package/src/skills/tdd-with-agents/SKILL.md +18 -10
  133. package/opencode.json +0 -58
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+ import { createHash } from 'node:crypto'
3
+ import { readFileSync } from 'node:fs'
4
+ import { join, resolve } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const PACKAGE_REF = /^(?:npm:)?pantheon-opencode(?:@[^/]+)?(?:\/(?:plugin|plugin-v2))?$/
8
+ export const SANDBOX_SOURCE_FILES = [
9
+ 'bin/pantheon-init.mjs',
10
+ 'scripts/install/config-migration.mjs',
11
+ 'scripts/install/opencode.mjs',
12
+ 'scripts/validate-sandbox-install.mjs',
13
+ 'src/plugin-v2.ts',
14
+ ]
15
+
16
+ function readJson(path, label) {
17
+ try {
18
+ return JSON.parse(readFileSync(path, 'utf8'))
19
+ } catch (error) {
20
+ throw new Error(`cannot read ${label} at ${path}: ${error.message}`)
21
+ }
22
+ }
23
+
24
+ function pluginReferences(config) {
25
+ const refs = []
26
+ for (const key of ['plugin', 'plugins']) {
27
+ const value = config?.[key]
28
+ const entries = Array.isArray(value) ? value : value === undefined ? [] : [value]
29
+ for (const entry of entries) {
30
+ if (typeof entry === 'string') refs.push(entry)
31
+ else if (entry && typeof entry === 'object' && !Array.isArray(entry)) {
32
+ for (const field of ['package', 'id', 'name', 'path', 'source']) {
33
+ if (typeof entry[field] === 'string') refs.push(entry[field])
34
+ }
35
+ }
36
+ }
37
+ }
38
+ return refs
39
+ }
40
+
41
+ /**
42
+ * Prove that the sandbox is executing the package built from this checkout and
43
+ * that the project config cannot silently load an older npm-cached Pantheon.
44
+ */
45
+ export function validateSandboxInstall({ repoDir, installDir, projectConfig, configPaths = [] }) {
46
+ const sourcePackagePath = join(resolve(repoDir), 'package.json')
47
+ const installedPackagePath = join(resolve(installDir), 'package.json')
48
+ const sourcePackage = readJson(sourcePackagePath, 'checkout package manifest')
49
+ const installedPackage = readJson(installedPackagePath, 'sandbox package manifest')
50
+ if (sourcePackage.version !== installedPackage.version) {
51
+ throw new Error(
52
+ `sandbox package version ${installedPackage.version} does not match checkout ${sourcePackage.version}`,
53
+ )
54
+ }
55
+
56
+ const sourceHash = createHash('sha256')
57
+ for (const relativePath of SANDBOX_SOURCE_FILES) {
58
+ let source
59
+ let installed
60
+ try {
61
+ source = readFileSync(join(resolve(repoDir), relativePath))
62
+ installed = readFileSync(join(resolve(installDir), relativePath))
63
+ } catch (error) {
64
+ throw new Error(`cannot compare package source ${relativePath}: ${error.message}`)
65
+ }
66
+ if (!source.equals(installed)) {
67
+ throw new Error(`installed package source differs from checkout: ${relativePath}`)
68
+ }
69
+ sourceHash.update(relativePath).update('\0').update(installed).update('\0')
70
+ }
71
+
72
+ const expectedPluginPath = resolve(installDir, 'src', 'plugin-v2')
73
+ const allConfigPaths = [...new Set([projectConfig, ...configPaths].map((path) => resolve(path)))]
74
+ let activeProjectPluginCount = 0
75
+ for (const configPath of allConfigPaths) {
76
+ const config = readJson(configPath, 'active OpenCode config')
77
+ if (!config || typeof config !== 'object' || Array.isArray(config)) {
78
+ throw new Error(`active OpenCode config must be an object: ${configPath}`)
79
+ }
80
+ for (const ref of pluginReferences(config)) {
81
+ const normalized = ref.replaceAll('\\', '/').replace(/\/$/, '')
82
+ if (PACKAGE_REF.test(normalized)) {
83
+ throw new Error(`stale Pantheon package reference in ${configPath}: ${ref}`)
84
+ }
85
+ if (resolve(ref) === expectedPluginPath) {
86
+ if (configPath === resolve(projectConfig)) activeProjectPluginCount += 1
87
+ }
88
+ }
89
+ }
90
+ if (activeProjectPluginCount !== 1) {
91
+ throw new Error(
92
+ `project config must reference the sandbox V2 plugin exactly once; found ${activeProjectPluginCount}: ${resolve(projectConfig)}`,
93
+ )
94
+ }
95
+
96
+ return {
97
+ status: 'PASS',
98
+ version: installedPackage.version,
99
+ sourceSha256: sourceHash.digest('hex'),
100
+ }
101
+ }
102
+
103
+ function parseArgs(args) {
104
+ const options = { configPaths: [] }
105
+ for (let i = 0; i < args.length; i += 1) {
106
+ const arg = args[i]
107
+ if (arg === '--config') options.configPaths.push(args[++i])
108
+ else if (['--repo', '--install', '--project-config'].includes(arg))
109
+ options[arg.slice(2).replace('-', '')] = args[++i]
110
+ else throw new Error(`unknown argument: ${arg}`)
111
+ }
112
+ for (const required of ['repo', 'install', 'projectconfig']) {
113
+ if (!options[required])
114
+ throw new Error(
115
+ `missing required option --${required.replace('projectconfig', 'project-config')}`,
116
+ )
117
+ }
118
+ return {
119
+ repoDir: options.repo,
120
+ installDir: options.install,
121
+ projectConfig: options.projectconfig,
122
+ configPaths: options.configPaths,
123
+ }
124
+ }
125
+
126
+ function main() {
127
+ try {
128
+ const result = validateSandboxInstall(parseArgs(process.argv.slice(2)))
129
+ process.stdout.write(
130
+ `Sandbox install proof: ${result.status} (version ${result.version}, source sha256 ${result.sourceSha256})\n`,
131
+ )
132
+ } catch (error) {
133
+ process.stderr.write(`Sandbox install proof: FAIL — ${error.message}\n`)
134
+ process.exitCode = 1
135
+ }
136
+ }
137
+
138
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main()
@@ -24,6 +24,7 @@ import { execFileSync } from 'node:child_process'
24
24
  import { existsSync, readFileSync } from 'node:fs'
25
25
  import { basename, dirname, join } from 'node:path'
26
26
  import { fileURLToPath } from 'node:url'
27
+ import { mergeUnreleasedIntoVersion } from './changelog-merge.mjs'
27
28
  import {
28
29
  commitPreparedUpdates,
29
30
  prepareInventoryVersion,
@@ -471,6 +472,17 @@ switch (command) {
471
472
  case 'changelog': {
472
473
  const version = arg || getCurrentVersion()
473
474
  const date = new Date().toISOString().slice(0, 10)
475
+ const currentChangelog = readFileSync(CHANGELOG_PATH, 'utf-8')
476
+ const mergePlan = mergeUnreleasedIntoVersion(currentChangelog, version)
477
+ if (mergePlan) {
478
+ if (mergePlan.changed) {
479
+ commitPreparedUpdates([{ path: CHANGELOG_PATH, content: mergePlan.content }])
480
+ console.log(` ✓ CHANGELOG: merged [Unreleased] into existing [v${version}]`)
481
+ } else {
482
+ console.log(` ✓ CHANGELOG: [Unreleased] is empty; [v${version}] unchanged`)
483
+ }
484
+ break
485
+ }
474
486
  const changelogPlan = prepareUnreleased(version, date)
475
487
  if (changelogPlan.changed) {
476
488
  commitPreparedUpdates([{ path: CHANGELOG_PATH, content: changelogPlan.content }])
@@ -492,7 +504,7 @@ Commands:
492
504
  --beta: advance the committed X.Y.Z-beta.N line and
493
505
  promote [Unreleased] → [vX.Y.Z-beta.N] in CHANGELOG
494
506
  beta Alias for 'apply --beta'
495
- changelog [version] Promote [Unreleased] → [vX.Y.Z] without bumping
507
+ changelog [version] Promote [Unreleased], or merge into an existing version section
496
508
 
497
509
  Release flow (stable):
498
510
  1. node scripts/versioning.mjs apply [minor]