agent-yes 1.220.0 → 1.221.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.
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-f4Ma0Z5W.js";
1
+ import { t as CLIS_CONFIG } from "./ts-BHGjVVXi.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-Caf2VGdD.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-DSinex5A.js.map
@@ -0,0 +1,9 @@
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 };
@@ -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-DUXM40pT.js";
5
+ import { M as resolveOne } from "./subcommands-C2VO1PO8.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-D3rB5mPN.js.map
232
+ //# sourceMappingURL=agentShare-DUaGnMN8.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-37_Q3yKY.js";
5
- import { n as getRustBinary } from "./rustBinary-DHtHddAg.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";
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-DnBuCOK9.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-8EdoNkxC.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-BLJ7sQCy.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-NZ7T0-20.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-f4Ma0Z5W.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-BHGjVVXi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-37_Q3yKY.js";
3
+ import "./versionChecker-RD3-wE5w.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-DUXM40pT.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";
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-CRjiUotr.js.map
592
+ //# sourceMappingURL=notifyDaemon-DYPvxxpg.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-37_Q3yKY.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.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-DHtHddAg.js.map
228
+ //# sourceMappingURL=rustBinary-DBT3Wo9A.js.map
@@ -1,10 +1,10 @@
1
- import "./ts-f4Ma0Z5W.js";
1
+ import "./ts-BHGjVVXi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-37_Q3yKY.js";
3
+ import "./versionChecker-RD3-wE5w.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-Caf2VGdD.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DSinex5A.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-DawiFWf_.js.map
154
+ //# sourceMappingURL=schedule-CuH1FRnq.js.map
@@ -1,15 +1,15 @@
1
- import "./ts-f4Ma0Z5W.js";
1
+ import "./ts-BHGjVVXi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-37_Q3yKY.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-DHtHddAg.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-DBT3Wo9A.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-Caf2VGdD.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, k as renderLogTailLines, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, q as isTransientLockMkdirError, tt as TYPING_BADGE, u as extractBadges } from "./subcommands-DUXM40pT.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";
13
13
  import "./e2e-jb0Hp43q.js";
14
14
  import "./webrtcLink-B7REGtK2.js";
15
15
  import "./remotes-Cim0dBU7.js";
@@ -366,6 +366,10 @@ function tokenPath() {
366
366
  function heartbeatPath() {
367
367
  return path.join(agentYesHome(), ".serve-heartbeat");
368
368
  }
369
+ const SEARCH_TAIL_BYTES = 256 * 1024;
370
+ const SEARCH_MAX_HITS = 20;
371
+ const SEARCH_CACHE_MAX = 300;
372
+ const searchTextCache = /* @__PURE__ */ new Map();
369
373
  const HEARTBEAT_WRITE_MS = 5e3;
370
374
  const HEARTBEAT_STALE_MS = 15e3;
371
375
  async function loadOrCreateToken(tokenFlag) {
@@ -1598,6 +1602,91 @@ Options:
1598
1602
  return new Response(e.message, { status: 500 });
1599
1603
  }
1600
1604
  }
