weaver-work-cli 0.1.44 → 0.1.46

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 (241) hide show
  1. package/README.md +9 -5
  2. package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
  3. package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
  4. package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
  5. package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
  6. package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-MCXQBD6N.js} +3 -3
  7. package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
  8. package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
  9. package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
  10. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  11. package/dist/chunks/{chunk-FAZTGX7S.js → chunk-4RWS2YYL.js} +5 -5
  12. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-6AXKWFKG.js} +32 -12
  13. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  14. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-6V5ZPKHV.js} +56 -12
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-76H3IKH6.js} +178 -37
  17. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-AD46OMQK.js} +239 -41
  18. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  19. package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
  20. package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
  21. package/dist/chunks/{chunk-CWYGFU5B.js → chunk-GSZTA43P.js} +2 -2
  22. package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  23. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-IP4CWQCF.js} +11 -11
  24. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-IRMIEDXN.js} +1 -1
  25. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  26. package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-JFAWZX53.js} +134 -13
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-OXHHJWNC.js} +1 -1
  29. package/dist/chunks/chunk-P5GQRWDC.js +60 -0
  30. package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
  31. package/dist/chunks/{chunk-OF4S23UB.js → chunk-PSOMGA3U.js} +4 -4
  32. package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
  33. package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
  34. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-UFIFZ4YC.js} +48 -14
  35. package/dist/chunks/chunk-VRPH24IC.js +76 -0
  36. package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
  37. package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
  38. package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-H7EHQXYY.js} +2 -2
  39. package/dist/chunks/continuation-GW6PRWK3.js +12 -0
  40. package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
  41. package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
  42. package/dist/chunks/{create-flow-J22BO65E.js → create-flow-VRVJEOBX.js} +6 -6
  43. package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
  44. package/dist/chunks/{ehr-GSTGAIY3.js → ehr-SH2LM3NK.js} +648 -88
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-66FPSJDV.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-UH2TZBVA.js} +1 -1
  49. package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
  50. package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-CAKMMV7K.js} +3 -3
  51. package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
  52. package/dist/chunks/host-7NTIBSPK.js +25 -0
  53. package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
  54. package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
  55. package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
  56. package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
  57. package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
  58. package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
  59. package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
  60. package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
  61. package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-DD6ULZ3I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-VTBFW4HI.js} +12 -12
  64. package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
  65. package/dist/chunks/operations-J7PUIVWZ.js +15 -0
  66. package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
  67. package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
  68. package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
  69. package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-CAKZTUA7.js} +1343 -178
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-IM5G23LS.js → registry-JVQBLFQ5.js} +10 -10
  72. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  73. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-5U55FMXZ.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-IDETODCA.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/cmd/action.js +14 -10
  78. package/dist/index.js +30 -30
  79. package/dist/internal/e10/auth/commands.js +32 -0
  80. package/dist/internal/e10/auth/error-log.js +156 -26
  81. package/dist/internal/e10/auth/xiaoe.js +176 -13
  82. package/dist/internal/e10/context.js +12 -1
  83. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  84. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  85. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  86. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  87. package/dist/shortcuts/archive/operations/shared.js +52 -0
  88. package/dist/shortcuts/contract/host.js +111 -4
  89. package/dist/shortcuts/contract/index.js +19 -0
  90. package/dist/shortcuts/contract/manifest.js +125 -0
  91. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  92. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  93. package/dist/shortcuts/contract/operations/customer.js +192 -0
  94. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  95. package/dist/shortcuts/contract/operations/flow.js +44 -2
  96. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  97. package/dist/shortcuts/contract/operations/registry.js +8 -0
  98. package/dist/shortcuts/contract/operations/review.js +116 -1
  99. package/dist/shortcuts/contract/operations/summary.js +177 -0
  100. package/dist/shortcuts/contract/operations/upload.js +64 -4
  101. package/dist/shortcuts/contract/upload-cache.js +104 -0
  102. package/dist/shortcuts/ehr/host.js +2 -2
  103. package/dist/shortcuts/ehr/index.js +14 -3
  104. package/dist/shortcuts/ehr/manifest.js +5 -1
  105. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +44 -12
  106. package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
  107. package/dist/shortcuts/ehr/operations/recruit-position.js +146 -43
  108. package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
  109. package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
  110. package/dist/shortcuts/ehr/operations/recruit-write.js +154 -36
  111. package/dist/shortcuts/ehr/operations/recruit.js +196 -12
  112. package/dist/shortcuts/ehr/operations/registry.js +4 -0
  113. package/dist/shortcuts/ehr/operations.js +24 -0
  114. package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
  115. package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
  116. package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
  117. package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
  118. package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
  119. package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
  120. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
  121. package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
  122. package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
  123. package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
  124. package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
  125. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
  126. package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
  127. package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
  128. package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
  129. package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
  130. package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
  131. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  132. package/dist/shortcuts/meeting/operations/eb/create-flow.js +274 -75
  133. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  134. package/dist/shortcuts/meeting/operations/eb/factory.js +63 -11
  135. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  136. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +38 -7
  137. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  138. package/dist/shortcuts/meeting/operations/invitation.js +27 -4
  139. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  140. package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
  141. package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
  142. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +356 -29
  143. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +36 -10
  144. package/dist/shortcuts/recruit-stage/operations/jd-create.js +309 -67
  145. package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
  146. package/dist/shortcuts/recruit-stage/operations/resume-import.js +310 -17
  147. package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
  148. package/dist/shortcuts/recruit-stage/shared.js +221 -24
  149. package/dist/shortcuts/workflow/index.js +2 -0
  150. package/dist/shortcuts/workflow/operations/read.js +8 -3
  151. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  152. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  153. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  154. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  155. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  156. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  157. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  158. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  159. package/docs/contract.md +1 -0
  160. package/docs/e10-auth.md +4 -2
  161. package/docs/todo-smart-convert/data-contract.md +7 -0
  162. package/package.json +1 -1
  163. package/skill-template/domains/jinchengda.md +2 -0
  164. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  165. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  166. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  167. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  168. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  169. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  170. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  171. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  172. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  173. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  174. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  175. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  176. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  177. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  178. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  179. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  180. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  181. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  182. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  183. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  184. package/skills/weaver-e10-jucailin/SKILL.md +12 -3
  185. package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
  186. package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
  187. package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
  188. package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
  189. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
  190. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
  191. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
  192. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
  193. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
  194. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
  195. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
  196. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
  197. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
  198. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
  199. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
  200. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
  201. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
  202. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
  203. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
  204. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
  205. package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
  206. package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
  207. package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
  208. package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -91
  209. package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
  210. package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
  211. package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
  212. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
  213. package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
  214. package/skills/weaver-e10-jucailin/references/recruit-write.md +55 -11
  215. package/skills/weaver-e10-meeting/SKILL.md +103 -11
  216. package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
  217. package/skills/weaver-e10-recruit-stage/SKILL.md +19 -11
  218. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -8
  219. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
  220. package/skills/weaver-e10-recruit-stage/references/position-templates.md +23 -2
  221. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  222. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -18
  223. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  224. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +11 -1
  225. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  226. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  227. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  228. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  229. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  230. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  231. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  232. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  233. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  234. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  235. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  236. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  237. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  238. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  239. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  240. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  241. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -22,7 +22,7 @@
