@testin-official/xagent 0.3.7 → 0.3.8
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/action/mcp-content.d.ts +4 -1
- package/dist/action/mcp-content.d.ts.map +1 -1
- package/dist/action/mcp-content.js +81 -17
- package/dist/action/mcp-content.js.map +1 -1
- package/dist/assets/integrations/manifest.json +3 -2
- package/dist/assets/integrations/xagent-skill/SKILL.md +33 -17
- package/dist/assets/integrations/xagent-skill/agents/openai.yaml +2 -2
- package/dist/assets/integrations/xagent-skill/references/evidence-lifecycle.md +23 -0
- package/dist/assets/integrations/xagent-skill/references/host-adapters.md +15 -6
- package/dist/assets/integrations/xagent-skill/references/routing.md +14 -24
- package/dist/assets/integrations/xagent-skill/references/setup-and-doctor.md +26 -0
- package/dist/assets/skills/xagent-analyze-failure/SKILL.md +18 -6
- package/dist/assets/skills/xagent-author-test/SKILL.md +28 -12
- package/dist/assets/skills/xagent-author-test/references/host-interaction-adapters.md +2 -4
- package/dist/assets/skills/xagent-author-test/references/interaction-modes.md +1 -2
- package/dist/assets/skills/xagent-cli/SKILL.md +23 -21
- package/dist/assets/skills/xagent-cli/references/host-modes.md +9 -17
- package/dist/assets/skills/xagent-explore-device/SKILL.md +24 -15
- package/dist/assets/skills/xagent-explore-device/agents/openai.yaml +2 -2
- package/dist/assets/skills/xagent-explore-device/references/tool-adapters.md +2 -2
- package/dist/assets/skills/xagent-repair-test/SKILL.md +16 -8
- package/dist/assets/skills/xagent-run-test/SKILL.md +25 -10
- package/dist/assets/skills/xagent-test-report/SKILL.md +21 -12
- package/dist/assets/skills/xagent-test-report/agents/openai.yaml +1 -1
- package/dist/assets/skills/xagent-test-report/references/evidence-policy.md +17 -12
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/evidence/store.d.ts +38 -0
- package/dist/evidence/store.d.ts.map +1 -0
- package/dist/evidence/store.js +112 -0
- package/dist/evidence/store.js.map +1 -0
- package/dist/integrations/manager.d.ts +1 -1
- package/dist/integrations/manager.d.ts.map +1 -1
- package/dist/integrations/manager.js +52 -20
- package/dist/integrations/manager.js.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +24 -11
- package/dist/mcp/tools.js.map +1 -1
- package/package.json +2 -2
- package/dist/assets/skills/xagent-cli/references/capability-routing.md +0 -36
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
type McpContent = Array<Record<string, string>>;
|
|
2
|
+
export declare function actionMcpContent(toolName: string, result: Record<string, any>): Promise<McpContent>;
|
|
3
|
+
export declare function workflowMcpContent(toolName: string, result: Record<string, any>): Promise<McpContent>;
|
|
4
|
+
export {};
|
|
2
5
|
//# sourceMappingURL=mcp-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-content.d.ts","sourceRoot":"","sources":["../../src/action/mcp-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-content.d.ts","sourceRoot":"","sources":["../../src/action/mcp-content.ts"],"names":[],"mappings":"AAWA,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AA8IhD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAEzG;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAE3G"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { XAgentApiError } from "../core/errors.js";
|
|
3
|
+
import { persistObservationEvidence } from "../evidence/store.js";
|
|
2
4
|
import sharp from "sharp";
|
|
3
5
|
const MAX_IMAGE_BYTES = 15 * 1024 * 1024;
|
|
4
6
|
const MAX_MCP_IMAGE_BYTES = 200 * 1024;
|
|
@@ -11,7 +13,7 @@ function textFor(toolName, result) {
|
|
|
11
13
|
}
|
|
12
14
|
return JSON.stringify(result);
|
|
13
15
|
}
|
|
14
|
-
function
|
|
16
|
+
function actionObservationFor(toolName, result) {
|
|
15
17
|
if (toolName === "xagent_device_acquire")
|
|
16
18
|
return result.observation;
|
|
17
19
|
if (toolName === "xagent_device_observe")
|
|
@@ -20,6 +22,53 @@ function observationFor(toolName, result) {
|
|
|
20
22
|
return result.after_observation ?? undefined;
|
|
21
23
|
return undefined;
|
|
22
24
|
}
|
|
25
|
+
function screenKey(value, fallback) {
|
|
26
|
+
const explicit = String(value ?? "").trim();
|
|
27
|
+
if (explicit)
|
|
28
|
+
return explicit;
|
|
29
|
+
return `screen_${createHash("sha256").update(fallback, "utf8").digest("hex").slice(0, 16)}`;
|
|
30
|
+
}
|
|
31
|
+
function evidenceCandidates(toolName, result) {
|
|
32
|
+
const actionObservation = actionObservationFor(toolName, result);
|
|
33
|
+
if (actionObservation)
|
|
34
|
+
return [{ observation: actionObservation, result }];
|
|
35
|
+
if (toolName === "xagent_authoring_observe")
|
|
36
|
+
return [{ observation: result, result }];
|
|
37
|
+
if (toolName === "xagent_authoring_draft_step_execute" || toolName === "xagent_authoring_attempt_get") {
|
|
38
|
+
const artifacts = Array.isArray(result.artifacts) ? result.artifacts : [];
|
|
39
|
+
return artifacts
|
|
40
|
+
.filter((artifact) => artifact?.type === "screenshot" && typeof artifact.url === "string")
|
|
41
|
+
.map((artifact, index) => ({
|
|
42
|
+
result,
|
|
43
|
+
observation: {
|
|
44
|
+
...result,
|
|
45
|
+
screenshot_url: artifact.url,
|
|
46
|
+
screen_id: screenKey(undefined, `${result.id ?? "attempt"}:${result.step_index ?? index}:${artifact.url}`),
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (toolName === "xagent_run_get" || toolName === "xagent_run_wait") {
|
|
51
|
+
const runId = String(result.id ?? result.run_id ?? "run").trim();
|
|
52
|
+
const candidates = [];
|
|
53
|
+
for (const execution of Array.isArray(result.device_executions) ? result.device_executions : []) {
|
|
54
|
+
for (const step of Array.isArray(execution?.steps) ? execution.steps : []) {
|
|
55
|
+
if (typeof step?.screenshot_url !== "string" || !step.screenshot_url.trim())
|
|
56
|
+
continue;
|
|
57
|
+
candidates.push({
|
|
58
|
+
result,
|
|
59
|
+
observation: {
|
|
60
|
+
...step,
|
|
61
|
+
session_id: `run:${runId}`,
|
|
62
|
+
device_id: execution.device_id,
|
|
63
|
+
screen_id: screenKey(undefined, `${runId}:${execution.id ?? execution.device_id}:${step.sequence}:${step.screenshot_url}`),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return candidates;
|
|
69
|
+
}
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
23
72
|
function assertImageUrl(value) {
|
|
24
73
|
if (typeof value !== "string")
|
|
25
74
|
throw new XAgentApiError("invalid_response", "Device observation has no screenshot URL");
|
|
@@ -38,9 +87,7 @@ function assertImageUrl(value) {
|
|
|
38
87
|
async function prepareMcpImage(bytes, mimeType) {
|
|
39
88
|
if (bytes.length <= MAX_MCP_IMAGE_BYTES)
|
|
40
89
|
return { bytes, mimeType };
|
|
41
|
-
const pipeline = sharp(bytes, { failOn: "error", limitInputPixels: 100_000_000 })
|
|
42
|
-
.rotate()
|
|
43
|
-
.flatten({ background: "#ffffff" });
|
|
90
|
+
const pipeline = sharp(bytes, { failOn: "error", limitInputPixels: 100_000_000 }).rotate().flatten({ background: "#ffffff" });
|
|
44
91
|
let smallest;
|
|
45
92
|
for (const quality of JPEG_QUALITIES) {
|
|
46
93
|
const candidate = await pipeline.clone().jpeg({ quality, mozjpeg: true }).toBuffer();
|
|
@@ -57,21 +104,13 @@ async function prepareMcpImage(bytes, mimeType) {
|
|
|
57
104
|
while (candidate.length > MAX_MCP_IMAGE_BYTES && longestEdge > 640) {
|
|
58
105
|
const ratio = Math.min(0.9, Math.sqrt(MAX_MCP_IMAGE_BYTES / candidate.length) * 0.95);
|
|
59
106
|
longestEdge = Math.max(640, Math.floor(longestEdge * ratio));
|
|
60
|
-
candidate = await pipeline.clone()
|
|
61
|
-
.resize({ width: longestEdge, height: longestEdge, fit: "inside", withoutEnlargement: true })
|
|
62
|
-
.jpeg({ quality: 72, mozjpeg: true })
|
|
63
|
-
.toBuffer();
|
|
107
|
+
candidate = await pipeline.clone().resize({ width: longestEdge, height: longestEdge, fit: "inside", withoutEnlargement: true }).jpeg({ quality: 72, mozjpeg: true }).toBuffer();
|
|
64
108
|
}
|
|
65
|
-
if (candidate.length > MAX_MCP_IMAGE_BYTES)
|
|
109
|
+
if (candidate.length > MAX_MCP_IMAGE_BYTES)
|
|
66
110
|
throw new XAgentApiError("invalid_response", "Device observation screenshot cannot be reduced to the MCP image limit");
|
|
67
|
-
}
|
|
68
111
|
return { bytes: candidate, mimeType: "image/jpeg" };
|
|
69
112
|
}
|
|
70
|
-
|
|
71
|
-
const content = [{ type: "text", text: textFor(toolName, result) }];
|
|
72
|
-
const observation = observationFor(toolName, result);
|
|
73
|
-
if (!observation)
|
|
74
|
-
return content;
|
|
113
|
+
async function fetchImage(observation) {
|
|
75
114
|
const url = assertImageUrl(observation.screenshot_url);
|
|
76
115
|
let response;
|
|
77
116
|
try {
|
|
@@ -109,8 +148,33 @@ export async function actionMcpContent(toolName, result) {
|
|
|
109
148
|
}
|
|
110
149
|
if (total === 0)
|
|
111
150
|
throw new XAgentApiError("invalid_response", "Device observation screenshot is empty");
|
|
112
|
-
|
|
113
|
-
|
|
151
|
+
return prepareMcpImage(Buffer.concat(chunks.map((chunk) => Buffer.from(chunk))), mimeType);
|
|
152
|
+
}
|
|
153
|
+
async function contentWithEvidence(toolName, result, strict) {
|
|
154
|
+
const content = [{ type: "text", text: textFor(toolName, result) }];
|
|
155
|
+
for (const candidate of evidenceCandidates(toolName, result)) {
|
|
156
|
+
try {
|
|
157
|
+
const image = await fetchImage(candidate.observation);
|
|
158
|
+
try {
|
|
159
|
+
await persistObservationEvidence({ sourceTool: toolName, result: candidate.result, observation: candidate.observation, bytes: image.bytes, mimeType: image.mimeType });
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
process.stderr.write(`${JSON.stringify({ xagent_evidence_cache: { status: "failed", cause: error instanceof Error ? error.message : String(error) } })}\n`);
|
|
163
|
+
}
|
|
164
|
+
content.push({ type: "image", data: image.bytes.toString("base64"), mimeType: image.mimeType });
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (strict)
|
|
168
|
+
throw error;
|
|
169
|
+
process.stderr.write(`${JSON.stringify({ xagent_evidence_fetch: { status: "failed", tool: toolName, cause: error instanceof Error ? error.message : String(error) } })}\n`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
114
172
|
return content;
|
|
115
173
|
}
|
|
174
|
+
export async function actionMcpContent(toolName, result) {
|
|
175
|
+
return contentWithEvidence(toolName, result, true);
|
|
176
|
+
}
|
|
177
|
+
export async function workflowMcpContent(toolName, result) {
|
|
178
|
+
return contentWithEvidence(toolName, result, false);
|
|
179
|
+
}
|
|
116
180
|
//# sourceMappingURL=mcp-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-content.js","sourceRoot":"","sources":["../../src/action/mcp-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,mBAAmB,GAAG,GAAG,GAAG,IAAI,CAAC;AACvC,MAAM,cAAc,GAAG,CAAC,EAAE,E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xB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,qBAAqB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAC9K,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB,EAAE,MAA2B;IAClF,OAAO,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB,EAAE,MAA2B;IACpF,OAAO,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": "xagent-skill/v1",
|
|
3
3
|
"skill_name": "xagent-skill",
|
|
4
|
-
"skill_version": "0.3.
|
|
5
|
-
"minimum_cli_version": "0.3.
|
|
4
|
+
"skill_version": "0.3.8",
|
|
5
|
+
"minimum_cli_version": "0.3.8",
|
|
6
|
+
"evidence_schema_version": "xagent-evidence/v1",
|
|
6
7
|
"default_domain": "action",
|
|
7
8
|
"mcp_protocol": "stdio",
|
|
8
9
|
"route_table_hash": "sha256:5aa8f83d0093cbcb93d661e60b1d516ef377402e41619cec2fae6ffb36eb6a5e",
|
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xagent-skill
|
|
3
|
-
description:
|
|
3
|
+
description: |
|
|
4
|
+
面向用户的 XAgent 测试与移动设备入口。用于查询或操作云真机、安装应用、验证目标、编写或执行测试、分析或修复失败,以及生成带截图证据的 Markdown 测试报告。
|
|
5
|
+
用户明确提到 XAgent、XAgent MCP、开发者设备、XAgent 测试或 XAgent 报告时触发。
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
# XAgent
|
|
8
|
+
# XAgent 用户入口
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
用户只需要说明最终目标。入口负责准备环境、选择一个明确流程,并按用户要求串联后续结果;不要让用户理解 MCP mode、Session、screen_id、幂等键或本地证据缓存。
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## 准备
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
2. Check the configured Profile and MCP connection without printing a Token.
|
|
14
|
-
3. Validate the Skill manifest and route-table hash against the CLI. If a check fails, stop before any upload, device, Authoring, Run, or report side effect.
|
|
15
|
-
4. Present the available behavior choices. `action` is the default; never silently select another side-effect mode.
|
|
16
|
-
5. Select exactly one domain and load only its matching packaged/server Skill.
|
|
14
|
+
按 `references/setup-and-doctor.md` 检查 Profile、凭证、CLI、Skill 和 MCP 状态。正常时直接开始;只有缺少初始化、登录、同步或重启时才说明需要用户完成的动作。
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
## 选择流程
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
- 操作设备或验证手机界面:`xagent-explore-device`
|
|
19
|
+
- 编写并逐步验证新测试:`xagent-author-test`
|
|
20
|
+
- 执行用户指定的现有测试:`xagent-run-test`
|
|
21
|
+
- 只读分析现有失败:`xagent-analyze-failure`
|
|
22
|
+
- 用户明确授权后修复测试:`xagent-repair-test`
|
|
23
|
+
- 从已经收集的证据生成报告:`xagent-test-report`
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
- Use the CLI for terminal and CI workflows. Stateful CLI commands must carry the current `session_id`, latest `screen_id`, and a unique idempotency key.
|
|
24
|
-
- Route with `xagent_workflow_options` and `xagent_workflow_route`, then verify `xagent_skill_load_local` (name, version, hash, and references) before side effects.
|
|
25
|
-
- A routed mode may load only its mapped Skill. Changing mode requires the Host to start the corresponding isolated MCP process or restart `xagent-local`.
|
|
26
|
-
- Never pass a Developer Token on a command line, put it in YAML, or copy it into a Skill. Personal credentials use the OS credential store; CI credentials use an explicitly named environment variable.
|
|
25
|
+
意图明确时直接进入对应流程。只有不同理解会产生不同业务结果时才询问用户,不展示内部模式选择。
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
## 用户可见执行
|
|
28
|
+
|
|
29
|
+
设备相关流程展示关键截图和一句可见结果。失败时区分应用结果、设备控制、网络和证据问题。Action 或步骤状态 `PASSED` 只说明命令完成,业务结论必须由用户要求的可见后置条件支持。
|
|
30
|
+
|
|
31
|
+
用户一次要求多个结果时,入口只编排必要阶段,例如:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
测试验证 → 保存证据 → 释放资源 → 生成报告
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
每个阶段仍由独立 Skill 负责,不把不同业务逻辑合并。报告复用测试过程中已经展示的图片,不重新占用设备、截图或执行动作。完整规则见 `references/routing.md` 和 `references/evidence-lifecycle.md`。
|
|
38
|
+
|
|
39
|
+
## 清理和边界
|
|
40
|
+
|
|
41
|
+
- 不调用 Exec、额外 GUI 模型或隐藏降级链路。
|
|
42
|
+
- 不为了补齐报告重新执行有副作用的操作。
|
|
43
|
+
- 设备 Session、Authoring Session 和临时 APK 由创建它们的阶段负责释放。
|
|
44
|
+
- 不把内部响应、绝对缓存路径或证据 hash 直接展示给用户。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: XAgent
|
|
3
|
-
short_description:
|
|
4
|
-
default_prompt:
|
|
3
|
+
short_description: Operate XAgent devices, verify tests, and produce screenshot-backed reports.
|
|
4
|
+
default_prompt: Understand the user's XAgent goal, run only the required workflow, show key screenshots and visible outcomes, clean up owned resources, and reuse the same evidence in any requested report.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 所见即所得的证据生命周期
|
|
2
|
+
|
|
3
|
+
用户看到的关键截图和报告中的截图必须来自同一次设备观察。MCP 返回的图片已经压缩到适合 Agent 交互的大小;CLI 在本地短期缓存同一份图片,Report 只复制选中的缓存文件,不再次截图。Author 的证据按 Authoring Session 归档,Run 的证据按 `run:<run_id>` 归档。
|
|
4
|
+
|
|
5
|
+
## 证据生产
|
|
6
|
+
|
|
7
|
+
Action、Authoring 和 Run 在返回初始状态、关键后置状态、失败、阻塞或基础设施异常时记录证据。Run 返回的步骤截图可以一次归档,报告阶段只挑选最能证明结果的图片。不要把每个纯导航中间画面都放进报告。
|
|
8
|
+
|
|
9
|
+
每条证据至少关联:测试项、设备、来源域、screen_id、截图文件、截图 hash、捕获时间和可见证明说明。
|
|
10
|
+
|
|
11
|
+
## 证据展示
|
|
12
|
+
|
|
13
|
+
设备动作完成后,向用户展示关键截图和一句可见结果。`PASSED` 只说明设备命令完成;业务状态必须由截图和用户目标共同判断。
|
|
14
|
+
|
|
15
|
+
## 报告消费
|
|
16
|
+
|
|
17
|
+
Report 读取证据清单,选择:
|
|
18
|
+
|
|
19
|
+
- 建立环境的初始图;
|
|
20
|
+
- 每个测试项的一张最终证明图;
|
|
21
|
+
- 解释失败、阻塞或基础设施异常的图。
|
|
22
|
+
|
|
23
|
+
将选中的图片复制到报告目录下的 `evidence/`,Markdown 只使用相对路径。图片不存在时保留 screen_id 并标记 `INCONCLUSIVE`,不编造图片或重新操作设备。
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
# Host
|
|
1
|
+
# Agent Host 适配
|
|
2
2
|
|
|
3
|
-
Codex
|
|
3
|
+
Codex Host 使用 XAgent Skill 包。Host 负责加载入口 Skill、启动对应 MCP 进程,并把 MCP 图片原生展示给用户。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. Launch `xagent` as the stdio MCP command with the selected `--profile` and `mcp --mode`.
|
|
7
|
-
3. Reload the Skill/MCP catalog after an upgrade.
|
|
5
|
+
## 用户体验要求
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
- 工具返回图片时,Host 应展示图片本身,不只显示 URL 或 Base64。
|
|
8
|
+
- 意图明确时不要让用户选择内部 domain。
|
|
9
|
+
- 只有确实存在多个业务目标且会产生不同结果时才询问用户。
|
|
10
|
+
- 用户要求测试报告时,在设备阶段结束并清理资源后继续本地 Report 阶段,不要求用户重新发起命令。
|
|
11
|
+
|
|
12
|
+
## 运行要求
|
|
13
|
+
|
|
14
|
+
Host 以当前 npm 安装的 `xagent` 启动 stdio MCP,并使用明确的 Profile。MCP 进程变化、Skill 同步或 npm scope 变化后需要重启 Host。
|
|
15
|
+
|
|
16
|
+
XAgent 同步只写入自己的 `xagent-skill` 目录,不扫描或覆盖 Host 的其他配置。
|
|
17
|
+
|
|
18
|
+
`step_confirm` 和 `auto` 是 Authoring 内部交互策略,不是用户必须理解的 XAgent 产品模式。
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 用户工作流边界
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
入口按用户最终目标选择最小的主流程,不向用户展示内部 MCP 参数。
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
5
|
+
| 用户目标 | 主 Skill | 结束时的用户结果 |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| 查询、占用、操作设备 | `xagent-explore-device` | 关键截图和可见操作结果 |
|
|
8
|
+
| 编写并验证测试 | `xagent-author-test` | 可继续编辑的测试和验证证据 |
|
|
9
|
+
| 执行已有测试 | `xagent-run-test` | Run 结果和关键步骤证据 |
|
|
10
|
+
| 分析已有失败 | `xagent-analyze-failure` | 失败分类和证据解释 |
|
|
11
|
+
| 修复已有测试 | `xagent-repair-test` | 修复后的测试和验证结果 |
|
|
12
|
+
| 生成报告 | `xagent-test-report` | 带相对图片链接的 Markdown 报告 |
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Use the CLI equivalents:
|
|
14
|
+
当用户明确同时要求测试和报告时,入口只编排顺序:
|
|
17
15
|
|
|
18
16
|
```text
|
|
19
|
-
|
|
20
|
-
xagent --json integrations route action --profile PROFILE
|
|
21
|
-
xagent --json integrations verify-skill PATH_TO_XAGENT_SKILL
|
|
17
|
+
Action / Author / Run → 证据整理 → 资源清理 → Report
|
|
22
18
|
```
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
xagent_workflow_options
|
|
28
|
-
xagent_workflow_route(domain="action")
|
|
29
|
-
xagent_skill_load_local(skill="xagent-explore-device")
|
|
30
|
-
```
|
|
20
|
+
如果用户没有要求报告,不要自动进入 Report。若用户后来单独要求报告,只能使用仍可读取的证据;缺失部分标记为 `INCONCLUSIVE`,不能重新执行设备动作补证据。
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
不要增加 `action_report`、`run_report` 之类组合 domain。组合是入口的顺序编排,不是新的 MCP 能力。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 初始化、自检和同步
|
|
2
|
+
|
|
3
|
+
这些检查面向 Agent Host 内部执行,正常时用一句话完成,不向用户展示 JSON、hash 或 Session 细节。
|
|
4
|
+
|
|
5
|
+
## 检查顺序
|
|
6
|
+
|
|
7
|
+
1. `xagent doctor --json`:检查本地配置、默认 Profile 和凭证来源。
|
|
8
|
+
2. `xagent integrations doctor --host <host> --json`:检查 Host Skill、CLI 版本、Skill 内容、路由版本和 MCP 配置候选。
|
|
9
|
+
3. 需要在线鉴权或权限诊断时才调用 `xagent auth status`。
|
|
10
|
+
|
|
11
|
+
状态解释:
|
|
12
|
+
|
|
13
|
+
| 状态 | 用户可见处理 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `OK` | 直接执行请求 |
|
|
16
|
+
| `NEED_INIT` | 引导用户完成一次 XAgent 初始化 |
|
|
17
|
+
| `NEED_AUTH` | 引导用户登录或配置指定 Profile |
|
|
18
|
+
| `NEED_SYNC` | 同步 XAgent 自己的 Skill 文件 |
|
|
19
|
+
| `NEED_UPGRADE` | 升级 CLI/Skill 后重新检查 |
|
|
20
|
+
| `NEED_RESTART` | 提示重启 Agent Host/MCP,然后继续 |
|
|
21
|
+
|
|
22
|
+
`xagent init` 只负责 Profile 和服务地址初始化;`integrations sync` 只负责从当前 npm 包同步 XAgent Skill。不要把两者混成一个不可逆的安装动作。
|
|
23
|
+
|
|
24
|
+
## 同步来源
|
|
25
|
+
|
|
26
|
+
npm 包是 XAgent Skill 的唯一发布源。同步只写入 XAgent 自己的目录,不覆盖 Host 配置。同步后必须重新加载 Skill,并在 MCP 命令路径变化时重启对应 MCP。
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xagent-analyze-failure
|
|
3
|
-
description: Read
|
|
3
|
+
description: Read and classify an existing XAgent Run or Authoring Attempt without side effects. Use when the user asks why a test failed, wants evidence classification, or requests a failure explanation. Do not use to run, retry, cancel, edit, repair, or control a device.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# 分析 XAgent 失败
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
本 Skill 是只读诊断流程。输入必须是用户明确给出的 Run、Attempt 或公开结果;没有明确对象时只说明缺少哪项信息,不猜测上游原因。
|
|
9
|
+
|
|
10
|
+
## 分析步骤
|
|
11
|
+
|
|
12
|
+
1. 读取指定 Run 或 Attempt 的公开状态、失败步骤、消息和 Artifacts。
|
|
13
|
+
2. 按 `references/failure-classification.md` 区分 schema/configuration、鉴权、测试行为、设备或网络基础设施、取消和超时。
|
|
14
|
+
3. 输出设备、步骤序号、动作、公开错误、时间和可用证据。
|
|
15
|
+
4. 说明证据支持的是测试行为问题、临时基础设施问题还是无法确认;没有证据时明确标记未知。
|
|
16
|
+
|
|
17
|
+
## 结果约束
|
|
18
|
+
|
|
19
|
+
分析结论不等同于修复方案。不要把基础设施故障改写成应用缺陷,也不要把一次 Action 或 Attempt 的成功状态直接解释成业务通过。
|
|
20
|
+
|
|
21
|
+
## 严格边界
|
|
12
22
|
|
|
13
23
|
This capability is strictly read-only. It must not modify files, create or cancel a Run, retry an Attempt, acquire or control a device, create a Draft or Revision, recommend or name another Skill, or automatically hand off. Only a newer explicit user request can select a different domain.
|
|
24
|
+
|
|
25
|
+
本阶段不会自动切换、加载或进入另一个工作流;后续阶段必须由入口按用户已明确的目标顺序编排。
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xagent-author-test
|
|
3
|
-
description: Create a new XAgent
|
|
3
|
+
description: Create and verify a new XAgent test from a user goal or selected artifact. Use when the user asks to write, create, generate, or iteratively validate a new test. Do not use for direct device action, unchanged test execution, read-only failure analysis, or repair without explicit authorization.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# 编写 XAgent 测试
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
2. Create a local authoring workspace under `.xagent/authoring/<session-id>/` with `draft.yaml`, `state.json`, and numbered checkpoints. Then create one Session for an explicit device ID and observe the device.
|
|
10
|
-
3. Read [script-format.md](references/script-format.md) before drafting. Build the working YAML one step at a time: observe the current device state, author the next step, validate the complete snapshot locally, save a checkpoint, then call `xagent_authoring_draft_step_execute`. Add the following step only after the returned evidence is understood.
|
|
11
|
-
4. After each Draft Attempt, show its status and available Artifacts. In `step_confirm`, present a continue-or-adjust choice before the next side effect. In `auto`, continue a successful Attempt without prompting; stop on failure, ambiguity, or new user input.
|
|
12
|
-
5. When the user provides a new instruction, save the current state, re-observe the device, reconcile the required entry state, and revise only invalid authored steps before appending the next step. Read [interactive-steering.md](references/interactive-steering.md) for goal-change scope and state-recovery rules.
|
|
13
|
-
6. Pair every business-critical action with a nearby `waitFor` or `assert` for the expected visible outcome. Use `if` branches for optional UI interruptions that may be absent.
|
|
14
|
-
7. After the user confirms the finished YAML, validate it once more, create exactly one formal Revision with `xagent_authoring_revision_create`, then Complete the Session.
|
|
15
|
-
8. Keep the Session lease alive while the workflow spans user waits or multiple CLI commands. MCP performs best-effort renewal before side effects; a manual multi-command workflow must run `xagent authoring keepalive <sessionId>` (or `xagent device keepalive <sessionId>`). Cancel the Session explicitly whenever authoring stops early. See the Device Occupancy Lifecycle in [authoring-workflow.md](references/authoring-workflow.md).
|
|
8
|
+
本 Skill 负责把用户明确的测试目标逐步整理成可执行的 XAgent YAML,并在一台明确设备上验证每一步。它是独立的编写流程,不负责直接操作模式、既有测试执行、失败分析或修复。
|
|
16
9
|
|
|
17
|
-
|
|
10
|
+
## 进入条件
|
|
18
11
|
|
|
19
|
-
|
|
12
|
+
1. 确认用户要新建测试,并确定输入是自然语言目标还是用户指定的已有材料。
|
|
13
|
+
2. 读取 `references/interaction-modes.md`、`references/authoring-workflow.md`、`references/script-format.md` 和 `references/host-interaction-adapters.md`。
|
|
14
|
+
3. 在产生云端副作用前,确认设备、应用和交互策略;多项匹配时让用户明确选择。
|
|
15
|
+
|
|
16
|
+
## 编写循环
|
|
17
|
+
|
|
18
|
+
1. 创建本地工作区,保存完整 `draft.yaml`、状态和编号检查点。
|
|
19
|
+
2. 创建一个 Authoring Session,在同一 Session 内观察设备初始状态。
|
|
20
|
+
3. 每次只追加一个经过验证的步骤:读取当前画面、生成候选 YAML、做本地校验、保存检查点、执行 Draft Step。
|
|
21
|
+
4. 向用户展示每次 Attempt 的状态、可见结果和关键截图。`step_confirm` 在副作用前等待确认,`auto` 只在结果清晰且成功时继续。
|
|
22
|
+
5. 用户改变目标时先保存当前状态,在同一 Session 重新观察并只修正受影响的步骤。
|
|
23
|
+
6. 业务关键动作必须有附近的 `waitFor` 或 `assert`,可选弹窗使用条件分支表达。
|
|
24
|
+
|
|
25
|
+
## 完成和清理
|
|
26
|
+
|
|
27
|
+
用户确认最终行为后,完整校验 YAML,创建一个正式 Revision,然后完成并释放 Session。若同一请求还要求报告,先保留已返回的证据,释放资源,再进入只读 Report 阶段。
|
|
28
|
+
|
|
29
|
+
Session 跨越用户等待或多次命令时保持租约;手工流程使用 `xagent authoring keepalive <sessionId>`。提前停止必须显式取消 Session。不要把内部 Session、screen_id、幂等键或缓存路径展示给用户。
|
|
30
|
+
|
|
31
|
+
## 严格边界
|
|
32
|
+
|
|
33
|
+
本流程可以创建本地 YAML、执行 Draft Step 并创建一个确认后的 Revision。Do not use for action mode or the scriptless Action workflow. Do not create a formal Run. Do not repair an existing failed test without explicit repair intent. Do not silently enter another workflow. A report requested in the same task is a later read-only evidence phase. `step_confirm` and `auto` only control confirmation inside Author and never override a user-selected action mode.
|
|
34
|
+
|
|
35
|
+
本阶段不会自动切换、加载或进入另一个工作流;后续阶段必须由入口按用户已明确的目标顺序编排。
|
|
@@ -21,9 +21,7 @@ Do not send Host, model, mode, prompt, or interaction-capability metadata to XAg
|
|
|
21
21
|
|---|---|---|
|
|
22
22
|
| Codex Plan mode | `request_user_input` when exposed and permitted | Present native choices. Do not promise that Plan mode permits device side effects; inspect the active Tool policy before execution. |
|
|
23
23
|
| Codex Default mode | Text fallback | Do not call `request_user_input` when the Host reports it unavailable in Default mode. Show the one-time Plan mode notice below. |
|
|
24
|
-
|
|
|
25
|
-
| CodeBuddy Code | `AskUserQuestion` or another documented native choice Tool when exposed | Detect the Tool at runtime; do not infer it from product branding. |
|
|
26
|
-
| WorkBuddy | Any documented native structured-choice Tool when exposed | Probe capabilities at runtime; otherwise use text fallback. |
|
|
24
|
+
| Host with native choices | The documented native choice Tool | Detect the Tool at runtime; otherwise use text fallback. |
|
|
27
25
|
| Other interactive MCP Hosts | Host-native choice Tool when exposed | Use text fallback when no such Tool is callable. |
|
|
28
26
|
| CI/CD or another non-interactive caller | No prompt | Require `auto`; fail before creating a Session if an unresolved interactive choice remains. |
|
|
29
27
|
|
|
@@ -78,4 +76,4 @@ Record Host-specific behavior separately. Passing the XAgent MCP lifecycle does
|
|
|
78
76
|
|
|
79
77
|
- Verify Codex Default text fallback and one-time notice.
|
|
80
78
|
- Verify Codex Plan structured choice separately from device-side-effect permission.
|
|
81
|
-
- Verify
|
|
79
|
+
- Verify the active Host and exposed choice tools before declaring the adapter supported.
|
|
@@ -59,8 +59,7 @@ Use the Host's native structured input only when it is callable now:
|
|
|
59
59
|
|
|
60
60
|
- Codex Plan mode: `request_user_input` when exposed and permitted.
|
|
61
61
|
- Codex Default mode: concise text fallback; show the one-time Plan mode notice.
|
|
62
|
-
-
|
|
63
|
-
- WorkBuddy and other Hosts: a documented native choice when exposed; otherwise text fallback.
|
|
62
|
+
- Hosts exposing a native question tool: use that tool when available; otherwise use the text fallback.
|
|
64
63
|
|
|
65
64
|
Do not branch on model branding. A Host must actually expose and permit the interaction Tool.
|
|
66
65
|
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xagent-cli
|
|
3
|
-
description: Configure XAgent,
|
|
3
|
+
description: Configure and diagnose the local XAgent CLI, Profile, Skill installation, MCP connection, application catalog, or device catalog. Use for setup and read-only inspection when the user has not requested a device or test workflow. Do not execute actions, write tests, run YAML, repair tests, or generate reports.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# 配置和检查 XAgent
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
2. Look up application identity when setup or the selected workflow needs it. If `package_id` is unknown, query the project application list. If `package_id` is known but `package_name` is not, query that exact package. Never guess `appPackage` or randomly select one of multiple matches.
|
|
10
|
-
3. Look up devices when setup or the selected workflow needs one and no `device_id` was supplied. Apply server-side filters and return only an explicit match; this routing Skill does not acquire it.
|
|
11
|
-
4. Apply [capability-routing.md](references/capability-routing.md) before selecting a workflow. The newest explicit user mode has highest priority and remains locked until the user explicitly changes it.
|
|
12
|
-
5. Inspect the Principal only for setup, explicit capability inspection, or permission diagnosis. Protected operations authenticate and authorize themselves. Read [permissions.md](references/permissions.md).
|
|
13
|
-
6. When no mode is explicit, recommend exactly one workflow using [failure-routing.md](references/failure-routing.md) and the table below. Do not perform the selected domain here. After handing off, do not load or enter a second workflow unless the user explicitly changes modes.
|
|
8
|
+
本 Skill 是 XAgent 用户流程的准备阶段,只处理本地初始化、自检、同步和只读资源解析。检查正常时用一句“环境已就绪”结束,不展示内部 JSON、版本 hash 或凭证内容。
|
|
14
9
|
|
|
15
|
-
##
|
|
10
|
+
## 检查流程
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| Run an existing YAML without editing | `xagent-run-test` |
|
|
22
|
-
| Classify a failure without editing | `xagent-analyze-failure` |
|
|
23
|
-
| Explore or diagnose one device step at a time | `xagent-explore-device` |
|
|
24
|
-
| Write a report from already-collected test evidence | `xagent-test-report` |
|
|
25
|
-
| Configure XAgent, inspect apps/devices, or choose an adapter | This Skill |
|
|
12
|
+
1. 运行 `xagent doctor --json`,检查默认 Profile、本地配置和凭证来源。
|
|
13
|
+
2. 运行 `xagent integrations doctor --host <host> --json`,检查 XAgent Skill、CLI 版本和 MCP 重启要求。
|
|
14
|
+
3. 只有用户明确要求权限或在线身份诊断时才调用 `xagent auth status`。
|
|
15
|
+
4. 设备和应用目录仅用于解析用户指定资源;多项匹配时展示名称、系统和状态,不能随机选择。
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
## 状态反馈
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
- 已配置:说明环境已就绪。
|
|
20
|
+
- 未初始化:引导执行一次 `xagent init`。
|
|
21
|
+
- 缺少登录:说明需要 Developer Token,但不回显 Token。
|
|
22
|
+
- Skill 过期:同步 XAgent Skill 后提示重启 Host。
|
|
23
|
+
- MCP 过期:提示重启 MCP,不自动切换执行链路。
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
## 严格边界
|
|
26
|
+
|
|
27
|
+
- 不执行 `device_acquire`、Action、Draft Step、Revision 或 Run。
|
|
28
|
+
- 不创建、修改或修复 YAML。
|
|
29
|
+
- 不生成报告,也不为了诊断调用截图。
|
|
30
|
+
- 只检查和同步 XAgent 自己的 Skill 目录,不覆盖 Host 配置。
|
|
31
|
+
- 不在本 Skill 中维护第二套用户意图到 MCP Tool 的映射。
|
|
32
|
+
|
|
33
|
+
明确的设备、测试或报告请求由入口选择对应流程。本 Skill 不自动加载或进入另一个工作流。
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
# Agent Host
|
|
1
|
+
# Agent Host 运行方式
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
| Environment | Use | Credential source |
|
|
3
|
+
| 环境 | 使用方式 | 凭证来源 |
|
|
6
4
|
|---|---|---|
|
|
7
|
-
| Shell
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
13
|
-
The stdio Host must launch the executable directly. It must not use a Shell wrapper. Local files remain the Agent Host's responsibility: read an explicitly selected file and send its content to MCP Tools.
|
|
14
|
-
|
|
15
|
-
Each MCP process exposes one capability domain. Changing domains requires restarting MCP with the new explicit mode after the user requests that change. There is no combined or full mode. A report mode consumes evidence already held by the Agent and does not recover evidence from a device.
|
|
16
|
-
|
|
17
|
-
The default `xagent-local` MCP is `action` and remains a long-lived stateful device-control process. Direct CLI commands are one-shot calls and must receive the current session, screen and idempotency values explicitly. Do not mix the two invocation styles.
|
|
5
|
+
| 有 Shell | 调用 `xagent` CLI 做初始化、自检和诊断 | 当前 Profile |
|
|
6
|
+
| Agent 设备操作 | 使用 `xagent mcp --mode action` | 当前 Profile |
|
|
7
|
+
| Author、Run、Analyze、Repair | 使用对应隔离 MCP mode | 当前 Profile |
|
|
8
|
+
| Report | 读取已收集结果和本地证据,不操作设备 | 不需要云端凭证,除非读取云端结果 |
|
|
9
|
+
| CI | 安装 npm 包并使用 Project CI Profile | 指定环境变量 |
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
Host 应显示 MCP 原生图片内容,不只向用户返回 screenshot URL。明确请求直接进入对应用户工作流;只有真正歧义时才读取 workflow options。
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
CLI、Skill 或 MCP 路径升级后,先运行 `xagent integrations doctor --host <host>`。状态过期时同步 XAgent 自己的 Skill 并重启 Host。不把 MCP 失败自动降级到 Exec。
|