weaver-work-cli 0.1.48 → 0.1.50
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-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
- package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-EJYIOJPH.js} +3 -3
- package/dist/chunks/{chunk-FEP6ELMR.js → chunk-3NCFFHB2.js} +1 -1
- package/dist/chunks/chunk-5QYE52LG.js +223 -0
- package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
- package/dist/chunks/{chunk-NBEWUR7L.js → chunk-6T53BSWZ.js} +158 -44
- package/dist/chunks/{chunk-OCYRVZGN.js → chunk-7AYQJSFY.js} +2 -2
- package/dist/chunks/{chunk-5B5JXTY2.js → chunk-7ECB22G3.js} +221 -30
- package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
- package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-BFKLQLBK.js} +8 -8
- package/dist/chunks/{chunk-EFOUMXIX.js → chunk-HARQF5IP.js} +28 -28
- package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
- package/dist/chunks/chunk-JEQHNNSS.js +158 -0
- package/dist/chunks/{chunk-NK74RE5F.js → chunk-K67FODVC.js} +3 -3
- package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
- package/dist/chunks/{chunk-BCACE6VV.js → chunk-MCZG6HPM.js} +3 -3
- package/dist/chunks/{chunk-SVFG6EMV.js → chunk-RYFRGTUV.js} +5 -5
- package/dist/chunks/{chunk-PSPOFLSU.js → chunk-WNJUGI2F.js} +1 -1
- package/dist/chunks/{chunk-R2HHLJNN.js → chunk-YB3AJYPY.js} +4 -4
- package/dist/chunks/{conflict-APGSD5E7.js → conflict-C4UDHCWV.js} +2 -2
- package/dist/chunks/{contract-N6P2HIIE.js → contract-VUC6JOPG.js} +464 -9
- package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-6OG2LYBD.js} +6 -6
- package/dist/chunks/data-QO7QWOIV.js +2525 -0
- package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
- package/dist/chunks/{env-B6GKA2J3.js → env-WP57TF2S.js} +2 -2
- package/dist/chunks/{factory-MFCKLUT6.js → factory-VUXI7N5C.js} +1 -1
- package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
- package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-UQRGXILK.js} +3 -3
- package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
- package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
- package/dist/chunks/{invoice-FXWH5GPO.js → invoice-E7GOITEU.js} +1 -1
- package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-4BBLVAWM.js} +10 -10
- package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
- package/dist/chunks/org-NFE7X7FK.js +12 -0
- package/dist/chunks/{reception-VL6TKVAW.js → reception-QGPNTGHG.js} +526 -175
- package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
- package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
- package/dist/chunks/{registry-22O6UG4I.js → registry-5CRCN2TV.js} +10 -10
- package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
- package/dist/chunks/{registry-7VZ6YJUF.js → registry-V4CHRQDI.js} +1 -1
- package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-AYR3UG7R.js} +4 -4
- package/dist/chunks/{schedule-SPPAHER2.js → schedule-JZEFIXUS.js} +4 -4
- package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-3ZAF2J5E.js} +4 -4
- package/dist/index.js +16 -11
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
- package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
- package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
- package/dist/shortcuts/contract/host.js +11 -0
- package/dist/shortcuts/contract/index.js +13 -0
- package/dist/shortcuts/contract/manifest.js +53 -0
- package/dist/shortcuts/contract/operations/performance.js +58 -7
- package/dist/shortcuts/contract/operations/quote.js +283 -1
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
- package/dist/shortcuts/data/errors.js +64 -0
- package/dist/shortcuts/data/host.js +140 -0
- package/dist/shortcuts/data/index.js +429 -0
- package/dist/shortcuts/data/manifest.js +133 -0
- package/dist/shortcuts/data/operations/attend.js +62 -0
- package/dist/shortcuts/data/operations/conf.js +384 -0
- package/dist/shortcuts/data/operations/ds.js +686 -0
- package/dist/shortcuts/data/operations/field.js +68 -0
- package/dist/shortcuts/data/operations/index.js +65 -0
- package/dist/shortcuts/data/operations/module.js +383 -0
- package/dist/shortcuts/data/operations/noun.js +102 -0
- package/dist/shortcuts/data/operations/query.js +85 -0
- package/dist/shortcuts/data/operations/scene.js +235 -0
- package/dist/shortcuts/data/operations/shared.js +279 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
- 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/manifest.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/reception/constants.js +13 -6
- package/dist/shortcuts/reception/index.js +3 -1
- package/dist/shortcuts/reception/manifest.js +3 -2
- package/dist/shortcuts/reception/operations/ask.js +20 -2
- package/dist/shortcuts/reception/operations/compose.js +11 -0
- package/dist/shortcuts/reception/operations/doc.js +59 -0
- package/dist/shortcuts/reception/operations/docrender.js +25 -1
- package/dist/shortcuts/reception/operations/leads.js +31 -7
- package/dist/shortcuts/reception/operations/panels.js +86 -22
- package/dist/shortcuts/reception/operations/render.js +40 -0
- package/dist/shortcuts/reception/operations/restaurant.js +17 -4
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/workflow/operations/read.js +58 -14
- 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 +2 -1
- package/docs/_catalog.md +4 -1
- package/docs/data.md +149 -0
- package/docs/fna.md +11 -4
- package/docs/reception.md +59 -5
- package/package.json +1 -1
- package/scripts/check-skill-sync.mjs +188 -0
- package/scripts/package-skill.mjs +17 -3
- package/skill-template/business-info.json +29 -1
- package/skill-template/domains/data.md +15 -0
- package/skill-template/domains/qiyecheng.md +4 -2
- package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
- package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
- package/skills/weaver-e10-data/SKILL.md +118 -0
- package/skills/weaver-e10-data/references/config-center.md +90 -0
- package/skills/weaver-e10-data/references/datasource.md +136 -0
- package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +1 -1
- 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 +219 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +50 -30
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +24 -15
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +43 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +265 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +83 -0
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
- package/skills/weaver-e10-meeting/SKILL.md +39 -7
- package/skills/weaver-e10-qiyecheng/SKILL.md +21 -7
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +104 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +17 -3
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +136 -30
- package/skills/weaver-e10-reception-flow/SKILL.md +70 -19
- package/skills/weaver-e10-reception-flow/references/guide.md +5 -4
- package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
- package/skills/weaver-e10-recruit-stage/SKILL.md +1 -1
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +6 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
- 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/tools/todo-summary.cjs +162 -10
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +6 -45
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +5 -5
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +4 -37
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +22 -35
- 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/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
|
@@ -229,6 +229,15 @@ function contractBusinessStatus(path, value) {
|
|
|
229
229
|
}
|
|
230
230
|
return { ok: true, code: errcode2 || void 0, message: textOf(messageNode, ["errmsg", "msg"]) };
|
|
231
231
|
}
|
|
232
|
+
if (path.startsWith("/api/ai/application/smartfill/")) {
|
|
233
|
+
const code = root.code ?? messageNode.code ?? messageNode.errcode;
|
|
234
|
+
const ok2 = (code === 0 || code === "0" || code === 200 || code === "200") && root.status !== false && root.fail !== true;
|
|
235
|
+
return {
|
|
236
|
+
ok: ok2,
|
|
237
|
+
code: code === void 0 ? void 0 : String(code),
|
|
238
|
+
message: textOf(root, ["msg", "message"]) ?? textOf(messageNode, ["msg", "errmsg"])
|
|
239
|
+
};
|
|
240
|
+
}
|
|
232
241
|
const errcode = messageNode.errcode ?? root.errcode;
|
|
233
242
|
const ok = errcode === "0" || errcode === 0 || errcode === "200" || errcode === 200;
|
|
234
243
|
return { ok, code: errcode === void 0 ? void 0 : String(errcode), message: textOf(messageNode, ["errmsg", "msg"]) };
|
|
@@ -948,6 +957,22 @@ var quoteContracts = [
|
|
|
948
957
|
includeZero: { type: "boolean" }
|
|
949
958
|
}, ["path"])
|
|
950
959
|
},
|
|
960
|
+
{
|
|
961
|
+
name: "contract.quote.extract",
|
|
962
|
+
risk: "read-with-upload",
|
|
963
|
+
fixed: { local: true, kind: "docx-extract" },
|
|
964
|
+
inputSchema: readSchema({
|
|
965
|
+
path: { type: "string", minLength: 1 }
|
|
966
|
+
}, ["path"])
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
name: "contract.quote.normalize",
|
|
970
|
+
risk: "read",
|
|
971
|
+
fixed: { local: true, kind: "quote-normalize" },
|
|
972
|
+
inputSchema: readSchema({
|
|
973
|
+
data: { type: "string", minLength: 1 }
|
|
974
|
+
}, ["data"])
|
|
975
|
+
},
|
|
951
976
|
{
|
|
952
977
|
name: "contract.quote.fill",
|
|
953
978
|
risk: "read-with-upload",
|
|
@@ -1635,6 +1660,43 @@ var contractOperations = [
|
|
|
1635
1660
|
path: { type: "string", minLength: 1, maxLength: 1e3 }
|
|
1636
1661
|
}, ["flow", "path"])
|
|
1637
1662
|
},
|
|
1663
|
+
{
|
|
1664
|
+
name: "contract.flow.save-recognize-record",
|
|
1665
|
+
risk: "write",
|
|
1666
|
+
auth: AUTH,
|
|
1667
|
+
fixed: {
|
|
1668
|
+
method: "POST",
|
|
1669
|
+
path: "/api/ai/application/smartfill/data/saveRecognizeRecord",
|
|
1670
|
+
note: "\u8981\u7D20\u62BD\u53D6\u7ED3\u679C\u5148\u5B58\u6210\u8BC6\u522B\u8BB0\u5F55\uFF0C\u8FD4\u56DE\u7684 aiExtraId \u518D\u968F customParams \u4F20\u7ED9\u6D41\u7A0B\u7EC4\u4EF6"
|
|
1671
|
+
},
|
|
1672
|
+
inputSchema: readSchema({
|
|
1673
|
+
flow: {
|
|
1674
|
+
type: "string",
|
|
1675
|
+
maxLength: 64,
|
|
1676
|
+
description: "\u53EF\u9009\u6D41\u7A0B\u9884\u8BBE\uFF08\u5951\u7EA6\u9501 / \u65B0\u5BA2\u6237 / \u8001\u5BA2\u6237\u589E\u503C / \u5E38\u89C4\u4E8C\u6B21\u9500\u552E\uFF09\uFF1B\u4E5F\u53EF\u4F20\u81EA\u5B9A\u4E49\u6D41\u7A0B\u540D\uFF0C\u6B64\u65F6\u5FC5\u987B\u540C\u65F6\u7ED9 workflowId"
|
|
1677
|
+
},
|
|
1678
|
+
recognizeResult: {
|
|
1679
|
+
description: "\u8BC6\u522B\u7ED3\u679C\uFF1B\u4F20 JSON \u5BF9\u8C61\u6216\u5176\u5B57\u7B26\u4E32\u5747\u53EF\uFF0CCLI \u7EDF\u4E00\u5E8F\u5217\u5316\u4E3A\u5B57\u7B26\u4E32",
|
|
1680
|
+
anyOf: [{ type: "string" }, { type: "object" }]
|
|
1681
|
+
},
|
|
1682
|
+
attachmentIds: { type: "string", maxLength: 4e3, description: "\u672C\u6B21\u5168\u90E8\u9644\u4EF6 ID\uFF0C\u82F1\u6587\u9017\u53F7\u5206\u9694" },
|
|
1683
|
+
attachmentFieldId: {
|
|
1684
|
+
type: "string",
|
|
1685
|
+
pattern: "^[1-9]\\d*$",
|
|
1686
|
+
description: "\u5408\u540C\u6587\u4EF6\u5B57\u6BB5 ID\uFF08\u53D6\u81EA\u8BE5\u6D41\u7A0B\u8868\u5355\u5B57\u6BB5\u5B9A\u4E49\uFF09\uFF1B\u4F20\u5165\u540E\u8BE5\u5B57\u6BB5\u4E0E\u6587\u4EF6 ID \u4F1A\u4E00\u8D77\u5199\u8FDB customParams\uFF0C\u7531\u6D41\u7A0B\u7EC4\u4EF6\u56DE\u586B\u9644\u4EF6"
|
|
1687
|
+
},
|
|
1688
|
+
attachmentFileId: {
|
|
1689
|
+
type: "string",
|
|
1690
|
+
maxLength: 64,
|
|
1691
|
+
description: "\u5408\u540C\u6587\u4EF6\u7684 fileId\uFF1B\u4E0D\u4F20\u65F6\u53D6 attachmentIds \u7684\u9996\u4E2A\u6587\u4EF6"
|
|
1692
|
+
},
|
|
1693
|
+
workflowId: {
|
|
1694
|
+
type: "string",
|
|
1695
|
+
pattern: "^[1-9]\\d*$",
|
|
1696
|
+
description: "\u6D41\u7A0B\u6A21\u677F ID\uFF1B\u4E0D\u4F20\u65F6\u53D6 flow \u7684\u9884\u8BBE workflowId\u3002\u4E0E flow \u81F3\u5C11\u4F20\u4E00\u4E2A"
|
|
1697
|
+
}
|
|
1698
|
+
}, ["recognizeResult"])
|
|
1699
|
+
},
|
|
1638
1700
|
{
|
|
1639
1701
|
name: "contract.recommend.doc",
|
|
1640
1702
|
risk: "read",
|
|
@@ -7734,7 +7796,14 @@ var CONTRACT_SOURCES = {
|
|
|
7734
7796
|
|
|
7735
7797
|
// src/shortcuts/contract/operations/performance.ts
|
|
7736
7798
|
var ORIGIN_PLACEHOLDER = "{baseUrl}";
|
|
7737
|
-
var
|
|
7799
|
+
var EBDF_LIST_PAGE_IDS = {
|
|
7800
|
+
"\u76F4\u9500\u5408\u540C": "881124906081886244",
|
|
7801
|
+
"\u76F4\u9500\u4E1A\u7EE9": "846297265322576586",
|
|
7802
|
+
"\u5408\u540C\u6536\u6B3E": "846297265322576589",
|
|
7803
|
+
"\u9879\u76EE\u9A8C\u6536": "846297265322576590",
|
|
7804
|
+
"\u6E20\u9053\u8BA2\u5355": "881210951456350225",
|
|
7805
|
+
"\u6E20\u9053\u8BA2\u5355-\u5546\u52A1": "881211329321197671"
|
|
7806
|
+
};
|
|
7738
7807
|
var NULL_OPS = /* @__PURE__ */ new Set(["isNull", "isNotNull"]);
|
|
7739
7808
|
function catalog() {
|
|
7740
7809
|
return PERFORMANCE_CATALOG;
|
|
@@ -7895,22 +7964,55 @@ function buildQuery(menu, conditions, origin) {
|
|
|
7895
7964
|
warnings.push(`\u9875\u9762\u53EF\u80FD\u9ED8\u8BA4\u9650\u5236${defaultTime}\u4E3A\u5F53\u5E74\u3002\u8BF7\u7528\u6237\u6838\u5BF9\u5B9E\u9645\u8303\u56F4\uFF1B\u8981\u6C42\u5168\u90E8\u5E74\u4EFD/\u5176\u4ED6\u65F6\u95F4\u53E3\u5F84\u65F6\uFF0C\u7531\u7528\u6237\u6E05\u7A7A\u9ED8\u8BA4\u5E74\u6708\u518D\u641C\u7D22\u3002`);
|
|
7896
7965
|
}
|
|
7897
7966
|
const url = origin + route + "?" + params.map(([k, v]) => `${encodeURIComponent0(k)}=${encodeURIComponent0(v)}`).join("&");
|
|
7967
|
+
const listPageId = EBDF_LIST_PAGE_IDS[menu.name] ?? menu.list_id;
|
|
7968
|
+
if (!listPageId) {
|
|
7969
|
+
throw contractValidationError("list_page_missing", `catalog \u672A\u8BB0\u5F55\u300C${menu.name}\u300D\u7684 ebdf \u5217\u8868 pageId\uFF0C\u65E0\u6CD5\u7EC4\u4EF6\u5316\u6253\u5F00\u3002`);
|
|
7970
|
+
}
|
|
7898
7971
|
return {
|
|
7899
7972
|
menu: menu.name,
|
|
7900
7973
|
url,
|
|
7901
7974
|
filters,
|
|
7902
7975
|
needs_ui: needsUi,
|
|
7903
7976
|
warnings,
|
|
7904
|
-
|
|
7905
|
-
version: "1.0",
|
|
7906
|
-
callId: "performance-query-1",
|
|
7907
|
-
toolId: "open_web",
|
|
7908
|
-
arguments: { url, title: menu.name, activate: true, width: BROWSER_WIDTH }
|
|
7909
|
-
},
|
|
7977
|
+
card: buildEbdfListCard(menu, origin, listPageId, filters),
|
|
7910
7978
|
page_verified: false,
|
|
7911
7979
|
execution: needsUi.length ? "manual-page-filter" : "filtered-link"
|
|
7912
7980
|
};
|
|
7913
7981
|
}
|
|
7982
|
+
function buildEbdfListCard(menu, origin, listPageId, filters) {
|
|
7983
|
+
const comParams = {};
|
|
7984
|
+
for (const f of filters) {
|
|
7985
|
+
const key = typeof f.key === "string" ? f.key : "";
|
|
7986
|
+
const value = f.value;
|
|
7987
|
+
if (!/^field_\d+$/u.test(key)) continue;
|
|
7988
|
+
if (typeof value !== "string" || value === "") continue;
|
|
7989
|
+
comParams[key] = value;
|
|
7990
|
+
}
|
|
7991
|
+
const now = /* @__PURE__ */ new Date();
|
|
7992
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
7993
|
+
const callId = `ebdf-list-${menu.name}-${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}-01`;
|
|
7994
|
+
const path = `/list/${listPageId}`;
|
|
7995
|
+
return {
|
|
7996
|
+
version: 1,
|
|
7997
|
+
callId,
|
|
7998
|
+
toolId: "fill_form",
|
|
7999
|
+
arguments: {
|
|
8000
|
+
type: "e10",
|
|
8001
|
+
title: menu.name,
|
|
8002
|
+
src: `${origin}/sp/ebdfpage/list/${listPageId}`,
|
|
8003
|
+
sdkRenderType: "inline",
|
|
8004
|
+
sdkOptions: {
|
|
8005
|
+
compName: "ui.CorsComponent",
|
|
8006
|
+
routerType: "MemoryRouter",
|
|
8007
|
+
routerProps_pc: { initialEntries: [path] },
|
|
8008
|
+
routerProps_mobile: { initialEntries: [path] },
|
|
8009
|
+
params_pc: { app: "@weapp/ebdfpage", compName: "TableViewList", noMDialog: true },
|
|
8010
|
+
params_mobile: { app: "@weapp/ebdfpage", compName: "MTableViewList", noMDialog: true },
|
|
8011
|
+
params: { pageId: listPageId, comParams }
|
|
8012
|
+
}
|
|
8013
|
+
}
|
|
8014
|
+
};
|
|
8015
|
+
}
|
|
7914
8016
|
function requireOrigin(input) {
|
|
7915
8017
|
const raw = String(input.origin ?? "").trim();
|
|
7916
8018
|
if (!raw) {
|
|
@@ -8521,8 +8623,8 @@ function fillTable(tableXml, filler, log) {
|
|
|
8521
8623
|
}));
|
|
8522
8624
|
for (let ci = cells.length - 1; ci >= 0; ci--) {
|
|
8523
8625
|
const cell = cells[ci];
|
|
8524
|
-
const
|
|
8525
|
-
if (
|
|
8626
|
+
const cellText2 = paragraphFullText(cell.xml);
|
|
8627
|
+
if (cellText2 && !hasBlank(cellText2) && !hasPlaceholder(cellText2)) continue;
|
|
8526
8628
|
let label = "";
|
|
8527
8629
|
for (let j = ci - 1; j >= 0; j--) {
|
|
8528
8630
|
const cand = cells[j];
|
|
@@ -8888,6 +8990,165 @@ function parseQuote(buffer, sheetName2, keepRemark = false, includeZero = false)
|
|
|
8888
8990
|
if (!meta.customer) warnings.push("\u62A5\u4EF7\u5355\u672A\u586B\u5199\u300E\u5BA2\u6237\u540D\u79F0\u300F\uFF0C\u7B7E\u7EA6\u4E3B\u4F53\u5FC5\u987B\u7531\u7528\u6237\u63D0\u4F9B");
|
|
8889
8991
|
return { source_sheet: sheet, available_sheets: names, meta, totals, sections, checks, warnings };
|
|
8890
8992
|
}
|
|
8993
|
+
function decodeXmlEntities(s) {
|
|
8994
|
+
return s.replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, '"').replace(/'/gu, "'").replace(/&/gu, "&");
|
|
8995
|
+
}
|
|
8996
|
+
function cellText(fragment) {
|
|
8997
|
+
const re = /<w:t(?:\s[^>]*)?>([\s\S]*?)<\/w:t>/gu;
|
|
8998
|
+
const out = [];
|
|
8999
|
+
let m;
|
|
9000
|
+
while ((m = re.exec(fragment)) !== null) out.push(m[1] ?? "");
|
|
9001
|
+
return decodeXmlEntities(out.join("")).replace(/\s+/gu, " ").trim();
|
|
9002
|
+
}
|
|
9003
|
+
function readDocxTablesFromXml(xml) {
|
|
9004
|
+
const tables = [];
|
|
9005
|
+
const tblRe = /<w:tbl>[\s\S]*?<\/w:tbl>/gu;
|
|
9006
|
+
let tm;
|
|
9007
|
+
while ((tm = tblRe.exec(xml)) !== null) {
|
|
9008
|
+
const rows = [];
|
|
9009
|
+
const trRe = /<w:tr[ >][\s\S]*?<\/w:tr>/gu;
|
|
9010
|
+
let rm;
|
|
9011
|
+
while ((rm = trRe.exec(tm[0])) !== null) {
|
|
9012
|
+
const cells = [];
|
|
9013
|
+
const tcRe = /<w:tc>[\s\S]*?<\/w:tc>/gu;
|
|
9014
|
+
let cm;
|
|
9015
|
+
while ((cm = tcRe.exec(rm[0])) !== null) cells.push(cellText(cm[0]));
|
|
9016
|
+
rows.push(cells);
|
|
9017
|
+
}
|
|
9018
|
+
if (rows.length) tables.push(rows);
|
|
9019
|
+
}
|
|
9020
|
+
return tables;
|
|
9021
|
+
}
|
|
9022
|
+
function docxParagraphs(xml) {
|
|
9023
|
+
const noTbl = xml.replace(/<w:tbl>[\s\S]*?<\/w:tbl>/gu, "");
|
|
9024
|
+
const re = /<w:p[ >][\s\S]*?<\/w:p>/gu;
|
|
9025
|
+
const out = [];
|
|
9026
|
+
let m;
|
|
9027
|
+
while ((m = re.exec(noTbl)) !== null) {
|
|
9028
|
+
const t = cellText(m[0]);
|
|
9029
|
+
if (t) out.push(t);
|
|
9030
|
+
}
|
|
9031
|
+
return out;
|
|
9032
|
+
}
|
|
9033
|
+
function numLoose(s) {
|
|
9034
|
+
const t = (s ?? "").replace(/,/gu, "");
|
|
9035
|
+
const m = /(-?\d+(?:\.\d+)?)/u.exec(t);
|
|
9036
|
+
if (!m) return null;
|
|
9037
|
+
const v = Number(m[1]);
|
|
9038
|
+
return Number.isFinite(v) ? v : null;
|
|
9039
|
+
}
|
|
9040
|
+
function extractQuoteDocx(buffer) {
|
|
9041
|
+
const xml = readZipEntry(buffer, "word/document.xml");
|
|
9042
|
+
if (!xml) {
|
|
9043
|
+
throw contractValidationError("docx_invalid", "Word \u6587\u4EF6\u7F3A\u5C11 word/document.xml\uFF0C\u53EF\u80FD\u4E0D\u662F\u5408\u6CD5\u7684 .docx\u3002");
|
|
9044
|
+
}
|
|
9045
|
+
const tables = readDocxTablesFromXml(xml);
|
|
9046
|
+
const paragraphs = docxParagraphs(xml);
|
|
9047
|
+
return {
|
|
9048
|
+
kind: "docx",
|
|
9049
|
+
tables: tables.map((rows, index) => ({ index, rows })),
|
|
9050
|
+
paragraphs,
|
|
9051
|
+
counts: { tables: tables.length, paragraphs: paragraphs.length },
|
|
9052
|
+
note: "\u5DF2\u6309\u539F\u6837\u63D0\u53D6\u8868\u683C\u4E0E\u6BB5\u843D\uFF0C\u672A\u505A\u8BED\u4E49\u5224\u65AD\u3002\u8BF7\u7531\u6A21\u578B\u7406\u89E3\u540E\u4EA7\u51FA ParsedQuote \u7ED3\u6784\uFF08meta.customer/title/validity/tax\uFF0Csections[].title/items[].name/price/qty/amount/total\uFF0C\u6C47\u603B\u8868\u6240\u5728 section \u9700\u6807 is_summary=true\uFF09\uFF0C\u518D\u8C03\u7528 contract.quote.normalize \u505A\u6821\u9A8C\u3002"
|
|
9053
|
+
};
|
|
9054
|
+
}
|
|
9055
|
+
function asNumber(v) {
|
|
9056
|
+
if (v === null || v === void 0 || v === "") return null;
|
|
9057
|
+
if (typeof v === "number") return Number.isFinite(v) ? v : null;
|
|
9058
|
+
return numLoose(String(v));
|
|
9059
|
+
}
|
|
9060
|
+
function asText(v) {
|
|
9061
|
+
return typeof v === "string" ? v.replace(/\s+/gu, " ").trim() : v === null || v === void 0 ? "" : String(v);
|
|
9062
|
+
}
|
|
9063
|
+
function normalizeParsedQuote(input) {
|
|
9064
|
+
const rawSections = Array.isArray(input.sections) ? input.sections : [];
|
|
9065
|
+
if (rawSections.length === 0) {
|
|
9066
|
+
throw contractValidationError(
|
|
9067
|
+
"quote_normalize_invalid",
|
|
9068
|
+
"sections \u4E3A\u7A7A\uFF1A\u6A21\u578B\u5FC5\u987B\u7ED9\u51FA\u81F3\u5C11\u4E00\u8282\u8D39\u7528\u660E\u7EC6\uFF08\u542B title \u4E0E items\uFF09\u3002"
|
|
9069
|
+
);
|
|
9070
|
+
}
|
|
9071
|
+
const sections = [];
|
|
9072
|
+
const checks = [];
|
|
9073
|
+
const summaryCodes = /* @__PURE__ */ new Set();
|
|
9074
|
+
let seq = 0;
|
|
9075
|
+
for (const s of rawSections) {
|
|
9076
|
+
seq += 1;
|
|
9077
|
+
const code = asText(s.code) || `S${seq}`;
|
|
9078
|
+
const title = asText(s.title) || `\u7B2C ${seq} \u8282`;
|
|
9079
|
+
const rawItems = Array.isArray(s.items) ? s.items : [];
|
|
9080
|
+
const items = [];
|
|
9081
|
+
for (const it of rawItems) {
|
|
9082
|
+
const name = asText(it.name);
|
|
9083
|
+
const price = asNumber(it.price);
|
|
9084
|
+
const qty = asNumber(it.qty);
|
|
9085
|
+
let amount = asNumber(it.amount);
|
|
9086
|
+
if (amount === null && price !== null) amount = price * (qty ?? 1);
|
|
9087
|
+
if (!name && amount === null) continue;
|
|
9088
|
+
items.push({
|
|
9089
|
+
no: asText(it.no),
|
|
9090
|
+
name,
|
|
9091
|
+
way: asText(it.way),
|
|
9092
|
+
desc: asText(it.desc),
|
|
9093
|
+
price,
|
|
9094
|
+
qty,
|
|
9095
|
+
amount
|
|
9096
|
+
});
|
|
9097
|
+
}
|
|
9098
|
+
const total = asNumber(s.total);
|
|
9099
|
+
const section = { code, title, items, total };
|
|
9100
|
+
section.sum_items = items.reduce((acc, i) => acc + (Number(i.amount) || 0), 0);
|
|
9101
|
+
sections.push(section);
|
|
9102
|
+
if (s.is_summary) summaryCodes.add(code);
|
|
9103
|
+
if (total !== null && section.sum_items !== total) {
|
|
9104
|
+
checks.push({
|
|
9105
|
+
section: `${code}\u3001${title}`,
|
|
9106
|
+
table_total: total,
|
|
9107
|
+
sum_items: section.sum_items,
|
|
9108
|
+
diff: section.sum_items - total
|
|
9109
|
+
});
|
|
9110
|
+
}
|
|
9111
|
+
}
|
|
9112
|
+
const totalIn = input.totals ?? {};
|
|
9113
|
+
const standard = asNumber(totalIn.standard_total) ?? asNumber(totalIn.final_total) ?? void 0;
|
|
9114
|
+
const grand = sections.filter((s) => !summaryCodes.has(s.code)).reduce((acc, s) => acc + (s.sum_items ?? 0), 0);
|
|
9115
|
+
const totals = {
|
|
9116
|
+
standard_total: standard ?? null,
|
|
9117
|
+
final_total: asNumber(totalIn.final_total) ?? standard ?? null,
|
|
9118
|
+
sum_items_grand: grand,
|
|
9119
|
+
has_mismatch: false,
|
|
9120
|
+
diff_vs_standard: standard === void 0 ? null : grand - standard
|
|
9121
|
+
};
|
|
9122
|
+
if (totalIn.discount !== void 0) totals.discount = totalIn.discount;
|
|
9123
|
+
totals.has_mismatch = checks.length > 0 || standard !== void 0 && grand !== standard;
|
|
9124
|
+
const warnings = Array.isArray(input.warnings) ? input.warnings.map(asText).filter(Boolean) : [];
|
|
9125
|
+
if (checks.length) {
|
|
9126
|
+
warnings.push(
|
|
9127
|
+
"\u5206\u8282\u660E\u7EC6\u6C42\u548C\u4E0E\u6240\u7ED9\u5408\u8BA1\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u4E0E\u62A5\u4EF7\u4EBA\u6838\u5BF9\uFF1A" + checks.map((c) => `${String(c.section)} \u5408\u8BA1${String(c.table_total)}/\u660E\u7EC6${String(c.sum_items)}`).join("\uFF1B")
|
|
9128
|
+
);
|
|
9129
|
+
}
|
|
9130
|
+
if (totals.diff_vs_standard) {
|
|
9131
|
+
warnings.push(
|
|
9132
|
+
`\u5168\u90E8\u660E\u7EC6\u6C42\u548C ${grand} \u4E0E\u5408\u8BA1\u989D ${String(standard)} \u4E0D\u4E00\u81F4\uFF0C\u5DEE\u989D ${String(totals.diff_vs_standard)}\uFF1B\u53EF\u80FD\u5B58\u5728\u6CA1\u6709\u72EC\u7ACB\u660E\u7EC6\u8868\u7684\u5206\u9879\uFF0C\u8BF7\u6838\u5BF9\u3002`
|
|
9133
|
+
);
|
|
9134
|
+
}
|
|
9135
|
+
const metaRaw = input.meta ?? {};
|
|
9136
|
+
const meta = {};
|
|
9137
|
+
for (const [k, v] of Object.entries(metaRaw)) {
|
|
9138
|
+
const t = asText(v);
|
|
9139
|
+
if (t) meta[k] = t;
|
|
9140
|
+
}
|
|
9141
|
+
if (!meta.customer) warnings.push("\u62A5\u4EF7\u4E66\u672A\u7ED9\u51FA\u5BA2\u6237\u540D\u79F0\uFF0C\u7B7E\u7EA6\u4E3B\u4F53\u5FC5\u987B\u7531\u7528\u6237\u63D0\u4F9B");
|
|
9142
|
+
return {
|
|
9143
|
+
source_sheet: "docx",
|
|
9144
|
+
available_sheets: ["\u6B63\u6587"],
|
|
9145
|
+
meta,
|
|
9146
|
+
totals,
|
|
9147
|
+
sections,
|
|
9148
|
+
checks,
|
|
9149
|
+
warnings
|
|
9150
|
+
};
|
|
9151
|
+
}
|
|
8891
9152
|
var FIELD_ALIASES = {
|
|
8892
9153
|
party_a: ["\u7532\u65B9", "\u4E70\u65B9", "\u5BA2\u6237\u540D\u79F0", "\u5BA2\u6237", "\u91C7\u8D2D\u65B9", "\u9700\u65B9", "\u8D2D\u8D27\u65B9", "\u7532\u65B9\u540D\u79F0", "\u4E70\u65B9\u540D\u79F0"],
|
|
8893
9154
|
party_a_addr: ["\u7532\u65B9\u5730\u5740", "\u4E70\u65B9\u5730\u5740", "\u5BA2\u6237\u5730\u5740", "\u7532\u65B9\u4F4F\u6240", "\u6CE8\u518C\u5730\u5740"],
|
|
@@ -9024,6 +9285,22 @@ var contractQuoteOperations = [
|
|
|
9024
9285
|
},
|
|
9025
9286
|
async execute(input) {
|
|
9026
9287
|
const path = resolve7(String(input.path));
|
|
9288
|
+
if (/\.docx$/iu.test(path)) {
|
|
9289
|
+
const extracted = extractQuoteDocx(readFileSync6(path));
|
|
9290
|
+
return {
|
|
9291
|
+
status: "DONE",
|
|
9292
|
+
data: {
|
|
9293
|
+
...extracted,
|
|
9294
|
+
next_step: "Word \u62A5\u4EF7\u4E66\u5DF2\u65E0\u635F\u63D0\u53D6\u3002\u8BF7\u6A21\u578B\u7406\u89E3\u8868\u683C\u4E0E\u6BB5\u843D\u8BED\u4E49\u540E\u4EA7\u51FA meta/sections\uFF08\u6C47\u603B\u8868\u6807 is_summary=true\uFF09\uFF0C\u518D\u8C03\u7528 contract.quote.normalize \u6821\u9A8C\u91D1\u989D\u4E0E\u7ED3\u6784\u3002\u4EE3\u7801\u4E0D\u518D\u505A\u8868\u5934\u8BED\u4E49\u6620\u5C04\u3002"
|
|
9295
|
+
}
|
|
9296
|
+
};
|
|
9297
|
+
}
|
|
9298
|
+
if (!/\.xlsx$/iu.test(path)) {
|
|
9299
|
+
throw contractValidationError(
|
|
9300
|
+
"file_type_unsupported",
|
|
9301
|
+
"\u62A5\u4EF7\u5355\u53EA\u652F\u6301 .xlsx \u6216 .docx\uFF1B.xls / .doc \u8001\u683C\u5F0F\u8BF7\u5148\u53E6\u5B58\u4E3A\u65B0\u683C\u5F0F\u3002"
|
|
9302
|
+
);
|
|
9303
|
+
}
|
|
9027
9304
|
const parsed = parseQuote(
|
|
9028
9305
|
readFileSync6(path),
|
|
9029
9306
|
input.sheet ? String(input.sheet) : null,
|
|
@@ -9033,6 +9310,55 @@ var contractQuoteOperations = [
|
|
|
9033
9310
|
return { status: "DONE", data: parsed };
|
|
9034
9311
|
}
|
|
9035
9312
|
},
|
|
9313
|
+
{
|
|
9314
|
+
name: "contract.quote.extract",
|
|
9315
|
+
risk: "read-with-upload",
|
|
9316
|
+
inputSchema: {
|
|
9317
|
+
type: "object",
|
|
9318
|
+
additionalProperties: false,
|
|
9319
|
+
properties: {
|
|
9320
|
+
path: { type: "string", description: ".docx \u62A5\u4EF7\u4E66\u8DEF\u5F84" }
|
|
9321
|
+
},
|
|
9322
|
+
required: ["path"]
|
|
9323
|
+
},
|
|
9324
|
+
async execute(input) {
|
|
9325
|
+
const path = resolve7(String(input.path));
|
|
9326
|
+
if (!/\.docx$/iu.test(path)) {
|
|
9327
|
+
throw contractValidationError(
|
|
9328
|
+
"file_type_unsupported",
|
|
9329
|
+
"\u65E0\u635F\u63D0\u53D6\u53EA\u9488\u5BF9 .docx \u62A5\u4EF7\u4E66\uFF1B.xlsx \u7ED3\u6784\u89C4\u6574\uFF0C\u8BF7\u76F4\u63A5\u7528 contract.quote.parse\u3002"
|
|
9330
|
+
);
|
|
9331
|
+
}
|
|
9332
|
+
const extracted = extractQuoteDocx(readFileSync6(path));
|
|
9333
|
+
return { status: "DONE", data: extracted };
|
|
9334
|
+
}
|
|
9335
|
+
},
|
|
9336
|
+
{
|
|
9337
|
+
name: "contract.quote.normalize",
|
|
9338
|
+
risk: "read",
|
|
9339
|
+
inputSchema: {
|
|
9340
|
+
type: "object",
|
|
9341
|
+
additionalProperties: false,
|
|
9342
|
+
properties: {
|
|
9343
|
+
data: { type: "string", description: "\u6A21\u578B\u4EA7\u51FA\u7684\u62A5\u4EF7 JSON \u6587\u4EF6\u8DEF\u5F84" }
|
|
9344
|
+
},
|
|
9345
|
+
required: ["data"]
|
|
9346
|
+
},
|
|
9347
|
+
async execute(input) {
|
|
9348
|
+
const p = resolve7(String(input.data));
|
|
9349
|
+
let raw;
|
|
9350
|
+
try {
|
|
9351
|
+
raw = JSON.parse(readFileSync6(p, "utf8"));
|
|
9352
|
+
} catch (e) {
|
|
9353
|
+
throw contractValidationError(
|
|
9354
|
+
"quote_normalize_invalid",
|
|
9355
|
+
`\u8BFB\u53D6\u6A21\u578B JSON \u5931\u8D25\uFF1A${e instanceof Error ? e.message : String(e)}`
|
|
9356
|
+
);
|
|
9357
|
+
}
|
|
9358
|
+
const normalized = normalizeParsedQuote(raw);
|
|
9359
|
+
return { status: "DONE", data: normalized };
|
|
9360
|
+
}
|
|
9361
|
+
},
|
|
9036
9362
|
{
|
|
9037
9363
|
name: "contract.quote.fill",
|
|
9038
9364
|
risk: "read-with-upload",
|
|
@@ -9636,6 +9962,121 @@ var contractReviewOperations = [
|
|
|
9636
9962
|
}
|
|
9637
9963
|
];
|
|
9638
9964
|
|
|
9965
|
+
// src/shortcuts/contract/operations/save-recognize.ts
|
|
9966
|
+
var SAVE_RECOGNIZE_PATH = "/api/ai/application/smartfill/data/saveRecognizeRecord";
|
|
9967
|
+
var OPEN_SOURCE = "xiaoE";
|
|
9968
|
+
function asPlainObject(value, name) {
|
|
9969
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
9970
|
+
throw contractValidationError("recognize_result_invalid", `${name} \u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
|
|
9971
|
+
}
|
|
9972
|
+
return value;
|
|
9973
|
+
}
|
|
9974
|
+
function normalizeRecognizeResult(value) {
|
|
9975
|
+
let parsed;
|
|
9976
|
+
if (typeof value === "string") {
|
|
9977
|
+
const text4 = value.trim();
|
|
9978
|
+
if (!text4) throw contractValidationError("recognize_result_invalid", "recognizeResult \u4E0D\u80FD\u4E3A\u7A7A");
|
|
9979
|
+
try {
|
|
9980
|
+
parsed = asPlainObject(JSON.parse(text4), "recognizeResult");
|
|
9981
|
+
} catch (error) {
|
|
9982
|
+
if (error instanceof Error && error.name === "ContractCliError") throw error;
|
|
9983
|
+
throw contractValidationError("recognize_result_invalid", "recognizeResult \u4E0D\u662F\u5408\u6CD5 JSON");
|
|
9984
|
+
}
|
|
9985
|
+
} else {
|
|
9986
|
+
parsed = asPlainObject(value, "recognizeResult");
|
|
9987
|
+
}
|
|
9988
|
+
if (typeof parsed.isSuccess !== "boolean") {
|
|
9989
|
+
throw contractValidationError("recognize_result_invalid", "recognizeResult.isSuccess \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
9990
|
+
}
|
|
9991
|
+
const mainTable = asPlainObject(parsed.mainTable, "recognizeResult.mainTable");
|
|
9992
|
+
if (!Array.isArray(mainTable.rows)) {
|
|
9993
|
+
throw contractValidationError("recognize_result_invalid", "recognizeResult.mainTable.rows \u5FC5\u987B\u662F\u6570\u7EC4");
|
|
9994
|
+
}
|
|
9995
|
+
if (!Array.isArray(parsed.subTables)) {
|
|
9996
|
+
throw contractValidationError("recognize_result_invalid", "recognizeResult.subTables \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u65E0\u660E\u7EC6\u4F20 []\uFF09");
|
|
9997
|
+
}
|
|
9998
|
+
return JSON.stringify({ isSuccess: parsed.isSuccess, mainTable, subTables: parsed.subTables });
|
|
9999
|
+
}
|
|
10000
|
+
function extractAiExtraId(value) {
|
|
10001
|
+
const root = value ?? {};
|
|
10002
|
+
const data = root.data ?? root;
|
|
10003
|
+
const candidate = data.aiExtraId ?? data.id ?? root.aiExtraId ?? root.id;
|
|
10004
|
+
const text4 = candidate === void 0 || candidate === null ? "" : String(candidate).trim();
|
|
10005
|
+
if (!text4) {
|
|
10006
|
+
throw contractValidationError("ai_extra_id_missing", "\u4FDD\u5B58\u63A5\u53E3\u672A\u8FD4\u56DE aiExtraId\uFF0C\u4E0D\u80FD\u7EE7\u7EED\u6253\u5F00\u6D41\u7A0B\u9875");
|
|
10007
|
+
}
|
|
10008
|
+
return text4;
|
|
10009
|
+
}
|
|
10010
|
+
function resolveFlowPreset(value) {
|
|
10011
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
10012
|
+
const raw = requireNonEmptyString(value, "flow", 64).trim();
|
|
10013
|
+
const exact = FLOW_PRESETS.find((preset) => preset.key === raw || preset.label === raw);
|
|
10014
|
+
if (exact) return { key: exact.key, label: exact.label, workflowId: exact.workflowId };
|
|
10015
|
+
const fuzzy = FLOW_PRESETS.filter((preset) => raw.includes(preset.key) || preset.label.includes(raw));
|
|
10016
|
+
if (fuzzy.length === 1) {
|
|
10017
|
+
return { key: fuzzy[0].key, label: fuzzy[0].label, workflowId: fuzzy[0].workflowId };
|
|
10018
|
+
}
|
|
10019
|
+
return { key: raw, label: raw, workflowId: "" };
|
|
10020
|
+
}
|
|
10021
|
+
var contractSaveRecognizeOperations = [
|
|
10022
|
+
{
|
|
10023
|
+
name: "contract.flow.save-recognize-record",
|
|
10024
|
+
async execute(input, { host }) {
|
|
10025
|
+
const flow = resolveFlowPreset(input.flow);
|
|
10026
|
+
const explicitWorkflowId = input.workflowId === void 0 || input.workflowId === null || input.workflowId === "" ? "" : requireNonEmptyString(input.workflowId, "workflowId", 64).trim();
|
|
10027
|
+
const workflowId = explicitWorkflowId || flow?.workflowId || "";
|
|
10028
|
+
if (!workflowId) {
|
|
10029
|
+
throw contractValidationError(
|
|
10030
|
+
"workflow_id_required",
|
|
10031
|
+
"flow \u4E0E workflowId \u81F3\u5C11\u4F20\u4E00\u4E2A\uFF1B\u56DB\u7C7B\u9884\u8BBE\u4E4B\u5916\u7684\u6D41\u7A0B\uFF08\u5982\u9500\u552E\u5408\u540C\u8D77\u8349\u6D41\u7A0B\uFF09\u5FC5\u987B\u663E\u5F0F\u4F20 workflowId"
|
|
10032
|
+
);
|
|
10033
|
+
}
|
|
10034
|
+
if (!/^[1-9]\d*$/.test(workflowId)) {
|
|
10035
|
+
throw contractValidationError("workflow_id_invalid", "workflowId \u5FC5\u987B\u662F\u7EAF\u6570\u5B57\u7684\u6D41\u7A0B\u6A21\u677F ID");
|
|
10036
|
+
}
|
|
10037
|
+
const recognizeResult = normalizeRecognizeResult(input.recognizeResult);
|
|
10038
|
+
const body = { workflowId, recognizeResult };
|
|
10039
|
+
const attachmentIds = typeof input.attachmentIds === "string" ? input.attachmentIds.trim() : "";
|
|
10040
|
+
if (attachmentIds) body.attachmentIds = attachmentIds;
|
|
10041
|
+
const attachmentFieldId = input.attachmentFieldId === void 0 || input.attachmentFieldId === null || input.attachmentFieldId === "" ? "" : requireNonEmptyString(input.attachmentFieldId, "attachmentFieldId", 64).trim();
|
|
10042
|
+
if (attachmentFieldId && !/^[1-9]\d*$/.test(attachmentFieldId)) {
|
|
10043
|
+
throw contractValidationError(
|
|
10044
|
+
"attachment_field_id_invalid",
|
|
10045
|
+
"attachmentFieldId \u5FC5\u987B\u662F\u4ECE\u8868\u5355\u5B57\u6BB5\u5B9A\u4E49\u4E2D\u53D6\u5F97\u7684\u7EAF\u6570\u5B57\u5B57\u6BB5 ID"
|
|
10046
|
+
);
|
|
10047
|
+
}
|
|
10048
|
+
const explicitFileId = typeof input.attachmentFileId === "string" ? input.attachmentFileId.trim() : "";
|
|
10049
|
+
const attachmentFileId = explicitFileId || (attachmentIds ? attachmentIds.split(",")[0].trim() : "");
|
|
10050
|
+
if (attachmentFieldId && !attachmentFileId) {
|
|
10051
|
+
throw contractValidationError(
|
|
10052
|
+
"attachment_file_id_missing",
|
|
10053
|
+
"\u4F20\u4E86 attachmentFieldId \u5C31\u5FC5\u987B\u6709\u6587\u4EF6 ID\uFF1A\u8BF7\u4F20 attachmentFileId\uFF0C\u6216\u5728 attachmentIds \u91CC\u5E26\u4E0A\u672C\u6B21\u6587\u4EF6"
|
|
10054
|
+
);
|
|
10055
|
+
}
|
|
10056
|
+
const response = await host.contractRequest({
|
|
10057
|
+
method: "POST",
|
|
10058
|
+
path: SAVE_RECOGNIZE_PATH,
|
|
10059
|
+
body
|
|
10060
|
+
});
|
|
10061
|
+
const aiExtraId = extractAiExtraId(response);
|
|
10062
|
+
const customParams = { aiExtraId, openSource: OPEN_SOURCE };
|
|
10063
|
+
if (attachmentFieldId) customParams[attachmentFieldId] = attachmentFileId;
|
|
10064
|
+
return {
|
|
10065
|
+
status: "COMPLETE",
|
|
10066
|
+
data: {
|
|
10067
|
+
flow: flow?.key ?? null,
|
|
10068
|
+
flowLabel: flow?.label ?? null,
|
|
10069
|
+
workflowId,
|
|
10070
|
+
aiExtraId,
|
|
10071
|
+
attachmentFieldId: attachmentFieldId || null,
|
|
10072
|
+
attachmentFileId: attachmentFileId || null,
|
|
10073
|
+
customParams
|
|
10074
|
+
}
|
|
10075
|
+
};
|
|
10076
|
+
}
|
|
10077
|
+
}
|
|
10078
|
+
];
|
|
10079
|
+
|
|
9639
10080
|
// src/shortcuts/contract/operations/subject.ts
|
|
9640
10081
|
var contractSubjectAppOperation = new ContractReadOperation("contract.subject.app", {
|
|
9641
10082
|
method: "GET",
|
|
@@ -9979,6 +10420,7 @@ function buildRegistry() {
|
|
|
9979
10420
|
...contractReviewOperations,
|
|
9980
10421
|
...contractFileDownloadOperations,
|
|
9981
10422
|
...contractFlowOperations,
|
|
10423
|
+
...contractSaveRecognizeOperations,
|
|
9982
10424
|
...contractRecommendOperations,
|
|
9983
10425
|
...contractCompareOperations,
|
|
9984
10426
|
...contractCreditPageOperations,
|
|
@@ -10359,6 +10801,13 @@ var contractShortcut = {
|
|
|
10359
10801
|
{ flag: "--sclx <types>", description: "8 risk review (contract pre-review); 1/2/3 disabled", key: "sclx" }
|
|
10360
10802
|
]);
|
|
10361
10803
|
const flow = contract.command("flow").description("Contract flow entry commands");
|
|
10804
|
+
registerCommand(flow, "save-recognize-record", "Save extracted form elements as a recognize record and return aiExtraId", "contract.flow.save-recognize-record", [
|
|
10805
|
+
{ flag: "--flow <name>", description: "optional flow preset: \u5951\u7EA6\u9501 / \u65B0\u5BA2\u6237 / \u8001\u5BA2\u6237\u589E\u503C / \u5E38\u89C4\u4E8C\u6B21\u9500\u552E" },
|
|
10806
|
+
{ flag: "--attachment-ids <ids>", description: "comma separated attachment ids", key: "attachmentIds" },
|
|
10807
|
+
{ flag: "--attachment-field-id <id>", description: "contract file field id; its value is passed to the flow component via customParams", key: "attachmentFieldId" },
|
|
10808
|
+
{ flag: "--attachment-file-id <id>", description: "fileId for the contract file field (defaults to the first attachment id)", key: "attachmentFileId" },
|
|
10809
|
+
{ flag: "--workflow-id <id>", description: "workflow template id; required when flow is not one of the four presets", key: "workflowId" }
|
|
10810
|
+
]);
|
|
10362
10811
|
registerCommand(flow, "page", "Build the flow create page url", "contract.flow.page", [
|
|
10363
10812
|
{ flag: "--flow <name>", description: "\u5951\u7EA6\u9501 / \u65B0\u5BA2\u6237 / \u8001\u5BA2\u6237\u589E\u503C / \u5E38\u89C4\u4E8C\u6B21\u9500\u552E", key: "flow" }
|
|
10364
10813
|
]);
|
|
@@ -10478,6 +10927,12 @@ var contractShortcut = {
|
|
|
10478
10927
|
{ flag: "--keep-remark", description: "keep remark column", key: "keepRemark", kind: "bool" },
|
|
10479
10928
|
{ flag: "--include-zero", description: "keep zero-qty/amount items", key: "includeZero", kind: "bool" }
|
|
10480
10929
|
]);
|
|
10930
|
+
registerCommand(quote, "extract", "Extract .docx quote into tables/paragraphs (no semantics)", "contract.quote.extract", [
|
|
10931
|
+
{ flag: "--path <file>", description: "quote docx path", key: "path" }
|
|
10932
|
+
]);
|
|
10933
|
+
registerCommand(quote, "normalize", "Validate and normalize model-produced quote JSON", "contract.quote.normalize", [
|
|
10934
|
+
{ flag: "--data <file>", description: "model JSON path", key: "data" }
|
|
10935
|
+
]);
|
|
10481
10936
|
registerCommand(quote, "fill", "Fill a real .docx contract template with data JSON", "contract.quote.fill", [
|
|
10482
10937
|
{ flag: "--template <file>", description: "real contract template docx", key: "template" },
|
|
10483
10938
|
{ flag: "--data <file>", description: "data JSON path", key: "data" },
|
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
resolveWorkflowId,
|
|
23
23
|
shapeBrowserValues,
|
|
24
24
|
shouldAutoPickFlow
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-HARQF5IP.js";
|
|
26
|
+
import "./chunk-RYFRGTUV.js";
|
|
27
|
+
import "./chunk-YB3AJYPY.js";
|
|
28
|
+
import "./chunk-WNJUGI2F.js";
|
|
29
|
+
import "./chunk-3NCFFHB2.js";
|
|
30
|
+
import "./chunk-K67FODVC.js";
|
|
31
31
|
import "./chunk-7BDPM5ST.js";
|
|
32
32
|
import "./chunk-UG5G54VL.js";
|
|
33
33
|
import "./chunk-BUSC6UAE.js";
|