weaver-work-cli 0.1.44 → 0.1.45

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 (179) hide show
  1. package/README.md +9 -5
  2. package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
  3. package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
  4. package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
  5. package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
  6. package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-CE3GMWTS.js} +3 -3
  7. package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
  8. package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
  9. package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
  10. package/dist/chunks/{chunk-CWYGFU5B.js → chunk-3WBIQLMB.js} +2 -2
  11. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  12. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-3ZMAQQ3W.js} +161 -33
  13. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-4EXOIQDI.js} +40 -10
  14. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-77YP6I52.js} +1 -1
  17. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  18. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-DGMYACGJ.js} +1 -1
  19. package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
  20. package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
  21. package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  22. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  23. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-JWWTI63L.js} +55 -5
  24. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-LGKWL4OH.js} +176 -39
  25. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-LRCPNDZA.js} +38 -6
  26. package/dist/chunks/{chunk-OF4S23UB.js → chunk-LXFVWZLM.js} +4 -4
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-OAE3AZBQ.js} +11 -11
  29. package/dist/chunks/chunk-P5GQRWDC.js +60 -0
  30. package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
  31. package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-T4MWQAQB.js} +7 -5
  32. package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
  33. package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
  34. package/dist/chunks/{chunk-FAZTGX7S.js → chunk-VIMCY4DI.js} +5 -5
  35. package/dist/chunks/chunk-VRPH24IC.js +76 -0
  36. package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
  37. package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
  38. package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-IYJETSGT.js} +2 -2
  39. package/dist/chunks/continuation-GW6PRWK3.js +12 -0
  40. package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
  41. package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
  42. package/dist/chunks/{create-flow-J22BO65E.js → create-flow-7JLC7UID.js} +6 -6
  43. package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
  44. package/dist/chunks/{ehr-GSTGAIY3.js → ehr-MYRDCHZ4.js} +121 -49
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-3MBHAWBL.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-TZEVU4DU.js} +1 -1
  49. package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
  50. package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-KL3HFKRM.js} +3 -3
  51. package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
  52. package/dist/chunks/host-7NTIBSPK.js +25 -0
  53. package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
  54. package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
  55. package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
  56. package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
  57. package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
  58. package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
  59. package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
  60. package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
  61. package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-UH6HGK2I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-C67EHQ4Z.js} +12 -12
  64. package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
  65. package/dist/chunks/operations-J7PUIVWZ.js +15 -0
  66. package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
  67. package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
  68. package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
  69. package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-AHY5QAMF.js} +450 -117
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  72. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  73. package/dist/chunks/{registry-IM5G23LS.js → registry-XPWPGHYE.js} +10 -10
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-CNWE5WQK.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-YYNYBQIE.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/index.js +30 -30
  78. package/dist/internal/e10/auth/commands.js +32 -0
  79. package/dist/internal/e10/auth/error-log.js +156 -26
  80. package/dist/internal/e10/auth/xiaoe.js +176 -13
  81. package/dist/internal/e10/context.js +12 -1
  82. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  83. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  84. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  85. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  86. package/dist/shortcuts/archive/operations/shared.js +52 -0
  87. package/dist/shortcuts/contract/host.js +111 -4
  88. package/dist/shortcuts/contract/index.js +19 -0
  89. package/dist/shortcuts/contract/manifest.js +125 -0
  90. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  91. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  92. package/dist/shortcuts/contract/operations/customer.js +192 -0
  93. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  94. package/dist/shortcuts/contract/operations/flow.js +44 -2
  95. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  96. package/dist/shortcuts/contract/operations/registry.js +8 -0
  97. package/dist/shortcuts/contract/operations/review.js +116 -1
  98. package/dist/shortcuts/contract/operations/summary.js +177 -0
  99. package/dist/shortcuts/contract/operations/upload.js +64 -4
  100. package/dist/shortcuts/contract/upload-cache.js +104 -0
  101. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +4 -2
  102. package/dist/shortcuts/ehr/operations/recruit-position.js +136 -35
  103. package/dist/shortcuts/ehr/operations/recruit-write.js +17 -18
  104. package/dist/shortcuts/ehr/operations/recruit.js +17 -5
  105. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  106. package/dist/shortcuts/meeting/operations/eb/create-flow.js +182 -58
  107. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  108. package/dist/shortcuts/meeting/operations/eb/factory.js +58 -3
  109. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  110. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +47 -5
  111. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  112. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  113. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +86 -16
  114. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +6 -4
  115. package/dist/shortcuts/recruit-stage/operations/jd-create.js +208 -56
  116. package/dist/shortcuts/recruit-stage/operations/resume-import.js +42 -16
  117. package/dist/shortcuts/recruit-stage/shared.js +161 -18
  118. package/dist/shortcuts/workflow/index.js +2 -0
  119. package/dist/shortcuts/workflow/operations/read.js +8 -3
  120. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  121. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  122. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  123. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  124. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  128. package/docs/contract.md +1 -0
  129. package/docs/e10-auth.md +4 -2
  130. package/docs/todo-smart-convert/data-contract.md +7 -0
  131. package/package.json +1 -1
  132. package/skill-template/domains/jinchengda.md +2 -0
  133. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  134. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  135. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  136. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  137. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  138. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  139. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  140. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  141. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  142. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  143. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  148. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  149. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  152. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  153. package/skills/weaver-e10-jucailin/references/recruit-create.md +5 -3
  154. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -2
  155. package/skills/weaver-e10-meeting/SKILL.md +57 -9
  156. package/skills/weaver-e10-recruit-stage/SKILL.md +11 -6
  157. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +10 -2
  158. package/skills/weaver-e10-recruit-stage/references/position-templates.md +3 -1
  159. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  160. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -18
  161. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  162. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +7 -1
  163. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  164. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  165. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  166. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  167. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  168. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  169. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  170. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  171. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  172. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  173. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  174. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  175. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  176. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  177. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  178. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  179. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -18,7 +18,9 @@
