muse-cli 0.3.7__tar.gz → 0.3.8__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.7
3
+ Version: 0.3.8
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
@@ -34,6 +34,12 @@ chat / feed / goals / ideas / sessions / ...
34
34
  exists in the client for other configurations.
35
35
  - **Framing:** `NoiseTransportFrame{chunk_id(i64), chunk_index, total_chunks,
36
36
  payload}` protobuf → Noise transport encrypt → one WS binary frame each.
37
+ A reply larger than one Noise message (65535 bytes) is split across several
38
+ frames that share a `chunk_id` (`total_chunks > 1`, `chunk_index` 0-based).
39
+ Only the concatenated payloads parse as a `ServiceResponse`; parsing a single
40
+ chunk fails with `DecodeError: Wire format was corrupt`. Frames of different
41
+ `chunk_id`s can interleave, so `Gateway._read_frame()` buffers per id.
42
+ (`egress.approvals` returns ~123 KB and hit this.)
37
43
  - **Request:** `ServiceRequest{service, payload =
38
44
  ServiceFrame{stream_id, request =
39
45
  ApplicationRequest{verb, path, headers, body, end_body}}}`. Stream ids start
@@ -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.7"
3
+ __version__ = "0.3.8"
@@ -194,6 +194,7 @@ class Gateway:
194
194
  self.stream = 1
195
195
  self._send_lock = threading.Lock()
196
196
  self._recv_lock = threading.Lock()
197
+ self._chunks = {} # chunk_id -> {chunk_index: payload}, guarded by _recv_lock
197
198
 
198
199
  # -- low-level framing -------------------------------------------------
199
200
  def _send_envelope(self, service_id, frame_bytes):
@@ -210,12 +211,26 @@ class Gateway:
210
211
  # Callers must still avoid *logical* races: only one thread should
211
212
  # be consuming frames at a time, or responses get misrouted.
212
213
  with self._recv_lock:
213
- data, _flags = self.ws.recv()
214
- pt = bytes(self.noise.decrypt(bytes(data)))
215
- ntf = NoiseTransportFrame()
216
- ntf.ParseFromString(pt)
214
+ # A reply bigger than one Noise message (65535 bytes) arrives as
215
+ # several transport frames sharing a chunk_id; only the joined
216
+ # payload is a ServiceResponse. Keep reading until it is whole.
217
+ while True:
218
+ data, _flags = self.ws.recv()
219
+ pt = bytes(self.noise.decrypt(bytes(data)))
220
+ ntf = NoiseTransportFrame()
221
+ ntf.ParseFromString(pt)
222
+ payload = bytes(ntf.payload)
223
+ total = ntf.total_chunks or 1
224
+ if total == 1:
225
+ break
226
+ parts = self._chunks.setdefault(ntf.chunk_id, {})
227
+ parts[ntf.chunk_index] = payload
228
+ if all(i in parts for i in range(total)):
229
+ del self._chunks[ntf.chunk_id]
230
+ payload = b"".join(parts[i] for i in range(total))
231
+ break
217
232
  sr = ServiceResponse()
218
- sr.ParseFromString(ntf.payload)
233
+ sr.ParseFromString(payload)
219
234
  sf = ServiceFrame()
220
235
  sf.ParseFromString(sr.payload)
221
236
  return sf
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes