weaver-work-cli 0.1.62 → 0.1.64
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/dist/chunks/{archive-S2VKZWQ3.js → archive-WUZKAEZ6.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-PN46RTI2.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-ZPC5VWZM.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-DHGP3NYY.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-JQDW3BIB.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-JC47AIXK.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-IKIHM77A.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-GZTSJ57Y.js} +5 -4
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-26FCCU5O.js} +5 -3
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-3PCXBG4H.js} +1 -1
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-3W5NMGDS.js} +2 -2
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-4AFWOGOV.js} +3 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-5QQKLR6H.js} +11 -11
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-6T5X6YWX.js} +5 -3
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-AFZTMYGC.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-AGSO3PIK.js} +2 -2
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-FDBAFANU.js} +76 -76
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-FJUOUSV3.js} +89 -8
- package/dist/chunks/{chunk-EGANE35F.js → chunk-HLT6B26P.js} +1 -1
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-HWA2A25Y.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-I3MOFD6Q.js} +4 -7
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-INVYKG4I.js} +140 -45
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-K7QKQRSL.js} +168 -62
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-KDFEHDIB.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-KYDXWYFB.js} +1 -1
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-Q6D6PSMH.js} +30 -24
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-RMOH2GMF.js} +2 -2
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-SCMHG23G.js} +387 -70
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-VLY5RTVO.js} +5 -3
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-WSHIOSGM.js} +5 -3
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-XHSEK2VM.js} +48 -12
- package/dist/chunks/{chunk-XT77MP54.js → chunk-YTFNMQO4.js} +410 -24
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-UUC7AFUI.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-INMS7SYQ.js} +3051 -4497
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-34CBYVQP.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-YOR4QTAJ.js} +18 -6
- package/dist/chunks/{data-FOODGAMF.js → data-QKWI5325.js} +14 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-ZONRROK4.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-2CONM7R6.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-S2ENJ6GZ.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-ZSAXU5PJ.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-FQASCY2H.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-N76QQA53.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-FCLVIWAS.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-UM665WDZ.js} +3 -3
- package/dist/chunks/{host-VTPAWDZV.js → host-2ED2KC4X.js} +4 -4
- package/dist/chunks/{host-TJ5VVHM7.js → host-2UYZEY2V.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-46NYKDQP.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-7IPZKIM4.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-P7G22WNM.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-XLCBLNJD.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-XKL27NX2.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-NDYIMASG.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-MOGNB6HN.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-3T5X7SB7.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-4WOIL3ZQ.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-P7VMUKQW.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-MMTYDHXA.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-LCSBWGJ3.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-VZXRQGS4.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-MI2BSKZX.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-OPEQNW7Y.js} +873 -17
- package/dist/chunks/{plan-BLGPZF5M.js → plan-TJAS4N5X.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-CYBGU6K6.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-3FT2F66K.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-WPGB5BDJ.js} +654 -336
- package/dist/chunks/{registry-3FYSWV3U.js → registry-BAWCWV4D.js} +3 -3
- package/dist/chunks/{registry-I4DVPDMU.js → registry-FNI5E76J.js} +12 -12
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-QRMXRSCT.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-I7QQRHEL.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-3P7EWGNZ.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-FOBSVNYW.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-U2KKTVQY.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +203 -44
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/error-actions.js +112 -0
- package/dist/shortcuts/contract/errors.js +9 -1
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +130 -274
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
- package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
- package/dist/shortcuts/contract/operations/elements-build.js +82 -56
- package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +123 -27
- package/dist/shortcuts/contract/operations/ledger.js +343 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/money.js +90 -0
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +326 -0
- package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +281 -0
- package/dist/shortcuts/contract/operations/quote.js +66 -12
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
- package/dist/shortcuts/contract/operations/triage.js +68 -15
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/data/operations/shared.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +138 -15
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/performance/flow-utils.js +363 -0
- package/dist/shortcuts/performance/manifest.js +2 -2
- package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
- package/dist/shortcuts/performance/operations/flow-list.js +213 -0
- package/dist/shortcuts/performance/operations/flow-score.js +241 -0
- package/dist/shortcuts/performance/operations/registry.js +6 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +55 -2
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +283 -345
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +126 -202
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +13 -5
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +47 -16
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +19 -18
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +78 -112
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +67 -333
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +18 -15
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +80 -84
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +38 -34
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +132 -47
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +108 -217
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +14 -20
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +13 -7
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +86 -46
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +22 -14
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +27 -26
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +252 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +15 -23
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +290 -104
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +5 -12
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +12 -18
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +33 -35
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +87 -534
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +9 -7
- package/skills/weaver-e10-meeting/references/create-guardrails.md +23 -17
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-performance/SKILL.md +45 -5
- package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
- package/skills/weaver-e10-performance/references/flow-api.md +128 -0
- package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -14
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* recruit-stage.resume.import.* ——
|
|
2
|
+
* recruit-stage.resume.import.* —— 简历导入建人才
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - fileId:已上传到 E10 的简历附件 id
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* 🔴 解析通道固定为 **OCR(resumeExtraction)**,唯一通道,不接受任何文本/结构化 JSON 手输入。
|
|
5
|
+
* 输入只有两种(必须先有原件):
|
|
6
|
+
* - resumeFile:本地简历路径(两步 multipart 上传进附件字段后解析)
|
|
7
|
+
* - fileId:已上传到 E10 的简历附件 id(复用原件、不重复上传,复跑请用这个)
|
|
8
|
+
* 闸门 = checkResumeExtraction:环境未开启即报错停止,**不回退大模型/结构化输入**。
|
|
9
|
+
* 接口返回什么就写什么,不做完整性校验、不因字段少/明细少而回退。checkRpaValid 已废弃。
|
|
10
10
|
*
|
|
11
11
|
* 链路:查重(两级:getCandidateByPhone 页面同款 + checkUnique 表单唯一性,含软删除占用)
|
|
12
12
|
* → 建人才(首选 dataset/v2 主表+明细一次写入;被拦时回退 form/core 主表 + dataset update 补明细)
|
|
@@ -24,8 +24,18 @@ import { rsSuccess, schemaOf } from './types.js';
|
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
25
|
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
26
|
import { resolveTags, addEntityTags, queryEntityTags } from '../tag-lookup.js';
|
|
27
|
-
import { scanResumeSource
|
|
28
|
-
import { saveBatchItems, loadBatchItems } from '../batch-store.js';
|
|
27
|
+
import { scanResumeSource } from '../fs-scan.js';
|
|
28
|
+
import { saveBatchItems, loadBatchItems, saveOcrResult, loadOcrResult } from '../batch-store.js';
|
|
29
|
+
// 阶段耗时打点(诊断用,不影响业务):E10_TRACE_MS=1 时把每段耗时打到 stderr
|
|
30
|
+
let tracePrev = 0;
|
|
31
|
+
function mark(label) {
|
|
32
|
+
if (process.env.E10_TRACE_MS !== '1')
|
|
33
|
+
return;
|
|
34
|
+
const now = performance.now();
|
|
35
|
+
const delta = tracePrev ? now - tracePrev : 0;
|
|
36
|
+
tracePrev = now;
|
|
37
|
+
console.error(`[trace] ${label} +${delta.toFixed(0)}ms t=${now.toFixed(0)}`);
|
|
38
|
+
}
|
|
29
39
|
// 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
|
|
30
40
|
const PROTECTED_UPDATE_KEYS = ['is_blacklist', 'recruit_status', 'candidate_status', 'data_status'];
|
|
31
41
|
// ── 上传简历文件(两步:preUploadCheck 取 preUploadId → module/upload 带 file)→ fileid ──
|
|
@@ -54,6 +64,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
54
64
|
};
|
|
55
65
|
const withFile = () => { const fd = baseForm(); fd.append('file', new Blob([buf]), filename); return fd; };
|
|
56
66
|
const c = await host.request({ path: '/api/file/preUploadCheck', method: 'POST', multipart: withFile(), headers });
|
|
67
|
+
mark('upload.preUploadCheck');
|
|
57
68
|
const preUploadId = c?.data?.preUploadId;
|
|
58
69
|
const uploadType = c?.data?.uploadType || 'common';
|
|
59
70
|
if (!preUploadId)
|
|
@@ -69,6 +80,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
69
80
|
fd.append('uploadType', String(uploadType));
|
|
70
81
|
fd.append('file', new Blob([buf]), filename);
|
|
71
82
|
const j = await host.request({ path: '/api/file/module/upload', method: 'POST', multipart: fd, headers });
|
|
83
|
+
mark('upload.moduleUpload');
|
|
72
84
|
if (!j?.data?.fileid)
|
|
73
85
|
throw rsFail('简历上传失败:' + JSON.stringify(j || {}).slice(0, 200));
|
|
74
86
|
return { fileid: String(j.data.fileid), name: j.data.name || filename };
|
|
@@ -96,15 +108,37 @@ async function writeAvatarIfProvided(ctx, opts) {
|
|
|
96
108
|
return { written: false, warning: '头像写入失败(已跳过,不影响建档):' + (e?.message || e) };
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
|
-
// OCR
|
|
100
|
-
|
|
111
|
+
// ── OCR 解析结果快照(prepare → apply 复用,避免同一份原件解析两次) ──
|
|
112
|
+
// 超过 80 KB 不回传:continuation 要走命令行参数,超大简历宁可 apply 重新解析,也不冒参数截断风险。
|
|
113
|
+
const PARSED_SNAPSHOT_LIMIT = 80 * 1024;
|
|
114
|
+
function snapshotParsedResume(s) {
|
|
115
|
+
if (!s || typeof s !== 'object')
|
|
116
|
+
return undefined;
|
|
117
|
+
try {
|
|
118
|
+
const raw = JSON.stringify(s);
|
|
119
|
+
if (raw.length > PARSED_SNAPSHOT_LIMIT)
|
|
120
|
+
return undefined;
|
|
121
|
+
return s;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// 闸门:简历抽取功能是否开启(幂等只读;与上传并发发起,先落闸门再解析)
|
|
128
|
+
async function checkExtractionGate(host) {
|
|
101
129
|
const b = await host.request({ path: '/api/recruit/ocr/checkResumeExtraction', method: 'POST', body: {} });
|
|
102
|
-
|
|
103
|
-
|
|
130
|
+
mark('ocr.checkResumeExtraction');
|
|
131
|
+
if (b?.data !== true) {
|
|
132
|
+
throw rsFail('当前环境未开启简历抽取(checkResumeExtraction=false):请在 E10 后台开启「简历抽取」能力后原路径重试;本 CLI 不接受结构化文本输入兜底');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// OCR 解析(唯一通道):闸门 = checkResumeExtraction;未开启即停止,不回退任何文本输入
|
|
136
|
+
async function extractResume(host, fileid) {
|
|
104
137
|
const r = await host.request({ path: '/api/recruit/ocr/resumeExtraction?fileId=' + encodeURIComponent(fileid), method: 'POST' });
|
|
138
|
+
mark('ocr.resumeExtraction');
|
|
105
139
|
const d = r?.data?.data;
|
|
106
140
|
if (!d || typeof d !== 'object')
|
|
107
|
-
throw rsFail('
|
|
141
|
+
throw rsFail('未从文件中解析出简历信息(可能是非简历文件),请确认上传的是简历原件');
|
|
108
142
|
return d;
|
|
109
143
|
}
|
|
110
144
|
// 解析结果 → 人才基本信息 dataDetails(文本 content / 字典 dataOptions / 长文本 dataText)
|
|
@@ -480,194 +514,6 @@ function deriveSchoolTags(structured) {
|
|
|
480
514
|
}
|
|
481
515
|
return { candidates, detail, schools };
|
|
482
516
|
}
|
|
483
|
-
// 文本直建:字典名称 → optionId 归一(唯一命中才写;歧义/缺失跳过并记 warning,宁缺勿错)
|
|
484
|
-
function normalizeTextStructured(cache, s, warnings) {
|
|
485
|
-
const raw = cache.dict?.raw || [];
|
|
486
|
-
const byName = cache.dict?.by_name || {};
|
|
487
|
-
const dictIdByName = (name) => {
|
|
488
|
-
const k = String(name || '').trim();
|
|
489
|
-
if (!k)
|
|
490
|
-
return '';
|
|
491
|
-
let ids = byName[k];
|
|
492
|
-
if (!ids || !ids.length)
|
|
493
|
-
ids = raw.filter((x) => x.selection_name === k).map((x) => x.option_id);
|
|
494
|
-
const uniq = [...new Set((ids || []).map(String))];
|
|
495
|
-
if (!uniq.length) {
|
|
496
|
-
warnings.push('字典未找到「' + k + '」→ 该字段跳过');
|
|
497
|
-
return '';
|
|
498
|
-
}
|
|
499
|
-
if (uniq.length > 1) {
|
|
500
|
-
warnings.push('字典「' + k + '」命中 ' + uniq.length + ' 个同名选项(歧义)→ 该字段跳过');
|
|
501
|
-
return '';
|
|
502
|
-
}
|
|
503
|
-
return uniq[0];
|
|
504
|
-
};
|
|
505
|
-
const fixRows = (rows, keys) => {
|
|
506
|
-
for (const r of rows || []) {
|
|
507
|
-
if (!r || typeof r !== 'object')
|
|
508
|
-
continue;
|
|
509
|
-
for (const k of keys) {
|
|
510
|
-
const v = String(r[k] || '').trim();
|
|
511
|
-
if (!v || /^\d{6,}$/.test(v))
|
|
512
|
-
continue;
|
|
513
|
-
const id = dictIdByName(v);
|
|
514
|
-
if (id)
|
|
515
|
-
r[k] = id;
|
|
516
|
-
else
|
|
517
|
-
delete r[k];
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
if (!s.gender && s.genderName) {
|
|
522
|
-
const id = dictIdByName(s.genderName);
|
|
523
|
-
if (id)
|
|
524
|
-
s.gender = id;
|
|
525
|
-
}
|
|
526
|
-
if (!s.highest_degree && s.highest_degree_name) {
|
|
527
|
-
const id = dictIdByName(s.highest_degree_name);
|
|
528
|
-
if (id)
|
|
529
|
-
s.highest_degree = id;
|
|
530
|
-
}
|
|
531
|
-
fixRows(s.academicInformations, ['edu_education', 'degree']);
|
|
532
|
-
fixRows(s.jobInformations || s.workExperiences, ['work_type']);
|
|
533
|
-
fixRows(s.internshipExperiences, ['sx_work_type']);
|
|
534
|
-
fixRows(s.languageAbilities, ['mastery', 'ls_ability', 'literacy']);
|
|
535
|
-
return s;
|
|
536
|
-
}
|
|
537
|
-
// ── 日期格式预检与归一(prepare 阶段前置,避免格式引发连锁失败)──
|
|
538
|
-
// 实测(2026-11-05):人才表单接口只接受 yyyy-MM-dd。模型常给「2020.11」「2008-08」「2004.09-2008.07」,
|
|
539
|
-
// 会让 dataset 新增整批校验失败 → 回退 form/core 建主表 → 回退补明细又被同一格式拦下 → 明细全丢却报 success,
|
|
540
|
-
// 且实测多花 3.4s(5523ms vs 2105ms)。此处统一归一:
|
|
541
|
-
// · 只有年月 → 开始补 -01、结束补当月最后一天(语义约定,写入 warnings 明示)
|
|
542
|
-
// · 「至今/现在」→ 空(表示至今,不伪造结束日)
|
|
543
|
-
// · 区间统一成 "start,end"(comma 分隔,供 DateRange 拆两键)
|
|
544
|
-
// · 无法识别 → 跳过该字段并告警(宁缺勿整批失败),绝不静默改写
|
|
545
|
-
const DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
546
|
-
const ONGOING_RE = /至今|现在|今|now|present/i;
|
|
547
|
-
const RE_RANGE_FULL = /^\s*(\d{4}[.\-/年]\d{1,2}[.\-/月]\d{1,2}\s*日?)\s*[-–—~至,,]\s*(\d{4}[.\-/年]\d{1,2}[.\-/月]\d{1,2}\s*日?|至今|现在|今)\s*$/;
|
|
548
|
-
const RE_RANGE_YM = /^\s*(\d{4}[.\-/年]\d{1,2})\s*[-–—~至,,]\s*(\d{4}[.\-/年]\d{1,2}|至今|现在|今)\s*$/;
|
|
549
|
-
/** 单日期片段 → yyyy-MM-dd;isEnd=true 且缺日时补该月最后一天。无法解析返回 ''。 */
|
|
550
|
-
function normDatePart(raw, isEnd) {
|
|
551
|
-
const s = String(raw ?? '').trim();
|
|
552
|
-
if (!s)
|
|
553
|
-
return '';
|
|
554
|
-
if (ONGOING_RE.test(s))
|
|
555
|
-
return '';
|
|
556
|
-
if (DATE_ONLY_RE.test(s))
|
|
557
|
-
return s;
|
|
558
|
-
const m = s.match(/^(\d{4})\s*[.\-/年]?\s*(\d{1,2})?\s*[.\-/月]?\s*(\d{1,2})?\s*日?$/);
|
|
559
|
-
if (!m)
|
|
560
|
-
return '';
|
|
561
|
-
const y = Number(m[1]);
|
|
562
|
-
const mo = m[2] ? Number(m[2]) : 1;
|
|
563
|
-
if (!y || mo < 1 || mo > 12)
|
|
564
|
-
return '';
|
|
565
|
-
const lastDay = new Date(y, mo, 0).getDate();
|
|
566
|
-
let d;
|
|
567
|
-
if (m[3]) {
|
|
568
|
-
d = Number(m[3]);
|
|
569
|
-
if (d < 1 || d > lastDay)
|
|
570
|
-
return '';
|
|
571
|
-
}
|
|
572
|
-
else {
|
|
573
|
-
d = isEnd ? lastDay : 1;
|
|
574
|
-
}
|
|
575
|
-
return y + '-' + String(mo).padStart(2, '0') + '-' + String(d).padStart(2, '0');
|
|
576
|
-
}
|
|
577
|
-
/** 日期区间 → "start,end";只有单值时返回单值。 */
|
|
578
|
-
function normDateRange(raw) {
|
|
579
|
-
const s = Array.isArray(raw)
|
|
580
|
-
? raw.map((x) => String(x ?? '').trim()).filter(Boolean).join(',')
|
|
581
|
-
: String(raw ?? '').trim();
|
|
582
|
-
if (!s)
|
|
583
|
-
return '';
|
|
584
|
-
const m = s.match(RE_RANGE_FULL) || s.match(RE_RANGE_YM);
|
|
585
|
-
if (m) {
|
|
586
|
-
const a = normDatePart(m[1], false);
|
|
587
|
-
if (!a)
|
|
588
|
-
return '';
|
|
589
|
-
const b = normDatePart(m[2], true);
|
|
590
|
-
return b ? a + ',' + b : a;
|
|
591
|
-
}
|
|
592
|
-
return normDatePart(s, false);
|
|
593
|
-
}
|
|
594
|
-
/** 就地归一结构化简历里的全部日期字段,把每处改动写进 warnings(不静默改写)。 */
|
|
595
|
-
function normalizeDates(s, warnings) {
|
|
596
|
-
if (!s || typeof s !== 'object')
|
|
597
|
-
return;
|
|
598
|
-
const one = (label, val, isEnd = false) => {
|
|
599
|
-
const before = String(val ?? '').trim();
|
|
600
|
-
if (!before)
|
|
601
|
-
return '';
|
|
602
|
-
if (ONGOING_RE.test(before))
|
|
603
|
-
return '';
|
|
604
|
-
const after = normDatePart(before, isEnd);
|
|
605
|
-
if (!after) {
|
|
606
|
-
warnings.push('日期无法识别,已跳过该字段(避免接口整批校验失败):' + label + ' = 「' + before + '」');
|
|
607
|
-
return '';
|
|
608
|
-
}
|
|
609
|
-
if (after !== before)
|
|
610
|
-
warnings.push('日期已规范化:' + label + ' 「' + before + '」→「' + after + '」');
|
|
611
|
-
return after;
|
|
612
|
-
};
|
|
613
|
-
// 主表单值日期
|
|
614
|
-
for (const k of ['joinworkdate', 'graduate_date', 'birthday']) {
|
|
615
|
-
if (s[k] === undefined || s[k] === null)
|
|
616
|
-
continue;
|
|
617
|
-
s[k] = one(k, s[k], false);
|
|
618
|
-
}
|
|
619
|
-
// 教育经历:区间(一个组件 = 起止两个物理字段,必须 comma 分隔)
|
|
620
|
-
if (Array.isArray(s.academicInformations)) {
|
|
621
|
-
for (let i = 0; i < s.academicInformations.length; i++) {
|
|
622
|
-
const r = s.academicInformations[i];
|
|
623
|
-
if (!r || typeof r !== 'object' || r.study_date === undefined)
|
|
624
|
-
continue;
|
|
625
|
-
const before = String(r.study_date ?? '').trim();
|
|
626
|
-
if (!before)
|
|
627
|
-
continue;
|
|
628
|
-
const after = normDateRange(before);
|
|
629
|
-
if (!after) {
|
|
630
|
-
warnings.push('日期区间无法识别,已跳过(避免接口整批校验失败):academicInformations[' + i + '].study_date = 「' + before + '」');
|
|
631
|
-
r.study_date = '';
|
|
632
|
-
}
|
|
633
|
-
else {
|
|
634
|
-
if (after !== before)
|
|
635
|
-
warnings.push('日期已规范化:academicInformations[' + i + '].study_date 「' + before + '」→「' + after + '」');
|
|
636
|
-
r.study_date = after;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
// 工作/项目经历:起止为两个独立字段,需分别归一后由 buildSubDetails 拼成区间
|
|
641
|
-
for (const key of ['jobInformations', 'workExperiences', 'projectExperiences']) {
|
|
642
|
-
const arr = s[key];
|
|
643
|
-
if (!Array.isArray(arr))
|
|
644
|
-
continue;
|
|
645
|
-
for (let i = 0; i < arr.length; i++) {
|
|
646
|
-
const r = arr[i];
|
|
647
|
-
if (!r || typeof r !== 'object')
|
|
648
|
-
continue;
|
|
649
|
-
if (r.start_date !== undefined && r.start_date !== null) {
|
|
650
|
-
r.start_date = one(key + '[' + i + '].start_date', r.start_date, false);
|
|
651
|
-
}
|
|
652
|
-
if (r.end_date !== undefined && r.end_date !== null) {
|
|
653
|
-
r.end_date = one(key + '[' + i + '].end_date', r.end_date, true);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
// 实习入职时间 / 获奖日期:单值日期
|
|
658
|
-
for (const [key, field] of [['internshipExperiences', 'entry_time'], ['awardExperiences', 'award_date']]) {
|
|
659
|
-
const arr = s[key];
|
|
660
|
-
if (!Array.isArray(arr))
|
|
661
|
-
continue;
|
|
662
|
-
for (let i = 0; i < arr.length; i++) {
|
|
663
|
-
const r = arr[i];
|
|
664
|
-
if (!r || typeof r !== 'object')
|
|
665
|
-
continue;
|
|
666
|
-
if (r[field] !== undefined && r[field] !== null)
|
|
667
|
-
r[field] = one(key + '[' + i + '].' + field, r[field], false);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
517
|
// 读回校验:统计各子表实际落库行数(不能只看写入接口返回,必须回读)
|
|
672
518
|
async function verifySubRows(ctx, formId, objId, dataId) {
|
|
673
519
|
const L = await getFormLayoutMeta(ctx.host, formId);
|
|
@@ -697,59 +543,50 @@ async function verifySubRows(ctx, formId, objId, dataId) {
|
|
|
697
543
|
rowTotal: Object.values(rowsBySubFormId).reduce((a, b) => a + b, 0),
|
|
698
544
|
};
|
|
699
545
|
}
|
|
700
|
-
async function loadStructured(ctx, args) {
|
|
701
|
-
const warnings = [];
|
|
702
|
-
if (args.structured !== undefined) {
|
|
703
|
-
const s = typeof args.structured === 'string' ? JSON.parse(args.structured) : args.structured;
|
|
704
|
-
if (!s || typeof s !== 'object')
|
|
705
|
-
throw rsValidationError('structured_invalid', 'structured 必须是 JSON 对象');
|
|
706
|
-
if (!String(s.telephone || '').trim() && !String(s.candidateName || '').trim()) {
|
|
707
|
-
throw rsValidationError('structured_invalid', '结构化简历缺少 telephone 与 candidateName(至少要有手机号或姓名,否则无法查重建档)');
|
|
708
|
-
}
|
|
709
|
-
const normalizedInline = normalizeTextStructured(ctx.cache, s, warnings);
|
|
710
|
-
normalizeDates(normalizedInline, warnings);
|
|
711
|
-
return { structured: normalizedInline, textMode: true, warnings };
|
|
712
|
-
}
|
|
713
|
-
if (args.structuredFile) {
|
|
714
|
-
const p = path.resolve(String(args.structuredFile));
|
|
715
|
-
const s = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
716
|
-
if (!s || typeof s !== 'object')
|
|
717
|
-
throw rsValidationError('structured_invalid', 'structuredFile 内容不是合法 JSON 对象');
|
|
718
|
-
if (!String(s.telephone || '').trim() && !String(s.candidateName || '').trim()) {
|
|
719
|
-
throw rsValidationError('structured_invalid', '结构化简历缺少 telephone 与 candidateName');
|
|
720
|
-
}
|
|
721
|
-
const normalizedFile = normalizeTextStructured(ctx.cache, s, warnings);
|
|
722
|
-
normalizeDates(normalizedFile, warnings);
|
|
723
|
-
return { structured: normalizedFile, textMode: true, warnings };
|
|
724
|
-
}
|
|
725
|
-
return { structured: null, textMode: false, warnings };
|
|
726
|
-
}
|
|
727
546
|
async function buildImport(ctx, args) {
|
|
728
547
|
const { host, baseUrl, appId, cache } = ctx;
|
|
548
|
+
mark('build.start');
|
|
729
549
|
const objId = objIdOf(cache, 'talent_pool');
|
|
730
550
|
const formId = formIdOf(cache, 'talent_pool');
|
|
731
551
|
const fields = cache.fields[objId] || {};
|
|
732
552
|
if (!fields.candidate_name || !fields.telephone)
|
|
733
553
|
throw rsFail('环境缓存缺人才表单字段 candidate_name/telephone');
|
|
734
554
|
const resumeFieldId = fields.original_resume || '937153853968539861';
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
555
|
+
// 原件 → fileid:本地文件先上传(写进附件字段);已上传的直接复用,不重复上传
|
|
556
|
+
// OCR 闸门与上传无依赖,先并发发起,省掉一次串行 RTT(2026-11-18 提速,结果不变)
|
|
557
|
+
if (!args.fileId && !args.resumeFile)
|
|
558
|
+
throw rsFail('缺少原件:请传 resumeFile(本地简历路径)或 fileId(已上传的简历附件 id)。解析固定走 OCR,不接受结构化 JSON 输入');
|
|
559
|
+
const gateP = checkExtractionGate(host);
|
|
560
|
+
gateP.catch(() => { });
|
|
738
561
|
let fileid = args.fileId ? String(args.fileId) : '';
|
|
739
562
|
let fileName = null;
|
|
740
|
-
if (!fileid
|
|
563
|
+
if (!fileid) {
|
|
741
564
|
const up = await uploadResume(host, baseUrl, path.resolve(String(args.resumeFile)), resumeFieldId, formId);
|
|
742
565
|
fileid = up.fileid;
|
|
743
566
|
fileName = up.name;
|
|
744
567
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
568
|
+
// 🔴 2026-11-18 起解析通道唯一:OCR。接口返回什么写什么,不做完整性校验、不回退文本输入。
|
|
569
|
+
await gateP;
|
|
570
|
+
// apply 复用 prepare 已确认的解析结果(同一份原件、同一 fileId),不再重复调 OCR:
|
|
571
|
+
// 既省 2.6~9.5 s,也保证「写入的就是用户刚确认过的数据」(避免二次解析抖动导致 fingerprint_mismatch)
|
|
572
|
+
const reuse = args.parsedResume && typeof args.parsedResume === 'object' ? args.parsedResume : null;
|
|
573
|
+
let structured;
|
|
574
|
+
if (reuse) {
|
|
575
|
+
mark('build.复用prepare解析结果');
|
|
576
|
+
structured = reuse;
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
// 批量路径:批量清单塞不下整份 JSON,解析结果在 prepare 时落盘,按 fileId 命中复用
|
|
580
|
+
const cached = loadOcrResult(fileid);
|
|
581
|
+
if (cached) {
|
|
582
|
+
mark('build.复用OCR缓存');
|
|
583
|
+
structured = cached;
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
structured = await extractResume(host, fileid);
|
|
750
587
|
}
|
|
751
|
-
structured = await extractResume(host, fileid);
|
|
752
588
|
}
|
|
589
|
+
saveOcrResult(fileid, structured);
|
|
753
590
|
// 学校归属标签推导(并入标签候选)
|
|
754
591
|
const schoolTagInfo = args.noSchoolTags ? { candidates: [], detail: [], schools: [] } : deriveSchoolTags(structured);
|
|
755
592
|
const tagNames = [...(args.tags || [])];
|
|
@@ -771,6 +608,7 @@ async function buildImport(ctx, args) {
|
|
|
771
608
|
continue;
|
|
772
609
|
tagNames.push(nm);
|
|
773
610
|
}
|
|
611
|
+
mark('build.ocr后-映射前');
|
|
774
612
|
// 字段映射 + 附件
|
|
775
613
|
const dataDetails = mapToTalent(fields, structured);
|
|
776
614
|
if (fileid) {
|
|
@@ -796,9 +634,16 @@ async function buildImport(ctx, args) {
|
|
|
796
634
|
dataDetails.push({ formField: { id: fields.channel }, dataOptions: [{ optionId: String(manualId), content: '手动录入' }] });
|
|
797
635
|
channelLabel = '手动录入(固定)';
|
|
798
636
|
}
|
|
637
|
+
mark('build.渠道映射完成');
|
|
638
|
+
// 下面三段都是只读、彼此无依赖:并发发起,避免 3 次 RTT 串行叠加(2026-11-18 提速,结果不变)
|
|
799
639
|
// 是否黑名单:固定「否」——写路径按缓存方案 A 走权威 ds/options(不读盘 field_options)
|
|
640
|
+
const blacklistP = fields.is_blacklist
|
|
641
|
+
? getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}))
|
|
642
|
+
: Promise.resolve({});
|
|
643
|
+
const subMetaP = resolveSubTableMeta(ctx).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e }));
|
|
644
|
+
const mappingP = getTableMapping(host, objId).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e }));
|
|
645
|
+
const opt = await blacklistP;
|
|
800
646
|
if (fields.is_blacklist) {
|
|
801
|
-
const opt = await getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}));
|
|
802
647
|
const noId = opt['否'];
|
|
803
648
|
if (noId)
|
|
804
649
|
dataDetails.push({ formField: { id: fields.is_blacklist }, dataOptions: [{ optionId: String(noId), content: '否' }] });
|
|
@@ -811,10 +656,15 @@ async function buildImport(ctx, args) {
|
|
|
811
656
|
const detailNodes = {};
|
|
812
657
|
const unmappedTables = [];
|
|
813
658
|
try {
|
|
814
|
-
|
|
659
|
+
const metaR = await subMetaP;
|
|
660
|
+
if (!metaR.ok)
|
|
661
|
+
throw metaR.e;
|
|
662
|
+
subMeta = metaR.v;
|
|
815
663
|
subBuild = buildSubDetails(structured, subMeta, cache);
|
|
816
|
-
const
|
|
817
|
-
|
|
664
|
+
const mapR = await mappingP;
|
|
665
|
+
if (!mapR.ok)
|
|
666
|
+
throw mapR.e;
|
|
667
|
+
const nodeOf = invertTableMapping(mapR.v);
|
|
818
668
|
for (const [dk, rows] of Object.entries(subBuild.byTable)) {
|
|
819
669
|
const sub = subMeta[dk];
|
|
820
670
|
const node = sub ? nodeOf[String(sub.subFormId)] : null;
|
|
@@ -830,8 +680,9 @@ async function buildImport(ctx, args) {
|
|
|
830
680
|
subError = e.message;
|
|
831
681
|
}
|
|
832
682
|
const subRowTotal = Object.values(subBuild.byTable).reduce((n, rows) => n + rows.length, 0);
|
|
683
|
+
mark('build.明细装配完成');
|
|
833
684
|
return {
|
|
834
|
-
objId, formId, fields, fileid, fileName, structured,
|
|
685
|
+
objId, formId, fields, fileid, fileName, structured,
|
|
835
686
|
dataDetails, detailsPayload, detailNodes, unmappedTables, subError, subBuild, subRowTotal,
|
|
836
687
|
subMeta, tagNames, schoolTagInfo, channelLabel, resumeFieldId,
|
|
837
688
|
};
|
|
@@ -906,32 +757,43 @@ function fingerprintMainTable(mainTable) {
|
|
|
906
757
|
return copy;
|
|
907
758
|
}
|
|
908
759
|
const baseInput = {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
fileId: { type: 'string', description: '已上传到 E10 的简历附件 id(原件写进附件字段)' },
|
|
912
|
-
resumeFile: { type: 'string', description: '本地简历文件路径(两步 multipart 上传)' },
|
|
760
|
+
fileId: { type: 'string', description: '已上传到 E10 的简历附件 id(原件写进附件字段;复跑/apply 复用此 id 可跳过二次上传)' },
|
|
761
|
+
resumeFile: { type: 'string', description: '本地简历文件路径(两步 multipart 上传后走 OCR 解析)' },
|
|
913
762
|
photoFile: { type: 'string', description: '可选:用户主动提供的头像图片本地路径。不自动从简历提取;没给或写失败都跳过,不影响建档' },
|
|
914
763
|
channel: { type: 'string', description: '简历渠道(须在数据字典中存在;缺省固定「手动录入」)' },
|
|
915
764
|
tags: { type: 'array', items: { type: 'string' }, maxItems: 20, description: '平台标签名(按名命中环境清单,不存在跳过;学校归属自动推导另算)' },
|
|
916
|
-
useOcr: { type: 'boolean', description: '显式开启 OCR 兜底解析(闸门=checkResumeExtraction;默认永不上调)' },
|
|
917
765
|
noSchoolTags: { type: 'boolean', description: '关闭学校归属标签自动推导' },
|
|
918
766
|
updateTalentId: { type: 'string', description: '按简历更新已有人才(主表全量覆盖+明细整表覆盖;先 prepare 看差异)' },
|
|
919
767
|
};
|
|
920
768
|
async function prepare(args, env, opts = {}) {
|
|
769
|
+
tracePrev = 0;
|
|
770
|
+
mark('prepare.进程内起点');
|
|
921
771
|
const host = env.host;
|
|
922
772
|
const session = await host.getSession();
|
|
923
773
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
|
|
924
774
|
ctx.appId = ctx.cache.appId;
|
|
775
|
+
mark('prepare.session+recruitContext');
|
|
776
|
+
// 旧通道显式拦死:结构化/文本直建已移除,静默忽略会让调用方误以为生效
|
|
777
|
+
const legacy = [
|
|
778
|
+
args.structured !== undefined ? 'structured' : '',
|
|
779
|
+
args.structuredFile !== undefined ? 'structuredFile' : '',
|
|
780
|
+
args.useOcr !== undefined ? 'useOcr' : '',
|
|
781
|
+
].filter(Boolean);
|
|
782
|
+
if (legacy.length) {
|
|
783
|
+
throw rsValidationError('legacy_channel_removed', '解析只走 OCR:已移除 ' + legacy.join('/') + ' 通道,请改为只传 resumeFile(本地原件)或 fileId(已上传原件);OCR 自动执行,无需开关');
|
|
784
|
+
}
|
|
925
785
|
if (!opts.skipPermissionProbe) {
|
|
926
786
|
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, 'talent_pool'));
|
|
927
787
|
if (perm === 'denied')
|
|
928
788
|
throw rsFail('当前账号没有「人才库」表单的创建权限,已阻断(未写入任何数据)');
|
|
929
789
|
}
|
|
790
|
+
mark('prepare.权限探测');
|
|
930
791
|
const argsT = args;
|
|
931
|
-
if (!argsT.
|
|
932
|
-
throw rsValidationError('input_required', '需要
|
|
792
|
+
if (!argsT.fileId && !argsT.resumeFile) {
|
|
793
|
+
throw rsValidationError('input_required', '需要 resumeFile(本地简历路径)或 fileId(已上传简历附件 id)之一;解析固定走 OCR,不再接受结构化 JSON');
|
|
933
794
|
}
|
|
934
795
|
const built = await buildImport(ctx, argsT);
|
|
796
|
+
mark('prepare.buildImport 完成');
|
|
935
797
|
// 更新模式:出差异摘要
|
|
936
798
|
if (argsT.updateTalentId) {
|
|
937
799
|
const updateTalentId = String(argsT.updateTalentId);
|
|
@@ -992,16 +854,14 @@ async function prepare(args, env, opts = {}) {
|
|
|
992
854
|
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
993
855
|
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
994
856
|
argsSnapshot: {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
fileId: args.fileId ? String(args.fileId) : undefined,
|
|
857
|
+
// 同新建路径:prepare 已上传的 fileid 必须回传,避免 apply 二次上传(并防孤儿附件)
|
|
858
|
+
fileId: (args.fileId ? String(args.fileId) : built.fileid) || undefined,
|
|
998
859
|
resumeFile: args.resumeFile ? String(args.resumeFile) : undefined,
|
|
999
860
|
photoFile: args.photoFile ? String(args.photoFile) : undefined,
|
|
861
|
+
parsedResume: snapshotParsedResume(built.structured),
|
|
1000
862
|
channel: args.channel ? String(args.channel) : undefined,
|
|
1001
863
|
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : undefined,
|
|
1002
|
-
useOcr: args.useOcr === true,
|
|
1003
864
|
noSchoolTags: args.noSchoolTags === true,
|
|
1004
|
-
structured: args.structured,
|
|
1005
865
|
tags: args.tags,
|
|
1006
866
|
} });
|
|
1007
867
|
return rsSuccess('recruit-stage.resume.import.prepare', {
|
|
@@ -1042,10 +902,12 @@ async function prepare(args, env, opts = {}) {
|
|
|
1042
902
|
return { requested: built.tagNames, error: e.message };
|
|
1043
903
|
}
|
|
1044
904
|
})();
|
|
905
|
+
mark('prepare.查重建档并行前');
|
|
1045
906
|
const [dupInfo, tagCheck] = await Promise.all([
|
|
1046
907
|
findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone }),
|
|
1047
908
|
tagCheckTask,
|
|
1048
909
|
]);
|
|
910
|
+
mark('prepare.查重+标签预检');
|
|
1049
911
|
const summary = {
|
|
1050
912
|
action: '简历导入建人才',
|
|
1051
913
|
resumeFile: built.fileName || ('fileid=' + built.fileid),
|
|
@@ -1065,7 +927,6 @@ async function prepare(args, env, opts = {}) {
|
|
|
1065
927
|
subTableNodes: built.detailNodes,
|
|
1066
928
|
subTableUnmapped: built.unmappedTables.length ? built.unmappedTables : undefined,
|
|
1067
929
|
subTableError: built.subError || undefined,
|
|
1068
|
-
structuredWarnings: built.structuredTextWarnings.length ? built.structuredTextWarnings : undefined,
|
|
1069
930
|
duplicate: {
|
|
1070
931
|
checked: dupInfo.checked,
|
|
1071
932
|
unique: dupInfo.unique,
|
|
@@ -1096,15 +957,16 @@ async function prepare(args, env, opts = {}) {
|
|
|
1096
957
|
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
1097
958
|
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
1098
959
|
argsSnapshot: {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
960
|
+
// 🔴 2026-11-18 修「apply 二次上传」:prepare 已上传拿到 fileid,快照必须带它。
|
|
961
|
+
// 此前只带用户显式传的 args.fileId(resumeFile 场景为 undefined)→ apply 重新上传同一份
|
|
962
|
+
// 原件,既多付 0.5~0.6 s/RTT,又在附件库留下孤儿文件(只有最后一份被绑定)。
|
|
963
|
+
fileId: (args.fileId ? String(args.fileId) : built.fileid) || undefined,
|
|
1102
964
|
resumeFile: args.resumeFile ? String(args.resumeFile) : undefined,
|
|
965
|
+
// OCR 解析结果随快照回传:apply 直接复用,不再重复调 resumeExtraction(单份省 2.6~9.5 s)
|
|
966
|
+
parsedResume: snapshotParsedResume(built.structured),
|
|
1103
967
|
channel: args.channel ? String(args.channel) : undefined,
|
|
1104
968
|
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : undefined,
|
|
1105
|
-
useOcr: args.useOcr === true,
|
|
1106
969
|
noSchoolTags: args.noSchoolTags === true,
|
|
1107
|
-
structured: args.structured,
|
|
1108
970
|
tags: args.tags,
|
|
1109
971
|
} });
|
|
1110
972
|
return rsSuccess('recruit-stage.resume.import.prepare', {
|
|
@@ -1144,13 +1006,17 @@ async function apply(args, env) {
|
|
|
1144
1006
|
}
|
|
1145
1007
|
/** 单份简历的落库执行体(供单条 apply 与批量 apply 复用;payload 由调用方校验)。 */
|
|
1146
1008
|
async function applyCore(args, env, payload) {
|
|
1009
|
+
tracePrev = 0;
|
|
1010
|
+
mark('apply.进程内起点');
|
|
1147
1011
|
restoreDsOptions(payload.enumMaps);
|
|
1148
1012
|
const host = env.host;
|
|
1149
1013
|
const session = await host.getSession();
|
|
1150
1014
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ''), appId: '', cache: await env.recruitContext() };
|
|
1151
1015
|
ctx.appId = ctx.cache.appId;
|
|
1016
|
+
mark('apply.context');
|
|
1152
1017
|
const argsT = args;
|
|
1153
1018
|
const built = await buildImport(ctx, argsT);
|
|
1019
|
+
mark('apply.buildImport 完成');
|
|
1154
1020
|
// 更新模式
|
|
1155
1021
|
if (argsT.updateTalentId) {
|
|
1156
1022
|
const updateTalentId = String(argsT.updateTalentId);
|
|
@@ -1233,6 +1099,7 @@ async function applyCore(args, env, payload) {
|
|
|
1233
1099
|
throw rsFail('手机号被 ' + dupInfo.formConflicts.unreadable.length + ' 条已删除记录占用(平台唯一性校验仍拦新建,id=' + dupInfo.formConflicts.unreadable.join(',') + '):请先在回收站清理,或改为更新已有人才');
|
|
1234
1100
|
}
|
|
1235
1101
|
// 建人才:① 首选数据集通道(主表+明细一次写入);② 被拦时回退页面级主表 + 数据集 update 补明细
|
|
1102
|
+
mark('apply.查重完成');
|
|
1236
1103
|
const datasetMain = toDatasetMainTable(built.dataDetails, built.fields);
|
|
1237
1104
|
let newId = '';
|
|
1238
1105
|
let writeChannel = '';
|
|
@@ -1256,7 +1123,9 @@ async function applyCore(args, env, payload) {
|
|
|
1256
1123
|
}
|
|
1257
1124
|
}
|
|
1258
1125
|
}
|
|
1126
|
+
mark('apply.saveFormData');
|
|
1259
1127
|
const r2 = await host.request({ path: '/api/recruit/candidate/initTalentBatch?formDataId=' + newId, method: 'POST' });
|
|
1128
|
+
mark('apply.initTalentBatch');
|
|
1260
1129
|
const talentId = String(newId);
|
|
1261
1130
|
// 可选头像:只在用户主动给图时写;失败不阻断,也不改变 result 判定
|
|
1262
1131
|
const avatarRes = await writeAvatarIfProvided(ctx, {
|
|
@@ -1276,6 +1145,7 @@ async function applyCore(args, env, payload) {
|
|
|
1276
1145
|
matchTalentLabel(host, talentId).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e })),
|
|
1277
1146
|
addEntityTags(host, talentId, built.tagNames).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e })),
|
|
1278
1147
|
]);
|
|
1148
|
+
mark('apply.四事并行');
|
|
1279
1149
|
const subTableVerify = verifyRes.ok ? verifyRes.v : { error: verifyRes.e?.message };
|
|
1280
1150
|
// 明细完整性判定:主表建成 ≠ 建档成功。实测(2026-11-05)出现过主表 19 字段写入成功、
|
|
1281
1151
|
// 18 行明细 0 行落库,而返回仍是 result=success —— 只看 writeWarnings 才会发现问题。
|
|
@@ -1298,6 +1168,7 @@ async function applyCore(args, env, payload) {
|
|
|
1298
1168
|
? tagRes.v
|
|
1299
1169
|
: { applied: [], skipped: built.tagNames, error: tagRes.e?.message };
|
|
1300
1170
|
// 标签回读依赖写入结果,放在并行组之后(写操作可验证优先)
|
|
1171
|
+
mark('apply.标签回读');
|
|
1301
1172
|
const tags = await queryEntityTags(host, talentId).catch(() => []);
|
|
1302
1173
|
// 第三层门禁:主表关键字段落库回查(明细行由 verifySubRows 单独校验)
|
|
1303
1174
|
// 🔴 回查白名单动态化(2026-11-11 修「age 假绿」):原白名单硬编码 3 个字段,
|
|
@@ -1337,13 +1208,15 @@ async function applyCore(args, env, payload) {
|
|
|
1337
1208
|
? '附件字段回查不一致:期望非空,实际 ' + attachMismatch.actual
|
|
1338
1209
|
: (built.fileid
|
|
1339
1210
|
? (attachFieldChecked ? '附件字段已回查确认非空' : '原件已上传(fileId 见上),但环境缓存无 original_resume 字段定义,未纳入回查')
|
|
1340
|
-
: '
|
|
1211
|
+
: '原件以 fileId 复用(本机未重新上传)'),
|
|
1341
1212
|
};
|
|
1342
1213
|
if (attachMismatch) {
|
|
1343
1214
|
writeWarnings.push('简历附件未绑定到人才记录(original_resume 回查为空):原件已上传但未写入附件字段,请在人才卡片页手工补挂,或走 updateTalentId 重传');
|
|
1344
1215
|
}
|
|
1345
1216
|
const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
|
|
1217
|
+
mark('apply.回查完成');
|
|
1346
1218
|
const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
1219
|
+
mark('apply.卡片/列表链接');
|
|
1347
1220
|
const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
|
|
1348
1221
|
return rsSuccess('recruit-stage.resume.import.apply', {
|
|
1349
1222
|
mode: 'apply', result,
|
|
@@ -1385,19 +1258,59 @@ async function applyCore(args, env, payload) {
|
|
|
1385
1258
|
});
|
|
1386
1259
|
}
|
|
1387
1260
|
// ── 批量简历导入(2026-11-06)────────────────────────────────────────────────
|
|
1388
|
-
// 输入可以是「一个文件夹」或「一个 zip 包」,也可以直接给 items
|
|
1389
|
-
// 逐份走与单条完全相同的 prepare → apply(上传原件 / 查重 / 明细写入 / 标签 / 回查),
|
|
1390
|
-
//
|
|
1261
|
+
// 输入可以是「一个文件夹」或「一个 zip 包」,也可以直接给 items(每项只给一份简历文件)。
|
|
1262
|
+
// 逐份走与单条完全相同的 prepare → apply(上传原件 / OCR 解析 / 查重 / 明细写入 / 标签 / 回查),
|
|
1263
|
+
// 最后汇总成一张结果表。解析口径与单条一致:固定 OCR,无文本/结构化输入通道。
|
|
1391
1264
|
const IMPORT_BATCH_MAX = 50;
|
|
1265
|
+
/**
|
|
1266
|
+
* 受限并发执行(保序返回):批量导入原为逐份串行 await,50 份时 prepare(上传+OCR 3~12 s/份)
|
|
1267
|
+
* 与 apply(落库 ~3.2 s/份)线性叠加。这里改成"固定窗口并发",**结果数组仍按原索引顺序**,
|
|
1268
|
+
* 因此汇总表、计数、`ready` 顺序与串行版完全一致。
|
|
1269
|
+
*
|
|
1270
|
+
* 失败不外抛:调用方每项自带 try/catch,这里只负责调度(与串行版异常语义相同)。
|
|
1271
|
+
*/
|
|
1272
|
+
async function mapLimit(list, limit, fn) {
|
|
1273
|
+
const results = new Array(list.length);
|
|
1274
|
+
const width = Math.max(1, Math.min(limit, list.length));
|
|
1275
|
+
let cursor = 0;
|
|
1276
|
+
await Promise.all(Array.from({ length: width }, async () => {
|
|
1277
|
+
while (true) {
|
|
1278
|
+
const index = cursor++;
|
|
1279
|
+
if (index >= list.length)
|
|
1280
|
+
return;
|
|
1281
|
+
results[index] = await fn(list[index], index);
|
|
1282
|
+
}
|
|
1283
|
+
}));
|
|
1284
|
+
return results;
|
|
1285
|
+
}
|
|
1286
|
+
/** 并发度:环境变量覆盖,默认 prepare 5 / apply 2(写库侧保守,可按 E10_BATCH_APPLY_CONCURRENCY 调) */
|
|
1287
|
+
function batchConcurrency(stage) {
|
|
1288
|
+
const raw = stage === 'prepare'
|
|
1289
|
+
? (process.env.E10_BATCH_PREPARE_CONCURRENCY ?? '5')
|
|
1290
|
+
: (process.env.E10_BATCH_APPLY_CONCURRENCY ?? '2');
|
|
1291
|
+
const n = Number(raw);
|
|
1292
|
+
return Number.isFinite(n) && n >= 1 ? Math.min(5, Math.floor(n)) : (stage === 'prepare' ? 5 : 2);
|
|
1293
|
+
}
|
|
1392
1294
|
async function batchPrepare(args, env) {
|
|
1295
|
+
// 旧通道显式拦死(同 prepare):批量也绝不吃 items[].structured / structuredFile / structuredDir / useOcr
|
|
1296
|
+
const legacyBatch = [
|
|
1297
|
+
args.structuredDir !== undefined ? 'structuredDir' : '',
|
|
1298
|
+
args.useOcr !== undefined ? 'useOcr' : '',
|
|
1299
|
+
...((Array.isArray(args.items) ? args.items : [])
|
|
1300
|
+
.map((x, i) => (x && (x.structured !== undefined || x.structuredFile !== undefined)
|
|
1301
|
+
? `items[${i}].${x.structured !== undefined ? 'structured' : 'structuredFile'}` : ''))
|
|
1302
|
+
.filter(Boolean)),
|
|
1303
|
+
].filter(Boolean);
|
|
1304
|
+
if (legacyBatch.length) {
|
|
1305
|
+
throw rsValidationError('legacy_channel_removed', '批量解析同样只走 OCR:已移除 ' + legacyBatch.join('/') + ',请改为 items:[{file}] 或 source(文件夹/.zip),每项必须是简历原件');
|
|
1306
|
+
}
|
|
1393
1307
|
const explicit = Array.isArray(args.items) ? args.items : null;
|
|
1394
1308
|
const scan = !explicit && args.source ? scanResumeSource(String(args.source)) : null;
|
|
1395
1309
|
if (!explicit && !scan) {
|
|
1396
|
-
throw rsValidationError('source_required', '需要 source(文件夹或 .zip 路径)或 items([{file,
|
|
1310
|
+
throw rsValidationError('source_required', '需要 source(文件夹或 .zip 路径)或 items([{file, photoFile?}])之一');
|
|
1397
1311
|
}
|
|
1398
|
-
const structuredDir = args.structuredDir ? String(args.structuredDir) : undefined;
|
|
1399
1312
|
const shared = {};
|
|
1400
|
-
for (const k of ['channel', '
|
|
1313
|
+
for (const k of ['channel', 'noSchoolTags'])
|
|
1401
1314
|
if (args[k] !== undefined)
|
|
1402
1315
|
shared[k] = args[k];
|
|
1403
1316
|
if (Array.isArray(args.tags))
|
|
@@ -1407,11 +1320,10 @@ async function batchPrepare(args, env) {
|
|
|
1407
1320
|
const file = x?.file ? path.resolve(String(x.file)) : '';
|
|
1408
1321
|
return {
|
|
1409
1322
|
file, name: file ? path.basename(file) : `第${i + 1}项`,
|
|
1410
|
-
structured: x?.structured, structuredFile: x?.structuredFile,
|
|
1411
1323
|
photoFile: x?.photoFile ? path.resolve(String(x.photoFile)) : undefined,
|
|
1412
1324
|
};
|
|
1413
1325
|
}
|
|
1414
|
-
return { file: x.path, name: x.name
|
|
1326
|
+
return { file: x.path, name: x.name };
|
|
1415
1327
|
});
|
|
1416
1328
|
if (entries.length > IMPORT_BATCH_MAX) {
|
|
1417
1329
|
throw rsValidationError('batch_too_many', `一次最多 ${IMPORT_BATCH_MAX} 份(当前 ${entries.length} 份);请分批执行`);
|
|
@@ -1419,73 +1331,71 @@ async function batchPrepare(args, env) {
|
|
|
1419
1331
|
if (!entries.length) {
|
|
1420
1332
|
throw rsValidationError('no_resume_files', '没有找到简历文件(支持 pdf/doc/docx/rtf/txt/wps;目录最多向下 4 层)');
|
|
1421
1333
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1334
|
+
// 🔴 2026-11-18 提速:逐份 prepare 由串行改受限并发(默认 3)。
|
|
1335
|
+
// 语义保持:① 每项仍独立 try/catch,失败只落该项;② 结果按原索引保序组装,items/ready 顺序不变;
|
|
1336
|
+
// ③ 权限探测仍只在第 1 项做(i>0 跳过),避免 N 次重复探测。
|
|
1337
|
+
const prepared = await mapLimit(entries, batchConcurrency('prepare'), async (e, i) => {
|
|
1426
1338
|
const row = { index: i + 1, file: e.name, path: e.file || undefined };
|
|
1427
1339
|
try {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
if (hit)
|
|
1433
|
-
structuredFile = hit;
|
|
1434
|
-
}
|
|
1435
|
-
if (!structured && !structuredFile && !shared.useOcr) {
|
|
1436
|
-
row.status = 'needs_parse';
|
|
1437
|
-
row.message = '缺少结构化数据:请由大模型解析后以 items[].structured(或同名 .json)提供;扫描件可显式 useOcr:true';
|
|
1438
|
-
items.push(row);
|
|
1439
|
-
continue;
|
|
1340
|
+
if (!e.file) {
|
|
1341
|
+
row.status = 'failed';
|
|
1342
|
+
row.message = '该项没有简历文件路径(items[] 每项必须有 file)';
|
|
1343
|
+
return { row };
|
|
1440
1344
|
}
|
|
1441
|
-
const r = await prepare({ ...shared, resumeFile: e.file
|
|
1345
|
+
const r = await prepare({ ...shared, resumeFile: e.file, photoFile: e.photoFile }, env, { skipPermissionProbe: i > 0 });
|
|
1442
1346
|
const d = r.data || {};
|
|
1443
1347
|
const meta = r.meta || {};
|
|
1444
1348
|
const dup = d.duplicate || {};
|
|
1445
1349
|
const blocked = dup.unique === false;
|
|
1446
1350
|
row.name = d.parsed?.name;
|
|
1447
1351
|
row.mobile = d.parsed?.mobile;
|
|
1448
|
-
row.hasStructured = !!(structured || structuredFile);
|
|
1449
1352
|
row.duplicateNote = dup.note;
|
|
1450
1353
|
if (blocked) {
|
|
1451
1354
|
row.status = 'blocked';
|
|
1452
1355
|
row.message = '查重未通过:' + (dup.note || '已存在同手机号人才');
|
|
1453
|
-
|
|
1454
|
-
continue;
|
|
1356
|
+
return { row };
|
|
1455
1357
|
}
|
|
1456
1358
|
row.status = 'ready';
|
|
1457
|
-
|
|
1458
|
-
|
|
1359
|
+
return {
|
|
1360
|
+
row,
|
|
1361
|
+
readyItem: {
|
|
1362
|
+
index: i + 1, label: row.name || e.name, file: e.file,
|
|
1363
|
+
// 手机号带上(apply 侧同号串行的键;prepare 已解析出,缺失则按索引各自独立)
|
|
1364
|
+
mobile: row.mobile || '',
|
|
1365
|
+
args: { ...shared, resumeFile: e.file, fileId: d.resumeFileId, photoFile: e.photoFile },
|
|
1366
|
+
fingerprint: String(meta.fingerprint || ''),
|
|
1367
|
+
},
|
|
1368
|
+
};
|
|
1459
1369
|
}
|
|
1460
1370
|
catch (err) {
|
|
1461
1371
|
row.status = 'failed';
|
|
1462
1372
|
row.message = err?.message || 'prepare 失败';
|
|
1463
|
-
|
|
1373
|
+
return { row };
|
|
1464
1374
|
}
|
|
1465
|
-
}
|
|
1375
|
+
});
|
|
1376
|
+
const items = prepared.map((x) => x.row);
|
|
1377
|
+
const ready = prepared.filter((x) => x.readyItem).map((x) => x.readyItem);
|
|
1466
1378
|
if (!ready.length) {
|
|
1467
1379
|
return rsSuccess('recruit-stage.resume.import.batch.prepare', {
|
|
1468
1380
|
mode: 'batch-prepare',
|
|
1469
1381
|
total: items.length, ready: 0,
|
|
1470
1382
|
blocked: items.filter((x) => x.status === 'blocked').length,
|
|
1471
|
-
needsParse: items.filter((x) => x.status === 'needs_parse').length,
|
|
1472
1383
|
failed: items.filter((x) => x.status === 'failed').length,
|
|
1473
1384
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : undefined,
|
|
1474
1385
|
items,
|
|
1475
|
-
hint: '没有可执行项,逐条看 items[].message
|
|
1386
|
+
hint: '没有可执行项,逐条看 items[].message(常见:查重命中、格式不支持、环境未开启简历抽取)',
|
|
1476
1387
|
// 🔴 2026-11-07:本 op 此前无 preview。文件清单可能很大,preview 只保留「文件 + 状态 + 原因」。
|
|
1477
1388
|
preview: {
|
|
1478
1389
|
action: '批量简历导入 — 无可执行项',
|
|
1479
1390
|
total: items.length,
|
|
1480
1391
|
blocked: items.filter((x) => x.status === 'blocked').length,
|
|
1481
|
-
needsParse: items.filter((x) => x.status === 'needs_parse').length,
|
|
1482
1392
|
failed: items.filter((x) => x.status === 'failed').length,
|
|
1483
1393
|
reasons: items.map((x) => `${x.file}:${x.message || x.status}`),
|
|
1484
1394
|
},
|
|
1485
1395
|
});
|
|
1486
1396
|
}
|
|
1487
1397
|
const fp = createHash('sha256').update(JSON.stringify(ready.map((x) => [x.file, x.fingerprint]))).digest('hex');
|
|
1488
|
-
// 清单可能很大(每项带
|
|
1398
|
+
// 清单可能很大(每项带 fileId/指纹),落盘暂存;token 只带路径与内容指纹
|
|
1489
1399
|
const store = saveBatchItems('resume-import', ready);
|
|
1490
1400
|
const continuation = await env.continuation.issue({
|
|
1491
1401
|
operation: 'recruit-stage.resume.import.batch.apply',
|
|
@@ -1495,25 +1405,22 @@ async function batchPrepare(args, env) {
|
|
|
1495
1405
|
batchFingerprint: store.fingerprint,
|
|
1496
1406
|
// 准备阶段已被查重拦截的份数:apply 汇总里要如实报「跳过」,不能只报成功/失败
|
|
1497
1407
|
blockedAtPrepare: items.filter((x) => x.status === 'blocked').length,
|
|
1498
|
-
needsParseAtPrepare: items.filter((x) => x.status === 'needs_parse').length,
|
|
1499
1408
|
});
|
|
1500
1409
|
return rsSuccess('recruit-stage.resume.import.batch.prepare', {
|
|
1501
1410
|
mode: 'batch-prepare',
|
|
1502
1411
|
total: items.length,
|
|
1503
1412
|
ready: ready.length,
|
|
1504
1413
|
blocked: items.filter((x) => x.status === 'blocked').length,
|
|
1505
|
-
needsParse: items.filter((x) => x.status === 'needs_parse').length,
|
|
1506
1414
|
failed: items.filter((x) => x.status === 'failed').length,
|
|
1507
1415
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : undefined,
|
|
1508
1416
|
items,
|
|
1509
1417
|
note: '确认后带 confirm:true 与 meta.continuation 调 batch.apply;逐份建档,可能是 partial',
|
|
1510
|
-
// 🔴 2026-11-07:本 op 此前无 preview。preview 只列「文件 +
|
|
1418
|
+
// 🔴 2026-11-07:本 op 此前无 preview。preview 只列「文件 + 状态」。
|
|
1511
1419
|
preview: {
|
|
1512
1420
|
action: '批量简历导入(逐份建档,结果可能 partial)',
|
|
1513
1421
|
total: items.length,
|
|
1514
1422
|
ready: ready.length,
|
|
1515
1423
|
blocked: items.filter((x) => x.status === 'blocked').length,
|
|
1516
|
-
needsParse: items.filter((x) => x.status === 'needs_parse').length,
|
|
1517
1424
|
failed: items.filter((x) => x.status === 'failed').length,
|
|
1518
1425
|
files: items.map((x) => `${x.file} — ${x.status}${x.message ? ':' + x.message : ''}`),
|
|
1519
1426
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : undefined,
|
|
@@ -1534,26 +1441,39 @@ async function batchApply(args, env) {
|
|
|
1534
1441
|
const items = loadBatchItems(batch.batchFile, batch.batchFingerprint);
|
|
1535
1442
|
if (!items.length)
|
|
1536
1443
|
throw rsValidationError('batch_empty', 'continuation 中没有可执行的简历');
|
|
1537
|
-
|
|
1538
|
-
|
|
1444
|
+
// 🔴 2026-11-18 提速:逐份 apply 由串行改受限并发(默认 2)。
|
|
1445
|
+
// 语义保持的关键:**同手机号必须串行**。串行版第二个同号会被服务端判 duplicate → skipped;
|
|
1446
|
+
// 若并发发起,可能双双通过查重各建一条(写脏数据)。这里按手机号做"同键串行链",
|
|
1447
|
+
// 不同手机号之间才并行;结果仍按原索引保序回填,汇总/计数口径不变。
|
|
1448
|
+
const results = new Array(items.length);
|
|
1449
|
+
const phoneTail = new Map();
|
|
1450
|
+
await mapLimit(items, batchConcurrency('apply'), async (it, i) => {
|
|
1451
|
+
const key = String(it?.mobile ?? it?.args?.mobile ?? it?.args?.telephone ?? '') || `#${it?.index ?? i}`;
|
|
1452
|
+
const prev = phoneTail.get(key) ?? Promise.resolve();
|
|
1453
|
+
const lock = { release: null };
|
|
1454
|
+
phoneTail.set(key, prev.then(() => new Promise((r) => { lock.release = r; })));
|
|
1455
|
+
await prev;
|
|
1539
1456
|
try {
|
|
1540
1457
|
const r = await applyCore({ ...(it.args || {}), confirm: true }, env, { fingerprint: it.fingerprint, enumMaps: batch.enumMaps });
|
|
1541
1458
|
const d = r.data || {};
|
|
1542
1459
|
// 2026-11-12:prepare 到 apply 之间可能有人被建(或并发),applyCore 会返回 duplicate。
|
|
1543
1460
|
// 重复人才**不新建**,状态必须记 skipped,不能混进 success 谎报「已建档」。
|
|
1544
1461
|
const isDup = d.result === 'duplicate';
|
|
1545
|
-
results
|
|
1462
|
+
results[i] = {
|
|
1546
1463
|
index: it.index, file: path.basename(String(it.file || '')), name: it.label,
|
|
1547
1464
|
status: isDup ? 'skipped' : (d.result === 'partial' ? 'partial' : 'success'),
|
|
1548
1465
|
talentId: d.talentId, cardUrl: d.talentCardUrl, viewLink: d.viewLink,
|
|
1549
1466
|
message: isDup ? (d.message || '手机号已存在,已跳过(未写入)') : undefined,
|
|
1550
1467
|
warnings: d.verifyWarnings && d.verifyWarnings.length ? d.verifyWarnings : undefined,
|
|
1551
|
-
}
|
|
1468
|
+
};
|
|
1552
1469
|
}
|
|
1553
1470
|
catch (e) {
|
|
1554
|
-
results
|
|
1471
|
+
results[i] = { index: it.index, file: path.basename(String(it.file || '')), name: it.label, status: 'failed', message: e?.message || '执行失败' };
|
|
1555
1472
|
}
|
|
1556
|
-
|
|
1473
|
+
finally {
|
|
1474
|
+
lock.release?.();
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1557
1477
|
const ok = results.filter((x) => x.status === 'success').length;
|
|
1558
1478
|
const partial = results.filter((x) => x.status === 'partial').length;
|
|
1559
1479
|
const failed = results.filter((x) => x.status === 'failed').length;
|
|
@@ -1609,17 +1529,15 @@ export const resumeImportOperations = [
|
|
|
1609
1529
|
resource: 'recruit.resume',
|
|
1610
1530
|
method: 'prepare',
|
|
1611
1531
|
action: 'resume.import.batch.prepare',
|
|
1612
|
-
summary: '批量简历导入确认摘要:扫描文件夹或 zip
|
|
1532
|
+
summary: '批量简历导入确认摘要:扫描文件夹或 zip、逐份上传/OCR 解析/查重/字段映射,输出可执行/查重拦截/失败清单(不建档);一次最多 50 份',
|
|
1613
1533
|
capability: 'recruit.resume.import',
|
|
1614
1534
|
risk: 'write',
|
|
1615
1535
|
requiresConfirmation: true,
|
|
1616
1536
|
inputSchema: schemaOf({
|
|
1617
1537
|
source: { type: 'string', description: '简历文件夹或 .zip 包路径(与 items 二选一)' },
|
|
1618
|
-
items: { type: 'array', description: '显式清单 [{file,
|
|
1619
|
-
structuredDir: { type: 'string', description: '结构化 JSON 目录(按同名 .json 自动匹配,可选)' },
|
|
1538
|
+
items: { type: 'array', description: '显式清单 [{file, photoFile?}],与 source 二选一;每项必须是简历原件路径(解析固定走 OCR)', items: { type: 'object' } },
|
|
1620
1539
|
tags: { type: 'array', description: '统一追加的标签名', items: { type: 'string' } },
|
|
1621
1540
|
channel: { type: 'string', description: '渠道(可选)' },
|
|
1622
|
-
useOcr: { type: 'boolean', description: '显式开启 OCR 兜底解析(闸门=checkResumeExtraction)' },
|
|
1623
1541
|
noSchoolTags: { type: 'boolean', description: '不自动推导学校归属标签' },
|
|
1624
1542
|
}, {}),
|
|
1625
1543
|
handler: batchPrepare,
|