weaver-work-cli 0.1.70 → 0.1.73

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 (263) hide show
  1. package/dist/chunks/{archive-VUTREF3P.js → archive-THZV4ND4.js} +22 -5
  2. package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-PQ23OLEV.js} +17 -5
  3. package/dist/chunks/{asset-45U6TY7I.js → asset-RGPROZYH.js} +22 -5
  4. package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-Z2PDX7NA.js} +15 -5
  5. package/dist/chunks/{attachment-content-DMU7KNZ7.js → attachment-content-R3RPVOYE.js} +3 -3
  6. package/dist/chunks/{blog-5AML4WMG.js → blog-7U3QZPIF.js} +25 -5
  7. package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-3AB42GCV.js} +22 -8
  8. package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-KINM64E4.js} +15 -5
  9. package/dist/chunks/{chunk-EHH363SP.js → chunk-2CHGUYMG.js} +4 -4
  10. package/dist/chunks/{chunk-GWM5TLIK.js → chunk-2XED2FKY.js} +34 -34
  11. package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
  12. package/dist/chunks/{chunk-QYDSTYGG.js → chunk-4BXR6CNB.js} +3 -3
  13. package/dist/chunks/{chunk-KDOJW5LH.js → chunk-4I26YMBY.js} +1 -1
  14. package/dist/chunks/{chunk-X6PMJQGO.js → chunk-4YXAK6OA.js} +19 -8
  15. package/dist/chunks/{chunk-HG6INLH6.js → chunk-54ST55IJ.js} +28 -7
  16. package/dist/chunks/{chunk-DSBV4GRK.js → chunk-6HT73VOI.js} +3 -3
  17. package/dist/chunks/{chunk-4W6BSNIL.js → chunk-7QFVXP2X.js} +6 -6
  18. package/dist/chunks/{chunk-I5XB4MZT.js → chunk-AMAPQVBT.js} +95 -65
  19. package/dist/chunks/{chunk-L2A3COWV.js → chunk-BWYVS62Z.js} +4 -4
  20. package/dist/chunks/{chunk-UPVAQJKS.js → chunk-DRUND2PJ.js} +130 -79
  21. package/dist/chunks/{chunk-LJE7RZNC.js → chunk-F4HM25K4.js} +1 -1
  22. package/dist/chunks/{chunk-T24EBWAZ.js → chunk-GAMGDNTF.js} +48 -21
  23. package/dist/chunks/{chunk-H2NRTGZR.js → chunk-GWJLAF6B.js} +3 -3
  24. package/dist/chunks/{chunk-XIBMZEDB.js → chunk-IBSJJGXL.js} +2 -2
  25. package/dist/chunks/{chunk-VZUH3LKI.js → chunk-ICP53R52.js} +167 -157
  26. package/dist/chunks/{chunk-LRKKKO5A.js → chunk-IU6UB2TD.js} +3 -4
  27. package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
  28. package/dist/chunks/{chunk-727VKJQK.js → chunk-JMJBPP4B.js} +2 -2
  29. package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-L7TYG5SN.js} +3 -3
  30. package/dist/chunks/{chunk-HAORST2G.js → chunk-LLCMOZ5L.js} +11 -11
  31. package/dist/chunks/{chunk-U3OO3IZF.js → chunk-NUP4RYZK.js} +20 -7
  32. package/dist/chunks/{chunk-IVCOZCAW.js → chunk-PAFOLIYQ.js} +1 -1
  33. package/dist/chunks/{chunk-LSVA7QA6.js → chunk-R3MK2RBN.js} +3 -1
  34. package/dist/chunks/{chunk-GFOFUH6O.js → chunk-TV46Q4NY.js} +52 -51
  35. package/dist/chunks/chunk-WM33BSIL.js +136 -0
  36. package/dist/chunks/{chunk-7CINV2BU.js → chunk-XZBYRYWX.js} +2 -2
  37. package/dist/chunks/{chunk-E7VWE2XI.js → chunk-ZWLWXHJC.js} +3 -3
  38. package/dist/chunks/{conflict-YW5BULJ3.js → conflict-VPAR7E6F.js} +2 -2
  39. package/dist/chunks/{contract-3PMHUASH.js → contract-DDXAO2DZ.js} +48 -5
  40. package/dist/chunks/{cowork-FZBTTBYX.js → cowork-34QCHMDD.js} +37 -8
  41. package/dist/chunks/{create-flow-5OBS3B3V.js → create-flow-52PU2OBI.js} +6 -6
  42. package/dist/chunks/{data-2YZ6A6TL.js → data-CLQ62QGD.js} +99 -184
  43. package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-W5R7Q22S.js} +17 -7
  44. package/dist/chunks/{ehr-MNPR4TE5.js → ehr-LCNAVMK5.js} +67 -17
  45. package/dist/chunks/{entry-mode-L65OWPFM.js → entry-mode-6Z3ZV3DE.js} +3 -3
  46. package/dist/chunks/{env-XW7LYIME.js → env-RDKWAARB.js} +2 -2
  47. package/dist/chunks/{esb-GSB5QCEX.js → esb-ANKPUU65.js} +17 -7
  48. package/dist/chunks/{factory-MHFZZAGH.js → factory-434B7RAT.js} +1 -1
  49. package/dist/chunks/{fna-XBSNUS2V.js → fna-AKBSG5HI.js} +15 -5
  50. package/dist/chunks/{group-chat-EEOLO5NM.js → group-chat-PROTW22R.js} +3 -3
  51. package/dist/chunks/{host-NVDG3NC6.js → host-5R2SNFWD.js} +4 -4
  52. package/dist/chunks/{host-2UMNXX5H.js → host-7FJW4E7R.js} +4 -4
  53. package/dist/chunks/{host-XVWBOSEN.js → host-CGXUFQO4.js} +4 -4
  54. package/dist/chunks/{host-R7BP3CTI.js → host-PDJAKCT7.js} +6 -4
  55. package/dist/chunks/{host-SYPCA63D.js → host-WO4L5G5I.js} +4 -4
  56. package/dist/chunks/{host-BD44ASOD.js → host-XIYG4F4B.js} +4 -4
  57. package/dist/chunks/{hrm-FZUDJAND.js → hrm-WGODDTEH.js} +15 -6
  58. package/dist/chunks/{im-F5NENPD7.js → im-YKTKAJU3.js} +16 -6
  59. package/dist/chunks/{invoice-DS6FLU55.js → invoice-PVYCCCVM.js} +27 -6
  60. package/dist/chunks/{jiuchuanhui-JCBUR563.js → jiuchuanhui-RKOQW7BY.js} +19 -6
  61. package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-DW45AFQ5.js} +6 -6
  62. package/dist/chunks/{mail-ZEOSANEJ.js → mail-BNB5S4NW.js} +116 -97
  63. package/dist/chunks/{meeting-PCD5EPBF.js → meeting-O2KDJH66.js} +29 -16
  64. package/dist/chunks/{minute-doc-WTZJVCHG.js → minute-doc-JUCG56GY.js} +4 -4
  65. package/dist/chunks/{okr-OZUMTMCL.js → okr-LWFGWOE7.js} +15 -5
  66. package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
  67. package/dist/chunks/{operations-UTUWFJTX.js → operations-532PN5OB.js} +5 -5
  68. package/dist/chunks/{performance-SMVTPK6T.js → performance-7W5COCFU.js} +92 -7
  69. package/dist/chunks/{plan-C2NENH42.js → plan-ZVY3IYTL.js} +15 -5
  70. package/dist/chunks/{project-FAJ2P3UR.js → project-SA62B7MH.js} +18 -5
  71. package/dist/chunks/{reception-NH6MJFPR.js → reception-NGIONPQ3.js} +128 -49
  72. package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-WOSN6MGP.js} +1264 -197
  73. package/dist/chunks/{registry-FTPUUHWC.js → registry-N7P3W2RD.js} +5 -5
  74. package/dist/chunks/{registry-3B3OAJYX.js → registry-R72GWXOG.js} +4 -4
  75. package/dist/chunks/{registry-ZQ7OONCB.js → registry-RIQ67ZT7.js} +12 -12
  76. package/dist/chunks/{room-recommend-73NBN3RU.js → room-recommend-KCGIVUFR.js} +4 -4
  77. package/dist/chunks/{schedule-SDBOBBUQ.js → schedule-6UP27HQ4.js} +4 -4
  78. package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-DDOQSPRB.js} +19 -6
  79. package/dist/chunks/{workflow-OWHWLAOX.js → workflow-V5ALD6QZ.js} +22 -8
  80. package/dist/cmd/auth/index.js +23 -0
  81. package/dist/cmd/e10/index.js +2 -1
  82. package/dist/cmd/index.js +2 -0
  83. package/dist/core/manifest-view.js +207 -0
  84. package/dist/core/output.js +42 -8
  85. package/dist/index.js +35 -35
  86. package/dist/internal/e10/auth/crypto.js +18 -8
  87. package/dist/internal/e10/auth/error-log.js +1 -2
  88. package/dist/internal/e10/auth/messages.js +2 -3
  89. package/dist/internal/e10/auth/xiaoe.js +1 -1
  90. package/dist/internal/e10/tls-policy.js +61 -13
  91. package/dist/shortcuts/archive/index.js +11 -2
  92. package/dist/shortcuts/archive/operations/download.js +1 -0
  93. package/dist/shortcuts/archive/operations/flow-url.js +3 -0
  94. package/dist/shortcuts/archive/operations/prelib.js +2 -0
  95. package/dist/shortcuts/archive/operations/upload.js +1 -0
  96. package/dist/shortcuts/archive-oa/index.js +11 -2
  97. package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
  98. package/dist/shortcuts/asset/index.js +11 -2
  99. package/dist/shortcuts/asset/manifest.js +7 -0
  100. package/dist/shortcuts/asset-idle/index.js +11 -2
  101. package/dist/shortcuts/blog/index.js +11 -2
  102. package/dist/shortcuts/blog/manifest.js +10 -0
  103. package/dist/shortcuts/caizhilian/host.js +20 -4
  104. package/dist/shortcuts/caizhilian/index.js +12 -2
  105. package/dist/shortcuts/caizhilian/manifest.js +4 -25
  106. package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
  107. package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
  108. package/dist/shortcuts/calendar/index.js +11 -2
  109. package/dist/shortcuts/contract/index.js +11 -2
  110. package/dist/shortcuts/contract/manifest.js +32 -0
  111. package/dist/shortcuts/contract/operations/write.js +3 -0
  112. package/dist/shortcuts/cowork/index.js +21 -5
  113. package/dist/shortcuts/cowork/manifest.js +3 -0
  114. package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
  115. package/dist/shortcuts/cowork/operations/item-write.js +3 -0
  116. package/dist/shortcuts/cowork/operations/member-write.js +2 -0
  117. package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
  118. package/dist/shortcuts/cowork/operations/review-write.js +1 -0
  119. package/dist/shortcuts/data/errors.js +16 -29
  120. package/dist/shortcuts/data/host.js +16 -7
  121. package/dist/shortcuts/data/index.js +12 -41
  122. package/dist/shortcuts/data/manifest.js +5 -44
  123. package/dist/shortcuts/data/operations/attend.js +2 -2
  124. package/dist/shortcuts/data/operations/conf.js +0 -88
  125. package/dist/shortcuts/data/operations/ds.js +4 -4
  126. package/dist/shortcuts/data/operations/index.js +1 -5
  127. package/dist/shortcuts/data/operations/module.js +40 -14
  128. package/dist/shortcuts/data/operations/query.js +2 -2
  129. package/dist/shortcuts/ebuilder-form/index.js +11 -2
  130. package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
  131. package/dist/shortcuts/ehr/index.js +11 -2
  132. package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
  133. package/dist/shortcuts/ehr/operations/recruit-position.js +4 -3
  134. package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
  135. package/dist/shortcuts/ehr/operations/recruit-write.js +3 -3
  136. package/dist/shortcuts/ehr/operations/recruit.js +206 -82
  137. package/dist/shortcuts/ehr/operations/shared.js +31 -0
  138. package/dist/shortcuts/esb/index.js +11 -2
  139. package/dist/shortcuts/esb/manifest.js +2 -0
  140. package/dist/shortcuts/fna/index.js +11 -2
  141. package/dist/shortcuts/hrm/index.js +11 -1
  142. package/dist/shortcuts/im/index.js +11 -2
  143. package/dist/shortcuts/invoice/index.js +11 -2
  144. package/dist/shortcuts/invoice/manifest.js +8 -0
  145. package/dist/shortcuts/jiuchuanhui/index.js +15 -1
  146. package/dist/shortcuts/jiuchuanhui/manifest.js +2 -0
  147. package/dist/shortcuts/mail/errors.js +14 -0
  148. package/dist/shortcuts/mail/index.js +23 -6
  149. package/dist/shortcuts/mail/manifest.js +11 -4
  150. package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
  151. package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
  152. package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
  153. package/dist/shortcuts/mail/operations/mail-read.js +7 -25
  154. package/dist/shortcuts/mail/operations/mail-send.js +12 -12
  155. package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
  156. package/dist/shortcuts/mail/operations/mail-template.js +10 -10
  157. package/dist/shortcuts/meeting/index.js +11 -2
  158. package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
  159. package/dist/shortcuts/okr/index.js +11 -2
  160. package/dist/shortcuts/performance/index.js +62 -3
  161. package/dist/shortcuts/performance/scheme-validate.js +7 -0
  162. package/dist/shortcuts/performance/shared.js +40 -2
  163. package/dist/shortcuts/plan/index.js +11 -2
  164. package/dist/shortcuts/project/index.js +11 -2
  165. package/dist/shortcuts/project/operations/write.js +3 -0
  166. package/dist/shortcuts/reception/constants.js +22 -0
  167. package/dist/shortcuts/reception/index.js +15 -2
  168. package/dist/shortcuts/reception/manifest.js +17 -3
  169. package/dist/shortcuts/reception/operations/ask.js +3 -0
  170. package/dist/shortcuts/reception/operations/doc.js +24 -11
  171. package/dist/shortcuts/reception/operations/docrender.js +18 -1
  172. package/dist/shortcuts/reception/operations/render-assets.js +93 -22
  173. package/dist/shortcuts/recruit-stage/context.js +12 -6
  174. package/dist/shortcuts/recruit-stage/index.js +22 -3
  175. package/dist/shortcuts/recruit-stage/manifest.js +2 -0
  176. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +19 -10
  177. package/dist/shortcuts/recruit-stage/operations/jd-create.js +487 -38
  178. package/dist/shortcuts/recruit-stage/operations/list.js +72 -1
  179. package/dist/shortcuts/recruit-stage/operations/profile.js +194 -0
  180. package/dist/shortcuts/recruit-stage/operations/registry.js +20 -2
  181. package/dist/shortcuts/recruit-stage/operations/resume-import.js +258 -63
  182. package/dist/shortcuts/recruit-stage/operations/search.js +226 -27
  183. package/dist/shortcuts/recruit-stage/operations/shortlist.js +122 -0
  184. package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
  185. package/dist/shortcuts/recruit-stage/shared.js +158 -4
  186. package/dist/shortcuts/smart-extract/index.js +11 -2
  187. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  188. package/dist/shortcuts/smart-extract/operations/save.js +2 -0
  189. package/dist/shortcuts/workflow/index.js +21 -1
  190. package/dist/shortcuts/workflow/operations/form.js +36 -2
  191. package/dist/shortcuts/workflow/operations/read.js +2 -2
  192. package/dist/shortcuts/workflow/operations/write.js +1 -1
  193. package/docs/caizhilian.md +1 -1
  194. package/docs/contract.md +1 -0
  195. package/docs/data.md +22 -22
  196. package/docs/e10-auth.md +41 -33
  197. package/docs/ehr.md +2 -0
  198. package/docs/reception.md +4 -3
  199. package/package.json +1 -1
  200. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  201. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  202. package/scripts/pysite/sitecustomize.py +41 -0
  203. package/skill-template/domains/data.md +4 -4
  204. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  205. package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
  206. package/skills/weaver-e10-cowork/SKILL.md +3 -1
  207. package/skills/weaver-e10-data/SKILL.md +12 -16
  208. package/skills/weaver-e10-data/references/config-center.md +6 -7
  209. package/skills/weaver-e10-data/references/datasource.md +1 -1
  210. package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
  211. package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -4
  212. package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
  213. package/skills/weaver-e10-jiuchuanhui/references/customer.md +18 -8
  214. package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
  215. package/skills/weaver-e10-jucailin/SKILL.md +7 -3
  216. package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
  217. package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
  218. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
  219. package/skills/weaver-e10-mail/SKILL.md +4 -1
  220. package/skills/weaver-e10-mail/references/mail-read.md +4 -2
  221. package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
  222. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  223. package/skills/weaver-e10-performance/SKILL.md +8 -6
  224. package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
  225. package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
  226. package/skills/weaver-e10-recruit-stage/SKILL.md +557 -75
  227. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +67 -44
  228. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +279 -0
  229. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +198 -0
  230. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +697 -0
  231. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +507 -0
  232. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
  233. package/skills/weaver-e10-recruit-stage/references/position-templates.md +19 -18
  234. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +19 -18
  235. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +1 -1
  236. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +1 -1
  237. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +15 -2
  238. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +37 -0
  239. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +4 -4
  240. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +64 -28
  241. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +43 -2
  242. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +41 -0
  243. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -4
  244. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +2 -2
  245. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +25 -7
  246. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +51 -0
  247. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +63 -0
  248. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -4
  249. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +2 -2
  250. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +58 -33
  251. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +4 -4
  252. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +5 -5
  253. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -2
  254. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +11 -10
  255. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +2 -2
  256. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
  257. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +106 -0
  258. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +325 -0
  259. package/skills/weaver-e10-recruit-stage/templates/match-report.html +265 -0
  260. package/skills/weaver-e10-shared/SKILL.md +22 -1
  261. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
  262. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
  263. package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
@@ -2,8 +2,19 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  createRecruitContextLoader,
5
- ehrValidationError
6
- } from "./chunk-UPVAQJKS.js";
5
+ ehrValidationError,
6
+ isSelfTenant,
7
+ toMenuList
8
+ } from "./chunk-DRUND2PJ.js";
9
+ import {
10
+ MANIFEST_LIST_COMPACT_PATHS,
11
+ manifestView,
12
+ schemaOptionsOf
13
+ } from "./chunk-WM33BSIL.js";
14
+ import {
15
+ shouldReportPlatformError,
16
+ toPlatformError
17
+ } from "./chunk-MD5CW4B6.js";
7
18
  import {
8
19
  CONTINUATION_TTL_MS
9
20
  } from "./chunk-7BDPM5ST.js";
