agent-yes 1.221.0 → 1.221.1

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,9 @@
1
+ import "./ts-B8jTQxjO.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-Db6hxBm6.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
+ import "./globalPidIndex-CoNr7tS8.js";
6
+ import "./messageLog-CxrKJj77.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CUPF0wEe.js";
8
+
9
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-BHGjVVXi.js";
1
+ import { t as CLIS_CONFIG } from "./ts-B8jTQxjO.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-DSinex5A.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-CUPF0wEe.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { M as resolveOne } from "./subcommands-C2VO1PO8.js";
5
+ import { M as resolveOne } from "./subcommands-DzGeZpfs.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-Cim0dBU7.js";
@@ -229,4 +229,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
229
 
230
230
  //#endregion
231
231
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-DUaGnMN8.js.map
232
+ //# sourceMappingURL=agentShare-Bbdy8MKW.js.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-RD3-wE5w.js";
5
- import { n as getRustBinary } from "./rustBinary-DBT3Wo9A.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-Db6hxBm6.js";
5
+ import { n as getRustBinary } from "./rustBinary-DrQ0MBY_.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -285,7 +285,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
285
285
  const rawArg = process.argv[2];
286
286
  const managerCommands = !invokedCliName(process.argv);
287
287
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
288
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-8EdoNkxC.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-re9wZB3T.js");
289
289
  if (isHelpFlag && process.argv.length === 3) {
290
290
  await cmdHelp(managerCommands);
291
291
  process.exit(0);
@@ -327,7 +327,7 @@ if (config.useRust) {
327
327
  }
328
328
  }
