@encoredigitalgroup/opencode 0.2.8 → 0.2.10

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.
@@ -33,10 +33,11 @@ interface QuotaExportEntryBase {
33
33
  /** Unix seconds of the next source-backed reset. */
34
34
  resetAt?: number;
35
35
  }
36
- /** One row in the version 3 export document. */
36
+ /** One row in the version 4 export document. */
37
37
  export type QuotaExportEntry = (QuotaExportEntryBase & {
38
38
  renderType: "percent";
39
- percentRemaining: number;
39
+ /** Consumed share of the quota, from 0 to 100. */
40
+ percentUsed: number;
40
41
  }) | (QuotaExportEntryBase & {
41
42
  renderType: "value";
42
43
  value: string;
@@ -85,10 +86,10 @@ export type QuotaExportProvider = ({
85
86
  /** Present for aggregate providers; preserves configured source order. */
86
87
  sources?: QuotaExportSource[];
87
88
  };
88
- /** The version 3 export document, assembled from all configured providers. */
89
+ /** The version 4 export document, assembled from all configured providers. */
89
90
  export interface QuotaExport {
90
91
  /** Schema version. */
91
- version: 3;
92
+ version: 4;
92
93
  /** Unix seconds when this document was assembled. */
93
94
  exportedAt: number;
94
95
  /** True when data was read from disk cache without a live fetch. */
@@ -334,11 +334,11 @@ export declare const SETTINGS_SCHEMA: {
334
334
  readonly kind: "separator";
335
335
  readonly default: " · ";
336
336
  };
337
- /** The words every client uses: "58% left", "58% remaining", "58%", or "42% used". */
337
+ /** Every client shows quota consumed: "42% used". */
338
338
  readonly "words.percent": {
339
339
  readonly kind: "choice";
340
- readonly values: readonly ["left", "remaining", "bare", "used"];
341
- readonly default: "used" | "remaining" | "left" | "bare";
340
+ readonly values: readonly ["used"];
341
+ readonly default: "used";
342
342
  };
343
343
  /** "4.5d" (smart), "2h 14m", "2h14m", "2h", or "2.2h" (with `resetDecimals`). */
344
344
  readonly "words.reset": {
@@ -34,7 +34,7 @@ export type Theme = {
34
34
  };
35
35
  };
36
36
  export declare function namedColor(theme: Theme, name: ColorName): RGBA;
37
- /** The bar color for a percent left: plenty left, getting low, or almost out. */
37
+ /** The bar color for a remaining percent: low, high, or nearly complete usage. */
38
38
  export declare function levelColor(theme: Theme, display: Settings, percent: number): RGBA;
39
39
  /** A role's color. A role set to "bar" takes the level color of the row's percent. */
40
40
  export declare function roleColor(theme: Theme, display: Settings, role: ColorRole, percent?: number): RGBA;
@@ -14,9 +14,9 @@ export declare function formatTokens(count: number): string;
14
14
  export declare function formatShare(share: number): string;
15
15
  /** The words until the server sends its own (docs/v6-build.local.md §5). */
16
16
  export declare const DEFAULT_WORDS: Words;
17
- /** The word after a percent ("left", "used", or "" for the bare style). */
17
+ /** The word after every quota percentage. */
18
18
  export declare function percentWord(words: Words): string;
19
- /** "58% left", "42% used", or "58%" without the word. */
19
+ /** A raw percent remaining displayed as the consumed percentage: "42% used". */
20
20
  export declare function percentText(words: Words, percentRemaining: number, withWord: boolean): string;
21
21
  /**
22
22
  * docs/v6-plan.local.md §4.7. Zero units are dropped in every style; the past is "now".
@@ -26,7 +26,7 @@ export declare function percentText(words: Words, percentRemaining: number, with
26
26
  */
27
27
  export declare function formatDuration(ms: number, style: Words["reset"], decimals: number): string;
28
28
  export type BarShape = Settings["layout"]["bar"];
29
- /** A bar in two parts (used, remaining), so each can have its own color. */
29
+ /** A bar in two parts: consumed quota, then the unfilled portion. */
30
30
  export declare function barParts(shape: BarShape, percentRemaining: number, width: number): [string, string];
31
31
  /**
32
32
  * The cell of a bar `width` cells wide where even use would be (the │ mark): `evenLeft` is the
@@ -38,14 +38,14 @@ export type Thresholds = {
38
38
  warningBelow: number;
39
39
  lowBelow: number;
40
40
  };
41
- /** Plenty left, getting low, or almost out; "almost out" wins where both would. */
41
+ /** Low, high, or nearly complete usage; "nearly complete" wins where both would. */
42
42
  export declare function levelOf(percentRemaining: number, thresholds: Thresholds): Level;
43
43
  /**
44
44
  * "$12.40", "12.40 EUR", "1 request", "1,200 requests", "30 nano". A count unit is one word
45
45
  * ("request"); it is plural for every number but 1, and the plain "unit" is not shown.
46
46
  */
47
47
  export declare function amountText(amount: Amount): string;
48
- /** The value of a row without a percent: its text, amount, used/limit, or yes/no. */
48
+ /** The value of a row without a percent: its text, used amount, used/limit, or yes/no. */
49
49
  export declare function rowValueText(row: QuotaRow): string;
50
50
  /** "12.3K in · 2.10K out". */
51
51
  export declare function sessionTokensText(tokens: SessionTokens): string;
@@ -12,8 +12,8 @@ export type Place = {
12
12
  */
13
13
  names: "words" | "label";
14
14
  /**
15
- * "number": "58%", the place says the word elsewhere. "words": "58% left", "42% used", or
16
- * "58%" in the bare style. "usedWord": "58%", but "42% used", which bare would read as left.
15
+ * "number": "42%", the place says the word elsewhere. "words": "42% used", and "usedWord":
16
+ * "42%" except where the consumed-usage label is needed.
17
17
  */
18
18
  percent: "number" | "words" | "usedWord";
19
19
  /** Reset and pace times in this style, whatever the words (Limits: always "exact"). */
@@ -22,7 +22,7 @@ export type Place = {
22
22
  evenUse?: boolean;
23
23
  /**
24
24
  * The pace words it shows, none without: "runsOut" only "runs out in 2h" (before the reset),
25
- * "fast" also "faster than it refills", "all" also "plenty to spare" and "on track".
25
+ * "fast" also "faster than it refills", "all" also "using less than planned" and "on track".
26
26
  */
27
27
  pace?: "runsOut" | "fast" | "all";
28
28
  };
@@ -30,9 +30,9 @@ export type RowFacts = {
30
30
  /** The row's id, for the lines that show it. */
31
31
  id: string;
32
32
  name: string;
33
- /** Its percent left as the row has it, for bars and level colors; undefined without one. */
33
+ /** Its remaining percent as the row has it, for bars and level colors; undefined without one. */
34
34
  percent?: number;
35
- /** Its percent in the place's style, or the value of a row without one ("$1,240.50 left"). */
35
+ /** Its percent in the place's style, or the value of a row without one ("$1,240.50 used"). */
36
36
  value: string;
37
37
  /** The time until it resets in the place's style ("2h 14m", "3.2d"); "" without a percent. */
38
38
  reset: string;
@@ -63,6 +63,6 @@ export declare function windowFor(windows: Readonly<Record<string, WindowChoice>
63
63
  /**
64
64
  * The one row a group shows in the collapsed sidebar and the status line: the preferred
65
65
  * window's row; with "lowest", or when the group has no row of that window, the row with the
66
- * least left; else the first row.
66
+ * most used; else the first row.
67
67
  */
68
68
  export declare function pickRow(group: Pick<Group, "rows">, choice?: WindowChoice): VisibleRow | undefined;
@@ -11,7 +11,7 @@ import { type Group, type WindowChoice } from "./select.js";
11
11
  export type ColorRole = "title" | "provider" | "account" | "label" | "good" | "warning" | "low" | "empty" | "percent" | "reset" | "value" | "error" | "statusName" | "separator" | "arrows";
12
12
  /**
13
13
  * A piece of a line. `role` "bar" is the filled part of a bar, drawn in its level color.
14
- * `percent` is the row's percent left, for roles that follow the bar color.
14
+ * `percent` is the row's remaining percent, for roles that follow the bar color.
15
15
  */
16
16
  export type Segment = {
17
17
  text: string;
@@ -43,7 +43,7 @@ type SidebarInput = {
43
43
  /** A "runs out in 2h" line under each row that runs out before its reset. */
44
44
  runsOut?: boolean;
45
45
  };
46
- /** §4.1: the expanded panel's title, with the percent's word its rows leave out: "▼ Quota left". */
46
+ /** §4.1: the expanded panel's title, with the rows' consumed-usage word: "▼ Quota used". */
47
47
  export declare function sidebarTitle(words: Words): string;
48
48
  /**
49
49
  * §4.1: the expanded Quota panel, below its title line (`sidebarTitle`). The name column fits
@@ -1741,21 +1741,14 @@ function formatTokens(count) {
1741
1741
  const whole = Math.round(count);
1742
1742
  return whole < 1000 ? String(whole) : COMPACT.format(whole);
1743
1743
  }
1744
- var PERCENT_WORDS = {
1745
- left: "left",
1746
- remaining: "remaining",
1747
- bare: "",
1748
- used: "used"
1749
- };
1750
1744
  function percentWord(words) {
1751
- return PERCENT_WORDS[words.percent];
1745
+ return "used";
1752
1746
  }
1753
1747
  function clampPercent(percent) {
1754
1748
  return Math.max(0, Math.min(100, Math.round(percent)));
1755
1749
  }
1756
1750
  function percentText(words, percentRemaining, withWord) {
1757
- const left = clampPercent(percentRemaining);
1758
- const value = words.percent === "used" ? 100 - left : left;
1751
+ const value = 100 - clampPercent(percentRemaining);
1759
1752
  const word = withWord ? percentWord(words) : "";
1760
1753
  return word ? `${value}% ${word}` : `${value}%`;
1761
1754
  }
@@ -1827,14 +1820,10 @@ function rowValueText(row) {
1827
1820
  return row.text;
1828
1821
  if (row.amount) {
1829
1822
  const amount = amountText(row.amount);
1830
- if (row.type === "balance")
1831
- return `${amount} left`;
1832
1823
  return row.type === "usage" ? `${amount} used` : amount;
1833
1824
  }
1834
- if (row.remaining)
1835
- return `${amountText(row.remaining)} left`;
1836
1825
  if (row.used && row.limit)
1837
- return `${amountText(row.used)}/${amountText(row.limit)}`;
1826
+ return `${amountText(row.used)}/${amountText(row.limit)} used`;
1838
1827
  if (row.used)
1839
1828
  return `${amountText(row.used)} used`;
1840
1829
  if (row.flag !== undefined)
@@ -3847,7 +3836,7 @@ function rowEntry(providerId, providerLabel, row) {
3847
3836
  ...resetAt !== undefined ? { resetAt } : {}
3848
3837
  };
3849
3838
  if (row.percentRemaining !== undefined) {
3850
- return { ...base, renderType: "percent", percentRemaining: row.percentRemaining };
3839
+ return { ...base, renderType: "percent", percentUsed: 100 - row.percentRemaining };
3851
3840
  }
3852
3841
  return {
3853
3842
  ...base,
@@ -3860,7 +3849,7 @@ function exportProvider(provider, answeredAtMs, nowMs) {
3860
3849
  return { status: "unavailable" };
3861
3850
  }
3862
3851
  const fetchedAt = Math.floor(answeredAtMs / 1000);
3863
- const entries = provider.rows.map((row) => rowEntry(provider.providerId, provider.label, row));
3852
+ const entries = provider.rows.filter((row) => row.type !== "balance").map((row) => rowEntry(provider.providerId, provider.label, row));
3864
3853
  if (!provider.error)
3865
3854
  return { status: "ok", fetchedAt, entries };
3866
3855
  const error = sanitizeSingleLineDisplaySnippet(describeError(provider.error, provider.label, nowMs), EXPORT_ERROR_MAX_LENGTH);
@@ -7283,7 +7272,7 @@ var SETTINGS_SCHEMA = {
7283
7272
  "layout.labelWidth": { ...whole(3, 20), default: 8 },
7284
7273
  "layout.providerGap": { ...whole(0, 2), default: 1 },
7285
7274
  "layout.separator": { kind: "separator", default: " \xB7 " },
7286
- "words.percent": choice(["left", "remaining", "bare", "used"], "left"),
7275
+ "words.percent": choice(["used"], "used"),
7287
7276
  "words.reset": choice(["smart", "exact", "compact", "short", "decimal"], "smart"),
7288
7277
  "words.resetDecimals": { ...whole(0, 4), default: 1 },
7289
7278
  "words.rowNames": choice(["short", "full"], "short"),
@@ -7558,7 +7547,8 @@ function settingsFrom(assignments) {
7558
7547
  issues.push({ key, message: "expected an object" });
7559
7548
  continue;
7560
7549
  }
7561
- const checked = checkSetting(key, value);
7550
+ const normalized = key === "words.percent" && ["left", "remaining", "bare", "used"].includes(String(value)) ? "used" : value;
7551
+ const checked = checkSetting(key, normalized);
7562
7552
  issues.push(...checked.issues);
7563
7553
  if (checked.value === undefined)
7564
7554
  continue;
@@ -8846,11 +8836,8 @@ function mapV5Values(values) {
8846
8836
  }
8847
8837
  const percentKeys = ["percentDisplayMode", "percentLabelStyle"].filter(has);
8848
8838
  if (percentKeys.length > 0) {
8849
- const used = chosen("percentDisplayMode", "remaining") === "used";
8850
- const bare = chosen("percentLabelStyle", "full") === "bare";
8851
- const note = used && bare ? 'v6 has no bare "used" percent; it shows "42% used"' : undefined;
8852
8839
  for (const key of percentKeys) {
8853
- toServer(key, "words.percent", used ? "used" : bare ? "bare" : "left", note);
8840
+ toServer(key, "words.percent", "used", "quota percentages now always show consumed usage");
8854
8841
  }
8855
8842
  }
8856
8843
  const resetKeys = ["resetTimeDecimals", "resetTimeSpaced"].filter(has);
package/dist/tui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/tui/index.tsx
3
3
  import { Plugin as Plugin2 } from "@opencode/plugin/tui";
4
- import { fg, StyledText } from "@opentui/core";
4
+ import { fg as fg2, StyledText as StyledText2 } from "@opentui/core";
5
5
 
6
6
  // node_modules/solid-js/dist/solid.js
7
7
  var sharedConfig = {
@@ -5532,7 +5532,7 @@ var SETTINGS_SCHEMA = {
5532
5532
  "layout.labelWidth": { ...whole(3, 20), default: 8 },
5533
5533
  "layout.providerGap": { ...whole(0, 2), default: 1 },
5534
5534
  "layout.separator": { kind: "separator", default: " \xB7 " },
5535
- "words.percent": choice(["left", "remaining", "bare", "used"], "left"),
5535
+ "words.percent": choice(["used"], "used"),
5536
5536
  "words.reset": choice(["smart", "exact", "compact", "short", "decimal"], "smart"),
5537
5537
  "words.resetDecimals": { ...whole(0, 4), default: 1 },
5538
5538
  "words.rowNames": choice(["short", "full"], "short"),
@@ -5807,7 +5807,8 @@ function settingsFrom(assignments) {
5807
5807
  issues.push({ key, message: "expected an object" });
5808
5808
  continue;
5809
5809
  }
5810
- const checked = checkSetting(key, value);
5810
+ const normalized = key === "words.percent" && ["left", "remaining", "bare", "used"].includes(String(value)) ? "used" : value;
5811
+ const checked = checkSetting(key, normalized);
5811
5812
  issues.push(...checked.issues);
5812
5813
  if (checked.value === undefined)
5813
5814
  continue;
@@ -5857,6 +5858,9 @@ function clientSettings({
5857
5858
  return { values, fromFile, providers, custom };
5858
5859
  }
5859
5860
 
5861
+ // src/lib/Quota/tui/sidebar.tsx
5862
+ import { bg, bold, fg, StyledText } from "@opentui/core";
5863
+
5860
5864
  // src/lib/Quota/view/columns.ts
5861
5865
  var GRAPHEMES = new Intl.Segmenter("en", { granularity: "grapheme" });
5862
5866
  var WIDE = /^[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]/u;
@@ -5899,21 +5903,14 @@ function formatTokens(count) {
5899
5903
  const whole = Math.round(count);
5900
5904
  return whole < 1000 ? String(whole) : COMPACT.format(whole);
5901
5905
  }
5902
- var PERCENT_WORDS = {
5903
- left: "left",
5904
- remaining: "remaining",
5905
- bare: "",
5906
- used: "used"
5907
- };
5908
5906
  function percentWord(words) {
5909
- return PERCENT_WORDS[words.percent];
5907
+ return "used";
5910
5908
  }
5911
5909
  function clampPercent(percent) {
5912
5910
  return Math.max(0, Math.min(100, Math.round(percent)));
5913
5911
  }
5914
5912
  function percentText(words, percentRemaining, withWord) {
5915
- const left = clampPercent(percentRemaining);
5916
- const value = words.percent === "used" ? 100 - left : left;
5913
+ const value = 100 - clampPercent(percentRemaining);
5917
5914
  const word = withWord ? percentWord(words) : "";
5918
5915
  return word ? `${value}% ${word}` : `${value}%`;
5919
5916
  }
@@ -5985,14 +5982,10 @@ function rowValueText(row) {
5985
5982
  return row.text;
5986
5983
  if (row.amount) {
5987
5984
  const amount = amountText(row.amount);
5988
- if (row.type === "balance")
5989
- return `${amount} left`;
5990
5985
  return row.type === "usage" ? `${amount} used` : amount;
5991
5986
  }
5992
- if (row.remaining)
5993
- return `${amountText(row.remaining)} left`;
5994
5987
  if (row.used && row.limit)
5995
- return `${amountText(row.used)}/${amountText(row.limit)}`;
5988
+ return `${amountText(row.used)}/${amountText(row.limit)} used`;
5996
5989
  if (row.used)
5997
5990
  return `${amountText(row.used)} used`;
5998
5991
  if (row.flag !== undefined)
@@ -6070,7 +6063,7 @@ function nameOf(item, group, place) {
6070
6063
  }
6071
6064
  function paceWords(pace, times, words) {
6072
6065
  if (pace.kind === "spare")
6073
- return "plenty to spare";
6066
+ return "using less than planned";
6074
6067
  if (pace.kind === "on_track")
6075
6068
  return "on track";
6076
6069
  if (pace.runsOutInMs === undefined)
@@ -6151,7 +6144,7 @@ function visibleGroups(snapshot, settings, surface, words) {
6151
6144
  const providers = ordered(snapshot.providers, (provider) => provider.providerId, shown.providerOrder).filter((provider) => !hidden.has(provider.providerId) && (currentModel === undefined || currentModel.includes(provider.providerId)));
6152
6145
  return providers.flatMap((provider) => {
6153
6146
  const prefixes = rowPrefixes?.[provider.providerId];
6154
- const rows = ordered(provider.rows, (row) => row.id, shown.rowOrder[provider.providerId] ?? []).filter((row) => !hidden.has(row.id)).filter((row) => prefixes === undefined || prefixes.some((prefix) => row.id.startsWith(prefix))).filter((row) => words.detail === "detailed" || row.prominence === "primary").map((row) => visibleRow(row, names));
6147
+ const rows = ordered(provider.rows, (row) => row.id, shown.rowOrder[provider.providerId] ?? []).filter((row) => !hidden.has(row.id)).filter((row) => row.type !== "balance").filter((row) => prefixes === undefined || prefixes.some((prefix) => row.id.startsWith(prefix))).filter((row) => words.detail === "detailed" || row.prominence === "primary").map((row) => visibleRow(row, names));
6155
6148
  return groupsOf(provider, rows, provider.rows.length > 0);
6156
6149
  });
6157
6150
  }
@@ -6505,78 +6498,92 @@ var MARKED_ROLES = new Set([
6505
6498
  "label",
6506
6499
  "statusName"
6507
6500
  ]);
6508
- function LineText(props) {
6509
- const theme = () => props.host.theme();
6510
- const color = (segment) => props.marked && MARKED_ROLES.has(segment.role) ? theme().text.action.primary.selected : segmentColor(theme(), props.host.display(), segment);
6511
- return /* @__PURE__ */ jsxs("text", {
6512
- wrapMode: "none",
6513
- selectable: false,
6514
- flexShrink: 0,
6515
- bg: props.marked ? theme().background.raised.high : undefined,
6516
- children: [
6517
- props.line.segments.length === 0 ? " " : null,
6518
- props.line.segments.map((segment) => /* @__PURE__ */ jsx("span", {
6519
- style: {
6520
- fg: color(segment),
6521
- bold: segment.bold === true
6522
- },
6523
- children: segment.text
6524
- }))
6525
- ]
6526
- });
6501
+ function segmentForeground(theme, settings, segment, marked) {
6502
+ return marked && MARKED_ROLES.has(segment.role) ? theme.text.action.primary.selected : segmentColor(theme, settings, segment);
6503
+ }
6504
+ function styledLine(line, host, marked) {
6505
+ const theme = host.theme();
6506
+ const settings = host.display();
6507
+ return new StyledText(line.segments.flatMap((segment) => {
6508
+ let chunk = fg(segmentForeground(theme, settings, segment, marked))(segment.text);
6509
+ if (segment.bold === true)
6510
+ chunk = bold(chunk);
6511
+ if (marked)
6512
+ chunk = bg(theme.background.raised.high)(chunk);
6513
+ return chunk;
6514
+ }));
6527
6515
  }
6528
6516
  function SidebarPanel(props) {
6529
6517
  const host = props.host;
6530
6518
  const stop = host.quota.watch(props.sessionID);
6531
6519
  onCleanup(stop);
6532
- const [snapshotRevision, setSnapshotRevision] = createSignal(0);
6533
- onCleanup(host.quota.subscribe(() => setSnapshotRevision((revision) => revision + 1)));
6534
- onMount(() => {
6535
- host.quota.refresh("poll", props.sessionID);
6536
- });
6537
6520
  onCleanup(host.editing.sidebarShown());
6538
6521
  const open = () => host.editing.panelOpen() ?? props.open();
6539
- const [width, setWidth] = createSignal(DEFAULT_SIDEBAR_WIDTH);
6540
- const [nowMs, setNowMs] = createSignal(Date.now());
6541
- const clock = setInterval(() => setNowMs(Date.now()), 60000);
6542
- onCleanup(() => clearInterval(clock));
6543
- const display = () => host.display();
6544
- const snapshot = () => {
6545
- snapshotRevision();
6546
- return host.quota.snapshot(props.sessionID);
6547
- };
6548
- const panel = createMemo(() => sidebarPanel(snapshot(), display(), { nowMs: nowMs(), width: width(), open: open() }));
6522
+ let width = DEFAULT_SIDEBAR_WIDTH;
6523
+ let nowMs = Date.now();
6549
6524
  const marked = () => host.editing.marked(open() ? "sidebar" : "collapsed");
6525
+ let heading;
6526
+ let body;
6527
+ const render = () => {
6528
+ const snapshot = host.quota.snapshot(props.sessionID);
6529
+ const panel = sidebarPanel(snapshot, host.display(), { nowMs, width, open: open() });
6530
+ if (heading)
6531
+ heading.content = new StyledText([bold(panel.title)]);
6532
+ if (!body)
6533
+ return;
6534
+ if (!snapshot) {
6535
+ body.content = "Loading quota\u2026";
6536
+ return;
6537
+ }
6538
+ body.content = new StyledText(panel.lines.flatMap((line, index) => [
6539
+ ...styledLine(line, host, line.id !== "" && line.id === marked()).chunks,
6540
+ ...index === panel.lines.length - 1 ? [] : [fg(host.theme().text.base)(`
6541
+ `)]
6542
+ ]));
6543
+ };
6544
+ onCleanup(host.quota.subscribe(render));
6545
+ const clock = setInterval(() => {
6546
+ nowMs = Date.now();
6547
+ render();
6548
+ }, 60000);
6549
+ onCleanup(() => clearInterval(clock));
6550
+ onMount(() => {
6551
+ render();
6552
+ host.quota.refresh("poll", props.sessionID);
6553
+ });
6550
6554
  return /* @__PURE__ */ jsx(Show, {
6551
- when: display().sidebar.show,
6555
+ when: host.display().sidebar.show,
6552
6556
  children: /* @__PURE__ */ jsxs("box", {
6553
6557
  flexDirection: "column",
6554
6558
  onSizeChange: function() {
6555
6559
  const measured = this.width;
6556
6560
  if (measured > 0)
6557
- queueMicrotask(() => setWidth(measured));
6561
+ queueMicrotask(() => {
6562
+ width = measured;
6563
+ render();
6564
+ });
6558
6565
  },
6559
6566
  children: [
6560
6567
  /* @__PURE__ */ jsx("text", {
6561
- fg: roleColor(host.theme(), display(), "title"),
6568
+ ref: (node) => {
6569
+ heading = node;
6570
+ },
6571
+ fg: roleColor(host.theme(), host.display(), "title"),
6562
6572
  wrapMode: "none",
6563
6573
  selectable: false,
6564
- onMouseDown: () => props.setOpen(!open()),
6565
- children: /* @__PURE__ */ jsx("b", {
6566
- children: panel().title
6567
- })
6574
+ onMouseDown: () => {
6575
+ props.setOpen(!open());
6576
+ queueMicrotask(render);
6577
+ },
6578
+ children: "Usage Meter"
6568
6579
  }),
6569
- /* @__PURE__ */ jsx(Show, {
6570
- when: snapshot(),
6571
- fallback: /* @__PURE__ */ jsx("text", {
6572
- fg: host.theme().text.muted,
6573
- children: "Loading quota\u2026"
6574
- }),
6575
- children: panel().lines.map((line) => /* @__PURE__ */ jsx(LineText, {
6576
- line,
6577
- host,
6578
- marked: line.id !== "" && line.id === marked()
6579
- }))
6580
+ /* @__PURE__ */ jsx("text", {
6581
+ ref: (node) => {
6582
+ body = node;
6583
+ },
6584
+ wrapMode: "none",
6585
+ selectable: false,
6586
+ content: "Loading..."
6580
6587
  })
6581
6588
  ]
6582
6589
  })
@@ -6952,8 +6959,8 @@ function TodoSidebar(props) {
6952
6959
  const line = (todo) => `${TodoTracker.marker(todo.status)} (${todo.priority}) ${todo.content}`;
6953
6960
  const plainContent = (items) => items.map(line).join(`
6954
6961
  `);
6955
- const content = (items) => new StyledText(items.flatMap((todo, index) => [
6956
- fg(color(todo.status))(`${line(todo)}${index === items.length - 1 ? "" : `
6962
+ const content = (items) => new StyledText2(items.flatMap((todo, index) => [
6963
+ fg2(color(todo.status))(`${line(todo)}${index === items.length - 1 ? "" : `
6957
6964
  `}`)
6958
6965
  ]));
6959
6966
  let heading;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@encoredigitalgroup/opencode",
3
3
  "type": "module",
4
- "version": "0.2.8",
4
+ "version": "0.2.10",
5
5
  "description": "OpenCode planning pickers, a todo tracker, and a quota sidebar.",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -26,7 +26,7 @@
26
26
  "@opencode/client": "2.1.4",
27
27
  "@opencode/plugin": "2.1.4",
28
28
  "@opentui/core": "0.5.14",
29
- "@types/node": "^22.0.0",
29
+ "@types/node": "^22.20.5",
30
30
  "@types/bun": "1.4.0",
31
31
  "tsfmt": "^0.3.0-beta9",
32
32
  "typescript": "5.8.2"