@meetstream/cli 0.2.0 → 0.4.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MeetStream CLI
2
2
 
3
- **The MeetStream meeting-bot API from your terminal.** Create bots that join Zoom, Google Meet, and Microsoft Teams meetings; record, transcribe, and interact — without writing a line of code.
3
+ **The MeetStream meeting-bot API from your terminal.** Create bots that join Zoom, Google Meet, and Microsoft Teams meetings; record, transcribe, and interact - without writing a line of code.
4
4
 
5
5
  ```bash
6
6
  npm install -g @meetstream/cli # or: npx @meetstream/cli ...
@@ -12,7 +12,7 @@ meetstream bot create "https://meet.google.com/abc-defg-hij" -t deepgram
12
12
 
13
13
  ## Authentication
14
14
 
15
- 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.
15
+ 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.
16
16
 
17
17
  | Source | Precedence | Set with |
18
18
  |--------|------------|----------|
@@ -52,36 +52,37 @@ meetstream transcript <bot_id> --wait
52
52
 
53
53
  ## Full capability list
54
54
 
55
- ### `auth` — credentials
55
+ ### `auth` - credentials
56
56
  | Command | What it does |
57
57
  |---------|---------------|
58
58
  | `auth set-key <key>` | Stores the key in `~/.meetstream/config.json` |
59
59
  | `auth status` | Validates the configured key against the live API and shows account info |
60
60
 
61
- ### `bot` — lifecycle, media, interaction
61
+ ### `bot` - lifecycle, media, interaction
62
62
  | Command | What it does |
63
63
  |---------|---------------|
64
- | `bot create <meeting-link>` | Sends (or schedules with `--join-at`) a bot to the meeting. See [`bot create` options](#bot-create-options) below — transcription provider, callbacks, per-participant streams, MIA agent, live streaming, idempotency, and safe leave-timeout defaults. |
64
+ | `bot create <meeting-link>` | Sends (or schedules with `--join-at`) a bot to the meeting. See [`bot create` options](#bot-create-options) below - transcription provider, callbacks, per-participant streams, MIA agent, live streaming, idempotency, and safe leave-timeout defaults. |
65
65
  | `bot list` | Lists every bot on the account with id, status, and platform |
66
66
  | `bot status <id> [--watch]` | Current status; `--watch` polls every 5s until a terminal state (`Stopped`/`Done`/`Error`/etc.) |
67
- | `bot detail <id>` | Full session metadata — platform, timings, status timeline, `transcript_id`, `caption_file` |
67
+ | `bot detail <id>` | Full session metadata - platform, timings, status timeline, `transcript_id`, `caption_file` |
68
68
  | `bot summary <id>` | MeetStream's built-in AI meeting summary |
69
69
  | `bot audio <id>` / `bot video <id>` | Presigned recording URL (audio valid 1h, video valid 10min) |
70
70
  | `bot streams <id>` / `bot audio-streams <id>` | Per-participant video/audio streams (needs `--separate-video`/`--separate-audio` at creation) |
71
71
  | `bot participants <id>` | Everyone detected in the meeting |
72
72
  | `bot chats <id>` | In-meeting chat messages |
73
73
  | `bot screenshots <id>` | Screenshots captured during the meeting |
74
- | `bot timeline <id>` | Speaker timeline — who spoke when |
74
+ | `bot timeline <id>` | Speaker timeline - who spoke when |
75
75
  | `bot send-message <id> <text...>` | Posts a chat message into the **live** meeting |
76
76
  | `bot send-image <id> <img-url> [-d seconds]` | Shows an image/GIF as the bot's video frame (public URL required) |
77
77
  | `bot remove <id>` | Makes the bot leave the meeting now (data is kept) |
78
- | `bot delete <id> --yes` | **Permanently** deletes audio/video/transcripts — the `--yes` flag is mandatory, no accidental deletes |
78
+ | `bot delete <id> --yes` | **Permanently** deletes audio/video/transcripts - the `--yes` flag is mandatory, no accidental deletes |
79
79
 
80
80
  <a name="bot-create-options"></a>
81
81
  **`bot create` options:**
82
82
  ```
83
83
  -n, --name <name> bot display name (default "MeetStream Bot")
84
- --video record video (default: audio only)
84
+ --video record video as well as audio (default: audio only)
85
+ --video-layout <layout> with --video: speaker_view (default) or grid_view
85
86
  -t, --transcript <provider> deepgram | assemblyai | sarvam | meetstream |
86
87
  jigsawstack | meeting_captions |
87
88
  deepgram_streaming | assemblyai_streaming
@@ -90,31 +91,74 @@ meetstream transcript <bot_id> --wait
90
91
  --join-at <iso8601> schedule a future join, e.g. 2026-07-02T15:00:00Z
91
92
  --bot-message <msg> chat message posted when the bot joins
92
93
  --image-url <url> PUBLIC image URL for the bot avatar
93
- --retention-hours <n> data retention window (API default 24h)
94
+ --retention-hours <n> data retention window in hours (API default 720, i.e. 30 days)
94
95
  --separate-audio capture per-participant audio streams
95
96
  --separate-video capture per-participant video streams
96
- --zoom-obf use Zoom On-Behalf-Of
97
+ --zoom-zak-url <url> Zoom: HTTPS endpoint returning a ZAK token (signed-in join)
98
+ --zoom-obf-url <url> Zoom: HTTPS endpoint returning an OBF token (on-behalf-of join)
99
+ --google-login-domain <domain> Google Meet: join signed in with an account from this
100
+ registered Workspace domain (see `logins google`)
101
+ --teams-login-domain <domain> Teams: join signed in with an account from this
102
+ registered Microsoft 365 domain (see `logins teams`)
103
+ --sign-in-email <email> signed-in bots: pin one registered account
104
+ (requires a login domain flag)
105
+ --no-strict-email with --sign-in-email: fall back to any free account
106
+ in the domain instead of failing (API default: strict)
97
107
  --agent-config-id <id> attach a MIA conversational agent
98
108
  --live-transcript-webhook <url> webhook URL for live transcript chunks
99
109
  --live-audio-ws <wss> WebSocket URL for live audio out
100
110
  --live-video-ws <wss> WebSocket URL for live video out
101
111
  --socket-ws <wss> two-way bot-control WebSocket (socket_connection_url)
102
112
  --attr <key=value...> custom_attributes entries (echoed back in webhooks)
103
- --idempotency-key <uuid> safe-retry key — a retry returns the original
113
+ --idempotency-key <uuid> safe-retry key - a retry returns the original
104
114
  bot (HTTP 507), never a duplicate
105
115
  --everyone-left-timeout <sec> leave after everyone else leaves (default 60)
106
116
  --waiting-room-timeout <sec> max seconds in waiting room (default 300)
107
117
  --max-recording-seconds <sec> max in-call recording seconds (default 14400)
