weaver-work-cli 0.1.29 → 0.1.31

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 (185) hide show
  1. package/dist/chunks/archive-U766FTFH.js +2537 -0
  2. package/dist/chunks/archive-oa-DMWEKX3L.js +1317 -0
  3. package/dist/chunks/asset-TCR7VDEV.js +2109 -0
  4. package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
  5. package/dist/chunks/blog-EVZWGDVM.js +2157 -0
  6. package/dist/chunks/caizhilian-JOWS6SL5.js +10087 -0
  7. package/dist/chunks/calendar-5WNCV66Q.js +1195 -0
  8. package/dist/chunks/chunk-2DUV44UX.js +15606 -0
  9. package/dist/chunks/chunk-324YPTC2.js +1607 -0
  10. package/dist/chunks/chunk-65QMVWHS.js +231 -0
  11. package/dist/chunks/chunk-6V7ZLF34.js +387 -0
  12. package/dist/chunks/chunk-AC7KJWC5.js +358 -0
  13. package/dist/chunks/chunk-AJ62BGAW.js +29 -0
  14. package/dist/chunks/chunk-BUSC6UAE.js +43 -0
  15. package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
  16. package/dist/chunks/chunk-D4LTJSJD.js +477 -0
  17. package/dist/chunks/chunk-EG6ZU444.js +654 -0
  18. package/dist/chunks/chunk-EZALDOQH.js +383 -0
  19. package/dist/chunks/chunk-FMPJJYYI.js +106 -0
  20. package/dist/chunks/chunk-G2JSIUWF.js +769 -0
  21. package/dist/chunks/chunk-GCG2NMWR.js +703 -0
  22. package/dist/chunks/chunk-GPMFD4RD.js +75 -0
  23. package/dist/chunks/chunk-H3WDBYJW.js +508 -0
  24. package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
  25. package/dist/chunks/chunk-J7RJTZSV.js +5556 -0
  26. package/dist/chunks/chunk-LUSPKZKY.js +53 -0
  27. package/dist/chunks/chunk-NIAJ5ZCG.js +73 -0
  28. package/dist/chunks/chunk-NOODWMCL.js +584 -0
  29. package/dist/chunks/chunk-OOUTBLZ4.js +51 -0
  30. package/dist/chunks/chunk-P26ZWSKU.js +73 -0
  31. package/dist/chunks/chunk-QWY6PGL6.js +3472 -0
  32. package/dist/chunks/chunk-R2IJAK7T.js +464 -0
  33. package/dist/chunks/chunk-R7O5PUWO.js +205 -0
  34. package/dist/chunks/chunk-RCGYCOMG.js +6962 -0
  35. package/dist/chunks/chunk-VZTXRG6X.js +403 -0
  36. package/dist/chunks/chunk-WHD4XMRP.js +161 -0
  37. package/dist/chunks/chunk-YLCYX7LE.js +371 -0
  38. package/dist/chunks/chunk-ZEDWSH32.js +68 -0
  39. package/dist/chunks/continuation-2CKSBLA6.js +11 -0
  40. package/dist/chunks/continuation-HZIZRZBX.js +13 -0
  41. package/dist/chunks/continuation-NLECEJPX.js +11 -0
  42. package/dist/chunks/ebuilder-form-NJ4YK6CC.js +2276 -0
  43. package/dist/chunks/ehr-MMYN36VA.js +5241 -0
  44. package/dist/chunks/employee-SAK2QYXX.js +11 -0
  45. package/dist/chunks/esb-HIWHOU7Q.js +141 -0
  46. package/dist/chunks/fna-KBACQTA5.js +1444 -0
  47. package/dist/chunks/host-3OHS5QUX.js +21 -0
  48. package/dist/chunks/host-IG6KEH5Q.js +19 -0
  49. package/dist/chunks/host-KQL5N4HO.js +23 -0
  50. package/dist/chunks/host-LLSZQCWR.js +17 -0
  51. package/dist/chunks/hrm-LYEC67ZQ.js +244 -0
  52. package/dist/chunks/im-RN2UKAEU.js +252 -0
  53. package/dist/chunks/invoice-EEPHLAF6.js +5179 -0
  54. package/dist/chunks/jiuchuanhui-WVVZYSJE.js +1940 -0
  55. package/dist/chunks/lazy-dispatch-MDOFFL2S.js +28 -0
  56. package/dist/chunks/mail-LNQLTF6L.js +2695 -0
  57. package/dist/chunks/meeting-XSD3BDVQ.js +504 -0
  58. package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
  59. package/dist/chunks/okr-TMWTIU2K.js +2482 -0
  60. package/dist/chunks/plan-A2FSFA7T.js +2025 -0
  61. package/dist/chunks/project-T26QLBQF.js +1361 -0
  62. package/dist/chunks/registry-2VLUAESA.js +14 -0
  63. package/dist/chunks/registry-JCFEYXOE.js +18 -0
  64. package/dist/chunks/registry-NYPYMZXG.js +16 -0
  65. package/dist/chunks/registry-Q7OQJ3SU.js +19 -0
  66. package/dist/chunks/registry-ZJMJVWFA.js +19 -0
  67. package/dist/chunks/room-recommend-UR4ZDZS6.js +20 -0
  68. package/dist/chunks/schedule-5L2PM4M6.js +24 -0
  69. package/dist/chunks/state-Y2XBP6YE.js +15 -0
  70. package/dist/chunks/workflow-TR6PG2SL.js +245 -0
  71. package/dist/cmd/argv.js +45 -0
  72. package/dist/cmd/docs/index.js +3 -3
  73. package/dist/cmd/lazy-dispatch.js +20 -0
  74. package/dist/cmd/root.js +2 -4
  75. package/dist/cmd/setup/index.js +2 -2
  76. package/dist/cmd/skills/index.js +2 -2
  77. package/dist/core/package-paths.js +47 -0
  78. package/dist/index.js +163 -7
  79. package/dist/internal/e10/auth/xiaoe.js +3 -3
  80. package/dist/internal/e10/request-runtime.js +18 -62
  81. package/dist/internal/skills/detector.js +2 -2
  82. package/dist/shortcuts/contract/data/performance-catalog.js +1306 -0
  83. package/dist/shortcuts/contract/host.js +91 -35
  84. package/dist/shortcuts/contract/index.js +213 -0
  85. package/dist/shortcuts/contract/manifest.js +928 -0
  86. package/dist/shortcuts/contract/ooxml/docx.js +295 -0
  87. package/dist/shortcuts/contract/ooxml/xlsx.js +221 -0
  88. package/dist/shortcuts/contract/ooxml/zip.js +158 -0
  89. package/dist/shortcuts/contract/operations/assistant.js +1156 -0
  90. package/dist/shortcuts/contract/operations/clause-library.js +522 -0
  91. package/dist/shortcuts/contract/operations/compare.js +193 -0
  92. package/dist/shortcuts/contract/operations/credit-page.js +34 -0
  93. package/dist/shortcuts/contract/operations/flow.js +98 -0
  94. package/dist/shortcuts/contract/operations/page.js +66 -0
  95. package/dist/shortcuts/contract/operations/performance.js +733 -0
  96. package/dist/shortcuts/contract/operations/quote.js +557 -0
  97. package/dist/shortcuts/contract/operations/recommend.js +78 -0
  98. package/dist/shortcuts/contract/operations/registry.js +18 -0
  99. package/dist/shortcuts/contract/operations/review.js +83 -0
  100. package/dist/shortcuts/contract/operations/shared.js +37 -0
  101. package/dist/shortcuts/contract/operations/upload.js +108 -0
  102. package/dist/shortcuts/contract/operations/write.js +3 -2
  103. package/dist/shortcuts/index.js +140 -40
  104. package/dist/shortcuts/invoice/manifest.js +34 -11
  105. package/dist/shortcuts/invoice/operations/reim-auto.js +9 -0
  106. package/dist/shortcuts/invoice/operations/reim.js +81 -5
  107. package/dist/shortcuts/invoice/operations/shared.js +12 -5
  108. package/dist/shortcuts/meeting/host.js +45 -3
  109. package/dist/shortcuts/meeting/invitation/docx.js +442 -0
  110. package/dist/shortcuts/meeting/operations/attachment-content.js +418 -0
  111. package/dist/shortcuts/meeting/operations/attachment.js +442 -0
  112. package/dist/shortcuts/meeting/operations/eb/cache.js +57 -0
  113. package/dist/shortcuts/meeting/operations/eb/catalog.js +343 -28
  114. package/dist/shortcuts/meeting/operations/eb/conflict.js +372 -11
  115. package/dist/shortcuts/meeting/operations/eb/create-flow.js +710 -0
  116. package/dist/shortcuts/meeting/operations/eb/decision.js +47 -1
  117. package/dist/shortcuts/meeting/operations/eb/factory.js +129 -11
  118. package/dist/shortcuts/meeting/operations/eb/index.js +122 -2
  119. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +378 -0
  120. package/dist/shortcuts/meeting/operations/eb/room-summary.js +84 -0
  121. package/dist/shortcuts/meeting/operations/eb/schedule.js +450 -0
  122. package/dist/shortcuts/meeting/operations/from-group-chat.js +576 -0
  123. package/dist/shortcuts/meeting/operations/invitation.js +458 -0
  124. package/dist/shortcuts/meeting/operations/minute-content.js +266 -0
  125. package/dist/shortcuts/meeting/operations/pipeline.js +489 -0
  126. package/dist/shortcuts/meeting/operations/qrcode.js +131 -0
  127. package/dist/shortcuts/meeting/operations/receipts.js +1 -1
  128. package/dist/shortcuts/meeting/operations/registry.js +18 -0
  129. package/dist/shortcuts/meeting/operations/summary.js +276 -0
  130. package/dist/shortcuts/meeting/operations/task-notify.js +325 -0
  131. package/dist/shortcuts/meeting/operations.js +42 -1
  132. package/dist/shortcuts/meeting/qr/encoder.js +427 -0
  133. package/dist/shortcuts/meeting/qr/render.js +103 -0
  134. package/dist/shortcuts/workflow/operations/form.js +17 -5
  135. package/docs/contract.md +39 -4
  136. package/docs/invoice.md +5 -5
  137. package/package.json +3 -2
  138. package/scripts/bundle.mjs +63 -0
  139. package/skill-template/business-info.json +25 -4
  140. package/skill-template/domains/jinchengda.md +16 -3
  141. package/skill-template/domains/yepiaotong.md +1 -1
  142. package/skills/weaver-e10-jinchengda/SKILL.md +111 -31
  143. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -13
  144. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +150 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +87 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +111 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +0 -15
  148. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +0 -13
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +50 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +4 -2
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +74 -0
  152. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +84 -0
  153. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +29 -0
  154. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +28 -0
  155. package/skills/weaver-e10-jinchengda/references/contract-request-status.md +2 -21
  156. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +0 -24
  157. package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +0 -15
  158. package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +0 -17
  159. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +70 -0
  160. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -15
  161. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +0 -15
  162. package/skills/weaver-e10-jinchengda/references/source-manifest.json +1168 -152
  163. package/skills/weaver-e10-meeting/SKILL.md +493 -17
  164. package/skills/weaver-e10-meeting/references/meeting-change.md +4 -4
  165. package/skills/weaver-e10-meeting/references/meeting-create.md +6 -6
  166. package/skills/weaver-e10-meeting/references/meeting-eb.md +503 -27
  167. package/skills/weaver-e10-meeting/references/meeting-invitation.md +113 -0
  168. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +6 -6
  169. package/skills/weaver-e10-meeting/references/meeting-minute-file.md +425 -0
  170. package/skills/weaver-e10-meeting/references/meeting-queries.md +4 -4
  171. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +15 -15
  172. package/skills/weaver-e10-meeting/references/meeting-verification.md +19 -11
  173. package/skills/weaver-e10-meeting.zip +0 -0
  174. package/skills/weaver-e10-yepiaotong/SKILL.md +9 -5
  175. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
  176. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +6 -5
  177. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +14 -11
  178. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +97 -56
  179. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +84 -60
  180. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +142 -105
  181. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +53 -194
  182. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -7
  183. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +164 -72
  184. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +6 -0
  185. package/templates/meeting/invitation.docx +0 -0
