weaver-work-cli 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{archive-S2VKZWQ3.js → archive-BLDYBZDX.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-3GJ3TWXR.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-AFXJN4CK.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-VUJXWGWJ.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-VMJA7NSQ.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-EREB35VU.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-ATM2JO5S.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-E26ZIH7S.js} +5 -4
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-4OB22YKE.js} +48 -12
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-5CY37VLS.js} +131 -38
- package/dist/chunks/{chunk-EGANE35F.js → chunk-6G2JARDK.js} +1 -1
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-6VCQLZXE.js} +75 -76
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-BY3WDJO5.js} +1 -1
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-C5PIGPGX.js} +5 -3
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-EOZHSNND.js} +2 -2
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-G3ZM57PD.js} +2 -2
- package/dist/chunks/{chunk-XT77MP54.js → chunk-GOBNIGWS.js} +410 -24
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-GQK6WLOS.js} +5 -3
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-HEJPVXD3.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-I4C2KR2G.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-IGICM3WJ.js} +2 -2
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-LOVAIGM2.js} +387 -70
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-OMAGCLUE.js} +5 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-QAMIIFP6.js} +11 -11
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-QZYKZ7MQ.js} +16 -8
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-RR45ELVE.js} +30 -24
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-RV2JAA5I.js} +89 -8
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-SDPC7BG2.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-SHBDXEUE.js} +4 -7
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-THMBDCRA.js} +5 -3
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-TNFIUZ4H.js} +3 -3
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-WPBZQVLS.js} +1 -1
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-AMNTM3FV.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-PLO2V2NO.js} +2333 -4426
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-FZAXE6FO.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-2DAUN7HU.js} +16 -6
- package/dist/chunks/{data-FOODGAMF.js → data-7NXMWET4.js} +3 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-DEYHX6M7.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-QQH2DYYA.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-2JTVEKMP.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-2JZMXC6I.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-I5ZFHJUK.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-XIATYHU6.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-3V2TL6B2.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-CVYUZCOQ.js} +3 -3
- package/dist/chunks/{host-TJ5VVHM7.js → host-4DP7C7YQ.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-4KQCAEWA.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-4X2F3JPQ.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-BD7NAM33.js} +4 -4
- package/dist/chunks/{host-VTPAWDZV.js → host-CBONEAZS.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-L37QVNIV.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-OL3IKN7C.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-YXQWUF3R.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-4WY32PR2.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-L6SHLONH.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-OYE6QV24.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-PZV2KNRU.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-6SOBCC6N.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-KSJSJNOH.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-B76FW5M2.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-YOMEGFLV.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-4VBKUPFO.js} +5 -4
- package/dist/chunks/{plan-BLGPZF5M.js → plan-HBNZRQTI.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-IV6FWK74.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-BR5YURT6.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-4HQ6OGXT.js} +654 -336
- package/dist/chunks/{registry-I4DVPDMU.js → registry-7LICMV5J.js} +12 -12
- package/dist/chunks/{registry-3FYSWV3U.js → registry-JFQEFC7E.js} +3 -3
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-MZJQX65Q.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-43GLLE7Y.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-ZQ42BEW6.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-QKAEAZGM.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-6HV7H5PC.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +21 -1
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +115 -270
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +98 -25
- package/dist/shortcuts/contract/operations/ledger.js +315 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +289 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +264 -0
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/triage.js +13 -6
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +116 -7
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +28 -0
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +237 -347
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +109 -185
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +12 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +18 -17
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +73 -104
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +32 -37
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +70 -82
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +37 -33
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +94 -27
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +9 -15
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +9 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +59 -32
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +7 -5
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +21 -13
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +13 -13
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +11 -20
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +203 -54
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +4 -11
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +31 -33
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +83 -531
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +3 -1
- package/skills/weaver-e10-meeting/references/create-guardrails.md +14 -8
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +10 -10
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { contractValidationError } from '../errors.js';
|
|
2
2
|
import { FLOW_PRESETS } from './flow.js';
|
|
3
|
-
import { requireNonEmptyString } from './shared.js';
|
|
4
3
|
/**
|
|
5
4
|
* 智能填单识别记录保存接口。
|
|
6
5
|
*
|
|
@@ -17,47 +16,102 @@ import { requireNonEmptyString } from './shared.js';
|
|
|
17
16
|
export const SAVE_RECOGNIZE_PATH = '/api/ai/application/smartfill/data/saveRecognizeRecord';
|
|
18
17
|
/** 回传 E10 流程组件时固定使用的来源标识。 */
|
|
19
18
|
export const OPEN_SOURCE = 'xiaoE';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
/**
|
|
20
|
+
* 把本轮收集到的全部问题一次性抛出(2026-11-18)。
|
|
21
|
+
*
|
|
22
|
+
* 历史问题:校验是「逐项短路」的,缺 N 个字段就要调用 N 轮,
|
|
23
|
+
* 实测同一个命令连错 6 次(isSuccess → mainTable → mainTable.rows → subTables →
|
|
24
|
+
* attachmentFileId → flow),每轮 5~10 秒纯浪费。
|
|
25
|
+
* 现在改为「先收齐、再一次性报」,一轮就能补齐所有缺口。
|
|
26
|
+
*/
|
|
27
|
+
function throwIssues(issues) {
|
|
28
|
+
const detail = issues.map((item, index) => `${index + 1}) ${item.message}`).join('\n');
|
|
29
|
+
throw contractValidationError(issues[0].subtype, `入参校验未通过,共 ${issues.length} 项:\n${detail}`);
|
|
25
30
|
}
|
|
26
31
|
/**
|
|
27
|
-
*
|
|
32
|
+
* 校验识别结果的顶层结构并把问题推入 `issues`,通过时返回接口要的 JSON 字符串。
|
|
28
33
|
*
|
|
29
34
|
* 接口要求 `recognizeResult` 是**字符串**(不是嵌套对象),且顶层固定
|
|
30
35
|
* `isSuccess` / `mainTable` / `subTables` 三个字段;`subTables` 无明细时必须是 `[]`。
|
|
36
|
+
*
|
|
37
|
+
* 与旧实现的差别:不再遇到第一个问题就抛错,而是把 5 项结构问题全部收集后交付调用方,
|
|
38
|
+
* 由调用方与附件、流程参数的问题合并成一次报错。
|
|
31
39
|
*/
|
|
32
|
-
|
|
40
|
+
function collectRecognizeIssues(value, issues) {
|
|
33
41
|
let parsed;
|
|
34
42
|
if (typeof value === 'string') {
|
|
35
43
|
const text = value.trim();
|
|
36
|
-
if (!text)
|
|
37
|
-
|
|
44
|
+
if (!text) {
|
|
45
|
+
issues.push({ subtype: 'recognize_result_invalid', message: 'recognizeResult 不能为空' });
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
38
48
|
try {
|
|
39
|
-
|
|
49
|
+
const candidate = JSON.parse(text);
|
|
50
|
+
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {
|
|
51
|
+
issues.push({
|
|
52
|
+
subtype: 'recognize_result_invalid',
|
|
53
|
+
message: 'recognizeResult 必须是 JSON 对象(不能是数组或单个值)',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
parsed = candidate;
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
|
-
catch
|
|
42
|
-
|
|
43
|
-
throw error;
|
|
44
|
-
throw contractValidationError('recognize_result_invalid', 'recognizeResult 不是合法 JSON');
|
|
60
|
+
catch {
|
|
61
|
+
issues.push({ subtype: 'recognize_result_invalid', message: 'recognizeResult 不是合法 JSON' });
|
|
45
62
|
}
|
|
46
63
|
}
|
|
64
|
+
else if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
65
|
+
issues.push({ subtype: 'recognize_result_invalid', message: 'recognizeResult 必须是 JSON 对象' });
|
|
66
|
+
}
|
|
47
67
|
else {
|
|
48
|
-
parsed =
|
|
68
|
+
parsed = value;
|
|
49
69
|
}
|
|
70
|
+
if (!parsed)
|
|
71
|
+
return '';
|
|
50
72
|
if (typeof parsed.isSuccess !== 'boolean') {
|
|
51
|
-
|
|
73
|
+
issues.push({
|
|
74
|
+
subtype: 'recognize_result_invalid',
|
|
75
|
+
message: 'recognizeResult.isSuccess 必须是布尔值 true / false(不要加引号、不要写 "true")',
|
|
76
|
+
});
|
|
52
77
|
}
|
|
53
|
-
const mainTable =
|
|
54
|
-
if (!Array.isArray(mainTable
|
|
55
|
-
|
|
78
|
+
const mainTable = parsed.mainTable;
|
|
79
|
+
if (!mainTable || typeof mainTable !== 'object' || Array.isArray(mainTable)) {
|
|
80
|
+
issues.push({
|
|
81
|
+
subtype: 'recognize_result_invalid',
|
|
82
|
+
message: 'recognizeResult.mainTable 必须是对象,形如 {"rows":[{"mainDataId":1,"fieldResults":[...]}]}',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (!Array.isArray(mainTable.rows)) {
|
|
86
|
+
issues.push({
|
|
87
|
+
subtype: 'recognize_result_invalid',
|
|
88
|
+
message: 'recognizeResult.mainTable.rows 必须是数组(主表只放一行,mainDataId 固定 1)',
|
|
89
|
+
});
|
|
56
90
|
}
|
|
57
91
|
if (!Array.isArray(parsed.subTables)) {
|
|
58
|
-
|
|
92
|
+
issues.push({
|
|
93
|
+
subtype: 'recognize_result_invalid',
|
|
94
|
+
message: 'recognizeResult.subTables 必须是数组(无明细时传 [],不要省略、不要传 null)',
|
|
95
|
+
});
|
|
59
96
|
}
|
|
60
|
-
|
|
97
|
+
if (issues.length)
|
|
98
|
+
return '';
|
|
99
|
+
return JSON.stringify({
|
|
100
|
+
isSuccess: parsed.isSuccess,
|
|
101
|
+
mainTable,
|
|
102
|
+
subTables: parsed.subTables,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 校验识别结果的顶层结构,返回可直接作为接口入参的 JSON 字符串。
|
|
107
|
+
* 校验失败时一次性列出全部问题。
|
|
108
|
+
*/
|
|
109
|
+
export function normalizeRecognizeResult(value) {
|
|
110
|
+
const issues = [];
|
|
111
|
+
const text = collectRecognizeIssues(value, issues);
|
|
112
|
+
if (issues.length)
|
|
113
|
+
throwIssues(issues);
|
|
114
|
+
return text;
|
|
61
115
|
}
|
|
62
116
|
/** 本次识别记录可用的真实附件 ID 列表(attachmentIds 全部 + attachmentFileId)。 */
|
|
63
117
|
export function collectFileIds(attachmentIds, attachmentFileId) {
|
|
@@ -184,11 +238,20 @@ function extractAiExtraId(value) {
|
|
|
184
238
|
* 与 `flow.ts` 的 `resolveFlow` 不同:**不再强制限定四个预设**。
|
|
185
239
|
* 四类以外的流程(如测试环境的「销售合同起草流程」)可以传自定义名称,
|
|
186
240
|
* 只要同时用 `workflowId` 明确流程模板 ID 即可;不传 `flow` 也允许。
|
|
241
|
+
*
|
|
242
|
+
* 与旧实现的差别:解析失败不再直接抛错,而是推入 `issues`,
|
|
243
|
+
* 与其他入参问题合并后一次性报出(2026-11-18)。
|
|
187
244
|
*/
|
|
188
|
-
function resolveFlowPreset(value) {
|
|
245
|
+
function resolveFlowPreset(value, issues) {
|
|
189
246
|
if (value === undefined || value === null || value === '')
|
|
190
247
|
return undefined;
|
|
191
|
-
|
|
248
|
+
if (typeof value !== 'string') {
|
|
249
|
+
issues.push({ subtype: 'flow_invalid', message: 'flow 必须是字符串,如 "新客户"' });
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
const raw = value.trim().slice(0, 64);
|
|
253
|
+
if (!raw)
|
|
254
|
+
return undefined;
|
|
192
255
|
const exact = FLOW_PRESETS.find((preset) => preset.key === raw || preset.label === raw);
|
|
193
256
|
if (exact)
|
|
194
257
|
return { key: exact.key, label: exact.label, workflowId: exact.workflowId };
|
|
@@ -199,38 +262,105 @@ function resolveFlowPreset(value) {
|
|
|
199
262
|
// 非四类预设:当作自定义流程名,workflowId 必须由调用方显式提供。
|
|
200
263
|
return { key: raw, label: raw, workflowId: '' };
|
|
201
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* 归一化附件 ID 列表(2026-11-18 修复)。
|
|
267
|
+
*
|
|
268
|
+
* 历史事故(实测踩坑):调用方按「文件 ID 列表」的直觉传数组 `["1339..."]`,
|
|
269
|
+
* 而实现只接受逗号分隔字符串,数组被静默当成空串,最终误报
|
|
270
|
+
* `attachment_file_id_missing`(提示「请传 attachmentFileId」)。
|
|
271
|
+
* 由于根因是类型而非缺值,照提示补 `attachmentFileId` 也修不好,极易反复试错。
|
|
272
|
+
*
|
|
273
|
+
* 规则:
|
|
274
|
+
* - 逗号分隔字符串 → 逐项 trim 后重新拼接(去掉空项与多余空格);
|
|
275
|
+
* - 字符串数组 / 数字数组 → 自动收敛为逗号分隔串(本次新增的兼容行为);
|
|
276
|
+
* - 对象、布尔等真正非法类型 → 推入 `attachment_ids_invalid` 明确报错,不再静默当空。
|
|
277
|
+
*/
|
|
278
|
+
function normalizeAttachmentIds(value, issues) {
|
|
279
|
+
if (value === undefined || value === null || value === '')
|
|
280
|
+
return '';
|
|
281
|
+
if (typeof value === 'string') {
|
|
282
|
+
return value
|
|
283
|
+
.split(',')
|
|
284
|
+
.map((item) => item.trim())
|
|
285
|
+
.filter(Boolean)
|
|
286
|
+
.join(',');
|
|
287
|
+
}
|
|
288
|
+
if (Array.isArray(value)) {
|
|
289
|
+
return value
|
|
290
|
+
.map((item) => (typeof item === 'string' || typeof item === 'number' ? String(item).trim() : ''))
|
|
291
|
+
.filter(Boolean)
|
|
292
|
+
.join(',');
|
|
293
|
+
}
|
|
294
|
+
issues.push({
|
|
295
|
+
subtype: 'attachment_ids_invalid',
|
|
296
|
+
message: 'attachmentIds 必须是逗号分隔字符串(如 "1339...,1340...")或字符串数组,不能是对象或布尔值',
|
|
297
|
+
});
|
|
298
|
+
return '';
|
|
299
|
+
}
|
|
300
|
+
/** 取纯数字 ID;非法时推入 `issues` 并返回空串,避免阻断后续校验的收集。 */
|
|
301
|
+
function takeNumericId(value, name, subtype, issues) {
|
|
302
|
+
if (value === undefined || value === null || value === '')
|
|
303
|
+
return '';
|
|
304
|
+
const text = typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '';
|
|
305
|
+
if (!text) {
|
|
306
|
+
issues.push({ subtype, message: `${name} 必须是非空字符串` });
|
|
307
|
+
return '';
|
|
308
|
+
}
|
|
309
|
+
if (!/^[1-9]\d*$/.test(text)) {
|
|
310
|
+
issues.push({ subtype, message: `${name} 必须是纯数字的 ID` });
|
|
311
|
+
return '';
|
|
312
|
+
}
|
|
313
|
+
return text;
|
|
314
|
+
}
|
|
202
315
|
export const contractSaveRecognizeOperations = [
|
|
203
316
|
{
|
|
204
317
|
name: 'contract.flow.save-recognize-record',
|
|
205
318
|
async execute(input, { host }) {
|
|
206
|
-
|
|
319
|
+
// 入参校验一律「先收齐、再一次性报」(2026-11-18):
|
|
320
|
+
// 旧实现逐项短路,缺 N 项就要跑 N 轮;实测同一命令连错 6 次(每轮 5~10 s 纯浪费)。
|
|
321
|
+
const issues = [];
|
|
322
|
+
const flow = resolveFlowPreset(input.flow, issues);
|
|
207
323
|
const explicitWorkflowId = input.workflowId === undefined || input.workflowId === null || input.workflowId === ''
|
|
208
324
|
? ''
|
|
209
|
-
:
|
|
210
|
-
|
|
211
|
-
if (
|
|
212
|
-
|
|
325
|
+
: String(input.workflowId).trim();
|
|
326
|
+
let workflowId = '';
|
|
327
|
+
if (explicitWorkflowId) {
|
|
328
|
+
if (/^[1-9]\d*$/.test(explicitWorkflowId)) {
|
|
329
|
+
workflowId = explicitWorkflowId;
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
issues.push({ subtype: 'workflow_id_invalid', message: 'workflowId 必须是纯数字的流程模板 ID' });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
workflowId = flow?.workflowId || '';
|
|
213
337
|
}
|
|
214
|
-
if (
|
|
215
|
-
|
|
338
|
+
if (!workflowId && !explicitWorkflowId) {
|
|
339
|
+
issues.push({
|
|
340
|
+
subtype: 'workflow_id_required',
|
|
341
|
+
message: '必须传 flow(契约锁 / 新客户 / 老客户增值 / 常规二次销售)或 workflowId;'
|
|
342
|
+
+ '注意用 --input <文件> 时 flow / workflowId 要写进 JSON 里,命令行 --flow 会被 JSON 覆盖',
|
|
343
|
+
});
|
|
216
344
|
}
|
|
217
|
-
|
|
218
|
-
const attachmentIds =
|
|
345
|
+
// attachmentIds 以逗号分隔字符串为准;数组自动收敛为逗号分隔串(2026-11-18 兼容修复)。
|
|
346
|
+
const attachmentIds = normalizeAttachmentIds(input.attachmentIds, issues);
|
|
219
347
|
// 合同文件字段:必须随 customParams 交给流程组件,否则附件挂不到表单字段上。
|
|
220
348
|
// 未显式传 attachmentFileId 时,取 attachmentIds 的首个文件。
|
|
221
|
-
const attachmentFieldId = input.attachmentFieldId
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
? ''
|
|
225
|
-
: requireNonEmptyString(input.attachmentFieldId, 'attachmentFieldId', 64).trim();
|
|
226
|
-
if (attachmentFieldId && !/^[1-9]\d*$/.test(attachmentFieldId)) {
|
|
227
|
-
throw contractValidationError('attachment_field_id_invalid', 'attachmentFieldId 必须是从表单字段定义中取得的纯数字字段 ID');
|
|
228
|
-
}
|
|
229
|
-
const explicitFileId = typeof input.attachmentFileId === 'string' ? input.attachmentFileId.trim() : '';
|
|
349
|
+
const attachmentFieldId = takeNumericId(input.attachmentFieldId, 'attachmentFieldId', 'attachment_field_id_invalid', issues);
|
|
350
|
+
const explicitFileId = typeof input.attachmentFileId === 'string'
|
|
351
|
+
? input.attachmentFileId.trim()
|
|
352
|
+
: (typeof input.attachmentFileId === 'number' ? String(input.attachmentFileId).trim() : '');
|
|
230
353
|
const attachmentFileId = explicitFileId || (attachmentIds ? attachmentIds.split(',')[0].trim() : '');
|
|
231
354
|
if (attachmentFieldId && !attachmentFileId) {
|
|
232
|
-
|
|
355
|
+
issues.push({
|
|
356
|
+
subtype: 'attachment_file_id_missing',
|
|
357
|
+
message: '传了 attachmentFieldId 就必须有文件 ID:显式传 attachmentFileId(字符串),'
|
|
358
|
+
+ '或让 attachmentIds 至少包含一个文件 ID(逗号分隔字符串或字符串数组均可)',
|
|
359
|
+
});
|
|
233
360
|
}
|
|
361
|
+
const recognizeResult = collectRecognizeIssues(input.recognizeResult, issues);
|
|
362
|
+
if (issues.length)
|
|
363
|
+
throwIssues(issues);
|
|
234
364
|
// origin 前缀兜底(2026-11-16):前缀必须是真实 fileId,否则后端按前缀回查不到附件,
|
|
235
365
|
// 表现是「要素值正常、合同原文列全空」且保存与出卡都不报错。
|
|
236
366
|
// 单附件时自动改写为真实 fileId;多附件时拒绝猜测,直接报错让人指认。
|
|
@@ -742,7 +742,7 @@ function buildSummarySkeleton(flowKey, title, text, fileName) {
|
|
|
742
742
|
constraints: CONSTRAINTS,
|
|
743
743
|
aiFillHint: {
|
|
744
744
|
file: 'ai_fill.json',
|
|
745
|
-
how: 'elements 按 elementsContract 填值;summary
|
|
745
|
+
how: 'elements 按 elementsContract 填值;summary 段只保留 badge / title(摘要由页面渲染,不填业务内容);' +
|
|
746
746
|
'阶段2 只需 --ai-fill ai_fill.json,无需再写 elements.json / summary_data.json',
|
|
747
747
|
sectionsView: 'contract_sections.txt(区段视图,辅助定位用:含抬头、要素命中行、表格块与签署尾部;' +
|
|
748
748
|
'取值一律回 contract_text.txt 全文核对,禁止只看视图下结论)',
|
|
@@ -1048,10 +1048,10 @@ export const contractTriageOperations = [
|
|
|
1048
1048
|
writeJsonFile(triagePath, result);
|
|
1049
1049
|
writeJsonFile(skeletonPath, skeleton);
|
|
1050
1050
|
writeJsonFile(aiFillPath, {
|
|
1051
|
-
instruction: '
|
|
1052
|
-
'summary
|
|
1053
|
-
'
|
|
1054
|
-
'
|
|
1051
|
+
instruction: '就地填值,只填 elements 段:按本文件给出的键名逐个填(键名即表单字段,禁止增删改名)。' +
|
|
1052
|
+
'summary 段只保留 badge / title,禁止补写 sections —— 摘要由系统页面渲染(tab=Summary),' +
|
|
1053
|
+
'写进 summary 的业务内容、表格与条款摘录一律不会被使用。' +
|
|
1054
|
+
'关键条款只写在 elements.terms 一处(name + content)。' +
|
|
1055
1055
|
'【专项方案】必须按 references/contract-field-extract-new-customer.md §5.2 的 15 项' +
|
|
1056
1056
|
'逐项核对原文后写入 solutions(name 只能取清单原名,禁止自创);未命中的整行删除,' +
|
|
1057
1057
|
'无专属计价 amount 填 0,禁止用「有没有单独列价」反推是否存在。' +
|
|
@@ -1059,7 +1059,14 @@ export const contractTriageOperations = [
|
|
|
1059
1059
|
flowKey: scored.flowKey,
|
|
1060
1060
|
file: { name: basename(file), textLength: plen(text) },
|
|
1061
1061
|
elements: buildElementsTemplate(scored.flowKey),
|
|
1062
|
-
|
|
1062
|
+
// 2026-11-19:摘要由页面渲染,ai_fill 只留 badge / title 骨架。
|
|
1063
|
+
// 之前把 sectionTemplate(业务分类归属 + 17 行合同要素 + 标的明细 + 付款节点)整套写进
|
|
1064
|
+
// ai_fill.json,模型被迫生成约 5KB 根本不会被使用的摘要正文,白耗一轮生成与上下文。
|
|
1065
|
+
summary: {
|
|
1066
|
+
badge: scored.flowKey,
|
|
1067
|
+
title,
|
|
1068
|
+
note: '摘要由系统页面渲染(tab=Summary),此处不填业务内容。',
|
|
1069
|
+
},
|
|
1063
1070
|
});
|
|
1064
1071
|
writeFileSync(sectionsPath, buildSectionView(text, hints), 'utf8');
|
|
1065
1072
|
outputs.text = textPath;
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import { ClauseProbeOperation } from './clause-library.js';
|
|
2
2
|
import { ContractReadOperation } from './read.js';
|
|
3
|
-
import { queryFrom
|
|
3
|
+
import { queryFrom } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* 合同类型与条款的只读查询。
|
|
6
|
+
*
|
|
7
|
+
* 2026-11-19:原 `template.ts` 是个大杂烩,除 `contract.template.*` 三件套外,
|
|
8
|
+
* 还顺带装着 `contract.type.tree`、条款读操作与 `contract.clause.reference.get`。
|
|
9
|
+
* 模板库三件套(tplinfo:tree / list / detail)已按技能口径移除(配置侧不在本 CLI
|
|
10
|
+
* 范围,也没有对应技能包),其余 7 个 operation 原样迁到这里,避免随模板一起被误删。
|
|
11
|
+
*/
|
|
4
12
|
export const contractTypeTreeOperation = new ContractReadOperation('contract.type.tree', {
|
|
5
13
|
method: 'GET',
|
|
6
14
|
path: '/api/ebd/contract/type/allTypes',
|
|
7
15
|
shape: (value) => ({ code: value.code, msg: value.msg, types: value.data }),
|
|
8
16
|
});
|
|
9
|
-
export const contractTemplateTreeOperation = new ContractReadOperation('contract.template.tree', {
|
|
10
|
-
method: 'GET',
|
|
11
|
-
path: '/api/ebd/contract/tpltree/queryList',
|
|
12
|
-
query: (input) => queryFrom(input, ['treeName', 'parentId', 'treeType', 'isSystem', 'useType', 'appId']),
|
|
13
|
-
});
|
|
14
|
-
export const contractTemplateListOperation = new ContractReadOperation('contract.template.list', {
|
|
15
|
-
method: 'GET',
|
|
16
|
-
path: '/api/ebd/contract/tplinfo/getListPage',
|
|
17
|
-
defaults: { pageNo: 1, pageSize: 10 },
|
|
18
|
-
query: (input) => queryFrom(input, [
|
|
19
|
-
'templateName', 'templateDesc', 'belongId', 'contractType', 'templateStatus', 'source',
|
|
20
|
-
'sourceType', 'templateVersion', 'operateType', 'useType', 'code', 'appId', 'formId',
|
|
21
|
-
'orgId', 'belongSub', 'outTime', 'pageNo', 'pageSize',
|
|
22
|
-
]),
|
|
23
|
-
});
|
|
24
|
-
export const contractTemplateDetailOperation = new ContractReadOperation('contract.template.detail', {
|
|
25
|
-
method: 'GET',
|
|
26
|
-
path: '/api/ebd/contract/tplinfo/getById',
|
|
27
|
-
query: (input) => ({ id: requireId(input.id, '模板 id') }),
|
|
28
|
-
});
|
|
29
17
|
export const contractClauseTreeOperation = new ClauseProbeOperation('contract.clause.tree', new ContractReadOperation('contract.clause.tree', {
|
|
30
18
|
method: 'GET',
|
|
31
19
|
path: '/api/ebd/contract/tree/queryList',
|
|
@@ -68,11 +56,8 @@ export const contractClauseReferenceGetOperation = new ContractReadOperation('co
|
|
|
68
56
|
'fileId', 'requestId', 'clauseId', 'referenceObjType', 'startTime', 'endTime', 'pageNum', 'pageSize',
|
|
69
57
|
]),
|
|
70
58
|
});
|
|
71
|
-
export const
|
|
59
|
+
export const contractTypeClauseReadOperations = [
|
|
72
60
|
contractTypeTreeOperation,
|
|
73
|
-
contractTemplateTreeOperation,
|
|
74
|
-
contractTemplateListOperation,
|
|
75
|
-
contractTemplateDetailOperation,
|
|
76
61
|
contractClauseTreeOperation,
|
|
77
62
|
contractClauseListOperation,
|
|
78
63
|
contractClauseGroupListOperation,
|
|
@@ -24,8 +24,8 @@ function pickFileId(payload) {
|
|
|
24
24
|
* 两段式文件上传:preUploadCheck 预检(命中秒传直接返回 fileId)→ module/upload 实传。
|
|
25
25
|
* 成功判据是拿到非空 fileId,HTTP 200 不算成功。
|
|
26
26
|
*
|
|
27
|
-
* 上传成功后**立即触发预审预热**(与 module
|
|
28
|
-
*
|
|
27
|
+
* 上传成功后**立即触发预审预热**(与 module 无关,但要带 `prewarmFlowId`),
|
|
28
|
+
* 由 `ensurePrewarmed` 做整轮去重:后续预审复用同一个 fileId 时不会再重复调用预热接口。
|
|
29
29
|
*/
|
|
30
30
|
export async function uploadFile(host, options) {
|
|
31
31
|
const absolutePath = resolve(options.path);
|
|
@@ -45,8 +45,7 @@ export async function uploadFile(host, options) {
|
|
|
45
45
|
const modified = String(Math.trunc(info.mtimeMs));
|
|
46
46
|
const sha256 = sha256Of(buffer);
|
|
47
47
|
// ---- 本地指纹复用:同一份文件在同一 module / 环境 / 用户下只真正上传一次 ----
|
|
48
|
-
//
|
|
49
|
-
// 因此去重只能在这里做。缓存不可用时静默跳过,不影响上传。
|
|
48
|
+
// 各 module 的 preUploadCheck 秒传行为不一致,去重统一在这里做;缓存不可用时静默跳过,不影响上传。
|
|
50
49
|
let reuseKey = null;
|
|
51
50
|
if (isCacheEnabled()) {
|
|
52
51
|
try {
|
|
@@ -77,7 +76,6 @@ export async function uploadFile(host, options) {
|
|
|
77
76
|
const form = {
|
|
78
77
|
compressImg: 'false',
|
|
79
78
|
module: options.module,
|
|
80
|
-
...(options.module === 'ebContract' ? { createDoc: 'true' } : {}),
|
|
81
79
|
...(options.extraFields ?? {}),
|
|
82
80
|
size: String(buffer.length),
|
|
83
81
|
name,
|
|
@@ -85,7 +83,7 @@ export async function uploadFile(host, options) {
|
|
|
85
83
|
lastModified: modified,
|
|
86
84
|
lastModifiedDate: modified,
|
|
87
85
|
};
|
|
88
|
-
const query = options.query ??
|
|
86
|
+
const query = options.query ?? { sf_request_type: 'ajax' };
|
|
89
87
|
const timeoutMs = options.timeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS;
|
|
90
88
|
const precheck = await host.contractRequest({
|
|
91
89
|
method: 'POST',
|
|
@@ -164,13 +162,14 @@ export async function uploadFile(host, options) {
|
|
|
164
162
|
/**
|
|
165
163
|
* 上传收口:三条返回路径共用。
|
|
166
164
|
* 1. 补记 fileId → module,供流程侧判断附件能否直接复用;
|
|
167
|
-
* 2.
|
|
165
|
+
* 2. 触发预审预热(默认开;同一 flowId + fileId 只触发一次)。
|
|
166
|
+
*
|
|
167
|
+
* 预热必须带 `flowId`(助手 URL 上那个动态值):没有它就没有可用的流程键 —— 例如
|
|
168
|
+
* 比对通道(`docCompared`)上传本来就不属于任何合同流程 —— 此时**跳过预热**,
|
|
169
|
+
* 不退回任何固定值,也不把"跳过"报成失败。
|
|
168
170
|
*/
|
|
169
171
|
async function finish(file) {
|
|
170
172
|
file.module = options.module;
|
|
171
|
-
const prewarmEnabled = options.prewarm !== false;
|
|
172
|
-
if (!prewarmEnabled)
|
|
173
|
-
return file;
|
|
174
173
|
try {
|
|
175
174
|
const session = await host.getSession();
|
|
176
175
|
await rememberFileModule({
|
|
@@ -183,8 +182,15 @@ export async function uploadFile(host, options) {
|
|
|
183
182
|
catch {
|
|
184
183
|
// 记录失败只影响"能否复用",不影响上传结果。
|
|
185
184
|
}
|
|
185
|
+
const prewarmFlowId = typeof options.prewarmFlowId === 'string' ? options.prewarmFlowId.trim() : '';
|
|
186
|
+
if (options.prewarm === false)
|
|
187
|
+
return file;
|
|
188
|
+
if (!prewarmFlowId) {
|
|
189
|
+
file.prewarmSkipped = true;
|
|
190
|
+
return file;
|
|
191
|
+
}
|
|
186
192
|
try {
|
|
187
|
-
const summary = await ensurePrewarmed(host, [file.fileId]);
|
|
193
|
+
const summary = await ensurePrewarmed(host, [file.fileId], { flowId: prewarmFlowId });
|
|
188
194
|
const result = summary.results[0];
|
|
189
195
|
const ok = result?.ok === true;
|
|
190
196
|
file.prewarmed = ok;
|
|
@@ -24,9 +24,13 @@ function ttlMs() {
|
|
|
24
24
|
export function isPrewarmCacheEnabled() {
|
|
25
25
|
return ttlMs() > 0;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* 预热去重键:flowId + fileId + 环境 + 用户,任一不同都视为不同预热对象。
|
|
29
|
+
* flowId 是助手 URL 上那个动态值(= 本轮 workflowId);缓存版本号不变,
|
|
30
|
+
* 旧键(无 flowId 段)自然失配,最多导致多预热一次。
|
|
31
|
+
*/
|
|
28
32
|
export function prewarmKey(input) {
|
|
29
|
-
return `${input.baseUrl}|${input.userId}|${input.fileId}`;
|
|
33
|
+
return `${input.baseUrl}|${input.userId}|${input.flowId}|${input.fileId}`;
|
|
30
34
|
}
|
|
31
35
|
async function readCache() {
|
|
32
36
|
try {
|
|
@@ -2,23 +2,24 @@ import { isPrewarmCacheEnabled, markPrewarmed, prewarmKey, wasPrewarmed } from '
|
|
|
2
2
|
/**
|
|
3
3
|
* 合同预审预热(`saveInternalRecord`)。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* 1.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* 业务口径:
|
|
6
|
+
* 1. **`flowId` 由调用方动态给,就是助手 URL 上那个 `flowId`(= 本轮合同流程的 `workflowId`)**。
|
|
7
|
+
* 2026-11-19 用户定稿:预热与取结果的 `getAiReviewRecord` 必须**同键同值**——历史上这里
|
|
8
|
+
* 写死 `1269716062340284522`(恰好是新客户流程的 workflowId),预热把记录写在一个流程键下、
|
|
9
|
+
* 取结果按另一个键查,非新客户流程必然取不到;因此本模块**不再持有任何固定 flowId**。
|
|
10
|
+
* 2. **文件上传后就触发预热**,与上传时用的 module 无关(workflow / docCompared 都一样);
|
|
11
|
+
* 取不到 flowId(例如比对通道上传,本就没有合同流程上下文)时**不预热**,不退回任何固定值。
|
|
12
|
+
* 3. 一整轮处理**只需要预热一次**,因此这里用 `ensurePrewarmed` 做本地去重;
|
|
13
|
+
* 4. 预热只是加速手段:失败不抛异常,收敛成 `{ ok: false, error }` 交给调用方汇总成 warnings。
|
|
11
14
|
*/
|
|
12
|
-
/** 预审预热流程 ID(固定业务常量,禁止替换)。 */
|
|
13
|
-
export const AI_REVIEW_PREWARM_FLOW_ID = '1269716062340284522';
|
|
14
15
|
const PREWARM_PATH = '/api/ebd/contract/ai/saveInternalRecord';
|
|
15
16
|
const PREWARM_TIMEOUT_MS = 30_000;
|
|
16
|
-
async function prewarmOne(host, fileId) {
|
|
17
|
+
async function prewarmOne(host, fileId, flowId) {
|
|
17
18
|
try {
|
|
18
19
|
await host.contractRequest({
|
|
19
20
|
method: 'POST',
|
|
20
21
|
path: PREWARM_PATH,
|
|
21
|
-
body: { flowId
|
|
22
|
+
body: { flowId, fileId },
|
|
22
23
|
timeoutMs: PREWARM_TIMEOUT_MS,
|
|
23
24
|
// 触发型接口:成功时响应体为空,代表"预审已在执行"。
|
|
24
25
|
// 不能走业务码判定,否则空体会被判成业务失败。
|
|
@@ -39,12 +40,28 @@ async function prewarmOne(host, fileId) {
|
|
|
39
40
|
/**
|
|
40
41
|
* 按需预热:已预热过的 fileId 直接跳过,未预热的并行触发。
|
|
41
42
|
*
|
|
43
|
+
* `flowId` 必传语义——助手 URL 上的动态值;缺失时本函数**不报错也不预热**,
|
|
44
|
+
* 返回 `enabled: false` 让调用方按「无流程上下文」处理。
|
|
45
|
+
*
|
|
42
46
|
* `force: true` 时会忽略去重标记强制重跑(仅用于显式补触发命令)。
|
|
43
47
|
* 本函数**不抛异常**,调用方据 `failCount` 汇总 warning 即可。
|
|
44
48
|
*/
|
|
45
49
|
export async function ensurePrewarmed(host, fileIds, options = {}) {
|
|
46
50
|
const unique = Array.from(new Set(fileIds.map((item) => String(item).trim()).filter(Boolean)));
|
|
47
51
|
const force = options.force === true;
|
|
52
|
+
const flowId = typeof options.flowId === 'string' ? options.flowId.trim() : '';
|
|
53
|
+
if (!flowId) {
|
|
54
|
+
// 没有 flowId 就没有可用的流程键:跳过预热(不是失败),也不退回任何固定值。
|
|
55
|
+
return {
|
|
56
|
+
flowId: '',
|
|
57
|
+
enabled: false,
|
|
58
|
+
reason: 'flow_id_missing',
|
|
59
|
+
okCount: 0,
|
|
60
|
+
failCount: 0,
|
|
61
|
+
skippedCount: unique.length,
|
|
62
|
+
results: unique.map((fileId) => ({ fileId, ok: false, skipped: true })),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
48
65
|
let baseUrl = '';
|
|
49
66
|
let userId = '';
|
|
50
67
|
try {
|
|
@@ -57,19 +74,19 @@ export async function ensurePrewarmed(host, fileIds, options = {}) {
|
|
|
57
74
|
}
|
|
58
75
|
const results = await Promise.all(unique.map(async (fileId) => {
|
|
59
76
|
if (!force && isPrewarmCacheEnabled() && baseUrl) {
|
|
60
|
-
const key = prewarmKey({ fileId, baseUrl, userId });
|
|
77
|
+
const key = prewarmKey({ flowId, fileId, baseUrl, userId });
|
|
61
78
|
if (await wasPrewarmed(key)) {
|
|
62
79
|
return { fileId, ok: true, skipped: true };
|
|
63
80
|
}
|
|
64
81
|
}
|
|
65
|
-
const result = await prewarmOne(host, fileId);
|
|
82
|
+
const result = await prewarmOne(host, fileId, flowId);
|
|
66
83
|
if (result.ok && isPrewarmCacheEnabled() && baseUrl) {
|
|
67
|
-
await markPrewarmed(prewarmKey({ fileId, baseUrl, userId }));
|
|
84
|
+
await markPrewarmed(prewarmKey({ flowId, fileId, baseUrl, userId }));
|
|
68
85
|
}
|
|
69
86
|
return result;
|
|
70
87
|
}));
|
|
71
88
|
return {
|
|
72
|
-
flowId
|
|
89
|
+
flowId,
|
|
73
90
|
enabled: true,
|
|
74
91
|
okCount: results.filter((item) => item.ok).length,
|
|
75
92
|
failCount: results.filter((item) => !item.ok).length,
|
|
@@ -77,12 +94,5 @@ export async function ensurePrewarmed(host, fileIds, options = {}) {
|
|
|
77
94
|
results,
|
|
78
95
|
};
|
|
79
96
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const unique = Array.from(new Set(fileIds.map((item) => String(item).trim()).filter(Boolean)));
|
|
83
|
-
return Promise.all(unique.map((fileId) => prewarmOne(host, fileId)));
|
|
84
|
-
}
|
|
85
|
-
/** 单文件无条件预热。 */
|
|
86
|
-
export async function prewarmOneFile(host, fileId) {
|
|
87
|
-
return prewarmOne(host, fileId);
|
|
88
|
-
}
|
|
97
|
+
// 2026-11-19 定稿:`prewarmAll` / `prewarmOneFile`(显式补触发用)已随
|
|
98
|
+
// `contract.review.prewarm` 一并删除——预热只在流程通道上传收口触发,没有第二个入口。
|