pantheon-opencode 1.7.0 → 2.0.0-beta.2
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 +85 -59
- package/README.md +74 -48
- 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 +2870 -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 +5612 -2086
- 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/decision-router-state.ts +242 -0
- package/src/plugins/tui/src/doctor-state.ts +198 -0
- package/src/plugins/tui/src/index.tsx +4222 -2822
- package/src/plugins/tui/src/j1-gate-status.ts +85 -0
- package/src/plugins/tui/src/pantheon-settings-state.ts +245 -0
- package/src/plugins/tui/src/pantheon-settings.tsx +442 -0
- package/src/plugins/tui/src/preset-state.ts +143 -0
- package/src/plugins/tui/src/server.ts +23 -10
- package/src/plugins/tui/src/update-notice.ts +90 -0
- package/src/plugins/tui/src/update-status.ts +98 -0
- package/src/plugins/tui/tsconfig.typecheck.json +9 -2
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# test-opencode-
|
|
2
|
+
# test-opencode-sandbox.sh — Pantheon global-install sandbox validator for
|
|
3
3
|
# OpenCode V2.
|
|
4
4
|
#
|
|
5
5
|
# Validates the installed pantheon-opencode package AS A REAL USER inside an
|
|
@@ -110,7 +110,7 @@ BOOTSTRAP_ENTRY="$BOOTSTRAP_NORMALIZED"
|
|
|
110
110
|
[[ -f "$BOOTSTRAP_ENTRY" && ! -L "$BOOTSTRAP_ENTRY" ]] || bootstrap_fail
|
|
111
111
|
SCRIPT_DIR="${BOOTSTRAP_ENTRY%/*}"
|
|
112
112
|
[[ "${SCRIPT_DIR##*/}" == scripts \
|
|
113
|
-
&& "${BOOTSTRAP_ENTRY##*/}" == test-opencode-
|
|
113
|
+
&& "${BOOTSTRAP_ENTRY##*/}" == test-opencode-sandbox.sh ]] || bootstrap_fail
|
|
114
114
|
|
|
115
115
|
SANDBOX_ENV_HELPER="$SCRIPT_DIR/sandbox-env.sh"
|
|
116
116
|
bootstrap_normalize_path "$SANDBOX_ENV_HELPER" || bootstrap_fail
|
|
@@ -144,7 +144,7 @@ V2_BIN="${OPENCODE_V2_BIN:-opencode2}"
|
|
|
144
144
|
# probe hermetic: an inherited config, database, or PORT can otherwise make
|
|
145
145
|
# the command query a different service and report a false result.
|
|
146
146
|
V2_CONFIG="${PANTHEON_V2_CONFIG:-$SANDBOX_ROOT/project-v2/opencode.json}"
|
|
147
|
-
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_ROOT/opencode
|
|
147
|
+
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_ROOT/opencode.db}"
|
|
148
148
|
V2_PORT="${PANTHEON_V2_PORT:-49376}"
|
|
149
149
|
V2_LOOPBACK_HOST="${PANTHEON_V2_HOST:-127.0.0.1}"
|
|
150
150
|
V2_HANDSHAKE_TIMEOUT="${PANTHEON_V2_HANDSHAKE_TIMEOUT:-60}"
|
|
@@ -495,7 +495,7 @@ write_run_test_sh() {
|
|
|
495
495
|
printf '%s\n' '#!/usr/bin/env bash'
|
|
496
496
|
printf 'EXPECTED_REPO_DIR=%s\n' "$expected_repo_q"
|
|
497
497
|
cat <<'RUNTEST'
|
|
498
|
-
# Generated by pantheon-opencode scripts/test-opencode-
|
|
498
|
+
# Generated by pantheon-opencode scripts/test-opencode-sandbox.sh --prepare
|
|
499
499
|
# Validates the global install: the V2 binary, exactly 5 connected MCPs, doctor
|
|
500
500
|
# 0 errors, AND the CONTENT of pantheon://agents (zeus/hermes present).
|
|
501
501
|
set -euo pipefail
|
|
@@ -556,7 +556,7 @@ NPM_PREFIX="$SANDBOX_HOME/.npm-global"
|
|
|
556
556
|
PANTHEON_GLOBAL="$SANDBOX_HOME/.config/opencode"
|
|
557
557
|
SANDBOX_VENV="$PANTHEON_GLOBAL/.venv"
|
|
558
558
|
V2_CONFIG="${PANTHEON_V2_CONFIG:-$SANDBOX_DIR/project-v2/opencode.json}"
|
|
559
|
-
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_DIR/opencode
|
|
559
|
+
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_DIR/opencode.db}"
|
|
560
560
|
pantheon_validate_sandbox_config_path "$SANDBOX_DIR" "$V2_CONFIG" || exit $?
|
|
561
561
|
pantheon_validate_sandbox_file_path "$SANDBOX_DIR" "$V2_DB" || exit $?
|
|
562
562
|
# Validate the generated metadata against the trusted path embedded above before
|
|
@@ -1123,7 +1123,7 @@ RUNTEST
|
|
|
1123
1123
|
|
|
1124
1124
|
cat > "$SANDBOX_ROOT/start-pantheon.sh" <<'STARTPANTHEON'
|
|
1125
1125
|
#!/usr/bin/env bash
|
|
1126
|
-
# Generated by pantheon-opencode scripts/test-opencode-
|
|
1126
|
+
# Generated by pantheon-opencode scripts/test-opencode-sandbox.sh --prepare
|
|
1127
1127
|
# Launches the installed OpenCode beta with only this sandbox's HOME/config/db.
|
|
1128
1128
|
set -euo pipefail
|
|
1129
1129
|
|
|
@@ -1183,7 +1183,7 @@ NPM_PREFIX="$SANDBOX_HOME/.npm-global"
|
|
|
1183
1183
|
SANDBOX_VENV="$SANDBOX_HOME/.config/opencode/.venv"
|
|
1184
1184
|
V2_PORT="${PANTHEON_V2_PORT:-49376}"
|
|
1185
1185
|
V2_CONFIG="${PANTHEON_V2_CONFIG:-$SANDBOX_DIR/project-v2/opencode.json}"
|
|
1186
|
-
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_DIR/opencode
|
|
1186
|
+
V2_DB="${PANTHEON_V2_DB:-$SANDBOX_DIR/opencode.db}"
|
|
1187
1187
|
pantheon_validate_sandbox_config_path "$SANDBOX_DIR" "$V2_CONFIG" || exit $?
|
|
1188
1188
|
pantheon_validate_sandbox_file_path "$SANDBOX_DIR" "$V2_DB" || exit $?
|
|
1189
1189
|
if [[ ! "$V2_PORT" =~ ^[0-9]{1,5}$ ]]; then
|
|
@@ -1972,14 +1972,14 @@ run_hooks() {
|
|
|
1972
1972
|
agent="${PANTHEON_HOOK_CANARY_AGENT:-canary}"
|
|
1973
1973
|
log "[hooks] V2 hook canary against $bin (model $PANTHEON_SANDBOX_MODEL, agent $agent) ..."
|
|
1974
1974
|
# PANTHEON_HOOK_CANARY_MODE=real is the point of this path: it makes the host
|
|
1975
|
-
# load src/plugin
|
|
1975
|
+
# load src/plugin.ts itself, so a hook that registers under a dead name
|
|
1976
1976
|
# fails here. Default `fixture` mode only proves the hook NAMES are real, so
|
|
1977
1977
|
# without this the sandbox would never exercise the shipped plugin.
|
|
1978
1978
|
if PANTHEON_HOOK_CANARY_BIN="$bin" \
|
|
1979
1979
|
PANTHEON_HOOK_CANARY_MODEL="$PANTHEON_SANDBOX_MODEL" \
|
|
1980
1980
|
PANTHEON_HOOK_CANARY_AGENT="$agent" \
|
|
1981
1981
|
PANTHEON_HOOK_CANARY_MODE=real \
|
|
1982
|
-
node --test "$REPO_DIR/tests/pantheon/plugin-
|
|
1982
|
+
node --test "$REPO_DIR/tests/pantheon/plugin-hook-canary.test.mjs"; then
|
|
1983
1983
|
log "Hook canary: PASS."
|
|
1984
1984
|
else
|
|
1985
1985
|
log "Hook canary: FAIL."
|
|
@@ -11,20 +11,32 @@ const LOCK_PATH = join(ROOT, 'skills-lock.json')
|
|
|
11
11
|
|
|
12
12
|
/** Rebuild the sorted SHA-256 inventory for every canonical skill file. */
|
|
13
13
|
function updateSkillsLock() {
|
|
14
|
-
const
|
|
14
|
+
const skillDirs = readdirSync(SKILLS_DIR, { withFileTypes: true })
|
|
15
15
|
.filter((entry) => entry.isDirectory())
|
|
16
|
-
.map((entry) =>
|
|
17
|
-
.filter((path) => existsSync(path))
|
|
18
|
-
.sort()
|
|
16
|
+
.map((entry) => entry.name)
|
|
19
17
|
|
|
20
|
-
const lock =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
const lock = {}
|
|
19
|
+
for (const id of skillDirs) {
|
|
20
|
+
const skillMd = join(SKILLS_DIR, id, 'SKILL.md')
|
|
21
|
+
if (existsSync(skillMd)) {
|
|
22
|
+
lock[relative(ROOT, skillMd).split('\\').join('/')] = createHash('sha256')
|
|
23
|
+
.update(readFileSync(skillMd))
|
|
24
|
+
.digest('hex')
|
|
25
|
+
}
|
|
26
|
+
const refDir = join(SKILLS_DIR, id, 'references')
|
|
27
|
+
if (!existsSync(refDir)) continue
|
|
28
|
+
for (const name of readdirSync(refDir).sort()) {
|
|
29
|
+
if (!name.endsWith('.md')) continue
|
|
30
|
+
const refPath = join(refDir, name)
|
|
31
|
+
lock[relative(ROOT, refPath).split('\\').join('/')] = createHash('sha256')
|
|
32
|
+
.update(readFileSync(refPath))
|
|
33
|
+
.digest('hex')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const sorted = Object.fromEntries(Object.entries(lock).sort(([a], [b]) => a.localeCompare(b)))
|
|
38
|
+
writeFileSync(LOCK_PATH, `${JSON.stringify(sorted, null, 2)}\n`)
|
|
39
|
+
process.stdout.write(`Updated ${Object.keys(sorted).length} skill digests in skills-lock.json\n`)
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
updateSkillsLock()
|
package/scripts/update.mjs
CHANGED
|
@@ -103,11 +103,27 @@ export function runUpdate(
|
|
|
103
103
|
|
|
104
104
|
if (compareVersions(latest, currentVersion) <= 0) {
|
|
105
105
|
console.log(
|
|
106
|
-
|
|
106
|
+
`\u2705 Already up to date (installed v${currentVersion}; ${channel} channel: v${latest}).`,
|
|
107
107
|
)
|
|
108
108
|
return 0
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// A stable installation never jumps to a prerelease silently (you stay
|
|
112
|
+
// in charge): the jump needs explicit opt-in via --allow-prerelease. The
|
|
113
|
+
// remedy is printed, never guessed.
|
|
114
|
+
const isPrerelease = (version) => /-beta\.\d+$/.test(version)
|
|
115
|
+
const crossingToPrerelease = isPrerelease(latest) && !isPrerelease(currentVersion)
|
|
116
|
+
if (crossingToPrerelease && !args.includes('--allow-prerelease')) {
|
|
117
|
+
console.error(
|
|
118
|
+
'\u274c v' +
|
|
119
|
+
latest +
|
|
120
|
+
' is a BETA and your installed v' +
|
|
121
|
+
currentVersion +
|
|
122
|
+
' is stable. A stable\u2192beta jump needs explicit opt-in: rerun with `update --allow-prerelease`, or stay on the stable line with `update --stable`.',
|
|
123
|
+
)
|
|
124
|
+
return 1
|
|
125
|
+
}
|
|
126
|
+
|
|
111
127
|
console.log(`Updating v${currentVersion} → v${latest} (channel: ${channel})...`)
|
|
112
128
|
const install = spawnSync('npm', ['install', '-g', `pantheon-opencode@${channel}`], {
|
|
113
129
|
stdio: 'inherit',
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* - Skills referenced exist in skills/
|
|
10
10
|
* - Handoffs reference valid agents
|
|
11
11
|
* - Routing matrix references valid agents
|
|
12
|
+
* - Skill references cited in SKILL.md exist and are routed (progressive disclosure)
|
|
12
13
|
*
|
|
13
14
|
* Usage:
|
|
14
15
|
* node scripts/validate-routing.mjs
|
|
@@ -127,9 +128,25 @@ if (skillLock && typeof skillLock === 'object' && !Array.isArray(skillLock)) {
|
|
|
127
128
|
.map((d) => `src/skills/${d}/SKILL.md`)
|
|
128
129
|
.sort()
|
|
129
130
|
: []
|
|
130
|
-
|
|
131
|
+
// references/ ride the same lock: every shipped reference must be pinned too.
|
|
132
|
+
const refFiles = existsSync(srcSkillsDir)
|
|
133
|
+
? readdirSync(srcSkillsDir, { withFileTypes: true })
|
|
134
|
+
.filter(
|
|
135
|
+
(entry) =>
|
|
136
|
+
entry.isDirectory() && existsSync(join(srcSkillsDir, entry.name, 'references')),
|
|
137
|
+
)
|
|
138
|
+
.flatMap((entry) =>
|
|
139
|
+
readdirSync(join(srcSkillsDir, entry.name, 'references'))
|
|
140
|
+
.filter((f) => f.endsWith('.md'))
|
|
141
|
+
.map((f) => `src/skills/${entry.name}/references/${f}`),
|
|
142
|
+
)
|
|
143
|
+
.sort()
|
|
144
|
+
: []
|
|
145
|
+
console.log(
|
|
146
|
+
` Locked skills: ${skillFiles.length} + ${refFiles.length} references (lock: ${lockedFiles.length})`,
|
|
147
|
+
)
|
|
131
148
|
|
|
132
|
-
for (const rel of skillFiles) {
|
|
149
|
+
for (const rel of [...skillFiles, ...refFiles]) {
|
|
133
150
|
const actual = createHash('sha256')
|
|
134
151
|
.update(readFileSync(join(ROOT, rel)))
|
|
135
152
|
.digest('hex')
|
|
@@ -140,8 +157,8 @@ if (skillLock && typeof skillLock === 'object' && !Array.isArray(skillLock)) {
|
|
|
140
157
|
}
|
|
141
158
|
for (const rel of lockedFiles) {
|
|
142
159
|
check(
|
|
143
|
-
skillFiles.includes(rel),
|
|
144
|
-
`skills-lock.json lists "${rel}" but that
|
|
160
|
+
skillFiles.includes(rel) || refFiles.includes(rel),
|
|
161
|
+
`skills-lock.json lists "${rel}" but that file does not exist`,
|
|
145
162
|
)
|
|
146
163
|
}
|
|
147
164
|
}
|
|
@@ -369,6 +386,64 @@ for (const agentName of canonicalFiles) {
|
|
|
369
386
|
}
|
|
370
387
|
}
|
|
371
388
|
|
|
389
|
+
// ─── H. Skill references — progressive disclosure ───────────────────────
|
|
390
|
+
|
|
391
|
+
const skillsDirH = join(ROOT, 'src', 'skills')
|
|
392
|
+
const skillDirIds = readdirSync(skillsDirH, { withFileTypes: true })
|
|
393
|
+
.filter((entry) => entry.isDirectory())
|
|
394
|
+
.map((entry) => entry.name)
|
|
395
|
+
.sort()
|
|
396
|
+
console.log('\n📎 Skill references (progressive disclosure)...')
|
|
397
|
+
for (const id of skillDirIds) {
|
|
398
|
+
const skillMdPath = join(skillsDirH, id, 'SKILL.md')
|
|
399
|
+
if (!existsSync(skillMdPath)) continue
|
|
400
|
+
const body = readFileSync(skillMdPath, 'utf8')
|
|
401
|
+
const cited = [...body.matchAll(/references\/([A-Za-z0-9][A-Za-z0-9._-]*\.md)/g)].map((m) => m[1])
|
|
402
|
+
const refDir = join(skillsDirH, id, 'references')
|
|
403
|
+
if (!existsSync(refDir)) {
|
|
404
|
+
check(
|
|
405
|
+
cited.length === 0,
|
|
406
|
+
`${id}: cites ${cited.length} reference(s) but ships no references/ directory`,
|
|
407
|
+
)
|
|
408
|
+
continue
|
|
409
|
+
}
|
|
410
|
+
const onDisk = readdirSync(refDir)
|
|
411
|
+
.filter((f) => f.endsWith('.md'))
|
|
412
|
+
.sort()
|
|
413
|
+
check(/##\s+Routing/.test(body), `${id}: ships references/ but has no "## Routing" section`)
|
|
414
|
+
for (const name of new Set(cited).values()) {
|
|
415
|
+
check(onDisk.includes(name), `${id}: cited reference missing on disk: references/${name}`)
|
|
416
|
+
}
|
|
417
|
+
for (const name of onDisk) {
|
|
418
|
+
if (!cited.includes(name)) warn(`${id}: orphan reference (never cited): references/${name}`)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ─── I. Behavior registry — the override surface ────────────────────────
|
|
423
|
+
|
|
424
|
+
const behaviors = routing.behaviors
|
|
425
|
+
if (!Array.isArray(behaviors) || behaviors.length === 0) {
|
|
426
|
+
check(false, 'routing.yml must declare a non-empty behaviors: registry')
|
|
427
|
+
} else {
|
|
428
|
+
console.log('\n🧩 Behavior registry...')
|
|
429
|
+
const seen = new Set()
|
|
430
|
+
for (const b of behaviors) {
|
|
431
|
+
check(typeof b?.id === 'string' && b.id.length > 0, 'behavior entry missing id')
|
|
432
|
+
if (typeof b?.id === 'string') {
|
|
433
|
+
check(!seen.has(b.id), `duplicate behavior id: ${b.id}`)
|
|
434
|
+
seen.add(b.id)
|
|
435
|
+
}
|
|
436
|
+
check(
|
|
437
|
+
b?.kind === 'install' || b?.kind === 'runtime',
|
|
438
|
+
`behavior ${b?.id}: kind must be install|runtime`,
|
|
439
|
+
)
|
|
440
|
+
check(typeof b?.owner === 'string' && b.owner.length > 0, `behavior ${b?.id}: owner required`)
|
|
441
|
+
if (b?.kind === 'install' && typeof b?.owner === 'string') {
|
|
442
|
+
check(existsSync(join(ROOT, b.owner)), `behavior ${b.id}: owner file missing: ${b.owner}`)
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
372
447
|
// Summary
|
|
373
448
|
console.log(`\n${'='.repeat(50)}`)
|
|
374
449
|
const status = failures === 0 ? '✅ PASSED' : `❌ FAILED (${failures}/${checks} checks failed)`
|
|
@@ -4,13 +4,13 @@ import { readFileSync } from 'node:fs'
|
|
|
4
4
|
import { join, resolve } from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
6
6
|
|
|
7
|
-
const PACKAGE_REF = /^(?:npm:)?pantheon-opencode(?:@[^/]+)?(?:\/(?:plugin|plugin
|
|
7
|
+
const PACKAGE_REF = /^(?:npm:)?pantheon-opencode(?:@[^/]+)?(?:\/(?:plugin|plugin))?$/
|
|
8
8
|
export const SANDBOX_SOURCE_FILES = [
|
|
9
9
|
'bin/pantheon-init.mjs',
|
|
10
10
|
'scripts/install/config-migration.mjs',
|
|
11
11
|
'scripts/install/opencode.mjs',
|
|
12
12
|
'scripts/validate-sandbox-install.mjs',
|
|
13
|
-
'src/plugin
|
|
13
|
+
'src/plugin.ts',
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
function readJson(path, label) {
|
|
@@ -69,7 +69,7 @@ export function validateSandboxInstall({ repoDir, installDir, projectConfig, con
|
|
|
69
69
|
sourceHash.update(relativePath).update('\0').update(installed).update('\0')
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const expectedPluginPath = resolve(installDir, 'src', 'plugin
|
|
72
|
+
const expectedPluginPath = resolve(installDir, 'src', 'plugin')
|
|
73
73
|
const allConfigPaths = [...new Set([projectConfig, ...configPaths].map((path) => resolve(path)))]
|
|
74
74
|
let activeProjectPluginCount = 0
|
|
75
75
|
for (const configPath of allConfigPaths) {
|
package/skills-lock.json
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"src/skills/agent-coordination/SKILL.md": "ffa4cfc9c778dd9619665010de32d82d49ae5bb803c985dc99417eb6fc7c3d1c",
|
|
3
3
|
"src/skills/agent-forge/SKILL.md": "cbe09946a59fa45b471828d9de6e7bc5c4b2fa29e0ce48e21d188593ece6c046",
|
|
4
|
-
"src/skills/artifact-management/
|
|
5
|
-
"src/skills/
|
|
4
|
+
"src/skills/artifact-management/references/artifact-templates.md": "6eedbcbc7bb466f64fe1ebf2622f905ea8a0f247b69c473f80edcf01b5caf4cf",
|
|
5
|
+
"src/skills/artifact-management/SKILL.md": "9de4488115b3d862d6989f958712f3369787be98e6df22ae413d20064da43721",
|
|
6
|
+
"src/skills/auto-continue/references/auto-continue-details.md": "630844448b0a5a69d23a1c270bbbf5312a4d7554d84cea0459fc8a1430a60798",
|
|
7
|
+
"src/skills/auto-continue/SKILL.md": "7bfddd84f96b657043074a35ef2f524913ccbed2689fc8a26ad425167f4b77c5",
|
|
6
8
|
"src/skills/clonedeps/SKILL.md": "3e0b43cf96da98c83699dc48db3fd58fbfda84b9022bb70d3747875c81c3e124",
|
|
7
|
-
"src/skills/code-review-checklist/
|
|
9
|
+
"src/skills/code-review-checklist/references/review-checklists.md": "ca5e8059e46052b88489cdc3ffcd009fa2b33f6bcff0493ded47a3ae12c6b94e",
|
|
10
|
+
"src/skills/code-review-checklist/SKILL.md": "cdca3dbd7393cd8b379297be8bf68d456e7217b0238eaeea13b35a96d553414f",
|
|
8
11
|
"src/skills/codemap/SKILL.md": "d21b3fa66b931b29dcf1ec0f0fcf1ec28514642a9f33f96e4b2901a0be74c72d",
|
|
9
12
|
"src/skills/context-compression/SKILL.md": "4d8368309ec72fefac69ad5cddd43650647d0bc684b6f8bf3cacc004edb56ef5",
|
|
10
13
|
"src/skills/git-workflow-and-versioning/SKILL.md": "685a94041f1b4ce2a430301f517b89102055696267c369a7e8fb191606659276",
|
|
11
14
|
"src/skills/incremental-implementation/SKILL.md": "7065ddb45da3c6b6751de07f290e92e6cb072e949a2e3aaae13ee7762f0a70fc",
|
|
15
|
+
"src/skills/instruction-forge/references/agents-md-doctrine.md": "23623cc40e830ba5f2f11b7b005e85b3f4d260428f1c31cb9840e7b9baa81360",
|
|
16
|
+
"src/skills/instruction-forge/references/eval-doctrine.md": "87412d9c9afb16a0cc9eab145df45518805d0e967fe736d65bae9f5cd6a19782",
|
|
17
|
+
"src/skills/instruction-forge/references/skill-doctrine.md": "9ad4f1c249595f934bd6397afd36017a6a61068c1c21ee0bee11952cb14dc4a1",
|
|
18
|
+
"src/skills/instruction-forge/SKILL.md": "e6d45074f959033359010c936346d6718c50b4700e98566bf9ca6ab36bd60951",
|
|
12
19
|
"src/skills/loop-engineering/SKILL.md": "f804e545821b9cca8fe0ec517307ed902446f28c2ca8ff9194c0f987cf7229e3",
|
|
13
|
-
"src/skills/memory-bank/
|
|
20
|
+
"src/skills/memory-bank/references/anti-patterns.md": "4809d9ad99aa7d3c863eacb19dcf3747ae85820179f782509912921872aac612",
|
|
21
|
+
"src/skills/memory-bank/references/product-adoption.md": "56a0608d757090e51596e484a8a9fb0cc72c9ca3b204afb803fbec4a993acd3d",
|
|
22
|
+
"src/skills/memory-bank/references/storage-model.md": "728a9e5f2055ce0f74c759405072a6fe57f65587bdb7b9e5e7fa90b60528b085",
|
|
23
|
+
"src/skills/memory-bank/references/structure-and-frequency.md": "09caedf905870c688401a2e58b2776a9c6187fe724c576019c58c3b80fe1b98f",
|
|
24
|
+
"src/skills/memory-bank/SKILL.md": "047b3049c27e908b1d79afb14f79336e32f775385ba23956771166d445944f2f",
|
|
14
25
|
"src/skills/prompt-refinery/SKILL.md": "a4935058aba4845ce93049113fc7f524eff31bbe3b1dbf46bbea208c6b2d5612",
|
|
15
|
-
"src/skills/reflect/SKILL.md": "
|
|
26
|
+
"src/skills/reflect/SKILL.md": "297c374f1fbc8e15d3848f51e811e0614d4a008c7d0e1daf88bbb240d605b8a8",
|
|
16
27
|
"src/skills/security-hardening/SKILL.md": "6d637e122421f7bc3b751f04854ad343a5a5d35249458bc8939233138fd3f20d",
|
|
17
|
-
"src/skills/session-goal/
|
|
28
|
+
"src/skills/session-goal/references/goal-format.md": "071f6f8f12cfbc26d4703cd5f34f839f91e586a3b969bf5f81a74b961c254a83",
|
|
29
|
+
"src/skills/session-goal/references/session-reuse.md": "38b9bc7b47cf8bdd47721bd5e501df420982776ce25b155228fd81795d7d0ef2",
|
|
30
|
+
"src/skills/session-goal/SKILL.md": "fda6e39c731ab803a980a213086758d55fedcdbd8cf6dd2ce095047da9226f5a",
|
|
18
31
|
"src/skills/simplify/SKILL.md": "1f3c06f4f856cbc8cdefcfe7fd260ad7382a441d8d9d9162671b17dc33aa6edd",
|
|
19
32
|
"src/skills/spec-driven-development/SKILL.md": "ccfbc0c32116a1d144f5c12a4187c053322ed31625a622a58c59739a57a86743",
|
|
20
|
-
"src/skills/tdd-with-agents/
|
|
33
|
+
"src/skills/tdd-with-agents/references/advanced-testing-patterns.md": "4aac82748bb670a61d67732168f8a265d5e66895a9183029e3da03de8e024788",
|
|
34
|
+
"src/skills/tdd-with-agents/references/testing-by-layer.md": "545291301661e57d846b2db2acca1edb1219a102dce4aad7e0c3cc1a250b570a",
|
|
35
|
+
"src/skills/tdd-with-agents/SKILL.md": "10ad9b489df22544d5697ec69dfeaa2c83b565787979bea6e88781556caacd8c",
|
|
21
36
|
"src/skills/verification-planning/SKILL.md": "14186446ef51e1ba2c87b337e8d5f86e566d805156ab21fba2a75f8c4a99df3f",
|
|
22
|
-
"src/skills/visual-review-pipeline/
|
|
37
|
+
"src/skills/visual-review-pipeline/references/findings-schema.md": "776511757c0d8387fab232fced8ac9ce031a03f62b6ca539e3c38b0d45035c8e",
|
|
38
|
+
"src/skills/visual-review-pipeline/references/workflow-steps.md": "1f763f39d9218263bfb10f575d739d9eb62d89cd9f00d38c21cd729b078b44c8",
|
|
39
|
+
"src/skills/visual-review-pipeline/SKILL.md": "7f66f0426868535db891bccd8e21c719b7dcbb16625ea75edbf436ccb1896ac1",
|
|
23
40
|
"src/skills/worktrees/SKILL.md": "9cf2b036e90d9ff7c6deb786ad7bab2cb78d6bf39166a67d5cbeafc29f593c6e"
|
|
24
41
|
}
|
package/src/agents/zeus.md
CHANGED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named-behavior overrides — the user's local layer over the plugin.
|
|
3
|
+
*
|
|
4
|
+
* The registry lives in `src/routing.yml` (`behaviors:`); the override FILES
|
|
5
|
+
* live outside the installer's ownership:
|
|
6
|
+
* - project: `<project>/.pantheon/overrides.json`
|
|
7
|
+
* - global: `<config-dir>/pantheon-overrides.json`
|
|
8
|
+
* Project entries win per id. The files are never inventoried, so
|
|
9
|
+
* reconcile/uninstall/upgrade never touch them.
|
|
10
|
+
*
|
|
11
|
+
* Pure module: parse, merge, validate. No fs, no plugin imports.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const OVERRIDE_CONTENT_MAX = 8000
|
|
15
|
+
export const OVERRIDE_REASON_MAX = 200
|
|
16
|
+
|
|
17
|
+
export interface BehaviorSpec {
|
|
18
|
+
id: string
|
|
19
|
+
kind: 'install' | 'runtime'
|
|
20
|
+
owner: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface OverrideEntry {
|
|
24
|
+
action: 'disable' | 'replace'
|
|
25
|
+
content?: string
|
|
26
|
+
reason?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type EffectiveOverrides = Record<string, OverrideEntry>
|
|
30
|
+
|
|
31
|
+
export interface ParseResult {
|
|
32
|
+
entries: EffectiveOverrides
|
|
33
|
+
errors: string[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function validateEntry(id: string, value: unknown, label: string, errors: string[]): void {
|
|
37
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
38
|
+
errors.push(`${label}: "${id}" must be an object`)
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
const entry = value as Record<string, unknown>
|
|
42
|
+
for (const key of Object.keys(entry)) {
|
|
43
|
+
if (key !== 'action' && key !== 'content' && key !== 'reason') {
|
|
44
|
+
errors.push(`${label}: "${id}" has unknown key "${key}"`)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (entry.action !== 'disable' && entry.action !== 'replace') {
|
|
48
|
+
errors.push(`${label}: "${id}".action must be "disable" or "replace"`)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
if (entry.action === 'replace') {
|
|
52
|
+
const content = entry.content
|
|
53
|
+
if (typeof content !== 'string' || content.length === 0) {
|
|
54
|
+
errors.push(`${label}: "${id}".content is required for action "replace"`)
|
|
55
|
+
} else if (content.length > OVERRIDE_CONTENT_MAX) {
|
|
56
|
+
errors.push(
|
|
57
|
+
`${label}: "${id}".content is ${content.length} chars — over the ${OVERRIDE_CONTENT_MAX}-char cap`,
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (
|
|
62
|
+
entry.reason !== undefined &&
|
|
63
|
+
(typeof entry.reason !== 'string' || entry.reason.length > OVERRIDE_REASON_MAX)
|
|
64
|
+
) {
|
|
65
|
+
errors.push(`${label}: "${id}".reason must be a string of at most ${OVERRIDE_REASON_MAX} chars`)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Parse one overrides file. Invalid entries are reported, valid ones kept. */
|
|
70
|
+
export function parseOverridesFile(raw: string, label = 'overrides'): ParseResult {
|
|
71
|
+
const errors: string[] = []
|
|
72
|
+
let data: unknown
|
|
73
|
+
try {
|
|
74
|
+
data = JSON.parse(raw)
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return { entries: {}, errors: [`${label}: invalid JSON (${(error as Error).message})`] }
|
|
77
|
+
}
|
|
78
|
+
if (data === null || typeof data !== 'object' || Array.isArray(data)) {
|
|
79
|
+
return { entries: {}, errors: [`${label}: top level must be an object`] }
|
|
80
|
+
}
|
|
81
|
+
const entries: EffectiveOverrides = {}
|
|
82
|
+
for (const [id, value] of Object.entries(data as Record<string, unknown>)) {
|
|
83
|
+
const before = errors.length
|
|
84
|
+
validateEntry(id, value, label, errors)
|
|
85
|
+
if (errors.length === before && value && typeof value === 'object') {
|
|
86
|
+
entries[id] = value as unknown as OverrideEntry
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { entries, errors }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Merge global under project: per id, the project entry wins whole. */
|
|
93
|
+
export function mergeOverrides(globalRaw?: string, projectRaw?: string): ParseResult {
|
|
94
|
+
const errors: string[] = []
|
|
95
|
+
const effective: EffectiveOverrides = {}
|
|
96
|
+
if (globalRaw !== undefined) {
|
|
97
|
+
const g = parseOverridesFile(globalRaw, 'global overrides')
|
|
98
|
+
errors.push(...g.errors)
|
|
99
|
+
Object.assign(effective, g.entries)
|
|
100
|
+
}
|
|
101
|
+
if (projectRaw !== undefined) {
|
|
102
|
+
const p = parseOverridesFile(projectRaw, 'project overrides')
|
|
103
|
+
errors.push(...p.errors)
|
|
104
|
+
Object.assign(effective, p.entries)
|
|
105
|
+
}
|
|
106
|
+
return { entries: effective, errors }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Ids present in the overrides but absent from the registry — doctor warns. */
|
|
110
|
+
export function unknownBehaviorIds(
|
|
111
|
+
effective: EffectiveOverrides,
|
|
112
|
+
registry: readonly BehaviorSpec[],
|
|
113
|
+
): string[] {
|
|
114
|
+
const known = new Set(registry.map((b) => b.id))
|
|
115
|
+
return Object.keys(effective)
|
|
116
|
+
.filter((id) => !known.has(id))
|
|
117
|
+
.sort()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** install behavior decision: 'skip' (disable) | content (replace) | undefined (canonical). */
|
|
121
|
+
export function installDecision(
|
|
122
|
+
effective: EffectiveOverrides,
|
|
123
|
+
registry: readonly BehaviorSpec[],
|
|
124
|
+
id: string,
|
|
125
|
+
): 'skip' | { content: string } | undefined {
|
|
126
|
+
const spec = registry.find((b) => b.id === id)
|
|
127
|
+
if (spec === undefined || spec.kind !== 'install') return undefined
|
|
128
|
+
const entry = effective[id]
|
|
129
|
+
if (entry === undefined) return undefined
|
|
130
|
+
if (entry.action === 'disable') return 'skip'
|
|
131
|
+
return { content: entry.content ?? '' }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** runtime behavior: true when a REGISTERED runtime behavior is disabled by override. */
|
|
135
|
+
export function isRuntimeDisabled(
|
|
136
|
+
effective: EffectiveOverrides,
|
|
137
|
+
registry: readonly BehaviorSpec[],
|
|
138
|
+
id: string,
|
|
139
|
+
): boolean {
|
|
140
|
+
const spec = registry.find((b) => b.id === id)
|
|
141
|
+
if (spec === undefined || spec.kind !== 'runtime') return false
|
|
142
|
+
return effective[id]?.action === 'disable'
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface OverrideWarning {
|
|
146
|
+
code: 'override_schema_invalid' | 'override_unknown_behavior'
|
|
147
|
+
file: 'project' | 'global'
|
|
148
|
+
message: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface OverrideClassification {
|
|
152
|
+
warnings: OverrideWarning[]
|
|
153
|
+
effective: EffectiveOverrides
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Doctor-side classifier: parse both override files, collect schema errors
|
|
158
|
+
* and registry-unknown ids as warnings. Pure — the doctor supplies the raw
|
|
159
|
+
* file contents (or undefined when a file does not exist) and decides how to
|
|
160
|
+
* render or fix.
|
|
161
|
+
*/
|
|
162
|
+
export function classifyOverrideFiles(
|
|
163
|
+
registry: readonly BehaviorSpec[],
|
|
164
|
+
projectRaw?: string,
|
|
165
|
+
globalRaw?: string,
|
|
166
|
+
): OverrideClassification {
|
|
167
|
+
const warnings: OverrideWarning[] = []
|
|
168
|
+
const global =
|
|
169
|
+
globalRaw === undefined ? undefined : parseOverridesFile(globalRaw, 'global overrides')
|
|
170
|
+
const project =
|
|
171
|
+
projectRaw === undefined ? undefined : parseOverridesFile(projectRaw, 'project overrides')
|
|
172
|
+
for (const parsed of [global, project]) {
|
|
173
|
+
if (parsed === undefined) continue
|
|
174
|
+
for (const error of parsed.errors) {
|
|
175
|
+
warnings.push({
|
|
176
|
+
code: 'override_schema_invalid',
|
|
177
|
+
file: parsed === project ? 'project' : 'global',
|
|
178
|
+
message: error,
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const effective = mergeOverrides(globalRaw, projectRaw).entries
|
|
183
|
+
for (const id of unknownBehaviorIds(effective, registry)) {
|
|
184
|
+
warnings.push({
|
|
185
|
+
code: 'override_unknown_behavior',
|
|
186
|
+
file: (project?.entries[id] !== undefined ? 'project' : 'global') as 'project' | 'global',
|
|
187
|
+
message: `override names unknown behavior "${id}" — it is not in the routing.yml behaviors registry`,
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
return { warnings, effective }
|
|
191
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { constants } from 'node:fs'
|
|
4
4
|
import { lstat, open, realpath } from 'node:fs/promises'
|
|
5
5
|
import path from 'node:path'
|
|
6
|
-
import type { V2ToolDef } from './
|
|
6
|
+
import type { V2ToolDef } from './tools.ts'
|
|
7
7
|
|
|
8
8
|
export const BOUNDED_READ_TOOL = 'pantheon_bounded_read'
|
|
9
9
|
export const BOUNDED_READ_MAX_CALLS = 2
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* dbPath resolution: explicit option > PANTHEON_COST_DB > OPENCODE_DB > the XDG
|
|
30
30
|
* default `opencode.db`. OPENCODE_DB is what a SANDBOX uses to name its state
|
|
31
|
-
* database `opencode
|
|
31
|
+
* database `opencode.db`, so it — not the host generation — is what selects
|
|
32
32
|
* a non-default file. The tool is wired in plugin.ts alongside the delegation
|
|
33
33
|
* toolset (usable by zeus and any agent with tool access — no routing change
|
|
34
34
|
* needed).
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `status: 'refusal'` and never as an error.
|
|
13
13
|
* - A missing or unusable answer is reported as `failed_to_respond` and is
|
|
14
14
|
* never promoted to a verdict. During mandatory verification it becomes
|
|
15
|
-
* `BLOCK` (see `resolveVerify` in `
|
|
15
|
+
* `BLOCK` (see `resolveVerify` in `decision-verify.ts`).
|
|
16
16
|
*
|
|
17
17
|
* `ask` questions are independent of each other: {@link evaluateAskAnswer}
|
|
18
18
|
* receives exactly one question, so no earlier answer can supply context.
|
|
@@ -296,5 +296,5 @@ export function evaluateAskAnswer(question: unknown, answer: unknown): AskResolu
|
|
|
296
296
|
return { status: 'score', questionId: spec.id, level }
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
export * from './
|
|
300
|
-
export * from './
|
|
299
|
+
export * from './decision-rank.ts'
|
|
300
|
+
export * from './decision-verify.ts'
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* rethrown into admission.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import { decideHeuristic, type HeuristicOutcome } from '../v2-decision-heuristic.ts'
|
|
16
|
+
import { decideHeuristic, type HeuristicOutcome } from '../decision-heuristic.ts'
|
|
18
17
|
import {
|
|
19
18
|
observeShadow,
|
|
20
19
|
type ShadowDecision,
|
|
21
20
|
type ShadowRecord,
|
|
22
21
|
type ShadowSink,
|
|
23
|
-
} from '../
|
|
22
|
+
} from '../decision-shadow.ts'
|
|
23
|
+
import { normalizeMeasuredValue } from '../local-decision-prompt.ts'
|
|
24
24
|
|
|
25
25
|
export type AgentSource = 'agents' | 'none'
|
|
26
26
|
|
|
@@ -27,13 +27,13 @@ import {
|
|
|
27
27
|
type ShadowDecision,
|
|
28
28
|
type ShadowRecord,
|
|
29
29
|
type ShadowSink,
|
|
30
|
-
} from '../
|
|
30
|
+
} from '../decision-shadow.ts'
|
|
31
31
|
import {
|
|
32
32
|
resolveVerify,
|
|
33
33
|
type VerifyOutcome,
|
|
34
34
|
type VerifyRequirement,
|
|
35
35
|
type VerifyVerdict,
|
|
36
|
-
} from '../
|
|
36
|
+
} from '../decision-verify.ts'
|
|
37
37
|
|
|
38
38
|
const TOKEN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/
|
|
39
39
|
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
* shared contract, and even then the draft is not mutated.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { type ChoiceQuestion, evaluateAskAnswer, validateAsk } from '../
|
|
24
|
+
import { type ChoiceQuestion, evaluateAskAnswer, validateAsk } from '../decision-contracts.ts'
|
|
25
25
|
import {
|
|
26
26
|
observeShadow,
|
|
27
27
|
type ShadowDecision,
|
|
28
28
|
type ShadowRecord,
|
|
29
29
|
type ShadowSink,
|
|
30
|
-
} from '../
|
|
30
|
+
} from '../decision-shadow.ts'
|
|
31
31
|
|
|
32
32
|
export type CatalogSource = 'draft' | 'none'
|
|
33
33
|
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* rethrown into admission.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import { rankCandidates } from '../v2-decision-rank.ts'
|
|
16
|
+
import { rankCandidates } from '../decision-rank.ts'
|
|
18
17
|
import {
|
|
19
18
|
observeShadow,
|
|
20
19
|
type ShadowDecision,
|
|
21
20
|
type ShadowRecord,
|
|
22
21
|
type ShadowSink,
|
|
23
|
-
} from '../
|
|
22
|
+
} from '../decision-shadow.ts'
|
|
23
|
+
import { resolveSkillSource, type SkillsSource } from '../local-decision-prompt.ts'
|
|
24
24
|
|
|
25
25
|
export interface SkillPointResult {
|
|
26
26
|
readonly record: ShadowRecord
|