dsh-ssh-tui 0.7.3 → 0.7.4

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 (74) hide show
  1. package/README.en.md +98 -27
  2. package/README.md +77 -27
  3. package/docs/remote-ops.md +27 -1
  4. package/docs/terminals.md +17 -4
  5. package/docs/windows.md +128 -0
  6. package/lib/attach.js +14 -1
  7. package/lib/attach.js.map +1 -1
  8. package/lib/commands.js +1 -0
  9. package/lib/commands.js.map +1 -1
  10. package/lib/copy-text.js +2 -0
  11. package/lib/copy-text.js.map +1 -1
  12. package/lib/diag.js +3 -0
  13. package/lib/diag.js.map +1 -1
  14. package/lib/dialogs.js.map +1 -1
  15. package/lib/display-sock.js +313 -2
  16. package/lib/display-sock.js.map +1 -1
  17. package/lib/dsh-compat.js +46 -0
  18. package/lib/dsh-compat.js.map +1 -1
  19. package/lib/i18n/en.js +40 -14
  20. package/lib/i18n/en.js.map +1 -1
  21. package/lib/i18n/index.js +5 -0
  22. package/lib/i18n/index.js.map +1 -1
  23. package/lib/i18n/zh.js +40 -14
  24. package/lib/i18n/zh.js.map +1 -1
  25. package/lib/index.js +75 -15
  26. package/lib/index.js.map +1 -1
  27. package/lib/line-mode.js +4 -0
  28. package/lib/line-mode.js.map +1 -1
  29. package/lib/paint.js +32 -1
  30. package/lib/paint.js.map +1 -1
  31. package/lib/picker.js +104 -15
  32. package/lib/picker.js.map +1 -1
  33. package/lib/plan.js +8 -0
  34. package/lib/plan.js.map +1 -1
  35. package/lib/platform.js +81 -0
  36. package/lib/platform.js.map +1 -1
  37. package/lib/preset-rows.js +54 -24
  38. package/lib/preset-rows.js.map +1 -1
  39. package/lib/question-wait.js +418 -0
  40. package/lib/question-wait.js.map +1 -0
  41. package/lib/selection.js +26 -8
  42. package/lib/selection.js.map +1 -1
  43. package/lib/term-text.js +79 -8
  44. package/lib/term-text.js.map +1 -1
  45. package/lib/terminal-input.js +13 -0
  46. package/lib/terminal-input.js.map +1 -1
  47. package/lib/tui.js +597 -51
  48. package/lib/tui.js.map +1 -1
  49. package/lib/types/attach.d.ts +8 -0
  50. package/lib/types/commands.d.ts +3 -0
  51. package/lib/types/diag.d.ts +2 -0
  52. package/lib/types/dialogs.d.ts +16 -0
  53. package/lib/types/display-sock.d.ts +78 -2
  54. package/lib/types/dsh-compat.d.ts +44 -12
  55. package/lib/types/i18n/index.d.ts +13 -3
  56. package/lib/types/paint.d.ts +21 -0
  57. package/lib/types/picker.d.ts +22 -0
  58. package/lib/types/platform.d.ts +22 -0
  59. package/lib/types/preset-rows.d.ts +18 -10
  60. package/lib/types/question-wait.d.ts +221 -0
  61. package/lib/types/selection.d.ts +12 -4
  62. package/lib/types/settings-subagent.d.ts +3 -3
  63. package/lib/types/subagent-model.d.ts +3 -3
  64. package/lib/types/term-text.d.ts +14 -0
  65. package/lib/types/terminal-input.d.ts +10 -0
  66. package/lib/types/transcript-types.d.ts +22 -0
  67. package/lib/types/tui.d.ts +126 -3
  68. package/lib/types/update-check.d.ts +19 -4
  69. package/lib/types/workspace-changes.d.ts +135 -0
  70. package/lib/update-check.js +25 -8
  71. package/lib/update-check.js.map +1 -1
  72. package/lib/workspace-changes.js +120 -0
  73. package/lib/workspace-changes.js.map +1 -0
  74. package/package.json +80 -42
@@ -9,10 +9,10 @@
9
9
  * OSC 52 (the channel `/copy` already uses).
10
10
  *
11
11
  * Only **model replies** are freely selectable. Everything here is pure: the
12
- * caller passes the painted lines (plain text plus whether each one came from a
13
- * reply) and gets back the ordered selection, the cell spans to paint in
14
- * reverse video, and the text to copy. The IO — mouse reports, OSC 52, notices —
15
- * stays in `tui.ts`.
12
+ * caller passes the painted lines (plain text, whether each one came from a
13
+ * reply, and how many leading cells are chrome) and gets back the ordered
14
+ * selection, the cell spans to paint in reverse video, and the text to copy.
15
+ * The IO — mouse reports, OSC 52, notices — stays in `tui.ts`.
16
16
  *
