pantheon-opencode 1.6.3-beta.1 → 1.6.3-beta.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.
Files changed (36) hide show
  1. package/AGENTS.global.md +1 -1
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +57 -0
  4. package/README.md +14 -2
  5. package/package.json +1 -1
  6. package/plugin.json +1 -1
  7. package/pyproject.toml +1 -1
  8. package/scripts/decision-router-budget.mjs +1 -2
  9. package/scripts/decision-router-v2-egress.mjs +0 -2
  10. package/scripts/decision-router.mjs +26 -1
  11. package/scripts/install/decision-router-config.mjs +45 -2
  12. package/scripts/install/interactive.mjs +78 -10
  13. package/scripts/install/opencode.mjs +20 -0
  14. package/scripts/install/plugin.mjs +17 -0
  15. package/scripts/jev-live-probe.mjs +184 -0
  16. package/scripts/sync-tui.mjs +11 -0
  17. package/src/agents/zeus.md +24 -0
  18. package/src/pantheon/j-telemetry-file.ts +96 -0
  19. package/src/pantheon/jev-decision-tool.ts +151 -24
  20. package/src/pantheon/jev-decisions.ts +18 -3
  21. package/src/pantheon/jev-rank-verify.ts +435 -0
  22. package/src/pantheon/local-decision-budget.ts +1 -3
  23. package/src/pantheon/local-decision-provider-matrix.ts +0 -1
  24. package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
  25. package/src/plugin-v2.ts +9 -2
  26. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  27. package/src/plugins/tui/dist/tui-v2.js +457 -4
  28. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  29. package/src/plugins/tui/dist/tui.js +1 -1
  30. package/src/plugins/tui/package-lock.json +2 -2
  31. package/src/plugins/tui/package.json +1 -1
  32. package/src/plugins/tui/src/index-v2.tsx +6 -0
  33. package/src/plugins/tui/src/whats-new-highlights.ts +263 -0
  34. package/src/plugins/tui/src/whats-new-open.ts +80 -0
  35. package/src/plugins/tui/src/whats-new-state.ts +128 -0
  36. package/src/plugins/tui/src/whats-new.tsx +119 -0
@@ -1,7 +1,8 @@
1
1
  import { createComponent, createElement, createTextNode, effect, insert, insertNode, memo, setProp } from "@opentui/solid";
2
- import { readFile } from "node:fs/promises";
2
+ import { mkdir, readFile, rename, stat, unlink, writeFile } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
- import { join } from "node:path";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
5
6
  import { For, Show, createEffect, createMemo, createSignal, on, onCleanup, onMount } from "solid-js";
6
7
  import { execFile } from "node:child_process";
7
8
  import { Plugin } from "@opencode/plugin/tui";
@@ -179,6 +180,457 @@ function cellWidth(value) {
179
180
  for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment);
180
181
  return width;
181
182
  }
