weaver-work-cli 0.1.73 → 0.1.76
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-THZV4ND4.js → archive-ENBSUMHV.js} +14 -9
- package/dist/chunks/{archive-oa-PQ23OLEV.js → archive-oa-7BFPQ6M5.js} +10 -7
- package/dist/chunks/{asset-RGPROZYH.js → asset-V5SUD3PW.js} +10 -7
- package/dist/chunks/{asset-idle-Z2PDX7NA.js → asset-idle-3CEL7WFX.js} +7 -4
- package/dist/chunks/{attachment-content-R3RPVOYE.js → attachment-content-24RL44SE.js} +3 -3
- package/dist/chunks/{blog-7U3QZPIF.js → blog-FLI4SS3P.js} +10 -7
- package/dist/chunks/{caizhilian-3AB42GCV.js → caizhilian-7WCTKCCP.js} +10 -7
- package/dist/chunks/{calendar-KINM64E4.js → calendar-G726HUUH.js} +10 -7
- package/dist/chunks/chunk-257JXJGD.js +30 -0
- package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
- package/dist/chunks/{chunk-4BXR6CNB.js → chunk-2KW7AI6P.js} +2 -2
- package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
- package/dist/chunks/chunk-2UV4IZIT.js +473 -0
- package/dist/chunks/{chunk-R3MK2RBN.js → chunk-5E2FDXBU.js} +1 -1
- package/dist/chunks/{chunk-DRUND2PJ.js → chunk-5QUTQHXF.js} +225 -152
- package/dist/chunks/chunk-7DE3VMZD.js +35 -0
- package/dist/chunks/{chunk-PAFOLIYQ.js → chunk-AZC53XSQ.js} +1 -1
- package/dist/chunks/{chunk-6HT73VOI.js → chunk-BWFCTE43.js} +2 -2
- package/dist/chunks/{chunk-4YXAK6OA.js → chunk-FEZK536Z.js} +12 -7
- package/dist/chunks/{chunk-IU6UB2TD.js → chunk-FPWCCRKT.js} +48 -6
- package/dist/chunks/{chunk-LLCMOZ5L.js → chunk-H6N6U2D6.js} +11 -11
- package/dist/chunks/{chunk-54ST55IJ.js → chunk-JJONWB5N.js} +11 -1
- package/dist/chunks/{chunk-GWJLAF6B.js → chunk-JWF2R6EQ.js} +0 -462
- package/dist/chunks/chunk-KINXYJXM.js +205 -0
- package/dist/chunks/{chunk-F4HM25K4.js → chunk-KJA7CRES.js} +1 -1
- package/dist/chunks/chunk-L5SCNJKX.js +1166 -0
- package/dist/chunks/{chunk-TV46Q4NY.js → chunk-MS7MKBGJ.js} +74 -68
- package/dist/chunks/{chunk-XZBYRYWX.js → chunk-NZQRW4KL.js} +2 -2
- package/dist/chunks/chunk-OJ4JPD25.js +428 -0
- package/dist/chunks/chunk-OVTCWLNQ.js +1346 -0
- package/dist/chunks/{chunk-NUP4RYZK.js → chunk-PMRNIGKZ.js} +2 -2
- package/dist/chunks/{chunk-2CHGUYMG.js → chunk-Q7RXCK2Y.js} +4 -4
- package/dist/chunks/{chunk-AMAPQVBT.js → chunk-QVKRNL7L.js} +286 -305
- package/dist/chunks/{chunk-7QFVXP2X.js → chunk-R4PN3OFK.js} +8 -7
- package/dist/chunks/{chunk-L7TYG5SN.js → chunk-RVEKGVZU.js} +2 -2
- package/dist/chunks/{chunk-2XED2FKY.js → chunk-SQFKBWTR.js} +38 -36
- package/dist/chunks/chunk-SU6IJD6D.js +49 -0
- package/dist/chunks/{chunk-IBSJJGXL.js → chunk-T7HVQ2WP.js} +2 -2
- package/dist/chunks/{chunk-ZWLWXHJC.js → chunk-TBCKK6LH.js} +2 -2
- package/dist/chunks/{chunk-JMJBPP4B.js → chunk-UDBQJLQF.js} +2 -2
- package/dist/chunks/chunk-UUJK76HV.js +209 -0
- package/dist/chunks/{chunk-4I26YMBY.js → chunk-WHI6YAUE.js} +7 -3
- package/dist/chunks/{chunk-BWYVS62Z.js → chunk-WJQJ7YEX.js} +4 -4
- package/dist/chunks/{chunk-GAMGDNTF.js → chunk-XNN5PZTI.js} +1 -1
- package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
- package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
- package/dist/chunks/cli-DFLV57LO.js +226 -0
- package/dist/chunks/commands-J52MJ6NF.js +70 -0
- package/dist/chunks/{conflict-VPAR7E6F.js → conflict-72Q6DM4I.js} +2 -2
- package/dist/chunks/{contract-DDXAO2DZ.js → contract-IRNRQ5FY.js} +12446 -5964
- package/dist/chunks/{cowork-34QCHMDD.js → cowork-GZDODGKF.js} +11 -8
- package/dist/chunks/{create-flow-52PU2OBI.js → create-flow-UGTDI7SP.js} +6 -6
- package/dist/chunks/{data-CLQ62QGD.js → data-HTQZRPPI.js} +6 -3
- package/dist/chunks/{ebuilder-form-W5R7Q22S.js → ebuilder-form-GHNIZ7ET.js} +9 -6
- package/dist/chunks/{ehr-LCNAVMK5.js → ehr-PHIBBUIG.js} +23 -16
- package/dist/chunks/{entry-mode-6Z3ZV3DE.js → entry-mode-5WOXFE67.js} +3 -3
- package/dist/chunks/{env-RDKWAARB.js → env-H4ALHESA.js} +2 -2
- package/dist/chunks/{esb-ANKPUU65.js → esb-ATRKVHCD.js} +10 -7
- package/dist/chunks/{factory-434B7RAT.js → factory-COX6AVK7.js} +1 -1
- package/dist/chunks/{fna-AKBSG5HI.js → fna-IKYI3SST.js} +13 -8
- package/dist/chunks/{group-chat-PROTW22R.js → group-chat-ZIWQQO4G.js} +3 -3
- package/dist/chunks/{host-5R2SNFWD.js → host-6UOXYOOY.js} +6 -3
- package/dist/chunks/{host-7FJW4E7R.js → host-EJSJSLVK.js} +6 -3
- package/dist/chunks/{host-WO4L5G5I.js → host-EYNLB6S4.js} +6 -3
- package/dist/chunks/{host-PDJAKCT7.js → host-OT4KNR3G.js} +6 -3
- package/dist/chunks/{host-CGXUFQO4.js → host-UY4LQPN4.js} +6 -3
- package/dist/chunks/{host-XIYG4F4B.js → host-XXGDQM7D.js} +6 -3
- package/dist/chunks/{hrm-WGODDTEH.js → hrm-5JQ7QZ6A.js} +8 -5
- package/dist/chunks/{im-YKTKAJU3.js → im-2YJW3EI5.js} +7 -4
- package/dist/chunks/{invoice-PVYCCCVM.js → invoice-37HR6L3W.js} +956 -566
- package/dist/chunks/{jiuchuanhui-RKOQW7BY.js → jiuchuanhui-KBWUZ7WT.js} +17 -10
- package/dist/chunks/{lazy-dispatch-DW45AFQ5.js → lazy-dispatch-MZ3EZYDL.js} +22 -8
- package/dist/chunks/{mail-BNB5S4NW.js → mail-YBKUM6HM.js} +11 -8
- package/dist/chunks/{meeting-O2KDJH66.js → meeting-XE6CTXYA.js} +22 -18
- package/dist/chunks/{minute-doc-JUCG56GY.js → minute-doc-4BA2R5EA.js} +4 -4
- package/dist/chunks/{okr-LWFGWOE7.js → okr-HW7IULIR.js} +10 -7
- package/dist/chunks/{operations-532PN5OB.js → operations-4P2UYVLH.js} +7 -4
- package/dist/chunks/{performance-7W5COCFU.js → performance-PM2G6L3E.js} +6 -3
- package/dist/chunks/{plan-ZVY3IYTL.js → plan-3YYGZ7ZM.js} +10 -7
- package/dist/chunks/{project-SA62B7MH.js → project-XREEXFU2.js} +10 -7
- package/dist/chunks/{reception-NGIONPQ3.js → reception-7G3J2MA6.js} +8 -4
- package/dist/chunks/{recruit-stage-WOSN6MGP.js → recruit-stage-TSQWOGQD.js} +199 -74
- package/dist/chunks/register-SQOPIR2G.js +16 -0
- package/dist/chunks/{registry-N7P3W2RD.js → registry-3VTB3KLV.js} +7 -4
- package/dist/chunks/registry-7UDUWYB5.js +30 -0
- package/dist/chunks/{registry-R72GWXOG.js → registry-F4YFZLOD.js} +7 -3
- package/dist/chunks/{room-recommend-KCGIVUFR.js → room-recommend-FO3HLPNB.js} +4 -4
- package/dist/chunks/root-YZG2TS5W.js +16 -0
- package/dist/chunks/{schedule-6UP27HQ4.js → schedule-DHNNOHVS.js} +4 -4
- package/dist/chunks/{smart-extract-DDOQSPRB.js → smart-extract-T5Z4AULN.js} +15 -7
- package/dist/chunks/update-AV5VOXGY.js +13 -0
- package/dist/chunks/{workflow-V5ALD6QZ.js → workflow-MAGCHWYZ.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 +8 -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 +7 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +7 -6
- package/dist/shortcuts/ehr/operations/recruit.js +318 -248
- package/dist/shortcuts/ehr/operations/shared.js +22 -2
- 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/business-response.js +13 -0
- package/dist/shortcuts/invoice/calendar.js +24 -0
- package/dist/shortcuts/invoice/host.js +26 -15
- package/dist/shortcuts/invoice/index.js +3 -3
- package/dist/shortcuts/invoice/invoice-record.js +7 -2
- package/dist/shortcuts/invoice/manifest.js +179 -155
- package/dist/shortcuts/invoice/operations/get.js +9 -3
- package/dist/shortcuts/invoice/operations/issuing-red-requests.js +138 -0
- package/dist/shortcuts/invoice/operations/registry.js +4 -5
- package/dist/shortcuts/invoice/operations/reim-auto.js +40 -2
- package/dist/shortcuts/invoice/operations/reim-customer-projects.js +79 -0
- package/dist/shortcuts/invoice/operations/reim-customer.js +79 -30
- package/dist/shortcuts/invoice/operations/reim-relation.js +0 -146
- package/dist/shortcuts/invoice/operations/reim.js +2 -126
- package/dist/shortcuts/invoice/operations/shared.js +15 -17
- package/dist/shortcuts/invoice/preapproval-enrichment.js +180 -0
- package/dist/shortcuts/invoice/projection.js +14 -0
- package/dist/shortcuts/invoice/read-enrichment.js +123 -0
- 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/manifest.js +2 -2
- package/dist/shortcuts/recruit-stage/context.js +10 -2
- package/dist/shortcuts/recruit-stage/index.js +16 -3
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +17 -8
- package/dist/shortcuts/recruit-stage/operations/list.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +178 -35
- package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +4 -2
- package/dist/shortcuts/recruit-stage/shared.js +27 -53
- 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 +8 -2
- package/docs/agent-invoice.md +28 -2
- package/docs/contract.md +6 -1
- package/docs/e10-auth.md +25 -7
- package/docs/invoice.md +60 -9
- package/docs/operation-manual.md +15 -0
- package/package.json +2 -2
- package/skill-template/business-info.json +28 -0
- package/skill-template/domains/jinchengda.md +13 -1
- package/skill-template/domains/yepiaotong.md +36 -7
- 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-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-recruit-stage/SKILL.md +230 -202
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +74 -46
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +3 -0
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +201 -36
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +336 -27
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +3 -0
- 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 +4 -0
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +12 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +20 -18
- 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 +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +6 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +7 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +32 -25
- 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 +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +16 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +6 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +148 -40
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +32 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +6 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +41 -41
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +7 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +7 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +5 -1
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +41 -28
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +23 -26
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +44 -36
- 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/SKILL.md +133 -61
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +18 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +3 -3
- package/skills/weaver-e10-yepiaotong/references/invoice-download.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +13 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +6 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +42 -45
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +18 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +14 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-red-workflow.md +96 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +56 -369
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +16 -6
- package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +38 -0
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +163 -646
- package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +90 -44
- package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +85 -0
- package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +61 -0
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +91 -280
- package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +98 -0
- package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +48 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +234 -695
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +395 -204
- package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +84 -0
- package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +165 -0
- package/skills/weaver-e10-yepiaotong.zip +0 -0
- package/dist/chunks/chunk-ICP53R52.js +0 -2849
- package/dist/chunks/registry-RIQ67ZT7.js +0 -27
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +0 -93
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +0 -774
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +0 -111
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +0 -360
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +0 -167
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
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, toMenuList, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
7
|
+
import { compact, menuShapeOf, normalizePaged, toMenuList, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
8
8
|
import { isXiaoECloudRuntime } from '../../../internal/e10/auth/xiaoe.js';
|
|
9
9
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
10
|
// 五层运行时解析(迁移自 ehr 技能 _init_env_cache.mjs,真机验证过)
|
|
@@ -31,34 +31,23 @@ export function isSelfTenant(tenantKey) {
|
|
|
31
31
|
const key = String(tenantKey || '').trim();
|
|
32
32
|
return !!key && SELF_TENANT_KEYS.has(key);
|
|
33
33
|
}
|
|
34
|
-
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
35
|
-
/**
|
|
36
|
-
* 环境缓存结构版本:新增/变更解析字段时 +1,旧缓存自动失效重建。
|
|
37
|
-
*
|
|
38
|
-
* v5(2026-11-28 缓存治理):① 新增 savedAt/degraded 字段;② 命中规则改为
|
|
39
|
-
* 「先闸门取 appId → 精确读 <appId>.json」,旧遍历命中废除;③ 新增 12h TTL。
|
|
40
|
-
* 升版后所有旧缓存(含另一台机器上「菜单失败→字典空」固化的 v4 缓存)自动作废,
|
|
41
|
-
* 无需用户手工删除。
|
|
42
|
-
*/
|
|
43
|
-
export const RECRUIT_CACHE_VERSION = 5;
|
|
44
34
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* 但它只在主缓存 miss 后才走——主缓存命中即 return,快照的时效保护被完全短路。
|
|
50
|
-
* 现在主缓存与快照统一 12h:过期 → 快照双探针 → 全量重建,配置漂移最多 12h 自愈。
|
|
35
|
+
* 缓存结构版本:结构或健康判据变化时 +1,旧缓存自动失效重建(用户无需手工删文件)。
|
|
36
|
+
* v8 变更:字典/业务配置改 B 通道按 objId 直读(与菜单解耦);分页以「本页 0 行」判末页;
|
|
37
|
+
* options/biz_config 降为 warn;memo 补 TTL 与健康校验。
|
|
38
|
+
* v7 及更早的缓存可能含「字典残缺但 degraded 为空」的产物,必须作废。
|
|
51
39
|
*/
|
|
52
|
-
const
|
|
40
|
+
export const RECRUIT_CACHE_VERSION = 8;
|
|
53
41
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* 2026-11-06 修复(小E 演示「读取职位表单→数据节点无法解析」的根因):
|
|
57
|
-
* 旧实现 L4 `fetchFormFields` 返回空 fmap 时**静默跳过**,随后把缺 `fields[objId]` 的
|
|
58
|
-
* 上下文照常落盘;`load()` 命中缓存又只校验 `cacheVersion`,于是坏缓存长期复用,
|
|
59
|
-
* 后续 prepare / list / prefill 全部在「职位管理缺少字段 …(ds/fields 解析不到)」处中断。
|
|
60
|
-
* 现在:关键表单字段为空即抛明确错误(不落盘),且命中缓存时校验关键字段,坏缓存自动重建。
|
|
42
|
+
* 主缓存、快照、进程内 memo 统一 TTL(默认 12h),过期 → 快照双探针 → 全量重建,
|
|
43
|
+
* 使菜单改名/字段调整/字典更新最多 12h 自愈。`E10_RS_RECRUIT_CACHE_TTL_MS` 仅供排障覆盖。
|
|
61
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
|
+
/** 关键表单:字段列表为空即判上下文不可用(抛错且不落盘),避免坏缓存固化后所有操作中断。 */
|
|
62
51
|
const RECRUIT_CRITICAL_FORMS = new Set(['position_manage', 'talent_pool', 'interview_plan']);
|
|
63
52
|
/** 关键表单中文名(报错用;表单自身 objName 在解析失败时取不到,不能依赖) */
|
|
64
53
|
const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
@@ -67,35 +56,30 @@ const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
|
67
56
|
interview_plan: '面试管理',
|
|
68
57
|
};
|
|
69
58
|
/**
|
|
70
|
-
*
|
|
71
|
-
* ①
|
|
72
|
-
* ② degraded 非空
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* 这类环境由 12 h TTL 兜底:配置修正后最迟 12 h 自动重建。
|
|
59
|
+
* 磁盘缓存健康检查,任一不满足即判坏重建:
|
|
60
|
+
* ① 关键表单有 objId 且字段表非空(缺 objId 说明当初 getObjsByTag 就没解析到,同属坏缓存);
|
|
61
|
+
* ② degraded 非空 = 残缺上下文,不复用;
|
|
62
|
+
* ③ 字典 by_name 非空(封堵 v7 及更早「字典空但 degraded 空」的残缺产物)。
|
|
63
|
+
* 不判坏的两类:warn 非空(菜单形状未知/显示降级,业务有兜底)、关键业务列表未定位(菜单改名,
|
|
64
|
+
* 属环境配置问题——判坏只会让该环境永久全量解析,且列表照样报错;由 12h TTL 兜底重建)。
|
|
77
65
|
*/
|
|
78
66
|
function hasCriticalFields(cache) {
|
|
79
67
|
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
80
68
|
const objId = cache?.forms?.[logic]?.objId;
|
|
81
|
-
// 🔴 关键表单缺 objId 同样是坏缓存:说明当初 getObjsByTag 解析失败(网络抖动/权限/未装全)。
|
|
82
|
-
// 旧实现 `if (!objId) continue` 等于「没表单就不用校验字段」,把解析失败的上下文当健康缓存长期复用,
|
|
83
|
-
// 之后所有职位/人才操作都在「表单未启用」或「缺少字段」处中断——这是坏缓存的第二条产生路径。
|
|
84
69
|
if (!objId)
|
|
85
70
|
return false;
|
|
86
71
|
const fmap = cache?.fields?.[objId] || {};
|
|
87
72
|
if (!Object.keys(fmap).length)
|
|
88
73
|
return false;
|
|
89
74
|
}
|
|
90
|
-
// ② 降级标记:非空 = 残缺上下文,绝不复用(防御旧版本/外部写入的 degraded 缓存)
|
|
91
75
|
if (Array.isArray(cache?.degraded) && cache.degraded.length)
|
|
92
76
|
return false;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// 落盘后由 12h TTL 兜底:环境配置修正后最多 12h 自动重建。
|
|
77
|
+
const dictByName = cache?.dict?.by_name;
|
|
78
|
+
if (!dictByName || typeof dictByName !== 'object' || !Object.keys(dictByName).length)
|
|
79
|
+
return false;
|
|
97
80
|
return true;
|
|
98
81
|
}
|
|
82
|
+
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
99
83
|
const RECRUIT_TAGS = {
|
|
100
84
|
talent_pool: 'uf_rcrt_talent_pool',
|
|
101
85
|
interview_plan: 'uf_rcrt_interview_plan',
|
|
@@ -158,21 +142,6 @@ function cacheDirFor(baseUrl) {
|
|
|
158
142
|
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
|
|
159
143
|
return join(home, 'env-cache', 'recruit-ops', host);
|
|
160
144
|
}
|
|
161
|
-
/**
|
|
162
|
-
* 上下文快照(「冷启动预置」的零写死实现):
|
|
163
|
-
*
|
|
164
|
-
* 冷启动(缓存被清 / 版本号变化 / 换机器首次)要发 46 个请求、约 2.2 s 才把
|
|
165
|
-
* appId + 14 个表单 objId + 菜单列表 + 13 份字段表 + 数据字典 + 选项拉全。
|
|
166
|
-
* 这里在**每次成功解析后**留一份快照(含版本与时间戳),下次冷启动先试快照:
|
|
167
|
-
* - 快照未过期(12 h)且版本一致;
|
|
168
|
-
* - 两个探针通过:getAppIds 的 appId 与快照一致 + talent_pool 的 tag 仍解析到同一 objId;
|
|
169
|
-
* 才采用快照(省掉 tags×14 / allMenus / ds/fields×13 / 字典分页 / 选项 这些请求),
|
|
170
|
-
* 否则一律回退原全量重建。
|
|
171
|
-
*
|
|
172
|
-
* 为什么不用「把自用那套 id 写死进代码」:菜单名、字段、数据字典都会随环境维护变化,
|
|
173
|
-
* 写死的 id 过期后会静默写错值;快照 + 双探针 + 12 h TTL 能拿到同样的冷启动速度,且过期自动重建。
|
|
174
|
-
*/
|
|
175
|
-
const CONTEXT_SNAPSHOT_TTL_MS = 12 * 60 * 60 * 1000;
|
|
176
145
|
function snapshotPathFor(baseUrl) {
|
|
177
146
|
const url = new URL(baseUrl);
|
|
178
147
|
const host = url.hostname + (url.port ? `_${url.port}` : '');
|
|
@@ -185,7 +154,7 @@ function readContextSnapshot(baseUrl) {
|
|
|
185
154
|
const raw = JSON.parse(readFileSync(snapshotPathFor(baseUrl), 'utf8'));
|
|
186
155
|
if (!raw?.at || raw.cacheVersion !== RECRUIT_CACHE_VERSION)
|
|
187
156
|
return null;
|
|
188
|
-
if (Date.now() - raw.at >
|
|
157
|
+
if (Date.now() - raw.at > recruitCacheTtlMs())
|
|
189
158
|
return null;
|
|
190
159
|
if (!raw.resolved || !hasCriticalFields({ ...raw.resolved, appId: raw.appId }))
|
|
191
160
|
return null;
|
|
@@ -196,7 +165,8 @@ function readContextSnapshot(baseUrl) {
|
|
|
196
165
|
}
|
|
197
166
|
}
|
|
198
167
|
function writeContextSnapshot(baseUrl, appId, resolved) {
|
|
199
|
-
// 与 persistContextCache
|
|
168
|
+
// 与 persistContextCache 同口径:**致命**残缺不写快照(否则快照文件成为永不过期的残缺源);
|
|
169
|
+
// warn(菜单形状未知等)允许写,快照里的 warn/menuShape 同样经 meta.cache 暴露。
|
|
200
170
|
if (Array.isArray(resolved?.degraded) && resolved.degraded.length)
|
|
201
171
|
return;
|
|
202
172
|
if (isXiaoECloudRuntime())
|
|
@@ -240,10 +210,19 @@ export function namesOf(field) {
|
|
|
240
210
|
function isPlainId(value) {
|
|
241
211
|
return value != null && /^\d+$/.test(String(value).trim());
|
|
242
212
|
}
|
|
243
|
-
|
|
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;
|
|
244
221
|
subtype;
|
|
245
|
-
|
|
222
|
+
retryable = false;
|
|
223
|
+
constructor(subtype, message, type = 'upstream') {
|
|
246
224
|
super(message);
|
|
225
|
+
this.type = type;
|
|
247
226
|
this.subtype = subtype;
|
|
248
227
|
}
|
|
249
228
|
}
|
|
@@ -309,14 +288,49 @@ async function fetchFormFields(host, appId, objId) {
|
|
|
309
288
|
}
|
|
310
289
|
return { fmap, omap };
|
|
311
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
|
+
}
|
|
312
327
|
/** 五层解析主流程(磁盘缓存缺失时执行;每层失败必须报错,禁止臆造) */
|
|
313
328
|
async function resolveRecruitEnv(host, appId) {
|
|
314
|
-
//
|
|
329
|
+
// 解析降级标记:degraded = 致命(尝试过且失败)→ 不落盘不命中;warn = 非致命(可选依赖不可用)→ 照常落盘。
|
|
315
330
|
const degraded = [];
|
|
331
|
+
const warn = [];
|
|
316
332
|
// L2:tag 解析各表单 objId/formId(顺带 tenantKey)
|
|
317
|
-
//
|
|
318
|
-
// 保持原语义:① 任一请求失败仍向上抛(Promise.all 不吞异常,与原串行一致);
|
|
319
|
-
// ② tenantKey 仍按 RECRUIT_TAGS 声明顺序取第一个非空值(用 forEach 按序回填,不依赖完成顺序)。
|
|
333
|
+
// tag 并发拉取;任一请求失败仍向上抛,tenantKey 按 RECRUIT_TAGS 声明顺序取第一个非空值。
|
|
320
334
|
const forms = {};
|
|
321
335
|
let tenantKey = '';
|
|
322
336
|
const tagEntries = Object.entries(RECRUIT_TAGS);
|
|
@@ -335,28 +349,20 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
335
349
|
if (!tenantKey && entry?.tenantKey)
|
|
336
350
|
tenantKey = String(entry.tenantKey);
|
|
337
351
|
});
|
|
338
|
-
// L2.5
|
|
339
|
-
// 与「字段表为空」同等对待——立即报错且**不落盘**,避免把解析失败的上下文写进缓存。
|
|
352
|
+
// L2.5:关键表单必须有 objId,缺任一个即报错且**不落盘**(tag/权限/安装有问题时不得缓存)。
|
|
340
353
|
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
341
354
|
if (forms[logic]?.objId)
|
|
342
355
|
continue;
|
|
343
356
|
throw new RecruitContextError('recruit_form_unresolved', `当前环境未解析到「${RECRUIT_CRITICAL_FORM_LABELS[logic] || logic}」表单(getObjsByTag 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限后重试。`);
|
|
344
357
|
}
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
// 简历录入永远拦在「缺手动录入」。业务配置表(biz_config)有 page/list 兜底,不强制。
|
|
358
|
+
// 字典表是简历来源等字典引用字段的唯一取值源,解析不到即字典必空,按致命降级处理;
|
|
359
|
+
// 业务配置表有 page/list 兜底,不强制。
|
|
348
360
|
if (!forms.dictionary?.objId)
|
|
349
361
|
degraded.push('dict');
|
|
350
362
|
// L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
|
|
351
|
-
//
|
|
352
|
-
//
|
|
353
|
-
//
|
|
354
|
-
// 「每次冷启动都在同一处失败、且永远不再生成缓存」的死循环。
|
|
355
|
-
//
|
|
356
|
-
// 🔴 2026-11-28 缓存治理:降级必须**留痕**(degraded 标记)。只降级不留痕的话,
|
|
357
|
-
// 「菜单失败 → 数据字典菜单找不到 → 字典整段跳过 → 残缺上下文被判健康落盘」,
|
|
358
|
-
// 之后每次录入都在「简历来源缺手动录入」处被拦(2026-11-28 另一台电脑的事故现场)。
|
|
359
|
-
// 有 degraded 标记的解析结果不落盘、不命中(见 hasCriticalFields),下次自动重建。
|
|
363
|
+
// 菜单是**可选依赖**:只定位列表/页面入口,地址另有固定路由兜底。接口失败或返回结构不可控
|
|
364
|
+
// (数组/包装对象/空对象/缺字段)一律降级为空菜单继续,且只进 warn——不得阻断上下文解析,
|
|
365
|
+
// 否则该环境会「每次冷启动都在同处失败、永不生成缓存」。降级必须留痕,否则残缺上下文会被判健康落盘。
|
|
360
366
|
const flat = [];
|
|
361
367
|
const walk = (nodes) => {
|
|
362
368
|
for (const node of toMenuList(nodes)) {
|
|
@@ -367,21 +373,22 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
367
373
|
}
|
|
368
374
|
};
|
|
369
375
|
let menuFailed = false;
|
|
376
|
+
let menuShape = 'unavailable';
|
|
370
377
|
try {
|
|
371
378
|
const menuResponse = (await host.request({
|
|
372
379
|
path: '/api/cusapp/app/allMenus',
|
|
373
380
|
query: { isFront: 1, appId, terminalType: 'PC' },
|
|
374
381
|
}));
|
|
375
382
|
// 只传 data:由 toMenuList 自行识别 cusAppMenus 包装;不要再 `|| menuData` 把整个对象塞进遍历
|
|
383
|
+
menuShape = menuShapeOf(menuResponse?.data);
|
|
376
384
|
walk(menuResponse?.data);
|
|
377
385
|
}
|
|
378
386
|
catch {
|
|
379
387
|
menuFailed = true; /* 菜单不可用:降级为空菜单,后续解析与业务链路照常继续 */
|
|
380
388
|
}
|
|
381
|
-
//
|
|
382
|
-
// 0 节点说明返回结构异常或权限不足,字典/列表解析必残缺。
|
|
389
|
+
// 菜单不可用(失败/形状未知/0 节点)只进 warn:只做寻址、不做授权,不决定业务成败。
|
|
383
390
|
if (menuFailed || !flat.length)
|
|
384
|
-
|
|
391
|
+
warn.push('menus');
|
|
385
392
|
const searchMenus = [];
|
|
386
393
|
const pages = [];
|
|
387
394
|
for (const node of flat) {
|
|
@@ -398,8 +405,7 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
398
405
|
const resolvedForms = Object.entries(forms).filter(([, v]) => v.objId);
|
|
399
406
|
await Promise.all(resolvedForms.map(async ([logic, entry]) => {
|
|
400
407
|
const { fmap, omap } = await fetchFormFields(host, appId, entry.objId);
|
|
401
|
-
//
|
|
402
|
-
// 非关键表单(辅助配置表等)允许为空,保持旧行为,避免误伤部分环境。
|
|
408
|
+
// 关键表单字段为空必须报错;非关键表单(辅助配置表)允许为空。
|
|
403
409
|
if (!Object.keys(fmap).length && RECRUIT_CRITICAL_FORMS.has(logic)) {
|
|
404
410
|
throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「${entry.objName || logic}」表单的字段列表(ds/fields 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限,或删除环境缓存后重试。`);
|
|
405
411
|
}
|
|
@@ -408,124 +414,118 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
408
414
|
if (Object.keys(omap).length)
|
|
409
415
|
fieldOptions[entry.objId] = omap;
|
|
410
416
|
}));
|
|
411
|
-
// L5
|
|
412
|
-
//
|
|
413
|
-
//
|
|
417
|
+
// L5:数据字典全量映射(字典引用类字段如渠道的 optionId 来源)
|
|
418
|
+
// 走 B 通道按 objId 直读:字典是招聘自己的配置表,可用性与「数据字典」菜单可见性无关。
|
|
419
|
+
// 旧实现靠菜单拿 listId,菜单权限未放开时字典整段跳过,简历录入会被「缺手动录入」拦住。
|
|
414
420
|
const dictByName = {};
|
|
415
421
|
const dictRaw = [];
|
|
416
|
-
const dictMenu = searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null;
|
|
417
422
|
const dictObjId = forms.dictionary?.objId || '';
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
for (const response of responses) {
|
|
442
|
-
const rows = response?.data?.data || [];
|
|
443
|
-
for (const row of rows) {
|
|
444
|
-
const name = row.selection_name;
|
|
445
|
-
const optionId = row.form_data_id;
|
|
446
|
-
if (name && optionId) {
|
|
447
|
-
(dictByName[String(name)] ||= []).push(String(optionId));
|
|
448
|
-
dictRaw.push({ selection_name: String(name), option_id: String(optionId), dict_type: row.dict_type, browser_key: row.browser_key });
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (rows.length < size) {
|
|
452
|
-
reachedEnd = true;
|
|
453
|
-
break;
|
|
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;
|
|
434
|
+
if (name && optionId) {
|
|
435
|
+
(dictByName[String(name)] ||= []).push(String(optionId));
|
|
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
|
+
});
|
|
454
446
|
}
|
|
455
447
|
}
|
|
456
|
-
pageNo += CONCURRENCY;
|
|
457
448
|
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
451
|
+
console.error('[recruit-context] 字典读取失败:', error instanceof Error ? error.message : String(error));
|
|
452
|
+
}
|
|
453
|
+
degraded.push('dict'); /* 字典拉取失败:留痕降级,残缺 dict 不落盘 */
|
|
454
|
+
}
|
|
455
|
+
// 一条字典都没拉到:要么接口静默失败,要么字典表真没配。按「尝试过且失败」处理。
|
|
456
|
+
if (!Object.keys(dictByName).length)
|
|
457
|
+
degraded.push('dict');
|
|
458
458
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// 两种都按残缺处理——环境配好后下次重建即恢复。
|
|
464
|
-
if (!Object.keys(dictByName).length)
|
|
465
|
-
degraded.push('dict');
|
|
466
|
-
}
|
|
467
|
-
// 人才卡片页面 id(L1 业务配置表 config_key=28 前台可查;L2 page/list 兜底,失败不阻塞)+ 泛微自用标记
|
|
459
|
+
};
|
|
460
|
+
// 人才卡片页面 id(业务配置表 config_key=28;page/list 兜底)+ 泛微自用标记
|
|
461
|
+
// 业务配置表同样走 B 通道按 objId 直读,不依赖菜单可见性;
|
|
462
|
+
// config_key 是 Select,B 通道取 fieldOptionId(与 A 通道扁平值同义)。
|
|
468
463
|
let ebdDetailPageId = '';
|
|
469
464
|
let selfUse = '0';
|
|
470
465
|
const bizConfig = forms.biz_config || { objId: '', formId: '', objName: '' };
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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;
|
|
518
517
|
}
|
|
519
518
|
}
|
|
520
|
-
|
|
519
|
+
}
|
|
520
|
+
catch {
|
|
521
|
+
warn.push(`options:${dataKey}`); /* 枚举拉取失败:非致命,仅提示 */
|
|
521
522
|
}
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
//
|
|
527
|
-
//
|
|
528
|
-
// 导致下游(人才卡片链接、简历导入、面试反馈)漏拼 &recruitType=useSelf 而取错数据。
|
|
525
|
+
};
|
|
526
|
+
await Promise.all([loadDict(), loadBizConfig(), loadDsOptions()]);
|
|
527
|
+
// 自用租户兜底:配置表要经表单权限才能读,任一环节缺失 selfUse 恒为 '0',
|
|
528
|
+
// 会导致下游漏拼 &recruitType=useSelf 而取错数据;tenantKey 是平台级唯一标识,最可靠。
|
|
529
529
|
if (isSelfTenant(tenantKey))
|
|
530
530
|
selfUse = '1';
|
|
531
531
|
if (!ebdDetailPageId) {
|
|
@@ -543,34 +543,13 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
543
543
|
}
|
|
544
544
|
catch { /* 后台权限不足不阻塞,保持空 */ }
|
|
545
545
|
}
|
|
546
|
-
// ds/options 兼容通道(人才库 recruit_status/channel;字典引用类返回空则跳过)
|
|
547
|
-
// 🔴 2026-11-28:拉取失败从「炸整链」改为降级留痕——枚举失败不该让上下文解析整体失败。
|
|
548
|
-
const options = {};
|
|
549
|
-
for (const [dataKey, logic] of [['recruit_status', 'talent_pool'], ['channel', 'talent_pool']]) {
|
|
550
|
-
const entry = forms[logic] || { objId: '', formId: '', objName: '' };
|
|
551
|
-
const fieldId = (fields[entry.objId] || {})[dataKey] || '';
|
|
552
|
-
if (fieldId && entry.objId) {
|
|
553
|
-
try {
|
|
554
|
-
const response = (await host.request({
|
|
555
|
-
path: '/api/ebuilder/common/ds/options',
|
|
556
|
-
query: { fieldName: fieldId, objId: entry.objId, sourceType: 'FORM', groupId: appId },
|
|
557
|
-
}));
|
|
558
|
-
if (Array.isArray(response?.data)) {
|
|
559
|
-
options[dataKey] = {};
|
|
560
|
-
for (const option of response.data) {
|
|
561
|
-
if (option?.id)
|
|
562
|
-
options[dataKey][String(option.id)] = option.name;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
catch {
|
|
567
|
-
degraded.push(`options:${dataKey}`); /* 枚举拉取失败:留痕降级 */
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
546
|
const lists = {
|
|
572
547
|
talent: null, demand: null, position: null, entry: null, offer: null,
|
|
573
|
-
|
|
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,
|
|
574
553
|
all_search: searchMenus, pages,
|
|
575
554
|
};
|
|
576
555
|
for (const [biz, keywords] of Object.entries(LIST_KEYWORDS)) {
|
|
@@ -581,10 +560,22 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
581
560
|
}
|
|
582
561
|
}
|
|
583
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)];
|
|
584
573
|
return {
|
|
585
574
|
appId,
|
|
586
575
|
tenantKey,
|
|
587
|
-
degraded,
|
|
576
|
+
degraded: dedupe(degraded),
|
|
577
|
+
warn: dedupe(warn),
|
|
578
|
+
menuShape,
|
|
588
579
|
forms,
|
|
589
580
|
lists,
|
|
590
581
|
fields,
|
|
@@ -595,26 +586,76 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
595
586
|
selfUse,
|
|
596
587
|
};
|
|
597
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
|
+
}
|
|
598
632
|
export function createRecruitContextLoader() {
|
|
599
633
|
const memo = new Map();
|
|
634
|
+
let last = null;
|
|
600
635
|
async function load(host) {
|
|
601
636
|
const session = await host.getSession();
|
|
602
637
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
603
638
|
const memoKey = baseUrl;
|
|
604
|
-
// 进程内 memo
|
|
605
|
-
//
|
|
606
|
-
|
|
607
|
-
if (cached)
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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;
|
|
652
|
+
}
|
|
653
|
+
memo.delete(memoKey);
|
|
654
|
+
}
|
|
655
|
+
// 网页端/沙箱容器不持久:跳过磁盘读写,只留进程内 memo(每次全量解析约 2s,属设计内成本)。
|
|
612
656
|
const cloudRuntime = isXiaoECloudRuntime();
|
|
613
|
-
//
|
|
614
|
-
//
|
|
615
|
-
// 命中时根本不知道当前 appId,只能靠「目录内恰好 1 个 json」间接保证;多份缓存
|
|
616
|
-
// (换 appId / 重装 / 另一套工具写入)时会随机命中错误的 appId。前置闸门只多花
|
|
617
|
-
// 1 个 RTT(相对全量解析 46 个请求可忽略),换来归属确定性。
|
|
657
|
+
// 闸门前置:先取 appId 再按 <appId>.json 精确读,避免多份缓存时命中错误 appId;
|
|
658
|
+
// 只多 1 个 RTT,换取归属确定性。
|
|
618
659
|
const gate = (await host.request({
|
|
619
660
|
path: '/api/bs/ebuilder/app/tags/getAppIds',
|
|
620
661
|
query: { tag: RECRUIT_APP_TAG },
|
|
@@ -632,9 +673,10 @@ export function createRecruitContextLoader() {
|
|
|
632
673
|
if (existsSync(file)) {
|
|
633
674
|
const candidate = JSON.parse(readFileSync(file, 'utf8'));
|
|
634
675
|
const savedAt = Number(candidate?.savedAt || 0);
|
|
635
|
-
const fresh = savedAt > 0 && (Date.now() - savedAt) <=
|
|
676
|
+
const fresh = savedAt > 0 && (Date.now() - savedAt) <= recruitCacheTtlMs();
|
|
636
677
|
if (candidate && candidate.cacheVersion === RECRUIT_CACHE_VERSION && fresh && hasCriticalFields(candidate)) {
|
|
637
678
|
memo.set(memoKey, candidate);
|
|
679
|
+
last = toCacheMeta(candidate, 'disk', savedAt);
|
|
638
680
|
return candidate;
|
|
639
681
|
}
|
|
640
682
|
}
|
|
@@ -658,41 +700,55 @@ export function createRecruitContextLoader() {
|
|
|
658
700
|
tagStillMatches = false;
|
|
659
701
|
}
|
|
660
702
|
if (tagStillMatches) {
|
|
661
|
-
|
|
703
|
+
// 必须带 savedAt:memo 命中依赖它判 TTL,缺了会导致快照采纳后 memo 永不命中。
|
|
704
|
+
const adopted = { ...snapshot.resolved, cacheVersion: RECRUIT_CACHE_VERSION, savedAt: Date.now() };
|
|
662
705
|
persistContextCache(baseUrl, appId, adopted);
|
|
663
706
|
memo.set(memoKey, adopted);
|
|
707
|
+
last = toCacheMeta(adopted, 'snapshot', adopted.savedAt);
|
|
664
708
|
return adopted;
|
|
665
709
|
}
|
|
666
710
|
}
|
|
667
711
|
const resolved = await resolveRecruitEnv(host, appId);
|
|
668
|
-
// 写磁盘缓存(结构同
|
|
712
|
+
// 写磁盘缓存(结构同 v7,供后续进程/ehr 技能共享)
|
|
713
|
+
const degradedNow = Array.isArray(resolved.degraded) && resolved.degraded.length > 0;
|
|
714
|
+
const persisted = !degradedNow && !cloudRuntime;
|
|
669
715
|
persistContextCache(baseUrl, appId, { ...resolved, cacheVersion: RECRUIT_CACHE_VERSION });
|
|
670
716
|
// 同步留一份冷启动快照(下次缓存被清/版本变化时用它省掉全量重建)
|
|
671
717
|
writeContextSnapshot(baseUrl, appId, resolved);
|
|
672
|
-
|
|
673
|
-
|
|
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;
|
|
674
725
|
}
|
|
675
|
-
return { load };
|
|
726
|
+
return { load, lastMeta: () => last };
|
|
676
727
|
}
|
|
677
|
-
/**
|
|
728
|
+
/** 写环境上下文磁盘缓存;失败不阻塞,可经 WEAVER_CLI_DEBUG_CACHE=1 诊断。 */
|
|
678
729
|
function persistContextCache(baseUrl, appId, cache) {
|
|
679
|
-
//
|
|
680
|
-
//
|
|
681
|
-
// 快照采纳路径(load 内 tagStillMatches)不会带 degraded:快照写入时若 resolved 残缺,
|
|
682
|
-
// resolveRecruitEnv 的返回值本身带标记,此处同样拦截。
|
|
730
|
+
// 致命残缺(degraded 非空)绝不落盘,否则固化后录入会永久被拦;warn 不拦,
|
|
731
|
+
// 拦住等于把「一次适配不认识」升级成「该环境永不缓存」。
|
|
683
732
|
if (Array.isArray(cache?.degraded) && cache.degraded.length) {
|
|
684
733
|
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
685
|
-
console.error('[recruit-context]
|
|
734
|
+
console.error('[recruit-context] 解析存在致命降级(', cache.degraded.join(','), '),本次不落盘,下次调用将全量重建');
|
|
686
735
|
}
|
|
687
736
|
return;
|
|
688
737
|
}
|
|
689
|
-
|
|
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
|
+
// 网页端/沙箱容器不持久,写盘永不命中还可能只读失败,直接跳过。
|
|
690
742
|
if (isXiaoECloudRuntime())
|
|
691
743
|
return;
|
|
744
|
+
let tmp = '';
|
|
692
745
|
try {
|
|
693
746
|
const dir = cacheDirFor(baseUrl);
|
|
694
747
|
mkdirSync(dir, { recursive: true });
|
|
695
|
-
|
|
748
|
+
const file = join(dir, `${appId}.json`);
|
|
749
|
+
// 原子写:先写临时文件再 rename,避免进程中断留下半截 JSON(下次读到会白跑一次全量重建)。
|
|
750
|
+
tmp = `${file}.${process.pid}.${randHex6()}.tmp`;
|
|
751
|
+
writeFileSync(tmp, JSON.stringify({
|
|
696
752
|
__meta__: {
|
|
697
753
|
capturedAt: new Date().toISOString().replace('T', ' ').substring(0, 19),
|
|
698
754
|
note: 'recruit-ops 环境参数缓存(weaver-work-cli 运行时解析产物,不含认证字段)',
|
|
@@ -703,10 +759,16 @@ function persistContextCache(baseUrl, appId, cache) {
|
|
|
703
759
|
// 🔴 savedAt 必须在 ...cache 之后:防止调用方携带旧 savedAt 把新写入标成过期
|
|
704
760
|
savedAt: Date.now(),
|
|
705
761
|
}, null, 2), 'utf8');
|
|
762
|
+
renameSync(tmp, file);
|
|
706
763
|
}
|
|
707
764
|
catch (error) {
|
|
708
|
-
//
|
|
709
|
-
|
|
765
|
+
// 落盘失败不阻塞本次调用;打开 WEAVER_CLI_DEBUG_CACHE=1 可诊断(落盘坏了会表现为每次调用都慢)。
|
|
766
|
+
if (tmp) {
|
|
767
|
+
try {
|
|
768
|
+
unlinkSync(tmp);
|
|
769
|
+
}
|
|
770
|
+
catch { /* 临时文件可能根本没创建,忽略 */ }
|
|
771
|
+
}
|
|
710
772
|
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
711
773
|
console.error('[recruit-context] 缓存落盘失败:', error instanceof Error ? error.message : String(error));
|
|
712
774
|
}
|
|
@@ -847,11 +909,20 @@ const candidateSearch = {
|
|
|
847
909
|
const talentList = cache.lists.talent;
|
|
848
910
|
const talentObjId = cache.forms.talent_pool?.objId;
|
|
849
911
|
if (!talentList?.listId || !talentObjId) {
|
|
850
|
-
throw new RecruitContextError('recruit_context_missing',
|
|
912
|
+
throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「人才库」列表入口,无法搜索人才。${listUnavailableHint(cache)}`, 'permission');
|
|
851
913
|
}
|
|
852
914
|
const fields = cache.fields[talentObjId] || {};
|
|
853
|
-
const
|
|
854
|
-
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 : '';
|
|
855
926
|
const conditions = {};
|
|
856
927
|
if (args.name)
|
|
857
928
|
conditions[nameField] = [{ [nameField]: args.name, [`${nameField}_condition_type`]: 'like' }];
|
|
@@ -952,7 +1023,7 @@ const candidateList = {
|
|
|
952
1023
|
const cache = await env.recruitContext.load(env.host);
|
|
953
1024
|
const listParam = cache.lists[listType.listKey];
|
|
954
1025
|
if (!listParam?.listId) {
|
|
955
|
-
throw new RecruitContextError('recruit_list_unavailable',
|
|
1026
|
+
throw new RecruitContextError('recruit_list_unavailable', `未定位到「${listType.title}」的列表入口,无法查询。${listUnavailableHint(cache)}`, 'permission');
|
|
956
1027
|
}
|
|
957
1028
|
const formObjId = cache.forms[listType.formType]?.objId;
|
|
958
1029
|
if (!formObjId) {
|
|
@@ -1026,7 +1097,6 @@ const candidateList = {
|
|
|
1026
1097
|
});
|
|
1027
1098
|
},
|
|
1028
1099
|
};
|
|
1029
|
-
/** 当前登录人姓名(teamsCheck → currentUser.username),用于「我作为面试官」匹配 */
|
|
1030
1100
|
/** 人员字段可能是 JSON 数组串([{name,id,...}])→ 取姓名连接;纯文本原样返回 */
|
|
1031
1101
|
function personNames(value) {
|
|
1032
1102
|
const text = String(value ?? '').trim();
|
|
@@ -1113,7 +1183,7 @@ const interviewFeedbackTodo = {
|
|
|
1113
1183
|
const listParam = cache.lists.interview;
|
|
1114
1184
|
const form = cache.forms.interview_plan;
|
|
1115
1185
|
if (!listParam?.listId || !form?.objId) {
|
|
1116
|
-
throw new RecruitContextError('recruit_list_unavailable', '
|
|
1186
|
+
throw new RecruitContextError('recruit_list_unavailable', `未定位到「面试管理」的列表入口,无法查询待办。${listUnavailableHint(cache)}`, 'permission');
|
|
1117
1187
|
}
|
|
1118
1188
|
const pageSize = toNumber(args.pageSize, 'pageSize') ?? 200;
|
|
1119
1189
|
const maxPages = toNumber(args.maxPages, 'maxPages') ?? 5;
|