@loadmill/droid-cua 2.29.0 → 2.30.0

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 (37) hide show
  1. package/README.md +4 -4
  2. package/build/index.js +142 -10
  3. package/build/src/browser/cloud-browser-catalog.js +27 -0
  4. package/build/src/browser/factory.js +33 -10
  5. package/build/src/browser/gesture-dispatch.js +281 -0
  6. package/build/src/browser/interface.js +3 -0
  7. package/build/src/browser/normalize.js +3 -1
  8. package/build/src/browser/playwright/actions.js +5 -271
  9. package/build/src/browser/webdriver/actions.js +10 -0
  10. package/build/src/browser/webdriver/client.js +83 -0
  11. package/build/src/browser/webdriver/connection.js +300 -0
  12. package/build/src/browser/webdriver/page-facade.js +123 -0
  13. package/build/src/browser/webdriver/session-state.js +35 -0
  14. package/build/src/cli/headless-execution-config.js +1 -1
  15. package/build/src/cli/headless-runner.js +26 -13
  16. package/build/src/cli/headless-target.js +87 -16
  17. package/build/src/cli/headless-test-source-label.js +4 -0
  18. package/build/src/cli/loadmill-cloud-device-connect-summary.js +6 -0
  19. package/build/src/cli/loadmill-cloud-session.js +26 -0
  20. package/build/src/core/context-optimization.js +1 -1
  21. package/build/src/core/execution-engine.js +9 -0
  22. package/build/src/core/runtime-config.js +2 -2
  23. package/build/src/desktop-shared/connection-predicates.js +52 -0
  24. package/build/src/device/cloud/loadmill-cloud/adapter.js +17 -12
  25. package/build/src/device/cloud/loadmill-cloud/artifact-downloader.js +13 -7
  26. package/build/src/device/cloud/loadmill-cloud/control-plane-client.js +22 -5
  27. package/build/src/device/cloud/loadmill-cloud/errors.js +25 -0
  28. package/build/src/device/cloud/loadmill-cloud/run-pool.js +41 -0
  29. package/build/src/device/cloud/loadmill-cloud/run-status.js +4 -0
  30. package/package.json +1 -1
  31. package/skill/droid-cua/SKILL.md +10 -3
  32. package/skill/droid-cua/agents/openai.yaml +2 -2
  33. package/skill/droid-cua/references/authoring-tests.md +36 -6
  34. package/skill/droid-cua/references/iterative-improvement.md +143 -0
  35. package/skill/droid-cua/references/onboarding-and-troubleshooting.md +19 -0
  36. package/skill/droid-cua/references/project-and-auth.md +2 -0
  37. package/skill/droid-cua/references/running-and-healing.md +32 -14
@@ -2,38 +2,38 @@
2
2
 
3
3
  ## Construct the run
4
4
 
5
- Prefer a single test before a directory or scenario run. Preserve an existing provider/model choice in `ci/droid-cua.json`; otherwise use the Loadmill provider. Use Loadmill Smart as the recommended default, or Loadmill Pulse when the user prioritizes faster, lower-cost execution:
5
+ Prefer a single test before a directory or scenario run. Preserve an existing provider/model choice in `ci/droid-cua.json`; otherwise use the Loadmill provider with Loadmill Pulse as the recommended model for daily authoring, local runs, and CI. Escalate to Loadmill Smart when stability is a demonstrated problem and run evidence shows Smart improves it:
6
6
 
7
7
  ```sh
8
- # Recommended default
9
- --llm-provider loadmill --cua-model loadmill-smart
10
-
11
- # Faster, lower-cost option
8
+ # Recommended daily model
12
9
  --llm-provider loadmill --cua-model loadmill-pulse
10
+
11
+ # Evidence-driven stability escalation
12
+ --llm-provider loadmill --cua-model loadmill-smart
13
13
  ```
14
14
 
15
- All Loadmill models require `LOADMILL_API_TOKEN`. Do not switch between Smart, Pulse, and Beacon silently; preserve the project's model or explain the capability, speed, and experimental tradeoffs and follow the user's choice. If the user chooses direct OpenAI access instead, require `OPENAI_API_KEY` and use `--llm-provider openai` with one of `gpt-5.6-terra`, `gpt-5.6-luna`, or `gpt-5.4`. Do not mix a provider with another provider's model, silently switch providers, or override an existing project choice without explaining it.
15
+ All Loadmill models require `LOADMILL_API_TOKEN`. Do not switch from Pulse to Smart merely because a test failed or was slow; first identify a model-related stability issue, then keep Smart only when comparison evidence shows an improvement. Do not switch between Smart, Pulse, and Beacon silently; preserve the project's model or explain the capability, speed, and experimental tradeoffs and follow the user's choice. If the user chooses direct OpenAI access instead, require `OPENAI_API_KEY` and use `--llm-provider openai` with one of `gpt-5.6-terra`, `gpt-5.6-luna`, or `gpt-5.4`. Do not mix a provider with another provider's model, silently switch providers, or override an existing project choice without explaining it.
16
16
 
