@chances-ai/tui 16.0.0 → 17.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.
@@ -1,156 +0,0 @@
1
- /**
2
- * (5.9 / v14) Pure parser that turns the `linesDiff` text block (carried in a
3
- * write/edit `tool:permission` summary — see `view-model.ts`) into structured,
4
- * renderable rows. NO React/Ink here — this is the correctness core, fully
5
- * unit-tested in isolation.
6
- *
7
- * `linesDiff` (`packages/tools/src/diff.ts`) emits, in order:
8
- * `@@ -start,rem +start,add @@`
9
- * `- <removed line>` × rem
10
- * `+ <added line>` × add
11
- * — i.e. ALL removes then ALL adds, NO context lines; with a `… (N lines
12
- * elided)` marker injected in the middle when the block exceeds its 14-body-row
13
- * cap (so a full block is up to 15 lines incl. the header — codex R1 SHOULD-5).
14
- *
15
- * Line numbers (codex R1 MUST-1): `write` diffs are whole-file-anchored
16
- * (`linesDiff(before, content)`), so `@@ -start` is the real file line — render
17
- * the gutter. `edit` diffs are `find`↔`replace` snippets, so `@@ -1` is
18
- * snippet-relative — the caller passes `anchored: false` and no gutter is shown.
19
- */
20
- import { diffWordsWithSpace } from "diff";
21
- /** Threshold above which a remove/add pair renders as whole-line (not word-level).
22
- * Matches claude-code `StructuredDiff/Fallback.tsx` `CHANGE_THRESHOLD`. */
23
- export const CHANGE_THRESHOLD = 0.4;
24
- const HUNK_RE = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
25
- // Anchored + exact: `linesDiff` emits the marker as `… (N lines elided)`. A
26
- // loose `lines elided)` alternative (codex R2 SHOULD-4) would misclassify a
27
- // real source line that merely contains that phrase.
28
- const ELISION_RE = /^… \(\d+ lines elided\)$/;
29
- /**
30
- * Detect whether a text block is a renderable diff (the non-diff guard, 5.9 §3):
31
- * true only when it contains a `@@ -d +d @@` hunk header.
32
- */
33
- export function looksLikeDiff(text) {
34
- return text.split("\n").some((l) => HUNK_RE.test(l));
35
- }
36
- /**
37
- * Parse a `linesDiff` block. `anchored` (write=true, edit=false) controls
38
- * whether line numbers are assigned. Returns rows in source order with
39
- * word-level segments computed for sub-threshold remove/add pairs.
40
- */
41
- export function parseDiff(text, opts) {
42
- const lines = text.split("\n");
43
- let startLine = null;
44
- const raw = [];
45
- for (const line of lines) {
46
- const hunk = HUNK_RE.exec(line);
47
- if (hunk) {
48
- if (startLine === null)
49
- startLine = Number(hunk[1]);
50
- continue;
51
- }
52
- if (ELISION_RE.test(line)) {
53
- raw.push({ kind: "elision", text: line });
54
- continue;
55
- }
56
- if (line.startsWith("- "))
57
- raw.push({ kind: "remove", text: line.slice(2) });
58
- else if (line.startsWith("+ "))
59
- raw.push({ kind: "add", text: line.slice(2) });
60
- else if (line === "-" || line === "+")
61
- raw.push({ kind: line === "+" ? "add" : "remove", text: "" });
62
- // Anything else (stray context / blank) is ignored: linesDiff never emits it.
63
- }
64
- const rows = numberAndPair(raw, startLine ?? 1, opts.anchored);
65
- return { rows, startLine };
66
- }
67
- /**
68
- * Assign line numbers (anchored only) and compute word-level pairing. Mirrors
69
- * claude-code's `numberDiffLines` + `processAdjacentLines`: a run of removes
70
- * followed by a run of adds pairs index-wise; the line counter rewinds by the
71
- * number of removes so the matching add reuses the same displayed number.
72
- */
73
- function numberAndPair(raw, startLine, anchored) {
74
- const out = [];
75
- let i = 0;
76
- let lineNo = startLine;
77
- while (i < raw.length) {
78
- const cur = raw[i];
79
- if (cur.kind === "elision") {
80
- out.push({ kind: "elision", text: cur.text, lineNo: null, words: null });
81
- i++;
82
- continue;
83
- }
84
- if (cur.kind === "remove") {
85
- // Collect the remove run, then the following add run.
86
- const removes = [];
87
- while (i < raw.length && raw[i].kind === "remove")
88
- removes.push(raw[i++]);
89
- const adds = [];
90
- while (i < raw.length && raw[i].kind === "add")
91
- adds.push(raw[i++]);
92
- const removeBase = lineNo;
93
- removes.forEach((r, k) => {
94
- const paired = adds[k];
95
- out.push({
96
- kind: "remove",
97
- text: r.text,
98
- lineNo: anchored ? removeBase + k : null,
99
- words: paired ? wordSegs(r.text, paired.text, "remove") : null,
100
- });
101
- });
102
- // Rewind: removed lines don't exist in the new file — adds reuse the numbers.
103
- adds.forEach((a, k) => {
104
- const paired = removes[k];
105
- out.push({
106
- kind: "add",
107
- text: a.text,
108
- lineNo: anchored ? removeBase + k : null,
109
- // wordSegs always takes (removeText, addText); here the add's pair is
110
- // the remove at the same index.
111
- words: paired ? wordSegs(paired.text, a.text, "add") : null,
112
- });
113
- });
114
- lineNo = removeBase + Math.max(removes.length, adds.length);
115
- continue;
116
- }
117
- // A lone add run (pure insertion, no preceding removes).
118
- if (cur.kind === "add") {
119
- while (i < raw.length && raw[i].kind === "add") {
120
- const a = raw[i++];
121
- out.push({ kind: "add", text: a.text, lineNo: anchored ? lineNo++ : null, words: null });
122
- }
123
- continue;
124
- }
125
- i++;
126
- }
127
- return out;
128
- }
129
- /**
130
- * Word-level segments for one side of a pair. `side:"remove"` keeps common +
131
- * removed words; `side:"add"` keeps common + added words. Returns null when the
132
- * pair changed more than {@link CHANGE_THRESHOLD} of its total length (render
133
- * whole-line instead).
134
- */
135
- export function wordSegs(removeText, addText, side) {
136
- const parts = diffWordsWithSpace(removeText, addText);
137
- const total = removeText.length + addText.length;
138
- const changedLen = parts.reduce((sum, p) => (p.added || p.removed ? sum + p.value.length : sum), 0);
139
- if (total === 0 || changedLen / total > CHANGE_THRESHOLD)
140
- return null;
141
- const segs = [];
142
- for (const p of parts) {
143
- if (side === "remove") {
144
- if (p.added)
145
- continue;
146
- segs.push({ text: p.value, changed: !!p.removed });
147
- }
148
- else {
149
- if (p.removed)
150
- continue;
151
- segs.push({ text: p.value, changed: !!p.added });
152
- }
153
- }
154
- return segs;
155
- }
156
- //# sourceMappingURL=diff-model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff-model.js","sourceRoot":"","sources":["../src/diff-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,E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AK,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACpG,IAAI,KAAK,KAAK,CAAC,IAAI,UAAU,GAAG,KAAK,GAAG,gBAAgB;QAAE,OAAO,IAAI,CAAC;IAEtE,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,IAAI,CAAC,CAAC,KAAK;gBAAE,SAAS;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,CAAC,OAAO;gBAAE,SAAS;YACxB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * (5.8 / v13) Frame-coalescing scheduler.
3
- *
4
- * Streaming `assistant:delta` events arrive one-per-token (engine.ts emits a
5
- * bump per stream chunk). Before v13 each one drove a full React re-render of
6
- * the whole scrollback. The view-model now routes delta-driven re-renders
7
- * through `schedule()` so at most ONE render happens per ~16 ms frame, while
8
- * structural events (a finished message, a tool call/result, turn end) still
9
- * flush immediately via the view-model's force-flush path (which `cancel()`s
10
- * any pending frame first).
11
- *
12
- * The scheduler is injectable so tests run deterministically with no timers:
13
- * inject {@link ManualFrameScheduler}, drive events, then `flush()` — the
14
- * assertion is "N deltas → exactly one notification", which a real
15
- * `setTimeout` clock can't express without flakiness.
16
- */
17
- /** Opaque handle returned by {@link FrameScheduler.schedule}; pass it back to
18
- * `cancel()`. Callers must not inspect it. */
19
- export type FrameHandle = unknown;
20
- export interface FrameScheduler {
21
- /** Run `cb` on a later frame; returns a handle for {@link cancel}. */
22
- schedule(cb: () => void): FrameHandle;
23
- /** Cancel a scheduled `cb` if it has not run yet. Idempotent. */
24
- cancel(handle: FrameHandle): void;
25
- }
26
- /** Default production scheduler: a single `setTimeout` per coalescing window. */
27
- export declare const defaultFrameScheduler: FrameScheduler;
28
- /**
29
- * Deterministic scheduler for tests. `schedule()` enqueues a callback (no
30
- * timer), `cancel()` removes it, `flush()` runs all queued callbacks in FIFO
31
- * order and clears the queue. `pending` exposes the queue depth so a test can
32
- * assert coalescing ("after N deltas, exactly one callback is queued").
33
- */
34
- export declare class ManualFrameScheduler implements FrameScheduler {
35
- private readonly queue;
36
- private nextId;
37
- schedule(cb: () => void): FrameHandle;
38
- cancel(handle: FrameHandle): void;
39
- /** Number of callbacks queued but not yet run or cancelled. */
40
- get pending(): number;
41
- /** Run every queued callback (FIFO) and clear the queue. */
42
- flush(): void;
43
- }
44
- //# sourceMappingURL=frame-scheduler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frame-scheduler.d.ts","sourceRoot":"","sources":["../src/frame-scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;+CAC+C;AAC/C,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;IACtC,iEAAiE;IACjE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAMD,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,EAAE,cAKnC,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,MAAM,CAAK;IAEnB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,WAAW;IAMrC,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAIjC,+DAA+D;IAC/D,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,4DAA4D;IAC5D,KAAK,IAAI,IAAI;CAKd"}
@@ -1,58 +0,0 @@
1
- /**
2
- * (5.8 / v13) Frame-coalescing scheduler.
3
- *
4
- * Streaming `assistant:delta` events arrive one-per-token (engine.ts emits a
5
- * bump per stream chunk). Before v13 each one drove a full React re-render of
6
- * the whole scrollback. The view-model now routes delta-driven re-renders
7
- * through `schedule()` so at most ONE render happens per ~16 ms frame, while
8
- * structural events (a finished message, a tool call/result, turn end) still
9
- * flush immediately via the view-model's force-flush path (which `cancel()`s
10
- * any pending frame first).
11
- *
12
- * The scheduler is injectable so tests run deterministically with no timers:
13
- * inject {@link ManualFrameScheduler}, drive events, then `flush()` — the
14
- * assertion is "N deltas → exactly one notification", which a real
15
- * `setTimeout` clock can't express without flakiness.
16
- */
17
- /** ~1 frame at 60fps. One coalesced render per frame is imperceptible while
18
- * capping re-renders during a fast token stream. */
19
- const FRAME_MS = 16;
20
- /** Default production scheduler: a single `setTimeout` per coalescing window. */
21
- export const defaultFrameScheduler = {
22
- schedule: (cb) => setTimeout(cb, FRAME_MS),
23
- cancel: (handle) => {
24
- if (handle !== undefined)
25
- clearTimeout(handle);
26
- },
27
- };
28
- /**
29
- * Deterministic scheduler for tests. `schedule()` enqueues a callback (no
30
- * timer), `cancel()` removes it, `flush()` runs all queued callbacks in FIFO
31
- * order and clears the queue. `pending` exposes the queue depth so a test can
32
- * assert coalescing ("after N deltas, exactly one callback is queued").
33
- */
34
- export class ManualFrameScheduler {
35
- queue = new Map();
36
- nextId = 1;
37
- schedule(cb) {
38
- const id = this.nextId++;
39
- this.queue.set(id, cb);
40
- return id;
41
- }
42
- cancel(handle) {
43
- if (typeof handle === "number")
44
- this.queue.delete(handle);
45
- }
46
- /** Number of callbacks queued but not yet run or cancelled. */
47
- get pending() {
48
- return this.queue.size;
49
- }
50
- /** Run every queued callback (FIFO) and clear the queue. */
51
- flush() {
52
- const callbacks = [...this.queue.values()];
53
- this.queue.clear();
54
- for (const cb of callbacks)
55
- cb();
56
- }
57
- }
58
- //# sourceMappingURL=frame-scheduler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frame-scheduler.js","sourceRoot":"","sources":["../src/frame-scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH;qDACqD;AACrD,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,iFAAiF;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACnD,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,CAAC;IAC1C,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjB,IAAI,MAAM,KAAK,SAAS;YAAE,YAAY,CAAC,MAAuC,CAAC,CAAC;IAClF,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IACd,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC/C,MAAM,GAAG,CAAC,CAAC;IAEnB,QAAQ,CAAC,EAAc;QACrB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,MAAmB;QACxB,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,+DAA+D;IAC/D,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,4DAA4D;IAC5D,KAAK;QACH,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,KAAK,MAAM,EAAE,IAAI,SAAS;YAAE,EAAE,EAAE,CAAC;IACnC,CAAC;CACF"}
@@ -1,18 +0,0 @@
1
- import type { Theme } from "./theme.js";
2
- /** Stable highlight scopes we color. Everything else → `"plain"` (no color). */
3
- export type HlScope = "plain" | "keyword" | "string" | "comment" | "number" | "function" | "type" | "literal" | "attr";
4
- export interface Segment {
5
- text: string;
6
- scope: HlScope;
7
- }
8
- /** scope → theme color role (used by views to pick the `<Text color>`). */
9
- export declare const SCOPE_TO_THEME: Record<HlScope, keyof Theme | undefined>;
10
- /** Resolve a user-supplied language label to a registered grammar, or null. */
11
- export declare function resolveLanguage(lang: string | undefined): string | null;
12
- /**
13
- * Highlight `code` as `lang` into themed segments. Unknown/absent language or
14
- * any highlighter error → a single `"plain"` segment with the original code
15
- * (callers render it as plain text).
16
- */
17
- export declare function highlightToSegments(code: string, lang: string | undefined): Segment[];
18
- //# sourceMappingURL=highlight-to-segments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"highlight-to-segments.d.ts","sourceRoot":"","sources":["../src/highlight-to-segments.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA4ExC,gFAAgF;AAChF,MAAM,MAAM,OAAO,GACf,OAAO,GACP,SAAS,GACT,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,UAAU,GACV,MAAM,GACN,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AA6CD,2EAA2E;AAC3E,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,SAAS,CAUnE,CAAC;AAgBF,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAMvE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,EAAE,CAWrF"}
@@ -1,224 +0,0 @@
1
- /**
2
- * (5.9 / v14) Terminal syntax highlighting, pi-style: drive highlight.js
3
- * directly (NOT `cli-highlight`, which drags in `parse5` + `yargs` — codex R1
4
- * UNVERIFIABLE-2), then map its `<span class="hljs-…">` HTML to flat, themed
5
- * segments with a tiny stack scanner. Pure `(code, lang) → Segment[]`, so it is
6
- * fully unit-testable without Ink and degrades to a single plain segment on
7
- * unknown language / highlighter throw.
8
- *
9
- * Only a curated language set is registered (via `highlight.js/lib/core`) to
10
- * keep the `bun build --compile` binary small.
11
- */
12
- import hljs from "highlight.js/lib/core";
13
- // -- curated language registration ------------------------------------------
14
- import bash from "highlight.js/lib/languages/bash";
15
- import c from "highlight.js/lib/languages/c";
16
- import cpp from "highlight.js/lib/languages/cpp";
17
- import css from "highlight.js/lib/languages/css";
18
- import diff from "highlight.js/lib/languages/diff";
19
- import dockerfile from "highlight.js/lib/languages/dockerfile";
20
- import go from "highlight.js/lib/languages/go";
21
- import java from "highlight.js/lib/languages/java";
22
- import javascript from "highlight.js/lib/languages/javascript";
23
- import json from "highlight.js/lib/languages/json";
24
- import markdown from "highlight.js/lib/languages/markdown";
25
- import python from "highlight.js/lib/languages/python";
26
- import ruby from "highlight.js/lib/languages/ruby";
27
- import rust from "highlight.js/lib/languages/rust";
28
- import sql from "highlight.js/lib/languages/sql";
29
- import toml from "highlight.js/lib/languages/ini";
30
- import typescript from "highlight.js/lib/languages/typescript";
31
- import xml from "highlight.js/lib/languages/xml";
32
- import yaml from "highlight.js/lib/languages/yaml";
33
- let registered = false;
34
- function ensureRegistered() {
35
- if (registered)
36
- return;
37
- registered = true;
38
- const langs = {
39
- bash,
40
- c,
41
- cpp,
42
- css,
43
- diff,
44
- dockerfile,
45
- go,
46
- java,
47
- javascript,
48
- json,
49
- markdown,
50
- python,
51
- ruby,
52
- rust,
53
- sql,
54
- toml,
55
- typescript,
56
- xml,
57
- yaml,
58
- };
59
- for (const [name, def] of Object.entries(langs))
60
- hljs.registerLanguage(name, def);
61
- }
62
- /** Common aliases highlight.js's curated set doesn't auto-register for us. */
63
- const ALIASES = {
64
- ts: "typescript",
65
- tsx: "typescript",
66
- js: "javascript",
67
- jsx: "javascript",
68
- mjs: "javascript",
69
- cjs: "javascript",
70
- py: "python",
71
- rb: "ruby",
72
- rs: "rust",
73
- sh: "bash",
74
- shell: "bash",
75
- zsh: "bash",
76
- yml: "yaml",
77
- html: "xml",
78
- htm: "xml",
79
- svg: "xml",
80
- golang: "go",
81
- "c++": "cpp",
82
- ini: "toml",
83
- dockerfile: "dockerfile",
84
- md: "markdown",
85
- };
86
- /** hljs class (without the `hljs-` prefix) → our scope. Unmapped → "plain". */
87
- function classToScope(cls) {
88
- // A span class may be multi-token, e.g. "hljs-title function_"; check each.
89
- const tokens = cls.split(/\s+/);
90
- for (const raw of tokens) {
91
- const t = raw.replace(/^hljs-/, "");
92
- switch (t) {
93
- case "keyword":
94
- return "keyword";
95
- case "string":
96
- case "regexp":
97
- case "char":
98
- case "char.escape":
99
- case "subst":
100
- return "string";
101
- case "comment":
102
- case "quote":
103
- return "comment";
104
- case "number":
105
- return "number";
106
- case "title":
107
- case "built_in":
108
- return "function";
109
- case "type":
110
- case "class":
111
- case "title.class":
112
- return "type";
113
- case "literal":
114
- return "literal";
115
- case "attr":
116
- case "attribute":
117
- case "property":
118
- case "selector-tag":
119
- case "selector-class":
120
- case "name":
121
- return "attr";
122
- default:
123
- continue;
124
- }
125
- }
126
- return "plain";
127
- }
128
- /** scope → theme color role (used by views to pick the `<Text color>`). */
129
- export const SCOPE_TO_THEME = {
130
- plain: undefined,
131
- keyword: "synKeyword",
132
- string: "synString",
133
- comment: "synComment",
134
- number: "synNumber",
135
- function: "synFunction",
136
- type: "synType",
137
- literal: "synLiteral",
138
- attr: "synAttr",
139
- };
140
- const ENTITIES = {
141
- "&amp;": "&",
142
- "&lt;": "<",
143
- "&gt;": ">",
144
- "&quot;": '"',
145
- "&#x27;": "'",
146
- "&#39;": "'",
147
- "&apos;": "'",
148
- };
149
- function decodeEntities(s) {
150
- return s.replace(/&(?:amp|lt|gt|quot|apos|#x27|#39);/g, (m) => ENTITIES[m] ?? m);
151
- }
152
- /** Resolve a user-supplied language label to a registered grammar, or null. */
153
- export function resolveLanguage(lang) {
154
- if (!lang)
155
- return null;
156
- ensureRegistered();
157
- const norm = lang.trim().toLowerCase();
158
- const aliased = ALIASES[norm] ?? norm;
159
- return hljs.getLanguage(aliased) ? aliased : null;
160
- }
161
- /**
162
- * Highlight `code` as `lang` into themed segments. Unknown/absent language or
163
- * any highlighter error → a single `"plain"` segment with the original code
164
- * (callers render it as plain text).
165
- */
166
- export function highlightToSegments(code, lang) {
167
- const resolved = resolveLanguage(lang);
168
- if (!resolved)
169
- return [{ text: code, scope: "plain" }];
170
- let html;
171
- try {
172
- html = hljs.highlight(code, { language: resolved, ignoreIllegals: true }).value;
173
- }
174
- catch {
175
- return [{ text: code, scope: "plain" }];
176
- }
177
- return scanHtml(html);
178
- }
179
- /**
180
- * Flatten highlight.js HTML into segments. Maintains a scope stack; the
181
- * innermost open span wins for the text between tags. Closing more spans than
182
- * are open (defensive) is ignored.
183
- */
184
- function scanHtml(html) {
185
- const segs = [];
186
- const stack = [];
187
- // The final `(<)` alternative captures a stray `<` that starts neither a
188
- // recognized span open/close — emitted as literal text so no source char is
189
- // silently dropped if highlight.js ever produces unexpected markup (codex R2
190
- // SHOULD-5). highlight.js escapes real `<` in source to `&lt;`, so this only
191
- // fires defensively.
192
- const re = /<span class="([^"]*)">|<\/span>|([^<]+)|(<)/g;
193
- const push = (raw) => {
194
- const text = decodeEntities(raw);
195
- if (text.length > 0)
196
- segs.push({ text, scope: stack[stack.length - 1] ?? "plain" });
197
- };
198
- let m = re.exec(html);
199
- while (m !== null) {
200
- if (m[1] !== undefined)
201
- stack.push(classToScope(m[1]));
202
- else if (m[2] !== undefined)
203
- push(m[2]);
204
- else if (m[3] !== undefined)
205
- push(m[3]); // stray "<"
206
- else
207
- stack.pop();
208
- m = re.exec(html);
209
- }
210
- return coalesce(segs);
211
- }
212
- /** Merge adjacent same-scope segments so the renderer emits fewer `<Text>`. */
213
- function coalesce(segs) {
214
- const out = [];
215
- for (const s of segs) {
216
- const last = out[out.length - 1];
217
- if (last && last.scope === s.scope)
218
- last.text += s.text;
219
- else
220
- out.push({ ...s });
221
- }
222
- return out;
223
- }
224
- //# sourceMappingURL=highlight-to-segments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"highlight-to-segments.js","sourceRoot":"","sources":["../src/highlight-to-segments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAGzC,8EAA8E;AAC9E,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,CAAC,MAAM,8BAA8B,CAAC;AAC7C,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC/C,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,QAAQ,MAAM,qCAAqC,CAAC;AAC3D,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,GAAG,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C;QACjB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,+EAA+E;AAC/E,SAAS,QAAQ,CAAC,IAAe;IAC/B,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;YAAE,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC;;YACnD,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,33 +0,0 @@
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
@@ -1 +0,0 @@
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"}