weaver-work-cli 0.1.62 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{archive-S2VKZWQ3.js → archive-WUZKAEZ6.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-PN46RTI2.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-ZPC5VWZM.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-DHGP3NYY.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-JQDW3BIB.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-JC47AIXK.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-IKIHM77A.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-GZTSJ57Y.js} +5 -4
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-26FCCU5O.js} +5 -3
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-3PCXBG4H.js} +1 -1
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-3W5NMGDS.js} +2 -2
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-4AFWOGOV.js} +3 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-5QQKLR6H.js} +11 -11
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-6T5X6YWX.js} +5 -3
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-AFZTMYGC.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-AGSO3PIK.js} +2 -2
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-FDBAFANU.js} +76 -76
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-FJUOUSV3.js} +89 -8
- package/dist/chunks/{chunk-EGANE35F.js → chunk-HLT6B26P.js} +1 -1
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-HWA2A25Y.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-I3MOFD6Q.js} +4 -7
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-INVYKG4I.js} +140 -45
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-K7QKQRSL.js} +168 -62
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-KDFEHDIB.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-KYDXWYFB.js} +1 -1
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-Q6D6PSMH.js} +30 -24
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-RMOH2GMF.js} +2 -2
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-SCMHG23G.js} +387 -70
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-VLY5RTVO.js} +5 -3
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-WSHIOSGM.js} +5 -3
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-XHSEK2VM.js} +48 -12
- package/dist/chunks/{chunk-XT77MP54.js → chunk-YTFNMQO4.js} +410 -24
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-UUC7AFUI.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-INMS7SYQ.js} +3051 -4497
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-34CBYVQP.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-YOR4QTAJ.js} +18 -6
- package/dist/chunks/{data-FOODGAMF.js → data-QKWI5325.js} +14 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-ZONRROK4.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-2CONM7R6.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-S2ENJ6GZ.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-ZSAXU5PJ.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-FQASCY2H.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-N76QQA53.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-FCLVIWAS.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-UM665WDZ.js} +3 -3
- package/dist/chunks/{host-VTPAWDZV.js → host-2ED2KC4X.js} +4 -4
- package/dist/chunks/{host-TJ5VVHM7.js → host-2UYZEY2V.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-46NYKDQP.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-7IPZKIM4.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-P7G22WNM.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-XLCBLNJD.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-XKL27NX2.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-NDYIMASG.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-MOGNB6HN.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-3T5X7SB7.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-4WOIL3ZQ.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-P7VMUKQW.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-MMTYDHXA.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-LCSBWGJ3.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-VZXRQGS4.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-MI2BSKZX.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-OPEQNW7Y.js} +873 -17
- package/dist/chunks/{plan-BLGPZF5M.js → plan-TJAS4N5X.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-CYBGU6K6.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-3FT2F66K.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-WPGB5BDJ.js} +654 -336
- package/dist/chunks/{registry-3FYSWV3U.js → registry-BAWCWV4D.js} +3 -3
- package/dist/chunks/{registry-I4DVPDMU.js → registry-FNI5E76J.js} +12 -12
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-QRMXRSCT.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-I7QQRHEL.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-3P7EWGNZ.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-FOBSVNYW.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-U2KKTVQY.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +203 -44
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/error-actions.js +112 -0
- package/dist/shortcuts/contract/errors.js +9 -1
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +130 -274
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
- package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
- package/dist/shortcuts/contract/operations/elements-build.js +82 -56
- package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +123 -27
- package/dist/shortcuts/contract/operations/ledger.js +343 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/money.js +90 -0
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +326 -0
- package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +281 -0
- package/dist/shortcuts/contract/operations/quote.js +66 -12
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
- package/dist/shortcuts/contract/operations/triage.js +68 -15
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/data/operations/shared.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +138 -15
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/performance/flow-utils.js +363 -0
- package/dist/shortcuts/performance/manifest.js +2 -2
- package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
- package/dist/shortcuts/performance/operations/flow-list.js +213 -0
- package/dist/shortcuts/performance/operations/flow-score.js +241 -0
- package/dist/shortcuts/performance/operations/registry.js +6 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +55 -2
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +283 -345
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +126 -202
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +13 -5
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +47 -16
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +19 -18
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +78 -112
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +67 -333
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +18 -15
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +80 -84
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +38 -34
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +132 -47
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +108 -217
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +14 -20
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +13 -7
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +86 -46
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +22 -14
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +27 -26
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +252 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +15 -23
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +290 -104
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +5 -12
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +12 -18
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +33 -35
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +87 -534
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +9 -7
- package/skills/weaver-e10-meeting/references/create-guardrails.md +23 -17
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-performance/SKILL.md +45 -5
- package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
- package/skills/weaver-e10-performance/references/flow-api.md +128 -0
- package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -14
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { contractValidationError } from '../errors.js';
|
|
4
|
+
import { mapCompany, pickOption } from './elements-build.js';
|
|
5
|
+
import { BUILTIN } from './elements-spec.js';
|
|
6
|
+
import { coerceAmount, findMoneyPlaceholder, inspectAmount } from './money.js';
|
|
7
|
+
import { assertQuoteRefsResolved, resolveQuoteRefs } from './quote-ref.js';
|
|
8
|
+
const DEFAULT_OUR_COMPANY = '泛微网络科技股份有限公司';
|
|
9
|
+
const SIGN_FORM_LABEL = '纸质签署';
|
|
10
|
+
const SIGN_DATE_LABEL = '默认合同办理当天';
|
|
11
|
+
const SIGN_WAY_LABEL = '我方先盖章';
|
|
12
|
+
const RELATED_FLOW_LABEL = '报价审批及伙伴授权书流程';
|
|
13
|
+
/** 关联流程类型选项:报价审批及伙伴授权书流程 = 0。 */
|
|
14
|
+
const RELATED_FLOW_OPTION = '0';
|
|
15
|
+
/**
|
|
16
|
+
* 关联流程类型字段(仅新客户 / 契约锁流程存在该字段)。
|
|
17
|
+
* 常规二次销售、老客户增值两个流程没有此字段,不能硬写。
|
|
18
|
+
*/
|
|
19
|
+
const RELATED_FLOW_FIELD = {
|
|
20
|
+
新客户: '1269716066559755039#关联流程类型',
|
|
21
|
+
契约锁: '1315752743078731884#关联流程类型',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 报价单类型标识 → 四个流程。
|
|
25
|
+
* 顺序敏感:契约锁、增值、二次销售先判,最后才落到新客户,
|
|
26
|
+
* 避免「新客户」二字出现在文件名里就把增值合同判成新客户。
|
|
27
|
+
*/
|
|
28
|
+
const FLOW_SIGNALS = [
|
|
29
|
+
{ flow: '契约锁', pattern: /契约锁/u },
|
|
30
|
+
{ flow: '老客户增值', pattern: /老客户增值|增值服务|增值合同|增值报价/u },
|
|
31
|
+
{ flow: '常规二次销售', pattern: /二次销售|增购|扩容|续购/u },
|
|
32
|
+
{ flow: '新客户', pattern: /新客户/u },
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* 按报价单标识识别合同类型。
|
|
36
|
+
*
|
|
37
|
+
* 为什么不看合同正文:合同是用本次选中的范文生成的,再回正文判「新客户」等于拿自己的输入
|
|
38
|
+
* 当证据(循环论证)。类型依据换成报价单标识 + 编排层一次性确认,正文判定只作兜底。
|
|
39
|
+
*
|
|
40
|
+
* 返回 `needsConfirm=true` 时不抛错——「判不出就问一次」是正常业务分支,不是故障。
|
|
41
|
+
*/
|
|
42
|
+
export function detectFlowFromQuote(...texts) {
|
|
43
|
+
const blob = texts.map((text) => String(text ?? '')).join(' ');
|
|
44
|
+
const candidates = [];
|
|
45
|
+
for (const signal of FLOW_SIGNALS) {
|
|
46
|
+
if (signal.pattern.test(blob) && !candidates.includes(signal.flow))
|
|
47
|
+
candidates.push(signal.flow);
|
|
48
|
+
}
|
|
49
|
+
if (candidates.length === 1) {
|
|
50
|
+
return { flow: candidates[0], needsConfirm: false, candidates, reason: '按报价单类型标识识别' };
|
|
51
|
+
}
|
|
52
|
+
if (candidates.length > 1) {
|
|
53
|
+
return { flow: '', needsConfirm: true, candidates, reason: '报价单同时出现多个类型标识,需确认' };
|
|
54
|
+
}
|
|
55
|
+
return { flow: '', needsConfirm: true, candidates: [], reason: '报价单无类型标识,需确认' };
|
|
56
|
+
}
|
|
57
|
+
function isRecord(value) {
|
|
58
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
59
|
+
}
|
|
60
|
+
function str(value) {
|
|
61
|
+
if (typeof value === 'string')
|
|
62
|
+
return value.trim();
|
|
63
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
64
|
+
return String(value);
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 金额归一:与 `money.ts` 同一份口径(2026-11-20 起不再各写一套)。
|
|
69
|
+
*
|
|
70
|
+
* 旧实现在这里放宽、在 `quote-submit` 用裸 `Number()`,同一个 `¥809,166.76` 一处能过、
|
|
71
|
+
* 一处报 `total_amount_required`——正是模型把错误读成「金额不可得」的起点。
|
|
72
|
+
*/
|
|
73
|
+
function numOf(value) {
|
|
74
|
+
return coerceAmount(value);
|
|
75
|
+
}
|
|
76
|
+
function moneyText(value) {
|
|
77
|
+
return Math.round(value).toLocaleString('en-US');
|
|
78
|
+
}
|
|
79
|
+
function normalizeSections(input) {
|
|
80
|
+
if (!Array.isArray(input))
|
|
81
|
+
return [];
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const item of input) {
|
|
84
|
+
if (!isRecord(item))
|
|
85
|
+
continue;
|
|
86
|
+
const name = str(item.name) || str(item.title);
|
|
87
|
+
const amount = numOf(item.amount ?? item.total ?? item.sum);
|
|
88
|
+
if (!name || amount === null)
|
|
89
|
+
continue;
|
|
90
|
+
out.push({ name, amount });
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/** 合同背景说明:客户 + 标的 + 费用构成概览,全部取自报价单。 */
|
|
95
|
+
function buildBackground(customer, sections, totalAmount) {
|
|
96
|
+
const parts = sections.slice(0, 8).map((section) => `${section.name} ${moneyText(section.amount)} 元`);
|
|
97
|
+
const detail = parts.length ? `费用构成:${parts.join('、')}。` : '';
|
|
98
|
+
return `${customer}采购合同管理系统软件产品及实施服务,${detail}合同总金额 ${moneyText(totalAmount)} 元。`;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 报价单 → 表单要素(按流程字段表分派)。
|
|
102
|
+
*
|
|
103
|
+
* origin 口径(与 elements-build 一致,但来源不同):
|
|
104
|
+
* - 逐字可溯的值(合同名称 / 客户 / 金额 / 背景 / 我方主体)给出 `fileId#值`,
|
|
105
|
+
* 前提是 `verified=true`——即 `slots.fill` 已回读确认这些值逐字落在合同里;
|
|
106
|
+
* - 纯推导与默认值(直签、签约形式、签署日期、签订方式、关联流程类型)一律 `null`,
|
|
107
|
+
* 因为合同正文里没有这些字面量,硬造片段会污染「合同原文」列。
|
|
108
|
+
*/
|
|
109
|
+
export function buildQuoteFieldResults(args) {
|
|
110
|
+
const spec = BUILTIN[args.flow];
|
|
111
|
+
if (!spec) {
|
|
112
|
+
throw contractValidationError('flow_not_builtin', `流程「${args.flow}」无内置字段表:${Object.keys(BUILTIN).join(' / ')}`);
|
|
113
|
+
}
|
|
114
|
+
const fieldOf = (key) => spec.fields[key] ?? spec.selects?.[key] ?? '';
|
|
115
|
+
const results = [];
|
|
116
|
+
const add = (fieldInfo, value, reason, origin) => {
|
|
117
|
+
if (!fieldInfo || !value)
|
|
118
|
+
return;
|
|
119
|
+
results.push({ fieldInfo, reason, value, origin });
|
|
120
|
+
};
|
|
121
|
+
const originOf = (text) => {
|
|
122
|
+
const value = String(text ?? '').trim();
|
|
123
|
+
if (!args.verified || !value || !args.fileId)
|
|
124
|
+
return null;
|
|
125
|
+
return [`${args.fileId}#${value}`];
|
|
126
|
+
};
|
|
127
|
+
// 选项类字段的值一律是**选项 ID**(2026-11-20 回退:此前一度改传显示名,已撤销)。
|
|
128
|
+
// `pickOption` 按本流程的 options 表做归一化匹配,返回值即选项 ID。
|
|
129
|
+
// ① 流程标题:与合同文件同名,四处一致(文件名 / 标题 / 上传名 / URL name)
|
|
130
|
+
add(fieldOf('title'), args.contractTitle, '取合同名称,与合同文件同名', originOf(args.contractTitle));
|
|
131
|
+
// ② 购买方式:报价单由泛微出具、客户即最终用户,不存在伙伴代签结构
|
|
132
|
+
add(fieldOf('buyMode'), pickOption(spec.options?.buyMode ?? {}, '直签') ?? '0', '泛微与最终用户直接签署(报价单无伙伴代签结构)', null);
|
|
133
|
+
// ③ 最终用户:取报价单「客户名称」
|
|
134
|
+
add(fieldOf('finalUser'), args.customer, '取报价单客户名称,客户即最终用户', originOf(args.customer));
|
|
135
|
+
// ④ 合同总金额:取「最终优惠报价」,不是标准价
|
|
136
|
+
add(fieldOf('totalAmount'), String(args.totalAmount), '取报价单最终优惠报价', originOf(moneyText(args.totalAmount)));
|
|
137
|
+
// ⑤ 合同背景说明:报价单标的 + 费用构成归纳
|
|
138
|
+
add(fieldOf('background'), args.background, '按报价单标的与费用分节归纳', originOf(args.background));
|
|
139
|
+
// ⑥ 我方签约公司:必须映射成下拉可选值,禁止直接填全称
|
|
140
|
+
const companyLabel = mapCompany(args.ourCompanyName) || args.ourCompanyName || DEFAULT_OUR_COMPANY;
|
|
141
|
+
add(fieldOf('ourCompany'), pickOption(spec.options?.ourCompany ?? {}, companyLabel) ?? '', `乙方签约主体:${args.ourCompanyName || DEFAULT_OUR_COMPANY}`, originOf(args.ourCompanyName || DEFAULT_OUR_COMPANY));
|
|
142
|
+
// ⑦ 签约形式:技术性默认(规则允许默认,非业务判断)
|
|
143
|
+
add(fieldOf('signForm'), pickOption(spec.options?.signForm ?? {}, SIGN_FORM_LABEL) ?? spec.defaults?.signForm ?? '', '合同未约定电子签,按纸质签署(技术性默认值)', null);
|
|
144
|
+
// ⑧ 合同签署日期:技术性默认「默认合同办理当天」
|
|
145
|
+
// 新客户字段键是 signDate,其余三个流程是 signDateType,择一写入
|
|
146
|
+
const signDateField = fieldOf('signDate') || fieldOf('signDateType');
|
|
147
|
+
add(signDateField, pickOption(spec.options?.signDate ?? {}, SIGN_DATE_LABEL) ?? spec.defaults?.signDate ?? '', '未约定固定签署日,按默认合同办理当天(技术性默认值)', null);
|
|
148
|
+
// ⑨ 合同签订方式:技术性默认「我方先盖章」
|
|
149
|
+
add(fieldOf('signWay'), pickOption(spec.options?.signWay ?? {}, SIGN_WAY_LABEL) ?? spec.defaults?.signWay ?? '', '未特别约定签署顺序,按我方先盖章(技术性默认值)', null);
|
|
150
|
+
// ⑩ 关联流程类型:报价单链路固定「报价审批及伙伴授权书流程」(传**选项 ID**:0)
|
|
151
|
+
// 仅新客户与契约锁流程存在该字段;另两个流程无此字段,不硬写
|
|
152
|
+
add(RELATED_FLOW_FIELD[args.flow] ?? '', RELATED_FLOW_OPTION, `报价单链路固定关联「${RELATED_FLOW_LABEL}」`, null);
|
|
153
|
+
return results;
|
|
154
|
+
}
|
|
155
|
+
/** 通用文件名黑名单:这些名字不是「合同名称」,落到系统里无法辨识。 */
|
|
156
|
+
const GENERIC_FILE_STEMS = new Set(['合同', '合同文件', '未命名', 'document', 'new', '模板', 'temp', 'output']);
|
|
157
|
+
/**
|
|
158
|
+
* 合同文件名归一:`{合同名称}.docx`。
|
|
159
|
+
*
|
|
160
|
+
* 2026-11-19 实测事故:编排层把回填产物写成 `合同.docx`,`flow.launch` 直接沿用本地文件名,
|
|
161
|
+
* 系统附件列表里只剩一个「合同.docx」,无法辨识客户与类型。
|
|
162
|
+
*/
|
|
163
|
+
export function normalizeContractFileName(contractTitle, fallbackCustomer = '') {
|
|
164
|
+
const raw = String(contractTitle ?? '').replace(/\.docx$/iu, '');
|
|
165
|
+
const cleaned = raw
|
|
166
|
+
.replace(/[\\/:*?"<>|\r\n\t]/gu, '')
|
|
167
|
+
.replace(/\s+/gu, ' ')
|
|
168
|
+
.trim();
|
|
169
|
+
const isGeneric = !cleaned || GENERIC_FILE_STEMS.has(cleaned.toLowerCase());
|
|
170
|
+
const stem = isGeneric
|
|
171
|
+
? `${fallbackCustomer || '客户'}合同管理系统软件产品及实施服务购买合同`
|
|
172
|
+
: cleaned;
|
|
173
|
+
return `${stem}.docx`;
|
|
174
|
+
}
|
|
175
|
+
export const contractQuoteRecognizeOperations = [
|
|
176
|
+
{
|
|
177
|
+
name: 'contract.quotescreen.recognize',
|
|
178
|
+
async execute(input) {
|
|
179
|
+
// 值引用解析(2026-11-20 P1):totalAmount / sections 都可以写成
|
|
180
|
+
// {"$quote":"<报价书解析结果.json>#totals.final_total"},由本进程读真值。
|
|
181
|
+
// 金额在模型侧是脱敏的,模型不可能把真值传出来;这条通道让「取值」由代码完成。
|
|
182
|
+
const refOutcome = resolveQuoteRefs(input);
|
|
183
|
+
assertQuoteRefsResolved(refOutcome, (errors) => `入参有 ${errors.length} 处 $quote 引用取不到值:`
|
|
184
|
+
+ errors.slice(0, 5).map((item) => `${item.at}(${item.ref}:${item.reason})`).join(';')
|
|
185
|
+
+ '。请核对文件路径与字段路径;报价书解析结果需先用 contract.quote.parse / contract.quote.normalize 的 out 参数落盘。');
|
|
186
|
+
input = refOutcome.value;
|
|
187
|
+
const fileId = str(input.fileId);
|
|
188
|
+
if (!fileId) {
|
|
189
|
+
throw contractValidationError('file_id_required', '缺少 fileId(必须是 flow.launch 返回的 workflow fileId)');
|
|
190
|
+
}
|
|
191
|
+
const customer = str(input.customerName);
|
|
192
|
+
if (!customer) {
|
|
193
|
+
throw contractValidationError('customer_required', '缺少 customerName(报价单客户全称)');
|
|
194
|
+
}
|
|
195
|
+
// ── 类型:显式 flow 优先;否则按报价单标识识别,判不出就返回待确认
|
|
196
|
+
let flow = str(input.flow);
|
|
197
|
+
let flowReason = '由调用方显式指定';
|
|
198
|
+
if (!flow) {
|
|
199
|
+
const detection = detectFlowFromQuote(str(input.quoteTitle), str(input.contractTitle), str(input.quoteFileName), customer);
|
|
200
|
+
if (detection.needsConfirm) {
|
|
201
|
+
return {
|
|
202
|
+
status: 'COMPLETE',
|
|
203
|
+
data: {
|
|
204
|
+
ok: false,
|
|
205
|
+
needsConfirm: true,
|
|
206
|
+
reason: detection.reason,
|
|
207
|
+
candidates: detection.candidates.length ? detection.candidates : Object.keys(BUILTIN),
|
|
208
|
+
steps: ['detect.flow'],
|
|
209
|
+
note: '合同类型未能唯一确定:请确认后传 flow 重跑(四个流程:契约锁 / 新客户 / 常规二次销售 / 老客户增值)',
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
flow = detection.flow;
|
|
214
|
+
flowReason = detection.reason;
|
|
215
|
+
}
|
|
216
|
+
const spec = BUILTIN[flow];
|
|
217
|
+
if (!spec) {
|
|
218
|
+
throw contractValidationError('flow_not_builtin', `流程「${flow}」无内置字段表:${Object.keys(BUILTIN).join(' / ')}`);
|
|
219
|
+
}
|
|
220
|
+
// ── 金额与标题
|
|
221
|
+
// 金额形态体检:脱敏占位符与「真的没传」必须分开报——占位符的正确动作是改传纯数值重跑,
|
|
222
|
+
// 不是向用户索要金额、也不是宣告链路失败(2026-11-20 事故:模型把 total_amount_required
|
|
223
|
+
// 误读成「金额在我这边不可得」,整条链路停在上传之前)。
|
|
224
|
+
const amountCheck = inspectAmount(input.totalAmount);
|
|
225
|
+
if (amountCheck.reason === 'placeholder') {
|
|
226
|
+
throw contractValidationError('total_amount_placeholder', `totalAmount 是平台脱敏占位符「${amountCheck.placeholder}」。它在模型上下文里是真实金额的等价表示,`
|
|
227
|
+
+ '但本地进程收到的是字面量、没有任何还原环节,不能当数值使用。'
|
|
228
|
+
+ '正确动作:改传报价单解析结果里的纯数值(如 809166.76)重跑。'
|
|
229
|
+
+ '⚠️ 这不是「金额拿不到」,不要据此向用户索要金额、也不要宣告链路失败。', { raw: amountCheck.raw, placeholder: amountCheck.placeholder });
|
|
230
|
+
}
|
|
231
|
+
// 分节金额同样不接受占位符:normalizeSections 对非数值是**静默丢弃**,
|
|
232
|
+
// 占位符会让费用分节凭空少一项且不报错,背景说明随之失真。
|
|
233
|
+
const sectionPlaceholders = [];
|
|
234
|
+
if (Array.isArray(input.sections)) {
|
|
235
|
+
input.sections.forEach((item, index) => {
|
|
236
|
+
if (!isRecord(item))
|
|
237
|
+
return;
|
|
238
|
+
const candidate = item.amount ?? item.total ?? item.sum;
|
|
239
|
+
const token = findMoneyPlaceholder(candidate);
|
|
240
|
+
if (token)
|
|
241
|
+
sectionPlaceholders.push({ index, placeholder: token, raw: String(candidate) });
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (sectionPlaceholders.length > 0) {
|
|
245
|
+
throw contractValidationError('sections_amount_placeholder', `sections 有 ${sectionPlaceholders.length} 项金额是脱敏占位符(第 ${sectionPlaceholders.map((item) => item.index + 1).join('、')} 项)。`
|
|
246
|
+
+ '本地进程不会还原占位符,写进合同背景说明就会留下占位符文本。'
|
|
247
|
+
+ '正确动作:改用报价单解析结果里的纯数值重跑,或不传 sections(背景说明退化为不含费用构成)。', { sections: sectionPlaceholders });
|
|
248
|
+
}
|
|
249
|
+
const totalAmount = numOf(input.totalAmount) ?? 0;
|
|
250
|
+
if (totalAmount <= 0) {
|
|
251
|
+
throw contractValidationError('total_amount_required', `totalAmount 必须是大于 0 的纯数值(报价单最终优惠报价),收到「${amountCheck.raw}」`, { raw: amountCheck.raw });
|
|
252
|
+
}
|
|
253
|
+
const contractTitle = str(input.contractTitle)
|
|
254
|
+
|| `${customer}合同管理系统软件产品及实施服务购买合同`;
|
|
255
|
+
const fileName = normalizeContractFileName(str(input.contractFileName) || contractTitle, customer);
|
|
256
|
+
// ── 费用分节与背景
|
|
257
|
+
const sections = normalizeSections(input.sections);
|
|
258
|
+
const background = str(input.background) || buildBackground(customer, sections, totalAmount);
|
|
259
|
+
const ourCompanyName = str(input.ourCompany) || DEFAULT_OUR_COMPANY;
|
|
260
|
+
// verified 默认 true:上游必须在 slots.fill 的 validate.ok === true 之后才调用本 operation。
|
|
261
|
+
// 传 false 时全部 origin 置空,宁可「合同原文」列空,也不给出失真出处。
|
|
262
|
+
const verified = input.verified === undefined ? true : input.verified === true;
|
|
263
|
+
const results = buildQuoteFieldResults({
|
|
264
|
+
flow,
|
|
265
|
+
customer,
|
|
266
|
+
contractTitle,
|
|
267
|
+
totalAmount,
|
|
268
|
+
ourCompanyName,
|
|
269
|
+
background,
|
|
270
|
+
fileId,
|
|
271
|
+
verified,
|
|
272
|
+
});
|
|
273
|
+
const payload = {
|
|
274
|
+
flow,
|
|
275
|
+
workflowId: spec.workflowId,
|
|
276
|
+
attachmentIds: fileId,
|
|
277
|
+
attachmentFieldId: spec.attachmentFieldId,
|
|
278
|
+
attachmentFileId: fileId,
|
|
279
|
+
recognizeResult: {
|
|
280
|
+
isSuccess: results.length > 0,
|
|
281
|
+
mainTable: { rows: [{ mainDataId: 1, fieldResults: results }] },
|
|
282
|
+
// 报价单分节(软件功能/授权许可/实施服务/AI/第三方)不是 15 项专项清单,
|
|
283
|
+
// 且新客户发起节点当前无专项字段 → 不输出专项明细,禁止硬凑
|
|
284
|
+
subTables: [],
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
let output;
|
|
288
|
+
const outPath = str(input.out);
|
|
289
|
+
if (outPath) {
|
|
290
|
+
output = resolve(outPath);
|
|
291
|
+
mkdirSync(dirname(output), { recursive: true });
|
|
292
|
+
writeFileSync(output, JSON.stringify(payload), 'utf8');
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
status: 'COMPLETE',
|
|
296
|
+
data: {
|
|
297
|
+
ok: true,
|
|
298
|
+
flow,
|
|
299
|
+
flowReason,
|
|
300
|
+
workflowId: spec.workflowId,
|
|
301
|
+
attachmentFieldId: spec.attachmentFieldId,
|
|
302
|
+
fieldCount: results.length,
|
|
303
|
+
// 编排层四处同名用:合同文件落盘名 / 上传名 / URL files[0][name] / 流程标题
|
|
304
|
+
expectedFileName: fileName,
|
|
305
|
+
expectedTitle: contractTitle,
|
|
306
|
+
totalAmount,
|
|
307
|
+
verified,
|
|
308
|
+
skipped: [
|
|
309
|
+
'合同收件人',
|
|
310
|
+
'收件人固定电话',
|
|
311
|
+
'收件人移动电话',
|
|
312
|
+
'合同邮寄地址',
|
|
313
|
+
'客户方人员',
|
|
314
|
+
'商机卡片',
|
|
315
|
+
'是否触发开票立项确认',
|
|
316
|
+
'契约锁公有云用户',
|
|
317
|
+
],
|
|
318
|
+
payload,
|
|
319
|
+
...(output ? { output } : {}),
|
|
320
|
+
note: '本 operation 不读合同正文;要素值全部来自报价单与固定规则,抽不到的字段一律留空由经办人补录。'
|
|
321
|
+
+ 'subTables 为空:报价单分节不是 15 项专项清单,且新客户发起节点当前无专项字段。',
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
];
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { contractValidationError } from '../errors.js';
|
|
4
|
+
/**
|
|
5
|
+
* 报价数值引用通道(2026-11-20 P1)。
|
|
6
|
+
*
|
|
7
|
+
* ## 解决什么问题
|
|
8
|
+
*
|
|
9
|
+
* 平台把金额在**进入模型上下文前**脱敏,还原只发生在渲染回模型/用户这一步。因此模型
|
|
10
|
+
* **物理上无法**把一个真实金额原样传给本地进程:它手上只有脱敏形态。P0 的守卫让这种错误
|
|
11
|
+
* 「不再静默产出残次品」,但没解决根因——链路仍然要求模型做一件它做不到的事。
|
|
12
|
+
*
|
|
13
|
+
* 本模块把「传值」换成「传引用」:
|
|
14
|
+
*
|
|
15
|
+
* ```json
|
|
16
|
+
* { "slotId": "t3r2c5", "value": { "$quote": "D:/q/quote.json#totals.final_total" } }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* 模型只需要说出**取哪个字段**(结构信息,不会被脱敏),真值由本地进程从报价书解析结果里读。
|
|
20
|
+
* 于是金额从头到尾不经过模型上下文,脱敏与否都不再影响正确性。
|
|
21
|
+
*
|
|
22
|
+
* ## 为什么统一成 `$quote` 一个形态
|
|
23
|
+
*
|
|
24
|
+
* plan / totalAmount / sections / 明细 items 全都能用同一个写法,规则只有一条,模型不必记
|
|
25
|
+
* 四套参数名;`$quote` 也不会与模板列名(`名称`/`金额`…)或业务键冲突。
|
|
26
|
+
*
|
|
27
|
+
* 递归解析:任何位置出现 `{ "$quote": "<解析结果路径>#<字段路径>" }` 都会被就地替换。
|
|
28
|
+
*/
|
|
29
|
+
export const QUOTE_REF_KEY = '$quote';
|
|
30
|
+
const FORBIDDEN_TOKENS = new Set(['__proto__', 'prototype', 'constructor']);
|
|
31
|
+
/** 引用串形态判定:必须以 `<路径>#<字段路径>` 给出,路径绝对、字段路径非空。 */
|
|
32
|
+
export function parseQuoteRefString(raw) {
|
|
33
|
+
const text = raw.trim();
|
|
34
|
+
if (!text)
|
|
35
|
+
return null;
|
|
36
|
+
// 用**最后一个** `#` 切分:Windows 路径不含 `#`,字段路径也不会含 `#`
|
|
37
|
+
const index = text.lastIndexOf('#');
|
|
38
|
+
if (index <= 0 || index === text.length - 1)
|
|
39
|
+
return null;
|
|
40
|
+
const quotePath = text.slice(0, index).trim();
|
|
41
|
+
const jsonPath = text.slice(index + 1).replace(/^\/+/u, '').trim();
|
|
42
|
+
if (!quotePath || !jsonPath)
|
|
43
|
+
return null;
|
|
44
|
+
return { quotePath, jsonPath };
|
|
45
|
+
}
|
|
46
|
+
/** `a.b[0].c` / `a.b.0.c` 两种写法都接受。 */
|
|
47
|
+
function toPathTokens(jsonPath) {
|
|
48
|
+
return jsonPath.replace(/\[(\d+)\]/gu, '.$1').split('.').filter((token) => token !== '');
|
|
49
|
+
}
|
|
50
|
+
function readByPath(root, tokens) {
|
|
51
|
+
let current = root;
|
|
52
|
+
for (const token of tokens) {
|
|
53
|
+
if (current === null || current === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
if (Array.isArray(current)) {
|
|
56
|
+
const index = Number(token);
|
|
57
|
+
if (!Number.isInteger(index) || index < 0 || index >= current.length)
|
|
58
|
+
return undefined;
|
|
59
|
+
current = current[index];
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (typeof current === 'object') {
|
|
63
|
+
// 只认自有属性,且挡掉原型链上的危险键
|
|
64
|
+
if (!Object.prototype.hasOwnProperty.call(current, token))
|
|
65
|
+
return undefined;
|
|
66
|
+
current = current[token];
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return current;
|
|
72
|
+
}
|
|
73
|
+
function isQuoteRefObject(value) {
|
|
74
|
+
return typeof value === 'object'
|
|
75
|
+
&& value !== null
|
|
76
|
+
&& !Array.isArray(value)
|
|
77
|
+
&& typeof value[QUOTE_REF_KEY] === 'string';
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 递归解析引用。
|
|
81
|
+
*
|
|
82
|
+
* - 先把**所有**引用解析完并收集错误,由调用方一次性抛出:避免"改一个报一个"的往返;
|
|
83
|
+
* - 每个报价书 JSON 只读一次(同一轮里多个位点引用同一个文件是常态);
|
|
84
|
+
* - 解析结果按位置记录 `resolved`,作为「这个金额是从哪个字段来的」的审计线索。
|
|
85
|
+
*/
|
|
86
|
+
export function resolveQuoteRefs(input) {
|
|
87
|
+
const resolved = [];
|
|
88
|
+
const errors = [];
|
|
89
|
+
const fileCache = new Map();
|
|
90
|
+
const loadQuote = (quotePath) => {
|
|
91
|
+
const absolute = resolve(quotePath);
|
|
92
|
+
const cached = fileCache.get(absolute);
|
|
93
|
+
if (cached)
|
|
94
|
+
return cached;
|
|
95
|
+
let entry;
|
|
96
|
+
if (!existsSync(absolute)) {
|
|
97
|
+
entry = { error: `报价书解析结果文件不存在:${absolute}` };
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
try {
|
|
101
|
+
entry = { root: JSON.parse(readFileSync(absolute, 'utf8').replace(/^\uFEFF/u, '')) };
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
entry = { error: `报价书解析结果不是合法 JSON:${error instanceof Error ? error.message : String(error)}` };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
fileCache.set(absolute, entry);
|
|
108
|
+
return entry;
|
|
109
|
+
};
|
|
110
|
+
const walk = (value, at) => {
|
|
111
|
+
if (isQuoteRefObject(value)) {
|
|
112
|
+
const ref = String(value[QUOTE_REF_KEY]);
|
|
113
|
+
const parsed = parseQuoteRefString(ref);
|
|
114
|
+
if (!parsed) {
|
|
115
|
+
errors.push({
|
|
116
|
+
at,
|
|
117
|
+
ref,
|
|
118
|
+
reason: '引用格式非法,应写成 "<报价书解析结果.json 绝对路径>#<字段路径>",例如 "D:/q/quote.json#totals.final_total"',
|
|
119
|
+
});
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
const tokens = toPathTokens(parsed.jsonPath);
|
|
123
|
+
if (tokens.length === 0) {
|
|
124
|
+
errors.push({ at, ref, reason: '字段路径为空' });
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
const forbidden = tokens.find((token) => FORBIDDEN_TOKENS.has(token));
|
|
128
|
+
if (forbidden) {
|
|
129
|
+
errors.push({ at, ref, reason: `字段路径含非法片段「${forbidden}」` });
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
const source = loadQuote(parsed.quotePath);
|
|
133
|
+
if (source.error) {
|
|
134
|
+
errors.push({ at, ref, reason: source.error });
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
const hit = readByPath(source.root, tokens);
|
|
138
|
+
if (hit === undefined) {
|
|
139
|
+
const topKeys = source.root && typeof source.root === 'object' && !Array.isArray(source.root)
|
|
140
|
+
? Object.keys(source.root).slice(0, 12).join(' / ')
|
|
141
|
+
: '(非对象)';
|
|
142
|
+
errors.push({ at, ref, reason: `字段路径取不到值:${parsed.jsonPath};该文件顶层字段有 ${topKeys}` });
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
if (hit === null || (typeof hit === 'object' && !Array.isArray(hit))) {
|
|
146
|
+
// 指向对象/空值通常意味着路径写浅了一层(如只写到 totals),
|
|
147
|
+
// 提前报出来比事后把 "[object Object]" 写进合同好
|
|
148
|
+
const keys = hit && typeof hit === 'object' && !Array.isArray(hit)
|
|
149
|
+
? Object.keys(hit).slice(0, 12).join(' / ')
|
|
150
|
+
: '(null)';
|
|
151
|
+
errors.push({
|
|
152
|
+
at,
|
|
153
|
+
ref,
|
|
154
|
+
reason: `字段路径指向的不是具体值:${parsed.jsonPath}(其下字段:${keys});请写到末端字段`,
|
|
155
|
+
});
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
resolved.push({ at, ref, quotePath: resolve(parsed.quotePath), jsonPath: parsed.jsonPath });
|
|
159
|
+
return hit;
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(value))
|
|
162
|
+
return value.map((item, index) => walk(item, `${at}[${index}]`));
|
|
163
|
+
if (typeof value === 'object' && value !== null) {
|
|
164
|
+
const out = {};
|
|
165
|
+
for (const [key, item] of Object.entries(value)) {
|
|
166
|
+
out[key] = walk(item, at ? `${at}.${key}` : key);
|
|
167
|
+
}
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
return value;
|
|
171
|
+
};
|
|
172
|
+
return { value: walk(input, ''), resolved, errors };
|
|
173
|
+
}
|
|
174
|
+
/** 调用方统一用的抛错封装:把全部引用错误一次报清。 */
|
|
175
|
+
export function assertQuoteRefsResolved(outcome, buildMessage, subtype = 'quote_ref_unresolved', details) {
|
|
176
|
+
if (outcome.errors.length === 0)
|
|
177
|
+
return;
|
|
178
|
+
throw contractValidationError(subtype, buildMessage(outcome.errors), { errors: outcome.errors, ...details });
|
|
179
|
+
}
|