weaver-work-cli 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
- package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
- package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
- package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
- package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-MCXQBD6N.js} +3 -3
- package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
- package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
- package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
- package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
- package/dist/chunks/{chunk-FAZTGX7S.js → chunk-4RWS2YYL.js} +5 -5
- package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-6AXKWFKG.js} +32 -12
- package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
- package/dist/chunks/{chunk-QVSWRLLU.js → chunk-6V5ZPKHV.js} +56 -12
- package/dist/chunks/chunk-762M5XJS.js +215 -0
- package/dist/chunks/{chunk-PC7VKEB5.js → chunk-76H3IKH6.js} +178 -37
- package/dist/chunks/{chunk-FRZKBMSW.js → chunk-AD46OMQK.js} +239 -41
- package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
- package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
- package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
- package/dist/chunks/{chunk-CWYGFU5B.js → chunk-GSZTA43P.js} +2 -2
- package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
- package/dist/chunks/{chunk-N4M2DDFE.js → chunk-IP4CWQCF.js} +11 -11
- package/dist/chunks/{chunk-GAMZLAG2.js → chunk-IRMIEDXN.js} +1 -1
- package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
- package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-JFAWZX53.js} +134 -13
- package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
- package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-OXHHJWNC.js} +1 -1
- package/dist/chunks/chunk-P5GQRWDC.js +60 -0
- package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
- package/dist/chunks/{chunk-OF4S23UB.js → chunk-PSOMGA3U.js} +4 -4
- package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
- package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
- package/dist/chunks/{chunk-XHK4MDR5.js → chunk-UFIFZ4YC.js} +48 -14
- package/dist/chunks/chunk-VRPH24IC.js +76 -0
- package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
- package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
- package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-H7EHQXYY.js} +2 -2
- package/dist/chunks/continuation-GW6PRWK3.js +12 -0
- package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
- package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
- package/dist/chunks/{create-flow-J22BO65E.js → create-flow-VRVJEOBX.js} +6 -6
- package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
- package/dist/chunks/{ehr-GSTGAIY3.js → ehr-SH2LM3NK.js} +648 -88
- package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
- package/dist/chunks/{env-BX3VRFS7.js → env-66FPSJDV.js} +2 -2
- package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
- package/dist/chunks/{factory-PETTFME6.js → factory-UH2TZBVA.js} +1 -1
- package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
- package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-CAKMMV7K.js} +3 -3
- package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
- package/dist/chunks/host-7NTIBSPK.js +25 -0
- package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
- package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
- package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
- package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
- package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
- package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
- package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
- package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
- package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-DD6ULZ3I.js} +4 -4
- package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
- package/dist/chunks/{meeting-FEVPZ67S.js → meeting-VTBFW4HI.js} +12 -12
- package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
- package/dist/chunks/operations-J7PUIVWZ.js +15 -0
- package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
- package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
- package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
- package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-CAKZTUA7.js} +1343 -178
- package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
- package/dist/chunks/{registry-IM5G23LS.js → registry-JVQBLFQ5.js} +10 -10
- package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
- package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
- package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-5U55FMXZ.js} +6 -4
- package/dist/chunks/{schedule-ESZIBAUO.js → schedule-IDETODCA.js} +4 -4
- package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
- package/dist/cmd/action.js +14 -10
- package/dist/index.js +30 -30
- package/dist/internal/e10/auth/commands.js +32 -0
- package/dist/internal/e10/auth/error-log.js +156 -26
- package/dist/internal/e10/auth/xiaoe.js +176 -13
- package/dist/internal/e10/context.js +12 -1
- package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
- package/dist/shortcuts/archive/operations/flow-url.js +182 -22
- package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
- package/dist/shortcuts/archive/operations/prelib.js +33 -4
- package/dist/shortcuts/archive/operations/shared.js +52 -0
- package/dist/shortcuts/contract/host.js +111 -4
- package/dist/shortcuts/contract/index.js +19 -0
- package/dist/shortcuts/contract/manifest.js +125 -0
- package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
- package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
- package/dist/shortcuts/contract/operations/customer.js +192 -0
- package/dist/shortcuts/contract/operations/file-download.js +75 -0
- package/dist/shortcuts/contract/operations/flow.js +44 -2
- package/dist/shortcuts/contract/operations/form-info.js +162 -62
- package/dist/shortcuts/contract/operations/registry.js +8 -0
- package/dist/shortcuts/contract/operations/review.js +116 -1
- package/dist/shortcuts/contract/operations/summary.js +177 -0
- package/dist/shortcuts/contract/operations/upload.js +64 -4
- package/dist/shortcuts/contract/upload-cache.js +104 -0
- package/dist/shortcuts/ehr/host.js +2 -2
- package/dist/shortcuts/ehr/index.js +14 -3
- package/dist/shortcuts/ehr/manifest.js +5 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +44 -12
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +146 -43
- package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +154 -36
- package/dist/shortcuts/ehr/operations/recruit.js +196 -12
- package/dist/shortcuts/ehr/operations/registry.js +4 -0
- package/dist/shortcuts/ehr/operations.js +24 -0
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
- package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
- package/dist/shortcuts/hrm/operations/employee.js +29 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +274 -75
- package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +63 -11
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +38 -7
- package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
- package/dist/shortcuts/meeting/operations/invitation.js +27 -4
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +356 -29
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +36 -10
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +309 -67
- package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +310 -17
- package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
- package/dist/shortcuts/recruit-stage/shared.js +221 -24
- package/dist/shortcuts/workflow/index.js +2 -0
- package/dist/shortcuts/workflow/operations/read.js +8 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
- package/docs/contract.md +1 -0
- package/docs/e10-auth.md +4 -2
- package/docs/todo-smart-convert/data-contract.md +7 -0
- package/package.json +1 -1
- package/skill-template/domains/jinchengda.md +2 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
- package/skills/weaver-e10-jucailin/SKILL.md +12 -3
- package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
- package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -91
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
- package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +55 -11
- package/skills/weaver-e10-meeting/SKILL.md +103 -11
- package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +19 -11
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -8
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +23 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +11 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
- package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
- package/skills/weaver-e10-workflow/SKILL.md +19 -17
- package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
createRecruitContextLoader
|
|
5
|
-
|
|
4
|
+
createRecruitContextLoader,
|
|
5
|
+
ehrValidationError
|
|
6
|
+
} from "./chunk-JFAWZX53.js";
|
|
6
7
|
import {
|
|
7
8
|
CONTINUATION_TTL_MS
|
|
8
9
|
} from "./chunk-7BDPM5ST.js";
|
|
@@ -11,11 +12,11 @@ import {
|
|
|
11
12
|
createE10RequestRuntime,
|
|
12
13
|
isE10SessionExpiredResponse,
|
|
13
14
|
requireE10Session
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6NXT4ICB.js";
|
|
15
16
|
import {
|
|
16
17
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
17
18
|
getActiveProfile
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-U6R6FZHD.js";
|
|
19
20
|
import {
|
|
20
21
|
CliError,
|
|
21
22
|
isCliError,
|
|
@@ -261,6 +262,11 @@ import { createHash, randomBytes as randomBytes2 } from "node:crypto";
|
|
|
261
262
|
function rsSuccess(action, data, meta) {
|
|
262
263
|
const payload = { ok: true, action, data };
|
|
263
264
|
if (meta && Object.keys(meta).length > 0) payload.meta = meta;
|
|
265
|
+
const cont = meta?.continuation;
|
|
266
|
+
if (typeof cont === "string" && data && typeof data === "object" && !Array.isArray(data)) {
|
|
267
|
+
const obj = data;
|
|
268
|
+
if (!(typeof obj.continuation === "string" && obj.continuation)) obj.continuation = cont;
|
|
269
|
+
}
|
|
264
270
|
return payload;
|
|
265
271
|
}
|
|
266
272
|
function schemaOf(properties, options = {}) {
|
|
@@ -275,6 +281,9 @@ function schemaOf(properties, options = {}) {
|
|
|
275
281
|
|
|
276
282
|
// src/shortcuts/recruit-stage/shared.ts
|
|
277
283
|
import { randomUUID } from "node:crypto";
|
|
284
|
+
import { unlinkSync } from "node:fs";
|
|
285
|
+
import { homedir as homedir2 } from "node:os";
|
|
286
|
+
import { join, resolve as resolvePath } from "node:path";
|
|
278
287
|
function randHex32() {
|
|
279
288
|
return randomUUID().replace(/-/g, "");
|
|
280
289
|
}
|
|
@@ -347,6 +356,32 @@ async function getFormButtons(host, objId, layoutId) {
|
|
|
347
356
|
}
|
|
348
357
|
return actions;
|
|
349
358
|
}
|
|
359
|
+
async function probeCreatePermission(host, objId) {
|
|
360
|
+
try {
|
|
361
|
+
const r = await host.request({
|
|
362
|
+
path: "/api/ebuilder/form/data/getFormButtons",
|
|
363
|
+
body: {
|
|
364
|
+
layoutType: "formLayout",
|
|
365
|
+
objId,
|
|
366
|
+
dataId: "",
|
|
367
|
+
formDataId: "",
|
|
368
|
+
type: "1",
|
|
369
|
+
fromRecycle: false,
|
|
370
|
+
otherOperator: "",
|
|
371
|
+
objectAppId: "",
|
|
372
|
+
browser: "Chrome",
|
|
373
|
+
isTamper: "0"
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
const d = r?.data;
|
|
377
|
+
const btns = Array.isArray(d) ? d : d?.buttons || [];
|
|
378
|
+
if (!Array.isArray(btns) || !btns.length) return "unknown";
|
|
379
|
+
const hasSave = btns.some((b) => String(b?.buttonKey || "").toLowerCase().includes("save") || String(b?.name || "").includes("\u4FDD\u5B58"));
|
|
380
|
+
return hasSave ? "ok" : "denied";
|
|
381
|
+
} catch {
|
|
382
|
+
return "unknown";
|
|
383
|
+
}
|
|
384
|
+
}
|
|
350
385
|
function pickSaveButtonActions(actions, { includeDisabled = false } = {}) {
|
|
351
386
|
const all = actions || [];
|
|
352
387
|
let own = all.filter((a) => a._buttonKey === "save");
|
|
@@ -525,31 +560,171 @@ async function resolveCurrentUser(host) {
|
|
|
525
560
|
return null;
|
|
526
561
|
}
|
|
527
562
|
}
|
|
528
|
-
async function resolvePersonId(host,
|
|
563
|
+
async function resolvePersonId(host, _fieldId, keyword) {
|
|
564
|
+
const kw = String(keyword || "").trim();
|
|
565
|
+
if (!kw) return null;
|
|
566
|
+
const formDatas = {
|
|
567
|
+
status: [{ statusSelect: ["normal"] }],
|
|
568
|
+
subcompany: [{ subcompanyOpt: "in" }],
|
|
569
|
+
department: [{ departmentOpt: "in" }],
|
|
570
|
+
role: [{ roleOpt: "in" }],
|
|
571
|
+
position: [{ positionOpt: "in" }],
|
|
572
|
+
superior: [{ superiorOpt: "in" }]
|
|
573
|
+
};
|
|
574
|
+
if (/@/.test(kw)) formDatas.email = [{ emailOpt: "in", emailInput: kw }];
|
|
575
|
+
else if (/^\d{11}$/.test(kw)) formDatas.mobile = [{ mobileOpt: "in", mobileInput: kw }];
|
|
576
|
+
else formDatas.username = [{ usernameOpt: "in", usernameInput: kw }];
|
|
529
577
|
const r = await host.request({
|
|
530
|
-
path: "/api/
|
|
531
|
-
body: {
|
|
578
|
+
path: "/api/hrm/common/browser/data/resource",
|
|
579
|
+
body: {
|
|
580
|
+
browserMultiple: true,
|
|
581
|
+
authWecahtBook: false,
|
|
582
|
+
wxDepNeedConvertCount: 0,
|
|
583
|
+
wxEmpNeedConvertCount: 0,
|
|
584
|
+
wxTotalNeedConvertCount: 0,
|
|
585
|
+
...formDatas,
|
|
586
|
+
cmd: "all",
|
|
587
|
+
formDatas,
|
|
588
|
+
quickSearchDatas: {},
|
|
589
|
+
type: "and",
|
|
590
|
+
current: 1,
|
|
591
|
+
pageSize: 200,
|
|
592
|
+
containsNoneAccount: false,
|
|
593
|
+
containsPartTimeEmployee: false,
|
|
594
|
+
containsDls: false
|
|
595
|
+
}
|
|
532
596
|
});
|
|
533
|
-
const
|
|
534
|
-
|
|
597
|
+
const rows = (r?.data?.data ?? []).filter((x) => x && (x.id || x.value) && x.name);
|
|
598
|
+
if (!rows.length) return null;
|
|
599
|
+
const nameOf = (x) => String(x.name || "").trim();
|
|
600
|
+
const idOf = (x) => String(x.id ?? x.value ?? "");
|
|
601
|
+
const exact = rows.filter((x) => nameOf(x) === kw);
|
|
602
|
+
if (exact.length === 1) return idOf(exact[0]) || null;
|
|
603
|
+
if (exact.length > 1) throw ambiguousPerson(kw, exact);
|
|
604
|
+
if (rows.length === 1) return idOf(rows[0]) || null;
|
|
605
|
+
throw ambiguousPerson(kw, rows);
|
|
606
|
+
}
|
|
607
|
+
function ambiguousPerson(keyword, rows) {
|
|
608
|
+
const candidates = rows.slice(0, 20).map((r) => ({
|
|
609
|
+
id: String(r.id ?? r.value ?? ""),
|
|
610
|
+
name: String(r.name ?? ""),
|
|
611
|
+
department: String(r.department ?? ""),
|
|
612
|
+
position: String(r.position ?? "")
|
|
613
|
+
}));
|
|
614
|
+
return ehrValidationError(
|
|
615
|
+
"person_ambiguous",
|
|
616
|
+
`\u4EBA\u5458\u300C${keyword}\u300D\u547D\u4E2D ${rows.length} \u4EBA\uFF0C\u8BF7\u6307\u660E\u5177\u4F53\u662F\u54EA\u4E00\u4F4D\uFF1A${candidates.map((c) => `${c.name}${c.department ? `\uFF08${c.department}\uFF09` : ""}`).join("\u3001")}`,
|
|
617
|
+
{ candidates }
|
|
618
|
+
);
|
|
535
619
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
for (const x of list) map[x.name] = x.id;
|
|
544
|
-
return map;
|
|
620
|
+
var dsOptionsMemo = /* @__PURE__ */ new Map();
|
|
621
|
+
function restoreDsOptions(snapshot) {
|
|
622
|
+
for (const [key, value] of Object.entries(snapshot || {})) {
|
|
623
|
+
if (value && typeof value === "object" && Object.keys(value).length) {
|
|
624
|
+
dsOptionsMemo.set(key, Promise.resolve(value));
|
|
625
|
+
}
|
|
626
|
+
}
|
|
545
627
|
}
|
|
546
|
-
function
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
628
|
+
async function dsOptionsSnapshot() {
|
|
629
|
+
const out = {};
|
|
630
|
+
await Promise.all([...dsOptionsMemo.entries()].map(async ([key, task]) => {
|
|
631
|
+
try {
|
|
632
|
+
const value = await task;
|
|
633
|
+
if (value && Object.keys(value).length) out[key] = value;
|
|
634
|
+
} catch {
|
|
635
|
+
}
|
|
636
|
+
}));
|
|
637
|
+
return out;
|
|
638
|
+
}
|
|
639
|
+
function expectedFields(details, fields, keys, nonEmptyOnly = [], optionalKeys = []) {
|
|
640
|
+
const out = [];
|
|
641
|
+
for (const k of keys) {
|
|
642
|
+
const fid = fields[k];
|
|
643
|
+
if (!fid) continue;
|
|
644
|
+
const d = (details || []).find((x) => String(x?.formField?.id) === String(fid));
|
|
645
|
+
if (!d) continue;
|
|
646
|
+
const value = String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? "");
|
|
647
|
+
const optional = optionalKeys.includes(k);
|
|
648
|
+
if (nonEmptyOnly.includes(k)) out.push({ fieldId: String(fid), label: k, expected: "*", optional });
|
|
649
|
+
else if (value) out.push({ fieldId: String(fid), label: k, expected: value, optional });
|
|
650
|
+
}
|
|
651
|
+
return out;
|
|
652
|
+
}
|
|
653
|
+
async function verifySubmitted(opts) {
|
|
654
|
+
const { host, formId, objId, dataId, expected } = opts;
|
|
655
|
+
if (!expected.length) return { checked: 0, mismatches: [] };
|
|
656
|
+
let details = [];
|
|
657
|
+
try {
|
|
658
|
+
const r = await host.request({
|
|
659
|
+
path: "/api/ebuilder/form/form/core/getFormDataAndLayout?formId=" + encodeURIComponent(formId) + "&dataId=" + encodeURIComponent(dataId),
|
|
660
|
+
method: "POST",
|
|
661
|
+
body: {
|
|
662
|
+
terminalType: "PC",
|
|
663
|
+
dataId,
|
|
664
|
+
formId,
|
|
665
|
+
module: "ebuilderform",
|
|
666
|
+
newLayout: true,
|
|
667
|
+
cacheUid: "",
|
|
668
|
+
layoutMultiId: "",
|
|
669
|
+
dataCrossLayout: false,
|
|
670
|
+
permissionId: "",
|
|
671
|
+
allReadOnly: false,
|
|
672
|
+
initialDatas: [],
|
|
673
|
+
dynamicData: false,
|
|
674
|
+
cost: false,
|
|
675
|
+
customParam: { objId }
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
details = r?.data?.formData?.dataDetails || [];
|
|
679
|
+
} catch (e) {
|
|
680
|
+
return { checked: 0, mismatches: [], unavailable: e?.message || "\u56DE\u67E5\u63A5\u53E3\u4E0D\u53EF\u7528" };
|
|
681
|
+
}
|
|
682
|
+
const byId = /* @__PURE__ */ new Map();
|
|
683
|
+
for (const d of details) {
|
|
684
|
+
const fid = String(d?.fieldId || d?.formField?.id || "");
|
|
685
|
+
if (fid) byId.set(fid, d);
|
|
686
|
+
}
|
|
687
|
+
const mismatches = [];
|
|
688
|
+
for (const e of expected) {
|
|
689
|
+
const d = byId.get(e.fieldId);
|
|
690
|
+
if (!d && e.optional) continue;
|
|
691
|
+
const actual = d ? String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? "") : "";
|
|
692
|
+
const bad = e.expected === "*" ? !actual : actual !== e.expected;
|
|
693
|
+
if (bad) mismatches.push({ label: e.label, expected: e.expected === "*" ? "\uFF08\u975E\u7A7A\uFF09" : e.expected, actual: actual || "\uFF08\u7A7A\uFF09" });
|
|
694
|
+
}
|
|
695
|
+
return { checked: expected.length, mismatches };
|
|
696
|
+
}
|
|
697
|
+
function invalidateEnvCache(baseUrl, appId) {
|
|
698
|
+
dsOptionsMemo.clear();
|
|
699
|
+
if (!baseUrl || !appId) return;
|
|
700
|
+
try {
|
|
701
|
+
const host = baseUrl.replace(/^https?:\/\//, "").replace(/\/+$/, "").replace(/:/g, "_");
|
|
702
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir2(), ".weaver-work-cli");
|
|
703
|
+
const root = process.env.E10_SKILL_CACHE_DIR || join(home, "env-cache", "recruit-ops");
|
|
704
|
+
unlinkSync(join(root, host, appId + ".json"));
|
|
705
|
+
} catch {
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
async function getDsOptions(host, objId, fieldId, groupId = "") {
|
|
709
|
+
const key = objId + ":" + fieldId;
|
|
710
|
+
const hit = dsOptionsMemo.get(key);
|
|
711
|
+
if (hit) return hit;
|
|
712
|
+
const task = (async () => {
|
|
713
|
+
const r = await host.request({
|
|
714
|
+
path: "/api/ebuilder/common/ds/options?fieldName=" + fieldId + "&objId=" + objId + "&sourceType=FORM" + (groupId ? "&groupId=" + groupId : ""),
|
|
715
|
+
method: "GET"
|
|
716
|
+
});
|
|
717
|
+
const list = r?.data || [];
|
|
718
|
+
const map = {};
|
|
719
|
+
for (const x of list) if (x?.name && x?.id) map[String(x.name)] = String(x.id);
|
|
720
|
+
if (!Object.keys(map).length) dsOptionsMemo.delete(key);
|
|
721
|
+
return map;
|
|
722
|
+
})();
|
|
723
|
+
dsOptionsMemo.set(key, task);
|
|
724
|
+
task.catch(() => {
|
|
725
|
+
dsOptionsMemo.delete(key);
|
|
726
|
+
});
|
|
727
|
+
return task;
|
|
553
728
|
}
|
|
554
729
|
async function getFormButtonsForData(host, objId, formId, dataId, layoutId) {
|
|
555
730
|
const body = {
|
|
@@ -750,10 +925,9 @@ function buildCardUrl(baseUrl, objId, dataId) {
|
|
|
750
925
|
if (!baseUrl || !objId || !dataId) return null;
|
|
751
926
|
return String(baseUrl).replace(/\/+$/, "") + "/sp/ebdfpage/card/0/" + objId + "/" + dataId;
|
|
752
927
|
}
|
|
753
|
-
function
|
|
754
|
-
if (!baseUrl || !listId
|
|
755
|
-
|
|
756
|
-
return `${base}/sp/ebdfpage/list/${listId}/card/0/${objId}/${dataId}/${listId}?id=${dataId}&openSource=field&openSourceId=${dataId}&openSourceAppId=${appId}`;
|
|
928
|
+
function buildListUrl(baseUrl, listId) {
|
|
929
|
+
if (!baseUrl || !listId) return null;
|
|
930
|
+
return String(baseUrl).replace(/\/+$/, "") + "/sp/ebdfpage/list/" + listId;
|
|
757
931
|
}
|
|
758
932
|
|
|
759
933
|
// src/shortcuts/recruit-stage/operations/jd-create.ts
|
|
@@ -765,12 +939,11 @@ var DEF_OPTION = { salary_type: "\u6708\u85AA", recruit_type: "\u793E\u4F1A\u62D
|
|
|
765
939
|
var DEF_CURRENT_USER = ["recr_principal", "employ_manager"];
|
|
766
940
|
var DEF_FROM_REF = [
|
|
767
941
|
"position_nature",
|
|
768
|
-
"job_category",
|
|
769
942
|
"education",
|
|
770
|
-
"work_years"
|
|
771
|
-
"work_location"
|
|
943
|
+
"work_years"
|
|
772
944
|
];
|
|
773
945
|
var DEF_STATUS = "\u62DB\u8058\u4E2D";
|
|
946
|
+
var DEFAULT_WORK_LOCATION = "\u6D66\u6C5F\u9547\u4E09\u9C81\u516C\u8DEF3419\u53F7\u6CDB\u5FAE\u8F6F\u4EF6\u56ED";
|
|
774
947
|
var NUM_KEYS = /* @__PURE__ */ new Set(["recruit_count", "number_of_pay_months", "salary_min", "salary_max", "internship_duration", "working_days"]);
|
|
775
948
|
var PERSON_KEYS = /* @__PURE__ */ new Set(["recr_principal", "recr_helper", "employ_manager", "interviewer"]);
|
|
776
949
|
var OPTION_KEYS = /* @__PURE__ */ new Set(["salary_type", "recruit_type", "status"]);
|
|
@@ -855,10 +1028,10 @@ async function findWorkPlaceMenu(ctx) {
|
|
|
855
1028
|
try {
|
|
856
1029
|
const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
|
|
857
1030
|
const flat = [];
|
|
858
|
-
(function
|
|
1031
|
+
(function walk2(ns) {
|
|
859
1032
|
for (const n of ns || []) if (n && typeof n === "object") {
|
|
860
1033
|
flat.push(n);
|
|
861
|
-
|
|
1034
|
+
walk2(n.children || n.childs);
|
|
862
1035
|
}
|
|
863
1036
|
})(r?.data?.cusAppMenus || r?.data);
|
|
864
1037
|
const hit3 = findMenuNode(flat, WORK_PLACE_NAMES, (m) => ok(m));
|
|
@@ -867,55 +1040,119 @@ async function findWorkPlaceMenu(ctx) {
|
|
|
867
1040
|
}
|
|
868
1041
|
return null;
|
|
869
1042
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1043
|
+
var workPlaceMemo = /* @__PURE__ */ new Map();
|
|
1044
|
+
function stripHtml(s) {
|
|
1045
|
+
return String(s ?? "").replace(/<[^>]*>/g, "").trim();
|
|
1046
|
+
}
|
|
1047
|
+
function parseSpans(raw) {
|
|
875
1048
|
try {
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
if (Array.isArray(d) && d[0]) pObj = String(d[0].id || "");
|
|
1049
|
+
const v = Array.isArray(raw) ? raw : JSON.parse(String(raw || "[]"));
|
|
1050
|
+
return Array.isArray(v) ? v : [];
|
|
879
1051
|
} catch {
|
|
1052
|
+
return [];
|
|
880
1053
|
}
|
|
1054
|
+
}
|
|
1055
|
+
function isEnabledText(s) {
|
|
1056
|
+
const t = stripHtml(s);
|
|
1057
|
+
return t.includes("\u542F\u7528") && !t.includes("\u7981\u7528");
|
|
1058
|
+
}
|
|
1059
|
+
async function loadWorkPlaces(ctx) {
|
|
1060
|
+
const { host, appId } = ctx;
|
|
881
1061
|
const menu = await findWorkPlaceMenu(ctx);
|
|
882
|
-
if (!menu) return
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1062
|
+
if (!menu) return { rows: [], statusFiltered: false };
|
|
1063
|
+
const key = appId + "|" + menu.listId;
|
|
1064
|
+
const cached = workPlaceMemo.get(key);
|
|
1065
|
+
if (cached) return cached;
|
|
1066
|
+
const [tagObjId] = await Promise.all([
|
|
1067
|
+
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(() => "")
|
|
1068
|
+
]);
|
|
1069
|
+
const pObj = tagObjId || String(menu.objId || "");
|
|
1070
|
+
if (!pObj) return { rows: [], statusFiltered: false };
|
|
1071
|
+
const pageSize = 200;
|
|
1072
|
+
const rawRows = [];
|
|
1073
|
+
const dispRows = [];
|
|
1074
|
+
for (let page = 1; page <= 5; page++) {
|
|
1075
|
+
const body = {
|
|
1076
|
+
current: page,
|
|
1077
|
+
pageSize,
|
|
1078
|
+
tableuid: randHex32(),
|
|
1079
|
+
listId: menu.listId,
|
|
1080
|
+
searchParamData: { searchType: "3", type: "and" },
|
|
1081
|
+
terminal: "PC",
|
|
1082
|
+
browser: "Chrome",
|
|
1083
|
+
requiredMatch: 1,
|
|
1084
|
+
mapResult: 1,
|
|
1085
|
+
recheckQuery: 1,
|
|
1086
|
+
isFollow: 0,
|
|
1087
|
+
isShareToMe: 0,
|
|
1088
|
+
filterCondition: {},
|
|
1089
|
+
cusMenuId: menu.cusMenuId,
|
|
1090
|
+
urlPageTitle: menu.menuName,
|
|
1091
|
+
menuName: menu.menuName
|
|
1092
|
+
};
|
|
1093
|
+
const r = await host.request({
|
|
1094
|
+
path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`,
|
|
1095
|
+
body,
|
|
1096
|
+
headers: { ebBusinessId: menu.listId }
|
|
1097
|
+
});
|
|
1098
|
+
const batch = r?.data?.data || r?.data?.displayData || [];
|
|
1099
|
+
rawRows.push(...batch);
|
|
1100
|
+
dispRows.push(...r?.data?.displayData || []);
|
|
1101
|
+
if (batch.length < pageSize) break;
|
|
1102
|
+
}
|
|
1103
|
+
const enabledStatusIds = /* @__PURE__ */ new Set();
|
|
1104
|
+
const enabledRowIds = /* @__PURE__ */ new Set();
|
|
1105
|
+
for (const d of dispRows) {
|
|
1106
|
+
const rid = String(d?.form_data_id || d?.id || "");
|
|
1107
|
+
if (isEnabledText(d?.place_status) && rid) enabledRowIds.add(rid);
|
|
1108
|
+
for (const s of parseSpans(d?.place_statusSpan)) {
|
|
1109
|
+
if (isEnabledText(s?.name) && s?.id) enabledStatusIds.add(String(s.id));
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
const statusFiltered = enabledRowIds.size > 0 || enabledStatusIds.size > 0;
|
|
1113
|
+
const rows = rawRows.filter((x) => !statusFiltered || enabledRowIds.has(String(x?.form_data_id || x?.id || "")) || enabledStatusIds.has(String(x?.place_status || ""))).map((x) => ({
|
|
1114
|
+
id: String(x?.form_data_id || x?.id || ""),
|
|
1115
|
+
name: String(x?.name || ""),
|
|
1116
|
+
detail: String(x?.detail_location || ""),
|
|
1117
|
+
area: String(x?.area_text || ""),
|
|
1118
|
+
city: String(x?.city || "")
|
|
1119
|
+
})).filter((x) => !!x.id);
|
|
1120
|
+
const out = { rows, statusFiltered };
|
|
1121
|
+
workPlaceMemo.set(key, out);
|
|
1122
|
+
return out;
|
|
1123
|
+
}
|
|
1124
|
+
function matchWorkPlace(rows, value) {
|
|
1125
|
+
const v = String(value).trim();
|
|
1126
|
+
if (!v || !rows.length) return null;
|
|
1127
|
+
const exact = rows.find((r) => r.detail === v) || rows.find((r) => r.name === v);
|
|
1128
|
+
if (exact) return exact;
|
|
1129
|
+
const valid = (s) => s.length >= 4 && !/^\d+$/.test(s);
|
|
1130
|
+
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;
|
|
1131
|
+
}
|
|
1132
|
+
async function resolveWorkLocation(ctx, value) {
|
|
1133
|
+
if (!String(value).trim()) return null;
|
|
1134
|
+
const { rows } = await loadWorkPlaces(ctx);
|
|
1135
|
+
const hit = matchWorkPlace(rows, value);
|
|
1136
|
+
return hit ? { id: hit.id, name: hit.detail || hit.name || String(value) } : null;
|
|
1137
|
+
}
|
|
1138
|
+
async function resolveDefaultWorkLocation(ctx) {
|
|
1139
|
+
return resolveWorkLocation(ctx, DEFAULT_WORK_LOCATION);
|
|
912
1140
|
}
|
|
913
1141
|
async function resolveSetValue(ctx, key, value, refByFid) {
|
|
914
1142
|
const { host, appId, cache } = ctx;
|
|
915
1143
|
const objId = objIdOf(cache, "position_manage");
|
|
916
1144
|
const id = (cache.fields[objId] || {})[key];
|
|
917
1145
|
if (!id) return null;
|
|
918
|
-
if (NUM_KEYS.has(key))
|
|
1146
|
+
if (NUM_KEYS.has(key)) {
|
|
1147
|
+
if (key === "salary_min" || key === "salary_max") {
|
|
1148
|
+
const n = Number(String(value).replace(/,/g, ""));
|
|
1149
|
+
if (Number.isFinite(n) && n > 0) {
|
|
1150
|
+
const k = n / 1e3;
|
|
1151
|
+
return { formField: { id }, content: String(Number.isInteger(k) ? k : Number(k.toFixed(3))) };
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return { formField: { id }, content: String(value) };
|
|
1155
|
+
}
|
|
919
1156
|
if (MTEXT_KEYS.has(key)) return { formField: { id }, dataText: { content: String(value) } };
|
|
920
1157
|
if (key === "position_name") return { formField: { id }, content: String(value) };
|
|
921
1158
|
if (PERSON_KEYS.has(key)) {
|
|
@@ -923,7 +1160,7 @@ async function resolveSetValue(ctx, key, value, refByFid) {
|
|
|
923
1160
|
return uid ? { formField: { id }, dataOptions: [{ optionId: String(uid), content: value }] } : null;
|
|
924
1161
|
}
|
|
925
1162
|
if (OPTION_KEYS.has(key)) {
|
|
926
|
-
const m =
|
|
1163
|
+
const m = await getDsOptions(host, objId, id);
|
|
927
1164
|
const oid = m[value];
|
|
928
1165
|
return oid ? { formField: { id }, dataOptions: [{ optionId: String(oid), content: value }] } : null;
|
|
929
1166
|
}
|
|
@@ -960,10 +1197,10 @@ async function resolvePositionNewUrl(ctx) {
|
|
|
960
1197
|
if (!node) {
|
|
961
1198
|
const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
|
|
962
1199
|
const flat = [];
|
|
963
|
-
(function
|
|
1200
|
+
(function walk2(ns) {
|
|
964
1201
|
for (const n of ns || []) if (n && typeof n === "object") {
|
|
965
1202
|
flat.push(n);
|
|
966
|
-
|
|
1203
|
+
walk2(n.children || n.childs);
|
|
967
1204
|
}
|
|
968
1205
|
})(r?.data?.cusAppMenus || r?.data);
|
|
969
1206
|
node = findMenuNode(flat, ["\u62DB\u8058\u804C\u4F4D", "\u804C\u4F4D\u5217\u8868", "\u804C\u4F4D\u7BA1\u7406"], (n) => n.combinationId && n.id && n.pageId);
|
|
@@ -975,10 +1212,10 @@ async function resolveHomePageUrl(ctx) {
|
|
|
975
1212
|
const { host, appId, baseUrl } = ctx;
|
|
976
1213
|
const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
|
|
977
1214
|
const flat = [];
|
|
978
|
-
(function
|
|
1215
|
+
(function walk2(ns) {
|
|
979
1216
|
for (const n of ns || []) if (n && typeof n === "object") {
|
|
980
1217
|
flat.push(n);
|
|
981
|
-
|
|
1218
|
+
walk2(n.children || n.childs);
|
|
982
1219
|
}
|
|
983
1220
|
})(r?.data?.cusAppMenus || r?.data);
|
|
984
1221
|
const node = findMenuNode(flat, ["\u62DB\u8058\u9996\u9875", "\u62DB\u8058\u4E3B\u9875"], (n) => n.pageType === "PAGE" && n.pageId && n.id) || flat.find((n) => n.pageType === "PAGE" && String(n.menuName || "").includes("\u9996\u9875"));
|
|
@@ -1076,6 +1313,7 @@ async function buildJd(opts) {
|
|
|
1076
1313
|
const fid = (k) => fields[k];
|
|
1077
1314
|
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
1315
|
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");
|
|
1316
|
+
const currentUserPromise = resolveCurrentUser(host).catch(() => null);
|
|
1079
1317
|
const refByFid = await fetchRefByFid(ctx);
|
|
1080
1318
|
const map = /* @__PURE__ */ new Map();
|
|
1081
1319
|
const put = (d) => {
|
|
@@ -1094,8 +1332,10 @@ async function buildJd(opts) {
|
|
|
1094
1332
|
}
|
|
1095
1333
|
const appliedSets = [];
|
|
1096
1334
|
const skippedSets = [];
|
|
1097
|
-
|
|
1098
|
-
|
|
1335
|
+
const resolvedSets = await Promise.all(
|
|
1336
|
+
sets.map(async ([k, v]) => ({ k, v, d: await resolveSetValue(ctx, k, v, refByFid).catch(() => null) }))
|
|
1337
|
+
);
|
|
1338
|
+
for (const { k, v, d } of resolvedSets) {
|
|
1099
1339
|
if (d) {
|
|
1100
1340
|
put(d);
|
|
1101
1341
|
appliedSets.push(k + "=" + v);
|
|
@@ -1105,7 +1345,7 @@ async function buildJd(opts) {
|
|
|
1105
1345
|
}
|
|
1106
1346
|
if (!hasKey("status")) {
|
|
1107
1347
|
if (!fid("status")) throw rsFail("\u804C\u4F4D\u7BA1\u7406\u7F3A\u5C11\u5B57\u6BB5 status\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
|
|
1108
|
-
const statusMap =
|
|
1348
|
+
const statusMap = await getDsOptions(host, objId, fid("status"));
|
|
1109
1349
|
const statusId = statusMap[DEF_STATUS];
|
|
1110
1350
|
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
1351
|
put({ formField: { id: fid("status") }, dataOptions: [{ optionId: String(statusId), content: DEF_STATUS }] });
|
|
@@ -1117,7 +1357,7 @@ async function buildJd(opts) {
|
|
|
1117
1357
|
const filled = [];
|
|
1118
1358
|
let currentUser = null;
|
|
1119
1359
|
if (DEF_CURRENT_USER.some((k) => fid(k) && !hasKey(k))) {
|
|
1120
|
-
currentUser = await
|
|
1360
|
+
currentUser = await currentUserPromise;
|
|
1121
1361
|
if (currentUser && currentUser.id) {
|
|
1122
1362
|
for (const k of DEF_CURRENT_USER) {
|
|
1123
1363
|
if (fid(k) && !hasKey(k)) {
|
|
@@ -1135,7 +1375,7 @@ async function buildJd(opts) {
|
|
|
1135
1375
|
}
|
|
1136
1376
|
for (const [k, name] of Object.entries(DEF_OPTION)) {
|
|
1137
1377
|
if (fid(k) && !hasKey(k)) {
|
|
1138
|
-
const m =
|
|
1378
|
+
const m = await getDsOptions(host, objId, fid(k));
|
|
1139
1379
|
const oid = m[name];
|
|
1140
1380
|
if (oid) {
|
|
1141
1381
|
put({ formField: { id: fid(k) }, dataOptions: [{ optionId: String(oid), content: name }] });
|
|
@@ -1155,6 +1395,27 @@ async function buildJd(opts) {
|
|
|
1155
1395
|
}
|
|
1156
1396
|
}
|
|
1157
1397
|
}
|
|
1398
|
+
const inheritedSalaryWarnings = [];
|
|
1399
|
+
for (const key of ["salary_min", "salary_max"]) {
|
|
1400
|
+
const hit = inheritedFromRef.find((x) => x.field === key);
|
|
1401
|
+
if (!hit) continue;
|
|
1402
|
+
const num = Number(String(hit.value).replace(/[^\d.]/g, ""));
|
|
1403
|
+
if (hit.value && Number.isFinite(num) && (num < 1 || num > 100)) {
|
|
1404
|
+
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");
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
let workLocationDefault = null;
|
|
1408
|
+
let workLocationWarning = null;
|
|
1409
|
+
if (!hasKey("work_location") && fid("work_location")) {
|
|
1410
|
+
const loc = await resolveDefaultWorkLocation(ctx).catch(() => null);
|
|
1411
|
+
if (loc) {
|
|
1412
|
+
put({ formField: { id: fid("work_location") }, dataOptions: [{ optionId: loc.id, content: loc.name }] });
|
|
1413
|
+
filled.push("work_location");
|
|
1414
|
+
workLocationDefault = loc.name;
|
|
1415
|
+
} else {
|
|
1416
|
+
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`;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1158
1419
|
const inv = {};
|
|
1159
1420
|
for (const [k, v] of Object.entries(fields)) inv[String(v)] = k;
|
|
1160
1421
|
const requiredDefaultsFilled = [...map.keys()].map((f) => inv[f] || f).filter((k) => filled.includes(k));
|
|
@@ -1176,9 +1437,12 @@ async function buildJd(opts) {
|
|
|
1176
1437
|
setApplied: appliedSets,
|
|
1177
1438
|
setSkipped: skippedSets,
|
|
1178
1439
|
// 明示哪些字段值继承自「环境内最近一条职位记录」——这些不是用户指定的,可能来自脏数据,
|
|
1179
|
-
//
|
|
1440
|
+
// 必须在确认摘要里人工核对(工作地点不参与继承,见 workLocationDefault)
|
|
1180
1441
|
inheritedFromRef: inheritedFromRef.length ? inheritedFromRef : void 0,
|
|
1181
|
-
|
|
1442
|
+
inheritedSalaryWarnings: inheritedSalaryWarnings.length ? inheritedSalaryWarnings : void 0,
|
|
1443
|
+
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,
|
|
1444
|
+
workLocationDefault: workLocationDefault || void 0,
|
|
1445
|
+
workLocationWarning: workLocationWarning || void 0,
|
|
1182
1446
|
requiredDefaultsFilled
|
|
1183
1447
|
}
|
|
1184
1448
|
};
|
|
@@ -1205,6 +1469,8 @@ async function prepare(args, env) {
|
|
|
1205
1469
|
const session = await host.getSession();
|
|
1206
1470
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
1207
1471
|
ctx.appId = ctx.cache.appId;
|
|
1472
|
+
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "position_manage"));
|
|
1473
|
+
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
1474
|
const positionName = String(args.positionName || "").trim();
|
|
1209
1475
|
if (!positionName) throw rsValidationError("position_name_required", "positionName \u5FC5\u586B");
|
|
1210
1476
|
const jd = await buildJd({
|
|
@@ -1219,28 +1485,85 @@ async function prepare(args, env) {
|
|
|
1219
1485
|
const refs = args.referenceKeyword ? await fetchRecentReferences(ctx, jd, String(args.referenceKeyword)).catch((e) => ({ available: false, reason: e.message, items: [] })) : {
|
|
1220
1486
|
available: false,
|
|
1221
1487
|
skipped: true,
|
|
1222
|
-
reason: "\u672A\u663E\u5F0F\u6307\u5B9A referenceKeyword\uFF0C\u5DF2\u8DF3\u8FC7\u540C\u7C7B\u804C\u4F4D\u53C2\u8003\u68C0\u7D22\
|
|
1488
|
+
reason: "\u672A\u663E\u5F0F\u6307\u5B9A referenceKeyword\uFF0C\u5DF2\u8DF3\u8FC7\u540C\u7C7B\u804C\u4F4D\u53C2\u8003\u68C0\u7D22\uFF1B\u8BF7\u6539\u7528 references/recruit-stage/position-templates.md \u7684\u5C97\u4F4D\u8303\u5F0F\u8865\u9F50 positionDuty / workRequest\uFF08\u8BE5\u6587\u4EF6\u672A\u8986\u76D6\u7684\u804C\u4F4D\u65CF\u987B\u7531\u7528\u6237\u63D0\u4F9B\uFF09",
|
|
1223
1489
|
items: []
|
|
1224
1490
|
};
|
|
1225
1491
|
const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
|
|
1226
1492
|
const fp = fingerprint(willSubmit);
|
|
1227
|
-
const continuation = await env.continuation.issue({
|
|
1493
|
+
const continuation = await env.continuation.issue({
|
|
1494
|
+
operation: "recruit-stage.jd.create.apply",
|
|
1495
|
+
fingerprint: fp,
|
|
1496
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
1497
|
+
// 🔴 2026-11-07 修复:协议文档写「apply 带 confirm + continuation」,但 apply 原来只从 args 取
|
|
1498
|
+
// positionName/positionDuty/...,Agent 少传 positionName 就直接报 position_name_required。
|
|
1499
|
+
// 现把 prepare 用过的业务参数一并签进 continuation;apply 显式传的仍优先。
|
|
1500
|
+
argsSnapshot: {
|
|
1501
|
+
positionName: String(args.positionName || ""),
|
|
1502
|
+
positionDuty: args.positionDuty ? String(args.positionDuty) : void 0,
|
|
1503
|
+
workRequest: args.workRequest ? String(args.workRequest) : void 0,
|
|
1504
|
+
demandId: args.demandId ? String(args.demandId) : void 0,
|
|
1505
|
+
demandName: args.demandName ? String(args.demandName) : void 0
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1228
1508
|
const invFieldKeys = {};
|
|
1229
1509
|
for (const [k, v] of Object.entries(ctx.cache.fields[jd.objId] || {})) invFieldKeys[String(v)] = k;
|
|
1510
|
+
const briefValue = (d) => {
|
|
1511
|
+
let raw;
|
|
1512
|
+
if (d?.dataText && d.dataText.content !== void 0 && d.dataText.content !== null) raw = d.dataText.content;
|
|
1513
|
+
else if (d?.content !== void 0 && d?.content !== null) raw = d.content;
|
|
1514
|
+
else if (Array.isArray(d?.dataOptions) && d.dataOptions.length) raw = d.dataOptions[0]?.content ?? d.dataOptions[0]?.id;
|
|
1515
|
+
if (typeof raw === "string") return raw.length > 60 ? raw.slice(0, 60) + "\u2026" : raw;
|
|
1516
|
+
return raw === void 0 ? null : raw;
|
|
1517
|
+
};
|
|
1518
|
+
const fieldTextOf = (name) => {
|
|
1519
|
+
const fid = String((ctx.cache.fields[jd.objId] || {})[name] || "");
|
|
1520
|
+
if (!fid) return "";
|
|
1521
|
+
const d = willSubmit.dataDetails.find((x) => String(x?.formField?.id) === fid);
|
|
1522
|
+
const raw = d?.dataText?.content ?? d?.content;
|
|
1523
|
+
return typeof raw === "string" ? raw : "";
|
|
1524
|
+
};
|
|
1525
|
+
const clip = (s, n) => s.length > n ? s.slice(0, n) + "\u2026" : s;
|
|
1526
|
+
const dutyText = fieldTextOf("position_duty");
|
|
1527
|
+
const requestText = fieldTextOf("work_request");
|
|
1528
|
+
const missingBody = jd.summary.dutyLen === 0 || jd.summary.requestLen === 0;
|
|
1529
|
+
const jdWarning = missingBody ? `JD \u6B63\u6587\u4E0D\u5B8C\u6574\uFF08\u804C\u8D23 ${jd.summary.dutyLen} \u5B57 / \u4EFB\u804C\u8981\u6C42 ${jd.summary.requestLen} \u5B57\uFF09\u3002\u8BF7\u8865 positionDuty / workRequest \u540E\u91CD\u65B0 prepare\uFF0C\u6216\u6309 references/recruit-stage/position-templates.md \u5BF9\u5E94\u804C\u4F4D\u65CF\u8865\u9F50\uFF1B\u4EE5\u5F53\u524D\u5185\u5BB9 apply \u4F1A\u521B\u5EFA\u4E00\u6761\u6CA1\u6709\u804C\u8D23\u4E0E\u8981\u6C42\u7684\u804C\u4F4D\u8BB0\u5F55\u3002` : void 0;
|
|
1530
|
+
const preview = {
|
|
1531
|
+
action: jd.summary.action,
|
|
1532
|
+
positionName: jd.summary.positionName,
|
|
1533
|
+
positionDuty: dutyText ? clip(dutyText, 100) : "\uFF08\u7A7A\uFF0C\u89C1 warning\uFF09",
|
|
1534
|
+
workRequest: requestText ? clip(requestText, 100) : "\uFF08\u7A7A\uFF0C\u89C1 warning\uFF09",
|
|
1535
|
+
demand: jd.summary.demand,
|
|
1536
|
+
status: jd.summary.status,
|
|
1537
|
+
recruitFlow: jd.summary.recruitFlow,
|
|
1538
|
+
currentUser: jd.summary.currentUser,
|
|
1539
|
+
setApplied: jd.summary.setApplied,
|
|
1540
|
+
setSkipped: jd.summary.setSkipped,
|
|
1541
|
+
inheritedFromRef: jd.summary.inheritedFromRef,
|
|
1542
|
+
inheritedSalaryWarnings: jd.summary.inheritedSalaryWarnings,
|
|
1543
|
+
inheritedNote: jd.summary.inheritedNote,
|
|
1544
|
+
workLocationDefault: jd.summary.workLocationDefault,
|
|
1545
|
+
workLocationWarning: jd.summary.workLocationWarning,
|
|
1546
|
+
requiredDefaultsFilled: jd.summary.requiredDefaultsFilled,
|
|
1547
|
+
fieldCount: willSubmit.dataDetails.length,
|
|
1548
|
+
warning: jdWarning
|
|
1549
|
+
};
|
|
1230
1550
|
return rsSuccess("recruit-stage.jd.create.prepare", {
|
|
1231
1551
|
mode: "prepare",
|
|
1232
1552
|
continuation,
|
|
1233
1553
|
fingerprint: fp,
|
|
1234
1554
|
...jd.summary,
|
|
1555
|
+
preview,
|
|
1556
|
+
jdWarning,
|
|
1235
1557
|
recentReferences: refs.items,
|
|
1236
1558
|
recentReferencesNote: refs.skipped ? refs.reason : refs.available ? `\u5DF2\u6309\u300C${refs.keyword}\u300D\u5728\u5F53\u524D\u73AF\u5883\u804C\u4F4D\u5217\u8868\u4E2D\u68C0\u7D22\uFF08\u626B\u63CF ${refs.scanned} \u6761\uFF0C\u547D\u4E2D ${refs.items.length} \u6761\uFF09\u2014\u2014\u8BF7\u5BF9\u6807\u8FD9\u4E9B\u540C\u7C7B\u804C\u4F4D\u7684\u85AA\u916C/\u4EBA\u6570/\u8981\u6C42\u7ED9\u51FA\u63A8\u8350\u503C\uFF0C\u4E00\u5E76\u653E\u8FDB\u786E\u8BA4\u6458\u8981\uFF0C\u4E0D\u8981\u9010\u5B57\u6BB5\u8BE2\u95EE\u7528\u6237` : "\u53C2\u8003\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A" + (refs.reason || ""),
|
|
1237
1559
|
willSubmit: {
|
|
1238
1560
|
formId: willSubmit.formId,
|
|
1239
1561
|
objId: willSubmit.objId,
|
|
1240
1562
|
fieldCount: willSubmit.dataDetails.length,
|
|
1241
|
-
fields: willSubmit.dataDetails.map(
|
|
1242
|
-
|
|
1243
|
-
|
|
1563
|
+
fields: willSubmit.dataDetails.map((d) => {
|
|
1564
|
+
const fid = String(d?.formField?.id || "");
|
|
1565
|
+
return { key: invFieldKeys[fid] || fid, fieldId: fid, value: briefValue(d) };
|
|
1566
|
+
})
|
|
1244
1567
|
}
|
|
1245
1568
|
}, {
|
|
1246
1569
|
continuation,
|
|
@@ -1252,20 +1575,22 @@ async function apply(args, env) {
|
|
|
1252
1575
|
if (args.confirm !== true) throw rsConfirmationError("recruit-stage.jd.create.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
1253
1576
|
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
|
|
1254
1577
|
const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.jd.create.apply");
|
|
1578
|
+
restoreDsOptions(payload.enumMaps);
|
|
1579
|
+
const merged = { ...payload.argsSnapshot || {}, ...args };
|
|
1255
1580
|
const host = env.host;
|
|
1256
1581
|
const session = await host.getSession();
|
|
1257
1582
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
1258
1583
|
ctx.appId = ctx.cache.appId;
|
|
1259
|
-
const positionName = String(
|
|
1584
|
+
const positionName = String(merged.positionName || "").trim();
|
|
1260
1585
|
if (!positionName) throw rsValidationError("position_name_required", "positionName \u5FC5\u586B");
|
|
1261
1586
|
const jd = await buildJd({
|
|
1262
1587
|
ctx,
|
|
1263
1588
|
positionName,
|
|
1264
|
-
duty:
|
|
1265
|
-
requestText:
|
|
1266
|
-
demandId:
|
|
1267
|
-
demandName:
|
|
1268
|
-
sets: setsOf(
|
|
1589
|
+
duty: merged.positionDuty ? String(merged.positionDuty) : void 0,
|
|
1590
|
+
requestText: merged.workRequest ? String(merged.workRequest) : void 0,
|
|
1591
|
+
demandId: merged.demandId ? String(merged.demandId) : void 0,
|
|
1592
|
+
demandName: merged.demandName ? String(merged.demandName) : void 0,
|
|
1593
|
+
sets: setsOf(merged)
|
|
1269
1594
|
});
|
|
1270
1595
|
const willSubmit = { formId: jd.formId, objId: jd.objId, dataDetails: jd.dataDetails };
|
|
1271
1596
|
if (payload.fingerprint !== fingerprint(willSubmit)) {
|
|
@@ -1283,24 +1608,42 @@ async function apply(args, env) {
|
|
|
1283
1608
|
const positionPostId = data.positionPostId;
|
|
1284
1609
|
const checkRpa = data.checkRpa;
|
|
1285
1610
|
const rpaValidMsg = data.rpaValidMsg || null;
|
|
1286
|
-
const
|
|
1287
|
-
const
|
|
1611
|
+
const okByResponse = r2?.status !== false && r2?.fail !== true && data.fail !== true;
|
|
1612
|
+
const verification = await verifySubmitted({
|
|
1613
|
+
host,
|
|
1614
|
+
formId: jd.formId,
|
|
1615
|
+
objId: jd.objId,
|
|
1616
|
+
dataId: formDataId,
|
|
1617
|
+
expected: expectedFields(
|
|
1618
|
+
jd.dataDetails,
|
|
1619
|
+
ctx.cache.fields[jd.objId] || {},
|
|
1620
|
+
["position_name", "position_duty", "work_request", "status", "salary_min", "salary_max", "work_location"],
|
|
1621
|
+
["position_name", "status"],
|
|
1622
|
+
["salary_min", "salary_max", "work_location"]
|
|
1623
|
+
)
|
|
1624
|
+
});
|
|
1625
|
+
if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
|
|
1626
|
+
const recordOk = verification.unavailable ? okByResponse : verification.mismatches.length === 0;
|
|
1627
|
+
const created = okByResponse && recordOk;
|
|
1628
|
+
const result = !created ? "failed" : verification.mismatches.length ? "partial" : "success";
|
|
1629
|
+
const listUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.position?.listId || "");
|
|
1288
1630
|
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
1631
|
return rsSuccess("recruit-stage.jd.create.apply", {
|
|
1291
1632
|
mode: "apply",
|
|
1292
|
-
result
|
|
1633
|
+
result,
|
|
1293
1634
|
formDataId,
|
|
1294
1635
|
positionPostId: positionPostId || null,
|
|
1295
1636
|
rpaChecked: checkRpa === void 0 ? null : !!checkRpa,
|
|
1296
1637
|
rpaValidMsg,
|
|
1297
|
-
|
|
1638
|
+
verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
|
|
1639
|
+
verifyWarnings: verification.mismatches.map((m) => "\u843D\u5E93\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A" + m.label + " \u671F\u671B " + m.expected + "\uFF0C\u5B9E\u9645 " + m.actual),
|
|
1640
|
+
positionListUrl: listUrl,
|
|
1298
1641
|
positionCardUrl: cardUrl,
|
|
1299
|
-
positionListLocateUrl:
|
|
1642
|
+
positionListLocateUrl: listUrl,
|
|
1300
1643
|
// 产物链接(Agent 原样搬运成 Markdown 链接,按顺序:详情在前、列表在后)
|
|
1301
1644
|
viewLink: cardUrl ? `[\u67E5\u770B ${jd.summary.positionName || "\u65B0\u5EFA\u804C\u4F4D"} \u804C\u4F4D\u8BE6\u60C5](${cardUrl})` : null,
|
|
1302
|
-
listLocateLink:
|
|
1303
|
-
agentNote: "\u67E5\u770B\u5165\u53E3 = \u4E24\u4E2A Markdown \u94FE\u63A5\uFF08\
|
|
1645
|
+
listLocateLink: listUrl ? `[\u6253\u5F00\u804C\u4F4D\u5217\u8868](${listUrl})` : null,
|
|
1646
|
+
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
1647
|
...jd.summary
|
|
1305
1648
|
});
|
|
1306
1649
|
}
|
|
@@ -1395,7 +1738,7 @@ var jdCreateOperations = [
|
|
|
1395
1738
|
];
|
|
1396
1739
|
|
|
1397
1740
|
// src/shortcuts/recruit-stage/operations/resume-import.ts
|
|
1398
|
-
import { createHash as
|
|
1741
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
1399
1742
|
import fs from "node:fs";
|
|
1400
1743
|
import path from "node:path";
|
|
1401
1744
|
|
|
@@ -1719,6 +2062,202 @@ var school_tiers_default = {
|
|
|
1719
2062
|
]
|
|
1720
2063
|
};
|
|
1721
2064
|
|
|
2065
|
+
// src/shortcuts/recruit-stage/fs-scan.ts
|
|
2066
|
+
import { mkdtempSync, readdirSync, readFileSync, statSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2067
|
+
import { tmpdir } from "node:os";
|
|
2068
|
+
import { basename, dirname, extname, join as join2, resolve as resolve2 } from "node:path";
|
|
2069
|
+
import { inflateRawSync } from "node:zlib";
|
|
2070
|
+
var RESUME_EXTS = /* @__PURE__ */ new Set([".pdf", ".doc", ".docx", ".rtf", ".txt", ".wps"]);
|
|
2071
|
+
function decodeName(bytes, utf8Flag) {
|
|
2072
|
+
if (utf8Flag) return bytes.toString("utf8");
|
|
2073
|
+
try {
|
|
2074
|
+
return new TextDecoder("gbk").decode(bytes);
|
|
2075
|
+
} catch {
|
|
2076
|
+
return bytes.toString("utf8");
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
function extractZip(zipPath) {
|
|
2080
|
+
const buf = readFileSync(zipPath);
|
|
2081
|
+
let eocd = -1;
|
|
2082
|
+
const floor = Math.max(0, buf.length - 22 - 65535);
|
|
2083
|
+
for (let i = buf.length - 22; i >= floor; i--) {
|
|
2084
|
+
if (buf.readUInt32LE(i) === 101010256) {
|
|
2085
|
+
eocd = i;
|
|
2086
|
+
break;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
if (eocd < 0) throw new Error("\u4E0D\u662F\u6709\u6548\u7684 zip \u6587\u4EF6\uFF08\u627E\u4E0D\u5230\u4E2D\u592E\u76EE\u5F55\u7ED3\u5C3E\u6807\u8BB0\uFF09");
|
|
2090
|
+
const count = buf.readUInt16LE(eocd + 10);
|
|
2091
|
+
let off = buf.readUInt32LE(eocd + 16);
|
|
2092
|
+
if (count === 65535 || off === 4294967295) {
|
|
2093
|
+
throw new Error("\u6682\u4E0D\u652F\u6301 ZIP64\uFF08\u8D85\u5927\u538B\u7F29\u5305\uFF09\uFF0C\u8BF7\u62C6\u5206\u6210\u591A\u4E2A\u666E\u901A zip \u540E\u91CD\u8BD5");
|
|
2094
|
+
}
|
|
2095
|
+
const dest = mkdtempSync(join2(tmpdir(), "e10-resume-"));
|
|
2096
|
+
let written = 0;
|
|
2097
|
+
for (let i = 0; i < count; i++) {
|
|
2098
|
+
if (off + 46 > buf.length || buf.readUInt32LE(off) !== 33639248) break;
|
|
2099
|
+
const flags = buf.readUInt16LE(off + 8);
|
|
2100
|
+
const method = buf.readUInt16LE(off + 10);
|
|
2101
|
+
const compSize = buf.readUInt32LE(off + 20);
|
|
2102
|
+
const nameLen = buf.readUInt16LE(off + 28);
|
|
2103
|
+
const extraLen = buf.readUInt16LE(off + 30);
|
|
2104
|
+
const commentLen = buf.readUInt16LE(off + 32);
|
|
2105
|
+
const localOff = buf.readUInt32LE(off + 42);
|
|
2106
|
+
const rawName = buf.subarray(off + 46, off + 46 + nameLen);
|
|
2107
|
+
const name = decodeName(rawName, (flags & 2048) !== 0);
|
|
2108
|
+
off += 46 + nameLen + extraLen + commentLen;
|
|
2109
|
+
if (!name || name.endsWith("/") || name.startsWith("__MACOSX/")) continue;
|
|
2110
|
+
const rawParts = name.replace(/\\/g, "/").split("/");
|
|
2111
|
+
if (rawParts.some((s) => s === "..")) continue;
|
|
2112
|
+
const parts = rawParts.filter((s) => s && s !== "." && !/^[a-zA-Z]:$/.test(s));
|
|
2113
|
+
if (!parts.length) continue;
|
|
2114
|
+
if (method !== 0 && method !== 8) continue;
|
|
2115
|
+
const lNameLen = buf.readUInt16LE(localOff + 26);
|
|
2116
|
+
const lExtraLen = buf.readUInt16LE(localOff + 28);
|
|
2117
|
+
const dataStart = localOff + 30 + lNameLen + lExtraLen;
|
|
2118
|
+
if (dataStart + compSize > buf.length) continue;
|
|
2119
|
+
const raw = buf.subarray(dataStart, dataStart + compSize);
|
|
2120
|
+
let out;
|
|
2121
|
+
try {
|
|
2122
|
+
out = method === 0 ? raw : inflateRawSync(raw);
|
|
2123
|
+
} catch {
|
|
2124
|
+
continue;
|
|
2125
|
+
}
|
|
2126
|
+
const target = join2(dest, ...parts);
|
|
2127
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
2128
|
+
writeFileSync(target, out);
|
|
2129
|
+
written++;
|
|
2130
|
+
}
|
|
2131
|
+
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");
|
|
2132
|
+
return dest;
|
|
2133
|
+
}
|
|
2134
|
+
function walk(dir, root, out, warnings, depth) {
|
|
2135
|
+
if (depth > 4) return;
|
|
2136
|
+
let entries;
|
|
2137
|
+
try {
|
|
2138
|
+
entries = readdirSync(dir);
|
|
2139
|
+
} catch (e) {
|
|
2140
|
+
warnings.push(`\u76EE\u5F55\u4E0D\u53EF\u8BFB\uFF1A${dir}\uFF08${e?.message || "\u672A\u77E5\u539F\u56E0"}\uFF09`);
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
for (const name of entries) {
|
|
2144
|
+
const p = join2(dir, name);
|
|
2145
|
+
let st;
|
|
2146
|
+
try {
|
|
2147
|
+
st = statSync(p);
|
|
2148
|
+
} catch {
|
|
2149
|
+
continue;
|
|
2150
|
+
}
|
|
2151
|
+
if (st.isDirectory()) {
|
|
2152
|
+
if (name === "__MACOSX" || name.startsWith(".")) continue;
|
|
2153
|
+
walk(p, root, out, warnings, depth + 1);
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
if (!RESUME_EXTS.has(extname(name).toLowerCase())) continue;
|
|
2157
|
+
out.push({ path: p, name, size: st.size });
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
function scanResumeSource(source) {
|
|
2161
|
+
const warnings = [];
|
|
2162
|
+
const abs = resolve2(source);
|
|
2163
|
+
let st;
|
|
2164
|
+
try {
|
|
2165
|
+
st = statSync(abs);
|
|
2166
|
+
} catch {
|
|
2167
|
+
throw new Error(`\u8DEF\u5F84\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BFB\uFF1A${source}`);
|
|
2168
|
+
}
|
|
2169
|
+
let root = abs;
|
|
2170
|
+
let tempDir;
|
|
2171
|
+
if (st.isFile()) {
|
|
2172
|
+
if (extname(abs).toLowerCase() !== ".zip") {
|
|
2173
|
+
throw new Error("source \u53EA\u652F\u6301\u6587\u4EF6\u5939\u6216 .zip \u538B\u7F29\u5305");
|
|
2174
|
+
}
|
|
2175
|
+
tempDir = extractZip(abs);
|
|
2176
|
+
root = tempDir;
|
|
2177
|
+
} else if (!st.isDirectory()) {
|
|
2178
|
+
throw new Error("source \u53EA\u652F\u6301\u6587\u4EF6\u5939\u6216 .zip \u538B\u7F29\u5305");
|
|
2179
|
+
}
|
|
2180
|
+
const files = [];
|
|
2181
|
+
walk(root, root, files, warnings, 0);
|
|
2182
|
+
files.sort((a, b) => a.name.localeCompare(b.name, "zh-Hans-CN"));
|
|
2183
|
+
return { root, files, warnings, tempDir };
|
|
2184
|
+
}
|
|
2185
|
+
function findStructuredJson(file, structuredDir) {
|
|
2186
|
+
const base = basename(file.name, extname(file.name));
|
|
2187
|
+
const candidates = [
|
|
2188
|
+
join2(dirname(file.path), base + ".json"),
|
|
2189
|
+
...structuredDir ? [join2(resolve2(structuredDir), base + ".json")] : []
|
|
2190
|
+
];
|
|
2191
|
+
for (const c of candidates) {
|
|
2192
|
+
try {
|
|
2193
|
+
if (statSync(c).isFile()) return c;
|
|
2194
|
+
} catch {
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
return null;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
// src/shortcuts/recruit-stage/batch-store.ts
|
|
2201
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2202
|
+
import { chmodSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2203
|
+
import { homedir as homedir3 } from "node:os";
|
|
2204
|
+
import { join as join3, resolve as resolve3, sep } from "node:path";
|
|
2205
|
+
function batchDir() {
|
|
2206
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve3(homedir3(), ".weaver-work-cli");
|
|
2207
|
+
const dir = join3(home, "batch");
|
|
2208
|
+
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
2209
|
+
return dir;
|
|
2210
|
+
}
|
|
2211
|
+
function digest(value) {
|
|
2212
|
+
return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
|
|
2213
|
+
}
|
|
2214
|
+
function cleanup(dir) {
|
|
2215
|
+
try {
|
|
2216
|
+
const now = Date.now();
|
|
2217
|
+
for (const f of readdirSync2(dir)) {
|
|
2218
|
+
if (!f.endsWith(".json")) continue;
|
|
2219
|
+
const p = join3(dir, f);
|
|
2220
|
+
try {
|
|
2221
|
+
if (now - statSync2(p).mtimeMs > 24 * 3600 * 1e3) unlinkSync2(p);
|
|
2222
|
+
} catch {
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
} catch {
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
function saveBatchItems(kind, items) {
|
|
2229
|
+
const dir = batchDir();
|
|
2230
|
+
cleanup(dir);
|
|
2231
|
+
const fingerprint3 = digest(items);
|
|
2232
|
+
const file = join3(dir, `${kind}-${fingerprint3.slice(0, 16)}.json`);
|
|
2233
|
+
writeFileSync2(file, JSON.stringify(items), { mode: 384 });
|
|
2234
|
+
try {
|
|
2235
|
+
chmodSync(file, 384);
|
|
2236
|
+
} catch {
|
|
2237
|
+
}
|
|
2238
|
+
return { file, fingerprint: fingerprint3 };
|
|
2239
|
+
}
|
|
2240
|
+
function loadBatchItems(file, expectedFingerprint) {
|
|
2241
|
+
const dir = resolve3(batchDir());
|
|
2242
|
+
const target = resolve3(String(file || ""));
|
|
2243
|
+
if (!target.startsWith(dir + sep)) {
|
|
2244
|
+
throw rsValidationError("batch_file_invalid", "\u6279\u91CF\u6E05\u5355\u8DEF\u5F84\u975E\u6CD5\uFF08\u5FC5\u987B\u4F4D\u4E8E CLI \u7684 batch \u76EE\u5F55\u5185\uFF09");
|
|
2245
|
+
}
|
|
2246
|
+
let items;
|
|
2247
|
+
try {
|
|
2248
|
+
items = JSON.parse(readFileSync2(target, "utf8"));
|
|
2249
|
+
} catch {
|
|
2250
|
+
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");
|
|
2251
|
+
}
|
|
2252
|
+
if (!Array.isArray(items)) {
|
|
2253
|
+
throw rsValidationError("batch_file_invalid", "\u6279\u91CF\u6E05\u5355\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u8BF7\u91CD\u65B0 prepare");
|
|
2254
|
+
}
|
|
2255
|
+
if (digest(items) !== String(expectedFingerprint || "")) {
|
|
2256
|
+
throw rsValidationError("batch_file_tampered", "\u6279\u91CF\u6E05\u5355\u4E0E\u786E\u8BA4\u65F6\u4E0D\u4E00\u81F4\uFF08\u6587\u4EF6\u88AB\u4FEE\u6539\uFF09\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\uFF0C\u8BF7\u91CD\u65B0 prepare");
|
|
2257
|
+
}
|
|
2258
|
+
return items;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
1722
2261
|
// src/shortcuts/recruit-stage/operations/resume-import.ts
|
|
1723
2262
|
var PROTECTED_UPDATE_KEYS = ["is_blacklist", "recruit_status", "candidate_status", "data_status"];
|
|
1724
2263
|
async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
@@ -1755,7 +2294,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
1755
2294
|
const uploadType = c?.data?.uploadType || "common";
|
|
1756
2295
|
if (!preUploadId) throw rsFail("\u7B80\u5386\u9884\u4E0A\u4F20\u68C0\u67E5\u5931\u8D25\uFF1A" + JSON.stringify(c || {}).slice(0, 200));
|
|
1757
2296
|
const fd = baseForm();
|
|
1758
|
-
const md5 =
|
|
2297
|
+
const md5 = createHash3("md5").update(buf).digest("hex");
|
|
1759
2298
|
const lm = String(Math.round(fs.statSync(filePath).mtimeMs || Date.now()));
|
|
1760
2299
|
fd.append("name", filename);
|
|
1761
2300
|
fd.append("MD5", md5);
|
|
@@ -1999,13 +2538,17 @@ function makeBriefReader(ctx, formId, objId, fields) {
|
|
|
1999
2538
|
}
|
|
2000
2539
|
function resolveTalentCardUrl(ctx, talentId) {
|
|
2001
2540
|
const pid = ctx.cache.ebdDetailPageId;
|
|
2002
|
-
if (!pid)
|
|
2541
|
+
if (!pid || !talentId) {
|
|
2542
|
+
const forms = ctx.cache.forms || {};
|
|
2543
|
+
const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || "");
|
|
2544
|
+
return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
|
|
2545
|
+
}
|
|
2003
2546
|
return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
|
|
2004
2547
|
}
|
|
2005
|
-
function resolveTalentListLocateUrl(ctx,
|
|
2548
|
+
function resolveTalentListLocateUrl(ctx, _talentId) {
|
|
2006
2549
|
const listId = ctx.cache.lists?.talent?.listId;
|
|
2007
|
-
if (!listId
|
|
2008
|
-
return `${ctx.baseUrl}/sp/ebdfpage/list/${listId}
|
|
2550
|
+
if (!listId) return null;
|
|
2551
|
+
return `${ctx.baseUrl.replace(/\/+$/, "")}/sp/ebdfpage/list/${listId}`;
|
|
2009
2552
|
}
|
|
2010
2553
|
async function readTalentSnapshot(ctx, opts) {
|
|
2011
2554
|
const { host, formId, objId, fields, subMeta, dataId } = opts;
|
|
@@ -2449,8 +2992,8 @@ async function buildImport(ctx, args) {
|
|
|
2449
2992
|
channelLabel = "\u624B\u52A8\u5F55\u5165\uFF08\u56FA\u5B9A\uFF09";
|
|
2450
2993
|
}
|
|
2451
2994
|
if (fields.is_blacklist) {
|
|
2452
|
-
const opt = (
|
|
2453
|
-
const noId =
|
|
2995
|
+
const opt = await getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}));
|
|
2996
|
+
const noId = opt["\u5426"];
|
|
2454
2997
|
if (noId) dataDetails.push({ formField: { id: fields.is_blacklist }, dataOptions: [{ optionId: String(noId), content: "\u5426" }] });
|
|
2455
2998
|
}
|
|
2456
2999
|
let subBuild = { byTable: {}, stats: {} };
|
|
@@ -2553,7 +3096,7 @@ async function findExistingTalents(ctx, opts) {
|
|
|
2553
3096
|
return { checked: true, unique: !hit, byPhone: byPhone && !byPhone.error ? byPhone : null, byPhoneError: byPhone?.error, formConflicts, ids };
|
|
2554
3097
|
}
|
|
2555
3098
|
function fingerprint2(value) {
|
|
2556
|
-
return
|
|
3099
|
+
return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
|
|
2557
3100
|
}
|
|
2558
3101
|
function fingerprintMainTable(mainTable) {
|
|
2559
3102
|
const copy = { ...mainTable };
|
|
@@ -2571,11 +3114,15 @@ var baseInput2 = {
|
|
|
2571
3114
|
noSchoolTags: { type: "boolean", description: "\u5173\u95ED\u5B66\u6821\u5F52\u5C5E\u6807\u7B7E\u81EA\u52A8\u63A8\u5BFC" },
|
|
2572
3115
|
updateTalentId: { type: "string", description: "\u6309\u7B80\u5386\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D\uFF08\u4E3B\u8868\u5168\u91CF\u8986\u76D6+\u660E\u7EC6\u6574\u8868\u8986\u76D6\uFF1B\u5148 prepare \u770B\u5DEE\u5F02\uFF09" }
|
|
2573
3116
|
};
|
|
2574
|
-
async function prepare2(args, env) {
|
|
3117
|
+
async function prepare2(args, env, opts = {}) {
|
|
2575
3118
|
const host = env.host;
|
|
2576
3119
|
const session = await host.getSession();
|
|
2577
3120
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
2578
3121
|
ctx.appId = ctx.cache.appId;
|
|
3122
|
+
if (!opts.skipPermissionProbe) {
|
|
3123
|
+
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "talent_pool"));
|
|
3124
|
+
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");
|
|
3125
|
+
}
|
|
2579
3126
|
const argsT = args;
|
|
2580
3127
|
if (!argsT.structured && !argsT.structuredFile && !argsT.fileId && !argsT.resumeFile) {
|
|
2581
3128
|
throw rsValidationError("input_required", "\u9700\u8981 structured/structuredFile/fileId/resumeFile \u4E4B\u4E00");
|
|
@@ -2631,7 +3178,26 @@ async function prepare2(args, env) {
|
|
|
2631
3178
|
}
|
|
2632
3179
|
const willSubmit2 = { updateTalentId, mainTable: fingerprintMainTable(upMain), details: built.detailsPayload };
|
|
2633
3180
|
const fp2 = fingerprint2(willSubmit2);
|
|
2634
|
-
const continuation2 = await env.continuation.issue({
|
|
3181
|
+
const continuation2 = await env.continuation.issue({
|
|
3182
|
+
operation: "recruit-stage.resume.import.apply",
|
|
3183
|
+
fingerprint: fp2,
|
|
3184
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
3185
|
+
// 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
|
|
3186
|
+
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
3187
|
+
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
3188
|
+
argsSnapshot: {
|
|
3189
|
+
file: args.file ? String(args.file) : void 0,
|
|
3190
|
+
structuredFile: args.structuredFile ? String(args.structuredFile) : void 0,
|
|
3191
|
+
fileId: args.fileId ? String(args.fileId) : void 0,
|
|
3192
|
+
resumeFile: args.resumeFile ? String(args.resumeFile) : void 0,
|
|
3193
|
+
channel: args.channel ? String(args.channel) : void 0,
|
|
3194
|
+
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : void 0,
|
|
3195
|
+
useOcr: args.useOcr === true,
|
|
3196
|
+
noSchoolTags: args.noSchoolTags === true,
|
|
3197
|
+
structured: args.structured,
|
|
3198
|
+
tags: args.tags
|
|
3199
|
+
}
|
|
3200
|
+
});
|
|
2635
3201
|
return rsSuccess("recruit-stage.resume.import.prepare", {
|
|
2636
3202
|
mode: "prepare-update",
|
|
2637
3203
|
action: "\u6309\u7B80\u5386\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D",
|
|
@@ -2644,7 +3210,17 @@ async function prepare2(args, env) {
|
|
|
2644
3210
|
keptTables,
|
|
2645
3211
|
protectedSkipped,
|
|
2646
3212
|
talentViewUrl: viewUrl,
|
|
2647
|
-
note: "\u4EE5\u4E0A\u4E3A\u5C06\u5199\u5165\u7684\u5DEE\u5F02\u3002\u786E\u8BA4\u540E apply \u6267\u884C\uFF1B\u5168\u91CF\u8986\u76D6\u4F1A\u6539\u6389\u4EBA\u5DE5\u4FEE\u6B63\u8FC7\u7684\u503C"
|
|
3213
|
+
note: "\u4EE5\u4E0A\u4E3A\u5C06\u5199\u5165\u7684\u5DEE\u5F02\u3002\u786E\u8BA4\u540E apply \u6267\u884C\uFF1B\u5168\u91CF\u8986\u76D6\u4F1A\u6539\u6389\u4EBA\u5DE5\u4FEE\u6B63\u8FC7\u7684\u503C",
|
|
3214
|
+
// 🔴 2026-11-07:本 op 此前无 preview(与 jd.create 同类缺陷)。更新场景最关键的是「改哪些字段、跳过哪些」。
|
|
3215
|
+
preview: {
|
|
3216
|
+
action: "\u6309\u7B80\u5386\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D\uFF08\u5168\u91CF\u8986\u76D6\uFF09",
|
|
3217
|
+
talentId: updateTalentId,
|
|
3218
|
+
\u53D8\u66F4\u5B57\u6BB5\u6570: Array.isArray(changed) ? changed.length : 0,
|
|
3219
|
+
\u53D8\u66F4\u660E\u7EC6: changed,
|
|
3220
|
+
\u672A\u53D8\u5B57\u6BB5\u6570: fieldDiff.filter((x) => x.change === "same").length,
|
|
3221
|
+
\u4FDD\u62A4\u672A\u8986\u76D6: protectedSkipped,
|
|
3222
|
+
note: "\u5168\u91CF\u8986\u76D6\u4F1A\u6539\u6389\u4EBA\u5DE5\u4FEE\u6B63\u8FC7\u7684\u503C\uFF1B\u786E\u8BA4\u9010\u9879\u53D8\u66F4\u540E\u518D apply"
|
|
3223
|
+
}
|
|
2648
3224
|
}, { continuation: continuation2, fingerprint: fp2, confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E continuation \u8C03\u7528 apply" });
|
|
2649
3225
|
}
|
|
2650
3226
|
const tagCheckTask = (async () => {
|
|
@@ -2699,20 +3275,50 @@ async function prepare2(args, env) {
|
|
|
2699
3275
|
};
|
|
2700
3276
|
const willSubmit = { formId: built.formId, objId: built.objId, mainTable: fingerprintMainTable(toDatasetMainTable(built.dataDetails, built.fields)), details: built.detailsPayload };
|
|
2701
3277
|
const fp = fingerprint2(willSubmit);
|
|
2702
|
-
const continuation = await env.continuation.issue({
|
|
3278
|
+
const continuation = await env.continuation.issue({
|
|
3279
|
+
operation: "recruit-stage.resume.import.apply",
|
|
3280
|
+
fingerprint: fp,
|
|
3281
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
3282
|
+
// 🔴 2026-11-07 修复(同 arrange / jd.create / position.create 的同类缺陷):apply 只带
|
|
3283
|
+
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
3284
|
+
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
3285
|
+
argsSnapshot: {
|
|
3286
|
+
file: args.file ? String(args.file) : void 0,
|
|
3287
|
+
structuredFile: args.structuredFile ? String(args.structuredFile) : void 0,
|
|
3288
|
+
fileId: args.fileId ? String(args.fileId) : void 0,
|
|
3289
|
+
resumeFile: args.resumeFile ? String(args.resumeFile) : void 0,
|
|
3290
|
+
channel: args.channel ? String(args.channel) : void 0,
|
|
3291
|
+
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : void 0,
|
|
3292
|
+
useOcr: args.useOcr === true,
|
|
3293
|
+
noSchoolTags: args.noSchoolTags === true,
|
|
3294
|
+
structured: args.structured,
|
|
3295
|
+
tags: args.tags
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
2703
3298
|
return rsSuccess("recruit-stage.resume.import.prepare", {
|
|
2704
3299
|
mode: "prepare",
|
|
2705
3300
|
...summary,
|
|
2706
3301
|
willSubmit,
|
|
2707
3302
|
tagCheck,
|
|
2708
3303
|
schoolTags: built.schoolTagInfo,
|
|
2709
|
-
onCommit: "\u63D0\u4EA4\u540E\u5C06\uFF1A\u2460 dataset/v2/saveFormData \u5EFA\u4EBA\u624D\uFF08\u4E3B\u8868+\u660E\u7EC6\u4E00\u6B21\u5199\u5165\uFF09\u2461 \u521D\u59CB\u5316\u4EBA\u624D\u6279\u6B21 \u2462 \u89E6\u53D1\u4EBA\u624D\u81EA\u52A8\u6807\u7B7E\u89C4\u5219\u5339\u914D \u2463 \u6309\u6807\u7B7E\uFF08\u542B\u5B66\u6821\u5F52\u5C5E\u81EA\u52A8\u63A8\u5BFC\uFF09\u5199\u5165\u5E73\u53F0\u6807\u7B7E \u2464 \u8F93\u51FA\u4EBA\u624D\u5361\u7247/\u4EBA\u624D\u5E93\u5B9A\u4F4D\u94FE\u63A5"
|
|
3304
|
+
onCommit: "\u63D0\u4EA4\u540E\u5C06\uFF1A\u2460 dataset/v2/saveFormData \u5EFA\u4EBA\u624D\uFF08\u4E3B\u8868+\u660E\u7EC6\u4E00\u6B21\u5199\u5165\uFF09\u2461 \u521D\u59CB\u5316\u4EBA\u624D\u6279\u6B21 \u2462 \u89E6\u53D1\u4EBA\u624D\u81EA\u52A8\u6807\u7B7E\u89C4\u5219\u5339\u914D \u2463 \u6309\u6807\u7B7E\uFF08\u542B\u5B66\u6821\u5F52\u5C5E\u81EA\u52A8\u63A8\u5BFC\uFF09\u5199\u5165\u5E73\u53F0\u6807\u7B7E \u2464 \u8F93\u51FA\u4EBA\u624D\u5361\u7247/\u4EBA\u624D\u5E93\u5B9A\u4F4D\u94FE\u63A5",
|
|
3305
|
+
// 🔴 2026-11-07:本 op 此前无 preview(与 jd.create 同类缺陷)。新建场景要把「建档字段 + 标签预检结果」一起给出来。
|
|
3306
|
+
preview: {
|
|
3307
|
+
...summary,
|
|
3308
|
+
tagCheck,
|
|
3309
|
+
schoolTags: built.schoolTagInfo,
|
|
3310
|
+
onCommit: "\u63D0\u4EA4\u540E\u5C06\uFF1A\u5EFA\u4EBA\u624D \u2192 \u521D\u59CB\u5316\u6279\u6B21 \u2192 \u81EA\u52A8\u6807\u7B7E\u5339\u914D \u2192 \u5199\u5E73\u53F0\u6807\u7B7E \u2192 \u8F93\u51FA\u5361\u7247\u4E0E\u4EBA\u624D\u5E93\u94FE\u63A5"
|
|
3311
|
+
}
|
|
2710
3312
|
}, { continuation, fingerprint: fp, confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E continuation \u8C03\u7528 apply" });
|
|
2711
3313
|
}
|
|
2712
3314
|
async function apply2(args, env) {
|
|
2713
3315
|
if (args.confirm !== true) throw rsConfirmationError("recruit-stage.resume.import.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
2714
3316
|
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
|
|
2715
3317
|
const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.resume.import.apply");
|
|
3318
|
+
return applyCore({ ...payload.argsSnapshot || {}, ...args }, env, payload);
|
|
3319
|
+
}
|
|
3320
|
+
async function applyCore(args, env, payload) {
|
|
3321
|
+
restoreDsOptions(payload.enumMaps);
|
|
2716
3322
|
const host = env.host;
|
|
2717
3323
|
const session = await host.getSession();
|
|
2718
3324
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
@@ -2850,15 +3456,28 @@ async function apply2(args, env) {
|
|
|
2850
3456
|
const labelMatch = labelRes.ok ? labelRes.v : "ERR:" + (labelRes.e?.message || "");
|
|
2851
3457
|
const tagResult = tagRes.ok ? tagRes.v : { applied: [], skipped: built.tagNames, error: tagRes.e?.message };
|
|
2852
3458
|
const tags = await queryEntityTags(host, talentId).catch(() => []);
|
|
3459
|
+
const verification = await verifySubmitted({
|
|
3460
|
+
host,
|
|
3461
|
+
formId: built.formId,
|
|
3462
|
+
objId: built.objId,
|
|
3463
|
+
dataId: newId,
|
|
3464
|
+
expected: expectedFields(built.dataDetails, built.fields, ["candidate_name", "telephone", "email"], [], ["email"])
|
|
3465
|
+
});
|
|
3466
|
+
if (verification.mismatches.length) {
|
|
3467
|
+
invalidateEnvCache(ctx.baseUrl, ctx.appId);
|
|
3468
|
+
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);
|
|
3469
|
+
}
|
|
3470
|
+
const result = detailsState === "complete" && !verification.mismatches.length ? "success" : "partial";
|
|
2853
3471
|
const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
|
|
2854
3472
|
const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
|
|
2855
3473
|
return rsSuccess("recruit-stage.resume.import.apply", {
|
|
2856
3474
|
mode: "apply",
|
|
2857
|
-
result
|
|
3475
|
+
result,
|
|
2858
3476
|
detailsState,
|
|
2859
3477
|
newCandidateFormDataId: newId,
|
|
2860
3478
|
talentId,
|
|
2861
3479
|
writeChannel,
|
|
3480
|
+
verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
|
|
2862
3481
|
writeWarnings: writeWarnings.length ? writeWarnings : void 0,
|
|
2863
3482
|
subTablesExpected: built.subBuild.stats,
|
|
2864
3483
|
subTableVerify,
|
|
@@ -2871,10 +3490,10 @@ async function apply2(args, env) {
|
|
|
2871
3490
|
tags,
|
|
2872
3491
|
talentCardUrl,
|
|
2873
3492
|
talentListLocateUrl,
|
|
2874
|
-
// 产物链接(Agent 原样搬运:①
|
|
3493
|
+
// 产物链接(Agent 原样搬运:① 人才卡片单页 ② 人才库列表;缺失哪个只给另一个)
|
|
2875
3494
|
viewLink: talentCardUrl ? `[\u67E5\u770B ${built.structured.candidateName || "\u65B0\u4EBA\u624D"} \u7684\u4EBA\u624D\u5361\u7247](${talentCardUrl})` : null,
|
|
2876
|
-
listLocateLink: talentListLocateUrl ? `[\
|
|
2877
|
-
agentNote: "\u6B63\u6587\u7ED9\u4E24\u4E2A Markdown \u94FE\u63A5\u2014\u2014\u2460 [\u67E5\u770B <\u59D3\u540D> \u7684\u4EBA\u624D\u5361\u7247](talentCardUrl) \u2461 [\
|
|
3495
|
+
listLocateLink: talentListLocateUrl ? `[\u6253\u5F00\u4EBA\u624D\u5E93\u5217\u8868](${talentListLocateUrl})` : null,
|
|
3496
|
+
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
3497
|
parsed: {
|
|
2879
3498
|
name: built.structured.candidateName,
|
|
2880
3499
|
mobile: built.structured.telephone,
|
|
@@ -2885,6 +3504,182 @@ async function apply2(args, env) {
|
|
|
2885
3504
|
}
|
|
2886
3505
|
});
|
|
2887
3506
|
}
|
|
3507
|
+
var IMPORT_BATCH_MAX = 50;
|
|
3508
|
+
async function batchPrepare(args, env) {
|
|
3509
|
+
const explicit = Array.isArray(args.items) ? args.items : null;
|
|
3510
|
+
const scan = !explicit && args.source ? scanResumeSource(String(args.source)) : null;
|
|
3511
|
+
if (!explicit && !scan) {
|
|
3512
|
+
throw rsValidationError("source_required", "\u9700\u8981 source\uFF08\u6587\u4EF6\u5939\u6216 .zip \u8DEF\u5F84\uFF09\u6216 items\uFF08[{file, structured?}]\uFF09\u4E4B\u4E00");
|
|
3513
|
+
}
|
|
3514
|
+
const structuredDir = args.structuredDir ? String(args.structuredDir) : void 0;
|
|
3515
|
+
const shared = {};
|
|
3516
|
+
for (const k of ["channel", "useOcr", "noSchoolTags"]) if (args[k] !== void 0) shared[k] = args[k];
|
|
3517
|
+
if (Array.isArray(args.tags)) shared.tags = args.tags;
|
|
3518
|
+
const entries = (explicit || scan.files).map((x, i) => {
|
|
3519
|
+
if (explicit) {
|
|
3520
|
+
const file = x?.file ? path.resolve(String(x.file)) : "";
|
|
3521
|
+
return {
|
|
3522
|
+
file,
|
|
3523
|
+
name: file ? path.basename(file) : `\u7B2C${i + 1}\u9879`,
|
|
3524
|
+
structured: x?.structured,
|
|
3525
|
+
structuredFile: x?.structuredFile
|
|
3526
|
+
};
|
|
3527
|
+
}
|
|
3528
|
+
return { file: x.path, name: x.name, structured: void 0, structuredFile: void 0 };
|
|
3529
|
+
});
|
|
3530
|
+
if (entries.length > IMPORT_BATCH_MAX) {
|
|
3531
|
+
throw rsValidationError("batch_too_many", `\u4E00\u6B21\u6700\u591A ${IMPORT_BATCH_MAX} \u4EFD\uFF08\u5F53\u524D ${entries.length} \u4EFD\uFF09\uFF1B\u8BF7\u5206\u6279\u6267\u884C`);
|
|
3532
|
+
}
|
|
3533
|
+
if (!entries.length) {
|
|
3534
|
+
throw rsValidationError("no_resume_files", "\u6CA1\u6709\u627E\u5230\u7B80\u5386\u6587\u4EF6\uFF08\u652F\u6301 pdf/doc/docx/rtf/txt/wps\uFF1B\u76EE\u5F55\u6700\u591A\u5411\u4E0B 4 \u5C42\uFF09");
|
|
3535
|
+
}
|
|
3536
|
+
const items = [];
|
|
3537
|
+
const ready = [];
|
|
3538
|
+
for (let i = 0; i < entries.length; i++) {
|
|
3539
|
+
const e = entries[i];
|
|
3540
|
+
const row = { index: i + 1, file: e.name, path: e.file || void 0 };
|
|
3541
|
+
try {
|
|
3542
|
+
let structured = e.structured;
|
|
3543
|
+
let structuredFile = e.structuredFile ? path.resolve(String(e.structuredFile)) : "";
|
|
3544
|
+
if (!structured && !structuredFile && e.file) {
|
|
3545
|
+
const hit = findStructuredJson({ path: e.file, name: e.name, size: 0 }, structuredDir);
|
|
3546
|
+
if (hit) structuredFile = hit;
|
|
3547
|
+
}
|
|
3548
|
+
if (!structured && !structuredFile && !shared.useOcr) {
|
|
3549
|
+
row.status = "needs_parse";
|
|
3550
|
+
row.message = "\u7F3A\u5C11\u7ED3\u6784\u5316\u6570\u636E\uFF1A\u8BF7\u7531\u5927\u6A21\u578B\u89E3\u6790\u540E\u4EE5 items[].structured\uFF08\u6216\u540C\u540D .json\uFF09\u63D0\u4F9B\uFF1B\u626B\u63CF\u4EF6\u53EF\u663E\u5F0F useOcr:true";
|
|
3551
|
+
items.push(row);
|
|
3552
|
+
continue;
|
|
3553
|
+
}
|
|
3554
|
+
const r = await prepare2({ ...shared, resumeFile: e.file || void 0, structured, structuredFile: structuredFile || void 0 }, env, { skipPermissionProbe: i > 0 });
|
|
3555
|
+
const d = r.data || {};
|
|
3556
|
+
const meta = r.meta || {};
|
|
3557
|
+
const dup = d.duplicate || {};
|
|
3558
|
+
const blocked = dup.unique === false;
|
|
3559
|
+
row.name = d.parsed?.name;
|
|
3560
|
+
row.mobile = d.parsed?.mobile;
|
|
3561
|
+
row.hasStructured = !!(structured || structuredFile);
|
|
3562
|
+
row.duplicateNote = dup.note;
|
|
3563
|
+
if (blocked) {
|
|
3564
|
+
row.status = "blocked";
|
|
3565
|
+
row.message = "\u67E5\u91CD\u672A\u901A\u8FC7\uFF1A" + (dup.note || "\u5DF2\u5B58\u5728\u540C\u624B\u673A\u53F7\u4EBA\u624D");
|
|
3566
|
+
items.push(row);
|
|
3567
|
+
continue;
|
|
3568
|
+
}
|
|
3569
|
+
row.status = "ready";
|
|
3570
|
+
items.push(row);
|
|
3571
|
+
ready.push({ index: i + 1, label: row.name || e.name, file: e.file, args: { ...shared, resumeFile: e.file || void 0, structured, structuredFile: structuredFile || void 0 }, fingerprint: String(meta.fingerprint || "") });
|
|
3572
|
+
} catch (err) {
|
|
3573
|
+
row.status = "failed";
|
|
3574
|
+
row.message = err?.message || "prepare \u5931\u8D25";
|
|
3575
|
+
items.push(row);
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
if (!ready.length) {
|
|
3579
|
+
return rsSuccess("recruit-stage.resume.import.batch.prepare", {
|
|
3580
|
+
mode: "batch-prepare",
|
|
3581
|
+
total: items.length,
|
|
3582
|
+
ready: 0,
|
|
3583
|
+
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3584
|
+
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3585
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
3586
|
+
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0,
|
|
3587
|
+
items,
|
|
3588
|
+
hint: "\u6CA1\u6709\u53EF\u6267\u884C\u9879\uFF0C\u9010\u6761\u770B items[].message\uFF08\u5E38\u89C1\uFF1A\u7F3A\u5C11\u7ED3\u6784\u5316 JSON\u3001\u67E5\u91CD\u547D\u4E2D\u3001\u683C\u5F0F\u4E0D\u652F\u6301\uFF09",
|
|
3589
|
+
// 🔴 2026-11-07:本 op 此前无 preview。文件清单可能很大,preview 只保留「文件 + 状态 + 原因」。
|
|
3590
|
+
preview: {
|
|
3591
|
+
action: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165 \u2014 \u65E0\u53EF\u6267\u884C\u9879",
|
|
3592
|
+
total: items.length,
|
|
3593
|
+
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3594
|
+
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3595
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
3596
|
+
reasons: items.map((x) => `${x.file}\uFF1A${x.message || x.status}`)
|
|
3597
|
+
}
|
|
3598
|
+
});
|
|
3599
|
+
}
|
|
3600
|
+
const fp = createHash3("sha256").update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest("hex");
|
|
3601
|
+
const store = saveBatchItems("resume-import", ready);
|
|
3602
|
+
const continuation = await env.continuation.issue({
|
|
3603
|
+
operation: "recruit-stage.resume.import.batch.apply",
|
|
3604
|
+
fingerprint: fp,
|
|
3605
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
3606
|
+
batchFile: store.file,
|
|
3607
|
+
batchFingerprint: store.fingerprint
|
|
3608
|
+
});
|
|
3609
|
+
return rsSuccess("recruit-stage.resume.import.batch.prepare", {
|
|
3610
|
+
mode: "batch-prepare",
|
|
3611
|
+
total: items.length,
|
|
3612
|
+
ready: ready.length,
|
|
3613
|
+
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3614
|
+
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3615
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
3616
|
+
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0,
|
|
3617
|
+
items,
|
|
3618
|
+
note: "\u786E\u8BA4\u540E\u5E26 confirm:true \u4E0E meta.continuation \u8C03 batch.apply\uFF1B\u9010\u4EFD\u5EFA\u6863\uFF0C\u53EF\u80FD\u662F partial",
|
|
3619
|
+
// 🔴 2026-11-07:本 op 此前无 preview。preview 只列「文件 + 状态」,不复制 structured(体积会爆)。
|
|
3620
|
+
preview: {
|
|
3621
|
+
action: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165\uFF08\u9010\u4EFD\u5EFA\u6863\uFF0C\u7ED3\u679C\u53EF\u80FD partial\uFF09",
|
|
3622
|
+
total: items.length,
|
|
3623
|
+
ready: ready.length,
|
|
3624
|
+
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3625
|
+
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3626
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
3627
|
+
files: items.map((x) => `${x.file} \u2014 ${x.status}${x.message ? "\uFF1A" + x.message : ""}`),
|
|
3628
|
+
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0
|
|
3629
|
+
}
|
|
3630
|
+
}, {
|
|
3631
|
+
continuation,
|
|
3632
|
+
fingerprint: fp,
|
|
3633
|
+
confirmHint: "\u7528\u6237\u786E\u8BA4\u6574\u6279\u540D\u5355\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E\u672C continuation \u8C03\u7528 recruit-stage.resume.import.batch.apply"
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
async function batchApply(args, env) {
|
|
3637
|
+
if (args.confirm !== true) {
|
|
3638
|
+
throw rsConfirmationError("recruit-stage.resume.import.batch.apply", { hint: "\u6279\u91CF\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
3639
|
+
}
|
|
3640
|
+
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA batch.prepare \u7684 meta\uFF09");
|
|
3641
|
+
const batch = await env.continuation.verify(String(args.continuation), "recruit-stage.resume.import.batch.apply");
|
|
3642
|
+
const items = loadBatchItems(batch.batchFile, batch.batchFingerprint);
|
|
3643
|
+
if (!items.length) throw rsValidationError("batch_empty", "continuation \u4E2D\u6CA1\u6709\u53EF\u6267\u884C\u7684\u7B80\u5386");
|
|
3644
|
+
const results = [];
|
|
3645
|
+
for (const it of items) {
|
|
3646
|
+
try {
|
|
3647
|
+
const r = await applyCore({ ...it.args || {}, confirm: true }, env, { fingerprint: it.fingerprint, enumMaps: batch.enumMaps });
|
|
3648
|
+
const d = r.data || {};
|
|
3649
|
+
results.push({
|
|
3650
|
+
index: it.index,
|
|
3651
|
+
file: path.basename(String(it.file || "")),
|
|
3652
|
+
name: it.label,
|
|
3653
|
+
status: d.result === "partial" ? "partial" : "success",
|
|
3654
|
+
talentId: d.talentId,
|
|
3655
|
+
cardUrl: d.talentCardUrl,
|
|
3656
|
+
viewLink: d.viewLink,
|
|
3657
|
+
warnings: d.verifyWarnings && d.verifyWarnings.length ? d.verifyWarnings : void 0
|
|
3658
|
+
});
|
|
3659
|
+
} catch (e) {
|
|
3660
|
+
results.push({ index: it.index, file: path.basename(String(it.file || "")), name: it.label, status: "failed", message: e?.message || "\u6267\u884C\u5931\u8D25" });
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
const ok = results.filter((x) => x.status === "success").length;
|
|
3664
|
+
const partial = results.filter((x) => x.status === "partial").length;
|
|
3665
|
+
const failed = results.filter((x) => x.status === "failed").length;
|
|
3666
|
+
const lines = [
|
|
3667
|
+
"| # | \u6587\u4EF6 | \u59D3\u540D | \u7ED3\u679C | \u8BF4\u660E |",
|
|
3668
|
+
"|---|---|---|---|---|",
|
|
3669
|
+
...results.map((x) => `| ${x.index} | ${x.file} | ${x.name || "-"} | ${x.status === "success" ? "\u6210\u529F" : x.status === "partial" ? "\u90E8\u5206\u6210\u529F" : "\u5931\u8D25"} | ${x.message || (x.warnings?.length ? x.warnings.join("\uFF1B") : x.cardUrl ? "\u5DF2\u5EFA\u6863" : "")} |`)
|
|
3670
|
+
];
|
|
3671
|
+
return rsSuccess("recruit-stage.resume.import.batch.apply", {
|
|
3672
|
+
mode: "batch-apply",
|
|
3673
|
+
result: failed || partial ? "partial" : "success",
|
|
3674
|
+
total: results.length,
|
|
3675
|
+
succeeded: ok,
|
|
3676
|
+
partial,
|
|
3677
|
+
failed,
|
|
3678
|
+
items: results,
|
|
3679
|
+
resultTable: lines.join("\n"),
|
|
3680
|
+
agentNote: "\u628A resultTable \u539F\u6837\u653E\u56DE\u7B54\u6B63\u6587\uFF1B\u5931\u8D25/\u90E8\u5206\u6210\u529F\u7684\u6761\u76EE\u8981\u5E26 message \u8BF4\u660E\u539F\u56E0\uFF0C\u4E0D\u8981\u53EA\u62A5\u603B\u6570\u3002"
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
2888
3683
|
var resumeImportOperations = [
|
|
2889
3684
|
{
|
|
2890
3685
|
name: "recruit-stage.resume.import.prepare",
|
|
@@ -2909,6 +3704,38 @@ var resumeImportOperations = [
|
|
|
2909
3704
|
requiresConfirmation: true,
|
|
2910
3705
|
inputSchema: schemaOf({ ...baseInput2, confirm: { type: "boolean" }, continuation: { type: "string" } }, {}),
|
|
2911
3706
|
handler: apply2
|
|
3707
|
+
},
|
|
3708
|
+
{
|
|
3709
|
+
name: "recruit-stage.resume.import.batch.prepare",
|
|
3710
|
+
resource: "recruit.resume",
|
|
3711
|
+
method: "prepare",
|
|
3712
|
+
action: "resume.import.batch.prepare",
|
|
3713
|
+
summary: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165\u786E\u8BA4\u6458\u8981\uFF1A\u626B\u63CF\u6587\u4EF6\u5939\u6216 zip\u3001\u9010\u4EFD\u4E0A\u4F20/\u67E5\u91CD/\u5B57\u6BB5\u6620\u5C04\uFF0C\u8F93\u51FA\u53EF\u6267\u884C/\u67E5\u91CD\u62E6\u622A/\u5F85\u89E3\u6790\u6E05\u5355\uFF08\u4E0D\u5EFA\u6863\uFF09\uFF1B\u4E00\u6B21\u6700\u591A 50 \u4EFD",
|
|
3714
|
+
capability: "recruit.resume.import",
|
|
3715
|
+
risk: "write",
|
|
3716
|
+
requiresConfirmation: true,
|
|
3717
|
+
inputSchema: schemaOf({
|
|
3718
|
+
source: { type: "string", description: "\u7B80\u5386\u6587\u4EF6\u5939\u6216 .zip \u5305\u8DEF\u5F84\uFF08\u4E0E items \u4E8C\u9009\u4E00\uFF09" },
|
|
3719
|
+
items: { type: "array", description: "\u663E\u5F0F\u6E05\u5355 [{file, structured?, structuredFile?}]\uFF0C\u4E0E source \u4E8C\u9009\u4E00", items: { type: "object" } },
|
|
3720
|
+
structuredDir: { type: "string", description: "\u7ED3\u6784\u5316 JSON \u76EE\u5F55\uFF08\u6309\u540C\u540D .json \u81EA\u52A8\u5339\u914D\uFF0C\u53EF\u9009\uFF09" },
|
|
3721
|
+
tags: { type: "array", description: "\u7EDF\u4E00\u8FFD\u52A0\u7684\u6807\u7B7E\u540D", items: { type: "string" } },
|
|
3722
|
+
channel: { type: "string", description: "\u6E20\u9053\uFF08\u53EF\u9009\uFF09" },
|
|
3723
|
+
useOcr: { type: "boolean", description: "\u663E\u5F0F\u5F00\u542F OCR \u515C\u5E95\u89E3\u6790\uFF08\u95F8\u95E8=checkResumeExtraction\uFF09" },
|
|
3724
|
+
noSchoolTags: { type: "boolean", description: "\u4E0D\u81EA\u52A8\u63A8\u5BFC\u5B66\u6821\u5F52\u5C5E\u6807\u7B7E" }
|
|
3725
|
+
}, {}),
|
|
3726
|
+
handler: batchPrepare
|
|
3727
|
+
},
|
|
3728
|
+
{
|
|
3729
|
+
name: "recruit-stage.resume.import.batch.apply",
|
|
3730
|
+
resource: "recruit.resume",
|
|
3731
|
+
method: "apply",
|
|
3732
|
+
action: "resume.import.batch.apply",
|
|
3733
|
+
summary: "\u7528\u6237\u786E\u8BA4\u540E\u9010\u4EFD\u5EFA\u6863\uFF08\u4E0A\u4F20\u539F\u4EF6+\u4E3B\u8868\u660E\u7EC6+\u6279\u6B21+\u6807\u7B7E+\u56DE\u67E5\uFF09\uFF0C\u8FD4\u56DE\u9010\u4EFD\u7ED3\u679C\u4E0E Markdown \u8868\u683C\uFF1B\u975E\u539F\u5B50\u6279\u91CF\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E3A partial",
|
|
3734
|
+
capability: "recruit.resume.import",
|
|
3735
|
+
risk: "write",
|
|
3736
|
+
requiresConfirmation: true,
|
|
3737
|
+
inputSchema: schemaOf({ confirm: { type: "boolean" }, continuation: { type: "string" } }, { required: ["confirm", "continuation"] }),
|
|
3738
|
+
handler: batchApply
|
|
2912
3739
|
}
|
|
2913
3740
|
];
|
|
2914
3741
|
|
|
@@ -3150,7 +3977,7 @@ function planBrief(items) {
|
|
|
3150
3977
|
return (items || []).map((x) => x.name + (x.position ? "\uFF08\u5C97\u4F4D\uFF1A" + x.position + "\uFF09" : "") + " [id=" + x.id + "]").join("\uFF1B");
|
|
3151
3978
|
}
|
|
3152
3979
|
async function buildPlan(opts) {
|
|
3153
|
-
const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan } = opts;
|
|
3980
|
+
const { ctx, talentId, positionId, interviewer, type, session, start, end, email, mobile, aiPlan, rounds } = opts;
|
|
3154
3981
|
const { host, appId, cache } = ctx;
|
|
3155
3982
|
const objId = objIdOf(cache, "interview_plan");
|
|
3156
3983
|
const formId = formIdOf(cache, "interview_plan");
|
|
@@ -3164,8 +3991,10 @@ async function buildPlan(opts) {
|
|
|
3164
3991
|
}
|
|
3165
3992
|
const candManageId = cand.candidateManageId ? String(cand.candidateManageId) : "";
|
|
3166
3993
|
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
|
|
3168
|
-
|
|
3994
|
+
const [typeMap, sessionMap] = await Promise.all([
|
|
3995
|
+
getDsOptions(host, objId, fid("interview_type")),
|
|
3996
|
+
getDsOptions(host, objId, fid("interview_session"))
|
|
3997
|
+
]);
|
|
3169
3998
|
const typeId = typeMap[type];
|
|
3170
3999
|
if (!typeId) throw rsFail("\u9762\u8BD5\u65B9\u5F0F\u300C" + type + "\u300D\u4E0D\u5728\u679A\u4E3E\u4E2D\uFF08" + Object.keys(typeMap).join("/") + "\uFF09");
|
|
3171
4000
|
const sessionId = sessionMap[session];
|
|
@@ -3190,7 +4019,9 @@ async function buildPlan(opts) {
|
|
|
3190
4019
|
}
|
|
3191
4020
|
const interviewerTask = (async () => {
|
|
3192
4021
|
if (interviewer) {
|
|
3193
|
-
|
|
4022
|
+
const id = await resolvePersonId(host, fid("interviewer"), interviewer);
|
|
4023
|
+
if (!id) throw rsFail(`\u9762\u8BD5\u5B98\u300C${interviewer}\u300D\u5728\u4EBA\u5458\u5E93\u4E2D\u67E5\u4E0D\u5230\uFF08\u53EF\u80FD\u59D3\u540D\u5199\u9519\u3001\u4E0D\u5728\u672C\u79DF\u6237\uFF0C\u6216\u4E0D\u662F\u5728\u804C\u4EBA\u5458\uFF09`);
|
|
4024
|
+
return { id, name: interviewer };
|
|
3194
4025
|
}
|
|
3195
4026
|
const cu = await resolveCurrentUser(host);
|
|
3196
4027
|
return cu ? { id: cu.id, name: cu.name } : { id: null, name: interviewer };
|
|
@@ -3247,6 +4078,32 @@ async function buildPlan(opts) {
|
|
|
3247
4078
|
if (aiPlanPicked) {
|
|
3248
4079
|
dataDetails.push({ formField: { id: digitalFid }, dataOptions: [{ optionId: aiPlanPicked.id, content: aiPlanPicked.name }] });
|
|
3249
4080
|
}
|
|
4081
|
+
const meta = await getFormLayoutMeta(host, formId).catch(() => null);
|
|
4082
|
+
const invFields = {};
|
|
4083
|
+
for (const [k, v] of Object.entries(fields)) invFields[String(v)] = k;
|
|
4084
|
+
const EXCLUDE_DEFAULTS = /* @__PURE__ */ new Set(["digital_id", "interview_type", "interview_paper_id", "send_channel"]);
|
|
4085
|
+
const defaultsApplied = [];
|
|
4086
|
+
for (const d of meta?.defaultDetails || []) {
|
|
4087
|
+
const did = String(d.fieldId || "");
|
|
4088
|
+
if (!did || dataDetails.some((x) => String(x.formField.id) === did)) continue;
|
|
4089
|
+
const dk = invFields[did] || "";
|
|
4090
|
+
if (EXCLUDE_DEFAULTS.has(dk)) continue;
|
|
4091
|
+
const o = (d.dataOptions || [])[0];
|
|
4092
|
+
if (o?.optionId) dataDetails.push({ formField: { id: did }, dataOptions: [{ optionId: String(o.optionId), content: o.content || "" }] });
|
|
4093
|
+
else if (d.content !== void 0 && d.content !== "") dataDetails.push({ formField: { id: did }, content: String(d.content) });
|
|
4094
|
+
else continue;
|
|
4095
|
+
defaultsApplied.push(dk || did);
|
|
4096
|
+
}
|
|
4097
|
+
const roundsName = String(rounds || "\u7B2C\u4E00\u8F6E").trim();
|
|
4098
|
+
let roundsWarning = null;
|
|
4099
|
+
const roundsFid = fid("interview_rounds");
|
|
4100
|
+
if (roundsFid && !dataDetails.some((x) => String(x.formField.id) === String(roundsFid))) {
|
|
4101
|
+
const hit = (cache.dict?.raw || []).find(
|
|
4102
|
+
(r) => String(r.selection_name || "").trim() === roundsName && ["one", "two", "three", "four"].includes(String(r.browser_key || ""))
|
|
4103
|
+
);
|
|
4104
|
+
if (hit) dataDetails.push({ formField: { id: roundsFid }, dataOptions: [{ optionId: String(hit.option_id), content: roundsName }] });
|
|
4105
|
+
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";
|
|
4106
|
+
}
|
|
3250
4107
|
return {
|
|
3251
4108
|
host: ctx.host,
|
|
3252
4109
|
objId,
|
|
@@ -3264,6 +4121,10 @@ async function buildPlan(opts) {
|
|
|
3264
4121
|
aiPlanOptions,
|
|
3265
4122
|
summary: {
|
|
3266
4123
|
action: "\u5B89\u6392\u9762\u8BD5",
|
|
4124
|
+
talentId,
|
|
4125
|
+
// 单独给一个纯姓名字段:batch 结果表必须用人名,不能拿 talentId 充当「候选人」
|
|
4126
|
+
// (W8:旧版 batch.apply 的 resultTable 显示 100005840000020214,同条 viewLink 却写「李伟」)
|
|
4127
|
+
candidateName: cand.name,
|
|
3267
4128
|
talent: cand.name + "\uFF08talentId=" + talentId + "\uFF09",
|
|
3268
4129
|
position: cand.positionName,
|
|
3269
4130
|
type,
|
|
@@ -3273,6 +4134,9 @@ async function buildPlan(opts) {
|
|
|
3273
4134
|
mobile: cand.mobile + "\uFF08\u6765\u6E90\uFF1A" + (mobileSource === "user" ? "\u672C\u6B21\u6307\u5B9A" : "\u4EBA\u624D\u8D44\u6599") + "\uFF09",
|
|
3274
4135
|
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
4136
|
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",
|
|
4137
|
+
rounds: roundsName,
|
|
4138
|
+
defaultsApplied: defaultsApplied.length ? defaultsApplied : void 0,
|
|
4139
|
+
roundsWarning: roundsWarning || void 0,
|
|
3276
4140
|
isAIInterview: isAI
|
|
3277
4141
|
}
|
|
3278
4142
|
};
|
|
@@ -3342,7 +4206,11 @@ async function resolveRequiredHint(plan, ctx) {
|
|
|
3342
4206
|
}
|
|
3343
4207
|
function resolveTalentCardUrl2(ctx, talentId) {
|
|
3344
4208
|
const pid = ctx.cache.ebdDetailPageId;
|
|
3345
|
-
if (!pid)
|
|
4209
|
+
if (!pid || !talentId) {
|
|
4210
|
+
const forms = ctx.cache.forms || {};
|
|
4211
|
+
const tobj = String(forms.talent_pool?.objId || forms.talent?.objId || "");
|
|
4212
|
+
return tobj && talentId ? buildCardUrl(ctx.baseUrl, tobj, String(talentId)) : null;
|
|
4213
|
+
}
|
|
3346
4214
|
return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
|
|
3347
4215
|
}
|
|
3348
4216
|
async function resolveInterviewListUrl(ctx) {
|
|
@@ -3353,16 +4221,17 @@ async function resolveInterviewListUrl(ctx) {
|
|
|
3353
4221
|
}
|
|
3354
4222
|
const r = await host.request({ path: `/api/cusapp/app/allMenus?isFront=1&appId=${appId}&terminalType=PC`, method: "GET" });
|
|
3355
4223
|
const flat = [];
|
|
3356
|
-
(function
|
|
4224
|
+
(function walk2(ns) {
|
|
3357
4225
|
for (const n of ns || []) if (n && typeof n === "object") {
|
|
3358
4226
|
flat.push(n);
|
|
3359
|
-
|
|
4227
|
+
walk2(n.children || n.childs);
|
|
3360
4228
|
}
|
|
3361
4229
|
})(r?.data?.cusAppMenus || r?.data);
|
|
3362
4230
|
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);
|
|
3363
4231
|
if (!node) return null;
|
|
3364
4232
|
return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
|
|
3365
4233
|
}
|
|
4234
|
+
var DEFAULT_INTERVIEW_TYPE = "\u73B0\u573A\u9762\u8BD5";
|
|
3366
4235
|
function nowAndEnd(type) {
|
|
3367
4236
|
const isAI = /AI|人工智能/i.test(String(type || ""));
|
|
3368
4237
|
const d = /* @__PURE__ */ new Date();
|
|
@@ -3410,16 +4279,21 @@ var baseInput3 = {
|
|
|
3410
4279
|
positionId: { type: "string", description: "\u5E94\u8058\u804C\u4F4D id\uFF08\u7B80\u5386\u6C60\u4EBA\u624D\u5FC5\u586B\uFF09" },
|
|
3411
4280
|
interviewer: { type: "string", description: "\u9762\u8BD5\u5B98\u59D3\u540D\uFF08\u7F3A\u7701=\u5F53\u524D\u767B\u5F55\u7528\u6237\uFF09" },
|
|
3412
4281
|
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\
|
|
4282
|
+
session: { type: "string", description: "\u9762\u8BD5\u9636\u6BB5\uFF08\u521D\u8BD5/\u590D\u8BD5/\u2026\uFF09" },
|
|
4283
|
+
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
4284
|
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
4285
|
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
4286
|
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" },
|
|
3417
4287
|
aiPlan: { type: "string", description: "AI \u9762\u8BD5\u65B9\u6848\u540D\u6216 id\uFF08AI \u9762\u8BD5\u5FC5\u586B\uFF1B\u4E0D\u4F20\u5219 prepare \u5217\u51FA\u5019\u9009\uFF09" }
|
|
3418
4288
|
};
|
|
3419
|
-
async function prepare3(args, env) {
|
|
4289
|
+
async function prepare3(args, env, opts = {}) {
|
|
3420
4290
|
const ctx = await makeCtx(env);
|
|
4291
|
+
if (!opts.skipPermissionProbe) {
|
|
4292
|
+
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "interview_plan"));
|
|
4293
|
+
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");
|
|
4294
|
+
}
|
|
3421
4295
|
const talentId = await locateTalentId(ctx, args);
|
|
3422
|
-
const auto = nowAndEnd(args.type ||
|
|
4296
|
+
const auto = nowAndEnd(String(args.type || DEFAULT_INTERVIEW_TYPE));
|
|
3423
4297
|
const startTime = args.start || auto.s;
|
|
3424
4298
|
const endTime = args.end || (args.start ? shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1e3 : 3600 * 1e3) || auto.e : auto.e);
|
|
3425
4299
|
const plan = await buildPlan({
|
|
@@ -3427,13 +4301,14 @@ async function prepare3(args, env) {
|
|
|
3427
4301
|
talentId,
|
|
3428
4302
|
positionId: args.positionId ? String(args.positionId) : void 0,
|
|
3429
4303
|
interviewer: args.interviewer ? String(args.interviewer) : void 0,
|
|
3430
|
-
type: String(args.type ||
|
|
4304
|
+
type: String(args.type || DEFAULT_INTERVIEW_TYPE),
|
|
3431
4305
|
session: String(args.session || "\u521D\u8BD5"),
|
|
3432
4306
|
start: String(startTime),
|
|
3433
4307
|
end: String(endTime),
|
|
3434
4308
|
email: args.email ? String(args.email) : void 0,
|
|
3435
4309
|
mobile: args.mobile ? String(args.mobile) : void 0,
|
|
3436
|
-
aiPlan: args.aiPlan ? String(args.aiPlan) : void 0
|
|
4310
|
+
aiPlan: args.aiPlan ? String(args.aiPlan) : void 0,
|
|
4311
|
+
rounds: args.rounds ? String(args.rounds) : void 0
|
|
3437
4312
|
});
|
|
3438
4313
|
plan.host = ctx.host;
|
|
3439
4314
|
const aiPlanCandidates = plan.isAI ? (plan.aiPlanOptions.items || []).map((x) => ({ id: x.id, name: x.name, position: x.position })) : [];
|
|
@@ -3445,9 +4320,29 @@ async function prepare3(args, env) {
|
|
|
3445
4320
|
}
|
|
3446
4321
|
const defaultAiPlan = defPlan?.optionId ? { id: defPlan.optionId, name: defPlan.content } : void 0;
|
|
3447
4322
|
const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
|
|
3448
|
-
const { createHash:
|
|
3449
|
-
const fp =
|
|
3450
|
-
const continuation = await env.continuation.issue({
|
|
4323
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
4324
|
+
const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
|
|
4325
|
+
const continuation = await env.continuation.issue({
|
|
4326
|
+
operation: "recruit-stage.interview.arrange.apply",
|
|
4327
|
+
fingerprint: fp,
|
|
4328
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
4329
|
+
timeWindow: { start: String(startTime), end: String(endTime) },
|
|
4330
|
+
// 🔴 参数快照(2026-11-07 修复):协议文档写的是「apply 带 confirm:true + continuation」,
|
|
4331
|
+
// 但 applyCore 原来只从 args 取 talentId/type/session…,Agent 少传任一项就直接报 talent_required。
|
|
4332
|
+
// 现把 prepare 用过的参数一并签进 continuation,apply 可只带 confirm + continuation;
|
|
4333
|
+
// 若 apply 显式传了同名字段,仍以显式值为准(batch 场景每人 talentId 不同,靠这条生效)。
|
|
4334
|
+
argsSnapshot: {
|
|
4335
|
+
talentId,
|
|
4336
|
+
type: String(args.type || DEFAULT_INTERVIEW_TYPE),
|
|
4337
|
+
session: String(args.session || "\u521D\u8BD5"),
|
|
4338
|
+
positionId: args.positionId ? String(args.positionId) : void 0,
|
|
4339
|
+
interviewer: args.interviewer ? String(args.interviewer) : void 0,
|
|
4340
|
+
aiPlan: args.aiPlan ? String(args.aiPlan) : void 0,
|
|
4341
|
+
email: args.email ? String(args.email) : void 0,
|
|
4342
|
+
mobile: args.mobile ? String(args.mobile) : void 0,
|
|
4343
|
+
rounds: args.rounds ? String(args.rounds) : void 0
|
|
4344
|
+
}
|
|
4345
|
+
});
|
|
3451
4346
|
return rsSuccess("recruit-stage.interview.arrange.prepare", {
|
|
3452
4347
|
mode: "prepare",
|
|
3453
4348
|
...plan.summary,
|
|
@@ -3456,7 +4351,19 @@ async function prepare3(args, env) {
|
|
|
3456
4351
|
defaultAiPlan,
|
|
3457
4352
|
aiPlanHint: plan.isAI && !plan.aiPlanPicked ? "AI\u9762\u8BD5\u65B9\u6848\u4E3A\u5FC5\u586B\uFF1A\u8BF7\u628A aiPlans \u5217\u7ED9\u7528\u6237\u9009\u62E9\uFF08isDefault=true \u4E3A\u9875\u9762\u9ED8\u8BA4\u65B9\u6848\uFF09\uFF0C\u786E\u8BA4\u540E\u5E26 aiPlan \u91CD\u8DD1 apply" : void 0,
|
|
3458
4353
|
requiredHint,
|
|
3459
|
-
|
|
4354
|
+
// 面试方式来源透明化:不传 type 时用 CLI 统一默认,同时把表单默认值一并给出,
|
|
4355
|
+
// 两者不同就给 typeNote,避免"摘要说现场面试、表单默认写视频面试"这种自相矛盾没人发现。
|
|
4356
|
+
typeSource: args.type ? "explicit" : "default",
|
|
4357
|
+
formDefaultInterviewType: requiredHint?.defaultValues?.interview_type?.content,
|
|
4358
|
+
typeNote: !args.type && requiredHint?.defaultValues?.interview_type?.content && String(requiredHint.defaultValues.interview_type.content) !== DEFAULT_INTERVIEW_TYPE ? `\u672C\u6B21\u672A\u6307\u5B9A type\uFF0C\u6309 CLI \u9ED8\u8BA4\u300C${DEFAULT_INTERVIEW_TYPE}\u300D\u63D0\u4EA4\uFF1B\u9875\u9762\u8868\u5355\u9ED8\u8BA4\u662F\u300C${requiredHint.defaultValues.interview_type.content}\u300D\uFF0C\u5982\u9700\u4E0E\u8BE5\u9ED8\u8BA4\u4E00\u81F4\u8BF7\u663E\u5F0F\u4F20 type` : void 0,
|
|
4359
|
+
willSubmit,
|
|
4360
|
+
// 🔴 2026-11-07:prepare 协议约定 preview(人类可读确认摘要),本 op 此前未提供,
|
|
4361
|
+
// 确认链只剩 willSubmit 明细。这里用 summary 全量 + 两处需用户裁决的提示拼出预览。
|
|
4362
|
+
preview: {
|
|
4363
|
+
...plan.summary,
|
|
4364
|
+
needAiPlan: plan.isAI && !plan.aiPlanPicked,
|
|
4365
|
+
note: plan.isAI && !plan.aiPlanPicked ? "AI \u9762\u8BD5\u65B9\u6848\u672A\u9009\u5B9A\uFF1Aapply \u4F1A\u9010\u4EBA\u963B\u65AD\uFF0C\u9700\u5148\u9009 aiPlan \u91CD\u65B0 prepare" : "\u786E\u8BA4\u59D3\u540D\u3001\u804C\u4F4D\u3001\u9762\u8BD5\u65B9\u5F0F\u3001\u8F6E\u6B21\u3001\u9762\u8BD5\u5B98\u4E0E\u65F6\u95F4\u7A97\u540E\u518D apply"
|
|
4366
|
+
}
|
|
3460
4367
|
}, {
|
|
3461
4368
|
continuation,
|
|
3462
4369
|
fingerprint: fp,
|
|
@@ -3467,31 +4374,37 @@ async function apply3(args, env) {
|
|
|
3467
4374
|
if (args.confirm !== true) throw rsConfirmationError("recruit-stage.interview.arrange.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
3468
4375
|
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
|
|
3469
4376
|
const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.interview.arrange.apply");
|
|
4377
|
+
return applyCore2(args, env, payload);
|
|
4378
|
+
}
|
|
4379
|
+
async function applyCore2(args, env, payload) {
|
|
4380
|
+
restoreDsOptions(payload.enumMaps);
|
|
3470
4381
|
const ctx = await makeCtx(env);
|
|
3471
|
-
const
|
|
3472
|
-
const
|
|
3473
|
-
const
|
|
3474
|
-
const
|
|
4382
|
+
const merged = { ...payload.argsSnapshot || {}, ...args };
|
|
4383
|
+
const talentId = await locateTalentId(ctx, merged);
|
|
4384
|
+
const auto = nowAndEnd(String(merged.type || DEFAULT_INTERVIEW_TYPE));
|
|
4385
|
+
const startTime = merged.start || payload.timeWindow?.start || auto.s;
|
|
4386
|
+
const endTime = merged.end || (merged.start ? shiftTime(String(merged.start), auto.isAI ? 7 * 24 * 3600 * 1e3 : 3600 * 1e3) || auto.e : payload.timeWindow?.end || auto.e);
|
|
3475
4387
|
const plan = await buildPlan({
|
|
3476
4388
|
ctx,
|
|
3477
4389
|
talentId,
|
|
3478
|
-
positionId:
|
|
3479
|
-
interviewer:
|
|
3480
|
-
type: String(
|
|
3481
|
-
session: String(
|
|
4390
|
+
positionId: merged.positionId ? String(merged.positionId) : void 0,
|
|
4391
|
+
interviewer: merged.interviewer ? String(merged.interviewer) : void 0,
|
|
4392
|
+
type: String(merged.type || DEFAULT_INTERVIEW_TYPE),
|
|
4393
|
+
session: String(merged.session || "\u521D\u8BD5"),
|
|
3482
4394
|
start: String(startTime),
|
|
3483
4395
|
end: String(endTime),
|
|
3484
|
-
email:
|
|
3485
|
-
mobile:
|
|
3486
|
-
aiPlan:
|
|
4396
|
+
email: merged.email ? String(merged.email) : void 0,
|
|
4397
|
+
mobile: merged.mobile ? String(merged.mobile) : void 0,
|
|
4398
|
+
aiPlan: merged.aiPlan ? String(merged.aiPlan) : void 0,
|
|
4399
|
+
rounds: merged.rounds ? String(merged.rounds) : void 0
|
|
3487
4400
|
});
|
|
3488
4401
|
plan.host = ctx.host;
|
|
3489
4402
|
if (plan.isAI && !plan.aiPlanPicked) {
|
|
3490
4403
|
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");
|
|
3491
4404
|
}
|
|
3492
4405
|
const willSubmit = { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails };
|
|
3493
|
-
const { createHash:
|
|
3494
|
-
if (payload.fingerprint !==
|
|
4406
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
4407
|
+
if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
|
|
3495
4408
|
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");
|
|
3496
4409
|
}
|
|
3497
4410
|
const formDataId = await saveFormData(ctx.host, {
|
|
@@ -3502,19 +4415,45 @@ async function apply3(args, env) {
|
|
|
3502
4415
|
dataDetails: plan.dataDetails
|
|
3503
4416
|
});
|
|
3504
4417
|
const actionsRun = await execSaveActions(plan, formDataId);
|
|
4418
|
+
const verification = await verifySubmitted({
|
|
4419
|
+
host: ctx.host,
|
|
4420
|
+
formId: plan.formId,
|
|
4421
|
+
objId: plan.objId,
|
|
4422
|
+
dataId: formDataId,
|
|
4423
|
+
expected: expectedFields(
|
|
4424
|
+
plan.dataDetails,
|
|
4425
|
+
ctx.cache.fields[plan.objId] || {},
|
|
4426
|
+
["interview_type", "interview_session", "interview_rounds", "digital_id", "email", "union_status"],
|
|
4427
|
+
["union_status"]
|
|
4428
|
+
)
|
|
4429
|
+
});
|
|
4430
|
+
if (verification.mismatches.length) invalidateEnvCache(ctx.baseUrl, ctx.appId);
|
|
4431
|
+
const verifyWarnings = verification.mismatches.map(
|
|
4432
|
+
(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"
|
|
4433
|
+
);
|
|
3505
4434
|
const detailUrl = buildCardUrl(ctx.baseUrl, plan.objId, formDataId);
|
|
3506
|
-
const listLocateUrl =
|
|
4435
|
+
const listLocateUrl = buildListUrl(ctx.baseUrl, ctx.cache.lists?.interview?.listId || "");
|
|
3507
4436
|
return rsSuccess("recruit-stage.interview.arrange.apply", {
|
|
3508
4437
|
mode: "apply",
|
|
3509
|
-
result: "success",
|
|
4438
|
+
result: verification.mismatches.length ? "partial" : "success",
|
|
3510
4439
|
interviewFormId: formDataId,
|
|
3511
4440
|
interviewCardUrl: detailUrl,
|
|
4441
|
+
// 🔴 回填落库实际采用的关键值(W9):旧版 apply 输出里没有 time,Agent 无法核对
|
|
4442
|
+
// 「输出时间 vs 落库时间」,曾出现差 2 分钟而无人发现。现在 time 直接取本次提交进表单的
|
|
4443
|
+
// dataDetails 时间值(与回查同一来源),所以与落库一致。
|
|
4444
|
+
time: plan.summary.time,
|
|
4445
|
+
talent: plan.summary.talent,
|
|
4446
|
+
position: plan.summary.position,
|
|
4447
|
+
type: plan.summary.type,
|
|
4448
|
+
session: plan.summary.session,
|
|
4449
|
+
interviewer: plan.summary.interviewer,
|
|
3512
4450
|
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
|
|
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\
|
|
4451
|
+
listLocateLink: listLocateUrl ? `[\u6253\u5F00\u9762\u8BD5\u7BA1\u7406\u5217\u8868](${listLocateUrl})` : null,
|
|
4452
|
+
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
4453
|
aiPlan: plan.isAI && plan.aiPlanPicked ? { id: plan.aiPlanPicked.id, name: plan.aiPlanPicked.name } : void 0,
|
|
3516
4454
|
saveActions: actionsRun.executed,
|
|
3517
|
-
|
|
4455
|
+
verification: { checked: verification.checked, mismatches: verification.mismatches, unavailable: verification.unavailable || null },
|
|
4456
|
+
warnings: [...actionsRun.warnings || [], ...verifyWarnings],
|
|
3518
4457
|
assigned: actionsRun.assigned || {}
|
|
3519
4458
|
});
|
|
3520
4459
|
}
|
|
@@ -3524,10 +4463,10 @@ async function prefill2(args, env) {
|
|
|
3524
4463
|
const objId = objIdOf(ctx.cache, "interview_plan");
|
|
3525
4464
|
const formId = formIdOf(ctx.cache, "interview_plan");
|
|
3526
4465
|
const fields = ctx.cache.fields[objId] || {};
|
|
3527
|
-
const typeKey = String(args.type ||
|
|
4466
|
+
const typeKey = String(args.type || DEFAULT_INTERVIEW_TYPE);
|
|
3528
4467
|
const typeFid = fields.interview_type;
|
|
3529
4468
|
if (!typeFid) throw rsFail("\u9762\u8BD5\u8BA1\u5212\u7F3A\u5C11\u5B57\u6BB5 interview_type\uFF08ds/fields \u89E3\u6790\u4E0D\u5230\uFF09");
|
|
3530
|
-
const typeMap =
|
|
4469
|
+
const typeMap = await getDsOptions(ctx.host, objId, typeFid);
|
|
3531
4470
|
const typeId = typeMap[typeKey];
|
|
3532
4471
|
if (!typeId) throw rsFail("\u9762\u8BD5\u65B9\u5F0F\u300C" + typeKey + "\u300D\u4E0D\u5728\u679A\u4E3E\u4E2D\uFF08" + Object.keys(typeMap).join("/") + "\uFF09");
|
|
3533
4472
|
const cardUrl = resolveTalentCardUrl2(ctx, talentId);
|
|
@@ -3552,6 +4491,166 @@ async function prefill2(args, env) {
|
|
|
3552
4491
|
]
|
|
3553
4492
|
});
|
|
3554
4493
|
}
|
|
4494
|
+
var BATCH_MAX = 30;
|
|
4495
|
+
function normalizeCandidateList(raw) {
|
|
4496
|
+
if (!Array.isArray(raw) || !raw.length) {
|
|
4497
|
+
throw rsValidationError("candidates_required", "candidates \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4\uFF0C\u5143\u7D20\u5F62\u5982 {talentId} / {mobile} / {name}");
|
|
4498
|
+
}
|
|
4499
|
+
if (raw.length > BATCH_MAX) {
|
|
4500
|
+
throw rsValidationError("candidates_too_many", `\u4E00\u6B21\u6700\u591A\u5904\u7406 ${BATCH_MAX} \u4EBA\uFF08\u5F53\u524D ${raw.length} \u4EBA\uFF09\uFF1B\u8BF7\u5206\u6279\u6267\u884C`);
|
|
4501
|
+
}
|
|
4502
|
+
return raw.map((x, i) => {
|
|
4503
|
+
const o = x && typeof x === "object" ? x : {};
|
|
4504
|
+
if (!o.talentId && !o.mobile && !o.name) {
|
|
4505
|
+
throw rsValidationError("candidate_invalid", `\u7B2C ${i + 1} \u4E2A\u5019\u9009\u4EBA\u7F3A\u5C11 talentId/mobile/name`);
|
|
4506
|
+
}
|
|
4507
|
+
return o;
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4510
|
+
async function batchPrepare2(args, env) {
|
|
4511
|
+
const list = normalizeCandidateList(args.candidates);
|
|
4512
|
+
const type = String(args.type || DEFAULT_INTERVIEW_TYPE);
|
|
4513
|
+
const auto = nowAndEnd(type);
|
|
4514
|
+
const startTime = String(args.start || auto.s);
|
|
4515
|
+
const endTime = String(args.end || (args.start ? shiftTime(String(args.start), auto.isAI ? 7 * 24 * 3600 * 1e3 : 3600 * 1e3) || auto.e : auto.e));
|
|
4516
|
+
const shared = {};
|
|
4517
|
+
for (const k of ["positionId", "interviewer", "type", "session", "rounds", "aiPlan", "email"]) {
|
|
4518
|
+
if (args[k] !== void 0 && args[k] !== null && String(args[k]).trim() !== "") shared[k] = String(args[k]);
|
|
4519
|
+
}
|
|
4520
|
+
shared.type = type;
|
|
4521
|
+
shared.start = startTime;
|
|
4522
|
+
shared.end = endTime;
|
|
4523
|
+
const items = [];
|
|
4524
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4525
|
+
for (let i = 0; i < list.length; i++) {
|
|
4526
|
+
const c = list[i];
|
|
4527
|
+
const label = String(c.name || c.mobile || c.talentId || `\u7B2C${i + 1}\u4EBA`);
|
|
4528
|
+
try {
|
|
4529
|
+
const r = await prepare3({ ...shared, ...c }, env, { skipPermissionProbe: i > 0 });
|
|
4530
|
+
const d = r.data || {};
|
|
4531
|
+
const talentId = String(d.talentId || "");
|
|
4532
|
+
if (talentId && seen.has(talentId)) {
|
|
4533
|
+
items.push({ index: i + 1, label, talentId, status: "duplicate", message: "\u4E0E\u524D\u9762\u7684\u5019\u9009\u4EBA\u91CD\u590D\uFF0C\u5DF2\u8DF3\u8FC7" });
|
|
4534
|
+
continue;
|
|
4535
|
+
}
|
|
4536
|
+
if (talentId) seen.add(talentId);
|
|
4537
|
+
const meta = r.meta || {};
|
|
4538
|
+
const resolvedName = String(d.candidateName || "").trim();
|
|
4539
|
+
items.push({
|
|
4540
|
+
index: i + 1,
|
|
4541
|
+
label: resolvedName || label,
|
|
4542
|
+
talentId,
|
|
4543
|
+
status: "ready",
|
|
4544
|
+
args: { ...shared, ...c },
|
|
4545
|
+
fingerprint: String(meta.fingerprint || ""),
|
|
4546
|
+
timeWindow: { start: startTime, end: endTime },
|
|
4547
|
+
message: d.needAiPlan ? "AI\u9762\u8BD5\u65B9\u6848\u672A\u9009\uFF08apply \u4F1A\u963B\u65AD\uFF09" : void 0
|
|
4548
|
+
});
|
|
4549
|
+
} catch (e) {
|
|
4550
|
+
items.push({ index: i + 1, label, status: "failed", message: e?.message || "prepare \u5931\u8D25" });
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
const ready = items.filter((x) => x.status === "ready");
|
|
4554
|
+
if (!ready.length) {
|
|
4555
|
+
return rsSuccess("recruit-stage.interview.arrange.batch.prepare", {
|
|
4556
|
+
mode: "batch-prepare",
|
|
4557
|
+
total: items.length,
|
|
4558
|
+
ready: 0,
|
|
4559
|
+
failed: items.length,
|
|
4560
|
+
items: items.map(({ args: args2, fingerprint: fingerprint3, timeWindow, ...rest }) => rest),
|
|
4561
|
+
hint: "\u6CA1\u6709\u4EFB\u4F55\u5019\u9009\u4EBA\u53EF\u6267\u884C\uFF0C\u9010\u6761\u770B items[].message \u4FEE\u6B63\u540E\u91CD\u8BD5",
|
|
4562
|
+
preview: {
|
|
4563
|
+
action: "\u6279\u91CF\u5B89\u6392\u9762\u8BD5 \u2014 \u65E0\u53EF\u6267\u884C\u9879",
|
|
4564
|
+
total: items.length,
|
|
4565
|
+
ready: 0,
|
|
4566
|
+
failed: items.length,
|
|
4567
|
+
reasons: items.map((x) => `${x.index}. ${x.label}\uFF1A${x.message || x.status}`)
|
|
4568
|
+
}
|
|
4569
|
+
});
|
|
4570
|
+
}
|
|
4571
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
4572
|
+
const fp = createHash4("sha256").update(JSON.stringify(ready.map((x) => [x.talentId, x.fingerprint]))).digest("hex");
|
|
4573
|
+
const continuation = await env.continuation.issue({
|
|
4574
|
+
operation: "recruit-stage.interview.arrange.batch.apply",
|
|
4575
|
+
fingerprint: fp,
|
|
4576
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
4577
|
+
items: ready.map((x) => ({ index: x.index, label: x.label, talentId: x.talentId, args: x.args, fingerprint: x.fingerprint, timeWindow: x.timeWindow }))
|
|
4578
|
+
});
|
|
4579
|
+
return rsSuccess("recruit-stage.interview.arrange.batch.prepare", {
|
|
4580
|
+
mode: "batch-prepare",
|
|
4581
|
+
total: items.length,
|
|
4582
|
+
ready: ready.length,
|
|
4583
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
4584
|
+
duplicates: items.filter((x) => x.status === "duplicate").length,
|
|
4585
|
+
shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + " ~ " + endTime, aiPlan: shared.aiPlan },
|
|
4586
|
+
items: items.map(({ args: args2, fingerprint: fingerprint3, timeWindow, ...rest }) => rest),
|
|
4587
|
+
note: "\u786E\u8BA4\u6458\u8981\u540E\u5E26 confirm:true \u4E0E meta.continuation \u8C03 batch.apply\uFF1B\u9010\u4EBA\u6267\u884C\uFF0C\u53EF\u80FD\u662F partial",
|
|
4588
|
+
// 🔴 2026-11-07:本 op 此前无 preview。批量场景用户要看的是「这批到底谁会被约、谁被跳过、为什么」,
|
|
4589
|
+
// 所以 preview 用逐行名单而不是数字汇总。
|
|
4590
|
+
preview: {
|
|
4591
|
+
action: "\u6279\u91CF\u5B89\u6392\u9762\u8BD5\uFF08\u9010\u4EBA\u6267\u884C\uFF0C\u7ED3\u679C\u53EF\u80FD partial\uFF09",
|
|
4592
|
+
total: items.length,
|
|
4593
|
+
ready: ready.length,
|
|
4594
|
+
failed: items.filter((x) => x.status === "failed").length,
|
|
4595
|
+
duplicates: items.filter((x) => x.status === "duplicate").length,
|
|
4596
|
+
shared: { type, session: shared.session, rounds: shared.rounds, interviewer: shared.interviewer, time: startTime + " ~ " + endTime, aiPlan: shared.aiPlan },
|
|
4597
|
+
candidates: items.map((x) => `${x.index}. ${x.label} \u2014 ${x.status}${x.message ? "\uFF1A" + x.message : ""}`)
|
|
4598
|
+
}
|
|
4599
|
+
}, {
|
|
4600
|
+
continuation,
|
|
4601
|
+
fingerprint: fp,
|
|
4602
|
+
confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u6574\u6279\u540D\u5355\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E\u672C continuation \u8C03\u7528 recruit-stage.interview.arrange.batch.apply"
|
|
4603
|
+
});
|
|
4604
|
+
}
|
|
4605
|
+
async function batchApply2(args, env) {
|
|
4606
|
+
if (args.confirm !== true) {
|
|
4607
|
+
throw rsConfirmationError("recruit-stage.interview.arrange.batch.apply", { hint: "\u6279\u91CF\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
4608
|
+
}
|
|
4609
|
+
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA batch.prepare \u7684 meta\uFF09");
|
|
4610
|
+
const batch = await env.continuation.verify(String(args.continuation), "recruit-stage.interview.arrange.batch.apply");
|
|
4611
|
+
const items = Array.isArray(batch.items) ? batch.items : [];
|
|
4612
|
+
if (!items.length) throw rsValidationError("batch_empty", "continuation \u4E2D\u6CA1\u6709\u53EF\u6267\u884C\u7684\u5019\u9009\u4EBA");
|
|
4613
|
+
const results = [];
|
|
4614
|
+
for (const it of items) {
|
|
4615
|
+
const payload = { fingerprint: it.fingerprint, timeWindow: it.timeWindow, enumMaps: batch.enumMaps };
|
|
4616
|
+
try {
|
|
4617
|
+
const r = await applyCore2({ ...it.args || {}, confirm: true }, env, payload);
|
|
4618
|
+
const d = r.data || {};
|
|
4619
|
+
results.push({
|
|
4620
|
+
index: it.index,
|
|
4621
|
+
talentId: it.talentId,
|
|
4622
|
+
name: it.label,
|
|
4623
|
+
candidateName: it.label,
|
|
4624
|
+
status: d.result === "partial" ? "partial" : "success",
|
|
4625
|
+
interviewFormId: d.interviewFormId,
|
|
4626
|
+
cardUrl: d.interviewCardUrl,
|
|
4627
|
+
viewLink: d.viewLink,
|
|
4628
|
+
warnings: d.warnings && d.warnings.length ? d.warnings : void 0
|
|
4629
|
+
});
|
|
4630
|
+
} catch (e) {
|
|
4631
|
+
results.push({ index: it.index, talentId: it.talentId, name: it.label, candidateName: it.label, status: "failed", message: e?.message || "\u6267\u884C\u5931\u8D25" });
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
const ok = results.filter((x) => x.status === "success").length;
|
|
4635
|
+
const partial = results.filter((x) => x.status === "partial").length;
|
|
4636
|
+
const failed = results.filter((x) => x.status === "failed").length;
|
|
4637
|
+
const lines = [
|
|
4638
|
+
"| # | \u5019\u9009\u4EBA | \u7ED3\u679C | \u8BF4\u660E |",
|
|
4639
|
+
"|---|---|---|---|",
|
|
4640
|
+
...results.map((x) => `| ${x.index} | ${x.name} | ${x.status === "success" ? "\u6210\u529F" : x.status === "partial" ? "\u90E8\u5206\u6210\u529F" : "\u5931\u8D25"} | ${x.message || (x.warnings?.length ? x.warnings.join("\uFF1B") : x.cardUrl ? "\u5DF2\u521B\u5EFA\u9762\u8BD5\u5B89\u6392" : "")} |`)
|
|
4641
|
+
];
|
|
4642
|
+
return rsSuccess("recruit-stage.interview.arrange.batch.apply", {
|
|
4643
|
+
mode: "batch-apply",
|
|
4644
|
+
result: failed || partial ? "partial" : "success",
|
|
4645
|
+
total: results.length,
|
|
4646
|
+
succeeded: ok,
|
|
4647
|
+
partial,
|
|
4648
|
+
failed,
|
|
4649
|
+
items: results,
|
|
4650
|
+
resultTable: lines.join("\n"),
|
|
4651
|
+
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"
|
|
4652
|
+
});
|
|
4653
|
+
}
|
|
3555
4654
|
var interviewArrangeOperations = [
|
|
3556
4655
|
{
|
|
3557
4656
|
name: "recruit-stage.interview.arrange.prepare",
|
|
@@ -3587,6 +4686,33 @@ var interviewArrangeOperations = [
|
|
|
3587
4686
|
risk: "read",
|
|
3588
4687
|
inputSchema: schemaOf(baseInput3, {}),
|
|
3589
4688
|
handler: prefill2
|
|
4689
|
+
},
|
|
4690
|
+
{
|
|
4691
|
+
name: "recruit-stage.interview.arrange.batch.prepare",
|
|
4692
|
+
resource: "recruit.interview",
|
|
4693
|
+
method: "prepare",
|
|
4694
|
+
action: "interview.arrange.batch.prepare",
|
|
4695
|
+
summary: "\u6279\u91CF\u7EA6\u9762\u786E\u8BA4\u6458\u8981\uFF1A\u9010\u4EBA\u5B9A\u4F4D\u5019\u9009\u4EBA\u3001\u89E3\u6790\u9762\u8BD5\u65B9\u5F0F/\u8F6E\u6B21\u4E0E\u5FC5\u586B\u9879\uFF0C\u8F93\u51FA\u540D\u5355\u4E0E\u5931\u8D25\u539F\u56E0\uFF08\u91CD\u590D\u81EA\u52A8\u8DF3\u8FC7\uFF09\uFF0C\u4E0D\u5199\u5165\uFF1B\u4E00\u6B21\u6700\u591A 30 \u4EBA",
|
|
4696
|
+
capability: "recruit.interview.arrange",
|
|
4697
|
+
risk: "write",
|
|
4698
|
+
requiresConfirmation: true,
|
|
4699
|
+
inputSchema: schemaOf({
|
|
4700
|
+
candidates: { type: "array", description: "\u5019\u9009\u4EBA\u6570\u7EC4\uFF0C\u5143\u7D20\u4E3A {talentId} / {mobile} / {name} \u4E4B\u4E00\uFF1B\u6700\u591A 30 \u4EBA", items: { type: "object" } },
|
|
4701
|
+
...baseInput3
|
|
4702
|
+
}, { required: ["candidates"] }),
|
|
4703
|
+
handler: batchPrepare2
|
|
4704
|
+
},
|
|
4705
|
+
{
|
|
4706
|
+
name: "recruit-stage.interview.arrange.batch.apply",
|
|
4707
|
+
resource: "recruit.interview",
|
|
4708
|
+
method: "apply",
|
|
4709
|
+
action: "interview.arrange.batch.apply",
|
|
4710
|
+
summary: "\u7528\u6237\u786E\u8BA4\u540D\u5355\u540E\u9010\u4EBA\u5B89\u6392\u9762\u8BD5\uFF08\u540C\u4E00\u5957\u4FDD\u5B58+\u52A8\u4F5C\u94FE+\u843D\u5E93\u56DE\u67E5\uFF09\uFF0C\u8FD4\u56DE\u9010\u4EBA\u7ED3\u679C\u6E05\u5355\u4E0E Markdown \u8868\u683C\uFF1B\u975E\u539F\u5B50\u6279\u91CF\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E3A partial",
|
|
4711
|
+
capability: "recruit.interview.arrange",
|
|
4712
|
+
risk: "write",
|
|
4713
|
+
requiresConfirmation: true,
|
|
4714
|
+
inputSchema: schemaOf({ confirm: { type: "boolean" }, continuation: { type: "string" } }, { required: ["confirm", "continuation"] }),
|
|
4715
|
+
handler: batchApply2
|
|
3590
4716
|
}
|
|
3591
4717
|
];
|
|
3592
4718
|
|
|
@@ -3690,16 +4816,28 @@ async function prepare4(args, env) {
|
|
|
3690
4816
|
const analysis = submitBtn ? analyzeButtonActions(submitBtn) : null;
|
|
3691
4817
|
let newOptionId = null;
|
|
3692
4818
|
if (args.result) {
|
|
3693
|
-
const opts =
|
|
4819
|
+
const opts = await getDsOptions(t.host, t.objId, t.resultFid);
|
|
3694
4820
|
newOptionId = opts[String(args.result)];
|
|
3695
4821
|
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
4822
|
}
|
|
3697
4823
|
const newComment = args.comment !== void 0 ? String(args.comment) : t.target.judgement;
|
|
3698
4824
|
const newResultName = args.result ? String(args.result) : t.target.result;
|
|
3699
4825
|
const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
|
|
3700
|
-
const { createHash:
|
|
3701
|
-
const fp =
|
|
3702
|
-
const continuation = await env.continuation.issue({
|
|
4826
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
4827
|
+
const fp = createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex");
|
|
4828
|
+
const continuation = await env.continuation.issue({
|
|
4829
|
+
operation: "recruit-stage.interview.feedback.edit.apply",
|
|
4830
|
+
fingerprint: fp,
|
|
4831
|
+
enumMaps: await dsOptionsSnapshot(),
|
|
4832
|
+
// 🔴 2026-11-07 修复(同 arrange/jd.create 的同类缺陷):apply 原来只从 args 取 talentId/result/comment,
|
|
4833
|
+
// 导致「只带 confirm + continuation」时定位不到目标或指纹不符。现将这些参数签进 continuation。
|
|
4834
|
+
argsSnapshot: {
|
|
4835
|
+
talentId: t.talentId,
|
|
4836
|
+
feedbackId: args.feedbackId ? String(args.feedbackId) : String(t.target.feedbackId),
|
|
4837
|
+
result: args.result ? String(args.result) : void 0,
|
|
4838
|
+
comment: args.comment !== void 0 ? String(args.comment) : void 0
|
|
4839
|
+
}
|
|
4840
|
+
});
|
|
3703
4841
|
return rsSuccess("recruit-stage.interview.feedback.edit.prepare", {
|
|
3704
4842
|
mode: "prepare",
|
|
3705
4843
|
talentId: t.talentId,
|
|
@@ -3714,27 +4852,41 @@ async function prepare4(args, env) {
|
|
|
3714
4852
|
\u52A8\u4F5C\u6D41: analysis.esbIds.length ? analysis.esbIds : "\uFF08\u8BE5\u6309\u94AE\u65E0 esb \u52A8\u4F5C\u6D41\uFF09",
|
|
3715
4853
|
\u62DB\u8058API: analysis.jsCalls.map((c) => c.url + (Object.keys(c.data).length ? " data=" + Object.keys(c.data).join(",") : ""))
|
|
3716
4854
|
} : "\u26A0\uFE0F \u672A\u5B9A\u4F4D\u5230\u300C\u63D0\u4EA4\u8BC4\u4EF7\u300D\u6309\u94AE\uFF08getFormButtons \u672A\u53D6\u5230\u4FDD\u5B58\u6309\u94AE\uFF09\uFF0C\u4EC5\u80FD\u6267\u884C\u4FDD\u5B58+\u5199\u8FC7\u7A0B\u65E5\u5FD7",
|
|
3717
|
-
willSubmit
|
|
4855
|
+
willSubmit,
|
|
4856
|
+
// 🔴 2026-11-07:本 op 此前无 preview(与 jd.create 同类缺陷)。把上方的中文字段收进 preview,
|
|
4857
|
+
// 让「确认」这一步有统一的机器可读摘要,而不是只能靠人读散装字段。
|
|
4858
|
+
preview: {
|
|
4859
|
+
action: "\u63D0\u4EA4/\u4FEE\u6539\u9762\u8BD5\u53CD\u9988",
|
|
4860
|
+
\u5019\u9009\u4EBA: t.talentId,
|
|
4861
|
+
\u9762\u8BD5: t.target.planName,
|
|
4862
|
+
\u9762\u8BD5\u5B98: t.target.interviewer,
|
|
4863
|
+
\u53CD\u9988\u8BB0\u5F55Id: t.target.feedbackId,
|
|
4864
|
+
\u5F53\u524D\u53CD\u9988: (t.target.result ? "\u7ED3\u679C " + t.target.result : "") + (t.target.judgement ? "\uFF1B\u8BC4\u4EF7 " + t.target.judgement : ""),
|
|
4865
|
+
\u65B0\u53CD\u9988: (args.result ? "\u7ED3\u679C " + newResultName : "") + (args.comment !== void 0 ? "\uFF1B\u8BC4\u4EF7 " + newComment : ""),
|
|
4866
|
+
\u5C06\u6267\u884C\u52A8\u4F5C: analysis ? { \u4FDD\u5B58\u53CD\u9988\u8868\u5355: "saveFormData\uFF08\u5168\u5B57\u6BB5\u96C6 + updateTimeStamp \u4E50\u89C2\u9501\uFF09", \u52A8\u4F5C\u6D41: analysis.esbIds.length ? analysis.esbIds : "\uFF08\u8BE5\u6309\u94AE\u65E0 esb \u52A8\u4F5C\u6D41\uFF09", \u62DB\u8058API: analysis.jsCalls.map((c) => c.url) } : "\u26A0\uFE0F \u672A\u5B9A\u4F4D\u5230\u300C\u63D0\u4EA4\u8BC4\u4EF7\u300D\u6309\u94AE\uFF0C\u4EC5\u80FD\u6267\u884C\u4FDD\u5B58+\u5199\u8FC7\u7A0B\u65E5\u5FD7"
|
|
4867
|
+
}
|
|
3718
4868
|
}, { continuation, fingerprint: fp, confirmHint: "\u7528\u6237\u660E\u786E\u786E\u8BA4\u540E\uFF0C\u643A\u5E26 confirm:true \u4E0E continuation \u8C03\u7528 apply" });
|
|
3719
4869
|
}
|
|
3720
4870
|
async function apply4(args, env) {
|
|
3721
4871
|
if (args.confirm !== true) throw rsConfirmationError("recruit-stage.interview.feedback.edit.apply", { hint: "\u5199\u64CD\u4F5C\u5FC5\u987B\u663E\u5F0F confirm:true" });
|
|
3722
4872
|
if (!args.continuation) throw rsValidationError("continuation_required", "\u7F3A\u5C11 continuation\uFF08\u6765\u81EA prepare \u7684 meta\uFF09");
|
|
3723
4873
|
const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.interview.feedback.edit.apply");
|
|
3724
|
-
|
|
4874
|
+
restoreDsOptions(payload.enumMaps);
|
|
4875
|
+
const merged = { ...payload.argsSnapshot || {}, ...args };
|
|
4876
|
+
const t = await buildTarget(env, merged);
|
|
3725
4877
|
const rec2 = await getFormDataRecord(t.host, t.formId, String(t.target.feedbackId), t.objId);
|
|
3726
4878
|
const details2 = toSubmitDetails(rec2.dataDetails);
|
|
3727
4879
|
let newOptionId = null;
|
|
3728
|
-
if (
|
|
3729
|
-
const opts =
|
|
3730
|
-
newOptionId = opts[String(
|
|
3731
|
-
if (!newOptionId) throw rsFail("\u672A\u8BC6\u522B\u7684\u9762\u8BD5\u7ED3\u679C\u300C" +
|
|
4880
|
+
if (merged.result) {
|
|
4881
|
+
const opts = await getDsOptions(t.host, t.objId, t.resultFid);
|
|
4882
|
+
newOptionId = opts[String(merged.result)];
|
|
4883
|
+
if (!newOptionId) throw rsFail("\u672A\u8BC6\u522B\u7684\u9762\u8BD5\u7ED3\u679C\u300C" + merged.result + "\u300D\uFF0C\u53EF\u9009\uFF1A" + Object.keys(opts).join("/"));
|
|
3732
4884
|
}
|
|
3733
|
-
const newComment =
|
|
3734
|
-
const newResultName =
|
|
4885
|
+
const newComment = merged.comment !== void 0 ? String(merged.comment) : t.target.judgement;
|
|
4886
|
+
const newResultName = merged.result ? String(merged.result) : t.target.result;
|
|
3735
4887
|
const willSubmit = { feedbackId: String(t.target.feedbackId), result: newResultName, comment: newComment };
|
|
3736
|
-
const { createHash:
|
|
3737
|
-
if (payload.fingerprint !==
|
|
4888
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
4889
|
+
if (payload.fingerprint !== createHash4("sha256").update(JSON.stringify(willSubmit)).digest("hex")) {
|
|
3738
4890
|
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");
|
|
3739
4891
|
}
|
|
3740
4892
|
const newDetails = details2.map((x) => {
|
|
@@ -4449,6 +5601,19 @@ function getRecruitStageOperation(operation) {
|
|
|
4449
5601
|
}
|
|
4450
5602
|
async function executeRecruitStageOperation(operation, input, env) {
|
|
4451
5603
|
const definition = getRecruitStageOperation(operation);
|
|
5604
|
+
const schema = definition.inputSchema;
|
|
5605
|
+
if (schema && schema.additionalProperties === false) {
|
|
5606
|
+
const known = Object.keys(schema.properties || {});
|
|
5607
|
+
const unknown = Object.keys(input || {}).filter((key) => !known.includes(key));
|
|
5608
|
+
if (unknown.length > 0) {
|
|
5609
|
+
throw new RecruitStageCliError(
|
|
5610
|
+
"validation",
|
|
5611
|
+
"unknown_argument",
|
|
5612
|
+
`\u672A\u77E5\u53C2\u6570\uFF1A${unknown.join("\u3001")}\u3002\u672C\u64CD\u4F5C\u652F\u6301\u7684\u53C2\u6570\uFF1A${known.length ? known.join("\u3001") : "\uFF08\u65E0\uFF09"}\u3002\u53C2\u6570\u540D\u5199\u9519\u4F1A\u88AB\u9759\u9ED8\u5FFD\u7565\u5E76\u8FD4\u56DE\u770B\u4F3C\u6B63\u5E38\u7684\u7ED3\u679C\uFF0C\u8BF7\u6309\u4E0A\u9762\u7684\u53C2\u6570\u540D\u91CD\u4F20\u3002`,
|
|
5613
|
+
{ exitCode: 1 }
|
|
5614
|
+
);
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
4452
5617
|
return definition.handler(input, env);
|
|
4453
5618
|
}
|
|
4454
5619
|
|
|
@@ -4478,10 +5643,10 @@ var recruitStageManifest = {
|
|
|
4478
5643
|
};
|
|
4479
5644
|
|
|
4480
5645
|
// src/shortcuts/recruit-stage/context.ts
|
|
4481
|
-
import { join, resolve as
|
|
5646
|
+
import { join as join4, resolve as resolve4 } from "node:path";
|
|
4482
5647
|
import { existsSync as existsSync2 } from "node:fs";
|
|
4483
5648
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
4484
|
-
import { homedir as
|
|
5649
|
+
import { homedir as homedir4 } from "node:os";
|
|
4485
5650
|
var flowMemo = /* @__PURE__ */ new Map();
|
|
4486
5651
|
var SELFUSE_DEFAULT_FLOW = {
|
|
4487
5652
|
selfUseHost: "www.e-cology.com.cn",
|
|
@@ -4493,9 +5658,9 @@ function cacheDirFor(baseUrl) {
|
|
|
4493
5658
|
const url = new URL(baseUrl);
|
|
4494
5659
|
const host = url.hostname + (url.port ? `_${url.port}` : "");
|
|
4495
5660
|
const envRoot = process.env.E10_SKILL_CACHE_DIR;
|
|
4496
|
-
if (envRoot) return
|
|
4497
|
-
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME ||
|
|
4498
|
-
return
|
|
5661
|
+
if (envRoot) return join4(envRoot, host);
|
|
5662
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve4(homedir4(), ".weaver-work-cli");
|
|
5663
|
+
return join4(home, "env-cache", "recruit-ops", host);
|
|
4499
5664
|
}
|
|
4500
5665
|
async function readLegacyCacheExtra(baseUrl) {
|
|
4501
5666
|
try {
|
|
@@ -4508,7 +5673,7 @@ async function readLegacyCacheExtra(baseUrl) {
|
|
|
4508
5673
|
for (const f of jsonFiles) {
|
|
4509
5674
|
let raw;
|
|
4510
5675
|
try {
|
|
4511
|
-
raw = JSON.parse(await readFile2(
|
|
5676
|
+
raw = JSON.parse(await readFile2(join4(dir, f), "utf8"));
|
|
4512
5677
|
} catch {
|
|
4513
5678
|
continue;
|
|
4514
5679
|
}
|