agent-yes 1.298.1 → 1.299.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 (45) hide show
  1. package/dist/{SUPPORTED_CLIS-AzChegaJ.js → SUPPORTED_CLIS-BIlQQJa6.js} +3 -3
  2. package/dist/{SUPPORTED_CLIS-sxjBFTrE.js → SUPPORTED_CLIS-Ct9reIJH.js} +2 -2
  3. package/dist/{agentShare-CDOvU64K.js → agentShare-uzFuaLUH.js} +4 -4
  4. package/dist/{callback-DBOgmPV6.js → callback-BxTZx3xJ.js} +3 -3
  5. package/dist/{callback-Dr5rqkUu.js → callback-DRrURxmb.js} +4 -4
  6. package/dist/cli.js +7 -7
  7. package/dist/{cmdPs-DKuMlynW.js → cmdPs-BGIWbeBM.js} +4 -4
  8. package/dist/index.js +2 -2
  9. package/dist/{notifyDaemon-Ceyhz4el.js → notifyDaemon-EEbnpoYp.js} +4 -4
  10. package/dist/{parentPingLoop-C0hekeg6.js → parentPingLoop-C1XXpKK7.js} +2 -2
  11. package/dist/remotes-BDMnvGI6.js +5 -0
  12. package/dist/{remotes-5P__pAXA.js → remotes-DrYe_nfw.js} +101 -18
  13. package/dist/{rustBinary-BW3BGZ4y.js → rustBinary--pof-MTj.js} +2 -2
  14. package/dist/{rustBinary-0cD4pQIE.js → rustBinary-B7rq3nuz.js} +2 -2
  15. package/dist/{schedule-BRC5cDkf.js → schedule-BFUe9-Mf.js} +4 -4
  16. package/dist/{serve-BD-7GaKa.js → serve-Q4dnZc5l.js} +40 -21
  17. package/dist/{setup-Dad2A_-o.js → setup-aEuGSFjB.js} +3 -3
  18. package/dist/shareCmd-DkITELaM.js +415 -0
  19. package/dist/{subcommands--9gcc0ew.js → subcommands-CUWPMI_r.js} +36 -22
  20. package/dist/{subcommands-ClQCwxvk.js → subcommands-CuRZt3X6.js} +3 -3
  21. package/dist/{systemPathLink-VV-Vm6y2.js → systemPathLink-DoyBuRQq.js} +1 -1
  22. package/dist/{terminal-Bam4XVWi.js → terminal-CUn1_oPd.js} +2 -2
  23. package/dist/{todoCli-BDttv8mk.js → todoCli-DwYlxIAY.js} +1 -1
  24. package/dist/{tray-DWWsVS7Y.js → tray-BcpHVeMk.js} +1 -1
  25. package/dist/{trayApp-DOgsH0en.js → trayApp-BHwAJFzl.js} +2 -2
  26. package/dist/trayApp-ucuB_j5l.js +5 -0
  27. package/dist/{ts-BePSXUQl.js → ts-oIxnyQbE.js} +3 -3
  28. package/dist/{versionChecker-D6zM6Pdv.js → versionChecker-DOgDaagD.js} +2 -2
  29. package/dist/{webrtcLink-CnQf9pmu.js → webrtcLink-DFRyWNMs.js} +2 -2
  30. package/dist/{webrtcRemote-0RGrSwqd.js → webrtcRemote-Cd4vTrgv.js} +2 -2
  31. package/dist/{widget-DJgiOfgE.js → widget-CuagzQwz.js} +3 -3
  32. package/dist/{ws-Covfyaxn.js → ws-DcJBGzQP.js} +2 -2
  33. package/dist/{ws-DjGQGPCq.js → ws-ID7-zDiJ.js} +4 -4
  34. package/lab/ui/index.html +9 -3
  35. package/package.json +1 -1
  36. package/ts/remotes.ts +128 -13
  37. package/ts/serve.ts +22 -0
  38. package/ts/shareCmd.ts +369 -0
  39. package/ts/shareCore.spec.ts +236 -0
  40. package/ts/shareCore.ts +148 -0
  41. package/ts/subcommands.spec.ts +19 -0
  42. package/ts/subcommands.ts +33 -5
  43. package/ts/webrtcLink.ts +3 -1
  44. package/dist/remotes-CY69MeQB.js +0 -5
  45. package/dist/trayApp-s2VuJUP4.js +0 -5
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D6zM6Pdv.js";
3
- import "./ts-BePSXUQl.js";
2
+ import "./versionChecker-DOgDaagD.js";
3
+ import "./ts-oIxnyQbE.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-CRH9L9tn.js";
7
7
  import "./pidStore-DXWqzTSz.js";
8
8
  import "./messageLog-Brx3w6zT.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-sxjBFTrE.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Ct9reIJH.js";
11
11
 
12
12
  export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-BePSXUQl.js";
1
+ import { t as CLIS_CONFIG } from "./ts-oIxnyQbE.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-sxjBFTrE.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-Ct9reIJH.js.map
@@ -5,10 +5,10 @@ import "./pidStore-DXWqzTSz.js";
5
5
  import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { J as resolveOne } from "./subcommands--9gcc0ew.js";
8
+ import { J as resolveOne } from "./subcommands-CUWPMI_r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-CnQf9pmu.js";
11
- import "./remotes-5P__pAXA.js";
10
+ import "./webrtcLink-DFRyWNMs.js";
11
+ import "./remotes-DrYe_nfw.js";
12
12
  import { o as startShare } from "./share-C9oGvjXT.js";
13
13
 
14
14
  //#region ts/agentShare.ts
@@ -232,4 +232,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
232
232
 
233
233
  //#endregion
234
234
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
235
- //# sourceMappingURL=agentShare-CDOvU64K.js.map
235
+ //# sourceMappingURL=agentShare-uzFuaLUH.js.map
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
2
- import { J as resolveOne } from "./subcommands--9gcc0ew.js";
2
+ import { J as resolveOne } from "./subcommands-CUWPMI_r.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Bl2gGcxg.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -72,7 +72,7 @@ async function resolveBase(flag) {
72
72
  if (flag) return flag;
73
73
  if (process.env.AGENT_YES_CALLBACK_BASE) return process.env.AGENT_YES_CALLBACK_BASE;
