weaver-work-cli 0.1.44 → 0.1.45

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 (179) hide show
  1. package/README.md +9 -5
  2. package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
  3. package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
  4. package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
  5. package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
  6. package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-CE3GMWTS.js} +3 -3
  7. package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
  8. package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
  9. package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
  10. package/dist/chunks/{chunk-CWYGFU5B.js → chunk-3WBIQLMB.js} +2 -2
  11. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  12. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-3ZMAQQ3W.js} +161 -33
  13. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-4EXOIQDI.js} +40 -10
  14. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-77YP6I52.js} +1 -1
  17. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  18. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-DGMYACGJ.js} +1 -1
  19. package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
  20. package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
  21. package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  22. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  23. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-JWWTI63L.js} +55 -5
  24. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-LGKWL4OH.js} +176 -39
  25. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-LRCPNDZA.js} +38 -6
  26. package/dist/chunks/{chunk-OF4S23UB.js → chunk-LXFVWZLM.js} +4 -4
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-OAE3AZBQ.js} +11 -11
  29. package/dist/chunks/chunk-P5GQRWDC.js +60 -0
  30. package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
  31. package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-T4MWQAQB.js} +7 -5
  32. package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
  33. package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
  34. package/dist/chunks/{chunk-FAZTGX7S.js → chunk-VIMCY4DI.js} +5 -5
  35. package/dist/chunks/chunk-VRPH24IC.js +76 -0
  36. package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
  37. package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
  38. package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-IYJETSGT.js} +2 -2
  39. package/dist/chunks/continuation-GW6PRWK3.js +12 -0
  40. package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
  41. package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
  42. package/dist/chunks/{create-flow-J22BO65E.js → create-flow-7JLC7UID.js} +6 -6
  43. package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
  44. package/dist/chunks/{ehr-GSTGAIY3.js → ehr-MYRDCHZ4.js} +121 -49
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-3MBHAWBL.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-TZEVU4DU.js} +1 -1
  49. package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
  50. package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-KL3HFKRM.js} +3 -3
  51. package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
  52. package/dist/chunks/host-7NTIBSPK.js +25 -0
  53. package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
  54. package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
  55. package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
  56. package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
  57. package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
  58. package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
  59. package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
  60. package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
  61. package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-UH6HGK2I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-C67EHQ4Z.js} +12 -12
  64. package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
  65. package/dist/chunks/operations-J7PUIVWZ.js +15 -0
  66. package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
  67. package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
  68. package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
  69. package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-AHY5QAMF.js} +450 -117
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  72. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  73. package/dist/chunks/{registry-IM5G23LS.js → registry-XPWPGHYE.js} +10 -10
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-CNWE5WQK.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-YYNYBQIE.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/index.js +30 -30
  78. package/dist/internal/e10/auth/commands.js +32 -0
  79. package/dist/internal/e10/auth/error-log.js +156 -26
  80. package/dist/internal/e10/auth/xiaoe.js +176 -13
  81. package/dist/internal/e10/context.js +12 -1
  82. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  83. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  84. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  85. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  86. package/dist/shortcuts/archive/operations/shared.js +52 -0
  87. package/dist/shortcuts/contract/host.js +111 -4
  88. package/dist/shortcuts/contract/index.js +19 -0
  89. package/dist/shortcuts/contract/manifest.js +125 -0
  90. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  91. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  92. package/dist/shortcuts/contract/operations/customer.js +192 -0
  93. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  94. package/dist/shortcuts/contract/operations/flow.js +44 -2
  95. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  96. package/dist/shortcuts/contract/operations/registry.js +8 -0
  97. package/dist/shortcuts/contract/operations/review.js +116 -1
  98. package/dist/shortcuts/contract/operations/summary.js +177 -0
  99. package/dist/shortcuts/contract/operations/upload.js +64 -4
  100. package/dist/shortcuts/contract/upload-cache.js +104 -0
  101. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +4 -2
  102. package/dist/shortcuts/ehr/operations/recruit-position.js +136 -35
  103. package/dist/shortcuts/ehr/operations/recruit-write.js +17 -18
  104. package/dist/shortcuts/ehr/operations/recruit.js +17 -5
  105. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  106. package/dist/shortcuts/meeting/operations/eb/create-flow.js +182 -58
  107. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  108. package/dist/shortcuts/meeting/operations/eb/factory.js +58 -3
  109. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  110. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +47 -5
  111. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  112. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  113. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +86 -16
  114. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +6 -4
  115. package/dist/shortcuts/recruit-stage/operations/jd-create.js +208 -56
  116. package/dist/shortcuts/recruit-stage/operations/resume-import.js +42 -16
  117. package/dist/shortcuts/recruit-stage/shared.js +161 -18
  118. package/dist/shortcuts/workflow/index.js +2 -0
  119. package/dist/shortcuts/workflow/operations/read.js +8 -3
  120. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  121. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  122. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  123. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  124. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  128. package/docs/contract.md +1 -0
  129. package/docs/e10-auth.md +4 -2
  130. package/docs/todo-smart-convert/data-contract.md +7 -0
  131. package/package.json +1 -1
  132. package/skill-template/domains/jinchengda.md +2 -0
  133. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  134. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  135. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  136. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  137. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  138. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  139. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  140. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  141. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  142. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  143. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  148. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  149. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  152. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  153. package/skills/weaver-e10-jucailin/references/recruit-create.md +5 -3
  154. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -2
  155. package/skills/weaver-e10-meeting/SKILL.md +57 -9
  156. package/skills/weaver-e10-recruit-stage/SKILL.md +11 -6
  157. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +10 -2
  158. package/skills/weaver-e10-recruit-stage/references/position-templates.md +3 -1
  159. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  160. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -18
  161. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  162. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +7 -1
  163. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  164. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  165. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  166. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  167. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  168. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  169. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  170. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  171. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  172. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  173. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  174. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  175. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  176. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  177. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  178. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  179. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  createRecruitContextLoader
5
- } from "./chunk-HIT4Y6OI.js";
5
+ } from "./chunk-T4MWQAQB.js";
6
6
  import {
7
7
  CONTINUATION_TTL_MS
8
8
  } from "./chunk-7BDPM5ST.js";
