weaver-work-cli 0.1.49 → 0.1.50

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 (103) hide show
  1. package/dist/chunks/{attachment-content-MU2LPI5P.js → attachment-content-EJYIOJPH.js} +3 -3
  2. package/dist/chunks/{chunk-6GWU63YF.js → chunk-3NCFFHB2.js} +1 -1
  3. package/dist/chunks/{chunk-NBEWUR7L.js → chunk-6T53BSWZ.js} +158 -44
  4. package/dist/chunks/{chunk-EJVA5ZVB.js → chunk-7AYQJSFY.js} +2 -2
  5. package/dist/chunks/{chunk-D2QRZUW4.js → chunk-7ECB22G3.js} +35 -28
  6. package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
  7. package/dist/chunks/{chunk-3NV2ETZR.js → chunk-BFKLQLBK.js} +8 -8
  8. package/dist/chunks/{chunk-BRRW7CWA.js → chunk-HARQF5IP.js} +26 -26
  9. package/dist/chunks/{chunk-K3BT54CU.js → chunk-K67FODVC.js} +1 -1
  10. package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
  11. package/dist/chunks/{chunk-GEOMANP7.js → chunk-MCZG6HPM.js} +2 -2
  12. package/dist/chunks/{chunk-ZKEUGS2U.js → chunk-RYFRGTUV.js} +4 -4
  13. package/dist/chunks/{chunk-3X7VOSBA.js → chunk-WNJUGI2F.js} +1 -1
  14. package/dist/chunks/{chunk-KV5SOWMS.js → chunk-YB3AJYPY.js} +4 -4
  15. package/dist/chunks/{conflict-6347A7YK.js → conflict-C4UDHCWV.js} +2 -2
  16. package/dist/chunks/{contract-N6P2HIIE.js → contract-VUC6JOPG.js} +464 -9
  17. package/dist/chunks/{create-flow-7WG7LVX5.js → create-flow-6OG2LYBD.js} +6 -6
  18. package/dist/chunks/{env-LHRKSLG6.js → env-WP57TF2S.js} +2 -2
  19. package/dist/chunks/{factory-2H7Z4RWJ.js → factory-VUXI7N5C.js} +1 -1
  20. package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
  21. package/dist/chunks/{group-chat-EW6PNDDT.js → group-chat-UQRGXILK.js} +3 -3
  22. package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
  23. package/dist/chunks/{invoice-FXWH5GPO.js → invoice-E7GOITEU.js} +1 -1
  24. package/dist/chunks/{meeting-N2FQBHXI.js → meeting-4BBLVAWM.js} +10 -10
  25. package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
  26. package/dist/chunks/{reception-MYOKJULO.js → reception-QGPNTGHG.js} +98 -82
  27. package/dist/chunks/{registry-CKUVBS53.js → registry-5CRCN2TV.js} +10 -10
  28. package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
  29. package/dist/chunks/{registry-7VZ6YJUF.js → registry-V4CHRQDI.js} +1 -1
  30. package/dist/chunks/{room-recommend-MBCYENQ2.js → room-recommend-AYR3UG7R.js} +4 -4
  31. package/dist/chunks/{schedule-5IFMCXME.js → schedule-JZEFIXUS.js} +4 -4
  32. package/dist/chunks/{workflow-2TRU2ZSP.js → workflow-3ZAF2J5E.js} +1 -1
  33. package/dist/index.js +7 -7
  34. package/dist/shortcuts/contract/host.js +11 -0
  35. package/dist/shortcuts/contract/index.js +13 -0
  36. package/dist/shortcuts/contract/manifest.js +53 -0
  37. package/dist/shortcuts/contract/operations/performance.js +58 -7
  38. package/dist/shortcuts/contract/operations/quote.js +283 -1
  39. package/dist/shortcuts/contract/operations/registry.js +2 -0
  40. package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
  41. package/dist/shortcuts/fna/host.js +4 -2
  42. package/dist/shortcuts/fna/manifest.js +14 -5
  43. package/dist/shortcuts/fna/operations/audit.js +334 -0
  44. package/dist/shortcuts/fna/operations/registry.js +2 -0
  45. package/dist/shortcuts/im/operations/at-mention.js +6 -3
  46. package/dist/shortcuts/im/operations/msg-parse.js +35 -5
  47. package/dist/shortcuts/im/operations/msg-sync.js +3 -1
  48. package/dist/shortcuts/im/operations/msg-write.js +57 -9
  49. package/dist/shortcuts/invoice/manifest.js +1 -1
  50. package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
  51. package/dist/shortcuts/reception/constants.js +3 -7
  52. package/dist/shortcuts/reception/operations/leads.js +30 -6
  53. package/dist/shortcuts/reception/operations/panels.js +3 -2
  54. package/dist/shortcuts/workflow/operations/read.js +58 -14
  55. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
  56. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
  57. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
  58. package/docs/SKILL.md +1 -1
  59. package/docs/_catalog.md +1 -1
  60. package/docs/fna.md +11 -4
  61. package/package.json +1 -1
  62. package/skill-template/business-info.json +6 -1
  63. package/skill-template/domains/qiyecheng.md +4 -2
  64. package/skills/weaver-e10-jinchengda/SKILL.md +1 -1
  65. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -5
  66. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +1 -1
  67. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
  68. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  69. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +219 -0
  70. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +50 -30
  71. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +24 -15
  72. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  73. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
  74. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +43 -0
  75. package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
  76. package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +265 -0
  77. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +83 -0
  78. package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
  79. package/skills/weaver-e10-qiyecheng/SKILL.md +21 -7
  80. package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +104 -0
  81. package/skills/weaver-e10-qiyecheng/references/catalog.md +17 -3
  82. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +136 -30
  83. package/skills/weaver-e10-reception-flow/SKILL.md +43 -6
  84. package/skills/weaver-e10-reception-flow/references/guide.md +1 -1
  85. package/skills/weaver-e10-recruit-stage/SKILL.md +1 -1
  86. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +3 -3
  87. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +6 -4
  88. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +3 -3
  89. package/skills/weaver-e10-workflow/SKILL.md +2 -1
  90. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
  91. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
  92. package/skills/weaver-e10-yepiaotong/SKILL.md +10 -5
  93. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
  94. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +6 -45
  95. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +5 -5
  96. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +4 -37
  97. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +2 -2
  98. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
  99. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +22 -35
  100. package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
  101. package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
  102. package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
  103. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
