@ai_mind/ade-plugin-sdk 0.0.0-stage → 0.1.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.
@@ -0,0 +1,712 @@
1
+ // 由 sdk/scripts/sync-types.mjs 从 ADE 宿主生成,请勿手工修改。
2
+ export interface Project {
3
+ /** Absolute path of the project directory */
4
+ path: string;
5
+ /** Display name (basename) */
6
+ name: string;
7
+ /** Last opened timestamp */
8
+ lastOpened: number;
9
+ }
10
+ export interface Worktree {
11
+ /** Absolute path of the worktree directory */
12
+ path: string;
13
+ /** Branch name (null when detached) */
14
+ branch: string | null;
15
+ /** Commit hash the worktree points to */
16
+ commit: string;
17
+ /** True when this is the main working tree of the git repo */
18
+ main: boolean;
19
+ /** True when this worktree is the project directory itself (non-git "current dir" mode) */
20
+ current: boolean;
21
+ }
22
+ export interface FileNode {
23
+ name: string;
24
+ path: string;
25
+ type: 'file' | 'dir';
26
+ /** Children, only present when type === 'dir' and expanded */
27
+ children?: FileNode[];
28
+ }
29
+ /** 复制/创建副本后实际写入磁盘的条目 */
30
+ export interface CopiedEntry {
31
+ path: string;
32
+ type: 'file' | 'dir';
33
+ }
34
+ /**
35
+ * 文件探测结果:路径不存在/不可访问时用 kind='missing' 表达,不抛错。
36
+ * 编辑器靠它区分「不是文件」(目录、已删除)与「临时读到一半」。
37
+ */
38
+ export interface FileStat {
39
+ mtimeMs: number;
40
+ size: number;
41
+ kind: 'file' | 'dir' | 'other' | 'missing';
42
+ }
43
+ /** A chat adapter entry (built-in or registered by a plugin) */
44
+ export interface ChatAdapterInfo {
45
+ id: string;
46
+ label: string;
47
+ description?: string;
48
+ kind: 'terminal' | 'sdk';
49
+ /** Spawn command for terminal adapters */
50
+ command?: string;
51
+ /** Plugin that registered this adapter, if any */
52
+ plugin?: string;
53
+ /**
54
+ * 该 agent CLI 的「YOLO / 跳过权限确认」参数(如 qoder 的 --dangerously-skip-permissions)。
55
+ * 未声明表示该 CLI 没有这类参数,设置页不提供 YOLO 开关。
56
+ */
57
+ yoloFlag?: string;
58
+ }
59
+ export type { PluginInfo } from './plugins.js';
60
+ export interface OpenTab {
61
+ path: string;
62
+ name: string;
63
+ }
64
+ export interface ChatSessionInfo {
65
+ id: string;
66
+ adapterId: string;
67
+ adapterLabel: string;
68
+ worktree: string;
69
+ cwd: string;
70
+ running: boolean;
71
+ /** 适配器是否支持原生结构化对话(聊天视图) */
72
+ chatSupported: boolean;
73
+ /** 底层 agent CLI 的会话标识(聊天视图与终端视图共用,切换不丢内容) */
74
+ cliSessionId?: string;
75
+ /** 该标识是否已经持久化,可安全传给 CLI/App Server 执行 resume。 */
76
+ cliSessionResumable?: boolean;
77
+ /** 协议是否原生流式输出(true 时渲染层直接显示增量;false 用打字机动画) */
78
+ streaming?: boolean;
79
+ /** CLI/插件当前是否可用;历史中的会话在适配器缺失时仍可查看 */
80
+ available?: boolean;
81
+ /** 适配器是否支持把本地文件作为对话附件发送 */
82
+ attachmentSupported?: boolean;
83
+ /** 适配器实际接受的附件类型;路径引用不属于附件。 */
84
+ attachmentKinds?: ChatAttachmentKind[];
85
+ }
86
+ /** 从 CLI --help 解析出的可配置选项(新会话对话框动态渲染,与 CLI 对齐) */
87
+ export interface CliOption {
88
+ /** 长选项名,如 --model */
89
+ flag: string;
90
+ /** 短选项名,如 -m */
91
+ short?: string;
92
+ /** 是否接收参数值 */
93
+ takesValue: boolean;
94
+ /** help 中声明的可选值(choices),无则自由输入 */
95
+ choices?: string[];
96
+ /** 面向用户的中文字段名;未提供时由 flag 生成。 */
97
+ label?: string;
98
+ /** 选项值的显示名(传给 CLI / App Server 的仍是原始 value)。 */
99
+ choiceLabels?: Record<string, string>;
100
+ /** 选项值的补充说明,用于 title 提示。 */
101
+ choiceDescriptions?: Record<string, string>;
102
+ /** 依赖另一个配置项时,按其值提供不同 choices(例如模型对应的思考等级)。 */
103
+ dependsOn?: string;
104
+ choicesByValue?: Record<string, string[]>;
105
+ /** CLI/App Server 的当前默认值;空配置仍表示跟随 provider 默认。 */
106
+ defaultValue?: string;
107
+ defaultValuesByValue?: Record<string, string>;
108
+ description: string;
109
+ /** 是否为核心配置项(协议声明,显示在对话配置条上;其余在「更多配置」) */
110
+ core?: boolean;
111
+ }
112
+ /** agent CLI 返回的模型选择项;value 是实际传给 --model 的值。 */
113
+ export interface CliModelOption {
114
+ value: string;
115
+ label: string;
116
+ /** 面向用户的分组标题,例如“默认(Default)”。 */
117
+ group?: string;
118
+ description?: string;
119
+ /** 模型上下文窗口(tokens),CLI 输出可解析时提供(如 pi --list-models 的 context 列) */
120
+ contextWindow?: number;
121
+ }
122
+ /** 结构化消息内容块(原生对话视图的数据单元) */
123
+ export type StructuredBlock = {
124
+ type: 'thinking';
125
+ text: string;
126
+ } | {
127
+ type: 'text';
128
+ text: string;
129
+ } | {
130
+ type: 'plan';
131
+ text?: string;
132
+ steps?: Array<{
133
+ step: string;
134
+ status: 'pending' | 'in_progress' | 'completed';
135
+ }>;
136
+ } | {
137
+ type: 'file_change';
138
+ changes: Array<{
139
+ path: string;
140
+ kind: string;
141
+ diff?: string;
142
+ }>;
143
+ status?: string;
144
+ } | {
145
+ type: 'diff';
146
+ text: string;
147
+ } | {
148
+ type: 'tool_use';
149
+ id: string;
150
+ name: string;
151
+ input: unknown;
152
+ /** 工具执行结果(渲染层按 tool_use_id 挂载) */
153
+ result?: {
154
+ content: string;
155
+ isError?: boolean;
156
+ };
157
+ } | {
158
+ type: 'tool_result';
159
+ toolUseId: string;
160
+ content: string;
161
+ isError?: boolean;
162
+ };
163
+ export type ChatAttachmentKind = 'image' | 'file';
164
+ /** 用户在图形化对话中附加的本地文件。 */
165
+ export interface ChatAttachment {
166
+ path: string;
167
+ name: string;
168
+ /** image / file;不依赖渲染进程自行猜测 MIME。 */
169
+ kind: ChatAttachmentKind;
170
+ }
171
+ export interface ChatMessageRecord {
172
+ id: string;
173
+ role: 'user' | 'assistant' | 'system';
174
+ content?: string;
175
+ blocks?: StructuredBlock[];
176
+ attachments?: ChatAttachment[];
177
+ /** 消息是否已产出完整内容(结构化事件按 messageId 更新)。 */
178
+ done?: boolean;
179
+ /** 排队、发送或取消状态;缺省表示已完成的普通历史消息。 */
180
+ status?: 'queued' | 'sending' | 'cancelled' | 'error';
181
+ createdAt: number;
182
+ /** 用于把 CLI 原生历史与 ADE 辅助消息安全合并。 */
183
+ source?: 'ade' | 'provider' | 'system';
184
+ }
185
+ export interface ChatApprovalQuestion {
186
+ id: string;
187
+ header: string;
188
+ question: string;
189
+ secret?: boolean;
190
+ options?: Array<{
191
+ label: string;
192
+ description?: string;
193
+ }>;
194
+ }
195
+ /** agent 在一轮对话中等待用户确认或补充输入。 */
196
+ export interface ChatApprovalRequest {
197
+ requestId: string;
198
+ kind: 'command' | 'file_change' | 'user_input';
199
+ title: string;
200
+ detail?: string;
201
+ command?: string;
202
+ cwd?: string;
203
+ url?: string;
204
+ questions?: ChatApprovalQuestion[];
205
+ allowForSession?: boolean;
206
+ }
207
+ export interface ChatApprovalResponse {
208
+ decision?: 'accept' | 'accept_for_session' | 'decline' | 'cancel';
209
+ answers?: Record<string, string[]>;
210
+ }
211
+ export interface ChatTokenUsage {
212
+ inputTokens?: number;
213
+ cachedInputTokens?: number;
214
+ outputTokens?: number;
215
+ reasoningOutputTokens?: number;
216
+ totalTokens?: number;
217
+ contextWindow?: number;
218
+ /** provider 直接给出的上下文占用比例(0-1),如 qoder 的 context_usage_ratio;展示时优先于推算 */
219
+ contextUsedRatio?: number;
220
+ /** 产生该统计的模型(用于按模型列表推断上下文窗口) */
221
+ model?: string;
222
+ }
223
+ /** 主进程持久化、渲染进程直接水合的完整会话快照。 */
224
+ export interface ChatSessionRecord {
225
+ info: ChatSessionInfo;
226
+ /** 会话记录的创建来源;用于避免 provider 扫描与 daemon/relay 记录互相覆盖。 */
227
+ origin?: 'desktop-created' | 'relay-created' | 'provider-indexed';
228
+ /** 0.21.3 写入的兼容字段;读取后迁移到 origin。 */
229
+ externalOrigin?: 'relay-created';
230
+ /** 是否作为当前工作区中的已打开会话展示;关闭后仍保留在历史中。 */
231
+ open: boolean;
232
+ kind: 'terminal' | 'sdk';
233
+ chatSupported: boolean;
234
+ view: 'terminal' | 'chat';
235
+ messages: ChatMessageRecord[];
236
+ /** 有界终端回放缓冲;完整上下文仍由 CLI 自己持久化。 */
237
+ raw: string;
238
+ turnRunning: boolean;
239
+ config: Record<string, string>;
240
+ projectPath: string | null;
241
+ name: string;
242
+ createdAt: number;
243
+ lastActiveAt: number;
244
+ updatedAt: number;
245
+ queuedCount: number;
246
+ pendingApproval?: ChatApprovalRequest | null;
247
+ usage?: ChatTokenUsage;
248
+ }
249
+ export interface ChatHistoryFile {
250
+ version: 1;
251
+ sessions: ChatSessionRecord[];
252
+ }
253
+ /** 结构化对话事件(主进程解析 agent CLI 协议后广播给渲染层) */
254
+ export interface StructuredEvent {
255
+ kind: 'init' | 'message' | 'tool_result' | 'result' | 'exit' | 'error' | 'approval' | 'approval_resolved' | 'usage';
256
+ /** CLI 会话标识(init/result 事件携带) */
257
+ sessionId?: string;
258
+ messageId?: string;
259
+ role?: 'user' | 'assistant' | 'system';
260
+ blocks?: StructuredBlock[];
261
+ attachments?: ChatAttachment[];
262
+ /** tool_result 事件:对应的 tool_use id */
263
+ toolUseId?: string;
264
+ /** tool_result 事件:工具输出;result 事件:本轮最终文本;error 事件:错误消息 */
265
+ content?: string;
266
+ text?: string;
267
+ isError?: boolean;
268
+ model?: string;
269
+ message?: string;
270
+ approval?: ChatApprovalRequest;
271
+ usage?: ChatTokenUsage;
272
+ done?: boolean;
273
+ }
274
+ /** 单个 worktree 记忆的编辑区状态(打开文件、活动标签、各文件浏览位置) */
275
+ export interface WorktreeTabState {
276
+ openTabs: string[];
277
+ activeTab: string | null;
278
+ dirty: Record<string, boolean>;
279
+ /** 各文件在该 worktree 下的滚动位置(px),用于切回时恢复浏览位置 */
280
+ scrolls: Record<string, number>;
281
+ }
282
+ export type AreaKey = 'project' | 'worktree' | 'files' | 'editor' | 'chat' | 'dingtalk' | 'aone';
283
+ export type AoneCategory = 'req' | 'bug' | 'task';
284
+ /** a1 CLI 可用性与 BUC 登录状态。 */
285
+ export interface AoneStatus {
286
+ available: boolean;
287
+ authenticated: boolean;
288
+ message: string;
289
+ executable?: string;
290
+ version?: string;
291
+ account?: {
292
+ username?: string;
293
+ name?: string;
294
+ employeeId?: string;
295
+ email?: string;
296
+ };
297
+ }
298
+ export interface AoneFieldOption {
299
+ identifier: string;
300
+ displayValue: string;
301
+ value: string;
302
+ }
303
+ export interface AoneWorkItemType {
304
+ identifier: string;
305
+ displayName: string;
306
+ category: AoneCategory;
307
+ isDefault: boolean;
308
+ statuses: AoneFieldOption[];
309
+ priorities: AoneFieldOption[];
310
+ }
311
+ /** 同名状态在不同工作项类型中可能使用不同 identifier,按显示值合并为一列。 */
312
+ export interface AoneBoardColumn {
313
+ key: string;
314
+ name: string;
315
+ typeIds: string[];
316
+ identifiers: Record<string, string>;
317
+ }
318
+ export interface AoneMember {
319
+ employeeId: string;
320
+ realName: string;
321
+ nickname: string;
322
+ status?: string;
323
+ roleName?: string;
324
+ }
325
+ export interface AoneView {
326
+ identifier: string;
327
+ name: string;
328
+ type?: string;
329
+ category?: string;
330
+ }
331
+ export interface AoneWorkItem {
332
+ id: string;
333
+ title: string;
334
+ url: string;
335
+ category: AoneCategory;
336
+ typeIdentifier?: string;
337
+ typeName?: string;
338
+ status: string;
339
+ assignee?: string;
340
+ assigneeId?: string;
341
+ priority?: string;
342
+ sprint?: string;
343
+ module?: string;
344
+ updatedAt?: string;
345
+ }
346
+ export interface AoneBoardData {
347
+ project: {
348
+ id: string;
349
+ name: string;
350
+ description?: string;
351
+ };
352
+ types: AoneWorkItemType[];
353
+ columns: AoneBoardColumn[];
354
+ cards: AoneWorkItem[];
355
+ members: AoneMember[];
356
+ views: AoneView[];
357
+ loadedAt: string;
358
+ }
359
+ export interface AoneBoardRequest {
360
+ /** 项目 ID,或包含项目 ID 的 Aone 工作项 URL。 */
361
+ project: string;
362
+ categories?: AoneCategory[];
363
+ filter?: string;
364
+ view?: string;
365
+ refreshMetadata?: boolean;
366
+ }
367
+ export interface AoneWorkItemField {
368
+ identifier: string;
369
+ label: string;
370
+ value: unknown;
371
+ displayValue?: string;
372
+ format?: string;
373
+ className?: string;
374
+ required?: boolean;
375
+ }
376
+ export interface AoneComment {
377
+ id: string;
378
+ author?: string;
379
+ createdAt?: string;
380
+ content: string;
381
+ }
382
+ export interface AoneActivity {
383
+ actionType?: string;
384
+ eventTime?: string;
385
+ operator?: string;
386
+ property?: string;
387
+ oldValue?: string;
388
+ newValue?: string;
389
+ }
390
+ export interface AoneRelationItem {
391
+ type?: string;
392
+ id?: string;
393
+ title?: string;
394
+ status?: string;
395
+ assignee?: string;
396
+ name?: string;
397
+ url?: string;
398
+ }
399
+ export interface AoneAttachment {
400
+ id: string;
401
+ name: string;
402
+ size?: string;
403
+ creator?: string;
404
+ createdAt?: string;
405
+ }
406
+ export interface AoneWorkItemDetail {
407
+ id: string;
408
+ title: string;
409
+ url: string;
410
+ description?: string;
411
+ creator?: string;
412
+ createdAt?: string;
413
+ updatedAt?: string;
414
+ fields: AoneWorkItemField[];
415
+ comments: AoneComment[];
416
+ activity: AoneActivity[];
417
+ relations: Record<string, AoneRelationItem[]>;
418
+ attachments: AoneAttachment[];
419
+ /** 辅助数据失败不应阻塞详情主体,用中文提示降级项。 */
420
+ partialErrors: string[];
421
+ }
422
+ export interface AoneCreateField {
423
+ identifier: string;
424
+ displayName: string;
425
+ required: boolean;
426
+ format?: string;
427
+ className?: string;
428
+ aliases: string[];
429
+ options: AoneFieldOption[];
430
+ }
431
+ export interface AoneCreateRequest {
432
+ projectId: string;
433
+ category: AoneCategory;
434
+ typeId: string;
435
+ title: string;
436
+ description?: string;
437
+ fields?: Record<string, string | string[]>;
438
+ }
439
+ export interface AoneUpdateRequest {
440
+ id: string;
441
+ status?: string;
442
+ assignee?: string;
443
+ sprint?: string;
444
+ priority?: string;
445
+ module?: string;
446
+ }
447
+ export type ThemeMode = 'light' | 'dark' | 'system';
448
+ export type Density = 'standard' | 'compact';
449
+ export interface AppearanceSettings {
450
+ /** 浅色 / 深色 / 跟随系统 */
451
+ theme: ThemeMode;
452
+ /** 强调色(hex,如 #0a7cff) */
453
+ accent: string;
454
+ /** UI 密度 */
455
+ density: Density;
456
+ /** 侧栏毛玻璃(macOS vibrancy) */
457
+ vibrancy: boolean;
458
+ }
459
+ export interface EditorSettings {
460
+ /** 正文字体栈 */
461
+ fontFamily: string;
462
+ /** 正文字号(px) */
463
+ fontSize: number;
464
+ /** 行高 */
465
+ lineHeight: number;
466
+ /** 字距(em) */
467
+ letterSpacing: number;
468
+ /** 代码字体栈 */
469
+ codeFontFamily: string;
470
+ /** 代码字号(px) */
471
+ codeFontSize: number;
472
+ /** 有预览的代码块(mermaid/svg/latex)默认只看图 */
473
+ previewOnlyByDefault: boolean;
474
+ }
475
+ export interface AgentSettings {
476
+ /** 从「新对话」列表隐藏的 adapter id */
477
+ hidden: string[];
478
+ /**
479
+ * 启用 YOLO(跳过权限确认)的 adapter id:新建会话时自动把该 CLI 的
480
+ * yoloFlag 并入会话配置;已有会话保持创建时的设置不变。
481
+ */
482
+ yolo: string[];
483
+ }
484
+ export interface DingTalkSettings {
485
+ cli: 'dws' | 'dwsx';
486
+ dwsxPath: string;
487
+ /** 留空使用 DWSX_DATA_DIR 或 ~/.local/share/dwsx,与终端共用登录态 */
488
+ dwsxDataDir?: string;
489
+ /** dws CLI 路径;留空时自动从 PATH 与常见目录探测 */
490
+ dwsPath: string;
491
+ }
492
+ export interface AppSettings {
493
+ appearance: AppearanceSettings;
494
+ editor: EditorSettings;
495
+ agents: AgentSettings;
496
+ dingtalk: DingTalkSettings;
497
+ }
498
+ /** 应用状态(原 state.json + localStorage ade-areas 的统一归宿) */
499
+ export interface AdeState {
500
+ projects: Project[];
501
+ areasVisible: Record<AreaKey, boolean>;
502
+ worktreeTabs: Record<string, WorktreeTabState>;
503
+ /** 插件功能区域的显示状态,以插件 ID 和区域 ID 组合为 key。 */
504
+ pluginAreasVisible?: Record<string, boolean>;
505
+ }
506
+ /** ~/.ade/settings.json 的完整结构 */
507
+ export interface AdeSettingsFile {
508
+ version: 2;
509
+ settings: AppSettings;
510
+ state: AdeState;
511
+ }
512
+ /** settings:set 的增量补丁:各节按 key 浅合并,数组字段整体替换 */
513
+ export interface SettingsPatch {
514
+ settings?: {
515
+ appearance?: Partial<AppearanceSettings>;
516
+ editor?: Partial<EditorSettings>;
517
+ agents?: Partial<AgentSettings>;
518
+ dingtalk?: Partial<DingTalkSettings>;
519
+ };
520
+ state?: Partial<AdeState>;
521
+ }
522
+ /** 设置页 Agent 列表项(桌面可新建的适配器 + 当前隐藏状态) */
523
+ export interface AgentSettingInfo extends ChatAdapterInfo {
524
+ hidden: boolean;
525
+ }
526
+ /** dws / 钉钉集成状态(设置页与钉钉面板共用) */
527
+ export interface DingTalkStatus {
528
+ cliKind?: 'dws' | 'dwsx';
529
+ dataDirectory?: string;
530
+ available: boolean;
531
+ authenticated: boolean;
532
+ version?: string;
533
+ /** dws 0.x 旧版接口线:上传走 doc create 而非 doc import */
534
+ legacy?: boolean;
535
+ message: string;
536
+ executable?: string;
537
+ }
538
+ /** 钉钉在线文档搜索结果条目 */
539
+ export interface DingTalkDocItem {
540
+ nodeId: string;
541
+ name: string;
542
+ docType?: string;
543
+ url?: string;
544
+ createTime?: number | string;
545
+ modifiedTime?: number | string;
546
+ creatorUid?: string;
547
+ creatorName?: string;
548
+ creatorNick?: string;
549
+ workspaceId?: string;
550
+ workspaceName?: string;
551
+ }
552
+ export type DingTalkDocDownloadFormat = 'dingdoc' | 'markdown';
553
+ /** 钉钉听记列表条目 */
554
+ export interface DingTalkMinutesItem {
555
+ taskUuid: string;
556
+ title: string;
557
+ url?: string;
558
+ startTime?: number | string;
559
+ status?: string;
560
+ creatorUid?: string;
561
+ creatorName?: string;
562
+ creatorNick?: string;
563
+ }
564
+ /** 下载到本地的结果 */
565
+ export interface DingTalkDownloadResult {
566
+ kind: 'doc' | 'minutes';
567
+ path: string;
568
+ title?: string;
569
+ url?: string;
570
+ taskUuid?: string;
571
+ /** dingdoc / dingmin 文件夹等场景下应打开的首选文件 */
572
+ entryPath?: string;
573
+ /** 钉钉文档/听记下载格式 */
574
+ format?: 'dingdoc' | 'dingmin' | 'markdown';
575
+ }
576
+ /** 可作为上传目标的钉钉知识库 / 个人空间 */
577
+ export interface DingTalkUploadWorkspace {
578
+ workspaceId: string;
579
+ name: string;
580
+ /** org = 组织知识库;mine = 「我的文档」个人空间 */
581
+ type: 'org' | 'mine';
582
+ }
583
+ /** 知识库内的文件夹节点(上传目标位置选择) */
584
+ export interface DingTalkUploadFolderNode {
585
+ nodeId: string;
586
+ name: string;
587
+ }
588
+ /** 粘贴钉钉链接后解析出的上传目标 */
589
+ export interface DingTalkUploadTarget {
590
+ /** 知识库 ID / URL */
591
+ workspace: string;
592
+ /** 文件夹 ID / URL */
593
+ folder: string;
594
+ /** 给人看的位置描述 */
595
+ label: string;
596
+ /** 链接指向文档本身时:可作为覆盖上传目标 */
597
+ document?: {
598
+ nodeId: string;
599
+ name: string;
600
+ };
601
+ }
602
+ /** 上传本地 Markdown 为钉钉文档的结果 */
603
+ export interface DingTalkUploadResult {
604
+ success: boolean;
605
+ documentUrl?: string;
606
+ nodeId?: string;
607
+ documentName?: string;
608
+ taskId?: string;
609
+ message?: string;
610
+ /** 随文档上传的本地图片(含 SVG)统计;无本地图片时不存在 */
611
+ images?: {
612
+ total: number;
613
+ inserted: number;
614
+ /** 上传失败的本地图片文件名 */
615
+ missing: string[];
616
+ /** 未能清理的占位块数量 */
617
+ leftoverPlaceholders: number;
618
+ };
619
+ }
620
+ /**
621
+ * dwsx JSONML 读取范围。不传 scope = 整篇 canonical body(root);
622
+ * outline 只取标题大纲(fragment,heading 带 uuid,可当块 ID)。
623
+ */
624
+ export type DingTalkJsonmlScope = 'outline' | 'tags' | 'section' | 'range';
625
+ /** dwsx doc read --content-format jsonml 的读取选项 */
626
+ export interface DingTalkJsonmlReadOptions {
627
+ scope?: DingTalkJsonmlScope;
628
+ /** scope=tags:只取指定标签的块 */
629
+ tags?: string[];
630
+ /** scope=range:起始块 ID(可从块列表 / outline 的 uuid 取) */
631
+ startBlockId?: string;
632
+ /** scope=range:结束块 ID */
633
+ endBlockId?: string;
634
+ /** scope=section/outline:最大层级 */
635
+ maxDepth?: number;
636
+ /** 指定文档历史版本 */
637
+ version?: number | string;
638
+ /** 落盘路径;留空写入 ADE 钉钉缓存目录,读回文件即覆盖前的备份 */
639
+ outputPath?: string;
640
+ }
641
+ /** JSONML canonical body(["root"|"fragment", attrs, ...blocks])读取结果 */
642
+ export interface DingTalkJsonmlDocument {
643
+ nodeId: string;
644
+ jsonml: unknown[];
645
+ contentFormat: 'jsonml';
646
+ /** 落盘备份路径,可直接作为 overwriteDocJsonml 的 filePath 回写 */
647
+ savedPath?: string;
648
+ bytes?: number;
649
+ revision?: string;
650
+ scope?: DingTalkJsonmlScope;
651
+ }
652
+ /**
653
+ * JSONML 覆盖输入:裸数组 / { jsonml: [...] } / { jsonml: "…" } / 读回落盘的信封。
654
+ * filePath 与对象形态都接受,ADE 与 dwsx 一样逐层解包。
655
+ */
656
+ export type DingTalkJsonmlInput = unknown[] | {
657
+ jsonml: unknown;
658
+ } | {
659
+ filePath: string;
660
+ };
661
+ /** JSONML 整篇覆盖结果 */
662
+ export interface DingTalkJsonmlWriteResult {
663
+ success: boolean;
664
+ message?: string;
665
+ nodeId?: string;
666
+ documentUrl?: string;
667
+ documentName?: string;
668
+ chunksWritten?: number;
669
+ }
670
+ /** 块 element 写入结果(dwsx doc block update / insert) */
671
+ export interface DingTalkBlockWriteResult {
672
+ success: boolean;
673
+ message?: string;
674
+ }
675
+ /** 日志等级:error > warn > info > debug */
676
+ export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
677
+ /** 单条日志 */
678
+ export interface LogEntry {
679
+ id: number;
680
+ /** ISO 时间戳 */
681
+ time: string;
682
+ level: LogLevel;
683
+ /** 模块标签,如 chat / daemon / renderer */
684
+ scope: string;
685
+ message: string;
686
+ /** 错误堆栈 / 附加数据 */
687
+ detail?: string;
688
+ }
689
+ /** 日志列表过滤条件 */
690
+ export interface LogFilter {
691
+ /** 最低严重级别:debug 表示全部 */
692
+ level?: LogLevel;
693
+ scope?: string;
694
+ query?: string;
695
+ limit?: number;
696
+ }
697
+ /** 可恢复的钉钉上传任务,正文与图片分别记录完成状态。 */
698
+ export interface DingTalkUploadJob {
699
+ filePath: string;
700
+ title?: string;
701
+ folder?: string;
702
+ workspace?: string;
703
+ nodeId?: string;
704
+ status: 'running' | 'failed' | 'completed';
705
+ step: string;
706
+ error?: string;
707
+ result?: DingTalkUploadResult;
708
+ steps: {
709
+ label: string;
710
+ status: 'running' | 'completed' | 'failed';
711
+ }[];
712
+ }