super-dsh 0.3.2 → 0.3.3-c
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 +15 -14
- package/agent-agy/dist/agent.d.ts +4 -1
- package/agent-agy/dist/agent.js +15 -1
- package/agent-agy/dist/index.js +5 -8
- package/agent-agy/package.json +6 -6
- package/agent-agy-sdk/dist/agent.d.ts +4 -1
- package/agent-agy-sdk/dist/agent.js +15 -1
- package/agent-agy-sdk/dist/index.js +5 -8
- package/agent-agy-sdk/package.json +5 -5
- package/agent-claude/dist/agent.js +15 -1
- package/agent-claude/package.json +8 -8
- package/agent-codex/dist/agent.js +15 -1
- package/agent-codex/package.json +7 -7
- package/agent-codex-sdk/dist/agent.js +15 -1
- package/agent-codex-sdk/dist/index.js +5 -11
- package/agent-codex-sdk/package.json +7 -7
- package/agent-hermes/dist/agent.js +15 -1
- package/agent-hermes/dist/index.js +5 -8
- package/agent-hermes/package.json +7 -7
- package/agent-omp/dist/agent.js +26 -2
- package/agent-omp/package.json +8 -8
- package/agent-omp-sdk/dist/agent.d.ts +4 -1
- package/agent-omp-sdk/dist/agent.js +15 -1
- package/agent-omp-sdk/package.json +8 -8
- package/agent-pi/dist/agent.js +20 -2
- package/agent-pi/dist/index.js +5 -11
- package/agent-pi/package.json +7 -7
- package/client/index.js +106 -249
- package/cordis.patch.yml +0 -6
- package/package.json +22 -27
- package/remote/hub-pty-pump.mjs +97 -0
- package/remote/plugin.d.ts +476 -200
- package/remote/plugin.js +1448 -667
- package/remote/provenance.json +22 -17
- package/superd-hub/dist/agent-model-face.d.ts +93 -0
- package/superd-hub/dist/agent-model-face.js +113 -0
- package/superd-hub/dist/exec.d.ts +3 -2
- package/superd-hub/dist/exec.js +6 -5
- package/superd-hub/dist/fusion-transport.js +0 -1
- package/superd-hub/dist/hub-tool.d.ts +1 -1
- package/superd-hub/dist/hub-tool.js +6 -6
- package/superd-hub/dist/index.d.ts +1 -0
- package/superd-hub/dist/index.js +1 -0
- package/superd-hub/dist/remote-provider.js +70 -36
- package/superd-hub/dist/world-entry.js +30 -0
- package/superd-hub/lib/client/index.js +106 -249
- package/superd-hub/package.json +14 -10
- package/superd-hub/dist/bundle-setup.d.ts +0 -27
- package/superd-hub/dist/bundle-setup.js +0 -94
- package/superd-hub/dist/client/companion-api.d.ts +0 -5
- package/superd-hub/dist/client/companion-api.js +0 -30
- package/superd-hub/dist/companion-contract.d.ts +0 -9
- package/superd-hub/dist/companion-contract.js +0 -1
- package/superd-hub/dist/companions.d.ts +0 -30
- package/superd-hub/dist/companions.js +0 -211
- package/superd-hub/dist/exec-pty-channel.d.ts +0 -58
- package/superd-hub/dist/exec-pty-channel.js +0 -162
- package/superd-hub/dist/exec-pty-framing.d.ts +0 -34
- package/superd-hub/dist/exec-pty-framing.js +0 -89
- package/superd-hub/dist/exec-pty-session.d.ts +0 -78
- package/superd-hub/dist/exec-pty-session.js +0 -228
package/remote/plugin.d.ts
CHANGED
|
@@ -100,6 +100,390 @@ declare function sshArgv(connection: SshConnection, options?: {
|
|
|
100
100
|
command?: string;
|
|
101
101
|
}): string[];
|
|
102
102
|
//#endregion
|
|
103
|
+
//#region src/remote/hub-contract.d.ts
|
|
104
|
+
/** Owned structural boundary. Better never imports or depends on Super. */
|
|
105
|
+
interface RemoteInput {
|
|
106
|
+
target?: string;
|
|
107
|
+
spawn?: string;
|
|
108
|
+
ssh?: SshConnection;
|
|
109
|
+
cmd?: string;
|
|
110
|
+
scriptPath?: string;
|
|
111
|
+
stdin?: string;
|
|
112
|
+
mode?: 'oneshot' | 'pty';
|
|
113
|
+
timeout?: number;
|
|
114
|
+
}
|
|
115
|
+
interface PreparedRemoteInput {
|
|
116
|
+
target?: string;
|
|
117
|
+
spawn?: string;
|
|
118
|
+
ssh?: SshConnection;
|
|
119
|
+
cmd: string;
|
|
120
|
+
stdin?: string;
|
|
121
|
+
mode?: 'oneshot' | 'pty';
|
|
122
|
+
timeout?: number;
|
|
123
|
+
}
|
|
124
|
+
/** Counters exclude diagnostic banners. dropped is ring eviction; total-returned is all omitted output. */
|
|
125
|
+
type OutputStats = {
|
|
126
|
+
unit: 'utf16' | 'bytes';
|
|
127
|
+
total: number;
|
|
128
|
+
retained: number;
|
|
129
|
+
dropped: number;
|
|
130
|
+
returned: number;
|
|
131
|
+
retentionLimit: number;
|
|
132
|
+
};
|
|
133
|
+
type StreamOutputStats = {
|
|
134
|
+
stdout: OutputStats;
|
|
135
|
+
stderr?: OutputStats;
|
|
136
|
+
};
|
|
137
|
+
interface RemoteProcess {
|
|
138
|
+
cancel(reason?: string): void;
|
|
139
|
+
done: Promise<{
|
|
140
|
+
exit: number | null;
|
|
141
|
+
timedOut: boolean;
|
|
142
|
+
durationMs: number;
|
|
143
|
+
cancelled?: boolean;
|
|
144
|
+
}>;
|
|
145
|
+
/** diagnostic is executor-generated text, not process output; excluded from byte cursor and counters. */
|
|
146
|
+
read(channel: 'stdout' | 'stderr', fromByte: number): {
|
|
147
|
+
text: string;
|
|
148
|
+
nextOffset: number;
|
|
149
|
+
lossy: boolean;
|
|
150
|
+
stats?: OutputStats;
|
|
151
|
+
diagnostic?: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
interface BinaryFileEndpoint {
|
|
155
|
+
exportTree(path: string, signal: AbortSignal): Promise<NodeJS.ReadableStream>;
|
|
156
|
+
importTree(path: string, source: NodeJS.ReadableStream, options: {
|
|
157
|
+
mkdir: boolean;
|
|
158
|
+
signal: AbortSignal;
|
|
159
|
+
}): Promise<void>;
|
|
160
|
+
digest(path: string, signal: AbortSignal, selection?: readonly string[]): Promise<{
|
|
161
|
+
sha256: string;
|
|
162
|
+
bytes: number;
|
|
163
|
+
entries: number;
|
|
164
|
+
}>;
|
|
165
|
+
}
|
|
166
|
+
interface HubTarget {
|
|
167
|
+
id: string;
|
|
168
|
+
label: string;
|
|
169
|
+
execEnabled: boolean;
|
|
170
|
+
}
|
|
171
|
+
interface HubRemoteTransport {
|
|
172
|
+
protocol: 1;
|
|
173
|
+
listTargets(): readonly HubTarget[];
|
|
174
|
+
start(machine: string, input: PreparedRemoteInput, owner: string): Promise<RemoteProcess>;
|
|
175
|
+
/** Hub PTY 端点(0.3.2-c):url = ws(s)://<origin>/api/superd/exec/pty;cookie = pairing 凭据;
|
|
176
|
+
* wsPath = transport 侧(superd-hub 上下文,分叉的 proven 解析链)解析好的 ws 模块绝对路径。 */
|
|
177
|
+
ptyEndpoint(machine: string): {
|
|
178
|
+
url: string;
|
|
179
|
+
cookie: string;
|
|
180
|
+
wsPath: string;
|
|
181
|
+
};
|
|
182
|
+
fileEndpoint(machine: string): BinaryFileEndpoint;
|
|
183
|
+
releaseOwner(owner: string): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/remote/output-ring.d.ts
|
|
187
|
+
/** Byte-addressed decoded output: mid-codepoint cursors skip forward and explicitly report loss. */
|
|
188
|
+
declare function readUtf8Tail(bytes: Buffer, totalBytes: number, fromByte: number): {
|
|
189
|
+
text: string;
|
|
190
|
+
nextOffset: number;
|
|
191
|
+
lossy: boolean;
|
|
192
|
+
};
|
|
193
|
+
/** Native/PTY retention is UTF16 units; cursor offsets remain real UTF8 bytes. Input is decoded text. */
|
|
194
|
+
declare class Utf16TailRing {
|
|
195
|
+
readonly capacity: number;
|
|
196
|
+
text: string;
|
|
197
|
+
total: number;
|
|
198
|
+
private totalBytes;
|
|
199
|
+
constructor(capacity?: number);
|
|
200
|
+
push(text: string): void;
|
|
201
|
+
stats(returned?: number): OutputStats;
|
|
202
|
+
read(fromByte: number): ReturnType<typeof readUtf8Tail>;
|
|
203
|
+
}
|
|
204
|
+
/** Raw byte retention for Hub oneshot. Tail/read starts skip partial UTF8 prefixes, never invent replacement characters. */
|
|
205
|
+
declare class ByteTailRing {
|
|
206
|
+
readonly capacity: number;
|
|
207
|
+
total: number;
|
|
208
|
+
private chunks;
|
|
209
|
+
private retained;
|
|
210
|
+
constructor(capacity?: number);
|
|
211
|
+
push(chunk: Buffer): void;
|
|
212
|
+
tail(maxBytes?: number): Buffer;
|
|
213
|
+
stats(returned?: number): OutputStats;
|
|
214
|
+
read(fromByte: number): ReturnType<typeof readUtf8Tail>;
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/remote/process.d.ts
|
|
218
|
+
declare const PROCESS_CLEANUP_BOUND_MS: number;
|
|
219
|
+
interface ProcessOptions {
|
|
220
|
+
stdin?: string;
|
|
221
|
+
timeoutSec?: number;
|
|
222
|
+
cwd?: string;
|
|
223
|
+
/** Hub retains raw bytes; native transports retain decoded UTF16 units. */
|
|
224
|
+
unit?: 'bytes' | 'utf16';
|
|
225
|
+
onOutput?: () => void;
|
|
226
|
+
/** Overlay on process.env (tool-built values only, e.g. RSYNC_RSH). */
|
|
227
|
+
env?: NodeJS.ProcessEnv;
|
|
228
|
+
/** Task E(SSH MUX):取消(timeout 或显式 cancel)即同步回调,不等 close。mux master 会经
|
|
229
|
+
* fd-passing 持有被杀客户端的会话 fd 直到远端会话结束——若远端清理 killer 等 close 后才发射,
|
|
230
|
+
* 就成了「close 等远端结束、远端结束等 killer」死锁。此处先行启动 killer 才能解开 close。至多一次。 */
|
|
231
|
+
onCancel?: () => void;
|
|
232
|
+
}
|
|
233
|
+
/** Real detached process. Completion includes group cleanup, even after its leader closes. */
|
|
234
|
+
declare function startBinaryProcess(argv: string[], options?: Pick<ProcessOptions, 'cwd' | 'timeoutSec' | 'env' | 'onCancel'>): {
|
|
235
|
+
stdout: Readable;
|
|
236
|
+
stderr: Readable;
|
|
237
|
+
stdin: Writable;
|
|
238
|
+
cancel(): void;
|
|
239
|
+
done: RemoteProcess['done'];
|
|
240
|
+
diagnostic(): string | undefined;
|
|
241
|
+
};
|
|
242
|
+
/** Text adapter over the same owned process-group lifecycle as binary pipelines. */
|
|
243
|
+
declare function startOneShot(argv: string[], options?: ProcessOptions): RemoteProcess;
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/remote/nonce-framing.d.ts
|
|
246
|
+
/** 0.3.2-e:自有 30K 返回窗口已删(原生 agent runtime 的 spill/输出保护接管模型上下文
|
|
247
|
+
* 尺寸)。本 helper 只做 retention 披露:ring 留存(4M UTF-16 / 4MiB bytes)未驱逐时
|
|
248
|
+
* 全量透传(returned=retained,无 banner);驱逐(dropped>0,仅 >4M 输出发生)时打一行
|
|
249
|
+
* banner 且 truncated=原始总量。text 已是 ring 尾部,不再二次裁剪。 */
|
|
250
|
+
declare function disclose(text: string, stats?: OutputStats): {
|
|
251
|
+
text: string;
|
|
252
|
+
truncated?: number;
|
|
253
|
+
stats?: OutputStats;
|
|
254
|
+
};
|
|
255
|
+
interface EnvDelta {
|
|
256
|
+
added: string[];
|
|
257
|
+
changed: string[];
|
|
258
|
+
removed: string[];
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/remote/pty-session.d.ts
|
|
262
|
+
interface PtySessionOptions {
|
|
263
|
+
key: string;
|
|
264
|
+
argv: string[];
|
|
265
|
+
/** Workbench 身份(§3):自动 id(p-xxxx)+ 可选 label + connection 展示名(ssh:dev4 / docker:c / BYOP)。 */
|
|
266
|
+
id: string;
|
|
267
|
+
label?: string;
|
|
268
|
+
connection: string;
|
|
269
|
+
byo?: boolean;
|
|
270
|
+
/** connection 来自 BYO ssh 身份(card 面标 `(built on)`,与 roster 同词)。 */
|
|
271
|
+
builtOn?: boolean;
|
|
272
|
+
/** spawn 原文(BYO 会话存档;v2 无 spec 对比——不再参与复用判定,仅供回执/账本溯源)。 */
|
|
273
|
+
origin?: string;
|
|
274
|
+
idleTtlSec: number;
|
|
275
|
+
initTimeoutSec?: number;
|
|
276
|
+
/** 池回调:会话彻底出池(dispose)时触发;进程意外死亡不出池(Ruling 7)。 */
|
|
277
|
+
onDead?: () => void;
|
|
278
|
+
}
|
|
279
|
+
interface PtyDispatchOptions {
|
|
280
|
+
stdin?: string;
|
|
281
|
+
timeoutSec?: number; /** 账本键:driver 分配(background 通道预传入 registry jobId;同步命令同格式本地生成)——一个命令永远只有一个 id。 */
|
|
282
|
+
commandId: string; /** P5:立即回执 running job,不等帧(run_in_background 与超时 handoff 共用同一条 job 通道)。 */
|
|
283
|
+
background?: boolean; /** background 通道预传入的 registry jobId(此时与 commandId 字面相等):账本与 input 回执如实携带,免 driver 侧二次回填。 */
|
|
284
|
+
jobId?: string;
|
|
285
|
+
}
|
|
286
|
+
/** §3.3(2026-10-25)interactive-stdin:input 动作的选项与回执(写入成功才回执)。 */
|
|
287
|
+
interface PtyInputOptions {
|
|
288
|
+
stdin: string;
|
|
289
|
+
commandId?: string;
|
|
290
|
+
}
|
|
291
|
+
interface PtyInputReceipt {
|
|
292
|
+
/** 模型面会话名(pty:<id>)。 */
|
|
293
|
+
session: string;
|
|
294
|
+
commandId: string;
|
|
295
|
+
/** 存在官方 job 时才有(background 预传 / timeout handoff 收养回填)。 */
|
|
296
|
+
jobId?: string;
|
|
297
|
+
/** 实际写入的 UTF-8 字节数。 */
|
|
298
|
+
writtenBytes: number;
|
|
299
|
+
}
|
|
300
|
+
/** detached job 的完成结果(frame 或会话死亡时结算;与 dispatch 回执同构)。 */
|
|
301
|
+
interface PtyJobResult {
|
|
302
|
+
output: string;
|
|
303
|
+
outputStats?: StreamOutputStats;
|
|
304
|
+
exit: number | null;
|
|
305
|
+
cwd: string | null;
|
|
306
|
+
timedOut: boolean;
|
|
307
|
+
commandId: string;
|
|
308
|
+
envDelta?: EnvDelta;
|
|
309
|
+
}
|
|
310
|
+
/** P4/P5(2026-10-19)running job 句柄:byte-cursor 增量读 + P8 显式中断 + 完成时帧结算。 */
|
|
311
|
+
interface PtyRunningJob {
|
|
312
|
+
/** 账本键:与 jobId 同构(background 通道预传入 registry id;同步完成命令用同格式生成 id)。 */
|
|
313
|
+
commandId: string;
|
|
314
|
+
/** Byte-cursor incremental read over the command's merged output (tail-ring retention; lossy reports eviction). */
|
|
315
|
+
read: (fromByte: number) => {
|
|
316
|
+
text: string;
|
|
317
|
+
nextOffset: number;
|
|
318
|
+
lossy: boolean;
|
|
319
|
+
};
|
|
320
|
+
stats: () => OutputStats;
|
|
321
|
+
/** P8 两段式 ^C 中断(会话存活;trap-INT 走宽限 group-kill 兜底)。 */
|
|
322
|
+
interrupt: () => void;
|
|
323
|
+
/** Settles on the exit frame, or with exit null when the session dies. */
|
|
324
|
+
done: Promise<PtyJobResult>;
|
|
325
|
+
}
|
|
326
|
+
interface PtyDispatchResult {
|
|
327
|
+
output: string;
|
|
328
|
+
outputStats?: StreamOutputStats;
|
|
329
|
+
exit: number | null;
|
|
330
|
+
cwd: string | null;
|
|
331
|
+
timedOut: boolean;
|
|
332
|
+
reconnected: boolean;
|
|
333
|
+
durationMs: number;
|
|
334
|
+
commandId: string;
|
|
335
|
+
/** env delta(E 帧侧信道):只回名字 + 变动标记,值不回传;init 侧信道失败时省略。 */
|
|
336
|
+
envDelta?: EnvDelta;
|
|
337
|
+
/** P4/P5:true = 命令仍在前台运行,本回执是 handoff(job 句柄随行)。 */
|
|
338
|
+
running?: boolean;
|
|
339
|
+
job?: PtyRunningJob;
|
|
340
|
+
}
|
|
341
|
+
type PtyState = 'cold' | 'starting' | 'ready' | 'dead' | 'disposed';
|
|
342
|
+
/** 会话运行时快照(status 面消费,Ruling 16 词汇源)。 */
|
|
343
|
+
interface SessionSnapshot {
|
|
344
|
+
state: PtyState;
|
|
345
|
+
busy: boolean;
|
|
346
|
+
idleMs: number | null;
|
|
347
|
+
pid: number | null;
|
|
348
|
+
}
|
|
349
|
+
declare class PtySession {
|
|
350
|
+
private readonly opts;
|
|
351
|
+
private proc;
|
|
352
|
+
private state;
|
|
353
|
+
private startPromise;
|
|
354
|
+
private idleTimer;
|
|
355
|
+
private onChunk;
|
|
356
|
+
private deathWaiters;
|
|
357
|
+
private diag;
|
|
358
|
+
private inFlight;
|
|
359
|
+
private cmdSeq;
|
|
360
|
+
/** P4/P5:当前占用前台的 detached job(background/超时 handoff)。非 null 时新命令拒绝(Q6)。 */
|
|
361
|
+
private detachedJob;
|
|
362
|
+
/** §3.2(2026-10-25):当前占用会话的命令——dispatch 同步占位,settle/cleanup 释放;input 的唯一写入对象。 */
|
|
363
|
+
private activeCommand;
|
|
364
|
+
/** env 侧信道基线(init E 帧);undefined = 侧信道不可用(不报假 delta)。 */
|
|
365
|
+
private envBaseline;
|
|
366
|
+
/** idle 起点(ready / settle 时重置);null = 尚无 idle 时钟(cold 或已 dispose)。 */
|
|
367
|
+
private idleSince;
|
|
368
|
+
/** 意外死亡后的回收定时器(R2):ready 过的会话先留池供 reconnect,超时仍无人寻址则出池。 */
|
|
369
|
+
private deathTimer;
|
|
370
|
+
private lastCwdSeen;
|
|
371
|
+
/** 是否曾成功初始化(ready 过)。决定死亡语义:ready 过 → reconnect(留池);从未 ready → 出池(见 start())。 */
|
|
372
|
+
private everReady;
|
|
373
|
+
private disposal;
|
|
374
|
+
private procClose;
|
|
375
|
+
private groupCleanup;
|
|
376
|
+
constructor(opts: PtySessionOptions);
|
|
377
|
+
get sessionState(): PtyState;
|
|
378
|
+
/** 池键(driver 的 ttl/inspect 用)。 */
|
|
379
|
+
get key(): string;
|
|
380
|
+
/** 最近帧 cwd(card 面);从未执行过 = null。 */
|
|
381
|
+
get lastCwd(): string | null;
|
|
382
|
+
/** 占用前台的 detached job 的 commandId(无 = null;close 拒绝与 busy 文案共用)。 */
|
|
383
|
+
get detachedCommandId(): string | null;
|
|
384
|
+
/** handoff/card 面(2026-11-01 默认 PTY 轮):当前占用会话的命令与可选 job 句柄;无 = null。 */
|
|
385
|
+
get active(): {
|
|
386
|
+
commandId: string;
|
|
387
|
+
jobId?: string;
|
|
388
|
+
} | null;
|
|
389
|
+
/** job 通道收养后回填 jobId(timeout handoff 时 registry id ≠ commandId);运行中的命令同步携带(stdin-only 写入回执用)。 */
|
|
390
|
+
attachJob(commandId: string, jobId: string): void;
|
|
391
|
+
/** Workbench 身份(§3):id + 可选 label + connection + byo 标记。 */
|
|
392
|
+
get identity(): {
|
|
393
|
+
id: string;
|
|
394
|
+
label?: string;
|
|
395
|
+
connection: string;
|
|
396
|
+
byo: boolean;
|
|
397
|
+
builtOn: boolean;
|
|
398
|
+
};
|
|
399
|
+
/** spawn 创建原文(仅 BYO 会话;v2 起仅存档,不参与复用判定)。 */
|
|
400
|
+
get origin(): string | undefined;
|
|
401
|
+
/** status 面快照:state + busy(有命令在跑)+ idleMs(上次 settle 至今)+ pid(进程组头,kill 兜底可观测)。 */
|
|
402
|
+
get snapshot(): SessionSnapshot;
|
|
403
|
+
/** 预热创建(创建形无 cmd):真正拨号到 init 帧——「会话已就绪」必须是真的,
|
|
404
|
+
* 而且只有 ready 过才挂 idle 回收(cold 会话没有 timer,会永远占配额)。 */
|
|
405
|
+
warm(): Promise<void>;
|
|
406
|
+
/** 同一会话命令占位制(2026-10-25 interactive-stdin 轮):dispatch 入口**同步**建立
|
|
407
|
+
* 命令占位(activeCommand + inFlight + 账本条目)——上一条命令仍在运行(同步等待 /
|
|
408
|
+
* 等输入 / detached job)时新 cmd 立即 E_SESSION_BUSY;原「纯同步并发排 FIFO」语义
|
|
409
|
+
* 废除(排队会让等输入的命令与补输入动作互相卡死,也给 busy 留下绕行窗口)。
|
|
410
|
+
* P4/P5:超时不杀命令而是 handoff 成 running job;background 立即回执;P8 显式
|
|
411
|
+
* interrupt 保留在 job.interrupt;死亡/冷态先重启(reconnect 语义不变)。 */
|
|
412
|
+
dispatch(cmd: string, dOpts: PtyDispatchOptions): Promise<PtyDispatchResult>;
|
|
413
|
+
/** §3.1(2026-10-25)interactive-stdin:向当前运行中的命令追加 stdin——只写既有通道
|
|
414
|
+
* 与身份,不新建命令、账本条目或输出游标;不重连、不重放(dead/disposed 明确拒绝)。
|
|
415
|
+
* 校验与写入全同步:多次 input 按调用顺序整段写入不交错;写入失败如实抛错(私有
|
|
416
|
+
* write() 的静默忽略不适用于回执语义)。stdin:"" 是零字节写入,不是 EOF。 */
|
|
417
|
+
input(options: PtyInputOptions): Promise<PtyInputReceipt>;
|
|
418
|
+
/** TTL / row teardown:尽力 exit,1s 后杀组,出池。 */
|
|
419
|
+
dispose(): Promise<void>;
|
|
420
|
+
private write;
|
|
421
|
+
private start;
|
|
422
|
+
private doStart;
|
|
423
|
+
private markDead;
|
|
424
|
+
private resetIdleTimer;
|
|
425
|
+
private clearIdleTimer;
|
|
426
|
+
/** 意外死亡后的回收:留池只换取一次 reconnect 机会,不得超过一段 idle TTL(R2 复核 P0)。
|
|
427
|
+
* 否则死会话永久占 label + 永久计入 10 配额,Agent 再也开不出新会话。 */
|
|
428
|
+
private armDeathReaper;
|
|
429
|
+
private clearDeathTimer;
|
|
430
|
+
private killTree;
|
|
431
|
+
/** A direct child's close is not proof that its detached process group is gone. */
|
|
432
|
+
private reapGroup;
|
|
433
|
+
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/remote/target.d.ts
|
|
436
|
+
/** 解析后的传输计划:三种 CLI 传输之一。 */
|
|
437
|
+
type TargetPlan = {
|
|
438
|
+
kind: 'ssh';
|
|
439
|
+
host: string;
|
|
440
|
+
connection?: SshConnection;
|
|
441
|
+
} | {
|
|
442
|
+
kind: 'docker';
|
|
443
|
+
container: string;
|
|
444
|
+
} | {
|
|
445
|
+
kind: 'incus';
|
|
446
|
+
container: string;
|
|
447
|
+
};
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/remote/helper.d.ts
|
|
450
|
+
interface HelperManifest {
|
|
451
|
+
format: 1;
|
|
452
|
+
name: string;
|
|
453
|
+
ver: string;
|
|
454
|
+
protocol: number;
|
|
455
|
+
targets: Record<string, {
|
|
456
|
+
file: string;
|
|
457
|
+
bytes: number;
|
|
458
|
+
sha256: string;
|
|
459
|
+
}>;
|
|
460
|
+
}
|
|
461
|
+
interface HelperAssets {
|
|
462
|
+
dir: string;
|
|
463
|
+
manifest: HelperManifest;
|
|
464
|
+
}
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/remote/transports.d.ts
|
|
467
|
+
/** Hub PTY 端点事实(ptyEndpoint 的返回形;结构类型,不引 superd-hub)。wsPath 由 transport
|
|
468
|
+
* 侧解析成绝对路径(superd-hub 上下文 = 分叉验证过的解析链;闭包/泵内绝不做按名解析赌注)。 */
|
|
469
|
+
interface HubPtyEndpoint {
|
|
470
|
+
url: string;
|
|
471
|
+
cookie: string;
|
|
472
|
+
wsPath: string;
|
|
473
|
+
}
|
|
474
|
+
/** Hub PTY(0.3.2-c;0.3.2-d F4 修正):会话子进程 = 本地 `script` PTY 托管的 WS 字节泵
|
|
475
|
+
* (hub-pty-pump.mjs)。与 docker exec 的嵌套 PTY 同形,但泵是哑 node 子进程、不像
|
|
476
|
+
* `ssh -tt` / `docker exec -it` 那样作为前台子进程自己把本地 tty 置 raw——所以本地包装必须
|
|
477
|
+
* `stty raw`:canonical+ISIG 下 0x03 在本地变 SIGINT 杀泵、0x04 变 EOF 结束泵 stdin
|
|
478
|
+
* (F4:input ^C/^D 与 job_kill 会打死整条会话)。raw 只作用于本地半段;对端 script PTY
|
|
479
|
+
* 保持 canonical,^C/^D 在对端产生 SIGINT/EOF 正是我们要的语义(字节原样过线,解释权在
|
|
480
|
+
* 对端)。kill 链 session 组杀 → 泵死 → WS 关 → 对端组杀,双向自然闭合。连接事实走 wrapper
|
|
481
|
+
* 内 env 赋值(cookie 不进 argv、不落 ps)。 */
|
|
482
|
+
declare function buildHubPtyArgv(endpoint: HubPtyEndpoint, assets: {
|
|
483
|
+
pumpPath: string;
|
|
484
|
+
nodePath?: string;
|
|
485
|
+
}): string[];
|
|
486
|
+
//#endregion
|
|
103
487
|
//#region src/remote/copy.d.ts
|
|
104
488
|
interface CopyRequest {
|
|
105
489
|
src: string;
|
|
@@ -126,20 +510,6 @@ interface TransferReceipt {
|
|
|
126
510
|
error?: string;
|
|
127
511
|
}
|
|
128
512
|
//#endregion
|
|
129
|
-
//#region src/remote/target.d.ts
|
|
130
|
-
/** 解析后的传输计划:三种 CLI 传输之一。 */
|
|
131
|
-
type TargetPlan = {
|
|
132
|
-
kind: 'ssh';
|
|
133
|
-
host: string;
|
|
134
|
-
connection?: SshConnection;
|
|
135
|
-
} | {
|
|
136
|
-
kind: 'docker';
|
|
137
|
-
container: string;
|
|
138
|
-
} | {
|
|
139
|
-
kind: 'incus';
|
|
140
|
-
container: string;
|
|
141
|
-
};
|
|
142
|
-
//#endregion
|
|
143
513
|
//#region src/remote/native-copy.d.ts
|
|
144
514
|
interface NativeCopyReceipt {
|
|
145
515
|
action: 'copy';
|
|
@@ -224,81 +594,40 @@ interface RsyncReceipt extends RunResult {
|
|
|
224
594
|
*/
|
|
225
595
|
declare function runRsync(request: RsyncRequest, source: RsyncEndpoint, destination: RsyncEndpoint, signal: AbortSignal, options?: RelayRsyncOptions): Promise<RsyncReceipt>;
|
|
226
596
|
//#endregion
|
|
227
|
-
//#region src/remote/
|
|
228
|
-
interface
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
597
|
+
//#region src/remote/ssh-mux.d.ts
|
|
598
|
+
interface SshMuxIdentity {
|
|
599
|
+
/** 原始 target 串(如 `ssh:dev4` / `dev4`)——同一 effective 身份不同拼法也不串 socket。 */
|
|
600
|
+
target: string;
|
|
601
|
+
connection: SshConnection;
|
|
602
|
+
}
|
|
603
|
+
interface SshMuxOptions {
|
|
604
|
+
persistSec?: number;
|
|
605
|
+
/** socket 目录根(默认 os.tmpdir());测试注入口。 */
|
|
606
|
+
rootDir?: string;
|
|
607
|
+
runner?: (argv: string[], opts?: {
|
|
608
|
+
timeoutSec?: number;
|
|
609
|
+
}) => Promise<{
|
|
610
|
+
exit: number | null;
|
|
237
611
|
}>;
|
|
238
612
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
exit: number | null;
|
|
257
|
-
cwd: string | null;
|
|
258
|
-
timedOut: boolean;
|
|
259
|
-
commandId: string;
|
|
260
|
-
envDelta?: EnvDelta;
|
|
261
|
-
}
|
|
262
|
-
/** P4/P5(2026-10-19)running job 句柄:byte-cursor 增量读 + P8 显式中断 + 完成时帧结算。 */
|
|
263
|
-
interface PtyRunningJob {
|
|
264
|
-
/** 账本键:与 jobId 同构(background 通道预传入 registry id;同步完成命令用同格式生成 id)。 */
|
|
265
|
-
commandId: string;
|
|
266
|
-
/** Byte-cursor incremental read over the command's merged output (tail-ring retention; lossy reports eviction). */
|
|
267
|
-
read: (fromByte: number) => {
|
|
268
|
-
text: string;
|
|
269
|
-
nextOffset: number;
|
|
270
|
-
lossy: boolean;
|
|
271
|
-
};
|
|
272
|
-
stats: () => OutputStats;
|
|
273
|
-
/** P8 两段式 ^C 中断(会话存活;trap-INT 走宽限 group-kill 兜底)。 */
|
|
274
|
-
interrupt: () => void;
|
|
275
|
-
/** Settles on the exit frame, or with exit null when the session dies. */
|
|
276
|
-
done: Promise<PtyJobResult>;
|
|
277
|
-
}
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region src/remote/process.d.ts
|
|
280
|
-
declare const PROCESS_CLEANUP_BOUND_MS: number;
|
|
281
|
-
interface ProcessOptions {
|
|
282
|
-
stdin?: string;
|
|
283
|
-
timeoutSec?: number;
|
|
284
|
-
cwd?: string;
|
|
285
|
-
/** Hub retains raw bytes; native transports retain decoded UTF16 units. */
|
|
286
|
-
unit?: 'bytes' | 'utf16';
|
|
287
|
-
onOutput?: () => void;
|
|
288
|
-
/** Overlay on process.env (tool-built values only, e.g. RSYNC_RSH). */
|
|
289
|
-
env?: NodeJS.ProcessEnv;
|
|
613
|
+
/** 每 Agent 一个(driver 私有):tool-owned 0700 socket 目录 + 按连接身份的 socket 名。
|
|
614
|
+
* 目录名含随机 owner 后缀,跨 Agent 天然不共享;dispose 逐 socket `-O exit` 后整目录删除。 */
|
|
615
|
+
declare class SshMux {
|
|
616
|
+
private readonly persistSec;
|
|
617
|
+
private readonly rootDir;
|
|
618
|
+
private readonly runner;
|
|
619
|
+
private readonly owner;
|
|
620
|
+
private readonly sockets;
|
|
621
|
+
private dir;
|
|
622
|
+
private disposal;
|
|
623
|
+
constructor(options?: SshMuxOptions);
|
|
624
|
+
/** 注入 SSH argv 的 MUX 选项(trusted internal argv,非模型输入)。目录懒建(纯 docker/hub
|
|
625
|
+
* Agent 永不触盘);超限/已 dispose 返回 [] = 诚实退化为普通连接。 */
|
|
626
|
+
argvFor(identity: SshMuxIdentity): string[];
|
|
627
|
+
/** Teardown:先 `-O exit` 逐 socket 礼貌拆除 master(不拨号、5s 上限、错误全吞——
|
|
628
|
+
* master 已死/残 socket 属正常),再删目录。单飞(重复调用同一 Promise)。 */
|
|
629
|
+
dispose(): Promise<void>;
|
|
290
630
|
}
|
|
291
|
-
/** Real detached process. Completion includes group cleanup, even after its leader closes. */
|
|
292
|
-
declare function startBinaryProcess(argv: string[], options?: Pick<ProcessOptions, 'cwd' | 'timeoutSec' | 'env'>): {
|
|
293
|
-
stdout: Readable;
|
|
294
|
-
stderr: Readable;
|
|
295
|
-
stdin: Writable;
|
|
296
|
-
cancel(): void;
|
|
297
|
-
done: RemoteProcess['done'];
|
|
298
|
-
diagnostic(): string | undefined;
|
|
299
|
-
};
|
|
300
|
-
/** Text adapter over the same owned process-group lifecycle as binary pipelines. */
|
|
301
|
-
declare function startOneShot(argv: string[], options?: ProcessOptions): RemoteProcess;
|
|
302
631
|
//#endregion
|
|
303
632
|
//#region src/remote/oneshot.d.ts
|
|
304
633
|
interface OneShotOptions {
|
|
@@ -319,6 +648,8 @@ interface ProbeOptions {
|
|
|
319
648
|
connectTimeoutSec?: number;
|
|
320
649
|
hardTimeoutSec?: number;
|
|
321
650
|
runner?: (argv: string[], opts?: OneShotOptions) => Promise<OneShotResult>;
|
|
651
|
+
/** Task E:SSH 探测与 oneshot 执行链共用 MUX(同一身份 → 同一 master,探测零额外握手)。 */
|
|
652
|
+
muxArgvFor?: (plan: TargetPlan) => readonly string[];
|
|
322
653
|
}
|
|
323
654
|
//#endregion
|
|
324
655
|
//#region src/remote/roster.d.ts
|
|
@@ -380,25 +711,39 @@ interface RemoteDriverOptions {
|
|
|
380
711
|
getHub?: () => HubRemoteTransport | undefined;
|
|
381
712
|
execTimeoutSec?: number;
|
|
382
713
|
idleTtlSec?: number;
|
|
383
|
-
maxOutputChars?: number;
|
|
384
714
|
onAudit?: (r: RemoteAuditRecord) => void;
|
|
385
715
|
oneshotArgvFor?: (plan: TargetPlan, cmd: string, options: {
|
|
386
716
|
cleanupTag?: string;
|
|
717
|
+
muxArgv?: readonly string[];
|
|
387
718
|
}) => string[];
|
|
388
719
|
ptyArgvFor?: (plan: TargetPlan) => string[];
|
|
389
720
|
spawnArgvFor?: (spawnCommand: string) => string[];
|
|
721
|
+
/** 测试/验收缝:hub PTY 泵 argv(默认 buildHubPtyArgv + 宿主树 ws 解析)。 */
|
|
722
|
+
hubPtyArgvFor?: (endpoint: HubPtyEndpoint) => string[];
|
|
390
723
|
probeRunner?: ProbeOptions['runner'];
|
|
391
724
|
/** 测试/验收缝:helper 资产来源(默认 lib 旁挂 helper-bin);显式 null 强制 shim 路径。 */
|
|
392
725
|
helperAssetsFor?: () => HelperAssets | null;
|
|
726
|
+
/** 测试/验收缝:SSH oneshot MUX 状态(默认每 driver 一个 SshMux = 每 Agent 隔离)。 */
|
|
727
|
+
sshMux?: SshMux;
|
|
393
728
|
/** 测试缝:roster 扫描执行器(裸名解析复用)。 */
|
|
394
729
|
rosterRunner?: RosterOptions['runner'];
|
|
395
730
|
/** 测试缝:ssh config 读取(裸名解析复用)。 */
|
|
396
731
|
sshConfigReader?: () => Promise<string>;
|
|
397
732
|
}
|
|
733
|
+
/** hub PTY 泵资产:pump 与本模块同目录(npm 包与 Super 闭包同构,helper.ts 同款纪律)。
|
|
734
|
+
* ws 模块路径由 transport 侧(superd-hub 上下文,分叉的 proven 解析链)解析后经
|
|
735
|
+
* ptyEndpoint 传入——闭包自身子树无可解析的 ws,按名解析不在闭包里做(0.3.2-c 定稿)。 */
|
|
736
|
+
declare function hubPtyAssets(): {
|
|
737
|
+
pumpPath: string;
|
|
738
|
+
};
|
|
398
739
|
/** 双轨调度器:参数校验 → 目标语法(parseTargetForm)→ 统一 label 池 → oneshot 子进程 / pty 会话池。 */
|
|
399
740
|
declare class RemoteDriver {
|
|
400
741
|
private readonly opts;
|
|
401
742
|
private readonly pool;
|
|
743
|
+
/** 默认 PTY 槽(spec remote-default-pty §1):sessionKey → 归一 machineKey → pool key。
|
|
744
|
+
* 会话本体是普通 PtySession(id 创建即认领,roster 全可见);槽登记在 dispose/TTL 后悬空,
|
|
745
|
+
* 取槽时经 pool.get(disposed 视同出池)惰性清理。 */
|
|
746
|
+
private readonly defaultSlots;
|
|
402
747
|
private readonly labels;
|
|
403
748
|
private readonly hubOwner;
|
|
404
749
|
private readonly hubProviders;
|
|
@@ -411,6 +756,7 @@ declare class RemoteDriver {
|
|
|
411
756
|
private readonly runnerOf;
|
|
412
757
|
private disposal;
|
|
413
758
|
private readonly ptyIdleTtlSec;
|
|
759
|
+
private readonly mux;
|
|
414
760
|
constructor(opts?: RemoteDriverOptions);
|
|
415
761
|
call(params: RemoteCallParams, callCtx?: {
|
|
416
762
|
sessionKey?: string;
|
|
@@ -449,6 +795,10 @@ declare class RemoteDriver {
|
|
|
449
795
|
private planOf;
|
|
450
796
|
/** ssh:<name> 的池感知解析:BYO 身份 → 其 connection;否则按 config 别名/主机名。 */
|
|
451
797
|
private sshPlanFor;
|
|
798
|
+
/** Task E MUX 身份:仅 SSH plan 注入(docker/incus/hub 返回 undefined)。身份键 = 原始
|
|
799
|
+
* target 串 + 有效连接字段(host/user/port/key/ProxyJump)——同身份共享 master,跨身份
|
|
800
|
+
* 不串 socket;目录/寿命/拆除全部由 SshMux 自持。 */
|
|
801
|
+
private muxArgvFor;
|
|
452
802
|
/** BYO ssh 注册(v2:无 spec 对比——label 占用即拒;注册成功才认领)。返回实际名(label 或 s-id)。 */
|
|
453
803
|
private registerByoSsh;
|
|
454
804
|
/** PTY 会话创建(native/spawn 同一形状):上限 → label 认领 → 惰性会话(失败由 onDead 释放 label)。 */
|
|
@@ -456,8 +806,36 @@ declare class RemoteDriver {
|
|
|
456
806
|
private ttlMinutes;
|
|
457
807
|
/** connection 由 BYO ssh 身份建立 → card 面标 `(built on)`(与 roster 同词,R2 复核 P2-10)。 */
|
|
458
808
|
private isBuiltOn;
|
|
459
|
-
/** PTY 创建形唯一实现(execute 与 background 预建共用):spawn BYO
|
|
809
|
+
/** PTY 创建形唯一实现(execute 与 background 预建共用):spawn BYO(spec 2026-11-01:native `:pty`/hub-pty 创建语法已删,machine 会话经默认槽 + handoff)。 */
|
|
460
810
|
private createPtyLane;
|
|
811
|
+
/** 池条目的槽键归一:同一实体(host/container/machine 身份)跨裸名/前缀/撞名前缀共享同一默认槽。 */
|
|
812
|
+
private machineKeyOfEntry;
|
|
813
|
+
/** 默认槽的 machine 规格:归一 key + 创建 argv + 展示 connection(hub 每次经 ptyEndpoint 重验 pairing,P10)。 */
|
|
814
|
+
private machineSlotSpec;
|
|
815
|
+
/** 取/懒建 machine 的默认 PTY 槽:dead/disposed 槽惰性重建;id 创建即认领(roster 全可见 + 防撞)。 */
|
|
816
|
+
private defaultSlot;
|
|
817
|
+
private releaseDefaultSlot;
|
|
818
|
+
/** 按池键反查并解绑默认槽(background 提交即 handoff 用);非槽会话无操作。 */
|
|
819
|
+
private releaseSlotByPoolKey;
|
|
820
|
+
/** roster/status 面:本 session 的默认槽标注(session id → machineKey;悬空条目过滤)。 */
|
|
821
|
+
private defaultMarks;
|
|
822
|
+
/** spec §1 handoff(2026-11-01 二/三轮裁决):把 machine 默认 PTY 解绑成可寻址 pty:<id>——同引用移动
|
|
823
|
+
* (不重启、不复制输出流);fresh(尚无默认槽)= 后台创建空闲 shell 再隔离(默认 PTY 思维模型恒
|
|
824
|
+
* ready,创建时机是实现细节);busy = 附当前命令与 job 句柄。machine 下次 exec 按需新建默认 PTY。 */
|
|
825
|
+
handoff(target: string, callCtx?: {
|
|
826
|
+
sessionKey?: string;
|
|
827
|
+
}): Promise<RemoteCallResult>;
|
|
828
|
+
/** close 统一入口(spec §1 + 三轮补充裁决):machine target 只关默认槽;pty selector 关该会话;
|
|
829
|
+
* 不存在 job 定位——取消运行中命令的唯一入口是官方 job_kill。 */
|
|
830
|
+
close(target: string, sessionKey: string, force?: boolean): Promise<{
|
|
831
|
+
session: string;
|
|
832
|
+
connection: string;
|
|
833
|
+
closed: boolean;
|
|
834
|
+
reason?: string;
|
|
835
|
+
killed: string[];
|
|
836
|
+
message?: string;
|
|
837
|
+
}>;
|
|
838
|
+
private closeDefault;
|
|
461
839
|
/** background PTY lane:会话先占位(不拨号)再进官方 jobs registry——首回执必须能寻址;
|
|
462
840
|
* registry 拒绝时把新建的会话拆掉(复用形的会话绝不拆)。返回 undefined = 走普通 oneshot job。 */
|
|
463
841
|
preparePtyLane(params: RemoteCallParams, callCtx?: {
|
|
@@ -482,6 +860,15 @@ declare class RemoteDriver {
|
|
|
482
860
|
};
|
|
483
861
|
/** job 通道收养回填(timeout handoff 时 registry id ≠ commandId,账本记录两者)。 */
|
|
484
862
|
attachPtyJob(commandId: string, jobId: string, sessionKey: string): void;
|
|
863
|
+
/** spec remote-default-pty §1(2026-11-01):exec stdin-only 写入核心——向已有 live PTY 的当前运行命令
|
|
864
|
+
* 追加 exact-byte stdin。寻址:pty:<id|label> / 裸 label 命中 pty 项 / machine target(其默认槽的
|
|
865
|
+
* 当前命令,无槽不懒建、如实报错)。不触发拨号、创建或重连;回执附 connection/label 供工具层渲染。 */
|
|
866
|
+
input(target: string, options: PtyInputOptions, callCtx?: {
|
|
867
|
+
sessionKey?: string;
|
|
868
|
+
}): Promise<PtyInputReceipt & {
|
|
869
|
+
connection: string;
|
|
870
|
+
label?: string;
|
|
871
|
+
}>;
|
|
485
872
|
private dispatchPty;
|
|
486
873
|
/** 预热(创建形无 cmd)回执:§3——无 commandId/envDelta;timeout 忽略。 */
|
|
487
874
|
private warmReceipt;
|
|
@@ -512,116 +899,6 @@ declare class RemoteDriver {
|
|
|
512
899
|
dispose(): Promise<void>;
|
|
513
900
|
}
|
|
514
901
|
//#endregion
|
|
515
|
-
//#region src/remote/hub-contract.d.ts
|
|
516
|
-
interface RemoteInput {
|
|
517
|
-
target?: string;
|
|
518
|
-
spawn?: string;
|
|
519
|
-
ssh?: SshConnection;
|
|
520
|
-
cmd?: string;
|
|
521
|
-
scriptPath?: string;
|
|
522
|
-
stdin?: string;
|
|
523
|
-
mode?: 'oneshot' | 'pty';
|
|
524
|
-
timeout?: number;
|
|
525
|
-
}
|
|
526
|
-
interface PreparedRemoteInput {
|
|
527
|
-
target?: string;
|
|
528
|
-
spawn?: string;
|
|
529
|
-
ssh?: SshConnection;
|
|
530
|
-
cmd: string;
|
|
531
|
-
stdin?: string;
|
|
532
|
-
mode?: 'oneshot' | 'pty';
|
|
533
|
-
timeout?: number;
|
|
534
|
-
}
|
|
535
|
-
/** Counters exclude diagnostic banners. dropped is ring eviction; total-returned is all omitted output. */
|
|
536
|
-
type OutputStats = {
|
|
537
|
-
unit: 'utf16' | 'bytes';
|
|
538
|
-
total: number;
|
|
539
|
-
retained: number;
|
|
540
|
-
dropped: number;
|
|
541
|
-
returned: number;
|
|
542
|
-
retentionLimit: number;
|
|
543
|
-
};
|
|
544
|
-
type StreamOutputStats = {
|
|
545
|
-
stdout: OutputStats;
|
|
546
|
-
stderr?: OutputStats;
|
|
547
|
-
};
|
|
548
|
-
interface RemoteProcess {
|
|
549
|
-
cancel(reason?: string): void;
|
|
550
|
-
done: Promise<{
|
|
551
|
-
exit: number | null;
|
|
552
|
-
timedOut: boolean;
|
|
553
|
-
durationMs: number;
|
|
554
|
-
cancelled?: boolean;
|
|
555
|
-
}>;
|
|
556
|
-
/** diagnostic is executor-generated text, not process output; excluded from byte cursor and counters. */
|
|
557
|
-
read(channel: 'stdout' | 'stderr', fromByte: number): {
|
|
558
|
-
text: string;
|
|
559
|
-
nextOffset: number;
|
|
560
|
-
lossy: boolean;
|
|
561
|
-
stats?: OutputStats;
|
|
562
|
-
diagnostic?: string;
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
interface BinaryFileEndpoint {
|
|
566
|
-
exportTree(path: string, signal: AbortSignal): Promise<NodeJS.ReadableStream>;
|
|
567
|
-
importTree(path: string, source: NodeJS.ReadableStream, options: {
|
|
568
|
-
mkdir: boolean;
|
|
569
|
-
signal: AbortSignal;
|
|
570
|
-
}): Promise<void>;
|
|
571
|
-
digest(path: string, signal: AbortSignal, selection?: readonly string[]): Promise<{
|
|
572
|
-
sha256: string;
|
|
573
|
-
bytes: number;
|
|
574
|
-
entries: number;
|
|
575
|
-
}>;
|
|
576
|
-
}
|
|
577
|
-
interface HubTarget {
|
|
578
|
-
id: string;
|
|
579
|
-
label: string;
|
|
580
|
-
execEnabled: boolean;
|
|
581
|
-
}
|
|
582
|
-
interface HubRemoteTransport {
|
|
583
|
-
protocol: 1;
|
|
584
|
-
listTargets(): readonly HubTarget[];
|
|
585
|
-
start(machine: string, input: PreparedRemoteInput, owner: string): Promise<RemoteProcess>;
|
|
586
|
-
pty(machine: string, cmd: string, owner: string, options: {
|
|
587
|
-
stdin?: string;
|
|
588
|
-
timeout?: number;
|
|
589
|
-
}): Promise<RemoteCallResult>;
|
|
590
|
-
fileEndpoint(machine: string): BinaryFileEndpoint;
|
|
591
|
-
releaseOwner(owner: string): Promise<void>;
|
|
592
|
-
}
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/remote/output-ring.d.ts
|
|
595
|
-
/** Byte-addressed decoded output: mid-codepoint cursors skip forward and explicitly report loss. */
|
|
596
|
-
declare function readUtf8Tail(bytes: Buffer, totalBytes: number, fromByte: number): {
|
|
597
|
-
text: string;
|
|
598
|
-
nextOffset: number;
|
|
599
|
-
lossy: boolean;
|
|
600
|
-
};
|
|
601
|
-
/** Native/PTY retention is UTF16 units; cursor offsets remain real UTF8 bytes. Input is decoded text. */
|
|
602
|
-
declare class Utf16TailRing {
|
|
603
|
-
readonly capacity: number;
|
|
604
|
-
text: string;
|
|
605
|
-
total: number;
|
|
606
|
-
private totalBytes;
|
|
607
|
-
constructor(capacity?: number);
|
|
608
|
-
push(text: string): void;
|
|
609
|
-
stats(returned?: number): OutputStats;
|
|
610
|
-
read(fromByte: number): ReturnType<typeof readUtf8Tail>;
|
|
611
|
-
}
|
|
612
|
-
/** Raw byte retention for Hub oneshot. Tail/read starts skip partial UTF8 prefixes, never invent replacement characters. */
|
|
613
|
-
declare class ByteTailRing {
|
|
614
|
-
readonly capacity: number;
|
|
615
|
-
total: number;
|
|
616
|
-
private chunks;
|
|
617
|
-
private retained;
|
|
618
|
-
constructor(capacity?: number);
|
|
619
|
-
push(chunk: Buffer): void;
|
|
620
|
-
tail(maxBytes?: number): Buffer;
|
|
621
|
-
stats(returned?: number): OutputStats;
|
|
622
|
-
read(fromByte: number): ReturnType<typeof readUtf8Tail>;
|
|
623
|
-
}
|
|
624
|
-
//#endregion
|
|
625
902
|
//#region src/remote/jobs.d.ts
|
|
626
903
|
declare module '@deepseek-ai/dsh-jobs' {
|
|
627
904
|
interface JobKindMap {
|
|
@@ -660,7 +937,6 @@ declare const inject: string[];
|
|
|
660
937
|
interface RemoteRowConfig {
|
|
661
938
|
execTimeoutSec: number;
|
|
662
939
|
idleTtlSec: number;
|
|
663
|
-
maxOutputChars: number;
|
|
664
940
|
}
|
|
665
941
|
type RemoteConfigValidator = ((value?: unknown) => RemoteRowConfig) & StandardSchemaV1<unknown, RemoteRowConfig> & NativeConfigSchema;
|
|
666
942
|
declare const Config: RemoteConfigValidator;
|
|
@@ -673,4 +949,4 @@ declare const _default: {
|
|
|
673
949
|
apply: (ctx: Context, config: RemoteRowConfig) => (() => void);
|
|
674
950
|
};
|
|
675
951
|
//#endregion
|
|
676
|
-
export { type BinaryFileEndpoint, ByteTailRing, Config, FILE_FRAME_BYTES, FILE_MAX_ENTRIES, FILE_MAX_METADATA, type HubRemoteTransport, type HubTarget, type OutputStats, PROCESS_CLEANUP_BOUND_MS, type PreparedRemoteInput, RemoteConfigValidator, type RemoteInput, type RemoteProcess, RemoteRowConfig, type RsyncEndpoint, type RsyncReceipt, type RsyncRequest, type SshConnection, type StreamOutputStats, Utf16TailRing, apply, checkAbsolute, checkSelection, _default as default, inject, localFileEndpoint, name, readUtf8Tail, runFileWorker, runRsync, sshArgv, startBinaryProcess, startOneShot, startRemoteJob };
|
|
952
|
+
export { type BinaryFileEndpoint, ByteTailRing, Config, FILE_FRAME_BYTES, FILE_MAX_ENTRIES, FILE_MAX_METADATA, type HubPtyEndpoint, type HubRemoteTransport, type HubTarget, type OutputStats, PROCESS_CLEANUP_BOUND_MS, type PreparedRemoteInput, type PtyDispatchResult, PtySession, RemoteConfigValidator, type RemoteInput, type RemoteProcess, RemoteRowConfig, type RsyncEndpoint, type RsyncReceipt, type RsyncRequest, type SshConnection, type StreamOutputStats, Utf16TailRing, apply, buildHubPtyArgv, checkAbsolute, checkSelection, _default as default, disclose, hubPtyAssets, inject, localFileEndpoint, name, readUtf8Tail, runFileWorker, runRsync, sshArgv, startBinaryProcess, startOneShot, startRemoteJob };
|