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.
Files changed (82) hide show
  1. package/AGENTS.md +14 -63
  2. package/CHANGELOG.md +320 -0
  3. package/README.md +14 -27
  4. package/README.pt-BR.md +5 -6
  5. package/commands/pantheon.md +1 -35
  6. package/package.json +1 -2
  7. package/plugin.json +1 -1
  8. package/pyproject.toml +2 -5
  9. package/scripts/doctor.mjs +32 -3
  10. package/scripts/install/plugin.mjs +9 -12
  11. package/scripts/mcp_persistence_server.py +1 -1
  12. package/scripts/sync-tui.mjs +8 -11
  13. package/src/agents/apollo.md +1 -0
  14. package/src/agents/gaia.md +1 -0
  15. package/src/agents/zeus.md +9 -52
  16. package/src/instructions/memory-protocol.instructions.md +6 -3
  17. package/src/instructions/zeus-anti-stall.instructions.md +2 -4
  18. package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
  19. package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
  20. package/src/mcp/mcp_persistence_server.py +1 -1
  21. package/src/mcp/toon_codec.py +2 -4
  22. package/src/pantheon/background-job-board.ts +4 -4
  23. package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
  24. package/src/pantheon/cost-command.ts +1 -2
  25. package/src/pantheon/delegation-enforce.ts +59 -14
  26. package/src/pantheon/goal-loop.ts +1 -1
  27. package/src/pantheon/goal-store.ts +1 -1
  28. package/src/pantheon/idle-continuation.ts +4 -6
  29. package/src/pantheon/model-command.ts +1 -2
  30. package/src/pantheon/native-task-status.ts +2 -2
  31. package/src/pantheon/presets.d.mts +0 -20
  32. package/src/pantheon/presets.mjs +0 -64
  33. package/src/pantheon/session-guard.ts +2 -2
  34. package/src/pantheon/session-id.ts +30 -0
  35. package/src/pantheon/task-result-guard.ts +2 -3
  36. package/src/pantheon/todo-enforcer.ts +3 -3
  37. package/src/pantheon/tool-context.ts +23 -0
  38. package/src/pantheon/v2-bridge.ts +1 -4
  39. package/src/plugin-v2.ts +8 -21
  40. package/src/plugin.ts +61 -245
  41. package/src/plugins/pantheon-hooks.ts +1 -1
  42. package/src/plugins/tui/dist/tui.d.ts +229 -77
  43. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  44. package/src/plugins/tui/dist/tui.js +509 -259
  45. package/src/plugins/tui/package-lock.json +2 -2
  46. package/src/plugins/tui/package.json +2 -2
  47. package/src/plugins/tui/src/index.tsx +753 -279
  48. package/src/routing.yml +0 -16
  49. package/src/skills/context-compression/SKILL.md +1 -1
  50. package/scripts/generate-preset-docs.mjs +0 -300
  51. package/scripts/generate-prompts.sh +0 -222
  52. package/scripts/hash_verify.py +0 -192
  53. package/scripts/install/component.mjs +0 -24
  54. package/scripts/install/migrate-config.mjs +0 -302
  55. package/scripts/test-context-compression.sh +0 -169
  56. package/src/pantheon/auto-wake.ts +0 -85
  57. package/src/pantheon/chat-reminders.ts +0 -9
  58. package/src/pantheon/comment-checker.ts +0 -48
  59. package/src/pantheon/compaction-assert.ts +0 -160
  60. package/src/pantheon/compaction-handoff.ts +0 -304
  61. package/src/pantheon/cost-tracker.ts +0 -108
  62. package/src/pantheon/delegate-manager.ts +0 -766
  63. package/src/pantheon/delegation-classifier.ts +0 -307
  64. package/src/pantheon/delegation-finalize.ts +0 -406
  65. package/src/pantheon/delegation-notify.ts +0 -212
  66. package/src/pantheon/delegation-toast.ts +0 -73
  67. package/src/pantheon/delegation.ts +0 -1337
  68. package/src/pantheon/dispatch-guard.ts +0 -109
  69. package/src/pantheon/native-probe.ts +0 -234
  70. package/src/pantheon/permission-eval.ts +0 -284
  71. package/src/pantheon/preemptive-compact.ts +0 -76
  72. package/src/pantheon/provider-capabilities.ts +0 -221
  73. package/src/pantheon/provider-stream-tracker.ts +0 -182
  74. package/src/pantheon/retry-policy.ts +0 -212
  75. package/src/pantheon/step-cap.ts +0 -110
  76. package/src/pantheon/token-opt.ts +0 -689
  77. package/src/pantheon/toon-codec.ts +0 -481
  78. package/src/pantheon/v2-events.ts +0 -148
  79. package/src/pantheon/v2-hooks.ts +0 -287
  80. package/src/pantheon/v2-tool-definitions.ts +0 -331
  81. package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
  82. 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
- }