weaver-work-cli 0.1.50 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{attachment-content-EJYIOJPH.js → attachment-content-W3TSJC3Y.js} +3 -3
- package/dist/chunks/{chunk-BFKLQLBK.js → chunk-2J3XY4ED.js} +7 -7
- package/dist/chunks/{chunk-K67FODVC.js → chunk-6GCXWKG6.js} +1 -1
- package/dist/chunks/{chunk-WNJUGI2F.js → chunk-76PRVYH4.js} +1 -1
- package/dist/chunks/{chunk-RYFRGTUV.js → chunk-DEHJ7PMA.js} +4 -4
- package/dist/chunks/{chunk-3NCFFHB2.js → chunk-IF33CG4V.js} +1 -1
- package/dist/chunks/{chunk-YB3AJYPY.js → chunk-PE334WL3.js} +4 -4
- package/dist/chunks/{chunk-MCZG6HPM.js → chunk-QQXMHM3J.js} +2 -2
- package/dist/chunks/{chunk-7ECB22G3.js → chunk-U7ROML5E.js} +23 -23
- package/dist/chunks/{chunk-7AYQJSFY.js → chunk-WTLQGS6D.js} +2 -2
- package/dist/chunks/{chunk-6T53BSWZ.js → chunk-XPQN4E5O.js} +50 -19
- package/dist/chunks/{chunk-HARQF5IP.js → chunk-Z4G7LLDD.js} +25 -25
- package/dist/chunks/{conflict-C4UDHCWV.js → conflict-57WDJWL7.js} +2 -2
- package/dist/chunks/{contract-VUC6JOPG.js → contract-LJRAXVZU.js} +8587 -1421
- package/dist/chunks/{create-flow-6OG2LYBD.js → create-flow-3FMMZBCA.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-WP57TF2S.js → env-JYZE3BZB.js} +2 -2
- package/dist/chunks/{factory-VUXI7N5C.js → factory-66SCIKW3.js} +1 -1
- package/dist/chunks/{group-chat-UQRGXILK.js → group-chat-MNRYMLNG.js} +3 -3
- package/dist/chunks/{invoice-E7GOITEU.js → invoice-V7ZTITUO.js} +725 -205
- package/dist/chunks/{meeting-4BBLVAWM.js → meeting-IIY4UAJL.js} +10 -10
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-V4CHRQDI.js → registry-CJOVECZD.js} +1 -1
- package/dist/chunks/{registry-5CRCN2TV.js → registry-METZ2LWE.js} +10 -10
- package/dist/chunks/{room-recommend-AYR3UG7R.js → room-recommend-YFY7HTOF.js} +4 -4
- package/dist/chunks/{schedule-JZEFIXUS.js → schedule-6I63TERA.js} +4 -4
- package/dist/chunks/smart-extract-FOUYNIG3.js +2882 -0
- package/dist/chunks/{workflow-3ZAF2J5E.js → workflow-YHXFIU63.js} +1 -1
- package/dist/index.js +11 -6
- package/dist/shortcuts/contract/manifest.js +251 -0
- package/dist/shortcuts/contract/ooxml/docx-table.js +233 -0
- package/dist/shortcuts/contract/operations/card-action.js +1165 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +571 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/card.js +6 -5
- package/dist/shortcuts/contract/operations/docx-fillfromquote.js +532 -0
- package/dist/shortcuts/contract/operations/docx-verify.js +258 -0
- package/dist/shortcuts/contract/operations/elements-build.js +761 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +588 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/ledger.js +438 -0
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +104 -3
- package/dist/shortcuts/contract/operations/quote.js +131 -25
- package/dist/shortcuts/contract/operations/quotescreen.js +529 -0
- package/dist/shortcuts/contract/operations/registry.js +30 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/triage.js +1100 -0
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +200 -49
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +492 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +454 -0
- package/dist/shortcuts/workflow/operations/form.js +68 -33
- package/dist/shortcuts/workflow/operations/read.js +19 -1
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +3 -0
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +14 -1
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +16 -1
- package/skill-template/domains/qiyecheng.md +2 -0
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +223 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +47 -481
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +11 -11
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +32 -16
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +478 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +39 -61
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +18 -13
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -6
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -4
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +263 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +525 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +36 -0
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +80 -54
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +110 -14
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +19 -21
- package/skills/weaver-e10-jinchengda/references/orchestration.md +12 -12
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1 -6
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +2 -1
- package/skills/weaver-e10-qiyecheng/SKILL.md +37 -0
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +25 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +34 -27
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -42
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +180 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +106 -0
- package/skills/weaver-e10-workflow/references/workflow-create.md +6 -5
- package/skills/weaver-e10-workflow/references/workflow-edit.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +46 -33
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +12 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +91 -2
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +12 -12
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +136 -91
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +109 -23
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +0 -265
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +0 -588
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +0 -118
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -1,588 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
validate_action_card.py — 行为卡片交付前机器校验(2026-11-09 修订)
|
|
5
|
-
|
|
6
|
-
修订要点(对应 2026-11-09 实测故障):
|
|
7
|
-
1) 校验对象改为「JSON 还原态」:先解析外层 JSON、取出 customParams.html,
|
|
8
|
-
这就是宿主真正拿到并渲染的字符串;在它上面做语法与符号检查。
|
|
9
|
-
旧版只查模型拼接出的中间态,`\"` 尚未还原,会把必崩的卡片放行。
|
|
10
|
-
2) 新增 node --check(还原态 script):语法错一次即 FAIL。
|
|
11
|
-
3) 引号纪律:html 内双引号只允许 `var S="…"` 的**那一对**(0 或 2 个),
|
|
12
|
-
S 串内必须 0 个;反斜杠必须 0 个。否则 JSON 往返后字符串提前闭合,整段脚本不执行。
|
|
13
|
-
4) 元素 id 校验放宽到 div/section:每张卡唯一 id,getElementById/bind 的目标必须存在。
|
|
14
|
-
5) 状态反馈行:接受 [data-status],或 say() 写到的小字节点(如 id='tip')。
|
|
15
|
-
|
|
16
|
-
用法:
|
|
17
|
-
python scripts/validate_action_card.py <file>
|
|
18
|
-
<file> 可以是:
|
|
19
|
-
- 含 <browsertool>{...}</browsertool> 的整段回复文本
|
|
20
|
-
- 单独的卡片 JSON 文件
|
|
21
|
-
- 单独的 customParams.html 文件
|
|
22
|
-
- 本技能包内的 contract-action-card-template.html(含占位符,外层只 WARN)
|
|
23
|
-
|
|
24
|
-
退出码:0 全部 PASS(允许 WARN),1 存在 FAIL。
|
|
25
|
-
输出为英文,避免 Windows 控制台编码问题。
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
import io
|
|
29
|
-
import json
|
|
30
|
-
import os
|
|
31
|
-
import re
|
|
32
|
-
import shutil
|
|
33
|
-
import subprocess
|
|
34
|
-
import sys
|
|
35
|
-
import tempfile
|
|
36
|
-
|
|
37
|
-
PASS, FAIL, WARN = "PASS", "FAIL", "WARN"
|
|
38
|
-
results = []
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def add(level, item, detail=""):
|
|
42
|
-
results.append((level, item, detail))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def read_text(path):
|
|
46
|
-
with io.open(path, "r", encoding="utf-8-sig") as f:
|
|
47
|
-
return f.read()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def strip_html_comments(s):
|
|
51
|
-
return re.sub(r"<!--.*?-->", "", s, flags=re.S)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def extract_outer_json(text):
|
|
55
|
-
"""从文本中取第一个完整 JSON 对象(支持 <browsertool> 包裹)。"""
|
|
56
|
-
text = text.strip()
|
|
57
|
-
m = re.search(r"<browsertool>\s*", text)
|
|
58
|
-
if m:
|
|
59
|
-
text = text[m.end():]
|
|
60
|
-
end = text.find("</browsertool>")
|
|
61
|
-
if end != -1:
|
|
62
|
-
text = text[:end]
|
|
63
|
-
start = text.find("{")
|
|
64
|
-
if start == -1:
|
|
65
|
-
return None
|
|
66
|
-
depth = 0
|
|
67
|
-
in_str = False
|
|
68
|
-
esc = False
|
|
69
|
-
for i in range(start, len(text)):
|
|
70
|
-
ch = text[i]
|
|
71
|
-
if in_str:
|
|
72
|
-
if esc:
|
|
73
|
-
esc = False
|
|
74
|
-
elif ch == "\\":
|
|
75
|
-
esc = True
|
|
76
|
-
elif ch == '"':
|
|
77
|
-
in_str = False
|
|
78
|
-
continue
|
|
79
|
-
if ch == '"':
|
|
80
|
-
in_str = True
|
|
81
|
-
elif ch == "{":
|
|
82
|
-
depth += 1
|
|
83
|
-
elif ch == "}":
|
|
84
|
-
depth -= 1
|
|
85
|
-
if depth == 0:
|
|
86
|
-
try:
|
|
87
|
-
return json.loads(text[start:i + 1])
|
|
88
|
-
except Exception:
|
|
89
|
-
return None
|
|
90
|
-
return None
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
EBDF_LIST_MARK = "/sp/ebdfpage/list/"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def check_outer_ebdf(obj):
|
|
97
|
-
"""ebdf 列表页组件卡(业绩核算六菜单):纯组件,不渲染自定义 HTML。
|
|
98
|
-
|
|
99
|
-
与动作卡的区别:没有 customParams.html,组件名在 params_pc / params_mobile,
|
|
100
|
-
带 noMDialog,且不写 arguments.width。
|
|
101
|
-
"""
|
|
102
|
-
a = obj.get("arguments") or {}
|
|
103
|
-
so = a.get("sdkOptions") or {}
|
|
104
|
-
pp = so.get("params_pc") or {}
|
|
105
|
-
pm = so.get("params_mobile") or {}
|
|
106
|
-
par = so.get("params") or {}
|
|
107
|
-
rpc = so.get("routerProps_pc") or {}
|
|
108
|
-
rmb = so.get("routerProps_mobile") or {}
|
|
109
|
-
|
|
110
|
-
def eq(actual, expect, item):
|
|
111
|
-
if actual == expect:
|
|
112
|
-
add(PASS, item)
|
|
113
|
-
else:
|
|
114
|
-
add(FAIL, item, "expected %r, got %r" % (expect, actual))
|
|
115
|
-
|
|
116
|
-
eq(obj.get("version"), 1, "outer.version == 1")
|
|
117
|
-
if obj.get("callId"):
|
|
118
|
-
add(PASS, "outer.callId present")
|
|
119
|
-
else:
|
|
120
|
-
add(FAIL, "outer.callId present", "missing or empty")
|
|
121
|
-
eq(obj.get("toolId"), "fill_form", "outer.toolId == fill_form")
|
|
122
|
-
eq(a.get("type"), "e10", "arguments.type == e10 (not browsertool)")
|
|
123
|
-
eq(a.get("sdkRenderType"), "inline", "arguments.sdkRenderType == inline")
|
|
124
|
-
if "width" in a:
|
|
125
|
-
add(FAIL, "ebdf list card has no arguments.width",
|
|
126
|
-
"got %r -> use client default" % a.get("width"))
|
|
127
|
-
else:
|
|
128
|
-
add(PASS, "ebdf list card has no arguments.width")
|
|
129
|
-
|
|
130
|
-
src = a.get("src") or ""
|
|
131
|
-
m = re.search(r"/sp/ebdfpage/list/(\d+)", src)
|
|
132
|
-
page_id = m.group(1) if m else ""
|
|
133
|
-
if page_id:
|
|
134
|
-
add(PASS, "arguments.src -> /sp/ebdfpage/list/<pageId>")
|
|
135
|
-
else:
|
|
136
|
-
add(FAIL, "arguments.src -> /sp/ebdfpage/list/<pageId>", "got %r" % src)
|
|
137
|
-
|
|
138
|
-
eq(so.get("compName"), "ui.CorsComponent", "sdkOptions.compName == ui.CorsComponent")
|
|
139
|
-
eq(so.get("routerType"), "MemoryRouter", "sdkOptions.routerType == MemoryRouter")
|
|
140
|
-
eq(pp.get("app"), "@weapp/ebdfpage", "params_pc.app == @weapp/ebdfpage")
|
|
141
|
-
eq(pp.get("compName"), "TableViewList", "params_pc.compName == TableViewList")
|
|
142
|
-
eq(pm.get("app"), "@weapp/ebdfpage", "params_mobile.app == @weapp/ebdfpage")
|
|
143
|
-
eq(pm.get("compName"), "MTableViewList", "params_mobile.compName == MTableViewList")
|
|
144
|
-
eq(pp.get("noMDialog"), True, "params_pc.noMDialog == true")
|
|
145
|
-
eq(pm.get("noMDialog"), True, "params_mobile.noMDialog == true")
|
|
146
|
-
eq(par.get("pageId"), page_id, "params.pageId matches src pageId")
|
|
147
|
-
|
|
148
|
-
want = ["/list/%s" % page_id] if page_id else []
|
|
149
|
-
eq(rpc.get("initialEntries"), want, "routerProps_pc.initialEntries == /list/<pageId>")
|
|
150
|
-
eq(rmb.get("initialEntries"), want, "routerProps_mobile.initialEntries == /list/<pageId>")
|
|
151
|
-
|
|
152
|
-
cp = par.get("comParams")
|
|
153
|
-
if cp is None:
|
|
154
|
-
add(WARN, "params.comParams absent (no preset filter)")
|
|
155
|
-
elif not isinstance(cp, dict):
|
|
156
|
-
add(FAIL, "params.comParams is an object", "got %s" % type(cp).__name__)
|
|
157
|
-
else:
|
|
158
|
-
bad_keys = [k for k in cp if not re.match(r"^field_\d+$", str(k))]
|
|
159
|
-
if bad_keys:
|
|
160
|
-
add(FAIL, "comParams keys are field_<fieldId>", "bad: %r" % bad_keys)
|
|
161
|
-
elif any(not isinstance(v, str) for v in cp.values()):
|
|
162
|
-
add(FAIL, "comParams values are strings", "non-string value found")
|
|
163
|
-
else:
|
|
164
|
-
add(PASS, "comParams keys/values ok (%d)" % len(cp))
|
|
165
|
-
return None
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
def check_outer(obj, has_placeholder):
|
|
169
|
-
a = obj.get("arguments") or {}
|
|
170
|
-
if EBDF_LIST_MARK in (a.get("src") or ""):
|
|
171
|
-
return check_outer_ebdf(obj)
|
|
172
|
-
so = a.get("sdkOptions") or {}
|
|
173
|
-
pp = so.get("params_pc") or {}
|
|
174
|
-
rp = so.get("routerProps_pc") or {}
|
|
175
|
-
|
|
176
|
-
def eq(actual, expect, item):
|
|
177
|
-
if actual == expect:
|
|
178
|
-
add(PASS, item)
|
|
179
|
-
else:
|
|
180
|
-
add(FAIL, item, "expected %r, got %r" % (expect, actual))
|
|
181
|
-
|
|
182
|
-
def nonempty(actual, item):
|
|
183
|
-
if actual:
|
|
184
|
-
add(PASS, item)
|
|
185
|
-
else:
|
|
186
|
-
add(FAIL, item, "missing or empty")
|
|
187
|
-
|
|
188
|
-
eq(obj.get("version"), 1, "outer.version == 1")
|
|
189
|
-
nonempty(obj.get("callId"), "outer.callId present")
|
|
190
|
-
eq(obj.get("toolId"), "fill_form", "outer.toolId == fill_form")
|
|
191
|
-
eq(a.get("type"), "e10", "arguments.type == e10 (not browsertool)")
|
|
192
|
-
src = a.get("src") or ""
|
|
193
|
-
if src.endswith("/sp/contract/xiaoe-custom-page"):
|
|
194
|
-
add(PASS, "arguments.src -> xiaoe-custom-page")
|
|
195
|
-
else:
|
|
196
|
-
add(FAIL, "arguments.src -> xiaoe-custom-page", "got %r" % src)
|
|
197
|
-
eq(a.get("width"), 1200, "arguments.width == 1200")
|
|
198
|
-
eq(a.get("sdkRenderType"), "inline", "arguments.sdkRenderType == inline")
|
|
199
|
-
eq(so.get("compName"), "ui.CorsComponent", "sdkOptions.compName == ui.CorsComponent")
|
|
200
|
-
eq(so.get("routerType"), "MemoryRouter", "sdkOptions.routerType == MemoryRouter")
|
|
201
|
-
entries = rp.get("initialEntries")
|
|
202
|
-
if isinstance(entries, list) and entries:
|
|
203
|
-
add(PASS, "routerProps_pc.initialEntries non-empty")
|
|
204
|
-
else:
|
|
205
|
-
add(FAIL, "routerProps_pc.initialEntries non-empty", "got %r" % entries)
|
|
206
|
-
eq(pp.get("app"), "@weapp/contract", "params_pc.app == @weapp/contract")
|
|
207
|
-
eq(pp.get("compName"), "xiaoeCustomPage", "params_pc.compName == xiaoeCustomPage")
|
|
208
|
-
html = (pp.get("customParams") or {}).get("html")
|
|
209
|
-
if html:
|
|
210
|
-
add(PASS, "params_pc.customParams.html present (%d chars)" % len(html))
|
|
211
|
-
return html
|
|
212
|
-
add(FAIL, "params_pc.customParams.html present", "missing")
|
|
213
|
-
return None
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
def strip_js_comments(s):
|
|
217
|
-
return re.sub(r"/\*.*?\*/", "", s, flags=re.S)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
def inner_region(s):
|
|
221
|
-
"""只校验会被渲染的区域:跳过 head 的 meta/title 与文档级属性。"""
|
|
222
|
-
s = strip_html_comments(s)
|
|
223
|
-
m = re.search(r"<section\b", s)
|
|
224
|
-
if m:
|
|
225
|
-
return s[m.start():]
|
|
226
|
-
m = re.search(r"<body\b[^>]*>", s)
|
|
227
|
-
if m:
|
|
228
|
-
return s[m.end():]
|
|
229
|
-
return s
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def extract_script(html):
|
|
233
|
-
m = re.search(r"<script>(.*)</script>", html, re.S)
|
|
234
|
-
return m.group(1) if m else None
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
def node_check(js):
|
|
238
|
-
"""在还原态脚本上跑 node --check。"""
|
|
239
|
-
node = shutil.which("node")
|
|
240
|
-
if not node:
|
|
241
|
-
add(WARN, "node --check on restored script", "node not found in PATH, skipped")
|
|
242
|
-
return
|
|
243
|
-
fd, tmp = tempfile.mkstemp(suffix=".js", text=True)
|
|
244
|
-
try:
|
|
245
|
-
with io.open(fd, "w", encoding="utf-8") as f:
|
|
246
|
-
f.write(js)
|
|
247
|
-
proc = subprocess.run([node, "--check", tmp],
|
|
248
|
-
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
249
|
-
if proc.returncode == 0:
|
|
250
|
-
add(PASS, "node --check on restored script")
|
|
251
|
-
else:
|
|
252
|
-
err = proc.stderr.decode("utf-8", "replace").strip().splitlines()
|
|
253
|
-
head = " / ".join([x.strip() for x in err if x.strip()][:4])
|
|
254
|
-
add(FAIL, "node --check on restored script",
|
|
255
|
-
"syntax error after JSON round-trip: %s" % (head or "exit %d" % proc.returncode))
|
|
256
|
-
finally:
|
|
257
|
-
try:
|
|
258
|
-
os.remove(tmp)
|
|
259
|
-
except Exception:
|
|
260
|
-
pass
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def check_s_constant(html):
|
|
264
|
-
"""var S 常量:包裹引号只允许一对,串内双引号/反斜杠必须为 0。"""
|
|
265
|
-
i = html.find('var S=')
|
|
266
|
-
if i == -1:
|
|
267
|
-
add(WARN, "var S constant present", "no summary constant found")
|
|
268
|
-
return
|
|
269
|
-
# 包裹引号可能是双引号(旧写法)或单引号(零双引号规范下的正确写法),两种都要认
|
|
270
|
-
m_close = re.match(r"var S=(['\"])(.*?)\1;", html[i:], re.S)
|
|
271
|
-
if not m_close:
|
|
272
|
-
add(FAIL, "var S constant closed", "cannot locate closing quote")
|
|
273
|
-
return
|
|
274
|
-
s_val = m_close.group(2)
|
|
275
|
-
if '"' in s_val:
|
|
276
|
-
add(FAIL, "var S inner double quotes == 0",
|
|
277
|
-
"found %d -> string closes early, whole script dies" % s_val.count('"'))
|
|
278
|
-
else:
|
|
279
|
-
add(PASS, "var S inner double quotes == 0")
|
|
280
|
-
unsafe_s = len(re.findall(r"\\(?!/script>|')", s_val))
|
|
281
|
-
if unsafe_s == 0:
|
|
282
|
-
add(PASS, "var S inner backslashes only safe escapes",
|
|
283
|
-
"total %d" % s_val.count("\\"))
|
|
284
|
-
else:
|
|
285
|
-
add(FAIL, "var S inner backslashes only safe escapes",
|
|
286
|
-
"unsafe found %d -> escaping breaks after JSON round-trip" % unsafe_s)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
def check_send_question(js):
|
|
290
|
-
"""sendQuestion 调用规范(2026-11-09 实测故障)。
|
|
291
|
-
|
|
292
|
-
正确:window.xiaoePlugin.session.sendQuestion({ question: '...', files: [] })
|
|
293
|
-
错误:plugin.sendQuestion('...') -> 方法不在 plugin 上,调用静默失败
|
|
294
|
-
plugin.session.sendQuestion('...') -> 参数类型错,宿主不认
|
|
295
|
-
"""
|
|
296
|
-
calls = re.findall(
|
|
297
|
-
r"([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*\.\s*sendQuestion\s*\(", js)
|
|
298
|
-
bare = re.findall(r"(?<![.\w$])sendQuestion\s*\(", js)
|
|
299
|
-
|
|
300
|
-
if not calls and not bare:
|
|
301
|
-
add(PASS, "sendQuestion namespace (no call present)")
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
if bare:
|
|
305
|
-
add(FAIL, "sendQuestion namespace == session",
|
|
306
|
-
"bare sendQuestion(...) found -> must be session.sendQuestion(...)")
|
|
307
|
-
return
|
|
308
|
-
|
|
309
|
-
bad_ns = [c.replace(" ", "") for c in calls if c.replace(" ", "").split(".")[-1] != "session"]
|
|
310
|
-
if bad_ns:
|
|
311
|
-
add(FAIL, "sendQuestion namespace == session",
|
|
312
|
-
"found %r -> 必须 session.sendQuestion,写成 plugin.sendQuestion 会静默不发送" % bad_ns)
|
|
313
|
-
else:
|
|
314
|
-
add(PASS, "sendQuestion namespace == session")
|
|
315
|
-
|
|
316
|
-
# 参数必须是对象字面量且含 question
|
|
317
|
-
bad_arg = 0
|
|
318
|
-
good_arg = 0
|
|
319
|
-
for m in re.finditer(r"\.\s*sendQuestion\s*\(", js):
|
|
320
|
-
tail = js[m.end():m.end() + 200]
|
|
321
|
-
if re.match(r"\s*\{", tail) and re.search(r"question\s*:", tail):
|
|
322
|
-
good_arg += 1
|
|
323
|
-
else:
|
|
324
|
-
bad_arg += 1
|
|
325
|
-
if bad_arg:
|
|
326
|
-
add(FAIL, "sendQuestion arg is {question, files}",
|
|
327
|
-
"%d call(s) not passing object with question -> 传字符串宿主不认" % bad_arg)
|
|
328
|
-
else:
|
|
329
|
-
add(PASS, "sendQuestion arg is {question, files} (%d call(s))" % good_arg)
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
# src 路径 → 目标页组件名(与 contract-ai-review.md / contract-credit-page.md 登记一致)
|
|
333
|
-
E10_COMP_EXPECT = (
|
|
334
|
-
("/sp/contract/business/credit", "ContractCreditDetail"),
|
|
335
|
-
("/sp/contract/business/ai-contract", "AIContractV2"),
|
|
336
|
-
("/sp/contract/business/doc-compare", "AIDocCompare"),
|
|
337
|
-
("/sp/contract/terms-library", "ClauseLibraryPage"),
|
|
338
|
-
("/sp/ebdfpage/list/", "TableViewList"),
|
|
339
|
-
("/sp/workflow/flowpage/create/", "Comp.WffpRoute"),
|
|
340
|
-
("/sp/contract/xiaoe-list", "XiaoeList"),
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
def check_e10sdk_comp(js):
|
|
345
|
-
"""e10Sdk 打开页面:params.compName 必须存在且与 src 对应。
|
|
346
|
-
|
|
347
|
-
漏写 params.compName 时宿主不知道渲染哪个组件,表现为"点了打不开/白屏",
|
|
348
|
-
但它不会报 JS 错误,所以 node --check 查不出来(2026-11-09 实测)。
|
|
349
|
-
"""
|
|
350
|
-
starts = [m.start() for m in re.finditer(r"type\s*:\s*'e10Sdk'", js)]
|
|
351
|
-
if not starts:
|
|
352
|
-
add(PASS, "e10Sdk params.compName (no e10Sdk call present)")
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
problems = []
|
|
356
|
-
checked = 0
|
|
357
|
-
for i, st in enumerate(starts):
|
|
358
|
-
end = starts[i + 1] if i + 1 < len(starts) else min(len(js), st + 3000)
|
|
359
|
-
seg = js[st:end]
|
|
360
|
-
|
|
361
|
-
m_src = re.search(r"src\s*:\s*'([^']+)'", seg)
|
|
362
|
-
src = m_src.group(1) if m_src else ""
|
|
363
|
-
|
|
364
|
-
m_pc = re.search(r"params\s*:\s*\{[^{}]*?compName\s*:\s*'([^']+)'", seg)
|
|
365
|
-
pc = m_pc.group(1) if m_pc else None
|
|
366
|
-
if pc is None:
|
|
367
|
-
# ebdf 列表卡的组件名在 params_pc / params_mobile,不在 params
|
|
368
|
-
m_pc2 = re.search(r"params_pc\s*:\s*\{[^{}]*?compName\s*:\s*'([^']+)'", seg)
|
|
369
|
-
pc = m_pc2.group(1) if m_pc2 else None
|
|
370
|
-
|
|
371
|
-
expected = None
|
|
372
|
-
for path, comp in E10_COMP_EXPECT:
|
|
373
|
-
if path in src:
|
|
374
|
-
expected = comp
|
|
375
|
-
break
|
|
376
|
-
|
|
377
|
-
checked += 1
|
|
378
|
-
if not pc:
|
|
379
|
-
problems.append("%s -> 缺 params.compName(期望 %s)" % (src or "<no src>", expected or "?"))
|
|
380
|
-
elif expected and pc != expected:
|
|
381
|
-
problems.append("%s -> params.compName=%s,期望 %s" % (src, pc, expected))
|
|
382
|
-
|
|
383
|
-
if problems:
|
|
384
|
-
add(FAIL, "e10Sdk params.compName correct (%d call(s))" % checked,
|
|
385
|
-
"; ".join(problems))
|
|
386
|
-
else:
|
|
387
|
-
add(PASS, "e10Sdk params.compName correct (%d call(s))" % checked)
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
def check_hover_feedback(js):
|
|
391
|
-
"""可点卡片必须带悬停描边高亮(2026-11-09 用户实测)。
|
|
392
|
-
|
|
393
|
-
规范 §视觉:悬停时边框 `#1d6fd8` + `box-shadow:0 2px 8px rgba(29,111,216,.12)`;
|
|
394
|
-
坑位 #8:只绑 click 不绑 hover → 用户不知道这块能点。
|
|
395
|
-
|
|
396
|
-
只绑 click 的卡片能点,但鼠标移入毫无变化,用户会误以为不可点。
|
|
397
|
-
"""
|
|
398
|
-
click_pat = r"(?:addEventListener\s*\(\s*['\"]click['\"]|\.onclick\s*=)"
|
|
399
|
-
enter_pat = r"(?:addEventListener\s*\(\s*['\"]mouse(?:enter|over)['\"]|\.onmouse(?:enter|over|move)\s*=)"
|
|
400
|
-
style_pat = r"(?:borderColor|boxShadow|border-color|border-top-color)"
|
|
401
|
-
|
|
402
|
-
n_click = len(re.findall(click_pat, js))
|
|
403
|
-
n_enter = len(re.findall(enter_pat, js))
|
|
404
|
-
has_style = bool(re.search(style_pat, js))
|
|
405
|
-
|
|
406
|
-
if n_click == 0:
|
|
407
|
-
add(WARN, "hover highlight on clickable cards", "no click binding found, skipped")
|
|
408
|
-
return
|
|
409
|
-
if n_enter == 0:
|
|
410
|
-
add(FAIL, "hover highlight on clickable cards",
|
|
411
|
-
"%d click binding(s) but no mouseenter/mouseover -> 鼠标移入无边框变化" % n_click)
|
|
412
|
-
return
|
|
413
|
-
if not has_style:
|
|
414
|
-
add(FAIL, "hover highlight on clickable cards",
|
|
415
|
-
"%d hover binding(s) but no borderColor/boxShadow change -> hover 无视觉反馈" % n_enter)
|
|
416
|
-
return
|
|
417
|
-
add(PASS, "hover highlight on clickable cards (%d hover / %d click)" % (n_enter, n_click))
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
def check_inner(html, has_placeholder):
|
|
421
|
-
h = inner_region(html)
|
|
422
|
-
h_nc = strip_js_comments(h)
|
|
423
|
-
|
|
424
|
-
# 1) 摘要承载方式
|
|
425
|
-
if "<textarea" in h_nc.lower():
|
|
426
|
-
add(FAIL, "no <textarea> container",
|
|
427
|
-
"textarea hides nothing; summary leaks as plain text -> use var S constant")
|
|
428
|
-
else:
|
|
429
|
-
add(PASS, "no <textarea> container")
|
|
430
|
-
|
|
431
|
-
# 2) 还原态脚本语法(最重要)
|
|
432
|
-
js = extract_script(html)
|
|
433
|
-
if js:
|
|
434
|
-
node_check(js)
|
|
435
|
-
else:
|
|
436
|
-
add(WARN, "script block present", "no <script> found")
|
|
437
|
-
|
|
438
|
-
# 3) 引号纪律:整段 html 只允许 var S 的那一对双引号
|
|
439
|
-
dq = h.count('"')
|
|
440
|
-
if dq in (0, 2):
|
|
441
|
-
add(PASS, "double quotes in html are only the var S wrapper (%d)" % dq)
|
|
442
|
-
else:
|
|
443
|
-
add(FAIL, "double quotes in html are only the var S wrapper",
|
|
444
|
-
"found %d (expected 0 or 2)" % dq)
|
|
445
|
-
|
|
446
|
-
# 4) 反斜杠:仅允许两类安全转义
|
|
447
|
-
# <\/script> 报告中内嵌 script 时避免提前闭合
|
|
448
|
-
# \' JS 单引号字符串内转义单引号(模板自带,如 charset=\'utf-8\')
|
|
449
|
-
unsafe_bs = len(re.findall(r"\\(?!/script>|')", h))
|
|
450
|
-
if unsafe_bs == 0:
|
|
451
|
-
add(PASS, "backslashes only safe escapes (\\/script or \\')",
|
|
452
|
-
"total %d" % h.count("\\"))
|
|
453
|
-
else:
|
|
454
|
-
add(FAIL, "backslashes only safe escapes (\\/script or \\')",
|
|
455
|
-
"unsafe found %d -> JSON round-trip will mangle it" % unsafe_bs)
|
|
456
|
-
|
|
457
|
-
# 5) 摘要常量本身
|
|
458
|
-
check_s_constant(html)
|
|
459
|
-
|
|
460
|
-
# 6) 标签配对(内嵌 script 的闭合可能写成 <\/script>,统计前先归一)
|
|
461
|
-
h_tag = h.replace('<\\/script>', '</script>')
|
|
462
|
-
for tag in ("section", "script"):
|
|
463
|
-
o = len(re.findall(r"<%s[\s>]" % tag, h_tag))
|
|
464
|
-
c = len(re.findall(r"</%s>" % tag, h_tag))
|
|
465
|
-
if o == c and o > 0:
|
|
466
|
-
add(PASS, "<%s> balanced (%d)" % (tag, o))
|
|
467
|
-
elif o == 0 and c == 0:
|
|
468
|
-
add(WARN, "<%s> absent" % tag)
|
|
469
|
-
else:
|
|
470
|
-
add(FAIL, "<%s> balanced" % tag, "open %d / close %d" % (o, c))
|
|
471
|
-
|
|
472
|
-
# 7) 元素唯一 id + 事件绑定目标存在(含 <p id='tip'> 这类反馈节点)
|
|
473
|
-
all_ids = re.findall(r"<[a-zA-Z][a-zA-Z0-9]*[^>]*\bid=['\"]([^'\"]+)['\"]", h)
|
|
474
|
-
card_ids = re.findall(r"<div[^>]*\brole=['\"]button['\"][^>]*\bid=['\"]([^'\"]+)['\"]", h)
|
|
475
|
-
card_ids += re.findall(r"<div[^>]*\bid=['\"]([^'\"]+)['\"][^>]*\brole=['\"]button['\"]", h)
|
|
476
|
-
if not card_ids:
|
|
477
|
-
add(FAIL, "action cards have id + role=button", "none found")
|
|
478
|
-
elif len(set(card_ids)) != len(card_ids):
|
|
479
|
-
add(FAIL, "card ids unique", "duplicated: %r" % card_ids)
|
|
480
|
-
else:
|
|
481
|
-
add(PASS, "action cards have unique id (%d cards)" % len(card_ids))
|
|
482
|
-
|
|
483
|
-
targets = re.findall(r"getElementById\(['\"]([^'\"]+)['\"]\)", h)
|
|
484
|
-
targets += re.findall(r"bind\(['\"]([^'\"]+)['\"]", h)
|
|
485
|
-
if not targets:
|
|
486
|
-
add(FAIL, "event binding targets existing id", "no getElementById/bind call")
|
|
487
|
-
else:
|
|
488
|
-
missing = sorted(set(targets) - set(all_ids))
|
|
489
|
-
if missing:
|
|
490
|
-
add(FAIL, "event binding targets existing id", "missing ids: %r" % missing)
|
|
491
|
-
else:
|
|
492
|
-
add(PASS, "event binding targets existing id (%d)" % len(set(targets)))
|
|
493
|
-
|
|
494
|
-
# 8) 状态反馈行(点击失败必须有可见提示)
|
|
495
|
-
has_status = ("data-status" in h) or bool(re.search(r"id=['\"]tip['\"]", h))
|
|
496
|
-
if has_status:
|
|
497
|
-
add(PASS, "has visible status feedback element")
|
|
498
|
-
else:
|
|
499
|
-
add(FAIL, "has visible status feedback element",
|
|
500
|
-
"no [data-status] / id=tip -> failures stay silent")
|
|
501
|
-
|
|
502
|
-
# 9) ES5 兼容
|
|
503
|
-
es5_bad = []
|
|
504
|
-
for pat, name in ((r"=>", "arrow function"), (r"\bconst\b", "const"),
|
|
505
|
-
(r"\blet\b", "let"), (r"`", "template literal"),
|
|
506
|
-
(r"\?\?", "nullish ??"), (r"\?\.", "optional chaining ?.")):
|
|
507
|
-
if re.search(pat, h_nc):
|
|
508
|
-
es5_bad.append(name)
|
|
509
|
-
if es5_bad:
|
|
510
|
-
add(FAIL, "ES5 only", "found: " + ", ".join(es5_bad))
|
|
511
|
-
else:
|
|
512
|
-
add(PASS, "ES5 only")
|
|
513
|
-
|
|
514
|
-
# 10) artifact 必须带 initialArtifactKeys
|
|
515
|
-
if "artifact" in h:
|
|
516
|
-
if "initialArtifactKeys" in h:
|
|
517
|
-
add(PASS, "artifact passes initialArtifactKeys")
|
|
518
|
-
else:
|
|
519
|
-
add(FAIL, "artifact passes initialArtifactKeys",
|
|
520
|
-
"missing -> panel opens blank / wrong doc")
|
|
521
|
-
ids = re.findall(r"artifacts:\s*\[\s*\{\s*id:\s*['\"]([^'\"]+)['\"]", h)
|
|
522
|
-
keys = re.findall(r"initialArtifactKeys:\s*\[([^\]]*)\]", h)
|
|
523
|
-
if ids and keys:
|
|
524
|
-
k = [x.strip().strip("'\"") for x in keys[0].split(",") if x.strip()]
|
|
525
|
-
if set(k) & set(ids):
|
|
526
|
-
add(PASS, "initialArtifactKeys matches artifacts[].id")
|
|
527
|
-
else:
|
|
528
|
-
add(FAIL, "initialArtifactKeys matches artifacts[].id",
|
|
529
|
-
"keys %r vs ids %r" % (k, ids))
|
|
530
|
-
|
|
531
|
-
# 11) 摘要以常量承载
|
|
532
|
-
if re.search(r"raw:\s*\{\s*html:\s*S\s*\}", h):
|
|
533
|
-
add(PASS if "var S" in h else FAIL, "summary carried by var S constant")
|
|
534
|
-
|
|
535
|
-
# 12) sendQuestion 调用规范(2026-11-09 新增)
|
|
536
|
-
# 必须 window.xiaoePlugin.session.sendQuestion({question, files}),
|
|
537
|
-
# 禁止 plugin.sendQuestion(...) 或 sendQuestion('字符串')
|
|
538
|
-
check_send_question(h_nc)
|
|
539
|
-
|
|
540
|
-
# 13) e10Sdk 必须带 params.compName,且与 src 对应(2026-11-09 新增)
|
|
541
|
-
# params.compName 缺失时宿主不知道渲染哪个组件,表现为"点了打不开"
|
|
542
|
-
check_e10sdk_comp(h_nc)
|
|
543
|
-
|
|
544
|
-
# 14) 悬停高亮(2026-11-09 新增)
|
|
545
|
-
# 规范 §视觉:悬停边框 #1d6fd8 + box-shadow;坑位 #8:只绑 click 不绑 hover
|
|
546
|
-
check_hover_feedback(h_nc)
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
def main():
|
|
550
|
-
if len(sys.argv) < 2:
|
|
551
|
-
print("usage: validate_action_card.py <file>")
|
|
552
|
-
return 2
|
|
553
|
-
path = sys.argv[1]
|
|
554
|
-
if not os.path.exists(path):
|
|
555
|
-
print("file not found: %s" % path)
|
|
556
|
-
return 2
|
|
557
|
-
|
|
558
|
-
text = read_text(path)
|
|
559
|
-
has_placeholder = "{{" in text
|
|
560
|
-
|
|
561
|
-
obj = extract_outer_json(text)
|
|
562
|
-
if obj is not None:
|
|
563
|
-
print("== outer JSON skeleton ==")
|
|
564
|
-
html = check_outer(obj, has_placeholder)
|
|
565
|
-
if html is not None:
|
|
566
|
-
print("== restored html (what the host renders) ==")
|
|
567
|
-
check_inner(html, has_placeholder)
|
|
568
|
-
else:
|
|
569
|
-
msg = "no parsable outer JSON (inner html only)"
|
|
570
|
-
add(WARN if has_placeholder else FAIL, "outer JSON skeleton", msg)
|
|
571
|
-
print("== inner html only ==")
|
|
572
|
-
check_inner(strip_html_comments(text), has_placeholder)
|
|
573
|
-
|
|
574
|
-
fails = [r for r in results if r[0] == FAIL]
|
|
575
|
-
warns = [r for r in results if r[0] == WARN]
|
|
576
|
-
for level, item, detail in results:
|
|
577
|
-
line = "[%s] %s" % (level, item)
|
|
578
|
-
if detail:
|
|
579
|
-
line += " -- " + detail
|
|
580
|
-
print(line)
|
|
581
|
-
print("")
|
|
582
|
-
print("summary: %d pass, %d warn, %d fail" %
|
|
583
|
-
(len(results) - len(fails) - len(warns), len(warns), len(fails)))
|
|
584
|
-
return 0 if not fails else 1
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if __name__ == "__main__":
|
|
588
|
-
sys.exit(main())
|