opencode-context-indicator 1.8.0 → 1.8.2

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/tui.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  // This file is the ENTRY + setup wiring only. The components and the data layer
12
12
  // live in lib/:
13
13
  // - lib/tui-sidebar.ts the `sidebar.content` slot component
14
+ // - lib/tui-composer.ts the `prompt.footer.status` usage capsule
14
15
  // - lib/tui-panel.ts the `session.panel` component (BreakdownPanel)
15
16
  // - lib/tui-h.ts the jsx()/component() builders (only jsx-runtime user)
16
17
  // - lib/tui-data.js state.json bridge, family walk, formatting helpers
@@ -51,6 +52,7 @@ import { POLL_MS, readSnapshot } from "./lib/tui-data.js"
51
52
  import { c as comp, h } from "./lib/tui-h.ts"
52
53
  import { Sidebar } from "./lib/tui-sidebar.ts"
53
54
  import { BreakdownPanel } from "./lib/tui-panel.ts"
55
+ import { ComposerStatus } from "./lib/tui-composer.ts"
54
56
 
55
57
  // Session-panel contribution name. Session-panel names are shared selection
56
58
  // values (not registered claims), so it MUST be plugin-prefixed to avoid
@@ -198,6 +200,26 @@ export default Plugin.define({
198
200
  }),
199
201
  )
200
202
 
203
+ // Always-on usage capsule inside the composer (`prompt.footer.status`,
204
+ // opencode 2.2.x): the percentage stays visible while the sidebar is
205
+ // collapsed and without opening the full-screen `/cx` panel. The slot input
206
+ // also carries `mode` (the pill is hidden in a shell prompt) and
207
+ // `showDetails` (the host's own compact/detailed toggle).
208
+ const unregisterComposer = registerSlot("prompt.footer.status", () =>
209
+ context.ui.slot({
210
+ append: "prompt.footer.status",
211
+ render: (input) => {
212
+ if (input?.sessionID) currentSession = input.sessionID
213
+ noteLive?.("slot-render prompt.footer.status")
214
+ return comp(ComposerStatus, {
215
+ entry,
216
+ mode: () => input?.mode ?? "normal",
217
+ showDetails: () => Boolean(input?.showDetails),
218
+ })
219
+ },
220
+ }),
221
+ )
222
+
201
223
  // The probe is ALSO mounted in the `app` slot, which the host renders even
202
224
  // when no session/sidebar is on screen (a standalone instance with no prompt
203
225
  // has no sidebar.content contribution to mount). Whichever slot mounts
@@ -277,7 +299,7 @@ export default Plugin.define({
277
299
  // loaded but REGISTERED its surfaces — a host-transform failure of this
278
300
  // file would otherwise die silently between "loading plugin" and here.
279
301
  console.log(
280
- "[context-indicator] live TUI surfaces registered (sidebar + session.panel + keymap)",
302
+ "[context-indicator] live TUI surfaces registered (sidebar + composer + session.panel + keymap)",
281
303
  )
282
304
 
283
305
  // E2E instrumentation (only when test/e2e-tui.mjs sets the marker env):
@@ -302,6 +324,7 @@ export default Plugin.define({
302
324
  if (probeTimer) clearInterval(probeTimer)
303
325
  for (const unregister of [
304
326
  unregisterSidebar,
327
+ unregisterComposer,
305
328
  unregisterProbe,
306
329
  unregisterPanel,
307
330
  unregisterCommands,