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
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { contractValidationError } from '../errors.js';
|
|
4
|
+
import { resolveOperation } from './op-resolver.js';
|
|
5
|
+
/**
|
|
6
|
+
* 合同比对报告渲染(2026-11-19 新增,取代已删除的 `contract.comparescreen.run`)。
|
|
7
|
+
*
|
|
8
|
+
* 背景:`comparescreen.run` 把「上传 + 全量比对 + 报告 HTML + 行为卡片」揉成一条命令,
|
|
9
|
+
* 卡片部分随「行为卡片全面废止」下线,报告交付也改为 HTML 落盘 + `open_web` 打开
|
|
10
|
+
* `file:///`。本 operation 只保留报告这一件事,不再出任何卡片:
|
|
11
|
+
* files(2) / baseFileId+compareFileId / ref(落盘的 diff 结果)
|
|
12
|
+
* → contract.compare.diff(需要时)
|
|
13
|
+
* → 按 `contract-compare-report.md` 的口径渲染 HTML → 落盘 → 返回路径
|
|
14
|
+
*
|
|
15
|
+
* 设计对齐 `review-report.ts`:模板内嵌在代码里(打包场景下读外部模板会静默失效),
|
|
16
|
+
* 只有显式传 `template` 才读外部文件;内嵌模板与
|
|
17
|
+
* `references/contract-compare-report-template.html` 互为镜像,两者必须一致。
|
|
18
|
+
*
|
|
19
|
+
* 默认比对(「比对一下 / 看看两版差异」)不走本命令,用 `compare.upload` →
|
|
20
|
+
* `compare.page` → `open_web`,由页面自行渲染差异。
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_BASE = 'https://www.e-cology.com.cn';
|
|
23
|
+
function isRecord(value) {
|
|
24
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
25
|
+
}
|
|
26
|
+
function str(value) {
|
|
27
|
+
return typeof value === 'string' ? value : typeof value === 'number' ? String(value) : '';
|
|
28
|
+
}
|
|
29
|
+
function num(value) {
|
|
30
|
+
const parsed = Number(value);
|
|
31
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
32
|
+
}
|
|
33
|
+
/** 只用于文件名、条款名等纯文本位置;接口给的 base/compare 已带高亮,不能二次转义。 */
|
|
34
|
+
function esc(value) {
|
|
35
|
+
return str(value)
|
|
36
|
+
.replace(/&/gu, '&')
|
|
37
|
+
.replace(/</gu, '<')
|
|
38
|
+
.replace(/>/gu, '>');
|
|
39
|
+
}
|
|
40
|
+
function readJson(path) {
|
|
41
|
+
const raw = readFileSync(path, 'utf8').replace(/^\uFEFF/u, '');
|
|
42
|
+
const parsed = JSON.parse(raw);
|
|
43
|
+
if (!isRecord(parsed))
|
|
44
|
+
throw new Error('JSON 根节点必须是对象');
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
async function callOperation(name, input, context) {
|
|
48
|
+
const operation = resolveOperation(name);
|
|
49
|
+
const result = await operation.execute(input, context);
|
|
50
|
+
return isRecord(result?.data) ? result.data : {};
|
|
51
|
+
}
|
|
52
|
+
function stampNow() {
|
|
53
|
+
const now = new Date();
|
|
54
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
55
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}`;
|
|
56
|
+
}
|
|
57
|
+
/** 按接口 type 逐条计数,合计恒等于 changes.length;同一处被拆成多条时照实各计一条。 */
|
|
58
|
+
function statOf(changes, percentage, serviceTime) {
|
|
59
|
+
let insert = 0;
|
|
60
|
+
let deleted = 0;
|
|
61
|
+
let changed = 0;
|
|
62
|
+
for (const item of changes) {
|
|
63
|
+
const type = str(item.type).toLowerCase();
|
|
64
|
+
if (type === 'insert')
|
|
65
|
+
insert += 1;
|
|
66
|
+
else if (type === 'delete')
|
|
67
|
+
deleted += 1;
|
|
68
|
+
else if (type === 'change' || type === 'replace')
|
|
69
|
+
changed += 1;
|
|
70
|
+
}
|
|
71
|
+
return { total: changes.length, insert, delete: deleted, change: changed, percentage, serviceTime };
|
|
72
|
+
}
|
|
73
|
+
function typeLabel(type) {
|
|
74
|
+
const value = type.toLowerCase();
|
|
75
|
+
if (value === 'insert')
|
|
76
|
+
return { label: '新增', cls: 'ins', color: '#237804' };
|
|
77
|
+
if (value === 'delete')
|
|
78
|
+
return { label: '删除', cls: 'del', color: '#a8071a' };
|
|
79
|
+
if (value === 'change' || value === 'replace')
|
|
80
|
+
return { label: '修改', cls: 'chg', color: '#b26a00' };
|
|
81
|
+
return { label: type || '差异', cls: 'oth', color: '#5c6570' };
|
|
82
|
+
}
|
|
83
|
+
/** 章节归属:正文章标题不带「第X章」,带编号的只出现在目录,故按关键词与页码定位。 */
|
|
84
|
+
function zoneOf(item) {
|
|
85
|
+
const content = [str(item.baseOriginal), str(item.compareOriginal), str(item.countText)].join(' ');
|
|
86
|
+
if (/(联系人|联系电话|电话|传真|邮箱|开户行|账号|税号|地址)/u.test(content))
|
|
87
|
+
return 'party';
|
|
88
|
+
if (/(签订时间|签订日期|签订地点|合同编号|合同名称)/u.test(content))
|
|
89
|
+
return 'cover';
|
|
90
|
+
return 'body';
|
|
91
|
+
}
|
|
92
|
+
function clauseOf(item) {
|
|
93
|
+
const content = [str(item.baseOriginal), str(item.compareOriginal), str(item.countText)].join(' ');
|
|
94
|
+
if (/(签订时间|签订日期)/u.test(content))
|
|
95
|
+
return '签订时间';
|
|
96
|
+
if (/签订地点/u.test(content))
|
|
97
|
+
return '签订地点';
|
|
98
|
+
if (/联系人/u.test(content))
|
|
99
|
+
return '联系人';
|
|
100
|
+
if (/电话/u.test(content))
|
|
101
|
+
return '联系电话';
|
|
102
|
+
if (/传真/u.test(content))
|
|
103
|
+
return '传真';
|
|
104
|
+
if (/邮箱/u.test(content))
|
|
105
|
+
return '电子邮箱';
|
|
106
|
+
if (/地址/u.test(content))
|
|
107
|
+
return '地址';
|
|
108
|
+
if (/合同编号/u.test(content))
|
|
109
|
+
return '合同编号';
|
|
110
|
+
if (/合同名称/u.test(content))
|
|
111
|
+
return '合同名称';
|
|
112
|
+
return '其他条款';
|
|
113
|
+
}
|
|
114
|
+
function pageOf(item) {
|
|
115
|
+
const side = isRecord(item.right) ? item.right : isRecord(item.left) ? item.left : {};
|
|
116
|
+
const positions = Array.isArray(side.positions) ? side.positions : [];
|
|
117
|
+
const first = positions.length > 0 && isRecord(positions[0]) ? positions[0] : {};
|
|
118
|
+
const page = num(first.page);
|
|
119
|
+
return page >= 0 ? page + 1 : 0;
|
|
120
|
+
}
|
|
121
|
+
function slimChanges(changes) {
|
|
122
|
+
return changes.map((item) => ({
|
|
123
|
+
type: str(item.type),
|
|
124
|
+
zone: zoneOf(item),
|
|
125
|
+
clause: clauseOf(item),
|
|
126
|
+
page: pageOf(item),
|
|
127
|
+
base: str(item.baseOriginal),
|
|
128
|
+
compare: str(item.compareOriginal),
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
// ---------------------------------------------------------------- 报告渲染
|
|
132
|
+
const ZONE_GROUPS = [
|
|
133
|
+
['cover', '封面(正文前)'],
|
|
134
|
+
['party', '缔约信息区(正文前)'],
|
|
135
|
+
['body', '正文条款'],
|
|
136
|
+
];
|
|
137
|
+
function detailRows(changes) {
|
|
138
|
+
return changes
|
|
139
|
+
.map((item, index) => {
|
|
140
|
+
const meta = typeLabel(str(item.type));
|
|
141
|
+
return `<tr><td class="num">${index + 1}</td>`
|
|
142
|
+
+ `<td><span class="tag" style="color:${meta.color}">${esc(meta.label)}</span></td>`
|
|
143
|
+
+ `<td class="cell base">${str(item.base)}</td>`
|
|
144
|
+
+ `<td class="cell cmp">${str(item.compare)}</td></tr>`;
|
|
145
|
+
})
|
|
146
|
+
.join('');
|
|
147
|
+
}
|
|
148
|
+
function diffBlocks(changes) {
|
|
149
|
+
const section2 = [];
|
|
150
|
+
const noDiff = [];
|
|
151
|
+
for (const [key, label] of ZONE_GROUPS) {
|
|
152
|
+
const group = changes.filter((item) => zoneOf(item) === key);
|
|
153
|
+
if (group.length === 0) {
|
|
154
|
+
noDiff.push(label);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const rows = group
|
|
158
|
+
.map((item) => {
|
|
159
|
+
const meta = typeLabel(str(item.type));
|
|
160
|
+
const page = pageOf(item);
|
|
161
|
+
const clause = clauseOf(item);
|
|
162
|
+
const position = `${label} · ${clause}${page > 0 ? `(第 ${page} 页)` : ''}`;
|
|
163
|
+
return `<tr><td class="clause">${esc(clause)}</td>`
|
|
164
|
+
+ `<td><span class="tag" style="color:${meta.color}">${esc(meta.label)}</span></td>`
|
|
165
|
+
+ `<td class="where">${esc(position)}</td>`
|
|
166
|
+
+ `<td class="cell base">${str(item.base)}</td>`
|
|
167
|
+
+ `<td class="cell cmp">${str(item.compare)}</td></tr>`;
|
|
168
|
+
})
|
|
169
|
+
.join('');
|
|
170
|
+
section2.push('<div class="grp">'
|
|
171
|
+
+ `<div class="grp-hd"><span class="grp-name">${esc(label)}</span>`
|
|
172
|
+
+ `<span class="grp-cnt">${group.length} 处差异</span></div>`
|
|
173
|
+
+ '<table class="diff2"><thead><tr><th style="width:20%">差异条款</th><th style="width:62px">类型</th>'
|
|
174
|
+
+ '<th style="width:22%">位置</th><th>改动前</th><th>改动后</th></tr></thead>'
|
|
175
|
+
+ `<tbody>${rows}</tbody></table></div>`);
|
|
176
|
+
}
|
|
177
|
+
return { section2: section2.join('\n'), noDiff };
|
|
178
|
+
}
|
|
179
|
+
function noDiffBlock(labels) {
|
|
180
|
+
if (labels.length === 0)
|
|
181
|
+
return '';
|
|
182
|
+
const rows = labels.map((label) => `<tr><td>${esc(label)}</td><td class="none">0 处差异</td></tr>`).join('');
|
|
183
|
+
return '<div class="grp">'
|
|
184
|
+
+ '<div class="grp-hd"><span class="grp-name">未检出差异的区块</span>'
|
|
185
|
+
+ '<span class="grp-cnt" style="background:#237804">0 处差异</span></div>'
|
|
186
|
+
+ '<div class="grp-sub">以下区块逐条比对后未发现差异</div>'
|
|
187
|
+
+ `<table class="chap"><tbody>${rows}</tbody></table></div>`;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 内嵌模板:与 `references/contract-compare-report-template.html` 互为镜像。
|
|
191
|
+
* 占位符(12 个):GENERATED_AT / BASIC_FILE / TARGET_FILE / TOTAL / INSERT / DELETE /
|
|
192
|
+
* CHANGE / PERCENTAGE / SERVICE_TIME / DIFF_ROWS / SECTION2_BLOCKS / NO_DIFF_BLOCK
|
|
193
|
+
*/
|
|
194
|
+
const DEFAULT_TEMPLATE = `<!DOCTYPE html>
|
|
195
|
+
<html lang="zh-CN">
|
|
196
|
+
<head>
|
|
197
|
+
<meta charset="UTF-8">
|
|
198
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
199
|
+
<title>合同比对报告 · {{BASIC_FILE}}</title>
|
|
200
|
+
<style>
|
|
201
|
+
.rp *{box-sizing:border-box}
|
|
202
|
+
.rp{font-family:"Microsoft YaHei","PingFang SC",sans-serif;color:#1f2329;line-height:1.7;font-size:13.5px;background:#f5f6f8;padding:20px 16px 32px}
|
|
203
|
+
.rp .card{background:#fff;border:1px solid #e3e6eb;border-radius:10px;padding:20px 22px;margin-bottom:14px}
|
|
204
|
+
.rp h1{font-size:19px;margin:0 0 4px;font-weight:700}
|
|
205
|
+
.rp .sub{color:#8a939e;font-size:12.5px;margin-bottom:16px}
|
|
206
|
+
.rp h2{font-size:15px;margin:0 0 12px;padding-left:9px;border-left:3px solid #1a56b8;line-height:1.3}
|
|
207
|
+
.rp h3{font-size:13.5px;margin:0 0 10px;color:#5c6570;font-weight:600}
|
|
208
|
+
.rp table{width:100%;border-collapse:collapse}
|
|
209
|
+
.rp .who{background:#fafbfc;border:1px solid #eef0f4;border-radius:8px;padding:14px 16px;margin-bottom:14px}
|
|
210
|
+
.rp .who .row{display:flex;gap:10px;margin-bottom:8px;align-items:flex-start}
|
|
211
|
+
.rp .who .row:last-child{margin-bottom:0}
|
|
212
|
+
.rp .who .lab{flex:0 0 92px;color:#8a939e;font-size:12.5px}
|
|
213
|
+
.rp .who .val{flex:1;font-weight:600;word-wrap:break-word}
|
|
214
|
+
.rp .who .arrow{flex:0 0 auto;color:#1a56b8;font-weight:700}
|
|
215
|
+
.rp .stats{display:flex;gap:10px;margin-bottom:14px;flex-wrap:wrap}
|
|
216
|
+
.rp .stat{flex:1 1 96px;background:#fff;border:1px solid #e3e6eb;border-radius:10px;padding:12px 14px;text-align:center}
|
|
217
|
+
.rp .stat .k{font-size:12px;color:#8a939e;margin-bottom:4px}
|
|
218
|
+
.rp .stat .n{font-size:22px;font-weight:700;line-height:1.15;color:#1f2329}
|
|
219
|
+
.rp .stat.tot .n{color:#1a56b8}
|
|
220
|
+
.rp .stat.ins .n{color:#237804}
|
|
221
|
+
.rp .stat.del .n{color:#a8071a}
|
|
222
|
+
.rp .stat.chg .n{color:#b26a00}
|
|
223
|
+
.rp .diff th,.rp .diff2 th{text-align:left;font-size:12.5px;color:#5c6570;font-weight:500;padding:9px 10px;background:#fafbfc;border-bottom:1px solid #e3e6eb}
|
|
224
|
+
.rp .diff td,.rp .diff2 td{padding:12px 10px;border-bottom:1px solid #f0f2f5;vertical-align:top}
|
|
225
|
+
.rp .diff tr:last-child td,.rp .diff2 tr:last-child td{border-bottom:none}
|
|
226
|
+
.rp .num{width:38px;color:#a0a8b3;text-align:center}
|
|
227
|
+
.rp .tag{display:inline-block;font-size:11.5px;padding:1px 9px;border-radius:999px;border:1px solid;white-space:nowrap}
|
|
228
|
+
.rp .cell{font-size:13px;line-height:1.8;word-wrap:break-word}
|
|
229
|
+
.rp .base{background:#fcfcfd}
|
|
230
|
+
.rp .cmp{background:#fbfdff}
|
|
231
|
+
.rp .clause{font-weight:600;font-size:13px}
|
|
232
|
+
.rp .where{color:#8a939e;font-size:12px;line-height:1.6}
|
|
233
|
+
.rp details{border:1px solid #e3e6eb;border-radius:10px;background:#fff;overflow:hidden}
|
|
234
|
+
.rp details>summary{cursor:pointer;padding:15px 20px;font-size:15px;font-weight:700;list-style:none;display:flex;align-items:center;gap:10px;background:#fff}
|
|
235
|
+
.rp details>summary::-webkit-details-marker{display:none}
|
|
236
|
+
.rp details>summary .arw{color:#1a56b8;font-size:13px;transition:transform .2s}
|
|
237
|
+
.rp details[open]>summary .arw{transform:rotate(90deg)}
|
|
238
|
+
.rp details>summary .hint{margin-left:auto;font-size:12px;color:#8a939e;font-weight:400}
|
|
239
|
+
.rp .body{padding:0 20px 18px}
|
|
240
|
+
.rp .grp{border:1px solid #eef0f4;border-radius:8px;margin-bottom:12px;overflow:hidden}
|
|
241
|
+
.rp .grp-hd{background:#fafbfc;padding:10px 14px;display:flex;align-items:center;gap:8px}
|
|
242
|
+
.rp .grp-name{font-weight:700;font-size:13.5px}
|
|
243
|
+
.rp .grp-cnt{font-size:11.5px;color:#fff;background:#1a56b8;border-radius:999px;padding:1px 9px}
|
|
244
|
+
.rp .grp-sub{padding:8px 14px 0;color:#8a939e;font-size:12px}
|
|
245
|
+
.rp .diff2{margin-top:6px}
|
|
246
|
+
.rp .chap td{padding:7px 12px;border-bottom:1px solid #f5f6f8;font-size:12.5px}
|
|
247
|
+
.rp .chap .none{color:#237804;text-align:right}
|
|
248
|
+
.rp .disc{font-size:12px;color:#8a939e;background:#fafbfc;border-radius:8px;padding:10px 14px;line-height:1.8;margin-top:12px}
|
|
249
|
+
.rp .foot{color:#a0a8b3;font-size:12px;text-align:center;margin-top:10px}
|
|
250
|
+
@media print{.rp{background:#fff;padding:0}.rp .card{border:none}}
|
|
251
|
+
</style>
|
|
252
|
+
</head>
|
|
253
|
+
<body style="margin:0;background:#f5f6f8">
|
|
254
|
+
|
|
255
|
+
<div class="rp">
|
|
256
|
+
|
|
257
|
+
<!-- ===== 第一部分:比对信息 ===== -->
|
|
258
|
+
<div class="card">
|
|
259
|
+
<h1>合同比对报告</h1>
|
|
260
|
+
<div class="sub">生成时间 {{GENERATED_AT}} | 数据来源:contract.compare.diff 实际返回</div>
|
|
261
|
+
|
|
262
|
+
<h2>一、比对信息</h2>
|
|
263
|
+
|
|
264
|
+
<h3>1. 比对双方</h3>
|
|
265
|
+
<div class="who">
|
|
266
|
+
<div class="row"><div class="lab">基准合同</div><div class="val">{{BASIC_FILE}}</div></div>
|
|
267
|
+
<div class="row"><div class="lab"></div><div class="arrow">↓ 与 ↓</div></div>
|
|
268
|
+
<div class="row"><div class="lab">比对合同</div><div class="val">{{TARGET_FILE}}</div></div>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<h3>2. 差异统计</h3>
|
|
272
|
+
<div class="stats">
|
|
273
|
+
<div class="stat tot"><div class="k">变化合计</div><div class="n">{{TOTAL}}</div></div>
|
|
274
|
+
<div class="stat ins"><div class="k">新增</div><div class="n">{{INSERT}}</div></div>
|
|
275
|
+
<div class="stat del"><div class="k">删除</div><div class="n">{{DELETE}}</div></div>
|
|
276
|
+
<div class="stat chg"><div class="k">修改</div><div class="n">{{CHANGE}}</div></div>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="disc" style="margin-bottom:14px">
|
|
279
|
+
自基准合同至比对合同,共发生 <b>{{TOTAL}}</b> 处变化:新增 <b>{{INSERT}}</b> 处、删除 <b>{{DELETE}}</b> 处、修改 <b>{{CHANGE}}</b> 处。
|
|
280
|
+
文本相似度 <b>{{PERCENTAGE}}</b>,比对耗时 {{SERVICE_TIME}}。
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<h3>3. 差异详情</h3>
|
|
284
|
+
<table class="diff">
|
|
285
|
+
<thead><tr><th style="width:38px">#</th><th style="width:68px">类型</th><th>基准合同内容</th><th>比对合同内容</th></tr></thead>
|
|
286
|
+
<tbody>{{DIFF_ROWS}}</tbody>
|
|
287
|
+
</table>
|
|
288
|
+
<div class="disc">上表为接口返回的原文片段,彩色文字即接口标注的改动位置(橙色=修改、绿色=新增、红色=删除),前后文字为上下文。</div>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<!-- ===== 第二部分:默认展开 ===== -->
|
|
292
|
+
<details open>
|
|
293
|
+
<summary>
|
|
294
|
+
<span class="arw">▶</span>
|
|
295
|
+
<span>二、按合同章节 / 条款展示差异点</span>
|
|
296
|
+
<span class="hint">可折叠</span>
|
|
297
|
+
</summary>
|
|
298
|
+
<div class="body">
|
|
299
|
+
{{SECTION2_BLOCKS}}
|
|
300
|
+
|
|
301
|
+
{{NO_DIFF_BLOCK}}
|
|
302
|
+
</div>
|
|
303
|
+
</details>
|
|
304
|
+
|
|
305
|
+
<div class="foot">本报告由系统根据实际比对结果自动生成,未对差异内容做任何增补或推断。</div>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
</body>
|
|
309
|
+
</html>`;
|
|
310
|
+
/**
|
|
311
|
+
* 按固定模板渲染比对报告 HTML。
|
|
312
|
+
* 模板占位符全部由本函数填充;`contract-compare-report.md` 是口径唯一事实源。
|
|
313
|
+
*/
|
|
314
|
+
export function renderCompareReport(args, template) {
|
|
315
|
+
const { stat } = args;
|
|
316
|
+
const similarity = stat.percentage > 0 ? `${(stat.percentage * 100).toFixed(2)}%` : '未返回';
|
|
317
|
+
const cost = stat.serviceTime > 0 ? `${Math.round(stat.serviceTime)} ms` : '未返回';
|
|
318
|
+
const detail = stat.total > 0
|
|
319
|
+
? detailRows(args.changes)
|
|
320
|
+
: '<tr><td colspan="4" class="cell">两版未检出差异。</td></tr>';
|
|
321
|
+
const { section2, noDiff } = diffBlocks(args.changes);
|
|
322
|
+
const values = {
|
|
323
|
+
GENERATED_AT: esc(args.generatedAt),
|
|
324
|
+
BASIC_FILE: esc(args.baseFileName),
|
|
325
|
+
TARGET_FILE: esc(args.compareFileName),
|
|
326
|
+
TOTAL: String(stat.total),
|
|
327
|
+
INSERT: String(stat.insert),
|
|
328
|
+
DELETE: String(stat.delete),
|
|
329
|
+
CHANGE: String(stat.change),
|
|
330
|
+
PERCENTAGE: similarity,
|
|
331
|
+
SERVICE_TIME: cost,
|
|
332
|
+
DIFF_ROWS: detail,
|
|
333
|
+
SECTION2_BLOCKS: section2 || '<div class="grp-sub">未检出差异。</div>',
|
|
334
|
+
NO_DIFF_BLOCK: noDiffBlock(noDiff),
|
|
335
|
+
};
|
|
336
|
+
let html = template;
|
|
337
|
+
for (const [key, value] of Object.entries(values)) {
|
|
338
|
+
html = html.split(`{{${key}}}`).join(value);
|
|
339
|
+
}
|
|
340
|
+
const leftover = html.match(/\{\{[A-Z_]+\}\}/gu);
|
|
341
|
+
if (leftover) {
|
|
342
|
+
throw contractValidationError('template_placeholder_unknown', `模板存在未知占位符:${[...new Set(leftover)].join(', ')}`);
|
|
343
|
+
}
|
|
344
|
+
return html;
|
|
345
|
+
}
|
|
346
|
+
// ---------------------------------------------------------------- operation
|
|
347
|
+
export const contractCompareReportOperation = {
|
|
348
|
+
name: 'contract.compare.report',
|
|
349
|
+
async execute(input, context) {
|
|
350
|
+
const paths = Array.isArray(input.files) ? input.files : [];
|
|
351
|
+
let baseFileId = str(input.baseFileId).trim();
|
|
352
|
+
let compareFileId = str(input.compareFileId).trim();
|
|
353
|
+
let baseFileName = str(input.baseFileName).trim();
|
|
354
|
+
let compareFileName = str(input.compareFileName).trim();
|
|
355
|
+
const refPath = str(input.ref).trim();
|
|
356
|
+
let envelope = {};
|
|
357
|
+
if (refPath) {
|
|
358
|
+
const abs = resolve(refPath);
|
|
359
|
+
let parsed;
|
|
360
|
+
try {
|
|
361
|
+
parsed = readJson(abs);
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
365
|
+
throw contractValidationError('ref_unreadable', `无法读取比对结果 JSON:${message}`);
|
|
366
|
+
}
|
|
367
|
+
envelope = isRecord(parsed.result) ? parsed.result : parsed;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
if (paths.length > 0) {
|
|
371
|
+
if (paths.length !== 2) {
|
|
372
|
+
throw contractValidationError('files_count_invalid', '文档比对需要恰好 2 个文件:基准文件在前,比对文件在后');
|
|
373
|
+
}
|
|
374
|
+
const uploaded = await callOperation('contract.compare.upload', { paths }, context);
|
|
375
|
+
const files = Array.isArray(uploaded.files) ? uploaded.files : [];
|
|
376
|
+
if (files.length !== 2 || !str(files[0]?.fileId) || !str(files[1]?.fileId)) {
|
|
377
|
+
throw contractValidationError('upload_no_fileid', '比对文件上传未拿到 fileId,已停止');
|
|
378
|
+
}
|
|
379
|
+
baseFileId = str(files[0].fileId);
|
|
380
|
+
compareFileId = str(files[1].fileId);
|
|
381
|
+
baseFileName = baseFileName || str(files[0].name);
|
|
382
|
+
compareFileName = compareFileName || str(files[1].name);
|
|
383
|
+
}
|
|
384
|
+
if (!baseFileId || !compareFileId) {
|
|
385
|
+
throw contractValidationError('file_ids_required', '请提供 files(2 个本地路径)、baseFileId + compareFileId,或 ref(落盘的比对结果 JSON)');
|
|
386
|
+
}
|
|
387
|
+
const diffData = await callOperation('contract.compare.diff', { baseFileId, compareFileId }, context);
|
|
388
|
+
envelope = isRecord(diffData.result) ? diffData.result : {};
|
|
389
|
+
}
|
|
390
|
+
const body = isRecord(envelope.data) ? envelope.data : {};
|
|
391
|
+
if (String(body.compareStatus ?? '') !== 'true') {
|
|
392
|
+
throw contractValidationError('compare_failed', `比对未成功:${str(envelope.msg) || '接口未返回 compareStatus=true'};`
|
|
393
|
+
+ '不要重试、不要补调 diff 复查,改走 compare.upload → compare.page → open_web');
|
|
394
|
+
}
|
|
395
|
+
const compare = isRecord(body.contractCompare) ? body.contractCompare : {};
|
|
396
|
+
const changes = Array.isArray(compare.changes) ? compare.changes : [];
|
|
397
|
+
baseFileName = str(compare.basicFileName) || baseFileName;
|
|
398
|
+
compareFileName = str(compare.targetFileName) || compareFileName;
|
|
399
|
+
const stat = statOf(changes, num(compare.percentage), num(compare.serviceTime));
|
|
400
|
+
const templatePath = str(input.template).trim();
|
|
401
|
+
let template = DEFAULT_TEMPLATE;
|
|
402
|
+
if (templatePath) {
|
|
403
|
+
const abs = resolve(templatePath);
|
|
404
|
+
try {
|
|
405
|
+
template = readFileSync(abs, 'utf8');
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
409
|
+
throw contractValidationError('template_not_found', `模板文件读取失败:${message}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const html = renderCompareReport({ baseFileName, compareFileName, changes, stat, generatedAt: stampNow() }, template);
|
|
413
|
+
const outPath = resolve(str(input.out).trim());
|
|
414
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
415
|
+
writeFileSync(outPath, html, 'utf8');
|
|
416
|
+
const dumpData = str(input.dumpData).trim();
|
|
417
|
+
let dumped = '';
|
|
418
|
+
if (dumpData) {
|
|
419
|
+
dumped = resolve(dumpData);
|
|
420
|
+
mkdirSync(dirname(dumped), { recursive: true });
|
|
421
|
+
writeFileSync(dumped, JSON.stringify({ baseFileName, compareFileName, stats: stat, changes: slimChanges(changes) }, null, 2), 'utf8');
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
status: 'COMPLETE',
|
|
425
|
+
data: {
|
|
426
|
+
ok: true,
|
|
427
|
+
out: outPath,
|
|
428
|
+
stats: stat,
|
|
429
|
+
changes: slimChanges(changes),
|
|
430
|
+
htmlLength: Buffer.byteLength(html, 'utf8'),
|
|
431
|
+
...(dumped ? { dumpData: dumped } : {}),
|
|
432
|
+
note: '报告已落盘;交付方式为产物文件(present_files 登记)+ open_web 打开该文件的 file:/// 绝对路径(不出卡片)',
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
export const contractCompareReportOperations = [contractCompareReportOperation];
|
|
@@ -53,6 +53,8 @@ export const contractCompareOperations = [
|
|
|
53
53
|
for (const rawPath of paths) {
|
|
54
54
|
const path = requireNonEmptyString(rawPath, 'paths[]', 1000);
|
|
55
55
|
// 比对走独立 module,不能与审查/流程上传混用。
|
|
56
|
+
// 比对文件不属于任何合同流程,没有助手 URL 的 flowId,因此这里不带 prewarmFlowId:
|
|
57
|
+
// 预审预热自动跳过(预热与取结果必须用同一个动态 flowId,不能用固定值兜底)。
|
|
56
58
|
files.push(await uploadFile(host, { path, module: 'docCompared' }));
|
|
57
59
|
}
|
|
58
60
|
return {
|