17
17
  Include `--report reports/<test-name>.html` for normal test runs unless the user opts out. Prefer an explicit filename over a directory so the result is easy to locate. Add `--debug` for every agent-observed run: it writes the screenshots needed for live progress updates as well as diagnosis.
18
18
 
19
19
  ```sh
20
20
  # Attached Android device or running emulator
21
- droid-cua --llm-provider loadmill --cua-model loadmill-smart --avd adb:<serial> --instructions tests/example.dcua --context tests/context.md --debug --report reports/example.html
21
+ droid-cua --llm-provider loadmill --cua-model loadmill-pulse --avd adb:<serial> --instructions tests/example.dcua --context tests/context.md --debug --report reports/example.html
22
22
 
23
23
  # Launchable Android AVD
24
24
  droid-cua --avd avd:<avd-name> --instructions tests/example.dcua --config ci/droid-cua.json --debug --report reports/example.html
25
25
 
26
26
  # iOS Simulator
27
- droid-cua --llm-provider loadmill --cua-model loadmill-smart --platform ios --avd "<simulator-name>" --instructions tests/example.dcua --debug --report reports/example.html
27
+ droid-cua --llm-provider loadmill --cua-model loadmill-pulse --platform ios --avd "<simulator-name>" --instructions tests/example.dcua --debug --report reports/example.html
28
28
 
29
29
  # Local web
30
- droid-cua --llm-provider loadmill --cua-model loadmill-smart --target web --browser chrome --session-mode fresh --instructions tests/example.dcua --debug --report reports/example.html
30
+ droid-cua --llm-provider loadmill --cua-model loadmill-pulse --target web --browser chrome --session-mode fresh --instructions tests/example.dcua --debug --report reports/example.html
31
31
 
32
32
  # LambdaTest
33
- droid-cua --llm-provider loadmill --cua-model loadmill-smart --device-source lambdatest --platform android --device-name "<name>" --os-version "<version>" --app <app.apk> --instructions tests/example.dcua --debug --report reports/example.html
33
+ droid-cua --llm-provider loadmill --cua-model loadmill-pulse --device-source lambdatest --platform android --device-name "<name>" --os-version "<version>" --app <app.apk> --instructions tests/example.dcua --debug --report reports/example.html
34
34
 
35
35
  # AWS Device Farm
36
- droid-cua --llm-provider loadmill --cua-model loadmill-smart --device-source aws-device-farm --platform android --device-name "<name>" --os-version "<version>" --app <app.apk> --instructions tests/example.dcua --debug --report reports/example.html
36
+ droid-cua --llm-provider loadmill --cua-model loadmill-pulse --device-source aws-device-farm --platform android --device-name "<name>" --os-version "<version>" --app <app.apk> --instructions tests/example.dcua --debug --report reports/example.html
37
37
 
38
38
  # Direct OpenAI alternative
39
39
  droid-cua --llm-provider openai --cua-model gpt-5.4 --avd adb:<serial> --instructions tests/example.dcua --context tests/context.md --debug --report reports/example.html
@@ -43,7 +43,7 @@ Use `.ipa` and `--platform ios` for supported cloud iOS runs. Preserve existing
43
43
 
44
44
  ## Confirm the run with the user
45
45
 
46
- Before starting any test command, send the user a short, plain-language run plan and wait for explicit confirmation. Treat this as a product conversation, not a command preview. Do not infer that a request to run a test also confirms an automatically selected device, browser, or batch of tests.
46
+ Before starting any test command, send the user a short, plain-language run plan and wait for explicit confirmation. Treat this as a product conversation, not a command preview. Do not infer that a request to run a test also confirms an automatically selected device, browser, or batch of tests. For an explicitly requested author-run-improve workflow, the plan may ask approval for the baseline and the evidence-driven edit/rerun and confidence runs needed to reach a readiness decision; follow [iterative-improvement.md](iterative-improvement.md).
47
47
 
48
48
  The run plan should briefly state:
49
49
 
@@ -54,7 +54,7 @@ The run plan should briefly state:
54
54
 
55
55
  Do not include CLI flags, commands, provider or model names, credential/key names, config/context filenames, or internal log/report paths unless the user asks or one changes a decision they need to make. Do not paste the test source into the confirmation.
56
56
 
57
- Ask the user about every unresolved or ambiguous choice before running. If the plan is complete, ask for a clear go-ahead (for example, `Ready to run this?`). Start only after they confirm. If they change the tests, target, or other material run detail, show the revised plan and confirm it again.
57
+ Ask the user about every unresolved or ambiguous choice before running. If the plan is complete, ask for a clear go-ahead (for example, `Ready to run this?`). Start only after they confirm. If they change the target, app build, test scope, provider/model, or another user-visible consequence, show the revised plan and confirm it again. Wording, context, config experiments, targeted reruns, and final confidence runs within an approved iterative workflow do not require separate confirmation when the target and side effects stay unchanged.
58
58
 
59
59
  For example: `I’m ready to run the Chrome smoke test in a fresh local Chrome window. It will check that Chrome opens and then closes. I’ll share screenshots as it progresses and provide a report at the end. Ready to run this?`
60
60
 
@@ -62,6 +62,14 @@ For example: `I’m ready to run the Chrome smoke test in a fresh local Chrome w
62
62
 
