agent-yes 1.306.3 → 1.307.0

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.
Files changed (52) hide show
  1. package/README.md +1 -0
  2. package/dist/{SUPPORTED_CLIS-Dvgot0oL.js → SUPPORTED_CLIS-BOGmmIrH.js} +3 -3
  3. package/dist/{SUPPORTED_CLIS-XUv7pAhg.js → SUPPORTED_CLIS-qL9_2DZ8.js} +2 -2
  4. package/dist/{agentShare-DHslHOe9.js → agentShare-C2oXrGvf.js} +4 -4
  5. package/dist/{callback-BnPh1ipj.js → callback-CNL-PGwh.js} +4 -4
  6. package/dist/{callback-BbDa82Yw.js → callback-ie8yyKma.js} +3 -3
  7. package/dist/cli.js +8 -8
  8. package/dist/{cmdPs-D_9k-_up.js → cmdPs-CfR5qCiO.js} +4 -4
  9. package/dist/index.js +2 -2
  10. package/dist/{notifyDaemon-Dsb009Id.js → notifyDaemon-DcAbvP43.js} +4 -4
  11. package/dist/{parentPingLoop-cXg1hXg0.js → parentPingLoop-BYT4XgfN.js} +2 -2
  12. package/dist/{remotes-BsMGvAay.js → remotes-CAZymHd7.js} +2 -2
  13. package/dist/{remotes-BqLoB5GR.js → remotes-W6NhMDfP.js} +1 -1
  14. package/dist/{roomReplyAlias-B-v76TA8.js → roomReplyAlias-B1EJft2d.js} +2 -2
  15. package/dist/roomReplyAlias-BeGVkAlc.js +6 -0
  16. package/dist/{rustBinary-BaadP-ZC.js → rustBinary-BjsZbiv5.js} +2 -2
  17. package/dist/{rustBinary-0BGlZPM2.js → rustBinary-CXQGcJEm.js} +2 -2
  18. package/dist/{schedule-CEZ-hTWV.js → schedule-zacFV53l.js} +49 -8
  19. package/dist/{schedulesCli-CLqieyQZ.js → schedules-BvwTGXU2.js} +2 -339
  20. package/dist/schedulesCli-Donh0LS2.js +343 -0
  21. package/dist/{serve-CuqQMmlO.js → serve-C38WYmzz.js} +35 -28
  22. package/dist/{serveRust-BfWkeL6T.js → serveRust-76_apYb8.js} +1 -1
  23. package/dist/{setup-D2hLlUYT.js → setup-CeAisuhv.js} +4 -4
  24. package/dist/{shareCmd-DbMp0rph.js → shareCmd-foO5MbJp.js} +6 -6
  25. package/dist/{spawnGate-I4p2fbz7.js → spawnGate-DhPgMs0Y.js} +1 -1
  26. package/dist/{spawnGate-3YSXiRFS.js → spawnGate-nUrmf4dd.js} +2 -2
  27. package/dist/{subcommands-7SrEP-BA.js → subcommands-DE31Tfv_.js} +24 -24
  28. package/dist/{subcommands-_Neez7D-.js → subcommands-DLQEC24N.js} +3 -3
  29. package/dist/{systemPathLink-Y3iC7bYV.js → systemPathLink-DI9WdoqQ.js} +1 -1
  30. package/dist/{terminal-iUqKIceC.js → terminal-CBbp6PfB.js} +2 -2
  31. package/dist/{todoCli-uJ3nK9j4.js → todoCli-BllShFnc.js} +1 -1
  32. package/dist/{tray-CLktEN3G.js → tray-RIjHSw7z.js} +1 -1
  33. package/dist/trayApp-BSOmax2E.js +5 -0
  34. package/dist/{trayApp-l9q9To-G.js → trayApp-C9SZOPpw.js} +2 -2
  35. package/dist/{ts-BLBWiX6i.js → ts-CO1H1P2R.js} +3 -3
  36. package/dist/{versionChecker-Dt2Aewei.js → versionChecker-CG--tQsV.js} +2 -2
  37. package/dist/{webrtcRemote-C3xQyf3u.js → webrtcRemote-B4pwES4i.js} +1 -1
  38. package/dist/{widget-_K5rPsLe.js → widget-CI7BtN94.js} +3 -3
  39. package/dist/{workspaceConfig-DBgsu81B.js → workspaceConfig-DjEklzxf.js} +1 -1
  40. package/dist/{ws-BCJF2ZKx.js → ws-DLJSBws6.js} +3 -3
  41. package/dist/{ws-BaBtzqo_.js → ws-W5nWHjDt.js} +4 -4
  42. package/lab/ui/console-logic.js +2 -2
  43. package/lab/ui/device-sync.js +209 -0
  44. package/lab/ui/device-transfer.js +99 -0
  45. package/lab/ui/index.html +129 -40
  46. package/lab/ui/sw.js +2 -0
  47. package/package.json +3 -1
  48. package/ts/schedule.ts +51 -1
  49. package/ts/scheduleSummary.bun.spec.ts +74 -0
  50. package/ts/serve.ts +11 -0
  51. package/dist/roomReplyAlias-BzWUBkQy.js +0 -6
  52. package/dist/trayApp-oEZBU7Cx.js +0 -5