1605
+ if (req.method === "GET" && p === "/api/search") {
1606
+ const q = (url.searchParams.get("q") || "").trim();
1607
+ if (q.length < 2) return Response.json({
1608
+ hits: [],
1609
+ scanned: 0,
1610
+ total: 0,
1611
+ partial: false
1612
+ });
1613
+ const ql = q.toLowerCase();
1614
+ const budget = Math.min(3e3, Number(url.searchParams.get("budget_ms")) || 900);
1615
+ const t0 = Date.now();
1616
+ try {
1617
+ const records = await listRecords(void 0, defaultOpts({ all: true }));
1618
+ const live = (await Promise.all(records.map(async (r) => ({
1619
+ r,
1620
+ st: r.log_file ? await stat(r.log_file).catch(() => null) : null
1621
+ })))).filter((x) => x.st).sort((a, b) => (b.st.mtimeMs || 0) - (a.st.mtimeMs || 0));
1622
+ const hits = [];
1623
+ let scanned = 0;
1624
+ let partial = false;
1625
+ for (const { r, st } of live) {
1626
+ if (hits.length >= SEARCH_MAX_HITS) break;
1627
+ if (Date.now() - t0 > budget) {
1628
+ partial = true;
1629
+ break;
1630
+ }
1631
+ const key = String(r.pid);
1632
+ let ent = searchTextCache.get(key);
1633
+ if (!ent || ent.size !== st.size || ent.mtimeMs !== st.mtimeMs) try {
1634
+ const fh = await open(r.log_file, "r");
1635
+ let buf;
1636
+ try {
1637
+ if (st.size <= SEARCH_TAIL_BYTES) {
1638
+ const data = await fh.readFile();
1639
+ buf = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
1640
+ } else {
1641
+ const tmp = Buffer.alloc(SEARCH_TAIL_BYTES);
1642
+ const { bytesRead } = await fh.read(tmp, 0, SEARCH_TAIL_BYTES, st.size - SEARCH_TAIL_BYTES);
1643
+ buf = new Uint8Array(tmp.buffer, 0, bytesRead);
1644
+ }
1645
+ } finally {
1646
+ await fh.close();
1647
+ }
1648
+ const geom = await readPtysize(r.pid).catch(() => null) ?? void 0;
1649
+ const lines = await renderRawLogLines(buf, geom ?? void 0);
1650
+ ent = {
1651
+ size: st.size,
1652
+ mtimeMs: st.mtimeMs,
1653
+ text: lines.join("\n")
1654
+ };
1655
+ searchTextCache.set(key, ent);
1656
+ if (searchTextCache.size > SEARCH_CACHE_MAX) {
1657
+ const k = searchTextCache.keys().next().value;
1658
+ if (k !== void 0) searchTextCache.delete(k);
1659
+ }
1660
+ } catch {
1661
+ continue;
1662
+ }
1663
+ else {
1664
+ searchTextCache.delete(key);
1665
+ searchTextCache.set(key, ent);
1666
+ }
1667
+ scanned++;
1668
+ const idx = ent.text.toLowerCase().lastIndexOf(ql);
1669
+ if (idx < 0) continue;
1670
+ const from = Math.max(0, idx - 60);
1671
+ const snippet = ent.text.slice(from, idx + ql.length + 60).replace(/\s+/g, " ").trim();
1672
+ hits.push({
1673
+ pid: r.pid,
1674
+ cli: r.cli,
1675
+ cwd: r.cwd,
1676
+ snippet,
1677
+ match_at: idx
1678
+ });
1679
+ }
1680
+ return Response.json({
1681
+ hits,
1682
+ scanned,
1683
+ total: live.length,
1684
+ partial
1685
+ });
1686
+ } catch (e) {
1687
+ return new Response(e.message, { status: 500 });
1688
+ }
1689
+ }
1601
1690
  if (req.method === "GET" && p === "/api/ls/subscribe") {
1602
1691
  const keyword = url.searchParams.get("keyword") ?? void 0;
1603
1692
  const opts = defaultOpts({
@@ -1893,7 +1982,7 @@ Options:
1893
1982
  }
1894
1983
  });
