agent-yes 1.175.1 → 1.176.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/agent-yes.config.schema.json +2 -2
  2. package/default.config.yaml +45 -0
  3. package/dist/SUPPORTED_CLIS-BC4fOfBC.js +8 -0
  4. package/dist/{SUPPORTED_CLIS-DH7pORiR.js → SUPPORTED_CLIS-TMmgX_p6.js} +2 -2
  5. package/dist/agentShare-DRfghQz8.js +231 -0
  6. package/dist/bash-yes.js +10 -0
  7. package/dist/cli.js +8 -8
  8. package/dist/cmd-yes.js +10 -0
  9. package/dist/{e2e-jb0Hp43q.js → e2e-BeKjLhmO.js} +1 -1
  10. package/dist/{forkNested-DhJxa4q4.js → forkNested-C8q7E6mp.js} +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/{notifyDaemon-CLRNmdHy.js → notifyDaemon-C08fJ2Ai.js} +5 -5
  13. package/dist/{openBrowser-ChR4llYa.js → openBrowser-BO5RVYwL.js} +1 -1
  14. package/dist/powershell-yes.js +10 -0
  15. package/dist/{remotes-BQMr4_En.js → remotes-BIHNxn1a.js} +3 -3
  16. package/dist/{remotes-CC-4GuJb.js → remotes-DsTnQhyx.js} +3 -3
  17. package/dist/{rustBinary-DSN5ekb5.js → rustBinary-DZTU07SA.js} +2 -2
  18. package/dist/{schedule-DXGDI0Uo.js → schedule-BQtFOk0z.js} +5 -5
  19. package/dist/{serve-DgQjFYQC.js → serve-B5PQdiOb.js} +143 -76
  20. package/dist/{setup-DHVydU-j.js → setup-BCqFNJoB.js} +3 -3
  21. package/dist/{share-QregR8a_.js → share-29YbzpbU.js} +6 -6
  22. package/dist/share-nvqy64A2.js +4 -0
  23. package/dist/{spawnGate-BFhva-2F.js → spawnGate-C5nBiUZQ.js} +1 -1
  24. package/dist/{spawnGate-IJDByl2U.js → spawnGate-Clp9xBPX.js} +2 -2
  25. package/dist/{subcommands-DjA3FgJk.js → subcommands-BbSJ_nTU.js} +736 -714
  26. package/dist/subcommands-BokdtqqC.js +9 -0
  27. package/dist/{tray-DXr7iK3E.js → tray-DKwVRBwr.js} +1 -1
  28. package/dist/{ts-PerHq0yJ.js → ts-Ce7a44Rj.js} +3 -3
  29. package/dist/{versionChecker-CfZx87hW.js → versionChecker-C7C7QAPu.js} +2 -2
  30. package/dist/{webrtcLink-B7REGtK2.js → webrtcLink-BG0Xc4-W.js} +2 -2
  31. package/dist/{webrtcRemote-Bx-eD_0I.js → webrtcRemote-BLEbZnbY.js} +3 -3
  32. package/dist/{workspaceConfig-BgqK-31W.js → workspaceConfig-DKd6UvVm.js} +1 -1
  33. package/lab/ui/index.html +495 -291
  34. package/lab/ui/qrcode.js +2297 -0
  35. package/lab/ui/sw.js +2 -1
  36. package/package.json +8 -2
  37. package/scripts/build-rgui.ts +78 -0
  38. package/ts/agentShare.lifecycle.spec.ts +139 -0
  39. package/ts/agentShare.spec.ts +238 -0
  40. package/ts/agentShare.ts +330 -0
  41. package/ts/forkNested.spec.ts +39 -2
  42. package/ts/index.ts +5 -1
  43. package/ts/serve.ts +119 -5
  44. package/ts/share.ts +10 -3
  45. package/ts/subcommands.ts +29 -0
  46. package/dist/SUPPORTED_CLIS-COSdc1BZ.js +0 -8
  47. package/dist/subcommands-C9u1em-X.js +0 -9
@@ -1,26 +1,26 @@
1
- import "./ts-PerHq0yJ.js";
1
+ import "./ts-Ce7a44Rj.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-CfZx87hW.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-DSN5ekb5.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-C7C7QAPu.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-DZTU07SA.js";
5
5
  import "./pidStore-BIvsBQ8X.js";
6
6
  import { a as updateGlobalPidStatus } from "./globalPidIndex-CoNr7tS8.js";
7
7
  import { t as pgidForWrapper } from "./reaper-CWF2_ATd.js";
8
8
  import "./configShared-0MnIQ652.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DH7pORiR.js";
10
- import { A as resolveOne, E as readPtysize, F as snapshotStatus, H as TYPING_BADGE, O as renderRawLog, S as listRecords, T as readNotes, V as writeToIpc, b as isUserTyping, f as extractNeedsInput, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-DjA3FgJk.js";
11
- import "./e2e-jb0Hp43q.js";
12
- import "./webrtcLink-B7REGtK2.js";
13
- import "./remotes-CC-4GuJb.js";
14
- import { a as getSpawnHook, c as hasProvisionHook, d as resolveSpawnCwd, i as getProvisionRoot, l as hasSpawnHook, r as getProvisionHook, u as isProvisionAllowed } from "./workspaceConfig-BgqK-31W.js";
15
- import { r as spawnRejectionReason } from "./spawnGate-IJDByl2U.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-TMmgX_p6.js";
10
+ import { $ as TYPING_BADGE, D as recentReadEdges, E as readPtysize, H as writeToIpc, I as snapshotStatus, S as listRecords, T as readNotes, b as isUserTyping, f as extractNeedsInput, j as resolveOne, k as renderRawLog, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-BbSJ_nTU.js";
11
+ import "./e2e-BeKjLhmO.js";
12
+ import "./webrtcLink-BG0Xc4-W.js";
13
+ import "./remotes-DsTnQhyx.js";
14
+ import { a as getSpawnHook, c as hasProvisionHook, d as resolveSpawnCwd, i as getProvisionRoot, l as hasSpawnHook, r as getProvisionHook, u as isProvisionAllowed } from "./workspaceConfig-DKd6UvVm.js";
15
+ import { r as spawnRejectionReason } from "./spawnGate-Clp9xBPX.js";
16
16
  import yargs from "yargs";
17
17
  import { mkdir, open, readFile, stat, unlink, writeFile } from "fs/promises";
18
18
  import { homedir, hostname, userInfo } from "os";
19
19
  import path from "path";
20
20
  import { execFileSync } from "node:child_process";
21
21
  import { fileURLToPath } from "node:url";
22
- import { renameSync, watch, writeFileSync } from "node:fs";
23
22
  import { randomBytes, timingSafeEqual } from "crypto";
23
+ import { renameSync, watch, writeFileSync } from "node:fs";
24
24
 
25
25
  //#region ts/serve.ts
26
26
  const DEFAULT_PORT = 7432;
@@ -478,7 +478,7 @@ async function cmdServeDaemon(sub, args) {
478
478
  let shareLink = null;
479
479
  let shareLinkMinted = false;
480
480
  if (webrtcDaemon) try {
481
- const { loadOrCreateShareRoom, shareLinkFromRoomUrl } = await import("./share-QregR8a_.js");
481
+ const { loadOrCreateShareRoom, shareLinkFromRoomUrl } = await import("./share-nvqy64A2.js");
482
482
  const explicit = explicitWebrtcUrl(effArgs);
483
483
  shareLink = shareLinkFromRoomUrl(explicit ?? await loadOrCreateShareRoom());
484
484
  shareLinkMinted = !explicit;
@@ -487,7 +487,7 @@ async function cmdServeDaemon(sub, args) {
487
487
  if (!webrtcDaemon) return;
488
488
  if (shareLink) {
489
489
  process.stdout.write(`\nshared over WebRTC — open this link (the token is eaten from the URL on open):\n ${shareLink}\n` + (shareLinkMinted ? ` (persistent room — same link across restarts; delete ~/.agent-yes/.share-room to rotate)\n` : ``));
490
- const { offerOpenInBrowser } = await import("./openBrowser-ChR4llYa.js");
490
+ const { offerOpenInBrowser } = await import("./openBrowser-BO5RVYwL.js");
491
491
  await offerOpenInBrowser(shareLink);
492
492
  } else process.stdout.write("\nthe WebRTC share link carries a secret, so the daemon does NOT log it —\nread it from ~/.agent-yes/.share-link (mode 0600). The room persists in\n~/.agent-yes/.share-room, so the link survives restarts.\n");
493
493
  };
@@ -767,6 +767,7 @@ Options:
767
767
  const oscTitleRe = /\x1b\][02];([^\x07\x1b]*)(?:\x07|\x1b\\)/g;
768
768
  let title = null;
769
769
  for (let m; m = oscTitleRe.exec(text);) if (m[1].trim()) title = m[1].trim();
770
+ if (title) title = title.replace(/[\x00-\x1f\x7f-\x9f]/g, "").slice(0, 256).trim() || null;
770
771
  titleCache.set(logFile, {
771
772
  size,
772
773
  mtimeMs,
@@ -1072,6 +1073,11 @@ Options:
1072
1073
  Connection: "keep-alive"
1073
1074
  } });
1074
1075
  }
1076
+ if (req.method === "GET" && p === "/api/edges") try {
1077
+ return Response.json({ reads: await recentReadEdges() });
1078
+ } catch (e) {
1079
+ return new Response(e.message, { status: 500 });
1080
+ }
1075
1081
  if (req.method === "GET" && p === "/api/whoami") {
1076
1082
  let user = "";
1077
1083
  try {
@@ -1148,69 +1154,77 @@ Options:
1148
1154
  const record = await resolveOne(keyword, defaultOpts());
1149
1155
  if (!record.log_file) return new Response(`pid ${record.pid}: no log_file`, { status: 404 });
1150
1156
  const logPath = record.log_file;
1151
- const stream = new ReadableStream({ async start(ctrl) {
1152
- const enc = new TextEncoder();
1153
- const send = (text) => ctrl.enqueue(enc.encode(`data: ${JSON.stringify(text)}\n\n`));
1154
- const ping = () => ctrl.enqueue(enc.encode(": ping\n\n"));
1155
- const initBuf = await readFile(logPath).catch(() => Buffer.alloc(0));
1156
- if (raw) send(new TextDecoder().decode(initBuf.slice(Math.max(0, initBuf.length - 65536))));
1157
- else send(await renderRawLog(initBuf, {
1158
- mode: "tail",
1159
- n: 96
1160
- }));
1161
- let offset = initBuf.length;
1162
- let closed = false;
1163
- const heartbeat = setInterval(() => {
1164
- if (closed) {
1165
- clearInterval(heartbeat);
1166
- return;
1167
- }
1168
- ping();
1169
- }, 15e3);
1170
- const ansiRe = /\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;
1171
- const ctrlRe = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
1172
- const fh = await open(logPath, "r").catch(() => null);
1173
- let reading = false;
1174
- const flush = async () => {
1175
- if (closed || reading || !fh) return;
1176
- reading = true;
1177
- try {
1178
- const { size } = await fh.stat();
1179
- if (size < offset) offset = size;
1180
- if (size > offset) {
1181
- const len = size - offset;
1182
- const buf = Buffer.allocUnsafe(len);
1183
- const { bytesRead } = await fh.read(buf, 0, len, offset);
1184
- offset += bytesRead;
1185
- const chunk = buf.subarray(0, bytesRead);
1186
- if (raw) send(new TextDecoder().decode(chunk));
1187
- else {
1188
- const text = new TextDecoder().decode(chunk).replace(ansiRe, "").replace(ctrlRe, "");
1189
- if (text.trim()) send(text.trimStart());
1157
+ let cleanup = () => {};
1158
+ const stream = new ReadableStream({
1159
+ async start(ctrl) {
1160
+ const enc = new TextEncoder();
1161
+ const send = (text) => ctrl.enqueue(enc.encode(`data: ${JSON.stringify(text)}\n\n`));
1162
+ const ping = () => ctrl.enqueue(enc.encode(": ping\n\n"));
1163
+ const initBuf = await readFile(logPath).catch(() => Buffer.alloc(0));
1164
+ if (raw) send(new TextDecoder().decode(initBuf.slice(Math.max(0, initBuf.length - 65536))));
1165
+ else send(await renderRawLog(initBuf, {
1166
+ mode: "tail",
1167
+ n: 96
1168
+ }));
1169
+ let offset = initBuf.length;
1170
+ let closed = false;
1171
+ const heartbeat = setInterval(() => {
1172
+ if (closed) {
1173
+ clearInterval(heartbeat);
1174
+ return;
1175
+ }
1176
+ ping();
1177
+ }, 15e3);
1178
+ const ansiRe = /\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;
1179
+ const ctrlRe = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
1180
+ const fh = await open(logPath, "r").catch(() => null);
1181
+ let reading = false;
1182
+ const flush = async () => {
1183
+ if (closed || reading || !fh) return;
1184
+ reading = true;
1185
+ try {
1186
+ const { size } = await fh.stat();
1187
+ if (size < offset) offset = size;
1188
+ if (size > offset) {
1189
+ const len = size - offset;
1190
+ const buf = Buffer.allocUnsafe(len);
1191
+ const { bytesRead } = await fh.read(buf, 0, len, offset);
1192
+ offset += bytesRead;
1193
+ const chunk = buf.subarray(0, bytesRead);
1194
+ if (raw) send(new TextDecoder().decode(chunk));
1195
+ else {
1196
+ const text = new TextDecoder().decode(chunk).replace(ansiRe, "").replace(ctrlRe, "");
1197
+ if (text.trim()) send(text.trimStart());
1198
+ }
1190
1199
  }
1200
+ } catch {} finally {
1201
+ reading = false;
1191
1202
  }
1192
- } catch {} finally {
1193
- reading = false;
1194
- }
1195
- };
1196
- let watcher = null;
1197
- try {
1198
- watcher = watch(logPath, () => void flush());
1199
- } catch {}
1200
- const poller = setInterval(() => void flush(), 60);
1201
- req.signal.addEventListener("abort", () => {
1202
- closed = true;
1203
- clearInterval(heartbeat);
1204
- clearInterval(poller);
1205
- try {
1206
- watcher?.close();
1207
- } catch {}
1208
- fh?.close().catch(() => {});
1203
+ };
1204
+ let watcher = null;
1209
1205
  try {
1210
- ctrl.close();
1206
+ watcher = watch(logPath, () => void flush());
1211
1207
  } catch {}
1212
- });
1213
- } });
1208
+ const poller = setInterval(() => void flush(), watcher ? 500 : 60);
1209
+ cleanup = () => {
1210
+ if (closed) return;
1211
+ closed = true;
1212
+ clearInterval(heartbeat);
1213
+ clearInterval(poller);
1214
+ try {
1215
+ watcher?.close();
1216
+ } catch {}
1217
+ fh?.close().catch(() => {});
1218
+ try {
1219
+ ctrl.close();
1220
+ } catch {}
1221
+ };
1222
+ req.signal.addEventListener("abort", cleanup);
1223
+ },
1224
+ cancel() {
1225
+ cleanup();
1226
+ }
1227
+ });
1214
1228
  return new Response(stream, { headers: {
1215
1229
  "Content-Type": "text/event-stream",
1216
1230
  "Cache-Control": "no-cache",
@@ -1558,13 +1572,64 @@ Options:
1558
1572
  return new Response(e.message, { status: 500 });
1559
1573
  }
1560
1574
  }
1575
+ if (req.method === "POST" && p === "/api/share") {
1576
+ let body;
1577
+ try {
1578
+ body = await req.json();
1579
+ } catch {
1580
+ return new Response("invalid JSON body", { status: 400 });
1581
+ }
1582
+ if (!body.agent) return new Response("agent required", { status: 400 });
1583
+ const perm = body.perm ?? "r";
1584
+ if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
1585
+ try {
1586
+ const { createScopedShare } = await import("./agentShare-DRfghQz8.js");
1587
+ const share = await createScopedShare({
1588
+ agent: body.agent,
1589
+ perm,
1590
+ localFetch: apiFetch,
1591
+ apiToken: token
1592
+ });
1593
+ return Response.json(share);
1594
+ } catch (e) {
1595
+ const msg = e.message;
1596
+ const status = /too many active shares/.test(msg) ? 409 : /no agent matched|no stable/.test(msg) ? 404 : 500;
1597
+ return new Response(msg, { status });
1598
+ }
1599
+ }
1600
+ if (req.method === "GET" && p === "/api/shares") {
1601
+ const { listShares } = await import("./agentShare-DRfghQz8.js");
1602
+ return Response.json(listShares());
1603
+ }
1604
+ const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
1605
+ if (req.method === "DELETE" && revokeM) {
1606
+ const { revokeShare } = await import("./agentShare-DRfghQz8.js");
1607
+ const ok = revokeShare(decodeURIComponent(revokeM[1]));
1608
+ return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
1609
+ }
1561
1610
  return new Response("Not Found", { status: 404 });
1562
1611
  };
1563
1612
  const uiDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "lab", "ui");
1613
+ const CONSOLE_CSP = [
1614
+ "default-src 'self'",
1615
+ "base-uri 'none'",
1616
+ "object-src 'none'",
1617
+ "frame-ancestors 'none'",
1618
+ "form-action 'self'",
1619
+ "img-src 'self' data:",
1620
+ "font-src 'self' data:",
1621
+ "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net",
1622
+ "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net",
1623
+ "connect-src 'self' https://s.agent-yes.com https://agent-yes.com wss:",
1624
+ "worker-src 'self'",
1625
+ "manifest-src 'self'"
1626
+ ].join("; ");
1564
1627
  const serveUiFile = async (name, type) => {
1565
1628
  try {
1566
1629
  const buf = await readFile(path.join(uiDir, name));
1567
- return new Response(buf, { headers: { "Content-Type": type } });
1630
+ const headers = { "Content-Type": type };
1631
+ if (type.includes("text/html")) headers["Content-Security-Policy"] = CONSOLE_CSP;
1632
+ return new Response(buf, { headers });
1568
1633
  } catch {
1569
1634
  return new Response("UI assets not found in this install — use the /api endpoints", { status: 404 });
1570
1635
  }
@@ -1575,6 +1640,7 @@ Options:
1575
1640
  if (req.method === "GET" && p === "/room-client.js") return serveUiFile("room-client.js", "text/javascript; charset=utf-8");
1576
1641
  if (req.method === "GET" && p === "/console-logic.js") return serveUiFile("console-logic.js", "text/javascript; charset=utf-8");
1577
1642
  if (req.method === "GET" && p === "/e2e.js") return serveUiFile("e2e.js", "text/javascript; charset=utf-8");
1643
+ if (req.method === "GET" && p === "/qrcode.js") return serveUiFile("qrcode.js", "text/javascript; charset=utf-8");
1578
1644
  if (req.method === "GET" && p === "/favicon.ico") return new Response(null, { status: 204 });
1579
1645
  return apiFetch(req);
1580
1646
  };
@@ -1630,7 +1696,7 @@ Options:
1630
1696
  const webrtcVal = argv.webrtc ?? argv.share;
1631
1697
  const explicitUrl = typeof webrtcVal === "string" && webrtcVal.startsWith("webrtc://") ? webrtcVal : void 0;
1632
1698
  try {
1633
- const { startShare, loadOrCreateShareRoom } = await import("./share-QregR8a_.js");
1699
+ const { startShare, loadOrCreateShareRoom } = await import("./share-nvqy64A2.js");
1634
1700
  const linkFile = path.join(process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes"), ".share-link");
1635
1701
  const announce = async (room, link, rotated) => {
1636
1702
  const lead = rotated ? "the room was rejected by signaling (stale generation) — rotated to a fresh link" : "shared over WebRTC — open this link (the token is eaten from the URL on open)";
@@ -1638,7 +1704,7 @@ Options:
1638
1704
  const persistNote = explicitUrl ? "\n" : ` (persistent room — same link across restarts; delete ~/.agent-yes/.share-room to rotate)\n\n`;
1639
1705
  process.stdout.write(`${wantHttp ? "\n" : ""}${lead}:\n ${link}\n` + persistNote);
1640
1706
  if (!rotated) {
1641
- const { offerOpenInBrowser } = await import("./openBrowser-ChR4llYa.js");
1707
+ const { offerOpenInBrowser } = await import("./openBrowser-BO5RVYwL.js");
1642
1708
  await offerOpenInBrowser(link);
1643
1709
  }
1644
1710
  } else {
@@ -1677,6 +1743,7 @@ Options:
1677
1743
  const shutdown = (resolve) => {
1678
1744
  if (heartbeat) clearInterval(heartbeat);
1679
1745
  closeShare?.();
1746
+ import("./agentShare-DRfghQz8.js").then((m) => m.revokeAllShares()).catch(() => {});
1680
1747
  server?.stop();
1681
1748
  resolve();
1682
1749
  };
@@ -1689,4 +1756,4 @@ Options:
1689
1756
 
1690
1757
  //#endregion
1691
1758
  export { cmdServe };
1692
- //# sourceMappingURL=serve-DgQjFYQC.js.map
1759
+ //# sourceMappingURL=serve-B5PQdiOb.js.map
@@ -1,4 +1,4 @@
1
- import { f as setWorkspaceRoot, s as getWorkspaceRoot } from "./workspaceConfig-BgqK-31W.js";
1
+ import { f as setWorkspaceRoot, s as getWorkspaceRoot } from "./workspaceConfig-DKd6UvVm.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { stdin, stdout } from "node:process";
4
4
  import { createInterface } from "node:readline/promises";
@@ -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-DgQjFYQC.js");
35
+ const { cmdServe } = await import("./serve-B5PQdiOb.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-DHVydU-j.js.map
45
+ //# sourceMappingURL=setup-BCqFNJoB.js.map
@@ -1,4 +1,4 @@
1
- import { a as computeTranscriptHash, c as open$1, d as randomHex, f as seal, i as MAX_CHUNK, l as packEnvelope, n as FLAG_CONFIRM, o as deriveAuthToken, p as unpackEnvelope, r as MARKER, s as deriveDirKeys, t as CONFIRM_TIMEOUT_MS, u as parseSecret } from "./e2e-jb0Hp43q.js";
1
+ import { a as computeTranscriptHash, c as open$1, d as randomHex, f as seal, i as MAX_CHUNK, l as packEnvelope, n as FLAG_CONFIRM, o as deriveAuthToken, p as unpackEnvelope, r as MARKER, s as deriveDirKeys, t as CONFIRM_TIMEOUT_MS, u as parseSecret } from "./e2e-BeKjLhmO.js";
2
2
  import { mkdir, readFile, writeFile } from "fs/promises";
3
3
  import { homedir } from "os";
4
4
  import path from "path";
@@ -58,7 +58,7 @@ async function loadOrCreateShareRoom(sighost = DEFAULT_SIGHOST) {
58
58
  if (parseShareUrl(url).token.startsWith(MARKER)) return url;
59
59
  }
60
60
  } catch {}
61
- const url = `webrtc://${"r" + randomBytes(3).toString("hex")}:${MARKER}${randomBytes(32).toString("hex")}@${sighost}`;
61
+ const url = `webrtc://${"r" + randomBytes(6).toString("hex")}:${MARKER}${randomBytes(32).toString("hex")}@${sighost}`;
62
62
  await mkdir(path.dirname(shareRoomPath()), { recursive: true });
63
63
  await writeFile(shareRoomPath(), url, { mode: 384 });
64
64
  return url;
@@ -146,7 +146,7 @@ async function startShare(opts) {
146
146
  opts.url;
147
147
  const sighost = opts.sighost ?? DEFAULT_SIGHOST;
148
148
  const initial = opts.url ? parseShareUrl(opts.url) : {
149
- room: "r" + randomBytes(3).toString("hex"),
149
+ room: "r" + randomBytes(6).toString("hex"),
150
150
  token: `${MARKER}${randomBytes(32).toString("hex")}`,
151
151
  host: sighost
152
152
  };
@@ -165,7 +165,7 @@ async function startShare(opts) {
165
165
  const rotate = async () => {
166
166
  if (!opts.onRotate || closed || rotateCount >= 5) return false;
167
167
  rotateCount++;
168
- room = "r" + randomBytes(3).toString("hex");
168
+ room = "r" + randomBytes(6).toString("hex");
169
169
  token = `${MARKER}${randomBytes(32).toString("hex")}`;
170
170
  S = parseSecret(token).s;
171
171
  authToken = await deriveAuthToken(S, room, host);
@@ -533,5 +533,5 @@ async function startShare(opts) {
533
533
  }
534
534
 
535
535
  //#endregion
536
- export { loadOrCreateShareRoom, shareLinkFromRoomUrl, startShare };
537
- //# sourceMappingURL=share-QregR8a_.js.map
536
+ export { shareLinkFromRoomUrl as n, startShare as r, loadOrCreateShareRoom as t };
537
+ //# sourceMappingURL=share-29YbzpbU.js.map
@@ -0,0 +1,4 @@
1
+ import "./e2e-BeKjLhmO.js";
2
+ import { n as shareLinkFromRoomUrl, r as startShare, t as loadOrCreateShareRoom } from "./share-29YbzpbU.js";
3
+
4
+ export { loadOrCreateShareRoom, shareLinkFromRoomUrl, startShare };
@@ -1,5 +1,5 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
- import { i as waitForSpawnCapacity, n as spawnGateEnabled, r as spawnRejectionReason, t as memAvailableMb } from "./spawnGate-IJDByl2U.js";
3
+ import { i as waitForSpawnCapacity, n as spawnGateEnabled, r as spawnRejectionReason, t as memAvailableMb } from "./spawnGate-Clp9xBPX.js";
4
4
 
5
5
  export { waitForSpawnCapacity };
@@ -1,5 +1,5 @@
1
1
  import { i as readGlobalPids } from "./globalPidIndex-CoNr7tS8.js";
2
- import { n as getMinFreeMb, o as getSpawnWaitMs, t as getMaxAgents } from "./workspaceConfig-BgqK-31W.js";
2
+ import { n as getMinFreeMb, o as getSpawnWaitMs, t as getMaxAgents } from "./workspaceConfig-DKd6UvVm.js";
3
3
  import { readFile } from "fs/promises";
4
4
 
5
5
  //#region ts/spawnGate.ts
@@ -104,4 +104,4 @@ async function waitForSpawnCapacity(opts) {
104
104
 
105
105
  //#endregion
106
106
  export { waitForSpawnCapacity as i, spawnGateEnabled as n, spawnRejectionReason as r, memAvailableMb as t };
107
- //# sourceMappingURL=spawnGate-IJDByl2U.js.map
107
+ //# sourceMappingURL=spawnGate-Clp9xBPX.js.map