package/lab/ui/index.html CHANGED
@@ -324,7 +324,8 @@
324
324
  border: 1px solid var(--line);
325
325
  border-radius: 8px;
326
326
  padding: 4px;
327
- min-width: 140px;
327
+ min-width: min(210px, 85vw);
328
+ white-space: nowrap;
328
329
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
329
330
  }
330
331
  .rmenupanel[hidden] {
@@ -383,6 +384,7 @@
383
384
  }
384
385
  /* A viewer can't steer/share — hide the composer, key bar and every agent
385
386
  action in the ⋯ menu (Share/Stop/Restart/Kill). View prefs stay. */
387
+ .app.readonly-agent .input-tools-toggle,
386
388
  .app.readonly-agent .composer,
387
389
  .app.readonly-agent .keybar,
388
390
  .app.readonly-agent .rmenuact {
@@ -737,6 +739,7 @@
737
739
  }
738
740
  #q {
739
741
  flex: 1;
742
+ min-width: 0;
740
743
  background: transparent;
741
744
  border: 0;
742
745
  outline: 0;
@@ -939,7 +942,8 @@
939
942
  outline: none;
940
943
  }
941
944
  .omni-results {
942
- max-height: 52vh;
945
+ max-height: min(52vh, calc(85dvh - 100px));
946
+ padding-bottom: 6px;
943
947
  overflow-y: auto;
944
948
  }
945
949
  .omni-row {
@@ -1190,7 +1194,10 @@
1190
1194
  min-width: 150px;
1191
1195
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
1192
1196
  }
1193
- .viewmenupanel[hidden] {
1197
+ #sync-dialog { max-width: min(32rem, 90vw); max-height: 80vh; overflow: auto; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; }
1198
+ #sync-dialog button { cursor: pointer; margin-block: 4px; }
1199
+ #sync-dialog::backdrop { background: #0008; }
1200
+ #device-sync[hidden], .viewmenupanel[hidden] {
1194
1201
  display: none;
1195
1202
  }
1196
1203
  .viewmenuitem {
@@ -1260,13 +1267,15 @@
1260
1267
  }
1261
1268
 
1262
1269
  .list {
1270
+ scroll-padding-block: 2px;
1271
+ padding-bottom: 2px;
1263
1272
  overflow-y: auto;
1264
1273
  flex: 1;
1265
1274
  min-height: 0;
1266
1275
  /* clear the home-indicator / gesture bar so the last row stays tappable,
1267
1276
  plus room for the floating New-agent FAB parked at the bottom-right —
1268
1277
  without it the last row can never be scrolled out from under the button. */
1269
- padding-bottom: calc(var(--sab) + 60px);
1278
+ margin-bottom: calc(var(--sab) + 54px);
1270
1279
  }
1271
1280
  .row {
1272
1281
  padding: 11px 18px;
@@ -1296,7 +1305,7 @@
1296
1305
  background: var(--panel);
1297
1306
  }
1298
1307
  .row.sel {
1299
- background: var(--panel);
1308
+ background: color-mix(in srgb, var(--accent) 18%, var(--panel));
1300
1309
  box-shadow: inset 3px 0 0 var(--accent);
1301
1310
  }