@@ -0,0 +1,334 @@
1
+ import { CONTINUATION_TTL_SECONDS } from '../../../core/continuation-ttl.js';
2
+ import { FnaCliError, fnaPartialError, fnaValidationError, isFnaNetworkError } from '../errors.js';
3
+ import { fnaSuccess, schemaOf, SCHEMA_ID, SCHEMA_STRING_NONEMPTY, WRITE } from './types.js';
4
+ import { compact, fingerprint, requireConfirm, unwrapData, verifyLease } from './shared.js';
5
+ /**
6
+ * aiCheckAudit 内部按 180s 轮询,single 模式逐条并发后整体更久,官方建议调用方 HTTP 超时 ≥ 10 分钟。
7
+ * 超时后不得自动重试:本次可能已生成预审记录并消耗模型额度。
8
+ */
9
+ const AUDIT_TIMEOUT_MS = 600_000;
10
+ const CHECK_MODES = ['batch', 'single'];
11
+ const DIMENSIONS = ['user', 'node'];
12
+ /** 未显式传 dimension 时按节点维度:不记个人,动作流 RPC 走这条。 */
13
+ const DEFAULT_DIMENSION = 'node';
14
+ const AUDIT_PATH = '/api/ai/application/rule/check/aiCheckAudit';
15
+ /** 数字转 long 字符串:服务端统一按 long 解析,字符串可避免 > 2^53 精度丢失。 */
16
+ function toIdString(value, field, options = {}) {
17
+ if (value === undefined || value === null || value === '') {
18
+ throw fnaValidationError('id_required', `${field} 必填`);
19
+ }
20
+ if (typeof value === 'number' && !Number.isFinite(value)) {
21
+ throw fnaValidationError('id_invalid', `${field} 必须是整数或数字字符串`);
22
+ }
23
+ const text = String(value).trim();
24
+ if (!/^\d+$/.test(text)) {
25
+ throw fnaValidationError('id_invalid', `${field} 必须是整数或数字字符串:${text}`);
26
+ }
27
+ if (!options.allowZero && text === '0') {
28
+ // 服务端不做必填校验,传 0 会静默返回空数据,必须在 CLI 侧拦掉。
29
+ throw fnaValidationError('id_invalid', `${field} 不能为 0(服务端会把 0 当空数据处理)`);
30
+ }
31
+ return text;
32
+ }
33
+ function optionalId(value, field, options = {}) {
34
+ if (value === undefined || value === null || value === '')
35
+ return undefined;
36
+ return toIdString(value, field, options);
37
+ }
38
+ function optionalEnum(value, allowed, field, subtype = `${field}_invalid`) {
39
+ if (value === undefined || value === null || value === '')
40
+ return undefined;
41
+ const text = String(value);
42
+ if (!allowed.includes(text)) {
43
+ throw fnaValidationError(subtype, `${field} 只能是 ${allowed.join(' / ')}:${text}`);
44
+ }
45
+ return text;
46
+ }
47
+ function requireRuleList(value) {
48
+ if (value === undefined || value === null || value === '')
49
+ return undefined;
50
+ if (typeof value !== 'string') {
51
+ throw fnaValidationError('rule_list_invalid', 'ruleList 必须是字符串:JSON 字符串数组(["规则1","规则2"])或 ## 分隔文本;数组请先序列化成字符串');
52
+ }
53
+ const text = value.trim();
54
+ if (!text)
55
+ return undefined;
56
+ if (text.startsWith('[')) {
57
+ try {
58
+ const parsed = JSON.parse(text);
59
+ if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== 'string')) {
60
+ throw new Error('not a string array');
61
+ }
62
+ }
63
+ catch {
64
+ throw fnaValidationError('rule_list_invalid', 'ruleList 以 [ 开头但不是合法的 JSON 字符串数组');
65
+ }
66
+ }
67
+ return text;
68
+ }
69
+ /** 组装 aiCheckAudit 请求体:ID 统一字符串,未提供的可选值不落 body。 */
70
+ function buildAuditBody(args) {
71
+ return compact({
72
+ workflowId: toIdString(args.workflowId, 'workflowId'),
73
+ requestId: toIdString(args.requestId, 'requestId'),
74
+ nodeId: toIdString(args.nodeId, 'nodeId'),
75
+ dimension: optionalEnum(args.dimension, DIMENSIONS, 'dimension') ?? DEFAULT_DIMENSION,
76
+ refId: optionalId(args.refId, 'refId'),
77
+ settingId: optionalId(args.settingId, 'settingId', { allowZero: true }),
78
+ ruleList: requireRuleList(args.ruleList),
79
+ pageType: args.pageType === undefined || args.pageType === '' ? undefined : String(args.pageType),
80
+ checkMode: optionalEnum(args.checkMode, CHECK_MODES, 'checkMode', 'check_mode_invalid'),
81
+ recordId: optionalId(args.recordId, 'recordId', { allowZero: true }),
82
+ userId: optionalId(args.userId, 'userId'),
83
+ });
84
+ }
85
+ const RISK_NAMES = { 0: '低风险', 1: '中风险', 2: '高风险' };
86
+ function asText(value) {
87
+ if (value === undefined || value === null)
88
+ return null;
89
+ const text = String(value);
90
+ return text === '' ? null : text;
91
+ }
92
+ function asCount(value) {
93
+ const numeric = Number(value);
94
+ return Number.isFinite(numeric) ? numeric : null;
95
+ }
96
+ function normalizeRuleResults(payload) {
97
+ const raw = Array.isArray(payload?.results) ? payload.results : [];
98
+ return raw.map((item) => {
99
+ const riskType = asCount(item?.riskType);
100
+ return {
101
+ id: asText(item?.id),
102
+ rule: asText(item?.rule),
103
+ result: asText(item?.result),
104
+ passed: typeof item?.passed === 'boolean' ? item.passed : null,
105
+ riskType,
106
+ riskName: asText(item?.riskName) ?? (riskType !== null ? RISK_NAMES[riskType] ?? null : null),
107
+ generated: typeof item?.generated === 'boolean' ? item.generated : null,
108
+ fieldId: asText(item?.fieldId),
109
+ auditResult: asText(item?.auditResult),
110
+ auditReason: asText(item?.auditReason),
111
+ };
112
+ });
113
+ }
114
+ /**
115
+ * 归一化 aiCheckAudit 的 data。三种形态:
116
+ * - catResult 为 null:无数据源/无表单/无规则,属业务成功但没内容,按 empty 返回原因;
117
+ * - chatMessage.content 是 JSON 字符串,必须二次解析才能拿到 results;
118
+ * - content 解析失败时保留 recordId 与文本预览,标记 unparsed(接口已执行、记录可能已写入,不能当失败处理)。
119
+ * formDataList 体积可能很大,只取 id/refId/title。
120
+ */
121
+ function normalizeAuditResult(data) {
122
+ const catResult = data?.catResult;
123
+ const recordId = asText(data?.recordId);
124
+ const firstForm = Array.isArray(data?.formDataList) ? data.formDataList[0] : undefined;
125
+ const form = firstForm
126
+ ? { id: asText(firstForm.id), refId: asText(firstForm.refId), title: asText(firstForm.title) }
127
+ : null;
128
+ if (!catResult || typeof catResult !== 'object') {
129
+ return {
130
+ status: 'empty',
131
+ recordId,
132
+ formData: form,
133
+ emptyReason: asText(data?.msg),
134
+ conclusion: 'none',
135
+ totalRules: 0,
136
+ passedCount: 0,
137
+ failedCount: 0,
138
+ results: [],
139
+ suggestions: null,
140
+ };
141
+ }
142
+ const ruleRecordId = asText(catResult.otherParam?.ruleRecordId) ?? recordId;
143
+ const content = catResult.chatMessage?.content;
144
+ if (typeof content !== 'string' || !content.trim()) {
145
+ return {
146
+ status: 'unparsed',
147
+ recordId: ruleRecordId,
148
+ formData: form,
149
+ emptyReason: null,
150
+ conclusion: 'none',
151
+ totalRules: 0,
152
+ passedCount: 0,
153
+ failedCount: 0,
154
+ results: [],
155
+ suggestions: null,
156
+ contentPreview: typeof content === 'string' ? content.slice(0, 500) : null,
157
+ };
158
+ }
159
+ let payload;
160
+ try {
161
+ payload = JSON.parse(content);
162
+ }
163
+ catch {
164
+ return {
165
+ status: 'unparsed',
166
+ recordId: ruleRecordId,
167
+ formData: form,
168
+ emptyReason: null,
169
+ conclusion: 'none',
170
+ totalRules: 0,
171
+ passedCount: 0,
172
+ failedCount: 0,
173
+ results: [],
174
+ suggestions: null,
175
+ contentPreview: content.slice(0, 500),
176
+ };
177
+ }
178
+ const results = normalizeRuleResults(payload);
179
+ const rawFailed = asCount(payload?.failedCount);
180
+ const failedCount = rawFailed ?? results.filter((item) => item.passed === false).length;
181
+ const rawPassed = asCount(payload?.passedCount);
182
+ const passedCount = rawPassed ?? results.filter((item) => item.passed === true).length;
183
+ return {
184
+ status: 'checked',
185
+ recordId: ruleRecordId,
186
+ formData: form,
187
+ emptyReason: null,
188
+ title: asText(payload?.title) ?? form?.title ?? null,
189
+ conclusion: failedCount > 0 ? 'failed' : 'passed',
190
+ totalRules: asCount(payload?.totalRules) ?? results.length,
191
+ passedCount,
192
+ failedCount,
193
+ results,
194
+ suggestions: payload?.suggestions ?? null,
195
+ };
196
+ }
197
+ /** 人员为空是服务端明确失败,单独成 subtype,避免和 AI 场景异常混在一起。 */
198
+ function mapAuditApiError(error) {
199
+ if (error instanceof FnaCliError && error.type === 'api' && error.subtype === 'business_error') {
200
+ const message = error.message || '';
201
+ if (message.includes('未获取当前人员信息') || message.includes('人员')) {
202
+ throw new FnaCliError('api', 'person_unavailable', message || '未获取当前人员信息', {
203
+ code: error.code,
204
+ retryable: false,
205
+ details: error.details,
206
+ exitCode: 1,
207
+ });
208
+ }
209
+ }
210
+ throw error;
211
+ }
212
+ async function requestAudit(env, body) {
213
+ let response;
214
+ try {
215
+ response = await env.host.request({
216
+ method: 'POST',
217
+ path: AUDIT_PATH,
218
+ body,
219
+ timeoutMs: AUDIT_TIMEOUT_MS,
220
+ });
221
+ }
222
+ catch (error) {
223
+ if (isFnaNetworkError(error)) {
224
+ throw fnaPartialError('预审请求发送后连接中断/超时,本次是否已生成预审记录不确定,禁止自动重试;请按 requestId + nodeId 回查预审记录后再决定是否重跑', { attempted: { requestId: body.requestId, nodeId: body.nodeId, recordId: body.recordId ?? null } }, { stage: 'aiCheckAudit' });
225
+ }
226
+ throw mapAuditApiError(error);
227
+ }
228
+ return normalizeAuditResult(unwrapData(response));
229
+ }
230
+ /**
231
+ * AI 规则预审(准备):本地校验 ID/枚举/规则文本,生成确认预览与 continuation。
232
+ * 不发请求、不消耗模型额度、不写预审记录。
233
+ */
234
+ const fnaAuditCheckPrepare = {
235
+ name: 'fna.audit.check.prepare',
236
+ resource: 'audit',
237
+ method: 'audit.check.prepare',
238
+ action: 'fna.audit.check.prepare',
239
+ summary: 'AI 规则预审(准备):校验 workflowId/requestId/nodeId 等入参并生成确认预览与 continuation,不发送请求、不消耗模型额度',
240
+ capability: 'audit',
241
+ risk: WRITE,
242
+ requiresConfirmation: true,
243
+ inputSchema: schemaOf({
244
+ workflowId: { ...SCHEMA_ID, description: '流程 ID(必填,>0);与 requestId、nodeId 拼成数据源 ids' },
245
+ requestId: { ...SCHEMA_ID, description: '流程实例 ID,即预审单据 ID(必填,>0)' },
246
+ nodeId: { ...SCHEMA_ID, description: '流程节点 ID(必填,>0);取当前待办节点的 nodeId' },
247
+ dimension: { type: 'string', enum: [...DIMENSIONS], default: DEFAULT_DIMENSION, description: '预审记录维度:node(按节点,不记个人,动作流 RPC 用这个,默认)/ user(按人)' },
248
+ refId: { ...SCHEMA_ID, description: '规则配置关联 ID,默认取 workflowId;EB 流程传表单 ID' },
249
+ settingId: { ...SCHEMA_ID, description: '规则设置 ID;>0 时直接取该规则设置,0 等同不传' },
250
+ ruleList: { type: 'string', description: '追加规则:JSON 字符串数组或 ## 分隔文本(数组需先序列化成字符串)' },
251
+ pageType: { type: 'string', description: '页面类型,默认 flowPage,透传给规则查询' },
252
+ checkMode: { type: 'string', enum: [...CHECK_MODES], description: '检验模式:batch(一次 AI 审核)/ single(逐条审核后合并);传了会覆盖流程配置' },
253
+ recordId: { ...SCHEMA_ID, description: '已有预审记录 ID;传了则本次结果追加到该记录(0 等同不传)' },
254
+ userId: { ...SCHEMA_ID, description: '执行人 ID(>0);不传用当前登录人,传了人员不存在会直接失败,不回退' },
255
+ }, {
256
+ required: ['workflowId', 'requestId', 'nodeId'],
257
+ description: 'AI 规则预审(准备):只做输入归一化与确认,不触网',
258
+ }),
259
+ handler: async (args, env) => {
260
+ const body = buildAuditBody(args);
261
+ const session = await env.host.getSession();
262
+ const token = await env.continuation.issue({
263
+ operation: 'fna.audit.check.apply',
264
+ baseUrl: session.baseUrl,
265
+ profile: session.profile,
266
+ userId: session.userId,
267
+ body,
268
+ fingerprint: fingerprint(body),
269
+ }, CONTINUATION_TTL_SECONDS * 1000);
270
+ return fnaSuccess('fna.audit.check.prepare', {
271
+ status: 'AWAITING_CONFIRMATION',
272
+ preview: {
273
+ ...body,
274
+ action: '按流程配置的 AI 规则对该单据做预审',
275
+ cost: '会消耗一次或多次大模型调用(single 模式逐条审核),通常数十秒到数分钟',
276
+ sideEffect: '会写入/更新预审记录 ai_check_audit_record;传 recordId 时追加到该记录',
277
+ appendToRecord: body.recordId ?? null,
278
+ hint: '向用户展示单据(requestId)、节点、检验模式与副作用后再确认;确认后调用 fna.audit.check.apply',
279
+ },
280
+ continuation: token,
281
+ expiresInSeconds: CONTINUATION_TTL_SECONDS,
282
+ });
283
+ },
284
+ };
285
+ /**
286
+ * AI 规则预审(执行):需 confirm=true 与 prepare 返回的 continuation,请求体指纹须与 prepare 一致。
287
+ * 逐条规则结果以 data.results 返回;接口已写入预审记录,超时/断网按「结果不确定」处理,禁止自动重试。
288
+ */
289
+ const fnaAuditCheckApply = {
290
+ name: 'fna.audit.check.apply',
291
+ resource: 'audit',
292
+ method: 'audit.check.apply',
293
+ action: 'fna.audit.check.apply',
294
+ summary: 'AI 规则预审(执行):需 confirm=true 与 prepare 的 continuation,返回逐条规则的 passed/riskName 与汇总计数;会写预审记录并消耗大模型',
295
+ capability: 'audit',
296
+ risk: WRITE,
297
+ requiresConfirmation: true,
298
+ inputSchema: schemaOf({
299
+ workflowId: { ...SCHEMA_ID, description: '流程 ID(必填,>0);与 prepare 时一致' },
300
+ requestId: { ...SCHEMA_ID, description: '流程实例 ID(必填,>0);与 prepare 时一致' },
301
+ nodeId: { ...SCHEMA_ID, description: '流程节点 ID(必填,>0);与 prepare 时一致' },
302
+ dimension: { type: 'string', enum: [...DIMENSIONS], default: DEFAULT_DIMENSION, description: '预审记录维度:node(默认)/ user;不传按 prepare 默认值 node' },
303
+ refId: { ...SCHEMA_ID, description: '规则配置关联 ID,默认取 workflowId' },
304
+ settingId: { ...SCHEMA_ID, description: '规则设置 ID;>0 时直接取该规则设置' },
305
+ ruleList: { type: 'string', description: '追加规则:JSON 字符串数组或 ## 分隔文本' },
306
+ pageType: { type: 'string', description: '页面类型,默认 flowPage' },
307
+ checkMode: { type: 'string', enum: [...CHECK_MODES], description: '检验模式:batch / single' },
308
+ recordId: { ...SCHEMA_ID, description: '已有预审记录 ID;传了则追加到该记录' },
309
+ userId: { ...SCHEMA_ID, description: '执行人 ID(>0);不传用当前登录人' },
310
+ confirm: { const: true },
311
+ continuation: { ...SCHEMA_STRING_NONEMPTY, description: 'prepare 返回的 continuation' },
312
+ }, {
313
+ required: ['workflowId', 'requestId', 'nodeId', 'confirm', 'continuation'],
314
+ description: 'AI 规则预审(执行):写入预审记录并消耗大模型',
315
+ }),
316
+ handler: async (args, env) => {
317
+ requireConfirm(args, 'fna.audit.check.apply');
318
+ const body = buildAuditBody(args);
319
+ const lease = await verifyLease(args, 'fna.audit.check.apply', env);
320
+ if (fingerprint(body) !== lease.fingerprint) {
321
+ throw fnaValidationError('target_changed', '预审目标与 prepare 时的快照不一致,请重新执行 prepare');
322
+ }
323
+ const data = await requestAudit(env, body);
324
+ return fnaSuccess('fna.audit.check.apply', data, {
325
+ checkMode: body.checkMode ?? 'flow-config',
326
+ dimension: body.dimension ?? DEFAULT_DIMENSION,
327
+ timeoutMs: AUDIT_TIMEOUT_MS,
328
+ });
329
+ },
330
+ };
331
+ export const auditOperations = [
332
+ fnaAuditCheckPrepare,
333
+ fnaAuditCheckApply,
334
+ ];
@@ -1,5 +1,6 @@
1
1
  import { fnaValidationError } from '../errors.js';
