weaver-work-cli 0.1.48 → 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.
- package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
- package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-EJYIOJPH.js} +3 -3
- package/dist/chunks/{chunk-FEP6ELMR.js → chunk-3NCFFHB2.js} +1 -1
- package/dist/chunks/chunk-5QYE52LG.js +223 -0
- package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
- package/dist/chunks/{chunk-NBEWUR7L.js → chunk-6T53BSWZ.js} +158 -44
- package/dist/chunks/{chunk-OCYRVZGN.js → chunk-7AYQJSFY.js} +2 -2
- package/dist/chunks/{chunk-5B5JXTY2.js → chunk-7ECB22G3.js} +221 -30
- package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
- package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-BFKLQLBK.js} +8 -8
- package/dist/chunks/{chunk-EFOUMXIX.js → chunk-HARQF5IP.js} +28 -28
- package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
- package/dist/chunks/chunk-JEQHNNSS.js +158 -0
- package/dist/chunks/{chunk-NK74RE5F.js → chunk-K67FODVC.js} +3 -3
- package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
- package/dist/chunks/{chunk-BCACE6VV.js → chunk-MCZG6HPM.js} +3 -3
- package/dist/chunks/{chunk-SVFG6EMV.js → chunk-RYFRGTUV.js} +5 -5
- package/dist/chunks/{chunk-PSPOFLSU.js → chunk-WNJUGI2F.js} +1 -1
- package/dist/chunks/{chunk-R2HHLJNN.js → chunk-YB3AJYPY.js} +4 -4
- package/dist/chunks/{conflict-APGSD5E7.js → conflict-C4UDHCWV.js} +2 -2
- package/dist/chunks/{contract-N6P2HIIE.js → contract-VUC6JOPG.js} +464 -9
- package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-6OG2LYBD.js} +6 -6
- package/dist/chunks/data-QO7QWOIV.js +2525 -0
- package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
- package/dist/chunks/{env-B6GKA2J3.js → env-WP57TF2S.js} +2 -2
- package/dist/chunks/{factory-MFCKLUT6.js → factory-VUXI7N5C.js} +1 -1
- package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
- package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-UQRGXILK.js} +3 -3
- package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
- package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
- package/dist/chunks/{invoice-FXWH5GPO.js → invoice-E7GOITEU.js} +1 -1
- package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-4BBLVAWM.js} +10 -10
- package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
- package/dist/chunks/org-NFE7X7FK.js +12 -0
- package/dist/chunks/{reception-VL6TKVAW.js → reception-QGPNTGHG.js} +526 -175
- package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
- package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
- package/dist/chunks/{registry-22O6UG4I.js → registry-5CRCN2TV.js} +10 -10
- package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
- package/dist/chunks/{registry-7VZ6YJUF.js → registry-V4CHRQDI.js} +1 -1
- package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-AYR3UG7R.js} +4 -4
- package/dist/chunks/{schedule-SPPAHER2.js → schedule-JZEFIXUS.js} +4 -4
- package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-3ZAF2J5E.js} +4 -4
- package/dist/index.js +16 -11
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
- package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
- package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
- package/dist/shortcuts/contract/host.js +11 -0
- package/dist/shortcuts/contract/index.js +13 -0
- package/dist/shortcuts/contract/manifest.js +53 -0
- package/dist/shortcuts/contract/operations/performance.js +58 -7
- package/dist/shortcuts/contract/operations/quote.js +283 -1
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
- package/dist/shortcuts/data/errors.js +64 -0
- package/dist/shortcuts/data/host.js +140 -0
- package/dist/shortcuts/data/index.js +429 -0
- package/dist/shortcuts/data/manifest.js +133 -0
- package/dist/shortcuts/data/operations/attend.js +62 -0
- package/dist/shortcuts/data/operations/conf.js +384 -0
- package/dist/shortcuts/data/operations/ds.js +686 -0
- package/dist/shortcuts/data/operations/field.js +68 -0
- package/dist/shortcuts/data/operations/index.js +65 -0
- package/dist/shortcuts/data/operations/module.js +383 -0
- package/dist/shortcuts/data/operations/noun.js +102 -0
- package/dist/shortcuts/data/operations/query.js +85 -0
- package/dist/shortcuts/data/operations/scene.js +235 -0
- package/dist/shortcuts/data/operations/shared.js +279 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/fna/host.js +4 -2
- package/dist/shortcuts/fna/manifest.js +14 -5
- package/dist/shortcuts/fna/operations/audit.js +334 -0
- package/dist/shortcuts/fna/operations/registry.js +2 -0
- package/dist/shortcuts/im/operations/at-mention.js +6 -3
- package/dist/shortcuts/im/operations/msg-parse.js +35 -5
- package/dist/shortcuts/im/operations/msg-sync.js +3 -1
- package/dist/shortcuts/im/operations/msg-write.js +57 -9
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/manifest.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/reception/constants.js +13 -6
- package/dist/shortcuts/reception/index.js +3 -1
- package/dist/shortcuts/reception/manifest.js +3 -2
- package/dist/shortcuts/reception/operations/ask.js +20 -2
- package/dist/shortcuts/reception/operations/compose.js +11 -0
- package/dist/shortcuts/reception/operations/doc.js +59 -0
- package/dist/shortcuts/reception/operations/docrender.js +25 -1
- package/dist/shortcuts/reception/operations/leads.js +31 -7
- package/dist/shortcuts/reception/operations/panels.js +86 -22
- package/dist/shortcuts/reception/operations/render.js +40 -0
- package/dist/shortcuts/reception/operations/restaurant.js +17 -4
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/workflow/operations/read.js +58 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
- package/docs/SKILL.md +2 -1
- package/docs/_catalog.md +4 -1
- package/docs/data.md +149 -0
- package/docs/fna.md +11 -4
- package/docs/reception.md +59 -5
- package/package.json +1 -1
- package/scripts/check-skill-sync.mjs +188 -0
- package/scripts/package-skill.mjs +17 -3
- package/skill-template/business-info.json +29 -1
- package/skill-template/domains/data.md +15 -0
- package/skill-template/domains/qiyecheng.md +4 -2
- package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
- package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
- package/skills/weaver-e10-data/SKILL.md +118 -0
- package/skills/weaver-e10-data/references/config-center.md +90 -0
- package/skills/weaver-e10-data/references/datasource.md +136 -0
- package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +219 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +50 -30
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +24 -15
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +43 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +265 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +83 -0
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
- package/skills/weaver-e10-meeting/SKILL.md +39 -7
- package/skills/weaver-e10-qiyecheng/SKILL.md +21 -7
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +104 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +17 -3
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +136 -30
- package/skills/weaver-e10-reception-flow/SKILL.md +70 -19
- package/skills/weaver-e10-reception-flow/references/guide.md +5 -4
- package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
- package/skills/weaver-e10-recruit-stage/SKILL.md +1 -1
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +6 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
- package/skills/weaver-e10-workflow/SKILL.md +2 -1
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +6 -45
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +5 -5
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +4 -37
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +22 -35
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
- package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
570
|
+
type: mdType, dt: [{ txt: txtSeg }], tf: '1',
|
|
526
571
|
});
|
|
527
|
-
msgTitle = JSON.stringify({ sname: myName, suid: myUid, scid: myCid, display: '0', type:
|
|
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' },
|
package/dist/shortcuts/index.js
CHANGED
|
@@ -150,6 +150,11 @@ export const builtinShortcuts = [
|
|
|
150
150
|
description: '泛微客户参观接待流程 CLI(面板/行程单与内部方案/填单页预填)',
|
|
151
151
|
load: async () => (await import('./reception/index.js')).receptionShortcut,
|
|
152
152
|
}),
|
|
153
|
+
lazyShortcut({
|
|
154
|
+
name: 'data',
|
|
155
|
+
description: '泛微E10数据助手 CLI(数据源查询 / 配置中心 / 场景定位)',
|
|
156
|
+
load: async () => (await import('./data/index.js')).dataShortcut,
|
|
157
|
+
}),
|
|
153
158
|
];
|
|
154
159
|
/** 全部 shortcut 的 CLI 元数据(不触发任何实现模块加载)。 */
|
|
155
160
|
export function shortcutMetadata() {
|
|
@@ -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: '
|
|
949
|
+
reason: { type: 'string', minLength: 1, description: '报销事由:话费固定「话费报销」,油费固定「油费报销」' },
|
|
950
950
|
relatedProcessId: { ...positiveId, description: '话费 / 油费事前申请的 requestId' },
|
|
951
951
|
invoices: {
|
|
952
952
|
type: 'array',
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组织/人员展开(2026-11-10 用户要求:治本,不是治标)。
|
|
3
|
+
*
|
|
4
|
+
* 问题:小E 说「我们部门所有人」时,模型用 `hrm.employee.query` 不带部门条件 → 服务端返回全公司
|
|
5
|
+
* 分页数据,本地再筛,实测 **51 秒**。正确路径其实只要两步:
|
|
6
|
+
* `hrm.org.lookup`(2s)→ `hrm.dept.members`(1s)。
|
|
7
|
+
*
|
|
8
|
+
* 本 operation 把这两步(以及分部/多部门/模糊名)收成 **一次调用**,并做 30 天缓存(可用 refresh 或环境变量覆盖):
|
|
9
|
+
* - 部门检索结果按关键词缓存(同一个「会议模块组」第二次 <1s)
|
|
10
|
+
* - 部门成员按部门 id 缓存(组织架构一天内不会变)
|
|
11
|
+
* - 支持模糊名:命中多个 → 返回 candidates 让用户点,不猜
|
|
12
|
+
* - 支持一次传多个关键词/多个部门,自动并集去重
|
|
13
|
+
*/
|
|
14
|
+
import { meetingValidationError } from '../../errors.js';
|
|
15
|
+
import { meetingSuccess } from '../types.js';
|
|
16
|
+
import { cacheScopeSuffix, readCache, writeCache } from './cache.js';
|
|
17
|
+
// ⛔ 2026-11-10 用户反馈:24h 太短(组织架构一天内不会变,反而是频繁重建缓存拖慢)。
|
|
18
|
+
// 默认 **30 天**(2026-11-10 用户定:组织架构变动不频繁,缓存越久越省);可用 WEAVER_MEETING_MEMBER_CACHE_TTL_HOURS 覆盖。
|
|
19
|
+
const TTL_HOURS = (() => {
|
|
20
|
+
const raw = Number(process.env.WEAVER_MEETING_MEMBER_CACHE_TTL_HOURS ?? '');
|
|
21
|
+
return Number.isFinite(raw) && raw > 0 ? Math.min(raw, 24 * 30) : 24 * 30;
|
|
22
|
+
})();
|
|
23
|
+
const TTL_ORG_MS = TTL_HOURS * 60 * 60 * 1000;
|
|
24
|
+
const TTL_MEMBERS_MS = TTL_ORG_MS;
|
|
25
|
+
const MAX_DEPARTMENTS = 30;
|
|
26
|
+
const MAX_MEMBERS_RETURN = 300;
|
|
27
|
+
async function runHrm(name, input, env) {
|
|
28
|
+
const { hrmOrgOperations } = await import('../../../hrm/operations/org.js');
|
|
29
|
+
const { hrmEmployeeOperations } = await import('../../../hrm/operations/employee.js');
|
|
30
|
+
const all = [...hrmOrgOperations, ...hrmEmployeeOperations];
|
|
31
|
+
const operation = all.find((item) => item.name === name);
|
|
32
|
+
if (!operation)
|
|
33
|
+
throw meetingValidationError('hrm_operation_missing', `当前 CLI 缺少 ${name}(请升级 weaver-work-cli)`);
|
|
34
|
+
return operation.handler(input, env);
|
|
35
|
+
}
|
|
36
|
+
async function lookupOrg(env, keyword, refresh) {
|
|
37
|
+
const scope = await cacheScopeSuffix(env);
|
|
38
|
+
const key = `org-lookup-v1-${scope}-${encodeURIComponent(keyword)}`;
|
|
39
|
+
if (!refresh) {
|
|
40
|
+
const hit = await readCache(env, key, { ttlMs: TTL_ORG_MS });
|
|
41
|
+
if (hit)
|
|
42
|
+
return { rows: hit.data, cached: true };
|
|
43
|
+
}
|
|
44
|
+
const result = await runHrm('hrm.org.lookup', { keyword, limit: 20 }, env);
|
|
45
|
+
const rows = (result?.data?.rows ?? []).map((row) => ({
|
|
46
|
+
id: String(row.id ?? ''),
|
|
47
|
+
name: String(row.name ?? ''),
|
|
48
|
+
type: String(row.type ?? ''),
|
|
49
|
+
...(row.fullPath ? { fullPath: String(row.fullPath) } : {}),
|
|
50
|
+
...(row.score !== undefined ? { score: Number(row.score) } : {}),
|
|
51
|
+
})).filter((row) => row.id && row.name);
|
|
52
|
+
await writeCache(env, key, rows);
|
|
53
|
+
return { rows, cached: false };
|
|
54
|
+
}
|
|
55
|
+
async function deptMembers(env, deptId, refresh) {
|
|
56
|
+
const scope = await cacheScopeSuffix(env);
|
|
57
|
+
const key = `dept-members-v1-${scope}-${deptId}`;
|
|
58
|
+
if (!refresh) {
|
|
59
|
+
const hit = await readCache(env, key, { ttlMs: TTL_MEMBERS_MS });
|
|
60
|
+
if (hit)
|
|
61
|
+
return { members: hit.data, cached: true };
|
|
62
|
+
}
|
|
63
|
+
const result = await runHrm('hrm.dept.members', { dept: deptId }, env);
|
|
64
|
+
const rows = (result?.data?.rows ?? result?.data?.members ?? []);
|
|
65
|
+
const members = rows.map((row) => ({
|
|
66
|
+
id: String(row.id ?? row.employeeId ?? ''),
|
|
67
|
+
name: String(row.name ?? row.employeeName ?? ''),
|
|
68
|
+
...(row.department ? { department: String(row.department) } : {}),
|
|
69
|
+
...(row.departmentId ? { departmentId: String(row.departmentId) } : {}),
|
|
70
|
+
...(row.subCompany ? { subCompany: String(row.subCompany) } : {}),
|
|
71
|
+
})).filter((row) => row.id);
|
|
72
|
+
await writeCache(env, key, members);
|
|
73
|
+
return { members, cached: false };
|
|
74
|
+
}
|
|
75
|
+
async function deptsUnderSubcompany(env, subcompanyId) {
|
|
76
|
+
const result = await runHrm('hrm.org.query', { type: 'department', subcompany: [subcompanyId], pageSize: 100 }, env);
|
|
77
|
+
const rows = (result?.data?.rows ?? []);
|
|
78
|
+
return rows.map((row) => ({ id: String(row.id ?? ''), name: String(row.name ?? '') })).filter((row) => row.id);
|
|
79
|
+
}
|
|
80
|
+
const meetingMemberExpand = {
|
|
81
|
+
name: 'meeting.member.expand',
|
|
82
|
+
resource: 'member',
|
|
83
|
+
method: 'expand',
|
|
84
|
+
action: 'meeting.member.expand',
|
|
85
|
+
summary: '把「我们部门所有人 / 某分部 / 模糊部门名」一次展开成员工 id 列表(查组织 + 取成员,带 30 天缓存,refresh 可强制刷新)。'
|
|
86
|
+
+ '支持 keywords 多个部门并集;模糊命中多个时返回 candidates(ambiguous=true)让用户点选,不猜。'
|
|
87
|
+
+ '⛔ 不要用 hrm.employee.query 不带条件查全公司(实测 51 秒)。',
|
|
88
|
+
capability: 'eb.meeting',
|
|
89
|
+
risk: 'read',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
additionalProperties: false,
|
|
93
|
+
properties: {
|
|
94
|
+
keyword: { type: 'string', description: '部门/分部名称,支持模糊(如「会议模块组」「产品研发中心」「会议」)' },
|
|
95
|
+
keywords: { type: 'array', items: { type: 'string' }, description: '多个部门/分部名称(并集去重)' },
|
|
96
|
+
scope: { type: 'string', enum: ['any', 'department', 'subcompany'], description: '限定组织类型,默认 any' },
|
|
97
|
+
includeMembers: { type: 'boolean', description: '是否展开成员,默认 true;只查部门 id 时传 false' },
|
|
98
|
+
refresh: { type: 'boolean', description: '忽略缓存重新查(默认 false)' },
|
|
99
|
+
maxDepartments: { type: 'number', description: `分部展开时最多取几个部门,默认 ${MAX_DEPARTMENTS}` },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
handler: async (args, env) => {
|
|
103
|
+
const tokens = [
|
|
104
|
+
...(typeof args.keyword === 'string' ? [args.keyword] : []),
|
|
105
|
+
...(Array.isArray(args.keywords) ? args.keywords.map((item) => String(item)) : []),
|
|
106
|
+
].map((item) => item.trim()).filter((item) => item !== '');
|
|
107
|
+
if (tokens.length === 0) {
|
|
108
|
+
throw meetingValidationError('keyword_required', '请传 keyword(部门/分部名称)或 keywords(多个)');
|
|
109
|
+
}
|
|
110
|
+
const scope = String(args.scope ?? 'any');
|
|
111
|
+
const includeMembers = args.includeMembers !== false;
|
|
112
|
+
const refresh = args.refresh === true;
|
|
113
|
+
const maxDepartments = Math.max(1, Math.min(100, Number(args.maxDepartments) || MAX_DEPARTMENTS));
|
|
114
|
+
const warnings = [];
|
|
115
|
+
const resolved = [];
|
|
116
|
+
const unresolved = [];
|
|
117
|
+
const ambiguous = [];
|
|
118
|
+
let fromCache = true;
|
|
119
|
+
for (const keyword of tokens) {
|
|
120
|
+
const { rows, cached } = await lookupOrg(env, keyword, refresh);
|
|
121
|
+
fromCache = fromCache && cached;
|
|
122
|
+
const filtered = scope === 'any' ? rows : rows.filter((row) => row.type === scope);
|
|
123
|
+
if (filtered.length === 0) {
|
|
124
|
+
unresolved.push(keyword);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
// 完全同名优先;否则若唯一候选就用它;多个候选 → 交给用户选,不猜
|
|
128
|
+
const exact = filtered.find((row) => row.name === keyword);
|
|
129
|
+
const picked = exact ?? (filtered.length === 1 ? filtered[0] : null);
|
|
130
|
+
if (!picked) {
|
|
131
|
+
ambiguous.push({ keyword, candidates: filtered.slice(0, 10) });
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
let members = [];
|
|
135
|
+
let deptCached = true;
|
|
136
|
+
if (includeMembers) {
|
|
137
|
+
if (picked.type === 'subcompany') {
|
|
138
|
+
const depts = await deptsUnderSubcompany(env, picked.id);
|
|
139
|
+
const limited = depts.slice(0, maxDepartments);
|
|
140
|
+
if (depts.length > limited.length) {
|
|
141
|
+
warnings.push(`「${picked.name}」下有 ${depts.length} 个部门,只展开了前 ${limited.length} 个(maxDepartments 可调)`);
|
|
142
|
+
}
|
|
143
|
+
for (const dept of limited) {
|
|
144
|
+
const part = await deptMembers(env, dept.id, refresh);
|
|
145
|
+
deptCached = deptCached && part.cached;
|
|
146
|
+
members.push(...part.members);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const part = await deptMembers(env, picked.id, refresh);
|
|
151
|
+
deptCached = part.cached;
|
|
152
|
+
members = part.members;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
fromCache = fromCache && deptCached;
|
|
156
|
+
resolved.push({ keyword, org: picked, members, cached: deptCached });
|
|
157
|
+
}
|
|
158
|
+
const seen = new Set();
|
|
159
|
+
const allMembers = [];
|
|
160
|
+
for (const item of resolved) {
|
|
161
|
+
for (const member of item.members) {
|
|
162
|
+
if (seen.has(member.id))
|
|
163
|
+
continue;
|
|
164
|
+
seen.add(member.id);
|
|
165
|
+
allMembers.push(member);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const overflow = allMembers.length > MAX_MEMBERS_RETURN;
|
|
169
|
+
const members = overflow ? allMembers.slice(0, MAX_MEMBERS_RETURN) : allMembers;
|
|
170
|
+
if (overflow)
|
|
171
|
+
warnings.push(`人员较多(${allMembers.length}),只返回前 ${MAX_MEMBERS_RETURN} 个;建议按更小的部门范围查`);
|
|
172
|
+
if (unresolved.length > 0)
|
|
173
|
+
warnings.push(`未找到组织:${unresolved.join('、')}`);
|
|
174
|
+
const isAmbiguous = ambiguous.length > 0;
|
|
175
|
+
if (isAmbiguous) {
|
|
176
|
+
warnings.push('存在多个同名/近名组织:请把 candidates 做成选项让用户点选,不要自己挑');
|
|
177
|
+
}
|
|
178
|
+
return meetingSuccess('meeting.member.expand', {
|
|
179
|
+
input: { keywords: tokens, scope, includeMembers },
|
|
180
|
+
departments: resolved.map((item) => ({
|
|
181
|
+
keyword: item.keyword,
|
|
182
|
+
id: item.org.id,
|
|
183
|
+
name: item.org.name,
|
|
184
|
+
type: item.org.type,
|
|
185
|
+
...(item.org.fullPath ? { fullPath: item.org.fullPath } : {}),
|
|
186
|
+
memberCount: item.members.length,
|
|
187
|
+
})),
|
|
188
|
+
members,
|
|
189
|
+
count: members.length,
|
|
190
|
+
/** 直接可用的参会人入参(逗号分隔的员工 id) */
|
|
191
|
+
membersCsv: members.map((member) => member.id).join(','),
|
|
192
|
+
memberNames: members.map((member) => member.name).join('、'),
|
|
193
|
+
ambiguous: isAmbiguous,
|
|
194
|
+
candidates: ambiguous.flatMap((item) => item.candidates.map((row) => ({ keyword: item.keyword, ...row }))),
|
|
195
|
+
unresolved,
|
|
196
|
+
source: fromCache ? 'cache' : 'api',
|
|
197
|
+
}, warnings.length > 0 ? { warnings } : {});
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
export const meetingMemberExpandOperations = [meetingMemberExpand];
|
|
@@ -44,6 +44,20 @@ const DEFAULT_AI_MINUTE_PAGE = '1250830691712172036';
|
|
|
44
44
|
function textOf(value) {
|
|
45
45
|
return value === undefined || value === null ? '' : String(value);
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* 系统通知的消息类型(入群 / 改名 / 群公告等居中灰字提示)。
|
|
49
|
+
* ⚠️ 必须按**数字 type** 判定,不能按 `typeName` 中文名判定:上游 2026-11-11 把
|
|
50
|
+
* type=14 的显示名从「通知」改成「居中(灰色字体)」,按名字过滤会静默失效、
|
|
51
|
+
* 把系统提示当成人话塞进纪要。
|
|
52
|
+
*/
|
|
53
|
+
const SYSTEM_NOTICE_TYPES = new Set(['9', '14']);
|
|
54
|
+
const SYSTEM_NOTICE_TYPE_NAMES = new Set(['系统', '通知', '居中']);
|
|
55
|
+
function isSystemNotice(message) {
|
|
56
|
+
const type = textOf(message.type).trim();
|
|
57
|
+
if (type)
|
|
58
|
+
return SYSTEM_NOTICE_TYPES.has(type);
|
|
59
|
+
return SYSTEM_NOTICE_TYPE_NAMES.has(textOf(message.typeName));
|
|
60
|
+
}
|
|
47
61
|
const DAY_MS = 24 * 3600_000;
|
|
48
62
|
/** 解析 E10 的本地时间串;只给日期时补 `00:00:00`,否则会得到 Invalid Date 静默退回默认窗口。 */
|
|
49
63
|
function parseLocalTime(value) {
|
|
@@ -167,7 +181,7 @@ function formatLine(message, nameByUid) {
|
|
|
167
181
|
export function composeTranscript(messages, nameByUid, keepSystem) {
|
|
168
182
|
// ⚠️ im.msg.sync.group 返回是**倒序(新→旧)**,不重排会把纪要时间线写反
|
|
169
183
|
const ordered = [...messages].sort((a, b) => Number(a.msgtime ?? 0) - Number(b.msgtime ?? 0));
|
|
170
|
-
const keptMessages = keepSystem ? ordered : ordered.filter((m) =>
|
|
184
|
+
const keptMessages = keepSystem ? ordered : ordered.filter((m) => !isSystemNotice(m));
|
|
171
185
|
const ignoredSystem = ordered.length - keptMessages.length;
|
|
172
186
|
return {
|
|
173
187
|
transcript: keptMessages.map((message) => formatLine(message, nameByUid)).join('\n'),
|
|
@@ -186,7 +200,7 @@ const DIGEST_PATTERN = /(@|负责|分工|安排|决定|结论|确定|定稿|通
|
|
|
186
200
|
/** 只保留有决策价值的发言,压成摘要版;仍超上限则按行截断。 */
|
|
187
201
|
export function buildDigest(messages, nameByUid, keepSystem, maxChars) {
|
|
188
202
|
const ordered = [...messages].sort((a, b) => Number(a.msgtime ?? 0) - Number(b.msgtime ?? 0));
|
|
189
|
-
const base = keepSystem ? ordered : ordered.filter((m) =>
|
|
203
|
+
const base = keepSystem ? ordered : ordered.filter((m) => !isSystemNotice(m));
|
|
190
204
|
const essence = base.filter((message) => {
|
|
191
205
|
const content = textOf(message.content).trim();
|
|
192
206
|
if (!content)
|
|
@@ -17,6 +17,7 @@ import { meetingMinuteFromGroupChatOperations } from './from-group-chat.js';
|
|
|
17
17
|
import { meetingDecisionNotifyOperations } from './task-notify.js';
|
|
18
18
|
import { meetingPipelineOperations } from './pipeline.js';
|
|
19
19
|
import { meetingInvitationOperations } from './invitation.js';
|
|
20
|
+
import { meetingMemberExpandOperations } from './eb/member-expand.js';
|
|
20
21
|
import { meetingInvitationPublishOperations } from './invitation-publish.js';
|
|
21
22
|
import { meetingQrOperations } from './qrcode.js';
|
|
22
23
|
import { meetingSummaryOperations } from './summary.js';
|
|
@@ -43,6 +44,7 @@ function buildRegistry() {
|
|
|
43
44
|
...meetingDecisionNotifyOperations,
|
|
44
45
|
...meetingPipelineOperations,
|
|
45
46
|
...meetingInvitationOperations,
|
|
47
|
+
...meetingMemberExpandOperations,
|
|
46
48
|
...meetingInvitationPublishOperations,
|
|
47
49
|
...meetingQrOperations,
|
|
48
50
|
...meetingSummaryOperations,
|
|
@@ -40,12 +40,19 @@ export const LOGISTICS_HINT = [
|
|
|
40
40
|
'伴手礼:如「礼盒每人1份」或「不用」',
|
|
41
41
|
'手机:11 位,只用于行程单显示接待人联系方式(系统不查员工手机号)',
|
|
42
42
|
].join('\n');
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
// 客户需求面板的四个选项已移到 `operations/leads.ts` 的 `buildNeedOptions()`:
|
|
44
|
+
// 第 2 项要按客户类型动态拼(政企 → 数智公文 / 科技 → AI 智能化 / 其余 → 数智业财),
|
|
45
|
+
// 放常量里会与实现脱节——历史上就出现过「SKILL 写动态生成、代码却是固定清单」。
|
|
46
|
+
/**
|
|
47
|
+
* 第 3 问:是否安排会议。
|
|
48
|
+
*
|
|
49
|
+
* 必问项——只有原话**明确提到会议室/座谈/汇报/指定房间**(`meetingExplicit:true`)才跳过。
|
|
50
|
+
* 「晚上订小餐厅」不算:小餐厅是晚餐场地,与会议室预定是两条独立线索,不得互相推断。
|
|
51
|
+
*/
|
|
52
|
+
export const MEETING_TITLE = '是否安排会议(需预留场地)';
|
|
53
|
+
export const MEETING_OPTIONS = [
|
|
54
|
+
{ label: '是,安排会议室', value: '是' },
|
|
55
|
+
{ label: '否,不需要', value: '否' },
|
|
49
56
|
];
|
|
50
57
|
/** 快照文件的 kind 标识,用于拒收无关 JSON。 */
|
|
51
58
|
export const SNAPSHOT_KIND = 'reception-fields-snapshot';
|
|
@@ -99,7 +99,7 @@ export const receptionShortcut = {
|
|
|
99
99
|
await runOperation(ctx, String(operation), input, opts);
|
|
100
100
|
}));
|
|
101
101
|
reception.command('ask')
|
|
102
|
-
.description('
|
|
102
|
+
.description('出交互面板(缺项才出屏,最多 3 屏:客户需求 / 接待细节 / 是否会议)')
|
|
103
103
|
.option('--known <json>', '7 项抽取结果(内联 JSON)')
|
|
104
104
|
.option('--known-file <path>', '7 项抽取结果(JSON 文件,推荐)')
|
|
105
105
|
.option('--user <names>', '陪同人员姓名,多人逗号分隔;不传用当前登录人兜底')
|
|
@@ -196,6 +196,7 @@ export const receptionShortcut = {
|
|
|
196
196
|
.option('--snapshot <path>', '字段快照路径(同时用于推导 render.py)')
|
|
197
197
|
.option('--render-py <path>', '显式指定 render.py')
|
|
198
198
|
.option('--no-upload', '跳过附件上传,只出本地文件')
|
|
199
|
+
.option('--allow-missing-restaurant', '提了小餐厅但没包厢号时仍放行(明细留空进待办)')
|
|
199
200
|
.option('--sdk-render <type>', '打开形态:inline / popup / drawer(默认 drawer)')
|
|
200
201
|
.action(action(async (ctx, options) => {
|
|
201
202
|
const opts = asOptions(options);
|
|
@@ -210,6 +211,7 @@ export const receptionShortcut = {
|
|
|
210
211
|
snapshot: textOf(opts, 'snapshot') || undefined,
|
|
211
212
|
renderPy: textOf(opts, 'renderPy') || undefined,
|
|
212
213
|
noUpload: opts.upload === false,
|
|
214
|
+
allowMissingRestaurant: opts.allowMissingRestaurant === true,
|
|
213
215
|
sdkRender: textOf(opts, 'sdkRender') || undefined,
|
|
214
216
|
}, opts);
|
|
215
217
|
}));
|
|
@@ -3,7 +3,7 @@ export const receptionOperations = [
|
|
|
3
3
|
{
|
|
4
4
|
name: 'reception.ask',
|
|
5
5
|
risk: 'read',
|
|
6
|
-
summary: '按 7
|
|
6
|
+
summary: '按 7 项抽取结果出交互面板:客户需求(已明确则跳过)+ 接待细节(常驻)+ 是否会议(必问,原话明确提及会议室才跳过)。返回 runId 供 doc 使用。',
|
|
7
7
|
inputSchema: {
|
|
8
8
|
type: 'object',
|
|
9
9
|
additionalProperties: false,
|
|
@@ -26,7 +26,7 @@ export const receptionOperations = [
|
|
|
26
26
|
demand: { type: 'string', description: '客户需求(旧字段名,customerNeed 优先)' },
|
|
27
27
|
customerNeed: { type: 'string', description: '客户需求原文;已给则不再出「客户需求」面板,并写入表单客户需求字段' },
|
|
28
28
|
meeting: { type: 'string', enum: ['是', '否'], description: '是否需要会议室座谈;必须与 meetingExplicit 一起传才生效' },
|
|
29
|
-
meetingExplicit: { type: 'boolean', description: '
|
|
29
|
+
meetingExplicit: { type: 'boolean', description: '原话是否明确提及预定会议室(会议室/订会议室/座谈场地/汇报场地,或指定 129/130/131)。只有 true 才跳过会议屏;「晚上订小餐厅」不算,不得据此推断' },
|
|
30
30
|
restaurantIntent: { type: 'boolean', description: '原话是否提到小餐厅/包厢;true 则必须带 --restaurant-rooms-file' },
|
|
31
31
|
logistics: { type: 'string', description: '接待细节原文:人数/接送/用餐/住宿/伴手礼/手机' },
|
|
32
32
|
},
|
|
@@ -145,6 +145,7 @@ export const receptionOperations = [
|
|
|
145
145
|
outDir: { type: 'string', description: '产物输出目录' },
|
|
146
146
|
noUpload: { type: 'boolean', description: '跳过附件上传,只出本地文件' },
|
|
147
147
|
snapshot: { type: 'string', description: '字段快照路径;同时用于推导技能包内 render.py 位置' },
|
|
148
|
+
allowMissingRestaurant: { type: 'boolean', description: '提了小餐厅但确实拿不到包厢号时放行(明细留空进待办),默认 false 直接报 RESTAURANT_DETAIL_MISSING' },
|
|
148
149
|
renderPy: { type: 'string', description: '显式指定 render.py 路径' },
|
|
149
150
|
sdkRender: {
|
|
150
151
|
type: 'string',
|