@aivin-labs/cli 1.0.21 → 1.0.27

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/docs/CLI.md CHANGED
@@ -1,1545 +1,1576 @@
1
- # 🖥️ CLI Reference
2
-
3
- `aivin` is built on [Commander](https://github.com/tj/commander.js), so help is always available
4
- without needing this doc:
5
-
6
- ```bash
7
- aivin --help # or: aivin help
8
- aivin <command> --help # or: aivin help <command>
9
- ```
10
-
11
- Every command below is real - this is the exact output of `aivin --help` as of this CLI version.
12
-
13
- ```
14
- Usage: aivin [options] [command]
15
-
16
- aivin CLI - scaffold, run, and deploy Aivin plugins
17
-
18
- Options:
19
- -V, --version output the version number
20
- -h, --help display help for command
21
-
22
- Commands:
23
- create [options] [name] Create new plugin
24
- init [options] [name] Set up a new plugin step by step: asks what it should do, then generates real working code from that description
25
- validate [options] Validate manifest.json in the current directory (or --json/--stdin for scripted use)
26
- start [options] Start plugin server
27
- deploy Deploy plugin to your org on the Aivin server
28
- test [options] Deploy to a non-production test instance, then smoke-test it with generated input and save a report to .test/
29
- plugin AI-assisted plugin authoring
30
- connector Register and discover reusable connectors (OAuth apps / credential-form namespaces)
31
- pluginstore Self-hosted aivin-service worker (Docker) - attach it to your org as a plugin store
32
- mcp [options] [url] MCP proxy plugins - wrap an external MCP server tool/resource/prompt, no code required
33
- login [options] [baseUrl] Log in and save an API key for plugin deployment (opens your browser by default)
34
- whoami Show which account is currently logged in on this machine (reads ~/.aivin/credentials - no server call)
35
- key Manage named API keys for your account
36
- browser [options] [mission] Run an AI Browser mission - by default opens/reuses a local browser window dedicated to AI Browser (own profile, own cookies - log in once, watch missions run live from then on); --remote uses a server-side browser instead
37
- do [options] [agentNickname] [mission] Have <agentNickname> work toward a goal in the background - not a specific deployed plugin
38
- task [options] [description] Create a new task from a plain-language description
39
- workspace [options] Browse your workspaces and projects, and pick one to use with --workspace/--project
40
- agent Search, install, create, and publish AI Staff agents
41
- project Create, update, and delete projects within a workspace
42
- help [command] display help for command
43
- ```
44
-
45
- ## `aivin init [name]`
46
-
47
- The simplest way to start: asks what the plugin should do, then scaffolds the project **and**
48
- generates real working code from that description in one step - no separate `aivin create` +
49
- `aivin plugin make` needed.
50
-
51
- ```bash
52
- aivin init my-plugin
53
- # ? Plugin name: my-plugin
54
- # ? What should this plugin do? (be specific - this is what generates your code)
55
- # > Summarize a support ticket and tag its urgency low/medium/high
56
- ```
57
-
58
- Options:
59
-
60
- ```
61
- Options:
62
- --name <name> Plugin name (if not specified, will prompt)
63
- --model <model> LLM model to use for generation
64
- --provider <provider> LLM provider to use for generation
65
- ```
66
-
67
- Writes two source files instead of one, unlike `aivin create`:
68
-
69
- - **`src/service.ts`** - the actual business logic, AI-generated from your description. A single
70
- exported `execute(input, ctx)` that returns plain result data (or throws a plain `Error`) - no
71
- `PluginResponse`/`PluginStatus` boilerplate to think about.
72
- - **`src/main.ts`** - a thin, static wrapper (not AI-generated, doesn't change between runs). Calls
73
- `execute()` and packages the result into the `PluginResponse` the platform expects. This filename
74
- is fixed - the runtime always loads exactly `src/main.ts`, so it's never regenerated or renamed.
75
-
76
- If code generation fails (network issue, `API_KEY` not set, etc.), `aivin init` still leaves you
77
- with a working, deployable scaffold - it falls back to the same plain placeholder `aivin create`
78
- writes, so nothing is left half-broken.
79
-
80
- Regenerating later: `aivin plugin make "<new description>"` detects `src/service.ts` and targets it
81
- instead of `src/main.ts`, so the split is preserved (see below).
82
-
83
- Prefer no AI step at all? `aivin create` scaffolds the same project structure minus the generation -
84
- one `src/main.ts` you write by hand.
85
-
86
- ## `aivin create`
87
-
88
- Scaffold a new plugin project (`manifest.json`, `src/main.ts`, `package.json`, `tsconfig.json`,
89
- `.env`, `.gitignore`).
90
-
91
- ```
92
- Usage: aivin create [options] [name]
93
-
94
- Options:
95
- --json <config> JSON config (AI mode)
96
- --stdin Read from stdin
97
- --name <name> Plugin name (if not specified, will prompt)
98
- --silent Silent mode
99
- --json-output JSON output
100
- ```
101
-
102
- - `aivin create <name>` (or `--name <name>`) → creates a new `<name>/` subdirectory and scaffolds
103
- into it, no name prompt (description still prompted).
104
- - No name at all → interactive prompts for both name and description, scaffolding into the
105
- **current** directory - `mkdir`/`cd` into your target folder yourself first.
106
- - `--json '<config>'` / `--stdin` → non-interactive/scripted mode for AI tooling, also creates a
107
- `<config.name>/` subdirectory. `config` needs at least `name` and `description`; anything else
108
- (`input`, `output`, `trigger_type`, ...) is merged straight into the generated `manifest.json`.
109
- `config` may also be a path to a JSON file.
110
- - `--json-output` → prints a machine-readable `{ success, pluginDir, name, description, timestamp }`
111
- result instead of the usual colored console output.
112
-
113
- ```bash
114
- aivin create my-plugin
115
- aivin create --json '{"name":"my-plugin","description":"Summarize tickets"}'
116
- ```
117
-
118
- ## `aivin validate`
119
-
120
- Validates a plugin config against the same rules `aivin create` enforces (name format, required
121
- `description`, and - if present - `proxy_config` completeness for MCP proxy plugins). Doesn't touch
122
- the network.
123
-
124
- With no flags, validates `manifest.json` in the current directory - the common case:
125
-
126
- ```bash
127
- cd my-plugin
128
- aivin validate
129
- ```
130
-
131
- ```
132
- Options:
133
- --json <config> JSON config, instead of reading manifest.json from the current directory
134
- --stdin Read JSON config from stdin, instead of reading manifest.json
135
- --json-output JSON output
136
- ```
137
-
138
- `--json`/`--stdin` remain for scripted/CI use where the config isn't a file on disk yet:
139
-
140
- ```bash
141
- aivin validate --json '{"name":"my-plugin","description":"x"}'
142
- ```
143
-
144
- ## `aivin start`
145
-
146
- Runs the current plugin directory (must contain `manifest.json` and `src/main.ts`) against a real
147
- local server - specifically, this project's own installed `@aivin-labs/sdk`'s `bin/server.mjs`
148
- (resolved from *this project's* `node_modules`, not the CLI's own install location - if you see
149
- "Could not find @aivin-labs/sdk installed", run `npm install` first). Starts:
150
-
151
- 1. A real gRPC server (bind `0.0.0.0:50051`) - the same protocol the production host uses to
152
- trigger your handler(s). You don't call this directly.
153
- 2. In development (anything but `NODE_ENV=production`), an HTTP test shim on `:4001` (override with
154
- `LOCAL_TEST_PORT`) for manual `curl` testing.
155
-
156
- ```bash
157
- aivin start
158
- curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
159
- -d '{"input":{"text":"hello"}}'
160
- ```
161
-
162
- With more than one `plugins: []` entry, pass `mission` to pick which entry's `func` runs - it's
163
- matched against each entry's `id`, falling back to `func` (a single-entry manifest, the scaffold
164
- default, always resolves to its one entry - no `mission` needed):
165
-
166
- ```bash
167
- curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
168
- -d '{"mission":"summarize-ticket","input":{"text":"hello"}}'
169
- ```
170
-
171
- SDK calls made while running default to the **production** backend (`api.aivin.cloud`) if
172
- `SDK_ENDPOINT` isn't set in `.env` - point it at a local/dev backend instead if you don't want
173
- that (see [Environment variables](#environment-variables) below).
174
-
175
- ### Hot-reload
176
-
177
- Saving `src/**` or `manifest.json` re-imports the plugin in place - no more Ctrl+C + `aivin start`
178
- again after every edit. Both the real gRPC server and the `:4001` HTTP test shim pick up the change
179
- together. A broken save (syntax error, missing export) is reported and the *previous* working
180
- version keeps serving until you fix it - a typo mid-edit doesn't kill the running server.
181
-
182
- ```
183
- ♻️ Reloaded (src/main.ts): my-plugin (My Plugin) v0.1.0
184
- ```
185
-
186
- On by default in development; disabled automatically inside a real deployed container (detected via
187
- `SDK_SECRET_FILE`, which only a real deploy sets - `NODE_ENV=production` alone doesn't reliably mean
188
- "deployed", the platform's own container build never sets it). This same file is also the
189
- container's entrypoint in production, where the plugin source is also bind-mounted read-only, so
190
- there'd be nothing for the watcher to see even without this check. Turn it off by hand with
191
- `--no-watch` or `AIVIN_START_WATCH=false`.
192
-
193
- ### Live per-call debugging: `--debug` / `--debug-json`
194
-
195
- By default you only see a trace summary once the whole invocation finishes (`AIVIN_TRACE`, on by
196
- default - see [Environment variables](#environment-variables)). To watch each `sdk.*` call as it
197
- happens instead:
198
-
199
- ```bash
200
- aivin start --debug # human-readable: one line per call, live
201
- aivin start --debug-json # same events, one JSON object per line - for a script/coding agent
202
- # to parse instead of pattern-matching free text
203
- ```
204
-
205
- Both are `SDK_DEBUG=true`/`SDK_DEBUG=json` under the hood (settable directly if you're not going
206
- through `aivin start`, e.g. inside `aivin test`'s smoke-test run). Each line/event covers exactly
207
- one `sdk.*` call: `namespace`, `duration_ms`, `attempts`, `success`, `error` (if any).
208
-
209
- ## `aivin deploy`
210
-
211
- Deploys the plugin in the current directory (`manifest.json` + every project file except
212
- `node_modules/`, `.git/`, `.tmp/`, `dist/`, `build/`, `.test/`, `.gitignore`, `yarn.lock`, and
213
- `.env`) to `POST /plugins/deploy`. Always private to your org - there's no CLI-reachable "submit to
214
- the public store" path for regular code/Docker plugins today (that only exists through the browser
215
- CodeEditor's publish flow, a different runtime). **MCP proxy plugins are the one exception** -
216
- `aivin mcp <url> --publish` (below) can submit those to the community store directly from the CLI.
217
-
218
- - `manifest.json` is normally the default `{ ...commonFields, plugins: [...] }` shape (see
219
- [MANIFEST.md#default-shape](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#default-shape)) - common fields are copied onto each
220
- entry in `plugins` before upload, and all entries deploy together, sharing one running
221
- container. The legacy flat single-object shape is still accepted.
222
- - If every entry's `manifest.proxy_config` is set (MCP proxy plugins - see `aivin mcp create`
223
- below), no files are read or sent at all - just the manifest.
224
- - `package-lock.json` is auto-generated (`npm install --package-lock-only`) before upload if missing
225
- - the backend's build runs `npm ci`, which requires one.
226
- - On success, auto-increments `manifest.json`'s patch version(s) and writes back the plugin id(s)
227
- the server assigned.
228
-
229
- ```bash
230
- aivin deploy
231
- ```
232
-
233
- ## `aivin test`
234
-
235
- Same payload/logic as `aivin deploy`, but against `POST /plugins/test/deploy` - a non-production
236
- instance for verifying the plugin runs end-to-end on real infra (real container, real gRPC, real
237
- the SDK) before anyone else can see it. This endpoint is blocked by the backend in production.
238
-
239
- After a successful deploy, it also **smoke-tests** every non-proxy plugin entry: generates sample
240
- input from `manifest.json`'s `input` schema (`POST /code/generate-sample-data`), invokes the plugin
241
- for real (`POST /plugins/execute`) against a workspace, and writes a pass/fail report to
242
- `.test/<timestamp>.json` in the project directory (also excluded from future deploy uploads).
243
-
244
- **MCP proxy entries are skipped by default** - there's no generic "sample input" that makes sense
245
- for a tool schema an external MCP server defines itself, so `aivin test` deploys them but runs no
246
- automated invoke/report unless you opt in with `--verify-proxy`. Use
247
- `aivin plugin trigger --id <pluginId> -a "<prompt>"` (or the interactive "Test now?" step
248
- `aivin mcp <url>` offers right after deploy) to test one by hand instead.
249
-
250
- ```
251
- Options:
252
- --workspace <id> Workspace id to run the smoke test against (default: auto-picks your first one)
253
- --no-smoke-test Only deploy - skip the generated-input invoke test and report
254
- --verify-proxy Also invoke MCP proxy entries for real (empty input) instead of skipping
255
- them - only use if you know the underlying tool(s) have no meaningful side
256
- effects
257
- ```
258
-
259
- ```bash
260
- aivin test # deploy + smoke-test + report
261
- aivin test --workspace <id> # smoke-test against a specific workspace
262
- aivin test --no-smoke-test # deploy only, same as before this flag existed
263
- aivin test --verify-proxy # also invoke proxy entries with empty input, for real
264
- ```
265
-
266
- `--verify-proxy` sends `arguments: {}` (not AI-generated - proxy's `input` schema is the generic
267
- `{ data: object }` passthrough, so there's nothing meaningful to infer a "realistic" sample from)
268
- straight to `/plugins/execute`. This really calls the external MCP server - only use it if the
269
- tool(s) involved are safe to invoke automatically (idempotent/read-only), since a repeated `aivin
270
- test` run means a repeated real call every time.
271
-
272
- Entries the MCP server itself flagged destructive/non-readonly (via the MCP spec's own
273
- `readOnlyHint`/`destructiveHint` tool annotations, surfaced on the manifest as `request_hil: true`)
274
- are skipped even under `--verify-proxy` - that flag means "the caller vetted these tools as safe to
275
- call automatically," which doesn't extend to a tool the server itself is warning isn't. Verify
276
- those by hand instead (`aivin plugin trigger --id <id> -a "..."`).
277
-
278
- ## `aivin plugin make <description>`
279
-
280
- AI-generates a plugin from a natural-language description, via `POST /code/generate-project` -
281
- **complexity-adaptive**: the backend classifies the requirement first, and only escalates beyond a
282
- single `src/main.ts` when it's genuinely complex.
283
-
284
- ```
285
- Options:
286
- --model <model> LLM model to use for generation
287
- --provider <provider> LLM provider to use for generation
288
- ```
289
-
290
- ```bash
291
- aivin plugin make "Summarize a support ticket and tag its urgency"
292
- ```
293
-
294
- - **Simple/moderate** requirement (the common case): exactly one `src/main.ts`, one generation call
295
- - unchanged from before. Same conventions as always (`main(mission, input, ctx)`,
296
- `import { ai } from '@aivin-labs/sdk'`, `PluginResponse`).
297
- - **Complex** requirement (several genuinely independent capabilities, or logic too large for one
298
- flat function): the backend plans a small multi-file project first, generates each file, and - if
299
- the plan calls for it - returns a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
300
- fragment that replaces `manifest.json`'s `plugins[]` with one entry per capability.
301
-
302
- Requires `manifest.json` to already exist (`aivin create` first).
303
-
304
- ### Self-correction loop
305
-
306
- Generation isn't one-shot, and for a multi-file plan it isn't one-file-at-a-time either: files with
307
- no dependency on each other generate in parallel (only a file that genuinely needs to see another
308
- one's content, per the plan's own `depends_on`, waits for it first). After writing every returned
309
- file, if the project's own `typescript` devDependency is installed (`npm install` already run), the
310
- whole project is type-checked with `tsc --noEmit`. Real compiler errors (exact
311
- `file(line,col): error TSxxxx: ...` lines) are attributed back to whichever file they were reported
312
- against and sent to the AI for a surgical fix - up to 2 rounds, across as many files as had errors:
313
-
314
- ```
315
- 🤖 Generating plugin
316
- ✅ 2 file(s) generated (src/main.ts, src/lib/search.ts)
317
- ⚠️ 2 compiler error(s) across 1 file(s) - asking the AI to fix...
318
- ✅ Fixed - clean type-check after 1 attempt(s)
319
- ```
320
-
321
- If `node_modules` isn't installed yet, type-checking (and the self-correction it enables) is skipped
322
- silently - run `npm install` first if you want it. If errors remain after both rounds, every file is
323
- still written, with every remaining error printed for you to fix by hand.
324
-
325
- Review generated code before relying on it either way - self-correction only catches what `tsc`
326
- catches (type errors), not wrong business logic.
327
-
328
- ## `aivin plugin convert [hint]`
329
-
330
- Hands the existing project in the current directory to the backend's agentic project-conversion
331
- pipeline instead of generating locally. Unlike `plugin make`/`plugin init` (a single AI call per
332
- file, run entirely from what you pass it), this command:
333
-
334
- 1. Uploads only the **directory tree** - paths and byte sizes, never file content - so the request
335
- stays cheap no matter how large the project is.
336
- 2. The backend scans it: it decides which files are actually worth reading (entry points,
337
- `package.json`, anything name-suggestive of routes/tools/skills) and asks the CLI to read them
338
- back one at a time, over the same socket connection `aivin plugin logs` uses.
339
- 3. It plans a conversion - single `main()` vs. a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
340
- (one `plugins[]` entry per independent capability), and which files to create vs. adapt in
341
- place - detecting the project's shape (a plain script, an MCP server, an API backend with
342
- routes, a Claude-style skill) from what it actually read, not a fixed regex. If the project isn't
343
- TypeScript/JavaScript (Python, Go, ...), every file becomes a **port** (translated, not edited) -
344
- the plan always uses `create` in that case, never `update`, since there's no existing `.ts` file
345
- to adapt in place.
346
- 4. It generates/updates each planned file, then **verifies with a real `tsc --noEmit` run** on your
347
- machine (via the same tool-call channel) and self-corrects on real compiler errors, up to twice.
348
-
349
- Every step prints live as it happens - this loop can take a while on a real project, so it's never
350
- silent:
351
-
352
- ```bash
353
- cd your-existing-project
354
- aivin plugin convert
355
- # 📂 Scanning project tree...
356
- # 142 file(s) in tree (content read on demand by the server, never uploaded up front)
357
- # 🤖 Converting - this loops (scan → plan → generate → verify), watch for progress below...
358
- #
359
- # [10:32:01] Scanning project tree (142 entries)...
360
- # [10:32:03] Reading 3 file(s): package.json, src/index.ts, src/tools/search.ts
361
- # [10:32:07] Plan ready: mcp_server, 2 file(s) - Two independent MCP tools found (search, fetch);
362
- # splitting into a multi-function manifest so each is separately callable.
363
- # [10:32:15] Generating 2 file(s) in parallel: src/main.ts, src/lib/search.ts
364
- # [10:32:22] Type-checking (attempt 1)...
365
- # [10:32:23] Type-check clean
366
- # [10:32:23] All required exports present
367
- # [10:32:24] Running a smoke test with generated sample input (may make real SDK/AI calls using your credentials)...
368
- # [10:32:31] Smoke test passed
369
- # ✅ Conversion done (mcp_server, 2 file(s))
370
- ```
371
-
372
- The smoke test only runs if the type-check passed first (no point executing code that doesn't even
373
- compile) and `@aivin-labs/sdk` is already installed locally (`npm install`) - skipped, not failed,
374
- otherwise. It spawns the real plugin runtime on your machine on off-default ports (won't collide with
375
- a real `aivin start`) with AI-generated sample input, so a plugin whose logic calls `ai.prompt()` or
376
- other SDK methods will make a real call using your credentials during this step.
377
-
378
- ```
379
- Options:
380
- --model <model> LLM model to use for generation
381
- --provider <provider> LLM provider to use for generation
382
- --force Re-run conversion even if src/main.ts already exists (e.g. redo a
383
- previous bad/stale result)
384
- ```
385
-
386
- - No `manifest.json` needed first - if one doesn't exist, it's created from `package.json` (name,
387
- description) or the directory name.
388
- - Fails if `src/main.ts` already exists, unless `--force` is given - the plain (no-flag) case is
389
- for a project that isn't a plugin yet; `--force` re-runs the whole scan/plan/generate/verify loop
390
- against a project this command already converted before (the earlier plan turned out wrong, the
391
- project changed since, whatever the reason) - `src/main.ts` isn't excluded from what gets scanned,
392
- so the new plan is free to mark it `update`, and the usual per-file overwrite confirmation still
393
- applies to it like any other existing file.
394
- - `[hint]` is optional extra guidance, e.g. which function to focus on - passed straight to the
395
- backend's planning step.
396
- - If the plan is multi-function, `manifest.json`'s `plugins[]` is replaced with one entry per
397
- planned capability (fresh local ids - `aivin deploy` still assigns the real ones).
398
- - Requires a live connection to the Aivin server for the whole duration (it's not a local batch
399
- job) - the socket is what lets the backend read files on demand and stream progress back.
400
- - Only one conversion can run at a time per project - starting a second one against the same
401
- project while the first is still running fails fast instead of racing both against the same
402
- files. If the previous run's process died without cleanly finishing, this frees up on its own
403
- within moments, not stuck for the full run duration.
404
- - The whole run gives up after ~15 minutes regardless of how far it got, so a stuck step can't hold
405
- the connection open forever.
406
-
407
- ### Overwrite safety
408
-
409
- Unlike `plugin make`, this command can touch files that **already exist** in your project - the
410
- backend's plan may mark some as `update` (adapt in place) rather than `create` (new file):
411
-
412
- - Before scanning starts, if the directory is a git repo with uncommitted changes, you're warned
413
- and (in an interactive terminal) asked to confirm before continuing at all.
414
- - Before any individual existing file is actually overwritten, you're prompted per-file (with a
415
- quick `git status` hint - untracked vs. has uncommitted changes - when available) - declining
416
- skips just that file, the rest of the conversion continues.
417
- - Non-interactive runs (CI/scripts) can't prompt, so they proceed automatically - the decision is
418
- still printed to the log either way, it's just not blocking.
419
-
420
- Review the generated code before relying on it - self-correction only catches what `tsc` catches
421
- (type errors), not wrong business logic, and the file/project-kind detection is a best effort, not
422
- a guarantee.
423
-
424
- ## `aivin plugin search <query>`
425
-
426
- Searches the platform's plugin ecosystem before you write new logic - the same relevance-ranked
427
- lookup the platform's own agent uses to auto-select a plugin for a mission (`GET /plugins/search`).
428
- Doesn't need to be run from inside a plugin project.
429
-
430
- ```bash
431
- aivin plugin search "send a slack message"
432
- ```
433
-
434
- Options:
435
-
436
- ```
437
- Options:
438
- --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
439
- --mcp <server_id> List every tool/resource/prompt plugin generated from one MCP server, instead of a text search
440
- --store <store_id> Restrict to plugins hosted on one self-hosted plugin store (id from `aivin pluginstore ls`) - combines with the text query/--mcp
441
- --limit <n> Max results to show
442
- --plain Print a flat list instead of the interactive browser (for scripts/CI)
443
- ```
444
-
445
- In a real terminal, results open in an interactive browser: `↑`/`↓` to move between matches,
446
- `→`/`space`/`enter` to open a plugin's detail view (full description, version, input/output
447
- schema), `←`/`esc`/`backspace` to go back to the list, `q` to quit. Non-TTY contexts (scripts, CI,
448
- piped output) or `--plain` fall back to a flat printed list.
449
-
450
- Call one from your own plugin with `import { call } from '@aivin-labs/sdk'` then
451
- `await call('<plugin_id>', params)`.
452
-
453
- ## `aivin plugin info <id>`
454
-
455
- Detail view for **one already-known plugin id**, without going through `plugin search`'s free-text
456
- ranking first - useful when debugging a specific plugin you already have the id for (copied from
457
- `plugin search --mcp <server_id>`'s listing, from the platform, etc.).
458
-
459
- ```bash
460
- aivin plugin info modelcontextprotocol-servers-src-everything-read_file
461
- ```
462
-
463
- Options:
464
-
465
- ```
466
- Options:
467
- --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
468
- --plain Print flat instead of the interactive browser, if falling back to
469
- closest-match results
470
- ```
471
-
472
- There's no dedicated `GET /plugins/:id` on the backend, so this reuses `/plugins/search` with the
473
- id itself as the query and picks the exact `id` match out of the ranked results. If nothing matches
474
- exactly (typo'd id, or a plugin not visible to you), it prints "no exact match" and falls back to
475
- the same interactive browser over the closest results instead of failing outright.
476
-
477
- ## `aivin plugin ask [mission]`
478
-
479
- One-shot "just simulate the agent" mode: give it a plain-language mission and it does what a
480
- running agent actually does at execution time - searches the plugin ecosystem the same
481
- relevance-ranked way (`plugin search`'s lookup), picks the **top match**, and immediately triggers
482
- it with that same mission auto-mapped onto the input schema (`plugin trigger -a` under the hood).
483
- Where `plugin search` + `plugin trigger --id <id> -a "..."` is a manual two-step "pick, then run"
484
- flow, `ask` collapses both into a single command - no copying an id between them.
485
-
486
- ```bash
487
- aivin plugin ask "send a slack message to #eng saying the deploy is done"
488
- ```
489
-
490
- ```
491
- 🤖 Auto-selected: Slack Notify (87% match) (slack-notify-abc123)
492
- runner-up(s): Slack Post Message, Discord Notify
493
-
494
- 🚀 Triggering Slack Notify...
495
- ...
496
- ```
497
-
498
- Options:
499
-
500
- ```
501
- Options:
502
- --top <n> How many candidates to consider/print as runner-up context
503
- (default 5) - only the top match is ever run
504
- -i, --input <json> Force specific fields (as JSON) alongside the auto-mapped
505
- ones - explicit fields win
506
- --workspace <id> Workspace id to search/run against (default: auto-picks
507
- your first one)
508
- --agent <id> Agent id to run as, if the plugin needs one for
509
- HIL/confirm behavior to be accurate
510
- --watch-logs Also stream the chosen plugin's own live console output inline
511
- --no-auth-prompt Don't offer to connect/configure a missing connector
512
- interactively - just print the needs_auth result and exit
513
- --save Write this run's result to .test/trigger/<ts>.json
514
- --compare <file> Diff this run against a previously --save'd file
515
- ```
516
-
517
- If the auto-pick looks wrong, check the printed runner-up(s) and fall back to the manual flow -
518
- `aivin plugin search "<mission>"` to browse candidates yourself, then
519
- `aivin plugin trigger --id <chosen-id> -a "<mission>"` to run that specific one instead. `ask`
520
- throws (no plugin executed) if the search comes back empty, rather than guessing.
521
-
522
- ## `aivin plugin trigger [mission] [input]`
523
-
524
- Invokes an **already-deployed** plugin for real and prints the result - the same
525
- `POST /plugins/execute` the platform's own Playground ("Thử nghiệm" tab) uses, so it exercises the
526
- exact same code path a running agent would hit. Run it from the plugin's project directory -
527
- `manifest.json` supplies the plugin id (`--func <name>` picks the entry for a multi-function
528
- plugin) - or pass `--id` directly for a plugin with no local project directory (e.g. one built by
529
- `aivin mcp <url>`, which deploys straight from a scan and never writes a `manifest.json` anywhere).
530
-
531
- ```
532
- Options:
533
- -a, --auto <prompt> Natural-language prompt - the platform auto-maps it onto
534
- the input schema for you
535
- --id <pluginId> Plugin id to trigger directly - skips the local
536
- manifest.json lookup entirely
537
- --func <name> Which function to trigger, for a multi-function plugin
538
- (matches name/func/id) - ignored when --id is given
539
- --workspace <id> Workspace id to run against (default: auto-picks your
540
- first one)
541
- --agent <id> Agent id to run as, if the plugin needs one for
542
- HIL/confirm behavior to be accurate
543
- --watch-logs Also stream the plugin's own live console output inline
544
- (same feed as `aivin plugin logs`) - no second terminal
545
- needed. Requires permission to view that plugin's logs;
546
- most store plugins from other orgs just fall back to
547
- the REST result only.
548
- --no-auth-prompt Don't offer to connect/configure a missing connector
549
- interactively - just print the needs_auth result and exit
550
- --save Write this run's result to .test/trigger/<ts>.json
551
- --compare <file> Diff this run against a previously --save'd file
552
- ```
553
-
554
- ```bash
555
- # no local project directory - e.g. an MCP proxy plugin from `aivin mcp <url>`
556
- aivin plugin trigger --id my-mcp-plugin-id -a "search for open issues about login"
557
- ```
558
-
559
- **Direct mode** - `<mission>` (becomes `main()`'s `mission` argument) and `<input>` (a JSON string,
560
- becomes `main()`'s `input` argument) both required:
561
-
562
- ```bash
563
- aivin plugin trigger "summarize this" '{"text":"Aivin plugins are easy to write."}'
564
- ```
565
-
566
- **Auto mode** (`-a`/`--auto <prompt>`) - give it free text instead of structured JSON; the backend's
567
- own input-mapping (`mapDataToSchema`, the same mechanism the Playground's chat-style tester uses)
568
- maps it onto `manifest.json`'s `input` schema for you:
569
-
570
- ```bash
571
- aivin plugin trigger -a "Summarize this ticket: customer can't log in after the last update"
572
- ```
573
-
574
- `<input>` can still be given alongside `-a` for fields you want to force rather than let the AI
575
- infer - explicit values win over auto-mapped ones per field.
576
-
577
- What gets printed:
578
- - `--- Log ---` - the backend's own mapping/execution stage messages (`processing_log`), if any.
579
- This is **not** your plugin's own `console.log()` output from inside `main.ts` - it's everything
580
- the HTTP response itself carries, printed after the call completes.
581
- - `--- Auto-mapped input ---` - what `-a`'s prompt actually got mapped to (`mapped_arguments`),
582
- only present in auto mode.
583
- - `--- Result: <status> ---` - the plugin's real `status`/`message`/`error_code`/`data`.
584
- - `--- Compare ---` (only with `--compare <file>`) - status + data diffed against the saved run.
585
-
586
- Both the workspace lookup and the execute call have a client-side timeout (15s and 3 minutes) - a
587
- hung backend fails with a clear error instead of `trigger` sitting there forever. Override the
588
- execute one with `AIVIN_TRIGGER_TIMEOUT_MS` if you have a legitimately slow plugin.
589
-
590
- ### Watching your plugin's own console output inline: `--watch-logs`
591
-
592
- By default `trigger` only shows what's above - not the plugin's own `console.log()`/`sdk.log()`
593
- calls from inside `main.ts`. Pass `--watch-logs` to subscribe to that live, over the same channel
594
- `aivin plugin logs` uses, right before firing the call - one terminal instead of two:
595
-
596
- ```bash
597
- aivin plugin trigger --watch-logs "summarize this" '{"text":"..."}'
598
- ```
599
-
600
- This is permission-scoped server-side to plugins you can see the container logs for (your own or
601
- your org's deployments). Triggering a plugin from the public store that some other org owns will
602
- print `(--watch-logs: no live console output - ...)` and fall back to the REST result only - there's
603
- no way around that from the CLI, raw container stdout isn't something the platform exposes across
604
- org boundaries.
605
-
606
- ### Missing a connector? `trigger` sets it up for you, right there
607
-
608
- If the plugin needs a connector (OAuth account, or a plain credential form like SMTP
609
- host/user/pass) that isn't configured yet, `/plugins/execute` comes back `needs_auth` instead of
610
- running. In an interactive terminal, `trigger`/`ask` catch that and offer to fix it on the spot
611
- instead of just printing the failure and making you go set it up in the web app:
612
-
613
- - **OAuth connector** - asks "Open your browser to connect now?", then opens the same
614
- authorize-flow the web app's "Connect" button uses (falls back to printing the URL if it can't
615
- launch a browser), and polls in the background until you've finished. No timeout hunting - it
616
- waits up to 3 minutes, then retries the trigger automatically.
617
- - **Credential-form connector** (SMTP, or any custom `credential_form` connector registered via
618
- `aivin connector register`) - prompts for each declared field right in the terminal (masked for
619
- `secret` fields), saves it, then retries.
620
-
621
- Either way, you get exactly one automatic retry after setup - if it still needs auth after that
622
- (e.g. you declined, or the OAuth flow timed out), the `needs_auth` result just prints as-is. Pass
623
- `--no-auth-prompt` to skip all of this and always just print the result (useful for scripts/CI,
624
- where there's no one to answer the prompt anyway - it's also skipped automatically whenever stdin/
625
- stdout isn't a real TTY).
626
-
627
- ### Turning ad-hoc tries into a regression check: `--save` / `--compare`
628
-
629
- ```bash
630
- aivin plugin trigger "summarize this" '{"text":"..."}' --save
631
- # Saved: .test/trigger/2026-01-15T10-30-00-000Z.json
632
-
633
- # ...later, after changing the plugin (or re-testing the same store plugin)...
634
- aivin plugin trigger "summarize this" '{"text":"..."}' \
635
- --compare .test/trigger/2026-01-15T10-30-00-000Z.json
636
- ```
637
-
638
- Lighter-weight than `aivin test`'s full deploy+smoke-test+report flow - useful for a quick "did this
639
- still behave the same way" check on any plugin you can trigger, including ones you don't own.
640
-
641
- ## `aivin plugin logs [pluginId]`
642
-
643
- Tails an **already-deployed** plugin's own container stdout/stderr live - the same real-time feed
644
- the platform's own Playground log panel uses. `pluginId` defaults to the current directory's
645
- `manifest.json` id (`--func <name>` picks the entry for a multi-function plugin), so plain
646
- `aivin plugin logs` works from inside the plugin's own project directory; pass an explicit id to
647
- watch a plugin you're not standing inside.
648
-
649
- ```
650
- Options:
651
- --func <name> Which function's id to resolve, for a multi-function plugin
652
- (only used when pluginId is omitted)
653
- ```
654
-
655
- ```bash
656
- aivin plugin logs
657
- aivin plugin logs my-plugin-id
658
- ```
659
-
660
- Prints each line as it's written (`console.log` → gray, `console.error` → red), with a local
661
- timestamp. Runs until you press Ctrl+C. If the container restarts (redeploy/crash) mid-stream,
662
- the connection ends - re-run the command to resume watching.
663
-
664
- ## `aivin plugin delete [id]`
665
-
666
- Deletes a plugin you own - `DELETE /plugins/store/:pluginId` for a single one, or
667
- `--group <groupId>` for every plugin created by one batch deploy at once (`DELETE
668
- /plugins/group/:groupId`) - e.g. everything `aivin mcp <url>` generated in a single run, which
669
- prints its `group_id` right after deploying specifically so you can pass it here later. Neither can
670
- be undone.
671
-
672
- ```
673
- Options:
674
- --group <groupId> Delete every plugin sharing this group_id instead of a single plugin by id
675
- -y, --yes Skip the confirmation prompt (for scripts/CI)
676
- ```
677
-
678
- ```bash
679
- aivin plugin delete my-plugin-id
680
- aivin plugin delete --group 66f2a1... # everything from one `mcp <url>` run
681
- aivin plugin delete --group 66f2a1... --yes # skip the prompt, for scripts
682
- ```
683
-
684
- Single delete asks a plain yes/no confirmation. `--group` asks you to **type the group id back** to
685
- confirm (same pattern `aivin pluginstore rm` uses) since one typo'd id could otherwise delete many
686
- plugins at once. Both skip the prompt entirely with `-y`/`--yes`. Deleting is scoped to plugins you
687
- own server-side - a wrong/other org's id fails with "not found" rather than revealing whether it
688
- exists.
689
-
690
- ## `aivin connector`
691
-
692
- Connectors are reusable OAuth apps / credential-form namespaces, referenced from `manifest.json`'s
693
- `connection_id` field so multiple plugins can share one set of user-connected credentials instead
694
- of each prompting for the same login separately. Check for an existing one before registering a
695
- new namespace:
696
-
697
- ```bash
698
- aivin connector search "slack"
699
- aivin connector list
700
- ```
701
-
702
- ```
703
- Commands:
704
- register Register a new connector namespace, interactively
705
- search [options] [query] Search connectors for something to reuse instead of registering a new one
706
- list [options] List connectors visible to your org
707
- deprecate [id] Hide a connector you own from search/list without breaking plugins already using it
708
- undeprecate [id] Make a previously-deprecated connector you own discoverable again
709
-
710
- Options for search/list:
711
- --limit <n> Max results to show (search)
712
- --page <n> Page number (list)
713
- --include-deprecated Also show your org's deprecated connectors, hidden by default (list)
714
- --plain Print a flat list instead of the interactive browser - for scripts/CI (both)
715
- ```
716
-
717
- `aivin connector register` walks you through naming the namespace and picking the auth shape
718
- (OAuth vs. a plain credential form) interactively - there's no non-interactive/scripted form, since
719
- registering real OAuth app credentials isn't something to automate blindly. Once registered, put
720
- the connector's id in your plugin's `manifest.json` as `connection_id` - see
721
- [MANIFEST.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#fields) (sdk
722
- repo).
723
-
724
- `aivin connector deprecate`/`undeprecate` only affect discoverability (search/list) - they never
725
- break a plugin that's already using the connector's `connection_id`, so it's safe to deprecate one
726
- you've replaced without migrating existing plugins first.
727
-
728
- ## `aivin pluginstore`
729
-
730
- Manages a **self-hosted `aivin-service` worker** (a Docker container you run yourself) attached to
731
- your org as a *plugin store* - a piece of infrastructure your org's plugins can run against,
732
- independent from Aivin's own hosted infra. A store can have multiple *nodes* (multiple machines
733
- each running their own `aivin-service`, all attached to the same store) for redundancy/scale. This
734
- is unrelated to the **Plugin Marketplace** (`aivin mcp <url> --publish` and the browser
735
- CodeEditor's publish flow) - a plugin store is infrastructure you attach, not a place plugins get
736
- published to.
737
-
738
- ```
739
- Commands:
740
- create [options] [store_id] Create a new plugin store + attach this machine as its first node
741
- attach [options] [store_id] Attach this machine as another node of an existing plugin store
742
- ls List plugin stores visible to your org, with online/offline status per node
743
- enable [store_id] Enable a store for your org (org admin only)
744
- disable [store_id] Disable a store for your org without deleting it (org admin only)
745
- rm [options] [store_id] Delete a store - revokes EVERY node attached to it, not just this machine (org admin only)
746
- detach [options] Remove THIS machine's pairing only (local file only, no BE call)
747
- ```
748
-
749
- ```bash
750
- aivin pluginstore create my-store --label "Production store"
751
- aivin pluginstore ls
752
- ```
753
-
754
- `create`/`attach` both end by writing `worker-identity.json` into a data directory (default
755
- `~/.aivin/service-data`, override with `--data-dir`) - the machine's actually-running
756
- `aivin-service` process watches that directory (`fs.watch`) and pairs itself automatically the
757
- moment the file appears. Neither command needs `aivin-service` to already be running, and neither
758
- restarts any container - the CLI's job ends at writing the file; pairing itself is the worker's own
759
- responsibility.
760
-
761
- ```
762
- Options (create):
763
- --label <label> Display label for the store (defaults to store_id)
764
- --node-label <label> Display label for this node/instance
765
- --data-dir <path> Where to write worker-identity.json (default: ~/.aivin/service-data)
766
-
767
- Options (attach):
768
- --node-label <label> Display label for this node/instance
769
- --data-dir <path> Where worker-identity.json is written (default: ~/.aivin/service-data)
770
- ```
771
-
772
- `aivin pluginstore detach` is the local-only inverse of `attach`/`create`: it deletes
773
- `worker-identity.json` from this machine (`--data-dir` to point at a non-default location) without
774
- calling the backend at all - the running `aivin-service` notices the file is gone and un-pairs on
775
- its own. To actually revoke a node/store server-side (so it can't reattach with an old token), use
776
- `aivin pluginstore rm` instead - **org admin only**, and destructive: it revokes every node attached
777
- to the store, not just this machine, hence the `-y`/`--yes` flag to skip the confirmation prompt in
778
- scripts.
779
-
780
- `enable`/`disable` don't delete anything - they just toggle whether your org's plugins are allowed
781
- to route to the store right now, so you can pull a store out of rotation (e.g. for maintenance)
782
- without losing its configuration or having to re-attach nodes afterward.
783
-
784
- ## `aivin mcp <url> [--publish|--private|--org]`
785
-
786
- The one-shot path from "here's an [MCP](https://modelcontextprotocol.io) server" to deployed
787
- plugin(s) - unlike `aivin mcp create` below (which scaffolds exactly 1 tool/resource/prompt you
788
- already know the transport/command/name for), this scans a whole server and converts everything it
789
- finds, interactively:
790
-
791
- 1. **Scan** (`POST /plugins/scan-mcp`) - `<url>` can be a GitHub/GitLab repo, an npm/Smithery
792
- package, or a live MCP server URL. Reads the repo/README or handshakes the live server directly.
793
- Only scan URLs you actually trust - this step connects to (and, for a live handshake, effectively
794
- runs) whatever's at that address to introspect it, same trust model as installing a dependency
795
- from source. Bounded to 60s (scanning a live server can legitimately take longer than the other
796
- steps, which is why this one gets more headroom) so an unresponsive server fails with a clear
797
- error instead of hanging the CLI indefinitely. The scan response also carries a deterministic
798
- `repo_id` (derived from the source URL, same convention the backend uses for every discovery
799
- path so the same server always converges on one id) - right after a successful scan, this is
800
- used as an exact `plugin search --mcp <repo_id>` lookup, so anything printed here really is from
801
- this exact server, not a fuzzy text guess. Still informational only - never blocks the flow.
802
- 2. **Select** - checkbox prompt lists every tool/resource/prompt found (all checked by default);
803
- space to toggle, enter to continue with only what you actually want as plugins.
804
- 3. **Build manifests** (`POST /plugins/build-mcp-manifests`, 30s timeout) - one `PluginManifest` per
805
- selected item, generated server-side (not typed by hand like `aivin mcp create` requires).
806
- 4. **Edit** (optional) - confirm prompt offers to rename/redescribe any of the generated plugins
807
- before anything is deployed. A second, separate optional prompt offers to attach one connector
808
- (existing or newly registered) as every generated manifest's `connection_id` in one go - see
809
- [`aivin mcp create`](#aivin-mcp-create-name)'s connector section above for what that buys you.
810
- 5. **Confirm** - since the checkbox in step 2 defaults to everything checked, this step asks for an
811
- explicit yes ("Deploy N plugin(s) to your org? This can't be undone from the CLI.", default
812
- **No**) before anything actually goes out. In a non-TTY context (scripts/CI) this step is skipped
813
- entirely - the same as everywhere else in the CLI, only a real terminal gets a confirmation prompt.
814
- 6. **Deploy** (`POST /plugins/deploy`, 60s timeout) - always org-scoped first, regardless of the
815
- visibility flag below (there's no narrower per-workspace scope for plugins today). Prints a
816
- `group_id` afterward - save it if you might want to remove everything from this run later in one
817
- shot with [`aivin plugin delete --group <groupId>`](#aivin-plugin-delete-id).
818
- 7. **Publish** (only with `--publish`, 30s timeout per submission) - submits each deployed plugin for
819
- community review (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against
820
- the real MCP server before it reaches the review queue, not just whatever got deployed (see the
821
- backend's own `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full
822
- gate). A submission can't be withdrawn from this CLI either once sent.
823
-
824
- **Blocked, not just warned**: a manifest whose `proxy_config.auth_secret_key` is set is skipped
825
- entirely at this step (never submitted) instead of being sent as-is. `auth_secret_key` is an
826
- admin-level credential meant to be shared by everyone *within the org that deployed it* -
827
- publishing means other orgs can call this same plugin, and there is no confirmed backend step
828
- that strips or reissues that credential per installing org, so submitting it unchanged would let
829
- another org's calls silently resolve to (and spend/exhaust/expose) your org's credential. Rebuild
830
- the plugin with a connector-bound environment variable instead (`aivin mcp create`'s interactive
831
- auth setup, "one or more environment variables" → bind to a connector) - that path resolves
832
- credentials per the *calling* org/user, not off the shared manifest, and is safe to publish.
833
- 8. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
834
- every plugin deployed, and offers to run one right now, interactively - see
835
- [`aivin test`](#aivin-test) above for why this exists (its automated smoke test skips proxy
836
- plugins entirely, so this interactive step is currently the *only* built-in way to verify a
837
- freshly-converted MCP plugin actually works before walking away from the terminal).
838
-
839
- ```
840
- Options:
841
- --publish Deploy to your org, then submit for community store review
842
- (needs admin approval)
843
- --private Deploy to your org only - default
844
- --org Alias of --private - there is no narrower per-workspace scope today
845
- ```
846
-
847
- ```bash
848
- aivin mcp https://github.com/example-org/example-mcp-server
849
- aivin mcp https://github.com/example-org/example-mcp-server --publish
850
- ```
851
-
852
- ## `aivin mcp create <name>`
853
-
854
- Scaffolds a **manifest-only** plugin (`proxy_config.type: "mcp"`) that proxies straight to an
855
- external [MCP](https://modelcontextprotocol.io) server's tool/resource/prompt - no `src/main.ts`,
856
- no `package.json`, nothing to run. `aivin deploy`/`aivin test` detect this automatically.
857
-
858
- ```
859
- Options:
860
- --transport <transport> stdio | sse
861
- --command <command> Command to launch the MCP server (stdio transport)
862
- --args <args> Space-separated args for --command (stdio transport)
863
- --url <url> Remote MCP server URL (sse transport)
864
- --kind <kind> tool | resource | prompt (default: tool)
865
- --tool-name <name> MCP tool name (kind=tool)
866
- --resource-uri <uri> MCP resource URI (kind=resource)
867
- --resource-mime-type <mime> MIME type of the resource (kind=resource)
868
- --prompt-name <name> MCP prompt name (kind=prompt)
869
- --description <description> Plugin description
870
- --auth-secret-key <key> Name of the workspace secret to use as the
871
- token/credential, if the MCP server needs auth
872
- --auth-type <type> auth_type value to send (default: "bearer" when
873
- --auth-secret-key is set) - check your backend
874
- for which values it supports
875
- --connector <id> Existing connector id for this plugin's connection_id
876
- (readiness/"needs login" display only - see below)
877
- ```
878
-
879
- - Fully interactive → run with no flags at all: prompts for everything, in order.
880
- - Fully flagged → fully non-interactive/scriptable, no prompts. `--transport` and `--kind` are
881
- inferred from whichever flags you pass (`--command` implies stdio, `--url` implies sse;
882
- `--tool-name`/`--resource-uri`/`--prompt-name` each imply their own `--kind`) - spell them out
883
- explicitly only if you're scripting this without any of those (unusual).
884
- - **Partially flagged, real terminal** → prompts for exactly what's still missing, not everything -
885
- e.g. `aivin mcp create foo --transport stdio` alone still prompts for `--command` instead of
886
- failing with a generic validation error.
887
- - Passing more than one kind-identifying flag at once (e.g. both `--tool-name` and
888
- `--resource-uri`) without an explicit `--kind` prints a warning and picks one by priority
889
- (tool → resource → prompt) rather than silently dropping the other with no explanation.
890
- - Whatever's still missing once prompting is done (or immediately, outside a real terminal) fails
891
- fast with the exact flag(s) needed, e.g. `Missing required field(s): --command <command>,
892
- --tool-name <name>`.
893
-
894
- ```bash
895
- # stdio (local command)
896
- aivin mcp create fs-tools --command npx --args "-y @modelcontextprotocol/server-filesystem /data" \
897
- --tool-name read_file --description "Read files via MCP"
898
-
899
- # sse (remote server)
900
- aivin mcp create doc-search --url https://example.com/mcp \
901
- --tool-name search_docs --description "Search external docs via MCP"
902
- ```
903
-
904
- See [MANIFEST.md#mcp-proxy-plugins](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#mcp-proxy-plugins) for the full `proxy_config`
905
- field reference.
906
-
907
- **Auth for a `mcp create` plugin, interactively**: leave `--auth-secret-key` off in a real terminal
908
- and you're asked "Does this MCP server need auth?" with three choices:
909
-
910
- - **No auth needed.**
911
- - **One shared token for everyone** (typical for a remote/sse server) - the classic bearer-token
912
- case, sent as `proxy_config.auth_secret_key`/`auth_type`. One value, shared by the whole org.
913
- - **One or more environment variables** (typical for a local/stdio server) - drops into a loop
914
- ("Variable 1 name:", Enter on blank to stop) where each declared name is either left for **every
915
- workspace to configure on its own** later (no OAuth - the platform's own "configure this plugin"
916
- screen collects the value per workspace) or bound to a **connector** (search-as-you-type over
917
- `aivin connector search`'s same endpoint, list your org's if the query is left blank, or register
918
- a brand new one right there - same flow as `aivin connector register`, no separate command
919
- needed) for automatic per-user/per-workspace OAuth resolution.
920
-
921
- This maps onto `manifest.initable`/`manifest.initial[varName].connection_id` - the fields the
922
- backend's plugin execution path (`PluginProxyService.resolveMcpEnv`) actually reads to merge
923
- credentials at call time, in increasing priority: the shared `auth_secret_key` first, then each
924
- workspace's own configured value, then OAuth auto-fill for any field bound to a connector. This is
925
- genuinely three tiers merged per call, not three alternatives to choose between - declaring some
926
- fields as connector-bound and others as "workspace configures it" on the very same plugin is normal
927
- if the MCP server needs more than one kind of credential.
928
-
929
- Only declarable interactively - like `aivin connector register`, there's no non-interactive/scripted
930
- form for the env-var loop (declaring several named fields isn't something to automate blindly).
931
-
932
- **What `--connector <id>` actually does (and doesn't)**: it sets the manifest's top-level
933
- `connection_id` directly, without going through the loop above. That field only drives the
934
- "requires logging in to a connector" readiness badge (see `plugin info`/`plugin search`'s detail
935
- view) - it is **not** read by the MCP execution path at all, so it injects nothing into the running
936
- MCP server by itself. If you use the interactive env-var loop and bind a field to a connector, the
937
- top-level `connection_id` gets set *for* you automatically (derived from whichever connector the
938
- declared field(s) actually use), for consistency with that badge - you shouldn't normally need
939
- `--connector` directly unless you're deliberately setting the readiness badge independently of any
940
- declared env var.
941
-
942
- `aivin mcp <url>` (below) offers a simpler, single-connector version of this same idea - one prompt
943
- to attach a connector to every generated manifest at once, right before the final deploy
944
- confirmation, for when a whole MCP server shares one auth scheme rather than needing individual
945
- per-tool env-var declarations.
946
-
947
- ## `aivin login`
948
-
949
- Saves an API key **once, machine-wide**, to `~/.aivin/credentials` - not the current project's
950
- `.env`. Logging in is a per-machine thing, not a per-project one, so you only need to run this once
951
- regardless of how many plugin projects you work in - every project's `deploy`/`test`/`plugin make`
952
- picks it up automatically.
953
-
954
- ```
955
- Options:
956
- -k, --api-key <key> Set API key directly (skip login entirely)
957
- --basic Log in with email/password directly in the terminal instead of a browser
958
- --google Alias of the default browser flow - pick Google once the page opens
959
- --client <client> Client/org id to use with --basic (default: "aivin.cloud")
960
- ```
961
-
962
- **Default (no flags) - browser flow, recommended:**
963
-
964
- ```bash
965
- aivin login
966
- ```
967
-
968
- Opens your default browser to the platform's actual login page (`https://brain.aivin.cloud`) with
969
- a one-time state token and a `localhost` callback URL. Log in exactly the way you normally would in the
970
- browser - custom-domain org, password, Google, OTP, whatever applies to your account. Once you
971
- confirm on the "Aivin CLI wants to create an API Key" prompt that appears after login, a fresh key
972
- is minted (named after this machine's hostname, replacing any previous key with that same name) and
973
- handed back to a tiny local HTTP server the CLI started for this one request, then saved to
974
- `~/.aivin/credentials`. The browser tab never shows you the raw key - only the CLI does.
975
-
976
- `--google` doesn't change anything technically; it's just documentation that once the page opens
977
- you can pick "Log in with Google" there, same as any other login on that page.
978
-
979
- **`--basic` - no browser, terminal-only:**
980
-
981
- ```bash
982
- aivin login --basic
983
- ```
984
-
985
- Prompts for email/password directly and logs in against the default/shared client only (`--client`,
986
- falls back to `"aivin.cloud"`). If your account belongs to a custom-domain organization, this won't
987
- resolve that domain for you - use the default browser flow instead, which handles it the same way
988
- the web login page does.
989
-
990
- **Already have a key:**
991
-
992
- ```bash
993
- aivin login --api-key <key>
994
- ```
995
-
996
- Skips login entirely - just saves the given key to `~/.aivin/credentials`.
997
-
998
- ## `aivin whoami`
999
-
1000
- Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1001
- off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1002
- (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1003
- something).
1004
-
1005
- ```bash
1006
- aivin whoami
1007
- ```
1008
-
1009
- ```
1010
- ✅ Logged in
1011
- Email: jane@example.com
1012
- Name: Jane Doe
1013
- Org: Acme Inc
1014
- Server: https://api.aivin.cloud
1015
- Logged in at: 1/15/2026, 10:30:00 AM
1016
- ```
1017
-
1018
- Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1019
- `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1020
- once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1021
- with a different key, `whoami` says so explicitly instead of guessing:
1022
-
1023
- ```
1024
- (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1025
- ```
1026
-
1027
- ## `aivin key`
1028
-
1029
- Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1030
- saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1031
- revoke independently later.
1032
-
1033
- ```
1034
- Commands:
1035
- gen [options] <name> Create (or replace) a named API key for your account - shown only once
1036
- revoke [options] <name> Revoke a named API key for your account
1037
- list [options] List API keys on your account
1038
- ```
1039
-
1040
- ```bash
1041
- aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1042
- aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1043
- aivin key list # see what's on your account
1044
- aivin key revoke "ci-pipeline" # revoke it by name
1045
- ```
1046
-
1047
- All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1048
- `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1049
- a step-up check, since minting a new key from an existing one is the one action here that could
1050
- otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1051
- `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1052
-
1053
- `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1054
- re-running `aivin login` replaces this machine's own key.
1055
-
1056
- ## `aivin browser [mission]`
1057
-
1058
- Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1059
- (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1060
-
1061
- ```
1062
- Options:
1063
- --remote Use a server-side pooled browser instead of your own local one (no
1064
- local browser needed, no cookies/logins carried over)
1065
- --debug-port <port> Local mode only: port to launch the AI Browser window's remote
1066
- debugging on (default: 9222, auto-tries a few nearby ports if that
1067
- one is taken by something else)
1068
- --browser <edge|chrome|brave|chromium>
1069
- Local mode only: which browser to drive - default: auto-detects your
1070
- OS's actual default browser, falling back to whichever of
1071
- Edge/Chrome/Brave/Chromium is installed
1072
- --separate-browser Local mode only: always use the dedicated AI Browser window, never
1073
- your everyday browser
1074
- --url <url> Local mode only: open this URL before the mission starts, instead of a
1075
- blank page (auto-guessed for a few well-known sites mentioned by name
1076
- in the mission if omitted)
1077
- --workspace <id> Workspace id to run in (default: your personal workspace)
1078
- --project <id> Project id within the workspace (--remote only)
1079
- --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1080
- mode, or the workspace's default agent for --remote)
1081
- --no-watch Fire the mission and return immediately - skip streaming live
1082
- progress and auto-opening the viewer
1083
- --view Just (re)open the fullscreen interactive viewer for whatever HIL
1084
- session is already active - no mission is started
1085
- ```
1086
-
1087
- **Local mode (default)** - drives a browser on your own computer via its remote-debugging protocol
1088
- (CDP), through the same guarded tunnel `aivin remote` uses. Which browser, in order:
1089
-
1090
- 1. **Your everyday Chrome/Edge**, if you've switched on remote debugging in it yourself
1091
- (`chrome://inspect/#remote-debugging`, or `edge://inspect/#remote-debugging`; Chrome 144+). The
1092
- browser asks you to **Allow** the connection once. Every login you already have works. The AI
1093
- opens its own tabs in the background, and your own tabs stay read-only to it. `--separate-browser`
1094
- skips this step.
1095
- 2. **Otherwise, a dedicated AI Browser window**, on its own profile (`~/.aivin/browser-profile`),
1096
- not your regular one. Cookies and logins persist there across runs. The first time you use a
1097
- site, you log in once, same as in a fresh browser. The CLI opens this window itself, and
1098
- reuses it while it's open. A Chrome/Edge window on any other profile is never attached to, even
1099
- if it has a debug port open.
1100
-
1101
- Either way, every command the server sends is filtered. No `file://` or browser-internal pages, no
1102
- picking files from your disk, and no loading extensions. Downloads always go to `~/Downloads/Aivin`,
1103
- and executables are cancelled as soon as they start downloading.
1104
-
1105
- In the AI Browser window, the tabs a mission opens (and the popups they open) are put in one
1106
- **tab group** named after the mission, with a different color per mission running at the same time.
1107
- Tab groups have no CDP command, so the CLI loads a small extension of its own into that profile
1108
- (`~/.aivin/browser-extension/tab-groups`, permissions `tabGroups` + `debugger`). The server can't
1109
- reach it. A window opened by an older CLI version doesn't have this - close it and rerun. Your
1110
- everyday browser's tabs are not grouped, because the CLI never installs anything into your own
1111
- profile.
1112
-
1113
- If the AI Browser window can't be started, `aivin browser` prints the exact launch command for your
1114
- OS/browser instead of failing silently:
1115
-
1116
- ```bash
1117
- aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1118
- ```
1119
-
1120
- A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1121
- as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1122
-
1123
- **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1124
- required, no cookies from your machine carried over. Useful for CI, headless environments, or
1125
- missions that don't need a logged-in session on a specific real account.
1126
-
1127
- ```bash
1128
- aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1129
- ```
1130
-
1131
- `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1132
- is already active, without starting anything new - handy if you closed the auto-opened window by
1133
- accident.
1134
-
1135
- ## `aivin remote` — let your agents work on this computer (Device Agent)
1136
-
1137
- Turns this computer into a device your Aivin agents can hand jobs to (`official.device_agent`): run commands, read/search/edit
1138
- files, inspect projects and the system — only inside the folder you allow.
1139
-
1140
- ```bash
1141
- aivin remote start --dir D:\code # first run pairs this computer (device token), then listens for work
1142
- aivin remote do "run the tests of the be project and summarize failures"
1143
- aivin remote devices # your paired computers + online state
1144
- aivin remote pause | resume # local kill switch - refuses every remote call while paused
1145
- aivin remote unpair [deviceId] # revoke (token stops working immediately)
1146
- aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
1147
- aivin remote meeting start "Weekly sales" --then "summarize and draft an email to my manager" # meeting notes (Windows)
1148
- aivin remote meeting stop | status | list | show [id]
1149
- aivin remote status | test | logs | reindex | enable | disable | reset-id
1150
- ```
1151
-
1152
- - **Device token, not your API key**: pairing (`POST /plugins/device-agent/devices/pair`) gives this machine its own token
1153
- (`~/.aivin/device-credentials.json`, the server only keeps a hash). Revoking a device never touches your API key.
1154
- - **Tools per device**: discovered from what is installed (git, ripgrep, node, python, docker…) — `aivin remote status` lists them.
1155
- - **Permissions come from the agent's own rules** (autonomous decisions / needs approval / must not): every step that changes
1156
- something goes through the platform policy gate and may ask you to approve. This computer keeps a hard floor the server cannot
1157
- change: allowed folder (checked with realpath, symlinks can't escape), secrets stripped from command environments, a safety net
1158
- against system-destroying commands, and the kill switch.
1159
- - **Memory stays on this computer**: `~/.aivin/memory/<kind>.yaml` (edit by hand if you like) + `vectors.json`; the agent recalls it
1160
- before planning and saves procedures that worked.
1161
- - Env: `AIVIN_REMOTE_HOME` (config folder), `AIVIN_REMOTE_LIMIT_<GROUP>` (parallel limit per tool group: fs_read, fs_write, exec, git, system, memory).
1162
- - **Stays up to date by itself**: the listener checks for a new release about every 6 hours (and right away when the Aivin server
1163
- asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
1164
- computer has had no remote work for 10 minutes; in a window you started yourself it only tells you to restart. If the new release
1165
- crashes 3 times before it has run for 10 minutes, the previous release is put back and the bad one is skipped - by the auto-start
1166
- script itself (Windows: the Aivin tray app, or the VBS script on older setups; macOS / Linux `~/.aivin/aivin-remote-run.sh`) when it crashes right at start, otherwise by aivin on the
1167
- next start. Auto-start set up by an older aivin lacks the first part: run `aivin remote enable` again to get it. See `aivin update`.
1168
- - The Aivin server can only *suggest* versions (a minimum version, the latest published one, releases on hold) - it can never choose
1169
- where aivin downloads from or what it installs. If the download site reports an older release than the server knows about, aivin
1170
- warns once that the site may be blocked; a release on hold (e.g. because several computers had to roll back from it) is not
1171
- installed by the background updater (`aivin update --to` still can).
1172
- - **Aivin mascot on screen** (Windows): while the listener runs, a small Aivin bot floats over your windows. Its speech bubble shows
1173
- the main thing the agent is doing on this computer; drag it anywhere (the spot is remembered). Hover it to **ask Aivin**: a small
1174
- box pops up above it (and slips away when the mouse leaves, unless you are typing, talking or waiting for an answer); click the
1175
- bot or the box to type (Enter) - it becomes a real chat on Aivin (also listed in your chats on the web), with the progress and the
1176
- answer shown in the box. The window you were using right before you reached for the bot (or pressed the mic hotkey) goes along
1177
- with the question, so "what's wrong here?" or "fill this in" means that window: the agent can read it (`gui.observe`) or take a
1178
- screenshot (`screen.capture`); it only looks when the question needs it. Or click the mic to **talk with Aivin live**, like the mic on the web: it listens all the time, answers
1179
- out loud and both sides show up as text in the box; click the mic while it talks to interrupt, while it listens to end. Its voice
1180
- is not picked up by the mic (your words are ignored while it talks), so interrupt with the button. Right-click it for the detailed activity log and a "Pause AI" button (the same kill switch
1181
- as `aivin remote pause`). The activity panel also has **Turn mascot off**: the mascot fades and slides away before its window closes,
1182
- while the listener keeps running in the background. Run `aivin ui` to bring it back immediately, or use `aivin remote mascot on` and
1183
- restart the listener. Apart from the open ask box it never takes keyboard focus; it is left out of screenshots and screen sharing,
1184
- and steps aside while the agent controls an app window. `aivin remote mascot off` turns it off persistently; `aivin remote start --no-mascot`
1185
- hides it for one run. Texts follow `AIVIN_LANG` / the system language. See the dedicated [Aivin mascot guide](AIVIN_MASCOT.md)
1186
- for interaction, state, shortcut, privacy and troubleshooting details.
1187
- - **Meeting notes** (Windows): ask the mascot something like "take notes of this meeting, then send my manager a summary". You can also
1188
- run `aivin remote meeting start "<title>" --then "..."` yourself.
1189
- - **What's recorded:** the computer's own sound (what the others say) and your microphone, plus a screenshot whenever the screen
1190
- changes (shared slides). This works with any meeting app (Google Meet, Zoom, Teams, Zalo...), and nobody joins the meeting on
1191
- your behalf.
1192
- - **Approval:** the agent can't start a recording on its own. Starting one always needs a click on **Allow** on this computer, and
1193
- you get a notification while it runs. Tell the other participants that they are being recorded.
1194
- - **When it stops:** when the meeting window closes and the computer goes quiet, after 10 minutes of silence, after 3 hours, on
1195
- `aivin remote meeting stop`, or when you press Pause.
1196
- - **The transcript:** it is made only after the meeting is over, by sending ~30 s pieces through Aivin's voice-to-text.
1197
- Then the audio files are deleted. If you gave an instruction ("then"), a new chat turn starts by itself with it. The
1198
- agent reads the transcript with `meeting.transcript`, writes the summary and drafts the email. Sending still asks you on this
1199
- computer first.
1200
- - **Where it's stored:** `~/.aivin/meetings/<id>/`, which the file tools can't read. If you name a `save_dir` in the allowed area,
1201
- it's stored there instead, so the files can be attached to an email.
1202
- - **Restarts:** if the listener restarts mid-meeting, the transcript is finished on the next start, and background updates wait
1203
- until the meeting is done. `--no-meetings` (or `AIVIN_REMOTE_MEETINGS=0`) turns it off.
1204
- - **Speaker labels:** each line of the transcript is labelled **Me** (your microphone) or **Others** (the computer's sound). Pieces
1205
- are cut where the talking switches between the two. The other participants are not told apart from each other.
1206
- - **Screenshots on request:** the agent can also take a screenshot of the whole screen (`screen.capture`). The mascot is never in it.
1207
- - **Clipboard**: the agent can read what you copied (`clipboard.read`) and put text on the clipboard for you to paste
1208
- (`clipboard.write`). On Windows it can also read images and files copied in Explorer; on macOS (`pbpaste`) and Linux (`wl-paste`,
1209
- `xclip` or `xsel`) only text. Anything a password manager marks private when copying (KeePass, 1Password, Bitwarden…) is never
1210
- read. Windows' own clipboard history skips the same content.
1211
- - **Controlling app windows** (Windows): when a job has no file, command or app API to go through (an accounting or ERP app, a
1212
- settings dialog, Save As), the agent can read and use app windows like you do.
1213
- - **How it sees:** it reads the window's accessibility tree, the same list of buttons, fields and menus that screen readers use
1214
- (`gui.observe`, `gui.find` for big windows). When an app draws its own interface and the tree is nearly empty, it takes a
1215
- screenshot and reads the text on it with Windows' built-in OCR, on this computer. Install the Vietnamese OCR language pack
1216
- (Settings → Time & language → Language & region → Vietnamese) for Vietnamese text.
1217
- - **How it acts:** clicks, fills fields, ticks boxes, picks list items, scrolls, presses shortcuts (`gui.act`), opens installed apps
1218
- or documents in the allowed folders (`gui.open_app`), and waits for a dialog or button to appear (`gui.wait_for`). It uses the
1219
- app's accessibility actions first, so most steps work while the window stays behind yours. Only when an app needs the real
1220
- mouse or keyboard does it bring the window to the front. Windows it opens are sent behind yours.
1221
- - **You stay in control:** touch the mouse or keyboard and the agent stops before its next real mouse/keyboard step and asks you.
1222
- The first time it controls a window (then at most every 5 minutes) you get a notification. `aivin remote pause` or the mascot's
1223
- "Pause AI" stops everything.
1224
- - **What it never does:** type into password fields, control password managers, UAC prompts, the lock screen or Windows Security,
1225
- or open programs and scripts by path. Unless the computer was started with `--full-access`, it also leaves terminals,
1226
- Registry Editor, Task Manager, code editors (VS Code, Cursor, JetBrains…) and agent apps (Claude, ChatGPT…) alone, because
1227
- typing commands there would get around the allowed folders.
1228
- - **When it asks first:** paying, deleting for good, signing out, or pressing Send / Post when you did not ask for it to be sent.
1229
- Other clicks don't ask, unless the agent's own rules say so.
1230
- - Excel, Word and Outlook go through the apps directly (`office.*`), without clicking. `--no-gui` turns window control off.
1231
-
1232
- ## `aivin ui`
1233
-
1234
- Shows the Aivin mascot with its ask box open, ready to type (Windows). If the listener (`aivin remote start`) is not running it is
1235
- started in the background - through the Aivin tray app when it is installed (`aivin desktop install`), else the older "Aivin Remote"
1236
- scheduled task, otherwise as a detached process. A computer that is not connected yet gets the pairing instructions.
1237
-
1238
- Preview all eight mascot animations locally without pairing or starting the listener:
1239
-
1240
- ```bash
1241
- aivin ui --demo
1242
- ```
1243
-
1244
- Current live-interface capture showing chat, file drag and attached files: [media/aivin-mascot-live.gif](media/aivin-mascot-live.gif)
1245
-
1246
- ## `aivin desktop`
1247
-
1248
- Puts Aivin on the desktop like a regular app: an icon you can click, an entry the system search finds, and a start-with-the-computer
1249
- setting you can change in the system's own settings. The installers (`install.ps1`, `install.sh`) run `aivin desktop install` for you
1250
- (on Linux only when there is a graphical session; `AIVIN_NO_DESKTOP=1` skips it, `AIVIN_NO_AUTOSTART=1` installs without starting with
1251
- the computer).
1252
-
1253
- ```bash
1254
- aivin desktop install # app + search entry + start with the computer (on by default)
1255
- aivin desktop install --no-autostart # same, without starting with the computer
1256
- aivin desktop uninstall # closes the app (and the listener it runs), removes all of it - `aivin` itself stays
1257
- aivin desktop # status
1258
- ```
1259
-
1260
- | | Windows | macOS | Linux |
1261
- |---|---|---|---|
1262
- | Icon | system tray (`%LOCALAPPDATA%\Aivin\Aivin.exe`) | menu bar (`~/Applications/Aivin.app`) | system tray (needs python3 + AppIndicator) |
1263
- | Found by | Start menu | Spotlight / Launchpad | app menu (`~/.local/share/applications/aivin.desktop`) |
1264
- | Start with the computer | Task Manager → Startup apps | System Settings → General → Login Items | Startup Applications (GNOME) / Autostart (KDE) |
1265
-
1266
- - **The icon** is in colour while Aivin is taking work, grey when paused, stopped or not connected. Its menu: connect this computer
1267
- (asks for the code from Aivin), pause / resume work (the kill switch), start with the computer, quit
1268
- (which also stops the listener). On Windows, clicking the icon opens the mascot and its ask box.
1269
- - **Keeps the listener running**: the app runs `aivin remote start --quiet` hidden. It restarts it when it crashes (after 10 s, then
1270
- longer, up to 5 minutes), switches to a newly installed release right away (exit code 75), and puts the previous release back when a
1271
- new one keeps crashing at start. If you run `aivin remote start` yourself in a terminal, the app leaves it alone and takes over again
1272
- once you close that window. Opening Aivin from the search again while it runs just opens it.
1273
- - **Start with the computer** is one setting, whichever way you change it: the app's menu, `aivin remote enable` / `disable`, or the
1274
- system settings in the table. `aivin remote disable` only switches it off, so it stays listed and can be switched back on there.
1275
- - Windows: an `Aivin` value under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, listed as "AIVIN Bot" (publisher Aivin Labs); the Start menu entry has the same name.
1276
- `Aivin.exe` is compiled on your computer by the C# compiler that comes with Windows (.NET Framework), so nothing is downloaded.
1277
- If that compiler is blocked, `aivin remote enable` falls back to the "Aivin Remote" scheduled task (not shown in Task Manager).
1278
- - macOS: the LaunchAgent `~/Library/LaunchAgents/com.aivin.remote.plist` opens `Aivin.app`, so Login Items lists it as "Aivin". If
1279
- you switch it off in Login Items, Aivin's own menu may still show it as on (macOS does not let apps read that switch).
1280
- - Linux: `~/.config/autostart/aivin.desktop` (switched off = `Hidden=true` / `X-GNOME-Autostart-enabled=false`). Without a graphical
1281
- session (servers, SSH), `aivin remote enable` keeps using the systemd user service as before.
1282
- - **Linux without a tray icon**: GNOME shows tray icons only with the AppIndicator extension (Ubuntu has it). Without python3's
1283
- AppIndicator binding (`sudo apt install gir1.2-ayatanaappindicator3-0.1` on Ubuntu / Debian), Aivin still runs in the background,
1284
- just without an icon - connect it with `aivin remote start --code <code>` once.
1285
- - Running `aivin remote enable` again replaces the scheduled task, Startup-folder script or older LaunchAgent / autostart entry made by
1286
- older aivin versions.
1287
- - **Open with AIVIN Bot** (Windows): install also adds "Open with AIVIN Bot" to the right-click menu (Windows 11: "Show more options")
1288
- and to "Open with" for `docx doc odt rtf xlsx xls xlsm ods csv pptx ppt odp pdf md txt` - see [`aivin open`](#aivin-open-files). Only
1289
- `HKCU\Software` is written (no admin). Windows doesn't let apps make themselves the default, so to open those files with a double-click
1290
- either pick Open with → AIVIN Bot → "Always", or run `aivin desktop defaults` to go straight to AIVIN Bot's page in Settings → Default
1291
- apps. For a whole company, `aivin desktop defaults --export-xml <file> [--all]` writes a file IT can push with the Group Policy "Set a
1292
- default associations configuration file" or Intune (`md txt csv` by default, `--all` adds Office formats). Installed before this
1293
- version? Run `aivin desktop install` again.
1294
-
1295
- ## `aivin open <files...>`
1296
-
1297
- Opens files from this computer in your Aivin Drive: uploads each file to your personal workspace (or `--workspace <id>`) and opens it
1298
- in the Aivin editor in your browser. The Drive copy is the one you work on from then on:
1299
-
1300
- - the **same content** opened again reopens the same Drive file (with whatever you changed there) - matched by sha256 in
1301
- `~/.aivin/opened-files.json`;
1302
- - a file that **changed on this computer** is uploaded as a new Drive file - the earlier Drive copy is never overwritten.
1303
-
1304
- ```bash
1305
- aivin open contract.docx report.pdf
1306
- aivin open budget.xlsx --workspace <id>
1307
- aivin open notes.md --tab # a normal browser tab instead of its own window
1308
- aivin open notes.md --print # print the Drive link instead of opening anything
1309
- ```
1310
-
1311
- Files open in their own window (no address bar or tabs) when your default browser is Chromium-based (Edge, Chrome, Brave), since that is
1312
- where your Aivin sign-in lives. With any other default browser they open in a normal tab.
1313
-
1314
- **Not signed in (or the saved key was revoked): view only.** Nothing is uploaded to your Drive. `aivin open` serves a read-only page from
1315
- this computer (`127.0.0.1`, random path) and keeps running until you close that window:
1316
-
1317
- - `.pdf`, `.md`, `.txt`, `.csv` are shown straight from this computer.
1318
- - Office files (`docx doc odt rtf xlsx xls xlsm ods pptx ppt odp`) are converted to PDF by the Aivin server, which does not keep the
1319
- file. The page asks first; "Don't ask again on this computer" is saved in `~/.aivin/open-settings.json`. Servers that turned this off
1320
- answer "sign in to open it". The PDF is kept on this computer in `~/.aivin/preview-cache/` (by file content, up to 500 MB, unused
1321
- copies removed after 30 days), so opening the same unchanged file again shows it at once without sending anything.
1322
- - **Sign in to edit and use AI** runs the browser sign-in of `aivin login`, uploads the file to your Drive and switches the same window to
1323
- the editor.
1324
-
1325
- Opened from Explorer, `Aivin.exe --open "<file>"` runs this command hidden (no console window) and shows a system notification while it
1326
- uploads, or when it fails (e.g. not signed in - run `aivin login`). Needs a server that accepts CLI API keys on Drive upload (Aivin
1327
- backend from 04/11/2026).
1328
-
1329
- ## `aivin update`
1330
-
1331
- Updates the standalone `aivin` (installed with `install.ps1` / `install.sh`) from the same download site as the installer:
1332
- reads `latest.txt`, checks the release's Ed25519 signature (`SHA256SUMS.sig`, verified against the release keys built into aivin -
1333
- an unsigned or wrongly signed release is refused before its build is even downloaded), downloads that release's build for this
1334
- computer, checks it against the signed `SHA256SUMS`, makes sure the new build starts (`--version`, run without your API key or tokens
1335
- in its environment), then replaces the installed file. The previous file is kept as `aivin.prev` / `aivin.exe.prev` until the new one
1336
- has run fine.
1337
-
1338
- ```bash
1339
- aivin update # install the latest release
1340
- aivin update --check # only tell whether a newer release exists
1341
- aivin update --to v1.0.8 # install a specific release (also goes back)
1342
- aivin update --auto off # stop background updates of `aivin remote start` on this computer (on: turn them back on)
1343
- ```
1344
-
1345
- - npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
1346
- - The build is streamed to disk while its SHA-256 is computed and it is unpacked, with size caps on both the download and the
1347
- unpacked file - nothing large is held in memory, and an oversized or tampered download stops the update without touching the
1348
- installed file.
1349
- - The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
1350
- (e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
1351
- `https` is accepted (plain `http` only to this computer itself), redirects included.
1352
- - Releases can be rolled out to a share of running computers first (`rollout.json` on the download site); `aivin update` run by
1353
- hand ignores that.
1354
- - Turn background updates off for one run with `aivin remote start --no-auto-update`, or with `AIVIN_AUTO_UPDATE=0`.
1355
-
1356
- ## `aivin do <agent_nickname> <mission>`
1357
-
1358
- Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1359
- not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1360
- progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1361
- and choosing which AI Staff agent should handle it.
1362
-
1363
- ```
1364
- Options:
1365
- --workspace <id> Workspace id to run in (default: your personal workspace)
1366
- --project <id> Project id within the workspace
1367
- --no-watch Fire the mission and return immediately - skip streaming live progress
1368
- ```
1369
-
1370
- ```bash
1371
- aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1372
- ```
1373
-
1374
- - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1375
- nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1376
- prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1377
- given (in a non-interactive shell, both are required up front).
1378
- - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1379
- yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1380
- one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1381
- make` below, which this reuses).
1382
-
1383
- By default it then streams the mission's live progress in the terminal (same realtime channel
1384
- `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1385
- `--no-watch` to just fire it and return immediately instead.
1386
-
1387
- If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1388
- that first when no workspace is given).
1389
-
1390
- ### `aivin do job <description>`
1391
-
1392
- Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1393
- of any single chat/mission invocation (`POST /automation/jobs/create`).
1394
-
1395
- ```
1396
- Options:
1397
- --workspace <id> Workspace id to create the job in (default: your personal workspace)
1398
- --project <id> Project id within the workspace
1399
- --agent <id> Agent id the job runs as (default: the workspace's default agent)
1400
- --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1401
- platform infer one)
1402
- ```
1403
-
1404
- ```bash
1405
- aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1406
- aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1407
- ```
1408
-
1409
- If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1410
- description itself - pass it explicitly if you already know the cadence, to skip the extra
1411
- inference call.
1412
-
1413
- ## `aivin task [description]`
1414
-
1415
- Creates a new task (`POST /task/create`) from a plain-language description - the description
1416
- becomes both the task's title (truncated if long) and its full content.
1417
-
1418
- ```
1419
- Options:
1420
- --workspace <id> Workspace id to create the task in (default: your personal workspace)
1421
- --project <id> Project id within the workspace
1422
- --assignee <userId> User id to assign the task to (default: unassigned)
1423
- ```
1424
-
1425
- ```bash
1426
- aivin task "Follow up with the customer about their refund request"
1427
- ```
1428
-
1429
- `aivin task` also has subcommands for the rest of the task lifecycle:
1430
-
1431
- ```
1432
- Commands:
1433
- list [options] List tasks in a project
1434
- mine [options] List tasks assigned to you in a project
1435
- get [id] Get a task by id
1436
- update [options] [id] Update a task
1437
- delete [id] Delete a task
1438
- ```
1439
-
1440
- ```bash
1441
- aivin task list --status todo # list open tasks in your first project
1442
- aivin task list --project <id> --assignee <userId> # filter by project/assignee
1443
- aivin task mine # tasks assigned to you
1444
- aivin task get <id> # full task details (JSON)
1445
- aivin task update <id> --status done # move a task to done
1446
- aivin task update <id> --title "New title" --priority high
1447
- aivin task delete <id>
1448
- ```
1449
-
1450
- `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1451
- `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1452
- Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1453
- `aivin workspace` to find one).
1454
-
1455
- ## `aivin workspace`
1456
-
1457
- Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1458
- lists that workspace's projects so you can pick the corresponding one - printing the resolved
1459
- `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1460
-
1461
- ```
1462
- Options:
1463
- --plain Print a flat list instead of the interactive picker (for scripts/CI)
1464
- ```
1465
-
1466
- ```bash
1467
- aivin workspace
1468
- ```
1469
-
1470
- Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1471
- interactive prompts.
1472
-
1473
- ## `aivin agent`
1474
-
1475
- Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1476
- publish one you own. `aivin do` calls into the same install/create flows automatically when it
1477
- can't resolve `<agent_nickname>`.
1478
-
1479
- ```
1480
- Commands:
1481
- search [options] [query] Search the AI Staff marketplace for an agent
1482
- install [options] [query] Search the marketplace and install an agent into a workspace
1483
- make [options] Create a brand new AI Staff agent
1484
- publish [options] [agentId] Publish an agent you own to the marketplace
1485
- ```
1486
-
1487
- ```bash
1488
- aivin agent search "customer support" # browse the marketplace
1489
- aivin agent install "customer support" # search + pick + install into your personal workspace
1490
- aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1491
- aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1492
- aivin agent publish <agentId> # make an agent you own visible in the marketplace
1493
- ```
1494
-
1495
- - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1496
- - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1497
- the new agent there too (no separate `install` call needed).
1498
- - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1499
- `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1500
- shared master) - both scoped to the workspace the agent actually lives/was authored in.
1501
-
1502
- ## `aivin project`
1503
-
1504
- Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1505
- endpoint - use `aivin workspace` to browse a workspace's existing projects).
1506
-
1507
- ```
1508
- Commands:
1509
- create [options] [name] Create a new project in a workspace
1510
- update [options] [id] Update a project (currently: rename)
1511
- delete [options] [id] Delete a project
1512
- ```
1513
-
1514
- ```bash
1515
- aivin project create "Q3 Launch"
1516
- aivin project update <id> --name "Q3 Launch (renamed)"
1517
- aivin project delete <id>
1518
- ```
1519
-
1520
- All three default to your personal workspace when `--workspace` is omitted.
1521
-
1522
- ## Environment variables
1523
-
1524
- `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1525
- machine picks it up automatically - there's no per-project credential to manage.
1526
-
1527
- | Variable | Used by | Default | When you'd touch it |
1528
- | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1529
- | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` | Point `main()`'s SDK calls at a local/dev/staging backend instead of production. Staging: `beta-sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1530
- | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` | Only for a self-hosted or staging instance. Staging: `https://beta-api.aivin.vn`. |
1531
- | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` | Only for a self-hosted or staging instance. |
1532
- | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1533
- | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` | Loopback-only by default (`/invoke` has no auth) - only widen this if you deliberately want another device on your network to reach it. See [sdk repo's SECURITY.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SECURITY.md). |
1534
- | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` | Set `true` to run `src/main.ts` inside an isolated `worker_threads.Worker` (no direct access to the container's secret, restricted fs/child_process) instead of loading it in-process. Off by default - see [sdk repo's worker-sandbox.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/draft/plugins/worker-sandbox.md). |
1535
-
1536
- Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1537
- either injected automatically inside a deployed container or has a working zero-config default -
1538
- not something you're expected to set by hand.
1539
-
1540
- ## See also
1541
-
1542
- - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1543
- - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1544
- - [PLUGIN_DEVELOPMENT_GUIDE.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/PLUGIN_DEVELOPMENT_GUIDE.md) - writing and testing a handler
1545
- - [SDK.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SDK.md) - everything the SDK exposes inside `main()`
1
+ # 🖥️ CLI Reference
2
+
3
+ `aivin` is built on [Commander](https://github.com/tj/commander.js), so help is always available
4
+ without needing this doc:
5
+
6
+ ```bash
7
+ aivin --help # or: aivin help
8
+ aivin <command> --help # or: aivin help <command>
9
+ ```
10
+
11
+ Every command below is real - this is the exact output of `aivin --help` as of this CLI version.
12
+
13
+ ```
14
+ Usage: aivin [options] [command]
15
+
16
+ aivin CLI - scaffold, run, and deploy Aivin plugins
17
+
18
+ Options:
19
+ -V, --version output the version number
20
+ -h, --help display help for command
21
+
22
+ Commands:
23
+ create [options] [name] Create new plugin
24
+ init [options] [name] Set up a new plugin step by step: asks what it should do, then generates real working code from that description
25
+ validate [options] Validate manifest.json in the current directory (or --json/--stdin for scripted use)
26
+ start [options] Start plugin server
27
+ deploy Deploy plugin to your org on the Aivin server
28
+ test [options] Deploy to a non-production test instance, then smoke-test it with generated input and save a report to .test/
29
+ plugin AI-assisted plugin authoring
30
+ connector Register and discover reusable connectors (OAuth apps / credential-form namespaces)
31
+ pluginstore Self-hosted aivin-service worker (Docker) - attach it to your org as a plugin store
32
+ mcp [options] [url] MCP proxy plugins - wrap an external MCP server tool/resource/prompt, no code required
33
+ login [options] [baseUrl] Log in and save an API key for plugin deployment (opens your browser by default)
34
+ whoami Show which account is currently logged in on this machine (reads ~/.aivin/credentials - no server call)
35
+ key Manage named API keys for your account
36
+ browser [options] [mission] Run an AI Browser mission - by default opens/reuses a local browser window dedicated to AI Browser (own profile, own cookies - log in once, watch missions run live from then on); --remote uses a server-side browser instead
37
+ do [options] [agentNickname] [mission] Have <agentNickname> work toward a goal in the background - not a specific deployed plugin
38
+ task [options] [description] Create a new task from a plain-language description
39
+ workspace [options] Browse your workspaces and projects, and pick one to use with --workspace/--project
40
+ agent Search, install, create, and publish AI Staff agents
41
+ project Create, update, and delete projects within a workspace
42
+ help [command] display help for command
43
+ ```
44
+
45
+ ## `aivin init [name]`
46
+
47
+ The simplest way to start: asks what the plugin should do, then scaffolds the project **and**
48
+ generates real working code from that description in one step - no separate `aivin create` +
49
+ `aivin plugin make` needed.
50
+
51
+ ```bash
52
+ aivin init my-plugin
53
+ # ? Plugin name: my-plugin
54
+ # ? What should this plugin do? (be specific - this is what generates your code)
55
+ # > Summarize a support ticket and tag its urgency low/medium/high
56
+ ```
57
+
58
+ Options:
59
+
60
+ ```
61
+ Options:
62
+ --name <name> Plugin name (if not specified, will prompt)
63
+ --model <model> LLM model to use for generation
64
+ --provider <provider> LLM provider to use for generation
65
+ ```
66
+
67
+ Writes two source files instead of one, unlike `aivin create`:
68
+
69
+ - **`src/service.ts`** - the actual business logic, AI-generated from your description. A single
70
+ exported `execute(input, ctx)` that returns plain result data (or throws a plain `Error`) - no
71
+ `PluginResponse`/`PluginStatus` boilerplate to think about.
72
+ - **`src/main.ts`** - a thin, static wrapper (not AI-generated, doesn't change between runs). Calls
73
+ `execute()` and packages the result into the `PluginResponse` the platform expects. This filename
74
+ is fixed - the runtime always loads exactly `src/main.ts`, so it's never regenerated or renamed.
75
+
76
+ If code generation fails (network issue, `API_KEY` not set, etc.), `aivin init` still leaves you
77
+ with a working, deployable scaffold - it falls back to the same plain placeholder `aivin create`
78
+ writes, so nothing is left half-broken.
79
+
80
+ Regenerating later: `aivin plugin make "<new description>"` detects `src/service.ts` and targets it
81
+ instead of `src/main.ts`, so the split is preserved (see below).
82
+
83
+ Prefer no AI step at all? `aivin create` scaffolds the same project structure minus the generation -
84
+ one `src/main.ts` you write by hand.
85
+
86
+ ## `aivin create`
87
+
88
+ Scaffold a new plugin project (`manifest.json`, `src/main.ts`, `package.json`, `tsconfig.json`,
89
+ `.env`, `.gitignore`).
90
+
91
+ ```
92
+ Usage: aivin create [options] [name]
93
+
94
+ Options:
95
+ --json <config> JSON config (AI mode)
96
+ --stdin Read from stdin
97
+ --name <name> Plugin name (if not specified, will prompt)
98
+ --silent Silent mode
99
+ --json-output JSON output
100
+ ```
101
+
102
+ - `aivin create <name>` (or `--name <name>`) → creates a new `<name>/` subdirectory and scaffolds
103
+ into it, no name prompt (description still prompted).
104
+ - No name at all → interactive prompts for both name and description, scaffolding into the
105
+ **current** directory - `mkdir`/`cd` into your target folder yourself first.
106
+ - `--json '<config>'` / `--stdin` → non-interactive/scripted mode for AI tooling, also creates a
107
+ `<config.name>/` subdirectory. `config` needs at least `name` and `description`; anything else
108
+ (`input`, `output`, `trigger_type`, ...) is merged straight into the generated `manifest.json`.
109
+ `config` may also be a path to a JSON file.
110
+ - `--json-output` → prints a machine-readable `{ success, pluginDir, name, description, timestamp }`
111
+ result instead of the usual colored console output.
112
+
113
+ ```bash
114
+ aivin create my-plugin
115
+ aivin create --json '{"name":"my-plugin","description":"Summarize tickets"}'
116
+ ```
117
+
118
+ ## `aivin validate`
119
+
120
+ Validates a plugin config against the same rules `aivin create` enforces (name format, required
121
+ `description`, and - if present - `proxy_config` completeness for MCP proxy plugins). Doesn't touch
122
+ the network.
123
+
124
+ With no flags, validates `manifest.json` in the current directory - the common case:
125
+
126
+ ```bash
127
+ cd my-plugin
128
+ aivin validate
129
+ ```
130
+
131
+ ```
132
+ Options:
133
+ --json <config> JSON config, instead of reading manifest.json from the current directory
134
+ --stdin Read JSON config from stdin, instead of reading manifest.json
135
+ --json-output JSON output
136
+ ```
137
+
138
+ `--json`/`--stdin` remain for scripted/CI use where the config isn't a file on disk yet:
139
+
140
+ ```bash
141
+ aivin validate --json '{"name":"my-plugin","description":"x"}'
142
+ ```
143
+
144
+ ## `aivin start`
145
+
146
+ Runs the current plugin directory (must contain `manifest.json` and `src/main.ts`) against a real
147
+ local server - specifically, this project's own installed `@aivin-labs/sdk`'s `bin/server.mjs`
148
+ (resolved from *this project's* `node_modules`, not the CLI's own install location - if you see
149
+ "Could not find @aivin-labs/sdk installed", run `npm install` first). Starts:
150
+
151
+ 1. A real gRPC server (bind `0.0.0.0:50051`) - the same protocol the production host uses to
152
+ trigger your handler(s). You don't call this directly.
153
+ 2. In development (anything but `NODE_ENV=production`), an HTTP test shim on `:4001` (override with
154
+ `LOCAL_TEST_PORT`) for manual `curl` testing.
155
+
156
+ ```bash
157
+ aivin start
158
+ curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
159
+ -d '{"input":{"text":"hello"}}'
160
+ ```
161
+
162
+ With more than one `plugins: []` entry, pass `mission` to pick which entry's `func` runs - it's
163
+ matched against each entry's `id`, falling back to `func` (a single-entry manifest, the scaffold
164
+ default, always resolves to its one entry - no `mission` needed):
165
+
166
+ ```bash
167
+ curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
168
+ -d '{"mission":"summarize-ticket","input":{"text":"hello"}}'
169
+ ```
170
+
171
+ SDK calls made while running default to the **production** backend (`api.aivin.cloud`) if
172
+ `SDK_ENDPOINT` isn't set in `.env` - point it at a local/dev backend instead if you don't want
173
+ that (see [Environment variables](#environment-variables) below).
174
+
175
+ ### Hot-reload
176
+
177
+ Saving `src/**` or `manifest.json` re-imports the plugin in place - no more Ctrl+C + `aivin start`
178
+ again after every edit. Both the real gRPC server and the `:4001` HTTP test shim pick up the change
179
+ together. A broken save (syntax error, missing export) is reported and the *previous* working
180
+ version keeps serving until you fix it - a typo mid-edit doesn't kill the running server.
181
+
182
+ ```
183
+ ♻️ Reloaded (src/main.ts): my-plugin (My Plugin) v0.1.0
184
+ ```
185
+
186
+ On by default in development; disabled automatically inside a real deployed container (detected via
187
+ `SDK_SECRET_FILE`, which only a real deploy sets - `NODE_ENV=production` alone doesn't reliably mean
188
+ "deployed", the platform's own container build never sets it). This same file is also the
189
+ container's entrypoint in production, where the plugin source is also bind-mounted read-only, so
190
+ there'd be nothing for the watcher to see even without this check. Turn it off by hand with
191
+ `--no-watch` or `AIVIN_START_WATCH=false`.
192
+
193
+ ### Live per-call debugging: `--debug` / `--debug-json`
194
+
195
+ By default you only see a trace summary once the whole invocation finishes (`AIVIN_TRACE`, on by
196
+ default - see [Environment variables](#environment-variables)). To watch each `sdk.*` call as it
197
+ happens instead:
198
+
199
+ ```bash
200
+ aivin start --debug # human-readable: one line per call, live
201
+ aivin start --debug-json # same events, one JSON object per line - for a script/coding agent
202
+ # to parse instead of pattern-matching free text
203
+ ```
204
+
205
+ Both are `SDK_DEBUG=true`/`SDK_DEBUG=json` under the hood (settable directly if you're not going
206
+ through `aivin start`, e.g. inside `aivin test`'s smoke-test run). Each line/event covers exactly
207
+ one `sdk.*` call: `namespace`, `duration_ms`, `attempts`, `success`, `error` (if any).
208
+
209
+ ## `aivin deploy`
210
+
211
+ Deploys the plugin in the current directory (`manifest.json` + every project file except
212
+ `node_modules/`, `.git/`, `.tmp/`, `dist/`, `build/`, `.test/`, `.gitignore`, `yarn.lock`, and
213
+ `.env`) to `POST /plugins/deploy`. Always private to your org - there's no CLI-reachable "submit to
214
+ the public store" path for regular code/Docker plugins today (that only exists through the browser
215
+ CodeEditor's publish flow, a different runtime). **MCP proxy plugins are the one exception** -
216
+ `aivin mcp <url> --publish` (below) can submit those to the community store directly from the CLI.
217
+
218
+ - `manifest.json` is normally the default `{ ...commonFields, plugins: [...] }` shape (see
219
+ [MANIFEST.md#default-shape](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#default-shape)) - common fields are copied onto each
220
+ entry in `plugins` before upload, and all entries deploy together, sharing one running
221
+ container. The legacy flat single-object shape is still accepted.
222
+ - If every entry's `manifest.proxy_config` is set (MCP proxy plugins - see `aivin mcp create`
223
+ below), no files are read or sent at all - just the manifest.
224
+ - `package-lock.json` is auto-generated (`npm install --package-lock-only`) before upload if missing
225
+ - the backend's build runs `npm ci`, which requires one.
226
+ - On success, auto-increments `manifest.json`'s patch version(s) and writes back the plugin id(s)
227
+ the server assigned.
228
+
229
+ ```bash
230
+ aivin deploy
231
+ ```
232
+
233
+ ## `aivin test`
234
+
235
+ Same payload/logic as `aivin deploy`, but against `POST /plugins/test/deploy` - a non-production
236
+ instance for verifying the plugin runs end-to-end on real infra (real container, real gRPC, real
237
+ the SDK) before anyone else can see it. This endpoint is blocked by the backend in production.
238
+
239
+ After a successful deploy, it also **smoke-tests** every non-proxy plugin entry: generates sample
240
+ input from `manifest.json`'s `input` schema (`POST /code/generate-sample-data`), invokes the plugin
241
+ for real (`POST /plugins/execute`) against a workspace, and writes a pass/fail report to
242
+ `.test/<timestamp>.json` in the project directory (also excluded from future deploy uploads).
243
+
244
+ **MCP proxy entries are skipped by default** - there's no generic "sample input" that makes sense
245
+ for a tool schema an external MCP server defines itself, so `aivin test` deploys them but runs no
246
+ automated invoke/report unless you opt in with `--verify-proxy`. Use
247
+ `aivin plugin trigger --id <pluginId> -a "<prompt>"` (or the interactive "Test now?" step
248
+ `aivin mcp <url>` offers right after deploy) to test one by hand instead.
249
+
250
+ ```
251
+ Options:
252
+ --workspace <id> Workspace id to run the smoke test against (default: auto-picks your first one)
253
+ --no-smoke-test Only deploy - skip the generated-input invoke test and report
254
+ --verify-proxy Also invoke MCP proxy entries for real (empty input) instead of skipping
255
+ them - only use if you know the underlying tool(s) have no meaningful side
256
+ effects
257
+ ```
258
+
259
+ ```bash
260
+ aivin test # deploy + smoke-test + report
261
+ aivin test --workspace <id> # smoke-test against a specific workspace
262
+ aivin test --no-smoke-test # deploy only, same as before this flag existed
263
+ aivin test --verify-proxy # also invoke proxy entries with empty input, for real
264
+ ```
265
+
266
+ `--verify-proxy` sends `arguments: {}` (not AI-generated - proxy's `input` schema is the generic
267
+ `{ data: object }` passthrough, so there's nothing meaningful to infer a "realistic" sample from)
268
+ straight to `/plugins/execute`. This really calls the external MCP server - only use it if the
269
+ tool(s) involved are safe to invoke automatically (idempotent/read-only), since a repeated `aivin
270
+ test` run means a repeated real call every time.
271
+
272
+ Entries the MCP server itself flagged destructive/non-readonly (via the MCP spec's own
273
+ `readOnlyHint`/`destructiveHint` tool annotations, surfaced on the manifest as `request_hil: true`)
274
+ are skipped even under `--verify-proxy` - that flag means "the caller vetted these tools as safe to
275
+ call automatically," which doesn't extend to a tool the server itself is warning isn't. Verify
276
+ those by hand instead (`aivin plugin trigger --id <id> -a "..."`).
277
+
278
+ ## `aivin plugin make <description>`
279
+
280
+ AI-generates a plugin from a natural-language description, via `POST /code/generate-project` -
281
+ **complexity-adaptive**: the backend classifies the requirement first, and only escalates beyond a
282
+ single `src/main.ts` when it's genuinely complex.
283
+
284
+ ```
285
+ Options:
286
+ --model <model> LLM model to use for generation
287
+ --provider <provider> LLM provider to use for generation
288
+ ```
289
+
290
+ ```bash
291
+ aivin plugin make "Summarize a support ticket and tag its urgency"
292
+ ```
293
+
294
+ - **Simple/moderate** requirement (the common case): exactly one `src/main.ts`, one generation call
295
+ - unchanged from before. Same conventions as always (`main(mission, input, ctx)`,
296
+ `import { ai } from '@aivin-labs/sdk'`, `PluginResponse`).
297
+ - **Complex** requirement (several genuinely independent capabilities, or logic too large for one
298
+ flat function): the backend plans a small multi-file project first, generates each file, and - if
299
+ the plan calls for it - returns a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
300
+ fragment that replaces `manifest.json`'s `plugins[]` with one entry per capability.
301
+
302
+ Requires `manifest.json` to already exist (`aivin create` first).
303
+
304
+ ### Self-correction loop
305
+
306
+ Generation isn't one-shot, and for a multi-file plan it isn't one-file-at-a-time either: files with
307
+ no dependency on each other generate in parallel (only a file that genuinely needs to see another
308
+ one's content, per the plan's own `depends_on`, waits for it first). After writing every returned
309
+ file, if the project's own `typescript` devDependency is installed (`npm install` already run), the
310
+ whole project is type-checked with `tsc --noEmit`. Real compiler errors (exact
311
+ `file(line,col): error TSxxxx: ...` lines) are attributed back to whichever file they were reported
312
+ against and sent to the AI for a surgical fix - up to 2 rounds, across as many files as had errors:
313
+
314
+ ```
315
+ 🤖 Generating plugin
316
+ ✅ 2 file(s) generated (src/main.ts, src/lib/search.ts)
317
+ ⚠️ 2 compiler error(s) across 1 file(s) - asking the AI to fix...
318
+ ✅ Fixed - clean type-check after 1 attempt(s)
319
+ ```
320
+
321
+ If `node_modules` isn't installed yet, type-checking (and the self-correction it enables) is skipped
322
+ silently - run `npm install` first if you want it. If errors remain after both rounds, every file is
323
+ still written, with every remaining error printed for you to fix by hand.
324
+
325
+ Review generated code before relying on it either way - self-correction only catches what `tsc`
326
+ catches (type errors), not wrong business logic.
327
+
328
+ ## `aivin plugin convert [hint]`
329
+
330
+ Hands the existing project in the current directory to the backend's agentic project-conversion
331
+ pipeline instead of generating locally. Unlike `plugin make`/`plugin init` (a single AI call per
332
+ file, run entirely from what you pass it), this command:
333
+
334
+ 1. Uploads only the **directory tree** - paths and byte sizes, never file content - so the request
335
+ stays cheap no matter how large the project is.
336
+ 2. The backend scans it: it decides which files are actually worth reading (entry points,
337
+ `package.json`, anything name-suggestive of routes/tools/skills) and asks the CLI to read them
338
+ back one at a time, over the same socket connection `aivin plugin logs` uses.
339
+ 3. It plans a conversion - single `main()` vs. a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
340
+ (one `plugins[]` entry per independent capability), and which files to create vs. adapt in
341
+ place - detecting the project's shape (a plain script, an MCP server, an API backend with
342
+ routes, a Claude-style skill) from what it actually read, not a fixed regex. If the project isn't
343
+ TypeScript/JavaScript (Python, Go, ...), every file becomes a **port** (translated, not edited) -
344
+ the plan always uses `create` in that case, never `update`, since there's no existing `.ts` file
345
+ to adapt in place.
346
+ 4. It generates/updates each planned file, then **verifies with a real `tsc --noEmit` run** on your
347
+ machine (via the same tool-call channel) and self-corrects on real compiler errors, up to twice.
348
+
349
+ Every step prints live as it happens - this loop can take a while on a real project, so it's never
350
+ silent:
351
+
352
+ ```bash
353
+ cd your-existing-project
354
+ aivin plugin convert
355
+ # 📂 Scanning project tree...
356
+ # 142 file(s) in tree (content read on demand by the server, never uploaded up front)
357
+ # 🤖 Converting - this loops (scan → plan → generate → verify), watch for progress below...
358
+ #
359
+ # [10:32:01] Scanning project tree (142 entries)...
360
+ # [10:32:03] Reading 3 file(s): package.json, src/index.ts, src/tools/search.ts
361
+ # [10:32:07] Plan ready: mcp_server, 2 file(s) - Two independent MCP tools found (search, fetch);
362
+ # splitting into a multi-function manifest so each is separately callable.
363
+ # [10:32:15] Generating 2 file(s) in parallel: src/main.ts, src/lib/search.ts
364
+ # [10:32:22] Type-checking (attempt 1)...
365
+ # [10:32:23] Type-check clean
366
+ # [10:32:23] All required exports present
367
+ # [10:32:24] Running a smoke test with generated sample input (may make real SDK/AI calls using your credentials)...
368
+ # [10:32:31] Smoke test passed
369
+ # ✅ Conversion done (mcp_server, 2 file(s))
370
+ ```
371
+
372
+ The smoke test only runs if the type-check passed first (no point executing code that doesn't even
373
+ compile) and `@aivin-labs/sdk` is already installed locally (`npm install`) - skipped, not failed,
374
+ otherwise. It spawns the real plugin runtime on your machine on off-default ports (won't collide with
375
+ a real `aivin start`) with AI-generated sample input, so a plugin whose logic calls `ai.prompt()` or
376
+ other SDK methods will make a real call using your credentials during this step.
377
+
378
+ ```
379
+ Options:
380
+ --model <model> LLM model to use for generation
381
+ --provider <provider> LLM provider to use for generation
382
+ --force Re-run conversion even if src/main.ts already exists (e.g. redo a
383
+ previous bad/stale result)
384
+ ```
385
+
386
+ - No `manifest.json` needed first - if one doesn't exist, it's created from `package.json` (name,
387
+ description) or the directory name.
388
+ - Fails if `src/main.ts` already exists, unless `--force` is given - the plain (no-flag) case is
389
+ for a project that isn't a plugin yet; `--force` re-runs the whole scan/plan/generate/verify loop
390
+ against a project this command already converted before (the earlier plan turned out wrong, the
391
+ project changed since, whatever the reason) - `src/main.ts` isn't excluded from what gets scanned,
392
+ so the new plan is free to mark it `update`, and the usual per-file overwrite confirmation still
393
+ applies to it like any other existing file.
394
+ - `[hint]` is optional extra guidance, e.g. which function to focus on - passed straight to the
395
+ backend's planning step.
396
+ - If the plan is multi-function, `manifest.json`'s `plugins[]` is replaced with one entry per
397
+ planned capability (fresh local ids - `aivin deploy` still assigns the real ones).
398
+ - Requires a live connection to the Aivin server for the whole duration (it's not a local batch
399
+ job) - the socket is what lets the backend read files on demand and stream progress back.
400
+ - Only one conversion can run at a time per project - starting a second one against the same
401
+ project while the first is still running fails fast instead of racing both against the same
402
+ files. If the previous run's process died without cleanly finishing, this frees up on its own
403
+ within moments, not stuck for the full run duration.
404
+ - The whole run gives up after ~15 minutes regardless of how far it got, so a stuck step can't hold
405
+ the connection open forever.
406
+
407
+ ### Overwrite safety
408
+
409
+ Unlike `plugin make`, this command can touch files that **already exist** in your project - the
410
+ backend's plan may mark some as `update` (adapt in place) rather than `create` (new file):
411
+
412
+ - Before scanning starts, if the directory is a git repo with uncommitted changes, you're warned
413
+ and (in an interactive terminal) asked to confirm before continuing at all.
414
+ - Before any individual existing file is actually overwritten, you're prompted per-file (with a
415
+ quick `git status` hint - untracked vs. has uncommitted changes - when available) - declining
416
+ skips just that file, the rest of the conversion continues.
417
+ - Non-interactive runs (CI/scripts) can't prompt, so they proceed automatically - the decision is
418
+ still printed to the log either way, it's just not blocking.
419
+
420
+ Review the generated code before relying on it - self-correction only catches what `tsc` catches
421
+ (type errors), not wrong business logic, and the file/project-kind detection is a best effort, not
422
+ a guarantee.
423
+
424
+ ## `aivin plugin search <query>`
425
+
426
+ Searches the platform's plugin ecosystem before you write new logic - the same relevance-ranked
427
+ lookup the platform's own agent uses to auto-select a plugin for a mission (`GET /plugins/search`).
428
+ Doesn't need to be run from inside a plugin project.
429
+
430
+ ```bash
431
+ aivin plugin search "send a slack message"
432
+ ```
433
+
434
+ Options:
435
+
436
+ ```
437
+ Options:
438
+ --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
439
+ --mcp <server_id> List every tool/resource/prompt plugin generated from one MCP server, instead of a text search
440
+ --store <store_id> Restrict to plugins hosted on one self-hosted plugin store (id from `aivin pluginstore ls`) - combines with the text query/--mcp
441
+ --limit <n> Max results to show
442
+ --plain Print a flat list instead of the interactive browser (for scripts/CI)
443
+ ```
444
+
445
+ In a real terminal, results open in an interactive browser: `↑`/`↓` to move between matches,
446
+ `→`/`space`/`enter` to open a plugin's detail view (full description, version, input/output
447
+ schema), `←`/`esc`/`backspace` to go back to the list, `q` to quit. Non-TTY contexts (scripts, CI,
448
+ piped output) or `--plain` fall back to a flat printed list.
449
+
450
+ Call one from your own plugin with `import { call } from '@aivin-labs/sdk'` then
451
+ `await call('<plugin_id>', params)`.
452
+
453
+ ## `aivin plugin info <id>`
454
+
455
+ Detail view for **one already-known plugin id**, without going through `plugin search`'s free-text
456
+ ranking first - useful when debugging a specific plugin you already have the id for (copied from
457
+ `plugin search --mcp <server_id>`'s listing, from the platform, etc.).
458
+
459
+ ```bash
460
+ aivin plugin info modelcontextprotocol-servers-src-everything-read_file
461
+ ```
462
+
463
+ Options:
464
+
465
+ ```
466
+ Options:
467
+ --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
468
+ --plain Print flat instead of the interactive browser, if falling back to
469
+ closest-match results
470
+ ```
471
+
472
+ There's no dedicated `GET /plugins/:id` on the backend, so this reuses `/plugins/search` with the
473
+ id itself as the query and picks the exact `id` match out of the ranked results. If nothing matches
474
+ exactly (typo'd id, or a plugin not visible to you), it prints "no exact match" and falls back to
475
+ the same interactive browser over the closest results instead of failing outright.
476
+
477
+ ## `aivin plugin ask [mission]`
478
+
479
+ One-shot "just simulate the agent" mode: give it a plain-language mission and it does what a
480
+ running agent actually does at execution time - searches the plugin ecosystem the same
481
+ relevance-ranked way (`plugin search`'s lookup), picks the **top match**, and immediately triggers
482
+ it with that same mission auto-mapped onto the input schema (`plugin trigger -a` under the hood).
483
+ Where `plugin search` + `plugin trigger --id <id> -a "..."` is a manual two-step "pick, then run"
484
+ flow, `ask` collapses both into a single command - no copying an id between them.
485
+
486
+ ```bash
487
+ aivin plugin ask "send a slack message to #eng saying the deploy is done"
488
+ ```
489
+
490
+ ```
491
+ 🤖 Auto-selected: Slack Notify (87% match) (slack-notify-abc123)
492
+ runner-up(s): Slack Post Message, Discord Notify
493
+
494
+ 🚀 Triggering Slack Notify...
495
+ ...
496
+ ```
497
+
498
+ Options:
499
+
500
+ ```
501
+ Options:
502
+ --top <n> How many candidates to consider/print as runner-up context
503
+ (default 5) - only the top match is ever run
504
+ -i, --input <json> Force specific fields (as JSON) alongside the auto-mapped
505
+ ones - explicit fields win
506
+ --workspace <id> Workspace id to search/run against (default: auto-picks
507
+ your first one)
508
+ --agent <id> Agent id to run as, if the plugin needs one for
509
+ HIL/confirm behavior to be accurate
510
+ --watch-logs Also stream the chosen plugin's own live console output inline
511
+ --no-auth-prompt Don't offer to connect/configure a missing connector
512
+ interactively - just print the needs_auth result and exit
513
+ --save Write this run's result to .test/trigger/<ts>.json
514
+ --compare <file> Diff this run against a previously --save'd file
515
+ ```
516
+
517
+ If the auto-pick looks wrong, check the printed runner-up(s) and fall back to the manual flow -
518
+ `aivin plugin search "<mission>"` to browse candidates yourself, then
519
+ `aivin plugin trigger --id <chosen-id> -a "<mission>"` to run that specific one instead. `ask`
520
+ throws (no plugin executed) if the search comes back empty, rather than guessing.
521
+
522
+ ## `aivin plugin trigger [mission] [input]`
523
+
524
+ Invokes an **already-deployed** plugin for real and prints the result - the same
525
+ `POST /plugins/execute` the platform's own Playground ("Thử nghiệm" tab) uses, so it exercises the
526
+ exact same code path a running agent would hit. Run it from the plugin's project directory -
527
+ `manifest.json` supplies the plugin id (`--func <name>` picks the entry for a multi-function
528
+ plugin) - or pass `--id` directly for a plugin with no local project directory (e.g. one built by
529
+ `aivin mcp <url>`, which deploys straight from a scan and never writes a `manifest.json` anywhere).
530
+
531
+ ```
532
+ Options:
533
+ -a, --auto <prompt> Natural-language prompt - the platform auto-maps it onto
534
+ the input schema for you
535
+ --id <pluginId> Plugin id to trigger directly - skips the local
536
+ manifest.json lookup entirely
537
+ --func <name> Which function to trigger, for a multi-function plugin
538
+ (matches name/func/id) - ignored when --id is given
539
+ --workspace <id> Workspace id to run against (default: auto-picks your
540
+ first one)
541
+ --agent <id> Agent id to run as, if the plugin needs one for
542
+ HIL/confirm behavior to be accurate
543
+ --watch-logs Also stream the plugin's own live console output inline
544
+ (same feed as `aivin plugin logs`) - no second terminal
545
+ needed. Requires permission to view that plugin's logs;
546
+ most store plugins from other orgs just fall back to
547
+ the REST result only.
548
+ --no-auth-prompt Don't offer to connect/configure a missing connector
549
+ interactively - just print the needs_auth result and exit
550
+ --save Write this run's result to .test/trigger/<ts>.json
551
+ --compare <file> Diff this run against a previously --save'd file
552
+ ```
553
+
554
+ ```bash
555
+ # no local project directory - e.g. an MCP proxy plugin from `aivin mcp <url>`
556
+ aivin plugin trigger --id my-mcp-plugin-id -a "search for open issues about login"
557
+ ```
558
+
559
+ **Direct mode** - `<mission>` (becomes `main()`'s `mission` argument) and `<input>` (a JSON string,
560
+ becomes `main()`'s `input` argument) both required:
561
+
562
+ ```bash
563
+ aivin plugin trigger "summarize this" '{"text":"Aivin plugins are easy to write."}'
564
+ ```
565
+
566
+ **Auto mode** (`-a`/`--auto <prompt>`) - give it free text instead of structured JSON; the backend's
567
+ own input-mapping (`mapDataToSchema`, the same mechanism the Playground's chat-style tester uses)
568
+ maps it onto `manifest.json`'s `input` schema for you:
569
+
570
+ ```bash
571
+ aivin plugin trigger -a "Summarize this ticket: customer can't log in after the last update"
572
+ ```
573
+
574
+ `<input>` can still be given alongside `-a` for fields you want to force rather than let the AI
575
+ infer - explicit values win over auto-mapped ones per field.
576
+
577
+ What gets printed:
578
+ - `--- Log ---` - the backend's own mapping/execution stage messages (`processing_log`), if any.
579
+ This is **not** your plugin's own `console.log()` output from inside `main.ts` - it's everything
580
+ the HTTP response itself carries, printed after the call completes.
581
+ - `--- Auto-mapped input ---` - what `-a`'s prompt actually got mapped to (`mapped_arguments`),
582
+ only present in auto mode.
583
+ - `--- Result: <status> ---` - the plugin's real `status`/`message`/`error_code`/`data`.
584
+ - `--- Compare ---` (only with `--compare <file>`) - status + data diffed against the saved run.
585
+
586
+ Both the workspace lookup and the execute call have a client-side timeout (15s and 3 minutes) - a
587
+ hung backend fails with a clear error instead of `trigger` sitting there forever. Override the
588
+ execute one with `AIVIN_TRIGGER_TIMEOUT_MS` if you have a legitimately slow plugin.
589
+
590
+ ### Watching your plugin's own console output inline: `--watch-logs`
591
+
592
+ By default `trigger` only shows what's above - not the plugin's own `console.log()`/`sdk.log()`
593
+ calls from inside `main.ts`. Pass `--watch-logs` to subscribe to that live, over the same channel
594
+ `aivin plugin logs` uses, right before firing the call - one terminal instead of two:
595
+
596
+ ```bash
597
+ aivin plugin trigger --watch-logs "summarize this" '{"text":"..."}'
598
+ ```
599
+
600
+ This is permission-scoped server-side to plugins you can see the container logs for (your own or
601
+ your org's deployments). Triggering a plugin from the public store that some other org owns will
602
+ print `(--watch-logs: no live console output - ...)` and fall back to the REST result only - there's
603
+ no way around that from the CLI, raw container stdout isn't something the platform exposes across
604
+ org boundaries.
605
+
606
+ ### Missing a connector? `trigger` sets it up for you, right there
607
+
608
+ If the plugin needs a connector (OAuth account, or a plain credential form like SMTP
609
+ host/user/pass) that isn't configured yet, `/plugins/execute` comes back `needs_auth` instead of
610
+ running. In an interactive terminal, `trigger`/`ask` catch that and offer to fix it on the spot
611
+ instead of just printing the failure and making you go set it up in the web app:
612
+
613
+ - **OAuth connector** - asks "Open your browser to connect now?", then opens the same
614
+ authorize-flow the web app's "Connect" button uses (falls back to printing the URL if it can't
615
+ launch a browser), and polls in the background until you've finished. No timeout hunting - it
616
+ waits up to 3 minutes, then retries the trigger automatically.
617
+ - **Credential-form connector** (SMTP, or any custom `credential_form` connector registered via
618
+ `aivin connector register`) - prompts for each declared field right in the terminal (masked for
619
+ `secret` fields), saves it, then retries.
620
+
621
+ Either way, you get exactly one automatic retry after setup - if it still needs auth after that
622
+ (e.g. you declined, or the OAuth flow timed out), the `needs_auth` result just prints as-is. Pass
623
+ `--no-auth-prompt` to skip all of this and always just print the result (useful for scripts/CI,
624
+ where there's no one to answer the prompt anyway - it's also skipped automatically whenever stdin/
625
+ stdout isn't a real TTY).
626
+
627
+ ### Turning ad-hoc tries into a regression check: `--save` / `--compare`
628
+
629
+ ```bash
630
+ aivin plugin trigger "summarize this" '{"text":"..."}' --save
631
+ # Saved: .test/trigger/2026-01-15T10-30-00-000Z.json
632
+
633
+ # ...later, after changing the plugin (or re-testing the same store plugin)...
634
+ aivin plugin trigger "summarize this" '{"text":"..."}' \
635
+ --compare .test/trigger/2026-01-15T10-30-00-000Z.json
636
+ ```
637
+
638
+ Lighter-weight than `aivin test`'s full deploy+smoke-test+report flow - useful for a quick "did this
639
+ still behave the same way" check on any plugin you can trigger, including ones you don't own.
640
+
641
+ ## `aivin plugin logs [pluginId]`
642
+
643
+ Tails an **already-deployed** plugin's own container stdout/stderr live - the same real-time feed
644
+ the platform's own Playground log panel uses. `pluginId` defaults to the current directory's
645
+ `manifest.json` id (`--func <name>` picks the entry for a multi-function plugin), so plain
646
+ `aivin plugin logs` works from inside the plugin's own project directory; pass an explicit id to
647
+ watch a plugin you're not standing inside.
648
+
649
+ ```
650
+ Options:
651
+ --func <name> Which function's id to resolve, for a multi-function plugin
652
+ (only used when pluginId is omitted)
653
+ ```
654
+
655
+ ```bash
656
+ aivin plugin logs
657
+ aivin plugin logs my-plugin-id
658
+ ```
659
+
660
+ Prints each line as it's written (`console.log` → gray, `console.error` → red), with a local
661
+ timestamp. Runs until you press Ctrl+C. If the container restarts (redeploy/crash) mid-stream,
662
+ the connection ends - re-run the command to resume watching.
663
+
664
+ ## `aivin plugin delete [id]`
665
+
666
+ Deletes a plugin you own - `DELETE /plugins/store/:pluginId` for a single one, or
667
+ `--group <groupId>` for every plugin created by one batch deploy at once (`DELETE
668
+ /plugins/group/:groupId`) - e.g. everything `aivin mcp <url>` generated in a single run, which
669
+ prints its `group_id` right after deploying specifically so you can pass it here later. Neither can
670
+ be undone.
671
+
672
+ ```
673
+ Options:
674
+ --group <groupId> Delete every plugin sharing this group_id instead of a single plugin by id
675
+ -y, --yes Skip the confirmation prompt (for scripts/CI)
676
+ ```
677
+
678
+ ```bash
679
+ aivin plugin delete my-plugin-id
680
+ aivin plugin delete --group 66f2a1... # everything from one `mcp <url>` run
681
+ aivin plugin delete --group 66f2a1... --yes # skip the prompt, for scripts
682
+ ```
683
+
684
+ Single delete asks a plain yes/no confirmation. `--group` asks you to **type the group id back** to
685
+ confirm (same pattern `aivin pluginstore rm` uses) since one typo'd id could otherwise delete many
686
+ plugins at once. Both skip the prompt entirely with `-y`/`--yes`. Deleting is scoped to plugins you
687
+ own server-side - a wrong/other org's id fails with "not found" rather than revealing whether it
688
+ exists.
689
+
690
+ ## `aivin connector`
691
+
692
+ Connectors are reusable OAuth apps / credential-form namespaces, referenced from `manifest.json`'s
693
+ `connection_id` field so multiple plugins can share one set of user-connected credentials instead
694
+ of each prompting for the same login separately. Check for an existing one before registering a
695
+ new namespace:
696
+
697
+ ```bash
698
+ aivin connector search "slack"
699
+ aivin connector list
700
+ ```
701
+
702
+ ```
703
+ Commands:
704
+ register Register a new connector namespace, interactively
705
+ search [options] [query] Search connectors for something to reuse instead of registering a new one
706
+ list [options] List connectors visible to your org
707
+ deprecate [id] Hide a connector you own from search/list without breaking plugins already using it
708
+ undeprecate [id] Make a previously-deprecated connector you own discoverable again
709
+
710
+ Options for search/list:
711
+ --limit <n> Max results to show (search)
712
+ --page <n> Page number (list)
713
+ --include-deprecated Also show your org's deprecated connectors, hidden by default (list)
714
+ --plain Print a flat list instead of the interactive browser - for scripts/CI (both)
715
+ ```
716
+
717
+ `aivin connector register` walks you through naming the namespace and picking the auth shape
718
+ (OAuth vs. a plain credential form) interactively - there's no non-interactive/scripted form, since
719
+ registering real OAuth app credentials isn't something to automate blindly. Once registered, put
720
+ the connector's id in your plugin's `manifest.json` as `connection_id` - see
721
+ [MANIFEST.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#fields) (sdk
722
+ repo).
723
+
724
+ `aivin connector deprecate`/`undeprecate` only affect discoverability (search/list) - they never
725
+ break a plugin that's already using the connector's `connection_id`, so it's safe to deprecate one
726
+ you've replaced without migrating existing plugins first.
727
+
728
+ ## `aivin pluginstore`
729
+
730
+ Manages a **self-hosted `aivin-service` worker** (a Docker container you run yourself) attached to
731
+ your org as a *plugin store* - a piece of infrastructure your org's plugins can run against,
732
+ independent from Aivin's own hosted infra. A store can have multiple *nodes* (multiple machines
733
+ each running their own `aivin-service`, all attached to the same store) for redundancy/scale. This
734
+ is unrelated to the **Plugin Marketplace** (`aivin mcp <url> --publish` and the browser
735
+ CodeEditor's publish flow) - a plugin store is infrastructure you attach, not a place plugins get
736
+ published to.
737
+
738
+ ```
739
+ Commands:
740
+ create [options] [store_id] Create a new plugin store + attach this machine as its first node
741
+ attach [options] [store_id] Attach this machine as another node of an existing plugin store
742
+ ls List plugin stores visible to your org, with online/offline status per node
743
+ enable [store_id] Enable a store for your org (org admin only)
744
+ disable [store_id] Disable a store for your org without deleting it (org admin only)
745
+ rm [options] [store_id] Delete a store - revokes EVERY node attached to it, not just this machine (org admin only)
746
+ detach [options] Remove THIS machine's pairing only (local file only, no BE call)
747
+ ```
748
+
749
+ ```bash
750
+ aivin pluginstore create my-store --label "Production store"
751
+ aivin pluginstore ls
752
+ ```
753
+
754
+ `create`/`attach` both end by writing `worker-identity.json` into a data directory (default
755
+ `~/.aivin/service-data`, override with `--data-dir`) - the machine's actually-running
756
+ `aivin-service` process watches that directory (`fs.watch`) and pairs itself automatically the
757
+ moment the file appears. Neither command needs `aivin-service` to already be running, and neither
758
+ restarts any container - the CLI's job ends at writing the file; pairing itself is the worker's own
759
+ responsibility.
760
+
761
+ ```
762
+ Options (create):
763
+ --label <label> Display label for the store (defaults to store_id)
764
+ --node-label <label> Display label for this node/instance
765
+ --data-dir <path> Where to write worker-identity.json (default: ~/.aivin/service-data)
766
+
767
+ Options (attach):
768
+ --node-label <label> Display label for this node/instance
769
+ --data-dir <path> Where worker-identity.json is written (default: ~/.aivin/service-data)
770
+ ```
771
+
772
+ `aivin pluginstore detach` is the local-only inverse of `attach`/`create`: it deletes
773
+ `worker-identity.json` from this machine (`--data-dir` to point at a non-default location) without
774
+ calling the backend at all - the running `aivin-service` notices the file is gone and un-pairs on
775
+ its own. To actually revoke a node/store server-side (so it can't reattach with an old token), use
776
+ `aivin pluginstore rm` instead - **org admin only**, and destructive: it revokes every node attached
777
+ to the store, not just this machine, hence the `-y`/`--yes` flag to skip the confirmation prompt in
778
+ scripts.
779
+
780
+ `enable`/`disable` don't delete anything - they just toggle whether your org's plugins are allowed
781
+ to route to the store right now, so you can pull a store out of rotation (e.g. for maintenance)
782
+ without losing its configuration or having to re-attach nodes afterward.
783
+
784
+ ## `aivin mcp <url> [--publish|--private|--org]`
785
+
786
+ The one-shot path from "here's an [MCP](https://modelcontextprotocol.io) server" to deployed
787
+ plugin(s) - unlike `aivin mcp create` below (which scaffolds exactly 1 tool/resource/prompt you
788
+ already know the transport/command/name for), this scans a whole server and converts everything it
789
+ finds, interactively:
790
+
791
+ 1. **Scan** (`POST /plugins/scan-mcp`) - `<url>` can be a GitHub/GitLab repo, an npm/Smithery
792
+ package, or a live MCP server URL. Reads the repo/README or handshakes the live server directly.
793
+ Only scan URLs you actually trust - this step connects to (and, for a live handshake, effectively
794
+ runs) whatever's at that address to introspect it, same trust model as installing a dependency
795
+ from source. Bounded to 60s (scanning a live server can legitimately take longer than the other
796
+ steps, which is why this one gets more headroom) so an unresponsive server fails with a clear
797
+ error instead of hanging the CLI indefinitely. The scan response also carries a deterministic
798
+ `repo_id` (derived from the source URL, same convention the backend uses for every discovery
799
+ path so the same server always converges on one id) - right after a successful scan, this is
800
+ used as an exact `plugin search --mcp <repo_id>` lookup, so anything printed here really is from
801
+ this exact server, not a fuzzy text guess. Still informational only - never blocks the flow.
802
+ 2. **Select** - checkbox prompt lists every tool/resource/prompt found (all checked by default);
803
+ space to toggle, enter to continue with only what you actually want as plugins.
804
+ 3. **Build manifests** (`POST /plugins/build-mcp-manifests`, 30s timeout) - one `PluginManifest` per
805
+ selected item, generated server-side (not typed by hand like `aivin mcp create` requires).
806
+ 4. **Edit** (optional) - confirm prompt offers to rename/redescribe any of the generated plugins
807
+ before anything is deployed. A second, separate optional prompt offers to attach one connector
808
+ (existing or newly registered) as every generated manifest's `connection_id` in one go - see
809
+ [`aivin mcp create`](#aivin-mcp-create-name)'s connector section above for what that buys you.
810
+ 5. **Confirm** - since the checkbox in step 2 defaults to everything checked, this step asks for an
811
+ explicit yes ("Deploy N plugin(s) to your org? This can't be undone from the CLI.", default
812
+ **No**) before anything actually goes out. In a non-TTY context (scripts/CI) this step is skipped
813
+ entirely - the same as everywhere else in the CLI, only a real terminal gets a confirmation prompt.
814
+ 6. **Deploy** (`POST /plugins/deploy`, 60s timeout) - always org-scoped first, regardless of the
815
+ visibility flag below (there's no narrower per-workspace scope for plugins today). Prints a
816
+ `group_id` afterward - save it if you might want to remove everything from this run later in one
817
+ shot with [`aivin plugin delete --group <groupId>`](#aivin-plugin-delete-id).
818
+ 7. **Publish** (only with `--publish`, 30s timeout per submission) - submits each deployed plugin for
819
+ community review (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against
820
+ the real MCP server before it reaches the review queue, not just whatever got deployed (see the
821
+ backend's own `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full
822
+ gate). A submission can't be withdrawn from this CLI either once sent.
823
+
824
+ **Blocked, not just warned**: a manifest whose `proxy_config.auth_secret_key` is set is skipped
825
+ entirely at this step (never submitted) instead of being sent as-is. `auth_secret_key` is an
826
+ admin-level credential meant to be shared by everyone *within the org that deployed it* -
827
+ publishing means other orgs can call this same plugin, and there is no confirmed backend step
828
+ that strips or reissues that credential per installing org, so submitting it unchanged would let
829
+ another org's calls silently resolve to (and spend/exhaust/expose) your org's credential. Rebuild
830
+ the plugin with a connector-bound environment variable instead (`aivin mcp create`'s interactive
831
+ auth setup, "one or more environment variables" → bind to a connector) - that path resolves
832
+ credentials per the *calling* org/user, not off the shared manifest, and is safe to publish.
833
+ 8. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
834
+ every plugin deployed, and offers to run one right now, interactively - see
835
+ [`aivin test`](#aivin-test) above for why this exists (its automated smoke test skips proxy
836
+ plugins entirely, so this interactive step is currently the *only* built-in way to verify a
837
+ freshly-converted MCP plugin actually works before walking away from the terminal).
838
+
839
+ ```
840
+ Options:
841
+ --publish Deploy to your org, then submit for community store review
842
+ (needs admin approval)
843
+ --private Deploy to your org only - default
844
+ --org Alias of --private - there is no narrower per-workspace scope today
845
+ ```
846
+
847
+ ```bash
848
+ aivin mcp https://github.com/example-org/example-mcp-server
849
+ aivin mcp https://github.com/example-org/example-mcp-server --publish
850
+ ```
851
+
852
+ ## `aivin mcp create <name>`
853
+
854
+ Scaffolds a **manifest-only** plugin (`proxy_config.type: "mcp"`) that proxies straight to an
855
+ external [MCP](https://modelcontextprotocol.io) server's tool/resource/prompt - no `src/main.ts`,
856
+ no `package.json`, nothing to run. `aivin deploy`/`aivin test` detect this automatically.
857
+
858
+ ```
859
+ Options:
860
+ --transport <transport> stdio | sse
861
+ --command <command> Command to launch the MCP server (stdio transport)
862
+ --args <args> Space-separated args for --command (stdio transport)
863
+ --url <url> Remote MCP server URL (sse transport)
864
+ --kind <kind> tool | resource | prompt (default: tool)
865
+ --tool-name <name> MCP tool name (kind=tool)
866
+ --resource-uri <uri> MCP resource URI (kind=resource)
867
+ --resource-mime-type <mime> MIME type of the resource (kind=resource)
868
+ --prompt-name <name> MCP prompt name (kind=prompt)
869
+ --description <description> Plugin description
870
+ --auth-secret-key <key> Name of the workspace secret to use as the
871
+ token/credential, if the MCP server needs auth
872
+ --auth-type <type> auth_type value to send (default: "bearer" when
873
+ --auth-secret-key is set) - check your backend
874
+ for which values it supports
875
+ --connector <id> Existing connector id for this plugin's connection_id
876
+ (readiness/"needs login" display only - see below)
877
+ ```
878
+
879
+ - Fully interactive → run with no flags at all: prompts for everything, in order.
880
+ - Fully flagged → fully non-interactive/scriptable, no prompts. `--transport` and `--kind` are
881
+ inferred from whichever flags you pass (`--command` implies stdio, `--url` implies sse;
882
+ `--tool-name`/`--resource-uri`/`--prompt-name` each imply their own `--kind`) - spell them out
883
+ explicitly only if you're scripting this without any of those (unusual).
884
+ - **Partially flagged, real terminal** → prompts for exactly what's still missing, not everything -
885
+ e.g. `aivin mcp create foo --transport stdio` alone still prompts for `--command` instead of
886
+ failing with a generic validation error.
887
+ - Passing more than one kind-identifying flag at once (e.g. both `--tool-name` and
888
+ `--resource-uri`) without an explicit `--kind` prints a warning and picks one by priority
889
+ (tool → resource → prompt) rather than silently dropping the other with no explanation.
890
+ - Whatever's still missing once prompting is done (or immediately, outside a real terminal) fails
891
+ fast with the exact flag(s) needed, e.g. `Missing required field(s): --command <command>,
892
+ --tool-name <name>`.
893
+
894
+ ```bash
895
+ # stdio (local command)
896
+ aivin mcp create fs-tools --command npx --args "-y @modelcontextprotocol/server-filesystem /data" \
897
+ --tool-name read_file --description "Read files via MCP"
898
+
899
+ # sse (remote server)
900
+ aivin mcp create doc-search --url https://example.com/mcp \
901
+ --tool-name search_docs --description "Search external docs via MCP"
902
+ ```
903
+
904
+ See [MANIFEST.md#mcp-proxy-plugins](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#mcp-proxy-plugins) for the full `proxy_config`
905
+ field reference.
906
+
907
+ **Auth for a `mcp create` plugin, interactively**: leave `--auth-secret-key` off in a real terminal
908
+ and you're asked "Does this MCP server need auth?" with three choices:
909
+
910
+ - **No auth needed.**
911
+ - **One shared token for everyone** (typical for a remote/sse server) - the classic bearer-token
912
+ case, sent as `proxy_config.auth_secret_key`/`auth_type`. One value, shared by the whole org.
913
+ - **One or more environment variables** (typical for a local/stdio server) - drops into a loop
914
+ ("Variable 1 name:", Enter on blank to stop) where each declared name is either left for **every
915
+ workspace to configure on its own** later (no OAuth - the platform's own "configure this plugin"
916
+ screen collects the value per workspace) or bound to a **connector** (search-as-you-type over
917
+ `aivin connector search`'s same endpoint, list your org's if the query is left blank, or register
918
+ a brand new one right there - same flow as `aivin connector register`, no separate command
919
+ needed) for automatic per-user/per-workspace OAuth resolution.
920
+
921
+ This maps onto `manifest.initable`/`manifest.initial[varName].connection_id` - the fields the
922
+ backend's plugin execution path (`PluginProxyService.resolveMcpEnv`) actually reads to merge
923
+ credentials at call time, in increasing priority: the shared `auth_secret_key` first, then each
924
+ workspace's own configured value, then OAuth auto-fill for any field bound to a connector. This is
925
+ genuinely three tiers merged per call, not three alternatives to choose between - declaring some
926
+ fields as connector-bound and others as "workspace configures it" on the very same plugin is normal
927
+ if the MCP server needs more than one kind of credential.
928
+
929
+ Only declarable interactively - like `aivin connector register`, there's no non-interactive/scripted
930
+ form for the env-var loop (declaring several named fields isn't something to automate blindly).
931
+
932
+ **What `--connector <id>` actually does (and doesn't)**: it sets the manifest's top-level
933
+ `connection_id` directly, without going through the loop above. That field only drives the
934
+ "requires logging in to a connector" readiness badge (see `plugin info`/`plugin search`'s detail
935
+ view) - it is **not** read by the MCP execution path at all, so it injects nothing into the running
936
+ MCP server by itself. If you use the interactive env-var loop and bind a field to a connector, the
937
+ top-level `connection_id` gets set *for* you automatically (derived from whichever connector the
938
+ declared field(s) actually use), for consistency with that badge - you shouldn't normally need
939
+ `--connector` directly unless you're deliberately setting the readiness badge independently of any
940
+ declared env var.
941
+
942
+ `aivin mcp <url>` (below) offers a simpler, single-connector version of this same idea - one prompt
943
+ to attach a connector to every generated manifest at once, right before the final deploy
944
+ confirmation, for when a whole MCP server shares one auth scheme rather than needing individual
945
+ per-tool env-var declarations.
946
+
947
+ ## `aivin login`
948
+
949
+ Saves an API key **once, machine-wide**, to `~/.aivin/credentials` - not the current project's
950
+ `.env`. Logging in is a per-machine thing, not a per-project one, so you only need to run this once
951
+ regardless of how many plugin projects you work in - every project's `deploy`/`test`/`plugin make`
952
+ picks it up automatically.
953
+
954
+ ```
955
+ Options:
956
+ -k, --api-key <key> Set API key directly (skip login entirely)
957
+ --basic Log in with email/password directly in the terminal instead of a browser
958
+ --google Alias of the default browser flow - pick Google once the page opens
959
+ --client <client> Client/org id to use with --basic (default: "aivin.cloud")
960
+ ```
961
+
962
+ **Default (no flags) - browser flow, recommended:**
963
+
964
+ ```bash
965
+ aivin login
966
+ ```
967
+
968
+ Opens your default browser to the platform's actual login page (`https://brain.aivin.cloud`) with
969
+ a one-time state token and a `localhost` callback URL. Log in exactly the way you normally would in the
970
+ browser - custom-domain org, password, Google, OTP, whatever applies to your account. Once you
971
+ confirm on the "Aivin CLI wants to create an API Key" prompt that appears after login, a fresh key
972
+ is minted (named after this machine's hostname, replacing any previous key with that same name) and
973
+ handed back to a tiny local HTTP server the CLI started for this one request, then saved to
974
+ `~/.aivin/credentials`. The browser tab never shows you the raw key - only the CLI does.
975
+
976
+ `--google` doesn't change anything technically; it's just documentation that once the page opens
977
+ you can pick "Log in with Google" there, same as any other login on that page.
978
+
979
+ **`--basic` - no browser, terminal-only:**
980
+
981
+ ```bash
982
+ aivin login --basic
983
+ ```
984
+
985
+ Prompts for email/password directly and logs in against the default/shared client only (`--client`,
986
+ falls back to `"aivin.cloud"`). If your account belongs to a custom-domain organization, this won't
987
+ resolve that domain for you - use the default browser flow instead, which handles it the same way
988
+ the web login page does.
989
+
990
+ **Already have a key:**
991
+
992
+ ```bash
993
+ aivin login --api-key <key>
994
+ ```
995
+
996
+ Skips login entirely - just saves the given key to `~/.aivin/credentials`.
997
+
998
+ ## `aivin whoami`
999
+
1000
+ Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1001
+ off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1002
+ (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1003
+ something).
1004
+
1005
+ ```bash
1006
+ aivin whoami
1007
+ ```
1008
+
1009
+ ```
1010
+ ✅ Logged in
1011
+ Email: jane@example.com
1012
+ Name: Jane Doe
1013
+ Org: Acme Inc
1014
+ Server: https://api.aivin.cloud
1015
+ Logged in at: 1/15/2026, 10:30:00 AM
1016
+ ```
1017
+
1018
+ Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1019
+ `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1020
+ once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1021
+ with a different key, `whoami` says so explicitly instead of guessing:
1022
+
1023
+ ```
1024
+ (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1025
+ ```
1026
+
1027
+ ## `aivin key`
1028
+
1029
+ Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1030
+ saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1031
+ revoke independently later.
1032
+
1033
+ ```
1034
+ Commands:
1035
+ gen [options] <name> Create (or replace) a named API key for your account - shown only once
1036
+ revoke [options] <name> Revoke a named API key for your account
1037
+ list [options] List API keys on your account
1038
+ ```
1039
+
1040
+ ```bash
1041
+ aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1042
+ aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1043
+ aivin key list # see what's on your account
1044
+ aivin key revoke "ci-pipeline" # revoke it by name
1045
+ ```
1046
+
1047
+ All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1048
+ `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1049
+ a step-up check, since minting a new key from an existing one is the one action here that could
1050
+ otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1051
+ `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1052
+
1053
+ `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1054
+ re-running `aivin login` replaces this machine's own key.
1055
+
1056
+ ## `aivin browser [mission]`
1057
+
1058
+ Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1059
+ (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1060
+
1061
+ ```
1062
+ Options:
1063
+ --remote Use a server-side pooled browser instead of your own local one (no
1064
+ local browser needed, no cookies/logins carried over)
1065
+ --debug-port <port> Local mode only: port to launch the AI Browser window's remote
1066
+ debugging on (default: 9222, auto-tries a few nearby ports if that
1067
+ one is taken by something else)
1068
+ --browser <edge|chrome|brave|chromium>
1069
+ Local mode only: which browser to drive - default: auto-detects your
1070
+ OS's actual default browser, falling back to whichever of
1071
+ Edge/Chrome/Brave/Chromium is installed
1072
+ --separate-browser Local mode only: always use the dedicated AI Browser window, never
1073
+ your everyday browser
1074
+ --url <url> Local mode only: open this URL before the mission starts, instead of a
1075
+ blank page (auto-guessed for a few well-known sites mentioned by name
1076
+ in the mission if omitted)
1077
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1078
+ --project <id> Project id within the workspace (--remote only)
1079
+ --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1080
+ mode, or the workspace's default agent for --remote)
1081
+ --no-watch Fire the mission and return immediately - skip streaming live
1082
+ progress and auto-opening the viewer
1083
+ --view Just (re)open the fullscreen interactive viewer for whatever HIL
1084
+ session is already active - no mission is started
1085
+ ```
1086
+
1087
+ **Local mode (default)** - drives a browser on your own computer via its remote-debugging protocol
1088
+ (CDP), through the same guarded tunnel `aivin remote` uses. Which browser, in order:
1089
+
1090
+ 1. **Your everyday Chrome/Edge**, if you've switched on remote debugging in it yourself
1091
+ (`chrome://inspect/#remote-debugging`, or `edge://inspect/#remote-debugging`; Chrome 144+). The
1092
+ browser asks you to **Allow** the connection once. Every login you already have works. The AI
1093
+ opens its own tabs in the background, and your own tabs stay read-only to it. `--separate-browser`
1094
+ skips this step.
1095
+ 2. **Otherwise, a dedicated AI Browser window**, on its own profile (`~/.aivin/browser-profile`),
1096
+ not your regular one. Cookies and logins persist there across runs. The first time you use a
1097
+ site, you log in once, same as in a fresh browser. The CLI opens this window itself, and
1098
+ reuses it while it's open. A Chrome/Edge window on any other profile is never attached to, even
1099
+ if it has a debug port open.
1100
+
1101
+ Either way, every command the server sends is filtered. No `file://` or browser-internal pages, no
1102
+ picking files from your disk, and no loading extensions. Downloads always go to `~/Downloads/Aivin`,
1103
+ and executables are cancelled as soon as they start downloading.
1104
+
1105
+ In the AI Browser window, the tabs a mission opens (and the popups they open) are put in one
1106
+ **tab group** named after the mission, with a different color per mission running at the same time.
1107
+ Tab groups have no CDP command, so the CLI loads a small extension of its own into that profile
1108
+ (`~/.aivin/browser-extension/tab-groups`, permissions `tabGroups` + `debugger`). The server can't
1109
+ reach it. A window opened by an older CLI version doesn't have this - close it and rerun. Your
1110
+ everyday browser's tabs are not grouped, because the CLI never installs anything into your own
1111
+ profile.
1112
+
1113
+ If the AI Browser window can't be started, `aivin browser` prints the exact launch command for your
1114
+ OS/browser instead of failing silently:
1115
+
1116
+ ```bash
1117
+ aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1118
+ ```
1119
+
1120
+ A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1121
+ as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1122
+
1123
+ **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1124
+ required, no cookies from your machine carried over. Useful for CI, headless environments, or
1125
+ missions that don't need a logged-in session on a specific real account.
1126
+
1127
+ ```bash
1128
+ aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1129
+ ```
1130
+
1131
+ `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1132
+ is already active, without starting anything new - handy if you closed the auto-opened window by
1133
+ accident.
1134
+
1135
+ ## `aivin remote` — let your agents work on this computer (Device Agent)
1136
+
1137
+ Turns this computer into a device your Aivin agents can hand jobs to (`official.device_agent`): run commands, read/search/edit
1138
+ files, inspect projects and the system — only inside the folder you allow.
1139
+
1140
+ ```bash
1141
+ aivin remote start --dir D:\code # first run pairs this computer (device token), then listens for work
1142
+ aivin remote do "run the tests of the be project and summarize failures"
1143
+ aivin remote devices # your paired computers + online state
1144
+ aivin remote pause | resume # local kill switch - refuses every remote call while paused
1145
+ aivin remote unpair [deviceId] # revoke (token stops working immediately)
1146
+ aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
1147
+ aivin remote meeting start "Weekly sales" --then "summarize and draft an email to my manager" # meeting notes (Windows)
1148
+ aivin remote meeting stop | status | list | show [id]
1149
+ aivin remote status | test | logs | reindex | enable | disable | reset-id
1150
+ ```
1151
+
1152
+ - **Device token, not your API key**: pairing (`POST /plugins/device-agent/devices/pair`) gives this machine its own token
1153
+ (`~/.aivin/device-credentials.json`, the server only keeps a hash). Revoking a device never touches your API key.
1154
+ - **Tools per device**: discovered from what is installed (git, ripgrep, node, python, docker…) — `aivin remote status` lists them.
1155
+ - **Permissions come from the agent's own rules** (autonomous decisions / needs approval / must not): every step that changes
1156
+ something goes through the platform policy gate and may ask you to approve. This computer keeps a hard floor the server cannot
1157
+ change: allowed folder (checked with realpath, symlinks can't escape), secrets stripped from command environments, a safety net
1158
+ against system-destroying commands, and the kill switch.
1159
+ - **Memory stays on this computer**: `~/.aivin/memory/<kind>.yaml` (edit by hand if you like) + `vectors.json`; the agent recalls it
1160
+ before planning and saves procedures that worked.
1161
+ - Env: `AIVIN_REMOTE_HOME` (config folder), `AIVIN_REMOTE_LIMIT_<GROUP>` (parallel limit per tool group: fs_read, fs_write, exec, git, system, memory).
1162
+ - **Stays up to date by itself**: the listener checks for a new release about every hour (and right away when the Aivin server
1163
+ asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
1164
+ computer has had no remote work for 10 minutes; in a window you started yourself it only tells you to restart. If the new release
1165
+ crashes 3 times before it has run for 10 minutes, the previous release is put back and the bad one is skipped - by the auto-start
1166
+ script itself (Windows: the Aivin tray app, or the VBS script on older setups; macOS / Linux `~/.aivin/aivin-remote-run.sh`) when it crashes right at start, otherwise by aivin on the
1167
+ next start. Auto-start set up by an older aivin lacks the first part: run `aivin remote enable` again to get it. See `aivin update`.
1168
+ - The Aivin server can only *suggest* versions (a minimum version, the latest published one, releases on hold) - it can never choose
1169
+ where aivin downloads from or what it installs. If the download site reports an older release than the server knows about, aivin
1170
+ warns once that the site may be blocked; a release on hold (e.g. because several computers had to roll back from it) is not
1171
+ installed by the background updater (`aivin update --to` still can).
1172
+ - **Aivin mascot on screen** (Windows): while the listener runs, a small Aivin bot floats over your windows. Its speech bubble shows
1173
+ the main thing the agent is doing on this computer; drag it anywhere (the spot is remembered). Hover it to **ask Aivin**: a small
1174
+ box pops up above it (and slips away when the mouse leaves, unless you are typing, talking or waiting for an answer); click the
1175
+ bot or the box to type (Enter) - it becomes a real chat on Aivin (also listed in your chats on the web), with the progress and the
1176
+ answer shown in the box. The window you were using right before you reached for the bot (or pressed the mic hotkey) goes along
1177
+ with the question, so "what's wrong here?" or "fill this in" means that window: the agent can read it (`gui.observe`) or take a
1178
+ screenshot (`screen.capture`); it only looks when the question needs it. Or click the mic to **talk with Aivin live**, like the mic on the web: it listens all the time, answers
1179
+ out loud and both sides show up as text in the box; click the mic while it talks to interrupt, while it listens to end. Its voice
1180
+ is not picked up by the mic (your words are ignored while it talks), so interrupt with the button. Right-click it for the detailed activity log and a "Pause AI" button (the same kill switch
1181
+ as `aivin remote pause`). The activity panel also has **Turn mascot off**: the mascot fades and slides away before its window closes,
1182
+ while the listener keeps running in the background. Run `aivin ui` to bring it back immediately, or use `aivin remote mascot on` and
1183
+ restart the listener. Apart from the open ask box it never takes keyboard focus; it is left out of screenshots and screen sharing,
1184
+ and steps aside while the agent controls an app window. `aivin remote mascot off` turns it off persistently; `aivin remote start --no-mascot`
1185
+ hides it for one run. Texts follow `AIVIN_LANG` / the system language. See the dedicated [Aivin mascot guide](AIVIN_MASCOT.md)
1186
+ for interaction, state, shortcut, privacy and troubleshooting details.
1187
+ - **Meeting notes** (Windows): ask the mascot something like "take notes of this meeting, then send my manager a summary". You can also
1188
+ run `aivin remote meeting start "<title>" --then "..."` yourself.
1189
+ - **What's recorded:** the computer's own sound (what the others say) and your microphone, plus a screenshot whenever the screen
1190
+ changes (shared slides). This works with any meeting app (Google Meet, Zoom, Teams, Zalo...), and nobody joins the meeting on
1191
+ your behalf.
1192
+ - **Approval:** the agent can't start a recording on its own. Starting one always needs a click on **Allow** on this computer, and
1193
+ you get a notification while it runs. Tell the other participants that they are being recorded.
1194
+ - **When it stops:** when the meeting window closes and the computer goes quiet, after 10 minutes of silence, after 3 hours, on
1195
+ `aivin remote meeting stop`, or when you press Pause.
1196
+ - **The transcript:** it is made only after the meeting is over, by sending ~30 s pieces through Aivin's voice-to-text.
1197
+ Then the audio files are deleted. If you gave an instruction ("then"), a new chat turn starts by itself with it. The
1198
+ agent reads the transcript with `meeting.transcript`, writes the summary and drafts the email. Sending still asks you on this
1199
+ computer first.
1200
+ - **Where it's stored:** `~/.aivin/meetings/<id>/`, which the file tools can't read. If you name a `save_dir` in the allowed area,
1201
+ it's stored there instead, so the files can be attached to an email.
1202
+ - **Restarts:** if the listener restarts mid-meeting, the transcript is finished on the next start, and background updates wait
1203
+ until the meeting is done. `--no-meetings` (or `AIVIN_REMOTE_MEETINGS=0`) turns it off.
1204
+ - **Speaker labels:** each line of the transcript is labelled **Me** (your microphone) or **Others** (the computer's sound). Pieces
1205
+ are cut where the talking switches between the two. The other participants are not told apart from each other.
1206
+ - **Screenshots on request:** the agent can also take a screenshot of the whole screen (`screen.capture`). The mascot is never in it.
1207
+ - **Clipboard**: the agent can read what you copied (`clipboard.read`) and put text on the clipboard for you to paste
1208
+ (`clipboard.write`). On Windows it can also read images and files copied in Explorer; on macOS (`pbpaste`) and Linux (`wl-paste`,
1209
+ `xclip` or `xsel`) only text. Anything a password manager marks private when copying (KeePass, 1Password, Bitwarden…) is never
1210
+ read. Windows' own clipboard history skips the same content.
1211
+ - **Controlling app windows** (Windows): when a job has no file, command or app API to go through (an accounting or ERP app, a
1212
+ settings dialog, Save As), the agent can read and use app windows like you do.
1213
+ - **How it sees:** it reads the window's accessibility tree, the same list of buttons, fields and menus that screen readers use
1214
+ (`gui.observe`, `gui.find` for big windows). When an app draws its own interface and the tree is nearly empty, it takes a
1215
+ screenshot and reads the text on it with Windows' built-in OCR, on this computer. Install the Vietnamese OCR language pack
1216
+ (Settings → Time & language → Language & region → Vietnamese) for Vietnamese text.
1217
+ - **How it acts:** clicks, fills fields, ticks boxes, picks list items, scrolls, presses shortcuts (`gui.act`), opens installed apps
1218
+ or documents in the allowed folders (`gui.open_app`), and waits for a dialog or button to appear (`gui.wait_for`). It uses the
1219
+ app's accessibility actions first, so most steps work while the window stays behind yours. Only when an app needs the real
1220
+ mouse or keyboard does it bring the window to the front. Windows it opens are sent behind yours.
1221
+ - **You stay in control:** touch the mouse or keyboard and the agent stops before its next real mouse/keyboard step and asks you.
1222
+ The first time it controls a window (then at most every 5 minutes) you get a notification. `aivin remote pause` or the mascot's
1223
+ "Pause AI" stops everything.
1224
+ - **What it never does:** type into password fields, control password managers, UAC prompts, the lock screen or Windows Security,
1225
+ or open programs and scripts by path. Unless the computer was started with `--full-access`, it also leaves terminals,
1226
+ Registry Editor, Task Manager, code editors (VS Code, Cursor, JetBrains…) and agent apps (Claude, ChatGPT…) alone, because
1227
+ typing commands there would get around the allowed folders.
1228
+ - **When it asks first:** paying, deleting for good, signing out, or pressing Send / Post when you did not ask for it to be sent.
1229
+ Other clicks don't ask, unless the agent's own rules say so.
1230
+ - Excel, Word and Outlook go through the apps directly (`office.*`), without clicking. `--no-gui` turns window control off.
1231
+
1232
+ ## `aivin ui`
1233
+
1234
+ Shows the Aivin mascot with its ask box open, ready to type (Windows). If the listener (`aivin remote start`) is not running it is
1235
+ started in the background - through the Aivin tray app when it is installed (`aivin desktop install`), else the older "Aivin Remote"
1236
+ scheduled task, otherwise as a detached process. A computer that is not connected yet gets the pairing instructions.
1237
+
1238
+ Preview all eight mascot animations locally without pairing or starting the listener:
1239
+
1240
+ ```bash
1241
+ aivin ui --demo
1242
+ ```
1243
+
1244
+ Current live-interface capture showing chat, file drag and attached files: [media/aivin-mascot-live.gif](media/aivin-mascot-live.gif)
1245
+
1246
+ ## `aivin desktop`
1247
+
1248
+ Puts Aivin on the desktop like a regular app: an icon you can click, an entry the system search finds, and a start-with-the-computer
1249
+ setting you can change in the system's own settings. The installers (`install.ps1`, `install.sh`) run `aivin desktop install` for you
1250
+ (on Linux only when there is a graphical session; `AIVIN_NO_DESKTOP=1` skips it, `AIVIN_NO_AUTOSTART=1` installs without starting with
1251
+ the computer).
1252
+
1253
+ ```bash
1254
+ aivin desktop install # app + search entry + start with the computer (on by default)
1255
+ aivin desktop install --no-autostart # same, without starting with the computer
1256
+ aivin desktop uninstall # closes the app (and the listener it runs), removes all of it - `aivin` itself stays
1257
+ aivin desktop # status
1258
+ ```
1259
+
1260
+ | | Windows | macOS | Linux |
1261
+ |---|---|---|---|
1262
+ | Icon | system tray (`%LOCALAPPDATA%\Aivin\Aivin.exe`) | menu bar (`~/Applications/Aivin.app`) | system tray (needs python3 + AppIndicator) |
1263
+ | Found by | Start menu | Spotlight / Launchpad | app menu (`~/.local/share/applications/aivin.desktop`) |
1264
+ | Start with the computer | Task Manager → Startup apps | System Settings → General → Login Items | Startup Applications (GNOME) / Autostart (KDE) |
1265
+
1266
+ - **The icon** is in colour while Aivin is taking work, grey when paused, stopped or not connected. Its menu: connect this computer
1267
+ (asks for the code from Aivin), pause / resume work (the kill switch), start with the computer, quit
1268
+ (which also stops the listener). On Windows, clicking the icon opens the mascot and its ask box.
1269
+ - **Keeps the listener running**: the app runs `aivin remote start --quiet` hidden. It restarts it when it crashes (after 10 s, then
1270
+ longer, up to 5 minutes), switches to a newly installed release right away (exit code 75), and puts the previous release back when a
1271
+ new one keeps crashing at start. If you run `aivin remote start` yourself in a terminal, the app leaves it alone and takes over again
1272
+ once you close that window. Opening Aivin from the search again while it runs just opens it.
1273
+ - **Start with the computer** is one setting, whichever way you change it: the app's menu, `aivin remote enable` / `disable`, or the
1274
+ system settings in the table. `aivin remote disable` only switches it off, so it stays listed and can be switched back on there.
1275
+ - Windows: an `Aivin` value under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, listed as "AIVIN Bot" (publisher Aivin Labs); the Start menu entry has the same name.
1276
+ `Aivin.exe` is compiled on your computer by the C# compiler that comes with Windows (.NET Framework), so nothing is downloaded.
1277
+ If that compiler is blocked, `aivin remote enable` falls back to the "Aivin Remote" scheduled task (not shown in Task Manager).
1278
+ - macOS: the LaunchAgent `~/Library/LaunchAgents/com.aivin.remote.plist` opens `Aivin.app`, so Login Items lists it as "Aivin". If
1279
+ you switch it off in Login Items, Aivin's own menu may still show it as on (macOS does not let apps read that switch).
1280
+ - Linux: `~/.config/autostart/aivin.desktop` (switched off = `Hidden=true` / `X-GNOME-Autostart-enabled=false`). Without a graphical
1281
+ session (servers, SSH), `aivin remote enable` keeps using the systemd user service as before.
1282
+ - **Linux without a tray icon**: GNOME shows tray icons only with the AppIndicator extension (Ubuntu has it). Without python3's
1283
+ AppIndicator binding (`sudo apt install gir1.2-ayatanaappindicator3-0.1` on Ubuntu / Debian), Aivin still runs in the background,
1284
+ just without an icon - connect it with `aivin remote start --code <code>` once.
1285
+ - Running `aivin remote enable` again replaces the scheduled task, Startup-folder script or older LaunchAgent / autostart entry made by
1286
+ older aivin versions.
1287
+ - **Open with AIVIN Bot** (Windows): install also adds "Open with AIVIN Bot" to the right-click menu (Windows 11: "Show more options")
1288
+ and to "Open with" for `docx doc odt rtf xlsx xls xlsm ods csv pptx ppt odp pdf md txt` - see [`aivin open`](#aivin-open-files). Only
1289
+ `HKCU\Software` is written (no admin). Windows doesn't let apps make themselves the default, so to open those files with a double-click
1290
+ either pick Open with → AIVIN Bot → "Always", or run `aivin desktop defaults` to go straight to AIVIN Bot's page in Settings → Default
1291
+ apps. For a whole company, `aivin desktop defaults --export-xml <file> [--all]` writes a file IT can push with the Group Policy "Set a
1292
+ default associations configuration file" or Intune (`md txt csv` by default, `--all` adds Office formats).
1293
+ - **Share with AIVIN Bot** (Windows): right-click any file or folder (one or many) → "Share with AIVIN Bot", or Send to → AIVIN Bot.
1294
+ The items are attached to the bot's chat box on screen, the same as dropping them on the mascot (see [`aivin share`](#aivin-share-paths)).
1295
+ - **Work here with AIVIN Bot** (Windows): right-click the empty space inside a folder, or the folder itself. The folder becomes the bot's
1296
+ working folder: a chip above the chat box shows it, every question you type goes out with it, and it stays across restarts until you
1297
+ click × on the chip. If the folder is outside the folders Aivin may use, a dialog on this computer asks first; once you allow it, Aivin can
1298
+ read, write and run commands there. Take that back with `aivin remote forget-folder <path>`. Network folders can't be used. Live voice
1299
+ conversations don't use the working folder.
1300
+ - Machines that installed Aivin earlier and only auto-update get all these menu items without reinstalling: each time `aivin remote start`
1301
+ starts, it rebuilds `Aivin.exe` if its code changed, rewrites the registry entries if they changed or were removed, and adds the
1302
+ Send to shortcut if it's missing.
1303
+
1304
+ ## `aivin uninstall` (Windows)
1305
+
1306
+ Removes Aivin from this computer: the app and everything `aivin desktop uninstall` removes, the `aivin` command and its PATH entry, and this
1307
+ computer's connection to your account (device token, sign-in key). `aivin desktop install` also adds **AIVIN Bot** to Programs & Features and
1308
+ Settings → Apps, and uninstalling there does the same thing after asking whether to delete your data.
1309
+
1310
+ ```bash
1311
+ aivin uninstall # asks first
1312
+ aivin uninstall --yes # keeps your data in .aivin
1313
+ aivin uninstall --yes --delete-data
1314
+ ```
1315
+
1316
+ Your data in `.aivin` (the bot's memory, file copies kept for undo, browser sign-ins, logs) stays unless you choose to delete it; deleting cannot
1317
+ be undone. If you weren't signed in on this computer or the server can't be reached, the computer stays listed on your account as offline, with no
1318
+ token left here; revoke it in Aivin if you want it gone. An install from npm keeps the command: run `npm rm -g @aivin-labs/cli`.
1319
+
1320
+ ## `aivin share <paths...>`
1321
+
1322
+ Attaches files or folders to the AIVIN Bot chat box on this computer, the same as dropping them on the mascot. Type your question and
1323
+ they go with it (up to 10 items). This needs `aivin remote start` running, and requests older than 2 minutes are dropped. On Windows,
1324
+ right-click → "Share with AIVIN Bot" does the same thing and also starts the tray app if it isn't running.
1325
+
1326
+ ## `aivin open <files...>`
1327
+
1328
+ Opens files from this computer in your Aivin Drive: uploads each file to your personal workspace (or `--workspace <id>`) and opens it
1329
+ in the Aivin editor in your browser. The Drive copy is the one you work on from then on:
1330
+
1331
+ - the **same content** opened again reopens the same Drive file (with whatever you changed there) - matched by sha256 in
1332
+ `~/.aivin/opened-files.json`;
1333
+ - a file that **changed on this computer** is uploaded as a new Drive file - the earlier Drive copy is never overwritten.
1334
+
1335
+ ```bash
1336
+ aivin open contract.docx report.pdf
1337
+ aivin open budget.xlsx --workspace <id>
1338
+ aivin open notes.md --tab # a normal browser tab instead of its own window
1339
+ aivin open notes.md --print # print the Drive link instead of opening anything
1340
+ ```
1341
+
1342
+ Files open in their own window (no address bar or tabs) when your default browser is Chromium-based (Edge, Chrome, Brave), since that is
1343
+ where your Aivin sign-in lives. With any other default browser they open in a normal tab.
1344
+
1345
+ **Not signed in (or the saved key was revoked): view only.** Nothing is uploaded to your Drive. `aivin open` serves a read-only page from
1346
+ this computer (`127.0.0.1`, random path) and keeps running until you close that window:
1347
+
1348
+ - `.pdf`, `.md`, `.txt`, `.csv` are shown straight from this computer.
1349
+ - Office files (`docx doc odt rtf xlsx xls xlsm ods pptx ppt odp`) are converted to PDF by the Aivin server, which does not keep the
1350
+ file. The page asks first; "Don't ask again on this computer" is saved in `~/.aivin/open-settings.json`. Servers that turned this off
1351
+ answer "sign in to open it". The PDF is kept on this computer in `~/.aivin/preview-cache/` (by file content, up to 500 MB, unused
1352
+ copies removed after 30 days), so opening the same unchanged file again shows it at once without sending anything.
1353
+ - **Sign in to edit and use AI** runs the browser sign-in of `aivin login`, uploads the file to your Drive and switches the same window to
1354
+ the editor.
1355
+
1356
+ Opened from Explorer, `Aivin.exe --open "<file>"` runs this command hidden (no console window) and shows a system notification while it
1357
+ uploads, or when it fails (e.g. not signed in - run `aivin login`). Needs a server that accepts CLI API keys on Drive upload (Aivin
1358
+ backend from 04/11/2026).
1359
+
1360
+ ## `aivin update`
1361
+
1362
+ Updates the standalone `aivin` (installed with `install.ps1` / `install.sh`) from the same download site as the installer:
1363
+ reads `latest.txt`, checks the release's Ed25519 signature (`SHA256SUMS.sig`, verified against the release keys built into aivin -
1364
+ an unsigned or wrongly signed release is refused before its build is even downloaded), downloads that release's build for this
1365
+ computer, checks it against the signed `SHA256SUMS`, makes sure the new build starts (`--version`, run without your API key or tokens
1366
+ in its environment), then replaces the installed file. The previous file is kept as `aivin.prev` / `aivin.exe.prev` until the new one
1367
+ has run fine.
1368
+
1369
+ ```bash
1370
+ aivin update # install the latest release
1371
+ aivin update --check # only tell whether a newer release exists
1372
+ aivin update --to v1.0.8 # install a specific release (also goes back)
1373
+ aivin update --auto off # stop background updates of `aivin remote start` on this computer (on: turn them back on)
1374
+ ```
1375
+
1376
+ - npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
1377
+ - The build is streamed to disk while its SHA-256 is computed and it is unpacked, with size caps on both the download and the
1378
+ unpacked file - nothing large is held in memory, and an oversized or tampered download stops the update without touching the
1379
+ installed file.
1380
+ - The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
1381
+ (e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
1382
+ `https` is accepted (plain `http` only to this computer itself), redirects included.
1383
+ - Releases can be rolled out to a share of running computers first (`rollout.json` on the download site); `aivin update` run by
1384
+ hand ignores that.
1385
+ - Turn background updates off for one run with `aivin remote start --no-auto-update`, or with `AIVIN_AUTO_UPDATE=0`.
1386
+
1387
+ ## `aivin do <agent_nickname> <mission>`
1388
+
1389
+ Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1390
+ not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1391
+ progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1392
+ and choosing which AI Staff agent should handle it.
1393
+
1394
+ ```
1395
+ Options:
1396
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1397
+ --project <id> Project id within the workspace
1398
+ --no-watch Fire the mission and return immediately - skip streaming live progress
1399
+ ```
1400
+
1401
+ ```bash
1402
+ aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1403
+ ```
1404
+
1405
+ - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1406
+ nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1407
+ prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1408
+ given (in a non-interactive shell, both are required up front).
1409
+ - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1410
+ yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1411
+ one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1412
+ make` below, which this reuses).
1413
+
1414
+ By default it then streams the mission's live progress in the terminal (same realtime channel
1415
+ `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1416
+ `--no-watch` to just fire it and return immediately instead.
1417
+
1418
+ If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1419
+ that first when no workspace is given).
1420
+
1421
+ ### `aivin do job <description>`
1422
+
1423
+ Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1424
+ of any single chat/mission invocation (`POST /automation/jobs/create`).
1425
+
1426
+ ```
1427
+ Options:
1428
+ --workspace <id> Workspace id to create the job in (default: your personal workspace)
1429
+ --project <id> Project id within the workspace
1430
+ --agent <id> Agent id the job runs as (default: the workspace's default agent)
1431
+ --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1432
+ platform infer one)
1433
+ ```
1434
+
1435
+ ```bash
1436
+ aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1437
+ aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1438
+ ```
1439
+
1440
+ If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1441
+ description itself - pass it explicitly if you already know the cadence, to skip the extra
1442
+ inference call.
1443
+
1444
+ ## `aivin task [description]`
1445
+
1446
+ Creates a new task (`POST /task/create`) from a plain-language description - the description
1447
+ becomes both the task's title (truncated if long) and its full content.
1448
+
1449
+ ```
1450
+ Options:
1451
+ --workspace <id> Workspace id to create the task in (default: your personal workspace)
1452
+ --project <id> Project id within the workspace
1453
+ --assignee <userId> User id to assign the task to (default: unassigned)
1454
+ ```
1455
+
1456
+ ```bash
1457
+ aivin task "Follow up with the customer about their refund request"
1458
+ ```
1459
+
1460
+ `aivin task` also has subcommands for the rest of the task lifecycle:
1461
+
1462
+ ```
1463
+ Commands:
1464
+ list [options] List tasks in a project
1465
+ mine [options] List tasks assigned to you in a project
1466
+ get [id] Get a task by id
1467
+ update [options] [id] Update a task
1468
+ delete [id] Delete a task
1469
+ ```
1470
+
1471
+ ```bash
1472
+ aivin task list --status todo # list open tasks in your first project
1473
+ aivin task list --project <id> --assignee <userId> # filter by project/assignee
1474
+ aivin task mine # tasks assigned to you
1475
+ aivin task get <id> # full task details (JSON)
1476
+ aivin task update <id> --status done # move a task to done
1477
+ aivin task update <id> --title "New title" --priority high
1478
+ aivin task delete <id>
1479
+ ```
1480
+
1481
+ `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1482
+ `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1483
+ Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1484
+ `aivin workspace` to find one).
1485
+
1486
+ ## `aivin workspace`
1487
+
1488
+ Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1489
+ lists that workspace's projects so you can pick the corresponding one - printing the resolved
1490
+ `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1491
+
1492
+ ```
1493
+ Options:
1494
+ --plain Print a flat list instead of the interactive picker (for scripts/CI)
1495
+ ```
1496
+
1497
+ ```bash
1498
+ aivin workspace
1499
+ ```
1500
+
1501
+ Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1502
+ interactive prompts.
1503
+
1504
+ ## `aivin agent`
1505
+
1506
+ Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1507
+ publish one you own. `aivin do` calls into the same install/create flows automatically when it
1508
+ can't resolve `<agent_nickname>`.
1509
+
1510
+ ```
1511
+ Commands:
1512
+ search [options] [query] Search the AI Staff marketplace for an agent
1513
+ install [options] [query] Search the marketplace and install an agent into a workspace
1514
+ make [options] Create a brand new AI Staff agent
1515
+ publish [options] [agentId] Publish an agent you own to the marketplace
1516
+ ```
1517
+
1518
+ ```bash
1519
+ aivin agent search "customer support" # browse the marketplace
1520
+ aivin agent install "customer support" # search + pick + install into your personal workspace
1521
+ aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1522
+ aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1523
+ aivin agent publish <agentId> # make an agent you own visible in the marketplace
1524
+ ```
1525
+
1526
+ - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1527
+ - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1528
+ the new agent there too (no separate `install` call needed).
1529
+ - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1530
+ `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1531
+ shared master) - both scoped to the workspace the agent actually lives/was authored in.
1532
+
1533
+ ## `aivin project`
1534
+
1535
+ Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1536
+ endpoint - use `aivin workspace` to browse a workspace's existing projects).
1537
+
1538
+ ```
1539
+ Commands:
1540
+ create [options] [name] Create a new project in a workspace
1541
+ update [options] [id] Update a project (currently: rename)
1542
+ delete [options] [id] Delete a project
1543
+ ```
1544
+
1545
+ ```bash
1546
+ aivin project create "Q3 Launch"
1547
+ aivin project update <id> --name "Q3 Launch (renamed)"
1548
+ aivin project delete <id>
1549
+ ```
1550
+
1551
+ All three default to your personal workspace when `--workspace` is omitted.
1552
+
1553
+ ## Environment variables
1554
+
1555
+ `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1556
+ machine picks it up automatically - there's no per-project credential to manage.
1557
+
1558
+ | Variable | Used by | Default | When you'd touch it |
1559
+ | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1560
+ | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` | Point `main()`'s SDK calls at a local/dev/staging backend instead of production. Staging: `beta-sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1561
+ | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` | Only for a self-hosted or staging instance. Staging: `https://beta-api.aivin.vn`. |
1562
+ | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` | Only for a self-hosted or staging instance. |
1563
+ | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1564
+ | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` | Loopback-only by default (`/invoke` has no auth) - only widen this if you deliberately want another device on your network to reach it. See [sdk repo's SECURITY.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SECURITY.md). |
1565
+ | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` | Set `true` to run `src/main.ts` inside an isolated `worker_threads.Worker` (no direct access to the container's secret, restricted fs/child_process) instead of loading it in-process. Off by default - see [sdk repo's worker-sandbox.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/draft/plugins/worker-sandbox.md). |
1566
+
1567
+ Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1568
+ either injected automatically inside a deployed container or has a working zero-config default -
1569
+ not something you're expected to set by hand.
1570
+
1571
+ ## See also
1572
+
1573
+ - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1574
+ - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1575
+ - [PLUGIN_DEVELOPMENT_GUIDE.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/PLUGIN_DEVELOPMENT_GUIDE.md) - writing and testing a handler
1576
+ - [SDK.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SDK.md) - everything the SDK exposes inside `main()`