dsh-ssh-tui 0.3.10 → 0.4.1
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.en.md +18 -13
- package/README.md +11 -13
- package/lib/i18n/en.js +27 -2
- package/lib/i18n/en.js.map +1 -1
- package/lib/i18n/index.js +2 -0
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/zh.js +27 -2
- package/lib/i18n/zh.js.map +1 -1
- package/lib/tui.js +293 -36
- package/lib/tui.js.map +1 -1
- package/lib/types/i18n/index.d.ts +4 -0
- package/lib/types/tui.d.ts +41 -6
- package/lib/types/update-check.d.ts +16 -2
- package/lib/update-check.js +46 -5
- package/lib/update-check.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,8 +12,12 @@ export type MessageVars = Record<string, string | number>;
|
|
|
12
12
|
export declare const UI_LOCALE_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
|
|
13
13
|
export declare const UI_LOCALE_SCHEMA: z<Schemastery.ObjectS<{
|
|
14
14
|
language: z<string, string>;
|
|
15
|
+
skipUpdate: z<string, string>;
|
|
16
|
+
view: z<string, string>;
|
|
15
17
|
}>, Schemastery.ObjectT<{
|
|
16
18
|
language: z<string, string>;
|
|
19
|
+
skipUpdate: z<string, string>;
|
|
20
|
+
view: z<string, string>;
|
|
17
21
|
}>>;
|
|
18
22
|
export declare function localeFromTag(tag: string): Locale | undefined;
|
|
19
23
|
/** Pick zh/en from env, optionally after a saved settings value. */
|
package/lib/types/tui.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ export interface FooterStatusInput {
|
|
|
280
280
|
multiLineInput: boolean;
|
|
281
281
|
queued: number;
|
|
282
282
|
cwdLabel?: string;
|
|
283
|
+
compactView?: boolean;
|
|
283
284
|
}
|
|
284
285
|
export declare function footerActivity(input: FooterStatusInput): {
|
|
285
286
|
kind: FooterActivityKind;
|
|
@@ -359,10 +360,18 @@ export declare function fmtElapsedCompact(elapsedSecs: number): string;
|
|
|
359
360
|
* every paint of the same frame stays in phase.
|
|
360
361
|
*/
|
|
361
362
|
export declare function shimmerText(text: string, nowMs: number, color: boolean): string;
|
|
362
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* Codex-style short status from reasoning: first `**bold**` / heading, else
|
|
365
|
+
* the first short clause. Keeps the wait card in sync with what the model is
|
|
366
|
+
* doing instead of repeating the user's prompt.
|
|
367
|
+
*/
|
|
368
|
+
export declare function waitSummaryFromReasoning(text: string, maxChars?: number): string | undefined;
|
|
369
|
+
/** Wait-card header + optional detail. Header tracks model work when known. */
|
|
363
370
|
export declare function waitCardCopy(input: {
|
|
364
371
|
toolTitle?: string;
|
|
365
372
|
toolSummary?: string;
|
|
373
|
+
reasoning?: string;
|
|
374
|
+
reply?: string;
|
|
366
375
|
prompt?: string;
|
|
367
376
|
}): {
|
|
368
377
|
header: string;
|
|
@@ -500,6 +509,21 @@ export declare function parseCursorPositionReply(text: string): {
|
|
|
500
509
|
* coordinates — only the elapsed milliseconds matter.
|
|
501
510
|
*/
|
|
502
511
|
export declare function probeTerminalRttMs(stdin?: NodeJS.ReadStream, stdout?: NodeJS.WriteStream, timeoutMs?: number): Promise<number | undefined>;
|
|
512
|
+
export type WorkspaceView = 'detailed' | 'compact';
|
|
513
|
+
export declare function parseWorkspaceView(raw: string): WorkspaceView | undefined;
|
|
514
|
+
export declare function countDiffLines(hunks: readonly ToolDiffHunk[] | undefined): number;
|
|
515
|
+
export declare function compactToolGroups(tools: readonly Extract<Row, {
|
|
516
|
+
kind: 'tool';
|
|
517
|
+
}>[]): {
|
|
518
|
+
edits: Extract<Row, {
|
|
519
|
+
kind: 'tool';
|
|
520
|
+
}>[];
|
|
521
|
+
calls: Extract<Row, {
|
|
522
|
+
kind: 'tool';
|
|
523
|
+
}>[];
|
|
524
|
+
editLines: number;
|
|
525
|
+
failedCalls: number;
|
|
526
|
+
};
|
|
503
527
|
/** True while a plan still belongs in the dock (latest incomplete work). */
|
|
504
528
|
export declare function planIsLive(plan: {
|
|
505
529
|
active: boolean;
|
|
@@ -657,6 +681,7 @@ export declare class SshTui {
|
|
|
657
681
|
private readonly color;
|
|
658
682
|
private readonly maxToolOutputLines;
|
|
659
683
|
private readonly showReasoning;
|
|
684
|
+
private workspaceView;
|
|
660
685
|
private readonly goodbye;
|
|
661
686
|
private readonly resume;
|
|
662
687
|
private readonly providerName;
|
|
@@ -730,6 +755,14 @@ export declare class SshTui {
|
|
|
730
755
|
/** Enter raw mode, switch to the alternate screen, and start listening. */
|
|
731
756
|
start(): void;
|
|
732
757
|
private notifyPluginUpdate;
|
|
758
|
+
private readSkippedUpdate;
|
|
759
|
+
private persistSkippedUpdate;
|
|
760
|
+
private mergeUiSettings;
|
|
761
|
+
private readWorkspaceView;
|
|
762
|
+
private isCompactView;
|
|
763
|
+
/** Test helper: switch the workspace view without going through /view. */
|
|
764
|
+
setWorkspaceView(view: WorkspaceView): void;
|
|
765
|
+
private paintCompactSummary;
|
|
733
766
|
private startRenderTimer;
|
|
734
767
|
private calibratePaintInterval;
|
|
735
768
|
/** Replay the durable session log so a resumed session renders its history. */
|
|
@@ -753,14 +786,14 @@ export declare class SshTui {
|
|
|
753
786
|
private collapsibleRows;
|
|
754
787
|
private spinnerFrame;
|
|
755
788
|
/**
|
|
756
|
-
* Codex wait card: shown while the turn is running
|
|
757
|
-
*
|
|
758
|
-
* name what is happening (Codex `update_details`).
|
|
789
|
+
* Codex wait card: shown while the turn is running. Thinking/reply streams
|
|
790
|
+
* feed the shimmer header; a live tool becomes the detail line.
|
|
759
791
|
*/
|
|
760
792
|
private waitCardVisible;
|
|
761
793
|
private beginWait;
|
|
762
794
|
private endWait;
|
|
763
795
|
private waitCardSource;
|
|
796
|
+
private planShouldDefaultExpand;
|
|
764
797
|
private findSubagentRow;
|
|
765
798
|
private findLivePlanRow;
|
|
766
799
|
/** Older / finished plans stay in the scrolling transcript. */
|
|
@@ -781,10 +814,10 @@ export declare class SshTui {
|
|
|
781
814
|
/** Move the expand/collapse focus among reasoning and tool rows. */
|
|
782
815
|
private moveCollapsibleFocus;
|
|
783
816
|
/** Toggle the focused block; without focus, toggle the most recent one. */
|
|
784
|
-
|
|
817
|
+
toggleCollapsible(): void;
|
|
785
818
|
toggleCard(target: CollapsibleBlock): void;
|
|
786
819
|
/** Expand all collapsible blocks, or collapse them again when all are open. */
|
|
787
|
-
|
|
820
|
+
toggleAllCollapsible(): void;
|
|
788
821
|
private highlightSearchLine;
|
|
789
822
|
private revealRow;
|
|
790
823
|
private focusCard;
|
|
@@ -916,6 +949,8 @@ export declare class SshTui {
|
|
|
916
949
|
private runSubeffortCommand;
|
|
917
950
|
/** /language or /lang: persist zh/en and repaint chrome immediately. */
|
|
918
951
|
private runLanguageCommand;
|
|
952
|
+
/** /view: detailed (see the work) vs compact (Codex-like summary). */
|
|
953
|
+
private runViewCommand;
|
|
919
954
|
/** /mode: pick an agent preset (standard / minimal / ptc / cordis / routing-suite / ...). */
|
|
920
955
|
private runModeCommand;
|
|
921
956
|
/** /resume: switch to a past session, or open a picker when no id is given. */
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
export declare const PLUGIN_PACKAGE = "dsh-ssh-tui";
|
|
1
2
|
export declare function compareSemver(a: string, b: string): number;
|
|
2
|
-
export declare function
|
|
3
|
+
export declare function resolvePluginProfileName(env?: NodeJS.ProcessEnv): string;
|
|
4
|
+
export declare function pluginUpgradeCommand(profile?: string): string;
|
|
5
|
+
export declare function formatUpdateNotice(current: string, latest: string, profile?: string): string;
|
|
3
6
|
export declare function fetchLatestNpmVersion(fetchImpl?: typeof fetch): Promise<string | undefined>;
|
|
4
|
-
export
|
|
7
|
+
export interface PluginUpdateInfo {
|
|
8
|
+
current: string;
|
|
9
|
+
latest: string;
|
|
10
|
+
profile: string;
|
|
11
|
+
command: string;
|
|
12
|
+
notice: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function checkForPluginUpdate(current: string): Promise<PluginUpdateInfo | undefined>;
|
|
15
|
+
export declare function installPluginLatest(profile?: string): Promise<{
|
|
16
|
+
ok: boolean;
|
|
17
|
+
output: string;
|
|
18
|
+
}>;
|
package/lib/update-check.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Best-effort npm latest check.
|
|
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
5
|
*/
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { t } from './i18n/index.js';
|
|
4
8
|
const NPM_REGISTRY = 'https://registry.npmjs.org/dsh-ssh-tui/latest';
|
|
5
9
|
const CHECK_TIMEOUT_MS = 4000;
|
|
10
|
+
export const PLUGIN_PACKAGE = 'dsh-ssh-tui';
|
|
6
11
|
export function compareSemver(a, b) {
|
|
7
12
|
const parse = (value) => {
|
|
8
13
|
const core = value.trim().replace(/^v/u, '').split('-')[0] ?? '0';
|
|
@@ -17,9 +22,20 @@ export function compareSemver(a, b) {
|
|
|
17
22
|
}
|
|
18
23
|
return 0;
|
|
19
24
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
export function resolvePluginProfileName(env = process.env) {
|
|
26
|
+
const fromEnv = env.DSH_TUI_PROFILE?.trim();
|
|
27
|
+
if (fromEnv !== undefined && fromEnv !== '')
|
|
28
|
+
return fromEnv;
|
|
29
|
+
const arg = env.DSH_PROFILE?.trim();
|
|
30
|
+
if (arg !== undefined && arg !== '')
|
|
31
|
+
return arg;
|
|
32
|
+
return 'tui';
|
|
33
|
+
}
|
|
34
|
+
export function pluginUpgradeCommand(profile = resolvePluginProfileName()) {
|
|
35
|
+
return `dsh plugin --profile ${profile} add ${PLUGIN_PACKAGE}@latest`;
|
|
36
|
+
}
|
|
37
|
+
export function formatUpdateNotice(current, latest, profile = resolvePluginProfileName()) {
|
|
38
|
+
return t('update.notice', { latest, current, command: pluginUpgradeCommand(profile) });
|
|
23
39
|
}
|
|
24
40
|
export async function fetchLatestNpmVersion(fetchImpl = fetch) {
|
|
25
41
|
try {
|
|
@@ -45,6 +61,31 @@ export async function checkForPluginUpdate(current) {
|
|
|
45
61
|
return undefined;
|
|
46
62
|
if (compareSemver(latest, current) <= 0)
|
|
47
63
|
return undefined;
|
|
48
|
-
|
|
64
|
+
const profile = resolvePluginProfileName();
|
|
65
|
+
return {
|
|
66
|
+
current,
|
|
67
|
+
latest,
|
|
68
|
+
profile,
|
|
69
|
+
command: pluginUpgradeCommand(profile),
|
|
70
|
+
notice: formatUpdateNotice(current, latest, profile),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export async function installPluginLatest(profile = resolvePluginProfileName()) {
|
|
74
|
+
return await new Promise(resolve => {
|
|
75
|
+
const child = spawn('dsh', ['plugin', '--profile', profile, 'add', `${PLUGIN_PACKAGE}@latest`], {
|
|
76
|
+
env: process.env,
|
|
77
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
78
|
+
});
|
|
79
|
+
const chunks = [];
|
|
80
|
+
child.stdout?.on('data', chunk => chunks.push(Buffer.from(chunk)));
|
|
81
|
+
child.stderr?.on('data', chunk => chunks.push(Buffer.from(chunk)));
|
|
82
|
+
child.on('error', error => {
|
|
83
|
+
resolve({ ok: false, output: error instanceof Error ? error.message : String(error) });
|
|
84
|
+
});
|
|
85
|
+
child.on('close', code => {
|
|
86
|
+
const output = Buffer.concat(chunks).toString('utf8').trim();
|
|
87
|
+
resolve({ ok: code === 0, output });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
49
90
|
}
|
|
50
91
|
//# sourceMappingURL=update-check.js.map
|
package/lib/update-check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"update-check.js","sour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