muse-cli 0.3.15__tar.gz → 0.3.16__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.15 → muse_cli-0.3.16}/PKG-INFO +27 -9
  2. {muse_cli-0.3.15 → muse_cli-0.3.16}/README.md +26 -8
  3. {muse_cli-0.3.15 → muse_cli-0.3.16}/docs/PROTOCOL.md +8 -1
  4. {muse_cli-0.3.15 → muse_cli-0.3.16}/skills/muse-cli/SKILL.md +8 -1
  5. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/__init__.py +1 -1
  6. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/browsers.py +83 -12
  7. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/cli.py +21 -17
  8. {muse_cli-0.3.15 → muse_cli-0.3.16}/.gitignore +0 -0
  9. {muse_cli-0.3.15 → muse_cli-0.3.16}/LICENSE +0 -0
  10. {muse_cli-0.3.15 → muse_cli-0.3.16}/docs/TUI.md +0 -0
  11. {muse_cli-0.3.15 → muse_cli-0.3.16}/pyproject.toml +0 -0
  12. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/__main__.py +0 -0
  13. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/bridge.py +0 -0
  14. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/chat.py +0 -0
  15. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/demo.py +0 -0
  16. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/desc0.bin +0 -0
  17. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/desc1.bin +0 -0
  18. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/gateway.py +0 -0
  19. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/routes.json +0 -0
  20. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/skill.py +0 -0
  21. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/bun.lock +0 -0
  22. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/package.json +0 -0
  23. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/app.tsx +0 -0
  24. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/bridge.ts +0 -0
  25. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Composer.tsx +0 -0
  26. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Header.tsx +0 -0
  27. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Overlays.tsx +0 -0
  28. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Panels.tsx +0 -0
  29. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Sidebar.tsx +0 -0
  30. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Splash.tsx +0 -0
  31. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/Transcript.tsx +0 -0
  32. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/components/common.tsx +0 -0
  33. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/context.tsx +0 -0
  34. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/controller.ts +0 -0
  35. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/format.ts +0 -0
  36. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/main.tsx +0 -0
  37. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/protocol.ts +0 -0
  38. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/store.ts +0 -0
  39. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/src/theme.ts +0 -0
  40. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/test/app.test.tsx +0 -0
  41. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/test/fake.ts +0 -0
  42. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/test/logic.test.ts +0 -0
  43. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui/tsconfig.json +0 -0
  44. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/tui.py +0 -0
  45. {muse_cli-0.3.15 → muse_cli-0.3.16}/src/muse_cli/update.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: muse-cli
3
- Version: 0.3.15
3
+ Version: 0.3.16
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
@@ -99,6 +99,22 @@ read it), and after that talks to muse.ai directly. Access tokens are reused
99
99
  for up to 15 minutes (`tokens.json`, mode `600`), so commands start fast. When a command later says the cookies expired, repeat
100
100
  this section.
101
101
 
102
+ ### Easiest, on any system: Firefox
103
+
104
+ 1. Log in at https://muse.ai/ in Firefox.
105
+ 2. Run:
106
+
107
+ ```bash
108
+ muse-cli auth export
109
+ muse-cli status
110
+ ```
111
+
112
+ Firefox keeps cookies unencrypted, so nothing else is needed: no Node.js, no
113
+ debugging port, no keychain prompt, and Firefox can stay open. Success looks
114
+ like `saved 10 muse.ai cookies to ... (from firefox (abc123.default-release))`.
115
+ Every Firefox profile is checked and the newest login wins. Container tabs and
116
+ private windows are not read. Force this route with `--browser firefox`.
117
+
102
118
  ### On a Mac (Chrome, Brave, Arc, Edge or Chromium)
103
119
 
104
120
  1. Log in at https://muse.ai/ in your browser.
@@ -132,10 +148,11 @@ disk as it was. `muse-cli status` then prints JSON with your VM id, how many
132
148
  chats you have, the unread count, and your identity. That means install and
133
149
  login both worked.
134
150
 
135
- ### Linux, Windows, or Safari: agent-browser or by hand
151
+ ### Chrome on Linux or Windows, or Safari: agent-browser or by hand
136
152
 