108
118
  ```
109
119
 
110
- ### `transcript` / `transcriptions` / `transcribe` — transcription
120
+ **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
+
122
+ ```bash
123
+ meetstream bot create "https://teams.microsoft.com/l/meetup-join/..." --teams-login-domain bots.example.com
124
+ meetstream bot create "https://meet.google.com/abc-defg-hij" --google-login-domain example.com \
125
+ --sign-in-email notetaker@example.com --no-strict-email
126
+ ```
127
+
128
+ ### `logins` - accounts for signed-in bots
129
+ Register the domain once, then the accounts bots sign in as. Setup guides: [Teams](https://docs.meetstream.ai/guides/app-integrations/teams-signed-in-bots) · [Google](https://docs.meetstream.ai/guides/app-integrations/google-signed-in-bots).
130
+
131
+ | Command | What it does |
132
+ |---------|---------------|
133
+ | `logins teams domains` / `logins teams domain <domain>` | List domains / show one domain with its accounts |
134
+ | `logins teams add-domain <domain> [--name <n>]` | Register a Microsoft 365 bot tenant domain (`login_mode` is always `always`) |
135
+ | `logins teams update-domain <domain> --name <n>` | Rename a domain |
136
+ | `logins teams remove-domain <domain> [--yes]` | Delete a domain **and all its accounts** (asks to confirm unless `--yes`) |
137
+ | `logins teams list --domain <d>` / `logins teams get <login-id>` | List accounts in a domain / show one account (lease status, last session result) |
138
+ | `logins teams add --domain <d> --email <e> [--password-stdin]` | Register an account. Teams runs **one bot per account at a time**: register N accounts for N concurrent bots |
139
+ | `logins teams set-password <login-id> [--password-stdin]` | Rotate the password (also reactivates an account disabled after a failed sign-in) |
140
+ | `logins teams disable\|enable <login-id>` | Take an account out of / back into rotation |
141
+ | `logins teams remove <login-id> [--yes]` | Delete an account |
142
+ | `logins google domains` / `domain` / `add-domain` / `update-domain` / `remove-domain` | Same as Teams, for Google Workspace domains (`add-domain` and `update-domain` also take `--login-mode always\|if_required`) |
143
+ | `logins google list --domain <d>` | List accounts in a domain |
144
+ | `logins google add --domain <d> --email <e> --key key.pem --cert cert.pem` | Register an account with the SSO private key + certificate from the setup guide (Google accounts use SSO, not passwords) |
145
+ | `logins google set-cert <login-id> --domain <d> --key <pem> --cert <pem>` | Replace an account's SSO key + certificate |
146
+ | `logins google disable\|enable\|remove <login-id> --domain <d>` | Same as Teams; Google needs the account's domain |
147
+
148
+ **Passwords are never CLI arguments** (they would land in shell history). The CLI reads them from `--password-stdin`, else `MEETSTREAM_LOGIN_PASSWORD`, else a hidden prompt, and never prints them. The API treats them as write-only.
149
+ ```bash
150
+ printf '%s' "$BOT_PASSWORD" | meetstream logins teams add --domain bots.example.com \
151
+ --email bot1@bots.example.com --password-stdin
152
+ ```
153
+
154
+ ### `transcript` / `transcriptions` / `transcribe` - transcription
111
155
  | Command | What it does |
112
156
  |---------|---------------|
113
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. |
114
- | `transcriptions <bot-id>` | Lists every transcription run for a bot — provider, status, presigned download URLs |
158
+ | `transcriptions <bot-id>` | Lists every transcription run for a bot - provider, status, presigned download URLs |
115
159
  | `transcribe <bot-id> -p <provider>` | (Re-)transcribes a bot's recorded audio, optionally with a different provider or language |
116
160
 
117
- ### `calendar` — Google Calendar auto-join
161
+ ### `calendar` - Google Calendar auto-join
118
162
  | Command | What it does |
119
163
  |---------|---------------|
120
164
  | `calendar connect --client-id --client-secret --refresh-token` | Connects a Google Calendar via OAuth refresh-token flow |
@@ -125,14 +169,14 @@ meetstream transcript <bot_id> --wait
125
169
  | `calendar reschedule <bot-id> <iso8601>` | Change a scheduled bot's join time |
126
170
  | `calendar cancel <bot-id>` | Delete a scheduled (not-yet-joined) bot |
127
171
 
128
- ### `mia` — conversational AI agents
172
+ ### `mia` - conversational AI agents
129
173
  | Command | What it does |
130
174
  |---------|---------------|
131
175
  | `mia list` | Lists agent configs |
132
- | `mia create -f <config.json>` | Creates an agent config (`agent_name`, `mode`, `model`, `voice`, `transcriber`, …) — attach it to a bot with `--agent-config-id` |
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` |
133
177
  | `mia delete <agent-config-id>` | Deletes an agent config |
134
178
 
135
- ### `listen` — local webhook receiver
179
+ ### `listen` - local webhook receiver
136
180
  | Command | What it does |
137
181
  |---------|---------------|
138
182
  | `listen [-p port] [--path path] [--forward url] [--json]` | Runs a local HTTP server that pretty-prints every MeetStream webhook event as it arrives, color-coded by outcome. Pair with `ngrok http <port>` to give `bot create --callback` a public URL during development. `--forward` also relays the raw payload to another URL. |
@@ -141,19 +185,19 @@ Every command supports `--json` for scripting.
141
185
 
142
186
  ---
143
187
 
144
- ## The webhook model — live-verified
188
+ ## The webhook model - live-verified
145
189
 
146
- Events arrive under the **`event`** key with `bot_id`, `bot_status`, `message`, `status_code` (200/500), `custom_attributes` — this is exactly what `meetstream listen` decodes and pretty-prints for you:
190
+ Every event carries **`event`**, `bot_id`, `message`, `status_code` (200/500), `custom_attributes` and `timestamp`, and most also carry **`bot_event`**. This is exactly what `meetstream listen` decodes and pretty-prints for you:
147
191
 
148
192
  ```
149
193
  bot.joining → bot.in_waiting_room → bot.inmeeting → bot.recording → bot.leaving → bot.stopped
150
194
  → manifest.completed → audio.processed → transcription.processed → video.processed → bot.done
151
195
  ```
152
196
 
153
- - **`bot.stopped` fires once** — `bot_status` says why (`Stopped` normal · `NotAllowed` lobby-timeout · `Denied` host-denied · `Error` crash).
154
- - **Streaming-only transcription providers** (`deepgram_streaming`, `assemblyai_streaming`, `meeting_captions`) end at `audio.processed` — they never fire `transcription.processed`, `transcription.failed`, or `bot.done`.
155
- - **`transcript_id` is not in webhooks** — `meetstream transcript <bot_id>` resolves it via `/detail` automatically.
156
- - The public docs page for this describes a different (`bot_event`) envelope key — that's inaccurate; this CLI, and the [MeetStream MCP server](https://github.com/meetstream-ai/meetstream-mcp), both implement the live-verified model above.
197
+ - **Terminals are two-layer.** Every ending arrives once as `event: "bot.stopped"`, and `bot_event` says why: `bot.stopped` (normal), `bot.kicked` (removed by a participant), `bot.notallowed` (lobby timeout), `bot.denied` (host refused), `bot.failed` (crash). Not admitted, denied and failed carry `status_code: 500`. Branch on `bot_event`: a kick and a clean exit both report `bot_status: "Stopped"`.
198
+ - **Streaming-only transcription providers** (`deepgram_streaming`, `assemblyai_streaming`, `meeting_captions`) never fire `transcription.processed` or `transcription.failed`. `bot.done` still fires, on every path.
199
+ - **`transcript_id` is not in webhooks** - `meetstream transcript <bot_id>` resolves it via `/detail` automatically.
200
+ - The [MeetStream MCP server](https://github.com/meetstream-ai/meetstream-mcp)'s `webhook_events_guide` tool describes the same model.
157
201
 
158
202
  ---
159
203
 
@@ -170,9 +214,11 @@ bot.joining → bot.in_waiting_room → bot.inmeeting → bot.recording → bot.
170
214
  | Symptom | Fix |
171
215
  |---------|-----|
172
216
  | "No API key found" | Run `meetstream auth set-key <key>` or `export MEETSTREAM_API_KEY=...` |
173
- | `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) |
174
- | `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 |
175
- | `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 |
217
+ | `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) |
218
+ | `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
+ | `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
+ | 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` |
221
+ | `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 |
176
222
 
