weaver-work-cli 0.1.47 → 0.1.48
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-BBDP7AKJ.js → archive-oa-EDJDU3V4.js} +454 -5
- package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-4KSNBPRO.js} +3 -3
- package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
- package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
- package/dist/chunks/{chunk-76H3IKH6.js → chunk-5B5JXTY2.js} +35 -35
- package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
- package/dist/chunks/{chunk-4RWS2YYL.js → chunk-BCACE6VV.js} +2 -2
- package/dist/chunks/{chunk-AD46OMQK.js → chunk-EFOUMXIX.js} +119 -44
- package/dist/chunks/{chunk-IRMIEDXN.js → chunk-FEP6ELMR.js} +1 -1
- package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
- package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
- package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-NK74RE5F.js} +2 -2
- package/dist/chunks/{chunk-GSZTA43P.js → chunk-OCYRVZGN.js} +2 -2
- package/dist/chunks/{chunk-OXHHJWNC.js → chunk-PSPOFLSU.js} +1 -1
- package/dist/chunks/{chunk-6AXKWFKG.js → chunk-R2HHLJNN.js} +4 -4
- package/dist/chunks/{chunk-PSOMGA3U.js → chunk-SVFG6EMV.js} +35 -6
- package/dist/chunks/{chunk-IP4CWQCF.js → chunk-WMSAWAWZ.js} +8 -8
- package/dist/chunks/{conflict-H7EHQXYY.js → conflict-APGSD5E7.js} +2 -2
- package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
- package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-5TXFOC7X.js} +6 -6
- package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
- package/dist/chunks/{env-66FPSJDV.js → env-B6GKA2J3.js} +2 -2
- package/dist/chunks/{factory-UH2TZBVA.js → factory-MFCKLUT6.js} +1 -1
- package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-YE7WIBFO.js} +3 -3
- package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
- package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
- package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
- package/dist/chunks/{meeting-VTBFW4HI.js → meeting-RYZV2JTQ.js} +10 -10
- package/dist/chunks/{reception-5WITA44R.js → reception-VL6TKVAW.js} +480 -26
- package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-ERZD3ZNB.js} +52 -16
- package/dist/chunks/{registry-JVQBLFQ5.js → registry-22O6UG4I.js} +10 -10
- package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
- package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
- package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-IMZPJMYB.js} +4 -4
- package/dist/chunks/{schedule-IDETODCA.js → schedule-SPPAHER2.js} +4 -4
- package/dist/chunks/{workflow-BSYT5TGL.js → workflow-WVEFJ6KC.js} +2 -2
- package/dist/core/refs.js +19 -2
- package/dist/index.js +14 -14
- package/dist/shortcuts/archive-oa/constants.js +42 -0
- package/dist/shortcuts/archive-oa/host.js +2 -2
- package/dist/shortcuts/archive-oa/index.js +38 -0
- package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
- package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
- package/dist/shortcuts/archive-oa/operations/registry.js +5 -3
- package/dist/shortcuts/contract/index.js +9 -1
- package/dist/shortcuts/contract/manifest.js +14 -2
- package/dist/shortcuts/contract/operations/card.js +231 -0
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/review.js +16 -5
- package/dist/shortcuts/contract/operations/summary.js +25 -17
- package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +17 -8
- package/dist/shortcuts/ehr/recruit-stage/shared.js +33 -8
- package/dist/shortcuts/im/index.js +128 -0
- package/dist/shortcuts/im/operations/session.js +6 -0
- package/dist/shortcuts/invoice/host.js +0 -3
- package/dist/shortcuts/invoice/manifest.js +0 -1
- package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
- package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
- package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
- package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
- package/dist/shortcuts/reception/host.js +33 -1
- package/dist/shortcuts/reception/index.js +19 -0
- package/dist/shortcuts/reception/manifest.js +53 -1
- package/dist/shortcuts/reception/operations/ask.js +18 -0
- package/dist/shortcuts/reception/operations/compose.js +113 -3
- package/dist/shortcuts/reception/operations/leads.js +245 -0
- package/dist/shortcuts/reception/operations/markdown.js +22 -0
- package/dist/shortcuts/reception/operations/registry.js +2 -0
- package/dist/shortcuts/reception/operations/render.js +36 -3
- package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
- package/dist/shortcuts/reception/operations/restaurant.js +251 -0
- package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
- package/dist/shortcuts/reception/operations/schedule.js +7 -1
- package/dist/shortcuts/reception/upload.js +22 -6
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +17 -8
- package/dist/shortcuts/recruit-stage/shared.js +42 -14
- package/docs/archive-oa.md +4 -2
- package/package.json +1 -1
- package/skill-template/domains/archive-oa.md +2 -1
- package/skill-template/master-skill-template.md +1 -0
- package/skill-template/skill-template.md +1 -0
- package/skills/weaver-e10-archive-oa/SKILL.md +33 -6
- package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
- package/skills/weaver-e10-archive-oa/references/contract-search.md +32 -0
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
- package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +22 -0
- package/skills/weaver-e10-calendar/SKILL.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
- package/skills/weaver-e10-cowork/SKILL.md +9 -6
- package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
- package/skills/weaver-e10-jucailin/SKILL.md +7 -4
- package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
- package/skills/weaver-e10-mail/SKILL.md +17 -4
- package/skills/weaver-e10-meeting/SKILL.md +94 -409
- package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
- package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
- package/skills/weaver-e10-reception-flow/SKILL.md +62 -18
- package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
- package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
- package/skills/weaver-e10-reception-flow/scripts/render.py +81 -2
- package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +58 -8
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +127 -0
- package/skills/weaver-e10-shijingran/SKILL.md +6 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
- package/skills/weaver-e10-workflow/SKILL.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
- package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-I5ZIX4WO.js} +3 -3
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
|
@@ -897,6 +897,21 @@ var quoteContracts = [
|
|
|
897
897
|
["data", "out"]
|
|
898
898
|
)
|
|
899
899
|
},
|
|
900
|
+
{
|
|
901
|
+
name: "contract.card.render",
|
|
902
|
+
risk: "local-file-write",
|
|
903
|
+
fixed: { local: true, kind: "card-render" },
|
|
904
|
+
inputSchema: readSchema(
|
|
905
|
+
{
|
|
906
|
+
data: { type: "string", minLength: 1, maxLength: 4096, description: "\u5361\u7247\u6570\u636E JSON \u6587\u4EF6\u8DEF\u5F84\uFF08cards \u6570\u7EC4 + title/width/hint\uFF09" },
|
|
907
|
+
out: { type: "string", minLength: 1, maxLength: 4096, description: "\u8F93\u51FA\u5361\u7247 HTML \u7EDD\u5BF9\u8DEF\u5F84\uFF08\u5373 customParams.html \u5185\u5BB9\uFF09" },
|
|
908
|
+
summary: { type: "string", minLength: 1, maxLength: 4096, description: "\u53EF\u9009\uFF1A\u6458\u8981\u6570\u636E JSON \u8DEF\u5F84\uFF0C\u6E32\u67D3\u540E\u5185\u5D4C\u4E3A artifact \u52A8\u4F5C\u7684\u5185\u5BB9" },
|
|
909
|
+
browsertool: { type: "string", minLength: 1, maxLength: 4096, description: "\u53EF\u9009\uFF1A\u540C\u65F6\u8F93\u51FA\u5B8C\u6574 browsertool JSON \u7684\u8DEF\u5F84" },
|
|
910
|
+
baseUrl: { type: "string", minLength: 1, maxLength: 2048, description: "\u53EF\u9009\uFF1A\u5F53\u524D E10 \u73AF\u5883\u5730\u5740\uFF0C\u7F3A\u7701\u53D6\u767B\u5F55\u4F1A\u8BDD" }
|
|
911
|
+
},
|
|
912
|
+
["data", "out"]
|
|
913
|
+
)
|
|
914
|
+
},
|
|
900
915
|
{
|
|
901
916
|
name: "contract.file.download",
|
|
902
917
|
risk: "local-file-write",
|
|
@@ -1575,11 +1590,11 @@ var contractOperations = [
|
|
|
1575
1590
|
method: "POST",
|
|
1576
1591
|
path: "/api/ebd/contract/ai/getAiReviewRecord",
|
|
1577
1592
|
aiId: "1326842382967570463",
|
|
1578
|
-
defaults: { sclx: "
|
|
1593
|
+
defaults: { sclx: "8" }
|
|
1579
1594
|
},
|
|
1580
1595
|
inputSchema: readSchema({
|
|
1581
1596
|
fileId: { type: "string", minLength: 1, maxLength: 64 },
|
|
1582
|
-
sclx: { type: "string", pattern: "^
|
|
1597
|
+
sclx: { type: "string", pattern: "^8$" }
|
|
1583
1598
|
}, ["fileId"])
|
|
1584
1599
|
},
|
|
1585
1600
|
{
|
|
@@ -2434,7 +2449,7 @@ var AI_MARKS = [
|
|
|
2434
2449
|
"termComponent",
|
|
2435
2450
|
"keywordComponent"
|
|
2436
2451
|
];
|
|
2437
|
-
var sleep = (ms) => new Promise((
|
|
2452
|
+
var sleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
2438
2453
|
function dataOf(value) {
|
|
2439
2454
|
return value?.data ?? {};
|
|
2440
2455
|
}
|
|
@@ -4818,25 +4833,388 @@ var contractClauseReferenceOperations = [
|
|
|
4818
4833
|
contractClauseReferenceSaveApplyOperation
|
|
4819
4834
|
];
|
|
4820
4835
|
|
|
4836
|
+
// src/shortcuts/contract/operations/card.ts
|
|
4837
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
4838
|
+
import { basename as basename3, resolve as resolve4 } from "node:path";
|
|
4839
|
+
|
|
4840
|
+
// src/shortcuts/contract/operations/summary.ts
|
|
4841
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4842
|
+
import { basename as basename2, resolve as resolve3 } from "node:path";
|
|
4843
|
+
var CSS = [
|
|
4844
|
+
"body{margin:0;padding:24px 20px;background:#f5f7fa;color:#1f2430;",
|
|
4845
|
+
'font-family:"Microsoft YaHei","PingFang SC",sans-serif;font-size:14px;line-height:1.65}',
|
|
4846
|
+
".w{max-width:1040px;margin:0 auto}",
|
|
4847
|
+
".hd,.s{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:18px 20px;margin-bottom:14px}",
|
|
4848
|
+
".bd{display:inline-block;padding:3px 14px;border-radius:16px;background:#1d6fd8;color:#fff;",
|
|
4849
|
+
"font-size:13px;font-weight:700}",
|
|
4850
|
+
"h1{font-size:19px;margin:10px 0 6px;line-height:1.4}",
|
|
4851
|
+
".mt{color:#5b6577;font-size:12px}",
|
|
4852
|
+
"h2{font-size:15px;margin:0 0 12px;padding-left:9px;border-left:4px solid #1d6fd8}",
|
|
4853
|
+
"g{display:grid;grid-template-columns:150px 1fr;border-top:1px solid #e6ebf2}",
|
|
4854
|
+
"g>div{padding:8px 10px;border-bottom:1px solid #e6ebf2}",
|
|
4855
|
+
"g>.k{background:#f8fafc;color:#46506a;font-weight:600}",
|
|
4856
|
+
"ul{margin:0;padding-left:20px}li{margin-bottom:4px}",
|
|
4857
|
+
"table{border-collapse:collapse;width:100%;font-size:13px}",
|
|
4858
|
+
"th,td{border:1px solid #dde3ec;padding:7px 9px}",
|
|
4859
|
+
"th{background:#eef3fb;text-align:left;white-space:nowrap}",
|
|
4860
|
+
"td.n{text-align:right}",
|
|
4861
|
+
"tr.t td{background:#f7f9fc;font-weight:700}",
|
|
4862
|
+
".na{color:#98a2b3}",
|
|
4863
|
+
".wn{background:#fff8e6;border:1px solid #f2d48a;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
4864
|
+
".er{background:#fdeceb;border:1px solid #f0b4ae;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
4865
|
+
".ok{background:#f1f9f2;border:1px solid #b7dfc0;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
4866
|
+
".nt{color:#7a8497;font-size:12px;margin:6px 0 0}"
|
|
4867
|
+
].join("");
|
|
4868
|
+
function esc(value) {
|
|
4869
|
+
return String(value ?? "").replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">");
|
|
4870
|
+
}
|
|
4871
|
+
function asArray2(value) {
|
|
4872
|
+
return Array.isArray(value) ? value : [];
|
|
4873
|
+
}
|
|
4874
|
+
function sectionHtml(section) {
|
|
4875
|
+
const type = String(section.type ?? "");
|
|
4876
|
+
const title = section.title ? `<h2>${esc(section.title)}</h2>` : "";
|
|
4877
|
+
if (type === "alert") {
|
|
4878
|
+
const level = section.level === "error" ? "er" : "wn";
|
|
4879
|
+
return `<div class="s">${title}<div class="${level}">${esc(section.text)}</div></div>`;
|
|
4880
|
+
}
|
|
4881
|
+
const parts = [`<div class="s">${title}`];
|
|
4882
|
+
if (type === "reasons") {
|
|
4883
|
+
if (section.lead) parts.push(`<p style="margin:0 0 8px">${esc(section.lead)}</p>`);
|
|
4884
|
+
const items = asArray2(section.items);
|
|
4885
|
+
if (items.length) {
|
|
4886
|
+
parts.push(`<ul>${items.map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`);
|
|
4887
|
+
}
|
|
4888
|
+
} else if (type === "grid") {
|
|
4889
|
+
const rows = asArray2(section.rows);
|
|
4890
|
+
parts.push("<g>");
|
|
4891
|
+
for (const row of rows) {
|
|
4892
|
+
const cells = asArray2(row);
|
|
4893
|
+
parts.push(`<div class="k">${esc(cells[0])}</div><div>${esc(cells[1])}</div>`);
|
|
4894
|
+
}
|
|
4895
|
+
parts.push("</g>");
|
|
4896
|
+
} else if (type === "table") {
|
|
4897
|
+
const headers = asArray2(section.headers);
|
|
4898
|
+
const rightAlign = section.align === "right";
|
|
4899
|
+
parts.push("<table><thead><tr>");
|
|
4900
|
+
parts.push(headers.map((header) => `<th>${esc(header)}</th>`).join(""));
|
|
4901
|
+
parts.push("</tr></thead><tbody>");
|
|
4902
|
+
for (const row of asArray2(section.rows)) {
|
|
4903
|
+
const cells = asArray2(row);
|
|
4904
|
+
parts.push("<tr>");
|
|
4905
|
+
cells.forEach((cell, index) => {
|
|
4906
|
+
const cls = rightAlign && index > 0 ? ' class="n"' : "";
|
|
4907
|
+
parts.push(`<td${cls}>${esc(cell)}</td>`);
|
|
4908
|
+
});
|
|
4909
|
+
parts.push("</tr>");
|
|
4910
|
+
}
|
|
4911
|
+
const total = asArray2(section.total);
|
|
4912
|
+
if (total.length) {
|
|
4913
|
+
const span = Math.max(0, headers.length - 1);
|
|
4914
|
+
parts.push('<tr class="t">');
|
|
4915
|
+
if (span > 0) parts.push(`<td colspan="${span}">${esc(total[0])}</td>`);
|
|
4916
|
+
parts.push(`<td class="n">${esc(total[total.length - 1])}</td>`);
|
|
4917
|
+
parts.push("</tr>");
|
|
4918
|
+
}
|
|
4919
|
+
parts.push("</tbody></table>");
|
|
4920
|
+
if (section.note) parts.push(`<p class="nt">${esc(section.note)}</p>`);
|
|
4921
|
+
} else if (type === "checks") {
|
|
4922
|
+
const ok = asArray2(section.ok);
|
|
4923
|
+
const warn = asArray2(section.warn);
|
|
4924
|
+
if (ok.length) parts.push(`<div class="ok">\u2705 ${esc(ok.join("\uFF1B"))}</div>`);
|
|
4925
|
+
if (warn.length) parts.push(`<div class="wn">\u26A0 ${esc(warn.join("\uFF1B"))}</div>`);
|
|
4926
|
+
} else if (type === "list") {
|
|
4927
|
+
const items = asArray2(section.items);
|
|
4928
|
+
if (items.length) {
|
|
4929
|
+
parts.push(`<ul>${items.map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`);
|
|
4930
|
+
}
|
|
4931
|
+
if (section.note) parts.push(`<p class="nt">${esc(section.note)}</p>`);
|
|
4932
|
+
} else if (type === "next") {
|
|
4933
|
+
parts.push(`<p style="margin:0">${esc(section.text)}</p>`);
|
|
4934
|
+
parts.push('<p class="nt">\u672C\u6458\u8981\u57FA\u4E8E\u5408\u540C\u6B63\u6587\u89E3\u6790\u751F\u6210\uFF0C\u4E0D\u6784\u6210\u6CD5\u5F8B\u5BA1\u67E5\u610F\u89C1\u3002</p>');
|
|
4935
|
+
} else if (section.text) {
|
|
4936
|
+
parts.push(`<p>${esc(section.text)}</p>`);
|
|
4937
|
+
}
|
|
4938
|
+
parts.push("</div>");
|
|
4939
|
+
return parts.join("");
|
|
4940
|
+
}
|
|
4941
|
+
var SECTION_TYPES = ["alert", "reasons", "grid", "table", "checks", "list", "next"];
|
|
4942
|
+
function renderSummaryHtml(data) {
|
|
4943
|
+
const sections = asArray2(data.sections);
|
|
4944
|
+
if (sections.length === 0) {
|
|
4945
|
+
throw contractValidationError("sections_required", "\u6458\u8981\u6570\u636E\u5FC5\u987B\u5305\u542B\u975E\u7A7A\u7684 sections \u6570\u7EC4");
|
|
4946
|
+
}
|
|
4947
|
+
const unknownTypes = sections.map((section) => String(section?.type ?? "")).filter((type) => !SECTION_TYPES.includes(type));
|
|
4948
|
+
if (unknownTypes.length) {
|
|
4949
|
+
throw contractValidationError(
|
|
4950
|
+
"section_type_unknown",
|
|
4951
|
+
`\u672A\u77E5\u7684 section \u7C7B\u578B\uFF1A${[...new Set(unknownTypes)].join(", ")}\uFF1B\u652F\u6301 ${SECTION_TYPES.join(" / ")}`
|
|
4952
|
+
);
|
|
4953
|
+
}
|
|
4954
|
+
const badge = esc(data.badge ?? "\u5408\u540C");
|
|
4955
|
+
const title = esc(data.title ?? "\u5408\u540C\u6458\u8981");
|
|
4956
|
+
const meta = esc(data.meta ?? "");
|
|
4957
|
+
const body = sections.map((section) => sectionHtml(section)).join("");
|
|
4958
|
+
return `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>\u5408\u540C\u6458\u8981 - ${title}</title><style>${CSS}</style></head><body><div class="w"><div class="hd"><span class="bd">${badge}</span><h1>${title}</h1><div class="mt">${meta}</div></div>${body}</div></body></html>`;
|
|
4959
|
+
}
|
|
4960
|
+
var contractSummaryOperations = [
|
|
4961
|
+
{
|
|
4962
|
+
name: "contract.summary.render",
|
|
4963
|
+
async execute(input) {
|
|
4964
|
+
const dataPath = resolve3(requireNonEmptyString(input.data, "data", 4096).trim());
|
|
4965
|
+
const outPath = resolve3(requireNonEmptyString(input.out, "out", 4096).trim());
|
|
4966
|
+
let data;
|
|
4967
|
+
try {
|
|
4968
|
+
const raw = readFileSync3(dataPath, "utf8").replace(/^\uFEFF/u, "");
|
|
4969
|
+
const parsed = JSON.parse(raw);
|
|
4970
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
4971
|
+
throw new Error("summary data must be an object");
|
|
4972
|
+
}
|
|
4973
|
+
data = parsed;
|
|
4974
|
+
} catch (error) {
|
|
4975
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4976
|
+
throw contractValidationError("data_unreadable", `\u65E0\u6CD5\u8BFB\u53D6\u6458\u8981\u6570\u636E JSON\uFF1A${message}`);
|
|
4977
|
+
}
|
|
4978
|
+
const sections = asArray2(data.sections);
|
|
4979
|
+
const html = renderSummaryHtml(data);
|
|
4980
|
+
writeFileSync2(outPath, html, "utf8");
|
|
4981
|
+
const bytes = Buffer.byteLength(html, "utf8");
|
|
4982
|
+
return {
|
|
4983
|
+
status: "COMPLETE",
|
|
4984
|
+
data: {
|
|
4985
|
+
output: outPath,
|
|
4986
|
+
fileName: basename2(outPath),
|
|
4987
|
+
fileSize: bytes,
|
|
4988
|
+
sectionCount: sections.length,
|
|
4989
|
+
sectionTypes: sections.map((section) => String(section.type)),
|
|
4990
|
+
note: "HTML \u7531 CLI \u6309\u56FA\u5B9A\u6A21\u677F\u6E32\u67D3\uFF1B\u6A21\u578B\u53EA\u9700\u63D0\u4F9B\u7D27\u51D1\u6570\u636E JSON"
|
|
4991
|
+
}
|
|
4992
|
+
};
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
];
|
|
4996
|
+
|
|
4997
|
+
// src/shortcuts/contract/operations/card.ts
|
|
4998
|
+
var CARD_SCRIPT = `(function(){
|
|
4999
|
+
var root=document.getElementById('__UID__');
|
|
5000
|
+
if(!root){return;}
|
|
5001
|
+
var st=root.querySelector('[data-status]');
|
|
5002
|
+
function say(m){if(st){st.textContent=m;}}
|
|
5003
|
+
function plug(){
|
|
5004
|
+
if(window.xiaoePlugin){return window.xiaoePlugin;}
|
|
5005
|
+
if(window.rawWindow&&window.rawWindow.xiaoePlugin){return window.rawWindow.xiaoePlugin;}
|
|
5006
|
+
return null;
|
|
5007
|
+
}
|
|
5008
|
+
var wrap=document.createElement('div');
|
|
5009
|
+
root.insertBefore(wrap,st);
|
|
5010
|
+
var cards=[];
|
|
5011
|
+
var cb=root.querySelector('[data-cards]');
|
|
5012
|
+
try{cards=JSON.parse(cb?cb.value:'[]');}catch(e){cards=[];}
|
|
5013
|
+
var ICON={send:'📧',shield:'🛡',search:'🔍',doc:'📋',compare:'🔄',calc:'📊',link:'🔗'};
|
|
5014
|
+
function run(c){
|
|
5015
|
+
var a=c.action||{};
|
|
5016
|
+
if(a.type==='sendQuestion'){
|
|
5017
|
+
var ps=plug();
|
|
5018
|
+
if(!ps||!ps.session||typeof ps.session.sendQuestion!=='function'){say('\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u53D1\u9001\u4F1A\u8BDD\u6D88\u606F');return;}
|
|
5019
|
+
try{ps.session.sendQuestion({question:a.question||c.title||'',files:[]});say('\u5DF2\u53D1\u9001\uFF0C\u6B63\u5728\u5904\u7406');}
|
|
5020
|
+
catch(e){say('\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5');}
|
|
5021
|
+
return;
|
|
5022
|
+
}
|
|
5023
|
+
var p=plug();
|
|
5024
|
+
if(!p||!p.rightPanel||typeof p.rightPanel.open!=='function'){say('\u5F53\u524D\u73AF\u5883\u6CA1\u6709\u5C0Fe\u53F3\u4FA7\u9762\u677F');return;}
|
|
5025
|
+
var cfg={};
|
|
5026
|
+
if(a.type==='e10Sdk'){
|
|
5027
|
+
var prm={app:a.app,compName:a.comp};
|
|
5028
|
+
if(a.companyName){prm.companyName=a.companyName;}
|
|
5029
|
+
if(a.customParams){prm.customParams=a.customParams;}
|
|
5030
|
+
cfg.type='e10Sdk';
|
|
5031
|
+
cfg.width=a.width||1300;
|
|
5032
|
+
cfg.contentProps={src:a.src,sdkOptions:{compName:'ui.CorsComponent',routerType:'MemoryRouter',routerProps:{initialEntries:a.entries},params:prm}};
|
|
5033
|
+
}else if(a.type==='artifact'){
|
|
5034
|
+
var sb=root.querySelector('[data-summary]');
|
|
5035
|
+
var h=sb?sb.value:'';
|
|
5036
|
+
if(!h){say('\u6458\u8981\u5185\u5BB9\u4E3A\u7A7A');return;}
|
|
5037
|
+
cfg.type='artifact';
|
|
5038
|
+
cfg.width=a.width||760;
|
|
5039
|
+
cfg.contentProps={initialArtifactKeys:['summary-1'],artifacts:[{id:'summary-1',name:'\u5408\u540C\u6458\u8981.html',fileType:'html',raw:{html:h}}]};
|
|
5040
|
+
}else{say('\u4E0D\u652F\u6301\u7684\u52A8\u4F5C\u7C7B\u578B');return;}
|
|
5041
|
+
try{p.rightPanel.open(cfg);say('\u5DF2\u6253\u5F00');}catch(e){say('\u9762\u677F\u6253\u5F00\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u53F3\u4FA7\u9762\u677F');}
|
|
5042
|
+
}
|
|
5043
|
+
for(var i=0;i<cards.length;i++){
|
|
5044
|
+
(function(c){
|
|
5045
|
+
var b=document.createElement('button');
|
|
5046
|
+
b.type='button';
|
|
5047
|
+
b.setAttribute('data-act',c.id||('act'+i));
|
|
5048
|
+
b.style.cssText='width:100%;box-sizing:border-box;text-align:left;font-family:inherit;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e3e6eb;border-radius:10px;padding:16px;margin-bottom:12px;cursor:pointer';
|
|
5049
|
+
var ic=document.createElement('span');
|
|
5050
|
+
ic.style.cssText='flex:0 0 auto;width:44px;height:44px;border-radius:10px;background:#eef4ff;display:flex;align-items:center;justify-content:center;font-size:20px';
|
|
5051
|
+
ic.innerHTML=ICON[c.icon]||ICON.doc;
|
|
5052
|
+
var tx=document.createElement('span');
|
|
5053
|
+
tx.style.cssText='min-width:0';
|
|
5054
|
+
var t1=document.createElement('span');
|
|
5055
|
+
t1.style.cssText='display:block;margin-bottom:6px;font-size:15px;font-weight:700;color:#1f2329';
|
|
5056
|
+
t1.textContent=c.title||'';
|
|
5057
|
+
if(c.recommended){
|
|
5058
|
+
var bd=document.createElement('span');
|
|
5059
|
+
bd.style.cssText='font-size:11px;color:#fff;background:#1a56b8;border-radius:999px;padding:2px 10px;margin-left:8px';
|
|
5060
|
+
bd.textContent='\u63A8\u8350';
|
|
5061
|
+
t1.appendChild(bd);
|
|
5062
|
+
}
|
|
5063
|
+
var t2=document.createElement('span');
|
|
5064
|
+
t2.style.cssText='display:block;font-size:13px;color:#5c6570;line-height:1.5';
|
|
5065
|
+
t2.textContent=c.desc||'';
|
|
5066
|
+
tx.appendChild(t1);tx.appendChild(t2);
|
|
5067
|
+
b.appendChild(ic);b.appendChild(tx);
|
|
5068
|
+
b.addEventListener('click',function(){run(c);});
|
|
5069
|
+
b.addEventListener('mouseenter',function(){b.style.borderColor='#1a56b8';});
|
|
5070
|
+
b.addEventListener('mouseleave',function(){b.style.borderColor='#e3e6eb';});
|
|
5071
|
+
wrap.appendChild(b);
|
|
5072
|
+
})(cards[i]);
|
|
5073
|
+
}
|
|
5074
|
+
say('\u5171 '+cards.length+' \u4E2A\u53EF\u6267\u884C\u64CD\u4F5C');
|
|
5075
|
+
})();`;
|
|
5076
|
+
function escAttr(value) {
|
|
5077
|
+
return String(value ?? "").replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/'/gu, "'");
|
|
5078
|
+
}
|
|
5079
|
+
function textareaRaw(value) {
|
|
5080
|
+
return value.replace(/&/gu, "&").replace(/"/gu, """).replace(/<\/textarea/giu, "</textarea");
|
|
5081
|
+
}
|
|
5082
|
+
function makeUid() {
|
|
5083
|
+
const now = /* @__PURE__ */ new Date();
|
|
5084
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
5085
|
+
const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}`;
|
|
5086
|
+
const rand = Math.random().toString(36).slice(2, 6);
|
|
5087
|
+
return `card-${stamp}-${rand}`;
|
|
5088
|
+
}
|
|
5089
|
+
function readJsonObject(path, label) {
|
|
5090
|
+
let raw;
|
|
5091
|
+
try {
|
|
5092
|
+
raw = readFileSync4(path, "utf8").replace(/^\uFEFF/u, "");
|
|
5093
|
+
} catch (error) {
|
|
5094
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5095
|
+
throw contractValidationError("data_unreadable", `\u65E0\u6CD5\u8BFB\u53D6${label} JSON\uFF1A${message}`);
|
|
5096
|
+
}
|
|
5097
|
+
let parsed;
|
|
5098
|
+
try {
|
|
5099
|
+
parsed = JSON.parse(raw);
|
|
5100
|
+
} catch (error) {
|
|
5101
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5102
|
+
throw contractValidationError("data_unreadable", `\u65E0\u6CD5\u89E3\u6790${label} JSON\uFF1A${message}`);
|
|
5103
|
+
}
|
|
5104
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
5105
|
+
throw contractValidationError("data_unreadable", `${label}\u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
|
|
5106
|
+
}
|
|
5107
|
+
return parsed;
|
|
5108
|
+
}
|
|
5109
|
+
var contractCardOperations = [
|
|
5110
|
+
{
|
|
5111
|
+
name: "contract.card.render",
|
|
5112
|
+
async execute(input, context) {
|
|
5113
|
+
const dataPath = resolve4(requireNonEmptyString(input.data, "data", 4096).trim());
|
|
5114
|
+
const outPath = resolve4(requireNonEmptyString(input.out, "out", 4096).trim());
|
|
5115
|
+
const data = readJsonObject(dataPath, "\u5361\u7247\u6570\u636E");
|
|
5116
|
+
const cards = Array.isArray(data.cards) ? data.cards : [];
|
|
5117
|
+
if (cards.length === 0) {
|
|
5118
|
+
throw contractValidationError("cards_required", "\u5361\u7247\u6570\u636E\u5FC5\u987B\u5305\u542B\u975E\u7A7A\u7684 cards \u6570\u7EC4");
|
|
5119
|
+
}
|
|
5120
|
+
let summaryHtml = "";
|
|
5121
|
+
if (input.summary) {
|
|
5122
|
+
const summaryPath = resolve4(requireNonEmptyString(input.summary, "summary", 4096).trim());
|
|
5123
|
+
summaryHtml = renderSummaryHtml(readJsonObject(summaryPath, "\u6458\u8981\u6570\u636E"));
|
|
5124
|
+
}
|
|
5125
|
+
let baseUrl = input.baseUrl ? requireNonEmptyString(input.baseUrl, "baseUrl", 2048).trim() : "";
|
|
5126
|
+
if (!baseUrl) {
|
|
5127
|
+
const session = await context.host.getSession();
|
|
5128
|
+
baseUrl = String(session?.baseUrl ?? "").trim();
|
|
5129
|
+
}
|
|
5130
|
+
baseUrl = baseUrl.replace(/\/+$/u, "");
|
|
5131
|
+
if (!baseUrl) {
|
|
5132
|
+
throw contractValidationError("base_url_missing", "\u65E0\u6CD5\u786E\u5B9A\u5F53\u524D E10 \u73AF\u5883\u5730\u5740\uFF0C\u8BF7\u663E\u5F0F\u4F20\u5165 baseUrl");
|
|
5133
|
+
}
|
|
5134
|
+
const uid = typeof data.id === "string" && data.id.trim() ? data.id.trim() : makeUid();
|
|
5135
|
+
const hint = typeof data.hint === "string" ? data.hint.trim() : "";
|
|
5136
|
+
const title = typeof data.title === "string" && data.title.trim() ? data.title.trim() : "\u53EF\u6267\u884C\u64CD\u4F5C";
|
|
5137
|
+
const width = typeof data.width === "number" && data.width > 0 ? data.width : 1300;
|
|
5138
|
+
const cardsJson = JSON.stringify(cards);
|
|
5139
|
+
const script = CARD_SCRIPT.replace(/__UID__/gu, uid);
|
|
5140
|
+
const parts = [];
|
|
5141
|
+
parts.push(`<section id='${escAttr(uid)}' style='padding:4px 2px;font-family:Microsoft YaHei,PingFang SC,sans-serif'>`);
|
|
5142
|
+
if (hint) {
|
|
5143
|
+
parts.push(`<div style='background:#eef4ff;border:1px solid #d6e4ff;border-radius:8px;padding:10px 12px;margin-bottom:12px;font-size:12.5px;color:#1d39c4;line-height:1.6'>${escAttr(hint)}</div>`);
|
|
5144
|
+
}
|
|
5145
|
+
parts.push(`<p data-status aria-live='polite' style='margin:8px 0 0;color:#b45309;font-size:12px;line-height:1.6'></p>`);
|
|
5146
|
+
parts.push(`<textarea data-cards style='display:none'>${textareaRaw(cardsJson)}</textarea>`);
|
|
5147
|
+
if (summaryHtml) {
|
|
5148
|
+
parts.push(`<textarea data-summary style='display:none'>${textareaRaw(summaryHtml)}</textarea>`);
|
|
5149
|
+
}
|
|
5150
|
+
parts.push(`</section><script>${script}</script>`);
|
|
5151
|
+
const html = parts.join("");
|
|
5152
|
+
writeFileSync3(outPath, html, "utf8");
|
|
5153
|
+
const bytes = Buffer.byteLength(html, "utf8");
|
|
5154
|
+
let browsertoolPath = "";
|
|
5155
|
+
if (input.browsertool) {
|
|
5156
|
+
browsertoolPath = resolve4(requireNonEmptyString(input.browsertool, "browsertool", 4096).trim());
|
|
5157
|
+
const browsertool = {
|
|
5158
|
+
version: 1,
|
|
5159
|
+
callId: typeof data.callId === "string" && data.callId.trim() ? data.callId.trim() : `${uid}-01`,
|
|
5160
|
+
toolId: "fill_form",
|
|
5161
|
+
arguments: {
|
|
5162
|
+
type: "e10",
|
|
5163
|
+
title,
|
|
5164
|
+
src: `${baseUrl}/sp/contract/xiaoe-custom-page`,
|
|
5165
|
+
width,
|
|
5166
|
+
sdkRenderType: "inline",
|
|
5167
|
+
sdkOptions: {
|
|
5168
|
+
compName: "ui.CorsComponent",
|
|
5169
|
+
routerType: "MemoryRouter",
|
|
5170
|
+
routerProps_pc: { initialEntries: ["/sp/contract/xiaoe-custom-page"] },
|
|
5171
|
+
params_pc: {
|
|
5172
|
+
app: "@weapp/contract",
|
|
5173
|
+
compName: "xiaoeCustomPage",
|
|
5174
|
+
customParams: { html }
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
};
|
|
5179
|
+
writeFileSync3(browsertoolPath, JSON.stringify(browsertool), "utf8");
|
|
5180
|
+
}
|
|
5181
|
+
return {
|
|
5182
|
+
status: "COMPLETE",
|
|
5183
|
+
data: {
|
|
5184
|
+
output: outPath,
|
|
5185
|
+
fileName: basename3(outPath),
|
|
5186
|
+
fileSize: bytes,
|
|
5187
|
+
uid,
|
|
5188
|
+
cardCount: cards.length,
|
|
5189
|
+
cardIds: cards.map((card) => String(card?.id ?? "")),
|
|
5190
|
+
summaryEmbedded: Boolean(summaryHtml),
|
|
5191
|
+
browsertool: browsertoolPath || void 0,
|
|
5192
|
+
note: "HTML \u4E0E browsertool JSON \u5747\u7531 CLI \u751F\u6210\uFF1B\u6A21\u578B\u4E0D\u8981\u518D\u624B\u5199\u5361\u7247 HTML"
|
|
5193
|
+
}
|
|
5194
|
+
};
|
|
5195
|
+
}
|
|
5196
|
+
}
|
|
5197
|
+
];
|
|
5198
|
+
|
|
4821
5199
|
// src/shortcuts/contract/operations/upload.ts
|
|
4822
5200
|
import { createHash as createHash3 } from "node:crypto";
|
|
4823
5201
|
import { readFile as readFile4, stat } from "node:fs/promises";
|
|
4824
|
-
import { basename as
|
|
5202
|
+
import { basename as basename4, resolve as resolve6 } from "node:path";
|
|
4825
5203
|
|
|
4826
5204
|
// src/shortcuts/contract/upload-cache.ts
|
|
4827
5205
|
import { createHash as createHash2 } from "node:crypto";
|
|
4828
5206
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
4829
5207
|
import { homedir as homedir2 } from "node:os";
|
|
4830
|
-
import { dirname as dirname2, resolve as
|
|
5208
|
+
import { dirname as dirname2, resolve as resolve5 } from "node:path";
|
|
4831
5209
|
var CACHE_VERSION = 1;
|
|
4832
5210
|
var MAX_ENTRIES = 200;
|
|
4833
5211
|
var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
4834
5212
|
function cacheRoot() {
|
|
4835
|
-
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME ||
|
|
4836
|
-
return
|
|
5213
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve5(homedir2(), ".weaver-work-cli");
|
|
5214
|
+
return resolve5(home, "contract");
|
|
4837
5215
|
}
|
|
4838
5216
|
function cacheFilePath() {
|
|
4839
|
-
return
|
|
5217
|
+
return resolve5(cacheRoot(), "upload-cache.json");
|
|
4840
5218
|
}
|
|
4841
5219
|
function ttlMs() {
|
|
4842
5220
|
const raw = process.env.WEAVER_CONTRACT_UPLOAD_CACHE_TTL_MS;
|
|
@@ -4917,7 +5295,7 @@ function pickFileId(payload) {
|
|
|
4917
5295
|
return text(payload.fileid) ?? text(payload.fileId) ?? text(payload.uploadModuleDto?.fileid) ?? text(payload.uploadModuleDto?.fileId);
|
|
4918
5296
|
}
|
|
4919
5297
|
async function uploadFile(host, options) {
|
|
4920
|
-
const absolutePath =
|
|
5298
|
+
const absolutePath = resolve6(options.path);
|
|
4921
5299
|
const info = await stat(absolutePath).catch(() => null);
|
|
4922
5300
|
if (!info || !info.isFile()) {
|
|
4923
5301
|
throw contractValidationError("file_not_found", `\u6587\u4EF6\u4E0D\u5B58\u5728\u6216\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${options.path}`);
|
|
@@ -4928,7 +5306,7 @@ async function uploadFile(host, options) {
|
|
|
4928
5306
|
if (info.size > MAX_FILE_BYTES) {
|
|
4929
5307
|
throw contractValidationError("file_too_large", `\u6587\u4EF6\u8D85\u8FC7 ${MAX_FILE_BYTES / 1024 / 1024}MB \u4E0A\u9650\uFF1A${options.path}`);
|
|
4930
5308
|
}
|
|
4931
|
-
const name =
|
|
5309
|
+
const name = basename4(absolutePath);
|
|
4932
5310
|
const buffer = await readFile4(absolutePath);
|
|
4933
5311
|
const md5 = createHash3("md5").update(buffer).digest("hex");
|
|
4934
5312
|
const modified = String(Math.trunc(info.mtimeMs));
|
|
@@ -5692,7 +6070,7 @@ var BROWSER_COMPLETE_PATH = "/api/ebuilder/form/common/browser/complete/ebuilder
|
|
|
5692
6070
|
var CUSTOMER_FIELD_NAME_HINTS = ["\u5BA2\u6237\u540D\u79F0", "\u6700\u7EC8\u7528\u6237\u540D\u79F0", "\u6700\u7EC8\u7528\u6237", "\u5BA2\u6237"];
|
|
5693
6071
|
var CUSTOMER_BROWSER_COMPONENTS = /* @__PURE__ */ new Set(["ebuilder", "customer", "browser"]);
|
|
5694
6072
|
var DEFAULT_PAGE_SIZE2 = 20;
|
|
5695
|
-
function
|
|
6073
|
+
function asArray3(value) {
|
|
5696
6074
|
return Array.isArray(value) ? value.filter((item) => item && typeof item === "object") : [];
|
|
5697
6075
|
}
|
|
5698
6076
|
function toCustomerField(field) {
|
|
@@ -5745,11 +6123,11 @@ function resolveCustomerField(fields, input) {
|
|
|
5745
6123
|
}
|
|
5746
6124
|
function extractRows(value) {
|
|
5747
6125
|
const data = (value ?? {}).data;
|
|
5748
|
-
if (Array.isArray(data)) return
|
|
6126
|
+
if (Array.isArray(data)) return asArray3(data);
|
|
5749
6127
|
if (data && typeof data === "object") {
|
|
5750
6128
|
const root = data;
|
|
5751
6129
|
for (const key of ["data", "list", "rows", "datas"]) {
|
|
5752
|
-
const rows =
|
|
6130
|
+
const rows = asArray3(root[key]);
|
|
5753
6131
|
if (rows.length) return rows;
|
|
5754
6132
|
if (Array.isArray(root[key])) return rows;
|
|
5755
6133
|
}
|
|
@@ -8000,11 +8378,11 @@ function requireApiPrefix(value) {
|
|
|
8000
8378
|
}
|
|
8001
8379
|
|
|
8002
8380
|
// src/shortcuts/contract/operations/quote.ts
|
|
8003
|
-
import { basename as
|
|
8004
|
-
import { existsSync as existsSync2, readFileSync as
|
|
8381
|
+
import { basename as basename5, resolve as resolve7 } from "node:path";
|
|
8382
|
+
import { existsSync as existsSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
8005
8383
|
|
|
8006
8384
|
// src/shortcuts/contract/ooxml/docx.ts
|
|
8007
|
-
import { readFileSync as
|
|
8385
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
8008
8386
|
var PLACEHOLDER_SOURCE = "\\{\\{[^}]{1,60}\\}\\}|\\$\\{[^}]{1,60}\\}|\u3010[^\u3011]{1,60}\u3011";
|
|
8009
8387
|
var BLANK_SOURCE = "_{2,}|\uFF3F{2,}|\u3010\\s*\u3011|\\{\\s*\\}";
|
|
8010
8388
|
function hasPlaceholder(text4) {
|
|
@@ -8240,7 +8618,7 @@ function formatAmount(v) {
|
|
|
8240
8618
|
function readDocumentXml(templatePath) {
|
|
8241
8619
|
let buffer;
|
|
8242
8620
|
try {
|
|
8243
|
-
buffer =
|
|
8621
|
+
buffer = readFileSync5(templatePath);
|
|
8244
8622
|
} catch {
|
|
8245
8623
|
throw new Error(
|
|
8246
8624
|
"\u5408\u540C\u6A21\u677F\u7F3A\u5931\uFF1A\u5FC5\u987B\u5148\u53D6\u5230\u771F\u5B9E\u7684 .docx \u6A21\u677F\u624D\u80FD\u751F\u6210\u5408\u540C\u3002\u53D6\u4E0D\u5230\u5C31\u505C\u6B62\u5E76\u8BF7\u7528\u6237\u63D0\u4F9B\u6A21\u677F\u6587\u4EF6\uFF1B\u7981\u6B62\u628A\u62A5\u4EF7\u5355\u5185\u5BB9\u76F4\u63A5\u751F\u6210\u6210\u4E00\u4EFD\u5408\u540C\u3002"
|
|
@@ -8590,7 +8968,7 @@ function makeFiller(data) {
|
|
|
8590
8968
|
};
|
|
8591
8969
|
}
|
|
8592
8970
|
function assertContractDocument2(path) {
|
|
8593
|
-
const absolute =
|
|
8971
|
+
const absolute = resolve7(path);
|
|
8594
8972
|
if (!/\.(docx)$/iu.test(absolute)) {
|
|
8595
8973
|
throw contractValidationError("bad_document", "\u53EA\u652F\u6301 .docx \u6A21\u677F\uFF1B.doc \u8001\u683C\u5F0F\u8BF7\u5148\u53E6\u5B58\u4E3A .docx\u3002");
|
|
8596
8974
|
}
|
|
@@ -8621,8 +8999,8 @@ var contractQuoteOperations = [
|
|
|
8621
8999
|
required: ["path"]
|
|
8622
9000
|
},
|
|
8623
9001
|
async execute(input) {
|
|
8624
|
-
const path =
|
|
8625
|
-
const sheets = listSheetNames(
|
|
9002
|
+
const path = resolve7(String(input.path));
|
|
9003
|
+
const sheets = listSheetNames(readFileSync6(path));
|
|
8626
9004
|
if (!sheets.length) throw contractValidationError("xlsx_invalid", "xlsx \u4E2D\u6CA1\u6709\u5DE5\u4F5C\u8868\u3002");
|
|
8627
9005
|
return {
|
|
8628
9006
|
status: "DONE",
|
|
@@ -8645,9 +9023,9 @@ var contractQuoteOperations = [
|
|
|
8645
9023
|
required: ["path"]
|
|
8646
9024
|
},
|
|
8647
9025
|
async execute(input) {
|
|
8648
|
-
const path =
|
|
9026
|
+
const path = resolve7(String(input.path));
|
|
8649
9027
|
const parsed = parseQuote(
|
|
8650
|
-
|
|
9028
|
+
readFileSync6(path),
|
|
8651
9029
|
input.sheet ? String(input.sheet) : null,
|
|
8652
9030
|
Boolean(input.keepRemark),
|
|
8653
9031
|
Boolean(input.includeZero)
|
|
@@ -8680,7 +9058,7 @@ var contractQuoteOperations = [
|
|
|
8680
9058
|
}
|
|
8681
9059
|
let data;
|
|
8682
9060
|
try {
|
|
8683
|
-
data = JSON.parse(
|
|
9061
|
+
data = JSON.parse(readFileSync6(resolve7(String(input.data)), "utf8"));
|
|
8684
9062
|
} catch (error) {
|
|
8685
9063
|
throw contractValidationError("bad_data", `\u6570\u636E JSON \u65E0\u6CD5\u8BFB\u53D6\u6216\u89E3\u6790\uFF1A${error instanceof Error ? error.message : String(error)}`);
|
|
8686
9064
|
}
|
|
@@ -8691,19 +9069,19 @@ var contractQuoteOperations = [
|
|
|
8691
9069
|
sections: data["__sections"] ?? void 0,
|
|
8692
9070
|
amount: data["amount"] ?? null
|
|
8693
9071
|
});
|
|
8694
|
-
const out =
|
|
8695
|
-
|
|
9072
|
+
const out = resolve7(String(input.out));
|
|
9073
|
+
writeFileSync4(out, buffer);
|
|
8696
9074
|
const response = {
|
|
8697
9075
|
out,
|
|
8698
|
-
template:
|
|
9076
|
+
template: basename5(template),
|
|
8699
9077
|
filled_count: result.filled.length,
|
|
8700
9078
|
filled: result.filled,
|
|
8701
9079
|
unfilled: result.unfilled,
|
|
8702
9080
|
warning: result.unfilled.length > 0 ? "\u5B58\u5728\u672A\u586B\u5145\u5360\u4F4D/\u7A7A\u767D\uFF1A\u8BF7\u628A unfilled \u5217\u8868\u7ED9\u7528\u6237\u786E\u8BA4\uFF0C\u7F3A\u7684\u4FE1\u606F\u8BA9\u7528\u6237\u8865\u5145\u540E\u518D\u586B\uFF0C\u4E0D\u8981\u7F16\u9020\u3002" : null
|
|
8703
9081
|
};
|
|
8704
9082
|
if (input.mapOut) {
|
|
8705
|
-
|
|
8706
|
-
response.map_out =
|
|
9083
|
+
writeFileSync4(resolve7(String(input.mapOut)), JSON.stringify({ filled: result.filled, unfilled: result.unfilled }, null, 2), "utf8");
|
|
9084
|
+
response.map_out = resolve7(String(input.mapOut));
|
|
8707
9085
|
}
|
|
8708
9086
|
return { status: "DONE", data: response };
|
|
8709
9087
|
}
|
|
@@ -9097,7 +9475,7 @@ var AI_REVIEW_PREWARM_FLOW_ID = "1269716062340284522";
|
|
|
9097
9475
|
var PREWARM_PATH = "/api/ebd/contract/ai/saveInternalRecord";
|
|
9098
9476
|
var PREWARM_TIMEOUT_MS = 3e4;
|
|
9099
9477
|
var MAX_FILES = 10;
|
|
9100
|
-
var
|
|
9478
|
+
var CONTRACT_REVIEW_SCLX = "8";
|
|
9101
9479
|
async function prewarmOne(host, fileId) {
|
|
9102
9480
|
try {
|
|
9103
9481
|
await host.contractRequest({
|
|
@@ -9122,9 +9500,12 @@ async function prewarmAll(host, fileIds) {
|
|
|
9122
9500
|
return Promise.all(fileIds.map((fileId) => prewarmOne(host, fileId)));
|
|
9123
9501
|
}
|
|
9124
9502
|
function normalizeSclx(value) {
|
|
9125
|
-
if (value === void 0 || value === null || value === "") return
|
|
9126
|
-
if (typeof value !== "string" ||
|
|
9127
|
-
throw contractValidationError(
|
|
9503
|
+
if (value === void 0 || value === null || value === "") return CONTRACT_REVIEW_SCLX;
|
|
9504
|
+
if (typeof value !== "string" || value !== CONTRACT_REVIEW_SCLX) {
|
|
9505
|
+
throw contractValidationError(
|
|
9506
|
+
"sclx_invalid",
|
|
9507
|
+
`\u5408\u540C\u9884\u5BA1\u53EA\u8D70\u98CE\u9669\u5BA1\u67E5\uFF0Csclx \u56FA\u5B9A\u4E3A "${CONTRACT_REVIEW_SCLX}"\uFF1B\u5185\u63A7/\u6CD5\u5BA1/\u7EA0\u9519\uFF081/2/3\uFF09\u5165\u53E3\u5DF2\u5C4F\u853D`
|
|
9508
|
+
);
|
|
9128
9509
|
}
|
|
9129
9510
|
return value;
|
|
9130
9511
|
}
|
|
@@ -9232,10 +9613,11 @@ var contractReviewOperations = [
|
|
|
9232
9613
|
async execute(input, { host }) {
|
|
9233
9614
|
const fileId = requireNonEmptyString(input.fileId, "fileId", 64);
|
|
9234
9615
|
const sclx = normalizeSclx(input.sclx);
|
|
9616
|
+
const flowId = input.flowId === void 0 || input.flowId === null || input.flowId === "" ? AI_REVIEW_PREWARM_FLOW_ID : requireNonEmptyString(input.flowId, "flowId", 64);
|
|
9235
9617
|
const value = await host.contractRequest({
|
|
9236
9618
|
method: "POST",
|
|
9237
9619
|
path: "/api/ebd/contract/ai/getAiReviewRecord",
|
|
9238
|
-
body: { sclx, fileId
|
|
9620
|
+
body: { flowId, sclx, fileId },
|
|
9239
9621
|
timeoutMs: 12e4
|
|
9240
9622
|
});
|
|
9241
9623
|
const records = collectRecords(value);
|
|
@@ -9414,159 +9796,6 @@ var contractSubjectOperations = [
|
|
|
9414
9796
|
contractSubjectCreateApplyOperation
|
|
9415
9797
|
];
|
|
9416
9798
|
|
|
9417
|
-
// src/shortcuts/contract/operations/summary.ts
|
|
9418
|
-
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
9419
|
-
import { basename as basename4, resolve as resolve6 } from "node:path";
|
|
9420
|
-
var CSS = [
|
|
9421
|
-
"body{margin:0;padding:24px 20px;background:#f5f7fa;color:#1f2430;",
|
|
9422
|
-
'font-family:"Microsoft YaHei","PingFang SC",sans-serif;font-size:14px;line-height:1.65}',
|
|
9423
|
-
".w{max-width:1040px;margin:0 auto}",
|
|
9424
|
-
".hd,.s{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:18px 20px;margin-bottom:14px}",
|
|
9425
|
-
".bd{display:inline-block;padding:3px 14px;border-radius:16px;background:#1d6fd8;color:#fff;",
|
|
9426
|
-
"font-size:13px;font-weight:700}",
|
|
9427
|
-
"h1{font-size:19px;margin:10px 0 6px;line-height:1.4}",
|
|
9428
|
-
".mt{color:#5b6577;font-size:12px}",
|
|
9429
|
-
"h2{font-size:15px;margin:0 0 12px;padding-left:9px;border-left:4px solid #1d6fd8}",
|
|
9430
|
-
"g{display:grid;grid-template-columns:150px 1fr;border-top:1px solid #e6ebf2}",
|
|
9431
|
-
"g>div{padding:8px 10px;border-bottom:1px solid #e6ebf2}",
|
|
9432
|
-
"g>.k{background:#f8fafc;color:#46506a;font-weight:600}",
|
|
9433
|
-
"ul{margin:0;padding-left:20px}li{margin-bottom:4px}",
|
|
9434
|
-
"table{border-collapse:collapse;width:100%;font-size:13px}",
|
|
9435
|
-
"th,td{border:1px solid #dde3ec;padding:7px 9px}",
|
|
9436
|
-
"th{background:#eef3fb;text-align:left;white-space:nowrap}",
|
|
9437
|
-
"td.n{text-align:right}",
|
|
9438
|
-
"tr.t td{background:#f7f9fc;font-weight:700}",
|
|
9439
|
-
".na{color:#98a2b3}",
|
|
9440
|
-
".wn{background:#fff8e6;border:1px solid #f2d48a;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
9441
|
-
".er{background:#fdeceb;border:1px solid #f0b4ae;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
9442
|
-
".ok{background:#f1f9f2;border:1px solid #b7dfc0;border-radius:6px;padding:10px 12px;margin-bottom:10px}",
|
|
9443
|
-
".nt{color:#7a8497;font-size:12px;margin:6px 0 0}"
|
|
9444
|
-
].join("");
|
|
9445
|
-
function esc(value) {
|
|
9446
|
-
return String(value ?? "").replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">");
|
|
9447
|
-
}
|
|
9448
|
-
function asArray3(value) {
|
|
9449
|
-
return Array.isArray(value) ? value : [];
|
|
9450
|
-
}
|
|
9451
|
-
function sectionHtml(section) {
|
|
9452
|
-
const type = String(section.type ?? "");
|
|
9453
|
-
const title = section.title ? `<h2>${esc(section.title)}</h2>` : "";
|
|
9454
|
-
if (type === "alert") {
|
|
9455
|
-
const level = section.level === "error" ? "er" : "wn";
|
|
9456
|
-
return `<div class="s">${title}<div class="${level}">${esc(section.text)}</div></div>`;
|
|
9457
|
-
}
|
|
9458
|
-
const parts = [`<div class="s">${title}`];
|
|
9459
|
-
if (type === "reasons") {
|
|
9460
|
-
if (section.lead) parts.push(`<p style="margin:0 0 8px">${esc(section.lead)}</p>`);
|
|
9461
|
-
const items = asArray3(section.items);
|
|
9462
|
-
if (items.length) {
|
|
9463
|
-
parts.push(`<ul>${items.map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`);
|
|
9464
|
-
}
|
|
9465
|
-
} else if (type === "grid") {
|
|
9466
|
-
const rows = asArray3(section.rows);
|
|
9467
|
-
parts.push("<g>");
|
|
9468
|
-
for (const row of rows) {
|
|
9469
|
-
const cells = asArray3(row);
|
|
9470
|
-
parts.push(`<div class="k">${esc(cells[0])}</div><div>${esc(cells[1])}</div>`);
|
|
9471
|
-
}
|
|
9472
|
-
parts.push("</g>");
|
|
9473
|
-
} else if (type === "table") {
|
|
9474
|
-
const headers = asArray3(section.headers);
|
|
9475
|
-
const rightAlign = section.align === "right";
|
|
9476
|
-
parts.push("<table><thead><tr>");
|
|
9477
|
-
parts.push(headers.map((header) => `<th>${esc(header)}</th>`).join(""));
|
|
9478
|
-
parts.push("</tr></thead><tbody>");
|
|
9479
|
-
for (const row of asArray3(section.rows)) {
|
|
9480
|
-
const cells = asArray3(row);
|
|
9481
|
-
parts.push("<tr>");
|
|
9482
|
-
cells.forEach((cell, index) => {
|
|
9483
|
-
const cls = rightAlign && index > 0 ? ' class="n"' : "";
|
|
9484
|
-
parts.push(`<td${cls}>${esc(cell)}</td>`);
|
|
9485
|
-
});
|
|
9486
|
-
parts.push("</tr>");
|
|
9487
|
-
}
|
|
9488
|
-
const total = asArray3(section.total);
|
|
9489
|
-
if (total.length) {
|
|
9490
|
-
const span = Math.max(0, headers.length - 1);
|
|
9491
|
-
parts.push('<tr class="t">');
|
|
9492
|
-
if (span > 0) parts.push(`<td colspan="${span}">${esc(total[0])}</td>`);
|
|
9493
|
-
parts.push(`<td class="n">${esc(total[total.length - 1])}</td>`);
|
|
9494
|
-
parts.push("</tr>");
|
|
9495
|
-
}
|
|
9496
|
-
parts.push("</tbody></table>");
|
|
9497
|
-
if (section.note) parts.push(`<p class="nt">${esc(section.note)}</p>`);
|
|
9498
|
-
} else if (type === "checks") {
|
|
9499
|
-
const ok = asArray3(section.ok);
|
|
9500
|
-
const warn = asArray3(section.warn);
|
|
9501
|
-
if (ok.length) parts.push(`<div class="ok">\u2705 ${esc(ok.join("\uFF1B"))}</div>`);
|
|
9502
|
-
if (warn.length) parts.push(`<div class="wn">\u26A0 ${esc(warn.join("\uFF1B"))}</div>`);
|
|
9503
|
-
} else if (type === "list") {
|
|
9504
|
-
const items = asArray3(section.items);
|
|
9505
|
-
if (items.length) {
|
|
9506
|
-
parts.push(`<ul>${items.map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`);
|
|
9507
|
-
}
|
|
9508
|
-
if (section.note) parts.push(`<p class="nt">${esc(section.note)}</p>`);
|
|
9509
|
-
} else if (type === "next") {
|
|
9510
|
-
parts.push(`<p style="margin:0">${esc(section.text)}</p>`);
|
|
9511
|
-
parts.push('<p class="nt">\u672C\u6458\u8981\u57FA\u4E8E\u5408\u540C\u6B63\u6587\u89E3\u6790\u751F\u6210\uFF0C\u4E0D\u6784\u6210\u6CD5\u5F8B\u5BA1\u67E5\u610F\u89C1\u3002</p>');
|
|
9512
|
-
} else if (section.text) {
|
|
9513
|
-
parts.push(`<p>${esc(section.text)}</p>`);
|
|
9514
|
-
}
|
|
9515
|
-
parts.push("</div>");
|
|
9516
|
-
return parts.join("");
|
|
9517
|
-
}
|
|
9518
|
-
var SECTION_TYPES = ["alert", "reasons", "grid", "table", "checks", "list", "next"];
|
|
9519
|
-
var contractSummaryOperations = [
|
|
9520
|
-
{
|
|
9521
|
-
name: "contract.summary.render",
|
|
9522
|
-
async execute(input) {
|
|
9523
|
-
const dataPath = resolve6(requireNonEmptyString(input.data, "data", 4096).trim());
|
|
9524
|
-
const outPath = resolve6(requireNonEmptyString(input.out, "out", 4096).trim());
|
|
9525
|
-
let data;
|
|
9526
|
-
try {
|
|
9527
|
-
const raw = readFileSync5(dataPath, "utf8").replace(/^\uFEFF/u, "");
|
|
9528
|
-
const parsed = JSON.parse(raw);
|
|
9529
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
9530
|
-
throw new Error("summary data must be an object");
|
|
9531
|
-
}
|
|
9532
|
-
data = parsed;
|
|
9533
|
-
} catch (error) {
|
|
9534
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
9535
|
-
throw contractValidationError("data_unreadable", `\u65E0\u6CD5\u8BFB\u53D6\u6458\u8981\u6570\u636E JSON\uFF1A${message}`);
|
|
9536
|
-
}
|
|
9537
|
-
const sections = asArray3(data.sections);
|
|
9538
|
-
if (sections.length === 0) {
|
|
9539
|
-
throw contractValidationError("sections_required", "\u6458\u8981\u6570\u636E\u5FC5\u987B\u5305\u542B\u975E\u7A7A\u7684 sections \u6570\u7EC4");
|
|
9540
|
-
}
|
|
9541
|
-
const unknownTypes = sections.map((section) => String(section?.type ?? "")).filter((type) => !SECTION_TYPES.includes(type));
|
|
9542
|
-
if (unknownTypes.length) {
|
|
9543
|
-
throw contractValidationError(
|
|
9544
|
-
"section_type_unknown",
|
|
9545
|
-
`\u672A\u77E5\u7684 section \u7C7B\u578B\uFF1A${[...new Set(unknownTypes)].join(", ")}\uFF1B\u652F\u6301 ${SECTION_TYPES.join(" / ")}`
|
|
9546
|
-
);
|
|
9547
|
-
}
|
|
9548
|
-
const badge = esc(data.badge ?? "\u5408\u540C");
|
|
9549
|
-
const title = esc(data.title ?? "\u5408\u540C\u6458\u8981");
|
|
9550
|
-
const meta = esc(data.meta ?? "");
|
|
9551
|
-
const body = sections.map((section) => sectionHtml(section)).join("");
|
|
9552
|
-
const html = `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>\u5408\u540C\u6458\u8981 - ${title}</title><style>${CSS}</style></head><body><div class="w"><div class="hd"><span class="bd">${badge}</span><h1>${title}</h1><div class="mt">${meta}</div></div>${body}</div></body></html>`;
|
|
9553
|
-
writeFileSync3(outPath, html, "utf8");
|
|
9554
|
-
const bytes = Buffer.byteLength(html, "utf8");
|
|
9555
|
-
return {
|
|
9556
|
-
status: "COMPLETE",
|
|
9557
|
-
data: {
|
|
9558
|
-
output: outPath,
|
|
9559
|
-
fileName: basename4(outPath),
|
|
9560
|
-
fileSize: bytes,
|
|
9561
|
-
sectionCount: sections.length,
|
|
9562
|
-
sectionTypes: sections.map((section) => String(section.type)),
|
|
9563
|
-
note: "HTML \u7531 CLI \u6309\u56FA\u5B9A\u6A21\u677F\u6E32\u67D3\uFF1B\u6A21\u578B\u53EA\u9700\u63D0\u4F9B\u7D27\u51D1\u6570\u636E JSON"
|
|
9564
|
-
}
|
|
9565
|
-
};
|
|
9566
|
-
}
|
|
9567
|
-
}
|
|
9568
|
-
];
|
|
9569
|
-
|
|
9570
9799
|
// src/shortcuts/contract/operations/template.ts
|
|
9571
9800
|
var contractTypeTreeOperation = new ContractReadOperation("contract.type.tree", {
|
|
9572
9801
|
method: "GET",
|
|
@@ -9756,6 +9985,7 @@ function buildRegistry() {
|
|
|
9756
9985
|
...contractAssistantOperations,
|
|
9757
9986
|
...contractPerformanceOperations,
|
|
9758
9987
|
...contractSummaryOperations,
|
|
9988
|
+
...contractCardOperations,
|
|
9759
9989
|
...contractQuoteOperations
|
|
9760
9990
|
];
|
|
9761
9991
|
for (const handler of handlers) {
|
|
@@ -10126,7 +10356,7 @@ var contractShortcut = {
|
|
|
10126
10356
|
]);
|
|
10127
10357
|
registerCommand(review, "export", "Export AI review records", "contract.review.export", [
|
|
10128
10358
|
{ flag: "--file-id <id>", description: "contract file id", key: "fileId" },
|
|
10129
|
-
{ flag: "--sclx <types>", description: "
|
|
10359
|
+
{ flag: "--sclx <types>", description: "8 risk review (contract pre-review); 1/2/3 disabled", key: "sclx" }
|
|
10130
10360
|
]);
|
|
10131
10361
|
const flow = contract.command("flow").description("Contract flow entry commands");
|
|
10132
10362
|
registerCommand(flow, "page", "Build the flow create page url", "contract.flow.page", [
|
|
@@ -10220,6 +10450,14 @@ var contractShortcut = {
|
|
|
10220
10450
|
{ flag: "--data <file>", description: "summary data JSON path", key: "data" },
|
|
10221
10451
|
{ flag: "--out <file>", description: "output HTML path", key: "out" }
|
|
10222
10452
|
]);
|
|
10453
|
+
const card = contract.command("card").description("Contract action card rendering commands (local)");
|
|
10454
|
+
registerCommand(card, "render", "Render action card JSON into xiaoeCustomPage HTML (local)", "contract.card.render", [
|
|
10455
|
+
{ flag: "--data <file>", description: "card data JSON path", key: "data" },
|
|
10456
|
+
{ flag: "--out <file>", description: "output card HTML path", key: "out" },
|
|
10457
|
+
{ flag: "--summary <file>", description: "optional summary data JSON path to embed", key: "summary" },
|
|
10458
|
+
{ flag: "--browsertool <file>", description: "optional path to write full browsertool JSON", key: "browsertool" },
|
|
10459
|
+
{ flag: "--base-url <url>", description: "optional E10 base url, defaults to session", key: "baseUrl" }
|
|
10460
|
+
]);
|
|
10223
10461
|
const file = contract.command("file").description("Contract file download commands (binary)");
|
|
10224
10462
|
registerCommand(file, "download", "Download an E10 file to a local path", "contract.file.download", [
|
|
10225
10463
|
{ flag: "--file-id <id>", description: "E10 file id (template / attachment / review file)", key: "fileId" },
|