@chances-ai/tui 12.0.0 → 14.0.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 (69) hide show
  1. package/dist/api-key-prompt.d.ts +1 -0
  2. package/dist/api-key-prompt.d.ts.map +1 -1
  3. package/dist/api-key-prompt.js +3 -1
  4. package/dist/api-key-prompt.js.map +1 -1
  5. package/dist/app.d.ts +14 -16
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +87 -69
  8. package/dist/app.js.map +1 -1
  9. package/dist/code-view.d.ts +9 -0
  10. package/dist/code-view.d.ts.map +1 -0
  11. package/dist/code-view.js +28 -0
  12. package/dist/code-view.js.map +1 -0
  13. package/dist/diff-model.d.ts +64 -0
  14. package/dist/diff-model.d.ts.map +1 -0
  15. package/dist/diff-model.js +156 -0
  16. package/dist/diff-model.js.map +1 -0
  17. package/dist/diff-view.d.ts +13 -0
  18. package/dist/diff-view.d.ts.map +1 -0
  19. package/dist/diff-view.js +60 -0
  20. package/dist/diff-view.js.map +1 -0
  21. package/dist/frame-scheduler.d.ts +44 -0
  22. package/dist/frame-scheduler.d.ts.map +1 -0
  23. package/dist/frame-scheduler.js +58 -0
  24. package/dist/frame-scheduler.js.map +1 -0
  25. package/dist/highlight-to-segments.d.ts +18 -0
  26. package/dist/highlight-to-segments.d.ts.map +1 -0
  27. package/dist/highlight-to-segments.js +224 -0
  28. package/dist/highlight-to-segments.js.map +1 -0
  29. package/dist/index.d.ts +13 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +14 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/markdown.d.ts +5 -0
  34. package/dist/markdown.d.ts.map +1 -0
  35. package/dist/markdown.js +117 -0
  36. package/dist/markdown.js.map +1 -0
  37. package/dist/model-picker.d.ts +1 -0
  38. package/dist/model-picker.d.ts.map +1 -1
  39. package/dist/model-picker.js +4 -2
  40. package/dist/model-picker.js.map +1 -1
  41. package/dist/progress.d.ts +41 -0
  42. package/dist/progress.d.ts.map +1 -0
  43. package/dist/progress.js +122 -0
  44. package/dist/progress.js.map +1 -0
  45. package/dist/session-picker.d.ts +1 -0
  46. package/dist/session-picker.d.ts.map +1 -1
  47. package/dist/session-picker.js +4 -2
  48. package/dist/session-picker.js.map +1 -1
  49. package/dist/theme-context.d.ts +25 -0
  50. package/dist/theme-context.d.ts.map +1 -0
  51. package/dist/theme-context.js +24 -0
  52. package/dist/theme-context.js.map +1 -0
  53. package/dist/theme.d.ts +106 -0
  54. package/dist/theme.d.ts.map +1 -0
  55. package/dist/theme.js +116 -0
  56. package/dist/theme.js.map +1 -0
  57. package/dist/tool-line.d.ts +33 -0
  58. package/dist/tool-line.d.ts.map +1 -0
  59. package/dist/tool-line.js +168 -0
  60. package/dist/tool-line.js.map +1 -0
  61. package/dist/tool-message.d.ts +18 -0
  62. package/dist/tool-message.d.ts.map +1 -0
  63. package/dist/tool-message.js +37 -0
  64. package/dist/tool-message.js.map +1 -0
  65. package/dist/view-model.d.ts +135 -3
  66. package/dist/view-model.d.ts.map +1 -1
  67. package/dist/view-model.js +292 -31
  68. package/dist/view-model.js.map +1 -1
  69. package/package.json +10 -6