17
17
  * Columns are **cells**, not characters: a CJK glyph is two cells wide, and a
18
18
  * selection that touches either half includes the whole glyph. Surrogate pairs
@@ -24,6 +24,14 @@ export interface SelectableLine {
24
24
  text: string;
25
25
  /** True when this line came from a model reply, the only freely copyable kind. */
26
26
  copyable: boolean;
27
+ /**
28
+ * Cells at the start of the line that are chrome, not content.
29
+ *
30
+ * The focused card or reply carries a `▶ ` marker, and a reply's lines are
31
+ * copyable, so without this the marker was part of the text a drag copied off
32
+ * its first line. Only the first line of the focused row carries one.
33
+ */
34
+ gutter?: number;
27
35
  }
28
36
  /** A point in the transcript: `line` indexes the painted lines, `column` is a cell. */
29
37
  export interface SelectionPoint {
@@ -11,14 +11,14 @@
11
11
  import type { Context } from '@deepseek-ai/cordis';
12
12
  export declare const name = "ssh-tui-settings-subagent";
13
13
  /** The subagent selection, as the 0.1.7 settings service wants to see it. */
14
- export declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<{
14
+ export declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<NoInfer<{
15
15
  provider: import("@deepseek-ai/schemastery").default<string>;
16
16
  model: import("@deepseek-ai/schemastery").default<string>;
17
17
  reasoningEffort: import("@deepseek-ai/schemastery").default<string>;
18
- }>, Schemastery.ObjectT<{
18
+ }>>, Schemastery.ObjectT<NoInfer<{
19
19
  provider: import("@deepseek-ai/schemastery").default<string>;
20
20
  model: import("@deepseek-ai/schemastery").default<string>;
21
21
  reasoningEffort: import("@deepseek-ai/schemastery").default<string>;
22
- }>>;
22
+ }>>, "plain">;
23
23
  /** Nothing to mount: the TUI owns every read and write of this section. */
24
24
  export declare function apply(_ctx: Context): void;
@@ -130,15 +130,15 @@ export declare function adoptSessionSubagentSelection(ref: SubagentSelectionRef,
130
130
  */
131
131
  export declare function releaseSessionSubagentSelection(ref: SubagentSelectionRef, settingsValue: unknown): void;
132
132
  /** Settings schema for the subagent selection; every field is form-writable. */
133
- export declare const SUBAGENT_SETTINGS_SCHEMA: z<Schemastery.ObjectS<{
133
+ export declare const SUBAGENT_SETTINGS_SCHEMA: z<Schemastery.ObjectS<NoInfer<{
134
134
  provider: z<string>;
135
135
  model: z<string>;
136
136
  reasoningEffort: z<string>;
137
- }>, Schemastery.ObjectT<{
137
+ }>>, Schemastery.ObjectT<NoInfer<{
138
138
  provider: z<string>;
139
139
  model: z<string>;
140
140
  reasoningEffort: z<string>;
141
- }>>;
141
+ }>>, "plain">;
142
142
  /** Normalize a raw settings section into a live typed selection. */
143
143
  export declare function normalizeSubagentSelection(value: unknown): SubagentSelection;
144
144
  /**
@@ -38,6 +38,20 @@ export declare function waitCardCopy(input: {
38
38
  * end the last one with an ellipsis when the text does not fit.
39
39
  */
40
40
  export declare function wrapWaitDetails(detail: string, width: number, maxLines?: number): string[];
41
+ /** Forget the cached decision, so the next read re-consults the environment. */
42
+ export declare function resetAsciiChrome(): void;
43
+ /**
44
+ * Rewrite one string's chrome into ASCII when the terminal cannot decode UTF-8.
45
+ *
46
+ * Only the glyphs in {@link ASCII_CHROME} move; CJK text is left byte for byte,
47
+ * because there is no ASCII for it and a Chinese locale on a non-UTF-8 console
48
+ * needs `/language en`, not a mangled translation. Widths are preserved for the
49
+ * two-cell marks, so a row measured either side of this call occupies the same
50
+ * number of cells.
51
+ * @param text - one row, possibly with ANSI sequences in it.
52
+ * @returns the row unchanged when UTF-8 chrome is safe.
53
+ */
54
+ export declare function mapAsciiChrome(text: string): string;
41
55
  /**
42
56
  * Terminal cell width for one string.
43
57
  *
@@ -133,6 +133,16 @@ export declare class TerminalInputPump {
133
133
  * and 0 ms, two "agreeing" samples, early stop, chip frozen on a wrong value).
134
134
  */
135
135
  private quietMs;
136
+ /**
137
+ * One request, one window: what a display-liveness check needs.
138
+ *
139
+ * `measure()` deliberately is not this. It waits out its whole budget between
140
+ * attempts so a late answer cannot be read as a fast one, and a check that
141
+ * costs seconds per question is a picker that hangs. Reading a late answer as
142
+ * this window's is the harmless direction here: it reports "the terminal is
143
+ * there", which is the conservative answer for every caller.
144
+ */
145
+ measureOnce(timeoutMs?: number): Promise<boolean>;
136
146
  /**
137
147
  * Wait until the line has been quiet for a full window, measured from the
138
148
  * later of the last answer and the last request. An answer to a request we
@@ -142,6 +142,26 @@ export type Row = {
142
142
  text: string;
143
143
  plugin?: string;
144
144
  expanded: boolean;
145
+ } | {
146
+ /**
147
+ * Files one turn changed, from the Host's `workspaceChanges` service.
148
+ * Display only: the summary is not in the session log, and a restarted
149
+ * Host cannot reopen it, so the card is never rebuilt from history.
150
+ */
151
+ kind: 'changes';
152
+ /** The turn the summary describes. A later event for it replaces this card. */
153
+ turn: number;
154
+ /** Sequence of the `workspace/changes` event the summary was read from. */
155
+ seq: number;
156
+ /** Session the summary belongs to; `diff` is served per session. */
157
+ sessionId: string;
158
+ /** Header text, rendered once so the card does not recompute it per frame. */
159
+ header: string;
160
+ /** One line per listed file, in the service's own order. */
161
+ files: string[];
162
+ /** Files the service's cap left off the list, appended after `files`. */
163
+ more?: string;
164
+ expanded: boolean;
145
165
  } | {
146
166
  kind: 'system';
147
167
  text: string;
@@ -171,6 +191,8 @@ export type CollapsibleBlock = Extract<Row, {
171
191
  kind: 'compaction';
172
192
  } | {
173
193
  kind: 'prompt';
194
+ } | {
195
+ kind: 'changes';
174
196
  }> | {
175
197
  kind: 'streaming-reasoning';
176
198
  expanded: boolean;
@@ -25,7 +25,7 @@ import { type SessionRoute } from './session-route.js';
25
25
  import { type SubagentSelectionRef } from './subagent-model.js';
26
26
  import { type AskUserQuestionAnswer, type AskUserQuestionRequest } from '@deepseek-ai/dsh-user-questions';
27
27
  import type { ApprovalOutcome, ApprovalRequest } from '@deepseek-ai/dsh-user-approval';
28
- import type { CollapsibleBlock, DisconnectPolicyName } from './transcript-types.js';
28
+ import type { CollapsibleBlock, DisconnectPolicyName, Row } from './transcript-types.js';
29
29
  import { paintedLinkHits } from './term-text.js';
30
30
  export type { CollapsibleBlock, DisplayKind, DisconnectPolicyName, PlanTodoItem, Row, SubagentLogEntry, ToolDiffHunk, } from './transcript-types.js';
31
31
  export { clipAnsiToWidth, cursorVisualPosition, displayWidth, foldInputView, hrefAtColumn, osc52Clipboard, osc8Enabled, paintedLinkHits, fmtElapsedCompact, padAnsiToWidth, padToWidth, renderMarkdownLines, repeatToWidth, shimmerText, truncateToWidth, visibleWidth, waitCardCopy, waitSummaryFromReasoning, wrapWaitDetails, } from './term-text.js';
@@ -107,6 +107,15 @@ export interface TuiConfig {
107
107
  onHangup?: () => void | Promise<void>;
108
108
  /** Called when a Display relay attaches after hangup. */
109
109
  onReattach?: () => void | Promise<void>;
110
+ /**
111
+ * The display just went away, before the Host has decided whether to stay.
112
+ *
113
+ * The lock stops saying `attached` from here: that field is what a resume (and
114
+ * the launch picker's list) reads to decide whether another window is on the
115
+ * session, and leaving it set for the whole cancel-and-flush below turned a
116
+ * reconnect in that window into "already attached to another window".
117
+ */
118
+ onDetach?: () => void | Promise<void>;
110
119
  /** Host process: no local TTY; paint only through the display socket. */
111
120
  headlessDisplay?: boolean;
112
121
  /** Append events as plain lines instead of painting (see `line-mode`). */
@@ -123,6 +132,16 @@ export interface TuiController {
123
132
  disconnectPolicy(): DisconnectPolicyName;
124
133
  }
125
134
  export type WorkspaceView = 'detailed' | 'compact';
135
+ /**
136
+ * One row the card cursor can land on.
137
+ *
138
+ * Every collapsible card, plus the model replies. A reply has nothing to expand,
139
+ * which is why it used to be left out of the ring — and that is exactly what
140
+ * made `/copy` unreachable for it: `/copy` takes the focused row, so as soon as
141
+ * the reader selected any card the reply stopped being a copy target, and the
142
+ * newest reply survived only as the no-focus fallback.
143
+ */
144
+ export type FocusTarget = Row | CollapsibleBlock;
126
145
  export declare function parseDisconnectPolicy(raw: string): DisconnectPolicyName | undefined;
127
146
  /**
128
147
  * The `reasoningEfforts` map `/setup` writes for a hand-declared
@@ -221,6 +240,7 @@ export declare class SshTui {
221
240
  private relayRows;
222
241
  private readonly onHangup;
223
242
  private readonly onReattach;
243
+ private readonly onDetach;
224
244
  private renderTimer;
225
245
  private readonly decoder;
226
246
  private readonly color;
@@ -317,6 +337,15 @@ export declare class SshTui {
317
337
  private readonly inputGuard;
318
338
  private thinkingStartedAt;
319
339
  private waitStartedAt;
340
+ /**
341
+ * Whether the running turn produced anything a person can read: reply text or
342
+ * a tool card. A turn that ends with thinking only is the upstream returning
343
+ * an empty stop, and painting 完成 for it reads as a finished answer — see
344
+ * the hint at `turn/end`.
345
+ */
346
+ private turnSawOutput;
347
+ /** Whether the turn produced thinking, which the empty-stop hint names. */
348
+ private turnSawReasoning;
320
349
  private completionSignaled;
321
350
  private replaying;
322
351
  /** Display-line budget for the first paint after resume; 0 = full transcript. */
@@ -370,10 +399,22 @@ export declare class SshTui {
370
399
  private detachedDeniedCount;
371
400
  /** Questions waiting for a display right now — their cards do not exist yet. */
372
401
  private queuedQuestions;
402
+ /** When the current detached wait began, so the reconnect can say how long. */
403
+ private questionWaitSince;
373
404
  private paintIntervalMs;
374
405
  private paintLink;
406
+ /**
407
+ * Whether this process runs inside an SSH session, from the sshd environment.
408
+ *
409
+ * Distinct from `paintLink`, which `applyProbedRtt` pins to `'ssh'` for any
410
+ * relayed frame — a local window included. Only this flag says the capability
411
+ * table described a remote tty rather than the terminal the bytes reach.
412
+ */
413
+ private sshSession;
375
414
  private paintProbed;
376
415
  private paintRttMs;
416
+ /** The last few measured round-trips; the chip and the budget use their median. */
417
+ private paintRttHistory;
377
418
  private sessionTitle;
378
419
  private llmRetry;
379
420
  private quotaSnapshot;
@@ -562,6 +603,8 @@ export declare class SshTui {
562
603
  /** Re-open DECSET and start painting to an attached Display relay. */
563
604
  attachRelayDisplay(): void;
564
605
  currentDisconnectPolicy(): DisconnectPolicyName;
606
+ /** The paint cadence in force right now: the link tier the footer shows. */
607
+ currentPaintIntervalMs(): number;
565
608
  applyProbedRtt(rttMs: number | undefined): void;
566
609
  private markDirty;
567
610
  private toolCardSummary;
@@ -576,6 +619,19 @@ export declare class SshTui {
576
619
  private flushLineMode;
577
620
  /** The transcript rows that support per-row expand/collapse. */
578
621
  private collapsibleRows;
622
+ /**
623
+ * Everything the card cursor walks, in transcript order: the collapsible
624
+ * cards plus the model replies.
625
+ *
626
+ * Built from the two lists rather than from the rows alone, because one of the
627
+ * collapsible entries is synthetic: the live thinking block exists only while a
628
+ * turn streams and is never a member of `this.rows`. Filtering the rows (the
629
+ * first version of this) silently dropped it out of the cursor walk — ↑ on a
630
+ * turn that had only streamed thinking did nothing, and Enter could no longer
631
+ * expand the card being written. It belongs at the end, which is where it is
632
+ * painted, so anything not in the rows is appended.
633
+ */
634
+ private focusRing;
579
635
  private spinnerFrame;
580
636
  /**
581
637
  * Codex wait card: shown while the turn is running. The live thinking
@@ -630,6 +686,16 @@ export declare class SshTui {
630
686
  private markSearchRow;
631
687
  private openToolInspect;
632
688
  private openSubagentInspect;
689
+ /**
690
+ * Read one reply full-screen.
691
+ *
692
+ * What Enter does on a selected reply: a reply has no body to fold away, and
693
+ * the transcript wraps it to the window — which for a long answer with tables
694
+ * or code blocks is not how it reads. The overlay is the same surface the tool
695
+ * cards use, and the copy key works inside it, so "read it, then copy it"
696
+ * needs no trip back through the timeline.
697
+ */
698
+ private openReplyInspect;
633
699
  /**
634
700
  * Line mode has no framed scroller, so an inspect body goes into the log.
635
701
  *
@@ -640,8 +706,18 @@ export declare class SshTui {
640
706
  private echoInspectToLog;
641
707
  closeInspect(): void;
642
708
  private paintCollapsibleHeader;
643
- /** Move the expand/collapse focus among reasoning and tool rows. */
644
- private moveCollapsibleFocus;
709
+ /**
710
+ * Which file line of an expanded changes card the screen cursor is on.
711
+ *
712
+ * The card paints its header, then one row per file, and `selectableLines`
713
+ * holds exactly the viewport. The cursor sits on the input row unless the
714
+ * reader scrolled, so the file is how many painted rows above the cursor the
715
+ * card's header is. A cursor on the header, the remainder line, or the prompt
716
+ * falls back to the first file, which is the only defensible guess.
717
+ */
718
+ private changesFileIndex;
719
+ /** Move the card cursor among the cards and the replies. */
720
+ private moveFocus;
645
721
  /** Toggle the focused block; without focus, toggle the most recent one. */
646
722
  toggleCollapsible(): void;
647
723
  /**
@@ -807,6 +883,27 @@ export declare class SshTui {
807
883
  private readonly handleInboxClaimed;
808
884
  private readonly handleInboxDiscarded;
809
885
  private readonly handleDisposed;
886
+ /**
887
+ * One `workspace/changes` event: the files a turn changed.
888
+ *
889
+ * The event carries only the turn number; the summary stays on the Host and
890
+ * is served by `workspaceChanges` for this event's own sequence, and only
891
+ * while the Session lives. A missing service (every 0.1.5 Host) or a summary
892
+ * that can no longer be opened (a log replayed after a restart) shows
893
+ * nothing — upstream's rule, so a card that cannot be read is never drawn.
894
+ * A later event for the same turn replaces the earlier summary in place.
895
+ */
896
+ private noteWorkspaceChanges;
897
+ /** Copy one summary onto its card. Shared by the first event and its replacements. */
898
+ private fillChangesCard;
899
+ /**
900
+ * Full view of one file on a changes card: its comparison, as the service
901
+ * computed it. Binary and oversized files have no lines, so the overlay
902
+ * carries the one-line explanation instead of an empty body.
903
+ */
904
+ private openChangesInspect;
905
+ /** Open (or replace) the changes overlay, or echo it to the log in line mode. */
906
+ private openChangesInspectLines;
810
907
  /** Plan-mode / command / team events that plugins merge into SessionEventMap. */
811
908
  private handleExtensionEvent;
812
909
  private findCompactionRow;
@@ -851,6 +948,19 @@ export declare class SshTui {
851
948
  /** Keep an open inspect overlay in sync with the live child log. */
852
949
  private refreshOpenSubagentInspect;
853
950
  private hasLiveDisplay;
951
+ /**
952
+ * Tell the absent user that a question is waiting.
953
+ *
954
+ * The marker file is the part that needs no configuration: it sits next to the
955
+ * session's stderr log, so logging back into the jump host shows it before the
956
+ * TUI is open. The command is whatever the user pointed `ssh-tui.notify` at,
957
+ * run once; it never blocks the wait and never reports its own failure.
958
+ */
959
+ private announceWaitingQuestion;
960
+ /** The SMTP account `/notify smtp` saved, when the target is authenticated. */
961
+ private readNotifySmtp;
962
+ /** `DSH_TUI_NOTIFY`, else the saved `ssh-tui.notify`. Empty means off. */
963
+ private readNotifyCommand;
854
964
  private waitForLiveDisplay;
855
965
  /**
856
966
  * Auto mode rides the approval waterfall: when the host approval policy is
@@ -884,6 +994,10 @@ export declare class SshTui {
884
994
  * `the user rejected tool "bash"`. Steer a plugin notice with the real
885
995
  * classifier/reviewer reason. Summary matches the workspace decision row
886
996
  * so the handler does not paint the body twice.
997
+ *
998
+ * This notice is committed to the session, so it is exactly the injection a
999
+ * V4 log refuses when it wears the released `plugin` wrapper — see
1000
+ * {@link TUI_SOURCE_KIND}.
887
1001
  */
888
1002
  private tellModelApprovalDenied;
889
1003
  readonly handleApproval: (request: ApprovalRequest, _next: () => Promise<ApprovalOutcome>) => Promise<ApprovalOutcome>;
@@ -1092,6 +1206,15 @@ export declare class SshTui {
1092
1206
  private runLanguageCommand;
1093
1207
  /** /view: detailed (see the work) vs compact (Codex-like summary). */
1094
1208
  private runViewCommand;
1209
+ /**
1210
+ * /notify: where a question waiting on an absent user is announced.
1211
+ *
1212
+ * No argument shows what is configured. `off` clears it. `mail`, `smtp` and
1213
+ * `local` store the command that target needs; the SMTP password is kept
1214
+ * beside it and handed to the command through the environment, so it is never
1215
+ * part of the command string.
1216
+ */
1217
+ private runNotifyCommand;
1095
1218
  /** /disconnect: pause (default) or continue the turn after SSH drop. */
1096
1219
  private runDisconnectCommand;
1097
1220
  /** /mode: pick an agent preset (standard / minimal / ptc / cordis / routing-suite / ...). */
@@ -1,13 +1,28 @@
1
1
  /**
2
2
  * Best-effort npm latest check. Failures stay quiet. The TUI may offer to
3
- * run `dsh plugin --profile <name> add dsh-ssh-tui@latest` — pnpm otherwise
4
- * keeps the lockfile pin (e.g. 0.3.7) when the spec is a bare package name.
3
+ * install the version it just read, by number: `dsh plugin --profile <name>
4
+ * add dsh-ssh-tui@<version>`. A bare package name lets pnpm keep the lockfile
5
+ * pin (e.g. 0.3.7), and `@latest` is resolved a second time at install — under
6
+ * pnpm's `minimumReleaseAge` that second lookup can quietly land on yesterday's
7
+ * release while still exiting 0.
5
8
  */
6
9
  import { spawn } from 'node:child_process';
7
10
  export declare const PLUGIN_PACKAGE = "dsh-ssh-tui";
8
11
  export declare function compareSemver(a: string, b: string): number;
9
12
  export declare function resolvePluginProfileName(env?: NodeJS.ProcessEnv): string;
10
- export declare function pluginUpgradeCommand(profile?: string): string;
13
+ /**
14
+ * The install command for one already-resolved version.
15
+ *
16
+ * The version is the number `checkForPluginUpdate` read from the registry, not
17
+ * the `latest` dist-tag: handing pnpm the tag makes it resolve the release a
18
+ * second time, and a release younger than `minimumReleaseAge` is then skipped
19
+ * without an error. A caller with no resolved version passes `@latest`, which
20
+ * is still better than a bare name.
21
+ * @param profile - the profile the plugin is installed into.
22
+ * @param version - the exact version to install.
23
+ * @returns the command, safe to show the user and to run.
24
+ */
25
+ export declare function pluginUpgradeCommand(profile?: string, version?: string): string;
11
26
  export declare function formatUpdateNotice(current: string, latest: string, profile?: string): string;
12
27
  export declare function fetchLatestNpmVersion(fetchImpl?: typeof fetch): Promise<string | undefined>;
13
28
  export interface PluginUpdateInfo {
@@ -50,7 +65,7 @@ export declare function resolveDshInvocation(options?: {
50
65
  * hold the fallback together.
51
66
  */
52
67
  export declare function shellSafeProfile(profile: string): string;
53
- export declare function installPluginLatest(profile?: string, deps?: {
68
+ export declare function installPluginLatest(profile?: string, version?: string, deps?: {
54
69
  invocation?: DshInvocation;
55
70
  spawnFn?: typeof spawn;
56
71
  }): Promise<{
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Per-turn workspace change cards, read from the Host's `workspaceChanges`
3
+ * service (`@deepseek-ai/dsh-workspace-changes`, shipped with dsh 0.1.7).
4
+ *
5
+ * The service is not a dependency of this plugin: 0.1.5 has neither the
6
+ * package nor the `workspace/changes` event, so everything here is reached by
7
+ * feature detection and the local types below are copied from the service's
8
+ * contract rather than imported. Importing the package would fail to compile
9
+ * on the 0.1.5 tree, where the module does not exist.
10
+ *
11
+ * What the service serves lives only as long as the Session does, in this Host
12
+ * process. After a restart a replayed event resolves to `undefined`, and the
13
+ * upstream decision — which this module honours — is to show no card at all
14
+ * rather than a card whose contents can no longer be opened.
15
+ * @module dsh-ssh-tui/workspace-changes
16
+ */
17
+ import type { DiffDisplayLine } from './transcript-types.js';
18
+ /** One file changed during a turn. Mirrors the service's `WorkspaceChangedFile`. */
19
+ export interface ChangesFile {
20
+ /** Path relative to the Session working directory, or absolute outside it. */
21
+ path: string;
22
+ /** Sort key and label, always slash-separated. */
23
+ display: string;
24
+ /** Lines added; zero when the file is binary or oversized. */
25
+ added: number;
26
+ /** Lines deleted; zero when the file is binary or oversized. */
27
+ deleted: number;
28
+ /** Git called it binary, or a captured side holds a NUL byte. */
29
+ binary?: true;
30
+ /** A captured side exceeded the plugin's byte cap; listed without counts. */
31
+ oversized?: true;
32
+ }
33
+ /** Files changed during one top-level turn. Mirrors `WorkspaceChangesSummary`. */
34
+ export interface ChangesSummary {
35
+ /** The turn this summary describes. */
36
+ turn: number;
37
+ /** Working directory the `path` values are relative to. */
38
+ cwd: string;
39
+ /** Changed files in `display` order, capped by the plugin's `maxFiles`. */
40
+ files: ChangesFile[];
41
+ /** Complete changed-file count, including files the cap omitted. */
42
+ total: number;
43
+ /** Lines added over every changed file, including omitted ones. */
44
+ added: number;
45
+ /** Lines deleted over every changed file, including omitted ones. */
46
+ deleted: number;
47
+ }
48
+ /** One unified-diff hunk; every line keeps its `+`, `-`, or space prefix. */
49
+ export interface ChangesHunk {
50
+ /** First line in the turn-start content, 1-based. */
51
+ oldStart: number;
52
+ /** Lines taken from the turn-start content. */
53
+ oldLines: number;
54
+ /** First line in the turn-end content, 1-based. */
55
+ newStart: number;
56
+ /** Lines taken from the turn-end content. */
57
+ newLines: number;
58
+ /** Hunk body in order, each line prefixed with `+`, `-`, or a space. */
59
+ lines: string[];
60
+ }
61
+ /**
62
+ * One listed file's comparison, computed when asked for. Mirrors
63
+ * `WorkspaceFileDiff`: a line diff, or a file that has no lines to show.
64
+ */
65
+ export type ChangesFileDiff = {
66
+ kind: 'text';
67
+ path: string;
68
+ display: string;
69
+ before: boolean;
70
+ after: boolean;
71
+ hunks: ChangesHunk[];
72
+ /** The comparison timed out and every line is shown as replaced. */
73
+ coarse: boolean;
74
+ } | {
75
+ kind: 'binary';
76
+ path: string;
77
+ display: string;
78
+ } | {
79
+ kind: 'oversized';
80
+ path: string;
81
+ display: string;
82
+ };
83
+ /**
84
+ * The Host service, as far as this plugin reads it. `seq` is the
85
+ * `workspace/changes` event's own sequence number, not the turn number.
86
+ */
87
+ export interface WorkspaceChangesSource {
88
+ summary(sessionId: string, seq: number): ChangesSummary | undefined;
89
+ diff(sessionId: string, seq: number, index: number, signal: AbortSignal): Promise<ChangesFileDiff | undefined>;
90
+ }
91
+ /**
92
+ * The `workspaceChanges` service, when this Host actually has one.
93
+ *
94
+ * Both methods have to be functions: a present-but-incomplete object (a stub,
95
+ * a future shape) must read as "not available" so the event is ignored instead
96
+ * of throwing when the card is built.
97
+ * @param ctx - the Host context.
98
+ * @returns the service, or undefined on a Host that never registered one.
99
+ */
100
+ export declare function workspaceChangesOf(ctx: {
101
+ get?(name: string): unknown;
102
+ }): WorkspaceChangesSource | undefined;
103
+ /** Whether a summary is worth a card. A turn that changed nothing is not. */
104
+ export declare function changesSummaryVisible(summary: ChangesSummary): boolean;
105
+ /** Collapsed-card header: `本轮改动 · 3 个文件 +42 -7`. */
106
+ export declare function changesHeader(summary: ChangesSummary): string;
107
+ /**
108
+ * One expanded-card file line.
109
+ *
110
+ * Binary and oversized files carry no counts upstream, so naming the file and
111
+ * then printing `+0 -0` would report a change that was not measured. They get
112
+ * a label instead.
113
+ * @param file - one entry of the summary.
114
+ * @returns the line, without the card's indent.
115
+ */
116
+ export declare function changesFileLine(file: ChangesFile): string;
117
+ /**
118
+ * Files the cap left out, when there are any.
119
+ * @param summary - the turn's summary.
120
+ * @returns the trailing line, or undefined when every file is listed.
121
+ */
122
+ export declare function changesRemainderLine(summary: ChangesSummary): string | undefined;
123
+ /**
124
+ * Render one file's comparison as overlay lines.
125
+ *
126
+ * The service already compared the two sides, so this only maps what it
127
+ * returned: recomputing the diff would be slower and could disagree with the
128
+ * counts the card already showed. A `+` line is an addition, a `-` line a
129
+ * removal, and a space-prefixed line is the unchanged context. Anything else
130
+ * (a hunk line the service did not prefix) is shown as context too — dropping
131
+ * it would hide part of the file.
132
+ * @param diff - the comparison `workspaceChanges.diff` returned.
133
+ * @returns the lines, or an empty list when there is nothing to show.
134
+ */
135
+ export declare function renderChangesDiff(diff: ChangesFileDiff | undefined): DiffDisplayLine[];
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Best-effort npm latest check. Failures stay quiet. The TUI may offer to
3
- * run `dsh plugin --profile <name> add dsh-ssh-tui@latest` — pnpm otherwise
4
- * keeps the lockfile pin (e.g. 0.3.7) when the spec is a bare package name.
3
+ * install the version it just read, by number: `dsh plugin --profile <name>
4
+ * add dsh-ssh-tui@<version>`. A bare package name lets pnpm keep the lockfile
5
+ * pin (e.g. 0.3.7), and `@latest` is resolved a second time at install — under
6
+ * pnpm's `minimumReleaseAge` that second lookup can quietly land on yesterday's
7
+ * release while still exiting 0.
5
8
  */
6
9
  import { spawn } from 'node:child_process';
7
10
  import { existsSync } from 'node:fs';
@@ -32,11 +35,24 @@ export function resolvePluginProfileName(env = process.env) {
32
35
  return arg;
33
36
  return 'tui';
34
37
  }
35
- export function pluginUpgradeCommand(profile = resolvePluginProfileName()) {
36
- return `dsh plugin --profile ${profile} add ${PLUGIN_PACKAGE}@latest`;
38
+ /**
39
+ * The install command for one already-resolved version.
40
+ *
41
+ * The version is the number `checkForPluginUpdate` read from the registry, not
42
+ * the `latest` dist-tag: handing pnpm the tag makes it resolve the release a
43
+ * second time, and a release younger than `minimumReleaseAge` is then skipped
44
+ * without an error. A caller with no resolved version passes `@latest`, which
45
+ * is still better than a bare name.
46
+ * @param profile - the profile the plugin is installed into.
47
+ * @param version - the exact version to install.
48
+ * @returns the command, safe to show the user and to run.
49
+ */
50
+ export function pluginUpgradeCommand(profile = resolvePluginProfileName(), version = 'latest') {
51
+ const spec = version.trim() === '' ? 'latest' : version.trim();
52
+ return `dsh plugin --profile ${profile} add ${PLUGIN_PACKAGE}@${spec}`;
37
53
  }
38
54
  export function formatUpdateNotice(current, latest, profile = resolvePluginProfileName()) {
39
- return t('update.notice', { latest, current, command: pluginUpgradeCommand(profile) });
55
+ return t('update.notice', { latest, current, command: pluginUpgradeCommand(profile, latest) });
40
56
  }
41
57
  export async function fetchLatestNpmVersion(fetchImpl = fetch) {
42
58
  try {
@@ -67,7 +83,7 @@ export async function checkForPluginUpdate(current) {
67
83
  current,
68
84
  latest,
69
85
  profile,
70
- command: pluginUpgradeCommand(profile),
86
+ command: pluginUpgradeCommand(profile, latest),
71
87
  notice: formatUpdateNotice(current, latest, profile),
72
88
  };
73
89
  }
@@ -93,12 +109,13 @@ export function resolveDshInvocation(options = {}) {
93
109
  export function shellSafeProfile(profile) {
94
110
  return /\s/u.test(profile) ? `"${profile.replaceAll('"', '')}"` : profile;
95
111
  }
96
- export async function installPluginLatest(profile = resolvePluginProfileName(), deps = {}) {
112
+ export async function installPluginLatest(profile = resolvePluginProfileName(), version = 'latest', deps = {}) {
97
113
  const invocation = deps.invocation ?? resolveDshInvocation();
98
114
  const spawnFn = deps.spawnFn ?? spawn;
99
115
  const profileArg = invocation.shell ? shellSafeProfile(profile) : profile;
116
+ const spec = version.trim() === '' ? 'latest' : version.trim();
100
117
  return await new Promise(resolve => {
101
- const child = spawnFn(invocation.command, [...invocation.prefix, 'plugin', '--profile', profileArg, 'add', `${PLUGIN_PACKAGE}@latest`], {
118
+ const child = spawnFn(invocation.command, [...invocation.prefix, 'plugin', '--profile', profileArg, 'add', `${PLUGIN_PACKAGE}@${spec}`], {
102
119
  env: process.env,
103
120
  stdio: ['ignore', 'pipe', 'pipe'],
104
121
  shell: invocation.shell,
@@ -1 +1 @@
1
- {"version":3,"file":"update-check.js","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO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