@linxin666/dsh-client-ui-task-board-ssh 0.0.0-stage → 0.4.20
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/LICENSE +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +85 -2
- package/README.zh.md +86 -0
- package/cordis.patch.yml +15 -0
- package/icon.svg +5 -0
- package/lib/client.js +4429 -0
- package/lib/index.js +6100 -0
- package/lib/types/client/PluginSettingsCard.d.ts +255 -0
- package/lib/types/client/RangeBubble.d.ts +46 -0
- package/lib/types/client/SegmentGroup.d.ts +28 -0
- package/lib/types/client/index.d.ts +100 -0
- package/lib/types/client/locales.d.ts +125 -0
- package/lib/types/client/seat-props.d.ts +53 -0
- package/lib/types/client/settings-entry-form.d.ts +49 -0
- package/lib/types/client/settings-form.d.ts +237 -0
- package/lib/types/client/ssh/card-decoration.d.ts +23 -0
- package/lib/types/client/ssh/compose-section.d.ts +7 -0
- package/lib/types/client/ssh/detail-section.d.ts +7 -0
- package/lib/types/client/ssh/extension.d.ts +54 -0
- package/lib/types/client/ssh/log-buffer.d.ts +128 -0
- package/lib/types/client/ssh/log-view.d.ts +37 -0
- package/lib/types/client/ssh/model.d.ts +130 -0
- package/lib/types/client/ssh/settings-section.d.ts +134 -0
- package/lib/types/client/ssh/summary.d.ts +160 -0
- package/lib/types/client/ssh/target-form.d.ts +60 -0
- package/lib/types/core/action.d.ts +89 -0
- package/lib/types/core/adapters/claude.d.ts +15 -0
- package/lib/types/core/adapters/codex.d.ts +15 -0
- package/lib/types/core/adapters/custom.d.ts +29 -0
- package/lib/types/core/adapters/dsh.d.ts +21 -0
- package/lib/types/core/adapters/index.d.ts +25 -0
- package/lib/types/core/adapters/types.d.ts +76 -0
- package/lib/types/core/contract.d.ts +445 -0
- package/lib/types/core/launcher-script.d.ts +13 -0
- package/lib/types/core/launcher.d.ts +153 -0
- package/lib/types/core/ledger.d.ts +123 -0
- package/lib/types/core/shell.d.ts +61 -0
- package/lib/types/core/target.d.ts +143 -0
- package/lib/types/core/task-record.d.ts +63 -0
- package/lib/types/core/workspace.d.ts +74 -0
- package/lib/types/host/board.d.ts +71 -0
- package/lib/types/host/engine.d.ts +418 -0
- package/lib/types/host/extension.d.ts +59 -0
- package/lib/types/host/logs.d.ts +135 -0
- package/lib/types/host/payload.d.ts +75 -0
- package/lib/types/host/prompt.d.ts +44 -0
- package/lib/types/host/queue.d.ts +53 -0
- package/lib/types/host/remote.d.ts +120 -0
- package/lib/types/host/settings.d.ts +149 -0
- package/lib/types/host/timers.d.ts +20 -0
- package/lib/types/host/tools.d.ts +15 -0
- package/lib/types/host/workspace/errors.d.ts +29 -0
- package/lib/types/host/workspace/git.d.ts +108 -0
- package/lib/types/host/workspace/in-place.d.ts +36 -0
- package/lib/types/host/workspace/index.d.ts +28 -0
- package/lib/types/host/workspace/layout.d.ts +62 -0
- package/lib/types/host/workspace/local-git.d.ts +72 -0
- package/lib/types/host/workspace/remote-git.d.ts +111 -0
- package/lib/types/host/workspace/remote.d.ts +85 -0
- package/lib/types/host/workspace/types.d.ts +28 -0
- package/lib/types/host/workspace-seam.d.ts +100 -0
- package/lib/types/index.d.ts +97 -0
- package/lib/types/mount-once.d.ts +55 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +89 -3
- package/src/client/PluginSettingsCard.tsx +838 -0
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +195 -0
- package/src/client/locales.ts +257 -0
- package/src/client/seat-props.ts +58 -0
- package/src/client/settings-card.module.css +821 -0
- package/src/client/settings-entry-form.ts +141 -0
- package/src/client/settings-form.ts +529 -0
- package/src/client/ssh/card-decoration.tsx +55 -0
- package/src/client/ssh/compose-section.tsx +147 -0
- package/src/client/ssh/detail-section.tsx +345 -0
- package/src/client/ssh/extension.ts +271 -0
- package/src/client/ssh/log-buffer.ts +224 -0
- package/src/client/ssh/log-view.tsx +149 -0
- package/src/client/ssh/model.ts +299 -0
- package/src/client/ssh/settings-section.tsx +401 -0
- package/src/client/ssh/summary.ts +388 -0
- package/src/client/ssh/target-form.tsx +380 -0
- package/src/client/ssh.module.css +617 -0
- package/src/core/action.ts +270 -0
- package/src/core/adapters/claude.ts +64 -0
- package/src/core/adapters/codex.ts +83 -0
- package/src/core/adapters/custom.ts +88 -0
- package/src/core/adapters/dsh.ts +87 -0
- package/src/core/adapters/index.ts +74 -0
- package/src/core/adapters/types.ts +95 -0
- package/src/core/contract.ts +510 -0
- package/src/core/launcher-script.ts +313 -0
- package/src/core/launcher.ts +283 -0
- package/src/core/ledger.ts +372 -0
- package/src/core/shell.ts +77 -0
- package/src/core/target.ts +413 -0
- package/src/core/task-record.ts +65 -0
- package/src/core/workspace.ts +78 -0
- package/src/host/board.ts +103 -0
- package/src/host/engine.ts +1602 -0
- package/src/host/extension.ts +304 -0
- package/src/host/logs.ts +297 -0
- package/src/host/payload.ts +134 -0
- package/src/host/prompt.ts +89 -0
- package/src/host/queue.ts +73 -0
- package/src/host/remote.ts +328 -0
- package/src/host/settings.ts +294 -0
- package/src/host/timers.ts +33 -0
- package/src/host/tools.ts +259 -0
- package/src/host/workspace/errors.ts +43 -0
- package/src/host/workspace/git.ts +305 -0
- package/src/host/workspace/in-place.ts +58 -0
- package/src/host/workspace/index.ts +37 -0
- package/src/host/workspace/layout.ts +122 -0
- package/src/host/workspace/local-git.ts +164 -0
- package/src/host/workspace/remote-git.ts +244 -0
- package/src/host/workspace/remote.ts +181 -0
- package/src/host/workspace/types.ts +34 -0
- package/src/host/workspace-seam.ts +132 -0
- package/src/index.ts +243 -0
- package/src/mount-once.ts +142 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form model behind the plugin settings card. Every control applies itself:
|
|
3
|
+
* a pick (a segment, a select option, a reset) writes the moment it is made,
|
|
4
|
+
* and typed text writes once typing pauses or the reader leaves the field.
|
|
5
|
+
* Between the edit and the write the edit is held here as a draft, so what is
|
|
6
|
+
* on screen is exactly what the write will store; a write the Host refuses
|
|
7
|
+
* puts a pick back to the stored value and keeps typed text for correcting.
|
|
8
|
+
* Family-shared slice inlined into each plugin's client bundle.
|
|
9
|
+
*/
|
|
10
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
11
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
12
|
+
/** The write one field's draft text performs when it is applied. */
|
|
13
|
+
export type FieldWrite = {
|
|
14
|
+
kind: 'set';
|
|
15
|
+
value: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'clear';
|
|
18
|
+
};
|
|
19
|
+
/** How one field converts between its stored value and its draft text. */
|
|
20
|
+
export interface FieldSpec {
|
|
21
|
+
/** Field name inside the namespace section. */
|
|
22
|
+
field: string;
|
|
23
|
+
/**
|
|
24
|
+
* How the reader enters a value, which decides when it is written: a `pick`
|
|
25
|
+
* is a whole value at once and applies immediately; `type` is text arriving
|
|
26
|
+
* a keystroke at a time and applies once typing pauses or the field is left.
|
|
27
|
+
*/
|
|
28
|
+
entry: 'pick' | 'type';
|
|
29
|
+
/**
|
|
30
|
+
* Whether the Host treats this field as a secret and redacts its value from
|
|
31
|
+
* the read-back (role('secret') in the section schema). Redacted secrets are
|
|
32
|
+
* never compared against the draft on save: the Host strips them from every
|
|
33
|
+
* wire view layer, so the settled snapshot carries nothing to read back. A
|
|
34
|
+
* staged secret set is judged by the mutation settling; the rest of its
|
|
35
|
+
* batch, when one exists, is still judged by read-back, and the atomic
|
|
36
|
+
* mutation lands every write or none.
|
|
37
|
+
*/
|
|
38
|
+
secret?: boolean;
|
|
39
|
+
/** Render a stored value as draft text; the empty string when the section carries none. */
|
|
40
|
+
format: (value: unknown) => string;
|
|
41
|
+
/**
|
|
42
|
+
* The write this draft text performs, or undefined when the text is not a
|
|
43
|
+
* value this field accepts — which holds the draft unwritten rather than
|
|
44
|
+
* discarding it.
|
|
45
|
+
*/
|
|
46
|
+
parse: (text: string) => FieldWrite | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** One field as the card renders it. */
|
|
49
|
+
export interface FieldState {
|
|
50
|
+
/** Draft text the control renders. */
|
|
51
|
+
text: string;
|
|
52
|
+
/** Whether the field leaves (or will leave) a user-layer entry. */
|
|
53
|
+
overridden: boolean;
|
|
54
|
+
/** Whether the draft is not a value this field accepts, which holds it unwritten. */
|
|
55
|
+
invalid: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** Form state every plugin settings card shares. */
|
|
58
|
+
export interface CardShell {
|
|
59
|
+
/** False while the namespace is still loading; the card renders nothing. */
|
|
60
|
+
available: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the namespace is actually served to this client. False when the
|
|
63
|
+
* Host deployment does not expose it (e.g. the owning plugin's settings
|
|
64
|
+
* domain is not mounted): the card renders an explanation
|
|
65
|
+
* instead of its form, so a missing namespace never looks like a missing
|
|
66
|
+
* plugin.
|
|
67
|
+
*/
|
|
68
|
+
exposed: boolean;
|
|
69
|
+
/** Whether the Host document accepts writes. */
|
|
70
|
+
writable: boolean;
|
|
71
|
+
/** Whether the form holds drafts not yet written (typed text waiting for its pause). */
|
|
72
|
+
dirty: boolean;
|
|
73
|
+
/** Whether any draft is invalid, which holds it unwritten. */
|
|
74
|
+
invalid: boolean;
|
|
75
|
+
/** Whether a write is crossing the wire. */
|
|
76
|
+
saving: boolean;
|
|
77
|
+
/** Whether the last write did not land; cleared by the next edit or write. */
|
|
78
|
+
failed: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The rejection code/message the Host returned for the last failed save,
|
|
81
|
+
* surfaced next to the generic failure text. Undefined while no save has
|
|
82
|
+
* failed (or the failure carried no server reason).
|
|
83
|
+
*/
|
|
84
|
+
failedReason?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The write actions the card's slot entry injects. */
|
|
87
|
+
export interface CardActions {
|
|
88
|
+
/** Take draft text for one field; a pick writes at once, typed text after a pause. */
|
|
89
|
+
edit: (field: string, text: string) => void;
|
|
90
|
+
/** Clear one field at once, so it re-inherits the composition layer. */
|
|
91
|
+
resetField: (field: string) => void;
|
|
92
|
+
/** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
|
|
93
|
+
save: () => void;
|
|
94
|
+
/** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
|
|
95
|
+
discard: () => void;
|
|
96
|
+
}
|
|
97
|
+
/** How long typed text rests before it is written. */
|
|
98
|
+
export declare const TYPE_PAUSE_MS = 600;
|
|
99
|
+
/** One durable write inside the save's atomic form mutation. */
|
|
100
|
+
export interface BatchedWrite {
|
|
101
|
+
/** Field this entry writes. */
|
|
102
|
+
field: string;
|
|
103
|
+
/** set stores a value; unset drops the leaf. */
|
|
104
|
+
op: 'set' | 'unset';
|
|
105
|
+
/** Value for op set (absent for unset). */
|
|
106
|
+
value?: unknown;
|
|
107
|
+
}
|
|
108
|
+
/** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */
|
|
109
|
+
export interface NumberConstraints {
|
|
110
|
+
/** The accepted value must be a whole number. */
|
|
111
|
+
integer?: boolean;
|
|
112
|
+
/** The accepted value must be at least this. */
|
|
113
|
+
min?: number;
|
|
114
|
+
/** The accepted value must be at most this. */
|
|
115
|
+
max?: number;
|
|
116
|
+
}
|
|
117
|
+
/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
|
|
118
|
+
export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
|
|
119
|
+
/**
|
|
120
|
+
* A free-text field. An empty draft clears the field. `entry` is `pick` when
|
|
121
|
+
* the text arrives whole from a picker (a preset or a reasoning level).
|
|
122
|
+
*/
|
|
123
|
+
export declare function textField(field: string, entry?: FieldSpec['entry']): FieldSpec;
|
|
124
|
+
/**
|
|
125
|
+
* A free-text field the Host treats as a secret and redacts from the read-back
|
|
126
|
+
* (role('secret') in the section schema). The card still edits it like text,
|
|
127
|
+
* but a save never compares the redacted value back: the staged set is judged
|
|
128
|
+
* by the mutation settling (see {@link FieldSpec.secret}).
|
|
129
|
+
*/
|
|
130
|
+
export declare function secretField(field: string): FieldSpec;
|
|
131
|
+
/** A boolean field, edited through true/false draft text. */
|
|
132
|
+
export declare function booleanField(field: string): FieldSpec;
|
|
133
|
+
/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
|
|
134
|
+
export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
|
|
135
|
+
/**
|
|
136
|
+
* Applies one card's edits to one settings namespace as the reader makes them.
|
|
137
|
+
*
|
|
138
|
+
* The Host is the only authority on whether a value was accepted — its
|
|
139
|
+
* validators own the constraints no schema can express — so the outcome is
|
|
140
|
+
* read back from the section rather than predicted here. A write that did not
|
|
141
|
+
* land puts each pick back to the stored value, the way a switch that could not
|
|
142
|
+
* flip springs back, and keeps typed text so the reader can correct it instead
|
|
143
|
+
* of retyping.
|
|
144
|
+
*/
|
|
145
|
+
export declare class CardForm<T> {
|
|
146
|
+
private readonly scope;
|
|
147
|
+
private readonly specs;
|
|
148
|
+
private readonly staged;
|
|
149
|
+
private readonly listeners;
|
|
150
|
+
/** The form subscription installed in the constructor; released by dispose(). */
|
|
151
|
+
private readonly disposeForm;
|
|
152
|
+
private disposed;
|
|
153
|
+
/** The pending write of typed text, waiting for typing to pause. */
|
|
154
|
+
private typePause;
|
|
155
|
+
private saving;
|
|
156
|
+
/** A save asked for while one was in flight; it runs once the first settles (#1754). */
|
|
157
|
+
private saveQueued;
|
|
158
|
+
private failed;
|
|
159
|
+
private failedReason;
|
|
160
|
+
/** @param scope - the bound configuration form for this card's namespace. */
|
|
161
|
+
constructor(scope: ConfigForm<T>, specs: FieldSpec[]);
|
|
162
|
+
/**
|
|
163
|
+
* Release the form subscription and every bound store listener. The card
|
|
164
|
+
* must call this on teardown; later calls are no-ops.
|
|
165
|
+
*/
|
|
166
|
+
dispose(): void;
|
|
167
|
+
/** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
|
|
168
|
+
bind<S>(project: () => S): SnapshotStore<S>;
|
|
169
|
+
/** Read the card-level state: what the Host serves, and what is still waiting to be written. */
|
|
170
|
+
shell(): CardShell;
|
|
171
|
+
/** Read one field's state from the effective section and its staged draft. */
|
|
172
|
+
field(field: string): FieldState;
|
|
173
|
+
/** The actions the card's slot registration injects. */
|
|
174
|
+
actions(): CardActions;
|
|
175
|
+
/**
|
|
176
|
+
* Run one write, and re-run it once if another was asked for while this one
|
|
177
|
+
* was still in flight.
|
|
178
|
+
*
|
|
179
|
+
* A write is a Host round trip that also drives the profile reconcile, and
|
|
180
|
+
* the Host runs it inside one exclusive transaction. Answering an edit that
|
|
181
|
+
* arrives mid-flight by returning immediately dropped it with no explanation
|
|
182
|
+
* (#1754). Serializing instead means an edit made while another write is
|
|
183
|
+
* still settling is written against the settled state.
|
|
184
|
+
* @returns settlement after the mutation and the read-back.
|
|
185
|
+
*/
|
|
186
|
+
requestSave(): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Write every valid draft in one atomic form mutation, then re-seed from
|
|
189
|
+
* what the Host accepted. A draft the field does not accept stays on screen,
|
|
190
|
+
* unwritten, without holding the others back.
|
|
191
|
+
*
|
|
192
|
+
* The batch rides one mutate, so cross-field validate hooks (baseURL+model)
|
|
193
|
+
* judge it as a unit: the Host either applies every write or refuses the
|
|
194
|
+
* batch. The form contract answers a refusal or a skipped write with `false`
|
|
195
|
+
* (it recovers with a fresh Host view instead of throwing), so the outcome is
|
|
196
|
+
* judged twice: the answer itself, and then the settled snapshot read back
|
|
197
|
+
* one planned write at a time. One missed write fails the whole batch. A
|
|
198
|
+
* transport that rejects instead (the dsh-web bridge controller on a dead
|
|
199
|
+
* connection) reports through the same failure path with its rejection
|
|
200
|
+
* message. A batch that did not land puts its picks and clears back to the
|
|
201
|
+
* stored value and keeps its typed text, so the reader can correct it.
|
|
202
|
+
* @returns settlement after the mutation and the read-back.
|
|
203
|
+
*/
|
|
204
|
+
save(): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Every staged edit a write would carry. An entry whose draft is not a value
|
|
207
|
+
* its field accepts carries no write: the form is still dirty, and the draft
|
|
208
|
+
* stays on screen rather than being dropped. A staged edit that matches the
|
|
209
|
+
* effective section is not a write at all.
|
|
210
|
+
* @returns the planned writes, in the order the fields were staged.
|
|
211
|
+
*/
|
|
212
|
+
private plan;
|
|
213
|
+
/**
|
|
214
|
+
* Read-back judgment for a planned set: the user layer must hold the
|
|
215
|
+
* intended value once the mutation has settled.
|
|
216
|
+
*/
|
|
217
|
+
private landedSet;
|
|
218
|
+
/**
|
|
219
|
+
* Read-back judgment for a planned unset: the field must be gone from the
|
|
220
|
+
* user layer once the mutation has settled.
|
|
221
|
+
*/
|
|
222
|
+
private landedUnset;
|
|
223
|
+
/**
|
|
224
|
+
* Take one edit and schedule its write: a pick or a clear is written now,
|
|
225
|
+
* typed text once typing has rested for TYPE_PAUSE_MS.
|
|
226
|
+
*/
|
|
227
|
+
private stage;
|
|
228
|
+
/** Write every pending draft now, taking the place of a waiting pause. */
|
|
229
|
+
private applyNow;
|
|
230
|
+
private specOf;
|
|
231
|
+
private snapshotOf;
|
|
232
|
+
private sectionValue;
|
|
233
|
+
private baseValue;
|
|
234
|
+
private userLayer;
|
|
235
|
+
private stored;
|
|
236
|
+
private publish;
|
|
237
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card-decoration seat: one chip that says where the card runs and how the
|
|
3
|
+
* run stands.
|
|
4
|
+
*
|
|
5
|
+
* It is a pure function of the card's ledger payload — no request, no timer, no
|
|
6
|
+
* subscription — because the board renders it on every card of every column on
|
|
7
|
+
* every mirror frame, and a provider's badge may not become the board's cost.
|
|
8
|
+
* An untargeted card renders nothing at all, so the chip always means "this card
|
|
9
|
+
* is pinned somewhere".
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-task-board-ssh/client/ssh/card-decoration
|
|
12
|
+
*/
|
|
13
|
+
import type { SshCardDecorationProps } from '../seat-props.ts';
|
|
14
|
+
import { type SshCardPhase } from './model.ts';
|
|
15
|
+
import { type TaskBoardSshKey } from '../locales.ts';
|
|
16
|
+
/** Copy key naming one phase; the detail section's pill reads the same table. */
|
|
17
|
+
export declare function phaseKey(phase: SshCardPhase): TaskBoardSshKey;
|
|
18
|
+
/**
|
|
19
|
+
* Render the card badge.
|
|
20
|
+
* @param props - the card being decorated.
|
|
21
|
+
* @returns the chip, or nothing when the card pins no target.
|
|
22
|
+
*/
|
|
23
|
+
export declare function SshCardDecoration({ task }: SshCardDecorationProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SshComposeSectionProps } from '../seat-props.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render the SSH provider's new-card seat.
|
|
4
|
+
* @param props - the board's draft channel, optional duplicate source and submit counter.
|
|
5
|
+
* @returns the picker while the host half is mounted, nothing otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SshComposeSection({ contribute, initialIntegrations, submitAttempt }: SshComposeSectionProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SshDetailSectionProps } from '../seat-props.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render the SSH provider's task-detail section.
|
|
4
|
+
* @param props - the card and the board's action channel.
|
|
5
|
+
* @returns the section in the shape the card's payload asks for.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SshDetailSection({ task, dispatch }: SshDetailSectionProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-half installer for the SSH provider.
|
|
3
|
+
*
|
|
4
|
+
* A provider's browser half registers its own contributions into the child seats
|
|
5
|
+
* the board declares; it resolves the board's client capability face from the
|
|
6
|
+
* shared service name and adds no HTTP surface of its own. Three switches
|
|
7
|
+
* compose here:
|
|
8
|
+
*
|
|
9
|
+
* - the BOARD's master switch collapses the seats (the board mirror reports it,
|
|
10
|
+
* so the seats are rebuilt when the board comes back);
|
|
11
|
+
* - this EXTENSION's own volatile switch hides the seats entirely, without a
|
|
12
|
+
* restart, because the installer follows the settings form the section edits;
|
|
13
|
+
* - the settings section itself follows neither: it is where that switch lives.
|
|
14
|
+
*
|
|
15
|
+
* The board's browser half publishes its `taskBoard` service inside its own
|
|
16
|
+
* apply, and the aggregate mounts its client children without ordering those
|
|
17
|
+
* applies, so the service is frequently NOT there yet when this installer runs.
|
|
18
|
+
* The seats therefore live behind a cordis dependency scope (`ctx.inject`)
|
|
19
|
+
* instead of a one-shot lookup: the scope mounts once the board serves the
|
|
20
|
+
* service and unloads — releasing every seat — when the board withdraws it.
|
|
21
|
+
*
|
|
22
|
+
* @module dsh-task-board-ssh/client/ssh/extension
|
|
23
|
+
*/
|
|
24
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
25
|
+
/** The live switch the installer follows; the settings section's form supplies it. */
|
|
26
|
+
export interface ExtensionEnabledSource {
|
|
27
|
+
/** Whether the extension is currently enabled (absent config means enabled). */
|
|
28
|
+
read(): boolean;
|
|
29
|
+
/** Observe switch changes; the returned disposer removes the listener. */
|
|
30
|
+
subscribe(listener: () => void): () => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The configuration section this extension contributes to the board's own
|
|
34
|
+
* settings card.
|
|
35
|
+
*
|
|
36
|
+
* The section is NOT gated by the extension's own switch: turning the extension
|
|
37
|
+
* off must not remove the control that turns it back on. It is gated by the
|
|
38
|
+
* board's service alone, because the board's settings card is the only surface
|
|
39
|
+
* that declares the seat it renders into.
|
|
40
|
+
*/
|
|
41
|
+
export interface SshSettingsSectionSeat {
|
|
42
|
+
/** Build the face the section renders with (its staged form and actions). */
|
|
43
|
+
inject(): unknown;
|
|
44
|
+
/** The section component itself. */
|
|
45
|
+
component: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Install the SSH provider's browser half.
|
|
49
|
+
* @param ctx - client context (slot registry).
|
|
50
|
+
* @param source - the extension's live enabled switch.
|
|
51
|
+
* @param settings - the section to contribute into the board's settings card.
|
|
52
|
+
* @returns disposer releasing every contribution.
|
|
53
|
+
*/
|
|
54
|
+
export declare function installSshClientHalf(ctx: ClientContext, source: ExtensionEnabledSource, settings?: SshSettingsSectionSeat): () => void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run log: byte-offset increments in, one bounded window of rows out.
|
|
3
|
+
*
|
|
4
|
+
* The provider publishes log INCREMENTS, not documents: each window carries
|
|
5
|
+
* `[baseOffset, endOffset)` and the bytes it read since the previous window. This
|
|
6
|
+
* module turns that stream into lines without ever re-walking text it has
|
|
7
|
+
* already seen — an append splits only the incoming chunk and the partial line
|
|
8
|
+
* it continues — and hands the renderer a fixed-height window of that line
|
|
9
|
+
* store, so a hundred thousand lines cost a hundred thousand short strings and
|
|
10
|
+
* a few dozen DOM rows instead of a hundred thousand nodes.
|
|
11
|
+
*
|
|
12
|
+
* Two rules keep the stream honest:
|
|
13
|
+
*
|
|
14
|
+
* - a window whose `endOffset` is not past what was consumed is a duplicate and
|
|
15
|
+
* changes nothing;
|
|
16
|
+
* - a window that does not continue at the consumed offset left bytes unseen
|
|
17
|
+
* (the provider restarted its read above zero), so the buffer keeps what it
|
|
18
|
+
* has, flags the gap, and appends after it. Nothing already shown is dropped;
|
|
19
|
+
* the notice under the log says earlier output is missing.
|
|
20
|
+
*
|
|
21
|
+
* Virtualization by fixed row height is the mechanism chosen here: log rows are
|
|
22
|
+
* monospace and never wrap, so a row's height is a constant and the window is
|
|
23
|
+
* arithmetic rather than measurement — no layout read on scroll, no observer,
|
|
24
|
+
* and a deterministic window the tests can state exactly.
|
|
25
|
+
*
|
|
26
|
+
* @module dsh-task-board-ssh/client/ssh/log-buffer
|
|
27
|
+
*/
|
|
28
|
+
/** One increment of a run's remote stdout, as the provider publishes it. */
|
|
29
|
+
export interface SshLogFrame {
|
|
30
|
+
/** Run the bytes belong to; a different run resets the buffer. */
|
|
31
|
+
runId?: string;
|
|
32
|
+
/** Byte offset of `text`'s first byte in the remote file. */
|
|
33
|
+
baseOffset: number;
|
|
34
|
+
/** Byte offset just past `text`'s last byte. */
|
|
35
|
+
endOffset: number;
|
|
36
|
+
/** The bytes themselves, verbatim. */
|
|
37
|
+
text: string;
|
|
38
|
+
/** Legacy flag: whether bytes before `baseOffset` were skipped (unless `hasMore` is set). */
|
|
39
|
+
truncated?: boolean;
|
|
40
|
+
/** Explicit flag from Host: more trailing bytes exist after `endOffset` (NOT missing earlier output). */
|
|
41
|
+
hasMore?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** What a renderer reads out of the buffer. */
|
|
44
|
+
export interface SshLogSnapshot {
|
|
45
|
+
/** Run the lines belong to, absent while the buffer is empty. */
|
|
46
|
+
runId?: string;
|
|
47
|
+
/** How many rows the buffer holds. */
|
|
48
|
+
count: number;
|
|
49
|
+
/** Whether bytes before the first line are known to be missing. */
|
|
50
|
+
truncated: boolean;
|
|
51
|
+
/** Byte offset of the first byte held. */
|
|
52
|
+
start: number;
|
|
53
|
+
/** Byte offset just past the last byte consumed. */
|
|
54
|
+
end: number;
|
|
55
|
+
}
|
|
56
|
+
/** Geometry of the log viewport. */
|
|
57
|
+
export interface LogViewport {
|
|
58
|
+
/** Current vertical scroll offset of the scroller, in pixels. */
|
|
59
|
+
scrollTop: number;
|
|
60
|
+
/** Visible height of the scroller, in pixels. */
|
|
61
|
+
height: number;
|
|
62
|
+
/** Height of every row, in pixels. */
|
|
63
|
+
rowHeight: number;
|
|
64
|
+
/** Rows rendered above and below the visible band. */
|
|
65
|
+
overscan: number;
|
|
66
|
+
}
|
|
67
|
+
/** The rows a renderer actually mounts. */
|
|
68
|
+
export interface LogWindow {
|
|
69
|
+
/** First mounted row index. */
|
|
70
|
+
start: number;
|
|
71
|
+
/** One past the last mounted row index. */
|
|
72
|
+
end: number;
|
|
73
|
+
/** Vertical offset of the mounted block inside the scroll surface. */
|
|
74
|
+
offsetY: number;
|
|
75
|
+
/** Full height of the scroll surface, so the scrollbar reflects every line. */
|
|
76
|
+
totalHeight: number;
|
|
77
|
+
/** How many rows exist in total. */
|
|
78
|
+
total: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Accumulates log increments into lines.
|
|
82
|
+
*
|
|
83
|
+
* One instance belongs to one open detail panel; closing the panel drops it,
|
|
84
|
+
* which is what makes reopening replay from the first byte — the buffer asks
|
|
85
|
+
* the provider for that replay and renders whatever windows arrive.
|
|
86
|
+
*/
|
|
87
|
+
export declare class SshLogBuffer {
|
|
88
|
+
private run;
|
|
89
|
+
private startOffset;
|
|
90
|
+
private endOffset;
|
|
91
|
+
private rows;
|
|
92
|
+
private tail;
|
|
93
|
+
private gap;
|
|
94
|
+
/** How many rows the buffer holds, partial trailing line included. */
|
|
95
|
+
get count(): number;
|
|
96
|
+
/**
|
|
97
|
+
* Apply one published increment.
|
|
98
|
+
* @param frame - the increment; duplicates and replays are tolerated.
|
|
99
|
+
* @returns true when the visible content changed.
|
|
100
|
+
*/
|
|
101
|
+
append(frame: SshLogFrame): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Read one row.
|
|
104
|
+
* @param index - zero-based row index below {@link count}.
|
|
105
|
+
* @returns the row text; the empty string outside the buffer.
|
|
106
|
+
*/
|
|
107
|
+
lineAt(index: number): string;
|
|
108
|
+
/**
|
|
109
|
+
* Copy every row out; for tests and small surfaces, never for a live render.
|
|
110
|
+
* @returns the rows, oldest first.
|
|
111
|
+
*/
|
|
112
|
+
toLines(): string[];
|
|
113
|
+
/** Drop every line; a later replay starts from the first byte again. */
|
|
114
|
+
reset(runId?: string): void;
|
|
115
|
+
/** Read the buffer's account of itself. */
|
|
116
|
+
snapshot(): SshLogSnapshot;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Compute the rows to mount for one scroll position.
|
|
120
|
+
*
|
|
121
|
+
* Pure arithmetic over a fixed row height: the tests state the window for a
|
|
122
|
+
* given geometry exactly, and the component never reads layout to decide what
|
|
123
|
+
* to render.
|
|
124
|
+
* @param total - how many rows exist.
|
|
125
|
+
* @param viewport - scroller geometry and overscan.
|
|
126
|
+
* @returns the mounted block and the scroll surface it sits in.
|
|
127
|
+
*/
|
|
128
|
+
export declare function visibleLogWindow(total: number, viewport: LogViewport): LogWindow;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type SshLogBuffer } from './log-buffer.ts';
|
|
2
|
+
/** Height of one log row in pixels; every row is one line of monospace text. */
|
|
3
|
+
export declare const LOG_ROW_HEIGHT = 18;
|
|
4
|
+
/** How many rows the scroller shows at once. */
|
|
5
|
+
export declare const LOG_VISIBLE_ROWS = 12;
|
|
6
|
+
/** Height of the scroller in pixels, derived from the two constants above. */
|
|
7
|
+
export declare const LOG_VIEWPORT_HEIGHT: number;
|
|
8
|
+
/** Copy the log surface needs, localized by the caller. */
|
|
9
|
+
export interface SshLogLabels {
|
|
10
|
+
/** Shown while nothing has been received. */
|
|
11
|
+
empty: string;
|
|
12
|
+
/** Shown when bytes before the first line are known to be missing. */
|
|
13
|
+
truncated: string;
|
|
14
|
+
/** Control that returns the scroller to the newest line. */
|
|
15
|
+
latest: string;
|
|
16
|
+
/** Accessible name of the scroller itself. */
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
/** Props of the log surface. */
|
|
20
|
+
export interface SshLogViewProps {
|
|
21
|
+
/** The buffer the parent owns for this panel. */
|
|
22
|
+
buffer: SshLogBuffer;
|
|
23
|
+
/** Bumped whenever the buffer changed; it is what makes the view re-render. */
|
|
24
|
+
version: number;
|
|
25
|
+
/** Whether the run is still producing output, so the tail follows. */
|
|
26
|
+
live: boolean;
|
|
27
|
+
/** Identity key (e.g. task + run) that resets scroll position and follow state when changed. */
|
|
28
|
+
resetKey?: string;
|
|
29
|
+
/** Localized copy. */
|
|
30
|
+
labels: SshLogLabels;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Render the run log.
|
|
34
|
+
* @param props - the buffer, its revision, and the copy it reads.
|
|
35
|
+
* @returns the scroller, its notices and the return-to-tail control.
|
|
36
|
+
*/
|
|
37
|
+
export declare function SshLogView({ buffer, live, labels, resetKey, version }: SshLogViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { SshAgentKind, SshExecutionMode, SshRunPhase, SshRunRecord, SshTarget, SshValidationIssue, SshWorkspaceKind } from '../../core/target.ts';
|
|
2
|
+
import type { TaskRecord } from '../../core/task-record.ts';
|
|
3
|
+
/** The phase a card shows when it has no run at all. */
|
|
4
|
+
export type SshCardPhase = 'idle' | SshRunPhase;
|
|
5
|
+
/** Everything the seats derive from one card. */
|
|
6
|
+
export interface SshCardView {
|
|
7
|
+
/** The target the card pins, absent when it pins none. */
|
|
8
|
+
target?: SshTarget;
|
|
9
|
+
/** The run currently in flight, when there is one. */
|
|
10
|
+
activeRun?: SshRunRecord;
|
|
11
|
+
/** The newest finished run, when the card has run before. */
|
|
12
|
+
lastRun?: SshRunRecord;
|
|
13
|
+
/** Phase the card presents: the active run's, else the newest run's, else idle. */
|
|
14
|
+
phase: SshCardPhase;
|
|
15
|
+
/** Run the phase belongs to, absent while the card has never run. */
|
|
16
|
+
runId?: string;
|
|
17
|
+
/** Queued follow-up / rework instruction waiting on the ledger, when any. */
|
|
18
|
+
pending?: 'follow-up' | 'rework';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read a card's SSH payload leniently.
|
|
22
|
+
*
|
|
23
|
+
* The container is accepted at a version this reader knows; a payload stamped
|
|
24
|
+
* with a version it does not know is refused whole, exactly as the ledger's own
|
|
25
|
+
* parser refuses it, because guessing at a future shape is worse than showing
|
|
26
|
+
* an untargeted card. Inside a readable container each record is parsed on its
|
|
27
|
+
* own, so one corrupt run never hides the target or the other runs.
|
|
28
|
+
* @param task - card to read.
|
|
29
|
+
* @returns the parsed pieces, or undefined when the card carries no readable payload.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readSshLedger(task: TaskRecord): {
|
|
32
|
+
target?: SshTarget;
|
|
33
|
+
activeRun?: SshRunRecord;
|
|
34
|
+
history: SshRunRecord[];
|
|
35
|
+
pending?: 'follow-up' | 'rework';
|
|
36
|
+
} | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Derive everything the card badge and the detail section show.
|
|
39
|
+
*
|
|
40
|
+
* Pure and allocation-light by contract: at most one record copy from the
|
|
41
|
+
* lenient reader, no request, no clock.
|
|
42
|
+
* @param task - card to derive.
|
|
43
|
+
* @returns the view; {@link NO_VIEW} when the card pins nothing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sshCardView(task: TaskRecord): SshCardView;
|
|
46
|
+
/**
|
|
47
|
+
* Whether a card pins a target at all.
|
|
48
|
+
* @param task - card to test.
|
|
49
|
+
* @returns true when the card's payload carries a readable target.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isSshTargeted(task: TaskRecord): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether a phase means a run is under way.
|
|
54
|
+
* @param phase - phase to test.
|
|
55
|
+
* @returns true for queued and running.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isSshRunActive(phase: SshCardPhase): boolean;
|
|
58
|
+
/** Every field the target form edits, in tab order. */
|
|
59
|
+
export type SshDraftField = 'mode' | 'host' | 'agent' | 'agentCommand' | 'agentResumeCommand' | 'workspaceKind' | 'workspacePath' | 'gitSource' | 'repositoryUrl' | 'baseBranch' | 'workspaceId';
|
|
60
|
+
/** The target form's whole state, as strings: a form holds text, not a target. */
|
|
61
|
+
export interface SshTargetDraft {
|
|
62
|
+
mode: SshExecutionMode;
|
|
63
|
+
host: string;
|
|
64
|
+
agent: SshAgentKind;
|
|
65
|
+
agentCommand: string;
|
|
66
|
+
agentResumeCommand: string;
|
|
67
|
+
workspaceKind: SshWorkspaceKind;
|
|
68
|
+
gitSource: 'url' | 'workspace';
|
|
69
|
+
workspacePath: string;
|
|
70
|
+
repositoryUrl: string;
|
|
71
|
+
baseBranch: string;
|
|
72
|
+
workspaceId: string;
|
|
73
|
+
}
|
|
74
|
+
/** What a save attempt produced: a target, or the field that refused it. */
|
|
75
|
+
export interface SshDraftValidation {
|
|
76
|
+
/** The parsed target, present only when nothing was refused. */
|
|
77
|
+
target?: SshTarget;
|
|
78
|
+
/** First refusal per field, keyed by the field the form highlights. */
|
|
79
|
+
errors: Partial<Record<SshDraftField, SshValidationIssue>>;
|
|
80
|
+
/** Every refusal, in the parser's order. */
|
|
81
|
+
issues: readonly SshValidationIssue[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build the wire shape a draft describes, leaving out the fields the chosen
|
|
85
|
+
* mode and workspace kind do not use.
|
|
86
|
+
*
|
|
87
|
+
* Leaving them out is what makes the parser's verdict match what the form
|
|
88
|
+
* showed: a hidden field can neither pass nor fail.
|
|
89
|
+
* @param draft - the form's state.
|
|
90
|
+
* @returns a candidate target for {@link parseSshTarget}.
|
|
91
|
+
*/
|
|
92
|
+
export declare function draftToTarget(draft: SshTargetDraft): Record<string, unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* Validate a draft through the frozen parser, addressing refusals per field.
|
|
95
|
+
* @param draft - the form's state.
|
|
96
|
+
* @param parse - target parser; defaults to the frozen core parser.
|
|
97
|
+
* @returns the target, or the refusals keyed by field.
|
|
98
|
+
*/
|
|
99
|
+
export declare function validateDraft(draft: SshTargetDraft, parse?: (value: unknown) => {
|
|
100
|
+
ok: true;
|
|
101
|
+
value: SshTarget;
|
|
102
|
+
} | {
|
|
103
|
+
ok: false;
|
|
104
|
+
errors: readonly SshValidationIssue[];
|
|
105
|
+
}): SshDraftValidation;
|
|
106
|
+
/**
|
|
107
|
+
* Read a card's form state out of its target, filling the rest from defaults.
|
|
108
|
+
* @param target - the pinned target, when the card has one.
|
|
109
|
+
* @param defaults - the published defaults, when the provider publishes any.
|
|
110
|
+
* @returns the draft the form opens with.
|
|
111
|
+
*/
|
|
112
|
+
export declare function draftOf(target: SshTarget | undefined, defaults?: {
|
|
113
|
+
host?: string;
|
|
114
|
+
mode?: SshExecutionMode;
|
|
115
|
+
agent?: SshAgentKind;
|
|
116
|
+
workspace?: SshWorkspaceKind;
|
|
117
|
+
}): SshTargetDraft;
|
|
118
|
+
/**
|
|
119
|
+
* One line describing a pinned target, for the detail summary.
|
|
120
|
+
*
|
|
121
|
+
* The host, the agent and the workspace are three facts of one sentence, so
|
|
122
|
+
* they stay three template values rather than three labelled rows.
|
|
123
|
+
* @param target - the pinned target.
|
|
124
|
+
* @returns the pieces the caller interpolates.
|
|
125
|
+
*/
|
|
126
|
+
export declare function targetSummaryParts(target: SshTarget): {
|
|
127
|
+
host: string;
|
|
128
|
+
agent: SshAgentKind;
|
|
129
|
+
workspace: string;
|
|
130
|
+
};
|