@namzu/computer-use 1.0.1 → 1.1.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 (43) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +49 -7
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +14 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/util/spawn.d.ts +9 -2
  8. package/dist/util/spawn.d.ts.map +1 -1
  9. package/dist/util/spawn.js +9 -2
  10. package/dist/util/spawn.js.map +1 -1
  11. package/package.json +12 -2
  12. package/src/index.ts +16 -0
  13. package/src/util/spawn.ts +9 -2
  14. package/dist/__tests__/darwin-keys.test.d.ts +0 -2
  15. package/dist/__tests__/darwin-keys.test.d.ts.map +0 -1
  16. package/dist/__tests__/darwin-keys.test.js +0 -39
  17. package/dist/__tests__/darwin-keys.test.js.map +0 -1
  18. package/dist/__tests__/detect.test.d.ts +0 -2
  19. package/dist/__tests__/detect.test.d.ts.map +0 -1
  20. package/dist/__tests__/detect.test.js +0 -26
  21. package/dist/__tests__/detect.test.js.map +0 -1
  22. package/dist/__tests__/host-skeleton.test.d.ts +0 -2
  23. package/dist/__tests__/host-skeleton.test.d.ts.map +0 -1
  24. package/dist/__tests__/host-skeleton.test.js +0 -69
  25. package/dist/__tests__/host-skeleton.test.js.map +0 -1
  26. package/dist/__tests__/linux-x11-keys.test.d.ts +0 -2
  27. package/dist/__tests__/linux-x11-keys.test.d.ts.map +0 -1
  28. package/dist/__tests__/linux-x11-keys.test.js +0 -25
  29. package/dist/__tests__/linux-x11-keys.test.js.map +0 -1
  30. package/dist/__tests__/wayland-keys.test.d.ts +0 -2
  31. package/dist/__tests__/wayland-keys.test.d.ts.map +0 -1
  32. package/dist/__tests__/wayland-keys.test.js +0 -22
  33. package/dist/__tests__/wayland-keys.test.js.map +0 -1
  34. package/dist/__tests__/win32-keys.test.d.ts +0 -2
  35. package/dist/__tests__/win32-keys.test.d.ts.map +0 -1
  36. package/dist/__tests__/win32-keys.test.js +0 -35
  37. package/dist/__tests__/win32-keys.test.js.map +0 -1
  38. package/src/__tests__/darwin-keys.test.ts +0 -44
  39. package/src/__tests__/detect.test.ts +0 -32
  40. package/src/__tests__/host-skeleton.test.ts +0 -77
  41. package/src/__tests__/linux-x11-keys.test.ts +0 -27
  42. package/src/__tests__/wayland-keys.test.ts +0 -27
  43. package/src/__tests__/win32-keys.test.ts +0 -41
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b26951b: The three errors this package throws are now exported.
8
+
9
+ `AdapterUnavailableError`, `ActionCapabilityError` and `SpawnError` have been
10
+ thrown since the first release and none of them was importable, so the only way
11
+ to tell "the binary is not installed" from "the command ran and failed" was to
12
+ match on `err.message` — a sentence this package is free to reword. The README
13
+ documented them as an error surface the whole time.
14
+
15
+ `AdapterUnavailableError.missing` carries the list of binaries to install, which
16
+ is the actionable half and was unreachable without the type. `SpawnError.result`
17
+ carries the exit code and stderr.
18
+
19
+ `SpawnOptions` and `SpawnResult` are exported as types alongside them.
20
+
21
+ ## 1.0.2
22
+
23
+ ### Patch Changes
24
+
25
+ - 48d9d67: Published tarballs no longer contain test files.
26
+
27
+ `files: ["dist", "src", ...]` reads as "the build output and the sources" and
28
+ means "everything the compiler emitted and everything in the tree", so every
29
+ compiled test, its declaration, and both source maps shipped to the registry —
30
+ and for the twelve packages that also ship `src`, the raw test sources went with
31
+ them.
32
+
33
+ Measured on the versions currently published:
34
+
35
+ | package | files | of which tests | unpacked |
36
+ | ------------ | ----------- | -------------- | ------------------ |
37
+ | `@namzu/sdk` | 3879 → 2239 | 1640 (42%) | 12.73 MB → 6.81 MB |
38
+ | `@namzu/cli` | 462 → 282 | 180 (39%) | 1.21 MB → 0.73 MB |
39
+
40
+ Nothing you can import changes. Every package restricts `exports` to `"."`, so
41
+ Node refused a deep subpath into those files already — they were weight in the
42
+ tarball and nothing else. Hence `patch`: there is no consumer-visible surface
43
+ here, only less to download.
44
+
45
+ The exclusions are at the packaging layer, not the compiler. Adding `exclude`
46
+ to `tsconfig.json` would have kept tests out of `dist` and also dropped them
47
+ from `tsc --noEmit`, silently ending type-checking of the entire test suite —
48
+ trading a packaging defect for a much worse one.
49
+
3
50
  ## 1.0.1
4
51
 
5
52
  ### Patch Changes
package/README.md CHANGED
@@ -1,5 +1,30 @@
1
- # @namzu/computer-use
1
+ <!-- okf
2
+ type: Reference
3
+ title: "@namzu/computer-use"
4
+ description: >-
5
+ Desktop control for Namzu agents — screenshots, mouse, keyboard — driven
6
+ through the CLIs already on the machine. No native addon, no prebuild matrix,
7
+ and a capability set probed at startup rather than assumed.
8
+ tags: [readme, package, computer-use, desktop]
9
+ timestamp: 2026-08-17T00:00:00Z
10
+ status: active
11
+ diataxis: reference
12
+ -->
2
13
 