1895
1984
  if (req.method === "GET" && p === "/api/ws") {
1896
- const ws = await import("./ws-CH6Uyznd.js");
1985
+ const ws = await import("./ws-DZ2q-u4b.js");
1897
1986
  try {
1898
1987
  await ws.loadProvision();
1899
1988
  } catch (e) {
@@ -1913,7 +2002,7 @@ Options:
1913
2002
  if (req.method === "GET" && p === "/api/ws/status") {
1914
2003
  const dirRaw = url.searchParams.get("path");
1915
2004
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
1916
- const ws = await import("./ws-CH6Uyznd.js");
2005
+ const ws = await import("./ws-DZ2q-u4b.js");
1917
2006
  let prov;
1918
2007
  try {
1919
2008
  prov = await ws.loadProvision();
@@ -2474,7 +2563,7 @@ Options:
2474
2563
  const perm = body.perm ?? "r";
2475
2564
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
2476
2565
  try {
2477
- const { createScopedShare } = await import("./agentShare-D3rB5mPN.js");
2566
+ const { createScopedShare } = await import("./agentShare-DUaGnMN8.js");
2478
2567
  const share = await createScopedShare({
2479
2568
  agent: body.agent,
2480
2569
  perm,
@@ -2489,12 +2578,12 @@ Options:
2489
2578
  }
2490
2579
  }
2491
2580
  if (req.method === "GET" && p === "/api/shares") {
2492
- const { listShares } = await import("./agentShare-D3rB5mPN.js");
2581
+ const { listShares } = await import("./agentShare-DUaGnMN8.js");
2493
2582
  return Response.json(listShares());
2494
2583
  }
2495
2584
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
2496
2585
  if (req.method === "DELETE" && revokeM) {
2497
- const { revokeShare } = await import("./agentShare-D3rB5mPN.js");
2586
+ const { revokeShare } = await import("./agentShare-DUaGnMN8.js");
2498
2587
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
2499
2588
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
2500
2589
  }
@@ -2680,7 +2769,7 @@ Options:
2680
2769
  const shutdown = (resolve) => {
2681
2770
  if (heartbeat) clearInterval(heartbeat);
2682
2771
  closeShare?.();
2683
- import("./agentShare-D3rB5mPN.js").then((m) => m.revokeAllShares()).catch(() => {});
2772
+ import("./agentShare-DUaGnMN8.js").then((m) => m.revokeAllShares()).catch(() => {});
2684
2773
  server?.stop();
2685
2774
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
2686
2775
  };
@@ -2693,4 +2782,4 @@ Options:
2693
2782
 
2694
2783
  //#endregion
2695
2784
  export { cmdServe };
2696
- //# sourceMappingURL=serve-lLwcOP5g.js.map
2785
+ //# sourceMappingURL=serve-D71iG-bH.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-lLwcOP5g.js");
35
+ const { cmdServe } = await import("./serve-D71iG-bH.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-KYLU9Llc.js.map
45
+ //# sourceMappingURL=setup-DEzyCwHH.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-DUXM40pT.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";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-Cim0dBU7.js";
@@ -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-lLwcOP5g.js");
1240
+ const { cmdServe } = await import("./serve-D71iG-bH.js");
1241
1241
  return cmdServe(rest);
1242
1242
  }
1243
1243
  case "setup": {
1244
- const { cmdSetup } = await import("./setup-KYLU9Llc.js");
1244
+ const { cmdSetup } = await import("./setup-DEzyCwHH.js");
1245
1245
  return cmdSetup(rest);
1246
1246
  }
1247
1247
  case "ws": {
1248
- const { cmdWs } = await import("./ws-CH6Uyznd.js");
1248
+ const { cmdWs } = await import("./ws-DZ2q-u4b.js");
1249
1249
  return cmdWs(rest);
1250
1250
  }
1251
1251
  case "schedule": {
1252
- const { cmdSchedule } = await import("./schedule-DawiFWf_.js");
1252
+ const { cmdSchedule } = await import("./schedule-CuH1FRnq.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-CRjiUotr.js");
4272
+ const { ensureDaemon } = await import("./notifyDaemon-DYPvxxpg.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-CRjiUotr.js");
4346
+ const daemon = await import("./notifyDaemon-DYPvxxpg.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-DUXM40pT.js.map
4373
+ //# sourceMappingURL=subcommands-C2VO1PO8.js.map
@@ -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-37_Q3yKY.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-RD3-wE5w.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-f4Ma0Z5W.js.map
1904
+ //# sourceMappingURL=ts-BHGjVVXi.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.220.0";
10
+ var version = "1.221.0";
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-37_Q3yKY.js.map
218
+ //# sourceMappingURL=versionChecker-RD3-wE5w.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-DUXM40pT.js";
5
+ import { S as listRecords } from "./subcommands-C2VO1PO8.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-CH6Uyznd.js.map
421
+ //# sourceMappingURL=ws-DZ2q-u4b.js.map
package/lab/ui/index.html CHANGED
@@ -6819,6 +6819,14 @@ my.translate = async (text, lang) => {
6819
6819
  // Tier 2 — debounced output (tail) search for alive agents not already shown.
6820
6820
  if (omniTailTimer) clearTimeout(omniTailTimer);
6821
6821
  if (q.length >= 2) omniTailTimer = setTimeout(() => omniTailSearch(q), 320);
6822
+ // Tier 3 — debounced CHAT-HISTORY search (server-side /api/search over
6823
+ // each agent's rendered log tail; covers exited agents and scrollback
6824
+ // the live-tail tier never sees). Fired just BEFORE tier 2's ~20
6825
+ // parallel /api/read calls: on HTTP/1.1 the browser caps same-origin
6826
+ // connections at ~6, so the single search request must enter the pool
6827
+ // first or it queues behind every tail read (measured: seconds).
6828
+ if (omniHistTimer) clearTimeout(omniHistTimer);
6829
+ if (q.length >= 2) omniHistTimer = setTimeout(() => omniHistorySearch(q), 300);
6822
6830
  }
6823
6831
 
6824
6832
  async function omniTailSearch(q) {
@@ -6869,6 +6877,55 @@ my.translate = async (text, lang) => {
6869
6877
  if (seq === omniTailSeq) renderOmni();
6870
6878
  }
6871
6879
 
6880
+ // Tier 3 — chat-history hits from GET /api/search on every writable live
6881
+ // source (fleet fan-out, same shape as /api/ws). The server renders each
6882
+ // agent's raw-log tail through headless xterm and caches it by
6883
+ // (size, mtime), so repeat queries are cheap; partial:true responses
6884
+ // (time budget hit while the cache warms) are simply what we show now —
6885
+ // the next keystroke re-queries a warmer cache. Hits map back to list
6886
+ // entries by (source, pid); agents already shown by tier 1/2 are skipped.
6887
+ let omniHistSeq = 0;
6888
+ let omniHistTimer = null;
6889
+ async function omniHistorySearch(q) {
6890
+ const seq = ++omniHistSeq;
6891
+ const srcs = [...sources.values()].filter((s) => s.tx?.fetchJSON && s.live && !s.readonly);
6892
+ const results = await Promise.all(
6893
+ srcs.map(async (s) => {
6894
+ try {
6895
+ const r = await s.tx.fetchJSON("/api/search?q=" + encodeURIComponent(q));
6896
+ return (r?.hits || []).map((h) => ({ h, srcId: s.id }));
6897
+ } catch {
6898
+ return []; // older daemon (404) / transport error — skip source
6899
+ }
6900
+ }),
6901
+ );
6902
+ if (seq !== omniHistSeq || !omniOpen()) return;
6903
+ const ql = q.toLowerCase();
6904
+ for (const { h, srcId } of results.flat()) {
6905
+ const key = srcId + "#" + h.pid;
6906
+ if (omniRows.some((r) => r.kind === "agent" && r.entry._key === key)) continue;
6907
+ const e = entries.find((x) => x._key === key);
6908
+ if (!e) continue; // hit for an agent the list doesn't know (raced away)
6909
+ const raw = String(h.snippet || "");
6910
+ const li = raw.toLowerCase().indexOf(ql);
6911
+ const snippet =
6912
+ li >= 0
6913
+ ? esc(raw.slice(0, li)) +
6914
+ "<b>" +
6915
+ esc(raw.slice(li, li + q.length)) +
6916
+ "</b>" +
6917
+ esc(raw.slice(li + q.length))
6918
+ : esc(raw);
6919
+ const at = omniRows.findIndex((r) => r.kind === "spawn");
6920
+ const row = { kind: "agent", entry: e, snippet };
6921
+ if (at >= 0) {
6922
+ omniRows.splice(at, 0, row);
6923
+ if (at <= omniIdx) omniIdx++; // keep the highlight on the same row
6924
+ } else omniRows.push(row);
6925
+ }
6926
+ renderOmni();
6927
+ }
6928
+
6872
6929
  function omniMove(d) {
6873
6930
  if (!omniRows.length) return;
6874
6931
  omniIdx = (omniIdx + d + omniRows.length) % omniRows.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.220.0",
3
+ "version": "1.221.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",
package/ts/serve.ts CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  recentReadEdges,
32
32
  renderLogTailLines,
33
33
  renderRawLog,
34
+ renderRawLogLines,
34
35
  resolveOne,
35
36
  snapshotStatus,
36
37
  writeToIpc,
@@ -152,6 +153,14 @@ function tokenPath(): string {
152
153
  function heartbeatPath(): string {
153
154
  return path.join(agentYesHome(), ".serve-heartbeat");
154
155
  }
156
+ // /api/search — chat-history search (v1). Per-agent rendered-tail cache, keyed
157
+ // on the log's (size, mtime): the expensive part is the headless-xterm replay,
158
+ // so an unchanged log never re-renders. Map insertion order doubles as LRU.
159
+ const SEARCH_TAIL_BYTES = 256 * 1024;
160
+ const SEARCH_MAX_HITS = 20;
161
+ const SEARCH_CACHE_MAX = 300;
162
+ const searchTextCache = new Map<string, { size: number; mtimeMs: number; text: string }>();
163
+
155
164
  const HEARTBEAT_WRITE_MS = 5_000;
156
165
  const HEARTBEAT_STALE_MS = 15_000; // event loop is wedged if no stamp this long (3 missed)
157
166
 
@@ -2015,6 +2024,99 @@ export async function cmdServe(rest: string[]): Promise<number> {
2015
2024
  }
2016
2025
  }
2017
2026
 
2027
+ // GET /api/search?q= — chat-history search across every agent's log.
2028
+ // v1 ("simple" scope, by design): no sidecar index yet — each agent's raw
2029
+ // log TAIL (SEARCH_TAIL_BYTES) is rendered through the same headless-xterm
2030
+ // path the reader uses (so TUI redraw spam collapses into real transcript
2031
+ // lines) and cached by (size, mtime); only agents whose log moved re-render.
2032
+ // Requests scan newest-first under a time budget and return partial:true
2033
+ // when the budget ran out before the fleet was covered — the console just
2034
+ // re-queries and hits the now-warm cache. Upgrade path: an incremental
2035
+ // transcript sidecar + full-history index (see the /api/ws pattern).
2036
+ if (req.method === "GET" && p === "/api/search") {
2037
+ const q = (url.searchParams.get("q") || "").trim();
2038
+ if (q.length < 2) return Response.json({ hits: [], scanned: 0, total: 0, partial: false });
2039
+ const ql = q.toLowerCase();
2040
+ const budget = Math.min(3000, Number(url.searchParams.get("budget_ms")) || 900);
2041
+ const t0 = Date.now();
2042
+ try {
2043
+ const records = await listRecords(undefined, defaultOpts({ all: true }));
2044
+ // newest activity first — the log mtime is the stop/activity clock.
2045
+ const stats = await Promise.all(
2046
+ records.map(async (r) => ({
2047
+ r,
2048
+ st: r.log_file ? await stat(r.log_file).catch(() => null) : null,
2049
+ })),
2050
+ );
2051
+ const live = stats
2052
+ .filter((x) => x.st)
2053
+ .sort((a, b) => (b.st!.mtimeMs || 0) - (a.st!.mtimeMs || 0));
2054
+ const hits: unknown[] = [];
2055
+ let scanned = 0;
2056
+ let partial = false;
2057
+ for (const { r, st } of live) {
2058
+ if (hits.length >= SEARCH_MAX_HITS) break;
2059
+ if (Date.now() - t0 > budget) {
2060
+ partial = true;
2061
+ break;
2062
+ }
2063
+ const key = String(r.pid);
2064
+ let ent = searchTextCache.get(key);
2065
+ if (!ent || ent.size !== st!.size || ent.mtimeMs !== st!.mtimeMs) {
2066
+ try {
2067
+ const fh = await open(r.log_file!, "r");
2068
+ let buf: Uint8Array;
2069
+ try {
2070
+ if (st!.size <= SEARCH_TAIL_BYTES) {
2071
+ const data = await fh.readFile();
2072
+ buf = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
2073
+ } else {
2074
+ const tmp = Buffer.alloc(SEARCH_TAIL_BYTES);
2075
+ const { bytesRead } = await fh.read(
2076
+ tmp,
2077
+ 0,
2078
+ SEARCH_TAIL_BYTES,
2079
+ st!.size - SEARCH_TAIL_BYTES,
2080
+ );
2081
+ buf = new Uint8Array(tmp.buffer, 0, bytesRead);
2082
+ }
2083
+ } finally {
2084
+ await fh.close();
2085
+ }
2086
+ const geom = (await readPtysize(r.pid).catch(() => null)) ?? undefined;
2087
+ const lines = await renderRawLogLines(buf, geom ?? undefined);
2088
+ ent = { size: st!.size, mtimeMs: st!.mtimeMs, text: lines.join("\n") };
2089
+ searchTextCache.set(key, ent);
2090
+ // bound the cache: drop the oldest entries past the cap
2091
+ if (searchTextCache.size > SEARCH_CACHE_MAX) {
2092
+ const k = searchTextCache.keys().next().value;
2093
+ if (k !== undefined) searchTextCache.delete(k);
2094
+ }
2095
+ } catch {
2096
+ continue; // unreadable log — skip this agent
2097
+ }
2098
+ } else {
2099
+ // refresh LRU position
2100
+ searchTextCache.delete(key);
2101
+ searchTextCache.set(key, ent);
2102
+ }
2103
+ scanned++;
2104
+ const tl = ent.text.toLowerCase();
2105
+ const idx = tl.lastIndexOf(ql); // latest occurrence reads most relevant
2106
+ if (idx < 0) continue;
2107
+ const from = Math.max(0, idx - 60);
2108
+ const snippet = ent.text
2109
+ .slice(from, idx + ql.length + 60)
2110
+ .replace(/\s+/g, " ")
2111
+ .trim();
2112
+ hits.push({ pid: r.pid, cli: r.cli, cwd: r.cwd, snippet, match_at: idx });
2113
+ }
2114
+ return Response.json({ hits, scanned, total: live.length, partial });
2115
+ } catch (e) {
2116
+ return new Response((e as Error).message, { status: 500 });
2117
+ }
2118
+ }
2119
+
2018
2120
  // GET /api/ls/subscribe — SSE: throttled live deltas of the agent list.
2019
2121
  // The console used to re-poll /api/ls every 3s; this streams the SAME records
2020
2122
  // (incl. each agent's OSC title) but only what CHANGED since the last tick, so
@@ -1,9 +0,0 @@
1
- import "./ts-f4Ma0Z5W.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-37_Q3yKY.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-Caf2VGdD.js";
8
-
9
- export { SUPPORTED_CLIS };