tryharness 0.7.45 → 0.7.54

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 (125) hide show
  1. package/README.md +239 -14
  2. package/assets/dsh-plugin.mjs +72 -0
  3. package/assets/opencode-plugin.js +4 -3
  4. package/cli.mjs +497 -196
  5. package/lib/actorRoster.mjs +28 -5
  6. package/lib/adapters.mjs +165 -222
  7. package/lib/agentRuntimeConfig.mjs +36 -0
  8. package/lib/agentRuntimes.mjs +570 -0
  9. package/lib/agentSignIn.mjs +226 -0
  10. package/lib/atlas.mjs +7 -2
  11. package/lib/audit.mjs +643 -0
  12. package/lib/backupSetup.mjs +141 -0
  13. package/lib/boardAccess.mjs +8 -1
  14. package/lib/boardBackup.mjs +283 -0
  15. package/lib/boardCommands.mjs +5 -10
  16. package/lib/boardFileCommands.mjs +2 -1
  17. package/lib/boardMirror.mjs +523 -0
  18. package/lib/boardProtocol.json +263 -6
  19. package/lib/boardTools.mjs +2 -6
  20. package/lib/boardWaits.mjs +102 -0
  21. package/lib/book.mjs +659 -0
  22. package/lib/bridge.mjs +26 -4
  23. package/lib/browserWake.mjs +60 -0
  24. package/lib/cards.mjs +159 -16
  25. package/lib/cloudBoot.mjs +124 -0
  26. package/lib/commands.mjs +25 -5
  27. package/lib/connectionTools.d.ts +13 -0
  28. package/lib/connectionTools.js +45 -0
  29. package/lib/connectorAuth.mjs +309 -0
  30. package/lib/connectorCatalog.json +41 -0
  31. package/lib/connectorCommands.mjs +121 -0
  32. package/lib/connectorGoogle.mjs +513 -0
  33. package/lib/connectors.mjs +805 -0
  34. package/lib/context.mjs +18 -4
  35. package/lib/contractGate.mjs +377 -0
  36. package/lib/coordinator.mjs +152 -39
  37. package/lib/coreModels.mjs +78 -0
  38. package/lib/daemon.mjs +973 -54
  39. package/lib/desk.mjs +239 -0
  40. package/lib/desktop.mjs +113 -8
  41. package/lib/digest.mjs +32 -0
  42. package/lib/directLink.mjs +283 -0
  43. package/lib/environments.mjs +825 -0
  44. package/lib/folders.mjs +4 -4
  45. package/lib/gitHost.mjs +174 -0
  46. package/lib/goalCommands.mjs +58 -14
  47. package/lib/hookDialects.mjs +298 -0
  48. package/lib/inference.mjs +263 -152
  49. package/lib/landed.mjs +887 -0
  50. package/lib/lessons.mjs +6 -0
  51. package/lib/lineup.mjs +324 -0
  52. package/lib/live.mjs +284 -13
  53. package/lib/localmodels.mjs +10 -0
  54. package/lib/machineIdentity.mjs +3 -0
  55. package/lib/machineRoutes.mjs +40 -2
  56. package/lib/machineRuns.mjs +30 -3
  57. package/lib/machineSeal.mjs +69 -10
  58. package/lib/mcp-stdio.mjs +189 -120
  59. package/lib/mcpRelay.mjs +119 -0
  60. package/lib/members.json +26 -0
  61. package/lib/members.mjs +33 -0
  62. package/lib/modelMemory.mjs +100 -0
  63. package/lib/models.mjs +48 -15
  64. package/lib/museSession.mjs +122 -0
  65. package/lib/nativeHost.mjs +203 -0
  66. package/lib/neovim.mjs +126 -0
  67. package/lib/network.mjs +7 -2
  68. package/lib/nudge.mjs +57 -18
  69. package/lib/onboard.mjs +430 -1
  70. package/lib/oneclawLocal.mjs +150 -0
  71. package/lib/ownMachines.mjs +828 -39
  72. package/lib/pairing.mjs +182 -0
  73. package/lib/paths.mjs +8 -0
  74. package/lib/personModel.mjs +89 -0
  75. package/lib/phones.mjs +119 -3
  76. package/lib/placeCommands.mjs +27 -0
  77. package/lib/places.mjs +337 -9
  78. package/lib/plans.mjs +151 -27
  79. package/lib/profile.mjs +152 -0
  80. package/lib/projects.mjs +624 -137
  81. package/lib/readiness.mjs +400 -0
  82. package/lib/record.mjs +115 -0
  83. package/lib/repoLinks.mjs +354 -0
  84. package/lib/roomChannels.mjs +641 -0
  85. package/lib/runBrief.mjs +32 -2
  86. package/lib/runRequests.mjs +157 -0
  87. package/lib/runWorker.mjs +37 -9
  88. package/lib/runner.mjs +74 -11
  89. package/lib/secretPatterns.json +55 -0
  90. package/lib/secrets.mjs +10 -27
  91. package/lib/seen.mjs +102 -0
  92. package/lib/service.mjs +11 -6
  93. package/lib/sessionControl.mjs +386 -96
  94. package/lib/sessionIndex.mjs +5 -3
  95. package/lib/specialties.json +74 -0
  96. package/lib/specialties.mjs +477 -0
  97. package/lib/specialtyKeys.d.ts +3 -0
  98. package/lib/specialtyKeys.js +58 -0
  99. package/lib/specialtyNotice.mjs +147 -0
  100. package/lib/specialtySnapshot.mjs +138 -0
  101. package/lib/store.mjs +829 -29
  102. package/lib/subagents.mjs +8 -4
  103. package/lib/swarm.mjs +483 -37
  104. package/lib/swarmMemory.mjs +947 -0
  105. package/lib/t3.mjs +56 -17
  106. package/lib/taskCommands.mjs +91 -13
  107. package/lib/taskRuns.mjs +68 -11
  108. package/lib/team.json +253 -144
  109. package/lib/team.mjs +538 -147
  110. package/lib/threadLine.mjs +116 -0
  111. package/lib/threadRuns.mjs +78 -12
  112. package/lib/threadView.mjs +66 -16
  113. package/lib/tokenizer.mjs +405 -0
  114. package/lib/ui.mjs +16 -2
  115. package/lib/usageTotals.mjs +148 -0
  116. package/lib/vault.mjs +1144 -0
  117. package/lib/vaultCloud.mjs +117 -0
  118. package/lib/vaultCommands.mjs +201 -0
  119. package/lib/vaultTools.d.ts +12 -0
  120. package/lib/vaultTools.js +42 -0
  121. package/lib/windowAsks.mjs +42 -0
  122. package/lib/workFocus.mjs +59 -0
  123. package/lib/workLinks.mjs +90 -0
  124. package/lib/worktrees.mjs +51 -13
  125. package/package.json +10 -5
