automify 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/README.md
CHANGED
|
@@ -34,7 +34,7 @@ OpenAI and Anthropic models are supported, and any other model can be plugged in
|
|
|
34
34
|
- Built-in OpenAI and Anthropic support, plus custom model adapters.
|
|
35
35
|
- Practical guardrails: domain allowlists, command policies, screenshot controls, max steps, and hooks.
|
|
36
36
|
|
|
37
|
-
Full docs live
|
|
37
|
+
Full docs live at [aldovincenti.github.io/automify](https://aldovincenti.github.io/automify/). The shorter argument reference is [`docs/argument-reference.md`](docs/argument-reference.md).
|
|
38
38
|
|
|
39
39
|
## Install
|
|
40
40
|
|
|
@@ -50,6 +50,14 @@ AUTOMIFY_SKIP_BROWSER_INSTALL=1 npm install automify
|
|
|
50
50
|
|
|
51
51
|
Requirements: Node.js `18.18+` and a provider config. OpenAI examples use `gpt-5.5`.
|
|
52
52
|
|
|
53
|
+
Automify is published as an ES module package, so the examples use modern `import` syntax:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import { initAutomify } from "automify";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use this from an ES module project (`"type": "module"` in `package.json`) or from `.mjs` files. In CommonJS projects, use dynamic `import()` from your `require`-based files instead.
|
|
60
|
+
|
|
53
61
|
Zod support is optional. Install Zod only if you want to build structured outputs from Zod schemas:
|
|
54
62
|
|
|
55
63
|
```bash
|
|
@@ -190,10 +198,10 @@ try {
|
|
|
190
198
|
|
|
191
199
|
### Desktop Computer Use
|
|
192
200
|
|
|
193
|
-
Local desktop computer use is optional because OS control
|
|
201
|
+
Local desktop computer use is optional. Install it with the command below; it may take a while because it compiles native desktop dependencies. When you use the local desktop adapter, your OS may ask for permission to control the desktop.
|
|
194
202
|
|
|
195
203
|
```bash
|
|
196
|
-
|
|
204
|
+
npx automify-install-desktop
|
|
197
205
|
```
|
|
198
206
|
|
|
199
207
|
```js
|
|
@@ -396,6 +404,27 @@ npm run test:e2e
|
|
|
396
404
|
OPENAI_API_KEY=... npm run test:live
|
|
397
405
|
```
|
|
398
406
|
|
|
407
|
+
`npm run test:live` runs `test/e2e/live-openai.e2e.test.js` with `RUN_OPENAI_E2E=1`. By default, it runs the live OpenAI CLI and Docker CLI checks and skips the browser and Docker desktop checks.
|
|
408
|
+
|
|
409
|
+
Run every live test:
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
OPENAI_API_KEY=... \
|
|
413
|
+
RUN_OPENAI_BROWSER_E2E=1 \
|
|
414
|
+
RUN_OPENAI_VIRTUAL_DESKTOP_E2E=1 \
|
|
415
|
+
npm run test:live
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
The equivalent direct command is:
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
OPENAI_API_KEY=... \
|
|
422
|
+
RUN_OPENAI_E2E=1 \
|
|
423
|
+
RUN_OPENAI_BROWSER_E2E=1 \
|
|
424
|
+
RUN_OPENAI_VIRTUAL_DESKTOP_E2E=1 \
|
|
425
|
+
node --test test/e2e/live-openai.e2e.test.js
|
|
426
|
+
```
|
|
427
|
+
|
|
399
428
|
## License
|
|
400
429
|
|
|
401
430
|
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLocalDesktopComputer, initAutomify } from "../src/index.js";
|
|
2
2
|
|
|
3
|
-
// Run `
|
|
3
|
+
// Run `npx automify-install-desktop` once before using createLocalDesktopComputer().
|
|
4
4
|
const automify = initAutomify({
|
|
5
5
|
provider: {
|
|
6
6
|
type: "openai",
|
|
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
|
|
|
3
3
|
|
|
4
4
|
import { createLocalDesktopComputer, initAutomify } from "../src/index.js";
|
|
5
5
|
|
|
6
|
-
// Run `
|
|
6
|
+
// Run `npx automify-install-desktop` once before using createLocalDesktopComputer().
|
|
7
7
|
const automify = initAutomify({
|
|
8
8
|
provider: {
|
|
9
9
|
type: "openai",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "automify",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "AI computer use for browser, CLI, and desktop in Node.js.",
|
|
5
5
|
"homepage": "https://aldovincenti.github.io/automify",
|
|
6
6
|
"bugs": {
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"types": "src/index.d.ts",
|
|
16
|
+
"bin": {
|
|
17
|
+
"automify-install-desktop": "./scripts/install-desktop.js"
|
|
18
|
+
},
|
|
16
19
|
"exports": {
|
|
17
20
|
".": {
|
|
18
21
|
"types": "./src/index.d.ts",
|
|
@@ -43,7 +46,9 @@
|
|
|
43
46
|
"format:check": "prettier --check ."
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|
|
46
|
-
"jimp": "^
|
|
49
|
+
"@jimp/core": "^1.6.1",
|
|
50
|
+
"@jimp/js-png": "^1.6.1",
|
|
51
|
+
"@jimp/plugin-resize": "^1.6.1",
|
|
47
52
|
"playwright": ">=1.40.0"
|
|
48
53
|
},
|
|
49
54
|
"peerDependencies": {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
2
6
|
|
|
3
7
|
if (process.env.AUTOMIFY_SKIP_BROWSER_INSTALL === "1" || process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD === "1") {
|
|
4
8
|
process.exit(0);
|
|
5
9
|
}
|
|
6
10
|
|
|
7
|
-
const
|
|
11
|
+
const playwrightCli = join(dirname(require.resolve("playwright")), "cli.js");
|
|
12
|
+
const result = spawnSync(process.execPath, [playwrightCli, "install", "chromium"], {
|
|
8
13
|
cwd: process.cwd(),
|
|
9
14
|
stdio: "inherit"
|
|
10
15
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
3
|
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -23,7 +24,9 @@ const platformPackageDir = join(nutScope, `libnut-${process.platform}`);
|
|
|
23
24
|
const macPermissionsPackageDir = join(nutScope, "node-mac-permissions");
|
|
24
25
|
|
|
25
26
|
const runtimeDependencies = [
|
|
26
|
-
"jimp@
|
|
27
|
+
"@jimp/core@1.6.1",
|
|
28
|
+
"@jimp/js-png@1.6.1",
|
|
29
|
+
"@jimp/plugin-resize@1.6.1",
|
|
27
30
|
"node-abort-controller@3.1.1",
|
|
28
31
|
"clipboardy@2.3.0",
|
|
29
32
|
"bindings@1.5.0"
|
|
@@ -123,7 +126,7 @@ function checkBuildPrerequisites() {
|
|
|
123
126
|
if (missing.length === 0) return;
|
|
124
127
|
|
|
125
128
|
console.error(`Missing required desktop build tool(s): ${missing.join(", ")}`);
|
|
126
|
-
console.error("Install the native build prerequisites, then rerun:
|
|
129
|
+
console.error("Install the native build prerequisites, then rerun: npx automify-install-desktop");
|
|
127
130
|
|
|
128
131
|
if (process.platform === "darwin") {
|
|
129
132
|
console.error("macOS: install Xcode Command Line Tools with `xcode-select --install` and install CMake.");
|
package/src/lib/automify.js
CHANGED
|
@@ -715,10 +715,15 @@ async function resizeScreenshot(screenshot, target, options, automify) {
|
|
|
715
715
|
}
|
|
716
716
|
|
|
717
717
|
try {
|
|
718
|
-
const {
|
|
718
|
+
const [{ createJimp }, png, resize] = await Promise.all([
|
|
719
|
+
import("@jimp/core"),
|
|
720
|
+
import("@jimp/js-png"),
|
|
721
|
+
import("@jimp/plugin-resize")
|
|
722
|
+
]);
|
|
723
|
+
const Jimp = createJimp({ formats: [png.default], plugins: [resize.methods] });
|
|
719
724
|
const image = await Jimp.read(Buffer.from(screenshot));
|
|
720
|
-
image.resize(target.width, target.height);
|
|
721
|
-
return image.
|
|
725
|
+
image.resize({ w: target.width, h: target.height });
|
|
726
|
+
return image.getBuffer("image/png");
|
|
722
727
|
} catch (error) {
|
|
723
728
|
debugLog(automify.debug, "automify", "screenshot_resize_skipped", {
|
|
724
729
|
reason: error?.message,
|
|
@@ -432,7 +432,7 @@ async function importNut() {
|
|
|
432
432
|
return await import("@nut-tree/nut-js");
|
|
433
433
|
} catch (error) {
|
|
434
434
|
throw new AutomifyError(
|
|
435
|
-
"createLocalDesktopComputer requires the local desktop adapter dependency built from source. Install it with:
|
|
435
|
+
"createLocalDesktopComputer requires the local desktop adapter dependency built from source. Install it with: npx automify-install-desktop",
|
|
436
436
|
{ cause: error }
|
|
437
437
|
);
|
|
438
438
|
}
|