@@ -12,13 +23,13 @@ import {
12
23
  createE10RequestRuntime,
13
24
  isE10SessionExpiredResponse,
14
25
  requireE10Session
15
- } from "./chunk-LRKKKO5A.js";
26
+ } from "./chunk-IU6UB2TD.js";
16
27
  import {
17
28
  E10_SESSION_EXPIRED_MESSAGE
18
- } from "./chunk-GTAFCAVP.js";
29
+ } from "./chunk-IZCQU5D5.js";
19
30
  import {
20
31
  getActiveProfile
21
- } from "./chunk-I5XB4MZT.js";
32
+ } from "./chunk-AMAPQVBT.js";
22
33
  import {
23
34
  CliError,
24
35
  isCliError,
@@ -27,7 +38,7 @@ import {
27
38
  import "./chunk-BUSC6UAE.js";
28
39
 
29
40
  // src/shortcuts/recruit-stage/index.ts
30
- import { readFile as readFile3 } from "node:fs/promises";
41
+ import { readFile as readFile4 } from "node:fs/promises";
31
42
 
32
43
  // src/shortcuts/recruit-stage/continuation.ts
33
44
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
@@ -258,7 +269,9 @@ function createRecruitStageHost(ctx, dependencies = {}) {
258
269
  }
259
270
 
260
271
  // src/shortcuts/recruit-stage/operations/jd-create.ts
261
- import { createHash, randomBytes as randomBytes2 } from "node:crypto";
272
+ import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
273
+ import { readFileSync, writeFileSync, mkdirSync, existsSync as existsSync2, rmSync } from "node:fs";
274
+ import { resolve as resolvePath2, dirname } from "node:path";
262
275
 
263
276
  // src/shortcuts/recruit-stage/operations/types.ts
264
277
  function rsSuccess(action, data, meta) {
@@ -282,8 +295,9 @@ function schemaOf(properties, options = {}) {
282
295
  }
283
296
 
284
297
  // src/shortcuts/recruit-stage/shared.ts
285
- import { randomUUID } from "node:crypto";
298
+ import { randomUUID, createHash } from "node:crypto";
286
299
  import { unlinkSync } from "node:fs";
300
+ import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
287
301
  import { homedir as homedir2 } from "node:os";
288
302
  import { join, resolve as resolvePath } from "node:path";
289
303
  function randHex32() {
@@ -553,15 +567,67 @@ async function runSaveButtonEsbActions(host, opts) {
553
567
  }
554
568
  return done;
555
569
  }
570
+ var __teamsCheckMemo = /* @__PURE__ */ new Map();
571
+ async function fetchTeamsCheck(host) {
572
+ let key = "__default__";
573
+ try {
574
+ const session = await host.getSession();
575
+ const base = String(session?.baseUrl || "").replace(/\/+$/, "");
576
+ if (base) key = base;
577
+ } catch {
578
+ }
579
+ const hit = __teamsCheckMemo.get(key);
580
+ if (hit) return hit;
581
+ const pending = host.request({ path: "/api/baseserver/layout/teamsCheck", method: "POST", body: {} }).catch((e) => {
582
+ __teamsCheckMemo.delete(key);
583
+ throw e;
584
+ });
585
+ __teamsCheckMemo.set(key, pending);
586
+ return pending;
587
+ }
556
588
  async function resolveCurrentUser(host) {
557
589
  try {
558
- const r = await host.request({ path: "/api/baseserver/layout/teamsCheck", method: "POST", body: {} });
590
+ const r = await fetchTeamsCheck(host);
559
591
  const cu = r && (r.currentUser || r.data && r.data.currentUser) || null;
560
592
  return cu && cu.id ? { id: String(cu.id), name: cu.username || String(cu.id) } : null;
561
593
  } catch {
562
594
  return null;
563
595
  }
564
596
  }
597
+ async function resolveCurrentUserOrg(host) {
598
+ try {
599
+ const r = await fetchTeamsCheck(host);
600
+ const root = r || {};
601
+ const nested = root.data || {};
602
+ const cu = root.currentUser ?? nested.currentUser ?? null;
603
+ if (!cu) return null;
604
+ const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
605
+ const dept = isObj(cu.department) ? cu.department : {};
606
+ const sub = isObj(cu.subCompany) ? cu.subCompany : isObj(cu.subcompany) ? cu.subcompany : {};
607
+ const pick = (...vals) => {
608
+ for (const v of vals) {
609
+ const s = v == null ? "" : String(v).trim();
610
+ if (s) return s;
611
+ }
612
+ return "";
613
+ };
614
+ const org = {
615
+ id: pick(cu.id, nested.employeeId, root.employeeId),
616
+ name: pick(cu.username, cu.name),
617
+ departmentId: pick(dept.id, cu.departmentId, cu.departmentid),
618
+ departmentName: pick(dept.name, cu.departmentName),
619
+ // 🔴 分部 id 实测落在 currentUser.department.subCompanyId(2026-11-28 teamsCheck 实测:
620
+ // department={"id":"9080...","name":"邮件协作组","subCompanyId":"6998..."}),
621
+ // 顶层只有名称 root.subCompanyName,所以两处都要取,缺一不可。
622
+ subCompanyId: pick(dept.subCompanyId, sub.id, cu.subCompanyId, cu.subcompanyId, root.subCompanyId, nested.subCompanyId),
623
+ subCompanyName: pick(dept.subCompanyName, sub.name, cu.subCompanyName, cu.subcompanyName, root.subCompanyName, nested.subCompanyName)
624
+ };
625
+ if (!org.id && !org.name) return null;
626
+ return org;
627
+ } catch {
628
+ return null;
629
+ }
630
+ }
565
631
  async function resolvePersonId(host, _fieldId, keyword) {
566
632
  const kw = String(keyword || "").trim();
567
633
  if (!kw) return null;
@@ -653,6 +719,13 @@ function expectedFields(details, fields, keys, nonEmptyOnly = [], optionalKeys =
653
719
  }
654
720
  return out;
655
721
  }
722
+ function valuesMatch(expected, actual) {
723
+ if (expected === actual) return true;
724
+ const expNum = Number(expected);
725
+ const actNum = Number(actual);
726
+ if (Number.isFinite(expNum) && Number.isFinite(actNum) && expNum === actNum) return true;
727
+ return false;
728
+ }
656
729
  async function verifySubmitted(opts) {
657
730
  const { host, formId, objId, dataId, expected } = opts;
658
731
  if (!expected.length) return { checked: 0, mismatches: [] };
@@ -692,7 +765,7 @@ async function verifySubmitted(opts) {
692
765
  const d = byId.get(e.fieldId);
693
766
  if (!d && e.optional) continue;
694
767
  const actual = d ? String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? "") : "";
695
- const bad = e.expected === "*" ? !actual : actual !== e.expected;
768
+ const bad = e.expected === "*" ? !actual : !valuesMatch(e.expected, actual);
696
769
  if (bad) mismatches.push({ label: e.label, expected: e.expected === "*" ? "\uFF08\u975E\u7A7A\uFF09" : e.expected, actual: actual || "\uFF08\u7A7A\uFF09" });
697
770
  }
698
771
  return { checked: expected.length, mismatches };
@@ -716,12 +789,47 @@ async function fetchDsOptionsRaw(host, objId, fieldId, groupId) {
716
789
  });
717
790
  return r?.data || [];
718
791
  }
792
+ var RS_DS_TTL_MS = 10 * 60 * 1e3;
793
+ function rsShortCacheDir() {
794
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir2(), ".weaver-work-cli");
795
+ const root = process.env.E10_SKILL_CACHE_DIR || join(home, "env-cache", "recruit-ops");
796
+ return join(root, "_short-cache");
797
+ }
798
+ async function rsHostBaseUrl(host) {
799
+ try {
800
+ const s = await host.getSession?.();
801
+ return String(s?.baseUrl || "").replace(/\/+$/, "");
802
+ } catch {
803
+ return "";
804
+ }
805
+ }
806
+ async function rsCachedDsOptions(host, objId, fieldId, groupId) {
807
+ const fetcher = () => fetchDsOptionsRaw(host, objId, fieldId, groupId);
808
+ if (process.env.E10_RS_NO_SHORT_CACHE === "1") return fetcher();
809
+ const baseUrl = await rsHostBaseUrl(host);
810
+ if (!baseUrl) return fetcher();
811
+ const file = join(rsShortCacheDir(), "rs-ds-" + createHash("sha1").update(`${baseUrl}|${objId}|${fieldId}|${groupId}`).digest("hex").slice(0, 24) + ".json");
812
+ try {
813
+ const raw = JSON.parse(await readFile2(file, "utf8"));
814
+ if (raw?.at && Array.isArray(raw.data) && Date.now() - raw.at <= RS_DS_TTL_MS) return raw.data;
815
+ } catch {
816
+ }
817
+ const data = await fetcher();
818
+ if (Array.isArray(data) && data.length) {
819
+ try {
820
+ await mkdir2(rsShortCacheDir(), { recursive: true });
821
+ await writeFile2(file, JSON.stringify({ at: Date.now(), data }), "utf8");
822
+ } catch {
823
+ }
824
+ }
825
+ return data;
826
+ }
719
827
  async function getDsOptionsFull(host, objId, fieldId, groupId = "") {
720
828
  const key = objId + ":" + fieldId + (groupId ? ":" + groupId : "") + ":full";
721
829
  const hit = dsOptionsFullMemo.get(key);
722
830
  if (hit) return hit;
723
831
  const task = (async () => {
724
- const list = await fetchDsOptionsRaw(host, objId, fieldId, groupId);
832
+ const list = await rsCachedDsOptions(host, objId, fieldId, groupId);
725
833
  const map = {};
726
834
  const disabled = [];
727
835
  for (const x of list) {
@@ -995,9 +1103,9 @@ function buildListUrl(baseUrl, listId) {
995
1103
  var SCHEMA_ID_STR = { type: "string", description: "18 \u4F4D\u8BB0\u5F55 id\uFF08\u5B57\u7B26\u4E32\uFF09" };
996
1104
  var DATAKEYS_TEXT = ["position_name"];
997
1105
  var DATAKEYS_MTEXT = ["position_duty", "work_request"];
998
- var DEF_TEXT = { recruit_count: "1", number_of_pay_months: "12" };
1106
+ var DEF_TEXT = { recruit_count: "3", number_of_pay_months: "12" };
999
1107
  var DEF_OPTION = { salary_type: "\u6708\u85AA", recruit_type: "\u793E\u4F1A\u62DB\u8058" };
1000
- var DEF_CURRENT_USER = ["recr_principal", "employ_manager"];
1108
+ var DEF_CURRENT_USER = ["recr_principal", "employ_manager", "interviewer"];
1001
1109
  var DEF_FROM_REF = [
1002
1110
  "position_nature",
1003
1111
  "education",
@@ -1005,13 +1113,34 @@ var DEF_FROM_REF = [
1005
1113
  ];
1006
1114
  var DEF_STATUS = "\u62DB\u8058\u4E2D";
1007
1115
  var DEFAULT_WORK_LOCATION = "\u6D66\u6C5F\u9547\u4E09\u9C81\u516C\u8DEF3419\u53F7\u6CDB\u5FAE\u8F6F\u4EF6\u56ED";
1116
+ var DEF_DICT = {
1117
+ position_nature: "\u5168\u804C",
1118
+ education: "\u672C\u79D1",
1119
+ work_years: "\u4E0D\u9650",
1120
+ // 🔴 2026-11-28 用户口径:招聘优先级默认「中」(该字段走数据字典 低/中/高)
1121
+ recruit_priority: "\u4E2D"
1122
+ };
1123
+ var DEF_CACHE_OPTION = {
1124
+ // 用户表述为「内部招聘」,该字段实际只有这两个选项,即内部招聘的全部渠道
1125
+ internal_channels: ["\u5185\u90E8\u63A8\u8350", "\u5185\u90E8\u9074\u9009"],
1126
+ third_party_platform: ["BOSS\u76F4\u8058", "\u524D\u7A0B\u65E0\u5FE7"]
1127
+ };
1128
+ var DEFAULT_JOB_CATEGORY = "\u6280\u672F";
1129
+ var DEFAULT_DAYS_TO_DEADLINE = 60;
1130
+ var DEF_SALARY = { salary_min: "18", salary_max: "30" };
1131
+ function inferJobCategory(positionName) {
1132
+ const n = String(positionName || "");
1133
+ if (/销售|客户经理|商务|大客户|渠道|BD|城市负责|区域负责|拓展/i.test(n)) return "\u9500\u552E";
1134
+ if (/人力|行政|财务|法务|会计|招聘|HR|人事|薪酬|绩效|审计|合规|秘书/i.test(n)) return "\u804C\u80FD";
1135
+ return DEFAULT_JOB_CATEGORY;
1136
+ }
1008
1137
  var NUM_KEYS = /* @__PURE__ */ new Set(["recruit_count", "number_of_pay_months", "salary_min", "salary_max", "internship_duration", "working_days"]);
1009
1138
  var PERSON_KEYS = /* @__PURE__ */ new Set(["recr_principal", "recr_helper", "employ_manager", "interviewer"]);
1010
1139
  var OPTION_KEYS = /* @__PURE__ */ new Set(["salary_type", "recruit_type", "status"]);
1011
1140
  var DICT_KEYS = /* @__PURE__ */ new Set(["position_nature", "job_category", "education", "work_years"]);
1012
1141
  var MTEXT_KEYS = /* @__PURE__ */ new Set(["position_duty", "work_request"]);
1013
1142
  function fingerprint(value) {
1014
- return createHash("sha256").update(JSON.stringify(value)).digest("hex");
1143
+ return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
1015
1144
  }
1016
1145
  function detailValueId(d) {
1017
1146
  if (!d) return "";
@@ -1090,11 +1219,11 @@ async function fetchAllMenusFlat(ctx) {
1090
1219
  });
1091
1220
  const flat = [];
1092
1221
  (function walk2(ns) {
1093
- for (const n of ns || []) if (n && typeof n === "object") {
1222
+ for (const n of toMenuList(ns)) if (n && typeof n === "object") {
1094
1223
  flat.push(n);
1095
- walk2(n.children || n.childs);
1224
+ walk2(n.children ?? n.childs);
1096
1225
  }
1097
- })(r?.data?.cusAppMenus || r?.data);
1226
+ })(r?.data);
1098
1227
  allMenusMemo.set(key, flat);
1099
1228
  return flat;
1100
1229
  } catch {
@@ -1117,6 +1246,93 @@ async function findWorkPlaceMenu(ctx) {
1117
1246
  }
1118
1247
  return null;
1119
1248
  }
1249
+ var FLOW_MENU_NAMES = ["\u62DB\u8058\u6D41\u7A0B"];
1250
+ var flowDataMemo = /* @__PURE__ */ new Map();
1251
+ function isDefaultFlowRow(x) {
1252
+ if (!x || typeof x !== "object") return false;
1253
+ const cands = [x.is_default, x.isDefault, x.default_flow, x.defaultFlow, x.is_enable, x.enabled, x.status];
1254
+ for (const v of cands) {
1255
+ if (v === true || v === 1 || v === "1") return true;
1256
+ const s = String(v ?? "");
1257
+ if (s === "\u662F" || s === "\u542F\u7528" || s === "\u9ED8\u8BA4") return true;
1258
+ }
1259
+ return false;
1260
+ }
1261
+ async function resolveFlowByData(ctx) {
1262
+ const { host, appId, cache } = ctx;
1263
+ let menu = null;
1264
+ const allSearch = (cache.lists || {}).all_search || [];
1265
+ menu = allSearch.find(
1266
+ (m) => m && m.listId && FLOW_MENU_NAMES.some((n) => String(m.menuName || "").includes(n))
1267
+ ) || null;
1268
+ if (!menu) {
1269
+ const hit2 = findMenuNode(cache.menus || [], FLOW_MENU_NAMES, (m) => m && m.listId);
1270
+ if (hit2) menu = hit2;
1271
+ }
1272
+ if (!menu) {
1273
+ const flat = await fetchAllMenusFlat(ctx);
1274
+ const hit3 = findMenuNode(flat, FLOW_MENU_NAMES, (m) => m && m.listId);
1275
+ if (hit3) menu = hit3;
1276
+ }
1277
+ if (!menu || !menu.listId) return null;
1278
+ const key = appId + "|" + String(menu.listId);
1279
+ if (flowDataMemo.has(key)) return flowDataMemo.get(key) ?? null;
1280
+ try {
1281
+ let flowObjId = "";
1282
+ try {
1283
+ const liBody = {
1284
+ cusMenuId: menu.cusMenuId || "",
1285
+ listId: String(menu.listId),
1286
+ urlPageTitle: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B")
1287
+ };
1288
+ liBody["appId_" + String(menu.listId)] = appId;
1289
+ const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: liBody });
1290
+ flowObjId = String(li?.data?.objid || "");
1291
+ } catch {
1292
+ }
1293
+ if (!flowObjId) {
1294
+ const t = await host.request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_recruit_flow`, method: "GET" }).catch(() => null);
1295
+ flowObjId = Array.isArray(t?.data) && t.data[0] ? String(t.data[0].id || "") : "";
1296
+ }
1297
+ if (!flowObjId) {
1298
+ flowDataMemo.set(key, null);
1299
+ return null;
1300
+ }
1301
+ const body = {
1302
+ current: 1,
1303
+ pageSize: 50,
1304
+ tableuid: randHex32(),
1305
+ listId: String(menu.listId),
1306
+ searchParamData: { searchType: "3", type: "and" },
1307
+ terminal: "PC",
1308
+ browser: "Chrome",
1309
+ requiredMatch: 1,
1310
+ mapResult: 1,
1311
+ recheckQuery: 1,
1312
+ isFollow: 0,
1313
+ isShareToMe: 0,
1314
+ filterCondition: {},
1315
+ cusMenuId: String(menu.cusMenuId || ""),
1316
+ urlPageTitle: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B"),
1317
+ menuName: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B")
1318
+ };
1319
+ const r = await host.request({
1320
+ path: `/api/ebuilder/form/list/getListDatas?passid=${flowObjId}&cid=${flowObjId}`,
1321
+ body,
1322
+ headers: { ebBusinessId: String(menu.listId) }
1323
+ });
1324
+ const rows = (r?.data?.data || r?.data?.displayData || []).filter(Boolean);
1325
+ const pick = rows.find(isDefaultFlowRow) || (rows.length === 1 ? rows[0] : null);
1326
+ const id = pick ? String(pick.form_data_id || pick.id || "") : "";
1327
+ const name = pick ? stripHtml(pick.name || pick.flow_name || pick.content || "") : "";
1328
+ const out = id && name ? { id, name } : null;
1329
+ flowDataMemo.set(key, out);
1330
+ return out;
1331
+ } catch {
1332
+ flowDataMemo.set(key, null);
1333
+ return null;
1334
+ }
1335
+ }
1120
1336
  var workPlaceMemo = /* @__PURE__ */ new Map();
1121
1337
  function stripHtml(s) {
1122
1338
  return String(s ?? "").replace(/<[^>]*>/g, "").trim();
@@ -1376,8 +1592,10 @@ async function buildJd(opts) {
1376
1592
  const fid = (k) => fields[k];
1377
1593
  for (const k of DATAKEYS_TEXT) if (!fid(k)) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 " + k + "\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1378
1594
  for (const k of DATAKEYS_MTEXT) if (!fid(k)) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 " + k + "\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1595
+ const setsKeys = new Set(sets.map(([k]) => k));
1596
+ const needsRefByFid = !DEF_FROM_REF.every((k) => setsKeys.has(k));
1379
1597
  const currentUserPromise = resolveCurrentUser(host).catch(() => null);
1380
- const refByFid = await fetchRefByFid(ctx);
1598
+ const refByFid = needsRefByFid ? await fetchRefByFid(ctx) : {};
1381
1599
  const map = /* @__PURE__ */ new Map();
1382
1600
  const put = (d) => {
1383
1601
  if (d && d.formField && d.formField.id) map.set(String(d.formField.id), d);
@@ -1406,14 +1624,35 @@ async function buildJd(opts) {
1406
1624
  skippedSets.push(k + "=" + v);
1407
1625
  }
1408
1626
  }
1627
+ const cacheOptionId = (key, name) => {
1628
+ const id = fid(key);
1629
+ if (!id) return "";
1630
+ const optMap = (cache.field_options?.[objId] || {})[String(id)] || {};
1631
+ for (const oid of Object.keys(optMap)) {
1632
+ if (String(optMap[oid]) === name) return String(oid);
1633
+ }
1634
+ return "";
1635
+ };
1636
+ const optionIdOf = async (key, name) => {
1637
+ const hit = cacheOptionId(key, name);
1638
+ if (hit) return hit;
1639
+ const id = fid(key);
1640
+ if (!id) return "";
1641
+ const m = await getDsOptions(host, objId, id).catch(() => ({}));
1642
+ return String(m[name] || "");
1643
+ };
1409
1644
  if (!hasKey("status")) {
1410
1645
  if (!fid("status")) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 status\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1411
- const statusMap = await getDsOptions(host, objId, fid("status"));
1412
- const statusId = statusMap[DEF_STATUS];
1413
- if (!statusId) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u300C\u62DB\u8058\u72B6\u6001\u300D\u672A\u89E3\u6790\u5230\u300C" + DEF_STATUS + "\u300D\u9009\u9879\uFF08ds/options \u8FD4\u56DE\u4E3A\u7A7A\uFF09");
1414
- put({ formField: { id: fid("status") }, dataOptions: [{ optionId: String(statusId), content: DEF_STATUS }] });
1646
+ const statusId = await optionIdOf("status", DEF_STATUS);
1647
+ if (!statusId) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u300C\u62DB\u8058\u72B6\u6001\u300D\u672A\u89E3\u6790\u5230\u300C" + DEF_STATUS + "\u300D\u9009\u9879\uFF08\u7F13\u5B58 field_options \u4E0E ds/options \u5747\u672A\u547D\u4E2D\uFF09");
1648
+ put({ formField: { id: fid("status") }, dataOptions: [{ optionId: statusId, content: DEF_STATUS }] });
1649
+ }
1650
+ let defFlow = cache.defaultRecruitFlow;
1651
+ let flowFromData = false;
1652
+ if (!hasKey("recruit_flow") && fid("recruit_flow") && (!defFlow || !defFlow.id)) {
1653
+ defFlow = await resolveFlowByData(ctx).catch(() => null);
1654
+ flowFromData = !!(defFlow && defFlow.id);
1415
1655
  }
1416
- const defFlow = cache.defaultRecruitFlow;
1417
1656
  if (!hasKey("recruit_flow") && fid("recruit_flow") && defFlow && defFlow.id) {
1418
1657
  put({ formField: { id: fid("recruit_flow") }, dataOptions: [{ optionId: String(defFlow.id), content: defFlow.name }] });
1419
1658
  }
@@ -1438,10 +1677,9 @@ async function buildJd(opts) {
1438
1677
  }
1439
1678
  for (const [k, name] of Object.entries(DEF_OPTION)) {
1440
1679
  if (fid(k) && !hasKey(k)) {
1441
- const m = await getDsOptions(host, objId, fid(k));
1442
- const oid = m[name];
1680
+ const oid = await optionIdOf(k, name);
1443
1681
  if (oid) {
1444
- put({ formField: { id: fid(k) }, dataOptions: [{ optionId: String(oid), content: name }] });
1682
+ put({ formField: { id: fid(k) }, dataOptions: [{ optionId: oid, content: name }] });
1445
1683
  filled.push(k);
1446
1684
  }
1447
1685
  }
@@ -1458,6 +1696,99 @@ async function buildJd(opts) {
1458
1696
  }
1459
1697
  }
1460
1698
  }
1699
+ const defaultedFields = [];
1700
+ const defaultSkipped = [];
1701
+ const putDictDefault = (key, name) => {
1702
+ const id = fid(key);
1703
+ if (!id || map.has(String(id))) return false;
1704
+ const group = dictGroupOf(cache, detailValueId(refByFid[String(id)]));
1705
+ const did = dictIdByName(cache, name, group) || dictIdByName(cache, name, "");
1706
+ if (!did) return false;
1707
+ put({ formField: { id }, dataOptions: [{ optionId: String(did), content: name }] });
1708
+ filled.push(key);
1709
+ defaultedFields.push({ field: key, value: name });
1710
+ return true;
1711
+ };
1712
+ const putCacheOptionDefault = (key, names) => {
1713
+ const id = fid(key);
1714
+ if (!id || map.has(String(id))) return false;
1715
+ const picked = [];
1716
+ const missed = [];
1717
+ for (const name of names) {
1718
+ const oid = cacheOptionId(key, name);
1719
+ if (oid) picked.push({ optionId: oid, content: name });
1720
+ else missed.push(name);
1721
+ }
1722
+ if (!picked.length) {
1723
+ defaultSkipped.push({
1724
+ field: key,
1725
+ wanted: names.join("\u3001"),
1726
+ reason: "\u73AF\u5883 field_options \u4E2D\u4E0D\u5B58\u5728\u8BE5\u9009\u9879\uFF0C\u672C\u6B21\u672A\u586B\uFF08\u8BE5\u5B57\u6BB5\u53EF\u80FD\u7559\u7A7A\uFF09"
1727
+ });
1728
+ return false;
1729
+ }
1730
+ put({ formField: { id }, dataOptions: picked });
1731
+ filled.push(key);
1732
+ defaultedFields.push({ field: key, value: picked.map((p) => p.content).join("\u3001") });
1733
+ if (missed.length) {
1734
+ defaultSkipped.push({
1735
+ field: key,
1736
+ wanted: missed.join("\u3001"),
1737
+ reason: "\u90E8\u5206\u9009\u9879\u5728\u73AF\u5883\u4E2D\u4E0D\u5B58\u5728\uFF0C\u4EC5\u586B\u5165\u5DF2\u547D\u4E2D\u7684\u503C"
1738
+ });
1739
+ }
1740
+ return true;
1741
+ };
1742
+ for (const [k, name] of Object.entries(DEF_DICT)) putDictDefault(k, name);
1743
+ putDictDefault("job_category", inferJobCategory(positionName));
1744
+ for (const [k, names] of Object.entries(DEF_CACHE_OPTION)) putCacheOptionDefault(k, names);
1745
+ const deadlineFid = fid("recruitment_deadline");
1746
+ if (deadlineFid && !map.has(String(deadlineFid))) {
1747
+ const d = /* @__PURE__ */ new Date();
1748
+ d.setDate(d.getDate() + DEFAULT_DAYS_TO_DEADLINE);
1749
+ const pad = (x) => String(x).padStart(2, "0");
1750
+ const deadline = d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
1751
+ put({ formField: { id: deadlineFid }, content: deadline });
1752
+ filled.push("recruitment_deadline");
1753
+ defaultedFields.push({ field: "recruitment_deadline", value: deadline });
1754
+ }
1755
+ for (const [k, v] of Object.entries(DEF_SALARY)) {
1756
+ const id = fid(k);
1757
+ if (!id || map.has(String(id))) continue;
1758
+ put({ formField: { id }, content: v });
1759
+ filled.push(k);
1760
+ defaultedFields.push({ field: k, value: v });
1761
+ }
1762
+ const needOrg = ["sub_company", "department"].some((k) => {
1763
+ const id = fid(k);
1764
+ return !!id && !map.has(String(id));
1765
+ });
1766
+ let orgDefaultWarning = null;
1767
+ if (needOrg) {
1768
+ const org = await resolveCurrentUserOrg(host).catch(() => null);
1769
+ if (!org) {
1770
+ orgDefaultWarning = "\u672A\u80FD\u89E3\u6790\u5F53\u524D\u767B\u5F55\u4EBA\u7684\u6240\u5C5E\u7EC4\u7EC7\uFF08teamsCheck \u4E0D\u53EF\u7528\uFF09\uFF0C\u672C\u6B21\u4E0D\u5199\u300C\u804C\u4F4D\u6240\u5C5E\u5206\u90E8 / \u804C\u4F4D\u6240\u5C5E\u90E8\u95E8\u300D\uFF1B\u8BF7\u7528 sets \u6307\u5B9A";
1771
+ } else {
1772
+ if (fid("sub_company") && !hasKey("sub_company")) {
1773
+ if (org.subCompanyId) {
1774
+ put({ formField: { id: fid("sub_company") }, dataOptions: [{ optionId: org.subCompanyId, content: org.subCompanyName }] });
1775
+ filled.push("sub_company");
1776
+ defaultedFields.push({ field: "sub_company", value: org.subCompanyName });
1777
+ } else {
1778
+ defaultSkipped.push({ field: "sub_company", wanted: "\u5F53\u524D\u4EBA\u6240\u5728\u5206\u90E8", reason: "teamsCheck \u672A\u8FD4\u56DE\u5206\u90E8\u8BB0\u5F55 id\uFF08subCompanyId\uFF09\uFF0C\u672C\u6B21\u672A\u586B" });
1779
+ }
1780
+ }
1781
+ if (fid("department") && !hasKey("department")) {
1782
+ if (org.departmentId) {
1783
+ put({ formField: { id: fid("department") }, dataOptions: [{ optionId: org.departmentId, content: org.departmentName }] });
1784
+ filled.push("department");
1785
+ defaultedFields.push({ field: "department", value: org.departmentName });
1786
+ } else {
1787
+ defaultSkipped.push({ field: "department", wanted: "\u5F53\u524D\u4EBA\u6240\u5728\u90E8\u95E8", reason: "teamsCheck \u672A\u8FD4\u56DE\u90E8\u95E8\u8BB0\u5F55 id\uFF0C\u672C\u6B21\u672A\u586B" });
1788
+ }
1789
+ }
1790
+ }
1791
+ }
1461
1792
  const inheritedSalaryWarnings = [];
1462
1793
  for (const key of ["salary_min", "salary_max"]) {
1463
1794
  const hit = inheritedFromRef.find((x) => x.field === key);
@@ -1496,6 +1827,8 @@ async function buildJd(opts) {
1496
1827
  status: DEF_STATUS,
1497
1828
  // 解析不到环境默认流程时不写该字段,表单自身默认值生效;文案按实际行为表述,避免误导。
1498
1829
  recruitFlow: defFlow && defFlow.id ? defFlow.name : "\uFF08\u6CBF\u7528\u8868\u5355\u9ED8\u8BA4\u503C\uFF09",
1830
+ // 流程来源:cache=上下文缓存命中;data=缓存缺失时从「招聘流程」列表数据兜底解析
1831
+ recruitFlowSource: defFlow && defFlow.id ? flowFromData ? "data" : "cache" : void 0,
1499
1832
  currentUser: currentUser ? currentUser.name : null,
1500
1833
  setApplied: appliedSets,
1501
1834
  setSkipped: skippedSets,
@@ -1506,6 +1839,14 @@ async function buildJd(opts) {
1506
1839
  inheritedNote: inheritedFromRef.length ? "\u4EE5\u4E0A\u5B57\u6BB5\u672A\u6307\u5B9A\uFF0C\u503C\u7EE7\u627F\u81EA\u73AF\u5883\u5185\u6700\u8FD1\u4E00\u6761\u804C\u4F4D\u8BB0\u5F55\uFF0C\u53EF\u80FD\u542B\u5386\u53F2\u810F\u6570\u636E\uFF0C\u8BF7\u6838\u5BF9\u540E\u518D\u63D0\u4EA4\uFF08\u5DE5\u4F5C\u5730\u70B9\u4E0D\u53C2\u4E0E\u7EE7\u627F\uFF09" : void 0,
1507
1840
  workLocationDefault: workLocationDefault || void 0,
1508
1841
  workLocationWarning: workLocationWarning || void 0,
1842
+ // A/C 告警:想填但填不上的默认值(环境缺选项 / 取不到记录 id)。不阻断创建,但必须让用户看见,
1843
+ // 否则会出现「摘要说已默认填写、实际字段留空」这种最难排查的情况。
1844
+ defaultSkipped: defaultSkipped.length ? defaultSkipped : void 0,
1845
+ defaultSkippedNote: defaultSkipped.length ? "\u4EE5\u4E0A\u9ED8\u8BA4\u503C\u672A\u80FD\u586B\u5165\uFF08\u73AF\u5883\u7F3A\u5C11\u5BF9\u5E94\u9009\u9879\uFF0C\u6216\u53D6\u4E0D\u5230\u8BB0\u5F55 id\uFF09\uFF0C\u5BF9\u5E94\u5B57\u6BB5\u53EF\u80FD\u7559\u7A7A\uFF1B\u8BF7\u6838\u5BF9\u540E\u7528 sets \u663E\u5F0F\u6307\u5B9A" : void 0,
1846
+ orgDefaultWarning: orgDefaultWarning || void 0,
1847
+ // 本次自动补上的固定默认值(用户未指定、继承也没拿到):摘要里明示,便于创建前核对
1848
+ defaultedFields: defaultedFields.length ? defaultedFields : void 0,
1849
+ defaultedNote: defaultedFields.length ? "\u4EE5\u4E0A\u5B57\u6BB5\u672A\u6307\u5B9A\uFF0C\u5DF2\u6309\u62DB\u8058\u52A9\u624B\u56FA\u5B9A\u9ED8\u8BA4\u503C\u81EA\u52A8\u586B\u5165\uFF08\u53EF\u968F\u65F6\u7528 sets \u8986\u76D6\uFF09" : void 0,
1509
1850
  requiredDefaultsFilled
1510
1851
  }
1511
1852
  };
@@ -1557,15 +1898,19 @@ async function prepare(args, env) {
1557
1898
  operation: "recruit-stage.jd.create.apply",
1558
1899
  fingerprint: fp,
1559
1900
  enumMaps: await dsOptionsSnapshot(),
1560
- // 🔴 2026-11-07 修复:协议文档写「apply 带 confirm + continuation」,但 apply 原来只从 args 取
1561
- // positionName/positionDuty/...,Agent 少传 positionName 就直接报 position_name_required。
1562
- // 现把 prepare 用过的业务参数一并签进 continuation;apply 显式传的仍优先。
1901
+ // 🔴 2026-11-27 优化:签入 willSubmit(已解析的完整提交数据)和 summary,
1902
+ // apply 有 willSubmit 时直接用,跳过 buildJd(省 ~10 个 HTTP 请求,5-8 秒)。
1903
+ willSubmit,
1904
+ summary: jd.summary,
1905
+ // 🔴 2026-11-27 修复:argsSnapshot 漏签了 sets,apply 不传 sets 时 buildJd 产出空 sets
1906
+ // → 指纹不一致 → fingerprint_mismatch。现在补上。
1563
1907
  argsSnapshot: {
1564
1908
  positionName: String(args.positionName || ""),
1565
1909
  positionDuty: args.positionDuty ? String(args.positionDuty) : void 0,
1566
1910
  workRequest: args.workRequest ? String(args.workRequest) : void 0,
1567
1911
  demandId: args.demandId ? String(args.demandId) : void 0,
1568
- demandName: args.demandName ? String(args.demandName) : void 0
1912
+ demandName: args.demandName ? String(args.demandName) : void 0,
1913
+ sets: args.sets
1569
1914
  }
1570
1915
  });
1571
1916
  const invFieldKeys = {};
@@ -1634,6 +1979,53 @@ async function prepare(args, env) {
1634
1979
  confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E\u672C continuation \u8C03\u7528 recruit-stage.jd.create.apply"
1635
1980
  });
1636
1981
  }
1982
+ var JD_PENDING_TTL_MS = 10 * 60 * 1e3;
1983
+ function jdPendingFile(positionName) {
1984
+ const home = process.env.USERPROFILE || process.env.HOME || ".";
1985
+ const key = createHash2("sha1").update(positionName).digest("hex").slice(0, 16);
1986
+ return resolvePath2(home, ".weaver-work-cli", "state", "jd-pending", key + ".json");
1987
+ }
1988
+ function readJdPending(positionName) {
1989
+ try {
1990
+ const p = jdPendingFile(positionName);
1991
+ if (!existsSync2(p)) return null;
1992
+ const j = JSON.parse(readFileSync(p, "utf8"));
1993
+ if (String(j.positionName || "") !== positionName) return null;
1994
+ if (!j.formDataId) return null;
1995
+ if (Date.now() - Number(j.savedAt || 0) > JD_PENDING_TTL_MS) return null;
1996
+ return { formDataId: String(j.formDataId), savedAt: Number(j.savedAt) };
1997
+ } catch {
1998
+ return null;
1999
+ }
2000
+ }
2001
+ function writeJdPending(positionName, formDataId) {
2002
+ try {
2003
+ const p = jdPendingFile(positionName);
2004
+ mkdirSync(dirname(p), { recursive: true });
2005
+ writeFileSync(p, JSON.stringify({ positionName, formDataId, savedAt: Date.now() }), "utf8");
2006
+ } catch {
2007
+ }
2008
+ }
2009
+ async function jdStatusName(ctx, formId, objId, dataId) {
2010
+ try {
2011
+ const rec = await getFormDataRecord(ctx.host, formId, dataId, objId);
2012
+ const dets = rec?.dataDetails || [];
2013
+ const statusFid = String((ctx.cache.fields[objId] || {})["status"] || "");
2014
+ const cell = dets.find((d) => String(d.fieldId) === statusFid && !d.subFormId);
2015
+ if (!cell) return "";
2016
+ const direct = String(cell.dataOptions?.[0]?.content || cell.content || "");
2017
+ if (direct) return direct;
2018
+ const oid = String(cell.dataOptions?.[0]?.optionId || "");
2019
+ if (oid) {
2020
+ const map = await getDsOptions(ctx.host, objId, statusFid).catch(() => ({}));
2021
+ const hit = Object.keys(map).find((k) => String(map[k]) === oid);
2022
+ if (hit) return hit;
2023
+ }
2024
+ return "";
2025
+ } catch {
2026
+ return "";
2027
+ }
2028
+ }
1637
2029
  async function apply(args, env) {
1638
2030
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.jd.create.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
1639
2031
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
@@ -1646,32 +2038,62 @@ async function apply(args, env) {
1646
2038
  ctx.appId = ctx.cache.appId;
1647
2039
  const positionName = String(merged.positionName || "").trim();
1648
2040
  if (!positionName) throw rsValidationError("position_name_required", "positionName \u5FC5\u586B");
1649
- const jd = await buildJd({
1650
- ctx,
1651
- positionName,
1652
- duty: merged.positionDuty ? String(merged.positionDuty) : void 0,
1653
- requestText: merged.workRequest ? String(merged.workRequest) : void 0,
1654
- demandId: merged.demandId ? String(merged.demandId) : void 0,
1655
- demandName: merged.demandName ? String(merged.demandName) : void 0,
1656
- sets: setsOf(merged)
1657
- });
1658
- const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
1659
- if (payload.fingerprint !== fingerprint(willSubmit)) {
1660
- throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF08\u5B57\u6BB5\u503C\u5DF2\u53D8\u5316\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
2041
+ let jd;
2042
+ if (payload.willSubmit) {
2043
+ const ws = payload.willSubmit;
2044
+ jd = { objId: ws.objId, formId: ws.formId, appId: ctx.appId, dataDetails: ws.dataDetails, summary: payload.summary || {} };
2045
+ } else {
2046
+ jd = await buildJd({
2047
+ ctx,
2048
+ positionName,
2049
+ duty: merged.positionDuty ? String(merged.positionDuty) : void 0,
2050
+ requestText: merged.workRequest ? String(merged.workRequest) : void 0,
2051
+ demandId: merged.demandId ? String(merged.demandId) : void 0,
2052
+ demandName: merged.demandName ? String(merged.demandName) : void 0,
2053
+ sets: setsOf(merged)
2054
+ });
2055
+ const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
2056
+ if (payload.fingerprint !== fingerprint(willSubmit)) {
2057
+ throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF08\u5B57\u6BB5\u503C\u5DF2\u53D8\u5316\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
2058
+ }
2059
+ }
2060
+ let formDataId = "";
2061
+ let resumedFromPending = false;
2062
+ let alreadyCreated = false;
2063
+ const pending = readJdPending(positionName);
2064
+ if (pending) {
2065
+ const st = await jdStatusName(ctx, jd.formId, jd.objId, pending.formDataId);
2066
+ formDataId = pending.formDataId;
2067
+ resumedFromPending = true;
2068
+ if (st && st !== "\u5F85\u53D1\u5E03") alreadyCreated = true;
2069
+ }
2070
+ if (!formDataId) {
2071
+ try {
2072
+ formDataId = await saveFormData(host, {
2073
+ appId: jd.appId,
2074
+ formId: jd.formId,
2075
+ objId: jd.objId,
2076
+ name: "\u804C\u4F4D\u7BA1\u7406-" + positionName,
2077
+ dataDetails: jd.dataDetails
2078
+ });
2079
+ } catch (e) {
2080
+ throw rsFail("\u2460 \u4FDD\u5B58\u804C\u4F4D\u7BA1\u7406\u8868\u5355\u5931\u8D25\uFF1A" + String(e?.message || e));
2081
+ }
2082
+ writeJdPending(positionName, formDataId);
2083
+ }
2084
+ let r2 = null;
2085
+ if (!alreadyCreated) {
2086
+ try {
2087
+ r2 = await host.request({ path: "/api/recruit/position/v2/addPosition?formDataId=" + formDataId, method: "POST" });
2088
+ } catch (e) {
2089
+ throw rsFail("\u2461 addPosition \u751F\u6210\u804C\u4F4D\u5931\u8D25\uFF08\u5DF2\u4FDD\u5B58\u7684\u804C\u4F4D\u8BB0\u5F55 id=" + formDataId + " \u5DF2\u4FDD\u7559\uFF0C10 \u5206\u949F\u5185\u91CD\u8DD1\u53EF\u7EED\uFF09\uFF1A" + String(e?.message || e));
2090
+ }
1661
2091
  }
1662
- const formDataId = await saveFormData(host, {
1663
- appId: jd.appId,
1664
- formId: jd.formId,
1665
- objId: jd.objId,
1666
- name: "\u804C\u4F4D\u7BA1\u7406-" + positionName,
1667
- dataDetails: jd.dataDetails
1668
- });
1669
- const r2 = await host.request({ path: "/api/recruit/position/v2/addPosition?formDataId=" + formDataId, method: "POST" });
1670
2092
  const data = r2?.data || {};
1671
2093
  const positionPostId = data.positionPostId;
1672
2094
  const checkRpa = data.checkRpa;
1673
2095
  const rpaValidMsg = data.rpaValidMsg || null;
1674
- const okByResponse = r2?.status !== false && r2?.fail !== true && data.fail !== true;
2096
+ const okByResponse = r2 ? r2?.status !== false && r2?.fail !== true && data.fail !== true : true;
1675
2097
  const verification = await verifySubmitted({
1676
2098
  host,
1677
2099
  formId: jd.formId,
@@ -1688,6 +2110,7 @@ async function apply(args, env) {
1688
2110
  if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
1689
2111
  const recordOk = verification.unavailable ? okByResponse : verification.mismatches.length === 0;
1690
2112
  const created = okByResponse && recordOk;
2113
+ if (created) writeJdPending(positionName, formDataId);
1691
2114
  const result = !created ? "failed" : verification.mismatches.length ? "partial" : "success";
1692
2115
  const listUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.position?.listId || "");
1693
2116
  const cardUrl = buildCardUrl(ctx.baseUrl, jd.objId, formDataId);
@@ -1695,6 +2118,9 @@ async function apply(args, env) {
1695
2118
  mode: "apply",
1696
2119
  result,
1697
2120
  formDataId,
2121
+ // 幂等语义(供 Agent 与用户判断"是否真的又建了一条")
2122
+ resumedFromPending,
2123
+ alreadyCreatedBeforeThisRun: alreadyCreated,
1698
2124
  positionPostId: positionPostId || null,
1699
2125
  rpaChecked: checkRpa === void 0 ? null : !!checkRpa,
1700
2126
  rpaValidMsg,
@@ -1708,7 +2134,6 @@ async function apply(args, env) {
1708
2134
  // 由 Agent 按 recruit-output-links.md「链接覆盖规则」替换 path 段后再输出。
1709
2135
  viewLink: cardUrl ? `[\u67E5\u770B ${jd.summary.positionName || "\u65B0\u5EFA\u804C\u4F4D"} \u804C\u4F4D\u8BE6\u60C5](${cardUrl})` : null,
1710
2136
  listLocateLink: listUrl ? `[\u6253\u5F00\u804C\u4F4D\u5217\u8868](${listUrl})` : null,
1711
- agentNote: "\u67E5\u770B\u5165\u53E3 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF1A\u2460 viewLink \u804C\u4F4D\u8BE6\u60C5\u5355\u9875\uFF08\u539F\u6837\u642C\u8FD0\uFF0C\u4E0D\u6539\uFF09\u2461 listLocateLink \u804C\u4F4D\u5217\u8868\u2014\u2014\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u7528\u56FA\u5B9A\u8DEF\u7531\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA viewLink\uFF09\uFF0C\u5426\u5219\u539F\u6837\u642C\u8FD0\u3002\u4E0D\u8981\u5305 browsertool / <artifact> \u6807\u7B7E\uFF1B\u7F3A\u54EA\u4E2A\u53EA\u7ED9\u53E6\u4E00\u4E2A\uFF0C\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u94FE\u63A5\u53EA\u662F\u67E5\u770B\u5165\u53E3\uFF0C\u91CD\u590D\u70B9\u51FB\u4E0D\u4F1A\u91CD\u590D\u521B\u5EFA\u3002",
1712
2137
  ...jd.summary
1713
2138
  });
1714
2139
  }
@@ -1803,7 +2228,7 @@ var jdCreateOperations = [
1803
2228
  ];
1804
2229
 
1805
2230
  // src/shortcuts/recruit-stage/operations/resume-import.ts
1806
- import { createHash as createHash3 } from "node:crypto";
2231
+ import { createHash as createHash4 } from "node:crypto";
1807
2232
  import fs from "node:fs";
1808
2233
  import path from "node:path";
1809
2234
 
@@ -2249,9 +2674,9 @@ async function queryEntityTags(host, talentId) {
2249
2674
  }
2250
2675
 
2251
2676
  // src/shortcuts/recruit-stage/fs-scan.ts
2252
- import { mkdtempSync, readdirSync, readFileSync, statSync, mkdirSync, writeFileSync } from "node:fs";
2677
+ import { mkdtempSync, readdirSync, readFileSync as readFileSync2, statSync, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
2253
2678
  import { tmpdir } from "node:os";
2254
- import { basename, dirname, extname, join as join2, resolve as resolve2 } from "node:path";
2679
+ import { basename, dirname as dirname2, extname, join as join2, resolve as resolve2 } from "node:path";
2255
2680
  import { inflateRawSync } from "node:zlib";
2256
2681
  var RESUME_EXTS = /* @__PURE__ */ new Set([".pdf", ".doc", ".docx", ".rtf", ".txt", ".wps"]);
2257
2682
  function decodeName(bytes, utf8Flag) {
@@ -2263,7 +2688,7 @@ function decodeName(bytes, utf8Flag) {
2263
2688
  }
2264
2689
  }
2265
2690
  function extractZip(zipPath) {
2266
- const buf = readFileSync(zipPath);
2691
+ const buf = readFileSync2(zipPath);
2267
2692
  let eocd = -1;
2268
2693
  const floor = Math.max(0, buf.length - 22 - 65535);
2269
2694
  for (let i = buf.length - 22; i >= floor; i--) {
@@ -2310,8 +2735,8 @@ function extractZip(zipPath) {
2310
2735
  continue;
2311
2736
  }
2312
2737
  const target = join2(dest, ...parts);
2313
- mkdirSync(dirname(target), { recursive: true });
2314
- writeFileSync(target, out);
2738
+ mkdirSync2(dirname2(target), { recursive: true });
2739
+ writeFileSync2(target, out);
2315
2740
  written++;
2316
2741
  }
2317
2742
  if (!written) throw new Error("zip \u5185\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u6587\u4EF6\uFF08\u53EF\u80FD\u4E3A\u7A7A\u5305\u6216\u4F7F\u7528\u4E86\u4E0D\u652F\u6301\u7684\u538B\u7F29\u65B9\u5F0F\uFF09");
@@ -2370,18 +2795,18 @@ function scanResumeSource(source) {
2370
2795
  }
2371
2796
 
2372
2797
  // src/shortcuts/recruit-stage/batch-store.ts
2373
- import { createHash as createHash2 } from "node:crypto";
2374
- import { chmodSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
2798
+ import { createHash as createHash3 } from "node:crypto";
2799
+ import { chmodSync, mkdirSync as mkdirSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
2375
2800
  import { homedir as homedir3 } from "node:os";
2376
2801
  import { join as join3, resolve as resolve3, sep } from "node:path";
2377
2802
  function batchDir() {
2378
2803
  const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve3(homedir3(), ".weaver-work-cli");
2379
2804
  const dir = join3(home, "batch");
2380
- mkdirSync2(dir, { recursive: true, mode: 448 });
2805
+ mkdirSync3(dir, { recursive: true, mode: 448 });
2381
2806
  return dir;
2382
2807
  }
2383
2808
  function digest(value) {
2384
- return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
2809
+ return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
2385
2810
  }
2386
2811
  function cleanup(dir) {
2387
2812
  try {
@@ -2402,7 +2827,7 @@ function saveBatchItems(kind, items) {
2402
2827
  cleanup(dir);
2403
2828
  const fingerprint3 = digest(items);
2404
2829
  const file = join3(dir, `${kind}-${fingerprint3.slice(0, 16)}.json`);
2405
- writeFileSync2(file, JSON.stringify(items), { mode: 384 });
2830
+ writeFileSync3(file, JSON.stringify(items), { mode: 384 });
2406
2831
  try {
2407
2832
  chmodSync(file, 384);
2408
2833
  } catch {
@@ -2417,7 +2842,7 @@ function loadBatchItems(file, expectedFingerprint) {
2417
2842
  }
2418
2843
  let items;
2419
2844
  try {
2420
- items = JSON.parse(readFileSync2(target, "utf8"));
2845
+ items = JSON.parse(readFileSync3(target, "utf8"));
2421
2846
  } catch {
2422
2847
  throw rsValidationError("batch_file_missing", "\u6279\u91CF\u6E05\u5355\u5DF2\u5931\u6548\uFF08\u6587\u4EF6\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare");
2423
2848
  }
@@ -2440,7 +2865,7 @@ function saveOcrResult(fileId, structured) {
2440
2865
  const dir = batchDir();
2441
2866
  cleanup(dir);
2442
2867
  const p = ocrFile(fileId);
2443
- writeFileSync2(p, JSON.stringify(structured), { mode: 384 });
2868
+ writeFileSync3(p, JSON.stringify(structured), { mode: 384 });
2444
2869
  try {
2445
2870
  chmodSync(p, 384);
2446
2871
  } catch {
@@ -2454,7 +2879,7 @@ function loadOcrResult(fileId, maxAgeMs = 24 * 3600 * 1e3) {
2454
2879
  const p = ocrFile(fileId);
2455
2880
  const st = statSync2(p);
2456
2881
  if (Date.now() - st.mtimeMs > maxAgeMs) return null;
2457
- const v = JSON.parse(readFileSync2(p, "utf8"));
2882
+ const v = JSON.parse(readFileSync3(p, "utf8"));
2458
2883
  return v && typeof v === "object" && !Array.isArray(v) ? v : null;
2459
2884
  } catch {
2460
2885
  return null;
@@ -2506,7 +2931,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
2506
2931
  const uploadType = c?.data?.uploadType || "common";
2507
2932
  if (!preUploadId) throw rsFail("\u7B80\u5386\u9884\u4E0A\u4F20\u68C0\u67E5\u5931\u8D25\uFF1A" + JSON.stringify(c || {}).slice(0, 200));
2508
2933
  const fd = baseForm();
2509
- const md5 = createHash3("md5").update(buf).digest("hex");
2934
+ const md5 = createHash4("md5").update(buf).digest("hex");
2510
2935
  const lm = String(Math.round(fs.statSync(filePath).mtimeMs || Date.now()));
2511
2936
  fd.append("name", filename);
2512
2937
  fd.append("MD5", md5);
@@ -2546,6 +2971,18 @@ function snapshotParsedResume(s) {
2546
2971
  return void 0;
2547
2972
  }
2548
2973
  }
2974
+ var BUILT_SNAPSHOT_LIMIT = 512 * 1024;
2975
+ function snapshotBuilt(built) {
2976
+ if (!built || typeof built !== "object") return void 0;
2977
+ try {
2978
+ const { structured: _omit, ...rest } = built;
2979
+ const raw = JSON.stringify(rest);
2980
+ if (raw.length > BUILT_SNAPSHOT_LIMIT) return void 0;
2981
+ return rest;
2982
+ } catch {
2983
+ return void 0;
2984
+ }
2985
+ }
2549
2986
  async function checkExtractionGate(host) {
2550
2987
  const b = await host.request({ path: "/api/recruit/ocr/checkResumeExtraction", method: "POST", body: {} });
2551
2988
  mark("ocr.checkResumeExtraction");
@@ -2639,6 +3076,8 @@ async function resolveSubTableMeta(ctx) {
2639
3076
  if (cfg.start && cfg.end && cfg.start.dataKey && cfg.end.dataKey) {
2640
3077
  col.startKey = String(cfg.start.dataKey);
2641
3078
  col.endKey = String(cfg.end.dataKey);
3079
+ if (cfg.start.fieldId) col.startFieldId = String(cfg.start.fieldId);
3080
+ if (cfg.end.fieldId) col.endFieldId = String(cfg.end.fieldId);
2642
3081
  }
2643
3082
  cols[String(cfg.dataKey)] = col;
2644
3083
  }
@@ -2852,6 +3291,107 @@ async function readTalentSnapshot(ctx, opts) {
2852
3291
  for (const [dk, s] of Object.entries(seen)) subRows[dk] = s.size;
2853
3292
  return { main, subRows, subCells };
2854
3293
  }
3294
+ async function readTalentRecordMeta(ctx, opts) {
3295
+ const L = await getFormLayoutMeta(ctx.host, opts.formId);
3296
+ const r = await ctx.host.request({
3297
+ path: "/api/ebuilder/form/form/core/getFormDataAndLayout",
3298
+ method: "POST",
3299
+ body: {
3300
+ terminalType: "PC",
3301
+ dataId: opts.dataId,
3302
+ formId: opts.formId,
3303
+ module: "ebuilderform",
3304
+ newLayout: true,
3305
+ layoutId: L?.formLayout?.id,
3306
+ layoutMultiId: L?.formLayoutMultiple?.id,
3307
+ dataCrossLayout: false,
3308
+ permissionId: "",
3309
+ allReadOnly: true,
3310
+ initialDatas: [],
3311
+ dynamicData: false,
3312
+ cost: false,
3313
+ customParam: { objId: opts.objId, dataId: opts.dataId }
3314
+ }
3315
+ });
3316
+ const dets = r?.data?.formData?.dataDetails || [];
3317
+ const rowIdsBySubForm = {};
3318
+ for (const d of dets) {
3319
+ if (!d.subFormId) continue;
3320
+ const sid = String(d.subFormId);
3321
+ const idx = Number(d.dataIndex || 0);
3322
+ if (idx < 1) continue;
3323
+ const arr = rowIdsBySubForm[sid] = rowIdsBySubForm[sid] || [];
3324
+ if (!arr[idx - 1]) arr[idx - 1] = String(d.rowId || "");
3325
+ }
3326
+ return {
3327
+ updateTimeStamp: String(r?.data?.formData?.updateTimeStamp || ""),
3328
+ formLayoutId: String(r?.data?.formLayout?.id || L?.formLayout?.id || ""),
3329
+ rowIdsBySubForm
3330
+ };
3331
+ }
3332
+ function debugDumpSubCells(built, rowIdsBySubForm) {
3333
+ for (const [dk, node] of Object.entries(built.detailNodes)) {
3334
+ const sub = (built.subMeta || {})[dk];
3335
+ const rows = (built.detailsPayload || {})[node] || [];
3336
+ const sid = sub ? String(sub.subFormId) : "";
3337
+ const oldIds = rowIdsBySubForm[sid] || [];
3338
+ const cols = Object.entries(sub?.columns || {}).map(([k, c]) => `${k}:${c.type}@${c.id}${c.startKey ? `(s=${c.startKey},e=${c.endKey})` : ""}`).join(" | ");
3339
+ console.error(`[debug-cells] ${dk} node=${node} subFormId=${sid} oldRows=${oldIds.length} newRows=${rows.length} cols=${cols}`);
3340
+ rows.forEach((r, i) => console.error(`[debug-cells] row${i + 1} rowId=${oldIds[i] || ""} json=${JSON.stringify(r)}`));
3341
+ }
3342
+ }
3343
+ function normDateCell(colType, v) {
3344
+ if (!/date/i.test(String(colType || ""))) return v;
3345
+ const s = String(v || "").trim().replace(/\//g, "-");
3346
+ const m0 = s.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
3347
+ if (m0) return `${m0[1]}-${String(m0[2]).padStart(2, "0")}-${String(m0[3]).padStart(2, "0")}`;
3348
+ const m = s.match(/^(\d{4})-(\d{1,2})$/);
3349
+ if (m) return `${m[1]}-${String(m[2]).padStart(2, "0")}-01`;
3350
+ const y = s.match(/^(\d{4})$/);
3351
+ if (y) return `${y[1]}-01-01`;
3352
+ return null;
3353
+ }
3354
+ function buildSubFormCells(built, rowIdsBySubForm, dictName) {
3355
+ const cells = [];
3356
+ const skippedOldRows = [];
3357
+ const droppedCells = [];
3358
+ if (process.env.E10_RS_DEBUG_CELLS === "1") debugDumpSubCells(built, rowIdsBySubForm);
3359
+ for (const [dk, node] of Object.entries(built.detailNodes)) {
3360
+ const sub = (built.subMeta || {})[dk];
3361
+ const rows = (built.detailsPayload || {})[node] || [];
3362
+ if (!sub || !rows.length) continue;
3363
+ const sid = String(sub.subFormId);
3364
+ const oldIds = rowIdsBySubForm[sid] || [];
3365
+ const keyMap = {};
3366
+ for (const [ck0, c0] of Object.entries(sub.columns || {})) {
3367
+ if (c0?.id) keyMap[ck0] = { fieldId: String(c0.id), date: /date/i.test(String(c0.type || "")) };
3368
+ if (c0?.startKey && c0?.startFieldId) keyMap[String(c0.startKey)] = { fieldId: String(c0.startFieldId), date: true };
3369
+ if (c0?.endKey && c0?.endFieldId) keyMap[String(c0.endKey)] = { fieldId: String(c0.endFieldId), date: true };
3370
+ }
3371
+ rows.forEach((row, i) => {
3372
+ const rowId = i < oldIds.length ? oldIds[i] || "" : "";
3373
+ for (const [ck, v] of Object.entries(row)) {
3374
+ const col = keyMap[ck];
3375
+ if (!col) {
3376
+ droppedCells.push(`${dk}#${i + 1}.${ck} \u65E0\u5BF9\u5E94\u5217\uFF08\u5E03\u5C40\u672A\u89E3\u6790\u5230 fieldId\uFF09\uFF0C\u5DF2\u8DF3\u8FC7`);
3377
+ continue;
3378
+ }
3379
+ const sv = String(v ?? "");
3380
+ const dateVal = col.date ? normDateCell("Date", sv) : sv;
3381
+ if (dateVal === null) {
3382
+ droppedCells.push(`${dk}#${i + 1}.${ck}\u300C${sv}\u300D\u975E\u65E5\u671F\u503C\uFF0C\u5DF2\u8DF3\u8FC7`);
3383
+ continue;
3384
+ }
3385
+ const isOption = /^\d{6,}$/.test(sv) && !!dictName(sv);
3386
+ cells.push(isOption ? { dataIndex: i + 1, rowId, formField: { id: col.fieldId }, subForm: { id: sid }, dataOptions: [{ optionId: sv, content: dictName(sv) }] } : { dataIndex: i + 1, rowId, formField: { id: col.fieldId }, subForm: { id: sid }, content: dateVal });
3387
+ }
3388
+ });
3389
+ if (oldIds.length > rows.length) {
3390
+ skippedOldRows.push(`${dk}\uFF1A\u539F\u8868 ${oldIds.length} \u884C > \u672C\u6B21\u89E3\u6790 ${rows.length} \u884C\uFF0C\u591A\u51FA\u7684\u65E7\u884C\u65E0\u6CD5\u7ECF\u672C\u901A\u9053\u5220\u9664\uFF0C\u9700\u9875\u9762\u624B\u5DE5\u5904\u7406`);
3391
+ }
3392
+ }
3393
+ return { cells, skippedOldRows, droppedCells };
3394
+ }
2855
3395
  async function matchTalentLabel(host, talentId) {
2856
3396
  const r = await host.request({ path: "/api/recruit/label/matchTalentLabel?talentId=" + encodeURIComponent(talentId), method: "POST", body: {} });
2857
3397
  return r?.data || null;
@@ -3092,7 +3632,7 @@ async function findExistingTalents(ctx, opts) {
3092
3632
  return { checked: true, unique: !hit, byPhone: byPhone && !byPhone.error ? byPhone : null, byPhoneError: byPhone?.error, formConflicts, ids };
3093
3633
  }
3094
3634
  function fingerprint2(value) {
3095
- return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
3635
+ return createHash4("sha256").update(JSON.stringify(value)).digest("hex");
3096
3636
  }
3097
3637
  function fingerprintMainTable(mainTable) {
3098
3638
  const copy = { ...mainTable };
@@ -3192,6 +3732,9 @@ async function prepare2(args, env, opts = {}) {
3192
3732
  operation: "recruit-stage.resume.import.apply",
3193
3733
  fingerprint: fp2,
3194
3734
  enumMaps: await dsOptionsSnapshot(),
3735
+ // 🔴 2026-11-27 优化:签入已解析的 built(不含 structured,已在 parsedResume 里),
3736
+ // apply 直接复用,跳过 buildImport(省 ~6 HTTP)和 findExistingTalents(省 2 HTTP)。
3737
+ built: snapshotBuilt(built),
3195
3738
  // 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
3196
3739
  // confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
3197
3740
  // 否则会报 resume_source_required(文档写法跑不通)。
@@ -3232,21 +3775,9 @@ async function prepare2(args, env, opts = {}) {
3232
3775
  }
3233
3776
  }, { continuation: continuation2, fingerprint: fp2, confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E continuation \u8C03\u7528 apply" });
3234
3777
  }
3235
- const tagCheckTask = (async () => {
3236
- if (!built.tagNames.length) return null;
3237
- try {
3238
- const rt = await resolveTags(ctx.host, built.tagNames);
3239
- return { requested: built.tagNames, found: rt.found, missing: rt.missing, ...typeof rt.availableCount === "number" ? { availableCount: rt.availableCount } : {} };
3240
- } catch (e) {
3241
- return { requested: built.tagNames, error: e.message };
3242
- }
3243
- })();
3244
- mark("prepare.\u67E5\u91CD\u5EFA\u6863\u5E76\u884C\u524D");
3245
- const [dupInfo, tagCheck] = await Promise.all([
3246
- findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone }),
3247
- tagCheckTask
3248
- ]);
3249
- mark("prepare.\u67E5\u91CD+\u6807\u7B7E\u9884\u68C0");
3778
+ const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
3779
+ const tagCheck = built.tagNames.length ? { requested: built.tagNames, note: "\u6807\u7B7E\u5C06\u5728\u63D0\u4EA4\u65F6\u81EA\u52A8\u89E3\u6790\u5E76\u5199\u5165" } : null;
3780
+ mark("prepare.\u67E5\u91CD\u5B8C\u6210");
3250
3781
  const summary = {
3251
3782
  action: "\u7B80\u5386\u5BFC\u5165\u5EFA\u4EBA\u624D",
3252
3783
  resumeFile: built.fileName || "fileid=" + built.fileid,
@@ -3294,6 +3825,19 @@ async function prepare2(args, env, opts = {}) {
3294
3825
  operation: "recruit-stage.resume.import.apply",
3295
3826
  fingerprint: fp,
3296
3827
  enumMaps: await dsOptionsSnapshot(),
3828
+ // 🔴 2026-11-28 修复「提速失效」:新建模式此前**从未签入 built**(只有更新通道签了),
3829
+ // 导致 apply 每次都重跑 buildImport(~6 HTTP)与 findExistingTalents(2 HTTP),
3830
+ // 优化写了但完全没生效。现补上;同时把 prepare 的查重结果签入 dupCheck,
3831
+ // 让 apply 能据此决策:unique=true 才跳过 HTTP 查重,unique=false 直接拒绝写入。
3832
+ built: snapshotBuilt(built),
3833
+ dupCheck: {
3834
+ checked: dupInfo.checked,
3835
+ unique: dupInfo.unique,
3836
+ conflictCount: dupInfo.formConflicts.existing.length,
3837
+ unreadableCount: dupInfo.formConflicts.unreadable.length,
3838
+ byPhoneTalentId: dupInfo.byPhone?.talentId || null,
3839
+ byPhoneCandidateId: dupInfo.byPhone?.candidateId || null
3840
+ },
3297
3841
  // 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
3298
3842
  // confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
3299
3843
  // 否则会报 resume_source_required(文档写法跑不通)。
@@ -3351,8 +3895,14 @@ async function applyCore(args, env, payload) {
3351
3895
  ctx.appId = ctx.cache.appId;
3352
3896
  mark("apply.context");
3353
3897
  const argsT = args;
3354
- const built = await buildImport(ctx, argsT);
3355
- mark("apply.buildImport \u5B8C\u6210");
3898
+ let built;
3899
+ if (payload.built && (argsT.parsedResume || payload.built.structured)) {
3900
+ built = { ...payload.built, structured: argsT.parsedResume || payload.built.structured };
3901
+ mark("apply.\u590D\u7528prepare\u7684built\uFF08\u8DF3\u8FC7buildImport+\u67E5\u91CD\uFF09");
3902
+ } else {
3903
+ built = await buildImport(ctx, argsT);
3904
+ mark("apply.buildImport \u5B8C\u6210");
3905
+ }
3356
3906
  if (argsT.updateTalentId) {
3357
3907
  const updateTalentId = String(argsT.updateTalentId);
3358
3908
  const upMain = toDatasetMainTable(built.dataDetails, built.fields);
@@ -3361,12 +3911,18 @@ async function applyCore(args, env, payload) {
3361
3911
  if (payload.fingerprint !== fingerprint2(willSubmit)) {
3362
3912
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
3363
3913
  }
3364
- await datasetUpdateFormData(host, {
3914
+ const fresh = await readTalentRecordMeta(ctx, { formId: built.formId, objId: built.objId, dataId: updateTalentId });
3915
+ const subCells = buildSubFormCells(built, fresh.rowIdsBySubForm, makeDictLookup(ctx.cache));
3916
+ const savedId = await saveFormData(ctx.host, {
3917
+ appId: ctx.appId,
3918
+ formId: built.formId,
3365
3919
  objId: built.objId,
3366
- dataId: updateTalentId,
3367
- mainTable: upMain,
3368
- details: built.detailsPayload,
3369
- coverDetails: Object.keys(built.detailsPayload)
3920
+ name: built.structured.candidateName || void 0,
3921
+ dataDetails: [...built.dataDetails, ...subCells.cells],
3922
+ rightType: "2",
3923
+ formDataId: updateTalentId,
3924
+ updateTimeStamp: fresh.updateTimeStamp || void 0,
3925
+ layoutId: fresh.formLayoutId || void 0
3370
3926
  });
3371
3927
  const avatarRes2 = await writeAvatarIfProvided(ctx, {
3372
3928
  photoFile: argsT.photoFile,
@@ -3390,17 +3946,18 @@ async function applyCore(args, env, payload) {
3390
3946
  return out;
3391
3947
  };
3392
3948
  let after = await readTalentSnapshot(ctx, { formId: built.formId, objId: built.objId, fields: built.fields, subMeta: built.subMeta, dataId: updateTalentId });
3393
- let verifyWarnings = checkAfter(after);
3949
+ let verifyWarnings = [...subCells.skippedOldRows, ...subCells.droppedCells, ...checkAfter(after)];
3394
3950
  if (verifyWarnings.length) {
3395
3951
  await new Promise((r) => setTimeout(r, 600));
3396
3952
  after = await readTalentSnapshot(ctx, { formId: built.formId, objId: built.objId, fields: built.fields, subMeta: built.subMeta, dataId: updateTalentId });
3397
- verifyWarnings = checkAfter(after);
3953
+ verifyWarnings = [...subCells.skippedOldRows, ...subCells.droppedCells, ...checkAfter(after)];
3398
3954
  }
3399
3955
  return rsSuccess("recruit-stage.resume.import.apply", {
3400
3956
  // 更新模式同理:明细行/格数对不上时只能报 partial,不能因主表写入成功就报 success
3401
3957
  mode: "update",
3402
3958
  result: verifyWarnings.length ? "partial" : "success",
3403
3959
  detailsState: verifyWarnings.length ? "missing" : "complete",
3960
+ writeChannel: "form/core saveFormData\uFF08formDataId+\u4E50\u89C2\u9501\uFF1Bdataset v2 \u5BF9\u4EBA\u624D\u8868\u5931\u660E\u5DF2\u5F03\u7528\uFF09",
3404
3961
  talentId: updateTalentId,
3405
3962
  afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
3406
3963
  verifyWarnings: verifyWarnings.length ? verifyWarnings : void 0,
@@ -3410,32 +3967,49 @@ async function applyCore(args, env, payload) {
3410
3967
  parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || "(\u7A7A)" }
3411
3968
  });
3412
3969
  }
3413
- const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
3414
- if (dupInfo.byPhone?.candidateId || dupInfo.byPhone?.talentId) {
3415
- const b = dupInfo.byPhone;
3970
+ const signedDup = payload.built && payload.dupCheck && payload.dupCheck.checked === true ? payload.dupCheck : null;
3971
+ if (signedDup && signedDup.unique === false) {
3972
+ const hasBatch = !!(signedDup.byPhoneCandidateId || signedDup.byPhoneTalentId);
3416
3973
  return rsSuccess("recruit-stage.resume.import.apply", {
3417
3974
  mode: "apply",
3418
3975
  result: "duplicate",
3419
- message: "\u5F53\u524D\u624B\u673A\u53F7\u5DF2\u7ED1\u5B9A\u4EBA\u624D\u4FE1\u606F\uFF0C\u6309\u9875\u9762\u89C4\u5219\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
3420
- existingTalent: { talentId: b.talentId, candidateId: b.candidateId, talentViewUrl: b.talentViewUrl, talentCardUrl: b.talentCardUrl },
3421
- talentViewUrl: b.talentViewUrl,
3422
- otherRecords: dupInfo.formConflicts.existing.length ? dupInfo.formConflicts.existing : void 0,
3976
+ message: hasBatch ? "\u5F53\u524D\u624B\u673A\u53F7\u5DF2\u7ED1\u5B9A\u4EBA\u624D\u4FE1\u606F\uFF0C\u6309\u9875\u9762\u89C4\u5219\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09" : "\u624B\u673A\u53F7\u5728\u4EBA\u624D\u5E93\u5DF2\u5B58\u5728\uFF08\u8868\u5355\u552F\u4E00\u6027\u547D\u4E2D\uFF0C\u4F46\u65E0\u5E94\u8058\u6279\u6B21\uFF09\uFF0C\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
3977
+ existingTalent: hasBatch ? {
3978
+ talentId: signedDup.byPhoneTalentId || "",
3979
+ candidateId: signedDup.byPhoneCandidateId || ""
3980
+ } : void 0,
3423
3981
  parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
3424
3982
  nextStep: "\u5982\u9700\u6309\u8FD9\u4EFD\u7B80\u5386\u66F4\u65B0\u8BE5\u4EBA\u624D\uFF0C\u660E\u786E\u8BF4\u660E\u5373\u53EF\uFF08updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\uFF09"
3425
3983
  });
3426
3984
  }
3427
- if (dupInfo.formConflicts.existing.length) {
3428
- return rsSuccess("recruit-stage.resume.import.apply", {
3429
- mode: "apply",
3430
- result: "duplicate",
3431
- message: "\u624B\u673A\u53F7\u5728\u4EBA\u624D\u5E93\u5DF2\u5B58\u5728\uFF08\u8868\u5355\u552F\u4E00\u6027\u547D\u4E2D\uFF0C\u4F46\u65E0\u5E94\u8058\u6279\u6B21\uFF09\uFF0C\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
3432
- formConflicts: dupInfo.formConflicts.existing,
3433
- parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
3434
- nextStep: "\u5982\u9700\u6309\u8FD9\u4EFD\u7B80\u5386\u66F4\u65B0\u8BE5\u4EBA\u624D\uFF0C\u660E\u786E\u8BF4\u660E\u5373\u53EF\uFF08updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\uFF09"
3435
- });
3436
- }
3437
- if (!dupInfo.unique && dupInfo.formConflicts.unreadable.length) {
3438
- throw rsFail("\u624B\u673A\u53F7\u88AB " + dupInfo.formConflicts.unreadable.length + " \u6761\u5DF2\u5220\u9664\u8BB0\u5F55\u5360\u7528\uFF08\u5E73\u53F0\u552F\u4E00\u6027\u6821\u9A8C\u4ECD\u62E6\u65B0\u5EFA\uFF0Cid=" + dupInfo.formConflicts.unreadable.join(",") + "\uFF09\uFF1A\u8BF7\u5148\u5728\u56DE\u6536\u7AD9\u6E05\u7406\uFF0C\u6216\u6539\u4E3A\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D");
3985
+ if (!signedDup) {
3986
+ const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
3987
+ if (dupInfo.byPhone?.candidateId || dupInfo.byPhone?.talentId) {
3988
+ const b = dupInfo.byPhone;
3989
+ return rsSuccess("recruit-stage.resume.import.apply", {
3990
+ mode: "apply",
3991
+ result: "duplicate",
3992
+ message: "\u5F53\u524D\u624B\u673A\u53F7\u5DF2\u7ED1\u5B9A\u4EBA\u624D\u4FE1\u606F\uFF0C\u6309\u9875\u9762\u89C4\u5219\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
3993
+ existingTalent: { talentId: b.talentId, candidateId: b.candidateId, talentViewUrl: b.talentViewUrl, talentCardUrl: b.talentCardUrl },
3994
+ talentViewUrl: b.talentViewUrl,
3995
+ otherRecords: dupInfo.formConflicts.existing.length ? dupInfo.formConflicts.existing : void 0,
3996
+ parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
3997
+ nextStep: "\u5982\u9700\u6309\u8FD9\u4EFD\u7B80\u5386\u66F4\u65B0\u8BE5\u4EBA\u624D\uFF0C\u660E\u786E\u8BF4\u660E\u5373\u53EF\uFF08updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\uFF09"
3998
+ });
3999
+ }
4000
+ if (dupInfo.formConflicts.existing.length) {
4001
+ return rsSuccess("recruit-stage.resume.import.apply", {
4002
+ mode: "apply",
4003
+ result: "duplicate",
4004
+ message: "\u624B\u673A\u53F7\u5728\u4EBA\u624D\u5E93\u5DF2\u5B58\u5728\uFF08\u8868\u5355\u552F\u4E00\u6027\u547D\u4E2D\uFF0C\u4F46\u65E0\u5E94\u8058\u6279\u6B21\uFF09\uFF0C\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
4005
+ formConflicts: dupInfo.formConflicts.existing,
4006
+ parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
4007
+ nextStep: "\u5982\u9700\u6309\u8FD9\u4EFD\u7B80\u5386\u66F4\u65B0\u8BE5\u4EBA\u624D\uFF0C\u660E\u786E\u8BF4\u660E\u5373\u53EF\uFF08updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\uFF09"
4008
+ });
4009
+ }
4010
+ if (!dupInfo.unique && dupInfo.formConflicts.unreadable.length) {
4011
+ throw rsFail("\u624B\u673A\u53F7\u88AB " + dupInfo.formConflicts.unreadable.length + " \u6761\u5DF2\u5220\u9664\u8BB0\u5F55\u5360\u7528\uFF08\u5E73\u53F0\u552F\u4E00\u6027\u6821\u9A8C\u4ECD\u62E6\u65B0\u5EFA\uFF0Cid=" + dupInfo.formConflicts.unreadable.join(",") + "\uFF09\uFF1A\u8BF7\u5148\u5728\u56DE\u6536\u7AD9\u6E05\u7406\uFF0C\u6216\u6539\u4E3A\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D");
4012
+ }
3439
4013
  }
3440
4014
  mark("apply.\u67E5\u91CD\u5B8C\u6210");
3441
4015
  const datasetMain = toDatasetMainTable(built.dataDetails, built.fields);
@@ -3447,16 +4021,11 @@ async function applyCore(args, env, payload) {
3447
4021
  newId = created.dataId;
3448
4022
  writeChannel = "dataset/v2/saveFormData\uFF08\u4E3B\u8868 + \u660E\u7EC6\u4E00\u6B21\u5199\u5165\uFF09";
3449
4023
  } catch (e) {
3450
- writeWarnings.push("\u6570\u636E\u96C6\u65B0\u589E\u672A\u901A\u8FC7\uFF08" + e.message + "\uFF09\uFF0C\u6539\u4E3A\u5EFA\u4E3B\u8868\u540E\u7528\u6570\u636E\u96C6 update \u8865\u660E\u7EC6");
3451
- newId = await saveFormData(host, { appId: ctx.appId, formId: built.formId, objId: built.objId, name: built.structured.candidateName || "\u7B80\u5386\u5BFC\u5165", dataDetails: built.dataDetails });
3452
- writeChannel = "form/core/saveFormData\uFF08\u4E3B\u8868\uFF09+ dataset/v2/updateFormData\uFF08\u660E\u7EC6\uFF09";
3453
- if (Object.keys(built.detailsPayload).length) {
3454
- try {
3455
- await datasetUpdateFormData(host, { objId: built.objId, dataId: newId, mainTable: {}, details: built.detailsPayload });
3456
- } catch (e2) {
3457
- writeWarnings.push("\u56DE\u9000\u540E\u8865\u660E\u7EC6\u5931\u8D25\uFF1A" + e2.message);
3458
- }
3459
- }
4024
+ writeWarnings.push("\u6570\u636E\u96C6\u65B0\u589E\u672A\u901A\u8FC7\uFF08" + e.message + "\uFF09\uFF0C\u56DE\u9000\u9875\u9762\u7EA7\u901A\u9053\uFF1A\u4E3B\u8868+\u660E\u7EC6\u4E00\u6B21\u5199\u5165");
4025
+ const subCells = buildSubFormCells(built, {}, makeDictLookup(ctx.cache));
4026
+ newId = await saveFormData(host, { appId: ctx.appId, formId: built.formId, objId: built.objId, name: built.structured.candidateName || "\u7B80\u5386\u5BFC\u5165", dataDetails: [...built.dataDetails, ...subCells.cells] });
4027
+ writeChannel = "form/core/saveFormData\uFF08\u4E3B\u8868 + \u660E\u7EC6 subForm \u4E00\u6B21\u5199\u5165\uFF09";
4028
+ writeWarnings.push(...subCells.droppedCells);
3460
4029
  }
3461
4030
  mark("apply.saveFormData");
3462
4031
  const r2 = await host.request({ path: "/api/recruit/candidate/initTalentBatch?formDataId=" + newId, method: "POST" });
@@ -3574,7 +4143,6 @@ async function applyCore(args, env, payload) {
3574
4143
  // 产物链接(Agent 原样搬运:① 人才卡片单页 ② 人才库列表;缺失哪个只给另一个)
3575
4144
  viewLink: talentCardUrl ? `[\u67E5\u770B ${built.structured.candidateName || "\u65B0\u4EBA\u624D"} \u7684\u4EBA\u624D\u5361\u7247](${talentCardUrl})` : null,
3576
4145
  listLocateLink: talentListLocateUrl ? `[\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](${talentListLocateUrl})` : null,
3577
- agentNote: "\u6B63\u6587\u7ED9\u4E24\u4E2A Markdown \u94FE\u63A5\u2014\u2014\u2460 [\u67E5\u770B <\u59D3\u540D> \u7684\u4EBA\u624D\u5361\u7247](talentCardUrl) \u8BE6\u60C5\u5355\u9875 \u2461 [\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](talentListLocateUrl) \u53EA\u6253\u5F00\u5217\u8868\u3001\u4E0D\u6253\u5F00\u8BE6\u60C5\uFF1B\u7F3A\u5931\u54EA\u4E2A\u5C31\u53EA\u7ED9\u53E6\u4E00\u4E2A\uFF0C\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u4E0D\u8981\u7528 artifact / browsertool\u3002",
3578
4146
  parsed: {
3579
4147
  name: built.structured.candidateName,
3580
4148
  mobile: built.structured.telephone,
@@ -3703,7 +4271,7 @@ async function batchPrepare(args, env) {
3703
4271
  }
3704
4272
  });
3705
4273
  }
3706
- const fp = createHash3("sha256").update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest("hex");
4274
+ const fp = createHash4("sha256").update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest("hex");
3707
4275
  const store = saveBatchItems("resume-import", ready);
3708
4276
  const continuation = await env.continuation.issue({
3709
4277
  operation: "recruit-stage.resume.import.batch.apply",
@@ -3800,8 +4368,7 @@ async function batchApply(args, env) {
3800
4368
  skippedAtPrepare: blockedAtPrepare,
3801
4369
  skippedTotal: blockedAtPrepare + skipped,
3802
4370
  items: results,
3803
- resultTable: lines.join("\n"),
3804
- agentNote: "\u628A resultTable \u539F\u6837\u653E\u56DE\u7B54\u6B63\u6587\u3002\u6C47\u603B\u5FC5\u987B\u8BF4\u5168\u56DB\u7C7B\uFF1A\u6210\u529F / \u90E8\u5206\u6210\u529F / \u8DF3\u8FC7\uFF08\u91CD\u590D\uFF0C\u4E0D\u65B0\u5EFA\uFF09/ \u5931\u8D25\uFF1B\u8DF3\u8FC7\u6570 = skippedAtPrepare\uFF08\u51C6\u5907\u9636\u6BB5\u67E5\u91CD\uFF09+ skipped\uFF08\u5EFA\u6863\u65F6\u53D1\u73B0\u91CD\u590D\uFF09\uFF1B\u5931\u8D25\u6216\u90E8\u5206\u6210\u529F\u8981\u5E26 message \u539F\u56E0\uFF0C\u4E0D\u8981\u53EA\u62A5\u603B\u6570\u3002\u672B\u5C3E\u9644\u300C\u4EBA\u624D\u5E93\u300D\u56FA\u5B9A\u5730\u5740\u4E00\u4E2A\u94FE\u63A5\u3002"
4371
+ resultTable: lines.join("\n")
3805
4372
  });
3806
4373
  }
3807
4374
  var resumeImportOperations = [
@@ -4279,7 +4846,7 @@ async function resolveSaveActions(plan) {
4279
4846
  async function callAssignedInterview(host, formDataId) {
4280
4847
  const r = await host.request({ path: "/api/recruit/candidate/assignedInterview?formDataId=" + formDataId, method: "POST" });
4281
4848
  const ok = String(r?.code) === "200" || r?.status === true || r?.success === true;
4282
- if (!ok) throw rsFail("\u5206\u914D\u9762\u8BD5\uFF08assignedInterview\uFF09\u5931\u8D25\uFF1A" + (r?.msg || JSON.stringify(r).slice(0, 200)));
4849
+ if (!ok) throw rsFail("\u5206\u914D\u9762\u8BD5\uFF08assignedInterview\uFF09\u5931\u8D25\uFF1A" + (r?.msg || JSON.stringify(r).slice(0, 200)) + "\u3002\u26A0\uFE0F \u9762\u8BD5\u8BB0\u5F55\u5DF2\u4FDD\u5B58\uFF08formDataId=" + formDataId + "\uFF0C\u72B6\u6001\u505C\u7559\u5728\u8868\u5355\u9ED8\u8BA4\u503C\uFF0C\u901A\u5E38\u4E3A\u300C\u672A\u5F00\u59CB\u300D\uFF09\uFF1B\u4E0D\u8981\u91CD\u65B0 apply\uFF08\u4F1A\u91CD\u590D\u521B\u5EFA\u9762\u8BD5\u8BB0\u5F55\uFF09\u3002\u8BF7\u5230\u9762\u8BD5\u7BA1\u7406\u5217\u8868\u67E5\u770B\u8BE5\u8BB0\u5F55\uFF0C\u4FEE\u6B63\u804C\u4F4D\u6D41\u7A0B\u914D\u7F6E\u540E\u7528 updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\u3002\u5E38\u89C1\u539F\u56E0\uFF1A\u804C\u4F4D\u672A\u914D\u7F6E\u62DB\u8058\u6D41\u7A0B\uFF08\u6D41\u7A0B ID \u4E3A\u7A7A\uFF09\u3002");
4283
4850
  return r?.data || {};
4284
4851
  }
4285
4852
  async function execSaveActions(plan, formDataId) {
@@ -4301,7 +4868,7 @@ async function execSaveActions(plan, formDataId) {
4301
4868
  const r = await runEsb(host, { objId: plan.objId, dataIds: formDataId, esbActionIds: a.id });
4302
4869
  const ok = r?.status !== false;
4303
4870
  executed.push({ ...base, ok, msg: r?.successMsg || r?.failMsg || "" });
4304
- if (!ok) throw rsFail("\u300C\u4FDD\u5B58\u300D\u540E\u7EED\u52A8\u4F5C\u300C" + (a.name || a.id) + "\u300D\u6267\u884C\u5931\u8D25\uFF1A" + (r?.failMsg || "\u672A\u77E5\u539F\u56E0"));
4871
+ if (!ok) throw rsFail("\u300C\u4FDD\u5B58\u300D\u540E\u7EED\u52A8\u4F5C\u300C" + (a.name || a.id) + "\u300D\u6267\u884C\u5931\u8D25\uFF1A" + (r?.failMsg || "\u672A\u77E5\u539F\u56E0") + "\u3002\u26A0\uFE0F \u9762\u8BD5\u8BB0\u5F55\u5DF2\u4FDD\u5B58\u5E76\u5206\u914D\u6210\u529F\uFF08formDataId=" + formDataId + "\uFF09\uFF0C\u8BE5\u540E\u7EED\u52A8\u4F5C\u4E0D\u5F71\u54CD\u9762\u8BD5\u8BB0\u5F55\u672C\u8EAB\uFF1B\u4E0D\u8981\u91CD\u65B0 apply\uFF08\u4F1A\u91CD\u590D\u521B\u5EFA\uFF09\u3002");
4305
4872
  } else if (a.actionType === "jsCode") {
4306
4873
  if (ASSIGNED_API_RE.test(a.ecode || "")) {
4307
4874
  assigned = await callAssignedInterview(host, formDataId);
@@ -4353,14 +4920,18 @@ async function resolveInterviewListUrl(ctx) {
4353
4920
  if (cachedMenu?.listId && cachedMenu.combinationId) {
4354
4921
  return `${baseUrl}/ebdapp/view/${appId}/combination/${cachedMenu.combinationId}-${cachedMenu.listId || cachedMenu.cusMenuId}/search/${cachedMenu.pageId || cachedMenu.cusMenuId}?terminal=PC&cusMenuId=${cachedMenu.cusMenuId}`;
4355
4922
  }
4356
- const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
4357
4923
  const flat = [];
4358
- (function walk2(ns) {
4359
- for (const n of ns || []) if (n && typeof n === "object") {
4360
- flat.push(n);
4361
- walk2(n.children || n.childs);
4362
- }
4363
- })(r?.data?.cusAppMenus || r?.data);
4924
+ try {
4925
+ const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
4926
+ (function walk2(ns) {
4927
+ for (const n of toMenuList(ns)) if (n && typeof n === "object") {
4928
+ flat.push(n);
4929
+ walk2(n.children ?? n.childs);
4930
+ }
4931
+ })(r?.data);
4932
+ } catch {
4933
+ return null;
4934
+ }
4364
4935
  const node = findMenuNode(flat, ["\u9762\u8BD5\u7BA1\u7406", "\u9762\u8BD5\u5B89\u6392\u5217\u8868", "\u9762\u8BD5\u5B89\u6392"], (n) => n.combinationId && n.id && n.pageId);
4365
4936
  if (!node) return null;
4366
4937
  return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
@@ -4454,8 +5025,8 @@ async function prepare3(args, env, opts = {}) {
4454
5025
  }
4455
5026
  const defaultAiPlan = defPlan?.optionId ? { id: defPlan.optionId, name: defPlan.content } : void 0;
4456
5027
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
4457
- const { createHash: createHash4 } = await import("node:crypto");
4458
- const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
5028
+ const { createHash: createHash5 } = await import("node:crypto");
5029
+ const fp = createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex");
4459
5030
  const continuation = await env.continuation.issue({
4460
5031
  operation: "recruit-stage.interview.arrange.apply",
4461
5032
  fingerprint: fp,
@@ -4537,8 +5108,8 @@ async function applyCore2(args, env, payload) {
4537
5108
  throw rsFail("AI\u9762\u8BD5\u5FC5\u987B\u9009\u62E9\u300CAI\u9762\u8BD5\u65B9\u6848\u300D\uFF08\u5FC5\u586B\uFF09\uFF0C\u5F53\u524D\u672A\u6307\u5B9A\u3002\u53EF\u9009\u65B9\u6848\uFF1A" + (plan.aiPlanOptions.items?.length ? planBrief(plan.aiPlanOptions.items) : "\uFF08\u65E0\uFF09") + "\u3002\u8BF7\u8BA9\u7528\u6237\u9009\u62E9\u540E\u5E26 aiPlan \u91CD\u8BD5\u3002");
4538
5109
  }
4539
5110
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
4540
- const { createHash: createHash4 } = await import("node:crypto");
4541
- if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5111
+ const { createHash: createHash5 } = await import("node:crypto");
5112
+ if (payload.fingerprint !== createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
4542
5113
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
4543
5114
  }
4544
5115
  const formDataId = await saveFormData(ctx.host, {
@@ -4588,7 +5159,6 @@ async function applyCore2(args, env, payload) {
4588
5159
  interviewer: plan.summary.interviewer,
4589
5160
  viewLink: detailUrl ? `[\u67E5\u770B ${plan.cand.name || ""} \u7684\u9762\u8BD5\u5B89\u6392\u8BE6\u60C5](${detailUrl})` : null,
4590
5161
  listLocateLink: listLocateUrl ? `[\u6253\u5F00\u9762\u8BD5\u7BA1\u7406\u5217\u8868](${listLocateUrl})` : null,
4591
- agentNote: "\u4EA7\u7269 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF08\u5E73\u53F0\u5B9E\u8BC1\u53EF\u70B9\u51FB\uFF09\uFF1A\u2460 viewLink \u9762\u8BD5\u5B89\u6392\u8BE6\u60C5\u5355\u9875\uFF08\u539F\u6837\u642C\u8FD0\uFF0C\u4E0D\u6539\uFF09\u2461 listLocateLink \u9762\u8BD5\u5217\u8868\u2014\u2014\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u7528\u56FA\u5B9A\u8DEF\u7531\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA viewLink\uFF09\uFF0C\u5426\u5219\u539F\u6837\u642C\u8FD0\u3002\u6309\u987A\u5E8F\u653E\u56DE\u7B54\u6B63\u6587\uFF0C\u7F3A\u54EA\u4E2A\u53EA\u7ED9\u53E6\u4E00\u4E2A\u3001\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u4E0D\u8981\u5305 browsertool / <artifact> \u6807\u7B7E\u3002",
4592
5162
  aiPlan: plan.isAI && plan.aiPlanPicked ? { id: plan.aiPlanPicked.id, name: plan.aiPlanPicked.name } : void 0,
4593
5163
  saveActions: actionsRun.executed,
4594
5164
  verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
@@ -4714,8 +5284,8 @@ async function batchPrepare2(args, env) {
4714
5284
  }
4715
5285
  });
4716
5286
  }
4717
- const { createHash: createHash4 } = await import("node:crypto");
4718
- const fp = createHash4("sha256").update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest("hex");
5287
+ const { createHash: createHash5 } = await import("node:crypto");
5288
+ const fp = createHash5("sha256").update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest("hex");
4719
5289
  const continuation = await env.continuation.issue({
4720
5290
  operation: "recruit-stage.interview.arrange.batch.apply",
4721
5291
  fingerprint: fp,
@@ -4793,8 +5363,7 @@ async function batchApply2(args, env) {
4793
5363
  partial,
4794
5364
  failed,
4795
5365
  items: results,
4796
- resultTable: lines.join("\n"),
4797
- agentNote: "\u628A resultTable \u539F\u6837\u653E\u56DE\u7B54\u6B63\u6587\uFF08\u8FD9\u662F\u672C\u6B21\u6279\u91CF\u7EA6\u9762\u7684\u7ED3\u679C\u6E05\u5355\uFF09\uFF1B\u5931\u8D25/\u90E8\u5206\u6210\u529F\u7684\u6761\u76EE\u8981\u8FDE\u540C message \u4E00\u8D77\u8BF4\u6E05\u695A\uFF0C\u4E0D\u8981\u53EA\u62A5\u603B\u6570\u3002"
5366
+ resultTable: lines.join("\n")
4798
5367
  });
4799
5368
  }
4800
5369
  var interviewArrangeOperations = [
@@ -4972,8 +5541,8 @@ async function prepare4(args, env) {
4972
5541
  const newComment = args.comment !== void 0 ? String(args.comment) : t.target.judgement;
4973
5542
  const newResultName = args.result ? String(args.result) : t.target.result;
4974
5543
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
4975
- const { createHash: createHash4 } = await import("node:crypto");
4976
- const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
5544
+ const { createHash: createHash5 } = await import("node:crypto");
5545
+ const fp = createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex");
4977
5546
  const continuation = await env.continuation.issue({
4978
5547
  operation: "recruit-stage.interview.feedback.edit.apply",
4979
5548
  fingerprint: fp,
@@ -5034,8 +5603,8 @@ async function apply4(args, env) {
5034
5603
  const newComment = merged.comment !== void 0 ? String(merged.comment) : t.target.judgement;
5035
5604
  const newResultName = merged.result ? String(merged.result) : t.target.result;
5036
5605
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
5037
- const { createHash: createHash4 } = await import("node:crypto");
5038
- if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5606
+ const { createHash: createHash5 } = await import("node:crypto");
5607
+ if (payload.fingerprint !== createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5039
5608
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
5040
5609
  }
5041
5610
  const newDetails = details2.map((x) => {
@@ -5160,6 +5729,52 @@ var TYPES = {
5160
5729
  candidate: { listKey: "candidate", formType: "candidate_manage", title: "\u5E94\u8058\u8005", menuNames: ["\u5E94\u8058\u8005", "\u5E94\u8058\u7BA1\u7406", "\u5019\u9009\u4EBA", "\u5E94\u8058\u6279\u6B21"] }
5161
5730
  };
5162
5731
  var FEEDBACK_TODO_MENU_NAMES = ["\u6211\u7684\u9762\u8BD5", "\u6211\u7684\u9762\u8BD5\u5B89\u6392", "\u6211\u53C2\u4E0E\u7684\u9762\u8BD5"];
5732
+ function participationOf(r) {
5733
+ const tp = String(r?.interview_type_key || r?.interview_type || "").trim();
5734
+ const pick = (...keys) => {
5735
+ for (const k of keys) {
5736
+ const v = r?.[k];
5737
+ if (v === void 0 || v === null) continue;
5738
+ const s = String(v).trim();
5739
+ if (s) return { key: k, val: s };
5740
+ }
5741
+ return null;
5742
+ };
5743
+ if (/现场/.test(tp)) {
5744
+ const got2 = pick("interview_location");
5745
+ return {
5746
+ mode: "\u73B0\u573A\u9762\u8BD5",
5747
+ field: "interview_location",
5748
+ value: got2?.val ?? null,
5749
+ ...got2 ? {} : { note: "\u5217\u8868\u672A\u8FD4\u56DE\u9762\u8BD5\u5730\u70B9\uFF1B\u9700\u5728 E10 \u540E\u53F0\u628A\u300C\u9762\u8BD5\u5730\u70B9\u300D\u52A0\u5165\u9762\u8BD5\u7BA1\u7406\u5217\u8868\u663E\u793A\u5217" }
5750
+ };
5751
+ }
5752
+ if (/AI\s*面试/i.test(tp)) {
5753
+ const got2 = pick("applet_code");
5754
+ return {
5755
+ mode: "AI\u9762\u8BD5",
5756
+ field: "applet_code",
5757
+ value: got2?.val ?? null,
5758
+ ...got2 ? {} : { note: "AI \u9762\u8BD5\u4EE5\u5C0F\u7A0B\u5E8F\u7801/\u94FE\u63A5\u9080\u7EA6\uFF0C\u672C\u8EAB\u6CA1\u6709\u5730\u70B9" }
5759
+ };
5760
+ }
5761
+ if (/视频/.test(tp)) {
5762
+ const got2 = pick("video_url_info", "meeting_vedio", "meeting_id");
5763
+ return {
5764
+ mode: "\u89C6\u9891\u9762\u8BD5",
5765
+ field: got2?.key ?? "video_url_info",
5766
+ value: got2?.val ?? null,
5767
+ ...got2 ? {} : { note: "\u89C6\u9891\u9762\u8BD5\u4EE5\u89C6\u9891\u94FE\u63A5/\u4F1A\u8BAE\u53F7\u9080\u7EA6\uFF0C\u672C\u8EAB\u6CA1\u6709\u5730\u70B9" }
5768
+ };
5769
+ }
5770
+ const got = pick("interview_location");
5771
+ return {
5772
+ mode: tp || "\u672A\u586B\u9762\u8BD5\u65B9\u5F0F",
5773
+ field: "interview_location",
5774
+ value: got?.val ?? null,
5775
+ ...got ? {} : { note: "\u8BE5\u9762\u8BD5\u65B9\u5F0F\u672A\u914D\u7F6E\u53C2\u4E0E\u65B9\u5F0F\u5B57\u6BB5\uFF0C\u6216\u5217\u8868\u672A\u8FD4\u56DE" }
5776
+ };
5777
+ }
5163
5778
  var DISPLAY_ALIASES = {
5164
5779
  candidate_name: ["talent_id", "name"],
5165
5780
  position_name: ["position_manage_id", "position"],
@@ -5528,6 +6143,9 @@ async function runList(env, args, feedbackTodoMode) {
5528
6143
  break;
5529
6144
  }
5530
6145
  }
6146
+ if (type === "interview") {
6147
+ row.participation = participationOf(r);
6148
+ }
5531
6149
  outRows.push(row);
5532
6150
  }
5533
6151
  if (feedbackTodoMode) {
@@ -5547,7 +6165,9 @@ async function runList(env, args, feedbackTodoMode) {
5547
6165
  subject: r.subject,
5548
6166
  mobile: r.mobile,
5549
6167
  talent_id: r.talent_id,
5550
- position_manage_id: r.position_manage_id
6168
+ position_manage_id: r.position_manage_id,
6169
+ // 参与方式按面试方式取值(现场=地点 / 视频=链接 / AI=小程序码),不要统一当"地点"
6170
+ participation: participationOf(r)
5551
6171
  });
5552
6172
  const pending = serverFilterApplied ? outRows : outRows.filter((r) => /待反馈/.test(st(r)));
5553
6173
  const mineAll = serverFilterApplied ? outRows : me ? pending.filter((r) => iv(r).includes(me)) : [];
@@ -5699,7 +6319,9 @@ async function runInterviewNotAttended(env, args) {
5699
6319
  // 🔴 type=interview 的 talent_id 放的是**候选人姓名**不是 id(已知口径,见聚才林
5700
6320
  // recruit-read.md);下游编排一律用 candidate_manage_id / form_data_id,故此处不透传 talent_id。
5701
6321
  candidate_manage_id: r.candidate_manage_id || null,
5702
- form_data_id: r.form_data_id || null
6322
+ form_data_id: r.form_data_id || null,
6323
+ // 参与方式按面试方式取值(现场=地点 / 视频=链接 / AI=小程序码)
6324
+ participation: participationOf(r)
5703
6325
  };
5704
6326
  };
5705
6327
  const total = base.total;
@@ -5731,7 +6353,6 @@ async function runInterviewNotAttended(env, args) {
5731
6353
  rows: notAttended.map(slim),
5732
6354
  listUrl,
5733
6355
  listLocateLink: listUrl ? { title: "\u6253\u5F00\u6211\u53D1\u8D77\u7684\u9762\u8BD5\u5217\u8868", url: listUrl } : null,
5734
- agentNote: "\u4EA7\u7269 = \u7EDF\u8BA1\u7ED3\u8BBA + \u4E00\u4E2A Markdown \u94FE\u63A5\uFF08listLocateLink\uFF09\u3002\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA listUrl\uFF09\uFF1B\u8C03\u7528\u65F6\u76F4\u63A5\u4F20 listId \u66F4\u7A33\u3002\u4E0D\u8F93\u51FA\u534A\u622A\u94FE\u63A5\u3002",
5735
6356
  note: notes.join("\uFF1B")
5736
6357
  };
5737
6358
  }
@@ -5845,7 +6466,29 @@ async function resolvePureIds(host, ids) {
5845
6466
  }
5846
6467
  return map;
5847
6468
  }
5848
- async function handler(args, env) {
6469
+ function clampPageSize(v) {
6470
+ const n = Number(v);
6471
+ if (!Number.isFinite(n) || n <= 0) return 10;
6472
+ return Math.min(200, Math.trunc(n));
6473
+ }
6474
+ var ledgerObjIdMemo = /* @__PURE__ */ new Map();
6475
+ async function resolveLedgerObjId(host, listId, fallbackObjId) {
6476
+ const key = String(listId || "");
6477
+ if (!key) return String(fallbackObjId);
6478
+ const cached = ledgerObjIdMemo.get(key);
6479
+ if (cached) return cached;
6480
+ try {
6481
+ const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: { listId: key } });
6482
+ const v = String(li?.data?.objid || "");
6483
+ if (v) {
6484
+ ledgerObjIdMemo.set(key, v);
6485
+ return v;
6486
+ }
6487
+ } catch {
6488
+ }
6489
+ return String(fallbackObjId);
6490
+ }
6491
+ async function candidateSearchHandler(args, env) {
5849
6492
  const host = env.host;
5850
6493
  const session = await host.getSession();
5851
6494
  const baseUrl = session.baseUrl.replace(/\/+$/, "");
@@ -5859,19 +6502,56 @@ async function handler(args, env) {
5859
6502
  const cusMenuId = talent.cusMenuId;
5860
6503
  const menuName = talent.menuName || "\u4EBA\u624D\u7BA1\u7406";
5861
6504
  const fields = cache.fields[objId] || {};
6505
+ const ledgerObjId = await resolveLedgerObjId(host, String(listId), String(objId));
5862
6506
  const nameField = "field_" + (fields.candidate_name || fields.name);
5863
6507
  const mobileField = "field_" + fields.telephone;
5864
6508
  const name = args.name ? String(args.name) : "";
5865
6509
  const mobile = args.mobile ? String(args.mobile) : "";
6510
+ const keyword = args.keyword ? String(args.keyword) : "";
6511
+ const createdAfter = args.createdAfter ? String(args.createdAfter) : "";
5866
6512
  const conds = {};
5867
6513
  if (name) conds[nameField] = [{ [nameField]: name, [nameField + "_condition_type"]: "like" }];
5868
6514
  if (mobile) conds[mobileField] = [{ [mobileField]: mobile, [mobileField + "_condition_type"]: "like" }];
6515
+ let searchType = "and";
6516
+ let searchFields;
6517
+ let searchNote;
6518
+ let keywordIgnored;
6519
+ if (keyword && (name || mobile)) {
6520
+ keywordIgnored = {
6521
+ keyword,
6522
+ reason: "keyword \u4E0E name/mobile \u4E92\u65A5\uFF1A\u672C\u6B21\u6309 name/mobile \u7CBE\u786E\u6761\u4EF6\u8FC7\u6EE4\uFF0Ckeyword \u5DF2\u5FFD\u7565\uFF1B\u5982\u9700\u8DE8\u5B57\u6BB5\u5173\u952E\u8BCD\u641C\u7D22\uFF0C\u8BF7\u4E0D\u8981\u540C\u65F6\u4F20\u59D3\u540D/\u624B\u673A\u53F7"
6523
+ };
6524
+ }
6525
+ if (keyword && !name && !mobile) {
6526
+ searchType = "or";
6527
+ const meta = await resolveListSearchMeta(host, String(listId));
6528
+ const used = [];
6529
+ const fellBack = [];
6530
+ for (const dk of KEYWORD_TEXT_FIELDS) {
6531
+ const fid = fields[dk];
6532
+ if (!fid) continue;
6533
+ const bare = String(fid);
6534
+ const mk = "field_" + bare;
6535
+ const norm = normalizeListOperator(meta.operators[bare]);
6536
+ if (norm.fellBack) fellBack.push(meta.labels[bare] || dk);
6537
+ conds[mk] = [{ [mk]: keyword, [mk + "_condition_type"]: norm.op }];
6538
+ used.push({ field: dk, label: meta.labels[bare] || dk, operator: norm.op, ...norm.fellBack ? { operatorFallback: true } : {} });
6539
+ }
6540
+ searchFields = used;
6541
+ if (!used.length) {
6542
+ searchNote = "\u5173\u952E\u8BCD\u641C\u7D22\u672A\u5B9A\u4F4D\u5230\u4EFB\u4F55\u53EF\u7528\u5B57\u6BB5\uFF08\u73AF\u5883\u7F13\u5B58 fields \u4E0E\u76EE\u6807\u5B57\u6BB5\u6E05\u5355\u65E0\u4EA4\u96C6\uFF09\uFF0C\u672C\u6B21\u672A\u505A\u5173\u952E\u8BCD\u8FC7\u6EE4\uFF0C\u8FD4\u56DE\u7684\u662F\u5168\u5E93\u5206\u9875\u7ED3\u679C\uFF1B\u8BF7\u6539\u7528 name/mobile \u7CBE\u786E\u641C\u7D22";
6543
+ } else if (fellBack.length) {
6544
+ searchNote = `\u5B57\u6BB5\u300C${fellBack.join("\u3001")}\u300D\u914D\u7F6E\u7684\u64CD\u4F5C\u7B26\u4E0D\u5728\u5217\u8868\u67E5\u8BE2\u5DF2\u77E5\u96C6\u5408\u5185\uFF0C\u5DF2\u56DE\u9000 like\uFF1B\u5982\u9700\u7CBE\u786E\u5339\u914D\u8BF7\u6539\u7528 name/mobile`;
6545
+ }
6546
+ }
6547
+ const wantPageSize = clampPageSize(args.pageSize);
6548
+ const fetchPageSize = createdAfter ? Math.min(200, Math.max(wantPageSize * 5, 50)) : wantPageSize;
5869
6549
  const baseBody = {
5870
6550
  current: Number(args.current || 1),
5871
- pageSize: Number(args.pageSize || 10),
6551
+ pageSize: fetchPageSize,
5872
6552
  tableuid: randHex32(),
5873
6553
  listId,
5874
- searchParamData: { searchType: "3", commonSearchFields: conds, type: "and" },
6554
+ searchParamData: { searchType: "3", commonSearchFields: conds, type: searchType },
5875
6555
  terminal: "PC",
5876
6556
  browser: "Chrome",
5877
6557
  requiredMatch: 1,
@@ -5890,12 +6570,12 @@ async function handler(args, env) {
5890
6570
  delete cntBody.pageSize;
5891
6571
  const [resp, c] = await Promise.all([
5892
6572
  host.request({
5893
- path: "/api/ebuilder/form/list/getListDatas?passid=" + objId + "&cid=" + objId,
6573
+ path: "/api/ebuilder/form/list/getListDatas?passid=" + ledgerObjId + "&cid=" + ledgerObjId,
5894
6574
  body: baseBody,
5895
6575
  headers: extra
5896
6576
  }),
5897
6577
  host.request({
5898
- path: "/api/ebuilder/form/list/getListDataCount?passid=" + objId + "&cid=" + objId,
6578
+ path: "/api/ebuilder/form/list/getListDataCount?passid=" + ledgerObjId + "&cid=" + ledgerObjId,
5899
6579
  body: cntBody,
5900
6580
  headers: extra
5901
6581
  }).catch(() => null)
@@ -5910,7 +6590,16 @@ async function handler(args, env) {
5910
6590
  for (const item of cache.dict?.raw || []) {
5911
6591
  if (item.option_id && item.selection_name) dictNameMap[item.option_id] = item.selection_name;
5912
6592
  }
5913
- const out = { env: new URL(baseUrl).hostname, total, rows: [] };
6593
+ const out = {
6594
+ env: new URL(baseUrl).hostname,
6595
+ total,
6596
+ // 🔴 显式回执「本次关键词实际搜了哪些字段、各用什么操作符」:
6597
+ // 条件被服务端静默忽略时(total 与全库相同)调用方无从判断,有了这个清单才能自查。
6598
+ ...searchFields ? { keyword, searchFields } : {},
6599
+ ...searchNote ? { searchNote } : {},
6600
+ ...keywordIgnored ? { keywordIgnored } : {},
6601
+ rows: []
6602
+ };
5914
6603
  const outRows = out.rows;
5915
6604
  const inlineNames = rows.map((r) => parsePortalName(r.creator));
5916
6605
  const pureIds = [];
@@ -5936,6 +6625,41 @@ async function handler(args, env) {
5936
6625
  createTime: r.create_time || null
5937
6626
  });
5938
6627
  });
6628
+ if (createdAfter) {
6629
+ const cutoff = Date.parse(String(createdAfter).replace(/-/g, "/"));
6630
+ const fetched = outRows.length;
6631
+ if (Number.isNaN(cutoff)) {
6632
+ out.timeFilter = {
6633
+ createdAfter,
6634
+ mode: "client",
6635
+ applied: false,
6636
+ fetched,
6637
+ matched: fetched,
6638
+ note: "createdAfter \u65E0\u6CD5\u89E3\u6790\u4E3A\u65E5\u671F\uFF08\u5E94\u4E3A YYYY-MM-DD\uFF09\uFF0C\u672C\u6B21\u672A\u505A\u65F6\u95F4\u8FC7\u6EE4\uFF0C\u8FD4\u56DE\u7684\u662F\u5168\u65F6\u6BB5\u7ED3\u679C"
6639
+ };
6640
+ } else {
6641
+ const kept = outRows.filter((r) => {
6642
+ const t = Date.parse(String(r.createTime || "").replace(/-/g, "/"));
6643
+ return !Number.isNaN(t) && t >= cutoff;
6644
+ });
6645
+ out.rows = kept;
6646
+ out.returned = kept.length;
6647
+ out.timeFilter = {
6648
+ createdAfter,
6649
+ mode: "client",
6650
+ applied: true,
6651
+ fetched,
6652
+ matched: kept.length,
6653
+ fetchPageSize,
6654
+ // 🔴 2026-11-28 修「total 语义歧义」:顶层 total 是**服务端未过滤**的总数(关键词命中全量),
6655
+ // 不是时间段内的数量。这里显式带出,避免调用方把 total 当成「半年内有多少人」。
6656
+ totalUnfiltered: total,
6657
+ // 🔴 必须显式声明「命中数 ≠ 该时间段全库总数」:客户端只能筛已取回的行,
6658
+ // 不写清会让调用方把 matched 当成真实总数,进而误判「半年内只有这么多人」。
6659
+ note: kept.length < wantPageSize ? `\u670D\u52A1\u7AEF\u4E0D\u652F\u6301\u6309\u521B\u5EFA\u65F6\u95F4\u8FC7\u6EE4\uFF0C\u5DF2\u5BA2\u6237\u7AEF\u7B5B\u9009\uFF1A\u53D6\u56DE ${fetched} \u884C\u3001\u547D\u4E2D ${kept.length} \u884C\uFF08\u5C11\u4E8E\u671F\u671B ${wantPageSize}\uFF09\u3002\u547D\u4E2D\u6570\u4E0D\u4EE3\u8868\u8BE5\u65F6\u95F4\u6BB5\u5168\u5E93\u603B\u6570\uFF0C\u53EF\u52A0\u5927 pageSize \u6216\u7FFB\u9875\u540E\u91CD\u67E5` : `\u670D\u52A1\u7AEF\u4E0D\u652F\u6301\u6309\u521B\u5EFA\u65F6\u95F4\u8FC7\u6EE4\uFF0C\u5DF2\u5BA2\u6237\u7AEF\u7B5B\u9009\uFF1A\u53D6\u56DE ${fetched} \u884C\u3001\u547D\u4E2D ${kept.length} \u884C`
6660
+ };
6661
+ }
6662
+ }
5939
6663
  return rsSuccess("recruit-stage.candidate.search", out);
5940
6664
  }
5941
6665
  var FALLBACK_TAG_FIELDS = { public: "field_11", private: "field_12" };
@@ -5949,10 +6673,37 @@ function clampInt(v, min, max, fallback) {
5949
6673
  function normTag(s) {
5950
6674
  return String(s == null ? "" : s).trim().toLowerCase();
5951
6675
  }
5952
- async function resolveTagFields(host, listId) {
5953
- let publicKey = FALLBACK_TAG_FIELDS.public;
5954
- let privateKey = FALLBACK_TAG_FIELDS.private;
5955
- let fromConfig = false;
6676
+ var LIST_QUERY_OPS = /* @__PURE__ */ new Set(["like", "eq", "neq", "ne", "in", "between", "inc", "contains", "notlike", "uncontains"]);
6677
+ function normalizeListOperator(raw) {
6678
+ const rawStr = String(raw ?? "").trim();
6679
+ const s = rawStr.toLowerCase();
6680
+ if (s && LIST_QUERY_OPS.has(s)) return { op: rawStr, fellBack: false };
6681
+ return { op: "like", fellBack: true };
6682
+ }
6683
+ function firstConditionType(it) {
6684
+ const ct = it?.conditionType ?? it?.conditionTypeValue ?? it?.conditionTypes ?? it?.conditions;
6685
+ const pick = (v) => {
6686
+ if (typeof v === "string") return v;
6687
+ if (v && typeof v === "object") return String(v.value ?? v.key ?? v.code ?? v.conditionType ?? "");
6688
+ return "";
6689
+ };
6690
+ if (Array.isArray(ct)) {
6691
+ for (const x of ct) {
6692
+ const s = pick(x);
6693
+ if (s) return s;
6694
+ }
6695
+ return "";
6696
+ }
6697
+ return pick(ct);
6698
+ }
6699
+ async function resolveListSearchMeta(host, listId) {
6700
+ const meta = {
6701
+ publicKey: FALLBACK_TAG_FIELDS.public,
6702
+ privateKey: FALLBACK_TAG_FIELDS.private,
6703
+ fromConfig: false,
6704
+ operators: {},
6705
+ labels: {}
6706
+ };
5956
6707
  try {
5957
6708
  const r = await host.request({
5958
6709
  path: "/api/ebuilder/form/listSearch/getListSearch/" + encodeURIComponent(listId),
@@ -5964,20 +6715,42 @@ async function resolveTagFields(host, listId) {
5964
6715
  if (!it || !it.id) continue;
5965
6716
  const raw = String(it.id);
5966
6717
  const key = raw.indexOf("field_") === 0 ? raw : "field_" + raw;
5967
- const label = String(it.label || "");
6718
+ const bare = key.slice("field_".length);
6719
+ const label = String(it.label || it.showName || it.fieldName || "");
6720
+ if (label) meta.labels[bare] = label;
5968
6721
  if (label === "\u516C\u5171\u6807\u7B7E") {
5969
- publicKey = key;
5970
- fromConfig = true;
6722
+ meta.publicKey = key;
6723
+ meta.fromConfig = true;
5971
6724
  } else if (label === "\u6211\u7684\u6807\u7B7E") {
5972
- privateKey = key;
5973
- fromConfig = true;
6725
+ meta.privateKey = key;
6726
+ meta.fromConfig = true;
5974
6727
  }
6728
+ const op = firstConditionType(it);
6729
+ if (op) meta.operators[bare] = op;
5975
6730
  }
5976
6731
  }
5977
6732
  } catch {
5978
6733
  }
5979
- return { publicKey, privateKey, fromConfig };
5980
- }
6734
+ return meta;
6735
+ }
6736
+ var KEYWORD_TEXT_FIELDS = [
6737
+ "candidate_name",
6738
+ // 姓名
6739
+ "intend_position",
6740
+ // 期望职位
6741
+ "current_position",
6742
+ // 当前职位(OCR 建档才有)
6743
+ "last_position_id",
6744
+ // 最近职位(渠道导入常有)
6745
+ "current_industry",
6746
+ // 当前公司(OCR 建档才有)
6747
+ "last_company_id",
6748
+ // 最近公司(渠道导入常有)
6749
+ "college",
6750
+ // 毕业院校
6751
+ "self_desc"
6752
+ // 自我评价
6753
+ ];
5981
6754
  function buildTagCond(ids, keys, mode) {
5982
6755
  const groups = [];
5983
6756
  const pub = ids.filter((x) => (x.type ?? 0) === 0).map((x) => String(x.id));
@@ -6051,13 +6824,8 @@ async function handlerSearchByTag(args, env) {
6051
6824
  rows: []
6052
6825
  });
6053
6826
  }
6054
- const keys = await resolveTagFields(host, String(listId));
6055
- let ledgerObjId = String(objId);
6056
- try {
6057
- const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: { listId: String(listId) } });
6058
- if (li?.data?.objid) ledgerObjId = String(li.data.objid);
6059
- } catch {
6060
- }
6827
+ const keys = await resolveListSearchMeta(host, String(listId));
6828
+ const ledgerObjId = await resolveLedgerObjId(host, String(listId), String(objId));
6061
6829
  const listPath = "/api/ebuilder/form/list/getListDatas?passid=" + ledgerObjId + "&cid=" + ledgerObjId;
6062
6830
  const countPath = "/api/ebuilder/form/list/getListDataCount?passid=" + ledgerObjId + "&cid=" + ledgerObjId;
6063
6831
  const headers = { ebBusinessId: listId };
@@ -6239,10 +7007,12 @@ var searchOperations = [
6239
7007
  inputSchema: schemaOf({
6240
7008
  name: { type: "string", description: "\u59D3\u540D\u5173\u952E\u8BCD\uFF08like\uFF09" },
6241
7009
  mobile: { type: "string", pattern: "^\\d{6,20}$", description: "\u624B\u673A\u53F7\uFF08like\uFF09" },
7010
+ keyword: { type: "string", description: "\u8DE8\u5B57\u6BB5\u5173\u952E\u8BCD\u641C\u7D22\uFF08E10 \u5217\u8868\u5FEB\u6377\u641C\u7D22\uFF0C\u5339\u914D\u59D3\u540D/\u804C\u4F4D/\u516C\u53F8/\u9662\u6821\u7B49\uFF09" },
7011
+ createdAfter: { type: "string", description: "\u521B\u5EFA\u65F6\u95F4\u8FC7\u6EE4\u8D77\u59CB\u65E5\u671F\uFF08YYYY-MM-DD\uFF0C\u6309 create_time gte \u8FC7\u6EE4\uFF09" },
6242
7012
  pageSize: { type: "integer", minimum: 1, maximum: 100 },
6243
7013
  current: { type: "integer", minimum: 1 }
6244
7014
  }, {}),
6245
- handler
7015
+ handler: candidateSearchHandler
6246
7016
  },
6247
7017
  {
6248
7018
  name: "recruit-stage.candidate.searchByTag",
@@ -6375,11 +7145,20 @@ function listOperation() {
6375
7145
  };
6376
7146
  if (type === 0) body.tagModules = ["recruit"];
6377
7147
  const r = await env.host.request({ path: "/api/my/tag/query", method: "POST", body });
6378
- const list = r?.data?.data;
6379
- if (!Array.isArray(list)) throw rsFail("\u6807\u7B7E\u5E93\u67E5\u8BE2\u5931\u8D25\uFF1A" + (r?.msg || "\u65E0\u8FD4\u56DE"), { response: r });
7148
+ const payload = r?.data;
7149
+ const list = payload?.data;
7150
+ const upstreamFailed = r?.status === false || r?.fail === true || typeof r?.code === "number" && r.code !== 200;
7151
+ if (upstreamFailed) throw rsFail("\u6807\u7B7E\u5E93\u67E5\u8BE2\u5931\u8D25\uFF1A" + (r?.msg || "\u65E0\u8FD4\u56DE"), { response: r });
7152
+ if (!Array.isArray(list)) {
7153
+ const total = Number(payload?.total ?? 0);
7154
+ if (Number.isFinite(total) && total > 0) {
7155
+ throw rsFail("\u6807\u7B7E\u5E93\u67E5\u8BE2\u5931\u8D25\uFF1A\u8FD4\u56DE\u7ED3\u6784\u5F02\u5E38\uFF08total=" + total + " \u4F46\u6CA1\u6709\u6807\u7B7E\u6570\u7EC4\uFF09", { response: r });
7156
+ }
7157
+ return rsSuccess("tag.list", { type: type === 0 ? "public" : "personal", total: 0, tags: [] });
7158
+ }
6380
7159
  return rsSuccess("tag.list", {
6381
7160
  type: type === 0 ? "public" : "personal",
6382
- total: Number(r?.data?.total ?? list.length),
7161
+ total: Number(payload?.total ?? list.length),
6383
7162
  tags: list.map((t) => ({
6384
7163
  tagId: String(t.tagId),
6385
7164
  name: String(t.name),
@@ -6529,9 +7308,275 @@ function applyOperation() {
6529
7308
  }
6530
7309
  var tagOperations = [listOperation(), prepareOperation(), applyOperation()];
6531
7310
 
7311
+ // src/shortcuts/recruit-stage/operations/profile.ts
7312
+ function makeDictLookup2(cache) {
7313
+ const byId = /* @__PURE__ */ new Map();
7314
+ for (const x of cache.dict?.raw || []) {
7315
+ if (x.option_id && x.selection_name) byId.set(String(x.option_id), x.selection_name);
7316
+ }
7317
+ return (id) => byId.get(String(id)) || "";
7318
+ }
7319
+ function detailDisplayValue(d, dictName) {
7320
+ if (!d) return "";
7321
+ if (Array.isArray(d.dataOptions) && d.dataOptions.length) {
7322
+ const names = d.dataOptions.map((o) => String(o?.content ?? "")).filter(Boolean);
7323
+ if (names.length) return names.join(",");
7324
+ return String(d.dataOptions[0]?.optionId ?? "");
7325
+ }
7326
+ if (d.dataText?.content != null) return String(d.dataText.content);
7327
+ if (d.content != null) {
7328
+ const s = String(d.content);
7329
+ const dn = dictName(s);
7330
+ return dn || s;
7331
+ }
7332
+ return "";
7333
+ }
7334
+ async function handlerProfile(args, env) {
7335
+ const host = env.host;
7336
+ const session = await host.getSession();
7337
+ const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
7338
+ ctx.appId = ctx.cache.appId;
7339
+ const talentId = String(args.talentId || "").trim();
7340
+ if (!talentId) throw rsFail("talentId \u5FC5\u586B");
7341
+ const objId = objIdOf(ctx.cache, "talent_pool");
7342
+ const formId = formIdOf(ctx.cache, "talent_pool");
7343
+ const fields = ctx.cache.fields[objId] || {};
7344
+ const revFields = {};
7345
+ for (const [dk, fid] of Object.entries(fields)) revFields[String(fid)] = dk;
7346
+ const rec = await getFormDataRecord(host, formId, talentId, objId);
7347
+ const dets = rec.dataDetails || [];
7348
+ if (!dets.length) throw rsFail("\u672A\u627E\u5230\u4EBA\u624D\u8BB0\u5F55\uFF08talentId=" + talentId + "\uFF09\uFF0C\u53EF\u80FD\u5DF2\u5220\u9664\u6216\u4E0D\u5B58\u5728");
7349
+ const dictName = makeDictLookup2(ctx.cache);
7350
+ const layoutMeta = await getFormLayoutMeta(host, formId);
7351
+ const comps = layoutMeta?.formLayout?.pageLayouts?.[0]?.comps || [];
7352
+ const subFormToDataKey = {};
7353
+ for (const c of comps) {
7354
+ const cfg = c.config || {};
7355
+ if (c.type === "DetailTable" && cfg.subFormId && cfg.dataKey) {
7356
+ subFormToDataKey[String(cfg.subFormId)] = String(cfg.dataKey);
7357
+ }
7358
+ if (cfg.subFormId && cfg.fieldId && cfg.dataKey) {
7359
+ revFields[String(cfg.fieldId)] = String(cfg.dataKey);
7360
+ }
7361
+ if (cfg.subFormId && cfg.start && cfg.end) {
7362
+ if (cfg.start.fieldId && cfg.start.dataKey) revFields[String(cfg.start.fieldId)] = String(cfg.start.dataKey);
7363
+ if (cfg.end.fieldId && cfg.end.dataKey) revFields[String(cfg.end.fieldId)] = String(cfg.end.dataKey);
7364
+ }
7365
+ }
7366
+ const main = {};
7367
+ const rowMap = {};
7368
+ for (const d of dets) {
7369
+ const fid = String(d.fieldId || d.formField?.id || "");
7370
+ const dk = revFields[fid] || fid;
7371
+ const val = detailDisplayValue(d, dictName);
7372
+ if (d.subFormId) {
7373
+ const sid = String(d.subFormId);
7374
+ const didx = String(d.dataIndex ?? "0");
7375
+ if (!rowMap[sid]) rowMap[sid] = /* @__PURE__ */ new Map();
7376
+ if (!rowMap[sid].has(didx)) rowMap[sid].set(didx, {});
7377
+ if (val) rowMap[sid].get(didx)[dk] = val;
7378
+ } else {
7379
+ if (val) main[dk] = val;
7380
+ }
7381
+ }
7382
+ const subTables = {};
7383
+ const subTableStats = {};
7384
+ const unclassified = {};
7385
+ for (const [sid, rows] of Object.entries(rowMap)) {
7386
+ const arr = [...rows.values()].filter((r) => Object.keys(r).length > 0);
7387
+ if (!arr.length) continue;
7388
+ const dk = subFormToDataKey[sid];
7389
+ if (dk) {
7390
+ subTables[dk] = arr;
7391
+ subTableStats[dk] = arr.length;
7392
+ } else {
7393
+ unclassified[sid] = arr;
7394
+ }
7395
+ }
7396
+ const warnings = [];
7397
+ const unclassifiedTotal = Object.values(unclassified).reduce((n, r) => n + r.length, 0);
7398
+ if (unclassifiedTotal) {
7399
+ warnings.push(`\u6709 ${unclassifiedTotal} \u884C\u660E\u7EC6\u672A\u80FD\u5F52\u7C7B\u5230\u5DF2\u77E5\u660E\u7EC6\u8868\uFF08\u8868\u5355\u5E03\u5C40\u672A\u89E3\u6790\u5230\u5BF9\u5E94 DetailTable \u914D\u7F6E\uFF09\uFF0C\u5DF2\u653E\u5728 unclassifiedDetails\uFF1B\u4E0D\u8981\u636E\u6B64\u5224\u5B9A\u300C\u8BE5\u5019\u9009\u4EBA\u6CA1\u6709\u8FD9\u4E9B\u7ECF\u5386\u300D`);
7400
+ }
7401
+ if (!layoutMeta) {
7402
+ warnings.push("\u8868\u5355\u5E03\u5C40\u63A5\u53E3\u672A\u8FD4\u56DE\u6570\u636E\uFF0C\u660E\u7EC6\u8868\u5217\u540D\u53EF\u80FD\u663E\u793A\u4E3A\u88F8\u5B57\u6BB5 id");
7403
+ }
7404
+ const profile = {
7405
+ talentId,
7406
+ basic: {
7407
+ name: main.candidate_name || "",
7408
+ mobile: main.telephone || "",
7409
+ email: main.email || "",
7410
+ gender: main.gender || "",
7411
+ age: main.age || "",
7412
+ birthday: main.birthday || "",
7413
+ degree: main.highest_degree || "",
7414
+ college: main.college || "",
7415
+ joinworkdate: main.joinworkdate || "",
7416
+ graduate_date: main.graduate_date || "",
7417
+ intend_position: main.intend_position || "",
7418
+ intended_workplace: main.intended_workplace || "",
7419
+ // 🔴 实测(2026-11-27 自用环境):BOSS直聘等渠道导入的人才,现职/现公司在
7420
+ // last_position_id / last_company_id,而 current_position / current_industry 为空
7421
+ // (后者只在 OCR 解析出 jobInformations[0] 时才写)。不回退会让基本信息大面积空白,
7422
+ // 匹配度评估拿不到关键依据。
7423
+ current_position: main.current_position || main.last_position_id || "",
7424
+ current_industry: main.current_industry || main.last_company_id || "",
7425
+ expect_salary: main.expect_salary || "",
7426
+ location_area: main.location_area || "",
7427
+ recruit_status: main.recruit_status || "",
7428
+ self_desc: main.self_desc || "",
7429
+ work_ability: main.work_ability || "",
7430
+ channel: main.channel || ""
7431
+ },
7432
+ education: subTables.rcrt_education_exp || [],
7433
+ workExperience: subTables.rcrt_work_exp || [],
7434
+ internship: subTables.rcrt_sxjl || [],
7435
+ projectExperience: subTables.rcrt_project_exp || [],
7436
+ awards: subTables.rcrt_award_exp || [],
7437
+ languages: subTables.rcrt_language_skill || [],
7438
+ subTableStats,
7439
+ // 🔴 未归类明细与告警必须显式暴露:静默返回空数组会让调用方误判「没有这段经历」
7440
+ ...unclassifiedTotal ? { unclassifiedDetails: unclassified } : {},
7441
+ ...warnings.length ? { warnings } : {},
7442
+ rawMain: main
7443
+ // 完整主表字段(含可能新增的字段)
7444
+ };
7445
+ return rsSuccess("recruit-stage.candidate.profile", profile);
7446
+ }
7447
+ var profileOperations = [
7448
+ {
7449
+ name: "recruit-stage.candidate.profile",
7450
+ resource: "recruit.candidate",
7451
+ method: "query",
7452
+ action: "candidate.profile",
7453
+ summary: "\u6309 talentId \u62C9\u53D6\u4EBA\u624D\u5B8C\u6574\u6863\u6848\uFF1A\u57FA\u672C\u4FE1\u606F\uFF08\u4E3B\u8868\u5168\u90E8\u5B57\u6BB5\uFF09+ \u6559\u80B2\u7ECF\u5386 + \u5DE5\u4F5C\u7ECF\u5386 + \u9879\u76EE\u7ECF\u5386\u7B49\u660E\u7EC6\u8868\u3002\u7528\u4E8E\u5339\u914D\u5EA6\u8BC4\u4F30\u3001\u5019\u9009\u4EBA\u5206\u6790",
7454
+ capability: "recruit.candidate.profile",
7455
+ risk: "read",
7456
+ inputSchema: schemaOf({
7457
+ talentId: { type: "string", description: "\u4EBA\u624D\u8BB0\u5F55 id\uFF08\u6765\u81EA candidate.search \u6216 resume.import.apply \u7684 talentId\uFF09" }
7458
+ }, { required: ["talentId"] }),
7459
+ handler: handlerProfile
7460
+ }
7461
+ ];
7462
+
7463
+ // src/shortcuts/recruit-stage/operations/shortlist.ts
7464
+ function clampInt2(v, min, max, fallback) {
7465
+ const n = Number(v);
7466
+ if (!Number.isFinite(n)) return fallback;
7467
+ return Math.min(max, Math.max(min, Math.trunc(n)));
7468
+ }
7469
+ function slimProfile(profile, full) {
7470
+ if (full) return profile || {};
7471
+ const basic = profile?.basic || {};
7472
+ const rawMain = profile?.rawMain || {};
7473
+ return {
7474
+ talentId: profile?.talentId || "",
7475
+ name: basic.name || "",
7476
+ degree: basic.degree || "",
7477
+ college: basic.college || "",
7478
+ current_position: basic.current_position || "",
7479
+ current_industry: basic.current_industry || "",
7480
+ intend_position: basic.intend_position || "",
7481
+ expect_salary: basic.expect_salary || "",
7482
+ location_area: basic.location_area || "",
7483
+ graduate_date: basic.graduate_date || "",
7484
+ recruit_status: basic.recruit_status || "",
7485
+ // 渠道导入的人才,工作年限常只落在 rawMain.work_exp,这里提出到顶层方便直接读
7486
+ work_exp: rawMain.work_exp || "",
7487
+ education: profile?.education || [],
7488
+ workExperience: profile?.workExperience || [],
7489
+ projectExperience: profile?.projectExperience || [],
7490
+ subTableStats: profile?.subTableStats || {},
7491
+ ...profile?.warnings ? { warnings: profile.warnings } : {}
7492
+ };
7493
+ }
7494
+ async function handlerShortlist(args, env) {
7495
+ const keyword = String(args.keyword || "").trim();
7496
+ if (!keyword) {
7497
+ throw rsFail('keyword \u5FC5\u586B\uFF1A\u8BF7\u63D0\u4F9B\u8981\u68C0\u7D22\u7684\u5173\u952E\u8BCD\uFF0C\u4F8B\u5982 {"keyword":"Java\u5F00\u53D1"}');
7498
+ }
7499
+ const limit = clampInt2(args.limit, 1, 10, 5);
7500
+ const concurrency = clampInt2(args.concurrency, 1, 10, 5);
7501
+ const full = args.full === true;
7502
+ const startedAt = Date.now();
7503
+ const tSearch = Date.now();
7504
+ const searchEnv = await candidateSearchHandler(
7505
+ {
7506
+ keyword,
7507
+ pageSize: limit,
7508
+ ...args.current ? { current: Number(args.current) } : {}
7509
+ },
7510
+ env
7511
+ );
7512
+ const sdata = searchEnv?.data || {};
7513
+ const rows = (sdata.rows || []).slice(0, limit);
7514
+ const searchMs = Date.now() - tSearch;
7515
+ const tProfiles = Date.now();
7516
+ const candidates = [];
7517
+ const errors = [];
7518
+ for (let i = 0; i < rows.length; i += concurrency) {
7519
+ const batch = rows.slice(i, i + concurrency);
7520
+ const settled = await Promise.allSettled(
7521
+ batch.map((r) => handlerProfile({ talentId: r.talentId }, env))
7522
+ );
7523
+ settled.forEach((s, idx) => {
7524
+ const src = batch[idx] || {};
7525
+ if (s.status === "fulfilled") {
7526
+ const data = s.value?.data || {};
7527
+ candidates.push(slimProfile(data, full));
7528
+ } else {
7529
+ const reason = s.reason;
7530
+ errors.push({
7531
+ talentId: src.talentId || null,
7532
+ name: src.name || null,
7533
+ message: String(reason && reason.message || reason || "\u672A\u77E5\u9519\u8BEF")
7534
+ });
7535
+ }
7536
+ });
7537
+ }
7538
+ const profilesMs = Date.now() - tProfiles;
7539
+ return rsSuccess("recruit-stage.candidate.shortlist", {
7540
+ keyword,
7541
+ // total 是服务端关键词命中总数(不是本次取回数),returned/shown 才是本次实际处理量
7542
+ total: Number(sdata.total) || 0,
7543
+ returned: rows.length,
7544
+ shown: candidates.length,
7545
+ limit,
7546
+ concurrency,
7547
+ ...sdata.searchFields ? { searchFields: sdata.searchFields } : {},
7548
+ ...sdata.searchNote ? { searchNote: sdata.searchNote } : {},
7549
+ listRows: rows,
7550
+ candidates,
7551
+ ...errors.length ? { errors } : {},
7552
+ timing: { searchMs, profilesMs, totalMs: Date.now() - startedAt }
7553
+ });
7554
+ }
7555
+ var shortlistOperations = [
7556
+ {
7557
+ name: "recruit-stage.candidate.shortlist",
7558
+ resource: "recruit.candidate",
7559
+ method: "query",
7560
+ action: "candidate.shortlist",
7561
+ summary: "\u5173\u952E\u8BCD\u4E00\u6B21\u5B8C\u6210\u300C\u641C\u7D22 + \u9010\u4EBA\u6863\u6848\u300D\uFF1A\u53EA\u53D6\u524D limit \u4EBA\u5E76\u5E76\u53D1\u62C9\u53D6\u6863\u6848\uFF0C\u8FD4\u56DE\u7CBE\u7B80\u6863\u6848\uFF08\u5DE5\u4F5C/\u9879\u76EE\u7ECF\u5386\uFF09\u4E0E\u5206\u6BB5\u8017\u65F6\u3002\u7528\u4E8E\u7B80\u5386\u68C0\u7D22\u4E0E\u4EBA\u5C97\u5339\u914D\uFF0C\u66FF\u4EE3\u300C\u5148 search \u518D\u9010\u4EBA profile\u300D\u7684\u591A\u6B21\u5F80\u8FD4",
7562
+ capability: "recruit.candidate.shortlist",
7563
+ risk: "read",
7564
+ inputSchema: schemaOf({
7565
+ keyword: { type: "string", description: "\u8DE8\u5B57\u6BB5\u5173\u952E\u8BCD\uFF08\u5339\u914D\u59D3\u540D/\u671F\u671B\u804C\u4F4D/\u5F53\u524D\u804C\u4F4D/\u6700\u8FD1\u804C\u4F4D/\u516C\u53F8/\u9662\u6821/\u81EA\u6211\u8BC4\u4EF7\uFF09" },
7566
+ limit: { type: "integer", minimum: 1, maximum: 10, description: "\u53D6\u524D N \u4EBA\uFF0C\u9ED8\u8BA4 5\uFF0C\u4E0A\u9650 10" },
7567
+ current: { type: "integer", minimum: 1, description: "\u641C\u7D22\u7ED3\u679C\u8D77\u59CB\u9875\uFF0C\u9ED8\u8BA4 1" },
7568
+ concurrency: { type: "integer", minimum: 1, maximum: 10, description: "\u6863\u6848\u5E76\u53D1\u6570\uFF0C\u9ED8\u8BA4 5" },
7569
+ full: { type: "boolean", description: "true=\u8FD4\u56DE\u5B8C\u6574\u6863\u6848\uFF08\u542B rawMain \u5168\u5B57\u6BB5\uFF09\uFF1B\u9ED8\u8BA4 false \u8FD4\u56DE\u7CBE\u7B80\u6863\u6848" }
7570
+ }, { required: ["keyword"] }),
7571
+ handler: handlerShortlist
7572
+ }
7573
+ ];
7574
+
6532
7575
  // src/shortcuts/recruit-stage/operations/registry.ts
6533
7576
  var definitions = [
6534
7577
  ...searchOperations,
7578
+ ...profileOperations,
7579
+ ...shortlistOperations,
6535
7580
  ...listOperations,
6536
7581
  ...tagOperations,
6537
7582
  ...jdCreateOperations,
@@ -6560,10 +7605,12 @@ function getRecruitStageOperation(operation) {
6560
7605
  }
6561
7606
  async function executeRecruitStageOperation(operation, input, env) {
6562
7607
  const definition = getRecruitStageOperation(operation);
7608
+ const debugTimings = input.debugTimings === true;
7609
+ const validated = debugTimings ? Object.fromEntries(Object.entries(input).filter(([k]) => k !== "debugTimings")) : input;
6563
7610
  const schema = definition.inputSchema;
6564
7611
  if (schema && schema.additionalProperties === false) {
6565
7612
  const known = Object.keys(schema.properties || {});
6566
- const unknown = Object.keys(input || {}).filter((key) => !known.includes(key));
7613
+ const unknown = Object.keys(validated || {}).filter((key) => !known.includes(key));
6567
7614
  if (unknown.length > 0) {
6568
7615
  throw new RecruitStageCliError(
6569
7616
  "validation",
@@ -6573,7 +7620,13 @@ async function executeRecruitStageOperation(operation, input, env) {
6573
7620
  );
6574
7621
  }
6575
7622
  }
6576
- return definition.handler(input, env);
7623
+ const startedAt = Date.now();
7624
+ const result = await definition.handler(validated, env);
7625
+ if (debugTimings && result && typeof result === "object") {
7626
+ const marks = { ...env?.__recruitTimings ?? {} };
7627
+ result.meta = { ...result.meta ?? {}, timings: { ...marks, totalMs: Date.now() - startedAt } };
7628
+ }
7629
+ return result;
6577
7630
  }
6578
7631
 
6579
7632
  // src/shortcuts/recruit-stage/manifest.ts
@@ -6598,13 +7651,15 @@ var recruitStageManifest = {
6598
7651
  sourceSkill: "weaver-e10-recruit-stage",
6599
7652
  capabilities: ["recruit.jd.create", "recruit.resume.import", "recruit.interview.arrange", "recruit.interview.feedback", "recruit.list", "recruit.candidate.search", "recruit.tag"],
6600
7653
  operations: buildOperations(),
7654
+ // 招聘域当前没有 withheld 能力,显式给 0,便于模型按统一字段判断边界(2026-11-27 审计 G-10)。
7655
+ withheldCount: 0,
6601
7656
  withheldOperations: []
6602
7657
  };
6603
7658
 
6604
7659
  // src/shortcuts/recruit-stage/context.ts
6605
- import { join as join4, resolve as resolve4, dirname as dirname2 } from "node:path";
6606
- import { existsSync as existsSync2 } from "node:fs";
6607
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "node:fs/promises";
7660
+ import { join as join4, resolve as resolve4, dirname as dirname3 } from "node:path";
7661
+ import { existsSync as existsSync3 } from "node:fs";
7662
+ import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
6608
7663
  import { homedir as homedir4 } from "node:os";
6609
7664
  var flowMemo = /* @__PURE__ */ new Map();
6610
7665
  var SELFUSE_DEFAULT_FLOW = {
@@ -6624,7 +7679,7 @@ function cacheDirFor(baseUrl) {
6624
7679
  async function readLegacyCacheExtra(baseUrl) {
6625
7680
  try {
6626
7681
  const dir = cacheDirFor(baseUrl);
6627
- if (!existsSync2(dir)) return { defaultRecruitFlow: null, digitalHumanMenu: null };
7682
+ if (!existsSync3(dir)) return { defaultRecruitFlow: null, digitalHumanMenu: null };
6628
7683
  const files = await (await import("node:fs/promises")).readdir(dir);
6629
7684
  const jsonFiles = files.filter((f) => f.endsWith(".json"));
6630
7685
  let flow = null;
@@ -6632,7 +7687,7 @@ async function readLegacyCacheExtra(baseUrl) {
6632
7687
  for (const f of jsonFiles) {
6633
7688
  let raw;
6634
7689
  try {
6635
- raw = JSON.parse(await readFile2(join4(dir, f), "utf8"));
7690
+ raw = JSON.parse(await readFile3(join4(dir, f), "utf8"));
6636
7691
  } catch {
6637
7692
  continue;
6638
7693
  }
@@ -6662,7 +7717,7 @@ function flowMissPath(baseUrl) {
6662
7717
  async function readFlowMissAt(baseUrl) {
6663
7718
  if (process.env.E10_RS_NO_FLOW_CACHE === "1") return null;
6664
7719
  try {
6665
- const raw = JSON.parse(await readFile2(flowMissPath(baseUrl), "utf8"));
7720
+ const raw = JSON.parse(await readFile3(flowMissPath(baseUrl), "utf8"));
6666
7721
  if (raw?.baseUrl !== baseUrl || !raw?.missedAt) return null;
6667
7722
  if (Date.now() - raw.missedAt > FLOW_MISS_TTL_MS) return null;
6668
7723
  return raw.missedAt;
@@ -6674,10 +7729,10 @@ async function writeFlowMiss(baseUrl) {
6674
7729
  if (process.env.E10_RS_NO_FLOW_CACHE === "1") return;
6675
7730
  try {
6676
7731
  const dir = cacheDirFor(baseUrl);
6677
- if (!existsSync2(dir)) return;
7732
+ if (!existsSync3(dir)) return;
6678
7733
  const target = flowMissPath(baseUrl);
6679
- await mkdir2(dirname2(target), { recursive: true });
6680
- await writeFile2(target, JSON.stringify({ baseUrl, missedAt: Date.now() }), "utf8");
7734
+ await mkdir3(dirname3(target), { recursive: true });
7735
+ await writeFile3(target, JSON.stringify({ baseUrl, missedAt: Date.now() }), "utf8");
6681
7736
  } catch {
6682
7737
  }
6683
7738
  }
@@ -6689,7 +7744,7 @@ function findFlowMenu(cache) {
6689
7744
  }
6690
7745
  return null;
6691
7746
  }
6692
- function isDefaultFlowRow(x) {
7747
+ function isDefaultFlowRow2(x) {
6693
7748
  if (!x) return false;
6694
7749
  const cands = [x.is_default, x.isDefault, x.default_flow, x.defaultFlow, x.is_enable, x.enabled, x.status];
6695
7750
  for (const v of cands) {
@@ -6749,7 +7804,7 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
6749
7804
  headers: { ebBusinessId: menu.listId }
6750
7805
  });
6751
7806
  const rows = r?.data?.data || r?.data?.displayData || [];
6752
- const pick = rows.find(isDefaultFlowRow) || (rows.length === 1 ? rows[0] : null);
7807
+ const pick = rows.find(isDefaultFlowRow2) || (rows.length === 1 ? rows[0] : null);
6753
7808
  if (pick) {
6754
7809
  const id = String(pick.form_data_id || pick.id || "");
6755
7810
  const name = String(pick.name || pick.flow_name || pick.content || "");
@@ -6772,7 +7827,7 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
6772
7827
  });
6773
7828
  const rows = r?.data?.list || r?.data?.rows || r?.data || [];
6774
7829
  const list = Array.isArray(rows) ? rows : [];
6775
- const enabled = list.find(isDefaultFlowRow) || null;
7830
+ const enabled = list.find(isDefaultFlowRow2) || null;
6776
7831
  if (enabled?.id) {
6777
7832
  result = { id: String(enabled.id), name: String(enabled.name || enabled.flow_name || "") };
6778
7833
  serverResolved = true;
@@ -6788,7 +7843,8 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
6788
7843
  } catch {
6789
7844
  host2 = "";
6790
7845
  }
6791
- if (isSelfUse && host2 === SELFUSE_DEFAULT_FLOW.selfUseHost) {
7846
+ const bySelfTenant = isSelfTenant(cache?.tenantKey);
7847
+ if (bySelfTenant || isSelfUse && host2 === SELFUSE_DEFAULT_FLOW.selfUseHost) {
6792
7848
  result = { id: SELFUSE_DEFAULT_FLOW.id, name: SELFUSE_DEFAULT_FLOW.name };
6793
7849
  }
6794
7850
  }
@@ -6855,7 +7911,7 @@ async function inputFrom(options, extra = {}) {
6855
7911
  if (opts.input) {
6856
7912
  let raw;
6857
7913
  try {
6858
- raw = stripBom(opts.input === "-" ? await readStdin() : await readFile3(String(opts.input), "utf8"));
7914
+ raw = stripBom(opts.input === "-" ? await readStdin() : await readFile4(String(opts.input), "utf8"));
6859
7915
  } catch {
6860
7916
  throw rsValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
6861
7917
  }
@@ -6908,7 +7964,13 @@ async function executeAndPrint(ctx, operation, input) {
6908
7964
  });
6909
7965
  ctx.output.write(successEnvelope(operation, result), { json: true });
6910
7966
  } catch (error) {
6911
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
7967
+ const env = failureEnvelope(error);
7968
+ if (shouldReportPlatformError(error)) {
7969
+ const pe = toPlatformError(error);
7970
+ console.error(JSON.stringify({ ...env, code: pe.code, message: pe.message }, null, 2));
7971
+ } else {
7972
+ console.error(JSON.stringify(env, null, 2));
7973
+ }
6912
7974
  process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
6913
7975
  }
6914
7976
  }
@@ -6918,8 +7980,13 @@ var recruitStageShortcut = {
6918
7980
  category: "shortcut",
6919
7981
  register({ program, action }) {
6920
7982
  const rs = program.command("recruit-stage").description("\u6CDB\u5FAEE10\u62DB\u8058\u52A9\u624B\uFF08\u62DB\u8058\u542F\u4E8B\u751F\u6210/\u7B80\u5386\u89E3\u6790\u5EFA\u6863/AI\u9762\u8BD5\u9080\u7EA6\u4E0E\u53CD\u9988\uFF09");
6921
- rs.command("schema").description("Print recruit-stage operation manifest for agents").action(action((ctx) => {
6922
- ctx.output.write(recruitStageManifest, { json: true });
7983
+ rs.command("schema").description("Print recruit-stage operation manifest for agents").option("--list", '\u53EA\u5217\u64CD\u4F5C\u6E05\u5355\uFF08name/summary/risk\uFF09\uFF0C\u5168\u91CF\u4E0D\u622A\u65AD\uFF1B\u5224\u65AD"\u6709\u6CA1\u6709\u67D0\u64CD\u4F5C"\u7528\u8FD9\u4E2A').option("--full", "\u6253\u5370\u5B8C\u6574 manifest\uFF08\u8D85 stdout \u9884\u7B97\u4F1A\u843D\u672C\u5730 ref\uFF0C\u7528 refs get \u5206\u9875\u53D6\uFF09").option("--operation <name>", "\u53EA\u8F93\u51FA\u5355\u4E2A\u64CD\u4F5C\u7684\u5B8C\u6574\u5951\u7EA6\uFF08\u542B inputSchema\uFF0C\u4F53\u79EF\u8FDC\u4F4E\u4E8E\u9884\u7B97\uFF09").action(action((ctx, options) => {
7984
+ const schema = schemaOptionsOf(options);
7985
+ ctx.output.write(manifestView(recruitStageManifest, schema), {
7986
+ json: true,
7987
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
7988
+ ...schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}
7989
+ });
6923
7990
  }));
6924
7991
  rs.command("run").description("Run a recruit-stage operation with JSON input").argument("<operation>", "operation name, e.g. recruit-stage.jd.create.prepare").option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object").action(action(async (ctx, operation, options) => {
6925
7992
  await executeAndPrint(ctx, String(operation), await inputFrom(options));