pantheon-opencode 1.7.0 → 2.0.0-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.
- package/AGENTS.global.md +2 -2
- package/AGENTS.md +3 -3
- package/CHANGELOG.md +64 -60
- package/README.md +52 -45
- package/README.pt-BR.md +19 -19
- package/bin/pantheon-init.mjs +11 -48
- package/package.json +9 -13
- package/plugin.json +2 -2
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +7 -6
- package/scripts/{check-plugin-v2-coverage.mjs → check-plugin-coverage.mjs} +7 -7
- package/scripts/{decision-router-v2-budget.mjs → decision-router-budget-gates.mjs} +1 -1
- package/scripts/{decision-router-v2-egress.mjs → decision-router-egress.mjs} +1 -1
- package/scripts/decision-router.mjs +2 -2
- package/scripts/docs-media.mjs +1 -1
- package/scripts/doctor.mjs +225 -136
- package/scripts/install/behavior-overrides.bundle.mjs +123 -0
- package/scripts/install/{v2-capabilities.mjs → capabilities.mjs} +7 -7
- package/scripts/install/config-migration.mjs +60 -253
- package/scripts/install/file-inventory.mjs +6 -4
- package/scripts/install/interactive.mjs +1 -1
- package/scripts/install/opencode-state.mjs +13 -12
- package/scripts/install/opencode-version.mjs +97 -162
- package/scripts/install/opencode.mjs +271 -428
- package/scripts/install/plan.mjs +1 -9
- package/scripts/install/plugin.mjs +19 -35
- package/scripts/install/shared.mjs +40 -1
- package/scripts/package-evidence.mjs +1 -4
- package/scripts/probe-pantheon-cost.mjs +1 -1
- package/scripts/reconcile.mjs +5 -7
- package/scripts/release-gates.mjs +22 -61
- package/scripts/setup-v2-config.mjs +10 -8
- package/scripts/setup.mjs +12 -22
- package/scripts/sync-tui.mjs +9 -17
- package/scripts/{test-opencode-v2-sandbox.sh → test-opencode-sandbox.sh} +9 -9
- package/scripts/update-skills-lock.mjs +24 -12
- package/scripts/update.mjs +17 -1
- package/scripts/validate-routing.mjs +79 -4
- package/scripts/validate-sandbox-install.mjs +3 -3
- package/skills-lock.json +25 -8
- package/src/agents/zeus.md +1 -0
- package/src/pantheon/behavior-overrides.ts +191 -0
- package/src/pantheon/{v2-bounded-read.ts → bounded-read.ts} +1 -1
- package/src/pantheon/cost-command.ts +1 -1
- package/src/pantheon/{v2-decision-contracts.ts → decision-contracts.ts} +3 -3
- package/src/pantheon/{v2-decision-points → decision-points}/p1-agent.ts +3 -3
- package/src/pantheon/{v2-decision-points → decision-points}/p10-claims.ts +2 -2
- package/src/pantheon/{v2-decision-points → decision-points}/p11-catalog.ts +2 -2
- package/src/pantheon/{v2-decision-points → decision-points}/p2-skill.ts +3 -3
- package/src/pantheon/{v2-decision-points → decision-points}/p3-complexity.ts +6 -6
- package/src/pantheon/{v2-decision-points → decision-points}/p4-memory.ts +2 -2
- package/src/pantheon/{v2-decision-points → decision-points}/p5-themis-verify.ts +2 -2
- package/src/pantheon/{v2-decision-points → decision-points}/p6-council.ts +3 -3
- package/src/pantheon/{v2-decision-points → decision-points}/p7-loop.ts +5 -5
- package/src/pantheon/{v2-decision-points → decision-points}/p8-guardrail.ts +2 -2
- package/src/pantheon/{v2-decision-points → decision-points}/p9-memory-compaction.ts +2 -2
- package/src/pantheon/{v2-decision-points.ts → decision-points.ts} +5 -5
- package/src/pantheon/{v2-decision-policy.ts → decision-policy.ts} +2 -2
- package/src/pantheon/{v2-decision-prompt-surface.ts → decision-prompt-surface.ts} +3 -3
- package/src/pantheon/{v2-decision-registry.ts → decision-registry.ts} +10 -13
- package/src/pantheon/{v2-decision-resource-ids.ts → decision-resource-ids.ts} +1 -1
- package/src/pantheon/{v2-decision-shadow.ts → decision-shadow.ts} +1 -1
- package/src/pantheon/{v2-decision-telemetry.ts → decision-telemetry.ts} +1 -1
- package/src/pantheon/{v2-execute-after.ts → execute-after.ts} +4 -4
- package/src/pantheon/goal-store.ts +7 -0
- package/src/pantheon/{v2-hook-engine.ts → hook-engine.ts} +3 -3
- package/src/pantheon/jev-decision-tool.ts +3 -3
- package/src/pantheon/jev-decisions.ts +12 -6
- package/src/pantheon/jev-escalation.ts +6 -6
- package/src/pantheon/jev-quality-score.ts +2 -2
- package/src/pantheon/jev-rank-verify.ts +2 -2
- package/src/pantheon/jev-risk-gate.ts +4 -4
- package/src/pantheon/local-decision-agents.ts +1 -1
- package/src/pantheon/local-decision-router.ts +1 -1
- package/src/pantheon/local-decision-tool.ts +2 -2
- package/src/pantheon/local-orchestration.ts +1 -1
- package/src/pantheon/model-command.ts +1 -1
- package/src/pantheon/{v2-vision.ts → native-vision.ts} +12 -15
- package/src/pantheon/pantheon-decision-catalog.ts +12 -0
- package/src/pantheon/{v2-shell-hooks.ts → shell-hooks.ts} +4 -4
- package/src/pantheon/{v2-tools.ts → tools.ts} +4 -4
- package/src/pantheon/{v2-unsupported.d.mts → unsupported.d.mts} +3 -3
- package/src/pantheon/{v2-unsupported.mjs → unsupported.mjs} +8 -8
- package/src/pantheon/update-notifier.ts +101 -0
- package/src/pantheon/vision-local.ts +12 -3
- package/src/pantheon/vision.ts +120 -2
- package/src/{plugin-v2 → plugin}/index.ts +7 -7
- package/src/plugin.ts +2875 -500
- package/src/plugins/hook-runner.ts +3 -3
- package/src/plugins/tui/dist/server.d.ts +23 -9
- package/src/plugins/tui/dist/server.d.ts.map +1 -1
- package/src/plugins/tui/dist/server.js +25 -12
- package/src/plugins/tui/dist/server.js.map +1 -1
- package/src/plugins/tui/dist/tui.d.ts +1023 -494
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +4841 -2066
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/{index-v2.ts → index.ts} +1 -1
- package/src/plugins/tui/package-lock.json +2 -42
- package/src/plugins/tui/package.json +4 -10
- package/src/plugins/tui/src/cost-data.ts +1 -1
- package/src/plugins/tui/src/index.tsx +4222 -2822
- package/src/plugins/tui/src/pantheon-settings-state.ts +111 -0
- package/src/plugins/tui/src/pantheon-settings.tsx +236 -0
- package/src/plugins/tui/src/server.ts +23 -10
- package/src/plugins/tui/src/update-notice.ts +86 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +3 -5
- package/src/plugins/tui/tui.ts +1 -2
- package/src/routing.yml +36 -0
- package/src/skills/README.md +16 -1
- package/src/skills/artifact-management/SKILL.md +10 -67
- package/src/skills/artifact-management/references/artifact-templates.md +71 -0
- package/src/skills/auto-continue/SKILL.md +10 -0
- package/src/skills/code-review-checklist/SKILL.md +11 -44
- package/src/skills/code-review-checklist/references/review-checklists.md +54 -0
- package/src/skills/instruction-forge/SKILL.md +57 -0
- package/src/skills/instruction-forge/references/agents-md-doctrine.md +50 -0
- package/src/skills/instruction-forge/references/eval-doctrine.md +37 -0
- package/src/skills/instruction-forge/references/skill-doctrine.md +62 -0
- package/src/skills/memory-bank/SKILL.md +11 -90
- package/src/skills/memory-bank/references/anti-patterns.md +33 -0
- package/src/skills/memory-bank/references/product-adoption.md +19 -0
- package/src/skills/memory-bank/references/storage-model.md +21 -0
- package/src/skills/memory-bank/references/structure-and-frequency.md +44 -0
- package/src/skills/reflect/SKILL.md +1 -0
- package/src/skills/session-goal/SKILL.md +7 -54
- package/src/skills/session-goal/references/goal-format.md +26 -0
- package/src/skills/session-goal/references/session-reuse.md +44 -0
- package/src/skills/tdd-with-agents/SKILL.md +11 -101
- package/src/skills/tdd-with-agents/references/advanced-testing-patterns.md +58 -0
- package/src/skills/tdd-with-agents/references/testing-by-layer.md +60 -0
- package/src/skills/visual-review-pipeline/SKILL.md +11 -120
- package/src/skills/visual-review-pipeline/references/findings-schema.md +49 -0
- package/src/skills/visual-review-pipeline/references/workflow-steps.md +111 -0
- package/scripts/hooks/log-session-start.sh +0 -48
- package/scripts/hooks/validate-post-conditions.sh +0 -21
- package/scripts/hooks/validate-talos-scope.sh +0 -50
- package/scripts/hooks/validate-tool-safety.sh +0 -49
- package/src/pantheon/goal-loop.ts +0 -314
- package/src/pantheon/idle-continuation.ts +0 -52
- package/src/pantheon/todo-preserve.ts +0 -301
- package/src/pantheon/tool-ceiling.ts +0 -159
- package/src/pantheon/v2-bridge.ts +0 -153
- package/src/plugin-v2.ts +0 -2954
- package/src/plugins/pantheon-hooks.ts +0 -1433
- package/src/plugins/tui/dist/server-v2.d.ts +0 -30
- package/src/plugins/tui/dist/server-v2.d.ts.map +0 -1
- package/src/plugins/tui/dist/server-v2.js +0 -33
- package/src/plugins/tui/dist/server-v2.js.map +0 -1
- package/src/plugins/tui/dist/tui-v2.d.ts +0 -1039
- package/src/plugins/tui/dist/tui-v2.d.ts.map +0 -1
- package/src/plugins/tui/dist/tui-v2.js +0 -4597
- package/src/plugins/tui/dist/tui-v2.js.map +0 -1
- package/src/plugins/tui/src/index-v2.tsx +0 -4496
- package/src/plugins/tui/src/server-v2.ts +0 -28
- package/src/plugins/tui/tui-v2.ts +0 -2
- /package/src/pantheon/{v2-decision-budget.ts → decision-budget.ts} +0 -0
- /package/src/pantheon/{v2-decision-egress.ts → decision-egress.ts} +0 -0
- /package/src/pantheon/{v2-decision-events.ts → decision-events.ts} +0 -0
- /package/src/pantheon/{v2-decision-heuristic.ts → decision-heuristic.ts} +0 -0
- /package/src/pantheon/{v2-decision-premises.ts → decision-premises.ts} +0 -0
- /package/src/pantheon/{v2-decision-rank.ts → decision-rank.ts} +0 -0
- /package/src/pantheon/{v2-decision-verify.ts → decision-verify.ts} +0 -0
- /package/src/pantheon/{v2-delegation-enforce.ts → delegation-policy.ts} +0 -0
- /package/src/pantheon/{v2-model-overrides.ts → model-overrides.ts} +0 -0
- /package/src/pantheon/{v2-native-decisions.ts → native-decisions.ts} +0 -0
- /package/src/plugins/tui/src/{opencode-v2.d.ts → opencode.d.ts} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pantheon-settings-state.ts — the pure state core of the settings window.
|
|
3
|
+
*
|
|
4
|
+
* TUI-local copy doctrine (same as cost-data.ts): the bundle must stay
|
|
5
|
+
* self-contained. The behaviors registry mirrors routing.yml's `behaviors:`
|
|
6
|
+
* (drift-pinned by tests/settings-registry.test.mjs); the Overrides tab reads
|
|
7
|
+
* and writes the GLOBAL overrides file — the same one
|
|
8
|
+
* `pantheon-opencode`'s installer and doctor consume
|
|
9
|
+
* (`<config-dir>/pantheon-overrides.json`).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface SettingsBehavior {
|
|
13
|
+
id: string
|
|
14
|
+
kind: 'install' | 'runtime'
|
|
15
|
+
title: string
|
|
16
|
+
description: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Mirrors routing.yml `behaviors:` — drift-pinned by the registry test. */
|
|
20
|
+
export const SETTINGS_BEHAVIORS: readonly SettingsBehavior[] = Object.freeze([
|
|
21
|
+
{
|
|
22
|
+
id: 'skill-auto-continue',
|
|
23
|
+
kind: 'install',
|
|
24
|
+
title: 'Auto-continue skill',
|
|
25
|
+
description: 'Continue multi-step todos while keeping safety gates.',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'skill-tdd-with-agents',
|
|
29
|
+
kind: 'install',
|
|
30
|
+
title: 'TDD with agents skill',
|
|
31
|
+
description: 'RED, GREEN, REFACTOR test-driven implementation.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'skill-code-review-checklist',
|
|
35
|
+
kind: 'install',
|
|
36
|
+
title: 'Code review checklist skill',
|
|
37
|
+
description: 'Systematic code review and quality gates.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'skill-prompt-refinery',
|
|
41
|
+
kind: 'install',
|
|
42
|
+
title: 'Prompt refinery skill',
|
|
43
|
+
description: 'Vague requests refined — silent adjust, >> full contract.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'gate-idle-todo-enforcer',
|
|
47
|
+
kind: 'runtime',
|
|
48
|
+
title: 'Idle todo enforcer',
|
|
49
|
+
description: 'Continues pending todos when a session goes idle.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'gate-context-pruner',
|
|
53
|
+
kind: 'runtime',
|
|
54
|
+
title: 'Context pruner',
|
|
55
|
+
description: 'Prunes repeated tool output before summarization.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'gate-j1-risk-gate',
|
|
59
|
+
kind: 'runtime',
|
|
60
|
+
title: 'J1 risk gate',
|
|
61
|
+
description: 'High-risk tool calls demand explicit human approval.',
|
|
62
|
+
},
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
export interface OverrideEntry {
|
|
66
|
+
action: 'disable' | 'replace'
|
|
67
|
+
content?: string
|
|
68
|
+
reason?: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type EffectiveOverrides = Record<string, OverrideEntry>
|
|
72
|
+
|
|
73
|
+
/** Which behaviors the settings window can toggle (runtime + install skills). */
|
|
74
|
+
export const SETTINGS_TOGGLABLE_IDS = new Set(SETTINGS_BEHAVIORS.map((b) => b.id))
|
|
75
|
+
|
|
76
|
+
export function isBehaviorDisabled(effective: EffectiveOverrides, id: string): boolean {
|
|
77
|
+
return effective[id]?.action === 'disable'
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Toggle: disabled -> enabled (entry removed); enabled -> disabled (entry written). */
|
|
81
|
+
export function toggledOverrides(
|
|
82
|
+
effective: EffectiveOverrides,
|
|
83
|
+
id: string,
|
|
84
|
+
reason = 'toggled in /pantheon-settings',
|
|
85
|
+
): EffectiveOverrides {
|
|
86
|
+
const next: EffectiveOverrides = { ...effective }
|
|
87
|
+
if (next[id]?.action === 'disable') delete next[id]
|
|
88
|
+
else next[id] = { action: 'disable', reason }
|
|
89
|
+
return next
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function serializeOverrides(effective: EffectiveOverrides): string {
|
|
93
|
+
const ordered: Record<string, unknown> = {}
|
|
94
|
+
for (const id of Object.keys(effective).sort()) ordered[id] = effective[id]
|
|
95
|
+
return `${JSON.stringify(ordered, null, 2)}\n`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface AboutData {
|
|
99
|
+
version: string
|
|
100
|
+
skillCount: number
|
|
101
|
+
agentCount: number
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function aboutRows(data: AboutData): string[] {
|
|
105
|
+
return [
|
|
106
|
+
`Pantheon v${data.version}`,
|
|
107
|
+
`${data.skillCount} skills · 14 agents · 5 MCP servers`,
|
|
108
|
+
'OpenCode 2.x only — the V1 contract is removed.',
|
|
109
|
+
'Docs: docs/design/2.0-settings-and-install.md',
|
|
110
|
+
]
|
|
111
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// biome-ignore-all lint/suspicious/noExplicitAny: OpenCode exposes its TUI API at runtime.
|
|
2
|
+
// biome-ignore-all lint/a11y/noStaticElementInteractions: TUI elements, not DOM
|
|
3
|
+
/** @jsxImportSource @opentui/solid */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* pantheon-settings.tsx — the /pantheon-settings window.
|
|
7
|
+
*
|
|
8
|
+
* Three pages (Gates / Overrides+About), keyboard-first: `up`/`down` select,
|
|
9
|
+
* `enter`/`space` toggles the selected behavior (writes the GLOBAL overrides
|
|
10
|
+
* file — the same one the installer and doctor consume), `tab` flips pages,
|
|
11
|
+
* `escape`/`q` closes. The gated-layer pattern mirrors the dispatch panel and
|
|
12
|
+
* whats-new windows. Every failure path is silent (fail-open).
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
15
|
+
import { homedir, join } from 'node:path'
|
|
16
|
+
import type { Context } from '@opencode/plugin/tui/context'
|
|
17
|
+
import { createSignal, For, Show } from 'solid-js'
|
|
18
|
+
import {
|
|
19
|
+
type EffectiveOverrides,
|
|
20
|
+
isBehaviorDisabled,
|
|
21
|
+
SETTINGS_BEHAVIORS,
|
|
22
|
+
type SettingsRow,
|
|
23
|
+
serializeOverrides,
|
|
24
|
+
toggledOverrides,
|
|
25
|
+
} from './pantheon-settings-state.ts'
|
|
26
|
+
|
|
27
|
+
function globalOverridesPath(): string {
|
|
28
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME ?? join(process.env.HOME ?? '', '.config')
|
|
29
|
+
return join(xdgConfig, 'opencode', 'pantheon-overrides.json')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function readOverridesFromDisk(): EffectiveOverrides {
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(readFileSync(globalOverridesPath(), 'utf8')) as EffectiveOverrides
|
|
35
|
+
} catch {
|
|
36
|
+
return {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function writeOverridesToDisk(effective: EffectiveOverrides): void {
|
|
41
|
+
writeFileSync(globalOverridesPath(), serializeOverrides(effective), 'utf8')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Rows shown on the Gates page: behavior state from the overrides file. */
|
|
45
|
+
export function buildSettingsRows(effective: EffectiveOverrides): SettingsRow[] {
|
|
46
|
+
return SETTINGS_BEHAVIORS.map((behavior) => ({
|
|
47
|
+
id: behavior.id,
|
|
48
|
+
title: behavior.title,
|
|
49
|
+
description: behavior.description,
|
|
50
|
+
disabled: isBehaviorDisabled(effective, behavior.id),
|
|
51
|
+
}))
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function SettingsContent(props: {
|
|
55
|
+
rows: () => SettingsRow[]
|
|
56
|
+
selected: () => number
|
|
57
|
+
page: () => number
|
|
58
|
+
version: () => string
|
|
59
|
+
about: () => string[]
|
|
60
|
+
fg?: any
|
|
61
|
+
muted?: any
|
|
62
|
+
}) {
|
|
63
|
+
const marker = (row: SettingsRow) => (row.disabled ? '[x]' : '[ ]')
|
|
64
|
+
return (
|
|
65
|
+
<box flexDirection="column" paddingLeft={1} paddingRight={1} paddingTop={1}>
|
|
66
|
+
<Show
|
|
67
|
+
when={props.page() === 0}
|
|
68
|
+
fallback={
|
|
69
|
+
<box flexDirection="column">
|
|
70
|
+
<text attributes={1} fg={props.fg}>
|
|
71
|
+
About
|
|
72
|
+
</text>
|
|
73
|
+
<text fg={props.muted}>{'─'.repeat(38)}</text>
|
|
74
|
+
<For each={props.about()}>{(line: string) => <text fg={props.muted}>{line}</text>}</For>
|
|
75
|
+
</box>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<text attributes={1} fg={props.fg}>
|
|
79
|
+
Gates & Overrides
|
|
80
|
+
</text>
|
|
81
|
+
<text fg={props.muted}>{'─'.repeat(38)}</text>
|
|
82
|
+
<For each={props.rows()}>
|
|
83
|
+
{(row: SettingsRow, index: () => number) => (
|
|
84
|
+
<box flexDirection="column">
|
|
85
|
+
<text
|
|
86
|
+
fg={props.selected() === index() ? props.fg : props.muted}
|
|
87
|
+
attributes={props.selected() === index() ? 1 : undefined}
|
|
88
|
+
>
|
|
89
|
+
{`${marker(row)} ${row.title}${props.selected() === index() ? ' <-' : ''}`}
|
|
90
|
+
</text>
|
|
91
|
+
<text fg={props.muted}>{` ${row.description}`}</text>
|
|
92
|
+
</box>
|
|
93
|
+
)}
|
|
94
|
+
</For>
|
|
95
|
+
<box height={1} />
|
|
96
|
+
<text fg={props.muted}>
|
|
97
|
+
{'enter: disable/enable · writes pantheon-overrides.json (global)'}
|
|
98
|
+
</text>
|
|
99
|
+
</Show>
|
|
100
|
+
<box height={1} />
|
|
101
|
+
<text fg={props.muted}>
|
|
102
|
+
{`${props.page() + 1}/2 · `}tab: page · up/down: select · enter: toggle · esc/q: close
|
|
103
|
+
</text>
|
|
104
|
+
</box>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Entry glue: read the overrides state, then show the window through the host
|
|
110
|
+
* dialog stack once. The gated keymap layer is inert while the window is
|
|
111
|
+
* closed. Never throws.
|
|
112
|
+
*/
|
|
113
|
+
export async function maybeShowPantheonSettings(context: Context): Promise<void> {
|
|
114
|
+
try {
|
|
115
|
+
const [open, setOpen] = createSignal(false)
|
|
116
|
+
const [page, setPage] = createSignal(0)
|
|
117
|
+
const [selected, setSelected] = createSignal(0)
|
|
118
|
+
const [effective, setEffective] = createSignal<EffectiveOverrides>(readOverridesFromDisk())
|
|
119
|
+
|
|
120
|
+
const rows = () => buildSettingsRows(effective())
|
|
121
|
+
const about = () => [
|
|
122
|
+
`Pantheon v${resolveRunningVersion()}`,
|
|
123
|
+
`${SETTINGS_BEHAVIORS.length} togglable behaviors · OpenCode 2.x only`,
|
|
124
|
+
'Docs: docs/design/2.0-settings-and-install.md',
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
let dismiss: () => void = () => {}
|
|
128
|
+
try {
|
|
129
|
+
context.keymap.layer(() => ({
|
|
130
|
+
mode: 'global',
|
|
131
|
+
enabled: () => open(),
|
|
132
|
+
commands: [
|
|
133
|
+
{
|
|
134
|
+
id: 'pantheon.settings.close',
|
|
135
|
+
title: 'Close settings',
|
|
136
|
+
bind: 'escape,q',
|
|
137
|
+
run: () => {
|
|
138
|
+
if (!open()) return false
|
|
139
|
+
dismiss()
|
|
140
|
+
return undefined
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'pantheon.settings.down',
|
|
145
|
+
title: 'Select next',
|
|
146
|
+
bind: 'down,j',
|
|
147
|
+
run: () => {
|
|
148
|
+
if (!open()) return false
|
|
149
|
+
setSelected((current) => Math.min(current + 1, rows().length - 1))
|
|
150
|
+
return undefined
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'pantheon.settings.up',
|
|
155
|
+
title: 'Select previous',
|
|
156
|
+
bind: 'up,k',
|
|
157
|
+
run: () => {
|
|
158
|
+
if (!open()) return false
|
|
159
|
+
setSelected((current) => Math.max(current - 1, 0))
|
|
160
|
+
return undefined
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 'pantheon.settings.toggle',
|
|
165
|
+
title: 'Disable/enable the selected behavior',
|
|
166
|
+
bind: 'enter,space',
|
|
167
|
+
run: () => {
|
|
168
|
+
if (!open()) return false
|
|
169
|
+
const row = rows()[selected()]
|
|
170
|
+
if (row === undefined) return false
|
|
171
|
+
setEffective(toggledOverrides(effective(), row.id))
|
|
172
|
+
writeOverridesToDisk(effective())
|
|
173
|
+
return undefined
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'pantheon.settings.page',
|
|
178
|
+
title: 'Flip page',
|
|
179
|
+
bind: 'tab',
|
|
180
|
+
run: () => {
|
|
181
|
+
if (!open()) return false
|
|
182
|
+
setPage((current) => (current === 0 ? 1 : 0))
|
|
183
|
+
return undefined
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
}))
|
|
188
|
+
} catch {
|
|
189
|
+
/* keymap API unavailable — the host dialog chrome still dismisses (ESC) */
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const close = () => {
|
|
193
|
+
setOpen(false)
|
|
194
|
+
try {
|
|
195
|
+
context.ui.dialog.clear()
|
|
196
|
+
} catch {
|
|
197
|
+
/* already closed */
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
dismiss = close
|
|
201
|
+
setOpen(true)
|
|
202
|
+
setPage(0)
|
|
203
|
+
try {
|
|
204
|
+
const theme = context.theme?.text ?? {}
|
|
205
|
+
context.ui.dialog.show(
|
|
206
|
+
() => (
|
|
207
|
+
<SettingsContent
|
|
208
|
+
rows={rows}
|
|
209
|
+
selected={selected}
|
|
210
|
+
page={page}
|
|
211
|
+
version={resolveRunningVersion}
|
|
212
|
+
about={about}
|
|
213
|
+
fg={theme.base}
|
|
214
|
+
muted={theme.muted}
|
|
215
|
+
/>
|
|
216
|
+
),
|
|
217
|
+
close,
|
|
218
|
+
)
|
|
219
|
+
} catch {
|
|
220
|
+
/* dialog stack unavailable — fail-open */
|
|
221
|
+
}
|
|
222
|
+
} catch {
|
|
223
|
+
/* fail-open — the window must never block or break TUI startup */
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function resolveRunningVersion(): string {
|
|
228
|
+
try {
|
|
229
|
+
const manifest = JSON.parse(
|
|
230
|
+
readFileSync(new URL('../../package.json', import.meta.url), 'utf8'),
|
|
231
|
+
) as { version?: string }
|
|
232
|
+
return manifest.version ?? 'unknown'
|
|
233
|
+
} catch {
|
|
234
|
+
return 'unknown'
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* No-op server stub for the
|
|
2
|
+
* No-op server stub for the OpenCode V2 plugin loader.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
* `server()` entry via `exports["./server"]` (or package.json `main`)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The OpenCode plugin host requires every plugin (TUI included) to expose a
|
|
5
|
+
* `server()` entry via `exports["./server"]` (or package.json `main`) — for the
|
|
6
|
+
* V2 copy this root `index-v2.ts` re-export resolves to this compiled entry —
|
|
7
|
+
* and it loads that server half only from a `config.plugins` entry (see
|
|
8
|
+
* `scripts/install/opencode.mjs`). When the entry is missing the host fails to
|
|
9
|
+
* attach the plugin's server half and the TUI runtime never wires the reactive
|
|
10
|
+
* channel — the initial JSX mounts but effects/refresh/events stay dead (the
|
|
11
|
+
* "mudo panel" symptom; same contract as the V1 `server.ts` stub).
|
|
9
12
|
*
|
|
10
|
-
* This stub satisfies the loader contract
|
|
11
|
-
*
|
|
13
|
+
* This stub satisfies the loader contract. Field report (beta.13): host 2.2.5
|
|
14
|
+
* validates the default export as a DEFINITION OBJECT — "Plugin must export a
|
|
15
|
+
* default definition with an id and an effect or setup function
|
|
16
|
+
* (SchemaError(Expected object at ["default"]))" — the bare `server()`
|
|
17
|
+
* function form failed that schema on every boot (~3.4k load failures in the
|
|
18
|
+
* host log). The native quota RPC that used to live here was removed in 1.6.2
|
|
19
|
+
* — provider quota/usage visibility is now the community plugin's job
|
|
20
|
+
* (`@slkiser/opencode-quota`, docs/tui-quota-providers.md) — and
|
|
21
|
+
* pantheon-tui has no other background server work of its own.
|
|
12
22
|
*/
|
|
13
|
-
export default
|
|
14
|
-
|
|
23
|
+
export default {
|
|
24
|
+
id: 'pantheon.tui.server',
|
|
25
|
+
setup() {
|
|
26
|
+
return {}
|
|
27
|
+
},
|
|
15
28
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update notifier core (TUI-local copy — the bundle must stay self-contained,
|
|
3
|
+
* same precedent as cost-data.ts/model-pricing.ts).
|
|
4
|
+
*
|
|
5
|
+
* Pin + notify, never silent auto-update: one notice per newer version,
|
|
6
|
+
* TTL-cached, offline-safe, and a stable install is never advertised a beta
|
|
7
|
+
* (the update guard owns that crossing). docs/design/2.0-settings-and-install.md
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const UPDATE_CHECK_TTL_MS = 6 * 60 * 60 * 1000
|
|
11
|
+
|
|
12
|
+
export interface UpdateCheckState {
|
|
13
|
+
/** Last version a notice was surfaced for (no repeats per version). */
|
|
14
|
+
lastNotifiedVersion?: string
|
|
15
|
+
/** Last time the registry was queried, for the TTL. */
|
|
16
|
+
lastCheckMs?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UpdateNoticeInput {
|
|
20
|
+
currentVersion: string
|
|
21
|
+
latestVersion: string
|
|
22
|
+
state?: UpdateCheckState
|
|
23
|
+
nowMs?: number
|
|
24
|
+
ttlMs?: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UpdateNotice {
|
|
28
|
+
version: string
|
|
29
|
+
message: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Semver-ish compare for X.Y.Z[-beta.N]; betas sort before their release. */
|
|
33
|
+
export function comparePantheonVersions(left: string, right: string): number {
|
|
34
|
+
const parse = (version: string) => {
|
|
35
|
+
const match = String(version)
|
|
36
|
+
.trim()
|
|
37
|
+
.match(/^(\d+)\.(\d+)\.(\d+)(?:-beta\.(\d+))?$/)
|
|
38
|
+
if (!match) return null
|
|
39
|
+
return {
|
|
40
|
+
core: [+match[1], +match[2], +match[3]],
|
|
41
|
+
beta: match[4] === undefined ? Number.POSITIVE_INFINITY : +match[4],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const a = parse(left)
|
|
45
|
+
const b = parse(right)
|
|
46
|
+
if (!a || !b) return 0
|
|
47
|
+
for (let index = 0; index < 3; index += 1) {
|
|
48
|
+
if (a.core[index] !== b.core[index]) return a.core[index] - b.core[index]
|
|
49
|
+
}
|
|
50
|
+
return a.beta - b.beta
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function pickUpdateNotice(input: UpdateNoticeInput): UpdateNotice | null {
|
|
54
|
+
const { currentVersion, latestVersion, state = {}, nowMs = Date.now() } = input
|
|
55
|
+
const ttlMs = input.ttlMs ?? UPDATE_CHECK_TTL_MS
|
|
56
|
+
|
|
57
|
+
const lastCheck = state.lastCheckMs ?? 0
|
|
58
|
+
if (nowMs - lastCheck < ttlMs) return null
|
|
59
|
+
if (state.lastNotifiedVersion === latestVersion) return null
|
|
60
|
+
|
|
61
|
+
const stable = (version: string) => !/-beta\.\d+$/.test(version)
|
|
62
|
+
// A stable install is never advertised a beta: the update guard owns that
|
|
63
|
+
// crossing and requires explicit opt-in there.
|
|
64
|
+
if (stable(currentVersion) && !stable(latestVersion)) return null
|
|
65
|
+
|
|
66
|
+
if (comparePantheonVersions(latestVersion, currentVersion) <= 0) return null
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
version: latestVersion,
|
|
70
|
+
message:
|
|
71
|
+
`pantheon-opencode ${latestVersion} available — ` +
|
|
72
|
+
'changelog in /pantheon-settings, adopt with `pantheon-opencode update`',
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The state to persist after a check (notified or not) for the TTL. */
|
|
77
|
+
export function nextCheckState(
|
|
78
|
+
previous: UpdateCheckState,
|
|
79
|
+
notice: UpdateNotice | null,
|
|
80
|
+
nowMs: number,
|
|
81
|
+
): UpdateCheckState {
|
|
82
|
+
return {
|
|
83
|
+
lastCheckMs: nowMs,
|
|
84
|
+
lastNotifiedVersion: notice?.version ?? previous.lastNotifiedVersion,
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "Typecheck gate for the V2 TUI entry only. `tsc --noEmit` at the package root was a no-op: with no tsconfig in this directory tsc walked up to the repo tsconfig.json, which excludes src/plugins/tui entirely — so nothing here was checked. tsdown bundles without type-checking, which is how an invalid event name (session.updated, absent from the OpenCode V2 event union) shipped in the V2 rewrite. This config points tsc at the V2 entry plus its ambient declarations so a type error in src/index-v2.tsx fails `npm run typecheck`. The V1 entry (src/index.tsx) is intentionally NOT included: it carries pre-existing type errors out of scope for the V2 gate. Keep this file strict JSON — the repo pre-commit `check-json` hook rejects comments.",
|
|
3
3
|
"extends": "./tsconfig.build.json",
|
|
4
|
-
"include": ["src/index-v2.tsx", "src/server-v2.ts", "src/opencode
|
|
4
|
+
"include": ["src/index-v2.tsx", "src/server-v2.ts", "src/opencode.d.ts"]
|
|
5
5
|
}
|
|
@@ -29,13 +29,13 @@ async function finalizeDistArtifacts(): Promise<void> {
|
|
|
29
29
|
|
|
30
30
|
/** Keep Rolldown's vendor source labels stable when a clean build uses a node_modules symlink. */
|
|
31
31
|
function normalizeHqtuiBundlePaths(name: string, contents: string): string {
|
|
32
|
-
if (name === 'tui
|
|
32
|
+
if (name === 'tui.js') {
|
|
33
33
|
return contents.replace(
|
|
34
34
|
/\/\/#region [^\n]*node_modules\/@profullstack\/hqtui\/dist\//g,
|
|
35
35
|
'//#region ../../../node_modules/@profullstack/hqtui/dist/',
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
|
-
if (name !== 'tui
|
|
38
|
+
if (name !== 'tui.js.map') return contents
|
|
39
39
|
|
|
40
40
|
const map = JSON.parse(contents) as { sources?: string[]; [key: string]: unknown }
|
|
41
41
|
if (!Array.isArray(map.sources)) return contents
|
|
@@ -50,9 +50,7 @@ function normalizeHqtuiBundlePaths(name: string, contents: string): string {
|
|
|
50
50
|
export default defineConfig({
|
|
51
51
|
entry: {
|
|
52
52
|
tui: 'src/index.tsx',
|
|
53
|
-
'tui-v2': 'src/index-v2.tsx',
|
|
54
53
|
server: 'src/server.ts',
|
|
55
|
-
'server-v2': 'src/server-v2.ts',
|
|
56
54
|
},
|
|
57
55
|
format: ['esm'],
|
|
58
56
|
platform: 'node',
|
|
@@ -61,7 +59,7 @@ export default defineConfig({
|
|
|
61
59
|
outExtensions: () => ({ js: '.js' }),
|
|
62
60
|
dts: {
|
|
63
61
|
tsconfig: join(__dirname, 'tsconfig.build.json'),
|
|
64
|
-
entry: ['src/index.tsx', 'src/
|
|
62
|
+
entry: ['src/index.tsx', 'src/server.ts'],
|
|
65
63
|
},
|
|
66
64
|
define: {
|
|
67
65
|
__PANTHEON_VERSION__: JSON.stringify(pkg.version),
|
package/src/plugins/tui/tui.ts
CHANGED
package/src/routing.yml
CHANGED
|
@@ -179,6 +179,7 @@ agents:
|
|
|
179
179
|
- auto-continue
|
|
180
180
|
- codemap
|
|
181
181
|
- prompt-refinery
|
|
182
|
+
- instruction-forge
|
|
182
183
|
- context-compression
|
|
183
184
|
- incremental-implementation
|
|
184
185
|
- loop-engineering
|
|
@@ -666,3 +667,38 @@ full_auto:
|
|
|
666
667
|
# for a bounded fix; use focused verification. This section documents guards
|
|
667
668
|
# and defaults only; the plugin uses GOAL_LOOP_DEFAULTS directly.
|
|
668
669
|
# Wave 3 (PR #46): one active goal per session (pending → in_progress → done).
|
|
670
|
+
|
|
671
|
+
# ─── Named behaviors: the only override surface (2.0) ─────────────────────
|
|
672
|
+
# Each id is the SINGLE addressable behavior a user may disable or replace
|
|
673
|
+
# via .pantheon/overrides.json (project) or pantheon-overrides.json in the
|
|
674
|
+
# global config dir (project wins per id). kind: install → owner is the file
|
|
675
|
+
# the installer writes ("disable" skips the copy, "replace" writes content
|
|
676
|
+
# instead of the canonical body, 8000-char cap). kind: runtime → a named gate
|
|
677
|
+
# the plugin reads at setup ("disable" turns it off; "replace" is not
|
|
678
|
+
# supported for runtime behaviors in 2.0).
|
|
679
|
+
# Override FILES are never inventoried: reconcile, uninstall and upgrades
|
|
680
|
+
# leave them alone. Anything not listed here is NOT overridable — add the id
|
|
681
|
+
# here first, then the override. secret-scan is deliberately absent: it is
|
|
682
|
+
# not user-overridable.
|
|
683
|
+
behaviors:
|
|
684
|
+
- id: skill-auto-continue
|
|
685
|
+
kind: install
|
|
686
|
+
owner: src/skills/auto-continue/SKILL.md
|
|
687
|
+
- id: skill-tdd-with-agents
|
|
688
|
+
kind: install
|
|
689
|
+
owner: src/skills/tdd-with-agents/SKILL.md
|
|
690
|
+
- id: skill-code-review-checklist
|
|
691
|
+
kind: install
|
|
692
|
+
owner: src/skills/code-review-checklist/SKILL.md
|
|
693
|
+
- id: skill-prompt-refinery
|
|
694
|
+
kind: install
|
|
695
|
+
owner: src/skills/prompt-refinery/SKILL.md
|
|
696
|
+
- id: gate-idle-todo-enforcer
|
|
697
|
+
kind: runtime
|
|
698
|
+
owner: src/plugin.ts (idle todo enforcer)
|
|
699
|
+
- id: gate-context-pruner
|
|
700
|
+
kind: runtime
|
|
701
|
+
owner: src/pantheon/context-pruner.ts
|
|
702
|
+
- id: gate-j1-risk-gate
|
|
703
|
+
kind: runtime
|
|
704
|
+
owner: src/pantheon/jev-risk-gate.ts
|
package/src/skills/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Skills are reference modules loaded on demand by agents. Each skill provides domain-specific knowledge — architecture patterns, security checklists, optimization strategies, and implementation guides. Agents load skills when their task matches the skill's description, keeping context focused and token-efficient.
|
|
6
6
|
|
|
7
|
-
There are **
|
|
7
|
+
There are **23 skills** divided into **6 domains**.
|
|
8
8
|
|
|
9
9
|
## Skills by Domain
|
|
10
10
|
|
|
@@ -98,6 +98,18 @@ There are **22 skills** divided into **5 domains**.
|
|
|
98
98
|
- Automated visual review pipeline — Playwright screenshots, self-analysis, fix loop, escalation.
|
|
99
99
|
- Used by: Aphrodite
|
|
100
100
|
|
|
101
|
+
### Domain 6: Meta
|
|
102
|
+
|
|
103
|
+
21. **agent-forge** — `agent-forge/SKILL.md`
|
|
104
|
+
- Forge a new OpenCode agent on demand — interview, canonical draft, confirm, write to project or user scope; never shadows a specialist.
|
|
105
|
+
- Used by: Zeus
|
|
106
|
+
22. **prompt-refinery** — `prompt-refinery/SKILL.md`
|
|
107
|
+
- Turn a vague multi-concern request into a usable brief — silent internal adjust by default; the full contract is only via `>>`.
|
|
108
|
+
- Used by: Zeus
|
|
109
|
+
23. **instruction-forge** — `instruction-forge/SKILL.md`
|
|
110
|
+
- Write and maintain AI instructions — where a rule lives, the contract, and testing that it fires (references/ for the doctrine).
|
|
111
|
+
- Used by: Zeus
|
|
112
|
+
|
|
101
113
|
## Skills File Structure
|
|
102
114
|
|
|
103
115
|
Each skill follows a consistent layout:
|
|
@@ -145,6 +157,9 @@ agent grants, and skill inventory.
|
|
|
145
157
|
| 18 | spec-driven-development | Planning | Athena |
|
|
146
158
|
| 19 | verification-planning | Planning | Athena, Zeus |
|
|
147
159
|
| 20 | visual-review-pipeline | Frontend Development | Aphrodite |
|
|
160
|
+
| 21 | agent-forge | Meta | Zeus |
|
|
161
|
+
| 22 | prompt-refinery | Meta | Zeus |
|
|
162
|
+
| 23 | instruction-forge | Meta | Zeus, Athena |
|
|
148
163
|
|
|
149
164
|
---
|
|
150
165
|
|