@songtonyli/dsh-cli 0.1.95 → 0.1.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +1 -0
  4. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
  5. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  6. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +0 -4
  7. package/node_modules/@deepseek-ai/dsh-session-continuation/README.i18n.yaml +15 -6
  8. package/node_modules/@deepseek-ai/dsh-session-continuation/README.md +10 -2
  9. package/node_modules/@deepseek-ai/dsh-session-continuation/README.zh.md +11 -3
  10. package/node_modules/@deepseek-ai/dsh-session-continuation/lib/index.js +4 -1
  11. package/node_modules/@deepseek-ai/dsh-session-continuation/lib/types/index.js +5 -2
  12. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +8 -8
  13. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +6 -2
  14. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +6 -2
  15. package/node_modules/@deepseek-ai/dsh-tui-app/cordis.patch.yml +0 -5
  16. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +18 -4
  17. package/node_modules/@swc/helpers/cjs/_ts_add_disposable_resource.cjs +41 -1
  18. package/node_modules/@swc/helpers/cjs/_ts_decorate.cjs +15 -1
  19. package/node_modules/@swc/helpers/cjs/_ts_dispose_resources.cjs +44 -1
  20. package/node_modules/@swc/helpers/cjs/_ts_metadata.cjs +7 -1
  21. package/node_modules/@swc/helpers/cjs/_ts_param.cjs +7 -1
  22. package/node_modules/@swc/helpers/cjs/_ts_rewrite_relative_import_extension.cjs +10 -1
  23. package/node_modules/@swc/helpers/cjs/_ts_values.cjs +19 -1
  24. package/node_modules/@swc/helpers/cjs/_unsupported_iterable_to_array.cjs +1 -1
  25. package/node_modules/@swc/helpers/cjs/index.cjs +0 -4
  26. package/node_modules/@swc/helpers/esm/_ts_add_disposable_resource.js +41 -1
  27. package/node_modules/@swc/helpers/esm/_ts_decorate.js +15 -1
  28. package/node_modules/@swc/helpers/esm/_ts_dispose_resources.js +44 -1
  29. package/node_modules/@swc/helpers/esm/_ts_metadata.js +7 -1
  30. package/node_modules/@swc/helpers/esm/_ts_param.js +7 -1
  31. package/node_modules/@swc/helpers/esm/_ts_rewrite_relative_import_extension.js +10 -1
  32. package/node_modules/@swc/helpers/esm/_ts_values.js +19 -1
  33. package/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js +1 -1
  34. package/node_modules/@swc/helpers/esm/index.js +0 -1
  35. package/node_modules/@swc/helpers/package.json +2 -11
  36. package/node_modules/@swc/helpers/scripts/ast_grep.js +5 -25
  37. package/node_modules/@swc/helpers/scripts/build.js +2 -1
  38. package/node_modules/turndown/dist/turndown.js +18 -15
  39. package/node_modules/turndown/lib/turndown.browser.cjs.js +18 -15
  40. package/node_modules/turndown/lib/turndown.browser.es.js +18 -15
  41. package/node_modules/turndown/lib/turndown.browser.umd.js +18 -15
  42. package/node_modules/turndown/lib/turndown.cjs.js +18 -15
  43. package/node_modules/turndown/lib/turndown.es.js +18 -15
  44. package/node_modules/turndown/lib/turndown.umd.js +18 -15
  45. package/node_modules/turndown/package.json +4 -3
  46. package/package.json +3 -3
  47. package/node_modules/@swc/helpers/_/_jsx/package.json +0 -4
  48. package/node_modules/@swc/helpers/cjs/_jsx.cjs +0 -28
  49. package/node_modules/@swc/helpers/esm/_jsx.js +0 -26
  50. package/node_modules/@swc/helpers/src/_jsx.mjs +0 -1
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.95; `dsh --version`
29
+ Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.96; `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.95 (deepseek-harness 0.2.2-rc.1)')
21
+ console.log('@songtonyli/dsh-cli 0.1.96 (deepseek-harness 0.2.2-rc.1)')
22
22
  process.exit(0)
23
23
  }
24
24
 
@@ -389,6 +389,7 @@ Every package below exports a Cordis plugin that a bundle patch can name in a Lo
389
389
  |---|---|---|
390
390
  | `@deepseek-ai/dsh-message-quotes` | no | Selected-text quotation and Markdown blockquote presentation |
391
391
  | `@deepseek-ai/dsh-session-checkpoint-policy` | no | Semantic session durability checkpoints before model requests and tool side effects |
392
+ | `@deepseek-ai/dsh-session-continuation` | no | Failed-turn continuation eligibility and admission |
392
393
  | `@deepseek-ai/dsh-session-log-deepseek` | yes | Incremental lossless session-log request extension for the official DeepSeek LLM API |
393
394
  | `@deepseek-ai/dsh-session-persistence-jsonl` | yes | JSONL durable session persistence backend for the DeepSeek Harness |
394
395
  | `@deepseek-ai/dsh-session-projection` | no | Session-projection seam: the merge-extensible projection type table, the provider contract, and the ctx.sessionProjections registry serving whole current values of log-derived per-session state |
@@ -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 = "270757a";
597
+ const commit = "e253cdf";
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-270757a-dirty`;
282
+ return `0.2.2-rc.1-e253cdf-dirty`;
283
283
  }
