@testin-official/xagent 0.3.9 → 0.3.11

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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://xagent.testin.cn/schemas/developer/v1/authoring-device-acquire.schema.json",
4
+ "title": "XAgent Device Acquire v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "session", "observation"],
8
+ "properties": {
9
+ "schema_version": {"const": "xagent-device-acquire/v1"},
10
+ "session": {"$ref": "authoring-session.schema.json"},
11
+ "observation": {"$ref": "authoring-observation.schema.json"}
12
+ }
13
+ }
@@ -166,7 +166,7 @@
166
166
  "allOf": [
167
167
  {"$ref": "#/$defs/normalStep"},
168
168
  {
169
- "required": ["direction", "distance"],
169
+ "required": ["direction"],
170
170
  "properties": {
171
171
  "action": {"const": "scroll"},
172
172
  "direction": {"enum": ["UP", "DOWN", "LEFT", "RIGHT"]},
@@ -302,6 +302,142 @@
302
302
  "pressHomeStep": {
303
303
  "allOf": [{"$ref": "#/$defs/normalStep"}, {"properties": {"action": {"const": "press_home"}}}]
304
304
  },
305
+ "scrollBetweenStep": {
306
+ "allOf": [
307
+ {"$ref": "#/$defs/normalStep"},
308
+ {
309
+ "required": ["action"],
310
+ "properties": {
311
+ "action": {"const": "scroll_between"},
312
+ "from": {"type": "string", "minLength": 1},
313
+ "to": {"type": "string", "minLength": 1},
314
+ "from_target": {"type": "string", "minLength": 1},
315
+ "to_target": {"type": "string", "minLength": 1},
316
+ "duration": {"type": ["integer", "number"], "minimum": 1, "maximum": 3600000}
317
+ },
318
+ "anyOf": [
319
+ {"required": ["from", "to"]},
320
+ {"required": ["from_target", "to_target"]}
321
+ ]
322
+ }
323
+ ]
324
+ },
325
+ "dragStep": {
326
+ "allOf": [
327
+ {"$ref": "#/$defs/normalStep"},
328
+ {
329
+ "required": ["action"],
330
+ "properties": {
331
+ "action": {"const": "drag"},
332
+ "from": {"type": "string", "minLength": 1},
333
+ "to": {"type": "string", "minLength": 1},
334
+ "from_target": {"type": "string", "minLength": 1},
335
+ "to_target": {"type": "string", "minLength": 1},
336
+ "speed": {"type": "string", "minLength": 1}
337
+ },
338
+ "anyOf": [
339
+ {"required": ["from", "to"]},
340
+ {"required": ["from_target", "to_target"]}
341
+ ]
342
+ }
343
+ ]
344
+ },
345
+ "extractStep": {
346
+ "allOf": [
347
+ {"$ref": "#/$defs/normalStep"},
348
+ {
349
+ "required": ["target", "varName"],
350
+ "properties": {
351
+ "action": {"const": "extract"},
352
+ "target": {"type": "string", "minLength": 1},
353
+ "varName": {"type": "string", "minLength": 1},
354
+ "type": {"type": "string", "minLength": 1}
355
+ }
356
+ }
357
+ ]
358
+ },
359
+ "randomVarStep": {
360
+ "allOf": [
361
+ {"$ref": "#/$defs/normalStep"},
362
+ {
363
+ "required": ["varName", "type"],
364
+ "properties": {
365
+ "action": {"const": "randomVar"},
366
+ "varName": {"type": "string", "minLength": 1},
367
+ "type": {"enum": ["string", "number", "phone", "email"]},
368
+ "length": {"type": "integer", "minimum": 1, "maximum": 10000},
369
+ "min": {"type": "integer"},
370
+ "max": {"type": "integer"}
371
+ }
372
+ }
373
+ ]
374
+ },
375
+ "forStep": {
376
+ "allOf": [
377
+ {"$ref": "#/$defs/normalStep"},
378
+ {
379
+ "required": ["steps"],
380
+ "properties": {
381
+ "action": {"const": "for"},
382
+ "count": {
383
+ "oneOf": [
384
+ {"type": "integer", "minimum": 0},
385
+ {"type": "string", "minLength": 1}
386
+ ]
387
+ },
388
+ "condition": {"type": "string", "minLength": 1},
389
+ "judge": {"$ref": "#/$defs/judge"},
390
+ "dead_loop": {"type": "integer", "minimum": 1, "maximum": 10000},
391
+ "steps": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
392
+ },
393
+ "anyOf": [
394
+ {"required": ["count"]},
395
+ {"required": ["condition"]},
396
+ {"required": ["judge"]}
397
+ ]
398
+ }
399
+ ]
400
+ },
401
+ "throwStep": {
402
+ "allOf": [
403
+ {"$ref": "#/$defs/normalStep"},
404
+ {
405
+ "properties": {
406
+ "action": {"const": "throw"},
407
+ "message": {"type": "string", "minLength": 1},
408
+ "content": {"type": "string", "minLength": 1},
409
+ "text": {"type": "string", "minLength": 1}
410
+ },
411
+ "anyOf": [
412
+ {"required": ["message"]},
413
+ {"required": ["content"]},
414
+ {"required": ["text"]}
415
+ ]
416
+ }
417
+ ]
418
+ },
419
+ "breakStep": {
420
+ "allOf": [{"$ref": "#/$defs/normalStep"}, {"properties": {"action": {"const": "break"}}}]
421
+ },
422
+ "pressKeyStep": {
423
+ "allOf": [
424
+ {"$ref": "#/$defs/normalStep"},
425
+ {
426
+ "properties": {
427
+ "action": {"const": "press_key"},
428
+ "key": {"type": "string", "minLength": 1},
429
+ "keys": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}
430
+ },
431
+ "anyOf": [
432
+ {"required": ["key"]},
433
+ {"required": ["keys"]}
434
+ ]
435
+ }
436
+ ]
437
+ },
438
+ "pressEnterStep": {
439
+ "allOf": [{"$ref": "#/$defs/normalStep"}, {"properties": {"action": {"const": "press_enter"}}}]
440
+ },
305
441
  "paragraphStep": {
306
442
  "allOf": [
307
443
  {"$ref": "#/$defs/editorFields"},
@@ -310,7 +446,7 @@
310
446
  "required": ["frontStepType", "userText", "desc", "children"],
311
447
  "properties": {
312
448
  "frontStepType": {"const": "paragraph"},
313
- "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
449
+ "children": {"type": "array", "items": {"$ref": "#/$defs/editorStep"}}
314
450
  }
315
451
  }
316
452
  ]
@@ -326,7 +462,7 @@
326
462
  "action": {"const": "if"},
327
463
  "condition": {"type": "string", "minLength": 1},
328
464
  "judge": {"$ref": "#/$defs/judge"},
329
- "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}},
465
+ "children": {"type": "array", "items": {"$ref": "#/$defs/editorStep"}},
330
466
  "elseIfChildren": {"type": "array", "items": {"$ref": "#/$defs/elseIfStep"}},
331
467
  "elseChildren": {"type": "array", "items": {"$ref": "#/$defs/elseStep"}}
332
468
  }
@@ -344,7 +480,7 @@
344
480
  "action": {"const": "else-if"},
345
481
  "condition": {"type": "string", "minLength": 1},
346
482
  "judge": {"$ref": "#/$defs/judge"},
347
- "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
483
+ "children": {"type": "array", "items": {"$ref": "#/$defs/editorStep"}}
348
484
  }