183
+ /** Prefix of the "+N more" line appended when the bullet budget is exceeded. */
184
+ const WHATS_NEW_MORE_PREFIX = "… +";
185
+ const EMPTY_HIGHLIGHTS = {
186
+ version: null,
187
+ found: false,
188
+ groups: [],
189
+ totalItems: 0,
190
+ truncated: false
191
+ };
192
+ /** Escape regex metacharacters so a version like 1.0.0 matches literally. */
193
+ function escapeRegExp(text) {
194
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
195
+ }
196
+ /**
197
+ * Extract the body of a version section from changelog text — inline replica
198
+ * of scripts/changelog-extract.mjs `extractSection` (see that file for the
199
+ * full contract: `## [<version>] - YYYY-MM-DD`, leading `v` and the date
200
+ * optional, `## [Unreleased]` never matched).
201
+ */
202
+ function extractSection(changelogText, version) {
203
+ const normalized = String(version).trim().replace(/^v/i, "");
204
+ if (!normalized || /^unreleased$/i.test(normalized)) return {
205
+ found: false,
206
+ body: null
207
+ };
208
+ const escaped = escapeRegExp(normalized);
209
+ const match = new RegExp(`^##[ \\t]+\\[v?${escaped}\\](?:[ \\t]*-[ \\t]*\\d{4}-\\d{2}-\\d{2})?(?=[ \\t]|$)`, "m").exec(changelogText);
210
+ if (!match) return {
211
+ found: false,
212
+ body: null
213
+ };
214
+ const newline = changelogText.indexOf("\n", match.index);
215
+ const start = newline === -1 ? changelogText.length : newline + 1;
216
+ const nextHeading = /^##[ \t]+\[/m.exec(changelogText.slice(start));
217
+ const end = nextHeading ? start + nextHeading.index : changelogText.length;
218
+ return {
219
+ found: true,
220
+ body: changelogText.slice(start, end).trim()
221
+ };
222
+ }
223
+ /**
224
+ * Reduce one markdown line to plain text: links keep their label, emphasis
225
+ * and inline-code markers are dropped, HTML comment fragments are removed,
226
+ * and whitespace collapses. Deliberately simple — the input is our own
227
+ * CHANGELOG (lint-capped at 200 chars per bullet), not hostile input.
228
+ */
229
+ function stripMarkdown(text) {
230
+ return text.replace(/<!--[\s\S]*?-->/g, " ").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/(\*\*|__)/g, "").replace(/`/g, "").replace(/\s+/g, " ").trim();
231
+ }
232
+ /** Strip the leading H3 marker (`### Added` → `Added`). */
233
+ function stripHeading(text) {
234
+ return text.replace(/^#{1,6}[ \t]+/, "").trim();
235
+ }
236
+ /**
237
+ * Extract the release highlights for `version`: H3 subsection headings as
238
+ * group labels and their bullets as sanitized plain text, bounded to
239
+ * WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a
240
+ * blank changelog all return EMPTY_HIGHLIGHTS (no window).
241
+ */
242
+ function extractHighlights(changelogText, version) {
243
+ const { found, body } = extractSection(changelogText ?? "", version ?? "");
244
+ if (!found || !body) return { ...EMPTY_HIGHLIGHTS };
245
+ const groups = [];
246
+ let totalItems = 0;
247
+ let truncated = false;
248
+ for (const rawLine of body.split("\n")) {
249
+ const line = rawLine.trim();
250
+ if (line === "" || line.startsWith("<!--")) continue;
251
+ if (/^#{1,6}[ \t]/.test(line)) {
252
+ const heading = stripMarkdown(stripHeading(line));
253
+ if (heading === "") continue;
254
+ if (groups.at(-1)?.items.length === 0) groups.pop();
255
+ groups.push({
256
+ heading,
257
+ items: []
258
+ });
259
+ continue;
260
+ }
261
+ if (totalItems >= 12) {
262
+ if (/^[-*][ \t]/.test(line)) totalItems += 1;
263
+ continue;
264
+ }
265
+ const isBullet = /^[-*][ \t]/.test(line);
266
+ const continuation = (groups.at(-1)?.items.length ?? 0) > 0;
267
+ if (!isBullet && !continuation) continue;
268
+ const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \t]+/, "") : line);
269
+ if (content === "") continue;
270
+ const group = groups.at(-1);
271
+ if (group === void 0) groups.push({
272
+ heading: null,
273
+ items: [content]
274
+ });
275
+ else if (isBullet || group.items.length === 0) group.items.push(content);
276
+ else group.items[group.items.length - 1] = `${group.items.at(-1)} ${content}`.trim();
277
+ if (isBullet) totalItems += 1;
278
+ }
279
+ const kept = groups.filter((group) => group.items.length > 0);
280
+ truncated = totalItems > 12;
281
+ return {
282
+ version: found ? String(version).trim().replace(/^v/i, "") : null,
283
+ found,
284
+ groups: kept,
285
+ totalItems,
286
+ truncated
287
+ };
288
+ }
289
+ /** Window title — mirrors the sidebar's `Pantheon v<version>` convention. */
290
+ function whatsNewTitle(version) {
291
+ return `O que há de novo — Pantheon v${String(version).trim().replace(/^v/i, "")}`;
292
+ }
293
+ /** Flat display lines for the window: group headings, `• ` bullets, `+N more`. */
294
+ function whatsNewLines(highlights) {
295
+ const lines = [];
296
+ for (const group of highlights.groups) {
297
+ if (group.heading !== null) lines.push(group.heading);
298
+ for (const item of group.items) lines.push(`• ${item}`);
299
+ }
300
+ if (highlights.truncated) {
301
+ const hidden = Math.max(0, highlights.totalItems - 12);
302
+ if (hidden > 0) lines.push(`${WHATS_NEW_MORE_PREFIX}${hidden} mais`);
303
+ }
304
+ return lines;
305
+ }
306
+ /**
307
+ * Candidate CHANGELOG.md locations for a bundle, first readable wins:
308
+ * 1. the plugin copy root (`<configDir>/plugins/pantheon-tui/CHANGELOG.md`,
309
+ * shipped by both installers next to package.json);
310
+ * 2. the package root (dev checkout; also an npm-package install when the
311
+ * bundle runs from `<pkg>/src/plugins/tui/dist/`).
312
+ */
313
+ function changelogCandidates(bundlePath) {
314
+ const dist = dirname(bundlePath);
315
+ const copyRoot = dirname(dist);
316
+ const packageRoot = dirname(dirname(dirname(copyRoot)));
317
+ return [join(copyRoot, "CHANGELOG.md"), join(packageRoot, "CHANGELOG.md")];
318
+ }
319
+ /** Read the first existing candidate; null when none is readable (no window). */
320
+ async function readChangelogForBundle(bundleUrl) {
321
+ try {
322
+ const bundlePath = fileURLToPath(bundleUrl);
323
+ for (const candidate of changelogCandidates(bundlePath)) try {
324
+ return await readFile(candidate, "utf8");
325
+ } catch {}
326
+ return null;
327
+ } catch {
328
+ return null;
329
+ }
330
+ }
331
+ /** The ambient build-time version, or null outside a tsdown build. */
332
+ function embeddedVersion() {
333
+ return "1.6.3-beta.10";
334
+ }
335
+ /**
336
+ * Resolve the running Pantheon version for the what's-new window: the plugin
337
+ * copy's own package.json first (the copy root two levels above the bundle,
338
+ * then the package root four levels above — the same legs as the V1 sidebar's
339
+ * detectVersion try 0a/0b), falling back to the tsdown build embed. Null when
340
+ * nothing resolves → no window (fail-open).
341
+ */
342
+ async function resolveRunningVersion(bundleUrl, embedded = embeddedVersion()) {
343
+ try {
344
+ const bundlePath = fileURLToPath(bundleUrl);
345
+ const dist = dirname(bundlePath);
346
+ for (const root of [dirname(dist), dirname(dirname(dirname(dist)))]) try {
347
+ const raw = await readFile(join(root, "package.json"), "utf8");
348
+ const parsed = JSON.parse(raw);
349
+ if (typeof parsed.version === "string" && parsed.version.trim() !== "") return parsed.version;
350
+ } catch {}
351
+ } catch {}
352
+ return embedded;
353
+ }
354
+ //#endregion
355
+ //#region src/whats-new-state.ts
356
+ /**
357
+ * whats-new-state.ts — last-seen version for the one-time "What's new" window.
358
+ *
359
+ * The TUI shows a dismissable release-highlights dialog once per Pantheon
360
+ * version. Whether a version was already seen is persisted next to the other
361
+ * opencode-level Pantheon state: `<configDir>/.pantheon/whats-new.json`, the
362
+ * same directory that already holds `install-state.json` (scripts/install/
363
+ * state.mjs) and the active-preset file the sidebar reads. There is no
364
+ * established persistent TUI KV store (the host `api.kv` is per-process), so
365
+ * the plugin owns one small JSON file with the atomic-write discipline used
366
+ * across the repo (unique tmp + rename, mirrors scripts/install/verify.mjs).
367
+ *
368
+ * Fail-open everywhere: a missing or corrupt file reads as "never seen" (the
369
+ * window may show), a failed write is silent (the window may show again) —
370
+ * neither can ever block TUI startup.
371
+ */
372
+ /** State file name, kept next to `install-state.json` in `<configDir>/.pantheon/`. */
373
+ const WHATS_NEW_STATE_FILENAME = "whats-new.json";
374
+ /** Parse a state file body; null when unreadable as the expected shape. */
375
+ function parseWhatsNewState(raw) {
376
+ try {
377
+ const parsed = JSON.parse(raw);
378
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
379
+ const record = parsed;
380
+ const seen = record.seenVersion;
381
+ if (typeof seen !== "string" && seen !== null) return null;
382
+ return {
383
+ seenVersion: seen,
384
+ updatedAt: String(record.updatedAt ?? "")
385
+ };
386
+ } catch {
387
+ return null;
388
+ }
389
+ }
390
+ /** Read the persisted state; null when missing or corrupt (never throws). */
391
+ async function readWhatsNewState(statePath) {
392
+ try {
393
+ return parseWhatsNewState(await readFile(statePath, "utf8"));
394
+ } catch {
395
+ return null;
396
+ }
397
+ }
398
+ /**
399
+ * Whether the one-time window should show for `version`: any version change
400
+ * since the last dismissal (including downgrades). A falsy version — the
401
+ * resolver failed — never shows.
402
+ */
403
+ async function shouldShowWhatsNew(version, statePath) {
404
+ if (typeof version !== "string" || version.trim() === "") return false;
405
+ return (await readWhatsNewState(statePath))?.seenVersion !== version;
406
+ }
407
+ /**
408
+ * Persist `version` as seen (atomic tmp + rename, 0o600). Never throws: a
409
+ * failed write leaves the state untouched and the window may show again —
410
+ * the same fail-open contract as the rest of the plugin.
411
+ */
412
+ async function markSeenWhatsNew(version, statePath) {
413
+ if (typeof version !== "string" || version.trim() === "") return false;
414
+ const previous = await readWhatsNewState(statePath);
415
+ const next = {
416
+ seenVersion: version,
417
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
418
+ };
419
+ const tmpPath = `${statePath}.tmp-${process.pid}`;
420
+ try {
421
+ await mkdir(dirname(statePath), { recursive: true });
422
+ await writeFile(tmpPath, `${JSON.stringify({
423
+ ...previous,
424
+ ...next
425
+ }, null, 2)}\n`, {
426
+ encoding: "utf8",
427
+ mode: 384
428
+ });
429
+ await rename(tmpPath, statePath);
430
+ return true;
431
+ } catch {
432
+ try {
433
+ await unlink(tmpPath);
434
+ } catch {}
435
+ return false;
436
+ }
437
+ }
438
+ /** `stat`-based existence probe (async I/O discipline). */
439
+ async function pathExists(path) {
440
+ try {
441
+ await stat(path);
442
+ return true;
443
+ } catch {
444
+ return false;
445
+ }
446
+ }
447
+ /**
448
+ * Default state path: `<configDir>/.pantheon/whats-new.json`, resolving the
449
+ * OpenCode config directory exactly like src/pantheon/tui-version-check.ts
450
+ * (`$XDG_CONFIG_HOME/opencode` → `~/.opencode`), defaulting to the XDG
451
+ * location `init` creates when neither exists yet.
452
+ */
453
+ async function defaultWhatsNewStatePath(env = process.env, home = homedir()) {
454
+ const xdgConfig = env.XDG_CONFIG_HOME || join(home, ".config");
455
+ const primary = join(xdgConfig, "opencode");
456
+ if (await pathExists(primary)) return join(primary, ".pantheon", WHATS_NEW_STATE_FILENAME);
457
+ const legacy = join(home, ".opencode");
458
+ if (await pathExists(legacy)) return join(legacy, ".pantheon", WHATS_NEW_STATE_FILENAME);
459
+ return join(primary, ".pantheon", WHATS_NEW_STATE_FILENAME);
460
+ }
461
+ //#endregion
462
+ //#region src/whats-new-open.ts
463
+ /**
464
+ * whats-new-open.ts — the show-once decision for the "What's new" window.
465
+ *
466
+ * Plain data in, plain data out: the entrypoints (index.tsx / index-v2.tsx)
467
+ * resolve the running version and the shipped CHANGELOG.md, then hand this
468
+ * module a `show` callback that renders the view data through the host's
469
+ * dialog API. Keeping the decision JSX-free makes the whole one-time flow
470
+ * testable offline (node strips the types natively) — the Solid glue lives in
471
+ * whats-new.tsx.
472
+ *
473
+ * Contract (pinned by tests/tui-whats-new.test.mjs):
474
+ * - shows at most once per version: dismissal marks the version seen;
475
+ * - nothing to show (no version, missing CHANGELOG, empty section) → no
476
+ * window AND no pin — the next start may still show it;
477
+ * - never throws on its own inputs; I/O failures inside the state module
478
+ * are fail-open there.
479
+ */
480
+ /** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */
481
+ const WHATS_NEW_CLOSE_HINT = "esc/q fechar";
482
+ /**
483
+ * Open the one-time window when the version changed and highlights exist.
484
+ * Returns true when the window was shown; the caller's `onClose` callback
485
+ * (both host-initiated and local close binds) must funnel into marking seen.
486
+ */
487
+ async function openWhatsNew(input) {
488
+ const { version, statePath, changelogText, show } = input;
489
+ if (typeof version !== "string" || version.trim() === "") return false;
490
+ if (!await shouldShowWhatsNew(version, statePath)) return false;
491
+ const lines = whatsNewLines(changelogText ? extractHighlights(changelogText, version) : { ...EMPTY_HIGHLIGHTS });
492
+ if (lines.length === 0) return false;
493
+ const data = {
494
+ version,
495
+ title: whatsNewTitle(version),
496
+ lines,
497
+ hint: WHATS_NEW_CLOSE_HINT
498
+ };
499
+ show(() => data, () => {
500
+ markSeenWhatsNew(version, statePath);
501
+ });
502
+ return true;
503
+ }
504
+ //#endregion
505
+ //#region src/whats-new.tsx
506
+ /** @jsxImportSource @opentui/solid */
507
+ /**
508
+ * whats-new.tsx — the one-time "What's new" window (per Pantheon version).
509
+ *
510
+ * When the running Pantheon version changed since the last TUI start, the V2
511
+ * entrypoint fires {@link maybeShowWhatsNewV2} (fire-and-forget, never
512
+ * awaited — startup must never block). The decision lives in
513
+ * whats-new-open.ts; this file is only the host glue + view:
514
+ * `context.ui.dialog.show` plus a keymap layer gated on the open signal so
515
+ * `escape`/`q` dismiss while (and only while) the window is up — the same
516
+ * gated-layer pattern as the dispatch panel.
517
+ *
518
+ * Deliberately V2-only: the two dist entries are self-contained (the V1
519
+ * sidebar mirrors the preset resolver rather than importing it) because any
520
+ * module shared by both entries becomes a content-hashed chunk in dist/,
521
+ * changing the artifact shape the byte-reproducible-dist gate pins. The V1
522
+ * generation (OpenCode 1.x, legacy) does not show the window; the pure
523
+ * modules here are generation-agnostic, so a V1 mirror can follow the
524
+ * documented inline-replica precedent if it is ever wanted.
525
+ *
526
+ * Dismissal always funnels into `markSeenWhatsNew` (idempotent), so the window
527
+ * is shown exactly once per version. Every failure path is silent: missing
528
+ * CHANGELOG.md, unreadable state, a host API that throws — the window simply
529
+ * does not show (fail-open, like the rest of the plugin).
530
+ */
531
+ /** Window body: title, rule, bounded highlight lines, dismiss hint. */
532
+ function WhatsNewContent(props) {
533
+ return (() => {
534
+ var _el$ = createElement("box"), _el$2 = createElement("text"), _el$3 = createElement("text"), _el$5 = createElement("box"), _el$6 = createElement("text");
535
+ insertNode(_el$, _el$2);
536
+ insertNode(_el$, _el$3);
537
+ insertNode(_el$, _el$5);
538
+ insertNode(_el$, _el$6);
539
+ setProp(_el$, "flexDirection", "column");
540
+ setProp(_el$, "paddingLeft", 1);
541
+ setProp(_el$, "paddingRight", 1);
542
+ setProp(_el$, "paddingTop", 1);
543
+ setProp(_el$2, "attributes", 1);
544
+ insert(_el$2, () => props.data.title);
545
+ insertNode(_el$3, createTextNode(`──────────────────────────────────────`));
546
+ insert(_el$, createComponent(For, {
547
+ get each() {
548
+ return props.data.lines;
549
+ },
550
+ children: (line) => (() => {
551
+ var _el$7 = createElement("text");
552
+ insert(_el$7, line);
553
+ effect((_$p) => setProp(_el$7, "fg", line.startsWith("• ") ? props.fg : props.muted, _$p));
554
+ return _el$7;
555
+ })()
556
+ }), _el$5);
557
+ setProp(_el$5, "height", 1);
558
+ insert(_el$6, () => props.data.hint);
559
+ effect((_p$) => {
560
+ var _v$ = props.fg, _v$2 = props.muted, _v$3 = props.muted;
561
+ _v$ !== _p$.e && (_p$.e = setProp(_el$2, "fg", _v$, _p$.e));
562
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$3, "fg", _v$2, _p$.t));
563
+ _v$3 !== _p$.a && (_p$.a = setProp(_el$6, "fg", _v$3, _p$.a));
564
+ return _p$;
565
+ }, {
566
+ e: void 0,
567
+ t: void 0,
568
+ a: void 0
569
+ });
570
+ return _el$;
571
+ })();
572
+ }
573
+ /**
574
+ * Entry glue: resolve version + shipped CHANGELOG.md, then show the window
575
+ * through the host dialog stack once. Never throws.
576
+ */
577
+ async function maybeShowWhatsNewV2(context) {
578
+ try {
579
+ const version = await resolveRunningVersion(import.meta.url);
580
+ if (!version) return;
581
+ const statePath = await defaultWhatsNewStatePath();
582
+ const changelogText = await readChangelogForBundle(import.meta.url);
583
+ const [open, setOpen] = createSignal(false);
584
+ let dismiss = () => {};
585
+ try {
586
+ context.keymap.layer(() => ({
587
+ mode: "global",
588
+ enabled: () => open(),
589
+ commands: [{
590
+ id: "pantheon.whats-new.close",
591
+ title: "Fechar o que há de novo",
592
+ bind: "escape,q",
593
+ run: () => {
594
+ if (!open()) return false;
595
+ dismiss();
596
+ }
597
+ }]
598
+ }));
599
+ } catch {}
600
+ await openWhatsNew({
601
+ version,
602
+ statePath,
603
+ changelogText,
604
+ show: (render, onClose) => {
605
+ const close = () => {
606
+ setOpen(false);
607
+ onClose();
608
+ };
609
+ dismiss = () => {
610
+ try {
611
+ context.ui.dialog.clear();
612
+ } catch {}
613
+ close();
614
+ };
615
+ setOpen(true);
616
+ try {
617
+ const theme = context.theme?.text ?? {};
618
+ context.ui.dialog.show(() => createComponent(WhatsNewContent, {
619
+ get data() {
620
+ return render();
621
+ },
622
+ get fg() {
623
+ return theme.base;
624
+ },
625
+ get muted() {
626
+ return theme.muted;
627
+ }
628
+ }), close);
629
+ } catch {}
630
+ }
631
+ });
632
+ } catch {}
633
+ }
182
634
  //#endregion
