@deepseek-harness-tui/dsh-tui 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -57
- package/cordis.patch.yml +5 -3
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/configuration.en.md +1 -1
- package/guide/dsh-tui-guide/configuration.md +1 -1
- package/guide/dsh-tui-guide/getting-started.en.md +2 -2
- package/guide/dsh-tui-guide/getting-started.md +2 -2
- package/guide/dsh-tui-guide/user-guide.en.md +7 -2
- package/guide/dsh-tui-guide/user-guide.md +7 -2
- package/lib/settings.json +24 -8
- package/lib/types/adapter/ports/channel-view.d.ts +39 -3
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +3 -1
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.js +8 -3
- package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/presentation.js +5 -2
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/permissions.d.ts +15 -0
- package/lib/types/channel/permissions.d.ts.map +1 -1
- package/lib/types/channel/permissions.js +28 -0
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +11 -1
- package/lib/types/channel/questions.d.ts +26 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/questions.js +43 -0
- package/lib/types/commands.js +1 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +3 -3
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -2
- package/lib/types/components/StarPrompt.d.ts +5 -3
- package/lib/types/components/StarPrompt.d.ts.map +1 -1
- package/lib/types/components/StarPrompt.js +56 -6
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +1 -1
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +3 -2
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +121 -23
- package/lib/types/components/teamRoster.d.ts +6 -3
- package/lib/types/components/teamRoster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.d.ts +19 -0
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.js +17 -1
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +15 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +7 -4
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
- package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +179 -33
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
- package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +2 -2
- package/lib/types/dsh-adapter/contract.d.ts +7 -4
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +8 -4
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.d.ts +2 -0
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +3 -0
- package/lib/types/dsh-adapter/index.d.ts +9 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/index.js +44 -0
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/service.js +5 -6
- package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +3 -2
- package/lib/types/dsh-adapter/plugin.d.ts +237 -6
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +608 -23
- package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
- package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/session-projection-store.js +30 -23
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +4 -1
- package/lib/types/dsh-adapter/subagents.d.ts +1 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +10 -2
- package/lib/types/dsh-adapter/team-mode.d.ts +29 -17
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +138 -17
- package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
- package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-roster.js +206 -39
- package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
- package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-tools.js +81 -26
- package/lib/types/i18n.d.ts +65 -9
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +29 -8
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +13 -3
- package/lib/types/ink/flush-tick.d.ts +6 -0
- package/lib/types/ink/flush-tick.d.ts.map +1 -1
- package/lib/types/ink/flush-tick.js +31 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-title.js +23 -3
- package/lib/types/ink/ink.js +2 -2
- package/lib/types/ink/jumpback-state.d.ts +33 -0
- package/lib/types/ink/jumpback-state.d.ts.map +1 -0
- package/lib/types/ink/jumpback-state.js +51 -0
- package/lib/types/ink/jumpback.d.ts +78 -0
- package/lib/types/ink/jumpback.d.ts.map +1 -0
- package/lib/types/ink/jumpback.js +515 -0
- package/lib/types/ink/log-update.js +37 -14
- package/lib/types/ink/notify-helper/activate.cs +836 -0
- package/lib/types/ink/notify-helper/compile.d.ts +30 -0
- package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
- package/lib/types/ink/notify-helper/compile.js +235 -0
- package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.js +14 -21
- package/lib/types/ink/terminal-notification.d.ts +31 -2
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +51 -0
- package/lib/types/ink/terminal.d.ts +2 -1
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +9 -4
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +1 -1
- package/lib/types/screens/Chat.d.ts +4 -3
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +38 -9
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +15 -7
- package/package.json +112 -112
- package/presets/liangshen/agent.cordis.yml +4 -0
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The jump-back helper's one build step (D5): compile `activate.cs`
|
|
3
|
+
* with the in-box .NET Framework `csc.exe` on first use, then reuse the
|
|
4
|
+
* executable until either the source or the compiler moves.
|
|
5
|
+
*
|
|
6
|
+
* The package ships the C# source, not a binary (D5), so this module turns it
|
|
7
|
+
* into `<DATA_DIR>/notify/helper/activate.exe` on the machine that needs it.
|
|
8
|
+
* The cache key is the source's content hash plus the resolved compiler path,
|
|
9
|
+
* recorded next to the executable in `activate.exe.hash`: an unchanged pair
|
|
10
|
+
* reuses the executable without spawning anything, and a package update or a
|
|
11
|
+
* different framework directory invalidates it.
|
|
12
|
+
*
|
|
13
|
+
* Every failure - a non-Windows host, a missing csc, an unreadable source, a
|
|
14
|
+
* non-zero exit or the {@link COMPILE_TIMEOUT_MS} ceiling - answers undefined
|
|
15
|
+
* and leaves the reason in the debug log. Jump-back is the only capability
|
|
16
|
+
* that needs the helper, so the caller degrades to a plain toast while the
|
|
17
|
+
* notification itself is unaffected. Nothing here writes the registry;
|
|
18
|
+
* that is the lazy protocol step in `jumpback.ts` (D7).
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The compiled helper's path, compiling it first when the cache is cold.
|
|
22
|
+
*
|
|
23
|
+
* Concurrent callers in this process share one compilation, so a burst of
|
|
24
|
+
* notifications cannot start two csc processes writing the same executable.
|
|
25
|
+
* A failed run is not remembered: the next notification retries, which is the
|
|
26
|
+
* recovery path after an antivirus block or a deleted cache.
|
|
27
|
+
* @returns the executable path, or undefined when this machine cannot build it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ensureHelper(): Promise<string | undefined>;
|
|
30
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../src/ink/notify-helper/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkNH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY1D"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The jump-back helper's one build step (D5): compile `activate.cs`
|
|
3
|
+
* with the in-box .NET Framework `csc.exe` on first use, then reuse the
|
|
4
|
+
* executable until either the source or the compiler moves.
|
|
5
|
+
*
|
|
6
|
+
* The package ships the C# source, not a binary (D5), so this module turns it
|
|
7
|
+
* into `<DATA_DIR>/notify/helper/activate.exe` on the machine that needs it.
|
|
8
|
+
* The cache key is the source's content hash plus the resolved compiler path,
|
|
9
|
+
* recorded next to the executable in `activate.exe.hash`: an unchanged pair
|
|
10
|
+
* reuses the executable without spawning anything, and a package update or a
|
|
11
|
+
* different framework directory invalidates it.
|
|
12
|
+
*
|
|
13
|
+
* Every failure - a non-Windows host, a missing csc, an unreadable source, a
|
|
14
|
+
* non-zero exit or the {@link COMPILE_TIMEOUT_MS} ceiling - answers undefined
|
|
15
|
+
* and leaves the reason in the debug log. Jump-back is the only capability
|
|
16
|
+
* that needs the helper, so the caller degrades to a plain toast while the
|
|
17
|
+
* notification itself is unaffected. Nothing here writes the registry;
|
|
18
|
+
* that is the lazy protocol step in `jumpback.ts` (D7).
|
|
19
|
+
*/
|
|
20
|
+
import { randomBytes } from 'node:crypto';
|
|
21
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
22
|
+
import { dirname, join } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { hashContent } from '../../terminal-utils/hash.js';
|
|
25
|
+
import { logForDebugging } from '../../utils/debug.js';
|
|
26
|
+
import { execFileNoThrow } from '../../utils/execFileNoThrow.js';
|
|
27
|
+
import { DATA_DIR } from '../../utils/paths.js';
|
|
28
|
+
/**
|
|
29
|
+
* The helper source beside this module. tsc keeps the directory layout, and
|
|
30
|
+
* the build's copy step puts `activate.cs` next to the emitted JavaScript in
|
|
31
|
+
* `lib/types/ink/notify-helper/`, so the same URL resolves in both trees.
|
|
32
|
+
*/
|
|
33
|
+
const HELPER_SOURCE = fileURLToPath(new URL('./activate.cs', import.meta.url));
|
|
34
|
+
const HELPER_DIR = join(DATA_DIR, 'notify', 'helper');
|
|
35
|
+
const HELPER_EXE = join(HELPER_DIR, 'activate.exe');
|
|
36
|
+
/** Remembers the (source hash, csc path) pair the executable was built from. */
|
|
37
|
+
const HELPER_HASH = `${HELPER_EXE}.hash`;
|
|
38
|
+
/** csc takes ~0.3 s on a warm machine; ten seconds means stuck, not slow. */
|
|
39
|
+
const COMPILE_TIMEOUT_MS = 10_000;
|
|
40
|
+
/**
|
|
41
|
+
* A failed build is retried after this pause instead of on every completion:
|
|
42
|
+
* an antivirus block or a broken framework does not heal within seconds, and
|
|
43
|
+
* each retry would delay the next toast by up to the compile timeout.
|
|
44
|
+
*/
|
|
45
|
+
const FAILURE_COOLDOWN_MS = 5 * 60_000;
|
|
46
|
+
/** A failed (source hash, compiler) pair and when it failed. */
|
|
47
|
+
let lastFailure;
|
|
48
|
+
/** The in-box framework layouts, 64-bit first; both ship the same csc. */
|
|
49
|
+
const FRAMEWORK_DIRS = ['Framework64', 'Framework'];
|
|
50
|
+
const FRAMEWORK_VERSION = 'v4.0.30319';
|
|
51
|
+
/**
|
|
52
|
+
* The assemblies the helper references. Both sit in the `WPF/` subdirectory of
|
|
53
|
+
* the framework directory csc itself was found in, and neither needs
|
|
54
|
+
* `System.Core` (verified when the source was written).
|
|
55
|
+
*/
|
|
56
|
+
const UI_AUTOMATION_ASSEMBLIES = ['UIAutomationClient.dll', 'UIAutomationTypes.dll'];
|
|
57
|
+
function detailOf(error) {
|
|
58
|
+
return error instanceof Error ? error.message : String(error);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The in-box compiler, or undefined when neither framework directory has one.
|
|
62
|
+
* `WINDIR` is what Windows itself uses; `SystemRoot` is the same directory's
|
|
63
|
+
* other spelling and covers stripped-down environments.
|
|
64
|
+
* @returns the absolute csc path.
|
|
65
|
+
*/
|
|
66
|
+
function inBoxCsc() {
|
|
67
|
+
const windowsRoot = process.env.WINDIR ?? process.env.SystemRoot;
|
|
68
|
+
if (windowsRoot === undefined || windowsRoot === '')
|
|
69
|
+
return undefined;
|
|
70
|
+
return FRAMEWORK_DIRS
|
|
71
|
+
.map(arch => join(windowsRoot, 'Microsoft.NET', arch, FRAMEWORK_VERSION, 'csc.exe'))
|
|
72
|
+
.find(candidate => existsSync(candidate));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `/target:winexe` keeps a console from flashing when Windows starts the helper
|
|
76
|
+
* from a toast click (D5); the source must stay at C# 5 because this csc is the
|
|
77
|
+
* .NET Framework 4.x in-box one.
|
|
78
|
+
* @returns the argv to run.
|
|
79
|
+
*/
|
|
80
|
+
function cscArgs(csc, out) {
|
|
81
|
+
const references = UI_AUTOMATION_ASSEMBLIES.map(assembly => `/r:${join(dirname(csc), 'WPF', assembly)}`);
|
|
82
|
+
return ['/nologo', '/warn:4', '/target:winexe', `/out:${out}`, ...references, HELPER_SOURCE];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A path no other csc run can share: the compiler writes here, and only a
|
|
86
|
+
* completed build is moved onto the documented executable.
|
|
87
|
+
*/
|
|
88
|
+
function temporaryName(target, extension) {
|
|
89
|
+
return `${target}.${process.pid}-${randomBytes(4).toString('hex')}.${extension}`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Move a finished artifact onto its documented path. A rename is atomic on the
|
|
93
|
+
* same volume, so a reader never sees a half-written executable or hash.
|
|
94
|
+
*/
|
|
95
|
+
function replaceFile(temporary, target) {
|
|
96
|
+
renameSync(temporary, target);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The csc path is in the key so a machine that acquires or switches framework
|
|
100
|
+
* directories rebuilds rather than running an executable from another layout.
|
|
101
|
+
* @returns the string stored in {@link HELPER_HASH}.
|
|
102
|
+
*/
|
|
103
|
+
function cacheKey(source, csc) {
|
|
104
|
+
return `${hashContent(source)}\n${csc}\n`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @returns true when the executable and its matching key both exist.
|
|
108
|
+
*/
|
|
109
|
+
function cacheHit(key) {
|
|
110
|
+
if (!existsSync(HELPER_EXE))
|
|
111
|
+
return false;
|
|
112
|
+
try {
|
|
113
|
+
return readFileSync(HELPER_HASH, 'utf8') === key;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function compileIfNeeded() {
|
|
120
|
+
if (process.platform !== 'win32') {
|
|
121
|
+
logForDebugging('notify helper: the in-box csc only exists on Windows', { platform: process.platform });
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
let source;
|
|
125
|
+
try {
|
|
126
|
+
source = readFileSync(HELPER_SOURCE, 'utf8');
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
logForDebugging('notify helper: source unreadable', { source: HELPER_SOURCE, detail: detailOf(error) });
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const csc = inBoxCsc();
|
|
133
|
+
if (csc === undefined) {
|
|
134
|
+
logForDebugging('notify helper: in-box csc not found', {
|
|
135
|
+
windowsRoot: process.env.WINDIR ?? process.env.SystemRoot ?? '',
|
|
136
|
+
});
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
const key = cacheKey(source, csc);
|
|
140
|
+
if (cacheHit(key))
|
|
141
|
+
return HELPER_EXE;
|
|
142
|
+
if (lastFailure !== undefined && lastFailure.key === key
|
|
143
|
+
&& Date.now() - lastFailure.at < FAILURE_COOLDOWN_MS) {
|
|
144
|
+
logForDebugging('notify helper: a recent build failure is still cooling down', { csc });
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
mkdirSync(HELPER_DIR, { recursive: true });
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
logForDebugging('notify helper: cache directory unusable', { dir: HELPER_DIR, detail: detailOf(error) });
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
const temporaryExe = temporaryName(HELPER_EXE, 'tmp.exe');
|
|
155
|
+
const temporaryHash = temporaryName(HELPER_HASH, 'tmp');
|
|
156
|
+
const result = await execFileNoThrow(csc, cscArgs(csc, temporaryExe), { timeout: COMPILE_TIMEOUT_MS });
|
|
157
|
+
if (result.code !== 0) {
|
|
158
|
+
// Only this run's temporary file is removed. A shared executable another
|
|
159
|
+
// instance already finished must survive a failed retry here.
|
|
160
|
+
try {
|
|
161
|
+
rmSync(temporaryExe, { force: true });
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Best effort: the next successful build leaves the same temp layout.
|
|
165
|
+
}
|
|
166
|
+
lastFailure = { key, at: Date.now() };
|
|
167
|
+
const detail = result.code === null
|
|
168
|
+
? `timed out after ${COMPILE_TIMEOUT_MS} ms or was killed`
|
|
169
|
+
: (result.stderr.trim() || result.stdout.trim()).slice(0, 500);
|
|
170
|
+
logForDebugging('notify helper: csc failed', { csc, code: result.code, detail });
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
replaceFile(temporaryExe, HELPER_EXE);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
try {
|
|
178
|
+
rmSync(temporaryExe, { force: true });
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// The temp file is diagnostic litter at worst.
|
|
182
|
+
}
|
|
183
|
+
lastFailure = { key, at: Date.now() };
|
|
184
|
+
logForDebugging('notify helper: compiled but the executable could not be installed', {
|
|
185
|
+
exe: HELPER_EXE,
|
|
186
|
+
detail: detailOf(error),
|
|
187
|
+
});
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
writeFileSync(temporaryHash, key, 'utf8');
|
|
192
|
+
replaceFile(temporaryHash, HELPER_HASH);
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
try {
|
|
196
|
+
rmSync(temporaryHash, { force: true });
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// Best effort.
|
|
200
|
+
}
|
|
201
|
+
// The executable is usable; only the next call has to compile it again.
|
|
202
|
+
logForDebugging('notify helper: compiled but the cache key was not written', {
|
|
203
|
+
hash: HELPER_HASH,
|
|
204
|
+
detail: detailOf(error),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
lastFailure = undefined;
|
|
208
|
+
logForDebugging('notify helper: compiled', { exe: HELPER_EXE, csc });
|
|
209
|
+
return HELPER_EXE;
|
|
210
|
+
}
|
|
211
|
+
/** The one compilation this process may be running; it coalesces callers. */
|
|
212
|
+
let inFlight;
|
|
213
|
+
/**
|
|
214
|
+
* The compiled helper's path, compiling it first when the cache is cold.
|
|
215
|
+
*
|
|
216
|
+
* Concurrent callers in this process share one compilation, so a burst of
|
|
217
|
+
* notifications cannot start two csc processes writing the same executable.
|
|
218
|
+
* A failed run is not remembered: the next notification retries, which is the
|
|
219
|
+
* recovery path after an antivirus block or a deleted cache.
|
|
220
|
+
* @returns the executable path, or undefined when this machine cannot build it.
|
|
221
|
+
*/
|
|
222
|
+
export function ensureHelper() {
|
|
223
|
+
if (inFlight !== undefined)
|
|
224
|
+
return inFlight;
|
|
225
|
+
const started = compileIfNeeded()
|
|
226
|
+
.catch((error) => {
|
|
227
|
+
logForDebugging('notify helper: compilation threw', { detail: detailOf(error) });
|
|
228
|
+
return undefined;
|
|
229
|
+
})
|
|
230
|
+
.finally(() => {
|
|
231
|
+
inFlight = undefined;
|
|
232
|
+
});
|
|
233
|
+
inFlight = started;
|
|
234
|
+
return started;
|
|
235
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Windows toast transport (DESIGN D3/D4/D8/D10/D11/D12): the only place the
|
|
3
|
-
* renderer talks to the Windows shell about
|
|
3
|
+
* renderer talks to the Windows shell about notifications.
|
|
4
4
|
*
|
|
5
5
|
* It answers two questions, and a caller should not need anything else:
|
|
6
6
|
* - show one {@link notifyWindowsToast}
|
|
@@ -62,12 +62,14 @@ export declare function toastHostSpawnOptions(): SpawnOptions;
|
|
|
62
62
|
* @returns The same text, safe inside an XML text node.
|
|
63
63
|
*/
|
|
64
64
|
export declare function escapeXmlText(text: string): string;
|
|
65
|
-
/** The parts of a
|
|
65
|
+
/** The parts of a notification toast. */
|
|
66
66
|
export interface ToastContent {
|
|
67
67
|
/** First line; the renderer passes its localized title (AC-1). */
|
|
68
68
|
title: string;
|
|
69
69
|
/** Second line: the single-line summary. Omitted when empty, clipped by {@link clampSummary}. */
|
|
70
70
|
message?: string;
|
|
71
|
+
/** Protocol activation URI a click opens; omitted, the toast only informs. */
|
|
72
|
+
launch?: string;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Build the ToastGeneric document (D10).
|
|
@@ -140,7 +142,7 @@ export type WindowsToastAvailability = {
|
|
|
140
142
|
export type WindowsToastResult = {
|
|
141
143
|
status: 'shown';
|
|
142
144
|
}
|
|
143
|
-
/** An external notifier owns
|
|
145
|
+
/** An external notifier owns the notification: no toast and no bell (AC-6). */
|
|
144
146
|
| {
|
|
145
147
|
status: 'yielded';
|
|
146
148
|
}
|
|
@@ -159,6 +161,8 @@ export interface WindowsToastInput {
|
|
|
159
161
|
title: string;
|
|
160
162
|
/** Single-line summary; empty shows the title alone. */
|
|
161
163
|
message?: string;
|
|
164
|
+
/** Protocol activation URI a click opens; omitted, the toast only informs. */
|
|
165
|
+
launch?: string;
|
|
162
166
|
/** The host confirmed an enabled, active DSH notifier in its live inventory. */
|
|
163
167
|
externalNotifierActive?: boolean;
|
|
164
168
|
/** Recheck live permission before dispatch, without repeating the focus gate. */
|
|
@@ -184,7 +188,7 @@ export interface WindowsToastTransport {
|
|
|
184
188
|
*/
|
|
185
189
|
export declare function createWindowsToastTransport(options?: WindowsToastTransportOptions): WindowsToastTransport;
|
|
186
190
|
/**
|
|
187
|
-
* Show one
|
|
191
|
+
* Show one notification toast: stand down for an external notifier, register
|
|
188
192
|
* once, then spawn the in-box host. Never rejects, and an unavailable transport
|
|
189
193
|
* is reported so the caller can ring the bell instead (AC-5).
|
|
190
194
|
* @param input Title, summary and the profile document for the dedup read.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-notification-windows.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal-notification-windows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"terminal-notification-windows.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal-notification-windows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAOpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAEhG,kFAAkF;AAClF,KAAK,UAAU,GAAG,CAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEnC,yEAAyE;AACzE,eAAO,MAAM,WAAW,YAAY,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,qDAA4D,CAAA;AAmE3F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,IAAI,YAAY,CAKpD;AAyDD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD;AAED,yCAAyC;AACzC,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAyBD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAWtD;AAID,6EAA6E;AAC7E,MAA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/D10/D11/D12): the only place the
|
|
3
|
-
* renderer talks to the Windows shell about
|
|
3
|
+
* renderer talks to the Windows shell about notifications.
|
|
4
4
|
*
|
|
5
5
|
* It answers two questions, and a caller should not need anything else:
|
|
6
6
|
* - show one {@link notifyWindowsToast}
|
|
@@ -24,9 +24,8 @@ import { existsSync } from 'node:fs';
|
|
|
24
24
|
import { join } from 'node:path';
|
|
25
25
|
import { fileURLToPath } from 'node:url';
|
|
26
26
|
import { logForDebugging } from '../utils/debug.js';
|
|
27
|
+
import { clipToWidthGraphemes } from './terminal-notification.js';
|
|
27
28
|
import { execFileNoThrow } from '../utils/execFileNoThrow.js';
|
|
28
|
-
import { stringWidth } from './stringWidth.js';
|
|
29
|
-
import { getGraphemeSegmenter } from '../utils/intl.js';
|
|
30
29
|
/** The AppUserModelID the toast is shown under (spike H, 2026-10-16). */
|
|
31
30
|
export const TOAST_AUMID = 'dsh-tui';
|
|
32
31
|
/**
|
|
@@ -198,9 +197,9 @@ export function escapeXmlText(text) {
|
|
|
198
197
|
* ellipsis at all - the UAT screenshot (2026-10-16) ended on "…(和 Claude (" -
|
|
199
198
|
* so the budget has to be ours. Two of the roughly 43-column lines that
|
|
200
199
|
* screenshot rendered is ~86 columns; 80 leaves margin for the wider glyphs of
|
|
201
|
-
* other locales and is measured with
|
|
202
|
-
* terminal side uses
|
|
203
|
-
* a Latin one.
|
|
200
|
+
* other locales and is measured with the shared grapheme-width clip - the
|
|
201
|
+
* display width the terminal side uses - so a CJK summary is not silently given
|
|
202
|
+
* twice the room of a Latin one.
|
|
204
203
|
*/
|
|
205
204
|
const TOAST_MESSAGE_MAX_WIDTH = 80;
|
|
206
205
|
/**
|
|
@@ -211,18 +210,7 @@ const TOAST_MESSAGE_MAX_WIDTH = 80;
|
|
|
211
210
|
* @returns The summary, whole or clipped.
|
|
212
211
|
*/
|
|
213
212
|
function clampSummary(message) {
|
|
214
|
-
|
|
215
|
-
return message;
|
|
216
|
-
let width = 0;
|
|
217
|
-
let clipped = '';
|
|
218
|
-
for (const { segment } of getGraphemeSegmenter().segment(message)) {
|
|
219
|
-
const segmentWidth = stringWidth(segment);
|
|
220
|
-
if (width + segmentWidth > TOAST_MESSAGE_MAX_WIDTH - 1)
|
|
221
|
-
break;
|
|
222
|
-
clipped += segment;
|
|
223
|
-
width += segmentWidth;
|
|
224
|
-
}
|
|
225
|
-
return `${clipped}…`;
|
|
213
|
+
return clipToWidthGraphemes(message, TOAST_MESSAGE_MAX_WIDTH);
|
|
226
214
|
}
|
|
227
215
|
/**
|
|
228
216
|
* Build the ToastGeneric document (D10).
|
|
@@ -230,11 +218,16 @@ function clampSummary(message) {
|
|
|
230
218
|
* @returns The XML handed to `XmlDocument.LoadXml` on the PowerShell side.
|
|
231
219
|
*/
|
|
232
220
|
export function toastXml(content) {
|
|
221
|
+
// Without a launch URI the document has to stay byte for byte what it was, so
|
|
222
|
+
// the attribute is built only when there is something to activate.
|
|
223
|
+
const activation = content.launch !== undefined && content.launch !== ''
|
|
224
|
+
? ` activationType="protocol" launch="${escapeXmlText(content.launch)}"`
|
|
225
|
+
: '';
|
|
233
226
|
const texts = [`<text>${escapeXmlText(content.title)}</text>`];
|
|
234
227
|
if (content.message !== undefined && content.message !== '') {
|
|
235
228
|
texts.push(`<text>${escapeXmlText(clampSummary(content.message))}</text>`);
|
|
236
229
|
}
|
|
237
|
-
return `<toast><visual><binding template="ToastGeneric">${texts.join('')}</binding></visual></toast>`;
|
|
230
|
+
return `<toast${activation}><visual><binding template="ToastGeneric">${texts.join('')}</binding></visual></toast>`;
|
|
238
231
|
}
|
|
239
232
|
/**
|
|
240
233
|
* Create a transport with its own registration state. Production shares one
|
|
@@ -302,7 +295,7 @@ export function createWindowsToastTransport(options = {}) {
|
|
|
302
295
|
return { ok: true, tools };
|
|
303
296
|
}
|
|
304
297
|
async function show(input, powershell) {
|
|
305
|
-
const xml = toastXml({ title: input.title, message: input.message });
|
|
298
|
+
const xml = toastXml({ title: input.title, message: input.message, launch: input.launch });
|
|
306
299
|
const started = now();
|
|
307
300
|
const result = await toastHost(powershell, ['-NoProfile', '-Command', TOAST_SCRIPT], { input: xml, timeout: TOAST_TIMEOUT_MS });
|
|
308
301
|
if (result.code !== 0) {
|
|
@@ -422,7 +415,7 @@ function describe(error) {
|
|
|
422
415
|
// --- the shared instance ------------------------------------------------------
|
|
423
416
|
let shared;
|
|
424
417
|
/**
|
|
425
|
-
* Show one
|
|
418
|
+
* Show one notification toast: stand down for an external notifier, register
|
|
426
419
|
* once, then spawn the in-box host. Never rejects, and an unavailable transport
|
|
427
420
|
* is reported so the caller can ring the bell instead (AC-5).
|
|
428
421
|
* @param input Title, summary and the profile document for the dedup read.
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
export type TaskNotifications = 'off' | 'unfocused' | 'always';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
2
|
+
/**
|
|
3
|
+
* How a notification is delivered: probe the terminal (`auto`), force OSC 9 or
|
|
4
|
+
* BEL, or ask for the native Windows toast.
|
|
5
|
+
*/
|
|
4
6
|
export type NotificationMethod = 'auto' | 'osc9' | 'bel' | 'windows';
|
|
7
|
+
/**
|
|
8
|
+
* Normalize one notification body part for both transports.
|
|
9
|
+
*
|
|
10
|
+
* A notification leaves the TUI: the terminal path embeds the body in an OSC
|
|
11
|
+
* payload and the Windows path in a ToastGeneric XML document, where a raw C0
|
|
12
|
+
* control is invalid XML 1.0 and an ANSI escape either prints as garbage or
|
|
13
|
+
* terminates the sequence early. The OS renders the body as one short line, so
|
|
14
|
+
* multi-line model or host text must be flattened too. This is the same
|
|
15
|
+
* treatment the completion preview gets, shared here so every notification
|
|
16
|
+
* body (completion, approval, waiting question and plan review) keeps one
|
|
17
|
+
* rule.
|
|
18
|
+
* @param text - The raw text a notification would carry.
|
|
19
|
+
* @param maxGraphemes - Most graphemes kept, ellipsis included; defaults to 200.
|
|
20
|
+
* @returns Plain single-line text, empty when the input carried nothing visible.
|
|
21
|
+
*/
|
|
22
|
+
export declare function notificationText(text: string, maxGraphemes?: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Clip one line to at most `maxWidth` display cells, with an ellipsis that says
|
|
25
|
+
* the text continues. The ellipsis is one of those cells, and the walk is by
|
|
26
|
+
* grapheme cluster so a combined emoji is never cut through its joiners. The
|
|
27
|
+
* name budget in a notification body and the Windows toast body budget differ,
|
|
28
|
+
* but the rule is this one.
|
|
29
|
+
* @param text - Plain single-line text (no ANSI); see {@link notificationText}.
|
|
30
|
+
* @param maxWidth - Most display cells the result may occupy, ellipsis included.
|
|
31
|
+
* @returns The text unchanged when it fits, else a grapheme-safe clip plus `…`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function clipToWidthGraphemes(text: string, maxWidth: number): string;
|
|
5
34
|
/** Terminal-owned notification transport; never writes to redirected output. */
|
|
6
35
|
export declare function createTerminalNotifier(stdout: Pick<NodeJS.WriteStream, 'isTTY' | 'write'>): {
|
|
7
36
|
configure(nextCondition?: TaskNotifications, nextMethod?: NotificationMethod): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-notification.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal-notification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"terminal-notification.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal-notification.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAA;AAC9D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;AAEpE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,SAAM,GAAG,MAAM,CAQzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW3E;AAqBD,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC;8BAK7D,iBAAiB,eAA4B,kBAAkB,GAAY,IAAI;kBAI1F,MAAM,qBAAiB,IAAI;EA0C5C"}
|
|
@@ -1,9 +1,60 @@
|
|
|
1
|
+
import stripAnsi from 'strip-ansi';
|
|
1
2
|
import { getTerminalFocused } from './terminal-focus-state.js';
|
|
3
|
+
import { stringWidth } from './stringWidth.js';
|
|
2
4
|
import { getNotificationProtocol } from './terminal.js';
|
|
3
5
|
import { BEL } from './termio/ansi.js';
|
|
4
6
|
import { OSC, osc, wrapForMultiplexer } from './termio/osc.js';
|
|
5
7
|
import { logForDebugging } from '../utils/debug.js';
|
|
6
8
|
import { getGraphemeSegmenter } from '../utils/intl.js';
|
|
9
|
+
/**
|
|
10
|
+
* Normalize one notification body part for both transports.
|
|
11
|
+
*
|
|
12
|
+
* A notification leaves the TUI: the terminal path embeds the body in an OSC
|
|
13
|
+
* payload and the Windows path in a ToastGeneric XML document, where a raw C0
|
|
14
|
+
* control is invalid XML 1.0 and an ANSI escape either prints as garbage or
|
|
15
|
+
* terminates the sequence early. The OS renders the body as one short line, so
|
|
16
|
+
* multi-line model or host text must be flattened too. This is the same
|
|
17
|
+
* treatment the completion preview gets, shared here so every notification
|
|
18
|
+
* body (completion, approval, waiting question and plan review) keeps one
|
|
19
|
+
* rule.
|
|
20
|
+
* @param text - The raw text a notification would carry.
|
|
21
|
+
* @param maxGraphemes - Most graphemes kept, ellipsis included; defaults to 200.
|
|
22
|
+
* @returns Plain single-line text, empty when the input carried nothing visible.
|
|
23
|
+
*/
|
|
24
|
+
export function notificationText(text, maxGraphemes = 200) {
|
|
25
|
+
const flat = stripAnsi(text).replace(/[\x00-\x1f\x7f-\x9f]/g, ' ').replace(/\s+/g, ' ').trim();
|
|
26
|
+
const graphemes = [];
|
|
27
|
+
for (const { segment } of getGraphemeSegmenter().segment(flat)) {
|
|
28
|
+
if (graphemes.length === maxGraphemes)
|
|
29
|
+
return `${graphemes.slice(0, maxGraphemes - 1).join('')}…`;
|
|
30
|
+
graphemes.push(segment);
|
|
31
|
+
}
|
|
32
|
+
return graphemes.join('');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Clip one line to at most `maxWidth` display cells, with an ellipsis that says
|
|
36
|
+
* the text continues. The ellipsis is one of those cells, and the walk is by
|
|
37
|
+
* grapheme cluster so a combined emoji is never cut through its joiners. The
|
|
38
|
+
* name budget in a notification body and the Windows toast body budget differ,
|
|
39
|
+
* but the rule is this one.
|
|
40
|
+
* @param text - Plain single-line text (no ANSI); see {@link notificationText}.
|
|
41
|
+
* @param maxWidth - Most display cells the result may occupy, ellipsis included.
|
|
42
|
+
* @returns The text unchanged when it fits, else a grapheme-safe clip plus `…`.
|
|
43
|
+
*/
|
|
44
|
+
export function clipToWidthGraphemes(text, maxWidth) {
|
|
45
|
+
if (stringWidth(text) <= maxWidth)
|
|
46
|
+
return text;
|
|
47
|
+
let width = 0;
|
|
48
|
+
let clipped = '';
|
|
49
|
+
for (const { segment } of getGraphemeSegmenter().segment(text)) {
|
|
50
|
+
const segmentWidth = stringWidth(segment);
|
|
51
|
+
if (width + segmentWidth > maxWidth - 1)
|
|
52
|
+
break;
|
|
53
|
+
clipped += segment;
|
|
54
|
+
width += segmentWidth;
|
|
55
|
+
}
|
|
56
|
+
return `${clipped}…`;
|
|
57
|
+
}
|
|
7
58
|
// Ghostty 1.2.3 has a 2048-byte OSC buffer. Counting the entire unwrapped
|
|
8
59
|
// sequence also reserves the introducer and terminator conservatively.
|
|
9
60
|
const MAX_OSC_BYTES = 2048;
|
|
@@ -228,6 +228,7 @@ export declare function serializeDiff(terminal: Terminal, diff: Diff, skipSyncMa
|
|
|
228
228
|
* @param terminal - the terminal to write to.
|
|
229
229
|
* @param diff - the frame diff patches to render.
|
|
230
230
|
* @param skipSyncMarkers - when true, omit the BSU/ESU wrapping.
|
|
231
|
+
* @param onWritten - optional completion receipt for this frame, including prior queued output.
|
|
231
232
|
*/
|
|
232
|
-
export declare function writeDiffToTerminal(terminal: Terminal, diff: Diff, skipSyncMarkers?: boolean): void;
|
|
233
|
+
export declare function writeDiffToTerminal(terminal: Terminal, diff: Diff, skipSyncMarkers?: boolean, onWritten?: (error?: Error | null) => void): void;
|
|
233
234
|
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAMtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAYpE;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,eAAe,CAAA;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,CAuCtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAwDvD;AAcD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,IAAI,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAQ7E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,kBAAkB,E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AM,CAAC,UAAwB,GAC3C,OAAO,CAKT;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,WAAW,GAAE,MAAM,GAAG,SAAoC,EAC1D,kBAAkB,GAAE,MAAM,GAAG,SAA4C,EACzE,WAAW,GAAE,MAAM,CAAC,UAAwB,GAC3C,OAAO,CAUT;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,SAAkC,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAuBD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,QAAQ,CAAA;IAChB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED;;;;;;;GAOG;AACH;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,eAAe,UAAQ,GACtB,MAAM,CAwFR;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,eAAe,UAAQ,EACvB,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GACzC,IAAI,CAON"}
|
|
@@ -513,11 +513,16 @@ export function serializeDiff(terminal, diff, skipSyncMarkers = false) {
|
|
|
513
513
|
* @param terminal - the terminal to write to.
|
|
514
514
|
* @param diff - the frame diff patches to render.
|
|
515
515
|
* @param skipSyncMarkers - when true, omit the BSU/ESU wrapping.
|
|
516
|
+
* @param onWritten - optional completion receipt for this frame, including prior queued output.
|
|
516
517
|
*/
|
|
517
|
-
export function writeDiffToTerminal(terminal, diff, skipSyncMarkers = false) {
|
|
518
|
+
export function writeDiffToTerminal(terminal, diff, skipSyncMarkers = false, onWritten) {
|
|
518
519
|
const buffer = serializeDiff(terminal, diff, skipSyncMarkers);
|
|
519
|
-
if (buffer === '')
|
|
520
|
+
if (buffer === '' && onWritten === undefined)
|
|
520
521
|
return;
|
|
521
|
-
|
|
522
|
-
|
|
522
|
+
// A presentation waiter needs the stream's completion, not just enqueueing.
|
|
523
|
+
// An empty diff uses an empty write as a barrier for earlier queued bytes.
|
|
524
|
+
if (onWritten === undefined)
|
|
525
|
+
terminal.stdout.write(buffer);
|
|
526
|
+
else
|
|
527
|
+
terminal.stdout.write(buffer, onWritten);
|
|
523
528
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentTranscriptScene.d.ts","sourceRoot":"","sources":["../../../src/screens/AgentTranscriptScene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,8CAA8C,CAAA;AAIrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAwDrI,MAAM,WAAW,yBAAyB;IACxC;kEAC8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC,sEAAsE;IACtE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;IACjD,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,MAAM,IAAI,IAAI,CAAA;IACd;;gCAE4B;IAC5B,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IAC/C;6DACyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,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ACzD,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACjG;;6BAEyB;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C;;8EAE0E;IAC1E,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAa,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,SAAS,CA+T3L"}
|
|
@@ -209,7 +209,7 @@ export function AgentTranscriptScene({ subagent, onFailureRead, source, onExit,
|
|
|
209
209
|
: `${liveBadge === '' ? '' : ` · ${liveBadge}`} · ${t('agent-view-readonly')} · id ${agentId.slice(0, 8)}`;
|
|
210
210
|
const fallbackTail = subagent.outputEvents;
|
|
211
211
|
const retained = fallbackTail.length >= OUTPUT_WINDOW_CAP;
|
|
212
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: "accent", bold: true, children: "\u2922" }) }), _jsx(Box, { flexShrink: 1, minWidth: 0, children: _jsx(Text, { bold: true, wrap: "truncate-end", children: headerLabel }) }), _jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: headerBadges }) }), _jsx(Box, { flexGrow: 1 }), _jsx(Box, { flexShrink: 0, children: _jsx(ExitButton, { onClick: onExit }) })] }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: `${t('agent-view-title')} · ${sourceLabel(source)} · ${t('agent-view-back')}: Esc${headerWidth < 44 ? '' : ` · ↑/↓ ${t('subagent-hint-scroll')} · o ${t('subagent-transcript-load-older', { count: TRANSCRIPT_OLDER_CHUNK })}`}` }), _jsxs(Box, { flexDirection: "row", paddingX: 1, maxHeight: Math.max(10, rows - (compose !== undefined ? 12 : 6)), children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, minWidth: panelEnabled ? 44 : 0, children: _jsx(ScrollBox, { ref: scrollRef, flexDirection: "column", flexGrow: 1, children: loadTranscript === undefined ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t('agent-view-no-transcript') }), retained && (_jsx(Text, { dimColor: true, children: t('agent-view-retained-tail', { count: fallbackTail.length }) })), fallbackTail.length === 0 && messages.length === 0 && (_jsx(Text, { dimColor: true, children: t('subagent-no-output') })), fallbackTail.map((line, index) => (_jsxs(Text, { wrap: "wrap", dimColor: line.kind === 'thinking' || line.kind === 'system', italic: line.kind === 'thinking', color: line.kind === 'error' ? 'error' : undefined, children: [line.text, !line.settled && isRunning ? ' ▍' : ''] }, `tail-${index}`))), messages.map(message => (_jsx(AgentMessageLeafRow, { message: message, selfAgentId: agentId, marginTopOnTurn: true }, `am-${message.messageId}`)))] })) : (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `${hasHistory ? t('agent-view-history') : t('agent-view-live')} · ${t('agent-view-readonly')}` }), transcript.status === 'ready' && transcript.parentAgentId !== null && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-parent', { id: transcript.parentAgentId.slice(0, 8) }) })), transcript.status === 'ready' && transcript.parentAgentId === null && (subagent.depth ?? 1) >= 2 && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-old-format', { depth: subagent.depth ?? 2 }) })), transcript.status === 'loading' && _jsx(Text, { dimColor: true, children: `⏳ ${t('subagent-transcript-loading')}` }), transcript.status === 'unavailable' && _jsx(Text, { color: "error", children: t('subagent-transcript-unavailable') }), transcript.status === 'ready' && (() => {
|
|
212
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: "accent", bold: true, children: "\u2922" }) }), _jsx(Box, { flexShrink: 1, minWidth: 0, children: _jsx(Text, { bold: true, wrap: "truncate-end", children: headerLabel }) }), subagent.name !== undefined && subagent.name !== '' && (_jsx(Box, { flexShrink: 1, minWidth: 0, overflow: "hidden", children: _jsx(Text, { color: "accent", wrap: "truncate-end", children: subagent.name }) })), _jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: headerBadges }) }), _jsx(Box, { flexGrow: 1 }), _jsx(Box, { flexShrink: 0, children: _jsx(ExitButton, { onClick: onExit }) })] }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: `${t('agent-view-title')} · ${sourceLabel(source)} · ${t('agent-view-back')}: Esc${headerWidth < 44 ? '' : ` · ↑/↓ ${t('subagent-hint-scroll')} · o ${t('subagent-transcript-load-older', { count: TRANSCRIPT_OLDER_CHUNK })}`}` }), _jsxs(Box, { flexDirection: "row", paddingX: 1, maxHeight: Math.max(10, rows - (compose !== undefined ? 12 : 6)), children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, minWidth: panelEnabled ? 44 : 0, children: _jsx(ScrollBox, { ref: scrollRef, flexDirection: "column", flexGrow: 1, children: loadTranscript === undefined ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t('agent-view-no-transcript') }), retained && (_jsx(Text, { dimColor: true, children: t('agent-view-retained-tail', { count: fallbackTail.length }) })), fallbackTail.length === 0 && messages.length === 0 && (_jsx(Text, { dimColor: true, children: t('subagent-no-output') })), fallbackTail.map((line, index) => (_jsxs(Text, { wrap: "wrap", dimColor: line.kind === 'thinking' || line.kind === 'system', italic: line.kind === 'thinking', color: line.kind === 'error' ? 'error' : undefined, children: [line.text, !line.settled && isRunning ? ' ▍' : ''] }, `tail-${index}`))), messages.map(message => (_jsx(AgentMessageLeafRow, { message: message, selfAgentId: agentId, marginTopOnTurn: true }, `am-${message.messageId}`)))] })) : (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `${hasHistory ? t('agent-view-history') : t('agent-view-live')} · ${t('agent-view-readonly')}` }), transcript.status === 'ready' && transcript.parentAgentId !== null && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-parent', { id: transcript.parentAgentId.slice(0, 8) }) })), transcript.status === 'ready' && transcript.parentAgentId === null && (subagent.depth ?? 1) >= 2 && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-old-format', { depth: subagent.depth ?? 2 }) })), transcript.status === 'loading' && _jsx(Text, { dimColor: true, children: `⏳ ${t('subagent-transcript-loading')}` }), transcript.status === 'unavailable' && _jsx(Text, { color: "error", children: t('subagent-transcript-unavailable') }), transcript.status === 'ready' && (() => {
|
|
213
213
|
const merged = mergeLiveWindow(transcript.leaves, subagent, true);
|
|
214
214
|
const liveStart = merged.findIndex(row => row.kind === 'live');
|
|
215
215
|
if (merged.length === 0)
|
|
@@ -112,9 +112,10 @@ export declare function Chat({ channel, questionStore, approvalStore, extensionD
|
|
|
112
112
|
*/
|
|
113
113
|
onPluginManage?: (args: string, sink: PluginManageSink) => PluginManageFlow | undefined;
|
|
114
114
|
/**
|
|
115
|
-
* `/team [status]`, wired to `createTeamCommandEntry`: a
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* `/team [status|on|off]`, wired to `createTeamCommandEntry`: on a selection
|
|
116
|
+
* host it writes the saved per-root switch; on a bundle host it reports and
|
|
117
|
+
* points at `/plugin enable|disable`, or at the enable route when the team
|
|
118
|
+
* service is not mounted. `undefined` on a backend without it.
|
|
118
119
|
*/
|
|
119
120
|
onTeamCommand?: (args: string, sink: TeamCommandSink) => Promise<readonly string[]>;
|
|
120
121
|
/** 启动参数(Config 行 / DSH_TUI_BACKEND)压过了记忆:选择器明说。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRo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