@plolink/sdk 0.0.8 → 0.0.10

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.
Files changed (58) hide show
  1. package/README.md +58 -4
  2. package/dist/{chunk-LHNCGCWW.js → chunk-4H4RACSE.js} +3 -137
  3. package/dist/chunk-4H4RACSE.js.map +1 -0
  4. package/dist/{chunk-WFBN23AH.cjs → chunk-NS3DJP2O.cjs} +2 -141
  5. package/dist/chunk-NS3DJP2O.cjs.map +1 -0
  6. package/dist/chunk-PJAJFV7D.js +139 -0
  7. package/dist/chunk-PJAJFV7D.js.map +1 -0
  8. package/dist/chunk-V6NFRYO2.cjs +145 -0
  9. package/dist/chunk-V6NFRYO2.cjs.map +1 -0
  10. package/dist/client-CAjIQKPm.d.cts +193 -0
  11. package/dist/client-CwNikk7i.d.ts +193 -0
  12. package/dist/common/index.cjs +19 -18
  13. package/dist/common/index.d.cts +2 -126
  14. package/dist/common/index.d.ts +2 -126
  15. package/dist/common/index.js +2 -1
  16. package/dist/index.cjs +18 -751
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +4 -410
  19. package/dist/index.d.ts +4 -410
  20. package/dist/index.js +4 -735
  21. package/dist/index.js.map +1 -1
  22. package/dist/modules/billing/index.cjs +1 -1
  23. package/dist/modules/billing/index.d.cts +1 -1
  24. package/dist/modules/billing/index.d.ts +1 -1
  25. package/dist/modules/billing/index.js +1 -1
  26. package/dist/modules/info-sync/index.cjs +275 -0
  27. package/dist/modules/info-sync/index.cjs.map +1 -0
  28. package/dist/modules/info-sync/index.d.cts +431 -0
  29. package/dist/modules/info-sync/index.d.ts +431 -0
  30. package/dist/modules/info-sync/index.js +269 -0
  31. package/dist/modules/info-sync/index.js.map +1 -0
  32. package/dist/modules/psychology-test/index.cjs +474 -0
  33. package/dist/modules/psychology-test/index.cjs.map +1 -0
  34. package/dist/{client-DXKAtLg1.d.ts → modules/psychology-test/index.d.cts} +34 -200
  35. package/dist/{client-l6cekf09.d.cts → modules/psychology-test/index.d.ts} +34 -200
  36. package/dist/modules/psychology-test/index.js +472 -0
  37. package/dist/modules/psychology-test/index.js.map +1 -0
  38. package/dist/modules/rbac/index.d.cts +1 -1
  39. package/dist/modules/rbac/index.d.ts +1 -1
  40. package/dist/modules/report-writer/index.cjs +282 -0
  41. package/dist/modules/report-writer/index.cjs.map +1 -0
  42. package/dist/modules/report-writer/index.d.cts +476 -0
  43. package/dist/modules/report-writer/index.d.ts +476 -0
  44. package/dist/modules/report-writer/index.js +280 -0
  45. package/dist/modules/report-writer/index.js.map +1 -0
  46. package/dist/modules/team/index.d.cts +1 -1
  47. package/dist/modules/team/index.d.ts +1 -1
  48. package/dist/modules/video-psych-analysis/index.cjs +1 -1
  49. package/dist/modules/video-psych-analysis/index.d.cts +1 -1
  50. package/dist/modules/video-psych-analysis/index.d.ts +1 -1
  51. package/dist/modules/video-psych-analysis/index.js +1 -1
  52. package/dist/modules/virtual-account/index.d.cts +1 -1
  53. package/dist/modules/virtual-account/index.d.ts +1 -1
  54. package/dist/signature-B5LL3Zij.d.cts +126 -0
  55. package/dist/signature-B5LL3Zij.d.ts +126 -0
  56. package/package.json +17 -1
  57. package/dist/chunk-LHNCGCWW.js.map +0 -1
  58. package/dist/chunk-WFBN23AH.cjs.map +0 -1
