@namzu/computer-use 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +36 -69
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/util/spawn.d.ts +9 -2
- package/dist/util/spawn.d.ts.map +1 -1
- package/dist/util/spawn.js +9 -2
- package/dist/util/spawn.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +16 -0
- package/src/util/spawn.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b2c005c: Make each README an npm package page rather than the package's manual.
|
|
8
|
+
|
|
9
|
+
`@namzu/sdk`'s README was a twenty-four-section architecture tour, 45 KB of it; the others ran to several hundred lines each. That is the right shape for a single-package repository, where the README _is_ the documentation, and the wrong one here — it duplicated a `docs/` tree that already existed, and nothing checked that the two agreed.
|
|
10
|
+
|
|
11
|
+
Each README is now what a reader needs in the first minute: what the package is, install with its Node requirement, one working example, and links. The long-form material moved into `docs/` whole — `docs/sdk/architecture.md`, `docs/cli/reference.md`, `docs/packages/<name>.md` — where the doc gates cover it.
|
|
12
|
+
|
|
13
|
+
Two documentation defects fell out of the move, both in `@namzu/telemetry`'s session-export example, and both had been shipping: the config field is `redactors` and takes a list, not `redactor` taking one; and `secretRedactor` is a factory that has to be called. The required `destination` field was missing from the example entirely. They surfaced because a README is gated by nothing and `docs/` is compiled against the built SDK.
|
|
14
|
+
|
|
15
|
+
No API change.
|
|
16
|
+
|
|
17
|
+
## 1.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- b26951b: The three errors this package throws are now exported.
|
|
22
|
+
|
|
23
|
+
`AdapterUnavailableError`, `ActionCapabilityError` and `SpawnError` have been
|
|
24
|
+
thrown since the first release and none of them was importable, so the only way
|
|
25
|
+
to tell "the binary is not installed" from "the command ran and failed" was to
|
|
26
|
+
match on `err.message` — a sentence this package is free to reword. The README
|
|
27
|
+
documented them as an error surface the whole time.
|
|
28
|
+
|
|
29
|
+
`AdapterUnavailableError.missing` carries the list of binaries to install, which
|
|
30
|
+
is the actionable half and was unreachable without the type. `SpawnError.result`
|
|
31
|
+
carries the exit code and stderr.
|
|
32
|
+
|
|
33
|
+
`SpawnOptions` and `SpawnResult` are exported as types alongside them.
|
|
34
|
+
|
|
3
35
|
## 1.0.2
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- okf
|
|
2
|
+
type: Reference
|
|
3
|
+
title: "@namzu/computer-use"
|
|
4
|
+
description: >-
|
|
5
|
+
Screen capture, keyboard and pointer control behind one adapter interface.
|
|
6
|
+
Which backend serves a call depends on the platform, and what a platform
|
|
7
|
+
cannot do is reported as a capability rather than discovered as a failure.
|
|
8
|
+
tags: [readme, package, computer-use, adapters]
|
|
9
|
+
timestamp: 2026-08-17T00:00:00Z
|
|
10
|
+
status: active
|
|
11
|
+
diataxis: reference
|
|
12
|
+
-->
|
|
2
13
|
|
|
3
|
-
|
|
14
|
+
<div align="center">
|
|
4
15
|
|
|
5
|
-
>
|
|
16
|
+
<h1>@namzu/computer-use</h1>
|
|
17
|
+
|
|
18
|
+
**Screen, keyboard and pointer control for Namzu agents.**
|
|
19
|
+
|
|
20
|
+
[](https://www.npmjs.com/package/@namzu/computer-use)
|
|
21
|
+
[](https://github.com/cogitave/namzu/actions/workflows/ci.yml)
|
|
22
|
+
[](https://github.com/cogitave/namzu/blob/main/LICENSE.md)
|
|
23
|
+
|
|
24
|
+
[Install](#install) · [Usage](#usage) · [Documentation](#documentation)
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
Screen capture, keyboard and pointer control, behind one adapter interface.
|
|
31
|
+
Which backend serves a call depends on the platform, and what a platform
|
|
32
|
+
cannot do is reported as a capability rather than discovered as a failure.
|
|
6
33
|
|
|
7
34
|
## Install
|
|
8
35
|
|
|
@@ -10,6 +37,8 @@ Subprocess-based computer-use host for [`@namzu/sdk`](https://www.npmjs.com/pack
|
|
|
10
37
|
pnpm add @namzu/sdk @namzu/computer-use
|
|
11
38
|
```
|
|
12
39
|
|
|
40
|
+
`@namzu/sdk` is a peer dependency. Install both.
|
|
41
|
+
|
|
13
42
|
## Usage
|
|
14
43
|
|
|
15
44
|
```ts
|
|
@@ -33,73 +62,11 @@ const registry = new ToolRegistry()
|
|
|
33
62
|
registry.register(createComputerUseTool(host))
|
|
34
63
|
```
|
|
35
64
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
{ type: 'screenshot' }
|
|
40
|
-
{ type: 'cursor_position' }
|
|
41
|
-
{ type: 'mouse_move'; to: { x, y } }
|
|
42
|
-
{ type: 'mouse_click'; at: { x, y }, button: 'left' | 'right' | 'middle' }
|
|
43
|
-
{ type: 'mouse_drag'; from: { x, y }, to: { x, y }, button }
|
|
44
|
-
{ type: 'scroll'; at: { x, y }, direction, amount }
|
|
45
|
-
{ type: 'type_text'; text }
|
|
46
|
-
{ type: 'key'; keys } // e.g. "ctrl+c", "cmd+shift+t", "Return"
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Screenshots return base64-encoded PNG in `ToolResult.output`. Destructive actions (click/drag/type/key/scroll) surface as `isDestructive === true` so namzu's HITL layer can gate them.
|
|
50
|
-
|
|
51
|
-
## Platform Matrix
|
|
52
|
-
|
|
53
|
-
| OS / Server | Screenshot | Mouse | Keyboard | Cursor Pos | Install |
|
|
54
|
-
|---|---|---|---|---|---|
|
|
55
|
-
| **macOS** | `screencapture` (built-in) | `osascript` click / `cliclick` for move+drag+right-click | `osascript` keystroke | via `cliclick` | `brew install cliclick` (optional, for move/drag/cursor-pos) |
|
|
56
|
-
| **Linux X11** | `maim` | `xdotool` | `xdotool` | `xdotool` | `apt install xdotool maim` / `dnf install …` / `pacman -S …` |
|
|
57
|
-
| **Linux Wayland** | `grim` (wlroots) | `ydotool` (needs uinput daemon) | `wtype` or `ydotool` | — | `apt install grim wtype ydotool` + start `ydotoold` |
|
|
58
|
-
| **Windows** | PowerShell `System.Drawing` | `SendInput` via inline C# | `SendKeys` | `Cursor::Position` | `pwsh` or `powershell.exe` (built-in) |
|
|
59
|
-
|
|
60
|
-
### macOS permissions (TCC)
|
|
61
|
-
|
|
62
|
-
On first use you'll be prompted for:
|
|
63
|
-
|
|
64
|
-
- **Screen Recording** — required by `screencapture` to produce images with window contents.
|
|
65
|
-
- **Accessibility** — required by `osascript` to send keystrokes and clicks.
|
|
66
|
-
|
|
67
|
-
Grant both to the terminal/app running your Node process. The adapter surfaces TCC-denied errors verbatim in `SpawnError.stderr`.
|
|
68
|
-
|
|
69
|
-
### macOS scroll
|
|
70
|
-
|
|
71
|
-
Scroll is not supported on macOS from built-in CLIs. Use keyboard navigation (`{ type: 'key', keys: 'page_down' }`) as a substitute, or install a future native host package.
|
|
72
|
-
|
|
73
|
-
### Linux Wayland caveats
|
|
74
|
-
|
|
75
|
-
- Only wlroots compositors (Sway, Hyprland, Wayfire) are supported for screenshot via `grim`. GNOME and KDE Wayland block compositor-level screen capture by design.
|
|
76
|
-
- `ydotool` requires the `ydotoold` daemon to be running with access to `/dev/uinput` (usually via the `input` group). If the daemon is not running, `mouse`/`keyboard` capabilities degrade to `false`.
|
|
77
|
-
- Cursor position has no standard Wayland API; capability stays `false` on this adapter.
|
|
78
|
-
|
|
79
|
-
### Windows caveats
|
|
80
|
-
|
|
81
|
-
- Input fails when the workstation is locked or on the screensaver. No way around this — Windows enforces user-session context for `SendInput`.
|
|
82
|
-
|
|
83
|
-
## Capability Flags
|
|
84
|
-
|
|
85
|
-
`host.capabilities` is frozen at `initialize()` and reflects what actually works, not what the action union permits. The tool layer rejects unsupported actions before hitting the adapter, so the model gets a clean error instead of a hang.
|
|
86
|
-
|
|
87
|
-
If the user installs a missing CLI mid-session, reconstruct the host (capabilities do not re-probe).
|
|
88
|
-
|
|
89
|
-
## Error Surface
|
|
90
|
-
|
|
91
|
-
| Error | Meaning |
|
|
92
|
-
|---|---|
|
|
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. |
|
|
96
|
-
|
|
97
|
-
## Design
|
|
98
|
-
|
|
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.
|
|
65
|
+
## Documentation
|
|
100
66
|
|
|
101
|
-
|
|
67
|
+
- [Computer use — the platform matrix, capability flags and error surface](https://github.com/cogitave/namzu/blob/main/docs/packages/computer-use.md)
|
|
68
|
+
- [Namzu docs](https://github.com/cogitave/namzu/tree/main/docs)
|
|
102
69
|
|
|
103
70
|
## License
|
|
104
71
|
|
|
105
|
-
FSL-1.1-MIT
|
|
72
|
+
FSL-1.1-MIT, converting to MIT two years after each release.
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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"}
|
package/dist/util/spawn.d.ts
CHANGED
|
@@ -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
|
|
35
|
-
*
|
|
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
|
package/dist/util/spawn.d.ts.map
CHANGED
|
@@ -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,EAA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S,MAAM,EAAE;CAKjC;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,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"}
|
package/dist/util/spawn.js
CHANGED
|
@@ -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
|
|
85
|
-
*
|
|
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 {
|
package/dist/util/spawn.js.map
CHANGED
|
@@ -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;I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;;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.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/node": "^22.19.17",
|
|
51
51
|
"typescript": "^5.5.0",
|
|
52
52
|
"vitest": "^3.2.6",
|
|
53
|
-
"@namzu/sdk": "^
|
|
53
|
+
"@namzu/sdk": "^30.0.1"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
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
|
|
126
|
-
*
|
|
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 {
|