1302
1311
  /* A human peer (not you) is watching this agent: yellow, mirrored on the
@@ -1307,7 +1316,7 @@
1307
1316
  background: color-mix(in srgb, var(--peer) 7%, transparent);
1308
1317
  }
1309
1318
  .row.sel.peerfocus {
1310
- background: var(--panel);
1319
+ background: color-mix(in srgb, var(--accent) 18%, var(--panel));
1311
1320
  box-shadow:
1312
1321
  inset 3px 0 0 var(--accent),
1313
1322
  inset -3px 0 0 var(--peer);
@@ -1588,7 +1597,11 @@
1588
1597
  font-family: var(--mono);
1589
1598
  font-size: 11.5px;
1590
1599
  color: var(--green);
1591
- flex: none;
1600
+ flex: 0 1 34%;
1601
+ min-width: 0;
1602
+ overflow: hidden;
1603
+ white-space: nowrap;
1604
+ text-overflow: ellipsis;
1592
1605
  }
1593
1606
  .crow .cname {
1594
1607
  font-weight: 600;
@@ -1874,6 +1887,9 @@
1874
1887
  border-top: 1px solid var(--line);
1875
1888
  background: var(--panel);
1876
1889
  }
1890
+ .app.show-input-tools:not(.readonly-agent) .keybar,
1891
+ .app.show-input-tools:not(.readonly-agent) .composer { display: flex; }
1892
+ @media (pointer: coarse), (max-width: 720px) { .input-tools-toggle { display: none; } }
1877
1893
  .composer textarea {
1878
1894
  flex: 1;
1879
1895
  min-width: 0;
@@ -2169,6 +2185,7 @@
2169
2185
  share QR codes render offline under `ay serve --http`. Classic script:
2170
2186
  defines the global `qrcode`. -->
2171
2187
  <script src="./qrcode.js"></script>
2188
+
2172
2189
  <script type="module">
2173
2190
  // codehost room transport — vendored from codehost's `bun run build:lib`.
2174
2191
  // Loaded as a module (deferred), so the classic script below awaits the
@@ -2179,6 +2196,13 @@
2179
2196
  </script>
2180
2197
  </head>
2181
2198
  <body>
2199
+ <dialog id="sync-dialog" aria-labelledby="sync-title">
2200
+ <h2 id="sync-title">Sync devices</h2>
2201
+ <p>Open this on two devices signed in to the same account. Sync now exchanges saved room access tokens, agent status and schedule times directly between them. Use devices you trust.</p>
2202
+ <p>Copies stay on each device for offline use. Jobs run on their original host.</p>
2203
+ <button class="pair">Sync now</button> <button class="forget">Clear saved copies</button> <button class="close">Close</button>
2204
+ <p role="status"></p><div class="copies"></div>
2205
+ </dialog>
2182
2206
  <div class="app">
2183
2207
  <div class="left">
2184
2208
  <div class="head">
@@ -2220,11 +2244,12 @@
2220
2244
  <span class="mag">⌕</span>
2221
2245
  <input
2222
2246
  id="q"
2223
- placeholder="filter… repo:agent-yes claude (space = AND)"
2247
+ placeholder="Filter agents…"
2224
2248
  aria-label="Filter agents by repo, CLI, or title"
2225
2249
  autocomplete="off"
2226
2250
  autofocus
2227
2251
  />
2252
+ <button type="button" class="viewbtn" id="open-search" aria-label="Search agents and commands">Search</button>
2228
2253
  </div>
2229
2254
  <div class="meta">
2230
2255
  <span class="metaleft">
@@ -2249,10 +2274,10 @@
2249
2274
  type="button"
2250
2275
  title="fold subagent trees"
2251
2276
  >
2252
- ⊞ subs
2277
+ Expand subagents
2253
2278
  </button>
2254
2279
  <button id="sortbtn" class="viewmenuitem" type="button" title="cycle sort order">
2255
- ⇅ state
2280
+ Sort by state
2256
2281
  </button>
2257
2282
  <button
2258
2283
  id="stalebtn"
@@ -2262,15 +2287,20 @@
2262
2287
  aria-checked="false"
2263
2288
  title="show stale stopped agents (exited over 5 minutes ago)"
2264
2289
  >
2265
- ◌ stale
2290
+ Show stopped agents
2291
+ </button>
2292
+ <button
2293
+ id="idle-filter" class="viewmenuitem" type="button" role="checkbox" aria-checked="false">
2294
+ Hide agents idle over a day
2266
2295
  </button>
2296
+ <button hidden id="device-sync" class="viewmenuitem" type="button">Sync devices…</button>
2267
2297
  <button
2268
2298
  id="portsbtn"
2269
2299
  class="viewmenuitem"
2270
2300
  type="button"
2271
2301
  title="manage exposed localhost ports"
2272
2302
  >
2273
- ⇄ ports
2303
+ Exposed ports
2274
2304
  </button>
2275
2305
  <button
2276
2306
  id="rguibtn"
@@ -2278,7 +2308,7 @@
2278
2308
  type="button"
2279
2309
  title="open the agent graph view (/r/) for this fleet"
2280
2310
  >
2281
- ⌗ graph
2311
+ Agent graph
2282
2312
  </button>
2283
2313
  </div>
2284
2314
  </span>
@@ -2343,6 +2373,7 @@
2343
2373
  <button type="button" id="fontUp" aria-label="larger font">A+</button>
2344
2374
  </span>
2345
2375
  </div>
2376
+ <label class="rmenuitem input-tools-toggle"><input type="checkbox" id="input-tools"> Terminal input tools</label>
2346
2377
  <div class="rmenusep"></div>
2347
2378
  <label class="rmenuitem"
2348
2379
  ><input type="checkbox" id="perfToggle" /> <span>Perf HUD</span></label
@@ -2551,7 +2582,7 @@
2551
2582
  <div class="omnibox">
2552
2583
  <input
2553
2584
  id="omni-input"
2554
- placeholder='Search agents &amp; workspaces, then output… · "/" commands · /ws workspaces'
2585
+ placeholder='Search agents, workspaces or /commands'
2555
2586
  spellcheck="false"
2556
2587
  autocapitalize="off"
2557
2588
  autocomplete="off"
@@ -2581,13 +2612,10 @@
2581
2612
  age,
2582
2613
  matches,
2583
2614
  nextIndex,
2584
- identContext,
2585
- compactIdent,
2586
- IDENT_CAP,
2615
+ identFields,
2587
2616
  rowTitle,
2588
2617
  isTransientTitle,
2589
2618
  fullIdent,
2590
- hasIdent,
2591
2619
  deviceCount,
2592
2620
  layeredRows,
2593
2621
  foldSummaries,
@@ -5673,6 +5701,7 @@ my.translate = async (text, lang) => {
5673
5701
  // to the IME/autocorrect glitches that dog xterm's hidden input. Enter
5674
5702
  // sends text + a carriage return in one write (identical to typing then ↵);
5675
5703
  // Shift+Enter inserts a literal newline.
5704
+ $("input-tools").onchange = (event) => document.querySelector(".app").classList.toggle("show-input-tools", event.target.checked);
5676
5705
  (function composerBoot() {
5677
5706
  const form = $("composer"),
5678
5707
  ta = $("cmpin");
@@ -5974,9 +6003,19 @@ my.translate = async (text, lang) => {
5974
6003
  const isStaleStopped = (e) =>
5975
6004
  e.status === "exited" &&
5976
6005
  Date.now() - (e.last_active_at || e.started_at || 0) > STALE_STOP_MS;
6006
+ let hideOldIdle = localStorage.getItem("ay.hideOldIdle") === "1";
6007
+ $("idle-filter").onclick = () => {
6008
+ hideOldIdle = !hideOldIdle;
6009
+ localStorage.setItem("ay.hideOldIdle", hideOldIdle ? "1" : "0");
6010
+ renderList();
6011
+ };
5977
6012
  function pruneStale(list) {
5978
- if (showStale) return list;
5979
- const keep = new Set(list.filter((e) => !isStaleStopped(e) || e._key === sel));
6013
+ const cutoff = Date.now() - 86400000;
6014
+ const keep = new Set(list.filter((e) => {
6015
+ const last = e.last_active_at || e.started_at;
6016
+ return e._key === sel || ((showStale || !isStaleStopped(e)) &&
6017
+ !(hideOldIdle && e.status === "idle" && last && last < cutoff));
6018
+ }));
5980
6019
  for (let grew = true; grew;) {
5981
6020
  grew = false;
5982
6021
  const wanted = new Set();
@@ -6178,7 +6217,9 @@ my.translate = async (text, lang) => {
6178
6217
  const toks = $("q").value.trim().split(/\s+/).filter(Boolean);
6179
6218
  // Build the full signalling-server > rooms > peers > agents > subagents
6180
6219
  // tree. Single-node room/peer layers fold away; ≥2 become ├ └ │ branches.
6181
- const fullRows = layeredRows(orderedEntries(toks));
6220
+ const fullRows = layeredRows(orderedEntries(toks), { showHost: true });
6221
+ const connected = [...sources.values()].some((s) => s.live);
6222
+ const emptyLabel = entries.length && toks.length ? "No matching agents" : connected ? "No agents to show" : ($("conn").textContent || "Connecting…").replace(/^●\s*/, "");
6182
6223
  const agentRows = fullRows.filter((r) => r.kind === "agent");
