@plolink/sdk 0.0.9 → 0.0.11

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,736 @@
1
+ import { P as PlolinkClient } from '../../client-CAjIQKPm.cjs';
2
+ import '../../core-77EbLgbp.cjs';
3
+ import 'axios';
4
+
5
+ /**
6
+ * Preset Agent Task 模块类型定义
7
+ */
8
+ /**
9
+ * 预设执行状态
10
+ */
11
+ type PresetExecutionStatus = 'INITIALIZING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
12
+ /**
13
+ * Token和费用统计
14
+ */
15
+ interface ExecutionMetrics {
16
+ /** 输入Token数 */
17
+ inputTokens: number;
18
+ /** 输出Token数 */
19
+ outputTokens: number;
20
+ /** 缓存读取Token数 */
21
+ cacheReadTokens: number;
22
+ /** 缓存创建Token数 */
23
+ cacheCreationTokens: number;
24
+ /** 总费用(美元) */
25
+ totalCost: number;
26
+ }
27
+ /**
28
+ * 预设配置(完整信息)
29
+ */
30
+ interface PresetConfig {
31
+ /** 预设ID */
32
+ id: string;
33
+ /** 预设唯一标识 */
34
+ code: string;
35
+ /** 预设名称 */
36
+ name: string;
37
+ /** 预设描述 */
38
+ description?: string;
39
+ /** 预设指令模板 */
40
+ prompt: string;
41
+ /** AI模型 */
42
+ model: string;
43
+ /** 内置skills列表 */
44
+ selectedSkills: string[];
45
+ /** 扩展skills压缩包文件ID */
46
+ extendedSkillsFileId?: string;
47
+ /** 超时时间(毫秒),0表示永不超时 */
48
+ timeoutMs: number;
49
+ /** 静默超时(毫秒) */
50
+ silentTimeoutMs: number;
51
+ /** 业务标识 */
52
+ businessKey: string;
53
+ /** 是否启用 */
54
+ enabled: boolean;
55
+ /** 创建人ID */
56
+ creatorId: string;
57
+ /** 团队ID */
58
+ teamId: string;
59
+ /** 创建时间 */
60
+ createdAt: string;
61
+ /** 更新时间 */
62
+ updatedAt: string;
63
+ }
64
+ /**
65
+ * 预设列表项(精简信息)
66
+ */
67
+ interface PresetListItem {
68
+ /** 预设ID */
69
+ id: string;
70
+ /** 预设唯一标识 */
71
+ code: string;
72
+ /** 预设名称 */
73
+ name: string;
74
+ /** 预设描述 */
75
+ description?: string;
76
+ /** AI模型 */
77
+ model: string;
78
+ /** 是否启用 */
79
+ enabled: boolean;
80
+ /** 创建时间 */
81
+ createdAt: string;
82
+ /** 更新时间 */
83
+ updatedAt: string;
84
+ }
85
+ /**
86
+ * 创建预设参数
87
+ */
88
+ interface CreatePresetParams {
89
+ /** 预设唯一标识(团队内唯一) */
90
+ code: string;
91
+ /** 预设名称 */
92
+ name: string;
93
+ /** 预设描述 */
94
+ description?: string;
95
+ /** 预设指令模板 */
96
+ prompt: string;
97
+ /** AI模型 */
98
+ model: string;
99
+ /** 内置skills列表 */
100
+ selectedSkills?: string[];
101
+ /** 扩展skills压缩包文件ID */
102
+ extendedSkillsFileId?: string;
103
+ /** 超时时间(毫秒),0表示永不超时 */
104
+ timeoutMs?: number;
105
+ /** 静默超时(毫秒) */
106
+ silentTimeoutMs?: number;
107
+ /** 业务标识 */
108
+ businessKey: string;
109
+ /** 是否启用 */
110
+ enabled?: boolean;
111
+ }
112
+ /**
113
+ * 更新预设参数
114
+ */
115
+ interface UpdatePresetParams {
116
+ /** 预设名称 */
117
+ name?: string;
118
+ /** 预设描述 */
119
+ description?: string;
120
+ /** 预设指令模板 */
121
+ prompt?: string;
122
+ /** AI模型 */
123
+ model?: string;
124
+ /** 内置skills列表 */
125
+ selectedSkills?: string[];
126
+ /** 扩展skills压缩包文件ID */
127
+ extendedSkillsFileId?: string;
128
+ /** 超时时间(毫秒) */
129
+ timeoutMs?: number;
130
+ /** 静默超时(毫秒) */
131
+ silentTimeoutMs?: number;
132
+ /** 业务标识 */
133
+ businessKey?: string;
134
+ /** 是否启用 */
135
+ enabled?: boolean;
136
+ }
137
+ /**
138
+ * 执行预设参数
139
+ */
140
+ interface ExecutePresetParams {
141
+ /** 预设唯一标识 */
142
+ code: string;
143
+ /** 附加指令(与预设指令合并) */
144
+ additionalPrompt?: string;
145
+ /** 输入文件ID(ZIP格式) */
146
+ inputFileId?: string;
147
+ }
148
+ /**
149
+ * 预设执行记录(完整详情)
150
+ *
151
+ * ⚠️ 注意:不包含 agentTaskId、runId(完全隐藏Agent Task细节)
152
+ */
153
+ interface PresetExecution {
154
+ /** 执行ID */
155
+ id: string;
156
+ /** 预设ID */
157
+ presetId: string;
158
+ /** 预设标识 */
159
+ presetCode: string;
160
+ /** 预设名称 */
161
+ presetName: string;
162
+ /** 附加指令 */
163
+ additionalPrompt?: string;
164
+ /** 输入文件ID */
165
+ inputFileId?: string;
166
+ /** 输出文件ID(对外暴露) */
167
+ outputFileId?: string;
168
+ /** 最终合并的prompt */
169
+ finalPrompt: string;
170
+ /** 执行状态 */
171
+ status: PresetExecutionStatus;
172
+ /** 执行时长(毫秒) */
173
+ duration: number;
174
+ /** 错误信息 */
175
+ errorMessage?: string;
176
+ /** Token和费用统计 */
177
+ metrics: ExecutionMetrics;
178
+ /** 创建人ID */
179
+ creatorId: string;
180
+ /** 团队ID */
181
+ teamId: string;
182
+ /** 创建时间 */
183
+ createdAt: string;
184
+ /** 更新时间 */
185
+ updatedAt: string;
186
+ /** 完成时间 */
187
+ completedAt?: string;
188
+ }
189
+ /**
190
+ * 执行记录列表项(精简信息)
191
+ */
192
+ interface PresetExecutionListItem {
193
+ /** 执行ID */
194
+ id: string;
195
+ /** 预设ID */
196
+ presetId: string;
197
+ /** 预设标识 */
198
+ presetCode: string;
199
+ /** 预设名称 */
200
+ presetName: string;
201
+ /** 执行状态 */
202
+ status: PresetExecutionStatus;
203
+ /** 输入文件ID */
204
+ inputFileId?: string;
205
+ /** 输出文件ID */
206
+ outputFileId?: string;
207
+ /** 执行时长(毫秒) */
208
+ duration: number;
209
+ /** 创建人ID */
210
+ creatorId: string;
211
+ /** 创建时间 */
212
+ createdAt: string;
213
+ /** 更新时间 */
214
+ updatedAt: string;
215
+ /** 完成时间 */
216
+ completedAt?: string;
217
+ }
218
+ /**
219
+ * 预设列表查询参数
220
+ */
221
+ interface PresetListQuery {
222
+ /** 是否启用 */
223
+ enabled?: boolean;
224
+ /** 页码(从1开始) */
225
+ page?: number;
226
+ /** 每页数量 */
227
+ pageSize?: number;
228
+ }
229
+ /**
230
+ * 执行记录列表查询参数
231
+ */
232
+ interface ExecutionListQuery {
233
+ /** 预设ID */
234
+ presetId?: string;
235
+ /** 执行状态 */
236
+ status?: PresetExecutionStatus;
237
+ /** 页码(从1开始) */
238
+ page?: number;
239
+ /** 每页数量 */
240
+ pageSize?: number;
241
+ }
242
+ /**
243
+ * 分页结果
244
+ */
245
+ interface PaginatedResult<T> {
246
+ /** 数据列表 */
247
+ list: T[];
248
+ /** 总条数 */
249
+ total: number;
250
+ /** 当前页码 */
251
+ page: number;
252
+ /** 每页数量 */
253
+ pageSize: number;
254
+ }
255
+ /**
256
+ * 执行结果(execute方法的返回值)
257
+ */
258
+ interface ExecutionResult {
259
+ /** 执行ID */
260
+ executionId: string;
261
+ /** 初始状态 */
262
+ status: PresetExecutionStatus;
263
+ }
264
+ /**
265
+ * 预设配置(用于导出/导入,不含团队特定字段)
266
+ */
267
+ interface PresetConfigForExport {
268
+ /** 预设唯一标识 */
269
+ code: string;
270
+ /** 预设名称 */
271
+ name: string;
272
+ /** 预设描述 */
273
+ description?: string;
274
+ /** 预设指令模板 */
275
+ prompt: string;
276
+ /** AI模型 */
277
+ model: string;
278
+ /** 内置skills列表 */
279
+ selectedSkills: string[];
280
+ /** 扩展skills压缩包文件ID */
281
+ extendedSkillsFileId?: string;
282
+ /** 超时时间(毫秒) */
283
+ timeoutMs: number;
284
+ /** 静默超时(毫秒) */
285
+ silentTimeoutMs: number;
286
+ /** 业务标识 */
287
+ businessKey: string;
288
+ /** 是否启用 */
289
+ enabled: boolean;
290
+ }
291
+ /**
292
+ * 导出配置
293
+ */
294
+ interface ExportedConfig {
295
+ /** 配置版本 */
296
+ version: string;
297
+ /** 导出时间 */
298
+ exportedAt: string;
299
+ /** 预设配置数组 */
300
+ presets: PresetConfigForExport[];
301
+ }
302
+ /**
303
+ * 导入结果详情
304
+ */
305
+ interface ImportResultDetail {
306
+ /** 预设标识 */
307
+ code: string;
308
+ /** 导入状态 */
309
+ status: 'imported' | 'skipped' | 'failed';
310
+ /** 预设ID(导入成功时返回) */
311
+ presetId?: string;
312
+ /** 错误信息(导入失败时返回) */
313
+ error?: string;
314
+ }
315
+ /**
316
+ * 导入结果
317
+ */
318
+ interface ImportResult {
319
+ /** 导入成功数量 */
320
+ imported: number;
321
+ /** 跳过数量 */
322
+ skipped: number;
323
+ /** 失败数量 */
324
+ failed: number;
325
+ /** 详细结果 */
326
+ details: ImportResultDetail[];
327
+ }
328
+ /**
329
+ * 冲突策略
330
+ */
331
+ type ConflictStrategy = 'skip' | 'overwrite';
332
+ /**
333
+ * Webhook负载(执行完成通知)
334
+ *
335
+ * ⚠️ 注意:不包含 agentTaskId、runId(完全隐藏Agent Task)
336
+ */
337
+ interface PresetExecutionWebhookPayload {
338
+ /** 模块名 */
339
+ module: 'preset-agent-task';
340
+ /** 动作 */
341
+ action: 'execution.completed' | 'execution.failed';
342
+ /** 时间戳 */
343
+ timestamp: string;
344
+ /** 数据 */
345
+ data: {
346
+ /** 执行ID */
347
+ executionId: string;
348
+ /** 预设标识 */
349
+ presetCode: string;
350
+ /** 预设名称 */
351
+ presetName: string;
352
+ /** 执行状态 */
353
+ status: 'COMPLETED' | 'FAILED';
354
+ /** 输入文件ID */
355
+ inputFileId?: string;
356
+ /** 输出文件ID */
357
+ outputFileId?: string;
358
+ /** 执行时长(毫秒) */
359
+ duration: number;
360
+ /** 错误信息 */
361
+ errorMessage?: string;
362
+ /** Token和费用统计 */
363
+ metrics: ExecutionMetrics;
364
+ };
365
+ }
366
+
367
+ /**
368
+ * 预设Agent任务模块
369
+ *
370
+ * @description
371
+ * 预设Agent任务是对Agent Task能力的封装,提供开箱即用的业务能力。
372
+ *
373
+ * 核心功能:
374
+ * - 预设配置管理(CRUD)
375
+ * - 预设执行(通过code调用)
376
+ * - 执行记录查询
377
+ * - 执行管理(取消、重试)
378
+ * - 配置导出/导入
379
+ *
380
+ * 注意:完全隐藏Agent Task实现细节,不暴露agentTaskId、runId
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * import { PlolinkClient } from '@plolink/sdk';
385
+ * import { PresetAgentTask } from '@plolink/sdk/preset-agent-task';
386
+ *
387
+ * const client = new PlolinkClient({
388
+ * mode: 'apiKey',
389
+ * apiKey: 'your-api-key'
390
+ * });
391
+ *
392
+ * const presetAgentTask = new PresetAgentTask(client);
393
+ *
394
+ * // 执行预设
395
+ * const result = await presetAgentTask.execute({
396
+ * code: 'talent-resume-parse',
397
+ * additionalPrompt: '请特别关注技能匹配度',
398
+ * inputFileId: 'file-resume-123'
399
+ * });
400
+ *
401
+ * console.log('执行ID:', result.executionId);
402
+ * console.log('初始状态:', result.status);
403
+ *
404
+ * // 方式1:轮询查询结果
405
+ * const execution = await presetAgentTask.getExecutionById(result.executionId);
406
+ * console.log('输出文件:', execution.outputFileId);
407
+ *
408
+ * // 方式2:通过Webhook接收结果(需要在系统中配置Webhook)
409
+ * // POST /your-webhook-url
410
+ * // { module: "preset-agent-task", action: "execution.completed", data: {...} }
411
+ * ```
412
+ *
413
+ * @module preset-agent-task
414
+ */
415
+
416
+ /**
417
+ * 预设Agent任务模块
418
+ */
419
+ declare class PresetAgentTask {
420
+ private client;
421
+ private baseUrl;
422
+ constructor(client: PlolinkClient);
423
+ /**
424
+ * 创建预设
425
+ *
426
+ * @param params - 创建参数
427
+ * @returns 预设ID和code
428
+ * @throws {PlolinkError} 当参数无效或创建失败时抛出
429
+ *
430
+ * @example
431
+ * ```typescript
432
+ * const result = await presetAgentTask.create({
433
+ * code: 'talent-resume-parse',
434
+ * name: '简历解析预设',
435
+ * description: '自动解析简历并提取关键信息',
436
+ * prompt: '请解析上传的简历文件,提取候选人的基本信息、教育背景、工作经历等关键数据',
437
+ * model: 'doubao-seed-1-6-lite-251015',
438
+ * selectedSkills: ['talent/resume-parse', 'common/file-extract'],
439
+ * timeoutMs: 1800000,
440
+ * businessKey: 'talent-resume-parse'
441
+ * });
442
+ *
443
+ * console.log('预设ID:', result.id);
444
+ * console.log('预设标识:', result.code);
445
+ * ```
446
+ */
447
+ create(params: CreatePresetParams): Promise<{
448
+ id: string;
449
+ code: string;
450
+ }>;
451
+ /**
452
+ * 获取预设列表
453
+ *
454
+ * @param options - 查询选项
455
+ * @returns 分页的预设列表
456
+ * @throws {PlolinkError} 当请求失败时抛出
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * // 获取所有启用的预设
461
+ * const result = await presetAgentTask.list({
462
+ * enabled: true,
463
+ * page: 1,
464
+ * pageSize: 20
465
+ * });
466
+ *
467
+ * console.log('总数:', result.total);
468
+ * result.list.forEach(preset => {
469
+ * console.log(`${preset.code}: ${preset.name}`);
470
+ * });
471
+ * ```
472
+ */
473
+ list(options?: PresetListQuery): Promise<PaginatedResult<PresetListItem>>;
474
+ /**
475
+ * 获取预设详情
476
+ *
477
+ * @param id - 预设ID
478
+ * @returns 预设详细信息
479
+ * @throws {PlolinkError} 当预设不存在时抛出
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * const preset = await presetAgentTask.getById('clx_preset_123');
484
+ * console.log('预设名称:', preset.name);
485
+ * console.log('预设指令:', preset.prompt);
486
+ * console.log('AI模型:', preset.model);
487
+ * ```
488
+ */
489
+ getById(id: string): Promise<PresetConfig>;
490
+ /**
491
+ * 通过code获取预设
492
+ *
493
+ * @param code - 预设唯一标识
494
+ * @returns 预设详细信息
495
+ * @throws {PlolinkError} 当预设不存在时抛出
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * const preset = await presetAgentTask.getByCode('talent-resume-parse');
500
+ * console.log('预设ID:', preset.id);
501
+ * console.log('预设名称:', preset.name);
502
+ * ```
503
+ */
504
+ getByCode(code: string): Promise<PresetConfig>;
505
+ /**
506
+ * 更新预设
507
+ *
508
+ * @param id - 预设ID
509
+ * @param params - 更新参数
510
+ * @throws {PlolinkError} 当预设不存在或更新失败时抛出
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * await presetAgentTask.update('clx_preset_123', {
515
+ * name: '简历解析预设(更新)',
516
+ * enabled: false
517
+ * });
518
+ *
519
+ * console.log('预设更新成功');
520
+ * ```
521
+ */
522
+ update(id: string, params: UpdatePresetParams): Promise<void>;
523
+ /**
524
+ * 删除预设
525
+ *
526
+ * @param id - 预设ID
527
+ * @throws {PlolinkError} 当预设不存在或删除失败时抛出
528
+ *
529
+ * @example
530
+ * ```typescript
531
+ * await presetAgentTask.delete('clx_preset_123');
532
+ * console.log('预设删除成功');
533
+ * ```
534
+ */
535
+ delete(id: string): Promise<void>;
536
+ /**
537
+ * 执行预设(核心方法)
538
+ *
539
+ * @description
540
+ * 通过预设code执行预设任务。可以附加额外指令和输入文件。
541
+ *
542
+ * 执行后可以通过以下方式获取结果:
543
+ * - 方式1:轮询查询 - 使用 getExecutionById() 定期查询执行状态
544
+ * - 方式2:Webhook推送 - 配置Webhook接收执行完成通知
545
+ *
546
+ * @param params - 执行参数
547
+ * @returns 执行ID和初始状态
548
+ * @throws {PlolinkError} 当预设不存在或执行失败时抛出
549
+ *
550
+ * @example
551
+ * ```typescript
552
+ * // 执行预设
553
+ * const result = await presetAgentTask.execute({
554
+ * code: 'talent-resume-parse',
555
+ * additionalPrompt: '请特别关注技能匹配度',
556
+ * inputFileId: 'file-resume-123'
557
+ * });
558
+ *
559
+ * console.log('执行ID:', result.executionId);
560
+ * console.log('初始状态:', result.status); // 'INITIALIZING'
561
+ *
562
+ * // 方式1:轮询查询结果
563
+ * let execution;
564
+ * do {
565
+ * await new Promise(resolve => setTimeout(resolve, 5000)); // 等待5秒
566
+ * execution = await presetAgentTask.getExecutionById(result.executionId);
567
+ * console.log('当前状态:', execution.status);
568
+ * } while (execution.status === 'INITIALIZING' || execution.status === 'RUNNING');
569
+ *
570
+ * console.log('执行完成!');
571
+ * console.log('输出文件:', execution.outputFileId);
572
+ * console.log('Token消耗:', execution.metrics.inputTokens);
573
+ * console.log('费用:', execution.metrics.totalCost);
574
+ *
575
+ * // 方式2:通过Webhook接收结果(需要在系统中配置)
576
+ * // Webhook URL会收到POST请求:
577
+ * // {
578
+ * // module: "preset-agent-task",
579
+ * // action: "execution.completed",
580
+ * // data: {
581
+ * // executionId: "...",
582
+ * // outputFileId: "...",
583
+ * // metrics: {...}
584
+ * // }
585
+ * // }
586
+ * ```
587
+ */
588
+ execute(params: ExecutePresetParams): Promise<ExecutionResult>;
589
+ /**
590
+ * 获取执行记录列表
591
+ *
592
+ * @param options - 查询选项
593
+ * @returns 分页的执行记录列表
594
+ * @throws {PlolinkError} 当请求失败时抛出
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * // 查询特定预设的执行记录
599
+ * const result = await presetAgentTask.listExecutions({
600
+ * presetId: 'clx_preset_123',
601
+ * status: 'COMPLETED',
602
+ * page: 1,
603
+ * pageSize: 20
604
+ * });
605
+ *
606
+ * console.log('总数:', result.total);
607
+ * result.list.forEach(execution => {
608
+ * console.log(`执行ID: ${execution.id}, 状态: ${execution.status}`);
609
+ * });
610
+ * ```
611
+ */
612
+ listExecutions(options?: ExecutionListQuery): Promise<PaginatedResult<PresetExecutionListItem>>;
613
+ /**
614
+ * 获取执行详情
615
+ *
616
+ * @description
617
+ * 获取执行记录的完整信息,包括输出文件ID、Token消耗、费用等。
618
+ * 注意:不包含agentTaskId、runId(完全隐藏Agent Task细节)
619
+ *
620
+ * @param executionId - 执行ID
621
+ * @returns 执行详细信息
622
+ * @throws {PlolinkError} 当执行记录不存在时抛出
623
+ *
624
+ * @example
625
+ * ```typescript
626
+ * const execution = await presetAgentTask.getExecutionById('clx_exec_789');
627
+ *
628
+ * console.log('执行状态:', execution.status);
629
+ * console.log('预设名称:', execution.presetName);
630
+ * console.log('输入文件:', execution.inputFileId);
631
+ * console.log('输出文件:', execution.outputFileId);
632
+ * console.log('执行时长:', execution.duration, 'ms');
633
+ * console.log('Token消耗:', execution.metrics.inputTokens, '+', execution.metrics.outputTokens);
634
+ * console.log('总费用:', execution.metrics.totalCost, 'USD');
635
+ *
636
+ * if (execution.status === 'FAILED') {
637
+ * console.error('错误信息:', execution.errorMessage);
638
+ * }
639
+ * ```
640
+ */
641
+ getExecutionById(executionId: string): Promise<PresetExecution>;
642
+ /**
643
+ * 取消执行
644
+ *
645
+ * @param executionId - 执行ID
646
+ * @param reason - 取消原因(可选)
647
+ * @throws {PlolinkError} 当执行不存在或取消失败时抛出
648
+ *
649
+ * @example
650
+ * ```typescript
651
+ * await presetAgentTask.cancelExecution('clx_exec_789', '用户主动取消');
652
+ * console.log('执行已取消');
653
+ * ```
654
+ */
655
+ cancelExecution(executionId: string, reason?: string): Promise<void>;
656
+ /**
657
+ * 重新执行
658
+ *
659
+ * @description
660
+ * 使用相同的参数重新执行预设任务。
661
+ *
662
+ * @param executionId - 原执行ID
663
+ * @returns 新的执行ID和状态
664
+ * @throws {PlolinkError} 当原执行不存在或重试失败时抛出
665
+ *
666
+ * @example
667
+ * ```typescript
668
+ * const result = await presetAgentTask.retryExecution('clx_exec_789');
669
+ * console.log('新执行ID:', result.executionId);
670
+ * console.log('初始状态:', result.status);
671
+ * ```
672
+ */
673
+ retryExecution(executionId: string): Promise<ExecutionResult>;
674
+ /**
675
+ * 导出预设配置
676
+ *
677
+ * @description
678
+ * 导出选中的预设配置为JSON格式,可用于跨团队/环境迁移。
679
+ * 注意:extendedSkillsFileId需要手动处理(文件不跨团队)
680
+ *
681
+ * @param presetIds - 预设ID数组
682
+ * @returns 导出的配置(JSON格式)
683
+ * @throws {PlolinkError} 当预设不存在或导出失败时抛出
684
+ *
685
+ * @example
686
+ * ```typescript
687
+ * const config = await presetAgentTask.export(['clx_preset_123', 'clx_preset_456']);
688
+ *
689
+ * console.log('配置版本:', config.version);
690
+ * console.log('导出时间:', config.exportedAt);
691
+ * console.log('预设数量:', config.presets.length);
692
+ *
693
+ * // 保存到文件(Node.js环境)
694
+ * const fs = require('fs');
695
+ * fs.writeFileSync('presets.json', JSON.stringify(config, null, 2));
696
+ * ```
697
+ */
698
+ export(presetIds: string[]): Promise<ExportedConfig>;
699
+ /**
700
+ * 导入预设配置
701
+ *
702
+ * @description
703
+ * 从导出的JSON配置导入预设到当前团队。
704
+ * 支持冲突处理策略:skip(跳过已存在)或 overwrite(覆盖已存在)
705
+ *
706
+ * @param config - 导出的配置
707
+ * @param conflictStrategy - 冲突策略('skip' 或 'overwrite'),默认 'skip'
708
+ * @returns 导入结果
709
+ * @throws {PlolinkError} 当配置无效或导入失败时抛出
710
+ *
711
+ * @example
712
+ * ```typescript
713
+ * // 从文件读取(Node.js环境)
714
+ * const fs = require('fs');
715
+ * const config = JSON.parse(fs.readFileSync('presets.json', 'utf-8'));
716
+ *
717
+ * // 导入(跳过已存在的code)
718
+ * const result = await presetAgentTask.import(config, 'skip');
719
+ * console.log('导入成功:', result.imported);
720
+ * console.log('跳过:', result.skipped);
721
+ * console.log('失败:', result.failed);
722
+ *
723
+ * result.details.forEach(detail => {
724
+ * console.log(`${detail.code}: ${detail.status}`);
725
+ * if (detail.status === 'imported') {
726
+ * console.log(' 新预设ID:', detail.presetId);
727
+ * } else if (detail.status === 'failed') {
728
+ * console.log(' 错误:', detail.error);
729
+ * }
730
+ * });
731
+ * ```
732
+ */
733
+ import(config: ExportedConfig, conflictStrategy?: ConflictStrategy): Promise<ImportResult>;
734
+ }
735
+
736
+ export { type ConflictStrategy, type CreatePresetParams, type ExecutePresetParams, type ExecutionListQuery, type ExecutionMetrics, type ExecutionResult, type ExportedConfig, type ImportResult, type ImportResultDetail, type PaginatedResult, PresetAgentTask, type PresetConfig, type PresetConfigForExport, type PresetExecution, type PresetExecutionListItem, type PresetExecutionStatus, type PresetExecutionWebhookPayload, type PresetListItem, type PresetListQuery, type UpdatePresetParams };