329
329
  if (rustBinary) {
330
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-NZ7T0-20.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C6e_-_R5.js");
331
331
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
332
332
  if (config.verbose) {
333
333
  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-BHGjVVXi.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-B8jTQxjO.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-RD3-wE5w.js";
3
+ import "./versionChecker-Db6hxBm6.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
  import "./messageLog-CxrKJj77.js";
@@ -2,7 +2,7 @@ import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-C2VO1PO8.js";
5
+ import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-DzGeZpfs.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-Cim0dBU7.js";
@@ -589,4 +589,4 @@ async function ensureDaemon() {
589
589
 
590
590
  //#endregion
591
591
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
592
- //# sourceMappingURL=notifyDaemon-DYPvxxpg.js.map
592
+ //# sourceMappingURL=notifyDaemon-CPyPTBL5.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-Db6hxBm6.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
225
225
 
226
226
  //#endregion
227
227
  export { getRustBinary as n, findSpawnHiddenLauncher as t };
228
- //# sourceMappingURL=rustBinary-DBT3Wo9A.js.map
228
+ //# sourceMappingURL=rustBinary-DrQ0MBY_.js.map
@@ -1,10 +1,10 @@
1
- import "./ts-BHGjVVXi.js";
1
+ import "./ts-B8jTQxjO.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-RD3-wE5w.js";
3
+ import "./versionChecker-Db6hxBm6.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
  import "./messageLog-CxrKJj77.js";
7
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DSinex5A.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CUPF0wEe.js";
8
8
  import { d as resolveSpawnCwd } from "./workspaceConfig-CjaRvTjf.js";
9
9
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CwNJuwH5.js";
10
10
  import { createHash } from "node:crypto";
@@ -151,4 +151,4 @@ async function cmdSchedule(rest) {
151
151
 
152
152
  //#endregion
153
153
  export { cmdSchedule };
154
- //# sourceMappingURL=schedule-CuH1FRnq.js.map
154
+ //# sourceMappingURL=schedule-Bj2KaiMh.js.map
@@ -1,15 +1,15 @@
1
- import "./ts-BHGjVVXi.js";
1
+ import "./ts-B8jTQxjO.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-DBT3Wo9A.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-Db6hxBm6.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-DrQ0MBY_.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-CtHb5b71.js";
6
6
  import "./pidStore-BIvsBQ8X.js";
7
7
  import { a as updateGlobalPidStatus } from "./globalPidIndex-CoNr7tS8.js";
8
8
  import { r as recordInbox } from "./messageLog-CxrKJj77.js";
9
9
  import { t as pgidForWrapper } from "./reaper-BUHCyxdF.js";
10
10
  import "./configShared-aKTg-sa5.js";
11
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DSinex5A.js";
12
- import { A as renderRawLog, D as recentMessageEdges, E as readPtysize, L as snapshotStatus, M as resolveOne, O as recentReadEdges, S as listRecords, T as readNotes, U as writeToIpc, b as isUserTyping, f as extractNeedsInput, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, q as isTransientLockMkdirError, tt as TYPING_BADGE, u as extractBadges } from "./subcommands-C2VO1PO8.js";
11
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CUPF0wEe.js";
12
+ import { A as renderRawLog, D as recentMessageEdges, E as readPtysize, L as snapshotStatus, M as resolveOne, O as recentReadEdges, S as listRecords, T as readNotes, U as writeToIpc, b as isUserTyping, f as extractNeedsInput, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, q as isTransientLockMkdirError, tt as TYPING_BADGE, u as extractBadges } from "./subcommands-DzGeZpfs.js";
13
13
  import "./e2e-jb0Hp43q.js";
14
14
  import "./webrtcLink-B7REGtK2.js";
15
15
  import "./remotes-Cim0dBU7.js";
@@ -1585,10 +1585,15 @@ Options:
1585
1585
  setInterval(() => {
1586
1586
  for (const pid of negoApplied.keys()) scheduleNego(pid);
1587
1587
  }, 5e3);
1588
- const apiFetch = async (req) => {
1588
+ const apiFetch = async (req, srv) => {
1589
1589
  if (!checkAuth(req, token)) return new Response("Unauthorized", { status: 401 });
1590
1590
  const url = new URL(req.url);
1591
1591
  const p = url.pathname;
1592
+ if (p === "/api/mux" && srv && req.headers.get("upgrade")?.toLowerCase() === "websocket") {
1593
+ const muxToken = url.searchParams.get("token") || "";
1594
+ if (srv.upgrade(req, { data: { muxToken } })) return void 0;
1595
+ return new Response("expected websocket", { status: 426 });
1596
+ }
1592
1597
  if (req.method === "GET" && p === "/api/ls") {
1593
1598
  const keyword = url.searchParams.get("keyword") ?? void 0;
1594
1599
  const opts = defaultOpts({
@@ -1982,7 +1987,7 @@ Options:
1982
1987
  }
1983
1988
  });
1984
1989
  if (req.method === "GET" && p === "/api/ws") {
1985
- const ws = await import("./ws-DZ2q-u4b.js");
1990
+ const ws = await import("./ws-ymzCIG7O.js");
1986
1991
  try {
1987
1992
  await ws.loadProvision();
1988
1993
  } catch (e) {
@@ -2002,7 +2007,7 @@ Options:
2002
2007
  if (req.method === "GET" && p === "/api/ws/status") {
2003
2008
  const dirRaw = url.searchParams.get("path");
2004
2009
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2005
- const ws = await import("./ws-DZ2q-u4b.js");
2010
+ const ws = await import("./ws-ymzCIG7O.js");
2006
2011
  let prov;
2007
2012
  try {
2008
2013
  prov = await ws.loadProvision();
@@ -2563,7 +2568,7 @@ Options:
2563
2568
  const perm = body.perm ?? "r";
2564
2569
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
2565
2570
  try {
2566
- const { createScopedShare } = await import("./agentShare-DUaGnMN8.js");
2571
+ const { createScopedShare } = await import("./agentShare-Bbdy8MKW.js");
2567
2572
  const share = await createScopedShare({
2568
2573
  agent: body.agent,
2569
2574
  perm,
@@ -2578,12 +2583,12 @@ Options:
2578
2583
  }
2579
2584
  }
2580
2585
  if (req.method === "GET" && p === "/api/shares") {
2581
- const { listShares } = await import("./agentShare-DUaGnMN8.js");
2586
+ const { listShares } = await import("./agentShare-Bbdy8MKW.js");
2582
2587
  return Response.json(listShares());
2583
2588
  }
2584
2589
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
2585
2590
  if (req.method === "DELETE" && revokeM) {
2586
- const { revokeShare } = await import("./agentShare-DUaGnMN8.js");
2591
+ const { revokeShare } = await import("./agentShare-Bbdy8MKW.js");
2587
2592
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
2588
2593
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
2589
2594
  }
@@ -2648,7 +2653,7 @@ Options:
2648
2653
  return new Response("UI assets not found in this install — use the /api endpoints", { status: 404 });
2649
2654
  }
2650
2655
  };
2651
- const httpFetch = async (req) => {
2656
+ const httpFetch = async (req, srv) => {
2652
2657
  const p = new URL(req.url).pathname;
2653
2658
  if (req.method === "GET" && (p === "/" || p === "/index.html")) return serveUiFile("index.html", "text/html; charset=utf-8");
2654
2659
  if (req.method === "GET" && p === "/r") return Response.redirect("/r/", 302);
@@ -2664,13 +2669,60 @@ Options:
2664
2669
  if (req.method === "GET" && p === "/manifest.webmanifest") return serveUiFile("manifest.webmanifest", "application/manifest+json");
2665
2670
  if (req.method === "GET" && p === "/icon.svg") return serveUiFile("icon.svg", "image/svg+xml");
2666
2671
  if (req.method === "GET" && p === "/favicon.ico") return new Response(null, { status: 204 });
2667
- return apiFetch(req);
2672
+ return apiFetch(req, srv);
2668
2673
  };
2669
2674
  const serverOpts = {
2670
2675
  hostname: host,
2671
2676
  port,
2672
2677
  idleTimeout: 0,
2673
- fetch: httpFetch
2678
+ fetch: (req, srv) => httpFetch(req, srv),
2679
+ websocket: {
2680
+ idleTimeout: 960,
2681
+ message: async (ws, raw) => {
2682
+ let m;
2683
+ try {
2684
+ m = JSON.parse(String(raw));
2685
+ } catch {
2686
+ return;
2687
+ }
2688
+ const { id, method, path, body } = m || {};
2689
+ if (!id || typeof path !== "string" || !path.startsWith("/api/")) return;
2690
+ try {
2691
+ const tok = ws.data?.muxToken || "";
2692
+ const u = "http://mux.internal" + path + (tok ? (path.includes("?") ? "&" : "?") + "token=" + encodeURIComponent(tok) : "");
2693
+ const res = await apiFetch(new Request(u, {
2694
+ method: method || "GET",
2695
+ headers: body != null ? { "content-type": "application/json" } : void 0,
2696
+ body: body != null ? JSON.stringify(body) : void 0
2697
+ }));
2698
+ if ((res.headers.get("content-type") || "").includes("text/event-stream")) {
2699
+ try {
2700
+ await res.body?.cancel();
2701
+ } catch {}
2702
+ ws.send(JSON.stringify({
2703
+ id,
2704
+ status: 501,
2705
+ text: "streams not supported over mux"
2706
+ }));
2707
+ return;
2708
+ }
2709
+ const text = await res.text();
2710
+ ws.send(JSON.stringify({
2711
+ id,
2712
+ status: res.status,
2713
+ text
2714
+ }));
2715
+ } catch (e) {
2716
+ try {
2717
+ ws.send(JSON.stringify({
2718
+ id,
2719
+ status: 599,
2720
+ text: String(e?.message ?? e)
2721
+ }));
2722
+ } catch {}
2723
+ }
2724
+ }
2725
+ }
2674
2726
  };
2675
2727
  if (useHttps) serverOpts.tls = {
2676
2728
  cert: Bun.file(certPath),
@@ -2769,7 +2821,7 @@ Options:
2769
2821
  const shutdown = (resolve) => {
2770
2822
  if (heartbeat) clearInterval(heartbeat);
2771
2823
  closeShare?.();
2772
- import("./agentShare-DUaGnMN8.js").then((m) => m.revokeAllShares()).catch(() => {});
2824
+ import("./agentShare-Bbdy8MKW.js").then((m) => m.revokeAllShares()).catch(() => {});
2773
2825
  server?.stop();
2774
2826
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
2775
2827
  };
@@ -2782,4 +2834,4 @@ Options:
2782
2834
 
2783
2835
  //#endregion
2784
2836
  export { cmdServe };
2785
- //# sourceMappingURL=serve-D71iG-bH.js.map
2837
+ //# sourceMappingURL=serve-C9nCZ2k0.js.map
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
32
32
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
33
33
  if (noShare) return 0;
34
34
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
35
- const { cmdServe } = await import("./serve-D71iG-bH.js");
35
+ const { cmdServe } = await import("./serve-C9nCZ2k0.js");
36
36
  return cmdServe([
37
37
  "install",
38
38
  "--share",
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdSetup };
45
- //# sourceMappingURL=setup-DEzyCwHH.js.map
45
+ //# sourceMappingURL=setup-B70ZV1aE.js.map
@@ -1237,19 +1237,19 @@ async function runSubcommand(argv) {
1237
1237
  case "restart": return await cmdRestart(rest);
1238
1238
  case "note": return await cmdNote(rest);
1239
1239
  case "serve": {
1240
- const { cmdServe } = await import("./serve-D71iG-bH.js");
1240
+ const { cmdServe } = await import("./serve-C9nCZ2k0.js");
1241
1241
  return cmdServe(rest);
1242
1242
  }
1243
1243
  case "setup": {
1244
- const { cmdSetup } = await import("./setup-DEzyCwHH.js");
1244
+ const { cmdSetup } = await import("./setup-B70ZV1aE.js");
1245
1245
  return cmdSetup(rest);
1246
1246
  }
1247
1247
  case "ws": {
1248
- const { cmdWs } = await import("./ws-DZ2q-u4b.js");
1248
+ const { cmdWs } = await import("./ws-ymzCIG7O.js");
1249
1249
  return cmdWs(rest);
1250
1250
  }
1251
1251
  case "schedule": {
1252
- const { cmdSchedule } = await import("./schedule-CuH1FRnq.js");
1252
+ const { cmdSchedule } = await import("./schedule-Bj2KaiMh.js");
1253
1253
  return cmdSchedule(rest);
1254
1254
  }
1255
1255
  case "remote": {
@@ -4269,7 +4269,7 @@ async function cmdNotify(rest) {
4269
4269
  }
4270
4270
  const ensure = async () => {
4271
4271
  if (!argv["ensure-daemon"]) return;
4272
- const { ensureDaemon } = await import("./notifyDaemon-DYPvxxpg.js");
4272
+ const { ensureDaemon } = await import("./notifyDaemon-CPyPTBL5.js");
4273
4273
  await ensureDaemon().catch(() => null);
4274
4274
  };
4275
4275
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4343,7 +4343,7 @@ async function cmdNotifyCursor(args) {
4343
4343
  }
4344
4344
  async function cmdNotifyd(rest) {
4345
4345
  const sub = rest[0] ?? "status";
4346
- const daemon = await import("./notifyDaemon-DYPvxxpg.js");
4346
+ const daemon = await import("./notifyDaemon-CPyPTBL5.js");
4347
4347
  switch (sub) {
4348
4348
  case "run": return daemon.runDaemon();
4349
4349
  case "once": return daemon.runDaemon({ once: true });
@@ -4370,4 +4370,4 @@ async function cmdNotifyd(rest) {
4370
4370
 
4371
4371
  //#endregion
4372
4372
  export { daemonLockOwnerPath as $, renderRawLog as A, submitAndConfirm as B, matchKeyword as C, recentMessageEdges as D, readPtysize as E, restartHintLines as F, gcInboxes as G, writeKeysPaced as H, runSubcommand as I, listInboxParents as J, hostId as K, snapshotStatus as L, resolveOne as M, resolveReadWindow as N, recentReadEdges as O, resolveResumeArgs as P, daemonLockDir as Q, stdinActivityPath as R, listRecords as S, readNotes as T, writeToIpc as U, waitForLogQuiet as V, appendEvent as W, readInbox as X, liveWatchers as Y, shouldStealLock as Z, isPidAlive as _, cmdHelp as a, isUserTyping as b, deriveLiveState as c, extractMenu as d, notifyDir as et, extractNeedsInput as f, isExitRequest as g, isAgentStuck as h, backoffWhileTyping as i, renderRawLogLines as j, renderLogTailLines as k, deriveLiveStatus as l, finalizedLines as m, READ_PAGE_DEFAULT as n, controlCodeFromName as o, extractTaskCounts as p, isTransientLockMkdirError as q, TYPING_WINDOW_MS as r, cursorAbs as s, GRACEFUL_EXIT_COMMANDS as t, TYPING_BADGE as tt, extractBadges as u, isSlashCommand as v, menuSelectKeys as w, lastStdinAt as x, isSubcommand as y, stopTipForCli as z };
4373
- //# sourceMappingURL=subcommands-C2VO1PO8.js.map
4373
+ //# sourceMappingURL=subcommands-DzGeZpfs.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { A as renderRawLog, B as submitAndConfirm, C as matchKeyword, D as recentMessageEdges, E as readPtysize, F as restartHintLines, H as writeKeysPaced, I as runSubcommand, L as snapshotStatus, M as resolveOne, N as resolveReadWindow, O as recentReadEdges, P as resolveResumeArgs, R as stdinActivityPath, S as listRecords, T as readNotes, U as writeToIpc, V as waitForLogQuiet, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as stopTipForCli } from "./subcommands-C2VO1PO8.js";
5
+ import { A as renderRawLog, B as submitAndConfirm, C as matchKeyword, D as recentMessageEdges, E as readPtysize, F as restartHintLines, H as writeKeysPaced, I as runSubcommand, L as snapshotStatus, M as resolveOne, N as resolveReadWindow, O as recentReadEdges, P as resolveResumeArgs, R as stdinActivityPath, S as listRecords, T as readNotes, U as writeToIpc, V as waitForLogQuiet, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as stopTipForCli } from "./subcommands-DzGeZpfs.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-Cim0dBU7.js";
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-Db6hxBm6.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-CNMl13dC.js";
5
5
  import { t as PidStore } from "./pidStore-BIvsBQ8X.js";
@@ -1901,4 +1901,4 @@ function sleep(ms) {
1901
1901
 
1902
1902
  //#endregion
1903
1903
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1904
- //# sourceMappingURL=ts-BHGjVVXi.js.map
1904
+ //# sourceMappingURL=ts-B8jTQxjO.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.221.0";
10
+ var version = "1.221.1";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -215,4 +215,4 @@ async function displayVersion() {
215
215
 
216
216
  //#endregion
217
217
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
218
- //# sourceMappingURL=versionChecker-RD3-wE5w.js.map
218
+ //# sourceMappingURL=versionChecker-Db6hxBm6.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { S as listRecords } from "./subcommands-C2VO1PO8.js";
5
+ import { S as listRecords } from "./subcommands-DzGeZpfs.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-Cim0dBU7.js";
@@ -418,4 +418,4 @@ async function cmdWs(args) {
418
418
 
419
419
  //#endregion
420
420
  export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, workspaceStatus };
421
- //# sourceMappingURL=ws-DZ2q-u4b.js.map
421
+ //# sourceMappingURL=ws-ymzCIG7O.js.map
package/lab/ui/index.html CHANGED
@@ -2667,24 +2667,108 @@
2667
2667
  // ---- transports: a uniform { fetchJSON, post, subscribe } over each wire ----
2668
2668
  // local (same-origin ay serve), an ay-share RTCClient, or a codehost room.
2669
2669
  // A codehost room builds one of these per machine in it (see chPeerTx).
2670
+ //
2671
+ // Local requests ride ONE multiplexed WebSocket (/api/mux) when the
2672
+ // daemon offers it: HTTP/1.1 gives the origin ~6 concurrent connections
2673
+ // and no multiplexing, so console bursts (a palette query fans out ~20
2674
+ // tail reads + a history search) queued behind each other for seconds —
2675
+ // the same trick the WebRTC / codehost transports already play. Plain
2676
+ // fetch remains the fallback while the socket is down or the daemon
2677
+ // predates /api/mux; subscribe() stays on EventSource (streams don't
2678
+ // fit req/res frames — the server refuses them over the mux).
2679
+ const localMux = {
2680
+ ws: null,
2681
+ state: "idle", // idle | connecting | open | dead (fallback until retryAt)
2682
+ pend: new Map(), // id → {resolve, reject}
2683
+ seq: 0,
2684
+ retryAt: 0,
2685
+ ensure() {
2686
+ if (this.state === "open" || this.state === "connecting") return;
2687
+ if (this.state === "dead" && Date.now() < this.retryAt) return;
2688
+ this.state = "connecting";
2689
+ try {
2690
+ const proto = location.protocol === "https:" ? "wss://" : "ws://";
2691
+ const ws = new WebSocket(proto + location.host + withTok("/api/mux"));
2692
+ this.ws = ws;
2693
+ ws.onopen = () => {
2694
+ if (this.ws === ws) this.state = "open";
2695
+ };
2696
+ ws.onmessage = (ev) => {
2697
+ let m;
2698
+ try {
2699
+ m = JSON.parse(ev.data);
2700
+ } catch {
2701
+ return;
2702
+ }
2703
+ const p = this.pend.get(m.id);
2704
+ if (!p) return;
2705
+ this.pend.delete(m.id);
2706
+ p.resolve(m);
2707
+ };
2708
+ const drop = () => {
2709
+ if (this.ws !== ws) return;
2710
+ this.ws = null;
2711
+ this.state = "dead";
2712
+ this.retryAt = Date.now() + 5000; // plain-fetch fallback, retry soon
2713
+ for (const [, p] of this.pend) p.reject(new Error("mux closed"));
2714
+ this.pend.clear();
2715
+ };
2716
+ ws.onclose = drop;
2717
+ ws.onerror = drop;
2718
+ } catch {
2719
+ this.state = "dead";
2720
+ this.retryAt = Date.now() + 5000;
2721
+ }
2722
+ },
2723
+ req(method, path, body) {
2724
+ const id = ++this.seq;
2725
+ return new Promise((resolve, reject) => {
2726
+ this.pend.set(id, { resolve, reject });
2727
+ try {
2728
+ this.ws.send(JSON.stringify({ id, method, path, body }));
2729
+ } catch (e) {
2730
+ this.pend.delete(id);
2731
+ reject(e);
2732
+ }
2733
+ });
2734
+ },
2735
+ };
2736
+ // One request, mux-first: {status, text} from the socket when it's open
2737
+ // (a mid-flight drop falls through), plain fetch otherwise.
2738
+ async function localReq(method, path, bodyObj) {
2739
+ localMux.ensure();
2740
+ if (localMux.state === "open") {
2741
+ try {
2742
+ return await localMux.req(method, path, bodyObj);
2743
+ } catch {
2744
+ /* socket died mid-flight — fall through to plain fetch */
2745
+ }
2746
+ }
2747
+ const opts =
2748
+ method === "GET"
2749
+ ? undefined
2750
+ : {
2751
+ method,
2752
+ headers: bodyObj != null ? { "Content-Type": "application/json" } : undefined,
2753
+ body: bodyObj != null ? JSON.stringify(bodyObj) : undefined,
2754
+ };
2755
+ const r = await fetch(withTok(path), opts);
2756
+ return { status: r.status, text: await r.text() };
2757
+ }
2670
2758
  const localTx = {
2671
2759
  async fetchJSON(path) {
2672
- return (await fetch(withTok(path))).json();
2760
+ return JSON.parse((await localReq("GET", path)).text);
2673
2761
  },
2674
2762
  async fetchText(path) {
2675
- return (await fetch(withTok(path))).text();
2763
+ return (await localReq("GET", path)).text;
2676
2764
  },
2677
2765
  async post(path, bodyObj) {
2678
- const r = await fetch(withTok(path), {
2679
- method: "POST",
2680
- headers: { "Content-Type": "application/json" },
2681
- body: JSON.stringify(bodyObj),
2682
- });
2683
- return { ok: r.ok, text: await r.text() };
2766
+ const r = await localReq("POST", path, bodyObj ?? {});
2767
+ return { ok: r.status >= 200 && r.status < 300, text: r.text };
2684
2768
  },
2685
2769
  async del(path) {
2686
- const r = await fetch(withTok(path), { method: "DELETE" });
2687
- return { ok: r.ok, text: await r.text() };
2770
+ const r = await localReq("DELETE", path);
2771
+ return { ok: r.status >= 200 && r.status < 300, text: r.text };
2688
2772
  },
2689
2773
  subscribe(path, onText, onOpen, onError) {
2690
2774
  const ev = new EventSource(withTok(path));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.221.0",
3
+ "version": "1.221.1",
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",
package/ts/serve.ts CHANGED
@@ -2001,7 +2001,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
2001
2001
  // The whole API as a plain handler: served over HTTP by Bun.serve (--http)
2002
2002
  // and called in-process by the WebRTC bridge (--webrtc) — the latter needs
2003
2003
  // no TCP port at all.
2004
- const apiFetch = async (req: Request): Promise<Response> => {
2004
+ const apiFetch = async (req: Request, srv?: { upgrade: (r: Request, o?: unknown) => boolean }): Promise<Response> => {
2005
2005
  if (!checkAuth(req, token)) {
2006
2006
  return new Response("Unauthorized", { status: 401 });
2007
2007
  }
@@ -2009,6 +2009,20 @@ export async function cmdServe(rest: string[]): Promise<number> {
2009
2009
  const url = new URL(req.url);
2010
2010
  const p = url.pathname;
2011
2011
 
2012
+ // GET /api/mux — WebSocket request multiplexer. HTTP/1.1 gives a browser
2013
+ // ~6 concurrent same-origin connections and no multiplexing, so console
2014
+ // bursts (a palette query fans out ~20 tail reads + a history search)
2015
+ // queue behind each other for seconds. The mux carries {id, method, path,
2016
+ // body} frames over ONE socket and answers {id, status, text} — each frame
2017
+ // is dispatched through THIS same handler (with the socket's token), so
2018
+ // there is exactly one API surface. Streams (SSE) don't fit req/res
2019
+ // frames and stay on EventSource; the handler refuses them.
2020
+ if (p === "/api/mux" && srv && req.headers.get("upgrade")?.toLowerCase() === "websocket") {
2021
+ const muxToken = url.searchParams.get("token") || "";
2022
+ if (srv.upgrade(req, { data: { muxToken } })) return undefined as unknown as Response;
2023
+ return new Response("expected websocket", { status: 426 });
2024
+ }
2025
+
2012
2026
  // GET /api/ls
2013
2027
  if (req.method === "GET" && p === "/api/ls") {
2014
2028
  const keyword = url.searchParams.get("keyword") ?? undefined;
@@ -3487,7 +3501,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
3487
3501
  });
3488
3502
  }
3489
3503
  };
3490
- const httpFetch = async (req: Request): Promise<Response> => {
3504
+ const httpFetch = async (req: Request, srv?: { upgrade: (r: Request, o?: unknown) => boolean }): Promise<Response> => {
3491
3505
  const p = new URL(req.url).pathname;
3492
3506
  if (req.method === "GET" && (p === "/" || p === "/index.html"))
3493
3507
  return serveUiFile("index.html", "text/html; charset=utf-8");
@@ -3522,14 +3536,64 @@ export async function cmdServe(rest: string[]): Promise<number> {
3522
3536
  return serveUiFile("manifest.webmanifest", "application/manifest+json");
3523
3537
  if (req.method === "GET" && p === "/icon.svg") return serveUiFile("icon.svg", "image/svg+xml");
3524
3538
  if (req.method === "GET" && p === "/favicon.ico") return new Response(null, { status: 204 });
3525
- return apiFetch(req);
3539
+ return apiFetch(req, srv);
3526
3540
  };
3527
3541
 
3528
3542
  const serverOpts: any = {
3529
3543
  hostname: host,
3530
3544
  port,
3531
3545
  idleTimeout: 0, // never time out SSE/tail streams
3532
- fetch: httpFetch,
3546
+ fetch: (req: Request, srv: unknown) =>
3547
+ httpFetch(req, srv as { upgrade: (r: Request, o?: unknown) => boolean }),
3548
+ // /api/mux frames — each one re-enters apiFetch as a synthetic Request
3549
+ // carrying the socket's token, so auth and routing stay single-sourced.
3550
+ websocket: {
3551
+ // Bun's per-socket idle cap; the console reconnects lazily on drop, but
3552
+ // don't let a quiet-but-alive console churn sockets every 2 minutes.
3553
+ idleTimeout: 960,
3554
+ message: async (ws: any, raw: string | Buffer) => {
3555
+ let m: { id?: number; method?: string; path?: string; body?: unknown };
3556
+ try {
3557
+ m = JSON.parse(String(raw));
3558
+ } catch {
3559
+ return; // not a mux frame — drop
3560
+ }
3561
+ const { id, method, path, body } = m || {};
3562
+ if (!id || typeof path !== "string" || !path.startsWith("/api/")) return;
3563
+ try {
3564
+ const tok = ws.data?.muxToken || "";
3565
+ const u =
3566
+ "http://mux.internal" +
3567
+ path +
3568
+ (tok ? (path.includes("?") ? "&" : "?") + "token=" + encodeURIComponent(tok) : "");
3569
+ const req = new Request(u, {
3570
+ method: method || "GET",
3571
+ headers: body != null ? { "content-type": "application/json" } : undefined,
3572
+ body: body != null ? JSON.stringify(body) : undefined,
3573
+ });
3574
+ const res = await apiFetch(req);
3575
+ // Streams can't ride a req/res frame — refuse instead of buffering an
3576
+ // endless SSE body (subscribe stays on EventSource client-side).
3577
+ if ((res.headers.get("content-type") || "").includes("text/event-stream")) {
3578
+ try {
3579
+ await res.body?.cancel();
3580
+ } catch {
3581
+ /* already closed */
3582
+ }
3583
+ ws.send(JSON.stringify({ id, status: 501, text: "streams not supported over mux" }));
3584
+ return;
3585
+ }
3586
+ const text = await res.text();
3587
+ ws.send(JSON.stringify({ id, status: res.status, text }));
3588
+ } catch (e) {
3589
+ try {
3590
+ ws.send(JSON.stringify({ id, status: 599, text: String((e as Error)?.message ?? e) }));
3591
+ } catch {
3592
+ /* socket gone */
3593
+ }
3594
+ }
3595
+ },
3596
+ },
3533
3597
  };
3534
3598
  if (useHttps) {
3535
3599
  serverOpts.tls = { cert: Bun.file(certPath!), key: Bun.file(keyPath!) };
@@ -1,9 +0,0 @@
1
- import "./ts-BHGjVVXi.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-RD3-wE5w.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import "./messageLog-CxrKJj77.js";
7
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DSinex5A.js";
8
-
9
- export { SUPPORTED_CLIS };