dsh-code 1.0.7 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.en.md +70 -24
  2. package/README.md +71 -25
  3. package/bin/deepseek.mjs +202 -39
  4. package/cordis.patch.yml +13 -4
  5. package/lib/index.mjs +4063 -844
  6. package/lib/session-query.mjs +3 -2
  7. package/lib/startup.mjs +4 -4
  8. package/lib/{theme-DCT8Y2xf.mjs → theme-7u5Qo3dF.mjs} +657 -20
  9. package/lib/types/app.d.ts +100 -63
  10. package/lib/types/authorization-panel.d.ts +3 -3
  11. package/lib/types/git-workflow.d.ts +91 -2
  12. package/lib/types/i18n.d.ts +39 -0
  13. package/lib/types/index.d.ts +73 -1
  14. package/lib/types/input-split.d.ts +1 -1
  15. package/lib/types/kernel-panels.d.ts +86 -31
  16. package/lib/types/language-panel.d.ts +12 -0
  17. package/lib/types/locales/en.d.ts +450 -0
  18. package/lib/types/locales/zh.d.ts +9 -0
  19. package/lib/types/mentions.d.ts +7 -3
  20. package/lib/types/models.d.ts +14 -0
  21. package/lib/types/panel-accent.d.ts +28 -0
  22. package/lib/types/rainbow.d.ts +69 -0
  23. package/lib/types/render/animations.d.ts +42 -0
  24. package/lib/types/render/inspector.d.ts +26 -0
  25. package/lib/types/render/lines.d.ts +21 -1
  26. package/lib/types/render/markdown.d.ts +1 -1
  27. package/lib/types/render/projection.d.ts +95 -4
  28. package/lib/types/render/status.d.ts +8 -8
  29. package/lib/types/render/text.d.ts +6 -0
  30. package/lib/types/render/usage.d.ts +113 -0
  31. package/lib/types/session-directory.d.ts +17 -0
  32. package/lib/types/startup.d.ts +1 -1
  33. package/lib/types/terminal-title.d.ts +8 -0
  34. package/lib/types/theme-panel.d.ts +2 -2
  35. package/lib/types/theme.d.ts +271 -52
  36. package/lib/types/update-panel.d.ts +5 -5
  37. package/lib/types/update.d.ts +10 -1
  38. package/lib/types/version.d.ts +4 -3
  39. package/package.json +24 -7
  40. package/src/app.ts +1155 -478
  41. package/src/approval.ts +166 -166
  42. package/src/authorization-panel.ts +19 -16
  43. package/src/editor-keys.ts +371 -371
  44. package/src/git-workflow.ts +229 -3
  45. package/src/i18n.ts +68 -0
  46. package/src/index.ts +412 -76
  47. package/src/input-split.ts +3 -3
  48. package/src/kernel-panels.ts +471 -89
  49. package/src/keyboard.ts +5 -4
  50. package/src/language-panel.ts +53 -0
  51. package/src/locales/en.ts +489 -0
  52. package/src/locales/zh.ts +488 -0
  53. package/src/mentions.ts +8 -4
  54. package/src/models.ts +264 -212
  55. package/src/panel-accent.ts +41 -0
  56. package/src/presets.ts +1 -1
  57. package/src/provider-settings.ts +1 -1
  58. package/src/rainbow.ts +208 -0
  59. package/src/render/animations.ts +104 -6
  60. package/src/render/editor.ts +20 -20
  61. package/src/render/export.ts +116 -95
  62. package/src/render/inspector.ts +42 -0
  63. package/src/render/lines.ts +628 -415
  64. package/src/render/markdown.ts +15 -3
  65. package/src/render/projection.ts +429 -19
  66. package/src/render/status.ts +41 -35
  67. package/src/render/text.ts +14 -0
  68. package/src/render/tool-preview.ts +77 -77
  69. package/src/render/usage.ts +430 -0
  70. package/src/render/width.ts +2 -2
  71. package/src/session-directory.ts +8 -6
  72. package/src/session-query.ts +8 -4
  73. package/src/startup.ts +3 -3
  74. package/src/subagents.ts +229 -229
  75. package/src/terminal-title.ts +22 -5
  76. package/src/theme-panel.ts +17 -21
  77. package/src/theme.ts +281 -33
  78. package/src/update-panel.ts +37 -27
  79. package/src/update.ts +19 -3
  80. package/src/version.ts +58 -20
  81. package/src/whale-glyph.ts +23 -23
