@deepseek-harness-tui/dsh-tui 0.17.0 → 0.18.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 +10 -8
- package/cli/adapters/dsh/index.mjs +2 -2
- package/guide/dsh-tui-guide/cli.en.md +1 -1
- package/guide/dsh-tui-guide/cli.md +1 -1
- package/guide/dsh-tui-guide/configuration.en.md +3 -2
- package/guide/dsh-tui-guide/configuration.md +3 -2
- package/guide/dsh-tui-guide/getting-started.en.md +6 -2
- package/guide/dsh-tui-guide/getting-started.md +4 -1
- package/guide/dsh-tui-guide/interaction.en.md +28 -7
- package/guide/dsh-tui-guide/interaction.md +17 -5
- package/guide/dsh-tui-guide/plugins.en.md +28 -7
- package/guide/dsh-tui-guide/plugins.md +18 -5
- package/guide/dsh-tui-guide/user-guide.en.md +29 -15
- package/guide/dsh-tui-guide/user-guide.md +20 -10
- package/lib/settings.json +3 -3
- package/lib/types/adapter/channel/ui-policy.d.ts +1 -0
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +1 -0
- package/lib/types/adapter/ports/channel-ui.d.ts +5 -0
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +3 -0
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.d.ts +60 -0
- package/lib/types/adapter/standard/grants.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.js +74 -0
- package/lib/types/agent/events.d.ts +7 -1
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/commands.js +1 -1
- package/lib/types/components/GoalTodoPanel.d.ts +71 -6
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +165 -17
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +3 -2
- package/lib/types/components/PluginGrantList.d.ts +45 -0
- package/lib/types/components/PluginGrantList.d.ts.map +1 -0
- package/lib/types/components/PluginGrantList.js +126 -0
- package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
- package/lib/types/components/PluginInstallPane.js +35 -6
- package/lib/types/components/PluginManagePane.d.ts.map +1 -1
- package/lib/types/components/PluginManagePane.js +65 -8
- package/lib/types/components/PromptInput.js +2 -2
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +10 -0
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +12 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +11 -5
- package/lib/types/components/onboardingModel.d.ts +2 -2
- package/lib/types/components/onboardingModel.js +3 -3
- package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
- package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
- package/lib/types/components/onboardingProviderPlan.js +78 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +8 -1
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
- package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
- package/lib/types/components/sidePanel/builtinPanels.js +14 -2
- package/lib/types/components/sidePanel/types.d.ts +2 -0
- package/lib/types/components/sidePanel/types.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.js +15 -1
- package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +62 -6
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +9 -5
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +2 -0
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +10 -2
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +22 -7
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +6 -0
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +35 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +5 -0
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +30 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +8 -4
- package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/mentions.js +21 -7
- package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +11 -9
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +3 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +10 -3
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +3 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +3 -1
- package/lib/types/dsh-adapter/contract.d.ts +4 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +6 -3
- package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
- package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +3 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +4 -0
- package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
- package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grant-file.js +178 -0
- package/lib/types/dsh-adapter/host-access.d.ts +4 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +54 -4
- 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.js +3 -3
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +8 -5
- package/lib/types/dsh-adapter/panels.d.ts +7 -1
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
- package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-install.js +160 -13
- package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +240 -51
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +64 -18
- package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugins-info.js +34 -21
- package/lib/types/dsh-adapter/presets.d.ts +6 -2
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +23 -5
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +11 -5
- package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
- package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
- package/lib/types/dsh-adapter/row-attachment.js +29 -0
- package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
- package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
- package/lib/types/dsh-adapter/worktree-tool.js +87 -0
- package/lib/types/heldInputs.d.ts +36 -0
- package/lib/types/heldInputs.d.ts.map +1 -0
- package/lib/types/heldInputs.js +173 -0
- package/lib/types/i18n.d.ts +352 -25
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +171 -18
- package/lib/types/onboardingDraft.d.ts +143 -0
- package/lib/types/onboardingDraft.d.ts.map +1 -0
- package/lib/types/onboardingDraft.js +71 -0
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +90 -30
- package/lib/types/screens/Onboarding.d.ts +22 -3
- package/lib/types/screens/Onboarding.d.ts.map +1 -1
- package/lib/types/screens/Onboarding.js +606 -36
- package/lib/types/settings/definitions.js +2 -2
- package/lib/types/utils/paths.d.ts +15 -0
- package/lib/types/utils/paths.d.ts.map +1 -1
- package/lib/types/utils/paths.js +25 -0
- package/package.json +111 -108
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/restart` carry-over of the composer queue (#1651): the queued and held
|
|
3
|
+
* texts the old process still showed are written to a per-restart file whose
|
|
4
|
+
* path rides the replacement's env, and the replacement parks them as held
|
|
5
|
+
* dock rows. The backend copies die with the old process (the kernel records
|
|
6
|
+
* them as canceled), so nothing re-sends them until the user sends the dock.
|
|
7
|
+
* Text only: staged images live in the old process's memory.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { randomBytes } from 'node:crypto';
|
|
11
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
12
|
+
import { DATA_DIR } from './utils/paths.js';
|
|
13
|
+
/** env marker naming the file the replacement takes its held texts from. */
|
|
14
|
+
export const HELD_INPUTS_ENV = 'DSH_TUI_HELD_INPUTS';
|
|
15
|
+
const HELD_INPUTS_FILE = /^held-inputs-\d+-[0-9a-f]{12}\.json$/u;
|
|
16
|
+
/** A restart that stalled leaves its file for the printed resume command; one
|
|
17
|
+
* nobody resumed within this long is swept at a later launch. */
|
|
18
|
+
const HELD_INPUTS_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Write the texts for a replacement process to take.
|
|
21
|
+
* @returns The env marker to hand the replacement, or undefined when there
|
|
22
|
+
* is nothing to carry or the write failed (best effort: a restart never
|
|
23
|
+
* waits on it).
|
|
24
|
+
*/
|
|
25
|
+
export function writeHeldInputs(texts, dir = DATA_DIR, pid = process.pid) {
|
|
26
|
+
const kept = texts.filter(text => text.trim() !== '');
|
|
27
|
+
if (kept.length === 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
// Unique per restart: a stalled restart's file stays for its printed
|
|
30
|
+
// resume command, and a later process reusing the pid must not replace it.
|
|
31
|
+
const file = join(dir, `held-inputs-${pid}-${randomBytes(6).toString('hex')}.json`);
|
|
32
|
+
try {
|
|
33
|
+
mkdirSync(dir, { recursive: true });
|
|
34
|
+
// The user's own prompt text: readable by them alone.
|
|
35
|
+
writeFileSync(file, JSON.stringify({ texts: kept }), { mode: 0o600, flag: 'wx' });
|
|
36
|
+
return { [HELD_INPUTS_ENV]: file };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The one handoff this process has not settled yet. The DSH launcher's boot
|
|
44
|
+
* recompose applies the entry a second time, after the first pass consumed
|
|
45
|
+
* the env marker; that pass must still find the texts.
|
|
46
|
+
*/
|
|
47
|
+
let waiting;
|
|
48
|
+
/** Read the marker once per handoff; without a fresh one, hand back the
|
|
49
|
+
* pending handoff (the recompose asking again). */
|
|
50
|
+
function carriedInputs(env, dir) {
|
|
51
|
+
if (env[HELD_INPUTS_ENV] !== undefined)
|
|
52
|
+
waiting = readHeldInputs(env, dir);
|
|
53
|
+
return waiting ?? { texts: [] };
|
|
54
|
+
}
|
|
55
|
+
/** Best effort: a file another process still holds open must not decide
|
|
56
|
+
* whether this one starts. */
|
|
57
|
+
function removeHeldFile(file) {
|
|
58
|
+
try {
|
|
59
|
+
rmSync(file, { force: true });
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The replacement's side: park the texts a `/restart` handed this process as
|
|
66
|
+
* held rows once the screen's channel is ready (never sent by themselves).
|
|
67
|
+
* A pass that cannot reach a ready channel leaves the handoff pending for the
|
|
68
|
+
* next `apply()` instead of dropping it.
|
|
69
|
+
* @returns What stops waiting for a channel that is not ready yet.
|
|
70
|
+
*/
|
|
71
|
+
export function adoptHeldInputs(channel, env = process.env, dir = DATA_DIR) {
|
|
72
|
+
const inputs = carriedInputs(env, dir);
|
|
73
|
+
const { texts, file } = inputs;
|
|
74
|
+
// The file goes only once its texts are on screen: a replacement that
|
|
75
|
+
// dies before its channel is ready leaves it for the resume command its
|
|
76
|
+
// parent prints. Then files nobody resumed are swept.
|
|
77
|
+
const settle = () => {
|
|
78
|
+
if (file !== undefined)
|
|
79
|
+
removeHeldFile(file);
|
|
80
|
+
waiting = undefined;
|
|
81
|
+
sweepHeldInputs(dir);
|
|
82
|
+
};
|
|
83
|
+
if (texts.length === 0) {
|
|
84
|
+
settle();
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
if (channel.ready) {
|
|
88
|
+
channel.holdInputs(texts);
|
|
89
|
+
settle();
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const unsubscribe = channel.subscribe(() => {
|
|
93
|
+
if (!channel.ready)
|
|
94
|
+
return;
|
|
95
|
+
unsubscribe();
|
|
96
|
+
// A later apply may have taken the handoff first (the recompose); the
|
|
97
|
+
// same texts must never be parked twice.
|
|
98
|
+
if (waiting !== inputs)
|
|
99
|
+
return;
|
|
100
|
+
channel.holdInputs(texts);
|
|
101
|
+
settle();
|
|
102
|
+
});
|
|
103
|
+
return unsubscribe;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The resume command after a restart that ended before any replacement took
|
|
107
|
+
* the held texts (a stall, a failed spawn): their file stays, and the command
|
|
108
|
+
* hands it to the next launch. Windows has no shared env-assignment syntax:
|
|
109
|
+
* PowerShell and cmd.exe each get their own copy-pasteable line.
|
|
110
|
+
*/
|
|
111
|
+
export function heldInputsResumeCommand(command, env, platform = process.platform) {
|
|
112
|
+
const file = env?.[HELD_INPUTS_ENV];
|
|
113
|
+
if (file === undefined || !existsSync(file))
|
|
114
|
+
return command;
|
|
115
|
+
if (platform === 'win32') {
|
|
116
|
+
// This line is the only way a stalled restart gets its texts back, and the
|
|
117
|
+
// two Windows shells disagree on how to set a variable: print both.
|
|
118
|
+
return `$env:${HELD_INPUTS_ENV}='${file.replaceAll('\'', '\'\'')}'; ${command}\nset "${HELD_INPUTS_ENV}=${file}" && ${command}`;
|
|
119
|
+
}
|
|
120
|
+
return `${HELD_INPUTS_ENV}='${file.replaceAll('\'', '\'\\\'\'')}' ${command}`;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Take (read and delete) the texts a `/restart` handed this process. One
|
|
124
|
+
* shot: the env marker is consumed too, so no child inherits it.
|
|
125
|
+
*/
|
|
126
|
+
export function takeHeldInputs(env = process.env, dir = DATA_DIR) {
|
|
127
|
+
const marked = env[HELD_INPUTS_ENV] !== undefined;
|
|
128
|
+
const { texts, file } = readHeldInputs(env, dir);
|
|
129
|
+
if (file !== undefined)
|
|
130
|
+
removeHeldFile(file);
|
|
131
|
+
if (marked)
|
|
132
|
+
waiting = undefined;
|
|
133
|
+
return texts;
|
|
134
|
+
}
|
|
135
|
+
/** Read the texts and consume the env marker; `file` is what the caller
|
|
136
|
+
* deletes once it is done with them. */
|
|
137
|
+
function readHeldInputs(env, dir) {
|
|
138
|
+
const file = env[HELD_INPUTS_ENV];
|
|
139
|
+
delete env[HELD_INPUTS_ENV];
|
|
140
|
+
// Only ever a file writeHeldInputs named, in the directory it writes to:
|
|
141
|
+
// the marker is env input, and the caller deletes what it names.
|
|
142
|
+
if (file === undefined || !HELD_INPUTS_FILE.test(basename(file)) || dirname(resolve(file)) !== resolve(dir))
|
|
143
|
+
return { texts: [] };
|
|
144
|
+
try {
|
|
145
|
+
const parsed = JSON.parse(readFileSync(file, 'utf8'));
|
|
146
|
+
const texts = parsed !== null && typeof parsed === 'object' ? parsed.texts : undefined;
|
|
147
|
+
return { texts: Array.isArray(texts) ? texts.filter((text) => typeof text === 'string' && text.trim() !== '') : [], file };
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return { texts: [], file };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** Remove held-input files older than the resume window (best effort). */
|
|
154
|
+
export function sweepHeldInputs(dir = DATA_DIR, now = Date.now()) {
|
|
155
|
+
let names;
|
|
156
|
+
try {
|
|
157
|
+
names = readdirSync(dir);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
for (const name of names) {
|
|
163
|
+
if (!HELD_INPUTS_FILE.test(name))
|
|
164
|
+
continue;
|
|
165
|
+
const file = join(dir, name);
|
|
166
|
+
try {
|
|
167
|
+
if (now - statSync(file).mtimeMs > HELD_INPUTS_MAX_AGE_MS)
|
|
168
|
+
rmSync(file, { force: true });
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|