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
@@ -22,7 +22,7 @@
22
22
  import { randomUUID } from 'node:crypto';
23
23
  import { rsSuccess, schemaOf } from './types.js';
24
24
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
25
- import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, findMenuNode, resolveCurrentUser, buildCardUrl, buildListUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
25
+ import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, getDsOptionsFull, findMenuNode, resolveCurrentUser, buildCardUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, talentUiCardUrl, resolveInterviewListUrlOrNative, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
26
26
  // 面试计划表单字段 dataKey(缓存 fields 里取)。
27
27
  // 注意:digital_id 不放入此列表——它只在「面试方式含 AI」时才是必填,
28
28
  // 放进来会让未部署数字人的环境连非 AI 面试都建不了(单独按需校验)。
@@ -266,9 +266,14 @@ async function buildPlan(opts) {
266
266
  getDsOptions(host, objId, fid('interview_type')),
267
267
  getDsOptions(host, objId, fid('interview_session')),
268
268
  ]);
269
- const typeId = typeMap[type];
270
- if (!typeId)
271
- throw rsFail('面试方式「' + type + '」不在枚举中(' + Object.keys(typeMap).join('/') + ')');
269
+ const typeFull = await getDsOptionsFull(host, objId, fid('interview_type'));
270
+ const typeId = typeFull.map[type];
271
+ if (!typeId) {
272
+ if (typeFull.disabled.some(function (d) { return d.name === type; })) {
273
+ throw rsFail('面试方式「' + type + '」已禁用(该枚举项 archive=1),请改用其它面试方式');
274
+ }
275
+ throw rsFail('面试方式「' + type + '」不在枚举中(' + Object.keys(typeFull.map).join('/') + ')');
276
+ }
272
277
  const sessionId = sessionMap[session];
273
278
  if (!sessionId)
274
279
  throw rsFail('面试轮次「' + session + '」不在枚举中(' + Object.keys(sessionMap).join('/') + ')');
@@ -507,8 +512,14 @@ async function resolveRequiredHint(plan, ctx) {
507
512
  dataDetails: plan.dataDetails,
508
513
  });
509
514
  }
