dsh-deeppilot 0.9.11 → 0.9.14
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/COMPATIBILITY.md +174 -19
- package/README.md +25 -18
- package/README.zh-CN.md +20 -16
- package/bin/SHA256SUMS +6 -6
- package/bin/darwin-amd64/dsh-deeppilot-tunnel +0 -0
- package/bin/darwin-arm64/dsh-deeppilot-tunnel +0 -0
- package/bin/linux-amd64/dsh-deeppilot-tunnel +0 -0
- package/bin/linux-arm64/dsh-deeppilot-tunnel +0 -0
- package/bin/windows-amd64/dsh-deeppilot-tunnel.exe +0 -0
- package/bin/windows-arm64/dsh-deeppilot-tunnel.exe +0 -0
- package/docs/DSH_022_FEATURES.md +78 -0
- package/docs/DSH_RELEASE_MEMORY.md +447 -14
- package/docs/NPM_PUBLISHING.md +53 -1
- package/lib/client.js +525 -341
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +381 -35
- package/lib/index.js +2820 -254
- package/lib/index.js.map +1 -1
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +26 -22
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
-
//#region src/device-auth.d.ts
|
|
4
3
|
declare const DEVICE_SCOPES: readonly ['sessions.read', 'prompt.send', 'sessions.manage', 'interactions.respond', 'notifications.register', 'schedule.manage'];
|
|
5
4
|
type DeviceScope = (typeof DEVICE_SCOPES)[number];
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/wire-errors.d.ts
|
|
8
5
|
/**
|
|
9
6
|
* 错误词表(error vocabulary)的唯一属主。
|
|
10
7
|
*
|
|
@@ -30,10 +27,10 @@ declare const ERROR_CODES: {
|
|
|
30
27
|
readonly E_BUSY: 'session is busy';
|
|
31
28
|
readonly E_UNSUPPORTED: 'protocol version or capability unsupported';
|
|
32
29
|
readonly E_INTERNAL: 'internal error';
|
|
30
|
+
readonly E_STEER_UNAVAILABLE: 'queued item can no longer steer the current turn';
|
|
31
|
+
readonly E_TOO_LARGE: 'response exceeds the client frame limit';
|
|
33
32
|
};
|
|
34
33
|
type WireErrorCode = keyof typeof ERROR_CODES;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/dispatch-journal.d.ts
|
|
37
34
|
/** 落盘条目:两个通用字段 + codec 私有字段。 */
|
|
38
35
|
interface JournalEntry {
|
|
39
36
|
fingerprint: string;
|
|
@@ -201,8 +198,6 @@ type MutationDispatchResult<T> = {
|
|
|
201
198
|
message?: string;
|
|
202
199
|
replayed?: boolean;
|
|
203
200
|
};
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/command-api.d.ts
|
|
206
201
|
interface CommandSummary {
|
|
207
202
|
name: string;
|
|
208
203
|
description: string;
|
|
@@ -241,8 +236,119 @@ interface PermissionCatalog {
|
|
|
241
236
|
options: PermissionOption[];
|
|
242
237
|
currentValue?: string;
|
|
243
238
|
}
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
/**
|
|
240
|
+
* `format` 缺省为 `zip`,与扩展出现前的行为逐字节相同;`markdown` 需要
|
|
241
|
+
* `welcome.capabilities.sessionMarkdown`,否则 Bridge 回 E_UNSUPPORTED。
|
|
242
|
+
* 不认识该字段的旧 Bridge 会忽略它并照常返回 ZIP,所以客户端必须先看能力位。
|
|
243
|
+
*/
|
|
244
|
+
type SessionExportFormat = 'zip' | 'markdown';
|
|
245
|
+
/** `at` 的本地日历写法;与 DSH `LocalAtInput` 一一对应。 */
|
|
246
|
+
interface HostScheduleLocalAt {
|
|
247
|
+
date: string;
|
|
248
|
+
time: string;
|
|
249
|
+
time_zone: string;
|
|
250
|
+
}
|
|
251
|
+
type HostScheduleTiming = {
|
|
252
|
+
kind: 'after';
|
|
253
|
+
after_seconds: number;
|
|
254
|
+
} | {
|
|
255
|
+
kind: 'at';
|
|
256
|
+
at: string | HostScheduleLocalAt;
|
|
257
|
+
} | {
|
|
258
|
+
kind: 'every';
|
|
259
|
+
every_seconds: number;
|
|
260
|
+
} | {
|
|
261
|
+
kind: 'daily';
|
|
262
|
+
daily: {
|
|
263
|
+
time: string;
|
|
264
|
+
time_zone: string;
|
|
265
|
+
};
|
|
266
|
+
} | {
|
|
267
|
+
kind: 'weekly';
|
|
268
|
+
weekly: {
|
|
269
|
+
time: string;
|
|
270
|
+
time_zone: string;
|
|
271
|
+
weekdays: number[];
|
|
272
|
+
};
|
|
273
|
+
} | {
|
|
274
|
+
kind: 'cron';
|
|
275
|
+
cron: {
|
|
276
|
+
expression: string;
|
|
277
|
+
time_zone: string;
|
|
278
|
+
};
|
|
279
|
+
} | {
|
|
280
|
+
kind: 'rrule';
|
|
281
|
+
rrule: string;
|
|
282
|
+
};
|
|
283
|
+
/** `new_once` / `new` 目标建会话时的工作目录与预设(省略用 Host 默认)。 */
|
|
284
|
+
interface HostScheduleCreateSpec {
|
|
285
|
+
cwd?: string;
|
|
286
|
+
agentPreset?: string;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* 任务视图里的交付目标。`new_once` 的 `sessionId` 是 Host 创建时预留的会话,
|
|
290
|
+
* 首次投递后目标会转成 `session`。
|
|
291
|
+
*/
|
|
292
|
+
type HostScheduleTarget = {
|
|
293
|
+
kind: 'session';
|
|
294
|
+
sessionId: string;
|
|
295
|
+
} | {
|
|
296
|
+
kind: 'new_once';
|
|
297
|
+
sessionId: string;
|
|
298
|
+
create?: HostScheduleCreateSpec;
|
|
299
|
+
} | {
|
|
300
|
+
kind: 'new';
|
|
301
|
+
create?: HostScheduleCreateSpec;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* 创建/编辑请求里客户端可给出的目标:`new_once` 的会话由 Host 预留,客户端不填
|
|
305
|
+
* `sessionId`。
|
|
306
|
+
*/
|
|
307
|
+
type HostScheduleTargetRequest = {
|
|
308
|
+
kind: 'session';
|
|
309
|
+
sessionId: string;
|
|
310
|
+
} | {
|
|
311
|
+
kind: 'new_once';
|
|
312
|
+
create?: HostScheduleCreateSpec;
|
|
313
|
+
} | {
|
|
314
|
+
kind: 'new';
|
|
315
|
+
create?: HostScheduleCreateSpec;
|
|
316
|
+
};
|
|
317
|
+
/** 最近一次已确认投递的回执;不含 prompt 正文。 */
|
|
318
|
+
interface HostScheduleDeliveryReceipt {
|
|
319
|
+
scheduledAt: string;
|
|
320
|
+
deliveredAt: string;
|
|
321
|
+
messageId: string;
|
|
322
|
+
targetSessionId: string;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* 宿主级任务视图。可选字段(createdAt/updatedAt/executionActive/
|
|
326
|
+
* deliveryFloorEndsAt/lastDelivery)客户端不得依赖;`involvedSessionIds` 是
|
|
327
|
+
* Host 内部字段,Bridge 不返回。
|
|
328
|
+
*/
|
|
329
|
+
interface HostScheduleTask {
|
|
330
|
+
id: string;
|
|
331
|
+
title: string;
|
|
332
|
+
prompt: string;
|
|
333
|
+
timing: HostScheduleTiming;
|
|
334
|
+
target: HostScheduleTarget;
|
|
335
|
+
status: 'active' | 'paused' | 'ended';
|
|
336
|
+
scheduledAt: string;
|
|
337
|
+
createdAt?: string;
|
|
338
|
+
updatedAt?: string;
|
|
339
|
+
executionActive?: boolean;
|
|
340
|
+
deliveryFloorEndsAt?: string;
|
|
341
|
+
lastDelivery?: HostScheduleDeliveryReceipt;
|
|
342
|
+
}
|
|
343
|
+
/** 编辑补丁:至少一个字段;省略的字段保持原值。 */
|
|
344
|
+
interface HostSchedulePatch {
|
|
345
|
+
title?: string;
|
|
346
|
+
prompt?: string;
|
|
347
|
+
timing?: HostScheduleTiming;
|
|
348
|
+
target?: HostScheduleTargetRequest;
|
|
349
|
+
/** false 暂停、true 恢复。 */
|
|
350
|
+
active?: boolean;
|
|
351
|
+
}
|
|
246
352
|
interface WelcomeCapabilities {
|
|
247
353
|
/** 会话命令目录、执行、权限与原生日志导出入口。缺省不支持。 */
|
|
248
354
|
commands?: boolean;
|
|
@@ -268,6 +374,10 @@ interface WelcomeCapabilities {
|
|
|
268
374
|
projectSelection: boolean;
|
|
269
375
|
/** Host exposes the optional DSH Schedule service. */
|
|
270
376
|
schedules?: boolean;
|
|
377
|
+
/** 宿主级计划任务模型(DSH 0.2.2-alpha.3 起):true 时
|
|
378
|
+
* 「Schedule 宿主级任务扩展」帧可用,schedulesHost=false/缺失时客户端只能
|
|
379
|
+
* 使用会话级 schedule 帧。与 `schedules` 相互独立(后者只表示服务存在)。 */
|
|
380
|
+
schedulesHost?: boolean;
|
|
271
381
|
/** Bridge has APNs configured; clients may send c2s.push.register. */
|
|
272
382
|
push?: boolean;
|
|
273
383
|
widgetPush?: boolean;
|
|
@@ -276,6 +386,26 @@ interface WelcomeCapabilities {
|
|
|
276
386
|
* deleting its local credentials. Absent on older bridges; older clients
|
|
277
387
|
* ignore the extra field. */
|
|
278
388
|
deviceRevoke?: boolean;
|
|
389
|
+
/** Host exposes DSH session.updateQueue and the inbox projection: running
|
|
390
|
+
* sessions accept mode:"steer", s2c.session.queue snapshots are pushed and
|
|
391
|
+
* c2s.session.queue.update is served. Absent ⇒ running sessions only stop. */
|
|
392
|
+
promptQueue?: boolean;
|
|
393
|
+
/** Bridge pushes s2c.session.delta while a turn runs: transient assistant and
|
|
394
|
+
* reasoning increments that never occupy a replay seq. Absent ⇒ the client
|
|
395
|
+
* keeps the old "text appears when the step lands" rendering. */
|
|
396
|
+
assistantStream?: boolean;
|
|
397
|
+
/** Bridge serves c2s.session.export with format:"markdown" (the host's
|
|
398
|
+
* /api/session.markdown route). Absent ⇒ only the ZIP archive is available. */
|
|
399
|
+
sessionMarkdown?: boolean;
|
|
400
|
+
/** Bridge serves c2s.plugin.update.check / c2s.plugin.update.apply, letting
|
|
401
|
+
* the phone replace this plugin with a published version. Absent ⇒ the phone
|
|
402
|
+
* can only link out to npm. */
|
|
403
|
+
pluginUpdate?: boolean;
|
|
404
|
+
/** Bridge answers c2s.session.export / c2s.session.attachment requests that
|
|
405
|
+
* carry `binary: true` with binary frames (raw bytes after a JSON header,
|
|
406
|
+
* see binary-frame.ts). Plugin-level, independent of the host. Absent ⇒ the
|
|
407
|
+
* client must keep requesting base64 text frames. */
|
|
408
|
+
binaryFrames?: boolean;
|
|
279
409
|
}
|
|
280
410
|
type SessionStatus = "running" | "idle" | "error" | "unknown";
|
|
281
411
|
/**
|
|
@@ -348,6 +478,21 @@ interface SessionSummary {
|
|
|
348
478
|
}
|
|
349
479
|
type MessageRole = 'user' | 'assistant' | 'tool' | 'system' | 'error';
|
|
350
480
|
type ToolState = 'running' | 'ok' | 'error';
|
|
481
|
+
/**
|
|
482
|
+
* 文件编辑类工具调用的改动内容(v2 追加式扩展,见 PROTOCOL.md「工具改动对比」)。
|
|
483
|
+
* Bridge 把宿主 `str_replace_editor` 的参数名(old_str/new_str/file_text/insert_line)
|
|
484
|
+
* 归一化成这里的字段,手机端不依赖宿主工具参数命名。`oldText` / `newText` 各自超过
|
|
485
|
+
* 16 KiB(UTF-8)时都不发,只带 `truncated: true`。
|
|
486
|
+
*/
|
|
487
|
+
interface ToolEditProjection {
|
|
488
|
+
path: string;
|
|
489
|
+
operation: 'replace' | 'create' | 'insert';
|
|
490
|
+
oldText?: string;
|
|
491
|
+
newText?: string;
|
|
492
|
+
/** `insert` 专用:在该行之后插入,0 表示文件开头。 */
|
|
493
|
+
insertLine?: number;
|
|
494
|
+
truncated?: boolean;
|
|
495
|
+
}
|
|
351
496
|
/** Provenance of host-injected context; present only on `role: "system"` rows.
|
|
352
497
|
* Mirrors the durable DSH message source (`dsh-llm` MessageSource): `label`
|
|
353
498
|
* names the producer (plugin name, skill name, instruction paths…), `form` is
|
|
@@ -381,6 +526,7 @@ interface MessageProjection {
|
|
|
381
526
|
name: string;
|
|
382
527
|
state: ToolState;
|
|
383
528
|
summary: string;
|
|
529
|
+
edit?: ToolEditProjection;
|
|
384
530
|
};
|
|
385
531
|
attachments?: MessageAttachment[];
|
|
386
532
|
/** Present only on system rows: provenance of the injected context.
|
|
@@ -442,8 +588,6 @@ interface PendingSnapshotPayload {
|
|
|
442
588
|
approvals: PendingApprovalPayload[];
|
|
443
589
|
questions: PendingQuestionPayload[];
|
|
444
590
|
}
|
|
445
|
-
//#endregion
|
|
446
|
-
//#region src/host-api.d.ts
|
|
447
591
|
interface CommandsApiLike {
|
|
448
592
|
list(req: RpcRequestLike<{
|
|
449
593
|
sessionId: string;
|
|
@@ -462,8 +606,10 @@ interface CommandsApiLike {
|
|
|
462
606
|
text: string;
|
|
463
607
|
category?: string;
|
|
464
608
|
}>): Promise<RpcResponseLike<void>>;
|
|
609
|
+
readonly markdownAvailable?: boolean;
|
|
465
610
|
export(req: RpcRequestLike<{
|
|
466
611
|
sessionId: string;
|
|
612
|
+
format?: SessionExportFormat;
|
|
467
613
|
}>, signal: AbortSignal): Promise<Response>;
|
|
468
614
|
}
|
|
469
615
|
interface RpcOk<T> {
|
|
@@ -549,6 +695,11 @@ interface SessionsApiLike {
|
|
|
549
695
|
};
|
|
550
696
|
data: string;
|
|
551
697
|
}>>;
|
|
698
|
+
/** Remove or steer one pending inbox item. Absent on hosts without the
|
|
699
|
+
* DSH session.updateQueue RPC; the promptQueue capability bit probes it. */
|
|
700
|
+
updateQueue?(req: RpcRequestLike<QueueUpdateArgs>): Promise<RpcResponseLike<{
|
|
701
|
+
accepted: true;
|
|
702
|
+
}>>;
|
|
552
703
|
/** Complete projection baseline for one session; null when it is gone. */
|
|
553
704
|
projections(req: RpcRequestLike<{
|
|
554
705
|
sessionId: string;
|
|
@@ -611,7 +762,10 @@ interface ScheduleHistoryViewLike {
|
|
|
611
762
|
};
|
|
612
763
|
nextBefore?: string;
|
|
613
764
|
}
|
|
614
|
-
|
|
765
|
+
/** 会话级 Schedule 服务(DSH ≤ 0.2.2-alpha.2):任务绑定单一 Session。 */
|
|
766
|
+
interface LegacyScheduleApiLike {
|
|
767
|
+
/** 判别位缺省即 legacy:旧宿主与既有测试夹具不必补字段。 */
|
|
768
|
+
readonly mode?: 'legacy';
|
|
615
769
|
list(req: RpcRequestLike<{
|
|
616
770
|
sessionId: string;
|
|
617
771
|
}>): Promise<RpcResponseLike<{
|
|
@@ -655,6 +809,107 @@ interface ScheduleApiLike {
|
|
|
655
809
|
code?: string;
|
|
656
810
|
}>>;
|
|
657
811
|
}
|
|
812
|
+
/** 宿主级任务视图:与 wire 的 `HostScheduleTask` 同一形状(Bridge 直接透传)。 */
|
|
813
|
+
type HostScheduleTaskView = HostScheduleTask;
|
|
814
|
+
interface HostScheduleListRequestLike {
|
|
815
|
+
/** true 只列运行中;false 只列暂停/结束;省略列全部。 */
|
|
816
|
+
active?: boolean;
|
|
817
|
+
limit?: number;
|
|
818
|
+
offset?: number;
|
|
819
|
+
}
|
|
820
|
+
interface HostScheduleListResultLike {
|
|
821
|
+
tasks: HostScheduleTaskView[];
|
|
822
|
+
shown: number;
|
|
823
|
+
total: number;
|
|
824
|
+
limit: number;
|
|
825
|
+
offset: number;
|
|
826
|
+
}
|
|
827
|
+
/** 查看结果:命中或非变更 miss(Host 用 code 表示 miss,不是抛错)。 */
|
|
828
|
+
type HostScheduleViewOutcome = {
|
|
829
|
+
kind: 'task';
|
|
830
|
+
task: HostScheduleTaskView;
|
|
831
|
+
} | {
|
|
832
|
+
kind: 'not-found';
|
|
833
|
+
id: string;
|
|
834
|
+
};
|
|
835
|
+
/** 编辑结果:更新后的任务、已删除、miss,或乐观锁冲突(wire 上回 E_BUSY)。 */
|
|
836
|
+
type HostScheduleEditOutcome = {
|
|
837
|
+
kind: 'task';
|
|
838
|
+
task: HostScheduleTaskView;
|
|
839
|
+
} | {
|
|
840
|
+
kind: 'deleted';
|
|
841
|
+
id: string;
|
|
842
|
+
} | {
|
|
843
|
+
kind: 'not-found';
|
|
844
|
+
id: string;
|
|
845
|
+
} | {
|
|
846
|
+
kind: 'conflict';
|
|
847
|
+
id: string;
|
|
848
|
+
};
|
|
849
|
+
/** 手动执行结果:已投递、已有执行在进行中(E_BUSY),或目标已不存在。 */
|
|
850
|
+
type HostScheduleRunOutcome = {
|
|
851
|
+
kind: 'task';
|
|
852
|
+
task: HostScheduleTaskView;
|
|
853
|
+
} | {
|
|
854
|
+
kind: 'pending';
|
|
855
|
+
id: string;
|
|
856
|
+
} | {
|
|
857
|
+
kind: 'not-found';
|
|
858
|
+
id: string;
|
|
859
|
+
};
|
|
860
|
+
/** 清理已结束任务的结果:删除的条数(宿主上没有已结束任务时为 0)。 */
|
|
861
|
+
interface HostScheduleDeleteEndedResult {
|
|
862
|
+
deleted: number;
|
|
863
|
+
}
|
|
864
|
+
interface HostScheduleLimitsView {
|
|
865
|
+
/** 以新建会话方式投递的最小间隔秒数;客户端只展示,不自行节流。 */
|
|
866
|
+
newSessionIntervalSeconds: number;
|
|
867
|
+
}
|
|
868
|
+
interface HostScheduleCreateRequestLike {
|
|
869
|
+
title: string;
|
|
870
|
+
prompt: string;
|
|
871
|
+
timing: HostScheduleTiming;
|
|
872
|
+
/** 省略时由 Host 默认:首次投递新建并复用会话。 */
|
|
873
|
+
target?: HostScheduleTargetRequest;
|
|
874
|
+
}
|
|
875
|
+
type HostScheduleEditRequestLike = {
|
|
876
|
+
id: string;
|
|
877
|
+
action: 'update';
|
|
878
|
+
patch: HostSchedulePatch;
|
|
879
|
+
expectedUpdatedAt?: string | null;
|
|
880
|
+
} | {
|
|
881
|
+
id: string;
|
|
882
|
+
action: 'delete';
|
|
883
|
+
expectedUpdatedAt?: string | null;
|
|
884
|
+
};
|
|
885
|
+
/**
|
|
886
|
+
* 宿主级 Schedule 服务(DSH 0.2.2-alpha.3 起)。
|
|
887
|
+
*
|
|
888
|
+
* 探测只看形状:`edit` 存在且 `update` 不存在。`remoteXxx` 是同一服务的
|
|
889
|
+
* 「人类 Remote 调用」变体(不记录 acting Session);Bridge 就是人类 Remote
|
|
890
|
+
* 调用方,因此直接用公开方法并省略 actorSessionId。
|
|
891
|
+
*/
|
|
892
|
+
interface HostScheduleApiLike {
|
|
893
|
+
readonly mode: 'host';
|
|
894
|
+
list(req: RpcRequestLike<HostScheduleListRequestLike>): Promise<RpcResponseLike<HostScheduleListResultLike>>;
|
|
895
|
+
view(req: RpcRequestLike<{
|
|
896
|
+
id: string;
|
|
897
|
+
}>): Promise<RpcResponseLike<HostScheduleViewOutcome>>;
|
|
898
|
+
create(req: RpcRequestLike<HostScheduleCreateRequestLike>): Promise<RpcResponseLike<HostScheduleTaskView>>;
|
|
899
|
+
edit(req: RpcRequestLike<HostScheduleEditRequestLike>): Promise<RpcResponseLike<HostScheduleEditOutcome>>;
|
|
900
|
+
run(req: RpcRequestLike<{
|
|
901
|
+
id: string;
|
|
902
|
+
}>): Promise<RpcResponseLike<HostScheduleRunOutcome>>;
|
|
903
|
+
history(req: RpcRequestLike<{
|
|
904
|
+
id: string;
|
|
905
|
+
limit: number;
|
|
906
|
+
before?: string;
|
|
907
|
+
}>): Promise<RpcResponseLike<ScheduleHistoryViewLike>>;
|
|
908
|
+
limits(req: RpcRequestLike<Record<string, never>>): Promise<RpcResponseLike<HostScheduleLimitsView>>;
|
|
909
|
+
/** 删除宿主上全部 `status="ended"` 的任务;进行中与暂停的任务不受影响。 */
|
|
910
|
+
deleteEnded(req: RpcRequestLike<Record<string, never>>): Promise<RpcResponseLike<HostScheduleDeleteEndedResult>>;
|
|
911
|
+
}
|
|
912
|
+
type ScheduleApiLike = LegacyScheduleApiLike | HostScheduleApiLike;
|
|
658
913
|
interface HostApiLike {
|
|
659
914
|
listDirectory?(req: RpcRequestLike<{
|
|
660
915
|
path?: string;
|
|
@@ -749,6 +1004,16 @@ interface PromptArgs {
|
|
|
749
1004
|
}>;
|
|
750
1005
|
clientTimeZone?: string;
|
|
751
1006
|
}
|
|
1007
|
+
/** DSH session.updateQueue request; `edit` is reserved on the wire and never sent. */
|
|
1008
|
+
interface QueueUpdateArgs {
|
|
1009
|
+
sessionId: string;
|
|
1010
|
+
itemId: string;
|
|
1011
|
+
action: {
|
|
1012
|
+
kind: 'remove';
|
|
1013
|
+
} | {
|
|
1014
|
+
kind: 'steer';
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
752
1017
|
interface PhoneSessionRow {
|
|
753
1018
|
sessionId: string;
|
|
754
1019
|
updatedAt: number;
|
|
@@ -809,6 +1074,8 @@ interface ApiStreamItemLike {
|
|
|
809
1074
|
payload: MuxFrameLike;
|
|
810
1075
|
}
|
|
811
1076
|
interface ApiProxyLike {
|
|
1077
|
+
/** 真实宿主反射声明了助手流帧时才为 true;旧代理缺省关闭。 */
|
|
1078
|
+
readonly assistantStreamAvailable?: boolean;
|
|
812
1079
|
commands?: CommandsApiLike;
|
|
813
1080
|
sessions: SessionsApiLike;
|
|
814
1081
|
workspace?: WorkspaceApiLike;
|
|
@@ -873,16 +1140,12 @@ interface PushOutlet {
|
|
|
873
1140
|
*/
|
|
874
1141
|
isAvailable(): boolean;
|
|
875
1142
|
}
|
|
876
|
-
//#endregion
|
|
877
|
-
//#region src/document-payload.d.ts
|
|
878
1143
|
interface PromptDocument {
|
|
879
1144
|
name: string;
|
|
880
1145
|
mediaType: string;
|
|
881
1146
|
text: string;
|
|
882
1147
|
truncated?: boolean;
|
|
883
1148
|
}
|
|
884
|
-
//#endregion
|
|
885
|
-
//#region src/host-bridge.d.ts
|
|
886
1149
|
/**
|
|
887
1150
|
* 失败结果直接携带 wire 错误码(error vocabulary 见 wire-errors.ts)。
|
|
888
1151
|
*
|
|
@@ -901,7 +1164,19 @@ type ScheduleBridgeResult<T> = {
|
|
|
901
1164
|
message: string;
|
|
902
1165
|
replayed?: boolean;
|
|
903
1166
|
};
|
|
904
|
-
|
|
1167
|
+
/**
|
|
1168
|
+
* 宿主级编辑(update / delete 合一的 `edit`)的 Bridge 结果值。
|
|
1169
|
+
*
|
|
1170
|
+
* 与 legacy 的 updated/deleted 两个独立帧结果分开表达,wire handler 用
|
|
1171
|
+
* `'deleted' in value` 落成 `deleted:true` 或 `task`。
|
|
1172
|
+
*/
|
|
1173
|
+
type HostScheduleEditValue = {
|
|
1174
|
+
task: HostScheduleTaskView;
|
|
1175
|
+
} | {
|
|
1176
|
+
deleted: true;
|
|
1177
|
+
id: string;
|
|
1178
|
+
};
|
|
1179
|
+
export declare class HostBridge {
|
|
905
1180
|
private readonly apiProxy;
|
|
906
1181
|
private readonly historyBufferMax;
|
|
907
1182
|
/** 三个 journal 的落盘失败诊断输出;缺省即静默。不打任何消息体。 */
|
|
@@ -916,7 +1191,13 @@ declare class HostBridge {
|
|
|
916
1191
|
* and restore them. Excluded from `summaries` and from the live broadcast. */
|
|
917
1192
|
private archivedSummaries;
|
|
918
1193
|
private subagentSessionIds;
|
|
1194
|
+
/**
|
|
1195
|
+
* 每个会话最近一次已知的队列(inbox 投影的折叠结果)及其指纹。来源是实时
|
|
1196
|
+
* 投影通知或打开会话时读到的基线;指纹用来丢掉内容没变的重复通知。
|
|
1197
|
+
*/
|
|
1198
|
+
private queues;
|
|
919
1199
|
private sinks;
|
|
1200
|
+
private readonly assistantStream;
|
|
920
1201
|
private ring;
|
|
921
1202
|
private cursor;
|
|
922
1203
|
private userReceiptSeq;
|
|
@@ -957,6 +1238,9 @@ declare class HostBridge {
|
|
|
957
1238
|
markSinkOpen(sink: BridgeSink, sessionId: string): void;
|
|
958
1239
|
markSinkClosed(sink: BridgeSink, sessionId: string): void;
|
|
959
1240
|
dropSinkSessions(sink: BridgeSink): void;
|
|
1241
|
+
private hasStreamViewer;
|
|
1242
|
+
/** Instant publications bypass record(): no cursor, ring, notification or push side effect. */
|
|
1243
|
+
private pushAssistantDelta;
|
|
960
1244
|
private isViewedBy;
|
|
961
1245
|
/** F-9: when a notification-worthy event fires, mirror it to every
|
|
962
1246
|
* online device that is not currently viewing the session (the s2c.notify
|
|
@@ -1000,6 +1284,19 @@ declare class HostBridge {
|
|
|
1000
1284
|
private deriveTitleFallback;
|
|
1001
1285
|
private captureActivity;
|
|
1002
1286
|
private noteActivity;
|
|
1287
|
+
/**
|
|
1288
|
+
* 折叠一次 inbox 投影。只有实时变化才广播 s2c.session.queue;基线只补缓存,
|
|
1289
|
+
* 打开会话的那台设备另由 pushQueueSnapshot 点对点拿到快照。
|
|
1290
|
+
*
|
|
1291
|
+
* 基线只补缺不覆盖:实时通知带的是完整投影值,收到过就以它为准;基线读取与
|
|
1292
|
+
* 实时变化并发时,较早算出的基线不得盖掉较新的实时值。
|
|
1293
|
+
*/
|
|
1294
|
+
private applyInbox;
|
|
1295
|
+
/**
|
|
1296
|
+
* 打开会话时补发的快照:不占 seq,与 tail 同属打开响应。还没读到过该会话的
|
|
1297
|
+
* 投影(基线失败、Host 不提供或子代理会话)时不发,因为未知不等于空队列。
|
|
1298
|
+
*/
|
|
1299
|
+
private pushQueueSnapshot;
|
|
1003
1300
|
private applyProjection;
|
|
1004
1301
|
private bumpPendingFlags;
|
|
1005
1302
|
private pushSummary;
|
|
@@ -1038,7 +1335,7 @@ declare class HostBridge {
|
|
|
1038
1335
|
data: string;
|
|
1039
1336
|
} | null>;
|
|
1040
1337
|
commandOperation(operation: 'list' | 'execute' | 'permissions' | 'feedback', payload: Record<string, unknown>): Promise<SessionManagementResult<unknown>>;
|
|
1041
|
-
exportSession(sessionId: string, signal: AbortSignal): Promise<Response>;
|
|
1338
|
+
exportSession(sessionId: string, signal: AbortSignal, format?: SessionExportFormat): Promise<Response>;
|
|
1042
1339
|
/** 由会话目录决定技能可见性;不读取正文,也不把本机路径发给移动端。 */
|
|
1043
1340
|
sessionSkills(sessionId: string): Promise<SessionManagementResult<{
|
|
1044
1341
|
skills: SkillSummary[];
|
|
@@ -1048,6 +1345,14 @@ declare class HostBridge {
|
|
|
1048
1345
|
renameSession(sessionId: string, title: string): Promise<SessionManagementResult<string>>;
|
|
1049
1346
|
archiveSession(sessionId: string): Promise<SessionManagementResult<true>>;
|
|
1050
1347
|
unarchiveSession(sessionId: string): Promise<SessionManagementResult<true>>;
|
|
1348
|
+
/**
|
|
1349
|
+
* 删除或转向一条排队项。ack 只表示 Host 已提交变更,真实状态以随后的
|
|
1350
|
+
* s2c.session.queue 为准;不做幂等,项已消失时 Host 回 queue-item-not-found。
|
|
1351
|
+
*/
|
|
1352
|
+
updateQueue(sessionId: string, itemId: string, action: 'remove' | 'steer'): Promise<SessionManagementResult<{
|
|
1353
|
+
sessionId: string;
|
|
1354
|
+
itemId: string;
|
|
1355
|
+
}>>;
|
|
1051
1356
|
cancelSession(sessionId: string): Promise<SessionManagementResult<true>>;
|
|
1052
1357
|
listWorkspaces(): Promise<SessionManagementResult<Array<{
|
|
1053
1358
|
id: string;
|
|
@@ -1078,7 +1383,52 @@ declare class HostBridge {
|
|
|
1078
1383
|
}): Promise<ScheduleBridgeResult<{
|
|
1079
1384
|
sessionId: string;
|
|
1080
1385
|
}>>;
|
|
1386
|
+
/**
|
|
1387
|
+
* 当前 adapter 是否宿主级计划任务模型。
|
|
1388
|
+
*
|
|
1389
|
+
* 能力位 `schedulesHost`(host-capabilities.ts)与新帧、旧帧映射全部读这一个
|
|
1390
|
+
* 判别位:探测只发生一次(DshApiProxy.resolveSchedule),这里不再看控制器
|
|
1391
|
+
* 方法,也不看版本号字符串。
|
|
1392
|
+
*/
|
|
1393
|
+
private get hostSchedule();
|
|
1081
1394
|
listSchedules(sessionId: string): Promise<ScheduleBridgeResult<ScheduleTaskViewLike[]>>;
|
|
1395
|
+
/** 宿主级列表 -> 旧会话级视图:过滤 session 目标、丢弃 ended、按 scheduledAt 升序。 */
|
|
1396
|
+
private listHostSchedulesAsLegacy;
|
|
1397
|
+
listHostSchedules(request?: HostScheduleListRequestLike): Promise<ScheduleBridgeResult<HostScheduleListResultLike>>;
|
|
1398
|
+
viewHostSchedule(id: string): Promise<ScheduleBridgeResult<HostScheduleTaskView>>;
|
|
1399
|
+
createHostSchedule(deviceId: string, payload: Record<string, unknown> & {
|
|
1400
|
+
clientRequestId: string;
|
|
1401
|
+
title: string;
|
|
1402
|
+
prompt: string;
|
|
1403
|
+
timing: unknown;
|
|
1404
|
+
target?: unknown;
|
|
1405
|
+
}): Promise<ScheduleBridgeResult<HostScheduleTaskView>>;
|
|
1406
|
+
editHostSchedule(deviceId: string, payload: Record<string, unknown> & {
|
|
1407
|
+
clientRequestId: string;
|
|
1408
|
+
id: string;
|
|
1409
|
+
action: 'update' | 'delete';
|
|
1410
|
+
expectedUpdatedAt?: string | null;
|
|
1411
|
+
patch?: unknown;
|
|
1412
|
+
}): Promise<ScheduleBridgeResult<HostScheduleEditValue>>;
|
|
1413
|
+
runHostSchedule(deviceId: string, payload: {
|
|
1414
|
+
clientRequestId: string;
|
|
1415
|
+
id: string;
|
|
1416
|
+
}): Promise<ScheduleBridgeResult<HostScheduleTaskView>>;
|
|
1417
|
+
/**
|
|
1418
|
+
* 删除宿主上全部已结束(`status="ended"`)的任务,返回删除条数。
|
|
1419
|
+
*
|
|
1420
|
+
* 与其他变更帧共用 scheduleMutations journal:同一 clientRequestId 重放时直接回放
|
|
1421
|
+
* 首次结果,不会再删一次。成功后广播 `s2c.schedule.changed`;失败时同样广播——上游
|
|
1422
|
+
* 文档说明失败的批次无法确定哪些行已删除,客户端应重新读取列表。
|
|
1423
|
+
*/
|
|
1424
|
+
deleteEndedHostSchedules(deviceId: string, payload: {
|
|
1425
|
+
clientRequestId: string;
|
|
1426
|
+
}): Promise<ScheduleBridgeResult<{
|
|
1427
|
+
deleted?: number;
|
|
1428
|
+
}>>;
|
|
1429
|
+
scheduleLimits(): Promise<ScheduleBridgeResult<{
|
|
1430
|
+
newSessionIntervalSeconds: number;
|
|
1431
|
+
}>>;
|
|
1082
1432
|
scheduleHistory(sessionId: string, id: string, limit: number, before?: string): Promise<ScheduleBridgeResult<ScheduleHistoryViewLike>>;
|
|
1083
1433
|
createSchedule(deviceId: string, payload: Record<string, unknown> & {
|
|
1084
1434
|
sessionId: string;
|
|
@@ -1104,13 +1454,14 @@ declare class HostBridge {
|
|
|
1104
1454
|
mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
1105
1455
|
data: string;
|
|
1106
1456
|
name?: string;
|
|
1107
|
-
}>, documents?: PromptDocument[]
|
|
1457
|
+
}>, documents?: PromptDocument[], options?: {
|
|
1458
|
+
mode?: 'queue' | 'steer';
|
|
1459
|
+
clientSendId?: string;
|
|
1460
|
+
}): Promise<SessionManagementResult<number>>;
|
|
1108
1461
|
respondApproval(requestId: string, decision: 'allow' | 'deny', reason?: string): Promise<PendingResponseOutcome>;
|
|
1109
1462
|
respondQuestion(requestId: string, answers: unknown): Promise<PendingResponseOutcome>;
|
|
1110
1463
|
}
|
|
1111
|
-
|
|
1112
|
-
//#region src/config.d.ts
|
|
1113
|
-
interface Config {
|
|
1464
|
+
export interface Config {
|
|
1114
1465
|
/** Master switch; when false the plugin activates and does nothing. */
|
|
1115
1466
|
enabled?: boolean;
|
|
1116
1467
|
/** Protocol-v2 device registry JSON path. */
|
|
@@ -1163,7 +1514,7 @@ interface Config {
|
|
|
1163
1514
|
relayToken?: string;
|
|
1164
1515
|
};
|
|
1165
1516
|
}
|
|
1166
|
-
declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
1517
|
+
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
1167
1518
|
enabled: z<boolean, boolean, "volatile-defined">;
|
|
1168
1519
|
devicesPath: z<string, string, "defined">;
|
|
1169
1520
|
historyBufferMax: z<number, number, "defined">;
|
|
@@ -1268,12 +1619,10 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
1268
1619
|
relayToken: z<string, string, "defined">;
|
|
1269
1620
|
}>>, "defined">;
|
|
1270
1621
|
}>>, "plain">;
|
|
1271
|
-
//#endregion
|
|
1272
|
-
//#region src/push-policy.d.ts
|
|
1273
1622
|
/** Prune only when the provider supplies an authoritative token-lifecycle verdict. */
|
|
1274
|
-
declare function shouldPrunePushToken(outcome: 'sent' | 'invalid-token' | 'failed', reason?: string): boolean;
|
|
1623
|
+
export declare function shouldPrunePushToken(outcome: 'sent' | 'invalid-token' | 'failed', reason?: string): boolean;
|
|
1275
1624
|
/** APNs requires both registration and the same content permission as WS. */
|
|
1276
|
-
declare function mayReceivePush(device: {
|
|
1625
|
+
export declare function mayReceivePush(device: {
|
|
1277
1626
|
scopes?: readonly string[];
|
|
1278
1627
|
}, notification: unknown): boolean;
|
|
1279
1628
|
/**
|
|
@@ -1282,13 +1631,11 @@ declare function mayReceivePush(device: {
|
|
|
1282
1631
|
* re-derive it; an explicitly configured relay token remains user-owned
|
|
1283
1632
|
* configuration and is never silently rewritten.
|
|
1284
1633
|
*/
|
|
1285
|
-
declare function shouldReEnrollRelayToken(transport: 'apns' | 'relay', outcome: 'sent' | 'invalid-token' | 'failed', reason: string | undefined, opts: {
|
|
1634
|
+
export declare function shouldReEnrollRelayToken(transport: 'apns' | 'relay', outcome: 'sent' | 'invalid-token' | 'failed', reason: string | undefined, opts: {
|
|
1286
1635
|
usedCellToken: boolean;
|
|
1287
1636
|
hasEnrollKey: boolean;
|
|
1288
1637
|
tokenStillCurrent: boolean;
|
|
1289
1638
|
}): boolean;
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/index.d.ts
|
|
1292
1639
|
/**
|
|
1293
1640
|
* dsh-deeppilot — data bridge between the DSH host and DeepPilot
|
|
1294
1641
|
* clients. Owns independent, narrowly routed LAN (TLS-only, pinned by paired
|
|
@@ -1303,10 +1650,9 @@ declare function shouldReEnrollRelayToken(transport: 'apns' | 'relay', outcome:
|
|
|
1303
1650
|
* Protocol: PROTOCOL.md is normative; src/protocol.ts and the private app's
|
|
1304
1651
|
* Swift models mirror that v2 contract.
|
|
1305
1652
|
*/
|
|
1306
|
-
declare const name = "deeppilot";
|
|
1653
|
+
export declare const name = "deeppilot";
|
|
1307
1654
|
/** No web-service requirement: the plugin owns its own transport listeners. */
|
|
1308
|
-
declare const inject: string[];
|
|
1309
|
-
declare function apply(ctx: Context, options: unknown): void;
|
|
1310
|
-
|
|
1311
|
-
export { Config, HostBridge, apply, inject, mayReceivePush, name, shouldPrunePushToken, shouldReEnrollRelayToken };
|
|
1655
|
+
export declare const inject: string[];
|
|
1656
|
+
export declare function apply(ctx: Context, options: unknown): void;
|
|
1657
|
+
export {};
|
|
1312
1658
|
//# sourceMappingURL=index.d.ts.map
|