validpilot-oss 1.1.0
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/CHANGELOG.md +111 -0
- package/README.md +196 -0
- package/bin/validpilot.js +173 -0
- package/brain/error_aggregator.js +203 -0
- package/core/artifacts.js +44 -0
- package/core/config.js +37 -0
- package/core/redaction.js +39 -0
- package/core/report.js +42 -0
- package/core/result.js +29 -0
- package/core/security.js +57 -0
- package/engines/chrome_mcp_adapter.js +319 -0
- package/engines/playwright_adapter.js +421 -0
- package/examples/demo/README.md +58 -0
- package/examples/demo/diagnostic-error-flow.json +22 -0
- package/examples/demo/diagnostic-error.html +29 -0
- package/examples/demo/flow.json +27 -0
- package/examples/demo/index.html +29 -0
- package/hands/browser_operator.js +67 -0
- package/hands/evidence_collector.js +97 -0
- package/package.json +55 -0
- package/rules/suggested-rules.json +237 -0
- package/server.js +5376 -0
- package/standalone-start.js +43 -0
- package/start-http.js +45 -0
- package/tools/ai_debug_investigate.json +30 -0
- package/tools/benchmark_run.json +37 -0
- package/tools/browser_a11y_check.json +21 -0
- package/tools/browser_artifacts.json +8 -0
- package/tools/browser_artifacts_clear.json +11 -0
- package/tools/browser_assert.json +16 -0
- package/tools/browser_batch.json +61 -0
- package/tools/browser_click.json +11 -0
- package/tools/browser_console.json +26 -0
- package/tools/browser_cookies.json +38 -0
- package/tools/browser_debug_report.json +11 -0
- package/tools/browser_diagnose.json +23 -0
- package/tools/browser_dom.json +11 -0
- package/tools/browser_element_status.json +26 -0
- package/tools/browser_errors.json +17 -0
- package/tools/browser_errors_aggregate.json +12 -0
- package/tools/browser_errors_clear.json +8 -0
- package/tools/browser_eval.json +11 -0
- package/tools/browser_events.json +15 -0
- package/tools/browser_events_clear.json +8 -0
- package/tools/browser_find_element.json +30 -0
- package/tools/browser_find_page.json +22 -0
- package/tools/browser_flow.json +38 -0
- package/tools/browser_har_export.json +17 -0
- package/tools/browser_highlight.json +18 -0
- package/tools/browser_hover.json +14 -0
- package/tools/browser_instrument.json +10 -0
- package/tools/browser_links.json +21 -0
- package/tools/browser_locator_suggest.json +16 -0
- package/tools/browser_locator_validate.json +12 -0
- package/tools/browser_network.json +16 -0
- package/tools/browser_network_detail.json +17 -0
- package/tools/browser_open.json +12 -0
- package/tools/browser_performance_check.json +25 -0
- package/tools/browser_press_key.json +18 -0
- package/tools/browser_quick_fix.json +29 -0
- package/tools/browser_screenshot.json +15 -0
- package/tools/browser_scroll.json +31 -0
- package/tools/browser_select.json +26 -0
- package/tools/browser_session_close.json +12 -0
- package/tools/browser_session_create.json +17 -0
- package/tools/browser_session_switch.json +12 -0
- package/tools/browser_sessions.json +8 -0
- package/tools/browser_snapshot.json +8 -0
- package/tools/browser_step.json +18 -0
- package/tools/browser_storage.json +10 -0
- package/tools/browser_trace_start.json +14 -0
- package/tools/browser_trace_stop.json +10 -0
- package/tools/browser_traverse_menu.json +25 -0
- package/tools/browser_type.json +12 -0
- package/tools/browser_verify_fix.json +39 -0
- package/tools/browser_visual_baseline.json +19 -0
- package/tools/browser_visual_compare.json +20 -0
- package/tools/browser_visual_report.json +8 -0
- package/tools/browser_wait.json +18 -0
- package/tools/debug_investigate.json +17 -0
- package/tools/error_fix_suggestion.json +13 -0
- package/tools/error_summary_md.json +11 -0
- package/tools/fix_verify.json +13 -0
- package/tools/mcp_health_check.json +8 -0
- package/tools/mcp_self_test.json +12 -0
- package/tools/screenshot_diff.json +16 -0
- package/tools/validation_check.json +20 -0
- package/tools/validation_decision.json +24 -0
- package/tools/validation_element.json +13 -0
- package/tools/validation_flow.json +12 -0
- package/tools/validation_matrix.json +27 -0
- package/tools/validation_quick_run.json +13 -0
- package/tools/validation_report.json +10 -0
- package/tools/validation_report_export.json +8 -0
- package/tools/validation_run.json +35 -0
- package/tools/validation_start.json +12 -0
- package/tools/validation_suite_run.json +17 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fix_verify",
|
|
3
|
+
"description": "执行低 Token 修复验证,返回修复前后摘要对比、pass/fail、Top errors 和 artifact 路径。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"url": { "type": "string" },
|
|
8
|
+
"beforeSummary": { "type": "object" },
|
|
9
|
+
"afterSummary": { "type": "object" },
|
|
10
|
+
"timeout": { "type": "number" }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp_self_test",
|
|
3
|
+
"description": "执行 MCP 自测:创建自测会话,打开 data URL,验证 flow/assert/type/click/wait/step/events/errors/trace/artifacts 基础能力。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"sessionName": { "type": "string", "description": "自测使用的会话名称,默认 mcp-self-test" },
|
|
8
|
+
"headless": { "type": "boolean", "description": "是否无头运行,默认 false" },
|
|
9
|
+
"trace": { "type": "boolean", "description": "是否录制 trace,默认 true" }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "screenshot_diff",
|
|
3
|
+
"description": "比较两张截图或捕获当前截图并返回差异摘要与 artifact 路径;不输出长截图描述。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"baselinePath": { "type": "string" },
|
|
8
|
+
"actualPath": { "type": "string" },
|
|
9
|
+
"beforePath": { "type": "string" },
|
|
10
|
+
"afterPath": { "type": "string" },
|
|
11
|
+
"selector": { "type": "string" },
|
|
12
|
+
"threshold": { "type": "number" },
|
|
13
|
+
"name": { "type": "string" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_check",
|
|
3
|
+
"description": "执行单项浏览器健康检查:可打开 URL、等待条件、执行断言、截图留证,并统计本轮错误。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": { "type": "string", "description": "检查名称" },
|
|
8
|
+
"url": { "type": "string", "description": "可选,检查前打开的 URL" },
|
|
9
|
+
"wait": { "type": "object", "description": "可选,browser_wait 参数" },
|
|
10
|
+
"assertions": { "type": "object", "description": "browser_assert 参数" },
|
|
11
|
+
"textContains": { "type": "string", "description": "快捷断言:页面包含文本" },
|
|
12
|
+
"selectorVisible": { "type": "string", "description": "快捷断言:元素可见" },
|
|
13
|
+
"urlContains": { "type": "string", "description": "快捷断言:URL 包含文本" },
|
|
14
|
+
"noErrors": { "type": "boolean", "description": "是否要求本轮无错误,默认 true" },
|
|
15
|
+
"clearErrors": { "type": "boolean", "description": "检查前是否清空错误 checkpoint,默认 true" },
|
|
16
|
+
"instrument": { "type": "boolean", "description": "是否注入运行时探针,默认 false" },
|
|
17
|
+
"evidence": { "type": "boolean", "description": "是否保存步骤证据,默认 true" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_decision",
|
|
3
|
+
"description": "快速止损决策系统 - 基于页面初始错误状态,1 秒内判断是否值得继续验证,避免浪费 Token。返回决策建议(STOP/WARN/CONTINUE)、置信度、预计节省 Token 比例和估算的浪费 Token 数量。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"browserErrors": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"description": "浏览器错误统计数据",
|
|
10
|
+
"properties": {
|
|
11
|
+
"pageErrorCount": { "type": "number", "description": "页面运行时错误数" },
|
|
12
|
+
"criticalJsErrors": { "type": "number", "description": "关键 JS 资源 404 错误数" },
|
|
13
|
+
"criticalCssErrors": { "type": "number", "description": "关键 CSS 资源 404 错误数" },
|
|
14
|
+
"totalCount": { "type": "number", "description": "错误总数" }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"format": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "返回格式:json(默认)或 text",
|
|
20
|
+
"enum": ["json", "text"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_element",
|
|
3
|
+
"description": "验证特定DOM元素",
|
|
4
|
+
"input_schema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"targetUrl": {"type": "string", "description": "目标页面URL"},
|
|
8
|
+
"elementSelector": {"type": "string", "description": "元素选择器"},
|
|
9
|
+
"expectedText": {"type": "string", "description": "预期文本"}
|
|
10
|
+
},
|
|
11
|
+
"required": ["targetUrl", "elementSelector"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_flow",
|
|
3
|
+
"description": "执行完整用户流程",
|
|
4
|
+
"input_schema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"flowType": {"type": "string", "description": "流程类型"},
|
|
8
|
+
"credentials": {"type": "object", "properties": {"email": {"type": "string"}, "password": {"type": "string"}}}
|
|
9
|
+
},
|
|
10
|
+
"required": ["flowType"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_matrix",
|
|
3
|
+
"description": "执行角色 × 功能权限矩阵验证。每个角色使用独立 session,按功能步骤执行并检查预期允许/禁止结果,失败时自动调查并生成矩阵报告数据。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": { "type": "string", "description": "矩阵验证名称" },
|
|
8
|
+
"roles": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"description": "角色列表,每个角色可包含 name、sessionName、url、setupSteps",
|
|
11
|
+
"items": { "type": "object" }
|
|
12
|
+
},
|
|
13
|
+
"features": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"description": "功能列表,每个功能可包含 name、steps、stepsByRole、expected、expectedByRole、assertions、assertionsByRole、focus",
|
|
16
|
+
"items": { "type": "object" }
|
|
17
|
+
},
|
|
18
|
+
"clearArtifacts": { "type": "boolean", "description": "执行前是否清理证据产物,默认 false" },
|
|
19
|
+
"clearErrors": { "type": "boolean", "description": "执行前是否清空错误 checkpoint,默认 true" },
|
|
20
|
+
"instrument": { "type": "boolean", "description": "是否注入运行时探针,默认 true" },
|
|
21
|
+
"har": { "type": "boolean", "description": "是否导出 HAR JSON,默认 true" },
|
|
22
|
+
"investigateOnFailure": { "type": "boolean", "description": "失败时是否自动 debug_investigate,默认 true" },
|
|
23
|
+
"continueOnFailure": { "type": "boolean", "description": "单元失败后是否继续执行后续功能,默认 false" }
|
|
24
|
+
},
|
|
25
|
+
"required": ["roles", "features"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_quick_run",
|
|
3
|
+
"description": "对单页执行低 Token 快速验证:Console、Network、PageError、DOM/ARIA/文本摘要和稳定选择器可达性,返回 pass/fail、Top errors、artifact 路径。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"url": { "type": "string" },
|
|
8
|
+
"headless": { "type": "boolean" },
|
|
9
|
+
"timeout": { "type": "number" }
|
|
10
|
+
},
|
|
11
|
+
"required": ["url"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_report",
|
|
3
|
+
"description": "根据最近一次 validation_check、validation_run、validation_matrix 或 validation_suite_run 生成 Markdown/JSON 结构化验证报告。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"format": { "type": "string", "enum": ["markdown", "json"], "default": "markdown", "description": "报告格式" }
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_report_export",
|
|
3
|
+
"description": "将最近一次 validation_check/run/matrix/suite 结果导出为本地静态 HTML 报告,包含摘要、结果表、失败分析和 artifacts 链接,输出到 .trae/mcp-server/reports/validation-<timestamp>.html。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_run",
|
|
3
|
+
"description": "执行完整浏览器验收计划:自动清空错误、注入探针、录制 trace、按用例执行 browser_flow、断言、失败调查、导出 HAR,并保存证据产物。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": { "type": "string", "description": "验证计划名称" },
|
|
8
|
+
"cases": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"description": "测试用例列表",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": { "type": "string", "description": "用例名称" },
|
|
15
|
+
"sessionName": { "type": "string", "description": "该用例使用的浏览器会话名称,如 free-user、pro-user" },
|
|
16
|
+
"steps": { "type": "array", "description": "browser_flow 步骤列表" },
|
|
17
|
+
"assertions": { "type": "object", "description": "browser_assert 参数" },
|
|
18
|
+
"focus": { "type": "string", "description": "失败调查关注的接口 URL 关键字" },
|
|
19
|
+
"symptom": { "type": "string", "description": "失败时用于 debug_investigate 的症状描述" },
|
|
20
|
+
"expected": { "type": "string", "description": "期望结果" },
|
|
21
|
+
"continueOnError": { "type": "boolean", "description": "单个 flow 内步骤失败后是否继续" }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"clearArtifacts": { "type": "boolean", "description": "执行前是否清理截图、trace、har,默认 false" },
|
|
26
|
+
"clearErrors": { "type": "boolean", "description": "执行前是否清空错误 checkpoint,默认 true" },
|
|
27
|
+
"instrument": { "type": "boolean", "description": "是否注入运行时探针,默认 true" },
|
|
28
|
+
"trace": { "type": "boolean", "description": "是否录制 trace,默认 true" },
|
|
29
|
+
"har": { "type": "boolean", "description": "是否导出 HAR JSON,默认 true" },
|
|
30
|
+
"investigateOnFailure": { "type": "boolean", "description": "失败时是否自动调用 debug_investigate,默认 true" },
|
|
31
|
+
"continueOnFailure": { "type": "boolean", "description": "用例失败后是否继续执行后续用例,默认 false" }
|
|
32
|
+
},
|
|
33
|
+
"required": ["cases"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_start",
|
|
3
|
+
"description": "启动端到端验证流程",
|
|
4
|
+
"input_schema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"targetUrl": {"type": "string", "description": "目标验证页面URL"},
|
|
8
|
+
"testScenarios": {"type": "array", "items": {"type": "string"}, "description": "测试场景列表"}
|
|
9
|
+
},
|
|
10
|
+
"required": ["targetUrl", "testScenarios"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validation_suite_run",
|
|
3
|
+
"description": "执行验证资产套件。可通过 suite 名称读取 .trae/validations/suites/<suite>.json,或通过 file 指定 .trae/validations 内的套件文件,按顺序运行 check/run/matrix 并聚合结果。",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"suite": { "type": "string", "description": "套件名称,如 p5.5,将读取 .trae/validations/suites/p5.5.json" },
|
|
8
|
+
"file": { "type": "string", "description": "套件文件路径,必须位于 .trae/validations 内" },
|
|
9
|
+
"continueOnFailure": { "type": "boolean", "description": "覆盖套件文件中的失败后继续策略" },
|
|
10
|
+
"sessionName": { "type": "string", "description": "默认浏览器会话名称" }
|
|
11
|
+
},
|
|
12
|
+
"anyOf": [
|
|
13
|
+
{ "required": ["suite"] },
|
|
14
|
+
{ "required": ["file"] }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|