183
635
  //#region src/index-v2.tsx
184
636
  /** @jsxImportSource @opentui/solid */
@@ -3197,7 +3649,7 @@ function Sidebar(props) {
3197
3649
  setProp(_el$12, "width", "100%");
3198
3650
  setProp(_el$12, "padding", 1);
3199
3651
  setProp(_el$13, "attributes", 1);
3200
- insert(_el$13, `Pantheon v1.6.3-beta.1`);
3652
+ insert(_el$13, `Pantheon v1.6.3-beta.10`);
3201
3653
  insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
3202
3654
  insert(_el$12, createComponent(Show, {
3203
3655
  get when() {
@@ -3918,7 +4370,7 @@ function HomeStatus(props) {
3918
4370
  const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
3919
4371
  return (() => {
3920
4372
  var _el$72 = createElement("text");
3921
- insert(_el$72, () => `Pantheon v1.6.3-beta.1${preset().name ? ` ▸ ${preset().name}` : ""}`);
4373
+ insert(_el$72, () => `Pantheon v1.6.3-beta.10${preset().name ? ` ▸ ${preset().name}` : ""}`);
3922
4374
  effect((_$p) => setProp(_el$72, "fg", muted(), _$p));
3923
4375
  return _el$72;
3924
4376
  })();
@@ -4025,6 +4477,7 @@ const plugin = Plugin.define({
4025
4477
  append: "app",
4026
4478
  render: () => createComponent(DispatchCommandLayer, { context })
4027
4479
  });
4480
+ maybeShowWhatsNewV2(context);
4028
4481
  return () => {
4029
4482
  if (typeof unregisterSidebar === "function") unregisterSidebar();
4030
4483
  if (typeof unregisterHome === "function") unregisterHome();
@@ -1 +1 @@
1
- {"version":3,"file":"tui-v2.js","names":["numberOrNull"],"sources":["../src/context-gauge.ts","../src/model-usage-limits.ts","../src/sidebar-width.ts"],"sourcesContent":["/** Shared, data-only formatting and visual helpers for compact context gauges. */\n\nexport type ContextProgressTone = 'info' | 'success' | 'warning' | 'error'\n\nexport const CONTEXT_BAR_CELLS = 12\nexport const CONTEXT_BAR_FILLED_CELL = '\\u25B0'\nexport const CONTEXT_BAR_EMPTY_CELL = '\\u25B1'\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\nexport function contextUsageTone(percent: number): ContextProgressTone {\n if (percent > 90) return 'error'\n if (percent > 50) return 'warning'\n if (percent > 25) return 'success'\n return 'info'\n}\n\nexport function formatTokenCount(tokens: number | null | undefined): string | null {\n const value = numberOrNull(tokens)\n if (value === null || value < 0) return null\n return Math.round(value).toLocaleString('en-US')\n}\n\nexport function formatContextWindow(limit: number | null | undefined): string | null {\n const value = numberOrNull(limit)\n if (value === null || value <= 0) return null\n if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`\n if (value >= 1_000) return `${Math.floor(value / 1_000)}K`\n return `${Math.floor(value)}`\n}\n\nexport function contextBarFilled(percent: number, cells = CONTEXT_BAR_CELLS): number {\n const total = Math.max(1, Math.floor(cells))\n const filled = Math.round((percent / 100) * total)\n if (!Number.isFinite(filled)) return 0\n return Math.min(total, Math.max(0, filled))\n}\n\nexport function contextBar(\n percent: number | null | undefined,\n cells = CONTEXT_BAR_CELLS,\n): { filled: string; empty: string } | null {\n const value = numberOrNull(percent)\n if (value === null) return null\n const total = Math.max(1, Math.floor(cells))\n const filled = contextBarFilled(value, total)\n return {\n filled: CONTEXT_BAR_FILLED_CELL.repeat(filled),\n empty: CONTEXT_BAR_EMPTY_CELL.repeat(total - filled),\n }\n}\n\nexport function formatSpent(cost: number | null | undefined): string | null {\n const value = numberOrNull(cost)\n if (value === null || value < 0) return null\n return `$${value.toFixed(2)}`\n}\n","/** Shared bounds for cached recent model-usage aggregation. */\nexport const MODEL_USAGE_VISIBLE_CEILING = 3\nexport const MODEL_USAGE_MESSAGE_LIMIT = 400\nexport const MODEL_USAGE_SESSION_LIMIT = 8\n","/** Conservative content budget; the host sidebar slot does not report its runtime width. */\nexport const SIDEBAR_CONTENT_WIDTH = 34\n\nexport const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\n/** A grapheme the host draws two cells wide: emoji presentation, an extended\n * pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`\n * does) and a regional-indicator pair (a flag). */\nconst EMOJI_GLYPH = /\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{Regional_Indicator}/u\n/** VS16 asks for emoji presentation; without it `1` is one cell, with it the\n * keycap sequence is drawn as one two-cell glyph. */\nconst EMOJI_PRESENTATION_SELECTOR = '\\uFE0F'\n/** Unicode default-ignorable code points carry no width of their own. */\nconst IGNORABLE_GLYPH = /^\\p{Default_Ignorable_Code_Point}$/u\n/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width\n * (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).\n * Generated from the host's own measurement (`string-width` over every code\n * point, emoji excluded), so this table can be regenerated verbatim when the\n * host upgrades its Unicode data instead of being hand-edited. */\nconst CELL_WIDE_RANGES: readonly (readonly [number, number])[] = [\n [0x1100, 0x115e],\n [0x2329, 0x232a],\n [0x2630, 0x2637],\n [0x268a, 0x268f],\n [0x2e80, 0x2e99],\n [0x2e9b, 0x2ef3],\n [0x2f00, 0x2fd5],\n [0x2ff0, 0x302f],\n [0x3031, 0x303c],\n [0x303e, 0x303e],\n [0x3041, 0x3096],\n [0x3099, 0x30ff],\n [0x3105, 0x312f],\n [0x3131, 0x3163],\n [0x3165, 0x318e],\n [0x3190, 0x31e5],\n [0x31ef, 0x321e],\n [0x3220, 0x3247],\n [0x3250, 0x3296],\n [0x3298, 0x3298],\n [0x329a, 0xa48c],\n [0xa490, 0xa4c6],\n [0xa960, 0xa97c],\n [0xac00, 0xd7a3],\n [0xf900, 0xfaff],\n [0xfe10, 0xfe19],\n [0xfe30, 0xfe52],\n [0xfe54, 0xfe66],\n [0xfe68, 0xfe6b],\n [0xff01, 0xff60],\n [0xffe0, 0xffe6],\n [0x16fe0, 0x16fe4],\n [0x16ff0, 0x16ff6],\n [0x17000, 0x18cda],\n [0x18cff, 0x18d20],\n [0x18d80, 0x18df2],\n [0x18e00, 0x19191],\n [0x191a0, 0x191d2],\n [0x1aff0, 0x1aff3],\n [0x1aff5, 0x1affb],\n [0x1affd, 0x1affe],\n [0x1b000, 0x1b128],\n [0x1b132, 0x1b132],\n [0x1b150, 0x1b152],\n [0x1b155, 0x1b155],\n [0x1b164, 0x1b168],\n [0x1b170, 0x1b2fb],\n [0x1d300, 0x1d356],\n [0x1d360, 0x1d376],\n [0x1f200, 0x1f200],\n [0x1f210, 0x1f219],\n [0x1f21b, 0x1f22e],\n [0x1f230, 0x1f231],\n [0x1f23b, 0x1f23b],\n [0x1f240, 0x1f248],\n [0x1f260, 0x1f265],\n [0x20000, 0x2fffd],\n [0x30000, 0x3fffd],\n]\n\n/** One code point the terminal draws no cell for: control characters, the\n * zero-width joiners/marks, combining marks and variation selectors. */\nfunction isZeroWidthCodePoint(code: number, glyph: string): boolean {\n if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) return true\n if (code >= 0x200b && code <= 0x200f) return true\n if (code === 0xfeff) return true\n if (code >= 0x300 && code <= 0x36f) return true\n if (code >= 0x1ab0 && code <= 0x1aff) return true\n if (code >= 0x1dc0 && code <= 0x1dff) return true\n if (code >= 0x20d0 && code <= 0x20ff) return true\n if (code >= 0xfe00 && code <= 0xfe0f) return true\n if (code >= 0xfe20 && code <= 0xfe2f) return true\n if (code >= 0xe0100 && code <= 0xe01ef) return true\n if (code >= 0xd800 && code <= 0xdfff) return true // a lone surrogate\n return IGNORABLE_GLYPH.test(glyph)\n}\n\nfunction isWideCodePoint(code: number): boolean {\n for (const [low, high] of CELL_WIDE_RANGES) {\n if (code < low) return false\n if (code <= high) return true\n }\n return false\n}\n\n/** Cells one grapheme occupies. */\nfunction graphemeWidth(segment: string): number {\n if (EMOJI_GLYPH.test(segment)) return 2\n // A lone VS16 carries no width; after a base it asks for emoji presentation.\n if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2\n let width = 0\n for (const glyph of segment) {\n const code = glyph.codePointAt(0) ?? 0\n if (isZeroWidthCodePoint(code, glyph)) continue\n width += isWideCodePoint(code) ? 2 : 1\n }\n return width\n}\n\n/** Terminal cells `value` occupies — the unit every column in this plugin is\n * measured in. Mirrors the host (that is how `@opentui/core` sizes a text\n * run): emoji count as two cells, East Asian Wide/Fullwidth as two, East\n * Asian Ambiguous as one, combining marks and variation selectors as none.\n * Pure. */\nexport function cellWidth(value: string): number {\n let width = 0\n for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment)\n return width\n}\n"],"mappings":";;;;;;;;AAIA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,yBAAyB;AAEtC,SAASA,eAAa,OAA+B;CACnD,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AACvE;AAEA,SAAgB,iBAAiB,SAAsC;CACrE,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,OAAO;AACT;AAEA,SAAgB,iBAAiB,QAAkD;CACjF,MAAM,QAAQA,eAAa,MAAM;CACjC,IAAI,UAAU,QAAQ,QAAQ,GAAG,OAAO;CACxC,OAAO,KAAK,MAAM,KAAK,CAAC,CAAC,eAAe,OAAO;AACjD;AAEA,SAAgB,oBAAoB,OAAiD;CACnF,MAAM,QAAQA,eAAa,KAAK;CAChC,IAAI,UAAU,QAAQ,SAAS,GAAG,OAAO;CACzC,IAAI,SAAS,KAAW,OAAO,IAAI,QAAQ,IAAA,CAAW,QAAQ,CAAC,EAAE;CACjE,IAAI,SAAS,KAAO,OAAO,GAAG,KAAK,MAAM,QAAQ,GAAK,EAAE;CACxD,OAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;AAEA,SAAgB,iBAAiB,SAAiB,QAAA,IAAmC;CACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC;CAC3C,MAAM,SAAS,KAAK,MAAO,UAAU,MAAO,KAAK;CACjD,IAAI,CAAC,OAAO,SAAS,MAAM,GAAG,OAAO;CACrC,OAAO,KAAK,IAAI,OAAO,KAAK,IAAI,GAAG,MAAM,CAAC;AAC5C;AAEA,SAAgB,WACd,SACA,QAAA,IAC0C;CAC1C,MAAM,QAAQA,eAAa,OAAO;CAClC,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,QAAQ,KAAK,IAAI,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IAAI,QAAQ,SAAU,QAAQ,OAAQ,OAAO;CAC7C,OAAO,gBAAgB,KAAK,KAAK;AACnC;AAEA,SAAS,gBAAgB,MAAuB;CAC9C,KAAK,MAAM,CAAC,KAAK,SAAS,kBAAkB;EAC1C,IAAI,OAAO,KAAK,OAAO;EACvB,IAAI,QAAQ,MAAM,OAAO;CAC3B;CACA,OAAO;AACT;;AAGA,SAAS,cAAc,SAAyB;CAC9C,IAAI,YAAY,KAAK,OAAO,GAAG,OAAO;CAEtC,IAAI,QAAQ,SAAS,KAAK,QAAQ,SAAS,2BAA2B,GAAG,OAAO;CAChF,IAAI,QAAQ;CACZ,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,OAAO,MAAM,YAAY,CAAC,KAAK;EACrC,IAAI,qBAAqB,MAAM,KAAK,GAAG;EACvC,SAAS,gBAAgB,IAAI,IAAI,IAAI;CACvC;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,UAAU,OAAuB;CAC/C,IAAI,QAAQ;CACZ,KAAK,MAAM,EAAE,aAAa,UAAU,QAAQ,KAAK,GAAG,SAAS,cAAc,OAAO;CAClF,OAAO;AACT"}
1
+ {"version":3,"file":"tui-v2.js","names":["numberOrNull"],"sources":["../src/context-gauge.ts","../src/model-usage-limits.ts","../src/sidebar-width.ts","../src/whats-new-highlights.ts","../src/whats-new-state.ts","../src/whats-new-open.ts"],"sourcesContent":["/** Shared, data-only formatting and visual helpers for compact context gauges. */\n\nexport type ContextProgressTone = 'info' | 'success' | 'warning' | 'error'\n\nexport const CONTEXT_BAR_CELLS = 12\nexport const CONTEXT_BAR_FILLED_CELL = '\\u25B0'\nexport const CONTEXT_BAR_EMPTY_CELL = '\\u25B1'\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\nexport function contextUsageTone(percent: number): ContextProgressTone {\n if (percent > 90) return 'error'\n if (percent > 50) return 'warning'\n if (percent > 25) return 'success'\n return 'info'\n}\n\nexport function formatTokenCount(tokens: number | null | undefined): string | null {\n const value = numberOrNull(tokens)\n if (value === null || value < 0) return null\n return Math.round(value).toLocaleString('en-US')\n}\n\nexport function formatContextWindow(limit: number | null | undefined): string | null {\n const value = numberOrNull(limit)\n if (value === null || value <= 0) return null\n if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`\n if (value >= 1_000) return `${Math.floor(value / 1_000)}K`\n return `${Math.floor(value)}`\n}\n\nexport function contextBarFilled(percent: number, cells = CONTEXT_BAR_CELLS): number {\n const total = Math.max(1, Math.floor(cells))\n const filled = Math.round((percent / 100) * total)\n if (!Number.isFinite(filled)) return 0\n return Math.min(total, Math.max(0, filled))\n}\n\nexport function contextBar(\n percent: number | null | undefined,\n cells = CONTEXT_BAR_CELLS,\n): { filled: string; empty: string } | null {\n const value = numberOrNull(percent)\n if (value === null) return null\n const total = Math.max(1, Math.floor(cells))\n const filled = contextBarFilled(value, total)\n return {\n filled: CONTEXT_BAR_FILLED_CELL.repeat(filled),\n empty: CONTEXT_BAR_EMPTY_CELL.repeat(total - filled),\n }\n}\n\nexport function formatSpent(cost: number | null | undefined): string | null {\n const value = numberOrNull(cost)\n if (value === null || value < 0) return null\n return `$${value.toFixed(2)}`\n}\n","/** Shared bounds for cached recent model-usage aggregation. */\nexport const MODEL_USAGE_VISIBLE_CEILING = 3\nexport const MODEL_USAGE_MESSAGE_LIMIT = 400\nexport const MODEL_USAGE_SESSION_LIMIT = 8\n","/** Conservative content budget; the host sidebar slot does not report its runtime width. */\nexport const SIDEBAR_CONTENT_WIDTH = 34\n\nexport const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\n/** A grapheme the host draws two cells wide: emoji presentation, an extended\n * pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`\n * does) and a regional-indicator pair (a flag). */\nconst EMOJI_GLYPH = /\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{Regional_Indicator}/u\n/** VS16 asks for emoji presentation; without it `1` is one cell, with it the\n * keycap sequence is drawn as one two-cell glyph. */\nconst EMOJI_PRESENTATION_SELECTOR = '\\uFE0F'\n/** Unicode default-ignorable code points carry no width of their own. */\nconst IGNORABLE_GLYPH = /^\\p{Default_Ignorable_Code_Point}$/u\n/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width\n * (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).\n * Generated from the host's own measurement (`string-width` over every code\n * point, emoji excluded), so this table can be regenerated verbatim when the\n * host upgrades its Unicode data instead of being hand-edited. */\nconst CELL_WIDE_RANGES: readonly (readonly [number, number])[] = [\n [0x1100, 0x115e],\n [0x2329, 0x232a],\n [0x2630, 0x2637],\n [0x268a, 0x268f],\n [0x2e80, 0x2e99],\n [0x2e9b, 0x2ef3],\n [0x2f00, 0x2fd5],\n [0x2ff0, 0x302f],\n [0x3031, 0x303c],\n [0x303e, 0x303e],\n [0x3041, 0x3096],\n [0x3099, 0x30ff],\n [0x3105, 0x312f],\n [0x3131, 0x3163],\n [0x3165, 0x318e],\n [0x3190, 0x31e5],\n [0x31ef, 0x321e],\n [0x3220, 0x3247],\n [0x3250, 0x3296],\n [0x3298, 0x3298],\n [0x329a, 0xa48c],\n [0xa490, 0xa4c6],\n [0xa960, 0xa97c],\n [0xac00, 0xd7a3],\n [0xf900, 0xfaff],\n [0xfe10, 0xfe19],\n [0xfe30, 0xfe52],\n [0xfe54, 0xfe66],\n [0xfe68, 0xfe6b],\n [0xff01, 0xff60],\n [0xffe0, 0xffe6],\n [0x16fe0, 0x16fe4],\n [0x16ff0, 0x16ff6],\n [0x17000, 0x18cda],\n [0x18cff, 0x18d20],\n [0x18d80, 0x18df2],\n [0x18e00, 0x19191],\n [0x191a0, 0x191d2],\n [0x1aff0, 0x1aff3],\n [0x1aff5, 0x1affb],\n [0x1affd, 0x1affe],\n [0x1b000, 0x1b128],\n [0x1b132, 0x1b132],\n [0x1b150, 0x1b152],\n [0x1b155, 0x1b155],\n [0x1b164, 0x1b168],\n [0x1b170, 0x1b2fb],\n [0x1d300, 0x1d356],\n [0x1d360, 0x1d376],\n [0x1f200, 0x1f200],\n [0x1f210, 0x1f219],\n [0x1f21b, 0x1f22e],\n [0x1f230, 0x1f231],\n [0x1f23b, 0x1f23b],\n [0x1f240, 0x1f248],\n [0x1f260, 0x1f265],\n [0x20000, 0x2fffd],\n [0x30000, 0x3fffd],\n]\n\n/** One code point the terminal draws no cell for: control characters, the\n * zero-width joiners/marks, combining marks and variation selectors. */\nfunction isZeroWidthCodePoint(code: number, glyph: string): boolean {\n if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) return true\n if (code >= 0x200b && code <= 0x200f) return true\n if (code === 0xfeff) return true\n if (code >= 0x300 && code <= 0x36f) return true\n if (code >= 0x1ab0 && code <= 0x1aff) return true\n if (code >= 0x1dc0 && code <= 0x1dff) return true\n if (code >= 0x20d0 && code <= 0x20ff) return true\n if (code >= 0xfe00 && code <= 0xfe0f) return true\n if (code >= 0xfe20 && code <= 0xfe2f) return true\n if (code >= 0xe0100 && code <= 0xe01ef) return true\n if (code >= 0xd800 && code <= 0xdfff) return true // a lone surrogate\n return IGNORABLE_GLYPH.test(glyph)\n}\n\nfunction isWideCodePoint(code: number): boolean {\n for (const [low, high] of CELL_WIDE_RANGES) {\n if (code < low) return false\n if (code <= high) return true\n }\n return false\n}\n\n/** Cells one grapheme occupies. */\nfunction graphemeWidth(segment: string): number {\n if (EMOJI_GLYPH.test(segment)) return 2\n // A lone VS16 carries no width; after a base it asks for emoji presentation.\n if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2\n let width = 0\n for (const glyph of segment) {\n const code = glyph.codePointAt(0) ?? 0\n if (isZeroWidthCodePoint(code, glyph)) continue\n width += isWideCodePoint(code) ? 2 : 1\n }\n return width\n}\n\n/** Terminal cells `value` occupies — the unit every column in this plugin is\n * measured in. Mirrors the host (that is how `@opentui/core` sizes a text\n * run): emoji count as two cells, East Asian Wide/Fullwidth as two, East\n * Asian Ambiguous as one, combining marks and variation selectors as none.\n * Pure. */\nexport function cellWidth(value: string): number {\n let width = 0\n for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment)\n return width\n}\n","/**\n * whats-new-highlights.ts — release highlights for the one-time \"What's new\"\n * window, extracted from the CHANGELOG.md shipped with the plugin copy.\n *\n * The section-finding logic is an inline replica of scripts/changelog-extract.mjs\n * `extractSection` (pinned by a parity test in tests/tui-whats-new.test.mjs):\n * the copied plugin ships only dist/ + package.json (+ CHANGELOG.md, copied by\n * both installers), so it cannot reach scripts/ at runtime — the same reason\n * the preset resolver is mirrored in index.tsx/index-v2.tsx rather than\n * imported. The script's CLI main is NOT replicated; the plugin only needs the\n * pure extraction.\n *\n * Everything is reduced to bounded plain text: no markdown syntax artifacts,\n * at most WHATS_NEW_MAX_ITEMS bullets. Missing CHANGELOG.md, an unknown\n * version or an empty section all resolve to an empty highlight set — the\n * window simply does not show (fail-open, like the rest of the plugin).\n */\nimport { readFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/** Hard cap on bullets shown in the window (the remainder is counted). */\nexport const WHATS_NEW_MAX_ITEMS = 12\n\n/** Prefix of the \"+N more\" line appended when the bullet budget is exceeded. */\nexport const WHATS_NEW_MORE_PREFIX = '… +'\n\n/** H3 subsection headings are kept as plain-text group labels. */\nexport interface WhatsNewGroup {\n heading: string | null\n items: string[]\n}\n\nexport interface WhatsNewHighlights {\n /** Normalized version the highlights belong to (null when not found). */\n version: string | null\n found: boolean\n groups: WhatsNewGroup[]\n /** Total bullets in the section, before the WHATS_NEW_MAX_ITEMS cut. */\n totalItems: number\n /** True when totalItems exceeded WHATS_NEW_MAX_ITEMS. */\n truncated: boolean\n}\n\nexport const EMPTY_HIGHLIGHTS: WhatsNewHighlights = {\n version: null,\n found: false,\n groups: [],\n totalItems: 0,\n truncated: false,\n}\n\n/** Escape regex metacharacters so a version like 1.0.0 matches literally. */\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Extract the body of a version section from changelog text — inline replica\n * of scripts/changelog-extract.mjs `extractSection` (see that file for the\n * full contract: `## [<version>] - YYYY-MM-DD`, leading `v` and the date\n * optional, `## [Unreleased]` never matched).\n */\nexport function extractSection(\n changelogText: string,\n version: string,\n): { found: boolean; body: string | null } {\n const normalized = String(version).trim().replace(/^v/i, '')\n if (!normalized || /^unreleased$/i.test(normalized)) return { found: false, body: null }\n\n const escaped = escapeRegExp(normalized)\n // Single-line heading: `## [v?1.2.1]` optionally followed by ` - YYYY-MM-DD`.\n // [ \\t] (not \\s) keeps the match from crossing newlines; the lookahead\n // requires end-of-line or whitespace so `[1.0.0-beta]` can never match `1.0.0`.\n const headingRe = new RegExp(\n `^##[ \\\\t]+\\\\[v?${escaped}\\\\](?:[ \\\\t]*-[ \\\\t]*\\\\d{4}-\\\\d{2}-\\\\d{2})?(?=[ \\\\t]|$)`,\n 'm',\n )\n const match = headingRe.exec(changelogText)\n if (!match) return { found: false, body: null }\n\n // Advance past the heading line (match.index may point mid-line).\n const newline = changelogText.indexOf('\\n', match.index)\n const start = newline === -1 ? changelogText.length : newline + 1\n\n // Body ends at the next `## [` heading or end of text.\n const nextHeading = /^##[ \\t]+\\[/m.exec(changelogText.slice(start))\n const end = nextHeading ? start + nextHeading.index : changelogText.length\n\n return { found: true, body: changelogText.slice(start, end).trim() }\n}\n\n/**\n * Reduce one markdown line to plain text: links keep their label, emphasis\n * and inline-code markers are dropped, HTML comment fragments are removed,\n * and whitespace collapses. Deliberately simple — the input is our own\n * CHANGELOG (lint-capped at 200 chars per bullet), not hostile input.\n */\nexport function stripMarkdown(text: string): string {\n return text\n .replace(/<!--[\\s\\S]*?-->/g, ' ')\n .replace(/\\[([^\\]]+)\\]\\([^)]*\\)/g, '$1')\n .replace(/(\\*\\*|__)/g, '')\n .replace(/`/g, '')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/** Strip the leading H3 marker (`### Added` → `Added`). */\nfunction stripHeading(text: string): string {\n return text.replace(/^#{1,6}[ \\t]+/, '').trim()\n}\n\n/**\n * Extract the release highlights for `version`: H3 subsection headings as\n * group labels and their bullets as sanitized plain text, bounded to\n * WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a\n * blank changelog all return EMPTY_HIGHLIGHTS (no window).\n */\nexport function extractHighlights(changelogText: string, version: string): WhatsNewHighlights {\n const { found, body } = extractSection(changelogText ?? '', version ?? '')\n if (!found || !body) return { ...EMPTY_HIGHLIGHTS }\n\n const groups: WhatsNewGroup[] = []\n let totalItems = 0\n let truncated = false\n\n for (const rawLine of body.split('\\n')) {\n const line = rawLine.trim()\n if (line === '' || line.startsWith('<!--')) continue\n\n if (/^#{1,6}[ \\t]/.test(line)) {\n const heading = stripMarkdown(stripHeading(line))\n if (heading === '') continue\n if (groups.at(-1)?.items.length === 0) groups.pop() // empty group boundary\n groups.push({ heading, items: [] })\n continue\n }\n\n if (totalItems >= WHATS_NEW_MAX_ITEMS) {\n // Keep scanning only to count the remainder for the \"+N more\" line.\n if (/^[-*][ \\t]/.test(line)) totalItems += 1\n continue\n }\n\n const isBullet = /^[-*][ \\t]/.test(line)\n const continuation = (groups.at(-1)?.items.length ?? 0) > 0\n if (!isBullet && !continuation) continue // prose between groups — not a highlight\n\n const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \\t]+/, '') : line)\n if (content === '') continue\n const group = groups.at(-1)\n if (group === undefined) {\n groups.push({ heading: null, items: [content] })\n } else if (isBullet || group.items.length === 0) {\n group.items.push(content)\n } else {\n group.items[group.items.length - 1] = `${group.items.at(-1)} ${content}`.trim()\n }\n if (isBullet) totalItems += 1\n }\n\n const kept = groups.filter((group) => group.items.length > 0)\n truncated = totalItems > WHATS_NEW_MAX_ITEMS\n return {\n version: found ? String(version).trim().replace(/^v/i, '') : null,\n found,\n groups: kept,\n totalItems,\n truncated,\n }\n}\n\n/** Window title — mirrors the sidebar's `Pantheon v<version>` convention. */\nexport function whatsNewTitle(version: string): string {\n return `O que há de novo — Pantheon v${String(version).trim().replace(/^v/i, '')}`\n}\n\n/** Flat display lines for the window: group headings, `• ` bullets, `+N more`. */\nexport function whatsNewLines(highlights: WhatsNewHighlights): string[] {\n const lines: string[] = []\n for (const group of highlights.groups) {\n if (group.heading !== null) lines.push(group.heading)\n for (const item of group.items) lines.push(`• ${item}`)\n }\n if (highlights.truncated) {\n const hidden = Math.max(0, highlights.totalItems - WHATS_NEW_MAX_ITEMS)\n if (hidden > 0) lines.push(`${WHATS_NEW_MORE_PREFIX}${hidden} mais`)\n }\n return lines\n}\n\n/**\n * Candidate CHANGELOG.md locations for a bundle, first readable wins:\n * 1. the plugin copy root (`<configDir>/plugins/pantheon-tui/CHANGELOG.md`,\n * shipped by both installers next to package.json);\n * 2. the package root (dev checkout; also an npm-package install when the\n * bundle runs from `<pkg>/src/plugins/tui/dist/`).\n */\nexport function changelogCandidates(bundlePath: string): string[] {\n const dist = dirname(bundlePath)\n const copyRoot = dirname(dist)\n // The second leg targets the package root: src/plugins/tui → plugins → src\n // → package root (dev checkout / npm-package install). On an installed copy\n // the same three levels land on the XDG base, where no CHANGELOG lives —\n // harmless, the copy-root candidate is the one the installers ship.\n const packageRoot = dirname(dirname(dirname(copyRoot)))\n return [join(copyRoot, 'CHANGELOG.md'), join(packageRoot, 'CHANGELOG.md')]\n}\n\n/** Read the first existing candidate; null when none is readable (no window). */\nexport async function readChangelogForBundle(bundleUrl: string): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n for (const candidate of changelogCandidates(bundlePath)) {\n try {\n return await readFile(candidate, 'utf8')\n } catch {}\n }\n return null\n } catch {\n return null\n }\n}\n\n/** Build-time embedded version (tsdown `define` in tsdown.config.ts). */\ndeclare const __PANTHEON_VERSION__: string | undefined\n\n/** The ambient build-time version, or null outside a tsdown build. */\nexport function embeddedVersion(): string | null {\n return typeof __PANTHEON_VERSION__ !== 'undefined' && __PANTHEON_VERSION__\n ? __PANTHEON_VERSION__\n : null\n}\n\n/**\n * Resolve the running Pantheon version for the what's-new window: the plugin\n * copy's own package.json first (the copy root two levels above the bundle,\n * then the package root four levels above — the same legs as the V1 sidebar's\n * detectVersion try 0a/0b), falling back to the tsdown build embed. Null when\n * nothing resolves → no window (fail-open).\n */\nexport async function resolveRunningVersion(\n bundleUrl: string,\n embedded: string | null = embeddedVersion(),\n): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n const dist = dirname(bundlePath)\n for (const root of [dirname(dist), dirname(dirname(dirname(dist)))]) {\n try {\n const raw = await readFile(join(root, 'package.json'), 'utf8')\n const parsed = JSON.parse(raw) as { version?: unknown }\n if (typeof parsed.version === 'string' && parsed.version.trim() !== '') {\n return parsed.version\n }\n } catch {}\n }\n } catch {\n /* fall through to the embed */\n }\n return embedded\n}\n","/**\n * whats-new-state.ts — last-seen version for the one-time \"What's new\" window.\n *\n * The TUI shows a dismissable release-highlights dialog once per Pantheon\n * version. Whether a version was already seen is persisted next to the other\n * opencode-level Pantheon state: `<configDir>/.pantheon/whats-new.json`, the\n * same directory that already holds `install-state.json` (scripts/install/\n * state.mjs) and the active-preset file the sidebar reads. There is no\n * established persistent TUI KV store (the host `api.kv` is per-process), so\n * the plugin owns one small JSON file with the atomic-write discipline used\n * across the repo (unique tmp + rename, mirrors scripts/install/verify.mjs).\n *\n * Fail-open everywhere: a missing or corrupt file reads as \"never seen\" (the\n * window may show), a failed write is silent (the window may show again) —\n * neither can ever block TUI startup.\n */\nimport { mkdir, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises'\nimport { homedir } from 'node:os'\nimport { dirname, join } from 'node:path'\n\n/** State file name, kept next to `install-state.json` in `<configDir>/.pantheon/`. */\nexport const WHATS_NEW_STATE_FILENAME = 'whats-new.json'\n\n/** Shape of the persisted file — the plugin owns this file outright. */\nexport interface WhatsNewStateFile {\n seenVersion: string | null\n updatedAt: string\n}\n\ntype Env = Record<string, string | undefined>\n\n/** Parse a state file body; null when unreadable as the expected shape. */\nexport function parseWhatsNewState(raw: string): WhatsNewStateFile | null {\n try {\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null\n const record = parsed as Record<string, unknown>\n const seen = record.seenVersion\n if (typeof seen !== 'string' && seen !== null) return null\n return { seenVersion: seen, updatedAt: String(record.updatedAt ?? '') }\n } catch {\n return null\n }\n}\n\n/** Read the persisted state; null when missing or corrupt (never throws). */\nexport async function readWhatsNewState(statePath: string): Promise<WhatsNewStateFile | null> {\n try {\n return parseWhatsNewState(await readFile(statePath, 'utf8'))\n } catch {\n return null\n }\n}\n\n/**\n * Whether the one-time window should show for `version`: any version change\n * since the last dismissal (including downgrades). A falsy version — the\n * resolver failed — never shows.\n */\nexport async function shouldShowWhatsNew(\n version: string | null | undefined,\n statePath: string,\n): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const state = await readWhatsNewState(statePath)\n return state?.seenVersion !== version\n}\n\n/**\n * Persist `version` as seen (atomic tmp + rename, 0o600). Never throws: a\n * failed write leaves the state untouched and the window may show again —\n * the same fail-open contract as the rest of the plugin.\n */\nexport async function markSeenWhatsNew(version: string, statePath: string): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const previous = await readWhatsNewState(statePath)\n const next: WhatsNewStateFile = {\n seenVersion: version,\n updatedAt: new Date().toISOString(),\n }\n const tmpPath = `${statePath}.tmp-${process.pid}`\n try {\n await mkdir(dirname(statePath), { recursive: true })\n await writeFile(tmpPath, `${JSON.stringify({ ...previous, ...next }, null, 2)}\\n`, {\n encoding: 'utf8',\n mode: 0o600,\n })\n await rename(tmpPath, statePath)\n return true\n } catch {\n try {\n await unlink(tmpPath)\n } catch {\n /* nothing to clean up */\n }\n return false\n }\n}\n\n/** `stat`-based existence probe (async I/O discipline). */\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Default state path: `<configDir>/.pantheon/whats-new.json`, resolving the\n * OpenCode config directory exactly like src/pantheon/tui-version-check.ts\n * (`$XDG_CONFIG_HOME/opencode` → `~/.opencode`), defaulting to the XDG\n * location `init` creates when neither exists yet.\n */\nexport async function defaultWhatsNewStatePath(\n env: Env = process.env,\n home: string = homedir(),\n): Promise<string> {\n const xdgConfig = env.XDG_CONFIG_HOME || join(home, '.config')\n const primary = join(xdgConfig, 'opencode')\n if (await pathExists(primary)) return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n const legacy = join(home, '.opencode')\n if (await pathExists(legacy)) return join(legacy, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n}\n","/**\n * whats-new-open.ts — the show-once decision for the \"What's new\" window.\n *\n * Plain data in, plain data out: the entrypoints (index.tsx / index-v2.tsx)\n * resolve the running version and the shipped CHANGELOG.md, then hand this\n * module a `show` callback that renders the view data through the host's\n * dialog API. Keeping the decision JSX-free makes the whole one-time flow\n * testable offline (node strips the types natively) — the Solid glue lives in\n * whats-new.tsx.\n *\n * Contract (pinned by tests/tui-whats-new.test.mjs):\n * - shows at most once per version: dismissal marks the version seen;\n * - nothing to show (no version, missing CHANGELOG, empty section) → no\n * window AND no pin — the next start may still show it;\n * - never throws on its own inputs; I/O failures inside the state module\n * are fail-open there.\n */\nimport {\n EMPTY_HIGHLIGHTS,\n extractHighlights,\n type WhatsNewHighlights,\n whatsNewLines,\n whatsNewTitle,\n} from './whats-new-highlights.ts'\nimport { markSeenWhatsNew, shouldShowWhatsNew } from './whats-new-state.ts'\n\n/** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */\nexport const WHATS_NEW_CLOSE_HINT = 'esc/q fechar'\n\n/** Everything the window needs to render — no host types, no JSX. */\nexport interface WhatsNewViewData {\n version: string\n title: string\n lines: string[]\n hint: string\n}\n\nexport type WhatsNewShowFn = (render: () => WhatsNewViewData, onClose: () => void) => void\n\nexport interface WhatsNewOpenInput {\n /** Running Pantheon version (null when unresolvable → no window). */\n version: string | null\n /** Path of the seen-version state file (see whats-new-state.ts). */\n statePath: string\n /** Shipped CHANGELOG.md content, or null when unreadable. */\n changelogText: string | null\n /** Host dialog opener; `onClose` fires on host dismissal (ESC / chrome). */\n show: WhatsNewShowFn\n}\n\n/**\n * Open the one-time window when the version changed and highlights exist.\n * Returns true when the window was shown; the caller's `onClose` callback\n * (both host-initiated and local close binds) must funnel into marking seen.\n */\nexport async function openWhatsNew(input: WhatsNewOpenInput): Promise<boolean> {\n const { version, statePath, changelogText, show } = input\n if (typeof version !== 'string' || version.trim() === '') return false\n if (!(await shouldShowWhatsNew(version, statePath))) return false\n\n const highlights: WhatsNewHighlights = changelogText\n ? extractHighlights(changelogText, version)\n : { ...EMPTY_HIGHLIGHTS }\n const lines = whatsNewLines(highlights)\n if (lines.length === 0) return false\n\n const data: WhatsNewViewData = {\n version,\n title: whatsNewTitle(version),\n lines,\n hint: WHATS_NEW_CLOSE_HINT,\n }\n show(\n () => data,\n () => {\n void markSeenWhatsNew(version, statePath)\n },\n )\n return true\n}\n"],"mappings":";;;;;;;;;AAIA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,yBAAyB;AAEtC,SAASA,eAAa,OAA+B;CACnD,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AACvE;AAEA,SAAgB,iBAAiB,SAAsC;CACrE,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,OAAO;AACT;AAEA,SAAgB,iBAAiB,QAAkD;CACjF,MAAM,QAAQA,eAAa,MAAM;CACjC,IAAI,UAAU,QAAQ,QAAQ,GAAG,OAAO;CACxC,OAAO,KAAK,MAAM,KAAK,CAAC,CAAC,eAAe,OAAO;AACjD;AAEA,SAAgB,oBAAoB,OAAiD;CACnF,MAAM,QAAQA,eAAa,KAAK;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AE,MAAM,mBAAmB,SAAS,SAAS,GAAI,OAAO;CAK5D,MAAM,QAAQ,cAHyB,gBACnC,kBAAkB,eAAe,OAAO,IACxC,EAAE,GAAG,iBAAiB,CACY;CACtC,IAAI,MAAM,WAAW,GAAG,OAAO;CAE/B,MAAM,OAAyB;EAC7B;EACA,OAAO,cAAc,OAAO;EAC5B;EACA,MAAM;CACR;CACA,WACQ,YACA;EACJ,iBAAsB,SAAS,SAAS;CAC1C,CACF;CACA,OAAO;AACT"}
@@ -167,7 +167,7 @@ async function detectVersion(api) {
167
167
  if (ver) return ver;
168
168
  }
169
169
  } catch {}
170
- return "1.6.3-beta.1";
170
+ return "1.6.3-beta.10";
171
171
  }
172
172
  /**
173
173
  * usage-bar — AI subscription usage gauge for the opencode TUI.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "1.6.3-beta.1",
3
+ "version": "1.6.3-beta.10",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "1.6.3-beta.1",
9
+ "version": "1.6.3-beta.10",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode-ai/plugin": "1.18.33",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "1.6.3-beta.1",
4
+ "version": "1.6.3-beta.10",
5
5
  "description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -24,6 +24,7 @@ import {
24
24
  MODEL_USAGE_VISIBLE_CEILING,
25
25
  } from './model-usage-limits'
26
26
  import { cellWidth, GRAPHEMES, SIDEBAR_CONTENT_WIDTH } from './sidebar-width'
27
+ import { maybeShowWhatsNewV2 } from './whats-new'
27
28
 
28
29
  export type { ContextProgressTone } from './context-gauge'
29
30
  export {
@@ -4476,6 +4477,11 @@ const plugin = Plugin.define({
4476
4477
  append: 'app',
4477
4478
  render: () => <DispatchCommandLayer context={context} />,
4478
4479
  })
4480
+ // One-time "What's new" window (per Pantheon version) — fire-and-forget:
4481
+ // resolves the running version and the shipped CHANGELOG.md, then opens a
4482
+ // host dialog when the version changed since the last dismissal. Fail-open;
4483
+ // a missing changelog or unreadable state simply means no window.
4484
+ void maybeShowWhatsNewV2(context)
4479
4485
  return () => {
4480
4486
  if (typeof unregisterSidebar === 'function') unregisterSidebar()
4481
4487
  if (typeof unregisterHome === 'function') unregisterHome()