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,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
- }