weaver-work-cli 0.1.47 → 0.1.49

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 (229) hide show
  1. package/dist/chunks/{archive-oa-BBDP7AKJ.js → archive-oa-57R2FYHV.js} +565 -17
  2. package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
  4. package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
  5. package/dist/chunks/{chunk-IP4CWQCF.js → chunk-3NV2ETZR.js} +8 -8
  6. package/dist/chunks/{chunk-OXHHJWNC.js → chunk-3X7VOSBA.js} +1 -1
  7. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  8. package/dist/chunks/{chunk-IRMIEDXN.js → chunk-6GWU63YF.js} +1 -1
  9. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  10. package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
  11. package/dist/chunks/{chunk-AD46OMQK.js → chunk-BRRW7CWA.js} +121 -46
  12. package/dist/chunks/{chunk-76H3IKH6.js → chunk-D2QRZUW4.js} +221 -37
  13. package/dist/chunks/{chunk-GSZTA43P.js → chunk-EJVA5ZVB.js} +2 -2
  14. package/dist/chunks/{chunk-4RWS2YYL.js → chunk-GEOMANP7.js} +3 -3
  15. package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
  16. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  17. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  18. package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-K3BT54CU.js} +4 -4
  19. package/dist/chunks/{chunk-6AXKWFKG.js → chunk-KV5SOWMS.js} +4 -4
  20. package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
  21. package/dist/chunks/{chunk-PSOMGA3U.js → chunk-ZKEUGS2U.js} +36 -7
  22. package/dist/chunks/{conflict-H7EHQXYY.js → conflict-6347A7YK.js} +2 -2
  23. package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
  24. package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-7WG7LVX5.js} +6 -6
  25. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  26. package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
  27. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  28. package/dist/chunks/{env-66FPSJDV.js → env-LHRKSLG6.js} +2 -2
  29. package/dist/chunks/{factory-UH2TZBVA.js → factory-2H7Z4RWJ.js} +1 -1
  30. package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-EW6PNDDT.js} +3 -3
  31. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  32. package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
  33. package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
  34. package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
  35. package/dist/chunks/{meeting-VTBFW4HI.js → meeting-N2FQBHXI.js} +10 -10
  36. package/dist/chunks/org-NFE7X7FK.js +12 -0
  37. package/dist/chunks/{reception-5WITA44R.js → reception-MYOKJULO.js} +905 -116
  38. package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-FKWS5UQF.js} +118 -29
  39. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  40. package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
  41. package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
  42. package/dist/chunks/{registry-JVQBLFQ5.js → registry-CKUVBS53.js} +10 -10
  43. package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-MBCYENQ2.js} +4 -4
  44. package/dist/chunks/{schedule-IDETODCA.js → schedule-5IFMCXME.js} +4 -4
  45. package/dist/chunks/{workflow-BSYT5TGL.js → workflow-2TRU2ZSP.js} +5 -5
  46. package/dist/core/refs.js +19 -2
  47. package/dist/index.js +20 -15
  48. package/dist/shortcuts/archive-oa/constants.js +42 -0
  49. package/dist/shortcuts/archive-oa/host.js +2 -2
  50. package/dist/shortcuts/archive-oa/index.js +38 -0
  51. package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
  52. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  53. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  54. package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
  55. package/dist/shortcuts/archive-oa/operations/registry.js +9 -4
  56. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  57. package/dist/shortcuts/contract/index.js +9 -1
  58. package/dist/shortcuts/contract/manifest.js +14 -2
  59. package/dist/shortcuts/contract/operations/card.js +231 -0
  60. package/dist/shortcuts/contract/operations/registry.js +2 -0
  61. package/dist/shortcuts/contract/operations/review.js +16 -5
  62. package/dist/shortcuts/contract/operations/summary.js +25 -17
  63. package/dist/shortcuts/data/errors.js +64 -0
  64. package/dist/shortcuts/data/host.js +140 -0
  65. package/dist/shortcuts/data/index.js +429 -0
  66. package/dist/shortcuts/data/manifest.js +133 -0
  67. package/dist/shortcuts/data/operations/attend.js +62 -0
  68. package/dist/shortcuts/data/operations/conf.js +384 -0
  69. package/dist/shortcuts/data/operations/ds.js +686 -0
  70. package/dist/shortcuts/data/operations/field.js +68 -0
  71. package/dist/shortcuts/data/operations/index.js +65 -0
  72. package/dist/shortcuts/data/operations/module.js +383 -0
  73. package/dist/shortcuts/data/operations/noun.js +102 -0
  74. package/dist/shortcuts/data/operations/query.js +85 -0
  75. package/dist/shortcuts/data/operations/scene.js +235 -0
  76. package/dist/shortcuts/data/operations/shared.js +279 -0
  77. package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
  78. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +28 -12
  79. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  80. package/dist/shortcuts/ehr/recruit-stage/shared.js +90 -8
  81. package/dist/shortcuts/im/index.js +128 -0
  82. package/dist/shortcuts/im/operations/session.js +6 -0
  83. package/dist/shortcuts/index.js +5 -0
  84. package/dist/shortcuts/invoice/host.js +0 -3
  85. package/dist/shortcuts/invoice/manifest.js +0 -1
  86. package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
  87. package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
  88. package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
  89. package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
  90. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
  91. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  92. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  93. package/dist/shortcuts/reception/constants.js +11 -0
  94. package/dist/shortcuts/reception/host.js +33 -1
  95. package/dist/shortcuts/reception/index.js +22 -1
  96. package/dist/shortcuts/reception/manifest.js +55 -2
  97. package/dist/shortcuts/reception/operations/ask.js +37 -1
  98. package/dist/shortcuts/reception/operations/compose.js +124 -3
  99. package/dist/shortcuts/reception/operations/doc.js +59 -0
  100. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  101. package/dist/shortcuts/reception/operations/leads.js +245 -0
  102. package/dist/shortcuts/reception/operations/markdown.js +22 -0
  103. package/dist/shortcuts/reception/operations/panels.js +84 -21
  104. package/dist/shortcuts/reception/operations/registry.js +2 -0
  105. package/dist/shortcuts/reception/operations/render.js +76 -3
  106. package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
  107. package/dist/shortcuts/reception/operations/restaurant.js +264 -0
  108. package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
  109. package/dist/shortcuts/reception/operations/schedule.js +7 -1
  110. package/dist/shortcuts/reception/upload.js +22 -6
  111. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +28 -12
  112. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  113. package/dist/shortcuts/recruit-stage/shared.js +99 -14
  114. package/docs/SKILL.md +1 -0
  115. package/docs/_catalog.md +3 -0
  116. package/docs/archive-oa.md +4 -2
  117. package/docs/data.md +149 -0
  118. package/docs/reception.md +59 -5
  119. package/package.json +1 -1
  120. package/scripts/check-skill-sync.mjs +188 -0
  121. package/scripts/package-skill.mjs +17 -3
  122. package/skill-template/business-info.json +23 -0
  123. package/skill-template/domains/archive-oa.md +2 -1
  124. package/skill-template/domains/data.md +15 -0
  125. package/skill-template/master-skill-template.md +1 -0
  126. package/skill-template/skill-template.md +1 -0
  127. package/skills/weaver-e10-archive-oa/SKILL.md +35 -7
  128. package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
  129. package/skills/weaver-e10-archive-oa/references/contract-search.md +105 -4
  130. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +2 -2
  131. package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
  132. package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
  133. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +48 -2
  134. package/skills/weaver-e10-calendar/SKILL.md +1 -1
  135. package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
  136. package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
  137. package/skills/weaver-e10-cowork/SKILL.md +9 -6
  138. package/skills/weaver-e10-data/SKILL.md +118 -0
  139. package/skills/weaver-e10-data/references/config-center.md +90 -0
  140. package/skills/weaver-e10-data/references/datasource.md +136 -0
  141. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  142. package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
  143. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
  145. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
  146. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  147. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
  148. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  150. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
  152. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
  153. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
  154. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
  155. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  156. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  157. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
  158. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
  159. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  160. package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
  161. package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
  162. package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
  163. package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
  164. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
  165. package/skills/weaver-e10-jucailin/SKILL.md +7 -4
  166. package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
  167. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
  168. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
  169. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
  170. package/skills/weaver-e10-mail/SKILL.md +17 -4
  171. package/skills/weaver-e10-meeting/SKILL.md +129 -412
  172. package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
  173. package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
  174. package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
  175. package/skills/weaver-e10-reception-flow/SKILL.md +77 -19
  176. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
  177. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
  178. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  179. package/skills/weaver-e10-reception-flow/scripts/render.py +84 -3
  180. package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
  181. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +78 -8
  182. package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
  183. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
  184. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
  185. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
  186. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
  187. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
  188. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
  189. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
  190. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
  191. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
  192. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
  193. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +169 -0
  194. package/skills/weaver-e10-shijingran/SKILL.md +6 -2
  195. package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
  196. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  197. package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
  198. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
  199. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  200. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
  201. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
  202. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
  203. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
  204. package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
  205. package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
  206. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
  207. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
  208. package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-CBYI6CQ6.js} +3 -3
  209. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
  210. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
  211. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
  212. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
  213. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
  214. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
  215. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
  216. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
  217. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
  218. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
  219. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
  220. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
  221. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
  222. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
  223. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
  224. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
  225. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
  226. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
  227. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
  228. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
  229. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