137
- Direct reading is macOS-only and covers Chromium browsers, not Safari.
138
- Elsewhere (or with `muse-cli auth export --browser agent-browser`) the login
153
+ Direct reading of Chromium browsers is macOS-only (Windows Chrome uses
154
+ app-bound encryption), and Safari is not supported. Without a Firefox login
155
+ (or with `muse-cli auth export --browser agent-browser`) the login
139
156
  is read from a running Google Chrome through [agent-browser](https://github.com/vercel-labs/agent-browser).
140
157
  Do the steps in order. Each one checks itself before you continue.
141
158
 
@@ -224,7 +241,7 @@ muse-cli status
224
241
  muse-cli # full-screen app on a terminal with Bun, else the plain chat
225
242
  muse-cli tui # the full-screen app (`--demo`: made-up data, no account)
226
243
  muse-cli chat # plain line-by-line chat
227
- muse-cli auth export --browser auto # import the browser login (macOS: direct read)
244
+ muse-cli auth export --browser auto # import the browser login (Firefox anywhere, Chromium on macOS)
228
245
  muse-cli threads # main chat + side chats
229
246
  muse-cli history --limit 5 # recent messages
230
247
  muse-cli history --thread <session-id> --limit 5 # one side chat
@@ -355,7 +372,7 @@ src/muse_cli/
355
372
  tui/ the full-screen app: TypeScript on OpenTUI and Bun
356
373
  bridge.py JSON-lines bridge the app talks to muse.ai through
357
374
  demo.py made-up data for `muse-cli tui --demo`
358
- browsers.py reads the muse.ai login from Chromium browsers on macOS
375
+ browsers.py reads the muse.ai login from Firefox, or Chromium browsers on macOS
359
376
  gateway.py gateway client (auth, Noise transport, subscriptions)
360
377
  update.py daily update notice and `muse-cli update`
361
378
  skill.py installs and refreshes the bundled agent skill
@@ -375,9 +392,10 @@ release flow and contributor notes. Merging to `main` publishes a release.
375
392
  - Login is the [Log in once](#log-in-once) section above. Cookies live at
376
393
  `~/.config/muse-cli/cookies.txt` (mode 600). Access and gateway tokens are
377
394
  cached in `tokens.json` (mode 600) for 15 minutes and refetched when refused.
378
- - On macOS, `auth export` decrypts the muse.ai cookies from the browser's own
379
- cookie file, using the browser's Safe Storage key from your login keychain.
380
- Elsewhere it reads Google Chrome through
395
+ - On every system, `auth export` reads Firefox's `cookies.sqlite`, which holds
396
+ plain values. On macOS it first decrypts the muse.ai cookies from Chromium
397
+ browsers' cookie files, using the browser's Safe Storage key from your login
398
+ keychain. Without either login it reads Google Chrome through
381
399
  [agent-browser](https://github.com/vercel-labs/agent-browser), which needs
382
400
  Chrome open with remote debugging on (`chrome://inspect/#remote-debugging`)
383
401
  and a logged-in muse.ai tab in front.
@@ -62,6 +62,22 @@ read it), and after that talks to muse.ai directly. Access tokens are reused
62
62
  for up to 15 minutes (`tokens.json`, mode `600`), so commands start fast. When a command later says the cookies expired, repeat
63
63
  this section.
64
64
 
65
+ ### Easiest, on any system: Firefox
66
+
67
+ 1. Log in at https://muse.ai/ in Firefox.
68
+ 2. Run:
69
+
70
+ ```bash
71
+ muse-cli auth export
72
+ muse-cli status
73
+ ```
74
+
75
+ Firefox keeps cookies unencrypted, so nothing else is needed: no Node.js, no
76
+ debugging port, no keychain prompt, and Firefox can stay open. Success looks
77
+ like `saved 10 muse.ai cookies to ... (from firefox (abc123.default-release))`.
78
+ Every Firefox profile is checked and the newest login wins. Container tabs and
79
+ private windows are not read. Force this route with `--browser firefox`.
80
+
65
81
  ### On a Mac (Chrome, Brave, Arc, Edge or Chromium)
66
82
 
67
83
  1. Log in at https://muse.ai/ in your browser.
@@ -95,10 +111,11 @@ disk as it was. `muse-cli status` then prints JSON with your VM id, how many
95
111
  chats you have, the unread count, and your identity. That means install and
96
112
  login both worked.
97
113
 
98
- ### Linux, Windows, or Safari: agent-browser or by hand
114
+ ### Chrome on Linux or Windows, or Safari: agent-browser or by hand
99
115
 
100
- Direct reading is macOS-only and covers Chromium browsers, not Safari.
101
- Elsewhere (or with `muse-cli auth export --browser agent-browser`) the login
116
+ Direct reading of Chromium browsers is macOS-only (Windows Chrome uses
117
+ app-bound encryption), and Safari is not supported. Without a Firefox login
118
+ (or with `muse-cli auth export --browser agent-browser`) the login
102
119
  is read from a running Google Chrome through [agent-browser](https://github.com/vercel-labs/agent-browser).
103
120
  Do the steps in order. Each one checks itself before you continue.
104
121
 
@@ -187,7 +204,7 @@ muse-cli status
187
204
  muse-cli # full-screen app on a terminal with Bun, else the plain chat
188
205
  muse-cli tui # the full-screen app (`--demo`: made-up data, no account)
189
206
  muse-cli chat # plain line-by-line chat
190
- muse-cli auth export --browser auto # import the browser login (macOS: direct read)
207
+ muse-cli auth export --browser auto # import the browser login (Firefox anywhere, Chromium on macOS)
191
208
  muse-cli threads # main chat + side chats
192
209
  muse-cli history --limit 5 # recent messages
193
210
  muse-cli history --thread <session-id> --limit 5 # one side chat
@@ -318,7 +335,7 @@ src/muse_cli/
318
335
  tui/ the full-screen app: TypeScript on OpenTUI and Bun
319
336
  bridge.py JSON-lines bridge the app talks to muse.ai through
320
337
  demo.py made-up data for `muse-cli tui --demo`
321
- browsers.py reads the muse.ai login from Chromium browsers on macOS
338
+ browsers.py reads the muse.ai login from Firefox, or Chromium browsers on macOS
322
339
  gateway.py gateway client (auth, Noise transport, subscriptions)
323
340
  update.py daily update notice and `muse-cli update`
324
341
  skill.py installs and refreshes the bundled agent skill
@@ -338,9 +355,10 @@ release flow and contributor notes. Merging to `main` publishes a release.
338
355
  - Login is the [Log in once](#log-in-once) section above. Cookies live at
339
356
  `~/.config/muse-cli/cookies.txt` (mode 600). Access and gateway tokens are
340
357
  cached in `tokens.json` (mode 600) for 15 minutes and refetched when refused.
341
- - On macOS, `auth export` decrypts the muse.ai cookies from the browser's own
342
- cookie file, using the browser's Safe Storage key from your login keychain.
343
- Elsewhere it reads Google Chrome through
358
+ - On every system, `auth export` reads Firefox's `cookies.sqlite`, which holds
359
+ plain values. On macOS it first decrypts the muse.ai cookies from Chromium
360
+ browsers' cookie files, using the browser's Safe Storage key from your login
361
+ keychain. Without either login it reads Google Chrome through
344
362
  [agent-browser](https://github.com/vercel-labs/agent-browser), which needs
345
363
  Chrome open with remote debugging on (`chrome://inspect/#remote-debugging`)
346
364
  and a logged-in muse.ai tab in front.
@@ -194,7 +194,14 @@ chat / feed / goals / ideas / sessions / ...
194
194
  keys and keychain failures per browser to avoid repeated prompts.
195
195
  Select only host keys `muse.ai` and `.muse.ai`: subdomain-only cookies are
196
196
  not valid for the CLI's requests to `https://muse.ai/api/`.
197
- - Elsewhere (and with `--browser agent-browser`) `auth export` reads cookies
197
+ - `auth export` reads Firefox on every system (after Chromium on macOS):
198
+ `<profiles root>/*/cookies.sqlite`, table `moz_cookies`, plain `value`,
199
+ host `muse.ai`/`.muse.ai`, `originAttributes = ''` (default container).
200
+ `expiry` is milliseconds in current Firefox, seconds in older releases.
201
+ Roots: `%APPDATA%\Mozilla\Firefox\Profiles`, `~/Library/Application
202
+ Support/Firefox/Profiles`, `~/.mozilla/firefox` (plus snap and flatpak).
203
+ The newest unexpired `hatch_sess` across profiles wins.
204
+ - Without those (and with `--browser agent-browser`) `auth export` reads cookies
198
205
  from the user's own Google Chrome through agent-browser `--auto-connect`.
199
206
  Chrome 144+ shares that profile only after remote debugging is enabled at
200
207
  `chrome://inspect/#remote-debugging`. That export follows the active tab, so
@@ -39,6 +39,12 @@ The CLI stores the user's muse.ai browser login at
39
39
  cached for 15 minutes in `tokens.json` (mode 0600) and refetched when refused. When a later command fails
40
40
  with `auth error`, the cookies expired: repeat this step.
41
41
 
42
+ Easiest on any system: if the user uses Firefox, ask them to log in at
43
+ https://muse.ai/ there and confirm, then run `muse-cli auth export` (no
44
+ prompt, no Node.js; Firefox may stay open). Success ends with
45
+ `(from firefox (<profile>))`. Force it with `--browser firefox`. Plain
46
+ `auth export` already tries Firefox, after Chromium browsers on macOS.
47
+
42
48
  ### 2a. macOS: read the browser directly (try this first)
43
49
 
44
50
  Needs no Node.js and no debugging port. The user must be logged in at
@@ -69,7 +75,8 @@ cookie values are never printed; do not print the cookies file either.
69
75
  - Only cookies valid for `muse.ai` are exported, not subdomain-only cookies.
70
76
  - `cookie database changed while reading ...`: close that browser and rerun
71
77
  once. The command retries a changing database at most three times.
72
- - On Linux or Windows, or if the Mac route is not possible, use 2b.
78
+ - On Linux or Windows without a Firefox login, or if the Mac route is not
79
+ possible, use 2b.
73
80
 
74
81
  ### 2b. Other systems: cookie reader (agent-browser)
75
82
 
@@ -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.15"
3
+ __version__ = "0.3.16"
@@ -1,11 +1,17 @@
1
- """Read the muse.ai login straight from a Chromium browser's cookie store on macOS.
1
+ """Read the muse.ai login straight from a browser's cookie store.
2
2
 
3
- Chromium keeps cookies in a SQLite file. Values are AES-128-CBC encrypted with
4
- a key derived from the browser's "Safe Storage" password in the login
5
- keychain, so macOS asks the user once before `security` may read it. Nothing
6
- here needs Node.js or a debugging port, and the browser can stay closed.
3
+ Firefox, on every system: cookies.sqlite holds plain values, so nothing needs
4
+ decrypting.
5
+
6
+ Chromium browsers, macOS only: values are AES-128-CBC encrypted with a key
7
+ derived from the browser's "Safe Storage" password in the login keychain, so
8
+ macOS asks the user once before `security` may read it. (Windows Chromium uses
9
+ app-bound encryption that only the browser itself can undo.)
10
+
11
+ Nothing here needs Node.js or a debugging port, and the browser can stay closed.
7
12
  """
8
13
  import ctypes
14
+ import glob
9
15
  import hashlib
10
16
  import os
11
17
  import shutil
@@ -28,6 +34,12 @@ BROWSERS = {
28
34
 
29
35
  KEYCHAIN_WAIT = 120 # seconds; macOS shows an Allow dialog the first time
30
36
 
37
+ CHROMIUM_SQL = ("SELECT host_key, name, path, is_secure, expires_utc, value, encrypted_value "
38
+ "FROM cookies WHERE host_key IN ('muse.ai', '.muse.ai')")
39
+ # Default container only: container tabs keep a second copy of each cookie.
40
+ FIREFOX_SQL = ("SELECT host, name, path, isSecure, expiry, value FROM moz_cookies "
41
+ "WHERE host IN ('muse.ai', '.muse.ai') AND originAttributes = ''")
42
+
31
43
 
32
44
  class BrowserCookieError(RuntimeError):
33
45
  pass
@@ -72,8 +84,53 @@ def _file_stamp(path):
72
84
  return s.st_ino, s.st_size, s.st_mtime_ns, s.st_ctime_ns
73
85
 
74
86
 
75
- def _muse_rows(path):
76
- """Encrypted muse.ai rows from a copy of the database (the browser locks the original)."""
87
+ def firefox_roots():
88
+ """Directories that hold Firefox profile folders on this system."""
89
+ if sys.platform == "win32":
90
+ return [os.path.join(os.environ.get("APPDATA", ""), "Mozilla", "Firefox", "Profiles")]
91
+ if sys.platform == "darwin":
92
+ return [os.path.join(SUPPORT, "Firefox", "Profiles")]
93
+ home = os.path.expanduser("~")
94
+ return [os.path.join(home, rel) for rel in (
95
+ ".mozilla/firefox", "snap/firefox/common/.mozilla/firefox",
96
+ ".var/app/org.mozilla.firefox/.mozilla/firefox")]
97
+
98
+
99
+ def _firefox_expires(expiry):
100
+ # Newer Firefox stores milliseconds, older seconds; 0 marks a session cookie.
101
+ return int(expiry / 1000 if expiry > 1e11 else expiry or 0)
102
+
103
+
104
+ def read_firefox_cookies():
105
+ """(jar, source) from the Firefox profile with the newest muse.ai login."""
106
+ paths = sorted(p for root in firefox_roots()
107
+ for p in glob.glob(os.path.join(glob.escape(root), "*", "cookies.sqlite")))
108
+ if not paths:
109
+ raise BrowserCookieError("no Firefox profile found")
110
+ now = time.time()
111
+ best, errors = None, []
112
+ for path in paths:
113
+ try:
114
+ rows = _muse_rows(path, FIREFOX_SQL)
115
+ except BrowserCookieError as e:
116
+ errors.append(str(e))
117
+ continue
118
+ jar = [{"name": name, "domain": host, "path": cpath or "/", "secure": bool(secure),
119
+ "expires": _firefox_expires(expiry), "value": value or ""}
120
+ for host, name, cpath, secure, expiry, value in rows]
121
+ jar = [c for c in jar if not c["expires"] or c["expires"] > now]
122
+ sess = [c["expires"] or float("inf") for c in jar if c["name"] == "hatch_sess" and c["value"]]
123
+ if sess and (best is None or max(sess) > best[0]):
124
+ best = (max(sess), jar, path)
125
+ if best:
126
+ return best[1], f"firefox ({os.path.basename(os.path.dirname(best[2]))})"
127
+ if errors:
128
+ raise BrowserCookieError("; ".join(errors))
129
+ raise BrowserCookieError("no muse.ai login (hatch_sess) in Firefox")
130
+
131
+
132
+ def _muse_rows(path, sql=CHROMIUM_SQL):
133
+ """muse.ai rows from a copy of the database (the browser locks the original)."""
77
134
  paths = [path, path + "-wal", path + "-journal"]
78
135
  try:
79
136
  for _ in range(3):
@@ -92,9 +149,7 @@ def _muse_rows(path):
92
149
  continue
93
150
  db = sqlite3.connect(copy)
94
151
  try:
95
- return db.execute(
96
- "SELECT host_key, name, path, is_secure, expires_utc, value, encrypted_value "
97
- "FROM cookies WHERE host_key IN ('muse.ai', '.muse.ai')").fetchall()
152
+ return db.execute(sql).fetchall()
98
153
  finally:
99
154
  db.close()
100
155
  except (OSError, sqlite3.Error) as e:
@@ -156,10 +211,26 @@ def read_cookies(browser="auto", key_for=_safe_storage_key, decrypt=_aes_cbc_dec
156
211
  jar entries match what `auth export` writes: name, value, domain, path,
157
212
  secure, expires. The keychain is asked only once a profile with an
158
213
  unexpired `hatch_sess` row is found, so a browser without a muse.ai login never
159
- triggers a prompt. Raises BrowserCookieError with a reason otherwise.
214
+ triggers a prompt. `auto` tries Chromium browsers first on macOS, then
215
+ Firefox. Raises BrowserCookieError with a reason otherwise.
160
216
  """
217
+ if browser == "firefox" or (browser == "auto" and not supported()):
218
+ return read_firefox_cookies()
161
219
  if not supported():
162
- raise BrowserCookieError("reading browser cookies directly is macOS-only")
220
+ raise BrowserCookieError("reading Chromium browsers directly is macOS-only; "
221
+ "use --browser firefox or agent-browser")
222
+ try:
223
+ return _read_chromium(browser, key_for, decrypt)
224
+ except BrowserCookieError as e:
225
+ if browser != "auto":
226
+ raise
227
+ try:
228
+ return read_firefox_cookies()
229
+ except BrowserCookieError as ff:
230
+ raise BrowserCookieError(f"{e}; {ff}") from None
231
+
232
+
233
+ def _read_chromium(browser, key_for, decrypt):
163
234
  names = None if browser == "auto" else [browser]
164
235
  stores = cookie_stores(names)
165
236
  if not stores:
@@ -325,9 +325,14 @@ def _browser_cookies():
325
325
  def _print_need_browser_login(err):
326
326
  print(f"Could not read a muse.ai login from your browser: {err}", file=sys.stderr)
327
327
  print(file=sys.stderr)
328
- print("Log in at https://muse.ai/ in Chrome, Brave, Arc or Edge, then run", file=sys.stderr)
329
- print("`muse-cli auth export` again. macOS may ask to let `security` use", file=sys.stderr)
330
- print("the browser's Safe Storage key; click Allow.", file=sys.stderr)
328
+ if browsers.supported():
329
+ print("Log in at https://muse.ai/ in Firefox, Chrome, Brave, Arc or Edge, then run", file=sys.stderr)
330
+ print("`muse-cli auth export` again. macOS may ask to let `security` use", file=sys.stderr)
331
+ print("the browser's Safe Storage key; click Allow.", file=sys.stderr)
332
+ else:
333
+ print("Log in at https://muse.ai/ in Firefox, then run `muse-cli auth export` again.",
334
+ file=sys.stderr)
335
+ print("Firefox can stay open, and nothing else needs installing.", file=sys.stderr)
331
336
  print(file=sys.stderr)
332
337
  _print_hand_copy()
333
338
 
@@ -336,7 +341,7 @@ def cmd_auth_export(args):
336
341
  os.makedirs(CONFIG_DIR, exist_ok=True)
337
342
  choice = getattr(args, "browser", None) or "auto"
338
343
  jar, source = None, "Chrome"
339
- if choice != "agent-browser" and browsers.supported():
344
+ if choice != "agent-browser":
340
345
  print("Reading muse.ai cookies from your browser...", file=sys.stderr)
341
346
  try:
342
347
  jar, source = browsers.read_cookies(choice)
@@ -348,10 +353,6 @@ def cmd_auth_export(args):
348
353
  _print_need_browser_login(e)
349
354
  sys.exit(1)
350
355
  print(f"({e}; trying agent-browser)", file=sys.stderr)
351
- elif choice not in ("auto", "agent-browser"):
352
- print("cookie export failed: reading browser cookies directly is macOS-only; "
353
- "use --browser agent-browser", file=sys.stderr)
354
- sys.exit(1)
355
356
  if jar is None:
356
357
  if shutil.which("agent-browser") is None:
357
358
  _print_need_agent_browser()
@@ -1218,16 +1219,19 @@ def build_parser():
1218
1219
  "Copy your muse.ai login out of your browser into\n"
1219
1220
  "~/.config/muse-cli/cookies.txt (mode 600).\n"
1220
1221
  "\n"
1221
- "On macOS it reads the cookies of Chrome, Brave, Arc, Edge or Chromium\n"
1222
- "directly: log in at https://muse.ai/ once, then run this command.\n"
1223
- "macOS asks once to let `security` use the browser's Safe Storage key;\n"
1224
- "click Allow. No Node.js or debugging port is needed, and the browser\n"
1225
- "can be closed.\n"
1222
+ "Easiest on every system: log in at https://muse.ai/ in Firefox, then run\n"
1223
+ "this command. Nothing else needs installing, and Firefox can stay open.\n"
1224
+ "\n"
1225
+ "On macOS it also reads Chrome, Brave, Arc, Edge or Chromium directly\n"
1226
+ "(tried before Firefox). macOS asks once to let `security` use the\n"
1227
+ "browser's Safe Storage key; click Allow. No Node.js or debugging port\n"
1228
+ "is needed, and the browser can be closed.\n"
1226
1229
  "Unreadable profiles are skipped if another has a usable login.\n"
1227
1230
  "Subdomain-only cookies are not exported.\n"
1228
1231
  "Empty or expired login cookies never replace a saved login.\n"
1229
1232
  "\n"
1230
- "Elsewhere, or with --browser agent-browser, it reads Google Chrome through\n"
1233
+ "Without a Firefox login (and on macOS no Chromium one), or with\n"
1234
+ "--browser agent-browser, it reads Google Chrome through\n"
1231
1235
  "agent-browser. Chrome shares those cookies only after remote debugging is on.\n"
1232
1236
  "In the Chrome window you already use for muse.ai:\n"
1233
1237
  "\n"
@@ -1251,9 +1255,9 @@ def build_parser():
1251
1255
  formatter_class=argparse.RawDescriptionHelpFormatter,
1252
1256
  )
1253
1257
  p.add_argument("--browser", default="auto",
1254
- choices=["auto", *browsers.BROWSERS, "agent-browser"],
1255
- help="where to read the login (default: auto = any logged-in "
1256
- "Chromium browser on macOS, else agent-browser)")
1258
+ choices=["auto", "firefox", *browsers.BROWSERS, "agent-browser"],
1259
+ help="where to read the login (default: auto = Chromium browsers "
1260
+ "on macOS, then Firefox, then agent-browser)")
1257
1261
  p.set_defaults(fn=cmd_auth_export)
1258
1262
 
1259
1263
  sub.add_parser("chat", help="plain line-by-line chat (the default with no command "
File without changes
File without changes
File without changes
File without changes
File without changes