pantheon-opencode 1.6.1 → 1.6.2-beta.10
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.
- package/AGENTS.global.md +11 -11
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +179 -0
- package/README.md +268 -20
- package/README.pt-BR.md +34 -11
- package/bin/pantheon-init.mjs +301 -32
- package/package.json +13 -4
- package/plugin.json +1 -1
- package/prompts/README.md +58 -0
- package/prompts/debug-issue.prompt.md +46 -0
- package/prompts/dynamic/agora-generated.txt +38 -0
- package/prompts/dynamic/orchestrate-generated.txt +51 -0
- package/prompts/focus.prompt.md +42 -0
- package/prompts/implement-feature.prompt.md +39 -0
- package/prompts/optimize-database.prompt.md +58 -0
- package/prompts/orchestrate-with-zeus.prompt.md +441 -0
- package/prompts/plan-architecture.prompt.md +59 -0
- package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
- package/prompts/quick-plan-large-feature.prompt.md +197 -0
- package/prompts/semantic-summarize.md +50 -0
- package/prompts/sketch.prompt.md +91 -0
- package/prompts/subtask.prompt.md +131 -0
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +1 -1
- package/scripts/decision-router-budget.mjs +780 -0
- package/scripts/decision-router-v2-budget.mjs +218 -0
- package/scripts/decision-router-v2-egress.mjs +272 -0
- package/scripts/decision-router.mjs +758 -0
- package/scripts/docs-check-changelog.mjs +5 -3
- package/scripts/doctor.mjs +213 -45
- package/scripts/install/agents-md.mjs +2 -1
- package/scripts/install/component-selection.mjs +9 -4
- package/scripts/install/config-migration.mjs +344 -393
- package/scripts/install/config-paths.mjs +15 -0
- package/scripts/install/decision-layer-preview.mjs +376 -0
- package/scripts/install/decision-router-config.mjs +560 -0
- package/scripts/install/health-check.mjs +20 -11
- package/scripts/install/interactive.mjs +103 -14
- package/scripts/install/interrupt.mjs +4 -3
- package/scripts/install/mcp-permissions.mjs +164 -0
- package/scripts/install/migrate.mjs +123 -72
- package/scripts/install/opencode-version.mjs +31 -13
- package/scripts/install/opencode-wildcard.mjs +106 -0
- package/scripts/install/opencode.mjs +411 -184
- package/scripts/install/plan-artifact.mjs +12 -1
- package/scripts/install/plan.mjs +8 -1
- package/scripts/install/plugin.mjs +18 -1
- package/scripts/install/state.mjs +12 -0
- package/scripts/install/strings.mjs +22 -0
- package/scripts/install/v2-capabilities.mjs +5 -6
- package/scripts/install/venv.mjs +34 -17
- package/scripts/mcp_resources.py +11 -9
- package/scripts/package-evidence.mjs +1 -0
- package/scripts/release-notes.mjs +30 -7
- package/scripts/restore.mjs +22 -10
- package/scripts/sandbox-env.sh +174 -0
- package/scripts/setup-v2-config.mjs +1703 -0
- package/scripts/setup.mjs +415 -0
- package/scripts/sync-tui.mjs +9 -1
- package/scripts/test-opencode-v2-sandbox.sh +448 -157
- package/scripts/update-skills-lock.mjs +30 -0
- package/scripts/versioning.mjs +41 -5
- package/skills-lock.json +10 -10
- package/src/agents/aphrodite.md +11 -3
- package/src/agents/apollo.md +6 -0
- package/src/agents/athena.md +7 -1
- package/src/agents/demeter.md +6 -2
- package/src/agents/gaia.md +5 -0
- package/src/agents/hephaestus.md +7 -2
- package/src/agents/hermes.md +14 -13
- package/src/agents/iris.md +6 -2
- package/src/agents/mnemosyne.md +21 -50
- package/src/agents/nyx.md +6 -2
- package/src/agents/prometheus.md +5 -1
- package/src/agents/talos.md +10 -1
- package/src/agents/themis.md +5 -1
- package/src/agents/zeus.md +61 -65
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +3 -3
- package/src/instructions/test-economy.instructions.md +6 -6
- package/src/mcp/eval_store.py +11 -4
- package/src/mcp/mcp_resources.py +11 -9
- package/src/mcp/memory_mcp.py +293 -150
- package/src/mcp/pantheon_vision.py +37 -36
- package/src/pantheon/cost-command.ts +30 -133
- package/src/pantheon/jev-decision-tool.ts +347 -0
- package/src/pantheon/jev-decisions.ts +625 -0
- package/src/pantheon/local-decision-agents.ts +170 -0
- package/src/pantheon/local-decision-budget.ts +1046 -0
- package/src/pantheon/local-decision-egress-gate.ts +144 -0
- package/src/pantheon/local-decision-prompt.ts +256 -0
- package/src/pantheon/local-decision-provider-matrix.ts +44 -0
- package/src/pantheon/local-decision-router.ts +225 -0
- package/src/pantheon/local-decision-skills.ts +281 -0
- package/src/pantheon/local-decision-tool.ts +160 -0
- package/src/pantheon/local-decision-turn.ts +101 -0
- package/src/pantheon/local-decision-usage-evidence.internal.ts +168 -0
- package/src/pantheon/local-orchestration.ts +322 -0
- package/src/pantheon/model-pricing.ts +1 -536
- package/src/pantheon/pantheon-decision-catalog.ts +101 -0
- package/src/pantheon/v2-decision-budget.ts +456 -0
- package/src/pantheon/v2-decision-contracts.ts +300 -0
- package/src/pantheon/v2-decision-egress.ts +203 -0
- package/src/pantheon/v2-decision-events.ts +180 -0
- package/src/pantheon/v2-decision-heuristic.ts +121 -0
- package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
- package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
- package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
- package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
- package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
- package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
- package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
- package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
- package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
- package/src/pantheon/v2-decision-points/p8-guardrail.ts +367 -0
- package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
- package/src/pantheon/v2-decision-points.ts +242 -0
- package/src/pantheon/v2-decision-policy.ts +166 -0
- package/src/pantheon/v2-decision-premises.ts +146 -0
- package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
- package/src/pantheon/v2-decision-rank.ts +91 -0
- package/src/pantheon/v2-decision-registry.ts +391 -0
- package/src/pantheon/v2-decision-resource-ids.ts +127 -0
- package/src/pantheon/v2-decision-shadow.ts +123 -0
- package/src/pantheon/v2-decision-telemetry.ts +214 -0
- package/src/pantheon/v2-decision-verify.ts +51 -0
- package/src/pantheon/v2-hook-engine.ts +307 -0
- package/src/pantheon/v2-native-decisions.ts +365 -0
- package/src/pantheon/v2-shell-hooks.ts +66 -2
- package/src/pantheon/v2-tools.ts +38 -15
- package/src/pantheon/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +43 -10
- package/src/plugin-v2.ts +449 -79
- package/src/plugin.ts +4 -0
- package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
- package/src/plugins/tui/dist/server-v2.d.ts +22 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/server-v2.js +26 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +54 -51
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +762 -529
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +17 -2
- package/src/plugins/tui/package.json +6 -3
- package/src/plugins/tui/src/context-gauge.ts +59 -0
- package/src/plugins/tui/src/cost-data.ts +607 -0
- package/src/plugins/tui/src/index-v2.tsx +360 -242
- package/src/plugins/tui/src/model-pricing.ts +536 -0
- package/src/plugins/tui/src/model-usage-limits.ts +4 -0
- package/src/plugins/tui/src/server-v2.ts +21 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +34 -5
- package/src/routing.yml +72 -13
- package/src/skills/README.md +4 -0
- package/src/skills/agent-coordination/SKILL.md +0 -3
- package/src/skills/artifact-management/SKILL.md +0 -3
- package/src/skills/auto-continue/SKILL.md +0 -3
- package/src/skills/code-review-checklist/SKILL.md +0 -3
- package/src/skills/context-compression/SKILL.md +0 -3
- package/src/skills/memory-bank/SKILL.md +6 -28
- package/src/skills/session-goal/SKILL.md +0 -3
- package/src/skills/simplify/SKILL.md +5 -4
- package/src/skills/tdd-with-agents/SKILL.md +0 -3
- package/src/skills/visual-review-pipeline/SKILL.md +0 -1
- package/src/pantheon/memory-context.ts +0 -1017
|
@@ -36,6 +36,11 @@ function hash(value) {
|
|
|
36
36
|
return createHash('sha256').update(value).digest('hex')
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** Bind an in-memory reviewed plan to the exact JSON payload passed to init. */
|
|
40
|
+
export function planArtifactDigest(artifact) {
|
|
41
|
+
return hash(JSON.stringify(artifact))
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
function lstatOrNull(path) {
|
|
40
45
|
try {
|
|
41
46
|
return lstatSync(path)
|
|
@@ -471,7 +476,10 @@ export function loadPlanArtifact(path) {
|
|
|
471
476
|
}
|
|
472
477
|
|
|
473
478
|
/** Compare current inputs and destinations against a saved reviewed plan. */
|
|
474
|
-
export function findPlanDrift(
|
|
479
|
+
export function findPlanDrift(
|
|
480
|
+
artifact,
|
|
481
|
+
{ target, packageRoot, packageVersion, options, files, snapshots },
|
|
482
|
+
) {
|
|
475
483
|
validatePlanArtifact(artifact)
|
|
476
484
|
const root = resolve(target)
|
|
477
485
|
const reasons = []
|
|
@@ -485,6 +493,9 @@ export function findPlanDrift(artifact, { target, packageRoot, packageVersion, f
|
|
|
485
493
|
sourceFingerprint(packageRoot, [artifact.artifact_path]) !== artifact.package.source_fingerprint
|
|
486
494
|
)
|
|
487
495
|
reasons.push('source')
|
|
496
|
+
if (options !== undefined && JSON.stringify(options) !== JSON.stringify(artifact.options)) {
|
|
497
|
+
reasons.push('options')
|
|
498
|
+
}
|
|
488
499
|
|
|
489
500
|
const currentSnapshots = new Map(snapshots.map((item) => [resolve(item.path), item]))
|
|
490
501
|
for (const operation of artifact.operations) {
|
package/scripts/install/plan.mjs
CHANGED
|
@@ -232,7 +232,7 @@ export function displayPath(target, filePath) {
|
|
|
232
232
|
* assumes V1 and may diverge from an apply on a 2.x host.
|
|
233
233
|
*
|
|
234
234
|
* @param {string} target - install target (used to relativize paths)
|
|
235
|
-
* @param {{ files: object[], totals: object, mcpServers?: string[], versionAssumed?: boolean }} plan
|
|
235
|
+
* @param {{ files: object[], totals: object, mcpServers?: string[], runtimeEffects?: { venv: string, dependencies: string }, versionAssumed?: boolean }} plan
|
|
236
236
|
* @param {{ perFile?: boolean }} [options] - `perFile: false` renders the
|
|
237
237
|
* summary (totals + MCP servers + "No files were written.") without the
|
|
238
238
|
* per-file list. That is the DEFAULT dry-run surface; the per-file list is
|
|
@@ -261,6 +261,13 @@ export function formatChangePlan(target, plan, { perFile = true } = {}) {
|
|
|
261
261
|
names.length === 0 ? 'none (already configured or runtime skipped)' : names.join(', ')
|
|
262
262
|
lines.push(` MCP servers (${names.length}): ${servers}`)
|
|
263
263
|
}
|
|
264
|
+
if (plan.runtimeEffects) {
|
|
265
|
+
const { venv, dependencies } = plan.runtimeEffects
|
|
266
|
+
lines.push(` Python virtual environment: ${venv}`)
|
|
267
|
+
lines.push(
|
|
268
|
+
` MCP dependencies: ${dependencies === 'install' ? 'install (may download packages)' : dependencies}`,
|
|
269
|
+
)
|
|
270
|
+
}
|
|
264
271
|
if (plan.versionAssumed) {
|
|
265
272
|
lines.push(
|
|
266
273
|
' OpenCode host generation unknown — this plan assumes V1 and may diverge from the ' +
|
|
@@ -100,6 +100,15 @@ export function copyPluginFiles(
|
|
|
100
100
|
'plugin entrypoint that re-exports a missing bundle. Reinstall pantheon-opencode.',
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
|
+
const requiredServerBundle = join(srcDir, 'dist', 'server-v2.js')
|
|
104
|
+
const serverBundleAvailable = version !== 'v2' || existsSync(requiredServerBundle)
|
|
105
|
+
if (!serverBundleAvailable) {
|
|
106
|
+
result.errors++
|
|
107
|
+
result.problems.push(
|
|
108
|
+
`TUI server bundle not found in the package: ${requiredServerBundle} — refusing to install a ` +
|
|
109
|
+
'plugin entrypoint that re-exports a missing bundle. Reinstall pantheon-opencode.',
|
|
110
|
+
)
|
|
111
|
+
}
|
|
103
112
|
|
|
104
113
|
if (!dryRun) {
|
|
105
114
|
assertNoSymlinkAncestors(dstDir)
|
|
@@ -136,6 +145,14 @@ export function copyPluginFiles(
|
|
|
136
145
|
if (version === 'v2' && packageJson.exports?.['./tui-v2']) {
|
|
137
146
|
packageJson.exports['./tui'] = packageJson.exports['./tui-v2']
|
|
138
147
|
}
|
|
148
|
+
// The OpenCode host resolves the plugin server through the `./server` export.
|
|
149
|
+
// In the V2 copy it must point at the V2 server entry so the host attaches
|
|
150
|
+
// the copy's V2 server half (the TUI reactive channel depends on it);
|
|
151
|
+
// otherwise the host loads the V1 server stub of the previous generation's
|
|
152
|
+
// payload.
|
|
153
|
+
if (version === 'v2' && packageJson.exports?.['./server-v2']) {
|
|
154
|
+
packageJson.exports['./server'] = packageJson.exports['./server-v2']
|
|
155
|
+
}
|
|
139
156
|
const pkgStatus = writeIfChanged(
|
|
140
157
|
join(dstDir, 'package.json'),
|
|
141
158
|
`${JSON.stringify(packageJson, null, 2)}\n`,
|
|
@@ -166,7 +183,7 @@ export function copyPluginFiles(
|
|
|
166
183
|
|
|
167
184
|
const v2ServerEntry = join(srcDir, 'index-v2.ts')
|
|
168
185
|
const v2ServerDestination = join(dstDir, 'index.ts')
|
|
169
|
-
if (version === 'v2' && existsSync(v2ServerEntry)) {
|
|
186
|
+
if (version === 'v2' && serverBundleAvailable && existsSync(v2ServerEntry)) {
|
|
170
187
|
const entryStatus = writeIfChanged(
|
|
171
188
|
v2ServerDestination,
|
|
172
189
|
readFileSync(v2ServerEntry, 'utf8'),
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* {
|
|
10
10
|
* "schema_version": 2,
|
|
11
11
|
* "pantheon_version": "1.1.1",
|
|
12
|
+
* "migration_schema_version": "3.19.2",
|
|
12
13
|
* "previous_version": "1.1.0",
|
|
13
14
|
* "updated_at": "2026-07-26T10:30:00Z",
|
|
14
15
|
* "migration_checkpoint": null,
|
|
@@ -30,10 +31,12 @@
|
|
|
30
31
|
|
|
31
32
|
import { existsSync, mkdirSync, readFileSync } from 'node:fs'
|
|
32
33
|
import { join, resolve } from 'node:path'
|
|
34
|
+
import { migrateDecisionRouterConfig } from './decision-router-config.mjs'
|
|
33
35
|
import { assertNoSymlinkAncestors, writeFileAtomically } from './verify.mjs'
|
|
34
36
|
|
|
35
37
|
const STATE_FILE = 'install-state.json'
|
|
36
38
|
const STATE_DIR = '.pantheon'
|
|
39
|
+
export const MIGRATION_SCHEMA_VERSION = '3.19.2'
|
|
37
40
|
|
|
38
41
|
function emptyFileInventory(legacyUnknown = true) {
|
|
39
42
|
return {
|
|
@@ -69,6 +72,7 @@ export function createInitialState(version, updatedAt = new Date().toISOString()
|
|
|
69
72
|
return {
|
|
70
73
|
schema_version: 2,
|
|
71
74
|
pantheon_version: version || '0.0.0',
|
|
75
|
+
migration_schema_version: MIGRATION_SCHEMA_VERSION,
|
|
72
76
|
previous_version: null,
|
|
73
77
|
updated_at: updatedAt,
|
|
74
78
|
migration_checkpoint: null,
|
|
@@ -79,6 +83,7 @@ export function createInitialState(version, updatedAt = new Date().toISOString()
|
|
|
79
83
|
plugins: { version: 1, status: 'pending' },
|
|
80
84
|
runtime: { version: 1, status: 'pending' },
|
|
81
85
|
},
|
|
86
|
+
decision_router: migrateDecisionRouterConfig(undefined),
|
|
82
87
|
file_inventory: emptyFileInventory(false),
|
|
83
88
|
}
|
|
84
89
|
}
|
|
@@ -122,6 +127,7 @@ export function upgradeStateV1toV2(state) {
|
|
|
122
127
|
return {
|
|
123
128
|
schema_version: 2,
|
|
124
129
|
pantheon_version: state.pantheon_version || state.version || 'unknown',
|
|
130
|
+
migration_schema_version: state.migration_schema_version ?? null,
|
|
125
131
|
previous_version: state.previous_version || null,
|
|
126
132
|
updated_at: state.updated_at || now,
|
|
127
133
|
migration_checkpoint: null,
|
|
@@ -135,6 +141,7 @@ export function upgradeStateV1toV2(state) {
|
|
|
135
141
|
plugins: { version: 1, status: 'unknown' },
|
|
136
142
|
runtime: { version: 1, status: 'unknown' },
|
|
137
143
|
},
|
|
144
|
+
decision_router: migrateDecisionRouterConfig(state.decision_router),
|
|
138
145
|
file_inventory: normalizeFileInventory(state),
|
|
139
146
|
}
|
|
140
147
|
}
|
|
@@ -153,6 +160,7 @@ export function upgradeStateV1toV2(state) {
|
|
|
153
160
|
* @returns {object} the same state object with required collections present
|
|
154
161
|
*/
|
|
155
162
|
function ensureV2Shape(state) {
|
|
163
|
+
if (!Object.hasOwn(state, 'migration_schema_version')) state.migration_schema_version = null
|
|
156
164
|
if (!Array.isArray(state.applied_migrations)) state.applied_migrations = []
|
|
157
165
|
if (
|
|
158
166
|
!state.components ||
|
|
@@ -169,6 +177,7 @@ function ensureV2Shape(state) {
|
|
|
169
177
|
) {
|
|
170
178
|
state.file_inventory = invalidFileInventory()
|
|
171
179
|
}
|
|
180
|
+
state.decision_router = migrateDecisionRouterConfig(state.decision_router)
|
|
172
181
|
return state
|
|
173
182
|
}
|
|
174
183
|
|
|
@@ -199,6 +208,9 @@ export function writeState(target, state, options = {}) {
|
|
|
199
208
|
assertNoSymlinkAncestors(stateFile)
|
|
200
209
|
state.updated_at = options.updatedAt ?? new Date().toISOString()
|
|
201
210
|
state.schema_version = 2
|
|
211
|
+
if (!Object.hasOwn(state, 'migration_schema_version')) state.migration_schema_version = null
|
|
212
|
+
if (!Array.isArray(state.applied_migrations)) state.applied_migrations = []
|
|
213
|
+
state.decision_router = migrateDecisionRouterConfig(state.decision_router)
|
|
202
214
|
if (!Object.hasOwn(state, 'file_inventory')) {
|
|
203
215
|
state.file_inventory = emptyFileInventory(true)
|
|
204
216
|
} else if (
|
|
@@ -21,6 +21,8 @@ const TABLE = {
|
|
|
21
21
|
cancelPoints: {
|
|
22
22
|
components: 'component selection',
|
|
23
23
|
target: 'install location',
|
|
24
|
+
decisionRouter: 'decision router selection',
|
|
25
|
+
egressConsent: 'external data-sharing consent',
|
|
24
26
|
confirmation: 'pre-install confirmation',
|
|
25
27
|
review: 'review prompt',
|
|
26
28
|
interrupt: 'interrupt (Ctrl-C)',
|
|
@@ -30,6 +32,9 @@ const TABLE = {
|
|
|
30
32
|
// stronger claim would be false.
|
|
31
33
|
canceledAt: (point) =>
|
|
32
34
|
`Installation canceled at ${point} — nothing was applied; no configuration was changed.`,
|
|
35
|
+
interruptedAfterWrite: (backupDir) =>
|
|
36
|
+
`Installation interrupted at Ctrl-C — changes may be partially applied; no automatic rollback was attempted. ` +
|
|
37
|
+
`The backup is preserved${backupDir ? ` at ${backupDir}` : ''}; inspect it and restore manually if needed.`,
|
|
33
38
|
declinedAt: (point) =>
|
|
34
39
|
`Installation declined at ${point} — nothing was applied; no configuration was changed; ` +
|
|
35
40
|
're-run init to review the plan again.',
|
|
@@ -51,6 +56,12 @@ const TABLE = {
|
|
|
51
56
|
nextLaunch: '2. Launch OpenCode',
|
|
52
57
|
nextAgents: '3. Invoke agents with @agent-name in chat',
|
|
53
58
|
nextProject: '4. For project-local install:\n npx pantheon-opencode init --project',
|
|
59
|
+
nextJev:
|
|
60
|
+
'5. Jev decision model (optional, off by default):\n npx pantheon-opencode decision-router setup-model opencode-console-jev/jev-1.13 --monthly-usd 5 --per-decision-usd 0.10\n npx pantheon-opencode decision-router doctor',
|
|
61
|
+
jevConfigured: (target) =>
|
|
62
|
+
`Jev decision model configured: ${target} (consent + caps + period; verify with decision-router doctor)`,
|
|
63
|
+
jevConfigureFailed: (msg) => `Decision-model configuration failed: ${msg}`,
|
|
64
|
+
jevDryRun: (target) => `[DRY-RUN] decision model would be configured: ${target}`,
|
|
54
65
|
// install steps
|
|
55
66
|
globalLayout:
|
|
56
67
|
'Global config directory detected — using flat layout (agents/, skills/, commands/)',
|
|
@@ -111,12 +122,17 @@ const TABLE = {
|
|
|
111
122
|
cancelPoints: {
|
|
112
123
|
components: 'seleção de componentes',
|
|
113
124
|
target: 'local da instalação',
|
|
125
|
+
decisionRouter: 'seleção do roteador decisório',
|
|
126
|
+
egressConsent: 'consentimento de compartilhamento externo',
|
|
114
127
|
confirmation: 'confirmação antes de instalar',
|
|
115
128
|
review: 'prompt de revisão',
|
|
116
129
|
interrupt: 'interrupção (Ctrl-C)',
|
|
117
130
|
},
|
|
118
131
|
canceledAt: (point) =>
|
|
119
132
|
`Instalação cancelada em ${point} — nada foi aplicado; nenhuma configuração foi alterada.`,
|
|
133
|
+
interruptedAfterWrite: (backupDir) =>
|
|
134
|
+
`Instalação interrompida por Ctrl-C — alterações podem ter sido aplicadas parcialmente; nenhum rollback automático foi feito. ` +
|
|
135
|
+
`O backup foi preservado${backupDir ? ` em ${backupDir}` : ''}; revise e restaure manualmente se necessário.`,
|
|
120
136
|
declinedAt: (point) =>
|
|
121
137
|
`Instalação recusada em ${point} — nada foi aplicado; nenhuma configuração foi alterada; ` +
|
|
122
138
|
'rode init de novo para revisar o plano.',
|
|
@@ -138,6 +154,12 @@ const TABLE = {
|
|
|
138
154
|
nextLaunch: '2. Abra o OpenCode',
|
|
139
155
|
nextAgents: '3. Invoc agentes com @nome-do-agente no chat',
|
|
140
156
|
nextProject: '4. Para instalar no projeto:\n npx pantheon-opencode init --project',
|
|
157
|
+
nextJev:
|
|
158
|
+
'5. Modelo de decisão Jev (opcional, desligado por padrão):\n npx pantheon-opencode decision-router setup-model opencode-console-jev/jev-1.13 --monthly-usd 5 --per-decision-usd 0.10\n npx pantheon-opencode decision-router doctor',
|
|
159
|
+
jevConfigured: (target) =>
|
|
160
|
+
`Modelo de decisão Jev configurado: ${target} (consentimento + limites + período; verifique com decision-router doctor)`,
|
|
161
|
+
jevConfigureFailed: (msg) => `Falha ao configurar o modelo de decisão: ${msg}`,
|
|
162
|
+
jevDryRun: (target) => `[DRY-RUN] o modelo de decisão seria configurado: ${target}`,
|
|
141
163
|
// install steps
|
|
142
164
|
globalLayout:
|
|
143
165
|
'Diretório de config global detectado — layout plano (agents/, skills/, commands/)',
|
|
@@ -149,8 +149,8 @@ export function isPantheonV2Reference(ref) {
|
|
|
149
149
|
* Whether the installed Pantheon V2 entry can receive plugin `options`.
|
|
150
150
|
*
|
|
151
151
|
* The host hands a plugin its `options` only from the OBJECT form
|
|
152
|
-
* (`{ package, options }`); a bare string entry leaves `ctx.options` empty
|
|
153
|
-
* `context_pruner`
|
|
152
|
+
* (`{ package, options }`); a bare string entry leaves `ctx.options` empty.
|
|
153
|
+
* `context_pruner` is the remaining opt-in that reads that object. A fresh
|
|
154
154
|
* install that emitted a bare string therefore had no reachable opt-in switch
|
|
155
155
|
* at all — this is the check that reports it after install.
|
|
156
156
|
*
|
|
@@ -183,8 +183,7 @@ export function describePluginOptionsReachability(plugins) {
|
|
|
183
183
|
reachable: true,
|
|
184
184
|
form: 'object',
|
|
185
185
|
detail:
|
|
186
|
-
'at least one Pantheon V2 entry carries an "options" object, so context_pruner
|
|
187
|
-
'memory_injection can be configured there' +
|
|
186
|
+
'at least one Pantheon V2 entry carries an "options" object, so context_pruner can be configured there' +
|
|
188
187
|
(extra.length === 0
|
|
189
188
|
? ''
|
|
190
189
|
: `; ${extra.length} other Pantheon entr${extra.length === 1 ? 'y' : 'ies'} in the same list cannot carry options`),
|
|
@@ -197,9 +196,9 @@ export function describePluginOptionsReachability(plugins) {
|
|
|
197
196
|
form: stringOnly ? 'string' : 'object',
|
|
198
197
|
detail: stringOnly
|
|
199
198
|
? 'the Pantheon V2 entry is a bare string, so the host passes no options and ' +
|
|
200
|
-
'context_pruner
|
|
199
|
+
'context_pruner cannot be enabled; the object form ' +
|
|
201
200
|
'{"package": …, "options": {…}} makes them reachable'
|
|
202
201
|
: 'the Pantheon V2 entry has no "options" object, so the host passes an empty ' +
|
|
203
|
-
'options bag and context_pruner
|
|
202
|
+
'options bag and context_pruner stays at its default',
|
|
204
203
|
}
|
|
205
204
|
}
|
package/scripts/install/venv.mjs
CHANGED
|
@@ -43,8 +43,8 @@ export function venvPythonPath(target) {
|
|
|
43
43
|
* Set up a Python virtual environment and install MCP dependencies.
|
|
44
44
|
*
|
|
45
45
|
* @param {string} target - Target installation directory (e.g. ~/.config/opencode)
|
|
46
|
-
* @param {{ dryRun?: boolean, skipInstall?: boolean, force?: boolean, recorder?: (change: object) => void, reviewedRemovals?: Set<string>|null, reviewedSnapshots?: Map<string, object>|null }} [options]
|
|
47
|
-
* @returns {{ venvPath: string, python: string }}
|
|
46
|
+
* @param {{ dryRun?: boolean, skipInstall?: boolean, force?: boolean, verbose?: boolean, recorder?: (change: object) => void, reviewedRemovals?: Set<string>|null, reviewedSnapshots?: Map<string, object>|null }} [options]
|
|
47
|
+
* @returns {{ venvPath: string, python: string, runtimeEffects: { venv: 'create'|'reuse'|'recreate', dependencies: 'install'|'skip' } }}
|
|
48
48
|
*/
|
|
49
49
|
export function setupVenv(
|
|
50
50
|
target,
|
|
@@ -52,6 +52,7 @@ export function setupVenv(
|
|
|
52
52
|
dryRun = false,
|
|
53
53
|
skipInstall = false,
|
|
54
54
|
force = false,
|
|
55
|
+
verbose = false,
|
|
55
56
|
recorder = null,
|
|
56
57
|
reviewedRemovals = null,
|
|
57
58
|
reviewedSnapshots = null,
|
|
@@ -59,9 +60,13 @@ export function setupVenv(
|
|
|
59
60
|
) {
|
|
60
61
|
const venvPath = join(target, '.venv')
|
|
61
62
|
const pythonBin = venvPythonPath(target)
|
|
63
|
+
const hadVenv = existsSync(venvPath)
|
|
64
|
+
const recreateVenv = force && hadVenv
|
|
65
|
+
const hadPython = existsSync(pythonBin)
|
|
66
|
+
const venvAction = recreateVenv ? 'recreate' : hadPython ? 'reuse' : 'create'
|
|
62
67
|
|
|
63
68
|
// Step 1: Force recreate venv if --force
|
|
64
|
-
if (
|
|
69
|
+
if (recreateVenv) {
|
|
65
70
|
if (dryRun) {
|
|
66
71
|
recordRemovalTree(venvPath, recorder)
|
|
67
72
|
info('.venv would be removed (--force)')
|
|
@@ -74,7 +79,7 @@ export function setupVenv(
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
// Step 1b: Create venv if not exists
|
|
77
|
-
const venvExists =
|
|
82
|
+
const venvExists = !recreateVenv && hadPython
|
|
78
83
|
if (!venvExists) {
|
|
79
84
|
if (dryRun) {
|
|
80
85
|
// Never claim a directory was created by a run that writes nothing.
|
|
@@ -116,12 +121,12 @@ export function setupVenv(
|
|
|
116
121
|
// Ensure PIP_USER=0 to install into venv, not user site-packages
|
|
117
122
|
const pipEnv = { ...process.env, PIP_USER: '0' }
|
|
118
123
|
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
// 30s pause.
|
|
124
|
+
// Inherit pip output while the step marker makes the upgrade's start
|
|
125
|
+
// and outcome explicit.
|
|
122
126
|
const pipUpgradeStep = step('Upgrading pip')
|
|
123
|
-
const
|
|
124
|
-
|
|
127
|
+
const pipVerbosity = verbose ? ['--verbose'] : ['--quiet']
|
|
128
|
+
const pipUpgrade = spawnSync(pip, ['install', ...pipVerbosity, '--upgrade', 'pip'], {
|
|
129
|
+
stdio: 'inherit',
|
|
125
130
|
timeout: 30_000,
|
|
126
131
|
env: pipEnv,
|
|
127
132
|
})
|
|
@@ -129,8 +134,9 @@ export function setupVenv(
|
|
|
129
134
|
pipUpgradeStep(upgraded)
|
|
130
135
|
if (!upgraded) warning('pip upgrade failed — continuing with the bundled version')
|
|
131
136
|
|
|
132
|
-
//
|
|
133
|
-
|
|
137
|
+
// Pip's quiet mode keeps normal init output concise while preserving
|
|
138
|
+
// stderr and its non-zero status; --verbose retains resolver detail.
|
|
139
|
+
const r = spawnSync(pip, ['install', ...pipVerbosity, '-r', reqFile], {
|
|
134
140
|
stdio: 'inherit',
|
|
135
141
|
timeout: 120_000,
|
|
136
142
|
env: pipEnv,
|
|
@@ -139,11 +145,15 @@ export function setupVenv(
|
|
|
139
145
|
if (r.status !== 0) {
|
|
140
146
|
// Attempt 2: --break-system-packages (PEP 668 / externally-managed)
|
|
141
147
|
warning('First attempt failed, retrying with --break-system-packages...')
|
|
142
|
-
const r2 = spawnSync(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
const r2 = spawnSync(
|
|
149
|
+
pip,
|
|
150
|
+
['install', ...pipVerbosity, '-r', reqFile, '--break-system-packages'],
|
|
151
|
+
{
|
|
152
|
+
stdio: 'inherit',
|
|
153
|
+
timeout: 120_000,
|
|
154
|
+
env: pipEnv,
|
|
155
|
+
},
|
|
156
|
+
)
|
|
147
157
|
if (r2.status !== 0) {
|
|
148
158
|
throw new Error(
|
|
149
159
|
'Failed to install MCP dependencies. ' +
|
|
@@ -169,7 +179,14 @@ export function setupVenv(
|
|
|
169
179
|
info('Dependency install skipped (--skip-install)')
|
|
170
180
|
}
|
|
171
181
|
|
|
172
|
-
return {
|
|
182
|
+
return {
|
|
183
|
+
venvPath,
|
|
184
|
+
python: pythonBin,
|
|
185
|
+
runtimeEffects: {
|
|
186
|
+
venv: venvAction,
|
|
187
|
+
dependencies: skipInstall ? 'skip' : 'install',
|
|
188
|
+
},
|
|
189
|
+
}
|
|
173
190
|
}
|
|
174
191
|
|
|
175
192
|
// ---------------------------------------------------------------------------
|
package/scripts/mcp_resources.py
CHANGED
|
@@ -23,7 +23,6 @@ from fastmcp import FastMCP
|
|
|
23
23
|
|
|
24
24
|
# ── Path Resolution ──────────────────────────────────────────────────────────
|
|
25
25
|
_PANTHEON_HOME: Path = pantheon_home()
|
|
26
|
-
_PANTHEON_PROJECT: Path | None = pantheon_project()
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def _within(path: Path, parent: Path) -> bool:
|
|
@@ -68,12 +67,13 @@ def _resource_root(name: str) -> Path | None:
|
|
|
68
67
|
preserves the global fallback while preventing symlink escapes.
|
|
69
68
|
"""
|
|
70
69
|
candidates: list[tuple[Path, Path]] = []
|
|
71
|
-
|
|
70
|
+
project = pantheon_project()
|
|
71
|
+
if project is not None:
|
|
72
72
|
if name in {"agents", "skills"}:
|
|
73
|
-
local =
|
|
73
|
+
local = project / ".opencode"
|
|
74
74
|
candidates.append((local / name, local))
|
|
75
75
|
elif name in {"deepwork", "memory-bank"}:
|
|
76
|
-
local =
|
|
76
|
+
local = project / ".pantheon"
|
|
77
77
|
candidates.append((local / name, local))
|
|
78
78
|
candidates.append((_PANTHEON_HOME / name, _PANTHEON_HOME))
|
|
79
79
|
for root, parent in candidates:
|
|
@@ -86,9 +86,10 @@ def _resource_root(name: str) -> Path | None:
|
|
|
86
86
|
def _resource_roots(name: str) -> list[Path]:
|
|
87
87
|
"""Return safe resource roots in local-first precedence order."""
|
|
88
88
|
roots: list[Path] = []
|
|
89
|
-
|
|
89
|
+
project = pantheon_project()
|
|
90
|
+
if project is not None:
|
|
90
91
|
base_name = ".opencode" if name in {"agents", "skills"} else ".pantheon"
|
|
91
|
-
base =
|
|
92
|
+
base = project / base_name
|
|
92
93
|
local = _safe_root(base / name, base)
|
|
93
94
|
if local is not None:
|
|
94
95
|
roots.append(local)
|
|
@@ -208,9 +209,10 @@ async def list_skills() -> str:
|
|
|
208
209
|
async def get_routing() -> str:
|
|
209
210
|
"""Return the full content of routing.yml."""
|
|
210
211
|
routing_file = _safe_child(_PANTHEON_HOME, "routing.yml")
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
project = pantheon_project()
|
|
213
|
+
if (routing_file is None or not routing_file.is_file()) and project:
|
|
214
|
+
routing_file = _safe_child(project / "src", "routing.yml")
|
|
215
|
+
if routing_file is None or not routing_file.is_file():
|
|
214
216
|
return "routing.yml not found."
|
|
215
217
|
return routing_file.read_text(encoding="utf-8")
|
|
216
218
|
|
|
@@ -31,6 +31,7 @@ const REQUIRED_PAYLOAD = [
|
|
|
31
31
|
'package/src/pantheon/v2-bridge.ts',
|
|
32
32
|
'package/src/plugins/tui/dist/tui.js',
|
|
33
33
|
'package/src/plugins/tui/dist/server.js',
|
|
34
|
+
'package/src/plugins/tui/dist/server-v2.js',
|
|
34
35
|
'package/bin/pantheon-init.mjs',
|
|
35
36
|
'package/scripts/doctor.mjs',
|
|
36
37
|
'package/scripts/node-engine-policy.mjs',
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* bullet `- #N - <subject>` per referenced issue
|
|
20
20
|
* (deduped); the group is OMITTED when no refs exist
|
|
21
21
|
*
|
|
22
|
-
* Omitted (internal, never user-facing):
|
|
23
|
-
* build | style | revert (unknown conventional types too).
|
|
22
|
+
* Omitted (internal, never user-facing): release scope and chore | refactor |
|
|
23
|
+
* test | ci | build | style | revert (unknown conventional types too).
|
|
24
24
|
*
|
|
25
25
|
* Breaking: `BREAKING CHANGE` footer or `type!:` / `type(scope)!:` — the
|
|
26
26
|
* commit keeps its type bucket and the bullet is prefixed with 💥
|
|
@@ -126,6 +126,27 @@ function parseIssueRefs(body) {
|
|
|
126
126
|
return [...body.matchAll(/\b(?:Closes|Fixes|Resolves)\s+#(\d+)\b/gi)].map((m) => Number(m[1]))
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Detect the documented BREAKING CHANGE trailer in the final body paragraph.
|
|
131
|
+
* The marker must be a trailer line, not a phrase embedded in body prose.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} body
|
|
134
|
+
* @returns {boolean}
|
|
135
|
+
*/
|
|
136
|
+
function hasBreakingFooter(body) {
|
|
137
|
+
const footerLines = body
|
|
138
|
+
.trimEnd()
|
|
139
|
+
.split(/\r?\n(?:[ \t]*\r?\n)+/)
|
|
140
|
+
.at(-1)
|
|
141
|
+
.split(/\r?\n/)
|
|
142
|
+
const isTrailerLine = /^[A-Za-z][A-Za-z-]*(?: [A-Za-z][A-Za-z-]*)*:[ \t]+\S/
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
isTrailerLine.test(footerLines[0]) &&
|
|
146
|
+
footerLines.some((line) => /^BREAKING CHANGE:[ \t]+\S.*$/i.test(line))
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
129
150
|
/**
|
|
130
151
|
* Parse one "subject|body" record into a conventional-commit entry.
|
|
131
152
|
* Returns null for records that must be skipped: merge commits ("Merge ..."),
|
|
@@ -151,7 +172,7 @@ export function parseCommitLine(line) {
|
|
|
151
172
|
type: type.toLowerCase(),
|
|
152
173
|
scope: scope || null,
|
|
153
174
|
subject: cleanSubject,
|
|
154
|
-
breaking: Boolean(bang) ||
|
|
175
|
+
breaking: Boolean(bang) || hasBreakingFooter(body),
|
|
155
176
|
refs: parseIssueRefs(body),
|
|
156
177
|
}
|
|
157
178
|
}
|
|
@@ -159,7 +180,8 @@ export function parseCommitLine(line) {
|
|
|
159
180
|
/**
|
|
160
181
|
* Conventional type → final release-note group. Types missing from this map
|
|
161
182
|
* (chore, refactor, test, ci, build, style, revert, unknown) are internal
|
|
162
|
-
* and omitted from the notes.
|
|
183
|
+
* and omitted from the notes. The maintainer-only `release` scope is also
|
|
184
|
+
* omitted, including its issue references.
|
|
163
185
|
*/
|
|
164
186
|
const TYPE_GROUPS = {
|
|
165
187
|
feat: 'whatsNew',
|
|
@@ -172,8 +194,9 @@ const TYPE_GROUPS = {
|
|
|
172
194
|
/**
|
|
173
195
|
* Group parsed commits into the final release-note sections. Breaking
|
|
174
196
|
* commits keep their type bucket (the 💥 marker is applied at render time);
|
|
175
|
-
* internal types are dropped; issue refs from
|
|
176
|
-
* closedIssues (deduped, first occurrence wins). Entries
|
|
197
|
+
* internal types and the `release` scope are dropped; issue refs from remaining
|
|
198
|
+
* commit bodies feed closedIssues (deduped, first occurrence wins). Entries
|
|
199
|
+
* keep git log order.
|
|
177
200
|
*
|
|
178
201
|
* @param {Array<ReturnType<typeof parseCommitLine>>} entries
|
|
179
202
|
* @param {{knownIssues?: string[]|string|null}} [options]
|
|
@@ -192,7 +215,7 @@ export function groupCommits(entries, options = {}) {
|
|
|
192
215
|
}
|
|
193
216
|
const seenRefs = new Set()
|
|
194
217
|
for (const entry of entries) {
|
|
195
|
-
if (!entry) continue
|
|
218
|
+
if (!entry || entry.scope === 'release') continue
|
|
196
219
|
const bucket = TYPE_GROUPS[entry.type]
|
|
197
220
|
if (bucket) groups[bucket].push(entry)
|
|
198
221
|
for (const ref of entry.refs) {
|
package/scripts/restore.mjs
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
restoreBackupSet,
|
|
36
36
|
verifyBackupSet,
|
|
37
37
|
} from './install/backup.mjs'
|
|
38
|
+
import { PROMPT_CANCELED } from './install/prompt-result.mjs'
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Resolve the config dir whose `opencode.json` the installer manages.
|
|
@@ -122,9 +123,16 @@ export function pickBackupSet(configDir, from) {
|
|
|
122
123
|
* @param {string} opts.backupDir
|
|
123
124
|
* @param {boolean} [opts.dryRun]
|
|
124
125
|
* @param {boolean} [opts.yes]
|
|
125
|
-
* @
|
|
126
|
+
* @param {(message: string, options: object) => Promise<unknown>} [opts.promptReview]
|
|
127
|
+
* @returns {Promise<{ ok: boolean, code: number, reason?: string, entries?: object[] }>}
|
|
126
128
|
*/
|
|
127
|
-
export async function runRestore({
|
|
129
|
+
export async function runRestore({
|
|
130
|
+
configDir,
|
|
131
|
+
backupDir,
|
|
132
|
+
dryRun = false,
|
|
133
|
+
yes = false,
|
|
134
|
+
promptReview: injectedPromptReview = null,
|
|
135
|
+
}) {
|
|
128
136
|
const verify = verifyBackupSet(backupDir)
|
|
129
137
|
if (!verify.ok) {
|
|
130
138
|
console.error(
|
|
@@ -155,22 +163,26 @@ export async function runRestore({ configDir, backupDir, dryRun = false, yes = f
|
|
|
155
163
|
|
|
156
164
|
if (dryRun) {
|
|
157
165
|
console.log(' (dry-run) No files were written.')
|
|
158
|
-
return { ok: true, code: 0, entries: plan.entries }
|
|
166
|
+
return { ok: true, code: 0, reason: 'preview', entries: plan.entries }
|
|
159
167
|
}
|
|
160
168
|
|
|
161
|
-
if (
|
|
169
|
+
if (yes !== true) {
|
|
162
170
|
// Reuse the shared confirm semantics (default NO). An interactive TTY may
|
|
163
171
|
// authorize without --yes; a non-TTY run must never proceed silently.
|
|
164
172
|
const tty = Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
165
|
-
if (!tty) {
|
|
173
|
+
if (!tty && typeof injectedPromptReview !== 'function') {
|
|
166
174
|
console.error('❌ Refusing to restore without authorization. Re-run with --yes.')
|
|
167
|
-
return { ok: false, code: 1 }
|
|
175
|
+
return { ok: false, code: 1, reason: 'not-authorized', entries: plan.entries }
|
|
168
176
|
}
|
|
169
|
-
const
|
|
177
|
+
const promptReview =
|
|
178
|
+
injectedPromptReview ?? (await import('./install/interactive.mjs')).promptReview
|
|
170
179
|
const accepted = await promptReview('Restore these changes?', { default: false })
|
|
171
|
-
if (
|
|
180
|
+
if (accepted === PROMPT_CANCELED) {
|
|
181
|
+
return { ok: false, code: 130, reason: 'canceled', entries: plan.entries }
|
|
182
|
+
}
|
|
183
|
+
if (accepted !== true) {
|
|
172
184
|
console.log(' Nothing restored.')
|
|
173
|
-
return { ok: true, code: 0, entries: plan.entries }
|
|
185
|
+
return { ok: true, code: 0, reason: 'declined', entries: plan.entries }
|
|
174
186
|
}
|
|
175
187
|
}
|
|
176
188
|
|
|
@@ -189,7 +201,7 @@ export async function runRestore({ configDir, backupDir, dryRun = false, yes = f
|
|
|
189
201
|
|
|
190
202
|
restoreBackupSet(backupDir, configDir, { dryRun: false })
|
|
191
203
|
console.log(` ✅ Restored ${plan.entries.length} path(s).`)
|
|
192
|
-
return { ok: true, code: 0, entries: plan.entries }
|
|
204
|
+
return { ok: true, code: 0, reason: 'restored', entries: plan.entries }
|
|
193
205
|
}
|
|
194
206
|
|
|
195
207
|
async function main() {
|