@@ -518,16 +518,37 @@ const ebConflictRoom = {
518
518
  properties: {
519
519
  beginDatetime: { ...SCHEMA_DATETIME_MINUTE, description: '开始时间(必填,yyyy-MM-dd HH:mm)' },
520
520
  endDatetime: { ...SCHEMA_DATETIME_MINUTE, description: '结束时间(必填,yyyy-MM-dd HH:mm)' },
521
- address: { ...SCHEMA_ID, description: '会议室 id(必填)' },
521
+ address: { ...SCHEMA_ID, description: '会议室 id;与 room_name 二选一(推荐直接传 room_name)' },
522
+ room_name: { type: 'string', description: '会议室名称(如「317」「317会议室」):内部解析成 id,省掉先查列表这一步' },
522
523
  mtId: { ...SCHEMA_ID, description: '变更会议时排除自身' },
523
524
  },
524
- required: ['beginDatetime', 'endDatetime', 'address'],
525
+ required: ['beginDatetime', 'endDatetime'],
525
526
  },
526
527
  handler: async (args, env) => {
528
+ // ⛔ 2026-11-09:以前只收 id,调用方要先拉全量清单找 id(155 间 × 多页,耗时上百秒)。
529
+ // 现在允许直接传 room_name,内部一次性解析,省掉“查清单 → 找 id → 再查冲突”的绕路。
530
+ let addressId = String(args.address ?? '').trim();
531
+ let resolvedRoom = null;
532
+ if (!addressId && String(args.room_name ?? '').trim()) {
533
+ const { resolveAddressRoom } = await import('./create-flow.js');
534
+ const resolved = await resolveAddressRoom(env, String(args.room_name));
535
+ if (!resolved?.id) {
536
+ throw meetingValidationError('room_not_found', `找不到名为「${String(args.room_name)}」的会议室,请用 meeting.eb.room.list 核对名称`);
537
+ }
538
+ addressId = String(resolved.id);
539
+ resolvedRoom = { id: String(resolved.id), name: String(resolved.name ?? ''), ...(resolved.status ? { status: String(resolved.status) } : {}) };
540
+ }
541
+ if (!addressId) {
542
+ // room_name 命中多间 / 找不到 → 明确报错,别拿一个假 id 去查出一片“空闲”
543
+ throw meetingValidationError('room_ambiguous', `「${String(args.room_name ?? '')}」匹配不到唯一会议室:请用 meeting.eb.room.list 查到准确名称/ID,或改用 address 传 id`);
544
+ }
545
+ if (!String(args.address ?? '').trim() && resolvedRoom?.status === 'unknown') {
546
+ throw meetingValidationError('room_unresolved', `「${String(args.room_name ?? '')}」在台账里找不到对应会议室(解析到 id=${addressId}),不能据此判断空闲`);
547
+ }
527
548
  const outcome = await runEbConflictCheck({
528
549
  beginDatetime: args.beginDatetime,
529
550
  endDatetime: args.endDatetime,
530
- address: String(args.address),
551
+ address: addressId,
531
552
  ...(args.mtId !== undefined ? { excludeMtId: String(args.mtId) } : {}),
532
553
  }, env, 'meeting.eb.conflict.room', { throwOnReject: false });
533
554
  const room = outcome.room ?? { skipped: true, hasConflict: false, conflicts: [], requests: 0 };
@@ -539,6 +560,8 @@ const ebConflictRoom = {
539
560
  ? 'rejected'
540
561
  : 'warn';
541
562
  return meetingSuccess('meeting.eb.conflict.room', {
563
+ // 透明化:告诉调用方 room_name 到底解析成了哪一间,避免「查了别间还以为查对了」
564
+ resolvedRoom,
542
565
  verdict,
543
566
  hasConflict: room.hasConflict,
544
567
  skipped: room.skipped,
@@ -0,0 +1,63 @@
1
+ /**
2
+ * continuation 短句柄(2026-11-09)。
3
+ *
4
+ * 问题:`create.flow.prepare` 返回的 continuation 是一串很长的 base64,
5
+ * 模型在对话里转述/重打时会被截断("确认凭证已失效,我在传递时被截断了"),
6
+ * 于是又跑一次预检 —— 用户看到的就是"又预检了一遍"。
7
+ *
8
+ * 方案:签发时同时落一个 8 位短 id,apply 只要传 `continuationId` 就能取回原 token。
9
+ * 短 id 只是本地索引,token 本身仍然校验签名/租户/账号,安全性不变。
10
+ */
11
+ import { randomBytes } from 'node:crypto';
12
+ import { mkdir, readFile, writeFile, readdir, stat, unlink } from 'node:fs/promises';
13
+ import { homedir } from 'node:os';
14
+ import { join } from 'node:path';
15
+ function storeDir() {
16
+ return join(homedir(), '.weaver-work-cli', 'meeting', 'state', 'continuations');
17
+ }
18
+ export async function saveContinuationAlias(token, ttlMs) {
19
+ const id = randomBytes(4).toString('hex');
20
+ const dir = storeDir();
21
+ await mkdir(dir, { recursive: true });
22
+ await writeFile(join(dir, `${id}.json`), JSON.stringify({ token, exp: Date.now() + ttlMs }), 'utf8');
23
+ // 顺手清理过期文件,避免无限增长
24
+ void pruneExpired(dir);
25
+ return id;
26
+ }
27
+ export async function resolveContinuationAlias(id) {
28
+ const text = String(id ?? '').trim();
29
+ if (!/^[0-9a-f]{8}$/u.test(text))
30
+ return null;
31
+ try {
32
+ const raw = await readFile(join(storeDir(), `${text}.json`), 'utf8');
33
+ const parsed = JSON.parse(raw);
34
+ if (!parsed.token || Number(parsed.exp ?? 0) <= Date.now())
35
+ return null;
36
+ return parsed.token;
37
+ }
38
+ catch {
39
+ return null;
40
+ }
41
+ }
42
+ async function pruneExpired(dir) {
43
+ try {
44
+ const names = await readdir(dir);
45
+ const now = Date.now();
46
+ for (const name of names) {
47
+ if (!name.endsWith('.json'))
48
+ continue;
49
+ const full = join(dir, name);
50
+ try {
51
+ const info = await stat(full);
52
+ if (now - info.mtimeMs > 24 * 60 * 60 * 1000)
53
+ await unlink(full);
54
+ }
55
+ catch {
56
+ /* 清理失败忽略 */
57
+ }
58
+ }
59
+ }
60
+ catch {
61
+ /* 目录不存在等忽略 */
62
+ }
63
+ }
@@ -11,6 +11,7 @@ import { inferRoomFloor, loadRooms, recommendRooms } from './room-recommend.js';
11
11
  import { dayOf, filterUsages, invalidateDayUsages, loadDayUsages } from './usage-cache.js';
12
12
  import { pickRememberedFlow, readFlowPick, rememberFlowPick } from './flow-memory.js';
13
13
  import { clearMeetingDraft, loadMeetingDraft, saveMeetingDraft } from './draft-memory.js';
14
+ import { resolveContinuationAlias, saveContinuationAlias } from './continuation-alias.js';
14
15
  import { resolveNamesCached } from './person-cache.js';
15
16
  /**
16
17
  * 通过**流程**新建 EB 会议(`meeting.eb.meeting.create.flow`)。
@@ -227,7 +228,20 @@ export async function resolveAddressRoom(env, input) {
227
228
  ?? (ref.name ? rooms.find((room) => room.name === ref.name) : undefined);
228
229
  if (hit)
229
230
  return { id: hit.id, name: hit.name, status: hit.status, statusText: hit.statusText };
230
- // 纯 id 且台账里没有(刚建/缓存旧)→ 保留 id 继续走,别拦住
231
+ // ⛔ 2026-11-09:用户说「317」时,parseRoomRef 会当成 id=317(台账根本没有这个 id),
232
+ // 旧逻辑直接原样返回 {id:'317'},占用接口查不到任何记录 → 假「ok 没冲突」。
233
+ // 这里补一层「名称包含」匹配:唯一命中就用它;命中多间则返回 null 让调用方去问。
234
+ const keyword = (ref.name ?? text).trim();
235
+ if (keyword) {
236
+ const loose = rooms.filter((room) => room.name.includes(keyword));
237
+ if (loose.length === 1) {
238
+ const only = loose[0];
239
+ return { id: only.id, name: only.name, status: only.status, statusText: only.statusText };
240
+ }
241
+ if (loose.length > 1)
242
+ return null;
243
+ }
244
+ // 纯 id 且台账里没有(刚建/缓存旧)→ 保留 id 继续走,但标记 unknown 让调用方别当“已确认空闲”
231
245
  if (ref.id)
232
246
  return { id: ref.id, name: ref.name ?? '', status: 'unknown' };
233
247
  return null;
@@ -1175,13 +1189,15 @@ const ebMeetingCreateFlowPrepare = {
1175
1189
  description: '结束时间(yyyy-MM-dd HH:mm);不传则按 durationMinutes 从开始时间推算(默认 60 分钟)',
1176
1190
  },
1177
1191
  mt_desc: { type: 'string', description: '会议内容/说明' },
1192
+ equipments: { type: 'string', description: '设备要求关键词(投影/视频/白板等):参与会议室推荐筛选;用户没说就不传' },
1178
1193
  agenda: { type: 'string', description: '邀请函议程(AI 按会议名称+内容分析后生成):每行「议程安排|议程内容|议程时间」,换行分隔;不传则用会议议题或模板示例行' },
1179
1194
  address: { type: 'string', description: '会议室(名称或 id);也可直接写楼层("一楼/1F/3层"),CLI 会按楼层给候选' },
1180
1195
  floor: { type: 'number', description: '楼层(1=一楼):和 address 二选一,按名称推断楼层过滤候选(120会议室=1楼、1007=10楼)' },
1181
1196
  askRoom: { type: 'boolean', description: '默认 false:不指定地点时 CLI 直接按推荐算法定一间;传 true 才返回候选让用户挑' },
1182
1197
  customize_address: { type: 'string', description: '自定义会议地点' },
1183
1198
  hrm_members: { type: 'string', description: '参会人员(逗号分隔员工 id 或姓名,按流程表单要求)' },
1184
- total_member: { type: 'number', description: '参会人数' },
1199
+ total_member: { type: 'number', description: '参会人数(用户直接说总数时才传)' },
1200
+ our_member_count: { type: 'number', description: '我方声明人数(用户说"我们也 3 个人"但没给姓名时传 3):CLI 会与 crm_member_count 相加作为参会人数' },
1185
1201
  crm_members: {
1186
1202
  oneOf: [{ type: 'string' }, { type: 'array', items: { oneOf: [{ type: 'string' }, { type: 'object' }] } }],
1187
1203
  description: '参会客户:**必须带客户名称**,写法 `[{id,name}]` 或「客户名(客户id)」或逗号分隔的这两种。'
@@ -1544,8 +1560,22 @@ const ebMeetingCreateFlowPrepare = {
1544
1560
  const declaredTotal = Number(args.total_member) > 0 ? Number(args.total_member) : null;
1545
1561
  const callerToken = String(args.caller ?? '').trim();
1546
1562
  const callerInMembers = callerToken !== '' && (rawMembers.includes(callerToken) || memberIds.includes(callerToken));
1547
- const roomMemberCount = declaredTotal
1548
- ?? (memberIds.length > 0 ? memberIds.length + (callerInMembers ? 0 : 1) : undefined);
1563
+ // 我方人数(含召集人);客户人数取「应到客户数」(用户说"他们来 3 个人" → 传 crm_member_count:3)
1564
+ const declaredOurCount = Number(args.our_member_count) > 0
1565
+ ? Number(args.our_member_count)
1566
+ : 0;
1567
+ const ourSideCount = declaredOurCount > 0
1568
+ ? declaredOurCount
1569
+ : (memberIds.length > 0 ? memberIds.length + (callerInMembers ? 0 : 1) : 0);
1570
+ const clientSideCount = Number(args.crm_member_count) > 0 ? Number(args.crm_member_count) : 0;
1571
+ // ⛔ 2026-11-09 用户反馈:说了"他们 3 个、我们 3 个",表单「参会人数」却是空的。
1572
+ // 规则:没显式传 total_member 时 = 我方人数 + 客户人数,自动补进表单与容量判断。
1573
+ const autoTotalMember = declaredTotal
1574
+ ?? (ourSideCount + clientSideCount > 0 ? ourSideCount + clientSideCount : null);
1575
+ if (autoTotalMember !== null && !(Number(args.total_member) > 0)) {
1576
+ args.total_member = autoTotalMember;
1577
+ }
1578
+ const roomMemberCount = autoTotalMember ?? undefined;
1549
1579
  // 有没有客户:决定要不要优先推接待类会议室(crm_members 可能是数组、"id,id" 或名称)
1550
1580
  // 2026-11-04 补:用户只在话里说了「接待某某客户」、没传 crm_members 时,也要识别出来 ——
1551
1581
  // 否则"带客户优先接待类"这条规则永远不生效(用户实测推荐了 3 间普通会议室)。
@@ -1582,6 +1612,10 @@ const ebMeetingCreateFlowPrepare = {
1582
1612
  ...(hasCustomer ? { hasCustomer: true } : {}),
1583
1613
  // 「一楼」这类楼层诉求:按楼层过滤候选(2026-11-06)
1584
1614
  ...(floorHint !== null ? { floor: Number(floorHint) } : {}),
1615
+ // ⛔ 设备诉求必须放在 requirement 里(顶层会被忽略,2026-11-09 踩到:传了投影仍推出没投影的房)
1616
+ ...(String(args.equipments ?? '').trim()
1617
+ ? { requirement: { equipmentsKeyword: String(args.equipments).trim() } }
1618
+ : {}),
1585
1619
  // 2026-11-03 用户批准松绑:不再每次强制重拉台账(省 ~1s + 2 请求)。
1586
1620
  // 兜底在 recommendRooms 内部:24h 缓存凑不出候选时自动强制重拉一次再算;
1587
1621
  // 代价是刚导入的会议室在缓存期可能按名称查不到(按 id 指定不受影响)。
@@ -1759,8 +1793,14 @@ const ebMeetingCreateFlowPrepare = {
1759
1793
  selectionType: 'room',
1760
1794
  ui: { component: 'choice', multiple: false, recommendedKey: 'R1' },
1761
1795
  message: floorHint !== null
1762
- ? `「${addressId}」是楼层,不是房间名;下面是 ${floorHint} 楼在该时段空闲的会议室,请选一间`
1763
- + (roomOptions.length > 0 ? '' : '(该楼层暂时没有空闲会议室,请改楼层或时间)')
1796
+ ? `「${addressId}」是楼层,不是房间名;`
1797
+ + (roomOptions.length > 0
1798
+ ? `下面是 ${floorHint} 楼在该时段空闲的会议室,请选一间`
1799
+ : `该楼层没有符合条件的会议室`
1800
+ + (String(args.equipments ?? '').trim()
1801
+ ? `(设备要求:${String(args.equipments)};该层台账未标注此设备)`
1802
+ : '')
1803
+ + ',请改楼层 / 去掉设备要求 / 改时间')
1764
1804
  : `没找到名为「${addressId}」的会议室(会议室台账里没有这个名字),本次**没有提交**。`
1765
1805
  + (roomOptions.length > 0
1766
1806
  ? `请从下面 ${roomOptions.length} 个在该时段空闲的会议室里选一间,或核对一下会议室名称`
@@ -2178,7 +2218,12 @@ const ebMeetingCreateFlowPrepare = {
2178
2218
  */
2179
2219
  let invitationDocInfo = null;
2180
2220
  const inviteDocWarnings = [];
2181
- if (args.invitation_doc !== false) {
2221
+ // ⛔ 2026-11-09 用户明确:**没有客户就不生成邀请函**(对话里不贴、文档也不建)。
2222
+ const hasLinkedCustomer = (Array.isArray(args.crm_members)
2223
+ ? args.crm_members.length > 0
2224
+ : String(args.crm_members ?? '').trim() !== '')
2225
+ || Number(args.crm_member_count) > 0;
2226
+ if (args.invitation_doc !== false && hasLinkedCustomer) {
2182
2227
  const inviteField = form.fields.find((field) => String(field?.name ?? '') === '邀请函');
2183
2228
  if (inviteField) {
2184
2229
  const existing = main[String(inviteField.id)];
@@ -2474,6 +2519,8 @@ const ebMeetingCreateFlowPrepare = {
2474
2519
  })(),
2475
2520
  } } : {}),
2476
2521
  },
2522
+ // 没有客户时不生成邀请函(apply 里的两处生成点都看这个标记)
2523
+ hasCustomer: hasLinkedCustomer,
2477
2524
  fingerprint: JSON.stringify({ workflowId, main, ...(detailPayload ? { details: detailPayload } : {}) }),
2478
2525
  }, CONTINUATION_TTL_MS);
