pantheon-opencode 1.5.0-beta.2 → 1.5.0-beta.20
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/.pantheon/code-mode/manifest.json +21 -0
- package/AGENTS.md +14 -63
- package/CHANGELOG.md +1260 -0
- package/README.md +162 -23
- package/README.pt-BR.md +104 -19
- package/bin/pantheon-init.mjs +178 -21
- package/commands/pantheon.md +1 -35
- package/package.json +23 -15
- package/plugin.json +1 -1
- package/pyproject.toml +62 -0
- package/scripts/code_mode_server.py +431 -55
- package/scripts/doctor.mjs +207 -9
- package/scripts/install/cli-ui.mjs +17 -11
- package/scripts/install/config-migration.mjs +4 -6
- package/scripts/install/opencode.mjs +137 -35
- package/scripts/install/plugin.mjs +12 -45
- package/scripts/install/shared.mjs +43 -2
- package/scripts/install/strings.mjs +129 -0
- package/scripts/install-mcp.mjs +1 -0
- package/scripts/manifest-inventory.mjs +410 -0
- package/scripts/mcp_persistence_server.py +536 -164
- package/scripts/package-evidence.mjs +242 -0
- package/scripts/probe-pantheon-cost.mjs +10 -1
- package/scripts/release-beta-version.mjs +56 -60
- package/scripts/sync-artifacts.mjs +169 -0
- package/scripts/sync-tui.mjs +129 -64
- package/scripts/test-opencode-v1-v2-sandbox.sh +79 -161
- package/scripts/validation-policy.mjs +7 -7
- package/scripts/version-check.mjs +113 -108
- package/scripts/versioning.mjs +230 -86
- package/src/agents/apollo.md +1 -0
- package/src/agents/gaia.md +1 -0
- package/src/agents/mnemosyne.md +1 -1
- package/src/agents/zeus.md +11 -54
- package/src/instructions/memory-protocol.instructions.md +6 -3
- package/src/instructions/zeus-anti-stall.instructions.md +2 -4
- package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
- package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
- package/src/mcp/code_mode_server.py +431 -55
- package/src/mcp/mcp_persistence_server.py +536 -164
- package/src/mcp/toon_codec.py +2 -4
- package/src/pantheon/background-job-board.ts +47 -5
- package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
- package/src/pantheon/cost-command.ts +309 -44
- package/src/pantheon/delegation-enforce.ts +59 -14
- package/src/pantheon/file-persistence-salvage.ts +64 -0
- package/src/pantheon/file-persistence.ts +194 -45
- package/src/pantheon/goal-loop.ts +1 -1
- package/src/pantheon/goal-store.ts +1 -1
- package/src/pantheon/idle-continuation.ts +4 -6
- package/src/pantheon/model-command.ts +1 -2
- package/src/pantheon/native-task-status.ts +139 -0
- package/src/pantheon/presets.d.mts +0 -20
- package/src/pantheon/presets.mjs +0 -64
- package/src/pantheon/session-guard.ts +2 -2
- package/src/pantheon/session-id.ts +30 -0
- package/src/pantheon/shared-board.ts +37 -0
- package/src/pantheon/task-result-guard.ts +106 -0
- package/src/pantheon/todo-enforcer.ts +3 -3
- package/src/pantheon/tool-ceiling.ts +159 -0
- package/src/pantheon/tool-context.ts +23 -0
- package/src/pantheon/v2-bridge.ts +1 -4
- package/src/plugin-v2.ts +8 -21
- package/src/plugin.ts +83 -251
- package/src/plugins/pantheon-hooks.ts +51 -0
- package/src/plugins/tui/dist/server.d.ts +1 -1
- package/src/plugins/tui/dist/server.d.ts.map +1 -1
- package/src/plugins/tui/dist/server.js +1 -1
- package/src/plugins/tui/dist/server.js.map +1 -1
- package/src/plugins/tui/dist/tui.d.ts +261 -77
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +640 -234
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +2 -2
- package/src/plugins/tui/src/index.tsx +872 -226
- package/src/routing.yml +0 -16
- package/src/skills/context-compression/SKILL.md +1 -1
- package/scripts/generate-preset-docs.mjs +0 -300
- package/scripts/generate-prompts.sh +0 -222
- package/scripts/hash_verify.py +0 -192
- package/scripts/install/component.mjs +0 -24
- package/scripts/install/migrate-config.mjs +0 -302
- package/scripts/test-context-compression.sh +0 -169
- package/src/pantheon/auto-wake.ts +0 -89
- package/src/pantheon/chat-reminders.ts +0 -9
- package/src/pantheon/comment-checker.ts +0 -48
- package/src/pantheon/compaction-assert.ts +0 -160
- package/src/pantheon/cost-tracker.ts +0 -108
- package/src/pantheon/delegate-manager.ts +0 -669
- package/src/pantheon/delegation-classifier.ts +0 -307
- package/src/pantheon/delegation-finalize.ts +0 -374
- package/src/pantheon/delegation-notify.ts +0 -212
- package/src/pantheon/delegation-toast.ts +0 -73
- package/src/pantheon/delegation.ts +0 -1120
- package/src/pantheon/dispatch-guard.ts +0 -109
- package/src/pantheon/permission-eval.ts +0 -284
- package/src/pantheon/preemptive-compact.ts +0 -76
- package/src/pantheon/retry-policy.ts +0 -212
- package/src/pantheon/step-cap.ts +0 -110
- package/src/pantheon/token-opt.ts +0 -781
- package/src/pantheon/toon-codec.ts +0 -481
- package/src/pantheon/v2-events.ts +0 -131
- package/src/pantheon/v2-hooks.ts +0 -287
- package/src/pantheon/v2-tool-definitions.ts +0 -331
- package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
- package/src/plugins/tui/dist/tui.tsx +0 -2605
package/scripts/versioning.mjs
CHANGED
|
@@ -6,45 +6,46 @@
|
|
|
6
6
|
* recommend Analyze commits and suggest next version bump type
|
|
7
7
|
* apply [type] Bump manifests + move [Unreleased] → [vX.Y.Z] in CHANGELOG
|
|
8
8
|
* type: patch | minor | major | auto (default: auto)
|
|
9
|
+
* --beta: bump the committed beta line instead
|
|
10
|
+
* beta Alias for `apply --beta`
|
|
9
11
|
* changelog [ver] (Internal) Insert a versioned section into CHANGELOG
|
|
10
12
|
* Normally called by `apply`; can be run standalone.
|
|
11
13
|
* status Show current version, latest tag, and pending bump type
|
|
12
14
|
*
|
|
13
|
-
* Design: the release signal is "package.json version > latest git tag"
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Design: the release signal is "package.json version > latest git tag" for
|
|
16
|
+
* stable, and "package.json version is a committed X.Y.Z-beta.N" for beta.
|
|
17
|
+
* Developers (or AI agents) call `apply` (or `apply --beta` / `beta`) to bump
|
|
18
|
+
* the manifests and promote CHANGELOG.md, then push. The dispatch-only release
|
|
19
|
+
* workflow reads the committed version and creates the release. No version
|
|
20
|
+
* bumping ever happens inside GitHub Actions.
|
|
17
21
|
*/
|
|
18
22
|
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { dirname, join } from 'node:path'
|
|
23
|
+
import { execFileSync } from 'node:child_process'
|
|
24
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
25
|
+
import { basename, dirname, join } from 'node:path'
|
|
22
26
|
import { fileURLToPath } from 'node:url'
|
|
27
|
+
import {
|
|
28
|
+
commitPreparedUpdates,
|
|
29
|
+
prepareInventoryVersion,
|
|
30
|
+
SEMVER_PATTERN,
|
|
31
|
+
validateInventory,
|
|
32
|
+
} from './manifest-inventory.mjs'
|
|
33
|
+
import { nextBetaVersion } from './release-beta-version.mjs'
|
|
23
34
|
import { collectEntries, groupCommits, parseCommitLine, renderChangelog } from './release-notes.mjs'
|
|
24
35
|
|
|
25
36
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
26
37
|
const ROOT = join(__dirname, '..')
|
|
27
38
|
|
|
28
|
-
const MANIFEST_FILES = [
|
|
29
|
-
// 'platform/forge.json' removed in v1.0 — directory no longer exists
|
|
30
|
-
'pyproject.toml',
|
|
31
|
-
'package.json',
|
|
32
|
-
'plugin.json',
|
|
33
|
-
'src/plugins/tui/package.json',
|
|
34
|
-
]
|
|
35
|
-
|
|
36
39
|
const CHANGELOG_PATH = join(ROOT, 'CHANGELOG.md')
|
|
40
|
+
const ZENODO_PATH = join(ROOT, '.zenodo.json')
|
|
41
|
+
const CITATION_PATH = join(ROOT, 'CITATION.cff')
|
|
37
42
|
|
|
38
43
|
// ---------------------------------------------------------------------------
|
|
39
44
|
// Git helpers
|
|
40
45
|
// ---------------------------------------------------------------------------
|
|
41
46
|
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
return execSync(cmd, { cwd: ROOT, encoding: 'utf-8' }).trim()
|
|
45
|
-
} catch {
|
|
46
|
-
return ''
|
|
47
|
-
}
|
|
47
|
+
function runGit(args) {
|
|
48
|
+
return execFileSync('git', args, { cwd: ROOT, encoding: 'utf8' }).trim()
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
function getLatestTag() {
|
|
@@ -52,12 +53,15 @@ function getLatestTag() {
|
|
|
52
53
|
// The loose glob `v[0-9]*.[0-9]*.[0-9]*` ALSO matches v1.2.0-beta.9.*
|
|
53
54
|
// (the trailing `*` swallows the -beta suffix), which would poison the
|
|
54
55
|
// version gate — so filter strictly before sorting.
|
|
55
|
-
const
|
|
56
|
-
|
|
56
|
+
const tags = runGit(['tag', '-l', 'v*'])
|
|
57
|
+
.split('\n')
|
|
58
|
+
.filter((tag) => /^v\d+\.\d+\.\d+$/.test(tag))
|
|
59
|
+
tags.sort((left, right) => compareStable(left.slice(1), right.slice(1)))
|
|
60
|
+
return tags.at(-1) || 'v0.0.0'
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
function getCurrentVersion() {
|
|
60
|
-
return
|
|
64
|
+
return validateInventory(ROOT).sourceVersion
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
// ---------------------------------------------------------------------------
|
|
@@ -65,7 +69,10 @@ function getCurrentVersion() {
|
|
|
65
69
|
// ---------------------------------------------------------------------------
|
|
66
70
|
|
|
67
71
|
function bumpVersion(version, type) {
|
|
68
|
-
const
|
|
72
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$/.exec(version)
|
|
73
|
+
if (!match) throw new Error(`cannot bump invalid semver: ${version}`)
|
|
74
|
+
if (!['major', 'minor', 'patch'].includes(type)) throw new Error(`invalid bump type: ${type}`)
|
|
75
|
+
const [major, minor, patch] = match.slice(1).map(Number)
|
|
69
76
|
switch (type) {
|
|
70
77
|
case 'major':
|
|
71
78
|
return `${major + 1}.0.0`
|
|
@@ -76,8 +83,17 @@ function bumpVersion(version, type) {
|
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
|
|
86
|
+
function compareStable(left, right) {
|
|
87
|
+
const a = left.split('.').map(Number)
|
|
88
|
+
const b = right.split('.').map(Number)
|
|
89
|
+
for (let index = 0; index < 3; index += 1) {
|
|
90
|
+
if (a[index] !== b[index]) return a[index] - b[index]
|
|
91
|
+
}
|
|
92
|
+
return 0
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
function analyzeConventionalCommits(since) {
|
|
80
|
-
const log =
|
|
96
|
+
const log = runGit(['log', `${since}..HEAD`, '--format=%s'])
|
|
81
97
|
if (!log) return 'patch'
|
|
82
98
|
let bump = 'patch'
|
|
83
99
|
for (const msg of log.split('\n').filter(Boolean)) {
|
|
@@ -91,27 +107,94 @@ function analyzeConventionalCommits(since) {
|
|
|
91
107
|
// Manifest updater
|
|
92
108
|
// ---------------------------------------------------------------------------
|
|
93
109
|
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
function prepareManifests(newVersion) {
|
|
111
|
+
if (!SEMVER_PATTERN.test(newVersion)) throw new Error(`invalid version: ${newVersion}`)
|
|
112
|
+
const inventory = validateInventory(ROOT, { allowVersionDivergence: true })
|
|
113
|
+
return { inventory, updates: prepareInventoryVersion(inventory, newVersion) }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Serialize `.zenodo.json` the way Biome 2.x formats it: objects stay expanded
|
|
118
|
+
* (matching `JSON.stringify(value, null, 2)`), while arrays containing only
|
|
119
|
+
* primitives are collapsed onto one line when they fit within the line width.
|
|
120
|
+
* A plain `JSON.stringify` emits the `keywords` array multiline, which Biome
|
|
121
|
+
* collapses — reintroducing a lint failure on the next release bump.
|
|
122
|
+
*
|
|
123
|
+
* @param {unknown} value parsed JSON document
|
|
124
|
+
* @param {number} [lineWidth] formatter line width (matches biome.json)
|
|
125
|
+
* @returns {string} Biome-compatible JSON with a trailing newline
|
|
126
|
+
*/
|
|
127
|
+
function formatZenodoJson(value, lineWidth = 100) {
|
|
128
|
+
const indent = (depth) => ' '.repeat(depth)
|
|
129
|
+
const render = (node, depth, column) => {
|
|
130
|
+
if (Array.isArray(node)) {
|
|
131
|
+
if (node.length === 0) return '[]'
|
|
132
|
+
const primitiveOnly = node.every((item) => item === null || typeof item !== 'object')
|
|
133
|
+
if (primitiveOnly) {
|
|
134
|
+
const inline = `[${node.map((item) => JSON.stringify(item)).join(', ')}]`
|
|
135
|
+
if (column + inline.length <= lineWidth) return inline
|
|
110
136
|
}
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
const body = node
|
|
138
|
+
.map((item) => `${indent(depth + 1)}${render(item, depth + 1, indent(depth + 1).length)}`)
|
|
139
|
+
.join(',\n')
|
|
140
|
+
return `[\n${body}\n${indent(depth)}]`
|
|
141
|
+
}
|
|
142
|
+
if (node !== null && typeof node === 'object') {
|
|
143
|
+
const entries = Object.entries(node)
|
|
144
|
+
if (entries.length === 0) return '{}'
|
|
145
|
+
const body = entries
|
|
146
|
+
.map(([key, item]) => {
|
|
147
|
+
const keyPrefix = `${indent(depth + 1)}${JSON.stringify(key)}: `
|
|
148
|
+
return `${keyPrefix}${render(item, depth + 1, keyPrefix.length)}`
|
|
149
|
+
})
|
|
150
|
+
.join(',\n')
|
|
151
|
+
return `{\n${body}\n${indent(depth)}}`
|
|
113
152
|
}
|
|
153
|
+
return JSON.stringify(node)
|
|
114
154
|
}
|
|
155
|
+
return `${render(value, 0, 0)}\n`
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Keep the Zenodo deposition metadata (.zenodo.json) and the citation file
|
|
160
|
+
* (CITATION.cff) aligned with the version and date being released. Zenodo's
|
|
161
|
+
* release validator hard-fails when CITATION.cff version differs from the
|
|
162
|
+
* release tag, so these must be bumped together with the manifests.
|
|
163
|
+
*/
|
|
164
|
+
function prepareReleaseMetadata(newVersion, dateStr) {
|
|
165
|
+
if (!SEMVER_PATTERN.test(newVersion)) throw new Error(`invalid version: ${newVersion}`)
|
|
166
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) throw new Error(`invalid date: ${dateStr}`)
|
|
167
|
+
const tagUrl = `https://github.com/ils15/pantheon-opencode/releases/tag/v${newVersion}`
|
|
168
|
+
const updates = []
|
|
169
|
+
|
|
170
|
+
if (existsSync(ZENODO_PATH)) {
|
|
171
|
+
const zenodo = JSON.parse(readFileSync(ZENODO_PATH, 'utf8'))
|
|
172
|
+
const zenodoPrevious = typeof zenodo.version === 'string' ? zenodo.version : null
|
|
173
|
+
if (zenodoPrevious && zenodoPrevious !== newVersion && typeof zenodo.description === 'string') {
|
|
174
|
+
zenodo.description = zenodo.description.replaceAll(zenodoPrevious, newVersion)
|
|
175
|
+
}
|
|
176
|
+
zenodo.version = newVersion
|
|
177
|
+
zenodo.publication_date = dateStr
|
|
178
|
+
zenodo.url = tagUrl
|
|
179
|
+
updates.push({ path: ZENODO_PATH, content: formatZenodoJson(zenodo) })
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (existsSync(CITATION_PATH)) {
|
|
183
|
+
const citationRaw = readFileSync(CITATION_PATH, 'utf8')
|
|
184
|
+
const citationMatch = /^version:\s*["']?([^"'\s]+)["']?\s*$/m.exec(citationRaw)
|
|
185
|
+
const citationPrevious = citationMatch ? citationMatch[1] : null
|
|
186
|
+
let citation = citationRaw
|
|
187
|
+
if (citationPrevious && citationPrevious !== newVersion) {
|
|
188
|
+
citation = citation.replaceAll(`Pantheon v${citationPrevious}`, `Pantheon v${newVersion}`)
|
|
189
|
+
}
|
|
190
|
+
citation = citation
|
|
191
|
+
.replace(/^version:.*$/m, `version: ${newVersion}`)
|
|
192
|
+
.replace(/^date-released:.*$/m, `date-released: ${dateStr}`)
|
|
193
|
+
.replace(/^url:.*$/m, `url: ${tagUrl}`)
|
|
194
|
+
updates.push({ path: CITATION_PATH, content: citation })
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return updates
|
|
115
198
|
}
|
|
116
199
|
|
|
117
200
|
// ---------------------------------------------------------------------------
|
|
@@ -181,15 +264,17 @@ function stripEmptySections(body) {
|
|
|
181
264
|
return keep.join('\n').replace(/\n{3,}/g, '\n\n')
|
|
182
265
|
}
|
|
183
266
|
|
|
184
|
-
function
|
|
267
|
+
function prepareUnreleased(newVersion, dateStr, notesBody = null) {
|
|
268
|
+
if (!SEMVER_PATTERN.test(newVersion)) throw new Error(`invalid changelog version: ${newVersion}`)
|
|
269
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) throw new Error(`invalid changelog date: ${dateStr}`)
|
|
270
|
+
if (notesBody !== null && typeof notesBody !== 'string') {
|
|
271
|
+
throw new Error('generated release notes must be text')
|
|
272
|
+
}
|
|
185
273
|
const content = readFileSync(CHANGELOG_PATH, 'utf-8')
|
|
186
274
|
|
|
187
275
|
const unreleasedHeader = '## [Unreleased]'
|
|
188
276
|
const idx = content.indexOf(unreleasedHeader)
|
|
189
|
-
if (idx === -1)
|
|
190
|
-
console.log(' ⚠ [Unreleased] section not found in CHANGELOG — skipping')
|
|
191
|
-
return false
|
|
192
|
-
}
|
|
277
|
+
if (idx === -1) throw new Error('CHANGELOG.md is missing the [Unreleased] section')
|
|
193
278
|
|
|
194
279
|
// Find the end of [Unreleased]: next ## header or end of file
|
|
195
280
|
const afterHeader = idx + unreleasedHeader.length
|
|
@@ -211,15 +296,10 @@ function promoteUnreleased(newVersion, dateStr, notesBody = null) {
|
|
|
211
296
|
.map((l) => l.trim())
|
|
212
297
|
.filter((l) => l && !l.startsWith('###') && !l.startsWith('## '))
|
|
213
298
|
|
|
214
|
-
if (notesBody === null && realLines.length === 0) {
|
|
215
|
-
console.log(' ℹ [Unreleased] is empty — CHANGELOG not modified')
|
|
216
|
-
return false
|
|
217
|
-
}
|
|
299
|
+
if (notesBody === null && realLines.length === 0) return { changed: false, content }
|
|
218
300
|
|
|
219
301
|
if (notesBody !== null && realLines.length > 0) {
|
|
220
|
-
console.log(
|
|
221
|
-
' ⚠ --notes replaces the manual [Unreleased] content — review the diff before committing',
|
|
222
|
-
)
|
|
302
|
+
console.log(' --notes replaces the manual [Unreleased] content')
|
|
223
303
|
}
|
|
224
304
|
|
|
225
305
|
// Strip lines that are just empty subsections (### X or ## 🆕/🐞/⚠️/✅
|
|
@@ -239,13 +319,35 @@ function promoteUnreleased(newVersion, dateStr, notesBody = null) {
|
|
|
239
319
|
|
|
240
320
|
const updated = `${before + unreleasedHeader + newTemplate}\n\n${newVersionHeader}${writtenBody}${after}`
|
|
241
321
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
322
|
+
if (!updated.includes('## [Unreleased]') || !updated.includes(newVersionHeader)) {
|
|
323
|
+
throw new Error('prepared CHANGELOG.md failed structural validation')
|
|
324
|
+
}
|
|
325
|
+
return { changed: true, content: updated, notesGenerated: notesBody !== null }
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function contentHasUnreleased() {
|
|
329
|
+
return readFileSync(CHANGELOG_PATH, 'utf8').includes('## [Unreleased]')
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function commitPreparedRelease(manifestPlan, changelogPlan, metadataUpdates = []) {
|
|
333
|
+
const updates = [...manifestPlan.updates, ...metadataUpdates]
|
|
334
|
+
if (changelogPlan.changed) {
|
|
335
|
+
updates.push({ path: CHANGELOG_PATH, content: changelogPlan.content })
|
|
336
|
+
}
|
|
337
|
+
commitPreparedUpdates(updates)
|
|
338
|
+
for (const document of manifestPlan.inventory.documents) {
|
|
339
|
+
console.log(` ✓ ${document.entry.file} → ${manifestPlan.version}`)
|
|
340
|
+
}
|
|
341
|
+
for (const { path } of metadataUpdates) {
|
|
342
|
+
console.log(` ✓ ${basename(path)} → ${manifestPlan.version}`)
|
|
343
|
+
}
|
|
344
|
+
if (changelogPlan.changed) {
|
|
345
|
+
console.log(
|
|
346
|
+
changelogPlan.notesGenerated
|
|
347
|
+
? ` ✓ CHANGELOG: [Unreleased] → [v${manifestPlan.version}] (notes generated from commits)`
|
|
348
|
+
: ` ✓ CHANGELOG: [Unreleased] → [v${manifestPlan.version}]`,
|
|
349
|
+
)
|
|
350
|
+
}
|
|
249
351
|
}
|
|
250
352
|
|
|
251
353
|
// ---------------------------------------------------------------------------
|
|
@@ -282,9 +384,35 @@ switch (command) {
|
|
|
282
384
|
break
|
|
283
385
|
}
|
|
284
386
|
|
|
387
|
+
case 'beta':
|
|
285
388
|
case 'apply': {
|
|
286
389
|
const args = process.argv.slice(3)
|
|
287
390
|
const useNotes = args.includes('--notes')
|
|
391
|
+
const useBeta = command === 'beta' || args.includes('--beta')
|
|
392
|
+
|
|
393
|
+
// Beta: advance the committed X.Y.Z-beta.N line and promote the
|
|
394
|
+
// [Unreleased] CHANGELOG section into [vX.Y.Z-beta.N], exactly like the
|
|
395
|
+
// stable path. The committed manifest is the single source of truth — no
|
|
396
|
+
// npm lookup, no git lookup, and no runtime version computation.
|
|
397
|
+
if (useBeta) {
|
|
398
|
+
if (!contentHasUnreleased())
|
|
399
|
+
throw new Error('CHANGELOG.md is missing the [Unreleased] section')
|
|
400
|
+
const current = getCurrentVersion()
|
|
401
|
+
const newVersion = nextBetaVersion(current)
|
|
402
|
+
const date = new Date().toISOString().slice(0, 10)
|
|
403
|
+
console.log(`Bumping ${current} → ${newVersion} (beta)`)
|
|
404
|
+
const changelogPlan = prepareUnreleased(newVersion, date)
|
|
405
|
+
const manifestPlan = prepareManifests(newVersion)
|
|
406
|
+
commitPreparedRelease(
|
|
407
|
+
{ ...manifestPlan, version: newVersion },
|
|
408
|
+
changelogPlan,
|
|
409
|
+
prepareReleaseMetadata(newVersion, date),
|
|
410
|
+
)
|
|
411
|
+
console.log(`\nDone. Commit the version inventory and CHANGELOG as v${newVersion}.`)
|
|
412
|
+
console.log(`Tag v${newVersion} will be created by the release workflow after merge to main.`)
|
|
413
|
+
break
|
|
414
|
+
}
|
|
415
|
+
|
|
288
416
|
const type = args.find((a) => !a.startsWith('--')) || 'auto'
|
|
289
417
|
const latestTag = getLatestTag()
|
|
290
418
|
const current = getCurrentVersion()
|
|
@@ -298,23 +426,25 @@ switch (command) {
|
|
|
298
426
|
const since = latestTag === 'v0.0.0' ? null : latestTag
|
|
299
427
|
const raw = collectEntries({ since, draft: since === null })
|
|
300
428
|
const body = renderChangelog(groupCommits(raw.map(parseCommitLine)))
|
|
301
|
-
if (!body)
|
|
302
|
-
|
|
303
|
-
return null
|
|
304
|
-
}
|
|
305
|
-
console.log(` ℹ --notes: release notes generated from ${raw.length} commits`)
|
|
429
|
+
if (!body) return null
|
|
430
|
+
console.log(` --notes generated from ${raw.length} commits`)
|
|
306
431
|
return body
|
|
307
432
|
}
|
|
308
433
|
|
|
309
|
-
|
|
310
|
-
// without tagging — warn and use the current version as-is. Tags are
|
|
311
|
-
// workflow-owned, so there is nothing to create here.
|
|
434
|
+
if (!contentHasUnreleased()) throw new Error('CHANGELOG.md is missing the [Unreleased] section')
|
|
312
435
|
if (current !== latestVer) {
|
|
313
|
-
console.log(
|
|
314
|
-
|
|
315
|
-
|
|
436
|
+
console.log(
|
|
437
|
+
`package.json (${current}) is ahead of latest tag (${latestTag}); synchronizing inventory.`,
|
|
438
|
+
)
|
|
316
439
|
const date = new Date().toISOString().slice(0, 10)
|
|
317
|
-
|
|
440
|
+
const notesBody = generateNotes()
|
|
441
|
+
const changelogPlan = prepareUnreleased(current, date, notesBody)
|
|
442
|
+
const manifestPlan = prepareManifests(current)
|
|
443
|
+
commitPreparedRelease(
|
|
444
|
+
{ ...manifestPlan, version: current },
|
|
445
|
+
changelogPlan,
|
|
446
|
+
prepareReleaseMetadata(current, date),
|
|
447
|
+
)
|
|
318
448
|
console.log(`Tag v${current} will be created by the release workflow after merge to main.`)
|
|
319
449
|
break
|
|
320
450
|
}
|
|
@@ -324,13 +454,15 @@ switch (command) {
|
|
|
324
454
|
const date = new Date().toISOString().slice(0, 10)
|
|
325
455
|
|
|
326
456
|
console.log(`Bumping ${current} → ${newVersion} (${bumpType})`)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
457
|
+
const notesBody = generateNotes()
|
|
458
|
+
const changelogPlan = prepareUnreleased(newVersion, date, notesBody)
|
|
459
|
+
const manifestPlan = prepareManifests(newVersion)
|
|
460
|
+
commitPreparedRelease(
|
|
461
|
+
{ ...manifestPlan, version: newVersion },
|
|
462
|
+
changelogPlan,
|
|
463
|
+
prepareReleaseMetadata(newVersion, date),
|
|
464
|
+
)
|
|
465
|
+
console.log(`\nDone. Commit the version inventory and CHANGELOG as v${newVersion}.`)
|
|
334
466
|
console.log(`Tag v${newVersion} will be created by the release workflow after merge to main.`)
|
|
335
467
|
break
|
|
336
468
|
}
|
|
@@ -339,7 +471,11 @@ switch (command) {
|
|
|
339
471
|
case 'changelog': {
|
|
340
472
|
const version = arg || getCurrentVersion()
|
|
341
473
|
const date = new Date().toISOString().slice(0, 10)
|
|
342
|
-
|
|
474
|
+
const changelogPlan = prepareUnreleased(version, date)
|
|
475
|
+
if (changelogPlan.changed) {
|
|
476
|
+
commitPreparedUpdates([{ path: CHANGELOG_PATH, content: changelogPlan.content }])
|
|
477
|
+
console.log(` ✓ CHANGELOG: [Unreleased] → [v${version}]`)
|
|
478
|
+
}
|
|
343
479
|
break
|
|
344
480
|
}
|
|
345
481
|
|
|
@@ -353,11 +489,19 @@ Commands:
|
|
|
353
489
|
type: patch | minor | major | auto (default: auto)
|
|
354
490
|
--notes: pre-fill the promoted entry with release
|
|
355
491
|
notes generated from conventional commits
|
|
492
|
+
--beta: advance the committed X.Y.Z-beta.N line and
|
|
493
|
+
promote [Unreleased] → [vX.Y.Z-beta.N] in CHANGELOG
|
|
494
|
+
beta Alias for 'apply --beta'
|
|
356
495
|
changelog [version] Promote [Unreleased] → [vX.Y.Z] without bumping
|
|
357
496
|
|
|
358
|
-
Release flow:
|
|
497
|
+
Release flow (stable):
|
|
359
498
|
1. node scripts/versioning.mjs apply [minor]
|
|
360
|
-
2.
|
|
361
|
-
3.
|
|
499
|
+
2. Commit the version inventory and CHANGELOG.
|
|
500
|
+
3. Push after review; CI and the dispatch-only release workflow create the tag.
|
|
501
|
+
|
|
502
|
+
Release flow (beta):
|
|
503
|
+
1. node scripts/versioning.mjs apply --beta (or: node scripts/versioning.mjs beta)
|
|
504
|
+
2. Commit the version inventory and CHANGELOG.
|
|
505
|
+
3. Dispatch the release workflow with release_channel=beta.
|
|
362
506
|
`)
|
|
363
507
|
}
|
package/src/agents/apollo.md
CHANGED
package/src/agents/gaia.md
CHANGED
package/src/agents/mnemosyne.md
CHANGED
package/src/agents/zeus.md
CHANGED
|
@@ -144,33 +144,11 @@ task_status(task_id="ses_xxx", wait=true)
|
|
|
144
144
|
-> bloqueia ate completar: { state: "completed", task_result: "..." }
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
###
|
|
147
|
+
### DELEGATION_RULES (native task API)
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
pantheon_delegate({prompt, agent, description?, read_only?})
|
|
153
|
-
-> cria sessao filha, registra no board, retorna alias: [apo-1]
|
|
154
|
-
pantheon_delegation_read({id: "apo-1"})
|
|
155
|
-
-> BLOQUEIA ate o job terminar, retorna o report markdown, marca reconciled
|
|
156
|
-
-> durante a espera, mostra o que o agente esta fazendo: seccao final "## Agent Activity"
|
|
157
|
-
(amostra as messages do child a cada ~2s; tool calls + args truncados / texto)
|
|
158
|
-
pantheon_delegation_list()
|
|
159
|
-
-> lista jobs da sessao, com [unread] para jobs terminados nao lidos
|
|
160
|
-
-> jobs RUNNING mostram "last activity:" (ultima acao visivel do child)
|
|
161
|
-
-> fail-open: sem suporte a messages, formato atual inalterado
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
- **Read-only enforcement:** agentes read-only (apollo, gaia — `read_only_agents` no routing.yml) tem `edit`, `write`, `bash`, `task` NEGADOS dentro da sessao delegada (o guard de `tool.execute.before` THROW com mensagem acionavel). Use `read_only: true` no delegate para qualquer agente de investigacao.
|
|
165
|
-
- **Depth-2 hard-enforced:** sessao read-only NAO cria subagentes (`task` bloqueado) — investigacao nunca vira arvore.
|
|
166
|
-
- **Compactacao:** jobs em voo (running + unread terminal) sao injetados no contexto de compactacao via `experimental.session.compacting` — delegacao em andamento nao se perde ao compactar.
|
|
167
|
-
|
|
168
|
-
### DELEGATION_RULES (plugin path)
|
|
169
|
-
|
|
170
|
-
1. **NUNCA** polle `pantheon_delegation_list` para checar se um job terminou.
|
|
171
|
-
2. Voce NAO recebe notificacao injetada no chat — politica do usuario: ZERO `task-notification` no transcript. Visibilidade de conclusao: marcador `[unread]` em `pantheon_delegation_list`, `pantheon_delegation_read({id})`, toasts TUI (pantheon-hooks) e carry-forward de compactacao.
|
|
172
|
-
3. Use `pantheon_delegation_read({id})` APENAS para fan-in explicito / recuperacao de resultado sob demanda (bloqueia ate o fim).
|
|
173
|
-
4. `pantheon_delegation_list` e para diagnostico, nao para polling.
|
|
149
|
+
1. Todo dispatch usa `task(background=true, subagent_type=..., prompt=...)`.
|
|
150
|
+
2. Recolha com `task_status(task_id=..., wait=true)` — bloqueia ate o fim, sem polling.
|
|
151
|
+
3. Use `task_status(wait=true)` apenas para fan-in explicito / recuperacao sob demanda.
|
|
174
152
|
|
|
175
153
|
### Background (sempre usar)
|
|
176
154
|
- **Apollo, Hermes, Aphrodite, Demeter, Hephaestus, Prometheus**
|
|
@@ -301,36 +279,15 @@ vão a idle com todos incompletos. Guards (todos no `src/pantheon/todo-enforcer.
|
|
|
301
279
|
|
|
302
280
|
## Wave 4 (PR #46): Empty-Result Retry + /cost + Themis Tier
|
|
303
281
|
|
|
304
|
-
### Empty-Result Retry (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
import { createDispatchGuard } from '.../src/pantheon/dispatch-guard.ts' # via code-mode ou subagente
|
|
311
|
-
|
|
312
|
-
guard = createDispatchGuard({ retryOnEmpty: true, logger: { warn: console.warn } })
|
|
313
|
-
|
|
314
|
-
# classificar resultado de task_status/wait:
|
|
315
|
-
# 'content' → tem texto, pronto
|
|
316
|
-
# 'empty-mode1' → SEM texto E SEM tokens (nada voltou) → RETRY 1x
|
|
317
|
-
# 'empty-mode2' → SEM texto, MAS tokens (raciocinou, perdeu a parte de texto;
|
|
318
|
-
# assinatura da falha themis Wave-2) → RETRY 1x
|
|
319
|
-
|
|
320
|
-
out = await guard.maybeRetry(result, async () => { ...task() de novo... })
|
|
321
|
-
# out.retried=true se redisparou; CAP DURO de 1 retry — nunca 2x.
|
|
322
|
-
# Se o retry voltar vazio, `out.retried=false` — NAO tente de novo: escale.
|
|
323
|
-
```
|
|
324
|
-
Regra: retry 1x APENAS em `empty-mode1`/`empty-mode2`. Resultado com conteudo
|
|
325
|
-
nunca redispara. Apos 1 retry vazio → escalate (mesma regra do TODO Enforcer).
|
|
326
|
-
|
|
327
|
-
> **Waves DEVEM usar `zeusDelegateWithRetry`** (`src/pantheon/zeus-delegate-with-retry.ts`) — encapsula `delegate → waitForTerminal → classify → retry 1x → escalate` com cap duro 1; se ainda vazio throw `ZeusEscalationError` (escale: tente outro agente, simplifique, manual).
|
|
328
|
-
> Uso alto-nível: `import { zeusDelegateWithRetry } from './pantheon/zeus-delegate-with-retry.ts'` → `await zeusDelegateWithRetry({ board, client, sessionID, agent, prompt })`.
|
|
329
|
-
> Uso baixo-nível: `createZeusRetryHelper().executeWithRetry(first, () => secondRead())` — classifica empty e decide retry/escalate (mesmo cap 1).
|
|
282
|
+
### Empty-Result Retry (runtime — automatic)
|
|
283
|
+
Empty-response detection for native `task()` subagent calls is wired at runtime
|
|
284
|
+
in `task-result-guard.ts` (plugin `tool.execute.after` chain): an
|
|
285
|
+
empty/whitespace-only result is converted into an explicit error so a silent
|
|
286
|
+
child failure is never mistaken for success. No manual retry helper is required.
|
|
330
287
|
|
|
331
288
|
### /cost — pantheon_cost tool (WIRED no plugin)
|
|
332
|
-
`pantheon_cost({ days?: number })` le o `opencode.db` READ-ONLY
|
|
333
|
-
|
|
289
|
+
`pantheon_cost({ days?: number })` le o `opencode.db` READ-ONLY usando o backend
|
|
290
|
+
unico `node:sqlite`; se indisponivel, retorna `UNSUPPORTED`, sem fallback. Devolve tabela markdown de custo + tokens por
|
|
334
291
|
agente nos ultimos N dias (default 7). Uso: quando Nyx pedir visibilidade de
|
|
335
292
|
custo, ou antes de escalar tier — decida se o batch valeu o preco.
|
|
336
293
|
|
|
@@ -84,7 +84,9 @@ memory_store({
|
|
|
84
84
|
agreements: ["point1", "point2"],
|
|
85
85
|
divergences: [{"issue": "...", "resolution": "..."}],
|
|
86
86
|
response_rate: "X of Y",
|
|
87
|
-
themis_audit: "approved|issues"
|
|
87
|
+
themis_audit: "approved|issues",
|
|
88
|
+
precedent_used: false,
|
|
89
|
+
timestamp: "<ISO-8601>"
|
|
88
90
|
},
|
|
89
91
|
metadata: {
|
|
90
92
|
type: "council_decision",
|
|
@@ -93,6 +95,7 @@ memory_store({
|
|
|
93
95
|
}
|
|
94
96
|
})
|
|
95
97
|
```
|
|
98
|
+
`value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
|
|
96
99
|
|
|
97
100
|
### Read Path (Precedent Fast-Path)
|
|
98
101
|
Before dispatching a new council, Zeus runs:
|
|
@@ -103,8 +106,8 @@ memory_search(question, top_k=2, namespace="council_decisions")
|
|
|
103
106
|
Result interpretation:
|
|
104
107
|
| Score | Age | Action |
|
|
105
108
|
|-------|-----|--------|
|
|
106
|
-
| > 0.85 | < 30 days | Return precedent as fast-path answer. Skip council dispatch entirely. |
|
|
107
|
-
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou" + proceed with council |
|
|
109
|
+
| > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ Decisão de [data] — reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
|
|
110
|
+
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou — decisão tem mais de 30 dias" + proceed with council |
|
|
108
111
|
| 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
|
|
109
112
|
| < 0.5 | Any | Ignore, proceed with fresh council |
|
|
110
113
|
|
|
@@ -15,7 +15,7 @@ You MUST self-monitor for these stall conditions:
|
|
|
15
15
|
| Symptom | Detection Rule | Recovery Action |
|
|
16
16
|
|---------|---------------|-----------------|
|
|
17
17
|
| Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
|
|
18
|
-
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`,
|
|
18
|
+
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
|
|
19
19
|
| Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
|
|
20
20
|
| Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
|
|
21
21
|
| Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
|
|
@@ -41,9 +41,7 @@ When a delegation fails (timeout, empty response, error):
|
|
|
41
41
|
|
|
42
42
|
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
43
43
|
|
|
44
|
-
3. **If retry also fails** →
|
|
45
|
-
- Dispatch to fallback agent (from routing.yml)
|
|
46
|
-
- If no fallback, escalate to user with: "Task [X] failed after retry. Options: (a) simplify, (b) different agent, (c) manual intervention."
|
|
44
|
+
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
47
45
|
|
|
48
46
|
## Progress Checkpoint
|
|
49
47
|
|
|
@@ -85,10 +85,7 @@ sequenceDiagram
|
|
|
85
85
|
## Dispatch Sequence (9-Step Protocol)
|
|
86
86
|
|
|
87
87
|
### Step 0 — Precedent Fast-Path (Fase 1)
|
|
88
|
-
|
|
89
|
-
- Score > 0.85 AND age < 30 days → return precedent verbatim with note "⚠️ Decisão de [data] — reavaliar se contexto mudou". SKIP entire dispatch.
|
|
90
|
-
- Score > 0.85 AND age > 30 days → return precedent with ⚠️ "Reavaliar se contexto mudou — decisão tem mais de 30 dias"
|
|
91
|
-
- Else → proceed to Step 0b
|
|
88
|
+
Run the precedent read path defined in `## Memory Protocol > Council Decisions Namespace` (`memory_search(query, top_k=2, namespace="council_decisions")`). If no precedent applies, proceed to Step 0b.
|
|
92
89
|
|
|
93
90
|
### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
|
|
94
91
|
If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
|
|
@@ -190,33 +187,11 @@ task(subagent_type: "themis", prompt: "Audit this council synthesis for fidelity
|
|
|
190
187
|
- If issues → fix each issue before delivering to user
|
|
191
188
|
|
|
192
189
|
### Step 9 — Persist & Reconcile (Fase 1)
|
|
193
|
-
|
|
194
|
-
memory_store({
|
|
195
|
-
namespace: "council_decisions",
|
|
196
|
-
key: "council:<yyyy-mm-dd>:<slug>",
|
|
197
|
-
value: JSON.stringify({
|
|
198
|
-
question, specialists, recommendation, confidence,
|
|
199
|
-
agreements, divergences, precedent_used, timestamp
|
|
200
|
-
}),
|
|
201
|
-
metadata: {type: "council_decision", specialist_count: N}
|
|
202
|
-
})
|
|
203
|
-
board.markReconciled("<task-id>")
|
|
204
|
-
```
|
|
190
|
+
Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
|
|
205
191
|
|
|
206
192
|
## Specialist Output Format (Fase 1 — machine-parseable structured fields)
|
|
207
193
|
|
|
208
|
-
Specialists MUST return
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
## specialist_response
|
|
212
|
-
**position:** <clear one-sentence position>
|
|
213
|
-
**reasoning:** <2-4 sentences>
|
|
214
|
-
**trade_offs:** <what's gained vs lost>
|
|
215
|
-
**risks:** <what could go wrong>
|
|
216
|
-
**confidence:** High | Medium | Low
|
|
217
|
-
**agreement_signals:** agree: @agent1, @agent2 on [issue] | disagree: @agent3 on [issue]
|
|
218
|
-
**specific_claims:** <count of specific factual claims in response>
|
|
219
|
-
```
|
|
194
|
+
Specialists MUST return the structured `## specialist_response` format (position, reasoning, trade_offs, risks, confidence, agreement_signals, specific_claims) defined in `## Agent Return Format > Council Specialist Response Format`.
|
|
220
195
|
|
|
221
196
|
## Domain-to-Specialist Mapping
|
|
222
197
|
|