weaver-work-cli 0.1.70 → 0.1.71

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 (214) hide show
  1. package/dist/chunks/{archive-VUTREF3P.js → archive-5P33NAUN.js} +22 -5
  2. package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-YTY5D7DG.js} +17 -5
  3. package/dist/chunks/{asset-45U6TY7I.js → asset-3Q5MFQBX.js} +22 -5
  4. package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-PQPNYIS7.js} +15 -5
  5. package/dist/chunks/{attachment-content-DMU7KNZ7.js → attachment-content-7CN7JB6B.js} +3 -3
  6. package/dist/chunks/{blog-5AML4WMG.js → blog-MFHHK6ZR.js} +25 -5
  7. package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-OZ435AYW.js} +22 -8
  8. package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-TNJXS5UC.js} +15 -5
  9. package/dist/chunks/{chunk-H2NRTGZR.js → chunk-2DNCKZRX.js} +3 -3
  10. package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
  11. package/dist/chunks/{chunk-HG6INLH6.js → chunk-6MMSLE6K.js} +23 -6
  12. package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-B4NINGP2.js} +3 -3
  13. package/dist/chunks/{chunk-LRKKKO5A.js → chunk-DRJYPXKC.js} +3 -4
  14. package/dist/chunks/{chunk-KDOJW5LH.js → chunk-EJLP63UO.js} +1 -1
  15. package/dist/chunks/{chunk-HAORST2G.js → chunk-FRMDHZSN.js} +11 -11
  16. package/dist/chunks/{chunk-GWM5TLIK.js → chunk-G7ZM2VOX.js} +34 -34
  17. package/dist/chunks/{chunk-LSVA7QA6.js → chunk-GB2MCJPG.js} +3 -1
  18. package/dist/chunks/{chunk-L2A3COWV.js → chunk-ICNUOWLL.js} +4 -4
  19. package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
  20. package/dist/chunks/{chunk-7CINV2BU.js → chunk-LU2SPJYY.js} +2 -2
  21. package/dist/chunks/{chunk-E7VWE2XI.js → chunk-MD5RXRI3.js} +3 -3
  22. package/dist/chunks/{chunk-VZUH3LKI.js → chunk-MZVQKQP5.js} +167 -157
  23. package/dist/chunks/{chunk-X6PMJQGO.js → chunk-OFCF23FY.js} +6 -6
  24. package/dist/chunks/{chunk-IVCOZCAW.js → chunk-OPTJ6IF7.js} +1 -1
  25. package/dist/chunks/{chunk-727VKJQK.js → chunk-OZ7CJC7W.js} +2 -2
  26. package/dist/chunks/{chunk-T24EBWAZ.js → chunk-P3AFNAJ6.js} +48 -21
  27. package/dist/chunks/{chunk-LJE7RZNC.js → chunk-Q3EXRNB4.js} +1 -1
  28. package/dist/chunks/{chunk-QYDSTYGG.js → chunk-SKWKCLJX.js} +3 -3
  29. package/dist/chunks/{chunk-DSBV4GRK.js → chunk-SSS75WXW.js} +3 -3
  30. package/dist/chunks/{chunk-I5XB4MZT.js → chunk-SUWR5QEG.js} +94 -65
  31. package/dist/chunks/{chunk-XIBMZEDB.js → chunk-VJWVB55R.js} +2 -2
  32. package/dist/chunks/{chunk-EHH363SP.js → chunk-VMVMEIL3.js} +4 -4
  33. package/dist/chunks/chunk-WM33BSIL.js +136 -0
  34. package/dist/chunks/{chunk-GFOFUH6O.js → chunk-X2C5CGGM.js} +52 -51
  35. package/dist/chunks/{chunk-4W6BSNIL.js → chunk-XLSJC6JZ.js} +6 -6
  36. package/dist/chunks/{chunk-U3OO3IZF.js → chunk-YN5SD4TX.js} +20 -7
  37. package/dist/chunks/{conflict-YW5BULJ3.js → conflict-Y4PXZ2YQ.js} +2 -2
  38. package/dist/chunks/{contract-3PMHUASH.js → contract-C3BGUMBM.js} +48 -5
  39. package/dist/chunks/{cowork-FZBTTBYX.js → cowork-2AWG4QLA.js} +37 -8
  40. package/dist/chunks/{create-flow-5OBS3B3V.js → create-flow-LOUOK46Z.js} +6 -6
  41. package/dist/chunks/{data-2YZ6A6TL.js → data-BSFYMXVO.js} +99 -184
  42. package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-LAAMTD2Y.js} +17 -7
  43. package/dist/chunks/{ehr-MNPR4TE5.js → ehr-36KEX5SH.js} +62 -13
  44. package/dist/chunks/{entry-mode-L65OWPFM.js → entry-mode-6N2IGCS4.js} +3 -3
  45. package/dist/chunks/{env-XW7LYIME.js → env-QYLS3EB3.js} +2 -2
  46. package/dist/chunks/{esb-GSB5QCEX.js → esb-PTYS3E67.js} +17 -7
  47. package/dist/chunks/{factory-MHFZZAGH.js → factory-LPFPKZ4T.js} +1 -1
  48. package/dist/chunks/{fna-XBSNUS2V.js → fna-JNHCLRDE.js} +15 -5
  49. package/dist/chunks/{group-chat-EEOLO5NM.js → group-chat-QP2WX4QJ.js} +3 -3
  50. package/dist/chunks/{host-2UMNXX5H.js → host-57LSRSE7.js} +4 -4
  51. package/dist/chunks/{host-NVDG3NC6.js → host-7BVR7CQ3.js} +4 -4
  52. package/dist/chunks/{host-SYPCA63D.js → host-C2BLBIID.js} +4 -4
  53. package/dist/chunks/{host-XVWBOSEN.js → host-K2ZKNXME.js} +4 -4
  54. package/dist/chunks/{host-R7BP3CTI.js → host-NS36QFLR.js} +6 -4
  55. package/dist/chunks/{host-BD44ASOD.js → host-QXFKQXNX.js} +4 -4
  56. package/dist/chunks/{hrm-FZUDJAND.js → hrm-FSGO4NSH.js} +15 -6
  57. package/dist/chunks/{im-F5NENPD7.js → im-2BFGS2XO.js} +16 -6
  58. package/dist/chunks/{invoice-DS6FLU55.js → invoice-JKLTTHSZ.js} +27 -6
  59. package/dist/chunks/{jiuchuanhui-JCBUR563.js → jiuchuanhui-PTABJE7V.js} +19 -6
  60. package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-YN2ZP3CS.js} +6 -6
  61. package/dist/chunks/{mail-ZEOSANEJ.js → mail-YNO7ZZUK.js} +116 -97
  62. package/dist/chunks/{meeting-PCD5EPBF.js → meeting-NIDHDBCB.js} +29 -16
  63. package/dist/chunks/{minute-doc-WTZJVCHG.js → minute-doc-G3QAT7DE.js} +4 -4
  64. package/dist/chunks/{okr-OZUMTMCL.js → okr-QC52G6AJ.js} +15 -5
  65. package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
  66. package/dist/chunks/{operations-UTUWFJTX.js → operations-MQV32ITT.js} +5 -5
  67. package/dist/chunks/{performance-SMVTPK6T.js → performance-3MQ3AHDQ.js} +92 -7
  68. package/dist/chunks/{plan-C2NENH42.js → plan-ISINIEPY.js} +15 -5
  69. package/dist/chunks/{project-FAJ2P3UR.js → project-IJ6DVKT7.js} +18 -5
  70. package/dist/chunks/{reception-NH6MJFPR.js → reception-3H5LUG2I.js} +17 -7
  71. package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-MIOJXP6W.js} +412 -85
  72. package/dist/chunks/{registry-ZQ7OONCB.js → registry-3GQRYP2R.js} +12 -12
  73. package/dist/chunks/{registry-3B3OAJYX.js → registry-3S7AVMXR.js} +4 -4
  74. package/dist/chunks/{registry-FTPUUHWC.js → registry-NHHKOEU3.js} +5 -5
  75. package/dist/chunks/{room-recommend-73NBN3RU.js → room-recommend-IOKBJVYP.js} +4 -4
  76. package/dist/chunks/{schedule-SDBOBBUQ.js → schedule-IB6EUARH.js} +4 -4
  77. package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-N2TK3CEF.js} +19 -6
  78. package/dist/chunks/{workflow-OWHWLAOX.js → workflow-RINBAL2M.js} +22 -8
  79. package/dist/cmd/auth/index.js +23 -0
  80. package/dist/cmd/e10/index.js +2 -1
  81. package/dist/cmd/index.js +2 -0
  82. package/dist/core/manifest-view.js +207 -0
  83. package/dist/core/output.js +38 -8
  84. package/dist/index.js +35 -35
  85. package/dist/internal/e10/auth/crypto.js +18 -8
  86. package/dist/internal/e10/auth/error-log.js +1 -2
  87. package/dist/internal/e10/auth/messages.js +2 -3
  88. package/dist/internal/e10/auth/xiaoe.js +1 -1
  89. package/dist/internal/e10/tls-policy.js +61 -13
  90. package/dist/shortcuts/archive/index.js +11 -2
  91. package/dist/shortcuts/archive/operations/download.js +1 -0
  92. package/dist/shortcuts/archive/operations/flow-url.js +3 -0
  93. package/dist/shortcuts/archive/operations/prelib.js +2 -0
  94. package/dist/shortcuts/archive/operations/upload.js +1 -0
  95. package/dist/shortcuts/archive-oa/index.js +11 -2
  96. package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
  97. package/dist/shortcuts/asset/index.js +11 -2
  98. package/dist/shortcuts/asset/manifest.js +7 -0
  99. package/dist/shortcuts/asset-idle/index.js +11 -2
  100. package/dist/shortcuts/blog/index.js +11 -2
  101. package/dist/shortcuts/blog/manifest.js +10 -0
  102. package/dist/shortcuts/caizhilian/host.js +20 -4
  103. package/dist/shortcuts/caizhilian/index.js +12 -2
  104. package/dist/shortcuts/caizhilian/manifest.js +4 -25
  105. package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
  106. package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
  107. package/dist/shortcuts/calendar/index.js +11 -2
  108. package/dist/shortcuts/contract/index.js +11 -2
  109. package/dist/shortcuts/contract/manifest.js +32 -0
  110. package/dist/shortcuts/contract/operations/write.js +3 -0
  111. package/dist/shortcuts/cowork/index.js +21 -5
  112. package/dist/shortcuts/cowork/manifest.js +3 -0
  113. package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
  114. package/dist/shortcuts/cowork/operations/item-write.js +3 -0
  115. package/dist/shortcuts/cowork/operations/member-write.js +2 -0
  116. package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
  117. package/dist/shortcuts/cowork/operations/review-write.js +1 -0
  118. package/dist/shortcuts/data/errors.js +16 -29
  119. package/dist/shortcuts/data/host.js +16 -7
  120. package/dist/shortcuts/data/index.js +12 -41
  121. package/dist/shortcuts/data/manifest.js +5 -44
  122. package/dist/shortcuts/data/operations/attend.js +2 -2
  123. package/dist/shortcuts/data/operations/conf.js +0 -88
  124. package/dist/shortcuts/data/operations/ds.js +4 -4
  125. package/dist/shortcuts/data/operations/index.js +1 -5
  126. package/dist/shortcuts/data/operations/module.js +40 -14
  127. package/dist/shortcuts/data/operations/query.js +2 -2
  128. package/dist/shortcuts/ebuilder-form/index.js +11 -2
  129. package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
  130. package/dist/shortcuts/ehr/index.js +11 -2
  131. package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
  132. package/dist/shortcuts/esb/index.js +11 -2
  133. package/dist/shortcuts/esb/manifest.js +2 -0
  134. package/dist/shortcuts/fna/index.js +11 -2
  135. package/dist/shortcuts/hrm/index.js +11 -1
  136. package/dist/shortcuts/im/index.js +11 -2
  137. package/dist/shortcuts/invoice/index.js +11 -2
  138. package/dist/shortcuts/invoice/manifest.js +8 -0
  139. package/dist/shortcuts/jiuchuanhui/index.js +15 -1
  140. package/dist/shortcuts/jiuchuanhui/manifest.js +2 -0
  141. package/dist/shortcuts/mail/errors.js +14 -0
  142. package/dist/shortcuts/mail/index.js +23 -6
  143. package/dist/shortcuts/mail/manifest.js +11 -4
  144. package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
  145. package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
  146. package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
  147. package/dist/shortcuts/mail/operations/mail-read.js +7 -25
  148. package/dist/shortcuts/mail/operations/mail-send.js +12 -12
  149. package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
  150. package/dist/shortcuts/mail/operations/mail-template.js +10 -10
  151. package/dist/shortcuts/meeting/index.js +11 -2
  152. package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
  153. package/dist/shortcuts/okr/index.js +11 -2
  154. package/dist/shortcuts/performance/index.js +62 -3
  155. package/dist/shortcuts/performance/scheme-validate.js +7 -0
  156. package/dist/shortcuts/performance/shared.js +40 -2
  157. package/dist/shortcuts/plan/index.js +11 -2
  158. package/dist/shortcuts/project/index.js +11 -2
  159. package/dist/shortcuts/project/operations/write.js +3 -0
  160. package/dist/shortcuts/reception/index.js +11 -2
  161. package/dist/shortcuts/reception/manifest.js +2 -2
  162. package/dist/shortcuts/reception/operations/ask.js +3 -0
  163. package/dist/shortcuts/recruit-stage/index.js +22 -3
  164. package/dist/shortcuts/recruit-stage/manifest.js +2 -0
  165. package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -16
  166. package/dist/shortcuts/recruit-stage/operations/profile.js +186 -0
  167. package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
  168. package/dist/shortcuts/recruit-stage/operations/resume-import.js +76 -47
  169. package/dist/shortcuts/recruit-stage/operations/search.js +151 -16
  170. package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
  171. package/dist/shortcuts/recruit-stage/shared.js +11 -1
  172. package/dist/shortcuts/smart-extract/index.js +11 -2
  173. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  174. package/dist/shortcuts/smart-extract/operations/save.js +2 -0
  175. package/dist/shortcuts/workflow/index.js +21 -1
  176. package/dist/shortcuts/workflow/operations/read.js +2 -2
  177. package/dist/shortcuts/workflow/operations/write.js +1 -1
  178. package/docs/caizhilian.md +1 -1
  179. package/docs/contract.md +1 -0
  180. package/docs/data.md +22 -22
  181. package/docs/e10-auth.md +41 -33
  182. package/docs/ehr.md +2 -0
  183. package/docs/reception.md +4 -3
  184. package/package.json +1 -1
  185. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  186. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  187. package/scripts/pysite/sitecustomize.py +41 -0
  188. package/skill-template/domains/data.md +4 -4
  189. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  190. package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
  191. package/skills/weaver-e10-cowork/SKILL.md +3 -1
  192. package/skills/weaver-e10-data/SKILL.md +12 -16
  193. package/skills/weaver-e10-data/references/config-center.md +6 -7
  194. package/skills/weaver-e10-data/references/datasource.md +1 -1
  195. package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
  196. package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -4
  197. package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
  198. package/skills/weaver-e10-jiuchuanhui/references/customer.md +18 -8
  199. package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
  200. package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
  201. package/skills/weaver-e10-mail/SKILL.md +4 -1
  202. package/skills/weaver-e10-mail/references/mail-read.md +4 -2
  203. package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
  204. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  205. package/skills/weaver-e10-performance/SKILL.md +8 -6
  206. package/skills/weaver-e10-recruit-stage/SKILL.md +125 -20
  207. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +359 -0
  208. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
  209. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +9 -2
  210. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +1 -0
  211. package/skills/weaver-e10-recruit-stage/templates/match-report.html +177 -0
  212. package/skills/weaver-e10-shared/SKILL.md +22 -1
  213. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
  214. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