@@ -0,0 +1,116 @@
1
+ import { askLocal } from "./personModel.mjs";
2
+
3
+ // The line that puts the person back into a thread at a glance (owner, October 23: "what was the last thing I said
4
+ // here", and titles are "incredibly lossy"): their last move, in their own words, and what it was about.
5
+ // "go ahead and deploy" → "deploy DeepSeek support".
6
+ //
7
+ // Most of what a person last says in a thread answers the agent ("yes", "commit this"), and agents end by asking them
8
+ // to decide something. So agents name it in a last line, `Deciding: deploy DeepSeek support` (mcp-stdio.mjs's
9
+ // instructions), and a short reply right after one is about that. A longer message is a new ask or a steer: the
10
+ // person's own local model names its work, when they have one (personModel.mjs). With neither, the thread's title says
11
+ // what it is about. Worked out once per message and kept, never while the person waits.
12
+
13
+ /** A reply this short answers what the agent asked rather than saying something new. */
14
+ const SHORT_WORDS = 8;
15
+ /** What is kept of a move or what it was about. */
16
+ const MOVE_CHARS = 60;
17
+ const ABOUT_CHARS = 80;
18
+
19
+ const NAME_WORK = `You label a message a person sent to an AI agent, so that weeks later they recognize the thread at a glance.
20
+ Reply with JSON only: {"move": "...", "object": "..."}.
21
+ - move: 1 to 3 words for what the person asked for, in their own word when they used one (look into, fix, build, write, remake, deep dive). A question: "asked".
22
+ - object: 2 to 6 words naming the work: the feature, bug, decision or document. Never mechanics: no file counts, "the change", "this", "it".
23
+ Lowercase except names. No sentences. Think briefly.`;
24
+
25
+ const tidy = (text) =>
26
+ String(text ?? "")
27
+ .replace(/\s+/g, " ")
28
+ .trim();
29
+ const words = (text) => tidy(text).split(" ").filter(Boolean);
30
+ const cut = (text, limit) => {
31
+ const clean = tidy(text);
32
+ if (clean.length <= limit) return clean;
33
+ const end = clean.lastIndexOf(" ", limit - 1);
34
+ return `${clean.slice(0, end > limit / 2 ? end : limit - 1)}…`;
35
+ };
36
+
37
+ /** What an agent's message asks the person to decide: its last `Deciding:` line, or null. */
38
+ export function decidingOf(text) {
39
+ const lines = String(text ?? "").split("\n");
40
+ for (let i = lines.length - 1; i >= 0; i--) {
41
+ const said = /^\s*[*_]*deciding:[*_]*\s*(.+?)\s*$/i.exec(lines[i]);
42
+ if (!said) continue;
43
+ const named = said[1].replace(/^[`*_"]+|[`*_".]+$/g, "").trim();
44
+ return named ? cut(named, ABOUT_CHARS) : null;
45
+ }
46
+ return null;
47
+ }
48
+
49
+ /**
50
+ * `store` keeps each thread's line by the message it was made from. `nameWork(message)`, when given, names a longer
51
+ * message's work ({ move, object } or null); by default the person's local model does.
52
+ */
53
+ export function createThreadLine({
54
+ store,
55
+ log = () => {},
56
+ nameWork = (message) => askLocal(NAME_WORK, message),
57
+ }) {
58
+ const kept = (key) => {
59
+ try {
60
+ return JSON.parse(store.meta(`thread-line:${key}`) || "null");
61
+ } catch {
62
+ return null;
63
+ }
64
+ };
65
+ // One label at a time: the local model runs on the person's computer.
66
+ let queue = Promise.resolve();
67
+
68
+ async function lineOf({ title, mine, answered }) {
69
+ const at = mine.at ?? null;
70
+ if (words(mine.text).length <= SHORT_WORDS) {
71
+ const asked = decidingOf(answered);
72
+ return {
73
+ move: cut(mine.text, MOVE_CHARS),
74
+ about: asked ?? cut(title, ABOUT_CHARS),
75
+ by: asked ? "agent" : "title",
76
+ at,
77
+ };
78
+ }
79
+ const named = await nameWork(cut(mine.text, 1500)).catch(() => null);
80
+ if (named?.move && named?.object)
81
+ return {
82
+ move: cut(named.move, MOVE_CHARS),
83
+ about: cut(named.object, ABOUT_CHARS),
84
+ by: "model",
85
+ at,
86
+ };
87
+ return {
88
+ move: `${words(mine.text).slice(0, 4).join(" ")}…`,
89
+ about: cut(title, ABOUT_CHARS),
90
+ by: "title",
91
+ at,
92
+ };
93
+ }
94
+
95
+ return {
96
+ /** The thread's line, as last worked out, or null. */
97
+ of: (key) => kept(key)?.line ?? null,
98
+ /**
99
+ * Works out the thread's line from the person's last message (`mine`: id, text, at) and the agent's message before
100
+ * it (`answered`, its text), unless it was already made from that message. Resolves to whether it changed.
101
+ */
102
+ update(key, { title, mine, answered = null }) {
103
+ const next = queue.then(async () => {
104
+ if (kept(key)?.message === mine.id) return false;
105
+ const line = await lineOf({ title, mine, answered });
106
+ store.meta(
107
+ `thread-line:${key}`,
108
+ JSON.stringify({ message: mine.id, line })
109
+ );
110
+ return true;
111
+ });
112
+ queue = next.catch((error) => log(`thread line: ${error.message}`));
113
+ return next.catch(() => false);
114
+ },
115
+ };
116
+ }
@@ -6,6 +6,8 @@ import { oneLine } from "./oneLine.mjs";
6
6
  import { setRunPick } from "./models.mjs";
7
7
  import { t3Access, startT3SignIn, steerT3Run } from "./t3.mjs";
8
8
  import { t3Model, t3Open, t3Project, t3Provider } from "./places.mjs";
9
+ import { within } from "./folders.mjs";
10
+ import { namedFiles } from "./worktrees.mjs";
9
11
 
10
12
  // The agents with a read-only switch (runner.mjs): only they talk out a clash in a shared project without waiting.
11
13
  const REVIEWERS = new Set(
@@ -31,6 +33,8 @@ export function createThreadRuns({
31
33
  placeElsewhere = () => null,
32
34
  // Projects shared with another person's swarm (projects.mjs): their check before work, and each agent's own branch.
33
35
  projects = () => null,
36
+ // The step of the thread's route an agent was last given (team.mjs), or null.
37
+ stepHeld = () => null,
34
38
  }) {
35
39
  const { RUNNERS } = authority;
36
40
  const inT3 = (thread, agent, review) => {
@@ -68,18 +72,32 @@ export function createThreadRuns({
68
72
  ? { in: "t3", why: null }
69
73
  : { in: "here", why: gap };
70
74
  };
71
- // A task's own run (its room's first job) goes where its room's turns go: into T3 Code when the person uses the agent
72
- // there. Not when it would run restricted (work another agent asked for on a goal's authority): only this computer
73
- // holds a run to that.
75
+ // Whether a task works in its thread's folder: the thread's repository, or Harness's copy of it where the agent that
76
+ // handed the work on was running.
77
+ const inThreadFolder = (task, room) => {
78
+ const folder = path.resolve(task.run_workspace);
79
+ const copy = worktrees.get(room.id)?.path;
80
+ return (
81
+ within(folder, room.goal.workspace) ||
82
+ Boolean(copy && within(folder, copy))
83
+ );
84
+ };
85
+ // A task's run goes where its room's turns go: into T3 Code when the person uses the agent there. That is the room's
86
+ // first job, and work an agent handed on into a thread in that thread's folder, a turn of the agent there like any
87
+ // other (owner, October 23: it opens where the person uses that agent most). Not when it would run restricted (work
88
+ // another agent asked for on a goal's authority): only this computer holds a run to that. Nor in a shared project,
89
+ // whose agents work on their own branches here.
74
90
  const taskInT3 = (task, agent) => {
75
91
  const room = task.parent_id ? store.getTask(task.parent_id) : null;
76
92
  if (
77
93
  task.kind !== "task" ||
78
94
  room?.kind !== "goal" ||
79
- store.meta(`task-room:${room.id}`) !== task.id ||
80
- !task.run_workspace
95
+ !task.run_workspace ||
96
+ projects()?.isProjectRoom(room.id)
81
97
  )
82
98
  return false;
99
+ const ownJob = store.meta(`task-room:${room.id}`) === task.id;
100
+ if (!ownJob && !inThreadFolder(task, room)) return false;
83
101
  const restricted =
84
102
  task.trust !== "user" &&
85
103
  task.run_authorized_by === "goal" &&
@@ -341,7 +359,7 @@ export function createThreadRuns({
341
359
  if (!t3 && !elsewhere)
342
360
  try {
343
361
  folder =
344
- (shared && !review ? shared.folderFor(task, agent) : null) ??
362
+ (shared ? shared.folderFor(task, agent, { review }) : null) ??
345
363
  worktrees.folderFor(task);
346
364
  } catch (error) {
347
365
  store.roomPost({
@@ -438,7 +456,7 @@ export function createThreadRuns({
438
456
  const key = `overlap:${[goalId, other.id].sort().join(":")}:${shared.join(",")}`;
439
457
  if (!shared.length || store.meta(key)) continue;
440
458
  store.meta(key, "1");
441
- const named = `${shared.slice(0, 5).join(", ")}${shared.length > 5 ? ` and ${shared.length - 5} more` : ""}`;
459
+ const named = namedFiles(shared);
442
460
  for (const [here, there] of [
443
461
  [goalId, other],
444
462
  [other.id, store.getTask(goalId)],
@@ -453,16 +471,61 @@ export function createThreadRuns({
453
471
  }
454
472
  }
455
473
  };
456
- // The turn's changes are committed in its thread's copy as soon as it ends, before another run can start there.
457
- // A shared project's agent commits on its own branch (projects.mjs); it is undefined for any other thread.
458
- const commitWake = (task) => {
474
+ // A run that may change its thread's copy: every turn woken there, and work handed on as a task into that copy. A
475
+ // review runs read-only (runner.mjs) beside whoever writes there, so what it would commit is never its own.
476
+ const inThreadCopy = (task) => {
477
+ const thread = task.parent_id ? store.getTask(task.parent_id) : null;
478
+ if (thread?.kind !== "goal" || !task.run_workspace) return false;
479
+ if (store.meta(`review:${task.id}`) === "1") return false;
480
+ if (task.kind === "wake") return true;
481
+ const copy = worktrees.get(thread.id)?.path;
482
+ return Boolean(copy && within(path.resolve(task.run_workspace), copy));
483
+ };
484
+ const startTurn = (task) => {
485
+ if (inThreadCopy(task)) worktrees.startTurn(task.parent_id, task.id);
486
+ };
487
+ // For code, made means committed on the thread's branch: a run's changes in its thread's copy are committed as soon
488
+ // as it ends, whatever kind of run it was, before another run can start there. A shared project's agent commits on
489
+ // its own branch (projects.mjs, undefined for any other thread).
490
+ const commitRun = (task) => {
491
+ if (!inThreadCopy(task)) return null;
459
492
  const onBranch = projects()?.committed(task);
460
493
  if (onBranch !== undefined) return onBranch;
461
- return worktrees.commitTurn(
494
+ const sha = worktrees.commitTurn(
462
495
  task.parent_id,
463
496
  task.id,
464
497
  `${task.target_agent}: ${task.objective.replace(/^Room: /, "")}`
465
498
  );
499
+ noteUncommitted(task);
500
+ return sha;
501
+ };
502
+ // What git would not commit (a hook refused it, say) stays in the copy. After a make run it is a fact: the thread's,
503
+ // for the next check's brief (team.mjs) until the branch is clean again, and the run's, for the audit (audit.mjs),
504
+ // with a note naming the agent and the files. A check or a frame does not make the change.
505
+ const noteUncommitted = (task) => {
506
+ const goalId = task.parent_id;
507
+ const files = worktrees.uncommitted(goalId);
508
+ if (!files.length) {
509
+ if (store.meta(`uncommitted:${goalId}`))
510
+ store.meta(`uncommitted:${goalId}`, "");
511
+ return;
512
+ }
513
+ const agent = task.target_agent;
514
+ const step = store.getTask(task.id)?.step ?? stepHeld(goalId, agent);
515
+ const makes = !step || step === "make";
516
+ if (!makes) return;
517
+ store.meta(
518
+ `uncommitted:${goalId}`,
519
+ JSON.stringify({ agent, files, run: task.id })
520
+ );
521
+ store.meta(`uncommitted:${task.id}`, JSON.stringify({ files }));
522
+ store.roomPost({
523
+ goalId,
524
+ author: "harness",
525
+ kind: "note",
526
+ text: `${nameOf(agent)}'s change is not committed on this thread's branch, so it is not made yet: ${namedFiles(files)} ${files.length === 1 ? "is" : "are"} still uncommitted in the thread's copy.`,
527
+ });
528
+ notifyBoard(store.getTask(goalId));
466
529
  };
467
530
  const settleWake = (task, kind, text, startedAt) => {
468
531
  const goalId = task.parent_id;
@@ -484,6 +547,8 @@ export function createThreadRuns({
484
547
  author: task.target_agent,
485
548
  kind: kind === "done" ? "post" : "failed",
486
549
  text: kind === "done" ? text : `run failed: ${text}`,
550
+ // The computer the turn ran on (runWorker.mjs claims it there).
551
+ machine: store.getTask(task.id)?.claimed_machine ?? null,
487
552
  });
488
553
  const key = `${goalId}:${task.target_agent}`;
489
554
  const pending = pendingWakes.get(key);
@@ -542,7 +607,8 @@ export function createThreadRuns({
542
607
  recover,
543
608
  where: runsIn,
544
609
  worker: {
545
- commitWake,
610
+ startTurn,
611
+ commitRun,
546
612
  settleWake,
547
613
  wakeBrief,
548
614
  ranOutsideT3,
@@ -1,4 +1,5 @@
1
1
  import { nameOf } from "./members.mjs";
2
+ import { onMachine, withComputer } from "./machineRoutes.mjs";
2
3
 
3
4
  // A thread as the person reads it, worked out once here so the buddy, the phone, the PiP, the dashboard and the
4
5
  // notices all say the same thing: its title, its state in one word, one line on where it stands, what needs the
@@ -72,6 +73,9 @@ function headlineOf(text) {
72
73
  return shorten(sentence ?? line, 160);
73
74
  }
74
75
 
76
+ // An allowed task the browser has not taken by then is the person's again: Allow once more, or open Harness.
77
+ const BROWSER_START_MS = 2 * 60_000;
78
+
75
79
  export function createThreadView({
76
80
  store,
77
81
  goals = null,
@@ -79,7 +83,24 @@ export function createThreadView({
79
83
  now = Date.now,
80
84
  // What a shared project's room waits on the person for (projects.mjs needsOf): an OK, a post to share.
81
85
  projectNeeds = () => [],
86
+ nativeNeeds = () => [],
87
+ // A run's agent asking for one of the person's secrets (vault.mjs).
88
+ vaultNeeds = () => [],
89
+ // The name of the computer an agent wrote from, once the person has more than one (ownMachines.mjs shownLabel).
90
+ computerOf = () => null,
91
+ // Whether the person's browser is listening for this computer (browserWake.mjs), so Harness can use it now.
92
+ browserListening = () => false,
93
+ // Where the person left the thread: their last move and what it was about (threadLine.mjs).
94
+ whereLeft = () => null,
95
+ // What waits on the person about an agent rather than a thread (kind "agent", specialtyNotice.mjs): an agent not
96
+ // living up to a specialty. Each opens the agent in the Swarm map.
97
+ agentNeeds = () => [],
82
98
  }) {
99
+ // Words from an agent on the person's computers say which one: the buddy reads it "Codex (linux)".
100
+ const writtenOn = (post) => {
101
+ const { computer } = withComputer(post, computerOf);
102
+ return computer ? { computer } : {};
103
+ };
83
104
  const coordinated = (post) =>
84
105
  Boolean(store.meta(`coordinator-post:${post.id}`));
85
106
  const filing = (threadId) => {
@@ -133,6 +154,8 @@ export function createThreadView({
133
154
  function needsYouOf(thread, posts, runs) {
134
155
  const items = [];
135
156
  for (const run of runs) {
157
+ items.push(...nativeNeeds(run.id));
158
+ items.push(...vaultNeeds(run.id));
136
159
  if (run.status === "needs_input" && run.holder === "user")
137
160
  items.push({
138
161
  id: `answer:${run.id}`,
@@ -201,21 +224,35 @@ export function createThreadView({
201
224
  at: thread.updated_at,
202
225
  });
203
226
  // What Harness's server left for the browser waits on the person opening their Harness window (October 18: one
204
- // such part waited 9 hours with nothing saying so).
205
- for (const run of runs)
227
+ // such part waited 9 hours with nothing saying so), or on their Allow when their browser listens for this computer
228
+ // (October 22: "right away, even if away"). Once allowed it waits on no one, unless the browser has not taken it.
229
+ for (const run of runs) {
206
230
  if (
207
- run.target_agent === "harness" &&
208
- run.status === "open" &&
209
- store.meta(`harness-window:${run.id}`)
231
+ run.target_agent !== "harness" ||
232
+ run.status !== "open" ||
233
+ !store.meta(`harness-window:${run.id}`)
210
234
  )
211
- items.push({
212
- id: `window:${run.id}`,
213
- kind: "window",
214
- agent: "harness",
215
- text: "Harness needs your browser to finish this: open Harness on your computer.",
216
- runId: run.id,
217
- at: run.updated_at,
218
- });
235
+ continue;
236
+ const allowedAt = Date.parse(
237
+ store.meta(`harness-browser-allowed:${run.id}`) || ""
238
+ );
239
+ if (now() - allowedAt < BROWSER_START_MS) continue;
240
+ const stopped = store.meta(`harness-browser-stopped:${run.id}`);
241
+ const canAllow = !stopped && browserListening();
242
+ items.push({
243
+ id: `window:${run.id}`,
244
+ kind: "window",
245
+ agent: "harness",
246
+ text: stopped
247
+ ? `Harness stopped in your browser to ask you: ${stopped}. Open Harness on your computer to answer.`
248
+ : canAllow
249
+ ? "Harness needs your browser to finish this. Allow it, and Harness carries on in your browser now."
250
+ : "Harness needs your browser to finish this: open Harness on your computer.",
251
+ runId: run.id,
252
+ ...(canAllow ? { browser: "can-allow" } : {}),
253
+ at: run.updated_at,
254
+ });
255
+ }
219
256
  for (const held of store.heldPosts(thread.id))
220
257
  if (!store.meta(`held-replaced:${held.id}`))
221
258
  items.push({
@@ -276,7 +313,9 @@ export function createThreadView({
276
313
  : thread.goal.paused_reason || "Stopped";
277
314
  const last = lastWords(posts);
278
315
  if (!last) return "Nothing yet";
279
- const who = last.author === "user" ? "You" : whoIs(last.author);
316
+ const { computer } = writtenOn(last);
317
+ const who =
318
+ last.author === "user" ? "You" : onMachine(whoIs(last.author), computer);
280
319
  return `${who}: ${shorten(withoutMentions(firstLine(last.text)), 140)}`;
281
320
  }
282
321
 
@@ -291,6 +330,7 @@ export function createThreadView({
291
330
  if (item.kind === "review") return "Ready for your review";
292
331
  if (item.kind === "held") return item.text;
293
332
  if (item.kind === "window") return "Harness needs your browser to finish";
333
+ if (item.kind === "agent") return item.text;
294
334
  return `${who} needs you to decide: ${shorten(item.text, 120)}`;
295
335
  }
296
336
 
@@ -316,6 +356,7 @@ export function createThreadView({
316
356
  late: state === "working" && Boolean(lateHandoff(runs)),
317
357
  needsYou: items,
318
358
  done: doneOf(thread, state, posts),
359
+ you: whereLeft(thread.id),
319
360
  };
320
361
  }
321
362
 
@@ -360,6 +401,7 @@ export function createThreadView({
360
401
  type: "file",
361
402
  seq: post.seq,
362
403
  author: post.author,
404
+ ...writtenOn(post),
363
405
  file: post.file,
364
406
  at: post.created_at,
365
407
  };
@@ -377,6 +419,7 @@ export function createThreadView({
377
419
  type: "message",
378
420
  seq: post.seq,
379
421
  author: post.author,
422
+ ...writtenOn(post),
380
423
  text: post.text,
381
424
  result: false,
382
425
  asks: false,
@@ -397,6 +440,7 @@ export function createThreadView({
397
440
  type: "message",
398
441
  seq: post.seq,
399
442
  author: post.author,
443
+ ...writtenOn(post),
400
444
  text: post.text,
401
445
  result: post.kind === "result" || post.kind === "answer",
402
446
  asks: post.kind === "question",
@@ -448,8 +492,14 @@ export function createThreadView({
448
492
  const items = needsYouOf(thread, posts, store.threadRuns(thread.id));
449
493
  const title = titleOf(thread, posts);
450
494
  return items.map((item) => ({ ...item, threadId: thread.id, title }));
451
- });
495
+ })
496
+ .concat(swarmNeeds().map((item) => ({ ...item, threadId: null })));
497
+ }
498
+
499
+ /** What waits on the person outside any thread, newest last: the same items on every surface. */
500
+ function swarmNeeds() {
501
+ return agentNeeds();
452
502
  }
453
503
 
454
- return { row, timeline, file, waiting, itemLine };
504
+ return { row, timeline, file, waiting, itemLine, swarmNeeds };
455
505
  }