22
22
  import { randomUUID } from 'node:crypto';
23
23
  import { rsSuccess, schemaOf } from './types.js';
24
24
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
25
- import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, cachedDsMap, findMenuNode, resolveCurrentUser, buildCardUrl, buildListLocateUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, } from '../shared.js';
25
+ import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, findMenuNode, resolveCurrentUser, buildCardUrl, buildListUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
26
26
  // 面试计划表单字段 dataKey(缓存 fields 里取)。
27
27
  // 注意:digital_id 不放入此列表——它只在「面试方式含 AI」时才是必填,
28
28
  // 放进来会让未部署数字人的环境连非 AI 面试都建不了(单独按需校验)。
@@ -243,7 +243,7 @@ function planBrief(items) {
243
243
  return (items || []).map((x) => x.name + (x.position ? '(岗位:' + x.position + ')' : '') + ' [id=' + x.id + ']').join(';');
244
244
  }
245
245
  async function buildPlan(opts) {
246
- const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan } = opts;
246
+ const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan, rounds } = opts;
247
247
  const { host, appId, cache } = ctx;
248
248
  const objId = objIdOf(cache, 'interview_plan');
249
249
  const formId = formIdOf(cache, 'interview_plan');
@@ -262,8 +262,10 @@ async function buildPlan(opts) {
262
262
  if (!candManageId)
263
263
  throw rsFail('未定位到应聘管理记录(candidateManageId),请确认候选人已有应聘批次');
264
264
  // 面试方式/轮次枚举:环境缓存 field_options 已有同名映射时直接反转使用(省 2 请求),未覆盖才回源
265
- const typeMap = cachedDsMap(cache, objId, 'interview_type') || await getDsOptions(host, objId, fid('interview_type'), appId);
266
- const sessionMap = cachedDsMap(cache, objId, 'interview_session') || await getDsOptions(host, objId, fid('interview_session'), appId);
265
+ const [typeMap, sessionMap] = await Promise.all([
266
+ getDsOptions(host, objId, fid('interview_type')),
267
+ getDsOptions(host, objId, fid('interview_session')),
268
+ ]);
267
269
  const typeId = typeMap[type];
268
270
  if (!typeId)
269
271
  throw rsFail('面试方式「' + type + '」不在枚举中(' + Object.keys(typeMap).join('/') + ')');
@@ -298,7 +300,11 @@ async function buildPlan(opts) {
298
300
  // 真正 await 时若失败再抛原错,保持与串行完全一致的错误语义。
299
301
  const interviewerTask = (async () => {
300
302
  if (interviewer) {
301
- return { id: await resolvePersonId(host, fid('interviewer'), interviewer), name: interviewer };
303
+ // 指定了姓名但人员库里查不到时,报"找不到",不要落到下面"未指定"的兜底文案(会误导成没传参数)。
304
+ const id = await resolvePersonId(host, fid('interviewer'), interviewer);
305
+ if (!id)
306
+ throw rsFail(`面试官「${interviewer}」在人员库中查不到(可能姓名写错、不在本租户,或不是在职人员)`);
307
+ return { id, name: interviewer };
302
308
  }
303
309
  const cu = await resolveCurrentUser(host);
304
310
  return cu ? { id: cu.id, name: cu.name } : { id: null, name: interviewer };
@@ -362,6 +368,46 @@ async function buildPlan(opts) {
362
368
  if (aiPlanPicked) {
363
369
  dataDetails.push({ formField: { id: digitalFid }, dataOptions: [{ optionId: aiPlanPicked.id, content: aiPlanPicked.name }] });
364
370
  }
371
+ // ① 表单默认值优先(用户 2026-11-06 定稿):CLI 走 saveFormData 直写,不触发表单渲染,
372
+ // 页面点「保存」会自动带出的 defaultDetails 必须显式并入提交体,否则「状态」等字段落库为空。
373
+ // 布局元数据回源(有进程内 memo),不读可能过期的磁盘选项缓存。
374
+ const meta = await getFormLayoutMeta(host, formId).catch(() => null);
375
+ const invFields = {};
376
+ for (const [k, v] of Object.entries(fields))
377
+ invFields[String(v)] = k;
378
+ // AI 专属字段由 aiPlan / 面试方式联动控制,不能拿页面默认值覆盖;轮次由下面单独处理(仅当默认里没有时)
379
+ const EXCLUDE_DEFAULTS = new Set(['digital_id', 'interview_type', 'interview_paper_id', 'send_channel']);
380
+ const defaultsApplied = [];
381
+ for (const d of (meta?.defaultDetails || [])) {
382
+ const did = String(d.fieldId || '');
383
+ if (!did || dataDetails.some((x) => String(x.formField.id) === did))
384
+ continue;
385
+ const dk = invFields[did] || '';
386
+ if (EXCLUDE_DEFAULTS.has(dk))
387
+ continue;
388
+ const o = (d.dataOptions || [])[0];
389
+ if (o?.optionId)
390
+ dataDetails.push({ formField: { id: did }, dataOptions: [{ optionId: String(o.optionId), content: o.content || '' }] });
391
+ else if (d.content !== undefined && d.content !== '')
392
+ dataDetails.push({ formField: { id: did }, content: String(d.content) });
393
+ else
394
+ continue;
395
+ defaultsApplied.push(dk || did);
396
+ }
397
+ // ② 轮次 interview_rounds(ebbrowser 关联字段,值=数据字典表记录 id,跨环境必变,运行时按名解析)。
398
+ // 2026-11-06 真机实测:defaultDetails 无该字段、viewLinkages 只有 hide/edit/readonly/required/show
399
+ // (无 value 赋值联动)、initDetails 为空 ⇒ 页面联动不可用,按用户裁定默认「第一轮」。
400
+ const roundsName = String(rounds || '第一轮').trim();
401
+ let roundsWarning = null;
402
+ const roundsFid = fid('interview_rounds');
403
+ if (roundsFid && !dataDetails.some((x) => String(x.formField.id) === String(roundsFid))) {
404
+ const hit = (cache.dict?.raw || []).find((r) => String(r.selection_name || '').trim() === roundsName
405
+ && ['one', 'two', 'three', 'four'].includes(String(r.browser_key || '')));
406
+ if (hit)
407
+ dataDetails.push({ formField: { id: roundsFid }, dataOptions: [{ optionId: String(hit.option_id), content: roundsName }] });
408
+ else
409
+ roundsWarning = '数据字典未找到轮次「' + roundsName + '」(browserKey one/two/three/four),已跳过该字段,不臆造';
410
+ }
365
411
  return {
366
412
  host: ctx.host,
367
413
  objId, formId, appId, dataDetails, cand, typeId, sessionId, interviewerId, isAI, layoutId,
@@ -369,6 +415,10 @@ async function buildPlan(opts) {
369
415
  aiPlanPicked, aiPlanOptions,
370
416
  summary: {
371
417
  action: '安排面试',
418
+ talentId,
419
+ // 单独给一个纯姓名字段:batch 结果表必须用人名,不能拿 talentId 充当「候选人」
420
+ // (W8:旧版 batch.apply 的 resultTable 显示 100005840000020214,同条 viewLink 却写「李伟」)
421
+ candidateName: cand.name,
372
422
  talent: cand.name + '(talentId=' + talentId + ')',
373
423
  position: cand.positionName, type, session,
374
424
  time: start + ' ~ ' + end, interviewer: interviewerName,
@@ -377,6 +427,9 @@ async function buildPlan(opts) {
377
427
  aiPlan: isAI
378
428
  ? (aiPlanPicked ? aiPlanPicked.name + '(id=' + aiPlanPicked.id + ')' : '未选择(AI面试必填,需用户指定)')
379
429
  : '(非 AI 面试,不适用)',
430
+ rounds: roundsName,
431
+ defaultsApplied: defaultsApplied.length ? defaultsApplied : undefined,
432
+ roundsWarning: roundsWarning || undefined,
380
433
  isAIInterview: isAI,
381
434
  },
382
435
  };
@@ -457,8 +510,13 @@ async function resolveRequiredHint(plan, ctx) {
457
510
  // 人才卡片详情 URL(EB 详情页):{baseUrl}/sp/ebdpage/view/{ebdDetailPageId}?talentId={id}
458
511
  function resolveTalentCardUrl(ctx, talentId) {
459
512
  const pid = ctx.cache.ebdDetailPageId;
460
- if (!pid)
461
- return null;
513
+ if (!pid || !talentId) {
514
+ // 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
515
+ // objId 从环境缓存 talent_pool 取,跨环境动态解析,绝不写死。
516
+ const forms = ctx.cache.forms || {};
517
+ const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || '');
518
+ return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
519
+ }
462
520
  return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
463
521
  }
464
522
  // 面试管理列表 URL:优先环境缓存菜单,回退 allMenus 解析(别名匹配,跨环境不写死)
@@ -480,6 +538,11 @@ async function resolveInterviewListUrl(ctx) {
480
538
  return null;
481
539
  return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
482
540
  }
541
+ // 🔴 面试方式默认值(2026-11-07 统一):四个入口此前三种默认——prefill 用「AI面试」、prepare/apply/batch 用
542
+ // 「现场面试」、而表单 defaultValues.interview_type 又是「视频面试」,同一件事三份摘要互相打脸。
543
+ // 现统一为「现场面试」:它不需要邮箱与 AI 方案,缺省路径不会因必填缺失而中途失败。
544
+ // 表单默认值仍在 prepare 的 requiredHint.defaultValues 中原样保留,用户要别的就显式传 type。
545
+ const DEFAULT_INTERVIEW_TYPE = '现场面试';
483
546
  // 默认时间:与页面「选 AI面试」联动一致 —— AI=当前时间~+7天,其它=1小时。分钟精度。
484
547
  function nowAndEnd(type) {
485
548
  const isAI = /AI|人工智能/i.test(String(type || ''));
@@ -531,27 +594,34 @@ const baseInput = {
531
594
  positionId: { type: 'string', description: '应聘职位 id(简历池人才必填)' },
532
595
  interviewer: { type: 'string', description: '面试官姓名(缺省=当前登录用户)' },
533
596
  type: { type: 'string', description: '面试方式(现场面试/视频面试/电话面试/AI面试;含 AI 时邮箱与方案必填)' },
534
- session: { type: 'string', description: '面试轮次(初试/复试/…)' },
597
+ session: { type: 'string', description: '面试阶段(初试/复试/…)' },
598
+ rounds: { type: 'string', description: '面试轮次(第一轮/第二轮/第三轮/第四轮;缺省=页面默认值或第一轮,按数据字典运行时解析)' },
535
599
  start: { type: 'string', pattern: '^\\d{4}-\\d{1,2}-\\d{1,2}[ T]\\d{1,2}:\\d{2}$', description: '开始时间 YYYY-MM-DD HH:mm(缺省=当前时间)' },
536
600
  end: { type: 'string', pattern: '^\\d{4}-\\d{1,2}-\\d{1,2}[ T]\\d{1,2}:\\d{2}$', description: '结束时间(缺省=AI +7天 / 其它 +1小时)' },
537
601
  email: { type: 'string', description: '候选人邮箱(AI 面试必填;补录值优先于人才资料)' },
538
602
  aiPlan: { type: 'string', description: 'AI 面试方案名或 id(AI 面试必填;不传则 prepare 列出候选)' },
539
603
  };
540
- async function prepare(args, env) {
604
+ async function prepare(args, env, opts = {}) {
541
605
  const ctx = await makeCtx(env);
606
+ if (!opts.skipPermissionProbe) {
607
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, 'interview_plan'));
608
+ if (perm === 'denied')
609
+ throw rsFail('当前账号没有「面试计划」表单的创建权限,已阻断(未写入任何数据)');
610
+ }
542
611
  const talentId = await locateTalentId(ctx, args);
543
- const auto = nowAndEnd(args.type || '现场面试');
612
+ const auto = nowAndEnd(String(args.type || DEFAULT_INTERVIEW_TYPE));
544
613
  const startTime = args.start || auto.s;
545
614
  const endTime = args.end || (args.start ? (shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : auto.e);
546
615
  const plan = await buildPlan({
547
616
  ctx, talentId,
548
617
  positionId: args.positionId ? String(args.positionId) : undefined,
549
618
  interviewer: args.interviewer ? String(args.interviewer) : undefined,
550
- type: String(args.type || '现场面试'), session: String(args.session || '初试'),
619
+ type: String(args.type || DEFAULT_INTERVIEW_TYPE), session: String(args.session || '初试'),
551
620
  start: String(startTime), end: String(endTime),
552
621
  email: args.email ? String(args.email) : undefined,
553
622
  mobile: args.mobile ? String(args.mobile) : undefined,
554
623
  aiPlan: args.aiPlan ? String(args.aiPlan) : undefined,
624
+ rounds: args.rounds ? String(args.rounds) : undefined,
555
625
  });
556
626
  plan.host = ctx.host;
557
627
  const aiPlanCandidates = plan.isAI
@@ -574,7 +644,22 @@ async function prepare(args, env) {
574
644
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
575
645
  const { createHash } = await import('node:crypto');
576
646
  const fp = createHash('sha256').update(JSON.stringify(willSubmit)).digest('hex');
577
- const continuation = await env.continuation.issue({ operation: 'recruit-stage.interview.arrange.apply', fingerprint: fp });
647
+ const continuation = await env.continuation.issue({ operation: 'recruit-stage.interview.arrange.apply', fingerprint: fp,
648
+ enumMaps: await dsOptionsSnapshot(), timeWindow: { start: String(startTime), end: String(endTime) },
649
+ // 🔴 参数快照(2026-11-07 修复):协议文档写的是「apply 带 confirm:true + continuation」,
650
+ // 但 applyCore 原来只从 args 取 talentId/type/session…,Agent 少传任一项就直接报 talent_required。
651
+ // 现把 prepare 用过的参数一并签进 continuation,apply 可只带 confirm + continuation;
652
+ // 若 apply 显式传了同名字段,仍以显式值为准(batch 场景每人 talentId 不同,靠这条生效)。
653
+ argsSnapshot: {
654
+ talentId, type: String(args.type || DEFAULT_INTERVIEW_TYPE), session: String(args.session || '初试'),
655
+ positionId: args.positionId ? String(args.positionId) : undefined,
656
+ interviewer: args.interviewer ? String(args.interviewer) : undefined,
657
+ aiPlan: args.aiPlan ? String(args.aiPlan) : undefined,
658
+ email: args.email ? String(args.email) : undefined,
659
+ mobile: args.mobile ? String(args.mobile) : undefined,
660
+ rounds: args.rounds ? String(args.rounds) : undefined,
661
+ },
662
+ });
578
663
  return rsSuccess('recruit-stage.interview.arrange.prepare', {
579
664
  mode: 'prepare', ...plan.summary,
580
665
  needAiPlan: plan.isAI && !plan.aiPlanPicked,
@@ -584,7 +669,25 @@ async function prepare(args, env) {
584
669
  ? 'AI面试方案为必填:请把 aiPlans 列给用户选择(isDefault=true 为页面默认方案),确认后带 aiPlan 重跑 apply'
585
670
  : undefined,
586
671
  requiredHint,
672
+ // 面试方式来源透明化:不传 type 时用 CLI 统一默认,同时把表单默认值一并给出,
673
+ // 两者不同就给 typeNote,避免"摘要说现场面试、表单默认写视频面试"这种自相矛盾没人发现。
674
+ typeSource: args.type ? 'explicit' : 'default',
675
+ formDefaultInterviewType: requiredHint?.defaultValues?.interview_type?.content,
676
+ typeNote: (!args.type
677
+ && requiredHint?.defaultValues?.interview_type?.content
678
+ && String(requiredHint.defaultValues.interview_type.content) !== DEFAULT_INTERVIEW_TYPE)
679
+ ? `本次未指定 type,按 CLI 默认「${DEFAULT_INTERVIEW_TYPE}」提交;页面表单默认是「${requiredHint.defaultValues.interview_type.content}」,如需与该默认一致请显式传 type`
680
+ : undefined,
587
681
  willSubmit,
682
+ // 🔴 2026-11-07:prepare 协议约定 preview(人类可读确认摘要),本 op 此前未提供,
683
+ // 确认链只剩 willSubmit 明细。这里用 summary 全量 + 两处需用户裁决的提示拼出预览。
684
+ preview: {
685
+ ...plan.summary,
686
+ needAiPlan: plan.isAI && !plan.aiPlanPicked,
687
+ note: plan.isAI && !plan.aiPlanPicked
688
+ ? 'AI 面试方案未选定:apply 会逐人阻断,需先选 aiPlan 重新 prepare'
689
+ : '确认姓名、职位、面试方式、轮次、面试官与时间窗后再 apply',
690
+ },
588
691
  }, {
589
692
  continuation,
590
693
  fingerprint: fp,
@@ -597,20 +700,30 @@ async function apply(args, env) {
597
700
  if (!args.continuation)
598
701
  throw rsValidationError('continuation_required', '缺少 continuation(来自 prepare 的 meta)');
599
702
  const payload = await env.continuation.verify(String(args.continuation), 'recruit-stage.interview.arrange.apply');
703
+ return applyCore(args, env, payload);
704
+ }
705
+ /** 单个候选人的落库执行体(供单条 apply 与批量 apply 复用;payload 由调用方校验)。 */
706
+ async function applyCore(args, env, payload) {
707
+ restoreDsOptions(payload.enumMaps);
600
708
  const ctx = await makeCtx(env);
601
- const talentId = await locateTalentId(ctx, args);
602
- const auto = nowAndEnd(args.type || '现场面试');
603
- const startTime = args.start || auto.s;
604
- const endTime = args.end || (args.start ? (shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : auto.e);
709
+ // 合并 prepare 快照与 apply 显式参数:显式优先(batch 每个候选人的 talentId 各不相同)。
710
+ // 这样 apply 只带 confirm + continuation 也能跑完,与协议文档一致。
711
+ const merged = { ...(payload.argsSnapshot || {}), ...args };
712
+ const talentId = await locateTalentId(ctx, merged);
713
+ const auto = nowAndEnd(String(merged.type || DEFAULT_INTERVIEW_TYPE));
714
+ // prepare 已把时间窗口放进 continuation:apply 复用它,避免两次运行时刻不同导致 fingerprint 漂移
715
+ const startTime = merged.start || payload.timeWindow?.start || auto.s;
716
+ const endTime = merged.end || (merged.start ? (shiftTime(String(merged.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : (payload.timeWindow?.end || auto.e));
605
717
  const plan = await buildPlan({
606
718
  ctx, talentId,
607
- positionId: args.positionId ? String(args.positionId) : undefined,
608
- interviewer: args.interviewer ? String(args.interviewer) : undefined,
609
- type: String(args.type || '现场面试'), session: String(args.session || '初试'),
719
+ positionId: merged.positionId ? String(merged.positionId) : undefined,
720
+ interviewer: merged.interviewer ? String(merged.interviewer) : undefined,
721
+ type: String(merged.type || DEFAULT_INTERVIEW_TYPE), session: String(merged.session || '初试'),
610
722
  start: String(startTime), end: String(endTime),
611
- email: args.email ? String(args.email) : undefined,
612
- mobile: args.mobile ? String(args.mobile) : undefined,
613
- aiPlan: args.aiPlan ? String(args.aiPlan) : undefined,
723
+ email: merged.email ? String(merged.email) : undefined,
724
+ mobile: merged.mobile ? String(merged.mobile) : undefined,
725
+ aiPlan: merged.aiPlan ? String(merged.aiPlan) : undefined,
726
+ rounds: merged.rounds ? String(merged.rounds) : undefined,
614
727
  });
615
728
  plan.host = ctx.host;
616
729
  // AI 面试方案必填:未选定直接阻断,不落库、不执行动作链
@@ -629,17 +742,37 @@ async function apply(args, env) {
629
742
  name: '面试管理-' + plan.cand.name + ' ' + plan.summary.time, dataDetails: plan.dataDetails,
630
743
  });
631
744
  const actionsRun = await execSaveActions(plan, formDataId);
745
+ // 第三层门禁:写完回查关键字段(后端对无效 optionId 会静默丢弃仍返回 success)
746
+ // union_status 可能被动作链推进,只要求非空;其余字段严格比对提交值。
747
+ const verification = await verifySubmitted({
748
+ host: ctx.host, formId: plan.formId, objId: plan.objId, dataId: formDataId,
749
+ expected: expectedFields(plan.dataDetails, ctx.cache.fields[plan.objId] || {}, ['interview_type', 'interview_session', 'interview_rounds', 'digital_id', 'email', 'union_status'], ['union_status']),
750
+ });
751
+ if (verification.mismatches.length)
752
+ invalidateEnvCache(ctx.baseUrl, ctx.appId);
753
+ const verifyWarnings = verification.mismatches.map((m) => '落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual + '(该字段可能未写入)');
632
754
  const detailUrl = buildCardUrl(ctx.baseUrl, plan.objId, formDataId);
633
- const listLocateUrl = buildListLocateUrl(ctx.baseUrl, ctx.appId, (ctx.cache.lists?.interview?.listId) || '', plan.objId, formDataId);
755
+ // 列表链接只打开列表;详情单页由 viewLink 单独给出,不再用「列表+滑出详情」组合地址。
756
+ const listLocateUrl = buildListUrl(ctx.baseUrl, (ctx.cache.lists?.interview?.listId) || '');
634
757
  return rsSuccess('recruit-stage.interview.arrange.apply', {
635
- mode: 'apply', result: 'success', interviewFormId: formDataId,
758
+ mode: 'apply', result: verification.mismatches.length ? 'partial' : 'success', interviewFormId: formDataId,
636
759
  interviewCardUrl: detailUrl,
760
+ // 🔴 回填落库实际采用的关键值(W9):旧版 apply 输出里没有 time,Agent 无法核对
761
+ // 「输出时间 vs 落库时间」,曾出现差 2 分钟而无人发现。现在 time 直接取本次提交进表单的
762
+ // dataDetails 时间值(与回查同一来源),所以与落库一致。
763
+ time: plan.summary.time,
764
+ talent: plan.summary.talent,
765
+ position: plan.summary.position,
766
+ type: plan.summary.type,
767
+ session: plan.summary.session,
768
+ interviewer: plan.summary.interviewer,
637
769
  viewLink: detailUrl ? `[查看 ${plan.cand.name || ''} 的面试安排详情](${detailUrl})` : null,
638
- listLocateLink: listLocateUrl ? `[打开面试管理列表(已定位本次面试安排)](${listLocateUrl})` : null,
639
- agentNote: '产物 = 两个 Markdown 链接(平台实证可点击):① viewLink 面试安排详情页 ② listLocateLink 面试管理列表并右侧滑出本次面试安排;按顺序原样放回答正文,缺哪个只给另一个、不输出半截。不要包 browsertool / <artifact> 标签。',
770
+ listLocateLink: listLocateUrl ? `[打开面试管理列表](${listLocateUrl})` : null,
771
+ agentNote: '产物 = 两个 Markdown 链接(平台实证可点击):① viewLink 面试安排详情单页 ② listLocateLink 面试管理列表(只打开列表,不打开详情)。按顺序原样放回答正文,缺哪个只给另一个、不输出半截。不要包 browsertool / <artifact> 标签。',
640
772
  aiPlan: plan.isAI && plan.aiPlanPicked ? { id: plan.aiPlanPicked.id, name: plan.aiPlanPicked.name } : undefined,
641
773
  saveActions: actionsRun.executed,
642
- warnings: actionsRun.warnings,
774
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
775
+ warnings: [...(actionsRun.warnings || []), ...verifyWarnings],
643
776
  assigned: actionsRun.assigned || {},
644
777
  });
645
778
  }
@@ -649,11 +782,11 @@ async function prefill(args, env) {
649
782
  const objId = objIdOf(ctx.cache, 'interview_plan');
650
783
  const formId = formIdOf(ctx.cache, 'interview_plan');
651
784
  const fields = ctx.cache.fields[objId] || {};
652
- const typeKey = String(args.type || 'AI面试');
785
+ const typeKey = String(args.type || DEFAULT_INTERVIEW_TYPE);
653
786
  const typeFid = fields.interview_type;
654
787
  if (!typeFid)
655
788
  throw rsFail('面试计划缺少字段 interview_type(ds/fields 解析不到)');
656
- const typeMap = cachedDsMap(ctx.cache, objId, 'interview_type') || await getDsOptions(ctx.host, objId, typeFid, ctx.appId);
789
+ const typeMap = await getDsOptions(ctx.host, objId, typeFid);
657
790
  const typeId = typeMap[typeKey];
658
791
  if (!typeId)
659
792
  throw rsFail('面试方式「' + typeKey + '」不在枚举中(' + Object.keys(typeMap).join('/') + ')');
@@ -682,6 +815,173 @@ async function prefill(args, env) {
682
815
  ],
683
816
  });
684
817
  }
818
+ // ── 批量约面(2026-11-06)──────────────────────────────────────────────────────
819
+ // 后端没有批量端点:assignedInterview 只收单个 formDataId,页面「多选约面」也是前端弹窗 + 循环。
820
+ // 这里做的是「一次确认、逐人执行」的编排:先逐人 prepare 出摘要与指纹,用户确认一次,
821
+ // 再逐人走完整的保存 + 动作链 + 回查,最后汇总成功/失败。非原子,结果可能是 partial。
822
+ const BATCH_MAX = 30;
823
+ function normalizeCandidateList(raw) {
824
+ if (!Array.isArray(raw) || !raw.length) {
825
+ throw rsValidationError('candidates_required', 'candidates 必须是非空数组,元素形如 {talentId} / {mobile} / {name}');
826
+ }
827
+ if (raw.length > BATCH_MAX) {
828
+ throw rsValidationError('candidates_too_many', `一次最多处理 ${BATCH_MAX} 人(当前 ${raw.length} 人);请分批执行`);
829
+ }
830
+ return raw.map((x, i) => {
831
+ const o = (x && typeof x === 'object') ? x : {};
832
+ if (!o.talentId && !o.mobile && !o.name) {
833
+ throw rsValidationError('candidate_invalid', `第 ${i + 1} 个候选人缺少 talentId/mobile/name`);
834
+ }
835
+ return o;
836
+ });
837
+ }
838
+ async function batchPrepare(args, env) {
839
+ const list = normalizeCandidateList(args.candidates);
840
+ const type = String(args.type || DEFAULT_INTERVIEW_TYPE);
841
+ const auto = nowAndEnd(type);
842
+ const startTime = String(args.start || auto.s);
843
+ const endTime = String(args.end || (args.start ? (shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1000 : 3600 * 1000) || auto.e) : auto.e));
844
+ const shared = {};
845
+ for (const k of ['positionId', 'interviewer', 'type', 'session', 'rounds', 'aiPlan', 'email']) {
846
+ if (args[k] !== undefined && args[k] !== null && String(args[k]).trim() !== '')
847
+ shared[k] = String(args[k]);
848
+ }
849
+ shared.type = type;
850
+ shared.start = startTime;
851
+ shared.end = endTime;
852
+ const items = [];
853
+ const seen = new Set();
854
+ for (let i = 0; i < list.length; i++) {
855
+ const c = list[i];
856
+ const label = String(c.name || c.mobile || c.talentId || `第${i + 1}人`);
857
+ try {
858
+ const r = await prepare({ ...shared, ...c }, env, { skipPermissionProbe: i > 0 });
859
+ const d = r.data || {};
860
+ const talentId = String(d.talentId || '');
861
+ if (talentId && seen.has(talentId)) {
862
+ items.push({ index: i + 1, label, talentId, status: 'duplicate', message: '与前面的候选人重复,已跳过' });
863
+ continue;
864
+ }
865
+ if (talentId)
866
+ seen.add(talentId);
867
+ const meta = r.meta || {};
868
+ // 结果表里的人名:优先用 prepare 解析出的真实姓名(d.candidateName),
869
+ // 退而用调用方传的 name → mobile → talentId。旧版直接拿 talentId 当 label,
870
+ // 从列表勾选(只传 talentId)时整张结果表都是 id,看不出是谁(W8)。
871
+ const resolvedName = String(d.candidateName || '').trim();
872
+ items.push({
873
+ index: i + 1, label: resolvedName || label, talentId, status: 'ready',
874
+ args: { ...shared, ...c },
875
+ fingerprint: String(meta.fingerprint || ''),
876
+ timeWindow: { start: startTime, end: endTime },
877
+ message: d.needAiPlan ? 'AI面试方案未选(apply 会阻断)' : undefined,
878
+ });
879
+ }
880
+ catch (e) {
881
+ items.push({ index: i + 1, label, status: 'failed', message: e?.message || 'prepare 失败' });
882
+ }
883
+ }
884
+ const ready = items.filter((x) => x.status === 'ready');
885
+ if (!ready.length) {
886
+ return rsSuccess('recruit-stage.interview.arrange.batch.prepare', {
887
+ mode: 'batch-prepare', total: items.length, ready: 0, failed: items.length,
888
+ items: items.map(({ args, fingerprint, timeWindow, ...rest }) => rest),
889
+ hint: '没有任何候选人可执行,逐条看 items[].message 修正后重试',
890
+ preview: {
891
+ action: '批量安排面试 — 无可执行项',
892
+ total: items.length,
893
+ ready: 0,
894
+ failed: items.length,
895
+ reasons: items.map((x) => `${x.index}. ${x.label}:${x.message || x.status}`),
896
+ },
897
+ });
898
+ }
899
+ const { createHash } = await import('node:crypto');
900
+ const fp = createHash('sha256').update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest('hex');
901
+ const continuation = await env.continuation.issue({
902
+ operation: 'recruit-stage.interview.arrange.batch.apply',
903
+ fingerprint: fp,
904
+ enumMaps: await dsOptionsSnapshot(),
905
+ items: ready.map((x) => ({ index: x.index, label: x.label, talentId: x.talentId, args: x.args, fingerprint: x.fingerprint, timeWindow: x.timeWindow })),
906
+ });
907
+ return rsSuccess('recruit-stage.interview.arrange.batch.prepare', {
908
+ mode: 'batch-prepare',
909
+ total: items.length,
910
+ ready: ready.length,
911
+ failed: items.filter((x) => x.status === 'failed').length,
912
+ duplicates: items.filter((x) => x.status === 'duplicate').length,
913
+ shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + ' ~ ' + endTime, aiPlan: shared.aiPlan },
914
+ items: items.map(({ args, fingerprint, timeWindow, ...rest }) => rest),
915
+ note: '确认摘要后带 confirm:true 与 meta.continuation 调 batch.apply;逐人执行,可能是 partial',
916
+ // 🔴 2026-11-07:本 op 此前无 preview。批量场景用户要看的是「这批到底谁会被约、谁被跳过、为什么」,
917
+ // 所以 preview 用逐行名单而不是数字汇总。
918
+ preview: {
919
+ action: '批量安排面试(逐人执行,结果可能 partial)',
920
+ total: items.length,
921
+ ready: ready.length,
922
+ failed: items.filter((x) => x.status === 'failed').length,
923
+ duplicates: items.filter((x) => x.status === 'duplicate').length,
924
+ shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + ' ~ ' + endTime, aiPlan: shared.aiPlan },
925
+ candidates: items.map((x) => `${x.index}. ${x.label} — ${x.status}${x.message ? ':' + x.message : ''}`),
926
+ },
927
+ }, {
928
+ continuation,
929
+ fingerprint: fp,
930
+ confirmHint: '用户明确确认整批名单后,携带 confirm:true 与本 continuation 调用 recruit-stage.interview.arrange.batch.apply',
931
+ });
932
+ }
933
+ async function batchApply(args, env) {
934
+ if (args.confirm !== true) {
935
+ throw rsConfirmationError('recruit-stage.interview.arrange.batch.apply', { hint: '批量写操作必须显式 confirm:true' });
936
+ }
937
+ if (!args.continuation)
938
+ throw rsValidationError('continuation_required', '缺少 continuation(来自 batch.prepare 的 meta)');
939
+ const batch = await env.continuation.verify(String(args.continuation), 'recruit-stage.interview.arrange.batch.apply');
940
+ const items = Array.isArray(batch.items) ? batch.items : [];
941
+ if (!items.length)
942
+ throw rsValidationError('batch_empty', 'continuation 中没有可执行的候选人');
943
+ const results = [];
944
+ for (const it of items) {
945
+ const payload = { fingerprint: it.fingerprint, timeWindow: it.timeWindow, enumMaps: batch.enumMaps };
946
+ try {
947
+ const r = await applyCore({ ...(it.args || {}), confirm: true }, env, payload);
948
+ const d = r.data || {};
949
+ results.push({
950
+ index: it.index,
951
+ talentId: it.talentId,
952
+ name: it.label,
953
+ candidateName: it.label,
954
+ status: d.result === 'partial' ? 'partial' : 'success',
955
+ interviewFormId: d.interviewFormId,
956
+ cardUrl: d.interviewCardUrl,
957
+ viewLink: d.viewLink,
958
+ warnings: d.warnings && d.warnings.length ? d.warnings : undefined,
959
+ });
960
+ }
961
+ catch (e) {
962
+ results.push({ index: it.index, talentId: it.talentId, name: it.label, candidateName: it.label, status: 'failed', message: e?.message || '执行失败' });
963
+ }
964
+ }
965
+ const ok = results.filter((x) => x.status === 'success').length;
966
+ const partial = results.filter((x) => x.status === 'partial').length;
967
+ const failed = results.filter((x) => x.status === 'failed').length;
968
+ const lines = [
969
+ '| # | 候选人 | 结果 | 说明 |',
970
+ '|---|---|---|---|',
971
+ ...results.map((x) => `| ${x.index} | ${x.name} | ${x.status === 'success' ? '成功' : x.status === 'partial' ? '部分成功' : '失败'} | ${x.message || (x.warnings?.length ? x.warnings.join(';') : x.cardUrl ? '已创建面试安排' : '')} |`),
972
+ ];
973
+ return rsSuccess('recruit-stage.interview.arrange.batch.apply', {
974
+ mode: 'batch-apply',
975
+ result: failed || partial ? 'partial' : 'success',
976
+ total: results.length,
977
+ succeeded: ok,
978
+ partial,
979
+ failed,
980
+ items: results,
981
+ resultTable: lines.join('\n'),
982
+ agentNote: '把 resultTable 原样放回答正文(这是本次批量约面的结果清单);失败/部分成功的条目要连同 message 一起说清楚,不要只报总数。',
983
+ });
984
+ }
685
985
  export const interviewArrangeOperations = [
686
986
  {
687
987
  name: 'recruit-stage.interview.arrange.prepare',
@@ -718,5 +1018,32 @@ export const interviewArrangeOperations = [
718
1018
  inputSchema: schemaOf(baseInput, {}),
719
1019
  handler: prefill,
720
1020
  },
1021
+ {
1022
+ name: 'recruit-stage.interview.arrange.batch.prepare',
1023
+ resource: 'recruit.interview',
1024
+ method: 'prepare',
1025
+ action: 'interview.arrange.batch.prepare',
1026
+ summary: '批量约面确认摘要:逐人定位候选人、解析面试方式/轮次与必填项,输出名单与失败原因(重复自动跳过),不写入;一次最多 30 人',
1027
+ capability: 'recruit.interview.arrange',
1028
+ risk: 'write',
1029
+ requiresConfirmation: true,
1030
+ inputSchema: schemaOf({
1031
+ candidates: { type: 'array', description: '候选人数组,元素为 {talentId} / {mobile} / {name} 之一;最多 30 人', items: { type: 'object' } },
1032
+ ...baseInput,
1033
+ }, { required: ['candidates'] }),
1034
+ handler: batchPrepare,
1035
+ },
1036
+ {
1037
+ name: 'recruit-stage.interview.arrange.batch.apply',
1038
+ resource: 'recruit.interview',
1039
+ method: 'apply',
1040
+ action: 'interview.arrange.batch.apply',
1041
+ summary: '用户确认名单后逐人安排面试(同一套保存+动作链+落库回查),返回逐人结果清单与 Markdown 表格;非原子批量,结果可能为 partial',
1042
+ capability: 'recruit.interview.arrange',
1043
+ risk: 'write',
1044
+ requiresConfirmation: true,
1045
+ inputSchema: schemaOf({ confirm: { type: 'boolean' }, continuation: { type: 'string' } }, { required: ['confirm', 'continuation'] }),
1046
+ handler: batchApply,
1047
+ },
721
1048
  ];
722
1049
  void randomUUID;
@@ -1,6 +1,6 @@
1
1
  import { rsSuccess, schemaOf } from './types.js';
2
2
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
3
- import { objIdOf, formIdOf, saveFormData, runEsb, getDsOptions, cachedDsMap, getFormButtonsForData, findSubmitButton, analyzeButtonActions, getFormDataRecord, toSubmitDetails, randHex32, } from '../shared.js';
3
+ import { objIdOf, formIdOf, saveFormData, runEsb, getDsOptions, getFormButtonsForData, findSubmitButton, analyzeButtonActions, getFormDataRecord, toSubmitDetails, randHex32, dsOptionsSnapshot, restoreDsOptions, } from '../shared.js';
4
4
  // InterviewStatusEnum.INVALID(已失效):系统反馈按钮(填写/编辑/代评价)均要求非此状态
5
5
  const INVALID_STATUS_ID = '841052191228968977';
6
6
  const R = (v) => String(v ?? '').replace(/^<p>|<\/p>$/g, '').trim();
@@ -110,7 +110,7 @@ async function prepare(args, env) {
110
110
  // result optionId
111
111
  let newOptionId = null;
112
112
  if (args.result) {
113
- const opts = cachedDsMap(t.cache, t.objId, 'result') || await getDsOptions(t.host, t.objId, t.resultFid, t.appId);
113
+ const opts = await getDsOptions(t.host, t.objId, t.resultFid);
114
114
  newOptionId = opts[String(args.result)];
115
115
  if (!newOptionId)
116
116
  throw rsFail('未识别的面试结果「' + args.result + '」,可选:' + Object.keys(opts).join('/'));
@@ -120,7 +120,16 @@ async function prepare(args, env) {
120
120
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
121
121
  const { createHash } = await import('node:crypto');
122
122
  const fp = createHash('sha256').update(JSON.stringify(willSubmit)).digest('hex');
123
- const continuation = await env.continuation.issue({ operation: 'recruit-stage.interview.feedback.edit.apply', fingerprint: fp });
123
+ const continuation = await env.continuation.issue({ operation: 'recruit-stage.interview.feedback.edit.apply', fingerprint: fp,
124
+ enumMaps: await dsOptionsSnapshot(),
125
+ // 🔴 2026-11-07 修复(同 arrange/jd.create 的同类缺陷):apply 原来只从 args 取 talentId/result/comment,
126
+ // 导致「只带 confirm + continuation」时定位不到目标或指纹不符。现将这些参数签进 continuation。
127
+ argsSnapshot: {
128
+ talentId: t.talentId,
129
+ feedbackId: args.feedbackId ? String(args.feedbackId) : String(t.target.feedbackId),
130
+ result: args.result ? String(args.result) : undefined,
131
+ comment: args.comment !== undefined ? String(args.comment) : undefined,
132
+ } });
124
133
  return rsSuccess('recruit-stage.interview.feedback.edit.prepare', {
125
134
  mode: 'prepare',
126
135
  talentId: t.talentId,
@@ -138,6 +147,20 @@ async function prepare(args, env) {
138
147
  }
139
148
  : '⚠️ 未定位到「提交评价」按钮(getFormButtons 未取到保存按钮),仅能执行保存+写过程日志',
140
149
  willSubmit,
150
+ // 🔴 2026-11-07:本 op 此前无 preview(与 jd.create 同类缺陷)。把上方的中文字段收进 preview,
151
+ // 让「确认」这一步有统一的机器可读摘要,而不是只能靠人读散装字段。
152
+ preview: {
153
+ action: '提交/修改面试反馈',
154
+ 候选人: t.talentId,
155
+ 面试: t.target.planName,
156
+ 面试官: t.target.interviewer,
157
+ 反馈记录Id: t.target.feedbackId,
158
+ 当前反馈: (t.target.result ? '结果 ' + t.target.result : '') + (t.target.judgement ? ';评价 ' + t.target.judgement : ''),
159
+ 新反馈: (args.result ? '结果 ' + newResultName : '') + (args.comment !== undefined ? ';评价 ' + newComment : ''),
160
+ 将执行动作: analysis
161
+ ? { 保存反馈表单: 'saveFormData(全字段集 + updateTimeStamp 乐观锁)', 动作流: analysis.esbIds.length ? analysis.esbIds : '(该按钮无 esb 动作流)', 招聘API: analysis.jsCalls.map((c) => c.url) }
162
+ : '⚠️ 未定位到「提交评价」按钮,仅能执行保存+写过程日志',
163
+ },
141
164
  }, { continuation, fingerprint: fp, confirmHint: '用户明确确认后,携带 confirm:true 与 continuation 调用 apply' });
142
165
  }
143
166
  async function apply(args, env) {
@@ -146,19 +169,22 @@ async function apply(args, env) {
146
169
  if (!args.continuation)
147
170
  throw rsValidationError('continuation_required', '缺少 continuation(来自 prepare 的 meta)');
148
171
  const payload = await env.continuation.verify(String(args.continuation), 'recruit-stage.interview.feedback.edit.apply');
149
- const t = await buildTarget(env, args);
172
+ restoreDsOptions(payload.enumMaps);
173
+ // 合并 prepare 快照(显式传的优先),使 apply 只带 confirm + continuation 也能执行
174
+ const merged = { ...(payload.argsSnapshot || {}), ...args };
175
+ const t = await buildTarget(env, merged);
150
176
  // 重新取最新 updateTimeStamp(乐观锁)
151
177
  const rec2 = await getFormDataRecord(t.host, t.formId, String(t.target.feedbackId), t.objId);
152
178
  const details2 = toSubmitDetails(rec2.dataDetails);
153
179
  let newOptionId = null;
154
- if (args.result) {
155
- const opts = cachedDsMap(t.cache, t.objId, 'result') || await getDsOptions(t.host, t.objId, t.resultFid, t.appId);
156
- newOptionId = opts[String(args.result)];
180
+ if (merged.result) {
181
+ const opts = await getDsOptions(t.host, t.objId, t.resultFid);
182
+ newOptionId = opts[String(merged.result)];
157
183
  if (!newOptionId)
158
- throw rsFail('未识别的面试结果「' + args.result + '」,可选:' + Object.keys(opts).join('/'));
184
+ throw rsFail('未识别的面试结果「' + merged.result + '」,可选:' + Object.keys(opts).join('/'));
159
185
  }
160
- const newComment = args.comment !== undefined ? String(args.comment) : t.target.judgement;
161
- const newResultName = args.result ? String(args.result) : t.target.result;
186
+ const newComment = merged.comment !== undefined ? String(merged.comment) : t.target.judgement;
187
+ const newResultName = merged.result ? String(merged.result) : t.target.result;
162
188
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
163
189
  const { createHash } = await import('node:crypto');
164
190
  if (payload.fingerprint !== createHash('sha256').update(JSON.stringify(willSubmit)).digest('hex')) {