weaver-work-cli 0.1.45 → 0.1.47

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 (129) hide show
  1. package/dist/chunks/{attachment-content-CE3GMWTS.js → attachment-content-MCXQBD6N.js} +3 -3
  2. package/dist/chunks/{chunk-VIMCY4DI.js → chunk-4RWS2YYL.js} +2 -2
  3. package/dist/chunks/{chunk-4EXOIQDI.js → chunk-6AXKWFKG.js} +4 -14
  4. package/dist/chunks/{chunk-JWWTI63L.js → chunk-6V5ZPKHV.js} +2 -8
  5. package/dist/chunks/{chunk-3ZMAQQ3W.js → chunk-76H3IKH6.js} +39 -26
  6. package/dist/chunks/{chunk-LGKWL4OH.js → chunk-AD46OMQK.js} +86 -25
  7. package/dist/chunks/{chunk-3WBIQLMB.js → chunk-GSZTA43P.js} +2 -2
  8. package/dist/chunks/{chunk-OAE3AZBQ.js → chunk-IP4CWQCF.js} +6 -6
  9. package/dist/chunks/{chunk-77YP6I52.js → chunk-IRMIEDXN.js} +1 -1
  10. package/dist/chunks/{chunk-LRCPNDZA.js → chunk-J2VEB5K3.js} +11 -9
  11. package/dist/chunks/{chunk-T4MWQAQB.js → chunk-JFAWZX53.js} +128 -9
  12. package/dist/chunks/{chunk-GR76ZDDX.js → chunk-LIEQJIGM.js} +3 -0
  13. package/dist/chunks/{chunk-DGMYACGJ.js → chunk-OXHHJWNC.js} +1 -1
  14. package/dist/chunks/{chunk-LXFVWZLM.js → chunk-PSOMGA3U.js} +3 -3
  15. package/dist/chunks/{conflict-IYJETSGT.js → conflict-H7EHQXYY.js} +2 -2
  16. package/dist/chunks/{create-flow-7JLC7UID.js → create-flow-VRVJEOBX.js} +6 -6
  17. package/dist/chunks/{ehr-MYRDCHZ4.js → ehr-SH2LM3NK.js} +528 -40
  18. package/dist/chunks/{env-3MBHAWBL.js → env-66FPSJDV.js} +2 -2
  19. package/dist/chunks/{factory-TZEVU4DU.js → factory-UH2TZBVA.js} +1 -1
  20. package/dist/chunks/{group-chat-KL3HFKRM.js → group-chat-CAKMMV7K.js} +3 -3
  21. package/dist/chunks/{invoice-OQP3TMKQ.js → invoice-UEAHSYAE.js} +279 -1
  22. package/dist/chunks/{lazy-dispatch-UH6HGK2I.js → lazy-dispatch-25XGTXLM.js} +2 -2
  23. package/dist/chunks/{meeting-C67EHQ4Z.js → meeting-VTBFW4HI.js} +10 -10
  24. package/dist/chunks/{recruit-stage-AHY5QAMF.js → recruit-stage-CAKZTUA7.js} +917 -85
  25. package/dist/chunks/{registry-XPWPGHYE.js → registry-JVQBLFQ5.js} +10 -10
  26. package/dist/chunks/{room-recommend-CNWE5WQK.js → room-recommend-5U55FMXZ.js} +4 -4
  27. package/dist/chunks/{schedule-YYNYBQIE.js → schedule-IDETODCA.js} +4 -4
  28. package/dist/cmd/action.js +14 -10
  29. package/dist/index.js +7 -7
  30. package/dist/shortcuts/ehr/host.js +2 -2
  31. package/dist/shortcuts/ehr/index.js +14 -3
  32. package/dist/shortcuts/ehr/manifest.js +5 -1
  33. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +40 -10
  34. package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
  35. package/dist/shortcuts/ehr/operations/recruit-position.js +10 -8
  36. package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
  37. package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
  38. package/dist/shortcuts/ehr/operations/recruit-write.js +137 -18
  39. package/dist/shortcuts/ehr/operations/recruit.js +180 -8
  40. package/dist/shortcuts/ehr/operations/registry.js +4 -0
  41. package/dist/shortcuts/ehr/operations.js +24 -0
  42. package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
  43. package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
  44. package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
  45. package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
  46. package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
  47. package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
  48. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
  49. package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
  50. package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
  51. package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
  52. package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
  53. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
  54. package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
  55. package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
  56. package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
  57. package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
  58. package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
  59. package/dist/shortcuts/invoice/host.js +3 -0
  60. package/dist/shortcuts/invoice/manifest.js +61 -0
  61. package/dist/shortcuts/invoice/operations/registry.js +2 -0
  62. package/dist/shortcuts/invoice/operations/reim-subsidy.js +233 -0
  63. package/dist/shortcuts/meeting/operations/eb/create-flow.js +93 -18
  64. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -8
  65. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +2 -13
  66. package/dist/shortcuts/meeting/operations/invitation.js +27 -4
  67. package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
  68. package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
  69. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +277 -20
  70. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +31 -7
  71. package/dist/shortcuts/recruit-stage/operations/jd-create.js +106 -16
  72. package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
  73. package/dist/shortcuts/recruit-stage/operations/resume-import.js +273 -6
  74. package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
  75. package/dist/shortcuts/recruit-stage/shared.js +60 -6
  76. package/docs/invoice.md +1 -0
  77. package/package.json +1 -1
  78. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +2 -2
  79. package/skills/weaver-e10-jucailin/SKILL.md +12 -3
  80. package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
  81. package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
  82. package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
  83. package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
  84. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
  85. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
  86. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
  87. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
  88. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
  89. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
  90. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
  91. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
  92. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
  93. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
  94. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
  95. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
  96. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
  97. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
  98. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
  99. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
  100. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
  101. package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
  102. package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
  103. package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -93
  104. package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
  105. package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
  106. package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
  107. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
  108. package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
  109. package/skills/weaver-e10-jucailin/references/recruit-write.md +53 -9
  110. package/skills/weaver-e10-meeting/SKILL.md +48 -4
  111. package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
  112. package/skills/weaver-e10-recruit-stage/SKILL.md +8 -5
  113. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +16 -6
  114. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
  115. package/skills/weaver-e10-recruit-stage/references/position-templates.md +20 -1
  116. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +21 -0
  117. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +4 -0
  118. package/skills/weaver-e10-yepiaotong/SKILL.md +7 -5
  119. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +1 -1
  120. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +9 -2
  121. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +2 -0
  122. package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +2 -0
  123. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +68 -6
  124. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +3 -3
  125. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +8 -15
  126. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +6 -5
  127. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +206 -92
  128. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +26 -21
  129. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +35 -0
