muse-cli 0.3.10__tar.gz → 0.3.12__tar.gz

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.
Files changed (45) hide show
  1. {muse_cli-0.3.10 → muse_cli-0.3.12}/.gitignore +3 -0
  2. {muse_cli-0.3.10 → muse_cli-0.3.12}/PKG-INFO +63 -10
  3. {muse_cli-0.3.10 → muse_cli-0.3.12}/README.md +62 -9
  4. {muse_cli-0.3.10 → muse_cli-0.3.12}/docs/PROTOCOL.md +80 -2
  5. muse_cli-0.3.12/docs/TUI.md +171 -0
  6. {muse_cli-0.3.10 → muse_cli-0.3.12}/pyproject.toml +4 -0
  7. {muse_cli-0.3.10 → muse_cli-0.3.12}/skills/muse-cli/SKILL.md +23 -5
  8. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/__init__.py +1 -1
  9. muse_cli-0.3.12/src/muse_cli/bridge.py +886 -0
  10. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/cli.py +358 -32
  11. muse_cli-0.3.12/src/muse_cli/demo.py +665 -0
  12. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/desc1.bin +0 -0
  13. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/gateway.py +51 -16
  14. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/routes.json +1035 -35
  15. muse_cli-0.3.12/src/muse_cli/tui/bun.lock +86 -0
  16. muse_cli-0.3.12/src/muse_cli/tui/package.json +21 -0
  17. muse_cli-0.3.12/src/muse_cli/tui/src/app.tsx +294 -0
  18. muse_cli-0.3.12/src/muse_cli/tui/src/bridge.ts +170 -0
  19. muse_cli-0.3.12/src/muse_cli/tui/src/components/Composer.tsx +235 -0
  20. muse_cli-0.3.12/src/muse_cli/tui/src/components/Header.tsx +64 -0
  21. muse_cli-0.3.12/src/muse_cli/tui/src/components/Overlays.tsx +367 -0
  22. muse_cli-0.3.12/src/muse_cli/tui/src/components/Panels.tsx +512 -0
  23. muse_cli-0.3.12/src/muse_cli/tui/src/components/Sidebar.tsx +122 -0
  24. muse_cli-0.3.12/src/muse_cli/tui/src/components/Splash.tsx +111 -0
  25. muse_cli-0.3.12/src/muse_cli/tui/src/components/Transcript.tsx +378 -0
  26. muse_cli-0.3.12/src/muse_cli/tui/src/components/common.tsx +43 -0
  27. muse_cli-0.3.12/src/muse_cli/tui/src/context.tsx +123 -0
  28. muse_cli-0.3.12/src/muse_cli/tui/src/controller.ts +465 -0
  29. muse_cli-0.3.12/src/muse_cli/tui/src/format.ts +170 -0
  30. muse_cli-0.3.12/src/muse_cli/tui/src/main.tsx +50 -0
  31. muse_cli-0.3.12/src/muse_cli/tui/src/protocol.ts +148 -0
  32. muse_cli-0.3.12/src/muse_cli/tui/src/store.ts +167 -0
  33. muse_cli-0.3.12/src/muse_cli/tui/src/theme.ts +58 -0
  34. muse_cli-0.3.12/src/muse_cli/tui/test/app.test.tsx +177 -0
  35. muse_cli-0.3.12/src/muse_cli/tui/test/fake.ts +174 -0
  36. muse_cli-0.3.12/src/muse_cli/tui/test/logic.test.ts +364 -0
  37. muse_cli-0.3.12/src/muse_cli/tui/tsconfig.json +15 -0
  38. muse_cli-0.3.12/src/muse_cli/tui.py +245 -0
  39. {muse_cli-0.3.10 → muse_cli-0.3.12}/LICENSE +0 -0
  40. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/__main__.py +0 -0
  41. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/browsers.py +0 -0
  42. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/chat.py +0 -0
  43. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/desc0.bin +0 -0
  44. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/skill.py +0 -0
  45. {muse_cli-0.3.10 → muse_cli-0.3.12}/src/muse_cli/update.py +0 -0
@@ -18,3 +18,6 @@ config.json
18
18
 
19
19
  # Firebase local cache
20
20
  .firebase/
21
+
22
+ # OpenTUI app dependencies
23
+ node_modules/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: muse-cli
3
- Version: 0.3.10
3
+ Version: 0.3.12
4
4
  Summary: Command-line client for your personal muse.ai AI agent: chat, automate, and manage side chats, feed, goals, ideas, and sessions from the terminal. No browser needed.
5
5
  Project-URL: Homepage, https://github.com/nikships/muse-cli
6
6
  Project-URL: Documentation, https://github.com/nikships/muse-cli#readme
@@ -56,9 +56,10 @@ https://github.com/user-attachments/assets/8c9aefe8-c5a4-4e4b-9393-48e2325f99a9
56
56
 
57
57
  A command-line client for your personal muse.ai AI agent: chat from the terminal, automate it with scripts, and manage side chats, feed, goals, ideas, and sessions without opening a browser. It speaks the app's own gateway protocol directly: HTTPS auth, then an encrypted Noise-XX WebSocket to your personal VM.
58
58
 
