@hivey/cli 0.9.84 → 0.9.86
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.
|
Binary file
|
package/package.json
CHANGED
package/repo/README.md
CHANGED
|
@@ -60,6 +60,10 @@ Turn it off the same way, or with `hivey quiet off`.
|
|
|
60
60
|
|
|
61
61
|
**Quiet mode on a schedule:** so you don't have to press it every night, open **settings → quiet**, click **on**, and set when it starts and ends: click **−** / **+** to move a time by 30 minutes, or select its row and type it (`2230`, `22:30` or `7`). Quiet mode then turns on and off by itself every day, even with every hivey window closed. You can still switch it by hand; your choice lasts until the next start or end. From a terminal: `hivey quiet schedule 22:30-6:45` (`hivey quiet schedule off` to stop).
|
|
62
62
|
|
|
63
|
+
**Hibernation frees memory.** An agent left idle for 2 days is stopped (the agent CLI and its MCP servers), which gives its memory back. Its pane, name and conversation stay, and the space shows 💤. Open the space again, or send the agent a message, and hivey resumes it with the same conversation on the latest CLI version. Choose the number of days (or off) in **settings → hibernate**. Right-click a space and pick **Hibernate now** or **Resume session** to do it by hand, or **Settings…** to give that swarm or agent its own value. From a terminal: `hivey hibernate`, `hivey hibernate now <pane>`, `hivey agent-settings <space> --hibernate 7`.
|
|
64
|
+
|
|
65
|
+
**Compacting by size** is off by default. In **settings → compact** (or a space's **Settings…**), pick a size such as 200k or 400k tokens, and an idle Claude agent whose context has grown past it gets `/compact` typed in. Other sizes: `hivey agent-settings [<space>] --compact 350k`.
|
|
66
|
+
|
|
63
67
|
**Voice quiet hours** silence only the voice at the same hours every night, for example from 22:00 to 08:00:
|
|
64
68
|
|
|
65
69
|
```bash
|
|
@@ -65,7 +65,24 @@ IDLE_SECONDS = 2 * 3600
|
|
|
65
65
|
PING = "/hv-ping"
|
|
66
66
|
LEGACY_PAGE = "/office" # the fleet page's address before it was renamed; redirected to /fleet/
|
|
67
67
|
MARK = b"hivey-agent-map"
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def code_stamp() -> str:
|
|
71
|
+
"""A short hash of the server's Python files: a `hivey update` that changes any of them changes it."""
|
|
72
|
+
import hashlib
|
|
73
|
+
h = hashlib.sha1()
|
|
74
|
+
for f in sorted(SCRIPTS.glob("*.py")):
|
|
75
|
+
try:
|
|
76
|
+
h.update(f.name.encode() + f.read_bytes())
|
|
77
|
+
except OSError:
|
|
78
|
+
pass
|
|
79
|
+
return h.hexdigest()[:10]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# `ensure` replaces a server whose version differs, and a running server restarts itself once its files change
|
|
83
|
+
# (bump the number when the server gains actions; the code hash catches every other change)
|
|
84
|
+
STAMP = code_stamp()
|
|
85
|
+
VERSION = b"fleet-19-" + STAMP.encode()
|
|
69
86
|
FLEET_EVERY = 300 # seconds between full fleet refreshes (every terminal re-summarized) while its page is open
|
|
70
87
|
FLEET_LIVE = 60 # seconds between live passes (status, context, screen; only changed statuses summarized)
|
|
71
88
|
FLEET_WATCHED = 600 # the page counts as open for this long after its last poll
|
|
@@ -720,16 +737,26 @@ def serve() -> int:
|
|
|
720
737
|
migrate_legacy()
|
|
721
738
|
REPORTS.mkdir(parents=True, exist_ok=True)
|
|
722
739
|
try:
|
|
723
|
-
|
|
740
|
+
# a restart after an update keeps its port, so open pages keep talking to it
|
|
741
|
+
httpd = http.server.ThreadingHTTPServer(("127.0.0.1", int(os.environ.pop("HV_AGENT_MAP_PORT", "") or PREFERRED_PORT)),
|
|
742
|
+
Handler)
|
|
724
743
|
except OSError: # taken: any free port
|
|
725
744
|
httpd = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
|
|
726
745
|
port = httpd.server_address[1]
|
|
727
746
|
INFO.write_text(json.dumps({"port": port, "pid": os.getpid(), "hivey": hivey_bin()}))
|
|
728
747
|
|
|
748
|
+
restart = threading.Event()
|
|
749
|
+
|
|
729
750
|
def watchdog() -> None:
|
|
730
751
|
while True:
|
|
731
752
|
time.sleep(60)
|
|
732
|
-
if
|
|
753
|
+
if Handler.busy.locked():
|
|
754
|
+
continue
|
|
755
|
+
if time.time() - Handler.last_used > IDLE_SECONDS:
|
|
756
|
+
httpd.shutdown()
|
|
757
|
+
return
|
|
758
|
+
if code_stamp() != STAMP: # a hivey update changed the scripts: restart on the new code
|
|
759
|
+
restart.set()
|
|
733
760
|
httpd.shutdown()
|
|
734
761
|
return
|
|
735
762
|
|
|
@@ -756,6 +783,11 @@ def serve() -> int:
|
|
|
756
783
|
threading.Thread(target=fleet_clock, daemon=True).start()
|
|
757
784
|
print(f"agent map pages: http://127.0.0.1:{port}/latest/agent-stats.html", flush=True)
|
|
758
785
|
httpd.serve_forever()
|
|
786
|
+
httpd.server_close()
|
|
787
|
+
if restart.is_set(): # same port and pid: open pages keep working and pick up the new code
|
|
788
|
+
print("agent map server: its scripts changed (hivey update), restarting", flush=True)
|
|
789
|
+
os.environ["HV_AGENT_MAP_PORT"] = str(port)
|
|
790
|
+
os.execv(sys.executable, [sys.executable, "-I", str(SCRIPTS / "agent_map.py"), "serve"])
|
|
759
791
|
try:
|
|
760
792
|
if json.loads(INFO.read_text()).get("pid") == os.getpid():
|
|
761
793
|
INFO.unlink()
|