@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.
- package/README.md +157 -0
- package/dist/action/client.d.ts +13 -0
- package/dist/action/client.d.ts.map +1 -0
- package/dist/action/client.js +28 -0
- package/dist/action/client.js.map +1 -0
- package/dist/action/mcp-content.d.ts +2 -0
- package/dist/action/mcp-content.d.ts.map +1 -0
- package/dist/action/mcp-content.js +116 -0
- package/dist/action/mcp-content.js.map +1 -0
- package/dist/action/protocol.d.ts +36 -0
- package/dist/action/protocol.d.ts.map +1 -0
- package/dist/action/protocol.js +29 -0
- package/dist/action/protocol.js.map +1 -0
- package/dist/assets/contracts/app-list.schema.json +31 -0
- package/dist/assets/contracts/app-upload.schema.json +45 -0
- package/dist/assets/contracts/app.schema.json +18 -0
- package/dist/assets/contracts/authoring-attempt-create.schema.json +12 -0
- package/dist/assets/contracts/authoring-attempt.schema.json +56 -0
- package/dist/assets/contracts/authoring-complete.schema.json +13 -0
- package/dist/assets/contracts/authoring-draft-attempt-create.schema.json +12 -0
- package/dist/assets/contracts/authoring-observation.schema.json +28 -0
- package/dist/assets/contracts/authoring-revision-create.schema.json +13 -0
- package/dist/assets/contracts/authoring-revision.schema.json +19 -0
- package/dist/assets/contracts/authoring-session-create.schema.json +11 -0
- package/dist/assets/contracts/authoring-session.schema.json +54 -0
- package/dist/assets/contracts/canonical-script.schema.json +219 -0
- package/dist/assets/contracts/compat-script.schema.json +380 -0
- package/dist/assets/contracts/device-list.schema.json +19 -0
- package/dist/assets/contracts/error.schema.json +47 -0
- package/dist/assets/contracts/execution-target.schema.json +55 -0
- package/dist/assets/contracts/fixtures/authoring-attempt-create.valid.json +4 -0
- package/dist/assets/contracts/fixtures/authoring-attempt.passed.json +16 -0
- package/dist/assets/contracts/fixtures/authoring-draft-attempt-create.valid.json +10 -0
- package/dist/assets/contracts/fixtures/authoring-observation.valid.json +7 -0
- package/dist/assets/contracts/fixtures/authoring-revision.valid.json +16 -0
- package/dist/assets/contracts/fixtures/authoring-session.active.json +12 -0
- package/dist/assets/contracts/fixtures/canonical-script.valid.json +17 -0
- package/dist/assets/contracts/fixtures/ci-exit-status-cases.json +44 -0
- package/dist/assets/contracts/fixtures/command-mutual-exclusion-cases.json +20 -0
- package/dist/assets/contracts/fixtures/compat-script.all-platform-actions.yaml +227 -0
- package/dist/assets/contracts/fixtures/execution-target.both.invalid.json +7 -0
- package/dist/assets/contracts/fixtures/execution-target.concurrency-two.invalid.json +4 -0
- package/dist/assets/contracts/fixtures/execution-target.count-two.invalid.json +6 -0
- package/dist/assets/contracts/fixtures/execution-target.dynamic.valid.json +12 -0
- package/dist/assets/contracts/fixtures/execution-target.fixed.valid.json +4 -0
- package/dist/assets/contracts/fixtures/execution-target.multiple-devices.invalid.json +4 -0
- package/dist/assets/contracts/fixtures/execution-target.multiple-filters.invalid.json +7 -0
- package/dist/assets/contracts/fixtures/execution-target.strategy-all.invalid.json +6 -0
- package/dist/assets/contracts/fixtures/idempotency.conflict.json +26 -0
- package/dist/assets/contracts/fixtures/idempotency.same-request.json +26 -0
- package/dist/assets/contracts/fixtures/principal.personal.json +23 -0
- package/dist/assets/contracts/fixtures/principal.project-ci.json +20 -0
- package/dist/assets/contracts/fixtures/project-config.no-default.valid.json +9 -0
- package/dist/assets/contracts/fixtures/project-config.secret.invalid.json +10 -0
- package/dist/assets/contracts/fixtures/project-config.target-name.invalid.json +10 -0
- package/dist/assets/contracts/fixtures/project-config.valid.json +22 -0
- package/dist/assets/contracts/fixtures/public-script.all-cli-actions.yaml +39 -0
- package/dist/assets/contracts/fixtures/public-script.invalid.json +8 -0
- package/dist/assets/contracts/fixtures/public-script.valid.json +17 -0
- package/dist/assets/contracts/fixtures/run-create-v2.device-id.invalid.json +16 -0
- package/dist/assets/contracts/fixtures/run-create.personal-upload.valid.json +20 -0
- package/dist/assets/contracts/fixtures/run-create.single-device.json +19 -0
- package/dist/assets/contracts/fixtures/run-create.target.valid.json +22 -0
- package/dist/assets/contracts/fixtures/run.queued.json +19 -0
- package/dist/assets/contracts/fixtures/run.target.queued.json +38 -0
- package/dist/assets/contracts/fixtures/skill-catalog.valid.json +19 -0
- package/dist/assets/contracts/fixtures/skill-reference.valid.json +9 -0
- package/dist/assets/contracts/fixtures/skill.valid.json +10 -0
- package/dist/assets/contracts/fixtures/target-hash-cases.json +30 -0
- package/dist/assets/contracts/fixtures/target-preview.hash-mismatch.error.json +8 -0
- package/dist/assets/contracts/fixtures/target-preview.no-match.error.json +9 -0
- package/dist/assets/contracts/fixtures/target-preview.request.valid.json +9 -0
- package/dist/assets/contracts/fixtures/target-preview.success.json +18 -0
- package/dist/assets/contracts/fixtures/target-preview.unavailable.json +18 -0
- package/dist/assets/contracts/principal.schema.json +72 -0
- package/dist/assets/contracts/project-config.schema.json +23 -0
- package/dist/assets/contracts/public-script.schema.json +397 -0
- package/dist/assets/contracts/run-create-v2.schema.json +78 -0
- package/dist/assets/contracts/run-create.schema.json +70 -0
- package/dist/assets/contracts/run.schema.json +137 -0
- package/dist/assets/contracts/skill-catalog.schema.json +15 -0
- package/dist/assets/contracts/skill-reference.schema.json +17 -0
- package/dist/assets/contracts/skill-summary.schema.json +28 -0
- package/dist/assets/contracts/skill.schema.json +30 -0
- package/dist/assets/contracts/target-preview.schema.json +75 -0
- package/dist/assets/integrations/manifest.json +17 -0
- package/dist/assets/integrations/xagent-skill/SKILL.md +28 -0
- package/dist/assets/integrations/xagent-skill/agents/openai.yaml +4 -0
- package/dist/assets/integrations/xagent-skill/references/cli-mcp-interop.md +10 -0
- package/dist/assets/integrations/xagent-skill/references/host-adapters.md +9 -0
- package/dist/assets/integrations/xagent-skill/references/installation.md +10 -0
- package/dist/assets/integrations/xagent-skill/references/privacy.md +3 -0
- package/dist/assets/integrations/xagent-skill/references/routing.md +32 -0
- package/dist/assets/integrations/xagent-skill/scripts/install-cli.ps1 +5 -0
- package/dist/assets/integrations/xagent-skill/scripts/install-cli.sh +6 -0
- package/dist/assets/skills/xagent-analyze-failure/SKILL.md +13 -0
- package/dist/assets/skills/xagent-analyze-failure/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-analyze-failure/references/failure-classification.md +20 -0
- package/dist/assets/skills/xagent-author-test/SKILL.md +19 -0
- package/dist/assets/skills/xagent-author-test/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-author-test/references/authoring-workflow.md +41 -0
- package/dist/assets/skills/xagent-author-test/references/host-interaction-adapters.md +81 -0
- package/dist/assets/skills/xagent-author-test/references/interaction-modes.md +97 -0
- package/dist/assets/skills/xagent-author-test/references/interactive-steering.md +57 -0
- package/dist/assets/skills/xagent-author-test/references/script-actions.md +34 -0
- package/dist/assets/skills/xagent-author-test/references/script-format.md +100 -0
- package/dist/assets/skills/xagent-cli/SKILL.md +31 -0
- package/dist/assets/skills/xagent-cli/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-cli/references/capability-routing.md +36 -0
- package/dist/assets/skills/xagent-cli/references/cli-commands.md +23 -0
- package/dist/assets/skills/xagent-cli/references/failure-routing.md +18 -0
- package/dist/assets/skills/xagent-cli/references/host-modes.md +21 -0
- package/dist/assets/skills/xagent-cli/references/mcp-tools.md +26 -0
- package/dist/assets/skills/xagent-cli/references/permissions.md +17 -0
- package/dist/assets/skills/xagent-explore-device/SKILL.md +26 -0
- package/dist/assets/skills/xagent-explore-device/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-explore-device/references/actions.md +24 -0
- package/dist/assets/skills/xagent-explore-device/references/single-action-protocol.md +59 -0
- package/dist/assets/skills/xagent-explore-device/references/tool-adapters.md +32 -0
- package/dist/assets/skills/xagent-repair-test/SKILL.md +16 -0
- package/dist/assets/skills/xagent-repair-test/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-repair-test/references/repair-workflow.md +21 -0
- package/dist/assets/skills/xagent-run-test/SKILL.md +16 -0
- package/dist/assets/skills/xagent-run-test/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-run-test/references/execution-modes.md +23 -0
- package/dist/assets/skills/xagent-run-test/references/result-status.md +13 -0
- package/dist/assets/skills/xagent-test-report/SKILL.md +20 -0
- package/dist/assets/skills/xagent-test-report/agents/openai.yaml +4 -0
- package/dist/assets/skills/xagent-test-report/references/evidence-policy.md +20 -0
- package/dist/assets/skills/xagent-test-report/references/report-template.md +41 -0
- package/dist/assets/skills/xagent-test-report/references/result-classification.md +13 -0
- package/dist/authoring/draft-store.d.ts +19 -0
- package/dist/authoring/draft-store.d.ts.map +1 -0
- package/dist/authoring/draft-store.js +104 -0
- package/dist/authoring/draft-store.js.map +1 -0
- package/dist/authoring/session-lease.d.ts +64 -0
- package/dist/authoring/session-lease.d.ts.map +1 -0
- package/dist/authoring/session-lease.js +190 -0
- package/dist/authoring/session-lease.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +529 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/credentials.d.ts +16 -0
- package/dist/config/credentials.d.ts.map +1 -0
- package/dist/config/credentials.js +93 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/config/store.d.ts +37 -0
- package/dist/config/store.d.ts.map +1 -0
- package/dist/config/store.js +142 -0
- package/dist/config/store.js.map +1 -0
- package/dist/core/assets.d.ts +5 -0
- package/dist/core/assets.d.ts.map +1 -0
- package/dist/core/assets.js +46 -0
- package/dist/core/assets.js.map +1 -0
- package/dist/core/errors.d.ts +19 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +36 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/interrupt.d.ts +8 -0
- package/dist/core/interrupt.d.ts.map +1 -0
- package/dist/core/interrupt.js +54 -0
- package/dist/core/interrupt.js.map +1 -0
- package/dist/core/json.d.ts +5 -0
- package/dist/core/json.d.ts.map +1 -0
- package/dist/core/json.js +21 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/version.d.ts +8 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +8 -0
- package/dist/core/version.js.map +1 -0
- package/dist/integrations/manager.d.ts +12 -0
- package/dist/integrations/manager.d.ts.map +1 -0
- package/dist/integrations/manager.js +218 -0
- package/dist/integrations/manager.js.map +1 -0
- package/dist/integrations/routing.d.ts +105 -0
- package/dist/integrations/routing.d.ts.map +1 -0
- package/dist/integrations/routing.js +85 -0
- package/dist/integrations/routing.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +69 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +30 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +345 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/project/config.d.ts +15 -0
- package/dist/project/config.d.ts.map +1 -0
- package/dist/project/config.js +46 -0
- package/dist/project/config.js.map +1 -0
- package/dist/run/progress.d.ts +5 -0
- package/dist/run/progress.d.ts.map +1 -0
- package/dist/run/progress.js +29 -0
- package/dist/run/progress.js.map +1 -0
- package/dist/script/service.d.ts +42 -0
- package/dist/script/service.d.ts.map +1 -0
- package/dist/script/service.js +457 -0
- package/dist/script/service.js.map +1 -0
- package/dist/sdk/authoring.d.ts +19 -0
- package/dist/sdk/authoring.d.ts.map +1 -0
- package/dist/sdk/authoring.js +43 -0
- package/dist/sdk/authoring.js.map +1 -0
- package/dist/sdk/client.d.ts +49 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +241 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/skills/catalog.d.ts +7 -0
- package/dist/skills/catalog.d.ts.map +1 -0
- package/dist/skills/catalog.js +59 -0
- package/dist/skills/catalog.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Agent Host Interaction Adapters
|
|
2
|
+
|
|
3
|
+
Choose interaction behavior from the Agent Host, active host mode, exposed interaction Tools, and whether the caller is interactive. Do not branch on the underlying model or provider name. The same model can run in different Hosts with different UI capabilities.
|
|
4
|
+
|
|
5
|
+
This reference applies only inside an explicitly selected Author workflow. Changing Codex collaboration mode changes the available interaction UI; it does not change the locked XAgent capability domain or authorize a different Skill.
|
|
6
|
+
|
|
7
|
+
## Resolution Order
|
|
8
|
+
|
|
9
|
+
Resolve the adapter before creating an Authoring Session:
|
|
10
|
+
|
|
11
|
+
1. Detect whether the caller is interactive. CI/CD and other non-interactive callers cannot prompt.
|
|
12
|
+
2. Identify the Agent Host and its active collaboration or execution mode when that state is available.
|
|
13
|
+
3. Inspect the interaction Tools the Host actually exposes and permits in that mode.
|
|
14
|
+
4. Use a native structured choice only when it is callable now; otherwise use the text fallback.
|
|
15
|
+
|
|
16
|
+
Do not send Host, model, mode, prompt, or interaction-capability metadata to XAgent. This is local Agent orchestration state.
|
|
17
|
+
|
|
18
|
+
## Host Matrix
|
|
19
|
+
|
|
20
|
+
| Environment | Preferred adapter | Required behavior |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Codex Plan mode | `request_user_input` when exposed and permitted | Present native choices. Do not promise that Plan mode permits device side effects; inspect the active Tool policy before execution. |
|
|
23
|
+
| Codex Default mode | Text fallback | Do not call `request_user_input` when the Host reports it unavailable in Default mode. Show the one-time Plan mode notice below. |
|
|
24
|
+
| Claude Code | `AskUserQuestion` when exposed | Present native choices; use text fallback when the Tool is absent or denied. |
|
|
25
|
+
| CodeBuddy Code | `AskUserQuestion` or another documented native choice Tool when exposed | Detect the Tool at runtime; do not infer it from product branding. |
|
|
26
|
+
| WorkBuddy | Any documented native structured-choice Tool when exposed | Probe capabilities at runtime; otherwise use text fallback. |
|
|
27
|
+
| Other interactive MCP Hosts | Host-native choice Tool when exposed | Use text fallback when no such Tool is callable. |
|
|
28
|
+
| CI/CD or another non-interactive caller | No prompt | Require `auto`; fail before creating a Session if an unresolved interactive choice remains. |
|
|
29
|
+
|
|
30
|
+
## Codex Default Mode Notice
|
|
31
|
+
|
|
32
|
+
When Codex is in Default mode and structured input is unavailable, show this notice once per Authoring request, localized to the user's language:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Codex Default mode can execute XAgent Tools but does not currently expose structured choices.
|
|
36
|
+
|
|
37
|
+
- Continue here with text confirmation: reply "Continue" or "Adjust test requirements: ...".
|
|
38
|
+
- To test structured choices, use the Codex mode selector to switch to Plan mode and resend the Authoring request.
|
|
39
|
+
|
|
40
|
+
Plan mode Tool permissions are controlled by Codex. Do not assume it can execute device side effects until the active Host confirms those Tools are permitted.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do not repeat this notice after every Draft Attempt. In `step_confirm`, use the concise text choices after the first notice:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Continue
|
|
47
|
+
Adjust test requirements: <replacement>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If a user selects the interaction mode in Plan mode and then execution requires Default mode, keep the choice only in the current Agent conversation and explain the mode transition. Do not upload or persist it in XAgent.
|
|
51
|
+
|
|
52
|
+
When a Host pauses for user input, the active Authoring Session remains owned by that Host. MCP hosts renew the lease before the next side effect. Hosts using separate CLI commands must run `xagent authoring keepalive <sessionId>` in another foreground terminal; a single short-lived CLI invocation cannot maintain a timer after it exits.
|
|
53
|
+
|
|
54
|
+
## Structured Choices
|
|
55
|
+
|
|
56
|
+
For initial mode selection, present:
|
|
57
|
+
|
|
58
|
+
- Confirm each step
|
|
59
|
+
- Execute automatically
|
|
60
|
+
|
|
61
|
+
After the execution mode is selected, present the authoring entry when it was not already explicit:
|
|
62
|
+
|
|
63
|
+
- Create from my test objective
|
|
64
|
+
- Optimize an existing test or case
|
|
65
|
+
|
|
66
|
+
Within the locked Author domain, an explicitly selected YAML, TXT, Markdown, spreadsheet, or existing case resolves to the second entry without a redundant prompt. A natural-language test-authoring request resolves to the first entry unless the user chooses otherwise.
|
|
67
|
+
|
|
68
|
+
For `step_confirm` after a Draft Attempt, present:
|
|
69
|
+
|
|
70
|
+
- Confirm and continue
|
|
71
|
+
- Adjust test requirements
|
|
72
|
+
|
|
73
|
+
A failed, ambiguous, unauthorized, or infrastructure-failed Draft Attempt must not recommend blind continuation. Offer adjustment of the test requirements or Session cancellation. The Agent should infer whether the adjustment changes the overall goal or only a local step from the user's natural-language input and current evidence; update the local complete YAML and checkpoint it before retrying.
|
|
74
|
+
|
|
75
|
+
## Acceptance Status
|
|
76
|
+
|
|
77
|
+
Record Host-specific behavior separately. Passing the XAgent MCP lifecycle does not prove that a Host renders structured controls.
|
|
78
|
+
|
|
79
|
+
- Verify Codex Default text fallback and one-time notice.
|
|
80
|
+
- Verify Codex Plan structured choice separately from device-side-effect permission.
|
|
81
|
+
- Verify Claude Code, CodeBuddy Code, and WorkBuddy with their real installed Host versions before declaring those adapters supported.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Authoring Interaction Modes
|
|
2
|
+
|
|
3
|
+
Interaction mode is Agent Host orchestration state. It is not an XAgent API field, is not stored in an Authoring Session, and must not be sent with Revision or Attempt requests.
|
|
4
|
+
|
|
5
|
+
Apply this reference only after the user has explicitly selected the Author capability. A natural-language device-control request does not become Author merely because it can be represented as steps. `step_confirm` and `auto` never replace the locked XAgent capability domain.
|
|
6
|
+
|
|
7
|
+
## Mode Resolution
|
|
8
|
+
|
|
9
|
+
Resolve the execution mode before creating a Session:
|
|
10
|
+
|
|
11
|
+
1. The user's latest explicit instruction for this request.
|
|
12
|
+
2. A Host-local preference that the user explicitly chose to save.
|
|
13
|
+
3. A first-use structured choice presented by the Agent Host.
|
|
14
|
+
|
|
15
|
+
The supported values are:
|
|
16
|
+
|
|
17
|
+
- `step_confirm`: show evidence after each Draft Attempt and require an explicit choice before the next side effect. Recommend this mode on first use.
|
|
18
|
+
- `auto`: continue successful Draft Attempts automatically while still accepting active-turn steering.
|
|
19
|
+
|
|
20
|
+
The input source is separate from execution mode:
|
|
21
|
+
|
|
22
|
+
- `goal`: a new test from the user's overall objective.
|
|
23
|
+
- `artifact`: a user-selected YAML, TXT, Markdown, spreadsheet, or existing case.
|
|
24
|
+
|
|
25
|
+
Both sources converge on the same local working-draft workflow. `draft_first` and `state_guided_local` are historical design names; do not present, store, or send them.
|
|
26
|
+
|
|
27
|
+
If the source is genuinely ambiguous, present one optional source choice:
|
|
28
|
+
|
|
29
|
+
- Create from my test objective
|
|
30
|
+
- Optimize an existing test or case
|
|
31
|
+
|
|
32
|
+
Within the already selected Author domain, resolve `goal` when the user described a desired test behavior. Resolve `artifact` when the user selected a file or existing case, without asking a redundant question. Neither choice is sent to XAgent.
|
|
33
|
+
|
|
34
|
+
## Local Working Draft
|
|
35
|
+
|
|
36
|
+
The Agent Host owns a durable local workspace selected by the user:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
.xagent/authoring/<session-id>/
|
|
40
|
+
draft.yaml
|
|
41
|
+
state.json
|
|
42
|
+
checkpoints/000001.yaml
|
|
43
|
+
checkpoints/000002.yaml
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Save the current complete YAML snapshot after every edit and after every Attempt. The snapshot is complete for the steps authored so far; it is not a requirement to prewrite the entire future test. Append the next step only after the current device evidence is understood. `state.json` records the next step index, latest Attempt ID/status, execution mode, and semantic script hash. The local checkpoint Tools do not upload this content or scan any other workspace path.
|
|
47
|
+
|
|
48
|
+
The Agent may execute a provisional step only with the complete current working YAML snapshot through `xagent_authoring_draft_step_execute`. This operation validates and executes the next authored step, records public Attempt evidence and the script hash, and does not create or update a Revision. A final `xagent_authoring_revision_create` is sent once, after the user confirms the finished YAML.
|
|
49
|
+
|
|
50
|
+
## Goal Entry Behavior
|
|
51
|
+
|
|
52
|
+
When `goal` is selected and the current user message is coherent, use it directly. Do not ask for a second detailed goal or require a generated YAML review before the first draft step. Generate only the next safe working step locally, save the current snapshot, and use the device observation and Draft Attempt evidence to author subsequent steps.
|
|
53
|
+
|
|
54
|
+
When `artifact` is selected, copy the selected intent into the same local working-draft directory. Do not create an intermediate Revision merely because the source was an existing file.
|
|
55
|
+
|
|
56
|
+
## Host Interaction
|
|
57
|
+
|
|
58
|
+
Use the Host's native structured input only when it is callable now:
|
|
59
|
+
|
|
60
|
+
- Codex Plan mode: `request_user_input` when exposed and permitted.
|
|
61
|
+
- Codex Default mode: concise text fallback; show the one-time Plan mode notice.
|
|
62
|
+
- Claude Code and CodeBuddy Code: `AskUserQuestion` when exposed.
|
|
63
|
+
- WorkBuddy and other Hosts: a documented native choice when exposed; otherwise text fallback.
|
|
64
|
+
|
|
65
|
+
Do not branch on model branding. A Host must actually expose and permit the interaction Tool.
|
|
66
|
+
|
|
67
|
+
Present the execution choices:
|
|
68
|
+
|
|
69
|
+
- Confirm each step
|
|
70
|
+
- Execute automatically
|
|
71
|
+
|
|
72
|
+
Save a default only when the user explicitly asks to remember it, and keep it in Host-local state.
|
|
73
|
+
|
|
74
|
+
## Step-Confirm Mode
|
|
75
|
+
|
|
76
|
+
After every Draft Attempt:
|
|
77
|
+
|
|
78
|
+
1. Show status, error details, and available screenshots or Artifacts.
|
|
79
|
+
2. Save the returned local checkpoint before any next side effect.
|
|
80
|
+
3. Present `Confirm and continue` and `Adjust test requirements`.
|
|
81
|
+
4. On adjustment, collect free-form replacement requirements. Treat them as an overall goal change by default; restrict them to one step only when the user explicitly names a step or says the change is local. Observe the device, reconcile the next required entry state, revise only invalid authored steps, and append the next safe step to the current YAML snapshot. Do not rewrite unverified future steps, and do not create a Revision yet. The user does not need to classify the scope or say that the complete draft should be adjusted.
|
|
82
|
+
|
|
83
|
+
A failed or ambiguous Attempt must not recommend blind continuation. Allow adjustment or Session cancellation.
|
|
84
|
+
|
|
85
|
+
## Automatic Mode
|
|
86
|
+
|
|
87
|
+
An action status is not by itself proof of business success; inspect the returned evidence and visible postcondition.
|
|
88
|
+
|
|
89
|
+
After every successful Draft Attempt, retain its evidence, save the local checkpoint, and continue to the next required step without asking for confirmation. Reconcile newer user input before the next side effect.
|
|
90
|
+
|
|
91
|
+
Automatic execution stops on a failed or ambiguous Attempt, authentication/permission/resource/infrastructure error, a materially ambiguous choice, new user input, or final completion.
|
|
92
|
+
|
|
93
|
+
Before `Complete`, use a structured choice to confirm the final local YAML or adjust its requirements. Only after confirmation create the single formal Revision. A formal full-script Run remains a separate explicit user action.
|
|
94
|
+
|
|
95
|
+
## Session Lease During Interaction
|
|
96
|
+
|
|
97
|
+
The execution mode does not change resource ownership. The MCP adapter renews a registered Session before the next Session-bound device operation when no more than 15 minutes remain; registration alone does not renew during idle waiting. If a structured choice or long user turn may exceed the server TTL, run a separate foreground `xagent authoring keepalive <sessionId>` process. Before resuming after a failed renewal or an expired Session, create a new Session and Observe the device. Never send `step_confirm`, `auto`, or Host interaction state to the XAgent API.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Interactive Steering And Verification Scope
|
|
2
|
+
|
|
3
|
+
The newest explicit user instruction is authoritative during interactive Authoring. Keep user prompts, local working YAML, checkpoints, and Agent conversation state in the Agent Host; send XAgent only the complete script and explicit Tool arguments required by the selected action.
|
|
4
|
+
|
|
5
|
+
## Instruction Scope
|
|
6
|
+
|
|
7
|
+
- Treat a new behavior, target, sequence, or acceptance requirement as an overall goal change by default. Do not pre-generate or rewrite all future steps. Revise only already-authored steps that are made invalid and author the next safe step from observed evidence.
|
|
8
|
+
- Treat a change as step-local only when the user explicitly names a step, action, or says the change is local.
|
|
9
|
+
- Do not ask the user to identify affected steps when the Agent can infer them from the goal, the working YAML, and the evidence.
|
|
10
|
+
- The scope of re-execution is separate from wording scope. Compute it from prerequisites, navigation state, variables, and device state.
|
|
11
|
+
|
|
12
|
+
## Working-Draft Meaning
|
|
13
|
+
|
|
14
|
+
The API requires each Draft Step request to contain a valid complete YAML snapshot. This is a transport requirement, not an instruction to write the whole test in advance. The local working draft contains only the steps known and authored so far; future steps are added after the device state and the previous Attempt evidence are available. A changed goal updates this evolving draft incrementally.
|
|
15
|
+
|
|
16
|
+
## Device State Reconciliation
|
|
17
|
+
|
|
18
|
+
An updated goal changes both the intended YAML and the device state that must be reached before the next business action. A rewritten script is not a state reset. Before submitting the next Draft Attempt:
|
|
19
|
+
|
|
20
|
+
1. Save the previous local state and checkpoint.
|
|
21
|
+
2. Observe the device and record the visible page, app, playback state, dialogs, and available controls.
|
|
22
|
+
3. Determine the required entry state for the next step of the updated goal. For example, a search action requires a visible search entry point; a playback assertion requires the requested title to be visibly selected and playing.
|
|
23
|
+
4. If the entry state is missing, author one explicit recovery or navigation step from observable controls, and verify the recovered state with a nearby `waitFor` or `assert` before authoring the next business step.
|
|
24
|
+
5. Never treat `appLaunch` alone as proof that the app returned to its home page. If the current screen has no required control, do not execute the next business step just because the YAML was regenerated.
|
|
25
|
+
6. If no safe recovery path can be established from the current evidence, stop the flow and ask the user whether to cancel/restart or provide a recovery instruction. Do not silently reset app data or invent unsupported actions.
|
|
26
|
+
|
|
27
|
+
An app-launch failure is a launch or installation precondition failure. Do not replace it with a launcher-icon assertion: an icon only proves that a launcher surface may contain a shortcut, not that the target package started. If the package is missing and the current script has an install capability, author the install step first; otherwise stop with the package/install prerequisite clearly reported.
|
|
28
|
+
|
|
29
|
+
## Correction Timing
|
|
30
|
+
|
|
31
|
+
1. Before a Draft Step is submitted, discard any unsent local draft that conflicts with newer input, save the previous state, Observe the device, reconcile the required entry state, revise the current snapshot only as needed, append the next step, and save a checkpoint. Do not require the user to classify the change or to request continuation explicitly.
|
|
32
|
+
2. If input arrives while a Draft Attempt is running, let the Tool return, save its evidence and local state, and stop before the next side effect.
|
|
33
|
+
3. After every Draft Attempt, present public status and available screenshots or Artifacts. In `step_confirm`, use the Host's continue-or-adjust choice before another side effect. In `auto`, continue only when the Attempt succeeded and no newer input or stop condition exists.
|
|
34
|
+
4. Before the final Revision is created, reconcile the complete local YAML with the latest user instruction and require confirmation.
|
|
35
|
+
|
|
36
|
+
## Revision Scope And Verification Scope
|
|
37
|
+
|
|
38
|
+
During interactive drafting, a correction updates the complete local YAML and creates a numbered local checkpoint. It is never stored as a one-step patch or an intermediate Revision. The single formal Revision is created only after final confirmation.
|
|
39
|
+
|
|
40
|
+
Validation and execution use narrower scopes where safe:
|
|
41
|
+
|
|
42
|
+
- Validate the current complete YAML snapshot locally before every Draft Step and the final Revision submission.
|
|
43
|
+
- Re-execute only the affected step when the change is isolated and the device is still in that step's valid prerequisite state.
|
|
44
|
+
- Replay required prerequisites when navigation, input, branching, variables, package state, or another dependency changed.
|
|
45
|
+
- Start from a known clean state when prerequisites cannot be established reliably.
|
|
46
|
+
|
|
47
|
+
## Business Postconditions
|
|
48
|
+
|
|
49
|
+
A side-effecting action is not a business success by itself. A click, input, or launch Attempt may be `PASSED` while the device is in the wrong screen or has selected the wrong item. For every business-critical selection or transition:
|
|
50
|
+
|
|
51
|
+
- express the intended result as a nearby `waitFor` or `assert`;
|
|
52
|
+
- verify the selected title, page, state, or other user-visible outcome before continuing;
|
|
53
|
+
- if the postcondition fails, use the evidence to repair the action and its dependent flow, then update the local complete YAML.
|
|
54
|
+
|
|
55
|
+
## Agent Host Enforcement
|
|
56
|
+
|
|
57
|
+
Use the Agent Host's active-turn steering when available. A Skill defines the portable workflow but is not itself a lifecycle Hook and cannot create UI controls that the Host does not expose. Hooks must remain host-specific, must not upload raw prompts, and must not change XAgent API semantics.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Authoring Script Actions
|
|
2
|
+
|
|
3
|
+
These are the actions available when writing XAgent YAML. All fields are case-sensitive. `description` is optional on every action. Targets are semantic descriptions resolved against the current Session screen.
|
|
4
|
+
|
|
5
|
+
| Action | Required fields | Optional fields |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `click` | `target` | `type`, `duration` |
|
|
8
|
+
| `input` | `text` | `target`, `clearFirst`, `inputMode`, `keyboardLayout` |
|
|
9
|
+
| `scroll` | `direction` | `distance`, `target`, `condition`, `maxSwipes`, scope and container fields |
|
|
10
|
+
| `scroll_between` | `from`, `to` | `duration` |
|
|
11
|
+
| `drag` | `from`, `to` | `speed` |
|
|
12
|
+
| `press_key` | `key` | - |
|
|
13
|
+
| `press_home` | - | - |
|
|
14
|
+
| `press_back` | - | - |
|
|
15
|
+
| `press_enter` | - | - |
|
|
16
|
+
| `screenshot` | - | `var` |
|
|
17
|
+
| `extract` | `target`, `varName` | `type` |
|
|
18
|
+
| `waitFor` | `time` or `condition` | `timeout` |
|
|
19
|
+
| `assert` | `condition` or `target` | `conditionType`, `text`, `message` |
|
|
20
|
+
| `set` | `varName`, `value` | - |
|
|
21
|
+
| `randomVar` | `varName`, `type` | `length`, `min`, `max` |
|
|
22
|
+
| `if` | `condition`, non-empty `then` | non-empty `else` |
|
|
23
|
+
| `for` | non-empty `steps`, exactly one of `count` or `condition` | `dead_loop` |
|
|
24
|
+
| `break` | - | - |
|
|
25
|
+
| `throw` | `message` | - |
|
|
26
|
+
| `install` | `appPackage`; execution also needs `packageId` | - |
|
|
27
|
+
| `appLaunch` | at least one of `appPackage` or `appName` | `launchPath` |
|
|
28
|
+
| `appStop` | at least one of `appPackage` or `appName` | - |
|
|
29
|
+
| `appClean` | at least one of `appPackage` or `appName` | - |
|
|
30
|
+
| `uninstall` | at least one of `appPackage` or `appName` | - |
|
|
31
|
+
|
|
32
|
+
`click.type` is `click`, `tap`, `longPress`, `doubleClick`, or `rightClick`. `click.duration` is accepted only with `longPress` so existing platform scripts round-trip, but current Exec does not transmit the requested duration to the device controller; do not promise an exact hold time. `assert.conditionType` is `textVisible` or `expr`. `scroll.direction` is up/down/left/right and `distance` is greater than 0 and at most 1. `press_key` accepts one key only. `break` is valid only inside `for.steps`, including an `if` nested under that loop. Application actions use the authoritative package identity; never put a download URL in YAML.
|
|
33
|
+
|
|
34
|
+
An application action can carry both identifiers when available, but it must provide at least one. When `appPackage` is present with a selected package, it must match that package. Validate every complete working snapshot. Do not invent action names, fields, or fallback behavior.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# XAgent Script Format
|
|
2
|
+
|
|
3
|
+
Every script uses `schema_version: xagent-script/v1` and contains one or more steps.
|
|
4
|
+
|
|
5
|
+
Files exported by the compat platform use the shared `xagent-compat-script/v1` schema instead. The CLI accepts those files for `validate`, `run`, and Authoring commands: it compiles the platform editor fields to the Public Script execution contract while leaving the source YAML unchanged. In a compat file, `userText`, `desc`, `stepIdFront`, `actionLocked`, `descVisible`, and `isEdit` are platform source fields and must be preserved when the file is edited or re-exported. Do not copy those editor fields into a new `xagent-script/v1` file unless the user explicitly asks for a platform export.
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
schema_version: xagent-compat-script/v1
|
|
9
|
+
name: Platform login smoke
|
|
10
|
+
package_id: 7183
|
|
11
|
+
steps:
|
|
12
|
+
- action: click
|
|
13
|
+
frontStepType: step
|
|
14
|
+
target: 登录
|
|
15
|
+
type: text
|
|
16
|
+
userText: 点击登录
|
|
17
|
+
desc: 登录入口
|
|
18
|
+
- action: input
|
|
19
|
+
frontStepType: step
|
|
20
|
+
target: 用户名
|
|
21
|
+
text: "${username}"
|
|
22
|
+
userText: 输入用户名
|
|
23
|
+
desc: 用户名输入
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The compat format uses the platform action set (`click`, `input`, `scroll`, `install`, `uninstall`, `appLaunch`, `appStop`, `appClean`, `waitFor`, `assert`, `screenshot`, `set`, `press_back`, and `press_home`). `xagent-script/v1` remains the CLI's compact execution format and may contain additional CLI-only flow actions.
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
schema_version: xagent-script/v1
|
|
30
|
+
name: Login smoke
|
|
31
|
+
package_id: 7183
|
|
32
|
+
variables:
|
|
33
|
+
username: demo
|
|
34
|
+
steps:
|
|
35
|
+
- action: install
|
|
36
|
+
appPackage: cn.example.app
|
|
37
|
+
- action: appLaunch
|
|
38
|
+
appPackage: cn.example.app
|
|
39
|
+
- action: click
|
|
40
|
+
target: 登录
|
|
41
|
+
- action: input
|
|
42
|
+
target: 用户名
|
|
43
|
+
text: "${username}"
|
|
44
|
+
clearFirst: true
|
|
45
|
+
- action: waitFor
|
|
46
|
+
condition: 首页可见
|
|
47
|
+
timeout: 10000
|
|
48
|
+
- action: assert
|
|
49
|
+
target: 首页
|
|
50
|
+
message: 应进入首页
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Optional UI interruptions use an `if` branch. The branch is skipped when its condition is not met, so a missing dialog does not fail the rest of the test:
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
- action: if
|
|
57
|
+
condition: 页面显示用户协议或隐私政策弹窗,并且存在同意按钮
|
|
58
|
+
then:
|
|
59
|
+
- action: click
|
|
60
|
+
target: 当前弹窗中的同意按钮
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use this pattern for first-launch agreements, notifications, permissions, update prompts, login prompts, and similar device-dependent UI. Do not issue an unconditional click for a dialog that may be absent. Keep each optional interruption in its own branch and continue with the main flow after the branch.
|
|
64
|
+
|
|
65
|
+
## Keyboard-Aware Input
|
|
66
|
+
|
|
67
|
+
Before authoring an input step, Observe the device and identify whether the focused field currently shows a keyboard and which layout is visible. Do not infer that a visible numeric layout proves that a secure-input adapter will work, and do not hard-code keyboard coordinates or literal key labels such as `123` or `ABC`.
|
|
68
|
+
|
|
69
|
+
The Public Script accepts two input controls. The authoritative server compiler applies them identically for CLI Run, MCP Run, Draft Step, Revision Step, and scriptless Action:
|
|
70
|
+
|
|
71
|
+
- `inputMode: secret` keeps the explicit secure-input call.
|
|
72
|
+
- `inputMode: normal` requests ordinary input. The server removes it from canonical execution so Exec does not apply smart secure fallback.
|
|
73
|
+
- `keyboardLayout: numeric` or `keyboardLayout: alphabetic` requests an evidence-driven layout check. The server compiles one logical input step into an atomic `if`: when the layout differs, switch and input in the same branch; otherwise input directly. It never submits fixed coordinates or literal `123`/`ABC` labels.
|
|
74
|
+
|
|
75
|
+
Focus the field first. Put `keyboardLayout` and the input mode on the following focused `input` step without `target`. The contract rejects `target` together with `keyboardLayout` because a secure input target causes an additional focus click that can change keyboard state:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
- action: click
|
|
79
|
+
target: 密码输入框
|
|
80
|
+
- action: input
|
|
81
|
+
text: "{{pin}}"
|
|
82
|
+
inputMode: secret
|
|
83
|
+
keyboardLayout: numeric
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For an ordinary field, use `inputMode: normal` only when ordinary input is required explicitly. Omitted `inputMode` is also ordinary input in the XAgent Public Script; do not assume another producer's omitted mode means `smart`. Add `keyboardLayout` only when the required layout is known from the task or current device evidence. Keep secure values in variables and do not put their plaintext values in evidence, notes, or status messages.
|
|
87
|
+
|
|
88
|
+
If a `secret` input reaches the device adapter with the requested layout but fails with a secure-keyboard keycode error, classify it as device-input infrastructure evidence. Preserve the Run or Attempt ID and screenshots; do not change the application scenario or retry the same secure call blindly.
|
|
89
|
+
|
|
90
|
+
A successful `click`, `input`, or `appLaunch` Attempt only confirms that the device action completed. It does not prove that the intended business result occurred. After a business-critical action, add a nearby `waitFor` or `assert` for the expected visible result before continuing. For list selection, target the row or title whose text matches the requested item and verify the current title immediately after the click; do not treat any clickable row as a successful selection.
|
|
91
|
+
|
|
92
|
+
`appLaunch` starts or brings the application to the foreground; it does not guarantee that the application has returned to its home page, cleared playback state, or restored a search control. When a new goal requires a specific entry point, first Observe the current device state and express the necessary navigation or recovery steps in the YAML. Verify the entry point before issuing the business action. Do not silently add app-data clearing, uninstall/reinstall, or unsupported reset actions.
|
|
93
|
+
|
|
94
|
+
The valid postcondition for `appLaunch` is an observable page belonging to the target application, such as its home page or another explicitly required entry page. Do not assert that a launcher contains the app icon as the launch postcondition, and do not infer that an icon means the package is installed and runnable on the selected device.
|
|
95
|
+
|
|
96
|
+
The Public Script action set is documented in [script-actions.md](script-actions.md). It includes verified interaction, observation, validation, variables, flow, and application controls. `break` is legal only inside `for.steps`. Use only actions and fields listed in that Author reference, and validate every draft; schema errors include paths and positions when available.
|
|
97
|
+
|
|
98
|
+
Keep targets tied to the user's intent, not incidental observations from one device. If the user asks to play “大东北是我的家乡”, target a result whose title contains that requested title and do not add a version, artist, album, or VIP qualifier unless the user specified it. If several results exist, choose the first result satisfying the requested behavior and available playback, and describe that selection generically.
|
|
99
|
+
|
|
100
|
+
The local Agent may derive steps from explicitly selected route code or requirements, but route names and implementation calls are not automatically valid UI targets. Express only behavior that can be observed or operated on the mobile device.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xagent-cli
|
|
3
|
+
description: Configure XAgent, inspect Profiles, Tokens, apps, devices, or capabilities, validate existing YAML, and select one workflow when the user has not already selected a mode. Do not use this Skill to override an explicit action, author, run, analyze, or repair request, or to perform those domain workflows itself.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Use XAgent
|
|
7
|
+
|
|
8
|
+
1. Determine the Agent Host mode from [host-modes.md](references/host-modes.md). Use [cli-commands.md](references/cli-commands.md) for setup and read-only lookup with Shell access. MCP defaults to isolated `action`; every other domain, including report generation, requires its explicit `--mode`. A larger Tool surface is never a substitute for selecting one domain.
|
|
9
|
+
2. Look up application identity when setup or the selected workflow needs it. If `package_id` is unknown, query the project application list. If `package_id` is known but `package_name` is not, query that exact package. Never guess `appPackage` or randomly select one of multiple matches.
|
|
10
|
+
3. Look up devices when setup or the selected workflow needs one and no `device_id` was supplied. Apply server-side filters and return only an explicit match; this routing Skill does not acquire it.
|
|
11
|
+
4. Apply [capability-routing.md](references/capability-routing.md) before selecting a workflow. The newest explicit user mode has highest priority and remains locked until the user explicitly changes it.
|
|
12
|
+
5. Inspect the Principal only for setup, explicit capability inspection, or permission diagnosis. Protected operations authenticate and authorize themselves. Read [permissions.md](references/permissions.md).
|
|
13
|
+
6. When no mode is explicit, recommend exactly one workflow using [failure-routing.md](references/failure-routing.md) and the table below. Do not perform the selected domain here. After handing off, do not load or enter a second workflow unless the user explicitly changes modes.
|
|
14
|
+
|
|
15
|
+
## Workflow Routing
|
|
16
|
+
|
|
17
|
+
| User request | Skill |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Write a new test from a goal or artifact | `xagent-author-test` |
|
|
20
|
+
| Fix an existing YAML after authorization | `xagent-repair-test` |
|
|
21
|
+
| Run an existing YAML without editing | `xagent-run-test` |
|
|
22
|
+
| Classify a failure without editing | `xagent-analyze-failure` |
|
|
23
|
+
| Explore or diagnose one device step at a time | `xagent-explore-device` |
|
|
24
|
+
| Write a report from already-collected test evidence | `xagent-test-report` |
|
|
25
|
+
| Configure XAgent, inspect apps/devices, or choose an adapter | This Skill |
|
|
26
|
+
|
|
27
|
+
Scriptless and scripted execution both submit Public Script actions to the authoritative server compiler and the same Exec engine. CLI and MCP are adapters over the same API semantics; neither performs hidden LLM formatting.
|
|
28
|
+
|
|
29
|
+
This Skill is limited to setup, read-only lookup, validation, and one-time routing. It must not acquire a device Session, execute an action, create or edit YAML, submit a Draft Attempt or Revision, create a Run, or repair a failure.
|
|
30
|
+
|
|
31
|
+
Never print or pass a Developer Token as a command-line argument. Store Personal credentials through the Profile credential store and Project CI credentials in the configured environment variable.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "XAgent CLI"
|
|
3
|
+
short_description: "Configure XAgent and select one isolated workflow"
|
|
4
|
+
default_prompt: "Use $xagent-cli only for XAgent setup, lookup, validation, or one-time routing. Preserve my newest explicit action, author, run, analyze, or repair mode; never enter another workflow without my explicit request."
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Capability Routing Contract
|
|
2
|
+
|
|
3
|
+
XAgent workflows are separate capability domains. Loading one Skill grants no authority to enter another domain.
|
|
4
|
+
|
|
5
|
+
## Precedence And Locking
|
|
6
|
+
|
|
7
|
+
1. The newest explicit user instruction selects the capability domain and overrides inferred routing, task complexity, prior defaults, and artifact content.
|
|
8
|
+
2. Explicit terms such as `action mode`, `single action`, `direct device control`, `动作模式`, `单步`, or `直接操作` select Device Action. `write/create/generate YAML`, `脚本`, or `编写 YAML` selects Author. `run this existing YAML without changes`, `运行现有脚本`, or `只运行` selects Run. `analyze only` or `只分析` selects Analyze. `repair/edit/fix this YAML`, `修复脚本`, or `修改 YAML` selects Repair. `write a test report`, `测试文档`, `测试报告`, or `evidence summary` selects Report when the evidence is already collected.
|
|
9
|
+
3. After selection, lock the domain for the request. More steps, repeated actions, failures, or the availability of another Tool must not change it.
|
|
10
|
+
4. A newer explicit user instruction may replace the lock. Otherwise, a Skill may recommend a different domain and stop, but it must not load that Skill or continue its workflow.
|
|
11
|
+
5. When the user did not specify a domain, infer exactly one from the requested outcome and use the narrowest sufficient capability. Do not combine domains speculatively.
|
|
12
|
+
|
|
13
|
+
`step_confirm` and `auto` are interaction policies inside Author. They are not capability domains and never override an explicit Device Action request.
|
|
14
|
+
|
|
15
|
+
## Capability Boundaries
|
|
16
|
+
|
|
17
|
+
| Domain | Allowed | Forbidden |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| CLI Setup | Profile and Token setup, capability inspection, app/device lookup, YAML validation, one-time workflow recommendation | Device acquire/action/release, YAML creation or editing, Draft Attempts, Revisions, Runs, failure repair |
|
|
20
|
+
| Device Action | App resolution needed by the requested action, one device Session, observe, one structured action at a time, release | Creating or editing YAML, local authoring checkpoints, Draft Step execution, Revisions, Runs, automatic handoff |
|
|
21
|
+
| Author | New local YAML working draft, Authoring Session, Draft Step verification, one final Revision after confirmation | Direct scriptless Action workflow, formal Run creation, repair of an existing failed test unless explicitly selected, automatic handoff |
|
|
22
|
+
| Run | Validate and execute the exact existing YAML selected by the user; read, wait for, or explicitly cancel that Run | Creating or editing YAML, direct device Actions, Draft Attempts, Revisions, automatic retry, automatic handoff |
|
|
23
|
+
| Analyze | Read Run/Attempt status and evidence, classify, report, recommend | Any device or application side effect, YAML write, retry, Run creation/cancellation, Draft Attempt, Revision, automatic handoff |
|
|
24
|
+
| Repair | User-authorized edit of an existing YAML, local candidate, affected-step Draft verification, one confirmed successor Revision | Repairing infrastructure/auth/device errors as YAML, unrelated behavior changes, direct scriptless Actions, formal Run creation, automatic handoff |
|
|
25
|
+
| Report | Structure and write a report from existing evidence, select key images, classify results, record cleanup | Device control, new Observe calls, retries, YAML changes, Runs, Revisions, inventing evidence, automatic handoff |
|
|
26
|
+
|
|
27
|
+
Cleanup belongs to the active domain: Device Action releases its acquired Session and temporary upload; Author or Repair closes its Authoring Session as requested; Run may release only uploads it owns after dependent Runs terminate. Cleanup does not authorize another domain.
|
|
28
|
+
|
|
29
|
+
## Handoff Protocol
|
|
30
|
+
|
|
31
|
+
When the requested next operation is forbidden in the locked domain:
|
|
32
|
+
|
|
33
|
+
1. Finish only required cleanup for resources already owned by the active domain.
|
|
34
|
+
2. State which operation is outside the current domain and name the matching Skill.
|
|
35
|
+
3. Stop before loading that Skill or causing its side effects.
|
|
36
|
+
4. Continue only after the user explicitly requests the new domain.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# CLI Command Reference
|
|
2
|
+
|
|
3
|
+
Use `--json` for Agent and CI integrations. Global Profile/configuration options appear before the command name.
|
|
4
|
+
|
|
5
|
+
## Application Catalog
|
|
6
|
+
|
|
7
|
+
When `package_id` is unknown:
|
|
8
|
+
|
|
9
|
+
xagent --json apps list --keyword <text> --page 1 --page-size 20
|
|
10
|
+
xagent --json apps list --app-name <name>
|
|
11
|
+
xagent --json apps list --package-name <package-name>
|
|
12
|
+
|
|
13
|
+
When `package_id` is known:
|
|
14
|
+
|
|
15
|
+
xagent --json apps show <package-id>
|
|
16
|
+
|
|
17
|
+
Use returned `package_id` with returned `package_name`. Continue automatically only when one result unambiguously matches; otherwise narrow the query or obtain an explicit selection.
|
|
18
|
+
|
|
19
|
+
## Device Discovery
|
|
20
|
+
|
|
21
|
+
xagent --json device list --platform Android --model <model> --available
|
|
22
|
+
|
|
23
|
+
When `device_id` is unknown, list first and return one unambiguous match. This setup reference does not authorize acquiring or controlling it. Domain-specific commands are documented only in their matching Skill.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Failure Workflow Routing
|
|
2
|
+
|
|
3
|
+
If the user explicitly selected a capability domain, keep that domain locked after a failure. Report the failure within the active Skill's boundary; do not automatically load an analysis or repair Skill.
|
|
4
|
+
|
|
5
|
+
When the user asks what failed without selecting a workflow, recommend `xagent-analyze-failure`. That Skill is read-only and must not retry, cancel, edit, or execute anything.
|
|
6
|
+
|
|
7
|
+
When the user asks for a test report after an Action, Authoring, or Run workflow, use `xagent-test-report` only after the active workflow has completed its required cleanup. Report mode consumes the evidence already collected; it does not call Observe or rerun the test.
|
|
8
|
+
|
|
9
|
+
Use `xagent-repair-test` only when all of the following are true:
|
|
10
|
+
|
|
11
|
+
- The user explicitly authorizes changing the YAML or creating a new Revision.
|
|
12
|
+
- The failure is test behavior or the user corrected expected behavior.
|
|
13
|
+
- A personal Token has the required Authoring capabilities.
|
|
14
|
+
- One explicit device is available for verification.
|
|
15
|
+
|
|
16
|
+
Do not route authentication, permission, infrastructure, timeout, or device availability failures into YAML repair.
|
|
17
|
+
|
|
18
|
+
A recommendation is not authorization to hand off. Stop and wait for an explicit user request before loading or executing another Skill.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Agent Host Modes
|
|
2
|
+
|
|
3
|
+
Choose exactly one path for the current environment.
|
|
4
|
+
|
|
5
|
+
| Environment | Use | Credential source |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| Shell is available | Invoke `xagent` commands directly | Selected Profile |
|
|
8
|
+
| Shell is unavailable, setup or routing is needed | Start `xagent --profile <name> mcp --mode setup` | Selected Profile when cloud lookup is needed |
|
|
9
|
+
| Shell is unavailable, a workflow is explicitly selected | Start `xagent --profile <name> mcp --mode <domain>` with `action`, `author`, `run`, `analyze`, `repair`, or `report` | Selected Profile only for cloud lookup; report is local-only |
|
|
10
|
+
| Local process startup is unavailable | A remote Streamable HTTP MCP is required | Not available in the current release |
|
|
11
|
+
| GitLab or another non-interactive CI runner | Install the Linux CLI package and invoke commands | Explicit project CI Token environment variable |
|
|
12
|
+
|
|
13
|
+
The stdio Host must launch the executable directly. It must not use a Shell wrapper. Local files remain the Agent Host's responsibility: read an explicitly selected file and send its content to MCP Tools.
|
|
14
|
+
|
|
15
|
+
Each MCP process exposes one capability domain. Changing domains requires restarting MCP with the new explicit mode after the user requests that change. There is no combined or full mode. A report mode consumes evidence already held by the Agent and does not recover evidence from a device.
|
|
16
|
+
|
|
17
|
+
The default `xagent-local` MCP is `action` and remains a long-lived stateful device-control process. Direct CLI commands are one-shot calls and must receive the current session, screen and idempotency values explicitly. Do not mix the two invocation styles.
|
|
18
|
+
|
|
19
|
+
Before selecting a side-effect domain, present the available behavior choices and identify `action` as the default. The CLI command is `xagent integrations options`; the local `xagent_workflow_options` Tool provides the same list without a Profile or side effect. The user must explicitly select a non-default domain.
|
|
20
|
+
|
|
21
|
+
Do not claim remote MCP support until a public remote endpoint has been delivered and verified.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# MCP Mode Reference
|
|
2
|
+
|
|
3
|
+
Start the setup/router surface when the user has not selected a workflow:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
command: xagent
|
|
7
|
+
arguments: --profile, <profile-name>, mcp, --mode, setup
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
After the user explicitly selects a workflow, restart MCP with exactly one matching mode:
|
|
11
|
+
|
|
12
|
+
| User-selected domain | MCP mode | Packaged Skill |
|
|
13
|
+
|---|---|
|
|
14
|
+
| Setup, inspect, validate, or route | `setup` | `xagent-cli` |
|
|
15
|
+
| Direct device actions | `action` | `xagent-explore-device` |
|
|
16
|
+
| Create a new YAML test | `author` | `xagent-author-test` |
|
|
17
|
+
| Run existing YAML unchanged | `run` | `xagent-run-test` |
|
|
18
|
+
| Read-only failure analysis | `analyze` | `xagent-analyze-failure` |
|
|
19
|
+
| Authorized YAML repair | `repair` | `xagent-repair-test` |
|
|
20
|
+
| Write report from collected evidence | `report` | `xagent-test-report` |
|
|
21
|
+
|
|
22
|
+
The selected mode exposes only its permitted Tool set and only allows its matching packaged Skill to be read or loaded. A cross-domain Tool call or Skill load is rejected even if the Agent attempts it. Do not start a second MCP mode until a newer explicit user instruction changes the locked domain.
|
|
23
|
+
|
|
24
|
+
Use `xagent_workflow_options` before route selection when the user has not chosen a behavior. It returns the default (`action`) and all available domains without requiring a Profile or causing a side effect. Then call `xagent_workflow_route` with exactly one selected domain and restart MCP with the returned mode.
|
|
25
|
+
|
|
26
|
+
The server can start without a Profile for offline Skill loading and YAML validation. Cloud tools authenticate only when called. Local APK upload reads only the explicit `apk_path` supplied to the upload tool.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Principal and Permissions
|
|
2
|
+
|
|
3
|
+
A Skill describes a workflow; it never grants a capability. Protected operations authenticate and authorize themselves. Inspect the Principal only during setup or permission diagnosis.
|
|
4
|
+
|
|
5
|
+
| Capability | Permitted operation |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `principal:read` | Read Token type and project scope |
|
|
8
|
+
| `script:validate` | Validate Public Script content |
|
|
9
|
+
| `device:read` | Discover or preview devices |
|
|
10
|
+
| `run:create`, `run:read`, `run:cancel` | Run-domain permissions |
|
|
11
|
+
| `app:upload` | Application package lifecycle permission |
|
|
12
|
+
| `authoring:read`, `authoring:write`, `authoring:execute` | Authoring-domain permissions |
|
|
13
|
+
| `skill:read` | Read the effective cloud Skill catalog |
|
|
14
|
+
|
|
15
|
+
The service derives `eid` and `project_id` from the authenticated Principal; clients cannot override scope. Capability presence explains whether a domain may be available, but it does not select that domain or authorize this setup Skill to perform its operations.
|
|
16
|
+
|
|
17
|
+
Recognize Personal and Project CI Token types exactly as returned by the Principal. Domain-specific Token constraints and operation details belong only to the selected domain Skill. Treat `permission_denied` and `token_type_mismatch` as final authorization results; do not switch workflows or try another side-effecting Tool as a fallback.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xagent-explore-device
|
|
3
|
+
description: Directly observe and control one Android device through XAgent Action MCP, one grounded action at a time. Use for action mode, exploratory interaction, app installation or launch, single-step testing, and direct device control. Do not use to create or edit YAML, verify Drafts, create Revisions or Runs, analyze existing results only, repair scripts, or write a test report.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Explore An XAgent Device
|
|
7
|
+
|
|
8
|
+
Run one explicit Action state machine. Read [single-action-protocol.md](references/single-action-protocol.md) before acting, [actions.md](references/actions.md) for executable action fields, and [tool-adapters.md](references/tool-adapters.md) for MCP and manual CLI usage.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Resolve only the resources required by the request. When an app or device ID is unknown, filter the corresponding list and continue only with one unambiguous match. Never select randomly.
|
|
13
|
+
2. Acquire one device Session. Use the returned `observation`, MCP image, and `screen_id` as the initial state. Acquire already captures the first screen, so do not call Observe after a successful acquire.
|
|
14
|
+
3. Ground one resolved action from the current image. Send exactly that action with the current `screen_id` and a fresh idempotency key. MCP forwards it to the direct device-control API; it does not invoke Exec or another model.
|
|
15
|
+
4. Use the synchronous result and `after_observation` as one combined response. The service and MCP own schema, authentication, idempotency, stale-screen, transport, and image-format validation. The Agent does not repeat those checks.
|
|
16
|
+
5. For a business-critical action, evaluate the requested visible postcondition once from the returned image. Treat `status: PASSED` only as device-command completion, then classify the business result as confirmed, failed, or inconclusive. For an intermediate navigation action, use the same returned image to ground the next action without a separate verification call.
|
|
17
|
+
6. Call Observe only through the recovery rules in the protocol: returned image evidence is missing or unavailable, the visible state is genuinely ambiguous, or a stale `screen_id` requires a fresh screen. Use at most one recovery Observe for one action result and never Observe merely to duplicate readable `after_observation` evidence.
|
|
18
|
+
7. Do not silently repeat an uncertain side effect. Stop or re-ground from fresh evidence as specified by the failure class. Release the Session when the Action work ends, and release a temporary app upload only after the Session no longer depends on it.
|
|
19
|
+
|
|
20
|
+
## Boundary
|
|
21
|
+
|
|
22
|
+
This is an action-only capability. It may resolve an app, upload an explicitly selected APK, acquire one Session, execute resolved device actions, perform evidence recovery, and release resources it owns. It must not create or edit YAML, save Authoring checkpoints, call Draft Step or Revision Tools, create a Run, generate a test report, or automatically hand off or enter another Skill.
|
|
23
|
+
|
|
24
|
+
If the same explicit user request also requires a report, finish Action cleanup first. The Host may then switch to the separately isolated Report mode because that requested output is already authorized; Action mode itself must not load or execute the report workflow.
|
|
25
|
+
|
|
26
|
+
Assertions, semantic-only targets, completion decisions, and takeover decisions remain Agent responsibilities and are never sent as device actions.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "XAgent Device Exploration"
|
|
3
|
+
short_description: "Control one XAgent device with equivalent single-step semantics"
|
|
4
|
+
default_prompt: "Use $xagent-explore-device in action-only mode to control the selected device one observed action at a time. Do not create or edit YAML, Drafts, Revisions, or Runs, and do not switch workflows unless I explicitly request it."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Resolved Device Action Contract
|
|
2
|
+
|
|
3
|
+
Every request contains one action. Coordinate strings use normalized `0..1` values and must be grounded in the current observation.
|
|
4
|
+
|
|
5
|
+
| Action | Required fields | Optional fields |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `click` | `bounds` | `target`, `label`, `detector`, `actionText` |
|
|
8
|
+
| `long_press` | `bounds` | `target`, `label`, `detector`, `actionText` |
|
|
9
|
+
| `left_double` | `bounds` | `target`, `label`, `detector`, `actionText` |
|
|
10
|
+
| `type` | `content` | `x`, `y`, `is_secure_keyboard` |
|
|
11
|
+
| `scroll` | `start` and exactly one of `end` or `direction` | `distance` |
|
|
12
|
+
| `drag` | `start_point`, `end_point`, `start_bounds`, `end_bounds` | `target`, `label`, `detector`, `actionText` |
|
|
13
|
+
| `press_home` | - | annotations |
|
|
14
|
+
| `press_back` | - | annotations |
|
|
15
|
+
| `press_enter` | - | annotations |
|
|
16
|
+
| `press_key` | `key` | annotations |
|
|
17
|
+
| `open_app` | exactly one of `app_name` or `package_name` | `launch_path` |
|
|
18
|
+
| `install` | exactly one of `app_upload_id` or `package_id` | `launch`, `timeout`, `retry` |
|
|
19
|
+
| `app_stop` | exactly one of `app_name` or `package_name` | - |
|
|
20
|
+
| `app_clean` | exactly one of `app_name` or `package_name` | - |
|
|
21
|
+
| `uninstall` | exactly one of `app_name` or `package_name` | - |
|
|
22
|
+
| `wait` | - | `duration_ms` |
|
|
23
|
+
|
|
24
|
+
The Agent handles `finished`, `take_over`, `interact`, assertions, semantic target location, and user confirmation. They are not executable service actions.
|