weaver-work-cli 0.1.71 → 0.1.75
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 +37 -1
- package/dist/chunks/{archive-5P33NAUN.js → archive-OZJ6PYUR.js} +14 -9
- package/dist/chunks/{archive-oa-YTY5D7DG.js → archive-oa-BHL5RK2F.js} +10 -7
- package/dist/chunks/{asset-3Q5MFQBX.js → asset-HKRFRQR2.js} +10 -7
- package/dist/chunks/{asset-idle-PQPNYIS7.js → asset-idle-GGIR4KE7.js} +7 -4
- package/dist/chunks/{attachment-content-7CN7JB6B.js → attachment-content-4OV65NK5.js} +3 -3
- package/dist/chunks/{blog-MFHHK6ZR.js → blog-HYDP4DV3.js} +10 -7
- package/dist/chunks/{caizhilian-OZ435AYW.js → caizhilian-JS4RQZ6Z.js} +10 -7
- package/dist/chunks/{calendar-TNJXS5UC.js → calendar-SWRY4DIT.js} +10 -7
- package/dist/chunks/chunk-257JXJGD.js +30 -0
- package/dist/chunks/{chunk-FRMDHZSN.js → chunk-2AUFKU2D.js} +11 -11
- package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
- package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
- package/dist/chunks/{chunk-X2C5CGGM.js → chunk-4FCBEWNB.js} +74 -68
- package/dist/chunks/{chunk-YN5SD4TX.js → chunk-5D2V7ZAN.js} +2 -2
- package/dist/chunks/{chunk-UPVAQJKS.js → chunk-5QUTQHXF.js} +282 -158
- package/dist/chunks/{chunk-SKWKCLJX.js → chunk-5ZJGPEIB.js} +2 -2
- package/dist/chunks/chunk-7DE3VMZD.js +35 -0
- package/dist/chunks/chunk-BNKUHN4N.js +1346 -0
- package/dist/chunks/{chunk-VMVMEIL3.js → chunk-BSR5TM7U.js} +4 -4
- package/dist/chunks/{chunk-EJLP63UO.js → chunk-ERZY6GYL.js} +7 -3
- package/dist/chunks/{chunk-OFCF23FY.js → chunk-FEZK536Z.js} +25 -9
- package/dist/chunks/{chunk-Q3EXRNB4.js → chunk-I6NOHKEK.js} +1 -1
- package/dist/chunks/{chunk-OZ7CJC7W.js → chunk-J7FAAHWH.js} +2 -2
- package/dist/chunks/{chunk-6MMSLE6K.js → chunk-JJONWB5N.js} +16 -2
- package/dist/chunks/chunk-JOY3HZXL.js +467 -0
- package/dist/chunks/{chunk-2DNCKZRX.js → chunk-JWF2R6EQ.js} +0 -462
- package/dist/chunks/{chunk-ICNUOWLL.js → chunk-KEA4XQPO.js} +4 -4
- package/dist/chunks/chunk-KINXYJXM.js +205 -0
- package/dist/chunks/{chunk-VJWVB55R.js → chunk-KWJEICD4.js} +2 -2
- package/dist/chunks/{chunk-P3AFNAJ6.js → chunk-LJI4N6FV.js} +1 -1
- package/dist/chunks/{chunk-DRJYPXKC.js → chunk-MXCRKXOP.js} +48 -6
- package/dist/chunks/{chunk-OPTJ6IF7.js → chunk-NWYHCZTY.js} +1 -1
- package/dist/chunks/chunk-OJ4JPD25.js +428 -0
- package/dist/chunks/{chunk-B4NINGP2.js → chunk-OQCK5SAU.js} +2 -2
- package/dist/chunks/chunk-PG5YSNYY.js +1166 -0
- package/dist/chunks/{chunk-LU2SPJYY.js → chunk-QJWVYOOV.js} +2 -2
- package/dist/chunks/{chunk-SUWR5QEG.js → chunk-QVKRNL7L.js} +287 -305
- package/dist/chunks/chunk-SU6IJD6D.js +49 -0
- package/dist/chunks/{chunk-MD5RXRI3.js → chunk-TA2RBUTH.js} +2 -2
- package/dist/chunks/{chunk-SSS75WXW.js → chunk-U6Y32KEV.js} +2 -2
- package/dist/chunks/chunk-UUJK76HV.js +209 -0
- package/dist/chunks/{chunk-GB2MCJPG.js → chunk-VOMDD2C5.js} +1 -1
- package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
- package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
- package/dist/chunks/{chunk-G7ZM2VOX.js → chunk-ZUB4M4N3.js} +38 -36
- package/dist/chunks/{chunk-XLSJC6JZ.js → chunk-ZWIMLT6P.js} +8 -7
- package/dist/chunks/cli-FULPXIKJ.js +226 -0
- package/dist/chunks/commands-BNWFNTD3.js +70 -0
- package/dist/chunks/{conflict-Y4PXZ2YQ.js → conflict-5BKCDV2F.js} +2 -2
- package/dist/chunks/{contract-C3BGUMBM.js → contract-WI23OXVC.js} +12446 -5964
- package/dist/chunks/{cowork-2AWG4QLA.js → cowork-DZBBVNMQ.js} +11 -8
- package/dist/chunks/{create-flow-LOUOK46Z.js → create-flow-7ZRBRKX7.js} +6 -6
- package/dist/chunks/{data-BSFYMXVO.js → data-PAZVE6QE.js} +6 -3
- package/dist/chunks/{ebuilder-form-LAAMTD2Y.js → ebuilder-form-5SQXIGXN.js} +9 -6
- package/dist/chunks/{ehr-36KEX5SH.js → ehr-CX5F4ZAU.js} +27 -19
- package/dist/chunks/{entry-mode-6N2IGCS4.js → entry-mode-I2BYNONZ.js} +3 -3
- package/dist/chunks/{env-QYLS3EB3.js → env-ZAQZ7EHN.js} +2 -2
- package/dist/chunks/{esb-PTYS3E67.js → esb-DQTXDIBF.js} +10 -7
- package/dist/chunks/{factory-LPFPKZ4T.js → factory-XRI6KZ7H.js} +1 -1
- package/dist/chunks/{fna-JNHCLRDE.js → fna-FK6HQVJL.js} +13 -8
- package/dist/chunks/{group-chat-QP2WX4QJ.js → group-chat-MLWNYM2P.js} +3 -3
- package/dist/chunks/{host-C2BLBIID.js → host-3EPREGXS.js} +6 -3
- package/dist/chunks/{host-QXFKQXNX.js → host-J74JGYAW.js} +6 -3
- package/dist/chunks/{host-57LSRSE7.js → host-KUMU3DDK.js} +6 -3
- package/dist/chunks/{host-7BVR7CQ3.js → host-MEC4VQZA.js} +6 -3
- package/dist/chunks/{host-NS36QFLR.js → host-T6NNQGVZ.js} +6 -3
- package/dist/chunks/{host-K2ZKNXME.js → host-VI7Q45PM.js} +6 -3
- package/dist/chunks/{hrm-FSGO4NSH.js → hrm-KKVAW4P5.js} +8 -5
- package/dist/chunks/{im-2BFGS2XO.js → im-47CIWQNL.js} +7 -4
- package/dist/chunks/{invoice-JKLTTHSZ.js → invoice-CDYRBNIG.js} +21 -16
- package/dist/chunks/{jiuchuanhui-PTABJE7V.js → jiuchuanhui-M7QTRHZK.js} +17 -10
- package/dist/chunks/{lazy-dispatch-YN2ZP3CS.js → lazy-dispatch-FKQJZFI5.js} +22 -8
- package/dist/chunks/{mail-YNO7ZZUK.js → mail-NRBS5N6Y.js} +11 -8
- package/dist/chunks/{meeting-NIDHDBCB.js → meeting-WC5LD3IO.js} +22 -18
- package/dist/chunks/{minute-doc-G3QAT7DE.js → minute-doc-OQUMDTKG.js} +4 -4
- package/dist/chunks/{okr-QC52G6AJ.js → okr-EHKSKMPL.js} +10 -7
- package/dist/chunks/{operations-MQV32ITT.js → operations-V5VM5MS2.js} +7 -4
- package/dist/chunks/{performance-3MQ3AHDQ.js → performance-ZJADXJPN.js} +6 -3
- package/dist/chunks/{plan-ISINIEPY.js → plan-OTDNBDJ7.js} +10 -7
- package/dist/chunks/{project-IJ6DVKT7.js → project-4XVBQ3HX.js} +10 -7
- package/dist/chunks/{reception-3H5LUG2I.js → reception-3FAHOOH7.js} +118 -45
- package/dist/chunks/{recruit-stage-MIOJXP6W.js → recruit-stage-3WTVWW2K.js} +1056 -191
- package/dist/chunks/register-SQOPIR2G.js +16 -0
- package/dist/chunks/{registry-3S7AVMXR.js → registry-F4YFZLOD.js} +7 -3
- package/dist/chunks/registry-NBTBXR4L.js +30 -0
- package/dist/chunks/{registry-NHHKOEU3.js → registry-TJGCVRCW.js} +7 -4
- package/dist/chunks/{room-recommend-IOKBJVYP.js → room-recommend-KL62XB2Y.js} +4 -4
- package/dist/chunks/root-YZG2TS5W.js +16 -0
- package/dist/chunks/{schedule-IB6EUARH.js → schedule-XOISYUPB.js} +4 -4
- package/dist/chunks/{smart-extract-N2TK3CEF.js → smart-extract-UYGNV3BM.js} +15 -7
- package/dist/chunks/update-AV5VOXGY.js +13 -0
- package/dist/chunks/{workflow-RINBAL2M.js → workflow-V54LJPXL.js} +15 -10
- package/dist/cli.js +40 -0
- package/dist/cmd/action.js +3 -1
- package/dist/cmd/doctor/index.js +1 -1
- package/dist/cmd/e10/index.js +1 -1
- package/dist/cmd/identity/index.js +5 -8
- package/dist/cmd/index.js +2 -0
- package/dist/cmd/setup/index.js +1 -1
- package/dist/cmd/update/index.js +38 -0
- package/dist/core/manifest-view.js +1 -1
- package/dist/core/output.js +12 -1
- package/dist/core/runtime-agent.js +13 -0
- package/dist/core/update-notice.js +23 -0
- package/dist/index.js +105 -198
- package/dist/internal/e10/auth/agent-host-key.js +16 -0
- package/dist/internal/e10/auth/agent-hosts.js +45 -9
- package/dist/internal/e10/auth/commands.js +66 -36
- package/dist/internal/e10/auth/session.js +30 -15
- package/dist/internal/e10/auth/xiaoe.js +4 -20
- package/dist/internal/e10/auth-recovery.js +44 -4
- package/dist/internal/e10/context.js +5 -2
- package/dist/internal/update/bootstrap.js +96 -0
- package/dist/internal/update/npm.js +78 -0
- package/dist/internal/update/service.js +252 -0
- package/dist/internal/update/store.js +135 -0
- package/dist/shortcuts/archive/index.js +2 -2
- package/dist/shortcuts/archive/manifest.js +1 -0
- package/dist/shortcuts/archive/operations/search.js +3 -1
- package/dist/shortcuts/archive-oa/index.js +1 -1
- package/dist/shortcuts/asset/index.js +1 -1
- package/dist/shortcuts/asset-idle/index.js +1 -1
- package/dist/shortcuts/blog/index.js +1 -1
- package/dist/shortcuts/caizhilian/index.js +1 -1
- package/dist/shortcuts/calendar/index.js +1 -1
- package/dist/shortcuts/contract/data/bi-config.js +156 -0
- package/dist/shortcuts/contract/data/collection-ledger-html.js +189 -0
- package/dist/shortcuts/contract/data/collection-node-catalog.js +226 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +154 -20
- package/dist/shortcuts/contract/data/report-renderers.js +414 -0
- package/dist/shortcuts/contract/data/report-spec.js +132 -0
- package/dist/shortcuts/contract/error-actions.js +114 -0
- package/dist/shortcuts/contract/host.js +12 -3
- package/dist/shortcuts/contract/index.js +17 -1
- package/dist/shortcuts/contract/manifest.js +398 -3
- package/dist/shortcuts/contract/ooxml/docx-table.js +48 -0
- package/dist/shortcuts/contract/operations/bi-preview.js +131 -0
- package/dist/shortcuts/contract/operations/bizreview-report.js +496 -0
- package/dist/shortcuts/contract/operations/collection-node.js +229 -0
- package/dist/shortcuts/contract/operations/docx-slots.js +735 -16
- package/dist/shortcuts/contract/operations/draft-build.js +940 -0
- package/dist/shortcuts/contract/operations/draft-submit.js +229 -0
- package/dist/shortcuts/contract/operations/first-screen.js +3 -2
- package/dist/shortcuts/contract/operations/generated-submit.js +175 -0
- package/dist/shortcuts/contract/operations/ledger-report.js +233 -0
- package/dist/shortcuts/contract/operations/ledger-stat.js +1400 -0
- package/dist/shortcuts/contract/operations/ledger.js +4 -1
- package/dist/shortcuts/contract/operations/metrics.js +9 -3
- package/dist/shortcuts/contract/operations/ops-draft.js +527 -0
- package/dist/shortcuts/contract/operations/page.js +9 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +55 -229
- package/dist/shortcuts/contract/operations/registry.js +20 -0
- package/dist/shortcuts/contract/operations/sign-launch.js +256 -0
- package/dist/shortcuts/contract/operations/viewlink.js +334 -0
- package/dist/shortcuts/cowork/index.js +2 -2
- package/dist/shortcuts/ebuilder-form/index.js +1 -1
- package/dist/shortcuts/ehr/index.js +2 -2
- package/dist/shortcuts/ehr/manifest.js +1 -1
- package/dist/shortcuts/ehr/operations/recruit-position.js +11 -5
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +10 -9
- package/dist/shortcuts/ehr/operations/recruit.js +390 -196
- package/dist/shortcuts/ehr/operations/shared.js +51 -0
- package/dist/shortcuts/esb/index.js +1 -1
- package/dist/shortcuts/fna/index.js +1 -1
- package/dist/shortcuts/fna/manifest.js +1 -0
- package/dist/shortcuts/fna/operations/expense-chart.js +3 -1
- package/dist/shortcuts/hrm/index.js +1 -1
- package/dist/shortcuts/invoice/index.js +1 -1
- package/dist/shortcuts/jiuchuanhui/index.js +2 -2
- package/dist/shortcuts/jiuchuanhui/manifest.js +3 -0
- package/dist/shortcuts/mail/index.js +2 -2
- package/dist/shortcuts/meeting/index.js +1 -1
- package/dist/shortcuts/meeting/manifest.js +1 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -3
- package/dist/shortcuts/meeting/operations/eb/conflict.js +3 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +10 -9
- package/dist/shortcuts/meeting/operations/eb/factory.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +3 -2
- package/dist/shortcuts/meeting/operations/invitation-publish.js +3 -3
- package/dist/shortcuts/meeting/operations/invitation.js +4 -4
- package/dist/shortcuts/meeting/operations/link.js +3 -1
- package/dist/shortcuts/okr/index.js +1 -1
- package/dist/shortcuts/performance/index.js +1 -1
- package/dist/shortcuts/plan/index.js +1 -1
- package/dist/shortcuts/project/index.js +1 -1
- package/dist/shortcuts/reception/constants.js +22 -0
- package/dist/shortcuts/reception/index.js +4 -0
- package/dist/shortcuts/reception/manifest.js +16 -2
- package/dist/shortcuts/reception/operations/doc.js +24 -11
- package/dist/shortcuts/reception/operations/docrender.js +18 -1
- package/dist/shortcuts/reception/operations/render-assets.js +93 -22
- package/dist/shortcuts/recruit-stage/context.js +22 -8
- package/dist/shortcuts/recruit-stage/index.js +16 -3
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +20 -11
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +467 -26
- package/dist/shortcuts/recruit-stage/operations/list.js +73 -2
- package/dist/shortcuts/recruit-stage/operations/profile.js +13 -5
- package/dist/shortcuts/recruit-stage/operations/registry.js +18 -2
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +363 -54
- package/dist/shortcuts/recruit-stage/operations/search.js +80 -16
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +124 -0
- package/dist/shortcuts/recruit-stage/shared.js +174 -56
- package/dist/shortcuts/smart-extract/manifest.js +1 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +7 -2
- package/dist/shortcuts/smart-extract/operations/validate.js +4 -1
- package/dist/shortcuts/workflow/index.js +2 -2
- package/dist/shortcuts/workflow/manifest.js +1 -0
- package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +4 -1
- package/dist/shortcuts/workflow/operations/deepRead.js +23 -2
- package/dist/shortcuts/workflow/operations/form.js +44 -4
- package/docs/contract.md +6 -1
- package/docs/e10-auth.md +25 -7
- package/docs/operation-manual.md +15 -0
- package/package.json +2 -2
- package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
- package/skill-template/business-info.json +28 -0
- package/skill-template/domains/jinchengda.md +13 -1
- package/skills/weaver-e10-archive-oa/references/source-manifest.json +3 -3
- package/skills/weaver-e10-caizhilian/references/auth-and-install.md +2 -1
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
- package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +90 -32
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +45 -0
- package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +68 -0
- package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +216 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-negotiate.md +215 -0
- package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +113 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +19 -3
- package/skills/weaver-e10-jinchengda/references/contract-decisions.md +114 -0
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -44
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +200 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -1
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +138 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +158 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +3 -1
- package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +139 -0
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +10 -3
- package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +106 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +176 -56
- package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +123 -0
- package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +410 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-viewlink.md +110 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +38 -24
- package/skills/weaver-e10-jucailin/SKILL.md +7 -3
- package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +13 -0
- package/skills/weaver-e10-okr/SKILL.md +11 -0
- package/skills/weaver-e10-okr/references/source-manifest.json +7 -6
- package/skills/weaver-e10-performance/SKILL.md +131 -39
- package/skills/weaver-e10-performance/agents/openai.yaml +48 -17
- package/skills/weaver-e10-performance/references/default-assembly.md +3 -0
- package/skills/weaver-e10-performance/references/extraction-guide.md +17 -3
- package/skills/weaver-e10-performance/references/flow-assess.md +38 -5
- package/skills/weaver-e10-performance/references/scheme-setting-page.md +20 -3
- package/skills/weaver-e10-performance/scripts/assemble_scheme.py +461 -0
- package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +41 -0
- package/skills/weaver-e10-plan/SKILL.md +10 -0
- package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
- package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
- package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
- package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +533 -137
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +103 -62
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +282 -0
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +331 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +865 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +162 -11
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +15 -1
- package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +38 -0
- package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +6 -2
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +26 -21
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +33 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +22 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +42 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +87 -50
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +48 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +45 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +17 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +162 -31
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +55 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +75 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +12 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +80 -46
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +12 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +10 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +15 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +7 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +7 -3
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +119 -0
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +322 -0
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +166 -76
- package/skills/weaver-e10-shared/SKILL.md +40 -5
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -1
- package/skills/weaver-e10-shared/references/json-output-contract.md +144 -8
- package/skills/weaver-e10-shared/references/weaver-e10-installation.md +11 -0
- package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
- package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +5 -5
- package/dist/chunks/chunk-MZVQKQP5.js +0 -2849
- package/dist/chunks/registry-3GQRYP2R.js +0 -27
- package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync,
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { ehrValidationError } from '../errors.js';
|
|
6
6
|
import { READ, SCHEMA_ID, ehrSuccess, schemaOf, } from './types.js';
|
|
7
|
-
import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
7
|
+
import { compact, menuShapeOf, normalizePaged, toMenuList, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
8
|
+
import { isXiaoECloudRuntime } from '../../../internal/e10/auth/xiaoe.js';
|
|
8
9
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
9
10
|
// 五层运行时解析(迁移自 ehr 技能 _init_env_cache.mjs,真机验证过)
|
|
10
11
|
// getAppIds -> getObjsByTag -> allMenus -> ds/fields -> ds/options
|
|
@@ -14,18 +15,39 @@ import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from '.
|
|
|
14
15
|
// 设同一 E10_SKILL_CACHE_DIR 即可共享缓存)。菜单名跨版本不同,解析不到必须报错,禁止臆造。
|
|
15
16
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
16
17
|
const RECRUIT_APP_TAG = 'weaver-recruit-service';
|
|
17
|
-
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
18
|
-
/** 环境缓存结构版本:新增/变更解析字段(如 2026-11-04 补 candidate 应聘者列表)时 +1,旧缓存自动失效重建。 */
|
|
19
|
-
const RECRUIT_CACHE_VERSION = 4;
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
19
|
+
* 自用系统租户标识(2026-11-28 用户指定,租户 key 唯一)。
|
|
22
20
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
21
|
+
* 判「是否自用环境」原有两条依据,都不够稳:
|
|
22
|
+
* · selfUse:来自业务配置表 config_key=-9999,配置表读不到/无权限时恒为 '0';
|
|
23
|
+
* · 域名:同一套自用环境可能有多个入口(www.e-cology.com.cn / 内网 IP / 带端口),
|
|
24
|
+
* 域名不匹配就漏判,但底层数据其实是同一套。
|
|
25
|
+
* tenantKey 是平台级唯一标识,与入口地址、菜单权限、配置表都无关,作为主判据最可靠。
|
|
26
|
+
* 这里只列自用租户;匹配不到仍按原逻辑判断,不影响其他环境。
|
|
27
|
+
*/
|
|
28
|
+
export const SELF_TENANT_KEYS = new Set(['t7akvdnf84']);
|
|
29
|
+
/** 是否自用租户:tenantKey 唯一命中即认定 */
|
|
30
|
+
export function isSelfTenant(tenantKey) {
|
|
31
|
+
const key = String(tenantKey || '').trim();
|
|
32
|
+
return !!key && SELF_TENANT_KEYS.has(key);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 缓存结构版本:结构或健康判据变化时 +1,旧缓存自动失效重建(用户无需手工删文件)。
|
|
36
|
+
* v8 变更:字典/业务配置改 B 通道按 objId 直读(与菜单解耦);分页以「本页 0 行」判末页;
|
|
37
|
+
* options/biz_config 降为 warn;memo 补 TTL 与健康校验。
|
|
38
|
+
* v7 及更早的缓存可能含「字典残缺但 degraded 为空」的产物,必须作废。
|
|
39
|
+
*/
|
|
40
|
+
export const RECRUIT_CACHE_VERSION = 8;
|
|
41
|
+
/**
|
|
42
|
+
* 主缓存、快照、进程内 memo 统一 TTL(默认 12h),过期 → 快照双探针 → 全量重建,
|
|
43
|
+
* 使菜单改名/字段调整/字典更新最多 12h 自愈。`E10_RS_RECRUIT_CACHE_TTL_MS` 仅供排障覆盖。
|
|
28
44
|
*/
|
|
45
|
+
const RECRUIT_CACHE_TTL_DEFAULT_MS = 12 * 60 * 60 * 1000;
|
|
46
|
+
function recruitCacheTtlMs() {
|
|
47
|
+
const raw = Number(process.env.E10_RS_RECRUIT_CACHE_TTL_MS || '');
|
|
48
|
+
return Number.isFinite(raw) && raw > 0 ? raw : RECRUIT_CACHE_TTL_DEFAULT_MS;
|
|
49
|
+
}
|
|
50
|
+
/** 关键表单:字段列表为空即判上下文不可用(抛错且不落盘),避免坏缓存固化后所有操作中断。 */
|
|
29
51
|
const RECRUIT_CRITICAL_FORMS = new Set(['position_manage', 'talent_pool', 'interview_plan']);
|
|
30
52
|
/** 关键表单中文名(报错用;表单自身 objName 在解析失败时取不到,不能依赖) */
|
|
31
53
|
const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
@@ -33,21 +55,31 @@ const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
|
33
55
|
talent_pool: '人才库',
|
|
34
56
|
interview_plan: '面试管理',
|
|
35
57
|
};
|
|
36
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* 磁盘缓存健康检查,任一不满足即判坏重建:
|
|
60
|
+
* ① 关键表单有 objId 且字段表非空(缺 objId 说明当初 getObjsByTag 就没解析到,同属坏缓存);
|
|
61
|
+
* ② degraded 非空 = 残缺上下文,不复用;
|
|
62
|
+
* ③ 字典 by_name 非空(封堵 v7 及更早「字典空但 degraded 空」的残缺产物)。
|
|
63
|
+
* 不判坏的两类:warn 非空(菜单形状未知/显示降级,业务有兜底)、关键业务列表未定位(菜单改名,
|
|
64
|
+
* 属环境配置问题——判坏只会让该环境永久全量解析,且列表照样报错;由 12h TTL 兜底重建)。
|
|
65
|
+
*/
|
|
37
66
|
function hasCriticalFields(cache) {
|
|
38
67
|
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
39
68
|
const objId = cache?.forms?.[logic]?.objId;
|
|
40
|
-
// 🔴 关键表单缺 objId 同样是坏缓存:说明当初 getObjsByTag 解析失败(网络抖动/权限/未装全)。
|
|
41
|
-
// 旧实现 `if (!objId) continue` 等于「没表单就不用校验字段」,把解析失败的上下文当健康缓存长期复用,
|
|
42
|
-
// 之后所有职位/人才操作都在「表单未启用」或「缺少字段」处中断——这是坏缓存的第二条产生路径。
|
|
43
69
|
if (!objId)
|
|
44
70
|
return false;
|
|
45
71
|
const fmap = cache?.fields?.[objId] || {};
|
|
46
72
|
if (!Object.keys(fmap).length)
|
|
47
73
|
return false;
|
|
48
74
|
}
|
|
75
|
+
if (Array.isArray(cache?.degraded) && cache.degraded.length)
|
|
76
|
+
return false;
|
|
77
|
+
const dictByName = cache?.dict?.by_name;
|
|
78
|
+
if (!dictByName || typeof dictByName !== 'object' || !Object.keys(dictByName).length)
|
|
79
|
+
return false;
|
|
49
80
|
return true;
|
|
50
81
|
}
|
|
82
|
+
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
51
83
|
const RECRUIT_TAGS = {
|
|
52
84
|
talent_pool: 'uf_rcrt_talent_pool',
|
|
53
85
|
interview_plan: 'uf_rcrt_interview_plan',
|
|
@@ -110,32 +142,19 @@ function cacheDirFor(baseUrl) {
|
|
|
110
142
|
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
|
|
111
143
|
return join(home, 'env-cache', 'recruit-ops', host);
|
|
112
144
|
}
|
|
113
|
-
/**
|
|
114
|
-
* 上下文快照(「冷启动预置」的零写死实现):
|
|
115
|
-
*
|
|
116
|
-
* 冷启动(缓存被清 / 版本号变化 / 换机器首次)要发 46 个请求、约 2.2 s 才把
|
|
117
|
-
* appId + 14 个表单 objId + 菜单列表 + 13 份字段表 + 数据字典 + 选项拉全。
|
|
118
|
-
* 这里在**每次成功解析后**留一份快照(含版本与时间戳),下次冷启动先试快照:
|
|
119
|
-
* - 快照未过期(12 h)且版本一致;
|
|
120
|
-
* - 两个探针通过:getAppIds 的 appId 与快照一致 + talent_pool 的 tag 仍解析到同一 objId;
|
|
121
|
-
* 才采用快照(省掉 tags×14 / allMenus / ds/fields×13 / 字典分页 / 选项 这些请求),
|
|
122
|
-
* 否则一律回退原全量重建。
|
|
123
|
-
*
|
|
124
|
-
* 为什么不用「把自用那套 id 写死进代码」:菜单名、字段、数据字典都会随环境维护变化,
|
|
125
|
-
* 写死的 id 过期后会静默写错值;快照 + 双探针 + 12 h TTL 能拿到同样的冷启动速度,且过期自动重建。
|
|
126
|
-
*/
|
|
127
|
-
const CONTEXT_SNAPSHOT_TTL_MS = 12 * 60 * 60 * 1000;
|
|
128
145
|
function snapshotPathFor(baseUrl) {
|
|
129
146
|
const url = new URL(baseUrl);
|
|
130
147
|
const host = url.hostname + (url.port ? `_${url.port}` : '');
|
|
131
148
|
return join(cacheDirFor(baseUrl), '..', '_recruit-stage', `context-snapshot-${host}.json`);
|
|
132
149
|
}
|
|
133
150
|
function readContextSnapshot(baseUrl) {
|
|
151
|
+
if (isXiaoECloudRuntime())
|
|
152
|
+
return null; /* 云端容器不持久,读快照无意义 */
|
|
134
153
|
try {
|
|
135
154
|
const raw = JSON.parse(readFileSync(snapshotPathFor(baseUrl), 'utf8'));
|
|
136
155
|
if (!raw?.at || raw.cacheVersion !== RECRUIT_CACHE_VERSION)
|
|
137
156
|
return null;
|
|
138
|
-
if (Date.now() - raw.at >
|
|
157
|
+
if (Date.now() - raw.at > recruitCacheTtlMs())
|
|
139
158
|
return null;
|
|
140
159
|
if (!raw.resolved || !hasCriticalFields({ ...raw.resolved, appId: raw.appId }))
|
|
141
160
|
return null;
|
|
@@ -146,6 +165,12 @@ function readContextSnapshot(baseUrl) {
|
|
|
146
165
|
}
|
|
147
166
|
}
|
|
148
167
|
function writeContextSnapshot(baseUrl, appId, resolved) {
|
|
168
|
+
// 与 persistContextCache 同口径:**致命**残缺不写快照(否则快照文件成为永不过期的残缺源);
|
|
169
|
+
// warn(菜单形状未知等)允许写,快照里的 warn/menuShape 同样经 meta.cache 暴露。
|
|
170
|
+
if (Array.isArray(resolved?.degraded) && resolved.degraded.length)
|
|
171
|
+
return;
|
|
172
|
+
if (isXiaoECloudRuntime())
|
|
173
|
+
return; /* 云端容器不持久,写快照无意义 */
|
|
149
174
|
try {
|
|
150
175
|
const path = snapshotPathFor(baseUrl);
|
|
151
176
|
mkdirSync(join(path, '..'), { recursive: true });
|
|
@@ -185,10 +210,19 @@ export function namesOf(field) {
|
|
|
185
210
|
function isPlainId(value) {
|
|
186
211
|
return value != null && /^\d+$/.test(String(value).trim());
|
|
187
212
|
}
|
|
188
|
-
|
|
213
|
+
/**
|
|
214
|
+
* 招聘上下文错误(环境/权限前置条件不满足)。
|
|
215
|
+
* 必须带 `type`,否则信封落 `internal/unexpected`、平台码落 `E-9999`,
|
|
216
|
+
* 宿主会把「菜单没权限」「招聘未安装」当成程序崩溃。
|
|
217
|
+
* permission → E-0005(菜单/列表入口不可见);upstream → E-0004(表单/字段/配置解析失败、未安装)。
|
|
218
|
+
*/
|
|
219
|
+
export class RecruitContextError extends Error {
|
|
220
|
+
type;
|
|
189
221
|
subtype;
|
|
190
|
-
|
|
222
|
+
retryable = false;
|
|
223
|
+
constructor(subtype, message, type = 'upstream') {
|
|
191
224
|
super(message);
|
|
225
|
+
this.type = type;
|
|
192
226
|
this.subtype = subtype;
|
|
193
227
|
}
|
|
194
228
|
}
|
|
@@ -254,12 +288,49 @@ async function fetchFormFields(host, appId, objId) {
|
|
|
254
288
|
}
|
|
255
289
|
return { fmap, omap };
|
|
256
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
/** 排障用:覆盖 B 通道每页条数(默认 500/100 不变),用于真机复现「小页/被截断」场景。 */
|
|
293
|
+
function datasetPageSize(fallback) {
|
|
294
|
+
const raw = Number(process.env.E10_RS_RECRUIT_B_PAGE_SIZE || '');
|
|
295
|
+
return Number.isInteger(raw) && raw > 0 ? Math.min(raw, fallback) : fallback;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* B 通道(`dataset/v2/getAllData`)全量分页读取。
|
|
299
|
+
*
|
|
300
|
+
* 终止判据必须是「本页 0 行」,不能是 `rows.length < pageSize`:平台若把 pageSize 截断到上限,
|
|
301
|
+
* 每页都「不满」→ 第一页后误判末页 → 字典被静默截断(来源少选项,最难发现)。
|
|
302
|
+
* 接口文档标注上限 1000、当前传 500 未触及,但判据不应依赖这个上限不变。代价是到底后多一次空请求。
|
|
303
|
+
* maxRows 按 pageSize 折算成页数,达上限仍未读空则 truncated=true,由调用方记 warn。
|
|
304
|
+
*/
|
|
305
|
+
async function fetchAllDatasetRows(host, objId, options) {
|
|
306
|
+
const rows = [];
|
|
307
|
+
const maxPages = Math.max(1, Math.ceil(options.maxRows / Math.max(1, options.pageSize)));
|
|
308
|
+
let pageNo = 1;
|
|
309
|
+
for (;;) {
|
|
310
|
+
if (pageNo > maxPages)
|
|
311
|
+
return { rows, pages: pageNo - 1, truncated: true };
|
|
312
|
+
const response = (await host.request({
|
|
313
|
+
method: 'POST',
|
|
314
|
+
path: '/api/ebuilder/form/dataset/v2/getAllData',
|
|
315
|
+
// header.objId + pageInfo 必带(不传 pageSize 平台默认只返 10 条);
|
|
316
|
+
// 顶层无 code/status,必须 skipBusinessCheck,由 datajson.datas 自行判成功。
|
|
317
|
+
body: { datajson: { header: { objId }, mainTable: {}, pageInfo: { pageNo, pageSize: options.pageSize } } },
|
|
318
|
+
skipBusinessCheck: true,
|
|
319
|
+
}));
|
|
320
|
+
const pageRows = response?.data?.datajson?.datas || [];
|
|
321
|
+
if (!pageRows.length)
|
|
322
|
+
return { rows, pages: pageNo, truncated: false };
|
|
323
|
+
rows.push(...pageRows);
|
|
324
|
+
pageNo += 1;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
257
327
|
/** 五层解析主流程(磁盘缓存缺失时执行;每层失败必须报错,禁止臆造) */
|
|
258
328
|
async function resolveRecruitEnv(host, appId) {
|
|
329
|
+
// 解析降级标记:degraded = 致命(尝试过且失败)→ 不落盘不命中;warn = 非致命(可选依赖不可用)→ 照常落盘。
|
|
330
|
+
const degraded = [];
|
|
331
|
+
const warn = [];
|
|
259
332
|
// L2:tag 解析各表单 objId/formId(顺带 tenantKey)
|
|
260
|
-
//
|
|
261
|
-
// 保持原语义:① 任一请求失败仍向上抛(Promise.all 不吞异常,与原串行一致);
|
|
262
|
-
// ② tenantKey 仍按 RECRUIT_TAGS 声明顺序取第一个非空值(用 forEach 按序回填,不依赖完成顺序)。
|
|
333
|
+
// tag 并发拉取;任一请求失败仍向上抛,tenantKey 按 RECRUIT_TAGS 声明顺序取第一个非空值。
|
|
263
334
|
const forms = {};
|
|
264
335
|
let tenantKey = '';
|
|
265
336
|
const tagEntries = Object.entries(RECRUIT_TAGS);
|
|
@@ -278,29 +349,46 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
278
349
|
if (!tenantKey && entry?.tenantKey)
|
|
279
350
|
tenantKey = String(entry.tenantKey);
|
|
280
351
|
});
|
|
281
|
-
// L2.5
|
|
282
|
-
// 与「字段表为空」同等对待——立即报错且**不落盘**,避免把解析失败的上下文写进缓存。
|
|
352
|
+
// L2.5:关键表单必须有 objId,缺任一个即报错且**不落盘**(tag/权限/安装有问题时不得缓存)。
|
|
283
353
|
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
284
354
|
if (forms[logic]?.objId)
|
|
285
355
|
continue;
|
|
286
356
|
throw new RecruitContextError('recruit_form_unresolved', `当前环境未解析到「${RECRUIT_CRITICAL_FORM_LABELS[logic] || logic}」表单(getObjsByTag 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限后重试。`);
|
|
287
357
|
}
|
|
358
|
+
// 字典表是简历来源等字典引用字段的唯一取值源,解析不到即字典必空,按致命降级处理;
|
|
359
|
+
// 业务配置表有 page/list 兜底,不强制。
|
|
360
|
+
if (!forms.dictionary?.objId)
|
|
361
|
+
degraded.push('dict');
|
|
288
362
|
// L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}));
|
|
363
|
+
// 菜单是**可选依赖**:只定位列表/页面入口,地址另有固定路由兜底。接口失败或返回结构不可控
|
|
364
|
+
// (数组/包装对象/空对象/缺字段)一律降级为空菜单继续,且只进 warn——不得阻断上下文解析,
|
|
365
|
+
// 否则该环境会「每次冷启动都在同处失败、永不生成缓存」。降级必须留痕,否则残缺上下文会被判健康落盘。
|
|
293
366
|
const flat = [];
|
|
294
367
|
const walk = (nodes) => {
|
|
295
|
-
for (const node of nodes
|
|
368
|
+
for (const node of toMenuList(nodes)) {
|
|
296
369
|
if (node && typeof node === 'object') {
|
|
297
370
|
flat.push(node);
|
|
298
|
-
walk(node.children
|
|
371
|
+
walk(node.children ?? node.childs);
|
|
299
372
|
}
|
|
300
373
|
}
|
|
301
374
|
};
|
|
302
|
-
|
|
303
|
-
|
|
375
|
+
let menuFailed = false;
|
|
376
|
+
let menuShape = 'unavailable';
|
|
377
|
+
try {
|
|
378
|
+
const menuResponse = (await host.request({
|
|
379
|
+
path: '/api/cusapp/app/allMenus',
|
|
380
|
+
query: { isFront: 1, appId, terminalType: 'PC' },
|
|
381
|
+
}));
|
|
382
|
+
// 只传 data:由 toMenuList 自行识别 cusAppMenus 包装;不要再 `|| menuData` 把整个对象塞进遍历
|
|
383
|
+
menuShape = menuShapeOf(menuResponse?.data);
|
|
384
|
+
walk(menuResponse?.data);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
menuFailed = true; /* 菜单不可用:降级为空菜单,后续解析与业务链路照常继续 */
|
|
388
|
+
}
|
|
389
|
+
// 菜单不可用(失败/形状未知/0 节点)只进 warn:只做寻址、不做授权,不决定业务成败。
|
|
390
|
+
if (menuFailed || !flat.length)
|
|
391
|
+
warn.push('menus');
|
|
304
392
|
const searchMenus = [];
|
|
305
393
|
const pages = [];
|
|
306
394
|
for (const node of flat) {
|
|
@@ -317,8 +405,7 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
317
405
|
const resolvedForms = Object.entries(forms).filter(([, v]) => v.objId);
|
|
318
406
|
await Promise.all(resolvedForms.map(async ([logic, entry]) => {
|
|
319
407
|
const { fmap, omap } = await fetchFormFields(host, appId, entry.objId);
|
|
320
|
-
//
|
|
321
|
-
// 非关键表单(辅助配置表等)允许为空,保持旧行为,避免误伤部分环境。
|
|
408
|
+
// 关键表单字段为空必须报错;非关键表单(辅助配置表)允许为空。
|
|
322
409
|
if (!Object.keys(fmap).length && RECRUIT_CRITICAL_FORMS.has(logic)) {
|
|
323
410
|
throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「${entry.objName || logic}」表单的字段列表(ds/fields 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限,或删除环境缓存后重试。`);
|
|
324
411
|
}
|
|
@@ -327,110 +414,120 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
327
414
|
if (Object.keys(omap).length)
|
|
328
415
|
fieldOptions[entry.objId] = omap;
|
|
329
416
|
}));
|
|
330
|
-
// L5
|
|
417
|
+
// L5:数据字典全量映射(字典引用类字段如渠道的 optionId 来源)
|
|
418
|
+
// 走 B 通道按 objId 直读:字典是招聘自己的配置表,可用性与「数据字典」菜单可见性无关。
|
|
419
|
+
// 旧实现靠菜单拿 listId,菜单权限未放开时字典整段跳过,简历录入会被「缺手动录入」拦住。
|
|
331
420
|
const dictByName = {};
|
|
332
421
|
const dictRaw = [];
|
|
333
|
-
const dictMenu = searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null;
|
|
334
422
|
const dictObjId = forms.dictionary?.objId || '';
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
terminal: 'PC', browser: 'Chrome', requiredMatch: 1, mapResult: 1,
|
|
347
|
-
recheckQuery: 1, isFollow: 0, isShareToMe: 0, filterCondition: {},
|
|
348
|
-
cusMenuId: dictMenu.cusMenuId, urlPageTitle: '数据字典', menuName: '数据字典',
|
|
349
|
-
},
|
|
350
|
-
headers: { ebBusinessId: dictMenu.listId },
|
|
351
|
-
});
|
|
352
|
-
let pageNo = 1;
|
|
353
|
-
let reachedEnd = false;
|
|
354
|
-
while (!reachedEnd) {
|
|
355
|
-
const batchPages = Array.from({ length: CONCURRENCY }, (_, i) => pageNo + i);
|
|
356
|
-
const responses = await Promise.all(batchPages.map((p) => fetchDictPage(p)));
|
|
357
|
-
for (const response of responses) {
|
|
358
|
-
const rows = response?.data?.data || [];
|
|
359
|
-
for (const row of rows) {
|
|
360
|
-
const name = row.selection_name;
|
|
361
|
-
const optionId = row.form_data_id;
|
|
423
|
+
// 字典 / 业务配置 / ds/options 三段相互独立,包装后并发执行(省 2 个 RTT 轮次)。
|
|
424
|
+
const loadDict = async () => {
|
|
425
|
+
if (dictObjId) {
|
|
426
|
+
try {
|
|
427
|
+
const page = await fetchAllDatasetRows(host, dictObjId, { pageSize: datasetPageSize(500), maxRows: 20000 });
|
|
428
|
+
if (page.truncated)
|
|
429
|
+
warn.push('dict-truncated');
|
|
430
|
+
for (const row of page.rows) {
|
|
431
|
+
const main = row?.mainTable || {};
|
|
432
|
+
const name = main.selection_name?.fieldValue;
|
|
433
|
+
const optionId = main.id?.fieldValue;
|
|
362
434
|
if (name && optionId) {
|
|
363
435
|
(dictByName[String(name)] ||= []).push(String(optionId));
|
|
364
|
-
|
|
436
|
+
// dict_type 是 Select:B 通道为选项数组,取 fieldOptionId(与 A 通道扁平值同义)
|
|
437
|
+
const dictType = Array.isArray(main.dict_type)
|
|
438
|
+
? (main.dict_type[0]?.fieldOptionId ?? '')
|
|
439
|
+
: (main.dict_type?.fieldValue ?? main.dict_type ?? '');
|
|
440
|
+
dictRaw.push({
|
|
441
|
+
selection_name: String(name),
|
|
442
|
+
option_id: String(optionId),
|
|
443
|
+
dict_type: String(dictType),
|
|
444
|
+
browser_key: String(main.browser_key?.fieldValue || ''),
|
|
445
|
+
});
|
|
365
446
|
}
|
|
366
447
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
451
|
+
console.error('[recruit-context] 字典读取失败:', error instanceof Error ? error.message : String(error));
|
|
370
452
|
}
|
|
453
|
+
degraded.push('dict'); /* 字典拉取失败:留痕降级,残缺 dict 不落盘 */
|
|
371
454
|
}
|
|
372
|
-
|
|
455
|
+
// 一条字典都没拉到:要么接口静默失败,要么字典表真没配。按「尝试过且失败」处理。
|
|
456
|
+
if (!Object.keys(dictByName).length)
|
|
457
|
+
degraded.push('dict');
|
|
373
458
|
}
|
|
374
|
-
}
|
|
375
|
-
// 人才卡片页面 id
|
|
459
|
+
};
|
|
460
|
+
// 人才卡片页面 id(业务配置表 config_key=28;page/list 兜底)+ 泛微自用标记
|
|
461
|
+
// 业务配置表同样走 B 通道按 objId 直读,不依赖菜单可见性;
|
|
462
|
+
// config_key 是 Select,B 通道取 fieldOptionId(与 A 通道扁平值同义)。
|
|
376
463
|
let ebdDetailPageId = '';
|
|
377
464
|
let selfUse = '0';
|
|
378
465
|
const bizConfig = forms.biz_config || { objId: '', formId: '', objName: '' };
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
466
|
+
const loadBizConfig = async () => {
|
|
467
|
+
if (bizConfig.objId) {
|
|
468
|
+
try {
|
|
469
|
+
const page = await fetchAllDatasetRows(host, bizConfig.objId, { pageSize: datasetPageSize(100), maxRows: 5000 });
|
|
470
|
+
if (page.truncated)
|
|
471
|
+
warn.push('biz_config-truncated');
|
|
472
|
+
for (const row of page.rows) {
|
|
473
|
+
const main = row?.mainTable || {};
|
|
474
|
+
const keyRaw = main.config_key;
|
|
475
|
+
const key = Array.isArray(keyRaw)
|
|
476
|
+
? (keyRaw[0]?.fieldOptionId ?? '')
|
|
477
|
+
: (keyRaw?.fieldValue ?? keyRaw ?? '');
|
|
478
|
+
const config = String(main.config?.fieldValue ?? '');
|
|
479
|
+
if (String(key) === '28' && config) {
|
|
480
|
+
const match = config.match(/\/sp\/ebdpage\/view\/(\d+)/);
|
|
481
|
+
if (match)
|
|
482
|
+
ebdDetailPageId = match[1];
|
|
483
|
+
}
|
|
484
|
+
if (String(key) === '-9999' && config === '1')
|
|
485
|
+
selfUse = '1';
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
catch (error) {
|
|
489
|
+
// 不阻塞(卡片页有 page/list 兜底、自用标记有 tenantKey 兜底),但必须留痕:
|
|
490
|
+
// 否则诊断时分不清「环境没配」和「账号读不到这张表」。
|
|
491
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
492
|
+
console.error('[recruit-context] 业务配置表读取失败:', error instanceof Error ? error.message : String(error));
|
|
493
|
+
}
|
|
494
|
+
warn.push('biz_config');
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
// ds/options 兼容通道(人才库 recruit_status/channel;字典引用类返回空则跳过)
|
|
499
|
+
// 这两个枚举只用于状态/渠道的中文显示,缺失退化为原始 id,故失败只进 warn:
|
|
500
|
+
// 按 degraded 处理会让 ds/options 恒失败的环境永不落盘、每次冷启动全量重解析。
|
|
501
|
+
const options = {};
|
|
502
|
+
const loadDsOptions = async () => {
|
|
503
|
+
for (const [dataKey, logic] of [['recruit_status', 'talent_pool'], ['channel', 'talent_pool']]) {
|
|
504
|
+
const entry = forms[logic] || { objId: '', formId: '', objName: '' };
|
|
505
|
+
const fieldId = (fields[entry.objId] || {})[dataKey] || '';
|
|
506
|
+
if (fieldId && entry.objId) {
|
|
507
|
+
try {
|
|
508
|
+
const response = (await host.request({
|
|
509
|
+
path: '/api/ebuilder/common/ds/options',
|
|
510
|
+
query: { fieldName: fieldId, objId: entry.objId, sourceType: 'FORM', groupId: appId },
|
|
511
|
+
}));
|
|
512
|
+
if (Array.isArray(response?.data)) {
|
|
513
|
+
options[dataKey] = {};
|
|
514
|
+
for (const option of response.data) {
|
|
515
|
+
if (option?.id)
|
|
516
|
+
options[dataKey][String(option.id)] = option.name;
|
|
426
517
|
}
|
|
427
518
|
}
|
|
428
|
-
|
|
519
|
+
}
|
|
520
|
+
catch {
|
|
521
|
+
warn.push(`options:${dataKey}`); /* 枚举拉取失败:非致命,仅提示 */
|
|
429
522
|
}
|
|
430
523
|
}
|
|
431
524
|
}
|
|
432
|
-
|
|
433
|
-
|
|
525
|
+
};
|
|
526
|
+
await Promise.all([loadDict(), loadBizConfig(), loadDsOptions()]);
|
|
527
|
+
// 自用租户兜底:配置表要经表单权限才能读,任一环节缺失 selfUse 恒为 '0',
|
|
528
|
+
// 会导致下游漏拼 &recruitType=useSelf 而取错数据;tenantKey 是平台级唯一标识,最可靠。
|
|
529
|
+
if (isSelfTenant(tenantKey))
|
|
530
|
+
selfUse = '1';
|
|
434
531
|
if (!ebdDetailPageId) {
|
|
435
532
|
try {
|
|
436
533
|
const response = (await host.request({
|
|
@@ -446,28 +543,13 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
446
543
|
}
|
|
447
544
|
catch { /* 后台权限不足不阻塞,保持空 */ }
|
|
448
545
|
}
|
|
449
|
-
// ds/options 兼容通道(人才库 recruit_status/channel;字典引用类返回空则跳过)
|
|
450
|
-
const options = {};
|
|
451
|
-
for (const [dataKey, logic] of [['recruit_status', 'talent_pool'], ['channel', 'talent_pool']]) {
|
|
452
|
-
const entry = forms[logic] || { objId: '', formId: '', objName: '' };
|
|
453
|
-
const fieldId = (fields[entry.objId] || {})[dataKey] || '';
|
|
454
|
-
if (fieldId && entry.objId) {
|
|
455
|
-
const response = (await host.request({
|
|
456
|
-
path: '/api/ebuilder/common/ds/options',
|
|
457
|
-
query: { fieldName: fieldId, objId: entry.objId, sourceType: 'FORM', groupId: appId },
|
|
458
|
-
}));
|
|
459
|
-
if (Array.isArray(response?.data)) {
|
|
460
|
-
options[dataKey] = {};
|
|
461
|
-
for (const option of response.data) {
|
|
462
|
-
if (option?.id)
|
|
463
|
-
options[dataKey][String(option.id)] = option.name;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
546
|
const lists = {
|
|
469
547
|
talent: null, demand: null, position: null, entry: null, offer: null,
|
|
470
|
-
|
|
548
|
+
// dict / biz_config 仅作为菜单元数据保留(供 describeTargets 诊断);
|
|
549
|
+
// 字典与业务配置的实际读取已改走 dataset/v2 B 通道,不再依赖这两个菜单项。
|
|
550
|
+
interview: null, candidate: null,
|
|
551
|
+
dict: searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null,
|
|
552
|
+
biz_config: searchMenus.find((m) => (m.menuName || '').trim() === '业务配置映射表') || null,
|
|
471
553
|
all_search: searchMenus, pages,
|
|
472
554
|
};
|
|
473
555
|
for (const [biz, keywords] of Object.entries(LIST_KEYWORDS)) {
|
|
@@ -478,9 +560,22 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
478
560
|
}
|
|
479
561
|
}
|
|
480
562
|
}
|
|
563
|
+
// 菜单树正常但 7 个业务列表全部未按关键词匹配到 → 大概率租户改了菜单名。
|
|
564
|
+
// 缓存仍健康落盘(列表寻址属环境配置问题,12h TTL 兜底),但必须留痕供上层预警,
|
|
565
|
+
// 否则列表类功能最长 12h 内持续报错而无任何提示。
|
|
566
|
+
if (!menuFailed && flat.length > 0
|
|
567
|
+
&& Object.keys(LIST_KEYWORDS).filter((k) => k !== 'biz_config').every((k) => !lists[k])) {
|
|
568
|
+
warn.push('menus-renamed');
|
|
569
|
+
}
|
|
570
|
+
// 同一 code 可能被多条路径 push(如 dict 既可能是 tag 缺失、也可能是 B 通道拉空),
|
|
571
|
+
// 去重后再回传/落盘:degraded/warn 会被技能层直接展示给用户。
|
|
572
|
+
const dedupe = (list) => [...new Set(list)];
|
|
481
573
|
return {
|
|
482
574
|
appId,
|
|
483
575
|
tenantKey,
|
|
576
|
+
degraded: dedupe(degraded),
|
|
577
|
+
warn: dedupe(warn),
|
|
578
|
+
menuShape,
|
|
484
579
|
forms,
|
|
485
580
|
lists,
|
|
486
581
|
fields,
|
|
@@ -491,38 +586,76 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
491
586
|
selfUse,
|
|
492
587
|
};
|
|
493
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* 「列表入口未定位到」的归因提示。菜单只做列表寻址(A 通道需要 listId + cusMenuId),
|
|
591
|
+
* 账号看不到菜单时缓存本身是健康的(warn=['menus']),报错若写「功能未启用」会误导排查方向。
|
|
592
|
+
*/
|
|
593
|
+
function listUnavailableHint(cache) {
|
|
594
|
+
const warnList = Array.isArray(cache?.warn) ? cache.warn : [];
|
|
595
|
+
if (warnList.includes('menus')) {
|
|
596
|
+
return '本次未取到菜单树(warn=[menus]):当前账号可能看不到招聘相关菜单。'
|
|
597
|
+
+ '请在「应用 → 菜单权限」中为本账号勾选招聘菜单后重试;数据读取(表单/字典/配置)不受此影响。';
|
|
598
|
+
}
|
|
599
|
+
return '菜单树可读但未匹配到该列表入口:可能是租户改了菜单名,或该功能未启用。'
|
|
600
|
+
+ '可运行 ehr.recruit.context.resolve 查看 targets / warn 定位。';
|
|
601
|
+
}
|
|
602
|
+
/** 寻址结果派生:各业务列表是否定位到(供 meta.cache.targets)。 */
|
|
603
|
+
function describeTargets(cache) {
|
|
604
|
+
const lists = (cache?.lists || {});
|
|
605
|
+
const targets = {};
|
|
606
|
+
for (const key of ['talent', 'demand', 'position', 'entry', 'offer', 'interview', 'candidate', 'dict', 'biz_config']) {
|
|
607
|
+
targets[key] = !!lists[key];
|
|
608
|
+
}
|
|
609
|
+
targets.all_search = Array.isArray(lists.all_search) && lists.all_search.length > 0;
|
|
610
|
+
targets.pages = Array.isArray(lists.pages) && lists.pages.length > 0;
|
|
611
|
+
return targets;
|
|
612
|
+
}
|
|
613
|
+
function toCacheMeta(cache, source, savedAt, persisted = true) {
|
|
614
|
+
// persisted=false(degraded 残缺 / 云端不落盘)时不给 savedAt:没落盘就不该声称「有效 12h」。
|
|
615
|
+
const saved = persisted
|
|
616
|
+
? (Number(savedAt || cache?.savedAt || 0) || (source === 'rebuild' ? Date.now() : 0))
|
|
617
|
+
: 0;
|
|
618
|
+
return {
|
|
619
|
+
hit: source !== 'rebuild',
|
|
620
|
+
source,
|
|
621
|
+
persisted,
|
|
622
|
+
...(saved > 0 ? { savedAt: saved, ageMs: srcAge(saved, source) } : {}),
|
|
623
|
+
degraded: Array.isArray(cache?.degraded) ? cache.degraded : [],
|
|
624
|
+
warn: Array.isArray(cache?.warn) ? cache.warn : [],
|
|
625
|
+
...(cache?.menuShape ? { menuShape: String(cache.menuShape) } : {}),
|
|
626
|
+
targets: describeTargets(cache),
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function srcAge(saved, source) {
|
|
630
|
+
return source === 'rebuild' ? 0 : Math.max(0, Date.now() - saved);
|
|
631
|
+
}
|
|
494
632
|
export function createRecruitContextLoader() {
|
|
495
633
|
const memo = new Map();
|
|
634
|
+
let last = null;
|
|
496
635
|
async function load(host) {
|
|
497
636
|
const session = await host.getSession();
|
|
498
637
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
499
638
|
const memoKey = baseUrl;
|
|
500
|
-
//
|
|
501
|
-
//
|
|
502
|
-
|
|
503
|
-
if (cached)
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (
|
|
510
|
-
//
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (files.length === 1) {
|
|
514
|
-
appId = files[0].replace(/\.json$/, '');
|
|
515
|
-
diskCache = JSON.parse(readFileSync(join(dir, files[0]), 'utf8'));
|
|
516
|
-
}
|
|
639
|
+
// 进程内 memo:单次调用内多次 load 复用。命中条件与磁盘同口径(savedAt 新鲜 + degraded 空 +
|
|
640
|
+
// 关键字段齐),否则丢弃重来——否则常驻进程会永久短路磁盘 TTL 与健康校验。
|
|
641
|
+
const cached = memo.get(memoKey);
|
|
642
|
+
if (cached) {
|
|
643
|
+
const memoAge = Date.now() - Number(cached.savedAt || 0);
|
|
644
|
+
const memoUsable = Number(cached.savedAt || 0) > 0
|
|
645
|
+
&& memoAge <= recruitCacheTtlMs()
|
|
646
|
+
&& !(Array.isArray(cached.degraded) && cached.degraded.length)
|
|
647
|
+
&& hasCriticalFields(cached);
|
|
648
|
+
if (memoUsable) {
|
|
649
|
+
// 云端运行时从不落盘:memo 命中也必须如实报 persisted=false,否则上层会以为「已缓存 12h」。
|
|
650
|
+
last = toCacheMeta(cached, 'memo', cached.savedAt, !isXiaoECloudRuntime());
|
|
651
|
+
return cached;
|
|
517
652
|
}
|
|
653
|
+
memo.delete(memoKey);
|
|
518
654
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
return diskCache;
|
|
524
|
-
}
|
|
525
|
-
// 安装闸门:getAppIds(tag) 取 appId(空=未安装招聘服务,必须明确报错)
|
|
655
|
+
// 网页端/沙箱容器不持久:跳过磁盘读写,只留进程内 memo(每次全量解析约 2s,属设计内成本)。
|
|
656
|
+
const cloudRuntime = isXiaoECloudRuntime();
|
|
657
|
+
// 闸门前置:先取 appId 再按 <appId>.json 精确读,避免多份缓存时命中错误 appId;
|
|
658
|
+
// 只多 1 个 RTT,换取归属确定性。
|
|
526
659
|
const gate = (await host.request({
|
|
527
660
|
path: '/api/bs/ebuilder/app/tags/getAppIds',
|
|
528
661
|
query: { tag: RECRUIT_APP_TAG },
|
|
@@ -531,8 +664,26 @@ export function createRecruitContextLoader() {
|
|
|
531
664
|
if (!Array.isArray(appIds) || !appIds.length) {
|
|
532
665
|
throw new RecruitContextError('recruit_service_not_installed', '当前租户未安装招聘服务(weaver-recruit-service),无法使用招聘能力。请先在 E10 应用市场安装「招聘」应用。');
|
|
533
666
|
}
|
|
534
|
-
appId = String(appIds[0]);
|
|
535
|
-
//
|
|
667
|
+
const appId = String(appIds[0]);
|
|
668
|
+
// 磁盘缓存:按 appId 精确读(不再遍历目录)。命中条件 = 版本一致 + 通过健康检查 + 未过 TTL。
|
|
669
|
+
// 残缺/过期/降版文件留在盘上作诊断证据,重建成功后被同名覆盖。
|
|
670
|
+
if (!cloudRuntime) {
|
|
671
|
+
try {
|
|
672
|
+
const file = join(cacheDirFor(baseUrl), `${appId}.json`);
|
|
673
|
+
if (existsSync(file)) {
|
|
674
|
+
const candidate = JSON.parse(readFileSync(file, 'utf8'));
|
|
675
|
+
const savedAt = Number(candidate?.savedAt || 0);
|
|
676
|
+
const fresh = savedAt > 0 && (Date.now() - savedAt) <= recruitCacheTtlMs();
|
|
677
|
+
if (candidate && candidate.cacheVersion === RECRUIT_CACHE_VERSION && fresh && hasCriticalFields(candidate)) {
|
|
678
|
+
memo.set(memoKey, candidate);
|
|
679
|
+
last = toCacheMeta(candidate, 'disk', savedAt);
|
|
680
|
+
return candidate;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
catch { /* 缓存读取失败回退快照/全量链路 */ }
|
|
685
|
+
}
|
|
686
|
+
// 冷启动快照试用:闸门已确认 appId,再用 1 个 tag 探针确认「表单 objId 未变」,
|
|
536
687
|
// 两条都过就采用快照(省掉 allMenus / 13 份字段表 / 字典分页 / 选项 ≈ 2 s)。
|
|
537
688
|
const snapshot = readContextSnapshot(baseUrl);
|
|
538
689
|
if (snapshot && snapshot.appId === appId && !process.env.E10_RS_NO_CTX_SNAPSHOT) {
|
|
@@ -549,40 +700,75 @@ export function createRecruitContextLoader() {
|
|
|
549
700
|
tagStillMatches = false;
|
|
550
701
|
}
|
|
551
702
|
if (tagStillMatches) {
|
|
552
|
-
|
|
703
|
+
// 必须带 savedAt:memo 命中依赖它判 TTL,缺了会导致快照采纳后 memo 永不命中。
|
|
704
|
+
const adopted = { ...snapshot.resolved, cacheVersion: RECRUIT_CACHE_VERSION, savedAt: Date.now() };
|
|
553
705
|
persistContextCache(baseUrl, appId, adopted);
|
|
554
706
|
memo.set(memoKey, adopted);
|
|
707
|
+
last = toCacheMeta(adopted, 'snapshot', adopted.savedAt);
|
|
555
708
|
return adopted;
|
|
556
709
|
}
|
|
557
710
|
}
|
|
558
711
|
const resolved = await resolveRecruitEnv(host, appId);
|
|
559
|
-
// 写磁盘缓存(结构同
|
|
712
|
+
// 写磁盘缓存(结构同 v7,供后续进程/ehr 技能共享)
|
|
713
|
+
const degradedNow = Array.isArray(resolved.degraded) && resolved.degraded.length > 0;
|
|
714
|
+
const persisted = !degradedNow && !cloudRuntime;
|
|
560
715
|
persistContextCache(baseUrl, appId, { ...resolved, cacheVersion: RECRUIT_CACHE_VERSION });
|
|
561
716
|
// 同步留一份冷启动快照(下次缓存被清/版本变化时用它省掉全量重建)
|
|
562
717
|
writeContextSnapshot(baseUrl, appId, resolved);
|
|
563
|
-
|
|
564
|
-
|
|
718
|
+
const withStamp = { ...resolved, savedAt: Date.now() };
|
|
719
|
+
// 🔴 v8:degraded 非空的结果**不写 memo**。否则同一常驻进程内后续每次 load 都拿到这份
|
|
720
|
+
// 残缺上下文(dict 空),永远不会重试——「不落盘不命中」就只对磁盘生效,窗口内仍会复发。
|
|
721
|
+
if (!degradedNow)
|
|
722
|
+
memo.set(memoKey, withStamp);
|
|
723
|
+
last = toCacheMeta(withStamp, 'rebuild', withStamp.savedAt, persisted);
|
|
724
|
+
return withStamp;
|
|
565
725
|
}
|
|
566
|
-
return { load };
|
|
726
|
+
return { load, lastMeta: () => last };
|
|
567
727
|
}
|
|
568
|
-
/**
|
|
728
|
+
/** 写环境上下文磁盘缓存;失败不阻塞,可经 WEAVER_CLI_DEBUG_CACHE=1 诊断。 */
|
|
569
729
|
function persistContextCache(baseUrl, appId, cache) {
|
|
730
|
+
// 致命残缺(degraded 非空)绝不落盘,否则固化后录入会永久被拦;warn 不拦,
|
|
731
|
+
// 拦住等于把「一次适配不认识」升级成「该环境永不缓存」。
|
|
732
|
+
if (Array.isArray(cache?.degraded) && cache.degraded.length) {
|
|
733
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
734
|
+
console.error('[recruit-context] 解析存在致命降级(', cache.degraded.join(','), '),本次不落盘,下次调用将全量重建');
|
|
735
|
+
}
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE && Array.isArray(cache?.warn) && cache.warn.length) {
|
|
739
|
+
console.error('[recruit-context] 非致命提示(', cache.warn.join(','), ')menuShape=', String(cache.menuShape || ''), ',照常落盘');
|
|
740
|
+
}
|
|
741
|
+
// 网页端/沙箱容器不持久,写盘永不命中还可能只读失败,直接跳过。
|
|
742
|
+
if (isXiaoECloudRuntime())
|
|
743
|
+
return;
|
|
744
|
+
let tmp = '';
|
|
570
745
|
try {
|
|
571
746
|
const dir = cacheDirFor(baseUrl);
|
|
572
747
|
mkdirSync(dir, { recursive: true });
|
|
573
|
-
|
|
748
|
+
const file = join(dir, `${appId}.json`);
|
|
749
|
+
// 原子写:先写临时文件再 rename,避免进程中断留下半截 JSON(下次读到会白跑一次全量重建)。
|
|
750
|
+
tmp = `${file}.${process.pid}.${randHex6()}.tmp`;
|
|
751
|
+
writeFileSync(tmp, JSON.stringify({
|
|
574
752
|
__meta__: {
|
|
575
753
|
capturedAt: new Date().toISOString().replace('T', ' ').substring(0, 19),
|
|
576
754
|
note: 'recruit-ops 环境参数缓存(weaver-work-cli 运行时解析产物,不含认证字段)',
|
|
577
755
|
},
|
|
578
756
|
envKey: `${dir.split(/[\\/]/).pop()}|${appId}`,
|
|
579
|
-
cacheVersion: RECRUIT_CACHE_VERSION,
|
|
580
757
|
...cache,
|
|
758
|
+
cacheVersion: RECRUIT_CACHE_VERSION,
|
|
759
|
+
// 🔴 savedAt 必须在 ...cache 之后:防止调用方携带旧 savedAt 把新写入标成过期
|
|
760
|
+
savedAt: Date.now(),
|
|
581
761
|
}, null, 2), 'utf8');
|
|
762
|
+
renameSync(tmp, file);
|
|
582
763
|
}
|
|
583
764
|
catch (error) {
|
|
584
|
-
//
|
|
585
|
-
|
|
765
|
+
// 落盘失败不阻塞本次调用;打开 WEAVER_CLI_DEBUG_CACHE=1 可诊断(落盘坏了会表现为每次调用都慢)。
|
|
766
|
+
if (tmp) {
|
|
767
|
+
try {
|
|
768
|
+
unlinkSync(tmp);
|
|
769
|
+
}
|
|
770
|
+
catch { /* 临时文件可能根本没创建,忽略 */ }
|
|
771
|
+
}
|
|
586
772
|
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
587
773
|
console.error('[recruit-context] 缓存落盘失败:', error instanceof Error ? error.message : String(error));
|
|
588
774
|
}
|
|
@@ -723,11 +909,20 @@ const candidateSearch = {
|
|
|
723
909
|
const talentList = cache.lists.talent;
|
|
724
910
|
const talentObjId = cache.forms.talent_pool?.objId;
|
|
725
911
|
if (!talentList?.listId || !talentObjId) {
|
|
726
|
-
throw new RecruitContextError('recruit_context_missing',
|
|
912
|
+
throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「人才库」列表入口,无法搜索人才。${listUnavailableHint(cache)}`, 'permission');
|
|
727
913
|
}
|
|
728
914
|
const fields = cache.fields[talentObjId] || {};
|
|
729
|
-
const
|
|
730
|
-
const
|
|
915
|
+
const nameKey = fields.candidate_name || fields.name;
|
|
916
|
+
const mobileKey = fields.telephone;
|
|
917
|
+
// 字段缺失时不得拼出 field_undefined 去请求(平台报错不可读),按入参给出可行动的错误。
|
|
918
|
+
if (args.name && !nameKey) {
|
|
919
|
+
throw new RecruitContextError('recruit_field_missing', '人才库表单未解析到「姓名」字段(candidate_name/name),无法按姓名搜索;可改用手机号搜索。');
|
|
920
|
+
}
|
|
921
|
+
if (args.mobile && !mobileKey) {
|
|
922
|
+
throw new RecruitContextError('recruit_field_missing', '人才库表单未解析到「手机号」字段(telephone),无法按手机号搜索;可改用姓名搜索。');
|
|
923
|
+
}
|
|
924
|
+
const nameField = nameKey ? 'field_' + nameKey : '';
|
|
925
|
+
const mobileField = mobileKey ? 'field_' + mobileKey : '';
|
|
731
926
|
const conditions = {};
|
|
732
927
|
if (args.name)
|
|
733
928
|
conditions[nameField] = [{ [nameField]: args.name, [`${nameField}_condition_type`]: 'like' }];
|
|
@@ -828,7 +1023,7 @@ const candidateList = {
|
|
|
828
1023
|
const cache = await env.recruitContext.load(env.host);
|
|
829
1024
|
const listParam = cache.lists[listType.listKey];
|
|
830
1025
|
if (!listParam?.listId) {
|
|
831
|
-
throw new RecruitContextError('recruit_list_unavailable',
|
|
1026
|
+
throw new RecruitContextError('recruit_list_unavailable', `未定位到「${listType.title}」的列表入口,无法查询。${listUnavailableHint(cache)}`, 'permission');
|
|
832
1027
|
}
|
|
833
1028
|
const formObjId = cache.forms[listType.formType]?.objId;
|
|
834
1029
|
if (!formObjId) {
|
|
@@ -902,7 +1097,6 @@ const candidateList = {
|
|
|
902
1097
|
});
|
|
903
1098
|
},
|
|
904
1099
|
};
|
|
905
|
-
/** 当前登录人姓名(teamsCheck → currentUser.username),用于「我作为面试官」匹配 */
|
|
906
1100
|
/** 人员字段可能是 JSON 数组串([{name,id,...}])→ 取姓名连接;纯文本原样返回 */
|
|
907
1101
|
function personNames(value) {
|
|
908
1102
|
const text = String(value ?? '').trim();
|
|
@@ -989,7 +1183,7 @@ const interviewFeedbackTodo = {
|
|
|
989
1183
|
const listParam = cache.lists.interview;
|
|
990
1184
|
const form = cache.forms.interview_plan;
|
|
991
1185
|
if (!listParam?.listId || !form?.objId) {
|
|
992
|
-
throw new RecruitContextError('recruit_list_unavailable', '
|
|
1186
|
+
throw new RecruitContextError('recruit_list_unavailable', `未定位到「面试管理」的列表入口,无法查询待办。${listUnavailableHint(cache)}`, 'permission');
|
|
993
1187
|
}
|
|
994
1188
|
const pageSize = toNumber(args.pageSize, 'pageSize') ?? 200;
|
|
995
1189
|
const maxPages = toNumber(args.maxPages, 'maxPages') ?? 5;
|