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.
Files changed (107) hide show
  1. package/.pantheon/code-mode/manifest.json +21 -0
  2. package/AGENTS.md +14 -63
  3. package/CHANGELOG.md +1260 -0
  4. package/README.md +162 -23
  5. package/README.pt-BR.md +104 -19
  6. package/bin/pantheon-init.mjs +178 -21
  7. package/commands/pantheon.md +1 -35
  8. package/package.json +23 -15
  9. package/plugin.json +1 -1
  10. package/pyproject.toml +62 -0
  11. package/scripts/code_mode_server.py +431 -55
  12. package/scripts/doctor.mjs +207 -9
  13. package/scripts/install/cli-ui.mjs +17 -11
  14. package/scripts/install/config-migration.mjs +4 -6
  15. package/scripts/install/opencode.mjs +137 -35
  16. package/scripts/install/plugin.mjs +12 -45
  17. package/scripts/install/shared.mjs +43 -2
  18. package/scripts/install/strings.mjs +129 -0
  19. package/scripts/install-mcp.mjs +1 -0
  20. package/scripts/manifest-inventory.mjs +410 -0
  21. package/scripts/mcp_persistence_server.py +536 -164
  22. package/scripts/package-evidence.mjs +242 -0
  23. package/scripts/probe-pantheon-cost.mjs +10 -1
  24. package/scripts/release-beta-version.mjs +56 -60
  25. package/scripts/sync-artifacts.mjs +169 -0
  26. package/scripts/sync-tui.mjs +129 -64
  27. package/scripts/test-opencode-v1-v2-sandbox.sh +79 -161
  28. package/scripts/validation-policy.mjs +7 -7
  29. package/scripts/version-check.mjs +113 -108
  30. package/scripts/versioning.mjs +230 -86
  31. package/src/agents/apollo.md +1 -0
  32. package/src/agents/gaia.md +1 -0
  33. package/src/agents/mnemosyne.md +1 -1
  34. package/src/agents/zeus.md +11 -54
  35. package/src/instructions/memory-protocol.instructions.md +6 -3
  36. package/src/instructions/zeus-anti-stall.instructions.md +2 -4
  37. package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
  38. package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
  39. package/src/mcp/code_mode_server.py +431 -55
  40. package/src/mcp/mcp_persistence_server.py +536 -164
  41. package/src/mcp/toon_codec.py +2 -4
  42. package/src/pantheon/background-job-board.ts +47 -5
  43. package/src/pantheon/{delegation-compaction.ts → compaction-context.ts} +10 -100
  44. package/src/pantheon/cost-command.ts +309 -44
  45. package/src/pantheon/delegation-enforce.ts +59 -14
  46. package/src/pantheon/file-persistence-salvage.ts +64 -0
  47. package/src/pantheon/file-persistence.ts +194 -45
  48. package/src/pantheon/goal-loop.ts +1 -1
  49. package/src/pantheon/goal-store.ts +1 -1
  50. package/src/pantheon/idle-continuation.ts +4 -6
  51. package/src/pantheon/model-command.ts +1 -2
  52. package/src/pantheon/native-task-status.ts +139 -0
  53. package/src/pantheon/presets.d.mts +0 -20
  54. package/src/pantheon/presets.mjs +0 -64
  55. package/src/pantheon/session-guard.ts +2 -2
  56. package/src/pantheon/session-id.ts +30 -0
  57. package/src/pantheon/shared-board.ts +37 -0
  58. package/src/pantheon/task-result-guard.ts +106 -0
  59. package/src/pantheon/todo-enforcer.ts +3 -3
  60. package/src/pantheon/tool-ceiling.ts +159 -0
  61. package/src/pantheon/tool-context.ts +23 -0
  62. package/src/pantheon/v2-bridge.ts +1 -4
  63. package/src/plugin-v2.ts +8 -21
  64. package/src/plugin.ts +83 -251
  65. package/src/plugins/pantheon-hooks.ts +51 -0
  66. package/src/plugins/tui/dist/server.d.ts +1 -1
  67. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  68. package/src/plugins/tui/dist/server.js +1 -1
  69. package/src/plugins/tui/dist/server.js.map +1 -1
  70. package/src/plugins/tui/dist/tui.d.ts +261 -77
  71. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  72. package/src/plugins/tui/dist/tui.js +640 -234
  73. package/src/plugins/tui/dist/tui.js.map +1 -1
  74. package/src/plugins/tui/package-lock.json +2 -2
  75. package/src/plugins/tui/package.json +2 -2
  76. package/src/plugins/tui/src/index.tsx +872 -226
  77. package/src/routing.yml +0 -16
  78. package/src/skills/context-compression/SKILL.md +1 -1
  79. package/scripts/generate-preset-docs.mjs +0 -300
  80. package/scripts/generate-prompts.sh +0 -222
  81. package/scripts/hash_verify.py +0 -192
  82. package/scripts/install/component.mjs +0 -24
  83. package/scripts/install/migrate-config.mjs +0 -302
  84. package/scripts/test-context-compression.sh +0 -169
  85. package/src/pantheon/auto-wake.ts +0 -89
  86. package/src/pantheon/chat-reminders.ts +0 -9
  87. package/src/pantheon/comment-checker.ts +0 -48
  88. package/src/pantheon/compaction-assert.ts +0 -160
  89. package/src/pantheon/cost-tracker.ts +0 -108
  90. package/src/pantheon/delegate-manager.ts +0 -669
  91. package/src/pantheon/delegation-classifier.ts +0 -307
  92. package/src/pantheon/delegation-finalize.ts +0 -374
  93. package/src/pantheon/delegation-notify.ts +0 -212
  94. package/src/pantheon/delegation-toast.ts +0 -73
  95. package/src/pantheon/delegation.ts +0 -1120
  96. package/src/pantheon/dispatch-guard.ts +0 -109
  97. package/src/pantheon/permission-eval.ts +0 -284
  98. package/src/pantheon/preemptive-compact.ts +0 -76
  99. package/src/pantheon/retry-policy.ts +0 -212
  100. package/src/pantheon/step-cap.ts +0 -110
  101. package/src/pantheon/token-opt.ts +0 -781
  102. package/src/pantheon/toon-codec.ts +0 -481
  103. package/src/pantheon/v2-events.ts +0 -131
  104. package/src/pantheon/v2-hooks.ts +0 -287
  105. package/src/pantheon/v2-tool-definitions.ts +0 -331
  106. package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
  107. package/src/plugins/tui/dist/tui.tsx +0 -2605