@@ -16,7 +16,38 @@ import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from '.
16
16
  const RECRUIT_APP_TAG = 'weaver-recruit-service';
17
17
  /** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
18
18
  /** 环境缓存结构版本:新增/变更解析字段(如 2026-11-04 补 candidate 应聘者列表)时 +1,旧缓存自动失效重建。 */
19
- const RECRUIT_CACHE_VERSION = 3;
19
+ const RECRUIT_CACHE_VERSION = 4;
20
+ /**
21
+ * 关键表单:解析不到字段列表即判定招聘上下文不可用。
22
+ *
23
+ * 2026-11-06 修复(小E 演示「读取职位表单→数据节点无法解析」的根因):
24
+ * 旧实现 L4 `fetchFormFields` 返回空 fmap 时**静默跳过**,随后把缺 `fields[objId]` 的
25
+ * 上下文照常落盘;`load()` 命中缓存又只校验 `cacheVersion`,于是坏缓存长期复用,
26
+ * 后续 prepare / list / prefill 全部在「职位管理缺少字段 …(ds/fields 解析不到)」处中断。
27
+ * 现在:关键表单字段为空即抛明确错误(不落盘),且命中缓存时校验关键字段,坏缓存自动重建。
28
+ */
29
+ const RECRUIT_CRITICAL_FORMS = new Set(['position_manage', 'talent_pool', 'interview_plan']);
30
+ /** 关键表单中文名(报错用;表单自身 objName 在解析失败时取不到,不能依赖) */
31
+ const RECRUIT_CRITICAL_FORM_LABELS = {
32
+ position_manage: '招聘职位',
33
+ talent_pool: '人才库',
34
+ interview_plan: '面试管理',
35
+ };
36
+ /** 磁盘缓存健康检查:关键表单必须解析到 objId **且**字段表非空,否则判坏必须重建。 */
37
+ function hasCriticalFields(cache) {
38
+ for (const logic of RECRUIT_CRITICAL_FORMS) {
39
+ const objId = cache?.forms?.[logic]?.objId;
40
+ // 🔴 关键表单缺 objId 同样是坏缓存:说明当初 getObjsByTag 解析失败(网络抖动/权限/未装全)。
41
+ // 旧实现 `if (!objId) continue` 等于「没表单就不用校验字段」,把解析失败的上下文当健康缓存长期复用,
42
+ // 之后所有职位/人才操作都在「表单未启用」或「缺少字段」处中断——这是坏缓存的第二条产生路径。
43
+ if (!objId)
44
+ return false;
45
+ const fmap = cache?.fields?.[objId] || {};
46
+ if (!Object.keys(fmap).length)
47
+ return false;
48
+ }
49
+ return true;
50
+ }
20
51
  const RECRUIT_TAGS = {
21
52
  talent_pool: 'uf_rcrt_talent_pool',
22
53
  interview_plan: 'uf_rcrt_interview_plan',
@@ -80,7 +111,7 @@ function cacheDirFor(baseUrl) {
80
111
  return join(home, 'env-cache', 'recruit-ops', host);
81
112
  }
82
113
  /** 内联展示字段解析:门户字段三种形态(数组/对象/字符串 JSON),同 recruit-detail.mjs namesOf */
83
- function namesOf(field) {
114
+ export function namesOf(field) {
84
115
  if (!field)
85
116
  return null;
86
117
  let arr;
@@ -199,6 +230,13 @@ async function resolveRecruitEnv(host, appId) {
199
230
  if (!tenantKey && entry?.tenantKey)
200
231
  tenantKey = String(entry.tenantKey);
201
232
  }
233
+ // L2.5:关键表单必须解析到 objId。缺一个就说明 tag/权限/安装有问题,
234
+ // 与「字段表为空」同等对待——立即报错且**不落盘**,避免把解析失败的上下文写进缓存。
235
+ for (const logic of RECRUIT_CRITICAL_FORMS) {
236
+ if (forms[logic]?.objId)
237
+ continue;
238
+ throw new RecruitContextError('recruit_form_unresolved', `当前环境未解析到「${RECRUIT_CRITICAL_FORM_LABELS[logic] || logic}」表单(getObjsByTag 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限后重试。`);
239
+ }
202
240
  // L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
203
241
  const menuResponse = (await host.request({
204
242
  path: '/api/cusapp/app/allMenus',
@@ -231,11 +269,15 @@ async function resolveRecruitEnv(host, appId) {
231
269
  const resolvedForms = Object.entries(forms).filter(([, v]) => v.objId);
232
270
  await Promise.all(resolvedForms.map(async ([logic, entry]) => {
233
271
  const { fmap, omap } = await fetchFormFields(host, appId, entry.objId);
272
+ // 🔴 关键表单字段解析失败必须报错,且不能让缺字段的上下文落盘(见文件头修复说明)。
273
+ // 非关键表单(辅助配置表等)允许为空,保持旧行为,避免误伤部分环境。
274
+ if (!Object.keys(fmap).length && RECRUIT_CRITICAL_FORMS.has(logic)) {
275
+ throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「${entry.objName || logic}」表单的字段列表(ds/fields 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限,或删除环境缓存后重试。`);
276
+ }
234
277
  if (Object.keys(fmap).length)
235
278
  fields[entry.objId] = fmap;
236
279
  if (Object.keys(omap).length)
237
280
  fieldOptions[entry.objId] = omap;
238
- void logic;
239
281
  }));
240
282
  // L5:数据字典表全量映射(字典引用类字段如渠道的 optionId 来源)
241
283
  const dictByName = {};
@@ -401,7 +443,8 @@ export function createRecruitContextLoader() {
401
443
  }
402
444
  }
403
445
  catch { /* 缓存读取失败回退闸门链路 */ }
404
- if (diskCache && diskCache.cacheVersion === RECRUIT_CACHE_VERSION) {
446
+ // 命中缓存前必须校验关键表单字段;版本对但字段表为空的坏缓存不复用,继续走闸门重建。
447
+ if (diskCache && diskCache.cacheVersion === RECRUIT_CACHE_VERSION && hasCriticalFields(diskCache)) {
405
448
  memo.set(memoKey, diskCache);
406
449
  return diskCache;
407
450
  }
@@ -430,7 +473,13 @@ export function createRecruitContextLoader() {
430
473
  ...resolved,
431
474
  }, null, 2), 'utf8');
432
475
  }
433
- catch { /* 缓存落盘失败不影响本次调用 */ }
476
+ catch (error) {
477
+ // 落盘失败不阻塞本次调用,但必须可诊断:落盘坏了会让每次调用都全量重解析(慢),
478
+ // 一旦解析偶发失败就会表现成「字段解析不到」。用 WEAVER_CLI_DEBUG_CACHE=1 打开。
479
+ if (process.env.WEAVER_CLI_DEBUG_CACHE) {
480
+ console.error('[recruit-context] 缓存落盘失败:', error instanceof Error ? error.message : String(error));
481
+ }
482
+ }
434
483
  memo.set(memoKey, resolved);
435
484
  return resolved;
436
485
  }
@@ -641,7 +690,7 @@ const candidateList = {
641
690
  resource: 'recruit',
642
691
  method: 'candidate.list',
643
692
  action: 'ehr.recruit.candidate.list',
644
- summary: '查询招聘业务列表(demand 招聘需求 / position 招聘职位 / entry 入职管理 / offer 录用管理),displayData 显示层零翻译输出',
693
+ summary: '查询招聘业务列表(demand 招聘需求 / position 招聘职位 / entry 入职管理 / offer 录用管理 / interview 面试管理 / candidate 应聘者),displayData 显示层零翻译输出',
645
694
  capability: 'recruit',
646
695
  risk: READ,
647
696
  inputSchema: schemaOf({
@@ -711,8 +760,23 @@ const candidateList = {
711
760
  }
712
761
  return cleaned;
713
762
  });
763
+ // 🔴 行内 id 语义(2026-11-07 实测,必须随数据一起给出,否则 Agent 会去找不存在的字段或拿人名当 id):
764
+ // · 所有类型:`form_data_id` 是**这一行记录本身**的 id(职位/面试/应聘…),卡片链接与后续写操作都用它;
765
+ // · type=position:列表**不返回 position_id**——实测后端字段就没有这一项,行里只有 form_data_id,
766
+ // 要「职位 id」一律用 form_data_id(对应职位卡片 /card/0/<职位objId>/<form_data_id>);
767
+ // · type=interview:`talent_id` / `position_manage_id` 放的是**人名**(displayData 已翻译),不是 id。
768
+ const idNote = type === 'position'
769
+ ? '本列表不返回 position_id(后端接口无此字段);职位 id 请用每行的 form_data_id,'
770
+ + '或改用 type=candidate 列表(那里有真实 position_id 与 talent_id)。'
771
+ : type === 'interview'
772
+ ? '本列表的 talent_id / position_manage_id 是人名不是 id;要人才 id 请用 candidate.search 按手机号或姓名取。'
773
+ : type === 'candidate'
774
+ ? '本列表的 form_data_id 是「应聘批次(candidateManage)」id,position_id / talent_id 是真实 id,可直接用于卡片与写操作。'
775
+ : undefined;
714
776
  return ehrSuccess('ehr.recruit.candidate.list', {
715
- type, total, totalExact, ...(totalNote ? { totalNote } : {}), current: body.current, pageSize: body.pageSize, rows: outRows,
777
+ type, total, totalExact, ...(totalNote ? { totalNote } : {}),
778
+ ...(idNote ? { idNote } : {}),
779
+ current: body.current, pageSize: body.pageSize, rows: outRows,
716
780
  });
717
781
  },
718
782
  };
@@ -912,17 +976,78 @@ const candidateCard = {
912
976
  const v = randHex6();
913
977
  const query = `talentId=${id}&batchId=${batchId}&v=${v}&randomkey_${rk2}=${rk2}`;
914
978
  const cardBody = { talentId: id, batchId, current: 1, pageSize: 100 };
915
- const [base, other, interview, remark] = await Promise.all([
979
+ // D7(2026-11-07 补):人才表单全量字段。
980
+ // `getCandidateCardBaseInfo` 只返回 9 个基础键(姓名/手机/邮箱/渠道/状态/时间/黑名单/附件数),
981
+ // 学历、工作年限、期望薪资、所在城市、教育/工作/项目经历全都读不到。
982
+ // 真正的全量通道是 EB OpenAPI `dataset/v2/getDataById`:
983
+ // objId = 人才表单(cache.forms.talent_pool.objId)
984
+ // mainTable.id = talentId
985
+ // isReturnDetail = 'y' 才会连三张明细表一起返回
986
+ const talentObjId = cache.forms.talent_pool?.objId;
987
+ const [base, other, interview, remark, talentForm] = await Promise.all([
916
988
  env.host.request({ path: `/api/recruit/candidate/getCandidateCardBaseInfo?${query}`, headers: extra }),
917
989
  env.host.request({ path: `/api/recruit/candidate/getCandidateCardOtherInfo?${query}`, headers: extra }),
918
990
  env.host.request({ path: '/api/recruit/candidate/getCandidateCardInterviewInfo', body: cardBody, headers: extra }),
919
991
  env.host.request({ path: '/api/recruit/candidate/getCandidateCardRemark', body: cardBody, headers: extra }),
992
+ talentObjId
993
+ ? env.host.request({
994
+ path: '/api/ebuilder/form/dataset/v2/getDataById',
995
+ method: 'POST',
996
+ // EB OpenAPI 族的成功标识在 `data.datajson.status`,顶层无 code/status,
997
+ // 走通用业务判定会被误判成失败,故跳过判定(HTTP/解析/会话保护仍然生效)。
998
+ skipBusinessCheck: true,
999
+ body: {
1000
+ datajson: {
1001
+ header: { objId: talentObjId },
1002
+ mainTable: { id },
1003
+ operationinfo: { isReturnDetail: 'y', fieldNoFindIgnore: 'false' },
1004
+ },
1005
+ },
1006
+ headers: extra,
1007
+ })
1008
+ : Promise.resolve(null),
920
1009
  ]);
921
1010
  const statusMap = cache.options?.recruit_status || {};
922
1011
  const talent = base?.data?.talent || {};
923
1012
  const currentBatch = other?.data?.currentCandidateBatch || {};
924
1013
  const interviewList = interview?.data?.list || [];
925
1014
  const remarkList = remark?.data?.list || [];
1015
+ // 解析人才表单全量字段。EB 返回的字段值是 { fieldValue | fieldOptionName | fieldOptionId, fieldType, ... }
1016
+ // 的包裹对象;选择类字段没有 fieldValue,只能取 fieldOptionName。空字段(未填)不会出现在返回里。
1017
+ const formRow = talentForm?.data?.datajson?.datas?.[0] || null;
1018
+ // 统一取值:跳过空串,取第一个有效值。
1019
+ // 实测 Cascader(所在地)返回 [{ fieldOptionId:"北京市", fieldOptionName:"" }],
1020
+ // 数组形态同样会被空字段名截住,必须逐个 candidate 判空。
1021
+ const pick = (holder) => {
1022
+ if (holder === undefined || holder === null)
1023
+ return null;
1024
+ for (const candidate of [holder.fieldValue, holder.fieldOptionName, holder.fieldOptionId]) {
1025
+ if (candidate !== undefined && candidate !== null && String(candidate).trim() !== '') {
1026
+ return candidate;
1027
+ }
1028
+ }
1029
+ return null;
1030
+ };
1031
+ const cell = (obj, key) => {
1032
+ const v = obj?.[key];
1033
+ if (v === undefined || v === null)
1034
+ return null;
1035
+ if (Array.isArray(v))
1036
+ return v.length ? pick(v[0]) : null;
1037
+ if (typeof v === 'object')
1038
+ return pick(v);
1039
+ return v;
1040
+ };
1041
+ const mainTable = formRow?.mainTable || {};
1042
+ // 明细表按「是否含某个标志字段」识别种类,不依赖 detail1/detail2 编号
1043
+ // (编号由 dataset/v1/getTableMapping 决定,换表单会变,硬编码编号必错)。
1044
+ const detailGroups = Object.entries(formRow || {})
1045
+ .filter(([key]) => /^detail\d+$/.test(key))
1046
+ .map(([, rows]) => (Array.isArray(rows) ? rows : []));
1047
+ const rowsWith = (probeKey) => detailGroups.find((rows) => rows.some((row) => row?.[probeKey] !== undefined)) || [];
1048
+ const workRows = rowsWith('co_name');
1049
+ const eduRows = rowsWith('school');
1050
+ const projectRows = rowsWith('pj_name');
926
1051
  const baseUrl = (await env.host.getSession()).baseUrl.replace(/\/+$/, '');
927
1052
  return ehrSuccess('ehr.recruit.candidate.card', {
928
1053
  talentId: id,
@@ -933,10 +1058,22 @@ const candidateCard = {
933
1058
  baseInfo: {
934
1059
  name: talent?.hrm?.name,
935
1060
  mobile: talent?.telephone,
1061
+ email: talent?.email || null,
936
1062
  channel: talent?.channel,
937
1063
  status: statusMap[base?.data?.recruitStatus] || base?.data?.recruitStatus || null,
938
1064
  createTime: talent?.createTime,
1065
+ updateTime: talent?.updateTime || null,
1066
+ // 🔴 isBlacklist 后端给的是**字典 optionId**(实测 840803130362052609),不是布尔值;
1067
+ // 该字典名未在 env 缓存里暴露,硬翻会猜错语义,故只保留原始 id 并标明它是 optionId,
1068
+ // 需要「是否拉黑」的业务判断时请到页面确认,不要把长 id 当成 true。
1069
+ isBlacklistOptionId: talent?.isBlacklist || null,
1070
+ resumeFileCount: Array.isArray(talent?.originalResume) ? talent.originalResume.length : 0,
939
1071
  },
1072
+ // 🔴 两处 channel 来源不同(2026-11-07 实测,属正常不是 bug):
1073
+ // baseInfo.channel = talent.channel,人才档案里的「简历来源渠道」;
1074
+ // position.channel = currentBatch.channel,本应聘批次走的渠道(如内部遴选)。
1075
+ // 同一人才可有多批次,这两者天然可能不一致,不要当成数据错误去"修正"。
1076
+ channelNote: 'baseInfo.channel 是人才档案的简历来源渠道;position.channel 是当前应聘批次的渠道,两者来源不同、可能不一致。',
940
1077
  position: {
941
1078
  position: currentBatch?.position?.name,
942
1079
  stage: currentBatch?.currentStageName,
@@ -971,6 +1108,41 @@ const candidateCard = {
971
1108
  creator: item?.creator?.username || item?.creator?.name || null,
972
1109
  content: item?.remark,
973
1110
  })),
1111
+ // 人才档案全量(D7 补齐,2026-11-07)。此前 baseInfo 只有 9 个基础键,简历里的学历/年限/薪资都读不到。
1112
+ profile: {
1113
+ highestDegree: cell(mainTable, 'highest_degree'),
1114
+ workYears: cell(mainTable, 'work_exp'),
1115
+ expectSalary: cell(mainTable, 'expect_salary'),
1116
+ currentSalary: cell(mainTable, 'current_salary'),
1117
+ expectIndustry: cell(mainTable, 'expect_industry'),
1118
+ locationArea: cell(mainTable, 'location_area'),
1119
+ college: cell(mainTable, 'college') ?? cell(mainTable, 'hd_college'),
1120
+ major: cell(mainTable, 'major') ?? cell(mainTable, 'hd_major'),
1121
+ graduateDate: cell(mainTable, 'graduate_date'),
1122
+ },
1123
+ workExperiences: workRows.map((row) => ({
1124
+ company: cell(row, 'co_name'),
1125
+ position: cell(row, 'work_position'),
1126
+ start: cell(row, 'start_end_date_0'),
1127
+ end: cell(row, 'start_end_date_1'),
1128
+ })),
1129
+ educations: eduRows.map((row) => ({
1130
+ school: cell(row, 'school'),
1131
+ degree: cell(row, 'edu_education'),
1132
+ major: cell(row, 'edu_major'),
1133
+ start: cell(row, 'study_date_0'),
1134
+ end: cell(row, 'study_date_1'),
1135
+ })),
1136
+ projects: projectRows.map((row) => ({
1137
+ name: cell(row, 'pj_name'),
1138
+ introduction: cell(row, 'pj_introduction'),
1139
+ start: cell(row, 'pj_date_0'),
1140
+ end: cell(row, 'pj_date_1'),
1141
+ })),
1142
+ // 空值不是读取失败:E9 迁移的老人才(如测试人 100005840000020214)只迁了 18 个基础字段,
1143
+ // 教育/工作/项目经历本来就没有数据;新建人才(千里聆解析)通常是三张明细齐全。
1144
+ profileNote: 'profile 与 workExperiences/educations/projects 来自人才表单全量读取;'
1145
+ + '字段为空表示该人才档案里没录这项(常见于早期 E9 迁移数据),不是读取失败。',
974
1146
  });
975
1147
  },
976
1148
  };
@@ -9,6 +9,8 @@ import { recruitWriteOperations } from './recruit-write.js';
9
9
  import { recruitStatsOperations } from './recruit-stats.js';
10
10
  import { recruitPositionOperations } from './recruit-position.js';
11
11
  import { recruitCandidateImportOperations } from './recruit-candidate-import.js';
12
+ import { recruitTagOperations } from './recruit-tag.js';
13
+ import { recruitInterviewOverviewOperations } from './recruit-interview-overview.js';
12
14
  import { salaryOperations } from './salary.js';
13
15
  function buildRegistry() {
14
16
  const registry = new Map();
@@ -24,6 +26,8 @@ function buildRegistry() {
24
26
  ...recruitStatsOperations,
25
27
  ...recruitPositionOperations,
26
28
  ...recruitCandidateImportOperations,
29
+ ...recruitTagOperations,
30
+ ...recruitInterviewOverviewOperations,
27
31
  ];
28
32
  for (const definition of definitions) {
29
33
  if (registry.has(definition.name)) {
@@ -1,10 +1,34 @@
1
1
  import { getEhrOperation } from './operations/registry.js';
2
2
  import { assertNoForbiddenKeys, asObject } from './operations/shared.js';
3
+ import { ehrValidationError } from './errors.js';
3
4
  import { createRecruitContextLoader } from './operations/recruit.js';
5
+ /**
6
+ * 拒绝未声明的参数(2026-11-07 新增)。
7
+ *
8
+ * 背景:`schemaOf` 只声明 `additionalProperties:false`,运行时不校验 —— 实测
9
+ * `ehr.recruit.candidate.search` 传 `keyword`(真名是 `name`/`mobile`)**不报错**,
10
+ * 而是把查询条件整个丢掉、返回最近 10 条无关数据,Agent 会误以为查到了。
11
+ * 这类「参数名写错被静默忽略」最难排查,故在入口直接拒绝,并把支持列表回给调用方。
12
+ *
13
+ * 只校验未知键,不校验 required(required 缺失由各 handler 抛更具体的业务错误)。
14
+ */
15
+ function assertKnownArguments(definition, input) {
16
+ const schema = definition.inputSchema;
17
+ if (!schema || schema.additionalProperties !== false)
18
+ return;
19
+ const props = (schema.properties || {});
20
+ const known = Object.keys(props);
21
+ const unknown = Object.keys(input).filter((key) => !known.includes(key));
22
+ if (unknown.length === 0)
23
+ return;
24
+ throw ehrValidationError('unknown_argument', `未知参数:${unknown.join('、')}。本操作支持的参数:${known.length ? known.join('、') : '(无)'}。`
25
+ + '参数名写错会被静默忽略并返回看似正常的结果,请按上面的参数名重传。');
26
+ }
4
27
  export async function executeEhrOperation(operation, rawInput, context) {
5
28
  const definition = getEhrOperation(operation);
6
29
  const input = asObject(rawInput);
7
30
  assertNoForbiddenKeys(input);
31
+ assertKnownArguments(definition, input);
8
32
  const host = {
9
33
  request(request) {
10
34
  return context.host.request({
@@ -0,0 +1,78 @@
1
+ /**
2
+ * 批量任务的暂存清单(2026-11-06)。
3
+ *
4
+ * 为什么不用 continuation 直接携带:
5
+ * 批量简历导入的每一项都带 `structured`(整份简历 JSON),几十份时 token 会膨胀到几十万字符,
6
+ * Agent 传参不现实。这里把清单落到本机 `~/.weaver-work-cli/batch/`,token 只带文件路径 + 指纹;
7
+ * apply 时重算指纹,不一致即拒绝(防止清单被中途改写)。
8
+ *
9
+ * 安全:
10
+ * - 目录 0700、文件 0600;
11
+ * - 只允许读 batch 目录内的文件(防越权读任意路径);
12
+ * - 24 小时以上的旧清单在下次写入时清理。
13
+ */
14
+ import { createHash } from 'node:crypto';
15
+ import { chmodSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
16
+ import { homedir } from 'node:os';
17
+ import { join, resolve, sep } from 'node:path';
18
+ import { rsValidationError } from './errors.js';
19
+ function batchDir() {
20
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
21
+ const dir = join(home, 'batch');
22
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
23
+ return dir;
24
+ }
25
+ function digest(value) {
26
+ return createHash('sha256').update(JSON.stringify(value)).digest('hex');
27
+ }
28
+ function cleanup(dir) {
29
+ try {
30
+ const now = Date.now();
31
+ for (const f of readdirSync(dir)) {
32
+ if (!f.endsWith('.json'))
33
+ continue;
34
+ const p = join(dir, f);
35
+ try {
36
+ if (now - statSync(p).mtimeMs > 24 * 3600 * 1000)
37
+ unlinkSync(p);
38
+ }
39
+ catch { /* 单文件清理失败忽略 */ }
40
+ }
41
+ }
42
+ catch { /* 目录不可读忽略 */ }
43
+ }
44
+ /** 落盘批量清单,返回文件路径与内容指纹。 */
45
+ export function saveBatchItems(kind, items) {
46
+ const dir = batchDir();
47
+ cleanup(dir);
48
+ const fingerprint = digest(items);
49
+ const file = join(dir, `${kind}-${fingerprint.slice(0, 16)}.json`);
50
+ writeFileSync(file, JSON.stringify(items), { mode: 0o600 });
51
+ try {
52
+ chmodSync(file, 0o600);
53
+ }
54
+ catch { /* Windows 上可能不支持 */ }
55
+ return { file, fingerprint };
56
+ }
57
+ /** 读取并校验批量清单(路径必须在 batch 目录内,内容指纹必须与 token 一致)。 */
58
+ export function loadBatchItems(file, expectedFingerprint) {
59
+ const dir = resolve(batchDir());
60
+ const target = resolve(String(file || ''));
61
+ if (!target.startsWith(dir + sep)) {
62
+ throw rsValidationError('batch_file_invalid', '批量清单路径非法(必须位于 CLI 的 batch 目录内)');
63
+ }
64
+ let items;
65
+ try {
66
+ items = JSON.parse(readFileSync(target, 'utf8'));
67
+ }
68
+ catch {
69
+ throw rsValidationError('batch_file_missing', '批量清单已失效(文件被移动或删除),请重新 prepare');
70
+ }
71
+ if (!Array.isArray(items)) {
72
+ throw rsValidationError('batch_file_invalid', '批量清单格式不正确,请重新 prepare');
73
+ }
74
+ if (digest(items) !== String(expectedFingerprint || '')) {
75
+ throw rsValidationError('batch_file_tampered', '批量清单与确认时不一致(文件被修改),已拒绝执行,请重新 prepare');
76
+ }
77
+ return items;
78
+ }
@@ -0,0 +1,231 @@
1
+ import { join, resolve } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { homedir } from 'node:os';
5
+ import { createRecruitContextLoader, } from '../operations/recruit.js';
6
+ import { rsFail } from './errors.js';
7
+ const flowMemo = new Map();
8
+ /**
9
+ * 自用系统(selfUse=1)默认招聘流程兜底常量 —— 2026-11-05 用户明确指定写死。
10
+ *
11
+ * 背景:www.e-cology.com.cn 是自用系统,招聘流程**只有一条**「初筛+面试+offer阶段」。
12
+ * 该环境的运行时解析通道全部取不到值(实测):
13
+ * · 环境缓存无 defaultRecruitFlow 键、无 menus 字段
14
+ * · 原接口 /api/recruit/position/recruitFlow/list 不存在(静默失败)
15
+ * · 招聘流程菜单列表经 listInit + getListDatas 仍未返回可用行
16
+ *
17
+ * ⚠️ 与技能「环境 id 绝不入包、跨环境自适应」原则冲突,故**加双重守卫**:
18
+ * 仅当 selfUse=1 且域名等于 selfUseHost 时才使用本常量;其他环境继续走运行时解析,不受影响。
19
+ * 换环境或该流程数据变更时必须同步修改此处。
20
+ */
21
+ const SELFUSE_DEFAULT_FLOW = {
22
+ selfUseHost: 'www.e-cology.com.cn',
23
+ id: '874896524979806209',
24
+ name: '初筛+面试+offer阶段',
25
+ };
26
+ const digitalMenuMemo = new Map();
27
+ function cacheDirFor(baseUrl) {
28
+ const url = new URL(baseUrl);
29
+ const host = url.hostname + (url.port ? `_${url.port}` : '');
30
+ const envRoot = process.env.E10_SKILL_CACHE_DIR;
31
+ if (envRoot)
32
+ return join(envRoot, host);
33
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
34
+ return join(home, 'env-cache', 'recruit-ops', host);
35
+ }
36
+ /**
37
+ * 磁盘缓存兼容:脚本版(recruit-stage 技能)播种的缓存里若已带 defaultRecruitFlow /
38
+ * lists.digital_human,直接复用(同环境免请求);CLI 侧则运行时解析一次并 memo。
39
+ */
40
+ async function readLegacyCacheExtra(baseUrl) {
41
+ try {
42
+ const dir = cacheDirFor(baseUrl);
43
+ if (!existsSync(dir))
44
+ return { defaultRecruitFlow: null, digitalHumanMenu: null };
45
+ const files = await (await import('node:fs/promises')).readdir(dir);
46
+ const jsonFiles = files.filter((f) => f.endsWith('.json'));
47
+ // 原实现要求「目录内恰好 1 个 json 才读」,多环境/多应用共存时必然读不到 →
48
+ // 改为遍历全部 json,取第一个带所需键的(2026-11-05 修)。
49
+ let flow = null;
50
+ let dh = null;
51
+ for (const f of jsonFiles) {
52
+ let raw;
53
+ try {
54
+ raw = JSON.parse(await readFile(join(dir, f), 'utf8'));
55
+ }
56
+ catch {
57
+ continue;
58
+ }
59
+ if (!flow && raw?.defaultRecruitFlow && raw.defaultRecruitFlow.id) {
60
+ flow = { id: String(raw.defaultRecruitFlow.id), name: String(raw.defaultRecruitFlow.name || '') };
61
+ }
62
+ if (!dh && raw?.lists?.digital_human?.listId) {
63
+ dh = {
64
+ menuName: String(raw.lists.digital_human.menuName || '面试数字人配置'),
65
+ listId: String(raw.lists.digital_human.listId),
66
+ cusMenuId: String(raw.lists.digital_human.cusMenuId || ''),
67
+ };
68
+ }
69
+ if (flow && dh)
70
+ break;
71
+ }
72
+ return { defaultRecruitFlow: flow, digitalHumanMenu: dh };
73
+ }
74
+ catch {
75
+ return { defaultRecruitFlow: null, digitalHumanMenu: null };
76
+ }
77
+ }
78
+ /** 从菜单树/list 里找「招聘流程」列表参数(本环境实测存在于 lists.all_search) */
79
+ function findFlowMenu(cache) {
80
+ const all = ((cache.lists || {}).all_search || []);
81
+ const hit = all.find((m) => m && m.listId && /招聘流程/.test(String(m.menuName || '')));
82
+ if (hit) {
83
+ return { listId: String(hit.listId), cusMenuId: String(hit.cusMenuId || ''), menuName: String(hit.menuName || '招聘流程') };
84
+ }
85
+ return null;
86
+ }
87
+ /** 判断某行是否为「默认启用」流程:兼容多种字段命名 */
88
+ function isDefaultFlowRow(x) {
89
+ if (!x)
90
+ return false;
91
+ const cands = [x.is_default, x.isDefault, x.default_flow, x.defaultFlow, x.is_enable, x.enabled, x.status];
92
+ for (const v of cands) {
93
+ if (v === true || v === 1 || v === '1')
94
+ return true;
95
+ if (String(v) === '是' || String(v) === '启用' || String(v) === '默认')
96
+ return true;
97
+ }
98
+ return false;
99
+ }
100
+ /** 默认招聘流程解析:优先 legacy 缓存 → 招聘流程菜单列表 → 旧接口兜底。失败**不缓存**(允许多次重试)。 */
101
+ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
102
+ const memoKey = baseUrl;
103
+ if (flowMemo.has(memoKey))
104
+ return flowMemo.get(memoKey) ?? null;
105
+ const legacy = await readLegacyCacheExtra(baseUrl);
106
+ if (legacy.defaultRecruitFlow) {
107
+ flowMemo.set(memoKey, legacy.defaultRecruitFlow);
108
+ return legacy.defaultRecruitFlow;
109
+ }
110
+ let result = null;
111
+ // ① 招聘流程菜单列表(本环境实测入口,原实现只调接口必然失败)
112
+ const menu = findFlowMenu(cache);
113
+ if (menu) {
114
+ try {
115
+ // getListDatas 的 passid/cid 必须是**表单 objId**,不是 listId;
116
+ // 先用 listInit 用 listId 反查 objId(口径同 interview-arrange 的数字人菜单解析)
117
+ let flowObjId = '';
118
+ try {
119
+ const liBody = {
120
+ cusMenuId: menu.cusMenuId,
121
+ listId: menu.listId,
122
+ urlPageTitle: menu.menuName,
123
+ };
124
+ liBody['appId_' + menu.listId] = appId;
125
+ const li = await host.request({ path: '/api/ebuilder/form/list/listInit', body: liBody });
126
+ flowObjId = String(li?.data?.objid || '');
127
+ }
128
+ catch { /* listInit 不可用 → 走接口兜底 */ }
129
+ if (flowObjId) {
130
+ const body = {
131
+ current: 1, pageSize: 50, tableuid: Math.random().toString(16).slice(2, 34),
132
+ listId: menu.listId, searchParamData: { searchType: '3', type: 'and' },
133
+ terminal: 'PC', browser: 'Chrome', requiredMatch: 1, mapResult: 1,
134
+ recheckQuery: 1, isFollow: 0, isShareToMe: 0, filterCondition: {},
135
+ cusMenuId: menu.cusMenuId, urlPageTitle: menu.menuName, menuName: menu.menuName,
136
+ };
137
+ const r = await host.request({
138
+ path: `/api/ebuilder/form/list/getListDatas?passid=${flowObjId}&cid=${flowObjId}`,
139
+ body,
140
+ headers: { ebBusinessId: menu.listId },
141
+ });
142
+ const rows = (r?.data?.data || r?.data?.displayData || []);
143
+ const pick = rows.find(isDefaultFlowRow) || (rows.length === 1 ? rows[0] : null);
144
+ if (pick) {
145
+ const id = String(pick.form_data_id || pick.id || '');
146
+ const name = String(pick.name || pick.flow_name || pick.content || '');
147
+ if (id && name)
148
+ result = { id, name };
149
+ }
150
+ }
151
+ }
152
+ catch { /* 菜单通道不可用 → 走接口兜底 */ }
153
+ }
154
+ // ② 旧接口兜底(原实现唯一通道,部分环境保留)
155
+ if (!result) {
156
+ try {
157
+ const r = await host.request({
158
+ path: '/api/recruit/position/recruitFlow/list',
159
+ method: 'POST',
160
+ body: { appId, current: 1, pageSize: 50 },
161
+ operation: 'context.defaultRecruitFlow',
162
+ });
163
+ const rows = r?.data?.list || r?.data?.rows || r?.data || [];
164
+ const list = Array.isArray(rows) ? rows : [];
165
+ const enabled = list.find(isDefaultFlowRow) || null;
166
+ if (enabled?.id) {
167
+ result = { id: String(enabled.id), name: String(enabled.name || enabled.flow_name || '') };
168
+ }
169
+ }
170
+ catch { /* 接口形态不符/未开放 */ }
171
+ }
172
+ // ③ 自用系统兜底(用户指定写死):仅 selfUse=1 且域名匹配时生效,不影响其他环境
173
+ if (!result) {
174
+ const isSelfUse = String(cache?.selfUse || '') === '1';
175
+ let host = '';
176
+ try {
177
+ host = new URL(baseUrl).hostname;
178
+ }
179
+ catch {
180
+ host = '';
181
+ }
182
+ if (isSelfUse && host === SELFUSE_DEFAULT_FLOW.selfUseHost) {
183
+ result = { id: SELFUSE_DEFAULT_FLOW.id, name: SELFUSE_DEFAULT_FLOW.name };
184
+ }
185
+ }
186
+ // 只有解析成功才写入 memo:失败若也缓存 null,进程内后续所有请求都拿不到(原实现缺陷)
187
+ if (result)
188
+ flowMemo.set(memoKey, result);
189
+ return result;
190
+ }
191
+ async function resolveDigitalHumanMenu(host, baseUrl, cache) {
192
+ const memoKey = baseUrl;
193
+ if (digitalMenuMemo.has(memoKey))
194
+ return digitalMenuMemo.get(memoKey) ?? null;
195
+ const legacy = await readLegacyCacheExtra(baseUrl);
196
+ if (legacy.digitalHumanMenu) {
197
+ digitalMenuMemo.set(memoKey, legacy.digitalHumanMenu);
198
+ return legacy.digitalHumanMenu;
199
+ }
200
+ // 从 all_search 菜单里按别名找(跨基线菜单名不同:面试数字人配置/数字人配置)
201
+ const allSearch = (cache.lists?.all_search || []);
202
+ const candidates = allSearch.filter((m) => m.listId);
203
+ let hit = (candidates.find((m) => (m.menuName || '').includes('面试数字人'))
204
+ || candidates.find((m) => (m.menuName || '').includes('数字人配置'))) ?? null;
205
+ digitalMenuMemo.set(memoKey, hit);
206
+ return hit;
207
+ }
208
+ const loaders = new Map();
209
+ export function createRecruitStageContext() {
210
+ return async (host) => {
211
+ const loaderKey = 'shared';
212
+ if (!loaders.has(loaderKey))
213
+ loaders.set(loaderKey, createRecruitContextLoader());
214
+ const cache = await loaders.get(loaderKey).load(host);
215
+ const baseUrl = (await host.getSession()).baseUrl.replace(/\/+$/, '');
216
+ const [defaultRecruitFlow, digitalHumanMenu] = await Promise.all([
217
+ resolveDefaultRecruitFlow(host, baseUrl, cache.appId, cache),
218
+ resolveDigitalHumanMenu(host, baseUrl, cache),
219
+ ]);
220
+ return { ...cache, defaultRecruitFlow, digitalHumanMenu };
221
+ };
222
+ }
223
+ /** 供 operation 内直接取上下文的辅助(失败统一转 rs 错误)。 */
224
+ export async function loadContext(host) {
225
+ try {
226
+ return await createRecruitStageContext()(host);
227
+ }
228
+ catch (e) {
229
+ throw rsFail(e?.message || '招聘环境上下文解析失败', { stage: 'context' });
230
+ }
231
+ }