@aivin-labs/cli 1.0.5 → 1.0.11

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 (93) hide show
  1. package/README.md +288 -216
  2. package/bin/assets/aivin-mascot.png +0 -0
  3. package/bin/cli.mjs +551 -5
  4. package/bin/lib/browserAutomation.mjs +384 -614
  5. package/bin/lib/browserTui.mjs +276 -251
  6. package/bin/lib/cancellation.mjs +61 -0
  7. package/bin/lib/localBrowser.mjs +345 -0
  8. package/bin/lib/mcpProxy.mjs +869 -837
  9. package/bin/lib/missionStream.mjs +696 -691
  10. package/bin/lib/releaseKeys.mjs +9 -0
  11. package/bin/lib/remote/activityLog.mjs +68 -0
  12. package/bin/lib/remote/autoStart.mjs +617 -0
  13. package/bin/lib/remote/autoUpdate.mjs +129 -0
  14. package/bin/lib/remote/brand.mjs +60 -0
  15. package/bin/lib/remote/browserTunnel.mjs +403 -0
  16. package/bin/lib/remote/callLedger.mjs +134 -0
  17. package/bin/lib/remote/cdpPolicy.mjs +79 -0
  18. package/bin/lib/remote/client.mjs +808 -0
  19. package/bin/lib/remote/clipboard.mjs +138 -0
  20. package/bin/lib/remote/codingAgents.mjs +293 -0
  21. package/bin/lib/remote/constants.mjs +234 -0
  22. package/bin/lib/remote/credentials.mjs +208 -0
  23. package/bin/lib/remote/daemonLock.mjs +86 -0
  24. package/bin/lib/remote/dailyBrowser.mjs +371 -0
  25. package/bin/lib/remote/desktop/index.mjs +272 -0
  26. package/bin/lib/remote/desktop/linux.mjs +144 -0
  27. package/bin/lib/remote/desktop/linuxTraySource.mjs +427 -0
  28. package/bin/lib/remote/desktop/mac.mjs +187 -0
  29. package/bin/lib/remote/desktop/macTraySource.mjs +292 -0
  30. package/bin/lib/remote/desktop/strings.mjs +74 -0
  31. package/bin/lib/remote/desktop/traySource.mjs +527 -0
  32. package/bin/lib/remote/deviceMemory.mjs +246 -0
  33. package/bin/lib/remote/deviceProfile.mjs +142 -0
  34. package/bin/lib/remote/deviceWatches.mjs +138 -0
  35. package/bin/lib/remote/docText.mjs +117 -0
  36. package/bin/lib/remote/fileIndexer.mjs +399 -0
  37. package/bin/lib/remote/gui/index.mjs +326 -0
  38. package/bin/lib/remote/gui/officeHostSource.mjs +393 -0
  39. package/bin/lib/remote/gui/windowsHost.mjs +109 -0
  40. package/bin/lib/remote/gui/windowsHostSource.mjs +1156 -0
  41. package/bin/lib/remote/httpTransfer.mjs +89 -0
  42. package/bin/lib/remote/idempotency.mjs +135 -0
  43. package/bin/lib/remote/keepAwake.mjs +100 -0
  44. package/bin/lib/remote/localConfirm.mjs +268 -0
  45. package/bin/lib/remote/localPolicy.mjs +256 -0
  46. package/bin/lib/remote/mascot/adpcm.mjs +70 -0
  47. package/bin/lib/remote/mascot/ask.mjs +768 -0
  48. package/bin/lib/remote/mascot/askHostSource.mjs +512 -0
  49. package/bin/lib/remote/mascot/assets.mjs +827 -0
  50. package/bin/lib/remote/mascot/bot.mjs +372 -0
  51. package/bin/lib/remote/mascot/hostSource.mjs +759 -0
  52. package/bin/lib/remote/mascot/hotkey.mjs +66 -0
  53. package/bin/lib/remote/mascot/index.mjs +493 -0
  54. package/bin/lib/remote/mascot/labels.mjs +82 -0
  55. package/bin/lib/remote/mascot/rigSource.mjs +609 -0
  56. package/bin/lib/remote/mascot/strings.mjs +375 -0
  57. package/bin/lib/remote/mascot/ui.mjs +104 -0
  58. package/bin/lib/remote/mascot/voiceSource.mjs +584 -0
  59. package/bin/lib/remote/meeting/index.mjs +415 -0
  60. package/bin/lib/remote/meeting/recorder.mjs +109 -0
  61. package/bin/lib/remote/meeting/recorderSource.mjs +394 -0
  62. package/bin/lib/remote/meeting/transcribe.mjs +259 -0
  63. package/bin/lib/remote/memberFsPool.mjs +134 -0
  64. package/bin/lib/remote/memberFsWorker.mjs +60 -0
  65. package/bin/lib/remote/mission.mjs +156 -0
  66. package/bin/lib/remote/missionQuestion.mjs +63 -0
  67. package/bin/lib/remote/multiUser.mjs +344 -0
  68. package/bin/lib/remote/netProxy.mjs +145 -0
  69. package/bin/lib/remote/notify.mjs +58 -0
  70. package/bin/lib/remote/office/index.mjs +90 -0
  71. package/bin/lib/remote/policyCommand.mjs +93 -0
  72. package/bin/lib/remote/processes.mjs +217 -0
  73. package/bin/lib/remote/sandbox.mjs +221 -0
  74. package/bin/lib/remote/schedule.mjs +213 -0
  75. package/bin/lib/remote/scheduler.mjs +124 -0
  76. package/bin/lib/remote/tabGroups.mjs +209 -0
  77. package/bin/lib/remote/textIndex.mjs +131 -0
  78. package/bin/lib/remote/tokenStore.mjs +77 -0
  79. package/bin/lib/remote/toolHandlers.mjs +741 -0
  80. package/bin/lib/remote/undoStore.mjs +242 -0
  81. package/bin/lib/remoteControl.mjs +26 -0
  82. package/bin/lib/scaffold.mjs +654 -653
  83. package/bin/lib/selfUpdate.mjs +71 -0
  84. package/bin/lib/update/binarySwap.mjs +63 -0
  85. package/bin/lib/update/constants.mjs +56 -0
  86. package/bin/lib/update/download.mjs +145 -0
  87. package/bin/lib/update/signature.mjs +42 -0
  88. package/bin/lib/update/state.mjs +205 -0
  89. package/bin/lib/update/versions.mjs +60 -0
  90. package/docs/AIVIN_MASCOT.md +116 -0
  91. package/docs/CLI.md +1484 -1299
  92. package/docs/media/aivin-mascot-states.mp4 +0 -0
  93. package/package.json +71 -62
