@hivey/cli 0.9.65 β 0.9.67
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.
- package/native/darwin-arm64/hivey +0 -0
- package/package.json +1 -1
- package/repo/skills/hivey-agent-map/SKILL.md +6 -6
- package/repo/skills/hivey-agent-map/scripts/agent_map.py +2 -2
- package/repo/skills/hivey-agent-map/scripts/enhance.py +1 -1
- package/repo/skills/hivey-agent-map/scripts/office/music/README.txt +14 -2
- package/repo/skills/hivey-agent-map/scripts/office/music/space_02.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_01.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_02.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_03.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_04.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_05.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_06.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_07.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/track_08.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/office.html +53 -20
- package/repo/skills/hivey-agent-map/scripts/office/office.js +58 -7
- package/repo/skills/hivey-agent-map/scripts/office.py +1 -1
- package/repo/skills/hivey-agent-map/scripts/report.py +2 -2
- package/repo/skills/hivey-agent-map/scripts/serve.py +7 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>hivey
|
|
6
|
+
<title>hivey fleet</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>π</text></svg>">
|
|
8
8
|
<style>
|
|
9
9
|
:root{
|
|
@@ -19,7 +19,7 @@ a{color:var(--honey)}
|
|
|
19
19
|
header{position:sticky;top:0;z-index:20;display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;
|
|
20
20
|
padding:10px 18px;background:rgba(13,17,25,.86);backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
|
|
21
21
|
.brand{display:flex;align-items:center;gap:10px;margin-right:6px}
|
|
22
|
-
.brand .logo{
|
|
22
|
+
.brand .logo{width:30px;height:30px;display:block;filter:drop-shadow(0 0 8px rgba(155,239,200,.35))}
|
|
23
23
|
.brand h1{margin:0;font-size:17px;letter-spacing:.2px}
|
|
24
24
|
.brand .sub{color:var(--muted);font-size:12px}
|
|
25
25
|
.pills{display:flex;flex-wrap:wrap;gap:6px}
|
|
@@ -40,6 +40,15 @@ header{position:sticky;top:0;z-index:20;display:flex;flex-wrap:wrap;align-items:
|
|
|
40
40
|
.iconbtn:hover{border-color:var(--honey)}
|
|
41
41
|
.every{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:7px 9px;color:inherit;font:inherit;cursor:pointer}
|
|
42
42
|
.every:hover{border-color:var(--honey)}
|
|
43
|
+
.settings{position:fixed;top:58px;right:14px;z-index:70;width:290px;background:rgba(12,18,34,.97);border:1px solid rgba(120,170,255,.4);border-radius:14px;
|
|
44
|
+
padding:12px 14px;box-shadow:0 14px 40px rgba(0,0,0,.55);display:flex;flex-direction:column;gap:10px}
|
|
45
|
+
.settings[hidden]{display:none}
|
|
46
|
+
.settings .t{font-weight:700;font-size:13px;color:#cfe0ff;letter-spacing:.04em}
|
|
47
|
+
.settings label{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px}
|
|
48
|
+
.settings label span{color:#cbd5e1;white-space:nowrap}
|
|
49
|
+
.settings select{width:160px}
|
|
50
|
+
.settings .note{font-size:11px;color:var(--muted);line-height:1.4}
|
|
51
|
+
#gear.on{border-color:var(--honey)}
|
|
43
52
|
.spin{display:inline-block;animation:spin 1s linear infinite}
|
|
44
53
|
@keyframes spin{to{transform:rotate(360deg)}}
|
|
45
54
|
/* ---------- needs-you inbox ---------- */
|
|
@@ -166,7 +175,7 @@ td.j{max-width:420px}
|
|
|
166
175
|
</head>
|
|
167
176
|
<body>
|
|
168
177
|
<header>
|
|
169
|
-
<div class="brand"><
|
|
178
|
+
<div class="brand"><svg class="logo" viewBox="0 0 40 40" role="img" aria-label="hivey"><rect width="40" height="40" rx="9" fill="#9befc8"/><path d="M10 9h7v9h6V9h7v23h-7V22h-6v10h-7z" fill="#122319"/></svg><div><h1>hivey fleet</h1><div class="sub" id="sub">loadingβ¦</div></div></div>
|
|
170
179
|
<div class="pills" id="pills"></div>
|
|
171
180
|
<div class="spacer"></div>
|
|
172
181
|
<input class="search" id="q" placeholder="Search agents, jobs⦠( / )" autocomplete="off">
|
|
@@ -176,24 +185,48 @@ td.j{max-width:420px}
|
|
|
176
185
|
<button data-v="list" title="One row per agent, for hundreds (3)">β° List</button>
|
|
177
186
|
</div>
|
|
178
187
|
<button class="iconbtn" id="music" title="Background music on/off (m)">π</button>
|
|
179
|
-
<select class="every" id="every" title="How the office updates itself">
|
|
180
|
-
<option value="minute">β± every minute</option>
|
|
181
|
-
<option value="5min">β± every 5 min</option>
|
|
182
|
-
<option value="15min">β± every 15 min</option>
|
|
183
|
-
<option value="1h">β± every hour</option>
|
|
184
|
-
<option value="reload">β± on reload only</option>
|
|
185
|
-
</select>
|
|
186
|
-
<select class="every" id="space" title="Background: a new space scene every time, or always one">
|
|
187
|
-
<option value="random">π new each time</option>
|
|
188
|
-
<option value="1">π violet</option>
|
|
189
|
-
<option value="2">π emerald</option>
|
|
190
|
-
<option value="3">π crimson</option>
|
|
191
|
-
<option value="4">π deep blue</option>
|
|
192
|
-
<option value="5">π golden suns</option>
|
|
193
|
-
<option value="6">π singularity</option>
|
|
194
|
-
</select>
|
|
195
188
|
<button class="iconbtn" id="refresh" title="Read every terminal and session log again now (r)">β³</button>
|
|
189
|
+
<button class="iconbtn" id="gear" title="Settings: music, updates, background">β</button>
|
|
196
190
|
</header>
|
|
191
|
+
<div id="settings" class="settings" hidden>
|
|
192
|
+
<div class="t">β Settings</div>
|
|
193
|
+
<label><span>π΅ Music</span>
|
|
194
|
+
<select class="every" id="track" title="Music: a new track each time, or always one">
|
|
195
|
+
<option value="random">new each time</option>
|
|
196
|
+
<option value="1">cosmic ambient</option>
|
|
197
|
+
<option value="2">cosmic ambient II</option>
|
|
198
|
+
<option value="3">dark techno</option>
|
|
199
|
+
<option value="4">synthwave cruise</option>
|
|
200
|
+
<option value="5">glitch downtempo</option>
|
|
201
|
+
<option value="6">cinematic drones</option>
|
|
202
|
+
<option value="7">lo-fi stars</option>
|
|
203
|
+
<option value="8">berlin sequencer</option>
|
|
204
|
+
<option value="9">deep house orbit</option>
|
|
205
|
+
<option value="10">liquid drum & bass</option>
|
|
206
|
+
</select>
|
|
207
|
+
</label>
|
|
208
|
+
<label><span>β± Updates</span>
|
|
209
|
+
<select class="every" id="every" title="How the office updates itself">
|
|
210
|
+
<option value="minute">every minute</option>
|
|
211
|
+
<option value="5min">every 5 min</option>
|
|
212
|
+
<option value="15min">every 15 min</option>
|
|
213
|
+
<option value="1h">every hour</option>
|
|
214
|
+
<option value="reload">on reload only</option>
|
|
215
|
+
</select>
|
|
216
|
+
</label>
|
|
217
|
+
<label><span>π Background</span>
|
|
218
|
+
<select class="every" id="space" title="Background: a new space scene every time, or always one">
|
|
219
|
+
<option value="random">new each time</option>
|
|
220
|
+
<option value="1">violet</option>
|
|
221
|
+
<option value="2">emerald</option>
|
|
222
|
+
<option value="3">crimson</option>
|
|
223
|
+
<option value="4">deep blue</option>
|
|
224
|
+
<option value="5">golden suns</option>
|
|
225
|
+
<option value="6">singularity</option>
|
|
226
|
+
</select>
|
|
227
|
+
</label>
|
|
228
|
+
<div class="note">Saved for every browser. π in the header mutes the music; β³ updates now.</div>
|
|
229
|
+
</div>
|
|
197
230
|
<div id="inbox"></div>
|
|
198
231
|
<main>
|
|
199
232
|
<section id="office">
|
|
@@ -206,7 +239,7 @@ td.j{max-width:420px}
|
|
|
206
239
|
<aside id="drawer"></aside>
|
|
207
240
|
<div id="tip"></div>
|
|
208
241
|
<div id="toast"></div>
|
|
209
|
-
<audio id="bgm"
|
|
242
|
+
<audio id="bgm" preload="auto"></audio>
|
|
210
243
|
<script type="module" src="./office.js"></script>
|
|
211
244
|
</body>
|
|
212
245
|
</html>
|
|
@@ -26,7 +26,7 @@ const ui = JSON.parse(localStorage.getItem('hv-office-ship') || '{}');
|
|
|
26
26
|
ui.view ||= 'office';
|
|
27
27
|
ui.filter ||= null;
|
|
28
28
|
if (ui.toon === undefined) ui.toon = false;
|
|
29
|
-
const save = () => localStorage.setItem('hv-office-ship', JSON.stringify({ view: ui.view, filter: ui.filter, toon: ui.toon, music: ui.music, ships: ui.ships, space: ui.space }));
|
|
29
|
+
const save = () => localStorage.setItem('hv-office-ship', JSON.stringify({ view: ui.view, filter: ui.filter, toon: ui.toon, music: ui.music, ships: ui.ships, space: ui.space, track: ui.track }));
|
|
30
30
|
// ship positions also live on the office server, so every browser opens the fleet where you left it
|
|
31
31
|
const saveShips = () => { save(); fetch('/hv-office-settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ships: ui.ships || {} }) }).catch(() => {}); };
|
|
32
32
|
|
|
@@ -904,7 +904,7 @@ async function poll() {
|
|
|
904
904
|
if (refreshing && Date.parse(j.generated) > refreshing) { refreshing = false; $('#refresh').innerHTML = 'β³'; toast('Office updated'); }
|
|
905
905
|
renderAll();
|
|
906
906
|
}
|
|
907
|
-
} catch (e) { console.error('hivey
|
|
907
|
+
} catch (e) { console.error('hivey fleet:', e); $('#sub').textContent = 'cannot read office.json: is the office server running? (hivey menu β agent fleet)'; }
|
|
908
908
|
}
|
|
909
909
|
async function refreshNow() {
|
|
910
910
|
if (refreshing) return;
|
|
@@ -917,18 +917,65 @@ async function refreshNow() {
|
|
|
917
917
|
}
|
|
918
918
|
document.querySelectorAll('#views button').forEach(b => b.onclick = () => { ui.view = b.dataset.v; save(); renderAll(); });
|
|
919
919
|
$('#refresh').onclick = refreshNow;
|
|
920
|
-
//
|
|
920
|
+
// β settings panel (music, updates, background): opens under the gear, closes on a click outside or Escape
|
|
921
|
+
const gear = $('#gear'), panel = $('#settings');
|
|
922
|
+
const showSettings = on => { panel.hidden = !on; gear.classList.toggle('on', on); };
|
|
923
|
+
gear.onclick = e => { e.stopPropagation(); showSettings(panel.hidden); };
|
|
924
|
+
panel.addEventListener('click', e => e.stopPropagation());
|
|
925
|
+
document.addEventListener('click', () => showSettings(false));
|
|
926
|
+
document.addEventListener('keydown', e => { if (e.key === 'Escape') showSettings(false); });
|
|
927
|
+
// background music: MusicGen electronic space tracks; π΅ setting = a new track each time (moving on to another
|
|
928
|
+
// when one ends) or always one (looping). Browsers only allow sound after you touch the page, so when playing
|
|
929
|
+
// right away is refused, the music starts with your first click or key press anywhere.
|
|
930
|
+
const TRACKS = [
|
|
931
|
+
['space.mp3', 'cosmic ambient'], ['space_02.mp3', 'cosmic ambient II'], ['track_01.mp3', 'dark techno'],
|
|
932
|
+
['track_02.mp3', 'synthwave cruise'], ['track_03.mp3', 'glitch downtempo'], ['track_04.mp3', 'cinematic drones'],
|
|
933
|
+
['track_05.mp3', 'lo-fi stars'], ['track_06.mp3', 'berlin sequencer'], ['track_07.mp3', 'deep house orbit'],
|
|
934
|
+
['track_08.mp3', 'liquid drum & bass'],
|
|
935
|
+
];
|
|
921
936
|
const bgm = $('#bgm');
|
|
922
937
|
bgm.volume = 0.35;
|
|
938
|
+
let trackNo = 0;
|
|
939
|
+
const fixedTrack = () => /^\d+$/.test(String(ui.track)) && +ui.track >= 1 && +ui.track <= TRACKS.length ? +ui.track : 0;
|
|
940
|
+
function loadTrack(n) {
|
|
941
|
+
trackNo = n;
|
|
942
|
+
bgm.src = './music/' + TRACKS[n - 1][0];
|
|
943
|
+
bgm.loop = !!fixedTrack();
|
|
944
|
+
$('#music').title = ui.music ? `Music: ${TRACKS[n - 1][1]} (click to mute, m)` : 'Background music on/off (m)';
|
|
945
|
+
}
|
|
946
|
+
function pickTrack() { // the fixed one, or a random one that is not the one just played
|
|
947
|
+
const f = fixedTrack();
|
|
948
|
+
if (f) return f;
|
|
949
|
+
let n = 1 + Math.floor(Math.random() * TRACKS.length);
|
|
950
|
+
if (n === trackNo && TRACKS.length > 1) n = n % TRACKS.length + 1;
|
|
951
|
+
return n;
|
|
952
|
+
}
|
|
953
|
+
bgm.addEventListener('ended', () => { if (!fixedTrack()) { loadTrack(pickTrack()); if (ui.music && inFront()) bgm.play().catch(() => {}); } });
|
|
954
|
+
let waitingForTouch = false;
|
|
955
|
+
function startOnTouch() { // the browser refused to play before you touched the page: start on the first touch
|
|
956
|
+
if (waitingForTouch) return;
|
|
957
|
+
waitingForTouch = true;
|
|
958
|
+
const go = () => { waitingForTouch = false; removeEventListener('pointerdown', go, true); removeEventListener('keydown', go, true); if (ui.music && bgm.paused) bgm.play().catch(() => {}); };
|
|
959
|
+
addEventListener('pointerdown', go, true); addEventListener('keydown', go, true);
|
|
960
|
+
}
|
|
923
961
|
function setMusic(on) {
|
|
924
962
|
ui.music = on; save();
|
|
925
963
|
$('#music').textContent = on ? 'π΅' : 'π';
|
|
926
|
-
|
|
927
|
-
|
|
964
|
+
if (!trackNo) loadTrack(pickTrack());
|
|
965
|
+
$('#music').title = on ? `Music: ${TRACKS[trackNo - 1][1]} (click to mute, m)` : 'Background music on/off (m)';
|
|
966
|
+
if (on) bgm.play().catch(() => startOnTouch()); else bgm.pause();
|
|
928
967
|
}
|
|
929
|
-
$('#music').onclick = ()
|
|
930
|
-
if (ui.music) addEventListener('pointerdown', () => { if (ui.music && bgm.paused) setMusic(true); }, { once: true });
|
|
968
|
+
$('#music').onclick = e => { e.stopPropagation(); setMusic(!ui.music); };
|
|
931
969
|
$('#music').textContent = ui.music ? 'π΅' : 'π';
|
|
970
|
+
$('#track').value = fixedTrack() ? String(fixedTrack()) : 'random';
|
|
971
|
+
$('#track').onchange = e => {
|
|
972
|
+
ui.track = e.target.value; save();
|
|
973
|
+
loadTrack(pickTrack());
|
|
974
|
+
if (!ui.music) setMusic(true); else bgm.play().catch(() => startOnTouch());
|
|
975
|
+
toast(ui.track === 'random' ? `A new track each time (now: ${TRACKS[trackNo - 1][1]})` : `Music: ${TRACKS[trackNo - 1][1]}, always`);
|
|
976
|
+
post('/hv-office-settings', { track: ui.track }).catch(() => {});
|
|
977
|
+
};
|
|
978
|
+
if (ui.music) { loadTrack(pickTrack()); bgm.play().catch(() => startOnTouch()); }
|
|
932
979
|
// only while the page is in front of you: pause when you switch to the terminal or another app or tab
|
|
933
980
|
const inFront = () => !document.hidden && document.hasFocus();
|
|
934
981
|
function followFocus() { if (!ui.music) return; if (inFront()) bgm.play().catch(() => {}); else bgm.pause(); }
|
|
@@ -974,6 +1021,10 @@ post('/hv-office-refresh', { load: true }).then(j => {
|
|
|
974
1021
|
ui.space = j.space; save(); $('#space').value = j.space;
|
|
975
1022
|
if (j.space !== 'random') office.setSpace(j.space);
|
|
976
1023
|
} else if (!j.space && ui.space) post('/hv-office-settings', { space: String(ui.space) }).catch(() => {});
|
|
1024
|
+
if (j.track && j.track !== String(ui.track || 'random')) { // the music choice made in another browser
|
|
1025
|
+
ui.track = j.track; save(); $('#track').value = j.track;
|
|
1026
|
+
if (fixedTrack() && fixedTrack() !== trackNo) { loadTrack(fixedTrack()); if (ui.music) bgm.play().catch(() => startOnTouch()); }
|
|
1027
|
+
} else if (!j.track && ui.track) post('/hv-office-settings', { track: String(ui.track) }).catch(() => {});
|
|
977
1028
|
const server = j.ships || {}, local = ui.ships || {};
|
|
978
1029
|
if (Object.keys(server).length) { // the server's positions win; rebuild if they differ from this browser's
|
|
979
1030
|
if (JSON.stringify(server) !== JSON.stringify(local)) { ui.ships = server; save(); if (data) renderAll(); }
|
|
@@ -605,7 +605,7 @@ def open_page(model: str) -> int:
|
|
|
605
605
|
serve.request_office_refresh(port)
|
|
606
606
|
url = f"http://127.0.0.1:{port}/office/"
|
|
607
607
|
subprocess.run(["open", url], capture_output=True)
|
|
608
|
-
print(f"agent
|
|
608
|
+
print(f"agent fleet: {url}")
|
|
609
609
|
return 0
|
|
610
610
|
|
|
611
611
|
|
|
@@ -216,7 +216,7 @@ def write_stats(snap: dict, folder: Path) -> None:
|
|
|
216
216
|
else:
|
|
217
217
|
L.append(f"β
All {len(jobs)} jobs ran cleanly.\n")
|
|
218
218
|
L.append("Every job and agent, with its status, issues and the last lines of its log: `agent-logs.html` "
|
|
219
|
-
"in this folder (hivey menu β agent
|
|
219
|
+
"in this folder (hivey menu β agent jobs opens it too).\n")
|
|
220
220
|
|
|
221
221
|
L.append("## What is not counted yet? {#gaps}\n")
|
|
222
222
|
L.append('@callout level=warning title="Spend the map cannot see"')
|
|
@@ -846,7 +846,7 @@ def offer(hour: int, minute: int, model: str) -> int:
|
|
|
846
846
|
tty.write(
|
|
847
847
|
"\nhivey can watch this computer every night: scheduled jobs (cron, launchd), agents and\n"
|
|
848
848
|
"swarms, token use and estimated cost per agent and provider, failing jobs, and how\n"
|
|
849
|
-
"agents feed each other. The report opens from the hivey menu β agent
|
|
849
|
+
"agents feed each other. The report opens from the hivey menu β agent jobs.\n"
|
|
850
850
|
f"It runs at {hour:02}:{minute:02} with Claude {model} (well under a dollar a night).\n"
|
|
851
851
|
"Set up the nightly agent monitoring? [Y/n] ")
|
|
852
852
|
tty.flush()
|
|
@@ -50,7 +50,7 @@ PREFERRED_PORT = 42817 # unregistered and below macOS's temporary-port range, s
|
|
|
50
50
|
IDLE_SECONDS = 2 * 3600
|
|
51
51
|
PING = "/hv-ping"
|
|
52
52
|
MARK = b"hivey-agent-map"
|
|
53
|
-
VERSION = b"office-
|
|
53
|
+
VERSION = b"office-12" # bump when the server gains actions, so `ensure` replaces an older one
|
|
54
54
|
OFFICE_EVERY = 300 # seconds between full office refreshes (every terminal re-summarized) while its page is open
|
|
55
55
|
OFFICE_LIVE = 60 # seconds between live passes (status, context, screen; only changed statuses summarized)
|
|
56
56
|
OFFICE_WATCHED = 600 # the page counts as open for this long after its last poll
|
|
@@ -498,10 +498,14 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|
|
498
498
|
if str(req["space"]) not in ("random", "1", "2", "3", "4", "5", "6"):
|
|
499
499
|
return self.answer(400, b'{"ok":false,"error":"space: random or 1..6"}')
|
|
500
500
|
cur["space"] = str(req["space"])
|
|
501
|
+
if "track" in req: # the music: "random" (new each load, then the next) or a track "1".."10"
|
|
502
|
+
if not re.fullmatch(r"random|[1-9]|10", str(req["track"])):
|
|
503
|
+
return self.answer(400, b'{"ok":false,"error":"track: random or 1..10"}')
|
|
504
|
+
cur["track"] = str(req["track"])
|
|
501
505
|
if "ships" in req: # the ship positions you dragged on the office page
|
|
502
506
|
cur["ships"] = clean_ships(req["ships"])
|
|
503
507
|
OFFICE_SETTINGS.write_text(json.dumps(cur))
|
|
504
|
-
return self.answer(200, json.dumps({"ok": True, "every": office_every(), "space": cur.get("space"),
|
|
508
|
+
return self.answer(200, json.dumps({"ok": True, "every": office_every(), "space": cur.get("space"), "track": cur.get("track"),
|
|
505
509
|
"ships": cur.get("ships", {})}).encode())
|
|
506
510
|
every = office_every()
|
|
507
511
|
# a page load: a quick pass when updating every minute, a full one otherwise; β³: always full
|
|
@@ -511,7 +515,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|
|
511
515
|
Handler.office_full = time.time()
|
|
512
516
|
start_office_refresh(quick=quick)
|
|
513
517
|
return self.answer(200, json.dumps({"ok": True, "started": True, "every": every,
|
|
514
|
-
"space": office_settings().get("space"),
|
|
518
|
+
"space": office_settings().get("space"), "track": office_settings().get("track"),
|
|
515
519
|
"ships": clean_ships(office_settings().get("ships"))}).encode())
|
|
516
520
|
if self.path == "/hv-office-action":
|
|
517
521
|
try:
|