@@ -1,110 +0,0 @@
1
- /**
2
- * R4 — Per-agent step caps (max_steps).
3
- *
4
- * Pure library. routing.yml `agents.<name>.max_steps` gives each agent a
5
- * step budget (e.g. explore: 25, reviewer: 25, oracle: 15). When an agent's
6
- * step count reaches max_steps it is forced to summarize-and-stop: the
7
- * delegation is either skipped with a capped summary (already at cap) or
8
- * the prompt is appended with a stop instruction (cap hit mid-dispatch).
9
- *
10
- * The tracker is PERMANENT-PER-PROCESS: counters accumulate for the process
11
- * lifetime and are intentionally NOT reset on successful delegations or
12
- * session end — a per-session reset would let an agent exceed its process
13
- * budget over a long session. `reset()` exists as a tested utility for
14
- * tests and future explicit reset points; no production caller wires it.
15
- *
16
- * @module step-cap
17
- */
18
-
19
- // ─── Types ─────────────────────────────────────────────────────────────
20
-
21
- /** Default step budget when routing.yml omits max_steps for an agent. */
22
- export const DEFAULT_MAX_STEPS = 25
23
-
24
- // ─── Stop instruction ──────────────────────────────────────────────────
25
-
26
- /**
27
- * The forced summarize-and-stop instruction injected into a prompt when an
28
- * agent's step count reaches max_steps.
29
- */
30
- export function buildStopInstruction(agent: string, maxSteps: number): string {
31
- return (
32
- `\n\n[STEP CAP REACHED — ${agent} at ${maxSteps} steps] ` +
33
- `You have reached the maximum step budget for this delegation. ` +
34
- `STOP working immediately and summarize what was accomplished (and ` +
35
- `what remains, if any) as your final message. Do not start new work.`
36
- )
37
- }
38
-
39
- /**
40
- * The text returned when a delegation is skipped because the agent is
41
- * already at its step cap — marks the delegation as capped and asks for a
42
- * summary of prior results instead of starting new work.
43
- */
44
- export function cappedSummary(agent: string, maxSteps: number): string {
45
- return (
46
- `[STEP CAP REACHED] ${agent} has reached its max_steps budget (${maxSteps}). ` +
47
- `Delegation skipped — no new work was started. ` +
48
- `Summarize prior results and stop.`
49
- )
50
- }
51
-
52
- // ─── Tracker ───────────────────────────────────────────────────────────
53
-
54
- /**
55
- * Per-agent step counters with a max_steps budget. Keyed by lowercase agent
56
- * name (matching is case-insensitive). Agents without a configured budget
57
- * are never capped.
58
- */
59
- export class StepCapTracker {
60
- private readonly steps = new Map<string, number>()
61
- readonly maxStepsByAgent: Readonly<Record<string, number>>
62
-
63
- constructor(maxStepsByAgent: Readonly<Record<string, number>> = {}) {
64
- this.maxStepsByAgent = maxStepsByAgent
65
- }
66
-
67
- /** The configured budget for an agent, or undefined when uncapped. */
68
- maxStepsFor(agent: string): number | undefined {
69
- return this.maxStepsByAgent[agent.toLowerCase()]
70
- }
71
-
72
- /** Current step count for an agent. */
73
- stepCount(agent: string): number {
74
- return this.steps.get(agent.toLowerCase()) ?? 0
75
- }
76
-
77
- /** Whether the agent has reached (or exceeded) its max_steps budget. */
78
- isCapped(agent: string): boolean {
79
- const max = this.maxStepsFor(agent)
80
- if (max === undefined) return false
81
- return this.stepCount(agent) >= max
82
- }
83
-
84
- /**
85
- * Record one step for an agent. Returns the new count and whether this
86
- * step hit the cap (capped === true exactly when steps >= maxSteps).
87
- */
88
- recordStep(agent: string): {
89
- steps: number
90
- capped: boolean
91
- maxSteps: number | undefined
92
- } {
93
- const key = agent.toLowerCase()
94
- const max = this.maxStepsFor(agent)
95
- const steps = (this.steps.get(key) ?? 0) + 1
96
- this.steps.set(key, steps)
97
- return { steps, capped: max !== undefined && steps >= max, maxSteps: max }
98
- }
99
-
100
- /**
101
- * Reset an agent's step count.
102
- *
103
- * Intentionally NOT wired in production: the tracker is permanent-per-
104
- * process (see module docstring) so agents cannot exceed their process
105
- * budget via resets. Exists for tests and future explicit reset points.
106
- */
107
- reset(agent: string): void {
108
- this.steps.delete(agent.toLowerCase())
109
- }
110
- }