@@ -1,6 +1,7 @@
1
1
  import { join } from 'node:path';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
3
  import { stateRoot } from '../../core/state.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
4
5
  import { DEFAULT_WORKFLOW, STATE_SUBDIR } from './constants.js';
5
6
  import { receptionValidationError } from './errors.js';
6
7
  import { createReceptionHost } from './host.js';
@@ -75,8 +76,16 @@ export const receptionShortcut = {
75
76
  .description('泛微客户参观接待流程:出面板 → 出两份产物并挂附件 → 输出填单页 browsertool');
76
77
  reception.command('schema')
77
78
  .description('输出 operation 合约(Agent 自查入口)')
78
- .action(action((ctx) => {
79
- ctx.output.write(receptionManifest, { json: true });
79
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
80
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
81
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
82
+ .action(action((ctx, options) => {
83
+ const schema = schemaOptionsOf(options);
84
+ ctx.output.write(manifestView(receptionManifest, schema), {
85
+ json: true,
86
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
87
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
88
+ });
80
89
  }));
81
90
  reception.command('run')
82
91
  .description('按 operation 名执行(reception.ask / reception.doc / reception.render)')
@@ -2,8 +2,8 @@ import { receptionOperationNames } from './operations/registry.js';
2
2
  export const receptionOperations = [
3
3
  {
4
4
  name: 'reception.ask',
5
- risk: 'read',
6
- summary: '按 7 项抽取结果出交互面板:客户需求(已明确则跳过)+ 接待细节(常驻)+ 是否会议(必问,原话明确提及会议室才跳过)。返回 runId 供 doc 使用。',
5
+ risk: 'read-with-side-effect',
6
+ summary: '按 7 项抽取结果出交互面板:客户需求(已明确则跳过)+ 接待细节(常驻)+ 是否会议(必问,原话明确提及会议室才跳过)。返回 runId 供 doc 使用;每次调用会在本地新建一份 run 记录(无服务端写入),不要当纯读取反复重试。',
7
7
  inputSchema: {
8
8
  type: 'object',
9
9
  additionalProperties: false,
@@ -64,6 +64,9 @@ export async function ask(input, ctx) {
64
64
  // 而 ask 只拿它填 empId(登录人兜底)和 base(拼 URL),这两件事 doc / render 阶段
65
65
  // 本来就绕不开会话,放在那里做即可。ask 保持纯本地,冷启动从 643ms 降到 340ms。
66
66
  data.empId = '';
67
+ // 注意:这里会落一份 run(stateDir/runs/<runId>.json),是 ask 唯一的副作用。
68
+ // 合约里因此标 read-with-side-effect,而不是 read —— 同一份输入重复调用会生成不同 runId,
69
+ // 调用方不能把它当成「随便重试的纯读取」。
67
70
  const runId = newRunId();
68
71
  saveRun(ctx.stateDir, {
69
72
  runId,
@@ -1,5 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
+ import { shouldReportPlatformError, toPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
3
5
  import { createRecruitStageContinuationSigner } from './continuation.js';
4
6
  import { createRecruitStageHost } from './host.js';
5
7
  import { recruitStageManifest } from './manifest.js';
@@ -88,7 +90,16 @@ async function executeAndPrint(ctx, operation, input) {
88
90
  ctx.output.write(successEnvelope(operation, result), { json: true });
89
91
  }
90
92
  catch (error) {
91
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
93
+ // stderr 只写一个 JSON 对象:顶层带平台码(E-XXXX),整段 stderr 可被一次 JSON.parse。
94
+ // 此前只打富信封、没有任何平台码,宿主侧拿不到 E-XXXX(审计 RE-02 / G-06)。
95
+ const env = failureEnvelope(error);
96
+ if (shouldReportPlatformError(error)) {
97
+ const pe = toPlatformError(error);
98
+ console.error(JSON.stringify({ ...env, code: pe.code, message: pe.message }, null, 2));
99
+ }
100
+ else {
101
+ console.error(JSON.stringify(env, null, 2));
102
+ }
92
103
  process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
93
104
  }
94
105
  }
@@ -100,8 +111,16 @@ export const recruitStageShortcut = {
100
111
  const rs = program.command('recruit-stage').description('泛微E10招聘助手(招聘启事生成/简历解析建档/AI面试邀约与反馈)');
101
112
  rs.command('schema')
102
113
  .description('Print recruit-stage operation manifest for agents')
103
- .action(action((ctx) => {
104
- ctx.output.write(recruitStageManifest, { json: true });
114
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
115
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
116
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
117
+ .action(action((ctx, options) => {
118
+ const schema = schemaOptionsOf(options);
119
+ ctx.output.write(manifestView(recruitStageManifest, schema), {
120
+ json: true,
121
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
122
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
123
+ });
105
124
  }));
106
125
  rs.command('run')
107
126
  .description('Run a recruit-stage operation with JSON input')
@@ -25,5 +25,7 @@ export const recruitStageManifest = {
25
25
  sourceSkill: 'weaver-e10-recruit-stage',
26
26
  capabilities: ['recruit.jd.create', 'recruit.resume.import', 'recruit.interview.arrange', 'recruit.interview.feedback', 'recruit.list', 'recruit.candidate.search', 'recruit.tag'],
27
27
  operations: buildOperations(),
28
+ // 招聘域当前没有 withheld 能力,显式给 0,便于模型按统一字段判断边界(2026-11-27 审计 G-10)。
29
+ withheldCount: 0,
28
30
  withheldOperations: [],
29
31
  };
@@ -481,10 +481,13 @@ async function buildJd(opts) {
481
481
  if (!fid(k))
482
482
  throw rsFail('职位管理缺少字段 ' + k + '(ds/fields 解析不到)');
483
483
  // 并行预取:refByFid(sets 解析依赖它)与 currentUser(仅第⑤步用,与 sets 无依赖)
484
- // 同时发出,避免过去「先等 refByFid → 再逐 set 串行 → 最后才取 currentUser」的多余 RTT。
484
+ // 🔴 2026-11-27 优化:当 sets 已覆盖全部 DEF_FROM_REF 字段时跳过 fetchRefByFid(省 2 HTTP)。
485
+ // dict 解析回退到无 group 搜索(dictIdByName(cache, value, '')),自用环境字典无歧义,结果一致。
486
+ const setsKeys = new Set(sets.map(([k]) => k));
487
+ const needsRefByFid = !DEF_FROM_REF.every(k => setsKeys.has(k));
485
488
  const currentUserPromise = resolveCurrentUser(host)
486
489
  .catch(() => null);
487
- const refByFid = await fetchRefByFid(ctx);
490
+ const refByFid = needsRefByFid ? await fetchRefByFid(ctx) : {};
488
491
  const map = new Map();
489
492
  const put = (d) => { if (d && d.formField && d.formField.id)
490
493
  map.set(String(d.formField.id), d); };
@@ -690,15 +693,19 @@ async function prepare(args, env) {
690
693
  const fp = fingerprint(willSubmit);
691
694
  const continuation = await env.continuation.issue({ operation: 'recruit-stage.jd.create.apply', fingerprint: fp,
692
695
  enumMaps: await dsOptionsSnapshot(),
693
- // 🔴 2026-11-07 修复:协议文档写「apply 带 confirm + continuation」,但 apply 原来只从 args 取
694
- // positionName/positionDuty/...,Agent 少传 positionName 就直接报 position_name_required。
695
- // 现把 prepare 用过的业务参数一并签进 continuation;apply 显式传的仍优先。
696
+ // 🔴 2026-11-27 优化:签入 willSubmit(已解析的完整提交数据)和 summary,
697
+ // apply 有 willSubmit 时直接用,跳过 buildJd(省 ~10 个 HTTP 请求,5-8 秒)。
698
+ willSubmit,
699
+ summary: jd.summary,
700
+ // 🔴 2026-11-27 修复:argsSnapshot 漏签了 sets,apply 不传 sets 时 buildJd 产出空 sets
701
+ // → 指纹不一致 → fingerprint_mismatch。现在补上。
696
702
  argsSnapshot: {
697
703
  positionName: String(args.positionName || ''),
698
704
  positionDuty: args.positionDuty ? String(args.positionDuty) : undefined,
699
705
  workRequest: args.workRequest ? String(args.workRequest) : undefined,
700
706
  demandId: args.demandId ? String(args.demandId) : undefined,
701
707
  demandName: args.demandName ? String(args.demandName) : undefined,
708
+ sets: args.sets,
702
709
  } });
703
710
  // 回执体积控制:continuation 与 fingerprint 放在返回体最前,避免大输出被截断时 Agent 取不到它们
704
711
  // 而重复调用 prepare(实测多花 10.7s)。
@@ -810,17 +817,27 @@ async function apply(args, env) {
810
817
  const positionName = String(merged.positionName || '').trim();
811
818
  if (!positionName)
812
819
  throw rsValidationError('position_name_required', 'positionName 必填');
813
- const jd = await buildJd({
814
- ctx, positionName,
815
- duty: merged.positionDuty ? String(merged.positionDuty) : undefined,
816
- requestText: merged.workRequest ? String(merged.workRequest) : undefined,
817
- demandId: merged.demandId ? String(merged.demandId) : undefined,
818
- demandName: merged.demandName ? String(merged.demandName) : undefined,
819
- sets: setsOf(merged),
820
- });
821
- const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
822
- if (payload.fingerprint !== fingerprint(willSubmit)) {
823
- throw rsValidationError('fingerprint_mismatch', '待提交内容与 prepare 确认摘要不一致(字段值已变化),请重新 prepare 确认后再 apply');
820
+ // 🔴 2026-11-27 优化:prepare 签入了 willSubmit(已解析的完整 dataDetails),
821
+ // apply 直接用,跳过 buildJd(省 ~10 个 HTTP 请求,5-8 秒)。
822
+ // 旧 continuation(无 willSubmit)走原逻辑:buildJd + 指纹比对(argsSnapshot 已补 sets,不会再 mismatch)。
823
+ let jd;
824
+ if (payload.willSubmit) {
825
+ const ws = payload.willSubmit;
826
+ jd = { objId: ws.objId, formId: ws.formId, appId: ctx.appId, dataDetails: ws.dataDetails, summary: payload.summary || {} };
827
+ }
828
+ else {
829
+ jd = await buildJd({
830
+ ctx, positionName,
831
+ duty: merged.positionDuty ? String(merged.positionDuty) : undefined,
832
+ requestText: merged.workRequest ? String(merged.workRequest) : undefined,
833
+ demandId: merged.demandId ? String(merged.demandId) : undefined,
834
+ demandName: merged.demandName ? String(merged.demandName) : undefined,
835
+ sets: setsOf(merged),
836
+ });
837
+ const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
838
+ if (payload.fingerprint !== fingerprint(willSubmit)) {
839
+ throw rsValidationError('fingerprint_mismatch', '待提交内容与 prepare 确认摘要不一致(字段值已变化),请重新 prepare 确认后再 apply');
840
+ }
824
841
  }
825
842
  // ① 保存职位管理表单 → ② addPosition 提交生成职位
826
843
  const formDataId = await saveFormData(host, {
@@ -0,0 +1,186 @@
1
+ import { rsSuccess, schemaOf } from './types.js';
2
+ import { rsFail } from '../errors.js';
3
+ import { objIdOf, formIdOf, getFormDataRecord, getFormLayoutMeta } from '../shared.js';
4
+ function makeDictLookup(cache) {
5
+ const byId = new Map();
6
+ for (const x of cache.dict?.raw || []) {
7
+ if (x.option_id && x.selection_name)
8
+ byId.set(String(x.option_id), x.selection_name);
9
+ }
10
+ return (id) => byId.get(String(id)) || '';
11
+ }
12
+ /** 从 dataDetails 提取展示值:dataOptions.content > dataText.content > content */
13
+ function detailDisplayValue(d, dictName) {
14
+ if (!d)
15
+ return '';
16
+ // 关联/选择字段:dataOptions[0].content 是展示名
17
+ if (Array.isArray(d.dataOptions) && d.dataOptions.length) {
18
+ const o = d.dataOptions[0];
19
+ return String(o?.content ?? o?.optionId ?? '');
20
+ }
21
+ // 长文本
22
+ if (d.dataText?.content != null)
23
+ return String(d.dataText.content);
24
+ // 单行文本/数字
25
+ if (d.content != null) {
26
+ // 字典类字段:content 存的是 optionId,翻译成名称
27
+ const s = String(d.content);
28
+ const dn = dictName(s);
29
+ return dn || s;
30
+ }
31
+ return '';
32
+ }
33
+ async function handlerProfile(args, env) {
34
+ const host = env.host;
35
+ const session = await host.getSession();
36
+ const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
37
+ ctx.appId = ctx.cache.appId;
38
+ const talentId = String(args.talentId || '').trim();
39
+ if (!talentId)
40
+ throw rsFail('talentId 必填');
41
+ const objId = objIdOf(ctx.cache, 'talent_pool');
42
+ const formId = formIdOf(ctx.cache, 'talent_pool');
43
+ const fields = ctx.cache.fields[objId] || {};
44
+ // 反向字段映射:fieldId → dataKey
45
+ const revFields = {};
46
+ for (const [dk, fid] of Object.entries(fields))
47
+ revFields[String(fid)] = dk;
48
+ // 拉取完整记录(含明细表行)
49
+ const rec = await getFormDataRecord(host, formId, talentId, objId);
50
+ const dets = rec.dataDetails || [];
51
+ if (!dets.length)
52
+ throw rsFail('未找到人才记录(talentId=' + talentId + '),可能已删除或不存在');
53
+ const dictName = makeDictLookup(ctx.cache);
54
+ // 获取明细表元数据(subFormId → dataKey 映射)
55
+ const layoutMeta = await getFormLayoutMeta(host, formId);
56
+ const comps = layoutMeta?.formLayout?.pageLayouts?.[0]?.comps || [];
57
+ const subFormToDataKey = {};
58
+ for (const c of comps) {
59
+ const cfg = c.config || {};
60
+ if (c.type === 'DetailTable' && cfg.subFormId && cfg.dataKey) {
61
+ subFormToDataKey[String(cfg.subFormId)] = String(cfg.dataKey);
62
+ }
63
+ // 明细表列的字段映射
64
+ if (cfg.subFormId && cfg.fieldId && cfg.dataKey) {
65
+ revFields[String(cfg.fieldId)] = String(cfg.dataKey);
66
+ }
67
+ // 🔴 日期区间(DateRange/DateInterval):一个组件含 start/end 两个物理子字段,
68
+ // 各有独立 fieldId 与 dataKey,但组件本身没有 cfg.dataKey → 不单独处理会输出裸 fieldId
69
+ // (实测:教育经历返回 "840810461896392709":"2021-09-01",无法判断是入学还是毕业)。
70
+ if (cfg.subFormId && cfg.start && cfg.end) {
71
+ if (cfg.start.fieldId && cfg.start.dataKey)
72
+ revFields[String(cfg.start.fieldId)] = String(cfg.start.dataKey);
73
+ if (cfg.end.fieldId && cfg.end.dataKey)
74
+ revFields[String(cfg.end.fieldId)] = String(cfg.end.dataKey);
75
+ }
76
+ }
77
+ // 主表字段 + 明细表行分组
78
+ const main = {};
79
+ // 按 subFormId + dataIndex 分组明细行
80
+ const rowMap = {};
81
+ for (const d of dets) {
82
+ const fid = String(d.fieldId || d.formField?.id || '');
83
+ const dk = revFields[fid] || fid;
84
+ const val = detailDisplayValue(d, dictName);
85
+ if (d.subFormId) {
86
+ const sid = String(d.subFormId);
87
+ const didx = String(d.dataIndex ?? '0');
88
+ if (!rowMap[sid])
89
+ rowMap[sid] = new Map();
90
+ if (!rowMap[sid].has(didx))
91
+ rowMap[sid].set(didx, {});
92
+ if (val)
93
+ rowMap[sid].get(didx)[dk] = val;
94
+ }
95
+ else {
96
+ if (val)
97
+ main[dk] = val;
98
+ }
99
+ }
100
+ // 转换明细表为数组
101
+ // 🔴 subFormToDataKey 解析不到时(表单布局变更 / 明细表被隐藏 / 布局接口失败),
102
+ // dk 会退化成裸 subFormId,于是 subTables.rcrt_work_exp 取不到 →
103
+ // workExperience 静默返回空数组,调用方会误判「这个人没有工作经历」。
104
+ // 因此未归类的明细单独暴露在 unclassifiedDetails 并给 warning,绝不静默丢弃。
105
+ const subTables = {};
106
+ const subTableStats = {};
107
+ const unclassified = {};
108
+ for (const [sid, rows] of Object.entries(rowMap)) {
109
+ const arr = [...rows.values()].filter((r) => Object.keys(r).length > 0);
110
+ if (!arr.length)
111
+ continue;
112
+ const dk = subFormToDataKey[sid];
113
+ if (dk) {
114
+ subTables[dk] = arr;
115
+ subTableStats[dk] = arr.length;
116
+ }
117
+ else {
118
+ unclassified[sid] = arr;
119
+ }
120
+ }
121
+ const warnings = [];
122
+ const unclassifiedTotal = Object.values(unclassified).reduce((n, r) => n + r.length, 0);
123
+ if (unclassifiedTotal) {
124
+ warnings.push(`有 ${unclassifiedTotal} 行明细未能归类到已知明细表(表单布局未解析到对应 DetailTable 配置),已放在 unclassifiedDetails;不要据此判定「该候选人没有这些经历」`);
125
+ }
126
+ if (!layoutMeta) {
127
+ warnings.push('表单布局接口未返回数据,明细表列名可能显示为裸字段 id');
128
+ }
129
+ // 构建可读的档案结构
130
+ const profile = {
131
+ talentId,
132
+ basic: {
133
+ name: main.candidate_name || '',
134
+ mobile: main.telephone || '',
135
+ email: main.email || '',
136
+ gender: main.gender || '',
137
+ age: main.age || '',
138
+ birthday: main.birthday || '',
139
+ degree: main.highest_degree || '',
140
+ college: main.college || '',
141
+ joinworkdate: main.joinworkdate || '',
142
+ graduate_date: main.graduate_date || '',
143
+ intend_position: main.intend_position || '',
144
+ intended_workplace: main.intended_workplace || '',
145
+ // 🔴 实测(2026-11-27 自用环境):BOSS直聘等渠道导入的人才,现职/现公司在
146
+ // last_position_id / last_company_id,而 current_position / current_industry 为空
147
+ // (后者只在 OCR 解析出 jobInformations[0] 时才写)。不回退会让基本信息大面积空白,
148
+ // 匹配度评估拿不到关键依据。
149
+ current_position: main.current_position || main.last_position_id || '',
150
+ current_industry: main.current_industry || main.last_company_id || '',
151
+ expect_salary: main.expect_salary || '',
152
+ location_area: main.location_area || '',
153
+ recruit_status: main.recruit_status || '',
154
+ self_desc: main.self_desc || '',
155
+ work_ability: main.work_ability || '',
156
+ channel: main.channel || '',
157
+ },
158
+ education: subTables.rcrt_education_exp || [],
159
+ workExperience: subTables.rcrt_work_exp || [],
160
+ internship: subTables.rcrt_sxjl || [],
161
+ projectExperience: subTables.rcrt_project_exp || [],
162
+ awards: subTables.rcrt_award_exp || [],
163
+ languages: subTables.rcrt_language_skill || [],
164
+ subTableStats,
165
+ // 🔴 未归类明细与告警必须显式暴露:静默返回空数组会让调用方误判「没有这段经历」
166
+ ...(unclassifiedTotal ? { unclassifiedDetails: unclassified } : {}),
167
+ ...(warnings.length ? { warnings } : {}),
168
+ rawMain: main, // 完整主表字段(含可能新增的字段)
169
+ };
170
+ return rsSuccess('recruit-stage.candidate.profile', profile);
171
+ }
172
+ export const profileOperations = [
173
+ {
174
+ name: 'recruit-stage.candidate.profile',
175
+ resource: 'recruit.candidate',
176
+ method: 'query',
177
+ action: 'candidate.profile',
178
+ summary: '按 talentId 拉取人才完整档案:基本信息(主表全部字段)+ 教育经历 + 工作经历 + 项目经历等明细表。用于匹配度评估、候选人分析',
179
+ capability: 'recruit.candidate.profile',
180
+ risk: 'read',
181
+ inputSchema: schemaOf({
182
+ talentId: { type: 'string', description: '人才记录 id(来自 candidate.search 或 resume.import.apply 的 talentId)' },
183
+ }, { required: ['talentId'] }),
184
+ handler: handlerProfile,
185
+ },
186
+ ];
@@ -6,8 +6,10 @@ import { interviewFeedbackOperations } from './interview-feedback.js';
6
6
  import { listOperations } from './list.js';
7
7
  import { searchOperations } from './search.js';
8
8
  import { tagOperations } from './tag.js';
9
+ import { profileOperations } from './profile.js';
9
10
  const definitions = [
10
11
  ...searchOperations,
12
+ ...profileOperations,
11
13
  ...listOperations,
12
14
  ...tagOperations,
13
15
  ...jdCreateOperations,
@@ -23,7 +23,7 @@ import schoolTiers from '../school-tiers.json';
23
23
  import { rsSuccess, schemaOf } from './types.js';
24
24
  import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
25
25
  import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
26
- import { resolveTags, addEntityTags, queryEntityTags } from '../tag-lookup.js';
26
+ import { addEntityTags, queryEntityTags } from '../tag-lookup.js';
27
27
  import { scanResumeSource } from '../fs-scan.js';
28
28
  import { saveBatchItems, loadBatchItems, saveOcrResult, loadOcrResult } from '../batch-store.js';
29
29
  // 阶段耗时打点(诊断用,不影响业务):E10_TRACE_MS=1 时把每段耗时打到 stderr
@@ -124,6 +124,31 @@ function snapshotParsedResume(s) {
124
124
  return undefined;
125
125
  }
126
126
  }
127
+ /**
128
+ * 🔴 built 签入 continuation 的大小闸门(2026-11-27 加固)。
129
+ * built 含 dataDetails / detailsPayload / fields / subMeta,明细行多时体积可观。
130
+ * continuation 最终可能走命令行参数(直调 CLI 的 `--input-json` 内联形态),
131
+ * Windows cmd 单命令上限 8191 字符,超限会被**静默截断** → apply 报 continuation_invalid,
132
+ * 且现象与「PowerShell 损坏 token」完全一样,极难排查。
133
+ * 走 helper 脚本(文件传参)没有这个限制,但不能假设调用方一定用 helper。
134
+ * 因此超过阈值就不签入:apply 自动回退到 buildImport(多花几个请求,但保证可用)。
135
+ * structured 已在 parsedResume 里单独签入,这里排除以免重复占体积。
136
+ */
137
+ const BUILT_SNAPSHOT_LIMIT = 48 * 1024;
138
+ function snapshotBuilt(built) {
139
+ if (!built || typeof built !== 'object')
140
+ return undefined;
141
+ try {
142
+ const { structured: _omit, ...rest } = built;
143
+ const raw = JSON.stringify(rest);
144
+ if (raw.length > BUILT_SNAPSHOT_LIMIT)
145
+ return undefined;
146
+ return rest;
147
+ }
148
+ catch {
149
+ return undefined;
150
+ }
151
+ }
127
152
  // 闸门:简历抽取功能是否开启(幂等只读;与上传并发发起,先落闸门再解析)
128
153
  async function checkExtractionGate(host) {
129
154
  const b = await host.request({ path: '/api/recruit/ocr/checkResumeExtraction', method: 'POST', body: {} });
@@ -850,6 +875,9 @@ async function prepare(args, env, opts = {}) {
850
875
  const fp = fingerprint(willSubmit);
851
876
  const continuation = await env.continuation.issue({ operation: 'recruit-stage.resume.import.apply', fingerprint: fp,
852
877
  enumMaps: await dsOptionsSnapshot(),
878
+ // 🔴 2026-11-27 优化:签入已解析的 built(不含 structured,已在 parsedResume 里),
879
+ // apply 直接复用,跳过 buildImport(省 ~6 HTTP)和 findExistingTalents(省 2 HTTP)。
880
+ built: snapshotBuilt(built),
853
881
  // 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
854
882
  // confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
855
883
  // 否则会报 resume_source_required(文档写法跑不通)。
@@ -889,25 +917,14 @@ async function prepare(args, env, opts = {}) {
889
917
  },
890
918
  }, { continuation, fingerprint: fp, confirmHint: '用户明确确认后,携带 confirm:true 与 continuation 调用 apply' });
891
919
  }
892
- // 查重与标签预检互不依赖 → 并行(标签清单分页通常多 RTT,与查重力求重叠)。
893
- // tagCheckTask 内部自带 try/catch,永不 reject,避免查重先抛错时产生 unhandledRejection。
894
- const tagCheckTask = (async () => {
895
- if (!built.tagNames.length)
896
- return null;
897
- try {
898
- const rt = await resolveTags(ctx.host, built.tagNames);
899
- return { requested: built.tagNames, found: rt.found, missing: rt.missing, ...(typeof rt.availableCount === 'number' ? { availableCount: rt.availableCount } : {}) };
900
- }
901
- catch (e) {
902
- return { requested: built.tagNames, error: e.message };
903
- }
904
- })();
905
- mark('prepare.查重建档并行前');
906
- const [dupInfo, tagCheck] = await Promise.all([
907
- findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone }),
908
- tagCheckTask,
909
- ]);
910
- mark('prepare.查重+标签预检');
920
+ // 🔴 2026-11-27 优化:跳过标签预检(省 2-5 HTTP)。
921
+ // 标签在 apply 时由 addEntityTags 自动解析并写入,prepare 预检只给确认摘要显示 found/missing,
922
+ // 不影响功能正确性。学校标签由 schoolTagInfo 本地推导,不需要 HTTP。
923
+ const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
924
+ const tagCheck = built.tagNames.length
925
+ ? { requested: built.tagNames, note: '标签将在提交时自动解析并写入' }
926
+ : null;
927
+ mark('prepare.查重完成');
911
928
  const summary = {
912
929
  action: '简历导入建人才',
913
930
  resumeFile: built.fileName || ('fileid=' + built.fileid),
@@ -1015,8 +1032,17 @@ async function applyCore(args, env, payload) {
1015
1032
  ctx.appId = ctx.cache.appId;
1016
1033
  mark('apply.context');
1017
1034
  const argsT = args;
1018
- const built = await buildImport(ctx, argsT);
1019
- mark('apply.buildImport 完成');
1035
+ // 🔴 2026-11-27 优化:prepare 签入了已解析的 built,apply 直接复用,
1036
+ // 跳过 buildImport(省 ~6 HTTP)和 findExistingTalents(省 2 HTTP,prepare 已查重)
1037
+ let built;
1038
+ if (payload.built && (argsT.parsedResume || payload.built.structured)) {
1039
+ built = { ...payload.built, structured: argsT.parsedResume || payload.built.structured };
1040
+ mark('apply.复用prepare的built(跳过buildImport+查重)');
1041
+ }
1042
+ else {
1043
+ built = await buildImport(ctx, argsT);
1044
+ mark('apply.buildImport 完成');
1045
+ }
1020
1046
  // 更新模式
1021
1047
  if (argsT.updateTalentId) {
1022
1048
  const updateTalentId = String(argsT.updateTalentId);
@@ -1073,31 +1099,34 @@ async function applyCore(args, env, payload) {
1073
1099
  });
1074
1100
  }
1075
1101
  // 新建模式:查重阻断
1076
- const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
1077
- if (dupInfo.byPhone?.candidateId || dupInfo.byPhone?.talentId) {
1078
- const b = dupInfo.byPhone;
1079
- return rsSuccess('recruit-stage.resume.import.apply', {
1080
- mode: 'apply', result: 'duplicate',
1081
- message: '当前手机号已绑定人才信息,按页面规则不新建(未写入任何数据)',
1082
- existingTalent: { talentId: b.talentId, candidateId: b.candidateId, talentViewUrl: b.talentViewUrl, talentCardUrl: b.talentCardUrl },
1083
- talentViewUrl: b.talentViewUrl,
1084
- otherRecords: dupInfo.formConflicts.existing.length ? dupInfo.formConflicts.existing : undefined,
1085
- parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
1086
- nextStep: '如需按这份简历更新该人才,明确说明即可(updateTalentId 走更新通道)',
1087
- });
1088
- }
1089
- if (dupInfo.formConflicts.existing.length) {
1090
- return rsSuccess('recruit-stage.resume.import.apply', {
1091
- mode: 'apply', result: 'duplicate',
1092
- message: '手机号在人才库已存在(表单唯一性命中,但无应聘批次),不新建(未写入任何数据)',
1093
- formConflicts: dupInfo.formConflicts.existing,
1094
- parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
1095
- nextStep: '如需按这份简历更新该人才,明确说明即可(updateTalentId 走更新通道)',
1096
- });
1097
- }
1098
- if (!dupInfo.unique && dupInfo.formConflicts.unreadable.length) {
1099
- throw rsFail('手机号被 ' + dupInfo.formConflicts.unreadable.length + ' 条已删除记录占用(平台唯一性校验仍拦新建,id=' + dupInfo.formConflicts.unreadable.join(',') + '):请先在回收站清理,或改为更新已有人才');
1100
- }
1102
+ // 🔴 2026-11-27 优化:prepare 已查重且 unique=true,payload.built 存在时跳过重复查重(省 2 HTTP)
1103
+ if (!payload.built) {
1104
+ const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
1105
+ if (dupInfo.byPhone?.candidateId || dupInfo.byPhone?.talentId) {
1106
+ const b = dupInfo.byPhone;
1107
+ return rsSuccess('recruit-stage.resume.import.apply', {
1108
+ mode: 'apply', result: 'duplicate',
1109
+ message: '当前手机号已绑定人才信息,按页面规则不新建(未写入任何数据)',
1110
+ existingTalent: { talentId: b.talentId, candidateId: b.candidateId, talentViewUrl: b.talentViewUrl, talentCardUrl: b.talentCardUrl },
1111
+ talentViewUrl: b.talentViewUrl,
1112
+ otherRecords: dupInfo.formConflicts.existing.length ? dupInfo.formConflicts.existing : undefined,
1113
+ parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
1114
+ nextStep: '如需按这份简历更新该人才,明确说明即可(updateTalentId 走更新通道)',
1115
+ });
1116
+ }
1117
+ if (dupInfo.formConflicts.existing.length) {
1118
+ return rsSuccess('recruit-stage.resume.import.apply', {
1119
+ mode: 'apply', result: 'duplicate',
1120
+ message: '手机号在人才库已存在(表单唯一性命中,但无应聘批次),不新建(未写入任何数据)',
1121
+ formConflicts: dupInfo.formConflicts.existing,
1122
+ parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
1123
+ nextStep: '如需按这份简历更新该人才,明确说明即可(updateTalentId 走更新通道)',
1124
+ });
1125
+ }
1126
+ if (!dupInfo.unique && dupInfo.formConflicts.unreadable.length) {
1127
+ throw rsFail('手机号被 ' + dupInfo.formConflicts.unreadable.length + ' 条已删除记录占用(平台唯一性校验仍拦新建,id=' + dupInfo.formConflicts.unreadable.join(',') + '):请先在回收站清理,或改为更新已有人才');
1128
+ }
1129
+ } // end if (!payload.built) — 跳过查重
1101
1130
  // 建人才:① 首选数据集通道(主表+明细一次写入);② 被拦时回退页面级主表 + 数据集 update 补明细
1102
1131
  mark('apply.查重完成');
1103
1132
  const datasetMain = toDatasetMainTable(built.dataDetails, built.fields);