@@ -1,5 +1,5 @@
1
1
  import os from "node:os";
2
- import process from "node:process";
2
+ import process$1 from "node:process";
3
3
  import tty from "node:tty";
4
4
  //#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
5
5
  const ANSI_BACKGROUND_OFFSET = 10;
@@ -166,13 +166,13 @@ function assembleStyles() {
166
166
  const ansiStyles = assembleStyles();
167
167
  //#endregion
168
168
  //#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
169
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
169
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
170
170
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
171
171
  const position = argv.indexOf(prefix + flag);
172
172
  const terminatorPosition = argv.indexOf("--");
173
173
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
174
174
  }
175
- const { env: env$1 } = process;
175
+ const { env: env$1 } = process$1;
176
176
  let flagForceColor;
177
177
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
178
178
  else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
@@ -205,7 +205,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
205
205
  if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
206
206
  const min = forceColor || 0;
207
207
  if (env$1.TERM === "dumb") return min;
208
- if (process.platform === "win32") {
208
+ if (process$1.platform === "win32") {
209
209
  const osRelease = os.release().split(".");
210
210
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
211
211
  return 1;
@@ -403,6 +403,244 @@ Object.defineProperties(createChalk.prototype, styles);
403
403
  const chalk = createChalk();
404
404
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
405
405
  //#endregion
406
+ //#region src/rainbow.ts
407
+ /**
408
+ * The bright-tier spectrum: twelve Tailwind *-300 hues covering red through
409
+ * fuchsia, every one ≥11:1 on black. The roll samples this pool by shuffle;
410
+ * nothing outside it is ever painted.
411
+ */
412
+ const RAINBOW_POOL = [
413
+ [
414
+ 252,
415
+ 165,
416
+ 165
417
+ ],
418
+ [
419
+ 253,
420
+ 186,
421
+ 116
422
+ ],
423
+ [
424
+ 253,
425
+ 230,
426
+ 138
427
+ ],
428
+ [
429
+ 253,
430
+ 224,
431
+ 71
432
+ ],
433
+ [
434
+ 190,
435
+ 242,
436
+ 100
437
+ ],
438
+ [
439
+ 134,
440
+ 239,
441
+ 172
442
+ ],
443
+ [
444
+ 94,
445
+ 234,
446
+ 212
447
+ ],
448
+ [
449
+ 103,
450
+ 232,
451
+ 249
452
+ ],
453
+ [
454
+ 125,
455
+ 211,
456
+ 252
457
+ ],
458
+ [
459
+ 147,
460
+ 197,
461
+ 253
462
+ ],
463
+ [
464
+ 196,
465
+ 181,
466
+ 253
467
+ ],
468
+ [
469
+ 240,
470
+ 171,
471
+ 252
472
+ ]
473
+ ];
474
+ /**
475
+ * Status tones in canonical on-screen order (row one left-to-right, then row
476
+ * two): consecutive entries here are the pairs the "adjacent spans differ"
477
+ * guarantee covers, including the accent→value step across the row boundary.
478
+ */
479
+ const TONE_ORDER = [
480
+ "live",
481
+ "model",
482
+ "path",
483
+ "branch",
484
+ "accent",
485
+ "value",
486
+ "label",
487
+ "meta",
488
+ "ctxFill",
489
+ "success",
490
+ "plan",
491
+ "warn",
492
+ "error"
493
+ ];
494
+ /** Parse a RAINBOW_SEED value: a non-negative decimal uint32, else nothing. */
495
+ function parseRainbowSeed(value) {
496
+ if (value === void 0 || !/^\d{1,10}$/.test(value.trim())) return void 0;
497
+ const parsed = Number(value.trim());
498
+ return Number.isSafeInteger(parsed) ? parsed >>> 0 : void 0;
499
+ }
500
+ /**
501
+ * One parsed `/rainbow` argument: empty means a fresh random roll; a
502
+ * decimal uint32 pins that seed; anything else is a usage error.
503
+ * @param argument - the raw text after `/rainbow`.
504
+ * @returns `{ seed }`, `'random'`, or `'usage'`.
505
+ */
506
+ function parseRainbowArgument(argument) {
507
+ const trimmed = argument.trim();
508
+ if (trimmed === "") return "random";
509
+ const parsed = parseRainbowSeed(trimmed);
510
+ return parsed === void 0 ? "usage" : { seed: parsed };
511
+ }
512
+ /** Deterministic 32-bit RNG (mulberry32) — one roll, one stream. */
513
+ function mulberry32(seed) {
514
+ let state = seed >>> 0;
515
+ return () => {
516
+ state = state + 1831565813 | 0;
517
+ let t = Math.imul(state ^ state >>> 15, 1 | state);
518
+ t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
519
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
520
+ };
521
+ }
522
+ /** Fisher–Yates shuffle over a copy, driven by the roll's RNG. */
523
+ function shuffle(items, rng) {
524
+ const out = [...items];
525
+ for (let i = out.length - 1; i > 0; i -= 1) {
526
+ const j = Math.floor(rng() * (i + 1));
527
+ [out[i], out[j]] = [out[j], out[i]];
528
+ }
529
+ return out;
530
+ }
531
+ /** Approximate HSL hue of one RGB triple, degrees in [0, 360). */
532
+ function hueOf([r, g, b]) {
533
+ const max = Math.max(r, g, b);
534
+ const min = Math.min(r, g, b);
535
+ if (max === min) return 0;
536
+ const span = max - min;
537
+ if (max === r) return (60 * (g - b) / span + 360) % 360;
538
+ if (max === g) return (60 * (b - r) / span + 120) % 360;
539
+ return (60 * (r - g) / span + 240) % 360;
540
+ }
541
+ /** A dark row tint for diff backgrounds: the hue at 22% strength over black. */
542
+ function darkTint(hue) {
543
+ return [
544
+ Math.round(hue[0] * .22),
545
+ Math.round(hue[1] * .22),
546
+ Math.round(hue[2] * .22)
547
+ ];
548
+ }
549
+ /** Readability anchors shared by every roll: captions, text, band stay calm. */
550
+ const DIM = [
551
+ 166,
552
+ 163,
553
+ 184
554
+ ];
555
+ const TEXT = [
556
+ 240,
557
+ 238,
558
+ 249
559
+ ];
560
+ const BAND = [
561
+ 46,
562
+ 46,
563
+ 52
564
+ ];
565
+ /**
566
+ * Build the roll for one seed: pure and deterministic, so tests pin exact
567
+ * outcomes and RAINBOW_SEED reproduces a lucky launch exactly.
568
+ * @param seed - the uint32 seed to roll from.
569
+ * @returns the complete carnival roll.
570
+ */
571
+ function rollRainbow(seed) {
572
+ const rng = mulberry32(seed);
573
+ const pool = shuffle(RAINBOW_POOL, rng);
574
+ const [brand, brandBright, brandMid, brandDeep, code, success, error, warn, addHue, delHue] = pool;
575
+ const palette = {
576
+ brand,
577
+ brandBright,
578
+ brandMid,
579
+ brandDeep,
580
+ dim: DIM,
581
+ success,
582
+ error,
583
+ warn,
584
+ text: TEXT,
585
+ code,
586
+ composerBand: BAND,
587
+ diffAdd: darkTint(addHue),
588
+ diffDel: darkTint(delHue),
589
+ diffAddFg: addHue,
590
+ diffDelFg: delHue,
591
+ surface: [
592
+ 0,
593
+ 0,
594
+ 0
595
+ ],
596
+ prompt: brandBright,
597
+ queued: warn,
598
+ steered: code
599
+ };
600
+ const ring = shuffle(RAINBOW_POOL, rng).slice(0, 4);
601
+ const offset = Math.floor(rng() * RAINBOW_POOL.length);
602
+ const toneColors = {};
603
+ TONE_ORDER.forEach((tone, index) => {
604
+ toneColors[tone] = pool[(offset + index) % pool.length];
605
+ });
606
+ return {
607
+ seed,
608
+ palette,
609
+ ring,
610
+ toneColors,
611
+ flowAnchors: [...RAINBOW_POOL].sort((a, b) => hueOf(a) - hueOf(b)),
612
+ flowPhaseMs: Math.floor(rng() * 2400)
613
+ };
614
+ }
615
+ /** The launch seed: RAINBOW_SEED when parseable, else a fresh random roll. */
616
+ function launchSeed() {
617
+ const pinned = parseRainbowSeed(process.env.RAINBOW_SEED);
618
+ if (pinned !== void 0) return pinned;
619
+ return (Date.now() ^ Math.floor(Math.random() * 4294967296)) >>> 0;
620
+ }
621
+ let rolled;
622
+ /** The memoized per-launch roll; computed once, stable for the whole run. */
623
+ function rainbowRoll() {
624
+ if (rolled === void 0) rolled = rollRainbow(launchSeed());
625
+ return rolled;
626
+ }
627
+ /**
628
+ * Replace the memoized roll: omit the seed for a fresh random one, or pass
629
+ * a uint32 to pin it. `/rainbow` uses this so a mid-session reroll actually
630
+ * recolors; {@link setTheme}(`'rainbow'`) must run afterwards so the
631
+ * palette accessor picks the new values up.
632
+ * @param seed - the seed to pin, or undefined for a new random roll.
633
+ * @returns the roll now in force.
634
+ */
635
+ function rerollRainbow(seed) {
636
+ rolled = rollRainbow(seed ?? (Date.now() ^ Math.floor(Math.random() * 4294967296)) >>> 0);
637
+ return rolled;
638
+ }
639
+ /** The current roll's seed as display copy (also the RAINBOW_SEED value). */
640
+ function rainbowSeedLabel() {
641
+ return String(rainbowRoll().seed);
642
+ }
643
+ //#endregion
406
644
  //#region src/theme.ts
407
645
  /**
408
646
  * Terminal color tokens for the dsh TUI, mapped from the product design
@@ -410,13 +648,12 @@ createChalk({ level: stderrColor ? stderrColor.level : 0 });
410
648
  * (`packages/client/ui-theme/src/styles/design-platform.css`). Truecolor RGB
411
649
  * rides chalk, which degrades automatically on terminals without truecolor.
412
650
  *
413
- * Two palettes — `dark` (the default) and `light` — share the same token keys
414
- * with different values. Painters and the palette accessor read the ACTIVE
651
+ * Three palettes — `dark` (the default), `light`, and `prismatic` (the
652
+ * neon synthwave skin) share the same token keys with different values.
653
+ * Painters and the palette accessor read the ACTIVE
415
654
  * palette selected through {@link setTheme}, so a theme switch recolors every
416
- * painted surface on the next render without touching call sites. Raw token
417
- * consumers keep reading {@link TUI_RGB} (the dark values) until the
418
- * theme-aware integration replaces those call sites with
419
- * `inkColor(getPalette().token)`.
655
+ * painted surface on the next render without touching call sites; consumers
656
+ * read colors through {@link getPalette} or the painters below only.
420
657
  *
421
658
  * @module @deepseek-ai/dsh-tui/theme
422
659
  */
@@ -424,9 +661,43 @@ createChalk({ level: stderrColor ? stderrColor.level : 0 });
424
661
  const THEME_NAMES = [
425
662
  "dark",
426
663
  "light",
664
+ "prismatic",
665
+ "rainbow",
427
666
  "auto"
428
667
  ];
429
668
  /**
669
+ * Every theme's picker metadata in canonical order — the single source the
670
+ * /theme panel rows derive from; {@link THEME_NAMES} stays the validation
671
+ * list. Adding a theme means adding its palette plus one row here.
672
+ */
673
+ const THEMES = [
674
+ {
675
+ id: "dark",
676
+ label: "dark",
677
+ description: "DeepSeek dark palette (default)"
678
+ },
679
+ {
680
+ id: "light",
681
+ label: "light",
682
+ description: "light palette for bright terminals"
683
+ },
684
+ {
685
+ id: "prismatic",
686
+ label: "prismatic",
687
+ description: "neon synthwave palette (violet/magenta/cyan)"
688
+ },
689
+ {
690
+ id: "rainbow",
691
+ label: "rainbow",
692
+ description: "randomized carnival palette (/rainbow to reroll)"
693
+ },
694
+ {
695
+ id: "auto",
696
+ label: "auto",
697
+ description: "follow the terminal; dark until detection lands"
698
+ }
699
+ ];
700
+ /**
430
701
  * DeepSeek dark palette: the original TUI colors, one entry per
431
702
  * design-platform token in use. Keep names and values in sync with the CSS
432
703
  * custom properties cited inline.
@@ -497,13 +768,67 @@ const DARK_PALETTE = {
497
768
  46,
498
769
  48,
499
770
  52
771
+ ],
772
+ /** Diff added-line background — Codex's muted dark green tint (#213A2B). */
773
+ diffAdd: [
774
+ 33,
775
+ 58,
776
+ 43
777
+ ],
778
+ /** Diff removed-line background — Codex's muted dark red tint (#4A221D). */
779
+ diffDel: [
780
+ 74,
781
+ 34,
782
+ 29
783
+ ],
784
+ /** Diff added-line foreground — green-500, 5.4:1 on the diffAdd tint. */
785
+ diffAddFg: [
786
+ 34,
787
+ 197,
788
+ 94
789
+ ],
790
+ /** Diff removed-line foreground — red-400, 4.9:1 on the diffDel tint (error's red-500 sinks to 3.6:1 on it). */
791
+ diffDelFg: [
792
+ 248,
793
+ 113,
794
+ 113
795
+ ],
796
+ /** Terminal background this palette is designed against; row tints blend toward it. */
797
+ surface: [
798
+ 0,
799
+ 0,
800
+ 0
801
+ ],
802
+ /**
803
+ * The three prompt-row colors, one per delivery kind. They are the palette's
804
+ * own accents (bright brand, warning amber, violet) rather than fixed RGBs,
805
+ * and every row's bar is these colors laid over {@link surface}.
806
+ */
807
+ prompt: [
808
+ 103,
809
+ 158,
810
+ 254
811
+ ],
812
+ queued: [
813
+ 245,
814
+ 158,
815
+ 11
816
+ ],
817
+ steered: [
818
+ 167,
819
+ 139,
820
+ 250
500
821
  ]
501
822
  };
502
- /** Every palette by theme name; auto resolves through {@link resolveTheme}. */
823
+ /**
824
+ * Every STATIC palette by theme name; auto resolves through {@link resolveTheme}
825
+ * and rainbow is rolled per launch ({@link rainbowRoll}), so neither lives
826
+ * here — {@link setTheme} resolves both through the same key space.
827
+ */
503
828
  const PALETTES = {
504
829
  dark: DARK_PALETTE,
505
830
  light: {
506
- /** Primary brand blue — unchanged, ≈4.9:1 AA on white. */
831
+ /** Primary brand blue — unchanged design-platform value; ≈4.2:1 on white, so bold/accent spans only (body-size brand text uses brandBright). */
507
832
  brand: [
508
833
  65,
509
834
  118,
@@ -568,6 +893,170 @@ const PALETTES = {
568
893
  229,
569
894
  231,
570
895
  235
896
+ ],
897
+ /** Diff added-line background — GitHub's pastel green (#dafbe1), Codex's light pick. */
898
+ diffAdd: [
899
+ 218,
900
+ 251,
901
+ 225
902
+ ],
903
+ /** Diff removed-line background — GitHub's pastel red (#ffebe9), Codex's light pick. */
904
+ diffDel: [
905
+ 255,
906
+ 235,
907
+ 233
908
+ ],
909
+ /** Diff added-line foreground — green-800, 6.4:1 on the pastel tint (green-700 clears 4.5:1 by a hair). */
910
+ diffAddFg: [
911
+ 22,
912
+ 101,
913
+ 52
914
+ ],
915
+ /** Diff removed-line foreground — red-700, 5.6:1 on the pastel tint (error's red-600 is 3.9:1). */
916
+ diffDelFg: [
917
+ 185,
918
+ 28,
919
+ 28
920
+ ],
921
+ /** Terminal background this palette is designed against; row tints blend toward it. */
922
+ surface: [
923
+ 255,
924
+ 255,
925
+ 255
926
+ ],
927
+ /**
928
+ * Prompt-row colors deepened for white: the amber and violet the dark theme
929
+ * uses sit at the AA edge on their own pastel bars, so each kind carries a
930
+ * value that clears 4.5:1 both on the bar and on plain white.
931
+ */
932
+ prompt: [
933
+ 47,
934
+ 76,
935
+ 143
936
+ ],
937
+ queued: [
938
+ 124,
939
+ 53,
940
+ 10
941
+ ],
942
+ steered: [
943
+ 109,
944
+ 40,
945
+ 217
946
+ ]
947
+ },
948
+ prismatic: {
949
+ /** Primary electric purple — violet-500 (#8B5CF6), 5.0:1 on black. */
950
+ brand: [
951
+ 139,
952
+ 92,
953
+ 246
954
+ ],
955
+ /** Live/streaming emphasis — neon fuchsia-300 (#F0ABFC), 11.9:1 on black. */
956
+ brandBright: [
957
+ 240,
958
+ 171,
959
+ 252
960
+ ],
961
+ /** Intermediate violet — violet-400 (#A78BFA), 7.7:1 on black. */
962
+ brandMid: [
963
+ 167,
964
+ 139,
965
+ 250
966
+ ],
967
+ /** Deep secondary chrome — violet-600 (#7C3AED), 3.7:1 on black (violet-700 misses 3:1). */
968
+ brandDeep: [
969
+ 124,
970
+ 58,
971
+ 237
972
+ ],
973
+ /** Muted captions — lavender gray (#A6A3B8), 8.6:1 on black. */
974
+ dim: [
975
+ 166,
976
+ 163,
977
+ 184
978
+ ],
979
+ /** Success green — unchanged from dark. */
980
+ success: [
981
+ 34,
982
+ 197,
983
+ 94
984
+ ],
985
+ /** Error red — unchanged from dark. */
986
+ error: [
987
+ 239,
988
+ 68,
989
+ 68
990
+ ],
991
+ /** Warning amber — unchanged from dark. */
992
+ warn: [
993
+ 245,
994
+ 158,
995
+ 11
996
+ ],
997
+ /** Default foreground text — white with a lavender cast (#F0EEF9). */
998
+ text: [
999
+ 240,
1000
+ 238,
1001
+ 249
1002
+ ],
1003
+ /** Inline/fenced code — neon cyan-300 (#67E8F9), 14.5:1 on black. */
1004
+ code: [
1005
+ 103,
1006
+ 232,
1007
+ 249
1008
+ ],
1009
+ /** Composer three-row band base — neutral dark gray, hue-free so wave tints read on it. */
1010
+ composerBand: [
1011
+ 46,
1012
+ 46,
1013
+ 52
1014
+ ],
1015
+ /** Diff added-line background — unchanged from dark. */
1016
+ diffAdd: [
1017
+ 33,
1018
+ 58,
1019
+ 43
1020
+ ],
1021
+ /** Diff removed-line background — unchanged from dark. */
1022
+ diffDel: [
1023
+ 74,
1024
+ 34,
1025
+ 29
1026
+ ],
1027
+ /** Diff added-line foreground — unchanged from dark. */
1028
+ diffAddFg: [
1029
+ 34,
1030
+ 197,
1031
+ 94
1032
+ ],
1033
+ /** Diff removed-line foreground — unchanged from dark. */
1034
+ diffDelFg: [
1035
+ 248,
1036
+ 113,
1037
+ 113
1038
+ ],
1039
+ /** Terminal background this palette is designed against; row tints blend toward it. */
1040
+ surface: [
1041
+ 0,
1042
+ 0,
1043
+ 0
1044
+ ],
1045
+ /** Prompt rows in the skin's own neon: fuchsia, amber, cyan. */
1046
+ prompt: [
1047
+ 240,
1048
+ 171,
1049
+ 252
1050
+ ],
1051
+ queued: [
1052
+ 245,
1053
+ 158,
1054
+ 11
1055
+ ],
1056
+ steered: [
1057
+ 103,
1058
+ 232,
1059
+ 249
571
1060
  ]
572
1061
  }
573
1062
  };
@@ -578,12 +1067,13 @@ let activePalette = DARK_PALETTE;
578
1067
  /**
579
1068
  * Resolve a theme name to the palette actually in use. `auto` detection
580
1069
  * (OSC 11 terminal background query) is a later enhancement; until it lands,
581
- * auto falls back to the dark palette.
1070
+ * auto falls back to the dark palette (prismatic and rainbow are always
1071
+ * explicit choices, never auto-resolved).
582
1072
  * @param name - the requested theme name.
583
- * @returns 'dark' or 'light' — the palette key to paint with.
1073
+ * @returns 'dark', 'light', 'prismatic', or 'rainbow' — the palette key.
584
1074
  */
585
1075
  function resolveTheme(name) {
586
- return name === "light" ? "light" : "dark";
1076
+ return name === "light" ? "light" : name === "prismatic" ? "prismatic" : name === "rainbow" ? "rainbow" : "dark";
587
1077
  }
588
1078
  /**
589
1079
  * Switch the active theme: painters and {@link getPalette} reflect the new
@@ -593,7 +1083,8 @@ function resolveTheme(name) {
593
1083
  */
594
1084
  function setTheme(name) {
595
1085
  activeName = name;
596
- activePalette = PALETTES[resolveTheme(name)];
1086
+ const resolved = resolveTheme(name);
1087
+ activePalette = resolved === "rainbow" ? rainbowRoll().palette : PALETTES[resolved];
597
1088
  }
598
1089
  /**
599
1090
  * The theme name in force. Returns the requested name ('auto' included) so
@@ -608,21 +1099,167 @@ function getPalette() {
608
1099
  return activePalette;
609
1100
  }
610
1101
  /**
611
- * Parse a persisted theme name: only 'light' and 'auto' survive; anything
612
- * else (missing, corrupt, or unknown) falls back to the dark default.
1102
+ * Parse a persisted theme name: only names in {@link THEME_NAMES} survive;
1103
+ * anything else (missing, corrupt, or unknown) falls back to the dark default.
613
1104
  * @param value - the raw parsed JSON value (expected string).
614
1105
  * @returns a valid theme name.
615
1106
  */
616
1107
  function parseThemeName(value) {
617
- return value === "light" || value === "auto" ? value : "dark";
1108
+ return typeof value === "string" && THEME_NAMES.includes(value) ? value : "dark";
618
1109
  }
619
1110
  /** Ink `color` string for one RGB triple. */
620
1111
  function inkColor(triple) {
621
1112
  return `rgb(${triple[0]}, ${triple[1]}, ${triple[2]})`;
622
1113
  }
1114
+ /**
1115
+ * Diff-line background as an Ink `backgroundColor` string, theme-aware and
1116
+ * depth-gated (the Codex diff renderer's rule): 16-color terminals paint
1117
+ * backgrounds from the saturated system palette, which drowns the text, so
1118
+ * they keep the foreground-only look; 256-color and truecolor terminals get
1119
+ * the palette's tint (chalk quantizes the RGB form down automatically).
1120
+ * @param token - which diff background, added or removed lines.
1121
+ * @returns the Ink background color, or undefined to paint foreground-only.
1122
+ */
1123
+ function diffBackground(token) {
1124
+ if (chalk.level < 2) return void 0;
1125
+ return inkColor(activePalette[token]);
1126
+ }
1127
+ /** How far one prompt-row tint leans toward its color, over the surface. */
1128
+ const PROMPT_ROW_TINT = .22;
1129
+ /**
1130
+ * The color family one prompt row wears, chosen by how it was delivered: the
1131
+ * ordinary brand accent, the warning amber for a queued prompt, and the
1132
+ * palette's own third accent for a steered one. The bar behind it is derived
1133
+ * from that same color, so every theme — including a freshly rolled rainbow —
1134
+ * carries its own look instead of a fixed triple.
1135
+ * @param delivery - how the prompt was delivered; undefined is an ordinary one.
1136
+ * @returns the palette token whose color paints the row.
1137
+ */
1138
+ function promptRowTokens(delivery) {
1139
+ if (delivery === "queued") return { fg: "queued" };
1140
+ if (delivery === "steered") return { fg: "steered" };
1141
+ return { fg: "prompt" };
1142
+ }
1143
+ /**
1144
+ * Blended prompt-row background for one row color: the palette color laid
1145
+ * over the surface the palette is designed for (dark themes over black, light
1146
+ * over white), depth-gated exactly like {@link diffBackground} — a 16-color
1147
+ * terminal keeps the foreground-only look rather than painting a saturated
1148
+ * system background behind the text.
1149
+ * @param color - the row's palette token.
1150
+ * @returns the Ink background color, or undefined to paint foreground-only.
1151
+ */
1152
+ function rowBackground(color) {
1153
+ if (chalk.level < 2) return void 0;
1154
+ const surface = activePalette.surface;
1155
+ const tint = activePalette[color];
1156
+ const blend = (index) => Math.round(surface[index] + (tint[index] - surface[index]) * PROMPT_ROW_TINT);
1157
+ return inkColor([
1158
+ blend(0),
1159
+ blend(1),
1160
+ blend(2)
1161
+ ]);
1162
+ }
1163
+ /**
1164
+ * The prismatic surface ring: four neon accents panels cycle through by
1165
+ * mount order (cyan → fuchsia → violet → lime), all ≥3:1 on black. Dark and
1166
+ * light ignore the ring — {@link surfaceAccent} falls back to the passed-in
1167
+ * base color so those themes stay pixel-identical.
1168
+ */
1169
+ const ACCENT_RING = [
1170
+ [
1171
+ 34,
1172
+ 211,
1173
+ 238
1174
+ ],
1175
+ [
1176
+ 232,
1177
+ 121,
1178
+ 249
1179
+ ],
1180
+ [
1181
+ 167,
1182
+ 139,
1183
+ 250
1184
+ ],
1185
+ [
1186
+ 163,
1187
+ 230,
1188
+ 53
1189
+ ]
1190
+ ];
1191
+ /**
1192
+ * The prismatic flow anchors: brand violet → neon fuchsia → neon cyan. All
1193
+ * three clear 4.5:1 on black, so a flowing foreground stays AA throughout
1194
+ * the oscillation (render/animations.ts walks the triangle).
1195
+ */
1196
+ const FLOW_ANCHORS = [
1197
+ [
1198
+ 139,
1199
+ 92,
1200
+ 246
1201
+ ],
1202
+ [
1203
+ 232,
1204
+ 121,
1205
+ 249
1206
+ ],
1207
+ [
1208
+ 34,
1209
+ 211,
1210
+ 238
1211
+ ]
1212
+ ];
1213
+ /**
1214
+ * Whether the active theme is prismatic (the neon skin with surface rings
1215
+ * and flowing accents).
1216
+ */
1217
+ function isPrismatic() {
1218
+ return activeName === "prismatic";
1219
+ }
1220
+ /** Whether the active theme is rainbow (the per-launch carnival roll). */
1221
+ function isRainbow() {
1222
+ return activeName === "rainbow";
1223
+ }
1224
+ /**
1225
+ * The flowing theme's anchor walk: prismatic rides the fixed violet→fuchsia→
1226
+ * cyan triangle; rainbow rides its rolled full-spectrum anchors with a random
1227
+ * phase; dark and light have no flow (undefined) and keep static accents.
1228
+ */
1229
+ function themeFlow() {
1230
+ if (isPrismatic()) return {
1231
+ anchors: FLOW_ANCHORS,
1232
+ phaseMs: 0
1233
+ };
1234
+ if (isRainbow()) {
1235
+ const roll = rainbowRoll();
1236
+ return {
1237
+ anchors: roll.flowAnchors,
1238
+ phaseMs: roll.flowPhaseMs
1239
+ };
1240
+ }
1241
+ }
1242
+ /**
1243
+ * The accent for one surface slot: prismatic rotates the {@link ACCENT_RING}
1244
+ * by slot index; every other theme gets the caller's base color back.
1245
+ * @param index - the slot's position in the mount-order sequence.
1246
+ * @param base - the color to use outside prismatic (the surface's usual one).
1247
+ * @returns the accent to paint the surface's border/title with.
1248
+ */
1249
+ function surfaceAccent(index, base) {
1250
+ if (isPrismatic()) {
1251
+ const ring = ACCENT_RING;
1252
+ return ring[(index % ring.length + ring.length) % ring.length];
1253
+ }
1254
+ if (isRainbow()) {
1255
+ const ring = rainbowRoll().ring;
1256
+ return ring[(index % ring.length + ring.length) % ring.length];
1257
+ }
1258
+ return base;
1259
+ }
623
1260
  /** Paint muted captions, hints, and meta lines. */
624
1261
  function dim(text) {
625
1262
  return chalk.rgb(...activePalette.dim)(text);
626
1263
  }
627
1264
  //#endregion
628
- export { inkColor as a, chalk as c, getTheme as i, dim as n, parseThemeName as o, getPalette as r, setTheme as s, THEME_NAMES as t };
1265
+ export { parseRainbowArgument as _, dim as a, rerollRainbow as b, inkColor as c, parseThemeName as d, promptRowTokens as f, themeFlow as g, surfaceAccent as h, diffBackground as i, isPrismatic as l, setTheme as m, THEMES as n, getPalette as o, rowBackground as p, THEME_NAMES as r, getTheme as s, FLOW_ANCHORS as t, isRainbow as u, rainbowRoll as v, chalk as x, rainbowSeedLabel as y };