chore(fleet): sync operator memory, hatch menu dialogs, and watchdog alerts
This commit is contained in:
+15
-1
@@ -131,12 +131,19 @@ def parse_threads_blob(blob):
|
||||
|
||||
|
||||
def normalize_thread(t):
|
||||
is_main = (
|
||||
t.get("thread") is False or
|
||||
t.get("is_main") is True or
|
||||
(t.get("title") and t.get("title").lower() in ("main chat", "main", "start conversation with muse"))
|
||||
)
|
||||
return {
|
||||
"thread_id": t.get("session_id") or t.get("thread_id") or t.get("id"),
|
||||
"title": t.get("title"),
|
||||
"pinned": bool(t.get("pinned")),
|
||||
"archived": bool(t.get("archived")),
|
||||
"updated": t.get("updated"),
|
||||
"thread": t.get("thread", True),
|
||||
"is_main": is_main,
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +153,14 @@ def cmd_list(agent):
|
||||
code, error, detail, ec = map_failure(rc, err)
|
||||
fail(code, error, detail=detail, exit_code=ec)
|
||||
threads = [normalize_thread(t) for t in parse_threads_blob(out)]
|
||||
print(json.dumps({"ok": True, "agent": agent, "threads": threads}))
|
||||
mains = [t for t in threads if t.get("is_main")]
|
||||
pinned = [t for t in threads if t.get("pinned") and not t.get("is_main")]
|
||||
regular = [t for t in threads if not t.get("is_main") and not t.get("pinned")]
|
||||
mains.sort(key=lambda t: t.get("updated") or "", reverse=True)
|
||||
pinned.sort(key=lambda t: t.get("updated") or "", reverse=True)
|
||||
regular.sort(key=lambda t: t.get("updated") or "", reverse=True)
|
||||
sorted_threads = mains + pinned + regular
|
||||
print(json.dumps({"ok": True, "agent": agent, "threads": sorted_threads}))
|
||||
|
||||
|
||||
def cmd_mutate(agent, op, thread_id, title=None):
|
||||
|
||||
Reference in New Issue
Block a user