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,529 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { basename, join, resolve } from 'node:path';
|
|
3
|
-
import { contractValidationError } from '../errors.js';
|
|
4
|
-
import { resolveOperation } from './op-resolver.js';
|
|
5
|
-
/**
|
|
6
|
-
* 报价单首屏:sheets → extract → parse → 自动识客户 → 金额矛盾校验 → 出动作卡片。
|
|
7
|
-
*
|
|
8
|
-
* 迁移自 `scripts/quote_screen.py`(2026-11-13 第七批下沉)。
|
|
9
|
-
*
|
|
10
|
-
* 迁移理由(这是最该消除的一处反模式):
|
|
11
|
-
* 原脚本本身不访问业务接口,它用 `subprocess` 去调 `weaver-work-cli contract run`,
|
|
12
|
-
* 而这些 operation(quote.sheets / quote.extract / quote.parse / card.action)
|
|
13
|
-
* **早已存在**。于是形成「Python 包一层 CLI」:额外的进程启动、额外的 Python 运行时依赖、
|
|
14
|
-
* 参数文件往返落盘,而且 Windows 下还要靠 shutil.which 绕 PATHEXT 才能启动。
|
|
15
|
-
* 改为进程内 `resolveOperation(...).execute(...)` 后,链路与原 contract.firstscreen.run 同构。
|
|
16
|
-
*
|
|
17
|
-
* 语义边界不变:客户名称、税率、汇总表标记一律由模型读 raw_grid 判定,
|
|
18
|
-
* 本 operation 只做无损提取、金额结构、自动识「标签:值」、金额矛盾校验与卡片渲染。
|
|
19
|
-
* 报价单不出摘要 HTML、不出摘要卡(2026-11-11 用户指定),只产出文字摘要。
|
|
20
|
-
*/
|
|
21
|
-
const DEFAULT_BASE = 'https://www.e-cology.com.cn';
|
|
22
|
-
// ---------------------------------------------------------------- 通用工具
|
|
23
|
-
function isRecord(value) {
|
|
24
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
25
|
-
}
|
|
26
|
-
function text(value) {
|
|
27
|
-
return typeof value === 'string' ? value : '';
|
|
28
|
-
}
|
|
29
|
-
function writeJson(path, value) {
|
|
30
|
-
writeFileSync(path, JSON.stringify(value, null, 2), 'utf8');
|
|
31
|
-
}
|
|
32
|
-
/** 进程内调用其它 operation,返回其 data(失败时抛错,由调用方决定如何降级)。 */
|
|
33
|
-
async function callOperation(name, input, context) {
|
|
34
|
-
const operation = resolveOperation(name);
|
|
35
|
-
const result = await operation.execute(input, context);
|
|
36
|
-
return (result?.data ?? {});
|
|
37
|
-
}
|
|
38
|
-
function groupThousands(value, decimals) {
|
|
39
|
-
return value.toLocaleString('en-US', {
|
|
40
|
-
minimumFractionDigits: decimals,
|
|
41
|
-
maximumFractionDigits: decimals,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/** 金额展示(对应脚本 _money):整数加千分位,非数字原样返回。 */
|
|
45
|
-
function moneyText(value) {
|
|
46
|
-
if (value === null || value === undefined || value === '')
|
|
47
|
-
return '';
|
|
48
|
-
const num = Number(String(value).replace(/,/gu, ''));
|
|
49
|
-
if (!Number.isFinite(num))
|
|
50
|
-
return String(value);
|
|
51
|
-
if (Math.abs(num - Math.trunc(num)) < 1e-9)
|
|
52
|
-
return groupThousands(Math.trunc(num), 0);
|
|
53
|
-
return groupThousands(num, 2);
|
|
54
|
-
}
|
|
55
|
-
/** 金额展示(对应脚本 _money0):缺值给破折号。 */
|
|
56
|
-
function moneyPlain(value) {
|
|
57
|
-
if (value === null || value === undefined || value === '')
|
|
58
|
-
return '—';
|
|
59
|
-
const num = Number(String(value).replace(/,/gu, ''));
|
|
60
|
-
if (!Number.isFinite(num))
|
|
61
|
-
return String(value);
|
|
62
|
-
if (Math.abs(num - Math.round(num)) < 0.005)
|
|
63
|
-
return groupThousands(Math.round(num), 0);
|
|
64
|
-
return groupThousands(num, 2);
|
|
65
|
-
}
|
|
66
|
-
/** 文件名 → 可读标题:去【】前缀、去 _日期_ 后缀与尾部编号。 */
|
|
67
|
-
function cleanTitle(filePath) {
|
|
68
|
-
let base = basename(filePath).replace(/\.[^.]+$/u, '');
|
|
69
|
-
base = base.replace(/^【[^】]*】/u, '');
|
|
70
|
-
base = base.replace(/_[0-9]{6,}.*$/u, '');
|
|
71
|
-
base = base.replace(/\s*\(\d+\)\s*$/u, '');
|
|
72
|
-
base = base.replace(/_\d+$/u, '');
|
|
73
|
-
return base.trim() || '报价单';
|
|
74
|
-
}
|
|
75
|
-
// ---------------------------------------------------------------- 网格预览
|
|
76
|
-
/** 模型判定客户/税率/汇总表只需这些行,直接带回可省一次读 raw_grid 的往返。 */
|
|
77
|
-
const PREVIEW_KEYS = [
|
|
78
|
-
'客户',
|
|
79
|
-
'用户名称',
|
|
80
|
-
'甲方',
|
|
81
|
-
'报价日期',
|
|
82
|
-
'有效',
|
|
83
|
-
'税率',
|
|
84
|
-
'合计',
|
|
85
|
-
'标准价',
|
|
86
|
-
'最终优惠',
|
|
87
|
-
'总价',
|
|
88
|
-
'汇总',
|
|
89
|
-
'总计',
|
|
90
|
-
];
|
|
91
|
-
function formatGridRow(index, row) {
|
|
92
|
-
const cells = row
|
|
93
|
-
.filter((cell) => String(cell ?? '').trim().length > 0)
|
|
94
|
-
.map((cell) => [...String(cell).trim()].slice(0, 40).join(''));
|
|
95
|
-
return `r${String(index + 1).padEnd(3, ' ')} ${cells.join(' | ')}`;
|
|
96
|
-
}
|
|
97
|
-
/** 头部若干行 + 关键词命中行,供模型直接判语义。 */
|
|
98
|
-
function buildPreview(rows, head = 12) {
|
|
99
|
-
const lines = [];
|
|
100
|
-
const total = rows.length;
|
|
101
|
-
lines.push('---- GRID HEAD ----');
|
|
102
|
-
for (let i = 0; i < Math.min(head, total); i += 1) {
|
|
103
|
-
const row = Array.isArray(rows[i]) ? rows[i] : [];
|
|
104
|
-
const line = formatGridRow(i, row);
|
|
105
|
-
if (line.trim())
|
|
106
|
-
lines.push(line);
|
|
107
|
-
}
|
|
108
|
-
lines.push('---- GRID KEY HITS ----');
|
|
109
|
-
const shown = new Set();
|
|
110
|
-
for (let i = 0; i < total; i += 1) {
|
|
111
|
-
const row = Array.isArray(rows[i]) ? rows[i] : [];
|
|
112
|
-
const joined = row.map((cell) => String(cell ?? '')).join('');
|
|
113
|
-
if (!PREVIEW_KEYS.some((key) => joined.includes(key)))
|
|
114
|
-
continue;
|
|
115
|
-
if (shown.has(i))
|
|
116
|
-
continue;
|
|
117
|
-
shown.add(i);
|
|
118
|
-
lines.push(formatGridRow(i, row));
|
|
119
|
-
}
|
|
120
|
-
if (total > head) {
|
|
121
|
-
lines.push(`NOTE 完整网格共 ${total} 行,见 raw_grid.json;上面只给头部与关键词行`);
|
|
122
|
-
}
|
|
123
|
-
return lines;
|
|
124
|
-
}
|
|
125
|
-
// ---------------------------------------------------------------- 自动识要素
|
|
126
|
-
const META_LABELS = [
|
|
127
|
-
{ key: 'customer', pat: /客户(?:名称|全称)?\s*[::]\s*([^\s::||]+)/u },
|
|
128
|
-
{ key: 'quote_date', pat: /报价日期\s*[::]\s*([0-9]{4}\s*[-/年]\s*[0-9]{1,2}\s*[-/月]\s*[0-9]{1,2})/u },
|
|
129
|
-
{ key: 'sales', pat: /客户经理\s*[::]\s*([^\s::||]+)/u },
|
|
130
|
-
{ key: 'phone', pat: /联系电话\s*[::]\s*([0-9-]{6,})/u },
|
|
131
|
-
];
|
|
132
|
-
/** 从原始网格的「标签:值」单元格取客户/日期/经理/电话;取不到留空,不编造。 */
|
|
133
|
-
function autoMeta(rows) {
|
|
134
|
-
const meta = { customer: '', quote_date: '', sales: '', phone: '' };
|
|
135
|
-
for (const row of rows ?? []) {
|
|
136
|
-
if (!Array.isArray(row))
|
|
137
|
-
continue;
|
|
138
|
-
for (const cell of row) {
|
|
139
|
-
if (cell === null || cell === undefined)
|
|
140
|
-
continue;
|
|
141
|
-
const value = String(cell).trim();
|
|
142
|
-
if (!value)
|
|
143
|
-
continue;
|
|
144
|
-
for (const { key, pat } of META_LABELS) {
|
|
145
|
-
if (meta[key])
|
|
146
|
-
continue;
|
|
147
|
-
const matched = value.match(pat);
|
|
148
|
-
if (matched?.[1])
|
|
149
|
-
meta[key] = matched[1].trim();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return meta;
|
|
154
|
-
}
|
|
155
|
-
/** 脚本能确定的部分全部自动填好;模型只需在需要时覆盖。 */
|
|
156
|
-
function autoSummary(filePath, raw, parsed, docType) {
|
|
157
|
-
const data = parsed ?? {};
|
|
158
|
-
const meta = autoMeta(Array.isArray(raw?.rows) ? raw.rows : []);
|
|
159
|
-
const parsedMeta = isRecord(data.meta) ? data.meta : {};
|
|
160
|
-
for (const key of ['customer', 'quote_date', 'sales', 'phone']) {
|
|
161
|
-
if (!meta[key] && parsedMeta[key])
|
|
162
|
-
meta[key] = String(parsedMeta[key]);
|
|
163
|
-
}
|
|
164
|
-
const totals = isRecord(data.totals) ? data.totals : {};
|
|
165
|
-
const rows = [];
|
|
166
|
-
const points = [];
|
|
167
|
-
const sections = Array.isArray(data.sections) ? data.sections : [];
|
|
168
|
-
for (const section of sections) {
|
|
169
|
-
if (!isRecord(section))
|
|
170
|
-
continue;
|
|
171
|
-
const code = text(section.code);
|
|
172
|
-
const name = text(section.title);
|
|
173
|
-
const items = Array.isArray(section.items) ? section.items : [];
|
|
174
|
-
rows.push([`${code}${name}`, moneyPlain(section.total)]);
|
|
175
|
-
if (name)
|
|
176
|
-
points.push(`${code}${name}:${items.length} 项,${moneyPlain(section.total)} 元`);
|
|
177
|
-
}
|
|
178
|
-
let warnings = (Array.isArray(data.warnings) ? data.warnings : [])
|
|
179
|
-
.map((item) => String(item))
|
|
180
|
-
.filter((item) => item.trim().length > 0);
|
|
181
|
-
// 客户名已自动取到时,「未能定位 / 未识别到客户名称」类告警已失效,不能带给用户
|
|
182
|
-
if (meta.customer) {
|
|
183
|
-
warnings = warnings.filter((warn) => !(warn.includes('客户名称') && (warn.includes('未能') || warn.includes('未从') || warn.includes('未识别'))));
|
|
184
|
-
}
|
|
185
|
-
const checks = Array.isArray(data.checks) ? data.checks : [];
|
|
186
|
-
for (const check of checks) {
|
|
187
|
-
if (!isRecord(check))
|
|
188
|
-
continue;
|
|
189
|
-
const diff = check.diff;
|
|
190
|
-
if (!diff)
|
|
191
|
-
continue;
|
|
192
|
-
const secKey = text(check.section).replace(/、/gu, '');
|
|
193
|
-
if (secKey) {
|
|
194
|
-
warnings = warnings.filter((warn) => !(warn.includes('表内') && warn.replace(/、/gu, '').includes(secKey)));
|
|
195
|
-
}
|
|
196
|
-
const message = `${text(check.section) || '某分项'} 明细求和 ${moneyPlain(check.sum_items)} 元` +
|
|
197
|
-
`与表内合计 ${moneyPlain(check.sheet_total)} 元相差 ${moneyPlain(Math.abs(Number(diff)))} 元`;
|
|
198
|
-
if (!warnings.includes(message))
|
|
199
|
-
warnings.push(message);
|
|
200
|
-
}
|
|
201
|
-
const totalsOut = {
|
|
202
|
-
standard_total: totals.standard_total ?? null,
|
|
203
|
-
final_total: totals.final_total ?? null,
|
|
204
|
-
};
|
|
205
|
-
if (totals.sum_items_grand !== null && totals.sum_items_grand !== undefined && totals.sum_items_grand !== '') {
|
|
206
|
-
const std = totals.standard_total;
|
|
207
|
-
const grand = totals.sum_items_grand;
|
|
208
|
-
if (std !== null && std !== undefined && std !== '') {
|
|
209
|
-
const grandNum = Number(String(grand).replace(/,/gu, ''));
|
|
210
|
-
const stdNum = Number(String(std).replace(/,/gu, ''));
|
|
211
|
-
if (Number.isFinite(grandNum) && Number.isFinite(stdNum) && grandNum !== stdNum) {
|
|
212
|
-
warnings.push(`全部明细求和 ${moneyPlain(grand)} 元与标准价合计 ${moneyPlain(std)} 元不一致,` +
|
|
213
|
-
`差额 ${moneyPlain(grandNum - stdNum)} 元`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
title: cleanTitle(filePath),
|
|
219
|
-
doc_type: docType,
|
|
220
|
-
meta,
|
|
221
|
-
totals: totalsOut,
|
|
222
|
-
sections: [
|
|
223
|
-
{ type: 'table', title: '费用构成', rows, total: moneyPlain(totals.final_total) },
|
|
224
|
-
{ type: 'list', title: '要点', items: points },
|
|
225
|
-
],
|
|
226
|
-
warnings,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
// ---------------------------------------------------------------- 文字摘要
|
|
230
|
-
/** 把 summary_data 压成对话可直接使用的纯文字摘要(不出 HTML、不出卡片)。 */
|
|
231
|
-
function buildTextSummary(input) {
|
|
232
|
-
const sd = isRecord(input) ? input : {};
|
|
233
|
-
const lines = [];
|
|
234
|
-
lines.push(`报价单:${text(sd.title) || '报价单'}`);
|
|
235
|
-
const meta = isRecord(sd.meta) ? sd.meta : {};
|
|
236
|
-
const totals = isRecord(sd.totals) ? sd.totals : {};
|
|
237
|
-
const who = [];
|
|
238
|
-
if (meta.customer)
|
|
239
|
-
who.push(`客户:${meta.customer}`);
|
|
240
|
-
if (meta.quote_date)
|
|
241
|
-
who.push(`报价日期:${meta.quote_date}`);
|
|
242
|
-
if (meta.sales)
|
|
243
|
-
who.push(`客户经理:${meta.sales}`);
|
|
244
|
-
if (who.length > 0)
|
|
245
|
-
lines.push(who.join(' | '));
|
|
246
|
-
const std = totals.standard_total;
|
|
247
|
-
const fin = totals.final_total;
|
|
248
|
-
const hasStd = std !== null && std !== undefined && std !== '';
|
|
249
|
-
const hasFin = fin !== null && fin !== undefined && fin !== '';
|
|
250
|
-
if (hasStd || hasFin) {
|
|
251
|
-
const seg = [];
|
|
252
|
-
if (hasStd)
|
|
253
|
-
seg.push(`标准价合计 ${moneyText(std)} 元`);
|
|
254
|
-
if (hasFin)
|
|
255
|
-
seg.push(`最终优惠报价 ${moneyText(fin)} 元`);
|
|
256
|
-
if (hasStd && hasFin) {
|
|
257
|
-
const a = Number(String(fin).replace(/,/gu, ''));
|
|
258
|
-
const b = Number(String(std).replace(/,/gu, ''));
|
|
259
|
-
if (Number.isFinite(a) && Number.isFinite(b) && a === b)
|
|
260
|
-
seg.push('未让价');
|
|
261
|
-
}
|
|
262
|
-
lines.push(`金额:${seg.join(',')}`);
|
|
263
|
-
}
|
|
264
|
-
const sections = Array.isArray(sd.sections) ? sd.sections : [];
|
|
265
|
-
// 费用构成:只认 >=3 列的明细表;2 列键值表不是费用构成
|
|
266
|
-
for (const section of sections) {
|
|
267
|
-
if (!isRecord(section))
|
|
268
|
-
continue;
|
|
269
|
-
const rows = Array.isArray(section.rows) ? section.rows : [];
|
|
270
|
-
if (section.type !== 'table' || rows.length === 0)
|
|
271
|
-
continue;
|
|
272
|
-
const first = rows[0];
|
|
273
|
-
if (!Array.isArray(first) || first.length < 3)
|
|
274
|
-
continue;
|
|
275
|
-
const parts = [];
|
|
276
|
-
for (const row of rows) {
|
|
277
|
-
if (!Array.isArray(row) || row.length < 2)
|
|
278
|
-
continue;
|
|
279
|
-
const name = String(row[1] ?? '').trim();
|
|
280
|
-
const amount = String(row[row.length - 1] ?? '').trim();
|
|
281
|
-
if (name)
|
|
282
|
-
parts.push(`${name} ${amount} 元`);
|
|
283
|
-
}
|
|
284
|
-
if (parts.length > 0)
|
|
285
|
-
lines.push(`构成:${parts.join(';')}`);
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
// 要点:list / reasons 型 section 的 items(每段最多 5 条,输出最多 5 条)
|
|
289
|
-
const points = [];
|
|
290
|
-
for (const section of sections) {
|
|
291
|
-
if (!isRecord(section))
|
|
292
|
-
continue;
|
|
293
|
-
if (section.type !== 'list' && section.type !== 'reasons')
|
|
294
|
-
continue;
|
|
295
|
-
const items = Array.isArray(section.items) ? section.items.slice(0, 5) : [];
|
|
296
|
-
for (const item of items) {
|
|
297
|
-
const value = String(item).trim();
|
|
298
|
-
if (value && !points.includes(value))
|
|
299
|
-
points.push(value);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (points.length > 0)
|
|
303
|
-
lines.push(`要点:${points.slice(0, 5).join(';')}`);
|
|
304
|
-
const warns = (Array.isArray(sd.warnings) ? sd.warnings : [])
|
|
305
|
-
.map((item) => String(item).trim())
|
|
306
|
-
.filter((item) => item.length > 0);
|
|
307
|
-
if (warns.length > 0)
|
|
308
|
-
lines.push(`待核对:${warns.slice(0, 3).join(';')}`);
|
|
309
|
-
return lines.join('\n');
|
|
310
|
-
}
|
|
311
|
-
function normalizeMode(raw) {
|
|
312
|
-
const value = text(raw).trim().toLowerCase();
|
|
313
|
-
if (!value)
|
|
314
|
-
return 'auto';
|
|
315
|
-
if (value === 'auto' || value === 'stage1' || value === 'stage2')
|
|
316
|
-
return value;
|
|
317
|
-
throw contractValidationError('mode_invalid', 'mode 只能是 auto / stage1 / stage2');
|
|
318
|
-
}
|
|
319
|
-
export const contractQuoteScreenOperations = [
|
|
320
|
-
{
|
|
321
|
-
name: 'contract.quotescreen.run',
|
|
322
|
-
async execute(input, context) {
|
|
323
|
-
const fileInput = text(input.file).trim();
|
|
324
|
-
if (!fileInput)
|
|
325
|
-
throw contractValidationError('file_required', 'file 必须是报价单 .xlsx 的绝对路径');
|
|
326
|
-
const filePath = resolve(fileInput);
|
|
327
|
-
if (!existsSync(filePath)) {
|
|
328
|
-
throw contractValidationError('file_not_found', `报价单文件不存在:${filePath}`);
|
|
329
|
-
}
|
|
330
|
-
const outDirInput = text(input.outDir).trim();
|
|
331
|
-
if (!outDirInput)
|
|
332
|
-
throw contractValidationError('out_dir_required', 'outDir 必须是产物目录');
|
|
333
|
-
const outDir = resolve(outDirInput);
|
|
334
|
-
mkdirSync(outDir, { recursive: true });
|
|
335
|
-
const mode = normalizeMode(input.mode);
|
|
336
|
-
const docType = text(input.docType).trim() || 'quote';
|
|
337
|
-
const title = text(input.title).trim();
|
|
338
|
-
let companyName = text(input.companyName).trim();
|
|
339
|
-
const summaryArg = text(input.summaryData).trim();
|
|
340
|
-
const baseUrl = (text(input.baseUrl) || DEFAULT_BASE).replace(/\/+$/u, '');
|
|
341
|
-
const headRaw = input.head;
|
|
342
|
-
const head = typeof headRaw === 'number' && Number.isFinite(headRaw) && headRaw > 0 ? Math.floor(headRaw) : 12;
|
|
343
|
-
const fwd = filePath;
|
|
344
|
-
const warnings = [];
|
|
345
|
-
const result = {
|
|
346
|
-
ok: true,
|
|
347
|
-
mode,
|
|
348
|
-
file: fwd,
|
|
349
|
-
outDir,
|
|
350
|
-
sheets: [],
|
|
351
|
-
sheet: null,
|
|
352
|
-
outputs: {},
|
|
353
|
-
previewLines: [],
|
|
354
|
-
auto: null,
|
|
355
|
-
textSummary: null,
|
|
356
|
-
cardPath: null,
|
|
357
|
-
cardHtml: null,
|
|
358
|
-
cardSelfCheckPassed: null,
|
|
359
|
-
warnings,
|
|
360
|
-
};
|
|
361
|
-
// 显式阶段2:只需 summaryData,不必重跑 sheets/extract/parse
|
|
362
|
-
if (mode === 'stage2') {
|
|
363
|
-
if (!summaryArg) {
|
|
364
|
-
throw contractValidationError('summary_data_required', 'mode=stage2 时必须提供 summaryData');
|
|
365
|
-
}
|
|
366
|
-
const summaryPath = resolve(summaryArg);
|
|
367
|
-
if (!existsSync(summaryPath)) {
|
|
368
|
-
throw contractValidationError('summary_data_not_found', `summaryData 不存在:${summaryPath}`);
|
|
369
|
-
}
|
|
370
|
-
const summary = JSON.parse(readFileSync(summaryPath, 'utf8').replace(/^\uFEFF/u, ''));
|
|
371
|
-
if (!companyName && isRecord(summary) && isRecord(summary.meta)) {
|
|
372
|
-
companyName = text(summary.meta.customer).trim();
|
|
373
|
-
}
|
|
374
|
-
const stage2 = await runStage2({
|
|
375
|
-
summary,
|
|
376
|
-
outDir,
|
|
377
|
-
docType,
|
|
378
|
-
title,
|
|
379
|
-
companyName,
|
|
380
|
-
baseUrl,
|
|
381
|
-
context,
|
|
382
|
-
warnings,
|
|
383
|
-
});
|
|
384
|
-
Object.assign(result, stage2.data);
|
|
385
|
-
warnings.push(...stage2.warnings);
|
|
386
|
-
result.warnings = warnings;
|
|
387
|
-
return { status: 'COMPLETE', data: result };
|
|
388
|
-
}
|
|
389
|
-
// ── sheets:多 sheet 时列出让用户选,默认取第一个
|
|
390
|
-
const sheetsData = await callOperation('contract.quote.sheets', { path: fwd }, context);
|
|
391
|
-
const sheets = (Array.isArray(sheetsData.sheets) ? sheetsData.sheets : []).map((item) => String(item));
|
|
392
|
-
if (sheets.length === 0) {
|
|
393
|
-
throw contractValidationError('sheets_empty', '未能从报价单读取到任何工作表');
|
|
394
|
-
}
|
|
395
|
-
const requestedSheet = text(input.sheet).trim();
|
|
396
|
-
if (requestedSheet && !sheets.includes(requestedSheet)) {
|
|
397
|
-
throw contractValidationError('sheet_not_found', `工作表「${requestedSheet}」不存在;可选:${sheets.join('、')}`);
|
|
398
|
-
}
|
|
399
|
-
const sheet = requestedSheet || sheets[0];
|
|
400
|
-
result.sheets = sheets;
|
|
401
|
-
result.sheet = sheet;
|
|
402
|
-
if (sheets.length > 1) {
|
|
403
|
-
warnings.push(requestedSheet
|
|
404
|
-
? `文件含 ${sheets.length} 个工作表,已按指定使用「${sheet}」`
|
|
405
|
-
: `文件含 ${sheets.length} 个工作表,已取第一个「${sheet}」;需要换表请传 sheet`);
|
|
406
|
-
}
|
|
407
|
-
// ── extract:无损还原网格
|
|
408
|
-
const raw = await callOperation('contract.quote.extract', { path: fwd, sheet }, context);
|
|
409
|
-
const rawGridPath = join(outDir, 'raw_grid.json');
|
|
410
|
-
writeJson(rawGridPath, raw);
|
|
411
|
-
result.outputs.rawGrid = rawGridPath;
|
|
412
|
-
result.previewLines = buildPreview(Array.isArray(raw.rows) ? raw.rows : [], head);
|
|
413
|
-
// ── parse:金额结构(含 checks / warnings)
|
|
414
|
-
const parsed = await callOperation('contract.quote.parse', { path: fwd, sheet }, context);
|
|
415
|
-
const parsedPath = join(outDir, 'parsed.json');
|
|
416
|
-
writeJson(parsedPath, parsed);
|
|
417
|
-
result.outputs.parsed = parsedPath;
|
|
418
|
-
if (mode === 'stage1') {
|
|
419
|
-
const skeleton = {
|
|
420
|
-
kind: 'quote',
|
|
421
|
-
file: fwd,
|
|
422
|
-
sheet,
|
|
423
|
-
sheets,
|
|
424
|
-
meta: {
|
|
425
|
-
customer: '',
|
|
426
|
-
quote_date: '',
|
|
427
|
-
sales: '',
|
|
428
|
-
phone: '',
|
|
429
|
-
_note: '读 raw_grid.json 后由模型填写;取不到写空串,不要编造',
|
|
430
|
-
},
|
|
431
|
-
totals: { standard_total: null, final_total: null },
|
|
432
|
-
sections: [],
|
|
433
|
-
_next: '模型填好本骨架后产出 summaryData,再以 mode=stage2 进入阶段2',
|
|
434
|
-
};
|
|
435
|
-
const skeletonPath = join(outDir, 'elements_skeleton.json');
|
|
436
|
-
writeJson(skeletonPath, skeleton);
|
|
437
|
-
result.outputs.skeleton = skeletonPath;
|
|
438
|
-
return { status: 'COMPLETE', data: result };
|
|
439
|
-
}
|
|
440
|
-
// ── auto:自动识要素 → 金额矛盾校验 → 文字摘要 → 卡片
|
|
441
|
-
const summary = autoSummary(fwd, raw, parsed, docType);
|
|
442
|
-
if (companyName)
|
|
443
|
-
summary.meta.customer = companyName;
|
|
444
|
-
else
|
|
445
|
-
companyName = summary.meta.customer;
|
|
446
|
-
const summaryPath = join(outDir, 'summary_data.json');
|
|
447
|
-
writeJson(summaryPath, summary);
|
|
448
|
-
result.outputs.summaryData = summaryPath;
|
|
449
|
-
result.auto = {
|
|
450
|
-
customer: summary.meta.customer,
|
|
451
|
-
quoteDate: summary.meta.quote_date,
|
|
452
|
-
sales: summary.meta.sales,
|
|
453
|
-
standardTotal: summary.totals.standard_total,
|
|
454
|
-
finalTotal: summary.totals.final_total,
|
|
455
|
-
checks: summary.warnings,
|
|
456
|
-
};
|
|
457
|
-
const stage2 = await runStage2({
|
|
458
|
-
summary,
|
|
459
|
-
outDir,
|
|
460
|
-
docType,
|
|
461
|
-
title,
|
|
462
|
-
companyName,
|
|
463
|
-
baseUrl,
|
|
464
|
-
context,
|
|
465
|
-
warnings,
|
|
466
|
-
});
|
|
467
|
-
Object.assign(result, stage2.data);
|
|
468
|
-
warnings.push(...stage2.warnings);
|
|
469
|
-
result.warnings = warnings;
|
|
470
|
-
return { status: 'COMPLETE', data: result };
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
];
|
|
474
|
-
/** 阶段2:文字摘要 + 动作卡片。报价单不出摘要 HTML、不出摘要卡。 */
|
|
475
|
-
async function runStage2(options) {
|
|
476
|
-
const { summary, outDir, docType, title, companyName, baseUrl, context } = options;
|
|
477
|
-
const warnings = [];
|
|
478
|
-
const textSummary = buildTextSummary(summary);
|
|
479
|
-
const textPath = join(outDir, 'text_summary.txt');
|
|
480
|
-
writeFileSync(textPath, textSummary, 'utf8');
|
|
481
|
-
const cardContext = {
|
|
482
|
-
scene: 'doc',
|
|
483
|
-
docType,
|
|
484
|
-
stage: 'quote',
|
|
485
|
-
hasFileId: false,
|
|
486
|
-
// 报价单写明对方企业全称时,按规则可追加「查对方资信」
|
|
487
|
-
hasCounterparty: Boolean(companyName),
|
|
488
|
-
// 报价单不出摘要卡:固定 false,动作引擎据此不生成「查看合同摘要」
|
|
489
|
-
summaryReady: false,
|
|
490
|
-
flowKey: null,
|
|
491
|
-
};
|
|
492
|
-
const cardPath = join(outDir, 'card.html');
|
|
493
|
-
const cardArgs = { context: cardContext, out: cardPath, baseUrl };
|
|
494
|
-
if (title)
|
|
495
|
-
cardArgs.title = title;
|
|
496
|
-
if (companyName)
|
|
497
|
-
cardArgs.companyName = companyName;
|
|
498
|
-
let cardHtml = null;
|
|
499
|
-
let selfCheckPassed = null;
|
|
500
|
-
try {
|
|
501
|
-
const cardData = await callOperation('contract.card.action', cardArgs, context);
|
|
502
|
-
if (existsSync(cardPath)) {
|
|
503
|
-
cardHtml = readFileSync(cardPath, 'utf8');
|
|
504
|
-
}
|
|
505
|
-
else if (typeof cardData.browsertool === 'string') {
|
|
506
|
-
cardHtml = cardData.browsertool;
|
|
507
|
-
}
|
|
508
|
-
selfCheckPassed = cardData.selfCheckPassed === true;
|
|
509
|
-
if (!selfCheckPassed) {
|
|
510
|
-
const fails = Array.isArray(cardData.selfCheck) ? cardData.selfCheck.join('; ') : '';
|
|
511
|
-
warnings.push(`卡片自检未通过${fails ? `:${fails}` : ''}`);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
catch (error) {
|
|
515
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
516
|
-
warnings.push(`动作卡片渲染失败:${message.slice(0, 200)}`);
|
|
517
|
-
}
|
|
518
|
-
return {
|
|
519
|
-
data: {
|
|
520
|
-
textSummary,
|
|
521
|
-
outputs: { textSummary: textPath, card: existsSync(cardPath) ? cardPath : '' },
|
|
522
|
-
cardPath: existsSync(cardPath) ? cardPath : null,
|
|
523
|
-
cardHtml,
|
|
524
|
-
cardSelfCheckPassed: selfCheckPassed,
|
|
525
|
-
cardContext,
|
|
526
|
-
},
|
|
527
|
-
warnings,
|
|
528
|
-
};
|
|
529
|
-
}
|