@meetstream/cli 0.4.2 → 0.6.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@meetstream/cli`.
4
+
5
+ ## 0.6.0 (2026-11-21)
6
+
7
+ Matches MeetStream API v1.10.0.
8
+
9
+ ### Added
10
+
11
+ - Agents API: `mia get`, `mia update <id> -f <file>` (`PUT`, whole blocks), `mia check <id>` (local agent bridge test, `GET /mia?check=local_agent`). `agents` is an alias of `mia`.
12
+ - `bot create --agent-config <id>` (alias of `--agent-config-id`) and `--agent-param key=value` for `agent_config_params`. A warning on stderr when `--socket-ws` or `--live-audio-ws` is sent with an agent.
13
+ - `balance`: prepaid balance from `GET /api/v1/billing/balance`. Available when the endpoint is on for the account; a `404` prints where to see the balance (https://app.meetstream.ai/billing) and exits 3.
14
+ - A failed transcript (`422`) prints `Transcript failed: <reason>` and the next step (`meetstream transcribe <bot-id>`), exits 4, and is never polled with `--wait`. With `--json`: `{"error": "transcript_failed", "reason", "transcript_status", "transcript_id"}`.
15
+ - A hint when the API refuses MeetStream's inbuilt keys (`MeetStream-managed keys are not available ...`): use your own key for that section.
16
+
17
+ ### Changed
18
+
19
+ - `mia create` tells you to attach the agent with `--agent-config` only (it no longer suggests `--socket-ws` / `--live-audio-ws`).
20
+ - `bot audio` / `bot video` help: download links are valid for 1 hour.
21
+ - README opens with the two ways to integrate, a fastest path for each, the voice agent setups with prices, and a "Latest docs" section.
22
+
23
+ ## 0.5.0 (2026-11-18)
24
+
25
+ - `bot raise-hand` / `bot lower-hand`, `bot create --zoom-use-own-app` / `--no-zoom-use-own-app` / `--storage-id`, Smallest AI providers, `bot timeline --download`, `Retry-After` on `429`, `/screenshots` and `/calendar/calendars` routes, `bot summary` removed (points to `transcript`).
26
+
27
+ ## 0.4.2 and earlier
28
+
29
+ See the git history.
package/README.md CHANGED
@@ -10,6 +10,59 @@ meetstream bot create "https://meet.google.com/abc-defg-hij" -t deepgram
10
10
 
11
11
  ---
12
12
 
13
+ ## Two ways to integrate
14
+
15
+ 1. **Bot API: meeting bots and recording.** Send a bot to Zoom, Google Meet or Microsoft Teams, then get recordings, transcripts, participants, chat and webhooks after the call, or live data during the call. This is the default.
16
+ 2. **Agents API: voice agents in the meeting.** A voice agent (API name: MIA) rides on the bot and answers by voice, in the chat, or with tool calls. Use it when you want an agent that talks.
17
+
18
+ Guide: [Two ways to integrate](https://docs.meetstream.ai/guides/introduction/integration-paths).
19
+
20
+ **Path 1, fastest path.** Decide first: notes after the call (post-call), or something during the call (live)?
21
+
22
+ ```bash
23
+ # Post-call: bot, webhooks, then the transcript
24
+ meetstream bot create "https://meet.google.com/abc-defg-hij" -t meetstream -c https://you.example.com/webhook
25
+ meetstream transcript <bot_id> --wait
26
+
27
+ # Live: live transcript webhook, then raise the bot's hand while it is in the meeting
28
+ meetstream bot create "https://zoom.us/j/123456789" -t deepgram_streaming --live-transcript-webhook https://you.example.com/live
29
+ meetstream bot raise-hand <bot_id> # POST /api/v1/bots/{bot_id}/send_command {"command":"raise_hand"}
30
+ ```
31
+
32
+ **Path 2, fastest path.** Save an agent config, then send a bot with its id. Nothing else is needed on the bot.
33
+
34
+ ```bash
35
+ cat > agent.json <<'JSON'
36
+ {
37
+ "agent_name": "Meeting assistant",
38
+ "mode": "pipeline",
39
+ "transcriber": { "provider": "deepgram", "model": "nova-3", "key_source": "meetstream" },
40
+ "model": { "provider": "openai", "model": "gpt-4.1", "key_source": "meetstream",
41
+ "system_prompt": "You are a helpful meeting assistant. Keep answers short.",
42
+ "first_message": "Hi, I'm an AI assistant on this call." },
43
+ "voice": { "provider": "openai", "voice_id": "coral", "key_source": "meetstream" }
44
+ }
45
+ JSON
46
+ meetstream mia create -f agent.json # prints agent_config_id
47
+ meetstream bot create "https://meet.google.com/abc-defg-hij" --agent-config <agent_config_id>
48
+ ```
49
+
50
+ **Voice agent setups and pricing** (per meeting hour):
51
+
52
+ | Setup | What you do | Price |
53
+ |---|---|---|
54
+ | a. MeetStream's inbuilt keys (default) | `"key_source": "meetstream"` on each pipeline section, no `api_key`. Inbuilt keys cover OpenAI (LLM, speech and voice models) and Deepgram (speech-to-text) today. | Bot price + $0.25 agent infrastructure + the per-hour price of each model you pick (the dashboard agent editor shows the rate before the bot runs) |
55
+ | b. Your own keys | Your provider keys (OpenAI, Anthropic, Deepgram, ElevenLabs and others) under Integrations; `"key_source": "user"` or leave it out | Bot price + $0.25 agent infrastructure; your provider bills you for model usage |
56
+ | c. Your own agent | `"model": {"provider": "local_agent", "local_agent": {"url": "https://..."}}` with the [MeetStream Agent Kit](https://github.com/meetstream-ai/agent-kit); check it with `meetstream mia check <id>` | Bot price + $0.25 agent infrastructure; no model tokens charged for your agent's reasoning |
57
+
58
+ Bot price: $0.35 per recording hour ($0.25 at volume). The MeetStream transcription add-on is $0.10 per hour, waived with your own provider key. Details: [Voice agent pricing and keys](https://docs.meetstream.ai/guides/mia/pricing-and-keys).
59
+
60
+ If inbuilt keys are not on for your account yet, `mia create` fails with `MeetStream-managed keys are not available for <section>. Use your own key.` Switch that section to your own key (setup b) and run it again; do not loop.
61
+
62
+ Setup c is opt-in and needs the local agent feature on for your account. Meeting speech reaches an agent that has access to your computer and terminal (prompt injection), so keep the lowest access level (`readonly`) and the activation code on, and keep your computer, the agent and the bridge running for the whole call. Guide: [MIA screen sharing and custom agents](https://docs.meetstream.ai/guides/features/mia-screen-sharing-and-custom-agents).
63
+
64
+ ---
65
+
13
66
  ## Authentication
14
67
 
15
68
  Every command authenticates to `https://api.meetstream.ai/api/v1` with `Authorization: Token <your-key>`. There's no OAuth flow or separate CLI login - the API key **is** the credential.
@@ -65,15 +118,16 @@ meetstream transcript <bot_id> --wait
65
118
  | `bot list` | Lists every bot on the account with id, status, and platform |
66
119
  | `bot status <id> [--watch]` | Current status; `--watch` polls every 5s until a terminal state (`Stopped`/`Done`/`Error`/etc.) |
