pantheon-opencode 1.6.1 → 1.6.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.global.md +11 -11
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +179 -0
- package/README.md +268 -20
- package/README.pt-BR.md +34 -11
- package/bin/pantheon-init.mjs +301 -32
- package/package.json +13 -4
- package/plugin.json +1 -1
- package/prompts/README.md +58 -0
- package/prompts/debug-issue.prompt.md +46 -0
- package/prompts/dynamic/agora-generated.txt +38 -0
- package/prompts/dynamic/orchestrate-generated.txt +51 -0
- package/prompts/focus.prompt.md +42 -0
- package/prompts/implement-feature.prompt.md +39 -0
- package/prompts/optimize-database.prompt.md +58 -0
- package/prompts/orchestrate-with-zeus.prompt.md +441 -0
- package/prompts/plan-architecture.prompt.md +59 -0
- package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
- package/prompts/quick-plan-large-feature.prompt.md +197 -0
- package/prompts/semantic-summarize.md +50 -0
- package/prompts/sketch.prompt.md +91 -0
- package/prompts/subtask.prompt.md +131 -0
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +1 -1
- package/scripts/decision-router-budget.mjs +780 -0
- package/scripts/decision-router-v2-budget.mjs +218 -0
- package/scripts/decision-router-v2-egress.mjs +272 -0
- package/scripts/decision-router.mjs +758 -0
- package/scripts/docs-check-changelog.mjs +5 -3
- package/scripts/doctor.mjs +213 -45
- package/scripts/install/agents-md.mjs +2 -1
- package/scripts/install/component-selection.mjs +9 -4
- package/scripts/install/config-migration.mjs +344 -393
- package/scripts/install/config-paths.mjs +15 -0
- package/scripts/install/decision-layer-preview.mjs +376 -0
- package/scripts/install/decision-router-config.mjs +560 -0
- package/scripts/install/health-check.mjs +20 -11
- package/scripts/install/interactive.mjs +103 -14
- package/scripts/install/interrupt.mjs +4 -3
- package/scripts/install/mcp-permissions.mjs +164 -0
- package/scripts/install/migrate.mjs +123 -72
- package/scripts/install/opencode-version.mjs +31 -13
- package/scripts/install/opencode-wildcard.mjs +106 -0
- package/scripts/install/opencode.mjs +411 -184
- package/scripts/install/plan-artifact.mjs +12 -1
- package/scripts/install/plan.mjs +8 -1
- package/scripts/install/plugin.mjs +18 -1
- package/scripts/install/state.mjs +12 -0
- package/scripts/install/strings.mjs +22 -0
- package/scripts/install/v2-capabilities.mjs +5 -6
- package/scripts/install/venv.mjs +34 -17
- package/scripts/mcp_resources.py +11 -9
- package/scripts/package-evidence.mjs +1 -0
- package/scripts/release-notes.mjs +30 -7
- package/scripts/restore.mjs +22 -10
- package/scripts/sandbox-env.sh +174 -0
- package/scripts/setup-v2-config.mjs +1703 -0
- package/scripts/setup.mjs +415 -0
- package/scripts/sync-tui.mjs +9 -1
- package/scripts/test-opencode-v2-sandbox.sh +448 -157
- package/scripts/update-skills-lock.mjs +30 -0
- package/scripts/versioning.mjs +41 -5
- package/skills-lock.json +10 -10
- package/src/agents/aphrodite.md +11 -3
- package/src/agents/apollo.md +6 -0
- package/src/agents/athena.md +7 -1
- package/src/agents/demeter.md +6 -2
- package/src/agents/gaia.md +5 -0
- package/src/agents/hephaestus.md +7 -2
- package/src/agents/hermes.md +14 -13
- package/src/agents/iris.md +6 -2
- package/src/agents/mnemosyne.md +21 -50
- package/src/agents/nyx.md +6 -2
- package/src/agents/prometheus.md +5 -1
- package/src/agents/talos.md +10 -1
- package/src/agents/themis.md +5 -1
- package/src/agents/zeus.md +61 -65
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +3 -3
- package/src/instructions/test-economy.instructions.md +6 -6
- package/src/mcp/eval_store.py +11 -4
- package/src/mcp/mcp_resources.py +11 -9
- package/src/mcp/memory_mcp.py +293 -150
- package/src/mcp/pantheon_vision.py +37 -36
- package/src/pantheon/cost-command.ts +30 -133
- package/src/pantheon/jev-decision-tool.ts +347 -0
- package/src/pantheon/jev-decisions.ts +625 -0
- package/src/pantheon/local-decision-agents.ts +170 -0
- package/src/pantheon/local-decision-budget.ts +1046 -0
- package/src/pantheon/local-decision-egress-gate.ts +144 -0
- package/src/pantheon/local-decision-prompt.ts +256 -0
- package/src/pantheon/local-decision-provider-matrix.ts +44 -0
- package/src/pantheon/local-decision-router.ts +225 -0
- package/src/pantheon/local-decision-skills.ts +281 -0
- package/src/pantheon/local-decision-tool.ts +160 -0
- package/src/pantheon/local-decision-turn.ts +101 -0
- package/src/pantheon/local-decision-usage-evidence.internal.ts +168 -0
- package/src/pantheon/local-orchestration.ts +322 -0
- package/src/pantheon/model-pricing.ts +1 -536
- package/src/pantheon/pantheon-decision-catalog.ts +101 -0
- package/src/pantheon/v2-decision-budget.ts +456 -0
- package/src/pantheon/v2-decision-contracts.ts +300 -0
- package/src/pantheon/v2-decision-egress.ts +203 -0
- package/src/pantheon/v2-decision-events.ts +180 -0
- package/src/pantheon/v2-decision-heuristic.ts +121 -0
- package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
- package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
- package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
- package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
- package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
- package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
- package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
- package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
- package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
- package/src/pantheon/v2-decision-points/p8-guardrail.ts +367 -0
- package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
- package/src/pantheon/v2-decision-points.ts +242 -0
- package/src/pantheon/v2-decision-policy.ts +166 -0
- package/src/pantheon/v2-decision-premises.ts +146 -0
- package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
- package/src/pantheon/v2-decision-rank.ts +91 -0
- package/src/pantheon/v2-decision-registry.ts +391 -0
- package/src/pantheon/v2-decision-resource-ids.ts +127 -0
- package/src/pantheon/v2-decision-shadow.ts +123 -0
- package/src/pantheon/v2-decision-telemetry.ts +214 -0
- package/src/pantheon/v2-decision-verify.ts +51 -0
- package/src/pantheon/v2-hook-engine.ts +307 -0
- package/src/pantheon/v2-native-decisions.ts +365 -0
- package/src/pantheon/v2-shell-hooks.ts +66 -2
- package/src/pantheon/v2-tools.ts +38 -15
- package/src/pantheon/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +43 -10
- package/src/plugin-v2.ts +449 -79
- package/src/plugin.ts +4 -0
- package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
- package/src/plugins/tui/dist/server-v2.d.ts +22 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/server-v2.js +26 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +54 -51
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +762 -529
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +17 -2
- package/src/plugins/tui/package.json +6 -3
- package/src/plugins/tui/src/context-gauge.ts +59 -0
- package/src/plugins/tui/src/cost-data.ts +607 -0
- package/src/plugins/tui/src/index-v2.tsx +360 -242
- package/src/plugins/tui/src/model-pricing.ts +536 -0
- package/src/plugins/tui/src/model-usage-limits.ts +4 -0
- package/src/plugins/tui/src/server-v2.ts +21 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +34 -5
- package/src/routing.yml +72 -13
- package/src/skills/README.md +4 -0
- package/src/skills/agent-coordination/SKILL.md +0 -3
- package/src/skills/artifact-management/SKILL.md +0 -3
- package/src/skills/auto-continue/SKILL.md +0 -3
- package/src/skills/code-review-checklist/SKILL.md +0 -3
- package/src/skills/context-compression/SKILL.md +0 -3
- package/src/skills/memory-bank/SKILL.md +6 -28
- package/src/skills/session-goal/SKILL.md +0 -3
- package/src/skills/simplify/SKILL.md +5 -4
- package/src/skills/tdd-with-agents/SKILL.md +0 -3
- package/src/skills/visual-review-pipeline/SKILL.md +0 -1
- package/src/pantheon/memory-context.ts +0 -1017
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { LocalDecisionPolicy } from './local-orchestration.ts'
|
|
2
|
+
import { PANTHEON_AGENT_CATALOG, PANTHEON_AGENT_IDS } from './pantheon-decision-catalog.ts'
|
|
3
|
+
import { isAgentAllowed } from './permission-globs.ts'
|
|
4
|
+
import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
|
|
5
|
+
|
|
6
|
+
export type AgentRecommendationReason =
|
|
7
|
+
| 'RECOMMENDED'
|
|
8
|
+
| 'NO_DELEGATION_SIGNAL'
|
|
9
|
+
| 'NO_ELIGIBLE_CANDIDATE'
|
|
10
|
+
| 'AMBIGUOUS_CANDIDATE'
|
|
11
|
+
| 'POLICY_UNAVAILABLE'
|
|
12
|
+
| 'INVALID_INPUT'
|
|
13
|
+
|
|
14
|
+
export interface LocalAgentRecommendation {
|
|
15
|
+
agent: string | null
|
|
16
|
+
reasonCode: AgentRecommendationReason
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MAX_REQUEST_LENGTH = 20_000
|
|
20
|
+
const CATALOG_ORDER = new Map(PANTHEON_AGENT_CATALOG.map((entry, index) => [entry.id, index]))
|
|
21
|
+
|
|
22
|
+
const EXPLICIT_DELEGATION_TOKENS = new Set([
|
|
23
|
+
'delegate',
|
|
24
|
+
'delegation',
|
|
25
|
+
'delegar',
|
|
26
|
+
'delegacao',
|
|
27
|
+
'handoff',
|
|
28
|
+
'subagent',
|
|
29
|
+
'specialist',
|
|
30
|
+
'especialista',
|
|
31
|
+
'route',
|
|
32
|
+
'routing',
|
|
33
|
+
'parallel',
|
|
34
|
+
'paralelo',
|
|
35
|
+
])
|
|
36
|
+
|
|
37
|
+
const ACTION_TOKENS = new Set([
|
|
38
|
+
'add',
|
|
39
|
+
'audit',
|
|
40
|
+
'build',
|
|
41
|
+
'change',
|
|
42
|
+
'create',
|
|
43
|
+
'debug',
|
|
44
|
+
'design',
|
|
45
|
+
'fix',
|
|
46
|
+
'implement',
|
|
47
|
+
'implementar',
|
|
48
|
+
'investigate',
|
|
49
|
+
'migrate',
|
|
50
|
+
'optimize',
|
|
51
|
+
'plan',
|
|
52
|
+
'planejar',
|
|
53
|
+
'refactor',
|
|
54
|
+
'research',
|
|
55
|
+
'review',
|
|
56
|
+
'revisar',
|
|
57
|
+
'update',
|
|
58
|
+
])
|
|
59
|
+
|
|
60
|
+
/** Specialist keywords. Scores are local only and never grant permission. */
|
|
61
|
+
const AGENT_KEYWORDS: Readonly<Record<string, readonly string[]>> = Object.freeze({
|
|
62
|
+
athena: ['plan', 'planning', 'architecture', 'architect', 'strategy', 'spec', 'requirements'],
|
|
63
|
+
apollo: ['investigate', 'investigation', 'research', 'discovery', 'explore', 'find', 'search'],
|
|
64
|
+
hermes: ['api', 'backend', 'fastapi', 'python', 'endpoint', 'async', 'server', 'pytest'],
|
|
65
|
+
aphrodite: [
|
|
66
|
+
'frontend',
|
|
67
|
+
'react',
|
|
68
|
+
'typescript',
|
|
69
|
+
'css',
|
|
70
|
+
'component',
|
|
71
|
+
'ui',
|
|
72
|
+
'accessibility',
|
|
73
|
+
'wcag',
|
|
74
|
+
'responsive',
|
|
75
|
+
],
|
|
76
|
+
demeter: ['database', 'sql', 'schema', 'migration', 'alembic', 'sqlalchemy', 'query', 'index'],
|
|
77
|
+
themis: ['security', 'owasp', 'audit', 'lint', 'coverage', 'quality', 'vulnerability', 'cve'],
|
|
78
|
+
prometheus: ['docker', 'ci', 'pipeline', 'deploy', 'infrastructure', 'provider', 'container'],
|
|
79
|
+
hephaestus: ['langchain', 'langgraph', 'rag', 'vector', 'embedding', 'llm', 'pipeline', 'ai'],
|
|
80
|
+
nyx: ['observability', 'telemetry', 'opentelemetry', 'tracing', 'metrics', 'langsmith', 'cost'],
|
|
81
|
+
gaia: ['satellite', 'spectral', 'sar', 'geospatial', 'imagery', 'remote', 'sensing'],
|
|
82
|
+
iris: ['github', 'pull', 'request', 'issue', 'branch', 'release', 'tag', 'pr'],
|
|
83
|
+
mnemosyne: ['memory', 'adr', 'documentation', 'knowledge', 'persistent'],
|
|
84
|
+
talos: ['typo', 'hotfix', 'small', 'quick', 'minor', 'css'],
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
function normalize(value: string): string {
|
|
88
|
+
return value
|
|
89
|
+
.normalize('NFD')
|
|
90
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
91
|
+
.toLowerCase()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function tokenize(value: string): Set<string> {
|
|
95
|
+
const tokens = value.match(/[a-z0-9]+(?:[+#.-][a-z0-9]+)*/g) ?? []
|
|
96
|
+
return new Set(tokens)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** True when the request plausibly considers delegating to a specialist. */
|
|
100
|
+
export function hasDelegationSignal(request: unknown): boolean {
|
|
101
|
+
if (typeof request !== 'string' || request.trim().length === 0) return false
|
|
102
|
+
if (request.length > MAX_REQUEST_LENGTH) return false
|
|
103
|
+
const tokens = tokenize(normalize(request))
|
|
104
|
+
for (const token of EXPLICIT_DELEGATION_TOKENS) {
|
|
105
|
+
if (tokens.has(token)) return true
|
|
106
|
+
}
|
|
107
|
+
if (![...tokens].some((token) => ACTION_TOKENS.has(token))) return false
|
|
108
|
+
return [...tokens].some((token) =>
|
|
109
|
+
Object.values(AGENT_KEYWORDS).some((keywords) => keywords.includes(token)),
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Intersect canonical agents with Zeus grants, routing defaults, and task rules. */
|
|
114
|
+
export function listEligibleDecisionAgents(policy: LocalDecisionPolicy | undefined): string[] {
|
|
115
|
+
if (policy === undefined || !PANTHEON_AGENTS.has('zeus')) return []
|
|
116
|
+
const zeus = policy.agents.zeus
|
|
117
|
+
if (zeus === undefined) return []
|
|
118
|
+
return PANTHEON_AGENT_CATALOG.filter(({ id }) => id !== 'zeus')
|
|
119
|
+
.filter(({ id }) => {
|
|
120
|
+
const target = policy.agents[id]
|
|
121
|
+
return (
|
|
122
|
+
PANTHEON_AGENT_IDS.has(id) &&
|
|
123
|
+
target?.canReceiveDelegation === true &&
|
|
124
|
+
zeus.canDelegateTo.includes(id) &&
|
|
125
|
+
isAgentAllowed(policy.permissionTask, id)
|
|
126
|
+
)
|
|
127
|
+
})
|
|
128
|
+
.map(({ id }) => id)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Recommend at most one canonical specialist, or abstain. The result is
|
|
133
|
+
* advisory only: it neither dispatches nor grants anything.
|
|
134
|
+
*/
|
|
135
|
+
export function recommendLocalDecisionAgent(
|
|
136
|
+
request: unknown,
|
|
137
|
+
policy: LocalDecisionPolicy | undefined,
|
|
138
|
+
): LocalAgentRecommendation {
|
|
139
|
+
if (typeof request !== 'string' || request.trim().length === 0) {
|
|
140
|
+
return { agent: null, reasonCode: 'INVALID_INPUT' }
|
|
141
|
+
}
|
|
142
|
+
if (request.length > MAX_REQUEST_LENGTH) {
|
|
143
|
+
return { agent: null, reasonCode: 'INVALID_INPUT' }
|
|
144
|
+
}
|
|
145
|
+
if (policy === undefined) return { agent: null, reasonCode: 'POLICY_UNAVAILABLE' }
|
|
146
|
+
if (!hasDelegationSignal(request)) {
|
|
147
|
+
return { agent: null, reasonCode: 'NO_DELEGATION_SIGNAL' }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const eligible = new Set(listEligibleDecisionAgents(policy))
|
|
151
|
+
if (eligible.size === 0) return { agent: null, reasonCode: 'NO_ELIGIBLE_CANDIDATE' }
|
|
152
|
+
|
|
153
|
+
const tokens = tokenize(normalize(request))
|
|
154
|
+
const scored: Array<{ id: string; score: number; order: number }> = []
|
|
155
|
+
for (const id of eligible) {
|
|
156
|
+
const keywords = AGENT_KEYWORDS[id] ?? []
|
|
157
|
+
const score = keywords.reduce((total, keyword) => total + (tokens.has(keyword) ? 1 : 0), 0)
|
|
158
|
+
if (score <= 0) continue
|
|
159
|
+
scored.push({ id, score, order: CATALOG_ORDER.get(id) ?? 0 })
|
|
160
|
+
}
|
|
161
|
+
if (scored.length === 0) return { agent: null, reasonCode: 'NO_ELIGIBLE_CANDIDATE' }
|
|
162
|
+
|
|
163
|
+
scored.sort((left, right) => right.score - left.score || left.order - right.order)
|
|
164
|
+
const [first, second] = scored
|
|
165
|
+
if (first === undefined) return { agent: null, reasonCode: 'NO_ELIGIBLE_CANDIDATE' }
|
|
166
|
+
if (second !== undefined && second.score === first.score) {
|
|
167
|
+
return { agent: null, reasonCode: 'AMBIGUOUS_CANDIDATE' }
|
|
168
|
+
}
|
|
169
|
+
return { agent: first.id, reasonCode: 'RECOMMENDED' }
|
|
170
|
+
}
|