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
@@ -0,0 +1,507 @@
1
+ /**
2
+ * recruit-write-helper.mjs — 招聘模块写操作 prepare→apply 链路辅助脚本
3
+ *
4
+ * 解决问题:
5
+ * ① PowerShell 传递超长 continuation token 会损坏 HMAC 签名(continuation_invalid)
6
+ * ② 中文 JSON 经 PowerShell 代码页改写后变空串(E-0003 不是合法 JSON)
7
+ * 方案:continuation 全程在 Node 进程内存传递,不接触 shell。
8
+ *
9
+ * 🔴 本脚本是**招聘技能私有**工具,不与其他技能共用;其他技能(jucailin/mail/cowork)
10
+ * 如需同类能力,各自在自己包内放一份副本,改 operation 前缀即可。
11
+ *
12
+ * 支持的写操作(自动补 .prepare / .apply 后缀):
13
+ * recruit-stage.jd.create / recruit-stage.resume.import / recruit-stage.resume.import.batch
14
+ * recruit-stage.interview.arrange / recruit-stage.interview.feedback.edit / recruit-stage.tag.attach
15
+ *
16
+ * 用法:
17
+ * prepare:node lib/recruit-write-helper.mjs prepare <operation> <params.json>
18
+ * apply :node lib/recruit-write-helper.mjs apply <operation>
19
+ *
20
+ * 状态文件按 operation 隔离(recruit-helper-state-<operation>.json),
21
+ * 因此可以交错跑多个不同 operation 的 prepare→apply,互不覆盖。
22
+ * 同一 operation 的两次 prepare 仍会互相覆盖(后一次生效),这是预期行为。
23
+ */
24
+
25
+ import { execFileSync } from 'node:child_process';
26
+ import { writeFileSync, readFileSync, existsSync, unlinkSync, mkdirSync, rmSync, renameSync, readdirSync } from 'node:fs';
27
+ import { join, dirname, resolve as resolvePath } from 'node:path';
28
+ import { fileURLToPath } from 'node:url';
29
+ import { homedir } from 'node:os';
30
+
31
+ const IS_WIN = process.platform === 'win32';
32
+ const CLI_REL = join('weaver-work-cli', 'dist', 'index.js');
33
+
34
+ // ── CLI 入口定位(跨平台,不写死任何机器专属路径)─────────────────────────────
35
+ // 🔴 原实现写死 'C:\\Users\\LW\\...\\weaver-work-cli.cmd',换机器/换用户/网页版(Linux) 全部失效。
36
+ // 🔴 第二版只补了 POSIX 标准全局根,仍漏掉 nvm / nvm-windows / PATH 里的 shim,
37
+ // 网页版沙箱(实测 Node v22.19.0,HOME=/home/sandbox)大概率装在 nvm 下 → 探测不到。
38
+ // 现按优先级探测,并且**直接用当前 node 执行 CLI 的 dist/index.js**,
39
+ // 绕开 Windows 下 spawn .cmd 需要 shell:true 的限制(Node 20+ 因 CVE-2024-27980 会报 EINVAL)。
40
+ function firstExisting(paths) {
41
+ for (const p of paths) {
42
+ if (!p) continue;
43
+ try { if (existsSync(p)) return p; } catch { /* 忽略不可读路径 */ }
44
+ }
45
+ return '';
46
+ }
47
+
48
+ /** ① 从 PATH 里的 npm shim 反推全局包位置(最通用:能跑 CLI 就说明 PATH 里有它)。 */
49
+ function fromPathShim() {
50
+ const pathEnv = process.env.PATH || process.env.Path || '';
51
+ const names = IS_WIN ? ['weaver-work-cli.cmd', 'weaver-work-cli.ps1', 'weaver-work-cli'] : ['weaver-work-cli'];
52
+ for (const dir of pathEnv.split(IS_WIN ? ';' : ':')) {
53
+ if (!dir) continue;
54
+ let hit = false;
55
+ for (const n of names) {
56
+ try { if (existsSync(join(dir, n))) { hit = true; break; } } catch { /* 忽略 */ }
57
+ }
58
+ if (!hit) continue;
59
+ // Windows: <prefix>\weaver-work-cli.cmd + <prefix>\node_modules\weaver-work-cli
60
+ // POSIX: <prefix>/bin/weaver-work-cli + <prefix>/lib/node_modules/weaver-work-cli
61
+ const found = firstExisting([
62
+ join(dir, 'node_modules', CLI_REL),
63
+ join(dir, '..', 'lib', 'node_modules', CLI_REL),
64
+ join(dir, '..', 'node_modules', CLI_REL),
65
+ join(dir, '..', '..', 'lib', 'node_modules', CLI_REL),
66
+ ]);
67
+ if (found) return found;
68
+ }
69
+ return '';
70
+ }
71
+
72
+ /** ② nvm / nvm-windows / Volta / fnm 等版本管理器的全局包位置。 */
73
+ function fromVersionManagers() {
74
+ const home = homedir();
75
+ const roots = [];
76
+ // nvm (POSIX):~/.nvm/versions/node/<ver>/lib/node_modules
77
+ const nvmDir = process.env.NVM_DIR || join(home, '.nvm');
78
+ roots.push(join(nvmDir, 'versions', 'node'));
79
+ // nvm-windows:%APPDATA%\nvm\<ver>\node_modules 与 NVM_SYMLINK
80
+ if (process.env.APPDATA) roots.push(join(process.env.APPDATA, 'nvm'));
81
+ if (process.env.NVM_SYMLINK) roots.push(process.env.NVM_SYMLINK);
82
+ // Volta:~/.volta/tools/image/packages/weaver-work-cli/lib/node_modules
83
+ roots.push(join(home, '.volta', 'tools', 'image', 'packages'));
84
+ // fnm:~/.local/share/fnm/node-versions
85
+ roots.push(join(home, '.local', 'share', 'fnm', 'node-versions'));
86
+
87
+ const out = [];
88
+ for (const root of roots) {
89
+ if (!root) continue;
90
+ let entries = [];
91
+ try { entries = readdirSync(root); } catch { continue; }
92
+ for (const e of entries) {
93
+ const base = join(root, e);
94
+ out.push(
95
+ join(base, 'lib', 'node_modules', CLI_REL), // nvm / fnm
96
+ join(base, 'node_modules', CLI_REL), // nvm-windows
97
+ join(base, 'installation', 'lib', 'node_modules', CLI_REL), // fnm installation 层
98
+ );
99
+ }
100
+ // Volta 结构不同:packages/weaver-work-cli/lib/node_modules/weaver-work-cli
101
+ out.push(join(root, 'weaver-work-cli', 'lib', 'node_modules', CLI_REL));
102
+ }
103
+ // 当前 node 自身的 lib/node_modules(沙箱把全局包与运行时装在一起时命中)
104
+ const execDir = dirname(process.execPath);
105
+ out.push(join(execDir, 'lib', 'node_modules', CLI_REL), join(execDir, 'node_modules', CLI_REL));
106
+ return firstExisting(out);
107
+ }
108
+
109
+ const CLI_ENTRY_CANDIDATES = [
110
+ // ⓪ 显式指定(最高优先级,便于测试与非常规部署)
111
+ () => process.env.WEAVER_WORK_CLI_ENTRY || '',
112
+ // ① PATH shim 反推
113
+ fromPathShim,
114
+ // ② 小E 客户端内置 node 旁的全局包(Windows 桌面端实测位置)
115
+ () => {
116
+ const localAppData = process.env.LOCALAPPDATA || '';
117
+ return localAppData ? join(localAppData, 'xiaoeUserData', 'node_js_exe', 'node_modules', CLI_REL) : '';
118
+ },
119
+ // ③ 版本管理器(nvm / nvm-windows / Volta / fnm)+ 当前 node 自身目录
120
+ fromVersionManagers,
121
+ // ④ npm 全局根常见固定位置
122
+ () => {
123
+ const prefix = process.env.npm_config_prefix || process.env.PREFIX || '';
124
+ const roots = prefix ? [join(prefix, 'lib', 'node_modules'), join(prefix, 'node_modules')] : [];
125
+ if (process.env.APPDATA) roots.push(join(process.env.APPDATA, 'npm', 'node_modules'));
126
+ roots.push(
127
+ '/usr/local/lib/node_modules', '/usr/lib/node_modules', '/opt/homebrew/lib/node_modules',
128
+ join(homedir(), '.npm-global', 'lib', 'node_modules'),
129
+ );
130
+ return firstExisting(roots.map((r) => join(r, CLI_REL)));
131
+ },
132
+ // ⑤ 从本脚本位置向上找 node_modules(技能被装进某个 node 工程时)
133
+ () => {
134
+ let dir = dirname(fileURLToPath(import.meta.url));
135
+ for (let i = 0; i < 8 && dir && dir !== dirname(dir); i++) {
136
+ const p = join(dir, 'node_modules', CLI_REL);
137
+ if (existsSync(p)) return p;
138
+ dir = dirname(dir);
139
+ }
140
+ return '';
141
+ },
142
+ ];
143
+
144
+ function resolveCliEntry() {
145
+ for (const cand of CLI_ENTRY_CANDIDATES) {
146
+ let p = '';
147
+ try { p = cand(); } catch { continue; }
148
+ if (p && existsSync(p)) return resolvePath(p);
149
+ }
150
+ return null;
151
+ }
152
+
153
+ const CLI_ENTRY = resolveCliEntry();
154
+
155
+ // ── 状态目录与文件(按 operation 隔离,避免并发/交错覆盖)──────────────────────
156
+ function stateDir() {
157
+ const base = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || join(homedir(), '.weaver-work-cli');
158
+ return join(base, 'recruit-helper');
159
+ }
160
+
161
+ function stateFileFor(operation) {
162
+ // operation 形如 recruit-stage.jd.create → 文件名安全化
163
+ const safe = String(operation).replace(/[^A-Za-z0-9._-]/g, '_');
164
+ return join(stateDir(), `state-${safe}.json`);
165
+ }
166
+
167
+ function ensureDir(dir) {
168
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
169
+ }
170
+
171
+ // ── 调 CLI(结构化错误透传,不吞不抛堆栈)────────────────────────────────────
172
+ /**
173
+ * 结果引用(ref)落盘目录:与 CLI 的 state.ts 同一套解析顺序。
174
+ * refsDir = <stateRoot>/state/refs/<YYYY-MM-DD>/<refId>.json
175
+ */
176
+ function refsRootDir() {
177
+ const base = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || join(homedir(), '.weaver-work-cli');
178
+ return join(base, 'state', 'refs');
179
+ }
180
+
181
+ /**
182
+ * 🔴 2026-11-28 性能修复:直接从 ref 落盘文件取全量结果。
183
+ *
184
+ * 原实现走 `refs get <refId> data`,而这条路径**必然失败**——data 里 22KB 的 continuation
185
+ * 本身就超 stdout 预算;失败后再按 17 个字段逐个 `refs get`,每个字段都要新起一个 Node
186
+ * 子进程(实测 ≈350ms),单次 prepare 平白多花 5.5 秒(helper 7.44s vs 原生 1.94s)。
187
+ *
188
+ * 技能文档 §7 本就写明可以用「refs path + 直接读 <refId>.json」取全量,这里按此实现:
189
+ * 一次目录扫描 + 一次 readFileSync,零子进程。
190
+ */
191
+ function readRefEnvelopeFromDisk(refId) {
192
+ // 诊断开关:置 1 可强制走旧的多子进程回取路径,用于 A/B 对比耗时(默认关闭)。
193
+ if (process.env.RECRUIT_HELPER_NO_DISK_REF === '1') return null;
194
+ if (!/^[A-Za-z0-9._-]+$/.test(refId)) return null; // 防路径穿越,refId 只含安全字符
195
+ const root = refsRootDir();
196
+ let entries = [];
197
+ try { entries = readdirSync(root, { withFileTypes: true }); } catch { return null; }
198
+ // 日期目录数量等于历史天数,量级很小;从新到旧扫,命中即返回
199
+ const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name).sort().reverse();
200
+ for (const dir of dirs) {
201
+ const file = join(root, dir, `${refId}.json`);
202
+ try {
203
+ if (!existsSync(file)) continue;
204
+ const doc = JSON.parse(readFileSync(file, 'utf8'));
205
+ if (doc && doc.refId === refId && doc.envelope && typeof doc.envelope === 'object') return doc.envelope;
206
+ } catch { /* 坏文件或 0 字节残骸,跳过 */ }
207
+ }
208
+ return null;
209
+ }
210
+
211
+ function runCli(operation, input) {
212
+ if (!CLI_ENTRY) {
213
+ return {
214
+ ok: false,
215
+ error: {
216
+ type: 'environment',
217
+ subtype: 'cli_entry_not_found',
218
+ message: '未找到 weaver-work-cli 的 dist/index.js。请确认 CLI 已安装,或用环境变量 WEAVER_WORK_CLI_ENTRY 显式指定入口路径。',
219
+ },
220
+ };
221
+ }
222
+ const dir = stateDir();
223
+ ensureDir(dir);
224
+ const tmpInput = join(dir, `input-${process.pid}-${Date.now()}.json`);
225
+ writeFileSync(tmpInput, JSON.stringify(input), 'utf8');
226
+ // 多环境测试:RECRUIT_CLI_PROFILE=10-12-105-188 时透传 --profile(默认走 CLI 默认 profile)
227
+ const cliProfile = String(process.env.RECRUIT_CLI_PROFILE || '').trim();
228
+ const args = [CLI_ENTRY, '--json'];
229
+ if (cliProfile) args.push('--profile', cliProfile);
230
+ args.push('recruit-stage', 'run', operation, '--input', tmpInput, '--allow-file-input');
231
+ try {
232
+ // 用当前 node 直接跑 CLI 的 JS 入口:跨平台一致,不需要 shell,不受 .cmd 限制
233
+ const stdout = execFileSync(process.execPath, args, {
234
+ encoding: 'utf8',
235
+ timeout: 600000,
236
+ maxBuffer: 32 * 1024 * 1024,
237
+ windowsHide: true,
238
+ });
239
+ const parsed = JSON.parse(stdout);
240
+ // 🔴 2026-11-28 修「大输出被截断导致 continuation 丢失」:
241
+ // CLI stdout 有 28000 字符预算,超出时把 data/meta 换成占位字符串
242
+ // ("<omitted: N keys, use --input-ref>")+ refId。签入 built 后 prepare 输出会到 5 万字符,
243
+ // 直接 JSON.parse 拿到的 continuation 是空的 → helper 误报 continuation_missing。
244
+ // 这里按 CLI 的 refs 契约把全量取回来。
245
+ if (parsed && parsed.refId && parsed.resultPersisted) {
246
+ const refId = String(parsed.refId);
247
+ // 🔴 2026-11-28 性能修复(主路径):直接读落盘文件,零子进程。
248
+ const fromDisk = readRefEnvelopeFromDisk(refId);
249
+ if (fromDisk) {
250
+ return {
251
+ ...parsed,
252
+ data: fromDisk.data ?? {},
253
+ meta: fromDisk.meta ?? {},
254
+ largeOutputRefId: refId,
255
+ refSource: 'disk',
256
+ };
257
+ }
258
+ // 兜底:磁盘不可读(自定义 state 根、权限受限等)时才走子进程回取
259
+ const getPath = (p) => execFileSync(
260
+ process.execPath,
261
+ [CLI_ENTRY, '--json', 'refs', 'get', refId, p],
262
+ { encoding: 'utf8', timeout: 120000, maxBuffer: 64 * 1024 * 1024, windowsHide: true },
263
+ );
264
+ // 先试整体 data;仍超预算时(continuation 22KB + summary 一起超 28000)
265
+ // 按字段逐个取,只取 Agent 展示确认摘要与 apply 必需的字段,控制子进程次数。
266
+ let fullData = null;
267
+ try {
268
+ fullData = JSON.parse(getPath('data'));
269
+ } catch {
270
+ fullData = {};
271
+ const FIELDS = [
272
+ 'continuation', 'mode', 'action', 'resumeFile', 'resumeFileId', 'parsed',
273
+ 'channel', 'subTables', 'subTableRows', 'duplicate', 'tagCheck', 'schoolTags',
274
+ 'setApplied', 'setSkipped', 'workLocationDefault', 'warnings', 'note',
275
+ ];
276
+ for (const f of FIELDS) {
277
+ try { fullData[f] = JSON.parse(getPath('data.' + f)); } catch { /* 字段不存在则跳过 */ }
278
+ }
279
+ }
280
+ let fullMeta = {};
281
+ try { fullMeta = JSON.parse(getPath('meta')); } catch { fullMeta = {}; }
282
+ return { ...parsed, data: fullData, meta: fullMeta, largeOutputRefId: refId };
283
+ }
284
+ return parsed;
285
+ } catch (e) {
286
+ // 🔴 CLI 业务报错时 exit code 非 0,结构化 JSON 在 stderr(部分在 stdout)。
287
+ // 原实现不 catch → 用户看到 Node 堆栈而不是「缺参数/无权限」这类可读原因。
288
+ const raw = String(e?.stdout || '') + String(e?.stderr || '');
289
+ const jsonStart = raw.indexOf('{');
290
+ if (jsonStart >= 0) {
291
+ try {
292
+ const parsed = JSON.parse(raw.slice(jsonStart));
293
+ if (parsed && (parsed.ok === false || parsed.error)) return parsed;
294
+ } catch { /* 非完整 JSON,落到下面的通用错误 */ }
295
+ }
296
+ return {
297
+ ok: false,
298
+ error: {
299
+ type: 'execution',
300
+ subtype: e?.code === 'ETIMEDOUT' ? 'timeout' : 'cli_failed',
301
+ message: e?.code === 'ETIMEDOUT'
302
+ ? 'CLI 执行超时(10 分钟),本次未确认写入结果,请先只读回查再决定是否重试'
303
+ : (raw.trim().slice(0, 600) || `CLI 执行失败:${e?.message || e}`),
304
+ },
305
+ };
306
+ } finally {
307
+ try { if (existsSync(tmpInput)) unlinkSync(tmpInput); } catch { /* 忽略清理失败 */ }
308
+ }
309
+ }
310
+
311
+ function emit(obj, exitCode) {
312
+ process.stdout.write(JSON.stringify(obj, null, 2));
313
+ if (exitCode) process.exit(exitCode);
314
+ }
315
+
316
+ // ── prepare ────────────────────────────────────────────────────────────────
317
+ function doPrepare(operation, paramsPath, inlineParams) {
318
+ let params;
319
+ if (inlineParams) {
320
+ params = inlineParams;
321
+ } else {
322
+ try {
323
+ // 🔴 剥掉 UTF-8 BOM:PowerShell 的 `Set-Content -Encoding utf8` 会写入 BOM,
324
+ // 原实现直接把带 BOM 的内容丢给 JSON.parse,报 Unexpected token ''(已实测复现)。
325
+ const raw = readFileSync(resolvePath(paramsPath), 'utf8').replace(/^\uFEFF/, '');
326
+ params = JSON.parse(raw);
327
+ } catch (e) {
328
+ return emit({ ok: false, error: { type: 'validation', subtype: 'params_unreadable', message: `参数文件读取或解析失败:${e?.message || e}` } }, 1);
329
+ }
330
+ }
331
+
332
+ const result = runCli(operation + '.prepare', params);
333
+ if (!result?.ok) {
334
+ // prepare 失败:不留状态文件,避免 apply 用到半截状态
335
+ emit(result, 1);
336
+ return;
337
+ }
338
+
339
+ const continuation = result?.meta?.continuation || result?.data?.continuation;
340
+ if (!continuation) {
341
+ emit({ ok: false, error: { type: 'validation', subtype: 'continuation_missing', message: 'prepare 成功但未返回 continuation,无法进入 apply;请把该 operation 的返回反馈给维护者' } }, 1);
342
+ return;
343
+ }
344
+
345
+ const dir = stateDir();
346
+ ensureDir(dir);
347
+ const state = {
348
+ operation,
349
+ params,
350
+ continuation,
351
+ fingerprint: result?.meta?.fingerprint || null,
352
+ savedAt: new Date().toISOString(),
353
+ };
354
+ // 原子写:先写临时文件再 rename,避免并发实例写出半截 JSON
355
+ const target = stateFileFor(operation);
356
+ const tmp = target + '.tmp';
357
+ writeFileSync(tmp, JSON.stringify(state), 'utf8');
358
+ try {
359
+ renameSync(tmp, target); // 同盘 rename 是原子的
360
+ } catch {
361
+ // rename 失败(跨盘/权限)时退回直接覆盖写,保证功能可用
362
+ writeFileSync(target, JSON.stringify(state), 'utf8');
363
+ try { rmSync(tmp, { force: true }); } catch { /* 忽略 */ }
364
+ }
365
+
366
+ // 🔴 2026-11-28:输出给 Agent 的 data 剔除 continuation(22KB+,已在 state 文件里),
367
+ // 否则 helper 自己的 stdout 也会超出平台预算被截断,Agent 看不到摘要。
368
+ const { continuation: _omitCont, ...dataForAgent } = (result.data || {});
369
+ emit({
370
+ ok: true,
371
+ phase: 'prepare',
372
+ operation,
373
+ stateSaved: true,
374
+ stateFile: target,
375
+ continuationChars: String(continuation).length,
376
+ data: dataForAgent,
377
+ });
378
+ }
379
+
380
+ // ── apply ──────────────────────────────────────────────────────────────────
381
+ function doApply(operation) {
382
+ const target = stateFileFor(operation);
383
+ if (!existsSync(target)) {
384
+ return emit({
385
+ ok: false,
386
+ error: {
387
+ type: 'validation',
388
+ subtype: 'state_not_found',
389
+ message: `未找到 ${operation} 的 prepare 状态文件,请先执行:node lib/recruit-write-helper.mjs prepare ${operation} <params.json>`,
390
+ },
391
+ }, 1);
392
+ }
393
+
394
+ let state;
395
+ try {
396
+ state = JSON.parse(readFileSync(target, 'utf8'));
397
+ } catch (e) {
398
+ return emit({ ok: false, error: { type: 'validation', subtype: 'state_corrupted', message: `状态文件损坏,请重新 prepare:${e?.message || e}` } }, 1);
399
+ }
400
+ if (state.operation !== operation) {
401
+ return emit({ ok: false, error: { type: 'validation', subtype: 'state_operation_mismatch', message: `状态文件属于 ${state.operation},不能用于 ${operation}` } }, 1);
402
+ }
403
+
404
+ const applyInput = { ...state.params, confirm: true, continuation: state.continuation };
405
+ const result = runCli(operation + '.apply', applyInput);
406
+
407
+ // 🔴 只在成功时删状态文件;失败保留以便排查或重试(continuation 有 TTL,过期需重新 prepare)。
408
+ // 原实现无条件删除 → 网络抖动一次就得从头 prepare(简历场景要重新上传+OCR)。
409
+ const succeeded = result?.ok === true;
410
+ if (succeeded) {
411
+ try { rmSync(target, { force: true }); } catch { /* 忽略 */ }
412
+ }
413
+
414
+ emit({
415
+ ...result,
416
+ helperStateCleared: succeeded,
417
+ ...(succeeded ? {} : { helperHint: '状态文件已保留,可修正参数后重试 apply;若 continuation 已过期需重新 prepare' }),
418
+ }, succeeded ? 0 : 1);
419
+ }
420
+
421
+ // ── 入口 ───────────────────────────────────────────────────────────────────
422
+ const USAGE = {
423
+ ok: false,
424
+ error: {
425
+ type: 'validation',
426
+ subtype: 'usage',
427
+ message: [
428
+ '用法:',
429
+ ' prepare: node lib/recruit-write-helper.mjs prepare <operation> <params.json>',
430
+ ' apply : node lib/recruit-write-helper.mjs apply <operation>',
431
+ '',
432
+ '示例:',
433
+ ' node lib/recruit-write-helper.mjs prepare recruit-stage.jd.create params.json',
434
+ ' node lib/recruit-write-helper.mjs apply recruit-stage.jd.create',
435
+ ].join('\n'),
436
+ },
437
+ };
438
+
439
+ // operation 白名单校验:只允许招聘模块的已知写操作前缀,防止拼错或注入
440
+ const ALLOWED_OPERATION_RE = /^recruit-stage\.[a-z0-9.]+$/;
441
+
442
+ /**
443
+ * 🔴 2026-11-28:prepare 支持直传入参,不必先落一个参数文件。
444
+ *
445
+ * 动机:参数文件把一次「模型往返 + 一次写盘」塞进了每次写操作,且 PowerShell 的
446
+ * UTF-8 写入会带 BOM(已实测把 helper 打到 params_unreadable)。直传走 Node argv,
447
+ * 本身是 UTF-16,中文路径不会损坏。
448
+ *
449
+ * ... <params.json> 仍支持(兼容既有调用)
450
+ * ... --fileid <id> 复用已上传的简历附件(跳过上传与 OCR)
451
+ * ... --resume <本地路径> 简历原件
452
+ * ... --set key=value 任意键值,可重复;true/false 自动转布尔
453
+ * ... --json '<内联 JSON>' 短参数,键值合并
454
+ */
455
+ function buildParamsFromArgv(argv) {
456
+ const params = {};
457
+ let filePath = '';
458
+ for (let i = 0; i < argv.length; i++) {
459
+ const a = argv[i];
460
+ if (a === '--fileid') params.fileId = argv[++i];
461
+ else if (a === '--resume') params.resumeFile = argv[++i];
462
+ else if (a === '--json') {
463
+ const doc = JSON.parse(argv[++i] || '{}');
464
+ if (doc && typeof doc === 'object') Object.assign(params, doc);
465
+ } else if (a === '--set') {
466
+ const kv = String(argv[++i] || '');
467
+ const eq = kv.indexOf('=');
468
+ if (eq <= 0) throw new Error(`--set 需要 key=value 形式,收到:${kv}`);
469
+ const value = kv.slice(eq + 1);
470
+ params[kv.slice(0, eq)] = value === 'true' ? true : value === 'false' ? false : value;
471
+ } else if (!a.startsWith('--') && !filePath) {
472
+ filePath = a;
473
+ }
474
+ }
475
+ return { filePath, params };
476
+ }
477
+
478
+ const mode = process.argv[2];
479
+ const operation = process.argv[3];
480
+
481
+ if (mode === 'prepare') {
482
+ if (!operation) emit(USAGE, 1);
483
+ else if (!ALLOWED_OPERATION_RE.test(operation)) {
484
+ emit({ ok: false, error: { type: 'validation', subtype: 'operation_invalid', message: `operation 必须是 recruit-stage.* 形式,收到:${operation}` } }, 1);
485
+ } else {
486
+ let parsedArgs;
487
+ try {
488
+ parsedArgs = buildParamsFromArgv(process.argv.slice(4));
489
+ } catch (e) {
490
+ emit({ ok: false, error: { type: 'validation', subtype: 'usage', message: `入参解析失败:${e?.message || e}` } }, 1);
491
+ parsedArgs = null;
492
+ }
493
+ if (parsedArgs) {
494
+ const { filePath, params } = parsedArgs;
495
+ if (filePath) doPrepare(operation, filePath);
496
+ else if (Object.keys(params).length) doPrepare(operation, '', params);
497
+ else emit(USAGE, 1);
498
+ }
499
+ }
500
+ } else if (mode === 'apply') {
501
+ if (!operation) emit(USAGE, 1);
502
+ else if (!ALLOWED_OPERATION_RE.test(operation)) {
503
+ emit({ ok: false, error: { type: 'validation', subtype: 'operation_invalid', message: `operation 必须是 recruit-stage.* 形式,收到:${operation}` } }, 1);
504
+ } else doApply(operation);
505
+ } else {
506
+ emit(USAGE, 1);
507
+ }
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: env-fixed-values
3
+ description: 自用环境结构元数据参考值(快路径)——objId/formId/listId/fieldId 等固定值,首次使用校验一次,命中即跳过运行时解析
4
+ ---
5
+
6
+ # 自用环境结构元数据参考值
7
+
8
+ > **背景**:招聘助手只在自用小E(www.e-cology.com.cn)使用,表单结构固定不变。
9
+ > 这些值作为**快路径**:命中即跳过运行时解析,不一致时回退动态解析。
10
+ > 遵守 [`env-ziyong.md`](env-ziyong.md) §3 分层:结构元数据可预置,optionId/人员 id 绝不写死。
11
+ >
12
+ > ⚠️ **校验方式**:首次使用时用 `listInit(listId)` 的 `objid` 比对;不一致就回退动态解析。
13
+ > 环境升级后这些值可能变化,需要重新验证。
14
+
15
+ ## 1. 职位管理(jd.create 用)
16
+
17
+ | 项 | dataKey | 参考值 |
18
+ |---|---|---|
19
+ | objId | — | 840738302251515904 |
20
+ | formId | — | 840738302251515906 |
21
+ | position_name | position_name | 840762714812071936 |
22
+ | position_duty | position_duty | 840770011802124289 |
23
+ | work_request | work_request | 840770011802124291 |
24
+ | position_nature | position_nature | 840765837051969540 |
25
+ | recruit_count | recruit_count | 840765837051969541 |
26
+ | education | education | 840768568709890049 |
27
+ | work_years | work_years | 840767271797538818 |
28
+ | salary_min | salary_min | 840762714812071940 |
29
+ | salary_max | salary_max | 840765837051969537 |
30
+ | status | status | 840773800139440131 |
31
+ | recruit_flow | recruit_flow | 840772541495918598 |
32
+ | recr_principal | recr_principal | 840772541495918599 |
33
+ | employ_manager | employ_manager | 840770011802124292 |
34
+ | number_of_pay_months | number_of_pay_months | 840773800139440130 |
35
+ | salary_type | salary_type | 840770862205648897 |
36
+ | recruit_type | recruit_type | 840767271797538820 |
37
+ | work_location | work_location | 840768568709890051 |
38
+
39
+ **职位列表**:listId 见环境缓存 `lists.position.listId`
40
+
41
+ **默认招聘流程**(selfUse 兜底常量,已写在 context.ts):
42
+ - id: 874896524979806209
43
+ - name: 初筛+面试+offer阶段
44
+
45
+ ## 2. 人才库(resume.import / candidate.search / candidate.profile 用)
46
+
47
+ | 项 | dataKey | 参考值 |
48
+ |---|---|---|
49
+ | objId | — | 840741476223959040 |
50
+ | formId | — | 840741480284045314 |
51
+ | candidate_name | candidate_name | (见环境缓存 fields[objId]) |
52
+ | telephone | telephone | (见环境缓存 fields[objId]) |
53
+ | original_resume | original_resume | (见环境缓存 fields[objId]) |
54
+
55
+ **人才库列表**:listId 见环境缓存 `lists.talent.listId`
56
+
57
+ ## 3. 面试管理(interview.arrange / list type=interview 用)
58
+
59
+ | 项 | dataKey | 参考值 |
60
+ |---|---|---|
61
+ | objId | — | 840751242946035712 |
62
+ | formId | — | 840751242946035714 |
63
+ | 面试管理列表 listId | — | 840751268732616721 |
64
+ **面试类型枚举**(optionId 跨环境不同,此处仅记录自用环境实测值,运行时仍走 ds/options 解析):
65
+
66
+ - 841052191228968962 = 视频面试
67
+ - 841052191228968963 = 现场面试
68
+ - 841052191228968964 = AI面试
69
+
70
+ **面试状态枚举**:
71
+ - 841052191228968972 = 未开始
72
+ - 841052191228968973 = 待查看
73
+ - 841052191228968974 = 待反馈
74
+ - 841052191228968975 = 已反馈
75
+
76
+ ## 4. 固定页面路由(recruit-output-links.md §2 已有,此处不重复)
77
+
78
+ ## 5. 使用方式
79
+
80
+ Agent 不需要直接读这个文件。CLI 的环境缓存(`~/.weaver-work-cli/env-cache/recruit-ops/<host>/<appId>.json`)
81
+ 已包含这些值,命中时跳过运行时解析。这个文件的作用是:
82
+ 1. 人工核对环境缓存是否正确
83
+ 2. 环境缓存丢失时作为参考值快速重建
84
+ 3. 记录自用环境的已知结构,便于排查问题
85
+
86
+ > 🔴 **绝不写死的值**:optionId(DS选项/字典)、人员 id、标签 id、AI面试方案 id、办公地点记录 id。
87
+ > 这些值后端会变,写死后无效 optionId 会被静默丢弃仍返回 success。