63
63
  Remain attached until the command exits and cloud cleanup finishes. Run the command through an interactive/pollable terminal mechanism so progress and new artifacts can be observed before it exits. Read terminal progress as it appears; do not treat a long model step as success or failure before completion.
64
64
 
65
+ ## Diagnose Loadmill flow failures
66
+
67
+ When an instruction that invokes a saved Loadmill flow fails, inspect the `[Loadmill] FAILED` block first. Capture the command, the `Error:` text, and the suite run ID. Droid asks Loadmill for a failure explanation automatically, so the `Error:` text contains Loadmill's reason when one is available.
68
+
69
+ If that reason is insufficient, open the suite run from the Loadmill Flow card in the desktop app and inspect the failed flow step and its available request, response, and assertion evidence. For a headless run, use the reported suite run ID and Loadmill site base URL to locate the same run at `/app/api-tests/test-suite-runs/<suite-run-id>`. Do not expose secrets from Loadmill evidence in chat, logs, or reports.
70
+
71
+ Classify a flow that started and then failed inside Loadmill as a **Loadmill flow failure**, not a Droid UI-test failure. Do not rewrite later UI instructions or assertions to hide it. Correct the `.dcua` instruction only when the evidence shows Droid selected the wrong flow or passed the wrong parameters because the request was ambiguous. Retry the unchanged instruction once only for a transient Loadmill service or network failure; otherwise stop and report the Loadmill explanation, failing flow step, and suite-run link or ID.
72
+
65
73
  ## Show live visual progress
66
74
 
67
75
  Use the screenshots already captured by `--debug` to make the run understandable while it is happening. This is a required user-facing behavior, not merely an artifact to inspect after the run. After the CLI prints `Debug logging enabled: <logs/execution-...>.jsonl`, new PNGs appear in that log file's sibling directory. Keep the CLI running in a pollable/background session and poll that directory while the test is running.
@@ -95,6 +103,16 @@ After the run, verify that the report exists and resolve its absolute path. Open
95
103
 
96
104
  Report the outcome, failing instruction and first divergence when applicable, relevant error text, screenshot/debug/report paths, target, provider/model, and command with secret values omitted.
97
105
 
106
+ After all requested running and healing work is complete, end with a short plain-language retrospective. Summarize the overall journey rather than listing every action or rerun:
107
+
108
+ - What behavior was tested and whether it is ready.
109
+ - The main ambiguity, failure, slow step, recovery loop, or other bottleneck found.
110
+ - What changed in the test, context, data, or configuration and why it addressed that evidence.
111
+ - The most meaningful before/after timing and stability results, such as total or hotspot duration, retries, recoveries, repeated actions, or consistency. Use exact numbers only when the artifacts support them; otherwise describe the observed improvement without inventing precision.
112
+ - Any remaining risk or blocker, followed by links to the final report and relevant evidence.
113
+
114
+ Keep this retrospective concise and lead with the result and improvement. Do not make the user reconstruct what happened from terminal output, screenshots, reports, or a chronological transcript.
115
+
98
116
  ## Classify the first divergence
99
117
 
100
118
  1. **Setup or authentication**: missing/invalid provider credential, dependency, license, browser, or executable. Return to onboarding and rerun only the failed check.
@@ -107,4 +125,4 @@ Report the outcome, failing instruction and first divergence when applicable, re
107
125
 
108
126
  Before editing, state the classification and evidence. Change only `.dcua`, `context.md`, `test-data.md`, or Droid CUA config. Never edit app code, delete coverage, loosen the expected outcome, or add broad waits simply to obtain green output.
109
127
 
110
- Make one minimal change, explain why it corrects the test rather than hides a product defect, and rerun only the affected test. Allow at most two edit/rerun cycles. If it still fails, stop with the original and final evidence, changes attempted, and recommended owner/action.
128
+ Apply the smallest evidence-supported batch, explain why each change corrects the test rather than hides a product defect, and rerun only the affected test. Continue analyzing, editing, and rerunning until the final representative evidence supports readiness or a genuine blocker remains. Do not stop based on a fixed rerun count. Stop when the evidence indicates an application regression, an environment or product dependency prevents progress, or no evidence-supported test, context, data, or configuration improvement remains; report the original and final evidence, changes attempted, and recommended owner/action.