muse-cli 0.3.17__tar.gz → 0.3.18__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.
- {muse_cli-0.3.17 → muse_cli-0.3.18}/PKG-INFO +4 -2
- {muse_cli-0.3.17 → muse_cli-0.3.18}/README.md +3 -1
- {muse_cli-0.3.17 → muse_cli-0.3.18}/docs/PROTOCOL.md +3 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/skills/muse-cli/SKILL.md +5 -2
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/__init__.py +1 -1
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/cli.py +13 -6
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/gateway.py +40 -7
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Splash.tsx +9 -4
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/main.tsx +12 -1
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui.py +8 -2
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/update.py +10 -5
- {muse_cli-0.3.17 → muse_cli-0.3.18}/.gitignore +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/LICENSE +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/docs/TUI.md +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/pyproject.toml +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/__main__.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/bridge.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/browsers.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/chat.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/demo.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/desc0.bin +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/desc1.bin +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/routes.json +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/skill.py +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/bun.lock +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/package.json +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/app.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/bridge.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Composer.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Header.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Overlays.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Panels.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Sidebar.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/Transcript.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/components/common.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/context.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/controller.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/format.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/protocol.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/store.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/src/theme.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/test/app.test.tsx +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/test/fake.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/test/logic.test.ts +0 -0
- {muse_cli-0.3.17 → muse_cli-0.3.18}/src/muse_cli/tui/tsconfig.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: muse-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.18
|
|
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
|
|
@@ -85,7 +85,7 @@ to `~/.agents/skills/muse-cli`:
|
|
|
85
85
|
curl -fsSL https://raw.githubusercontent.com/nikships/muse-cli/main/install.sh | bash
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
Upgrade with `muse-cli update`. It also refreshes the agent skill if you installed one (the skill ships inside the package, so it always matches the CLI). `muse-cli update --skill` refreshes or installs just the skill, with no package upgrade, which is handy after `pip` or `pipx` installs. In a terminal it
|
|
88
|
+
Upgrade with `muse-cli update`. It also refreshes the agent skill if you installed one (the skill ships inside the package, so it always matches the CLI). `muse-cli update --skill` refreshes or installs just the skill, with no package upgrade, which is handy after `pip` or `pipx` installs. In a terminal it checks PyPI once a day and shows newer releases in the full-screen app and on stderr. It does not upgrade itself. Set `MUSE_NO_UPDATE_CHECK=1` to silence the notice. The check stays quiet when output is piped or `CI` is set. Remove with `uv tool uninstall muse-cli`.
|
|
89
89
|
|
|
90
90
|
Logging in is a separate one-time step. On a Mac it is one command, run after
|
|
91
91
|
you have logged in at https://muse.ai/ in your browser. Follow
|
|
@@ -99,6 +99,8 @@ 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
|
+
If the full-screen app can't connect, press **R** to retry or **L** to read your browser login again. A gateway 502, 503, or 504 is retried automatically and does not mean you were signed out.
|
|
103
|
+
|
|
102
104
|
### Easiest, on any system: Firefox
|
|
103
105
|
|
|
104
106
|
1. Log in at https://muse.ai/ in Firefox.
|
|
@@ -48,7 +48,7 @@ to `~/.agents/skills/muse-cli`:
|
|
|
48
48
|
curl -fsSL https://raw.githubusercontent.com/nikships/muse-cli/main/install.sh | bash
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
Upgrade with `muse-cli update`. It also refreshes the agent skill if you installed one (the skill ships inside the package, so it always matches the CLI). `muse-cli update --skill` refreshes or installs just the skill, with no package upgrade, which is handy after `pip` or `pipx` installs. In a terminal it
|
|
51
|
+
Upgrade with `muse-cli update`. It also refreshes the agent skill if you installed one (the skill ships inside the package, so it always matches the CLI). `muse-cli update --skill` refreshes or installs just the skill, with no package upgrade, which is handy after `pip` or `pipx` installs. In a terminal it checks PyPI once a day and shows newer releases in the full-screen app and on stderr. It does not upgrade itself. Set `MUSE_NO_UPDATE_CHECK=1` to silence the notice. The check stays quiet when output is piped or `CI` is set. Remove with `uv tool uninstall muse-cli`.
|
|
52
52
|
|
|
53
53
|
Logging in is a separate one-time step. On a Mac it is one command, run after
|
|
54
54
|
you have logged in at https://muse.ai/ in your browser. Follow
|
|
@@ -62,6 +62,8 @@ 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
|
+
If the full-screen app can't connect, press **R** to retry or **L** to read your browser login again. A gateway 502, 503, or 504 is retried automatically and does not mean you were signed out.
|
|
66
|
+
|
|
65
67
|
### Easiest, on any system: Firefox
|
|
66
68
|
|
|
67
69
|
1. Log in at https://muse.ai/ in Firefox.
|
|
@@ -29,6 +29,9 @@ chat / feed / goals / ideas / sessions / ...
|
|
|
29
29
|
- **Gateway host:** the shared `hatch.metaaivm.com`, not the per-VM hostname.
|
|
30
30
|
Plain TLS to the per-VM host is reset at the edge; a Chrome fingerprint
|
|
31
31
|
(curl_cffi `impersonate="chrome"`) is required.
|
|
32
|
+
- **WebSocket upgrade:** the shared gateway can return HTTP 502 even when both
|
|
33
|
+
auth endpoints accept the login. Retry 502, 503 and 504 before starting Noise,
|
|
34
|
+
without discarding the cached login or replaying an application request.
|
|
32
35
|
- **Handshake:** standard Noise XX. This account negotiates standard mode
|
|
33
36
|
(empty msg3). An attested/RV mode with SNP attestation and HMAC proofs
|
|
34
37
|
exists in the client for other configurations.
|
|
@@ -245,10 +245,13 @@ only for methods with no wrapper.
|
|
|
245
245
|
- The gateway API is unversioned. Whole classes of calls failing at once means
|
|
246
246
|
the protocol drifted: see `docs/PROTOCOL.md` for the re-derivation notes,
|
|
247
247
|
don't guess at crypto or framing.
|
|
248
|
+
- A WebSocket upgrade HTTP 502, 503, or 504 is retried automatically. It is
|
|
249
|
+
not an expired login. In the full-screen app, press R to retry or L to read
|
|
250
|
+
the browser login again if needed.
|
|
248
251
|
- Respect rate limits. Writes (send, react, execute, session ops) act as the
|
|
249
252
|
user in their agent: announce them before running, never loop them.
|
|
250
253
|
- A stderr line `A new release of muse-cli is available` is an upgrade
|
|
251
254
|
notice, not a failed command. Upgrade with `muse-cli update`, which also refreshes this skill
|
|
252
255
|
(`muse-cli update --skill` refreshes only the skill). The check
|
|
253
|
-
runs at most once a day,
|
|
254
|
-
by itself. `MUSE_NO_UPDATE_CHECK=1` silences it.
|
|
256
|
+
runs at most once a day, shows updates in the full-screen app too, and never
|
|
257
|
+
changes the install by itself. `MUSE_NO_UPDATE_CHECK=1` silences it.
|
|
@@ -19,8 +19,8 @@ import time
|
|
|
19
19
|
import urllib.parse
|
|
20
20
|
|
|
21
21
|
from . import __version__, browsers
|
|
22
|
-
from .gateway import (Gateway, AuthError, GatewayError,
|
|
23
|
-
fetch_session_info, load_cookies)
|
|
22
|
+
from .gateway import (Gateway, AuthError, GatewayError, RETRYABLE_UPGRADE_STATUS,
|
|
23
|
+
fetch_access_token, fetch_hatch_token, fetch_session_info, load_cookies)
|
|
24
24
|
from .update import cmd_update, finish_update_check, start_update_check
|
|
25
25
|
|
|
26
26
|
CONFIG_DIR = os.path.expanduser("~/.config/muse-cli")
|
|
@@ -64,16 +64,20 @@ def connect(cfg):
|
|
|
64
64
|
raise AuthError(f"cookies file {cfg['cookies_file']} is empty; run `muse-cli auth export`")
|
|
65
65
|
# Three HTTPS round trips (session, auth/check, hatch/token) are most of a
|
|
66
66
|
# connect, about 2.3 s of 2.8 s, and their answers outlive one command.
|
|
67
|
-
# A stale cached token is refused fast (403 on the WebSocket upgrade)
|
|
68
|
-
#
|
|
67
|
+
# A stale cached token is refused fast (403 on the WebSocket upgrade).
|
|
68
|
+
# A timeout or a server outage won't be fixed by fetching fresh tokens.
|
|
69
69
|
cached = _cached_tokens(cookies)
|
|
70
70
|
if cached and cfg.get("vm_id") in (None, cached["vm_id"]):
|
|
71
71
|
try:
|
|
72
72
|
return Gateway(cookies, **cached)
|
|
73
73
|
except TimeoutError:
|
|
74
74
|
raise
|
|
75
|
+
except GatewayError as e:
|
|
76
|
+
if e.status in RETRYABLE_UPGRADE_STATUS:
|
|
77
|
+
raise
|
|
75
78
|
except Exception:
|
|
76
|
-
|
|
79
|
+
pass
|
|
80
|
+
_drop_tokens()
|
|
77
81
|
vm_id = cfg.get("vm_id") or fetch_session_info(cookies)["vm_id"]
|
|
78
82
|
access_token = fetch_access_token(cookies)
|
|
79
83
|
hatch_token = fetch_hatch_token(cookies, access_token, vm_id)
|
|
@@ -1265,7 +1269,8 @@ def build_parser():
|
|
|
1265
1269
|
p = sub.add_parser("tui", help="full-screen app (OpenTUI); `chat` is the plain version",
|
|
1266
1270
|
description="Full-screen app built on OpenTUI. Needs Bun 1.3.14 or later "
|
|
1267
1271
|
"(offers to install it). Bare `muse-cli` opens it on a terminal "
|
|
1268
|
-
"when Bun is there; set MUSE_CLI_UI=plain to keep the plain chat."
|
|
1272
|
+
"when Bun is there; set MUSE_CLI_UI=plain to keep the plain chat. "
|
|
1273
|
+
"If it cannot connect, press R to retry or L to read your browser login.")
|
|
1269
1274
|
p.add_argument("--demo", action="store_true",
|
|
1270
1275
|
help="made-up data for screenshots; never touches muse.ai")
|
|
1271
1276
|
p.set_defaults(fn=cmd_tui)
|
|
@@ -1399,6 +1404,8 @@ def main(argv=None):
|
|
|
1399
1404
|
# A piped command prints JSON. The notice stays off unless both streams
|
|
1400
1405
|
# are a terminal, and `update` is already doing the upgrade.
|
|
1401
1406
|
notice = None if args.cmd == "update" else start_update_check()
|
|
1407
|
+
if args.cmd == "tui":
|
|
1408
|
+
args.update_check = notice
|
|
1402
1409
|
try:
|
|
1403
1410
|
try:
|
|
1404
1411
|
args.fn(args)
|
|
@@ -6,6 +6,7 @@ No browser needed after the initial cookie export.
|
|
|
6
6
|
"""
|
|
7
7
|
import json
|
|
8
8
|
import os
|
|
9
|
+
import re
|
|
9
10
|
import struct
|
|
10
11
|
import threading
|
|
11
12
|
import time
|
|
@@ -13,8 +14,9 @@ import urllib.parse
|
|
|
13
14
|
import uuid
|
|
14
15
|
import queue as queue_mod
|
|
15
16
|
|
|
16
|
-
from curl_cffi import requests as rq
|
|
17
|
+
from curl_cffi import CurlECode, CurlOpt, requests as rq
|
|
17
18
|
from curl_cffi.requests import WebSocket
|
|
19
|
+
from curl_cffi.requests.exceptions import CurlError
|
|
18
20
|
from curl_cffi.requests.websockets import WebSocketTimeout
|
|
19
21
|
from noise.connection import NoiseConnection, Keypair
|
|
20
22
|
from google.protobuf import descriptor_pb2, descriptor_pool, message_factory
|
|
@@ -23,6 +25,7 @@ _HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
23
25
|
UA = ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 "
|
|
24
26
|
"(KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36")
|
|
25
27
|
GATEWAY_HOST = "hatch.metaaivm.com"
|
|
28
|
+
RETRYABLE_UPGRADE_STATUS = (502, 503, 504)
|
|
26
29
|
|
|
27
30
|
_pool = descriptor_pool.DescriptorPool()
|
|
28
31
|
for _i in (0, 1):
|
|
@@ -176,6 +179,41 @@ def fetch_session_info(cookies):
|
|
|
176
179
|
return info
|
|
177
180
|
|
|
178
181
|
|
|
182
|
+
def _open_websocket(url):
|
|
183
|
+
deadline = time.monotonic() + 20
|
|
184
|
+
for delay in (1, 2, None):
|
|
185
|
+
status = None
|
|
186
|
+
|
|
187
|
+
def response_header(line):
|
|
188
|
+
nonlocal status
|
|
189
|
+
match = re.match(rb"HTTP/\S+ (\d{3})(?:\s|$)", line)
|
|
190
|
+
if match:
|
|
191
|
+
status = int(match[1])
|
|
192
|
+
return len(line)
|
|
193
|
+
|
|
194
|
+
ws = WebSocket()
|
|
195
|
+
try:
|
|
196
|
+
ws.connect(url, impersonate="chrome", timeout=deadline - time.monotonic(),
|
|
197
|
+
verify=True, curl_options={CurlOpt.HEADERFUNCTION: response_header})
|
|
198
|
+
return ws
|
|
199
|
+
except CurlError as e:
|
|
200
|
+
if isinstance(e, rq.exceptions.Timeout) or e.code == CurlECode.OPERATION_TIMEDOUT:
|
|
201
|
+
raise TimeoutError("gateway connect timed out") from None
|
|
202
|
+
if status in RETRYABLE_UPGRADE_STATUS:
|
|
203
|
+
if delay is not None and time.monotonic() + delay < deadline:
|
|
204
|
+
time.sleep(delay)
|
|
205
|
+
if time.monotonic() < deadline:
|
|
206
|
+
continue
|
|
207
|
+
message = f"Muse's gateway is temporarily unavailable (HTTP {status}). Retry in a moment."
|
|
208
|
+
elif status is not None and status >= 300:
|
|
209
|
+
message = f"Muse's gateway refused the WebSocket connection (HTTP {status})."
|
|
210
|
+
else:
|
|
211
|
+
message = f"Could not open a WebSocket to Muse's gateway (curl error {e.code})."
|
|
212
|
+
# Never echo the curl error: a connection URL contains the hatch token.
|
|
213
|
+
raise GatewayError(status if status is not None and status >= 300 else -1,
|
|
214
|
+
{"error": message}) from None
|
|
215
|
+
|
|
216
|
+
|
|
179
217
|
class Gateway:
|
|
180
218
|
"""One authenticated connection to the personal VM gateway."""
|
|
181
219
|
|
|
@@ -187,14 +225,9 @@ class Gateway:
|
|
|
187
225
|
hatch_token = hatch_token or fetch_hatch_token(cookies, access_token, vm_id)
|
|
188
226
|
url = (f"wss://{GATEWAY_HOST}/v1/noise?vm_id={vm_id}"
|
|
189
227
|
f"&auth_token={urllib.parse.quote(hatch_token, safe='')}")
|
|
190
|
-
self.ws = WebSocket()
|
|
191
228
|
# verify=True is required: curl_cffi's WebSocket.connect defaults to
|
|
192
229
|
# verify=None, which disables TLS certificate verification entirely.
|
|
193
|
-
|
|
194
|
-
self.ws.connect(url, impersonate="chrome", timeout=20, verify=True)
|
|
195
|
-
except rq.exceptions.Timeout:
|
|
196
|
-
self.close()
|
|
197
|
-
raise TimeoutError("gateway connect timed out") from None
|
|
230
|
+
self.ws = _open_websocket(url)
|
|
198
231
|
try:
|
|
199
232
|
noise = NoiseConnection.from_name(b"Noise_XX_25519_AESGCM_SHA256")
|
|
200
233
|
noise.set_as_initiator()
|
|
@@ -16,8 +16,12 @@ export function Splash() {
|
|
|
16
16
|
const t = tick / 40
|
|
17
17
|
|
|
18
18
|
useKeyboard((key) => {
|
|
19
|
+
if (key.defaultPrevented || key.eventType === "release" || key.ctrl || key.meta) return
|
|
19
20
|
if (phase === "auth" && (key.name === "l" || key.name === "return") && !busy) ctl.login()
|
|
20
|
-
if (phase === "fatal" &&
|
|
21
|
+
if (phase === "fatal" && !busy) {
|
|
22
|
+
if (key.name === "r") ctl.boot()
|
|
23
|
+
if (key.name === "l") ctl.login()
|
|
24
|
+
}
|
|
21
25
|
if ((phase === "auth" || phase === "fatal") && (key.name === "q" || key.name === "escape")) ctl.onQuit()
|
|
22
26
|
})
|
|
23
27
|
|
|
@@ -62,7 +66,7 @@ export function Splash() {
|
|
|
62
66
|
Let's get you signed in
|
|
63
67
|
</text>
|
|
64
68
|
<text fg={theme.textSoft} wrapMode="word">
|
|
65
|
-
Log in at muse.ai in Chrome, Brave, Arc or Edge, then press L. muse-cli copies that login to this computer; your
|
|
69
|
+
Log in at muse.ai in Firefox, or in Chrome, Brave, Arc or Edge on macOS, then press L. muse-cli copies that login to this computer; your
|
|
66
70
|
password never leaves the browser.
|
|
67
71
|
</text>
|
|
68
72
|
{detail ? (
|
|
@@ -76,7 +80,7 @@ export function Splash() {
|
|
|
76
80
|
</box>
|
|
77
81
|
</box>
|
|
78
82
|
) : null}
|
|
79
|
-
{phase === "fatal" ? (
|
|
83
|
+
{phase === "fatal" && !busy ? (
|
|
80
84
|
<box
|
|
81
85
|
border
|
|
82
86
|
borderStyle="rounded"
|
|
@@ -95,8 +99,9 @@ export function Splash() {
|
|
|
95
99
|
<text fg={theme.textSoft} wrapMode="word">
|
|
96
100
|
{detail}
|
|
97
101
|
</text>
|
|
98
|
-
<box flexDirection="row"
|
|
102
|
+
<box flexDirection="row" flexWrap="wrap" justifyContent="center" columnGap={2}>
|
|
99
103
|
<Kbd k="R" label="retry" />
|
|
104
|
+
<Kbd k="L" label="use browser login" />
|
|
100
105
|
<Kbd k="Q" label="quit" />
|
|
101
106
|
</box>
|
|
102
107
|
</box>
|
|
@@ -34,6 +34,8 @@ const renderer = await createCliRenderer({
|
|
|
34
34
|
})
|
|
35
35
|
renderer.setTerminalTitle("muse")
|
|
36
36
|
|
|
37
|
+
const latest = process.env.MUSE_CLI_UPDATE_AVAILABLE
|
|
38
|
+
|
|
37
39
|
ctl.onQuit = () => {
|
|
38
40
|
if (renderer.isDestroyed) return
|
|
39
41
|
// An empty title hands the tab name back to the shell.
|
|
@@ -43,7 +45,16 @@ ctl.onQuit = () => {
|
|
|
43
45
|
|
|
44
46
|
createRoot(renderer).render(
|
|
45
47
|
<AppContext.Provider value={{ ctl, store }}>
|
|
46
|
-
|
|
48
|
+
{latest ? (
|
|
49
|
+
<box width="100%" height="100%" flexDirection="column" backgroundColor={theme.bg}>
|
|
50
|
+
<box flexGrow={1} minHeight={0}>
|
|
51
|
+
<App />
|
|
52
|
+
</box>
|
|
53
|
+
<text fg={theme.yellow} flexShrink={0} width="100%" wrapMode="word">
|
|
54
|
+
{`Update ${latest} available · run muse-cli update after quitting`}
|
|
55
|
+
</text>
|
|
56
|
+
</box>
|
|
57
|
+
) : <App />}
|
|
47
58
|
</AppContext.Provider>,
|
|
48
59
|
)
|
|
49
60
|
|
|
@@ -16,6 +16,8 @@ import tempfile
|
|
|
16
16
|
import time
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
|
|
19
|
+
from .update import available_update
|
|
20
|
+
|
|
19
21
|
MIN_BUN = (1, 3, 14)
|
|
20
22
|
APP_DIR = Path(__file__).parent / "tui"
|
|
21
23
|
SKIP = {"node_modules", ".DS_Store", "__pycache__"}
|
|
@@ -191,8 +193,12 @@ def offer_bun_install():
|
|
|
191
193
|
return usable_bun()
|
|
192
194
|
|
|
193
195
|
|
|
194
|
-
def run_app(bun, directory, demo):
|
|
196
|
+
def run_app(bun, directory, demo, update_check=None):
|
|
195
197
|
env = dict(os.environ, MUSE_CLI_PYTHON=sys.executable)
|
|
198
|
+
env.pop("MUSE_CLI_UPDATE_AVAILABLE", None)
|
|
199
|
+
latest = available_update(update_check, timeout=2)
|
|
200
|
+
if latest:
|
|
201
|
+
env["MUSE_CLI_UPDATE_AVAILABLE"] = latest
|
|
196
202
|
# React's development build is much slower at rendering.
|
|
197
203
|
env.setdefault("NODE_ENV", "production")
|
|
198
204
|
if demo:
|
|
@@ -236,7 +242,7 @@ def launch(args, demo=False, bun=None, ask=True):
|
|
|
236
242
|
return 1
|
|
237
243
|
plain_notice(f"Could not set up the full-screen app ({e})")
|
|
238
244
|
return fallback(args)
|
|
239
|
-
return run_app(bun, directory, demo)
|
|
245
|
+
return run_app(bun, directory, demo, getattr(args, "update_check", None))
|
|
240
246
|
|
|
241
247
|
|
|
242
248
|
def fallback(args):
|
|
@@ -123,15 +123,20 @@ def start_update_check():
|
|
|
123
123
|
return holder
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
def
|
|
127
|
-
"""Print the notice on stderr once the check has had a moment to finish."""
|
|
126
|
+
def available_update(holder, timeout=1.5):
|
|
128
127
|
if not holder:
|
|
129
|
-
return
|
|
128
|
+
return None
|
|
130
129
|
thread = holder.get("thread")
|
|
131
130
|
if thread is not None:
|
|
132
|
-
thread.join(timeout=
|
|
131
|
+
thread.join(timeout=timeout)
|
|
133
132
|
latest = holder.get("latest")
|
|
134
|
-
if
|
|
133
|
+
return latest if is_newer(latest, __version__) else None
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def finish_update_check(holder):
|
|
137
|
+
"""Print the notice on stderr once the check has had a moment to finish."""
|
|
138
|
+
latest = available_update(holder)
|
|
139
|
+
if latest is None:
|
|
135
140
|
return
|
|
136
141
|
print(
|
|
137
142
|
f"\nA new release of muse-cli is available: {__version__} → {latest}\n"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|