74
74
  try {
75
- const { resolveLocalServeUrl } = await import("./serve-BD-7GaKa.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-Q4dnZc5l.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -187,4 +187,4 @@ async function cmdCallback(rest) {
187
187
 
188
188
  //#endregion
189
189
  export { loadOrCreateCallbackSecret as i, isCallbackRevoked as n, loadCallbackSecretReadOnly as r, cmdCallback as t };
190
- //# sourceMappingURL=callback-DBOgmPV6.js.map
190
+ //# sourceMappingURL=callback-BxTZx3xJ.js.map
@@ -5,11 +5,11 @@ import "./pidStore-DXWqzTSz.js";
5
5
  import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import "./subcommands--9gcc0ew.js";
8
+ import "./subcommands-CUWPMI_r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-CnQf9pmu.js";
11
- import "./remotes-5P__pAXA.js";
10
+ import "./webrtcLink-DFRyWNMs.js";
11
+ import "./remotes-DrYe_nfw.js";
12
12
  import "./callbackCore-Bl2gGcxg.js";
13
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DBOgmPV6.js";
13
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-BxTZx3xJ.js";
14
14
 
15
15
  export { cmdCallback };
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-D6zM6Pdv.js";
5
- import { d as getRustBinary } from "./rustBinary-BW3BGZ4y.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-DOgDaagD.js";
5
+ import { d as getRustBinary } from "./rustBinary--pof-MTj.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
295
  const rawArg = process.argv[2];
296
296
  const managerCommands = !invokedCliName(process.argv);
297
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-ClQCwxvk.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-CuRZt3X6.js");
299
299
  if (isHelpFlag && process.argv.length === 3) {
300
300
  await cmdHelp(managerCommands);
301
301
  process.exit(0);
@@ -309,7 +309,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
309
309
  process.exit(code ?? 0);
310
310
  }
311
311
  {
312
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-AzChegaJ.js");
312
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BIlQQJa6.js");
313
313
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
314
314
  process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
315
315
  process.exit(1);
@@ -328,12 +328,12 @@ await checkAndAutoUpdate();
328
328
  logger.info(versionString());
329
329
  const config = parseCliArgs(process.argv);
330
330
  if (config.tray) {
331
- const { startTray } = await import("./tray-DWWsVS7Y.js");
331
+ const { startTray } = await import("./tray-BcpHVeMk.js");
332
332
  await startTray();
333
333
  await new Promise(() => {});
334
334
  }
335
335
  {
336
- const { ensureTray } = await import("./tray-DWWsVS7Y.js");
336
+ const { ensureTray } = await import("./tray-BcpHVeMk.js");
337
337
  ensureTray();
338
338
  }
339
339
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
@@ -360,7 +360,7 @@ if (config.useRust) {
360
360
  }
361
361
  }
362
362
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-AzChegaJ.js");
363
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BIlQQJa6.js");
364
364
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
365
365
  if (config.verbose) {
366
366
  console.log(`[rust] Using binary: ${rustBinary}`);
@@ -5,10 +5,10 @@ import "./pidStore-DXWqzTSz.js";
5
5
  import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { F as listRecords, dt as buildAgentForest, ft as flattenForest, h as deriveLiveState } from "./subcommands--9gcc0ew.js";
8
+ import { F as listRecords, dt as buildAgentForest, ft as flattenForest, h as deriveLiveState } from "./subcommands-CUWPMI_r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-CnQf9pmu.js";
11
- import "./remotes-5P__pAXA.js";
10
+ import "./webrtcLink-DFRyWNMs.js";
11
+ import "./remotes-DrYe_nfw.js";
12
12
  import { i as systemStats, n as sampleTrees, r as snapshotProcs, t as humanBytes } from "./procStats-CyD8h5nx.js";
13
13
  import yargs from "yargs";
14
14
  import { readFileSync } from "node:fs";
@@ -330,4 +330,4 @@ function readPpidSync(pid) {
330
330
 
331
331
  //#endregion
332
332
  export { cmdPs };
333
- //# sourceMappingURL=cmdPs-DKuMlynW.js.map
333
+ //# sourceMappingURL=cmdPs-BGIWbeBM.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D6zM6Pdv.js";
3
- import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-BePSXUQl.js";
2
+ import "./versionChecker-DOgDaagD.js";
3
+ import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-oIxnyQbE.js";
4
4
  import { a as renderTree, c as describeBlock, i as renderDigest, l as monitorHint, o as unblockedTasks, r as openBlockers, t as reconcileTodos, u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-CRH9L9tn.js";
@@ -5,10 +5,10 @@ import "./pidStore-DXWqzTSz.js";
5
5
  import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { D as isPidAlive, F as listRecords, G as renderLogTailLines, h as deriveLiveState } from "./subcommands--9gcc0ew.js";
8
+ import { D as isPidAlive, F as listRecords, G as renderLogTailLines, h as deriveLiveState } from "./subcommands-CUWPMI_r.js";
9
9
  import { f as readInbox, g as daemonLockOwnerPath, h as daemonLockDir, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, s as hostId, u as liveWatchers, x as notifyDir } from "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-CnQf9pmu.js";
11
- import "./remotes-5P__pAXA.js";
10
+ import "./webrtcLink-DFRyWNMs.js";
11
+ import "./remotes-DrYe_nfw.js";
12
12
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
13
13
  import { randomUUID } from "node:crypto";
14
14
  import { execFile, execFileSync } from "node:child_process";
@@ -879,4 +879,4 @@ async function ensureDaemon() {
879
879
 
880
880
  //#endregion
881
881
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
882
- //# sourceMappingURL=notifyDaemon-Ceyhz4el.js.map
882
+ //# sourceMappingURL=notifyDaemon-EEbnpoYp.js.map
@@ -338,7 +338,7 @@ async function isParentWatching(parentWrapperPid, parentAgentPid, selfAgentPid,
338
338
  logger.debug("[parent-ping] watcher lookup failed:", error);
339
339
  }
340
340
  try {
341
- const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-ClQCwxvk.js");
341
+ const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-CuRZt3X6.js");
342
342
  const last = await lastReadAt(`agent:${parentAgentPid}`, selfAgentPid);
343
343
  if (last !== null && now - last <= READ_WINDOW_MS) return true;
344
344
  } catch (error) {
@@ -466,4 +466,4 @@ function startParentPingLoop(opts) {
466
466
 
467
467
  //#endregion
468
468
  export { startParentPingLoop };
469
- //# sourceMappingURL=parentPingLoop-C0hekeg6.js.map
469
+ //# sourceMappingURL=parentPingLoop-C1XXpKK7.js.map
@@ -0,0 +1,5 @@
1
+ import "./e2e-z1xpwSAg.js";
2
+ import "./webrtcLink-DFRyWNMs.js";
3
+ import { a as parseDirectRemoteSpec, c as resolveRemoteSpec, i as deleteRemoteAlias, l as writeRemoteAlias, n as cmdRemote, o as parseShareUrl, r as defaultConnectAlias, s as readRemotes, t as cmdConnect } from "./remotes-DrYe_nfw.js";
4
+
5
+ export { cmdConnect, cmdRemote };
@@ -1,4 +1,4 @@
1
- import { n as isWebrtcSpec, r as parseWebrtcLink } from "./webrtcLink-CnQf9pmu.js";
1
+ import { n as isWebrtcSpec, r as parseWebrtcLink } from "./webrtcLink-DFRyWNMs.js";
2
2
  import { mkdir, readFile, writeFile } from "fs/promises";
3
3
  import { homedir } from "os";
4
4
  import path from "path";
@@ -59,6 +59,44 @@ function parseDirectRemoteSpec(spec) {
59
59
  };
60
60
  }
61
61
  /**
62
+ * Parse an http(s) share URL into {url, token}. This is the ONE link `ay share`
63
+ * hands out for both the web console and the CLI:
64
+ * https://host.ts.net/ay/#k=<token> console link (token in the fragment)
65
+ * http://<token>@192.168.1.5:7432 legacy userinfo form (`ay remote add`)
66
+ * The base keeps any path prefix (a reverse proxy mount like /ay), minus a
67
+ * trailing slash / index.html. Null when there's no token or it isn't http(s).
68
+ *
69
+ * Never throws: every http(s) spec reaches here through resolveRemoteSpec, so a
70
+ * malformed one must come back as "not a share URL", not as an exception.
71
+ */
72
+ function decodeMaybe(s) {
73
+ try {
74
+ return decodeURIComponent(s);
75
+ } catch {
76
+ return s;
77
+ }
78
+ }
79
+ function parseShareUrl(spec) {
80
+ if (!/^https?:\/\//i.test(spec)) return null;
81
+ let u;
82
+ try {
83
+ u = new URL(spec);
84
+ } catch {
85
+ return null;
86
+ }
87
+ const token = new URLSearchParams(u.hash.replace(/^#/, "")).get("k") || decodeMaybe(u.username);
88
+ if (!token) return null;
89
+ u.username = "";
90
+ u.password = "";
91
+ u.hash = "";
92
+ u.search = "";
93
+ u.pathname = u.pathname.replace(/\/index\.html$/, "/").replace(/\/+$/, "");
94
+ return {
95
+ url: u.toString().replace(/\/+$/, ""),
96
+ token
97
+ };
98
+ }
99
+ /**
62
100
  * Resolve a spec to connection details.
63
101
  * Accepts:
64
102
  * token@host:port[:keyword] — direct
@@ -67,6 +105,11 @@ function parseDirectRemoteSpec(spec) {
67
105
  */
68
106
  async function resolveRemoteSpec(spec) {
69
107
  if (isWebrtcSpec(spec)) return resolveWebrtc(spec, void 0, webrtcLabel(spec));
108
+ const shared = parseShareUrl(spec);
109
+ if (shared) return {
110
+ ...shared,
111
+ label: new URL(shared.url).host
112
+ };
70
113
  const direct = parseDirectRemoteSpec(spec);
71
114
  if (direct) return {
72
115
  url: direct.baseUrl,
@@ -93,7 +136,7 @@ async function resolveRemoteSpec(spec) {
93
136
  * The bridge lives for the rest of the process (torn down on `process.exit`).
94
137
  */
95
138
  async function resolveWebrtc(link, keyword, label) {
96
- const { startWebrtcBridge } = await import("./webrtcRemote-0RGrSwqd.js");
139
+ const { startWebrtcBridge } = await import("./webrtcRemote-Cd4vTrgv.js");
97
140
  const bridge = await startWebrtcBridge(link);
98
141
  return {
99
142
  url: bridge.baseUrl,
@@ -105,7 +148,7 @@ async function resolveWebrtc(link, keyword, label) {
105
148
  async function cmdRemote(rest) {
106
149
  const sub = rest[0];
107
150
  if (sub === "-h" || sub === "--help") {
108
- process.stdout.write("Usage: ay remote <subcommand>\n\nManage saved remote server aliases.\n\nSubcommands:\n ay remote ls list configured remotes\n ay remote add <alias> http://<token>@<host>:<port> add an http remote\n ay remote add <alias> webrtc://<room>:<token>@<host> add a WebRTC share remote\n ay remote add <alias> https://agent-yes.com/w/#<room>:<token> (share link form)\n ay remote rm <alias> remove a remote\n\nOnce added, use the alias anywhere a keyword is accepted:\n ay ls <alias>\n ay tail <alias>:<keyword>\n ay send <alias>:<keyword> \"message\"\n");
151
+ process.stdout.write("Usage: ay remote <subcommand>\n\nManage saved remote server aliases.\n\nSubcommands:\n ay remote ls list configured remotes\n ay remote add <alias> http://<token>@<host>:<port> add an http remote\n ay remote add <alias> webrtc://<room>:<token>@<host> add a WebRTC share remote\n ay remote add <alias> https://agent-yes.com/w/#<room>:<token> (share link form)\n ay remote add <alias> https://<host>/ay/#k=<token> (an `ay share` URL)\n ay remote rm <alias> remove a remote\n\nOnce added, use the alias anywhere a keyword is accepted:\n ay ls <alias>\n ay tail <alias>:<keyword>\n ay send <alias>:<keyword> \"message\"\n");
109
152
  return 0;
110
153
  }
111
154
  if (!sub || sub === "ls" || sub === "list") {
@@ -137,21 +180,12 @@ async function cmdRemote(rest) {
137
180
  process.stderr.write(`\n ay ls ${alias} # list agents on ${alias}\n`);
138
181
  return 0;
139
182
  }
140
- let url, token;
141
- try {
142
- const parsed = new URL(rawUrl);
143
- token = parsed.username;
144
- parsed.username = "";
145
- parsed.password = "";
146
- url = parsed.toString().replace(/\/$/, "");
147
- } catch {
148
- process.stderr.write(`ay remote add: invalid URL '${rawUrl}'\n`);
149
- return 1;
150
- }
151
- if (!token) {
152
- process.stderr.write(`ay remote add: no token in URL — expected http://<token>@<host>:<port>\n`);
183
+ const parsed = parseShareUrl(rawUrl);
184
+ if (!parsed) {
185
+ process.stderr.write(`ay remote add: no token in '${rawUrl}' — expected http://<token>@<host>:<port>\n or a share URL like https://<host>/ay/#k=<token> (from \`ay share\`)\n`);
153
186
  return 1;
154
187
  }
188
+ const { url, token } = parsed;
155
189
  await writeRemoteAlias(alias, {
156
190
  url,
157
191
  token
@@ -178,7 +212,56 @@ async function cmdRemote(rest) {
178
212
  process.stderr.write(" ay remote ls # list configured remotes\n ay remote add <alias> http://<token>@<host>:<port> # add a remote\n ay remote rm <alias> # remove a remote\n");
179
213
  return 1;
180
214
  }
215
+ /**
216
+ * Default alias for a share URL: the machine's short name. Call only on a link
217
+ * that already parsed (a webrtc link or `parseShareUrl` hit) — it assumes a
218
+ * valid URL and throws otherwise.
219
+ */
220
+ function defaultConnectAlias(link) {
221
+ const w = parseWebrtcLink(link);
222
+ if (w) return `webrtc-${w.room.slice(0, 8)}`;
223
+ const host = new URL(link).hostname;
224
+ if (/^[\d.]+$/.test(host) || host.includes(":")) return host.replace(/[.:]/g, "-");
225
+ return host.split(".")[0] || host;
226
+ }
227
+ async function cmdConnect(rest) {
228
+ const [link, aliasArg] = rest.filter((a) => !a.startsWith("-"));
229
+ if (!link || rest.includes("-h") || rest.includes("--help")) {
230
+ process.stdout.write("Usage: ay connect <share-url> [alias]\n\nSave another machine's `ay share` URL as a remote, so this CLI can drive it.\nThe same URL opens that machine's web console in a browser.\n\n ay connect 'https://box.tailnet.ts.net/ay/#k=<token>' # tailscale\n ay connect 'http://192.168.1.5:7432/#k=<token>' # lan\n ay connect 'https://agent-yes.com/w/#<room>:<secret>' box # webrtc\n\nalias defaults to the host's short name. Then:\n ay ls <alias> ay tail <alias>:<keyword> ay send <alias>:<keyword> \"msg\"\n");
231
+ return link ? 0 : 1;
232
+ }
233
+ const webrtc = isWebrtcSpec(link);
234
+ const parsed = webrtc ? null : parseShareUrl(link);
235
+ if (!webrtc && !parsed) {
236
+ process.stderr.write(`ay connect: not a share URL: '${link}' — expected https://<host>/ay/#k=<token>\n (quote it: the # starts a comment in most shells)\n`);
237
+ return 1;
238
+ }
239
+ const alias = aliasArg ?? defaultConnectAlias(link);
240
+ if (!parsed) await writeRemoteAlias(alias, {
241
+ url: link,
242
+ token: ""
243
+ });
244
+ else {
245
+ try {
246
+ const r = await fetch(`${parsed.url}/api/version`, {
247
+ headers: { Authorization: `Bearer ${parsed.token}` },
248
+ signal: AbortSignal.timeout(5e3)
249
+ });
250
+ if (r.status === 401 || r.status === 403) {
251
+ process.stderr.write(`ay connect: ${parsed.url} rejected the token (HTTP ${r.status})\n`);
252
+ return 1;
253
+ }
254
+ if (!r.ok) throw new Error(`HTTP ${r.status}`);
255
+ } catch (e) {
256
+ process.stderr.write(`ay connect: warning: ${parsed.url} is not reachable right now (${e.message}) — saving anyway\n`);
257
+ }
258
+ await writeRemoteAlias(alias, parsed);
259
+ }
260
+ process.stdout.write(`connected '${alias}'\n`);
261
+ process.stderr.write(`\n ay ls ${alias} # list its agents\n ay tail ${alias}:<keyword> # read one\n ay remote rm ${alias} # forget it\n`);
262
+ return 0;
263
+ }
181
264
 
182
265
  //#endregion
183
- export { resolveRemoteSpec as a, readRemotes as i, deleteRemoteAlias as n, writeRemoteAlias as o, parseDirectRemoteSpec as r, cmdRemote as t };
184
- //# sourceMappingURL=remotes-5P__pAXA.js.map
266
+ export { parseDirectRemoteSpec as a, resolveRemoteSpec as c, deleteRemoteAlias as i, writeRemoteAlias as l, cmdRemote as n, parseShareUrl as o, defaultConnectAlias as r, readRemotes as s, cmdConnect as t };
267
+ //# sourceMappingURL=remotes-DrYe_nfw.js.map
@@ -1,4 +1,4 @@
1
- import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-D6zM6Pdv.js";
1
+ import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-DOgDaagD.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, readdirSync, rmSync, statSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -371,4 +371,4 @@ async function getRustBinary(options = {}) {
371
371
 
372
372
  //#endregion
373
373
  export { findSpawnHiddenLauncher as a, getBinDir as c, getRustBinary as d, hasValidMacSignature as f, findRustBinary as i, getBinaryName as l, downloadBinary as n, findTrayLauncher as o, findAyrsBinary as r, gcOldBinaryDirs as s, devBuildInfo as t, getDownloadUrl as u };
374
- //# sourceMappingURL=rustBinary-BW3BGZ4y.js.map
374
+ //# sourceMappingURL=rustBinary--pof-MTj.js.map
@@ -1,4 +1,4 @@
1
- import "./versionChecker-D6zM6Pdv.js";
2
- import { a as findSpawnHiddenLauncher, c as getBinDir, d as getRustBinary, f as hasValidMacSignature, i as findRustBinary, l as getBinaryName, n as downloadBinary, o as findTrayLauncher, r as findAyrsBinary, s as gcOldBinaryDirs, t as devBuildInfo, u as getDownloadUrl } from "./rustBinary-BW3BGZ4y.js";
1
+ import "./versionChecker-DOgDaagD.js";
2
+ import { a as findSpawnHiddenLauncher, c as getBinDir, d as getRustBinary, f as hasValidMacSignature, i as findRustBinary, l as getBinaryName, n as downloadBinary, o as findTrayLauncher, r as findAyrsBinary, s as gcOldBinaryDirs, t as devBuildInfo, u as getDownloadUrl } from "./rustBinary--pof-MTj.js";
3
3
 
4
4
  export { findAyrsBinary, gcOldBinaryDirs };
@@ -1,13 +1,13 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D6zM6Pdv.js";
3
- import "./ts-BePSXUQl.js";
2
+ import "./versionChecker-DOgDaagD.js";
3
+ import "./ts-oIxnyQbE.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-CRH9L9tn.js";
7
7
  import "./pidStore-DXWqzTSz.js";
8
8
  import "./messageLog-Brx3w6zT.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-sxjBFTrE.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Ct9reIJH.js";
11
11
  import { f as resolveSpawnCwd } from "./workspaceConfig-DTvPtr5j.js";
12
12
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
13
13
  import { createHash } from "node:crypto";
@@ -154,4 +154,4 @@ async function cmdSchedule(rest) {
154
154
 
155
155
  //#endregion
156
156
  export { cmdSchedule };
157
- //# sourceMappingURL=schedule-BRC5cDkf.js.map
157
+ //# sourceMappingURL=schedule-BFUe9-Mf.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { i as getInstalledPackage } from "./versionChecker-D6zM6Pdv.js";
3
- import { a as findSpawnHiddenLauncher } from "./rustBinary-BW3BGZ4y.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-BePSXUQl.js";
2
+ import { i as getInstalledPackage } from "./versionChecker-DOgDaagD.js";
3
+ import { a as findSpawnHiddenLauncher } from "./rustBinary--pof-MTj.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-oIxnyQbE.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-BNtn19J4.js";
6
6
  import { u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
7
7
  import "./JsonlStore-BqF7AQ6E.js";
@@ -12,19 +12,19 @@ import { t as pgidForWrapper } from "./reaper-UimuuTfO.js";
12
12
  import "./todoStore-DF6vxHgV.js";
13
13
  import "./e2e-z1xpwSAg.js";
14
14
  import "./configShared-DKTgiz7K.js";
15
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-sxjBFTrE.js";
16
- import { B as readLogForRender, F as listRecords, G as renderLogTailLines, H as readPtysize, J as resolveOne, K as renderRawLog, M as isUserTyping, O as isSlashCommand, S as extractTaskCounts, U as recentMessageEdges, V as readNotes, W as recentReadEdges, ct as framePaste, et as snapshotStatus, g as deriveLiveStatus, lt as shouldFramePaste, ot as writeToIpc, p as controlCodeFromName, q as renderRawLogLines, st as withIpcLock, u as cliDefaults, ut as TYPING_BADGE, x as extractNeedsInput, y as extractBadges } from "./subcommands--9gcc0ew.js";
15
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Ct9reIJH.js";
16
+ import { B as readLogForRender, F as listRecords, G as renderLogTailLines, H as readPtysize, J as resolveOne, K as renderRawLog, M as isUserTyping, O as isSlashCommand, S as extractTaskCounts, U as recentMessageEdges, V as readNotes, W as recentReadEdges, ct as framePaste, et as snapshotStatus, g as deriveLiveStatus, lt as shouldFramePaste, ot as writeToIpc, p as controlCodeFromName, q as renderRawLogLines, st as withIpcLock, u as cliDefaults, ut as TYPING_BADGE, x as extractNeedsInput, y as extractBadges } from "./subcommands-CUWPMI_r.js";
17
17
  import { c as isTransientLockMkdirError } from "./notifyStore-2SWKGwZI.js";
18
- import { i as toWebrtcUrl, n as isWebrtcSpec } from "./webrtcLink-CnQf9pmu.js";
19
- import "./remotes-5P__pAXA.js";
18
+ import { i as toWebrtcUrl, n as isWebrtcSpec } from "./webrtcLink-DFRyWNMs.js";
19
+ import "./remotes-DrYe_nfw.js";
20
20
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Bl2gGcxg.js";
21
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-DBOgmPV6.js";
21
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-BxTZx3xJ.js";
22
22
  import { n as sampleTrees } from "./procStats-CyD8h5nx.js";
23
23
  import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-DTvPtr5j.js";
24
24
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
25
- import { i as importProvisionModule } from "./ws-Covfyaxn.js";
25
+ import { i as importProvisionModule } from "./ws-DcJBGzQP.js";
26
26
  import { r as spawnRejectionReason } from "./spawnGate-YpHopveO.js";
27
- import { i as launchTray } from "./trayApp-DOgsH0en.js";
27
+ import { i as launchTray } from "./trayApp-BHwAJFzl.js";
28
28
  import yargs from "yargs";
29
29
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
30
30
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
@@ -1249,6 +1249,25 @@ async function resolveLocalServeUrl() {
1249
1249
  return port ? `http://127.0.0.1:${port}` : null;
1250
1250
  }
1251
1251
  /**
1252
+ * What `ay share` needs to know about this host's daemon: the args it was
1253
+ * installed with (null = none installed), whether its HTTP API answers, and the token.
1254
+ * `port` is the loopback HTTP port (fixed --port, else the portless backend).
1255
+ */
1256
+ async function inspectServeDaemon() {
1257
+ const mgr = await resolveActiveManager();
1258
+ const args = mgr ? await readDaemonServeArgs(mgr) : null;
1259
+ const token = await loadOrCreateToken(void 0);
1260
+ const portless = args !== null && argsUsePortless(args);
1261
+ const port = args === null ? null : portless ? await portlessAppPort() : portFromArgs(args);
1262
+ return {
1263
+ args,
1264
+ port,
1265
+ httpUp: args !== null && await fetchDaemonVersion(port, token) !== null,
1266
+ token,
1267
+ consoleUrl: portless ? await resolvedPortlessConsoleUrl(token) : null
1268
+ };
1269
+ }
1270
+ /**
1252
1271
  * Best-effort HTTP base URL of the LOCAL running daemon, for CLI→daemon calls
1253
1272
  * (`ay widget`). More robust than resolveLocalServeUrl for UNMANAGED daemons: it
1254
1273
  * also reads the portless proxy backend port (~/.portless/routes.json) and the
@@ -1671,7 +1690,7 @@ Options:
1671
1690
  const { planRustServe } = await import("./serveRust-DDQiZmMf.js");
1672
1691
  const plan = planRustServe(rest);
1673
1692
  if (plan.kind === "rust") {
1674
- const { findAyrsBinary } = await import("./rustBinary-0cD4pQIE.js");
1693
+ const { findAyrsBinary } = await import("./rustBinary-B7rq3nuz.js");
1675
1694
  const ayrs = findAyrsBinary();
1676
1695
  if (ayrs) return runAyrsServe(ayrs, plan.argv);
1677
1696
  process.stderr.write("ay serve: ayrs binary not found — running the TypeScript server (bun run build:rs, or reinstall, to get the Rust daemon)\n");
@@ -2646,7 +2665,7 @@ Options:
2646
2665
  }
2647
2666
  });
2648
2667
  if (req.method === "GET" && p === "/api/ws") {
2649
- const ws = await import("./ws-DjGQGPCq.js");
2668
+ const ws = await import("./ws-ID7-zDiJ.js");
2650
2669
  try {
2651
2670
  await ws.loadProvision();
2652
2671
  } catch (e) {
@@ -2666,7 +2685,7 @@ Options:
2666
2685
  if (req.method === "GET" && p === "/api/ws/status") {
2667
2686
  const dirRaw = url.searchParams.get("path");
2668
2687
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2669
- const ws = await import("./ws-DjGQGPCq.js");
2688
+ const ws = await import("./ws-ID7-zDiJ.js");
2670
2689
  let prov;
2671
2690
  try {
2672
2691
  prov = await ws.loadProvision();
@@ -2688,7 +2707,7 @@ Options:
2688
2707
  }
2689
2708
  }
2690
2709
  if (req.method === "GET" && p === "/api/ws/repos") {
2691
- const ws = await import("./ws-DjGQGPCq.js");
2710
+ const ws = await import("./ws-ID7-zDiJ.js");
2692
2711
  try {
2693
2712
  await ws.loadProvision();
2694
2713
  } catch (e) {
@@ -2769,7 +2788,7 @@ Options:
2769
2788
  const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
2770
2789
  if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
2771
2790
  const [, owner, repo] = m;
2772
- const ws = await import("./ws-DjGQGPCq.js");
2791
+ const ws = await import("./ws-ID7-zDiJ.js");
2773
2792
  let prov;
2774
2793
  try {
2775
2794
  prov = await ws.loadProvision();
@@ -3687,7 +3706,7 @@ Options:
3687
3706
  const perm = body.perm ?? "r";
3688
3707
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3689
3708
  try {
3690
- const { createScopedShare } = await import("./agentShare-CDOvU64K.js");
3709
+ const { createScopedShare } = await import("./agentShare-uzFuaLUH.js");
3691
3710
  const share = await createScopedShare({
3692
3711
  agent: body.agent,
3693
3712
  perm,
@@ -3702,12 +3721,12 @@ Options:
3702
3721
  }
3703
3722
  }
3704
3723
  if (req.method === "GET" && p === "/api/shares") {
3705
- const { listShares } = await import("./agentShare-CDOvU64K.js");
3724
+ const { listShares } = await import("./agentShare-uzFuaLUH.js");
3706
3725
  return Response.json(listShares());
3707
3726
  }
3708
3727
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3709
3728
  if (req.method === "DELETE" && revokeM) {
3710
- const { revokeShare } = await import("./agentShare-CDOvU64K.js");
3729
+ const { revokeShare } = await import("./agentShare-uzFuaLUH.js");
3711
3730
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3712
3731
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3713
3732
  }
@@ -4019,7 +4038,7 @@ Options:
4019
4038
  const shutdown = (resolve) => {
4020
4039
  if (heartbeat) clearInterval(heartbeat);
4021
4040
  closeShare?.();
4022
- import("./agentShare-CDOvU64K.js").then((m) => m.revokeAllShares()).catch(() => {});
4041
+ import("./agentShare-uzFuaLUH.js").then((m) => m.revokeAllShares()).catch(() => {});
4023
4042
  server?.stop();
4024
4043
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
4025
4044
  };
@@ -4031,5 +4050,5 @@ Options:
4031
4050
  }
4032
4051
 
4033
4052
  //#endregion
4034
- export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
4035
- //# sourceMappingURL=serve-BD-7GaKa.js.map
4053
+ export { cmdServe, inspectServeDaemon, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
4054
+ //# sourceMappingURL=serve-Q4dnZc5l.js.map
@@ -88,7 +88,7 @@ async function cmdSetup(rest) {
88
88
  process.stdout.write(`workspace root: ${abs}\n`);
89
89
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
90
90
  try {
91
- const { linkBunBinsToSystemPath } = await import("./systemPathLink-VV-Vm6y2.js");
91
+ const { linkBunBinsToSystemPath } = await import("./systemPathLink-DoyBuRQq.js");
92
92
  const r = linkBunBinsToSystemPath();
93
93
  if (r && (r.linked.length || r.refreshed.length)) {
94
94
  const n = r.linked.length + r.refreshed.length;
@@ -97,7 +97,7 @@ async function cmdSetup(rest) {
97
97
  } catch {}
98
98
  if (noShare) return 0;
99
99
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
100
- const { cmdServe } = await import("./serve-BD-7GaKa.js");
100
+ const { cmdServe } = await import("./serve-Q4dnZc5l.js");
101
101
  return cmdServe([
102
102
  "install",
103
103
  "--share",
@@ -107,4 +107,4 @@ async function cmdSetup(rest) {
107
107
 
108
108
  //#endregion
109
109
  export { cmdSetup };
110
- //# sourceMappingURL=setup-Dad2A_-o.js.map
110
+ //# sourceMappingURL=setup-aEuGSFjB.js.map