@testin-official/xagent 0.3.7

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.
Files changed (212) hide show
  1. package/README.md +157 -0
  2. package/dist/action/client.d.ts +13 -0
  3. package/dist/action/client.d.ts.map +1 -0
  4. package/dist/action/client.js +28 -0
  5. package/dist/action/client.js.map +1 -0
  6. package/dist/action/mcp-content.d.ts +2 -0
  7. package/dist/action/mcp-content.d.ts.map +1 -0
  8. package/dist/action/mcp-content.js +116 -0
  9. package/dist/action/mcp-content.js.map +1 -0
  10. package/dist/action/protocol.d.ts +36 -0
  11. package/dist/action/protocol.d.ts.map +1 -0
  12. package/dist/action/protocol.js +29 -0
  13. package/dist/action/protocol.js.map +1 -0
  14. package/dist/assets/contracts/app-list.schema.json +31 -0
  15. package/dist/assets/contracts/app-upload.schema.json +45 -0
  16. package/dist/assets/contracts/app.schema.json +18 -0
  17. package/dist/assets/contracts/authoring-attempt-create.schema.json +12 -0
  18. package/dist/assets/contracts/authoring-attempt.schema.json +56 -0
  19. package/dist/assets/contracts/authoring-complete.schema.json +13 -0
  20. package/dist/assets/contracts/authoring-draft-attempt-create.schema.json +12 -0
  21. package/dist/assets/contracts/authoring-observation.schema.json +28 -0
  22. package/dist/assets/contracts/authoring-revision-create.schema.json +13 -0
  23. package/dist/assets/contracts/authoring-revision.schema.json +19 -0
  24. package/dist/assets/contracts/authoring-session-create.schema.json +11 -0
  25. package/dist/assets/contracts/authoring-session.schema.json +54 -0
  26. package/dist/assets/contracts/canonical-script.schema.json +219 -0
  27. package/dist/assets/contracts/compat-script.schema.json +380 -0
  28. package/dist/assets/contracts/device-list.schema.json +19 -0
  29. package/dist/assets/contracts/error.schema.json +47 -0
  30. package/dist/assets/contracts/execution-target.schema.json +55 -0
  31. package/dist/assets/contracts/fixtures/authoring-attempt-create.valid.json +4 -0
  32. package/dist/assets/contracts/fixtures/authoring-attempt.passed.json +16 -0
  33. package/dist/assets/contracts/fixtures/authoring-draft-attempt-create.valid.json +10 -0
  34. package/dist/assets/contracts/fixtures/authoring-observation.valid.json +7 -0
  35. package/dist/assets/contracts/fixtures/authoring-revision.valid.json +16 -0
  36. package/dist/assets/contracts/fixtures/authoring-session.active.json +12 -0
  37. package/dist/assets/contracts/fixtures/canonical-script.valid.json +17 -0
  38. package/dist/assets/contracts/fixtures/ci-exit-status-cases.json +44 -0
  39. package/dist/assets/contracts/fixtures/command-mutual-exclusion-cases.json +20 -0
  40. package/dist/assets/contracts/fixtures/compat-script.all-platform-actions.yaml +227 -0
  41. package/dist/assets/contracts/fixtures/execution-target.both.invalid.json +7 -0
  42. package/dist/assets/contracts/fixtures/execution-target.concurrency-two.invalid.json +4 -0
  43. package/dist/assets/contracts/fixtures/execution-target.count-two.invalid.json +6 -0
  44. package/dist/assets/contracts/fixtures/execution-target.dynamic.valid.json +12 -0
  45. package/dist/assets/contracts/fixtures/execution-target.fixed.valid.json +4 -0
  46. package/dist/assets/contracts/fixtures/execution-target.multiple-devices.invalid.json +4 -0
  47. package/dist/assets/contracts/fixtures/execution-target.multiple-filters.invalid.json +7 -0
  48. package/dist/assets/contracts/fixtures/execution-target.strategy-all.invalid.json +6 -0
  49. package/dist/assets/contracts/fixtures/idempotency.conflict.json +26 -0
  50. package/dist/assets/contracts/fixtures/idempotency.same-request.json +26 -0
  51. package/dist/assets/contracts/fixtures/principal.personal.json +23 -0
  52. package/dist/assets/contracts/fixtures/principal.project-ci.json +20 -0
  53. package/dist/assets/contracts/fixtures/project-config.no-default.valid.json +9 -0
  54. package/dist/assets/contracts/fixtures/project-config.secret.invalid.json +10 -0
  55. package/dist/assets/contracts/fixtures/project-config.target-name.invalid.json +10 -0
  56. package/dist/assets/contracts/fixtures/project-config.valid.json +22 -0
  57. package/dist/assets/contracts/fixtures/public-script.all-cli-actions.yaml +39 -0
  58. package/dist/assets/contracts/fixtures/public-script.invalid.json +8 -0
  59. package/dist/assets/contracts/fixtures/public-script.valid.json +17 -0
  60. package/dist/assets/contracts/fixtures/run-create-v2.device-id.invalid.json +16 -0
  61. package/dist/assets/contracts/fixtures/run-create.personal-upload.valid.json +20 -0
  62. package/dist/assets/contracts/fixtures/run-create.single-device.json +19 -0
  63. package/dist/assets/contracts/fixtures/run-create.target.valid.json +22 -0
  64. package/dist/assets/contracts/fixtures/run.queued.json +19 -0
  65. package/dist/assets/contracts/fixtures/run.target.queued.json +38 -0
  66. package/dist/assets/contracts/fixtures/skill-catalog.valid.json +19 -0
  67. package/dist/assets/contracts/fixtures/skill-reference.valid.json +9 -0
  68. package/dist/assets/contracts/fixtures/skill.valid.json +10 -0
  69. package/dist/assets/contracts/fixtures/target-hash-cases.json +30 -0
  70. package/dist/assets/contracts/fixtures/target-preview.hash-mismatch.error.json +8 -0
  71. package/dist/assets/contracts/fixtures/target-preview.no-match.error.json +9 -0
  72. package/dist/assets/contracts/fixtures/target-preview.request.valid.json +9 -0
  73. package/dist/assets/contracts/fixtures/target-preview.success.json +18 -0
  74. package/dist/assets/contracts/fixtures/target-preview.unavailable.json +18 -0
  75. package/dist/assets/contracts/principal.schema.json +72 -0
  76. package/dist/assets/contracts/project-config.schema.json +23 -0
  77. package/dist/assets/contracts/public-script.schema.json +397 -0
  78. package/dist/assets/contracts/run-create-v2.schema.json +78 -0
  79. package/dist/assets/contracts/run-create.schema.json +70 -0
  80. package/dist/assets/contracts/run.schema.json +137 -0
  81. package/dist/assets/contracts/skill-catalog.schema.json +15 -0
  82. package/dist/assets/contracts/skill-reference.schema.json +17 -0
  83. package/dist/assets/contracts/skill-summary.schema.json +28 -0
  84. package/dist/assets/contracts/skill.schema.json +30 -0
  85. package/dist/assets/contracts/target-preview.schema.json +75 -0
  86. package/dist/assets/integrations/manifest.json +17 -0
  87. package/dist/assets/integrations/xagent-skill/SKILL.md +28 -0
  88. package/dist/assets/integrations/xagent-skill/agents/openai.yaml +4 -0
  89. package/dist/assets/integrations/xagent-skill/references/cli-mcp-interop.md +10 -0
  90. package/dist/assets/integrations/xagent-skill/references/host-adapters.md +9 -0
  91. package/dist/assets/integrations/xagent-skill/references/installation.md +10 -0
  92. package/dist/assets/integrations/xagent-skill/references/privacy.md +3 -0
  93. package/dist/assets/integrations/xagent-skill/references/routing.md +32 -0
  94. package/dist/assets/integrations/xagent-skill/scripts/install-cli.ps1 +5 -0
  95. package/dist/assets/integrations/xagent-skill/scripts/install-cli.sh +6 -0
  96. package/dist/assets/skills/xagent-analyze-failure/SKILL.md +13 -0
  97. package/dist/assets/skills/xagent-analyze-failure/agents/openai.yaml +4 -0
  98. package/dist/assets/skills/xagent-analyze-failure/references/failure-classification.md +20 -0
  99. package/dist/assets/skills/xagent-author-test/SKILL.md +19 -0
  100. package/dist/assets/skills/xagent-author-test/agents/openai.yaml +4 -0
  101. package/dist/assets/skills/xagent-author-test/references/authoring-workflow.md +41 -0
  102. package/dist/assets/skills/xagent-author-test/references/host-interaction-adapters.md +81 -0
  103. package/dist/assets/skills/xagent-author-test/references/interaction-modes.md +97 -0
  104. package/dist/assets/skills/xagent-author-test/references/interactive-steering.md +57 -0
  105. package/dist/assets/skills/xagent-author-test/references/script-actions.md +34 -0
  106. package/dist/assets/skills/xagent-author-test/references/script-format.md +100 -0
  107. package/dist/assets/skills/xagent-cli/SKILL.md +31 -0
  108. package/dist/assets/skills/xagent-cli/agents/openai.yaml +4 -0
  109. package/dist/assets/skills/xagent-cli/references/capability-routing.md +36 -0
  110. package/dist/assets/skills/xagent-cli/references/cli-commands.md +23 -0
  111. package/dist/assets/skills/xagent-cli/references/failure-routing.md +18 -0
  112. package/dist/assets/skills/xagent-cli/references/host-modes.md +21 -0
  113. package/dist/assets/skills/xagent-cli/references/mcp-tools.md +26 -0
  114. package/dist/assets/skills/xagent-cli/references/permissions.md +17 -0
  115. package/dist/assets/skills/xagent-explore-device/SKILL.md +26 -0
  116. package/dist/assets/skills/xagent-explore-device/agents/openai.yaml +4 -0
  117. package/dist/assets/skills/xagent-explore-device/references/actions.md +24 -0
  118. package/dist/assets/skills/xagent-explore-device/references/single-action-protocol.md +59 -0
  119. package/dist/assets/skills/xagent-explore-device/references/tool-adapters.md +32 -0
  120. package/dist/assets/skills/xagent-repair-test/SKILL.md +16 -0
  121. package/dist/assets/skills/xagent-repair-test/agents/openai.yaml +4 -0
  122. package/dist/assets/skills/xagent-repair-test/references/repair-workflow.md +21 -0
  123. package/dist/assets/skills/xagent-run-test/SKILL.md +16 -0
  124. package/dist/assets/skills/xagent-run-test/agents/openai.yaml +4 -0
  125. package/dist/assets/skills/xagent-run-test/references/execution-modes.md +23 -0
  126. package/dist/assets/skills/xagent-run-test/references/result-status.md +13 -0
  127. package/dist/assets/skills/xagent-test-report/SKILL.md +20 -0
  128. package/dist/assets/skills/xagent-test-report/agents/openai.yaml +4 -0
  129. package/dist/assets/skills/xagent-test-report/references/evidence-policy.md +20 -0
  130. package/dist/assets/skills/xagent-test-report/references/report-template.md +41 -0
  131. package/dist/assets/skills/xagent-test-report/references/result-classification.md +13 -0
  132. package/dist/authoring/draft-store.d.ts +19 -0
  133. package/dist/authoring/draft-store.d.ts.map +1 -0
  134. package/dist/authoring/draft-store.js +104 -0
  135. package/dist/authoring/draft-store.js.map +1 -0
  136. package/dist/authoring/session-lease.d.ts +64 -0
  137. package/dist/authoring/session-lease.d.ts.map +1 -0
  138. package/dist/authoring/session-lease.js +190 -0
  139. package/dist/authoring/session-lease.js.map +1 -0
  140. package/dist/cli.d.ts +3 -0
  141. package/dist/cli.d.ts.map +1 -0
  142. package/dist/cli.js +529 -0
  143. package/dist/cli.js.map +1 -0
  144. package/dist/config/credentials.d.ts +16 -0
  145. package/dist/config/credentials.d.ts.map +1 -0
  146. package/dist/config/credentials.js +93 -0
  147. package/dist/config/credentials.js.map +1 -0
  148. package/dist/config/store.d.ts +37 -0
  149. package/dist/config/store.d.ts.map +1 -0
  150. package/dist/config/store.js +142 -0
  151. package/dist/config/store.js.map +1 -0
  152. package/dist/core/assets.d.ts +5 -0
  153. package/dist/core/assets.d.ts.map +1 -0
  154. package/dist/core/assets.js +46 -0
  155. package/dist/core/assets.js.map +1 -0
  156. package/dist/core/errors.d.ts +19 -0
  157. package/dist/core/errors.d.ts.map +1 -0
  158. package/dist/core/errors.js +36 -0
  159. package/dist/core/errors.js.map +1 -0
  160. package/dist/core/interrupt.d.ts +8 -0
  161. package/dist/core/interrupt.d.ts.map +1 -0
  162. package/dist/core/interrupt.js +54 -0
  163. package/dist/core/interrupt.js.map +1 -0
  164. package/dist/core/json.d.ts +5 -0
  165. package/dist/core/json.d.ts.map +1 -0
  166. package/dist/core/json.js +21 -0
  167. package/dist/core/json.js.map +1 -0
  168. package/dist/core/version.d.ts +8 -0
  169. package/dist/core/version.d.ts.map +1 -0
  170. package/dist/core/version.js +8 -0
  171. package/dist/core/version.js.map +1 -0
  172. package/dist/integrations/manager.d.ts +12 -0
  173. package/dist/integrations/manager.d.ts.map +1 -0
  174. package/dist/integrations/manager.js +218 -0
  175. package/dist/integrations/manager.js.map +1 -0
  176. package/dist/integrations/routing.d.ts +105 -0
  177. package/dist/integrations/routing.d.ts.map +1 -0
  178. package/dist/integrations/routing.js +85 -0
  179. package/dist/integrations/routing.js.map +1 -0
  180. package/dist/mcp/server.d.ts +4 -0
  181. package/dist/mcp/server.d.ts.map +1 -0
  182. package/dist/mcp/server.js +69 -0
  183. package/dist/mcp/server.js.map +1 -0
  184. package/dist/mcp/tools.d.ts +30 -0
  185. package/dist/mcp/tools.d.ts.map +1 -0
  186. package/dist/mcp/tools.js +345 -0
  187. package/dist/mcp/tools.js.map +1 -0
  188. package/dist/project/config.d.ts +15 -0
  189. package/dist/project/config.d.ts.map +1 -0
  190. package/dist/project/config.js +46 -0
  191. package/dist/project/config.js.map +1 -0
  192. package/dist/run/progress.d.ts +5 -0
  193. package/dist/run/progress.d.ts.map +1 -0
  194. package/dist/run/progress.js +29 -0
  195. package/dist/run/progress.js.map +1 -0
  196. package/dist/script/service.d.ts +42 -0
  197. package/dist/script/service.d.ts.map +1 -0
  198. package/dist/script/service.js +457 -0
  199. package/dist/script/service.js.map +1 -0
  200. package/dist/sdk/authoring.d.ts +19 -0
  201. package/dist/sdk/authoring.d.ts.map +1 -0
  202. package/dist/sdk/authoring.js +43 -0
  203. package/dist/sdk/authoring.js.map +1 -0
  204. package/dist/sdk/client.d.ts +49 -0
  205. package/dist/sdk/client.d.ts.map +1 -0
  206. package/dist/sdk/client.js +241 -0
  207. package/dist/sdk/client.js.map +1 -0
  208. package/dist/skills/catalog.d.ts +7 -0
  209. package/dist/skills/catalog.d.ts.map +1 -0
  210. package/dist/skills/catalog.js +59 -0
  211. package/dist/skills/catalog.js.map +1 -0
  212. package/package.json +45 -0