177
223
  ## Development
178
224
 
@@ -183,7 +229,7 @@ npm test # node --test, fully mocked (no network)
183
229
 
184
230
  ---
185
231
 
186
- 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) · Migrating from Recall.ai: [@meetstream/migrate](https://github.com/meetstream-ai/recall-meetstream-migration-kit)
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)
187
233
 
188
234
  MIT © MeetStream.ai
189
235
 
package/bin/meetstream.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // MeetStream CLI — https://github.com/meetstream-ai/meetstream-cli
2
+ // MeetStream CLI - https://github.com/meetstream-ai/meetstream-cli
3
3
  import { Command } from 'commander';
4
4
  import { createRequire } from 'node:module';
5
5
  import { MeetStreamClient } from '../src/api.js';
@@ -9,6 +9,7 @@ import { registerBotCommands } from '../src/commands/bot.js';
9
9
  import { registerTranscriptCommands } from '../src/commands/transcript.js';
10
10
  import { registerAuthCommands, registerCalendarCommands, registerMiaCommands } from '../src/commands/misc.js';
11
11
  import { registerListenCommand } from '../src/commands/listen.js';
12
+ import { registerLoginsCommands } from '../src/commands/logins.js';
12
13
  import { track, shutdownTelemetry } from '../src/telemetry.js';
13
14
 
14
15
  const require = createRequire(import.meta.url);
@@ -17,7 +18,7 @@ const { version } = require('../package.json');
17
18
  const program = new Command();
18
19
  program
19
20
  .name('meetstream')
20
- .description('MeetStream — meeting bot API from your terminal (Zoom, Google Meet, Teams)\nDocs: https://docs.meetstream.ai · Keys: https://app.meetstream.ai/api-keys')
21
+ .description('MeetStream - meeting bot API from your terminal (Zoom, Google Meet, Teams)\nDocs: https://docs.meetstream.ai · Keys: https://app.meetstream.ai/api-keys')
21
22
  .version(version);
22
23
 
23
24
  let client;
@@ -31,6 +32,7 @@ registerBotCommands(program, getClient);
31
32
  registerTranscriptCommands(program, getClient);
32
33
  registerCalendarCommands(program, getClient);
33
34
  registerMiaCommands(program, getClient);
35
+ registerLoginsCommands(program, getClient);
34
36
  registerListenCommand(program);
35
37
 
