@anycon/protocol 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -1
- package/dist/crypto.d.ts +10 -1
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +1 -0
- package/dist/crypto.js.map +1 -1
- package/dist/envelope.d.ts.map +1 -1
- package/dist/envelope.js +5 -3
- package/dist/envelope.js.map +1 -1
- package/dist/generated.d.ts +656 -13
- package/dist/generated.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/method-types.d.ts +29 -1
- package/dist/method-types.d.ts.map +1 -1
- package/dist/preview.d.ts +173 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +554 -0
- package/dist/preview.js.map +1 -0
- package/package.json +3 -3
- package/src/constants.ts +16 -0
- package/src/crypto.ts +16 -4
- package/src/envelope.ts +5 -3
- package/src/generated.ts +663 -13
- package/src/index.ts +2 -0
- package/src/method-types.ts +17 -0
- package/src/preview.ts +625 -0
- package/wasm/THIRD-PARTY-LICENSES.txt +4 -3
- package/wasm/anycon_crypto.d.ts +6 -0
- package/wasm/anycon_crypto.js +29 -0
- package/wasm/anycon_crypto_bg.wasm +0 -0
- package/wasm/anycon_crypto_bg.wasm.d.ts +1 -0
package/dist/generated.d.ts
CHANGED
|
@@ -6,12 +6,21 @@ export type AgentStatus = ("ready" | "disabled" | "not_installed" | "not_authent
|
|
|
6
6
|
*/
|
|
7
7
|
export type LinkBlock = "hidden" | "sensitive" | "workspace" | "data_dir" | "filesystem_root";
|
|
8
8
|
export type DeviceKind = "daemon" | "web" | "cli" | "sdk";
|
|
9
|
+
/**
|
|
10
|
+
* 一项配置能不能被远程客户端改(ADR-43)。
|
|
11
|
+
*/
|
|
12
|
+
export type ConfigEditable = "any" | "tighten_only" | "no";
|
|
13
|
+
/**
|
|
14
|
+
* 配置值的类型,客户端据此选控件。
|
|
15
|
+
*/
|
|
16
|
+
export type ConfigValueKind = "bool" | "int" | "duration" | "enum" | "text";
|
|
9
17
|
/**
|
|
10
18
|
* 控制消息集合。方向见注释:D = 设备,H = hub。
|
|
11
19
|
*/
|
|
12
20
|
export type Control = {
|
|
13
21
|
client: ClientInfo;
|
|
14
22
|
device_token?: string | null;
|
|
23
|
+
preview_token?: string | null;
|
|
15
24
|
protocol_version: number;
|
|
16
25
|
type: "auth";
|
|
17
26
|
} | {
|
|
@@ -79,6 +88,10 @@ export type Control = {
|
|
|
79
88
|
} | {
|
|
80
89
|
device: string;
|
|
81
90
|
type: "peer_offline";
|
|
91
|
+
} | {
|
|
92
|
+
label: string;
|
|
93
|
+
peer: string;
|
|
94
|
+
type: "preview_peer";
|
|
82
95
|
} | {
|
|
83
96
|
seq: number;
|
|
84
97
|
to: string;
|
|
@@ -100,6 +113,7 @@ export type Control = {
|
|
|
100
113
|
type: "dropped";
|
|
101
114
|
} | {
|
|
102
115
|
retry_after_ms: number;
|
|
116
|
+
to?: string | null;
|
|
103
117
|
type: "rate_limited";
|
|
104
118
|
} | {
|
|
105
119
|
quota: Quota;
|
|
@@ -256,7 +270,18 @@ export type Event = {
|
|
|
256
270
|
title: string;
|
|
257
271
|
type: "permission";
|
|
258
272
|
} | {
|
|
273
|
+
/**
|
|
274
|
+
* 设备答复时带的 `answers`(kind = question:`{ [question_id]: 字符串或字符串数组 }`),原样记下,
|
|
275
|
+
* 客户端据此在历史里显示问题和回答。daemon 自己答复的(超时、取消、自动拒绝)没有。
|
|
276
|
+
*/
|
|
277
|
+
answers?: {
|
|
278
|
+
[k: string]: unknown;
|
|
279
|
+
} | null;
|
|
259
280
|
by_device: string;
|
|
281
|
+
/**
|
|
282
|
+
* 设备答复时附的话(拒绝的理由、跳过问题时的说明)。daemon 自己答复的没有。
|
|
283
|
+
*/
|
|
284
|
+
message?: string | null;
|
|
260
285
|
option_id?: string | null;
|
|
261
286
|
request_id: string;
|
|
262
287
|
type: "permission_resolved";
|
|
@@ -302,9 +327,96 @@ export type Event = {
|
|
|
302
327
|
type: "git";
|
|
303
328
|
} | {
|
|
304
329
|
code: string;
|
|
330
|
+
/**
|
|
331
|
+
* `code = usage_limit`:触到的是账号级的窗口还是特定模型的窗口。只有上游明确给出限额类型时才有;
|
|
332
|
+
* 缺省 = 不知道。
|
|
333
|
+
*/
|
|
334
|
+
limit_scope?: LimitScope | null;
|
|
305
335
|
message: string;
|
|
306
336
|
recoverable: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* 限额类错误(`usage_limit`,有时 `rate_limited`):限额恢复的时间。和 `Notice.resets_at_ms` 同语义;
|
|
339
|
+
* 上游没给就缺省,不估算。
|
|
340
|
+
*/
|
|
341
|
+
resets_at_ms?: number | null;
|
|
307
342
|
type: "error";
|
|
343
|
+
} | {
|
|
344
|
+
/**
|
|
345
|
+
* workflow 里的各个 agent,按 `index` 升序;非 workflow 为空。
|
|
346
|
+
*/
|
|
347
|
+
agents?: TaskAgent[];
|
|
348
|
+
/**
|
|
349
|
+
* agent 给任务的 id(Claude Code 的 `task_id`;Codex 子 agent 的 thread id)。会话内唯一。
|
|
350
|
+
*/
|
|
351
|
+
id: string;
|
|
352
|
+
kind: TaskKind;
|
|
353
|
+
/**
|
|
354
|
+
* 任务最近一次调用的工具名。
|
|
355
|
+
*/
|
|
356
|
+
last_tool?: string | null;
|
|
357
|
+
/**
|
|
358
|
+
* workflow 的阶段,按 `index` 升序;非 workflow 为空。
|
|
359
|
+
*/
|
|
360
|
+
phases?: TaskPhase[];
|
|
361
|
+
status: TaskStatus;
|
|
362
|
+
/**
|
|
363
|
+
* agent 给的进度 / 结果摘要。
|
|
364
|
+
*/
|
|
365
|
+
summary?: string | null;
|
|
366
|
+
/**
|
|
367
|
+
* workflow 的名字 / 任务描述。
|
|
368
|
+
*/
|
|
369
|
+
title: string;
|
|
370
|
+
/**
|
|
371
|
+
* 启动这个任务的 `tool_call` 的 `id`(Claude Code 的 `tool_use_id`;Codex 的 collab agent 调用 item id)。
|
|
372
|
+
* 客户端据此把进度挂在那个工具块上;对不上时单独成块。
|
|
373
|
+
*/
|
|
374
|
+
tool_id?: string | null;
|
|
375
|
+
type: "task";
|
|
376
|
+
usage?: TaskUsage | null;
|
|
377
|
+
} | {
|
|
378
|
+
code: string;
|
|
379
|
+
level: NoticeLevel;
|
|
380
|
+
/**
|
|
381
|
+
* agent 给的原文(通常是英文),可能是空串。`command_output` 里是本地命令的输出,可能多行。
|
|
382
|
+
*/
|
|
383
|
+
message: string;
|
|
384
|
+
/**
|
|
385
|
+
* `code = model_fallback`:原来的模型。
|
|
386
|
+
*/
|
|
387
|
+
model_from?: string | null;
|
|
388
|
+
/**
|
|
389
|
+
* `code = model_fallback`:实际使用的模型。
|
|
390
|
+
*/
|
|
391
|
+
model_to?: string | null;
|
|
392
|
+
/**
|
|
393
|
+
* `code = rate_limit`:限额恢复的时间。
|
|
394
|
+
*/
|
|
395
|
+
resets_at_ms?: number | null;
|
|
396
|
+
type: "notice";
|
|
397
|
+
} | {
|
|
398
|
+
/**
|
|
399
|
+
* `retrying`:这是第几次重试(从 1 开始)。
|
|
400
|
+
*/
|
|
401
|
+
attempt?: number | null;
|
|
402
|
+
/**
|
|
403
|
+
* `retrying`:距下一次重试的毫秒数。
|
|
404
|
+
*/
|
|
405
|
+
delay_ms?: number | null;
|
|
406
|
+
/**
|
|
407
|
+
* `retrying`:最多重试几次。
|
|
408
|
+
*/
|
|
409
|
+
max_attempts?: number | null;
|
|
410
|
+
/**
|
|
411
|
+
* `retrying`:触发重试的错误摘要,如 `529 overloaded_error`。
|
|
412
|
+
*/
|
|
413
|
+
reason?: string | null;
|
|
414
|
+
state: ActivityState;
|
|
415
|
+
type: "activity";
|
|
416
|
+
} | {
|
|
417
|
+
message_id: string;
|
|
418
|
+
state: MessageDeliveryState;
|
|
419
|
+
type: "message_delivery";
|
|
308
420
|
};
|
|
309
421
|
export type ToolCategory = "shell" | "file_edit" | "file_read" | "search" | "web" | "subagent" | "mcp" | "other";
|
|
310
422
|
export type EditKind = "edit" | "write" | "delete" | "move";
|
|
@@ -321,6 +433,40 @@ export type SessionStatus = ("starting" | "running" | "waiting_permission" | "id
|
|
|
321
433
|
* `Event::Git` 的动作。
|
|
322
434
|
*/
|
|
323
435
|
export type GitAction = ("sync_up_to_date" | "sync_merged" | "sync_conflicts" | "sync_aborted") | "worktree_created" | "worktree_failed" | "worktree_removed" | "worktree_kept" | "worktree_restored" | "worktree_missing";
|
|
436
|
+
/**
|
|
437
|
+
* `Event::Error.limit_scope`:用量限额的范围。
|
|
438
|
+
*/
|
|
439
|
+
export type LimitScope = "account" | "model";
|
|
440
|
+
/**
|
|
441
|
+
* workflow 里一个 agent 的状态。
|
|
442
|
+
*/
|
|
443
|
+
export type TaskAgentState = ("running" | "done" | "failed") | "queued" | "skipped";
|
|
444
|
+
/**
|
|
445
|
+
* `Event::Task` 的任务种类。
|
|
446
|
+
*/
|
|
447
|
+
export type TaskKind = "other" | "workflow" | "subagent" | "shell";
|
|
448
|
+
/**
|
|
449
|
+
* `Event::Task` 的任务状态。`Running` 以外的三个是收尾状态(终态):Claude Code 的任务进入终态后不会再变;
|
|
450
|
+
* Codex 的子 agent 是一个可以再收到输入的 thread,`Completed` 之后收到新输入、开始新 turn 就会回到 `Running`。
|
|
451
|
+
* 所以终态只说明「这一刻不在跑」,不保证同一个 `id` 以后不会再有快照;客户端始终以最新的一条为准。
|
|
452
|
+
*/
|
|
453
|
+
export type TaskStatus = ("running" | "completed" | "failed") | "cancelled";
|
|
454
|
+
/**
|
|
455
|
+
* `Event::Notice` 的级别。
|
|
456
|
+
*/
|
|
457
|
+
export type NoticeLevel = "info" | "warning";
|
|
458
|
+
/**
|
|
459
|
+
* `Event::Activity` 的状态。
|
|
460
|
+
*/
|
|
461
|
+
export type ActivityState = "none" | "retrying" | "compacting";
|
|
462
|
+
/**
|
|
463
|
+
* `Event::MessageDelivery` 的状态。目前只有 `uncertain`;未来如有别的取值,客户端把不认识的当成没有标记。
|
|
464
|
+
*/
|
|
465
|
+
export type MessageDeliveryState = "uncertain";
|
|
466
|
+
/**
|
|
467
|
+
* `fs.read` 返回内容的方式。
|
|
468
|
+
*/
|
|
469
|
+
export type FsReadEncoding = "text" | "base64";
|
|
324
470
|
/**
|
|
325
471
|
* 信封种类。hub 对每种的处理见 docs/protocol.md § 3。
|
|
326
472
|
*/
|
|
@@ -329,11 +475,34 @@ export type Kind = "handshake" | "data" | "notify" | "control";
|
|
|
329
475
|
* 节点配置 `worktree.default` 的取值,也是 `SessionWorkspace` 的两种模式。
|
|
330
476
|
*/
|
|
331
477
|
export type SessionWorkspaceMode = "local" | "worktree";
|
|
478
|
+
/**
|
|
479
|
+
* 日志级别,`node.logs` 的最低级别过滤。
|
|
480
|
+
*/
|
|
481
|
+
export type NodeLogLevel = "trace" | "debug" | "info" | "warn" | "error";
|
|
332
482
|
/**
|
|
333
483
|
* `node.security_event.kind`。
|
|
334
484
|
*/
|
|
335
485
|
export type SecurityEventKind = "device_enrolled" | "password_failures" | "password_locked" | "password_changed" | "settings_changed";
|
|
336
486
|
export type NotifyCategory = ("permission_requested" | "turn_finished" | "error" | "session_idle") | "enroll_requested" | "security";
|
|
487
|
+
/**
|
|
488
|
+
* 隧道里响应体的编码。`gzip`:`DATA` 帧拼起来是 gzip 流,预览页要先解压;`headers` 里已经去掉
|
|
489
|
+
* `content-encoding` / `content-length`。
|
|
490
|
+
*/
|
|
491
|
+
export type PreviewBodyEncoding = "identity" | "gzip";
|
|
492
|
+
/**
|
|
493
|
+
* 端口探测是否可用。`unavailable`:这台机器上没有可用的探测手段(如没有 `lsof`),只能预览配置里允许的端口。
|
|
494
|
+
*/
|
|
495
|
+
export type PreviewDetection = "ok" | "unavailable";
|
|
496
|
+
export type PreviewGoawayCode = "expired" | "closed" | "revoked" | "disabled" | "port_not_allowed" | "shutdown";
|
|
497
|
+
/**
|
|
498
|
+
* 这个端口为什么允许预览(spec/daemon.md § 19.3)。
|
|
499
|
+
*/
|
|
500
|
+
export type PreviewPortSource = "session" | "workspace" | "config";
|
|
501
|
+
/**
|
|
502
|
+
* daemon 拒绝隧道握手的原因(握手回复 `0x01` 后面的 UTF-8 串)。这一条不受 Noise 保护,只能当提示用。
|
|
503
|
+
*/
|
|
504
|
+
export type PreviewRejectReason = ("expired" | "port_not_allowed" | "disabled" | "malformed") | "unknown_ticket" | "label_mismatch" | "busy";
|
|
505
|
+
export type PreviewResetCode = "internal" | "refused" | "timeout" | "too_large" | "cancelled" | "flow_control" | "protocol" | "limit";
|
|
337
506
|
/**
|
|
338
507
|
* 项目从哪来。
|
|
339
508
|
*/
|
|
@@ -397,6 +566,10 @@ export interface ProtocolSchema {
|
|
|
397
566
|
blob_put_chunk_params: BlobPutChunkParams;
|
|
398
567
|
browse_entry: BrowseEntry;
|
|
399
568
|
client_info: ClientInfo;
|
|
569
|
+
config_change: ConfigChange;
|
|
570
|
+
config_editable: ConfigEditable;
|
|
571
|
+
config_item: ConfigItem;
|
|
572
|
+
config_value_kind: ConfigValueKind;
|
|
400
573
|
control: Control;
|
|
401
574
|
diff_against: DiffAgainst;
|
|
402
575
|
diff_file: DiffFile;
|
|
@@ -417,6 +590,7 @@ export interface ProtocolSchema {
|
|
|
417
590
|
event: Event;
|
|
418
591
|
fs_list_params: FsListParams;
|
|
419
592
|
fs_list_result: FsListResult;
|
|
593
|
+
fs_read_encoding: FsReadEncoding;
|
|
420
594
|
fs_read_params: FsReadParams;
|
|
421
595
|
fs_read_result: FsReadResult;
|
|
422
596
|
git_action: GitAction;
|
|
@@ -428,6 +602,7 @@ export interface ProtocolSchema {
|
|
|
428
602
|
link_block: LinkBlock;
|
|
429
603
|
node_audit_params: NodeAuditParams;
|
|
430
604
|
node_audit_result: NodeAuditResult;
|
|
605
|
+
node_config_result: NodeConfigResult;
|
|
431
606
|
node_devices_result: NodeDevicesResult;
|
|
432
607
|
node_doctor_result: NodeDoctorResult;
|
|
433
608
|
node_enroll_approve_params: NodeEnrollApproveParams;
|
|
@@ -438,11 +613,15 @@ export interface ProtocolSchema {
|
|
|
438
613
|
node_enroll_resolved: NodeEnrollResolved;
|
|
439
614
|
node_enroll_status_result: NodeEnrollStatusResult;
|
|
440
615
|
node_info: NodeInfo;
|
|
616
|
+
node_log_level: NodeLogLevel;
|
|
617
|
+
node_logs_params: NodeLogsParams;
|
|
618
|
+
node_logs_result: NodeLogsResult;
|
|
441
619
|
node_pair_begin_params: NodePairBeginParams;
|
|
442
620
|
node_pair_begin_result: NodePairBeginResult;
|
|
443
621
|
node_revoke_device_params: NodeRevokeDeviceParams;
|
|
444
622
|
node_security_event: NodeSecurityEvent;
|
|
445
623
|
node_set_agent_defaults_params: NodeSetAgentDefaultsParams;
|
|
624
|
+
node_set_config_params: NodeSetConfigParams;
|
|
446
625
|
node_set_enroll_enabled_params: NodeSetEnrollEnabledParams;
|
|
447
626
|
node_set_enroll_password_params: NodeSetEnrollPasswordParams;
|
|
448
627
|
node_stats: NodeStats;
|
|
@@ -455,6 +634,26 @@ export interface ProtocolSchema {
|
|
|
455
634
|
permission_request: PermissionRequest;
|
|
456
635
|
permission_resolved: PermissionResolved;
|
|
457
636
|
permission_respond_params: PermissionRespondParams;
|
|
637
|
+
preview_body_encoding: PreviewBodyEncoding;
|
|
638
|
+
preview_close_params: PreviewCloseParams;
|
|
639
|
+
preview_detection: PreviewDetection;
|
|
640
|
+
preview_goaway: PreviewGoaway;
|
|
641
|
+
preview_goaway_code: PreviewGoawayCode;
|
|
642
|
+
preview_hello: PreviewHello;
|
|
643
|
+
preview_info: PreviewInfo;
|
|
644
|
+
preview_launch: PreviewLaunch;
|
|
645
|
+
preview_list_result: PreviewListResult;
|
|
646
|
+
preview_open_params: PreviewOpenParams;
|
|
647
|
+
preview_open_result: PreviewOpenResult;
|
|
648
|
+
preview_port: PreviewPort;
|
|
649
|
+
preview_port_source: PreviewPortSource;
|
|
650
|
+
preview_ports_params: PreviewPortsParams;
|
|
651
|
+
preview_ports_result: PreviewPortsResult;
|
|
652
|
+
preview_reject_reason: PreviewRejectReason;
|
|
653
|
+
preview_request_head: PreviewRequestHead;
|
|
654
|
+
preview_reset: PreviewReset;
|
|
655
|
+
preview_reset_code: PreviewResetCode;
|
|
656
|
+
preview_response_head: PreviewResponseHead;
|
|
458
657
|
project: Project;
|
|
459
658
|
project_kind: ProjectKind;
|
|
460
659
|
pull_request_info: PullRequestInfo;
|
|
@@ -506,6 +705,7 @@ export interface ProtocolSchema {
|
|
|
506
705
|
workspace_name_params: WorkspaceNameParams;
|
|
507
706
|
workspace_remove_worktree_params: WorkspaceRemoveWorktreeParams;
|
|
508
707
|
workspace_rename_params: WorkspaceRenameParams;
|
|
708
|
+
workspace_root_info: WorkspaceRootInfo;
|
|
509
709
|
workspace_trash_id_params: WorkspaceTrashIdParams;
|
|
510
710
|
workspace_trash_list_result: WorkspaceTrashListResult;
|
|
511
711
|
workspace_worktrees_params: WorkspaceWorktreesParams;
|
|
@@ -556,7 +756,8 @@ export interface AgentInfo {
|
|
|
556
756
|
}
|
|
557
757
|
export interface AgentCapabilities {
|
|
558
758
|
/**
|
|
559
|
-
*
|
|
759
|
+
* agent **原生**收的附件 mime,如 `image/png`。其它附件(非图片、这里没列出的图片格式)不受它限制:daemon 把它们落到
|
|
760
|
+
* 会话工作目录并在文字里附上路径(ADR-44)。
|
|
560
761
|
*/
|
|
561
762
|
attachments?: string[];
|
|
562
763
|
/**
|
|
@@ -657,7 +858,7 @@ export interface AgentListResult {
|
|
|
657
858
|
not_modified?: boolean;
|
|
658
859
|
}
|
|
659
860
|
/**
|
|
660
|
-
* 消息里的一个附件(ADR-35):指向 daemon 上已经传完的 blob
|
|
861
|
+
* 消息里的一个附件(ADR-35、ADR-44):指向 daemon 上已经传完的 blob(图片或任意文件)。客户端从 `blob.put_end` 拿到它、原样放进
|
|
661
862
|
* `session.send` / `session.create`;daemon 以自己记录的元数据为准写进 `user_message` 事件。
|
|
662
863
|
*/
|
|
663
864
|
export interface AttachmentRef {
|
|
@@ -667,7 +868,7 @@ export interface AttachmentRef {
|
|
|
667
868
|
mime: string;
|
|
668
869
|
name: string;
|
|
669
870
|
/**
|
|
670
|
-
* 图片像素宽高(daemon
|
|
871
|
+
* 图片像素宽高(daemon 读文件头得出;读不出来、不是图片时省略)。客户端用来在下载前占好位置。
|
|
671
872
|
*/
|
|
672
873
|
width?: number | null;
|
|
673
874
|
}
|
|
@@ -705,11 +906,13 @@ export interface BlobIdParams {
|
|
|
705
906
|
*/
|
|
706
907
|
export interface BlobPutBeginParams {
|
|
707
908
|
/**
|
|
708
|
-
*
|
|
909
|
+
* 任意 `type/subtype`:不合法或空的按 `application/octet-stream` 记录(不报错),大小写和 `;` 之后的参数规整掉。
|
|
910
|
+
* 声明为 `image/png` `image/jpeg` `image/gif` `image/webp` 的才校验文件头、读宽高。
|
|
709
911
|
*/
|
|
710
912
|
mime: string;
|
|
711
913
|
/**
|
|
712
|
-
* 展示用的文件名(1–255 字节,不能含 `/` `\`
|
|
914
|
+
* 展示用的文件名(1–255 字节,不能含 `/` `\` 和控制字符)。非图片的存储扩展名取自它(清洗过),落到工作目录时也用它
|
|
915
|
+
* 作文件名;daemon 不用它拼出别的路径。
|
|
713
916
|
*/
|
|
714
917
|
name: string;
|
|
715
918
|
/**
|
|
@@ -791,6 +994,47 @@ export interface ClientInfo {
|
|
|
791
994
|
*/
|
|
792
995
|
version: string;
|
|
793
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* `node.set_config` 的一项改动。
|
|
999
|
+
*/
|
|
1000
|
+
export interface ConfigChange {
|
|
1001
|
+
key: string;
|
|
1002
|
+
/**
|
|
1003
|
+
* 新值,JSON 类型要和该键的 `kind` 一致(布尔、整数、字符串)。
|
|
1004
|
+
*/
|
|
1005
|
+
value: unknown;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* `node.get_config` 的一项:一个可以远程查看的配置键。
|
|
1009
|
+
*/
|
|
1010
|
+
export interface ConfigItem {
|
|
1011
|
+
editable: ConfigEditable;
|
|
1012
|
+
/**
|
|
1013
|
+
* 被 `ANYCON_*` 环境变量覆盖(`log.level` 还包括 `ANYCON_LOG` / `RUST_LOG`)。为真时 `editable` 一定是 `no`。
|
|
1014
|
+
*/
|
|
1015
|
+
env_override?: boolean;
|
|
1016
|
+
/**
|
|
1017
|
+
* 点分隔的键,和 `config.toml` 一致(`sessions.max_concurrent`)。
|
|
1018
|
+
*/
|
|
1019
|
+
key: string;
|
|
1020
|
+
kind: ConfigValueKind;
|
|
1021
|
+
/**
|
|
1022
|
+
* 取值上限:`int` 是数值,`duration` 是毫秒,`text` 是字符数。
|
|
1023
|
+
*/
|
|
1024
|
+
max?: number | null;
|
|
1025
|
+
/**
|
|
1026
|
+
* 取值下限:`int` 是数值,`duration` 是毫秒,`text` 不用。
|
|
1027
|
+
*/
|
|
1028
|
+
min?: number | null;
|
|
1029
|
+
/**
|
|
1030
|
+
* `kind = enum` 时允许的取值。
|
|
1031
|
+
*/
|
|
1032
|
+
options?: string[];
|
|
1033
|
+
/**
|
|
1034
|
+
* 当前生效的值(默认值 → 文件 → 环境变量合并后的结果):布尔、整数或字符串,类型见 `kind`。
|
|
1035
|
+
*/
|
|
1036
|
+
value: unknown;
|
|
1037
|
+
}
|
|
794
1038
|
export interface Quota {
|
|
795
1039
|
connections: number;
|
|
796
1040
|
connections_max?: number | null;
|
|
@@ -935,12 +1179,22 @@ export interface PermissionDetail {
|
|
|
935
1179
|
* kind = tool
|
|
936
1180
|
*/
|
|
937
1181
|
tool?: ToolPermissionDetail | null;
|
|
1182
|
+
/**
|
|
1183
|
+
* kind = other:要用户在浏览器里打开的链接(MCP server 的 URL 模式 elicitation)。只会是 `http` / `https`;
|
|
1184
|
+
* 客户端只对这两种协议提供「打开」入口,并且显示完整 URL。
|
|
1185
|
+
*/
|
|
1186
|
+
url?: string | null;
|
|
938
1187
|
}
|
|
939
1188
|
export interface Question {
|
|
940
1189
|
choices?: QuestionChoice[];
|
|
941
1190
|
free_text?: boolean;
|
|
942
1191
|
id: string;
|
|
943
1192
|
multi?: boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* 可以不答:客户端允许留空提交,答复里就没有这一题的答案。默认 `false`(必答),
|
|
1195
|
+
* 所以 AskUserQuestion 这类每题都要答的行为不变;MCP elicitation 表单里 schema 没列进 `required` 的字段是 `true`。
|
|
1196
|
+
*/
|
|
1197
|
+
optional?: boolean;
|
|
944
1198
|
text: string;
|
|
945
1199
|
}
|
|
946
1200
|
export interface QuestionChoice {
|
|
@@ -972,6 +1226,15 @@ export interface PermissionOption {
|
|
|
972
1226
|
export interface Usage {
|
|
973
1227
|
cache_read_tokens?: number | null;
|
|
974
1228
|
cache_write_tokens?: number | null;
|
|
1229
|
+
/**
|
|
1230
|
+
* turn 结束时上下文已经占用的 token:最近一次模型请求的输入 + 缓存读写。和 `input_tokens` 等
|
|
1231
|
+
* 累计用量不同,它是「此刻窗口里有多少」,客户端拿它和 `context_window` 算占用比例。agent 不报就缺省。
|
|
1232
|
+
*/
|
|
1233
|
+
context_tokens?: number | null;
|
|
1234
|
+
/**
|
|
1235
|
+
* 模型的上下文窗口大小(token)。agent 不报就缺省。
|
|
1236
|
+
*/
|
|
1237
|
+
context_window?: number | null;
|
|
975
1238
|
cost_usd?: number | null;
|
|
976
1239
|
duration_ms: number;
|
|
977
1240
|
input_tokens?: number | null;
|
|
@@ -1004,6 +1267,56 @@ export interface SessionSettings {
|
|
|
1004
1267
|
*/
|
|
1005
1268
|
thinking?: string | null;
|
|
1006
1269
|
}
|
|
1270
|
+
/**
|
|
1271
|
+
* workflow 里的一个 agent。
|
|
1272
|
+
*/
|
|
1273
|
+
export interface TaskAgent {
|
|
1274
|
+
/**
|
|
1275
|
+
* 第几次尝试(重试过才有)。
|
|
1276
|
+
*/
|
|
1277
|
+
attempt?: number | null;
|
|
1278
|
+
/**
|
|
1279
|
+
* 结果来自缓存,没有真的运行。
|
|
1280
|
+
*/
|
|
1281
|
+
cached?: boolean | null;
|
|
1282
|
+
duration_ms?: number | null;
|
|
1283
|
+
/**
|
|
1284
|
+
* `state = failed` 时的错误信息。
|
|
1285
|
+
*/
|
|
1286
|
+
error?: string | null;
|
|
1287
|
+
/**
|
|
1288
|
+
* 在 workflow 里的序号,同一个任务内唯一。
|
|
1289
|
+
*/
|
|
1290
|
+
index: number;
|
|
1291
|
+
label: string;
|
|
1292
|
+
/**
|
|
1293
|
+
* 最近一次调用的工具名。
|
|
1294
|
+
*/
|
|
1295
|
+
last_tool?: string | null;
|
|
1296
|
+
model?: string | null;
|
|
1297
|
+
/**
|
|
1298
|
+
* 所属阶段的 `TaskPhase.index`。
|
|
1299
|
+
*/
|
|
1300
|
+
phase_index?: number | null;
|
|
1301
|
+
state: TaskAgentState;
|
|
1302
|
+
tokens?: number | null;
|
|
1303
|
+
tool_calls?: number | null;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* workflow 的一个阶段。
|
|
1307
|
+
*/
|
|
1308
|
+
export interface TaskPhase {
|
|
1309
|
+
index: number;
|
|
1310
|
+
title: string;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* 任务的用量。每个字段 agent 不报就缺省。
|
|
1314
|
+
*/
|
|
1315
|
+
export interface TaskUsage {
|
|
1316
|
+
duration_ms?: number | null;
|
|
1317
|
+
tool_calls?: number | null;
|
|
1318
|
+
total_tokens?: number | null;
|
|
1319
|
+
}
|
|
1007
1320
|
export interface FsListParams {
|
|
1008
1321
|
/**
|
|
1009
1322
|
* `<项目名>/<项目内的相对路径>`,如 `my-app/src`。第一段是关联项目的名字时,其余部分相对那个目录解析,
|
|
@@ -1022,21 +1335,50 @@ export interface FsEntry {
|
|
|
1022
1335
|
}
|
|
1023
1336
|
export interface FsReadParams {
|
|
1024
1337
|
/**
|
|
1025
|
-
*
|
|
1338
|
+
* 缺省 `text`。
|
|
1339
|
+
*/
|
|
1340
|
+
encoding?: FsReadEncoding & string;
|
|
1341
|
+
/**
|
|
1342
|
+
* 读多少**原始字节**。`encoding = text`:默认 1 MiB,上限 10 MiB。`encoding = base64`:一次最多一块(512 KiB,和
|
|
1343
|
+
* `blob.get` 一样),缺省就是一块,超过的按一块算(不报错);`0` 只回大小、不带数据。
|
|
1026
1344
|
*/
|
|
1027
1345
|
max_bytes?: number | null;
|
|
1346
|
+
/**
|
|
1347
|
+
* 从文件的第几个字节读起,缺省 0。只有 `encoding = base64` 能用:大文件按块一块一块读,一个响应不会长时间占住设备到 daemon
|
|
1348
|
+
* 那条有序的传输。`text` 模式下 `offset > 0` 是 `invalid`。
|
|
1349
|
+
*/
|
|
1350
|
+
offset?: number;
|
|
1028
1351
|
/**
|
|
1029
1352
|
* 解析规则同 `FsListParams.path`。
|
|
1030
1353
|
*/
|
|
1031
1354
|
path: string;
|
|
1032
1355
|
}
|
|
1033
1356
|
export interface FsReadResult {
|
|
1357
|
+
/**
|
|
1358
|
+
* `text` 模式:文件是二进制(不返回内容)。`base64` 模式:按**这一块**的内容判断(前 8 KiB 里有 NUL、或不是合法的
|
|
1359
|
+
* UTF-8),只有 `offset = 0` 的那一块说明整个文件;从中间读起的块可能从半个字符开始,客户端不要依赖它。
|
|
1360
|
+
*/
|
|
1034
1361
|
binary: boolean;
|
|
1362
|
+
/**
|
|
1363
|
+
* 文件的总字节数(不是读到的)。分块读的时候每一块都带着它:总数变了说明文件在读的过程中被改写过。
|
|
1364
|
+
*/
|
|
1035
1365
|
bytes: number;
|
|
1036
1366
|
/**
|
|
1037
|
-
*
|
|
1367
|
+
* `encoding = base64` 时读到的字节(至多一块;`offset` 在文件末尾或之后时为空串);`text` 模式没有这个字段。
|
|
1368
|
+
*/
|
|
1369
|
+
data_base64?: string | null;
|
|
1370
|
+
/**
|
|
1371
|
+
* `encoding = base64` 时 `data_base64` 从文件的第几个字节开始(原样回显请求的 `offset`);`text` 模式没有这个字段。
|
|
1372
|
+
* 不认识 `offset` 的旧 daemon 不会带它,客户端据此知道分块读不能用。
|
|
1373
|
+
*/
|
|
1374
|
+
offset?: number | null;
|
|
1375
|
+
/**
|
|
1376
|
+
* UTF-8 文本;二进制文件 `text` 为空且 `binary = true`。`encoding = base64` 时恒为空。
|
|
1038
1377
|
*/
|
|
1039
1378
|
text: string;
|
|
1379
|
+
/**
|
|
1380
|
+
* 文件在读到的这一段**之后**还有内容(`offset + 读到的字节数 < bytes`)。
|
|
1381
|
+
*/
|
|
1040
1382
|
truncated: boolean;
|
|
1041
1383
|
}
|
|
1042
1384
|
export interface JobCancelParams {
|
|
@@ -1072,6 +1414,12 @@ export interface AuditEntry {
|
|
|
1072
1414
|
target?: string | null;
|
|
1073
1415
|
ts_ms: number;
|
|
1074
1416
|
}
|
|
1417
|
+
/**
|
|
1418
|
+
* `node.get_config` / `node.set_config` 的结果:白名单里的全部配置项(顺序固定,按段分组)。
|
|
1419
|
+
*/
|
|
1420
|
+
export interface NodeConfigResult {
|
|
1421
|
+
items: ConfigItem[];
|
|
1422
|
+
}
|
|
1075
1423
|
export interface NodeDevicesResult {
|
|
1076
1424
|
devices: PeerDevice[];
|
|
1077
1425
|
}
|
|
@@ -1160,6 +1508,10 @@ export interface NodeEnrollStatusResult {
|
|
|
1160
1508
|
* `node.info` 结果。
|
|
1161
1509
|
*/
|
|
1162
1510
|
export interface NodeInfo {
|
|
1511
|
+
/**
|
|
1512
|
+
* `capabilities.blobs` 为 true 时给出。
|
|
1513
|
+
*/
|
|
1514
|
+
attachment_limits?: NodeAttachmentLimits | null;
|
|
1163
1515
|
capabilities: NodeCapabilities;
|
|
1164
1516
|
name: string;
|
|
1165
1517
|
node_id: string;
|
|
@@ -1167,16 +1519,49 @@ export interface NodeInfo {
|
|
|
1167
1519
|
protocol_version: number;
|
|
1168
1520
|
started_at_ms: number;
|
|
1169
1521
|
version: string;
|
|
1522
|
+
/**
|
|
1523
|
+
* 主根。多个根时看 `workspace_roots`。
|
|
1524
|
+
*/
|
|
1170
1525
|
workspace_root?: string | null;
|
|
1526
|
+
/**
|
|
1527
|
+
* 所有 workspace 根,主根在最前,额外根按配置顺序。老版本的 daemon 不给,客户端当作只有 `workspace_root` 一个。
|
|
1528
|
+
*/
|
|
1529
|
+
workspace_roots?: WorkspaceRootInfo[];
|
|
1171
1530
|
/**
|
|
1172
1531
|
* `capabilities.worktree` 为 true 时给出。
|
|
1173
1532
|
*/
|
|
1174
1533
|
worktree?: NodeWorktreeSettings | null;
|
|
1175
1534
|
}
|
|
1535
|
+
/**
|
|
1536
|
+
* 附件的上限(`node.info`),客户端据此在上传之前就拒绝明显超限的文件。
|
|
1537
|
+
*/
|
|
1538
|
+
export interface NodeAttachmentLimits {
|
|
1539
|
+
/**
|
|
1540
|
+
* 单个附件的字节上限(`sessions.max_attachment_bytes`,热加载;这里是 `node.info` 被调用那一刻的值)。
|
|
1541
|
+
*/
|
|
1542
|
+
max_bytes: number;
|
|
1543
|
+
/**
|
|
1544
|
+
* 一条消息的附件字节合计上限。
|
|
1545
|
+
*/
|
|
1546
|
+
max_message_bytes: number;
|
|
1547
|
+
/**
|
|
1548
|
+
* 一条消息至多带几个附件。
|
|
1549
|
+
*/
|
|
1550
|
+
max_per_message: number;
|
|
1551
|
+
}
|
|
1176
1552
|
export interface NodeCapabilities {
|
|
1177
1553
|
audit: boolean;
|
|
1178
1554
|
blobs: boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* daemon 能把任意类型的文件交给任何会话的 agent(非图片、agent 不原生收的图片落到会话工作目录,ADR-44)。
|
|
1557
|
+
* 为 false(旧 daemon)时客户端只能上传图片。
|
|
1558
|
+
*/
|
|
1559
|
+
file_attachments?: boolean;
|
|
1179
1560
|
fs: boolean;
|
|
1561
|
+
/**
|
|
1562
|
+
* 支持 dev server 预览(`preview.*`,ADR-39),且节点配置 `preview.enabled = true`。
|
|
1563
|
+
*/
|
|
1564
|
+
preview?: boolean;
|
|
1180
1565
|
search: boolean;
|
|
1181
1566
|
/**
|
|
1182
1567
|
* 有 workspace(文件夹即项目)。SDK 节点可能没有。
|
|
@@ -1187,6 +1572,24 @@ export interface NodeCapabilities {
|
|
|
1187
1572
|
*/
|
|
1188
1573
|
worktree?: boolean;
|
|
1189
1574
|
}
|
|
1575
|
+
/**
|
|
1576
|
+
* 一个 workspace 根(ADR-45)。每个根下的一级子文件夹都是项目。
|
|
1577
|
+
*/
|
|
1578
|
+
export interface WorkspaceRootInfo {
|
|
1579
|
+
/**
|
|
1580
|
+
* 现在能用:daemon 启动时它是一个存在的目录,并且现在还在。不可用的根下的项目不出现在列表里,也不能在上面新建 / 克隆;
|
|
1581
|
+
* 配置只在启动时读,修好(挂上外接盘)之后要重启 daemon。
|
|
1582
|
+
*/
|
|
1583
|
+
available: boolean;
|
|
1584
|
+
/**
|
|
1585
|
+
* canonical 绝对路径(根不可用时是展开后的配置值)。`workspace.create` / `clone` 的 `root` 取这里的值。
|
|
1586
|
+
*/
|
|
1587
|
+
path: string;
|
|
1588
|
+
/**
|
|
1589
|
+
* 主根:放 `.scratch/`,不指定 `root` 时新项目建在这里。恰好有一个。
|
|
1590
|
+
*/
|
|
1591
|
+
primary: boolean;
|
|
1592
|
+
}
|
|
1190
1593
|
/**
|
|
1191
1594
|
* 节点的 worktree 配置(`config.toml` 的 `[worktree]`),客户端据此决定新建会话的初始选择和分支名预览。
|
|
1192
1595
|
*/
|
|
@@ -1200,6 +1603,32 @@ export interface NodeWorktreeSettings {
|
|
|
1200
1603
|
*/
|
|
1201
1604
|
default_mode: SessionWorkspaceMode;
|
|
1202
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* `node.logs` 参数。
|
|
1608
|
+
*/
|
|
1609
|
+
export interface NodeLogsParams {
|
|
1610
|
+
/**
|
|
1611
|
+
* 最低级别:只返回这个级别及更高级别的行。缺省 = 不过滤。
|
|
1612
|
+
*/
|
|
1613
|
+
level?: NodeLogLevel | null;
|
|
1614
|
+
/**
|
|
1615
|
+
* 最多返回多少行,缺省 200,最大 1000(超出按 1000)。
|
|
1616
|
+
*/
|
|
1617
|
+
lines?: number | null;
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* `node.logs` 结果。
|
|
1621
|
+
*/
|
|
1622
|
+
export interface NodeLogsResult {
|
|
1623
|
+
/**
|
|
1624
|
+
* 日志行,旧的在前、新的在后;每行最多 2 KiB(超出的截断,行尾加 `…`)。
|
|
1625
|
+
*/
|
|
1626
|
+
lines: string[];
|
|
1627
|
+
/**
|
|
1628
|
+
* 还有更早的行没有返回(行数到了上限,或扫描的日志量到了上限)。
|
|
1629
|
+
*/
|
|
1630
|
+
truncated: boolean;
|
|
1631
|
+
}
|
|
1203
1632
|
export interface NodePairBeginParams {
|
|
1204
1633
|
/**
|
|
1205
1634
|
* `true`(缺省)= 16 位短码(约 79 bit;链接、二维码、默认都是它);`false` = 8 位(约 40 bit),
|
|
@@ -1261,6 +1690,15 @@ export interface NodeSetAgentDefaultsParams {
|
|
|
1261
1690
|
} | null;
|
|
1262
1691
|
thinking?: string | null;
|
|
1263
1692
|
}
|
|
1693
|
+
/**
|
|
1694
|
+
* `node.set_config` 参数。所有改动先校验,任何一项不合法就一项都不写。
|
|
1695
|
+
*
|
|
1696
|
+
* 错误:键不在白名单、被环境变量覆盖、想放宽只能收紧的键 → `forbidden`(`data.field` 是键,`data.reason` 是
|
|
1697
|
+
* `not_editable` / `env_override` / `tighten_only`);值的类型或取值不合法、键重复、`changes` 为空 → `invalid`(`data.field` 是键)。
|
|
1698
|
+
*/
|
|
1699
|
+
export interface NodeSetConfigParams {
|
|
1700
|
+
changes: ConfigChange[];
|
|
1701
|
+
}
|
|
1264
1702
|
/**
|
|
1265
1703
|
* `node.set_enroll_enabled` 参数:写 `[enroll]` 配置。`password: true` 同时解除锁定、失败计数清零。
|
|
1266
1704
|
*/
|
|
@@ -1373,7 +1811,171 @@ export interface PermissionRespondParams {
|
|
|
1373
1811
|
request_id: string;
|
|
1374
1812
|
}
|
|
1375
1813
|
/**
|
|
1376
|
-
*
|
|
1814
|
+
* `preview.close` 参数:作废这个 label 的全部票据,断开它的全部隧道。
|
|
1815
|
+
*/
|
|
1816
|
+
export interface PreviewCloseParams {
|
|
1817
|
+
label: string;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* 隧道 `GOAWAY` 帧的载荷(msgpack,只有 daemon 发,stream 0):daemon 要关掉这条隧道,之后不再处理它的帧。
|
|
1821
|
+
*/
|
|
1822
|
+
export interface PreviewGoaway {
|
|
1823
|
+
code: PreviewGoawayCode;
|
|
1824
|
+
message?: string | null;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* 隧道握手第二条消息(daemon → 预览页)的 payload,JSON。到这一条预览页才确认对端持有票据、是钉住的 daemon。
|
|
1828
|
+
*/
|
|
1829
|
+
export interface PreviewHello {
|
|
1830
|
+
expires_at_ms: number;
|
|
1831
|
+
port: number;
|
|
1832
|
+
session_id?: string | null;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* `preview.list` 的一项:一张未过期的票据。
|
|
1836
|
+
*/
|
|
1837
|
+
export interface PreviewInfo {
|
|
1838
|
+
created_at_ms: number;
|
|
1839
|
+
/**
|
|
1840
|
+
* 签发这张票据的设备。
|
|
1841
|
+
*/
|
|
1842
|
+
created_by: string;
|
|
1843
|
+
created_by_name: string;
|
|
1844
|
+
expires_at_ms: number;
|
|
1845
|
+
label: string;
|
|
1846
|
+
port: number;
|
|
1847
|
+
session_id?: string | null;
|
|
1848
|
+
ticket_id: string;
|
|
1849
|
+
/**
|
|
1850
|
+
* 此刻用这张票据建立的隧道数。
|
|
1851
|
+
*/
|
|
1852
|
+
tunnels: number;
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* 预览页的启动参数。Web UI 把它序列化成 JSON、再 base64url(无填充),放进
|
|
1856
|
+
* `<预览 origin>/__anycon/enter#<…>` 的 fragment(浏览器不会把 fragment 发给 hub)。引导页读出后存进预览 origin 的
|
|
1857
|
+
* IndexedDB,立即从地址栏抹掉。
|
|
1858
|
+
*/
|
|
1859
|
+
export interface PreviewLaunch {
|
|
1860
|
+
/**
|
|
1861
|
+
* 票据和令牌里较早的那个过期时间。
|
|
1862
|
+
*/
|
|
1863
|
+
expires_at_ms: number;
|
|
1864
|
+
label: string;
|
|
1865
|
+
/**
|
|
1866
|
+
* daemon 的设备 id。
|
|
1867
|
+
*/
|
|
1868
|
+
node: string;
|
|
1869
|
+
/**
|
|
1870
|
+
* daemon 的 Noise 静态公钥,64 个小写 hex。预览页用它做 NK 握手(钉住 daemon)。
|
|
1871
|
+
*/
|
|
1872
|
+
node_public: string;
|
|
1873
|
+
/**
|
|
1874
|
+
* 打开后先导航到的路径(以 `/` 开头,可带查询串)。
|
|
1875
|
+
*/
|
|
1876
|
+
path: string;
|
|
1877
|
+
port: number;
|
|
1878
|
+
psk: string;
|
|
1879
|
+
ticket_id: string;
|
|
1880
|
+
/**
|
|
1881
|
+
* hub 签发的预览令牌(`POST /api/preview/tokens`),预览连接凭它向 hub 认证。
|
|
1882
|
+
*/
|
|
1883
|
+
token: string;
|
|
1884
|
+
/**
|
|
1885
|
+
* 格式版本,目前是 1。
|
|
1886
|
+
*/
|
|
1887
|
+
v: number;
|
|
1888
|
+
}
|
|
1889
|
+
export interface PreviewListResult {
|
|
1890
|
+
previews: PreviewInfo[];
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* `preview.open` 参数:为本机 `port` 签发一张预览票据。
|
|
1894
|
+
*/
|
|
1895
|
+
export interface PreviewOpenParams {
|
|
1896
|
+
port: number;
|
|
1897
|
+
/**
|
|
1898
|
+
* 从哪个会话发起(只用于界面展示和审计;端口是否允许不看它,见 spec/daemon.md § 19.3)。
|
|
1899
|
+
*/
|
|
1900
|
+
session_id?: string | null;
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* `preview.open` 结果。`psk` 是票据的密钥,只交给预览页(放进 [`PreviewLaunch`]),不要写日志、不要发给 hub。
|
|
1904
|
+
*/
|
|
1905
|
+
export interface PreviewOpenResult {
|
|
1906
|
+
expires_at_ms: number;
|
|
1907
|
+
/**
|
|
1908
|
+
* 这个端口固定的预览 label(26 位小写 base32),预览 origin 是 `<label>.<预览域名>`。
|
|
1909
|
+
*/
|
|
1910
|
+
label: string;
|
|
1911
|
+
port: number;
|
|
1912
|
+
/**
|
|
1913
|
+
* 票据密钥,64 个小写 hex(32 字节),Noise PSK。
|
|
1914
|
+
*/
|
|
1915
|
+
psk: string;
|
|
1916
|
+
session_id?: string | null;
|
|
1917
|
+
/**
|
|
1918
|
+
* 票据 id,32 个小写 hex(16 字节)。
|
|
1919
|
+
*/
|
|
1920
|
+
ticket_id: string;
|
|
1921
|
+
}
|
|
1922
|
+
export interface PreviewPort {
|
|
1923
|
+
pid?: number | null;
|
|
1924
|
+
port: number;
|
|
1925
|
+
/**
|
|
1926
|
+
* 进程名(可执行文件名,不含参数)。
|
|
1927
|
+
*/
|
|
1928
|
+
process?: string | null;
|
|
1929
|
+
session_id?: string | null;
|
|
1930
|
+
source: PreviewPortSource;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* `preview.ports` 参数。带 `session_id` 只列这个会话的端口(外加配置里允许的端口)。
|
|
1934
|
+
*/
|
|
1935
|
+
export interface PreviewPortsParams {
|
|
1936
|
+
session_id?: string | null;
|
|
1937
|
+
}
|
|
1938
|
+
export interface PreviewPortsResult {
|
|
1939
|
+
detection: PreviewDetection;
|
|
1940
|
+
ports: PreviewPort[];
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* 隧道 `REQUEST` 帧的载荷(msgpack,字段名为键)。
|
|
1944
|
+
*/
|
|
1945
|
+
export interface PreviewRequestHead {
|
|
1946
|
+
/**
|
|
1947
|
+
* 请求头,按原顺序,名字小写。`cookie` 来自预览页自己的 cookie jar;daemon 转发前改写哪些头见
|
|
1948
|
+
* spec/daemon.md § 19.5。
|
|
1949
|
+
*/
|
|
1950
|
+
headers: [string, string][];
|
|
1951
|
+
method: string;
|
|
1952
|
+
/**
|
|
1953
|
+
* 以 `/` 开头,可带查询串;不含 scheme 和主机。
|
|
1954
|
+
*/
|
|
1955
|
+
path: string;
|
|
1956
|
+
/**
|
|
1957
|
+
* `true`:这是一个 WebSocket 升级请求(`method` 为 `GET`,子协议在 `sec-websocket-protocol` 头里)。
|
|
1958
|
+
*/
|
|
1959
|
+
websocket?: boolean;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* 隧道 `RESET` 帧的载荷(msgpack):终止这个 stream 的两个方向。
|
|
1963
|
+
*/
|
|
1964
|
+
export interface PreviewReset {
|
|
1965
|
+
code: PreviewResetCode;
|
|
1966
|
+
message?: string | null;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* 隧道 `RESPONSE` 帧的载荷(msgpack)。WebSocket 流里 `status = 101` 表示升级成功,其他状态码表示被拒,
|
|
1970
|
+
* 后面跟普通响应体。
|
|
1971
|
+
*/
|
|
1972
|
+
export interface PreviewResponseHead {
|
|
1973
|
+
encoding?: PreviewBodyEncoding & string;
|
|
1974
|
+
headers: [string, string][];
|
|
1975
|
+
status: number;
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* 一个项目 = 某个 workspace 根目录下的一个一级子文件夹,或一个关联的本机目录(`kind = linked`)。
|
|
1377
1979
|
* 元数据全部推导;只有「关联了哪些目录」存在 daemon 的库里。
|
|
1378
1980
|
*/
|
|
1379
1981
|
export interface Project {
|
|
@@ -1395,13 +1997,18 @@ export interface Project {
|
|
|
1395
1997
|
missing?: boolean;
|
|
1396
1998
|
modified_at_ms: number;
|
|
1397
1999
|
/**
|
|
1398
|
-
*
|
|
2000
|
+
* 项目名。所有 workspace 根下的项目和关联的项目共用一个命名空间,客户端的所有操作都用它。
|
|
1399
2001
|
*/
|
|
1400
2002
|
name: string;
|
|
1401
2003
|
/**
|
|
1402
2004
|
* 绝对路径,仅展示用。
|
|
1403
2005
|
*/
|
|
1404
2006
|
path: string;
|
|
2007
|
+
/**
|
|
2008
|
+
* 文件夹项目所在的 workspace 根(canonical 绝对路径,等于 `node.info.workspace_roots` 里的某一项的 `path`);
|
|
2009
|
+
* 关联项目没有。老版本的 daemon 不给,客户端当作主根。
|
|
2010
|
+
*/
|
|
2011
|
+
root?: string | null;
|
|
1405
2012
|
}
|
|
1406
2013
|
export interface GitMeta {
|
|
1407
2014
|
branch?: string | null;
|
|
@@ -1524,7 +2131,8 @@ export interface SessionWorktree {
|
|
|
1524
2131
|
export interface SessionCreateParams {
|
|
1525
2132
|
agent: string;
|
|
1526
2133
|
/**
|
|
1527
|
-
* 第一条消息的附件(`blob.put_end` 的结果)。agent
|
|
2134
|
+
* 第一条消息的附件(`blob.put_end` 的结果)。agent 原生收的 mime(`capabilities.attachments`)交给 adapter,
|
|
2135
|
+
* 其余落到会话工作目录、路径写在交给 agent 的文字里(ADR-44)。
|
|
1528
2136
|
*/
|
|
1529
2137
|
attachments?: AttachmentRef[];
|
|
1530
2138
|
/**
|
|
@@ -1740,26 +2348,45 @@ export interface SessionRenameParams {
|
|
|
1740
2348
|
title: string;
|
|
1741
2349
|
}
|
|
1742
2350
|
export interface SessionSearchParams {
|
|
2351
|
+
/**
|
|
2352
|
+
* 最多返回几条命中,默认 20,上限 200。
|
|
2353
|
+
*/
|
|
1743
2354
|
limit?: number | null;
|
|
2355
|
+
/**
|
|
2356
|
+
* 只搜这个项目里的会话。
|
|
2357
|
+
*/
|
|
1744
2358
|
project?: string | null;
|
|
2359
|
+
/**
|
|
2360
|
+
* 空白分隔的若干个词,每个词按前缀匹配、都要出现在同一段文字里;不能为空(`invalid`)。
|
|
2361
|
+
*/
|
|
1745
2362
|
query: string;
|
|
1746
2363
|
}
|
|
1747
2364
|
export interface SessionSearchResult {
|
|
1748
2365
|
hits: SearchHit[];
|
|
1749
2366
|
}
|
|
1750
2367
|
export interface SearchHit {
|
|
2368
|
+
/**
|
|
2369
|
+
* 命中的那段文字开始处的事件 seq:用户消息就是 `user_message` 的 seq;assistant 文字是那一段第一个 `text_delta` 的 seq
|
|
2370
|
+
* (长文字每 32 KiB 切一段索引,所以同一条回复可以有几个不同的 seq)。
|
|
2371
|
+
*/
|
|
1751
2372
|
seq: number;
|
|
1752
2373
|
session_id: string;
|
|
1753
2374
|
/**
|
|
1754
|
-
*
|
|
2375
|
+
* 命中处的片段。除了包住命中词的字面 `<mark>` / `</mark>`,里面没有 HTML:会话文字里原有的
|
|
2376
|
+
* `<` `>` `&` 已转义成 `<` `>` `&`,客户端按 `<mark>` 切开后把这三个实体还原成字符、
|
|
2377
|
+
* 当纯文本显示即可,不要当 HTML 解析。
|
|
1755
2378
|
*/
|
|
1756
2379
|
snippet: string;
|
|
2380
|
+
/**
|
|
2381
|
+
* 会话当前的标题。
|
|
2382
|
+
*/
|
|
1757
2383
|
title: string;
|
|
1758
2384
|
ts_ms: number;
|
|
1759
2385
|
}
|
|
1760
2386
|
export interface SessionSendParams {
|
|
1761
2387
|
/**
|
|
1762
|
-
* `blob.put_end` 的结果,每条至多 20 个。agent
|
|
2388
|
+
* `blob.put_end` 的结果,每条至多 20 个。agent 原生收的 mime(`capabilities.attachments`)交给 adapter,
|
|
2389
|
+
* 其余落到会话工作目录、路径写在交给 agent 的文字里(ADR-44)。
|
|
1763
2390
|
*/
|
|
1764
2391
|
attachments?: AttachmentRef[];
|
|
1765
2392
|
/**
|
|
@@ -1824,10 +2451,14 @@ export interface SessionSyncBaseResult {
|
|
|
1824
2451
|
export interface TrashEntry {
|
|
1825
2452
|
bytes: number;
|
|
1826
2453
|
/**
|
|
1827
|
-
* `.trash/` 下的目录名,如 `my-app-20261011T120000Z
|
|
2454
|
+
* `.trash/` 下的目录名,如 `my-app-20261011T120000Z`。每个根有自己的 `.trash/`,id 在所有根之间唯一。
|
|
1828
2455
|
*/
|
|
1829
2456
|
id: string;
|
|
1830
2457
|
original_name: string;
|
|
2458
|
+
/**
|
|
2459
|
+
* 条目所在(也是 `restore` 还原到)的 workspace 根。老版本的 daemon 不给,客户端当作主根。
|
|
2460
|
+
*/
|
|
2461
|
+
root?: string | null;
|
|
1831
2462
|
trashed_at_ms: number;
|
|
1832
2463
|
}
|
|
1833
2464
|
/**
|
|
@@ -1924,6 +2555,10 @@ export interface RenamedProject {
|
|
|
1924
2555
|
}
|
|
1925
2556
|
export interface WorkspaceCloneParams {
|
|
1926
2557
|
name?: string | null;
|
|
2558
|
+
/**
|
|
2559
|
+
* 克隆到哪个 workspace 根下,规则同 `WorkspaceCreateParams.root`。
|
|
2560
|
+
*/
|
|
2561
|
+
root?: string | null;
|
|
1927
2562
|
/**
|
|
1928
2563
|
* 只允许 `https://`、`ssh://`、`git@host:path` 三种形式。
|
|
1929
2564
|
*/
|
|
@@ -1932,6 +2567,11 @@ export interface WorkspaceCloneParams {
|
|
|
1932
2567
|
export interface WorkspaceCreateParams {
|
|
1933
2568
|
git_init?: boolean;
|
|
1934
2569
|
name: string;
|
|
2570
|
+
/**
|
|
2571
|
+
* 在哪个 workspace 根下新建。必须是 `node.info.workspace_roots` 里的某一项的 `path`;缺省 = 主根;
|
|
2572
|
+
* 不在列表里 → `invalid`,在列表里但现在不可用(`available = false`)→ `not_found`。
|
|
2573
|
+
*/
|
|
2574
|
+
root?: string | null;
|
|
1935
2575
|
}
|
|
1936
2576
|
/**
|
|
1937
2577
|
* `workspace.link`:把本机一个已有目录关联为项目。
|
|
@@ -1949,6 +2589,9 @@ export interface WorkspaceLinkParams {
|
|
|
1949
2589
|
}
|
|
1950
2590
|
export interface WorkspaceListResult {
|
|
1951
2591
|
projects: Project[];
|
|
2592
|
+
/**
|
|
2593
|
+
* 主根(`node.info.workspace_roots` 里 `primary` 的那一项)。其余根下的项目看 `Project.root`。
|
|
2594
|
+
*/
|
|
1952
2595
|
root: string;
|
|
1953
2596
|
}
|
|
1954
2597
|
export interface WorkspaceNameParams {
|