59
+ - **A full-screen app:** `muse-cli` opens a chat app built on [OpenTUI](https://github.com/anomalyco/opentui), with your chats, feed, goals, ideas, tasks, mail and files a keystroke away.
59
60
  - **Chat from the shell:** send a message and get the agent's reply back as JSON.
60
61
  - **Script it:** every command prints JSON, so it pipes into `jq`, cron jobs, and other AI agents.
61
- - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 258 gateway methods.
62
+ - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 402 gateway methods.
62
63
  - **Agent-ready:** ships an agent skill so coding agents can drive your muse.ai agent for you.
63
64
 
64
65
  ## Agents driving agents
@@ -220,7 +221,9 @@ muse-cli status
220
221
  ## Usage
221
222
 
222
223
  ```bash
223
- muse-cli # interactive chat (same as `muse-cli chat`)
224
+ muse-cli # full-screen app on a terminal with Bun, else the plain chat
225
+ muse-cli tui # the full-screen app (`--demo`: made-up data, no account)
226
+ muse-cli chat # plain line-by-line chat
224
227
  muse-cli auth export --browser auto # import the browser login (macOS: direct read)
225
228
  muse-cli threads # main chat + side chats
226
229
  muse-cli history --limit 5 # recent messages
@@ -241,15 +244,52 @@ muse-cli goals # one goal: muse-cli goal <id>
241
244
  muse-cli ideas # one idea: muse-cli idea <id>
242
245
  muse-cli idea-exec <idea-id> # agent acts on the idea
243
246
 
247
+ muse-cli tasks # scheduled tasks (reminders, recurring jobs)
248
+ muse-cli task-runs --job <task-id> --limit 5 # recent runs, all tasks without --job
249
+ muse-cli task-run <task-id> # run a scheduled task now
250
+ muse-cli voices --gender F --accent British # voice catalog; also --search, --tone
251
+ muse-cli voice # the agent's current voice
252
+ muse-cli email # Muse Mail: mailbox + threads (--cursor for more)
253
+ muse-cli email-thread <thread-id> # messages in a thread; also email-message <id>
254
+ muse-cli email-attachment <message-id> 0 -o ./out # save attachment number 0
255
+ muse-cli peers # Trusted Network status and connected agents
256
+ muse-cli export-data -o ./out # download all your agent's data as a ZIP
257
+
244
258
  muse-cli session-start --title "trip planning" # new side chat
245
259
  muse-cli session-rename <id> "new title"
246
260
  muse-cli session-archive <id> # also: pin, unpin, unarchive, delete
247
261
  muse-cli seen <thread-id>
248
262
  muse-cli wake
249
- muse-cli raw <method> --body '{}' # escape hatch: any of 258 gateway methods
263
+ muse-cli raw <method> --body '{}' # escape hatch: any of 402 gateway methods
250
264
  ```
251
265
 
252
- The interactive chat prints plain text, one message per line, so it works well
266
+ ### The full-screen app
267
+
268
+ ![The muse-cli full-screen app in demo mode](https://raw.githubusercontent.com/nikships/muse-cli/main/assets/tui.png)
269
+
270
+ On a terminal, `muse-cli` opens a full-screen app built on
271
+ [OpenTUI](https://github.com/anomalyco/opentui). It needs
272
+ [Bun](https://bun.sh) 1.3.14 or later; `muse-cli tui` offers to install it.
273
+ The first run copies the app to `~/.cache/muse-cli/tui` and installs its
274
+ dependencies, which takes a few seconds once per release.
275
+
276
+ - Replies stream in as they arrive, with Markdown, code blocks and file chips.
277
+ Press Enter on a file to save it to `~/Downloads/muse`.
278
+ - Your chats sit on the left. `Tab` moves between them and the message box,
279
+ `Ctrl+N` starts a side chat.
280
+ - `Ctrl+K` jumps to any chat, space or action. `Alt+1` to `Alt+7` open Chat,
281
+ Feed, Goals, Ideas, Tasks, Mail and Files. Type `/` for commands, `F1` for
282
+ every shortcut.
283
+ - `Ctrl+C` clears the message box, and quits when it is empty.
284
+
285
+ `muse-cli tui --demo` runs it on made-up data and never contacts muse.ai.
286
+ Set `MUSE_CLI_UI=plain` to make bare `muse-cli` open the plain chat instead.
287
+ Without Bun, or when stdin or stdout is not a terminal, `muse-cli` opens the
288
+ plain chat. Problems are logged to `~/.config/muse-cli/tui.log`.
289
+
290
+ ### The plain chat
291
+
292
+ `muse-cli chat` prints plain text, one message per line, so it works well
253
293
  with screen readers. It resumes the conversation you used last; type `/help`
254
294
  inside it for `/chats`, `/open N`, `/main`, `/new`, `/history`, and `/login`.
255
295
  Any command above can also be run with a leading slash (`/status`, `/goals`,
@@ -258,6 +298,12 @@ Any command above can also be run with a leading slash (`/status`, `/goals`,
258
298
  Every other command prints JSON. Your VM is auto-discovered from your session, and a
259
299
  random device id is generated on first run.
260
300
 
301
+ Some features are rolled out per account. When yours does not have one, the
302
+ command exits with a gateway error that names it, for example
303
+ `email_not_enabled` for Muse Mail. `peers` reports when the Trusted Network is
304
+ turned off instead of failing. `export-data` streams the ZIP to disk (the
305
+ server picks the file name), so a large agent does not need the memory.
306
+
261
307
  Pipe it into other tools:
262
308
 
263
309
  ```bash
@@ -280,7 +326,7 @@ found during reverse engineering.
280
326
  |----------|-------------|
281
327
  | [skills/muse-cli/SKILL.md](https://github.com/nikships/muse-cli/blob/main/skills/muse-cli/SKILL.md) | Agent skill: install check, auth setup, command reference |
282
328
  | [docs/PROTOCOL.md](https://github.com/nikships/muse-cli/blob/main/docs/PROTOCOL.md) | Gateway protocol reference: auth chain, Noise transport, framing, method quirks |
283
- | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 258 gateway methods with paths and services |
329
+ | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 402 gateway methods with paths and services |
284
330
  | `muse-cli raw --help` | Escape hatch for calling any gateway method directly |
285
331
 
286
332
  ## Development
@@ -290,23 +336,30 @@ git clone https://github.com/nikships/muse-cli.git
290
336
  cd muse-cli
291
337
  uv run muse-cli --help
292
338
  uv run python -m unittest discover -s tests # unit tests (no network)
339
+ cd src/muse_cli/tui && bun install && bun test && bunx tsc --noEmit # app tests
340
+ MUSE_CLI_TUI_DIR=$PWD uv run muse-cli tui --demo # run the app from the checkout
293
341
  ```
294
342
 
295
343
  ```
296
344
  muse-cli/
297
- assets/ README artwork (generated with Muse Image)
345
+ assets/ README artwork (generated with Muse Image) and app screenshots
298
346
  docs/PROTOCOL.md protocol reference for re-derivation
299
- scripts/ release version bump (used by CI)
347
+ docs/TUI.md the full-screen app and its bridge protocol
348
+ scripts/ release version bump (used by CI), route table extractor
300
349
  site/ landing page (Firebase Hosting)
301
350
  skills/muse-cli/ agent skill
302
351
  src/muse_cli/
303
352
  cli.py argument parsing and all commands
304
- chat.py interactive chat (the default command)
353
+ chat.py plain interactive chat (`muse-cli chat`)
354
+ tui.py launches the full-screen app (finds Bun, caches the app)
355
+ tui/ the full-screen app: TypeScript on OpenTUI and Bun
356
+ bridge.py JSON-lines bridge the app talks to muse.ai through
357
+ demo.py made-up data for `muse-cli tui --demo`
305
358
  browsers.py reads the muse.ai login from Chromium browsers on macOS
306
359
  gateway.py gateway client (auth, Noise transport, subscriptions)
307
360
  update.py daily update notice and `muse-cli update`
308
361
  skill.py installs and refreshes the bundled agent skill
309
- routes.json 258 gateway methods extracted from the web client
362
+ routes.json 402 gateway methods extracted from the web client
310
363
  desc0.bin protobuf descriptors for the wire framing
311
364
  desc1.bin
312
365
  tests/ unit tests (no network)
@@ -19,9 +19,10 @@ https://github.com/user-attachments/assets/8c9aefe8-c5a4-4e4b-9393-48e2325f99a9
19
19
 
20
20
  A command-line client for your personal muse.ai AI agent: chat from the terminal, automate it with scripts, and manage side chats, feed, goals, ideas, and sessions without opening a browser. It speaks the app's own gateway protocol directly: HTTPS auth, then an encrypted Noise-XX WebSocket to your personal VM.
21
21
 
22
+ - **A full-screen app:** `muse-cli` opens a chat app built on [OpenTUI](https://github.com/anomalyco/opentui), with your chats, feed, goals, ideas, tasks, mail and files a keystroke away.
22
23
  - **Chat from the shell:** send a message and get the agent's reply back as JSON.
23
24
  - **Script it:** every command prints JSON, so it pipes into `jq`, cron jobs, and other AI agents.
24
- - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 258 gateway methods.
25
+ - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 402 gateway methods.
25
26
  - **Agent-ready:** ships an agent skill so coding agents can drive your muse.ai agent for you.
26
27
 
27
28
  ## Agents driving agents
@@ -183,7 +184,9 @@ muse-cli status
183
184
  ## Usage
184
185
 
185
186
  ```bash
186
- muse-cli # interactive chat (same as `muse-cli chat`)
187
+ muse-cli # full-screen app on a terminal with Bun, else the plain chat
188
+ muse-cli tui # the full-screen app (`--demo`: made-up data, no account)
189
+ muse-cli chat # plain line-by-line chat
187
190
  muse-cli auth export --browser auto # import the browser login (macOS: direct read)
188
191
  muse-cli threads # main chat + side chats
189
192
  muse-cli history --limit 5 # recent messages
@@ -204,15 +207,52 @@ muse-cli goals # one goal: muse-cli goal <id>
204
207
  muse-cli ideas # one idea: muse-cli idea <id>
205
208
  muse-cli idea-exec <idea-id> # agent acts on the idea
206
209
 
210
+ muse-cli tasks # scheduled tasks (reminders, recurring jobs)
211
+ muse-cli task-runs --job <task-id> --limit 5 # recent runs, all tasks without --job
212
+ muse-cli task-run <task-id> # run a scheduled task now
213
+ muse-cli voices --gender F --accent British # voice catalog; also --search, --tone
214
+ muse-cli voice # the agent's current voice
215
+ muse-cli email # Muse Mail: mailbox + threads (--cursor for more)
216
+ muse-cli email-thread <thread-id> # messages in a thread; also email-message <id>
217
+ muse-cli email-attachment <message-id> 0 -o ./out # save attachment number 0
218
+ muse-cli peers # Trusted Network status and connected agents
219
+ muse-cli export-data -o ./out # download all your agent's data as a ZIP
220
+
207
221
  muse-cli session-start --title "trip planning" # new side chat
208
222
  muse-cli session-rename <id> "new title"
209
223
  muse-cli session-archive <id> # also: pin, unpin, unarchive, delete
210
224
  muse-cli seen <thread-id>
211
225
  muse-cli wake
212
- muse-cli raw <method> --body '{}' # escape hatch: any of 258 gateway methods
226
+ muse-cli raw <method> --body '{}' # escape hatch: any of 402 gateway methods
213
227
  ```
214
228
 
215
- The interactive chat prints plain text, one message per line, so it works well
229
+ ### The full-screen app
230
+
231
+ ![The muse-cli full-screen app in demo mode](https://raw.githubusercontent.com/nikships/muse-cli/main/assets/tui.png)
232
+
233
+ On a terminal, `muse-cli` opens a full-screen app built on
234
+ [OpenTUI](https://github.com/anomalyco/opentui). It needs
235
+ [Bun](https://bun.sh) 1.3.14 or later; `muse-cli tui` offers to install it.
236
+ The first run copies the app to `~/.cache/muse-cli/tui` and installs its
237
+ dependencies, which takes a few seconds once per release.
238
+
239
+ - Replies stream in as they arrive, with Markdown, code blocks and file chips.
240
+ Press Enter on a file to save it to `~/Downloads/muse`.
241
+ - Your chats sit on the left. `Tab` moves between them and the message box,
242
+ `Ctrl+N` starts a side chat.
243
+ - `Ctrl+K` jumps to any chat, space or action. `Alt+1` to `Alt+7` open Chat,
244
+ Feed, Goals, Ideas, Tasks, Mail and Files. Type `/` for commands, `F1` for
245
+ every shortcut.
246
+ - `Ctrl+C` clears the message box, and quits when it is empty.
247
+
248
+ `muse-cli tui --demo` runs it on made-up data and never contacts muse.ai.
249
+ Set `MUSE_CLI_UI=plain` to make bare `muse-cli` open the plain chat instead.
250
+ Without Bun, or when stdin or stdout is not a terminal, `muse-cli` opens the
251
+ plain chat. Problems are logged to `~/.config/muse-cli/tui.log`.
252
+
253
+ ### The plain chat
254
+
255
+ `muse-cli chat` prints plain text, one message per line, so it works well
216
256
  with screen readers. It resumes the conversation you used last; type `/help`
217
257
  inside it for `/chats`, `/open N`, `/main`, `/new`, `/history`, and `/login`.
218
258
  Any command above can also be run with a leading slash (`/status`, `/goals`,
@@ -221,6 +261,12 @@ Any command above can also be run with a leading slash (`/status`, `/goals`,
221
261
  Every other command prints JSON. Your VM is auto-discovered from your session, and a
222
262
  random device id is generated on first run.
223
263
 
264
+ Some features are rolled out per account. When yours does not have one, the
265
+ command exits with a gateway error that names it, for example
266
+ `email_not_enabled` for Muse Mail. `peers` reports when the Trusted Network is
267
+ turned off instead of failing. `export-data` streams the ZIP to disk (the
268
+ server picks the file name), so a large agent does not need the memory.
269
+
224
270
  Pipe it into other tools:
225
271
 
226
272
  ```bash
@@ -243,7 +289,7 @@ found during reverse engineering.
243
289
  |----------|-------------|
244
290
  | [skills/muse-cli/SKILL.md](https://github.com/nikships/muse-cli/blob/main/skills/muse-cli/SKILL.md) | Agent skill: install check, auth setup, command reference |
245
291
  | [docs/PROTOCOL.md](https://github.com/nikships/muse-cli/blob/main/docs/PROTOCOL.md) | Gateway protocol reference: auth chain, Noise transport, framing, method quirks |
246
- | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 258 gateway methods with paths and services |
292
+ | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 402 gateway methods with paths and services |
247
293
  | `muse-cli raw --help` | Escape hatch for calling any gateway method directly |
248
294
 
249
295
  ## Development
@@ -253,23 +299,30 @@ git clone https://github.com/nikships/muse-cli.git
253
299
  cd muse-cli
254
300
  uv run muse-cli --help
255
301
  uv run python -m unittest discover -s tests # unit tests (no network)
302
+ cd src/muse_cli/tui && bun install && bun test && bunx tsc --noEmit # app tests
303
+ MUSE_CLI_TUI_DIR=$PWD uv run muse-cli tui --demo # run the app from the checkout
256
304
  ```
257
305
 
258
306
  ```
259
307
  muse-cli/
260
- assets/ README artwork (generated with Muse Image)
308
+ assets/ README artwork (generated with Muse Image) and app screenshots
261
309
  docs/PROTOCOL.md protocol reference for re-derivation
262
- scripts/ release version bump (used by CI)
310
+ docs/TUI.md the full-screen app and its bridge protocol
311
+ scripts/ release version bump (used by CI), route table extractor
263
312
  site/ landing page (Firebase Hosting)
264
313
  skills/muse-cli/ agent skill
265
314
  src/muse_cli/
266
315
  cli.py argument parsing and all commands
267
- chat.py interactive chat (the default command)
316
+ chat.py plain interactive chat (`muse-cli chat`)
317
+ tui.py launches the full-screen app (finds Bun, caches the app)
318
+ tui/ the full-screen app: TypeScript on OpenTUI and Bun
319
+ bridge.py JSON-lines bridge the app talks to muse.ai through
320
+ demo.py made-up data for `muse-cli tui --demo`
268
321
  browsers.py reads the muse.ai login from Chromium browsers on macOS
269
322
  gateway.py gateway client (auth, Noise transport, subscriptions)
270
323
  update.py daily update notice and `muse-cli update`
271
324
  skill.py installs and refreshes the bundled agent skill
272
- routes.json 258 gateway methods extracted from the web client
325
+ routes.json 402 gateway methods extracted from the web client
273
326
  desc0.bin protobuf descriptors for the wire framing
274
327
  desc1.bin
275
328
  tests/ unit tests (no network)
@@ -43,13 +43,15 @@ chat / feed / goals / ideas / sessions / ...
43
43
  - **Request:** `ServiceRequest{service, payload =
44
44
  ServiceFrame{stream_id, request =
45
45
  ApplicationRequest{verb, path, headers, body, end_body}}}`. Stream ids start
46
- at 1. Services: daemon 0, sentinel 1, vault 2, authd 3.
46
+ at 1. Services: daemon 0, sentinel 1, vault 2, authd 3, ssh_access 4,
47
+ yolk 5.
47
48
  - **Response:** `ServiceResponse{payload = ServiceFrame{... response =
48
49
  ApplicationResponse{status, headers, body, end_body}}}` plus `body_chunk`
49
50
  frames until `end_body`.
50
51
  - **Subscriptions** (`chat.subscribe`, `chat.stream`, ...): same envelope, the
51
52
  server streams `application/x-ndjson` records in body chunks.
52
- - **Method table:** `routes.json` (258 methods extracted from the web bundle).
53
+ - **Method table:** `routes.json` (402 methods extracted from the web bundle
54
+ by `scripts/extract_routes.py`).
53
55
 
54
56
  ## Server quirks learned from live errors
55
57
 
@@ -84,6 +86,28 @@ chat / feed / goals / ideas / sessions / ...
84
86
  not in `routes.json`; sent as a raw-path daemon request over the Noise
85
87
  tunnel it returns the file (body chunks). `Gateway.download_file()` wraps
86
88
  this. `artifacts.fetch_url` is unrelated (needs `project_dir`).
89
+ - **Presentations**: images, files and other widgets the agent shows arrive
90
+ in history as their own `delta.presentation` events (role `assistant`,
91
+ empty `reply_to_message_id`, no `status`) after the text reply.
92
+ `payload.kind` is `image` (`data.images[]`), `file` (`data.file`, a single
93
+ object), `external_link` (`data.url`), `internal_link_action_card`
94
+ (`data.title`, `data.subtitle`, `data.data.url`), `space_build_completed`
95
+ (`data.display_name`, `data.summary`), `browser_task` (`data.display_state`,
96
+ `data.current_site`), `html` (`data.html`) or `voice_options`.
97
+ `display_text` is a caption or a markdown link, `fallback_text` the
98
+ markdown version. Names in `display_text` are wrapped in Unicode isolates
99
+ (U+2068/U+2069). A browser task that updates is re-sent with a new `seq`
100
+ and the same `payload.id`; when `data.activity_title_source` is `state`,
101
+ `display_text` is only the status ("Task completed").
102
+ - **User uploads** (a photo sent from the phone app): the text is
103
+ `[image:<mime> workspace/<p>]` and `payload.metadata.attachments[]` has
104
+ `{path: "workspace/<p>", mime_type, filename, bytes_len, width, height}`.
105
+ The bare path downloads like an agent file as `sandbox://workspace/<p>`.
106
+ - **Quick-reply widgets**: the text holds `[hatch_widget:<widget_id>]` (or
107
+ `[[hatch_widget:<widget_id>]]`) and `payload.widgets[]` has
108
+ `{widget_id, kind: "option", data: {options: [...]}, fallback_text,
109
+ state: {data: {selectedText}, version}}`. `widgets.state.set` and
110
+ `widgets.state.patch` exist in `routes.json` but are not mapped yet.
87
111
  - `session.start`: `{method: "/api/session/start", params: {origin: "fresh",
88
112
  lifecycle: "persistent"}}`. A `title` param is accepted but ignored (the
89
113
  chat stays untitled), so `start_session` follows up with `session.rename`.
@@ -94,6 +118,60 @@ chat / feed / goals / ideas / sessions / ...
94
118
  - `api.idea-cards.execute`: `{ideaCardId, mode: "full"}` plus path param. A
95
119
  `session_id` in the body did not move the run into that side chat; the
96
120
  user message and the agent's reply landed in the main chat.
121
+ - **Re-deriving the method table:** `scripts/extract_routes.py` crawls the web
122
+ app and rewrites `routes.json`, `desc0.bin` and `desc1.bin`. Logged out,
123
+ every muse.ai page redirects to the marketing page (`?aymh_complete=1`),
124
+ whose ~50 chunks do not include the app. The script therefore loads `/`
125
+ with the saved cookies, then follows `static/chunks/*.js` references
126
+ (about 1300 chunks, all public). The route table is one array of
127
+ `{method,httpMethod,path,...}` literals; the descriptors are base64
128
+ `FileDescriptorProto` blobs (`noise_transport.proto`,
129
+ `noise_envelope.proto`). Route literals may carry `requestBody: "empty"`,
130
+ `requestTimeoutMs`, `responseIdleTimeoutMs` and `maxResponseBytes`
131
+ (numbers such as `12e4`, `0x2400000`, `1/0` for no limit).
132
+ - **How the web client builds a request:** GET routes fill `{path}` params
133
+ from the params object and send the rest as query; non-GET routes send the
134
+ whole params object (path params included) as the JSON body, except
135
+ `requestBody: "empty"` routes, which send no body and no content-type.
136
+ `Gateway` matches this. List filters are repeated query keys:
137
+ `voice.catalog?source=library&gender=F&gender=M` works.
138
+ - `Gateway.request()` with `timeout=None` uses the route's `requestTimeoutMs`
139
+ (30 s when absent); `raw` and `export-data` default to that.
140
+ - `tasks.list` returns `{schedules: [{id, title, mode, enabled,
141
+ schedule_key, next_run_at_utc (s), cadence, ...}], invalid}`;
142
+ `tasks.runs` takes `{limit, job_id?}` and returns `{runs: [{run_id,
143
+ job_id, status, trigger_reason, scheduled_for_utc, result_summary,
144
+ error_text}]}`. `tasks.run` is POST `/tasks/{job_id}/run` with body
145
+ `{job_id}`, and the web client treats it as an inference call like
146
+ `chat.stream`.
147
+ - `voice.catalog`: `{source: "library", query?, gender?: [F|M|N], accent?:
148
+ [..], tone?: [..], limit, offset}`; `voice.catalog_filters` lists the
149
+ values with counts. `voice.speak` (`{voice_id, text, format: "mp3",
150
+ stream: true}`, binary `audio/mpeg`) returned 404 `preview_audio_disabled`
151
+ on the test account.
152
+ - Muse Mail (`email.*`) answers 403 `{"code": "email_not_enabled"}` when the
153
+ account has no mailbox. Thread list: `{data: [{id, subject,
154
+ message_count, participants, last_message}], paging: {cursors: {after}}}`,
155
+ next page with `{cursor}`. Messages carry `header_from`,
156
+ `header_from_name`, `header_to`, `text_body`/`html_body`/`extracted_text`,
157
+ `sender_authentication.verdict`, `attachments[{index, filename, mime_type,
158
+ size}]`. `email.attachment.get` returns JSON with `content_base64` and
159
+ `metadata.mime_type`, not raw bytes.
160
+ - Trusted Network (`peers.*`, `grants.list`, `peerSpaces.*`): `peers.status`
161
+ always answers, with `availability` (`"disabled"` when off), `features`,
162
+ `limits` and the agent's `muse_id`. While it is off, the list calls return
163
+ 503 `peer_operation_unavailable` (`peers.connections.list`:
164
+ `connections_unavailable`). Page params are `{limit (1-100), cursor?}`.
165
+ - `dyi.export` (POST, empty body, ~65 min client timeout) streams the whole
166
+ data export as `application/zip` with `content-length` and a
167
+ `content-disposition` file name (`EYI Package_<date>_<n>.zip`). The test
168
+ account's export was 347 MB / 290 files in ~21 s. `export-data` writes the
169
+ body chunks straight to disk and checks type and length before keeping it.
170
+ - Services `ssh_access` (4, `ssh.operator.*`) and `yolk` (5,
171
+ `rv_migration.enable_export`) joined the `ServiceType` enum. Both are
172
+ operator/migration switches; muse-cli has no named commands for them.
173
+ - `vault.luks_status` returns 401 `request must come through nginx
174
+ auth_request` over the tunnel.
97
175
  - POSTs to muse.ai need browser `Sec-Fetch-*` headers or they return 403.
98
176
  - `auth export` on macOS decrypts the muse.ai rows of the browser's own cookie
99
177
  database (`~/Library/Application Support/<browser>/<profile>/{Network/,}Cookies`,
@@ -0,0 +1,171 @@
1
+ # The full-screen app (`muse-cli tui`)
2
+
3
+ `muse-cli tui` (and bare `muse-cli` on an interactive terminal) opens a
4
+ full-screen app built on [OpenTUI](https://github.com/anomalyco/opentui).
5
+ `muse-cli chat` stays the plain, line-by-line chat for screen readers and
6
+ dumb terminals.
7
+
8
+ ## Architecture
9
+
10
+ ```
11
+ muse-cli tui (Python launcher, muse_cli/tui.py)
12
+ │ prepares the app in ~/.cache/muse-cli/tui/<hash>, then runs
13
+ ▼
14
+ bun src/main.tsx (OpenTUI + React, muse_cli/tui/) ── owns the terminal
15
+ │ spawns, talks JSON lines over pipes
16
+ ▼
17
+ python -m muse_cli.bridge (muse_cli/bridge.py) ── owns the Gateway
18
+ ```
19
+
20
+ - The TypeScript app owns the terminal. It never talks to muse.ai itself.
21
+ - The bridge is the only process with a `Gateway`. One worker thread makes
22
+ every gateway call, so the WebSocket has exactly one consumer.
23
+ - The bridge keeps its protocol on the original stdout file descriptor and
24
+ points `sys.stdout` and fd 1 at stderr, so a stray `print()` from a CLI
25
+ helper can never corrupt the protocol. The app writes the bridge's stderr
26
+ to `~/.config/muse-cli/tui.log`.
27
+
28
+ ### Launcher
29
+
30
+ - Finds Bun (`bun` on PATH, else `~/.bun/bin/bun`). Bun 1.3.14 or later.
31
+ - Copies `muse_cli/tui` (without `node_modules`) to
32
+ `~/.cache/muse-cli/tui/<hash>` where `<hash>` covers every shipped file,
33
+ then runs `bun install --frozen-lockfile` there once. Later launches reuse
34
+ it. `MUSE_CLI_TUI_DIR=<dir>` runs a checkout in place instead (development).
35
+ - Runs `bun <dir>/src/main.tsx` with the terminal inherited, and sets
36
+ `MUSE_CLI_PYTHON=<sys.executable>` so the app can start the bridge with
37
+ `[$MUSE_CLI_PYTHON, -m, muse_cli.bridge]` (plus `--demo` in demo mode).
38
+ - Exit code: the app's.
39
+ - Bare `muse-cli` opens the app when stdin and stdout are terminals, Bun is
40
+ available and `MUSE_CLI_UI` is not `plain`; otherwise the plain chat.
41
+ `muse-cli tui` without Bun offers to install it on a terminal and falls
42
+ back to the plain chat when declined.
43
+ - `muse-cli tui --demo` (or `MUSE_CLI_DEMO=1`) runs the bridge with made-up
44
+ data and never touches muse.ai. Screenshots and tests use it. Its fake
45
+ gateway (`muse_cli/demo.py`) answers with the real server's shapes, and a
46
+ reply streams in word by word. `MUSE_CLI_DEMO_SPEED=N` plays every demo
47
+ delay N times faster; in demo mode `idle` comes 3 s after the last reply.
48
+
49
+ ## Bridge protocol
50
+
51
+ Newline-delimited JSON, UTF-8, one object per line.
52
+
53
+ App to bridge (request):
54
+
55
+ ```json
56
+ {"id": 7, "method": "history", "params": {"session_id": null, "limit": 40}}
57
+ ```
58
+
59
+ Bridge to app (response, exactly one per request id):
60
+
61
+ ```json
62
+ {"id": 7, "result": {...}}
63
+ {"id": 7, "error": {"kind": "gateway", "message": "...", "status": 404}}
64
+ ```
65
+
66
+ Error `kind`: `auth` (no or expired login), `not_found` (deleted chat),
67
+ `gateway`, `timeout`, `bad_request` (unknown method or bad params),
68
+ `internal`. A gateway error whose body carries the server's reason uses its
69
+ `message`, and adds its `code` (for example `email_not_enabled`). The app
70
+ shows a code ending in `_not_enabled` as a feature the account lacks rather
71
+ than a failure to retry.
72
+
73
+ Bridge to app (event, no id):
74
+
75
+ ```json
76
+ {"event": "message", "data": {...}}
77
+ ```
78
+
79
+ ### Shapes
80
+
81
+ `Chat`: `{"session_id": str|null, "title": str}`. `session_id: null` is the
82
+ main chat.
83
+
84
+ `Session`: `{"session_id", "title", "is_thread", "pinned", "archived",
85
+ "updated_at_ms", "unread"}`. The main chat has `session_id: null` here too,
86
+ so its `Session` opens with `open` as is.
87
+
88
+ `Message`:
89
+
90
+ ```json
91
+ {"seq": 26693, "id": "assistant-msg-…", "role": "user"|"assistant",
92
+ "text": "markdown text", "at_ms": 1794117896436,
93
+ "final": true, "push": false,
94
+ "files": [{"path": "sandbox://…", "kind": "image", "mime": "image/png",
95
+ "label": "…", "byte_len": 1234}],
96
+ "choices": [{"id": "widget-…", "options": ["Yes", "Not now"], "selected": null}],
97
+ "card": null, "widget": false}
98
+ ```
99
+
100
+ - `at_ms` is `occurred_at_ms` (fallback `display_text_updated_at_ms`).
101
+ - `final` is false while the assistant is still writing (no `status`).
102
+ - `push` is true for proactive assistant messages (non-empty
103
+ `reply_to_message_id`, same rule as `cli.is_reply`).
104
+ - Only `message.user` and `message.assistant` events with text, files or
105
+ choices become messages, plus `delta.presentation` events (below).
106
+ - A `delta.presentation` event is something the agent shows after its text:
107
+ an image or file (`files`, empty `text`), or a link, connector, finished
108
+ space, browser task or note (`card`: `{"id", "kind", "title", "subtitle",
109
+ "url", "status"}`). These messages have `widget: true`; they never count as
110
+ the reply, and the app draws them as part of the assistant message before
111
+ them. A widget that changes (a browser task finishing) comes back with a new
112
+ `seq` but the same `card.id`; only the latest is kept. Kinds with nothing
113
+ to show (`voice_options`) are skipped.
114
+ - `choices` come from `payload.widgets` of kind `option` (quick replies);
115
+ `selected` is `state.data.selectedText`. Their `[hatch_widget:…]` or
116
+ `[[hatch_widget:…]]` placeholder is removed from `text`. The app sends a
117
+ picked option as a normal message.
118
+ - A user's own uploads come from `payload.metadata.attachments` (a bare
119
+ `workspace/…` path, given a `sandbox://` prefix), and their
120
+ `[image:<mime> <path>]` placeholder is removed from `text`.
121
+
122
+ ### Events
123
+
124
+ | event | data | when |
125
+ | ------------ | ---- | ---- |
126
+ | `ready` | `{"version", "demo"}` | first line, before any connection |
127
+ | `connection` | `{"state": "connecting"\|"online"\|"offline"\|"auth_needed", "detail"}` | connection state changes |
128
+ | `message` | `{"session_id", "message": Message}` | a new final message in the active chat (user or assistant), ordered by seq |
129
+ | `draft` | `{"session_id", "message": Message}` | the assistant's in-progress reply changed (`final: false`) |
130
+ | `thinking` | `{"session_id", "since_ms"}` | after `send`, until the first reply |
131
+ | `idle` | `{"session_id", "replied": bool}` | the agent went quiet after a send (10 s after the last reply, or 300 s with no reply) |
132
+ | `unread` | unread-count payload | every 30 s while online |
133
+ | `log` | `{"level", "text"}` | notices worth a toast |
134
+
135
+ The bridge tracks one active chat (`open`). It polls that chat's history:
136
+ every 1 s from `send` until `idle`, otherwise every 8 s, and emits
137
+ `message` for every final message newer than the last one it reported.
138
+ That covers proactive pushes too. A poll failure never kills the loop; three
139
+ failures in a row emit `connection` `offline` and the bridge reconnects with
140
+ backoff.
141
+
142
+ ### Methods
143
+
144
+ | method | params | result |
145
+ | ------ | ------ | ------ |
146
+ | `connect` | `{}` | `{"vm_id", "chat": Chat, "identity"}`; uses `chat.json` for the last chat |
147
+ | `login` | `{}` | `{"ok": bool, "log": str}`; runs `auth export` with its output captured, reconnects on success |
148
+ | `sessions` | `{"archived": false}` | `{"sessions": [Session]}`; main chat first, then pinned, then by `updated_at_ms` desc. `archived: true` also lists archived chats |
149
+ | `open` | `{"session_id": str\|null, "title": str, "limit": 40}` | `{"chat": Chat, "messages": [Message]}`; sets the active chat and saves `chat.json`. `not_found` for a deleted chat |
150
+ | `history` | `{"limit": 40, "before_seq": int?}` | `{"messages": [Message]}` for the active chat |
151
+ | `send` | `{"text": str}` | `{"sent": true, "baseline": seq}`; then `thinking`, `draft`, `message`, `idle` events |
152
+ | `new_chat` | `{"title": str?}` | `{"chat": Chat}`; also makes it active |
153
+ | `session_op` | `{"op": "rename"\|"pin"\|"unpin"\|"archive"\|"unarchive"\|"delete", "session_id", "title"?}` | server result |
154
+ | `status` | `{}` | `{"vm_id", "sessions", "unread", "identity"}` |
155
+ | `feed` | `{"limit": 50}` | `{"units": [{"id", "title", "date", "edition", "summary", "reaction", "emoji", "kicker", "category", "source", "why"}]}` |
156
+ | `feed_react` | `{"unit", "reaction": "like"\|"love"\|"dislike"}` | server result |
157
+ | `goals` | `{}` | `{"goals": [{"id", "title", "status", "subtitle"}]}` |
158
+ | `goal` | `{"id"}` | server result |
159
+ | `ideas` | `{}` | `{"ideas": [{"id", "title", "section", "summary"}]}` |
160
+ | `idea` | `{"id"}` | server result |
161
+ | `idea_exec` | `{"id"}` | server result (runs in the active chat) |
162
+ | `tasks` | `{}` | `{"tasks": [...same rows as cmd_tasks]}` |
163
+ | `task_runs` | `{"job": str?, "limit": 10}` | `{"runs": [...same rows as cmd_task_runs]}` |
164
+ | `email` | `{}` | `{"mailbox", "threads": [...same rows as cmd_email]}` |
165
+ | `email_thread` | `{"id"}` | `{"messages": [...same rows as _email_message]}` |
166
+ | `files` | `{"limit": 200}` | `{"files": [{"seq", "message_id", "path", "kind", "mime", "label", "byte_len"}]}` for the active chat, newest first, uploads and presented files included |
167
+ | `download` | `{"path", "dir"?}` | `{"rows": [...save_resources rows]}`; default dir `~/Downloads/muse` |
168
+ | `ping` | `{}` | `{"pong": true}` |
169
+ | `shutdown` | `{}` | `{}`, then the bridge closes the gateway and exits 0 |
170
+
171
+ The bridge also exits when its stdin closes.
@@ -72,6 +72,10 @@ muse-cli = "muse_cli.cli:main"
72
72
  [tool.hatch.version]
73
73
  path = "src/muse_cli/__init__.py"
74
74
 
75
+ [tool.hatch.build]
76
+ # The app's dependencies are installed per user at first launch.
77
+ exclude = ["node_modules"]
78
+
75
79
  [tool.hatch.build.targets.wheel]
76
80
  packages = ["src/muse_cli"]
77
81
 
@@ -11,8 +11,9 @@ fails and report it.
11
11
 
12
12
  The `muse-cli` package (on PyPI) talks to the muse.ai personal gateway
13
13
  directly. No browser needed after the one-time cookie export. Every command
14
- prints JSON except the interactive chat (`muse-cli` with no arguments, or
15
- `muse-cli chat`), which is a human REPL. Agents should never run it.
14
+ prints JSON except the interactive ones: `muse-cli` with no arguments (the
15
+ full-screen app on a terminal, else the plain chat), `muse-cli tui` and
16
+ `muse-cli chat`. They are for humans. Agents should never run them.
16
17
 
17
18
  ## 1. Install
18
19
 
@@ -177,6 +178,15 @@ muse-cli goals # one goal: muse-cli goa
177
178
  muse-cli ideas # one idea: muse-cli idea <id>
178
179
  muse-cli unread
179
180
  muse-cli seen <thread-id>
181
+ muse-cli tasks # scheduled tasks (id, schedule, next_run)
182
+ muse-cli task-runs --job <task-id> --limit 5 # what recent runs did
183
+ muse-cli voices --search calm --limit 5 # voice catalog; --gender F|M|N --accent --tone
184
+ muse-cli voice # current voice
185
+ muse-cli email # Muse Mail mailbox + threads
186
+ muse-cli email-thread <thread-id> # also: email-message <id>
187
+ muse-cli email-attachment <message-id> <index> -o DIR
188
+ muse-cli peers # Trusted Network status / connected agents
189
+ muse-cli export-data -o DIR # full data export ZIP (can be hundreds of MB)
180
190
  ```
181
191
 
182
192
  Management (visible side effects, confirm with the user first when destructive):
@@ -184,6 +194,7 @@ Management (visible side effects, confirm with the user first when destructive):
184
194
  ```bash
185
195
  muse-cli feed-react <unit-id> love
186
196
  muse-cli idea-exec <idea-id> # the agent acts on the idea (real work)
197
+ muse-cli task-run <task-id> # runs a scheduled task now (real work)
187
198
  muse-cli session-start --title "x" # new side chat
188
199
  muse-cli session-rename <id> "title" # also: pin, unpin, archive, unarchive, delete
189
200
  muse-cli wake
@@ -191,7 +202,7 @@ muse-cli wake
191
202
 
192
203
  ## Escape hatch
193
204
 
194
- `muse-cli raw <method> --body '{...}' [--param k=v]` calls any of the 258
205
+ `muse-cli raw <method> --body '{...}' [--param k=v]` calls any of the 402
195
206
  gateway methods in `routes.json`. Prefer the named commands above; use raw
196
207
  only for methods with no wrapper.
197
208
 
@@ -209,8 +220,15 @@ only for methods with no wrapper.
209
220
  may be missing.
210
221
  - `idea-exec --thread` may be ignored by the server; the run can land in the
211
222
  main chat.
212
- - Running `muse-cli` with no command opens the interactive chat and blocks on
213
- stdin. From an agent, always pass an explicit command such as `status` or
223
+ - Muse Mail, the Trusted Network (`peers`) and some other features are
224
+ enabled per account. `email` failing with `email_not_enabled` (exit 3) means
225
+ the account has no Muse Mail, not a broken install. `peers` prints
226
+ `availability: "disabled"` and a note when the Trusted Network is off.
227
+ - `export-data` writes the user's entire agent data (workspace, chats) to
228
+ disk. It takes about 20 s for a few hundred MB. Run it only when asked, and
229
+ keep the ZIP private.
230
+ - Running `muse-cli` with no command opens the full-screen app (or the plain
231
+ chat without Bun) and blocks on the terminal. From an agent, always pass an explicit command such as `status` or
214
232
  `send`.
215
233
  - `history` without `--thread` reads the main chat only.
216
234
  - Agent media shows up as `sandbox://workspace/...` paths, often in a
@@ -1,3 +1,3 @@
1
1
  """muse-cli: talk to your personal muse.ai AI agent from the terminal."""
2
2
 
3
- __version__ = "0.3.10"
3
+ __version__ = "0.3.12"