@meetstream/cli 0.4.2 → 0.6.1

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,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@meetstream/cli`.
4
+
5
+ ## 0.6.1 (2026-11-21)
6
+
7
+ ### Fixed
8
+
9
+ - `meetstream transcript` printed `Unknown:` lines with no text: it read `speaker` / `transcript`, but segments name the speaker in `participant.name` and hold the text in `words[].text`. It now reads this shape (and the flat shape), and skips segments with no text.
10
+ - Zoom help text: `bot create` says Zoom bots join through your Zoom app with an OBF or ZAK token (`--zoom-obf-url` / `--zoom-zak-url`). `--zoom-use-own-app` / `--no-zoom-use-own-app` stay and now say which `use_own_app` value they send; the text no longer says Zoom needs no setup.
11
+ - README and AGENTS.md state: "Inbuilt keys work in pipeline mode only: Deepgram (speech-to-text) and OpenAI (LLM and voice). Realtime mode runs on OpenAI and needs your own OpenAI key. Any other provider: bring your own key." `key_source: "meetstream"` works in pipeline mode only.
12
+ - Removed an internal ticket reference from a test comment.
13
+
14
+ ## 0.6.0 (2026-11-21)
15
+
16
+ Matches MeetStream API v1.10.0.
17
+
18
+ ### Added
19
+
20
+ - 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`.
21
+ - `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.
22
+ - `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.
23
+ - 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"}`.
24
+ - A hint when the API refuses MeetStream's inbuilt keys (`MeetStream-managed keys are not available ...`): use your own key for that section.
25
+
26
+ ### Changed
27
+
28
+ - `mia create` tells you to attach the agent with `--agent-config` only (it no longer suggests `--socket-ws` / `--live-audio-ws`).
29
+ - `bot audio` / `bot video` help: download links are valid for 1 hour.
30
+ - README opens with the two ways to integrate, a fastest path for each, the voice agent setups with prices, and a "Latest docs" section.
31
+
32
+ ## 0.5.0 (2026-11-18)
33
+
34
+ - `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`).
35
+
36
+ ## 0.4.2 and earlier
37
+
38
+ See the git history.
package/README.md CHANGED
@@ -10,6 +10,70 @@ meetstream bot create "https://meet.google.com/abc-defg-hij" -t deepgram
10
10
 
11
11
  ---
12
12
 