6183
6224
  // Fold: summarize each root's hidden descendants, then drop subagent rows
6184
6225
  // (any agent row with a parent agent). The count still reports every
@@ -6189,20 +6230,19 @@ my.translate = async (text, lang) => {
6189
6230
  : fullRows;
6190
6231
  shownAgentCount = agentRows.length;
6191
6232
  updateSummary(); // one consolidated "agents · rooms · peers" badge
6192
- $("foldbtn").textContent = foldSubs ? "⊞ subs" : "⊟ subs";
6233
+ $("foldbtn").textContent = foldSubs ? "Expand subagents" : "Collapse subagents";
6234
+ $("idle-filter").setAttribute("aria-checked", String(hideOldIdle));
6235
+ $("idle-filter").classList.toggle("on", hideOldIdle);
6193
6236
  $("stalebtn").classList.toggle("on", showStale);
6194
6237
  $("stalebtn").setAttribute("aria-checked", showStale ? "true" : "false");
6195
- $("stalebtn").textContent = showStale ? "◉ stale" : "◌ stale";
6238
+ $("stalebtn").textContent = showStale ? "Hide stopped agents" : "Show stopped agents";
6196
6239
  $("foldbtn").classList.toggle("on", !foldSubs);
6197
6240
  // Show the active sort mode on the button so it's self-documenting; the
6198
6241
  // default ("state") is also highlighted to hint it's the implicit order.
6199
- $("sortbtn").textContent = `⇅ ${sortMode}`;
6242
+ $("sortbtn").textContent = `Sort by ${sortMode}`;
6200
6243
  $("sortbtn").classList.toggle("on", sortMode !== "state");
6201
- // identContext blanks any field uniform across the shown list (so a
6202
- // single-device fleet shows no device); multiDevice gates the detailed
6203
- // host tag so it only appears when machines are actually mixed.
6244
+ // The detailed host tag only earns space when multiple devices are shown.
6204
6245
  const shownEntries = agentRows.map((r) => r.entry);
6205
- const ctx = identContext(shownEntries);
6206
6246
  const multiDevice = deviceCount(shownEntries) > 1;
6207
6247
  if (compactList) {
6208
6248
  $("list").innerHTML =
@@ -6214,13 +6254,15 @@ my.translate = async (text, lang) => {
6214
6254
  // (spinner / "· done" stamp) doesn't replace it on the next draw.
6215
6255
  if (e.title && !isTransientTitle(e.title)) topicTitles.set(e._key, e.title);
6216
6256
  const t = rowTitle(e, topicTitles.get(e._key));
6217
- const id = compactIdent(e, ctx, IDENT_CAP, r.parentEntry);
6257
+ const fields = identFields(e);
6258
+ const path = [fields.owner, fields.repo, fields.branch].filter(Boolean).join("/");
6259
+ const id = [path, fields.sub].filter(Boolean).join(" → ") || `PID ${e.pid}`;
6218
6260
  const cli = cliLabel(e);
6219
6261
  return `<div class="row crow ${e._key === sel ? "sel" : ""}${rowFlags(e)}" data-key="${esc(e._key)}">${rowIoHeat(e)}
6220
6262
  ${r.branch ? `<span class="tbranch">${esc(r.branch)}</span>` : ""}
6221
6263
  ${pinMarkHtml(e)}
6222
6264
  <span class="dot ${esc(e.status)}"></span>
6223
- ${hasIdent(id) ? `<span class="cident" title="${esc(fullIdent(e))}">${esc(id)}</span>` : ""}
6265
+ <span class="cident" title="${esc(fullIdent(e))}">${esc(id)}</span>
6224
6266
  ${cli ? `<span class="cname">${esc(cli)}</span>` : ""}
6225
6267
  <span class="ctitle ${e.title ? "" : "dim"}" title="${esc(t)}">${esc(t)}</span>
6226
6268
  ${foldChipHtml(e)}
@@ -6230,7 +6272,7 @@ my.translate = async (text, lang) => {
6230
6272
  ${peerChipHtml(e)}
6231
6273
  <span class="age">${age(e)}</span></div>`;
6232
6274
  })
6233
- .join("") || `<div class="empty">no match</div>`;
6275
+ .join("") || `<div class="empty">${esc(emptyLabel)}</div>`;
6234
6276
  renderSendWires(); // rows were replaced — re-draw the overlay (see below)
6235
6277
  return;
6236
6278
  }
@@ -6270,7 +6312,7 @@ my.translate = async (text, lang) => {
6270
6312
  <div class="rowtags">${tags}</div>
6271
6313
  </div>`;
6272
6314
  })
6273
- .join("") || `<div class="empty">no match</div>`;
6315
+ .join("") || `<div class="empty">${esc(emptyLabel)}</div>`;
6274
6316
  // The innerHTML above replaced every row — and with them the wire overlay
6275
6317
  // (a child of #list). Re-draw it against the fresh rects, or an in-flight
6276
6318
  // wire would vanish on the next list render.
@@ -6389,6 +6431,7 @@ my.translate = async (text, lang) => {
6389
6431
  } else {
6390
6432
  sel = e._key;
6391
6433
  renderList();
6434
+ $("list").querySelector(".row.sel")?.scrollIntoView({ block: "nearest" });
6392
6435
  }
6393
6436
  }
6394
6437
  }
@@ -6450,6 +6493,7 @@ my.translate = async (text, lang) => {
6450
6493
  const pid = e.pid;
6451
6494
  const tx = txFor(e);
6452
6495
  renderList();
6496
+ $("list").querySelector(".row.sel")?.scrollIntoView({ block: "nearest" });
6453
6497
  // Mobile: flip the single-column layout to the terminal ("detail") pane.
6454
6498
  // Done BEFORE term.open below so xterm measures a visible container.
6455
6499
  // Entering detail FROM the list gets a history entry, so the hardware
@@ -7128,7 +7172,7 @@ my.translate = async (text, lang) => {
7128
7172
  location.href = "/r/" + frag;
7129
7173
  });
7130
7174
  // Cycle the sort order: state → created → identity → state.
7131
- // "◌ stale" checkbox: show/hide stopped agents older than 5 min.
7175
+ // "Show stopped agents" checkbox: show/hide stopped agents older than 5 min.
7132
7176
  $("stalebtn").addEventListener("click", () => {
7133
7177
  showStale = !showStale;
7134
7178
  localStorage.setItem("ay.showStale", showStale ? "1" : "0");
@@ -7376,6 +7420,8 @@ my.translate = async (text, lang) => {
7376
7420
  let omniPreviewTimer = null;
7377
7421
  const omniOpen = () => $("omni").style.display !== "none";
7378
7422
 
7423
+ $("open-search").textContent = IS_MAC ? "Search ⌘K" : "Search Ctrl+K";
7424
+ $("open-search").onclick = openOmni;
7379
7425
  function openOmni() {
7380
7426
  omniReturnSel = sel;
7381
7427
  omniWasDetail = document.querySelector(".app").classList.contains("show-detail");
@@ -7811,7 +7857,7 @@ my.translate = async (text, lang) => {
7811
7857
  <span class="dot ${esc(e.status)}"></span>
7812
7858
  <div class="omni-main">
7813
7859
  <div class="omni-title">${esc(e.title || cliLabel(e) || ident(e) || "agent")}</div>
7814
- <div class="omni-sub">${esc((e.cli || "") + " · " + agentDir(e))}</div>
7860
+ <div class="omni-sub">${esc([e.cli, "PID " + e.pid, agentDir(e)].filter(Boolean).join(" · "))}</div>
7815
7861
  ${snip}
7816
7862
  </div></div>`;
7817
7863
  })
@@ -8182,6 +8228,40 @@ my.translate = async (text, lang) => {
8182
8228
  }
8183
8229
  localStorage.setItem(ROOMS_KEY, JSON.stringify(r));
8184
8230
  };
8231
+ if (location.pathname.startsWith("/w/")) {
8232
+ const btn = $("device-sync");
8233
+ btn.hidden = false;
8234
+ let openSync;
8235
+ btn.onclick = async () => {
8236
+ const { mountDeviceSync } = await import("./device-sync.js");
8237
+ openSync ??= mountDeviceSync({
8238
+ dialog: $("sync-dialog"),
8239
+ connect: async (r) => {
8240
+ const existing = loadRooms()[r.name];
8241
+ if (existing && (existing.token !== r.token || existing.host !== r.host)) return false;
8242
+ await addRoomSource(r.name, r.token, r.host);
8243
+ return true;
8244
+ },
8245
+ getLocal: async () => {
8246
+ const rooms = Object.entries(loadRooms()).map(([name, r]) => ({
8247
+ name, token: r.token, host: r.host || SIG_DEFAULT, ts: r.ts || Date.now(),
8248
+ }));
8249
+ const agents = entries.map(e => ({ room: e._src, pid: e.pid, status: e.status || "unknown" }));
8250
+ const schedules = [], unavailable = [];
8251
+ await Promise.all([...sources.values()].filter(s => !s.readonly).map(async s => {
8252
+ try {
8253
+ if (!s.live || !s.tx) throw Error();
8254
+ const jobs = await s.tx.fetchJSON("/api/schedule-summary");
8255
+ if (!Array.isArray(jobs)) throw Error();
8256
+ for (const j of jobs) schedules.push({ host:s.id, name:j.name, cron:j.cron, tz:j.tz, enabled:j.enabled });
8257
+ } catch { unavailable.push(s.id); }
8258
+ }));
8259
+ return { rooms, agents, schedules, unavailable };
8260
+ },
8261
+ });
8262
+ await openSync();
8263
+ };
8264
+ }
8185
8265
  const dropRoom = (room) => {
8186
8266
  const r = loadRooms();
8187
8267
  delete r[room];
@@ -8640,7 +8720,7 @@ my.translate = async (text, lang) => {
8640
8720
  .map(
8641
8721
  (n) => `<div class="ritem ${roomLive(n) ? "cur" : ""}">
8642
8722
  ${roomStatus(n)}
8643
- <span class="rname" data-room="${esc(n)}">${esc(n)}</span>
8723
+ <span class="rname" data-room="${esc(n)}" title="${esc(n)}">${esc([...new Set(roomSources(n).map((s) => hostStats.get(s.id)?.host).filter(Boolean))].join(", ") || n)}</span>
8644
8724
  <span class="rhost">${esc(r[n].host)}</span>
8645
8725
  ${resChipHtml(n)}
8646
8726
  <span class="rx" data-del="${esc(n)}" title="forget">✕</span></div>`,
@@ -8648,7 +8728,7 @@ my.translate = async (text, lang) => {
8648
8728
  .join("")
8649
8729
  : `<div class="empty2">no saved rooms — paste a share link below</div>`;
8650
8730
  $("rooms").innerHTML = `<div class="rtitle">rooms · stored on this device</div>${items}
8651
- <div class="radd"><input id="roomin" placeholder="room:token or https://…/#room:token" /><button id="roomadd">add</button></div>
8731
+ <div class="radd"><input id="roomin" placeholder="room:token or https://…/#room:token" /><button id="roomadd">Add</button></div>
8652
8732
  <div class="rconnect">new here? install agent-yes (bun or npm, auto):
8653
8733
  <code id="cmdinstall" class="copy" title="click to copy">curl -fsSL https://agent-yes.com/setup.sh | sh</code>
8654
8734
  <span style="opacity:.6">Windows:</span>
@@ -8931,10 +9011,10 @@ my.translate = async (text, lang) => {
8931
9011
  <div class="nfield"><label>Prompt — optional</label><textarea id="nf-prompt" rows="3" placeholder="initial message to send the agent…"></textarea></div>
8932
9012
  <div class="lrow">
8933
9013
  <button class="lfleet" id="nf-go">▷ Launch</button>
8934
- <button class="lcancel" id="nf-cancel">cancel</button>
9014
+ <button class="lcancel" id="nf-cancel">Cancel</button>
8935
9015
  </div>
8936
9016
  <div id="nf-hook" class="lhint" style="display:none"></div>
8937
- <div class="lhint">POST /api/spawn on this machine. ${IS_MAC ? "⌘" : "Ctrl"}+Enter to launch.</div></div>`;
9017
+ <div class="lhint">${IS_MAC ? "⌘" : "Ctrl"}+Enter to launch.</div></div>`;
8938
9018
  $("newform").style.display = "flex";
8939
9019
  setTimeout(() => $("nf-prompt")?.focus(), 0);
8940
9020
  // Retarget the form when the user picks another machine — the spawn-hook
@@ -9066,7 +9146,10 @@ my.translate = async (text, lang) => {
9066
9146
  const parsed = parseRepoInput($("nf-repo")?.value || "");
9067
9147
  const row = $("nf-branch-row");
9068
9148
  const hint = $("nf-branch-hint");
9069
- nfRemoteBranches = null;
9149
+ if (parsed?.kind !== "github") {
9150
+ delete row.dataset.lookup;
9151
+ nfRemoteBranches = null;
9152
+ }
9070
9153
  if (row) row.style.display = parsed ? "" : "none";
9071
9154
  updateProvisionCwd();
9072
9155
  if (!parsed) return;
@@ -9088,6 +9171,10 @@ my.translate = async (text, lang) => {
9088
9171
  }
9089
9172
  function loadBranchPicker(target, repo) {
9090
9173
  const dl = $("nf-branch-list");
9174
+ const row = $("nf-branch-row");
9175
+ const lookup = JSON.stringify([target?.id, repo]);
9176
+ if (row.dataset.lookup === lookup) return;
9177
+ row.dataset.lookup = lookup;
9091
9178
  const hint = $("nf-branch-hint");
9092
9179
  nfRemoteBranches = null;
9093
9180
  if (dl) dl.innerHTML = "";
@@ -9102,7 +9189,7 @@ my.translate = async (text, lang) => {
9102
9189
  .then((d) => {
9103
9190
  // user picked another repo meanwhile (value may be a URL — normalize)
9104
9191
  const cur = parseRepoInput($("nf-repo")?.value || "");
9105
- if (!cur || cur.kind !== "github" || `${cur.owner}/${cur.repo}` !== want) return;
9192
+ if (row !== $("nf-branch-row") || row.dataset.lookup !== lookup || !cur || cur.kind !== "github" || `${cur.owner}/${cur.repo}` !== want) return;
9106
9193
  const branches = (d && d.branches) || [];
9107
9194
  nfRemoteBranches = new Set(branches.filter((b) => b.remote).map((b) => b.name));
9108
9195
  if (dl)
@@ -9116,6 +9203,8 @@ my.translate = async (text, lang) => {
9116
9203
  updateProvisionCwd();
9117
9204
  })
9118
9205
  .catch(() => {
9206
+ if (row !== $("nf-branch-row") || row.dataset.lookup !== lookup) return;
9207
+ delete row.dataset.lookup;
9119
9208
  if (hint) hint.textContent = "branch list unavailable — type a branch name";
9120
9209
  });
9121
9210
  }
package/lab/ui/sw.js CHANGED
@@ -122,6 +122,8 @@ const SHELL = [
122
122
  "./",
123
123
  "./index.html",
124
124
  "./room-client.js",
125
+ "./device-sync.js",
126
+ "./device-transfer.js",
125
127
  "./console-logic.js",
126
128
  "./rtc.js",
127
129
  "./e2e.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.306.3",
3
+ "version": "1.307.0",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
@@ -65,6 +65,8 @@
65
65
  "!ts/terminal/*.spec.ts",
66
66
  "dist/**/*.js",
67
67
  "lab/ui/console-logic.js",
68
+ "lab/ui/device-sync.js",
69
+ "lab/ui/device-transfer.js",
68
70
  "lab/ui/e2e.d.ts",
69
71
  "lab/ui/e2e.js",
70
72
  "lab/ui/icon.svg",
package/ts/schedule.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import { execFile } from "node:child_process";
2
+ import { readFile } from "node:fs/promises";
3
+ import { promisify } from "node:util";
4
+ import { parseStore, storeFile } from "./schedules.ts";
1
5
  import { createHash } from "node:crypto";
2
6
  import { SUPPORTED_CLIS } from "./SUPPORTED_CLIS.ts";
3
7
  import { resolveSpawnCwd } from "./workspaceConfig.ts";
@@ -47,7 +51,53 @@ async function run(cmd: string[], capture = false): Promise<{ code: number; out:
47
51
  return { code: (await p.exited) ?? 1, out };
48
52
  }
49
53
 
54
+ /** The read-only timetable shared by the CLI and device sync. Process manager
55
+ * records also contain command arguments and environment; only project times and names. */
56
+ export async function scheduleSummary() {
57
+ const file = await readFile(storeFile(), "utf8").catch((err: NodeJS.ErrnoException) => {
58
+ if (err.code === "ENOENT") return null;
59
+ throw err;
60
+ });
61
+ const reminders = parseStore(file).entries.map(({ name, cron, tz, enabled }) => ({
62
+ name,
63
+ cron,
64
+ tz,
65
+ enabled,
66
+ }));
67
+ const ox = Bun.which("oxmgr");
68
+ if (!ox) return reminders;
69
+ await ensureNodeRuntime();
70
+ const { stdout } = await promisify(execFile)(ox, ["list", "--json"], {
71
+ encoding: "utf8",
72
+ timeout: 3000,
73
+ maxBuffer: 8 * 1024 * 1024,
74
+ env: liveEnv(),
75
+ });
76
+ const rows: { name?: string; cron_restart?: string; desired_state?: string }[] =
77
+ JSON.parse(stdout);
78
+ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
79
+ return [
80
+ ...rows.flatMap((row) =>
81
+ typeof row?.name === "string" &&
82
+ row.name.startsWith(SCHED_PREFIX) &&
83
+ typeof row.cron_restart === "string"
84
+ ? [{ name: row.name, cron: row.cron_restart, tz, enabled: row.desired_state !== "stopped" }]
85
+ : [],
86
+ ),
87
+ ...reminders,
88
+ ];
89
+ }
90
+
50
91
  export async function cmdSchedule(rest: string[]): Promise<number> {
92
+ if ((rest[0] === "list" || rest[0] === "ls") && rest[1] === "--json") {
93
+ try {
94
+ console.log(JSON.stringify(await scheduleSummary()));
95
+ return 0;
96
+ } catch {
97
+ console.error("ay schedule: timetable unavailable");
98
+ return 1;
99
+ }
100
+ }
51
101
  // On a bun-only box oxmgr's `#!/usr/bin/env node` launcher needs the node→bun
52
102
  // shim before ANY oxmgr call below can exec (same fix as serve-install).
53
103
  await ensureNodeRuntime();
@@ -68,7 +118,7 @@ export async function cmdSchedule(rest: string[]): Promise<number> {
68
118
  `Usage:\n` +
69
119
  ` ay schedule <when> <cli> [--cwd DIR] [--name N] [-- <prompt>]\n` +
70
120
  ` schedule a recurring agent\n` +
71
- ` ay schedule list list scheduled agents\n` +
121
+ ` ay schedule list list scheduled agents (--json for timetable metadata)\n` +
72
122
  ` ay schedule remove <name> remove one\n\n` +
73
123
  `<when> is a daily HH:MM (e.g. 10:00) or a 5-field cron ("0 10 * * *").\n` +
74
124
  `The agent runs once now and then on every tick, and survives reboot.\n\n` +
@@ -0,0 +1,74 @@
1
+ import { expect, test } from "bun:test";
2
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+
6
+ test.skipIf(process.platform === "win32")(
7
+ "schedule list --json exports only timetable metadata",
8
+ async () => {
9
+ const dir = await mkdtemp(path.join(tmpdir(), "ay-timetable-"));
10
+ try {
11
+ const store = path.join(dir, "schedules.json");
12
+ await writeFile(
13
+ store,
14
+ JSON.stringify({
15
+ entries: [
16
+ {
17
+ name: "reminder",
18
+ cron: "5 10 * * *",
19
+ tz: "UTC",
20
+ enabled: false,
21
+ message: "private example",
22
+ },
23
+ ],
24
+ }),
25
+ );
26
+ const command = path.join(dir, "oxmgr");
27
+ const rows = [
28
+ {
29
+ name: "agent-yes-cron-test",
30
+ cron_restart: "0 8 * * *",
31
+ args: ["private example"],
32
+ env: { EXAMPLE: "private example" },
33
+ },
34
+ { name: "other-job", cron_restart: "0 9 * * *" },
35
+ ];
36
+ await writeFile(
37
+ command,
38
+ "#!/bin/sh\n[ \"$*\" = 'list --json' ] || exit 1\nprintf '%s\\n' '" +
39
+ JSON.stringify(rows) +
40
+ "'\n",
41
+ { mode: 0o755 },
42
+ );
43
+ const run = () =>
44
+ Bun.spawn([process.execPath, "ts/cli.ts", "schedule", "list", "--json"], {
45
+ env: {
46
+ ...process.env,
47
+ PATH: dir + path.delimiter + process.env.PATH,
48
+ AY_SCHEDULES_STORE: store,
49
+ TZ: "UTC",
50
+ },
51
+ stdout: "pipe",
52
+ stderr: "pipe",
53
+ });
54
+ const ok = run();
55
+ expect(await new Response(ok.stdout).json()).toEqual([
56
+ {
57
+ name: "agent-yes-cron-test",
58
+ cron: "0 8 * * *",
59
+ tz: "UTC",
60
+ enabled: true,
61
+ },
62
+ { name: "reminder", cron: "5 10 * * *", tz: "UTC", enabled: false },
63
+ ]);
64
+ expect(await ok.exited).toBe(0);
65
+ await writeFile(command, "#!/bin/sh\necho 'private example' >&2\nexit 1\n");
66
+ const failed = run();
67
+ expect(await new Response(failed.stdout).text()).toBe("");
68
+ expect((await new Response(failed.stderr).text()).trim()).toBe("ay schedule: timetable unavailable");
69
+ expect(await failed.exited).toBe(1);
70
+ } finally {
71
+ await rm(dir, { recursive: true, force: true });
72
+ }
73
+ },
74
+ );
package/ts/serve.ts CHANGED
@@ -3411,6 +3411,15 @@ export async function cmdServe(rest: string[]): Promise<number> {
3411
3411
  });
3412
3412
  }
3413
3413
 
3414
+ if (req.method === "GET" && p === "/api/schedule-summary") {
3415
+ try {
3416
+ const { scheduleSummary } = await import("./schedule.ts");
3417
+ return Response.json(await scheduleSummary(), { headers: { "Cache-Control": "no-store" } });
3418
+ } catch {
3419
+ return new Response("Schedule unavailable", { status: 503 });
3420
+ }
3421
+ }
3422
+
3414
3423
  // GET /api/host — this machine as an ENVIRONMENT: identity + live health
3415
3424
  // (load, memory) + what the environment permits (capability flags, otoji
3416
3425
  // environment-node style). The /rgui viewer renders it as the host env node
@@ -5200,6 +5209,8 @@ export async function cmdServe(rest: string[]): Promise<number> {
5200
5209
  return serveUiFile("rgui/dist/main.js", "text/javascript; charset=utf-8");
5201
5210
  if (req.method === "GET" && p === "/r/main.js.map")
5202
5211
  return serveUiFile("rgui/dist/main.js.map", "application/json");
5212
+ if (req.method === "GET" && (p === "/device-sync.js" || p === "/device-transfer.js"))
5213
+ return serveUiFile(p.slice(1), "text/javascript; charset=utf-8");
5203
5214
  if (req.method === "GET" && p === "/room-client.js")
5204
5215
  return serveUiFile("room-client.js", "text/javascript; charset=utf-8");
5205
5216
  if (req.method === "GET" && p === "/console-logic.js")