weaver-work-cli 0.1.71 → 0.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/chunks/{archive-5P33NAUN.js → archive-THZV4ND4.js} +2 -2
  2. package/dist/chunks/{archive-oa-YTY5D7DG.js → archive-oa-PQ23OLEV.js} +2 -2
  3. package/dist/chunks/{asset-3Q5MFQBX.js → asset-RGPROZYH.js} +2 -2
  4. package/dist/chunks/{asset-idle-PQPNYIS7.js → asset-idle-Z2PDX7NA.js} +2 -2
  5. package/dist/chunks/{attachment-content-7CN7JB6B.js → attachment-content-R3RPVOYE.js} +3 -3
  6. package/dist/chunks/{blog-MFHHK6ZR.js → blog-7U3QZPIF.js} +2 -2
  7. package/dist/chunks/{caizhilian-OZ435AYW.js → caizhilian-3AB42GCV.js} +4 -4
  8. package/dist/chunks/{calendar-TNJXS5UC.js → calendar-KINM64E4.js} +2 -2
  9. package/dist/chunks/{chunk-VMVMEIL3.js → chunk-2CHGUYMG.js} +4 -4
  10. package/dist/chunks/{chunk-G7ZM2VOX.js → chunk-2XED2FKY.js} +34 -34
  11. package/dist/chunks/{chunk-SKWKCLJX.js → chunk-4BXR6CNB.js} +2 -2
  12. package/dist/chunks/{chunk-EJLP63UO.js → chunk-4I26YMBY.js} +1 -1
  13. package/dist/chunks/{chunk-OFCF23FY.js → chunk-4YXAK6OA.js} +15 -4
  14. package/dist/chunks/{chunk-6MMSLE6K.js → chunk-54ST55IJ.js} +5 -1
  15. package/dist/chunks/{chunk-SSS75WXW.js → chunk-6HT73VOI.js} +2 -2
  16. package/dist/chunks/{chunk-XLSJC6JZ.js → chunk-7QFVXP2X.js} +6 -6
  17. package/dist/chunks/{chunk-SUWR5QEG.js → chunk-AMAPQVBT.js} +1 -0
  18. package/dist/chunks/{chunk-ICNUOWLL.js → chunk-BWYVS62Z.js} +4 -4
  19. package/dist/chunks/{chunk-UPVAQJKS.js → chunk-DRUND2PJ.js} +130 -79
  20. package/dist/chunks/{chunk-Q3EXRNB4.js → chunk-F4HM25K4.js} +1 -1
  21. package/dist/chunks/{chunk-P3AFNAJ6.js → chunk-GAMGDNTF.js} +1 -1
  22. package/dist/chunks/{chunk-2DNCKZRX.js → chunk-GWJLAF6B.js} +2 -2
  23. package/dist/chunks/{chunk-VJWVB55R.js → chunk-IBSJJGXL.js} +2 -2
  24. package/dist/chunks/{chunk-MZVQKQP5.js → chunk-ICP53R52.js} +4 -4
  25. package/dist/chunks/{chunk-DRJYPXKC.js → chunk-IU6UB2TD.js} +1 -1
  26. package/dist/chunks/{chunk-OZ7CJC7W.js → chunk-JMJBPP4B.js} +2 -2
  27. package/dist/chunks/{chunk-B4NINGP2.js → chunk-L7TYG5SN.js} +2 -2
  28. package/dist/chunks/{chunk-FRMDHZSN.js → chunk-LLCMOZ5L.js} +11 -11
  29. package/dist/chunks/{chunk-YN5SD4TX.js → chunk-NUP4RYZK.js} +2 -2
  30. package/dist/chunks/{chunk-OPTJ6IF7.js → chunk-PAFOLIYQ.js} +1 -1
  31. package/dist/chunks/{chunk-GB2MCJPG.js → chunk-R3MK2RBN.js} +1 -1
  32. package/dist/chunks/{chunk-X2C5CGGM.js → chunk-TV46Q4NY.js} +50 -50
  33. package/dist/chunks/{chunk-LU2SPJYY.js → chunk-XZBYRYWX.js} +2 -2
  34. package/dist/chunks/{chunk-MD5RXRI3.js → chunk-ZWLWXHJC.js} +2 -2
  35. package/dist/chunks/{conflict-Y4PXZ2YQ.js → conflict-VPAR7E6F.js} +2 -2
  36. package/dist/chunks/{contract-C3BGUMBM.js → contract-DDXAO2DZ.js} +2 -2
  37. package/dist/chunks/{cowork-2AWG4QLA.js → cowork-34QCHMDD.js} +2 -2
  38. package/dist/chunks/{create-flow-LOUOK46Z.js → create-flow-52PU2OBI.js} +6 -6
  39. package/dist/chunks/{data-BSFYMXVO.js → data-CLQ62QGD.js} +2 -2
  40. package/dist/chunks/{ebuilder-form-LAAMTD2Y.js → ebuilder-form-W5R7Q22S.js} +3 -3
  41. package/dist/chunks/{ehr-36KEX5SH.js → ehr-LCNAVMK5.js} +7 -6
  42. package/dist/chunks/{entry-mode-6N2IGCS4.js → entry-mode-6Z3ZV3DE.js} +3 -3
  43. package/dist/chunks/{env-QYLS3EB3.js → env-RDKWAARB.js} +2 -2
  44. package/dist/chunks/{esb-PTYS3E67.js → esb-ANKPUU65.js} +4 -4
  45. package/dist/chunks/{factory-LPFPKZ4T.js → factory-434B7RAT.js} +1 -1
  46. package/dist/chunks/{fna-JNHCLRDE.js → fna-AKBSG5HI.js} +2 -2
  47. package/dist/chunks/{group-chat-QP2WX4QJ.js → group-chat-PROTW22R.js} +3 -3
  48. package/dist/chunks/{host-7BVR7CQ3.js → host-5R2SNFWD.js} +3 -3
  49. package/dist/chunks/{host-57LSRSE7.js → host-7FJW4E7R.js} +3 -3
  50. package/dist/chunks/{host-K2ZKNXME.js → host-CGXUFQO4.js} +3 -3
  51. package/dist/chunks/{host-NS36QFLR.js → host-PDJAKCT7.js} +3 -3
  52. package/dist/chunks/{host-C2BLBIID.js → host-WO4L5G5I.js} +3 -3
  53. package/dist/chunks/{host-QXFKQXNX.js → host-XIYG4F4B.js} +3 -3
  54. package/dist/chunks/{hrm-FSGO4NSH.js → hrm-WGODDTEH.js} +3 -3
  55. package/dist/chunks/{im-2BFGS2XO.js → im-YKTKAJU3.js} +3 -3
  56. package/dist/chunks/{invoice-JKLTTHSZ.js → invoice-PVYCCCVM.js} +3 -3
  57. package/dist/chunks/{jiuchuanhui-PTABJE7V.js → jiuchuanhui-RKOQW7BY.js} +3 -3
  58. package/dist/chunks/{lazy-dispatch-YN2ZP3CS.js → lazy-dispatch-DW45AFQ5.js} +5 -5
  59. package/dist/chunks/{mail-YNO7ZZUK.js → mail-BNB5S4NW.js} +2 -2
  60. package/dist/chunks/{meeting-NIDHDBCB.js → meeting-O2KDJH66.js} +13 -13
  61. package/dist/chunks/{minute-doc-G3QAT7DE.js → minute-doc-JUCG56GY.js} +4 -4
  62. package/dist/chunks/{okr-QC52G6AJ.js → okr-LWFGWOE7.js} +2 -2
  63. package/dist/chunks/{operations-MQV32ITT.js → operations-532PN5OB.js} +4 -4
  64. package/dist/chunks/{performance-3MQ3AHDQ.js → performance-7W5COCFU.js} +2 -2
  65. package/dist/chunks/{plan-ISINIEPY.js → plan-ZVY3IYTL.js} +2 -2
  66. package/dist/chunks/{project-IJ6DVKT7.js → project-SA62B7MH.js} +2 -2
  67. package/dist/chunks/{reception-3H5LUG2I.js → reception-NGIONPQ3.js} +113 -44
  68. package/dist/chunks/{recruit-stage-MIOJXP6W.js → recruit-stage-WOSN6MGP.js} +868 -128
  69. package/dist/chunks/{registry-NHHKOEU3.js → registry-N7P3W2RD.js} +4 -4
  70. package/dist/chunks/{registry-3S7AVMXR.js → registry-R72GWXOG.js} +3 -3
  71. package/dist/chunks/{registry-3GQRYP2R.js → registry-RIQ67ZT7.js} +12 -12
  72. package/dist/chunks/{room-recommend-IOKBJVYP.js → room-recommend-KCGIVUFR.js} +4 -4
  73. package/dist/chunks/{schedule-IB6EUARH.js → schedule-6UP27HQ4.js} +4 -4
  74. package/dist/chunks/{smart-extract-N2TK3CEF.js → smart-extract-DDOQSPRB.js} +3 -3
  75. package/dist/chunks/{workflow-RINBAL2M.js → workflow-V5ALD6QZ.js} +5 -5
  76. package/dist/core/output.js +4 -0
  77. package/dist/index.js +34 -34
  78. package/dist/shortcuts/ehr/operations/recruit-position.js +4 -3
  79. package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
  80. package/dist/shortcuts/ehr/operations/recruit-write.js +3 -3
  81. package/dist/shortcuts/ehr/operations/recruit.js +206 -82
  82. package/dist/shortcuts/ehr/operations/shared.js +31 -0
  83. package/dist/shortcuts/reception/constants.js +22 -0
  84. package/dist/shortcuts/reception/index.js +4 -0
  85. package/dist/shortcuts/reception/manifest.js +15 -1
  86. package/dist/shortcuts/reception/operations/doc.js +24 -11
  87. package/dist/shortcuts/reception/operations/docrender.js +18 -1
  88. package/dist/shortcuts/reception/operations/render-assets.js +93 -22
  89. package/dist/shortcuts/recruit-stage/context.js +12 -6
  90. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +19 -10
  91. package/dist/shortcuts/recruit-stage/operations/jd-create.js +454 -22
  92. package/dist/shortcuts/recruit-stage/operations/list.js +72 -1
  93. package/dist/shortcuts/recruit-stage/operations/profile.js +13 -5
  94. package/dist/shortcuts/recruit-stage/operations/registry.js +18 -2
  95. package/dist/shortcuts/recruit-stage/operations/resume-import.js +192 -26
  96. package/dist/shortcuts/recruit-stage/operations/search.js +78 -14
  97. package/dist/shortcuts/recruit-stage/operations/shortlist.js +122 -0
  98. package/dist/shortcuts/recruit-stage/shared.js +147 -3
  99. package/dist/shortcuts/workflow/operations/form.js +36 -2
  100. package/package.json +1 -1
  101. package/skills/weaver-e10-jucailin/SKILL.md +7 -3
  102. package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
  103. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
  104. package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
  105. package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
  106. package/skills/weaver-e10-recruit-stage/SKILL.md +499 -122
  107. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +67 -44
  108. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +279 -0
  109. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +198 -0
  110. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +697 -0
  111. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +159 -11
  112. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +2 -2
  113. package/skills/weaver-e10-recruit-stage/references/position-templates.md +19 -18
  114. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +19 -18
  115. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +1 -1
  116. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +1 -1
  117. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +15 -2
  118. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +37 -0
  119. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +4 -4
  120. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +62 -33
  121. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +43 -2
  122. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +41 -0
  123. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -4
  124. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +2 -2
  125. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +25 -7
  126. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +51 -0
  127. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +63 -0
  128. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -4
  129. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +2 -2
  130. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +58 -33
  131. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +4 -4
  132. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +5 -5
  133. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -2
  134. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +10 -10
  135. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +2 -2
  136. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
  137. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +106 -0
  138. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +325 -0
  139. package/skills/weaver-e10-recruit-stage/templates/match-report.html +161 -73
  140. package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
@@ -2,8 +2,10 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  createRecruitContextLoader,
5
- ehrValidationError
6
- } from "./chunk-UPVAQJKS.js";
5
+ ehrValidationError,
6
+ isSelfTenant,
7
+ toMenuList
8
+ } from "./chunk-DRUND2PJ.js";
7
9
  import {
8
10
  MANIFEST_LIST_COMPACT_PATHS,
9
11
  manifestView,
@@ -21,13 +23,13 @@ import {
21
23
  createE10RequestRuntime,
22
24
  isE10SessionExpiredResponse,
23
25
  requireE10Session
24
- } from "./chunk-DRJYPXKC.js";
26
+ } from "./chunk-IU6UB2TD.js";
25
27
  import {
26
28
  E10_SESSION_EXPIRED_MESSAGE
27
29
  } from "./chunk-IZCQU5D5.js";