@@ -0,0 +1,476 @@
1
+ import { P as PlolinkClient } from '../../client-CAjIQKPm.cjs';
2
+ import '../../core-77EbLgbp.cjs';
3
+ import 'axios';
4
+
5
+ /**
6
+ * Report Writer 模块类型定义
7
+ */
8
+ /**
9
+ * 报告状态枚举
10
+ */
11
+ declare enum ReportStatus {
12
+ /** 未开始 */
13
+ PENDING = "PENDING",
14
+ /** 风格生成中 */
15
+ STYLE_GENERATING = "STYLE_GENERATING",
16
+ /** 材料摘要中 */
17
+ MATERIALS_SUMMARIZING = "MATERIALS_SUMMARIZING",
18
+ /** 结构生成中 */
19
+ STRUCTURE_GENERATING = "STRUCTURE_GENERATING",
20
+ /** 指引生成中 */
21
+ GUIDANCE_GENERATING = "GUIDANCE_GENERATING",
22
+ /** 内容生成中 */
23
+ CONTENT_GENERATING = "CONTENT_GENERATING",
24
+ /** 校对修订中 */
25
+ REVIEWING = "REVIEWING",
26
+ /** 已完成 */
27
+ COMPLETED = "COMPLETED",
28
+ /** 失败 */
29
+ FAILED = "FAILED"
30
+ }
31
+ /**
32
+ * 材料类型
33
+ */
34
+ type MaterialType = 'text';
35
+ /**
36
+ * 材料项
37
+ */
38
+ interface MaterialItem {
39
+ /** 材料类型 */
40
+ type: MaterialType;
41
+ /** 材料内容 */
42
+ content: string;
43
+ }
44
+ /**
45
+ * 材料摘要
46
+ */
47
+ interface MaterialsSummary {
48
+ /** 摘要内容(600-1200字) */
49
+ summary: string;
50
+ /** 关键事实 */
51
+ keyFacts: string[];
52
+ /** 关键词 */
53
+ keywords: string[];
54
+ }
55
+ /**
56
+ * 文章风格
57
+ */
58
+ interface ArticleStyle {
59
+ /** 语气 */
60
+ tone: string;
61
+ /** 写作风格 */
62
+ writingStyle: string;
63
+ /** 目标受众 */
64
+ targetAudience: string;
65
+ /** 特点 */
66
+ characteristics: string[];
67
+ }
68
+ /**
69
+ * 校对建议
70
+ */
71
+ interface ReviewSuggestion {
72
+ /** 是否需要修订 */
73
+ needsRevision: boolean;
74
+ /** 修改建议列表 */
75
+ suggestions: string[];
76
+ }
77
+ /**
78
+ * 文章节点(支持嵌套)
79
+ */
80
+ interface ArticleNode {
81
+ /** 节点标题 */
82
+ title: string;
83
+ /** 内容填充指引 */
84
+ guidance: string;
85
+ /** 生成的内容 */
86
+ content: string;
87
+ /** 校对建议 */
88
+ reviewSuggestion: ReviewSuggestion | null;
89
+ /** 校对后的内容(如果有修订) */
90
+ revisedContent: string;
91
+ /** 子节点数组 */
92
+ children: ArticleNode[];
93
+ }
94
+ /**
95
+ * 创建报告参数
96
+ */
97
+ interface CreateReportParams {
98
+ /** 报告名称 */
99
+ name: string;
100
+ /** 写作指令,描述要生成的文章内容 */
101
+ instruction: string;
102
+ /** 业务代号,用于后续处理策略分发 */
103
+ businessCode: string;
104
+ /** 外部ID,关联外部业务系统 */
105
+ externalId: string;
106
+ /** 参考材料数组 */
107
+ materials?: MaterialItem[];
108
+ /** 文章层级,1-3,默认 3 */
109
+ articleLevel?: number;
110
+ }
111
+ /**
112
+ * 创建报告响应
113
+ */
114
+ interface CreateReportResponse {
115
+ /** 报告ID */
116
+ id: string;
117
+ /** 消息 */
118
+ message: string;
119
+ }
120
+ /**
121
+ * 列表查询参数
122
+ */
123
+ interface ListReportsParams {
124
+ /** 页码,默认 1 */
125
+ page?: number;
126
+ /** 每页数量,默认 20 */
127
+ pageSize?: number;
128
+ /** 搜索关键词(报告名称、业务代号) */
129
+ keyword?: string;
130
+ /** 状态筛选 */
131
+ status?: ReportStatus;
132
+ /** 业务代号筛选 */
133
+ businessCode?: string;
134
+ }
135
+ /**
136
+ * 报告摘要(用于列表)
137
+ */
138
+ interface ReportSummary {
139
+ /** 报告ID */
140
+ id: string;
141
+ /** 报告名称 */
142
+ name: string;
143
+ /** 业务代号 */
144
+ businessCode: string;
145
+ /** 外部ID */
146
+ externalId: string;
147
+ /** 状态 */
148
+ status: ReportStatus;
149
+ /** 创建时间 */
150
+ createdAt: string;
151
+ /** 更新时间 */
152
+ updatedAt: string;
153
+ }
154
+ /**
155
+ * 列表响应
156
+ */
157
+ interface ListReportsResponse {
158
+ /** 报告列表 */
159
+ list: ReportSummary[];
160
+ /** 总数 */
161
+ total: number;
162
+ /** 当前页码 */
163
+ page: number;
164
+ /** 每页数量 */
165
+ pageSize: number;
166
+ }
167
+ /**
168
+ * 报告详情
169
+ */
170
+ interface ReportDetail {
171
+ /** 报告ID */
172
+ id: string;
173
+ /** 报告名称 */
174
+ name: string;
175
+ /** 写作指令 */
176
+ instruction: string;
177
+ /** 业务代号 */
178
+ businessCode: string;
179
+ /** 外部ID */
180
+ externalId: string;
181
+ /** 文章层级 */
182
+ articleLevel: number;
183
+ /** 参考材料 */
184
+ materials: MaterialItem[];
185
+ /** 材料摘要 */
186
+ materialsSummary: MaterialsSummary | null;
187
+ /** 文章风格 */
188
+ articleStyle: ArticleStyle | null;
189
+ /** 文章结构 */
190
+ articleStructure: ArticleNode[];
191
+ /** 状态 */
192
+ status: ReportStatus;
193
+ /** 错误信息 */
194
+ errorMessage: string;
195
+ /** 创建者ID */
196
+ creatorId: string;
197
+ /** 团队ID */
198
+ teamId: string;
199
+ /** 创建时间 */
200
+ createdAt: string;
201
+ /** 更新时间 */
202
+ updatedAt: string;
203
+ }
204
+ /**
205
+ * 获取 Markdown 响应
206
+ */
207
+ interface GetMarkdownResponse {
208
+ /** Markdown 格式的报告内容 */
209
+ markdown: string;
210
+ }
211
+ /**
212
+ * Webhook 数据结构
213
+ */
214
+ interface ReportWebhookData {
215
+ /** 业务模块 */
216
+ businessModule: 'report-writer';
217
+ /** 业务代码 */
218
+ businessCode: 'REPORT_COMPLETED' | 'REPORT_FAILED';
219
+ /** 业务ID(报告ID) */
220
+ businessId: string;
221
+ /** 业务数据 */
222
+ data: {
223
+ /** 报告ID */
224
+ reportId: string;
225
+ /** 外部ID */
226
+ externalId: string;
227
+ /** 业务代号 */
228
+ businessCode: string;
229
+ /** 状态(仅 REPORT_COMPLETED 时存在) */
230
+ status?: ReportStatus;
231
+ /** 报告详情(仅 REPORT_COMPLETED 时存在) */
232
+ reportDetail?: ReportDetail;
233
+ /** 错误信息(仅 REPORT_FAILED 时存在) */
234
+ errorMessage?: string;
235
+ };
236
+ /** 团队ID */
237
+ teamId: string;
238
+ /** 用户ID */
239
+ userId: string;
240
+ /** 同步记录ID */
241
+ syncRecordId: string;
242
+ /** 时间戳 */
243
+ timestamp: number;
244
+ }
245
+
246
+ /**
247
+ * Report Writer 模块
248
+ *
249
+ * @description
250
+ * 提供 AI 自动报告写作功能,支持:
251
+ * - 创建报告任务
252
+ * - 查询报告列表和详情
253
+ * - 删除报告
254
+ * - 导出 Markdown 格式
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import { PlolinkClient } from '@plolink/sdk';
259
+ *
260
+ * const client = new PlolinkClient({
261
+ * token: 'sk-your-api-key'
262
+ * });
263
+ *
264
+ * // 创建报告
265
+ * const createResult = await client.reportWriter.create({
266
+ * name: '2024年度总结报告',
267
+ * instruction: '请根据提供的材料,撰写一份年度工作总结报告',
268
+ * businessCode: 'annual-report',
269
+ * externalId: '2024-001',
270
+ * articleLevel: 3,
271
+ * materials: [
272
+ * {
273
+ * type: 'text',
274
+ * content: '2024年完成了10个项目,总营收增长30%...'
275
+ * }
276
+ * ]
277
+ * });
278
+ * console.log(`报告创建成功: ${createResult.id}`);
279
+ *
280
+ * // 查询报告详情(轮询检查状态)
281
+ * let detail = await client.reportWriter.getDetail(createResult.id);
282
+ * while (detail.status !== 'COMPLETED' && detail.status !== 'FAILED') {
283
+ * await new Promise(resolve => setTimeout(resolve, 5000));
284
+ * detail = await client.reportWriter.getDetail(createResult.id);
285
+ * console.log(`当前状态: ${detail.status}`);
286
+ * }
287
+ *
288
+ * // 获取 Markdown 格式
289
+ * if (detail.status === 'COMPLETED') {
290
+ * const markdown = await client.reportWriter.getMarkdown(createResult.id);
291
+ * console.log('报告内容:', markdown.markdown);
292
+ * }
293
+ * ```
294
+ *
295
+ * @module report-writer
296
+ */
297
+
298
+ /**
299
+ * Report Writer 模块类
300
+ *
301
+ * @description
302
+ * 提供 AI 报告写作相关功能的封装,包括创建报告、查询状态、导出结果等。
303
+ *
304
+ * 报告生成流程:
305
+ * 1. 调用 create() 创建报告,返回 reportId
306
+ * 2. 后端异步处理,经历多个阶段(STYLE_GENERATING → ... → COMPLETED)
307
+ * 3. 使用 getDetail() 轮询检查状态
308
+ * 4. 完成后调用 getMarkdown() 获取最终结果
309
+ *
310
+ * Webhook 通知:
311
+ * - REPORT_COMPLETED - 报告生成完成
312
+ * - REPORT_FAILED - 报告生成失败
313
+ */
314
+ declare class ReportWriter {
315
+ private client;
316
+ constructor(client: PlolinkClient);
317
+ /**
318
+ * 创建报告
319
+ *
320
+ * @description
321
+ * 创建一个新的报告任务,系统会自动加入队列进行处理。
322
+ * 报告生成过程是异步的,需要通过 getDetail() 方法轮询检查状态。
323
+ *
324
+ * @param params - 创建报告参数
325
+ * @param params.name - 报告名称
326
+ * @param params.instruction - 写作指令,描述要生成的文章内容
327
+ * @param params.businessCode - 业务代号,用于后续处理策略分发
328
+ * @param params.externalId - 外部ID,关联外部业务系统
329
+ * @param params.materials - 参考材料数组(可选)
330
+ * @param params.articleLevel - 文章层级,1-3,默认 3(可选)
331
+ *
332
+ * @returns 创建结果,包含报告ID
333
+ *
334
+ * @throws {PlolinkError} 参数验证失败或 API 调用失败
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const result = await client.reportWriter.create({
339
+ * name: '2024年度总结报告',
340
+ * instruction: '请根据提供的材料,撰写一份年度工作总结报告',
341
+ * businessCode: 'annual-report',
342
+ * externalId: '2024-001',
343
+ * articleLevel: 3,
344
+ * materials: [
345
+ * {
346
+ * type: 'text',
347
+ * content: '2024年完成了10个项目,总营收增长30%...'
348
+ * }
349
+ * ]
350
+ * });
351
+ * console.log(`报告ID: ${result.id}`);
352
+ * ```
353
+ */
354
+ create(params: CreateReportParams): Promise<CreateReportResponse>;
355
+ /**
356
+ * 获取报告列表
357
+ *
358
+ * @description
359
+ * 分页获取报告列表,支持按状态、业务代号、关键词筛选。
360
+ *
361
+ * @param params - 查询参数(可选)
362
+ * @param params.page - 页码,默认 1(可选)
363
+ * @param params.pageSize - 每页数量,默认 20(可选)
364
+ * @param params.keyword - 搜索关键词(报告名称、业务代号)(可选)
365
+ * @param params.status - 状态筛选(可选)
366
+ * @param params.businessCode - 业务代号筛选(可选)
367
+ *
368
+ * @returns 分页列表结果
369
+ *
370
+ * @throws {PlolinkError} API 调用失败
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * // 获取所有报告
375
+ * const allReports = await client.reportWriter.list();
376
+ *
377
+ * // 分页查询
378
+ * const page2 = await client.reportWriter.list({
379
+ * page: 2,
380
+ * pageSize: 10
381
+ * });
382
+ *
383
+ * // 按状态筛选
384
+ * const completedReports = await client.reportWriter.list({
385
+ * status: 'COMPLETED'
386
+ * });
387
+ *
388
+ * // 按业务代号和关键词筛选
389
+ * const filtered = await client.reportWriter.list({
390
+ * businessCode: 'annual-report',
391
+ * keyword: '2024'
392
+ * });
393
+ * ```
394
+ */
395
+ list(params?: ListReportsParams): Promise<ListReportsResponse>;
396
+ /**
397
+ * 获取报告详情
398
+ *
399
+ * @description
400
+ * 获取单个报告的完整详情,包括文章风格、结构化内容和生成状态。
401
+ * 可用于轮询检查报告生成进度。
402
+ *
403
+ * @param id - 报告ID
404
+ *
405
+ * @returns 报告详情
406
+ *
407
+ * @throws {PlolinkError} 报告不存在或 API 调用失败
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * // 获取报告详情
412
+ * const detail = await client.reportWriter.getDetail('report-123');
413
+ * console.log(`状态: ${detail.status}`);
414
+ *
415
+ * // 轮询检查状态
416
+ * let report = await client.reportWriter.getDetail('report-123');
417
+ * while (report.status !== 'COMPLETED' && report.status !== 'FAILED') {
418
+ * await new Promise(resolve => setTimeout(resolve, 5000)); // 等待5秒
419
+ * report = await client.reportWriter.getDetail('report-123');
420
+ * console.log(`当前状态: ${report.status}`);
421
+ * }
422
+ *
423
+ * if (report.status === 'COMPLETED') {
424
+ * console.log('报告生成完成');
425
+ * } else {
426
+ * console.error('报告生成失败:', report.errorMessage);
427
+ * }
428
+ * ```
429
+ */
430
+ getDetail(id: string): Promise<ReportDetail>;
431
+ /**
432
+ * 删除报告
433
+ *
434
+ * @description
435
+ * 软删除指定报告。已删除的报告无法恢复。
436
+ *
437
+ * @param id - 报告ID
438
+ *
439
+ * @returns Promise<void>
440
+ *
441
+ * @throws {PlolinkError} 报告不存在或 API 调用失败
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * await client.reportWriter.delete('report-123');
446
+ * console.log('报告已删除');
447
+ * ```
448
+ */
449
+ delete(id: string): Promise<void>;
450
+ /**
451
+ * 获取 Markdown 格式
452
+ *
453
+ * @description
454
+ * 将报告内容渲染为 Markdown 格式。
455
+ * 只有状态为 COMPLETED 的报告才能导出 Markdown。
456
+ *
457
+ * @param id - 报告ID
458
+ *
459
+ * @returns Markdown 内容
460
+ *
461
+ * @throws {PlolinkError} 报告不存在、未完成或 API 调用失败
462
+ *
463
+ * @example
464
+ * ```typescript
465
+ * const result = await client.reportWriter.getMarkdown('report-123');
466
+ * console.log(result.markdown);
467
+ *
468
+ * // 保存为文件
469
+ * const fs = require('fs');
470
+ * fs.writeFileSync('report.md', result.markdown, 'utf-8');
471
+ * ```
472
+ */
473
+ getMarkdown(id: string): Promise<GetMarkdownResponse>;
474
+ }
475
+
476
+ export { type ArticleNode, type ArticleStyle, type CreateReportParams, type CreateReportResponse, type GetMarkdownResponse, type ListReportsParams, type ListReportsResponse, type MaterialItem, type MaterialType, type MaterialsSummary, type ReportDetail, ReportStatus, type ReportSummary, type ReportWebhookData, ReportWriter, type ReviewSuggestion };