67
120
  | `bot detail <id>` | Full session metadata - platform, timings, status timeline, `transcript_id`, `caption_file` |
68
- | `bot summary <id>` | MeetStream's built-in AI meeting summary |
69
- | `bot audio <id>` / `bot video <id>` | Presigned recording URL (audio valid 1h, video valid 10min) |
121
+ | `bot summary <id>` | Removed: the API has no summary endpoint. The command exits 2 and points to `meetstream transcript <id>` |
122
+ | `bot audio <id>` / `bot video <id>` | Recording download link (valid 1 hour) |
70
123
  | `bot streams <id>` / `bot audio-streams <id>` | Per-participant video/audio streams (needs `--separate-video`/`--separate-audio` at creation) |
71
124
  | `bot participants <id>` | Everyone detected in the meeting |
72
125
  | `bot chats <id>` | In-meeting chat messages |
73
- | `bot screenshots <id>` | Screenshots captured during the meeting |
74
- | `bot timeline <id>` | Speaker timeline - who spoke when |
126
+ | `bot screenshots <id>` | Screenshots captured during the meeting, newest first, each with a 1h download URL |
127
+ | `bot timeline <id> [--download]` | Speaker timeline - who spoke when. A very large timeline comes back as `speaker_timeline_url` (a download link valid 1h, no key needed) with `size_bytes`; `--download` fetches the file and prints the timeline |
75
128
  | `bot send-message <id> <text...>` | Posts a chat message into the **live** meeting |
76
129
  | `bot send-image <id> <img-url> [-d seconds]` | Shows an image/GIF as the bot's video frame (public URL required) |
130
+ | `bot raise-hand <id>` / `bot lower-hand <id>` | Raises or lowers the bot's hand with the meeting's own control (Google Meet, Zoom, Teams). The bot must be in the meeting (`409` otherwise). Prints `hand_raised`, the state read back from the meeting. Safe to repeat |
77
131
  | `bot remove <id>` | Makes the bot leave the meeting now (data is kept) |
78
132
  | `bot delete <id> --yes` | **Permanently** deletes audio/video/transcripts - the `--yes` flag is mandatory, no accidental deletes |
79
133
 
@@ -82,10 +136,14 @@ meetstream transcript <bot_id> --wait
82
136
  ```
83
137
  -n, --name <name> bot display name (default "MeetStream Bot")
84
138
  --video record video as well as audio (default: audio only)
85
- --video-layout <layout> with --video: speaker_view (default) or grid_view
139
+ --video-layout <layout> with --video: speaker_view (default) or grid_view;
140
+ Google Meet and Teams also accept
141
+ speaker_view_default, grid_view_default
86
142
  -t, --transcript <provider> deepgram | assemblyai | sarvam | meetstream |
87
- jigsawstack | meeting_captions |
88
- deepgram_streaming | assemblyai_streaming
143
+ jigsawstack | smallest | meeting_captions |
144
+ deepgram_streaming | assemblyai_streaming |
145
+ smallest_streaming (smallest* need your Smallest AI
146
+ key saved in the dashboard)
89
147
  -l, --language <lang> transcription language (provider-specific format)
90
148
  -c, --callback <url> HTTPS webhook for lifecycle events
91
149
  --join-at <iso8601> schedule a future join, e.g. 2026-07-02T15:00:00Z
@@ -96,6 +154,10 @@ meetstream transcript <bot_id> --wait
96
154
  --separate-video capture per-participant video streams
97
155
  --zoom-zak-url <url> Zoom: HTTPS endpoint returning a ZAK token (signed-in join)
98
156
  --zoom-obf-url <url> Zoom: HTTPS endpoint returning an OBF token (on-behalf-of join)
157
+ --zoom-use-own-app Zoom: always join with your own Zoom app
158
+ --no-zoom-use-own-app Zoom: always join with no setup (not with ZAK/OBF)
159
+ --storage-id <id> save the recording to this storage destination of
160
+ your workspace (default: the workspace default)
99
161
  --google-login-domain <domain> Google Meet: join signed in with an account from this
100
162
  registered Workspace domain (see `logins google`)
101
163
  --teams-login-domain <domain> Teams: join signed in with an account from this
@@ -104,10 +166,13 @@ meetstream transcript <bot_id> --wait
104
166
  (requires a login domain flag)
105
167
  --no-strict-email with --sign-in-email: fall back to any free account
106
168
  in the domain instead of failing (API default: strict)
107
- --agent-config-id <id> attach a MIA conversational agent
169
+ --agent-config <id> attach a voice agent (Agents API); nothing else is
170
+ needed (alias: --agent-config-id)
171
+ --agent-param <key=value...> agent_config_params for {{variable}} placeholders
108
172
  --live-transcript-webhook <url> webhook URL for live transcript chunks
109
173
  --live-audio-ws <wss> WebSocket URL for live audio out
110
- --live-video-ws <wss> WebSocket URL for live video out
174
+ --live-video-ws <wss> reserved: accepted by the API, but live video
175
+ is not delivered yet
111
176
  --socket-ws <wss> two-way bot-control WebSocket (socket_connection_url)
112
177
  --attr <key=value...> custom_attributes entries (echoed back in webhooks)
113
178
  --idempotency-key <uuid> safe-retry key - a retry returns the original
@@ -117,6 +182,8 @@ meetstream transcript <bot_id> --wait
117
182
  --max-recording-seconds <sec> max in-call recording seconds (default 14400)
118
183
  ```
119
184
 
185
+ **Zoom needs no setup.** Your API key and the meeting link are enough. With neither Zoom flag, the API chooses: no setup, or your own Zoom app when the account has saved Zoom app credentials or a connected Zoom account. `--zoom-zak-url` and `--zoom-obf-url` need your own Zoom app.
186
+
120
187
  **Signed-in bots.** `--google-login-domain` / `--teams-login-domain` send the `google_meet` / `teams` block (`login_required: true` plus the domain, and `sign_in_email` / `strict_email` when you pin an account). Pass one domain flag, not both. The CLI warns on stderr (and still sends) if the meeting link host doesn't match the platform. Signed-in Teams bots show the Microsoft account's own name and picture, so `--name` / `--image-url` are not applied.
121
188
 
