agent-yes 1.99.0 → 1.100.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.
@@ -0,0 +1,8 @@
1
+ import "./ts-CUn393DD.js";
2
+ import "./logger-B9h0djqx.js";
3
+ import "./versionChecker-BWdncsn6.js";
4
+ import "./pidStore-DBjlqzo8.js";
5
+ import "./globalPidIndex-yVd3mbsV.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DIHMEdRx.js";
7
+
8
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-BECoCPV1.js";
1
+ import { t as CLIS_CONFIG } from "./ts-CUn393DD.js";
2
2
 
3
3
  //#region ts/SUPPORTED_CLIS.ts
4
4
  const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
5
5
 
6
6
  //#endregion
7
7
  export { SUPPORTED_CLIS as t };
8
- //# sourceMappingURL=SUPPORTED_CLIS-eIjVu8HF.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-DIHMEdRx.js.map
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import { n as logger } from "./logger-B9h0djqx.js";
3
- import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-pct2j3wR.js";
3
+ import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-BWdncsn6.js";
4
4
  import { argv } from "process";
5
5
  import { execFileSync, spawn } from "child_process";
6
6
  import ms from "ms";
@@ -482,7 +482,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
482
482
  {
483
483
  const rawArg = process.argv[2];
484
484
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
485
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-D3Z9cD9u.js");
485
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-dnjUZ9nY.js");
486
486
  if (isHelpFlag && process.argv.length === 3) {
487
487
  cmdHelp();
488
488
  process.exit(0);
@@ -515,7 +515,7 @@ if (config.useRust) {
515
515
  }
516
516
  }
517
517
  if (rustBinary) {
518
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BGUPuqya.js");
518
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C-cenkTG.js");
519
519
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
520
520
  if (config.verbose) {
521
521
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-BECoCPV1.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-CUn393DD.js";
2
2
  import "./logger-B9h0djqx.js";
3
- import "./versionChecker-pct2j3wR.js";
3
+ import "./versionChecker-BWdncsn6.js";
4
4
  import "./pidStore-DBjlqzo8.js";
5
5
  import "./globalPidIndex-yVd3mbsV.js";
6
6
 
@@ -1,11 +1,11 @@
1
- import "./ts-BECoCPV1.js";
1
+ import "./ts-CUn393DD.js";
2
2
  import "./logger-B9h0djqx.js";
3
- import "./versionChecker-pct2j3wR.js";
3
+ import "./versionChecker-BWdncsn6.js";
4
4
  import "./pidStore-DBjlqzo8.js";
5
5
  import "./globalPidIndex-yVd3mbsV.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-eIjVu8HF.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DIHMEdRx.js";
7
7
  import "./remotes-C3xPRtfg.js";
8
- import { c as readNotes, f as snapshotStatus, l as renderRawLog, m as writeToIpc, o as listRecords, r as controlCodeFromName, u as resolveOne } from "./subcommands-z8Y8gcD_.js";
8
+ import { c as readNotes, f as snapshotStatus, l as renderRawLog, m as writeToIpc, o as listRecords, r as controlCodeFromName, u as resolveOne } from "./subcommands-BKY3nQV4.js";
9
9
  import yargs from "yargs";
10
10
  import { mkdir, open, readFile, writeFile } from "fs/promises";
11
11
  import { homedir } from "os";
@@ -551,4 +551,4 @@ Options:
551
551
 
552
552
  //#endregion
553
553
  export { cmdServe };
554
- //# sourceMappingURL=serve-SQYFRbm3.js.map
554
+ //# sourceMappingURL=serve-C4fZSjh9.js.map
@@ -163,7 +163,7 @@ async function runSubcommand(argv) {
163
163
  case "restart": return await cmdRestart(rest);
164
164
  case "note": return await cmdNote(rest);
165
165
  case "serve": {
166
- const { cmdServe } = await import("./serve-SQYFRbm3.js");
166
+ const { cmdServe } = await import("./serve-C4fZSjh9.js");
167
167
  return cmdServe(rest);
168
168
  }
169
169
  case "setup": {
@@ -1452,4 +1452,4 @@ async function cmdStatus(rest) {
1452
1452
 
1453
1453
  //#endregion
1454
1454
  export { isSubcommand as a, readNotes as c, runSubcommand as d, snapshotStatus as f, isPidAlive as i, renderRawLog as l, writeToIpc as m, cmdHelp as n, listRecords as o, stopTipForCli as p, controlCodeFromName as r, matchKeyword as s, GRACEFUL_EXIT_COMMANDS as t, resolveOne as u };
1455
- //# sourceMappingURL=subcommands-z8Y8gcD_.js.map
1455
+ //# sourceMappingURL=subcommands-BKY3nQV4.js.map
@@ -1,6 +1,6 @@
1
1
  import "./logger-B9h0djqx.js";
2
2
  import "./globalPidIndex-yVd3mbsV.js";
3
3
  import "./remotes-C3xPRtfg.js";
4
- import { a as isSubcommand, c as readNotes, d as runSubcommand, f as snapshotStatus, i as isPidAlive, l as renderRawLog, m as writeToIpc, n as cmdHelp, o as listRecords, p as stopTipForCli, r as controlCodeFromName, s as matchKeyword, t as GRACEFUL_EXIT_COMMANDS, u as resolveOne } from "./subcommands-z8Y8gcD_.js";
4
+ import { a as isSubcommand, c as readNotes, d as runSubcommand, f as snapshotStatus, i as isPidAlive, l as renderRawLog, m as writeToIpc, n as cmdHelp, o as listRecords, p as stopTipForCli, r as controlCodeFromName, s as matchKeyword, t as GRACEFUL_EXIT_COMMANDS, u as resolveOne } from "./subcommands-BKY3nQV4.js";
5
5
 
6
6
  export { cmdHelp, isSubcommand, runSubcommand };
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-B9h0djqx.js";
2
- import { r as getInstalledPackage } from "./versionChecker-pct2j3wR.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-BWdncsn6.js";
3
3
  import { n as agentYesHome, t as PidStore } from "./pidStore-DBjlqzo8.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-CJxsoGdb.js";
5
5
  import { i as readGlobalPids } from "./globalPidIndex-yVd3mbsV.js";
@@ -1714,4 +1714,4 @@ function sleep(ms) {
1714
1714
 
1715
1715
  //#endregion
1716
1716
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1717
- //# sourceMappingURL=ts-BECoCPV1.js.map
1717
+ //# sourceMappingURL=ts-CUn393DD.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "agent-yes";
10
- var version = "1.99.0";
10
+ var version = "1.100.0";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -221,4 +221,4 @@ async function displayVersion() {
221
221
 
222
222
  //#endregion
223
223
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
224
- //# sourceMappingURL=versionChecker-pct2j3wR.js.map
224
+ //# sourceMappingURL=versionChecker-BWdncsn6.js.map
package/lab/ui/index.html CHANGED
@@ -52,14 +52,34 @@
52
52
  flex children actually shrink — without it overflow:auto never engages). */
53
53
  .app {
54
54
  display: grid;
55
- grid-template-columns: minmax(360px, 42%) 1fr;
55
+ grid-template-columns: var(--leftw, 42%) 1px 1fr;
56
56
  grid-template-rows: minmax(0, 1fr);
57
57
  height: 100vh;
58
58
  }
59
59
 
60
+ /* VSCode-style splitter: the visible divider stays 1px, but a ::before
61
+ overlay widens the pointer hit area to ~11px so it's easy to grab. */
62
+ .splitter {
63
+ position: relative;
64
+ background: var(--line);
65
+ cursor: col-resize;
66
+ z-index: 5;
67
+ }
68
+ .splitter::before {
69
+ content: "";
70
+ position: absolute;
71
+ top: 0;
72
+ bottom: 0;
73
+ left: -5px;
74
+ right: -5px;
75
+ }
76
+ .splitter:hover,
77
+ .splitter.drag {
78
+ background: var(--accent);
79
+ }
80
+
60
81
  /* ---- left: list ---- */
61
82
  .left {
62
- border-right: 1px solid var(--line);
63
83
  display: flex;
64
84
  flex-direction: column;
65
85
  min-width: 0;
@@ -453,8 +473,15 @@
453
473
  gap: 8px;
454
474
  padding: 6px 18px;
455
475
  }
476
+ .crow .cident {
477
+ font-family: var(--mono);
478
+ font-size: 11.5px;
479
+ color: var(--green);
480
+ flex: none;
481
+ }
456
482
  .crow .cname {
457
483
  font-weight: 600;
484
+ color: var(--purple);
458
485
  flex: none;
459
486
  }
460
487
  .crow .ctitle {
@@ -553,50 +580,6 @@
553
580
  color: var(--muted);
554
581
  font-size: 14px;
555
582
  }
556
- .composer {
557
- border-top: 1px solid var(--line);
558
- padding: 12px 16px;
559
- display: flex;
560
- gap: 8px;
561
- align-items: flex-end;
562
- }
563
- .composer textarea {
564
- flex: 1;
565
- resize: none;
566
- background: var(--panel);
567
- border: 1px solid var(--line);
568
- border-radius: 9px;
569
- color: var(--fg);
570
- font: 13px var(--mono);
571
- padding: 9px 12px;
572
- outline: 0;
573
- min-height: 40px;
574
- max-height: 160px;
575
- }
576
- .composer textarea:focus {
577
- border-color: var(--accent);
578
- }
579
- .send {
580
- background: var(--accent);
581
- color: var(--bg);
582
- border: 0;
583
- border-radius: 9px;
584
- font-weight: 600;
585
- padding: 10px 18px;
586
- cursor: pointer;
587
- font-size: 13px;
588
- }
589
- .send:disabled {
590
- opacity: 0.45;
591
- cursor: not-allowed;
592
- }
593
- .hint {
594
- color: var(--muted);
595
- font-size: 11px;
596
- font-family: var(--mono);
597
- margin-top: 6px;
598
- padding: 0 16px 10px;
599
- }
600
583
  </style>
601
584
  <link
602
585
  rel="stylesheet"
@@ -645,6 +628,8 @@
645
628
  <div class="list" id="list"></div>
646
629
  </div>
647
630
 
631
+ <div class="splitter" id="splitter" title="drag to resize"></div>
632
+
648
633
  <div class="right">
649
634
  <div class="rhead" id="rhead" style="display: none">
650
635
  <span class="dot" id="rdot"></span>
@@ -655,18 +640,9 @@
655
640
  >
656
641
  </div>
657
642
  <div class="log" id="log">
658
- <div class="placeholder">← pick an agent to tail its log and send it a message</div>
659
- </div>
660
- <div class="composer" id="composer" style="display: none">
661
- <textarea
662
- id="msg"
663
- rows="1"
664
- placeholder="message to send to the agent… (⌘/Ctrl+Enter)"
665
- ></textarea>
666
- <button class="send" id="send">Send ⏎</button>
667
- </div>
668
- <div class="hint" id="hint" style="display: none">
669
- POST /api/send → writes to the agent's stdin fifo, then Enter.
643
+ <div class="placeholder">
644
+ ← pick an agent to tail its log; type directly into the terminal
645
+ </div>
670
646
  </div>
671
647
  </div>
672
648
  </div>
@@ -1008,14 +984,32 @@
1008
984
  },
1009
985
  };
1010
986
 
987
+ // claude is the default CLI — show the cli name only when it differs, so the
988
+ // common case stays uncluttered and the identity (repo/branch) leads instead.
989
+ const cliLabel = (e) => (e.cli && e.cli !== "claude" ? e.cli : "");
990
+ // Parse owner/repo/branch from a cwd like .../ws/<owner>/<repo>/tree/<branch>.
991
+ function repoBranch(e) {
992
+ const m = /\/([^/]+)\/([^/]+)\/tree\/([^/]+)/.exec(e.cwd || "");
993
+ return m ? { owner: m[1], repo: m[2], branch: m[3] } : null;
994
+ }
995
+ // Identity string for the left panel. cap=true → repo/branch each clipped to
996
+ // 3 chars for the compact one-line view (e.g. "age/mai").
997
+ function ident(e, cap) {
998
+ const rb = repoBranch(e);
999
+ if (!rb) return "";
1000
+ const c = (s) => (cap && s.length > 3 ? s.slice(0, 3) : s);
1001
+ return `${c(rb.repo)}/${c(rb.branch)}`;
1002
+ }
1003
+
1011
1004
  // Derive codehost-style mnemonic tags from a cwd like .../ws/<owner>/<repo>/tree/<wt>
1012
1005
  function tagsFor(e) {
1013
1006
  const t = [];
1014
- const m = /\/([^/]+)\/([^/]+)\/tree\/([^/]+)/.exec(e.cwd || "");
1015
- if (m) {
1016
- t.push(["repo", `${m[1]}/${m[2]}`], ["wt", m[3]]);
1007
+ const rb = repoBranch(e);
1008
+ if (rb) {
1009
+ t.push(["repo", `${rb.owner}/${rb.repo}`], ["wt", rb.branch]);
1017
1010
  }
1018
- if (e.cli) t.push(["cli", e.cli]);
1011
+ const cli = cliLabel(e);
1012
+ if (cli) t.push(["cli", cli]);
1019
1013
  if (e._host) t.push(["host", e._host]); // codehost rooms: which machine
1020
1014
  return t;
1021
1015
  }
@@ -1063,9 +1057,12 @@
1063
1057
  shown
1064
1058
  .map((e) => {
1065
1059
  const t = e.title || e.prompt || "";
1060
+ const id = ident(e, true);
1061
+ const cli = cliLabel(e);
1066
1062
  return `<div class="row crow ${String(e.pid) === sel ? "sel" : ""}" data-pid="${e.pid}">
1067
1063
  <span class="dot ${esc(e.status)}"></span>
1068
- <span class="cname">${esc(e.cli)}</span>
1064
+ ${id ? `<span class="cident" title="${esc(ident(e))}">${esc(id)}</span>` : ""}
1065
+ ${cli ? `<span class="cname">${esc(cli)}</span>` : ""}
1069
1066
  <span class="ctitle ${e.title ? "" : "dim"}" title="${esc(t)}">${esc(t)}</span>
1070
1067
  <span class="age">${age(e)}</span></div>`;
1071
1068
  })
@@ -1083,7 +1080,7 @@
1083
1080
  .join("");
1084
1081
  return `<div class="row ${String(e.pid) === sel ? "sel" : ""}" data-pid="${e.pid}">
1085
1082
  <div class="r1"><span class="dot ${esc(e.status)}"></span>
1086
- <span class="name">${esc(e.cli)}</span>
1083
+ <span class="name">${esc(cliLabel(e) || ident(e) || "agent")}</span>
1087
1084
  <span class="badge">pid ${e.pid}</span>
1088
1085
  <span class="age">${age(e)}</span></div>
1089
1086
  ${e.title ? `<div class="rowtitle" title="${esc(e.title)}">${esc(e.title)}</div>` : ""}
@@ -1123,12 +1120,9 @@
1123
1120
  if (!e) return;
1124
1121
  renderList();
1125
1122
  $("rhead").style.display = "flex";
1126
- $("composer").style.display = "flex";
1127
- $("hint").style.display = "block";
1128
1123
  $("rdot").className = "dot " + e.status;
1129
- $("rname").textContent = e.title || e.cli;
1124
+ $("rname").textContent = e.title || cliLabel(e) || ident(e) || "agent";
1130
1125
  $("rpid").textContent = "pid " + e.pid;
1131
- $("msg").focus();
1132
1126
 
1133
1127
  // Render the agent's native TUI with xterm.js by feeding it the raw PTY
1134
1128
  // stream (ANSI/cursor control intact) — see /api/tail?raw=1.
@@ -1151,6 +1145,7 @@
1151
1145
  fit = new FitAddon.FitAddon();
1152
1146
  term.loadAddon(fit);
1153
1147
  term.open(logEl);
1148
+ term.focus();
1154
1149
  // An agent can rename itself by emitting an OSC 0/2 title sequence
1155
1150
  // (\x1b]2;my-name\x07); xterm parses it out of the raw PTY stream we already
1156
1151
  // feed it, so we just surface the latest title as the header name. Falls
@@ -1226,24 +1221,6 @@
1226
1221
  es = { close };
1227
1222
  }
1228
1223
 
1229
- async function send() {
1230
- if (!sel) return;
1231
- const msg = $("msg").value;
1232
- if (!msg.trim()) return;
1233
- $("send").disabled = true;
1234
- try {
1235
- const r = await Conn.post("/api/send", { keyword: sel, msg, code: "enter" });
1236
- if (r.ok) {
1237
- $("msg").value = "";
1238
- } else {
1239
- alert("send failed: " + r.text);
1240
- }
1241
- } finally {
1242
- $("send").disabled = false;
1243
- $("msg").focus();
1244
- }
1245
- }
1246
-
1247
1224
  $("list").addEventListener("click", (ev) => {
1248
1225
  const row = ev.target.closest(".row");
1249
1226
  if (row) select(row.dataset.pid);
@@ -1260,13 +1237,6 @@
1260
1237
  fit.fit();
1261
1238
  } catch {}
1262
1239
  });
1263
- $("send").addEventListener("click", send);
1264
- $("msg").addEventListener("keydown", (ev) => {
1265
- if (ev.key === "Enter" && (ev.metaKey || ev.ctrlKey)) {
1266
- ev.preventDefault();
1267
- send();
1268
- }
1269
- });
1270
1240
 
1271
1241
  // ---- rooms: localStorage cache + a manager you open by clicking the badge ----
1272
1242
  const ROOMS_KEY = "ay.rooms";
@@ -1572,8 +1542,7 @@
1572
1542
  history.replaceState(null, document.title, location.pathname + location.search); // eat launch params
1573
1543
  if (spec) showLaunch(spec);
1574
1544
  setConn("● local", "var(--muted)");
1575
- loadList();
1576
- setInterval(loadList, 3000);
1545
+ startPolling();
1577
1546
  return;
1578
1547
  }
1579
1548
  // #k=<token> — local-mode auth from `ay serve --http`'s printed link.
@@ -1585,8 +1554,7 @@
1585
1554
  // SECURITY: strip the token from the URL immediately.
1586
1555
  history.replaceState(null, document.title, location.pathname + location.search);
1587
1556
  setConn("● local", "var(--muted)");
1588
- loadList();
1589
- setInterval(loadList, 3000);
1557
+ startPolling();
1590
1558
  return;
1591
1559
  }
1592
1560
  const h = decodeURIComponent(raw);
@@ -1635,10 +1603,97 @@
1635
1603
  // Render the UI immediately and refresh on a timer; connect to a room (if
1636
1604
  // any) in the BACKGROUND so a dead/slow cached room never blanks the page.
1637
1605
  if (!pending) setConn("● local", "var(--muted)");
1638
- loadList();
1639
- setInterval(loadList, 3000); // refresh statuses / new agents
1606
+ startPolling();
1640
1607
  if (pending) connectRoom(pending.room, pending.token, pending.host);
1641
1608
  }
1609
+
1610
+ // ---- activity-gated polling + auto-reload on new deploy ----------------
1611
+ // Poll the agent list while the page is actually in use; pause when the tab
1612
+ // is hidden or the user has been idle for IDLE_MS, so an unattended console
1613
+ // stops making requests. On returning to the tab we refresh immediately.
1614
+ let lastActivity = Date.now();
1615
+ const IDLE_MS = 60_000; // no interaction for 1 min → idle → stop polling
1616
+ ["mousemove", "keydown", "pointerdown", "wheel", "touchstart"].forEach((ev) =>
1617
+ window.addEventListener(ev, () => (lastActivity = Date.now()), { passive: true }),
1618
+ );
1619
+ const isActive = () =>
1620
+ document.visibilityState === "visible" && Date.now() - lastActivity < IDLE_MS;
1621
+
1622
+ let polling = false;
1623
+ function startPolling() {
1624
+ if (polling) return;
1625
+ polling = true;
1626
+ loadList();
1627
+ setInterval(() => {
1628
+ if (isActive()) loadList();
1629
+ }, 3000); // refresh statuses / new agents — only while active
1630
+ document.addEventListener("visibilitychange", () => {
1631
+ if (document.visibilityState === "visible") {
1632
+ lastActivity = Date.now();
1633
+ loadList();
1634
+ }
1635
+ });
1636
+ watchVersion();
1637
+ }
1638
+
1639
+ // Auto-reload when the console's own assets change (a new deploy). HEAD the
1640
+ // page once a minute and compare the cache validator; reload on change.
1641
+ // Best-effort — ignores failures (e.g. remote rooms / cross-origin).
1642
+ function watchVersion() {
1643
+ let seen = null;
1644
+ const check = async () => {
1645
+ if (!isActive()) return;
1646
+ try {
1647
+ const r = await fetch(location.pathname, { method: "HEAD", cache: "no-store" });
1648
+ const tag = r.headers.get("etag") || r.headers.get("last-modified");
1649
+ if (!tag) return;
1650
+ if (seen && seen !== tag) return location.reload();
1651
+ seen = tag;
1652
+ } catch {}
1653
+ };
1654
+ check();
1655
+ setInterval(check, 60_000);
1656
+ }
1657
+
1658
+ // ---- draggable middle splitter (VSCode-style) -------------------------
1659
+ // Drag adjusts the left column width (a CSS var on .app), clamped so neither
1660
+ // pane collapses, persisted per device, and refits the terminal as it moves.
1661
+ (function () {
1662
+ const sp = $("splitter");
1663
+ const app = document.querySelector(".app");
1664
+ const saved = localStorage.getItem("ay.leftw");
1665
+ if (saved) app.style.setProperty("--leftw", saved);
1666
+ let dragging = false;
1667
+ sp.addEventListener("pointerdown", (e) => {
1668
+ dragging = true;
1669
+ sp.classList.add("drag");
1670
+ sp.setPointerCapture(e.pointerId);
1671
+ e.preventDefault();
1672
+ });
1673
+ sp.addEventListener("pointermove", (e) => {
1674
+ if (!dragging) return;
1675
+ const w = Math.min(Math.max(e.clientX, 280), window.innerWidth - 360);
1676
+ app.style.setProperty("--leftw", w + "px");
1677
+ if (fit)
1678
+ try {
1679
+ fit.fit();
1680
+ } catch {}
1681
+ });
1682
+ const end = (e) => {
1683
+ if (!dragging) return;
1684
+ dragging = false;
1685
+ sp.classList.remove("drag");
1686
+ try {
1687
+ sp.releasePointerCapture(e.pointerId);
1688
+ } catch {}
1689
+ localStorage.setItem(
1690
+ "ay.leftw",
1691
+ getComputedStyle(app).getPropertyValue("--leftw").trim(),
1692
+ );
1693
+ };
1694
+ sp.addEventListener("pointerup", end);
1695
+ sp.addEventListener("pointercancel", end);
1696
+ })();
1642
1697
  boot();
1643
1698
  </script>
1644
1699
  </body>
@@ -1,17 +1,17 @@
1
- function F() {
1
+ function k() {
2
2
  return crypto.randomUUID();
3
3
  }
4
- var v = 60000,
5
- w = 1e4,
6
- M = 1000,
7
- u = 120000,
8
- b = 25000;
9
- class H {
4
+ var g = 60000,
5
+ u = 1e4,
6
+ L = 1000,
7
+ b = 120000,
8
+ O = 25000;
9
+ class j {
10
10
  opts;
11
11
  peerId;
12
12
  ws = null;
13
13
  closed = !1;
14
- reconnectDelay = M;
14
+ reconnectDelay = L;
15
15
  reconnectTimer = null;
16
16
  dormant = !1;
17
17
  heartbeat = null;
@@ -19,7 +19,7 @@ class H {
19
19
  openedAt = 0;
20
20
  constructor(z) {
21
21
  this.opts = z;
22
- this.peerId = z.peerId ?? F();
22
+ this.peerId = z.peerId ?? k();
23
23
  }
24
24
  connect() {
25
25
  ((this.closed = !1), this.attachWakeListeners(), this.open());
@@ -42,13 +42,13 @@ class H {
42
42
  }
43
43
  attachWakeListeners() {
44
44
  globalThis.document?.addEventListener("visibilitychange", this.onWake);
45
- let K = globalThis.window;
46
- (K?.addEventListener("focus", this.onWake), K?.addEventListener("online", this.onWake));
45
+ let Q = globalThis.window;
46
+ (Q?.addEventListener("focus", this.onWake), Q?.addEventListener("online", this.onWake));
47
47
  }
48
48
  detachWakeListeners() {
49
49
  globalThis.document?.removeEventListener("visibilitychange", this.onWake);
50
- let K = globalThis.window;
51
- (K?.removeEventListener("focus", this.onWake), K?.removeEventListener("online", this.onWake));
50
+ let Q = globalThis.window;
51
+ (Q?.removeEventListener("focus", this.onWake), Q?.removeEventListener("online", this.onWake));
52
52
  }
53
53
  roomUrl() {
54
54
  return `${this.opts.url.replace(/\/+$/, "")}/room/${encodeURIComponent(this.opts.token)}`;
@@ -56,43 +56,43 @@ class H {
56
56
  open() {
57
57
  let z = new WebSocket(this.roomUrl());
58
58
  this.ws = z;
59
- let K = setTimeout(() => {
59
+ let Q = setTimeout(() => {
60
60
  if (z.readyState === 0)
61
61
  try {
62
62
  z.close();
63
63
  } catch {}
64
- }, w);
64
+ }, u);
65
65
  ((z.onopen = () => {
66
- (clearTimeout(K),
66
+ (clearTimeout(Q),
67
67
  (this.openedAt = Date.now()),
68
68
  this.clearStableTimer(),
69
69
  (this.stableTimer = setTimeout(() => {
70
- this.reconnectDelay = M;
71
- }, v)));
72
- let Q = {
70
+ this.reconnectDelay = L;
71
+ }, g)));
72
+ let Y = {
73
73
  type: "hello",
74
74
  role: this.opts.role,
75
75
  peerId: this.peerId,
76
76
  ...(this.opts.meta ? { meta: this.opts.meta } : {}),
77
77
  };
78
- (z.send(JSON.stringify(Q)), this.startHeartbeat(), this.opts.onOpen?.());
78
+ (z.send(JSON.stringify(Y)), this.startHeartbeat(), this.opts.onOpen?.());
79
79
  }),
80
- (z.onmessage = (Q) => {
81
- let Y;
80
+ (z.onmessage = (Y) => {
81
+ let Z;
82
82
  try {
83
- Y = JSON.parse(String(Q.data));
83
+ Z = JSON.parse(String(Y.data));
84
84
  } catch {
85
85
  return;
86
86
  }
87
- if (Y.type === "peers") this.opts.onPeers?.(Y.peers);
88
- else if (Y.type === "signal") this.opts.onSignal?.(Y.from, Y.data);
87
+ if (Z.type === "peers") this.opts.onPeers?.(Z.peers);
88
+ else if (Z.type === "signal") this.opts.onSignal?.(Z.from, Z.data);
89
89
  }),
90
- (z.onclose = (Q) => {
91
- (clearTimeout(K), this.clearStableTimer(), this.stopHeartbeat());
92
- let Y = this.openedAt ? Date.now() - this.openedAt : 0;
90
+ (z.onclose = (Y) => {
91
+ (clearTimeout(Q), this.clearStableTimer(), this.stopHeartbeat());
92
+ let Z = this.openedAt ? Date.now() - this.openedAt : 0;
93
93
  if (
94
94
  ((this.openedAt = 0),
95
- this.opts.onClose?.({ code: Q?.code ?? 0, reason: Q?.reason ?? "", ms: Y }),
95
+ this.opts.onClose?.({ code: Y?.code ?? 0, reason: Y?.reason ?? "", ms: Z }),
96
96
  !this.closed)
97
97
  )
98
98
  this.scheduleReconnect();
@@ -109,7 +109,7 @@ class H {
109
109
  try {
110
110
  this.ws?.send(JSON.stringify({ type: "ping" }));
111
111
  } catch {}
112
- }, b)));
112
+ }, O)));
113
113
  }
114
114
  stopHeartbeat() {
115
115
  if (this.heartbeat != null) (clearInterval(this.heartbeat), (this.heartbeat = null));
@@ -123,7 +123,7 @@ class H {
123
123
  return;
124
124
  }
125
125
  let z = Math.round(this.reconnectDelay * (0.75 + Math.random() * 0.5));
126
- ((this.reconnectDelay = Math.min(this.reconnectDelay * 2, u)),
126
+ ((this.reconnectDelay = Math.min(this.reconnectDelay * 2, b)),
127
127
  this.clearReconnectTimer(),
128
128
  (this.reconnectTimer = setTimeout(() => {
129
129
  if (((this.reconnectTimer = null), this.closed)) return;
@@ -138,14 +138,14 @@ class H {
138
138
  if (this.reconnectTimer != null)
139
139
  (clearTimeout(this.reconnectTimer), (this.reconnectTimer = null));
140
140
  }
141
- sendSignal(z, K) {
142
- let Q = { type: "signal", to: z, data: K };
143
- this.ws?.send(JSON.stringify(Q));
141
+ sendSignal(z, Q) {
142
+ let Y = { type: "signal", to: z, data: Q };
143
+ this.ws?.send(JSON.stringify(Y));
144
144
  }
145
145
  updateMeta(z) {
146
146
  if (((this.opts.meta = z), this.ws?.readyState === 1)) {
147
- let K = { type: "meta", meta: z };
148
- this.ws.send(JSON.stringify(K));
147
+ let Q = { type: "meta", meta: z };
148
+ this.ws.send(JSON.stringify(Q));
149
149
  }
150
150
  }
151
151
  close() {
@@ -160,21 +160,23 @@ class H {
160
160
  } catch {}
161
161
  }
162
162
  }
163
- var R = ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"],
164
- A = "codehost";
165
- class x {
163
+ var A = ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"],
164
+ N = "codehost",
165
+ _ = "codehost-bulk";
166
+ class B {
166
167
  opts;
167
168
  pc;
168
169
  channel = null;
170
+ bulk = null;
169
171
  constructor(z) {
170
172
  this.opts = z;
171
- ((this.pc = new RTCPeerConnection({ iceServers: R.map((K) => ({ urls: K })) })),
172
- (this.pc.onicecandidate = (K) => {
173
- if (K.candidate)
173
+ ((this.pc = new RTCPeerConnection({ iceServers: A.map((Q) => ({ urls: Q })) })),
174
+ (this.pc.onicecandidate = (Q) => {
175
+ if (Q.candidate)
174
176
  this.opts.sendSignal({
175
177
  kind: "candidate",
176
- candidate: K.candidate.candidate,
177
- mid: K.candidate.sdpMid ?? "0",
178
+ candidate: Q.candidate.candidate,
179
+ mid: Q.candidate.sdpMid ?? "0",
178
180
  });
179
181
  }),
180
182
  (this.pc.onconnectionstatechange = () => {
@@ -182,60 +184,65 @@ class x {
182
184
  }));
183
185
  }
184
186
  async start() {
185
- let z = this.pc.createDataChannel(A, { ordered: !0 });
187
+ let z = this.pc.createDataChannel(N, { ordered: !0 });
186
188
  ((z.binaryType = "arraybuffer"),
187
189
  (this.channel = z),
188
190
  (z.onopen = () => this.opts.onOpen?.(z)),
189
191
  (z.onclose = () => this.opts.onClose?.()));
190
- let K = await this.pc.createOffer();
191
- (await this.pc.setLocalDescription(K),
192
- this.opts.sendSignal({ kind: "offer", type: "offer", sdp: K.sdp ?? "" }));
192
+ let Q = this.pc.createDataChannel(_, { ordered: !0 });
193
+ ((Q.binaryType = "arraybuffer"), (this.bulk = Q));
194
+ let Y = await this.pc.createOffer();
195
+ (await this.pc.setLocalDescription(Y),
196
+ this.opts.sendSignal({ kind: "offer", type: "offer", sdp: Y.sdp ?? "" }));
193
197
  }
194
198
  async handleSignal(z) {
195
- let K = z;
196
- if (!K || typeof K !== "object") return;
197
- if (K.kind === "answer") await this.pc.setRemoteDescription({ type: "answer", sdp: K.sdp });
198
- else if (K.kind === "candidate")
199
+ let Q = z;
200
+ if (!Q || typeof Q !== "object") return;
201
+ if (Q.kind === "answer") await this.pc.setRemoteDescription({ type: "answer", sdp: Q.sdp });
202
+ else if (Q.kind === "candidate")
199
203
  try {
200
- await this.pc.addIceCandidate({ candidate: K.candidate, sdpMid: K.mid });
201
- } catch (Q) {
202
- console.error("[rtc] addIceCandidate failed:", Q);
204
+ await this.pc.addIceCandidate({ candidate: Q.candidate, sdpMid: Q.mid });
205
+ } catch (Y) {
206
+ console.error("[rtc] addIceCandidate failed:", Y);
203
207
  }
204
208
  }
205
209
  get dataChannel() {
206
210
  return this.channel;
207
211
  }
212
+ get bulkChannel() {
213
+ return this.bulk;
214
+ }
208
215
  async selectedPath() {
209
216
  try {
210
217
  let z = await this.pc.getStats(),
211
- K = null;
212
- z.forEach(($) => {
213
- if ($.type === "transport" && $.selectedCandidatePairId) K = $.selectedCandidatePairId;
218
+ Q = null;
219
+ z.forEach((q) => {
220
+ if (q.type === "transport" && q.selectedCandidatePairId) Q = q.selectedCandidatePairId;
214
221
  });
215
- let Q = null;
222
+ let Y = null;
216
223
  if (
217
- (z.forEach(($) => {
224
+ (z.forEach((q) => {
218
225
  if (
219
- K ? $.id === K : $.type === "candidate-pair" && $.state === "succeeded" && $.nominated
226
+ Q ? q.id === Q : q.type === "candidate-pair" && q.state === "succeeded" && q.nominated
220
227
  )
221
- Q = $;
228
+ Y = q;
222
229
  }),
223
- !Q)
230
+ !Y)
224
231
  )
225
232
  return null;
226
- let { localCandidateId: Y, remoteCandidateId: Z } = Q,
227
- q = !0,
228
- X = 0;
233
+ let { localCandidateId: Z, remoteCandidateId: $ } = Y,
234
+ G = !0,
235
+ V = 0;
229
236
  if (
230
- (z.forEach(($) => {
231
- if ($.id === Y || $.id === Z) {
232
- if ((X++, $.candidateType !== "host")) q = !1;
237
+ (z.forEach((q) => {
238
+ if (q.id === Z || q.id === $) {
239
+ if ((V++, q.candidateType !== "host")) G = !1;
233
240
  }
234
241
  }),
235
- X < 2)
242
+ V < 2)
236
243
  )
237
244
  return null;
238
- return q ? "lan" : "p2p";
245
+ return G ? "lan" : "p2p";
239
246
  } catch {
240
247
  return null;
241
248
  }
@@ -244,77 +251,87 @@ class x {
244
251
  try {
245
252
  this.channel?.close();
246
253
  } catch {}
254
+ try {
255
+ this.bulk?.close();
256
+ } catch {}
247
257
  try {
248
258
  this.pc.close();
249
259
  } catch {}
250
260
  }
251
261
  }
252
- var g = new TextEncoder(),
253
- N = new TextDecoder();
254
- function D(z, K, Q) {
255
- let Y = Q?.byteLength ?? 0,
256
- Z = new Uint8Array(5 + Y);
257
- if (((Z[0] = z), new DataView(Z.buffer).setUint32(1, K >>> 0, !1), Q && Y)) Z.set(Q, 5);
258
- return Z;
262
+ var y = new TextEncoder(),
263
+ S = new TextDecoder();
264
+ function P(z, Q, Y) {
265
+ let Z = Y?.byteLength ?? 0,
266
+ $ = new Uint8Array(5 + Z);
267
+ if ((($[0] = z), new DataView($.buffer).setUint32(1, Q >>> 0, !1), Y && Z)) $.set(Y, 5);
268
+ return $;
259
269
  }
260
- function k(z, K, Q) {
261
- return D(z, K, g.encode(JSON.stringify(Q)));
270
+ function J(z, Q, Y) {
271
+ return P(z, Q, y.encode(JSON.stringify(Y)));
262
272
  }
263
- function S(z) {
264
- let K = z instanceof Uint8Array ? z : new Uint8Array(z),
265
- Q = K[0],
266
- Y = new DataView(K.buffer, K.byteOffset, K.byteLength).getUint32(1, !1),
267
- Z = K.subarray(5);
268
- return { op: Q, streamId: Y, payload: Z };
273
+ function T(z) {
274
+ let Q = z instanceof Uint8Array ? z : new Uint8Array(z),
275
+ Y = Q[0],
276
+ Z = new DataView(Q.buffer, Q.byteOffset, Q.byteLength).getUint32(1, !1),
277
+ $ = Q.subarray(5);
278
+ return { op: Y, streamId: Z, payload: $ };
269
279
  }
270
280
  function U(z) {
271
- return JSON.parse(N.decode(z));
281
+ return JSON.parse(S.decode(z));
272
282
  }
273
- function T(z) {
274
- return N.decode(z);
283
+ function E(z) {
284
+ return S.decode(z);
275
285
  }
276
- function* _(z) {
277
- for (let K = 0; K < z.byteLength; K += 65531) yield z.slice(K, Math.min(K + 65531, z.byteLength));
286
+ function* C(z) {
287
+ for (let Q = 0; Q < z.byteLength; Q += 65531) yield z.slice(Q, Math.min(Q + 65531, z.byteLength));
278
288
  }
279
- function O(z) {
289
+ function f(z) {
280
290
  if (z.length === 1) return z[0];
281
- let K = z.reduce((Z, q) => Z + q.byteLength, 0),
282
- Q = new Uint8Array(K),
283
- Y = 0;
284
- for (let Z of z) (Q.set(Z, Y), (Y += Z.byteLength));
285
- return Q;
291
+ let Q = z.reduce(($, G) => $ + G.byteLength, 0),
292
+ Y = new Uint8Array(Q),
293
+ Z = 0;
294
+ for (let $ of z) (Y.set($, Z), (Z += $.byteLength));
295
+ return Y;
286
296
  }
287
- function* J(z, K, Q) {
288
- let Y = 0;
289
- while (Q.byteLength - Y > 65531) (yield D(13, K, Q.subarray(Y, Y + 65531)), (Y += 65531));
290
- yield D(z, K, Q.subarray(Y));
297
+ function* H(z, Q, Y) {
298
+ let Z = 0;
299
+ while (Y.byteLength - Z > 65531) (yield P(13, Q, Y.subarray(Z, Z + 65531)), (Z += 65531));
300
+ yield P(z, Q, Y.subarray(Z));
291
301
  }
292
- class W {
302
+ class F {
293
303
  pending = new Map();
294
- cont(z, K) {
295
- let Q = this.pending.get(z);
296
- if (Q) Q.push(K.slice());
297
- else this.pending.set(z, [K.slice()]);
304
+ cont(z, Q) {
305
+ let Y = this.pending.get(z);
306
+ if (Y) Y.push(Q.slice());
307
+ else this.pending.set(z, [Q.slice()]);
298
308
  }
299
- finish(z, K) {
300
- let Q = this.pending.get(z);
301
- if (!Q) return K;
302
- return (this.pending.delete(z), Q.push(K), O(Q));
309
+ finish(z, Q) {
310
+ let Y = this.pending.get(z);
311
+ if (!Y) return Q;
312
+ return (this.pending.delete(z), Y.push(Q), f(Y));
303
313
  }
304
314
  drop(z) {
305
315
  this.pending.delete(z);
306
316
  }
307
317
  }
308
- class j {
318
+ class R {
309
319
  channel;
320
+ bulk;
310
321
  nextStreamId = 1;
311
322
  https = new Map();
312
323
  wss = new Map();
313
- wsRx = new W();
324
+ wsRx = new F();
314
325
  textEncoder = new TextEncoder();
315
- constructor(z) {
326
+ constructor(z, Q = null) {
316
327
  this.channel = z;
317
- ((z.binaryType = "arraybuffer"), z.addEventListener("message", (K) => this.onFrame(K.data)));
328
+ this.bulk = Q;
329
+ if (
330
+ ((z.binaryType = "arraybuffer"),
331
+ z.addEventListener("message", (Y) => this.onFrame(Y.data)),
332
+ Q)
333
+ )
334
+ ((Q.binaryType = "arraybuffer"), Q.addEventListener("message", (Y) => this.onFrame(Y.data)));
318
335
  }
319
336
  allocId() {
320
337
  let z = this.nextStreamId;
@@ -322,130 +339,131 @@ class j {
322
339
  }
323
340
  onFrame(z) {
324
341
  if (typeof z === "string") return;
325
- let { op: K, streamId: Q, payload: Y } = S(z);
326
- switch (K) {
342
+ let { op: Q, streamId: Y, payload: Z } = T(z);
343
+ switch (Q) {
327
344
  case 4:
328
- this.https.get(Q)?.onHead(U(Y));
345
+ this.https.get(Y)?.onHead(U(Z));
329
346
  break;
330
347
  case 5:
331
- this.https.get(Q)?.onBody(Y.slice());
348
+ this.https.get(Y)?.onBody(Z.slice());
332
349
  break;
333
350
  case 6:
334
- (this.https.get(Q)?.onEnd(), this.https.delete(Q));
351
+ (this.https.get(Y)?.onEnd(), this.https.delete(Y));
335
352
  break;
336
353
  case 12: {
337
- let Z = this.https.get(Q);
338
- if (Z) (Z.onError(U(Y).message), this.https.delete(Q));
354
+ let $ = this.https.get(Y);
355
+ if ($) ($.onError(U(Z).message), this.https.delete(Y));
339
356
  break;
340
357
  }
341
358
  case 8: {
342
- let Z = U(Y);
343
- this.wss.get(Q)?.onOpenAck(Z.ok, Z.protocol);
359
+ let $ = U(Z);
360
+ this.wss.get(Y)?.onOpenAck($.ok, $.protocol);
344
361
  break;
345
362
  }
346
363
  case 13:
347
- this.wsRx.cont(Q, Y);
364
+ this.wsRx.cont(Y, Z);
348
365
  break;
349
366
  case 9:
350
- this.wss.get(Q)?.onText(T(this.wsRx.finish(Q, Y)));
367
+ this.wss.get(Y)?.onText(E(this.wsRx.finish(Y, Z)));
351
368
  break;
352
369
  case 10:
353
- this.wss.get(Q)?.onBin(this.wsRx.finish(Q, Y).slice());
370
+ this.wss.get(Y)?.onBin(this.wsRx.finish(Y, Z).slice());
354
371
  break;
355
372
  case 11: {
356
- let Z = U(Y);
357
- (this.wsRx.drop(Q),
358
- this.wss.get(Q)?.onClose(Z.code ?? 1000, Z.reason ?? ""),
359
- this.wss.delete(Q));
373
+ let $ = U(Z);
374
+ (this.wsRx.drop(Y),
375
+ this.wss.get(Y)?.onClose($.code ?? 1000, $.reason ?? ""),
376
+ this.wss.delete(Y));
360
377
  break;
361
378
  }
362
379
  }
363
380
  }
364
- fetch(z, K, Q, Y) {
365
- let Z = this.allocId();
366
- return new Promise((q, X) => {
367
- let $ = null,
368
- P = null,
369
- V = new ReadableStream({
370
- start: (G) => {
371
- P = G;
381
+ fetch(z, Q, Y, Z) {
382
+ let $ = this.allocId();
383
+ return new Promise((G, V) => {
384
+ let q = null,
385
+ D = null,
386
+ X = new ReadableStream({
387
+ start: (K) => {
388
+ D = K;
372
389
  },
373
390
  }),
374
- C = typeof DecompressionStream < "u" ? { ...Q, "x-codehost-accept-gzip": "1" } : Q;
375
- if (
376
- (this.https.set(Z, {
377
- onHead: (G) => {
378
- $ = G;
379
- let B = new Headers(G.headers),
380
- L = V;
381
- if (B.get("content-encoding") === "gzip")
382
- ((L = V.pipeThrough(new DecompressionStream("gzip"))),
383
- B.delete("content-encoding"),
384
- B.delete("content-length"));
385
- q(
386
- new Response(L, {
387
- status: G.status === 204 || G.status === 304 ? G.status : G.status,
388
- statusText: G.statusText,
389
- headers: B,
390
- }),
391
- );
392
- },
393
- onBody: (G) => {
394
- try {
395
- P?.enqueue(G);
396
- } catch {}
397
- },
398
- onEnd: () => {
399
- try {
400
- P?.close();
401
- } catch {}
402
- if (!$) X(Error("stream ended before head"));
403
- },
404
- onError: (G) => {
405
- try {
406
- P?.error(Error(G));
407
- } catch {}
408
- if (!$) X(Error(G));
409
- },
410
- }),
411
- this.send(k(1, Z, { method: z, path: K, headers: C })),
412
- Y && Y.byteLength)
413
- )
414
- for (let G of _(Y)) this.send(D(2, Z, G));
415
- this.send(D(3, Z));
391
+ v = typeof DecompressionStream < "u" ? { ...Y, "x-codehost-accept-gzip": "1" } : Y;
392
+ this.https.set($, {
393
+ onHead: (K) => {
394
+ q = K;
395
+ let x = new Headers(K.headers),
396
+ M = X;
397
+ if (x.get("content-encoding") === "gzip")
398
+ ((M = X.pipeThrough(new DecompressionStream("gzip"))),
399
+ x.delete("content-encoding"),
400
+ x.delete("content-length"));
401
+ G(
402
+ new Response(M, {
403
+ status: K.status === 204 || K.status === 304 ? K.status : K.status,
404
+ statusText: K.statusText,
405
+ headers: x,
406
+ }),
407
+ );
408
+ },
409
+ onBody: (K) => {
410
+ try {
411
+ D?.enqueue(K);
412
+ } catch {}
413
+ },
414
+ onEnd: () => {
415
+ try {
416
+ D?.close();
417
+ } catch {}
418
+ if (!q) V(Error("stream ended before head"));
419
+ },
420
+ onError: (K) => {
421
+ try {
422
+ D?.error(Error(K));
423
+ } catch {}
424
+ if (!q) V(Error(K));
425
+ },
426
+ });
427
+ let W = this.bulk?.readyState === "open" ? this.bulk : this.channel;
428
+ if ((this.sendOn(W, J(1, $, { method: z, path: Q, headers: v })), Z && Z.byteLength))
429
+ for (let K of C(Z)) this.sendOn(W, P(2, $, K));
430
+ this.sendOn(W, P(3, $));
416
431
  });
417
432
  }
418
- openWs(z, K, Q) {
419
- let Y = this.allocId();
433
+ openWs(z, Q, Y) {
434
+ let Z = this.allocId();
420
435
  return (
421
- this.wss.set(Y, Q),
422
- this.send(k(7, Y, { path: z, protocols: K })),
436
+ this.wss.set(Z, Y),
437
+ this.send(J(7, Z, { path: z, protocols: Q })),
423
438
  {
424
- sendText: (Z) => {
425
- for (let q of J(9, Y, this.textEncoder.encode(Z))) this.send(q);
439
+ sendText: ($) => {
440
+ for (let G of H(9, Z, this.textEncoder.encode($))) this.send(G);
426
441
  },
427
- sendBin: (Z) => {
428
- for (let q of J(10, Y, Z)) this.send(q);
442
+ sendBin: ($) => {
443
+ for (let G of H(10, Z, $)) this.send(G);
429
444
  },
430
- close: (Z, q) => {
431
- (this.send(k(11, Y, { code: Z, reason: q })), this.wss.delete(Y));
445
+ close: ($, G) => {
446
+ (this.send(J(11, Z, { code: $, reason: G })), this.wss.delete(Z));
432
447
  },
433
448
  }
434
449
  );
435
450
  }
436
451
  send(z) {
437
- if (this.channel.readyState === "open") {
438
- let K = new Uint8Array(z.byteLength);
439
- (K.set(z), this.channel.send(K.buffer));
452
+ this.sendOn(this.channel, z);
453
+ }
454
+ sendOn(z, Q) {
455
+ if (z.readyState === "open") {
456
+ let Y = new Uint8Array(Q.byteLength);
457
+ (Y.set(Q), z.send(Y.buffer));
440
458
  }
441
459
  }
442
460
  get ready() {
443
461
  return this.channel.readyState === "open";
444
462
  }
445
463
  }
446
- var f = "wss://signal.codehost.dev",
447
- y = 1e4;
448
- class E {
464
+ var I = "wss://signal.codehost.dev",
465
+ h = 1e4;
466
+ class w {
449
467
  peers = [];
450
468
  signaling;
451
469
  rtcs = new Map();
@@ -453,58 +471,58 @@ class E {
453
471
  dialFailedAt = new Map();
454
472
  closed = !1;
455
473
  constructor(z) {
456
- ((this.signaling = new H({
457
- url: z.signalUrl ?? f,
474
+ ((this.signaling = new j({
475
+ url: z.signalUrl ?? I,
458
476
  token: z.token,
459
477
  role: "viewer",
460
478
  onOpen: () => z.onStatus?.(!0),
461
479
  onClose: () => z.onStatus?.(!1),
462
- onPeers: (K) => {
463
- ((this.peers = K.filter((Q) => Q.role === "server")), z.onPeers?.(this.peers));
480
+ onPeers: (Q) => {
481
+ ((this.peers = Q.filter((Y) => Y.role === "server")), z.onPeers?.(this.peers));
464
482
  },
465
- onSignal: (K, Q) => void this.rtcs.get(K)?.handleSignal(Q),
483
+ onSignal: (Q, Y) => void this.rtcs.get(Q)?.handleSignal(Y),
466
484
  })),
467
485
  this.signaling.connect());
468
486
  }
469
- async fetch(z, K, Q, Y = {}) {
470
- let Z = await this.dial(z),
471
- q = typeof Y.body === "string" ? new TextEncoder().encode(Y.body) : Y.body;
472
- return Z.fetch(K, Q, Y.headers ?? {}, q);
487
+ async fetch(z, Q, Y, Z = {}) {
488
+ let $ = await this.dial(z),
489
+ G = typeof Z.body === "string" ? new TextEncoder().encode(Z.body) : Z.body;
490
+ return $.fetch(Q, Y, Z.headers ?? {}, G);
473
491
  }
474
492
  dial(z) {
475
- let K = this.tunnels.get(z);
476
- if (K) return K;
477
- let Q = this.dialFailedAt.get(z);
478
- if (Q != null && Date.now() - Q < y)
493
+ let Q = this.tunnels.get(z);
494
+ if (Q) return Q;
495
+ let Y = this.dialFailedAt.get(z);
496
+ if (Y != null && Date.now() - Y < h)
479
497
  return Promise.reject(Error("dial failed recently; cooling down"));
480
- let Y = () => {
498
+ let Z = () => {
481
499
  (this.tunnels.delete(z), this.rtcs.get(z)?.close(), this.rtcs.delete(z));
482
500
  },
483
- Z = new Promise((q, X) => {
484
- let $ = setTimeout(() => {
485
- (Y(), X(Error("dial timed out")));
501
+ $ = new Promise((G, V) => {
502
+ let q = setTimeout(() => {
503
+ (Z(), V(Error("dial timed out")));
486
504
  }, 15000),
487
- P = new x({
488
- sendSignal: (V) => this.signaling.sendSignal(z, V),
489
- onOpen: (V) => {
490
- (clearTimeout($), this.dialFailedAt.delete(z), q(new j(V)));
505
+ D = new B({
506
+ sendSignal: (X) => this.signaling.sendSignal(z, X),
507
+ onOpen: (X) => {
508
+ (clearTimeout(q), this.dialFailedAt.delete(z), G(new R(X, D.bulkChannel)));
491
509
  },
492
- onClose: Y,
493
- onState: (V) => {
494
- if (V === "failed" || V === "disconnected") Y();
510
+ onClose: Z,
511
+ onState: (X) => {
512
+ if (X === "failed" || X === "disconnected") Z();
495
513
  },
496
514
  });
497
- (this.rtcs.set(z, P),
498
- P.start().catch((V) => {
499
- (clearTimeout($), Y(), X(V));
515
+ (this.rtcs.set(z, D),
516
+ D.start().catch((X) => {
517
+ (clearTimeout(q), Z(), V(X));
500
518
  }));
501
519
  });
502
520
  return (
503
- this.tunnels.set(z, Z),
504
- Z.catch(() => {
521
+ this.tunnels.set(z, $),
522
+ $.catch(() => {
505
523
  (this.dialFailedAt.set(z, Date.now()), this.tunnels.delete(z));
506
524
  }),
507
- Z
525
+ $
508
526
  );
509
527
  }
510
528
  close() {
@@ -514,7 +532,7 @@ class E {
514
532
  (this.rtcs.clear(), this.tunnels.clear(), this.signaling.close());
515
533
  }
516
534
  }
517
- function a(z) {
518
- return new E(z);
535
+ function zz(z) {
536
+ return new w(z);
519
537
  }
520
- export { a as joinRoom, f as DEFAULT_SIGNAL_URL, E as CodehostRoom };
538
+ export { zz as joinRoom, I as DEFAULT_SIGNAL_URL, w as CodehostRoom };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.99.0",
3
+ "version": "1.100.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",
@@ -1,8 +0,0 @@
1
- import "./ts-BECoCPV1.js";
2
- import "./logger-B9h0djqx.js";
3
- import "./versionChecker-pct2j3wR.js";
4
- import "./pidStore-DBjlqzo8.js";
5
- import "./globalPidIndex-yVd3mbsV.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-eIjVu8HF.js";
7
-
8
- export { SUPPORTED_CLIS };