muse-cli 0.3.9__tar.gz → 0.3.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: muse-cli
3
- Version: 0.3.9
3
+ Version: 0.3.11
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
@@ -58,7 +58,7 @@ A command-line client for your personal muse.ai AI agent: chat from the terminal
58
58
 
59
59
  - **Chat from the shell:** send a message and get the agent's reply back as JSON.
60
60
  - **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.
61
+ - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 402 gateway methods.
62
62
  - **Agent-ready:** ships an agent skill so coding agents can drive your muse.ai agent for you.
63
63
 
64
64
  ## Agents driving agents
@@ -241,21 +241,40 @@ muse-cli goals # one goal: muse-cli goal <id>
241
241
  muse-cli ideas # one idea: muse-cli idea <id>
242
242
  muse-cli idea-exec <idea-id> # agent acts on the idea
243
243
 
244
+ muse-cli tasks # scheduled tasks (reminders, recurring jobs)
245
+ muse-cli task-runs --job <task-id> --limit 5 # recent runs, all tasks without --job
246
+ muse-cli task-run <task-id> # run a scheduled task now
247
+ muse-cli voices --gender F --accent British # voice catalog; also --search, --tone
248
+ muse-cli voice # the agent's current voice
249
+ muse-cli email # Muse Mail: mailbox + threads (--cursor for more)
250
+ muse-cli email-thread <thread-id> # messages in a thread; also email-message <id>
251
+ muse-cli email-attachment <message-id> 0 -o ./out # save attachment number 0
252
+ muse-cli peers # Trusted Network status and connected agents
253
+ muse-cli export-data -o ./out # download all your agent's data as a ZIP
254
+
244
255
  muse-cli session-start --title "trip planning" # new side chat
245
256
  muse-cli session-rename <id> "new title"
246
257
  muse-cli session-archive <id> # also: pin, unpin, unarchive, delete
247
258
  muse-cli seen <thread-id>
248
259
  muse-cli wake
249
- muse-cli raw <method> --body '{}' # escape hatch: any of 258 gateway methods
260
+ muse-cli raw <method> --body '{}' # escape hatch: any of 402 gateway methods
250
261
  ```
251
262
 
252
263
  The interactive chat prints plain text, one message per line, so it works well
253
264
  with screen readers. It resumes the conversation you used last; type `/help`
254
265
  inside it for `/chats`, `/open N`, `/main`, `/new`, `/history`, and `/login`.
266
+ Any command above can also be run with a leading slash (`/status`, `/goals`,
267
+ `/files`, etc.) with `<TAB>` auto-completion.
255
268
 
256
269
  Every other command prints JSON. Your VM is auto-discovered from your session, and a
257
270
  random device id is generated on first run.
258
271
 
272
+ Some features are rolled out per account. When yours does not have one, the
273
+ command exits with a gateway error that names it, for example
274
+ `email_not_enabled` for Muse Mail. `peers` reports when the Trusted Network is
275
+ turned off instead of failing. `export-data` streams the ZIP to disk (the
276
+ server picks the file name), so a large agent does not need the memory.
277
+
259
278
  Pipe it into other tools:
260
279
 
261
280
  ```bash
@@ -278,7 +297,7 @@ found during reverse engineering.
278
297
  |----------|-------------|