349
485
  }
350
486
  ]
@@ -358,7 +494,7 @@
358
494
  "properties": {
359
495
  "frontStepType": {"const": "else"},
360
496
  "action": {"const": "else"},
361
- "children": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/editorStep"}}
497
+ "children": {"type": "array", "items": {"$ref": "#/$defs/editorStep"}}
362
498
  }
363
499
  }
364
500
  ]
@@ -372,6 +508,11 @@
372
508
  {"$ref": "#/$defs/waitForStep"}, {"$ref": "#/$defs/assertStep"},
373
509
  {"$ref": "#/$defs/screenshotStep"}, {"$ref": "#/$defs/setStep"},
374
510
  {"$ref": "#/$defs/pressBackStep"}, {"$ref": "#/$defs/pressHomeStep"},
511
+ {"$ref": "#/$defs/scrollBetweenStep"}, {"$ref": "#/$defs/dragStep"},
512
+ {"$ref": "#/$defs/extractStep"}, {"$ref": "#/$defs/randomVarStep"},
513
+ {"$ref": "#/$defs/forStep"}, {"$ref": "#/$defs/throwStep"},
514
+ {"$ref": "#/$defs/breakStep"}, {"$ref": "#/$defs/pressKeyStep"},
515
+ {"$ref": "#/$defs/pressEnterStep"},
375
516
  {"$ref": "#/$defs/paragraphStep"}, {"$ref": "#/$defs/ifStep"},
376
517
  {"$ref": "#/$defs/elseIfStep"}, {"$ref": "#/$defs/elseStep"}
377
518
  ]
@@ -188,6 +188,67 @@ steps:
188
188
  desc: 桌面动作备注
189
189
  frontStepType: step
190
190
  stepIdFront: step-home