36
38
  program.hook('preAction', (thisCmd, actionCmd) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meetstream/cli",
3
- "version": "0.2.0",
4
- "description": "Official MeetStream CLI \u2014 create meeting bots, fetch transcripts, and stream webhook events from your terminal. Zoom, Google Meet, Microsoft Teams.",
3
+ "version": "0.4.2",
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": {
7
7
  "meetstream": "bin/meetstream.js"
package/src/api.js CHANGED
@@ -1,4 +1,4 @@
1
- // MeetStream API client — mirrors the live OpenAPI spec (https://docs.meetstream.ai/openapi.json)
1
+ // MeetStream API client - mirrors the live OpenAPI spec (https://docs.meetstream.ai/openapi.json)
2
2
  // Auth: `Authorization: Token <key>` · Base: https://api.meetstream.ai/api/v1
3
3
  import { BASE_URL } from './config.js';
4
4
 
@@ -37,7 +37,7 @@ export class MeetStreamClient {
37
37
  const text = await res.text();
38
38
  let data;
39
39
  try { data = text ? JSON.parse(text) : null; } catch { data = text; }
40
- // 507 = idempotent replay of an existing bot — a success, not an error.
40
+ // 507 = idempotent replay of an existing bot - a success, not an error.
41
41
  if (!res.ok && res.status !== 507) {
42
42
  const detail = typeof data === 'object' && data !== null
43
43
  ? (data.detail || data.message || data.error || JSON.stringify(data))
@@ -89,7 +89,7 @@ export class MeetStreamClient {
89
89
  }
90
90
 
91
91
  /**
92
- * Resolve a bot's transcript_id. transcript_id is NOT delivered in webhooks —
92
+ * Resolve a bot's transcript_id. transcript_id is NOT delivered in webhooks -
93
93
  * canonical sources: GET /bots/{id}/detail (bot_details.transcript_id),
94
94
  * the create_bot response, or GET /bots/{id}/transcriptions.
95
95
  */
@@ -165,6 +165,131 @@ export class MeetStreamClient {
165
165
  miaCreate(config) { return this.request('POST', '/mia', { body: config }); }
166
166
  miaUpdate(config) { return this.request('PUT', '/mia', { body: config }); }
167
167
  miaDelete(agentConfigId) { return this.request('DELETE', '/mia', { query: { agent_config_id: agentConfigId } }); }
168
+
169
+ // ── Signed-in bots: Microsoft Teams logins ────────────────────────────
170
+ // Passwords are write-only: sent in the request body, never returned, never logged.
171
+ teamsDomainsList() { return this.request('GET', '/teams-login-domains'); }
172
+ teamsDomainGet(domain) { return this.request('GET', `/teams-login-domains/${enc(domain)}`); }
173
+ teamsDomainCreate({ domain, name } = {}) {
174
+ // login_mode "if_required" is not supported for Teams yet; always use "always".
175
+ return this.request('POST', '/teams-login-domains', {
176
+ body: { domain, ...(name ? { name } : {}), login_mode: 'always' },
177
+ });
178
+ }
179
+ teamsDomainUpdate(domain, { name } = {}) {
180
+ return this.request('PATCH', `/teams-login-domains/${enc(domain)}`, { body: { ...(name ? { name } : {}) } });
181
+ }
182
+ teamsDomainDelete(domain) { return this.request('DELETE', `/teams-login-domains/${enc(domain)}`); }
183
+ teamsLoginsList(domain) { return this.request('GET', '/teams-logins', { query: { domain } }); }
184
+ teamsLoginGet(loginId) { return this.request('GET', `/teams-logins/${enc(loginId)}`); }
185
+ teamsLoginCreate({ domain, email, password, isActive } = {}) {
186
+ return this.request('POST', '/teams-logins', {
187
+ body: { domain, email, password, ...(isActive !== undefined ? { is_active: Boolean(isActive) } : {}) },
188
+ });
189
+ }
190
+ teamsLoginUpdate(loginId, { password, isActive } = {}) {
191
+ const body = {};
192
+ if (password !== undefined) body.password = password; // a new password also reactivates the account
193
+ if (isActive !== undefined) body.is_active = Boolean(isActive);
194
+ return this.request('PATCH', `/teams-logins/${enc(loginId)}`, { body });
195
+ }
196
+ teamsLoginDelete(loginId) { return this.request('DELETE', `/teams-logins/${enc(loginId)}`); }
197
+
198
+ // ── Signed-in bots: Google Meet logins ────────────────────────────────
199
+ // Google domains are keyed by sso_workspace_domain; logins authenticate with an
200
+ // SSO private key + certificate (PEM), not a password. There is no GET-by-id for
201
+ // a Google login, and PATCH/DELETE on a login need the domain.
202
+ googleDomainsList() { return this.request('GET', '/google-login-domains'); }
203
+ googleDomainGet(domain) { return this.request('GET', `/google-login-domains/${enc(domain)}`); }
204
+ googleDomainCreate({ domain, name, loginMode = 'always' } = {}) {
205
+ return this.request('POST', '/google-login-domains', {
206
+ body: { sso_workspace_domain: domain, ...(name ? { name } : {}), login_mode: loginMode },
207
+ });
208
+ }
209
+ googleDomainUpdate(domain, { name, loginMode } = {}) {
210
+ return this.request('PATCH', `/google-login-domains/${enc(domain)}`, {
211
+ body: { ...(name ? { name } : {}), ...(loginMode ? { login_mode: loginMode } : {}) },
212
+ });
213
+ }
214
+ googleDomainDelete(domain) { return this.request('DELETE', `/google-login-domains/${enc(domain)}`); }
215
+ googleLoginsList(domain) { return this.request('GET', '/google-logins', { query: { domain } }); }
216
+ googleLoginCreate({ domain, email, privateKeyPem, certPem, isActive } = {}) {
217
+ return this.request('POST', '/google-logins', {
218
+ body: {
219
+ domain, email, sso_private_key_pem: privateKeyPem, sso_cert_pem: certPem,
220
+ ...(isActive !== undefined ? { is_active: Boolean(isActive) } : {}),
221
+ },
222
+ });
223
+ }
224
+ googleLoginUpdate(loginId, { domain, isActive, privateKeyPem, certPem } = {}) {
225
+ const body = { domain };
226
+ if (isActive !== undefined) body.is_active = Boolean(isActive);
227
+ if (privateKeyPem !== undefined) body.sso_private_key_pem = privateKeyPem;
228
+ if (certPem !== undefined) body.sso_cert_pem = certPem;
229
+ return this.request('PATCH', `/google-logins/${enc(loginId)}`, { body });
230
+ }
231
+ googleLoginDelete(loginId, domain) {
232
+ return this.request('DELETE', `/google-logins/${enc(loginId)}`, { query: { domain } });
233
+ }
234
+ }
235
+
236
+ const enc = (s) => encodeURIComponent(String(s));
237
+
238
+ const TEAMS_HOSTS = ['teams.microsoft.com', 'teams.live.com', 'teams.cloud.microsoft'];
239
+ const GOOGLE_HOSTS = ['meet.google.com'];
240
+
241
+ function linkHost(link) {
242
+ try { return new URL(String(link)).hostname.toLowerCase(); } catch { return ''; }
243
+ }
244
+ const hostIn = (host, list) => list.some((h) => host === h || host.endsWith(`.${h}`));
245
+
246
+ function usageError(message) {
247
+ return Object.assign(new Error(message), { exitCode: 2 });
248
+ }
249
+
250
+ /**
251
+ * Validate the signed-in bot flags and build the `google_meet` / `teams` block.
252
+ * Returns { key, block } or null when no signed-in flag is set. Throws (exitCode 2) on misuse.
253
+ */
254
+ export function buildSignedInBlock(opts = {}) {
255
+ const { googleLoginDomain, teamsLoginDomain, signInEmail, strictEmail } = opts;
256
+ if (googleLoginDomain && teamsLoginDomain) {
257
+ throw usageError('Use either --google-login-domain or --teams-login-domain, not both (one meeting, one platform).');
258
+ }
259
+ const domain = googleLoginDomain || teamsLoginDomain;
260
+ if (!domain) {
261
+ if (signInEmail) throw usageError('--sign-in-email needs --google-login-domain or --teams-login-domain.');
262
+ if (strictEmail === false) throw usageError('--no-strict-email only applies together with --sign-in-email and a login domain flag.');
263
+ return null;
264
+ }
265
+ if (strictEmail === false && !signInEmail) {
266
+ throw usageError('--no-strict-email only applies together with --sign-in-email.');
267
+ }
268
+ const isTeams = Boolean(teamsLoginDomain);
269
+ const block = { login_required: true, [isTeams ? 'teams_login_domain' : 'google_login_domain']: domain };
270
+ if (signInEmail) {
271
+ block.sign_in_email = signInEmail;
272
+ block.strict_email = strictEmail !== false; // API default is true; false = fall back to any free account
273
+ }
274
+ return { key: isTeams ? 'teams' : 'google_meet', block };
275
+ }
276
+
277
+ /** Non-fatal warnings for signed-in bot flags (printed to stderr; the request is still sent). */
278
+ export function signedInWarnings(opts = {}) {
279
+ const warnings = [];
280
+ const host = linkHost(opts.meetingLink);
281
+ if (opts.teamsLoginDomain) {
282
+ if (!hostIn(host, TEAMS_HOSTS)) {
283
+ warnings.push(`--teams-login-domain is set but the meeting link host is "${host || opts.meetingLink}", not a Microsoft Teams host (teams.microsoft.com / teams.live.com). Sending anyway.`);
284
+ } else if (hostIn(host, ['teams.live.com'])) {
285
+ warnings.push('teams.live.com is personal Teams: signed-in bots only work with Microsoft 365 work/school Teams meetings.');
286
+ }
287
+ warnings.push('Signed-in Teams bots show the Microsoft account\'s own display name and picture; --name and --image-url are not applied.');
288
+ }
289
+ if (opts.googleLoginDomain && !hostIn(host, GOOGLE_HOSTS)) {
290
+ warnings.push(`--google-login-domain is set but the meeting link host is "${host || opts.meetingLink}", not meet.google.com. Sending anyway.`);
291
+ }
292
+ return warnings;
168
293
  }
169
294
 
170
295
  /** Build a create_bot payload from CLI-ish options, applying safe defaults. */
@@ -180,8 +305,33 @@ export function buildCreateBotPayload(opts) {
180
305
  if (opts.joinAt) payload.join_at = opts.joinAt;
181
306
  if (opts.agentConfigId) payload.agent_config_id = opts.agentConfigId;
182
307
  if (opts.separateAudio) payload.audio_separate_streams = true;
308
+ // Per-participant video is opt-in only: never set implicitly.
183
309
  if (opts.separateVideo) payload.video_separate_streams = true;
184
- if (opts.zoomObf) payload.zoom = { use_zoom_obf: true };
310
+
311
+ // Audio only unless --video; with --video, speaker view unless --video-layout grid_view
312
+ // (the REST API defaults to grid_view, so the layout is always sent explicitly).
313
+ // video_layout applies to mixed video only, so audio-only bots never carry it.
314
+ if (payload.video_required) {
315
+ 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.");
318
+ }
319
+ payload.recording_config = { ...(payload.recording_config || {}), video_layout: layout };
320
+ } else if (opts.videoLayout) {
321
+ throw usageError('--video-layout needs --video (an audio-only bot records no mixed video).');
322
+ }
323
+ if (opts.zoomObf) {
324
+ 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
+ }
326
+ // Authenticated Zoom joins: each URL is an HTTPS endpoint on the caller's server that returns a fresh token.
327
+ if (opts.zoomZakUrl || opts.zoomObfUrl) {
328
+ payload.zoom = {};
329
+ if (opts.zoomZakUrl) payload.zoom.zak_url = opts.zoomZakUrl;
330
+ if (opts.zoomObfUrl) payload.zoom.obf_url = opts.zoomObfUrl;
331
+ }
332
+ // Signed-in bots: Google Meet (google_meet) or Microsoft Teams (teams) accounts registered via `meetstream logins`.
333
+ const signedIn = buildSignedInBlock(opts);
334
+ if (signedIn) payload[signedIn.key] = signedIn.block;
185
335
  if (opts.liveTranscriptWebhook) payload.live_transcription_required = { webhook_url: opts.liveTranscriptWebhook };
186
336
  if (opts.liveAudioWs) payload.live_audio_required = { websocket_url: opts.liveAudioWs };
187
337
  if (opts.liveVideoWs) payload.live_video_required = { websocket_url: opts.liveVideoWs };
@@ -1,5 +1,5 @@
1
- import { buildCreateBotPayload } from '../api.js';
2
- import { printJson, ok, kv, bold, dim, cyan, transcriptToText, handleError } from '../output.js';
1
+ import { buildCreateBotPayload, signedInWarnings } from '../api.js';
2
+ import { printJson, ok, kv, bold, dim, cyan, transcriptToText, handleError, warnErr } from '../output.js';
3
3
 
4
4
  function parseAttrs(list = []) {
5
5
  const out = {};
@@ -19,17 +19,24 @@ export function registerBotCommands(program, getClient) {
19
19
  .description('Send a bot to a meeting (or schedule with --join-at)')
20
20
  .argument('<meeting-link>', 'Zoom / Google Meet / Teams meeting URL')
21
21
  .option('-n, --name <name>', 'bot display name', 'MeetStream Bot')
22
- .option('--video', 'record video (default: audio only)')
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')
23
24
  .option('-t, --transcript <provider>', 'deepgram | assemblyai | sarvam | meetstream | jigsawstack | meeting_captions | deepgram_streaming | assemblyai_streaming')
24
25
  .option('-l, --language <lang>', 'transcription language (provider-specific format)')
25
26
  .option('-c, --callback <url>', 'HTTPS webhook for lifecycle events')
26
27
  .option('--join-at <iso8601>', 'schedule a future join, e.g. 2026-07-02T15:00:00Z')
27
28
  .option('--bot-message <msg>', 'chat message posted when the bot joins')
28
29
  .option('--image-url <url>', 'PUBLIC image URL for the bot avatar')
29
- .option('--retention-hours <n>', 'data retention window (default: API default 24h)')
30
+ .option('--retention-hours <n>', 'data retention window in hours (API default 720, i.e. 30 days)')
30
31
  .option('--separate-audio', 'capture per-participant audio streams')
31
- .option('--separate-video', 'capture per-participant video streams')
32
- .option('--zoom-obf', 'use Zoom On-Behalf-Of')
32
+ .option('--separate-video', 'capture per-participant video streams (opt-in; off unless you pass this)')
33
+ .option('--zoom-zak-url <url>', 'Zoom: HTTPS endpoint on your server returning a ZAK token (join as a signed-in user)')
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
+ .option('--zoom-obf', 'removed: use --zoom-obf-url')
36
+ .option('--google-login-domain <domain>', 'Google Meet: join signed in with an account from this registered Workspace domain (see: meetstream logins google)')
37
+ .option('--teams-login-domain <domain>', 'Teams: join signed in with an account from this registered Microsoft 365 domain (see: meetstream logins teams)')
38
+ .option('--sign-in-email <email>', 'signed-in bots: pin one registered account (needs a login domain flag)')
39
+ .option('--no-strict-email', 'with --sign-in-email: fall back to any free account in the domain instead of failing')
33
40
  .option('--agent-config-id <id>', 'attach a MIA conversational agent')
34
41
  .option('--live-transcript-webhook <url>', 'webhook URL for live transcript chunks')
35
42
  .option('--live-audio-ws <wss>', 'WebSocket URL for live audio out')
@@ -43,11 +50,11 @@ export function registerBotCommands(program, getClient) {
43
50
  .option('--json', 'JSON output')
44
51
  .action(async (meetingLink, opts) => {
45
52
  try {
46
- const client = getClient();
47
53
  const payload = buildCreateBotPayload({
48
54
  meetingLink,
49
55
  name: opts.name,
50
56
  video: opts.video,
57
+ videoLayout: opts.videoLayout,
51
58
  transcript: opts.transcript,
52
59
  language: opts.language,
53
60
  callback: opts.callback,
@@ -58,6 +65,12 @@ export function registerBotCommands(program, getClient) {
58
65
  separateAudio: opts.separateAudio,
59
66
  separateVideo: opts.separateVideo,
60
67
  zoomObf: opts.zoomObf,
68
+ zoomZakUrl: opts.zoomZakUrl,
69
+ zoomObfUrl: opts.zoomObfUrl,
70
+ googleLoginDomain: opts.googleLoginDomain,
71
+ teamsLoginDomain: opts.teamsLoginDomain,
72
+ signInEmail: opts.signInEmail,
73
+ strictEmail: opts.strictEmail,
61
74
  agentConfigId: opts.agentConfigId,
62
75
  liveTranscriptWebhook: opts.liveTranscriptWebhook,
63
76
  liveAudioWs: opts.liveAudioWs,
@@ -68,9 +81,10 @@ export function registerBotCommands(program, getClient) {
68
81
  waitingRoomTimeout: opts.waitingRoomTimeout,
69
82
  maxRecordingSeconds: opts.maxRecordingSeconds,
70
83
  });
71
- const { status, data } = await client.createBot(payload, { idempotencyKey: opts.idempotencyKey });
84
+ for (const w of signedInWarnings({ meetingLink, googleLoginDomain: opts.googleLoginDomain, teamsLoginDomain: opts.teamsLoginDomain })) warnErr(w);
85
+ const { status, data } = await getClient().createBot(payload, { idempotencyKey: opts.idempotencyKey });
72
86
  if (opts.json) return printJson(data);
73
- ok(status === 507 ? 'Idempotent replay — existing bot returned (no new bot created)' : 'Bot created');
87
+ ok(status === 507 ? 'Idempotent replay - existing bot returned (no new bot created)' : 'Bot created');
74
88
  kv({ bot_id: bold(data.bot_id), transcript_id: data.transcript_id || dim('(pending)'), status: data.status, meeting: data.meeting_url });
75
89
  console.log(dim(`\n Next: meetstream bot status ${data.bot_id} --watch`));
76
90
  if (payload.recording_config?.transcript) console.log(dim(` meetstream transcript ${data.bot_id} --wait`));
@@ -139,7 +153,7 @@ export function registerBotCommands(program, getClient) {
139
153
  .action(async (botId, opts) => {
140
154
  try {
141
155
  const { data } = await getClient()[method](botId);
142
- printJson(data); // structured data — JSON is the honest default
156
+ printJson(data); // structured data - JSON is the honest default
143
157
  } catch (e) { handleError(e, opts); }
144
158
  });
145
159
  }
@@ -1,15 +1,29 @@
1
- // `meetstream listen` — local webhook receiver for MeetStream lifecycle events.
2
- // Ground truth (live-verified): the envelope key is `event` (NOT bot_event).
3
- // Two-layer model: bot.stopped fires once; bot_status says why
4
- // (Stopped | NotAllowed lobby-timeout | Denied host-denied | Error crash).
1
+ // `meetstream listen` - local webhook receiver for MeetStream lifecycle events.
2
+ // Verified against 4,139 captured webhooks: every delivery carries `event`, most
3
+ // also carry `bot_event`. Terminals are two-layer: every ending arrives once as
4
+ // event "bot.stopped" and bot_event says why (bot.stopped | bot.kicked |
5
+ // bot.notallowed | bot.denied | bot.failed). bot.done is the final event.
6
+ // Branch on bot_event: a kick and a clean exit both report bot_status "Stopped".
5
7
  import { createServer } from 'node:http';
6
8
  import { bold, dim, green, yellow, red, cyan } from '../output.js';
7
9
 
8
10
  const TERMINAL = new Set(['bot.stopped', 'bot.done']);
9
11
  const FAILY = /denied|notallowed|failed|error/i;
12
+ const ABNORMAL_STOP = new Set(['bot.kicked', 'bot.notallowed', 'bot.denied', 'bot.failed']);
13
+
14
+ function stopReason(payload) {
15
+ if (payload?.bot_event) return payload.bot_event;
16
+ const st = String(payload?.bot_status || '').toLowerCase();
17
+ if (st === 'notallowed') return 'bot.notallowed';
18
+ if (st === 'denied') return 'bot.denied';
19
+ if (st === 'error' || st === 'failed') return 'bot.failed';
20
+ return 'bot.stopped';
21
+ }
10
22
 
11
23
  function colorFor(event, payload) {
12
- if (event === 'transcription.failed' || FAILY.test(payload?.bot_status || '')) return red;
24
+ if (event === 'transcription.failed') return red;
25
+ if (event === 'bot.stopped' && ABNORMAL_STOP.has(stopReason(payload))) return red;
26
+ if (FAILY.test(payload?.bot_status || '')) return red;
13
27
  if (TERMINAL.has(event)) return yellow;
14
28
  if (/\.processed$|manifest\.completed/.test(event)) return green;
15
29
  return cyan;
@@ -42,6 +56,7 @@ export function registerListenCommand(program) {
42
56
  const bits = [
43
57
  dim(time),
44
58
  paint(bold(event)),
59
+ payload.bot_event && payload.bot_event !== event ? paint(`(${payload.bot_event})`) : '',
45
60
  payload.bot_status ? `status=${payload.bot_status}` : '',
46
61
  payload.status_code !== undefined ? `code=${payload.status_code}` : '',
47
62
  payload.bot_id ? dim(String(payload.bot_id).slice(0, 8)) : '',
@@ -51,8 +66,8 @@ export function registerListenCommand(program) {
51
66
  if (event === 'transcription.processed' && payload.bot_id) {
52
67
  console.log(dim(` → meetstream transcript ${payload.bot_id}`));
53
68
  }
54
- if (event === 'bot.stopped' && FAILY.test(payload.bot_status || '')) {
55
- console.log(red(` bot ended abnormally (bot_status=${payload.bot_status})`));
69
+ if (event === 'bot.stopped' && ABNORMAL_STOP.has(stopReason(payload))) {
70
+ console.log(red(` bot ended abnormally (${stopReason(payload)}, bot_status=${payload.bot_status})`));
56
71
  }
57
72
  }
58
73
 
@@ -66,7 +81,7 @@ export function registerListenCommand(program) {
66
81
  console.log(`${green('▶')} listening on ${bold(`http://localhost:${port}${opts.path === '/webhook' ? '/webhook' : opts.path}`)}`);
67
82
  console.log(dim(' expose it: ngrok http ' + port));
68
83
  console.log(dim(' then create a bot with: --callback https://<your-ngrok>.ngrok.io/webhook'));
69
- console.log(dim(' events arrive under the `event` key · Ctrl-C to stop\n'));
84
+ console.log(dim(' terminals arrive as bot.stopped; the reason is in bot_event · Ctrl-C to stop\n'));
70
85
  });
71
86
  });
72
87
  }
@@ -0,0 +1,292 @@
1
+ // `meetstream logins teams|google ...` - manage the accounts signed-in bots use.
2
+ // Teams accounts use an email + password (write-only). Google accounts use an SSO
3
+ // private key + certificate (PEM files). Secrets are never CLI args and never printed.
4
+ import { readFileSync } from 'node:fs';
5
+ import { printJson, ok, kv, bold, dim, cyan, green, yellow, handleError } from '../output.js';
6
+ import { resolvePassword, confirm, PASSWORD_ENV } from '../secrets.js';
7
+
8
+ function usageError(message) {
9
+ return Object.assign(new Error(message), { exitCode: 2 });
10
+ }
11
+
12
+ async function confirmOrAbort(question, opts) {
13
+ if (opts.yes) return;
14
+ if (!process.stdin.isTTY) throw usageError(`${question} Refusing without --yes in a non-interactive shell.`);
15
+ if (!(await confirm(question))) throw Object.assign(new Error('Aborted'), { exitCode: 1 });
16
+ }
17
+
18
+ function readPem(path, flag) {
19
+ try { return readFileSync(path, 'utf8'); } catch (e) {
20
+ throw usageError(`${flag}: cannot read ${path} (${e.code || e.message})`);
21
+ }
22
+ }
23
+
24
+ const activeLabel = (v) => (v === false ? yellow('inactive') : green('active'));
25
+
26
+ const PLATFORMS = {
27
+ teams: {
28
+ label: 'Microsoft Teams',
29
+ docs: 'https://docs.meetstream.ai/guides/app-integrations/teams-signed-in-bots',
30
+ domainKey: 'domain',
31
+ m: {
32
+ domains: 'teamsDomainsList', domain: 'teamsDomainGet', addDomain: 'teamsDomainCreate',
33
+ updateDomain: 'teamsDomainUpdate', removeDomain: 'teamsDomainDelete',
34
+ list: 'teamsLoginsList', add: 'teamsLoginCreate', update: 'teamsLoginUpdate', remove: 'teamsLoginDelete',
35
+ },
36
+ loginLine: (l) => `${cyan(l.login_id)} ${l.email} ${activeLabel(l.is_active)} ${dim(`lease: ${l.lease_status ?? '-'} last: ${l.last_session_result ?? '-'}`)}`,
37
+ },
38
+ google: {
39
+ label: 'Google Meet',
40
+ docs: 'https://docs.meetstream.ai/guides/app-integrations/google-signed-in-bots',
41
+ domainKey: 'sso_workspace_domain',
42
+ m: {
43
+ domains: 'googleDomainsList', domain: 'googleDomainGet', addDomain: 'googleDomainCreate',
44
+ updateDomain: 'googleDomainUpdate', removeDomain: 'googleDomainDelete',
45
+ list: 'googleLoginsList', add: 'googleLoginCreate', update: 'googleLoginUpdate', remove: 'googleLoginDelete',
46
+ },
47
+ loginLine: (l) => `${cyan(l.login_id)} ${l.email} ${activeLabel(l.is_active)} ${dim(`sessions: ${l.active_sessions ?? 0} last test: ${l.last_test_status ?? '-'}`)}`,
48
+ },
49
+ };
50
+
51
+ function registerPlatform(logins, key, getClient) {
52
+ const p = PLATFORMS[key];
53
+ const isTeams = key === 'teams';
54
+ const cmd = logins
55
+ .command(key)
56
+ .description(`${p.label} signed-in bot domains and accounts (guide: ${p.docs})`);
57
+
58
+ // ── Domains ──────────────────────────────────────────────────────────
59
+ cmd
60
+ .command('domains')
61
+ .description('List registered login domains')
62
+ .option('--json', 'JSON output')
63
+ .action(async (opts) => {
64
+ try {
65
+ const { data } = await getClient()[p.m.domains]();
66
+ if (opts.json) return printJson(data);
67
+ const domains = data?.domains || [];
68
+ if (!domains.length) return console.log(dim(`No ${p.label} login domains yet. Register one: meetstream logins ${key} add-domain <domain>`));
69
+ for (const d of domains) {
70
+ const extra = isTeams ? '' : ` ${dim(`max/login: ${d.max_concurrent_per_login ?? '-'}`)}`;
71
+ console.log(`${cyan(d[p.domainKey])} ${d.name ?? ''} ${dim(d.login_mode ?? '')} ${d.active_login_count ?? 0}/${d.login_count ?? 0} active logins${extra}`);
72
+ }
73
+ } catch (e) { handleError(e, opts); }
74
+ });
75
+
76
+ cmd
77
+ .command('domain')
78
+ .description('Show one domain and its accounts')
79
+ .argument('<domain>')
80
+ .option('--json', 'JSON output')
81
+ .action(async (domain, opts) => {
82
+ try {
83
+ const { data } = await getClient()[p.m.domain](domain);
84
+ if (opts.json) return printJson(data);
85
+ kv({ domain: bold(data?.[p.domainKey] ?? domain), name: data?.name, login_mode: data?.login_mode, max_concurrent_per_login: data?.max_concurrent_per_login, created_at: data?.created_at });
86
+ const list = data?.logins || [];
87
+ console.log(list.length ? '' : dim('\n No accounts yet.'));
88
+ for (const l of list) console.log(` ${p.loginLine(l)}`);
89
+ } catch (e) { handleError(e, opts); }
90
+ });
91
+
92
+ const addDomain = cmd
93
+ .command('add-domain')
94
+ .description(isTeams
95
+ ? 'Register a Microsoft 365 bot tenant domain (login_mode is always "always" for Teams)'
96
+ : 'Register a Google Workspace domain (set up SSO in Google Admin first, see the guide)')
97
+ .argument('<domain>')
98
+ .option('--name <name>', 'friendly name');
99
+ if (!isTeams) addDomain.option('--login-mode <mode>', 'always | if_required', 'always');
100
+ addDomain
101
+ .option('--json', 'JSON output')
102
+ .action(async (domain, opts) => {
103
+ try {
104
+ const { data } = await getClient()[p.m.addDomain]({ domain, name: opts.name, loginMode: opts.loginMode });
105
+ if (opts.json) return printJson(data);
106
+ ok(`Domain ${bold(domain)} registered`);
107
+ console.log(dim(isTeams
108
+ ? `\n Next: meetstream logins teams add --domain ${domain} --email <bot@${domain}>`
109
+ : `\n Next: meetstream logins google add --domain ${domain} --email <bot@${domain}> --key key.pem --cert cert.pem`));
110
+ } catch (e) { handleError(e, opts); }
111
+ });
112
+
113
+ const updateDomain = cmd
114
+ .command('update-domain')
115
+ .description('Rename a domain' + (isTeams ? '' : ' or change its login mode'))
116
+ .argument('<domain>')
117
+ .option('--name <name>', 'new friendly name');
118
+ if (!isTeams) updateDomain.option('--login-mode <mode>', 'always | if_required');
119
+ updateDomain
120
+ .option('--json', 'JSON output')
121
+ .action(async (domain, opts) => {
122
+ try {
123
+ if (!opts.name && !opts.loginMode) throw usageError('Nothing to update: pass --name' + (isTeams ? '' : ' and/or --login-mode'));
124
+ const { data } = await getClient()[p.m.updateDomain](domain, { name: opts.name, loginMode: opts.loginMode });
125
+ if (opts.json) return printJson(data);
126
+ ok(`Domain ${bold(domain)} updated`);
127
+ } catch (e) { handleError(e, opts); }
128
+ });
129
+
130
+ cmd
131
+ .command('remove-domain')
132
+ .description(isTeams
133
+ ? 'Delete a domain AND all of its accounts'
134
+ : 'Delete a domain and its accounts (the API refuses while any account is active; disable them first)')
135
+ .argument('<domain>')
136
+ .option('--yes', 'skip confirmation')
137
+ .option('--json', 'JSON output')
138
+ .action(async (domain, opts) => {
139
+ try {
140
+ await confirmOrAbort(`Delete ${p.label} domain ${domain} and every account registered under it?`, opts);
141
+ const { data } = await getClient()[p.m.removeDomain](domain);
142
+ if (opts.json) return printJson(data);
143
+ ok(`Domain ${bold(domain)} deleted`);
144
+ } catch (e) { handleError(e, opts); }
145
+ });
146
+
147
+ // ── Accounts ─────────────────────────────────────────────────────────
148
+ cmd
149
+ .command('list')
150
+ .description('List accounts in a domain')
151
+ .requiredOption('--domain <domain>', 'registered domain')
152
+ .option('--json', 'JSON output')
153
+ .action(async (opts) => {
154
+ try {
155
+ const { data } = await getClient()[p.m.list](opts.domain);
156
+ if (opts.json) return printJson(data);
157
+ const list = data?.logins || [];
158
+ if (!list.length) return console.log(dim(`No accounts in ${opts.domain} yet.`));
159
+ for (const l of list) console.log(p.loginLine(l));
160
+ } catch (e) { handleError(e, opts); }
161
+ });
162
+
163
+ if (isTeams) {
164
+ cmd
165
+ .command('get')
166
+ .description('Show one account')
167
+ .argument('<login-id>')
168
+ .option('--json', 'JSON output')
169
+ .action(async (loginId, opts) => {
170
+ try {
171
+ const { data } = await getClient().teamsLoginGet(loginId);
172
+ if (opts.json) return printJson(data);
173
+ kv({ login_id: bold(data.login_id), domain: data.domain, email: data.email, is_active: String(data.is_active), lease_status: data.lease_status, last_session_result: data.last_session_result, last_login_error: data.last_login_error, updated_at: data.updated_at });
174
+ } catch (e) { handleError(e, opts); }
175
+ });
176
+
177
+ cmd
178
+ .command('add')
179
+ .description(`Register a bot account. Password from --password-stdin, $${PASSWORD_ENV}, or a hidden prompt (never a CLI argument)`)
180
+ .requiredOption('--domain <domain>', 'registered domain')
181
+ .requiredOption('--email <email>', 'account email, e.g. bot1@bots.example.com')
182
+ .option('--password-stdin', 'read the password from stdin')
183
+ .option('--inactive', 'register the account disabled')
184
+ .option('--json', 'JSON output')
185
+ .action(async (opts) => {
186
+ try {
187
+ const password = await resolvePassword({ passwordStdin: opts.passwordStdin });
188
+ const { data } = await getClient().teamsLoginCreate({ domain: opts.domain, email: opts.email, password, isActive: opts.inactive ? false : undefined });
189
+ if (opts.json) return printJson(data);
190
+ ok(`Account ${bold(opts.email)} registered (login_id ${cyan(data?.login_id)})`);
191
+ console.log(dim(' Teams allows ONE concurrent bot per account: register N accounts for N concurrent signed-in bots.'));
192
+ } catch (e) { handleError(e, opts); }
193
+ });
194
+
195
+ cmd
196
+ .command('set-password')
197
+ .description(`Rotate an account password (also reactivates a deactivated account). Same password sources as add`)
198
+ .argument('<login-id>')
199
+ .option('--password-stdin', 'read the password from stdin')
200
+ .option('--json', 'JSON output')
201
+ .action(async (loginId, opts) => {
202
+ try {
203
+ const password = await resolvePassword({ passwordStdin: opts.passwordStdin });
204
+ const { data } = await getClient().teamsLoginUpdate(loginId, { password });
205
+ if (opts.json) return printJson(data);
206
+ ok(`Password updated for ${bold(loginId)}`);
207
+ } catch (e) { handleError(e, opts); }
208
+ });
209
+ } else {
210
+ cmd
211
+ .command('add')
212
+ .description('Register a Google Workspace account with the SSO key + certificate from the setup guide')
213
+ .requiredOption('--domain <domain>', 'registered Workspace domain')
214
+ .requiredOption('--email <email>', 'account email')
215
+ .requiredOption('--key <path>', 'path to the SSO private key PEM (key.pem)')
216
+ .requiredOption('--cert <path>', 'path to the SSO certificate PEM (cert.pem)')
217
+ .option('--inactive', 'register the account disabled')
218
+ .option('--json', 'JSON output')
219
+ .action(async (opts) => {
220
+ try {
221
+ const privateKeyPem = readPem(opts.key, '--key');
222
+ const certPem = readPem(opts.cert, '--cert');
223
+ const { data } = await getClient().googleLoginCreate({ domain: opts.domain, email: opts.email, privateKeyPem, certPem, isActive: opts.inactive ? false : undefined });
224
+ if (opts.json) return printJson(data);
225
+ ok(`Account ${bold(opts.email)} registered (login_id ${cyan(data?.login_id)})`);
226
+ } catch (e) { handleError(e, opts); }
227
+ });
228
+
229
+ cmd
230
+ .command('set-cert')
231
+ .description('Replace an account\'s SSO key + certificate (refused while the account has active sessions)')
232
+ .argument('<login-id>')
233
+ .requiredOption('--domain <domain>', 'the account\'s domain')
234
+ .requiredOption('--key <path>', 'path to the SSO private key PEM')
235
+ .requiredOption('--cert <path>', 'path to the SSO certificate PEM')
236
+ .option('--json', 'JSON output')
237
+ .action(async (loginId, opts) => {
238
+ try {
239
+ const { data } = await getClient().googleLoginUpdate(loginId, {
240
+ domain: opts.domain, privateKeyPem: readPem(opts.key, '--key'), certPem: readPem(opts.cert, '--cert'),
241
+ });
242
+ if (opts.json) return printJson(data);
243
+ ok(`Credentials updated for ${bold(loginId)}`);
244
+ } catch (e) { handleError(e, opts); }
245
+ });
246
+ }
247
+
248
+ for (const [name, active] of [['disable', false], ['enable', true]]) {
249
+ const c = cmd
250
+ .command(name)
251
+ .description(active ? 'Re-enable an account' : 'Disable an account (bots stop using it)')
252
+ .argument('<login-id>');
253
+ if (!isTeams) c.requiredOption('--domain <domain>', 'the account\'s domain');
254
+ c.option('--json', 'JSON output')
255
+ .action(async (loginId, opts) => {
256
+ try {
257
+ const { data } = await getClient()[p.m.update](loginId, isTeams ? { isActive: active } : { domain: opts.domain, isActive: active });
258
+ if (opts.json) return printJson(data);
259
+ ok(`Account ${bold(loginId)} ${active ? 'enabled' : 'disabled'}`);
260
+ } catch (e) { handleError(e, opts); }
261
+ });
262
+ }
263
+
264
+ const rm = cmd
265
+ .command('remove')
266
+ .description('Delete an account')
267
+ .argument('<login-id>');
268
+ if (!isTeams) rm.requiredOption('--domain <domain>', 'the account\'s domain');
269
+ rm.option('--yes', 'skip confirmation')
270
+ .option('--json', 'JSON output')
271
+ .action(async (loginId, opts) => {
272
+ try {
273
+ await confirmOrAbort(`Delete ${p.label} account ${loginId}?`, opts);
274
+ const { data } = isTeams
275
+ ? await getClient().teamsLoginDelete(loginId)
276
+ : await getClient().googleLoginDelete(loginId, opts.domain);
277
+ if (opts.json) return printJson(data);
278
+ ok(`Account ${bold(loginId)} deleted`);
279
+ } catch (e) { handleError(e, opts); }
280
+ });
281
+
282
+ return cmd;
283
+ }
284
+
285
+ export function registerLoginsCommands(program, getClient) {
286
+ const logins = program
287
+ .command('logins')
288
+ .description('Accounts for signed-in bots (Microsoft Teams, Google Meet). Use them with bot create --teams-login-domain / --google-login-domain');
289
+ registerPlatform(logins, 'teams', getClient);
290
+ registerPlatform(logins, 'google', getClient);
291
+ return logins;
292
+ }
package/src/output.js CHANGED
@@ -1,4 +1,4 @@
1
- // Terminal output helpers — zero-dependency colors + consistent JSON mode.
1
+ // Terminal output helpers - zero-dependency colors + consistent JSON mode.
2
2
  const tty = process.stdout.isTTY;
3
3
  const c = (code) => (s) => (tty ? `\x1b[${code}m${s}\x1b[0m` : String(s));
4
4
  export const bold = c('1');
@@ -14,6 +14,8 @@ export function printJson(obj) {
14
14
 
15
15
  export function ok(msg) { console.log(green('✓ ') + msg); }
16
16
  export function warn(msg) { console.log(yellow('⚠ ') + msg); }
17
+ /** Warning on stderr, so --json output on stdout stays parseable. */
18
+ export function warnErr(msg) { console.error(yellow('⚠ ') + msg); }
17
19
  export function fail(msg) { console.error(red('✗ ') + msg); }
18
20
 
19
21
  export function kv(pairs) {
package/src/secrets.js ADDED
@@ -0,0 +1,61 @@
1
+ // Secret input for signed-in bot accounts. A password is NEVER accepted as a CLI
2
+ // argument (it would land in shell history and `ps`), and is never printed or logged.
3
+ import readline from 'node:readline';
4
+ import { Writable } from 'node:stream';
5
+
6
+ export const PASSWORD_ENV = 'MEETSTREAM_LOGIN_PASSWORD';
7
+
8
+ function usageError(message) {
9
+ return Object.assign(new Error(message), { exitCode: 2 });
10
+ }
11
+
12
+ /** Read all of stdin and strip one trailing newline (so `echo "$PW" | ...` works). */
13
+ export async function readStdin(stream = process.stdin) {
14
+ const chunks = [];
15
+ for await (const chunk of stream) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
16
+ return Buffer.concat(chunks).toString('utf8').replace(/\r?\n$/, '');
17
+ }
18
+
19
+ /** Prompt on stderr without echoing what is typed. */
20
+ export function promptHidden(question, { input = process.stdin, output = process.stderr } = {}) {
21
+ return new Promise((resolve, reject) => {
22
+ let muted = false;
23
+ const sink = new Writable({
24
+ write(chunk, encoding, cb) { if (!muted) output.write(chunk, encoding); cb(); },
25
+ });
26
+ const rl = readline.createInterface({ input, output: sink, terminal: true });
27
+ rl.on('SIGINT', () => { rl.close(); output.write('\n'); reject(usageError('Cancelled')); });
28
+ rl.question(question, (answer) => { rl.close(); output.write('\n'); resolve(answer); });
29
+ muted = true;
30
+ });
31
+ }
32
+
33
+ /** Ask a yes/no question on stderr. Resolves true only for y / yes. */
34
+ export function confirm(question, { input = process.stdin, output = process.stderr } = {}) {
35
+ return new Promise((resolve) => {
36
+ const rl = readline.createInterface({ input, output });
37
+ rl.question(`${question} [y/N] `, (answer) => { rl.close(); resolve(/^y(es)?$/i.test(answer.trim())); });
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Resolve a login password. Order: --password-stdin, then $MEETSTREAM_LOGIN_PASSWORD,
43
+ * then an interactive hidden prompt (TTY only). Dependencies are injectable for tests.
44
+ */
45
+ export async function resolvePassword({
46
+ passwordStdin = false,
47
+ env = process.env,
48
+ isTTY = Boolean(process.stdin.isTTY),
49
+ read = readStdin,
50
+ prompt = promptHidden,
51
+ } = {}) {
52
+ let password;
53
+ if (passwordStdin) password = await read();
54
+ else if (env[PASSWORD_ENV]) password = env[PASSWORD_ENV];
55
+ else if (isTTY) password = await prompt('Account password (input hidden): ');
56
+ else {
57
+ throw usageError(`No password provided. Pipe it with --password-stdin or set ${PASSWORD_ENV}. Passwords are never accepted as command-line arguments.`);
58
+ }
59
+ if (!password) throw usageError('Password is empty.');
60
+ return password;
61
+ }
package/src/telemetry.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anonymous, opt-out usage telemetry (PostHog).
3
- * Captures ONLY command names + counts — never API keys, meeting URLs, transcripts,
3
+ * Captures ONLY command names + counts - never API keys, meeting URLs, transcripts,
4
4
  * or any content. Disable with DO_NOT_TRACK=1 or MEETSTREAM_TELEMETRY=0.
5
5
  * The project key is a PostHog *public* key.
6
6
  */