@@ -0,0 +1,137 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/run.schema.json",
4
+ "title": "XAgent Run v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "id", "status", "script_snapshot", "device_executions"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-run/v1"},
10
+ "id": {"type": "string", "minLength": 1},
11
+ "status": {
12
+ "enum": [
13
+ "validating",
14
+ "queued",
15
+ "waiting_device",
16
+ "running",
17
+ "passed",
18
+ "failed",
19
+ "infrastructure_failed",
20
+ "cancelling",
21
+ "cancelled",
22
+ "timed_out"
23
+ ]
24
+ },
25
+ "script_snapshot": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["source_hash", "canonical_hash", "schema_version", "compiler_version"],
29
+ "properties": {
30
+ "source_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
31
+ "canonical_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
32
+ "schema_version": {"const": "xagent-script/v1"},
33
+ "compiler_version": {"const": "xagent-compiler/1"}
34
+ }
35
+ },
36
+ "target_snapshot": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": ["target_name", "target_hash", "target", "devices"],
40
+ "properties": {
41
+ "target_name": {
42
+ "type": "string",
43
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
44
+ },
45
+ "target_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
46
+ "target": {"$ref": "execution-target.schema.json"},
47
+ "devices": {
48
+ "type": "array",
49
+ "minItems": 1,
50
+ "maxItems": 1,
51
+ "items": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": [
55
+ "device_id",
56
+ "platform",
57
+ "brand",
58
+ "model",
59
+ "os_version",
60
+ "resolution",
61
+ "available"
62
+ ],
63
+ "properties": {
64
+ "device_id": {"type": "string", "minLength": 1, "maxLength": 128},
65
+ "platform": {"type": "string", "minLength": 1, "maxLength": 64},
66
+ "brand": {"type": "string", "minLength": 1, "maxLength": 128},
67
+ "model": {"type": "string", "minLength": 1, "maxLength": 128},
68
+ "os_version": {"type": "string", "minLength": 1, "maxLength": 64},
69
+ "resolution": {"type": "string", "minLength": 1, "maxLength": 64},
70
+ "available": {"type": "boolean"}
71
+ }
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "app_upload_id": {
77
+ "type": "string",
78
+ "pattern": "^appup_[a-f0-9]{32}$"
79
+ },
80
+ "billing": {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "required": ["status", "estimated_minutes", "billable_minutes", "cost", "discount_rate"],
84
+ "properties": {
85
+ "status": {"enum": ["pending", "succeeded", "failed", "unknown"]},
86
+ "estimated_minutes": {"type": "integer", "minimum": 0},
87
+ "billable_minutes": {"type": "integer", "minimum": 0},
88
+ "cost": {"type": "integer", "minimum": 0},
89
+ "discount_rate": {"type": "number", "minimum": 0}
90
+ }
91
+ },
92
+ "device_executions": {
93
+ "type": "array",
94
+ "minItems": 1,
95
+ "maxItems": 1,
96
+ "items": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["id", "device_id", "status"],
100
+ "properties": {
101
+ "id": {"type": "string", "minLength": 1},
102
+ "device_id": {"type": "string", "minLength": 1},
103
+ "device_name": {"type": "string", "minLength": 1},
104
+ "status": {
105
+ "enum": [
106
+ "created",
107
+ "waiting_resource",
108
+ "starting",
109
+ "running",
110
+ "passed",
111
+ "test_failed",
112
+ "infrastructure_failed",
113
+ "cancelling",
114
+ "cancelled",
115
+ "timed_out"
116
+ ]
117
+ },
118
+ "steps": {
119
+ "type": "array",
120
+ "items": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "required": ["sequence", "action", "status"],
124
+ "properties": {
125
+ "sequence": {"type": "integer", "minimum": 1},
126
+ "action": {"type": "string", "minLength": 1},
127
+ "status": {"enum": ["passed", "failed"]},
128
+ "message": {"type": "string"},
129
+ "screenshot_url": {"type": "string", "format": "uri"}
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/skill-catalog.schema.json",
4
+ "title": "XAgent Effective Skill Catalog v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "skills"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-skill-catalog/v1"},
10
+ "skills": {
11
+ "type": "array",
12
+ "items": {"$ref": "skill-summary.schema.json"}
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/skill-reference.schema.json",
4
+ "title": "XAgent Skill Reference v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "skill_name", "skill_version", "path", "media_type", "content"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-skill-reference/v1"},
10
+ "skill_name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
11
+ "skill_version": {"type": "string", "minLength": 1, "maxLength": 64},
12
+ "path": {"type": "string", "minLength": 1, "maxLength": 512},
13
+ "title": {"type": "string", "maxLength": 256},
14
+ "media_type": {"type": "string", "minLength": 1, "maxLength": 128},
15
+ "content": {"type": "string"}
16
+ }
17
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/skill-summary.schema.json",
4
+ "title": "XAgent Effective Skill Summary v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["name", "version", "trigger_description", "scope", "references", "updated_at"],
8
+ "properties": {
9
+ "name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
10
+ "version": {"type": "string", "minLength": 1, "maxLength": 64},
11
+ "trigger_description": {"type": "string", "maxLength": 1024},
12
+ "scope": {"enum": ["personal", "project", "enterprise", "platform"]},
13
+ "references": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["path", "media_type"],
19
+ "properties": {
20
+ "path": {"type": "string", "minLength": 1, "maxLength": 512},
21
+ "title": {"type": "string", "maxLength": 256},
22
+ "media_type": {"type": "string", "minLength": 1, "maxLength": 128}
23
+ }
24
+ }
25
+ },
26
+ "updated_at": {"type": "string", "format": "date-time"}
27
+ }
28
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/skill.schema.json",
4
+ "title": "XAgent Effective Skill v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "name", "version", "trigger_description", "scope", "references", "updated_at", "skill_md"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-skill/v1"},
10
+ "name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
11
+ "version": {"type": "string", "minLength": 1, "maxLength": 64},
12
+ "trigger_description": {"type": "string", "maxLength": 1024},
13
+ "scope": {"enum": ["personal", "project", "enterprise", "platform"]},
14
+ "references": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["path", "media_type"],
20
+ "properties": {
21
+ "path": {"type": "string", "minLength": 1, "maxLength": 512},
22
+ "title": {"type": "string", "maxLength": 256},
23
+ "media_type": {"type": "string", "minLength": 1, "maxLength": 128}
24
+ }
25
+ }
26
+ },
27
+ "updated_at": {"type": "string", "format": "date-time"},
28
+ "skill_md": {"type": "string", "minLength": 1}
29
+ }
30
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/target-preview.schema.json",
4
+ "title": "XAgent Target Preview v1",
5
+ "oneOf": [
6
+ {"$ref": "#/$defs/request"},
7
+ {"$ref": "#/$defs/response"}
8
+ ],
9
+ "$defs": {
10
+ "request": {
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": ["schema_version", "target_name", "target_hash", "target"],
14
+ "properties": {
15
+ "schema_version": {"const": "xagent-target-preview/v1"},
16
+ "target_name": {
17
+ "type": "string",
18
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
19
+ },
20
+ "target_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
21
+ "target": {"$ref": "execution-target.schema.json"}
22
+ }
23
+ },
24
+ "response": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": [
28
+ "schema_version",
29
+ "target_name",
30
+ "target_hash",
31
+ "devices",
32
+ "previewed_at",
33
+ "reserved"
34
+ ],
35
+ "properties": {
36
+ "schema_version": {"const": "xagent-target-preview/v1"},
37
+ "target_name": {
38
+ "type": "string",
39
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
40
+ },
41
+ "target_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
42
+ "devices": {
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "maxItems": 1,
46
+ "items": {"$ref": "#/$defs/device_summary"}
47
+ },
48
+ "previewed_at": {"type": "string", "format": "date-time"},
49
+ "reserved": {"const": false}
50
+ }
51
+ },
52
+ "device_summary": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": [
56
+ "device_id",
57
+ "platform",
58
+ "brand",
59
+ "model",
60
+ "os_version",
61
+ "resolution",
62
+ "available"
63
+ ],
64
+ "properties": {
65
+ "device_id": {"type": "string", "minLength": 1, "maxLength": 128},
66
+ "platform": {"type": "string", "minLength": 1, "maxLength": 64},
67
+ "brand": {"type": "string", "minLength": 1, "maxLength": 128},
68
+ "model": {"type": "string", "minLength": 1, "maxLength": 128},
69
+ "os_version": {"type": "string", "minLength": 1, "maxLength": 64},
70
+ "resolution": {"type": "string", "minLength": 1, "maxLength": 64},
71
+ "available": {"type": "boolean"}
72
+ }
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "schema_version": "xagent-skill/v1",
3
+ "skill_name": "xagent-skill",
4
+ "skill_version": "0.3.5",
5
+ "minimum_cli_version": "0.3.5",
6
+ "default_domain": "action",
7
+ "mcp_protocol": "stdio",
8
+ "route_table_hash": "sha256:5aa8f83d0093cbcb93d661e60b1d516ef377402e41619cec2fae6ffb36eb6a5e",
9
+ "routes": [
10
+ { "domain": "action", "mode": "action", "skill": "xagent-explore-device", "side_effects": true },
11
+ { "domain": "author", "mode": "author", "skill": "xagent-author-test", "side_effects": true },
12
+ { "domain": "run", "mode": "run", "skill": "xagent-run-test", "side_effects": true },
13
+ { "domain": "analyze", "mode": "analyze", "skill": "xagent-analyze-failure", "side_effects": false },
14
+ { "domain": "repair", "mode": "repair", "skill": "xagent-repair-test", "side_effects": true },
15
+ { "domain": "report", "mode": "report", "skill": "xagent-test-report", "side_effects": false }
16
+ ]
17
+ }
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: xagent-skill
3
+ description: Use XAgent to inspect or control an Android device, author and verify a YAML test, run an existing test, analyze evidence, repair an explicitly selected test, or produce a report. Install this Skill once and let it route each request to exactly one XAgent CLI/MCP workflow.
4
+ ---
5
+
6
+ # XAgent
7
+
8
+ This is the single Agent Host entry for XAgent. The CLI is the cross-platform execution client and `xagent-local` MCP is the stateful Tool adapter. They use the same public API contracts and route table; this Skill must not reimplement device or test business logic.
9
+
10
+ ## Before Any Operation
11
+
12
+ 1. Check that `xagent` is installed and that its version satisfies `manifest.json`.
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.
17
+
18
+ The choices are: `action` (direct device control), `author` (write and verify a test), `run` (execute existing YAML), `analyze` (read-only evidence analysis), `repair` (authorized test repair), and `report` (evidence report). `setup` is an entry check only and is not a user business mode.
19
+
20
+ ## Execution Boundary
21
+
22
+ - Prefer the connected MCP mode for Agent work. It keeps the device Session, current screen, renewal, and release state between Tool calls.
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.
27
+
28
+ Read the relevant file in `references/` only after the domain is selected. The Skill owns routing and safety gates; the routed Skill owns its workflow.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: XAgent
3
+ short_description: Route XAgent device and test requests through one verified CLI/MCP Skill.
4
+ default_prompt: Check the XAgent CLI, MCP connection, manifest, and route before any side effect; action is the default.
@@ -0,0 +1,10 @@
1
+ # CLI and MCP Interoperability
2
+
3
+ CLI and MCP are adapters over the same XAgent Developer API. They do not maintain separate execution semantics:
4
+
5
+ - `action` MCP owns a long-lived device Session and current screen between calls.
6
+ - Direct CLI action calls are explicit and must include the Session and screen identifiers returned by the previous call.
7
+ - Authoring, Run, upload, analysis, repair, and report use the same public schemas, authorization rules, idempotency behavior, and result statuses in both adapters.
8
+ - The external Skill only routes and validates. It must call the selected CLI/MCP surface instead of copying server or device logic.
9
+
10
+ If MCP is unavailable, a terminal/CI workflow can still use the CLI after the same manifest, profile, capability, and route checks. A missing MCP connection is not permission to guess a different mode.
@@ -0,0 +1,9 @@
1
+ # Host Adapters
2
+
3
+ Codex, Claude, Trae, and WorkBuddy may expose different Skill reload and MCP configuration UIs. The package remains identical. The Host must:
4
+
5
+ 1. Import the directory containing the root `SKILL.md`.
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.
8
+
9
+ Do not assume that a Host supports structured user-choice UI. If it does not, ask for a plain-text domain choice. `step_confirm` is an Agent Host interaction policy and is never sent to the XAgent API.
@@ -0,0 +1,10 @@
1
+ # Installation
2
+
3
+ The customer installs two independent artifacts:
4
+
5
+ 1. The execution client: `npm install --global @testin-official/xagent`.
6
+ 2. This directory, `xagent-skill/`, in the Agent Host's Skill directory.
7
+
8
+ The Skill does not contain a Token and does not require a Python runtime. On Windows use `scripts/install-cli.ps1`; on macOS/Linux use `scripts/install-cli.sh` when the Host permits scripts. Otherwise show the equivalent npm command and wait for the user to run it.
9
+
10
+ After installation, restart the Agent Host or reload its Skill catalog and start the `xagent-local` MCP entry configured by the Host. Do not overwrite an existing Host configuration automatically.
@@ -0,0 +1,3 @@
1
+ # Credentials and Data
2
+
3
+ Never put Developer Tokens, browser Cookies, passwords, or APK contents in this Skill package or in a YAML file. The CLI reads credentials from its Profile credential store or the named CI environment variable. Screenshots and test evidence are sent only through the configured XAgent/file-service endpoints when the selected workflow requires them.
@@ -0,0 +1,32 @@
1
+ # Routing Contract
2
+
3
+ The route is an immutable one-to-one mapping. Select one row before a side effect:
4
+
5
+ | Domain | MCP mode | Routed Skill | Side effects |
6
+ |---|---|---|---|
7
+ | action | action | xagent-explore-device | yes |
8
+ | author | author | xagent-author-test | yes |
9
+ | run | run | xagent-run-test | yes |
10
+ | analyze | analyze | xagent-analyze-failure | no |
11
+ | repair | repair | xagent-repair-test | yes |
12
+ | report | report | xagent-test-report | no |
13
+
14
+ `setup` is reserved for read-only discovery and routing. It is not in the behavior choices.
15
+
16
+ Use the CLI equivalents:
17
+
18
+ ```text
19
+ xagent --json integrations options
20
+ xagent --json integrations route action --profile PROFILE
21
+ xagent --json integrations verify-skill PATH_TO_XAGENT_SKILL
22
+ ```
23
+
24
+ Use the MCP equivalents when available:
25
+
26
+ ```text
27
+ xagent_workflow_options
28
+ xagent_workflow_route(domain="action")
29
+ xagent_skill_load_local(skill="xagent-explore-device")
30
+ ```
31
+
32
+ The selected route's `domain`, `mode`, and `skill` must match exactly. A mismatch is a hard stop, not a fallback.
@@ -0,0 +1,5 @@
1
+ $ErrorActionPreference = "Stop"
2
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) { throw "Node.js 20.9 or newer is required" }
3
+ if (-not (Get-Command npm -ErrorAction SilentlyContinue)) { throw "npm is required" }
4
+ npm install --global @testin-official/xagent
5
+ xagent --json version
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+ set -eu
3
+ command -v node >/dev/null 2>&1 || { echo "Node.js 20.9 or newer is required" >&2; exit 1; }
4
+ command -v npm >/dev/null 2>&1 || { echo "npm is required" >&2; exit 1; }
5
+ npm install --global @testin-official/xagent
6
+ xagent --json version
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: xagent-analyze-failure
3
+ description: Read-only analysis of an existing XAgent Run or Authoring Attempt result. Use when the user explicitly asks to analyze, explain, or classify a failure without side effects. Do not use to run, retry, cancel, author, repair, or directly control a device.
4
+ ---
5
+
6
+ # Analyze An XAgent Failure
7
+
8
+ 1. Read the explicit Run or Attempt result, or query it through CLI/MCP when the ID and permission are available.
9
+ 2. Classify the outcome using [failure-classification.md](references/failure-classification.md): separate schema/configuration/authentication failures, test behavior failures, infrastructure failures, cancellation, and timeout.
10
+ 3. Report the failing device, step index/action, public message, and available Artifact evidence. Do not invent an upstream cause absent from public output.
11
+ 4. State whether evidence indicates a transient infrastructure condition or a test-behavior problem. Do not turn that classification into a retry, edit, or workflow change.
12
+
13
+ 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.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "XAgent Failure Analysis"
3
+ short_description: "Analyze XAgent test and infrastructure failures"
4
+ default_prompt: "Use $xagent-analyze-failure in strict read-only mode to classify this existing result. Do not retry, cancel, edit YAML, control a device, create resources, or switch workflows."
@@ -0,0 +1,20 @@
1
+ # Failure Classification
2
+
3
+ Classify using the public status and evidence in this order:
4
+
5
+ 1. `schema_invalid`, `configuration_invalid`, `target_invalid`: input/configuration failure before execution.
6
+ 2. `authentication_required`, `token_*`, `token_type_mismatch`, `permission_denied`: authentication or authorization failure.
7
+ 3. `test_failed` or a failed step/assertion: product/test behavior failure.
8
+ 4. `infrastructure_failed`, `device_unavailable`, upload/control connection errors, and `secure.keyboard.not.exist.keycode`: infrastructure failure. A visible numeric keyboard or successful visible-key click does not prove secure `deviceInput` is healthy.
9
+ 5. `cancelled`: requested or propagated cancellation.
10
+ 6. `timeout`: caller deadline. If a Run, Session, or Attempt ID exists, query it once before deciding the final business state.
11
+
12
+ Record:
13
+
14
+ - Public Run or Attempt ID.
15
+ - Device ID/name when public.
16
+ - Step index, action, status, and message.
17
+ - Before/after screenshots or other public Artifact URLs.
18
+ - Whether the evidence is transient infrastructure, test behavior, permission, or platform evidence. Classification is not authorization for a follow-up operation.
19
+
20
+ Do not infer model output, upstream raw responses, database state, or internal service addresses from a generic public error.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: xagent-author-test
3
+ description: Create a new XAgent YAML test from an explicit script-authoring request and incrementally verify it on one real device. Use when the user asks to write, create, or generate a test/YAML from a goal or artifact. Do not use for action mode, direct device control, running unchanged YAML, read-only analysis, or repair without explicit edit authorization.
4
+ ---
5
+
6
+ # Author An XAgent Test
7
+
8
+ 1. Resolve the execution mode (`step_confirm` or `auto`) and input source (`goal` or `artifact`) before creating cloud resources. Read [interaction-modes.md](references/interaction-modes.md), [authoring-workflow.md](references/authoring-workflow.md), and [host-interaction-adapters.md](references/host-interaction-adapters.md).
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).
16
+
17
+ The local Agent generates and corrects the YAML. XAgent validates, records Attempts and the single Revision, and executes on the device.
18
+
19
+ This capability may create local YAML, execute Draft Steps, and create one confirmed final Revision. It must not use the scriptless Action workflow, create a formal Run, repair an existing failed test without explicit repair intent, or automatically hand off to another Skill. `step_confirm` and `auto` only control confirmation inside Author and never override a user-selected action mode.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "XAgent Test Authoring"
3
+ short_description: "Create and verify XAgent YAML on a cloud device"
4
+ default_prompt: "Use $xagent-author-test only because I requested a new script/YAML. Create a local working draft, verify Draft Steps, and create one final Revision after confirmation; do not use direct action mode, create a Run, repair an unrelated script, or switch workflows."
@@ -0,0 +1,41 @@
1
+ # Authoring Workflow
2
+
3
+ Authoring requires a personal Token with `authoring:read`, `authoring:write`, and `authoring:execute`.
4
+
5
+ 1. Resolve `step_confirm` or `auto` and choose the local workspace before creating cloud resources. Read [interaction-modes.md](interaction-modes.md).
6
+ 2. Create one Session for an explicit device ID and observe the device.
7
+ 3. Build the current local working YAML incrementally from the goal or selected artifact. The snapshot must be valid, but it should contain only the steps authored so far rather than an unverified end-to-end plan. Save `draft.yaml`, `state.json`, and a numbered checkpoint before the first side effect.
8
+ 4. For each provisional step, validate the current complete YAML snapshot, save a pre-attempt checkpoint, and call `xagent_authoring_draft_step_execute` (or CLI `authoring draft-step`). After evidence is returned, author the next step. This executes the current step without creating a Revision.
9
+ 5. Present the Draft Attempt status and public Artifacts. In `step_confirm`, wait on a structured continue-or-modify choice. In `auto`, continue successful steps unless a stop condition or newer user instruction exists. Save the returned state before any next side effect.
10
+ 6. On a new user requirement, do not ask the user to say that the complete draft should be adjusted. Save the prior state, Observe the device again, reconcile the required entry state for the next step of the new goal, then revise only invalid authored steps and append the next step to the current local YAML snapshot. Save another checkpoint. Include explicit recovery or navigation steps when the current page does not expose the next required control. Replay only the affected scope and its required prerequisites from the observed device state. If recovery cannot be established safely, pause for a user decision instead of executing against the wrong screen.
11
+ 7. After the final Host confirmation, validate the complete local YAML and create exactly one formal Revision (`base_revision_id: null` for a new Session). Then Complete the Session.
12
+ 8. If the Session is cancelled or expires, release the device; local checkpoints may remain for explicit resume. A formal full-script Run remains a separate explicit action.
13
+
14
+ Do not create intermediate Revisions, submit step-only patches, upload local checkpoint files, publish a platform script, or start a formal Run implicitly. Session completion releases the device.
15
+
16
+ ## Device Occupancy Lifecycle
17
+
18
+ A Session occupies one real device until it is completed, cancelled, or reaches `expires_at`. Release the device explicitly whenever authoring stops early.
19
+
20
+ - `expires_at` is an absolute deadline returned by `authoring start` and `authoring show`. The device is released at that instant whether or not authoring finished.
21
+ - The CLI and MCP host track Sessions they own. Before a Session-bound side effect, they check the current deadline and call `xagent_authoring_session_renew` automatically when no more than 15 minutes remain. Idle registration does not renew in the background. A workflow that must stay idle beyond the server TTL must run `xagent authoring keepalive <sessionId>` (or `xagent device keepalive <sessionId>`) in a foreground terminal.
22
+ - Before a long local generation, user wait, or resumed conversation, check the Session again. Automatic renewal is best effort and must never hide a renewal error or execute device work against an expired Session.
23
+ - `authoring complete <sessionId> <revisionId>` and `authoring cancel <sessionId>` release the device early. Both require an idempotency key.
24
+ - Abandoning a Session keeps the device occupied until `expires_at` passes. Call `authoring cancel` explicitly when the user stops, the goal becomes unreachable, or an error ends authoring.
25
+ - After expiration, the Session reaches `EXPIRED` and the device is released. Local workspace and checkpoints survive. Recover by starting a new Session and resuming from the last checkpoint; retrying calls against an expired Session are rejected.
26
+
27
+ Renewal and release rules:
28
+
29
+ | Situation | Required behavior |
30
+ |---|---|
31
+ | Session created or device acquired | Register the returned `session_id` and `expires_at` in the current CLI/MCP host only. |
32
+ | No more than 15 minutes remain | Renew the same Session and device occupancy before the next side effect. Do not acquire a second device or change the Session ID. |
33
+ | Renewal fails | Report the error, retry with a bounded backoff, and stop the next device side effect until the Session is confirmed active. |
34
+ | Session already expired | Do not renew or replay steps. Create a new Session, Observe the current device, and recover from the latest local checkpoint. |
35
+ | `step_confirm` waiting for the user | Keep the Session registered and renew it before resuming; do not release it merely because the Agent is waiting. |
36
+ | Final Revision confirmed | Call `xagent_authoring_complete`, then unregister the local lease. |
37
+ | User cancels, abandons the goal, or authoring cannot continue | Call `xagent_authoring_cancel`, then unregister the local lease. |
38
+ | MCP process interruption | Best-effort cancel Sessions owned by that MCP process; server-side expiration scanning remains the crash-recovery fallback. |
39
+ | Temporary APK no longer needed | Release the upload separately after all dependent Runs or Sessions finish. |
40
+
41
+ Lease ownership is local host state. It is not sent as a new XAgent API field, and it does not replace the server's Redis/database lease or expiration scanner.