weaver-work-cli 0.1.75 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/chunks/{archive-OZJ6PYUR.js → archive-ENBSUMHV.js} +1 -1
- package/dist/chunks/{archive-oa-BHL5RK2F.js → archive-oa-7BFPQ6M5.js} +1 -1
- package/dist/chunks/{asset-HKRFRQR2.js → asset-V5SUD3PW.js} +1 -1
- package/dist/chunks/{asset-idle-GGIR4KE7.js → asset-idle-3CEL7WFX.js} +1 -1
- package/dist/chunks/{attachment-content-4OV65NK5.js → attachment-content-TFOC3Y3X.js} +3 -3
- package/dist/chunks/{blog-HYDP4DV3.js → blog-FLI4SS3P.js} +1 -1
- package/dist/chunks/{caizhilian-JS4RQZ6Z.js → caizhilian-7WCTKCCP.js} +3 -3
- package/dist/chunks/{calendar-SWRY4DIT.js → calendar-G726HUUH.js} +1 -1
- package/dist/chunks/{chunk-5ZJGPEIB.js → chunk-2KW7AI6P.js} +1 -1
- package/dist/chunks/{chunk-JOY3HZXL.js → chunk-2UV4IZIT.js} +21 -15
- package/dist/chunks/{chunk-FEZK536Z.js → chunk-4PBN7NJY.js} +353 -43
- package/dist/chunks/{chunk-VOMDD2C5.js → chunk-5E2FDXBU.js} +1 -1
- package/dist/chunks/{chunk-ZUB4M4N3.js → chunk-5VQ7JHV4.js} +134 -49
- package/dist/chunks/{chunk-I6NOHKEK.js → chunk-7SQN5IZR.js} +1 -1
- package/dist/chunks/{chunk-4FCBEWNB.js → chunk-BP7BONZO.js} +675 -86
- package/dist/chunks/{chunk-U6Y32KEV.js → chunk-BWFCTE43.js} +1 -1
- package/dist/chunks/{chunk-PG5YSNYY.js → chunk-DACQKJ6O.js} +3 -3
- package/dist/chunks/{chunk-KWJEICD4.js → chunk-E2EY3DMS.js} +2 -2
- package/dist/chunks/{chunk-KEA4XQPO.js → chunk-FAC4IFGQ.js} +4 -4
- package/dist/chunks/{chunk-MXCRKXOP.js → chunk-FPWCCRKT.js} +1 -1
- package/dist/chunks/{minute-doc-OQUMDTKG.js → chunk-IBTGXLOT.js} +101 -18
- package/dist/chunks/{chunk-OJ4JPD25.js → chunk-LQLIXBJF.js} +6 -8
- package/dist/chunks/{chunk-BNKUHN4N.js → chunk-OVTCWLNQ.js} +2 -2
- package/dist/chunks/{chunk-5D2V7ZAN.js → chunk-PMRNIGKZ.js} +1 -1
- package/dist/chunks/{chunk-OQCK5SAU.js → chunk-RVEKGVZU.js} +1 -1
- package/dist/chunks/{chunk-2AUFKU2D.js → chunk-SWFTWNWL.js} +11 -11
- package/dist/chunks/{chunk-TA2RBUTH.js → chunk-TBCKK6LH.js} +1 -1
- package/dist/chunks/{chunk-SU6IJD6D.js → chunk-TD5IOEGN.js} +1 -1
- package/dist/chunks/{chunk-J7FAAHWH.js → chunk-UDBQJLQF.js} +1 -1
- package/dist/chunks/{chunk-BSR5TM7U.js → chunk-USYFVIUR.js} +22 -7
- package/dist/chunks/{chunk-ERZY6GYL.js → chunk-UZ2E3VNI.js} +1 -1
- package/dist/chunks/{chunk-NWYHCZTY.js → chunk-VNEU7OUN.js} +1 -1
- package/dist/chunks/{chunk-5QUTQHXF.js → chunk-WNFDR5PC.js} +198 -80
- package/dist/chunks/{chunk-LJI4N6FV.js → chunk-XNN5PZTI.js} +1 -1
- package/dist/chunks/{chunk-QJWVYOOV.js → chunk-Z44YFIN6.js} +2 -2
- package/dist/chunks/{chunk-ZWIMLT6P.js → chunk-ZOTXXGUM.js} +7 -7
- package/dist/chunks/{cli-FULPXIKJ.js → cli-WA7FOQKC.js} +35 -35
- package/dist/chunks/{commands-BNWFNTD3.js → commands-J52MJ6NF.js} +3 -3
- package/dist/chunks/{conflict-5BKCDV2F.js → conflict-D4GVAURN.js} +2 -2
- package/dist/chunks/{contract-WI23OXVC.js → contract-GW7US3UF.js} +4400 -3548
- package/dist/chunks/{cowork-DZBBVNMQ.js → cowork-GZDODGKF.js} +1 -1
- package/dist/chunks/{create-flow-7ZRBRKX7.js → create-flow-ERDGW3FZ.js} +10 -6
- package/dist/chunks/{data-PAZVE6QE.js → data-HTQZRPPI.js} +1 -1
- package/dist/chunks/{ebuilder-form-5SQXIGXN.js → ebuilder-form-GHNIZ7ET.js} +2 -2
- package/dist/chunks/{ehr-CX5F4ZAU.js → ehr-P6T7OAAV.js} +2 -2
- package/dist/chunks/{entry-mode-I2BYNONZ.js → entry-mode-SQU5WTX6.js} +3 -3
- package/dist/chunks/{env-ZAQZ7EHN.js → env-DASBNSEM.js} +2 -2
- package/dist/chunks/{esb-DQTXDIBF.js → esb-ATRKVHCD.js} +3 -3
- package/dist/chunks/{factory-XRI6KZ7H.js → factory-A3NAKZAA.js} +1 -1
- package/dist/chunks/{fna-FK6HQVJL.js → fna-IKYI3SST.js} +1 -1
- package/dist/chunks/{group-chat-MLWNYM2P.js → group-chat-7SEAVAJR.js} +3 -3
- package/dist/chunks/{host-MEC4VQZA.js → host-6UOXYOOY.js} +2 -2
- package/dist/chunks/{host-KUMU3DDK.js → host-EJSJSLVK.js} +2 -2
- package/dist/chunks/{host-3EPREGXS.js → host-EYNLB6S4.js} +2 -2
- package/dist/chunks/{host-T6NNQGVZ.js → host-OT4KNR3G.js} +2 -2
- package/dist/chunks/{host-VI7Q45PM.js → host-UY4LQPN4.js} +2 -2
- package/dist/chunks/{host-J74JGYAW.js → host-XXGDQM7D.js} +2 -2
- package/dist/chunks/{hrm-KKVAW4P5.js → hrm-5JQ7QZ6A.js} +2 -2
- package/dist/chunks/{im-47CIWQNL.js → im-2YJW3EI5.js} +2 -2
- package/dist/chunks/{invoice-CDYRBNIG.js → invoice-37HR6L3W.js} +937 -552
- package/dist/chunks/{jiuchuanhui-M7QTRHZK.js → jiuchuanhui-KBWUZ7WT.js} +1 -1
- package/dist/chunks/{lazy-dispatch-FKQJZFI5.js → lazy-dispatch-ZDKLS5MR.js} +6 -6
- package/dist/chunks/{mail-NRBS5N6Y.js → mail-YBKUM6HM.js} +1 -1
- package/dist/chunks/{meeting-WC5LD3IO.js → meeting-7AEQGBAT.js} +19 -13
- package/dist/chunks/minute-doc-REI6RUE4.js +20 -0
- package/dist/chunks/{okr-EHKSKMPL.js → okr-HW7IULIR.js} +1 -1
- package/dist/chunks/{operations-V5VM5MS2.js → operations-4P2UYVLH.js} +3 -3
- package/dist/chunks/{performance-ZJADXJPN.js → performance-PM2G6L3E.js} +1 -1
- package/dist/chunks/{plan-OTDNBDJ7.js → plan-3YYGZ7ZM.js} +1 -1
- package/dist/chunks/{project-4XVBQ3HX.js → project-6PRGBLO2.js} +39 -15
- package/dist/chunks/{reception-3FAHOOH7.js → reception-7G3J2MA6.js} +1 -1
- package/dist/chunks/{recruit-stage-3WTVWW2K.js → recruit-stage-TLZJUFHD.js} +544 -464
- package/dist/chunks/{registry-TJGCVRCW.js → registry-3VTB3KLV.js} +3 -3
- package/dist/chunks/{registry-F4YFZLOD.js → registry-KQ4TNUWO.js} +1 -1
- package/dist/chunks/{registry-NBTBXR4L.js → registry-UVTI323K.js} +12 -11
- package/dist/chunks/{room-recommend-KL62XB2Y.js → room-recommend-ELEJUYBN.js} +4 -4
- package/dist/chunks/{schedule-XOISYUPB.js → schedule-XBKY7VEA.js} +4 -4
- package/dist/chunks/{smart-extract-UYGNV3BM.js → smart-extract-T5Z4AULN.js} +1 -1
- package/dist/chunks/{update-AV5VOXGY.js → update-77ZUIYSG.js} +2 -2
- package/dist/chunks/{workflow-V54LJPXL.js → workflow-SYCBS5XD.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/internal/update/service.js +9 -8
- package/dist/shortcuts/contract/data/collection-ledger-html.js +109 -33
- package/dist/shortcuts/contract/data/collection-node-catalog.js +26 -2
- package/dist/shortcuts/contract/data/report-renderers.js +75 -31
- package/dist/shortcuts/contract/data/report-spec.js +17 -3
- package/dist/shortcuts/contract/manifest.js +20 -3
- package/dist/shortcuts/contract/operations/bizreview-report.js +23 -2
- package/dist/shortcuts/contract/operations/collection-node.js +116 -1
- package/dist/shortcuts/contract/operations/compare-report.js +27 -5
- package/dist/shortcuts/contract/operations/credit-page.js +11 -2
- package/dist/shortcuts/contract/operations/docx-slots.js +27 -2
- package/dist/shortcuts/contract/operations/draft-submit.js +9 -6
- package/dist/shortcuts/contract/operations/elements-build.js +162 -30
- package/dist/shortcuts/contract/operations/elements-spec.js +50 -0
- package/dist/shortcuts/contract/operations/generated-submit.js +35 -0
- package/dist/shortcuts/contract/operations/ledger-card.js +32 -2
- package/dist/shortcuts/contract/operations/ledger-stat.js +17 -5
- package/dist/shortcuts/contract/operations/ledger.js +88 -16
- package/dist/shortcuts/contract/operations/metrics.js +16 -3
- package/dist/shortcuts/contract/operations/ops-draft.js +359 -27
- package/dist/shortcuts/contract/operations/page.js +23 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +91 -13
- package/dist/shortcuts/contract/operations/quote-submit.js +16 -0
- package/dist/shortcuts/contract/operations/review-report.js +11 -3
- package/dist/shortcuts/contract/operations/save-recognize.js +62 -1
- package/dist/shortcuts/contract/operations/triage.js +18 -3
- package/dist/shortcuts/contract/operations/viewlink.js +17 -1
- package/dist/shortcuts/ehr/operations/recruit.js +255 -90
- package/dist/shortcuts/invoice/business-response.js +13 -0
- package/dist/shortcuts/invoice/calendar.js +24 -0
- package/dist/shortcuts/invoice/host.js +26 -15
- package/dist/shortcuts/invoice/index.js +2 -2
- package/dist/shortcuts/invoice/invoice-record.js +7 -2
- package/dist/shortcuts/invoice/manifest.js +179 -155
- package/dist/shortcuts/invoice/operations/get.js +9 -3
- package/dist/shortcuts/invoice/operations/issuing-red-requests.js +138 -0
- package/dist/shortcuts/invoice/operations/registry.js +4 -5
- package/dist/shortcuts/invoice/operations/reim-auto.js +40 -2
- package/dist/shortcuts/invoice/operations/reim-customer-projects.js +79 -0
- package/dist/shortcuts/invoice/operations/reim-customer.js +79 -30
- package/dist/shortcuts/invoice/operations/reim-relation.js +0 -146
- package/dist/shortcuts/invoice/operations/reim.js +2 -126
- package/dist/shortcuts/invoice/operations/shared.js +15 -17
- package/dist/shortcuts/invoice/preapproval-enrichment.js +180 -0
- package/dist/shortcuts/invoice/projection.js +14 -0
- package/dist/shortcuts/invoice/read-enrichment.js +123 -0
- package/dist/shortcuts/meeting/confirm-gate.js +42 -0
- package/dist/shortcuts/meeting/continuation.js +6 -2
- package/dist/shortcuts/meeting/minute-doc.js +119 -12
- package/dist/shortcuts/meeting/operations/attachment.js +19 -0
- package/dist/shortcuts/meeting/operations/compose-outcome.js +24 -2
- package/dist/shortcuts/meeting/operations/eb/conflict.js +2 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +162 -19
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +22 -3
- package/dist/shortcuts/meeting/operations/group-share.js +268 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +58 -1
- package/dist/shortcuts/meeting/operations/minute-export.js +295 -0
- package/dist/shortcuts/meeting/operations/registry.js +4 -0
- package/dist/shortcuts/project/operations/read.js +40 -15
- package/dist/shortcuts/recruit-stage/context.js +16 -81
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +89 -53
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +15 -5
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +46 -108
- package/dist/shortcuts/recruit-stage/operations/list.js +203 -74
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -85
- package/dist/shortcuts/recruit-stage/operations/search.js +113 -53
- package/dist/shortcuts/recruit-stage/shared.js +153 -4
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +11 -0
- package/dist/shortcuts/workflow/operations/read.js +24 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +2 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +28 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.node.js +198 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subordinate.js +70 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +15 -5
- package/docs/agent-invoice.md +28 -2
- package/docs/invoice.md +60 -9
- package/docs/project.md +1 -1
- package/package.json +1 -1
- package/skill-template/domains/yepiaotong.md +36 -7
- package/skills/weaver-e10-jinchengda/SKILL.md +64 -28
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +26 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +9 -8
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +47 -52
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +7 -1
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +44 -1
- package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +8 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +33 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +17 -3
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +18 -10
- package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +77 -37
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +7 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +55 -12
- package/skills/weaver-e10-jinchengda/references/contract-review-todo.md +102 -0
- package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +1 -17
- package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +11 -8
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +2 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +6 -6
- package/skills/weaver-e10-meeting/SKILL.md +203 -80
- package/skills/weaver-e10-meeting/references/create-quickstart.md +98 -0
- package/skills/weaver-e10-meeting/references/delivery-checklist.md +34 -0
- package/skills/weaver-e10-meeting/references/error-codes.md +44 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +56 -3
- package/skills/weaver-e10-meeting/references/room-recommend.md +2 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +158 -146
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +64 -51
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +56 -18
- package/skills/weaver-e10-recruit-stage/lib/recruit-attach-probe.mjs +127 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +217 -30
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +39 -7
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +2 -2
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +18 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +29 -31
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +4 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -20
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +10 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +21 -25
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +19 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +31 -58
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +2 -2
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +2 -2
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +1 -1
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +25 -15
- package/skills/weaver-e10-shijingran/SKILL.md +2 -2
- package/skills/weaver-e10-shijingran/references/operations.md +5 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-workflow/SKILL.md +13 -9
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +33 -8
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +19 -14
- package/skills/weaver-e10-workflow/references/workflow-create.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +4 -2
- package/skills/weaver-e10-workflow/references/workflow-view.md +3 -3
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +132 -42
- package/skills/weaver-e10-yepiaotong/SKILL.md +133 -61
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +18 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +3 -3
- package/skills/weaver-e10-yepiaotong/references/invoice-download.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +13 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +6 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +42 -45
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +18 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +14 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-red-workflow.md +96 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +56 -369
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +16 -6
- package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +38 -0
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +163 -646
- package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +90 -44
- package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +85 -0
- package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +61 -0
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +91 -280
- package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +98 -0
- package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +48 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +234 -695
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +395 -204
- package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +84 -0
- package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +165 -0
- package/templates/meeting/minute.docx +0 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +0 -93
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +0 -774
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +0 -111
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +0 -360
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +0 -167
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* 链路(本 operation 负责 ①~④,⑤⑥ 由调用方按 nextCommands 继续):
|
|
5
5
|
*
|
|
6
6
|
* ① 客户 → 该客户的**销售合同**(多条让用户自己选,唯一则继续)→ 取「合同总金额」`htzje`
|
|
7
|
-
* ② 百分比(默认 10%,可被用户指定)×
|
|
8
|
-
*
|
|
7
|
+
* ② 百分比(默认 10%,可被用户指定)× **计费基数** = **运维合同金额**;基数默认取台账合同总金额,
|
|
8
|
+
* 台账合同 **0 元或处理进度=作废/终止/解除 一律不可用** → 返回 `NEED_BASE_CONFIRM` 让用户
|
|
9
|
+
* 「换一份合同」或「直接给 `baseAmount`」,⛔ 不硬生成 0 元合同
|
|
10
|
+
* ③ 在**范文库**里按名称找系统维护的**年度维护服务合同模板**(命中多篇按优先级取第一,并把候选摊出来);
|
|
11
|
+
* 附件 fileId 解析:显式入参 `templateFileId` → 范文库行(`mapResult` 形态与展示形态都要能解析)
|
|
12
|
+
* → 自动回退 `contract.recommend.doc`;三条路都拿不到时返回 `NEED_TEMPLATE_FILE_ID` 让用户指定,**不抛死胡同错误**
|
|
9
13
|
* ④ 下载该范文 → `docx.slots.scan` → 按模板真实位点生成**填充方案**(金额一律走 `$quote` 值引用,不经过模型上下文)
|
|
10
14
|
* ⑤ `contract.docx.slots.fill`(template/out/plan)
|
|
11
15
|
* ⑥ `contract.quotescreen.submit`(上传 + 装配要素 + 存识别记录 → `open_web` 开 `tab=Extract`)
|
|
@@ -22,6 +26,7 @@ import { contractValidationError } from '../errors.js';
|
|
|
22
26
|
import { contractDocxSlotsOperations } from './docx-slots.js';
|
|
23
27
|
import { contractFileDownloadOperations } from './file-download.js';
|
|
24
28
|
import { contractPerformanceOperations } from './performance.js';
|
|
29
|
+
import { contractRecommendOperations } from './recommend.js';
|
|
25
30
|
import { requireNonEmptyString } from './shared.js';
|
|
26
31
|
// ---------------------------------------------------------------- 固定常量
|
|
27
32
|
const SALES_LIST_ID = '846297265322576591';
|
|
@@ -38,10 +43,23 @@ const LIST_DATAS_PATH = '/api/ebuilder/form/list/getListDatas';
|
|
|
38
43
|
/** 运维/维护类模板的命中优先级(越靠前越专指「年度维护服务合同」)。 */
|
|
39
44
|
const TEMPLATE_KEYWORDS = ['年度维护服务合同', '维护服务合同', '运维服务合同', '运维合同', '维护服务', '维保服务', '运维', '维保', '维护'];
|
|
40
45
|
const DEFAULT_PERCENT = 10;
|
|
46
|
+
/** 候选销售合同列表上限 = 一次取数的页大小(pageSize)。⛔ 不要再往小改:截掉的候选 agent 再也取不回来。 */
|
|
47
|
+
const CANDIDATE_LIMIT = 50;
|
|
41
48
|
/** 甲方占位(模板里写作 `***有限公司`),按客户全称替换。 */
|
|
42
49
|
const PARTY_PLACEHOLDER = '***有限公司';
|
|
43
50
|
const PLAN_SCAN_OPERATION = 'contract.docx.slots.scan';
|
|
44
51
|
const FILE_DOWNLOAD_OPERATION = 'contract.file.download';
|
|
52
|
+
const RECOMMEND_OPERATION = 'contract.recommend.doc';
|
|
53
|
+
/** 范文附件 id 一定是长数字串(E10 附件 id 形如 1333557727371280453)。 */
|
|
54
|
+
const FILE_ID_RE = /^\d{6,}$/u;
|
|
55
|
+
/**
|
|
56
|
+
* 范文行里可能**直接**放附件 id 的扁平字段。范文库同一行有两种取数形态:
|
|
57
|
+
* `mapResult` 响应把附件 id 放在 `file_id`;列表展示形态同名字段放的是**文件名**,
|
|
58
|
+
* 真 id 藏在 `file_idSpan` 的 JSON 里。所以这里必须用「纯数字」判定,不能按字段名取值就信。
|
|
59
|
+
*/
|
|
60
|
+
const FLAT_FILE_ID_KEYS = ['file_id', 'fileId', 'fileid', 'fid', 'attachment_id', 'attachmentId', 'fjid'];
|
|
61
|
+
/** 附件地址里抠 id:`/api/file/remotedownload/<id>/…`、`…?fileId=<id>`。 */
|
|
62
|
+
const FILE_ID_IN_URL_RES = [/\bremotedownload\/(\d{6,})/iu, /[?&]fileId=(\d{6,})/iu];
|
|
45
63
|
// ---------------------------------------------------------------- 纯函数(可单测)
|
|
46
64
|
function isRecord(value) {
|
|
47
65
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -94,13 +112,39 @@ export function rankTemplates(rows, keywords = TEMPLATE_KEYWORDS) {
|
|
|
94
112
|
.sort((a, b) => (a.score === b.score ? a.order - b.order : a.score - b.score))
|
|
95
113
|
.map((item) => item.row);
|
|
96
114
|
}
|
|
115
|
+
/** 从附件地址里抠 fileId:`/api/file/remotedownload/<id>/…`、`…?fileId=<id>`。 */
|
|
116
|
+
export function fileIdFromUrl(value) {
|
|
117
|
+
for (const pattern of FILE_ID_IN_URL_RES) {
|
|
118
|
+
const matched = pattern.exec(value);
|
|
119
|
+
if (matched)
|
|
120
|
+
return matched[1];
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
97
124
|
/**
|
|
98
|
-
* 从范文行里挖出附件 fileId
|
|
125
|
+
* 从范文行里挖出附件 fileId。范文库同一行在两种取数形态下差别很大,两条路都必须走通:
|
|
126
|
+
*
|
|
127
|
+
* - `mapResult` 形态(本 operation 实际调用的形态):`file_id` **直接就是附件 id**(纯数字串);
|
|
128
|
+
* - 列表展示形态:同名字段 `file_id` 放的是**文件名**,真 id 藏在 `file_idSpan` 的
|
|
129
|
+
* `FileComponent` JSON 里(`{"id":"…","type":"FileComponent","src":"…fileId=…"}`)。
|
|
99
130
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
131
|
+
* 行里还混着一堆长得像文件的干扰项(`creator` 的头像 URL、`file_idAction` 的动作对象),
|
|
132
|
+
* 所以 URL 兜底只在**已判定为文件对象**的节点上做,不做全行盲搜;容器行本身也不当文件对象
|
|
133
|
+
* (行级 `id` 是表单数据 id,不是附件 id)。
|
|
102
134
|
*/
|
|
103
135
|
export function extractAttachmentFileId(row) {
|
|
136
|
+
// ① 扁平标量:范文库 mapResult 响应里 file_id 就是附件 id(展示态下是文件名,用纯数字判定区分)
|
|
137
|
+
for (const key of FLAT_FILE_ID_KEYS) {
|
|
138
|
+
const value = text(row[key]);
|
|
139
|
+
if (!value)
|
|
140
|
+
continue;
|
|
141
|
+
if (FILE_ID_RE.test(value))
|
|
142
|
+
return value;
|
|
143
|
+
const fromUrl = fileIdFromUrl(value);
|
|
144
|
+
if (fromUrl)
|
|
145
|
+
return fromUrl;
|
|
146
|
+
}
|
|
147
|
+
// ② 文件对象(FileComponent / 带 fileExtendName / 文件名以 .docx/.pdf 结尾):先取 id,再从其地址里抠
|
|
104
148
|
const visit = (value, depth) => {
|
|
105
149
|
if (depth > 6)
|
|
106
150
|
return null;
|
|
@@ -128,8 +172,15 @@ export function extractAttachmentFileId(row) {
|
|
|
128
172
|
const looksLikeFile = text(value.type) === 'FileComponent'
|
|
129
173
|
|| typeof value.fileExtendName === 'string'
|
|
130
174
|
|| /\.(docx?|pdf)$/iu.test(text(value.name));
|
|
131
|
-
if (
|
|
132
|
-
|
|
175
|
+
if (looksLikeFile) {
|
|
176
|
+
if (FILE_ID_RE.test(id))
|
|
177
|
+
return id;
|
|
178
|
+
for (const key of ['src', 'downloadSrc', 'url', 'fileUrl']) {
|
|
179
|
+
const fromUrl = fileIdFromUrl(text(value[key]));
|
|
180
|
+
if (fromUrl)
|
|
181
|
+
return fromUrl;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
133
184
|
for (const item of Object.values(value)) {
|
|
134
185
|
const hit = visit(item, depth + 1);
|
|
135
186
|
if (hit)
|
|
@@ -138,7 +189,12 @@ export function extractAttachmentFileId(row) {
|
|
|
138
189
|
}
|
|
139
190
|
return null;
|
|
140
191
|
};
|
|
141
|
-
|
|
192
|
+
for (const item of Object.values(row)) {
|
|
193
|
+
const hit = visit(item, 0);
|
|
194
|
+
if (hit)
|
|
195
|
+
return hit;
|
|
196
|
+
}
|
|
197
|
+
return null;
|
|
142
198
|
}
|
|
143
199
|
/** 扫描结果里 `fullText` 偶发整段重复(模板里同一段被拆成两半),去掉重复的一半。 */
|
|
144
200
|
export function dedupeDoubled(value) {
|
|
@@ -177,6 +233,76 @@ export function computeMaintenanceAmount(baseTotal, percent) {
|
|
|
177
233
|
zeroBase: base === 0,
|
|
178
234
|
};
|
|
179
235
|
}
|
|
236
|
+
/** 处理进度里出现这些词说明该合同已不能充当计费基数(本机实测取值含「已归档」「作废」,textarea 不支持 notEq)。 */
|
|
237
|
+
const VOID_PROGRESS_RE = /作废|终止|解除/u;
|
|
238
|
+
/**
|
|
239
|
+
* 运维(年度维护)合同的**默认流程类型**。
|
|
240
|
+
*
|
|
241
|
+
* 2026-11-30 事故:本链路原默认「老客户增值」(文档给的由头是"维护服务是对已签约客户的增值"),
|
|
242
|
+
* 与技能自己的判定层直接冲突——
|
|
243
|
+
* - `contract-object-detect.md` §D4 类别表:**年度维护** 归 **常规** → `flowKey = 常规二次销售`;
|
|
244
|
+
* - `contract-type-fingerprints.md` §F3 指纹就叫「**常规二次销售 · 年度维护**」,样本正是本链路用的
|
|
245
|
+
* 《上海泛微软件有限公司年度维护服务合同模板 V1》;
|
|
246
|
+
* - `老客户增值` 在 D4 里对应「增值:**分权帐套(不可赠送)/ 实施及 license**」与「**升级合同**」。
|
|
247
|
+
* 所以默认值改为「常规二次销售」;用户/调用方显式指定时以指定值优先。
|
|
248
|
+
*/
|
|
249
|
+
export const DEFAULT_MAINTENANCE_FLOW = '常规二次销售';
|
|
250
|
+
/** 决定本链路用哪个合同流程(纯函数,可单测):显式指定优先,否则按 D4/F3 默认「常规二次销售」。 */
|
|
251
|
+
export function resolveMaintenanceFlow(requested) {
|
|
252
|
+
const asked = text(requested);
|
|
253
|
+
if (asked) {
|
|
254
|
+
return { flow: asked, source: 'input', reason: '调用方/用户显式指定,按其口径' };
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
flow: DEFAULT_MAINTENANCE_FLOW,
|
|
258
|
+
source: 'default',
|
|
259
|
+
reason: '年度维护(运维)服务属 contract-object-detect.md §D4 的「常规」类,'
|
|
260
|
+
+ 'contract-type-fingerprints.md §F3 指纹即「常规二次销售 · 年度维护」;'
|
|
261
|
+
+ '老客户增值对应分权帐套(不可赠送)/ 实施及 license 与升级合同',
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* 计费基数评估(纯函数,可单测):
|
|
266
|
+
*
|
|
267
|
+
* - 用户显式给了 `baseAmount`:**以用户给的数为基数**,仍按同一百分比由 CLI 本地算金额(`$quote` 链路不变);
|
|
268
|
+
* - 否则用台账的「合同总金额」,但 **0 元、或处理进度为 作废/终止/解除 一律不可用**——
|
|
269
|
+
* 真实台账里这两类都存在(维森集团 `2019611597` 就是「作废 + 0.00」),
|
|
270
|
+
* 生成 0 元维护合同没有业务意义,必须让用户「换一份合同」或「直接给基数」,⛔ 不猜、不硬生成。
|
|
271
|
+
*/
|
|
272
|
+
export function assessBillingBase(input) {
|
|
273
|
+
const progress = text(input.ledgerProgress);
|
|
274
|
+
const ledger = computeMaintenanceAmount(input.ledgerAmount, input.percent);
|
|
275
|
+
const voided = VOID_PROGRESS_RE.test(progress);
|
|
276
|
+
const riskNotes = [];
|
|
277
|
+
if (ledger.zeroBase)
|
|
278
|
+
riskNotes.push('台账合同的「合同总金额」为 0');
|
|
279
|
+
if (voided)
|
|
280
|
+
riskNotes.push(`台账合同的「处理进度」为「${progress}」`);
|
|
281
|
+
if (input.userBaseAmount !== undefined) {
|
|
282
|
+
return {
|
|
283
|
+
usable: true,
|
|
284
|
+
baseSource: 'user',
|
|
285
|
+
amount: computeMaintenanceAmount(input.userBaseAmount, input.percent),
|
|
286
|
+
blockReason: null,
|
|
287
|
+
riskNotes,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
let blockReason = null;
|
|
291
|
+
if (ledger.zeroBase) {
|
|
292
|
+
blockReason = `销售合同的「合同总金额」是 ${ledger.base} 元,按 ${input.percent}% 算出来的运维合同金额也是 0 元`;
|
|
293
|
+
}
|
|
294
|
+
if (voided) {
|
|
295
|
+
const why = `销售合同的「处理进度」是「${progress}」,不是可签署状态`;
|
|
296
|
+
blockReason = blockReason ? `${blockReason};而且${why}` : why;
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
usable: blockReason === null,
|
|
300
|
+
baseSource: 'ledger',
|
|
301
|
+
amount: ledger,
|
|
302
|
+
blockReason,
|
|
303
|
+
riskNotes,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
180
306
|
/**
|
|
181
307
|
* 按模板真实位点生成填充方案:
|
|
182
308
|
* - 段落/单元格:占位与签署日期按实际值写;
|
|
@@ -311,6 +437,66 @@ async function queryModelTexts(context) {
|
|
|
311
437
|
}
|
|
312
438
|
return [];
|
|
313
439
|
}
|
|
440
|
+
/** 从推荐结果单项的 `files[]` 里取附件 fileId(先取数字 id,再从它的地址里抠)。 */
|
|
441
|
+
function fileIdFromRecommendationItem(item) {
|
|
442
|
+
const files = Array.isArray(item.files) ? item.files : [];
|
|
443
|
+
for (const file of files) {
|
|
444
|
+
if (!isRecord(file))
|
|
445
|
+
continue;
|
|
446
|
+
const flat = text(file.id ?? file.file_id);
|
|
447
|
+
if (FILE_ID_RE.test(flat))
|
|
448
|
+
return flat;
|
|
449
|
+
const fromUrl = fileIdFromUrl(text(file.src) || text(file.downloadSrc));
|
|
450
|
+
if (fromUrl)
|
|
451
|
+
return fromUrl;
|
|
452
|
+
const nested = extractAttachmentFileId(file);
|
|
453
|
+
if (nested)
|
|
454
|
+
return nested;
|
|
455
|
+
}
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* 范文库行解析不出附件 fileId 时的**自动回退**:调一次 `contract.recommend.doc`(只读语义匹配,
|
|
460
|
+
* 服务端本身要 30~40 秒),优先取与范文库命中**同名**的那一篇,否则取 rank1。
|
|
461
|
+
*
|
|
462
|
+
* 取不到(接口报错 / 列表为空 / 一条都没有附件)一律返回 null,由上层转成
|
|
463
|
+
* 「需要用户指定模板」的结构化结果——⛔ 不再抛出让 agent 无处可去的死胡同错误。
|
|
464
|
+
*/
|
|
465
|
+
export async function pickTemplateViaRecommend(context, options) {
|
|
466
|
+
const { customer, percent, preferredFileName } = options;
|
|
467
|
+
let recommendations = [];
|
|
468
|
+
try {
|
|
469
|
+
const result = await findOperation(contractRecommendOperations, RECOMMEND_OPERATION).execute({
|
|
470
|
+
content: `${customer}年度维护服务合同(运维服务/维护服务),服务期一年,维护费按历史销售合同金额的 ${percent}% 计`,
|
|
471
|
+
}, context);
|
|
472
|
+
recommendations = (Array.isArray(result.data?.recommendations) ? result.data.recommendations : [])
|
|
473
|
+
.filter(isRecord);
|
|
474
|
+
}
|
|
475
|
+
catch {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
if (!recommendations.length)
|
|
479
|
+
return null;
|
|
480
|
+
const normalize = (value) => text(value).replace(/\.(docx?|pdf)$/iu, '').replace(/\s+/gu, '').toLowerCase();
|
|
481
|
+
const preferred = normalize(preferredFileName);
|
|
482
|
+
const ordered = preferred
|
|
483
|
+
? [...recommendations].sort((a, b) => Number(normalize(b.fileName ?? b.file_name) === preferred)
|
|
484
|
+
- Number(normalize(a.fileName ?? a.file_name) === preferred))
|
|
485
|
+
: recommendations;
|
|
486
|
+
for (const item of ordered) {
|
|
487
|
+
const fileId = fileIdFromRecommendationItem(item);
|
|
488
|
+
if (fileId) {
|
|
489
|
+
return {
|
|
490
|
+
fileId,
|
|
491
|
+
fileName: text(item.fileName ?? item.file_name) || preferredFileName,
|
|
492
|
+
templateId: text(item.templateId ?? item.template_id),
|
|
493
|
+
matchScore: typeof item.matchScore === 'number' ? item.matchScore : null,
|
|
494
|
+
rank: typeof item.rank === 'number' ? item.rank : null,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
314
500
|
export const contractOpsDraftOperations = [
|
|
315
501
|
{
|
|
316
502
|
name: 'contract.ops.draft',
|
|
@@ -322,17 +508,29 @@ export const contractOpsDraftOperations = [
|
|
|
322
508
|
customer: { type: 'string', description: '客户全称(必填):用它查该客户的销售合同' },
|
|
323
509
|
salesContractNo: { type: 'string', description: '用户已选定的销售合同号;给了就跳过"多条让用户选"' },
|
|
324
510
|
percent: { type: 'number', description: '计费百分比,默认 10(即销售合同总额的 10%)' },
|
|
511
|
+
baseAmount: { type: 'number', description: '用户直接指定的计费基数(元,>0):给了就用它当基数,跳过台账「合同总金额」;用于台账合同为 0 元/作废时' },
|
|
325
512
|
outDir: { type: 'string', description: '产物目录(必填):范文 docx、ops.json、plan.json、生成的合同 docx 都放这里' },
|
|
326
513
|
today: { type: 'string', description: '仅测试/复核用:以该日期(YYYY-MM-DD)作为签订与生效日期' },
|
|
327
|
-
flow: { type: 'string', description: '
|
|
514
|
+
flow: { type: 'string', description: '合同流程类型,默认「常规二次销售」(年度维护属 D4 常规类 / F3 指纹);四类之一,用户指定优先' },
|
|
515
|
+
templateFileId: { type: 'string', description: '范文附件 id(纯数字):给了就直接下载它,跳过范文库附件解析;取自 contract.recommend.doc 的 file_id' },
|
|
516
|
+
templateFileName: { type: 'string', description: '范文文件名(配合 templateFileId 用):只影响产物命名与我方主体识别,缺省取范文库命中名' },
|
|
328
517
|
},
|
|
329
518
|
required: ['customer', 'outDir'],
|
|
330
519
|
},
|
|
331
520
|
async execute(input, context) {
|
|
332
|
-
const
|
|
521
|
+
const customerInput = requireNonEmptyString(input.customer, 'customer');
|
|
522
|
+
/**
|
|
523
|
+
* 业务用客户名:默认取入参;**台账命中后以台账「客户名称」`khmc` 为准归正**。
|
|
524
|
+
*
|
|
525
|
+
* 2026-12-01 事故:用户口语给简称(「韦莱」),工具把简称直接落进了合同——
|
|
526
|
+
* 合同名称、模板甲方、最终用户全成「韦莱」,而台账里客户全称是「韦莱保险经纪有限公司」。
|
|
527
|
+
* 台账本来就把全称放在 `khmc` 里,必须以它为准。
|
|
528
|
+
*/
|
|
529
|
+
let customer = customerInput;
|
|
333
530
|
const outDir = resolve(requireNonEmptyString(input.outDir, 'outDir'));
|
|
334
531
|
const salesContractNo = text(input.salesContractNo);
|
|
335
|
-
const
|
|
532
|
+
const flowDecision = resolveMaintenanceFlow(input.flow);
|
|
533
|
+
const flow = flowDecision.flow;
|
|
336
534
|
const percentRaw = input.percent === undefined || input.percent === null || input.percent === ''
|
|
337
535
|
? DEFAULT_PERCENT
|
|
338
536
|
: Number(input.percent);
|
|
@@ -340,16 +538,34 @@ export const contractOpsDraftOperations = [
|
|
|
340
538
|
throw contractValidationError('percent_invalid', `percent 必须在 0~100 之间(收到 ${String(input.percent)})`);
|
|
341
539
|
}
|
|
342
540
|
const percent = round2(percentRaw);
|
|
541
|
+
// 用户直接指定的计费基数(可选):入参体检放在**联网前**,非法值不得发出任何业务请求
|
|
542
|
+
const userBaseAmount = input.baseAmount === undefined || input.baseAmount === null || input.baseAmount === ''
|
|
543
|
+
? undefined
|
|
544
|
+
: Number(input.baseAmount);
|
|
545
|
+
if (userBaseAmount !== undefined && (!Number.isFinite(userBaseAmount) || userBaseAmount <= 0)) {
|
|
546
|
+
throw contractValidationError('base_amount_invalid', `baseAmount 必须是大于 0 的数字(收到「${String(input.baseAmount)}」)。`);
|
|
547
|
+
}
|
|
343
548
|
const todayIso = /^\d{4}-\d{2}-\d{2}$/u.test(text(input.today))
|
|
344
549
|
? text(input.today)
|
|
345
550
|
: new Date().toISOString().slice(0, 10);
|
|
346
551
|
const base = {
|
|
347
552
|
customer,
|
|
553
|
+
/** 用户原样传入的客户名(可能是简称):用于查台账;与台账全称不一致时以台账为准 */
|
|
554
|
+
customerInput,
|
|
555
|
+
/** 台账命中的客户全称(去重):命中多家客户时列出,供"先定客户再选合同" */
|
|
556
|
+
customerNames: [],
|
|
348
557
|
percent,
|
|
349
558
|
ledger: { menu: '直销合同', listId: SALES_LIST_ID, objId: SALES_OBJ_ID, apiPrefix: API_PREFIX },
|
|
350
559
|
outDir,
|
|
351
560
|
flow,
|
|
561
|
+
/** 流程类型怎么来的:input=调用方/用户指定,default=本链路默认口径 */
|
|
562
|
+
flowSource: flowDecision.source,
|
|
563
|
+
flowReason: flowDecision.reason,
|
|
352
564
|
warnings: [],
|
|
565
|
+
/** 该客户销售合同候选(全部摊出,见 CANDIDATE_LIMIT)与条数口径 */
|
|
566
|
+
candidates: [],
|
|
567
|
+
counts: { total: 0, returned: 0, remaining: 0 },
|
|
568
|
+
candidatesTruncated: false,
|
|
353
569
|
};
|
|
354
570
|
// ① 客户 → 销售合同
|
|
355
571
|
const lookup = await findOperation(contractPerformanceOperations, LIST_QUERY_OPERATION).execute({
|
|
@@ -357,13 +573,15 @@ export const contractOpsDraftOperations = [
|
|
|
357
573
|
listId: SALES_LIST_ID,
|
|
358
574
|
appId: APP_ID,
|
|
359
575
|
objId: SALES_OBJ_ID,
|
|
360
|
-
searchParamJson: buildSalesLookupSearchParam(
|
|
576
|
+
searchParamJson: buildSalesLookupSearchParam(customerInput, salesContractNo || undefined),
|
|
361
577
|
pageSize: 50,
|
|
362
578
|
maxPages: 1,
|
|
363
579
|
}, context);
|
|
364
580
|
const rows = (Array.isArray(lookup.data?.rows) ? lookup.data.rows : []).filter(isRecord);
|
|
365
581
|
const total = Number(lookup.data?.pagination?.total ?? rows.length);
|
|
366
|
-
|
|
582
|
+
// 一次取数只取一页(pageSize=50);候选**全部摊出来**,不再硬截 20 条
|
|
583
|
+
// (2026-11-30 事故:韦莱名下 28 份合同,后 8 份被 slice(0,20) 吃掉且无从再取)。
|
|
584
|
+
const candidates = rows.slice(0, CANDIDATE_LIMIT).map((row, index) => ({
|
|
367
585
|
index: index + 1,
|
|
368
586
|
contractNo: text(row.hth),
|
|
369
587
|
customerName: text(row.khmc),
|
|
@@ -373,6 +591,30 @@ export const contractOpsDraftOperations = [
|
|
|
373
591
|
performanceMonth: text(row.htyjny),
|
|
374
592
|
signDate: text(row.qdrq),
|
|
375
593
|
}));
|
|
594
|
+
const lookupTruncated = lookup.data?.pagination?.truncated === true || candidates.length < total;
|
|
595
|
+
base.candidates = candidates;
|
|
596
|
+
// ①b 客户全称归正:台账 `khmc` 才是权威客户名(用户可能只给简称)
|
|
597
|
+
const customerNames = [...new Set(candidates.map((item) => item.customerName).filter((name) => name))];
|
|
598
|
+
base.customerNames = customerNames;
|
|
599
|
+
if (customerNames.length === 1) {
|
|
600
|
+
customer = customerNames[0];
|
|
601
|
+
base.customer = customer;
|
|
602
|
+
if (customer !== customerInput) {
|
|
603
|
+
base.warnings.push(`客户名称按台账全称归正:「${customerInput}」→「${customer}」;`
|
|
604
|
+
+ '合同名称、模板甲方、最终用户一律用台账全称(简称不得落进合同)。');
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
else if (customerNames.length > 1) {
|
|
608
|
+
base.warnings.push(`客户名「${customerInput}」在台账命中 ${customerNames.length} 家客户:${customerNames.join(' / ')};`
|
|
609
|
+
+ '请先让用户确认是哪一家,再判断合同条数(见 §5「模糊命中多家」)。');
|
|
610
|
+
}
|
|
611
|
+
base.counts = { total, returned: candidates.length, remaining: Math.max(0, total - candidates.length) };
|
|
612
|
+
base.candidatesTruncated = lookupTruncated;
|
|
613
|
+
const lookupWarning = text(lookup.data?.warning);
|
|
614
|
+
if (lookupTruncated) {
|
|
615
|
+
base.warnings.push(lookupWarning
|
|
616
|
+
|| `该客户共 ${total} 份销售合同,本次只取回 ${candidates.length} 份(一次一页,pageSize=${CANDIDATE_LIMIT})。`);
|
|
617
|
+
}
|
|
376
618
|
if (total === 0) {
|
|
377
619
|
return {
|
|
378
620
|
status: 'COMPLETE',
|
|
@@ -394,10 +636,13 @@ export const contractOpsDraftOperations = [
|
|
|
394
636
|
status: 'NEED_CONTRACT_CHOICE',
|
|
395
637
|
salesContract: null,
|
|
396
638
|
candidates,
|
|
397
|
-
counts:
|
|
639
|
+
counts: base.counts,
|
|
398
640
|
nextAction: 'ask_user_to_choose',
|
|
399
641
|
nextCommand: `contract run contract.ops.draft --input '{"customer":"${customer}","salesContractNo":"<用户选中的合同号>","outDir":"${outDir.replace(/\\/gu, '\\\\')}"}'`,
|
|
400
|
-
message: `客户「${customer}」名下有 ${total}
|
|
642
|
+
message: `客户「${customer}」名下有 ${total} 份销售合同,已列出 ${candidates.length} 份,请让用户自己选一份作为计费基数(不要自行取第一条);选定后带 salesContractNo 重跑本命令。`
|
|
643
|
+
+ (lookupTruncated
|
|
644
|
+
? `⚠️ 还有 ${base.counts.remaining} 份未列出:请让用户直接给**合同号**(精确号,可按 合同号 精确定位),或按年份/金额缩小范围后重查。`
|
|
645
|
+
: ''),
|
|
401
646
|
},
|
|
402
647
|
};
|
|
403
648
|
}
|
|
@@ -408,15 +653,51 @@ export const contractOpsDraftOperations = [
|
|
|
408
653
|
progress: text(salesRow.cljd),
|
|
409
654
|
amount: text(salesRow.htzje),
|
|
410
655
|
contractType: text(salesRow.htzl),
|
|
656
|
+
/** 台账「销售类型」(本机实测取值含 增值二次销售 / 常规二次销售 / 第三方 / 直销销售):只作佐证,不决定新合同的流程 */
|
|
657
|
+
salesType: text(salesRow.xslx),
|
|
411
658
|
signDate: text(salesRow.qdrq),
|
|
412
659
|
performanceMonth: text(salesRow.htyjny),
|
|
413
660
|
};
|
|
414
|
-
// ②
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
661
|
+
// ② 金额:默认取台账合同的「合同总金额」;0 元 / 作废·终止·解除 一律停下来问用户
|
|
662
|
+
const assessment = assessBillingBase({
|
|
663
|
+
ledgerAmount: salesRow.htzje,
|
|
664
|
+
ledgerProgress: salesContract.progress,
|
|
665
|
+
userBaseAmount,
|
|
666
|
+
percent,
|
|
667
|
+
});
|
|
668
|
+
const amount = assessment.amount;
|
|
669
|
+
for (const note of assessment.riskNotes) {
|
|
670
|
+
base.warnings.push(`${note}(基数来源:${assessment.baseSource === 'user' ? '用户指定' : '台账合同总金额'});`
|
|
671
|
+
+ `运维合同金额 = ${amount.formula} 元,请人工核实。`);
|
|
672
|
+
}
|
|
673
|
+
if (!assessment.usable) {
|
|
674
|
+
base.warnings.push(`计费基数不可用,本次**不生成合同**:${assessment.blockReason}。`
|
|
675
|
+
+ '请让用户在「换一份销售合同」与「直接给一个计费基数」之间二选一。');
|
|
676
|
+
return {
|
|
677
|
+
status: 'COMPLETE',
|
|
678
|
+
data: {
|
|
679
|
+
...base,
|
|
680
|
+
status: 'NEED_BASE_CONFIRM',
|
|
681
|
+
salesContract,
|
|
682
|
+
amount,
|
|
683
|
+
candidates,
|
|
684
|
+
baseSource: assessment.baseSource,
|
|
685
|
+
nextAction: 'ask_user_to_confirm_base',
|
|
686
|
+
nextCommand: `contract run contract.ops.draft --input '{"customer":"${customer}","salesContractNo":"<换一条销售合同号>","outDir":"${outDir.replace(/\\/gu, '\\\\')}"}'`,
|
|
687
|
+
provideBaseCommand: `contract run contract.ops.draft --input '{"customer":"${customer}","salesContractNo":"${salesContract.contractNo}","outDir":"${outDir.replace(/\\/gu, '\\\\')}","baseAmount":<用户给的计费基数>}'`,
|
|
688
|
+
message: `计费基数不可用:${assessment.blockReason}。`
|
|
689
|
+
+ `请让用户选:① 从 candidates 里换一条有效销售合同(带 salesContractNo 重跑);`
|
|
690
|
+
+ `② 直接给一个计费基数(带 baseAmount 重跑,金额仍由 CLI 按 ${percent}% 本地算)。`
|
|
691
|
+
+ '⛔ 不要自己换合同顶上,也不要生成 0 元的维护合同。',
|
|
692
|
+
},
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
// ③ 范文模板(显式给了 templateFileId 就直接用;否则范文库行 → contract.recommend.doc 回退)
|
|
696
|
+
const explicitTemplateFileId = text(input.templateFileId);
|
|
697
|
+
if (explicitTemplateFileId && !FILE_ID_RE.test(explicitTemplateFileId)) {
|
|
698
|
+
throw contractValidationError('template_file_id_invalid', `templateFileId 必须是范文附件的数字 id(收到「${explicitTemplateFileId}」);文件名不是 id,请取 contract.recommend.doc 返回的 file_id。`);
|
|
418
699
|
}
|
|
419
|
-
|
|
700
|
+
const explicitTemplateFileName = text(input.templateFileName);
|
|
420
701
|
const modelTexts = await queryModelTexts(context);
|
|
421
702
|
const matched = rankTemplates(modelTexts);
|
|
422
703
|
const templateCandidates = (matched.length ? matched : modelTexts).map((row) => ({
|
|
@@ -425,7 +706,7 @@ export const contractOpsDraftOperations = [
|
|
|
425
706
|
fileId: extractAttachmentFileId(row),
|
|
426
707
|
matched: matched.includes(row),
|
|
427
708
|
}));
|
|
428
|
-
if (!matched.length) {
|
|
709
|
+
if (!matched.length && !explicitTemplateFileId) {
|
|
429
710
|
return {
|
|
430
711
|
status: 'COMPLETE',
|
|
431
712
|
data: {
|
|
@@ -440,12 +721,52 @@ export const contractOpsDraftOperations = [
|
|
|
440
721
|
},
|
|
441
722
|
};
|
|
442
723
|
}
|
|
443
|
-
const templateRow = matched[0];
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
724
|
+
const templateRow = matched[0] ?? {};
|
|
725
|
+
let templateFileName = explicitTemplateFileName || text(templateRow.file_name ?? templateRow.fileName);
|
|
726
|
+
let templateId = text(templateRow.id ?? templateRow.rowKey ?? templateRow.form_data_id);
|
|
727
|
+
let templateFileId = explicitTemplateFileId || null;
|
|
728
|
+
let templateResolvedBy = 'input';
|
|
729
|
+
if (!templateFileId) {
|
|
730
|
+
templateResolvedBy = 'modeltext';
|
|
731
|
+
templateFileId = extractAttachmentFileId(templateRow);
|
|
732
|
+
}
|
|
733
|
+
let recommendedBy = null;
|
|
447
734
|
if (!templateFileId) {
|
|
448
|
-
|
|
735
|
+
const picked = await pickTemplateViaRecommend(context, {
|
|
736
|
+
customer,
|
|
737
|
+
percent,
|
|
738
|
+
preferredFileName: templateFileName,
|
|
739
|
+
});
|
|
740
|
+
if (picked) {
|
|
741
|
+
templateFileId = picked.fileId;
|
|
742
|
+
templateFileName = picked.fileName || templateFileName;
|
|
743
|
+
templateId = picked.templateId || templateId;
|
|
744
|
+
templateResolvedBy = 'recommend.doc';
|
|
745
|
+
recommendedBy = { fileName: picked.fileName, rank: picked.rank, matchScore: picked.matchScore };
|
|
746
|
+
base.warnings.push(`范文库行没解析出附件 fileId,已自动回退 contract.recommend.doc 取模板「${picked.fileName}」`
|
|
747
|
+
+ `(rank ${picked.rank ?? '-'} / 匹配分 ${picked.matchScore ?? '-'});请核对这是要用的那一篇。`);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (!templateFileId) {
|
|
751
|
+
return {
|
|
752
|
+
status: 'COMPLETE',
|
|
753
|
+
data: {
|
|
754
|
+
...base,
|
|
755
|
+
status: 'NEED_TEMPLATE_FILE_ID',
|
|
756
|
+
salesContract,
|
|
757
|
+
amount,
|
|
758
|
+
template: { templateId, fileName: templateFileName, fileId: null, resolvedBy: null },
|
|
759
|
+
templateCandidates,
|
|
760
|
+
nextAction: 'ask_user_to_provide_template',
|
|
761
|
+
nextCommand: `contract run contract.ops.draft --input '{"customer":"${customer}","salesContractNo":"${salesContract.contractNo}","outDir":"${outDir.replace(/\\/gu, '\\\\')}","templateFileId":"<范文附件 fileId>"}'`,
|
|
762
|
+
message: `范文「${templateFileName || '(未命名)'}」的附件 fileId 既没从范文库行解析出来,contract.recommend.doc 也没给出可用附件;`
|
|
763
|
+
+ '请让用户指定范文附件(templateFileId,取 contract.recommend.doc 的 file_id),再带该入参重跑本命令。',
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
if (!templateFileName) {
|
|
768
|
+
templateFileName = `${customer}年度维护服务合同模板.docx`;
|
|
769
|
+
base.warnings.push('没拿到范文文件名,按客户名兜底命名产物文档;模板内容以 templateFileId 指向的范文为准。');
|
|
449
770
|
}
|
|
450
771
|
// ④ 下载 + 扫描 + 出方案
|
|
451
772
|
const safeName = templateFileName.replace(/[\\/:*?"<>|]/gu, '_') || 'template.docx';
|
|
@@ -459,6 +780,10 @@ export const contractOpsDraftOperations = [
|
|
|
459
780
|
customer,
|
|
460
781
|
salesContractNo: salesContract.contractNo,
|
|
461
782
|
percent,
|
|
783
|
+
base_source: assessment.baseSource,
|
|
784
|
+
base_source_note: assessment.baseSource === 'user'
|
|
785
|
+
? '基数由用户直接指定(台账合同的合同总金额不可用)'
|
|
786
|
+
: '基数取台账合同的合同总金额',
|
|
462
787
|
totals: {
|
|
463
788
|
base_total: amount.base,
|
|
464
789
|
percent: amount.percent,
|
|
@@ -485,9 +810,13 @@ export const contractOpsDraftOperations = [
|
|
|
485
810
|
contractTitle: `${customer}协同办公系统(e-cology)软件年度维护合同`,
|
|
486
811
|
ourCompany,
|
|
487
812
|
sections: [{ name: '系统维护费', amount: { $quote: `${opsJsonPath}#totals.final_total` } }],
|
|
813
|
+
// 用户口述的用印顺序(如「对方先用印」)透传给收口;不传则收口落默认「我方先盖章」
|
|
814
|
+
...(typeof input.signWay === 'string' && input.signWay.trim() ? { signWay: input.signWay.trim() } : {}),
|
|
488
815
|
tab: 'Extract',
|
|
489
816
|
};
|
|
490
|
-
base.warnings.push(`流程类型按「${flow}
|
|
817
|
+
base.warnings.push(`流程类型按「${flow}」(来源:${flowDecision.source === 'input' ? '调用方指定' : '本链路默认口径'});依据:${flowDecision.reason}。`
|
|
818
|
+
+ '四类流程仍属业务判断:**必须经用户确认**,用户明确要「老客户增值 / 契约锁 / 新客户」时按其口径;'
|
|
819
|
+
+ '⛔ 未经用户确认不得直接调 quotescreen.submit,⛔ 不得把运维合同默认成「老客户增值」。');
|
|
491
820
|
return {
|
|
492
821
|
status: 'COMPLETE',
|
|
493
822
|
data: {
|
|
@@ -495,12 +824,15 @@ export const contractOpsDraftOperations = [
|
|
|
495
824
|
status: 'READY',
|
|
496
825
|
salesContract,
|
|
497
826
|
amount,
|
|
827
|
+
baseSource: assessment.baseSource,
|
|
498
828
|
template: {
|
|
499
829
|
templateId,
|
|
500
830
|
fileName: templateFileName,
|
|
501
831
|
fileId: templateFileId,
|
|
502
832
|
localPath: templatePath,
|
|
503
833
|
ourCompany,
|
|
834
|
+
resolvedBy: templateResolvedBy,
|
|
835
|
+
recommendedBy,
|
|
504
836
|
},
|
|
505
837
|
templateCandidates,
|
|
506
838
|
standardTerms,
|
|
@@ -47,6 +47,18 @@ export function creditPageUrl(baseUrl, names) {
|
|
|
47
47
|
const segments = names.map((name, index) => `name[${index}]=${encodeURIComponent(name)}`);
|
|
48
48
|
return `${baseOf(baseUrl)}/sp/contract/business/credit?${segments.join('&')}`;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* 外部资信详情页(`cloud.qianliling.com`)。
|
|
52
|
+
*
|
|
53
|
+
* 2026-12-01 定稿:**单独调用资信组件**(用户直接给企业名 / 多企业批量 / 把合同里的签约主体单独拿去查)
|
|
54
|
+
* 一律用 `open_web` 打开这个外部详情页,**一个主体一个地址**;
|
|
55
|
+
* `openIn` 用 `external`(外部/默认浏览器),⛔ 不走系统浏览器。
|
|
56
|
+
* 助手页里的资信(本轮有合同文件 → `tab=Credit`)仍走 `creditPageUrl`,两者不混用。
|
|
57
|
+
*/
|
|
58
|
+
export const CREDIT_DETAIL_HOST = 'https://cloud.qianliling.com';
|
|
59
|
+
export function creditDetailUrl(name) {
|
|
60
|
+
return `${CREDIT_DETAIL_HOST}/main/app-company/DetailPage?name=${encodeURIComponent(name)}`;
|
|
61
|
+
}
|
|
50
62
|
/** 流程发起页;带 fileId 时只追加 fileId(2026-11-19 起不再追加 automaticFormFilling)。 */
|
|
51
63
|
export function flowPageUrl(baseUrl, workflowId, fileId) {
|
|
52
64
|
const base = `${baseOf(baseUrl)}/sp/workflow/flowpage/create/${workflowId}?workflowId=${workflowId}&isCreate=1`;
|
|
@@ -77,3 +89,14 @@ export function aiSettingPageUrl(baseUrl) {
|
|
|
77
89
|
export function dataCardPageUrl(baseUrl, objId, dataId) {
|
|
78
90
|
return `${baseOf(baseUrl)}/sp/ebdfpage/card/0/${objId}/${dataId}`;
|
|
79
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* 项目卡片页:`/sp/ebdfpage/card/2/{项目基础 objId}/{项目ID}`。
|
|
94
|
+
*
|
|
95
|
+
* 与合同卡片只差 `card` 后的类型位(项目是 `2`,合同是 `0`)与 objId。
|
|
96
|
+
* `2` 与 objId 均由业务给出并实测:`https://www.e-cology.com.cn/sp/ebdfpage/card/2/1020275562853482532/{项目ID}`
|
|
97
|
+
* (该 objId 与项目看板 `PROJECT_BOARD.objId` 同值,即「项目基础」表单)。
|
|
98
|
+
*/
|
|
99
|
+
export const PROJECT_CARD_OBJ_ID = '1020275562853482532';
|
|
100
|
+
export function projectCardPageUrl(baseUrl, projectId) {
|
|
101
|
+
return `${baseOf(baseUrl)}/sp/ebdfpage/card/2/${PROJECT_CARD_OBJ_ID}/${projectId}`;
|
|
102
|
+
}
|