279
298
  | [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 |
280
299
  | [docs/PROTOCOL.md](https://github.com/nikships/muse-cli/blob/main/docs/PROTOCOL.md) | Gateway protocol reference: auth chain, Noise transport, framing, method quirks |
281
- | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 258 gateway methods with paths and services |
300
+ | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 402 gateway methods with paths and services |
282
301
  | `muse-cli raw --help` | Escape hatch for calling any gateway method directly |
283
302
 
284
303
  ## Development
@@ -294,7 +313,7 @@ uv run python -m unittest discover -s tests # unit tests (no network)
294
313
  muse-cli/
295
314
  assets/ README artwork (generated with Muse Image)
296
315
  docs/PROTOCOL.md protocol reference for re-derivation
297
- scripts/ release version bump (used by CI)
316
+ scripts/ release version bump (used by CI), route table extractor
298
317
  site/ landing page (Firebase Hosting)
299
318
  skills/muse-cli/ agent skill
300
319
  src/muse_cli/
@@ -304,7 +323,7 @@ src/muse_cli/
304
323
  gateway.py gateway client (auth, Noise transport, subscriptions)
305
324
  update.py daily update notice and `muse-cli update`
306
325
  skill.py installs and refreshes the bundled agent skill
307
- routes.json 258 gateway methods extracted from the web client
326
+ routes.json 402 gateway methods extracted from the web client
308
327
  desc0.bin protobuf descriptors for the wire framing
309
328
  desc1.bin
310
329
  tests/ unit tests (no network)
@@ -21,7 +21,7 @@ A command-line client for your personal muse.ai AI agent: chat from the terminal
21
21
 
22
22
  - **Chat from the shell:** send a message and get the agent's reply back as JSON.
23
23
  - **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.
24
+ - **Full coverage:** named commands for the common tasks, plus a `raw` escape hatch for all 402 gateway methods.
25
25
  - **Agent-ready:** ships an agent skill so coding agents can drive your muse.ai agent for you.
26
26
 
27
27
  ## Agents driving agents
@@ -204,21 +204,40 @@ muse-cli goals # one goal: muse-cli goal <id>
204
204
  muse-cli ideas # one idea: muse-cli idea <id>
205
205
  muse-cli idea-exec <idea-id> # agent acts on the idea
206
206
 
207
+ muse-cli tasks # scheduled tasks (reminders, recurring jobs)
208
+ muse-cli task-runs --job <task-id> --limit 5 # recent runs, all tasks without --job
209
+ muse-cli task-run <task-id> # run a scheduled task now
210
+ muse-cli voices --gender F --accent British # voice catalog; also --search, --tone
211
+ muse-cli voice # the agent's current voice
212
+ muse-cli email # Muse Mail: mailbox + threads (--cursor for more)
213
+ muse-cli email-thread <thread-id> # messages in a thread; also email-message <id>
214
+ muse-cli email-attachment <message-id> 0 -o ./out # save attachment number 0
215
+ muse-cli peers # Trusted Network status and connected agents
216
+ muse-cli export-data -o ./out # download all your agent's data as a ZIP
217
+
207
218
  muse-cli session-start --title "trip planning" # new side chat
208
219
  muse-cli session-rename <id> "new title"
209
220
  muse-cli session-archive <id> # also: pin, unpin, unarchive, delete
210
221
  muse-cli seen <thread-id>
211
222
  muse-cli wake
212
- muse-cli raw <method> --body '{}' # escape hatch: any of 258 gateway methods
223
+ muse-cli raw <method> --body '{}' # escape hatch: any of 402 gateway methods
213
224
  ```
214
225
 
215
226
  The interactive chat prints plain text, one message per line, so it works well
216
227
  with screen readers. It resumes the conversation you used last; type `/help`
217
228
  inside it for `/chats`, `/open N`, `/main`, `/new`, `/history`, and `/login`.
229
+ Any command above can also be run with a leading slash (`/status`, `/goals`,
230
+ `/files`, etc.) with `<TAB>` auto-completion.
218
231
 
219
232
  Every other command prints JSON. Your VM is auto-discovered from your session, and a
220
233
  random device id is generated on first run.
221
234
 
235
+ Some features are rolled out per account. When yours does not have one, the
236
+ command exits with a gateway error that names it, for example
237
+ `email_not_enabled` for Muse Mail. `peers` reports when the Trusted Network is
238
+ turned off instead of failing. `export-data` streams the ZIP to disk (the
239
+ server picks the file name), so a large agent does not need the memory.
240
+
222
241
  Pipe it into other tools:
223
242
 
224
243
  ```bash
@@ -241,7 +260,7 @@ found during reverse engineering.
241
260
  |----------|-------------|
242
261
  | [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 |
243
262
  | [docs/PROTOCOL.md](https://github.com/nikships/muse-cli/blob/main/docs/PROTOCOL.md) | Gateway protocol reference: auth chain, Noise transport, framing, method quirks |
244
- | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 258 gateway methods with paths and services |
263
+ | [routes.json](https://github.com/nikships/muse-cli/blob/main/src/muse_cli/routes.json) | All 402 gateway methods with paths and services |
245
264
  | `muse-cli raw --help` | Escape hatch for calling any gateway method directly |
246
265
 
247
266
  ## Development
@@ -257,7 +276,7 @@ uv run python -m unittest discover -s tests # unit tests (no network)
257
276
  muse-cli/
258
277
  assets/ README artwork (generated with Muse Image)
259
278
  docs/PROTOCOL.md protocol reference for re-derivation
260
- scripts/ release version bump (used by CI)
279
+ scripts/ release version bump (used by CI), route table extractor
261
280
  site/ landing page (Firebase Hosting)
262
281
  skills/muse-cli/ agent skill
263
282
  src/muse_cli/
@@ -267,7 +286,7 @@ src/muse_cli/
267
286
  gateway.py gateway client (auth, Noise transport, subscriptions)
268
287
  update.py daily update notice and `muse-cli update`
269
288
  skill.py installs and refreshes the bundled agent skill
270
- routes.json 258 gateway methods extracted from the web client
289
+ routes.json 402 gateway methods extracted from the web client
271
290
  desc0.bin protobuf descriptors for the wire framing
272
291
  desc1.bin
273
292
  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
 
@@ -94,6 +96,60 @@ chat / feed / goals / ideas / sessions / ...
94
96
  - `api.idea-cards.execute`: `{ideaCardId, mode: "full"}` plus path param. A
95
97
  `session_id` in the body did not move the run into that side chat; the
96
98
  user message and the agent's reply landed in the main chat.
99
+ - **Re-deriving the method table:** `scripts/extract_routes.py` crawls the web
100
+ app and rewrites `routes.json`, `desc0.bin` and `desc1.bin`. Logged out,
101
+ every muse.ai page redirects to the marketing page (`?aymh_complete=1`),
102
+ whose ~50 chunks do not include the app. The script therefore loads `/`
103
+ with the saved cookies, then follows `static/chunks/*.js` references
104
+ (about 1300 chunks, all public). The route table is one array of
105
+ `{method,httpMethod,path,...}` literals; the descriptors are base64
106
+ `FileDescriptorProto` blobs (`noise_transport.proto`,
107
+ `noise_envelope.proto`). Route literals may carry `requestBody: "empty"`,
108
+ `requestTimeoutMs`, `responseIdleTimeoutMs` and `maxResponseBytes`
109
+ (numbers such as `12e4`, `0x2400000`, `1/0` for no limit).
110
+ - **How the web client builds a request:** GET routes fill `{path}` params
111
+ from the params object and send the rest as query; non-GET routes send the
112
+ whole params object (path params included) as the JSON body, except
113
+ `requestBody: "empty"` routes, which send no body and no content-type.
114
+ `Gateway` matches this. List filters are repeated query keys:
115
+ `voice.catalog?source=library&gender=F&gender=M` works.
116
+ - `Gateway.request()` with `timeout=None` uses the route's `requestTimeoutMs`
117
+ (30 s when absent); `raw` and `export-data` default to that.
118
+ - `tasks.list` returns `{schedules: [{id, title, mode, enabled,
119
+ schedule_key, next_run_at_utc (s), cadence, ...}], invalid}`;
120
+ `tasks.runs` takes `{limit, job_id?}` and returns `{runs: [{run_id,
121
+ job_id, status, trigger_reason, scheduled_for_utc, result_summary,
122
+ error_text}]}`. `tasks.run` is POST `/tasks/{job_id}/run` with body
123
+ `{job_id}`, and the web client treats it as an inference call like
124
+ `chat.stream`.
125
+ - `voice.catalog`: `{source: "library", query?, gender?: [F|M|N], accent?:
126
+ [..], tone?: [..], limit, offset}`; `voice.catalog_filters` lists the
127
+ values with counts. `voice.speak` (`{voice_id, text, format: "mp3",
128
+ stream: true}`, binary `audio/mpeg`) returned 404 `preview_audio_disabled`
129
+ on the test account.
130
+ - Muse Mail (`email.*`) answers 403 `{"code": "email_not_enabled"}` when the
131
+ account has no mailbox. Thread list: `{data: [{id, subject,
132
+ message_count, participants, last_message}], paging: {cursors: {after}}}`,
133
+ next page with `{cursor}`. Messages carry `header_from`,
134
+ `header_from_name`, `header_to`, `text_body`/`html_body`/`extracted_text`,
135
+ `sender_authentication.verdict`, `attachments[{index, filename, mime_type,
136
+ size}]`. `email.attachment.get` returns JSON with `content_base64` and
137
+ `metadata.mime_type`, not raw bytes.
138
+ - Trusted Network (`peers.*`, `grants.list`, `peerSpaces.*`): `peers.status`
139
+ always answers, with `availability` (`"disabled"` when off), `features`,
140
+ `limits` and the agent's `muse_id`. While it is off, the list calls return
141
+ 503 `peer_operation_unavailable` (`peers.connections.list`:
142
+ `connections_unavailable`). Page params are `{limit (1-100), cursor?}`.
143
+ - `dyi.export` (POST, empty body, ~65 min client timeout) streams the whole
144
+ data export as `application/zip` with `content-length` and a
145
+ `content-disposition` file name (`EYI Package_<date>_<n>.zip`). The test
146
+ account's export was 347 MB / 290 files in ~21 s. `export-data` writes the
147
+ body chunks straight to disk and checks type and length before keeping it.
148
+ - Services `ssh_access` (4, `ssh.operator.*`) and `yolk` (5,
149
+ `rv_migration.enable_export`) joined the `ServiceType` enum. Both are
150
+ operator/migration switches; muse-cli has no named commands for them.
151
+ - `vault.luks_status` returns 401 `request must come through nginx
152
+ auth_request` over the tunnel.
97
153
  - POSTs to muse.ai need browser `Sec-Fetch-*` headers or they return 403.
98
154
  - `auth export` on macOS decrypts the muse.ai rows of the browser's own cookie
99
155
  database (`~/Library/Application Support/<browser>/<profile>/{Network/,}Cookies`,
@@ -177,6 +177,15 @@ muse-cli goals # one goal: muse-cli goa
177
177
  muse-cli ideas # one idea: muse-cli idea <id>
178
178
  muse-cli unread
179
179
  muse-cli seen <thread-id>
180
+ muse-cli tasks # scheduled tasks (id, schedule, next_run)
181
+ muse-cli task-runs --job <task-id> --limit 5 # what recent runs did
182
+ muse-cli voices --search calm --limit 5 # voice catalog; --gender F|M|N --accent --tone
183
+ muse-cli voice # current voice
184
+ muse-cli email # Muse Mail mailbox + threads
185
+ muse-cli email-thread <thread-id> # also: email-message <id>
186
+ muse-cli email-attachment <message-id> <index> -o DIR
187
+ muse-cli peers # Trusted Network status / connected agents
188
+ muse-cli export-data -o DIR # full data export ZIP (can be hundreds of MB)
180
189
  ```
181
190
 
182
191
  Management (visible side effects, confirm with the user first when destructive):
@@ -184,6 +193,7 @@ Management (visible side effects, confirm with the user first when destructive):
184
193
  ```bash
185
194
  muse-cli feed-react <unit-id> love
186
195
  muse-cli idea-exec <idea-id> # the agent acts on the idea (real work)
196
+ muse-cli task-run <task-id> # runs a scheduled task now (real work)
187
197
  muse-cli session-start --title "x" # new side chat
188
198
  muse-cli session-rename <id> "title" # also: pin, unpin, archive, unarchive, delete
189
199
  muse-cli wake
@@ -191,7 +201,7 @@ muse-cli wake
191
201
 
192
202
  ## Escape hatch
193
203
 
194
- `muse-cli raw <method> --body '{...}' [--param k=v]` calls any of the 258
204
+ `muse-cli raw <method> --body '{...}' [--param k=v]` calls any of the 402
195
205
  gateway methods in `routes.json`. Prefer the named commands above; use raw
196
206
  only for methods with no wrapper.
197
207
 
@@ -209,6 +219,13 @@ only for methods with no wrapper.
209
219
  may be missing.
210
220
  - `idea-exec --thread` may be ignored by the server; the run can land in the
211
221
  main chat.
222
+ - Muse Mail, the Trusted Network (`peers`) and some other features are
223
+ enabled per account. `email` failing with `email_not_enabled` (exit 3) means
224
+ the account has no Muse Mail, not a broken install. `peers` prints
225
+ `availability: "disabled"` and a note when the Trusted Network is off.
226
+ - `export-data` writes the user's entire agent data (workspace, chats) to
227
+ disk. It takes about 20 s for a few hundred MB. Run it only when asked, and
228
+ keep the ZIP private.
212
229
  - Running `muse-cli` with no command opens the interactive chat and blocks on
213
230
  stdin. From an agent, always pass an explicit command such as `status` or
214
231
  `send`.
@@ -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.9"
3
+ __version__ = "0.3.11"
@@ -5,6 +5,7 @@ reader. Picks up the conversation you used last. Type /help for commands.
5
5
  """
6
6
  import json
7
7
  import os
8
+ import shlex
8
9
  import time
9
10
  # Enable GNU readline / libedit for line editing, history, and proper
10
11
  # CJK/wide-character deletion (wcwidth). It is a standard library C extension,
@@ -14,7 +15,7 @@ try:
14
15
  except ImportError:
15
16
  readline = None
16
17
 
17
- from .cli import CONFIG_DIR, cmd_auth_export, connect, fmt_event, load_config, start_session
18
+ from .cli import CONFIG_DIR, build_parser, cmd_auth_export, connect, fmt_event, load_config, start_session
18
19
  from .gateway import AuthError, GatewayError
19
20
 
20
21
  WAIT = 300 # seconds to wait for the first reply
@@ -30,6 +31,7 @@ HELP = """Commands:
30
31
  /new [title] start a new conversation
31
32
  /history [N] read the last N messages here (default 10)
32
33
  /login save your muse.ai login from Chrome again (same as `muse-cli auth export`)
34
+ /<command> run any muse-cli command (/status, /goals, /ideas, /files, etc.)
33
35
  /exit quit (Ctrl+C works too)"""
34
36
 
35
37
 
@@ -58,6 +60,31 @@ class Chat:
58
60
  self.st = load_state()
59
61
  self.gw = connect(self.cfg)
60
62
  self.listing = []
63
+ self.parser = build_parser()
64
+ if readline is not None:
65
+ sub_actions = [a for a in self.parser._actions if a.dest == "cmd"]
66
+ choices = [k for k in sub_actions[0].choices if k != "chat"] if sub_actions else []
67
+ repl_cmds = ["chats", "open", "main", "new", "history", "login", "help", "exit", "quit"]
68
+ all_cmds = sorted(set(f"/{c}" for c in repl_cmds + choices))
69
+
70
+ def complete(text, state):
71
+ line = (readline.get_line_buffer().lstrip() if hasattr(readline, "get_line_buffer") else "") or text
72
+ if " " not in line and line.startswith("/"):
73
+ matches = [c for c in all_cmds if c.startswith(text)]
74
+ return matches[state] if state < len(matches) else None
75
+ return None
76
+
77
+ self.complete = complete
78
+ try:
79
+ delims = readline.get_completer_delims().replace("/", "").replace("-", "")
80
+ readline.set_completer_delims(delims)
81
+ except Exception:
82
+ pass
83
+ readline.set_completer(complete)
84
+ if "libedit" in (readline.__doc__ or ""):
85
+ readline.parse_and_bind("bind ^I rl_complete")
86
+ else:
87
+ readline.parse_and_bind("tab: complete")
61
88
 
62
89
  def scope(self):
63
90
  return {"session_id": self.st["session_id"]} if self.st["session_id"] else {}
@@ -175,6 +202,40 @@ class Chat:
175
202
  self.gw.close()
176
203
  self.gw = connect(self.cfg)
177
204
 
205
+ def run_cli(self, line):
206
+ try:
207
+ tokens = shlex.split(line.lstrip("/"))
208
+ except ValueError as e:
209
+ print(f"Error parsing command: {e}")
210
+ return True
211
+ if not tokens:
212
+ return False
213
+ if tokens[0] in ("chat", "exit", "quit"):
214
+ if tokens[0] == "chat":
215
+ print("Already in chat.")
216
+ return True
217
+ return False
218
+
219
+ sub_actions = [a for a in self.parser._actions if a.dest == "cmd"]
220
+ choices = sub_actions[0].choices if sub_actions else {}
221
+ if tokens[0] not in choices:
222
+ return False
223
+
224
+ try:
225
+ args = self.parser.parse_args(tokens)
226
+ except SystemExit:
227
+ return True
228
+
229
+ if getattr(args, "fn", None):
230
+ if hasattr(args, "thread") and args.thread is None and self.st.get("session_id"):
231
+ args.thread = self.st["session_id"]
232
+ try:
233
+ args.fn(args)
234
+ except (SystemExit, KeyboardInterrupt):
235
+ print() # command stopped or exited; stay in the chat
236
+ return True
237
+ return False
238
+
178
239
  def handle(self, line):
179
240
  cmd, _, arg = line.partition(" ")
180
241
  arg = arg.strip()
@@ -188,12 +249,14 @@ class Chat:
188
249
  self.switch(None, "main chat")
189
250
  elif cmd == "/new":
190
251
  self.new_chat(arg)
191
- elif cmd == "/history":
252
+ elif cmd == "/history" and (not arg or arg.isdigit()):
192
253
  self.show_history(int(arg) if arg.isdigit() else 10)
193
254
  elif cmd == "/login":
194
255
  if login():
195
256
  self.reconnect()
196
257
  print("Signed in.")
258
+ elif self.run_cli(line):
259
+ pass
197
260
  else:
198
261
  print("Unknown command. Type /help.")
199
262