@@ -11,11 +11,11 @@ import {
11
11
  createE10RequestRuntime,
12
12
  isE10SessionExpiredResponse,
13
13
  requireE10Session
14
- } from "./chunk-ETNJSKMM.js";
14
+ } from "./chunk-6NXT4ICB.js";
15
15
  import {
16
16
  E10_SESSION_EXPIRED_MESSAGE,
17
17
  getActiveProfile
18
- } from "./chunk-UFIT2UU3.js";
18
+ } from "./chunk-U6R6FZHD.js";
19
19
  import {
20
20
  CliError,
21
21
  isCliError,
@@ -275,6 +275,9 @@ function schemaOf(properties, options = {}) {
275
275
 
276
276
  // src/shortcuts/recruit-stage/shared.ts
277
277
  import { randomUUID } from "node:crypto";
278
+ import { unlinkSync } from "node:fs";
279
+ import { homedir as homedir2 } from "node:os";
280
+ import { join, resolve as resolvePath } from "node:path";
278
281
  function randHex32() {
279
282
  return randomUUID().replace(/-/g, "");
280
283
  }
@@ -347,6 +350,32 @@ async function getFormButtons(host, objId, layoutId) {
347
350
  }
348
351
  return actions;
349
352
  }
353
+ async function probeCreatePermission(host, objId) {
354
+ try {
355
+ const r = await host.request({
356
+ path: "/api/ebuilder/form/data/getFormButtons",
357
+ body: {
358
+ layoutType: "formLayout",
359
+ objId,
360
+ dataId: "",
361
+ formDataId: "",
362
+ type: "1",
363
+ fromRecycle: false,
364
+ otherOperator: "",
365
+ objectAppId: "",
366
+ browser: "Chrome",
367
+ isTamper: "0"
368
+ }
369
+ });
370
+ const d = r?.data;
371
+ const btns = Array.isArray(d) ? d : d?.buttons || [];
372
+ if (!Array.isArray(btns) || !btns.length) return "unknown";
373
+ const hasSave = btns.some((b) => String(b?.buttonKey || "").toLowerCase().includes("save") || String(b?.name || "").includes("\u4FDD\u5B58"));
374
+ return hasSave ? "ok" : "denied";
375
+ } catch {
376
+ return "unknown";
377
+ }
378
+ }
350
379
  function pickSaveButtonActions(actions, { includeDisabled = false } = {}) {
351
380
  const all = actions || [];
352
381
  let own = all.filter((a) => a._buttonKey === "save");
@@ -533,23 +562,114 @@ async function resolvePersonId(host, fieldId, keyword) {
533
562
  const list = r?.data?.data || r?.data || [];
534
563
  return list[0]?.id || list[0]?.value || null;
535
564
  }
536
- async function getDsOptions(host, objId, fieldId, groupId) {
537
- const r = await host.request({
538
- path: "/api/ebuilder/common/ds/options?fieldName=" + fieldId + "&objId=" + objId + "&sourceType=FORM&groupId=" + groupId,
539
- method: "GET"
540
- });
541
- const list = r?.data || [];
542
- const map = {};
543
- for (const x of list) map[x.name] = x.id;
544
- return map;
565
+ var dsOptionsMemo = /* @__PURE__ */ new Map();
566
+ function restoreDsOptions(snapshot) {
567
+ for (const [key, value] of Object.entries(snapshot || {})) {
568
+ if (value && typeof value === "object" && Object.keys(value).length) {
569
+ dsOptionsMemo.set(key, Promise.resolve(value));
570
+ }
571
+ }
545
572
  }
546
- function cachedDsMap(cache, objId, fieldKey) {
547
- const fidv = (cache.fields[objId] || {})[fieldKey];
548
- const opts = fidv && cache.field_options?.[objId] && cache.field_options[objId][fidv];
549
- if (!opts || !Object.keys(opts).length) return null;
550
- const map = {};
551
- for (const [id, name] of Object.entries(opts)) map[name] = id;
552
- return map;
573
+ async function dsOptionsSnapshot() {
574
+ const out = {};
575
+ await Promise.all([...dsOptionsMemo.entries()].map(async ([key, task]) => {
576
+ try {
577
+ const value = await task;
578
+ if (value && Object.keys(value).length) out[key] = value;
579
+ } catch {
580
+ }
581
+ }));
582
+ return out;
583
+ }
584
+ function expectedFields(details, fields, keys, nonEmptyOnly = [], optionalKeys = []) {
585
+ const out = [];
586
+ for (const k of keys) {
587
+ const fid = fields[k];
588
+ if (!fid) continue;
589
+ const d = (details || []).find((x) => String(x?.formField?.id) === String(fid));
590
+ if (!d) continue;
591
+ const value = String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? "");
592
+ const optional = optionalKeys.includes(k);
593
+ if (nonEmptyOnly.includes(k)) out.push({ fieldId: String(fid), label: k, expected: "*", optional });
594
+ else if (value) out.push({ fieldId: String(fid), label: k, expected: value, optional });
595
+ }
596
+ return out;
597
+ }
598
+ async function verifySubmitted(opts) {
599
+ const { host, formId, objId, dataId, expected } = opts;
600
+ if (!expected.length) return { checked: 0, mismatches: [] };
601
+ let details = [];
602
+ try {
603
+ const r = await host.request({
604
+ path: "/api/ebuilder/form/form/core/getFormDataAndLayout?formId=" + encodeURIComponent(formId) + "&dataId=" + encodeURIComponent(dataId),
605
+ method: "POST",
606
+ body: {
607
+ terminalType: "PC",
608
+ dataId,
609
+ formId,
610
+ module: "ebuilderform",
611
+ newLayout: true,
612
+ cacheUid: "",
613
+ layoutMultiId: "",
614
+ dataCrossLayout: false,
615
+ permissionId: "",
616
+ allReadOnly: false,
617
+ initialDatas: [],
618
+ dynamicData: false,
619
+ cost: false,
620
+ customParam: { objId }
621
+ }
622
+ });
623
+ details = r?.data?.formData?.dataDetails || [];
624
+ } catch (e) {
625
+ return { checked: 0, mismatches: [], unavailable: e?.message || "\u56DE\u67E5\u63A5\u53E3\u4E0D\u53EF\u7528" };
626
+ }
627
+ const byId = /* @__PURE__ */ new Map();
628
+ for (const d of details) {
629
+ const fid = String(d?.fieldId || d?.formField?.id || "");
630
+ if (fid) byId.set(fid, d);
631
+ }
632
+ const mismatches = [];
633
+ for (const e of expected) {
634
+ const d = byId.get(e.fieldId);
635
+ if (!d && e.optional) continue;
636
+ const actual = d ? String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? "") : "";
637
+ const bad = e.expected === "*" ? !actual : actual !== e.expected;
638
+ if (bad) mismatches.push({ label: e.label, expected: e.expected === "*" ? "\uFF08\u975E\u7A7A\uFF09" : e.expected, actual: actual || "\uFF08\u7A7A\uFF09" });
639
+ }
640
+ return { checked: expected.length, mismatches };
641
+ }
642
+ function invalidateEnvCache(baseUrl, appId) {
643
+ dsOptionsMemo.clear();
644
+ if (!baseUrl || !appId) return;
645
+ try {
646
+ const host = baseUrl.replace(/^https?:\/\//, "").replace(/\/+$/, "").replace(/:/g, "_");
647
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir2(), ".weaver-work-cli");
648
+ const root = process.env.E10_SKILL_CACHE_DIR || join(home, "env-cache", "recruit-ops");
649
+ unlinkSync(join(root, host, appId + ".json"));
650
+ } catch {
651
+ }
652
+ }
653
+ async function getDsOptions(host, objId, fieldId, groupId = "") {
654
+ const key = objId + ":" + fieldId;
655
+ const hit = dsOptionsMemo.get(key);
656
+ if (hit) return hit;
657
+ const task = (async () => {
658
+ const r = await host.request({
659
+ path: "/api/ebuilder/common/ds/options?fieldName=" + fieldId + "&objId=" + objId + "&sourceType=FORM" + (groupId ? "&groupId=" + groupId : ""),
660
+ method: "GET"
661
+ });
662
+ const list = r?.data || [];
663
+ const map = {};
664
+ for (const x of list) if (x?.name && x?.id) map[String(x.name)] = String(x.id);
665
+ if (!Object.keys(map).length) dsOptionsMemo.delete(key);
666
+ return map;
667
+ })();
668
+ dsOptionsMemo.set(key, task);
669
+ task.catch(() => {
670
+ dsOptionsMemo.delete(key);
671
+ });
672
+ return task;
553
673
  }
554
674
  async function getFormButtonsForData(host, objId, formId, dataId, layoutId) {
555
675
  const body = {
@@ -750,10 +870,9 @@ function buildCardUrl(baseUrl, objId, dataId) {
750
870
  if (!baseUrl || !objId || !dataId) return null;
751
871
  return String(baseUrl).replace(/\/+$/, "") + "/sp/ebdfpage/card/0/" + objId + "/" + dataId;
752
872
  }
753
- function buildListLocateUrl(baseUrl, appId, listId, objId, dataId) {
754
- if (!baseUrl || !listId || !objId || !dataId) return null;
755
- const base = String(baseUrl).replace(/\/+$/, "");
756
- return `${base}/sp/ebdfpage/list/${listId}/card/0/${objId}/${dataId}/${listId}?id=${dataId}&openSource=field&openSourceId=${dataId}&openSourceAppId=${appId}`;
873
+ function buildListUrl(baseUrl, listId) {
874
+ if (!baseUrl || !listId) return null;
875
+ return String(baseUrl).replace(/\/+$/, "") + "/sp/ebdfpage/list/" + listId;
757
876
  }
758
877
 
759
878
  // src/shortcuts/recruit-stage/operations/jd-create.ts
@@ -768,9 +887,11 @@ var DEF_FROM_REF = [
768
887
  "job_category",
769
888
  "education",
770
889
  "work_years",
771
- "work_location"
890
+ "salary_min",
891
+ "salary_max"
772
892
  ];
773
893
  var DEF_STATUS = "\u62DB\u8058\u4E2D";
894
+ var DEFAULT_WORK_LOCATION = "\u6D66\u6C5F\u9547\u4E09\u9C81\u516C\u8DEF3419\u53F7\u6CDB\u5FAE\u8F6F\u4EF6\u56ED";
774
895
  var NUM_KEYS = /* @__PURE__ */ new Set(["recruit_count", "number_of_pay_months", "salary_min", "salary_max", "internship_duration", "working_days"]);
775
896
  var PERSON_KEYS = /* @__PURE__ */ new Set(["recr_principal", "recr_helper", "employ_manager", "interviewer"]);
776
897
  var OPTION_KEYS = /* @__PURE__ */ new Set(["salary_type", "recruit_type", "status"]);
@@ -867,55 +988,119 @@ async function findWorkPlaceMenu(ctx) {
867
988
  }
868
989
  return null;
869
990
  }
870
- async function resolveWorkLocation(ctx, value) {
871
- const { host, appId, cache } = ctx;
872
- const v = String(value).trim();
873
- if (!v) return null;
874
- let pObj = "";
991
+ var workPlaceMemo = /* @__PURE__ */ new Map();
992
+ function stripHtml(s) {
993
+ return String(s ?? "").replace(/<[^>]*>/g, "").trim();
994
+ }
995
+ function parseSpans(raw) {
875
996
  try {
876
- const t = await host.request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_work_place`, method: "GET" });
877
- const d = t?.data;
878
- if (Array.isArray(d) && d[0]) pObj = String(d[0].id || "");
997
+ const v = Array.isArray(raw) ? raw : JSON.parse(String(raw || "[]"));
998
+ return Array.isArray(v) ? v : [];
879
999
  } catch {
1000
+ return [];
880
1001
  }
1002
+ }
1003
+ function isEnabledText(s) {
1004
+ const t = stripHtml(s);
1005
+ return t.includes("\u542F\u7528") && !t.includes("\u7981\u7528");
1006
+ }
1007
+ async function loadWorkPlaces(ctx) {
1008
+ const { host, appId } = ctx;
881
1009
  const menu = await findWorkPlaceMenu(ctx);
882
- if (!menu) return null;
883
- if (!pObj) pObj = String(menu.objId || "");
884
- if (!pObj) return null;
885
- const body = {
886
- current: 1,
887
- pageSize: 200,
888
- tableuid: randHex32(),
889
- listId: menu.listId,
890
- searchParamData: { searchType: "3", type: "and" },
891
- terminal: "PC",
892
- browser: "Chrome",
893
- requiredMatch: 1,
894
- mapResult: 1,
895
- recheckQuery: 1,
896
- isFollow: 0,
897
- isShareToMe: 0,
898
- filterCondition: {},
899
- cusMenuId: menu.cusMenuId,
900
- urlPageTitle: menu.menuName,
901
- menuName: menu.menuName
902
- };
903
- const r = await host.request({ path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`, body, headers: { ebBusinessId: menu.listId } });
904
- const rows = r?.data?.data || r?.data?.displayData || [];
905
- const hit = rows.find((x) => {
906
- const name = String(x.name || x.detail_location || "");
907
- const detail = String(x.detail_location || "");
908
- const area = String(x.area_text || "");
909
- return name.includes(v) || detail.includes(v) || area.includes(v) || detail && v.includes(detail);
910
- });
911
- return hit ? { id: String(hit.form_data_id || hit.id), name: String(hit.detail_location || hit.name || v) } : null;
1010
+ if (!menu) return { rows: [], statusFiltered: false };
1011
+ const key = appId + "|" + menu.listId;
1012
+ const cached = workPlaceMemo.get(key);
1013
+ if (cached) return cached;
1014
+ const [tagObjId] = await Promise.all([
1015
+ host.request({ path: `/api/ebuilder/form/obj/getObjsByTag?appId=${appId}&tag=uf_rcrt_work_place`, method: "GET" }).then((t) => Array.isArray(t?.data) && t.data[0] ? String(t.data[0].id || "") : "").catch(() => "")
1016
+ ]);
1017
+ const pObj = tagObjId || String(menu.objId || "");
1018
+ if (!pObj) return { rows: [], statusFiltered: false };
1019
+ const pageSize = 200;
1020
+ const rawRows = [];
1021
+ const dispRows = [];
1022
+ for (let page = 1; page <= 5; page++) {
1023
+ const body = {
1024
+ current: page,
1025
+ pageSize,
1026
+ tableuid: randHex32(),
1027
+ listId: menu.listId,
1028
+ searchParamData: { searchType: "3", type: "and" },
1029
+ terminal: "PC",
1030
+ browser: "Chrome",
1031
+ requiredMatch: 1,
1032
+ mapResult: 1,
1033
+ recheckQuery: 1,
1034
+ isFollow: 0,
1035
+ isShareToMe: 0,
1036
+ filterCondition: {},
1037
+ cusMenuId: menu.cusMenuId,
1038
+ urlPageTitle: menu.menuName,
1039
+ menuName: menu.menuName
1040
+ };
1041
+ const r = await host.request({
1042
+ path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`,
1043
+ body,
1044
+ headers: { ebBusinessId: menu.listId }
1045
+ });
1046
+ const batch = r?.data?.data || r?.data?.displayData || [];
1047
+ rawRows.push(...batch);
1048
+ dispRows.push(...r?.data?.displayData || []);
1049
+ if (batch.length < pageSize) break;
1050
+ }
1051
+ const enabledStatusIds = /* @__PURE__ */ new Set();
1052
+ const enabledRowIds = /* @__PURE__ */ new Set();
1053
+ for (const d of dispRows) {
1054
+ const rid = String(d?.form_data_id || d?.id || "");
1055
+ if (isEnabledText(d?.place_status) && rid) enabledRowIds.add(rid);
1056
+ for (const s of parseSpans(d?.place_statusSpan)) {
1057
+ if (isEnabledText(s?.name) && s?.id) enabledStatusIds.add(String(s.id));
1058
+ }
1059
+ }
1060
+ const statusFiltered = enabledRowIds.size > 0 || enabledStatusIds.size > 0;
1061
+ const rows = rawRows.filter((x) => !statusFiltered || enabledRowIds.has(String(x?.form_data_id || x?.id || "")) || enabledStatusIds.has(String(x?.place_status || ""))).map((x) => ({
1062
+ id: String(x?.form_data_id || x?.id || ""),
1063
+ name: String(x?.name || ""),
1064
+ detail: String(x?.detail_location || ""),
1065
+ area: String(x?.area_text || ""),
1066
+ city: String(x?.city || "")
1067
+ })).filter((x) => !!x.id);
1068
+ const out = { rows, statusFiltered };
1069
+ workPlaceMemo.set(key, out);
1070
+ return out;
1071
+ }
1072
+ function matchWorkPlace(rows, value) {
1073
+ const v = String(value).trim();
1074
+ if (!v || !rows.length) return null;
1075
+ const exact = rows.find((r) => r.detail === v) || rows.find((r) => r.name === v);
1076
+ if (exact) return exact;
1077
+ const valid = (s) => s.length >= 4 && !/^\d+$/.test(s);
1078
+ return rows.find((r) => r.detail.includes(v) && valid(r.detail) || r.name.includes(v) && valid(r.name) || r.area.includes(v) && valid(r.area) || v.includes(r.detail) && valid(r.detail)) || null;
1079
+ }
1080
+ async function resolveWorkLocation(ctx, value) {
1081
+ if (!String(value).trim()) return null;
1082
+ const { rows } = await loadWorkPlaces(ctx);
1083
+ const hit = matchWorkPlace(rows, value);
1084
+ return hit ? { id: hit.id, name: hit.detail || hit.name || String(value) } : null;
1085
+ }
1086
+ async function resolveDefaultWorkLocation(ctx) {
1087
+ return resolveWorkLocation(ctx, DEFAULT_WORK_LOCATION);
912
1088
  }
913
1089
  async function resolveSetValue(ctx, key, value, refByFid) {
914
1090
  const { host, appId, cache } = ctx;
915
1091
  const objId = objIdOf(cache, "position_manage");
916
1092
  const id = (cache.fields[objId] || {})[key];
917
1093
  if (!id) return null;
918
- if (NUM_KEYS.has(key)) return { formField: { id }, content: String(value) };
1094
+ if (NUM_KEYS.has(key)) {
1095
+ if (key === "salary_min" || key === "salary_max") {
1096
+ const n = Number(String(value).replace(/,/g, ""));
1097
+ if (Number.isFinite(n) && n > 0) {
1098
+ const k = n / 1e3;
1099
+ return { formField: { id }, content: String(Number.isInteger(k) ? k : Number(k.toFixed(3))) };
1100
+ }
1101
+ }
1102
+ return { formField: { id }, content: String(value) };
1103
+ }
919
1104
  if (MTEXT_KEYS.has(key)) return { formField: { id }, dataText: { content: String(value) } };
920
1105
  if (key === "position_name") return { formField: { id }, content: String(value) };
921
1106
  if (PERSON_KEYS.has(key)) {
@@ -923,7 +1108,7 @@ async function resolveSetValue(ctx, key, value, refByFid) {
923
1108
  return uid ? { formField: { id }, dataOptions: [{ optionId: String(uid), content: value }] } : null;
924
1109
  }
925
1110
  if (OPTION_KEYS.has(key)) {
926
- const m = cachedDsMap(cache, objId, key) || await getDsOptions(host, objId, id, appId);
1111
+ const m = await getDsOptions(host, objId, id);
927
1112
  const oid = m[value];
928
1113
  return oid ? { formField: { id }, dataOptions: [{ optionId: String(oid), content: value }] } : null;
929
1114
  }
@@ -1076,6 +1261,7 @@ async function buildJd(opts) {
1076
1261
  const fid = (k) => fields[k];
1077
1262
  for (const k of DATAKEYS_TEXT) if (!fid(k)) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 " + k + "\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1078
1263
  for (const k of DATAKEYS_MTEXT) if (!fid(k)) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 " + k + "\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1264
+ const currentUserPromise = resolveCurrentUser(host).catch(() => null);
1079
1265
  const refByFid = await fetchRefByFid(ctx);
1080
1266
  const map = /* @__PURE__ */ new Map();
1081
1267
  const put = (d) => {
@@ -1094,8 +1280,10 @@ async function buildJd(opts) {
1094
1280
  }
1095
1281
  const appliedSets = [];
1096
1282
  const skippedSets = [];
1097
- for (const [k, v] of sets) {
1098
- const d = await resolveSetValue(ctx, k, v, refByFid);
1283
+ const resolvedSets = await Promise.all(
1284
+ sets.map(async ([k, v]) => ({ k, v, d: await resolveSetValue(ctx, k, v, refByFid).catch(() => null) }))
1285
+ );
1286
+ for (const { k, v, d } of resolvedSets) {
1099
1287
  if (d) {
1100
1288
  put(d);
1101
1289
  appliedSets.push(k + "=" + v);
@@ -1105,7 +1293,7 @@ async function buildJd(opts) {
1105
1293
  }
1106
1294
  if (!hasKey("status")) {
1107
1295
  if (!fid("status")) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 status\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
1108
- const statusMap = cachedDsMap(cache, objId, "status") || await getDsOptions(host, objId, fid("status"), appId);
1296
+ const statusMap = await getDsOptions(host, objId, fid("status"));
1109
1297
  const statusId = statusMap[DEF_STATUS];
1110
1298
  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");
1111
1299
  put({ formField: { id: fid("status") }, dataOptions: [{ optionId: String(statusId), content: DEF_STATUS }] });
@@ -1117,7 +1305,7 @@ async function buildJd(opts) {
1117
1305
  const filled = [];
1118
1306
  let currentUser = null;
1119
1307
  if (DEF_CURRENT_USER.some((k) => fid(k) && !hasKey(k))) {
1120
- currentUser = await resolveCurrentUser(host);
1308
+ currentUser = await currentUserPromise;
1121
1309
  if (currentUser && currentUser.id) {
1122
1310
  for (const k of DEF_CURRENT_USER) {
1123
1311
  if (fid(k) && !hasKey(k)) {
@@ -1135,7 +1323,7 @@ async function buildJd(opts) {
1135
1323
  }
1136
1324
  for (const [k, name] of Object.entries(DEF_OPTION)) {
1137
1325
  if (fid(k) && !hasKey(k)) {
1138
- const m = cachedDsMap(cache, objId, k) || await getDsOptions(host, objId, fid(k), appId);
1326
+ const m = await getDsOptions(host, objId, fid(k));
1139
1327
  const oid = m[name];
1140
1328
  if (oid) {
1141
1329
  put({ formField: { id: fid(k) }, dataOptions: [{ optionId: String(oid), content: name }] });
@@ -1155,6 +1343,27 @@ async function buildJd(opts) {
1155
1343
  }
1156
1344
  }
1157
1345
  }
1346
+ const inheritedSalaryWarnings = [];
1347
+ for (const key of ["salary_min", "salary_max"]) {
1348
+ const hit = inheritedFromRef.find((x) => x.field === key);
1349
+ if (!hit) continue;
1350
+ const num = Number(String(hit.value).replace(/[^\d.]/g, ""));
1351
+ if (hit.value && Number.isFinite(num) && (num < 1 || num > 100)) {
1352
+ inheritedSalaryWarnings.push(key + " \u7EE7\u627F\u503C\u300C" + hit.value + "\u300D\uFF08\u5343\u5143\uFF09\u660E\u663E\u5F02\u5E38\uFF0C\u8BF7\u4EBA\u5DE5\u6838\u5BF9\u540E\u518D\u63D0\u4EA4");
1353
+ }
1354
+ }
1355
+ let workLocationDefault = null;
1356
+ let workLocationWarning = null;
1357
+ if (!hasKey("work_location") && fid("work_location")) {
1358
+ const loc = await resolveDefaultWorkLocation(ctx).catch(() => null);
1359
+ if (loc) {
1360
+ put({ formField: { id: fid("work_location") }, dataOptions: [{ optionId: loc.id, content: loc.name }] });
1361
+ filled.push("work_location");
1362
+ workLocationDefault = loc.name;
1363
+ } else {
1364
+ workLocationWarning = `\u672A\u5728\u300C\u529E\u516C\u5730\u70B9\u300D\u5217\u8868\u627E\u5230\u542F\u7528\u72B6\u6001\u7684\u9ED8\u8BA4\u5730\u70B9\u300C${DEFAULT_WORK_LOCATION}\u300D\uFF0C\u672C\u6B21\u4E0D\u5199 work_location\uFF1B\u8BF7\u7528 sets \u6307\u5B9A`;
1365
+ }
1366
+ }
1158
1367
  const inv = {};
1159
1368
  for (const [k, v] of Object.entries(fields)) inv[String(v)] = k;
1160
1369
  const requiredDefaultsFilled = [...map.keys()].map((f) => inv[f] || f).filter((k) => filled.includes(k));
@@ -1176,9 +1385,12 @@ async function buildJd(opts) {
1176
1385
  setApplied: appliedSets,
1177
1386
  setSkipped: skippedSets,
1178
1387
  // 明示哪些字段值继承自「环境内最近一条职位记录」——这些不是用户指定的,可能来自脏数据,
1179
- // 必须在确认摘要里人工核对(尤其 work_location)
1388
+ // 必须在确认摘要里人工核对(工作地点不参与继承,见 workLocationDefault)
1180
1389
  inheritedFromRef: inheritedFromRef.length ? inheritedFromRef : void 0,
1181
- 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\uFF08\u5982\u91CD\u590D\u5730\u70B9\uFF09\uFF0C\u8BF7\u6838\u5BF9\u540E\u518D\u63D0\u4EA4" : void 0,
1390
+ inheritedSalaryWarnings: inheritedSalaryWarnings.length ? inheritedSalaryWarnings : void 0,
1391
+ 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,
1392
+ workLocationDefault: workLocationDefault || void 0,
1393
+ workLocationWarning: workLocationWarning || void 0,
1182
1394
  requiredDefaultsFilled
1183
1395
  }
1184
1396
  };
@@ -1205,6 +1417,8 @@ async function prepare(args, env) {
1205
1417
  const session = await host.getSession();
1206
1418
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
1207
1419
  ctx.appId = ctx.cache.appId;
1420
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "position_manage"));
1421
+ if (perm === "denied") throw rsFail("\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u300C\u804C\u4F4D\u7BA1\u7406\u300D\u8868\u5355\u7684\u521B\u5EFA\u6743\u9650\uFF0C\u5DF2\u963B\u65AD\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09");
1208
1422
  const positionName = String(args.positionName || "").trim();
1209
1423
  if (!positionName) throw rsValidationError("position_name_required", "positionName \u5FC5\u586B");
1210
1424
  const jd = await buildJd({
@@ -1224,7 +1438,11 @@ async function prepare(args, env) {
1224
1438
  };
1225
1439
  const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
1226
1440
  const fp = fingerprint(willSubmit);
1227
- const continuation = await env.continuation.issue({ operation: "recruit-stage.jd.create.apply", fingerprint: fp });
1441
+ const continuation = await env.continuation.issue({
1442
+ operation: "recruit-stage.jd.create.apply",
1443
+ fingerprint: fp,
1444
+ enumMaps: await dsOptionsSnapshot()
1445
+ });
1228
1446
  const invFieldKeys = {};
1229
1447
  for (const [k, v] of Object.entries(ctx.cache.fields[jd.objId] || {})) invFieldKeys[String(v)] = k;
1230
1448
  return rsSuccess("recruit-stage.jd.create.prepare", {
@@ -1252,6 +1470,7 @@ async function apply(args, env) {
1252
1470
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.jd.create.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
1253
1471
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
1254
1472
  const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.jd.create.apply");
1473
+ restoreDsOptions(payload.enumMaps);
1255
1474
  const host = env.host;
1256
1475
  const session = await host.getSession();
1257
1476
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
@@ -1283,24 +1502,42 @@ async function apply(args, env) {
1283
1502
  const positionPostId = data.positionPostId;
1284
1503
  const checkRpa = data.checkRpa;
1285
1504
  const rpaValidMsg = data.rpaValidMsg || null;
1286
- const created = r2?.status !== false && !!positionPostId;
1287
- const listUrl = await resolvePositionNewUrl(ctx).catch(() => null);
1505
+ const okByResponse = r2?.status !== false && r2?.fail !== false && data.fail !== true;
1506
+ const verification = await verifySubmitted({
1507
+ host,
1508
+ formId: jd.formId,
1509
+ objId: jd.objId,
1510
+ dataId: formDataId,
1511
+ expected: expectedFields(
1512
+ jd.dataDetails,
1513
+ ctx.cache.fields[jd.objId] || {},
1514
+ ["position_name", "status", "salary_min", "salary_max", "work_location"],
1515
+ ["position_name", "status"],
1516
+ ["salary_min", "salary_max", "work_location"]
1517
+ )
1518
+ });
1519
+ if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
1520
+ const recordOk = verification.unavailable ? okByResponse : verification.mismatches.length === 0;
1521
+ const created = okByResponse && recordOk;
1522
+ const result = !created ? "failed" : verification.mismatches.length ? "partial" : "success";
1523
+ const listUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.position?.listId || "");
1288
1524
  const cardUrl = buildCardUrl(ctx.baseUrl, jd.objId, formDataId);
1289
- const locateUrl = buildListLocateUrl(ctx.baseUrl, ctx.appId, ctx.cache.lists?.position?.listId || "", jd.objId, formDataId);
1290
1525
  return rsSuccess("recruit-stage.jd.create.apply", {
1291
1526
  mode: "apply",
1292
- result: created ? "success" : "failed",
1527
+ result,
1293
1528
  formDataId,
1294
1529
  positionPostId: positionPostId || null,
1295
1530
  rpaChecked: checkRpa === void 0 ? null : !!checkRpa,
1296
1531
  rpaValidMsg,
1297
- positionListUrl: listUrl || null,
1532
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
1533
+ verifyWarnings: verification.mismatches.map((m) => "\u843D\u5E93\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A" + m.label + " \u671F\u671B " + m.expected + "\uFF0C\u5B9E\u9645 " + m.actual),
1534
+ positionListUrl: listUrl,
1298
1535
  positionCardUrl: cardUrl,
1299
- positionListLocateUrl: locateUrl,
1536
+ positionListLocateUrl: listUrl,
1300
1537
  // 产物链接(Agent 原样搬运成 Markdown 链接,按顺序:详情在前、列表在后)
1301
1538
  viewLink: cardUrl ? `[\u67E5\u770B ${jd.summary.positionName || "\u65B0\u5EFA\u804C\u4F4D"} \u804C\u4F4D\u8BE6\u60C5](${cardUrl})` : null,
1302
- listLocateLink: locateUrl || listUrl ? `[\u6253\u5F00\u62DB\u8058\u5C97\u4F4D\u5217\u8868\uFF08\u5DF2\u5B9A\u4F4D\u65B0\u5EFA\u804C\u4F4D\uFF09](${locateUrl || listUrl})` : null,
1303
- agentNote: "\u67E5\u770B\u5165\u53E3 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF08\u5E73\u53F0\u5B9E\u8BC1\u53EF\u70B9\u51FB\uFF09\uFF1A\u6309\u987A\u5E8F\u539F\u6837\u642C\u8FD0 viewLink \u4E0E listLocateLink\uFF1B\u4E0D\u8981\u5305 browsertool \u6807\u7B7E\u3002\u94FE\u63A5\u53EA\u662F\u67E5\u770B\u5165\u53E3\uFF0C\u91CD\u590D\u70B9\u51FB\u4E0D\u4F1A\u91CD\u590D\u521B\u5EFA\u3002",
1539
+ listLocateLink: listUrl ? `[\u6253\u5F00\u804C\u4F4D\u5217\u8868](${listUrl})` : null,
1540
+ agentNote: "\u67E5\u770B\u5165\u53E3 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF1A\u2460 viewLink \u804C\u4F4D\u8BE6\u60C5\u5355\u9875 \u2461 listLocateLink \u804C\u4F4D\u5217\u8868\uFF08\u53EA\u6253\u5F00\u5217\u8868\uFF0C\u4E0D\u6253\u5F00\u8BE6\u60C5\uFF09\u3002\u6309\u987A\u5E8F\u539F\u6837\u642C\u8FD0\uFF0C\u4E0D\u8981\u5305 browsertool \u6807\u7B7E\uFF1B\u7F3A\u54EA\u4E2A\u53EA\u7ED9\u53E6\u4E00\u4E2A\u3002\u94FE\u63A5\u53EA\u662F\u67E5\u770B\u5165\u53E3\uFF0C\u91CD\u590D\u70B9\u51FB\u4E0D\u4F1A\u91CD\u590D\u521B\u5EFA\u3002",
1304
1541
  ...jd.summary
1305
1542
  });
1306
1543
  }
@@ -1999,13 +2236,17 @@ function makeBriefReader(ctx, formId, objId, fields) {
1999
2236
  }
2000
2237
  function resolveTalentCardUrl(ctx, talentId) {
2001
2238
  const pid = ctx.cache.ebdDetailPageId;
2002
- if (!pid) return null;
2239
+ if (!pid || !talentId) {
2240
+ const forms = ctx.cache.forms || {};
2241
+ const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || "");
2242
+ return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
2243
+ }
2003
2244
  return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
2004
2245
  }
2005
- function resolveTalentListLocateUrl(ctx, talentId) {
2246
+ function resolveTalentListLocateUrl(ctx, _talentId) {
2006
2247
  const listId = ctx.cache.lists?.talent?.listId;
2007
- if (!listId || !talentId) return null;
2008
- return `${ctx.baseUrl}/sp/ebdfpage/list/${listId}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
2248
+ if (!listId) return null;
2249
+ return `${ctx.baseUrl.replace(/\/+$/, "")}/sp/ebdfpage/list/${listId}`;
2009
2250
  }
2010
2251
  async function readTalentSnapshot(ctx, opts) {
2011
2252
  const { host, formId, objId, fields, subMeta, dataId } = opts;
@@ -2449,8 +2690,8 @@ async function buildImport(ctx, args) {
2449
2690
  channelLabel = "\u624B\u52A8\u5F55\u5165\uFF08\u56FA\u5B9A\uFF09";
2450
2691
  }
2451
2692
  if (fields.is_blacklist) {
2452
- const opt = (cache.field_options?.[objId] || {})[fields.is_blacklist] || {};
2453
- const noId = Object.keys(opt).find((k) => opt[k] === "\u5426");
2693
+ const opt = await getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}));
2694
+ const noId = opt["\u5426"];
2454
2695
  if (noId) dataDetails.push({ formField: { id: fields.is_blacklist }, dataOptions: [{ optionId: String(noId), content: "\u5426" }] });
2455
2696
  }
2456
2697
  let subBuild = { byTable: {}, stats: {} };
@@ -2576,6 +2817,8 @@ async function prepare2(args, env) {
2576
2817
  const session = await host.getSession();
2577
2818
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
2578
2819
  ctx.appId = ctx.cache.appId;
2820
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "talent_pool"));
2821
+ if (perm === "denied") throw rsFail("\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u300C\u4EBA\u624D\u5E93\u300D\u8868\u5355\u7684\u521B\u5EFA\u6743\u9650\uFF0C\u5DF2\u963B\u65AD\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09");
2579
2822
  const argsT = args;
2580
2823
  if (!argsT.structured && !argsT.structuredFile && !argsT.fileId && !argsT.resumeFile) {
2581
2824
  throw rsValidationError("input_required", "\u9700\u8981 structured/structuredFile/fileId/resumeFile \u4E4B\u4E00");
@@ -2631,7 +2874,11 @@ async function prepare2(args, env) {
2631
2874
  }
2632
2875
  const willSubmit2 = { updateTalentId, mainTable: fingerprintMainTable(upMain), details: built.detailsPayload };
2633
2876
  const fp2 = fingerprint2(willSubmit2);
2634
- const continuation2 = await env.continuation.issue({ operation: "recruit-stage.resume.import.apply", fingerprint: fp2 });
2877
+ const continuation2 = await env.continuation.issue({
2878
+ operation: "recruit-stage.resume.import.apply",
2879
+ fingerprint: fp2,
2880
+ enumMaps: await dsOptionsSnapshot()
2881
+ });
2635
2882
  return rsSuccess("recruit-stage.resume.import.prepare", {
2636
2883
  mode: "prepare-update",
2637
2884
  action: "\u6309\u7B80\u5386\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D",
@@ -2699,7 +2946,11 @@ async function prepare2(args, env) {
2699
2946
  };
2700
2947
  const willSubmit = { formId: built.formId, objId: built.objId, mainTable: fingerprintMainTable(toDatasetMainTable(built.dataDetails, built.fields)), details: built.detailsPayload };
2701
2948
  const fp = fingerprint2(willSubmit);
2702
- const continuation = await env.continuation.issue({ operation: "recruit-stage.resume.import.apply", fingerprint: fp });
2949
+ const continuation = await env.continuation.issue({
2950
+ operation: "recruit-stage.resume.import.apply",
2951
+ fingerprint: fp,
2952
+ enumMaps: await dsOptionsSnapshot()
2953
+ });
2703
2954
  return rsSuccess("recruit-stage.resume.import.prepare", {
2704
2955
  mode: "prepare",
2705
2956
  ...summary,
@@ -2713,6 +2964,7 @@ async function apply2(args, env) {
2713
2964
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.resume.import.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
2714
2965
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
2715
2966
  const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.resume.import.apply");
2967
+ restoreDsOptions(payload.enumMaps);
2716
2968
  const host = env.host;
2717
2969
  const session = await host.getSession();
2718
2970
  const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
@@ -2850,15 +3102,28 @@ async function apply2(args, env) {
2850
3102
  const labelMatch = labelRes.ok ? labelRes.v : "ERR:" + (labelRes.e?.message || "");
2851
3103
  const tagResult = tagRes.ok ? tagRes.v : { applied: [], skipped: built.tagNames, error: tagRes.e?.message };
2852
3104
  const tags = await queryEntityTags(host, talentId).catch(() => []);
3105
+ const verification = await verifySubmitted({
3106
+ host,
3107
+ formId: built.formId,
3108
+ objId: built.objId,
3109
+ dataId: newId,
3110
+ expected: expectedFields(built.dataDetails, built.fields, ["candidate_name", "telephone", "email"], [], ["email"])
3111
+ });
3112
+ if (verification.mismatches.length) {
3113
+ invalidateEnvCache(ctx.baseUrl, ctx.appId);
3114
+ for (const m of verification.mismatches) writeWarnings.push("\u843D\u5E93\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A" + m.label + " \u671F\u671B " + m.expected + "\uFF0C\u5B9E\u9645 " + m.actual);
3115
+ }
3116
+ const result = detailsState === "complete" && !verification.mismatches.length ? "success" : "partial";
2853
3117
  const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
2854
3118
  const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
2855
3119
  return rsSuccess("recruit-stage.resume.import.apply", {
2856
3120
  mode: "apply",
2857
- result: detailsState === "complete" ? "success" : "partial",
3121
+ result,
2858
3122
  detailsState,
2859
3123
  newCandidateFormDataId: newId,
2860
3124
  talentId,
2861
3125
  writeChannel,
3126
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
2862
3127
  writeWarnings: writeWarnings.length ? writeWarnings : void 0,
2863
3128
  subTablesExpected: built.subBuild.stats,
2864
3129
  subTableVerify,
@@ -2871,10 +3136,10 @@ async function apply2(args, env) {
2871
3136
  tags,
2872
3137
  talentCardUrl,
2873
3138
  talentListLocateUrl,
2874
- // 产物链接(Agent 原样搬运:① 人才卡片 ② 人才库定位;缺失哪个只给另一个)
3139
+ // 产物链接(Agent 原样搬运:① 人才卡片单页 ② 人才库列表;缺失哪个只给另一个)
2875
3140
  viewLink: talentCardUrl ? `[\u67E5\u770B ${built.structured.candidateName || "\u65B0\u4EBA\u624D"} \u7684\u4EBA\u624D\u5361\u7247](${talentCardUrl})` : null,
2876
- listLocateLink: talentListLocateUrl ? `[\u5728\u4EBA\u624D\u5E93\u4E2D\u6253\u5F00](${talentListLocateUrl})` : null,
2877
- agentNote: "\u6B63\u6587\u7ED9\u4E24\u4E2A Markdown \u94FE\u63A5\u2014\u2014\u2460 [\u67E5\u770B <\u59D3\u540D> \u7684\u4EBA\u624D\u5361\u7247](talentCardUrl) \u2461 [\u5728\u4EBA\u624D\u5E93\u4E2D\u6253\u5F00](talentListLocateUrl)\uFF1B\u7F3A\u5931\u54EA\u4E2A\u5C31\u53EA\u7ED9\u53E6\u4E00\u4E2A\uFF0C\u4E0D\u8F93\u51FA\u534A\u622A\u3002\u4E0D\u8981\u7528 artifact / browsertool\u3002",
3141
+ listLocateLink: talentListLocateUrl ? `[\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](${talentListLocateUrl})` : null,
3142
+ 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",
2878
3143
  parsed: {
2879
3144
  name: built.structured.candidateName,
2880
3145
  mobile: built.structured.telephone,
@@ -3150,7 +3415,7 @@ function planBrief(items) {
3150
3415
  return (items || []).map((x) => x.name + (x.position ? "\uFF08\u5C97\u4F4D\uFF1A" + x.position + "\uFF09" : "") + " [id=" + x.id + "]").join("\uFF1B");
3151
3416
  }
3152
3417
  async function buildPlan(opts) {
3153
- const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan } = opts;
3418
+ const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan, rounds } = opts;
3154
3419
  const { host, appId, cache } = ctx;
3155
3420
  const objId = objIdOf(cache, "interview_plan");
3156
3421
  const formId = formIdOf(cache, "interview_plan");
@@ -3164,8 +3429,10 @@ async function buildPlan(opts) {
3164
3429
  }
3165
3430
  const candManageId = cand.candidateManageId ? String(cand.candidateManageId) : "";
3166
3431
  if (!candManageId) throw rsFail("\u672A\u5B9A\u4F4D\u5230\u5E94\u8058\u7BA1\u7406\u8BB0\u5F55\uFF08candidateManageId\uFF09\uFF0C\u8BF7\u786E\u8BA4\u5019\u9009\u4EBA\u5DF2\u6709\u5E94\u8058\u6279\u6B21");
3167
- const typeMap = cachedDsMap(cache, objId, "interview_type") || await getDsOptions(host, objId, fid("interview_type"), appId);
3168
- const sessionMap = cachedDsMap(cache, objId, "interview_session") || await getDsOptions(host, objId, fid("interview_session"), appId);
3432
+ const [typeMap, sessionMap] = await Promise.all([
3433
+ getDsOptions(host, objId, fid("interview_type")),
3434
+ getDsOptions(host, objId, fid("interview_session"))
3435
+ ]);
3169
3436
  const typeId = typeMap[type];
3170
3437
  if (!typeId) throw rsFail("\u9762\u8BD5\u65B9\u5F0F\u300C" + type + "\u300D\u4E0D\u5728\u679A\u4E3E\u4E2D\uFF08" + Object.keys(typeMap).join("/") + "\uFF09");
3171
3438
  const sessionId = sessionMap[session];
@@ -3247,6 +3514,32 @@ async function buildPlan(opts) {
3247
3514
  if (aiPlanPicked) {
3248
3515
  dataDetails.push({ formField: { id: digitalFid }, dataOptions: [{ optionId: aiPlanPicked.id, content: aiPlanPicked.name }] });
3249
3516
  }
3517
+ const meta = await getFormLayoutMeta(host, formId).catch(() => null);
3518
+ const invFields = {};
3519
+ for (const [k, v] of Object.entries(fields)) invFields[String(v)] = k;
3520
+ const EXCLUDE_DEFAULTS = /* @__PURE__ */ new Set(["digital_id", "interview_type", "interview_paper_id", "send_channel"]);
3521
+ const defaultsApplied = [];
3522
+ for (const d of meta?.defaultDetails || []) {
3523
+ const did = String(d.fieldId || "");
3524
+ if (!did || dataDetails.some((x) => String(x.formField.id) === did)) continue;
3525
+ const dk = invFields[did] || "";
3526
+ if (EXCLUDE_DEFAULTS.has(dk)) continue;
3527
+ const o = (d.dataOptions || [])[0];
3528
+ if (o?.optionId) dataDetails.push({ formField: { id: did }, dataOptions: [{ optionId: String(o.optionId), content: o.content || "" }] });
3529
+ else if (d.content !== void 0 && d.content !== "") dataDetails.push({ formField: { id: did }, content: String(d.content) });
3530
+ else continue;
3531
+ defaultsApplied.push(dk || did);
3532
+ }
3533
+ const roundsName = String(rounds || "\u7B2C\u4E00\u8F6E").trim();
3534
+ let roundsWarning = null;
3535
+ const roundsFid = fid("interview_rounds");
3536
+ if (roundsFid && !dataDetails.some((x) => String(x.formField.id) === String(roundsFid))) {
3537
+ const hit = (cache.dict?.raw || []).find(
3538
+ (r) => String(r.selection_name || "").trim() === roundsName && ["one", "two", "three", "four"].includes(String(r.browser_key || ""))
3539
+ );
3540
+ if (hit) dataDetails.push({ formField: { id: roundsFid }, dataOptions: [{ optionId: String(hit.option_id), content: roundsName }] });
3541
+ else roundsWarning = "\u6570\u636E\u5B57\u5178\u672A\u627E\u5230\u8F6E\u6B21\u300C" + roundsName + "\u300D\uFF08browserKey one/two/three/four\uFF09\uFF0C\u5DF2\u8DF3\u8FC7\u8BE5\u5B57\u6BB5\uFF0C\u4E0D\u81C6\u9020";
3542
+ }
3250
3543
  return {
3251
3544
  host: ctx.host,
3252
3545
  objId,
@@ -3273,6 +3566,9 @@ async function buildPlan(opts) {
3273
3566
  mobile: cand.mobile + "\uFF08\u6765\u6E90\uFF1A" + (mobileSource === "user" ? "\u672C\u6B21\u6307\u5B9A" : "\u4EBA\u624D\u8D44\u6599") + "\uFF09",
3274
3567
  email: (cand.email || "\uFF08\u672A\u63D0\u4F9B\uFF09") + "\uFF08\u6765\u6E90\uFF1A" + (emailSource === "user" ? "\u672C\u6B21\u6307\u5B9A" : emailSource === "talent" ? "\u4EBA\u624D\u8D44\u6599" : "\u7F3A\u5931") + "\uFF09",
3275
3568
  aiPlan: isAI ? aiPlanPicked ? aiPlanPicked.name + "\uFF08id=" + aiPlanPicked.id + "\uFF09" : "\u672A\u9009\u62E9\uFF08AI\u9762\u8BD5\u5FC5\u586B\uFF0C\u9700\u7528\u6237\u6307\u5B9A\uFF09" : "\uFF08\u975E AI \u9762\u8BD5\uFF0C\u4E0D\u9002\u7528\uFF09",
3569
+ rounds: roundsName,
3570
+ defaultsApplied: defaultsApplied.length ? defaultsApplied : void 0,
3571
+ roundsWarning: roundsWarning || void 0,
3276
3572
  isAIInterview: isAI
3277
3573
  }
3278
3574
  };
@@ -3342,7 +3638,11 @@ async function resolveRequiredHint(plan, ctx) {
3342
3638
  }
3343
3639
  function resolveTalentCardUrl2(ctx, talentId) {
3344
3640
  const pid = ctx.cache.ebdDetailPageId;
3345
- if (!pid) return null;
3641
+ if (!pid || !talentId) {
3642
+ const forms = ctx.cache.forms || {};
3643
+ const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || "");
3644
+ return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
3645
+ }
3346
3646
  return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
3347
3647
  }
3348
3648
  async function resolveInterviewListUrl(ctx) {
@@ -3410,7 +3710,8 @@ var baseInput3 = {
3410
3710
  positionId: { type: "string", description: "\u5E94\u8058\u804C\u4F4D id\uFF08\u7B80\u5386\u6C60\u4EBA\u624D\u5FC5\u586B\uFF09" },
3411
3711
  interviewer: { type: "string", description: "\u9762\u8BD5\u5B98\u59D3\u540D\uFF08\u7F3A\u7701=\u5F53\u524D\u767B\u5F55\u7528\u6237\uFF09" },
3412
3712
  type: { type: "string", description: "\u9762\u8BD5\u65B9\u5F0F\uFF08\u73B0\u573A\u9762\u8BD5/\u89C6\u9891\u9762\u8BD5/\u7535\u8BDD\u9762\u8BD5/AI\u9762\u8BD5\uFF1B\u542B AI \u65F6\u90AE\u7BB1\u4E0E\u65B9\u6848\u5FC5\u586B\uFF09" },
3413
- session: { type: "string", description: "\u9762\u8BD5\u8F6E\u6B21\uFF08\u521D\u8BD5/\u590D\u8BD5/\u2026\uFF09" },
3713
+ session: { type: "string", description: "\u9762\u8BD5\u9636\u6BB5\uFF08\u521D\u8BD5/\u590D\u8BD5/\u2026\uFF09" },
3714
+ rounds: { type: "string", description: "\u9762\u8BD5\u8F6E\u6B21\uFF08\u7B2C\u4E00\u8F6E/\u7B2C\u4E8C\u8F6E/\u7B2C\u4E09\u8F6E/\u7B2C\u56DB\u8F6E\uFF1B\u7F3A\u7701=\u9875\u9762\u9ED8\u8BA4\u503C\u6216\u7B2C\u4E00\u8F6E\uFF0C\u6309\u6570\u636E\u5B57\u5178\u8FD0\u884C\u65F6\u89E3\u6790\uFF09" },
3414
3715
  start: { type: "string", pattern: "^\\d{4}-\\d{1,2}-\\d{1,2}[ T]\\d{1,2}:\\d{2}$", description: "\u5F00\u59CB\u65F6\u95F4 YYYY-MM-DD HH:mm\uFF08\u7F3A\u7701=\u5F53\u524D\u65F6\u95F4\uFF09" },
3415
3716
  end: { type: "string", pattern: "^\\d{4}-\\d{1,2}-\\d{1,2}[ T]\\d{1,2}:\\d{2}$", description: "\u7ED3\u675F\u65F6\u95F4\uFF08\u7F3A\u7701=AI +7\u5929 / \u5176\u5B83 +1\u5C0F\u65F6\uFF09" },
3416
3717
  email: { type: "string", description: "\u5019\u9009\u4EBA\u90AE\u7BB1\uFF08AI \u9762\u8BD5\u5FC5\u586B\uFF1B\u8865\u5F55\u503C\u4F18\u5148\u4E8E\u4EBA\u624D\u8D44\u6599\uFF09" },
@@ -3418,6 +3719,8 @@ var baseInput3 = {
3418
3719
  };
3419
3720
  async function prepare3(args, env) {
3420
3721
  const ctx = await makeCtx(env);
3722
+ const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "interview_plan"));
3723
+ if (perm === "denied") throw rsFail("\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u300C\u9762\u8BD5\u8BA1\u5212\u300D\u8868\u5355\u7684\u521B\u5EFA\u6743\u9650\uFF0C\u5DF2\u963B\u65AD\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09");
3421
3724
  const talentId = await locateTalentId(ctx, args);
3422
3725
  const auto = nowAndEnd(args.type || "\u73B0\u573A\u9762\u8BD5");
3423
3726
  const startTime = args.start || auto.s;
@@ -3433,7 +3736,8 @@ async function prepare3(args, env) {
3433
3736
  end: String(endTime),
3434
3737
  email: args.email ? String(args.email) : void 0,
3435
3738
  mobile: args.mobile ? String(args.mobile) : void 0,
3436
- aiPlan: args.aiPlan ? String(args.aiPlan) : void 0
3739
+ aiPlan: args.aiPlan ? String(args.aiPlan) : void 0,
3740
+ rounds: args.rounds ? String(args.rounds) : void 0
3437
3741
  });
3438
3742
  plan.host = ctx.host;
3439
3743
  const aiPlanCandidates = plan.isAI ? (plan.aiPlanOptions.items || []).map((x) => ({ id: x.id, name: x.name, position: x.position })) : [];
@@ -3447,7 +3751,12 @@ async function prepare3(args, env) {
3447
3751
  const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
3448
3752
  const { createHash: createHash3 } = await import("node:crypto");
3449
3753
  const fp = createHash3("sha256").update(JSON.stringify(willSubmit)).digest("hex");
3450
- const continuation = await env.continuation.issue({ operation: "recruit-stage.interview.arrange.apply", fingerprint: fp });
3754
+ const continuation = await env.continuation.issue({
3755
+ operation: "recruit-stage.interview.arrange.apply",
3756
+ fingerprint: fp,
3757
+ enumMaps: await dsOptionsSnapshot(),
3758
+ timeWindow: { start: String(startTime), end: String(endTime) }
3759
+ });
3451
3760
  return rsSuccess("recruit-stage.interview.arrange.prepare", {
3452
3761
  mode: "prepare",
3453
3762
  ...plan.summary,
@@ -3467,11 +3776,12 @@ async function apply3(args, env) {
3467
3776
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.interview.arrange.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
3468
3777
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
3469
3778
  const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.interview.arrange.apply");
3779
+ restoreDsOptions(payload.enumMaps);
3470
3780
  const ctx = await makeCtx(env);
3471
3781
  const talentId = await locateTalentId(ctx, args);
3472
3782
  const auto = nowAndEnd(args.type || "\u73B0\u573A\u9762\u8BD5");
3473
- const startTime = args.start || auto.s;
3474
- const endTime = args.end || (args.start ? shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1e3 : 3600 * 1e3) || auto.e : auto.e);
3783
+ const startTime = args.start || payload.timeWindow?.start || auto.s;
3784
+ const endTime = args.end || (args.start ? shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1e3 : 3600 * 1e3) || auto.e : payload.timeWindow?.end || auto.e);
3475
3785
  const plan = await buildPlan({
3476
3786
  ctx,
3477
3787
  talentId,
@@ -3483,7 +3793,8 @@ async function apply3(args, env) {
3483
3793
  end: String(endTime),
3484
3794
  email: args.email ? String(args.email) : void 0,
3485
3795
  mobile: args.mobile ? String(args.mobile) : void 0,
3486
- aiPlan: args.aiPlan ? String(args.aiPlan) : void 0
3796
+ aiPlan: args.aiPlan ? String(args.aiPlan) : void 0,
3797
+ rounds: args.rounds ? String(args.rounds) : void 0
3487
3798
  });
3488
3799
  plan.host = ctx.host;
3489
3800
  if (plan.isAI && !plan.aiPlanPicked) {
@@ -3502,19 +3813,36 @@ async function apply3(args, env) {
3502
3813
  dataDetails: plan.dataDetails
3503
3814
  });
3504
3815
  const actionsRun = await execSaveActions(plan, formDataId);
3816
+ const verification = await verifySubmitted({
3817
+ host: ctx.host,
3818
+ formId: plan.formId,
3819
+ objId: plan.objId,
3820
+ dataId: formDataId,
3821
+ expected: expectedFields(
3822
+ plan.dataDetails,
3823
+ ctx.cache.fields[plan.objId] || {},
3824
+ ["interview_type", "interview_session", "interview_rounds", "digital_id", "email", "union_status"],
3825
+ ["union_status"]
3826
+ )
3827
+ });
3828
+ if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
3829
+ const verifyWarnings = verification.mismatches.map(
3830
+ (m) => "\u843D\u5E93\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A" + m.label + " \u671F\u671B " + m.expected + "\uFF0C\u5B9E\u9645 " + m.actual + "\uFF08\u8BE5\u5B57\u6BB5\u53EF\u80FD\u672A\u5199\u5165\uFF09"
3831
+ );
3505
3832
  const detailUrl = buildCardUrl(ctx.baseUrl, plan.objId, formDataId);
3506
- const listLocateUrl = buildListLocateUrl(ctx.baseUrl, ctx.appId, ctx.cache.lists?.interview?.listId || "", plan.objId, formDataId);
3833
+ const listLocateUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.interview?.listId || "");
3507
3834
  return rsSuccess("recruit-stage.interview.arrange.apply", {
3508
3835
  mode: "apply",
3509
- result: "success",
3836
+ result: verification.mismatches.length ? "partial" : "success",
3510
3837
  interviewFormId: formDataId,
3511
3838
  interviewCardUrl: detailUrl,
3512
3839
  viewLink: detailUrl ? `[\u67E5\u770B ${plan.cand.name || ""} \u7684\u9762\u8BD5\u5B89\u6392\u8BE6\u60C5](${detailUrl})` : null,
3513
- listLocateLink: listLocateUrl ? `[\u6253\u5F00\u9762\u8BD5\u7BA1\u7406\u5217\u8868\uFF08\u5DF2\u5B9A\u4F4D\u672C\u6B21\u9762\u8BD5\u5B89\u6392\uFF09](${listLocateUrl})` : null,
3514
- 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\u9875 \u2461 listLocateLink \u9762\u8BD5\u7BA1\u7406\u5217\u8868\u5E76\u53F3\u4FA7\u6ED1\u51FA\u672C\u6B21\u9762\u8BD5\u5B89\u6392\uFF1B\u6309\u987A\u5E8F\u539F\u6837\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",
3840
+ listLocateLink: listLocateUrl ? `[\u6253\u5F00\u9762\u8BD5\u7BA1\u7406\u5217\u8868](${listLocateUrl})` : null,
3841
+ 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 \u2461 listLocateLink \u9762\u8BD5\u7BA1\u7406\u5217\u8868\uFF08\u53EA\u6253\u5F00\u5217\u8868\uFF0C\u4E0D\u6253\u5F00\u8BE6\u60C5\uFF09\u3002\u6309\u987A\u5E8F\u539F\u6837\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",
3515
3842
  aiPlan: plan.isAI && plan.aiPlanPicked ? { id: plan.aiPlanPicked.id, name: plan.aiPlanPicked.name } : void 0,
3516
3843
  saveActions: actionsRun.executed,
3517
- warnings: actionsRun.warnings,
3844
+ verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
3845
+ warnings: [...actionsRun.warnings || [], ...verifyWarnings],
3518
3846
  assigned: actionsRun.assigned || {}
3519
3847
  });
3520
3848
  }
@@ -3527,7 +3855,7 @@ async function prefill2(args, env) {
3527
3855
  const typeKey = String(args.type || "AI\u9762\u8BD5");
3528
3856
  const typeFid = fields.interview_type;
3529
3857
  if (!typeFid) throw rsFail("\u9762\u8BD5\u8BA1\u5212\u7F3A\u5C11\u5B57\u6BB5 interview_type\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
3530
- const typeMap = cachedDsMap(ctx.cache, objId, "interview_type") || await getDsOptions(ctx.host, objId, typeFid, ctx.appId);
3858
+ const typeMap = await getDsOptions(ctx.host, objId, typeFid);
3531
3859
  const typeId = typeMap[typeKey];
3532
3860
  if (!typeId) throw rsFail("\u9762\u8BD5\u65B9\u5F0F\u300C" + typeKey + "\u300D\u4E0D\u5728\u679A\u4E3E\u4E2D\uFF08" + Object.keys(typeMap).join("/") + "\uFF09");
3533
3861
  const cardUrl = resolveTalentCardUrl2(ctx, talentId);
@@ -3690,7 +4018,7 @@ async function prepare4(args, env) {
3690
4018
  const analysis = submitBtn ? analyzeButtonActions(submitBtn) : null;
3691
4019
  let newOptionId = null;
3692
4020
  if (args.result) {
3693
- const opts = cachedDsMap(t.cache, t.objId, "result") || await getDsOptions(t.host, t.objId, t.resultFid, t.appId);
4021
+ const opts = await getDsOptions(t.host, t.objId, t.resultFid);
3694
4022
  newOptionId = opts[String(args.result)];
3695
4023
  if (!newOptionId) throw rsFail("\u672A\u8BC6\u522B\u7684\u9762\u8BD5\u7ED3\u679C\u300C" + args.result + "\u300D\uFF0C\u53EF\u9009\uFF1A" + Object.keys(opts).join("/"));
3696
4024
  }
@@ -3699,7 +4027,11 @@ async function prepare4(args, env) {
3699
4027
  const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
3700
4028
  const { createHash: createHash3 } = await import("node:crypto");
3701
4029
  const fp = createHash3("sha256").update(JSON.stringify(willSubmit)).digest("hex");
3702
- const continuation = await env.continuation.issue({ operation: "recruit-stage.interview.feedback.edit.apply", fingerprint: fp });
4030
+ const continuation = await env.continuation.issue({
4031
+ operation: "recruit-stage.interview.feedback.edit.apply",
4032
+ fingerprint: fp,
4033
+ enumMaps: await dsOptionsSnapshot()
4034
+ });
3703
4035
  return rsSuccess("recruit-stage.interview.feedback.edit.prepare", {
3704
4036
  mode: "prepare",
3705
4037
  talentId: t.talentId,
@@ -3721,12 +4053,13 @@ async function apply4(args, env) {
3721
4053
  if (args.confirm !== true) throw rsConfirmationError("recruit-stage.interview.feedback.edit.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
3722
4054
  if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
3723
4055
  const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.interview.feedback.edit.apply");
4056
+ restoreDsOptions(payload.enumMaps);
3724
4057
  const t = await buildTarget(env, args);
3725
4058
  const rec2 = await getFormDataRecord(t.host, t.formId, String(t.target.feedbackId), t.objId);
3726
4059
  const details2 = toSubmitDetails(rec2.dataDetails);
3727
4060
  let newOptionId = null;
3728
4061
  if (args.result) {
3729
- const opts = cachedDsMap(t.cache, t.objId, "result") || await getDsOptions(t.host, t.objId, t.resultFid, t.appId);
4062
+ const opts = await getDsOptions(t.host, t.objId, t.resultFid);
3730
4063
  newOptionId = opts[String(args.result)];
3731
4064
  if (!newOptionId) throw rsFail("\u672A\u8BC6\u522B\u7684\u9762\u8BD5\u7ED3\u679C\u300C" + args.result + "\u300D\uFF0C\u53EF\u9009\uFF1A" + Object.keys(opts).join("/"));
3732
4065
  }
@@ -4478,10 +4811,10 @@ var recruitStageManifest = {
4478
4811
  };
4479
4812
 
4480
4813
  // src/shortcuts/recruit-stage/context.ts
4481
- import { join, resolve as resolve2 } from "node:path";
4814
+ import { join as join2, resolve as resolve2 } from "node:path";
4482
4815
  import { existsSync as existsSync2 } from "node:fs";
4483
4816
  import { readFile as readFile2 } from "node:fs/promises";
4484
- import { homedir as homedir2 } from "node:os";
4817
+ import { homedir as homedir3 } from "node:os";
4485
4818
  var flowMemo = /* @__PURE__ */ new Map();
4486
4819
  var SELFUSE_DEFAULT_FLOW = {
4487
4820
  selfUseHost: "www.e-cology.com.cn",
@@ -4493,9 +4826,9 @@ function cacheDirFor(baseUrl) {
4493
4826
  const url = new URL(baseUrl);
4494
4827
  const host = url.hostname + (url.port ? `_${url.port}` : "");
4495
4828
  const envRoot = process.env.E10_SKILL_CACHE_DIR;
4496
- if (envRoot) return join(envRoot, host);
4497
- const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve2(homedir2(), ".weaver-work-cli");
4498
- return join(home, "env-cache", "recruit-ops", host);
4829
+ if (envRoot) return join2(envRoot, host);
4830
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve2(homedir3(), ".weaver-work-cli");
4831
+ return join2(home, "env-cache", "recruit-ops", host);
4499
4832
  }
4500
4833
  async function readLegacyCacheExtra(baseUrl) {
4501
4834
  try {
@@ -4508,7 +4841,7 @@ async function readLegacyCacheExtra(baseUrl) {
4508
4841
  for (const f of jsonFiles) {
4509
4842
  let raw;
4510
4843
  try {
4511
- raw = JSON.parse(await readFile2(join(dir, f), "utf8"));
4844
+ raw = JSON.parse(await readFile2(join2(dir, f), "utf8"));
4512
4845
  } catch {
4513
4846
  continue;
4514
4847
  }