tryharness 0.7.78 → 0.7.82

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 (63) hide show
  1. package/README.md +4 -3
  2. package/assets/install.sh +104 -0
  3. package/cli.mjs +203 -321
  4. package/lib/adapters.mjs +7 -6
  5. package/lib/agentRuntimes.mjs +2 -1
  6. package/lib/backupSetup.mjs +0 -52
  7. package/lib/boardProtocol.json +21 -1
  8. package/lib/browserPage.mjs +30 -0
  9. package/lib/coordinator.mjs +0 -2
  10. package/lib/daemon.mjs +117 -7
  11. package/lib/desktop.mjs +7 -1
  12. package/lib/dispatcher.mjs +12 -2
  13. package/lib/environments.mjs +4 -11
  14. package/lib/goalCommands.mjs +18 -8
  15. package/lib/hookDialects.mjs +2 -1
  16. package/lib/jobAnswers.mjs +2 -1
  17. package/lib/kanban.mjs +217 -48
  18. package/lib/localStack.mjs +24 -9
  19. package/lib/machineRoutes.mjs +9 -0
  20. package/lib/machineRuns.mjs +9 -1
  21. package/lib/manager.mjs +60 -2
  22. package/lib/mcp-stdio.mjs +9 -3
  23. package/lib/museSession.mjs +2 -1
  24. package/lib/nativeHost.mjs +11 -2
  25. package/lib/network.mjs +20 -0
  26. package/lib/notify.mjs +48 -16
  27. package/lib/onboard.mjs +71 -366
  28. package/lib/ownMachines.mjs +95 -44
  29. package/lib/pairing.mjs +0 -84
  30. package/lib/paths.mjs +17 -0
  31. package/lib/peopleBoard.mjs +131 -0
  32. package/lib/personNotices.mjs +9 -25
  33. package/lib/phones.mjs +1 -0
  34. package/lib/profile.mjs +0 -109
  35. package/lib/projectBoard.mjs +219 -0
  36. package/lib/projectPieces.mjs +26 -0
  37. package/lib/projects.mjs +37 -4
  38. package/lib/removeHarness.mjs +91 -0
  39. package/lib/roomChannels.mjs +2 -0
  40. package/lib/runAuthority.mjs +23 -9
  41. package/lib/runBrief.mjs +20 -14
  42. package/lib/runner.mjs +3 -3
  43. package/lib/runtime-install.mjs +22 -2
  44. package/lib/screen.mjs +133 -0
  45. package/lib/selfUpdate.mjs +6 -6
  46. package/lib/service.mjs +120 -7
  47. package/lib/sessionControl.mjs +10 -0
  48. package/lib/setupChoices.mjs +400 -0
  49. package/lib/setupMode.mjs +137 -0
  50. package/lib/store.mjs +6 -3
  51. package/lib/swarm.mjs +181 -61
  52. package/lib/t3.mjs +23 -14
  53. package/lib/taskCommands.mjs +25 -15
  54. package/lib/taskRooms.mjs +2 -4
  55. package/lib/threadActions.mjs +16 -4
  56. package/lib/threadAuthority.mjs +28 -10
  57. package/lib/threadRuns.mjs +162 -74
  58. package/lib/toolCheck.mjs +136 -0
  59. package/lib/ui.mjs +15 -1
  60. package/lib/wakes.mjs +3 -3
  61. package/npm-shrinkwrap.json +14 -14
  62. package/package.json +4 -4
  63. package/release.json +64 -55
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import { spawnSync } from "node:child_process";
5
5
  import { createRequire } from "node:module";
6
6
  import { ensureDir, readJson, writeJsonAtomic } from "./files.mjs";