2
2
  import { budgetOperations } from './budget.js';
3
+ import { auditOperations } from './audit.js';
3
4
  import { expenseCenterOperations } from './expense-center.js';
4
5
  import { expenseChartOperations } from './expense-chart.js';
5
6
  import { loanOperations } from './loan.js';
@@ -8,6 +9,7 @@ function buildRegistry() {
8
9
  const registry = new Map();
9
10
  const definitions = [
10
11
  ...budgetOperations,
12
+ ...auditOperations,
11
13
  ...expenseCenterOperations,
12
14
  ...expenseChartOperations,
13
15
  ...loanOperations,
@@ -8,6 +8,7 @@ import { extractGroupMembers, isSystemMember, str, unwrapInner } from './shared.
8
8
  * `txt` 字段传 JSON 字符串会被服务端原样塞进 `dt[0].txt.v`,客户端直接显示 JSON 原文(踩坑确认)。
9
9
  * - 原生结构:`{ bgc:'', cnt:'0', dev:5, display:'', dt:[{txt:{aus, ft:'china', next:'0', v}}],
10
10
  * guid:'0', idx:'0', opb:['received','reply'], scid, sname, suid, sysId:'', type:'1', ver:'1.0', weaOaId:'' }`
11
+ * (markdown 消息外层 type 为 '26'——客户端仅对 type=26 按 markdown 解析——且 txt 段带 vt:'1')
11
12
  * - `txt.aus` 条目:@具体人 `{ cid:<人cid>, fd:'@', id:<人uid>, nm:<姓名>, t:'1' }`;
12
13
  * @所有人固定 `{ cid:'10000', fd:'@', id:'88', nm:'全体成员', t:'2' }`。
13
14
  * - `txt.v` 中每个 @ 位置写占位符 `:@<id>;`(冒号+@+id+分号),其余文本原样保留;
@@ -104,14 +105,16 @@ export function buildAtText(text, entries) {
104
105
  const aus = [...used, ...rest];
105
106
  return { v, aus };
106
107
  }
107
- /** 组装 sendGroupMsg 的 `msg` 字段值(完整原生 msg JSON 字符串)。 */
108
- export function buildAtMsgJson(v, aus, self, extra = {}) {
108
+ /** 组装 sendGroupMsg/sendSingleMsg 的 `msg` 字段值(完整原生 msg JSON 字符串)。 */
109
+ export function buildAtMsgJson(v, aus, self, extra = {},
110
+ /** txt 段附加字段(与 v 同级),如 markdown 的 `{ vt: '1' }`。 */
111
+ txtExtra = {}) {
109
112
  return JSON.stringify({
110
113
  bgc: '',
111
114
  cnt: '0',
112
115
  dev: 5,
113
116
  display: '',
114
- dt: [{ txt: { aus, ft: 'china', next: '0', v } }],
117
+ dt: [{ txt: { aus, ft: 'china', next: '0', v, ...txtExtra } }],
115
118
  guid: '0',
116
119
  idx: '0',
117
120
  opb: ['received', 'reply'],
@@ -6,6 +6,15 @@
6
6
  * - 媒体段提取(供预览/下载按钮 URL 构造)
7
7
  * - 发送者姓名回退规则
8
8
  */
9
+ /**
10
+ * 消息体最外层 type 官方枚举(2026-11-11 上游确认):
11
+ * 1 文本 / 2 图片 / 3 语音 / 4 文件 / 5 地理位置 / 6 图文 / 7 视频 / 8 事项 / 9 系统 /
12
+ * 10 撤回 / 11 抖一抖 / 12 屏蔽 / 14 居中(灰色字体)/ 15 第三方(im 不解析)/ 16 语音通话 /
13
+ * 17 合并转发 / 18 视频通话 / 19 群公告通知 / 20 分享地址(消息体 t:0 群分享,1 人员卡片即名片)/
14
+ * 21 表情 / 22 强提醒 / 23 链接 / 24 群接龙 / 25 +1回复 / 26 富文本。
15
+ * 特别说明:26 富文本 = 一个消息里可包含多种类型数据段(纯文本/图片/文件等混合),
16
+ * **不等于 markdown 消息**——只有 26 且 txt 段带 vt=1 时,该 txt 段的 v 才是 markdown 原文。
17
+ */
9
18
  export const MSG_TYPES = {
10
19
  1: '文本',
11
20
  2: '图片',
@@ -15,14 +24,14 @@ export const MSG_TYPES = {
15
24
  6: '图文',
16
25
  7: '视频',
17
26
  8: '事项',
18
- 9: '系统消息',
27
+ 9: '系统',
19
28
  10: '撤回',
20
29
  11: '抖一抖',
21
30
  12: '屏蔽',
22
- 14: '通知',
23
- 15: '自定义',
31
+ 14: '居中',
32
+ 15: '第三方',
24
33
  16: '语音通话',
25
- 17: '聊天记录',
34
+ 17: '合并转发',
26
35
  18: '视频通话',
27
36
  19: '群公告',
28
37
  20: '分享地址',
@@ -175,6 +184,26 @@ export function parseSysMsg(msg) {
175
184
  id18n: sys.id18n !== undefined ? String(sys.id18n) : undefined,
176
185
  };
177
186
  }
187
+ /** 判断 txt 段是否带 markdown 标记(与 v 同级的 vt=1)。注意:完整 markdown 判定还须消息外层 type=26,见 isMarkdownMsg。 */
188
+ export function isMarkdownTxt(txt) {
189
+ if (!txt || typeof txt !== 'object')
190
+ return false;
191
+ const vt = txt.vt;
192
+ return vt === 1 || vt === '1';
193
+ }
194
+ /**
195
+ * 消息是否为 markdown。
196
+ * 判定两要素(缺一不可):
197
+ * 1. 消息体最外层 `type === 26`(富文本)——客户端仅对 type=26 的消息按 markdown 解析渲染;
198
+ * 2. 任一 dt 段 txt 带 `vt=1`(与 v 同级)——表示 v 的内容是 markdown 原文。
199
+ * type≠26 时即使 txt 段带 vt=1,客户端也按普通文本展示,不判为 markdown。
200
+ */
201
+ export function isMarkdownMsg(msg) {
202
+ if (Number(msg?.type) !== 26)
203
+ return false;
204
+ const dt = Array.isArray(msg?.dt) ? msg.dt : [];
205
+ return dt.some((seg) => isMarkdownTxt(seg?.txt));
206
+ }
178
207
  /** 消息内容解析主入口。 */
179
208
  export function parseContent(value, opts = {}) {
180
209
  const msg = parseMsg(value) || {};
@@ -237,7 +266,8 @@ export function parseContent(value, opts = {}) {
237
266
  title = sys.etName;
238
267
  else if (sys.id18n && opts.i18nMap?.[sys.id18n])
239
268
  title = opts.i18nMap[sys.id18n];
240
- return { type, typeName, content, title, must, fileName, sys };
269
+ const format = isMarkdownMsg(msg) ? 'markdown' : 'text';
270
+ return { type, typeName, content, title, must, fileName, sys, format };
241
271
  }
242
272
  /**
243
273
  * 单段解析:图片/文件/视频/媒体/语音/位置 段 → 展示文本,文本段兜底。
@@ -162,7 +162,9 @@ async function enrichMessages(rawRows, host, options = {}) {
162
162
  type: parsed.type,
163
163
  typeName: parsed.typeName,
164
164
  title: options.titleFirst ? parsed.title : undefined,
165
- content: collapseNewlines(parsed.content),
165
+ // markdown 消息(vt=1)保留原文换行/表格结构不折叠;普通文本维持 ⏎ 单行化
166
+ content: parsed.format === 'markdown' ? parsed.content : collapseNewlines(parsed.content),
167
+ contentFormat: parsed.format,
166
168
  ...(quoteSummary
167
169
  ? { quote: quoteSummary, quoteTime: Number(quoteSummary.msgtime) > 0 ? formatFullTime(Math.floor(Number(quoteSummary.msgtime) / 1000)) : undefined }
168
170
  : {}),
@@ -16,19 +16,27 @@ function assertLocalFile(pathValue, field) {
16
16
  /**
17
17
  * 单聊/群聊发送内容归一化:txt / img / file 至少一种。
18
18
  * 🔴 全空白文本(空格 / 换行)不算内容,禁止发送空白消息。
19
+ * markdown:true 表示 txt 是 markdown 原文(发送时外层 type=26 且 txt 段带 vt=1,客户端仅对 type=26 按 markdown 解析),仅支持纯文本消息。
19
20
  */
20
21
  function normalizeContent(args) {
21
22
  const txtRaw = args.txt !== undefined && args.txt !== null ? String(args.txt) : '';
22
23
  const txt = txtRaw.trim() !== '' ? txtRaw : undefined;
23
24
  const imgPath = args.img || args.imgPath ? String(args.img || args.imgPath) : undefined;
24
25
  const filePath = args.file || args.filePath ? String(args.file || args.filePath) : undefined;
26
+ const markdown = args.markdown === true || args.markdown === 'true' || args.markdown === '1';
25
27
  if (!txt && !imgPath && !filePath) {
26
28
  throw imValidationError('content_required', 'txt / img / file 至少提供一种(空白文本不算内容,禁止发送空白消息)');
27
29
  }
28
30
  if (imgPath && filePath) {
29
31
  throw imValidationError('content_conflict', 'img 与 file 不能同时提供(一次发一种媒体)');
30
32
  }
31
- return { txt, imgPath, filePath };
33
+ if (markdown && !txt) {
34
+ throw imValidationError('markdown_requires_txt', 'markdown:true 必须同时提供 txt(markdown 仅支持文本消息)');
35
+ }
36
+ if (markdown && (imgPath || filePath)) {
37
+ throw imValidationError('markdown_txt_only', 'markdown 仅支持 txt 文本消息,不能与 img/file 同时使用');
38
+ }
39
+ return { txt, imgPath, filePath, markdown };
32
40
  }
33
41
  // ── 发单聊 ──
34
42
  const sendSinglePair = makeWritePair({
@@ -58,10 +66,12 @@ const sendSinglePair = makeWritePair({
58
66
  hasTxt: Boolean(content.txt),
59
67
  hasImg: Boolean(content.imgPath),
60
68
  hasFile: Boolean(content.filePath),
69
+ ...(content.markdown ? { contentFormat: 'markdown' } : {}),
61
70
  };
62
71
  const snapshot = { toUid, toCid };
63
72
  if (content.txt) {
64
73
  snapshot.txt = content.txt;
74
+ snapshot.markdown = content.markdown;
65
75
  summary.textPreview = content.txt.length > 60 ? `${content.txt.slice(0, 60)}…` : content.txt;
66
76
  }
67
77
  if (quote) {
@@ -84,13 +94,23 @@ const sendSinglePair = makeWritePair({
84
94
  async execute(plan, env) {
85
95
  const body = { reciver: { cid: plan.toCid, uid: plan.toUid } };
86
96
  const quoteRef = plan.quoteRef ?? null;
97
+ const txtExtra = plan.markdown ? { vt: '1' } : {};
98
+ // markdown 约束:客户端仅对最外层 type=26 的消息按 markdown 解析,故 markdown 发送时 msg JSON 的 type 必须为 '26'
99
+ const markdownTypeExtra = plan.markdown ? { type: '26' } : {};
87
100
  if (quoteRef) {
88
101
  // 引用:完整原生 msg JSON 走 msg 字段(与群聊同款承载方式,实测单聊同样生效)
89
102
  const self = await env.host.getSelfIdentity();
90
- body.msg = buildAtMsgJson(String(plan.txt ?? ''), [], self, { ref: quoteRef });
103
+ body.msg = buildAtMsgJson(String(plan.txt ?? ''), [], self, { ref: quoteRef, ...markdownTypeExtra }, txtExtra);
91
104
  }
92
105
  else if (plan.txt !== undefined) {
93
- body.txt = plan.txt;
106
+ if (plan.markdown) {
107
+ // markdown:完整原生 msg JSON 走 msg 字段,外层 type='26' 且 txt 段带 vt=1(与客户端格式一致)
108
+ const self = await env.host.getSelfIdentity();
109
+ body.msg = buildAtMsgJson(plan.txt, [], self, markdownTypeExtra, txtExtra);
110
+ }
111
+ else {
112
+ body.txt = plan.txt;
113
+ }
94
114
  }
95
115
  if (plan.imgPath) {
96
116
  const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
@@ -128,10 +148,11 @@ const sendGroupPair = makeWritePair({
128
148
  if (quote && !content.txt) {
129
149
  throw imValidationError('quote_requires_txt', 'quoteMsgId/replyMsgId 仅支持文本消息(txt)');
130
150
  }
131
- const summary = { action: '发送群聊消息', groupId, hasTxt: Boolean(content.txt), hasImg: Boolean(content.imgPath), hasFile: Boolean(content.filePath) };
151
+ const summary = { action: '发送群聊消息', groupId, hasTxt: Boolean(content.txt), hasImg: Boolean(content.imgPath), hasFile: Boolean(content.filePath), ...(content.markdown ? { contentFormat: 'markdown' } : {}) };
132
152
  const snapshot = { groupId };
133
153
  if (content.txt) {
134
154
  snapshot.txt = content.txt;
155
+ snapshot.markdown = content.markdown;
135
156
  summary.textPreview = content.txt.length > 60 ? `${content.txt.slice(0, 60)}…` : content.txt;
136
157
  }
137
158
  if (atEntries.length) {
@@ -159,14 +180,24 @@ const sendGroupPair = makeWritePair({
159
180
  const body = { groupId: plan.groupId };
160
181
  const atEntries = Array.isArray(plan.atEntries) ? plan.atEntries : [];
161
182
  const quoteRef = plan.quoteRef ?? null;
183
+ const txtExtra = plan.markdown ? { vt: '1' } : {};
184
+ // markdown 约束:客户端仅对最外层 type=26 的消息按 markdown 解析,故 markdown 发送时 msg JSON 的 type 必须为 '26'
185
+ const markdownTypeExtra = plan.markdown ? { type: '26' } : {};
162
186
  if (atEntries.length || quoteRef) {
163
187
  // @ / 引用 / 回复:完整原生 msg JSON 走 msg 字段(txt 字段无法携带 aus/ref,实测会被当纯文本展示)
164
188
  const { v, aus } = buildAtText(String(plan.txt ?? ''), atEntries);
165
189
  const self = await env.host.getSelfIdentity();
166
- body.msg = buildAtMsgJson(v, aus, self, quoteRef ? { [plan.quoteKind === 'reply' ? 'rmsg' : 'ref']: quoteRef } : {});
190
+ body.msg = buildAtMsgJson(v, aus, self, { ...(quoteRef ? { [plan.quoteKind === 'reply' ? 'rmsg' : 'ref']: quoteRef } : {}), ...markdownTypeExtra }, txtExtra);
167
191
  }
168
192
  else if (plan.txt !== undefined) {
169
- body.txt = plan.txt;
193
+ if (plan.markdown) {
194
+ // markdown:完整原生 msg JSON 走 msg 字段,外层 type='26' 且 txt 段带 vt=1(与客户端格式一致)
195
+ const self = await env.host.getSelfIdentity();
196
+ body.msg = buildAtMsgJson(plan.txt, [], self, markdownTypeExtra, txtExtra);
197
+ }
198
+ else {
199
+ body.txt = plan.txt;
200
+ }
170
201
  }
171
202
  if (plan.imgPath) {
172
203
  const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
@@ -343,6 +374,13 @@ const dingSendPair = makeWritePair({
343
374
  const txt = txtRaw.trim() !== '' ? txtRaw : '';
344
375
  if (!convertMsgid && !txt)
345
376
  throw imValidationError('content_required', '普通必达需 txt;转必达需 convertMsgid');
377
+ const markdown = args.markdown === true || args.markdown === 'true' || args.markdown === '1';
378
+ if (markdown && convertMsgid) {
379
+ throw imValidationError('markdown_txt_only', 'markdown 仅支持普通必达(txt),转必达沿用源消息格式');
380
+ }
381
+ if (markdown && !txt) {
382
+ throw imValidationError('markdown_requires_txt', 'markdown:true 必须同时提供 txt');
383
+ }
346
384
  if (args.unreadOnly === true && !groupId) {
347
385
  throw imValidationError('unread_only_group_only', 'unreadOnly 仅支持群聊转必达(需提供 groupId)');
348
386
  }
@@ -354,6 +392,7 @@ const dingSendPair = makeWritePair({
354
392
  targetType: groupId ? '群聊' : '单聊',
355
393
  ...(groupId ? { groupId } : { toUid }),
356
394
  ...(convertMsgid ? { convertMsgid } : { textPreview: txt.length > 60 ? `${txt.slice(0, 60)}…` : txt }),
395
+ ...(markdown ? { contentFormat: 'markdown' } : {}),
357
396
  sendMsg: args.sendMsg !== undefined ? Number(args.sendMsg) : 1,
358
397
  showType: args.showType !== undefined ? Number(args.showType) : 0,
359
398
  };
@@ -362,6 +401,7 @@ const dingSendPair = makeWritePair({
362
401
  toUid: toUid || undefined,
363
402
  toCid: args.toCid !== undefined ? str(args.toCid) : undefined,
364
403
  txt: txt || undefined,
404
+ markdown,
365
405
  convertMsgid: convertMsgid || undefined,
366
406
  unreadOnly: args.unreadOnly === true,
367
407
  toUids: args.toUids !== undefined ? (Array.isArray(args.toUids) ? args.toUids.map((x) => String(x)) : String(args.toUids).split(',').map((s) => s.trim()).filter(Boolean)) : undefined,
@@ -516,15 +556,20 @@ const dingSendPair = makeWritePair({
516
556
  extraInfo = JSON.stringify({ msgSource: { source: { tag, msgid: String(plan.convertMsgid), flag: plan.groupId ? 1 : 0, ...(plan.groupId ? { group_id: plan.groupId } : { user: { cid: plan.toCid, uid: plan.toUid } }) } } });
517
557
  }
518
558
  else {
519
- // 普通必达
559
+ // 普通必达(markdown 时外层 type='26' 且 txt 段带 vt=1,与客户端 markdown 消息格式一致;
560
+ // 客户端仅对最外层 type=26 的消息按 markdown 解析)
520
561
  content = plan.txt;
521
562
  mkind = 1;
563
+ const mdType = plan.markdown ? '26' : '1';
564
+ const txtSeg = plan.markdown
565
+ ? { v: plan.txt, vt: '1', next: '0', ft: 'china' }
566
+ : { v: plan.txt, next: '0', ft: 'china' };
522
567
  msgEntity = JSON.stringify({
523
568
  ver: '1.0', dev: 5, guid: '0', cnt: '0', idx: '0',
524
569
  sname: myName, suid: myUid, scid: myCid, display: '', sysId: '', weaOaId: '', bgc: '',
525
- type: '1', dt: [{ txt: { v: plan.txt, next: '0', ft: 'china' } }], tf: '1',
570
+ type: mdType, dt: [{ txt: txtSeg }], tf: '1',
526
571
  });
527
- msgTitle = JSON.stringify({ sname: myName, suid: myUid, scid: myCid, display: '0', type: '1', dt: [{ txt: { v: plan.txt, next: '0', ft: 'china' } }], vv: '', des: '', tf: '1' });
572
+ msgTitle = JSON.stringify({ sname: myName, suid: myUid, scid: myCid, display: '0', type: mdType, dt: [{ txt: txtSeg }], vv: '', des: '', tf: '1' });
528
573
  }
529
574
  // 接收人
530
575
  if (plan.groupId) {
@@ -609,6 +654,7 @@ const msgWriteOps = [
609
654
  toUid: { type: 'string', pattern: '^\\d+$', description: '接收人 uid' },
610
655
  toCid: { type: 'string', pattern: '^\\d+$', description: '接收人 cid' },
611
656
  txt: { type: 'string', description: '文本内容' },
657
+ markdown: { type: 'boolean', description: 'true 时 txt 按 markdown 发送(外层 type=26 + txt 段 vt=1),客户端按 markdown 渲染;仅支持纯文本消息,不能与 img/file/quoteMsgId 冲突(quote 可组合)' },
612
658
  quoteMsgId: { type: 'string', pattern: '^\\d+$', description: '引用该消息(单聊仅支持引用,不支持回复;仅 txt 文本消息);传单聊会话内消息 id(ser_msgid),prepare 阶段自动定位并组装 ref' },
613
659
  img: { type: 'string', description: '本地图片路径(发送前会上传到 E10 文件服务)' },
614
660
  file: { type: 'string', description: '本地文件路径' },
@@ -619,6 +665,7 @@ const msgWriteOps = [
619
665
  ...buildMsgWriteDefinition('im.msg.send.group', 'msg.send.group', '发送群聊消息(文本/图片/文件,文本支持 @ 提及与引用/回复)', {
620
666
  groupId: { type: 'string', pattern: '^\\d+$', description: '群 id' },
621
667
  txt: { type: 'string', description: '文本内容;@ 位置直接写 @<姓名>(如 @张三)或 @全体成员/@所有人' },
668
+ markdown: { type: 'boolean', description: 'true 时 txt 按 markdown 发送(外层 type=26 + txt 段 vt=1),客户端按 markdown 渲染;仅支持纯文本消息,不能与 img/file 同用,可与 @/引用/回复组合' },
622
669
  atAll: { type: 'boolean', description: '@全体成员(服务端固定 id=88),仅群聊、仅 txt 文本消息生效' },
623
670
  atUids: { type: 'array', items: { type: 'string' }, description: '@具体人 uid 列表,仅群聊;prepare 阶段会逐个核实是否在群内,不在群内则拒绝发送' },
624
671
  quoteMsgId: { type: 'string', pattern: '^\\d+$', description: '引用该消息(与 replyMsgId 互斥,仅群聊、仅 txt 文本消息);传消息 id(ser_msgid),prepare 阶段自动定位被引消息并组装 ref' },
@@ -644,6 +691,7 @@ const msgWriteOps = [
644
691
  toUid: { type: 'string', pattern: '^\\d+$', description: '单聊场景对方 uid' },
645
692
  toCid: { type: 'string', pattern: '^\\d+$', description: '单聊转必达对方 cid' },
646
693
  txt: { type: 'string', description: '普通必达文本' },
694
+ markdown: { type: 'boolean', description: 'true 时 txt 按 markdown 发送(外层 type=26 + txt 段 vt=1);仅普通必达支持,转必达沿用源消息格式' },
647
695
  convertMsgid: { type: 'string', pattern: '^\\d+$', description: '转必达源消息 id' },
648
696
  unreadOnly: { type: 'boolean', description: '群转必达仅发给未读人员' },
649
697
  toUids: { type: 'array', items: { type: 'string' }, description: '指定接收人 uid' },
@@ -946,7 +946,7 @@ export const invoiceOperations = [
946
946
  required: ['processTitle', 'reason', 'relatedProcessId', 'invoices'],
947
947
  properties: {
948
948
  processTitle: { type: 'string', minLength: 1, description: '报销流程标题,如「龚为明10月话费报销」' },
949
- reason: { type: 'string', minLength: 1, description: '报销事由,如「10月话费」' },
949
+ reason: { type: 'string', minLength: 1, description: '报销事由:话费固定「话费报销」,油费固定「油费报销」' },
950
950
  relatedProcessId: { ...positiveId, description: '话费 / 油费事前申请的 requestId' },
951
951
  invoices: {
952
952
  type: 'array',