pantheon-opencode 1.5.0-beta.8 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +14 -63
- package/CHANGELOG.md +320 -0
- package/README.md +14 -27
- package/README.pt-BR.md +5 -6
- package/commands/pantheon.md +1 -35
- package/package.json +1 -2
- package/plugin.json +1 -1
- package/pyproject.toml +2 -5
- package/scripts/doctor.mjs +32 -3
- package/scripts/install/plugin.mjs +9 -12
- package/scripts/mcp_persistence_server.py +1 -1
- package/scripts/sync-tui.mjs +8 -11
- package/src/agents/apollo.md +1 -0
- package/src/agents/gaia.md +1 -0
- package/src/agents/zeus.md +9 -52
- 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/mcp_persistence_server.py +1 -1
- package/src/mcp/toon_codec.py +2 -4
- package/src/pantheon/background-job-board.ts +4 -4
- package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
- package/src/pantheon/cost-command.ts +1 -2
- package/src/pantheon/delegation-enforce.ts +59 -14
- 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 +2 -2
- 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/task-result-guard.ts +2 -3
- package/src/pantheon/todo-enforcer.ts +3 -3
- 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 +61 -245
- package/src/plugins/pantheon-hooks.ts +1 -1
- package/src/plugins/tui/dist/tui.d.ts +229 -77
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +509 -259
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +2 -2
- package/src/plugins/tui/src/index.tsx +753 -279
- 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 -85
- 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/compaction-handoff.ts +0 -304
- package/src/pantheon/cost-tracker.ts +0 -108
- package/src/pantheon/delegate-manager.ts +0 -766
- package/src/pantheon/delegation-classifier.ts +0 -307
- package/src/pantheon/delegation-finalize.ts +0 -406
- package/src/pantheon/delegation-notify.ts +0 -212
- package/src/pantheon/delegation-toast.ts +0 -73
- package/src/pantheon/delegation.ts +0 -1337
- package/src/pantheon/dispatch-guard.ts +0 -109
- package/src/pantheon/native-probe.ts +0 -234
- package/src/pantheon/permission-eval.ts +0 -284
- package/src/pantheon/preemptive-compact.ts +0 -76
- package/src/pantheon/provider-capabilities.ts +0 -221
- package/src/pantheon/provider-stream-tracker.ts +0 -182
- package/src/pantheon/retry-policy.ts +0 -212
- package/src/pantheon/step-cap.ts +0 -110
- package/src/pantheon/token-opt.ts +0 -689
- package/src/pantheon/toon-codec.ts +0 -481
- package/src/pantheon/v2-events.ts +0 -148
- 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 -2777
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cost Tracker (Wave 4, PR #46) — JSONL cost ledger for background
|
|
3
|
-
* delegations. Every delegation that finishes (or times out) records one
|
|
4
|
-
* line; the ledger lives at `.pantheon/costs/delegations.jsonl` and gives
|
|
5
|
-
* Nyx / the /cost command a durable, human-readable cost history.
|
|
6
|
-
*
|
|
7
|
-
* record() APPENDS (appendFile + parent dir auto-create), never rewrites.
|
|
8
|
-
* A missing ledger is an EMPTY ledger — list() → [], summary() → zeros,
|
|
9
|
-
* no crash. Injectable clock not needed: timestamp is caller-provided
|
|
10
|
-
* (ISO 8601), matching the delegation toolset's timestamping style.
|
|
11
|
-
*
|
|
12
|
-
* @module cost-tracker
|
|
13
|
-
*/
|
|
14
|
-
import { appendFile, mkdir, readFile } from 'node:fs/promises'
|
|
15
|
-
import { dirname } from 'node:path'
|
|
16
|
-
|
|
17
|
-
/** One delegation cost event. */
|
|
18
|
-
export interface CostRecord {
|
|
19
|
-
/** Board task ID (e.g. "ses_child_1" or the job alias "apo-1"). */
|
|
20
|
-
taskId: string
|
|
21
|
-
/** Session that owns the delegation — list(sessionID?) filters on this. */
|
|
22
|
-
sessionID?: string
|
|
23
|
-
/** Delegated agent name (e.g. "hermes"). */
|
|
24
|
-
agent: string
|
|
25
|
-
/** Model ID actually used (e.g. "opencode/deepseek-v4-flash"). */
|
|
26
|
-
model: string
|
|
27
|
-
tokensInput: number
|
|
28
|
-
tokensOutput: number
|
|
29
|
-
/** Cost in USD (already computed by the caller). */
|
|
30
|
-
costUsd: number
|
|
31
|
-
/** ISO 8601 timestamp of the record. */
|
|
32
|
-
timestamp: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Aggregate across the whole ledger. */
|
|
36
|
-
export interface CostSummary {
|
|
37
|
-
count: number
|
|
38
|
-
totalCostUsd: number
|
|
39
|
-
totalTokensInput: number
|
|
40
|
-
totalTokensOutput: number
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CostTrackerOptions {
|
|
44
|
-
/** Ledger path. Default: ".pantheon/costs/delegations.jsonl". */
|
|
45
|
-
filePath?: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface CostTracker {
|
|
49
|
-
/** Append one record to the ledger (creates the parent dir on first write). */
|
|
50
|
-
record(entry: CostRecord): Promise<void>
|
|
51
|
-
/** All records, optionally filtered by sessionID. Missing file → []. */
|
|
52
|
-
list(sessionID?: string): Promise<CostRecord[]>
|
|
53
|
-
/** Aggregate totals across the whole ledger. Missing file → zeros. */
|
|
54
|
-
summary(): Promise<CostSummary>
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Parse the ledger file; missing file → empty array (never throws). */
|
|
58
|
-
async function readLedger(filePath: string): Promise<CostRecord[]> {
|
|
59
|
-
let raw: string
|
|
60
|
-
try {
|
|
61
|
-
raw = await readFile(filePath, 'utf8')
|
|
62
|
-
} catch {
|
|
63
|
-
return []
|
|
64
|
-
}
|
|
65
|
-
const records: CostRecord[] = []
|
|
66
|
-
for (const line of raw.split('\n')) {
|
|
67
|
-
if (line.trim() === '') continue
|
|
68
|
-
try {
|
|
69
|
-
records.push(JSON.parse(line) as CostRecord)
|
|
70
|
-
} catch {
|
|
71
|
-
// Skip malformed lines — a partial ledger never breaks the reader.
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return records
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function createCostTracker(options?: CostTrackerOptions): CostTracker {
|
|
78
|
-
const filePath = options?.filePath ?? '.pantheon/costs/delegations.jsonl'
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
async record(entry: CostRecord): Promise<void> {
|
|
82
|
-
await mkdir(dirname(filePath), { recursive: true })
|
|
83
|
-
await appendFile(filePath, `${JSON.stringify(entry)}\n`, 'utf8')
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
async list(sessionID?: string): Promise<CostRecord[]> {
|
|
87
|
-
const records = await readLedger(filePath)
|
|
88
|
-
if (sessionID === undefined) return records
|
|
89
|
-
return records.filter((r) => r.sessionID === sessionID)
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
async summary(): Promise<CostSummary> {
|
|
93
|
-
const records = await readLedger(filePath)
|
|
94
|
-
const summary: CostSummary = {
|
|
95
|
-
count: records.length,
|
|
96
|
-
totalCostUsd: 0,
|
|
97
|
-
totalTokensInput: 0,
|
|
98
|
-
totalTokensOutput: 0,
|
|
99
|
-
}
|
|
100
|
-
for (const r of records) {
|
|
101
|
-
summary.totalCostUsd += r.costUsd
|
|
102
|
-
summary.totalTokensInput += r.tokensInput
|
|
103
|
-
summary.totalTokensOutput += r.tokensOutput
|
|
104
|
-
}
|
|
105
|
-
return summary
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
}
|