@@ -0,0 +1,106 @@
1
+ /**
2
+ * (5.9 / v14) The single home for the TUI's visual-language literals: glyphs +
3
+ * color palettes. Pure module — NO React, NO Ink — so every consumer (the
4
+ * pure diff/highlight/markdown cores AND the components) reads one source and
5
+ * the constants are unit-testable in isolation. The React seam lives in
6
+ * `theme-context.tsx`.
7
+ *
8
+ * Colors are emitted as Ink-compatible `rgb(r,g,b)` strings; Ink renders them
9
+ * through chalk, which downsamples truecolor → 256/16 by the terminal's
10
+ * detected level. We therefore keep ONE truecolor palette per mode and let
11
+ * chalk degrade — there is no hand-rolled 16-ANSI fallback table (5.9 §0).
12
+ *
13
+ * `NO_COLOR` (https://no-color.org) is honored explicitly here because chalk
14
+ * 5 / Ink 7 only read the `--no-color` *flag*, not the env var (codex R1
15
+ * MUST-2): when set, `resolveTheme` returns a palette whose every color is
16
+ * `undefined`, so components emit no `color`/`backgroundColor` and meaning is
17
+ * carried by glyphs + sigils alone (the diff `+`/`-`, the `⏺`/`⎿` shapes).
18
+ *
19
+ * Dark RGB values are the facts of claude-code's `darkTheme` visual language
20
+ * (verified `~/Projects/github/claude-code/src/utils/theme.ts`); light values
21
+ * track its `lightTheme`. Syntax colors are an OneDark-ish set legible on the
22
+ * respective background.
23
+ */
24
+ /** A resolved palette. Every field optional: `undefined` ⇒ emit no color for
25
+ * that role (terminal default fg / no bg). The NO_COLOR palette is all-undefined. */
26
+ export interface Theme {
27
+ /** Claude accent (orange). Running tool dot, top-level headings, links, spinner glyph. */
28
+ accent?: string;
29
+ /** Successful tool / ok states. */
30
+ success?: string;
31
+ /** Errors (dot, message body). */
32
+ error?: string;
33
+ /** Amber warnings. */
34
+ warning?: string;
35
+ /** Permission dialog rule + title. */
36
+ permission?: string;
37
+ /** Plan-mode badge. */
38
+ planMode?: string;
39
+ /** auto-edit / yolo badge (violet). */
40
+ autoAccept?: string;
41
+ /** Bash tool accent (pink). */
42
+ bashPink?: string;
43
+ /** Full-line diff backgrounds. */
44
+ diffAddedBg?: string;
45
+ diffRemovedBg?: string;
46
+ /** Word-level (intra-line) diff backgrounds — brighter than the line bg. */
47
+ diffAddedWordBg?: string;
48
+ diffRemovedWordBg?: string;
49
+ /** User-message bubble background. */
50
+ userMessageBg?: string;
51
+ /** Stalled-spinner red (interpolation target when no token for ~3s). */
52
+ stall?: string;
53
+ synKeyword?: string;
54
+ synString?: string;
55
+ synComment?: string;
56
+ synNumber?: string;
57
+ synFunction?: string;
58
+ synType?: string;
59
+ synLiteral?: string;
60
+ synTitle?: string;
61
+ synAttr?: string;
62
+ }
63
+ /** Theme selection as it arrives from config. `'auto'` resolves to `'dark'` in
64
+ * v14 (terminal-background detection is a later lever). */
65
+ export type ThemeSetting = "dark" | "light" | "auto";
66
+ /** `NO_COLOR` (https://no-color.org): present and NON-EMPTY ⇒ disable color,
67
+ * regardless of value. An empty string does NOT disable (per the spec). */
68
+ export declare function isNoColor(env?: NodeJS.ProcessEnv): boolean;
69
+ /**
70
+ * Resolve a palette. `NO_COLOR` wins over any setting; otherwise `'light'` →
71
+ * the light palette and `'dark'`/`'auto'`/undefined → dark.
72
+ */
73
+ export declare function resolveTheme(setting: ThemeSetting | undefined, env?: NodeJS.ProcessEnv): Theme;
74
+ export interface Glyphs {
75
+ /** Tool/turn status dot. `⏺` aligns well only on macOS terminals; `●`
76
+ * elsewhere (matches claude-code `figures.ts` BLACK_CIRCLE). */
77
+ dot: string;
78
+ /** Result continuation L-branch. */
79
+ branch: string;
80
+ /** Input + selection prompt caret. */
81
+ prompt: string;
82
+ /** Blockquote bar. */
83
+ blockquote: string;
84
+ /** Plan-mode badge symbol. */
85
+ plan: string;
86
+ /** Accept-edits / auto badge symbol. */
87
+ accept: string;
88
+ /** Success tick. */
89
+ tick: string;
90
+ /** Horizontal rule fill. */
91
+ hr: string;
92
+ /** Unordered-list bullet. */
93
+ bullet: string;
94
+ /** Progress "thinking" glyph (also the brightest spinner frame). */
95
+ thinking: string;
96
+ arrowDown: string;
97
+ arrowUp: string;
98
+ }
99
+ /** Build the glyph set for a platform. Exported as a function so tests can pin
100
+ * both the darwin (`⏺`) and non-darwin (`●`) dot without monkey-patching. */
101
+ export declare function makeGlyphs(platform?: NodeJS.Platform): Glyphs;
102
+ export declare const GLYPHS: Glyphs;
103
+ export declare const SPINNER_FRAMES: readonly string[];
104
+ /** Static glyph shown instead of the animation under reduced-motion / NO_COLOR. */
105
+ export declare const SPINNER_STATIC = "\u25CF";
106
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;sFACsF;AACtF,MAAM,WAAW,KAAK;IACpB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,C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AE,MAAM,CAAC,UAAwB,GACnC,KAAK,CAGP;AAED,MAAM,WAAW,MAAM;IACrB;qEACiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;8EAC8E;AAC9E,wBAAgB,UAAU,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,CAe/E;AAED,eAAO,MAAM,MAAM,EAAE,MAAqB,CAAC;AAK3C,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAsD,CAAC;AAEnG,mFAAmF;AACnF,eAAO,MAAM,cAAc,WAAM,CAAC"}
package/dist/theme.js ADDED
@@ -0,0 +1,116 @@
1
+ /**
2
+ * (5.9 / v14) The single home for the TUI's visual-language literals: glyphs +
3
+ * color palettes. Pure module — NO React, NO Ink — so every consumer (the
4
+ * pure diff/highlight/markdown cores AND the components) reads one source and
5
+ * the constants are unit-testable in isolation. The React seam lives in
6
+ * `theme-context.tsx`.
7
+ *
8
+ * Colors are emitted as Ink-compatible `rgb(r,g,b)` strings; Ink renders them
9
+ * through chalk, which downsamples truecolor → 256/16 by the terminal's
10
+ * detected level. We therefore keep ONE truecolor palette per mode and let
11
+ * chalk degrade — there is no hand-rolled 16-ANSI fallback table (5.9 §0).
12
+ *
13
+ * `NO_COLOR` (https://no-color.org) is honored explicitly here because chalk
14
+ * 5 / Ink 7 only read the `--no-color` *flag*, not the env var (codex R1
15
+ * MUST-2): when set, `resolveTheme` returns a palette whose every color is
16
+ * `undefined`, so components emit no `color`/`backgroundColor` and meaning is
17
+ * carried by glyphs + sigils alone (the diff `+`/`-`, the `⏺`/`⎿` shapes).
18
+ *
19
+ * Dark RGB values are the facts of claude-code's `darkTheme` visual language
20
+ * (verified `~/Projects/github/claude-code/src/utils/theme.ts`); light values
21
+ * track its `lightTheme`. Syntax colors are an OneDark-ish set legible on the
22
+ * respective background.
23
+ */
24
+ const darkTheme = {
25
+ accent: "rgb(215,119,87)",
26
+ success: "rgb(78,186,101)",
27
+ error: "rgb(255,107,128)",
28
+ warning: "rgb(255,193,7)",
29
+ permission: "rgb(177,185,249)",
30
+ planMode: "rgb(72,150,140)",
31
+ autoAccept: "rgb(175,135,255)",
32
+ bashPink: "rgb(253,93,177)",
33
+ diffAddedBg: "rgb(34,92,43)",
34
+ diffRemovedBg: "rgb(122,41,54)",
35
+ diffAddedWordBg: "rgb(56,166,96)",
36
+ diffRemovedWordBg: "rgb(179,89,107)",
37
+ userMessageBg: "rgb(55,55,55)",
38
+ stall: "rgb(171,43,63)",
39
+ synKeyword: "rgb(198,120,221)",
40
+ synString: "rgb(152,195,121)",
41
+ synComment: "rgb(106,115,125)",
42
+ synNumber: "rgb(209,154,102)",
43
+ synFunction: "rgb(97,175,239)",
44
+ synType: "rgb(229,192,123)",
45
+ synLiteral: "rgb(86,182,194)",
46
+ synTitle: "rgb(97,175,239)",
47
+ synAttr: "rgb(209,154,102)",
48
+ };
49
+ const lightTheme = {
50
+ accent: "rgb(215,119,87)",
51
+ success: "rgb(44,122,57)",
52
+ error: "rgb(171,43,63)",
53
+ warning: "rgb(150,108,30)",
54
+ permission: "rgb(87,105,247)",
55
+ planMode: "rgb(0,102,102)",
56
+ autoAccept: "rgb(135,0,255)",
57
+ bashPink: "rgb(255,0,135)",
58
+ diffAddedBg: "rgb(105,219,124)",
59
+ diffRemovedBg: "rgb(255,168,180)",
60
+ diffAddedWordBg: "rgb(47,157,68)",
61
+ diffRemovedWordBg: "rgb(209,69,75)",
62
+ userMessageBg: "rgb(240,240,240)",
63
+ stall: "rgb(171,43,63)",
64
+ synKeyword: "rgb(166,38,164)",
65
+ synString: "rgb(80,161,79)",
66
+ synComment: "rgb(160,161,167)",
67
+ synNumber: "rgb(152,104,1)",
68
+ synFunction: "rgb(64,120,242)",
69
+ synType: "rgb(193,132,1)",
70
+ synLiteral: "rgb(1,132,188)",
71
+ synTitle: "rgb(64,120,242)",
72
+ synAttr: "rgb(152,104,1)",
73
+ };
74
+ /** Every color undefined ⇒ no color props emitted (glyphs/sigils carry meaning). */
75
+ const noColorTheme = {};
76
+ /** `NO_COLOR` (https://no-color.org): present and NON-EMPTY ⇒ disable color,
77
+ * regardless of value. An empty string does NOT disable (per the spec). */
78
+ export function isNoColor(env = process.env) {
79
+ const v = env.NO_COLOR;
80
+ return typeof v === "string" && v.length > 0;
81
+ }
82
+ /**
83
+ * Resolve a palette. `NO_COLOR` wins over any setting; otherwise `'light'` →
84
+ * the light palette and `'dark'`/`'auto'`/undefined → dark.
85
+ */
86
+ export function resolveTheme(setting, env = process.env) {
87
+ if (isNoColor(env))
88
+ return noColorTheme;
89
+ return setting === "light" ? lightTheme : darkTheme;
90
+ }
91
+ /** Build the glyph set for a platform. Exported as a function so tests can pin
92
+ * both the darwin (`⏺`) and non-darwin (`●`) dot without monkey-patching. */
93
+ export function makeGlyphs(platform = process.platform) {
94
+ return {
95
+ dot: platform === "darwin" ? "⏺" : "●",
96
+ branch: "⎿",
97
+ prompt: "❯",
98
+ blockquote: "▎",
99
+ plan: "⏸",
100
+ accept: "⏵⏵",
101
+ tick: "✓",
102
+ hr: "─",
103
+ bullet: "•",
104
+ thinking: "✻",
105
+ arrowDown: "↓",
106
+ arrowUp: "↑",
107
+ };
108
+ }
109
+ export const GLYPHS = makeGlyphs();
110
+ /** Spinner pulse: 6 frames then their reverse = a 12-step in/out pulse
111
+ * (claude-code `Spinner.tsx` `[...frames, ...reversed]`). Tick ~120 ms. */
112
+ const SPINNER_BASE = ["·", "✢", "✱", "✶", "✻", "✽"];
113
+ export const SPINNER_FRAMES = [...SPINNER_BASE, ...[...SPINNER_BASE].reverse()];
114
+ /** Static glyph shown instead of the animation under reduced-motion / NO_COLOR. */
115
+ export const SPINNER_STATIC = "●";
116
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA+CH,MAAM,SAAS,GAAU;IACvB,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,iBAAiB;IAC1B,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,iBAAiB;IAC3B,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,iBAAiB;IAC3B,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,gBAAgB;IAC/B,eAAe,EAAE,gBAAgB;IACjC,iBAAiB,EAAE,iBAAiB;IACpC,aAAa,EAAE,eAAe;IAC9B,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,kBAAkB;IAC9B,SAAS,EAAE,kBAAkB;IAC7B,UAAU,EAAE,kBAAkB;IAC9B,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,iBAAiB;IAC7B,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE,kBAAkB;CAC5B,CAAC;AAEF,MAAM,UAAU,GAAU;IACxB,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,gBAAgB;IACvB,OAAO,EAAE,iBAAiB;IAC1B,UAAU,EAAE,iBA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GAAG;QACX,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,GAAG;QACP,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,GAAG;QACd,OAAO,EAAE,GAAG;KACb,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAW,UAAU,EAAE,CAAC;AAE3C;4EAC4E;AAC5E,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAsB,CAAC,GAAG,YAAY,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAEnG,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * (5.9 / v14) Pure view-side tool-call label. Renders `⏺ Name(argSummary)` —
3
+ * see `tool-message.tsx`. This is a MINIMAL, NON-AUTHORITATIVE label (codex R1
4
+ * SHOULD-1): it only echoes the call's own args (available on the `tool:call`
5
+ * bus event, which carries no `ToolContext`). It deliberately does NOT claim
6
+ * create-vs-overwrite, byte counts, or diffs — that fidelity comes only from
7
+ * the richer permission summary (`tool:permission`), which the view stashes
8
+ * and renders under the `⎿` branch (see `view-model.ts`).
9
+ *
10
+ * Pure `(name, args) => string`, so it is fully unit-testable without Ink.
11
+ */
12
+ /** Collapse a leading home-dir to `~`. `home` is injectable for deterministic
13
+ * tests; defaults to the real home directory. Handles both POSIX (`/`) and
14
+ * Windows (`\`) separators after the home prefix (codex R2 NICE-8). */
15
+ export declare function homeRelative(path: string, home?: string): string;
16
+ /** Display name for a tool: builtin names verbatim; `mcp__<server>__<tool>`
17
+ * shown as `<server›>`. Edit/write get a claude-code-style verb. */
18
+ export declare function toolDisplayName(name: string): string;
19
+ /** `mcp__<server>__<tool>` → `{server, tool}`; null for non-MCP or malformed
20
+ * names (empty server — codex R2 NICE-9). A `mcp__<server>` with no `__tool`
21
+ * is allowed (server-level), but an empty server component is rejected. */
22
+ export declare function parseMcpName(name: string): {
23
+ server: string;
24
+ tool: string;
25
+ } | null;
26
+ /**
27
+ * The parenthesized argument summary for the header. Empty string ⇒ the header
28
+ * renders just `⏺ Name` with no parens.
29
+ */
30
+ export declare function formatToolCall(name: string, args: unknown, opts?: {
31
+ home?: string;
32
+ }): string;
33
+ //# sourceMappingURL=tool-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-line.d.ts","sourceRoot":"","sources":["../src/tool-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH;;wEAEwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkB,GAAG,MAAM,CAO3E;AAQD;qEACqE;AACrE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmCpD;AAED;;4EAE4E;AAC5E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOlF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAsD5F"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * (5.9 / v14) Pure view-side tool-call label. Renders `⏺ Name(argSummary)` —
3
+ * see `tool-message.tsx`. This is a MINIMAL, NON-AUTHORITATIVE label (codex R1
4
+ * SHOULD-1): it only echoes the call's own args (available on the `tool:call`
5
+ * bus event, which carries no `ToolContext`). It deliberately does NOT claim
6
+ * create-vs-overwrite, byte counts, or diffs — that fidelity comes only from
7
+ * the richer permission summary (`tool:permission`), which the view stashes
8
+ * and renders under the `⎿` branch (see `view-model.ts`).
9
+ *
10
+ * Pure `(name, args) => string`, so it is fully unit-testable without Ink.
11
+ */
12
+ import { homedir } from "node:os";
13
+ /** Read a string property from an unknown JSON args bag, or "" if absent. */
14
+ function s(args, key) {
15
+ if (args && typeof args === "object" && key in args) {
16
+ const v = args[key];
17
+ if (typeof v === "string")
18
+ return v;
19
+ if (typeof v === "number" || typeof v === "boolean")
20
+ return String(v);
21
+ }
22
+ return "";
23
+ }
24
+ /** Collapse a leading home-dir to `~`. `home` is injectable for deterministic
25
+ * tests; defaults to the real home directory. Handles both POSIX (`/`) and
26
+ * Windows (`\`) separators after the home prefix (codex R2 NICE-8). */
27
+ export function homeRelative(path, home = homedir()) {
28
+ if (!path || !home)
29
+ return path;
30
+ if (path === home)
31
+ return "~";
32
+ if (path.startsWith(`${home}/`) || path.startsWith(`${home}\\`)) {
33
+ return `~${path.slice(home.length)}`;
34
+ }
35
+ return path;
36
+ }
37
+ /** Truncate a single-line value for the inline label. */
38
+ function clip(text, max = 60) {
39
+ const oneLine = text.replace(/\s+/g, " ").trim();
40
+ return oneLine.length <= max ? oneLine : `${oneLine.slice(0, max - 1)}…`;
41
+ }
42
+ /** Display name for a tool: builtin names verbatim; `mcp__<server>__<tool>`
43
+ * shown as `<server›>`. Edit/write get a claude-code-style verb. */
44
+ export function toolDisplayName(name) {
45
+ const mcp = parseMcpName(name);
46
+ if (mcp)
47
+ return mcp.server;
48
+ switch (name) {
49
+ case "edit":
50
+ return "Edit";
51
+ case "write":
52
+ return "Write";
53
+ case "read":
54
+ return "Read";
55
+ case "bash":
56
+ return "Bash";
57
+ case "grep":
58
+ return "Grep";
59
+ case "glob":
60
+ return "Glob";
61
+ case "diff":
62
+ return "Diff";
63
+ case "web_fetch":
64
+ return "Fetch";
65
+ case "task":
66
+ return "Task";
67
+ case "lsp":
68
+ return "Lsp";
69
+ case "pty":
70
+ return "Pty";
71
+ case "memory_save":
72
+ return "Memory";
73
+ case "memory_delete":
74
+ return "Memory";
75
+ case "memory_list":
76
+ return "Memory";
77
+ default:
78
+ return name;
79
+ }
80
+ }
81
+ /** `mcp__<server>__<tool>` → `{server, tool}`; null for non-MCP or malformed
82
+ * names (empty server — codex R2 NICE-9). A `mcp__<server>` with no `__tool`
83
+ * is allowed (server-level), but an empty server component is rejected. */
84
+ export function parseMcpName(name) {
85
+ if (!name.startsWith("mcp__"))
86
+ return null;
87
+ const rest = name.slice("mcp__".length);
88
+ const sep = rest.indexOf("__");
89
+ const server = sep < 0 ? rest : rest.slice(0, sep);
90
+ if (server.length === 0)
91
+ return null;
92
+ return { server, tool: sep < 0 ? "" : rest.slice(sep + 2) };
93
+ }
94
+ /**
95
+ * The parenthesized argument summary for the header. Empty string ⇒ the header
96
+ * renders just `⏺ Name` with no parens.
97
+ */
98
+ export function formatToolCall(name, args, opts) {
99
+ const home = opts?.home;
100
+ const rel = (p) => homeRelative(p, home ?? homedir());
101
+ const mcp = parseMcpName(name);
102
+ if (mcp)
103
+ return mcp.tool;
104
+ switch (name) {
105
+ case "read":
106
+ case "edit":
107
+ case "write":
108
+ case "diff":
109
+ return clip(rel(s(args, "path")));
110
+ case "bash": {
111
+ const desc = s(args, "description");
112
+ return clip(desc || s(args, "command"));
113
+ }
114
+ case "grep": {
115
+ const pattern = s(args, "pattern");
116
+ const path = s(args, "path");
117
+ return clip(path ? `${pattern} in ${rel(path)}` : pattern);
118
+ }
119
+ case "glob": {
120
+ const pattern = s(args, "pattern");
121
+ const path = s(args, "path");
122
+ return clip(path ? `${pattern} in ${rel(path)}` : pattern);
123
+ }
124
+ case "web_fetch":
125
+ return clip(s(args, "url"));
126
+ case "task": {
127
+ const sub = s(args, "subagent_type");
128
+ const desc = s(args, "description");
129
+ return clip([sub, desc].filter(Boolean).join(": ") || desc || sub);
130
+ }
131
+ case "lsp": {
132
+ const op = s(args, "op");
133
+ const path = s(args, "path");
134
+ const query = s(args, "query");
135
+ const detail = path ? rel(path) : query;
136
+ return clip([op, detail].filter(Boolean).join(" "));
137
+ }
138
+ case "pty": {
139
+ const op = s(args, "op");
140
+ const cmd = s(args, "command");
141
+ return clip([op, cmd].filter(Boolean).join(" "));
142
+ }
143
+ case "memory_save":
144
+ case "memory_delete":
145
+ return clip(s(args, "name"));
146
+ case "memory_list":
147
+ return clip(s(args, "scope"));
148
+ default:
149
+ return compactArgs(args);
150
+ }
151
+ }
152
+ /** Fallback for unknown tools: a compact `key=value` join of scalar args. */
153
+ function compactArgs(args) {
154
+ if (!args || typeof args !== "object")
155
+ return "";
156
+ const parts = [];
157
+ for (const [k, v] of Object.entries(args)) {
158
+ if (v === null || v === undefined)
159
+ continue;
160
+ if (typeof v === "object")
161
+ continue; // skip nested for a one-liner
162
+ parts.push(`${k}=${String(v)}`);
163
+ if (parts.length >= 3)
164
+ break;
165
+ }
166
+ return clip(parts.join(" "));
167
+ }
168
+ //# sourceMappingURL=tool-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-line.js","sourceRoot":"","sources":["../src/tool-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,6EAA6E;AAC7E,SAAS,CAAC,CAAC,IAAa,EAAE,GAAW;IACnC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACpD,MAAM,CAAC,GAAI,IAAgC,CAAC,GAAG,CAAC,CAAC;QACjD,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;wEAEwE;AACxE,MAAM,UA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C;QAC/B,KAAK,aAAa;YAChB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QAChC;YACE,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,WAAW,CAAC,IAAa;IAChC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAA+B,CAAC,EAAE,CAAC;QACrE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,SAAS,CAAC,8BAA8B;QACnE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;YAAE,MAAM;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { JSX } from "react";
2
+ export interface ToolMessageProps {
3
+ /** Raw tool name (e.g. "edit", "mcp__github__create_issue"). */
4
+ name: string;
5
+ /** Pure arg summary from `formatToolCall`. */
6
+ argSummary: string;
7
+ /** undefined ⇒ still running; true/false ⇒ finished ok/error. */
8
+ ok?: boolean;
9
+ /** Result preview text (already line-capped by `previewToolResult`). */
10
+ result?: string;
11
+ /** Raw `linesDiff` text for write/edit (rendered under the ⎿ branch). */
12
+ diff?: string;
13
+ /** Whether `diff` is whole-file-anchored (write) vs snippet (edit). */
14
+ anchored?: boolean;
15
+ width?: number;
16
+ }
17
+ export declare function ToolMessage({ name, argSummary, ok, result, diff, anchored, width, }: ToolMessageProps): JSX.Element;
18
+ //# sourceMappingURL=tool-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-message.d.ts","sourceRoot":"","sources":["../src/tool-message.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAajC,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,UAAU,EACV,EAAE,EACF,MAAM,EACN,IAAI,EACJ,QAAgB,EAChB,KAAK,GACN,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA4BhC"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * (5.9 / v14) claude-code-style tool block:
4
+ * ⏺ Name(argSummary)
5
+ * ⎿ result one-liner
6
+ * <structured diff for write/edit>
7
+ *
8
+ * The status dot color reflects the FINAL state once known (running while
9
+ * `ok === undefined`, then success/error) — the view-model fills `ok`/`result`/
10
+ * `diff` onto the still-live tool line before committing it, so the dot never
11
+ * has to mutate after commit (append-only preserved; see `view-model.ts`).
12
+ */
13
+ import { Box, Text } from "ink";
14
+ import { DiffView } from "./diff-view.js";
15
+ import { toolDisplayName } from "./tool-line.js";
16
+ import { useTheme } from "./theme-context.js";
17
+ /** Left indent (cols) the embedded diff sits under the `⎿` branch. */
18
+ const DIFF_INDENT = 5;
19
+ function termColumns() {
20
+ const cols = process.stdout?.columns;
21
+ return typeof cols === "number" && cols > 0 ? cols : 80;
22
+ }
23
+ export function ToolMessage({ name, argSummary, ok, result, diff, anchored = false, width, }) {
24
+ const { theme, glyphs } = useTheme();
25
+ const dotColor = ok === undefined ? theme.accent : ok ? theme.success : theme.error;
26
+ const display = toolDisplayName(name);
27
+ const resultLines = result ? splitPreview(result) : [];
28
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: dotColor, children: glyphs.dot }), " ", _jsx(Text, { bold: true, children: display }), argSummary ? `(${argSummary})` : ""] }), resultLines.map((line, i) => (_jsxs(Text, { color: ok === false ? theme.error : undefined, dimColor: ok !== false, children: [i === 0 ? ` ${glyphs.branch} ` : " ", line] }, i))), diff ? (_jsx(Box, { paddingLeft: DIFF_INDENT, children: _jsx(DiffView, { diff: diff, anchored: anchored, width: (width ?? termColumns()) - DIFF_INDENT }) })) : null] }));
29
+ }
30
+ /** Split a result preview into display lines (cap defensively so a pathological
31
+ * result can't blow up the block; the view-model already line-caps via
32
+ * previewToolResult, this is a second floor). */
33
+ function splitPreview(result) {
34
+ const lines = result.split("\n");
35
+ return lines.length > 20 ? [...lines.slice(0, 20), `… +${lines.length - 20} more`] : lines;
36
+ }
37
+ //# sourceMappingURL=tool-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-message.js","sourceRoot":"","sources":["../src/tool-message.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,sEAAsE;AACtE,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,SAAS,WAAW;IAClB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