191
+ - action: scroll_between
192
+ from: 列表顶部
193
+ to: 目标条目
194
+ duration: 800
195
+ userText: 从列表顶部滑到目标条目
196
+ desc: 点到点滑动备注
197
+ frontStepType: step
198
+ stepIdFront: step-scroll-between
199
+ - action: drag
200
+ from: 滑块起点
201
+ to: 滑块终点
202
+ speed: medium
203
+ userText: 拖动滑块
204
+ desc: 拖拽动作备注
205
+ frontStepType: step
206
+ stepIdFront: step-drag
207
+ - action: extract
208
+ target: 订单号
209
+ varName: order_no
210
+ type: string
211
+ userText: 提取订单号
212
+ desc: 提取动作备注
213
+ frontStepType: step
214
+ stepIdFront: step-extract
215
+ - action: randomVar
216
+ varName: generated_code
217
+ type: string
218
+ length: 6
219
+ userText: 生成随机验证码
220
+ desc: 随机变量备注
221
+ frontStepType: step
222
+ stepIdFront: step-random
223
+ - action: for
224
+ count: 2
225
+ steps:
226
+ - action: break
227
+ userText: 跳出当前循环
228
+ desc: 跳出循环备注
229
+ frontStepType: step
230
+ stepIdFront: step-break
231
+ userText: 重复执行两次
232
+ desc: 循环动作备注
233
+ frontStepType: step
234
+ stepIdFront: step-for
235
+ - action: throw
236
+ message: 主动终止测试
237
+ userText: 主动终止测试
238
+ desc: 抛错动作备注
239
+ frontStepType: step
240
+ stepIdFront: step-throw
241
+ - action: press_key
242
+ key: ENTER
243
+ userText: 按下指定按键
244
+ desc: 指定按键备注
245
+ frontStepType: step
246
+ stepIdFront: step-press-key
247
+ - action: press_enter
248
+ userText: 按下回车键
249
+ desc: 回车动作备注
250
+ frontStepType: step
251
+ stepIdFront: step-press-enter
191
252
  - action: if
192
253
  frontStepType: if
193
254
  userText: 页面显示登录入口
@@ -1,5 +1,21 @@
1
1
  # Agent Host 适配
2
2
 
3
+ ## Guided UI Coordinator
4
+
5
+ Guided UI 的推荐 Host 接入是 `xagent guided-ui coordinate`。Coordinator 独占消费本地 Broker 的 durable events,把事件 JSON 放进一次 Host turn 的 prompt;Host Agent 只负责调用 Action MCP 完成回复、用户确认和页面观察提交,不要再次调用 `xagent_guided_ui_wait` 消费同一事件。
6
+
7
+ Codex 通过 `codex queue --thread <当前任务>` 把事件排入用户正在查看的任务,并在该调用中注入本地 Action MCP 配置。禁止为交互另建不可见的 ephemeral thread。WorkBuddy 使用等价的本地 stdio JSON-RPC Host Driver,把消息排入现有可见会话:
8
+
9
+ ```text
10
+ initialize {}
11
+ message/queue {"session_id":"当前可见会话","prompt":"..."}
12
+ -> {"message_id":"..."}
13
+ ```
14
+
15
+ WorkBuddy 桌面程序的私有 IPC 不作为 XAgent 合约。需要由 WorkBuddy 侧提供一个适配进程,并通过 `XAGENT_HOST_DRIVER_COMMAND`、JSON 数组形式的 `XAGENT_HOST_DRIVER_ARGS` 和 `XAGENT_WORKBUDDY_SESSION_ID` 启动。这样两种 Host 共享 Broker、事件、停止和截图协议,并且消息都出现在用户实际查看的会话中。
16
+
17
+ `tour.stop_requested` 会停止后续消息注入;Coordinator 退出时会关闭适配进程,但不会终止可见会话中无关的活动 turn。Ctrl+C 只释放 Host 资源,不会静默伪造 WebUI 的 stopped 状态。
18
+
3
19
  Codex Host 使用 XAgent Skill 包。Host 负责加载入口 Skill、启动对应 MCP 进程,并把 MCP 图片原生展示给用户。
4
20
 
5
21
  ## 用户体验要求
@@ -14,7 +14,7 @@
14
14
  |---|---|
15
15
  | `OK` | 直接执行请求 |
16
16
  | `NEED_INIT` | 引导用户完成一次 XAgent 初始化 |
17
- | `NEED_AUTH` | 引导用户登录或配置指定 Profile |
17
+ | `NEED_AUTH` | 提示“请联系云小宝并依据用户id获取相关token” |
18
18
  | `NEED_SYNC` | 同步 XAgent 自己的 Skill 文件 |
19
19
  | `NEED_UPGRADE` | 升级 CLI/Skill 后重新检查 |
20
20
  | `NEED_RESTART` | 提示重启 Agent Host/MCP,然后继续 |
@@ -18,7 +18,7 @@ description: Configure and diagnose the local XAgent CLI, Profile, Skill install
18
18
 
19
19
  - 已配置:说明环境已就绪。
20
20
  - 未初始化:引导执行一次 `xagent init`。
21
- - 缺少登录:说明需要 Developer Token,但不回显 Token。
21
+ - 缺少登录:提示“请联系云小宝并依据用户id获取相关token”,但不回显 Token。
22
22
  - Skill 过期:同步 XAgent Skill 后提示重启 Host。
23
23
  - MCP 过期:提示重启 MCP,不自动切换执行链路。
24
24
 
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA8XA,wBAAsB,MAAM,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/D"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA2dA,wBAAsB,MAAM,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/D"}