weaver-work-cli 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{archive-S2VKZWQ3.js → archive-BLDYBZDX.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-3GJ3TWXR.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-AFXJN4CK.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-VUJXWGWJ.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-VMJA7NSQ.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-EREB35VU.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-ATM2JO5S.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-E26ZIH7S.js} +5 -4
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-4OB22YKE.js} +48 -12
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-5CY37VLS.js} +131 -38
- package/dist/chunks/{chunk-EGANE35F.js → chunk-6G2JARDK.js} +1 -1
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-6VCQLZXE.js} +75 -76
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-BY3WDJO5.js} +1 -1
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-C5PIGPGX.js} +5 -3
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-EOZHSNND.js} +2 -2
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-G3ZM57PD.js} +2 -2
- package/dist/chunks/{chunk-XT77MP54.js → chunk-GOBNIGWS.js} +410 -24
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-GQK6WLOS.js} +5 -3
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-HEJPVXD3.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-I4C2KR2G.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-IGICM3WJ.js} +2 -2
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-LOVAIGM2.js} +387 -70
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-OMAGCLUE.js} +5 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-QAMIIFP6.js} +11 -11
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-QZYKZ7MQ.js} +16 -8
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-RR45ELVE.js} +30 -24
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-RV2JAA5I.js} +89 -8
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-SDPC7BG2.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-SHBDXEUE.js} +4 -7
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-THMBDCRA.js} +5 -3
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-TNFIUZ4H.js} +3 -3
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-WPBZQVLS.js} +1 -1
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-AMNTM3FV.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-PLO2V2NO.js} +2333 -4426
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-FZAXE6FO.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-2DAUN7HU.js} +16 -6
- package/dist/chunks/{data-FOODGAMF.js → data-7NXMWET4.js} +3 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-DEYHX6M7.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-QQH2DYYA.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-2JTVEKMP.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-2JZMXC6I.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-I5ZFHJUK.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-XIATYHU6.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-3V2TL6B2.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-CVYUZCOQ.js} +3 -3
- package/dist/chunks/{host-TJ5VVHM7.js → host-4DP7C7YQ.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-4KQCAEWA.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-4X2F3JPQ.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-BD7NAM33.js} +4 -4
- package/dist/chunks/{host-VTPAWDZV.js → host-CBONEAZS.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-L37QVNIV.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-OL3IKN7C.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-YXQWUF3R.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-4WY32PR2.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-L6SHLONH.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-OYE6QV24.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-PZV2KNRU.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-6SOBCC6N.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-KSJSJNOH.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-B76FW5M2.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-YOMEGFLV.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-4VBKUPFO.js} +5 -4
- package/dist/chunks/{plan-BLGPZF5M.js → plan-HBNZRQTI.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-IV6FWK74.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-BR5YURT6.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-4HQ6OGXT.js} +654 -336
- package/dist/chunks/{registry-I4DVPDMU.js → registry-7LICMV5J.js} +12 -12
- package/dist/chunks/{registry-3FYSWV3U.js → registry-JFQEFC7E.js} +3 -3
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-MZJQX65Q.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-43GLLE7Y.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-ZQ42BEW6.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-QKAEAZGM.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-6HV7H5PC.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +21 -1
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +115 -270
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +98 -25
- package/dist/shortcuts/contract/operations/ledger.js +315 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +289 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +264 -0
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/triage.js +13 -6
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +116 -7
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +28 -0
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +237 -347
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +109 -185
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +12 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +18 -17
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +73 -104
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +32 -37
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +70 -82
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +37 -33
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +94 -27
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +9 -15
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +9 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +59 -32
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +7 -5
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +21 -13
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +13 -13
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +11 -20
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +203 -54
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +4 -11
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +31 -33
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +83 -531
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +3 -1
- package/skills/weaver-e10-meeting/references/create-guardrails.md +14 -8
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +10 -10
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -1,449 +1,499 @@
|
|
|
1
1
|
import { hrmValidationError } from '../errors.js';
|
|
2
|
-
import { browserBaseBody, orgLink, } from './shared.js';
|
|
3
2
|
import { READ, SCHEMA_ID, hrmSuccess, schemaOf, } from './types.js';
|
|
3
|
+
import { browserBaseBody, orgLink, pickDefined, toNumber, toStringIdList, } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* 多维(companyVirtual)查询。
|
|
6
|
+
*
|
|
7
|
+
* 业务场景:E10 的组织树被拆成若干「多维」(虚拟组织维度,如「行政组织」「1号维度」…),
|
|
8
|
+
* 同名部门/分部在不同维度下是**不同节点**。因此「按名称找部门」必须先用多维名称定位多维 id,
|
|
9
|
+
* 再以该 id 作为浏览接口的 `companyId` 收敛,否则默认落到「行政组织」维度。
|
|
10
|
+
*
|
|
11
|
+
* 全部匹配逻辑(多步调用 + 精确/模糊匹配 + 歧义判定)都在本文件内一次完成,
|
|
12
|
+
* 调用方(Agent)只需一次调用即可拿到结果或候选清单,不需要多轮推理。
|
|
13
|
+
*/
|
|
14
|
+
const ORG_TYPES = ['department', 'subcompany'];
|
|
15
|
+
/** 组织浏览接口单页上限(与 SKILL.md「分页统一约束」一致,禁止放大取值)。 */
|
|
16
|
+
const BROWSE_PAGE_SIZE = 100;
|
|
17
|
+
/** 歧义时最多回传的候选数,防止大结果整段进入上下文。 */
|
|
18
|
+
const MAX_CANDIDATES = 20;
|
|
19
|
+
/** 候选上限的硬顶(入参 `maxCandidates` 允许的最大值)。 */
|
|
20
|
+
const MAX_CANDIDATES_LIMIT = 200;
|
|
21
|
+
/** 「近似名称」建议条数(仅提示,绝不参与自动解析)。 */
|
|
22
|
+
const SUGGESTION_LIMIT = 5;
|
|
23
|
+
/** 名称近似度阈值:只认「打字/口误级」差异(4 字名错 1 字 = 0.75),不做语义联想。 */
|
|
24
|
+
const NEAR_NAME_THRESHOLD = 0.6;
|
|
4
25
|
const VIRTUAL_PATH = '/api/bs/hrm/companyVirtual/listCompanyVirtual';
|
|
26
|
+
const DEPT_PATH = '/api/hrm/common/browser/data/department';
|
|
27
|
+
const SUB_PATH = '/api/hrm/common/browser/data/subcompany';
|
|
5
28
|
const ORG_DETAIL_PATH = '/api/bs/hrm/organization/getForm';
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** 名称匹配忽略大小写、全半角差异和多余空白。 */
|
|
14
|
-
function normalizedName(value) {
|
|
15
|
-
return text(value).normalize('NFKC').replace(/\s+/gu, '').toLocaleLowerCase();
|
|
16
|
-
}
|
|
17
|
-
function normalizePath(value) {
|
|
18
|
-
return text(value)
|
|
19
|
-
.split(/[|/]+/u)
|
|
20
|
-
.map((part) => part.trim())
|
|
21
|
-
.filter(Boolean)
|
|
22
|
-
.join('/');
|
|
23
|
-
}
|
|
24
|
-
function idValue(value, field) {
|
|
25
|
-
const valueText = text(value);
|
|
26
|
-
if (!/^\d+$/u.test(valueText)) {
|
|
27
|
-
throw hrmValidationError('id_invalid', `${field} 必须是数字 ID`);
|
|
28
|
-
}
|
|
29
|
-
return valueText;
|
|
29
|
+
/** 浏览接口需要 HRM 页面上下文,缺失会让网关长时间无响应;用录制页面最稳。 */
|
|
30
|
+
const BROWSER_REFERER = '/hrm/addressbook/department';
|
|
31
|
+
function optionalText(value) {
|
|
32
|
+
if (value === undefined || value === null)
|
|
33
|
+
return undefined;
|
|
34
|
+
const text = String(value).trim();
|
|
35
|
+
return text === '' ? undefined : text;
|
|
30
36
|
}
|
|
31
|
-
function
|
|
37
|
+
function optionalId(value, field) {
|
|
32
38
|
if (value === undefined || value === null || value === '')
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
if (!Number.isInteger(numeric) || numeric < 1 || numeric > MAX_CANDIDATES) {
|
|
36
|
-
throw hrmValidationError('number_invalid', `maxCandidates 必须是 1~${MAX_CANDIDATES} 的整数`);
|
|
37
|
-
}
|
|
38
|
-
return numeric;
|
|
39
|
+
return undefined;
|
|
40
|
+
return toStringIdList(value, field)?.[0];
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return
|
|
43
|
-
if (!item.id || seen.has(item.id))
|
|
44
|
-
return false;
|
|
45
|
-
seen.add(item.id);
|
|
46
|
-
return true;
|
|
47
|
-
});
|
|
42
|
+
/** 名称归一化:折叠空白、去首尾空格(多语言名称里全角空格也会被折叠)。 */
|
|
43
|
+
function normalizeName(value) {
|
|
44
|
+
return String(value ?? '').replace(/\s+/g, ' ').trim();
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
/**
|
|
47
|
+
* 名称匹配:**精确优先**(忽略大小写与空白差异),无精确命中时退化为**包含模糊**。
|
|
48
|
+
* 命中数量由调用方判定:1 个 → 继续;多个 → 视为歧义并要求用户确认。
|
|
49
|
+
*/
|
|
50
|
+
function matchByName(items, keyword) {
|
|
51
|
+
const key = normalizeName(keyword).toLowerCase();
|
|
52
|
+
if (!key)
|
|
53
|
+
return { matchType: 'none', items: [] };
|
|
54
|
+
const exact = items.filter((item) => normalizeName(item.name).toLowerCase() === key);
|
|
55
|
+
if (exact.length > 0)
|
|
56
|
+
return { matchType: 'exact', items: exact };
|
|
57
|
+
const fuzzy = items.filter((item) => normalizeName(item.name).toLowerCase().includes(key));
|
|
58
|
+
return fuzzy.length > 0 ? { matchType: 'fuzzy', items: fuzzy } : { matchType: 'none', items: [] };
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
/** 取全量多维(虚拟组织维度)。该接口一次返回全部,无需分页。 */
|
|
61
|
+
async function fetchVirtuals(host, baseUrl) {
|
|
62
|
+
const resp = await host.request({
|
|
63
|
+
method: 'GET',
|
|
64
|
+
path: VIRTUAL_PATH,
|
|
65
|
+
headers: { Referer: `${baseUrl}${BROWSER_REFERER}` },
|
|
66
|
+
});
|
|
67
|
+
const raw = resp?.data;
|
|
68
|
+
if (!Array.isArray(raw))
|
|
69
|
+
return [];
|
|
70
|
+
return raw
|
|
71
|
+
.map((item) => ({ id: String(item?.id ?? ''), name: normalizeName(item?.content ?? item?.name) }))
|
|
72
|
+
.filter((item) => item.id !== '' && item.name !== '');
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
74
|
+
/** 按维度 + 名称浏览部门/分部;`exact` 决定服务端条件(等于 / 包含)。 */
|
|
75
|
+
async function browseOrg(host, baseUrl, options) {
|
|
76
|
+
const { type, virtualId, name, exact } = options;
|
|
77
|
+
const body = {
|
|
78
|
+
...browserBaseBody(),
|
|
79
|
+
virtualType: 'ALL',
|
|
80
|
+
cmd: 'list',
|
|
81
|
+
current: 1,
|
|
82
|
+
// 浏览分页只服务于「取候选」:输出侧另有 maxCandidates 截断,故按上限放宽(仍 ≤ 200)。
|
|
83
|
+
pageSize: options.pageSize ?? BROWSE_PAGE_SIZE,
|
|
84
|
+
formDatas: {
|
|
85
|
+
name: [
|
|
86
|
+
{
|
|
87
|
+
nameCondition: { id: exact ? 'eq' : 'in', content: exact ? '等于' : '包含', disabled: false },
|
|
88
|
+
name,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
quickSearchDatas: {},
|
|
93
|
+
type: 'and',
|
|
94
|
+
stopDepartment: false,
|
|
95
|
+
// companyId = 多维 id;不传会默认落到「行政组织」维度。
|
|
96
|
+
companyId: virtualId,
|
|
97
|
+
};
|
|
98
|
+
if (type === 'department')
|
|
99
|
+
body.enableSubcompany = false;
|
|
100
|
+
const resp = await host.request({
|
|
101
|
+
method: 'POST',
|
|
102
|
+
path: type === 'department' ? DEPT_PATH : SUB_PATH,
|
|
103
|
+
body,
|
|
104
|
+
headers: { Referer: `${baseUrl}${BROWSER_REFERER}` },
|
|
105
|
+
});
|
|
106
|
+
const data = resp?.data ?? {};
|
|
107
|
+
const rows = Array.isArray(data.data) ? data.data : [];
|
|
108
|
+
return { rows, total: Number(data.total ?? rows.length) };
|
|
77
109
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
110
|
+
/**
|
|
111
|
+
* 上级路径:部门行在 `supDepartment`、分部行在 `supSubDepartment`;
|
|
112
|
+
* 两者都没有时退化为解析 `title`(形如 `名称|上级路径`,根节点无 `|`)。
|
|
113
|
+
* ⚠️ 不同租户上游用的层级分隔符不一致(实测:木林泉用 `/`、泛微网络租户用 `|`),
|
|
114
|
+
* 本函数统一归一化为 `/`,保证 `fullPath`/`parentPath` 跨环境可读且格式一致。
|
|
115
|
+
*/
|
|
116
|
+
function parentPathOf(row) {
|
|
117
|
+
const direct = normalizeName(row?.supDepartment ?? row?.supSubDepartment ?? '');
|
|
118
|
+
if (direct)
|
|
119
|
+
return direct.replace(/\s*\|\s*/g, '/');
|
|
120
|
+
const title = typeof row?.title === 'string' ? row.title : '';
|
|
121
|
+
const sep = title.indexOf('|');
|
|
122
|
+
return sep >= 0 ? normalizeName(title.slice(sep + 1)).replace(/\s*\|\s*/g, '/') : '';
|
|
85
123
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const name = text(row.name);
|
|
92
|
-
if (title && name && title.startsWith(`${name}|`)) {
|
|
93
|
-
return normalizePath(title.slice(name.length + 1));
|
|
94
|
-
}
|
|
95
|
-
return '';
|
|
124
|
+
/** 全路径 = 上级路径/名称(上级路径已含多维名,如 `1号维度/超级组织66/第一团队`)。 */
|
|
125
|
+
function fullPathOf(row) {
|
|
126
|
+
const parentPath = parentPathOf(row);
|
|
127
|
+
const name = normalizeName(row?.name ?? '');
|
|
128
|
+
return parentPath ? `${parentPath}/${name}` : name;
|
|
96
129
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
const parentPath = orgPath(row, type);
|
|
101
|
-
const rawFullPath = normalizePath(row.fullPath);
|
|
102
|
-
const fullPath = rawFullPath || (parentPath ? `${parentPath}/${name}` : name);
|
|
103
|
-
const virtualName = parentPath.split('/')[0] || virtual.name;
|
|
104
|
-
const parentId = text(row.parent?.id ?? row.parent);
|
|
105
|
-
const subcompanyId = text(row.subcompanyid ?? row.subcompanyId);
|
|
106
|
-
const virtualId = text(row.virtualid ?? row.virtualId) || virtual.id;
|
|
130
|
+
/** 命中组织的输出(只保留决策与后续调用需要的信息)。 */
|
|
131
|
+
function formatOrg(row, baseUrl, virtualName) {
|
|
132
|
+
const parentPath = parentPathOf(row);
|
|
107
133
|
return {
|
|
108
|
-
id,
|
|
109
|
-
name,
|
|
110
|
-
type:
|
|
111
|
-
|
|
112
|
-
fullPath,
|
|
134
|
+
id: String(row?.id ?? ''),
|
|
135
|
+
name: normalizeName(row?.name ?? ''),
|
|
136
|
+
type: String(row?.type ?? ''),
|
|
137
|
+
fullPath: fullPathOf(row),
|
|
113
138
|
...(parentPath ? { parentPath } : {}),
|
|
114
|
-
...(
|
|
115
|
-
...(
|
|
116
|
-
virtualId,
|
|
117
|
-
virtualName,
|
|
118
|
-
...(row
|
|
119
|
-
|
|
139
|
+
...(row?.parent ? { parentId: String(row.parent) } : {}),
|
|
140
|
+
...(row?.subcompanyid ? { subcompanyId: String(row.subcompanyid) } : {}),
|
|
141
|
+
...(row?.virtualid ? { virtualId: String(row.virtualid) } : {}),
|
|
142
|
+
...(virtualName ? { virtualName } : {}),
|
|
143
|
+
...(row?.hasSub === true ? { hasSub: true } : {}),
|
|
144
|
+
...pickDefined(row, ['code', 'shortname', 'description', 'remark', 'status']),
|
|
145
|
+
link: orgLink(baseUrl, row?.id),
|
|
120
146
|
};
|
|
121
147
|
}
|
|
122
|
-
|
|
123
|
-
|
|
148
|
+
/** 歧义候选(比命中结果更瘦,便于一次列多个)。 */
|
|
149
|
+
function formatCandidate(row, baseUrl) {
|
|
124
150
|
return {
|
|
125
|
-
id:
|
|
126
|
-
name:
|
|
127
|
-
type:
|
|
128
|
-
fullPath:
|
|
129
|
-
...(
|
|
130
|
-
link:
|
|
151
|
+
id: String(row?.id ?? ''),
|
|
152
|
+
name: normalizeName(row?.name ?? ''),
|
|
153
|
+
type: String(row?.type ?? ''),
|
|
154
|
+
fullPath: fullPathOf(row),
|
|
155
|
+
...(row?.code ? { code: String(row.code) } : {}),
|
|
156
|
+
link: orgLink(baseUrl, row?.id),
|
|
131
157
|
};
|
|
132
158
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
135
|
-
?
|
|
136
|
-
:
|
|
159
|
+
function capCandidates(items, limit) {
|
|
160
|
+
return items.length > limit
|
|
161
|
+
? { items: items.slice(0, limit), truncated: true }
|
|
162
|
+
: { items, truncated: false };
|
|
137
163
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
formDatas: {
|
|
150
|
-
name: [{
|
|
151
|
-
nameCondition: {
|
|
152
|
-
id: condition,
|
|
153
|
-
content: condition === 'eq' ? '等于' : '包含',
|
|
154
|
-
disabled: false,
|
|
155
|
-
},
|
|
156
|
-
name: keyword,
|
|
157
|
-
}],
|
|
158
|
-
},
|
|
159
|
-
quickSearchDatas: {},
|
|
160
|
-
type: 'and',
|
|
161
|
-
stopDepartment: false,
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
const data = response?.data ?? {};
|
|
165
|
-
const rows = Array.isArray(data.data) ? data.data : [];
|
|
166
|
-
const reportedTotal = Number(data.total);
|
|
167
|
-
return {
|
|
168
|
-
type,
|
|
169
|
-
rows,
|
|
170
|
-
total: Number.isFinite(reportedTotal) ? reportedTotal : rows.length,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
async function browseTypes(host, types, virtualId, keyword, condition, pageSize) {
|
|
174
|
-
return Promise.all(types.map((type) => browseOrg(host, type, virtualId, keyword, condition, pageSize)));
|
|
164
|
+
/** 候选上限:默认 20,可由入参 `maxCandidates` 提高到 200(防止大结果撑爆上下文)。 */
|
|
165
|
+
function resolveCandidateLimit(value) {
|
|
166
|
+
if (value === undefined || value === null || value === '')
|
|
167
|
+
return MAX_CANDIDATES;
|
|
168
|
+
const limit = toNumber(value, 'maxCandidates');
|
|
169
|
+
if (limit === undefined)
|
|
170
|
+
return MAX_CANDIDATES;
|
|
171
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > MAX_CANDIDATES_LIMIT) {
|
|
172
|
+
throw hrmValidationError('number_invalid', `maxCandidates 必须是 1~${MAX_CANDIDATES_LIMIT} 的整数`);
|
|
173
|
+
}
|
|
174
|
+
return limit;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
/** Levenshtein 编辑距离(只用于给名称近似度打分,参与比较的列表规模很小)。 */
|
|
177
|
+
function editDistance(a, b) {
|
|
178
|
+
const m = a.length;
|
|
179
|
+
const n = b.length;
|
|
180
|
+
if (m === 0)
|
|
181
|
+
return n;
|
|
182
|
+
if (n === 0)
|
|
183
|
+
return m;
|
|
184
|
+
let prev = Array.from({ length: n + 1 }, (_, index) => index);
|
|
185
|
+
for (let i = 1; i <= m; i += 1) {
|
|
186
|
+
const current = new Array(n + 1);
|
|
187
|
+
current[0] = i;
|
|
188
|
+
for (let j = 1; j <= n; j += 1) {
|
|
189
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
190
|
+
current[j] = Math.min(prev[j] + 1, current[j - 1] + 1, prev[j - 1] + cost);
|
|
191
|
+
}
|
|
192
|
+
prev = current;
|
|
193
|
+
}
|
|
194
|
+
return prev[n];
|
|
182
195
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
196
|
+
function similarity(a, b) {
|
|
197
|
+
const longest = Math.max(a.length, b.length);
|
|
198
|
+
return longest === 0 ? 1 : 1 - editDistance(a, b) / longest;
|
|
185
199
|
}
|
|
186
|
-
|
|
187
|
-
|
|
200
|
+
/**
|
|
201
|
+
* 「近似名称」建议:按相似度排序、阈值内只认打字级差异(如「客服维度」→「客户维度」)。
|
|
202
|
+
*
|
|
203
|
+
* 🔴 结果**只用于提示**,绝不参与自动解析——名称不存在时必须让用户确认,不能由 CLI/Agent 替用户改名。
|
|
204
|
+
* 已被「包含」模糊命中过的名称不算近似(那条路径本来就会自动继续,属既定契约)。
|
|
205
|
+
*/
|
|
206
|
+
function nearNameSuggestions(items, keyword, limit) {
|
|
207
|
+
const key = normalizeName(keyword).toLowerCase();
|
|
208
|
+
if (!key)
|
|
209
|
+
return [];
|
|
210
|
+
return items
|
|
211
|
+
.map((item) => ({ item, name: normalizeName(item.name).toLowerCase() }))
|
|
212
|
+
.filter((entry) => entry.name !== '' && !entry.name.includes(key))
|
|
213
|
+
.map((entry) => ({ item: entry.item, score: similarity(key, entry.name) }))
|
|
214
|
+
.filter((entry) => entry.score >= NEAR_NAME_THRESHOLD)
|
|
215
|
+
.sort((a, b) => b.score - a.score)
|
|
216
|
+
.slice(0, limit)
|
|
217
|
+
.map((entry) => entry.item);
|
|
188
218
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const subcompany = results.find((result) => result.type === 'subcompany');
|
|
201
|
-
const departmentCount = department ? Math.max(department.total, department.rows.length) : 0;
|
|
202
|
-
const subcompanyCount = subcompany ? Math.max(subcompany.total, subcompany.rows.length) : 0;
|
|
203
|
-
if (departmentCount === 1 && department?.rows[0]) {
|
|
204
|
-
return {
|
|
205
|
-
selected: { type: 'department', row: department.rows[0] },
|
|
206
|
-
alternatives: (subcompany?.rows ?? []).map((row) => ({ type: 'subcompany', row })),
|
|
207
|
-
ambiguous: false,
|
|
208
|
-
};
|
|
219
|
+
/**
|
|
220
|
+
* 组织级「近似名称」探测:真未找到时,用关键字**末 2 字 / 首 2 字**各做一次包含查询(≤2 次)。
|
|
221
|
+
* 同样**只提示不解析**:中文组织名后缀信息量最大(经理/部/科/中心…),故先试末 2 字。
|
|
222
|
+
*/
|
|
223
|
+
async function probeNearOrgNames(host, baseUrl, options) {
|
|
224
|
+
const { type, virtualId, keyword, pageSize } = options;
|
|
225
|
+
const keys = [];
|
|
226
|
+
for (const candidate of [keyword.slice(-2), keyword.slice(0, 2)]) {
|
|
227
|
+
const key = candidate.trim();
|
|
228
|
+
if (key.length >= 2 && key !== keyword && !keys.includes(key))
|
|
229
|
+
keys.push(key);
|
|
209
230
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
231
|
+
for (const key of keys) {
|
|
232
|
+
const result = await browseOrg(host, baseUrl, { type, virtualId, name: key, exact: false, pageSize });
|
|
233
|
+
if (result.rows.length > 0)
|
|
234
|
+
return { rows: result.rows, total: result.total, key };
|
|
214
235
|
}
|
|
215
|
-
return {
|
|
236
|
+
return { rows: [], total: 0, key: '' };
|
|
216
237
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return
|
|
223
|
-
candidates,
|
|
224
|
-
candidateTotal,
|
|
225
|
-
truncated: candidateTotal > candidates.length,
|
|
226
|
-
};
|
|
238
|
+
function typeLabel(type) {
|
|
239
|
+
if (type === 'department')
|
|
240
|
+
return '部门';
|
|
241
|
+
if (type === 'subcompany')
|
|
242
|
+
return '分部';
|
|
243
|
+
return '组织(部门/分部)';
|
|
227
244
|
}
|
|
228
|
-
|
|
229
|
-
|
|
245
|
+
/** 用户已确认组织 id 时直接读详情,跳过名称匹配。 */
|
|
246
|
+
async function fetchOrgById(host, baseUrl, id) {
|
|
247
|
+
const resp = await host.request({
|
|
230
248
|
method: 'GET',
|
|
231
249
|
path: ORG_DETAIL_PATH,
|
|
232
|
-
query: { id
|
|
233
|
-
headers: { Referer: `${baseUrl}/sp/hrm/orgCard/${
|
|
250
|
+
query: { id, readOnly: true, includeSub: true, quote: true, isMobile: false },
|
|
251
|
+
headers: { Referer: `${baseUrl}/sp/hrm/orgCard/${id}` },
|
|
234
252
|
});
|
|
235
|
-
const raw =
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
const subcompanyName = Array.isArray(raw.subcompany) ? text(raw.subcompany[0]?.name) : '';
|
|
239
|
-
const fullPath = normalizePath(raw.fullPath);
|
|
240
|
-
const pathParts = fullPath.split('/').filter(Boolean);
|
|
253
|
+
const raw = resp?.data?.data ?? {};
|
|
254
|
+
const parentName = Array.isArray(raw.parent) && raw.parent[0]?.name ? String(raw.parent[0].name) : '';
|
|
255
|
+
const subcompanyName = Array.isArray(raw.subcompany) && raw.subcompany[0]?.name ? String(raw.subcompany[0].name) : '';
|
|
241
256
|
return {
|
|
242
|
-
id
|
|
243
|
-
name:
|
|
244
|
-
type,
|
|
245
|
-
...(
|
|
246
|
-
...(fullPath ? { fullPath } : {}),
|
|
247
|
-
...(pathParts.length > 1 ? { parentPath: pathParts.slice(0, -1).join('/') } : {}),
|
|
257
|
+
id,
|
|
258
|
+
name: normalizeName(raw.name),
|
|
259
|
+
type: raw.type,
|
|
260
|
+
...pickDefined(raw, ['code', 'fullPath', 'status']),
|
|
248
261
|
...(parentName ? { parentName } : {}),
|
|
249
262
|
...(subcompanyName ? { subcompanyName } : {}),
|
|
250
|
-
|
|
251
|
-
virtualName: virtual.name,
|
|
252
|
-
...(raw.status !== undefined ? { status: raw.status } : {}),
|
|
253
|
-
link: orgLink(baseUrl, orgId),
|
|
263
|
+
link: orgLink(baseUrl, id),
|
|
254
264
|
};
|
|
255
265
|
}
|
|
256
|
-
function relaxedKeywords(name) {
|
|
257
|
-
const characters = [...text(name)];
|
|
258
|
-
if (characters.length <= 2)
|
|
259
|
-
return [characters.join('')].filter(Boolean);
|
|
260
|
-
const suffix = characters.slice(-2).join('');
|
|
261
|
-
const prefix = characters.slice(0, 2).join('');
|
|
262
|
-
return suffix === prefix ? [suffix] : [suffix, prefix];
|
|
263
|
-
}
|
|
264
|
-
async function nearOrgSuggestions(host, type, virtual, name, pageSize, baseUrl) {
|
|
265
|
-
const results = [];
|
|
266
|
-
const seen = new Set();
|
|
267
|
-
for (const keyword of relaxedKeywords(name)) {
|
|
268
|
-
const result = await browseOrg(host, type, virtual.id, keyword, 'in', pageSize);
|
|
269
|
-
for (const row of result.rows) {
|
|
270
|
-
const id = text(row.id);
|
|
271
|
-
if (!id || seen.has(id))
|
|
272
|
-
continue;
|
|
273
|
-
seen.add(id);
|
|
274
|
-
results.push(orgCandidate(row, type, baseUrl, virtual));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return results;
|
|
278
|
-
}
|
|
279
266
|
const orgResolve = {
|
|
280
267
|
name: 'hrm.org.resolve',
|
|
281
268
|
resource: 'org',
|
|
282
269
|
method: 'org.resolve',
|
|
283
270
|
action: 'hrm.org.resolve',
|
|
284
|
-
summary: '
|
|
271
|
+
summary: '按「多维名称 + 部门/分部名称」解析组织:自动取全量多维→精确优先/模糊兜底匹配→按维度查组织;歧义时返回候选待用户确认',
|
|
285
272
|
risk: READ,
|
|
286
273
|
inputSchema: schemaOf({
|
|
287
|
-
virtual: { type: 'string',
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
maxCandidates: {
|
|
274
|
+
virtual: { type: 'string', description: '多维名称(如「行政组织」「1号维度」);精确优先,未命中按包含模糊匹配' },
|
|
275
|
+
name: { type: 'string', description: '部门或分部名称;精确优先,未命中按包含模糊匹配' },
|
|
276
|
+
type: { type: 'string', enum: [...ORG_TYPES], description: `department 部门 / subcompany 分部;不传时同时检索两者、按部门优先定位,并把同名另一类型节点回在 alsoMatched` },
|
|
277
|
+
virtualId: { ...SCHEMA_ID, description: '多维 id;用户确认后复调可直接传,跳过维度名称匹配' },
|
|
278
|
+
orgId: { ...SCHEMA_ID, description: '组织节点 id;用户确认后复调可直接传,跳过名称匹配' },
|
|
279
|
+
maxCandidates: { ...SCHEMA_ID, description: `歧义时最多回传的候选条数,1~${MAX_CANDIDATES_LIMIT},默认 ${MAX_CANDIDATES}` },
|
|
280
|
+
}, {
|
|
281
|
+
description: '首调必填 virtual + name;复调可用 virtualId / orgId 直接定位。结果以 data.status 判定(resolved / ambiguous / not_found)。',
|
|
293
282
|
}),
|
|
294
283
|
handler: async (args, { host }) => {
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const orgId = args.orgId === undefined ? '' : idValue(args.orgId, 'orgId');
|
|
299
|
-
if (!virtualKeyword && !virtualId) {
|
|
300
|
-
throw hrmValidationError('virtual_required', 'virtual 或 virtualId 至少传一个');
|
|
284
|
+
const typeArg = optionalText(args.type);
|
|
285
|
+
if (typeArg && !ORG_TYPES.includes(typeArg)) {
|
|
286
|
+
throw hrmValidationError('enum_invalid', `type 取值必须是 ${ORG_TYPES.join(' / ')} 之一`);
|
|
301
287
|
}
|
|
302
|
-
|
|
303
|
-
|
|
288
|
+
const nameArg = optionalText(args.name) ?? '';
|
|
289
|
+
const virtualArg = optionalText(args.virtual) ?? '';
|
|
290
|
+
const virtualIdArg = optionalId(args.virtualId, 'virtualId');
|
|
291
|
+
const orgIdArg = optionalId(args.orgId, 'orgId');
|
|
292
|
+
const candidateLimit = resolveCandidateLimit(args.maxCandidates);
|
|
293
|
+
const browsePageSize = Math.max(BROWSE_PAGE_SIZE, candidateLimit);
|
|
294
|
+
if (!virtualArg && !virtualIdArg) {
|
|
295
|
+
throw hrmValidationError('virtual_required', '必须提供多维名称 virtual,或用户已确认的多维 id virtualId');
|
|
304
296
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (explicitType && !ORG_TYPES.includes(requestedType)) {
|
|
308
|
-
throw hrmValidationError('enum_invalid', `type 取值必须是 ${ORG_TYPES.join(' / ')} 之一`);
|
|
297
|
+
if (!nameArg && !orgIdArg) {
|
|
298
|
+
throw hrmValidationError('name_required', '必须提供部门/分部名称 name,或用户已确认的组织 id orgId');
|
|
309
299
|
}
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
const pageSize = Math.max(100, maxCandidates);
|
|
315
|
-
const virtualResponse = await host.request({ method: 'GET', path: VIRTUAL_PATH });
|
|
316
|
-
const virtuals = readVirtuals(virtualResponse);
|
|
300
|
+
const session = await host.getSession();
|
|
301
|
+
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
302
|
+
// ── ① 定位多维 ────────────────────────────────────────────────
|
|
303
|
+
const dimensions = await fetchVirtuals(host, baseUrl);
|
|
317
304
|
let virtual;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
virtual =
|
|
321
|
-
virtualMatchType = 'id';
|
|
305
|
+
if (virtualIdArg) {
|
|
306
|
+
const hit = dimensions.find((item) => item.id === virtualIdArg);
|
|
307
|
+
virtual = { id: virtualIdArg, name: hit?.name ?? '', keyword: virtualArg || virtualIdArg, matchType: 'id' };
|
|
322
308
|
}
|
|
323
309
|
else {
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const
|
|
310
|
+
const outcome = matchByName(dimensions, virtualArg);
|
|
311
|
+
if (outcome.matchType === 'none') {
|
|
312
|
+
// 不存在 → 只报「无此多维」+ 近似名称,**不自动降级到近似项**(避免替用户改名)。
|
|
313
|
+
const near = nearNameSuggestions(dimensions, virtualArg, SUGGESTION_LIMIT);
|
|
314
|
+
const nearText = near.length
|
|
315
|
+
? `近似名称:${near.map((item) => item.name).join('、')}。请先让用户确认是否指其中之一,**不要自行替换名称重试**;确认后把对应 id 作为 virtualId 复调。`
|
|
316
|
+
: '';
|
|
317
|
+
const listText = dimensions.length
|
|
318
|
+
? `当前租户可用多维(${dimensions.length} 个):${dimensions.map((item) => item.name).join('、')}。`
|
|
319
|
+
: '未取到多维清单。';
|
|
320
|
+
return hrmSuccess('hrm.org.resolve', {
|
|
321
|
+
status: 'not_found',
|
|
322
|
+
stage: 'virtual',
|
|
323
|
+
matchType: 'none',
|
|
324
|
+
virtual: null,
|
|
325
|
+
type: typeArg ?? null,
|
|
326
|
+
suggestions: near.map((item) => ({ id: item.id, name: item.name })),
|
|
327
|
+
suggestionTotal: near.length,
|
|
328
|
+
candidates: [],
|
|
329
|
+
candidateTotal: 0,
|
|
330
|
+
truncated: false,
|
|
331
|
+
availableVirtuals: dimensions,
|
|
332
|
+
message: `多维「${virtualArg}」不存在。${nearText}${listText}`,
|
|
333
|
+
}, { virtualTotal: dimensions.length });
|
|
334
|
+
}
|
|
335
|
+
if (outcome.items.length > 1) {
|
|
336
|
+
const capped = capCandidates(outcome.items.map((item) => ({ id: item.id, name: item.name })), candidateLimit);
|
|
332
337
|
return hrmSuccess('hrm.org.resolve', {
|
|
333
338
|
status: 'ambiguous',
|
|
334
339
|
stage: 'virtual',
|
|
340
|
+
matchType: outcome.matchType,
|
|
335
341
|
virtual: null,
|
|
336
|
-
|
|
337
|
-
candidates,
|
|
338
|
-
candidateTotal:
|
|
339
|
-
truncated:
|
|
340
|
-
message: `多维「${
|
|
341
|
-
});
|
|
342
|
+
type: typeArg ?? null,
|
|
343
|
+
candidates: capped.items,
|
|
344
|
+
candidateTotal: outcome.items.length,
|
|
345
|
+
truncated: capped.truncated,
|
|
346
|
+
message: `多维「${virtualArg}」${outcome.matchType === 'exact' ? '精确' : '模糊'}匹配到 ${outcome.items.length} 个维度,请让用户确认使用哪一个,然后用返回的 id 作为 virtualId 重新调用本操作。`,
|
|
347
|
+
}, { virtualTotal: dimensions.length });
|
|
342
348
|
}
|
|
343
|
-
virtual =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const suggestionText = suggestions.length > 0
|
|
350
|
-
? `;近似名称:${suggestions.map((item) => item.name).join('、')}。不要自行替换名称,请先让用户确认`
|
|
351
|
-
: '';
|
|
352
|
-
return hrmSuccess('hrm.org.resolve', {
|
|
353
|
-
status: 'not_found',
|
|
354
|
-
stage: 'virtual',
|
|
355
|
-
virtual: null,
|
|
356
|
-
matchType: 'none',
|
|
357
|
-
candidates: [],
|
|
358
|
-
candidateTotal: 0,
|
|
359
|
-
suggestions,
|
|
360
|
-
suggestionTotal: suggestions.length,
|
|
361
|
-
availableVirtuals: virtuals,
|
|
362
|
-
message: `多维${target}不存在${suggestionText}。当前可用多维:${available || '无'}。`,
|
|
363
|
-
});
|
|
349
|
+
virtual = {
|
|
350
|
+
id: outcome.items[0].id,
|
|
351
|
+
name: outcome.items[0].name,
|
|
352
|
+
keyword: virtualArg,
|
|
353
|
+
matchType: outcome.matchType,
|
|
354
|
+
};
|
|
364
355
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
keyword: virtualKeyword,
|
|
369
|
-
matchType: virtualMatchType,
|
|
370
|
-
};
|
|
371
|
-
const session = await host.getSession();
|
|
372
|
-
const baseUrl = session.baseUrl.replace(/\/+$/u, '');
|
|
373
|
-
if (orgId) {
|
|
374
|
-
const org = await resolveOrgId(host, orgId, baseUrl, virtual);
|
|
356
|
+
// ── ② 用户已确认组织 id:直接读详情 ────────────────────────────
|
|
357
|
+
if (orgIdArg) {
|
|
358
|
+
const org = await fetchOrgById(host, baseUrl, orgIdArg);
|
|
375
359
|
return hrmSuccess('hrm.org.resolve', {
|
|
376
360
|
status: 'resolved',
|
|
377
361
|
stage: 'org',
|
|
378
362
|
matchType: 'id',
|
|
379
|
-
|
|
380
|
-
|
|
363
|
+
virtual,
|
|
364
|
+
type: org.type ?? typeArg ?? null,
|
|
381
365
|
org,
|
|
382
|
-
|
|
383
|
-
|
|
366
|
+
candidates: [],
|
|
367
|
+
candidateTotal: 0,
|
|
368
|
+
truncated: false,
|
|
369
|
+
message: `已按组织 id 读取${typeLabel(org.type ?? null)}「${org.name || orgIdArg}」(多维:${virtual.name || virtual.id})。`,
|
|
370
|
+
}, { searchedTypes: [] });
|
|
384
371
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
matches = fuzzyResults;
|
|
397
|
-
matchType = 'fuzzy';
|
|
398
|
-
}
|
|
399
|
-
choice = resolvedFromMatches(matches, explicitType);
|
|
372
|
+
const searchedTypes = typeArg ? [typeArg] : ['department', 'subcompany'];
|
|
373
|
+
const queried = [];
|
|
374
|
+
// ── ③ 精确匹配(服务端 eq):唯一命中即定位,多命中即歧义 ──
|
|
375
|
+
// 不传 type 时**先查完部门与分部再判定**,同名另一类型节点(如同一个客户下既有同名分部又有同名部门)
|
|
376
|
+
// 会随结果一起回传,避免「静默二选一」。
|
|
377
|
+
const exactHits = [];
|
|
378
|
+
for (const type of searchedTypes) {
|
|
379
|
+
const result = await browseOrg(host, baseUrl, { type, virtualId: virtual.id, name: nameArg, exact: true, pageSize: browsePageSize });
|
|
380
|
+
queried.push(type);
|
|
381
|
+
if (result.rows.length > 0)
|
|
382
|
+
exactHits.push({ type, rows: result.rows });
|
|
400
383
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
|
|
384
|
+
const uniqueHit = exactHits.find((hit) => hit.rows.length === 1);
|
|
385
|
+
if (uniqueHit) {
|
|
386
|
+
const org = formatOrg(uniqueHit.rows[0], baseUrl, virtual.name);
|
|
387
|
+
// 同名但属于另一类型(部门/分部)的节点:显式回传,供用户改选
|
|
388
|
+
const alsoMatched = capCandidates(exactHits
|
|
389
|
+
.filter((hit) => hit !== uniqueHit)
|
|
390
|
+
.flatMap((hit) => hit.rows)
|
|
391
|
+
.map((row) => formatCandidate(row, baseUrl)), candidateLimit);
|
|
392
|
+
const alsoNote = alsoMatched.items.length
|
|
393
|
+
? `⚠️ 另有同名节点 ${alsoMatched.items.length} 个(${alsoMatched.items.map((item) => typeLabel(String(item.type ?? ''))).join('、')}),见 alsoMatched;如需改用它们,按 type 或 orgId 复调。`
|
|
407
394
|
: '';
|
|
408
395
|
return hrmSuccess('hrm.org.resolve', {
|
|
409
396
|
status: 'resolved',
|
|
410
397
|
stage: 'org',
|
|
411
|
-
matchType,
|
|
412
|
-
|
|
413
|
-
|
|
398
|
+
matchType: 'exact',
|
|
399
|
+
virtual,
|
|
400
|
+
type: uniqueHit.type,
|
|
414
401
|
org,
|
|
415
|
-
...(alsoMatched.length
|
|
416
|
-
|
|
417
|
-
|
|
402
|
+
...(alsoMatched.items.length ? { alsoMatched: alsoMatched.items, alsoMatchedTruncated: alsoMatched.truncated } : {}),
|
|
403
|
+
candidates: [],
|
|
404
|
+
candidateTotal: 1,
|
|
405
|
+
truncated: false,
|
|
406
|
+
message: `精确命中${typeLabel(uniqueHit.type)}「${org.name}」(多维:${virtual.name})。${alsoNote}`,
|
|
407
|
+
}, { searchedTypes: queried });
|
|
418
408
|
}
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
const
|
|
409
|
+
if (exactHits.length > 0) {
|
|
410
|
+
const pool = exactHits.flatMap((hit) => hit.rows);
|
|
411
|
+
const capped = capCandidates(pool.map((row) => formatCandidate(row, baseUrl)), candidateLimit);
|
|
422
412
|
return hrmSuccess('hrm.org.resolve', {
|
|
423
413
|
status: 'ambiguous',
|
|
424
414
|
stage: 'org',
|
|
425
|
-
matchType,
|
|
426
|
-
virtual
|
|
427
|
-
|
|
428
|
-
|
|
415
|
+
matchType: 'exact',
|
|
416
|
+
virtual,
|
|
417
|
+
type: exactHits.length === 1 ? exactHits[0].type : typeArg ?? null,
|
|
418
|
+
candidates: capped.items,
|
|
419
|
+
candidateTotal: pool.length,
|
|
420
|
+
truncated: capped.truncated,
|
|
421
|
+
message: `名称「${nameArg}」在多维「${virtual.name}」下精确匹配到 ${pool.length} 个节点(同名不同层级),请让用户确认使用哪一个,然后用返回的 id 作为 orgId 重新调用本操作。`,
|
|
422
|
+
}, { searchedTypes: queried });
|
|
423
|
+
}
|
|
424
|
+
// ── ④ 模糊匹配(服务端 包含):单命中继续,多命中要用户确认 ────
|
|
425
|
+
const fuzzyRows = [];
|
|
426
|
+
let fuzzyServerTotal = 0;
|
|
427
|
+
for (const type of searchedTypes) {
|
|
428
|
+
const result = await browseOrg(host, baseUrl, { type, virtualId: virtual.id, name: nameArg, exact: false, pageSize: browsePageSize });
|
|
429
|
+
if (result.rows.length > 0)
|
|
430
|
+
fuzzyRows.push(...result.rows);
|
|
431
|
+
fuzzyServerTotal += result.total;
|
|
432
|
+
}
|
|
433
|
+
// 模糊结果里再优先取「忽略大小写后完全相等」的行(服务端 eq 可能受全角/空格影响)。
|
|
434
|
+
const exactLike = fuzzyRows.filter((row) => normalizeName(row.name).toLowerCase() === nameArg.toLowerCase());
|
|
435
|
+
const pool = exactLike.length > 0 ? exactLike : fuzzyRows;
|
|
436
|
+
if (pool.length === 0) {
|
|
437
|
+
// 真未找到 → 只报「无此名称」+ 近似名称,**不自动降级到近似项**(避免替用户改名)。
|
|
438
|
+
const probe = await probeNearOrgNames(host, baseUrl, {
|
|
439
|
+
type: searchedTypes[0],
|
|
440
|
+
virtualId: virtual.id,
|
|
441
|
+
keyword: nameArg,
|
|
442
|
+
pageSize: browsePageSize,
|
|
429
443
|
});
|
|
444
|
+
const suggestions = capCandidates(probe.rows.map((row) => formatCandidate(row, baseUrl)), SUGGESTION_LIMIT);
|
|
445
|
+
const nearText = suggestions.items.length
|
|
446
|
+
? `近似名称(含相似关键字「${probe.key}」,共 ${probe.total} 个,本次列 ${suggestions.items.length} 个,见 suggestions):${suggestions.items
|
|
447
|
+
.map((item) => item.name)
|
|
448
|
+
.join('、')}。请让用户确认名称,**不要自行替换名称重试**。`
|
|
449
|
+
: '';
|
|
450
|
+
return hrmSuccess('hrm.org.resolve', {
|
|
451
|
+
status: 'not_found',
|
|
452
|
+
stage: 'org',
|
|
453
|
+
matchType: 'none',
|
|
454
|
+
virtual,
|
|
455
|
+
type: typeArg ?? null,
|
|
456
|
+
suggestions: suggestions.items,
|
|
457
|
+
suggestionTotal: probe.rows.length ? probe.total : 0,
|
|
458
|
+
candidates: [],
|
|
459
|
+
candidateTotal: 0,
|
|
460
|
+
truncated: false,
|
|
461
|
+
message: `多维「${virtual.name}」下未找到名称包含「${nameArg}」的${typeLabel(typeArg ? typeArg : null)}${typeArg ? '' : '(已同时检索部门与分部)'}。${nearText}如确无名称可匹配,请让用户补充更多关键字。`,
|
|
462
|
+
}, { searchedTypes });
|
|
463
|
+
}
|
|
464
|
+
const effectiveMatch = exactLike.length > 0 ? 'exact' : 'fuzzy';
|
|
465
|
+
if (pool.length === 1) {
|
|
466
|
+
const org = formatOrg(pool[0], baseUrl, virtual.name);
|
|
467
|
+
return hrmSuccess('hrm.org.resolve', {
|
|
468
|
+
status: 'resolved',
|
|
469
|
+
stage: 'org',
|
|
470
|
+
matchType: effectiveMatch,
|
|
471
|
+
virtual,
|
|
472
|
+
type: String(pool[0].type ?? ''),
|
|
473
|
+
org,
|
|
474
|
+
candidates: [],
|
|
475
|
+
candidateTotal: 1,
|
|
476
|
+
truncated: false,
|
|
477
|
+
message: `${effectiveMatch === 'exact' ? '精确' : '模糊'}命中唯一${typeLabel(String(pool[0].type ?? ''))}「${org.name}」(多维:${virtual.name})。${effectiveMatch === 'fuzzy' ? '命中方式为模糊包含匹配,如与预期不符请让用户核对名称。' : ''}`,
|
|
478
|
+
}, { searchedTypes });
|
|
430
479
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
const
|
|
435
|
-
const suggestionMessage = suggestions.length > 0
|
|
436
|
-
? `;找到近似名称 ${suggestions.map((item) => item.name).join('、')},不要自行替换名称,请先让用户确认`
|
|
437
|
-
: '';
|
|
480
|
+
const capped = capCandidates(pool.map((row) => formatCandidate(row, baseUrl)), candidateLimit);
|
|
481
|
+
// 精确(含服务端 eq 漏判的等值行)以判定池为准;模糊以服务端 total 为准(可能超过单页行数)。
|
|
482
|
+
const candidateTotal = effectiveMatch === 'exact' ? pool.length : Math.max(fuzzyServerTotal, pool.length);
|
|
483
|
+
const truncated = capped.items.length < candidateTotal;
|
|
438
484
|
return hrmSuccess('hrm.org.resolve', {
|
|
439
|
-
status: '
|
|
485
|
+
status: 'ambiguous',
|
|
440
486
|
stage: 'org',
|
|
441
|
-
matchType:
|
|
442
|
-
virtual
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
487
|
+
matchType: effectiveMatch,
|
|
488
|
+
virtual,
|
|
489
|
+
type: typeArg ?? null,
|
|
490
|
+
candidates: capped.items,
|
|
491
|
+
candidateTotal,
|
|
492
|
+
truncated,
|
|
493
|
+
message: `名称「${nameArg}」在多维「${virtual.name}」下${effectiveMatch === 'exact' ? '精确' : '模糊'}匹配到 ${candidateTotal} 个${typeLabel(typeArg ? typeArg : null)}${truncated ? `,本次仅列出前 ${capped.items.length} 个` : ''}。请让用户按 fullPath 确认层级,确认后用返回的 id 作为 orgId 重新调用本操作。`,
|
|
494
|
+
}, { searchedTypes });
|
|
447
495
|
},
|
|
448
496
|
};
|
|
449
|
-
export const hrmResolveOperations = [
|
|
497
|
+
export const hrmResolveOperations = [
|
|
498
|
+
orgResolve,
|
|
499
|
+
];
|