@namzu/computer-use 1.0.2 → 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.
- package/CHANGELOG.md +18 -0
- package/README.md +49 -7
- 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,23 @@
|
|
|
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
|
+
|
|
3
21
|
## 1.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
|
|
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
|
+
[](https://github.com/cogitave/namzu/blob/main/LICENSE.md)
|
|
21
|
+
[](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` |
|
|
95
|
-
| `SpawnError` | A spawned CLI returned non-zero
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
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,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE;CAKjC;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,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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;IACA;IAJV,YACC,OAAe,EACN,MAAmB,EACnB,OAAe,EACf,IAAuB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAA;QAJL,WAA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,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
|
|
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",
|
|
@@ -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": "^28.0.0"
|
|
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 {
|