automify 0.1.1 → 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
@@ -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 needs permissions:
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
- npm run install:desktop
204
+ npx automify-install-desktop
197
205
  ```
198
206
 
199
207
  ```js
@@ -1,6 +1,6 @@
1
1
  import { createLocalDesktopComputer, initAutomify } from "../src/index.js";
2
2
 
3
- // Run `npm run install:desktop` once before using createLocalDesktopComputer().
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 `npm run install:desktop` once before using createLocalDesktopComputer().
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.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": "^0.22.10",
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,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@0.22.10",
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: npm run install:desktop");
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.");
@@ -715,10 +715,15 @@ async function resizeScreenshot(screenshot, target, options, automify) {
715
715
  }
716
716
 
717
717
  try {
718
- const { default: Jimp } = await import("jimp");
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.getBufferAsync(Jimp.MIME_PNG);
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: npm run install:desktop",
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
  }