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
package/lib/swarm.mjs CHANGED
@@ -199,6 +199,9 @@ export function createSwarm({
199
199
  // The person chose a model for an agent here (an agent on Harness's AI also takes it as its default).
200
200
  modelChosen = () => {},
201
201
  folders,
202
+ // The person's other computers (daemon.mjs): this one's id, a computer's name, its folders for the composer
203
+ // (ownMachines.mjs foldersOn) and its checkout of a folder here (checkoutOn).
204
+ computers = null,
202
205
  runsIn,
203
206
  threadFiles = () => ({ files: [], rendering: [] }),
204
207
  whyWaiting = () => null,
@@ -228,6 +231,8 @@ export function createSwarm({
228
231
  notifyFocus = () => {},
229
232
  // What the person's words just did to a run they steered (threadRuns.mjs steered): a promise of the thread's note.
230
233
  steered = () => null,
234
+ // The computer a thread's run is on, by id (threadRuns.mjs computerOfRun).
235
+ computerOfRun = (run) => run.claimed_machine ?? null,
231
236
  }) {
232
237
  const focus = createWorkFocus({ store });
233
238
  const readWork = async (id, hostedCaller = false) => {
@@ -381,6 +386,8 @@ export function createSwarm({
381
386
  // The task this room was opened for, when it is a task's own room.
382
387
  root: store.meta(`task-room:${thread.id}`) || null,
383
388
  folder: thread.goal.workspace,
389
+ // The folder on another of the person's computers it works in instead, with that computer.
390
+ folderOn: folderOnOf(thread.id),
384
391
  working: [
385
392
  ...new Set(
386
393
  runs
@@ -510,7 +517,8 @@ export function createSwarm({
510
517
  !team.length || team.some((name) => PROCESS_NAMES[name]);
511
518
  // Where each coding agent in a thread would run its turn there: in T3 Code, or here, and why not T3 when the person uses it there.
512
519
  // `lastWorked`: where its agent last worked, when Harness picked another folder from the message, for the person to take.
513
- const placeOf = (folder, team, by, lastWorked = null) => ({
520
+ // `on`: the other computer the folder is on ({ id, label }), null for this one. No folder: a scratch folder.
521
+ const placeOf = (folder, team, by, lastWorked = null, on = null) => ({
514
522
  ok: true,
515
523
  folder,
516
524
  name: folder ? path.basename(folder) : null,
@@ -518,13 +526,61 @@ export function createSwarm({
518
526
  lastWorked: lastWorked
519
527
  ? { folder: lastWorked, name: path.basename(lastWorked) }
520
528
  : null,
521
- runs: folder
522
- ? team
523
- .filter((name) => PROCESS_NAMES[name])
524
- .map((name) => ({ agent: name, ...runsIn(name, folder) }))
525
- : [],
529
+ runs:
530
+ folder && !on
531
+ ? team
532
+ .filter((name) => PROCESS_NAMES[name])
533
+ .map((name) => ({ agent: name, ...runsIn(name, folder) }))
534
+ : [],
535
+ computer: on,
526
536
  });
527
537
 
538
+ /**
539
+ * The other computer of the person's whose folders a thread works in: the one a computer id names, else the one the
540
+ * message sends its agents to (`#pop-os`, `@codex on pop-os`); null for this computer or none.
541
+ */
542
+ const computerFor = ({ id = null, address = null, team = [] }) => {
543
+ if (!computers) return null;
544
+ const named =
545
+ id ??
546
+ (address?.ok
547
+ ? (address.shared ?? team.map(address.forAgent).find(Boolean))?.id
548
+ : null);
549
+ if (!named || named === computers.self()) return null;
550
+ return { id: String(named), label: computers.labelOf(named) ?? named };
551
+ };
552
+
553
+ // A thread whose folder is on another of the person's computers: { machine, path }. Its folder here stays empty, so
554
+ // a turn on any other computer works in a scratch folder (threadRuns.mjs).
555
+ const folderAway = (threadId) => {
556
+ try {
557
+ return JSON.parse(store.meta(`thread-folder-on:${threadId}`) || "null");
558
+ } catch {
559
+ return null;
560
+ }
561
+ };
562
+ const setFolderAway = (threadId, on, folder) => {
563
+ const away = on && folder ? { machine: on.id, path: folder } : null;
564
+ store.meta(
565
+ `thread-folder-on:${threadId}`,
566
+ away ? JSON.stringify(away) : ""
567
+ );
568
+ // Its agents' turns go to that computer unless a message names another.
569
+ if (away) store.meta(`thread-work-computer:${threadId}`, on.id);
570
+ };
571
+ const folderOnOf = (threadId) => {
572
+ const away = folderAway(threadId);
573
+ return away
574
+ ? {
575
+ folder: away.path,
576
+ computer: {
577
+ id: away.machine,
578
+ label: computers?.labelOf(away.machine) ?? away.machine,
579
+ },
580
+ }
581
+ : null;
582
+ };
583
+
528
584
  const askOf = (run) => askOfRun(store, run);
529
585
  const linkThreads = (from, to, agent) => {
530
586
  const note = (goalId, text) =>
@@ -708,10 +764,12 @@ export function createSwarm({
708
764
 
709
765
  /**
710
766
  * The person's words in a chat that is not a thread (the PiP chat, the extension, the buddy's box, the phone's New
711
- * message), naming one agent that is working (owner, October 26: steering "from any chat interface"): they go into
712
- * the thread it works in as the person's steer, as written. Working in several threads, the answer asks which
713
- * (`choose`); none, null, and the chat goes on as it would have. Words for the whole swarm, or naming several agents,
714
- * are never a steer.
767
+ * message), naming one agent that is working (owner, October 26: steering "from any chat interface"). The person
768
+ * picks where they go: one of the threads it works in, or a new thread (`choose`; owner, November 2, after "@claude
769
+ * #pop-os fix opencode" from the extension went into Claude Code's video edit on the Mac). Named for a computer the
770
+ * agent is not at work on, at work elsewhere or nowhere, they start a new thread with no choice (`newThread`). At
771
+ * work nowhere and naming no computer, null, and the chat goes on as it would have. Words for the whole swarm, or
772
+ * naming several agents, are never a steer.
715
773
  */
716
774
  const steerFromChat = (request) => {
717
775
  const text = String(request.text || "");
@@ -722,32 +780,45 @@ export function createSwarm({
722
780
  const named = asked ? [asked] : mentionsIn(text, roomAgents);
723
781
  if (named.length !== 1) return null;
724
782
  const [agent] = named;
725
- const threads = store
783
+ const address = computerAddress(text, "user", {
784
+ target: request.targetMachine ?? null,
785
+ });
786
+ const computer = address.ok ? (address.forAgent(agent)?.id ?? null) : null;
787
+ const working = (thread) =>
788
+ store
789
+ .threadRuns(thread.id)
790
+ .filter(
791
+ (run) => run.target_agent === agent && run.status === "running"
792
+ );
793
+ const atWork = store
726
794
  .goals({ all: false })
727
- .filter(
728
- (thread) =>
729
- thread.status === "open" &&
730
- store
731
- .threadRuns(thread.id)
732
- .some(
733
- (run) => run.target_agent === agent && run.status === "running"
734
- )
735
- );
736
- if (!threads.length) return null;
737
- if (threads.length > 1)
738
- return {
739
- ok: true,
740
- steered: false,
741
- choose: {
742
- agent,
743
- question: `${nameOf(agent)} is working in ${threads.length} threads. Which one is this for?`,
744
- threads: threads.map((thread) => ({
745
- id: thread.id,
746
- title: summary(thread).title,
747
- })),
748
- },
749
- };
750
- return steer({ ...request, id: threads[0].id, to: agent });
795
+ .filter((thread) => thread.status === "open" && working(thread).length);
796
+ // At work nowhere: words naming a computer start a thread there, since Harness's own handoffs cannot place work
797
+ // on a computer; naming none, the chat goes on as before.
798
+ if (!atWork.length)
799
+ return computer ? { ok: true, steered: false, newThread: true } : null;
800
+ const threads = computer
801
+ ? atWork.filter((thread) =>
802
+ working(thread).some((run) => computerOfRun(run) === computer)
803
+ )
804
+ : atWork;
805
+ if (!threads.length) return { ok: true, steered: false, newThread: true };
806
+ const titled = threads.map((thread) => ({
807
+ id: thread.id,
808
+ title: summary(thread).title,
809
+ }));
810
+ return {
811
+ ok: true,
812
+ steered: false,
813
+ choose: {
814
+ agent,
815
+ question:
816
+ titled.length === 1
817
+ ? `${nameOf(agent)} is working in "${titled[0].title}". Send this there, or start a new thread?`
818
+ : `${nameOf(agent)} is working in ${titled.length} threads. Send this to one of them, or start a new thread?`,
819
+ threads: titled,
820
+ },
821
+ };
751
822
  };
752
823
 
753
824
  // One of the person's agents as a command names it, or why not.
@@ -1110,8 +1181,7 @@ export function createSwarm({
1110
1181
  : listing();
1111
1182
  }
1112
1183
  // Any of the person's agents may start a thread and stop one it started. The thread carries the agent's trust, so
1113
- // nothing in it runs without the person's Start, and one started through Harness gets no coordinator rounds (they
1114
- // are paid) until the person sets a spend ceiling.
1184
+ // nothing in it runs without the person's Start.
1115
1185
  if (agent !== "user" && command === "board.swarm.start") {
1116
1186
  const text = String(request.text || "")
1117
1187
  .trim()
@@ -1156,7 +1226,6 @@ export function createSwarm({
1156
1226
  maxPosts: defaults.maxPosts,
1157
1227
  maxWakes: defaults.maxWakes,
1158
1228
  });
1159
- if (request.hostedCaller) store.meta(`hosted-thread:${thread.id}`, "1");
1160
1229
  // A thread an agent starts from another says so in both, so neither is a dead end for the person.
1161
1230
  const [from] = store.threadsWorkedIn(agent);
1162
1231
  if (from)
@@ -1206,9 +1275,22 @@ export function createSwarm({
1206
1275
  // Where a thread works, for the composer (folders.mjs): the folders the person works in, any folder on the computer
1207
1276
  // from a typed path, and where a message would work: the folder chosen (`folder`) or the one Harness suggests, and
1208
1277
  // where each coding agent named in it (`text`, `to`, `agents`) runs its turns there.
1278
+ // `computer`: another of the person's computers, whose own folders are listed (asked there).
1279
+ const listedOn = request.computer
1280
+ ? computerFor({ id: String(request.computer) })
1281
+ : null;
1209
1282
  if (command === "board.swarm.places")
1210
- return { ok: true, places: folders.known(), home: os.homedir() };
1211
- if (command === "board.swarm.browse") return folders.browse(request.path);
1283
+ return listedOn
1284
+ ? { pending: computers.foldersOn(listedOn.id, { places: true }) }
1285
+ : { ok: true, places: folders.known(), home: os.homedir() };
1286
+ if (command === "board.swarm.browse")
1287
+ return listedOn
1288
+ ? {
1289
+ pending: computers.foldersOn(listedOn.id, {
1290
+ browse: String(request.path ?? ""),
1291
+ }),
1292
+ }
1293
+ : folders.browse(request.path);
1212
1294
  if (command === "board.swarm.place") {
1213
1295
  const text = String(request.text || "").slice(0, 20_000);
1214
1296
  const to = recipient(request);
@@ -1223,19 +1305,31 @@ export function createSwarm({
1223
1305
  : []),
1224
1306
  ]),
1225
1307
  ];
1308
+ const on =
1309
+ listedOn ??
1310
+ computerFor({ address: computerAddress(text, "user"), team });
1311
+ if (request.noFolder === true)
1312
+ return placeOf(null, team, "you", null, on);
1226
1313
  if (request.folder) {
1227
1314
  const folder = String(request.folder);
1315
+ if (on)
1316
+ return path.isAbsolute(folder)
1317
+ ? placeOf(folder, team, "you", null, on)
1318
+ : { ok: false, error: `${folder} is not a full path` };
1228
1319
  return isDir(folder)
1229
1320
  ? placeOf(path.resolve(folder), team, "you")
1230
1321
  : { ok: false, error: `${folder} is not a folder on this computer` };
1231
1322
  }
1232
- if (!needsFolder(team)) return placeOf(null, team, null);
1323
+ if (!needsFolder(team)) return placeOf(null, team, null, null, on);
1233
1324
  return {
1234
1325
  pending: folders
1235
1326
  .suggest(text, team)
1236
- .then(({ folder, by, lastWorked }) =>
1237
- placeOf(folder, team, by, lastWorked)
1238
- ),
1327
+ .then(({ folder, by, lastWorked }) => {
1328
+ if (!on) return placeOf(folder, team, by, lastWorked);
1329
+ // Harness picks among the folders here; the computer named works in its checkout of the same repository.
1330
+ const there = folder ? computers.checkoutOn(on.id, folder) : null;
1331
+ return placeOf(there, team, there ? by : null, null, on);
1332
+ }),
1239
1333
  };
1240
1334
  }
1241
1335
  // The person's own note on one agent's card ("use it for reviews"), told to every other agent; no text clears it.
@@ -1458,9 +1552,9 @@ export function createSwarm({
1458
1552
  .slice(0, 20_000);
1459
1553
  if (!text) return { ok: false, error: "a thread starts with a message" };
1460
1554
  // From a chat outside any thread (the buddy's box, the phone's New message): words for one agent already at work
1461
- // steer it there rather than start it again somewhere new.
1555
+ // ask whether they go to its thread or start this one; for it on a computer it is not at work on, this one starts.
1462
1556
  const steering = request.steer === true ? steerFromChat(request) : null;
1463
- if (steering) return steering;
1557
+ if (steering && !steering.newThread) return steering;
1464
1558
  // What it may spend of the person's Harness credits, set once as it starts.
1465
1559
  const ceiling = ceilingFrom(request.ceilingUsd);
1466
1560
  if (ceiling === undefined)
@@ -1470,11 +1564,8 @@ export function createSwarm({
1470
1564
  ? request.continueSession
1471
1565
  : null;
1472
1566
  let folder = request.folder ? String(request.folder) : null;
1473
- if (folder && !isDir(folder))
1474
- return {
1475
- ok: false,
1476
- error: `${folder} is not an absolute path to a folder`,
1477
- };
1567
+ // The person chose no folder: its agents work in a scratch folder, and Harness picks none.
1568
+ const noFolder = request.noFolder === true && !folder;
1478
1569
  const to = recipient(request);
1479
1570
  if (to === false)
1480
1571
  return {
@@ -1490,6 +1581,17 @@ export function createSwarm({
1490
1581
  const target = request.targetMachine ?? null;
1491
1582
  const address = computerAddress(text, "user", { target });
1492
1583
  if (!address.ok) return { ok: false, error: address.error };
1584
+ // `computer`: the other computer the folder is on (its composer listed that computer's folders). A folder of this
1585
+ // computer's stays the thread's; another computer works in its own checkout of it, else a scratch folder.
1586
+ const folderOn =
1587
+ folder && request.computer
1588
+ ? computerFor({ id: String(request.computer) })
1589
+ : null;
1590
+ if (folder && !(folderOn ? path.isAbsolute(folder) : isDir(folder)))
1591
+ return {
1592
+ ok: false,
1593
+ error: `${folder} is not an absolute path to a folder`,
1594
+ };
1493
1595
  if (from) {
1494
1596
  const agentName = String(from.agent || ""),
1495
1597
  sessionId = String(from.sessionId || "");
@@ -1530,10 +1632,11 @@ export function createSwarm({
1530
1632
  provenance: provenanceFor("user"),
1531
1633
  team: [...new Set(team)],
1532
1634
  facilitator: DISPATCHER,
1533
- workspace: where ? path.resolve(where) : null,
1635
+ workspace: !folderOn && where ? path.resolve(where) : null,
1534
1636
  maxPosts: defaults.maxPosts,
1535
1637
  maxWakes: defaults.maxWakes,
1536
1638
  });
1639
+ if (folderOn) setFolderAway(thread.id, folderOn, where);
1537
1640
  if (ceiling !== null) setCeiling(thread.id, ceiling);
1538
1641
  if (from) {
1539
1642
  store.setGoalSession(
@@ -1562,7 +1665,7 @@ export function createSwarm({
1562
1665
  notifyBoard(store.getTask(id));
1563
1666
  return { ok: true, thread: summary(store.getTask(id)) };
1564
1667
  };
1565
- if (folder || !needsFolder([...team])) {
1668
+ if (folder || noFolder || !needsFolder([...team])) {
1566
1669
  const thread = begin(folder);
1567
1670
  hear(thread);
1568
1671
  return started(thread);
@@ -1582,7 +1685,7 @@ export function createSwarm({
1582
1685
  void suggestion.then(({ folder: picked }) => {
1583
1686
  const now = store.getTask(thread.id);
1584
1687
  if (now?.status !== "open") return;
1585
- if (picked && !now.goal.workspace)
1688
+ if (picked && !now.goal.workspace && !folderAway(thread.id))
1586
1689
  store.setGoalFolder(thread.id, path.resolve(picked));
1587
1690
  hear(thread);
1588
1691
  notifyBoard(store.getTask(thread.id));
@@ -2006,15 +2109,26 @@ export function createSwarm({
2006
2109
  }
2007
2110
  // The person moves the thread to another folder between turns. Each agent starts a new session there, as a session
2008
2111
  // and a T3 thread belong to the folder they ran in.
2112
+ // `noFolder`: to a scratch folder; `computer`: to a folder on another of the person's computers.
2009
2113
  if (command === "board.swarm.folder") {
2010
- const folder = String(request.folder || "");
2011
- if (!isDir(folder))
2114
+ const on = request.computer
2115
+ ? computerFor({ id: String(request.computer) })
2116
+ : null;
2117
+ const folder =
2118
+ request.noFolder === true ? null : String(request.folder || "");
2119
+ if (folder !== null && !(on ? path.isAbsolute(folder) : isDir(folder)))
2012
2120
  return {
2013
2121
  ok: false,
2014
- error: `${folder} is not a folder on this computer`,
2122
+ error: on
2123
+ ? `${folder} is not a full path`
2124
+ : `${folder} is not a folder on this computer`,
2015
2125
  };
2016
- const where = path.resolve(folder);
2017
- if (where === thread.goal.workspace)
2126
+ const where = folder && !on ? path.resolve(folder) : folder;
2127
+ const away = folderAway(thread.id);
2128
+ const now = away
2129
+ ? { machine: away.machine, path: away.path }
2130
+ : { machine: null, path: thread.goal.workspace ?? null };
2131
+ if (where === now.path && (on?.id ?? null) === now.machine)
2018
2132
  return { ok: true, thread: summary(thread) };
2019
2133
  if (
2020
2134
  store
@@ -2028,7 +2142,9 @@ export function createSwarm({
2028
2142
  };
2029
2143
  const moved = worktrees.moved(thread.id);
2030
2144
  if (!moved.ok) return moved;
2031
- store.setGoalFolder(thread.id, where);
2145
+ store.setGoalFolder(thread.id, on ? null : where);
2146
+ setFolderAway(thread.id, on, on ? where : null);
2147
+ if (away && !on) store.meta(`thread-work-computer:${thread.id}`, "");
2032
2148
  for (const name of Object.keys(thread.goal.sessions || {}))
2033
2149
  store.setGoalSession(thread.id, name, null);
2034
2150
  for (const name of thread.goal.team)
@@ -2038,7 +2154,11 @@ export function createSwarm({
2038
2154
  goalId: thread.id,
2039
2155
  author: "user",
2040
2156
  kind: "note",
2041
- text: `Now working in ${where}.`,
2157
+ text: !where
2158
+ ? "Now working in a scratch folder."
2159
+ : on
2160
+ ? `Now working in ${where} on ${on.label}.`
2161
+ : `Now working in ${where}.`,
2042
2162
  });
2043
2163
  notifyBoard(store.getTask(thread.id));
2044
2164
  return { ok: true, thread: summary(store.getTask(thread.id)) };
package/lib/t3.mjs CHANGED
@@ -429,24 +429,33 @@ function laterTurn(recent, runId, activeRunId) {
429
429
  return ordinal(activeRunId) > ordinal(runId) ? activeRunId : null;
430
430
  }
431
431
 
432
- /** One item of a T3 thread as a step on the board: its words, or what it did in a line. */
433
- function stepOf(item) {
432
+ // T3 keeps a tool's call and answer as JSON in an item's text, with the tool's name first.
433
+ const TOOL_NAME = /"toolName":\s*"([^"]+)"/;
434
+
435
+ /** What an item did, in a line. Its text can be a tool's raw JSON, which is T3's record and not for the person to read. */
436
+ function didLine(item, text) {
437
+ if (item.type === "command_execution") {
438
+ const command = text.split("\n")[0].replace(/^\$\s*/, "");
439
+ return `ran: ${item.title === "Workspace ready" ? item.title : command}`;
440
+ }
441
+ if (item.type === "web_search") return "searched the web";
442
+ if (item.title) return item.title;
443
+ if (item.type === "dynamic_tool")
444
+ return TOOL_NAME.exec(text)?.[1] ?? "used a tool";
445
+ // A file change is its path, then the change as JSON.
446
+ if (item.type === "file_change") return `edited: ${text.split(" {")[0]}`;
447
+ const raw = /^[[{]/.test(text);
448
+ return (!raw && text.split("\n")[0]) || String(item.type).replace(/_/g, " ");
449
+ }
450
+
451
+ /** One item of a T3 thread as a step on the board: its words, or what it did in a line; null for T3's own bookkeeping. */
452
+ export function t3Step(item) {
434
453
  const text = String(item.text || "").trim();
435
454
  if (item.type === "assistant_message")
436
455
  return text ? { kind: "say", text } : null;
437
- if (item.type === "command_execution")
438
- return {
439
- kind: "do",
440
- text: `ran: ${(item.title === "Workspace ready" ? item.title : text.split("\n")[0].replace(/^\$\s*/, "")).slice(0, 200)}`,
441
- };
442
- if (item.type === "web_search")
443
- return { kind: "do", text: "searched the web" };
444
456
  if (["user_message", "reasoning", "checkpoint"].includes(item.type))
445
457
  return null;
446
- return {
447
- kind: "do",
448
- text: `${item.title || String(item.type).replace(/_/g, " ")}`.slice(0, 200),
449
- };
458
+ return { kind: "do", text: didLine(item, text).slice(0, 200) };
450
459
  }
451
460
 
452
461
  // The option T3 gives each agent's effort under, by agent.
@@ -586,7 +595,7 @@ export function runInT3(run, emit, observe) {
586
595
  !seen.has(item.itemId)
587
596
  ) {
588
597
  seen.add(item.itemId);
589
- const step = stepOf(item);
598
+ const step = t3Step(item);
590
599
  if (step) {
591
600
  if (step.kind === "say") last = step.text;
592
601
  observe(
@@ -24,17 +24,19 @@ import {
24
24
  youLine,
25
25
  } from "./cards.mjs";
26
26
  import { PICKABLE, resolvePick, setRunPick } from "./models.mjs";
27
- import { onMachine, placeTask } from "./machineRoutes.mjs";
27
+ import { fromCloud, onMachine, placeTask } from "./machineRoutes.mjs";
28
28
  import { computerAddress } from "./computerAddress.mjs";
29
29
  import { within } from "./folders.mjs";
30
30
  import { recordClaims } from "./audit.mjs";
31
31
  import {
32
+ callerRun,
32
33
  HOSTED_CALLER,
33
34
  limitedCaller,
34
35
  PROPOSERS,
35
36
  RUN_CALLER,
36
37
  } from "./runAuthority.mjs";
37
38
  import { prepareScratch, threadScratch } from "./scratch.mjs";
39
+ import { restrictedRun } from "./runWorker.mjs";
38
40
 
39
41
  // An agent working in a thread may bring another agent in for part of the work there, as Harness does when it names
40
42
  // one; an agent that moves money or takes positions joins only when the person names it (members.mjs TAGGED_ONLY).
@@ -149,7 +151,6 @@ export function createTaskCommands({
149
151
  opts.agent,
150
152
  provenance,
151
153
  {
152
- hosted: Boolean(request.hostedCaller),
153
154
  into: opts.into,
154
155
  folder: opts.folder,
155
156
  machine: opts.machine,
@@ -172,10 +173,15 @@ export function createTaskCommands({
172
173
  // What a worker is told of a task home lists for it, sealed like every answer between the person's computers
173
174
  // (machineRuns.mjs): started on another agent's ask on standing permission, so it gets none of the person's secrets,
174
175
  // and, naming no folder, run in its thread's scratch folder there.
176
+ // A run handed to another computer runs held in as home would run it (runWorker.mjs startBoardRun): read-only for a
177
+ // review, restricted, or with only the person's own agent settings for work another person asked for.
175
178
  const forWorker = (task) => ({
176
179
  ...task,
177
180
  standing: Boolean(store.standingProposal(task.id)),
178
181
  scratch: !task.run_workspace && task.kind === "task" && !!task.parent_id,
182
+ readOnly: store.meta(`review:${task.id}`) === "1",
183
+ restricted: restrictedRun(store, task),
184
+ ownSettingsOnly: store.meta(`other-person-run:${task.id}`) === "1",
179
185
  });
180
186
  return (request, { agent, id, expected, machine }) => {
181
187
  if (request.command.startsWith("board.dispatch."))
@@ -185,11 +191,15 @@ export function createTaskCommands({
185
191
  let outcome;
186
192
  // A call from one of the person's other computers, which home answers on its board (ownMachines.mjs).
187
193
  const fromElsewhere = Boolean(machine) && machine !== machines.self();
188
- // An agent's words from another computer carry no go of the person's here, as a call through Harness carries none
189
- // (security audit 2026-10-25, M1): the work it writes waits for the person's Start.
190
- const noGo =
191
- Boolean(request.hostedCaller) ||
192
- (fromElsewhere && !["user", "harness"].includes(agent));
194
+ // An agent's words from another computer the person drives carry their go as from this one, its run's limits sealed
195
+ // with them (owner, November 2, in place of audit M1). From a cloud computer Harness runs for them, as through
196
+ // Harness's server, they carry none of their own: what its agent writes starts on standing permission, past the
197
+ // guard (runAuthority.mjs admitPosted).
198
+ const cloud =
199
+ fromElsewhere &&
200
+ fromCloud(store, request) &&
201
+ !["user", "harness"].includes(agent);
202
+ const noGo = Boolean(request.hostedCaller) || cloud;
193
203
  if (
194
204
  request.command === "board.post" &&
195
205
  request.thread &&
@@ -597,8 +607,9 @@ export function createTaskCommands({
597
607
  if (pick) setRunPick(store, task.id, pick, agent);
598
608
  // How many times the person's agents have handed this work on since the person last did (runAuthority.mjs
599
609
  // MAX_HANDOFFS): one more than the run that posted it, none from a session or a post of the person's own.
600
- const handoffs = request[RUN_CALLER]
601
- ? Number(store.meta(`handoffs:${request[RUN_CALLER].id}`) || 0) + 1
610
+ const caller = callerRun(request);
611
+ const handoffs = caller
612
+ ? Number(store.meta(`handoffs:${caller.id}`) || 0) + 1
602
613
  : 0;
603
614
  if (handoffs) store.meta(`handoffs:${task.id}`, String(handoffs));
604
615
  if (deferred) {
@@ -618,8 +629,8 @@ export function createTaskCommands({
618
629
  }
619
630
  }
620
631
  // A job in a goal's room runs on the goal's authority; anywhere else, standing permission decides. The goal covers
621
- // jobs from the person and from their agents whose words came from the person's side (the agents on this machine,
622
- // Harness in the person's window; threadAuthority.mjs), with the person's go (personsGo) unless an agent's words
632
+ // jobs from the person and from their agents whose words came from the person's side (the agents on this machine
633
+ // or another the person drives, Harness in the person's window; threadAuthority.mjs), with the person's go (personsGo) unless an agent's words
623
634
  // came from above the poster; a job from a member that runs elsewhere (Grok Bot, Muse, a connected app), or any job
624
635
  // that came through Harness's server whatever name it carries, waits for the person's Start. A job
625
636
  // a restricted run or a review posts carries no go: it runs restricted (a review's job as a review) or waits, as
@@ -630,8 +641,7 @@ export function createTaskCommands({
630
641
  (!noGo && request.fromWindow !== true && speaksFromPersonsSide(agent));
631
642
  const agentWritten = task.trust !== "user";
632
643
  const limited = limitedCaller(request);
633
- if (limited && request[RUN_CALLER].review)
634
- store.meta(`review:${task.id}`, "1");
644
+ if (limited && caller.review) store.meta(`review:${task.id}`, "1");
635
645
  const go =
636
646
  onGoal &&
637
647
  !limited &&
@@ -682,7 +692,6 @@ export function createTaskCommands({
682
692
  ROOM_AGENTS.includes(task.target_agent)
683
693
  )
684
694
  openTaskRoom(store.getTask(task.id), agent, provenance, {
685
- hosted: Boolean(request.hostedCaller),
686
695
  into: workingThread,
687
696
  folder: askerFolder,
688
697
  machine,
@@ -705,7 +714,7 @@ export function createTaskCommands({
705
714
  // goal's authority.
706
715
  const cameAsItSpeaks = speaksThroughHarness(agent)
707
716
  ? request[HOSTED_CALLER] === true
708
- : !noGo;
717
+ : !noGo || cloud;
709
718
  const proposed =
710
719
  cameAsItSpeaks &&
711
720
  PROPOSERS.includes(agent) &&
@@ -734,6 +743,7 @@ export function createTaskCommands({
734
743
  proposer: agent,
735
744
  hosted: request[HOSTED_CALLER] === true,
736
745
  here: !noGo,
746
+ cloud,
737
747
  guard,
738
748
  limited,
739
749
  window: request.fromWindow === true,
package/lib/taskRooms.mjs CHANGED
@@ -79,14 +79,13 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
79
79
  /**
80
80
  * The thread `task` is worked in, opened for it or joined. `into`: the thread the poster is working in, which the
81
81
  * task joins (taskCommands.mjs). `folder`: where a coding agent that asked works, so its turn on the answer runs
82
- * there (answers.mjs) when the task names no folder. `machine`: the computer the poster wrote from. `hosted`: posted
83
- * through Harness.
82
+ * there (answers.mjs) when the task names no folder. `machine`: the computer the poster wrote from.
84
83
  */
85
84
  const open = (
86
85
  task,
87
86
  poster,
88
87
  provenance,
89
- { hosted = false, into = null, folder = null, machine = null } = {}
88
+ { into = null, folder = null, machine = null } = {}
90
89
  ) => {
91
90
  const conversation = conversationOf(task);
92
91
  const joined = into
@@ -115,7 +114,6 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
115
114
  if (provenance?.trust === "user") worktrees.inPlace(room.id);
116
115
  store.meta(`task-room:${room.id}`, task.id);
117
116
  if (conversation) store.meta(`conversation-room:${conversation}`, room.id);
118
- if (hosted) store.meta(`hosted-thread:${room.id}`, "1");
119
117
  return postJob(room, task, poster, machine);
120
118
  };
121
119
 
@@ -162,6 +162,8 @@ export function createThreadActions({
162
162
  names = post.mentions,
163
163
  {
164
164
  hosted = false,
165
+ // The words came from a cloud computer Harness runs for the person: the guard's reading decides, as for hosted.
166
+ cloud = false,
165
167
  window = false,
166
168
  why = null,
167
169
  guard,
@@ -220,6 +222,7 @@ export function createThreadActions({
220
222
  projectGo ??
221
223
  authority.personsGo(author, agent, {
222
224
  hosted,
225
+ cloud,
223
226
  guard,
224
227
  limited,
225
228
  window,
@@ -232,15 +235,23 @@ export function createThreadActions({
232
235
  held:
233
236
  guard === undefined
234
237
  ? null
235
- : authority.guardWait(author, agent, guard, { hosted }),
238
+ : authority.guardWait(author, agent, guard, { hosted, cloud }),
236
239
  orders: guard !== undefined && authority.readAsOrders(guard),
237
240
  answer: agent === answering,
238
241
  // How the ask came, for one from the person's own agents: in a thread another agent wrote, its turn may start
239
- // on the agent's standing permission (threadRuns.mjs admitProposal). `here`: from a process on this computer.
242
+ // on the agent's standing permission (threadRuns.mjs admitProposal). `here`: from a process on this computer
243
+ // or another the person drives; `cloud`: from a cloud computer Harness runs for them.
240
244
  proposal:
241
245
  guard === undefined
242
246
  ? null
243
- : { hosted: server, here: !hosted, guard, limited, window },
247
+ : {
248
+ hosted: server,
249
+ here: !hosted && !cloud,
250
+ cloud,
251
+ guard,
252
+ limited,
253
+ window,
254
+ },
244
255
  });
245
256
  const original =
246
257
  typeof assigned === "string" ? store.getTask(assigned) : null;
@@ -350,7 +361,8 @@ export function createThreadActions({
350
361
  }
351
362
  if (finding.kind === "lease")
352
363
  notices.notify(
353
- `${nameOf(finding.agent)} stopped checking in again on: ${String(task.objective).slice(0, 80)}. Release it from the buddy or your phone, or give it to another agent.`
364
+ `${nameOf(finding.agent)} stopped checking in again on: ${String(task.objective).slice(0, 80)}. Release it from the buddy or your phone, or give it to another agent.`,
365
+ { thread: thread?.id }
354
366
  );
355
367
  if (thread) say(thread, finding.text);
356
368
  // Work posted on its own lives in a room of its own (task-room): it is still loose work, told to its poster too.