510
- // 人才卡片详情 URL(EB 详情页):{baseUrl}/sp/ebdpage/view/{ebdDetailPageId}?talentId={id}
511
- function resolveTalentCardUrl(ctx, talentId) {
515
+ // 人才卡片详情 URL:装了人才库 ecode 页面就用新卡片页,否则回退 EB 详情页
516
+ // {baseUrl}/sp/ebdpage/view/{ebdDetailPageId}?talentId={id}(2026-11-10 用户要求改指向新页面)
517
+ async function resolveTalentCardUrl(ctx, talentId) {
518
+ if (talentId) {
519
+ const ui = await talentUiCardUrl(ctx.host, ctx.cache, ctx.baseUrl, String(talentId));
520
+ if (ui)
521
+ return ui;
522
+ }
512
523
  const pid = ctx.cache.ebdDetailPageId;
513
524
  if (!pid || !talentId) {
514
525
  // 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
@@ -753,7 +764,8 @@ async function applyCore(args, env, payload) {
753
764
  const verifyWarnings = verification.mismatches.map((m) => '落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual + '(该字段可能未写入)');
754
765
  const detailUrl = buildCardUrl(ctx.baseUrl, plan.objId, formDataId);
755
766
  // 列表链接只打开列表;详情单页由 viewLink 单独给出,不再用「列表+滑出详情」组合地址。
756
- const listLocateUrl = buildListUrl(ctx.baseUrl, (ctx.cache.lists?.interview?.listId) || '');
767
+ // 2026-11-10 用户定稿:装了人才库 ecode 页面就指向新的「面试进展」页,否则回退原生面试台账列表。
768
+ const listLocateUrl = await resolveInterviewListUrlOrNative(ctx.host, ctx.cache, ctx.baseUrl, (ctx.cache.lists?.interview?.listId) || '');
757
769
  return rsSuccess('ehr.recruit.stage.interview.arrange.apply', {
758
770
  mode: 'apply', result: verification.mismatches.length ? 'partial' : 'success', interviewFormId: formDataId,
759
771
  interviewCardUrl: detailUrl,
@@ -786,11 +798,15 @@ async function prefill(args, env) {
786
798
  const typeFid = fields.interview_type;
787
799
  if (!typeFid)
788
800
  throw rsFail('面试计划缺少字段 interview_type(ds/fields 解析不到)');
789
- const typeMap = await getDsOptions(ctx.host, objId, typeFid);
790
- const typeId = typeMap[typeKey];
791
- if (!typeId)
792
- throw rsFail('面试方式「' + typeKey + '」不在枚举中(' + Object.keys(typeMap).join('/') + ')');
793
- const cardUrl = resolveTalentCardUrl(ctx, talentId);
801
+ const typeFull = await getDsOptionsFull(ctx.host, objId, typeFid);
802
+ const typeId = typeFull.map[typeKey];
803
+ if (!typeId) {
804
+ if (typeFull.disabled.some(function (d) { return d.name === typeKey; })) {
805
+ throw rsFail('面试方式「' + typeKey + '」已禁用(该枚举项 archive=1),请改用其它面试方式');
806
+ }
807
+ throw rsFail('面试方式「' + typeKey + '」不在枚举中(' + Object.keys(typeFull.map).join('/') + ')');
808
+ }
809
+ const cardUrl = await resolveTalentCardUrl(ctx, talentId);
794
810
  const listUrl = await resolveInterviewListUrl(ctx).catch(() => null);
795
811
  const jsExpr = `(() => { const W = window.WeFormSDK; const i = W && W.getWeFormInstance('ebuilderform', '${formId}');`
796
812
  + ` if (!i) return 'no-form-instance(请先在人才卡片点「安排面试」打开面试安排表单)';`
@@ -22,7 +22,7 @@ import path from 'node:path';
22
22
  import schoolTiers from '../school-tiers.json';
23
23
  import { rsSuccess, schemaOf } from './types.js';
24
24
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
25
- import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
25
+ import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
26
26
  import { scanResumeSource, findStructuredJson } from '../fs-scan.js';
27
27
  import { saveBatchItems, loadBatchItems } from '../batch-store.js';
28
28
  // 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
@@ -338,8 +338,13 @@ function makeBriefReader(ctx, formId, objId, fields) {
338
338
  }
339
339
  };
340
340
  }
341
- // 人才卡片 URL(环境缓存 ebdDetailPageId;自用系统追加 recruitType=useSelf)
342
- function resolveTalentCardUrl(ctx, talentId) {
341
+ // 人才卡片 URL(装了人才库 ecode 页面就指向新卡片页;否则环境缓存 ebdDetailPageId,自用追加 recruitType=useSelf)
342
+ async function resolveTalentCardUrl(ctx, talentId) {
343
+ if (talentId) {
344
+ const ui = await talentUiCardUrl(ctx.host, ctx.cache, ctx.baseUrl, String(talentId));
345
+ if (ui)
346
+ return ui;
347
+ }
343
348
  const pid = ctx.cache.ebdDetailPageId;
344
349
  if (!pid || !talentId) {
345
350
  // 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
@@ -350,12 +355,15 @@ function resolveTalentCardUrl(ctx, talentId) {
350
355
  }
351
356
  return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
352
357
  }
353
- // 人才库列表(只打开列表):{baseUrl}/sp/ebdfpage/list/{listId}
358
+ // 人才库列表(只打开列表):装了人才库 ecode 页面就指向新页面,否则 {baseUrl}/sp/ebdfpage/list/{listId}
354
359
  // 2026-11-06 用户定稿:列表链接不携带 /card/... 段,也不拼 talentId 等 query,
355
360
  // 避免打开列表时一同滑出人才详情单页;人才卡片由 talentCardUrl 单独给出。
356
361
  // listId 取环境缓存 lists.talent.listId(运行时解析,跨环境不写死)。
357
- function resolveTalentListLocateUrl(ctx, _talentId) {
362
+ async function resolveTalentListLocateUrl(ctx, _talentId) {
358
363
  const listId = ctx.cache.lists?.talent?.listId;
364
+ const preferred = await resolveTalentListUrl(ctx.host, ctx.cache, ctx.baseUrl, listId || '');
365
+ if (preferred)
366
+ return preferred;
359
367
  if (!listId)
360
368
  return null;
361
369
  return `${ctx.baseUrl.replace(/\/+$/, '')}/sp/ebdfpage/list/${listId}`;
@@ -955,8 +963,8 @@ async function findExistingTalents(ctx, opts) {
955
963
  talentId: b.talentId,
956
964
  candidateId: b.candidateId,
957
965
  talentViewUrl: b.candidateId ? buildTalentViewUrl(ctx.baseUrl, b.candidateId) : null,
958
- talentCardUrl: b.talentId ? resolveTalentCardUrl(ctx, b.talentId) : null,
959
- talentListLocateUrl: b.talentId ? resolveTalentListLocateUrl(ctx, b.talentId) : null,
966
+ talentCardUrl: b.talentId ? await resolveTalentCardUrl(ctx, b.talentId) : null,
967
+ talentListLocateUrl: b.talentId ? await resolveTalentListLocateUrl(ctx, b.talentId) : null,
960
968
  };
961
969
  }
962
970
  }
@@ -976,8 +984,8 @@ async function findExistingTalents(ctx, opts) {
976
984
  if (rec) {
977
985
  formConflicts.existing.push({
978
986
  talentId: id, ...rec,
979
- talentCardUrl: resolveTalentCardUrl(ctx, id),
980
- talentListLocateUrl: resolveTalentListLocateUrl(ctx, id),
987
+ talentCardUrl: await resolveTalentCardUrl(ctx, id),
988
+ talentListLocateUrl: await resolveTalentListLocateUrl(ctx, id),
981
989
  recordCardUrl: buildCardUrl(ctx.baseUrl, objId, id),
982
990
  });
983
991
  }
@@ -1271,8 +1279,8 @@ async function applyCore(args, env, payload) {
1271
1279
  talentId: updateTalentId,
1272
1280
  afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
1273
1281
  verifyWarnings: verifyWarnings.length ? verifyWarnings : undefined,
1274
- talentCardUrl: resolveTalentCardUrl(ctx, updateTalentId),
1275
- talentListLocateUrl: resolveTalentListLocateUrl(ctx, updateTalentId),
1282
+ talentCardUrl: await resolveTalentCardUrl(ctx, updateTalentId),
1283
+ talentListLocateUrl: await resolveTalentListLocateUrl(ctx, updateTalentId),
1276
1284
  parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || '(空)' },
1277
1285
  });
1278
1286
  }
@@ -1375,8 +1383,8 @@ async function applyCore(args, env, payload) {
1375
1383
  writeWarnings.push('落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual);
1376
1384
  }
1377
1385
  const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
1378
- const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
1379
- const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
1386
+ const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
1387
+ const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
1380
1388
  return rsSuccess('ehr.recruit.stage.resume.import.apply', {
1381
1389
  mode: 'apply', result,
1382
1390
  detailsState,
@@ -421,6 +421,12 @@ function ambiguousPerson(keyword, rows) {
421
421
  * prepare 可通过 dsOptionsSnapshot() 把结果放进 continuation,apply 用 restoreDsOptions() 复用,避免重复请求。
422
422
  */
423
423
  const dsOptionsMemo = new Map();
424
+ /**
425
+ * getDsOptionsFull 独立 memo:它返回 {map, disabled},结构与 dsOptionsMemo 的 Record 不同。
426
+ * 混用会让 dsOptionsSnapshot() 把 full 结构写进 continuation,apply 复用时报类型错误,
427
+ * 所以两者分开缓存;full 的结果不进快照,apply 时按需回源。
428
+ */
429
+ const dsOptionsFullMemo = new Map();
424
430
  export function restoreDsOptions(snapshot) {
425
431
  for (const [key, value] of Object.entries(snapshot || {})) {
426
432
  if (value && typeof value === 'object' && Object.keys(value).length) {
@@ -508,6 +514,7 @@ export async function verifySubmitted(opts) {
508
514
  /** 回查/校验失败时清空进程内枚举 memo,并标记磁盘环境缓存失效(下次自动重建)。 */
509
515
  export function invalidateEnvCache(baseUrl, appId) {
510
516
  dsOptionsMemo.clear();
517
+ dsOptionsFullMemo.clear();
511
518
  if (!baseUrl || !appId)
512
519
  return;
513
520
  try {
@@ -518,9 +525,10 @@ export function invalidateEnvCache(baseUrl, appId) {
518
525
  }
519
526
  catch { /* 缓存文件不存在/只读盘:不影响主流程 */ }
520
527
  }
521
- export async function getDsOptions(host, objId, fieldId, groupId = '') {
522
- const key = objId + ':' + fieldId;
523
- const hit = dsOptionsMemo.get(key);
528
+ /** 全量版:map 排除 archive=1 的禁用项,disabled 单独列出供「已禁用」精确报错。 */
529
+ export async function getDsOptionsFull(host, objId, fieldId, groupId = '') {
530
+ const key = objId + ':' + fieldId + (groupId ? ':' + groupId : '') + ':full';
531
+ const hit = dsOptionsFullMemo.get(key);
524
532
  if (hit)
525
533
  return hit;
526
534
  const task = (async () => {
@@ -531,14 +539,31 @@ export async function getDsOptions(host, objId, fieldId, groupId = '') {
531
539
  });
532
540
  const list = r?.data || [];
533
541
  const map = {};
534
- for (const x of list)
535
- if (x?.name && x?.id)
542
+ const disabled = [];
543
+ for (const x of list) {
544
+ if (!x?.name || !x?.id)
545
+ continue;
546
+ if (String(x.archive) === '1')
547
+ disabled.push({ name: String(x.name), id: String(x.id) });
548
+ else
536
549
  map[String(x.name)] = String(x.id);
550
+ }
537
551
  // 空结果不缓存:字典引用类字段可能临时返回空,下次应能重新回源
538
- if (!Object.keys(map).length)
539
- dsOptionsMemo.delete(key);
540
- return map;
552
+ if (!Object.keys(map).length && !disabled.length)
553
+ dsOptionsFullMemo.delete(key);
554
+ return { map, disabled };
541
555
  })();
556
+ dsOptionsFullMemo.set(key, task);
557
+ task.catch(() => { dsOptionsFullMemo.delete(key); });
558
+ return task;
559
+ }
560
+ export async function getDsOptions(host, objId, fieldId, groupId = '') {
561
+ // key 沿用旧口径(不含 groupId),保证 dsOptionsSnapshot() 的键与 apply 复用一致
562
+ const key = objId + ':' + fieldId;
563
+ const hit = dsOptionsMemo.get(key);
564
+ if (hit)
565
+ return hit;
566
+ const task = getDsOptionsFull(host, objId, fieldId, groupId).then((r) => r.map);
542
567
  dsOptionsMemo.set(key, task);
543
568
  task.catch(() => { dsOptionsMemo.delete(key); });
544
569
  return task;
@@ -790,6 +815,63 @@ export function buildCardUrl(baseUrl, objId, dataId) {
790
815
  return null;
791
816
  return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/card/0/' + objId + '/' + dataId;
792
817
  }
818
+ // ── 人才库 ecode 页面(recruit-talent-ui)优先 ────────────────────────────────
819
+ // 2026-11-10 用户定稿:「安排面试后返回的列表链接可以改;返回的人才卡片和人才列表也改,
820
+ // 改为新做的页面地址」。新页面是 ecode 独立页面(101 已发布,路由见该工程 entry.js)。
821
+ //
822
+ // 🔴 但不能硬用:自用等环境装不了这套 ecode(应用锁定),必须回退原生页。所以先探测再选。
823
+ // 探测判据(101 实测):/api/ecode/project/searchAll 的项目里有 projectName 以 recruit-talent-ui 开头。
824
+ // ❌ 不能拿页面 URL 的 HTTP 状态判:实测不存在的 /sp/custom/ecode/__no_such_app_xyz__ 也返回
825
+ // 200 + 完全相同的壳(3189 字节),会假绿。
826
+ export const TALENT_UI_ROUTE = '/sp/custom/ecode/recruit-talent';
827
+ /** 探测当前环境是否装了人才库 ecode 页面;结果缓存进 cache.talentUi('1'/'0'),一次运行只探一次。 */
828
+ export async function detectTalentUi(host, cache) {
829
+ const flag = String(cache.talentUi || '');
830
+ if (flag === '1')
831
+ return true;
832
+ if (flag === '0')
833
+ return false;
834
+ let installed = false;
835
+ try {
836
+ const r = await host.request({
837
+ path: '/api/ecode/project/searchAll',
838
+ method: 'GET',
839
+ query: { page: 1, size: 100 },
840
+ operation: 'detect-talent-ui',
841
+ });
842
+ const list = ((r && r.data && r.data.list) || (r && r.list) || []);
843
+ installed = Array.isArray(list)
844
+ && list.some((x) => String((x && x.projectName) || '').startsWith('recruit-talent-ui'));
845
+ }
846
+ catch {
847
+ // 探测失败按「没装」处理:宁可回退到原生页,也不要给出打不开的链接。
848
+ installed = false;
849
+ }
850
+ cache.talentUi = installed ? '1' : '0';
851
+ return installed;
852
+ }
853
+ /** 人才库列表:装了 ecode 页面 → 新页面;否则原生台账列表。 */
854
+ export async function resolveTalentListUrl(host, cache, baseUrl, fallbackListId) {
855
+ if (await detectTalentUi(host, cache)) {
856
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE;
857
+ }
858
+ return buildListUrl(baseUrl, fallbackListId);
859
+ }
860
+ /** 面试进展:装了 ecode 页面 → 新面试进展页;否则原生面试台账列表。 */
861
+ export async function resolveInterviewListUrlOrNative(host, cache, baseUrl, fallbackListId) {
862
+ if (await detectTalentUi(host, cache)) {
863
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/interview';
864
+ }
865
+ return buildListUrl(baseUrl, fallbackListId);
866
+ }
867
+ /** 人才卡片:装了 ecode 页面 → /card?talentId=;返回 null 表示该环境用原生页(调用方走原逻辑)。 */
868
+ export async function talentUiCardUrl(host, cache, baseUrl, talentId) {
869
+ if (!talentId)
870
+ return null;
871
+ if (!(await detectTalentUi(host, cache)))
872
+ return null;
873
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/card?talentId=' + encodeURIComponent(String(talentId));
874
+ }
793
875
  /**
794
876
  * 「只打开列表」URL:{base}/sp/ebdfpage/list/{listId}(2026-11-06 用户定稿)。
795
877
  *
@@ -102,6 +102,126 @@ function boolOption(value) {
102
102
  return undefined;
103
103
  return value === true || value === 'true' || value === '1';
104
104
  }
105
+ const BATCH_MAX_ITEMS = 1000;
106
+ /**
107
+ * 在 item.input 里解析 `$prev.<path>` 引用:字符串值整体形如 "$prev.a.b" 时,
108
+ * 从上一个成功 item 的结果 data 里按点路径取值(典型用法:prepare 的 continuation
109
+ * 传给下一步 apply,同一进程内串行链式执行)。上一个 item 失败或路径取不到值则报错。
110
+ */
111
+ function resolvePrevRefs(input, prevData) {
112
+ const resolved = {};
113
+ for (const [key, value] of Object.entries(input)) {
114
+ if (typeof value === 'string' && value.startsWith('$prev.')) {
115
+ if (!prevData) {
116
+ throw imValidationError('prev_unavailable', `${key}:$prev 引用不可用(上一项失败或不存在)`);
117
+ }
118
+ let cursor = prevData;
119
+ for (const seg of value.slice(6).split('.')) {
120
+ if (cursor && typeof cursor === 'object' && seg in cursor) {
121
+ cursor = cursor[seg];
122
+ }
123
+ else {
124
+ throw imValidationError('prev_ref_missing', `${key}:$prev 路径 "${value.slice(6)}" 在上一项结果中不存在`);
125
+ }
126
+ }
127
+ resolved[key] = cursor;
128
+ }
129
+ else {
130
+ resolved[key] = value;
131
+ }
132
+ }
133
+ return resolved;
134
+ }
135
+ /**
136
+ * `im run-batch`:单进程内**严格串行**执行多个 operation(禁止并发),
137
+ * 等当前项出结果(成功/失败)才执行下一项;每项独立 envelope,最后输出一个聚合 envelope。
138
+ * 目的:把「N 个 operation = N 次 CLI 冷启动」压成 1 次进程启动,批量场景耗时大幅下降。
139
+ * item.input 字符串值支持 "$prev.xxx" 引用上一项结果(prepare→apply 链式场景)。
140
+ */
141
+ async function executeBatchAndPrint(ctx, input, stopOnFailure) {
142
+ const rawItems = input.items;
143
+ if (!Array.isArray(rawItems) || rawItems.length === 0) {
144
+ throw imValidationError('batch_items_required', 'batch 输入必须包含非空 items 数组');
145
+ }
146
+ if (rawItems.length > BATCH_MAX_ITEMS) {
147
+ throw imValidationError('batch_items_too_many', `items 超过上限 ${BATCH_MAX_ITEMS}`);
148
+ }
149
+ const items = [];
150
+ rawItems.forEach((raw, i) => {
151
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw) || typeof raw.operation !== 'string') {
152
+ throw imValidationError('batch_item_invalid', `items[${i}] 必须是含 operation 字符串字段的对象`);
153
+ }
154
+ const item = raw;
155
+ items.push({
156
+ operation: String(item.operation),
157
+ input: (item.input && typeof item.input === 'object' && !Array.isArray(item.input))
158
+ ? { ...item.input }
159
+ : {},
160
+ });
161
+ });
162
+ const results = [];
163
+ let prevData = null;
164
+ let prevFailed = false;
165
+ let okCount = 0;
166
+ let failCount = 0;
167
+ const started = Date.now();
168
+ for (let i = 0; i < items.length; i++) {
169
+ const { operation, input: rawInput } = items[i];
170
+ // 严格串行:上一项未落地(成功/失败)绝不开始下一项;$prev 引用且上一项失败则跳过本项
171
+ let itemError = prevFailed && Object.values(rawInput ?? {}).some((v) => typeof v === 'string' && v.startsWith('$prev.')) ? imValidationError('prev_failed_skipped', '上一项失败,本项依赖 $prev 引用被跳过') : null;
172
+ let envelope;
173
+ if (!itemError) {
174
+ try {
175
+ const merged = resolvePrevRefs(rawInput ?? {}, prevData);
176
+ const result = await executeImOperation(operation, merged, {
177
+ ctx,
178
+ host: createImHost(ctx),
179
+ continuation: createImContinuationSigner(ctx),
180
+ });
181
+ envelope = successEnvelope(operation, result);
182
+ prevData = result.data === undefined ? null : result.data;
183
+ prevFailed = false;
184
+ okCount++;
185
+ }
186
+ catch (error) {
187
+ envelope = failureEnvelope(error);
188
+ prevData = null;
189
+ prevFailed = true;
190
+ failCount++;
191
+ }
192
+ }
193
+ else {
194
+ envelope = failureEnvelope(itemError);
195
+ prevData = null;
196
+ prevFailed = true;
197
+ failCount++;
198
+ }
199
+ results.push({ index: i, operation, ...envelope });
200
+ // 进度走 stderr(不影响 stdout 的单个聚合 JSON)
201
+ process.stderr.write(`[batch ${i + 1}/${items.length}] ${operation} ${envelope.ok ? 'ok' : 'failed'}\n`);
202
+ if (stopOnFailure && !envelope.ok) {
203
+ // 剩余项不再执行,逐项记为 skipped
204
+ for (let j = i + 1; j < items.length; j++) {
205
+ results.push({ index: j, operation: items[j].operation, ok: false, error: { type: 'batch', subtype: 'skipped_stop_on_failure' } });
206
+ }
207
+ failCount += items.length - 1 - i;
208
+ break;
209
+ }
210
+ }
211
+ const ok = failCount === 0;
212
+ ctx.output.write({
213
+ schemaVersion: 1,
214
+ ok,
215
+ operation: 'im.run-batch',
216
+ data: {
217
+ results,
218
+ summary: { total: items.length, ok: okCount, failed: failCount, elapsedMs: Date.now() - started },
219
+ },
220
+ warnings: [],
221
+ }, { json: true });
222
+ if (!ok)
223
+ process.exitCode = ExitCode.GeneralError;
224
+ }
105
225
  /**
106
226
  * 易秒办(即时通讯)CLI 命令注册。
107
227
  * 所有操作统一走 `run <operation> --input-json '{}'`;便捷命令只覆盖高频只读场景,
@@ -127,6 +247,14 @@ export const imShortcut = {
127
247
  .action(action(async (ctx, operation, options) => {
128
248
  await executeAndPrint(ctx, String(operation), await inputFrom(options));
129
249
  }));
250
+ // ---- 单进程批量执行:一次 CLI 冷启动串行跑完 N 个 operation(严格串行,禁止并发) ----
251
+ withJsonInputOptions(im.command('run-batch')
252
+ .description('Run multiple im operations sequentially in one process (strictly serial, no concurrency)')
253
+ .option('--stop-on-failure', 'skip all remaining items after the first failure'))
254
+ .action(action(async (ctx, options) => {
255
+ const opts = asOptions(options);
256
+ await executeBatchAndPrint(ctx, await inputFrom(opts), boolOption(opts.stopOnFailure) === true);
257
+ }));
130
258
  // ---- 高频便捷命令:会话 ----
131
259
  const session = im.command('session').description('Session commands');
132
260
  withJsonInputOptions(session.command('list')
@@ -160,6 +160,12 @@ const sessionList = {
160
160
  sessionType: type,
161
161
  sessionTypeName: typeName,
162
162
  name,
163
+ // 目标 id:单聊对方 uid/cid、群聊 group_id、系统消息分组 group(直接可用于发消息/查消息,不用再按名字反查)
164
+ ...([1, 6, 9].includes(type) && s?.fuser
165
+ ? { toUid: str(s.fuser.uid), toCid: str(s.fuser.cid) }
166
+ : {}),
167
+ ...([2, 3, 7, 11].includes(type) && s?.group_id ? { groupId: str(s.group_id) } : {}),
168
+ ...([4, 10].includes(type) && s?.group ? { group: str(s.group) } : {}),
163
169
  unread: Number(unread),
164
170
  dontDisturb,
165
171
  unreadLabel: Number(unread) > 0 ? (dontDisturb ? `${unread}(免打扰)` : String(unread)) : '',
@@ -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() {
@@ -369,8 +369,5 @@ export function createInvoiceHost(ctx, dependencies = {}) {
369
369
  invoiceToken = null;
370
370
  void clearCachedInvoiceToken();
371
371
  },
372
- debug(message) {
373
- ctx.logger?.debug?.(message);
374
- },
375
372
  };
376
373
  }
@@ -986,7 +986,6 @@ export const invoiceOperations = [
986
986
  relatedInvoiceId: { type: 'string' },
987
987
  invoiceTotal: { type: 'string' },
988
988
  }, ['relatedInvoiceId', 'invoiceTotal']), { description: '额度用完后没进明细、留在票夹的发票' }),
989
- debugTrace: { type: 'array', description: '排查用:入参、每行金额分摊、请求体、接口返回' },
990
989
  finalMarkdown: { type: 'string', description: '[processTitle](url),直接展示给用户' },
991
990
  result: rawObject,
992
991
  workflow: workflowSchema,
@@ -45,9 +45,6 @@ function normalizeInvoices(value) {
45
45
  }
46
46
  return invoices;
47
47
  }
48
- function formatRemaining(cents) {
49
- return Number.isFinite(cents) ? formatCents(cents) : '不封顶';
50
- }
51
48
  function workflowViewUrl(baseUrl, requestId) {
52
49
  return `${baseUrl.replace(/\/+$/, '')}/sp/workflow/flowpage/view/${requestId}`;
53
50
  }
@@ -60,16 +57,6 @@ function workflowViewUrl(baseUrl, requestId) {
60
57
  export class InvoiceReimSubsidySubmitOperation {
61
58
  name = 'invoice.reim.subsidy.submit';
62
59
  async execute(input, { host }) {
63
- const debugTrace = [];
64
- const debug = (step, detail) => {
65
- debugTrace.push({ step, detail });
66
- const message = `[${this.name}] ${step} ${typeof detail === 'string' ? detail : JSON.stringify(detail)}`;
67
- host.debug?.(message);
68
- // `--json` 时 logger.debug 会被关掉;单测环境不打 stderr,避免刷屏。
69
- if (!process.env.NODE_TEST_CONTEXT)
70
- console.error(message);
71
- };
72
- debugger; // 入口:核对入参
73
60
  const processTitle = asNonEmptyString(input.processTitle, 'processTitle');
74
61
  const reason = asNonEmptyString(input.reason, 'reason');
75
62
  const relatedProcessId = asPositiveString(input.relatedProcessId, 'relatedProcessId');
@@ -77,54 +64,22 @@ export class InvoiceReimSubsidySubmitOperation {
77
64
  const customerId = optionalId(input.customerId, 'customerId') || DEFAULT_CUSTOMER_ID;
78
65
  const projectId = optionalId(input.projectId, 'projectId');
79
66
  const allowanceCents = amountCents(input.monthlyAllowance, 'monthlyAllowance');
80
- debug('1/5 入参', {
81
- processTitle,
82
- reason,
83
- relatedProcessId,
84
- invoices: invoices.map((item) => ({ fid: item.fid, total: formatCents(item.cents) })),
85
- monthlyAllowance: allowanceCents === null ? null : formatCents(allowanceCents),
86
- customerId,
87
- projectId,
88
- });
89
67
  let remainingCents = allowanceCents ?? Number.POSITIVE_INFINITY;
90
68
  const details = [];
91
69
  const skipped = [];
92
70
  for (const item of invoices) {
93
71
  if (remainingCents <= 0) {
94
72
  skipped.push(item);
95
- debug('2/5 额度已用完,不进明细', { fid: item.fid, total: formatCents(item.cents) });
96
73
  continue;
97
74
  }
98
- const remainingBefore = remainingCents;
99
75
  const reimbursedCents = Math.min(item.cents, remainingCents);
100
76
  remainingCents -= reimbursedCents;
101
77
  details.push({ ...item, reimbursedCents });
102
- debug('2/5 明细行', {
103
- fid: item.fid,
104
- total: formatCents(item.cents),
105
- remainingBefore: formatRemaining(remainingBefore),
106
- reimbursedAmount: formatCents(reimbursedCents),
107
- remainingAfter: formatRemaining(remainingCents),
108
- });
109
78
  }
110
79
  const relatedInvoiceIds = details.map((item) => item.fid);
111
80
  const invoiceTotalCents = invoices.reduce((sum, item) => sum + item.cents, 0);
112
81
  const reimbursedTotalCents = details.reduce((sum, item) => sum + item.reimbursedCents, 0);
113
82
  const capped = reimbursedTotalCents < invoiceTotalCents;
114
- debug('2/5 金额汇总', {
115
- invoiceTotal: formatCents(invoiceTotalCents),
116
- reimbursedAmount: formatCents(reimbursedTotalCents),
117
- capped,
118
- detailCount: details.length,
119
- skippedCount: skipped.length,
120
- details: details.map((item) => ({
121
- fid: item.fid,
122
- total: formatCents(item.cents),
123
- reimbursedAmount: formatCents(item.reimbursedCents),
124
- })),
125
- skipped: skipped.map((item) => ({ fid: item.fid, total: formatCents(item.cents) })),
126
- });
127
- debugger; // 金额分摊完成:看 details / skipped / remainingCents
128
83
  const session = await host.getSession();
129
84
  const currentEmpId = asPositiveString(session.userId, '当前人员 ID');
130
85
  const body = {
@@ -140,21 +95,6 @@ export class InvoiceReimSubsidySubmitOperation {
140
95
  reimbursedAmount: formatCents(item.reimbursedCents),
141
96
  })),
142
97
  };
143
- debug('3/5 请求体', {
144
- path: SUBSIDY_SUBMIT_PATH,
145
- autoCommit: body.autoCommit,
146
- processTitle: body.processTitle,
147
- reason: body.reason,
148
- currentEmpId,
149
- customerId,
150
- projectId,
151
- detailList: details.map((item) => ({
152
- relatedProcessId,
153
- relatedInvoiceId: item.fid,
154
- reimbursedAmount: formatCents(item.reimbursedCents),
155
- })),
156
- });
157
- debugger; // 即将发请求:看 body.detailList[].reimbursedAmount
158
98
  let result;
159
99
  try {
160
100
  result = await host.invoiceRequest({
@@ -164,19 +104,13 @@ export class InvoiceReimSubsidySubmitOperation {
164
104
  operation: this.name,
165
105
  timeoutMs: 90_000,
166
106
  });
167
- debug('4/5 接口返回', result);
168
- debugger; // 接口已返回:看 result.data.requestId / data.code
169
107
  }
170
108
  catch (error) {
171
- const failure = error;
172
- debug('4/5 请求异常', { type: failure?.type, subtype: failure?.subtype, code: failure?.code, message: failure?.message });
173
- debugger; // 请求异常:看 failure / debugTrace
174
109
  if (isInvoiceNetworkError(error)) {
175
110
  throw invoicePartialError('报销提交请求发出后连接中断,结果不确定,禁止自动重试', {
176
111
  processTitle,
177
112
  relatedProcessId,
178
113
  relatedInvoiceIds,
179
- debugTrace,
180
114
  workflow: workflow(this.name, 'EXECUTING'),
181
115
  }, { stage: 'submit' });
182
116
  }
@@ -185,10 +119,9 @@ export class InvoiceReimSubsidySubmitOperation {
185
119
  const data = result?.data && typeof result.data === 'object' ? result.data : {};
186
120
  const dataCode = data.code;
187
121
  if (result?.status === false || result?.fail === true || (dataCode !== undefined && Number(dataCode) !== 0)) {
188
- debug('4/5 业务失败', { dataCode, msg: data.msg || result?.msg });
189
122
  throw new InvoiceCliError('api', 'reim_subsidy_submit_failed', data.msg || result?.msg || '话费 / 油费报销提交失败', {
190
123
  code: dataCode ?? result?.code,
191
- details: { result, debugTrace },
124
+ details: { result },
192
125
  exitCode: 1,
193
126
  });
194
127
  }
@@ -197,12 +130,10 @@ export class InvoiceReimSubsidySubmitOperation {
197
130
  throw invoicePartialError('报销提交接口返回成功但没有流程 ID,结果不确定,禁止自动重试', {
198
131
  processTitle,
199
132
  result,
200
- debugTrace,
201
133
  workflow: workflow(this.name, 'VERIFYING'),
202
134
  }, { stage: 'submit-response' });
203
135
  }
204
136
  const url = workflowViewUrl(session.baseUrl, requestId);
205
- debug('5/5 完成', { requestId, url });
206
137
  return {
207
138
  status: 'COMPLETE',
208
139
  data: {
@@ -223,7 +154,6 @@ export class InvoiceReimSubsidySubmitOperation {
223
154
  relatedInvoiceId: item.fid,
224
155
  invoiceTotal: formatCents(item.cents),
225
156
  })),
226
- debugTrace,
227
157
  finalMarkdown: `[${processTitle}](${url})`,
228
158
  result,
229
159
  workflow: workflow(this.name, 'COMPLETE'),