usecomputer 0.1.0 → 0.1.2
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 +10 -0
- package/build.zig +5 -0
- package/build.zig.zon +2 -2
- package/dist/bridge-contract.test.js +3 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +0 -60
- package/dist/darwin-arm64/usecomputer.node +0 -0
- package/dist/darwin-x64/usecomputer.node +0 -0
- package/dist/linux-x64/usecomputer.node +0 -0
- package/package.json +12 -11
- package/src/bridge-contract.test.ts +3 -3
- package/src/cli.ts +0 -62
- package/zig/src/lib.zig +2 -6
- package/LICENSE +0 -21
- package/dist/native-lib.cjs +0 -33
- package/dist/native-lib.d.cts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
All notable changes to `usecomputer` will be documented in this file.
|
|
6
6
|
|
|
7
|
+
## 0.1.2
|
|
8
|
+
|
|
9
|
+
1. **Removed all unimplemented command stubs** — 18 placeholder commands (`snapshot`, `get text/title/value/bounds/focused`, `window focus/resize/move/minimize/maximize/close`, `app list/launch/quit`, `wait`, `find`, `diff snapshot/screenshot`) that only threw "TODO not implemented" have been removed. The CLI now only exposes commands that actually work.
|
|
10
|
+
2. **Clipboard errors clarified** — clipboard commands now return "not supported on this platform" instead of "TODO not implemented".
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
1. **Fixed Linux native builds** — standalone executable now links libc correctly on Linux, fixing "C allocator is only available when linking against libc" errors.
|
|
15
|
+
2. **Fixed native host builds** — build script now omits `-Dtarget` when building for the host platform so Zig finds system libraries (X11, libpng, etc).
|
|
16
|
+
|
|
7
17
|
## 0.1.0
|
|
8
18
|
|
|
9
19
|
1. **Standalone executable** — `usecomputer` now ships as a self-contained binary.
|
package/build.zig
CHANGED
|
@@ -106,6 +106,11 @@ pub fn build(b: *std.Build) void {
|
|
|
106
106
|
.root_module = exe_mod,
|
|
107
107
|
});
|
|
108
108
|
linkPlatformDeps(exe.root_module, target_os);
|
|
109
|
+
// The standalone exe uses c_allocator and system libs that require libc.
|
|
110
|
+
// The N-API .node lib gets this automatically through napigen, but the
|
|
111
|
+
// exe needs it explicitly — otherwise native builds fail with
|
|
112
|
+
// "C allocator is only available when linking against libc".
|
|
113
|
+
exe.root_module.link_libc = true;
|
|
109
114
|
b.installArtifact(exe);
|
|
110
115
|
|
|
111
116
|
const run_exe = b.addRunArtifact(exe);
|
package/build.zig.zon
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
.lazy = true,
|
|
15
15
|
},
|
|
16
16
|
.zeke = .{
|
|
17
|
-
.url = "https://github.com/remorses/zeke/archive/
|
|
18
|
-
.hash = "zeke-0.1.0-
|
|
17
|
+
.url = "https://github.com/remorses/zeke/archive/87f8844f4a8d4427671cdb79bce5f501739eb54b.tar.gz",
|
|
18
|
+
.hash = "zeke-0.1.0-fnPIzGwUAQA4utTXwlr6mZo7vVhxTt1_h1MTpsBixLC0",
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
.paths = .{
|
|
@@ -61,8 +61,8 @@ describe('native bridge contract', () => {
|
|
|
61
61
|
expect(typeof firstWindow.ownerName).toBe('string');
|
|
62
62
|
expect(typeof firstWindow.desktopIndex).toBe('number');
|
|
63
63
|
}
|
|
64
|
-
// -- Clipboard (
|
|
65
|
-
await expect(bridge.clipboardSet({ text: 'bridge-contract-test' })).rejects.toThrow(
|
|
66
|
-
await expect(bridge.clipboardGet()).rejects.toThrow(
|
|
64
|
+
// -- Clipboard (not supported on this platform yet) --
|
|
65
|
+
await expect(bridge.clipboardSet({ text: 'bridge-contract-test' })).rejects.toThrow(/not (supported|implemented)/);
|
|
66
|
+
await expect(bridge.clipboardGet()).rejects.toThrow(/not (supported|implemented)/);
|
|
67
67
|
});
|
|
68
68
|
});
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAmC,iBAAiB,EAAc,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAmC,iBAAiB,EAAc,MAAM,YAAY,CAAA;AA6NhG,wBAAgB,SAAS,CAAC,EAAE,MAAuB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAAO,2BAqYzF;AAED,wBAAgB,MAAM,IAAI,IAAI,CAG7B"}
|
package/dist/cli.js
CHANGED
|
@@ -172,9 +172,6 @@ function printWindowList({ windows }) {
|
|
|
172
172
|
printLine(line);
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
function notImplemented({ command }) {
|
|
176
|
-
throw new Error(`TODO not implemented: ${command}`);
|
|
177
|
-
}
|
|
178
175
|
export function createCli({ bridge = createBridge() } = {}) {
|
|
179
176
|
const cli = goke('usecomputer');
|
|
180
177
|
cli
|
|
@@ -511,24 +508,6 @@ export function createCli({ bridge = createBridge() } = {}) {
|
|
|
511
508
|
.action(async (text) => {
|
|
512
509
|
await bridge.clipboardSet({ text });
|
|
513
510
|
});
|
|
514
|
-
cli.command('snapshot').action(() => {
|
|
515
|
-
notImplemented({ command: 'snapshot' });
|
|
516
|
-
});
|
|
517
|
-
cli.command('get text <target>').action(() => {
|
|
518
|
-
notImplemented({ command: 'get text' });
|
|
519
|
-
});
|
|
520
|
-
cli.command('get title <target>').action(() => {
|
|
521
|
-
notImplemented({ command: 'get title' });
|
|
522
|
-
});
|
|
523
|
-
cli.command('get value <target>').action(() => {
|
|
524
|
-
notImplemented({ command: 'get value' });
|
|
525
|
-
});
|
|
526
|
-
cli.command('get bounds <target>').action(() => {
|
|
527
|
-
notImplemented({ command: 'get bounds' });
|
|
528
|
-
});
|
|
529
|
-
cli.command('get focused').action(() => {
|
|
530
|
-
notImplemented({ command: 'get focused' });
|
|
531
|
-
});
|
|
532
511
|
cli.command('window list').option('--json', 'Output as JSON').action(async (options) => {
|
|
533
512
|
const windows = await bridge.windowList();
|
|
534
513
|
if (options.json) {
|
|
@@ -537,45 +516,6 @@ export function createCli({ bridge = createBridge() } = {}) {
|
|
|
537
516
|
}
|
|
538
517
|
printWindowList({ windows });
|
|
539
518
|
});
|
|
540
|
-
cli.command('window focus <target>').action(() => {
|
|
541
|
-
notImplemented({ command: 'window focus' });
|
|
542
|
-
});
|
|
543
|
-
cli.command('window resize <target> <width> <height>').action(() => {
|
|
544
|
-
notImplemented({ command: 'window resize' });
|
|
545
|
-
});
|
|
546
|
-
cli.command('window move <target> <x> <y>').action(() => {
|
|
547
|
-
notImplemented({ command: 'window move' });
|
|
548
|
-
});
|
|
549
|
-
cli.command('window minimize <target>').action(() => {
|
|
550
|
-
notImplemented({ command: 'window minimize' });
|
|
551
|
-
});
|
|
552
|
-
cli.command('window maximize <target>').action(() => {
|
|
553
|
-
notImplemented({ command: 'window maximize' });
|
|
554
|
-
});
|
|
555
|
-
cli.command('window close <target>').action(() => {
|
|
556
|
-
notImplemented({ command: 'window close' });
|
|
557
|
-
});
|
|
558
|
-
cli.command('app list').action(() => {
|
|
559
|
-
notImplemented({ command: 'app list' });
|
|
560
|
-
});
|
|
561
|
-
cli.command('app launch <name>').action(() => {
|
|
562
|
-
notImplemented({ command: 'app launch' });
|
|
563
|
-
});
|
|
564
|
-
cli.command('app quit <name>').action(() => {
|
|
565
|
-
notImplemented({ command: 'app quit' });
|
|
566
|
-
});
|
|
567
|
-
cli.command('wait <target>').action(() => {
|
|
568
|
-
notImplemented({ command: 'wait' });
|
|
569
|
-
});
|
|
570
|
-
cli.command('find <query>').action(() => {
|
|
571
|
-
notImplemented({ command: 'find' });
|
|
572
|
-
});
|
|
573
|
-
cli.command('diff snapshot').action(() => {
|
|
574
|
-
notImplemented({ command: 'diff snapshot' });
|
|
575
|
-
});
|
|
576
|
-
cli.command('diff screenshot').action(() => {
|
|
577
|
-
notImplemented({ command: 'diff screenshot' });
|
|
578
|
-
});
|
|
579
519
|
cli.help();
|
|
580
520
|
cli.version(packageJson.version);
|
|
581
521
|
return cli;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usecomputer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Fast computer automation CLI for AI agents. Control any desktop with accessibility snapshots, clicks, typing, scrolling, and more.",
|
|
6
6
|
"bin": "./bin.js",
|
|
@@ -39,6 +39,16 @@
|
|
|
39
39
|
"README.md",
|
|
40
40
|
"CHANGELOG.md"
|
|
41
41
|
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc && chmod +x bin.js",
|
|
44
|
+
"build:zig": "zig build",
|
|
45
|
+
"build:native": "tsx scripts/build.ts",
|
|
46
|
+
"build:native:macos": "tsx scripts/build.ts darwin-arm64 darwin-x64",
|
|
47
|
+
"vm": "tsx scripts/vm.ts",
|
|
48
|
+
"test": "vitest --run",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"prepublishOnly": "[ -n \"$CI\" ] || (pnpm build && pnpm build:native:macos)"
|
|
51
|
+
},
|
|
42
52
|
"keywords": [
|
|
43
53
|
"computer-use",
|
|
44
54
|
"automation",
|
|
@@ -80,14 +90,5 @@
|
|
|
80
90
|
},
|
|
81
91
|
"optionalDependencies": {
|
|
82
92
|
"sharp": "^0.34.5"
|
|
83
|
-
},
|
|
84
|
-
"scripts": {
|
|
85
|
-
"build": "tsc && chmod +x bin.js",
|
|
86
|
-
"build:zig": "zig build",
|
|
87
|
-
"build:native": "tsx scripts/build.ts",
|
|
88
|
-
"build:native:macos": "tsx scripts/build.ts darwin-arm64 darwin-x64",
|
|
89
|
-
"vm": "tsx scripts/vm.ts",
|
|
90
|
-
"test": "vitest --run",
|
|
91
|
-
"typecheck": "tsc --noEmit"
|
|
92
93
|
}
|
|
93
|
-
}
|
|
94
|
+
}
|
|
@@ -73,8 +73,8 @@ describe('native bridge contract', () => {
|
|
|
73
73
|
expect(typeof firstWindow.desktopIndex).toBe('number')
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// -- Clipboard (
|
|
77
|
-
await expect(bridge.clipboardSet({ text: 'bridge-contract-test' })).rejects.toThrow(
|
|
78
|
-
await expect(bridge.clipboardGet()).rejects.toThrow(
|
|
76
|
+
// -- Clipboard (not supported on this platform yet) --
|
|
77
|
+
await expect(bridge.clipboardSet({ text: 'bridge-contract-test' })).rejects.toThrow(/not (supported|implemented)/)
|
|
78
|
+
await expect(bridge.clipboardGet()).rejects.toThrow(/not (supported|implemented)/)
|
|
79
79
|
})
|
|
80
80
|
})
|
package/src/cli.ts
CHANGED
|
@@ -239,10 +239,6 @@ function printWindowList({ windows }: { windows: WindowInfo[] }) {
|
|
|
239
239
|
})
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
function notImplemented({ command }: { command: string }): never {
|
|
243
|
-
throw new Error(`TODO not implemented: ${command}`)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
242
|
export function createCli({ bridge = createBridge() }: { bridge?: UseComputerBridge } = {}) {
|
|
247
243
|
const cli = goke('usecomputer')
|
|
248
244
|
|
|
@@ -621,24 +617,6 @@ export function createCli({ bridge = createBridge() }: { bridge?: UseComputerBri
|
|
|
621
617
|
await bridge.clipboardSet({ text })
|
|
622
618
|
})
|
|
623
619
|
|
|
624
|
-
cli.command('snapshot').action(() => {
|
|
625
|
-
notImplemented({ command: 'snapshot' })
|
|
626
|
-
})
|
|
627
|
-
cli.command('get text <target>').action(() => {
|
|
628
|
-
notImplemented({ command: 'get text' })
|
|
629
|
-
})
|
|
630
|
-
cli.command('get title <target>').action(() => {
|
|
631
|
-
notImplemented({ command: 'get title' })
|
|
632
|
-
})
|
|
633
|
-
cli.command('get value <target>').action(() => {
|
|
634
|
-
notImplemented({ command: 'get value' })
|
|
635
|
-
})
|
|
636
|
-
cli.command('get bounds <target>').action(() => {
|
|
637
|
-
notImplemented({ command: 'get bounds' })
|
|
638
|
-
})
|
|
639
|
-
cli.command('get focused').action(() => {
|
|
640
|
-
notImplemented({ command: 'get focused' })
|
|
641
|
-
})
|
|
642
620
|
cli.command('window list').option('--json', 'Output as JSON').action(async (options) => {
|
|
643
621
|
const windows = await bridge.windowList()
|
|
644
622
|
if (options.json) {
|
|
@@ -647,46 +625,6 @@ export function createCli({ bridge = createBridge() }: { bridge?: UseComputerBri
|
|
|
647
625
|
}
|
|
648
626
|
printWindowList({ windows })
|
|
649
627
|
})
|
|
650
|
-
cli.command('window focus <target>').action(() => {
|
|
651
|
-
notImplemented({ command: 'window focus' })
|
|
652
|
-
})
|
|
653
|
-
cli.command('window resize <target> <width> <height>').action(() => {
|
|
654
|
-
notImplemented({ command: 'window resize' })
|
|
655
|
-
})
|
|
656
|
-
cli.command('window move <target> <x> <y>').action(() => {
|
|
657
|
-
notImplemented({ command: 'window move' })
|
|
658
|
-
})
|
|
659
|
-
cli.command('window minimize <target>').action(() => {
|
|
660
|
-
notImplemented({ command: 'window minimize' })
|
|
661
|
-
})
|
|
662
|
-
cli.command('window maximize <target>').action(() => {
|
|
663
|
-
notImplemented({ command: 'window maximize' })
|
|
664
|
-
})
|
|
665
|
-
cli.command('window close <target>').action(() => {
|
|
666
|
-
notImplemented({ command: 'window close' })
|
|
667
|
-
})
|
|
668
|
-
cli.command('app list').action(() => {
|
|
669
|
-
notImplemented({ command: 'app list' })
|
|
670
|
-
})
|
|
671
|
-
cli.command('app launch <name>').action(() => {
|
|
672
|
-
notImplemented({ command: 'app launch' })
|
|
673
|
-
})
|
|
674
|
-
cli.command('app quit <name>').action(() => {
|
|
675
|
-
notImplemented({ command: 'app quit' })
|
|
676
|
-
})
|
|
677
|
-
cli.command('wait <target>').action(() => {
|
|
678
|
-
notImplemented({ command: 'wait' })
|
|
679
|
-
})
|
|
680
|
-
cli.command('find <query>').action(() => {
|
|
681
|
-
notImplemented({ command: 'find' })
|
|
682
|
-
})
|
|
683
|
-
cli.command('diff snapshot').action(() => {
|
|
684
|
-
notImplemented({ command: 'diff snapshot' })
|
|
685
|
-
})
|
|
686
|
-
cli.command('diff screenshot').action(() => {
|
|
687
|
-
notImplemented({ command: 'diff screenshot' })
|
|
688
|
-
})
|
|
689
|
-
|
|
690
628
|
cli.help()
|
|
691
629
|
cli.version(packageJson.version)
|
|
692
630
|
return cli
|
package/zig/src/lib.zig
CHANGED
|
@@ -197,10 +197,6 @@ fn failData(comptime T: type, command: []const u8, code: []const u8, message: []
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
fn todoNotImplemented(command: []const u8) CommandResult {
|
|
201
|
-
return failCommand(command, "TODO_NOT_IMPLEMENTED", "TODO not implemented");
|
|
202
|
-
}
|
|
203
|
-
|
|
204
200
|
pub const Point = struct {
|
|
205
201
|
x: f64,
|
|
206
202
|
y: f64,
|
|
@@ -1187,12 +1183,12 @@ pub fn windowList() DataResult([]const u8) {
|
|
|
1187
1183
|
}
|
|
1188
1184
|
|
|
1189
1185
|
pub fn clipboardGet() DataResult([]const u8) {
|
|
1190
|
-
return failData([]const u8, "clipboard-get", "
|
|
1186
|
+
return failData([]const u8, "clipboard-get", "NOT_SUPPORTED", "clipboard-get is not supported on this platform");
|
|
1191
1187
|
}
|
|
1192
1188
|
|
|
1193
1189
|
pub fn clipboardSet(input: ClipboardSetInput) CommandResult {
|
|
1194
1190
|
_ = input;
|
|
1195
|
-
return
|
|
1191
|
+
return failCommand("clipboard-set", "NOT_SUPPORTED", "clipboard-set is not supported on this platform");
|
|
1196
1192
|
}
|
|
1197
1193
|
|
|
1198
1194
|
pub fn typeText(input: TypeTextInput) CommandResult {
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Kimaki
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/native-lib.cjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Loads the platform-specific usecomputer native addon built from Zig.
|
|
2
|
-
|
|
3
|
-
const os = require('node:os')
|
|
4
|
-
|
|
5
|
-
function loadCandidate(path) {
|
|
6
|
-
try {
|
|
7
|
-
return require(path)
|
|
8
|
-
} catch {
|
|
9
|
-
return undefined
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function loadNativeModule() {
|
|
14
|
-
const dev = loadCandidate('../zig-out/lib/usecomputer.node')
|
|
15
|
-
if (dev) {
|
|
16
|
-
return dev
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const platform = os.platform()
|
|
20
|
-
const arch = os.arch()
|
|
21
|
-
const target = `${platform}-${arch}`
|
|
22
|
-
|
|
23
|
-
const packaged = loadCandidate(`../dist/${target}/usecomputer.node`)
|
|
24
|
-
if (packaged) {
|
|
25
|
-
return packaged
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return null
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const native = loadNativeModule()
|
|
32
|
-
|
|
33
|
-
module.exports = { native }
|