284
284
  /** Analytics category of an official panel; other panels are never reported. */
285
285
  function officialEntry(id) {
@@ -2365,10 +2365,6 @@ call: (method, args = null) => env.invoke(method, args) }, harnessTrap(), ...Obj
2365
2365
  name: "SessionReferenceSourceMap",
2366
2366
  declaration: "export interface SessionReferenceSourceMap {\n controllerOperation: unknown;\n gateway: unknown;\n}"
2367
2367
  },
2368
- {
2369
- name: "SessionRequestId",
2370
- declaration: "export type SessionRequestId = Branded<'session-request-id'>;"
2371
- },
2372
2368
  {
2373
2369
  name: "SessionRetainInfo",
2374
2370
  declaration: "export interface SessionRetainInfo {\n readonly referenceCount: number;\n readonly retainedBy: Readonly<Partial<Record<SessionReferenceSource, number>>>;\n}"
@@ -10,7 +10,7 @@
10
10
  zh: 15a5430f49098011
11
11
  /deepseek-ai-dsh-session-continuation/summary:
12
12
  en: 46c5ffad72f35e54
13
- zh: 584227d1a5878e11
13
+ zh: fd8cd9ac30905477
14
14
  /deepseek-ai-dsh-session-continuation/table-of-contents:
15
15
  en: d152484eb41ac6b4
16
16
  zh: 2fbbd3dd3430b19e
@@ -24,11 +24,20 @@
24
24
  en: 0418e52ddba1089f
25
25
  zh: 308479157587ac1b
26
26
  /deepseek-ai-dsh-session-continuation/model-experience:
27
- en: 7d8063a144afc77b
28
- zh: fbf1fff5e0b50a4a
29
- /deepseek-ai-dsh-session-continuation/model-experience/kv-cache-effect:
30
- en: b24ddae0f5ab0bc2
31
- zh: 21b5acf2e6a5d1a3
27
+ en: 215e7ba838619b7b
28
+ zh: a311da3843709f90
29
+ /deepseek-ai-dsh-session-continuation/model-experience/accepted-retry:
30
+ en: 9767fa834a1d6fa4
31
+ zh: 05510b8ca5812d4b
32
+ /deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/what-the-model-sees:
33
+ en: 2f9258cf95618523
34
+ zh: 9177d10a660492e9
35
+ /deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/token-effect:
36
+ en: f8b1dc7bcbf9c0c1
37
+ zh: 65233da2af81d21b
38
+ /deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/kv-cache-effect:
39
+ en: 4b999358127340f2
40
+ zh: 5e25de8e23b58e61
32
41
  /deepseek-ai-dsh-session-continuation/known-limitations-and-deferred-work:
33
42
  en: 39368dac7142e7bb
34
43
  zh: 847fc8ad68d85fd2
@@ -61,11 +61,19 @@ The [service entry](src/index.ts) provides admission, the [projection](src/proje
61
61
  <a id="model-experience"></a>
62
62
  ## Model Experience
63
63
 
64
- An accepted retry records an empty user message with its retry source and starts a new turn. It adds no instruction text; retained non-waking context is delivered with that request.
64
+ ### Accepted retry
65
+
66
+ #### What the model sees
67
+
68
+ An accepted retry appends one user message with empty `content`. The next request includes that empty user turn, the retained history, and any queued non-waking context. The message adds no instruction text.
69
+
70
+ #### Token effect
71
+
72
+ The retry message contributes no instruction tokens. Tokens in the new request come from the retained history, queued context, and the provider framing of the empty user turn.
65
73
 
66
74
  #### KV Cache effect
67
75
 
68
- The empty message extends the conversation. Existing history is retained; actual cache reuse depends on the provider and assembled request.
76
+ The empty user turn is appended after the retained history and does not replace earlier tokens. Queued context delivered with the new request extends the suffix. A refused retry adds no message.
69
77
 
70
78
  ## Known Limitations and Deferred Work
71
79
 
@@ -7,7 +7,7 @@ kind: "package-reference"
7
7
 
8
8
  [English](README.md) | 中文
9
9
 
10
- ## 概要
10
+ ## 概述
11
11
 
12
12
  在不向对话添加指令文本的情况下继续符合条件的失败模型工作。重试会开始新轮次,并在 Session 日志中保留失败轮次。待处理的用户输入或正在运行的 Agent 工作会阻止接纳。
13
13
 
@@ -61,11 +61,19 @@ Agent 维护锁将条件检查、收件箱检查和接纳操作保护为一个
61
61
  <a id="model-experience"></a>
62
62
  ## 模型体验
63
63
 
64
- 接纳的重试会记录一个带重试来源的空用户消息并开始新轮次。它不会添加指令文本;保留的不唤醒上下文会随该请求交付。
64
+ ### 已接纳的重试
65
+
66
+ #### 模型看到什么
67
+
68
+ 已接纳的重试追加一条 `content` 为空的用户消息。下一次请求包含该空用户回合、保留的历史,以及队列中不唤醒 Agent 的上下文。该消息不添加指令文本。
69
+
70
+ #### Token 影响
71
+
72
+ 重试消息不贡献指令 token。新请求中的 token 来自保留的历史、已排队的上下文,以及提供方对空用户回合的消息封装。
65
73
 
66
74
  #### KV Cache 影响
67
75
 
68
- 空消息会扩展对话。现有历史会保留;实际缓存复用取决于提供方和组装后的请求。
76
+ 空用户回合追加在保留历史之后,不会替换先前的 token。随新请求交付的已排队上下文会延长后缀。被拒绝的重试不添加消息。
69
77
 
70
78
  ## 已知限制与延期工作
71
79
 
@@ -65,6 +65,7 @@ const continuationProjectionDefinition = {
65
65
  /** The Agent already owns a turn or maintenance operation; retry after that work settles. */
66
66
  var SessionContinuationBusyError = class extends Error {
67
67
  name = "SessionContinuationBusyError";
68
+ /** Machine-readable code for a retry refused because the Agent is not idle. */
68
69
  code = "AGENT_BUSY";
69
70
  constructor(cause) {
70
71
  super("generation continuation requires an idle agent", { cause });
@@ -90,8 +91,9 @@ var SessionContinuation = class extends Service {
90
91
  * @throws if reading the projection or queuing the retry fails.
91
92
  */
92
93
  async retry(agent, source) {
94
+ let admitted;
93
95
  try {
94
- return agent.runMaintenance(() => {
96
+ admitted = agent.runMaintenance(() => {
95
97
  const inbox = agent.inbox;
96
98
  if (this.projection.stateOf(agent.session).ending === null || inbox.nextTurn.length > 0 || inbox.nextStep.some((message) => message.source.kind === "user")) return Promise.resolve("unavailable");
97
99
  agent.followup(createUserMessage({
@@ -103,6 +105,7 @@ var SessionContinuation = class extends Service {
103
105
  } catch (cause) {
104
106
  throw new SessionContinuationBusyError(cause);
105
107
  }
108
+ return admitted;
106
109
  }
107
110
  };
108
111
  //#endregion
@@ -5,6 +5,7 @@ import { continuationProjectionDefinition } from "./projection.js";
5
5
  /** The Agent already owns a turn or maintenance operation; retry after that work settles. */
6
6
  export class SessionContinuationBusyError extends Error {
7
7
  name = 'SessionContinuationBusyError';
8
+ /** Machine-readable code for a retry refused because the Agent is not idle. */
8
9
  code = 'AGENT_BUSY';
9
10
  constructor(cause) {
10
11
  super('generation continuation requires an idle agent', { cause });
@@ -30,8 +31,10 @@ export class SessionContinuation extends Service {
30
31
  * @throws if reading the projection or queuing the retry fails.
31
32
  */
32
33
  async retry(agent, source) {
34
+ // Catch only the synchronous busy rejection. Admission failures stay on the returned promise.
35
+ let admitted;
33
36
  try {
34
- return agent.runMaintenance(() => {
37
+ admitted = agent.runMaintenance(() => {
35
38
  const inbox = agent.inbox;
36
39
  if (this.projection.stateOf(agent.session).ending === null
37
40
  || inbox.nextTurn.length > 0 || inbox.nextStep.some(message => message.source.kind === 'user')) {
@@ -42,9 +45,9 @@ export class SessionContinuation extends Service {
42
45
  });
43
46
  }
44
47
  catch (cause) {
45
- // runMaintenance throws synchronously only when another activity owns the Agent.
46
48
  throw new SessionContinuationBusyError(cause);
47
49
  }
50
+ return admitted;
48
51
  }
49
52
  }
50
53
  export default SessionContinuation;
@@ -18,8 +18,8 @@
18
18
  en: 192bbbb187278f91
19
19
  zh: 1f7e5632c15bdcf7
20
20
  /deepseek-ai-dsh-tui-app/use-this-package/starting-and-resuming:
21
- en: 312d9a3ea1cbb673
22
- zh: 937ff76d6bdcca22
21
+ en: d0ede2f3fc62912b
22
+ zh: d177b8f16b58828f
23
23
  /deepseek-ai-dsh-tui-app/use-this-package/the-screen:
24
24
  en: 8798852e763b4558
25
25
  zh: 6bb6768ee7186709
@@ -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: a49396b53b347ac4
46
- zh: 6ee8443d318b2bf6
45
+ en: 5476d8ed57b808c6
46
+ zh: ccd70bd708b38629
47
47
  /deepseek-ai-dsh-tui-app/understand-the-implementation:
48
48
  en: f124d406565fef39
49
49
  zh: 90344b5eec319cad
@@ -51,11 +51,11 @@
51
51
  en: e6c3923481cbf9e6
52
52
  zh: 0bca6c917dd26cbc
53
53
  /deepseek-ai-dsh-tui-app/understand-the-implementation/rendering-model:
54
- en: ee593519f59c7a36
55
- zh: 351fa58a43b483ff
54
+ en: ecbcecfd325fddfc
55
+ zh: ba726f23145a86d7
56
56
  /deepseek-ai-dsh-tui-app/understand-the-implementation/patch-surface-over-base:
57
- en: 142f04bf29e981dd
58
- zh: a1689297b06c9ca6
57
+ en: 5fcf3240081b9540
58
+ zh: 6fafe10c4adf654f
59
59
  /deepseek-ai-dsh-tui-app/understand-the-implementation/source-map:
60
60
  en: cb2a9fb8623dac76
61
61
  zh: 1cd89366da059886
@@ -38,6 +38,8 @@ dsh tui --no-open # print sign-in URLs without opening a
38
38
 
39
39
  Once a quit has saved the session, the app prints `dsh: session <id> saved; resume with: dsh --profile tui --resume <id>` on stderr for the root session bound at that moment; [Quitting](#quitting) lists every line a quit prints. A resumed session redraws its persisted history before accepting input and continues with that session's last model, or the launch default when the log has no request header; inside the terminal, `/resume` and `/sessions` open the same picker over persisted root sessions other than the current session, newest first, and resume the selected previous session, `/new` starts a fresh empty session with the launch default model, while `/clear` starts a fresh empty session that retains the current model and reasoning effort; the previous session stays on disk for `/resume`, and `/fork` copies the current session up to its last completed turn into a new one, the same cut the browser's fork takes. Switching releases the previous Agent and redraws the transcript of the next.
40
40
 
41
+ Failed attempts retain their saved text and reasoning after a resume or session switch. These diagnostic entries do not enter model history, add unexecuted tool cards, or contribute to committed token totals.
42
+
41
43
  ### The screen
42
44
 
43
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.
@@ -255,6 +257,8 @@ The exit code is 130 when `Ctrl+C` ended the wait, 129 when the terminal closed,
255
257
 
256
258
  ### Configuration
257
259
 
260
+ The TUI inherits native tool execution from `dsh-base` and ignores `DSH_TOOLS_MODE`. Select PTC through an explicit executor patch; see the [TUI executor migration](../../../docs/upgrade-guide/v0.2.2-rc.1/tui-tool-executor-selection/guide.md).
261
+
258
262
  | Field | Default | Meaning |
259
263
  |---|---|---|
260
264
  | `prompt` | none | A first prompt submitted when the terminal is up |
@@ -296,11 +300,11 @@ The runner awaits the complete application (`ctx.get('loader')?.await()`) and bu
296
300
 
297
301
  ### Rendering model
298
302
 
299
- Durable facts come from the session log: `system/message` (a nonempty prompt draws in full; an empty rendering is omitted), `user/message` (own submissions are drawn once and their echo skipped by message id; injected context — instructions, catalogs, snapshots, notices, relays, recalls, and undeclared forms — draws in full as a dim `⬡` row, a snapshot as one named contribution per part; compaction checkpoints and tool or model sources are omitted), `compaction/start`, `compaction/summary`, the checkpoint replacement, and `compaction/end` (a mirror of the surface kept from each event's `surfaceOp` names the replaced and remaining nodes, and the closing marker draws the compaction block or a failed `/compact` notice; a turn-owned `compaction/start` relabels the running spinner), `assistant/message` (which replaces the streamed block with the committed text and folds usage into the footer), `tool/call` and `tool/result` (drawn through the tool's `presentCall` and `presentResult` views when it declares them, with a raw-argument and raw-result fallback), `turn/end` notices, `workspace/changes` (one notice with the turn's file and line counts while the Host still holds the summary), `session/title` (header), `permission/preset` (footer), and `todo/write` under the enclosing `turn/start` (the turns one todo item's page reports; the list carries no per-item identity, so a reworded item counts as a new one; the same write refreshes the activity board from the `todos` projection). A descendant `turn/start`, `assistant/message`, or `turn/end`, and a `subagent/start` or `subagent/end` for the bound parent, update that child's own board row — the last sentence of the message's text blocks, never reasoning, tool calls, or tool results, and the stop word once the turn settles; a child that has not spoken draws its label alone; `turn/end` on the bound session and bind clear the board. Live incrementality comes from `agent/assistant-stream` text, reasoning, tool-call, and usage deltas: a card is mounted when the model names the tool, and the working spinner follows that stream plus durable `tool/call` / `tool/result` so it says `thinking`, `writing`, or `calling <tool>` with live `↑` send and `↓` receive for that call. Session facts outside the log come from the same services the browser reads: `sessionTitle`, `permissionPresets`, `sessionQuery` for the picker identities, the live or cached `title` projection for picker titles, `/deliverables`, and subagent details, `sessionProjections` for the footer, `/status`, `/context`, `/todos`, and `/outline`, `tokenMeter` for `/context`, `fileReferences` and `sessionReferenceResolver` for `@` completion, `attachments`, `skills`, `authorization`, `settings`, `subagents`, and the Loader's entries for `/plugins`. Modal prompts are process-local presentation and are never logged.
303
+ Durable facts come from the session log: `system/message` (a nonempty prompt draws in full; an empty rendering is omitted), `user/message` (own submissions are drawn once and their echo skipped by message id; injected context — instructions, catalogs, snapshots, notices, relays, recalls, and undeclared forms — draws in full as a dim `⬡` row, a snapshot as one named contribution per part; compaction checkpoints and tool or model sources are omitted), `compaction/start`, `compaction/summary`, the checkpoint replacement, and `compaction/end` (a mirror of the surface kept from each event's `surfaceOp` names the replaced and remaining nodes, and the closing marker draws the compaction block or a failed `/compact` notice; a turn-owned `compaction/start` relabels the running spinner), `assistant/attempt` (diagnostic text and reasoning settled from the embedded stream), `assistant/message` (which replaces the streamed block with the committed text and folds usage into the footer), `tool/call` and `tool/result` (drawn through the tool's `presentCall` and `presentResult` views when it declares them, with a raw-argument and raw-result fallback), `turn/end` notices, `workspace/changes` (one notice with the turn's file and line counts while the Host still holds the summary), `session/title` (header), `permission/preset` (footer), and `todo/write` under the enclosing `turn/start` (the turns one todo item's page reports; the list carries no per-item identity, so a reworded item counts as a new one; the same write refreshes the activity board from the `todos` projection). A descendant `turn/start`, `assistant/message`, or `turn/end`, and a `subagent/start` or `subagent/end` for the bound parent, update that child's own board row — the last sentence of the message's text blocks, never reasoning, tool calls, or tool results, and the stop word once the turn settles; a child that has not spoken draws its label alone; `turn/end` on the bound session and bind clear the board. Live incrementality comes from `agent/assistant-stream` text, reasoning, tool-call, and usage deltas: a card is mounted when the model names the tool, and the working spinner follows that stream plus durable `tool/call` / `tool/result` so it says `thinking`, `writing`, or `calling <tool>` with live `↑` send and `↓` receive for that call. Session facts outside the log come from the same services the browser reads: `sessionTitle`, `permissionPresets`, `sessionQuery` for the picker identities, the live or cached `title` projection for picker titles, `/deliverables`, and subagent details, `sessionProjections` for the footer, `/status`, `/context`, `/todos`, and `/outline`, `tokenMeter` for `/context`, `fileReferences` and `sessionReferenceResolver` for `@` completion, `attachments`, `skills`, `authorization`, `settings`, `subagents`, and the Loader's entries for `/plugins`. Modal prompts are process-local presentation and are never logged.
300
304
 
301
305
  ### Patch surface over base
302
306
 
303
- The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffix on the base `system-prompt` row, keeps the same temporary process-wide PTC mode opt-in (`DSH_TOOLS_MODE`) as the Web surface, inserts PTC mode's worker, mounts the model-facing `ask_user_question` tool whose questions the terminal answers, mounts the same `@`-reference resolvers (`file-reference-local`, `session-reference`) and the `present` deliverable tool the browser composes, adds the `session-turn-outline` and `session-stats` projection rows behind `/outline` and `/status`, and mounts the startup provider and the runner. The base agent-plane rows (bash, filesystem, skills, goals, compaction, subagents) stay enabled because the terminal composes its Agents process-wide.
307
+ The patch rides over `dsh-base`: it sets the coding persona prefix on the base `system-prompt` row, inherits the base tool executors and PTC runtime, mounts the model-facing `ask_user_question` tool whose questions the terminal answers, mounts the same `@`-reference resolvers (`file-reference-local`, `session-reference`) and the `present` deliverable tool the browser composes, adds the `session-turn-outline` and `session-stats` projection rows behind `/outline` and `/status`, and mounts the startup provider and the runner. The base agent-plane rows (bash, filesystem, skills, goals, compaction, subagents) stay enabled because the terminal composes its Agents process-wide.
304
308
 
305
309
  ### Source map
306
310
 
@@ -38,6 +38,8 @@ dsh tui --no-open # print sign-in URLs without opening a
38
38
 
39
39
  一次退出保存会话之后,应用在 stderr 为当时绑定的根会话打印 `dsh: session <id> saved; resume with: dsh --profile tui --resume <id>`;[退出](#quitting)列出退出时打印的每一行。恢复的会话会在接受输入前先重绘其持久化历史,并沿用该会话上次使用的模型;日志里还没有请求头时则使用启动默认模型。在终端内,`/resume` 与 `/sessions` 打开同一个选择器,按从新到旧列出当前会话以外的持久化根会话,并恢复选中的先前会话,`/new` 使用启动默认模型开始新的空会话,而 `/clear` 开始新的空会话并保留当前模型和推理强度;先前会话仍留在磁盘上可用 `/resume` 恢复,`/fork` 把当前会话复制到其最后一个完成轮次并作为新会话,切割点与浏览器的 fork 相同。切换会释放先前的 Agent 并重绘下一个会话的对话记录。
40
40
 
41
+ 恢复或切换会话后,失败尝试中已保存的文本与推理仍会显示。这些诊断条目不会进入模型历史、添加未执行的工具卡片,也不会计入已提交的 token 总量。
42
+
41
43
  ### 屏幕布局
42
44
 
43
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` 帧,较短的行按比例更短,刚画出的列会从终端背景色亮起到各自的颜色。工具回答后,结果行也以同样方式流出,排在卡片尚未画完的内容之后;调用与结果都不会等待动画。`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` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理在同一时长内浮出:以抬高的颜色出现,再退回到稳定时的暗色斜体。工具卡片的每一列则在这段时长内从终端背景色亮起到它稳定时的调色板颜色;从持久化历史重绘的卡片不带流出或淡入,已经稳定下来的文字也不会再被调暗。
@@ -255,6 +257,8 @@ TUI 在 `subagent` 与 `subagent_fork` 上均公开可选的 `provider`、`model
255
257
 
256
258
  ### 配置
257
259
 
260
+ TUI 从 `dsh-base` 继承原生工具执行,并忽略 `DSH_TOOLS_MODE`。通过显式执行器 patch 选择 PTC;参见 [TUI 执行器迁移](../../../docs/upgrade-guide/v0.2.2-rc.1/tui-tool-executor-selection/guide.zh.md)。
261
+
258
262
  | 字段 | 默认值 | 含义 |
259
263
  |---|---|---|
260
264
  | `prompt` | 无 | 终端就绪后提交的首个提示 |
@@ -296,11 +300,11 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
296
300
 
297
301
  ### 渲染模型
298
302
 
299
- 持久事实来自会话日志:`system/message`(非空提示词完整画出;空的绘制则省略)、`user/message`(自己提交的消息只绘制一次,其回显按消息 id 跳过;注入的上下文——instructions、catalogs、snapshots、notices、relays、recalls 以及未声明的形式——以暗色 `⬡` 行完整画出,快照按具名贡献各成一部分;压缩检查点以及工具或模型来源则省略)、`compaction/start`、`compaction/summary`、检查点替换与 `compaction/end`(依据每个事件的 `surfaceOp` 维护的 surface 镜像写明被替换与仍保留的节点,结束标记绘出压缩块或失败的 `/compact` 通知;归属于轮次的 `compaction/start` 会改写运行中的旋转指示标签)、`assistant/message`(用已提交文本替换流式块,并把用量折入页脚)、`tool/call` 与 `tool/result`(工具声明 `presentCall` 与 `presentResult` 视图时据此绘制,否则回退到原始参数与原始结果)、`turn/end` 通知、`workspace/changes`(在 Host 仍保存摘要时,以一行通知给出该轮的文件数与行数)、`session/title`(页眉)、`permission/preset`(页脚),以及所属 `turn/start` 之下的 `todo/write`(某条 todo 的详情页所报告的轮次;该列表不带逐条标识,因此改写措辞的条目算作新条目;同一次写入还从 `todos` 投影刷新 activity board)。后代会话的 `turn/start`、`assistant/message` 或 `turn/end`,以及绑定父会话的 `subagent/start` / `subagent/end`,会更新该子会话在板上自己的那一行——消息文本块的最后一句话,从不使用推理、工具调用或工具结果,轮次结束后则是停止用语;尚未说过话的子会话只画出标签;绑定会话的 `turn/end` 与 bind 会清空该板。实时增量来自 `agent/assistant-stream` 的文本、推理、工具调用与用量增量:模型一报出工具名就挂上卡片,工作时的旋转指示跟随该流以及持久的 `tool/call` / `tool/result`,从而标出 `thinking`、`writing` 或 `calling <tool>`,并带着该次调用的实时 `↑` 发送与 `↓` 接收。日志之外的会话事实来自浏览器读取的同一批服务:`sessionTitle`、`permissionPresets`、供选择器身份、`/deliverables` 与子 agent 详情使用的 `sessionQuery`、供选择器标题使用的实时或缓存 `title` 投影、供页脚、`/status`、`/context`、`/todos` 与 `/outline` 使用的 `sessionProjections`、供 `/context` 使用的 `tokenMeter`、供 `@` 补全使用的 `fileReferences` 与 `sessionReferenceResolver`、`attachments`、`skills`、`authorization`、`settings`、`subagents`,以及供 `/plugins` 使用的 Loader 条目。模态提示是进程本地的呈现,从不写入日志。
303
+ 持久事实来自会话日志:`system/message`(非空提示词完整画出;空的绘制则省略)、`user/message`(自己提交的消息只绘制一次,其回显按消息 id 跳过;注入的上下文——instructions、catalogs、snapshots、notices、relays、recalls 以及未声明的形式——以暗色 `⬡` 行完整画出,快照按具名贡献各成一部分;压缩检查点以及工具或模型来源则省略)、`compaction/start`、`compaction/summary`、检查点替换与 `compaction/end`(依据每个事件的 `surfaceOp` 维护的 surface 镜像写明被替换与仍保留的节点,结束标记绘出压缩块或失败的 `/compact` 通知;归属于轮次的 `compaction/start` 会改写运行中的旋转指示标签)、`assistant/attempt`(由嵌入流确定的诊断文本与推理)、`assistant/message`(用已提交文本替换流式块,并把用量折入页脚)、`tool/call` 与 `tool/result`(工具声明 `presentCall` 与 `presentResult` 视图时据此绘制,否则回退到原始参数与原始结果)、`turn/end` 通知、`workspace/changes`(在 Host 仍保存摘要时,以一行通知给出该轮的文件数与行数)、`session/title`(页眉)、`permission/preset`(页脚),以及所属 `turn/start` 之下的 `todo/write`(某条 todo 的详情页所报告的轮次;该列表不带逐条标识,因此改写措辞的条目算作新条目;同一次写入还从 `todos` 投影刷新 activity board)。后代会话的 `turn/start`、`assistant/message` 或 `turn/end`,以及绑定父会话的 `subagent/start` / `subagent/end`,会更新该子会话在板上自己的那一行——消息文本块的最后一句话,从不使用推理、工具调用或工具结果,轮次结束后则是停止用语;尚未说过话的子会话只画出标签;绑定会话的 `turn/end` 与 bind 会清空该板。实时增量来自 `agent/assistant-stream` 的文本、推理、工具调用与用量增量:模型一报出工具名就挂上卡片,工作时的旋转指示跟随该流以及持久的 `tool/call` / `tool/result`,从而标出 `thinking`、`writing` 或 `calling <tool>`,并带着该次调用的实时 `↑` 发送与 `↓` 接收。日志之外的会话事实来自浏览器读取的同一批服务:`sessionTitle`、`permissionPresets`、供选择器身份、`/deliverables` 与子 agent 详情使用的 `sessionQuery`、供选择器标题使用的实时或缓存 `title` 投影、供页脚、`/status`、`/context`、`/todos` 与 `/outline` 使用的 `sessionProjections`、供 `/context` 使用的 `tokenMeter`、供 `@` 补全使用的 `fileReferences` 与 `sessionReferenceResolver`、`attachments`、`skills`、`authorization`、`settings`、`subagents`,以及供 `/plugins` 使用的 Loader 条目。模态提示是进程本地的呈现,从不写入日志。
300
304
 
301
305
  ### 基于 base 的 patch 面
302
306
 
303
- 该 patch 叠加在 `dsh-base` 之上:在 base 的 `system-prompt` 行上设置编码 persona 前缀与 cwd 后缀,保留与 Web 表层相同的临时进程级 PTC 模式开关(`DSH_TOOLS_MODE`),插入 PTC 模式的 worker,挂载由终端应答其问题的模型侧 `ask_user_question` 工具,挂载浏览器所组合的同一批 `@` 引用解析器(`file-reference-local`、`session-reference`)与 `present` 交付物工具,加入 `/outline` 与 `/status` 背后的 `session-turn-outline` 与 `session-stats` 投影行,并挂载启动提供方与 runner。base 的 agent 平面行(bash、文件系统、技能、目标、压缩、子 agent)保持启用,因为终端在进程范围内组合其 Agent。
307
+ 该 patch 叠加在 `dsh-base` 之上:在 base 的 `system-prompt` 行上设置编码 persona 前缀,继承 base 的工具执行器与 PTC 运行时,挂载由终端应答其问题的模型侧 `ask_user_question` 工具,挂载浏览器所组合的同一批 `@` 引用解析器(`file-reference-local`、`session-reference`)与 `present` 交付物工具,加入 `/outline` 与 `/status` 背后的 `session-turn-outline` 与 `session-stats` 投影行,并挂载启动提供方与 runner。base 的 agent 平面行(bash、文件系统、技能、目标、压缩、子 agent)保持启用,因为终端在进程范围内组合其 Agent。
304
308
 
305
309
  ### 源码地图
306
310
 
@@ -27,11 +27,6 @@
27
27
  toolName: subagent_fork
28
28
  modelSelection: true
29
29
 
30
- - id: tools
31
- config:
32
- # Keep the same temporary process-wide PTC mode opt-in as the Web surface.
33
- mode: !!js process.env.DSH_TOOLS_MODE
34
-
35
30
  # The terminal confines commands with the Apple container backend below
36
31
  # instead of the base local sandbox row.
37
32
  - id: sandbox
@@ -3,7 +3,7 @@ import { CURSOR_MARKER, Container, Editor, Input, Loader, Markdown, ProcessTermi
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { brandString } from "@deepseek-ai/dsh-brand";
5
5
  import { installModelSelection } from "@deepseek-ai/dsh-agent";
6
- import { HarnessError, ReasoningEffortId, boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm";
6
+ import { HarnessError, ReasoningEffortId, assembleAssistantStream, boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm";
7
7
  import { SessionId, SessionLogOffset, buildForkSeed } from "@deepseek-ai/dsh-session";
8
8
  import { SubagentError, appendDelegatedPolicyOverrides } from "@deepseek-ai/dsh-subagent";
9
9
  import { launchEnvironmentOf, launchedThroughSsh } from "@deepseek-ai/dsh-launch-environment";
@@ -20481,13 +20481,13 @@ var TuiApp = class {
20481
20481
  for (const question of questions) {
20482
20482
  const prompt = new QuestionPrompt(this.deps.palette, question);
20483
20483
  const withdraw = prompt.withdraw.bind(prompt);
20484
- let withdrawn = false;
20484
+ const withdrawal = { requested: false };
20485
20485
  prompt.withdraw = () => {
20486
- withdrawn = true;
20486
+ withdrawal.requested = true;
20487
20487
  withdraw();
20488
20488
  };
20489
20489
  const answer = await this.showModal(prompt, signal);
20490
- if (withdrawn || signal?.aborted === true) throw new UserQuestionError("ask_user_question was aborted before the user answered", "ASK_ABORTED");
20490
+ if (withdrawal.requested || signal?.aborted === true) throw new UserQuestionError("ask_user_question was aborted before the user answered", "ASK_ABORTED");
20491
20491
  if (answer === null) throw new UserQuestionError("the question was dismissed", "ASK_CANCELLED");
20492
20492
  answers.push(answer);
20493
20493
  }
@@ -21023,6 +21023,20 @@ var TuiApp = class {
21023
21023
  if (view !== void 0) this.addContext(view.title, view.parts, event.data.turn);
21024
21024
  break;
21025
21025
  }
21026
+ case "assistant/attempt": {
21027
+ const content = assembleAssistantStream(event.data.stream).interruptedBlocks();
21028
+ if (content.length > 0) {
21029
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("");
21030
+ const reasoning = content.filter((block) => block.type === "reasoning").map((block) => block.text).join("");
21031
+ this.streamingBlock().commit(text, reasoning, false);
21032
+ } else if (this.streaming !== void 0) this.chat.removeChild(this.streaming);
21033
+ this.streaming = void 0;
21034
+ this.endFade();
21035
+ this.clearLiveUsage();
21036
+ this.dropUnconfirmedTools();
21037
+ this.updateSpinTicker();
21038
+ break;
21039
+ }
21026
21040
  case "assistant/message": {
21027
21041
  const { message, usage, interrupted } = event.data;
21028
21042
  const text = message.content.filter((block) => block.type === "text").map((block) => block.text).join("");
@@ -1,3 +1,43 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__addDisposableResource;
3
+ function _ts_add_disposable_resource(env, value, async) {
4
+ if (value !== null && value !== void 0) {
5
+ if (typeof value !== "object" && typeof value !== "function") {
6
+ throw new TypeError("Object expected.");
7
+ }
8
+ var dispose, inner;
9
+ if (async) {
10
+ if (!Symbol.asyncDispose) {
11
+ throw new TypeError("Symbol.asyncDispose is not defined.");
12
+ }
13
+ dispose = value[Symbol.asyncDispose];
14
+ }
15
+ if (dispose === void 0) {
16
+ if (!Symbol.dispose) {
17
+ throw new TypeError("Symbol.dispose is not defined.");
18
+ }
19
+ dispose = value[Symbol.dispose];
20
+ if (async) {
21
+ inner = dispose;
22
+ }
23
+ }
24
+ if (typeof dispose !== "function") {
25
+ throw new TypeError("Object not disposable.");
26
+ }
27
+ if (inner) {
28
+ dispose = function() {
29
+ try {
30
+ inner.call(this);
31
+ } catch (e) {
32
+ return Promise.reject(e);
33
+ }
34
+ };
35
+ }
36
+ env.stack.push({ value: value, dispose: dispose, async: async });
37
+ } else if (async) {
38
+ env.stack.push({ async: true });
39
+ }
40
+ return value;
41
+ }
42
+
43
+ exports._ = _ts_add_disposable_resource;
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__decorate;
3
+ function _ts_decorate(decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
6
+ r = Reflect.decorate(decorators, target, key, desc);
7
+ } else {
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ if (d = decorators[i]) {
10
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
+ }
12
+ }
13
+ }
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ }
16
+
17
+ exports._ = _ts_decorate;
@@ -1,3 +1,46 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__disposeResources;
3
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
4
+ var e = new Error(message);
5
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
6
+ };
7
+
8
+ function _ts_dispose_resources(env) {
9
+ function fail(e) {
10
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
11
+ env.hasError = true;
12
+ }
13
+ var r, s = 0;
14
+ function next() {
15
+ while (r = env.stack.pop()) {
16
+ try {
17
+ if (!r.async && s === 1) {
18
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
19
+ }
20
+ if (r.dispose) {
21
+ var result = r.dispose.call(r.value);
22
+ if (r.async) {
23
+ return s |= 2,
24
+ Promise.resolve(result).then(next, function(e) {
25
+ fail(e);
26
+ return next();
27
+ });
28
+ }
29
+ } else {
30
+ s |= 1;
31
+ }
32
+ } catch (e) {
33
+ fail(e);
34
+ }
35
+ }
36
+ if (s === 1) {
37
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
38
+ }
39
+ if (env.hasError) {
40
+ throw env.error;
41
+ }
42
+ }
43
+ return next();
44
+ }
45
+
46
+ exports._ = _ts_dispose_resources;
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__metadata;
3
+ function _ts_metadata(metadataKey, metadataValue) {
4
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
5
+ return Reflect.metadata(metadataKey, metadataValue);
6
+ }
7
+ }
8
+
9
+ exports._ = _ts_metadata;
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__param;
3
+ function _ts_param(paramIndex, decorator) {
4
+ return function(target, key) {
5
+ decorator(target, key, paramIndex);
6
+ };
7
+ }
8
+
9
+ exports._ = _ts_param;
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__rewriteRelativeImportExtension;
3
+ function _ts_rewrite_relative_import_extension(path, preserveJsx) {
4
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
5
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
6
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
7
+ });
8
+ }
9
+ return path;
10
+ }
11
+
12
+ exports._ = _ts_rewrite_relative_import_extension;
@@ -1,3 +1,21 @@
1
1
  "use strict";
2
2
 
3
- exports._ = require("tslib").__values;
3
+ function _ts_values(o) {
4
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
5
+ if (m) {
6
+ return m.call(o);
7
+ }
8
+ if (o && typeof o.length === "number") {
9
+ return {
10
+ next: function() {
11
+ if (o && i >= o.length) {
12
+ o = void 0;
13
+ }
14
+ return { value: o && o[i++], done: !o };
15
+ }
16
+ };
17
+ }
18
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
19
+ }
20
+
21
+ exports._ = _ts_values;
@@ -9,7 +9,7 @@ function _unsupported_iterable_to_array(o, minLen) {
9
9
  var n = Object.prototype.toString.call(o).slice(8, -1);
10
10
 
11
11
  if (n === "Object" && o.constructor) n = o.constructor.name;
12
- if (n === "Map" || n === "Set") return Array.from(n);
12
+ if (n === "Map" || n === "Set") return Array.from(o);
13
13
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array._(o, minLen);
14
14
  }
15
15
  exports._ = _unsupported_iterable_to_array;