@bastani/atomic 0.9.20-alpha.5 → 0.9.20-alpha.6

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 (285) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +37 -0
  3. package/dist/builtin/intercom/CHANGELOG.md +10 -0
  4. package/dist/builtin/intercom/broker/broker.ts +110 -39
  5. package/dist/builtin/intercom/broker/client.ts +8 -1
  6. package/dist/builtin/intercom/index.bundle.mjs +61 -2
  7. package/dist/builtin/intercom/live-route-refusal.ts +69 -0
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/intercom/recoverable-disconnect.ts +16 -4
  10. package/dist/builtin/intercom/skills/intercom/SKILL.md +11 -11
  11. package/dist/builtin/intercom/types.ts +3 -1
  12. package/dist/builtin/mcp/package.json +2 -2
  13. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  14. package/dist/builtin/subagents/package.json +3 -3
  15. package/dist/builtin/subagents/skills/cua-driver/BROWSER.md +494 -0
  16. package/dist/builtin/subagents/skills/cua-driver/EMBEDDING.md +578 -0
  17. package/dist/builtin/subagents/skills/cua-driver/LINUX.md +364 -0
  18. package/dist/builtin/subagents/skills/cua-driver/MACOS.md +509 -0
  19. package/dist/builtin/subagents/skills/cua-driver/README.md +113 -0
  20. package/dist/builtin/subagents/skills/cua-driver/RECORDING.md +162 -0
  21. package/dist/builtin/subagents/skills/cua-driver/SKILL.md +1105 -0
  22. package/dist/builtin/subagents/skills/cua-driver/WINDOWS.md +866 -0
  23. package/dist/builtin/web-access/package.json +2 -2
  24. package/dist/builtin/workflows/CHANGELOG.md +13 -0
  25. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  26. package/dist/builtin/workflows/builtin/{chunk-7f381xnq.js → chunk-2hzrv5y8.js} +140 -21
  27. package/dist/builtin/workflows/builtin/{chunk-e83tc6nr.js → chunk-3tx8ry44.js} +3 -2
  28. package/dist/builtin/workflows/builtin/{chunk-00ywx588.js → chunk-5724b0cf.js} +1 -1
  29. package/dist/builtin/workflows/builtin/{chunk-ne6vh5ct.js → chunk-7n51c5gh.js} +1 -1
  30. package/dist/builtin/workflows/builtin/{chunk-x2nftpgj.js → chunk-9z3ztr2a.js} +1 -1
  31. package/dist/builtin/workflows/builtin/{chunk-zj5162bh.js → chunk-deq63d9p.js} +3 -3
  32. package/dist/builtin/workflows/builtin/{chunk-7h7s5xdj.js → chunk-dxjxtgmp.js} +1 -1
  33. package/dist/builtin/workflows/builtin/{chunk-tvcydq13.js → chunk-ffdrv23t.js} +1 -1
  34. package/dist/builtin/workflows/builtin/{chunk-pfm1kgqz.js → chunk-hmt5w62g.js} +12 -4
  35. package/dist/builtin/workflows/builtin/{chunk-tdqvdrg1.js → chunk-jngsbbpm.js} +3 -3
  36. package/dist/builtin/workflows/builtin/{chunk-55p5dxjk.js → chunk-njmf5ze7.js} +1 -1
  37. package/dist/builtin/workflows/builtin/{chunk-evfb0312.js → chunk-vn0wb31x.js} +1 -1
  38. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  39. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  40. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  41. package/dist/builtin/workflows/builtin/goal.js +4 -4
  42. package/dist/builtin/workflows/builtin/index.js +12 -12
  43. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  44. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  45. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  46. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  47. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  48. package/dist/builtin/workflows/package.json +2 -2
  49. package/dist/builtin/workflows/src/extension/index.bundle.mjs +199 -36
  50. package/dist/builtin/workflows/src/index.js +1418 -1271
  51. package/dist/cli/args.d.ts.map +1 -1
  52. package/dist/cli/args.js +15 -4
  53. package/dist/cli/args.js.map +1 -1
  54. package/dist/cli/file-processor.d.ts +1 -1
  55. package/dist/cli/file-processor.d.ts.map +1 -1
  56. package/dist/cli/file-processor.js.map +1 -1
  57. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  58. package/dist/core/agent-session-auto-compaction.js +40 -12
  59. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  60. package/dist/core/agent-session-bash.d.ts.map +1 -1
  61. package/dist/core/agent-session-bash.js +9 -8
  62. package/dist/core/agent-session-bash.js.map +1 -1
  63. package/dist/core/agent-session-boundaries.d.ts +68 -0
  64. package/dist/core/agent-session-boundaries.d.ts.map +1 -0
  65. package/dist/core/agent-session-boundaries.js +334 -0
  66. package/dist/core/agent-session-boundaries.js.map +1 -0
  67. package/dist/core/agent-session-compaction.js +1 -1
  68. package/dist/core/agent-session-compaction.js.map +1 -1
  69. package/dist/core/agent-session-events.d.ts.map +1 -1
  70. package/dist/core/agent-session-events.js +27 -13
  71. package/dist/core/agent-session-events.js.map +1 -1
  72. package/dist/core/agent-session-export.d.ts.map +1 -1
  73. package/dist/core/agent-session-export.js +16 -20
  74. package/dist/core/agent-session-export.js.map +1 -1
  75. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  76. package/dist/core/agent-session-message-queue.js +3 -2
  77. package/dist/core/agent-session-message-queue.js.map +1 -1
  78. package/dist/core/agent-session-methods.d.ts +30 -4
  79. package/dist/core/agent-session-methods.d.ts.map +1 -1
  80. package/dist/core/agent-session-methods.js.map +1 -1
  81. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  82. package/dist/core/agent-session-persistent-custom-messages.js +2 -1
  83. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  84. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  85. package/dist/core/agent-session-prompt.js +93 -25
  86. package/dist/core/agent-session-prompt.js.map +1 -1
  87. package/dist/core/agent-session-retry.d.ts.map +1 -1
  88. package/dist/core/agent-session-retry.js +4 -9
  89. package/dist/core/agent-session-retry.js.map +1 -1
  90. package/dist/core/agent-session-runtime.js +1 -1
  91. package/dist/core/agent-session-runtime.js.map +1 -1
  92. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  93. package/dist/core/agent-session-tool-hooks.js +15 -5
  94. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  95. package/dist/core/agent-session-tree.d.ts.map +1 -1
  96. package/dist/core/agent-session-tree.js +2 -3
  97. package/dist/core/agent-session-tree.js.map +1 -1
  98. package/dist/core/agent-session-types.d.ts +6 -0
  99. package/dist/core/agent-session-types.d.ts.map +1 -1
  100. package/dist/core/agent-session-types.js.map +1 -1
  101. package/dist/core/agent-session.d.ts +15 -2
  102. package/dist/core/agent-session.d.ts.map +1 -1
  103. package/dist/core/agent-session.js +17 -1
  104. package/dist/core/agent-session.js.map +1 -1
  105. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  106. package/dist/core/compaction/branch-summarization.js +1 -0
  107. package/dist/core/compaction/branch-summarization.js.map +1 -1
  108. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  109. package/dist/core/compaction/compaction-boundary.js +11 -6
  110. package/dist/core/compaction/compaction-boundary.js.map +1 -1
  111. package/dist/core/compaction/compaction.d.ts +3 -1
  112. package/dist/core/compaction/compaction.d.ts.map +1 -1
  113. package/dist/core/compaction/compaction.js +37 -0
  114. package/dist/core/compaction/compaction.js.map +1 -1
  115. package/dist/core/crash-log.d.ts +6 -0
  116. package/dist/core/crash-log.d.ts.map +1 -0
  117. package/dist/core/crash-log.js +69 -0
  118. package/dist/core/crash-log.js.map +1 -0
  119. package/dist/core/execution-model-router.d.ts +1 -0
  120. package/dist/core/execution-model-router.d.ts.map +1 -1
  121. package/dist/core/execution-model-router.js +15 -12
  122. package/dist/core/execution-model-router.js.map +1 -1
  123. package/dist/core/export-html/template-js/tree-filter-render.js +6 -1
  124. package/dist/core/export-html/template.js +6 -1
  125. package/dist/core/extensions/agent-events.d.ts +69 -3
  126. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  127. package/dist/core/extensions/agent-events.js.map +1 -1
  128. package/dist/core/extensions/api-types.d.ts +5 -3
  129. package/dist/core/extensions/api-types.d.ts.map +1 -1
  130. package/dist/core/extensions/api-types.js.map +1 -1
  131. package/dist/core/extensions/event-results.d.ts +3 -0
  132. package/dist/core/extensions/event-results.d.ts.map +1 -1
  133. package/dist/core/extensions/event-results.js.map +1 -1
  134. package/dist/core/extensions/event-types.d.ts +2 -2
  135. package/dist/core/extensions/event-types.d.ts.map +1 -1
  136. package/dist/core/extensions/event-types.js.map +1 -1
  137. package/dist/core/extensions/index.d.ts +1 -1
  138. package/dist/core/extensions/index.d.ts.map +1 -1
  139. package/dist/core/extensions/index.js.map +1 -1
  140. package/dist/core/extensions/provider-types.d.ts +2 -0
  141. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  142. package/dist/core/extensions/provider-types.js.map +1 -1
  143. package/dist/core/extensions/runner-events.d.ts +16 -2
  144. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  145. package/dist/core/extensions/runner-events.js +98 -5
  146. package/dist/core/extensions/runner-events.js.map +1 -1
  147. package/dist/core/extensions/runner.d.ts +3 -2
  148. package/dist/core/extensions/runner.d.ts.map +1 -1
  149. package/dist/core/extensions/runner.js +4 -1
  150. package/dist/core/extensions/runner.js.map +1 -1
  151. package/dist/core/index.d.ts +1 -1
  152. package/dist/core/index.d.ts.map +1 -1
  153. package/dist/core/index.js.map +1 -1
  154. package/dist/core/messages.d.ts +10 -0
  155. package/dist/core/messages.d.ts.map +1 -1
  156. package/dist/core/messages.js +57 -0
  157. package/dist/core/messages.js.map +1 -1
  158. package/dist/core/model-config.d.ts +52 -0
  159. package/dist/core/model-config.d.ts.map +1 -1
  160. package/dist/core/model-config.js +16 -0
  161. package/dist/core/model-config.js.map +1 -1
  162. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  163. package/dist/core/model-resolver-defaults.js +2 -1
  164. package/dist/core/model-resolver-defaults.js.map +1 -1
  165. package/dist/core/prompt-templates-async.d.ts +2 -2
  166. package/dist/core/prompt-templates-async.d.ts.map +1 -1
  167. package/dist/core/prompt-templates-async.js +57 -29
  168. package/dist/core/prompt-templates-async.js.map +1 -1
  169. package/dist/core/prompt-templates.d.ts +6 -1
  170. package/dist/core/prompt-templates.d.ts.map +1 -1
  171. package/dist/core/prompt-templates.js +61 -35
  172. package/dist/core/prompt-templates.js.map +1 -1
  173. package/dist/core/provider-composer-internal.d.ts +1 -0
  174. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  175. package/dist/core/provider-composer-internal.js +19 -0
  176. package/dist/core/provider-composer-internal.js.map +1 -1
  177. package/dist/core/resource-loader-assets.d.ts.map +1 -1
  178. package/dist/core/resource-loader-assets.js +6 -6
  179. package/dist/core/resource-loader-assets.js.map +1 -1
  180. package/dist/core/sdk.js +3 -2
  181. package/dist/core/sdk.js.map +1 -1
  182. package/dist/core/session-manager-core.d.ts +10 -3
  183. package/dist/core/session-manager-core.d.ts.map +1 -1
  184. package/dist/core/session-manager-core.js +65 -7
  185. package/dist/core/session-manager-core.js.map +1 -1
  186. package/dist/core/session-manager-entries.d.ts +4 -1
  187. package/dist/core/session-manager-entries.d.ts.map +1 -1
  188. package/dist/core/session-manager-entries.js +8 -0
  189. package/dist/core/session-manager-entries.js.map +1 -1
  190. package/dist/core/session-manager-history.d.ts +16 -1
  191. package/dist/core/session-manager-history.d.ts.map +1 -1
  192. package/dist/core/session-manager-history.js +105 -42
  193. package/dist/core/session-manager-history.js.map +1 -1
  194. package/dist/core/session-manager-types.d.ts +30 -3
  195. package/dist/core/session-manager-types.d.ts.map +1 -1
  196. package/dist/core/session-manager-types.js.map +1 -1
  197. package/dist/core/session-manager.d.ts +2 -2
  198. package/dist/core/session-manager.d.ts.map +1 -1
  199. package/dist/core/session-manager.js +1 -1
  200. package/dist/core/session-manager.js.map +1 -1
  201. package/dist/core/structured-output/index.d.ts +0 -1
  202. package/dist/core/structured-output/index.d.ts.map +1 -1
  203. package/dist/core/structured-output/index.js +3 -15
  204. package/dist/core/structured-output/index.js.map +1 -1
  205. package/dist/core/structured-output/jev-client.d.ts +4 -8
  206. package/dist/core/structured-output/jev-client.d.ts.map +1 -1
  207. package/dist/core/structured-output/jev-client.js +36 -32
  208. package/dist/core/structured-output/jev-client.js.map +1 -1
  209. package/dist/core/structured-output/jev.d.ts.map +1 -1
  210. package/dist/core/structured-output/jev.js +4 -12
  211. package/dist/core/structured-output/jev.js.map +1 -1
  212. package/dist/core/structured-output/types.d.ts +0 -2
  213. package/dist/core/structured-output/types.d.ts.map +1 -1
  214. package/dist/core/structured-output/types.js.map +1 -1
  215. package/dist/core/system-prompt.js +1 -1
  216. package/dist/core/system-prompt.js.map +1 -1
  217. package/dist/core/tools/read.d.ts +4 -0
  218. package/dist/core/tools/read.d.ts.map +1 -1
  219. package/dist/core/tools/read.js +5 -1
  220. package/dist/core/tools/read.js.map +1 -1
  221. package/dist/index-extensions.d.ts +1 -1
  222. package/dist/index-extensions.d.ts.map +1 -1
  223. package/dist/index-extensions.js.map +1 -1
  224. package/dist/index.d.ts +2 -2
  225. package/dist/index.d.ts.map +1 -1
  226. package/dist/index.js +2 -2
  227. package/dist/index.js.map +1 -1
  228. package/dist/main-app-mode.d.ts +1 -1
  229. package/dist/main-app-mode.d.ts.map +1 -1
  230. package/dist/main-app-mode.js +3 -2
  231. package/dist/main-app-mode.js.map +1 -1
  232. package/dist/main.d.ts.map +1 -1
  233. package/dist/main.js +1 -1
  234. package/dist/main.js.map +1 -1
  235. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  236. package/dist/modes/interactive/components/tree-selector-content.js +6 -0
  237. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  238. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -1
  239. package/dist/modes/interactive/components/tree-selector-model.js +1 -0
  240. package/dist/modes/interactive/components/tree-selector-model.js.map +1 -1
  241. package/dist/modes/interactive/interactive-agent-events.js +17 -1
  242. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  243. package/dist/modes/interactive/interactive-mode-helpers.d.ts +1 -0
  244. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  245. package/dist/modes/interactive/interactive-mode-helpers.js +16 -0
  246. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  247. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  248. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  249. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  250. package/dist/modes/interactive/interactive-process-lifecycle.js +13 -1
  251. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  252. package/dist/modes/interactive/interactive-session-runtime.js +5 -1
  253. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  254. package/dist/utils/mime.js +1 -1
  255. package/dist/utils/mime.js.map +1 -1
  256. package/dist/utils/tool-result-images.d.ts +3 -1
  257. package/dist/utils/tool-result-images.d.ts.map +1 -1
  258. package/dist/utils/tool-result-images.js +4 -1
  259. package/dist/utils/tool-result-images.js.map +1 -1
  260. package/docs/compaction.md +5 -1
  261. package/docs/computer-use.md +105 -56
  262. package/docs/extensions/events.md +75 -7
  263. package/docs/extensions.md +6 -2
  264. package/docs/getting-started/first-session.md +1 -0
  265. package/docs/intercom/operations.md +13 -1
  266. package/docs/intercom.md +1 -1
  267. package/docs/models/evals.md +68 -82
  268. package/docs/models/reference.md +30 -2
  269. package/docs/packages.md +2 -0
  270. package/docs/prompt-templates.md +1 -0
  271. package/docs/providers.md +8 -2
  272. package/docs/sdk/reference.md +1 -2
  273. package/docs/sdk/structured-decisions.md +10 -9
  274. package/docs/sdk.md +13 -2
  275. package/docs/session-format.md +17 -2
  276. package/docs/settings.md +1 -1
  277. package/docs/skills.md +3 -1
  278. package/docs/subagents/reference.md +4 -4
  279. package/docs/subagents.md +1 -1
  280. package/docs/workflows/api-reference.md +2 -0
  281. package/docs/workflows/authoring.md +191 -0
  282. package/docs/workflows/operations.md +9 -3
  283. package/docs/workflows/verification.md +21 -8
  284. package/npm-shrinkwrap.json +69 -69
  285. package/package.json +8 -8