122
189
  ```bash
@@ -154,9 +221,9 @@ printf '%s' "$BOT_PASSWORD" | meetstream logins teams add --domain bots.example.
154
221
  ### `transcript` / `transcriptions` / `transcribe` - transcription
155
222
  | Command | What it does |
156
223
  |---------|---------------|
157
- | `transcript <bot-id> [--wait] [--raw] [--json]` | Fetches the transcript, resolving `transcript_id` automatically (it's never in webhooks). `--wait` polls until ready. Default output is readable `Speaker: text` lines. |
158
- | `transcriptions <bot-id>` | Lists every transcription run for a bot - provider, status, presigned download URLs |
159
- | `transcribe <bot-id> -p <provider>` | (Re-)transcribes a bot's recorded audio, optionally with a different provider or language |
224
+ | `transcript <bot-id> [--wait] [--raw] [--json]` | Fetches the transcript, resolving `transcript_id` automatically (it's never in webhooks). `--wait` polls until ready. Default output is readable `Speaker: text` lines. A failed transcript (`422`) prints `Transcript failed: <reason>` and the next step, and exits with code 4: it will not become ready, so fix the cause and run `transcribe`. |
225
+ | `transcriptions <bot-id>` | Lists every transcription run for a bot - provider, status, download links |
226
+ | `transcribe <bot-id> -p <provider>` | (Re-)transcribes a bot's recorded audio, optionally with a different provider (`deepgram`, `assemblyai`, `sarvam`, `meetstream`, `jigsawstack`, `smallest`) or language |
160
227
 
161
228
  ### `calendar` - Google Calendar auto-join
162
229
  | Command | What it does |
@@ -169,12 +236,22 @@ printf '%s' "$BOT_PASSWORD" | meetstream logins teams add --domain bots.example.
169
236
  | `calendar reschedule <bot-id> <iso8601>` | Change a scheduled bot's join time |
170
237
  | `calendar cancel <bot-id>` | Delete a scheduled (not-yet-joined) bot |
171
238
 
172
- ### `mia` - conversational AI agents
239
+ ### `mia` (alias `agents`) - Agents API, voice agent configs
173
240
  | Command | What it does |
174
241
  |---------|---------------|
175
242
  | `mia list` | Lists agent configs |
176
- | `mia create -f <config.json>` | Creates an agent config (`agent_name`, `mode`, `model`, `voice`, `transcriber`, …) - attach it to a bot with `--agent-config-id` |
243
+ | `mia get <agent-config-id>` | Shows one agent config (secrets come back masked) |
244
+ | `mia create -f <config.json>` | Creates an agent config (`agent_name`, `mode`, `model`, `voice`, `transcriber`, `agent`, ...). Attach it with `bot create <link> --agent-config <id>` |
245
+ | `mia update <agent-config-id> -f <blocks.json>` | Updates a config (`PUT`): each block in the file replaces the saved block, so send whole blocks. Running bots are not changed |
177
246
  | `mia delete <agent-config-id>` | Deletes an agent config |
247
+ | `mia check <agent-config-id>` | Tests the connection to your local agent bridge (`model.provider: "local_agent"`). Exits 3 when the status is not `ok` |
248
+
249
+ The config file takes the fields of the [MIA API guide](https://docs.meetstream.ai/guides/mia/mia-api-guide), including `key_source` on `transcriber` / `model` / `voice`, `transcriber.language`, and the agent options `agent.tools` (`["screen"]` on Google Meet), `agent.chat_input`, `agent.quiet_actions` and `agent.speak_only_when_asked`.
250
+
251
+ ### `balance` - prepaid balance
252
+ | Command | What it does |
253
+ |---------|---------------|
254
+ | `balance [--json]` | Shows your prepaid balance (`GET /api/v1/billing/balance`, read only). Available when the balance endpoint is on for your account; until then it prints where to see the balance (https://app.meetstream.ai/billing) and exits 3 |
178
255
 
179
256
  ### `listen` - local webhook receiver
180
257
  | Command | What it does |
@@ -215,9 +292,12 @@ bot.joining → bot.in_waiting_room → bot.inmeeting → bot.recording → bot.
215
292
  |---------|-----|
216
293
  | "No API key found" | Run `meetstream auth set-key <key>` or `export MEETSTREAM_API_KEY=...` |
217
294
  | `auth status` fails with 401 | Key is invalid/revoked - generate a new one at [app.meetstream.ai/api-keys](https://app.meetstream.ai/api-keys) |
295
+ | `transcript` prints "Transcript failed: ..." (exit 4) | The transcript ended `Failed` (API `422`), for example the provider rejected the key or its usage limit was reached. Fix the cause, then `meetstream transcribe <bot-id>` |
296
+ | `mia create` fails with "MeetStream-managed keys are not available" | Inbuilt keys are not on for your account yet. Use your own provider key for that section (`"key_source": "user"`) |
218
297
  | `transcript` returns "not ready yet" | The meeting isn't fully processed, or the provider is streaming-only (no post-call transcript) - check `bot status` first |
219
298
  | `bot create` with a login domain fails with 400 "not registered" | Register the domain first: `meetstream logins teams add-domain <domain>` (or `logins google add-domain`) |
220
299
  | Signed-in Teams bot fails with 409 / 429 | The pinned account is busy or deactivated, or every account is in use. Add accounts (`logins teams add`), rotate a password (`set-password`), or use `--no-strict-email` |
300
+ | `HTTP 429 ... (retry after N s)` on `bot create` | Prepaid accounts can create only a few bots per minute and per hour. Wait N seconds, then run the command again with the same `--idempotency-key`. With `--json`, the error has `retry_after` |
221
301
  | `listen` events never arrive | Confirm the bot's `--callback` URL is a public HTTPS URL (use `ngrok http <port>`) - MeetStream will not retry non-2xx or unreachable webhooks |
222
302
 
223
303
  ## Development
@@ -229,7 +309,15 @@ npm test # node --test, fully mocked (no network)
229
309
 
230
310
  ---
231
311
 
232
- Docs: [docs.meetstream.ai](https://docs.meetstream.ai) · OpenAPI: [openapi.json](https://docs.meetstream.ai/openapi.json) · MCP server for AI agents: [meetstream-mcp](https://github.com/meetstream-ai/meetstream-mcp) (hosted at `https://mcp.meetstream.ai/mcp`) · Migrating from Recall.ai: [@meetstream/migrate](https://github.com/meetstream-ai/recall-meetstream-migration-kit)
312
+ ## Latest docs
313
+
314
+ - [Two ways to integrate](https://docs.meetstream.ai/guides/introduction/integration-paths) · [CLI](https://docs.meetstream.ai/build-with-ai/meetstream-cli)
315
+ - [Create Bot payload reference](https://docs.meetstream.ai/api-reference/create-bot-payload-reference) · [Webhooks and events](https://docs.meetstream.ai/guides/webhooks/webhooks-and-events) · [Errors](https://docs.meetstream.ai/errors)
316
+ - [MIA API guide](https://docs.meetstream.ai/guides/mia/mia-api-guide) · [Voice agent pricing and keys](https://docs.meetstream.ai/guides/mia/pricing-and-keys)
317
+
318
+ For the latest details, fetch the page with `.md` appended, read https://docs.meetstream.ai/llms.txt, or connect the docs MCP server at https://docs.meetstream.ai/_mcp/server. If this README and the docs differ, the docs are correct.
319
+
320
+ OpenAPI: [openapi.json](https://docs.meetstream.ai/openapi.json) · Hosted MCP server for AI agents: `https://mcp.meetstream.ai/mcp` ([docs](https://docs.meetstream.ai/build-with-ai/meetstream-mcp-server)) · Migrating from Recall.ai: [@meetstream/migrate](https://www.npmjs.com/package/@meetstream/migrate) · Changes: [CHANGELOG.md](CHANGELOG.md)
233
321
 
234
322
  MIT © MeetStream.ai
235
323
 
package/bin/meetstream.js CHANGED
@@ -7,7 +7,7 @@ import { resolveApiKey } from '../src/config.js';
7
7
  import { fail } from '../src/output.js';
8
8
  import { registerBotCommands } from '../src/commands/bot.js';
9
9
  import { registerTranscriptCommands } from '../src/commands/transcript.js';
10
- import { registerAuthCommands, registerCalendarCommands, registerMiaCommands } from '../src/commands/misc.js';
10
+ import { registerAuthCommands, registerCalendarCommands, registerMiaCommands, registerBalanceCommand } from '../src/commands/misc.js';
11
11
  import { registerListenCommand } from '../src/commands/listen.js';
12
12
  import { registerLoginsCommands } from '../src/commands/logins.js';
13
13
  import { track, shutdownTelemetry } from '../src/telemetry.js';
@@ -32,6 +32,7 @@ registerBotCommands(program, getClient);
32
32
  registerTranscriptCommands(program, getClient);
33
33
  registerCalendarCommands(program, getClient);
34
34
  registerMiaCommands(program, getClient);
35
+ registerBalanceCommand(program, getClient);
35
36
  registerLoginsCommands(program, getClient);
36
37
  registerListenCommand(program);
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetstream/cli",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "Official MeetStream CLI: create meeting bots, fetch transcripts, and stream webhook events from your terminal. Zoom, Google Meet, Microsoft Teams, including signed-in bots.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "bin",
11
11
  "src",
12
12
  "README.md",
13
- "LICENSE"
13
+ "LICENSE",
14
+ "CHANGELOG.md"
14
15
  ],
15
16
  "scripts": {
16
17
  "test": "node --test"
package/src/api.js CHANGED
@@ -3,15 +3,35 @@
3
3
  import { BASE_URL } from './config.js';
4
4
 
5
5
  export class ApiError extends Error {
6
- constructor(message, { status, body, path } = {}) {
6
+ constructor(message, { status, body, path, retryAfter } = {}) {
7
7
  super(message);
8
8
  this.name = 'ApiError';
9
9
  this.status = status;
10
10
  this.body = body;
11
11
  this.path = path;
12
+ // Seconds from the Retry-After header (429 rate limit, 409 while an
13
+ // idempotent create is still saving). undefined when the API sent none.
14
+ this.retryAfter = retryAfter;
12
15
  }
13
16
  }
14
17
 
18
+ /** Error text from a response body: message, then detail, then error, then a bare string. */
19
+ export function errorDetail(data) {
20
+ if (typeof data === 'object' && data !== null) {
21
+ return data.message || data.detail || data.error || JSON.stringify(data);
22
+ }
23
+ return String(data).slice(0, 300);
24
+ }
25
+
26
+ function retryAfterSeconds(res) {
27
+ const v = res.headers?.get?.('retry-after');
28
+ if (v == null || String(v).trim() === '') return undefined;
29
+ const n = Number(v);
30
+ if (Number.isFinite(n)) return Math.max(0, Math.ceil(n));
31
+ const when = Date.parse(v); // HTTP-date form
32
+ return Number.isNaN(when) ? undefined : Math.max(0, Math.ceil((when - Date.now()) / 1000));
33
+ }
34
+
15
35
  export class MeetStreamClient {
16
36
  constructor(apiKey, { baseUrl = BASE_URL, fetchImpl = fetch } = {}) {
17
37
  this.apiKey = apiKey;
@@ -39,11 +59,10 @@ export class MeetStreamClient {
39
59
  try { data = text ? JSON.parse(text) : null; } catch { data = text; }
40
60
  // 507 = idempotent replay of an existing bot - a success, not an error.
41
61
  if (!res.ok && res.status !== 507) {
42
- const detail = typeof data === 'object' && data !== null
43
- ? (data.detail || data.message || data.error || JSON.stringify(data))
44
- : String(data).slice(0, 300);
45
- throw new ApiError(`${method} ${path} → HTTP ${res.status}: ${detail}`, {
46
- status: res.status, body: data, path,
62
+ const retryAfter = retryAfterSeconds(res);
63
+ const suffix = retryAfter !== undefined ? ` (retry after ${retryAfter} s)` : '';
64
+ throw new ApiError(`${method} ${path} → HTTP ${res.status}: ${errorDetail(data)}${suffix}`, {
65
+ status: res.status, body: data, path, retryAfter,
47
66
  });
48
67
  }
49
68
  return { status: res.status, data };
@@ -57,14 +76,26 @@ export class MeetStreamClient {
57
76
  listBots() { return this.request('GET', '/bots'); }
58
77
  botStatus(botId) { return this.request('GET', `/bots/${botId}/status`); }
59
78
  botDetail(botId) { return this.request('GET', `/bots/${botId}/detail`); }
60
- botSummary(botId) { return this.request('GET', `/bots/${botId}/summary`); }
61
79
  botAudio(botId) { return this.request('GET', `/bots/${botId}/get_audio`); }
62
80
  botVideo(botId) { return this.request('GET', `/bots/${botId}/get_video`); }
63
81
  recordingStreams(botId) { return this.request('GET', `/bots/${botId}/get_recording_streams`); }
64
82
  audioStreams(botId) { return this.request('GET', `/bots/${botId}/get_audio_streams`); }
65
83
  speakerTimeline(botId) { return this.request('GET', `/bots/${botId}/get_speaker_timeline`); }
84
+ /**
85
+ * A large speaker timeline comes back as { bot_id, speaker_timeline_url, size_bytes, truncated }
86
+ * instead of the timeline itself. This downloads the file from that pre-signed URL (valid 1 hour).
87
+ * The URL needs no API key, so no Authorization header is sent to it.
88
+ */
89
+ async downloadSpeakerTimeline(url) {
90
+ const res = await this.fetch(url, { method: 'GET' });
91
+ const text = await res.text();
92
+ if (!res.ok) {
93
+ throw new ApiError(`GET speaker_timeline_url → HTTP ${res.status}: ${String(text).slice(0, 300)}`, { status: res.status, path: 'speaker_timeline_url' });
94
+ }
95
+ try { return JSON.parse(text); } catch { return text; }
96
+ }
66
97
  chats(botId) { return this.request('GET', `/bots/${botId}/get_chats`); }
67
- screenshots(botId) { return this.request('GET', `/bots/${botId}/get_screenshots`); }
98
+ screenshots(botId) { return this.request('GET', `/bots/${botId}/screenshots`); }
68
99
  participants(botId) { return this.request('GET', `/bots/${botId}/get_participants`); }
69
100
  removeBot(botId) { return this.request('GET', `/bots/${botId}/remove_bot`); } // GET, not DELETE
70
101
  deleteBotData(botId) { return this.request('DELETE', `/bots/${botId}/delete`); }
@@ -77,6 +108,13 @@ export class MeetStreamClient {
77
108
  });
78
109
  }
79
110
 
111
+ /** In-meeting command, e.g. raise_hand / lower_hand. The bot must be in the meeting. */
112
+ sendCommand(botId, command) {
113
+ return this.request('POST', `/bots/${botId}/send_command`, { body: { command } });
114
+ }
115
+ raiseHand(botId) { return this.sendCommand(botId, 'raise_hand'); }
116
+ lowerHand(botId) { return this.sendCommand(botId, 'lower_hand'); }
117
+
80
118
  // ── Transcription ─────────────────────────────────────────────────────
81
119
  transcriptions(botId) { return this.request('GET', `/bots/${botId}/transcriptions`); }
82
120
  transcribe(botId, provider, callbackUrl) {
@@ -120,7 +158,8 @@ export class MeetStreamClient {
120
158
  return { transcript_id: tid, transcript: segments };
121
159
  }
122
160
  } catch (e) {
123
- if (!wait || (e.status && e.status !== 404 && e.status !== 400)) throw e;
161
+ // 422 = the transcript failed: final, never poll it.
162
+ if (!wait || e.status === 422 || (e.status && e.status !== 404 && e.status !== 400)) throw e;
124
163
  }
125
164
  }
126
165
  if (!wait || Date.now() > deadline) {
@@ -131,6 +170,10 @@ export class MeetStreamClient {
131
170
  }
132
171
  }
133
172
 
173
+ // ── Billing ───────────────────────────────────────────────────────────
174
+ /** Prepaid balance, read only. 404 while the endpoint is not on for the account. */
175
+ balance() { return this.request('GET', '/billing/balance'); }
176
+
134
177
  // ── Calendar ──────────────────────────────────────────────────────────
135
178
  connectCalendar({ clientId, clientSecret, refreshToken }) {
136
179
  return this.request('POST', '/calendar/create_calendar', {
@@ -142,7 +185,7 @@ export class MeetStreamClient {
142
185
  body: { google_client_id: clientId, google_client_secret: clientSecret, google_refresh_token: refreshToken },
143
186
  });
144
187
  }
145
- listCalendars() { return this.request('GET', '/calendar'); }
188
+ listCalendars() { return this.request('GET', '/calendar/calendars'); }
146
189
  calendarEvents() { return this.request('GET', '/calendar/events'); }
147
190
  scheduleEvent(eventId) { return this.request('POST', `/calendar/schedule/${eventId}`); }
148
191
  unscheduleEvent(eventId) { return this.request('DELETE', `/calendar/schedule/${eventId}`); }
@@ -162,8 +205,14 @@ export class MeetStreamClient {
162
205
 
163
206
  // ── MIA (conversational agents) ───────────────────────────────────────
164
207
  miaList() { return this.request('GET', '/mia'); }
208
+ miaGet(agentConfigId) { return this.request('GET', '/mia', { query: { agent_config_id: agentConfigId } }); }
165
209
  miaCreate(config) { return this.request('POST', '/mia', { body: config }); }
210
+ /** PUT replaces each block you send; the body must carry agent_config_id. */
166
211
  miaUpdate(config) { return this.request('PUT', '/mia', { body: config }); }
212
+ /** Test the connection to a local agent bridge (model.provider "local_agent"). */
213
+ miaCheckLocalAgent(agentConfigId) {
214
+ return this.request('GET', '/mia', { query: { agent_config_id: agentConfigId, check: 'local_agent' } });
215
+ }
167
216
  miaDelete(agentConfigId) { return this.request('DELETE', '/mia', { query: { agent_config_id: agentConfigId } }); }
168
217
 
169
218
  // ── Signed-in bots: Microsoft Teams logins ────────────────────────────
@@ -235,6 +284,10 @@ export class MeetStreamClient {
235
284
 
236
285
  const enc = (s) => encodeURIComponent(String(s));
237
286
 
287
+ // recording_config.video_layout values. The *_default layouts are Google Meet and Teams only (the API returns 400 on Zoom).
288
+ const VIDEO_LAYOUTS = ['speaker_view', 'grid_view', 'speaker_view_default', 'grid_view_default'];
289
+ const STORAGE_ID_RE = /^[A-Za-z0-9_-]{1,80}$/;
290
+
238
291
  const TEAMS_HOSTS = ['teams.microsoft.com', 'teams.live.com', 'teams.cloud.microsoft'];
239
292
  const GOOGLE_HOSTS = ['meet.google.com'];
240
293
 
@@ -304,6 +357,7 @@ export function buildCreateBotPayload(opts) {
304
357
  if (opts.callback) payload.callback_url = opts.callback;
305
358
  if (opts.joinAt) payload.join_at = opts.joinAt;
306
359
  if (opts.agentConfigId) payload.agent_config_id = opts.agentConfigId;
360
+ if (opts.agentConfigParams && Object.keys(opts.agentConfigParams).length) payload.agent_config_params = opts.agentConfigParams;
307
361
  if (opts.separateAudio) payload.audio_separate_streams = true;
308
362
  // Per-participant video is opt-in only: never set implicitly.
309
363
  if (opts.separateVideo) payload.video_separate_streams = true;
@@ -313,8 +367,8 @@ export function buildCreateBotPayload(opts) {
313
367
  // video_layout applies to mixed video only, so audio-only bots never carry it.
314
368
  if (payload.video_required) {
315
369
  const layout = String(opts.videoLayout || 'speaker_view').toLowerCase();
316
- if (!['speaker_view', 'grid_view'].includes(layout)) {
317
- throw usageError("--video-layout must be speaker_view or grid_view.");
370
+ if (!VIDEO_LAYOUTS.includes(layout)) {
371
+ throw usageError('--video-layout must be speaker_view or grid_view (Google Meet and Teams also accept speaker_view_default or grid_view_default).');
318
372
  }
319
373
  payload.recording_config = { ...(payload.recording_config || {}), video_layout: layout };
320
374
  } else if (opts.videoLayout) {
@@ -324,11 +378,25 @@ export function buildCreateBotPayload(opts) {
324
378
  throw new Error('--zoom-obf was removed: the API rejects use_zoom_obf. Use --zoom-obf-url <https-url> or --zoom-zak-url <https-url>.');
325
379
  }
326
380
  // Authenticated Zoom joins: each URL is an HTTPS endpoint on the caller's server that returns a fresh token.
381
+ // Both need the account's own Zoom app, so they cannot go with --no-zoom-use-own-app.
382
+ if (opts.zoomUseOwnApp === false && (opts.zoomZakUrl || opts.zoomObfUrl)) {
383
+ throw usageError('--zoom-zak-url and --zoom-obf-url need your own Zoom app; they cannot be used with --no-zoom-use-own-app.');
384
+ }
327
385
  if (opts.zoomZakUrl || opts.zoomObfUrl) {
328
386
  payload.zoom = {};
329
387
  if (opts.zoomZakUrl) payload.zoom.zak_url = opts.zoomZakUrl;
330
388
  if (opts.zoomObfUrl) payload.zoom.obf_url = opts.zoomObfUrl;
331
389
  }
390
+ // Zoom join choice. Omitted = automatic: no setup, or the account's own Zoom app when it has one.
391
+ if (typeof opts.zoomUseOwnApp === 'boolean') {
392
+ payload.zoom = { ...(payload.zoom || {}), use_own_app: opts.zoomUseOwnApp };
393
+ }
394
+ if (opts.storageId !== undefined) {
395
+ if (!STORAGE_ID_RE.test(String(opts.storageId))) {
396
+ throw usageError('--storage-id must be 1-80 letters, numbers, underscores or hyphens.');
397
+ }
398
+ payload.storage_id = String(opts.storageId);
399
+ }
332
400
  // Signed-in bots: Google Meet (google_meet) or Microsoft Teams (teams) accounts registered via `meetstream logins`.
333
401
  const signedIn = buildSignedInBlock(opts);
334
402
  if (signedIn) payload[signedIn.key] = signedIn.block;
@@ -349,6 +417,9 @@ export function buildCreateBotPayload(opts) {
349
417
  else if (p === 'meeting_captions') provider.meeting_captions = {};
350
418
  else if (p === 'deepgram_streaming') provider.deepgram_streaming = { model: 'nova-3', language: opts.language || 'en' };
351
419
  else if (p === 'assemblyai_streaming') provider.assemblyai_streaming = {};
420
+ // Smallest AI needs the account's Smallest AI key saved in the MeetStream dashboard.
421
+ else if (p === 'smallest') provider.smallest = { model: 'pulse', language: opts.language || 'en', diarize: true };
422
+ else if (p === 'smallest_streaming') provider.smallest_streaming = { model: 'pulse', language: opts.language || 'en' };
352
423
  else provider[p] = {};
353
424
  payload.recording_config = {
354
425
  ...(payload.recording_config || {}),
@@ -372,3 +443,4 @@ export function buildCreateBotPayload(opts) {
372
443
  };
373
444
  return payload;
374
445
  }
446
+
@@ -1,11 +1,11 @@
1
1
  import { buildCreateBotPayload, signedInWarnings } from '../api.js';
2
2
  import { printJson, ok, kv, bold, dim, cyan, transcriptToText, handleError, warnErr } from '../output.js';
3
3
 
4
- function parseAttrs(list = []) {
4
+ function parseAttrs(list = [], flag = '--attr') {
5
5
  const out = {};
6
6
  for (const item of list) {
7
7
  const i = item.indexOf('=');
8
- if (i === -1) throw Object.assign(new Error(`--attr expects key=value, got "${item}"`), { exitCode: 2 });
8
+ if (i === -1) throw Object.assign(new Error(`${flag} expects key=value, got "${item}"`), { exitCode: 2 });
9
9
  out[item.slice(0, i)] = item.slice(i + 1); // values kept as strings (API expects strings)
10
10
  }
11
11
  return out;
@@ -16,12 +16,12 @@ export function registerBotCommands(program, getClient) {
16
16
 
17
17
  bot
18
18
  .command('create')
19
- .description('Send a bot to a meeting (or schedule with --join-at)')
19
+ .description('Send a bot to a meeting (or schedule with --join-at). Zoom needs no setup: the API key and the link are enough')
20
20
  .argument('<meeting-link>', 'Zoom / Google Meet / Teams meeting URL')
21
21
  .option('-n, --name <name>', 'bot display name', 'MeetStream Bot')
22
22
  .option('--video', 'record video as well as audio (default: audio only)')
23
- .option('--video-layout <layout>', 'with --video: speaker_view (default) or grid_view')
24
- .option('-t, --transcript <provider>', 'deepgram | assemblyai | sarvam | meetstream | jigsawstack | meeting_captions | deepgram_streaming | assemblyai_streaming')
23
+ .option('--video-layout <layout>', 'with --video: speaker_view (default) or grid_view; Google Meet and Teams also accept speaker_view_default, grid_view_default')
24
+ .option('-t, --transcript <provider>', 'deepgram | assemblyai | sarvam | meetstream | jigsawstack | smallest | meeting_captions | deepgram_streaming | assemblyai_streaming | smallest_streaming (smallest* need your Smallest AI key saved in the dashboard)')
25
25
  .option('-l, --language <lang>', 'transcription language (provider-specific format)')
26
26
  .option('-c, --callback <url>', 'HTTPS webhook for lifecycle events')
27
27
  .option('--join-at <iso8601>', 'schedule a future join, e.g. 2026-07-02T15:00:00Z')
@@ -33,14 +33,19 @@ export function registerBotCommands(program, getClient) {
33
33
  .option('--zoom-zak-url <url>', 'Zoom: HTTPS endpoint on your server returning a ZAK token (join as a signed-in user)')
34
34
  .option('--zoom-obf-url <url>', 'Zoom: HTTPS endpoint on your server returning an OBF token (join on behalf of a user in the meeting)')
35
35
  .option('--zoom-obf', 'removed: use --zoom-obf-url')
36
+ .option('--zoom-use-own-app', 'Zoom: always join with your own Zoom app (default: automatic, no setup unless the account has its own Zoom app)')
37
+ .option('--no-zoom-use-own-app', 'Zoom: always join with no setup (cannot be combined with --zoom-zak-url / --zoom-obf-url)')
38
+ .option('--storage-id <id>', 'save the recording to this storage destination of your workspace (default: the workspace default)')
36
39
  .option('--google-login-domain <domain>', 'Google Meet: join signed in with an account from this registered Workspace domain (see: meetstream logins google)')
37
40
  .option('--teams-login-domain <domain>', 'Teams: join signed in with an account from this registered Microsoft 365 domain (see: meetstream logins teams)')
38
41
  .option('--sign-in-email <email>', 'signed-in bots: pin one registered account (needs a login domain flag)')
39
42
  .option('--no-strict-email', 'with --sign-in-email: fall back to any free account in the domain instead of failing')
40
- .option('--agent-config-id <id>', 'attach a MIA conversational agent')
43
+ .option('--agent-config <id>', 'attach a voice agent (Agents API): the agent_config_id from "meetstream mia create". Nothing else is needed')
44
+ .option('--agent-config-id <id>', 'same as --agent-config')
45
+ .option('--agent-param <key=value...>', 'agent_config_params: values for {{variable}} placeholders in the agent prompt')
41
46
  .option('--live-transcript-webhook <url>', 'webhook URL for live transcript chunks')
42
47
  .option('--live-audio-ws <wss>', 'WebSocket URL for live audio out')
43
- .option('--live-video-ws <wss>', 'WebSocket URL for live video out')
48
+ .option('--live-video-ws <wss>', 'reserved: the API accepts live_video_required.websocket_url but does not deliver live video yet')
44
49
  .option('--socket-ws <wss>', 'two-way bot-control WebSocket (socket_connection_url)')
45
50
  .option('--attr <key=value...>', 'custom_attributes entries (echoed back in webhooks)')
46
51
  .option('--idempotency-key <uuid>', 'safe-retry key (retry returns HTTP 507 with the original bot)')
@@ -67,11 +72,14 @@ export function registerBotCommands(program, getClient) {
67
72
  zoomObf: opts.zoomObf,
68
73
  zoomZakUrl: opts.zoomZakUrl,
69
74
  zoomObfUrl: opts.zoomObfUrl,
75
+ zoomUseOwnApp: opts.zoomUseOwnApp,
76
+ storageId: opts.storageId,
70
77
  googleLoginDomain: opts.googleLoginDomain,
71
78
  teamsLoginDomain: opts.teamsLoginDomain,
72
79
  signInEmail: opts.signInEmail,
73
80
  strictEmail: opts.strictEmail,
74
- agentConfigId: opts.agentConfigId,
81
+ agentConfigId: opts.agentConfig || opts.agentConfigId,
82
+ agentConfigParams: parseAttrs(opts.agentParam, '--agent-param'),
75
83
  liveTranscriptWebhook: opts.liveTranscriptWebhook,
76
84
  liveAudioWs: opts.liveAudioWs,
77
85
  liveVideoWs: opts.liveVideoWs,
@@ -81,6 +89,9 @@ export function registerBotCommands(program, getClient) {
81
89
  waitingRoomTimeout: opts.waitingRoomTimeout,
82
90
  maxRecordingSeconds: opts.maxRecordingSeconds,
83
91
  });
92
+ if (payload.agent_config_id && (opts.socketWs || opts.liveAudioWs)) {
93
+ warnErr('A voice agent needs only --agent-config. --socket-ws / --live-audio-ws are for your own bridge and are the usual cause of a silent agent.');
94
+ }
84
95
  for (const w of signedInWarnings({ meetingLink, googleLoginDomain: opts.googleLoginDomain, teamsLoginDomain: opts.teamsLoginDomain })) warnErr(w);
85
96
  const { status, data } = await getClient().createBot(payload, { idempotencyKey: opts.idempotencyKey });
86
97
  if (opts.json) return printJson(data);
@@ -134,12 +145,10 @@ export function registerBotCommands(program, getClient) {
134
145
 
135
146
  const simpleGets = [
136
147
  ['detail', 'botDetail', 'Full session metadata (incl. transcript_id + caption_file)'],
137
- ['summary', 'botSummary', "MeetStream's built-in AI meeting summary"],
138
- ['audio', 'botAudio', 'Recorded audio URL (presigned S3, valid 1h)'],
139
- ['video', 'botVideo', 'Recorded video URL (presigned S3, valid 10min)'],
148
+ ['audio', 'botAudio', 'Recorded audio download link (valid 1 hour)'],
149
+ ['video', 'botVideo', 'Recorded video download link (valid 1 hour)'],
140
150
  ['streams', 'recordingStreams', 'Per-participant video streams (needs --separate-video at create)'],
141
151
  ['audio-streams', 'audioStreams', 'Per-participant audio streams (needs --separate-audio at create)'],
142
- ['timeline', 'speakerTimeline', 'Speaker timeline (who spoke when)'],
143
152
  ['chats', 'chats', 'In-meeting chat messages'],
144
153
  ['screenshots', 'screenshots', 'Screenshots captured during the meeting'],
145
154
  ['participants', 'participants', 'Participant list'],
@@ -158,6 +167,50 @@ export function registerBotCommands(program, getClient) {
158
167
  });
159
168
  }
160
169
 
170
+ bot
171
+ .command('timeline')
172
+ .description('Speaker timeline (who spoke when). A very large timeline comes back as a download link; --download fetches it')
173
+ .argument('<bot-id>')
174
+ .option('--download', 'when the API returns speaker_timeline_url, download the file and print the timeline')
175
+ .option('--json', 'JSON output')
176
+ .action(async (botId, opts) => {
177
+ try {
178
+ const client = getClient();
179
+ const { data } = await client.speakerTimeline(botId);
180
+ const url = data && typeof data === 'object' && !Array.isArray(data) ? data.speaker_timeline_url : undefined;
181
+ if (url && opts.download) return printJson(await client.downloadSpeakerTimeline(url));
182
+ if (url) warnErr(`The timeline is ${data.size_bytes ?? 'too many'} bytes, so the API returned a download link (valid 1 hour). Run again with --download to fetch it.`);
183
+ printJson(data);
184
+ } catch (e) { handleError(e, opts); }
185
+ });
186
+
187
+ bot
188
+ .command('summary')
189
+ .description('Removed: the API has no summary endpoint. Use: meetstream transcript <bot-id>')
190
+ .argument('<bot-id>')
191
+ .option('--json', 'JSON output')
192
+ .action((botId, opts) => {
193
+ const err = new Error(`MeetStream has no meeting summary endpoint. Fetch the transcript and summarize it: meetstream transcript ${botId}`);
194
+ err.exitCode = 2;
195
+ handleError(err, opts);
196
+ });
197
+
198
+ for (const [name, method, label] of [['raise-hand', 'raiseHand', 'raised'], ['lower-hand', 'lowerHand', 'lowered']]) {
199
+ bot
200
+ .command(name)
201
+ .description(`${label === 'raised' ? 'Raise' : 'Lower'} the bot's hand in the live meeting (Google Meet, Zoom, Teams; the bot must be in the meeting)`)
202
+ .argument('<bot-id>')
203
+ .option('--json', 'JSON output')
204
+ .action(async (botId, opts) => {
205
+ try {
206
+ const { data } = await getClient()[method](botId);
207
+ if (opts.json) return printJson(data);
208
+ ok(`Hand ${label}`);
209
+ kv({ hand_raised: String(data?.hand_raised ?? '(not reported)') });
210
+ } catch (e) { handleError(e, opts); }
211
+ });
212
+ }
213
+
161
214
  bot
162
215
  .command('remove')
163
216
  .description('Remove the bot from an active meeting (data is kept)')
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { printJson, ok, kv, dim, handleError } from '../output.js';
2
+ import { printJson, ok, kv, dim, warn, handleError } from '../output.js';
3
3
  import { saveConfig, resolveApiKey, CONFIG_PATH, BASE_URL } from '../config.js';
4
4
 
5
5
  export function registerAuthCommands(program, getClient) {
@@ -78,24 +78,110 @@ export function registerCalendarCommands(program, getClient) {
78
78
  });
79
79
  }
80
80
 
81
+ function readJsonFile(path) {
82
+ try {
83
+ return JSON.parse(readFileSync(path, 'utf8'));
84
+ } catch (e) {
85
+ throw Object.assign(new Error(`Could not read JSON from ${path}: ${e.message}`), { exitCode: 2 });
86
+ }
87
+ }
88
+
81
89
  export function registerMiaCommands(program, getClient) {
82
- const mia = program.command('mia').description('MIA conversational AI agents');
83
- mia.command('list').description('List agent configs').action(async (opts) => {
90
+ const mia = program
91
+ .command('mia')
92
+ .alias('agents')
93
+ .description('Agents API: voice agent (MIA) configs. Attach one to a bot with: bot create <link> --agent-config <id>');
94
+
95
+ mia.command('list').description('List agent configs').option('--json', 'JSON output').action(async (opts) => {
84
96
  try { printJson((await getClient().miaList()).data); } catch (e) { handleError(e, opts); }
85
97
  });
98
+
99
+ mia.command('get').description('Show one agent config (secrets come back masked)').argument('<agent-config-id>')
100
+ .option('--json', 'JSON output')
101
+ .action(async (id, opts) => {
102
+ try { printJson((await getClient().miaGet(id)).data); } catch (e) { handleError(e, opts); }
103
+ });
104
+
86
105
  mia
87
106
  .command('create')
88
- .description('Create an agent config from a JSON file (agent_name, mode, model, voice, transcriber, …)')
107
+ .description('Create an agent config from a JSON file (agent_name, mode, model, voice, transcriber, agent, ...)')
89
108
  .requiredOption('-f, --file <path>', 'JSON config file')
109
+ .option('--json', 'JSON output')
90
110
  .action(async (opts) => {
91
111
  try {
92
- const cfg = JSON.parse(readFileSync(opts.file, 'utf8'));
93
- const { data } = await getClient().miaCreate(cfg);
112
+ const { data } = await getClient().miaCreate(readJsonFile(opts.file));
113
+ if (opts.json) return printJson(data);
94
114
  ok('Agent config created'); printJson(data);
95
- console.log(dim('Attach it to a bot: meetstream bot create <link> --agent-config-id <id> --socket-ws <wss> --live-audio-ws <wss>'));
115
+ const id = data?.agent_config_id || '<agent-config-id>';
116
+ console.log(dim(`Attach it to a bot (nothing else is needed): meetstream bot create <meeting-link> --agent-config ${id}`));
96
117
  } catch (e) { handleError(e, opts); }
97
118
  });
98
- mia.command('delete').description('Delete an agent config').argument('<agent-config-id>').action(async (id, opts) => {
99
- try { printJson((await getClient().miaDelete(id)).data); ok('Deleted'); } catch (e) { handleError(e, opts); }
100
- });
119
+
120
+ mia
121
+ .command('update')
122
+ .description('Update an agent config from a JSON file (PUT: each block you send replaces the saved block, so send whole blocks)')
123
+ .argument('<agent-config-id>')
124
+ .requiredOption('-f, --file <path>', 'JSON file with the blocks to replace')
125
+ .option('--json', 'JSON output')
126
+ .action(async (id, opts) => {
127
+ try {
128
+ const body = { ...readJsonFile(opts.file), agent_config_id: id };
129
+ const { data } = await getClient().miaUpdate(body);
130
+ if (opts.json) return printJson(data);
131
+ ok('Agent config updated'); printJson(data);
132
+ } catch (e) { handleError(e, opts); }
133
+ });
134
+
135
+ mia.command('delete').description('Delete an agent config').argument('<agent-config-id>').option('--json', 'JSON output')
136
+ .action(async (id, opts) => {
137
+ try {
138
+ const { data } = await getClient().miaDelete(id);
139
+ if (opts.json) return printJson(data);
140
+ printJson(data); ok('Deleted');
141
+ } catch (e) { handleError(e, opts); }
142
+ });
143
+
144
+ mia
145
+ .command('check')
146
+ .description('Test the connection to your local agent bridge (model.provider "local_agent"; needs the local agent feature on for your account)')
147
+ .argument('<agent-config-id>')
148
+ .option('--json', 'JSON output')
149
+ .action(async (id, opts) => {
150
+ try {
151
+ const { data } = await getClient().miaCheckLocalAgent(id);
152
+ if (opts.json) return printJson(data);
153
+ const status = data?.local_agent?.status;
154
+ if (status === 'ok') ok(`Local agent bridge is reachable (${data.local_agent.latency_ms ?? '?'} ms)`);
155
+ else warn(`Local agent bridge status: ${status ?? 'unknown'}`);
156
+ printJson(data);
157
+ if (status && status !== 'ok') process.exit(3);
158
+ } catch (e) { handleError(e, opts); }
159
+ });
160
+ }
161
+
162
+ export function registerBalanceCommand(program, getClient) {
163
+ program
164
+ .command('balance')
165
+ .description('Show your prepaid balance (read only; available when the balance endpoint is on for your account)')
166
+ .option('--json', 'JSON output')
167
+ .action(async (opts) => {
168
+ try {
169
+ const { data } = await getClient().balance();
170
+ if (opts.json) return printJson(data);
171
+ if (data?.balance_usd == null) {
172
+ kv({ customer_type: data?.customer_type, balance: 'no prepaid balance (billed by invoice)' });
173
+ } else {
174
+ kv({ customer_type: data?.customer_type, balance: `${data.balance_usd} ${data.currency || 'USD'}` });
175
+ }
176
+ console.log(dim(' Top up: https://app.meetstream.ai/billing'));
177
+ } catch (e) {
178
+ if (e.status === 404) {
179
+ const msg = 'The balance endpoint is not available for this account yet. See your balance at https://app.meetstream.ai/billing';
180
+ if (opts.json) printJson({ error: 'balance_unavailable', status: 404, message: msg, billing_url: 'https://app.meetstream.ai/billing' });
181
+ else warn(msg);
182
+ process.exit(3);
183
+ }
184
+ handleError(e, opts);
185
+ }
186
+ });
101
187
  }
@@ -41,7 +41,7 @@ export function registerTranscriptCommands(program, getClient) {
41
41
  .command('transcribe')
42
42
  .description('Run (or re-run) transcription on a bot\'s recorded audio')
43
43
  .argument('<bot-id>')
44
- .option('-p, --provider <name>', 'deepgram | assemblyai | sarvam | meetstream | jigsawstack', 'deepgram')
44
+ .option('-p, --provider <name>', 'deepgram | assemblyai | sarvam | meetstream | jigsawstack | smallest (needs your Smallest AI key saved in the dashboard)', 'deepgram')
45
45
  .option('-l, --language <lang>', 'language (provider-specific format)')
46
46
  .option('-c, --callback <url>', 'webhook to notify when done')
47
47
  .option('--json', 'JSON output')
@@ -54,6 +54,7 @@ export function registerTranscriptCommands(program, getClient) {
54
54
  else if (p === 'sarvam') provider.sarvam = { model: 'saarika:v2', language_code: opts.language || 'en-IN', mode: 'batch' };
55
55
  else if (p === 'meetstream') provider.meetstream = { language: opts.language || 'auto', translate: false };
56
56
  else if (p === 'jigsawstack') provider.jigsawstack = { language: opts.language || 'auto', translate: false };
57
+ else if (p === 'smallest') provider.smallest = { model: 'pulse', language: opts.language || 'en' };
57
58
  else provider[p] = {};
58
59
  const { data } = await getClient().transcribe(botId, provider, opts.callback);
59
60
  if (opts.json) return printJson(data);
package/src/output.js CHANGED
@@ -35,12 +35,43 @@ export function transcriptToText(segments) {
35
35
  .join('\n');
36
36
  }
37
37
 
38
+ const FAILED_TRANSCRIPT_EXIT = 4;
39
+
40
+ /** For a failed transcript (422 with transcript_status): { reason, transcript_status, transcript_id }, else null. */
41
+ export function failedTranscript(err) {
42
+ if (err?.status !== 422 || typeof err?.body?.transcript_status !== 'string') return null;
43
+ const msg = typeof err.body.message === 'string' ? err.body.message : '';
44
+ return {
45
+ reason: msg.replace(/^Transcript processing failed:?\s*/i, '') || msg || 'no reason given',
46
+ transcript_status: err.body.transcript_status,
47
+ transcript_id: err.body.transcript_id,
48
+ };
49
+ }
50
+
38
51
  export function handleError(err, { json = false } = {}) {
52
+ const failed = failedTranscript(err);
53
+ if (failed) {
54
+ if (json) {
55
+ printJson({ error: 'transcript_failed', status: 422, ...failed });
56
+ } else {
57
+ fail(`Transcript failed: ${failed.reason}`);
58
+ console.error(dim(` transcript_id ${failed.transcript_id ?? '(unknown)'}, status ${failed.transcript_status}. It will not become ready, so do not retry.`));
59
+ console.error(dim(' Fix the cause (for example the provider API key or its usage limit), then run: meetstream transcribe <bot-id>'));
60
+ }
61
+ process.exit(FAILED_TRANSCRIPT_EXIT);
62
+ }
39
63
  if (json) {
40
- printJson({ error: err.message, status: err.status, body: err.body });
64
+ printJson({ error: err.message, status: err.status, body: err.body, ...(err.retryAfter !== undefined ? { retry_after: err.retryAfter } : {}) });
41
65
  } else {
42
66
  fail(err.message);
67
+ if (/MeetStream-managed keys are not available/i.test(err.message || '')) {
68
+ console.error(dim(' MeetStream\'s inbuilt keys are not on for your account yet. Use your own provider key for that section'));
69
+ console.error(dim(' ("key_source": "user", key saved under Integrations), then run the command again.'));
70
+ }
43
71
  if (err.status === 401) console.error(dim(' Check your API key: https://app.meetstream.ai/api-keys'));
72
+ if (err.status === 429 && err.retryAfter !== undefined) {
73
+ console.error(dim(` Rate limited. Wait ${err.retryAfter} s, then run the command again (reuse the same --idempotency-key).`));
74
+ }
44
75
  }
45
76
  process.exit(err.exitCode || 1);
46
77
  }