pantheon-opencode 1.6.0-beta.8 → 1.6.0
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 +118 -0
- package/AGENTS.md +18 -168
- package/CHANGELOG.md +126 -346
- package/README.md +83 -608
- package/README.pt-BR.md +120 -345
- package/bin/pantheon-init.mjs +366 -132
- package/commands/pantheon-audit.md +7 -1
- package/commands/pantheon-consolidate.md +1 -1
- package/commands/pantheon-deepwork.md +14 -3
- package/commands/pantheon-focus.md +17 -0
- package/commands/pantheon-vision.md +61 -12
- package/package.json +19 -11
- package/plugin.json +1 -1
- package/pyproject.toml +6 -2
- package/scripts/_pantheon_paths.py +24 -0
- package/scripts/build-agents-md.mjs +368 -69
- package/scripts/changelog-merge.mjs +161 -0
- package/scripts/check-plugin-v2-coverage.mjs +11 -8
- package/scripts/docs-check-changelog.mjs +204 -0
- package/scripts/docs-link-check.mjs +314 -0
- package/scripts/docs-media.mjs +157 -0
- package/scripts/doctor.mjs +828 -40
- package/scripts/install/agents-md.mjs +2 -2
- package/scripts/install/backup.mjs +648 -0
- package/scripts/install/cli-ui.mjs +303 -72
- package/scripts/install/component-selection.mjs +61 -0
- package/scripts/install/config-migration.mjs +583 -27
- package/scripts/install/exit-codes.mjs +26 -0
- package/scripts/install/file-inventory.mjs +555 -0
- package/scripts/install/health-check.mjs +31 -25
- package/scripts/install/interactive.mjs +78 -383
- package/scripts/install/migrate.mjs +49 -25
- package/scripts/install/model-picker.mjs +218 -250
- package/scripts/install/opencode-version.mjs +83 -21
- package/scripts/install/opencode.mjs +1465 -180
- package/scripts/install/plan-artifact.mjs +517 -0
- package/scripts/install/plan.mjs +475 -0
- package/scripts/install/plugin.mjs +251 -30
- package/scripts/install/prompt-result.mjs +2 -0
- package/scripts/install/shared.mjs +256 -99
- package/scripts/install/state.mjs +63 -8
- package/scripts/install/strings.mjs +60 -4
- package/scripts/install/venv.mjs +90 -47
- package/scripts/install/verify.mjs +128 -0
- package/scripts/install/vision-prompt.mjs +173 -0
- package/scripts/install-mcp.mjs +2 -2
- package/scripts/manifest-inventory.mjs +49 -3
- package/scripts/mcp_persistence.py +1535 -1050
- package/scripts/memory_mcp.py +12 -843
- package/scripts/node-engine-policy.mjs +85 -0
- package/scripts/package-evidence.mjs +10 -2
- package/scripts/postinstall.mjs +26 -26
- package/scripts/probe-pantheon-cost.mjs +118 -19
- package/scripts/prune.mjs +9 -3
- package/scripts/reconcile.mjs +325 -0
- package/scripts/release-gates.mjs +682 -0
- package/scripts/restore.mjs +222 -0
- package/scripts/run-node-tests.mjs +24 -8
- package/scripts/sync-artifacts.mjs +20 -7
- package/scripts/sync-tui.mjs +29 -4
- package/scripts/test-opencode-v2-sandbox.sh +36 -123
- package/scripts/uninstall.mjs +369 -34
- package/scripts/update.mjs +164 -0
- package/scripts/validate-node-engine-policy.mjs +13 -0
- package/scripts/version-check.mjs +34 -1
- package/scripts/versioning.mjs +23 -3
- package/scripts/vision-status.mjs +682 -0
- package/skills-lock.json +8 -8
- package/src/agents/aphrodite.md +13 -10
- package/src/agents/apollo.md +4 -5
- package/src/agents/athena.md +74 -46
- package/src/agents/demeter.md +10 -7
- package/src/agents/gaia.md +0 -1
- package/src/agents/hephaestus.md +4 -3
- package/src/agents/hermes.md +10 -9
- package/src/agents/iris.md +6 -1
- package/src/agents/mnemosyne.md +14 -15
- package/src/agents/nyx.md +4 -4
- package/src/agents/prometheus.md +12 -11
- package/src/agents/talos.md +6 -0
- package/src/agents/zeus.md +84 -56
- package/src/instructions/agent-return-format.instructions.md +12 -41
- package/src/instructions/memory-protocol.instructions.md +5 -11
- package/src/instructions/test-economy.instructions.md +12 -0
- package/src/instructions/yagni.instructions.md +6 -15
- package/src/instructions/zeus-anti-stall.instructions.md +6 -6
- package/src/instructions/zeus-communication-rules.instructions.md +6 -6
- package/src/instructions/zeus-council-synthesis.instructions.md +11 -12
- package/src/instructions/zeus-memory-operations.instructions.md +13 -7
- package/src/instructions/zeus-timeout-retry.instructions.md +36 -10
- package/src/mcp/_pantheon_paths.py +24 -0
- package/src/mcp/mcp_codemap_module.py +86 -18
- package/src/mcp/mcp_persistence.py +1535 -1050
- package/src/mcp/memory_mcp.py +444 -94
- package/src/mcp/pantheon_vision.py +285 -41
- package/src/mcp/requirements-mcp.txt +5 -0
- package/src/pantheon/context-pruner.ts +541 -0
- package/src/pantheon/cost-command.ts +814 -60
- package/src/pantheon/goal-loop.ts +11 -8
- package/src/pantheon/memory-context.ts +1017 -0
- package/src/pantheon/model-agents.ts +19 -0
- package/src/pantheon/model-command.ts +218 -56
- package/src/pantheon/model-pricing.ts +536 -0
- package/src/pantheon/presets.mjs +2 -0
- package/src/pantheon/task-result-guard.ts +50 -14
- package/src/pantheon/v2-bounded-read.ts +640 -0
- package/src/pantheon/v2-delegation-enforce.ts +133 -6
- package/src/pantheon/v2-execute-after.ts +135 -24
- package/src/pantheon/v2-model-overrides.ts +275 -0
- package/src/pantheon/v2-tools.ts +89 -35
- package/src/pantheon/v2-unsupported.mjs +2 -3
- package/src/pantheon/v2-vision.ts +622 -0
- package/src/pantheon/vision-local.ts +531 -0
- package/src/pantheon/vision.ts +1160 -115
- package/src/plugin-v2.ts +654 -162
- package/src/plugin.ts +15 -11
- package/src/plugins/tui/dist/tui-v2.d.ts +1036 -0
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/tui-v2.js +3808 -0
- package/src/plugins/tui/dist/tui-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui.js +4 -4
- package/src/plugins/tui/index-v2.ts +6 -0
- package/src/plugins/tui/package-lock.json +5416 -1297
- package/src/plugins/tui/package.json +14 -10
- package/src/plugins/tui/src/index-v2.tsx +4372 -0
- package/src/plugins/tui/src/index.tsx +3 -3
- package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
- package/src/plugins/tui/tsconfig.typecheck.json +5 -0
- package/src/plugins/tui/tsdown.config.ts +2 -2
- package/src/plugins/tui/tui-v2.ts +2 -0
- package/src/plugins/tui/tui.ts +3 -0
- package/src/routing.yml +50 -5
- package/src/skills/agent-coordination/SKILL.md +7 -2
- package/src/skills/artifact-management/SKILL.md +5 -1
- package/src/skills/auto-continue/SKILL.md +14 -6
- package/src/skills/codemap/SKILL.md +1 -1
- package/src/skills/memory-bank/SKILL.md +21 -13
- package/src/skills/session-goal/SKILL.md +14 -15
- package/src/skills/spec-driven-development/SKILL.md +3 -1
- package/src/skills/worktrees/SKILL.md +30 -11
- package/scripts/probe-context-rehydrate.mjs +0 -263
package/src/pantheon/v2-tools.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* V2 tool surface — the Pantheon tools that are self-sufficient on the
|
|
3
3
|
* OpenCode V2 host, declared for `ctx.tool.transform`'s `draft.add`.
|
|
4
4
|
*
|
|
5
|
-
* ## Why only three tools
|
|
5
|
+
* ## Why only three unconditional tools
|
|
6
6
|
*
|
|
7
7
|
* A V2 tool can only be served here when it needs no V1 infrastructure. The
|
|
8
8
|
* three goal tools (`pantheon_goal_create`, `pantheon_goal_get`,
|
|
@@ -18,6 +18,15 @@
|
|
|
18
18
|
* `pantheon_model` (reads/writes `active-preset.json`) need none of that, so
|
|
19
19
|
* they are wired to their real V1 implementations.
|
|
20
20
|
*
|
|
21
|
+
* ## Three unconditional tools, up to two host-dependent ones
|
|
22
|
+
*
|
|
23
|
+
* The three above are always built. Two more exist on the V2 host and are
|
|
24
|
+
* conditional: `vision_describe` is added here when the caller supplies a
|
|
25
|
+
* vision runtime (the host model catalog), and `pantheon_bounded_read` is
|
|
26
|
+
* appended by the plugin when the host exposes its permission and session APIs
|
|
27
|
+
* (root Zeus sessions only). The effective count is therefore 3 unconditional
|
|
28
|
+
* plus up to 2 host-dependent — never a flat 3.
|
|
29
|
+
*
|
|
21
30
|
* ## The output declaration is mandatory
|
|
22
31
|
*
|
|
23
32
|
* The host enforces a biconditional between a tool's declared `output` and the
|
|
@@ -40,6 +49,7 @@ import { createCostCommand } from './cost-command.ts'
|
|
|
40
49
|
import { createHashlineEditTool, type HashlineToolResult } from './hashline/tool.ts'
|
|
41
50
|
import { createModelCommand } from './model-command.ts'
|
|
42
51
|
import type { ToolContextLike } from './tool-context.ts'
|
|
52
|
+
import { createV2VisionTool, type V2VisionRuntime } from './v2-vision.ts'
|
|
43
53
|
|
|
44
54
|
// ─── Contract types ─────────────────────────────────────────────────────
|
|
45
55
|
|
|
@@ -283,6 +293,17 @@ const COST_INPUT: Record<string, unknown> = {
|
|
|
283
293
|
maximum: 365,
|
|
284
294
|
description: 'Reporting window in days (default 7).',
|
|
285
295
|
},
|
|
296
|
+
session: {
|
|
297
|
+
type: 'string',
|
|
298
|
+
minLength: 1,
|
|
299
|
+
description:
|
|
300
|
+
'Root session id. The report is scoped to that session plus every descendant session in its subtree.',
|
|
301
|
+
},
|
|
302
|
+
refreshPricing: {
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
description:
|
|
305
|
+
'Await a models.dev price refresh (bounded by a short timeout) instead of using the cached catalog. This is the only path that waits on the network.',
|
|
306
|
+
},
|
|
286
307
|
},
|
|
287
308
|
}
|
|
288
309
|
|
|
@@ -295,6 +316,28 @@ function coerceDays(value: unknown): { ok: true; days?: number } | { ok: false;
|
|
|
295
316
|
return { ok: true, days: value }
|
|
296
317
|
}
|
|
297
318
|
|
|
319
|
+
/** Validate `session` exactly as the V1 zod schema does; absent means no scope. */
|
|
320
|
+
function coerceSession(
|
|
321
|
+
value: unknown,
|
|
322
|
+
): { ok: true; session?: string } | { ok: false; error: string } {
|
|
323
|
+
if (value === undefined) return { ok: true }
|
|
324
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
325
|
+
return { ok: false, error: 'pantheon_cost: "session" must be a non-empty string' }
|
|
326
|
+
}
|
|
327
|
+
return { ok: true, session: value }
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Validate `refreshPricing` exactly as the V1 zod schema does; absent means cached. */
|
|
331
|
+
function coerceRefreshPricing(
|
|
332
|
+
value: unknown,
|
|
333
|
+
): { ok: true; refreshPricing?: boolean } | { ok: false; error: string } {
|
|
334
|
+
if (value === undefined) return { ok: true }
|
|
335
|
+
if (typeof value !== 'boolean') {
|
|
336
|
+
return { ok: false, error: 'pantheon_cost: "refreshPricing" must be a boolean' }
|
|
337
|
+
}
|
|
338
|
+
return { ok: true, refreshPricing: value }
|
|
339
|
+
}
|
|
340
|
+
|
|
298
341
|
const costCommand = createCostCommand()
|
|
299
342
|
|
|
300
343
|
async function executeCost(
|
|
@@ -303,14 +346,29 @@ async function executeCost(
|
|
|
303
346
|
): Promise<V2ToolResult> {
|
|
304
347
|
const days = coerceDays(input.days)
|
|
305
348
|
if (!days.ok) return { output: days.error }
|
|
349
|
+
const session = coerceSession(input.session)
|
|
350
|
+
if (!session.ok) return { output: session.error }
|
|
351
|
+
const refreshPricing = coerceRefreshPricing(input.refreshPricing)
|
|
352
|
+
if (!refreshPricing.ok) return { output: refreshPricing.error }
|
|
353
|
+
// Every accepted option is forwarded: a schema the host validates but the
|
|
354
|
+
// wrapper drops would be a tool that silently ignores its own arguments.
|
|
306
355
|
// The V1 tool already wraps its whole body and reports failures as text.
|
|
307
|
-
const output = await costCommand.pantheon_cost.execute(
|
|
356
|
+
const output = await costCommand.pantheon_cost.execute(
|
|
357
|
+
{
|
|
358
|
+
...(days.days === undefined ? {} : { days: days.days }),
|
|
359
|
+
...(session.session === undefined ? {} : { session: session.session }),
|
|
360
|
+
...(refreshPricing.refreshPricing === undefined
|
|
361
|
+
? {}
|
|
362
|
+
: { refreshPricing: refreshPricing.refreshPricing }),
|
|
363
|
+
},
|
|
364
|
+
toolContext(context),
|
|
365
|
+
)
|
|
308
366
|
return { output }
|
|
309
367
|
}
|
|
310
368
|
|
|
311
369
|
// ─── pantheon_model ─────────────────────────────────────────────────────
|
|
312
370
|
|
|
313
|
-
/** JSON Schema for `pantheon_model
|
|
371
|
+
/** JSON Schema for V2 `pantheon_model`; global scope is intentionally absent. */
|
|
314
372
|
const MODEL_INPUT: Record<string, unknown> = {
|
|
315
373
|
type: 'object',
|
|
316
374
|
additionalProperties: false,
|
|
@@ -329,39 +387,27 @@ const MODEL_INPUT: Record<string, unknown> = {
|
|
|
329
387
|
},
|
|
330
388
|
scope: {
|
|
331
389
|
type: 'string',
|
|
332
|
-
enum: ['project'
|
|
333
|
-
description: '
|
|
334
|
-
},
|
|
335
|
-
confirm: {
|
|
336
|
-
type: 'boolean',
|
|
337
|
-
description: 'Explicit confirmation for a mutating operation; required for global changes.',
|
|
338
|
-
},
|
|
339
|
-
authorize_global: {
|
|
340
|
-
type: 'boolean',
|
|
341
|
-
description: 'Separate authorization for global configuration; not implied by confirm.',
|
|
390
|
+
enum: ['project'],
|
|
391
|
+
description: 'Project scope only; global overrides are not supported in V2.',
|
|
342
392
|
},
|
|
343
393
|
},
|
|
344
394
|
}
|
|
345
395
|
|
|
346
|
-
const
|
|
347
|
-
'the interactive wizard has no user in the V2 tool surface — pass action="status" to read ' +
|
|
348
|
-
'the current overrides, or pass agent and model explicitly for action="set"'
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* The V1 command falls back to an interactive readline prompt when invoked
|
|
352
|
-
* with no arguments. A tool call has no user at the terminal, so that fallback
|
|
353
|
-
* would block the call until it timed out. `ask` is injected to refuse
|
|
354
|
-
* deterministically instead, which routes through the command's own
|
|
355
|
-
* `wizard canceled` error path rather than forking its logic.
|
|
356
|
-
*/
|
|
357
|
-
const modelCommand = createModelCommand({
|
|
358
|
-
ask: () => Promise.reject(new Error(WIZARD_UNAVAILABLE)),
|
|
359
|
-
})
|
|
396
|
+
const modelCommand = createModelCommand({ v2Mode: true })
|
|
360
397
|
|
|
361
398
|
async function executeModel(
|
|
362
399
|
input: Record<string, unknown>,
|
|
363
400
|
context: unknown,
|
|
364
401
|
): Promise<V2ToolResult> {
|
|
402
|
+
if (input.scope !== undefined && input.scope !== 'project') {
|
|
403
|
+
return { output: 'Error: V2 pantheon_model is project-only; global scope is not supported.' }
|
|
404
|
+
}
|
|
405
|
+
if (Object.hasOwn(input, 'confirm') || Object.hasOwn(input, 'authorize_global')) {
|
|
406
|
+
return {
|
|
407
|
+
output:
|
|
408
|
+
'Error: V2 pantheon_model does not accept authorization flags; global authorization is not supported by this tool.',
|
|
409
|
+
}
|
|
410
|
+
}
|
|
365
411
|
// The V1 tool validates its own args (zod) and reports failures as text.
|
|
366
412
|
const output = await modelCommand.pantheon_model.execute(
|
|
367
413
|
input as Parameters<typeof modelCommand.pantheon_model.execute>[0],
|
|
@@ -388,8 +434,8 @@ async function executeModel(
|
|
|
388
434
|
* performs filesystem or database work at construction, so importing this
|
|
389
435
|
* module stays side-effect free.
|
|
390
436
|
*/
|
|
391
|
-
export function createV2ToolDefinitions(): V2ToolDef[] {
|
|
392
|
-
|
|
437
|
+
export function createV2ToolDefinitions(visionRuntime?: V2VisionRuntime): V2ToolDef[] {
|
|
438
|
+
const definitions: V2ToolDef[] = [
|
|
393
439
|
{
|
|
394
440
|
name: 'hashline_edit',
|
|
395
441
|
description:
|
|
@@ -405,8 +451,13 @@ export function createV2ToolDefinitions(): V2ToolDef[] {
|
|
|
405
451
|
{
|
|
406
452
|
name: 'pantheon_cost',
|
|
407
453
|
description:
|
|
408
|
-
'Report
|
|
409
|
-
'
|
|
454
|
+
'Report token usage and USD cost by agent and phase, by model, and by session, over the ' +
|
|
455
|
+
'last N days from opencode.db (read-only). Costs come from the models.dev catalog cached ' +
|
|
456
|
+
'on disk: a call reads that cache and never waits on the network unless refreshPricing is ' +
|
|
457
|
+
'set, a stale cache is refreshed in the background and the report says so, and an unpriced ' +
|
|
458
|
+
'model reads — and is excluded from the totals, which then say partial. Pass session=<root ' +
|
|
459
|
+
'session id> to aggregate that session plus its descendant sessions. Phase may be unknown ' +
|
|
460
|
+
'on V2; costs are catalog list prices, not an invoice.',
|
|
410
461
|
input: COST_INPUT,
|
|
411
462
|
output: {},
|
|
412
463
|
execute: executeCost,
|
|
@@ -414,13 +465,16 @@ export function createV2ToolDefinitions(): V2ToolDef[] {
|
|
|
414
465
|
{
|
|
415
466
|
name: 'pantheon_model',
|
|
416
467
|
description:
|
|
417
|
-
'Show, set, or reset per-agent model overrides in active-preset.json
|
|
418
|
-
'
|
|
419
|
-
'
|
|
420
|
-
'
|
|
468
|
+
'Show, set, or reset explicit per-agent project-scoped model overrides in active-preset.json. ' +
|
|
469
|
+
'V2 ignores static preset names and PANTHEON_MODEL_PRESET; no wizard or implicit model ' +
|
|
470
|
+
'selection. Global overrides are not read or written in V2; future global support requires ' +
|
|
471
|
+
'separate explicit authorization. Pass action="status" to read project-scoped overrides. ' +
|
|
472
|
+
'Never writes .env or top-level model/small_model.',
|
|
421
473
|
input: MODEL_INPUT,
|
|
422
474
|
output: {},
|
|
423
475
|
execute: executeModel,
|
|
424
476
|
},
|
|
425
477
|
]
|
|
478
|
+
if (visionRuntime) definitions.push(createV2VisionTool(visionRuntime))
|
|
479
|
+
return definitions
|
|
426
480
|
}
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
* So a `.mjs` import is the only form all three consumers can share, and it
|
|
22
22
|
* matches the existing `src/pantheon/presets.mjs` + `.d.mts` precedent.
|
|
23
23
|
*
|
|
24
|
-
* NOT the reason: type-stripping. `package.json#engines` admits
|
|
25
|
-
*
|
|
26
|
-
* unflagged type-stripping (it landed in 22.18.0), so that argument would not
|
|
24
|
+
* NOT the reason: type-stripping. `package.json#engines` admits Node >=26.4.0,
|
|
25
|
+
* which defaults to unflagged type-stripping (it landed in 22.18.0), so that argument would not
|
|
27
26
|
* have held on any admitted version. The live hazard is that `engines` is not
|
|
28
27
|
* ENFORCED: a Node 20 user can run `doctor` and would get no type-stripping,
|
|
29
28
|
* which is an argument for a runtime version check, not for this file's shape.
|