@@ -0,0 +1,364 @@
1
+ # cua-driver — Linux
2
+
3
+ The Linux backend drives X11 apps **in the background**: clicks and
4
+ keystrokes are injected to the target window without raising it,
5
+ activating it, or moving the real pointer — the same no-foreground
6
+ contract the macOS and Windows backends hold. The full tool surface is
7
+ supported: `click`, `type_text`, scroll, `press_key`, `screenshot`,
8
+ `launch_app`, `list_apps`, `list_windows`, `get_window_state`, and
9
+ session recording.
10
+
11
+ On X11, `set_window_frame({pid, window_id, x, y, width, height})` sends an
12
+ EWMH window-manager request and confirms it against `list_windows` geometry.
13
+ Wayland has no portable protocol for setting another application's top-level
14
+ geometry, so this tool refuses there unless a future compositor-owned adapter
15
+ can provide exact targeting and readback.
16
+
17
+ AT-SPI is talked to natively over D-Bus (the `atspi`/zbus crate) — no
18
+ `pyatspi` or GObject-introspection typelibs are required at runtime.
19
+
20
+ ## How input is delivered (the no-foreground contract)
21
+
22
+ - **Pixel click** — `XSendEvent(ButtonPress/Release)` to the resolved
23
+ target window. No raise, no activate, no real-pointer warp. (It does
24
+ **not** use `XTestFakeButtonEvent`, which would route through the
25
+ focused window.)
26
+ - **Element click** (`element_token`, or `element_index` + `snapshot_id`) — AT-SPI `do_action` on the
27
+ accessible. Toolkit-native, focus-free.
28
+ - **type_text** — AT-SPI EditableText first (focus-free; lands in an
29
+ *unfocused* window's editable for Qt6 / GTK4). When a **non-editable**
30
+ widget holds focus — a spreadsheet cell, a terminal, a canvas — it
31
+ synth-types into the focused widget via XTest, and terminals take a
32
+ focus-free pty-injection path. So background typing into an editable
33
+ needs no focus; the XTest path is the foreground "type where I
34
+ clicked" case.
35
+ - The **agent cursor** is a synthetic overlay showing where the run is
36
+ acting; it never moves the real pointer (same model as macOS/Windows).
37
+ It glides on clicks and ordinary `move_cursor` calls; cursor-bearing and
38
+ keyboard actions re-show it automatically. Only the explicit
39
+ `move_cursor({x,y,scope:"desktop"})` escape hatch moves the compositor
40
+ cursor. Do not use desktop scope unless the user asked for real-pointer
41
+ control.
42
+
43
+ ## `delivery_mode` — the background/foreground ladder
44
+
45
+ Every input tool (`click`, `type_text`, `press_key`, `hotkey`,
46
+ `double_click`, `right_click`, `scroll`) takes an optional **`delivery_mode`**
47
+ — the per-call rung of the best-effort-background ladder, matching the macOS
48
+ and Windows surface:
49
+
50
+ - **`background`** (default) — inject **without activating or raising** the
51
+ target. X11: the no-focus-steal paths above (AT-SPI / `XSendEvent` /
52
+ XInput2 MPX pointer). This is cua-driver's differentiator and the right
53
+ default.
54
+ - **`foreground`** — **activate the target first** (X11 EWMH
55
+ `_NET_ACTIVE_WINDOW`, proper timestamp handling to beat the WM's
56
+ focus-stealing prevention), inject, then **restore the prior active
57
+ window**. The explicit escalation when a background inject didn't land —
58
+ e.g. a GTK dialog button or a widget that only reads input while focused.
59
+ A brief focus swap unless the target was already active.
60
+
61
+ Foreground is a user-visible takeover boundary. Never select it automatically.
62
+ Use it only when the user already authorized foreground control for the
63
+ workflow or after asking for approval. If background delivery refuses and that
64
+ authorization is absent, return the refusal instead of changing the user's
65
+ focus, workspace, or compositor cursor.
66
+
67
+ ### Persistent focus-proxy exception
68
+
69
+ `bring_to_front` is not part of the normal input ladder. After an ordinary
70
+ `background_unavailable` response, and only with foreground authorization,
71
+ retry the refused action with `delivery_mode:"foreground"`; cua-driver activates the target, performs the
72
+ action, and restores the prior active window. Use `bring_to_front` only when a
73
+ focus-proxy surface must remain foreground across multiple calls, such as a
74
+ remote desktop session, or when repeated action-scoped activation prevents the
75
+ remote surface from accepting input. On X11 it uses persistent
76
+ `_NET_ACTIVE_WINDOW` activation (the `wmctrl -a` equivalent).
77
+
78
+ **Read-back / action effect** — AT-SPI `EditableText.insertText` can return
79
+ `effect:"confirmed"` with `evidence:[{"kind":"value_readback"}]` when the
80
+ accessibility layer reads the inserted value back from the widget model.
81
+ Keystroke / XSendEvent / XTest / foreground rungs return
82
+ `effect:"unverifiable"` unless another publishable readback exists. Confirm
83
+ those through `verify_state` or multimodal reading.
84
+
85
+ **Escalation** — action responses use the cross-platform closed
86
+ `escalation:{target, reason}` shape. See `SKILL.md` → behavior matrix. On a
87
+ standard Wayland compositor the Linux-specific target is **`foreground`**
88
+ (raw background pixels cannot target an unfocused window without a dedicated
89
+ adapter); the opt-in nested compositor and Hyprland input v3 candidate below
90
+ have separate limits. Use **`pixel` on X11** (an element px
91
+ action — background pixel click — lands via
92
+ AT-SPI `do_action`-at-point off the screenshot already in the snapshot — the
93
+ matrix below).
94
+
95
+ ## Perception and the ax/px action choice
96
+
97
+ `get_window_state` is **perception-mode-agnostic** — by default it returns
98
+ **both** the AT-SPI tree **and** a screenshot in one call. You ground on both
99
+ and cross-check; the tree **lies** on some surfaces (Electron echo-confirms
100
+ `setValue`, virtualized/off-viewport rows report bogus `h:1` frames), so a
101
+ grounding screenshot is always present by default. There is no capture mode to
102
+ pick.
103
+
104
+ **Perf opt-out — `include_screenshot`** (boolean, default `true`). Pass
105
+ `include_screenshot:false` to skip the screen grab and return tree-only — the
106
+ cheap path when you're re-indexing before an **element ax action** and don't
107
+ need fresh pixels. It's a **perf** knob, not a modality choice.
108
+
109
+ **`capture_mode` is DEPRECATED and IGNORED.** It's still *accepted* so old
110
+ callers don't error, but it has **no effect** — both the tree and the
111
+ screenshot come back regardless of what you pass (`ax`/`vision`/`som`). There
112
+ is no `ax`/`vision`/`som` capture choice anymore; drop that vocabulary.
113
+
114
+ Modality is chosen at **action time**, by how you address the target:
115
+
116
+ - **element ax action** — `element_token` (preferred), or the matching
117
+ `element_index` + `snapshot_id` pair → AT-SPI
118
+ `do_action`. Backgroundable, driver-verifiable.
119
+ - **element px action** — `x,y` → pixel rung, read straight off the screenshot
120
+ already in the `get_window_state` response. Best-effort; caller-confirmed.
121
+
122
+ `get_window_state` returning `degraded:true` (empty AT-SPI walk) is the cue to
123
+ do an **element px action** off that same screenshot (X11) or escalate to
124
+ `delivery_mode:"foreground"` when authorized (standard Wayland has no general
125
+ raw background route). The nested compositor and Hyprland input v3 candidate
126
+ have their own experimental per-surface routes; an empty tree does not establish
127
+ eligibility for either route.
128
+
129
+ ## Cross-platform schema residuals (Linux)
130
+
131
+ The capture/dispatch/addressing params are a shared cross-platform
132
+ contract (see `SKILL.md` → *Cross-platform parameter contract*) — the
133
+ same `session`, `delivery_mode`, `capture_mode`, `scope`, `modifier`,
134
+ `element_index`/`snapshot_id`/`element_token` *shapes* as macOS and Windows, gated in
135
+ CI so the three surfaces can't drift. Linux-relevant notes:
136
+
137
+ - **`session` is now accepted on every action/cursor tool.** Earlier
138
+ Linux builds rejected it via `additionalProperties:false` (it was
139
+ effectively macOS-only); it is now uniformly schema-accepted — Linux
140
+ glides a per-session cursor on X11 where the overlay is available.
141
+ - **Windowless screen-absolute actions** use
142
+ `target:{"kind":"desktop","display_id":"primary"}`, uniformly with macOS
143
+ and Windows. Exact window actions use
144
+ `target:{"kind":"window","pid":PID,"window_id":WINDOW_ID}`. Legacy flat
145
+ `scope`, `pid`, and `window_id` fields remain compatibility inputs, but do
146
+ not combine them with `target`; capture modality no longer changes lifecycle
147
+ session state.
148
+
149
+ ## Native application menus
150
+
151
+ Use `invoke_menu({pid, window_id, path:[...]})` for a known GTK/Qt application
152
+ menu command. It activates the exact target only for the duration of the
153
+ operation, resolves each labelled AT-SPI menu descendant again after the prior
154
+ menu expands, and refuses missing, duplicate, disabled, or non-actionable
155
+ segments. It works through AT-SPI on both X11 and Wayland and never falls back
156
+ to coordinates. Verify the command's semantic effect from fresh state; the
157
+ native `do_action` acknowledgement alone is not task completion.
158
+
159
+ ## AT-SPI needs the session bus (headless / containers / `runuser`)
160
+
161
+ AT-SPI — the accessibility tree behind `get_window_state`, element-indexed
162
+ clicks, and focus-free `type_text` — lives **entirely on the desktop
163
+ session's D-Bus**. cua-driver reaches it via `DBUS_SESSION_BUS_ADDRESS`. When
164
+ the daemon is started *inside* a normal desktop login that variable is already
165
+ exported and everything works. When it is started **outside** the session —
166
+ a container entrypoint, a headless box, `runuser`/`su` into the desktop user,
167
+ a systemd *system* unit, or a VNC session running its own ad-hoc bus — the
168
+ variable is unset, the AT-SPI registry walk comes back empty, and
169
+ `get_window_state` reports **every** window as having no elements.
170
+
171
+ cua-driver now **auto-discovers the session bus at startup** (mirroring the
172
+ `XAUTHORITY` recovery): if `DBUS_SESSION_BUS_ADDRESS` is unset it adopts
173
+ `/run/user/<uid>/bus`, or reads the address out of a running desktop-session
174
+ process's `/proc/<pid>/environ` (`xfce4-session`, `gnome-session`, …). So the
175
+ common headless cases now "just work". The two things that still must be true:
176
+
177
+ 1. **An accessibility bus must be running** in that session, and
178
+ **`toolkit-accessibility` must be on** — cua-driver advertises a screen
179
+ reader at startup to flip it, but a session with no a11y bus at all
180
+ (`/usr/libexec/at-spi-bus-launcher`) can't expose a tree. `cua-driver
181
+ doctor` now probes `org.a11y.Bus` for real (not just "is there a bus?")
182
+ and tells you which of the two is missing.
183
+ 2. The daemon must run **as the desktop user** (so it can read that user's
184
+ session-process environ and the `/run/user/<uid>/bus` socket). Running the
185
+ daemon as root against a user session is the Linux analogue of the Windows
186
+ "Session 0" isolation problem.
187
+
188
+ An empty AT-SPI walk is now surfaced honestly: `get_window_state` sets
189
+ `degraded: true` + a `degraded_reason` (instead of a bare `elements: []`) so a
190
+ caller can tell "this window genuinely has no controls" apart from "the a11y
191
+ bridge isn't up / the daemon isn't on the session bus".
192
+
193
+ ## The validated modality matrix (X11 / XFCE)
194
+
195
+ Each input rung and its stable public route:
196
+
197
+ | Modality | `delivery_mode` | `route` | Postcondition proof |
198
+ |---|---|---|---|
199
+ | Element click (`element_index`) | `background` | `accessibility` | Use `verify_state`; invocation alone is not confirmation |
200
+ | **element px action (x,y)** | `background` | `accessibility` when AT-SPI-at-point lands, otherwise `global_input` | Use `verify_state` or multimodal reading |
201
+ | Pixel (px) click, escalated | `foreground` | `global_input` | Use `verify_state` or multimodal reading |
202
+ | `type_text` into editable | `background` | `accessibility` | `confirmed` only with `value_readback` evidence |
203
+ | `type_text`, non-editable focus | `background`/`foreground` | `synthetic_events` or `global_input` | Use `verify_state` or multimodal reading |
204
+
205
+ **A background element px action does land on X11** — for an AX-exposing app it
206
+ takes the focus-free AT-SPI `do_action`-at-point path (`x11_atspi`), exactly
207
+ like the macOS/Windows background pixel click. It falls to the MPX
208
+ virtual-pointer path (`x11_pixel`) only for non-AX surfaces, **and that path
209
+ needs a real Xorg + `/dev/uinput`** — under Xvnc / minimal containers without
210
+ uinput, escalate to `delivery_mode:"foreground"`. (`type_text` in the
211
+ `background` rung is focus-dependent for non-editable widgets; that's the one
212
+ genuine background limitation, and `foreground` is the documented escalation.)
213
+
214
+ ## Wayland
215
+
216
+ Set `CUA_DRIVER_RS_ENABLE_WAYLAND=1` to enable native Wayland support. The
217
+ driver selects a backend from compositor capabilities:
218
+
219
+ - Sway and other wlroots compositors use foreign-toplevel discovery,
220
+ wlr-screencopy, virtual pointer, and virtual keyboard protocols.
221
+ - Hyprland has separate discovery and capture adapters. Its optional plugin
222
+ defaults to discovery-only; the opt-in input v3 source candidate has the
223
+ qualification and validation limits below. Do not inherit Sway coverage.
224
+ - GNOME/Mutter uses the bundled WinRects Shell helper for target geometry and
225
+ activation, plus portal/libei for foreground raw input.
226
+ - KDE/KWin uses AT-SPI and portal facilities where available. Target-specific
227
+ foreground activation remains experimental, so unsafe raw input refuses.
228
+ - The optional `cua-compositor` is a separate nested session enabled
229
+ explicitly for controlled automation. GNOME and KDE never switch into it.
230
+
231
+ Sway recording works through the wlroots recorder path and is exercised by the
232
+ canonical harness runner. Portal-backed GNOME recording is still an evidence
233
+ gap. Capture and recording availability therefore depend on the compositor,
234
+ installed helpers, and portal grant.
235
+
236
+ Standard Wayland has no general client protocol for raw input to an arbitrary
237
+ occluded surface. Background AX actions can still deliver through AT-SPI, and
238
+ a PX left click can deliver when hit-testing resolves to an actionable AT-SPI
239
+ control. Other focus-bound background pointer and keyboard shapes return an
240
+ exact `background_unavailable` result. They do not report success after a
241
+ silent drop.
242
+
243
+ Outside an explicitly enabled, qualified compositor-owned background route,
244
+ raw Wayland input requires explicitly authorized `delivery_mode:"foreground"`.
245
+ The driver activates the selected target through a verified compositor adapter
246
+ before dispatch. If
247
+ the compositor has no target-addressable activation or input backend, the call
248
+ refuses before sending input. Reconstructing coordinates alone does not make
249
+ raw background PX possible on a standard compositor.
250
+
251
+ ### Hyprland input v3 source candidate
252
+
253
+ [PR #3572](https://github.com/trycua/cua/pull/3572) records dated, exact-source
254
+ validation results for the experimental opt-in input v3 candidate. Acceptance
255
+ requires the unchanged complete Linux canonical runner on native Hyprland and
256
+ separate bounded qualified-app proof. The default plugin build remains
257
+ discovery-only.
258
+ The candidate source reports Driver `0.23.2`; published Driver `0.23.2` does not
259
+ include these branch changes. Switching Driver channels does not install or
260
+ enable the plugin. Build and loading require the exact Hyprland ABI and compiler
261
+ toolchain; v3 uses `CUA_HYPRLAND_INPUT=ON`, separate from the historical
262
+ `CUA_HYPRLAND_TEST_INPUT` experiment.
263
+
264
+ Driver admits each action through its normal shared permission, resource, and
265
+ lifecycle policy. There is no additional Omarchy approval panel or external
266
+ signer. The plugin accepts the trusted desktop account over same-user local
267
+ sockets; this does not sandbox native code running as that user. Application
268
+ qualification is a compatibility check, not authorization.
269
+
270
+ The initial native qualification scope is Calc from `libreoffice-fresh 26.2.5-3`
271
+ and Inkscape `1.4.4-6`, subject to per-operation native evidence. Before each
272
+ action, Driver matches `/proc/<pid>/exe` to the canonical executable path
273
+ (`/usr/lib/libreoffice/program/soffice.bin` or `/usr/bin/inkscape`), checks the
274
+ exact package name and version in the local pacman database and its executable
275
+ file listing, and rechecks process identity. Unknown or unavailable package
276
+ identity refuses. Package eligibility does not certify every LibreOffice
277
+ application or operation.
278
+
279
+ The plugin separately binds the exact live native surface and checks geometry,
280
+ desktop availability, primary-client and other-lane conflicts, and the compiled
281
+ default `evdev`/`pc105`/`us` keymap. The candidate excludes variants, options,
282
+ remaps, multiple layout groups, missing keyboards, Unicode, IME input,
283
+ arbitrary held-key streams, and modified pointer gestures. Chromium, Electron,
284
+ and XWayland raw background input are outside this scope. AT-SPI routes retain
285
+ their separate behavior.
286
+
287
+ Two compositor seats, `Cua-Agent` and `Cua-Agent-2`, persist across configuration
288
+ disable/re-enable. Each connection claims one lane, and each admitted action
289
+ requires a fresh target binding. Plugin replacement requires a desktop restart;
290
+ do not treat historical experiment reload workarounds as a supported lifecycle.
291
+ Refusals never authorize a hidden foreground fallback, display wake, or session
292
+ unlock. A dispatch acknowledgement is `effect:"unverifiable"`; verify the
293
+ application effect from fresh state. Do not replay canceled, partial, or unknown
294
+ actions.
295
+
296
+ The candidate also adds an explicitly requested foreground route, advertised
297
+ by the plugin as `foreground_target:true`. It binds the exact native top-level
298
+ surface on the compositor thread and intentionally changes primary focus and,
299
+ for pointer actions, cursor position. It does not restore the previous focus or
300
+ cursor. This route has no Calc/Inkscape background package gate. The canonical
301
+ native harness covers defined GTK3, Electron, and Tauri foreground cases. It refuses
302
+ held physical input, grabs, constraints, drag-and-drop, ambiguous primary seat
303
+ bindings, and non-neutral keyboard modifiers. Background refusal never selects
304
+ this route automatically. Driver expands bounded ASCII text under the exact
305
+ US keymap; Unicode and IME remain outside its raw-input scope.
306
+
307
+ The retained bounded app evidence at source
308
+ `f180e8828b8f31cc153e3c44eaa89a9c13c5bc68` includes instrumented Calc/Inkscape
309
+ proof on both seats and an uninstrumented smoke. The plugin tree and
310
+ uninstrumented module hash are unchanged at
311
+ `1133a06e4f205cf80188a7ac9e41102f37611fea`. The proof covers recorded actions
312
+ and observation intervals, not every application operation or release package.
313
+ Portable tests and historical experiments do not replace complete native
314
+ harness acceptance. Compatible release artifacts and final Fleet image
315
+ packaging and lifecycle validation require separate evidence. Physical Omarchy
316
+ parity requires separate acceptance; it is not a gate for publishing a validated
317
+ Fleet image.
318
+
319
+ ## Quick triage
320
+
321
+ If a tool call surprises you on Linux:
322
+
323
+ 1. `cua-driver doctor` — reports the display server (X11 / Wayland),
324
+ **whether `org.a11y.Bus` actually answers on the session bus** (not just
325
+ "is there a bus"), the discovered `DBUS_SESSION_BUS_ADDRESS`, and
326
+ `ffmpeg` availability (for recording).
327
+ 2. Check `XDG_SESSION_TYPE` — `x11` is fully supported; `wayland`
328
+ needs `CUA_DRIVER_RS_ENABLE_WAYLAND=1` for the native backend,
329
+ else XWayland.
330
+ 3. **Empty AT-SPI tree** (`get_window_state` returns `degraded:true`) — in
331
+ order of likelihood: (a) the daemon isn't on the desktop session bus
332
+ (headless / container / `runuser` / root-against-user-session — see
333
+ *AT-SPI needs the session bus* above; doctor will say
334
+ `DBUS_SESSION_BUS_ADDRESS unset`); (b) the a11y bridge is off
335
+ (`gsettings set org.gnome.desktop.interface toolkit-accessibility true`);
336
+ (c) GTK4 / Qt6 / Chromium populate lazily — re-snapshot after an
337
+ interaction or an AX-enable settle.
338
+
339
+ ## Forbidden vectors
340
+
341
+ Same idea as macOS / Windows — don't shell out to anything that
342
+ foregrounds a target:
343
+
344
+ - `wmctrl -a <window>` / `wmctrl -R <window>` — activates / raises.
345
+ - `xdotool windowactivate <wid>` — activates.
346
+ - `xdotool key --window <wid> alt+Tab` — focus churn.
347
+
348
+ Prefer cua-driver tools with an explicit `window_id`. When in doubt,
349
+ ask the user.
350
+
351
+ ## What to expect
352
+
353
+ | Environment | Proven baseline | Main limits |
354
+ |---|---|---|
355
+ | X11/Openbox | AT-SPI trees and actions, foreground pointer and keyboard input, window and desktop capture, and video | Raw background delivery remains toolkit-specific; unsupported shapes refuse |
356
+ | Sway/wlroots | AT-SPI, native discovery, full-display and cropped-window screencopy, foreground input, semantic background actions, and video | Raw background pointer and keyboard input remains focus-bound |
357
+ | Hyprland/Omarchy | Experimental source candidate with separate discovery-foundation and bounded two-seat app evidence | Default plugin is discovery-only; raw background v3 qualification is limited to the exact native Calc/Inkscape packages and plain US keymap; complete native harness and release acceptance are separate gates |
358
+ | GNOME/Mutter | AT-SPI, WinRects geometry and activation, capture, and portal/libei foreground input | Requires the helper and portal grant; portal video parity remains open |
359
+ | KDE/KWin | AT-SPI and generic discovery where exposed | Target-specific activation and behavioral coverage remain experimental |
360
+ | Nested `cua-compositor` | Versioned direct per-surface input, native GTK 31/31, capture/scope 5/5, and partial Electron coverage | The complete shared matrix remains experimental; do not infer standard-Wayland support |
361
+
362
+ See `SKILL.md` for the cross-platform loop (snapshot-before-AND-after,
363
+ pixel-click contract, failure modes) and `RECORDING.md` for session
364
+ recording.