@aivin-labs/cli 1.0.51 → 1.0.57

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,1602 +1,1606 @@
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://app.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 server`
999
-
1000
- Choose which Aivin server this machine uses. The choice is stored in `~/.aivin/server.json`; CLI API login contexts and remote-device pairing tokens remain separate for each server.
1001
-
1002
- ```bash
1003
- aivin server # show the active server
1004
- aivin server cloud # production API (https://api.aivin.cloud)
1005
- aivin server vn # Vietnam API (https://api.aivin.vn)
1006
- aivin server local # localhost:3001
1007
- aivin server local:3247 # localhost on a custom port
1008
- aivin server https://host # self-hosted server
1009
- ```
1010
-
1011
- `aivin server <target> --force` skips the confirmation before stopping a running remote connection. Installers use this when applying the environment selected by their download domain. Reinstalling from a different Aivin domain can require pairing the computer again on that server. Set `AIVIN_PRESERVE_SERVER=1` before reinstalling to keep the current server.
1012
-
1013
- Aivin-owned `*.aivin.cloud` and `*.aivin.vn` hosts resolve to their API host, while explicit API hosts are retained. Only localhost accepts HTTP. The tray menu also has Cloud, VN, and Local choices. Switching servers with a running daemon asks before stopping its current work; the tray then reconnects using that server?s saved pairing, or asks to pair if none exists. Pairing codes are server-specific, so include `--server` when a code was created on a non-default server.
1014
- ## `aivin whoami`
1015
-
1016
- Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1017
- off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1018
- (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1019
- something).
1020
-
1021
- ```bash
1022
- aivin whoami
1023
- ```
1024
-
1025
- ```
1026
- ✅ Logged in
1027
- Email: jane@example.com
1028
- Name: Jane Doe
1029
- Org: Acme Inc
1030
- Server: https://api.aivin.cloud
1031
- Logged in at: 1/15/2026, 10:30:00 AM
1032
- ```
1033
-
1034
- Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1035
- `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1036
- once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1037
- with a different key, `whoami` says so explicitly instead of guessing:
1038
-
1039
- ```
1040
- (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1041
- ```
1042
-
1043
- ## `aivin key`
1044
-
1045
- Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1046
- saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1047
- revoke independently later.
1048
-
1049
- ```
1050
- Commands:
1051
- gen [options] <name> Create (or replace) a named API key for your account - shown only once
1052
- revoke [options] <name> Revoke a named API key for your account
1053
- list [options] List API keys on your account
1054
- ```
1055
-
1056
- ```bash
1057
- aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1058
- aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1059
- aivin key list # see what's on your account
1060
- aivin key revoke "ci-pipeline" # revoke it by name
1061
- ```
1062
-
1063
- All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1064
- `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1065
- a step-up check, since minting a new key from an existing one is the one action here that could
1066
- otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1067
- `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1068
-
1069
- `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1070
- re-running `aivin login` replaces this machine's own key.
1071
-
1072
- ## `aivin browser [mission]`
1073
-
1074
- Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1075
- (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1076
-
1077
- ```
1078
- Options:
1079
- --remote Use a server-side pooled browser instead of your own local one (no
1080
- local browser needed, no cookies/logins carried over)
1081
- --debug-port <port> Local mode only: port to launch the AI Browser window's remote
1082
- debugging on (default: 9222, auto-tries a few nearby ports if that
1083
- one is taken by something else)
1084
- --browser <edge|chrome|brave|chromium>
1085
- Local mode only: which browser to drive - default: auto-detects your
1086
- OS's actual default browser, falling back to whichever of
1087
- Edge/Chrome/Brave/Chromium is installed
1088
- --separate-browser Local mode only: always use the dedicated AI Browser window, never
1089
- your everyday browser
1090
- --url <url> Local mode only: open this URL before the mission starts, instead of a
1091
- blank page (auto-guessed for a few well-known sites mentioned by name
1092
- in the mission if omitted)
1093
- --workspace <id> Workspace id to run in (default: your personal workspace)
1094
- --project <id> Project id within the workspace (--remote only)
1095
- --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1096
- mode, or the workspace's default agent for --remote)
1097
- --no-watch Fire the mission and return immediately - skip streaming live
1098
- progress and auto-opening the viewer
1099
- --view Just (re)open the fullscreen interactive viewer for whatever HIL
1100
- session is already active - no mission is started
1101
- ```
1102
-
1103
- **Local mode (default)** - drives a browser on your own computer via its remote-debugging protocol
1104
- (CDP), through the same guarded tunnel `aivin remote` uses. Which browser, in order:
1105
-
1106
- 1. **Your everyday Chrome/Edge**, if you've switched on remote debugging in it yourself
1107
- (`chrome://inspect/#remote-debugging`, or `edge://inspect/#remote-debugging`; Chrome 144+). The
1108
- browser asks you to **Allow** the connection once. Every login you already have works. The AI
1109
- opens its own tabs in the background, and your own tabs stay read-only to it. `--separate-browser`
1110
- skips this step.
1111
- 2. **Otherwise, a dedicated AI Browser window**, on its own profile (`~/.aivin/browser-profile`),
1112
- not your regular one. Cookies and logins persist there across runs. The first time you use a
1113
- site, you log in once, same as in a fresh browser. The CLI opens this window itself, and
1114
- reuses it while it's open. A Chrome/Edge window on any other profile is never attached to, even
1115
- if it has a debug port open.
1116
-
1117
- Either way, every command the server sends is filtered. No `file://` or browser-internal pages, no
1118
- picking files from your disk, and no loading extensions. Downloads always go to `~/Downloads/Aivin`,
1119
- and executables are cancelled as soon as they start downloading.
1120
-
1121
- In the AI Browser window, the tabs a mission opens (and the popups they open) are put in one
1122
- **tab group** named after the mission, with a different color per mission running at the same time.
1123
- Tab groups have no CDP command, so the CLI loads a small extension of its own into that profile
1124
- (`~/.aivin/browser-extension/tab-groups`, permissions `tabGroups` + `debugger`). The server can't
1125
- reach it. A window opened by an older CLI version doesn't have this - close it and rerun. Your
1126
- everyday browser's tabs are not grouped, because the CLI never installs anything into your own
1127
- profile.
1128
-
1129
- If the AI Browser window can't be started, `aivin browser` prints the exact launch command for your
1130
- OS/browser instead of failing silently:
1131
-
1132
- ```bash
1133
- aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1134
- ```
1135
-
1136
- A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1137
- as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1138
-
1139
- **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1140
- required, no cookies from your machine carried over. Useful for CI, headless environments, or
1141
- missions that don't need a logged-in session on a specific real account.
1142
-
1143
- ```bash
1144
- aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1145
- ```
1146
-
1147
- `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1148
- is already active, without starting anything new - handy if you closed the auto-opened window by
1149
- accident.
1150
-
1151
- ## `aivin remote` — let your agents work on this computer (Device Agent)
1152
-
1153
- Turns this computer into a device your Aivin agents can hand jobs to (`official.device_agent`): run commands, read/search/edit
1154
- files, inspect projects and the system — only inside the folder you allow.
1155
-
1156
- ```bash
1157
- aivin remote start --dir D:\code # first run pairs this computer (device token), then listens for work
1158
- aivin remote do "run the tests of the be project and summarize failures"
1159
- aivin remote devices # your paired computers + online state
1160
- aivin remote pause | resume # local kill switch - refuses every remote call while paused
1161
- aivin remote unpair [deviceId] # revoke (token stops working immediately)
1162
- aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
1163
- aivin remote meeting start "Weekly sales" --then "summarize and draft an email to my manager" # meeting notes (Windows)
1164
- aivin remote meeting stop | status | list | show [id]
1165
- aivin remote status | test | logs | reindex | enable | disable | reset-id
1166
- ```
1167
-
1168
- - **Device token, not your API key**: pairing (`POST /plugins/device-agent/devices/pair`) gives this machine its own token
1169
- (`~/.aivin/device-credentials.json`, the server only keeps a hash). Revoking a device never touches your API key.
1170
- - **Tools per device**: discovered from what is installed (git, ripgrep, node, python, docker…) — `aivin remote status` lists them.
1171
- - **Permissions come from the agent's own rules** (autonomous decisions / needs approval / must not): every step that changes
1172
- something goes through the platform policy gate and may ask you to approve. This computer keeps a hard floor the server cannot
1173
- change: allowed folder (checked with realpath, symlinks can't escape), secrets stripped from command environments, a safety net
1174
- against system-destroying commands, and the kill switch.
1175
- - **Memory stays on this computer**: `~/.aivin/memory/<kind>.yaml` (edit by hand if you like) + `vectors.json`; the agent recalls it
1176
- before planning and saves procedures that worked.
1177
- - Env: `AIVIN_REMOTE_HOME` (config folder), `AIVIN_REMOTE_LIMIT_<GROUP>` (parallel limit per tool group: fs_read, fs_write, exec, git, system, memory).
1178
- - **Stays up to date by itself**: the listener checks for a new release about every hour (and right away when the Aivin server
1179
- asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
1180
- 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
1181
- 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
1182
- 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
1183
- 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`.
1184
- - The Aivin server can only *suggest* versions (a minimum version, the latest published one, releases on hold) - it can never choose
1185
- where aivin downloads from or what it installs. If the download site reports an older release than the server knows about, aivin
1186
- 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
1187
- installed by the background updater (`aivin update --to` still can).
1188
- - **Aivin mascot on screen** (Windows): while the listener runs, a small Aivin bot floats over your windows. Its speech bubble shows
1189
- the main thing the agent is doing on this computer; drag it anywhere (the spot is remembered). Hover it to **ask Aivin**: a small
1190
- box pops up above it (and slips away when the mouse leaves, unless you are typing, talking or waiting for an answer); click the
1191
- 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
1192
- answer shown in the box. The window you were using right before you reached for the bot (or pressed the mic hotkey) goes along
1193
- 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
1194
- 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
1195
- 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
1196
- 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
1197
- as `aivin remote pause`). The activity panel also has **Turn mascot off**: the mascot fades and slides away before its window closes,
1198
- while the listener keeps running in the background. Run `aivin ui` to bring it back immediately, or use `aivin remote mascot on` and
1199
- restart the listener. Apart from the open ask box it never takes keyboard focus; it is left out of screenshots and screen sharing,
1200
- and steps aside while the agent controls an app window. `aivin remote mascot off` turns it off persistently; `aivin remote start --no-mascot`
1201
- hides it for one run. Texts follow `AIVIN_LANG` / the system language. See the dedicated [Aivin mascot guide](AIVIN_MASCOT.md)
1202
- for interaction, state, shortcut, privacy and troubleshooting details.
1203
- - **Meeting notes** (Windows): ask the mascot something like "take notes of this meeting, then send my manager a summary". You can also
1204
- run `aivin remote meeting start "<title>" --then "..."` yourself.
1205
- - **What's recorded:** the computer's own sound (what the others say) and your microphone, plus a screenshot whenever the screen
1206
- changes (shared slides). This works with any meeting app (Google Meet, Zoom, Teams, Zalo...), and nobody joins the meeting on
1207
- your behalf.
1208
- - **Approval:** the agent can't start a recording on its own. Starting one always needs a click on **Allow** on this computer, and
1209
- you get a notification while it runs. Tell the other participants that they are being recorded.
1210
- - **When it stops:** when the meeting window closes and the computer goes quiet, after 10 minutes of silence, after 3 hours, on
1211
- `aivin remote meeting stop`, or when you press Pause.
1212
- - **The transcript:** it is made only after the meeting is over, by sending ~30 s pieces through Aivin's voice-to-text.
1213
- Then the audio files are deleted. If you gave an instruction ("then"), a new chat turn starts by itself with it. The
1214
- agent reads the transcript with `meeting.transcript`, writes the summary and drafts the email. Sending still asks you on this
1215
- computer first.
1216
- - **Where it's stored:** `~/.aivin/meetings/<id>/`, which the file tools can't read. If you name a `save_dir` in the allowed area,
1217
- it's stored there instead, so the files can be attached to an email.
1218
- - **Restarts:** if the listener restarts mid-meeting, the transcript is finished on the next start, and background updates wait
1219
- until the meeting is done. `--no-meetings` (or `AIVIN_REMOTE_MEETINGS=0`) turns it off.
1220
- - **Speaker labels:** each line of the transcript is labelled **Me** (your microphone) or **Others** (the computer's sound). Pieces
1221
- are cut where the talking switches between the two. The other participants are not told apart from each other.
1222
- - **Screenshots on request:** the agent can also take a screenshot of the whole screen (`screen.capture`). The mascot is never in it.
1223
- - **Clipboard**: the agent can read what you copied (`clipboard.read`) and put text on the clipboard for you to paste
1224
- (`clipboard.write`). On Windows it can also read images and files copied in Explorer; on macOS (`pbpaste`) and Linux (`wl-paste`,
1225
- `xclip` or `xsel`) only text. Anything a password manager marks private when copying (KeePass, 1Password, Bitwarden…) is never
1226
- read. Windows' own clipboard history skips the same content.
1227
- - **Controlling app windows** (Windows): when a job has no file, command or app API to go through (an accounting or ERP app, a
1228
- settings dialog, Save As), the agent can read and use app windows like you do.
1229
- - **How it sees:** it reads the window's accessibility tree, the same list of buttons, fields and menus that screen readers use
1230
- (`gui.observe`, `gui.find` for big windows). When an app draws its own interface and the tree is nearly empty, it takes a
1231
- screenshot and reads the text on it with Windows' built-in OCR, on this computer. Install the Vietnamese OCR language pack
1232
- (Settings → Time & language → Language & region → Vietnamese) for Vietnamese text.
1233
- - **How it acts:** clicks, fills fields, ticks boxes, picks list items, scrolls, presses shortcuts (`gui.act`), opens installed apps
1234
- or documents in the allowed folders (`gui.open_app`), and waits for a dialog or button to appear (`gui.wait_for`). It uses the
1235
- app's accessibility actions first, so most steps work while the window stays behind yours. Only when an app needs the real
1236
- mouse or keyboard does it bring the window to the front. Windows it opens are sent behind yours.
1237
- - **You stay in control:** touch the mouse or keyboard and the agent stops before its next real mouse/keyboard step and asks you.
1238
- The first time it controls a window (then at most every 5 minutes) you get a notification. `aivin remote pause` or the mascot's
1239
- "Pause AI" stops everything.
1240
- - **What it never does:** type into password fields, control password managers, UAC prompts, the lock screen or Windows Security,
1241
- or open programs and scripts by path. Unless the computer was started with `--full-access`, it also leaves terminals,
1242
- Registry Editor, Task Manager, code editors (VS Code, Cursor, JetBrains…) and agent apps (Claude, ChatGPT…) alone, because
1243
- typing commands there would get around the allowed folders.
1244
- - **When it asks first:** paying, deleting for good, signing out, or pressing Send / Post when you did not ask for it to be sent.
1245
- Other clicks don't ask, unless the agent's own rules say so.
1246
- - Excel, Word and Outlook go through the apps directly (`office.*`), without clicking. `--no-gui` turns window control off.
1247
-
1248
- ## `aivin ui`
1249
-
1250
- Shows the Aivin mascot with its ask box open, ready to type (Windows). If the listener (`aivin remote start`) is not running it is
1251
- started in the background - through the Aivin tray app when it is installed (`aivin desktop install`), else the older "Aivin Remote"
1252
- scheduled task, otherwise as a detached process. A computer that is not connected yet gets the pairing instructions.
1253
-
1254
- Preview all eight mascot animations locally without pairing or starting the listener:
1255
-
1256
- ```bash
1257
- aivin ui --demo
1258
- ```
1259
-
1260
- Current live-interface capture of the real ask box, mascot, chat and attached-file states: [media/aivin-mascot-live.gif](media/aivin-mascot-live.gif)
1261
-
1262
- ## `aivin desktop`
1263
-
1264
- 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
1265
- setting you can change in the system's own settings. The installers (`install.ps1`, `install.sh`) run `aivin desktop install` for you
1266
- (on Linux only when there is a graphical session; `AIVIN_NO_DESKTOP=1` skips it, `AIVIN_NO_AUTOSTART=1` installs without starting with
1267
- the computer).
1268
-
1269
- ```bash
1270
- aivin desktop install # app + search entry + start with the computer (on by default)
1271
- aivin desktop install --no-autostart # same, without starting with the computer
1272
- aivin desktop install --open-platform # Windows: open the platform app window after install
1273
- aivin desktop uninstall # closes the app (and the listener it runs), removes all of it - `aivin` itself stays
1274
- aivin desktop # status
1275
- ```
1276
-
1277
- On Windows, `install.ps1` asks how Aivin should start. The recommended choice (default: press Enter) creates Desktop and Start
1278
- shortcuts, starts Aivin in the background with Windows, and opens the platform app window after setup. The other choices keep
1279
- Aivin in the background without opening the platform, or open the platform once without enabling startup. Set
1280
- `AIVIN_OPEN_PLATFORM=0` or `AIVIN_NO_AUTOSTART=1` to override the prompt for scripted installs. For example:
1281
-
1282
- ```powershell
1283
- $env:AIVIN_OPEN_PLATFORM='0'; irm https://get.aivin.vn/install.ps1 | iex
1284
- ```
1285
-
1286
- | | Windows | macOS | Linux |
1287
- |---|---|---|---|
1288
- | Icon | system tray (`%LOCALAPPDATA%\Aivin\Aivin.exe`) | menu bar (`~/Applications/Aivin.app`) | system tray (needs python3 + AppIndicator) |
1289
- | Found by | Start menu | Spotlight / Launchpad | app menu (`~/.local/share/applications/aivin.desktop`) |
1290
- | Start with the computer | Task Manager → Startup apps | System Settings → General → Login Items | Startup Applications (GNOME) / Autostart (KDE) |
1291
-
1292
- - **The icon** is in colour while Aivin is taking work, grey when paused, stopped or not connected. Its menu: connect this computer
1293
- (asks for the code from Aivin), pause / resume work (the kill switch), start with the computer, quit
1294
- (which also stops the listener). On Windows, clicking the icon opens the mascot and its ask box.
1295
- - **Keeps the listener running**: the app runs `aivin remote start --quiet` hidden. It restarts it when it crashes (after 10 s, then
1296
- longer, up to 5 minutes), switches to a newly installed release right away (exit code 75), and puts the previous release back when a
1297
- 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
1298
- once you close that window. Opening Aivin from the search again while it runs just opens it.
1299
- - **Start with the computer** is one setting, whichever way you change it: the app's menu, `aivin remote enable` / `disable`, or the
1300
- system settings in the table. `aivin remote disable` only switches it off, so it stays listed and can be switched back on there.
1301
- - 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.
1302
- `Aivin.exe` is compiled on your computer by the C# compiler that comes with Windows (.NET Framework), so nothing is downloaded.
1303
- If that compiler is blocked, `aivin remote enable` falls back to the "Aivin Remote" scheduled task (not shown in Task Manager).
1304
- - macOS: the LaunchAgent `~/Library/LaunchAgents/com.aivin.remote.plist` opens `Aivin.app`, so Login Items lists it as "Aivin". If
1305
- 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).
1306
- - Linux: `~/.config/autostart/aivin.desktop` (switched off = `Hidden=true` / `X-GNOME-Autostart-enabled=false`). Without a graphical
1307
- session (servers, SSH), `aivin remote enable` keeps using the systemd user service as before.
1308
- - **Linux without a tray icon**: GNOME shows tray icons only with the AppIndicator extension (Ubuntu has it). Without python3's
1309
- AppIndicator binding (`sudo apt install gir1.2-ayatanaappindicator3-0.1` on Ubuntu / Debian), Aivin still runs in the background,
1310
- just without an icon - connect it with `aivin remote start --code <code>` once.
1311
- - Running `aivin remote enable` again replaces the scheduled task, Startup-folder script or older LaunchAgent / autostart entry made by
1312
- older aivin versions.
1313
- - **Open with AIVIN Bot** (Windows): install also adds "Open with AIVIN Bot" to the right-click menu (Windows 11: "Show more options")
1314
- 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
1315
- `HKCU\Software` is written (no admin). Windows doesn't let apps make themselves the default, so to open those files with a double-click
1316
- either pick Open with → AIVIN Bot → "Always", or run `aivin desktop defaults` to go straight to AIVIN Bot's page in Settings → Default
1317
- apps. For a whole company, `aivin desktop defaults --export-xml <file> [--all]` writes a file IT can push with the Group Policy "Set a
1318
- default associations configuration file" or Intune (`md txt csv` by default, `--all` adds Office formats).
1319
- - **Share with AIVIN Bot** (Windows): right-click any file or folder (one or many) → "Share with AIVIN Bot", or Send to → AIVIN Bot.
1320
- 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)).
1321
- - **Work here with AIVIN Bot** (Windows): right-click the empty space inside a folder, or the folder itself. The folder becomes the bot's
1322
- 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
1323
- 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
1324
- read, write and run commands there. Take that back with `aivin remote forget-folder <path>`. Network folders can't be used. Live voice
1325
- conversations don't use the working folder.
1326
- - Machines that installed Aivin earlier and only auto-update get all these menu items without reinstalling: each time `aivin remote start`
1327
- starts, it rebuilds `Aivin.exe` if its code changed, rewrites the registry entries if they changed or were removed, and adds the
1328
- Send to shortcut if it's missing.
1329
-
1330
- ## `aivin uninstall` (Windows)
1331
-
1332
- Removes Aivin from this computer: the app and everything `aivin desktop uninstall` removes, the `aivin` command and its PATH entry, and this
1333
- computer's connection to your account (device token, sign-in key). `aivin desktop install` also adds **AIVIN Bot** to Programs & Features and
1334
- Settings → Apps, and uninstalling there does the same thing after asking whether to delete your data.
1335
-
1336
- ```bash
1337
- aivin uninstall # asks first
1338
- aivin uninstall --yes # keeps your data in .aivin
1339
- aivin uninstall --yes --delete-data
1340
- ```
1341
-
1342
- 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
1343
- 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
1344
- 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`.
1345
-
1346
- ## `aivin share <paths...>`
1347
-
1348
- 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
1349
- they go with it (up to 10 items). This needs `aivin remote start` running, and requests older than 2 minutes are dropped. On Windows,
1350
- right-click → "Share with AIVIN Bot" does the same thing and also starts the tray app if it isn't running.
1351
-
1352
- ## `aivin open <files...>`
1353
-
1354
- Opens files from this computer in your Aivin Drive: uploads each file to your personal workspace (or `--workspace <id>`) and opens it
1355
- in the Aivin editor in your browser. The Drive copy is the one you work on from then on:
1356
-
1357
- - the **same content** opened again reopens the same Drive file (with whatever you changed there) - matched by sha256 in
1358
- `~/.aivin/opened-files.json`;
1359
- - a file that **changed on this computer** is uploaded as a new Drive file - the earlier Drive copy is never overwritten.
1360
-
1361
- ```bash
1362
- aivin open contract.docx report.pdf
1363
- aivin open budget.xlsx --workspace <id>
1364
- aivin open notes.md --tab # a normal browser tab instead of its own window
1365
- aivin open notes.md --print # print the Drive link instead of opening anything
1366
- ```
1367
-
1368
- Files open in their own window (no address bar or tabs) when your default browser is Chromium-based (Edge, Chrome, Brave), since that is
1369
- where your Aivin sign-in lives. With any other default browser they open in a normal tab.
1370
-
1371
- **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
1372
- this computer (`127.0.0.1`, random path) and keeps running until you close that window:
1373
-
1374
- - `.pdf`, `.md`, `.txt`, `.csv` are shown straight from this computer.
1375
- - 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
1376
- file. The page asks first; "Don't ask again on this computer" is saved in `~/.aivin/open-settings.json`. Servers that turned this off
1377
- 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
1378
- copies removed after 30 days), so opening the same unchanged file again shows it at once without sending anything.
1379
- - **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
1380
- the editor.
1381
-
1382
- Opened from Explorer, `Aivin.exe --open "<file>"` runs this command hidden (no console window) and shows a system notification while it
1383
- 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
1384
- backend from 04/11/2026).
1385
-
1386
- ## `aivin update`
1387
-
1388
- Updates the standalone `aivin` (installed with `install.ps1` / `install.sh`) from the same download site as the installer:
1389
- reads `latest.txt`, checks the release's Ed25519 signature (`SHA256SUMS.sig`, verified against the release keys built into aivin -
1390
- an unsigned or wrongly signed release is refused before its build is even downloaded), downloads that release's build for this
1391
- computer, checks it against the signed `SHA256SUMS`, makes sure the new build starts (`--version`, run without your API key or tokens
1392
- in its environment), then replaces the installed file. The previous file is kept as `aivin.prev` / `aivin.exe.prev` until the new one
1393
- has run fine.
1394
-
1395
- ```bash
1396
- aivin update # install the latest release
1397
- aivin update --check # only tell whether a newer release exists
1398
- aivin update --to v1.0.8 # install a specific release (also goes back)
1399
- aivin update --auto off # stop background updates of `aivin remote start` on this computer (on: turn them back on)
1400
- ```
1401
-
1402
- - npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
1403
- - 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
1404
- unpacked file - nothing large is held in memory, and an oversized or tampered download stops the update without touching the
1405
- installed file.
1406
- - The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
1407
- (e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
1408
- `https` is accepted (plain `http` only to this computer itself), redirects included.
1409
- - Releases can be rolled out to a share of running computers first (`rollout.json` on the download site); `aivin update` run by
1410
- hand ignores that.
1411
- - Turn background updates off for one run with `aivin remote start --no-auto-update`, or with `AIVIN_AUTO_UPDATE=0`.
1412
-
1413
- ## `aivin do <agent_nickname> <mission>`
1414
-
1415
- Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1416
- not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1417
- progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1418
- and choosing which AI Staff agent should handle it.
1419
-
1420
- ```
1421
- Options:
1422
- --workspace <id> Workspace id to run in (default: your personal workspace)
1423
- --project <id> Project id within the workspace
1424
- --no-watch Fire the mission and return immediately - skip streaming live progress
1425
- ```
1426
-
1427
- ```bash
1428
- aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1429
- ```
1430
-
1431
- - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1432
- nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1433
- prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1434
- given (in a non-interactive shell, both are required up front).
1435
- - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1436
- yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1437
- one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1438
- make` below, which this reuses).
1439
-
1440
- By default it then streams the mission's live progress in the terminal (same realtime channel
1441
- `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1442
- `--no-watch` to just fire it and return immediately instead.
1443
-
1444
- If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1445
- that first when no workspace is given).
1446
-
1447
- ### `aivin do job <description>`
1448
-
1449
- Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1450
- of any single chat/mission invocation (`POST /automation/jobs/create`).
1451
-
1452
- ```
1453
- Options:
1454
- --workspace <id> Workspace id to create the job in (default: your personal workspace)
1455
- --project <id> Project id within the workspace
1456
- --agent <id> Agent id the job runs as (default: the workspace's default agent)
1457
- --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1458
- platform infer one)
1459
- ```
1460
-
1461
- ```bash
1462
- aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1463
- aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1464
- ```
1465
-
1466
- If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1467
- description itself - pass it explicitly if you already know the cadence, to skip the extra
1468
- inference call.
1469
-
1470
- ## `aivin task [description]`
1471
-
1472
- Creates a new task (`POST /task/create`) from a plain-language description - the description
1473
- becomes both the task's title (truncated if long) and its full content.
1474
-
1475
- ```
1476
- Options:
1477
- --workspace <id> Workspace id to create the task in (default: your personal workspace)
1478
- --project <id> Project id within the workspace
1479
- --assignee <userId> User id to assign the task to (default: unassigned)
1480
- ```
1481
-
1482
- ```bash
1483
- aivin task "Follow up with the customer about their refund request"
1484
- ```
1485
-
1486
- `aivin task` also has subcommands for the rest of the task lifecycle:
1487
-
1488
- ```
1489
- Commands:
1490
- list [options] List tasks in a project
1491
- mine [options] List tasks assigned to you in a project
1492
- get [id] Get a task by id
1493
- update [options] [id] Update a task
1494
- delete [id] Delete a task
1495
- ```
1496
-
1497
- ```bash
1498
- aivin task list --status todo # list open tasks in your first project
1499
- aivin task list --project <id> --assignee <userId> # filter by project/assignee
1500
- aivin task mine # tasks assigned to you
1501
- aivin task get <id> # full task details (JSON)
1502
- aivin task update <id> --status done # move a task to done
1503
- aivin task update <id> --title "New title" --priority high
1504
- aivin task delete <id>
1505
- ```
1506
-
1507
- `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1508
- `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1509
- Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1510
- `aivin workspace` to find one).
1511
-
1512
- ## `aivin workspace`
1513
-
1514
- Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1515
- lists that workspace's projects so you can pick the corresponding one - printing the resolved
1516
- `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1517
-
1518
- ```
1519
- Options:
1520
- --plain Print a flat list instead of the interactive picker (for scripts/CI)
1521
- ```
1522
-
1523
- ```bash
1524
- aivin workspace
1525
- ```
1526
-
1527
- Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1528
- interactive prompts.
1529
-
1530
- ## `aivin agent`
1531
-
1532
- Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1533
- publish one you own. `aivin do` calls into the same install/create flows automatically when it
1534
- can't resolve `<agent_nickname>`.
1535
-
1536
- ```
1537
- Commands:
1538
- search [options] [query] Search the AI Staff marketplace for an agent
1539
- install [options] [query] Search the marketplace and install an agent into a workspace
1540
- make [options] Create a brand new AI Staff agent
1541
- publish [options] [agentId] Publish an agent you own to the marketplace
1542
- ```
1543
-
1544
- ```bash
1545
- aivin agent search "customer support" # browse the marketplace
1546
- aivin agent install "customer support" # search + pick + install into your personal workspace
1547
- aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1548
- aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1549
- aivin agent publish <agentId> # make an agent you own visible in the marketplace
1550
- ```
1551
-
1552
- - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1553
- - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1554
- the new agent there too (no separate `install` call needed).
1555
- - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1556
- `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1557
- shared master) - both scoped to the workspace the agent actually lives/was authored in.
1558
-
1559
- ## `aivin project`
1560
-
1561
- Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1562
- endpoint - use `aivin workspace` to browse a workspace's existing projects).
1563
-
1564
- ```
1565
- Commands:
1566
- create [options] [name] Create a new project in a workspace
1567
- update [options] [id] Update a project (currently: rename)
1568
- delete [options] [id] Delete a project
1569
- ```
1570
-
1571
- ```bash
1572
- aivin project create "Q3 Launch"
1573
- aivin project update <id> --name "Q3 Launch (renamed)"
1574
- aivin project delete <id>
1575
- ```
1576
-
1577
- All three default to your personal workspace when `--workspace` is omitted.
1578
-
1579
- ## Environment variables
1580
-
1581
- `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1582
- machine picks it up automatically - there's no per-project credential to manage.
1583
-
1584
- | Variable | Used by | Default | When you'd touch it |
1585
- | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1586
- | `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: `sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1587
- | `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://api.aivin.vn`. |
1588
- | `AIVIN_WEB_URL` | `login` (browser flow) | `https://app.aivin.cloud` | Only for a self-hosted or staging instance. |
1589
- | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1590
- | `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). |
1591
- | `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). |
1592
-
1593
- Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1594
- either injected automatically inside a deployed container or has a working zero-config default -
1595
- not something you're expected to set by hand.
1596
-
1597
- ## See also
1598
-
1599
- - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1600
- - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1601
- - [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
1602
- - [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://app.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 server`
999
+
1000
+ Choose which Aivin server this machine uses. The choice is stored in `~/.aivin/server.json`; CLI API login contexts and remote-device pairing tokens remain separate for each server.
1001
+
1002
+ ```bash
1003
+ aivin server # show the active server
1004
+ aivin server cloud # production API (https://api.aivin.cloud)
1005
+ aivin server vn # Vietnam API (https://api.aivin.vn)
1006
+ aivin server local # localhost:3001
1007
+ aivin server local:3247 # localhost on a custom port
1008
+ aivin server https://host # self-hosted server
1009
+ ```
1010
+
1011
+ `aivin server <target> --force` skips the confirmation before stopping a running remote connection. Installers use this when applying the environment selected by their download domain. Reinstalling from a different Aivin domain can require pairing the computer again on that server. Set `AIVIN_PRESERVE_SERVER=1` before reinstalling to keep the current server.
1012
+
1013
+ Aivin-owned `*.aivin.cloud` and `*.aivin.vn` hosts resolve to their API host, while explicit API hosts are retained. Only localhost accepts HTTP. The tray menu also has Cloud, VN, and Local choices. Switching servers with a running daemon asks before stopping its current work; the tray then reconnects using that server?s saved pairing, or asks to pair if none exists. Pairing codes are server-specific, so include `--server` when a code was created on a non-default server.
1014
+ ## `aivin whoami`
1015
+
1016
+ Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1017
+ off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1018
+ (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1019
+ something).
1020
+
1021
+ ```bash
1022
+ aivin whoami
1023
+ ```
1024
+
1025
+ ```
1026
+ ✅ Logged in
1027
+ Email: jane@example.com
1028
+ Name: Jane Doe
1029
+ Org: Acme Inc
1030
+ Server: https://api.aivin.cloud
1031
+ Logged in at: 1/15/2026, 10:30:00 AM
1032
+ ```
1033
+
1034
+ Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1035
+ `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1036
+ once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1037
+ with a different key, `whoami` says so explicitly instead of guessing:
1038
+
1039
+ ```
1040
+ (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1041
+ ```
1042
+
1043
+ ## `aivin key`
1044
+
1045
+ Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1046
+ saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1047
+ revoke independently later.
1048
+
1049
+ ```
1050
+ Commands:
1051
+ gen [options] <name> Create (or replace) a named API key for your account - shown only once
1052
+ revoke [options] <name> Revoke a named API key for your account
1053
+ list [options] List API keys on your account
1054
+ ```
1055
+
1056
+ ```bash
1057
+ aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1058
+ aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1059
+ aivin key list # see what's on your account
1060
+ aivin key revoke "ci-pipeline" # revoke it by name
1061
+ ```
1062
+
1063
+ All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1064
+ `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1065
+ a step-up check, since minting a new key from an existing one is the one action here that could
1066
+ otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1067
+ `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1068
+
1069
+ `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1070
+ re-running `aivin login` replaces this machine's own key.
1071
+
1072
+ ## `aivin browser [mission]`
1073
+
1074
+ Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1075
+ (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1076
+
1077
+ ```
1078
+ Options:
1079
+ --remote Use a server-side pooled browser instead of your own local one (no
1080
+ local browser needed, no cookies/logins carried over)
1081
+ --debug-port <port> Local mode only: port to launch the AI Browser window's remote
1082
+ debugging on (default: 9222, auto-tries a few nearby ports if that
1083
+ one is taken by something else)
1084
+ --browser <edge|chrome|brave|chromium>
1085
+ Local mode only: which browser to drive - default: auto-detects your
1086
+ OS's actual default browser, falling back to whichever of
1087
+ Edge/Chrome/Brave/Chromium is installed
1088
+ --separate-browser Local mode only: always use the dedicated AI Browser window, never
1089
+ your everyday browser
1090
+ --url <url> Local mode only: open this URL before the mission starts, instead of a
1091
+ blank page (auto-guessed for a few well-known sites mentioned by name
1092
+ in the mission if omitted)
1093
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1094
+ --project <id> Project id within the workspace (--remote only)
1095
+ --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1096
+ mode, or the workspace's default agent for --remote)
1097
+ --no-watch Fire the mission and return immediately - skip streaming live
1098
+ progress and auto-opening the viewer
1099
+ --view Just (re)open the fullscreen interactive viewer for whatever HIL
1100
+ session is already active - no mission is started
1101
+ ```
1102
+
1103
+ **Local mode (default)** - drives a browser on your own computer via its remote-debugging protocol
1104
+ (CDP), through the same guarded tunnel `aivin remote` uses. Which browser, in order:
1105
+
1106
+ 1. **Your everyday Chrome/Edge**, if you've switched on remote debugging in it yourself
1107
+ (`chrome://inspect/#remote-debugging`, or `edge://inspect/#remote-debugging`; Chrome 144+). The
1108
+ browser asks you to **Allow** the connection once. Every login you already have works. The AI
1109
+ opens its own tabs in the background, and your own tabs stay read-only to it. `--separate-browser`
1110
+ skips this step.
1111
+ 2. **Otherwise, a dedicated AI Browser window**, on its own profile (`~/.aivin/browser-profile`),
1112
+ not your regular one. Cookies and logins persist there across runs. The first time you use a
1113
+ site, you log in once, same as in a fresh browser. The CLI opens this window itself, and
1114
+ reuses it while it's open. A Chrome/Edge window on any other profile is never attached to, even
1115
+ if it has a debug port open.
1116
+
1117
+ Either way, every command the server sends is filtered. No `file://` or browser-internal pages, no
1118
+ picking files from your disk, and no loading extensions. Downloads always go to `~/Downloads/Aivin`,
1119
+ and executables are cancelled as soon as they start downloading.
1120
+
1121
+ In the AI Browser window, the tabs a mission opens (and the popups they open) are put in one
1122
+ **tab group** named after the mission, with a different color per mission running at the same time.
1123
+ Tab groups have no CDP command, so the CLI loads a small extension of its own into that profile
1124
+ (`~/.aivin/browser-extension/tab-groups`, permissions `tabGroups` + `debugger`). The server can't
1125
+ reach it. A window opened by an older CLI version doesn't have this - close it and rerun. Your
1126
+ everyday browser's tabs are not grouped, because the CLI never installs anything into your own
1127
+ profile.
1128
+
1129
+ If the AI Browser window can't be started, `aivin browser` prints the exact launch command for your
1130
+ OS/browser instead of failing silently:
1131
+
1132
+ ```bash
1133
+ aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1134
+ ```
1135
+
1136
+ A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1137
+ as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1138
+
1139
+ **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1140
+ required, no cookies from your machine carried over. Useful for CI, headless environments, or
1141
+ missions that don't need a logged-in session on a specific real account.
1142
+
1143
+ ```bash
1144
+ aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1145
+ ```
1146
+
1147
+ `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1148
+ is already active, without starting anything new - handy if you closed the auto-opened window by
1149
+ accident.
1150
+
1151
+ ## `aivin remote` — let your agents work on this computer (Device Agent)
1152
+
1153
+ Turns this computer into a device your Aivin agents can hand jobs to (`official.device_agent`): run commands, read/search/edit
1154
+ files, inspect projects and the system — only inside the folder you allow.
1155
+
1156
+ ```bash
1157
+ aivin remote start --dir D:\code # first run pairs this computer (device token), then listens for work
1158
+ aivin remote do "run the tests of the be project and summarize failures"
1159
+ aivin remote devices # your paired computers + online state
1160
+ aivin remote pause | resume # local kill switch - refuses every remote call while paused
1161
+ aivin remote unpair [deviceId] # revoke (token stops working immediately)
1162
+ aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
1163
+ aivin remote meeting start "Weekly sales" --then "summarize and draft an email to my manager" # meeting notes (Windows)
1164
+ aivin remote meeting stop | status | list | show [id]
1165
+ aivin remote status | test | logs | reindex | enable | disable | reset-id
1166
+ ```
1167
+
1168
+ - **Device token, not your API key**: pairing (`POST /plugins/device-agent/devices/pair`) gives this machine its own token
1169
+ (`~/.aivin/device-credentials.json`, the server only keeps a hash). Revoking a device never touches your API key.
1170
+ - **Tools per device**: discovered from what is installed (git, ripgrep, node, python, docker…) — `aivin remote status` lists them.
1171
+ - **Permissions come from the agent's own rules** (autonomous decisions / needs approval / must not): every step that changes
1172
+ something goes through the platform policy gate and may ask you to approve. This computer keeps a hard floor the server cannot
1173
+ change: allowed folder (checked with realpath, symlinks can't escape), secrets stripped from command environments, a safety net
1174
+ against system-destroying commands, and the kill switch.
1175
+ - **Memory stays on this computer**: `~/.aivin/memory/<kind>.yaml` (edit by hand if you like) + `vectors.json`; the agent recalls it
1176
+ before planning and saves procedures that worked.
1177
+ - Env: `AIVIN_REMOTE_HOME` (config folder), `AIVIN_REMOTE_LIMIT_<GROUP>` (parallel limit per tool group: fs_read, fs_write, exec, git, system, memory).
1178
+ - **Stays up to date by itself**: the listener checks for a new release about every hour (and right away when the Aivin server
1179
+ asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
1180
+ 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
1181
+ 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
1182
+ 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
1183
+ 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`.
1184
+ - The Aivin server can only *suggest* versions (a minimum version, the latest published one, releases on hold) - it can never choose
1185
+ where aivin downloads from or what it installs. If the download site reports an older release than the server knows about, aivin
1186
+ 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
1187
+ installed by the background updater (`aivin update --to` still can).
1188
+ - **Aivin mascot on screen** (Windows): while the listener runs, a small Aivin bot floats over your windows. Its speech bubble shows
1189
+ the main thing the agent is doing on this computer; drag it anywhere (the spot is remembered). Hover it to **ask Aivin**: a small
1190
+ box pops up above it (and slips away when the mouse leaves, unless you are typing, talking or waiting for an answer); click the
1191
+ 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
1192
+ answer shown in the box. The window you were using right before you reached for the bot (or pressed the mic hotkey) goes along
1193
+ 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
1194
+ 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
1195
+ 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
1196
+ 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
1197
+ as `aivin remote pause`). The activity panel also has **Turn mascot off**: the mascot fades and slides away before its window closes,
1198
+ while the listener keeps running in the background. Run `aivin ui` to bring it back immediately, or use `aivin remote mascot on` and
1199
+ restart the listener. Apart from the open ask box it never takes keyboard focus; it is left out of screenshots and screen sharing,
1200
+ and steps aside while the agent controls an app window. `aivin remote mascot off` turns it off persistently; `aivin remote start --no-mascot`
1201
+ hides it for one run. Texts follow `AIVIN_LANG` / the system language. See the dedicated [Aivin mascot guide](AIVIN_MASCOT.md)
1202
+ for interaction, state, shortcut, privacy and troubleshooting details.
1203
+ - **Meeting notes** (Windows): ask the mascot something like "take notes of this meeting, then send my manager a summary". You can also
1204
+ run `aivin remote meeting start "<title>" --then "..."` yourself.
1205
+ - **What's recorded:** the computer's own sound (what the others say) and your microphone, plus a screenshot whenever the screen
1206
+ changes (shared slides). This works with any meeting app (Google Meet, Zoom, Teams, Zalo...), and nobody joins the meeting on
1207
+ your behalf.
1208
+ - **Approval:** the agent can't start a recording on its own. Starting one always needs a click on **Allow** on this computer, and
1209
+ you get a notification while it runs. Tell the other participants that they are being recorded.
1210
+ - **When it stops:** when the meeting window closes and the computer goes quiet, after 10 minutes of silence, after 3 hours, on
1211
+ `aivin remote meeting stop`, or when you press Pause.
1212
+ - **The transcript:** it is made only after the meeting is over, by sending ~30 s pieces through Aivin's voice-to-text.
1213
+ Then the audio files are deleted. If you gave an instruction ("then"), a new chat turn starts by itself with it. The
1214
+ agent reads the transcript with `meeting.transcript`, writes the summary and drafts the email. Sending still asks you on this
1215
+ computer first.
1216
+ - **Where it's stored:** `~/.aivin/meetings/<id>/`, which the file tools can't read. If you name a `save_dir` in the allowed area,
1217
+ it's stored there instead, so the files can be attached to an email.
1218
+ - **Restarts:** if the listener restarts mid-meeting, the transcript is finished on the next start, and background updates wait
1219
+ until the meeting is done. `--no-meetings` (or `AIVIN_REMOTE_MEETINGS=0`) turns it off.
1220
+ - **Speaker labels:** each line of the transcript is labelled **Me** (your microphone) or **Others** (the computer's sound). Pieces
1221
+ are cut where the talking switches between the two. The other participants are not told apart from each other.
1222
+ - **Screenshots on request:** the agent can also take a screenshot of the whole screen (`screen.capture`). The mascot is never in it.
1223
+ - **Clipboard**: the agent can read what you copied (`clipboard.read`) and put text on the clipboard for you to paste
1224
+ (`clipboard.write`). On Windows it can also read images and files copied in Explorer; on macOS (`pbpaste`) and Linux (`wl-paste`,
1225
+ `xclip` or `xsel`) only text. Anything a password manager marks private when copying (KeePass, 1Password, Bitwarden…) is never
1226
+ read. Windows' own clipboard history skips the same content.
1227
+ - **Controlling app windows** (Windows): when a job has no file, command or app API to go through (an accounting or ERP app, a
1228
+ settings dialog, Save As), the agent can read and use app windows like you do.
1229
+ - **How it sees:** it reads the window's accessibility tree, the same list of buttons, fields and menus that screen readers use
1230
+ (`gui.observe`, `gui.find` for big windows). When an app draws its own interface and the tree is nearly empty, it takes a
1231
+ screenshot and reads the text on it with Windows' built-in OCR, on this computer. Install the Vietnamese OCR language pack
1232
+ (Settings → Time & language → Language & region → Vietnamese) for Vietnamese text.
1233
+ - **How it acts:** clicks, fills fields, ticks boxes, picks list items, scrolls, presses shortcuts (`gui.act`), opens installed apps
1234
+ or documents in the allowed folders (`gui.open_app`), and waits for a dialog or button to appear (`gui.wait_for`). It uses the
1235
+ app's accessibility actions first, so most steps work while the window stays behind yours. Only when an app needs the real
1236
+ mouse or keyboard does it bring the window to the front. Windows it opens are sent behind yours.
1237
+ - **You stay in control:** touch the mouse or keyboard and the agent stops before its next real mouse/keyboard step and asks you.
1238
+ The first time it controls a window (then at most every 5 minutes) you get a notification. `aivin remote pause` or the mascot's
1239
+ "Pause AI" stops everything.
1240
+ - **What it never does:** type into password fields, control password managers, UAC prompts, the lock screen or Windows Security,
1241
+ or open programs and scripts by path. Unless the computer was started with `--full-access`, it also leaves terminals,
1242
+ Registry Editor, Task Manager, code editors (VS Code, Cursor, JetBrains…) and agent apps (Claude, ChatGPT…) alone, because
1243
+ typing commands there would get around the allowed folders.
1244
+ - **When it asks first:** paying, deleting for good, signing out, or pressing Send / Post when you did not ask for it to be sent.
1245
+ Other clicks don't ask, unless the agent's own rules say so.
1246
+ - Excel, Word and Outlook go through the apps directly (`office.*`), without clicking. `--no-gui` turns window control off.
1247
+
1248
+ ## `aivin ui`
1249
+
1250
+ Shows the Aivin mascot with its ask box open, ready to type (Windows). If the listener (`aivin remote start`) is not running it is
1251
+ started in the background - through the Aivin tray app when it is installed (`aivin desktop install`), else the older "Aivin Remote"
1252
+ scheduled task, otherwise as a detached process. A computer that is not connected yet gets the pairing instructions.
1253
+
1254
+ Preview all eight mascot animations locally without pairing or starting the listener:
1255
+
1256
+ ```bash
1257
+ aivin ui --demo
1258
+ ```
1259
+
1260
+ Current live-interface capture of the real ask box, mascot, chat and attached-file states: [media/aivin-mascot-live.gif](media/aivin-mascot-live.gif)
1261
+
1262
+ ## `aivin desktop`
1263
+
1264
+ 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
1265
+ setting you can change in the system's own settings. The installers (`install.ps1`, `install.sh`) run `aivin desktop install` for you
1266
+ (on Linux only when there is a graphical session; `AIVIN_NO_DESKTOP=1` skips it, `AIVIN_NO_AUTOSTART=1` installs without starting with
1267
+ the computer).
1268
+
1269
+ ```bash
1270
+ aivin desktop install # app + search entry + start with the computer (on by default)
1271
+ aivin desktop install --no-autostart # same, without starting with the computer
1272
+ aivin desktop install --open-platform # Windows: open the platform app window after install
1273
+ aivin desktop uninstall # closes the app (and the listener it runs), removes all of it - `aivin` itself stays
1274
+ aivin desktop # status
1275
+ ```
1276
+
1277
+ Developing the CLI: `aivin desktop install` and `aivin remote enable` run from a source checkout (Node) keep an installed `aivin` executable
1278
+ as the program the background app starts, because a listener running on Node cannot update itself. Add `--use-node` to run the background
1279
+ app from the checkout on purpose; run the installer or `aivin desktop install` from the executable to go back.
1280
+
1281
+ On Windows, `install.ps1` asks how Aivin should start. The recommended choice (default: press Enter) creates Desktop and Start
1282
+ shortcuts, starts Aivin in the background with Windows, and opens the platform app window after setup. The other choices keep
1283
+ Aivin in the background without opening the platform, or open the platform once without enabling startup. Set
1284
+ `AIVIN_OPEN_PLATFORM=0` or `AIVIN_NO_AUTOSTART=1` to override the prompt for scripted installs. For example:
1285
+
1286
+ ```powershell
1287
+ $env:AIVIN_OPEN_PLATFORM='0'; irm https://get.aivin.vn/install.ps1 | iex
1288
+ ```
1289
+
1290
+ | | Windows | macOS | Linux |
1291
+ |---|---|---|---|
1292
+ | Icon | system tray (`%LOCALAPPDATA%\Aivin\Aivin.exe`) | menu bar (`~/Applications/Aivin.app`) | system tray (needs python3 + AppIndicator) |
1293
+ | Found by | Start menu | Spotlight / Launchpad | app menu (`~/.local/share/applications/aivin.desktop`) |
1294
+ | Start with the computer | Task Manager → Startup apps | System Settings → General → Login Items | Startup Applications (GNOME) / Autostart (KDE) |
1295
+
1296
+ - **The icon** is in colour while Aivin is taking work, grey when paused, stopped or not connected. Its menu: connect this computer
1297
+ (asks for the code from Aivin), pause / resume work (the kill switch), start with the computer, quit
1298
+ (which also stops the listener). On Windows, clicking the icon opens the mascot and its ask box.
1299
+ - **Keeps the listener running**: the app runs `aivin remote start --quiet` hidden. It restarts it when it crashes (after 10 s, then
1300
+ longer, up to 5 minutes), switches to a newly installed release right away (exit code 75), and puts the previous release back when a
1301
+ 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
1302
+ once you close that window. Opening Aivin from the search again while it runs just opens it.
1303
+ - **Start with the computer** is one setting, whichever way you change it: the app's menu, `aivin remote enable` / `disable`, or the
1304
+ system settings in the table. `aivin remote disable` only switches it off, so it stays listed and can be switched back on there.
1305
+ - 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.
1306
+ `Aivin.exe` is compiled on your computer by the C# compiler that comes with Windows (.NET Framework), so nothing is downloaded.
1307
+ If that compiler is blocked, `aivin remote enable` falls back to the "Aivin Remote" scheduled task (not shown in Task Manager).
1308
+ - macOS: the LaunchAgent `~/Library/LaunchAgents/com.aivin.remote.plist` opens `Aivin.app`, so Login Items lists it as "Aivin". If
1309
+ 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).
1310
+ - Linux: `~/.config/autostart/aivin.desktop` (switched off = `Hidden=true` / `X-GNOME-Autostart-enabled=false`). Without a graphical
1311
+ session (servers, SSH), `aivin remote enable` keeps using the systemd user service as before.
1312
+ - **Linux without a tray icon**: GNOME shows tray icons only with the AppIndicator extension (Ubuntu has it). Without python3's
1313
+ AppIndicator binding (`sudo apt install gir1.2-ayatanaappindicator3-0.1` on Ubuntu / Debian), Aivin still runs in the background,
1314
+ just without an icon - connect it with `aivin remote start --code <code>` once.
1315
+ - Running `aivin remote enable` again replaces the scheduled task, Startup-folder script or older LaunchAgent / autostart entry made by
1316
+ older aivin versions.
1317
+ - **Open with AIVIN Bot** (Windows): install also adds "Open with AIVIN Bot" to the right-click menu (Windows 11: "Show more options")
1318
+ 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
1319
+ `HKCU\Software` is written (no admin). Windows doesn't let apps make themselves the default, so to open those files with a double-click
1320
+ either pick Open with → AIVIN Bot → "Always", or run `aivin desktop defaults` to go straight to AIVIN Bot's page in Settings → Default
1321
+ apps. For a whole company, `aivin desktop defaults --export-xml <file> [--all]` writes a file IT can push with the Group Policy "Set a
1322
+ default associations configuration file" or Intune (`md txt csv` by default, `--all` adds Office formats).
1323
+ - **Share with AIVIN Bot** (Windows): right-click any file or folder (one or many) → "Share with AIVIN Bot", or Send to → AIVIN Bot.
1324
+ 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)).
1325
+ - **Work here with AIVIN Bot** (Windows): right-click the empty space inside a folder, or the folder itself. The folder becomes the bot's
1326
+ 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
1327
+ 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
1328
+ read, write and run commands there. Take that back with `aivin remote forget-folder <path>`. Network folders can't be used. Live voice
1329
+ conversations don't use the working folder.
1330
+ - Machines that installed Aivin earlier and only auto-update get all these menu items without reinstalling: each time `aivin remote start`
1331
+ starts, it rebuilds `Aivin.exe` if its code changed, rewrites the registry entries if they changed or were removed, and adds the
1332
+ Send to shortcut if it's missing.
1333
+
1334
+ ## `aivin uninstall` (Windows)
1335
+
1336
+ Removes Aivin from this computer: the app and everything `aivin desktop uninstall` removes, the `aivin` command and its PATH entry, and this
1337
+ computer's connection to your account (device token, sign-in key). `aivin desktop install` also adds **AIVIN Bot** to Programs & Features and
1338
+ Settings → Apps, and uninstalling there does the same thing after asking whether to delete your data.
1339
+
1340
+ ```bash
1341
+ aivin uninstall # asks first
1342
+ aivin uninstall --yes # keeps your data in .aivin
1343
+ aivin uninstall --yes --delete-data
1344
+ ```
1345
+
1346
+ 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
1347
+ 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
1348
+ 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`.
1349
+
1350
+ ## `aivin share <paths...>`
1351
+
1352
+ 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
1353
+ they go with it (up to 10 items). This needs `aivin remote start` running, and requests older than 2 minutes are dropped. On Windows,
1354
+ right-click → "Share with AIVIN Bot" does the same thing and also starts the tray app if it isn't running.
1355
+
1356
+ ## `aivin open <files...>`
1357
+
1358
+ Opens files from this computer in your Aivin Drive: uploads each file to your personal workspace (or `--workspace <id>`) and opens it
1359
+ in the Aivin editor in your browser. The Drive copy is the one you work on from then on:
1360
+
1361
+ - the **same content** opened again reopens the same Drive file (with whatever you changed there) - matched by sha256 in
1362
+ `~/.aivin/opened-files.json`;
1363
+ - a file that **changed on this computer** is uploaded as a new Drive file - the earlier Drive copy is never overwritten.
1364
+
1365
+ ```bash
1366
+ aivin open contract.docx report.pdf
1367
+ aivin open budget.xlsx --workspace <id>
1368
+ aivin open notes.md --tab # a normal browser tab instead of its own window
1369
+ aivin open notes.md --print # print the Drive link instead of opening anything
1370
+ ```
1371
+
1372
+ Files open in their own window (no address bar or tabs) when your default browser is Chromium-based (Edge, Chrome, Brave), since that is
1373
+ where your Aivin sign-in lives. With any other default browser they open in a normal tab.
1374
+
1375
+ **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
1376
+ this computer (`127.0.0.1`, random path) and keeps running until you close that window:
1377
+
1378
+ - `.pdf`, `.md`, `.txt`, `.csv` are shown straight from this computer.
1379
+ - 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
1380
+ file. The page asks first; "Don't ask again on this computer" is saved in `~/.aivin/open-settings.json`. Servers that turned this off
1381
+ 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
1382
+ copies removed after 30 days), so opening the same unchanged file again shows it at once without sending anything.
1383
+ - **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
1384
+ the editor.
1385
+
1386
+ Opened from Explorer, `Aivin.exe --open "<file>"` runs this command hidden (no console window) and shows a system notification while it
1387
+ 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
1388
+ backend from 04/11/2026).
1389
+
1390
+ ## `aivin update`
1391
+
1392
+ Updates the standalone `aivin` (installed with `install.ps1` / `install.sh`) from the same download site as the installer:
1393
+ reads `latest.txt`, checks the release's Ed25519 signature (`SHA256SUMS.sig`, verified against the release keys built into aivin -
1394
+ an unsigned or wrongly signed release is refused before its build is even downloaded), downloads that release's build for this
1395
+ computer, checks it against the signed `SHA256SUMS`, makes sure the new build starts (`--version`, run without your API key or tokens
1396
+ in its environment), then replaces the installed file. The previous file is kept as `aivin.prev` / `aivin.exe.prev` until the new one
1397
+ has run fine.
1398
+
1399
+ ```bash
1400
+ aivin update # install the latest release
1401
+ aivin update --check # only tell whether a newer release exists
1402
+ aivin update --to v1.0.8 # install a specific release (also goes back)
1403
+ aivin update --auto off # stop background updates of `aivin remote start` on this computer (on: turn them back on)
1404
+ ```
1405
+
1406
+ - npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
1407
+ - 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
1408
+ unpacked file - nothing large is held in memory, and an oversized or tampered download stops the update without touching the
1409
+ installed file.
1410
+ - The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
1411
+ (e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
1412
+ `https` is accepted (plain `http` only to this computer itself), redirects included.
1413
+ - Releases can be rolled out to a share of running computers first (`rollout.json` on the download site); `aivin update` run by
1414
+ hand ignores that.
1415
+ - Turn background updates off for one run with `aivin remote start --no-auto-update`, or with `AIVIN_AUTO_UPDATE=0`.
1416
+
1417
+ ## `aivin do <agent_nickname> <mission>`
1418
+
1419
+ Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1420
+ not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1421
+ progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1422
+ and choosing which AI Staff agent should handle it.
1423
+
1424
+ ```
1425
+ Options:
1426
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1427
+ --project <id> Project id within the workspace
1428
+ --no-watch Fire the mission and return immediately - skip streaming live progress
1429
+ ```
1430
+
1431
+ ```bash
1432
+ aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1433
+ ```
1434
+
1435
+ - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1436
+ nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1437
+ prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1438
+ given (in a non-interactive shell, both are required up front).
1439
+ - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1440
+ yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1441
+ one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1442
+ make` below, which this reuses).
1443
+
1444
+ By default it then streams the mission's live progress in the terminal (same realtime channel
1445
+ `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1446
+ `--no-watch` to just fire it and return immediately instead.
1447
+
1448
+ If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1449
+ that first when no workspace is given).
1450
+
1451
+ ### `aivin do job <description>`
1452
+
1453
+ Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1454
+ of any single chat/mission invocation (`POST /automation/jobs/create`).
1455
+
1456
+ ```
1457
+ Options:
1458
+ --workspace <id> Workspace id to create the job in (default: your personal workspace)
1459
+ --project <id> Project id within the workspace
1460
+ --agent <id> Agent id the job runs as (default: the workspace's default agent)
1461
+ --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1462
+ platform infer one)
1463
+ ```
1464
+
1465
+ ```bash
1466
+ aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1467
+ aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1468
+ ```
1469
+
1470
+ If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1471
+ description itself - pass it explicitly if you already know the cadence, to skip the extra
1472
+ inference call.
1473
+
1474
+ ## `aivin task [description]`
1475
+
1476
+ Creates a new task (`POST /task/create`) from a plain-language description - the description
1477
+ becomes both the task's title (truncated if long) and its full content.
1478
+
1479
+ ```
1480
+ Options:
1481
+ --workspace <id> Workspace id to create the task in (default: your personal workspace)
1482
+ --project <id> Project id within the workspace
1483
+ --assignee <userId> User id to assign the task to (default: unassigned)
1484
+ ```
1485
+
1486
+ ```bash
1487
+ aivin task "Follow up with the customer about their refund request"
1488
+ ```
1489
+
1490
+ `aivin task` also has subcommands for the rest of the task lifecycle:
1491
+
1492
+ ```
1493
+ Commands:
1494
+ list [options] List tasks in a project
1495
+ mine [options] List tasks assigned to you in a project
1496
+ get [id] Get a task by id
1497
+ update [options] [id] Update a task
1498
+ delete [id] Delete a task
1499
+ ```
1500
+
1501
+ ```bash
1502
+ aivin task list --status todo # list open tasks in your first project
1503
+ aivin task list --project <id> --assignee <userId> # filter by project/assignee
1504
+ aivin task mine # tasks assigned to you
1505
+ aivin task get <id> # full task details (JSON)
1506
+ aivin task update <id> --status done # move a task to done
1507
+ aivin task update <id> --title "New title" --priority high
1508
+ aivin task delete <id>
1509
+ ```
1510
+
1511
+ `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1512
+ `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1513
+ Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1514
+ `aivin workspace` to find one).
1515
+
1516
+ ## `aivin workspace`
1517
+
1518
+ Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1519
+ lists that workspace's projects so you can pick the corresponding one - printing the resolved
1520
+ `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1521
+
1522
+ ```
1523
+ Options:
1524
+ --plain Print a flat list instead of the interactive picker (for scripts/CI)
1525
+ ```
1526
+
1527
+ ```bash
1528
+ aivin workspace
1529
+ ```
1530
+
1531
+ Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1532
+ interactive prompts.
1533
+
1534
+ ## `aivin agent`
1535
+
1536
+ Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1537
+ publish one you own. `aivin do` calls into the same install/create flows automatically when it
1538
+ can't resolve `<agent_nickname>`.
1539
+
1540
+ ```
1541
+ Commands:
1542
+ search [options] [query] Search the AI Staff marketplace for an agent
1543
+ install [options] [query] Search the marketplace and install an agent into a workspace
1544
+ make [options] Create a brand new AI Staff agent
1545
+ publish [options] [agentId] Publish an agent you own to the marketplace
1546
+ ```
1547
+
1548
+ ```bash
1549
+ aivin agent search "customer support" # browse the marketplace
1550
+ aivin agent install "customer support" # search + pick + install into your personal workspace
1551
+ aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1552
+ aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1553
+ aivin agent publish <agentId> # make an agent you own visible in the marketplace
1554
+ ```
1555
+
1556
+ - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1557
+ - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1558
+ the new agent there too (no separate `install` call needed).
1559
+ - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1560
+ `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1561
+ shared master) - both scoped to the workspace the agent actually lives/was authored in.
1562
+
1563
+ ## `aivin project`
1564
+
1565
+ Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1566
+ endpoint - use `aivin workspace` to browse a workspace's existing projects).
1567
+
1568
+ ```
1569
+ Commands:
1570
+ create [options] [name] Create a new project in a workspace
1571
+ update [options] [id] Update a project (currently: rename)
1572
+ delete [options] [id] Delete a project
1573
+ ```
1574
+
1575
+ ```bash
1576
+ aivin project create "Q3 Launch"
1577
+ aivin project update <id> --name "Q3 Launch (renamed)"
1578
+ aivin project delete <id>
1579
+ ```
1580
+
1581
+ All three default to your personal workspace when `--workspace` is omitted.
1582
+
1583
+ ## Environment variables
1584
+
1585
+ `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1586
+ machine picks it up automatically - there's no per-project credential to manage.
1587
+
1588
+ | Variable | Used by | Default | When you'd touch it |
1589
+ | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1590
+ | `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: `sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1591
+ | `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://api.aivin.vn`. |
1592
+ | `AIVIN_WEB_URL` | `login` (browser flow) | `https://app.aivin.cloud` | Only for a self-hosted or staging instance. |
1593
+ | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1594
+ | `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). |
1595
+ | `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). |
1596
+
1597
+ Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1598
+ either injected automatically inside a deployed container or has a working zero-config default -
1599
+ not something you're expected to set by hand.
1600
+
1601
+ ## See also
1602
+
1603
+ - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1604
+ - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1605
+ - [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
1606
+ - [SDK.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SDK.md) - everything the SDK exposes inside `main()`