18
18
  *
19
19
  * 默认值策略(跨环境运行时解析、不写死 id):状态=招聘中;流程=环境默认启用流程;
20
20
  * 人数=1、薪酬月数=12;薪酬类型=月薪、招聘方式=社会招聘;
21
- * 招聘负责人/用人经理=当前登录用户;其余关联表单型取环境内已有职位记录的值("默认值=系统现成值")。
21
+ * 招聘负责人/用人经理=当前登录用户;工作地点=「办公地点」列表里启用状态的默认详细地址;
22
+ * 其余关联表单型取环境内已有职位记录的值("默认值=系统现成值")。
23
+ * ⚠️ 工作地点**不参与继承**:历史职位曾带出 detail_location 为「1」的脏地点。
22
24
  */
23
25
  import { createHash, randomBytes } from 'node:crypto';
24
26
  import { readFileSync } from 'node:fs';
@@ -26,7 +28,7 @@ import { resolve as resolvePath, dirname } from 'node:path';
26
28
  import { fileURLToPath } from 'node:url';
27
29
  import { rsSuccess, schemaOf } from './types.js';
28
30
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
29
- import { objIdOf, formIdOf, saveFormData, getDsOptions, cachedDsMap, getFormDataRecord, resolvePersonId, findMenuNode, resolveCurrentUser, buildCardUrl, buildListLocateUrl, randHex32, } from '../shared.js';
31
+ import { objIdOf, formIdOf, saveFormData, getDsOptions, getFormDataRecord, resolvePersonId, findMenuNode, resolveCurrentUser, buildCardUrl, buildListUrl, randHex32, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
30
32
  const SCHEMA_ID_STR = { type: 'string', description: '18 位记录 id(字符串)' };
31
33
  // 职位管理表单字段 dataKey(缓存 fields 里取;不写死 fieldId)
32
34
  const DATAKEYS_TEXT = ['position_name'];
@@ -35,12 +37,20 @@ const DATAKEYS_MTEXT = ['position_duty', 'work_request'];
35
37
  const DEF_TEXT = { recruit_count: '1', number_of_pay_months: '12' };
36
38
  const DEF_OPTION = { salary_type: '月薪', recruit_type: '社会招聘' };
37
39
  const DEF_CURRENT_USER = ['recr_principal', 'employ_manager'];
38
- // 🔴 薪资不继承:历史职位薪资可能是脏数据(实测抓到 300 元月薪),
39
- // 改为按 references/position-templates.md §1.1 的推荐表由 Agent 填入 sets,未指定就留空。
40
+ // 🔴 薪资(salary_min / salary_max)必须继承,不能留空:这两个字段是**职位表单必填项**,
41
+ // 不传会导致后端必填校验失败、建职位直接报错(2026-11-06 实测:移除继承后 willSubmit 无薪资字段)。
42
+ // 但历史薪资确实可能是脏数据(实测抓到 300 元月薪),因此不静默使用:
43
+ // 通过 summary.inheritedFromRef 暴露继承值,并对明显偏低的值追加 inheritedSalaryWarnings 提示。
40
44
  const DEF_FROM_REF = [
41
- 'position_nature', 'job_category', 'education', 'work_years', 'work_location',
45
+ 'position_nature', 'job_category', 'education', 'work_years',
46
+ 'salary_min', 'salary_max',
42
47
  ];
43
48
  const DEF_STATUS = '招聘中';
49
+ // 默认办公地点用「详细地址名称」声明,不写死记录 id:运行时到「办公地点」列表
50
+ // 按「启用」状态 + 详细地址精确匹配取 id。历史职位继承会把内容写成「1」的脏地点带进新职位
51
+ // (2026-11-06 实测:某在册地点 detail_location 就是 "1" 且状态为启用),故 work_location 已从
52
+ // DEF_FROM_REF 移除,改由本默认地点解析;匹配不到则不写该字段并点名,不臆造 id。
53
+ const DEFAULT_WORK_LOCATION = '浦江镇三鲁公路3419号泛微软件园';
44
54
  // sets 覆盖解析:字段取值类别
45
55
  const NUM_KEYS = new Set(['recruit_count', 'number_of_pay_months', 'salary_min', 'salary_max', 'internship_duration', 'working_days']);
46
56
  const PERSON_KEYS = new Set(['recr_principal', 'recr_helper', 'employ_manager', 'interviewer']);
@@ -152,45 +162,120 @@ async function findWorkPlaceMenu(ctx) {
152
162
  catch { /* 接口不可用则放弃 */ }
153
163
  return null;
154
164
  }
155
- // 工作地点:按名称/详细地址/城市解析「办公地点」记录 id
156
- async function resolveWorkLocation(ctx, value) {
157
- const { host, appId, cache } = ctx;
158
- const v = String(value).trim();
159
- if (!v)
160
- return null;
161
- // objId:优先按 tag 取;取不到时用菜单节点自带的(部分环境 tag 未注册)
162
- let pObj = '';
165
+ // 仅进程内 memo(不落盘):同一 CLI 进程内 prepare/apply 及多个 set 复用一次列表请求。
166
+ // 记录 id / 启用状态 optionId 一律运行时从列表解析,跨环境不缓存、不写死。
167
+ const workPlaceMemo = new Map();
168
+ function stripHtml(s) {
169
+ return String(s ?? '').replace(/<[^>]*>/g, '').trim();
170
+ }
171
+ function parseSpans(raw) {
163
172
  try {
164
- const t = await host.request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_work_place`, method: 'GET' });
165
- const d = t?.data;
166
- if (Array.isArray(d) && d[0])
167
- pObj = String(d[0].id || '');
173
+ const v = Array.isArray(raw) ? raw : JSON.parse(String(raw || '[]'));
174
+ return Array.isArray(v) ? v : [];
168
175
  }
169
- catch { /* tag 未注册:继续用菜单兜底 */ }
176
+ catch {
177
+ return [];
178
+ }
179
+ }
180
+ /** 「启用」判定:只读服务端翻译后的文本,不写死 optionId(跨环境 optionId 会变)。 */
181
+ function isEnabledText(s) {
182
+ const t = stripHtml(s);
183
+ return t.includes('启用') && !t.includes('禁用');
184
+ }
185
+ /** 拉取「办公地点」列表,按 place_status=启用 过滤;状态信息缺失时返回原始行并标记未过滤。 */
186
+ async function loadWorkPlaces(ctx) {
187
+ const { host, appId } = ctx;
170
188
  const menu = await findWorkPlaceMenu(ctx);
171
189
  if (!menu)
172
- return null;
173
- if (!pObj)
174
- pObj = String(menu.objId || '');
190
+ return { rows: [], statusFiltered: false };
191
+ const key = appId + '|' + menu.listId;
192
+ const cached = workPlaceMemo.get(key);
193
+ if (cached)
194
+ return cached;
195
+ const [tagObjId] = await Promise.all([
196
+ host
197
+ .request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_work_place`, method: 'GET' })
198
+ .then((t) => (Array.isArray(t?.data) && t.data[0] ? String(t.data[0].id || '') : ''))
199
+ .catch(() => ''),
200
+ ]);
201
+ const pObj = tagObjId || String(menu.objId || '');
175
202
  if (!pObj)