@@ -0,0 +1,266 @@
1
+ /**
2
+ * 纪要内容回写与状态查询(配合 ESB 解析链路)。
3
+ *
4
+ * 背景(2026-10-26 与用户确认的链路):
5
+ * ```
6
+ * 上传附件 → 建纪要挂附件 → ESB「解析附件」(1325287772302863627)
7
+ * ├ 文档:同步出原文
8
+ * └ 音视频:后台定时任务写表单(**最小间隔 1 分钟**)
9
+ * → 原文写 minutes_content → 智能体生成纪要 → 写 parse_content
10
+ * → ESB「保存解析并生成文档」(1325287772302863628)
11
+ * ```
12
+ *
13
+ * 本文件负责其中两件事(都不依赖 ESB 细节):
14
+ * 1. `meeting.minute.writeContent` —— 把智能体/调用方产出的文字写回纪要,并**正确推进状态**;
15
+ * 2. `meeting.minute.parseStatus` —— 单次查询解析进展,**不阻塞、不轮询**。
16
+ *
17
+ * ⚠️ 状态口径(真机验证过,别再依赖 minutes_status 判断完成):
18
+ * - 全库 33 条纪要里 28 条 `minutes_status=1(生成中)`,但 `parse_content` 早已有内容 ——
19
+ * 该字段没有任何环节负责推进,**它是"标签"不是"事实"**。
20
+ * - 判断解析是否完成,看 `video_taskResult`(后台任务写)+ 内容是否为空。
21
+ *
22
+ * ⚠️ 音频等待:后台任务最小间隔 1 分钟,所以**不要同步等待**。
23
+ * 触发解析后立刻返回 `pending`,让调用方 1 分钟后再来查(`parseStatus`)。
24
+ */
25
+ import { meetingValidationError } from '../errors.js';
26
+ import { meetingSuccess, SCHEMA_ID } from './types.js';
27
+ /** minutes_status 枚举(接口文档口径)。 */
28
+ const MINUTE_STATUS = {
29
+ parsing: '0',
30
+ generating: '1',
31
+ done: '2',
32
+ extracting: '3',
33
+ extracted: '4',
34
+ };
35
+ const STATUS_LABEL = {
36
+ '0': '解析中',
37
+ '1': '生成中',
38
+ '2': '已完成',
39
+ '3': '文字提取中',
40
+ '4': '文字提取完成',
41
+ };
42
+ const TASK_RESULT_LABEL = {
43
+ '0': '生成中',
44
+ '1': '生成成功',
45
+ '2': '生成失败',
46
+ };
47
+ function textOf(value) {
48
+ return value === undefined || value === null ? '' : String(value);
49
+ }
50
+ /** 读一条纪要(走已实现的 EB detail 操作,不复制接口契约)。 */
51
+ async function readMinute(env, id) {
52
+ const { getMeetingOperation } = await import('./registry.js');
53
+ const detail = getMeetingOperation('meeting.eb.minute.detail');
54
+ const result = await detail.handler({ id }, env);
55
+ const row = result?.data?.data;
56
+ if (!row || typeof row !== 'object') {
57
+ throw meetingValidationError('not_found', `未找到纪要 id=${id},或当前账号无权限查看`, { id });
58
+ }
59
+ return row;
60
+ }
61
+ const meetingMinuteWriteContent = {
62
+ name: 'meeting.minute.writeContent',
63
+ resource: 'minute',
64
+ method: 'writeContent',
65
+ action: 'meeting.minute.writeContent',
66
+ summary: '把解析出的原文 / 生成的纪要写回会议纪要,并按内容自动推进 minutes_status(原文就绪→文档4/音频2;纪要写完→2)',
67
+ capability: 'minute',
68
+ risk: 'high-risk-write',
69
+ inputSchema: {
70
+ type: 'object',
71
+ additionalProperties: false,
72
+ properties: {
73
+ id: { ...SCHEMA_ID, description: '纪要 id(minute.list / create 返回的 id)' },
74
+ mt_id: { ...SCHEMA_ID, description: '所属会议 id(update_mt_minute 服务端必填)' },
75
+ minutes_content: {
76
+ type: 'string',
77
+ description: '原始文字(文档 OCR 提取结果 / 音频转写原文)。传了就写,不传则保持原值',
78
+ },
79
+ parse_content: {
80
+ type: 'string',
81
+ description: '会议纪要文案(富文本 HTML)。写完会把状态置为 2(已完成)',
82
+ },
83
+ file_type: {
84
+ type: 'string',
85
+ enum: ['0', '1'],
86
+ description: '0 文档 / 1 音频。省略时自动读纪要当前值,用于决定原文就绪后状态是 4 还是 2',
87
+ },
88
+ minutes_status: {
89
+ type: 'string',
90
+ enum: ['0', '1', '2', '3', '4'],
91
+ description: '显式指定状态(一般不要传,交给自动规则)。传了以你为准',
92
+ },
93
+ },
94
+ required: ['id', 'mt_id'],
95
+ },
96
+ handler: async (args, env) => {
97
+ const id = textOf(args.id).trim();
98
+ const mtId = textOf(args.mt_id).trim();
99
+ if (!id)
100
+ throw meetingValidationError('id_required', '必须提供纪要 id(id)');
101
+ if (!mtId)
102
+ throw meetingValidationError('mt_id_required', '必须提供会议 id(mt_id)');
103
+ const minutesContent = args.minutes_content === undefined ? undefined : textOf(args.minutes_content);
104
+ const parseContent = args.parse_content === undefined ? undefined : textOf(args.parse_content);
105
+ if (minutesContent === undefined && parseContent === undefined && args.minutes_status === undefined) {
106
+ throw meetingValidationError('nothing_to_update', 'minutes_content / parse_content / minutes_status 至少要给一个,否则这次调用什么都不会改变');
107
+ }
108
+ // file_type 决定"原文就绪"后的状态:文档=4(文字提取完成),音频=2(已完成,用户 2026-10-26 确认)
109
+ let fileType = textOf(args.file_type).trim();
110
+ let current = null;
111
+ if (!fileType) {
112
+ current = await readMinute(env, id);
113
+ fileType = textOf(current.file_type).trim();
114
+ }
115
+ const patch = {};
116
+ if (minutesContent !== undefined)
117
+ patch.minutes_content = minutesContent;
118
+ if (parseContent !== undefined)
119
+ patch.parse_content = parseContent;
120
+ let statusReason;
121
+ if (args.minutes_status !== undefined) {
122
+ patch.minutes_status = textOf(args.minutes_status);
123
+ statusReason = `调用方显式指定为 ${patch.minutes_status}(${STATUS_LABEL[patch.minutes_status] ?? '未知'})`;
124
+ }
125
+ else if (parseContent !== undefined && parseContent.trim() !== '') {
126
+ // ⚠️ 2026-10-26 真机:生成纪要文案后状态是 **1(生成中)**,不是 2。
127
+ // 2 由「保存解析并生成文档」那个 ESB 在生成完文档后自己写(实测 status 1 → 2、mt_minutes 拿到 wdID)。
128
+ patch.minutes_status = MINUTE_STATUS.generating;
129
+ statusReason = '纪要文案已写入 ⇒ 1(生成中),等待 ESB 生成文档后由服务端置 2';
130
+ }
131
+ else if (minutesContent !== undefined && minutesContent.trim() !== '') {
132
+ // ⚠️ 2026-10-26 真机更正:**文档和音频**在"原文就绪"阶段,服务端自己写的都是
133
+ // `4(文字提取完成)`,不是 2。音频那条实测:status 3(文字提取中)→ 4,
134
+ // 同时 video_taskResult 0 → 1、minutes_content 3986 字。
135
+ // 所以这里统一写 4,等纪要文案生成后再置 2 —— 与平台口径保持一致,
136
+ // 避免同一条链路上出现"服务端写 4、CLI 写 2"的自相矛盾。
137
+ patch.minutes_status = MINUTE_STATUS.extracted;
138
+ statusReason = '原文就绪 ⇒ 4(文字提取完成),与平台口径一致;待生成纪要后置 1、生成文档后置 2';
139
+ }
140
+ else {
141
+ statusReason = '仅清空内容,未改状态';
142
+ }
143
+ const { getMeetingOperation } = await import('./registry.js');
144
+ const prepare = getMeetingOperation('meeting.eb.minute.update.prepare');
145
+ const apply = getMeetingOperation('meeting.eb.minute.update.apply');
146
+ const prepared = await prepare.handler({ id, mt_id: mtId, ...patch }, env);
147
+ const applied = await apply.handler({ confirm: true, continuation: prepared?.data?.continuation }, env);
148
+ const after = await readMinute(env, id);
149
+ const warnings = [];
150
+ if (textOf(after.minutes_content) !== textOf(patch.minutes_content ?? after.minutes_content)) {
151
+ warnings.push('minutes_content 回读与写入值不一致,建议人工核对(服务端可能做了富文本处理)');
152
+ }
153
+ return meetingSuccess('meeting.minute.writeContent', {
154
+ id,
155
+ mtId,
156
+ written: Object.keys(patch),
157
+ statusReason,
158
+ // 回读结果(以服务端为准,不信本地假设)
159
+ minutesStatus: textOf(after.minutes_status),
160
+ minutesStatusLabel: STATUS_LABEL[textOf(after.minutes_status)] ?? '',
161
+ minutesContentLength: textOf(after.minutes_content).length,
162
+ parseContentLength: textOf(after.parse_content).length,
163
+ videoTaskId: textOf(after.video_taskId),
164
+ videoTaskResult: textOf(after.video_taskResult),
165
+ applyResult: applied?.data ?? null,
166
+ }, warnings.length > 0 ? { warnings } : undefined);
167
+ },
168
+ };
169
+ const meetingMinuteParseStatus = {
170
+ name: 'meeting.minute.parseStatus',
171
+ resource: 'minute',
172
+ method: 'parseStatus',
173
+ action: 'meeting.minute.parseStatus',
174
+ summary: '单次查询纪要解析进展(不阻塞、不轮询):返回 pending / extracted / completed / failed / idle,并给出下次复查建议',
175
+ capability: 'minute',
176
+ risk: 'read',
177
+ inputSchema: {
178
+ type: 'object',
179
+ additionalProperties: false,
180
+ properties: {
181
+ id: { ...SCHEMA_ID, description: '纪要 id' },
182
+ },
183
+ required: ['id'],
184
+ },
185
+ handler: async (args, env) => {
186
+ const id = textOf(args.id).trim();
187
+ if (!id)
188
+ throw meetingValidationError('id_required', '必须提供纪要 id(id)');
189
+ const row = await readMinute(env, id);
190
+ const minutesContent = textOf(row.minutes_content).trim();
191
+ const parseContent = textOf(row.parse_content).trim();
192
+ const taskResult = textOf(row.video_taskResult).trim();
193
+ const taskId = textOf(row.video_taskId).trim();
194
+ const status = textOf(row.minutes_status).trim();
195
+ const fileType = textOf(row.file_type).trim();
196
+ /** 生成的纪要文档 id(ESB「保存解析并生成文档」回写的 `mt_minutes` 字段)。 */
197
+ const documentId = textOf(row.mt_minutes).trim();
198
+ /**
199
+ * 状态判定顺序(2026-10-26 全链路真机验证后定稿):
200
+ * 文档已生成 > 失败 > 纪要文案就绪(待生成文档) > 原文就绪(待生成纪要) > 后台在跑 > 未触发
201
+ */
202
+ let state;
203
+ let hint;
204
+ /** 下一步该干什么(让 Agent 不用自己推理,直接照做)。 */
205
+ let nextAction;
206
+ if (documentId !== '' && status === MINUTE_STATUS.done) {
207
+ state = 'done';
208
+ nextAction = 'none';
209
+ hint = `整条链已完成:纪要文档已生成并回写 OA(mt_minutes=${documentId})`;
210
+ }
211
+ else if (taskResult === '2') {
212
+ state = 'failed';
213
+ nextAction = 'manual_check';
214
+ hint = '后台解析失败:请到会议详情页看失败原因;不要把状态改成已完成';
215
+ }
216
+ else if (parseContent !== '') {
217
+ state = 'minutes_ready';
218
+ nextAction = 'generate_document';
219
+ hint =
220
+ `纪要文案已就绪(当前状态 ${status || '空'}${STATUS_LABEL[status] ? ` ${STATUS_LABEL[status]}` : ''})。`
221
+ + '**直接调用 ESB「保存解析并生成文档」**(流程 id 从本租户配置取,见 `meeting.minute.fromGroupChat` 的 `flowGenerateDocument`),'
222
+ + '传 `parse_content` + `mt_minute_id`;该动作流会生成文档、回写 `mt_minutes` 并把状态置 2。**不用再问用户**';
223
+ }
224
+ else if (minutesContent !== '') {
225
+ state = 'extracted';
226
+ nextAction = 'generate_minutes';
227
+ hint =
228
+ '原文已就绪(状态 4 文字提取完成)。调用 ESB「根据智能体解析文本生成智能纪要文本」(流程 id 见 `flowGenerateMinutes`),'
229
+ + '只需传 `minuteId`,它会把纪要文案写进 `parse_content` 并把状态置 1';
230
+ }
231
+ else if (taskResult === '0' || status === MINUTE_STATUS.parsing || status === MINUTE_STATUS.extracting) {
232
+ state = 'pending';
233
+ nextAction = 'wait_then_check';
234
+ hint = '后台定时任务最小间隔 60 秒,建议 60 秒后再查一次;不要连续轮询';
235
+ }
236
+ else {
237
+ state = 'idle';
238
+ nextAction = 'trigger_parse';
239
+ hint = '尚未触发解析:确认已挂附件后再调用 ESB「解析附件」';
240
+ }
241
+ return meetingSuccess('meeting.minute.parseStatus', {
242
+ id,
243
+ state,
244
+ hint,
245
+ nextAction,
246
+ fileType,
247
+ minutesStatus: status,
248
+ minutesStatusLabel: STATUS_LABEL[status] ?? '',
249
+ videoTaskId: taskId,
250
+ videoTaskResult: taskResult,
251
+ videoTaskResultLabel: TASK_RESULT_LABEL[taskResult] ?? '',
252
+ minutesContentLength: minutesContent.length,
253
+ parseContentLength: parseContent.length,
254
+ /** 生成的纪要文档 id(空 = 还没生成文档)。 */
255
+ documentId,
256
+ // 判断"完成"永远用这几个布尔,不要用 minutes_status
257
+ contentReady: minutesContent !== '',
258
+ minutesReady: parseContent !== '',
259
+ documentReady: documentId !== '',
260
+ });
261
+ },
262
+ };
263
+ export const meetingMinuteContentOperations = [
264
+ meetingMinuteWriteContent,
265
+ meetingMinuteParseStatus,
266
+ ];