weaver-work-cli 0.1.49 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{attachment-content-MU2LPI5P.js → attachment-content-MBYYSQIX.js} +3 -3
- package/dist/chunks/{chunk-ZKEUGS2U.js → chunk-7UOXOGFL.js} +4 -4
- package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
- package/dist/chunks/{chunk-3NV2ETZR.js → chunk-D3TDNRFE.js} +8 -8
- package/dist/chunks/{chunk-6GWU63YF.js → chunk-DZOC77ZD.js} +1 -1
- package/dist/chunks/{chunk-K3BT54CU.js → chunk-IRMA3GVP.js} +1 -1
- package/dist/chunks/{chunk-3X7VOSBA.js → chunk-KLZ3ULQQ.js} +1 -1
- package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
- package/dist/chunks/{chunk-NBEWUR7L.js → chunk-LALWNK6M.js} +167 -44
- package/dist/chunks/{chunk-BRRW7CWA.js → chunk-LM2H7SZI.js} +26 -26
- package/dist/chunks/{chunk-KV5SOWMS.js → chunk-LTRLF6MM.js} +4 -4
- package/dist/chunks/{chunk-D2QRZUW4.js → chunk-RPRFIG6I.js} +35 -28
- package/dist/chunks/{chunk-GEOMANP7.js → chunk-RWFRZSIP.js} +2 -2
- package/dist/chunks/{chunk-EJVA5ZVB.js → chunk-ZRHKGQRQ.js} +2 -2
- package/dist/chunks/{conflict-6347A7YK.js → conflict-D2HYKBMH.js} +2 -2
- package/dist/chunks/{contract-N6P2HIIE.js → contract-MFOFMM2J.js} +4284 -254
- package/dist/chunks/{create-flow-7WG7LVX5.js → create-flow-7ZATJVTM.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-LHRKSLG6.js → env-5DO4YENS.js} +2 -2
- package/dist/chunks/{factory-2H7Z4RWJ.js → factory-3M7D7WJC.js} +1 -1
- package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
- package/dist/chunks/{group-chat-EW6PNDDT.js → group-chat-B2HT5NEO.js} +3 -3
- package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
- package/dist/chunks/{invoice-FXWH5GPO.js → invoice-V7ZTITUO.js} +726 -206
- package/dist/chunks/{meeting-N2FQBHXI.js → meeting-HZOX3CBB.js} +10 -10
- package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
- package/dist/chunks/{reception-MYOKJULO.js → reception-QGPNTGHG.js} +98 -82
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
- package/dist/chunks/{registry-7VZ6YJUF.js → registry-KYPFFQIH.js} +1 -1
- package/dist/chunks/{registry-CKUVBS53.js → registry-SJHSBO5G.js} +10 -10
- package/dist/chunks/{room-recommend-MBCYENQ2.js → room-recommend-5AHR4YQV.js} +4 -4
- package/dist/chunks/{schedule-5IFMCXME.js → schedule-KZPJUPC2.js} +4 -4
- package/dist/chunks/smart-extract-IXHCZE4R.js +2846 -0
- package/dist/chunks/{workflow-2TRU2ZSP.js → workflow-UHKCZJMY.js} +1 -1
- package/dist/index.js +14 -9
- package/dist/shortcuts/contract/host.js +11 -0
- package/dist/shortcuts/contract/index.js +13 -0
- package/dist/shortcuts/contract/manifest.js +204 -0
- package/dist/shortcuts/contract/operations/card-action.js +585 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +315 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/elements-build.js +714 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +563 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +58 -7
- package/dist/shortcuts/contract/operations/quote.js +410 -22
- package/dist/shortcuts/contract/operations/registry.js +22 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/fna/host.js +4 -2
- package/dist/shortcuts/fna/manifest.js +14 -5
- package/dist/shortcuts/fna/operations/audit.js +334 -0
- package/dist/shortcuts/fna/operations/registry.js +2 -0
- package/dist/shortcuts/im/operations/at-mention.js +6 -3
- package/dist/shortcuts/im/operations/msg-parse.js +35 -5
- package/dist/shortcuts/im/operations/msg-sync.js +3 -1
- package/dist/shortcuts/im/operations/msg-write.js +57 -9
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +201 -50
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
- package/dist/shortcuts/reception/constants.js +3 -7
- package/dist/shortcuts/reception/operations/leads.js +30 -6
- package/dist/shortcuts/reception/operations/panels.js +3 -2
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +489 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +408 -0
- package/dist/shortcuts/workflow/operations/read.js +77 -15
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +4 -1
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +24 -4
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +21 -1
- package/skill-template/domains/qiyecheng.md +6 -2
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +159 -11
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +13 -8
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +220 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +68 -33
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +26 -15
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +90 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +167 -5
- package/skills/weaver-e10-jinchengda/scripts/contract_first_screen.py +200 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_contract_from_quote.py +572 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
- package/skills/weaver-e10-jinchengda/scripts/quote_screen.py +560 -0
- package/skills/weaver-e10-jinchengda/scripts/triage_contract.py +894 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +93 -0
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
- package/skills/weaver-e10-qiyecheng/SKILL.md +58 -7
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +118 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +42 -3
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +153 -40
- package/skills/weaver-e10-reception-flow/SKILL.md +43 -6
- package/skills/weaver-e10-reception-flow/references/guide.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -40
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +169 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +105 -0
- package/skills/weaver-e10-workflow/SKILL.md +2 -1
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
- package/skills/weaver-e10-yepiaotong/SKILL.md +53 -35
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +18 -53
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +96 -7
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +5 -38
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +14 -14
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +139 -94
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +131 -58
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -15,6 +15,7 @@ import { contractValidationError } from '../errors.js';
|
|
|
15
15
|
import { requireNonEmptyString } from './shared.js';
|
|
16
16
|
import { listSheetNames, readGrid } from '../ooxml/xlsx.js';
|
|
17
17
|
import { fillDocx, labelBefore } from '../ooxml/docx.js';
|
|
18
|
+
import { readZipEntry } from '../ooxml/zip.js';
|
|
18
19
|
// ---------------------------------------------------------------- 人民币大写
|
|
19
20
|
const DIGITS = '零壹贰叁肆伍陆柒捌玖';
|
|
20
21
|
const UNITS = ['', '拾', '佰', '仟'];
|
|
@@ -116,6 +117,88 @@ function fmtNum(v) {
|
|
|
116
117
|
return String(v);
|
|
117
118
|
return f === Math.trunc(f) ? f.toLocaleString('en-US') : f.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
118
119
|
}
|
|
120
|
+
const META_FIELDS = [
|
|
121
|
+
{
|
|
122
|
+
key: 'customer',
|
|
123
|
+
labels: ['客户名称', '客户全称', '客户单位', '用户名称', '甲方名称', '采购方', '购买方', '订购方', '最终用户', '客户', '甲方', '需方'],
|
|
124
|
+
valid: (v) => v.length >= 2 && v.length <= 80 && /[\u4e00-\u9fa5A-Za-z]/u.test(v),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: 'quote_date',
|
|
128
|
+
labels: ['报价日期', '报价时间', '报价日'],
|
|
129
|
+
valid: (v) => /\d{4}/u.test(v),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: 'sales',
|
|
133
|
+
labels: ['客户经理', '销售经理', '销售代表', '报价人', '商务经理'],
|
|
134
|
+
valid: (v) => v.length >= 1 && v.length <= 30 && !/^\d+$/u.test(v),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'phone',
|
|
138
|
+
labels: ['联系电话', '联系方式', '客户电话', '手机号码', '手机'],
|
|
139
|
+
valid: (v) => /^[\d\-+() ]{6,}$/u.test(v.replace(/\s+/gu, '')),
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
function escapeRe(s) {
|
|
143
|
+
return s.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
144
|
+
}
|
|
145
|
+
/** 值本身是另一个字段的标签(如「客户经理:」)时不能当值用。 */
|
|
146
|
+
function isLabelLike(v) {
|
|
147
|
+
const bare = v.trim().replace(/[::]$/u, '').trim();
|
|
148
|
+
if (!bare)
|
|
149
|
+
return true;
|
|
150
|
+
return META_FIELDS.some((f) => f.labels.includes(bare));
|
|
151
|
+
}
|
|
152
|
+
function cleanMetaValue(v) {
|
|
153
|
+
return v.replace(/^[\s::\-—_]+/u, '').replace(/[\s::]+$/u, '').trim();
|
|
154
|
+
}
|
|
155
|
+
function extractQuoteMeta(rows) {
|
|
156
|
+
const meta = { customer: '', quote_date: '', sales: '', phone: '' };
|
|
157
|
+
const bestScore = {};
|
|
158
|
+
const consider = (field, raw, score) => {
|
|
159
|
+
const v = cleanMetaValue(raw);
|
|
160
|
+
if (!v || isLabelLike(v) || !field.valid(v))
|
|
161
|
+
return;
|
|
162
|
+
if (score > (bestScore[field.key] ?? 0)) {
|
|
163
|
+
meta[field.key] = v;
|
|
164
|
+
bestScore[field.key] = score;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
for (let r = 0; r < rows.length; r++) {
|
|
168
|
+
const row = rows[r] ?? [];
|
|
169
|
+
for (let c = 0; c < row.length; c++) {
|
|
170
|
+
const cell = cleanMetaValue(row[c] ?? '');
|
|
171
|
+
if (!cell)
|
|
172
|
+
continue;
|
|
173
|
+
for (const field of META_FIELDS) {
|
|
174
|
+
for (const label of field.labels) {
|
|
175
|
+
// ① 同格内联:标签在本格开头,冒号后即值
|
|
176
|
+
const inline = new RegExp(`^${escapeRe(label)}\\s*[::]\\s*(.+)$`, 'u').exec(cell);
|
|
177
|
+
if (inline && inline[1]) {
|
|
178
|
+
consider(field, inline[1], 100);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// 标签独占一格(可带冒号)→ 右邻格 / 下邻格
|
|
182
|
+
if (cell.replace(/[::]$/u, '').trim() !== label)
|
|
183
|
+
continue;
|
|
184
|
+
for (let j = c + 1; j < row.length; j++) {
|
|
185
|
+
const v = cleanMetaValue(row[j] ?? '');
|
|
186
|
+
if (!v)
|
|
187
|
+
continue;
|
|
188
|
+
if (isLabelLike(v))
|
|
189
|
+
break; // 撞到下一个标签,说明本字段确实没值
|
|
190
|
+
consider(field, v, 95);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
const below = cleanMetaValue(rows[r + 1]?.[c] ?? '');
|
|
194
|
+
if (below && !isLabelLike(below))
|
|
195
|
+
consider(field, below, 80);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return meta;
|
|
201
|
+
}
|
|
119
202
|
export function parseQuote(buffer, sheetName, keepRemark = false, includeZero = false) {
|
|
120
203
|
const names = listSheetNames(buffer);
|
|
121
204
|
if (names.length === 0)
|
|
@@ -165,25 +248,8 @@ export function parseQuote(buffer, sheetName, keepRemark = false, includeZero =
|
|
|
165
248
|
return i;
|
|
166
249
|
return null;
|
|
167
250
|
};
|
|
168
|
-
// ----
|
|
169
|
-
const meta =
|
|
170
|
-
for (const row of rows) {
|
|
171
|
-
const joined = row.join('');
|
|
172
|
-
for (const [label, key] of [['客户名称', 'customer'], ['报价日期', 'quote_date'], ['客户经理', 'sales'], ['联系电话', 'phone']]) {
|
|
173
|
-
if (!joined.includes(label) || meta[key])
|
|
174
|
-
continue;
|
|
175
|
-
const i = firstIdx(row, [label + ':', label + ':', label]);
|
|
176
|
-
if (i === null)
|
|
177
|
-
continue;
|
|
178
|
-
for (let j = i + 1; j < row.length; j++) {
|
|
179
|
-
const v = row[j];
|
|
180
|
-
if (v && v.replace(/[::]$/u, '') !== label && !['报价日期', '客户经理', '联系电话'].some((x) => v.startsWith(x))) {
|
|
181
|
-
meta[key] = v.replace(/[::]$/u, '');
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
251
|
+
// ---- 元信息:同格内联 / 分列 / 竖排 / 同行多字段,统一走 extractQuoteMeta
|
|
252
|
+
const meta = extractQuoteMeta(rows);
|
|
187
253
|
// ---- 项目总价区
|
|
188
254
|
const totals = {};
|
|
189
255
|
for (const row of rows) {
|
|
@@ -278,6 +344,8 @@ export function parseQuote(buffer, sheetName, keepRemark = false, includeZero =
|
|
|
278
344
|
checks.push({ section: `${s.code}、${s.title}`, sheet_total: s.total, sum_items: s.sum_items, diff: s.sum_items - s.total });
|
|
279
345
|
}
|
|
280
346
|
}
|
|
347
|
+
// 费用总表本身是各明细的汇总,若再累加会与合计额重复计算(实测差额等于合计值),
|
|
348
|
+
// 因此它只用于提供 standard_total / final_total,不参与明细求和。
|
|
281
349
|
const grand = sections.reduce((acc, s) => acc + (s.sum_items ?? 0), 0);
|
|
282
350
|
totals.sum_items_grand = grand;
|
|
283
351
|
const standard = totals.standard_total;
|
|
@@ -295,10 +363,217 @@ export function parseQuote(buffer, sheetName, keepRemark = false, includeZero =
|
|
|
295
363
|
if (final !== undefined && standard !== undefined && final !== standard) {
|
|
296
364
|
warnings.push(`存在折扣:标准价 ${standard} → 最终优惠报价 ${final},合同金额应以最终优惠报价为准`);
|
|
297
365
|
}
|
|
298
|
-
|
|
299
|
-
|
|
366
|
+
// 2026-11-12:已覆盖同格内联、分列、竖排三种形态;仍取不到才告警,
|
|
367
|
+
// 且只报「未能自动定位」——不得断言「未填写」,也不得据此向用户索要。
|
|
368
|
+
if (!meta.customer) {
|
|
369
|
+
warnings.push('未能自动定位『客户名称』(已尝试标签同格内联、右邻格、下邻格三种形态)。' +
|
|
370
|
+
'这不代表文件未填写:请用 contract.quote.extract 取原始网格行,由模型在网格中确认客户全称后再交用户核对。');
|
|
371
|
+
}
|
|
300
372
|
return { source_sheet: sheet, available_sheets: names, meta, totals, sections, checks, warnings };
|
|
301
373
|
}
|
|
374
|
+
// ---------------------------------------------------------------- docx 报价书解析
|
|
375
|
+
/**
|
|
376
|
+
* Word 版报价书解析(2026-11-09 补充)。
|
|
377
|
+
*
|
|
378
|
+
* 背景:`contract.quote.parse` 原先只认 .xlsx,客户实际提交的报价书多为 .docx,
|
|
379
|
+
* 只能报错或让用户手工转格式。本文按「表头识别」而非固定表序解析,兼容
|
|
380
|
+
* 软件功能费用 / 用户授权许可 / 实施服务费用 / 费用总表四类常见表。
|
|
381
|
+
*/
|
|
382
|
+
function decodeXmlEntities(s) {
|
|
383
|
+
return s
|
|
384
|
+
.replace(/</gu, '<')
|
|
385
|
+
.replace(/>/gu, '>')
|
|
386
|
+
.replace(/"/gu, '"')
|
|
387
|
+
.replace(/'/gu, "'")
|
|
388
|
+
.replace(/&/gu, '&');
|
|
389
|
+
}
|
|
390
|
+
/** 取单元格纯文本:只认 <w:t> / <w:t xml:space="preserve">,不能写成 <w:t[^>]*>(会吞掉 <w:tcPr>)。 */
|
|
391
|
+
function cellText(fragment) {
|
|
392
|
+
const re = /<w:t(?:\s[^>]*)?>([\s\S]*?)<\/w:t>/gu;
|
|
393
|
+
const out = [];
|
|
394
|
+
let m;
|
|
395
|
+
while ((m = re.exec(fragment)) !== null)
|
|
396
|
+
out.push(m[1] ?? '');
|
|
397
|
+
return decodeXmlEntities(out.join('')).replace(/\s+/gu, ' ').trim();
|
|
398
|
+
}
|
|
399
|
+
/** 从 document.xml 提取全部表格为「行 → 单元格文本」二维数组。 */
|
|
400
|
+
export function readDocxTablesFromXml(xml) {
|
|
401
|
+
const tables = [];
|
|
402
|
+
const tblRe = /<w:tbl>[\s\S]*?<\/w:tbl>/gu;
|
|
403
|
+
let tm;
|
|
404
|
+
while ((tm = tblRe.exec(xml)) !== null) {
|
|
405
|
+
const rows = [];
|
|
406
|
+
const trRe = /<w:tr[ >][\s\S]*?<\/w:tr>/gu;
|
|
407
|
+
let rm;
|
|
408
|
+
while ((rm = trRe.exec(tm[0])) !== null) {
|
|
409
|
+
const cells = [];
|
|
410
|
+
const tcRe = /<w:tc>[\s\S]*?<\/w:tc>/gu;
|
|
411
|
+
let cm;
|
|
412
|
+
while ((cm = tcRe.exec(rm[0])) !== null)
|
|
413
|
+
cells.push(cellText(cm[0]));
|
|
414
|
+
rows.push(cells);
|
|
415
|
+
}
|
|
416
|
+
if (rows.length)
|
|
417
|
+
tables.push(rows);
|
|
418
|
+
}
|
|
419
|
+
return tables;
|
|
420
|
+
}
|
|
421
|
+
/** 表格以外的段落文本(用于客户名、有效期、备注)。 */
|
|
422
|
+
function docxParagraphs(xml) {
|
|
423
|
+
const noTbl = xml.replace(/<w:tbl>[\s\S]*?<\/w:tbl>/gu, '');
|
|
424
|
+
const re = /<w:p[ >][\s\S]*?<\/w:p>/gu;
|
|
425
|
+
const out = [];
|
|
426
|
+
let m;
|
|
427
|
+
while ((m = re.exec(noTbl)) !== null) {
|
|
428
|
+
const t = cellText(m[0]);
|
|
429
|
+
if (t)
|
|
430
|
+
out.push(t);
|
|
431
|
+
}
|
|
432
|
+
return out;
|
|
433
|
+
}
|
|
434
|
+
function numLoose(s) {
|
|
435
|
+
const t = (s ?? '').replace(/,/gu, '');
|
|
436
|
+
const m = /(-?\d+(?:\.\d+)?)/u.exec(t);
|
|
437
|
+
if (!m)
|
|
438
|
+
return null;
|
|
439
|
+
const v = Number(m[1]);
|
|
440
|
+
return Number.isFinite(v) ? v : null;
|
|
441
|
+
}
|
|
442
|
+
/** 把 Word 报价书无损提取为「表格二维数组 + 段落文本」,不做任何语义判断。 */
|
|
443
|
+
export function extractQuoteDocx(buffer) {
|
|
444
|
+
const xml = readZipEntry(buffer, 'word/document.xml');
|
|
445
|
+
if (!xml) {
|
|
446
|
+
throw contractValidationError('docx_invalid', 'Word 文件缺少 word/document.xml,可能不是合法的 .docx。');
|
|
447
|
+
}
|
|
448
|
+
const tables = readDocxTablesFromXml(xml);
|
|
449
|
+
const paragraphs = docxParagraphs(xml);
|
|
450
|
+
return {
|
|
451
|
+
kind: 'docx',
|
|
452
|
+
tables: tables.map((rows, index) => ({ index, rows })),
|
|
453
|
+
paragraphs,
|
|
454
|
+
counts: { tables: tables.length, paragraphs: paragraphs.length },
|
|
455
|
+
note: '已按原样提取表格与段落,未做语义判断。请由模型理解后产出 ParsedQuote 结构' +
|
|
456
|
+
'(meta.customer/title/validity/tax,sections[].title/items[].name/price/qty/amount/total,' +
|
|
457
|
+
'汇总表所在 section 需标 is_summary=true),再调用 contract.quote.normalize 做校验。',
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function asNumber(v) {
|
|
461
|
+
if (v === null || v === undefined || v === '')
|
|
462
|
+
return null;
|
|
463
|
+
if (typeof v === 'number')
|
|
464
|
+
return Number.isFinite(v) ? v : null;
|
|
465
|
+
return numLoose(String(v));
|
|
466
|
+
}
|
|
467
|
+
function asText(v) {
|
|
468
|
+
return typeof v === 'string' ? v.replace(/\s+/gu, ' ').trim() : v === null || v === undefined ? '' : String(v);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* 校验并归一化模型给出的报价结构。
|
|
472
|
+
*
|
|
473
|
+
* 职责边界:**只验不算语义**——不猜哪张表是什么,只检查模型给的结构是否自洽:
|
|
474
|
+
* - sections 不能为空,items 必须是数组
|
|
475
|
+
* - 金额字段统一转成 number,缺失按 price × qty 补齐
|
|
476
|
+
* - 逐节重算 sum_items 并与 total 比对;汇总表(is_summary)不参与总计
|
|
477
|
+
* - 明细求和与合计额不一致时写入 warnings,供上游决定是否需要人工核对
|
|
478
|
+
*/
|
|
479
|
+
export function normalizeParsedQuote(input) {
|
|
480
|
+
const rawSections = Array.isArray(input.sections) ? input.sections : [];
|
|
481
|
+
if (rawSections.length === 0) {
|
|
482
|
+
throw contractValidationError('quote_normalize_invalid', 'sections 为空:模型必须给出至少一节费用明细(含 title 与 items)。');
|
|
483
|
+
}
|
|
484
|
+
const sections = [];
|
|
485
|
+
const checks = [];
|
|
486
|
+
const summaryCodes = new Set();
|
|
487
|
+
let seq = 0;
|
|
488
|
+
for (const s of rawSections) {
|
|
489
|
+
seq += 1;
|
|
490
|
+
const code = asText(s.code) || `S${seq}`;
|
|
491
|
+
const title = asText(s.title) || `第 ${seq} 节`;
|
|
492
|
+
const rawItems = Array.isArray(s.items) ? s.items : [];
|
|
493
|
+
const items = [];
|
|
494
|
+
for (const it of rawItems) {
|
|
495
|
+
const name = asText(it.name);
|
|
496
|
+
const price = asNumber(it.price);
|
|
497
|
+
const qty = asNumber(it.qty);
|
|
498
|
+
let amount = asNumber(it.amount);
|
|
499
|
+
if (amount === null && price !== null)
|
|
500
|
+
amount = price * (qty ?? 1);
|
|
501
|
+
if (!name && amount === null)
|
|
502
|
+
continue;
|
|
503
|
+
items.push({
|
|
504
|
+
no: asText(it.no),
|
|
505
|
+
name,
|
|
506
|
+
way: asText(it.way),
|
|
507
|
+
desc: asText(it.desc),
|
|
508
|
+
price,
|
|
509
|
+
qty,
|
|
510
|
+
amount,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
const total = asNumber(s.total);
|
|
514
|
+
const section = { code, title, items, total };
|
|
515
|
+
section.sum_items = items.reduce((acc, i) => acc + (Number(i.amount) || 0), 0);
|
|
516
|
+
sections.push(section);
|
|
517
|
+
if (s.is_summary)
|
|
518
|
+
summaryCodes.add(code);
|
|
519
|
+
if (total !== null && section.sum_items !== total) {
|
|
520
|
+
checks.push({
|
|
521
|
+
section: `${code}、${title}`,
|
|
522
|
+
table_total: total,
|
|
523
|
+
sum_items: section.sum_items,
|
|
524
|
+
diff: section.sum_items - total,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const totalIn = (input.totals ?? {});
|
|
529
|
+
const standard = asNumber(totalIn.standard_total) ?? asNumber(totalIn.final_total) ?? undefined;
|
|
530
|
+
// 汇总表只提供合计额,不参与明细求和;否则会与合计重复计算
|
|
531
|
+
const grand = sections
|
|
532
|
+
.filter((s) => !summaryCodes.has(s.code))
|
|
533
|
+
.reduce((acc, s) => acc + (s.sum_items ?? 0), 0);
|
|
534
|
+
const totals = {
|
|
535
|
+
standard_total: standard ?? null,
|
|
536
|
+
final_total: asNumber(totalIn.final_total) ?? standard ?? null,
|
|
537
|
+
sum_items_grand: grand,
|
|
538
|
+
has_mismatch: false,
|
|
539
|
+
diff_vs_standard: standard === undefined ? null : grand - standard,
|
|
540
|
+
};
|
|
541
|
+
if (totalIn.discount !== undefined)
|
|
542
|
+
totals.discount = totalIn.discount;
|
|
543
|
+
totals.has_mismatch = checks.length > 0 || (standard !== undefined && grand !== standard);
|
|
544
|
+
const warnings = Array.isArray(input.warnings) ? input.warnings.map(asText).filter(Boolean) : [];
|
|
545
|
+
if (checks.length) {
|
|
546
|
+
warnings.push('分节明细求和与所给合计不一致,请与报价人核对:' +
|
|
547
|
+
checks
|
|
548
|
+
.map((c) => `${String(c.section)} 合计${String(c.table_total)}/明细${String(c.sum_items)}`)
|
|
549
|
+
.join(';'));
|
|
550
|
+
}
|
|
551
|
+
if (totals.diff_vs_standard) {
|
|
552
|
+
warnings.push(`全部明细求和 ${grand} 与合计额 ${String(standard)} 不一致,差额 ${String(totals.diff_vs_standard)};` +
|
|
553
|
+
'可能存在没有独立明细表的分项,请核对。');
|
|
554
|
+
}
|
|
555
|
+
const metaRaw = (input.meta ?? {});
|
|
556
|
+
const meta = {};
|
|
557
|
+
for (const [k, v] of Object.entries(metaRaw)) {
|
|
558
|
+
const t = asText(v);
|
|
559
|
+
if (t)
|
|
560
|
+
meta[k] = t;
|
|
561
|
+
}
|
|
562
|
+
if (!meta.customer) {
|
|
563
|
+
warnings.push('未从报价书中识别到客户名称(可能写法非常规)。这不代表文件未填写:'
|
|
564
|
+
+ '请由模型从原文确认客户全称后再交用户核对。');
|
|
565
|
+
}
|
|
566
|
+
return {
|
|
567
|
+
source_sheet: 'docx',
|
|
568
|
+
available_sheets: ['正文'],
|
|
569
|
+
meta,
|
|
570
|
+
totals,
|
|
571
|
+
sections,
|
|
572
|
+
checks,
|
|
573
|
+
warnings,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
// ----------------------------------------------------------------
|
|
302
577
|
// ---------------------------------------------------------------- docx 填充(字段打分)
|
|
303
578
|
const FIELD_ALIASES = {
|
|
304
579
|
party_a: ['甲方', '买方', '客户名称', '客户', '采购方', '需方', '购货方', '甲方名称', '买方名称'],
|
|
@@ -450,10 +725,105 @@ export const contractQuoteOperations = [
|
|
|
450
725
|
},
|
|
451
726
|
async execute(input) {
|
|
452
727
|
const path = resolve(String(input.path));
|
|
728
|
+
// 2026-11-09 用户定稿:报价书格式无法穷举,语义映射交给模型。
|
|
729
|
+
// .docx 到 parse 只做无损提取并明确提示走模型链路,不再由代码猜表头含义。
|
|
730
|
+
if (/\.docx$/iu.test(path)) {
|
|
731
|
+
const extracted = extractQuoteDocx(readFileSync(path));
|
|
732
|
+
return {
|
|
733
|
+
status: 'DONE',
|
|
734
|
+
data: {
|
|
735
|
+
...extracted,
|
|
736
|
+
next_step: 'Word 报价书已无损提取。请模型理解表格与段落语义后产出 meta/sections(汇总表标 is_summary=true),' +
|
|
737
|
+
'再调用 contract.quote.normalize 校验金额与结构。代码不再做表头语义映射。',
|
|
738
|
+
},
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
if (!/\.xlsx$/iu.test(path)) {
|
|
742
|
+
throw contractValidationError('file_type_unsupported', '报价单只支持 .xlsx 或 .docx;.xls / .doc 老格式请先另存为新格式。');
|
|
743
|
+
}
|
|
453
744
|
const parsed = parseQuote(readFileSync(path), input.sheet ? String(input.sheet) : null, Boolean(input.keepRemark), Boolean(input.includeZero));
|
|
454
745
|
return { status: 'DONE', data: parsed };
|
|
455
746
|
},
|
|
456
747
|
},
|
|
748
|
+
{
|
|
749
|
+
name: 'contract.quote.extract',
|
|
750
|
+
risk: 'read-with-upload',
|
|
751
|
+
inputSchema: {
|
|
752
|
+
type: 'object',
|
|
753
|
+
additionalProperties: false,
|
|
754
|
+
properties: {
|
|
755
|
+
path: { type: 'string', description: '.docx / .xlsx 报价书路径' },
|
|
756
|
+
sheet: { type: 'string', description: '.xlsx 工作表名(可选,默认第一个)' },
|
|
757
|
+
},
|
|
758
|
+
required: ['path'],
|
|
759
|
+
},
|
|
760
|
+
async execute(input) {
|
|
761
|
+
const path = resolve(String(input.path));
|
|
762
|
+
// 2026-11-11:xlsx 也必须能无损提取。xlsx 是 ZIP 内的 XML,模型无法直读,
|
|
763
|
+
// 所以「解包 + 单元格还原成文本」这层必须由代码完成;
|
|
764
|
+
// 但语义判定(客户名在哪、哪张表是汇总、税率)一律交模型。
|
|
765
|
+
if (/\.xlsx$/iu.test(path)) {
|
|
766
|
+
const buf = readFileSync(path);
|
|
767
|
+
const sheets = listSheetNames(buf);
|
|
768
|
+
const wanted = input.sheet ? String(input.sheet) : '';
|
|
769
|
+
const idx = wanted ? Math.max(0, sheets.indexOf(wanted)) : 0;
|
|
770
|
+
const grid = readGrid(buf, idx);
|
|
771
|
+
const rows = [];
|
|
772
|
+
for (let r = 1; r <= grid.maxRow; r++) {
|
|
773
|
+
const line = [];
|
|
774
|
+
const rowMap = grid.values.get(r);
|
|
775
|
+
for (let c = 1; c <= grid.maxCol; c++) {
|
|
776
|
+
line.push(rowMap?.get(c)?.text ?? '');
|
|
777
|
+
}
|
|
778
|
+
rows.push(line);
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
status: 'DONE',
|
|
782
|
+
data: {
|
|
783
|
+
kind: 'xlsx',
|
|
784
|
+
sheet: sheets[idx] ?? null,
|
|
785
|
+
sheets,
|
|
786
|
+
rows,
|
|
787
|
+
counts: {
|
|
788
|
+
rows: rows.length,
|
|
789
|
+
cols: rows.reduce((m, r) => Math.max(m, r.length), 0),
|
|
790
|
+
},
|
|
791
|
+
note: '零语义判断:只还原单元格文本。请模型读 rows 判定 meta(客户全称/日期/税率等)、'
|
|
792
|
+
+ '哪张表是汇总表(is_summary=true),产出 JSON 后交 contract.quote.normalize 校验金额。',
|
|
793
|
+
},
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
if (!/\.docx$/iu.test(path)) {
|
|
797
|
+
throw contractValidationError('file_type_unsupported', '无损提取支持 .xlsx / .docx;.xls / .doc 老格式请先另存为新格式。');
|
|
798
|
+
}
|
|
799
|
+
const extracted = extractQuoteDocx(readFileSync(path));
|
|
800
|
+
return { status: 'DONE', data: extracted };
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: 'contract.quote.normalize',
|
|
805
|
+
risk: 'read',
|
|
806
|
+
inputSchema: {
|
|
807
|
+
type: 'object',
|
|
808
|
+
additionalProperties: false,
|
|
809
|
+
properties: {
|
|
810
|
+
data: { type: 'string', description: '模型产出的报价 JSON 文件路径' },
|
|
811
|
+
},
|
|
812
|
+
required: ['data'],
|
|
813
|
+
},
|
|
814
|
+
async execute(input) {
|
|
815
|
+
const p = resolve(String(input.data));
|
|
816
|
+
let raw;
|
|
817
|
+
try {
|
|
818
|
+
raw = JSON.parse(readFileSync(p, 'utf8'));
|
|
819
|
+
}
|
|
820
|
+
catch (e) {
|
|
821
|
+
throw contractValidationError('quote_normalize_invalid', `读取模型 JSON 失败:${e instanceof Error ? e.message : String(e)}`);
|
|
822
|
+
}
|
|
823
|
+
const normalized = normalizeParsedQuote(raw);
|
|
824
|
+
return { status: 'DONE', data: normalized };
|
|
825
|
+
},
|
|
826
|
+
},
|
|
457
827
|
{
|
|
458
828
|
name: 'contract.quote.fill',
|
|
459
829
|
risk: 'read-with-upload',
|
|
@@ -530,7 +900,7 @@ export function quoteContractContracts() {
|
|
|
530
900
|
},
|
|
531
901
|
{
|
|
532
902
|
name: 'contract.quote.parse',
|
|
533
|
-
summary: '
|
|
903
|
+
summary: '解析报价单:xlsx 确定性解析;docx 仅无损提取(语义交给模型)',
|
|
534
904
|
risk: 'read-with-upload',
|
|
535
905
|
inputSchema: {
|
|
536
906
|
type: 'object', additionalProperties: false,
|
|
@@ -540,6 +910,24 @@ export function quoteContractContracts() {
|
|
|
540
910
|
}, required: ['path'],
|
|
541
911
|
},
|
|
542
912
|
},
|
|
913
|
+
{
|
|
914
|
+
name: 'contract.quote.extract',
|
|
915
|
+
summary: '把 .docx 报价书无损提取为表格与段落(零语义判断)',
|
|
916
|
+
risk: 'read-with-upload',
|
|
917
|
+
inputSchema: {
|
|
918
|
+
type: 'object', additionalProperties: false,
|
|
919
|
+
properties: { path: { type: 'string' } }, required: ['path'],
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: 'contract.quote.normalize',
|
|
924
|
+
summary: '校验并归一化模型产出的报价 JSON(结构 + 金额自校验)',
|
|
925
|
+
risk: 'read',
|
|
926
|
+
inputSchema: {
|
|
927
|
+
type: 'object', additionalProperties: false,
|
|
928
|
+
properties: { data: { type: 'string' } }, required: ['data'],
|
|
929
|
+
},
|
|
930
|
+
},
|
|
543
931
|
{
|
|
544
932
|
name: 'contract.quote.fill',
|
|
545
933
|
summary: '用真实 .docx 模板 + 数据 JSON 生成合同 docx',
|
|
@@ -5,41 +5,60 @@ import { contractClauseInsertOperations } from './clause-insert.js';
|
|
|
5
5
|
import { contractClauseLibraryOperations } from './clause-library.js';
|
|
6
6
|
import { contractClauseReferenceOperations } from './clause-reference.js';
|
|
7
7
|
import { contractCardOperations } from './card.js';
|
|
8
|
+
import { contractCardPlanOperations } from './card-plan.js';
|
|
9
|
+
import { contractCardEbdfListOperations } from './card-ebdf-list.js';
|
|
10
|
+
import { contractCardRiskReportOperations } from './card-risk-report.js';
|
|
11
|
+
import { contractCardActionOperations } from './card-action.js';
|
|
8
12
|
import { contractCompareOperations } from './compare.js';
|
|
9
13
|
import { contractCreditPageOperations } from './credit-page.js';
|
|
10
14
|
import { contractCustomerOperations } from './customer.js';
|
|
15
|
+
import { contractElementsBuildOperations } from './elements-build.js';
|
|
11
16
|
import { contractFileDownloadOperations } from './file-download.js';
|
|
17
|
+
import { contractFirstScreenOperations } from './first-screen.js';
|
|
18
|
+
import { setOperationResolver } from './op-resolver.js';
|
|
12
19
|
import { contractFlowOperations } from './flow.js';
|
|
20
|
+
import { contractModelTextOperations } from './modeltext.js';
|
|
13
21
|
import { contractPerformanceOperations } from './performance.js';
|
|
14
22
|
import { contractQuoteOperations } from './quote.js';
|
|
15
23
|
import { contractRecommendOperations } from './recommend.js';
|
|
16
24
|
import { contractRequestOperations } from './request.js';
|
|
17
25
|
import { contractReviewOperations } from './review.js';
|
|
26
|
+
import { contractSaveRecognizeOperations } from './save-recognize.js';
|
|
18
27
|
import { contractSubjectOperations } from './subject.js';
|
|
19
28
|
import { contractSummaryOperations } from './summary.js';
|
|
29
|
+
import { contractSummaryValidateOperations } from './summary-validate.js';
|
|
20
30
|
import { contractTemplateOperations } from './template.js';
|
|
21
31
|
import { contractWorkflowOperations } from './workflow.js';
|
|
22
32
|
function buildRegistry() {
|
|
23
33
|
const registry = new Map();
|
|
24
34
|
const handlers = [
|
|
25
35
|
...contractTemplateOperations,
|
|
36
|
+
...contractModelTextOperations,
|
|
26
37
|
...contractClauseLibraryOperations,
|
|
27
38
|
...contractClauseInsertOperations,
|
|
28
39
|
...contractClauseReferenceOperations,
|
|
29
40
|
...contractSubjectOperations,
|
|
30
41
|
...contractCustomerOperations,
|
|
42
|
+
...contractElementsBuildOperations,
|
|
43
|
+
...contractFirstScreenOperations,
|
|
31
44
|
...contractWorkflowOperations,
|
|
32
45
|
...contractRequestOperations,
|
|
33
46
|
...contractReviewOperations,
|
|
34
47
|
...contractFileDownloadOperations,
|
|
35
48
|
...contractFlowOperations,
|
|
49
|
+
...contractSaveRecognizeOperations,
|
|
36
50
|
...contractRecommendOperations,
|
|
37
51
|
...contractCompareOperations,
|
|
38
52
|
...contractCreditPageOperations,
|
|
39
53
|
...contractAssistantOperations,
|
|
40
54
|
...contractPerformanceOperations,
|
|
41
55
|
...contractSummaryOperations,
|
|
56
|
+
...contractSummaryValidateOperations,
|
|
42
57
|
...contractCardOperations,
|
|
58
|
+
...contractCardPlanOperations,
|
|
59
|
+
...contractCardEbdfListOperations,
|
|
60
|
+
...contractCardRiskReportOperations,
|
|
61
|
+
...contractCardActionOperations,
|
|
43
62
|
...contractQuoteOperations,
|
|
44
63
|
];
|
|
45
64
|
for (const handler of handlers) {
|
|
@@ -59,6 +78,9 @@ function buildRegistry() {
|
|
|
59
78
|
return registry;
|
|
60
79
|
}
|
|
61
80
|
const contractOperationRegistry = buildRegistry();
|
|
81
|
+
// 编排层(first-screen)需要在进程内调用其它 operation;通过 resolver 注入,
|
|
82
|
+
// 避免 registry ↔ 编排层形成循环依赖。
|
|
83
|
+
setOperationResolver(getContractOperation);
|
|
62
84
|
export function getContractOperation(operation) {
|
|
63
85
|
const handler = contractOperationRegistry.get(operation);
|
|
64
86
|
if (!handler) {
|