2479
2526
  // 记住本轮已确认的要素(30 分钟内同一场会再调 prepare 时,缺字段就沿用,避免重复追问)
@@ -2527,6 +2574,7 @@ const ebMeetingCreateFlowPrepare = {
2527
2574
  ...(Object.keys(decisions).length > 0 ? { decisions } : {}),
2528
2575
  },
2529
2576
  continuation,
2577
+ continuationId: await saveContinuationAlias(continuation, CONTINUATION_TTL_MS).catch(() => null),
2530
2578
  expiresInSeconds: CONTINUATION_TTL_SECONDS,
2531
2579
  }, warnings.length > 0 ? { warnings } : {});
2532
2580
  },
@@ -2658,7 +2706,8 @@ const ebMeetingCreateFlowApply = {
2658
2706
  risk: 'high-risk-write',
2659
2707
  requiresConfirmation: true,
2660
2708
  inputSchema: schemaOf({
2661
- continuation: { type: 'string', description: 'prepare 返回的确认票据(必填)' },
2709
+ continuation: { type: 'string', description: 'prepare 返回的确认票据;太长时可用 continuationId 代替(二选一)' },
2710
+ continuationId: { type: 'string', description: 'prepare 返回的 8 位短句柄:不想复制长 token 时传这个' },
2662
2711
  confirm: { type: 'boolean', description: '必须显式传 true' },
2663
2712
  submit_mode: {
2664
2713
  type: 'string',
@@ -2668,12 +2717,17 @@ const ebMeetingCreateFlowApply = {
2668
2717
  + '只有用户明确说"不用我确认,直接建"时才传 direct',
2669
2718
  },
2670
2719
  waitSeconds: { type: 'number', description: '提交后等待会议生成的最长秒数(默认 60,0 = 不等待)' },
2671
- }, { required: ['continuation', 'confirm'] }),
2720
+ }, { required: ['confirm'] }),
2672
2721
  handler: async (args, env) => {
2673
2722
  if (args.confirm !== true) {
2674
2723
  throw meetingValidationError('confirmation_required', '流程建会属于高影响写操作,必须显式传 confirm=true');
2675
2724
  }
2676
- const lease = await env.continuation.verify(String(args.continuation ?? ''), 'meeting.eb.meeting.create.flow.apply');
2725
+ // 模型常把长 token 截断 → 允许只传短句柄 continuationId
2726
+ let continuationToken = String(args.continuation ?? '').trim();
2727
+ if (!continuationToken && String(args.continuationId ?? '').trim()) {
2728
+ continuationToken = String(await resolveContinuationAlias(String(args.continuationId)) ?? '');
2729
+ }
2730
+ const lease = await env.continuation.verify(continuationToken, 'meeting.eb.meeting.create.flow.apply');
2677
2731
  const session = await env.host.getSession();
2678
2732
  if (lease.baseUrl !== session.baseUrl || lease.userId !== session.userId) {
2679
2733
  throw meetingValidationError('context_mismatch', '确认上下文已变化(租户或登录账号不同),请重新执行 prepare');
@@ -2729,7 +2783,9 @@ const ebMeetingCreateFlowApply = {
2729
2783
  // 所以这里永远拿不到 requestId / 会议 id —— 这不是失败,但也**不是"流程已提交"**,
2730
2784
  // 不能报错把整轮卡死(用户要的表单就在 finalMarkdown 里)。
2731
2785
  // ⛔ 邀请函必须照给:它是预置函,按申请单已知信息生成,不依赖会议是否已生成。
2732
- const pre = await renderPreInvitation(payload, env);
2786
+ const pre = payload?.hasCustomer === true
2787
+ ? await renderPreInvitation(payload, env)
2788
+ : { invitation: { skipped: true, reason: 'no_customer' }, ms: 0 };
2733
2789
  // 建群:这一档服务端没有单据、也没有会议 id,只能先把群建出来(回写等会议生成后再补)。
2734
2790
  // 用户口径是「发起流程时就同步建群」,表单都递到手上了,群该先建好。
2735
2791
  let groupChat;
@@ -2959,7 +3015,9 @@ const ebMeetingCreateFlowApply = {
2959
3015
  // ⛔ 不等于"没有邀请函"。邀请函本质是**预置函**(项目人员下载后自己改、自己发,
2960
3016
  // 2026-10-30 用户明确要求),所以会议还在审批、尚未生成时,也要用申请单已知信息
2961
3017
  // 先出一份,取不到的字段渲染成【待补充】。这样调用方/用户提交完立刻就能拿到文件。
2962
- const pre = await renderPreInvitation(payload, env);
3018
+ const pre = payload?.hasCustomer === true
3019
+ ? await renderPreInvitation(payload, env)
3020
+ : { invitation: { skipped: true, reason: 'no_customer' }, ms: 0 };
2963
3021
  invitation = pre.invitation;
2964
3022
  timings.invitationMs = pre.ms;
2965
3023
  warnings.push(`流程已提交(requestId=${requestId || '未返回'}),但 ${waitSeconds}s 内没在会议表里查到「${payload.mtName}」——`
@@ -3033,6 +3091,7 @@ const ebMeetingCreateFlowQuick = {
3033
3091
  description: '结束时间(yyyy-MM-dd HH:mm);不传则按 durationMinutes 从开始时间推算(默认 60 分钟)',
3034
3092
  },
3035
3093
  mt_desc: { type: 'string', description: '会议内容/说明' },
3094
+ equipments: { type: 'string', description: '设备要求关键词(投影/视频/白板等):参与会议室推荐筛选;用户没说就不传' },
3036
3095
  address: { type: 'string', description: '会议室(id 或名称;不传则返回候选让用户选,不会自动决定)' },
3037
3096
  customize_address: { type: 'string', description: '自定义会议地点' },
3038
3097
  hrm_members: { type: 'string', description: '参会人员 id,逗号分隔' },
@@ -512,9 +512,11 @@ function buildReadOperation(endpoint) {
512
512
  + `需要全量请翻页(pageNo=${pageNo + 1} 起)或加大 pageSize,或收窄筛选条件`);
513
513
  }
514
514
  if (fallback) {
515
- pageWarnings.push(`服务端只支持「精确匹配」,按 ${filterKeys.join('/')} 过滤后 0 条;`
516
- + `已翻页扫描全量 ${fallback.scanned} 条(${fallback.pages} 页)在客户端按「包含」重新筛选,命中 ${rows.length} 条。`
517
- + `传 noFallback:true 可跳过这次扫描`);
515
+ // ⛔ 2026-11-09:旧文案以「0 条」开头,模型扫一眼就判“没查到”(实际命中了)。
516
+ // 现在结果先行,把命中数放最前面。
517
+ pageWarnings.push(rows.length > 0
518
+ ? `已命中 ${rows.length} 条(服务端精确匹配 0 条,CLI 自动翻页扫描 ${fallback.scanned} 条 / ${fallback.pages} 页后按「包含」筛出)`
519
+ : `未命中:服务端精确匹配 0 条,且翻页扫描 ${fallback.scanned} 条(${fallback.pages} 页)后按「包含」也没找到 —— 这个名称可能确实不存在`);
518
520
  }
519
521
  return meetingSuccess(endpoint.operation, {
520
522
  total: effectiveTotal,
@@ -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];
@@ -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,
@@ -47,6 +47,17 @@ export const CUSTOMER_NEED_OPTIONS = [
47
47
  '交流具体项目合作与实施细节',
48
48
  '暂未确定,先进待办',
49
49
  ];
50
+ /**
51
+ * 第 3 问:是否安排会议。
52
+ *
53
+ * 必问项——只有原话**明确提到会议室/座谈/汇报/指定房间**(`meetingExplicit:true`)才跳过。
54
+ * 「晚上订小餐厅」不算:小餐厅是晚餐场地,与会议室预定是两条独立线索,不得互相推断。
55
+ */
56
+ export const MEETING_TITLE = '是否安排会议(需预留场地)';
57
+ export const MEETING_OPTIONS = [
58
+ { label: '是,安排会议室', value: '是' },
59
+ { label: '否,不需要', value: '否' },
60
+ ];
50
61
  /** 快照文件的 kind 标识,用于拒收无关 JSON。 */
51
62
  export const SNAPSHOT_KIND = 'reception-fields-snapshot';
52
63
  /** python 探测结果的缓存时长(7 天)。 */
@@ -2,6 +2,7 @@ import { getE10Session } from '../../internal/e10/context.js';
2
2
  import { E10ApiError, createE10RequestRuntime, } from '../../internal/e10/request-runtime.js';
3
3
  import { receptionBusinessError, receptionEnvironmentError } from './errors.js';
4
4
  import { UploadProtocolError, uploadToFileService } from './upload.js';
5
+ import { fetchRestaurantRooms as fetchRooms } from './operations/restaurant-rooms.js';
5
6
  /** 单次上传的总时限。分片上传是多轮请求,留足 3 分钟。 */
6
7
  const UPLOAD_TIMEOUT_MS = 180_000;
7
8
  export function createReceptionHost(ctx) {
@@ -100,6 +101,18 @@ export function createReceptionHost(ctx) {
100
101
  contentType: error.contentType,
101
102
  detail: error.detail,
102
103
  hint: `链路 teamsCheck → preUploadCheck → module/upload,module=${module}`,
104
+ failedAt: error.failedAt,
105
+ // 请求侧只暴露「带了哪些头、凭据在不在」,值一律不打印
106
+ request: {
107
+ method: error.request?.method || 'POST',
108
+ path: error.request?.path || '',
109
+ headers: ['eteamsid', 'cookie', 'langtype', 'referer'],
110
+ auth: {
111
+ eteamsid: info.userId ? 'sent' : 'missing',
112
+ cookie: info.userId ? 'sent' : 'missing',
113
+ userid: info.userId ? String(info.userId) : 'missing',
114
+ },
115
+ },
103
116
  };
104
117
  }
105
118
  if (error instanceof E10ApiError) {
@@ -113,7 +126,26 @@ export function createReceptionHost(ctx) {
113
126
  };
114
127
  }
115
128
  }
116
- return { getSession, requireRuntime, uploadFile };
129
+ /**
130
+ * 查「小食堂包厢」。
131
+ * eteamsId / tenantKey 只在这里取用并塞进请求体,不返回给调用方。
132
+ */
133
+ async function fetchRestaurantRooms(options = {}) {
134
+ const { e10 } = await resolve();
135
+ if (!e10) {
136
+ throw receptionEnvironmentError('NO_SESSION', '未取得 E10 会话,无法查询小食堂包厢');
137
+ }
138
+ const runtime = createE10RequestRuntime(ctx, e10);
139
+ return fetchRooms(runtime, {
140
+ ...options,
141
+ context: {
142
+ eteamsId: e10.eteamsId,
143
+ userId: e10.userId,
144
+ tenantKey: e10.tenantKey,
145
+ },
146
+ });
147
+ }
148
+ return { getSession, requireRuntime, uploadFile, fetchRestaurantRooms };
117
149
  }
118
150
  /** 未登录时不该静默继续的场景,统一用它取 baseUrl 并给出可读错误。 */
119
151
  export async function requireBaseUrl(host) {