@songtonyli/dsh-cli 0.1.99 → 0.1.100
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.
- package/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +2 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +2 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +452 -114
- package/node_modules/@eslint-community/regexpp/index.js +3 -3
- package/node_modules/@eslint-community/regexpp/index.mjs +3 -3
- package/node_modules/@eslint-community/regexpp/package.json +1 -1
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
- package/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
- package/node_modules/jose/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ workspace and no build step. Native packages that ship one build per platform
|
|
|
26
26
|
ripgrep, the PTY backend's addons, sharp, koffi, and the Landlock launcher — are
|
|
27
27
|
ordinary optional dependencies, so npm resolves the right one for your machine.
|
|
28
28
|
|
|
29
|
-
Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.
|
|
29
|
+
Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.100; `dsh --version`
|
|
30
30
|
also reports the harness build the package was assembled from.
|
|
31
31
|
|
|
32
32
|
## License
|
package/bin/dsh.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const argv = process.argv.slice(2)
|
|
|
18
18
|
// version this package publishes. Reporting only one of the two would make an
|
|
19
19
|
// ordinary `npm install @songtonyli/dsh-cli@x` look like it installed something else.
|
|
20
20
|
if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-V')) {
|
|
21
|
-
console.log('@songtonyli/dsh-cli 0.1.
|
|
21
|
+
console.log('@songtonyli/dsh-cli 0.1.100 (deepseek-harness 0.2.2-rc.1)')
|
|
22
22
|
process.exit(0)
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -594,7 +594,7 @@ var ClientModuleRegistry = class extends Service {
|
|
|
594
594
|
constructor(ctx) {
|
|
595
595
|
super(ctx, "clientModules");
|
|
596
596
|
const { version } = createRequire(import.meta.url)("../package.json");
|
|
597
|
-
const commit = "
|
|
597
|
+
const commit = "ae303ee";
|
|
598
598
|
this.release = {
|
|
599
599
|
version,
|
|
600
600
|
commit
|
|
@@ -279,7 +279,7 @@ window.__ModuleLoader__.load({
|
|
|
279
279
|
const SCROLLBAR_LINGER_MS = 2e3;
|
|
280
280
|
/** Format complete-build metadata for the local brand badge. */
|
|
281
281
|
function localBuildVersion() {
|
|
282
|
-
return `0.2.2-rc.1-
|
|
282
|
+
return `0.2.2-rc.1-ae303ee` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
|
|
283
283
|
}
|
|
284
284
|
/** Analytics category of an official panel; other panels are never reported. */
|
|
285
285
|
function officialEntry(id) {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
en: d0ede2f3fc62912b
|
|
22
22
|
zh: d177b8f16b58828f
|
|
23
23
|
/deepseek-ai-dsh-tui-app/use-this-package/the-screen:
|
|
24
|
-
en:
|
|
25
|
-
zh:
|
|
24
|
+
en: c4b44c71368b6a09
|
|
25
|
+
zh: e0c4ef1c2a567282
|
|
26
26
|
/deepseek-ai-dsh-tui-app/use-this-package/keys-and-commands:
|
|
27
27
|
en: 90afe7e001ddcd8a
|
|
28
28
|
zh: 76c22b3e600e5dd9
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
en: 1354f4f002a282eb
|
|
43
43
|
zh: 98ce0fa0ef7e3156
|
|
44
44
|
/deepseek-ai-dsh-tui-app/use-this-package/configuration:
|
|
45
|
-
en:
|
|
46
|
-
zh:
|
|
45
|
+
en: 596216fb115ab0b3
|
|
46
|
+
zh: 16b0e8e97a8bbdec
|
|
47
47
|
/deepseek-ai-dsh-tui-app/understand-the-implementation:
|
|
48
48
|
en: f124d406565fef39
|
|
49
49
|
zh: 90344b5eec319cad
|
|
@@ -42,7 +42,7 @@ Failed attempts retain their saved text and reasoning after a resume or session
|
|
|
42
42
|
|
|
43
43
|
### The screen
|
|
44
44
|
|
|
45
|
-
Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, a bloom spinning beside `Thinking` while it streams, and each tool call is a card with a status glyph — a yellow spinner of that tool family's flowers, blooms, and stars while it runs, a green `◆` once done, a red `◆` on failure — the tool name in bold cyan, the presenter headline in teal — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. Shell output is dimmed apart from the syntax-colored command; a complete JSON object or array result draws as a tree with dim guides, cyan keys, orange array indices, and type-colored scalar values instead of braces, and so does a call's JSON object or array input unless its presenter supplies its own rows, while malformed or mixed output stays unchanged. A top-level workflow call also draws its own run beside that card: the name, member count, status, and a ten-cell member progress bar with the settled count, then each phase and the members that started. While a live run runs, its `◇` pulses through a diamond animation and each running member's `○` spins in the subagent family's flowers, one phase ahead of the member before it; a run drawn from a replayed log spins only while its background job is still live, and reduced motion draws the static glyphs. Running groups and groups with a failed, cancelled, or interrupted member open; a clean completion stays closed. Space or Enter on a run or phase folds that level, and Enter on a running member opens its child only while that child is a live direct child of this session. The card appears when the model starts the call and flows out row after row, each row left to right, at one pace whatever the card holds: a full-width row takes `toolRevealFrames` frames, a shorter row proportionally less, and the columns just drawn brighten from the terminal background to their own colors. The result rows flow out the same way when the tool answers, behind whatever the card is still drawing; neither the call nor the result waits for the animation. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a dim `◆` for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt is omitted. A compaction, from `/compact` or automatic, draws as one context block whose accent `⬡` title names its origin and the estimated tokens it replaced and its summary costs, as in `context compacted by /compact · ~6.4k → ~0.9k tokens` or `context compacted automatically in turn 12 · …`; under the title, `compressed` names the item count and turns the summary replaced, each prompt among them (five at most, one row each), and a count of the replies, tool results by tool, context blocks, and earlier summaries, and `preserved` names the system prompt and what each later turn still holds verbatim; both stay drawn while the summary under them folds to `contextPreviewLines` rows like any context block. The checkpoint message itself is not drawn again. A `/compact` attempt the log closes with an error prints `/compact failed · <error>` when the session is redrawn, since the live command reports its own failure; a failed automatic attempt changes nothing and draws nothing, as in the browser. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings and list markers use orange, links and inline code use magenta, and quotes stay dim. Every hue is a Tokyo Night (Night) color, drawn exactly when `COLORTERM` declares `truecolor` or `24bit` and as the nearest of the 256 indexed colors otherwise; the background bands keep their 256-color greys and diff tints. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning floats out over the same duration: it appears at a lifted color and recedes to the dim italic it settles in. Each column of a tool card brightens over it from the terminal background to the palette color it settles in; a card redrawn from persisted history carries no flow or fade, and text that has settled is never dimmed again.
|
|
45
|
+
Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, a bloom spinning beside `Thinking` while it streams, and each tool call is a card with a status glyph — a yellow spinner of that tool family's flowers, blooms, and stars while it runs, a green `◆` once done, a red `◆` on failure — the tool name in bold cyan, the presenter headline in teal — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. Shell output is dimmed apart from the syntax-colored command; a complete JSON object or array result draws as a tree with dim guides, cyan keys, orange array indices, and type-colored scalar values instead of braces, and so does a call's JSON object or array input unless its presenter supplies its own rows, while malformed or mixed output stays unchanged. A top-level workflow call also draws its own run beside that card: the name, member count, status, and a ten-cell member progress bar with the settled count, then each phase and the members that started. While a live run runs, its `◇` pulses through a diamond animation and each running member's `○` spins in the subagent family's flowers, one phase ahead of the member before it; a run drawn from a replayed log spins only while its background job is still live, and reduced motion draws the static glyphs. Running groups and groups with a failed, cancelled, or interrupted member open; a clean completion stays closed. Space or Enter on a run or phase folds that level, and Enter on a running member opens its child only while that child is a live direct child of this session. The card appears when the model starts the call and flows out row after row, each row left to right, at one pace whatever the card holds: a full-width row takes `toolRevealFrames` frames, a shorter row proportionally less, and the columns just drawn brighten from the terminal background to their own colors. The result rows flow out the same way when the tool answers, behind whatever the card is still drawing; neither the call nor the result waits for the animation. Until the call's argument JSON closes, the card's rows come from the arguments as they stream: the file path, the command, or the first line of the description once that argument is complete, and for a `content`, `old_string`, or `new_string` argument a size row such as `content 3 KB` that grows while its text arrives; a call with neither draws only the loading row. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a dim `◆` for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt is omitted. A compaction, from `/compact` or automatic, draws as one context block whose accent `⬡` title names its origin and the estimated tokens it replaced and its summary costs, as in `context compacted by /compact · ~6.4k → ~0.9k tokens` or `context compacted automatically in turn 12 · …`; under the title, `compressed` names the item count and turns the summary replaced, each prompt among them (five at most, one row each), and a count of the replies, tool results by tool, context blocks, and earlier summaries, and `preserved` names the system prompt and what each later turn still holds verbatim; both stay drawn while the summary under them folds to `contextPreviewLines` rows like any context block. The checkpoint message itself is not drawn again. A `/compact` attempt the log closes with an error prints `/compact failed · <error>` when the session is redrawn, since the live command reports its own failure; a failed automatic attempt changes nothing and draws nothing, as in the browser. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings and list markers use orange, links and inline code use magenta, and quotes stay dim. Every hue is a Tokyo Night (Night) color, drawn exactly when `COLORTERM` declares `truecolor` or `24bit` and as the nearest of the 256 indexed colors otherwise; the background bands keep their 256-color greys and diff tints. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Syntax-colored code in a streamed reply fades in the same way toward each token's own color, from the level plain text starts at. Streamed reasoning floats out over the same duration: it appears at a lifted color and recedes to the dim italic it settles in. Each column of a tool card brightens over it from the terminal background to the palette color it settles in; a card redrawn from persisted history carries no flow or fade, and text that has settled is never dimmed again.
|
|
46
46
|
|
|
47
47
|
Below the transcript sit a spinner while the agent works — `thinking`, `writing`, `calling <tool>`, a retry, or `compacting`, each beside its own braille animation: circling dots, filling lines, an orbiting dot, a sliding bar, or a settling cell — with a bright highlight sweeping across the word, plus live `↑` send and `↓` receive tokens for the current model call, as compact `k` / `M` / `B` counts, growing as the stream arrives and settling on the provider usage chunk — any open prompt, a boxed follow-ups list while messages wait, an activity board of the open turn's todos and one row per subagent while either has a row — completed todo content scratched out and status glyphs colored green, yellow, or blue, the in-progress one a spinner, at most four todo rows then `+<n> more`, each subagent row its spinner or `✓` / `✗`, its task label — `<name> · <role>` for an Agent Teams teammate — and the last sentence of what it said it was doing, cut to one terminal line, running subagents first and at most three then `+<n> more subagents`, not a focus region, gone on `turn/end` and bind — the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model is purple and the entry keys magenta; live turn, context, and todo facts use yellow, magenta, and green. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, or `Shift+↑ select · Shift+↓ status` while follow-ups wait, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, token usage (session totals plus the in-flight call), the goal and plan-mode markers from the projection seam, and the count of pending attachments. Model-request retries appear as notices, the same facts the browser's markers carry.
|
|
48
48
|
|
|
@@ -273,7 +273,7 @@ The TUI inherits native tool execution from `dsh-base` and ignores `DSH_TOOLS_MO
|
|
|
273
273
|
| `toastMs` | `2000` | How long a transient key-feedback line holds at full strength before it fades out; while the line is on screen, a second `Esc` stops the running turn and a second `Ctrl+C` quits |
|
|
274
274
|
| `quitGraceMs` | `10000` | How long a quit waits for the running turn to stop, the session log to save, and the session's background jobs and subagents to stop before it names what may still run and exits with code 1; the launcher's own 5 s disposal follows. A value below 1000 is rejected |
|
|
275
275
|
| `liveRefreshMs` | `1000` | Period of the redraw that advances the `turn` segment and the panel's elapsed values and re-reads a stale subagent listing |
|
|
276
|
-
| `streamFadeSteps` | `
|
|
276
|
+
| `streamFadeSteps` | `12` | How many ticks a fade lasts: reply text and the columns of a tool card fade in, reasoning floats out, over `streamFadeSteps × streamFadeStepMs`, about 190 ms by default |
|
|
277
277
|
| `streamFadeStepMs` | `16` | One frame: the fade tick, the repaint period while anything is still moving, and the period paced stream text is drawn at; duration is `streamFadeSteps × streamFadeStepMs` |
|
|
278
278
|
| `streamPaceFrames` | `8` | Frames a backlog of streamed reply text or tool arguments takes to reach the screen. Thinking still queued when its block ends, or when reply text or a tool call starts, is drawn at once; `0`, like `reducedMotion`, draws each delta as it arrives |
|
|
279
279
|
| `toolRevealFrames` | `6` | Frames one full-width row of a tool card takes to flow out when the card appears or its result lands; a shorter row takes proportionally less, so every card flows at the same pace in columns per second. Unfolding a card, and a card whose flowing row is above the part of the screen the renderer can repaint, draw every column at once; `0`, like `reducedMotion`, draws every card whole with no animation |
|
|
@@ -42,7 +42,7 @@ dsh tui --no-open # print sign-in URLs without opening a
|
|
|
42
42
|
|
|
43
43
|
### 屏幕布局
|
|
44
44
|
|
|
45
|
-
每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),而在已有模型步骤的轮次中被引导或注入的提示以暗色文字铺在更深的背景带上,退到它所加入的轮次之后,assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,流式期间标题旁的绽放符号随之旋转,每次工具调用是一张卡片,含状态符号(运行中为按工具族混合花朵、绽放与星形的黄色旋转指示、完成为绿色 `◆`、失败为红色 `◆`)、粗体青色工具名、以蓝绿色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。shell 输出以暗色显示,与使用语法着色的命令区分;完整的 JSON 对象或数组结果绘成树,以暗色导引线、青色键、橙色数组下标和按类型着色的标量值取代括号包裹的原始 JSON;调用输入为 JSON 对象或数组时同样绘成树,除非其展示转换器自带行内容;格式错误或混合文本的输出保持不变。顶层 workflow 调用还会在该卡片旁另绘一次运行:运行名、成员数、状态,以及一条十格的成员进度条与已结束数,然后是每个阶段和已启动的成员。实时运行进行中时,其 `◇` 以菱形动画脉动,每个运行中成员的 `○` 以子 agent 族的花朵旋转,相位比前一个成员领先一格;从重放日志绘制的运行只在其后台作业仍存活时旋转,减少动效时绘制静态符号。运行中的层级,以及含失败、取消或中断成员的层级会展开;干净完成的层级保持折叠。在运行或阶段上按 Space 或 Enter 折叠该层,在仍在运行的成员上按 Enter 只会在该子会话是本会话的直接子会话且仍在本进程运行时打开它。卡片在模型开始调用时出现,并逐行向外流出,每行从左到右,无论卡片装着什么,速度都一致:一整行宽的内容需 `toolRevealFrames`
|
|
45
|
+
每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),而在已有模型步骤的轮次中被引导或注入的提示以暗色文字铺在更深的背景带上,退到它所加入的轮次之后,assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,流式期间标题旁的绽放符号随之旋转,每次工具调用是一张卡片,含状态符号(运行中为按工具族混合花朵、绽放与星形的黄色旋转指示、完成为绿色 `◆`、失败为红色 `◆`)、粗体青色工具名、以蓝绿色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。shell 输出以暗色显示,与使用语法着色的命令区分;完整的 JSON 对象或数组结果绘成树,以暗色导引线、青色键、橙色数组下标和按类型着色的标量值取代括号包裹的原始 JSON;调用输入为 JSON 对象或数组时同样绘成树,除非其展示转换器自带行内容;格式错误或混合文本的输出保持不变。顶层 workflow 调用还会在该卡片旁另绘一次运行:运行名、成员数、状态,以及一条十格的成员进度条与已结束数,然后是每个阶段和已启动的成员。实时运行进行中时,其 `◇` 以菱形动画脉动,每个运行中成员的 `○` 以子 agent 族的花朵旋转,相位比前一个成员领先一格;从重放日志绘制的运行只在其后台作业仍存活时旋转,减少动效时绘制静态符号。运行中的层级,以及含失败、取消或中断成员的层级会展开;干净完成的层级保持折叠。在运行或阶段上按 Space 或 Enter 折叠该层,在仍在运行的成员上按 Enter 只会在该子会话是本会话的直接子会话且仍在本进程运行时打开它。卡片在模型开始调用时出现,并逐行向外流出,每行从左到右,无论卡片装着什么,速度都一致:一整行宽的内容需 `toolRevealFrames` 帧,较短的行按比例更短,刚画出的列会从终端背景色亮起到各自的颜色。工具回答后,结果行也以同样方式流出,排在卡片尚未画完的内容之后;调用与结果都不会等待动画。在调用的参数 JSON 闭合之前,卡片的行取自正在流入的参数:文件路径、命令或描述的第一行,各在该参数完整后出现;`content`、`old_string` 或 `new_string` 参数则显示为一行大小,如 `content 3 KB`,并随其文本到达而增长;两者都没有的调用只画加载行。`edit` 或 `write` diff 卡片把每一新增行整行铺满绿色背景、每一删除行整行铺满红色背景,删除的旧行在上、新增的新行在下,并把 `+` 与 `-` 画成各自更亮的颜色,使符号从填充色中读得出来;折行续行只延续填充色,不再画第二个符号;工具应用变更后,已应用的 hunk 取代调用时携带的 diff,并在每行前标出文件行号,新增行与未变行用新文件的行号,删除行用旧文件的行号。`subagent` 与 `subagent_*` 卡片折叠时只画一行,行首是同样的状态符号,运行中旋转,交给后台的子 agent 则为暗色 `◆`:运行中显示工具名、任务描述,以及调用指定的模型与 `background`;结束后描述变暗,右端标出 `[done]`,交给后台的子 agent 标 `[started]`,失败标 `[failed]`。在被标记的行上按 `Space`,或按 `Ctrl+O`,即可展开完整卡片。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词则省略。一次压缩(compaction)——无论来自 `/compact` 还是自动触发——绘制为一个上下文块,其强调色 `⬡` 标题写明来源,以及被替换内容与摘要各自的估算 token 数,如 `context compacted by /compact · ~6.4k → ~0.9k tokens` 或 `context compacted automatically in turn 12 · …`;标题之下,`compressed` 写明摘要替换的条目数与轮次、其中的每条提示(最多五条,每条一行),以及回复、按工具分列的工具结果、上下文块与更早摘要的计数,`preserved` 写明系统提示词以及之后每一轮仍逐字保留的内容;这两部分始终绘出,其下的摘要则像其他上下文块一样折叠到 `contextPreviewLines` 行。检查点消息本身不再重复绘制。日志以错误结束的 `/compact` 尝试会在会话重绘时打印 `/compact failed · <error>`,因为实时运行的命令会自己报告失败;失败的自动尝试不改变任何内容,也不绘制任何内容,与浏览器一致。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行、`edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——以及 `!` / `!!` 草稿、用户 shell 的 `$ command` 行(其 `$` 用强调色)与终端工具卡片中的 shell 命令,都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。标题与列表标记使用橙色,链接与行内代码使用品红色,引用保持暗色。每种色相都是 Tokyo Night(Night)配色,当 `COLORTERM` 声明 `truecolor` 或 `24bit` 时按原色精确绘制,否则取 256 色索引中最接近的一色;背景带保留其 256 色灰阶与 diff 底色。流式推理、回复文字与工具参数到达时先入队,再按帧(默认约每秒 60 帧)分批绘制,因此一次网络突发会分摊到 `streamPaceFrames` 帧里,而不是一次落下,队列也从不拖慢模型调用。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式回复中带语法高亮的代码以同样方式淡入,从纯文本起始的亮度级别提亮到每个语法记号自己的颜色。流式推理在同一时长内浮出:以抬高的颜色出现,再退回到稳定时的暗色斜体。工具卡片的每一列则在这段时长内从终端背景色亮起到它稳定时的调色板颜色;从持久化历史重绘的卡片不带流出或淡入,已经稳定下来的文字也不会再被调暗。
|
|
46
46
|
|
|
47
47
|
对话记录下方依次是 agent 工作时的旋转指示——`thinking`、`writing`、`calling <tool>`、重试或 `compacting`,各自旁边是它自己的盲文动画:环绕的点、逐行填满的线、绕行的单点、滑动的横条,或沉降又回满的方格——标签单词上带着一道扫过的高亮,并带着当前这次模型调用的实时 `↑` 发送与 `↓` 接收 token,以紧凑的 `k` / `M` / `B` 计数,随数据流入增长,并在提供方的 usage 块到达后落定——任何打开的提示、有消息等待时的带框 follow-ups 列表、本轮 todo 与每个子 agent 一行的 activity board(有行时才绘制;已完成内容划掉,状态符号以绿色、黄色或蓝色显示,进行中的那一项为旋转指示,todo 最多四行其后 `+<n> more`,每个子 agent 行是其旋转指示或 `✓` / `✗`、任务标签(Agent Teams 的 teammate 为 `<name> · <role>`),以及它自述正在做什么的最后一句话,截成终端的一行,运行中的子 agent 在前,最多三行其后 `+<n> more subagents`,不是焦点区域,在 `turn/end` 与 bind 时消失)、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型为紫色,入口按键为品红色;进行中的轮次、上下文与 todo 信息分别使用黄色、品红色与绿色。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,有 follow-ups 等待时则写作 `Shift+↑ select · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、token 用量(会话合计加上进行中的这次调用)、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
|
|
48
48
|
|
|
@@ -273,7 +273,7 @@ TUI 从 `dsh-base` 继承原生工具执行,并忽略 `DSH_TOOLS_MODE`。通
|
|
|
273
273
|
| `toastMs` | `2000` | 临时按键提示行以全亮度保持多久后淡出;该行仍在屏幕上时,第二次 `Esc` 停止正在进行的轮次,第二次 `Ctrl+C` 退出 |
|
|
274
274
|
| `quitGraceMs` | `10000` | 退出时等待进行中的轮次停止、会话日志保存、会话的后台作业与子 agent 停止的时长,超过后写明可能仍在运行的工作并以退出码 1 退出;随后是启动器自身 5 s 的 dispose。低于 1000 的值会被拒绝 |
|
|
275
275
|
| `liveRefreshMs` | `1000` | 重绘周期:推进 `turn` 分段与面板中的已用时间,并重新读取已过期的子 agent 列表 |
|
|
276
|
-
| `streamFadeSteps` | `
|
|
276
|
+
| `streamFadeSteps` | `12` | 一次淡入或浮出持续多少拍:回复文字与工具卡片的列淡入,推理浮出,时长为 `streamFadeSteps × streamFadeStepMs`,默认约 190 ms |
|
|
277
277
|
| `streamFadeStepMs` | `16` | 一帧的时长:淡入或浮出的一拍、仍在变化时的重绘周期,也是逐帧绘制流式文字的周期;总时长为 `streamFadeSteps × streamFadeStepMs` |
|
|
278
278
|
| `streamPaceFrames` | `8` | 积压的流式回复文字或工具参数要经过多少帧才全部上屏。思考块结束时,或回复文字或工具调用开始时,仍在队列中的思考立即画出;`0` 与 `reducedMotion` 一样,收到即绘制 |
|
|
279
279
|
| `toolRevealFrames` | `6` | 工具卡片出现或其结果落下时,一整行宽的内容流出所用的帧数;较短的行按比例更短,因此每张卡片的流出速度(以每秒列数计)都相同。展开卡片,以及正在流出的行已位于渲染器可重绘范围之上的卡片,都会一次画出所有列;`0` 与 `reducedMotion` 一样,整张卡片一次画出,不带动画 |
|
|
@@ -16,7 +16,7 @@ import { formatSessionReferenceMention } from "@deepseek-ai/dsh-session-referenc
|
|
|
16
16
|
import { AppleContainerSandboxProvider } from "@deepseek-ai/dsh-sandbox-apple-container";
|
|
17
17
|
import { JobId } from "@deepseek-ai/dsh-jobs";
|
|
18
18
|
import { UserQuestionError, planReviewOptions } from "@deepseek-ai/dsh-user-questions";
|
|
19
|
-
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
19
|
+
import { PartialArguments, assertNever } from "@deepseek-ai/dsh-util-values";
|
|
20
20
|
import { maskCredentialText } from "@deepseek-ai/dsh-client-ui-secret-mask";
|
|
21
21
|
import { readFile } from "node:fs/promises";
|
|
22
22
|
import { basename, extname, join, resolve } from "node:path";
|
|
@@ -526,19 +526,56 @@ function cursorTo(row) {
|
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region lib/types/columns.js
|
|
528
528
|
/**
|
|
529
|
-
* Cutting a rendered line at several columns in one pass
|
|
529
|
+
* Cutting a rendered line at several columns in one pass, and reading the
|
|
530
|
+
* styling its escape sequences leave in force.
|
|
530
531
|
*
|
|
531
532
|
* pi-tui's `sliceByColumn` walks a line from its first character on every
|
|
532
|
-
* call
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* restores the line's own styling.
|
|
533
|
+
* call and opens each piece with every escape sequence written before it, so
|
|
534
|
+
* a fade that recolors `n` runs of one line reads that line about `2n` times
|
|
535
|
+
* per frame and writes the line's whole styling history once per run.
|
|
536
|
+
* {@link sliceColumns} reads the line once and opens each piece after a cut
|
|
537
|
+
* with only the styling in force at that cut.
|
|
538
538
|
* @module @deepseek-ai/dsh-tui-app/columns
|
|
539
539
|
*/
|
|
540
540
|
/** Grapheme segmenter for the text between escape sequences. */
|
|
541
541
|
const GRAPHEMES$3 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
542
|
+
/** Control Sequence Introducer. */
|
|
543
|
+
const CSI$3 = "\x1B[";
|
|
544
|
+
/** Opening of an OSC 8 hyperlink sequence, which an empty target closes. */
|
|
545
|
+
const OSC8 = "\x1B]8;";
|
|
546
|
+
/** SGR codes that take a color in the parameters after them: foreground, background, underline color. */
|
|
547
|
+
const EXTENDED_COLOR_CODES = new Set([
|
|
548
|
+
38,
|
|
549
|
+
48,
|
|
550
|
+
58
|
|
551
|
+
]);
|
|
552
|
+
/** SGR codes that restore the terminal's default foreground, background, and underline color. */
|
|
553
|
+
const DEFAULT_COLOR_CODES = new Set([
|
|
554
|
+
39,
|
|
555
|
+
49,
|
|
556
|
+
59
|
|
557
|
+
]);
|
|
558
|
+
/** SGR codes that turn an attribute on, which a cut restores while they stay in force. */
|
|
559
|
+
const ATTRIBUTE_CODES = new Set([
|
|
560
|
+
1,
|
|
561
|
+
2,
|
|
562
|
+
3,
|
|
563
|
+
4,
|
|
564
|
+
5,
|
|
565
|
+
7,
|
|
566
|
+
8,
|
|
567
|
+
9
|
|
568
|
+
]);
|
|
569
|
+
/** SGR codes that turn attributes off, each with the codes whose attributes it ends. */
|
|
570
|
+
const ATTRIBUTE_ENDS = new Map([
|
|
571
|
+
[22, [1, 2]],
|
|
572
|
+
[23, [3]],
|
|
573
|
+
[24, [4]],
|
|
574
|
+
[25, [5]],
|
|
575
|
+
[27, [7]],
|
|
576
|
+
[28, [8]],
|
|
577
|
+
[29, [9]]
|
|
578
|
+
]);
|
|
542
579
|
/**
|
|
543
580
|
* The terminal escape sequence starting at `index`, as pi-tui recognizes one:
|
|
544
581
|
* a CSI sequence ending in `m`, `G`, `K`, `H`, or `J`, or an OSC or APC
|
|
@@ -561,7 +598,181 @@ function escapeLength(line, index) {
|
|
|
561
598
|
return 0;
|
|
562
599
|
}
|
|
563
600
|
/**
|
|
601
|
+
* Split a rendered line into its escape sequences and the text between them.
|
|
602
|
+
* A sequence is a CSI sequence ending in `m`, `G`, `K`, `H`, or `J`, or an OSC
|
|
603
|
+
* or APC sequence ending in BEL or ST, which is what pi-tui steps over when it
|
|
604
|
+
* measures a line; an unterminated sequence is text.
|
|
605
|
+
* @param line - the rendered line.
|
|
606
|
+
* @returns the parts in line order; consecutive text is one part.
|
|
607
|
+
*/
|
|
608
|
+
function* lineParts(line) {
|
|
609
|
+
let index = 0;
|
|
610
|
+
while (index < line.length) {
|
|
611
|
+
const length = escapeLength(line, index);
|
|
612
|
+
if (length > 0) {
|
|
613
|
+
yield {
|
|
614
|
+
text: line.slice(index, index + length),
|
|
615
|
+
sequence: true
|
|
616
|
+
};
|
|
617
|
+
index += length;
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
let end = index + 1;
|
|
621
|
+
while (end < line.length && escapeLength(line, end) === 0) end += 1;
|
|
622
|
+
yield {
|
|
623
|
+
text: line.slice(index, end),
|
|
624
|
+
sequence: false
|
|
625
|
+
};
|
|
626
|
+
index = end;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Whether one escape sequence is SGR, the sequence that sets text attributes.
|
|
631
|
+
* @param sequence - one escape sequence from {@link lineParts}.
|
|
632
|
+
* @returns true for `ESC[` parameters `m`.
|
|
633
|
+
*/
|
|
634
|
+
function isSgr(sequence) {
|
|
635
|
+
return sequence.startsWith(CSI$3) && sequence.endsWith("m");
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* The attribute changes one SGR sequence makes, in order. A `38`, `48`, or
|
|
639
|
+
* `58` code is one change together with the parameters its color takes:
|
|
640
|
+
* `2;R;G;B`, `5;N`, or the one mode parameter it carries otherwise. Every
|
|
641
|
+
* other parameter is a change of its own. An empty parameter reads as 0, so
|
|
642
|
+
* `ESC[m` and the first slot of `ESC[;1m` are full resets.
|
|
643
|
+
* @param sequence - an SGR sequence, `ESC[` through the final `m`.
|
|
644
|
+
* @returns the changes, each the numeric parameters it consists of; a
|
|
645
|
+
* parameter that is not a number reads as `NaN`.
|
|
646
|
+
*/
|
|
647
|
+
function sgrChanges(sequence) {
|
|
648
|
+
const body = sequence.slice(2, -1);
|
|
649
|
+
const parts = body === "" ? [0] : body.split(";").map((part) => part === "" ? 0 : Number(part));
|
|
650
|
+
const changes = [];
|
|
651
|
+
let index = 0;
|
|
652
|
+
while (index < parts.length) {
|
|
653
|
+
const code = parts[index];
|
|
654
|
+
const length = EXTENDED_COLOR_CODES.has(code) ? extendedColorLength(parts[index + 1]) : 1;
|
|
655
|
+
changes.push(parts.slice(index, index + length));
|
|
656
|
+
index += length;
|
|
657
|
+
}
|
|
658
|
+
return changes;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* How many parameters an extended color change spans, its own code included.
|
|
662
|
+
* @param mode - the parameter after the `38`, `48`, or `58`.
|
|
663
|
+
* @returns 5 for `2;R;G;B`, 3 for `5;N`, 1 when the sequence ends at the code, and 2 for any other mode.
|
|
664
|
+
*/
|
|
665
|
+
function extendedColorLength(mode) {
|
|
666
|
+
if (mode === 2) return 5;
|
|
667
|
+
if (mode === 5) return 3;
|
|
668
|
+
return mode === void 0 ? 1 : 2;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Whether one SGR code sets or clears the foreground.
|
|
672
|
+
* @param code - a change's first parameter, from {@link sgrChanges}.
|
|
673
|
+
* @returns true for `30`-`39` and `90`-`97`.
|
|
674
|
+
*/
|
|
675
|
+
function setsForeground(code) {
|
|
676
|
+
return code >= 30 && code <= 39 || code >= 90 && code <= 97;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* The color slot one SGR code sets or clears.
|
|
680
|
+
* @param code - the change's first parameter.
|
|
681
|
+
* @returns `38` for a foreground code, `48` for a background code, `58` for
|
|
682
|
+
* an underline color code, or undefined for a code that sets no color.
|
|
683
|
+
*/
|
|
684
|
+
function colorSlot(code) {
|
|
685
|
+
if (setsForeground(code)) return 38;
|
|
686
|
+
if (code >= 40 && code <= 49 || code >= 100 && code <= 107) return 48;
|
|
687
|
+
return code === 58 || code === 59 ? 58 : void 0;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The styling a line's escape sequences leave in force at one point of a
|
|
691
|
+
* walk: each attribute set since the last full reset and not ended since, the
|
|
692
|
+
* latest foreground, background, and underline color, and the hyperlink an
|
|
693
|
+
* OSC 8 sequence opened and none closed. A code this does not model is not
|
|
694
|
+
* restored.
|
|
695
|
+
*/
|
|
696
|
+
var StylingInForce = class {
|
|
697
|
+
/** Each attribute in force, by the code that set it, as the parameter that set it. */
|
|
698
|
+
attributes = /* @__PURE__ */ new Map();
|
|
699
|
+
/** The background and underline color in force, by slot (`48`, `58`), as the parameters that set each. */
|
|
700
|
+
colors = /* @__PURE__ */ new Map();
|
|
701
|
+
/** The parameters that set the foreground in force; undefined for the terminal default. */
|
|
702
|
+
foreground;
|
|
703
|
+
/** The OSC 8 sequence that opened the hyperlink in force. */
|
|
704
|
+
link;
|
|
705
|
+
/**
|
|
706
|
+
* Take one escape sequence into the styling.
|
|
707
|
+
* @param sequence - one escape sequence of the line, in line order.
|
|
708
|
+
*/
|
|
709
|
+
read(sequence) {
|
|
710
|
+
if (sequence.startsWith(OSC8)) {
|
|
711
|
+
this.link = linkTarget(sequence) === "" ? void 0 : sequence;
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (!isSgr(sequence)) return;
|
|
715
|
+
for (const change of sgrChanges(sequence)) this.apply(change);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* The sequences that restore this styling over the line's own styling: the
|
|
719
|
+
* hyperlink opener, one SGR with every attribute and the background and
|
|
720
|
+
* underline colors, and one SGR with the foreground, each present only when
|
|
721
|
+
* something of it is in force.
|
|
722
|
+
* @returns the restoring sequences; empty when nothing is in force.
|
|
723
|
+
*/
|
|
724
|
+
restore() {
|
|
725
|
+
const rest = [...this.attributes.values(), ...this.colors.values()];
|
|
726
|
+
const others = rest.length === 0 ? "" : `${CSI$3}${rest.join(";")}m`;
|
|
727
|
+
const foreground = this.foreground === void 0 ? "" : `${CSI$3}${this.foreground}m`;
|
|
728
|
+
return `${this.link ?? ""}${others}${foreground}`;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Apply one change from {@link sgrChanges}.
|
|
732
|
+
* @param change - the change's parameters.
|
|
733
|
+
*/
|
|
734
|
+
apply(change) {
|
|
735
|
+
const code = change[0];
|
|
736
|
+
if (code === 0) {
|
|
737
|
+
this.attributes.clear();
|
|
738
|
+
this.colors.clear();
|
|
739
|
+
this.foreground = void 0;
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
if (ATTRIBUTE_CODES.has(code)) {
|
|
743
|
+
this.attributes.set(code, String(code));
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const ended = ATTRIBUTE_ENDS.get(code);
|
|
747
|
+
if (ended !== void 0) {
|
|
748
|
+
for (const attribute of ended) this.attributes.delete(attribute);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
const slot = colorSlot(code);
|
|
752
|
+
if (slot === void 0) return;
|
|
753
|
+
const parameters = DEFAULT_COLOR_CODES.has(code) ? void 0 : change.join(";");
|
|
754
|
+
if (slot === 38) this.foreground = parameters;
|
|
755
|
+
else if (parameters === void 0) this.colors.delete(slot);
|
|
756
|
+
else this.colors.set(slot, parameters);
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* The target an OSC 8 sequence links to.
|
|
761
|
+
* @param sequence - `ESC]8;params;target` ended by BEL or ST.
|
|
762
|
+
* @returns the target; empty for the sequence that closes a hyperlink.
|
|
763
|
+
*/
|
|
764
|
+
function linkTarget(sequence) {
|
|
765
|
+
const body = sequence.slice(4, sequence.endsWith("\x07") ? -1 : -2);
|
|
766
|
+
return body.slice(body.indexOf(";") + 1);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
564
769
|
* Cut `line` into the column ranges between consecutive cuts.
|
|
770
|
+
*
|
|
771
|
+
* A piece a grapheme starts in opens with the styling in force at its first
|
|
772
|
+
* column, as {@link StylingInForce} restores it, and never with the sequences
|
|
773
|
+
* that styling was built from. The escape sequences inside a range follow that
|
|
774
|
+
* restore, so a sequence at a cut column styles the range it starts rather
|
|
775
|
+
* than the one before it.
|
|
565
776
|
* @param line - the rendered line, escape sequences included.
|
|
566
777
|
* @param cuts - ascending columns; equal neighbours make an empty range.
|
|
567
778
|
* @returns `cuts.length + 1` pieces: columns `[0, cuts[0])`, then each range
|
|
@@ -573,44 +784,34 @@ function sliceColumns(line, cuts) {
|
|
|
573
784
|
const starts = [0, ...cuts];
|
|
574
785
|
const pieces = starts.map(() => "");
|
|
575
786
|
const drawn = starts.map(() => false);
|
|
576
|
-
const
|
|
577
|
-
|
|
787
|
+
const restores = starts.map(() => "");
|
|
788
|
+
const styling = new StylingInForce();
|
|
578
789
|
let column = 0;
|
|
579
790
|
let range = 0;
|
|
580
791
|
let reached = 1;
|
|
581
792
|
const advance = () => {
|
|
582
793
|
while (range + 1 < starts.length && starts[range + 1] <= column) range += 1;
|
|
583
794
|
while (reached < starts.length && starts[reached] <= column) {
|
|
584
|
-
|
|
795
|
+
restores[reached] = styling.restore();
|
|
585
796
|
reached += 1;
|
|
586
797
|
}
|
|
587
798
|
};
|
|
588
|
-
const append = (text) => {
|
|
589
|
-
pieces[range] = `${pieces[range]}${text}`;
|
|
590
|
-
};
|
|
591
799
|
advance();
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
const sequence = line.slice(index, index + length);
|
|
597
|
-
sequences += sequence;
|
|
598
|
-
append(sequence);
|
|
599
|
-
index += length;
|
|
800
|
+
for (const part of lineParts(line)) {
|
|
801
|
+
if (part.sequence) {
|
|
802
|
+
styling.read(part.text);
|
|
803
|
+
pieces[range] = `${pieces[range]}${part.text}`;
|
|
600
804
|
continue;
|
|
601
805
|
}
|
|
602
|
-
|
|
603
|
-
while (end < line.length && escapeLength(line, end) === 0) end += 1;
|
|
604
|
-
for (const { segment } of GRAPHEMES$3.segment(line.slice(index, end))) {
|
|
806
|
+
for (const { segment } of GRAPHEMES$3.segment(part.text)) {
|
|
605
807
|
if (!drawn[range]) {
|
|
606
808
|
drawn[range] = true;
|
|
607
|
-
|
|
809
|
+
pieces[range] = `${restores[range]}${pieces[range]}`;
|
|
608
810
|
}
|
|
609
|
-
|
|
811
|
+
pieces[range] = `${pieces[range]}${segment}`;
|
|
610
812
|
column += visibleWidth(segment);
|
|
611
813
|
advance();
|
|
612
814
|
}
|
|
613
|
-
index = end;
|
|
614
815
|
}
|
|
615
816
|
return pieces;
|
|
616
817
|
}
|
|
@@ -972,7 +1173,7 @@ function resolveFadeCapability(input) {
|
|
|
972
1173
|
* @param steps - brightness levels; defaults to {@link FADE_STEPS}.
|
|
973
1174
|
* @returns `steps` levels, darkest first.
|
|
974
1175
|
*/
|
|
975
|
-
function buildFadeRamp(bg, fg, steps =
|
|
1176
|
+
function buildFadeRamp(bg, fg, steps = 12) {
|
|
976
1177
|
return Array.from({ length: steps }, (_unused, level) => {
|
|
977
1178
|
if (level === steps - 1) return {
|
|
978
1179
|
r: fg.r,
|
|
@@ -1150,7 +1351,7 @@ function recolorLines(lines, age, style, from = 0) {
|
|
|
1150
1351
|
* level and rises to the color the component drew it in, so text in the
|
|
1151
1352
|
* default foreground, a dim rule, and a colored title each brighten to their
|
|
1152
1353
|
* own settled color. The slice should come from {@link sliceColumns}, which
|
|
1153
|
-
*
|
|
1354
|
+
* opens it with the styling in force at its first column.
|
|
1154
1355
|
* @param slice - the slice's text with its escape sequences.
|
|
1155
1356
|
* @param age - elapsed time in units of `stepMs`; `ramp.length` is t = 1.
|
|
1156
1357
|
* @param style - the capability and the ramp, darkest level first.
|
|
@@ -1364,15 +1565,13 @@ function floatOutSpanSgr(style, age) {
|
|
|
1364
1565
|
return `${RESET_INTENSITY}${encodeMix(style.capability, mixed)}`;
|
|
1365
1566
|
}
|
|
1366
1567
|
/**
|
|
1367
|
-
* Apply one SGR sequence to the
|
|
1568
|
+
* Apply one SGR sequence to the foreground state.
|
|
1368
1569
|
* @param state - the state to update.
|
|
1369
1570
|
* @param sequence - a CSI SGR including the trailing `m`.
|
|
1370
1571
|
*/
|
|
1371
1572
|
function applySgr(state, sequence) {
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
for (let index = 0; index < parts.length; index += 1) {
|
|
1375
|
-
const code = colorParam(parts, index);
|
|
1573
|
+
for (const change of sgrChanges(sequence)) {
|
|
1574
|
+
const code = change[0];
|
|
1376
1575
|
if (code === 0) {
|
|
1377
1576
|
state.color = void 0;
|
|
1378
1577
|
state.dim = false;
|
|
@@ -1381,46 +1580,22 @@ function applySgr(state, sequence) {
|
|
|
1381
1580
|
else if (code === 39) state.color = void 0;
|
|
1382
1581
|
else if (code >= 30 && code <= 37) state.color = ANSI16[code - 30];
|
|
1383
1582
|
else if (code >= 90 && code <= 97) state.color = ANSI16[code - 90 + 8];
|
|
1384
|
-
else if (code === 38)
|
|
1385
|
-
const read = readExtendedColor(parts, index);
|
|
1386
|
-
state.color = read.color;
|
|
1387
|
-
index += read.skip;
|
|
1388
|
-
} else if (code === 48) index += readExtendedColor(parts, index).skip;
|
|
1583
|
+
else if (code === 38) state.color = extendedColor(change);
|
|
1389
1584
|
}
|
|
1390
1585
|
}
|
|
1391
1586
|
/**
|
|
1392
|
-
*
|
|
1393
|
-
* @param
|
|
1394
|
-
* @
|
|
1395
|
-
* @returns the RGB for a foreground read, and how many following parameters were consumed.
|
|
1587
|
+
* Read the color of one ITU T.416 extended color change (`38`/`48` plus `2;R;G;B` or `5;N`).
|
|
1588
|
+
* @param change - the change from {@link sgrChanges}, its code first.
|
|
1589
|
+
* @returns the RGB, with a missing channel or index read as 0, or undefined for any other mode.
|
|
1396
1590
|
*/
|
|
1397
|
-
function
|
|
1398
|
-
const mode =
|
|
1591
|
+
function extendedColor(change) {
|
|
1592
|
+
const mode = change[1];
|
|
1399
1593
|
if (mode === 2) return {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
b: channel(colorParam(parts, index + 4))
|
|
1404
|
-
},
|
|
1405
|
-
skip: 4
|
|
1406
|
-
};
|
|
1407
|
-
if (mode === 5) return {
|
|
1408
|
-
color: ansi256Rgb(colorParam(parts, index + 2)),
|
|
1409
|
-
skip: 2
|
|
1410
|
-
};
|
|
1411
|
-
return {
|
|
1412
|
-
color: void 0,
|
|
1413
|
-
skip: mode === void 0 ? 0 : 1
|
|
1594
|
+
r: channel(change[2] ?? 0),
|
|
1595
|
+
g: channel(change[3] ?? 0),
|
|
1596
|
+
b: channel(change[4] ?? 0)
|
|
1414
1597
|
};
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
* Read one SGR numeric parameter, defaulting a missing slot to 0.
|
|
1418
|
-
* @param parts - the SGR parameter list.
|
|
1419
|
-
* @param index - the slot to read.
|
|
1420
|
-
* @returns the parameter, or 0 when it is absent.
|
|
1421
|
-
*/
|
|
1422
|
-
function colorParam(parts, index) {
|
|
1423
|
-
return parts[index] ?? 0;
|
|
1598
|
+
return mode === 5 ? ansi256Rgb(change[2] ?? 0) : void 0;
|
|
1424
1599
|
}
|
|
1425
1600
|
/**
|
|
1426
1601
|
* RGB for one xterm 256-color index.
|
|
@@ -1504,7 +1679,7 @@ var FadeTracker = class {
|
|
|
1504
1679
|
chunks = [];
|
|
1505
1680
|
openChunk = void 0;
|
|
1506
1681
|
constructor(options) {
|
|
1507
|
-
this.steps = options.steps ??
|
|
1682
|
+
this.steps = options.steps ?? 12;
|
|
1508
1683
|
this.stepMs = options.stepMs ?? 16;
|
|
1509
1684
|
this.now = options.now;
|
|
1510
1685
|
}
|
|
@@ -1672,15 +1847,23 @@ var FadeRegistry = class {
|
|
|
1672
1847
|
* there at all - text this tail never reached; that chunk and every older one
|
|
1673
1848
|
* then draw at the foreground, unchanged.
|
|
1674
1849
|
*
|
|
1675
|
-
* Styling inside a recolored run survives.
|
|
1676
|
-
* force at its
|
|
1677
|
-
* enclosing
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1850
|
+
* Styling inside a recolored run survives. Each run opens with the styling in
|
|
1851
|
+
* force at its first column, as {@link sliceColumns} restores it, so an
|
|
1852
|
+
* enclosing bold, italic, background, or hyperlink continues across it, and
|
|
1853
|
+
* keeps every sequence of its own except the ones a fade color replaces. In a
|
|
1854
|
+
* fade-in under `truecolor` or `ansi256`, text under the default foreground
|
|
1855
|
+
* draws at the run's level of the gray ramp, and text under an explicit
|
|
1856
|
+
* foreground, such as a syntax-colored token, draws at the same age's mix from
|
|
1857
|
+
* the ramp's darkest level to that foreground: the exact mix under `truecolor`
|
|
1858
|
+
* and the nearest 256-color index of the mix at the age's whole level under
|
|
1859
|
+
* `ansi256`. A run that crosses a color change takes a fade color for each
|
|
1860
|
+
* color it covers. The two-level mode and float-out open each run with one
|
|
1861
|
+
* sequence, under which an enclosing foreground keeps its color. Each
|
|
1862
|
+
* recolored line ends with `ESC[39m` (or `ESC[22m` in the two-level mode,
|
|
1863
|
+
* which also ends bold) after the line's own closing sequences, so the
|
|
1864
|
+
* recolor never leaks past the line it was applied to. Float-out resets
|
|
1865
|
+
* intensity before the mixed color so a dim wrapper does not stack on the
|
|
1866
|
+
* overlay, and at t >= 1 the original lines come back unchanged.
|
|
1684
1867
|
* @param lines - the rendered lines of the streaming block, newest text last.
|
|
1685
1868
|
* @param spans - the tail from {@link FadeTracker.spans}, oldest first.
|
|
1686
1869
|
* @param style - the capability and the ramp.
|
|
@@ -1694,13 +1877,14 @@ var FadeRegistry = class {
|
|
|
1694
1877
|
*/
|
|
1695
1878
|
function recolorTail(lines, spans, style, from = 0, mode = "in") {
|
|
1696
1879
|
if (spans.length === 0 || lines.length === 0) return [...lines];
|
|
1880
|
+
const mixing = tokenMix(style, mode);
|
|
1697
1881
|
const cells = new CellWalk(cellsFromEnd(lines));
|
|
1698
1882
|
const runs = [];
|
|
1699
1883
|
for (const span of [...spans].reverse()) {
|
|
1700
1884
|
const covered = consumeSpan(cells, span.text);
|
|
1701
1885
|
if (covered === void 0) break;
|
|
1702
1886
|
const sgr = mode === "out" ? floatOutSpanSgr(style, span.age) : fadeSgr(style, span.age);
|
|
1703
|
-
if (sgr !== "") collectRuns(runs, covered, sgr);
|
|
1887
|
+
if (sgr !== "") collectRuns(runs, covered, sgr, mixing === void 0 ? 0 : mixPosition(mixing, style.ramp.length, span.age));
|
|
1704
1888
|
}
|
|
1705
1889
|
const byLine = /* @__PURE__ */ new Map();
|
|
1706
1890
|
for (const run of runs) {
|
|
@@ -1709,12 +1893,44 @@ function recolorTail(lines, spans, style, from = 0, mode = "in") {
|
|
|
1709
1893
|
else known.unshift(run);
|
|
1710
1894
|
}
|
|
1711
1895
|
const restore = restoreFor(style.capability);
|
|
1896
|
+
const paint = mixing === void 0 ? (piece, run) => `${run.sgr}${piece}` : (piece, run) => fadeInRun(piece, run, mixing);
|
|
1712
1897
|
return lines.map((text, index) => {
|
|
1713
1898
|
const lineRuns = index < from ? void 0 : byLine.get(index);
|
|
1714
|
-
return lineRuns === void 0 ? text : paintLine(text, lineRuns, restore);
|
|
1899
|
+
return lineRuns === void 0 ? text : paintLine(text, lineRuns, restore, paint);
|
|
1715
1900
|
});
|
|
1716
1901
|
}
|
|
1717
1902
|
/**
|
|
1903
|
+
* Whether a recolor mixes syntax colors, and with what.
|
|
1904
|
+
* @param style - the capability and the ramp.
|
|
1905
|
+
* @param mode - the recolor's direction.
|
|
1906
|
+
* @returns the encoding and the start color for a fade-in under `truecolor`
|
|
1907
|
+
* or `ansi256` with a ramp; undefined for float-out, the two-level mode, no
|
|
1908
|
+
* capability, and an empty ramp, whose runs each open with one sequence.
|
|
1909
|
+
*/
|
|
1910
|
+
function tokenMix(style, mode) {
|
|
1911
|
+
const start = style.ramp[0];
|
|
1912
|
+
const { capability } = style;
|
|
1913
|
+
if (mode === "out" || start === void 0) return void 0;
|
|
1914
|
+
return capability === "truecolor" || capability === "ansi256" ? {
|
|
1915
|
+
capability,
|
|
1916
|
+
start
|
|
1917
|
+
} : void 0;
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* How far a syntax-colored chunk of one age has come toward its color. The
|
|
1921
|
+
* position reaches 1 at age `steps - 1`, where default-foreground text reaches
|
|
1922
|
+
* the last ramp level, and the 256-color encoding reads the age's whole level
|
|
1923
|
+
* as {@link fadeSgr} does.
|
|
1924
|
+
* @param mixing - the encoding.
|
|
1925
|
+
* @param steps - the ramp's level count.
|
|
1926
|
+
* @param age - the chunk's age in units of `stepMs`.
|
|
1927
|
+
* @returns the position from the ramp's darkest level to the color, 0 to 1.
|
|
1928
|
+
*/
|
|
1929
|
+
function mixPosition(mixing, steps, age) {
|
|
1930
|
+
const level = mixing.capability === "ansi256" ? Math.floor(age) : age;
|
|
1931
|
+
return Math.min(1, level / Math.max(1, steps - 1));
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1718
1934
|
* Walk the rendered lines backwards, one visible grapheme at a time. Lazy: a
|
|
1719
1935
|
* line is stripped and segmented only once the walk reaches it, so a long
|
|
1720
1936
|
* settled message costs nothing beyond the lines the tail touches.
|
|
@@ -1829,20 +2045,22 @@ function isBlank(grapheme) {
|
|
|
1829
2045
|
}
|
|
1830
2046
|
/**
|
|
1831
2047
|
* Turn covered cells into runs, merging each cell into the run to its right
|
|
1832
|
-
* when they touch on the same line under the same sequence.
|
|
2048
|
+
* when they touch on the same line under the same sequence and mix.
|
|
1833
2049
|
* @param runs - runs collected so far, in the walk's right-to-left order.
|
|
1834
2050
|
* @param covered - the cells one chunk covers.
|
|
1835
2051
|
* @param sgr - the sequence the chunk draws under.
|
|
2052
|
+
* @param mix - the chunk's position toward a syntax color, from {@link mixPosition}.
|
|
1836
2053
|
*/
|
|
1837
|
-
function collectRuns(runs, covered, sgr) {
|
|
2054
|
+
function collectRuns(runs, covered, sgr, mix) {
|
|
1838
2055
|
for (const cell of covered) {
|
|
1839
2056
|
const previous = runs.at(-1);
|
|
1840
|
-
if (previous !== void 0 && previous.line === cell.line && previous.
|
|
2057
|
+
if (previous !== void 0 && previous.line === cell.line && previous.start === cell.column + cell.width && previous.sgr === sgr && previous.mix === mix) previous.start = cell.column;
|
|
1841
2058
|
else runs.push({
|
|
1842
2059
|
line: cell.line,
|
|
1843
2060
|
start: cell.column,
|
|
1844
2061
|
end: cell.column + cell.width,
|
|
1845
|
-
sgr
|
|
2062
|
+
sgr,
|
|
2063
|
+
mix
|
|
1846
2064
|
});
|
|
1847
2065
|
}
|
|
1848
2066
|
}
|
|
@@ -1851,17 +2069,76 @@ function collectRuns(runs, covered, sgr) {
|
|
|
1851
2069
|
* @param text - the rendered line.
|
|
1852
2070
|
* @param runs - the line's runs, in column order.
|
|
1853
2071
|
* @param restore - the sequence that ends the last run.
|
|
1854
|
-
* @
|
|
1855
|
-
*
|
|
2072
|
+
* @param paint - draws one run's piece from {@link sliceColumns} in the run's fade.
|
|
2073
|
+
* @returns the line with each run painted, the text between runs untouched,
|
|
2074
|
+
* and the line's own trailing sequences kept ahead of `restore`.
|
|
1856
2075
|
*/
|
|
1857
|
-
function paintLine(text, runs, restore) {
|
|
2076
|
+
function paintLine(text, runs, restore, paint) {
|
|
1858
2077
|
const pieces = sliceColumns(text, runs.flatMap((run) => [run.start, run.end]));
|
|
1859
2078
|
let out = pieces[0];
|
|
1860
2079
|
runs.forEach((run, index) => {
|
|
1861
|
-
out += `${
|
|
2080
|
+
out += `${paint(pieces[2 * index + 1], run)}${pieces[2 * index + 2]}`;
|
|
1862
2081
|
});
|
|
1863
2082
|
return `${out}${restore}`;
|
|
1864
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Draw one fade-in run whose text may sit under several foregrounds. Text
|
|
2086
|
+
* under the default foreground draws in `run.sgr`; text under an explicit
|
|
2087
|
+
* foreground draws at `run.mix` of the way from `mixing.start` to that
|
|
2088
|
+
* foreground. The fade color is written before the run's first text and
|
|
2089
|
+
* again after a sequence that changed the foreground. A sequence that only
|
|
2090
|
+
* sets the foreground is left out when text follows it, since the fade color
|
|
2091
|
+
* takes its place; every other sequence stays where it was.
|
|
2092
|
+
* @param piece - the run's piece from {@link sliceColumns}, which opens with
|
|
2093
|
+
* the styling in force at the run's first column.
|
|
2094
|
+
* @param run - the run.
|
|
2095
|
+
* @param mixing - the encoding and the start color.
|
|
2096
|
+
* @returns the run with its fade colors; the sequences after its last text,
|
|
2097
|
+
* every one of them, as written.
|
|
2098
|
+
*/
|
|
2099
|
+
function fadeInRun(piece, run, mixing) {
|
|
2100
|
+
const state = {
|
|
2101
|
+
color: void 0,
|
|
2102
|
+
dim: false
|
|
2103
|
+
};
|
|
2104
|
+
let out = "";
|
|
2105
|
+
let kept = "";
|
|
2106
|
+
let read = "";
|
|
2107
|
+
let stale = true;
|
|
2108
|
+
for (const part of lineParts(piece)) {
|
|
2109
|
+
if (part.sequence) {
|
|
2110
|
+
read += part.text;
|
|
2111
|
+
const effect = foregroundEffect(part.text);
|
|
2112
|
+
if (effect !== "none") {
|
|
2113
|
+
applySgr(state, part.text);
|
|
2114
|
+
stale = true;
|
|
2115
|
+
}
|
|
2116
|
+
if (effect !== "only") kept += part.text;
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
out += kept;
|
|
2120
|
+
if (stale) out += state.color === void 0 ? run.sgr : encodeMix(mixing.capability, mixFadeColor(mixing.start, state.color, run.mix));
|
|
2121
|
+
out += part.text;
|
|
2122
|
+
kept = "";
|
|
2123
|
+
read = "";
|
|
2124
|
+
stale = false;
|
|
2125
|
+
}
|
|
2126
|
+
return `${out}${read}`;
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2129
|
+
* What one escape sequence does to the foreground.
|
|
2130
|
+
* @param sequence - one escape sequence from {@link lineParts}.
|
|
2131
|
+
* @returns `only` for an SGR whose every change sets or clears the
|
|
2132
|
+
* foreground, `some` for an SGR with a full reset or a foreground change
|
|
2133
|
+
* among other changes, and `none` for any other sequence.
|
|
2134
|
+
*/
|
|
2135
|
+
function foregroundEffect(sequence) {
|
|
2136
|
+
if (!isSgr(sequence)) return "none";
|
|
2137
|
+
const changes = sgrChanges(sequence);
|
|
2138
|
+
const touching = changes.filter((change) => change[0] === 0 || setsForeground(change[0]));
|
|
2139
|
+
if (touching.length === 0) return "none";
|
|
2140
|
+
return touching.length === changes.length && touching.every((change) => change[0] !== 0) ? "only" : "some";
|
|
2141
|
+
}
|
|
1865
2142
|
//#endregion
|
|
1866
2143
|
//#region lib/types/json-tree.js
|
|
1867
2144
|
/**
|
|
@@ -2279,10 +2556,19 @@ function hunks(lines, context) {
|
|
|
2279
2556
|
//#endregion
|
|
2280
2557
|
//#region lib/types/stream-args.js
|
|
2281
2558
|
/**
|
|
2282
|
-
*
|
|
2283
|
-
*
|
|
2559
|
+
* Rows a tool card draws for its arguments: the raw input of a call whose
|
|
2560
|
+
* presenter supplied no content, and the live rows of a call whose argument
|
|
2561
|
+
* JSON is still streaming. A live path, command, or description appears once
|
|
2562
|
+
* its key is complete; a content key appears as a size that grows while its
|
|
2563
|
+
* text arrives, never as the text.
|
|
2284
2564
|
* @module @deepseek-ai/dsh-tui-app/stream-args
|
|
2285
2565
|
*/
|
|
2566
|
+
/** Keys whose text is shown as a size, not as the text itself. */
|
|
2567
|
+
const SIZED_KEYS = [
|
|
2568
|
+
"content",
|
|
2569
|
+
"old_string",
|
|
2570
|
+
"new_string"
|
|
2571
|
+
];
|
|
2286
2572
|
/**
|
|
2287
2573
|
* Rows for a generic card's raw input when the presenter supplied no content.
|
|
2288
2574
|
* A todo list becomes one status line per item. A string is the program or path.
|
|
@@ -2323,6 +2609,34 @@ function todoLines$1(value) {
|
|
|
2323
2609
|
}
|
|
2324
2610
|
return lines;
|
|
2325
2611
|
}
|
|
2612
|
+
/**
|
|
2613
|
+
* Rows for the arguments of a call that are still streaming: the path
|
|
2614
|
+
* (`file_path`, else `path`), the command, and the first line of the
|
|
2615
|
+
* description, each once its key is complete, then one size row per text key
|
|
2616
|
+
* that holds content (`content`, `old_string`, `new_string`), as in
|
|
2617
|
+
* `content 3 KB`. A size counts the text decoded so far in UTF-16 units,
|
|
2618
|
+
* rounds up to whole kilobytes of 1024, and grows while the text arrives.
|
|
2619
|
+
* @param partial - the live argument parser.
|
|
2620
|
+
* @returns the rows; empty while no key has anything to show.
|
|
2621
|
+
*/
|
|
2622
|
+
function streamedArgumentLines(partial) {
|
|
2623
|
+
const lines = [];
|
|
2624
|
+
const path = partial.complete("file_path") ? partial.text("file_path") : partial.complete("path") ? partial.text("path") : void 0;
|
|
2625
|
+
if (path !== void 0 && path !== "") lines.push(path);
|
|
2626
|
+
const command = partial.complete("command") ? partial.text("command") : void 0;
|
|
2627
|
+
if (command !== void 0 && command !== "") lines.push(command);
|
|
2628
|
+
const description = partial.complete("description") ? partial.text("description") : void 0;
|
|
2629
|
+
if (description !== void 0 && description !== "") {
|
|
2630
|
+
const first = description.split("\n")[0];
|
|
2631
|
+
if (first !== void 0 && first !== "") lines.push(first);
|
|
2632
|
+
}
|
|
2633
|
+
for (const key of SIZED_KEYS) {
|
|
2634
|
+
const length = partial.stringLength(key);
|
|
2635
|
+
if (length === void 0 || length === 0) continue;
|
|
2636
|
+
lines.push(`${key} ${String(Math.max(1, Math.ceil(length / 1024)))} KB`);
|
|
2637
|
+
}
|
|
2638
|
+
return lines;
|
|
2639
|
+
}
|
|
2326
2640
|
//#endregion
|
|
2327
2641
|
//#region lib/types/transcript.js
|
|
2328
2642
|
/**
|
|
@@ -4402,17 +4716,18 @@ const WORKFLOW_SPINNER = [
|
|
|
4402
4716
|
];
|
|
4403
4717
|
/**
|
|
4404
4718
|
* Bloom frames for the live Thinking header, disjoint from every tool
|
|
4405
|
-
* family; completed reasoning keeps its static `✻`.
|
|
4719
|
+
* family; completed reasoning keeps its static `✻`. No frame has the Unicode
|
|
4720
|
+
* `Emoji` property, so a terminal never draws one from a colour emoji font.
|
|
4406
4721
|
*/
|
|
4407
4722
|
const THINKING_SPINNER = [
|
|
4408
4723
|
"☙",
|
|
4409
|
-
"
|
|
4410
|
-
"
|
|
4411
|
-
"
|
|
4724
|
+
"⊛",
|
|
4725
|
+
"✠",
|
|
4726
|
+
"☼",
|
|
4412
4727
|
"※",
|
|
4413
|
-
"
|
|
4728
|
+
"⁜",
|
|
4414
4729
|
"⁂",
|
|
4415
|
-
"
|
|
4730
|
+
"⍟"
|
|
4416
4731
|
];
|
|
4417
4732
|
/** Blank steps between two shimmer passes, so the sweep pauses past the word's end. */
|
|
4418
4733
|
const SHIMMER_GAP = 6;
|
|
@@ -16015,6 +16330,15 @@ function assumedForeground(background) {
|
|
|
16015
16330
|
return (.2126 * background.r + .7152 * background.g + .0722 * background.b) / 255 < DARK_BACKGROUND_LUMINANCE ? LIGHT_FOREGROUND : DARK_FOREGROUND;
|
|
16016
16331
|
}
|
|
16017
16332
|
/**
|
|
16333
|
+
* Whether two lists of card rows are the same rows in the same order.
|
|
16334
|
+
* @param rows - the rows a streamed call reads now.
|
|
16335
|
+
* @param drawn - the rows the card last drew.
|
|
16336
|
+
* @returns true when `drawn` holds exactly `rows`.
|
|
16337
|
+
*/
|
|
16338
|
+
function sameRows(rows, drawn) {
|
|
16339
|
+
return drawn.length === rows.length && rows.every((row, index) => row === drawn[index]);
|
|
16340
|
+
}
|
|
16341
|
+
/**
|
|
16018
16342
|
* Where one step along the status bar's segments lands: one either way,
|
|
16019
16343
|
* wrapping at both ends, or straight to an end.
|
|
16020
16344
|
* @param to - which way the key steps.
|
|
@@ -16354,7 +16678,7 @@ var TuiApp = class {
|
|
|
16354
16678
|
/** The global fold action has not chosen a workflow default until the first `Ctrl+O`. */
|
|
16355
16679
|
workflowExpanded;
|
|
16356
16680
|
toolArguments = /* @__PURE__ */ new Map();
|
|
16357
|
-
/**
|
|
16681
|
+
/** The arguments each call streamed so far through `tool-call-delta` chunks, keyed by call id. */
|
|
16358
16682
|
toolStreamArgs = /* @__PURE__ */ new Map();
|
|
16359
16683
|
/** Cards mounted from the live stream that no logged `tool/call` has confirmed yet. */
|
|
16360
16684
|
unconfirmedTools = /* @__PURE__ */ new Map();
|
|
@@ -21274,7 +21598,7 @@ var TuiApp = class {
|
|
|
21274
21598
|
this.toolStreamArgs.delete(callId);
|
|
21275
21599
|
this.pendingToolNames.set(callId, name);
|
|
21276
21600
|
this.setLoaderActivity(callingActivity(name));
|
|
21277
|
-
this.upsertToolCard(callId, name, argumentsJson
|
|
21601
|
+
this.upsertToolCard(callId, name, argumentsJson);
|
|
21278
21602
|
this.rememberWorkflowCall(callId, this.toolArguments.get(callId));
|
|
21279
21603
|
break;
|
|
21280
21604
|
}
|
|
@@ -21766,17 +22090,27 @@ var TuiApp = class {
|
|
|
21766
22090
|
}
|
|
21767
22091
|
/**
|
|
21768
22092
|
* Mount or refresh a tool card from a stream delta: the name as soon as
|
|
21769
|
-
* the model sends one,
|
|
21770
|
-
*
|
|
22093
|
+
* the model sends one, the rows {@link streamedArgumentLines} reads off the
|
|
22094
|
+
* arguments while their JSON is open, then the presenter headline once it
|
|
22095
|
+
* closes and parses.
|
|
21771
22096
|
* @param chunk - one `tool-call-delta` of the live assistant stream.
|
|
21772
22097
|
*/
|
|
21773
22098
|
onToolCallDelta(chunk) {
|
|
21774
22099
|
const name = this.streamedToolName(chunk);
|
|
21775
22100
|
if (chunk.id === "") return;
|
|
21776
|
-
|
|
21777
|
-
|
|
22101
|
+
let streamed = this.toolStreamArgs.get(chunk.id);
|
|
22102
|
+
if (streamed === void 0) {
|
|
22103
|
+
streamed = {
|
|
22104
|
+
text: "",
|
|
22105
|
+
partial: new PartialArguments(),
|
|
22106
|
+
rows: void 0
|
|
22107
|
+
};
|
|
22108
|
+
this.toolStreamArgs.set(chunk.id, streamed);
|
|
22109
|
+
}
|
|
22110
|
+
streamed.text += chunk.argumentsDelta;
|
|
22111
|
+
streamed.partial.append(chunk.argumentsDelta);
|
|
21778
22112
|
if (name === void 0) return;
|
|
21779
|
-
this.upsertToolCard(chunk.id, name,
|
|
22113
|
+
this.upsertToolCard(chunk.id, name, streamed.text, streamed);
|
|
21780
22114
|
}
|
|
21781
22115
|
/**
|
|
21782
22116
|
* Draw one tool card, creating it on the first sighting and updating the
|
|
@@ -21785,20 +22119,24 @@ var TuiApp = class {
|
|
|
21785
22119
|
* @param callId - the model's call id.
|
|
21786
22120
|
* @param name - the tool name.
|
|
21787
22121
|
* @param argumentsJson - arguments accumulated so far, or the logged string.
|
|
21788
|
-
* @param
|
|
22122
|
+
* @param streamed - a live call's arguments, which are parsed whole only
|
|
22123
|
+
* once their outer object closed; absent for the durable call.
|
|
21789
22124
|
*/
|
|
21790
|
-
upsertToolCard(callId, name, argumentsJson,
|
|
21791
|
-
const args = parseArguments(argumentsJson);
|
|
22125
|
+
upsertToolCard(callId, name, argumentsJson, streamed) {
|
|
22126
|
+
const args = streamed === void 0 || streamed.partial.closed() ? parseArguments(argumentsJson) : void 0;
|
|
21792
22127
|
if (args !== void 0) this.toolArguments.set(callId, args);
|
|
21793
|
-
const
|
|
21794
|
-
title: "",
|
|
21795
|
-
lines: []
|
|
21796
|
-
} : toolCallText(argumentsJson, args === void 0 ? void 0 : this.presentCall(name, args), name);
|
|
22128
|
+
const rows = streamed !== void 0 && args === void 0 ? streamedArgumentLines(streamed.partial) : void 0;
|
|
21797
22129
|
const existing = this.toolBlocks.get(callId);
|
|
22130
|
+
if (existing !== void 0 && rows !== void 0 && streamed?.rows !== void 0 && sameRows(rows, streamed.rows)) return;
|
|
22131
|
+
if (streamed !== void 0) streamed.rows = rows;
|
|
22132
|
+
const call = rows === void 0 ? toolCallText(argumentsJson, args === void 0 ? void 0 : this.presentCall(name, args), name) : {
|
|
22133
|
+
title: "",
|
|
22134
|
+
lines: rows
|
|
22135
|
+
};
|
|
21798
22136
|
if (existing !== void 0) {
|
|
21799
22137
|
existing.setCall(name, call);
|
|
21800
22138
|
if (isSubagentTool(name)) existing.setSubagent(subagentRowFacts(args));
|
|
21801
|
-
if (
|
|
22139
|
+
if (streamed === void 0) this.unconfirmedTools.delete(callId);
|
|
21802
22140
|
this.trackReveal(existing);
|
|
21803
22141
|
return;
|
|
21804
22142
|
}
|
|
@@ -21809,7 +22147,7 @@ var TuiApp = class {
|
|
|
21809
22147
|
this.chat.addChild(block);
|
|
21810
22148
|
this.revealBlock(block);
|
|
21811
22149
|
this.spinBlock(block);
|
|
21812
|
-
if (
|
|
22150
|
+
if (streamed !== void 0) this.unconfirmedTools.set(callId, block);
|
|
21813
22151
|
}
|
|
21814
22152
|
/**
|
|
21815
22153
|
* Take down every card the live stream mounted that no `tool/call` confirmed.
|
|
@@ -21943,7 +22281,7 @@ const Config = z.object({
|
|
|
21943
22281
|
toastMs: z.natural().min(500).default(TOAST_MS),
|
|
21944
22282
|
quitGraceMs: z.natural().min(1e3).default(1e4),
|
|
21945
22283
|
liveRefreshMs: z.natural().min(100).default(1e3),
|
|
21946
|
-
streamFadeSteps: z.natural().min(2).default(
|
|
22284
|
+
streamFadeSteps: z.natural().min(2).default(12),
|
|
21947
22285
|
streamFadeStepMs: z.natural().min(16).default(16),
|
|
21948
22286
|
streamPaceFrames: z.natural().default(8),
|
|
21949
22287
|
toolRevealFrames: z.natural().default(6),
|
|
@@ -45,10 +45,10 @@ function isLargeIdContinue(cp) {
|
|
|
45
45
|
return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? largeIdContinueRanges : (largeIdContinueRanges = initLargeIdContinueRanges()));
|
|
46
46
|
}
|
|
47
47
|
function initLargeIdStartRanges() {
|
|
48
|
-
return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11
|
|
48
|
+
return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 2 1 7 14 3 1 1w q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 6 h 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 2 1 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 v 2 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 g g 2r 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 2a 5 0 f g 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 3 1 3 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 d 1t 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 7 p 13 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 5 i l i s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 i 0 52 w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 o 17 m 0 6n i g 0 2 c 2 x 3h 0 28 pl 2v 33 6 5q d 8m 1sa 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r x o 3 o 19 22 6 0 1v c 1t 1 2 0 f 4 a 5p6 11 x 2o 36 e pd f 1e 5y6 3 2 6 2 1 2 88 a 0 u 2 3 0 f 4 8 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9g 2 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 3l f 6 1j 1e 1d 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 5s u 2 2 2 1 2 6 3 4 a 1 69 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 3dq 2 4gd 3 5rk g h9 1wj f1 15v 3t6 6 6jt upz 8qn");
|
|
49
49
|
}
|
|
50
50
|
function initLargeIdContinueRanges() {
|
|
51
|
-
return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2
|
|
51
|
+
return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 2 1z a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 6 4 b 1 3 9 j 0 1o 4 4 2 2 3 a 0 f 9 h 4 1k 0 2 6 2 2 2 3 8 1 c 1 3 9 i 2 1l 0 2 6 2 2 2 3 8 1 c 1 3 9 4 0 d 3 1k 1 2 6 2 2 2 3 a 0 b 1 3 9 i 2 1z 0 5 5 2 0 2 7 7 9 3 1 1q 0 3 6 d 7 2 9 2g 0 3 8 c 6 2 9 1r 1 7 9 c 0 2 0 2 0 5 1 1e j 2 1 6 a 2 z a 0 2t j 2 9 d 3 5 2 2 2 3 6 4 3 e b 2 e jk 2 a 8 pt 3 t 2 u 1 v 1 1t v a 0 3 9 y 2 2 a 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 1d g 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1r el 1 1e 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 2p 0 n51 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 12 0 ig 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 7 9 w 4 8u 1 v 4 x f 1z a 1e 3 3f 2 1i e w a 3 1 b 3 1a a 8 0 1a 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 3 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 5j 7 3t 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 1j 9 7 0 77 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m dd 1 1p 4 4 5 9 7 3 6 v 3 45 2 c 2 9 1 3 0 x 1 11p 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 6h 0 3 0 8 1 6 0 d7 6 32 6 6 9 3o7 9 gvt3 6n");
|
|
52
52
|
}
|
|
53
53
|
function isInRange(cp, ranges) {
|
|
54
54
|
let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0;
|
|
@@ -125,7 +125,7 @@ class DataSet {
|
|
|
125
125
|
const gcNameSet = new Set(["General_Category", "gc"]);
|
|
126
126
|
const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
|
|
127
127
|
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "", "");
|
|
128
|
-
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", "");
|
|
128
|
+
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Jurc Jurchen Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Pcun Proto_Cuneiform Seal Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", "");
|
|
129
129
|
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "", "");
|
|
130
130
|
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "", "");
|
|
131
131
|
function isValidUnicodeProperty(version, name, value) {
|
|
@@ -41,10 +41,10 @@ function isLargeIdContinue(cp) {
|
|
|
41
41
|
return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? largeIdContinueRanges : (largeIdContinueRanges = initLargeIdContinueRanges()));
|
|
42
42
|
}
|
|
43
43
|
function initLargeIdStartRanges() {
|
|
44
|
-
return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11
|
|
44
|
+
return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 2 1 7 14 3 1 1w q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 6 h 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 2 1 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 v 2 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 g g 2r 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 2a 5 0 f g 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 3 1 3 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 d 1t 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 7 p 13 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 5 i l i s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 i 0 52 w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 o 17 m 0 6n i g 0 2 c 2 x 3h 0 28 pl 2v 33 6 5q d 8m 1sa 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r x o 3 o 19 22 6 0 1v c 1t 1 2 0 f 4 a 5p6 11 x 2o 36 e pd f 1e 5y6 3 2 6 2 1 2 88 a 0 u 2 3 0 f 4 8 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9g 2 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 3l f 6 1j 1e 1d 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 5s u 2 2 2 1 2 6 3 4 a 1 69 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 3dq 2 4gd 3 5rk g h9 1wj f1 15v 3t6 6 6jt upz 8qn");
|
|
45
45
|
}
|
|
46
46
|
function initLargeIdContinueRanges() {
|
|
47
|
-
return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2
|
|
47
|
+
return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 2 1z a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 6 4 b 1 3 9 j 0 1o 4 4 2 2 3 a 0 f 9 h 4 1k 0 2 6 2 2 2 3 8 1 c 1 3 9 i 2 1l 0 2 6 2 2 2 3 8 1 c 1 3 9 4 0 d 3 1k 1 2 6 2 2 2 3 a 0 b 1 3 9 i 2 1z 0 5 5 2 0 2 7 7 9 3 1 1q 0 3 6 d 7 2 9 2g 0 3 8 c 6 2 9 1r 1 7 9 c 0 2 0 2 0 5 1 1e j 2 1 6 a 2 z a 0 2t j 2 9 d 3 5 2 2 2 3 6 4 3 e b 2 e jk 2 a 8 pt 3 t 2 u 1 v 1 1t v a 0 3 9 y 2 2 a 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 1d g 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1r el 1 1e 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 2p 0 n51 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 12 0 ig 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 7 9 w 4 8u 1 v 4 x f 1z a 1e 3 3f 2 1i e w a 3 1 b 3 1a a 8 0 1a 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 3 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 5j 7 3t 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 1j 9 7 0 77 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m dd 1 1p 4 4 5 9 7 3 6 v 3 45 2 c 2 9 1 3 0 x 1 11p 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 6h 0 3 0 8 1 6 0 d7 6 32 6 6 9 3o7 9 gvt3 6n");
|
|
48
48
|
}
|
|
49
49
|
function isInRange(cp, ranges) {
|
|
50
50
|
let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0;
|
|
@@ -121,7 +121,7 @@ class DataSet {
|
|
|
121
121
|
const gcNameSet = new Set(["General_Category", "gc"]);
|
|
122
122
|
const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
|
|
123
123
|
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "", "");
|
|
124
|
-
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", "");
|
|
124
|
+
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Jurc Jurchen Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Pcun Proto_Cuneiform Seal Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", "");
|
|
125
125
|
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "", "");
|
|
126
126
|
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "", "");
|
|
127
127
|
function isValidUnicodeProperty(version, name, value) {
|
|
@@ -13,9 +13,10 @@ async function generalDecrypt(jwe, key, options) {
|
|
|
13
13
|
throw new JWEInvalid("JWE Recipients missing or incorrect type");
|
|
14
14
|
if (!recipients.length)
|
|
15
15
|
throw new JWEInvalid("JWE Recipients has no members");
|
|
16
|
-
|
|
16
|
+
const shared = prepareDecrypt(options);
|
|
17
|
+
let sharedJwe, token;
|
|
17
18
|
try {
|
|
18
|
-
|
|
19
|
+
sharedJwe = snapshotSharedJWE(jwe), token = shareJWE(sharedJwe);
|
|
19
20
|
} catch {
|
|
20
21
|
throw new JWEDecryptionFailed();
|
|
21
22
|
}
|
|
@@ -5,7 +5,7 @@ function isCloudflareWorkers() {
|
|
|
5
5
|
return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
|
|
6
6
|
}
|
|
7
7
|
let USER_AGENT;
|
|
8
|
-
(typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.
|
|
8
|
+
(typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.16");
|
|
9
9
|
const customFetch = /* @__PURE__ */ Symbol();
|
|
10
10
|
async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
|
|
11
11
|
const response = await fetchImpl(url, {
|
|
@@ -22,15 +22,9 @@ async function generalVerify(jws, key, options) {
|
|
|
22
22
|
const signatureEntries = Array.from(signatures);
|
|
23
23
|
if (!signatureEntries.every(isObject))
|
|
24
24
|
throw new JWSInvalid("JWS Signatures missing or incorrect type");
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
if (inputPayload === void 0)
|
|
28
|
-
throw new Error();
|
|
29
|
-
shared = prepareVerify(options);
|
|
30
|
-
} catch {
|
|
25
|
+
if (inputPayload === void 0)
|
|
31
26
|
throw new JWSSignatureVerificationFailed();
|
|
32
|
-
|
|
33
|
-
const payload = inputPayload instanceof Uint8Array ? new Uint8Array(inputPayload) : inputPayload, candidates = signatureEntries.map((signature) => snapshotSignature(signature, payload)).filter((candidate) => candidate !== void 0);
|
|
27
|
+
const shared = prepareVerify(options), payload = inputPayload instanceof Uint8Array ? new Uint8Array(inputPayload) : inputPayload, candidates = signatureEntries.map((signature) => snapshotSignature(signature, payload)).filter((candidate) => candidate !== void 0);
|
|
34
28
|
let payloadEncodings = 0;
|
|
35
29
|
for (const [, , payloadEncoding] of candidates)
|
|
36
30
|
if (payloadEncodings |= payloadEncoding, payloadEncodings === 3)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decrypt, generateCek } from "./content_encryption.js";
|
|
2
2
|
import { decodeBase64url, encodeAsciiMember, parseJoseHeader, isDisjoint, isObject, validateCrit, validateAlgorithms, JWE_RECOGNIZED } from "./validate.js";
|
|
3
3
|
import { JOSEAlgNotAllowed, JOSENotSupported, JWEInvalid } from "../util/errors.js";
|
|
4
|
-
import { decryptKeyManagement } from "./key_management.js";
|
|
4
|
+
import { decryptKeyManagement, validateMaxPBES2Count } from "./key_management.js";
|
|
5
5
|
import { decoder } from "./buffer_utils.js";
|
|
6
6
|
import { prepareKey } from "./key.js";
|
|
7
7
|
import { JWE, isJWECEKTransport, jweAlgorithm, jweEncryption } from "./jwe_algorithms.js";
|
|
@@ -69,12 +69,17 @@ function shareJWE(jwe) {
|
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
function prepareDecrypt(options) {
|
|
72
|
+
const keyManagementAlgorithms = options && validateAlgorithms("keyManagementAlgorithms", options.keyManagementAlgorithms), contentEncryptionAlgorithms = options && validateAlgorithms("contentEncryptionAlgorithms", options.contentEncryptionAlgorithms), { crit, maxPBES2Count, maxDecompressedLength } = options ?? {};
|
|
73
|
+
validateMaxPBES2Count(maxPBES2Count);
|
|
74
|
+
const decompressionLimit = maxDecompressedLength ?? 25e4;
|
|
75
|
+
if (decompressionLimit !== 0 && decompressionLimit !== 1 / 0 && (!Number.isSafeInteger(decompressionLimit) || decompressionLimit < 1))
|
|
76
|
+
throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");
|
|
72
77
|
return [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
keyManagementAlgorithms,
|
|
79
|
+
contentEncryptionAlgorithms,
|
|
80
|
+
crit,
|
|
81
|
+
maxPBES2Count,
|
|
82
|
+
maxDecompressedLength
|
|
78
83
|
];
|
|
79
84
|
}
|
|
80
85
|
async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
|
|
@@ -145,8 +150,6 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
|
|
|
145
150
|
const decompressionLimit = maxDecompressedLength ?? 25e4;
|
|
146
151
|
if (decompressionLimit === 0)
|
|
147
152
|
throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
|
|
148
|
-
if (decompressionLimit !== 1 / 0 && (!Number.isSafeInteger(decompressionLimit) || decompressionLimit < 1))
|
|
149
|
-
throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");
|
|
150
153
|
plaintext = await decompress(plaintext, decompressionLimit).catch((cause) => {
|
|
151
154
|
throw cause instanceof JWEInvalid ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
|
|
152
155
|
});
|
|
@@ -111,7 +111,6 @@ async function decryptKeyManagement(entry, enc, key, encryptedKey, joseHeader, m
|
|
|
111
111
|
case "PBKDF2": {
|
|
112
112
|
if (typeof joseHeader.p2c != "number")
|
|
113
113
|
throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');
|
|
114
|
-
validateMaxPBES2Count(maxPBES2Count);
|
|
115
114
|
const p2cLimit = maxPBES2Count ?? 1e4;
|
|
116
115
|
if (joseHeader.p2c > p2cLimit)
|
|
117
116
|
throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@songtonyli/dsh-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.100",
|
|
4
4
|
"description": "The dsh terminal agent: an interactive TUI over the DeepSeek Harness, with its whole Node runtime bundled in one install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
"@earendil-works/pi-schema": "1.5.0",
|
|
384
384
|
"@earendil-works/pi-telemetry": "1.5.0",
|
|
385
385
|
"@earendil-works/pi-tui": "0.85.1",
|
|
386
|
-
"@eslint-community/regexpp": "4.12.
|
|
386
|
+
"@eslint-community/regexpp": "4.12.3",
|
|
387
387
|
"@google/genai": "2.21.0",
|
|
388
388
|
"@img/colour": "1.1.0",
|
|
389
389
|
"@joplin/turndown-plugin-gfm": "1.0.68",
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
"is-unicode-supported": "2.1.0",
|
|
528
528
|
"is-wsl": "3.1.1",
|
|
529
529
|
"isexe": "2.0.0",
|
|
530
|
-
"jose": "6.2.
|
|
530
|
+
"jose": "6.2.16",
|
|
531
531
|
"js-tokens": "4.0.0",
|
|
532
532
|
"js-yaml": "4.3.2",
|
|
533
533
|
"jsbi": "4.3.2",
|