@aivin-labs/cli 1.0.4 → 1.0.8

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.
Files changed (76) hide show
  1. package/README.md +263 -216
  2. package/bin/cli.mjs +1780 -1361
  3. package/bin/lib/browserAutomation.mjs +655 -648
  4. package/bin/lib/browserTui.mjs +276 -245
  5. package/bin/lib/cancellation.mjs +61 -0
  6. package/bin/lib/codegen.mjs +61 -5
  7. package/bin/lib/connectors.mjs +55 -21
  8. package/bin/lib/deploy.mjs +25 -2
  9. package/bin/lib/mcpProxy.mjs +869 -773
  10. package/bin/lib/mission.mjs +13 -1
  11. package/bin/lib/missionStream.mjs +696 -660
  12. package/bin/lib/pluginAuthResolve.mjs +127 -0
  13. package/bin/lib/pluginTrigger.mjs +207 -90
  14. package/bin/lib/releaseKeys.mjs +9 -0
  15. package/bin/lib/remote/activityLog.mjs +68 -0
  16. package/bin/lib/remote/autoStart.mjs +457 -0
  17. package/bin/lib/remote/autoUpdate.mjs +129 -0
  18. package/bin/lib/remote/brand.mjs +60 -0
  19. package/bin/lib/remote/browserTunnel.mjs +292 -0
  20. package/bin/lib/remote/callLedger.mjs +134 -0
  21. package/bin/lib/remote/cdpPolicy.mjs +66 -0
  22. package/bin/lib/remote/client.mjs +726 -0
  23. package/bin/lib/remote/constants.mjs +173 -0
  24. package/bin/lib/remote/credentials.mjs +208 -0
  25. package/bin/lib/remote/daemonLock.mjs +86 -0
  26. package/bin/lib/remote/dailyBrowser.mjs +371 -0
  27. package/bin/lib/remote/deviceMemory.mjs +246 -0
  28. package/bin/lib/remote/deviceProfile.mjs +142 -0
  29. package/bin/lib/remote/deviceWatches.mjs +138 -0
  30. package/bin/lib/remote/docText.mjs +117 -0
  31. package/bin/lib/remote/fileIndexer.mjs +399 -0
  32. package/bin/lib/remote/gui/index.mjs +245 -0
  33. package/bin/lib/remote/gui/officeHostSource.mjs +393 -0
  34. package/bin/lib/remote/gui/windowsHost.mjs +109 -0
  35. package/bin/lib/remote/gui/windowsHostSource.mjs +904 -0
  36. package/bin/lib/remote/httpTransfer.mjs +89 -0
  37. package/bin/lib/remote/idempotency.mjs +135 -0
  38. package/bin/lib/remote/keepAwake.mjs +100 -0
  39. package/bin/lib/remote/localConfirm.mjs +268 -0
  40. package/bin/lib/remote/localPolicy.mjs +249 -0
  41. package/bin/lib/remote/mascot/assets.mjs +218 -0
  42. package/bin/lib/remote/mascot/hostSource.mjs +362 -0
  43. package/bin/lib/remote/mascot/index.mjs +322 -0
  44. package/bin/lib/remote/mascot/labels.mjs +83 -0
  45. package/bin/lib/remote/mascot/strings.mjs +189 -0
  46. package/bin/lib/remote/memberFsPool.mjs +134 -0
  47. package/bin/lib/remote/memberFsWorker.mjs +60 -0
  48. package/bin/lib/remote/mission.mjs +156 -0
  49. package/bin/lib/remote/missionQuestion.mjs +63 -0
  50. package/bin/lib/remote/multiUser.mjs +344 -0
  51. package/bin/lib/remote/netProxy.mjs +145 -0
  52. package/bin/lib/remote/notify.mjs +58 -0
  53. package/bin/lib/remote/office/index.mjs +90 -0
  54. package/bin/lib/remote/policyCommand.mjs +93 -0
  55. package/bin/lib/remote/processes.mjs +217 -0
  56. package/bin/lib/remote/sandbox.mjs +221 -0
  57. package/bin/lib/remote/schedule.mjs +213 -0
  58. package/bin/lib/remote/scheduler.mjs +124 -0
  59. package/bin/lib/remote/textIndex.mjs +131 -0
  60. package/bin/lib/remote/tokenStore.mjs +77 -0
  61. package/bin/lib/remote/toolHandlers.mjs +726 -0
  62. package/bin/lib/remote/undoStore.mjs +242 -0
  63. package/bin/lib/remoteControl.mjs +26 -0
  64. package/bin/lib/scaffold.mjs +654 -653
  65. package/bin/lib/selfUpdate.mjs +71 -0
  66. package/bin/lib/store.mjs +16 -2
  67. package/bin/lib/tasks.mjs +52 -8
  68. package/bin/lib/update/binarySwap.mjs +63 -0
  69. package/bin/lib/update/constants.mjs +56 -0
  70. package/bin/lib/update/download.mjs +145 -0
  71. package/bin/lib/update/signature.mjs +42 -0
  72. package/bin/lib/update/state.mjs +205 -0
  73. package/bin/lib/update/versions.mjs +60 -0
  74. package/bin/lib/util.mjs +8 -0
  75. package/docs/CLI.md +1353 -1274
  76. package/package.json +71 -62