28
30
  import {
29
31
  getActiveProfile
30
- } from "./chunk-SUWR5QEG.js";
32
+ } from "./chunk-AMAPQVBT.js";
31
33
  import {
32
34
  CliError,
33
35
  isCliError,
@@ -36,7 +38,7 @@ import {
36
38
  import "./chunk-BUSC6UAE.js";
37
39
 
38
40
  // src/shortcuts/recruit-stage/index.ts
39
- import { readFile as readFile3 } from "node:fs/promises";
41
+ import { readFile as readFile4 } from "node:fs/promises";
40
42
 
41
43
  // src/shortcuts/recruit-stage/continuation.ts
42
44
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
@@ -267,7 +269,9 @@ function createRecruitStageHost(ctx, dependencies = {}) {
267
269
  }
268
270
 
269
271
  // src/shortcuts/recruit-stage/operations/jd-create.ts
270
- import { createHash, randomBytes as randomBytes2 } from "node:crypto";
272
+ import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
273
+ import { readFileSync, writeFileSync, mkdirSync, existsSync as existsSync2, rmSync } from "node:fs";
274
+ import { resolve as resolvePath2, dirname } from "node:path";
271
275
 
272
276
  // src/shortcuts/recruit-stage/operations/types.ts
273
277
  function rsSuccess(action, data, meta) {
@@ -291,8 +295,9 @@ function schemaOf(properties, options = {}) {
291
295
  }
292
296
 
293
297
  // src/shortcuts/recruit-stage/shared.ts
294
- import { randomUUID } from "node:crypto";
298
+ import { randomUUID, createHash } from "node:crypto";
295
299
  import { unlinkSync } from "node:fs";
300
+ import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
296
301
  import { homedir as homedir2 } from "node:os";
297
302
  import { join, resolve as resolvePath } from "node:path";
298
303
  function randHex32() {
@@ -562,15 +567,67 @@ async function runSaveButtonEsbActions(host, opts) {
562
567
  }
563
568
  return done;
564
569
  }
570
+ var __teamsCheckMemo = /* @__PURE__ */ new Map();
571
+ async function fetchTeamsCheck(host) {
572
+ let key = "__default__";
573
+ try {
574
+ const session = await host.getSession();
575
+ const base = String(session?.baseUrl || "").replace(/\/+$/, "");
576
+ if (base) key = base;
577
+ } catch {
578
+ }
579
+ const hit = __teamsCheckMemo.get(key);
580
+ if (hit) return hit;
581
+ const pending = host.request({ path: "/api/baseserver/layout/teamsCheck", method: "POST", body: {} }).catch((e) => {
582
+ __teamsCheckMemo.delete(key);
583
+ throw e;
584
+ });
585
+ __teamsCheckMemo.set(key, pending);
586
+ return pending;
587
+ }
565
588
  async function resolveCurrentUser(host) {
566
589
  try {
567
- const r = await host.request({ path: "/api/baseserver/layout/teamsCheck", method: "POST", body: {} });
590
+ const r = await fetchTeamsCheck(host);
568
591
  const cu = r && (r.currentUser || r.data && r.data.currentUser) || null;
569
592
  return cu && cu.id ? { id: String(cu.id), name: cu.username || String(cu.id) } : null;
570
593
  } catch {
571
594
  return null;
572
595
  }
573
596
  }
597
+ async function resolveCurrentUserOrg(host) {
598
+ try {
599
+ const r = await fetchTeamsCheck(host);
600
+ const root = r || {};
601
+ const nested = root.data || {};
602
+ const cu = root.currentUser ?? nested.currentUser ?? null;
603
+ if (!cu) return null;
604
+ const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
605
+ const dept = isObj(cu.department) ? cu.department : {};
606
+ const sub = isObj(cu.subCompany) ? cu.subCompany : isObj(cu.subcompany) ? cu.subcompany : {};
607
+ const pick = (...vals) => {
608
+ for (const v of vals) {
609
+ const s = v == null ? "" : String(v).trim();
610
+ if (s) return s;
611
+ }
612
+ return "";
613
+ };
614
+ const org = {
615
+ id: pick(cu.id, nested.employeeId, root.employeeId),
616
+ name: pick(cu.username, cu.name),
617
+ departmentId: pick(dept.id, cu.departmentId, cu.departmentid),
618
+ departmentName: pick(dept.name, cu.departmentName),
619
+ // 🔴 分部 id 实测落在 currentUser.department.subCompanyId(2026-11-28 teamsCheck 实测:
620
+ // department={"id":"9080...","name":"邮件协作组","subCompanyId":"6998..."}),
621
+ // 顶层只有名称 root.subCompanyName,所以两处都要取,缺一不可。
622
+ subCompanyId: pick(dept.subCompanyId, sub.id, cu.subCompanyId, cu.subcompanyId, root.subCompanyId, nested.subCompanyId),
623
+ subCompanyName: pick(dept.subCompanyName, sub.name, cu.subCompanyName, cu.subcompanyName, root.subCompanyName, nested.subCompanyName)
624
+ };
625
+ if (!org.id && !org.name) return null;
626
+ return org;
627
+ } catch {
628
+ return null;
629
+ }
630
+ }
574
631
  async function resolvePersonId(host, _fieldId, keyword) {
575
632
  const kw = String(keyword || "").trim();
576
633
  if (!kw) return null;
@@ -732,12 +789,47 @@ async function fetchDsOptionsRaw(host, objId, fieldId, groupId) {
732
789
  });
733
790
  return r?.data || [];
734
791
  }
792
+ var RS_DS_TTL_MS = 10 * 60 * 1e3;
793
+ function rsShortCacheDir() {
794
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir2(), ".weaver-work-cli");
795
+ const root = process.env.E10_SKILL_CACHE_DIR || join(home, "env-cache", "recruit-ops");
796
+ return join(root, "_short-cache");
797
+ }
798
+ async function rsHostBaseUrl(host) {
799
+ try {
800
+ const s = await host.getSession?.();
801
+ return String(s?.baseUrl || "").replace(/\/+$/, "");
802
+ } catch {
803
+ return "";
804
+ }
805
+ }
806
+ async function rsCachedDsOptions(host, objId, fieldId, groupId) {
807
+ const fetcher = () => fetchDsOptionsRaw(host, objId, fieldId, groupId);
808
+ if (process.env.E10_RS_NO_SHORT_CACHE === "1") return fetcher();
809
+ const baseUrl = await rsHostBaseUrl(host);
810
+ if (!baseUrl) return fetcher();
811
+ const file = join(rsShortCacheDir(), "rs-ds-" + createHash("sha1").update(`${baseUrl}|${objId}|${fieldId}|${groupId}`).digest("hex").slice(0, 24) + ".json");
812
+ try {
813
+ const raw = JSON.parse(await readFile2(file, "utf8"));
814
+ if (raw?.at && Array.isArray(raw.data) && Date.now() - raw.at <= RS_DS_TTL_MS) return raw.data;
815
+ } catch {
816
+ }
817
+ const data = await fetcher();
818
+ if (Array.isArray(data) && data.length) {
819
+ try {
820
+ await mkdir2(rsShortCacheDir(), { recursive: true });
821
+ await writeFile2(file, JSON.stringify({ at: Date.now(), data }), "utf8");
822
+ } catch {
823
+ }
824
+ }
825
+ return data;
826
+ }
735
827
  async function getDsOptionsFull(host, objId, fieldId, groupId = "") {
736
828
  const key = objId + ":" + fieldId + (groupId ? ":" + groupId : "") + ":full";
737
829
  const hit = dsOptionsFullMemo.get(key);
738
830
  if (hit) return hit;
739
831
  const task = (async () => {
740
- const list = await fetchDsOptionsRaw(host, objId, fieldId, groupId);
832
+ const list = await rsCachedDsOptions(host, objId, fieldId, groupId);
741
833
  const map = {};
742
834
  const disabled = [];
743
835
  for (const x of list) {
@@ -1011,9 +1103,9 @@ function buildListUrl(baseUrl, listId) {
1011
1103
  var SCHEMA_ID_STR = { type: "string", description: "18 \u4F4D\u8BB0\u5F55 id\uFF08\u5B57\u7B26\u4E32\uFF09" };
1012
1104
  var DATAKEYS_TEXT = ["position_name"];
1013
1105
  var DATAKEYS_MTEXT = ["position_duty", "work_request"];
1014
- var DEF_TEXT = { recruit_count: "1", number_of_pay_months: "12" };
1106
+ var DEF_TEXT = { recruit_count: "3", number_of_pay_months: "12" };
1015
1107
  var DEF_OPTION = { salary_type: "\u6708\u85AA", recruit_type: "\u793E\u4F1A\u62DB\u8058" };
1016
- var DEF_CURRENT_USER = ["recr_principal", "employ_manager"];
1108
+ var DEF_CURRENT_USER = ["recr_principal", "employ_manager", "interviewer"];
1017
1109
  var DEF_FROM_REF = [
1018
1110
  "position_nature",
1019
1111
  "education",
@@ -1021,13 +1113,34 @@ var DEF_FROM_REF = [
1021
1113
  ];
1022
1114
  var DEF_STATUS = "\u62DB\u8058\u4E2D";
1023
1115
  var DEFAULT_WORK_LOCATION = "\u6D66\u6C5F\u9547\u4E09\u9C81\u516C\u8DEF3419\u53F7\u6CDB\u5FAE\u8F6F\u4EF6\u56ED";
1116
+ var DEF_DICT = {
1117
+ position_nature: "\u5168\u804C",
1118
+ education: "\u672C\u79D1",
1119
+ work_years: "\u4E0D\u9650",
1120
+ // 🔴 2026-11-28 用户口径:招聘优先级默认「中」(该字段走数据字典 低/中/高)
1121
+ recruit_priority: "\u4E2D"
1122
+ };
1123
+ var DEF_CACHE_OPTION = {
1124
+ // 用户表述为「内部招聘」,该字段实际只有这两个选项,即内部招聘的全部渠道
1125
+ internal_channels: ["\u5185\u90E8\u63A8\u8350", "\u5185\u90E8\u9074\u9009"],
1126
+ third_party_platform: ["BOSS\u76F4\u8058", "\u524D\u7A0B\u65E0\u5FE7"]
1127
+ };
1128
+ var DEFAULT_JOB_CATEGORY = "\u6280\u672F";
1129
+ var DEFAULT_DAYS_TO_DEADLINE = 60;
1130
+ var DEF_SALARY = { salary_min: "18", salary_max: "30" };
1131
+ function inferJobCategory(positionName) {
1132
+ const n = String(positionName || "");
1133
+ if (/销售|客户经理|商务|大客户|渠道|BD|城市负责|区域负责|拓展/i.test(n)) return "\u9500\u552E";
1134
+ if (/人力|行政|财务|法务|会计|招聘|HR|人事|薪酬|绩效|审计|合规|秘书/i.test(n)) return "\u804C\u80FD";
1135
+ return DEFAULT_JOB_CATEGORY;
1136
+ }
1024
1137
  var NUM_KEYS = /* @__PURE__ */ new Set(["recruit_count", "number_of_pay_months", "salary_min", "salary_max", "internship_duration", "working_days"]);
1025
1138
  var PERSON_KEYS = /* @__PURE__ */ new Set(["recr_principal", "recr_helper", "employ_manager", "interviewer"]);
1026
1139
  var OPTION_KEYS = /* @__PURE__ */ new Set(["salary_type", "recruit_type", "status"]);
1027
1140
  var DICT_KEYS = /* @__PURE__ */ new Set(["position_nature", "job_category", "education", "work_years"]);
1028
1141
  var MTEXT_KEYS = /* @__PURE__ */ new Set(["position_duty", "work_request"]);
1029
1142
  function fingerprint(value) {
1030
- return createHash("sha256").update(JSON.stringify(value)).digest("hex");
1143
+ return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
1031
1144
  }
1032
1145
  function detailValueId(d) {
1033
1146
  if (!d) return "";
@@ -1106,11 +1219,11 @@ async function fetchAllMenusFlat(ctx) {
1106
1219
  });
1107
1220
  const flat = [];
1108
1221
  (function walk2(ns) {
1109
- for (const n of ns || []) if (n && typeof n === "object") {
1222
+ for (const n of toMenuList(ns)) if (n && typeof n === "object") {
1110
1223
  flat.push(n);
1111
- walk2(n.children || n.childs);
1224
+ walk2(n.children ?? n.childs);
1112
1225
  }
1113
- })(r?.data?.cusAppMenus || r?.data);
1226
+ })(r?.data);
1114
1227
  allMenusMemo.set(key, flat);
1115
1228
  return flat;
1116
1229
  } catch {
@@ -1133,6 +1246,93 @@ async function findWorkPlaceMenu(ctx) {
1133
1246
  }
1134
1247
  return null;
1135
1248
  }
1249
+ var FLOW_MENU_NAMES = ["\u62DB\u8058\u6D41\u7A0B"];
1250
+ var flowDataMemo = /* @__PURE__ */ new Map();
1251
+ function isDefaultFlowRow(x) {
1252
+ if (!x || typeof x !== "object") return false;
1253
+ const cands = [x.is_default, x.isDefault, x.default_flow, x.defaultFlow, x.is_enable, x.enabled, x.status];
1254
+ for (const v of cands) {
1255
+ if (v === true || v === 1 || v === "1") return true;
1256
+ const s = String(v ?? "");
1257
+ if (s === "\u662F" || s === "\u542F\u7528" || s === "\u9ED8\u8BA4") return true;
1258
+ }
1259
+ return false;
1260
+ }
1261
+ async function resolveFlowByData(ctx) {
1262
+ const { host, appId, cache } = ctx;
1263
+ let menu = null;
1264
+ const allSearch = (cache.lists || {}).all_search || [];
1265
+ menu = allSearch.find(
1266
+ (m) => m && m.listId && FLOW_MENU_NAMES.some((n) => String(m.menuName || "").includes(n))
1267
+ ) || null;
1268
+ if (!menu) {
1269
+ const hit2 = findMenuNode(cache.menus || [], FLOW_MENU_NAMES, (m) => m && m.listId);
1270
+ if (hit2) menu = hit2;
1271
+ }
1272
+ if (!menu) {
1273
+ const flat = await fetchAllMenusFlat(ctx);
1274
+ const hit3 = findMenuNode(flat, FLOW_MENU_NAMES, (m) => m && m.listId);
1275
+ if (hit3) menu = hit3;
1276
+ }
1277
+ if (!menu || !menu.listId) return null;
1278
+ const key = appId + "|" + String(menu.listId);
1279
+ if (flowDataMemo.has(key)) return flowDataMemo.get(key) ?? null;
1280
+ try {
1281
+ let flowObjId = "";
1282
+ try {
1283
+ const liBody = {
1284
+ cusMenuId: menu.cusMenuId || "",
1285
+ listId: String(menu.listId),
1286
+ urlPageTitle: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B")
1287
+ };
1288
+ liBody["appId_" + String(menu.listId)] = appId;
1289
+ const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: liBody });
1290
+ flowObjId = String(li?.data?.objid || "");
1291
+ } catch {
1292
+ }
1293
+ if (!flowObjId) {
1294
+ const t = await host.request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_recruit_flow`, method: "GET" }).catch(() => null);
1295
+ flowObjId = Array.isArray(t?.data) && t.data[0] ? String(t.data[0].id || "") : "";
1296
+ }
1297
+ if (!flowObjId) {
1298
+ flowDataMemo.set(key, null);
1299
+ return null;
1300
+ }
1301
+ const body = {
1302
+ current: 1,
1303
+ pageSize: 50,
1304
+ tableuid: randHex32(),
1305
+ listId: String(menu.listId),
1306
+ searchParamData: { searchType: "3", type: "and" },
1307
+ terminal: "PC",
1308
+ browser: "Chrome",
1309
+ requiredMatch: 1,
1310
+ mapResult: 1,
1311
+ recheckQuery: 1,
1312
+ isFollow: 0,
1313
+ isShareToMe: 0,
1314
+ filterCondition: {},
1315
+ cusMenuId: String(menu.cusMenuId || ""),
1316
+ urlPageTitle: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B"),
1317
+ menuName: String(menu.menuName || "\u62DB\u8058\u6D41\u7A0B")
1318
+ };
1319
+ const r = await host.request({
1320
+ path: `/api/ebuilder/form/list/getListDatas?passid=${flowObjId}&cid=${flowObjId}`,
1321
+ body,
1322
+ headers: { ebBusinessId: String(menu.listId) }
1323
+ });
1324
+ const rows = (r?.data?.data || r?.data?.displayData || []).filter(Boolean);
1325
+ const pick = rows.find(isDefaultFlowRow) || (rows.length === 1 ? rows[0] : null);
1326
+ const id = pick ? String(pick.form_data_id || pick.id || "") : "";
1327
+ const name = pick ? stripHtml(pick.name || pick.flow_name || pick.content || "") : "";
1328
+ const out = id && name ? { id, name } : null;
1329
+ flowDataMemo.set(key, out);
1330
+ return out;
1331
+ } catch {
1332
+ flowDataMemo.set(key, null);
1333
+ return null;
1334
+ }
1335
+ }
1136
1336
  var workPlaceMemo = /* @__PURE__ */ new Map();
1137
1337
  function stripHtml(s) {
1138
1338
  return String(s ?? "").replace(/<[^>]*>/g, "").trim();
@@ -1424,14 +1624,35 @@ async function buildJd(opts) {
1424
1624
  skippedSets.push(k + "=" + v);
1425
1625
  }
1426
1626
  }
1627
+ const cacheOptionId = (key, name) => {
1628
+ const id = fid(key);
1629
+ if (!id) return "";
1630
+ const optMap = (cache.field_options?.[objId] || {})[String(id)] || {};
1631
+ for (const oid of Object.keys(optMap)) {
1632
+ if (String(optMap[oid]) === name) return String(oid);
1633
+ }
1634
+ return "";
1635
+ };
1636
+ const optionIdOf = async (key, name) => {
1637
+ const hit = cacheOptionId(key, name);
1638
+ if (hit) return hit;
1639
+ const id = fid(key);
1640
+ if (!id) return "";
1641
+ const m = await getDsOptions(host, objId, id).catch(() => ({}));
1642
+ return String(m[name] || "");
1643
+ };
1427
1644
  if (!hasKey("status")) {
1428
1645
  if (!fid("status")) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 status\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1429
- const statusMap = await getDsOptions(host, objId, fid("status"));
1430
- const statusId = statusMap[DEF_STATUS];
1431
- if (!statusId) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u300C\u62DB\u8058\u72B6\u6001\u300D\u672A\u89E3\u6790\u5230\u300C" + DEF_STATUS + "\u300D\u9009\u9879\uFF08ds/options \u8FD4\u56DE\u4E3A\u7A7A\uFF09");
1432
- put({ formField: { id: fid("status") }, dataOptions: [{ optionId: String(statusId), content: DEF_STATUS }] });
1646
+ const statusId = await optionIdOf("status", DEF_STATUS);
1647
+ if (!statusId) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u300C\u62DB\u8058\u72B6\u6001\u300D\u672A\u89E3\u6790\u5230\u300C" + DEF_STATUS + "\u300D\u9009\u9879\uFF08\u7F13\u5B58 field_options \u4E0E ds/options \u5747\u672A\u547D\u4E2D\uFF09");
1648
+ put({ formField: { id: fid("status") }, dataOptions: [{ optionId: statusId, content: DEF_STATUS }] });
1649
+ }
1650
+ let defFlow = cache.defaultRecruitFlow;
1651
+ let flowFromData = false;
1652
+ if (!hasKey("recruit_flow") && fid("recruit_flow") && (!defFlow || !defFlow.id)) {
1653
+ defFlow = await resolveFlowByData(ctx).catch(() => null);
1654
+ flowFromData = !!(defFlow && defFlow.id);
1433
1655
  }
1434
- const defFlow = cache.defaultRecruitFlow;
1435
1656
  if (!hasKey("recruit_flow") && fid("recruit_flow") && defFlow && defFlow.id) {
1436
1657
  put({ formField: { id: fid("recruit_flow") }, dataOptions: [{ optionId: String(defFlow.id), content: defFlow.name }] });
1437
1658
  }
@@ -1456,10 +1677,9 @@ async function buildJd(opts) {
1456
1677
  }
1457
1678
  for (const [k, name] of Object.entries(DEF_OPTION)) {
1458
1679
  if (fid(k) && !hasKey(k)) {
1459
- const m = await getDsOptions(host, objId, fid(k));
1460
- const oid = m[name];
1680
+ const oid = await optionIdOf(k, name);
1461
1681
  if (oid) {
1462
- put({ formField: { id: fid(k) }, dataOptions: [{ optionId: String(oid), content: name }] });
1682
+ put({ formField: { id: fid(k) }, dataOptions: [{ optionId: oid, content: name }] });
1463
1683
  filled.push(k);
1464
1684
  }
1465
1685
  }
@@ -1476,6 +1696,99 @@ async function buildJd(opts) {
1476
1696
  }
1477
1697
  }
1478
1698
  }
1699
+ const defaultedFields = [];
1700
+ const defaultSkipped = [];
1701
+ const putDictDefault = (key, name) => {
1702
+ const id = fid(key);
1703
+ if (!id || map.has(String(id))) return false;
1704
+ const group = dictGroupOf(cache, detailValueId(refByFid[String(id)]));
1705
+ const did = dictIdByName(cache, name, group) || dictIdByName(cache, name, "");
1706
+ if (!did) return false;
1707
+ put({ formField: { id }, dataOptions: [{ optionId: String(did), content: name }] });
1708
+ filled.push(key);
1709
+ defaultedFields.push({ field: key, value: name });
1710
+ return true;
1711
+ };
1712
+ const putCacheOptionDefault = (key, names) => {
1713
+ const id = fid(key);
1714
+ if (!id || map.has(String(id))) return false;
1715
+ const picked = [];
1716
+ const missed = [];
1717
+ for (const name of names) {
1718
+ const oid = cacheOptionId(key, name);
1719
+ if (oid) picked.push({ optionId: oid, content: name });
1720
+ else missed.push(name);
1721
+ }
1722
+ if (!picked.length) {
1723
+ defaultSkipped.push({
1724
+ field: key,
1725
+ wanted: names.join("\u3001"),
1726
+ reason: "\u73AF\u5883 field_options \u4E2D\u4E0D\u5B58\u5728\u8BE5\u9009\u9879\uFF0C\u672C\u6B21\u672A\u586B\uFF08\u8BE5\u5B57\u6BB5\u53EF\u80FD\u7559\u7A7A\uFF09"
1727
+ });
1728
+ return false;
1729
+ }
1730
+ put({ formField: { id }, dataOptions: picked });
1731
+ filled.push(key);
1732
+ defaultedFields.push({ field: key, value: picked.map((p) => p.content).join("\u3001") });
1733
+ if (missed.length) {
1734
+ defaultSkipped.push({
1735
+ field: key,
1736
+ wanted: missed.join("\u3001"),
1737
+ reason: "\u90E8\u5206\u9009\u9879\u5728\u73AF\u5883\u4E2D\u4E0D\u5B58\u5728\uFF0C\u4EC5\u586B\u5165\u5DF2\u547D\u4E2D\u7684\u503C"
1738
+ });
1739
+ }
1740
+ return true;
1741
+ };
1742
+ for (const [k, name] of Object.entries(DEF_DICT)) putDictDefault(k, name);
1743
+ putDictDefault("job_category", inferJobCategory(positionName));
1744
+ for (const [k, names] of Object.entries(DEF_CACHE_OPTION)) putCacheOptionDefault(k, names);
1745
+ const deadlineFid = fid("recruitment_deadline");
1746
+ if (deadlineFid && !map.has(String(deadlineFid))) {
1747
+ const d = /* @__PURE__ */ new Date();
1748
+ d.setDate(d.getDate() + DEFAULT_DAYS_TO_DEADLINE);
1749
+ const pad = (x) => String(x).padStart(2, "0");
1750
+ const deadline = d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
1751
+ put({ formField: { id: deadlineFid }, content: deadline });
1752
+ filled.push("recruitment_deadline");
1753
+ defaultedFields.push({ field: "recruitment_deadline", value: deadline });
1754
+ }
1755
+ for (const [k, v] of Object.entries(DEF_SALARY)) {
1756
+ const id = fid(k);
1757
+ if (!id || map.has(String(id))) continue;
1758
+ put({ formField: { id }, content: v });
1759
+ filled.push(k);
1760
+ defaultedFields.push({ field: k, value: v });
1761
+ }
1762
+ const needOrg = ["sub_company", "department"].some((k) => {
1763
+ const id = fid(k);
1764
+ return !!id && !map.has(String(id));
1765
+ });
1766
+ let orgDefaultWarning = null;
1767
+ if (needOrg) {
1768
+ const org = await resolveCurrentUserOrg(host).catch(() => null);
1769
+ if (!org) {
1770
+ orgDefaultWarning = "\u672A\u80FD\u89E3\u6790\u5F53\u524D\u767B\u5F55\u4EBA\u7684\u6240\u5C5E\u7EC4\u7EC7\uFF08teamsCheck \u4E0D\u53EF\u7528\uFF09\uFF0C\u672C\u6B21\u4E0D\u5199\u300C\u804C\u4F4D\u6240\u5C5E\u5206\u90E8 / \u804C\u4F4D\u6240\u5C5E\u90E8\u95E8\u300D\uFF1B\u8BF7\u7528 sets \u6307\u5B9A";
1771
+ } else {
1772
+ if (fid("sub_company") && !hasKey("sub_company")) {
1773
+ if (org.subCompanyId) {
1774
+ put({ formField: { id: fid("sub_company") }, dataOptions: [{ optionId: org.subCompanyId, content: org.subCompanyName }] });
1775
+ filled.push("sub_company");
1776
+ defaultedFields.push({ field: "sub_company", value: org.subCompanyName });
1777
+ } else {
1778
+ defaultSkipped.push({ field: "sub_company", wanted: "\u5F53\u524D\u4EBA\u6240\u5728\u5206\u90E8", reason: "teamsCheck \u672A\u8FD4\u56DE\u5206\u90E8\u8BB0\u5F55 id\uFF08subCompanyId\uFF09\uFF0C\u672C\u6B21\u672A\u586B" });
1779
+ }
1780
+ }
1781
+ if (fid("department") && !hasKey("department")) {
1782
+ if (org.departmentId) {
1783
+ put({ formField: { id: fid("department") }, dataOptions: [{ optionId: org.departmentId, content: org.departmentName }] });
1784
+ filled.push("department");
1785
+ defaultedFields.push({ field: "department", value: org.departmentName });
1786
+ } else {
1787
+ defaultSkipped.push({ field: "department", wanted: "\u5F53\u524D\u4EBA\u6240\u5728\u90E8\u95E8", reason: "teamsCheck \u672A\u8FD4\u56DE\u90E8\u95E8\u8BB0\u5F55 id\uFF0C\u672C\u6B21\u672A\u586B" });
1788
+ }
1789
+ }
1790
+ }
1791
+ }
1479
1792
  const inheritedSalaryWarnings = [];
1480
1793
  for (const key of ["salary_min", "salary_max"]) {
1481
1794
  const hit = inheritedFromRef.find((x) => x.field === key);
@@ -1514,6 +1827,8 @@ async function buildJd(opts) {
1514
1827
  status: DEF_STATUS,
1515
1828
  // 解析不到环境默认流程时不写该字段,表单自身默认值生效;文案按实际行为表述,避免误导。
1516
1829
  recruitFlow: defFlow && defFlow.id ? defFlow.name : "\uFF08\u6CBF\u7528\u8868\u5355\u9ED8\u8BA4\u503C\uFF09",
1830
+ // 流程来源:cache=上下文缓存命中;data=缓存缺失时从「招聘流程」列表数据兜底解析
1831
+ recruitFlowSource: defFlow && defFlow.id ? flowFromData ? "data" : "cache" : void 0,
1517
1832
  currentUser: currentUser ? currentUser.name : null,
1518
1833
  setApplied: appliedSets,
1519
1834
  setSkipped: skippedSets,
@@ -1524,6 +1839,14 @@ async function buildJd(opts) {
1524
1839
  inheritedNote: inheritedFromRef.length ? "\u4EE5\u4E0A\u5B57\u6BB5\u672A\u6307\u5B9A\uFF0C\u503C\u7EE7\u627F\u81EA\u73AF\u5883\u5185\u6700\u8FD1\u4E00\u6761\u804C\u4F4D\u8BB0\u5F55\uFF0C\u53EF\u80FD\u542B\u5386\u53F2\u810F\u6570\u636E\uFF0C\u8BF7\u6838\u5BF9\u540E\u518D\u63D0\u4EA4\uFF08\u5DE5\u4F5C\u5730\u70B9\u4E0D\u53C2\u4E0E\u7EE7\u627F\uFF09" : void 0,
1525
1840
  workLocationDefault: workLocationDefault || void 0,
1526
1841
  workLocationWarning: workLocationWarning || void 0,
1842
+ // A/C 告警:想填但填不上的默认值(环境缺选项 / 取不到记录 id)。不阻断创建,但必须让用户看见,
1843
+ // 否则会出现「摘要说已默认填写、实际字段留空」这种最难排查的情况。
1844
+ defaultSkipped: defaultSkipped.length ? defaultSkipped : void 0,
1845
+ defaultSkippedNote: defaultSkipped.length ? "\u4EE5\u4E0A\u9ED8\u8BA4\u503C\u672A\u80FD\u586B\u5165\uFF08\u73AF\u5883\u7F3A\u5C11\u5BF9\u5E94\u9009\u9879\uFF0C\u6216\u53D6\u4E0D\u5230\u8BB0\u5F55 id\uFF09\uFF0C\u5BF9\u5E94\u5B57\u6BB5\u53EF\u80FD\u7559\u7A7A\uFF1B\u8BF7\u6838\u5BF9\u540E\u7528 sets \u663E\u5F0F\u6307\u5B9A" : void 0,
1846
+ orgDefaultWarning: orgDefaultWarning || void 0,
1847
+ // 本次自动补上的固定默认值(用户未指定、继承也没拿到):摘要里明示,便于创建前核对
1848
+ defaultedFields: defaultedFields.length ? defaultedFields : void 0,
1849
+ defaultedNote: defaultedFields.length ? "\u4EE5\u4E0A\u5B57\u6BB5\u672A\u6307\u5B9A\uFF0C\u5DF2\u6309\u62DB\u8058\u52A9\u624B\u56FA\u5B9A\u9ED8\u8BA4\u503C\u81EA\u52A8\u586B\u5165\uFF08\u53EF\u968F\u65F6\u7528 sets \u8986\u76D6\uFF09" : void 0,
1527
1850
  requiredDefaultsFilled
1528
1851
  }
1529
1852
  };
@@ -1656,6 +1979,53 @@ async function prepare(args, env) {
1656
1979
  confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E\u672C continuation \u8C03\u7528 recruit-stage.jd.create.apply"
1657
1980
  });
1658
1981
  }
1982
+ var JD_PENDING_TTL_MS = 10 * 60 * 1e3;
1983
+ function jdPendingFile(positionName) {
1984
+ const home = process.env.USERPROFILE || process.env.HOME || ".";
1985
+ const key = createHash2("sha1").update(positionName).digest("hex").slice(0, 16);
1986
+ return resolvePath2(home, ".weaver-work-cli", "state", "jd-pending", key + ".json");
1987
+ }
1988
+ function readJdPending(positionName) {
1989
+ try {
1990
+ const p = jdPendingFile(positionName);
1991
+ if (!existsSync2(p)) return null;
1992
+ const j = JSON.parse(readFileSync(p, "utf8"));
1993
+ if (String(j.positionName || "") !== positionName) return null;
1994
+ if (!j.formDataId) return null;
1995
+ if (Date.now() - Number(j.savedAt || 0) > JD_PENDING_TTL_MS) return null;
1996
+ return { formDataId: String(j.formDataId), savedAt: Number(j.savedAt) };
1997
+ } catch {
1998
+ return null;
1999
+ }
2000
+ }
2001
+ function writeJdPending(positionName, formDataId) {
2002
+ try {
2003
+ const p = jdPendingFile(positionName);
2004
+ mkdirSync(dirname(p), { recursive: true });
2005
+ writeFileSync(p, JSON.stringify({ positionName, formDataId, savedAt: Date.now() }), "utf8");
2006
+ } catch {
2007
+ }
2008
+ }
2009
+ async function jdStatusName(ctx, formId, objId, dataId) {
2010
+ try {
2011
+ const rec = await getFormDataRecord(ctx.host, formId, dataId, objId);
2012
+ const dets = rec?.dataDetails || [];
2013
+ const statusFid = String((ctx.cache.fields[objId] || {})["status"] || "");
2014
+ const cell = dets.find((d) => String(d.fieldId) === statusFid && !d.subFormId);
2015
+ if (!cell) return "";
2016
+ const direct = String(cell.dataOptions?.[0]?.content || cell.content || "");
2017
+ if (direct) return direct;
2018
+ const oid = String(cell.dataOptions?.[0]?.optionId || "");
2019
+ if (oid) {
2020
+ const map = await getDsOptions(ctx.host, objId, statusFid).catch(() => ({}));
2021
+ const hit = Object.keys(map).find((k) => String(map[k]) === oid);
2022
+ if (hit) return hit;
2023
+ }
2024
+ return "";
2025
+ } catch {
2026
+ return "";
2027
+ }
2028
+ }
1659
2029
  async function apply(args, env) {
1660
2030
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.jd.create.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
1661
2031
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
@@ -1687,19 +2057,43 @@ async function apply(args, env) {
1687
2057
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF08\u5B57\u6BB5\u503C\u5DF2\u53D8\u5316\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
1688
2058
  }
1689
2059
  }
1690
- const formDataId = await saveFormData(host, {
1691
- appId: jd.appId,
1692
- formId: jd.formId,
1693
- objId: jd.objId,
1694
- name: "\u804C\u4F4D\u7BA1\u7406-" + positionName,
1695
- dataDetails: jd.dataDetails
1696
- });
1697
- const r2 = await host.request({ path: "/api/recruit/position/v2/addPosition?formDataId=" + formDataId, method: "POST" });
2060
+ let formDataId = "";
2061
+ let resumedFromPending = false;
2062
+ let alreadyCreated = false;
2063
+ const pending = readJdPending(positionName);
2064
+ if (pending) {
2065
+ const st = await jdStatusName(ctx, jd.formId, jd.objId, pending.formDataId);
2066
+ formDataId = pending.formDataId;
2067
+ resumedFromPending = true;
2068
+ if (st && st !== "\u5F85\u53D1\u5E03") alreadyCreated = true;
2069
+ }
2070
+ if (!formDataId) {
2071
+ try {
2072
+ formDataId = await saveFormData(host, {
2073
+ appId: jd.appId,
2074
+ formId: jd.formId,
2075
+ objId: jd.objId,
2076
+ name: "\u804C\u4F4D\u7BA1\u7406-" + positionName,
2077
+ dataDetails: jd.dataDetails
2078
+ });
2079
+ } catch (e) {
2080
+ throw rsFail("\u2460 \u4FDD\u5B58\u804C\u4F4D\u7BA1\u7406\u8868\u5355\u5931\u8D25\uFF1A" + String(e?.message || e));
2081
+ }
2082
+ writeJdPending(positionName, formDataId);
2083
+ }
2084
+ let r2 = null;
2085
+ if (!alreadyCreated) {
2086
+ try {
2087
+ r2 = await host.request({ path: "/api/recruit/position/v2/addPosition?formDataId=" + formDataId, method: "POST" });
2088
+ } catch (e) {
2089
+ throw rsFail("\u2461 addPosition \u751F\u6210\u804C\u4F4D\u5931\u8D25\uFF08\u5DF2\u4FDD\u5B58\u7684\u804C\u4F4D\u8BB0\u5F55 id=" + formDataId + " \u5DF2\u4FDD\u7559\uFF0C10 \u5206\u949F\u5185\u91CD\u8DD1\u53EF\u7EED\uFF09\uFF1A" + String(e?.message || e));
2090
+ }
2091
+ }
1698
2092
  const data = r2?.data || {};
1699
2093
  const positionPostId = data.positionPostId;
1700
2094
  const checkRpa = data.checkRpa;
1701
2095
  const rpaValidMsg = data.rpaValidMsg || null;
1702
- const okByResponse = r2?.status !== false && r2?.fail !== true && data.fail !== true;
2096
+ const okByResponse = r2 ? r2?.status !== false && r2?.fail !== true && data.fail !== true : true;
1703
2097
  const verification = await verifySubmitted({
1704
2098
  host,
1705
2099
  formId: jd.formId,
@@ -1716,6 +2110,7 @@ async function apply(args, env) {
1716
2110
  if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
1717
2111
  const recordOk = verification.unavailable ? okByResponse : verification.mismatches.length === 0;
1718
2112
  const created = okByResponse && recordOk;
2113
+ if (created) writeJdPending(positionName, formDataId);
1719
2114
  const result = !created ? "failed" : verification.mismatches.length ? "partial" : "success";
1720
2115
  const listUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.position?.listId || "");
1721
2116
  const cardUrl = buildCardUrl(ctx.baseUrl, jd.objId, formDataId);
@@ -1723,6 +2118,9 @@ async function apply(args, env) {
1723
2118
  mode: "apply",
1724
2119
  result,
1725
2120
  formDataId,
2121
+ // 幂等语义(供 Agent 与用户判断"是否真的又建了一条")
2122
+ resumedFromPending,
2123
+ alreadyCreatedBeforeThisRun: alreadyCreated,
1726
2124
  positionPostId: positionPostId || null,
1727
2125
  rpaChecked: checkRpa === void 0 ? null : !!checkRpa,
1728
2126
  rpaValidMsg,
@@ -1736,7 +2134,6 @@ async function apply(args, env) {
1736
2134
  // 由 Agent 按 recruit-output-links.md「链接覆盖规则」替换 path 段后再输出。
1737
2135
  viewLink: cardUrl ? `[\u67E5\u770B ${jd.summary.positionName || "\u65B0\u5EFA\u804C\u4F4D"} \u804C\u4F4D\u8BE6\u60C5](${cardUrl})` : null,
1738
2136
  listLocateLink: listUrl ? `[\u6253\u5F00\u804C\u4F4D\u5217\u8868](${listUrl})` : null,
1739
- agentNote: "\u67E5\u770B\u5165\u53E3 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF1A\u2460 viewLink \u804C\u4F4D\u8BE6\u60C5\u5355\u9875\uFF08\u539F\u6837\u642C\u8FD0\uFF0C\u4E0D\u6539\uFF09\u2461 listLocateLink \u804C\u4F4D\u5217\u8868\u2014\u2014\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u7528\u56FA\u5B9A\u8DEF\u7531\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA viewLink\uFF09\uFF0C\u5426\u5219\u539F\u6837\u642C\u8FD0\u3002\u4E0D\u8981\u5305 browsertool / <artifact> \u6807\u7B7E\uFF1B\u7F3A\u54EA\u4E2A\u53EA\u7ED9\u53E6\u4E00\u4E2A\uFF0C\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u94FE\u63A5\u53EA\u662F\u67E5\u770B\u5165\u53E3\uFF0C\u91CD\u590D\u70B9\u51FB\u4E0D\u4F1A\u91CD\u590D\u521B\u5EFA\u3002",
1740
2137
  ...jd.summary
1741
2138
  });
1742
2139
  }
@@ -1831,7 +2228,7 @@ var jdCreateOperations = [
1831
2228
  ];
1832
2229
 
1833
2230
  // src/shortcuts/recruit-stage/operations/resume-import.ts
1834
- import { createHash as createHash3 } from "node:crypto";
2231
+ import { createHash as createHash4 } from "node:crypto";
1835
2232
  import fs from "node:fs";
1836
2233
  import path from "node:path";
1837
2234
 
@@ -2277,9 +2674,9 @@ async function queryEntityTags(host, talentId) {
2277
2674
  }
2278
2675
 
2279
2676
  // src/shortcuts/recruit-stage/fs-scan.ts
2280
- import { mkdtempSync, readdirSync, readFileSync, statSync, mkdirSync, writeFileSync } from "node:fs";
2677
+ import { mkdtempSync, readdirSync, readFileSync as readFileSync2, statSync, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
2281
2678
  import { tmpdir } from "node:os";
2282
- import { basename, dirname, extname, join as join2, resolve as resolve2 } from "node:path";
2679
+ import { basename, dirname as dirname2, extname, join as join2, resolve as resolve2 } from "node:path";
2283
2680
  import { inflateRawSync } from "node:zlib";
2284
2681
  var RESUME_EXTS = /* @__PURE__ */ new Set([".pdf", ".doc", ".docx", ".rtf", ".txt", ".wps"]);
2285
2682
  function decodeName(bytes, utf8Flag) {
@@ -2291,7 +2688,7 @@ function decodeName(bytes, utf8Flag) {
2291
2688
  }
2292
2689
  }
2293
2690
  function extractZip(zipPath) {
2294
- const buf = readFileSync(zipPath);
2691
+ const buf = readFileSync2(zipPath);
2295
2692
  let eocd = -1;
2296
2693
  const floor = Math.max(0, buf.length - 22 - 65535);
2297
2694
  for (let i = buf.length - 22; i >= floor; i--) {
@@ -2338,8 +2735,8 @@ function extractZip(zipPath) {
2338
2735
  continue;
2339
2736
  }
2340
2737
  const target = join2(dest, ...parts);
2341
- mkdirSync(dirname(target), { recursive: true });
2342
- writeFileSync(target, out);
2738
+ mkdirSync2(dirname2(target), { recursive: true });
2739
+ writeFileSync2(target, out);
2343
2740
  written++;
2344
2741
  }
2345
2742
  if (!written) throw new Error("zip \u5185\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u6587\u4EF6\uFF08\u53EF\u80FD\u4E3A\u7A7A\u5305\u6216\u4F7F\u7528\u4E86\u4E0D\u652F\u6301\u7684\u538B\u7F29\u65B9\u5F0F\uFF09");
@@ -2398,18 +2795,18 @@ function scanResumeSource(source) {
2398
2795
  }
2399
2796
 
2400
2797
  // src/shortcuts/recruit-stage/batch-store.ts
2401
- import { createHash as createHash2 } from "node:crypto";
2402
- import { chmodSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
2798
+ import { createHash as createHash3 } from "node:crypto";
2799
+ import { chmodSync, mkdirSync as mkdirSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
2403
2800
  import { homedir as homedir3 } from "node:os";
2404
2801
  import { join as join3, resolve as resolve3, sep } from "node:path";
2405
2802
  function batchDir() {
2406
2803
  const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve3(homedir3(), ".weaver-work-cli");
2407
2804
  const dir = join3(home, "batch");
2408
- mkdirSync2(dir, { recursive: true, mode: 448 });
2805
+ mkdirSync3(dir, { recursive: true, mode: 448 });
2409
2806
  return dir;
2410
2807
  }
2411
2808
  function digest(value) {
2412
- return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
2809
+ return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
2413
2810
  }
2414
2811
  function cleanup(dir) {
2415
2812
  try {
@@ -2430,7 +2827,7 @@ function saveBatchItems(kind, items) {
2430
2827
  cleanup(dir);
2431
2828
  const fingerprint3 = digest(items);
2432
2829
  const file = join3(dir, `${kind}-${fingerprint3.slice(0, 16)}.json`);
2433
- writeFileSync2(file, JSON.stringify(items), { mode: 384 });
2830
+ writeFileSync3(file, JSON.stringify(items), { mode: 384 });
2434
2831
  try {
2435
2832
  chmodSync(file, 384);
2436
2833
  } catch {
@@ -2445,7 +2842,7 @@ function loadBatchItems(file, expectedFingerprint) {
2445
2842
  }
2446
2843
  let items;
2447
2844
  try {
2448
- items = JSON.parse(readFileSync2(target, "utf8"));
2845
+ items = JSON.parse(readFileSync3(target, "utf8"));
2449
2846
  } catch {
2450
2847
  throw rsValidationError("batch_file_missing", "\u6279\u91CF\u6E05\u5355\u5DF2\u5931\u6548\uFF08\u6587\u4EF6\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare");
2451
2848
  }
@@ -2468,7 +2865,7 @@ function saveOcrResult(fileId, structured) {
2468
2865
  const dir = batchDir();
2469
2866
  cleanup(dir);
2470
2867
  const p = ocrFile(fileId);
2471
- writeFileSync2(p, JSON.stringify(structured), { mode: 384 });
2868
+ writeFileSync3(p, JSON.stringify(structured), { mode: 384 });
2472
2869
  try {
2473
2870
  chmodSync(p, 384);
2474
2871
  } catch {
@@ -2482,7 +2879,7 @@ function loadOcrResult(fileId, maxAgeMs = 24 * 3600 * 1e3) {
2482
2879
  const p = ocrFile(fileId);
2483
2880
  const st = statSync2(p);
2484
2881
  if (Date.now() - st.mtimeMs > maxAgeMs) return null;
2485
- const v = JSON.parse(readFileSync2(p, "utf8"));
2882
+ const v = JSON.parse(readFileSync3(p, "utf8"));
2486
2883
  return v && typeof v === "object" && !Array.isArray(v) ? v : null;
2487
2884
  } catch {
2488
2885
  return null;
@@ -2534,7 +2931,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
2534
2931
  const uploadType = c?.data?.uploadType || "common";
2535
2932
  if (!preUploadId) throw rsFail("\u7B80\u5386\u9884\u4E0A\u4F20\u68C0\u67E5\u5931\u8D25\uFF1A" + JSON.stringify(c || {}).slice(0, 200));
2536
2933
  const fd = baseForm();
2537
- const md5 = createHash3("md5").update(buf).digest("hex");
2934
+ const md5 = createHash4("md5").update(buf).digest("hex");
2538
2935
  const lm = String(Math.round(fs.statSync(filePath).mtimeMs || Date.now()));
2539
2936
  fd.append("name", filename);
2540
2937
  fd.append("MD5", md5);
@@ -2574,7 +2971,7 @@ function snapshotParsedResume(s) {
2574
2971
  return void 0;
2575
2972
  }
2576
2973
  }
2577
- var BUILT_SNAPSHOT_LIMIT = 48 * 1024;
2974
+ var BUILT_SNAPSHOT_LIMIT = 512 * 1024;
2578
2975
  function snapshotBuilt(built) {
2579
2976
  if (!built || typeof built !== "object") return void 0;
2580
2977
  try {
@@ -2679,6 +3076,8 @@ async function resolveSubTableMeta(ctx) {
2679
3076
  if (cfg.start && cfg.end && cfg.start.dataKey && cfg.end.dataKey) {
2680
3077
  col.startKey = String(cfg.start.dataKey);
2681
3078
  col.endKey = String(cfg.end.dataKey);
3079
+ if (cfg.start.fieldId) col.startFieldId = String(cfg.start.fieldId);
3080
+ if (cfg.end.fieldId) col.endFieldId = String(cfg.end.fieldId);
2682
3081
  }
2683
3082
  cols[String(cfg.dataKey)] = col;
2684
3083
  }
@@ -2892,6 +3291,107 @@ async function readTalentSnapshot(ctx, opts) {
2892
3291
  for (const [dk, s] of Object.entries(seen)) subRows[dk] = s.size;
2893
3292
  return { main, subRows, subCells };
2894
3293
  }
3294
+ async function readTalentRecordMeta(ctx, opts) {
3295
+ const L = await getFormLayoutMeta(ctx.host, opts.formId);
3296
+ const r = await ctx.host.request({
3297
+ path: "/api/ebuilder/form/form/core/getFormDataAndLayout",
3298
+ method: "POST",
3299
+ body: {
3300
+ terminalType: "PC",
3301
+ dataId: opts.dataId,
3302
+ formId: opts.formId,
3303
+ module: "ebuilderform",
3304
+ newLayout: true,
3305
+ layoutId: L?.formLayout?.id,
3306
+ layoutMultiId: L?.formLayoutMultiple?.id,
3307
+ dataCrossLayout: false,
3308
+ permissionId: "",
3309
+ allReadOnly: true,
3310
+ initialDatas: [],
3311
+ dynamicData: false,
3312
+ cost: false,
3313
+ customParam: { objId: opts.objId, dataId: opts.dataId }
3314
+ }
3315
+ });
3316
+ const dets = r?.data?.formData?.dataDetails || [];
3317
+ const rowIdsBySubForm = {};
3318
+ for (const d of dets) {
3319
+ if (!d.subFormId) continue;
3320
+ const sid = String(d.subFormId);
3321
+ const idx = Number(d.dataIndex || 0);
3322
+ if (idx < 1) continue;
3323
+ const arr = rowIdsBySubForm[sid] = rowIdsBySubForm[sid] || [];
3324
+ if (!arr[idx - 1]) arr[idx - 1] = String(d.rowId || "");
3325
+ }
3326
+ return {
3327
+ updateTimeStamp: String(r?.data?.formData?.updateTimeStamp || ""),
3328
+ formLayoutId: String(r?.data?.formLayout?.id || L?.formLayout?.id || ""),
3329
+ rowIdsBySubForm
3330
+ };
3331
+ }
3332
+ function debugDumpSubCells(built, rowIdsBySubForm) {
3333
+ for (const [dk, node] of Object.entries(built.detailNodes)) {
3334
+ const sub = (built.subMeta || {})[dk];
3335
+ const rows = (built.detailsPayload || {})[node] || [];
3336
+ const sid = sub ? String(sub.subFormId) : "";
3337
+ const oldIds = rowIdsBySubForm[sid] || [];
3338
+ const cols = Object.entries(sub?.columns || {}).map(([k, c]) => `${k}:${c.type}@${c.id}${c.startKey ? `(s=${c.startKey},e=${c.endKey})` : ""}`).join(" | ");
3339
+ console.error(`[debug-cells] ${dk} node=${node} subFormId=${sid} oldRows=${oldIds.length} newRows=${rows.length} cols=${cols}`);
3340
+ rows.forEach((r, i) => console.error(`[debug-cells] row${i + 1} rowId=${oldIds[i] || ""} json=${JSON.stringify(r)}`));
3341
+ }
3342
+ }
3343
+ function normDateCell(colType, v) {
3344
+ if (!/date/i.test(String(colType || ""))) return v;
3345
+ const s = String(v || "").trim().replace(/\//g, "-");
3346
+ const m0 = s.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
3347
+ if (m0) return `${m0[1]}-${String(m0[2]).padStart(2, "0")}-${String(m0[3]).padStart(2, "0")}`;
3348
+ const m = s.match(/^(\d{4})-(\d{1,2})$/);
3349
+ if (m) return `${m[1]}-${String(m[2]).padStart(2, "0")}-01`;
3350
+ const y = s.match(/^(\d{4})$/);
3351
+ if (y) return `${y[1]}-01-01`;
3352
+ return null;
3353
+ }
3354
+ function buildSubFormCells(built, rowIdsBySubForm, dictName) {
3355
+ const cells = [];
3356
+ const skippedOldRows = [];
3357
+ const droppedCells = [];
3358
+ if (process.env.E10_RS_DEBUG_CELLS === "1") debugDumpSubCells(built, rowIdsBySubForm);
3359
+ for (const [dk, node] of Object.entries(built.detailNodes)) {
3360
+ const sub = (built.subMeta || {})[dk];
3361
+ const rows = (built.detailsPayload || {})[node] || [];
3362
+ if (!sub || !rows.length) continue;
3363
+ const sid = String(sub.subFormId);
3364
+ const oldIds = rowIdsBySubForm[sid] || [];
3365
+ const keyMap = {};
3366
+ for (const [ck0, c0] of Object.entries(sub.columns || {})) {
3367
+ if (c0?.id) keyMap[ck0] = { fieldId: String(c0.id), date: /date/i.test(String(c0.type || "")) };
3368
+ if (c0?.startKey && c0?.startFieldId) keyMap[String(c0.startKey)] = { fieldId: String(c0.startFieldId), date: true };
3369
+ if (c0?.endKey && c0?.endFieldId) keyMap[String(c0.endKey)] = { fieldId: String(c0.endFieldId), date: true };
3370
+ }
3371
+ rows.forEach((row, i) => {
3372
+ const rowId = i < oldIds.length ? oldIds[i] || "" : "";
3373
+ for (const [ck, v] of Object.entries(row)) {
3374
+ const col = keyMap[ck];
3375
+ if (!col) {
3376
+ droppedCells.push(`${dk}#${i + 1}.${ck} \u65E0\u5BF9\u5E94\u5217\uFF08\u5E03\u5C40\u672A\u89E3\u6790\u5230 fieldId\uFF09\uFF0C\u5DF2\u8DF3\u8FC7`);
3377
+ continue;
3378
+ }
3379
+ const sv = String(v ?? "");
3380
+ const dateVal = col.date ? normDateCell("Date", sv) : sv;
3381
+ if (dateVal === null) {
3382
+ droppedCells.push(`${dk}#${i + 1}.${ck}\u300C${sv}\u300D\u975E\u65E5\u671F\u503C\uFF0C\u5DF2\u8DF3\u8FC7`);
3383
+ continue;
3384
+ }
3385
+ const isOption = /^\d{6,}$/.test(sv) && !!dictName(sv);
3386
+ cells.push(isOption ? { dataIndex: i + 1, rowId, formField: { id: col.fieldId }, subForm: { id: sid }, dataOptions: [{ optionId: sv, content: dictName(sv) }] } : { dataIndex: i + 1, rowId, formField: { id: col.fieldId }, subForm: { id: sid }, content: dateVal });
3387
+ }
3388
+ });
3389
+ if (oldIds.length > rows.length) {
3390
+ skippedOldRows.push(`${dk}\uFF1A\u539F\u8868 ${oldIds.length} \u884C > \u672C\u6B21\u89E3\u6790 ${rows.length} \u884C\uFF0C\u591A\u51FA\u7684\u65E7\u884C\u65E0\u6CD5\u7ECF\u672C\u901A\u9053\u5220\u9664\uFF0C\u9700\u9875\u9762\u624B\u5DE5\u5904\u7406`);
3391
+ }
3392
+ }
3393
+ return { cells, skippedOldRows, droppedCells };
3394
+ }
2895
3395
  async function matchTalentLabel(host, talentId) {
2896
3396
  const r = await host.request({ path: "/api/recruit/label/matchTalentLabel?talentId=" + encodeURIComponent(talentId), method: "POST", body: {} });
2897
3397
  return r?.data || null;
@@ -3132,7 +3632,7 @@ async function findExistingTalents(ctx, opts) {
3132
3632
  return { checked: true, unique: !hit, byPhone: byPhone && !byPhone.error ? byPhone : null, byPhoneError: byPhone?.error, formConflicts, ids };
3133
3633
  }
3134
3634
  function fingerprint2(value) {
3135
- return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
3635
+ return createHash4("sha256").update(JSON.stringify(value)).digest("hex");
3136
3636
  }
3137
3637
  function fingerprintMainTable(mainTable) {
3138
3638
  const copy = { ...mainTable };
@@ -3325,6 +3825,19 @@ async function prepare2(args, env, opts = {}) {
3325
3825
  operation: "recruit-stage.resume.import.apply",
3326
3826
  fingerprint: fp,
3327
3827
  enumMaps: await dsOptionsSnapshot(),
3828
+ // 🔴 2026-11-28 修复「提速失效」:新建模式此前**从未签入 built**(只有更新通道签了),
3829
+ // 导致 apply 每次都重跑 buildImport(~6 HTTP)与 findExistingTalents(2 HTTP),
3830
+ // 优化写了但完全没生效。现补上;同时把 prepare 的查重结果签入 dupCheck,
3831
+ // 让 apply 能据此决策:unique=true 才跳过 HTTP 查重,unique=false 直接拒绝写入。
3832
+ built: snapshotBuilt(built),
3833
+ dupCheck: {
3834
+ checked: dupInfo.checked,
3835
+ unique: dupInfo.unique,
3836
+ conflictCount: dupInfo.formConflicts.existing.length,
3837
+ unreadableCount: dupInfo.formConflicts.unreadable.length,
3838
+ byPhoneTalentId: dupInfo.byPhone?.talentId || null,
3839
+ byPhoneCandidateId: dupInfo.byPhone?.candidateId || null
3840
+ },
3328
3841
  // 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
3329
3842
  // confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
3330
3843
  // 否则会报 resume_source_required(文档写法跑不通)。
@@ -3398,12 +3911,18 @@ async function applyCore(args, env, payload) {
3398
3911
  if (payload.fingerprint !== fingerprint2(willSubmit)) {
3399
3912
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
3400
3913
  }
3401
- await datasetUpdateFormData(host, {
3914
+ const fresh = await readTalentRecordMeta(ctx, { formId: built.formId, objId: built.objId, dataId: updateTalentId });
3915
+ const subCells = buildSubFormCells(built, fresh.rowIdsBySubForm, makeDictLookup(ctx.cache));
3916
+ const savedId = await saveFormData(ctx.host, {
3917
+ appId: ctx.appId,
3918
+ formId: built.formId,
3402
3919
  objId: built.objId,
3403
- dataId: updateTalentId,
3404
- mainTable: upMain,
3405
- details: built.detailsPayload,
3406
- coverDetails: Object.keys(built.detailsPayload)
3920
+ name: built.structured.candidateName || void 0,
3921
+ dataDetails: [...built.dataDetails, ...subCells.cells],
3922
+ rightType: "2",
3923
+ formDataId: updateTalentId,
3924
+ updateTimeStamp: fresh.updateTimeStamp || void 0,
3925
+ layoutId: fresh.formLayoutId || void 0
3407
3926
  });
3408
3927
  const avatarRes2 = await writeAvatarIfProvided(ctx, {
3409
3928
  photoFile: argsT.photoFile,
@@ -3427,17 +3946,18 @@ async function applyCore(args, env, payload) {
3427
3946
  return out;
3428
3947
  };
3429
3948
  let after = await readTalentSnapshot(ctx, { formId: built.formId, objId: built.objId, fields: built.fields, subMeta: built.subMeta, dataId: updateTalentId });
3430
- let verifyWarnings = checkAfter(after);
3949
+ let verifyWarnings = [...subCells.skippedOldRows, ...subCells.droppedCells, ...checkAfter(after)];
3431
3950
  if (verifyWarnings.length) {
3432
3951
  await new Promise((r) => setTimeout(r, 600));
3433
3952
  after = await readTalentSnapshot(ctx, { formId: built.formId, objId: built.objId, fields: built.fields, subMeta: built.subMeta, dataId: updateTalentId });
3434
- verifyWarnings = checkAfter(after);
3953
+ verifyWarnings = [...subCells.skippedOldRows, ...subCells.droppedCells, ...checkAfter(after)];
3435
3954
  }
3436
3955
  return rsSuccess("recruit-stage.resume.import.apply", {
3437
3956
  // 更新模式同理:明细行/格数对不上时只能报 partial,不能因主表写入成功就报 success
3438
3957
  mode: "update",
3439
3958
  result: verifyWarnings.length ? "partial" : "success",
3440
3959
  detailsState: verifyWarnings.length ? "missing" : "complete",
3960
+ writeChannel: "form/core saveFormData\uFF08formDataId+\u4E50\u89C2\u9501\uFF1Bdataset v2 \u5BF9\u4EBA\u624D\u8868\u5931\u660E\u5DF2\u5F03\u7528\uFF09",
3441
3961
  talentId: updateTalentId,
3442
3962
  afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
3443
3963
  verifyWarnings: verifyWarnings.length ? verifyWarnings : void 0,
@@ -3447,7 +3967,22 @@ async function applyCore(args, env, payload) {
3447
3967
  parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || "(\u7A7A)" }
3448
3968
  });
3449
3969
  }
3450
- if (!payload.built) {
3970
+ const signedDup = payload.built && payload.dupCheck && payload.dupCheck.checked === true ? payload.dupCheck : null;
3971
+ if (signedDup && signedDup.unique === false) {
3972
+ const hasBatch = !!(signedDup.byPhoneCandidateId || signedDup.byPhoneTalentId);
3973
+ return rsSuccess("recruit-stage.resume.import.apply", {
3974
+ mode: "apply",
3975
+ result: "duplicate",
3976
+ message: hasBatch ? "\u5F53\u524D\u624B\u673A\u53F7\u5DF2\u7ED1\u5B9A\u4EBA\u624D\u4FE1\u606F\uFF0C\u6309\u9875\u9762\u89C4\u5219\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09" : "\u624B\u673A\u53F7\u5728\u4EBA\u624D\u5E93\u5DF2\u5B58\u5728\uFF08\u8868\u5355\u552F\u4E00\u6027\u547D\u4E2D\uFF0C\u4F46\u65E0\u5E94\u8058\u6279\u6B21\uFF09\uFF0C\u4E0D\u65B0\u5EFA\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09",
3977
+ existingTalent: hasBatch ? {
3978
+ talentId: signedDup.byPhoneTalentId || "",
3979
+ candidateId: signedDup.byPhoneCandidateId || ""
3980
+ } : void 0,
3981
+ parsed: { name: built.structured.candidateName, mobile: built.structured.telephone },
3982
+ nextStep: "\u5982\u9700\u6309\u8FD9\u4EFD\u7B80\u5386\u66F4\u65B0\u8BE5\u4EBA\u624D\uFF0C\u660E\u786E\u8BF4\u660E\u5373\u53EF\uFF08updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\uFF09"
3983
+ });
3984
+ }
3985
+ if (!signedDup) {
3451
3986
  const dupInfo = await findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone });
3452
3987
  if (dupInfo.byPhone?.candidateId || dupInfo.byPhone?.talentId) {
3453
3988
  const b = dupInfo.byPhone;
@@ -3486,16 +4021,11 @@ async function applyCore(args, env, payload) {
3486
4021
  newId = created.dataId;
3487
4022
  writeChannel = "dataset/v2/saveFormData\uFF08\u4E3B\u8868 + \u660E\u7EC6\u4E00\u6B21\u5199\u5165\uFF09";
3488
4023
  } catch (e) {
3489
- writeWarnings.push("\u6570\u636E\u96C6\u65B0\u589E\u672A\u901A\u8FC7\uFF08" + e.message + "\uFF09\uFF0C\u6539\u4E3A\u5EFA\u4E3B\u8868\u540E\u7528\u6570\u636E\u96C6 update \u8865\u660E\u7EC6");
3490
- newId = await saveFormData(host, { appId: ctx.appId, formId: built.formId, objId: built.objId, name: built.structured.candidateName || "\u7B80\u5386\u5BFC\u5165", dataDetails: built.dataDetails });
3491
- writeChannel = "form/core/saveFormData\uFF08\u4E3B\u8868\uFF09+ dataset/v2/updateFormData\uFF08\u660E\u7EC6\uFF09";
3492
- if (Object.keys(built.detailsPayload).length) {
3493
- try {
3494
- await datasetUpdateFormData(host, { objId: built.objId, dataId: newId, mainTable: {}, details: built.detailsPayload });
3495
- } catch (e2) {
3496
- writeWarnings.push("\u56DE\u9000\u540E\u8865\u660E\u7EC6\u5931\u8D25\uFF1A" + e2.message);
3497
- }
3498
- }
4024
+ writeWarnings.push("\u6570\u636E\u96C6\u65B0\u589E\u672A\u901A\u8FC7\uFF08" + e.message + "\uFF09\uFF0C\u56DE\u9000\u9875\u9762\u7EA7\u901A\u9053\uFF1A\u4E3B\u8868+\u660E\u7EC6\u4E00\u6B21\u5199\u5165");
4025
+ const subCells = buildSubFormCells(built, {}, makeDictLookup(ctx.cache));
4026
+ newId = await saveFormData(host, { appId: ctx.appId, formId: built.formId, objId: built.objId, name: built.structured.candidateName || "\u7B80\u5386\u5BFC\u5165", dataDetails: [...built.dataDetails, ...subCells.cells] });
4027
+ writeChannel = "form/core/saveFormData\uFF08\u4E3B\u8868 + \u660E\u7EC6 subForm \u4E00\u6B21\u5199\u5165\uFF09";
4028
+ writeWarnings.push(...subCells.droppedCells);
3499
4029
  }
3500
4030
  mark("apply.saveFormData");
3501
4031
  const r2 = await host.request({ path: "/api/recruit/candidate/initTalentBatch?formDataId=" + newId, method: "POST" });
@@ -3613,7 +4143,6 @@ async function applyCore(args, env, payload) {
3613
4143
  // 产物链接(Agent 原样搬运:① 人才卡片单页 ② 人才库列表;缺失哪个只给另一个)
3614
4144
  viewLink: talentCardUrl ? `[\u67E5\u770B ${built.structured.candidateName || "\u65B0\u4EBA\u624D"} \u7684\u4EBA\u624D\u5361\u7247](${talentCardUrl})` : null,
3615
4145
  listLocateLink: talentListLocateUrl ? `[\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](${talentListLocateUrl})` : null,
3616
- agentNote: "\u6B63\u6587\u7ED9\u4E24\u4E2A Markdown \u94FE\u63A5\u2014\u2014\u2460 [\u67E5\u770B <\u59D3\u540D> \u7684\u4EBA\u624D\u5361\u7247](talentCardUrl) \u8BE6\u60C5\u5355\u9875 \u2461 [\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](talentListLocateUrl) \u53EA\u6253\u5F00\u5217\u8868\u3001\u4E0D\u6253\u5F00\u8BE6\u60C5\uFF1B\u7F3A\u5931\u54EA\u4E2A\u5C31\u53EA\u7ED9\u53E6\u4E00\u4E2A\uFF0C\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u4E0D\u8981\u7528 artifact / browsertool\u3002",
3617
4146
  parsed: {
3618
4147
  name: built.structured.candidateName,
3619
4148
  mobile: built.structured.telephone,
@@ -3742,7 +4271,7 @@ async function batchPrepare(args, env) {
3742
4271
  }
3743
4272
  });
3744
4273
  }
3745
- const fp = createHash3("sha256").update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest("hex");
4274
+ const fp = createHash4("sha256").update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest("hex");
3746
4275
  const store = saveBatchItems("resume-import", ready);
3747
4276
  const continuation = await env.continuation.issue({
3748
4277
  operation: "recruit-stage.resume.import.batch.apply",
@@ -3839,8 +4368,7 @@ async function batchApply(args, env) {
3839
4368
  skippedAtPrepare: blockedAtPrepare,
3840
4369
  skippedTotal: blockedAtPrepare + skipped,
3841
4370
  items: results,
3842
- resultTable: lines.join("\n"),
3843
- agentNote: "\u628A resultTable \u539F\u6837\u653E\u56DE\u7B54\u6B63\u6587\u3002\u6C47\u603B\u5FC5\u987B\u8BF4\u5168\u56DB\u7C7B\uFF1A\u6210\u529F / \u90E8\u5206\u6210\u529F / \u8DF3\u8FC7\uFF08\u91CD\u590D\uFF0C\u4E0D\u65B0\u5EFA\uFF09/ \u5931\u8D25\uFF1B\u8DF3\u8FC7\u6570 = skippedAtPrepare\uFF08\u51C6\u5907\u9636\u6BB5\u67E5\u91CD\uFF09+ skipped\uFF08\u5EFA\u6863\u65F6\u53D1\u73B0\u91CD\u590D\uFF09\uFF1B\u5931\u8D25\u6216\u90E8\u5206\u6210\u529F\u8981\u5E26 message \u539F\u56E0\uFF0C\u4E0D\u8981\u53EA\u62A5\u603B\u6570\u3002\u672B\u5C3E\u9644\u300C\u4EBA\u624D\u5E93\u300D\u56FA\u5B9A\u5730\u5740\u4E00\u4E2A\u94FE\u63A5\u3002"
4371
+ resultTable: lines.join("\n")
3844
4372
  });
3845
4373
  }
3846
4374
  var resumeImportOperations = [
@@ -4318,7 +4846,7 @@ async function resolveSaveActions(plan) {
4318
4846
  async function callAssignedInterview(host, formDataId) {
4319
4847
  const r = await host.request({ path: "/api/recruit/candidate/assignedInterview?formDataId=" + formDataId, method: "POST" });
4320
4848
  const ok = String(r?.code) === "200" || r?.status === true || r?.success === true;
4321
- if (!ok) throw rsFail("\u5206\u914D\u9762\u8BD5\uFF08assignedInterview\uFF09\u5931\u8D25\uFF1A" + (r?.msg || JSON.stringify(r).slice(0, 200)));
4849
+ if (!ok) throw rsFail("\u5206\u914D\u9762\u8BD5\uFF08assignedInterview\uFF09\u5931\u8D25\uFF1A" + (r?.msg || JSON.stringify(r).slice(0, 200)) + "\u3002\u26A0\uFE0F \u9762\u8BD5\u8BB0\u5F55\u5DF2\u4FDD\u5B58\uFF08formDataId=" + formDataId + "\uFF0C\u72B6\u6001\u505C\u7559\u5728\u8868\u5355\u9ED8\u8BA4\u503C\uFF0C\u901A\u5E38\u4E3A\u300C\u672A\u5F00\u59CB\u300D\uFF09\uFF1B\u4E0D\u8981\u91CD\u65B0 apply\uFF08\u4F1A\u91CD\u590D\u521B\u5EFA\u9762\u8BD5\u8BB0\u5F55\uFF09\u3002\u8BF7\u5230\u9762\u8BD5\u7BA1\u7406\u5217\u8868\u67E5\u770B\u8BE5\u8BB0\u5F55\uFF0C\u4FEE\u6B63\u804C\u4F4D\u6D41\u7A0B\u914D\u7F6E\u540E\u7528 updateTalentId \u8D70\u66F4\u65B0\u901A\u9053\u3002\u5E38\u89C1\u539F\u56E0\uFF1A\u804C\u4F4D\u672A\u914D\u7F6E\u62DB\u8058\u6D41\u7A0B\uFF08\u6D41\u7A0B ID \u4E3A\u7A7A\uFF09\u3002");
4322
4850
  return r?.data || {};
4323
4851
  }
4324
4852
  async function execSaveActions(plan, formDataId) {
@@ -4340,7 +4868,7 @@ async function execSaveActions(plan, formDataId) {
4340
4868
  const r = await runEsb(host, { objId: plan.objId, dataIds: formDataId, esbActionIds: a.id });
4341
4869
  const ok = r?.status !== false;
4342
4870
  executed.push({ ...base, ok, msg: r?.successMsg || r?.failMsg || "" });
4343
- if (!ok) throw rsFail("\u300C\u4FDD\u5B58\u300D\u540E\u7EED\u52A8\u4F5C\u300C" + (a.name || a.id) + "\u300D\u6267\u884C\u5931\u8D25\uFF1A" + (r?.failMsg || "\u672A\u77E5\u539F\u56E0"));
4871
+ if (!ok) throw rsFail("\u300C\u4FDD\u5B58\u300D\u540E\u7EED\u52A8\u4F5C\u300C" + (a.name || a.id) + "\u300D\u6267\u884C\u5931\u8D25\uFF1A" + (r?.failMsg || "\u672A\u77E5\u539F\u56E0") + "\u3002\u26A0\uFE0F \u9762\u8BD5\u8BB0\u5F55\u5DF2\u4FDD\u5B58\u5E76\u5206\u914D\u6210\u529F\uFF08formDataId=" + formDataId + "\uFF09\uFF0C\u8BE5\u540E\u7EED\u52A8\u4F5C\u4E0D\u5F71\u54CD\u9762\u8BD5\u8BB0\u5F55\u672C\u8EAB\uFF1B\u4E0D\u8981\u91CD\u65B0 apply\uFF08\u4F1A\u91CD\u590D\u521B\u5EFA\uFF09\u3002");
4344
4872
  } else if (a.actionType === "jsCode") {
4345
4873
  if (ASSIGNED_API_RE.test(a.ecode || "")) {
4346
4874
  assigned = await callAssignedInterview(host, formDataId);
@@ -4392,14 +4920,18 @@ async function resolveInterviewListUrl(ctx) {
4392
4920
  if (cachedMenu?.listId && cachedMenu.combinationId) {
4393
4921
  return `${baseUrl}/ebdapp/view/${appId}/combination/${cachedMenu.combinationId}-${cachedMenu.listId || cachedMenu.cusMenuId}/search/${cachedMenu.pageId || cachedMenu.cusMenuId}?terminal=PC&cusMenuId=${cachedMenu.cusMenuId}`;
4394
4922
  }
4395
- const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
4396
4923
  const flat = [];
4397
- (function walk2(ns) {
4398
- for (const n of ns || []) if (n && typeof n === "object") {
4399
- flat.push(n);
4400
- walk2(n.children || n.childs);
4401
- }
4402
- })(r?.data?.cusAppMenus || r?.data);
4924
+ try {
4925
+ const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
4926
+ (function walk2(ns) {
4927
+ for (const n of toMenuList(ns)) if (n && typeof n === "object") {
4928
+ flat.push(n);
4929
+ walk2(n.children ?? n.childs);
4930
+ }
4931
+ })(r?.data);
4932
+ } catch {
4933
+ return null;
4934
+ }
4403
4935
  const node = findMenuNode(flat, ["\u9762\u8BD5\u7BA1\u7406", "\u9762\u8BD5\u5B89\u6392\u5217\u8868", "\u9762\u8BD5\u5B89\u6392"], (n) => n.combinationId && n.id && n.pageId);
4404
4936
  if (!node) return null;
4405
4937
  return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
@@ -4493,8 +5025,8 @@ async function prepare3(args, env, opts = {}) {
4493
5025
  }
4494
5026
  const defaultAiPlan = defPlan?.optionId ? { id: defPlan.optionId, name: defPlan.content } : void 0;
4495
5027
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
4496
- const { createHash: createHash4 } = await import("node:crypto");
4497
- const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
5028
+ const { createHash: createHash5 } = await import("node:crypto");
5029
+ const fp = createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex");
4498
5030
  const continuation = await env.continuation.issue({
4499
5031
  operation: "recruit-stage.interview.arrange.apply",
4500
5032
  fingerprint: fp,
@@ -4576,8 +5108,8 @@ async function applyCore2(args, env, payload) {
4576
5108
  throw rsFail("AI\u9762\u8BD5\u5FC5\u987B\u9009\u62E9\u300CAI\u9762\u8BD5\u65B9\u6848\u300D\uFF08\u5FC5\u586B\uFF09\uFF0C\u5F53\u524D\u672A\u6307\u5B9A\u3002\u53EF\u9009\u65B9\u6848\uFF1A" + (plan.aiPlanOptions.items?.length ? planBrief(plan.aiPlanOptions.items) : "\uFF08\u65E0\uFF09") + "\u3002\u8BF7\u8BA9\u7528\u6237\u9009\u62E9\u540E\u5E26 aiPlan \u91CD\u8BD5\u3002");
4577
5109
  }
4578
5110
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
4579
- const { createHash: createHash4 } = await import("node:crypto");
4580
- if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5111
+ const { createHash: createHash5 } = await import("node:crypto");
5112
+ if (payload.fingerprint !== createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
4581
5113
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
4582
5114
  }
4583
5115
  const formDataId = await saveFormData(ctx.host, {
@@ -4627,7 +5159,6 @@ async function applyCore2(args, env, payload) {
4627
5159
  interviewer: plan.summary.interviewer,
4628
5160
  viewLink: detailUrl ? `[\u67E5\u770B ${plan.cand.name || ""} \u7684\u9762\u8BD5\u5B89\u6392\u8BE6\u60C5](${detailUrl})` : null,
4629
5161
  listLocateLink: listLocateUrl ? `[\u6253\u5F00\u9762\u8BD5\u7BA1\u7406\u5217\u8868](${listLocateUrl})` : null,
4630
- agentNote: "\u4EA7\u7269 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF08\u5E73\u53F0\u5B9E\u8BC1\u53EF\u70B9\u51FB\uFF09\uFF1A\u2460 viewLink \u9762\u8BD5\u5B89\u6392\u8BE6\u60C5\u5355\u9875\uFF08\u539F\u6837\u642C\u8FD0\uFF0C\u4E0D\u6539\uFF09\u2461 listLocateLink \u9762\u8BD5\u5217\u8868\u2014\u2014\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u7528\u56FA\u5B9A\u8DEF\u7531\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA viewLink\uFF09\uFF0C\u5426\u5219\u539F\u6837\u642C\u8FD0\u3002\u6309\u987A\u5E8F\u653E\u56DE\u7B54\u6B63\u6587\uFF0C\u7F3A\u54EA\u4E2A\u53EA\u7ED9\u53E6\u4E00\u4E2A\u3001\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u4E0D\u8981\u5305 browsertool / <artifact> \u6807\u7B7E\u3002",
4631
5162
  aiPlan: plan.isAI && plan.aiPlanPicked ? { id: plan.aiPlanPicked.id, name: plan.aiPlanPicked.name } : void 0,
4632
5163
  saveActions: actionsRun.executed,
4633
5164
  verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
@@ -4753,8 +5284,8 @@ async function batchPrepare2(args, env) {
4753
5284
  }
4754
5285
  });
4755
5286
  }
4756
- const { createHash: createHash4 } = await import("node:crypto");
4757
- const fp = createHash4("sha256").update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest("hex");
5287
+ const { createHash: createHash5 } = await import("node:crypto");
5288
+ const fp = createHash5("sha256").update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest("hex");
4758
5289
  const continuation = await env.continuation.issue({
4759
5290
  operation: "recruit-stage.interview.arrange.batch.apply",
4760
5291
  fingerprint: fp,
@@ -4832,8 +5363,7 @@ async function batchApply2(args, env) {
4832
5363
  partial,
4833
5364
  failed,
4834
5365
  items: results,
4835
- resultTable: lines.join("\n"),
4836
- agentNote: "\u628A resultTable \u539F\u6837\u653E\u56DE\u7B54\u6B63\u6587\uFF08\u8FD9\u662F\u672C\u6B21\u6279\u91CF\u7EA6\u9762\u7684\u7ED3\u679C\u6E05\u5355\uFF09\uFF1B\u5931\u8D25/\u90E8\u5206\u6210\u529F\u7684\u6761\u76EE\u8981\u8FDE\u540C message \u4E00\u8D77\u8BF4\u6E05\u695A\uFF0C\u4E0D\u8981\u53EA\u62A5\u603B\u6570\u3002"
5366
+ resultTable: lines.join("\n")
4837
5367
  });
4838
5368
  }
4839
5369
  var interviewArrangeOperations = [
@@ -5011,8 +5541,8 @@ async function prepare4(args, env) {
5011
5541
  const newComment = args.comment !== void 0 ? String(args.comment) : t.target.judgement;
5012
5542
  const newResultName = args.result ? String(args.result) : t.target.result;
5013
5543
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
5014
- const { createHash: createHash4 } = await import("node:crypto");
5015
- const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
5544
+ const { createHash: createHash5 } = await import("node:crypto");
5545
+ const fp = createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex");
5016
5546
  const continuation = await env.continuation.issue({
5017
5547
  operation: "recruit-stage.interview.feedback.edit.apply",
5018
5548
  fingerprint: fp,
@@ -5073,8 +5603,8 @@ async function apply4(args, env) {
5073
5603
  const newComment = merged.comment !== void 0 ? String(merged.comment) : t.target.judgement;
5074
5604
  const newResultName = merged.result ? String(merged.result) : t.target.result;
5075
5605
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
5076
- const { createHash: createHash4 } = await import("node:crypto");
5077
- if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5606
+ const { createHash: createHash5 } = await import("node:crypto");
5607
+ if (payload.fingerprint !== createHash5("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
5078
5608
  throw rsValidationError("fingerprint_mismatch", "\u5F85\u63D0\u4EA4\u5185\u5BB9\u4E0E prepare \u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare \u786E\u8BA4\u540E\u518D apply");
5079
5609
  }
5080
5610
  const newDetails = details2.map((x) => {
@@ -5199,6 +5729,52 @@ var TYPES = {
5199
5729
  candidate: { listKey: "candidate", formType: "candidate_manage", title: "\u5E94\u8058\u8005", menuNames: ["\u5E94\u8058\u8005", "\u5E94\u8058\u7BA1\u7406", "\u5019\u9009\u4EBA", "\u5E94\u8058\u6279\u6B21"] }
5200
5730
  };
5201
5731
  var FEEDBACK_TODO_MENU_NAMES = ["\u6211\u7684\u9762\u8BD5", "\u6211\u7684\u9762\u8BD5\u5B89\u6392", "\u6211\u53C2\u4E0E\u7684\u9762\u8BD5"];
5732
+ function participationOf(r) {
5733
+ const tp = String(r?.interview_type_key || r?.interview_type || "").trim();
5734
+ const pick = (...keys) => {
5735
+ for (const k of keys) {
5736
+ const v = r?.[k];
5737
+ if (v === void 0 || v === null) continue;
5738
+ const s = String(v).trim();
5739
+ if (s) return { key: k, val: s };
5740
+ }
5741
+ return null;
5742
+ };
5743
+ if (/现场/.test(tp)) {
5744
+ const got2 = pick("interview_location");
5745
+ return {
5746
+ mode: "\u73B0\u573A\u9762\u8BD5",
5747
+ field: "interview_location",
5748
+ value: got2?.val ?? null,
5749
+ ...got2 ? {} : { note: "\u5217\u8868\u672A\u8FD4\u56DE\u9762\u8BD5\u5730\u70B9\uFF1B\u9700\u5728 E10 \u540E\u53F0\u628A\u300C\u9762\u8BD5\u5730\u70B9\u300D\u52A0\u5165\u9762\u8BD5\u7BA1\u7406\u5217\u8868\u663E\u793A\u5217" }
5750
+ };
5751
+ }
5752
+ if (/AI\s*面试/i.test(tp)) {
5753
+ const got2 = pick("applet_code");
5754
+ return {
5755
+ mode: "AI\u9762\u8BD5",
5756
+ field: "applet_code",
5757
+ value: got2?.val ?? null,
5758
+ ...got2 ? {} : { note: "AI \u9762\u8BD5\u4EE5\u5C0F\u7A0B\u5E8F\u7801/\u94FE\u63A5\u9080\u7EA6\uFF0C\u672C\u8EAB\u6CA1\u6709\u5730\u70B9" }
5759
+ };
5760
+ }
5761
+ if (/视频/.test(tp)) {
5762
+ const got2 = pick("video_url_info", "meeting_vedio", "meeting_id");
5763
+ return {
5764
+ mode: "\u89C6\u9891\u9762\u8BD5",
5765
+ field: got2?.key ?? "video_url_info",
5766
+ value: got2?.val ?? null,
5767
+ ...got2 ? {} : { note: "\u89C6\u9891\u9762\u8BD5\u4EE5\u89C6\u9891\u94FE\u63A5/\u4F1A\u8BAE\u53F7\u9080\u7EA6\uFF0C\u672C\u8EAB\u6CA1\u6709\u5730\u70B9" }
5768
+ };
5769
+ }
5770
+ const got = pick("interview_location");
5771
+ return {
5772
+ mode: tp || "\u672A\u586B\u9762\u8BD5\u65B9\u5F0F",
5773
+ field: "interview_location",
5774
+ value: got?.val ?? null,
5775
+ ...got ? {} : { note: "\u8BE5\u9762\u8BD5\u65B9\u5F0F\u672A\u914D\u7F6E\u53C2\u4E0E\u65B9\u5F0F\u5B57\u6BB5\uFF0C\u6216\u5217\u8868\u672A\u8FD4\u56DE" }
5776
+ };
5777
+ }
5202
5778
  var DISPLAY_ALIASES = {
5203
5779
  candidate_name: ["talent_id", "name"],
5204
5780
  position_name: ["position_manage_id", "position"],
@@ -5567,6 +6143,9 @@ async function runList(env, args, feedbackTodoMode) {
5567
6143
  break;
5568
6144
  }
5569
6145
  }
6146
+ if (type === "interview") {
6147
+ row.participation = participationOf(r);
6148
+ }
5570
6149
  outRows.push(row);
5571
6150
  }
5572
6151
  if (feedbackTodoMode) {
@@ -5586,7 +6165,9 @@ async function runList(env, args, feedbackTodoMode) {
5586
6165
  subject: r.subject,
5587
6166
  mobile: r.mobile,
5588
6167
  talent_id: r.talent_id,
5589
- position_manage_id: r.position_manage_id
6168
+ position_manage_id: r.position_manage_id,
6169
+ // 参与方式按面试方式取值(现场=地点 / 视频=链接 / AI=小程序码),不要统一当"地点"
6170
+ participation: participationOf(r)
5590
6171
  });
5591
6172
  const pending = serverFilterApplied ? outRows : outRows.filter((r) => /待反馈/.test(st(r)));
5592
6173
  const mineAll = serverFilterApplied ? outRows : me ? pending.filter((r) => iv(r).includes(me)) : [];
@@ -5738,7 +6319,9 @@ async function runInterviewNotAttended(env, args) {
5738
6319
  // 🔴 type=interview 的 talent_id 放的是**候选人姓名**不是 id(已知口径,见聚才林
5739
6320
  // recruit-read.md);下游编排一律用 candidate_manage_id / form_data_id,故此处不透传 talent_id。
5740
6321
  candidate_manage_id: r.candidate_manage_id || null,
5741
- form_data_id: r.form_data_id || null
6322
+ form_data_id: r.form_data_id || null,
6323
+ // 参与方式按面试方式取值(现场=地点 / 视频=链接 / AI=小程序码)
6324
+ participation: participationOf(r)
5742
6325
  };
5743
6326
  };
5744
6327
  const total = base.total;
@@ -5770,7 +6353,6 @@ async function runInterviewNotAttended(env, args) {
5770
6353
  rows: notAttended.map(slim),
5771
6354
  listUrl,
5772
6355
  listLocateLink: listUrl ? { title: "\u6253\u5F00\u6211\u53D1\u8D77\u7684\u9762\u8BD5\u5217\u8868", url: listUrl } : null,
5773
- agentNote: "\u4EA7\u7269 = \u7EDF\u8BA1\u7ED3\u8BBA + \u4E00\u4E2A Markdown \u94FE\u63A5\uFF08listLocateLink\uFF09\u3002\u82E5\u6280\u80FD\u300C\u56FA\u5B9A\u53C2\u6570\u8868\u300D\u914D\u7F6E\u4E86\u672C\u79DF\u6237\u7684\u56FA\u5B9A\u9875\u9762\u8DEF\u7531\uFF0C\u6309 recruit-output-links.md \u8986\u76D6\u89C4\u5219\u66FF\u6362 path \u6BB5\uFF08origin \u53D6\u81EA listUrl\uFF09\uFF1B\u8C03\u7528\u65F6\u76F4\u63A5\u4F20 listId \u66F4\u7A33\u3002\u4E0D\u8F93\u51FA\u534A\u622A\u94FE\u63A5\u3002",
5774
6356
  note: notes.join("\uFF1B")
5775
6357
  };
5776
6358
  }
@@ -5889,7 +6471,24 @@ function clampPageSize(v) {
5889
6471
  if (!Number.isFinite(n) || n <= 0) return 10;
5890
6472
  return Math.min(200, Math.trunc(n));
5891
6473
  }
5892
- async function handler(args, env) {
6474
+ var ledgerObjIdMemo = /* @__PURE__ */ new Map();
6475
+ async function resolveLedgerObjId(host, listId, fallbackObjId) {
6476
+ const key = String(listId || "");
6477
+ if (!key) return String(fallbackObjId);
6478
+ const cached = ledgerObjIdMemo.get(key);
6479
+ if (cached) return cached;
6480
+ try {
6481
+ const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: { listId: key } });
6482
+ const v = String(li?.data?.objid || "");
6483
+ if (v) {
6484
+ ledgerObjIdMemo.set(key, v);
6485
+ return v;
6486
+ }
6487
+ } catch {
6488
+ }
6489
+ return String(fallbackObjId);
6490
+ }
6491
+ async function candidateSearchHandler(args, env) {
5893
6492
  const host = env.host;
5894
6493
  const session = await host.getSession();
5895
6494
  const baseUrl = session.baseUrl.replace(/\/+$/, "");
@@ -5903,6 +6502,7 @@ async function handler(args, env) {
5903
6502
  const cusMenuId = talent.cusMenuId;
5904
6503
  const menuName = talent.menuName || "\u4EBA\u624D\u7BA1\u7406";
5905
6504
  const fields = cache.fields[objId] || {};
6505
+ const ledgerObjId = await resolveLedgerObjId(host, String(listId), String(objId));
5906
6506
  const nameField = "field_" + (fields.candidate_name || fields.name);
5907
6507
  const mobileField = "field_" + fields.telephone;
5908
6508
  const name = args.name ? String(args.name) : "";
@@ -5915,22 +6515,33 @@ async function handler(args, env) {
5915
6515
  let searchType = "and";
5916
6516
  let searchFields;
5917
6517
  let searchNote;
6518
+ let keywordIgnored;
6519
+ if (keyword && (name || mobile)) {
6520
+ keywordIgnored = {
6521
+ keyword,
6522
+ reason: "keyword \u4E0E name/mobile \u4E92\u65A5\uFF1A\u672C\u6B21\u6309 name/mobile \u7CBE\u786E\u6761\u4EF6\u8FC7\u6EE4\uFF0Ckeyword \u5DF2\u5FFD\u7565\uFF1B\u5982\u9700\u8DE8\u5B57\u6BB5\u5173\u952E\u8BCD\u641C\u7D22\uFF0C\u8BF7\u4E0D\u8981\u540C\u65F6\u4F20\u59D3\u540D/\u624B\u673A\u53F7"
6523
+ };
6524
+ }
5918
6525
  if (keyword && !name && !mobile) {
5919
6526
  searchType = "or";
5920
6527
  const meta = await resolveListSearchMeta(host, String(listId));
5921
6528
  const used = [];
6529
+ const fellBack = [];
5922
6530
  for (const dk of KEYWORD_TEXT_FIELDS) {
5923
6531
  const fid = fields[dk];
5924
6532
  if (!fid) continue;
5925
6533
  const bare = String(fid);
5926
6534
  const mk = "field_" + bare;
5927
- const op = meta.operators[bare] || "like";
5928
- conds[mk] = [{ [mk]: keyword, [mk + "_condition_type"]: op }];
5929
- used.push({ field: dk, label: meta.labels[bare] || dk, operator: op });
6535
+ const norm = normalizeListOperator(meta.operators[bare]);
6536
+ if (norm.fellBack) fellBack.push(meta.labels[bare] || dk);
6537
+ conds[mk] = [{ [mk]: keyword, [mk + "_condition_type"]: norm.op }];
6538
+ used.push({ field: dk, label: meta.labels[bare] || dk, operator: norm.op, ...norm.fellBack ? { operatorFallback: true } : {} });
5930
6539
  }
5931
6540
  searchFields = used;
5932
6541
  if (!used.length) {
5933
6542
  searchNote = "\u5173\u952E\u8BCD\u641C\u7D22\u672A\u5B9A\u4F4D\u5230\u4EFB\u4F55\u53EF\u7528\u5B57\u6BB5\uFF08\u73AF\u5883\u7F13\u5B58 fields \u4E0E\u76EE\u6807\u5B57\u6BB5\u6E05\u5355\u65E0\u4EA4\u96C6\uFF09\uFF0C\u672C\u6B21\u672A\u505A\u5173\u952E\u8BCD\u8FC7\u6EE4\uFF0C\u8FD4\u56DE\u7684\u662F\u5168\u5E93\u5206\u9875\u7ED3\u679C\uFF1B\u8BF7\u6539\u7528 name/mobile \u7CBE\u786E\u641C\u7D22";
6543
+ } else if (fellBack.length) {
6544
+ searchNote = `\u5B57\u6BB5\u300C${fellBack.join("\u3001")}\u300D\u914D\u7F6E\u7684\u64CD\u4F5C\u7B26\u4E0D\u5728\u5217\u8868\u67E5\u8BE2\u5DF2\u77E5\u96C6\u5408\u5185\uFF0C\u5DF2\u56DE\u9000 like\uFF1B\u5982\u9700\u7CBE\u786E\u5339\u914D\u8BF7\u6539\u7528 name/mobile`;
5934
6545
  }
5935
6546
  }
5936
6547
  const wantPageSize = clampPageSize(args.pageSize);
@@ -5959,12 +6570,12 @@ async function handler(args, env) {
5959
6570
  delete cntBody.pageSize;
5960
6571
  const [resp, c] = await Promise.all([
5961
6572
  host.request({
5962
- path: "/api/ebuilder/form/list/getListDatas?passid=" + objId + "&cid=" + objId,
6573
+ path: "/api/ebuilder/form/list/getListDatas?passid=" + ledgerObjId + "&cid=" + ledgerObjId,
5963
6574
  body: baseBody,
5964
6575
  headers: extra
5965
6576
  }),
5966
6577
  host.request({
5967
- path: "/api/ebuilder/form/list/getListDataCount?passid=" + objId + "&cid=" + objId,
6578
+ path: "/api/ebuilder/form/list/getListDataCount?passid=" + ledgerObjId + "&cid=" + ledgerObjId,
5968
6579
  body: cntBody,
5969
6580
  headers: extra
5970
6581
  }).catch(() => null)
@@ -5986,6 +6597,7 @@ async function handler(args, env) {
5986
6597
  // 条件被服务端静默忽略时(total 与全库相同)调用方无从判断,有了这个清单才能自查。
5987
6598
  ...searchFields ? { keyword, searchFields } : {},
5988
6599
  ...searchNote ? { searchNote } : {},
6600
+ ...keywordIgnored ? { keywordIgnored } : {},
5989
6601
  rows: []
5990
6602
  };
5991
6603
  const outRows = out.rows;
@@ -6039,6 +6651,9 @@ async function handler(args, env) {
6039
6651
  fetched,
6040
6652
  matched: kept.length,
6041
6653
  fetchPageSize,
6654
+ // 🔴 2026-11-28 修「total 语义歧义」:顶层 total 是**服务端未过滤**的总数(关键词命中全量),
6655
+ // 不是时间段内的数量。这里显式带出,避免调用方把 total 当成「半年内有多少人」。
6656
+ totalUnfiltered: total,
6042
6657
  // 🔴 必须显式声明「命中数 ≠ 该时间段全库总数」:客户端只能筛已取回的行,
6043
6658
  // 不写清会让调用方把 matched 当成真实总数,进而误判「半年内只有这么多人」。
6044
6659
  note: kept.length < wantPageSize ? `\u670D\u52A1\u7AEF\u4E0D\u652F\u6301\u6309\u521B\u5EFA\u65F6\u95F4\u8FC7\u6EE4\uFF0C\u5DF2\u5BA2\u6237\u7AEF\u7B5B\u9009\uFF1A\u53D6\u56DE ${fetched} \u884C\u3001\u547D\u4E2D ${kept.length} \u884C\uFF08\u5C11\u4E8E\u671F\u671B ${wantPageSize}\uFF09\u3002\u547D\u4E2D\u6570\u4E0D\u4EE3\u8868\u8BE5\u65F6\u95F4\u6BB5\u5168\u5E93\u603B\u6570\uFF0C\u53EF\u52A0\u5927 pageSize \u6216\u7FFB\u9875\u540E\u91CD\u67E5` : `\u670D\u52A1\u7AEF\u4E0D\u652F\u6301\u6309\u521B\u5EFA\u65F6\u95F4\u8FC7\u6EE4\uFF0C\u5DF2\u5BA2\u6237\u7AEF\u7B5B\u9009\uFF1A\u53D6\u56DE ${fetched} \u884C\u3001\u547D\u4E2D ${kept.length} \u884C`
@@ -6058,6 +6673,13 @@ function clampInt(v, min, max, fallback) {
6058
6673
  function normTag(s) {
6059
6674
  return String(s == null ? "" : s).trim().toLowerCase();
6060
6675
  }
6676
+ var LIST_QUERY_OPS = /* @__PURE__ */ new Set(["like", "eq", "neq", "ne", "in", "between", "inc", "contains", "notlike", "uncontains"]);
6677
+ function normalizeListOperator(raw) {
6678
+ const rawStr = String(raw ?? "").trim();
6679
+ const s = rawStr.toLowerCase();
6680
+ if (s && LIST_QUERY_OPS.has(s)) return { op: rawStr, fellBack: false };
6681
+ return { op: "like", fellBack: true };
6682
+ }
6061
6683
  function firstConditionType(it) {
6062
6684
  const ct = it?.conditionType ?? it?.conditionTypeValue ?? it?.conditionTypes ?? it?.conditions;
6063
6685
  const pick = (v) => {
@@ -6203,12 +6825,7 @@ async function handlerSearchByTag(args, env) {
6203
6825
  });
6204
6826
  }
6205
6827
  const keys = await resolveListSearchMeta(host, String(listId));
6206
- let ledgerObjId = String(objId);
6207
- try {
6208
- const li = await host.request({ path: "/api/ebuilder/form/list/listInit", body: { listId: String(listId) } });
6209
- if (li?.data?.objid) ledgerObjId = String(li.data.objid);
6210
- } catch {
6211
- }
6828
+ const ledgerObjId = await resolveLedgerObjId(host, String(listId), String(objId));
6212
6829
  const listPath = "/api/ebuilder/form/list/getListDatas?passid=" + ledgerObjId + "&cid=" + ledgerObjId;
6213
6830
  const countPath = "/api/ebuilder/form/list/getListDataCount?passid=" + ledgerObjId + "&cid=" + ledgerObjId;
6214
6831
  const headers = { ebBusinessId: listId };
@@ -6395,7 +7012,7 @@ var searchOperations = [
6395
7012
  pageSize: { type: "integer", minimum: 1, maximum: 100 },
6396
7013
  current: { type: "integer", minimum: 1 }
6397
7014
  }, {}),
6398
- handler
7015
+ handler: candidateSearchHandler
6399
7016
  },
6400
7017
  {
6401
7018
  name: "recruit-stage.candidate.searchByTag",
@@ -6702,8 +7319,9 @@ function makeDictLookup2(cache) {
6702
7319
  function detailDisplayValue(d, dictName) {
6703
7320
  if (!d) return "";
6704
7321
  if (Array.isArray(d.dataOptions) && d.dataOptions.length) {
6705
- const o = d.dataOptions[0];
6706
- return String(o?.content ?? o?.optionId ?? "");
7322
+ const names = d.dataOptions.map((o) => String(o?.content ?? "")).filter(Boolean);
7323
+ if (names.length) return names.join(",");
7324
+ return String(d.dataOptions[0]?.optionId ?? "");
6707
7325
  }
6708
7326
  if (d.dataText?.content != null) return String(d.dataText.content);
6709
7327
  if (d.content != null) {
@@ -6842,10 +7460,123 @@ var profileOperations = [
6842
7460
  }
6843
7461
  ];
6844
7462
 
7463
+ // src/shortcuts/recruit-stage/operations/shortlist.ts
7464
+ function clampInt2(v, min, max, fallback) {
7465
+ const n = Number(v);
7466
+ if (!Number.isFinite(n)) return fallback;
7467
+ return Math.min(max, Math.max(min, Math.trunc(n)));
7468
+ }
7469
+ function slimProfile(profile, full) {
7470
+ if (full) return profile || {};
7471
+ const basic = profile?.basic || {};
7472
+ const rawMain = profile?.rawMain || {};
7473
+ return {
7474
+ talentId: profile?.talentId || "",
7475
+ name: basic.name || "",
7476
+ degree: basic.degree || "",
7477
+ college: basic.college || "",
7478
+ current_position: basic.current_position || "",
7479
+ current_industry: basic.current_industry || "",
7480
+ intend_position: basic.intend_position || "",
7481
+ expect_salary: basic.expect_salary || "",
7482
+ location_area: basic.location_area || "",
7483
+ graduate_date: basic.graduate_date || "",
7484
+ recruit_status: basic.recruit_status || "",
7485
+ // 渠道导入的人才,工作年限常只落在 rawMain.work_exp,这里提出到顶层方便直接读
7486
+ work_exp: rawMain.work_exp || "",
7487
+ education: profile?.education || [],
7488
+ workExperience: profile?.workExperience || [],
7489
+ projectExperience: profile?.projectExperience || [],
7490
+ subTableStats: profile?.subTableStats || {},
7491
+ ...profile?.warnings ? { warnings: profile.warnings } : {}
7492
+ };
7493
+ }
7494
+ async function handlerShortlist(args, env) {
7495
+ const keyword = String(args.keyword || "").trim();
7496
+ if (!keyword) {
7497
+ throw rsFail('keyword \u5FC5\u586B\uFF1A\u8BF7\u63D0\u4F9B\u8981\u68C0\u7D22\u7684\u5173\u952E\u8BCD\uFF0C\u4F8B\u5982 {"keyword":"Java\u5F00\u53D1"}');
7498
+ }
7499
+ const limit = clampInt2(args.limit, 1, 10, 5);
7500
+ const concurrency = clampInt2(args.concurrency, 1, 10, 5);
7501
+ const full = args.full === true;
7502
+ const startedAt = Date.now();
7503
+ const tSearch = Date.now();
7504
+ const searchEnv = await candidateSearchHandler(
7505
+ {
7506
+ keyword,
7507
+ pageSize: limit,
7508
+ ...args.current ? { current: Number(args.current) } : {}
7509
+ },
7510
+ env
7511
+ );
7512
+ const sdata = searchEnv?.data || {};
7513
+ const rows = (sdata.rows || []).slice(0, limit);
7514
+ const searchMs = Date.now() - tSearch;
7515
+ const tProfiles = Date.now();
7516
+ const candidates = [];
7517
+ const errors = [];
7518
+ for (let i = 0; i < rows.length; i += concurrency) {
7519
+ const batch = rows.slice(i, i + concurrency);
7520
+ const settled = await Promise.allSettled(
7521
+ batch.map((r) => handlerProfile({ talentId: r.talentId }, env))
7522
+ );
7523
+ settled.forEach((s, idx) => {
7524
+ const src = batch[idx] || {};
7525
+ if (s.status === "fulfilled") {
7526
+ const data = s.value?.data || {};
7527
+ candidates.push(slimProfile(data, full));
7528
+ } else {
7529
+ const reason = s.reason;
7530
+ errors.push({
7531
+ talentId: src.talentId || null,
7532
+ name: src.name || null,
7533
+ message: String(reason && reason.message || reason || "\u672A\u77E5\u9519\u8BEF")
7534
+ });
7535
+ }
7536
+ });
7537
+ }
7538
+ const profilesMs = Date.now() - tProfiles;
7539
+ return rsSuccess("recruit-stage.candidate.shortlist", {
7540
+ keyword,
7541
+ // total 是服务端关键词命中总数(不是本次取回数),returned/shown 才是本次实际处理量
7542
+ total: Number(sdata.total) || 0,
7543
+ returned: rows.length,
7544
+ shown: candidates.length,
7545
+ limit,
7546
+ concurrency,
7547
+ ...sdata.searchFields ? { searchFields: sdata.searchFields } : {},
7548
+ ...sdata.searchNote ? { searchNote: sdata.searchNote } : {},
7549
+ listRows: rows,
7550
+ candidates,
7551
+ ...errors.length ? { errors } : {},
7552
+ timing: { searchMs, profilesMs, totalMs: Date.now() - startedAt }
7553
+ });
7554
+ }
7555
+ var shortlistOperations = [
7556
+ {
7557
+ name: "recruit-stage.candidate.shortlist",
7558
+ resource: "recruit.candidate",
7559
+ method: "query",
7560
+ action: "candidate.shortlist",
7561
+ summary: "\u5173\u952E\u8BCD\u4E00\u6B21\u5B8C\u6210\u300C\u641C\u7D22 + \u9010\u4EBA\u6863\u6848\u300D\uFF1A\u53EA\u53D6\u524D limit \u4EBA\u5E76\u5E76\u53D1\u62C9\u53D6\u6863\u6848\uFF0C\u8FD4\u56DE\u7CBE\u7B80\u6863\u6848\uFF08\u5DE5\u4F5C/\u9879\u76EE\u7ECF\u5386\uFF09\u4E0E\u5206\u6BB5\u8017\u65F6\u3002\u7528\u4E8E\u7B80\u5386\u68C0\u7D22\u4E0E\u4EBA\u5C97\u5339\u914D\uFF0C\u66FF\u4EE3\u300C\u5148 search \u518D\u9010\u4EBA profile\u300D\u7684\u591A\u6B21\u5F80\u8FD4",
7562
+ capability: "recruit.candidate.shortlist",
7563
+ risk: "read",
7564
+ inputSchema: schemaOf({
7565
+ keyword: { type: "string", description: "\u8DE8\u5B57\u6BB5\u5173\u952E\u8BCD\uFF08\u5339\u914D\u59D3\u540D/\u671F\u671B\u804C\u4F4D/\u5F53\u524D\u804C\u4F4D/\u6700\u8FD1\u804C\u4F4D/\u516C\u53F8/\u9662\u6821/\u81EA\u6211\u8BC4\u4EF7\uFF09" },
7566
+ limit: { type: "integer", minimum: 1, maximum: 10, description: "\u53D6\u524D N \u4EBA\uFF0C\u9ED8\u8BA4 5\uFF0C\u4E0A\u9650 10" },
7567
+ current: { type: "integer", minimum: 1, description: "\u641C\u7D22\u7ED3\u679C\u8D77\u59CB\u9875\uFF0C\u9ED8\u8BA4 1" },
7568
+ concurrency: { type: "integer", minimum: 1, maximum: 10, description: "\u6863\u6848\u5E76\u53D1\u6570\uFF0C\u9ED8\u8BA4 5" },
7569
+ full: { type: "boolean", description: "true=\u8FD4\u56DE\u5B8C\u6574\u6863\u6848\uFF08\u542B rawMain \u5168\u5B57\u6BB5\uFF09\uFF1B\u9ED8\u8BA4 false \u8FD4\u56DE\u7CBE\u7B80\u6863\u6848" }
7570
+ }, { required: ["keyword"] }),
7571
+ handler: handlerShortlist
7572
+ }
7573
+ ];
7574
+
6845
7575
  // src/shortcuts/recruit-stage/operations/registry.ts
6846
7576
  var definitions = [
6847
7577
  ...searchOperations,
6848
7578
  ...profileOperations,
7579
+ ...shortlistOperations,
6849
7580
  ...listOperations,
6850
7581
  ...tagOperations,
6851
7582
  ...jdCreateOperations,
@@ -6874,10 +7605,12 @@ function getRecruitStageOperation(operation) {
6874
7605
  }
6875
7606
  async function executeRecruitStageOperation(operation, input, env) {
6876
7607
  const definition = getRecruitStageOperation(operation);
7608
+ const debugTimings = input.debugTimings === true;
7609
+ const validated = debugTimings ? Object.fromEntries(Object.entries(input).filter(([k]) => k !== "debugTimings")) : input;
6877
7610
  const schema = definition.inputSchema;
6878
7611
  if (schema && schema.additionalProperties === false) {
6879
7612
  const known = Object.keys(schema.properties || {});
6880
- const unknown = Object.keys(input || {}).filter((key) => !known.includes(key));
7613
+ const unknown = Object.keys(validated || {}).filter((key) => !known.includes(key));
6881
7614
  if (unknown.length > 0) {
6882
7615
  throw new RecruitStageCliError(
6883
7616
  "validation",
@@ -6887,7 +7620,13 @@ async function executeRecruitStageOperation(operation, input, env) {
6887
7620
  );
6888
7621
  }
6889
7622
  }
6890
- return definition.handler(input, env);
7623
+ const startedAt = Date.now();
7624
+ const result = await definition.handler(validated, env);
7625
+ if (debugTimings && result && typeof result === "object") {
7626
+ const marks = { ...env?.__recruitTimings ?? {} };
7627
+ result.meta = { ...result.meta ?? {}, timings: { ...marks, totalMs: Date.now() - startedAt } };
7628
+ }
7629
+ return result;
6891
7630
  }
6892
7631
 
6893
7632
  // src/shortcuts/recruit-stage/manifest.ts
@@ -6918,9 +7657,9 @@ var recruitStageManifest = {
6918
7657
  };
6919
7658
 
6920
7659
  // src/shortcuts/recruit-stage/context.ts
6921
- import { join as join4, resolve as resolve4, dirname as dirname2 } from "node:path";
6922
- import { existsSync as existsSync2 } from "node:fs";
6923
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "node:fs/promises";
7660
+ import { join as join4, resolve as resolve4, dirname as dirname3 } from "node:path";
7661
+ import { existsSync as existsSync3 } from "node:fs";
7662
+ import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
6924
7663
  import { homedir as homedir4 } from "node:os";
6925
7664
  var flowMemo = /* @__PURE__ */ new Map();
6926
7665
  var SELFUSE_DEFAULT_FLOW = {
@@ -6940,7 +7679,7 @@ function cacheDirFor(baseUrl) {
6940
7679
  async function readLegacyCacheExtra(baseUrl) {
6941
7680
  try {
6942
7681
  const dir = cacheDirFor(baseUrl);
6943
- if (!existsSync2(dir)) return { defaultRecruitFlow: null, digitalHumanMenu: null };
7682
+ if (!existsSync3(dir)) return { defaultRecruitFlow: null, digitalHumanMenu: null };
6944
7683
  const files = await (await import("node:fs/promises")).readdir(dir);
6945
7684
  const jsonFiles = files.filter((f) => f.endsWith(".json"));
6946
7685
  let flow = null;
@@ -6948,7 +7687,7 @@ async function readLegacyCacheExtra(baseUrl) {
6948
7687
  for (const f of jsonFiles) {
6949
7688
  let raw;
6950
7689
  try {
6951
- raw = JSON.parse(await readFile2(join4(dir, f), "utf8"));
7690
+ raw = JSON.parse(await readFile3(join4(dir, f), "utf8"));
6952
7691
  } catch {
6953
7692
  continue;
6954
7693
  }
@@ -6978,7 +7717,7 @@ function flowMissPath(baseUrl) {
6978
7717
  async function readFlowMissAt(baseUrl) {
6979
7718
  if (process.env.E10_RS_NO_FLOW_CACHE === "1") return null;
6980
7719
  try {
6981
- const raw = JSON.parse(await readFile2(flowMissPath(baseUrl), "utf8"));
7720
+ const raw = JSON.parse(await readFile3(flowMissPath(baseUrl), "utf8"));
6982
7721
  if (raw?.baseUrl !== baseUrl || !raw?.missedAt) return null;
6983
7722
  if (Date.now() - raw.missedAt > FLOW_MISS_TTL_MS) return null;
6984
7723
  return raw.missedAt;
@@ -6990,10 +7729,10 @@ async function writeFlowMiss(baseUrl) {
6990
7729
  if (process.env.E10_RS_NO_FLOW_CACHE === "1") return;
6991
7730
  try {
6992
7731
  const dir = cacheDirFor(baseUrl);
6993
- if (!existsSync2(dir)) return;
7732
+ if (!existsSync3(dir)) return;
6994
7733
  const target = flowMissPath(baseUrl);
6995
- await mkdir2(dirname2(target), { recursive: true });
6996
- await writeFile2(target, JSON.stringify({ baseUrl, missedAt: Date.now() }), "utf8");
7734
+ await mkdir3(dirname3(target), { recursive: true });
7735
+ await writeFile3(target, JSON.stringify({ baseUrl, missedAt: Date.now() }), "utf8");
6997
7736
  } catch {
6998
7737
  }
6999
7738
  }
@@ -7005,7 +7744,7 @@ function findFlowMenu(cache) {
7005
7744
  }
7006
7745
  return null;
7007
7746
  }
7008
- function isDefaultFlowRow(x) {
7747
+ function isDefaultFlowRow2(x) {
7009
7748
  if (!x) return false;
7010
7749
  const cands = [x.is_default, x.isDefault, x.default_flow, x.defaultFlow, x.is_enable, x.enabled, x.status];
7011
7750
  for (const v of cands) {
@@ -7065,7 +7804,7 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
7065
7804
  headers: { ebBusinessId: menu.listId }
7066
7805
  });
7067
7806
  const rows = r?.data?.data || r?.data?.displayData || [];
7068
- const pick = rows.find(isDefaultFlowRow) || (rows.length === 1 ? rows[0] : null);
7807
+ const pick = rows.find(isDefaultFlowRow2) || (rows.length === 1 ? rows[0] : null);
7069
7808
  if (pick) {
7070
7809
  const id = String(pick.form_data_id || pick.id || "");
7071
7810
  const name = String(pick.name || pick.flow_name || pick.content || "");
@@ -7088,7 +7827,7 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
7088
7827
  });
7089
7828
  const rows = r?.data?.list || r?.data?.rows || r?.data || [];
7090
7829
  const list = Array.isArray(rows) ? rows : [];
7091
- const enabled = list.find(isDefaultFlowRow) || null;
7830
+ const enabled = list.find(isDefaultFlowRow2) || null;
7092
7831
  if (enabled?.id) {
7093
7832
  result = { id: String(enabled.id), name: String(enabled.name || enabled.flow_name || "") };
7094
7833
  serverResolved = true;
@@ -7104,7 +7843,8 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
7104
7843
  } catch {
7105
7844
  host2 = "";
7106
7845
  }
7107
- if (isSelfUse && host2 === SELFUSE_DEFAULT_FLOW.selfUseHost) {
7846
+ const bySelfTenant = isSelfTenant(cache?.tenantKey);
7847
+ if (bySelfTenant || isSelfUse && host2 === SELFUSE_DEFAULT_FLOW.selfUseHost) {
7108
7848
  result = { id: SELFUSE_DEFAULT_FLOW.id, name: SELFUSE_DEFAULT_FLOW.name };
7109
7849
  }
7110
7850
  }
@@ -7171,7 +7911,7 @@ async function inputFrom(options, extra = {}) {
7171
7911
  if (opts.input) {
7172
7912
  let raw;
7173
7913
  try {
7174
- raw = stripBom(opts.input === "-" ? await readStdin() : await readFile3(String(opts.input), "utf8"));
7914
+ raw = stripBom(opts.input === "-" ? await readStdin() : await readFile4(String(opts.input), "utf8"));
7175
7915
  } catch {
7176
7916
  throw rsValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
7177
7917
  }