14
+ <div align="center">
15
+
16
+ <h1>@namzu/computer-use</h1>
17
+
18
+ **Desktop control for [`@namzu/sdk`](https://www.npmjs.com/package/@namzu/sdk).**
19
+
20
+ [![License: FSL-1.1-MIT](https://img.shields.io/badge/license-FSL--1.1--MIT-blue.svg)](https://github.com/cogitave/namzu/blob/main/LICENSE.md)
21
+ [![npm](https://img.shields.io/npm/v/@namzu/computer-use.svg?label=%40namzu%2Fcomputer-use)](https://www.npmjs.com/package/@namzu/computer-use)
22
+
23
+ [Install](#install) · [Usage](#usage) · [Platform matrix](#platform-matrix) · [Capabilities](#capability-flags) · [Errors](#error-surface)
24
+
25
+ </div>
26
+
27
+ ---
3
28
  Subprocess-based computer-use host for [`@namzu/sdk`](https://www.npmjs.com/package/@namzu/sdk). Lets namzu agents control a desktop — screenshots, mouse, keyboard — via platform-native CLIs.
4
29
 
5
30
  > No native addons. No Rust toolchain. No per-platform prebuild packages. No CFRunLoop pump. Just `spawn()` and the CLIs already on your OS.
@@ -88,18 +113,35 @@ If the user installs a missing CLI mid-session, reconstruct the host (capabiliti
88
113
 
89
114
  ## Error Surface
90
115
 
116
+ ```ts
117
+ import {
118
+ ActionCapabilityError,
119
+ AdapterUnavailableError,
120
+ SpawnError,
121
+ } from '@namzu/computer-use'
122
+ ```
123
+
91
124
  | Error | Meaning |
92
125
  |---|---|
93
- | `AdapterUnavailableError` | Mandatory binaries missing at construction (e.g. `xdotool` on Linux X11). `err.missing` lists them. |
94
- | `ActionCapabilityError` | Action requires a capability that's `false` (e.g. macOS `mouse_move` without `cliclick`). |
95
- | `SpawnError` | A spawned CLI returned non-zero, timed out, or the stderr holds a TCC / permission rejection. |
126
+ | `AdapterUnavailableError` | Mandatory binaries missing at construction (e.g. `xdotool` on Linux X11). `err.missing` lists them, which is the actionable half. |
127
+ | `ActionCapabilityError` | The action requires a capability that is `false` (e.g. macOS `mouse_move` without `cliclick`). |
128
+ | `SpawnError` | A spawned CLI returned non-zero or timed out. `err.result.stderr` carries the reason, including a TCC or permission rejection verbatim. |
129
+
130
+ All three are exported, so a host can branch on the type rather than matching
131
+ on a message this package is free to reword.
96
132
 
97
133
  ## Design
98
134
 
99
- See [Platform support](https://github.com/cogitave/namzu/blob/main/docs/computer-use/platform-support.md) and [Host lifecycle](https://github.com/cogitave/namzu/blob/main/docs/computer-use/host-lifecycle.md) for the adapter contract, the capability protocol, and the platform command matrix.
135
+ The adapter contract, the capability protocol and the platform command matrix
136
+ are declared in this package's own types and enforced by its tests.
100
137
 
101
- ADR: [`docs/architecture/decisions/adr-computer-use-subprocess.md`](../../docs/architecture/decisions/adr-computer-use-subprocess.md) explains why subprocess over Rust+napi-rs.
138
+ Subprocess rather than a native addon, deliberately. A Rust + napi-rs host
139
+ would mean a prebuild for every platform and architecture, a toolchain for
140
+ anyone building from source, and a native crash taking the agent's process
141
+ with it. Every capability here is a program the operating system already
142
+ ships or the user can install with one command, and a failure is an exit code.
102
143
 
103
144
  ## License
104
145
 
105
- FSL-1.1-MIT. Same as `@namzu/sdk`.
146
+ FSL-1.1-MIT, converting to MIT two years after each release. Same as
147
+ `@namzu/sdk`.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,18 @@
1
1
  export { SubprocessComputerUseHost } from './SubprocessComputerUseHost.js';
2
2
  export { detectDisplayServer } from './detect/index.js';
3
+ /**
4
+ * The three failures a caller has to tell apart.
5
+ *
6
+ * They existed and were thrown from the first release, and none of them was
7
+ * exported — so the only way to distinguish "the binary is not installed" from
8
+ * "the command ran and failed" was to match on `err.message`, which is a
9
+ * sentence this package is free to reword. The README documented them as an
10
+ * error surface the whole time.
11
+ *
12
+ * `AdapterUnavailableError` also carries `missing`, the list of binaries to
13
+ * install, which is the actionable half and was unreachable without the type.
14
+ */
15
+ export { ActionCapabilityError, AdapterUnavailableError } from './adapters/types.js';
16
+ export { SpawnError } from './util/spawn.js';
17
+ export type { SpawnOptions, SpawnResult } from './util/spawn.js';
3
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEvD;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,17 @@
1
1
  export { SubprocessComputerUseHost } from './SubprocessComputerUseHost.js';
2
2
  export { detectDisplayServer } from './detect/index.js';
3
+ /**
4
+ * The three failures a caller has to tell apart.
5
+ *
6
+ * They existed and were thrown from the first release, and none of them was
7
+ * exported — so the only way to distinguish "the binary is not installed" from
8
+ * "the command ran and failed" was to match on `err.message`, which is a
9
+ * sentence this package is free to reword. The README documented them as an
10
+ * error surface the whole time.
11
+ *
12
+ * `AdapterUnavailableError` also carries `missing`, the list of binaries to
13
+ * install, which is the actionable half and was unreachable without the type.
14
+ */
15
+ export { ActionCapabilityError, AdapterUnavailableError } from './adapters/types.js';
16
+ export { SpawnError } from './util/spawn.js';
3
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEvD;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
@@ -31,8 +31,15 @@ export declare function runCommand(command: string, args: readonly string[], opt
31
31
  */
32
32
  export declare function runCommandOrThrow(command: string, args: readonly string[], options?: SpawnOptions): Promise<SpawnResult>;
33
33
  /**
34
- * Probe for presence of an executable on PATH. Uses `/usr/bin/env -- name --help`
35
- * or plain `which`. Returns true on success, false otherwise. Never throws.
34
+ * Probe for presence of an executable on PATH, with `which` (`where` on
35
+ * Windows). Returns true on success, false otherwise, and never throws — a
36
+ * caller probing five optional tools should not have to wrap each one.
37
+ *
38
+ * The `stdout.length > 0` half of the success test has no reachable case
39
+ * that anything here can construct: both probes print the resolved path when
40
+ * they exit 0, so a mutation removing it survives the whole suite. Kept as a
41
+ * cheap guard against a `which` that answers differently, and recorded as
42
+ * undriven rather than left to look tested.
36
43
  */
37
44
  export declare function hasExecutable(name: string): Promise<boolean>;
38
45
  //# sourceMappingURL=spawn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/util/spawn.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;CACtC;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,UAAW,SAAQ,KAAK;IAGnC,QAAQ,CAAC,MAAM,EAAE,WAAW;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE;gBAHhC,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE;CAKjC;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,YAAiB,GACxB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,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,YAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAkDtB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,YAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQlE"}
@@ -81,8 +81,15 @@ export async function runCommandOrThrow(command, args, options = {}) {
81
81
  return result;
82
82
  }
83
83
  /**
84
- * Probe for presence of an executable on PATH. Uses `/usr/bin/env -- name --help`
85
- * or plain `which`. Returns true on success, false otherwise. Never throws.
84
+ * Probe for presence of an executable on PATH, with `which` (`where` on
85
+ * Windows). Returns true on success, false otherwise, and never throws — a
86
+ * caller probing five optional tools should not have to wrap each one.
87
+ *
88
+ * The `stdout.length > 0` half of the success test has no reachable case
89
+ * that anything here can construct: both probes print the resolved path when
90
+ * they exit 0, so a mutation removing it survives the whole suite. Kept as a
91
+ * cheap guard against a `which` that answers differently, and recorded as
92
+ * undriven rather than left to look tested.
86
93
  */
87
94
  export async function hasExecutable(name) {
88
95
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../src/util/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAiB7D,MAAM,OAAO,UAAW,SAAQ,KAAK;IAG1B;IACA;IACA;IAJV,YACC,OAAe,EACN,MAAmB,EACnB,OAAe,EACf,IAAuB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAA;QAJL,WAAM,GAAN,MAAM,CAAa;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAmB;QAGhC,IAAI,CAAC,IAAI,GAAG,YAAY,CAA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AE,CAAC;QAC3B,MAAM,IAAI,UAAU,CACnB,GAAG,OAAO,qBAAqB,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,aAAa,EAAE,EAC1F,MAAM,EACN,OAAO,EACP,IAAI,CACJ,CAAA;IACF,CAAC;IACD,OAAO,MAAM,CAAA;AACd,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC/C,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAA;QAC9D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAA;QACpE,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IACzD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAA;IACb,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/computer-use",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Subprocess-based computer-use host for @namzu/sdk. Screenshot, mouse, and keyboard control via platform-native CLIs (screencapture/osascript on darwin, xdotool/maim on Linux X11, grim/wtype/ydotool on Wayland, PowerShell on Windows).",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "type": "module",
@@ -23,7 +23,17 @@
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
+ "!dist/**/*.test.*",
27
+ "!dist/**/*.proc-test.*",
28
+ "!dist/**/__tests__",
29
+ "!dist/**/__fixtures__",
30
+ "!dist/**/test-setup.*",
26
31
  "src",
32
+ "!src/**/*.test.*",
33
+ "!src/**/*.proc-test.*",
34
+ "!src/**/__tests__",
35
+ "!src/**/__fixtures__",
36
+ "!src/**/test-setup.*",
27
37
  "LICENSE.md",
28
38
  "README.md",
29
39
  "CHANGELOG.md"
@@ -40,7 +50,7 @@
40
50
  "@types/node": "^22.19.17",
41
51
  "typescript": "^5.5.0",
42
52
  "vitest": "^3.2.6",
43
- "@namzu/sdk": "^14.0.7"
53
+ "@namzu/sdk": "^28.0.0"
44
54
  },
45
55
  "scripts": {
46
56
  "build": "tsc --build",
package/src/index.ts CHANGED
@@ -1,2 +1,18 @@
1
1
  export { SubprocessComputerUseHost } from './SubprocessComputerUseHost.js'
2
2
  export { detectDisplayServer } from './detect/index.js'
3
+
4
+ /**
5
+ * The three failures a caller has to tell apart.
6
+ *
7
+ * They existed and were thrown from the first release, and none of them was
8
+ * exported — so the only way to distinguish "the binary is not installed" from
9
+ * "the command ran and failed" was to match on `err.message`, which is a
10
+ * sentence this package is free to reword. The README documented them as an
11
+ * error surface the whole time.
12
+ *
13
+ * `AdapterUnavailableError` also carries `missing`, the list of binaries to
14
+ * install, which is the actionable half and was unreachable without the type.
15
+ */
16
+ export { ActionCapabilityError, AdapterUnavailableError } from './adapters/types.js'
17
+ export { SpawnError } from './util/spawn.js'
18
+ export type { SpawnOptions, SpawnResult } from './util/spawn.js'
package/src/util/spawn.ts CHANGED
@@ -122,8 +122,15 @@ export async function runCommandOrThrow(
122
122
  }
123
123
 
124
124
  /**
125
- * Probe for presence of an executable on PATH. Uses `/usr/bin/env -- name --help`
126
- * or plain `which`. Returns true on success, false otherwise. Never throws.
125
+ * Probe for presence of an executable on PATH, with `which` (`where` on
126
+ * Windows). Returns true on success, false otherwise, and never throws — a
127
+ * caller probing five optional tools should not have to wrap each one.
128
+ *
129
+ * The `stdout.length > 0` half of the success test has no reachable case
130
+ * that anything here can construct: both probes print the resolved path when
131
+ * they exit 0, so a mutation removing it survives the whole suite. Kept as a
132
+ * cheap guard against a `which` that answers differently, and recorded as
133
+ * undriven rather than left to look tested.
127
134
  */
128
135
  export async function hasExecutable(name: string): Promise<boolean> {
129
136
  try {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=darwin-keys.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"darwin-keys.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/darwin-keys.test.ts"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { parseKeyCombo } from '../adapters/darwin.js';
3
- describe('parseKeyCombo', () => {
4
- it('parses a bare key', () => {
5
- expect(parseKeyCombo('Return')).toEqual({ modifiers: [], mainKey: 'Return' });
6
- expect(parseKeyCombo('a')).toEqual({ modifiers: [], mainKey: 'a' });
7
- });
8
- it('parses single modifier combos', () => {
9
- expect(parseKeyCombo('cmd+c')).toEqual({ modifiers: ['command'], mainKey: 'c' });
10
- expect(parseKeyCombo('ctrl+v')).toEqual({ modifiers: ['control'], mainKey: 'v' });
11
- expect(parseKeyCombo('alt+Tab')).toEqual({ modifiers: ['option'], mainKey: 'Tab' });
12
- expect(parseKeyCombo('shift+Home')).toEqual({ modifiers: ['shift'], mainKey: 'Home' });
13
- });
14
- it('parses multi-modifier combos in order', () => {
15
- expect(parseKeyCombo('ctrl+shift+t')).toEqual({
16
- modifiers: ['control', 'shift'],
17
- mainKey: 't',
18
- });
19
- expect(parseKeyCombo('cmd+alt+shift+4')).toEqual({
20
- modifiers: ['command', 'option', 'shift'],
21
- mainKey: '4',
22
- });
23
- });
24
- it('normalises modifier aliases (meta/super/win → command, opt → option)', () => {
25
- expect(parseKeyCombo('meta+c').modifiers).toEqual(['command']);
26
- expect(parseKeyCombo('super+c').modifiers).toEqual(['command']);
27
- expect(parseKeyCombo('win+c').modifiers).toEqual(['command']);
28
- expect(parseKeyCombo('opt+c').modifiers).toEqual(['option']);
29
- expect(parseKeyCombo('Control+c').modifiers).toEqual(['control']);
30
- });
31
- it('throws on unknown modifier', () => {
32
- expect(() => parseKeyCombo('hyper+c')).toThrow(/unknown modifier/);
33
- });
34
- it('throws on empty input', () => {
35
- expect(() => parseKeyCombo('')).toThrow(/empty/);
36
- expect(() => parseKeyCombo('+++')).toThrow(/empty/);
37
- });
38
- });
39
- //# sourceMappingURL=darwin-keys.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"darwin-keys.test.js","sourceRoot":"","sources":["../../src/__tests__/darwin-keys.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC7E,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;QAChF,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;QACjF,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC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AE;QACrC,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACnE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAChD,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=detect.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/detect.test.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { detectDisplayServer } from '../detect/index.js';
3
- describe('detectDisplayServer', () => {
4
- it('returns darwin on macOS regardless of env', () => {
5
- expect(detectDisplayServer({}, 'darwin')).toBe('darwin');
6
- expect(detectDisplayServer({ DISPLAY: ':0' }, 'darwin')).toBe('darwin');
7
- });
8
- it('returns win32 on Windows', () => {
9
- expect(detectDisplayServer({}, 'win32')).toBe('win32');
10
- });
11
- it('prefers XDG_SESSION_TYPE on linux', () => {
12
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'wayland' }, 'linux')).toBe('wayland');
13
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'x11' }, 'linux')).toBe('x11');
14
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'WAYLAND' }, 'linux')).toBe('wayland');
15
- });
16
- it('falls back to WAYLAND_DISPLAY / DISPLAY when XDG_SESSION_TYPE is absent', () => {
17
- expect(detectDisplayServer({ WAYLAND_DISPLAY: 'wayland-0' }, 'linux')).toBe('wayland');
18
- expect(detectDisplayServer({ DISPLAY: ':0' }, 'linux')).toBe('x11');
19
- expect(detectDisplayServer({ WAYLAND_DISPLAY: 'wayland-0', DISPLAY: ':0' }, 'linux')).toBe('wayland');
20
- });
21
- it('returns unknown for headless linux or non-recognised platforms', () => {
22
- expect(detectDisplayServer({}, 'linux')).toBe('unknown');
23
- expect(detectDisplayServer({}, 'freebsd')).toBe('unknown');
24
- });
25
- });
26
- //# sourceMappingURL=detect.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect.test.js","sourceRoot":"","sources":["../../src/__tests__/detect.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACrF,MAAM,CAAC,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7E,MAAM,CAAC,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACtF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QAClF,MAAM,CAAC,mBAAmB,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACtF,MAAM,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnE,MAAM,CAAC,mBAAmB,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CACzF,SAAS,CACT,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACzE,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,SAA4B,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC9E,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=host-skeleton.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host-skeleton.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/host-skeleton.test.ts"],"names":[],"mappings":""}
@@ -1,69 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { SubprocessComputerUseHost } from '../SubprocessComputerUseHost.js';
3
- function makeAdapter() {
4
- return {
5
- capabilities: Object.freeze({
6
- displayServer: 'darwin',
7
- screenshot: true,
8
- mouse: true,
9
- keyboard: true,
10
- cursorPosition: false,
11
- clipboard: true,
12
- }),
13
- async getDisplayGeometry() {
14
- return { width: 1920, height: 1080, scaleFactor: 2 };
15
- },
16
- async execute(action) {
17
- if (action.type === 'screenshot') {
18
- return {
19
- type: 'screenshot',
20
- result: {
21
- data: Buffer.from([0x89, 0x50, 0x4e, 0x47]),
22
- mimeType: 'image/png',
23
- width: 10,
24
- height: 10,
25
- },
26
- };
27
- }
28
- return { type: 'ok' };
29
- },
30
- };
31
- }
32
- describe('SubprocessComputerUseHost', () => {
33
- it('detects the display server before initialize()', () => {
34
- const host = new SubprocessComputerUseHost({ platform: 'darwin' });
35
- expect(host.capabilities.displayServer).toBe('darwin');
36
- });
37
- it('reports all feature flags false before initialize()', () => {
38
- const host = new SubprocessComputerUseHost({ platform: 'darwin' });
39
- expect(host.capabilities.screenshot).toBe(false);
40
- expect(host.capabilities.mouse).toBe(false);
41
- expect(host.capabilities.keyboard).toBe(false);
42
- expect(host.capabilities.cursorPosition).toBe(false);
43
- expect(host.capabilities.clipboard).toBe(false);
44
- });
45
- it('accepts an injected adapter and exposes its capabilities', async () => {
46
- const host = new SubprocessComputerUseHost({ adapter: makeAdapter() });
47
- expect(host.capabilities.screenshot).toBe(true);
48
- expect(host.capabilities.mouse).toBe(true);
49
- expect(host.capabilities.keyboard).toBe(true);
50
- expect(host.capabilities.displayServer).toBe('darwin');
51
- const result = await host.execute({ type: 'screenshot' });
52
- expect(result.type).toBe('screenshot');
53
- });
54
- it('throws on execute before initialize() when no adapter injected', async () => {
55
- const host = new SubprocessComputerUseHost({ platform: 'darwin' });
56
- await expect(host.execute({ type: 'screenshot' })).rejects.toThrow('not initialised');
57
- });
58
- it('dispose clears the adapter reference without error', async () => {
59
- const host = new SubprocessComputerUseHost({ adapter: makeAdapter() });
60
- await expect(host.dispose()).resolves.toBeUndefined();
61
- await expect(host.execute({ type: 'screenshot' })).rejects.toThrow('not initialised');
62
- });
63
- it('rejects initialize() for unknown display server with no adapter', async () => {
64
- const host = new SubprocessComputerUseHost({ env: {}, platform: 'linux' });
65
- expect(host.capabilities.displayServer).toBe('unknown');
66
- await expect(host.initialize()).rejects.toThrow(/no adapter available/);
67
- });
68
- });
69
- //# sourceMappingURL=host-skeleton.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host-skeleton.test.js","sourceRoot":"","sources":["../../src/__tests__/host-skeleton.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAG3E,SAAS,WAAW;IACnB,OAAO;QACN,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;YAC3B,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,cAAc,EAAE,KAAK;YACrB,SAAS,EAAE,IAAI;SACf,CAAC;QACF,KAAK,CAAC,kBAAkB;YACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAA;QACrD,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,MAAM;YACnB,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAClC,OAAO;oBACN,IAAI,EAAE,YAAY;oBAClB,MAAM,EAAE;wBACP,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;wBAC3C,QAAQ,EAAE,WAAW;wBACrB,KAAK,EAAE,EAAE;wBACT,MAAM,EAAE,EAAE;qBACV;iBACD,CAAA;YACF,CAAC;YACD,OAAO,EAAE,IA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,yBAAyB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;QAC1E,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvD,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=linux-x11-keys.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linux-x11-keys.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/linux-x11-keys.test.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { _translateKeyCombo as translateKeyCombo } from '../adapters/linux-x11.js';
3
- describe('translateKeyCombo (xdotool)', () => {
4
- it('maps single keys to xdotool names', () => {
5
- expect(translateKeyCombo('Return')).toBe('Return');
6
- expect(translateKeyCombo('escape')).toBe('Escape');
7
- expect(translateKeyCombo('enter')).toBe('Return');
8
- expect(translateKeyCombo('backspace')).toBe('BackSpace');
9
- expect(translateKeyCombo('page_up')).toBe('Page_Up');
10
- expect(translateKeyCombo('up')).toBe('Up');
11
- });
12
- it('normalises modifier aliases to xdotool equivalents', () => {
13
- expect(translateKeyCombo('cmd+c')).toBe('super+c');
14
- expect(translateKeyCombo('meta+c')).toBe('super+c');
15
- expect(translateKeyCombo('ctrl+v')).toBe('ctrl+v');
16
- expect(translateKeyCombo('Control+v')).toBe('ctrl+v');
17
- expect(translateKeyCombo('alt+Tab')).toBe('alt+Tab');
18
- expect(translateKeyCombo('option+Tab')).toBe('alt+Tab');
19
- });
20
- it('preserves unknown tokens as-is for xdotool to try', () => {
21
- expect(translateKeyCombo('F5')).toBe('F5');
22
- expect(translateKeyCombo('ctrl+shift+F12')).toBe('ctrl+shift+F12');
23
- });
24
- });
25
- //# sourceMappingURL=linux-x11-keys.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linux-x11-keys.test.js","sourceRoot":"","sources":["../../src/__tests__/linux-x11-keys.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAElF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClD,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClD,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjD,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxD,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACpD,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC7D,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClD,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACnD,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClD,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrD,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACpD,MAAM,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IACnE,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=wayland-keys.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wayland-keys.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/wayland-keys.test.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { translateKeyToYdotool } from '../adapters/linux-wayland.js';
3
- describe('translateKeyToYdotool', () => {
4
- it('emits press/release pairs for a bare key', () => {
5
- expect(translateKeyToYdotool('Return')).toBe('KEY_ENTER:1 KEY_ENTER:0');
6
- expect(translateKeyToYdotool('a')).toBe('KEY_A:1 KEY_A:0');
7
- });
8
- it('wraps modifiers around the main key for combos', () => {
9
- expect(translateKeyToYdotool('ctrl+c')).toBe('KEY_LEFTCTRL:1 KEY_C:1 KEY_C:0 KEY_LEFTCTRL:0');
10
- expect(translateKeyToYdotool('ctrl+shift+t')).toBe('KEY_LEFTCTRL:1 KEY_LEFTSHIFT:1 KEY_T:1 KEY_T:0 KEY_LEFTSHIFT:0 KEY_LEFTCTRL:0');
11
- });
12
- it('normalises modifier aliases', () => {
13
- expect(translateKeyToYdotool('cmd+c')).toBe('KEY_LEFTMETA:1 KEY_C:1 KEY_C:0 KEY_LEFTMETA:0');
14
- expect(translateKeyToYdotool('alt+Tab')).toBe('KEY_LEFTALT:1 KEY_TAB:1 KEY_TAB:0 KEY_LEFTALT:0');
15
- });
16
- it('maps named special keys', () => {
17
- expect(translateKeyToYdotool('escape')).toBe('KEY_ESC:1 KEY_ESC:0');
18
- expect(translateKeyToYdotool('backspace')).toBe('KEY_BACKSPACE:1 KEY_BACKSPACE:0');
19
- expect(translateKeyToYdotool('page_up')).toBe('KEY_PAGEUP:1 KEY_PAGEUP:0');
20
- });
21
- });
22
- //# sourceMappingURL=wayland-keys.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wayland-keys.test.js","sourceRoot":"","sources":["../../src/__tests__/wayland-keys.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;QACvE,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;QAC7F,MAAM,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CACjD,+EAA+E,CAC/E,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;QAC5F,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAA;IACjG,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;QACnE,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAA;QAClF,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=win32-keys.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"win32-keys.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/win32-keys.test.ts"],"names":[],"mappings":""}
@@ -1,35 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { translateKeyToSendKeys } from '../adapters/win32.js';
3
- describe('translateKeyToSendKeys', () => {
4
- it('passes through bare printable characters', () => {
5
- expect(translateKeyToSendKeys('a')).toBe('a');
6
- expect(translateKeyToSendKeys('Z')).toBe('Z');
7
- });
8
- it('maps single modifier combos to SendKeys prefixes', () => {
9
- expect(translateKeyToSendKeys('ctrl+c')).toBe('^c');
10
- expect(translateKeyToSendKeys('shift+a')).toBe('+a');
11
- expect(translateKeyToSendKeys('alt+F4')).toBe('%{F4}');
12
- });
13
- it('chains multiple modifiers', () => {
14
- expect(translateKeyToSendKeys('ctrl+shift+t')).toBe('^+t');
15
- expect(translateKeyToSendKeys('ctrl+alt+delete')).toBe('^%{DELETE}');
16
- });
17
- it('translates cmd/meta/super to ^ (Windows ctrl equivalent)', () => {
18
- expect(translateKeyToSendKeys('cmd+c')).toBe('^c');
19
- expect(translateKeyToSendKeys('meta+v')).toBe('^v');
20
- });
21
- it('translates named keys to SendKeys special tokens', () => {
22
- expect(translateKeyToSendKeys('Return')).toBe('{ENTER}');
23
- expect(translateKeyToSendKeys('escape')).toBe('{ESC}');
24
- expect(translateKeyToSendKeys('tab')).toBe('{TAB}');
25
- expect(translateKeyToSendKeys('page_up')).toBe('{PGUP}');
26
- expect(translateKeyToSendKeys('up')).toBe('{UP}');
27
- });
28
- it('throws on unknown modifier', () => {
29
- expect(() => translateKeyToSendKeys('hyper+c')).toThrow(/unknown modifier/);
30
- });
31
- it('throws on empty input', () => {
32
- expect(() => translateKeyToSendKeys('')).toThrow(/empty/);
33
- });
34
- });
35
- //# sourceMappingURL=win32-keys.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"win32-keys.test.js","sourceRoot":"","sources":["../../src/__tests__/win32-keys.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,sBAAs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;IAClD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,44 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { parseKeyCombo } from '../adapters/darwin.js'
3
-
4
- describe('parseKeyCombo', () => {
5
- it('parses a bare key', () => {
6
- expect(parseKeyCombo('Return')).toEqual({ modifiers: [], mainKey: 'Return' })
7
- expect(parseKeyCombo('a')).toEqual({ modifiers: [], mainKey: 'a' })
8
- })
9
-
10
- it('parses single modifier combos', () => {
11
- expect(parseKeyCombo('cmd+c')).toEqual({ modifiers: ['command'], mainKey: 'c' })
12
- expect(parseKeyCombo('ctrl+v')).toEqual({ modifiers: ['control'], mainKey: 'v' })
13
- expect(parseKeyCombo('alt+Tab')).toEqual({ modifiers: ['option'], mainKey: 'Tab' })
14
- expect(parseKeyCombo('shift+Home')).toEqual({ modifiers: ['shift'], mainKey: 'Home' })
15
- })
16
-
17
- it('parses multi-modifier combos in order', () => {
18
- expect(parseKeyCombo('ctrl+shift+t')).toEqual({
19
- modifiers: ['control', 'shift'],
20
- mainKey: 't',
21
- })
22
- expect(parseKeyCombo('cmd+alt+shift+4')).toEqual({
23
- modifiers: ['command', 'option', 'shift'],
24
- mainKey: '4',
25
- })
26
- })
27
-
28
- it('normalises modifier aliases (meta/super/win → command, opt → option)', () => {
29
- expect(parseKeyCombo('meta+c').modifiers).toEqual(['command'])
30
- expect(parseKeyCombo('super+c').modifiers).toEqual(['command'])
31
- expect(parseKeyCombo('win+c').modifiers).toEqual(['command'])
32
- expect(parseKeyCombo('opt+c').modifiers).toEqual(['option'])
33
- expect(parseKeyCombo('Control+c').modifiers).toEqual(['control'])
34
- })
35
-
36
- it('throws on unknown modifier', () => {
37
- expect(() => parseKeyCombo('hyper+c')).toThrow(/unknown modifier/)
38
- })
39
-
40
- it('throws on empty input', () => {
41
- expect(() => parseKeyCombo('')).toThrow(/empty/)
42
- expect(() => parseKeyCombo('+++')).toThrow(/empty/)
43
- })
44
- })
@@ -1,32 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { detectDisplayServer } from '../detect/index.js'
3
-
4
- describe('detectDisplayServer', () => {
5
- it('returns darwin on macOS regardless of env', () => {
6
- expect(detectDisplayServer({}, 'darwin')).toBe('darwin')
7
- expect(detectDisplayServer({ DISPLAY: ':0' }, 'darwin')).toBe('darwin')
8
- })
9
-
10
- it('returns win32 on Windows', () => {
11
- expect(detectDisplayServer({}, 'win32')).toBe('win32')
12
- })
13
-
14
- it('prefers XDG_SESSION_TYPE on linux', () => {
15
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'wayland' }, 'linux')).toBe('wayland')
16
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'x11' }, 'linux')).toBe('x11')
17
- expect(detectDisplayServer({ XDG_SESSION_TYPE: 'WAYLAND' }, 'linux')).toBe('wayland')
18
- })
19
-
20
- it('falls back to WAYLAND_DISPLAY / DISPLAY when XDG_SESSION_TYPE is absent', () => {
21
- expect(detectDisplayServer({ WAYLAND_DISPLAY: 'wayland-0' }, 'linux')).toBe('wayland')
22
- expect(detectDisplayServer({ DISPLAY: ':0' }, 'linux')).toBe('x11')
23
- expect(detectDisplayServer({ WAYLAND_DISPLAY: 'wayland-0', DISPLAY: ':0' }, 'linux')).toBe(
24
- 'wayland',
25
- )
26
- })
27
-
28
- it('returns unknown for headless linux or non-recognised platforms', () => {
29
- expect(detectDisplayServer({}, 'linux')).toBe('unknown')
30
- expect(detectDisplayServer({}, 'freebsd' as NodeJS.Platform)).toBe('unknown')
31
- })
32
- })
@@ -1,77 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { SubprocessComputerUseHost } from '../SubprocessComputerUseHost.js'
3
- import type { Adapter } from '../adapters/types.js'
4
-
5
- function makeAdapter(): Adapter {
6
- return {
7
- capabilities: Object.freeze({
8
- displayServer: 'darwin',
9
- screenshot: true,
10
- mouse: true,
11
- keyboard: true,
12
- cursorPosition: false,
13
- clipboard: true,
14
- }),
15
- async getDisplayGeometry() {
16
- return { width: 1920, height: 1080, scaleFactor: 2 }
17
- },
18
- async execute(action) {
19
- if (action.type === 'screenshot') {
20
- return {
21
- type: 'screenshot',
22
- result: {
23
- data: Buffer.from([0x89, 0x50, 0x4e, 0x47]),
24
- mimeType: 'image/png',
25
- width: 10,
26
- height: 10,
27
- },
28
- }
29
- }
30
- return { type: 'ok' }
31
- },
32
- }
33
- }
34
-
35
- describe('SubprocessComputerUseHost', () => {
36
- it('detects the display server before initialize()', () => {
37
- const host = new SubprocessComputerUseHost({ platform: 'darwin' })
38
- expect(host.capabilities.displayServer).toBe('darwin')
39
- })
40
-
41
- it('reports all feature flags false before initialize()', () => {
42
- const host = new SubprocessComputerUseHost({ platform: 'darwin' })
43
- expect(host.capabilities.screenshot).toBe(false)
44
- expect(host.capabilities.mouse).toBe(false)
45
- expect(host.capabilities.keyboard).toBe(false)
46
- expect(host.capabilities.cursorPosition).toBe(false)
47
- expect(host.capabilities.clipboard).toBe(false)
48
- })
49
-
50
- it('accepts an injected adapter and exposes its capabilities', async () => {
51
- const host = new SubprocessComputerUseHost({ adapter: makeAdapter() })
52
- expect(host.capabilities.screenshot).toBe(true)
53
- expect(host.capabilities.mouse).toBe(true)
54
- expect(host.capabilities.keyboard).toBe(true)
55
- expect(host.capabilities.displayServer).toBe('darwin')
56
-
57
- const result = await host.execute({ type: 'screenshot' })
58
- expect(result.type).toBe('screenshot')
59
- })
60
-
61
- it('throws on execute before initialize() when no adapter injected', async () => {
62
- const host = new SubprocessComputerUseHost({ platform: 'darwin' })
63
- await expect(host.execute({ type: 'screenshot' })).rejects.toThrow('not initialised')
64
- })
65
-
66
- it('dispose clears the adapter reference without error', async () => {
67
- const host = new SubprocessComputerUseHost({ adapter: makeAdapter() })
68
- await expect(host.dispose()).resolves.toBeUndefined()
69
- await expect(host.execute({ type: 'screenshot' })).rejects.toThrow('not initialised')
70
- })
71
-
72
- it('rejects initialize() for unknown display server with no adapter', async () => {
73
- const host = new SubprocessComputerUseHost({ env: {}, platform: 'linux' })
74
- expect(host.capabilities.displayServer).toBe('unknown')
75
- await expect(host.initialize()).rejects.toThrow(/no adapter available/)
76
- })
77
- })
@@ -1,27 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { _translateKeyCombo as translateKeyCombo } from '../adapters/linux-x11.js'
3
-
4
- describe('translateKeyCombo (xdotool)', () => {
5
- it('maps single keys to xdotool names', () => {
6
- expect(translateKeyCombo('Return')).toBe('Return')
7
- expect(translateKeyCombo('escape')).toBe('Escape')
8
- expect(translateKeyCombo('enter')).toBe('Return')
9
- expect(translateKeyCombo('backspace')).toBe('BackSpace')
10
- expect(translateKeyCombo('page_up')).toBe('Page_Up')
11
- expect(translateKeyCombo('up')).toBe('Up')
12
- })
13
-
14
- it('normalises modifier aliases to xdotool equivalents', () => {
15
- expect(translateKeyCombo('cmd+c')).toBe('super+c')
16
- expect(translateKeyCombo('meta+c')).toBe('super+c')
17
- expect(translateKeyCombo('ctrl+v')).toBe('ctrl+v')
18
- expect(translateKeyCombo('Control+v')).toBe('ctrl+v')
19
- expect(translateKeyCombo('alt+Tab')).toBe('alt+Tab')
20
- expect(translateKeyCombo('option+Tab')).toBe('alt+Tab')
21
- })
22
-
23
- it('preserves unknown tokens as-is for xdotool to try', () => {
24
- expect(translateKeyCombo('F5')).toBe('F5')
25
- expect(translateKeyCombo('ctrl+shift+F12')).toBe('ctrl+shift+F12')
26
- })
27
- })
@@ -1,27 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { translateKeyToYdotool } from '../adapters/linux-wayland.js'
3
-
4
- describe('translateKeyToYdotool', () => {
5
- it('emits press/release pairs for a bare key', () => {
6
- expect(translateKeyToYdotool('Return')).toBe('KEY_ENTER:1 KEY_ENTER:0')
7
- expect(translateKeyToYdotool('a')).toBe('KEY_A:1 KEY_A:0')
8
- })
9
-
10
- it('wraps modifiers around the main key for combos', () => {
11
- expect(translateKeyToYdotool('ctrl+c')).toBe('KEY_LEFTCTRL:1 KEY_C:1 KEY_C:0 KEY_LEFTCTRL:0')
12
- expect(translateKeyToYdotool('ctrl+shift+t')).toBe(
13
- 'KEY_LEFTCTRL:1 KEY_LEFTSHIFT:1 KEY_T:1 KEY_T:0 KEY_LEFTSHIFT:0 KEY_LEFTCTRL:0',
14
- )
15
- })
16
-
17
- it('normalises modifier aliases', () => {
18
- expect(translateKeyToYdotool('cmd+c')).toBe('KEY_LEFTMETA:1 KEY_C:1 KEY_C:0 KEY_LEFTMETA:0')
19
- expect(translateKeyToYdotool('alt+Tab')).toBe('KEY_LEFTALT:1 KEY_TAB:1 KEY_TAB:0 KEY_LEFTALT:0')
20
- })
21
-
22
- it('maps named special keys', () => {
23
- expect(translateKeyToYdotool('escape')).toBe('KEY_ESC:1 KEY_ESC:0')
24
- expect(translateKeyToYdotool('backspace')).toBe('KEY_BACKSPACE:1 KEY_BACKSPACE:0')
25
- expect(translateKeyToYdotool('page_up')).toBe('KEY_PAGEUP:1 KEY_PAGEUP:0')
26
- })
27
- })
@@ -1,41 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { translateKeyToSendKeys } from '../adapters/win32.js'
3
-
4
- describe('translateKeyToSendKeys', () => {
5
- it('passes through bare printable characters', () => {
6
- expect(translateKeyToSendKeys('a')).toBe('a')
7
- expect(translateKeyToSendKeys('Z')).toBe('Z')
8
- })
9
-
10
- it('maps single modifier combos to SendKeys prefixes', () => {
11
- expect(translateKeyToSendKeys('ctrl+c')).toBe('^c')
12
- expect(translateKeyToSendKeys('shift+a')).toBe('+a')
13
- expect(translateKeyToSendKeys('alt+F4')).toBe('%{F4}')
14
- })
15
-
16
- it('chains multiple modifiers', () => {
17
- expect(translateKeyToSendKeys('ctrl+shift+t')).toBe('^+t')
18
- expect(translateKeyToSendKeys('ctrl+alt+delete')).toBe('^%{DELETE}')
19
- })
20
-
21
- it('translates cmd/meta/super to ^ (Windows ctrl equivalent)', () => {
22
- expect(translateKeyToSendKeys('cmd+c')).toBe('^c')
23
- expect(translateKeyToSendKeys('meta+v')).toBe('^v')
24
- })
25
-
26
- it('translates named keys to SendKeys special tokens', () => {
27
- expect(translateKeyToSendKeys('Return')).toBe('{ENTER}')
28
- expect(translateKeyToSendKeys('escape')).toBe('{ESC}')
29
- expect(translateKeyToSendKeys('tab')).toBe('{TAB}')
30
- expect(translateKeyToSendKeys('page_up')).toBe('{PGUP}')
31
- expect(translateKeyToSendKeys('up')).toBe('{UP}')
32
- })
33
-
34
- it('throws on unknown modifier', () => {
35
- expect(() => translateKeyToSendKeys('hyper+c')).toThrow(/unknown modifier/)
36
- })
37
-
38
- it('throws on empty input', () => {
39
- expect(() => translateKeyToSendKeys('')).toThrow(/empty/)
40
- })
41
- })