pantheon-opencode 1.5.0-beta.3 → 1.5.0-beta.4

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/src/plugin.ts CHANGED
@@ -46,6 +46,7 @@ import {
46
46
  } from './pantheon/presets.mjs'
47
47
  import { safeSessionPath } from './pantheon/session-guard.ts'
48
48
  import { StepCapTracker } from './pantheon/step-cap.ts'
49
+ import { createTaskResultGuard } from './pantheon/task-result-guard.ts'
49
50
  import {
50
51
  TODO_ENFORCER_DEFAULTS,
51
52
  TodoEnforcer,
@@ -53,6 +54,7 @@ import {
53
54
  todoEnforcerEnabledFromEnv,
54
55
  } from './pantheon/todo-enforcer.ts'
55
56
  import { TodoPreserver } from './pantheon/todo-preserve.ts'
57
+ import { handleToolCeilingEvent, type ToolCeilingResult } from './pantheon/tool-ceiling.ts'
56
58
  import { checkTuiVersionStaleness } from './pantheon/tui-version-check.ts'
57
59
  import { activePresetCandidates, createVisionHandler } from './pantheon/vision.ts'
58
60
 
@@ -165,6 +167,7 @@ const COMPACTION_MAX_ITEMS = 10
165
167
  const rootSessions = new Set<string>()
166
168
  const sessionHierarchy = new SessionHierarchyRegistry()
167
169
  const sessionAgents = new Map<string, string>()
170
+ const sessionToolCeilings = new Map<string, ToolCeilingResult>()
168
171
 
169
172
  /**
170
173
  * Seed resumed root sessions without making OpenCode startup depend on the
@@ -504,13 +507,18 @@ const plugin: Plugin = async (input: PluginInput) => {
504
507
  },
505
508
  }
506
509
  const sandboxHandler = createContextSandbox(sandboxConfig)
510
+ // Task Result Guard (2026-09-10): detect empty task() results from native
511
+ // opencode subagent calls and convert to explicit errors. Runs FIRST in the
512
+ // chain so the error message is visible even if later handlers skip.
513
+ const taskResultGuard = createTaskResultGuard()
507
514
  const combinedAfter: typeof readEnhancer = async (input, output) => {
515
+ await taskResultGuard(input, output)
508
516
  await sandboxHandler(input, output)
509
517
  await readEnhancer(input, output)
510
518
  }
511
519
 
512
520
  // Wave 4 (PR #46): /cost — delegation cost + token visibility. Reads
513
- // opencode.db read-only (node:sqlite, falls back to scripts/cost.mjs).
521
+ // opencode.db read-only via the single node:sqlite backend.
514
522
  // Fully wired (unlike dispatch-guard, which is manual-orchestration-only
515
523
  // because opencode 1.18.x cannot intercept task completion via hooks).
516
524
  const costCommand = createCostCommand()
@@ -615,6 +623,9 @@ const plugin: Plugin = async (input: PluginInput) => {
615
623
  if (ev.type === 'session.compacted') {
616
624
  await todoPreserver.onCompacted(ev.properties.sessionID)
617
625
  }
626
+ if (ev.type === 'message.updated') {
627
+ await handleToolCeilingEvent(input.client, ev, sessionToolCeilings)
628
+ }
618
629
  // Phase 3: observe completion on child sessions → finalizeDelegation.
619
630
  // The board transition fires onTerminal → the file-only audit log (no
620
631
  // chat delivery — see the onTerminal listener above). Unknown sessions
@@ -680,6 +691,13 @@ const plugin: Plugin = async (input: PluginInput) => {
680
691
  list: (sessionID: string) => todoEnforcer.listPendingTodos(sessionID),
681
692
  },
682
693
  })
694
+ const ceiling = sessionToolCeilings.get(_input.sessionID)
695
+ if (ceiling?.status === 'OK') {
696
+ output.context.push(
697
+ `<tool_ceiling remaining_context_tokens="${ceiling.ceiling}">` +
698
+ 'Use the remaining host-reported context budget when selecting tools.</tool_ceiling>',
699
+ )
700
+ }
683
701
  if (blocks.length > 0) {
684
702
  output.context.push(...blocks)
685
703
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "1.5.0-beta.3",
3
+ "version": "1.5.0-beta.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "1.5.0-beta.3",
9
+ "version": "1.5.0-beta.4",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode-ai/plugin": ">=1.14.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "1.5.0-beta.3",
4
+ "version": "1.5.0-beta.4",
5
5
  "description": "Pantheon TUI plugin — sidebar (version, preset, sessions, real-time delegations) + AI subscription usage gauges incl. OpenCode Go/Zen dollar limits (vendored, MIT)",
6
6
  "license": "MIT",
7
7
  "exports": {