203
+ return { rows: [], statusFiltered: false };
204
+ const pageSize = 200;
205
+ const rawRows = [];
206
+ const dispRows = [];
207
+ for (let page = 1; page <= 5; page++) {
208
+ const body = {
209
+ current: page, pageSize, tableuid: randHex32(),
210
+ listId: menu.listId, searchParamData: { searchType: '3', type: 'and' },
211
+ terminal: 'PC', browser: 'Chrome', requiredMatch: 1, mapResult: 1,
212
+ recheckQuery: 1, isFollow: 0, isShareToMe: 0, filterCondition: {},
213
+ cusMenuId: menu.cusMenuId, urlPageTitle: menu.menuName, menuName: menu.menuName,
214
+ };
215
+ const r = await host.request({
216
+ path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`,
217
+ body, headers: { ebBusinessId: menu.listId },
218
+ });
219
+ const batch = (r?.data?.data || r?.data?.displayData || []);
220
+ rawRows.push(...batch);
221
+ dispRows.push(...(r?.data?.displayData || []));
222
+ if (batch.length < pageSize)
223
+ break; // 服务端 total/hasMore 不可信,唯一可靠判据是分页本身
224
+ }
225
+ // 从 displayData 学「启用」对应的 optionId 集合与行 id 集合(两种形态都兼容)
226
+ const enabledStatusIds = new Set();
227
+ const enabledRowIds = new Set();
228
+ for (const d of dispRows) {
229
+ const rid = String(d?.form_data_id || d?.id || '');
230
+ if (isEnabledText(d?.place_status) && rid)
231
+ enabledRowIds.add(rid);
232
+ for (const s of parseSpans(d?.place_statusSpan)) {
233
+ if (isEnabledText(s?.name) && s?.id)
234
+ enabledStatusIds.add(String(s.id));
235
+ }
236
+ }
237
+ const statusFiltered = enabledRowIds.size > 0 || enabledStatusIds.size > 0;
238
+ const rows = rawRows
239
+ .filter((x) => !statusFiltered
240
+ || enabledRowIds.has(String(x?.form_data_id || x?.id || ''))
241
+ || enabledStatusIds.has(String(x?.place_status || '')))
242
+ .map((x) => ({
243
+ id: String(x?.form_data_id || x?.id || ''),
244
+ name: String(x?.name || ''),
245
+ detail: String(x?.detail_location || ''),
246
+ area: String(x?.area_text || ''),
247
+ city: String(x?.city || ''),
248
+ }))
249
+ .filter((x) => !!x.id);
250
+ const out = { rows, statusFiltered };
251
+ workPlaceMemo.set(key, out);
252
+ return out;
253
+ }
254
+ /** 精确匹配优先;包含匹配要求地址文本足够长且非纯数字,避免把内容写成「1」的脏地点选中。 */
255
+ function matchWorkPlace(rows, value) {
256
+ const v = String(value).trim();
257
+ if (!v || !rows.length)
176
258
  return null;
177
- const body = {
178
- current: 1, pageSize: 200, tableuid: randHex32(),
179
- listId: menu.listId, searchParamData: { searchType: '3', type: 'and' },
180
- terminal: 'PC', browser: 'Chrome', requiredMatch: 1, mapResult: 1,
181
- recheckQuery: 1, isFollow: 0, isShareToMe: 0, filterCondition: {},
182
- cusMenuId: menu.cusMenuId, urlPageTitle: menu.menuName, menuName: menu.menuName,
183
- };
184
- const r = await host.request({ path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`, body, headers: { ebBusinessId: menu.listId } });
185
- // displayData 是服务端翻译后的可读文本;data 为原始行 —— 两者都兜
186
- const rows = r?.data?.data || r?.data?.displayData || [];
187
- const hit = rows.find((x) => {
188
- const name = String(x.name || x.detail_location || '');
189
- const detail = String(x.detail_location || '');
190
- const area = String(x.area_text || '');
191
- return name.includes(v) || detail.includes(v) || area.includes(v) || (detail && v.includes(detail));
192
- });
193
- return hit ? { id: String(hit.form_data_id || hit.id), name: String(hit.detail_location || hit.name || v) } : null;
259
+ const exact = rows.find((r) => r.detail === v) || rows.find((r) => r.name === v);
260
+ if (exact)
261
+ return exact;
262
+ const valid = (s) => s.length >= 4 && !/^\d+$/.test(s);
263
+ return rows.find((r) => (r.detail.includes(v) && valid(r.detail))
264
+ || (r.name.includes(v) && valid(r.name))
265
+ || (r.area.includes(v) && valid(r.area))
266
+ || (v.includes(r.detail) && valid(r.detail))) || null;
267
+ }
268
+ // 工作地点:按名称/详细地址/城市解析「办公地点」记录 id(只在启用记录中匹配)
269
+ async function resolveWorkLocation(ctx, value) {
270
+ if (!String(value).trim())
271
+ return null;
272
+ const { rows } = await loadWorkPlaces(ctx);
273
+ const hit = matchWorkPlace(rows, value);
274
+ return hit ? { id: hit.id, name: hit.detail || hit.name || String(value) } : null;
275
+ }
276
+ /** 默认办公地点:按声明的详细地址在启用列表中精确解析 id,解析不到返回 null(不写、不继承)。 */
277
+ async function resolveDefaultWorkLocation(ctx) {
278
+ return resolveWorkLocation(ctx, DEFAULT_WORK_LOCATION);
194
279
  }