13
+ ## Three ways to integrate
14
+
15
+ | Flow | What it is | Price per meeting hour |
16
+ |---|---|---|
17
+ | **1. Recording only** (Bot API) | 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. | Bot price |
18
+ | **2. Agents in meetings, your own stack** (recommended first for an agent) | **2a. Bridge server:** the bot streams live audio to your server, and your server sends audio, chat and images back; you run your own speech-to-text, LLM and voice, hosted or local. **2b. Your own agent as the brain:** Claude Code, Codex, Hermes, OpenClaw and others answer through `model.provider: "local_agent"` and the Agent Kit. | 2a: bot price only. 2b: bot price + $0.25 agent infrastructure. No model tokens charged in either. |
19
+ | **3. Managed agent infrastructure** (Agents API) | MeetStream hosts the voice agent (API name: MIA). **3a.** MeetStream's inbuilt keys. Inbuilt keys work in pipeline mode only: Deepgram (speech-to-text) and OpenAI (LLM and voice). Realtime mode runs on OpenAI and needs your own OpenAI key. Any other provider: bring your own key. **3b.** Your own provider keys. | Bot price + $0.25 agent infrastructure + the models you pick |
20
+
21
+ 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. Guide: [Integration paths](https://docs.meetstream.ai/guides/introduction/integration-paths).
22
+
23
+ Want an agent but not sure which flow? Run your own stack (flow 2, any models, local ones included), or let MeetStream host it (flow 3, no infrastructure work).
24
+
25
+ **Flow 1, recording only.** Decide first: notes after the call (post-call), or something during the call (live)?
26
+
27
+ ```bash
28
+ # Post-call: bot, webhooks, then the transcript
29
+ meetstream bot create "https://meet.google.com/abc-defg-hij" -t meetstream -c https://you.example.com/webhook
30
+ meetstream transcript <bot_id> --wait
31
+
32
+ # Live: live transcript webhook, then raise the bot's hand while it is in the meeting
33
+ meetstream bot create "https://zoom.us/j/123456789" -t deepgram_streaming --live-transcript-webhook https://you.example.com/live
34
+ meetstream bot raise-hand <bot_id> # POST /api/v1/bots/{bot_id}/send_command {"command":"raise_hand"}
35
+ ```
36
+
37
+ **Flow 2a, bridge server.** The bot opens two WebSockets to your server: live audio in (`--live-audio-ws`, sent as `live_audio_required`) and the meeting control socket (`--socket-ws`, sent as `socket_connection_url`) for the audio, chat, images and interrupts you send back. Your server runs its own speech-to-text, LLM and voice, hosted or local (for example Parakeet for local speech-to-text). Bot price only.
38
+
39
+ ```bash
40
+ meetstream bot create "https://meet.google.com/abc-defg-hij" \
41
+ --live-audio-ws wss://your-bridge.example.com/bridge/audio \
42
+ --socket-ws wss://your-bridge.example.com/bridge
43
+ ```
44
+
45
+ Starter: [MeetStream Bridge](https://github.com/meetstream-ai/meetstream-agent) (FastAPI, OpenAI Realtime by default; swap in your own or local models). Guides: [Bridge server architecture](https://docs.meetstream.ai/guides/websockets/bridge-server-architecture), [Real-time audio streaming](https://docs.meetstream.ai/guides/websockets/real-time-audio-streaming), [Meeting control patterns](https://docs.meetstream.ai/guides/websockets/meeting-control-patterns).
46
+
47
+ **Flow 2b, your own agent as the brain.** Run the [MeetStream Agent Kit](https://github.com/meetstream-ai/agent-kit) bridge, save an agent with `"model": {"provider": "local_agent", "local_agent": {"url": "https://..."}}` (`meetstream mia create -f`), check it with `meetstream mia check <id>`, then send a bot with `--agent-config <id>`. Bot price + $0.25 agent infrastructure; no model tokens charged for your agent's reasoning. Flow 2b 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).
48
+
49
+ **Flow 3, managed agent infrastructure.** Save an agent config, then send a bot with its id. Nothing else is needed on the bot.
50
+
51
+ ```bash
52
+ cat > agent.json <<'JSON'
53
+ {
54
+ "agent_name": "Meeting assistant",
55
+ "mode": "pipeline",
56
+ "transcriber": { "provider": "deepgram", "model": "nova-3", "key_source": "meetstream" },
57
+ "model": { "provider": "openai", "model": "gpt-4.1", "key_source": "meetstream",
58
+ "system_prompt": "You are a helpful meeting assistant. Keep answers short.",
59
+ "first_message": "Hi, I'm an AI assistant on this call." },
60
+ "voice": { "provider": "openai", "voice_id": "coral", "key_source": "meetstream" }
61
+ }
62
+ JSON
63
+ meetstream mia create -f agent.json # prints agent_config_id
64
+ meetstream bot create "https://meet.google.com/abc-defg-hij" --agent-config <agent_config_id>
65
+ ```
66
+
67
+ - **3a. MeetStream's inbuilt keys:** `"key_source": "meetstream"` on each pipeline section, no `api_key`. Inbuilt keys work in pipeline mode only: Deepgram (speech-to-text) and OpenAI (LLM and voice). Realtime mode runs on OpenAI and needs your own OpenAI key. Any other provider: bring your own key.
68
+ - **3b. Your own keys:** your provider keys (OpenAI, Anthropic, Deepgram, ElevenLabs and others) under Integrations; `"key_source": "user"` or leave it out. Your provider bills you for model usage.
69
+ - **Price:** 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). Details: [Voice agent pricing and keys](https://docs.meetstream.ai/guides/mia/pricing-and-keys) and the [MIA API guide](https://docs.meetstream.ai/guides/mia/mia-api-guide).
70
+
71
+ 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 (3b) and run it again; do not loop.
72
+
73
+ A voice agent bot takes only `--agent-config`. Do not add `--socket-ws` or `--live-audio-ws` to it (the usual cause of a silent agent); flows 2a and 3 are separate bots.
74
+
75
+ ---
76
+
13
77
  ## Authentication
14
78
 
15
79
  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 +129,16 @@ meetstream transcript <bot_id> --wait
65
129
  | `bot list` | Lists every bot on the account with id, status, and platform |
66
130
  | `bot status <id> [--watch]` | Current status; `--watch` polls every 5s until a terminal state (`Stopped`/`Done`/`Error`/etc.) |
67
131
  | `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) |
132
+ | `bot summary <id>` | Removed: the API has no summary endpoint. The command exits 2 and points to `meetstream transcript <id>` |
133
+ | `bot audio <id>` / `bot video <id>` | Recording download link (valid 1 hour) |
70
134
  | `bot streams <id>` / `bot audio-streams <id>` | Per-participant video/audio streams (needs `--separate-video`/`--separate-audio` at creation) |
71
135
  | `bot participants <id>` | Everyone detected in the meeting |
72
136
  | `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 |
137
+ | `bot screenshots <id>` | Screenshots captured during the meeting, newest first, each with a 1h download URL |
138
+ | `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
139
  | `bot send-message <id> <text...>` | Posts a chat message into the **live** meeting |
76
140
  | `bot send-image <id> <img-url> [-d seconds]` | Shows an image/GIF as the bot's video frame (public URL required) |
141
+ | `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
142
  | `bot remove <id>` | Makes the bot leave the meeting now (data is kept) |
78
143
  | `bot delete <id> --yes` | **Permanently** deletes audio/video/transcripts - the `--yes` flag is mandatory, no accidental deletes |
79
144
 
@@ -82,10 +147,14 @@ meetstream transcript <bot_id> --wait
82
147
  ```
83
148
  -n, --name <name> bot display name (default "MeetStream Bot")
84
149
  --video record video as well as audio (default: audio only)
85
- --video-layout <layout> with --video: speaker_view (default) or grid_view
150
+ --video-layout <layout> with --video: speaker_view (default) or grid_view;
151
+ Google Meet and Teams also accept
152
+ speaker_view_default, grid_view_default
86
153
  -t, --transcript <provider> deepgram | assemblyai | sarvam | meetstream |
87
- jigsawstack | meeting_captions |
88
- deepgram_streaming | assemblyai_streaming
154
+ jigsawstack | smallest | meeting_captions |
155
+ deepgram_streaming | assemblyai_streaming |
156
+ smallest_streaming (smallest* need your Smallest AI
157
+ key saved in the dashboard)
89
158
  -l, --language <lang> transcription language (provider-specific format)
90
159
  -c, --callback <url> HTTPS webhook for lifecycle events
91
160
  --join-at <iso8601> schedule a future join, e.g. 2026-07-02T15:00:00Z
@@ -96,6 +165,9 @@ meetstream transcript <bot_id> --wait
96
165
  --separate-video capture per-participant video streams
97
166
  --zoom-zak-url <url> Zoom: HTTPS endpoint returning a ZAK token (signed-in join)
98
167
  --zoom-obf-url <url> Zoom: HTTPS endpoint returning an OBF token (on-behalf-of join)
168
+ --zoom-use-own-app Zoom: send use_own_app=true (needs your connected Zoom app)
169
+ --storage-id <id> save the recording to this storage destination of
170
+ your workspace (default: the workspace default)
99
171
  --google-login-domain <domain> Google Meet: join signed in with an account from this
100
172
  registered Workspace domain (see `logins google`)
101
173
  --teams-login-domain <domain> Teams: join signed in with an account from this
@@ -104,10 +176,13 @@ meetstream transcript <bot_id> --wait
104
176
  (requires a login domain flag)
105
177
  --no-strict-email with --sign-in-email: fall back to any free account
106
178
  in the domain instead of failing (API default: strict)
107
- --agent-config-id <id> attach a MIA conversational agent
179
+ --agent-config <id> attach a voice agent (Agents API); nothing else is
180
+ needed (alias: --agent-config-id)
181
+ --agent-param <key=value...> agent_config_params for {{variable}} placeholders
108
182
  --live-transcript-webhook <url> webhook URL for live transcript chunks
109
183
  --live-audio-ws <wss> WebSocket URL for live audio out
110
- --live-video-ws <wss> WebSocket URL for live video out
184
+ --live-video-ws <wss> reserved: accepted by the API, but live video
185
+ is not delivered yet
111
186
  --socket-ws <wss> two-way bot-control WebSocket (socket_connection_url)
112
187
  --attr <key=value...> custom_attributes entries (echoed back in webhooks)
113
188
  --idempotency-key <uuid> safe-retry key - a retry returns the original
@@ -117,6 +192,8 @@ meetstream transcript <bot_id> --wait
117
192
  --max-recording-seconds <sec> max in-call recording seconds (default 14400)
118
193
  ```
119
194
 
195
+ **Zoom joins through your Zoom app.** Bots join through your Zoom app (Meeting SDK) with an OBF token (`--zoom-obf-url`, on behalf of a user who is in the meeting) or a ZAK token (`--zoom-zak-url`, a signed-in bot), the way Zoom asks Meeting SDK apps to join since 2 March 2026. Setup: [Zoom Marketplace app setup](https://docs.meetstream.ai/guides/app-integrations/zoom-marketplace-app-setup) · [Zoom authenticated bots (ZAK and OBF)](https://docs.meetstream.ai/guides/app-integrations/zoom-authenticated-bots).
196
+
120
197
  **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
198
 
122
199
  ```bash
@@ -154,9 +231,9 @@ printf '%s' "$BOT_PASSWORD" | meetstream logins teams add --domain bots.example.
154
231
  ### `transcript` / `transcriptions` / `transcribe` - transcription
155
232
  | Command | What it does |
156
233
  |---------|---------------|
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 |
234
+ | `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`. |
235
+ | `transcriptions <bot-id>` | Lists every transcription run for a bot - provider, status, download links |
236
+ | `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
237
 
161
238
  ### `calendar` - Google Calendar auto-join
162
239
  | Command | What it does |
@@ -169,12 +246,22 @@ printf '%s' "$BOT_PASSWORD" | meetstream logins teams add --domain bots.example.
169
246
  | `calendar reschedule <bot-id> <iso8601>` | Change a scheduled bot's join time |
170
247
  | `calendar cancel <bot-id>` | Delete a scheduled (not-yet-joined) bot |
171
248
 
172
- ### `mia` - conversational AI agents
249
+ ### `mia` (alias `agents`) - Agents API, voice agent configs
173
250
  | Command | What it does |
174
251
  |---------|---------------|
175
252
  | `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` |
253
+ | `mia get <agent-config-id>` | Shows one agent config (secrets come back masked) |
254
+ | `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>` |
255
+ | `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
256
  | `mia delete <agent-config-id>` | Deletes an agent config |
257
+ | `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` |
258
+
259
+ 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`.
260
+
261
+ ### `balance` - prepaid balance
262
+ | Command | What it does |
263
+ |---------|---------------|
264
+ | `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
265
 
179
266
  ### `listen` - local webhook receiver
180
267
  | Command | What it does |
@@ -215,9 +302,12 @@ bot.joining → bot.in_waiting_room → bot.inmeeting → bot.recording → bot.
215
302
  |---------|-----|
216
303
  | "No API key found" | Run `meetstream auth set-key <key>` or `export MEETSTREAM_API_KEY=...` |
217
304
  | `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) |
305
+ | `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>` |
306
+ | `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
307
  | `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
308
  | `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
309
  | 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` |
310
+ | `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
311
  | `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
312
 
223
313
  ## Development
@@ -229,7 +319,16 @@ npm test # node --test, fully mocked (no network)
229
319
 
230
320
  ---
231
321
 
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)
322
+ ## Latest docs
323
+
324
+ - [Integration paths](https://docs.meetstream.ai/guides/introduction/integration-paths) · [CLI](https://docs.meetstream.ai/build-with-ai/meetstream-cli)
325
+ - [Bridge server architecture](https://docs.meetstream.ai/guides/websockets/bridge-server-architecture) · [MIA screen sharing and custom agents](https://docs.meetstream.ai/guides/features/mia-screen-sharing-and-custom-agents)
326
+ - [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)
327
+ - [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)
328
+
329
+ 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.
330
+
331
+ 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
332
 
234
333
  MIT © MeetStream.ai
235
334
 
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.1",
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) {
@@ -114,13 +152,14 @@ export class MeetStreamClient {
114
152
  if (tid) {
115
153
  try {
116
154
  const { data } = await this.getTranscriptById(tid, { raw });
117
- // Live API may wrap segments in a `message` key: { message: [ {speaker, transcript, ...} ] }
155
+ // Live API may wrap segments in a `message` key: { message: [ {participant, words, ...} ] }
118
156
  const segments = Array.isArray(data) ? data : (Array.isArray(data?.message) ? data.message : data);
119
157
  if (segments && (Array.isArray(segments) ? segments.length : true)) {
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
+ // use_own_app (API field): sent only when --zoom-use-own-app / --no-zoom-use-own-app is passed.
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 bots join through your Zoom app with an OBF or ZAK token (--zoom-obf-url / --zoom-zak-url)')
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: send use_own_app=true (needs your connected Zoom app; the API returns 400 without one)')
37
+ .option('--no-zoom-use-own-app', 'Zoom: send use_own_app=false (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
@@ -26,21 +26,75 @@ export function kv(pairs) {
26
26
  }
27
27
  }
28
28
 
29
- /** Render transcript segments (speaker + transcript fields) as readable text. */
29
+ const str = (v) => (typeof v === 'string' ? v.trim() : '');
30
+
31
+ /** Speaker of a transcript segment: participant.name, else the flat speaker field. */
32
+ export function segmentSpeaker(s) {
33
+ return str(s?.participant?.name) || str(s?.speaker) || 'Unknown';
34
+ }
35
+
36
+ /** Text of a transcript segment: words[].text joined with spaces, else the flat transcript field. */
37
+ export function segmentText(s) {
38
+ if (Array.isArray(s?.words)) {
39
+ const parts = s.words.map((w) => str(w?.text ?? w?.punctuated_word ?? w?.word)).filter(Boolean);
40
+ if (parts.length) return parts.join(' ');
41
+ }
42
+ return str(s?.transcript) || str(s?.text);
43
+ }
44
+
45
+ /**
46
+ * Render transcript segments as readable "Speaker: text" lines. Segments name the speaker in
47
+ * participant.name and hold the text in words[].text; the flat speaker/transcript shape also works.
48
+ * Segments with no text are skipped.
49
+ */
30
50
  export function transcriptToText(segments) {
31
51
  if (!Array.isArray(segments)) return typeof segments === 'string' ? segments : JSON.stringify(segments, null, 2);
32
52
  return segments
33
- .map((s) => `${s.speaker ?? 'Unknown'}: ${s.transcript ?? ''}`.trim())
53
+ .map((s) => {
54
+ const text = segmentText(s);
55
+ return text ? `${segmentSpeaker(s)}: ${text}` : '';
56
+ })
34
57
  .filter(Boolean)
35
58
  .join('\n');
36
59
  }
37
60
 
61
+ const FAILED_TRANSCRIPT_EXIT = 4;
62
+
63
+ /** For a failed transcript (422 with transcript_status): { reason, transcript_status, transcript_id }, else null. */
64
+ export function failedTranscript(err) {
65
+ if (err?.status !== 422 || typeof err?.body?.transcript_status !== 'string') return null;
66
+ const msg = typeof err.body.message === 'string' ? err.body.message : '';
67
+ return {
68
+ reason: msg.replace(/^Transcript processing failed:?\s*/i, '') || msg || 'no reason given',
69
+ transcript_status: err.body.transcript_status,
70
+ transcript_id: err.body.transcript_id,
71
+ };
72
+ }
73
+
38
74
  export function handleError(err, { json = false } = {}) {
75
+ const failed = failedTranscript(err);
76
+ if (failed) {
77
+ if (json) {
78
+ printJson({ error: 'transcript_failed', status: 422, ...failed });
79
+ } else {
80
+ fail(`Transcript failed: ${failed.reason}`);
81
+ console.error(dim(` transcript_id ${failed.transcript_id ?? '(unknown)'}, status ${failed.transcript_status}. It will not become ready, so do not retry.`));
82
+ console.error(dim(' Fix the cause (for example the provider API key or its usage limit), then run: meetstream transcribe <bot-id>'));
83
+ }
84
+ process.exit(FAILED_TRANSCRIPT_EXIT);
85
+ }
39
86
  if (json) {
40
- printJson({ error: err.message, status: err.status, body: err.body });
87
+ printJson({ error: err.message, status: err.status, body: err.body, ...(err.retryAfter !== undefined ? { retry_after: err.retryAfter } : {}) });
41
88
  } else {
42
89
  fail(err.message);
90
+ if (/MeetStream-managed keys are not available/i.test(err.message || '')) {
91
+ console.error(dim(' MeetStream\'s inbuilt keys are not on for your account yet. Use your own provider key for that section'));
92
+ console.error(dim(' ("key_source": "user", key saved under Integrations), then run the command again.'));
93
+ }
43
94
  if (err.status === 401) console.error(dim(' Check your API key: https://app.meetstream.ai/api-keys'));
95
+ if (err.status === 429 && err.retryAfter !== undefined) {
96
+ console.error(dim(` Rate limited. Wait ${err.retryAfter} s, then run the command again (reuse the same --idempotency-key).`));
97
+ }
44
98
  }
45
99
  process.exit(err.exitCode || 1);
46
100
  }