@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,380 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/contracts/developer/v1/compat-script.schema.json",
4
+ "title": "XAgent Compat Platform Editor Script",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "name", "steps"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-compat-script/v1"},
10
+ "name": {"type": "string", "minLength": 1, "maxLength": 255},
11
+ "description": {"type": "string"},
12
+ "package_id": {"type": "integer", "minimum": 1},
13
+ "runtime_version": {"type": "integer", "minimum": 1},
14
+ "metadata": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "appid": {"type": ["integer", "null"]},
19
+ "dir_id": {"type": ["integer", "null"]},
20
+ "ostype": {"type": ["integer", "null"]},
21
+ "script_type": {"type": ["integer", "null"]},
22
+ "tags": {"type": ["string", "null"]},
23
+ "record_type": {"type": ["integer", "null"]},
24
+ "update_desc": {"type": ["string", "null"]}
25
+ }
26
+ },
27
+ "steps": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}},
28
+ "variables": {
29
+ "oneOf": [
30
+ {"type": "object", "additionalProperties": true},
31
+ {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "object",
35
+ "additionalProperties": true,
36
+ "required": ["key", "type", "defaultValue"],
37
+ "properties": {
38
+ "key": {"type": "string", "minLength": 1},
39
+ "type": {"enum": ["string", "number", "bool", "array", "object"]},
40
+ "defaultValue": true
41
+ }
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ "content_fields": {
47
+ "type": "object",
48
+ "additionalProperties": true,
49
+ "not": {"anyOf": [{"required": ["steps"]}, {"required": ["variables"]}, {"required": ["runtime"]}]}
50
+ }
51
+ },
52
+ "$defs": {
53
+ "spatialConstraint": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": ["relation"],
57
+ "properties": {
58
+ "anchor": {"type": "string", "minLength": 1},
59
+ "relation": {"type": "string", "minLength": 1}
60
+ }
61
+ },
62
+ "judgePart": {
63
+ "type": "object",
64
+ "additionalProperties": true,
65
+ "required": ["kind"],
66
+ "properties": {
67
+ "kind": {"enum": ["expr", "ai_assert", "ui_exists", "group"]},
68
+ "expr": {"type": "string"},
69
+ "text": {"type": "string"},
70
+ "target": {"type": "string"},
71
+ "match": {"type": "string"},
72
+ "logic": {"enum": ["single", "and", "or", "not"]},
73
+ "parts": {"type": "array", "items": {"$ref": "#/$defs/judgePart"}}
74
+ }
75
+ },
76
+ "judge": {
77
+ "type": "object",
78
+ "additionalProperties": true,
79
+ "required": ["logic", "parts"],
80
+ "properties": {
81
+ "raw": {"type": "string"},
82
+ "logic": {"enum": ["single", "and", "or", "not"]},
83
+ "parts": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/judgePart"}}
84
+ }
85
+ },
86
+ "editorFields": {
87
+ "type": "object",
88
+ "properties": {
89
+ "frontStepType": {"enum": ["step", "paragraph", "if", "else-if", "else"]},
90
+ "userText": {"type": "string"},
91
+ "desc": {"type": "string"},
92
+ "description": {"type": "string"},
93
+ "stepIdFront": {"type": "string"},
94
+ "stepIndex": {"type": "integer", "minimum": 0},
95
+ "descVisible": {"type": "boolean"},
96
+ "isEdit": {"type": "boolean"},
97
+ "actionLocked": {"type": "boolean"},
98
+ "ai_content": {"type": "string"},
99
+ "content": {"type": "string"},
100
+ "task": {"type": "string"},
101
+ "element": {"type": "string"},
102
+ "actionText": {"type": "string"},
103
+ "smartWaitDisplay": {"type": "boolean"},
104
+ "smart_wait_display": {"type": "boolean"},
105
+ "postWaitCondition": {"type": "string"},
106
+ "post_wait_condition": {"type": "string"},
107
+ "conditionAst": {"type": "object"},
108
+ "userTextAst": {"type": "object"},
109
+ "targetAst": {"type": "object"},
110
+ "textAst": {"type": "object"},
111
+ "messageAst": {"type": "object"},
112
+ "valueAst": {"type": "object"},
113
+ "postWaitConditionAst": {"type": "object"},
114
+ "appPackageAst": {"type": "object"},
115
+ "appNameAst": {"type": "object"},
116
+ "launchPathAst": {"type": "object"},
117
+ "urlAst": {"type": "object"},
118
+ "inputModeAst": {"type": "object"},
119
+ "keysAst": {"type": "object"},
120
+ "countAst": {"type": "object"},
121
+ "exprAst": {"type": "object"}
122
+ },
123
+ "patternProperties": {"^[A-Za-z_][A-Za-z0-9_]*Ast$": {"type": "object"}}
124
+ },
125
+ "normalStep": {
126
+ "allOf": [
127
+ {"$ref": "#/$defs/editorFields"},
128
+ {
129
+ "type": "object",
130
+ "required": ["frontStepType", "action", "userText", "desc"],
131
+ "properties": {"frontStepType": {"const": "step"}, "action": {"type": "string"}}
132
+ }
133
+ ]
134
+ },
135
+ "clickStep": {
136
+ "allOf": [
137
+ {"$ref": "#/$defs/normalStep"},
138
+ {
139
+ "required": ["target", "type"],
140
+ "properties": {
141
+ "action": {"const": "click"},
142
+ "target": {"type": "string", "minLength": 1},
143
+ "type": {"const": "text"}
144
+ }
145
+ }
146
+ ]
147
+ },
148
+ "inputStep": {
149
+ "allOf": [
150
+ {"$ref": "#/$defs/normalStep"},
151
+ {
152
+ "required": ["text"],
153
+ "properties": {
154
+ "action": {"const": "input"},
155
+ "text": {"type": "string"},
156
+ "target": {"type": "string", "minLength": 1},
157
+ "clearFirst": {"type": "boolean"},
158
+ "inputMode": {"enum": ["normal", "smart", "secret"]},
159
+ "keyboardLayout": {"enum": ["numeric", "alphabetic"]},
160
+ "input_mode": {"type": "string", "minLength": 1}
161
+ }
162
+ }
163
+ ]
164
+ },
165
+ "scrollStep": {
166
+ "allOf": [
167
+ {"$ref": "#/$defs/normalStep"},
168
+ {
169
+ "required": ["direction", "distance"],
170
+ "properties": {
171
+ "action": {"const": "scroll"},
172
+ "direction": {"enum": ["UP", "DOWN", "LEFT", "RIGHT"]},
173
+ "distance": {"type": "number"},
174
+ "target": {"type": "string", "minLength": 1},
175
+ "condition": {"type": "string", "minLength": 1},
176
+ "maxSwipes": {"type": "integer", "minimum": 1, "maximum": 1000},
177
+ "scope": {"enum": ["page", "container"]},
178
+ "containerRole": {"enum": ["horizontal", "vertical"]},
179
+ "containerAnchor": {"type": "string", "minLength": 1},
180
+ "containerHint": {"type": "string", "minLength": 1},
181
+ "scrollAreaTarget": {"type": "string", "minLength": 1},
182
+ "untilScope": {"enum": ["page", "container"]},
183
+ "stopMode": {"enum": ["visible", "position"]},
184
+ "untilMatchMode": {"type": "string", "minLength": 1},
185
+ "spatialConstraints": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/spatialConstraint"}}
186
+ }
187
+ }
188
+ ]
189
+ },
190
+ "installStep": {
191
+ "allOf": [
192
+ {"$ref": "#/$defs/normalStep"},
193
+ {
194
+ "properties": {
195
+ "action": {"const": "install"},
196
+ "appDownloadUrl": {"type": "string", "minLength": 1},
197
+ "url": {"type": "string", "minLength": 1},
198
+ "appUrl": {"type": "string", "minLength": 1},
199
+ "appPackage": {"type": "string", "minLength": 1},
200
+ "packageName": {"type": "string", "minLength": 1},
201
+ "coverInstall": {"type": "boolean"},
202
+ "resign": {"type": "boolean"}
203
+ },
204
+ "anyOf": [
205
+ {"required": ["appDownloadUrl"]}, {"required": ["url"]},
206
+ {"required": ["appUrl"]}, {"required": ["appPackage"]}
207
+ ]
208
+ }
209
+ ]
210
+ },
211
+ "appIdentityFields": {
212
+ "type": "object",
213
+ "properties": {
214
+ "appName": {"type": "string", "minLength": 1},
215
+ "appPackage": {"type": "string", "minLength": 1},
216
+ "packageName": {"type": "string", "minLength": 1},
217
+ "appDownloadUrl": {"type": "string", "minLength": 1}
218
+ },
219
+ "anyOf": [
220
+ {"required": ["appName"]}, {"required": ["appPackage"]},
221
+ {"required": ["packageName"]}, {"required": ["appDownloadUrl"]}
222
+ ]
223
+ },
224
+ "uninstallStep": {
225
+ "allOf": [
226
+ {"$ref": "#/$defs/normalStep"}, {"$ref": "#/$defs/appIdentityFields"},
227
+ {"properties": {"action": {"const": "uninstall"}}}
228
+ ]
229
+ },
230
+ "appLaunchStep": {
231
+ "allOf": [
232
+ {"$ref": "#/$defs/normalStep"}, {"$ref": "#/$defs/appIdentityFields"},
233
+ {"properties": {"action": {"const": "appLaunch"}, "launchPath": {"type": "string", "minLength": 1}}}
234
+ ]
235
+ },
236
+ "appStopStep": {
237
+ "allOf": [
238
+ {"$ref": "#/$defs/normalStep"}, {"$ref": "#/$defs/appIdentityFields"},
239
+ {"properties": {"action": {"const": "appStop"}}}
240
+ ]
241
+ },
242
+ "appCleanStep": {
243
+ "allOf": [
244
+ {"$ref": "#/$defs/normalStep"}, {"$ref": "#/$defs/appIdentityFields"},
245
+ {"properties": {"action": {"const": "appClean"}}}
246
+ ]
247
+ },
248
+ "waitForStep": {
249
+ "allOf": [
250
+ {"$ref": "#/$defs/normalStep"},
251
+ {
252
+ "properties": {
253
+ "action": {"const": "waitFor"},
254
+ "time": {"type": ["integer", "number", "string"], "minimum": 0, "maximum": 3600000},
255
+ "condition": {"type": "string", "minLength": 1},
256
+ "judge": {"$ref": "#/$defs/judge"},
257
+ "target": {"type": "string", "minLength": 1},
258
+ "timeout": {"type": ["integer", "number", "string"], "minimum": 1, "maximum": 3600000}
259
+ },
260
+ "anyOf": [
261
+ {"required": ["time"]}, {"required": ["condition"]},
262
+ {"required": ["judge"]}, {"required": ["target"]}
263
+ ]
264
+ }
265
+ ]
266
+ },
267
+ "assertStep": {
268
+ "allOf": [
269
+ {"$ref": "#/$defs/normalStep"},
270
+ {
271
+ "properties": {
272
+ "action": {"const": "assert"},
273
+ "target": {"type": "string", "minLength": 1},
274
+ "condition": {"type": "string", "minLength": 1},
275
+ "judge": {"$ref": "#/$defs/judge"},
276
+ "conditionType": {"type": "string", "minLength": 1},
277
+ "text": {"type": "string"},
278
+ "message": {"type": "string"}
279
+ },
280
+ "anyOf": [{"required": ["target"]}, {"required": ["condition"]}, {"required": ["judge"]}]
281
+ }
282
+ ]
283
+ },
284
+ "screenshotStep": {
285
+ "allOf": [
286
+ {"$ref": "#/$defs/normalStep"},
287
+ {"properties": {"action": {"const": "screenshot"}, "var": {"type": "string", "minLength": 1}}}
288
+ ]
289
+ },
290
+ "setStep": {
291
+ "allOf": [
292
+ {"$ref": "#/$defs/normalStep"},
293
+ {
294
+ "required": ["varName", "value"],
295
+ "properties": {"action": {"const": "set"}, "varName": {"type": "string", "minLength": 1}, "value": true}
296
+ }
297
+ ]
298
+ },
299
+ "pressBackStep": {
300
+ "allOf": [{"$ref": "#/$defs/normalStep"}, {"properties": {"action": {"const": "press_back"}}}]
301
+ },
302
+ "pressHomeStep": {
303
+ "allOf": [{"$ref": "#/$defs/normalStep"}, {"properties": {"action": {"const": "press_home"}}}]
304
+ },
305
+ "paragraphStep": {
306
+ "allOf": [
307
+ {"$ref": "#/$defs/editorFields"},
308
+ {
309
+ "type": "object",
310
+ "required": ["frontStepType", "userText", "desc", "children"],
311
+ "properties": {
312
+ "frontStepType": {"const": "paragraph"},
313
+ "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
314
+ }
315
+ }
316
+ ]
317
+ },
318
+ "ifStep": {
319
+ "allOf": [
320
+ {"$ref": "#/$defs/editorFields"},
321
+ {
322
+ "type": "object",
323
+ "required": ["frontStepType", "action", "userText", "desc", "children"],
324
+ "properties": {
325
+ "frontStepType": {"const": "if"},
326
+ "action": {"const": "if"},
327
+ "condition": {"type": "string", "minLength": 1},
328
+ "judge": {"$ref": "#/$defs/judge"},
329
+ "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}},
330
+ "elseIfChildren": {"type": "array", "items": {"$ref": "#/$defs/elseIfStep"}},
331
+ "elseChildren": {"type": "array", "items": {"$ref": "#/$defs/elseStep"}}
332
+ }
333
+ }
334
+ ]
335
+ },
336
+ "elseIfStep": {
337
+ "allOf": [
338
+ {"$ref": "#/$defs/editorFields"},
339
+ {
340
+ "type": "object",
341
+ "required": ["frontStepType", "action", "userText", "desc", "children"],
342
+ "properties": {
343
+ "frontStepType": {"const": "else-if"},
344
+ "action": {"const": "else-if"},
345
+ "condition": {"type": "string", "minLength": 1},
346
+ "judge": {"$ref": "#/$defs/judge"},
347
+ "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
348
+ }
349
+ }
350
+ ]
351
+ },
352
+ "elseStep": {
353
+ "allOf": [
354
+ {"$ref": "#/$defs/editorFields"},
355
+ {
356
+ "type": "object",
357
+ "required": ["frontStepType", "action", "userText", "desc", "children"],
358
+ "properties": {
359
+ "frontStepType": {"const": "else"},
360
+ "action": {"const": "else"},
361
+ "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
362
+ }
363
+ }
364
+ ]
365
+ },
366
+ "editorStep": {
367
+ "oneOf": [
368
+ {"$ref": "#/$defs/clickStep"}, {"$ref": "#/$defs/inputStep"},
369
+ {"$ref": "#/$defs/scrollStep"}, {"$ref": "#/$defs/installStep"},
370
+ {"$ref": "#/$defs/uninstallStep"}, {"$ref": "#/$defs/appLaunchStep"},
371
+ {"$ref": "#/$defs/appStopStep"}, {"$ref": "#/$defs/appCleanStep"},
372
+ {"$ref": "#/$defs/waitForStep"}, {"$ref": "#/$defs/assertStep"},
373
+ {"$ref": "#/$defs/screenshotStep"}, {"$ref": "#/$defs/setStep"},
374
+ {"$ref": "#/$defs/pressBackStep"}, {"$ref": "#/$defs/pressHomeStep"},
375
+ {"$ref": "#/$defs/paragraphStep"}, {"$ref": "#/$defs/ifStep"},
376
+ {"$ref": "#/$defs/elseIfStep"}, {"$ref": "#/$defs/elseStep"}
377
+ ]
378
+ }
379
+ }
380
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/contracts/developer/v1/device-list.schema.json",
4
+ "title": "XAgent Developer Device List",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "devices", "page", "page_size", "total"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-device-list/v1"},
10
+ "devices": {"type": "array", "items": {"$ref": "#/$defs/device"}},
11
+ "page": {"type": "integer", "minimum": 1},
12
+ "page_size": {"type": "integer", "minimum": 1, "maximum": 100},
13
+ "total": {"type": "integer", "minimum": 0}
14
+ },
15
+ "$defs": {
16
+ "nullableText": {"type": ["string", "null"]},
17
+ "device": {"type": "object", "additionalProperties": false, "required": ["device_id", "name", "platform", "brand", "model", "os_version", "resolution", "sdk_version", "available", "unavailable_reason"], "properties": {"device_id": {"type": "string", "minLength": 1}, "name": {"type": "string", "minLength": 1}, "platform": {"$ref": "#/$defs/nullableText"}, "brand": {"type": "string"}, "model": {"type": "string"}, "os_version": {"type": "string"}, "resolution": {"$ref": "#/$defs/nullableText"}, "sdk_version": {"type": ["integer", "null"], "minimum": 0}, "available": {"type": "boolean"}, "unavailable_reason": {"enum": [null, "device_busy", "connection_unavailable"]}}}
18
+ }
19
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/error.schema.json",
4
+ "title": "XAgent Developer API Error v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["api_version", "request_id", "error"],
8
+ "properties": {
9
+ "api_version": {"const": "v1"},
10
+ "request_id": {"type": "string", "minLength": 1},
11
+ "error": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["code", "message"],
15
+ "properties": {
16
+ "code": {
17
+ "enum": [
18
+ "invalid_request",
19
+ "schema_invalid",
20
+ "configuration_invalid",
21
+ "authentication_required",
22
+ "token_invalid",
23
+ "token_expired",
24
+ "token_revoked",
25
+ "token_type_mismatch",
26
+ "permission_denied",
27
+ "resource_not_found",
28
+ "target_not_found",
29
+ "target_invalid",
30
+ "target_hash_mismatch",
31
+ "idempotency_conflict",
32
+ "authoring_state_invalid",
33
+ "revision_conflict",
34
+ "attempt_in_progress",
35
+ "device_unavailable",
36
+ "test_failed",
37
+ "infrastructure_failed",
38
+ "cancelled",
39
+ "timeout"
40
+ ]
41
+ },
42
+ "message": {"type": "string", "minLength": 1},
43
+ "details": {"type": "object", "additionalProperties": true}
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/execution-target.schema.json",
4
+ "title": "XAgent Execution Target v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["concurrency"],
8
+ "properties": {
9
+ "device_ids": {
10
+ "type": "array",
11
+ "minItems": 1,
12
+ "maxItems": 1,
13
+ "uniqueItems": true,
14
+ "items": {"type": "string", "minLength": 1, "maxLength": 128}
15
+ },
16
+ "device_filters": {
17
+ "type": "array",
18
+ "minItems": 1,
19
+ "maxItems": 1,
20
+ "items": {"$ref": "#/$defs/device_filter"}
21
+ },
22
+ "concurrency": {"const": 1}
23
+ },
24
+ "oneOf": [
25
+ {
26
+ "required": ["device_ids"],
27
+ "not": {"required": ["device_filters"]}
28
+ },
29
+ {
30
+ "required": ["device_filters"],
31
+ "not": {"required": ["device_ids"]}
32
+ }
33
+ ],
34
+ "$defs": {
35
+ "device_filter": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["count", "strategy"],
39
+ "properties": {
40
+ "os": {"type": "string", "minLength": 1, "maxLength": 64},
41
+ "brand": {"type": "string", "minLength": 1, "maxLength": 128},
42
+ "model": {"type": "string", "minLength": 1, "maxLength": 128},
43
+ "resolution": {"type": "string", "minLength": 1, "maxLength": 64},
44
+ "count": {"const": 1},
45
+ "strategy": {"enum": ["random", "weight"]}
46
+ },
47
+ "anyOf": [
48
+ {"required": ["os"]},
49
+ {"required": ["brand"]},
50
+ {"required": ["model"]},
51
+ {"required": ["resolution"]}
52
+ ]
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "revision_id": "rev_0123456789abcdef0123456789abcdef",
3
+ "step_index": 0
4
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "attempt_0123456789abcdef0123456789abcdef",
3
+ "schema_version": "xagent-authoring-attempt/v1",
4
+ "session_id": "auth_0123456789abcdef0123456789abcdef",
5
+ "revision_id": "rev_0123456789abcdef0123456789abcdef",
6
+ "script_source": "revision",
7
+ "script_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
+ "step_index": 0,
9
+ "status": "PASSED",
10
+ "started_at": "2026-08-05T12:03:00",
11
+ "finished_at": "2026-08-05T12:03:02",
12
+ "result": {"success": true},
13
+ "artifacts": [
14
+ {"type": "screenshot", "url": "https://files.example/authoring/step.png"}
15
+ ]
16
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "script": {
3
+ "schema_version": "xagent-script/v1",
4
+ "name": "草稿步骤验证",
5
+ "steps": [
6
+ {"action": "click", "target": "登录"}
7
+ ]
8
+ },
9
+ "step_index": 0
10
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "schema_version": "xagent-authoring-observation/v1",
3
+ "session_id": "auth_0123456789abcdef0123456789abcdef",
4
+ "device_id": "device-1",
5
+ "screenshot_url": "https://files.example/authoring/observe.png",
6
+ "captured_at": "2026-08-05T12:02:00"
7
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "rev_0123456789abcdef0123456789abcdef",
3
+ "schema_version": "xagent-authoring-revision/v1",
4
+ "session_id": "auth_0123456789abcdef0123456789abcdef",
5
+ "number": 1,
6
+ "source": "agent",
7
+ "script": {
8
+ "schema_version": "xagent-script/v1",
9
+ "steps": [
10
+ {"action": "waitFor", "time": 1000}
11
+ ]
12
+ },
13
+ "source_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
+ "canonical_hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
15
+ "created_at": "2026-08-05T12:01:00"
16
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "auth_0123456789abcdef0123456789abcdef",
3
+ "schema_version": "xagent-authoring-session/v1",
4
+ "device_id": "device-1",
5
+ "status": "ACTIVE",
6
+ "current_revision_id": null,
7
+ "final_revision_id": null,
8
+ "console_url": "https://api.example.test/s/example-console-key",
9
+ "created_at": "2026-08-05T12:00:00",
10
+ "updated_at": "2026-08-05T12:00:01",
11
+ "expires_at": "2026-08-05T12:30:00"
12
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "schema_version": "xagent-canonical/v1",
3
+ "version": 1,
4
+ "variables": {
5
+ "username": "demo-user"
6
+ },
7
+ "steps": [
8
+ {"action": "prepareDevice"},
9
+ {"action": "install", "appPackage": "com.example.demo", "appDownloadUrl": "https://example.com/demo.apk"},
10
+ {"action": "appLaunch", "appPackage": "com.example.demo"},
11
+ {"action": "click", "target": "登录按钮"},
12
+ {"action": "input", "target": "用户名", "text": "{{username}}"},
13
+ {"action": "waitFor", "condition": "登录成功提示出现", "timeout": 10000},
14
+ {"action": "assert", "condition": "当前页面显示登录成功"},
15
+ {"action": "uninstall", "appPackage": "com.example.demo"}
16
+ ]
17
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "cases": [
3
+ {
4
+ "name": "run_passed",
5
+ "run_statuses": ["queued", "running", "passed"],
6
+ "expected_exit_code": 0
7
+ },
8
+ {
9
+ "name": "test_failed",
10
+ "run_statuses": ["queued", "running", "failed"],
11
+ "expected_exit_code": 1
12
+ },
13
+ {
14
+ "name": "configuration_invalid",
15
+ "error_code": "configuration_invalid",
16
+ "expected_exit_code": 2
17
+ },
18
+ {
19
+ "name": "token_type_mismatch",
20
+ "error_code": "token_type_mismatch",
21
+ "expected_exit_code": 3
22
+ },
23
+ {
24
+ "name": "cancelled",
25
+ "run_statuses": ["queued", "cancelling", "cancelled"],
26
+ "expected_exit_code": 4
27
+ },
28
+ {
29
+ "name": "device_unavailable",
30
+ "error_code": "device_unavailable",
31
+ "expected_exit_code": 5
32
+ },
33
+ {
34
+ "name": "infrastructure_failed",
35
+ "run_statuses": ["queued", "running", "infrastructure_failed"],
36
+ "expected_exit_code": 6
37
+ },
38
+ {
39
+ "name": "timed_out",
40
+ "run_statuses": ["queued", "running", "timed_out"],
41
+ "expected_exit_code": 7
42
+ }
43
+ ]
44
+ }