195
280
  // 解析 sets key=value → 提交 detail(按字段取值类别;解析不到返回 null)
196
281
  async function resolveSetValue(ctx, key, value, refByFid) {
@@ -199,8 +284,18 @@ async function resolveSetValue(ctx, key, value, refByFid) {
199
284
  const id = (cache.fields[objId] || {})[key];
200
285
  if (!id)
201
286
  return null;
202
- if (NUM_KEYS.has(key))
287
+ if (NUM_KEYS.has(key)) {
288
+ // 薪资字段单位是「千元」(页面 15.00 = 15K,与字段 ID 交叉验证);用户/Agent 传的是「元」。
289
+ // 只对**显式输入**换算;从已有职位继承的值本来就是千元,绝不能再除一次。
290
+ if (key === 'salary_min' || key === 'salary_max') {
291
+ const n = Number(String(value).replace(/,/g, ''));
292
+ if (Number.isFinite(n) && n > 0) {
293
+ const k = n / 1000;
294
+ return { formField: { id }, content: String(Number.isInteger(k) ? k : Number(k.toFixed(3))) };
295
+ }
296
+ }
203
297
  return { formField: { id }, content: String(value) };
298
+ }
204
299
  if (MTEXT_KEYS.has(key))
205
300
  return { formField: { id }, dataText: { content: String(value) } };
206
301
  if (key === 'position_name')
@@ -210,7 +305,7 @@ async function resolveSetValue(ctx, key, value, refByFid) {
210
305
  return uid ? { formField: { id }, dataOptions: [{ optionId: String(uid), content: value }] } : null;
211
306
  }
212
307
  if (OPTION_KEYS.has(key)) {
213
- const m = cachedDsMap(cache, objId, key) || await getDsOptions(host, objId, id, appId);
308
+ const m = await getDsOptions(host, objId, id);
214
309
  const oid = m[value];
215
310
  return oid ? { formField: { id }, dataOptions: [{ optionId: String(oid), content: value }] } : null;
216
311
  }
@@ -368,6 +463,10 @@ async function buildJd(opts) {
368
463
  for (const k of DATAKEYS_MTEXT)
369
464
  if (!fid(k))
370
465
  throw rsFail('职位管理缺少字段 ' + k + '(ds/fields 解析不到)');
466
+ // 并行预取:refByFid(sets 解析依赖它)与 currentUser(仅第⑤步用,与 sets 无依赖)
467
+ // 同时发出,避免过去「先等 refByFid → 再逐 set 串行 → 最后才取 currentUser」的多余 RTT。
468
+ const currentUserPromise = resolveCurrentUser(host)
469
+ .catch(() => null);
371
470
  const refByFid = await fetchRefByFid(ctx);
372
471
  const map = new Map();
373
472
  const put = (d) => { if (d && d.formField && d.formField.id)
@@ -385,10 +484,13 @@ async function buildJd(opts) {
385
484
  put({ formField: { id: fid('demand') }, dataOptions: [{ optionId: String(demandId), content: demandName || String(demandId) }] });
386
485
  }
387
486
  // ② sets 覆盖(AI 依 JD 指定;优先于自动默认值)
487
+ // 各项之间互不依赖(都只读 refByFid 与字典缓存),因此并行解析:
488
+ // 原实现逐个 await,6 个 set 就要串 6 次 RTT(含 work_location 内部 2~3 次请求),是 prepare 的主要串行瓶颈。
489
+ // 仍按原顺序 put,保证同一 key 多次出现时「后者覆盖前者」的语义不变。
388
490
  const appliedSets = [];
389
491
  const skippedSets = [];
390
- for (const [k, v] of sets) {
391
- const d = await resolveSetValue(ctx, k, v, refByFid);
492
+ const resolvedSets = await Promise.all(sets.map(async ([k, v]) => ({ k, v, d: await resolveSetValue(ctx, k, v, refByFid).catch(() => null) })));
493
+ for (const { k, v, d } of resolvedSets) {
392
494
  if (d) {
393
495
  put(d);
394
496
  appliedSets.push(k + '=' + v);
@@ -401,7 +503,7 @@ async function buildJd(opts) {
401
503
  if (!hasKey('status')) {
402
504
  if (!fid('status'))
403
505
  throw rsFail('职位管理缺少字段 status(ds/fields 解析不到)');
404
- const statusMap = cachedDsMap(cache, objId, 'status') || await getDsOptions(host, objId, fid('status'), appId);
506
+ const statusMap = await getDsOptions(host, objId, fid('status'));
405
507
  const statusId = statusMap[DEF_STATUS];
406
508
  if (!statusId)
407
509
  throw rsFail('职位管理「招聘状态」未解析到「' + DEF_STATUS + '」选项(ds/options 返回为空)');
@@ -416,7 +518,7 @@ async function buildJd(opts) {
416
518
  const filled = [];
417
519
  let currentUser = null;
418
520
  if (DEF_CURRENT_USER.some((k) => fid(k) && !hasKey(k))) {
419
- currentUser = await resolveCurrentUser(host);
521
+ currentUser = await currentUserPromise;
420
522
  if (currentUser && currentUser.id) {
421
523
  for (const k of DEF_CURRENT_USER) {
422
524
  if (fid(k) && !hasKey(k)) {
@@ -435,7 +537,7 @@ async function buildJd(opts) {
435
537
  }
436
538
  for (const [k, name] of Object.entries(DEF_OPTION)) {
437
539
  if (fid(k) && !hasKey(k)) {
438
- const m = cachedDsMap(cache, objId, k) || await getDsOptions(host, objId, fid(k), appId);
540
+ const m = await getDsOptions(host, objId, fid(k));
439
541
  const oid = m[name];
440
542
  if (oid) {
441
543
  put({ formField: { id: fid(k) }, dataOptions: [{ optionId: String(oid), content: name }] });
@@ -458,6 +560,34 @@ async function buildJd(opts) {
458
560
  }
459
561
  }
460
562
  }
563
+ // 继承来的薪资若明显偏低(历史脏数据,实测出现过 300 元月薪),额外点名提示。
564
+ // 不阻断提交(薪资是必填项,阻断等于无法建档),但要求 Agent 在确认摘要里明确提示用户核对。
565
+ const inheritedSalaryWarnings = [];
566
+ for (const key of ['salary_min', 'salary_max']) {
567
+ const hit = inheritedFromRef.find((x) => x.field === key);
568
+ if (!hit)
569
+ continue;
570
+ const num = Number(String(hit.value).replace(/[^\d.]/g, ''));
571
+ // 继承值单位也是千元:18 = 18K 正常;低于 1(<1000元)或高于 100(>10万/月)才算异常
572
+ if (hit.value && Number.isFinite(num) && (num < 1 || num > 100)) {
573
+ inheritedSalaryWarnings.push(key + ' 继承值「' + hit.value + '」(千元)明显异常,请人工核对后再提交');
574
+ }
575
+ }
576
+ // ⑦ 工作地点默认值:不再从历史职位继承(实测会把 detail_location 为「1」的脏地点带进新职位),
577
+ // 改为在「办公地点」列表按「启用」状态 + 详细地址精确解析;解析不到则不写并点名。
578
+ let workLocationDefault = null;
579
+ let workLocationWarning = null;
580
+ if (!hasKey('work_location') && fid('work_location')) {
581
+ const loc = await resolveDefaultWorkLocation(ctx).catch(() => null);
582
+ if (loc) {
583
+ put({ formField: { id: fid('work_location') }, dataOptions: [{ optionId: loc.id, content: loc.name }] });
584
+ filled.push('work_location');
585
+ workLocationDefault = loc.name;
586
+ }
587
+ else {
588
+ workLocationWarning = `未在「办公地点」列表找到启用状态的默认地点「${DEFAULT_WORK_LOCATION}」,本次不写 work_location;请用 sets 指定`;
589
+ }
590
+ }
461
591
  const inv = {};
462
592
  for (const [k, v] of Object.entries(fields))
463
593
  inv[String(v)] = k;
@@ -477,11 +607,14 @@ async function buildJd(opts) {
477
607
  setApplied: appliedSets,
478
608
  setSkipped: skippedSets,
479
609
  // 明示哪些字段值继承自「环境内最近一条职位记录」——这些不是用户指定的,可能来自脏数据,
480
- // 必须在确认摘要里人工核对(尤其 work_location)
610
+ // 必须在确认摘要里人工核对(工作地点不参与继承,见 workLocationDefault)
481
611
  inheritedFromRef: inheritedFromRef.length ? inheritedFromRef : undefined,
612
+ inheritedSalaryWarnings: inheritedSalaryWarnings.length ? inheritedSalaryWarnings : undefined,
482
613
  inheritedNote: inheritedFromRef.length
483
- ? '以上字段未指定,值继承自环境内最近一条职位记录,可能含历史脏数据(如重复地点),请核对后再提交'
614
+ ? '以上字段未指定,值继承自环境内最近一条职位记录,可能含历史脏数据,请核对后再提交(工作地点不参与继承)'
484
615
  : undefined,
616
+ workLocationDefault: workLocationDefault || undefined,
617
+ workLocationWarning: workLocationWarning || undefined,
485
618
  requiredDefaultsFilled,
486
619
  },
487
620
  };
@@ -509,6 +642,9 @@ async function prepare(args, env) {
509
642
  const session = await host.getSession();
510
643
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
511
644
  ctx.appId = ctx.cache.appId;
645
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, 'position_manage'));
646
+ if (perm === 'denied')
647
+ throw rsFail('当前账号没有「职位管理」表单的创建权限,已阻断(未写入任何数据)');
512
648
  const positionName = String(args.positionName || '').trim();
513
649
  if (!positionName)
514
650
  throw rsValidationError('position_name_required', 'positionName 必填');
@@ -535,7 +671,8 @@ async function prepare(args, env) {
535
671
  // fingerprint 必须基于完整 dataDetails(apply 阶段比对同一口径),回执里才做瘦身。
536
672
  const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
537
673
  const fp = fingerprint(willSubmit);
538
- const continuation = await env.continuation.issue({ operation: 'recruit-stage.jd.create.apply', fingerprint: fp });
674
+ const continuation = await env.continuation.issue({ operation: 'recruit-stage.jd.create.apply', fingerprint: fp,
675
+ enumMaps: await dsOptionsSnapshot() });
539
676
  // 回执瘦身:willSubmit 只输出字段名清单(不含内部 fieldId),continuation 提到首部——
540
677
  // 避免大输出被截断导致 Agent 取不到 continuation 而重复调用 prepare(实测多花 10.7s)。
541
678
  const invFieldKeys = {};
@@ -570,6 +707,7 @@ async function apply(args, env) {
570
707
  if (!args.continuation)
571
708
  throw rsValidationError('continuation_required', '缺少 continuation(来自 prepare 的 meta)');
572
709
  const payload = await env.continuation.verify(String(args.continuation), 'recruit-stage.jd.create.apply');
710
+ restoreDsOptions(payload.enumMaps);
573
711
  const host = env.host;
574
712
  const session = await host.getSession();
575
713
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
@@ -599,24 +737,38 @@ async function apply(args, env) {
599
737
  const positionPostId = data.positionPostId;
600
738
  const checkRpa = data.checkRpa;
601
739
  const rpaValidMsg = data.rpaValidMsg || null;
602
- const created = r2?.status !== false && !!positionPostId;
603
- const listUrl = await resolvePositionNewUrl(ctx).catch(() => null);
740
+ // 页面真实响应:外层 status=true、data.status=false(业务子状态,不是失败)、fail=false、
741
+ // successMsg=操作成功,且可能没有 positionPostId。旧逻辑强依赖 positionPostId 会把成功误判为 failed。
742
+ const okByResponse = r2?.status !== false && r2?.fail !== false && data.fail !== true;
743
+ // 第三层门禁:写完回查记录与关键字段,作为最终判定(接口语义不一致时以落库为准)
744
+ const verification = await verifySubmitted({
745
+ host, formId: jd.formId, objId: jd.objId, dataId: formDataId,
746
+ expected: expectedFields(jd.dataDetails, ctx.cache.fields[jd.objId] || {}, ['position_name', 'status', 'salary_min', 'salary_max', 'work_location'], ['position_name', 'status'], ['salary_min', 'salary_max', 'work_location']),
747
+ });
748
+ if (verification.mismatches.length)
749
+ invalidateEnvCache(ctx.baseUrl, ctx.appId);
750
+ const recordOk = verification.unavailable ? okByResponse : verification.mismatches.length === 0;
751
+ const created = okByResponse && recordOk;
752
+ const result = !created ? 'failed' : (verification.mismatches.length ? 'partial' : 'success');
753
+ // 列表链接只打开列表;详情单页由 viewLink 单独给出,两者不再合并成一个「列表+滑出详情」地址。
754
+ const listUrl = buildListUrl(ctx.baseUrl, (ctx.cache.lists?.position?.listId) || '');
604
755
  const cardUrl = buildCardUrl(ctx.baseUrl, jd.objId, formDataId);
605
- const locateUrl = buildListLocateUrl(ctx.baseUrl, ctx.appId, (ctx.cache.lists?.position?.listId) || '', jd.objId, formDataId);
606
756
  return rsSuccess('recruit-stage.jd.create.apply', {
607
757
  mode: 'apply',
608
- result: created ? 'success' : 'failed',
758
+ result,
609
759
  formDataId,
610
760
  positionPostId: positionPostId || null,
611
761
  rpaChecked: checkRpa === undefined ? null : !!checkRpa,
612
762
  rpaValidMsg,
613
- positionListUrl: listUrl || null,
763
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
764
+ verifyWarnings: verification.mismatches.map((m) => '落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual),
765
+ positionListUrl: listUrl,
614
766
  positionCardUrl: cardUrl,
615
- positionListLocateUrl: locateUrl,
767
+ positionListLocateUrl: listUrl,
616
768
  // 产物链接(Agent 原样搬运成 Markdown 链接,按顺序:详情在前、列表在后)
617
769
  viewLink: cardUrl ? `[查看 ${jd.summary.positionName || '新建职位'} 职位详情](${cardUrl})` : null,
618
- listLocateLink: (locateUrl || listUrl) ? `[打开招聘岗位列表(已定位新建职位)](${locateUrl || listUrl})` : null,
619
- agentNote: '查看入口 = 两个 Markdown 链接(平台实证可点击):按顺序原样搬运 viewLink 与 listLocateLink;不要包 browsertool 标签。链接只是查看入口,重复点击不会重复创建。',
770
+ listLocateLink: listUrl ? `[打开职位列表](${listUrl})` : null,
771
+ agentNote: '查看入口 = 两个 Markdown 链接:① viewLink 职位详情单页 ② listLocateLink 职位列表(只打开列表,不打开详情)。按顺序原样搬运,不要包 browsertool 标签;缺哪个只给另一个。链接只是查看入口,重复点击不会重复创建。',
620
772
  ...jd.summary,
621
773
  });
622
774
  }
@@ -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, } from '../shared.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';
26
26
  // 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
27
27
  const PROTECTED_UPDATE_KEYS = ['is_blacklist', 'recruit_status', 'candidate_status', 'data_status'];
28
28
  // ── 上传简历文件(两步:preUploadCheck 取 preUploadId → module/upload 带 file)→ fileid ──
@@ -339,16 +339,24 @@ function makeBriefReader(ctx, formId, objId, fields) {
339
339
  // 人才卡片 URL(环境缓存 ebdDetailPageId;自用系统追加 recruitType=useSelf)
340
340
  function resolveTalentCardUrl(ctx, talentId) {
341
341
  const pid = ctx.cache.ebdDetailPageId;
342
- if (!pid)
343
- return null;
342
+ if (!pid || !talentId) {
343
+ // 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
344
+ // objId 从环境缓存 talent_pool 取,跨环境动态解析,绝不写死。
345
+ const forms = ctx.cache.forms || {};
346
+ const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || '');
347
+ return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
348
+ }
344
349
  return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
345
350
  }
346
- // 人才库列表并打开指定人才:{baseUrl}/sp/ebdfpage/list/{listId}?talentId={id}&recruitType=useSelf
347
- function resolveTalentListLocateUrl(ctx, talentId) {
351
+ // 人才库列表(只打开列表):{baseUrl}/sp/ebdfpage/list/{listId}
352
+ // 2026-11-06 用户定稿:列表链接不携带 /card/... 段,也不拼 talentId 等 query,
353
+ // 避免打开列表时一同滑出人才详情单页;人才卡片由 talentCardUrl 单独给出。
354
+ // listId 取环境缓存 lists.talent.listId(运行时解析,跨环境不写死)。
355
+ function resolveTalentListLocateUrl(ctx, _talentId) {
348
356
  const listId = ctx.cache.lists?.talent?.listId;
349
- if (!listId || !talentId)
357
+ if (!listId)
350
358
  return null;
351
- return `${ctx.baseUrl}/sp/ebdfpage/list/${listId}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
359
+ return `${ctx.baseUrl.replace(/\/+$/, '')}/sp/ebdfpage/list/${listId}`;
352
360
  }
353
361
  // 读记录快照(更新前算 diff):主表 {dataKey: 展示值} + 各子表行数/格数
354
362
  async function readTalentSnapshot(ctx, opts) {
@@ -883,10 +891,10 @@ async function buildImport(ctx, args) {
883
891
  dataDetails.push({ formField: { id: fields.channel }, dataOptions: [{ optionId: String(manualId), content: '手动录入' }] });
884
892
  channelLabel = '手动录入(固定)';
885
893
  }
886
- // 是否黑名单:固定「否」(选项 id 运行时按名称反查)
894
+ // 是否黑名单:固定「否」——写路径按缓存方案 A 走权威 ds/options(不读盘 field_options)
887
895
  if (fields.is_blacklist) {
888
- const opt = (cache.field_options?.[objId] || {})[fields.is_blacklist] || {};
889
- const noId = Object.keys(opt).find((k) => opt[k] === '否');
896
+ const opt = await getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}));
897
+ const noId = opt['否'];
890
898
  if (noId)
891
899
  dataDetails.push({ formField: { id: fields.is_blacklist }, dataOptions: [{ optionId: String(noId), content: '否' }] });
892
900
  }
@@ -1008,6 +1016,9 @@ async function prepare(args, env) {
1008
1016
  const session = await host.getSession();
1009
1017
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
1010
1018
  ctx.appId = ctx.cache.appId;
1019
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, 'talent_pool'));
1020
+ if (perm === 'denied')
1021
+ throw rsFail('当前账号没有「人才库」表单的创建权限,已阻断(未写入任何数据)');
1011
1022
  const argsT = args;
1012
1023
  if (!argsT.structured && !argsT.structuredFile && !argsT.fileId && !argsT.resumeFile) {
1013
1024
  throw rsValidationError('input_required', '需要 structured/structuredFile/fileId/resumeFile 之一');
@@ -1067,7 +1078,8 @@ async function prepare(args, env) {
1067
1078
  catch { /* 查不到批次不影响更新 */ }
1068
1079
  const willSubmit = { updateTalentId, mainTable: fingerprintMainTable(upMain), details: built.detailsPayload };
1069
1080
  const fp = fingerprint(willSubmit);
1070
- const continuation = await env.continuation.issue({ operation: 'recruit-stage.resume.import.apply', fingerprint: fp });
1081
+ const continuation = await env.continuation.issue({ operation: 'recruit-stage.resume.import.apply', fingerprint: fp,
1082
+ enumMaps: await dsOptionsSnapshot() });
1071
1083
  return rsSuccess('recruit-stage.resume.import.prepare', {
1072
1084
  mode: 'prepare-update',
1073
1085
  action: '按简历更新已有人才',
@@ -1138,7 +1150,8 @@ async function prepare(args, env) {
1138
1150
  };
1139
1151
  const willSubmit = { formId: built.formId, objId: built.objId, mainTable: fingerprintMainTable(toDatasetMainTable(built.dataDetails, built.fields)), details: built.detailsPayload };
1140
1152
  const fp = fingerprint(willSubmit);
1141
- const continuation = await env.continuation.issue({ operation: 'recruit-stage.resume.import.apply', fingerprint: fp });
1153
+ const continuation = await env.continuation.issue({ operation: 'recruit-stage.resume.import.apply', fingerprint: fp,
1154
+ enumMaps: await dsOptionsSnapshot() });
1142
1155
  return rsSuccess('recruit-stage.resume.import.prepare', {
1143
1156
  mode: 'prepare', ...summary,
1144
1157
  willSubmit,
@@ -1153,6 +1166,7 @@ async function apply(args, env) {
1153
1166
  if (!args.continuation)
1154
1167
  throw rsValidationError('continuation_required', '缺少 continuation(来自 prepare 的 meta)');
1155
1168
  const payload = await env.continuation.verify(String(args.continuation), 'recruit-stage.resume.import.apply');
1169
+ restoreDsOptions(payload.enumMaps);
1156
1170
  const host = env.host;
1157
1171
  const session = await host.getSession();
1158
1172
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
@@ -1294,14 +1308,26 @@ async function apply(args, env) {
1294
1308
  : { applied: [], skipped: built.tagNames, error: tagRes.e?.message };
1295
1309
  // 标签回读依赖写入结果,放在并行组之后(写操作可验证优先)
1296
1310
  const tags = await queryEntityTags(host, talentId).catch(() => []);
1311
+ // 第三层门禁:主表关键字段落库回查(明细行由 verifySubRows 单独校验)
1312
+ const verification = await verifySubmitted({
1313
+ host, formId: built.formId, objId: built.objId, dataId: newId,
1314
+ expected: expectedFields(built.dataDetails, built.fields, ['candidate_name', 'telephone', 'email'], [], ['email']),
1315
+ });
1316
+ if (verification.mismatches.length) {
1317
+ invalidateEnvCache(ctx.baseUrl, ctx.appId);
1318
+ for (const m of verification.mismatches)
1319
+ writeWarnings.push('落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual);
1320
+ }
1321
+ const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
1297
1322
  const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
1298
1323
  const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
1299
1324
  return rsSuccess('recruit-stage.resume.import.apply', {
1300
- mode: 'apply', result: detailsState === 'complete' ? 'success' : 'partial',
1325
+ mode: 'apply', result,
1301
1326
  detailsState,
1302
1327
  newCandidateFormDataId: newId,
1303
1328
  talentId,
1304
1329
  writeChannel,
1330
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
1305
1331
  writeWarnings: writeWarnings.length ? writeWarnings : undefined,
1306
1332
  subTablesExpected: built.subBuild.stats,
1307
1333
  subTableVerify,
@@ -1314,10 +1340,10 @@ async function apply(args, env) {
1314
1340
  tags,
1315
1341
  talentCardUrl,
1316
1342
  talentListLocateUrl,
1317
- // 产物链接(Agent 原样搬运:① 人才卡片 ② 人才库定位;缺失哪个只给另一个)
1343
+ // 产物链接(Agent 原样搬运:① 人才卡片单页 ② 人才库列表;缺失哪个只给另一个)
1318
1344
  viewLink: talentCardUrl ? `[查看 ${built.structured.candidateName || '新人才'} 的人才卡片](${talentCardUrl})` : null,
1319
- listLocateLink: talentListLocateUrl ? `[在人才库中打开](${talentListLocateUrl})` : null,
1320
- agentNote: '正文给两个 Markdown 链接——① [查看 <姓名> 的人才卡片](talentCardUrl) ② [在人才库中打开](talentListLocateUrl);缺失哪个就只给另一个,不输出半截。不要用 artifact / browsertool。',
1345
+ listLocateLink: talentListLocateUrl ? `[打开人才库列表](${talentListLocateUrl})` : null,
1346
+ agentNote: '正文给两个 Markdown 链接——① [查看 <姓名> 的人才卡片](talentCardUrl) 详情单页 ② [打开人才库列表](talentListLocateUrl) 只打开列表、不打开详情;缺失哪个就只给另一个,不输出半截。不要用 artifact / browsertool。',
1321
1347
  parsed: {
1322
1348
  name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || '(空)',
1323
1349
  gender: built.structured.genderName, degree: built.structured.highest_degree_name, college: built.structured.college,