7
- import { paths } from "./paths.mjs";
7
+ import { harnessNode, paths } from "./paths.mjs";
8
8
  import {
9
9
  RELEASE_ENTRIES,
10
10
  RELEASE_FILE,
@@ -193,7 +193,7 @@ const launcherFile = () =>
193
193
  path.join(paths.home, "bin", WINDOWS ? "tryharness.cmd" : "tryharness");
194
194
 
195
195
  // The person's command for this computer's Harness: it runs the installed release, never whatever npm has newest.
196
- function writeLauncher(release, nodePath = process.execPath) {
196
+ function writeLauncher(release, nodePath = harnessNode()) {
197
197
  const entry = path.join(release, "cli.mjs");
198
198
  const script = WINDOWS
199
199
  ? `@"${nodePath}" "${entry}" %*\r\n`
@@ -218,6 +218,26 @@ export function relayCommand(words = "") {
218
218
  return `${shown.includes(" ") ? JSON.stringify(shown) : shown}${tail}`;
219
219
  }
220
220
 
221
+ /**
222
+ * Before `tryharness upgrade` sets up a checked release: a computer that runs Harness on its own Node (~/.harness/node,
223
+ * from install.sh) gets the Node the release pins, by the release's own install.sh, so it is downloaded and checked
224
+ * the same way as at install. The Node here stays until the new one is checked and in place. A computer set up with
225
+ * plain npx has no Node of Harness's own and keeps the one it runs on.
226
+ */
227
+ export function updateHarnessNode(releaseRoot) {
228
+ const installer = path.join(releaseRoot, "assets", "install.sh");
229
+ const hasOwnNode = fs.existsSync(paths.node);
230
+ if (WINDOWS || !hasOwnNode || !fs.existsSync(installer)) return;
231
+ const updated = spawnSync("sh", [installer, "--node-only"], {
232
+ stdio: "inherit",
233
+ env: { ...process.env, HARNESS_HOME: paths.home },
234
+ });
235
+ if (updated.status !== 0)
236
+ throw new Error(
237
+ "could not bring the Node.js this release runs on, so it was not set up. Nothing was changed."
238
+ );
239
+ }
240
+
221
241
  /**
222
242
  * `tryharness upgrade`: fetches a release from npm without running any of it (no install scripts), and keeps it only
223
243
  * when it is signed with a key the installed runtime trusts. Returns where it is unpacked, for setup to run from
package/lib/screen.mjs ADDED
@@ -0,0 +1,133 @@
1
+ import os from "node:os";
2
+ import path from "node:path";
3
+ import { spawnSync } from "node:child_process";
4
+
5
+ // Whether setup can show its screens on this computer, or has to give the person a code to type on another one.
6
+ // Only certain facts say there is no screen: no buddy is built for this computer, or this user has no desktop
7
+ // session. Where there is a screen, the buddy opens and the code is printed as well, so a wrong guess only means
8
+ // typing a code. Signs that the person is remote (a login over SSH or mosh above the installer) put the code first
9
+ // and leave the screen alone; the person can say otherwise with --screen or --no-screen.
10
+
11
+ // The computers a buddy is built for (cli/package.json's tryharness-desktop-* packages).
12
+ const BUDDY_BUILT = ["darwin-arm64", "darwin-x64", "linux-x64"];
13
+ // What runs a login from another computer.
14
+ const REMOTE = /^(sshd|sshd-session|mosh-server)$/;
15
+
16
+ const run = (command, args) =>
17
+ spawnSync(command, args, { encoding: "utf8", timeout: 3_000 });
18
+
19
+ /**
20
+ * Where setup shows. `facts` are what `readScreenFacts` reads; kept apart so the rule can be checked on its own.
21
+ * Returns { show: "screen" | "code-first" | "code-only", why }.
22
+ */
23
+ export function whereSetupShows({ buddyBuilt, desktopSession, remote, asked }) {
24
+ if (!buddyBuilt)
25
+ return { show: "code-only", why: "no Harness app for this computer" };
26
+ if (!desktopSession)
27
+ return { show: "code-only", why: "no desktop on this computer" };
28
+ if (asked === "screen") return { show: "screen", why: "asked for" };
29
+ if (asked === "code") return { show: "code-first", why: "asked for" };
30
+ if (remote) return { show: "code-first", why: "signed in from elsewhere" };
31
+ return { show: "screen", why: "at this computer" };
32
+ }
33
+
34
+ /** Read the facts `whereSetupShows` decides on, for the installer running as `pid`. */
35
+ export function readScreenFacts({
36
+ table,
37
+ pid = process.pid,
38
+ env = process.env,
39
+ platform = process.platform,
40
+ arch = process.arch,
41
+ argv = process.argv,
42
+ }) {
43
+ return {
44
+ buddyBuilt: BUDDY_BUILT.includes(`${platform}-${arch}`),
45
+ desktopSession: hasDesktopSession({ env, platform }),
46
+ remote: isRemote({ table, pid }),
47
+ asked: argv.includes("--screen")
48
+ ? "screen"
49
+ : argv.includes("--no-screen")
50
+ ? "code"
51
+ : null,
52
+ };
53
+ }
54
+
55
+ /** Whether the person running setup has a desktop on this computer: on a Mac, a login at its screen. */
56
+ function hasDesktopSession({ env, platform }) {
57
+ // Run with sudo, the desktop to look for is the person's who ran it, not root's.
58
+ const uid = Number(env.SUDO_UID) || os.userInfo().uid;
59
+ if (platform === "darwin")
60
+ return run("launchctl", ["print", `gui/${uid}`]).status === 0;
61
+ if (platform === "linux") {
62
+ if (env.DISPLAY || env.WAYLAND_DISPLAY) return true;
63
+ return graphicalLinuxSession(uid);
64
+ }
65
+ return false;
66
+ }
67
+
68
+ /** A graphical login (X11 or Wayland) of this user that systemd knows, for when the environment does not say. */
69
+ function graphicalLinuxSession(uid) {
70
+ const listed = run("loginctl", ["list-sessions", "--no-legend"]);
71
+ if (listed.status !== 0) return false;
72
+ return (listed.stdout || "")
73
+ .split("\n")
74
+ .map((line) => line.trim().split(/\s+/))
75
+ .filter(([id, user]) => id && Number(user) === uid)
76
+ .some(([id]) => {
77
+ const shown = run("loginctl", ["show-session", id, "-p", "Type"]);
78
+ return /Type=(x11|wayland)/.test(shown.stdout || "");
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Whether the installer was started from another computer: a login over SSH or mosh among the processes above it.
84
+ * Inside tmux the processes above lead to the tmux server, started whenever the session was, so the walk starts from
85
+ * the tmux client showing this session now.
86
+ */
87
+ function isRemote({ table, pid }) {
88
+ if (!table?.size) return false;
89
+ const start = tmuxClientOf(table, pid) ?? pid;
90
+ for (let current = start, steps = 0; current > 1 && steps < 64; steps++) {
91
+ const row = table.get(current);
92
+ if (!row) return false;
93
+ if (REMOTE.test(path.basename(row.comm))) return true;
94
+ current = row.ppid;
95
+ }
96
+ return false;
97
+ }
98
+
99
+ /** The process id of the tmux client showing the pane `pid` runs in, or null outside tmux. */
100
+ function tmuxClientOf(table, pid) {
101
+ const tty = table.get(pid)?.tty;
102
+ if (!tty || !underTmux(table, pid)) return null;
103
+ const panes = run("tmux", [
104
+ "list-panes",
105
+ "-a",
106
+ "-F",
107
+ "#{pane_tty}\t#{session_name}",
108
+ ]);
109
+ const session = (panes.stdout || "")
110
+ .split("\n")
111
+ .map((line) => line.split("\t"))
112
+ .find(([paneTty]) => paneTty === tty || paneTty === `/dev/${tty}`)?.[1];
113
+ if (!session) return null;
114
+ const clients = run("tmux", [
115
+ "list-clients",
116
+ "-t",
117
+ session,
118
+ "-F",
119
+ "#{client_pid}",
120
+ ]);
121
+ const clientPid = Number((clients.stdout || "").split("\n")[0]);
122
+ return clientPid > 1 ? clientPid : null;
123
+ }
124
+
125
+ function underTmux(table, pid) {
126
+ for (let current = pid, steps = 0; current > 1 && steps < 64; steps++) {
127
+ const row = table.get(current);
128
+ if (!row) return false;
129
+ if (/^tmux\b/.test(path.basename(row.comm))) return true;
130
+ current = row.ppid;
131
+ }
132
+ return false;
133
+ }
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { spawn } from "node:child_process";
4
4
  import { fileURLToPath } from "node:url";
5
- import { paths } from "./paths.mjs";
5
+ import { harnessNode, paths } from "./paths.mjs";
6
6
 
7
7
  const CLI = fileURLToPath(new URL("../cli.mjs", import.meta.url));
8
8
 
@@ -22,11 +22,11 @@ export function startUpdate(spec, { from, log = () => {} }) {
22
22
  out,
23
23
  `${new Date().toISOString()} updating from ${from} to ${spec}, as the person asked from home\n`
24
24
  );
25
- const child = spawn(
26
- process.execPath,
27
- [CLI, "upgrade", spec, "--no-desktop"],
28
- { detached: true, stdio: ["ignore", out, out], env: process.env }
29
- );
25
+ const child = spawn(harnessNode(), [CLI, "upgrade", spec, "--no-desktop"], {
26
+ detached: true,
27
+ stdio: ["ignore", out, out],
28
+ env: process.env,
29
+ });
30
30
  child.unref();
31
31
  } finally {
32
32
  fs.closeSync(out);
package/lib/service.mjs CHANGED
@@ -3,9 +3,9 @@ import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { spawn } from "node:child_process";
5
5
  import { detectAgents, run } from "./commands.mjs";
6
- import { ensureDir } from "./files.mjs";
7
- import { paths } from "./paths.mjs";
8
- import { appProgram } from "./desktop.mjs";
6
+ import { ensureDir, writeJsonAtomic } from "./files.mjs";
7
+ import { harnessNode, paths } from "./paths.mjs";
8
+ import { appProgram, BUNDLE_ID } from "./desktop.mjs";
9
9
 
10
10
  const LABEL = "ai.tryharness.daemon";
11
11
 
@@ -80,7 +80,7 @@ function windowsUser(env = process.env) {
80
80
 
81
81
  export function installWindowsTask({
82
82
  runtimeRoot,
83
- nodePath = process.execPath,
83
+ nodePath = harnessNode(),
84
84
  execute = run,
85
85
  env = process.env,
86
86
  }) {
@@ -136,6 +136,8 @@ export function uninstallWindowsTask({ execute = run } = {}) {
136
136
 
137
137
  function agentPath() {
138
138
  const dirs = new Set([
139
+ path.dirname(harnessNode()),
140
+ // The Node setup ran on stays reachable for the person's own tools, after Harness's own.
139
141
  path.dirname(process.execPath),
140
142
  "/opt/homebrew/bin",
141
143
  "/usr/local/bin",
@@ -182,10 +184,73 @@ function retireLegacyBridge() {
182
184
  }
183
185
  }
184
186
 
187
+ // The Harness app's one background item on a Mac (packages/desktop/helper/ai.tryharness.agent.plist), which the app
188
+ // registers when setup finishes so macOS announces it once and by the app's name. Until then the daemon runs through
189
+ // the app's launcher outside launchd, which macOS does not announce; the launcher's pid is kept to stop it by.
190
+ const APP_LABEL = "ai.tryharness.agent";
191
+ const launcherPidFile = () => path.join(paths.home, "launcher.pid");
192
+
193
+ /** Whether this Mac's daemon runs as the Harness app's background item rather than the installer's own launchd plist. */
194
+ export function appRunsService(platform = process.platform) {
195
+ const launcher = appProgram("HarnessDaemon", { platform });
196
+ if (!launcher) return false;
197
+ const item = path.join(
198
+ path.dirname(launcher),
199
+ "..",
200
+ "Library",
201
+ "LaunchAgents",
202
+ `${APP_LABEL}.plist`
203
+ );
204
+ return fs.existsSync(item) && !fs.existsSync(servicePath(platform));
205
+ }
206
+
207
+ /** Whether Harness is still set to run here: its service, or the launcher setup started, is there. */
208
+ export function serviceRunning(platform = process.platform) {
209
+ if (platform === "darwin" && appRunsService(platform))
210
+ return appItemLoaded() || launcherPid() !== null;
211
+ const file = servicePath(platform);
212
+ return !file || fs.existsSync(file);
213
+ }
214
+
215
+ function appItemLoaded() {
216
+ return run("launchctl", ["print", `gui/${process.getuid()}/${APP_LABEL}`]).ok;
217
+ }
218
+
219
+ /** The launcher setup started, while it runs: its pid, or null. */
220
+ function launcherAlive() {
221
+ const pid = Number(fs.readFileSync(launcherPidFile(), "utf8").trim() || 0);
222
+ if (!pid) return null;
223
+ // An exited launcher this process started stays listed (a zombie) until this process reaps it, which it cannot do
224
+ // while it waits here synchronously: ps tells running from exited.
225
+ const state = run("ps", ["-o", "stat=", "-p", String(pid)]).stdout?.trim();
226
+ return state && !state.startsWith("Z") ? pid : null;
227
+ }
228
+
229
+ function launcherPid() {
230
+ try {
231
+ return launcherAlive();
232
+ } catch {
233
+ return null;
234
+ }
235
+ }
236
+
237
+ /** Stop the launcher setup started, by its pid, and wait for it to go. */
238
+ function stopLauncher() {
239
+ const pid = launcherPid();
240
+ if (!pid) return;
241
+ try {
242
+ process.kill(pid, "SIGTERM");
243
+ } catch {}
244
+ for (let waited = 0; waited < 5_000 && launcherPid(); waited += 100)
245
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 100);
246
+ fs.rmSync(launcherPidFile(), { force: true });
247
+ }
248
+
185
249
  /** Whether the Harness app's launcher is here on a Mac but the daemon does not start through it yet. */
186
250
  export function launcherMissing(platform = process.platform) {
187
251
  if (platform !== "darwin" || !appProgram("HarnessDaemon", { platform }))
188
252
  return false;
253
+ if (appRunsService(platform)) return false;
189
254
  try {
190
255
  return !fs
191
256
  .readFileSync(servicePath(platform), "utf8")
@@ -197,7 +262,7 @@ export function launcherMissing(platform = process.platform) {
197
262
 
198
263
  export function installService({
199
264
  runtimeRoot,
200
- nodePath = process.execPath,
265
+ nodePath = harnessNode(),
201
266
  platform = process.platform,
202
267
  execute = run,
203
268
  }) {
@@ -209,8 +274,17 @@ export function installService({
209
274
  return installWindowsTask({ runtimeRoot, nodePath, execute });
210
275
  if (platform === "darwin") {
211
276
  const plist = servicePath(platform);
212
- // Through the Harness app's launcher when the app is here, so macOS asks for the person's folders as Harness.
277
+ // Through the Harness app's launcher when the app is here, so macOS asks for the person's folders as Harness, and
278
+ // tied to the app, so Login Items and the background-activity notice name Harness rather than its signer or Node.
213
279
  const launcher = appProgram("HarnessDaemon", { platform });
280
+ // What the launcher runs when the app's background item, or the app itself, starts it with no arguments.
281
+ if (launcher)
282
+ writeJsonAtomic(path.join(paths.home, "service.json"), {
283
+ program: [nodePath, entry, "daemon"],
284
+ path: envPath,
285
+ log: paths.log,
286
+ });
287
+ if (launcher && appRunsService(platform)) return startThroughApp(launcher);
214
288
  const program = [
215
289
  ...(launcher ? [launcher] : []),
216
290
  nodePath,
@@ -225,7 +299,7 @@ export function installService({
225
299
  `<?xml version="1.0" encoding="UTF-8"?>
226
300
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
227
301
  <plist version="1.0"><dict>
228
- <key>Label</key><string>${LABEL}</string>
302
+ <key>Label</key><string>${LABEL}</string>${launcher ? `\n <key>AssociatedBundleIdentifiers</key><string>${BUNDLE_ID}</string>` : ""}
229
303
  <key>ProgramArguments</key><array>${program.map((arg) => `<string>${xml(arg)}</string>`).join("")}</array>
230
304
  <key>EnvironmentVariables</key><dict><key>PATH</key><string>${xml(envPath)}</string><key>MallocLargeCache</key><string>0</string></dict>
231
305
  <key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>ThrottleInterval</key><integer>5</integer>
@@ -293,10 +367,49 @@ export function installService({
293
367
  return { manager: "detached", file: null };
294
368
  }
295
369
 
370
+ // The app's background item restarts onto a new release at once; before setup registered it, the launcher setup
371
+ // started is replaced by one running this release.
372
+ function startThroughApp(launcher) {
373
+ if (appItemLoaded()) {
374
+ run("launchctl", [
375
+ "kickstart",
376
+ "-k",
377
+ `gui/${process.getuid()}/${APP_LABEL}`,
378
+ ]);
379
+ return { manager: "Harness app" };
380
+ }
381
+ stopLauncher();
382
+ // The app starts it (background.rs run_daemon_now), so macOS counts the daemon's folder reads as Harness's, not as
383
+ // this terminal's (seen November 3: picking a folder in setup asked nothing). Without a screen to open the app on,
384
+ // or an app that does not start it, the launcher starts here.
385
+ const app = path.resolve(path.dirname(launcher), "..", "..");
386
+ if (run("open", ["-g", app]).ok && waitFor(() => launcherPid() !== null))
387
+ return { manager: "Harness app" };
388
+ const child = spawn(launcher, [], { detached: true, stdio: "ignore" });
389
+ child.unref();
390
+ fs.writeFileSync(launcherPidFile(), String(child.pid));
391
+ return { manager: "Harness app" };
392
+ }
393
+
394
+ // How long the app may take to open and start the daemon; past it the installer starts the daemon itself, which still
395
+ // works, counted as the terminal's. Measured November 3 on the owner's M5 Pro, 3 scripted installs, from the installer's
396
+ // start (so an upper bound on open→daemon): 4.5 s on the first (app just installed, cold) and 1.6 s twice after, the
397
+ // daemon each time within 0.5 s of the app coming up. 10 s is over twice the cold one.
398
+ const APP_STARTS_DAEMON_MS = 10_000;
399
+
400
+ function waitFor(condition) {
401
+ for (let waited = 0; waited < APP_STARTS_DAEMON_MS; waited += 200) {
402
+ if (condition()) return true;
403
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 200);
404
+ }
405
+ return false;
406
+ }
407
+
296
408
  export function uninstallService({
297
409
  platform = process.platform,
298
410
  execute = run,
299
411
  } = {}) {
412
+ if (platform === "darwin") stopLauncher();
300
413
  const file = servicePath(platform);
301
414
  if (platform === "win32") {
302
415
  uninstallWindowsTask({ execute });
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { paths } from "./paths.mjs";
4
+ import { readJson } from "./files.mjs";
4
5
  import { runningPids, runningProcesses } from "./runner.mjs";
5
6
  import { PROCESS_NAMES, nativeSessionId } from "./swarm.mjs";
6
7
  import { member, nameOf } from "./members.mjs";
@@ -488,10 +489,17 @@ export function createSessionControl({
488
489
  .sort((a, b) => b.count - a.count)[0]?.place;
489
490
  return (seeded.homes[agentId] =
490
491
  seen ??
492
+ picked().all ??
491
493
  (CODING_AGENTS.includes(agentId) && terminal
492
494
  ? terminalPlace(terminal)
493
495
  : null));
494
496
  };
497
+ // Where the person said threads open, in setup or settings (setupChoices.mjs): `all` when Harness cannot tell where
498
+ // they work, and per agent, which always wins for that agent.
499
+ const picked = () => {
500
+ const workplace = readJson(paths.config, {}).workplace ?? {};
501
+ return { all: workplace.all ?? null, agents: workplace.agents ?? {} };
502
+ };
495
503
  /** A place with the app that opens it now (T3's running build, an editor's install); null when it is not on this computer. */
496
504
  const usable = (place) => {
497
505
  if (!place) return null;
@@ -516,6 +524,8 @@ export function createSessionControl({
516
524
  return place;
517
525
  };
518
526
  const homeOf = (agentId) => {
527
+ const chosen = usable(picked().agents[agentId]);
528
+ if (chosen) return chosen;
519
529
  const tally = new Map();
520
530
  for (const place of Object.values(placesOf(agentId))) {
521
531
  if (!place?.kind || place.kind === "unknown") continue;