package/README.md CHANGED
@@ -1,216 +1,288 @@
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
+ - [Aivin mascot on Windows](#aivin-mascot-on-windows)
71
+ - [What you get from a scaffold](#what-you-get-from-a-scaffold)
72
+ - [Command overview](#command-overview)
73
+ - [Environment variables](#environment-variables)
74
+ - [Documentation](#documentation)
75
+ - [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk)
76
+ - [Development](#development)
77
+ - [License](#license)
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ npm install -g @aivin-labs/cli
83
+ aivin --version
84
+ ```
85
+
86
+ Requires Node.js ≥ 22.0.0 — the SDK relies on Node's native TypeScript execution to load
87
+ `src/main.ts` directly, with no separate build step. `aivin start`/`aivin test` check this up
88
+ front and fail with a clear message (not a cryptic loader error) if your Node is too old.
89
+
90
+ ### Install without Node.js (connect a computer to Aivin)
91
+
92
+ Single-file builds are served from **https://get.aivin.vn** (mirrored on
93
+ [GitHub Releases](https://github.com/aivin-labs/cli/releases)) together with `SHA256SUMS`. The
94
+ installers pick the right build, verify its checksum, check it starts, and put `aivin` first on
95
+ your PATH:
96
+
97
+ ```powershell
98
+ # Windows 10/11 (PowerShell 5.1 or 7), x64 or ARM64
99
+ irm https://get.aivin.vn/install.ps1 | iex
100
+ ```
101
+
102
+ ```bash
103
+ # macOS (Intel / Apple Silicon) and Linux (x64 / arm64, glibc or musl)
104
+ curl -fsSL https://get.aivin.vn/install.sh | sh
105
+ # Alpine / systems without curl
106
+ wget -qO- https://get.aivin.vn/install.sh | sh
107
+ ```
108
+
109
+ | Platform | Build |
110
+ |---|---|
111
+ | Windows x64 / ARM64 | `aivin-windows-x64.exe` (baseline, no AVX2 needed) / `aivin-windows-arm64.exe` |
112
+ | macOS Intel / Apple Silicon | `aivin-darwin-x64` (baseline) / `aivin-darwin-arm64` (ad-hoc signed) |
113
+ | Linux glibc x64 / arm64 | `aivin-linux-x64` (baseline) / `aivin-linux-arm64` |
114
+ | 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 |
115
+
116
+ In Aivin, **chat box → Browser menu → Add this computer** prints the same one-liner with a
117
+ one-time pairing code, so the computer is installed and connected in one step
118
+ (`aivin remote start --code <code>`).
119
+
120
+ When the chat has a computer selected, AI Browser work on websites runs in a Chrome/Edge window
121
+ on that computer. If you enabled **"Allow remote debugging for this browser instance"** in your
122
+ everyday browser (`chrome://inspect/#remote-debugging`, Edge: `edge://inspect` → Remote debugging),
123
+ the AI works in THAT browser with all your existing logins: click "Allow" once when it asks; the AI
124
+ opens its own tabs in the background and can only watch (never drive, close or read cookies of) the
125
+ tabs you opened. Otherwise it uses Aivin's own window (profile `~/.aivin/browser-profile`, shared with
126
+ `aivin browser` — log in once per site). `--separate-browser` always uses Aivin's own window.
127
+ Downloads land in `~/Downloads/Aivin`; when the AI needs you (login, 2FA, approval) you get an OS
128
+ notification. `aivin remote start --no-browser` turns this off.
129
+ Every tunnel goes through a CDP filter on this computer: no `file://` / `chrome://` pages, no picking local files, downloads only into
130
+ `~/Downloads/Aivin` (executables are cancelled). `aivin remote pause` now also cancels running commands and closes AI browser tabs.
131
+
132
+ Releasing: `npm run build:binary` (Bun, all 8 builds into `dist/`), then on the host behind
133
+ Cloudflare `npm run get:publish && npm run get:up` (nginx `deploy/get/`, versioned folders +
134
+ `latest.txt`). Pushing a `v*` tag also builds and attaches everything to a GitHub Release
135
+ (`.github/workflows/release.yml`).
136
+
137
+ ## Quick start
138
+
139
+ ```bash
140
+ aivin init my-plugin # ask what the plugin should do, scaffold + generate working code
141
+ cd my-plugin && npm install
142
+
143
+ aivin start # run it locally - gRPC server + an HTTP test shim on :4001
144
+
145
+ aivin login # save an API key (once per machine)
146
+ aivin test # verify on a non-production instance first
147
+ aivin deploy # ship it
148
+ ```
149
+
150
+ `aivin init` asks what the plugin should do, then scaffolds the project **and** generates real
151
+ working code from that description in one step. Prefer a blank scaffold you write by hand?
152
+ `aivin create my-plugin` does just the scaffolding, no AI step. Already have a project instead of
153
+ a description? `aivin plugin convert` turns an existing directory into a plugin in place.
154
+
155
+ ## Aivin mascot on Windows
156
+
157
+ When Aivin Remote is running on Windows, a small animated Aivin mascot can float above your apps.
158
+ It shows whether Aivin is idle, working, thinking, waiting for you, done, paused, offline, or has hit
159
+ an error. Hover or click it to type a question, use its microphone for a live voice conversation,
160
+ right-click for the activity panel, or drop local files onto it to attach them to your next message.
161
+ The mascot stays out of Aivin screenshots and moves aside while the agent controls another window.
162
+
163
+ ```bash
164
+ aivin remote start # start the listener and mascot
165
+ aivin ui # show the mascot and open its ask box
166
+ aivin ui --demo # preview all mascot animations
167
+ aivin remote mascot off # turn it off persistently
168
+ aivin remote mascot on # enable it for the next listener start
169
+ ```
170
+
171
+ Turning it off from the activity panel plays a short fade-and-slide exit animation while the Remote
172
+ listener continues in the background. See the dedicated [Aivin mascot guide](docs/AIVIN_MASCOT.md)
173
+ for interactions, voice and keyboard shortcuts, states, privacy behavior, and troubleshooting.
174
+
175
+ ## What you get from a scaffold
176
+
177
+ Both `aivin init` and `aivin create` produce the same project shape (`init` additionally writes
178
+ `src/service.ts` — see [CLI.md](docs/CLI.md#aivin-init-name)):
179
+
180
+ ```
181
+ my-plugin/
182
+ ├── manifest.json # shared fields + plugins[] - identity, input/output schema, triggers
183
+ ├── src/
184
+ │ └── main.ts # (+ service.ts, if you used `aivin init`)
185
+ ├── package.json # depends only on @aivin-labs/sdk; "start" runs `aivin-server` directly
186
+ ├── tsconfig.json # editor/type-checking config, not used to build anything at deploy time
187
+ ├── AGENTS.md # orientation for a coding agent (Claude Code, Cursor, ...) in this project
188
+ ├── test/ # a real, runnable example test using createMockSDK
189
+ ├── .env # local-only config (SDK_ENDPOINT, etc.)
190
+ └── .gitignore
191
+ ```
192
+
193
+ `manifest.json`'s `description` is what the AI planner reads to decide when to use your plugin —
194
+ fill it in precisely. Full field reference lives in
195
+ [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md).
196
+
197
+ ## Command overview
198
+
199
+ Every command supports `--help` for its full flag list (`aivin <command> --help`). This table is
200
+ a map — see [docs/CLI.md](docs/CLI.md) for the complete reference, including exact flags,
201
+ examples, and behavior notes for each one.
202
+
203
+ | Command | What it does |
204
+ | --- | --- |
205
+ | `aivin init [name]` | Scaffold a plugin **and** AI-generate its code from a description, in one step |
206
+ | `aivin create [name]` | Scaffold a blank plugin project, no AI step |
207
+ | `aivin validate` | Validate `manifest.json` (or `--json`/`--stdin`) without touching the network |
208
+ | `aivin start` | Run the plugin locally (real gRPC server + `:4001` HTTP test shim), with hot-reload |
209
+ | `aivin deploy` | Deploy the current plugin to your org |
210
+ | `aivin test` | Deploy to a non-production instance, then smoke-test it and save a report |
211
+ | `aivin plugin search <query>` | Search the platform's plugin ecosystem for something to reuse |
212
+ | `aivin plugin info <id>` | Show one plugin's detail directly by id, no search query needed |
213
+ | `aivin plugin ask [mission]` | One-shot: auto-pick the best-matching plugin for a mission and trigger it, like an agent would |
214
+ | `aivin plugin make <description>` | AI-generate `src/main.ts` from a natural-language description |
215
+ | `aivin plugin convert [hint]` | Turn an existing project in the current directory into a plugin |
216
+ | `aivin plugin trigger [mission] [input]` | Invoke a deployed plugin for real and print the result |
217
+ | `aivin plugin logs [pluginId]` | Tail a deployed plugin's live console output |
218
+ | `aivin connector` | Register/search/list reusable OAuth or credential-form connectors |
219
+ | `aivin pluginstore` | Attach a self-hosted `aivin-service` worker to your org as a plugin store |
220
+ | `aivin mcp <url>` | Scan an MCP server and convert everything it finds into deployed plugin(s) |
221
+ | `aivin mcp create <name>` | Scaffold a single manifest-only plugin that proxies one MCP tool/resource/prompt |
222
+ | `aivin login [baseUrl]` | Log in and save an API key for this machine (browser flow by default) |
223
+ | `aivin whoami` | Show which account is logged in on this machine |
224
+ | `aivin key` | Manage named API keys (`gen` / `revoke` / `list`) for your account |
225
+ | `aivin browser [mission]` | Run an AI Browser mission, driving a real local or server-side browser |
226
+ | `aivin remote start` | Connect this computer to Aivin and show the Windows mascot when enabled |
227
+ | `aivin ui` | Show the Windows mascot with its ask box, or preview its animations with `--demo` |
228
+ | `aivin do [agentNickname] [mission]` | Have an AI Staff agent work toward a goal in the background |
229
+ | `aivin do job [description]` | Create a recurring automation job from a plain-language description |
230
+ | `aivin task [description]` | Create, list, get, update, or delete tasks in a project |
231
+ | `aivin workspace` | Browse your workspaces/projects and pick one for `--workspace`/`--project` |
232
+ | `aivin agent` | Search, install, create, and publish AI Staff agents |
233
+ | `aivin project` | Create, rename, and delete projects within a workspace |
234
+
235
+ ## Environment variables
236
+
237
+ Most projects never need any of these — `aivin login` saves your key once, machine-wide, and
238
+ sensible defaults cover local development. Set them in a project's `.env` (or your shell) to
239
+ override:
240
+
241
+ | Variable | Used by | Default |
242
+ | --- | --- | --- |
243
+ | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` |
244
+ | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` |
245
+ | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` |
246
+ | `LOCAL_TEST_PORT` | `aivin start` | `4001` |
247
+ | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` (loopback-only — `/invoke` has no auth) |
248
+ | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` |
249
+
250
+ Full descriptions and when you'd actually touch each one: [CLI.md#environment-variables](docs/CLI.md#environment-variables).
251
+
252
+ ## Documentation
253
+
254
+ - [docs/AIVIN_MASCOT.md](docs/AIVIN_MASCOT.md) — the Windows mascot: interaction, voice,
255
+ animation states, shortcuts, privacy, controls, and troubleshooting.
256
+ - [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) — the full narrative walkthrough: scaffold,
257
+ write, test, deploy, and use a plugin from the CLI, plus everything else `aivin` drives (tasks,
258
+ AI Browser missions, workspaces, agents).
259
+ - [docs/CLI.md](docs/CLI.md) — every command, flag, and environment variable, for lookup.
260
+ - [docs/CHANGELOG.md](docs/CHANGELOG.md) — release history.
261
+ - [`@aivin-labs/sdk`'s own docs](https://github.com/aivin-labs/AIVIN-SDK/tree/main/docs) — the SDK
262
+ API your plugin code calls (`ai`, `vector`, `store`, ...), `manifest.json`'s field reference, and
263
+ `ctx`. This package doesn't duplicate that content.
264
+
265
+ ## Relationship to @aivin-labs/sdk
266
+
267
+ - **This package (`@aivin-labs/cli`)** is dev tooling: it never runs inside a deployed plugin
268
+ container, only on your machine (or CI). Its own `aivin --version` is independent of whatever
269
+ `@aivin-labs/sdk` version a given plugin project has installed.
270
+ - **`@aivin-labs/sdk`** is the runtime library (`import { ai, ... } from '@aivin-labs/sdk'`) and
271
+ also ships `bin/server.mjs` (exposed as the `aivin-server` binary) — the actual process a
272
+ deployed plugin container runs via `npm start`. `aivin start`/`aivin test` resolve and run this
273
+ binary from the **current project's own** installed `@aivin-labs/sdk`, not from this CLI's
274
+ install location, so a scaffolded project's `package.json` depends on `@aivin-labs/sdk` directly
275
+ and never needs this CLI package installed inside the container.
276
+
277
+ ## Development
278
+
279
+ ```bash
280
+ npm install
281
+ npm run lint # eslint .
282
+ npm run format # prettier --write .
283
+ npm test # node --test test/cli.validate.test.mjs
284
+ ```
285
+
286
+ ## License
287
+
288
+ MIT
Binary file