package/README.md CHANGED
@@ -1,216 +1,263 @@
1
- # @aivin-labs/cli
2
-
3
- Building an AI agent that does real work — one that calls an LLM, reasons over your data, uses
4
- tools, and knows when to hand a decision back to a human — usually means weeks of infrastructure
5
- before you write a single line of business logic: a service to host it, an SDK to wire the model
6
- calls, auth, queues, logging, a deploy pipeline. [Aivin](https://aivin.cloud) exists to collapse
7
- that. Describe what you want built, and get back a real, typed, callable, observable service in
8
- minutes — not sprints.
9
-
10
- `@aivin-labs/cli` is your entry point into that platform, and your main tool for working inside
11
- the Aivin ecosystem day to day. Instead of hand-rolling a service, you run `aivin init`, describe
12
- what the plugin should do, and get a real, deployable TypeScript project — hot-reloading local dev
13
- server, typed input/output, and a one-command path to production included. Everything after that —
14
- testing, logs, connectors, MCP integrations, agents, automation — is one more `aivin` command
15
- away, so you can build agentic applications that plug straight into the platform without ever
16
- leaving your terminal or editor.
17
-
18
- This package is the interactive tooling only; the plugin runtime library your generated code
19
- actually imports at runtime is
20
- [`@aivin-labs/sdk`](https://www.npmjs.com/package/@aivin-labs/sdk) (`ai`, `vector`, `store`, ...),
21
- installed automatically as a dependency of every project this CLI scaffolds. See
22
- [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk) below for how the two packages
23
- divide responsibilities.
24
-
25
- ## The Aivin ecosystem
26
-
27
- Aivin isn't just a place to host one function — it's a small, composable ecosystem for agentic
28
- software, and this CLI is how you reach every piece of it:
29
-
30
- - **Plugins** — the core unit of work: a typed function (`main(mission, input, ctx)`), deployed as
31
- its own container, callable by name, and searchable by every other plugin or agent in your org
32
- (`aivin plugin search`, `call()` from the SDK). Write one by hand (`aivin create`), have AI
33
- generate it from a description (`aivin init` / `aivin plugin make`), or convert an existing
34
- project into one in place (`aivin plugin convert`).
35
- - **MCP proxies** — wrap any [Model Context Protocol](https://modelcontextprotocol.io) server's
36
- tools, resources, or prompts as first-class Aivin plugins with zero code (`aivin mcp <url>`),
37
- so the growing MCP ecosystem becomes instantly usable by your agents.
38
- - **Connectors** — shared OAuth apps and credential namespaces (`aivin connector`), so ten plugins
39
- that all need "the org's Slack" don't each prompt the user for a separate login.
40
- - **AI Staff agents** — persistent, nameable agents you target with a mission, that use your
41
- plugins as tools and can pause to ask a human for input mid-task (HIL). Install one from the
42
- marketplace or build your own (`aivin agent`, `aivin do`).
43
- - **Automation jobs** — recurring, scheduled work described in plain language
44
- (`aivin do job "..."`) — no cron syntax to write.
45
- - **AI Browser** — a self-correcting agent that drives a real browser, yours or a server-side one,
46
- to complete a goal end-to-end (`aivin browser`).
47
- - **Workspaces, projects, and tasks** — the organizing structure everything above lives in, plus a
48
- lightweight task tracker (`aivin task`) for the human side of the work.
49
- - **Plugin Marketplace** — plugins and MCP proxies you build here aren't limited to your own org:
50
- submit them for community review and publish to Aivin's public Plugin Marketplace
51
- (`aivin mcp <url> --publish`), so the AI capabilities you develop become reusable building
52
- blocks other teams on the platform can search for and call, not just your own.
53
- - **Local, agent-supervised execution** — this CLI is also how Aivin reaches onto *your* machine to
54
- get real work done, always under an explicit mission and never as open-ended remote access:
55
- `aivin browser` drives a dedicated local browser profile (your own cookies/logins, isolated from
56
- your daily-driver browser) so an agent can act on real logged-in sites, and `aivin start` can run
57
- your plugin code inside a sandboxed `worker_threads.Worker` (`AIVIN_SANDBOX_WORKER=true`) with no
58
- direct access to secrets or the filesystem. Every run stays scoped to the mission that started
59
- it, with human-in-the-loop checkpoints (HIL) whenever an agent needs your go-ahead.
60
-
61
- Put together: you describe the outcome you want, and Aivin's building blocks — plugins, agents,
62
- connectors, MCP tools — compose into it. `aivin` is how you author, test, and ship each of those
63
- pieces from your own terminal, on top of whatever editor/CI workflow you already use.
64
-
65
- ## Table of contents
66
-
67
- - [The Aivin ecosystem](#the-aivin-ecosystem)
68
- - [Install](#install)
69
- - [Quick start](#quick-start)
70
- - [What you get from a scaffold](#what-you-get-from-a-scaffold)
71
- - [Command overview](#command-overview)
72
- - [Environment variables](#environment-variables)
73
- - [Documentation](#documentation)
74
- - [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk)
75
- - [Development](#development)
76
- - [License](#license)
77
-
78
- ## Install
79
-
80
- ```bash
81
- npm install -g @aivin-labs/cli
82
- aivin --version
83
- ```
84
-
85
- Requires Node.js ≥ 22.0.0 — the SDK relies on Node's native TypeScript execution to load
86
- `src/main.ts` directly, with no separate build step. `aivin start`/`aivin test` check this up
87
- front and fail with a clear message (not a cryptic loader error) if your Node is too old.
88
-
89
- ## Quick start
90
-
91
- ```bash
92
- aivin init my-plugin # ask what the plugin should do, scaffold + generate working code
93
- cd my-plugin && npm install
94
-
95
- aivin start # run it locally - gRPC server + an HTTP test shim on :4001
96
-
97
- aivin login # save an API key (once per machine)
98
- aivin test # verify on a non-production instance first
99
- aivin deploy # ship it
100
- ```
101
-
102
- `aivin init` asks what the plugin should do, then scaffolds the project **and** generates real
103
- working code from that description in one step. Prefer a blank scaffold you write by hand?
104
- `aivin create my-plugin` does just the scaffolding, no AI step. Already have a project instead of
105
- a description? `aivin plugin convert` turns an existing directory into a plugin in place.
106
-
107
- ## What you get from a scaffold
108
-
109
- Both `aivin init` and `aivin create` produce the same project shape (`init` additionally writes
110
- `src/service.ts` — see [CLI.md](docs/CLI.md#aivin-init-name)):
111
-
112
- ```
113
- my-plugin/
114
- ├── manifest.json # shared fields + plugins[] - identity, input/output schema, triggers
115
- ├── src/
116
- │ └── main.ts # (+ service.ts, if you used `aivin init`)
117
- ├── package.json # depends only on @aivin-labs/sdk; "start" runs `aivin-server` directly
118
- ├── tsconfig.json # editor/type-checking config, not used to build anything at deploy time
119
- ├── AGENTS.md # orientation for a coding agent (Claude Code, Cursor, ...) in this project
120
- ├── test/ # a real, runnable example test using createMockSDK
121
- ├── .env # local-only config (SDK_ENDPOINT, etc.)
122
- └── .gitignore
123
- ```
124
-
125
- `manifest.json`'s `description` is what the AI planner reads to decide when to use your plugin —
126
- fill it in precisely. Full field reference lives in
127
- [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md).
128
-
129
- ## Command overview
130
-
131
- Every command supports `--help` for its full flag list (`aivin <command> --help`). This table is
132
- a map — see [docs/CLI.md](docs/CLI.md) for the complete reference, including exact flags,
133
- examples, and behavior notes for each one.
134
-
135
- | Command | What it does |
136
- | --- | --- |
137
- | `aivin init [name]` | Scaffold a plugin **and** AI-generate its code from a description, in one step |
138
- | `aivin create [name]` | Scaffold a blank plugin project, no AI step |
139
- | `aivin validate` | Validate `manifest.json` (or `--json`/`--stdin`) without touching the network |
140
- | `aivin start` | Run the plugin locally (real gRPC server + `:4001` HTTP test shim), with hot-reload |
141
- | `aivin deploy` | Deploy the current plugin to your org |
142
- | `aivin test` | Deploy to a non-production instance, then smoke-test it and save a report |
143
- | `aivin plugin search <query>` | Search the platform's plugin ecosystem for something to reuse |
144
- | `aivin plugin info <id>` | Show one plugin's detail directly by id, no search query needed |
145
- | `aivin plugin ask [mission]` | One-shot: auto-pick the best-matching plugin for a mission and trigger it, like an agent would |
146
- | `aivin plugin make <description>` | AI-generate `src/main.ts` from a natural-language description |
147
- | `aivin plugin convert [hint]` | Turn an existing project in the current directory into a plugin |
148
- | `aivin plugin trigger [mission] [input]` | Invoke a deployed plugin for real and print the result |
149
- | `aivin plugin logs [pluginId]` | Tail a deployed plugin's live console output |
150
- | `aivin connector` | Register/search/list reusable OAuth or credential-form connectors |
151
- | `aivin pluginstore` | Attach a self-hosted `aivin-service` worker to your org as a plugin store |
152
- | `aivin mcp <url>` | Scan an MCP server and convert everything it finds into deployed plugin(s) |
153
- | `aivin mcp create <name>` | Scaffold a single manifest-only plugin that proxies one MCP tool/resource/prompt |
154
- | `aivin login [baseUrl]` | Log in and save an API key for this machine (browser flow by default) |
155
- | `aivin whoami` | Show which account is logged in on this machine |
156
- | `aivin key` | Manage named API keys (`gen` / `revoke` / `list`) for your account |
157
- | `aivin browser [mission]` | Run an AI Browser mission, driving a real local or server-side browser |
158
- | `aivin do [agentNickname] [mission]` | Have an AI Staff agent work toward a goal in the background |
159
- | `aivin do job [description]` | Create a recurring automation job from a plain-language description |
160
- | `aivin task [description]` | Create, list, get, update, or delete tasks in a project |
161
- | `aivin workspace` | Browse your workspaces/projects and pick one for `--workspace`/`--project` |
162
- | `aivin agent` | Search, install, create, and publish AI Staff agents |
163
- | `aivin project` | Create, rename, and delete projects within a workspace |
164
-
165
- ## Environment variables
166
-
167
- Most projects never need any of these — `aivin login` saves your key once, machine-wide, and
168
- sensible defaults cover local development. Set them in a project's `.env` (or your shell) to
169
- override:
170
-
171
- | Variable | Used by | Default |
172
- | --- | --- | --- |
173
- | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` |
174
- | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` |
175
- | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` |
176
- | `LOCAL_TEST_PORT` | `aivin start` | `4001` |
177
- | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` (loopback-only — `/invoke` has no auth) |
178
- | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` |
179
-
180
- Full descriptions and when you'd actually touch each one: [CLI.md#environment-variables](docs/CLI.md#environment-variables).
181
-
182
- ## Documentation
183
-
184
- - [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) — the full narrative walkthrough: scaffold,
185
- write, test, deploy, and use a plugin from the CLI, plus everything else `aivin` drives (tasks,
186
- AI Browser missions, workspaces, agents).
187
- - [docs/CLI.md](docs/CLI.md) — every command, flag, and environment variable, for lookup.
188
- - [docs/CHANGELOG.md](docs/CHANGELOG.md) — release history.
189
- - [`@aivin-labs/sdk`'s own docs](https://github.com/aivin-labs/AIVIN-SDK/tree/main/docs) — the SDK
190
- API your plugin code calls (`ai`, `vector`, `store`, ...), `manifest.json`'s field reference, and
191
- `ctx`. This package doesn't duplicate that content.
192
-
193
- ## Relationship to @aivin-labs/sdk
194
-
195
- - **This package (`@aivin-labs/cli`)** is dev tooling: it never runs inside a deployed plugin
196
- container, only on your machine (or CI). Its own `aivin --version` is independent of whatever
197
- `@aivin-labs/sdk` version a given plugin project has installed.
198
- - **`@aivin-labs/sdk`** is the runtime library (`import { ai, ... } from '@aivin-labs/sdk'`) and
199
- also ships `bin/server.mjs` (exposed as the `aivin-server` binary) — the actual process a
200
- deployed plugin container runs via `npm start`. `aivin start`/`aivin test` resolve and run this
201
- binary from the **current project's own** installed `@aivin-labs/sdk`, not from this CLI's
202
- install location, so a scaffolded project's `package.json` depends on `@aivin-labs/sdk` directly
203
- and never needs this CLI package installed inside the container.
204
-
205
- ## Development
206
-
207
- ```bash
208
- npm install
209
- npm run lint # eslint .
210
- npm run format # prettier --write .
211
- npm test # node --test test/cli.validate.test.mjs
212
- ```
213
-
214
- ## License
215
-
216
- MIT
1
+ # @aivin-labs/cli
2
+
3
+ Building an AI agent that does real work — one that calls an LLM, reasons over your data, uses
4
+ tools, and knows when to hand a decision back to a human — usually means weeks of infrastructure
5
+ before you write a single line of business logic: a service to host it, an SDK to wire the model
6
+ calls, auth, queues, logging, a deploy pipeline. [Aivin](https://aivin.cloud) exists to collapse
7
+ that. Describe what you want built, and get back a real, typed, callable, observable service in
8
+ minutes — not sprints.
9
+
10
+ `@aivin-labs/cli` is your entry point into that platform, and your main tool for working inside
11
+ the Aivin ecosystem day to day. Instead of hand-rolling a service, you run `aivin init`, describe
12
+ what the plugin should do, and get a real, deployable TypeScript project — hot-reloading local dev
13
+ server, typed input/output, and a one-command path to production included. Everything after that —
14
+ testing, logs, connectors, MCP integrations, agents, automation — is one more `aivin` command
15
+ away, so you can build agentic applications that plug straight into the platform without ever
16
+ leaving your terminal or editor.
17
+
18
+ This package is the interactive tooling only; the plugin runtime library your generated code
19
+ actually imports at runtime is
20
+ [`@aivin-labs/sdk`](https://www.npmjs.com/package/@aivin-labs/sdk) (`ai`, `vector`, `store`, ...),
21
+ installed automatically as a dependency of every project this CLI scaffolds. See
22
+ [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk) below for how the two packages
23
+ divide responsibilities.
24
+
25
+ ## The Aivin ecosystem
26
+
27
+ Aivin isn't just a place to host one function — it's a small, composable ecosystem for agentic
28
+ software, and this CLI is how you reach every piece of it:
29
+
30
+ - **Plugins** — the core unit of work: a typed function (`main(mission, input, ctx)`), deployed as
31
+ its own container, callable by name, and searchable by every other plugin or agent in your org
32
+ (`aivin plugin search`, `call()` from the SDK). Write one by hand (`aivin create`), have AI
33
+ generate it from a description (`aivin init` / `aivin plugin make`), or convert an existing
34
+ project into one in place (`aivin plugin convert`).
35
+ - **MCP proxies** — wrap any [Model Context Protocol](https://modelcontextprotocol.io) server's
36
+ tools, resources, or prompts as first-class Aivin plugins with zero code (`aivin mcp <url>`),
37
+ so the growing MCP ecosystem becomes instantly usable by your agents.
38
+ - **Connectors** — shared OAuth apps and credential namespaces (`aivin connector`), so ten plugins
39
+ that all need "the org's Slack" don't each prompt the user for a separate login.
40
+ - **AI Staff agents** — persistent, nameable agents you target with a mission, that use your
41
+ plugins as tools and can pause to ask a human for input mid-task (HIL). Install one from the
42
+ marketplace or build your own (`aivin agent`, `aivin do`).
43
+ - **Automation jobs** — recurring, scheduled work described in plain language
44
+ (`aivin do job "..."`) — no cron syntax to write.
45
+ - **AI Browser** — a self-correcting agent that drives a real browser, yours or a server-side one,
46
+ to complete a goal end-to-end (`aivin browser`).
47
+ - **Workspaces, projects, and tasks** — the organizing structure everything above lives in, plus a
48
+ lightweight task tracker (`aivin task`) for the human side of the work.
49
+ - **Plugin Marketplace** — plugins and MCP proxies you build here aren't limited to your own org:
50
+ submit them for community review and publish to Aivin's public Plugin Marketplace
51
+ (`aivin mcp <url> --publish`), so the AI capabilities you develop become reusable building
52
+ blocks other teams on the platform can search for and call, not just your own.
53
+ - **Local, agent-supervised execution** — this CLI is also how Aivin reaches onto *your* machine to
54
+ get real work done, always under an explicit mission and never as open-ended remote access:
55
+ `aivin browser` drives a dedicated local browser profile (your own cookies/logins, isolated from
56
+ your daily-driver browser) so an agent can act on real logged-in sites, and `aivin start` can run
57
+ your plugin code inside a sandboxed `worker_threads.Worker` (`AIVIN_SANDBOX_WORKER=true`) with no
58
+ direct access to secrets or the filesystem. Every run stays scoped to the mission that started
59
+ it, with human-in-the-loop checkpoints (HIL) whenever an agent needs your go-ahead.
60
+
61
+ Put together: you describe the outcome you want, and Aivin's building blocks — plugins, agents,
62
+ connectors, MCP tools — compose into it. `aivin` is how you author, test, and ship each of those
63
+ pieces from your own terminal, on top of whatever editor/CI workflow you already use.
64
+
65
+ ## Table of contents
66
+
67
+ - [The Aivin ecosystem](#the-aivin-ecosystem)
68
+ - [Install](#install)
69
+ - [Quick start](#quick-start)
70
+ - [What you get from a scaffold](#what-you-get-from-a-scaffold)
71
+ - [Command overview](#command-overview)
72
+ - [Environment variables](#environment-variables)
73
+ - [Documentation](#documentation)
74
+ - [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk)
75
+ - [Development](#development)
76
+ - [License](#license)
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ npm install -g @aivin-labs/cli
82
+ aivin --version
83
+ ```
84
+
85
+ Requires Node.js ≥ 22.0.0 — the SDK relies on Node's native TypeScript execution to load
86
+ `src/main.ts` directly, with no separate build step. `aivin start`/`aivin test` check this up
87
+ front and fail with a clear message (not a cryptic loader error) if your Node is too old.
88
+
89
+ ### Install without Node.js (connect a computer to Aivin)
90
+
91
+ Single-file builds are served from **https://get.aivin.vn** (mirrored on
92
+ [GitHub Releases](https://github.com/aivin-labs/cli/releases)) together with `SHA256SUMS`. The
93
+ installers pick the right build, verify its checksum, check it starts, and put `aivin` first on
94
+ your PATH:
95
+
96
+ ```powershell
97
+ # Windows 10/11 (PowerShell 5.1 or 7), x64 or ARM64
98
+ irm https://get.aivin.vn/install.ps1 | iex
99
+ ```
100
+
101
+ ```bash
102
+ # macOS (Intel / Apple Silicon) and Linux (x64 / arm64, glibc or musl)
103
+ curl -fsSL https://get.aivin.vn/install.sh | sh
104
+ # Alpine / systems without curl
105
+ wget -qO- https://get.aivin.vn/install.sh | sh
106
+ ```
107
+
108
+ | Platform | Build |
109
+ |---|---|
110
+ | Windows x64 / ARM64 | `aivin-windows-x64.exe` (baseline, no AVX2 needed) / `aivin-windows-arm64.exe` |
111
+ | macOS Intel / Apple Silicon | `aivin-darwin-x64` (baseline) / `aivin-darwin-arm64` (ad-hoc signed) |
112
+ | Linux glibc x64 / arm64 | `aivin-linux-x64` (baseline) / `aivin-linux-arm64` |
113
+ | Linux musl (Alpine) x64 / arm64 | `aivin-linux-x64-musl` / `aivin-linux-arm64-musl` — needs `libstdc++ libgcc`, which the installer adds with `apk` when it can |
114
+
115
+ In Aivin, **chat box → Browser menu → Add this computer** prints the same one-liner with a
116
+ one-time pairing code, so the computer is installed and connected in one step
117
+ (`aivin remote start --code <code>`).
118
+
119
+ When the chat has a computer selected, AI Browser work on websites runs in a Chrome/Edge window
120
+ on that computer. If you enabled **"Allow remote debugging for this browser instance"** in your
121
+ everyday browser (`chrome://inspect/#remote-debugging`, Edge: `edge://inspect` → Remote debugging),
122
+ the AI works in THAT browser with all your existing logins: click "Allow" once when it asks; the AI
123
+ opens its own tabs in the background and can only watch (never drive, close or read cookies of) the
124
+ tabs you opened. Otherwise it uses Aivin's own window (profile `~/.aivin/browser-profile`, shared with
125
+ `aivin browser` — log in once per site). `--separate-browser` always uses Aivin's own window.
126
+ Downloads land in `~/Downloads/Aivin`; when the AI needs you (login, 2FA, approval) you get an OS
127
+ notification. `aivin remote start --no-browser` turns this off.
128
+ Every tunnel goes through a CDP filter on this computer: no `file://` / `chrome://` pages, no picking local files, downloads only into
129
+ `~/Downloads/Aivin` (executables are cancelled). `aivin remote pause` now also cancels running commands and closes AI browser tabs.
130
+
131
+ Releasing: `npm run build:binary` (Bun, all 8 builds into `dist/`), then on the host behind
132
+ Cloudflare `npm run get:publish && npm run get:up` (nginx `deploy/get/`, versioned folders +
133
+ `latest.txt`). Pushing a `v*` tag also builds and attaches everything to a GitHub Release
134
+ (`.github/workflows/release.yml`).
135
+
136
+ ## Quick start
137
+
138
+ ```bash
139
+ aivin init my-plugin # ask what the plugin should do, scaffold + generate working code
140
+ cd my-plugin && npm install
141
+
142
+ aivin start # run it locally - gRPC server + an HTTP test shim on :4001
143
+
144
+ aivin login # save an API key (once per machine)
145
+ aivin test # verify on a non-production instance first
146
+ aivin deploy # ship it
147
+ ```
148
+
149
+ `aivin init` asks what the plugin should do, then scaffolds the project **and** generates real
150
+ working code from that description in one step. Prefer a blank scaffold you write by hand?
151
+ `aivin create my-plugin` does just the scaffolding, no AI step. Already have a project instead of
152
+ a description? `aivin plugin convert` turns an existing directory into a plugin in place.
153
+
154
+ ## What you get from a scaffold
155
+
156
+ Both `aivin init` and `aivin create` produce the same project shape (`init` additionally writes
157
+ `src/service.ts` — see [CLI.md](docs/CLI.md#aivin-init-name)):
158
+
159
+ ```
160
+ my-plugin/
161
+ ├── manifest.json # shared fields + plugins[] - identity, input/output schema, triggers
162
+ ├── src/
163
+ │ └── main.ts # (+ service.ts, if you used `aivin init`)
164
+ ├── package.json # depends only on @aivin-labs/sdk; "start" runs `aivin-server` directly
165
+ ├── tsconfig.json # editor/type-checking config, not used to build anything at deploy time
166
+ ├── AGENTS.md # orientation for a coding agent (Claude Code, Cursor, ...) in this project
167
+ ├── test/ # a real, runnable example test using createMockSDK
168
+ ├── .env # local-only config (SDK_ENDPOINT, etc.)
169
+ └── .gitignore
170
+ ```
171
+
172
+ `manifest.json`'s `description` is what the AI planner reads to decide when to use your plugin —
173
+ fill it in precisely. Full field reference lives in
174
+ [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md).
175
+
176
+ ## Command overview
177
+
178
+ Every command supports `--help` for its full flag list (`aivin <command> --help`). This table is
179
+ a map — see [docs/CLI.md](docs/CLI.md) for the complete reference, including exact flags,
180
+ examples, and behavior notes for each one.
181
+
182
+ | Command | What it does |
183
+ | --- | --- |
184
+ | `aivin init [name]` | Scaffold a plugin **and** AI-generate its code from a description, in one step |
185
+ | `aivin create [name]` | Scaffold a blank plugin project, no AI step |
186
+ | `aivin validate` | Validate `manifest.json` (or `--json`/`--stdin`) without touching the network |
187
+ | `aivin start` | Run the plugin locally (real gRPC server + `:4001` HTTP test shim), with hot-reload |
188
+ | `aivin deploy` | Deploy the current plugin to your org |
189
+ | `aivin test` | Deploy to a non-production instance, then smoke-test it and save a report |
190
+ | `aivin plugin search <query>` | Search the platform's plugin ecosystem for something to reuse |
191
+ | `aivin plugin info <id>` | Show one plugin's detail directly by id, no search query needed |
192
+ | `aivin plugin ask [mission]` | One-shot: auto-pick the best-matching plugin for a mission and trigger it, like an agent would |
193
+ | `aivin plugin make <description>` | AI-generate `src/main.ts` from a natural-language description |
194
+ | `aivin plugin convert [hint]` | Turn an existing project in the current directory into a plugin |
195
+ | `aivin plugin trigger [mission] [input]` | Invoke a deployed plugin for real and print the result |
196
+ | `aivin plugin logs [pluginId]` | Tail a deployed plugin's live console output |
197
+ | `aivin connector` | Register/search/list reusable OAuth or credential-form connectors |
198
+ | `aivin pluginstore` | Attach a self-hosted `aivin-service` worker to your org as a plugin store |
199
+ | `aivin mcp <url>` | Scan an MCP server and convert everything it finds into deployed plugin(s) |
200
+ | `aivin mcp create <name>` | Scaffold a single manifest-only plugin that proxies one MCP tool/resource/prompt |
201
+ | `aivin login [baseUrl]` | Log in and save an API key for this machine (browser flow by default) |
202
+ | `aivin whoami` | Show which account is logged in on this machine |
203
+ | `aivin key` | Manage named API keys (`gen` / `revoke` / `list`) for your account |
204
+ | `aivin browser [mission]` | Run an AI Browser mission, driving a real local or server-side browser |
205
+ | `aivin do [agentNickname] [mission]` | Have an AI Staff agent work toward a goal in the background |
206
+ | `aivin do job [description]` | Create a recurring automation job from a plain-language description |
207
+ | `aivin task [description]` | Create, list, get, update, or delete tasks in a project |
208
+ | `aivin workspace` | Browse your workspaces/projects and pick one for `--workspace`/`--project` |
209
+ | `aivin agent` | Search, install, create, and publish AI Staff agents |
210
+ | `aivin project` | Create, rename, and delete projects within a workspace |
211
+
212
+ ## Environment variables
213
+
214
+ Most projects never need any of these — `aivin login` saves your key once, machine-wide, and
215
+ sensible defaults cover local development. Set them in a project's `.env` (or your shell) to
216
+ override:
217
+
218
+ | Variable | Used by | Default |
219
+ | --- | --- | --- |
220
+ | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` |
221
+ | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` |
222
+ | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` |
223
+ | `LOCAL_TEST_PORT` | `aivin start` | `4001` |
224
+ | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` (loopback-only — `/invoke` has no auth) |
225
+ | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` |
226
+
227
+ Full descriptions and when you'd actually touch each one: [CLI.md#environment-variables](docs/CLI.md#environment-variables).
228
+
229
+ ## Documentation
230
+
231
+ - [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) — the full narrative walkthrough: scaffold,
232
+ write, test, deploy, and use a plugin from the CLI, plus everything else `aivin` drives (tasks,
233
+ AI Browser missions, workspaces, agents).
234
+ - [docs/CLI.md](docs/CLI.md) — every command, flag, and environment variable, for lookup.
235
+ - [docs/CHANGELOG.md](docs/CHANGELOG.md) — release history.
236
+ - [`@aivin-labs/sdk`'s own docs](https://github.com/aivin-labs/AIVIN-SDK/tree/main/docs) — the SDK
237
+ API your plugin code calls (`ai`, `vector`, `store`, ...), `manifest.json`'s field reference, and
238
+ `ctx`. This package doesn't duplicate that content.
239
+
240
+ ## Relationship to @aivin-labs/sdk
241
+
242
+ - **This package (`@aivin-labs/cli`)** is dev tooling: it never runs inside a deployed plugin
243
+ container, only on your machine (or CI). Its own `aivin --version` is independent of whatever
244
+ `@aivin-labs/sdk` version a given plugin project has installed.
245
+ - **`@aivin-labs/sdk`** is the runtime library (`import { ai, ... } from '@aivin-labs/sdk'`) and
246
+ also ships `bin/server.mjs` (exposed as the `aivin-server` binary) — the actual process a
247
+ deployed plugin container runs via `npm start`. `aivin start`/`aivin test` resolve and run this
248
+ binary from the **current project's own** installed `@aivin-labs/sdk`, not from this CLI's
249
+ install location, so a scaffolded project's `package.json` depends on `@aivin-labs/sdk` directly
250
+ and never needs this CLI package installed inside the container.
251
+
252
+ ## Development
253
+
254
+ ```bash
255
+ npm install
256
+ npm run lint # eslint .
257
+ npm run format # prettier --write .
258
+ npm test # node --test test/cli.validate.test.mjs
259
+ ```
260
+
261
+ ## License
262
+
263
+ MIT