tryharness 0.7.73 → 0.7.76

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 (49) hide show
  1. package/assets/pi-extension.ts +7 -1
  2. package/cli.mjs +67 -4
  3. package/lib/actorRoster.mjs +20 -9
  4. package/lib/adoption.mjs +5 -3
  5. package/lib/audit.mjs +7 -2
  6. package/lib/boardFiles.mjs +4 -2
  7. package/lib/boardMirror.mjs +2 -0
  8. package/lib/boardProtocol.json +4 -0
  9. package/lib/bridge.mjs +3 -0
  10. package/lib/capabilityCheck.mjs +39 -3
  11. package/lib/coordinator.mjs +480 -117
  12. package/lib/daemon.mjs +74 -21
  13. package/lib/dispatcher.mjs +568 -0
  14. package/lib/goalCommands.mjs +21 -6
  15. package/lib/handoffs.mjs +8 -7
  16. package/lib/handover.mjs +2 -2
  17. package/lib/inference.mjs +53 -3
  18. package/lib/jobAnswers.mjs +7 -6
  19. package/lib/lessons.mjs +6 -1
  20. package/lib/library.mjs +83 -7
  21. package/lib/lineup.mjs +17 -9
  22. package/lib/localAgentAsk.mjs +68 -29
  23. package/lib/localStack.mjs +19 -3
  24. package/lib/localmodels.mjs +59 -25
  25. package/lib/machineRoutes.mjs +1 -0
  26. package/lib/manager.mjs +97 -52
  27. package/lib/mcp-stdio.mjs +14 -7
  28. package/lib/members.json +5 -1
  29. package/lib/members.mjs +21 -1
  30. package/lib/moves.mjs +15 -2
  31. package/lib/nudge.mjs +5 -0
  32. package/lib/plans.mjs +2 -1
  33. package/lib/projects.mjs +16 -9
  34. package/lib/runAuthority.mjs +2 -1
  35. package/lib/runBrief.mjs +2 -2
  36. package/lib/runWorker.mjs +6 -6
  37. package/lib/snippets.mjs +5 -5
  38. package/lib/store.mjs +79 -10
  39. package/lib/swarm.mjs +56 -12
  40. package/lib/taskCommands.mjs +8 -8
  41. package/lib/taskRooms.mjs +6 -8
  42. package/lib/team.mjs +5 -3
  43. package/lib/threadActions.mjs +6 -30
  44. package/lib/threadAuthority.mjs +16 -3
  45. package/lib/threadRuns.mjs +26 -16
  46. package/lib/verdicts.mjs +2 -2
  47. package/npm-shrinkwrap.json +14 -14
  48. package/package.json +4 -4
  49. package/release.json +50 -49
package/lib/runWorker.mjs CHANGED
@@ -3,7 +3,7 @@ import { stopAgentTask } from "./runner.mjs";
3
3
  import { notifyDesktop } from "./notify.mjs";
4
4
  import { receipt, receiptLine } from "./receipts.mjs";
5
5
  import { readTrail } from "./trails.mjs";
6
- import { nameOf } from "./members.mjs";
6
+ import { DISPATCHER, nameOf } from "./members.mjs";
7
7
  import { sessionFile } from "./live.mjs";
8
8
  import { oneLine } from "./oneLine.mjs";
9
9
 
@@ -129,7 +129,7 @@ export function createRunWorker({
129
129
  store.meta(`wait-note:${task.id}`, "1");
130
130
  store.roomPost({
131
131
  goalId: task.parent_id,
132
- author: "harness",
132
+ author: DISPATCHER,
133
133
  kind: "note",
134
134
  text: why,
135
135
  });
@@ -290,7 +290,7 @@ export function createRunWorker({
290
290
  store.addContribution({
291
291
  taskId: task.id,
292
292
  kind: "note",
293
- author: "harness",
293
+ author: DISPATCHER,
294
294
  text: `Stopped because ${reason}. It starts again where it left off once the Mac can run it.`,
295
295
  source: "lid-closed",
296
296
  });
@@ -329,7 +329,7 @@ export function createRunWorker({
329
329
  if (line)
330
330
  store.roomPost({
331
331
  goalId: task.parent_id,
332
- author: "harness",
332
+ author: DISPATCHER,
333
333
  kind: "note",
334
334
  text: line,
335
335
  });
@@ -399,7 +399,7 @@ export function createRunWorker({
399
399
  store.addContribution({
400
400
  taskId,
401
401
  kind: "receipt",
402
- author: "harness",
402
+ author: DISPATCHER,
403
403
  text: line,
404
404
  source: "receipts",
405
405
  });
@@ -415,7 +415,7 @@ export function createRunWorker({
415
415
  if (forThread && post) {
416
416
  store.roomPost({
417
417
  goalId: task.parent_id,
418
- author: "harness",
418
+ author: DISPATCHER,
419
419
  kind: "note",
420
420
  text: line,
421
421
  });
package/lib/snippets.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
- import { nameOf } from "./members.mjs";
4
+ import { DISPATCHER, nameOf } from "./members.mjs";
5
5
  import { repositoryOf } from "./worktrees.mjs";
6
6
 
7
7
  // Code or a file for an agent that does not run on this computer (Grok Bot, Muse) leaves it only with the person's OK.
@@ -91,7 +91,7 @@ export function createSnippets({
91
91
  save(snippet);
92
92
  store.roomPost({
93
93
  goalId: threadId,
94
- author: "harness",
94
+ author: DISPATCHER,
95
95
  kind: "note",
96
96
  text: `${nameOf(agent)} asks to see lines ${from} to ${to} of ${file.path} ("${words.slice(0, 120)}"). They stay on this computer until you share them.`,
97
97
  });
@@ -170,7 +170,7 @@ export function createSnippets({
170
170
  save(snippet);
171
171
  store.roomPost({
172
172
  goalId: threadId,
173
- author: "harness",
173
+ author: DISPATCHER,
174
174
  kind: "note",
175
175
  text: `${nameOf(agent)} asks to see ${label} from your files ("${words.slice(0, 120)}"). It stays on this computer until you share it.`,
176
176
  });
@@ -222,7 +222,7 @@ export function createSnippets({
222
222
  if (share) {
223
223
  const post = store.roomPost({
224
224
  goalId: snippet.thread,
225
- author: "harness",
225
+ author: DISPATCHER,
226
226
  kind: "post",
227
227
  mentions: [snippet.agent],
228
228
  text: sharedText(snippet),
@@ -231,7 +231,7 @@ export function createSnippets({
231
231
  } else
232
232
  store.roomPost({
233
233
  goalId: snippet.thread,
234
- author: "harness",
234
+ author: DISPATCHER,
235
235
  kind: "note",
236
236
  text: `The person kept ${snippet.label ?? `lines ${snippet.from} to ${snippet.to} of ${snippet.path}`} on this computer.`,
237
237
  });
package/lib/store.mjs CHANGED
@@ -4,7 +4,7 @@ import sqliteWasm from "node-sqlite3-wasm";
4
4
  import { parseSession } from "./parsers.mjs";
5
5
  import { provenanceFor } from "./provenance.mjs";
6
6
  import { BOOK_TABLES } from "./book.mjs";
7
- import { PROPOSERS } from "./members.mjs";
7
+ import { DISPATCHER, PROPOSERS } from "./members.mjs";
8
8
 
9
9
  const SCHEMA_VERSION = 11;
10
10
  const INDEX_FORMAT_VERSION = 2;
@@ -412,6 +412,12 @@ export function openStore(file) {
412
412
  specialty text not null,
413
413
  set_at text not null
414
414
  );
415
+ -- The person's choices for the whole swarm, kept with the board so they follow home (the dispatcher slot).
416
+ create table if not exists board_settings (
417
+ key text primary key,
418
+ value text not null,
419
+ set_at text not null
420
+ );
415
421
  create table if not exists board_pins (
416
422
  specialty text primary key,
417
423
  agent text not null,
@@ -444,6 +450,45 @@ export function openStore(file) {
444
450
  "alter table sessions add column parser_version integer not null default 0"
445
451
  );
446
452
  }
453
+ // Rounds recorded before November 1 named the server's decider "harness"; every one was Jev's (the server has
454
+ // decided rounds with Jev since the coordinator began, October 11), so the record says so.
455
+ db.exec(
456
+ "update swarm_rounds set coordinator = 'jev' where coordinator = 'harness'"
457
+ );
458
+ // Threads facilitated as "harness" are the dispatcher's (owner, November 1: "facilitator is dispatcher", "@harness is
459
+ // just another agent"): the facilitator, and what it posted in their rooms (the coordinator's marked posts and the
460
+ // kinds only a facilitator writes). Harness the agent's own posts and results keep its name.
461
+ db.exec(`
462
+ update board_contributions set author = 'dispatcher'
463
+ where author = 'harness' and source = 'room'
464
+ and task_id in (select goal_id from board_goals where facilitator = 'harness')
465
+ and (
466
+ kind in ('note', 'goal_update', 'answer', 'open_item', 'question', 'check_in')
467
+ or exists (
468
+ select 1 from board_meta where key = 'coordinator-post:' || board_contributions.id
469
+ )
470
+ )
471
+ `);
472
+ db.exec(
473
+ "update board_goals set facilitator = 'dispatcher' where facilitator = 'harness'"
474
+ );
475
+ // Harness was added to every thread's team as its facilitator; it stays on a thread only where it posted or ran.
476
+ for (const { goal_id: goalId, team } of db.all(
477
+ `select goal_id, team from board_goals where team like '%"harness"%'
478
+ and not exists (select 1 from board_contributions c where c.task_id = goal_id and c.author = 'harness')
479
+ and not exists (select 1 from board_tasks t where t.parent_id = goal_id and t.target_agent = 'harness')`
480
+ )) {
481
+ let members = [];
482
+ try {
483
+ members = JSON.parse(team);
484
+ } catch {
485
+ continue;
486
+ }
487
+ db.run("update board_goals set team = ? where goal_id = ?", [
488
+ JSON.stringify(members.filter((agent) => agent !== "harness")),
489
+ goalId,
490
+ ]);
491
+ }
447
492
  // Boards written before the lock existed: give every task a holder and a version.
448
493
  const boardColumns = new Set(
449
494
  db.all("pragma table_info(board_tasks)").map((column) => column.name)
@@ -1139,7 +1184,7 @@ export function openStore(file) {
1139
1184
  this.addContribution({
1140
1185
  taskId: parentId,
1141
1186
  kind: "result",
1142
- author: "harness",
1187
+ author: DISPATCHER,
1143
1188
  text: result,
1144
1189
  source: `group:${status}`,
1145
1190
  });
@@ -1466,6 +1511,30 @@ export function openStore(file) {
1466
1511
  new Date().toISOString()
1467
1512
  );
1468
1513
  },
1514
+ /** A choice of the person's for the whole swarm, as it was set, or null. */
1515
+ boardSetting(key) {
1516
+ const row = execute(
1517
+ "get",
1518
+ "select value from board_settings where key = ?",
1519
+ key
1520
+ );
1521
+ if (!row) return null;
1522
+ try {
1523
+ return JSON.parse(row.value);
1524
+ } catch {
1525
+ return null;
1526
+ }
1527
+ },
1528
+ setBoardSetting(key, value) {
1529
+ execute(
1530
+ "run",
1531
+ `insert into board_settings(key, value, set_at) values(?, ?, ?)
1532
+ on conflict(key) do update set value = excluded.value, set_at = excluded.set_at`,
1533
+ key,
1534
+ JSON.stringify(value),
1535
+ new Date().toISOString()
1536
+ );
1537
+ },
1469
1538
  pins() {
1470
1539
  return execute(
1471
1540
  "all",
@@ -2690,14 +2759,14 @@ export function openStore(file) {
2690
2759
  this.addContribution({
2691
2760
  taskId: id,
2692
2761
  kind: "receipt",
2693
- author: "harness",
2762
+ author: DISPATCHER,
2694
2763
  text,
2695
2764
  source: "route",
2696
2765
  });
2697
2766
  const receipt = this.addContribution({
2698
2767
  taskId: goalId,
2699
2768
  kind: "receipt",
2700
- author: "harness",
2769
+ author: DISPATCHER,
2701
2770
  text,
2702
2771
  source: "room",
2703
2772
  });
@@ -2787,8 +2856,8 @@ export function openStore(file) {
2787
2856
  }));
2788
2857
  },
2789
2858
  /**
2790
- * How the coordinator held up, a day at a time, newest first: rounds Harness decided, rounds a backup on this
2791
- * computer decided after Harness could not, rounds decided here on the privacy setting, and rounds no one decided.
2859
+ * How the coordinator held up, a day at a time, newest first: rounds Jev decided on the server, rounds a backup on
2860
+ * this computer decided after Jev could not, rounds decided here on the privacy setting, and rounds no one decided.
2792
2861
  */
2793
2862
  roundHealth(goalId = null, days = 14) {
2794
2863
  const since = new Date(
@@ -2798,9 +2867,9 @@ export function openStore(file) {
2798
2867
  "all",
2799
2868
  `select substr(at, 1, 10) as day,
2800
2869
  count(*) as rounds,
2801
- sum(case when action is not null and coordinator = 'harness' then 1 else 0 end) as harness,
2802
- sum(case when action is not null and coordinator != 'harness' and error is not null then 1 else 0 end) as backup,
2803
- sum(case when action is not null and coordinator != 'harness' and error is null then 1 else 0 end) as local,
2870
+ sum(case when action is not null and coordinator = 'jev' then 1 else 0 end) as jev,
2871
+ sum(case when action is not null and coordinator != 'jev' and error is not null then 1 else 0 end) as backup,
2872
+ sum(case when action is not null and coordinator != 'jev' and error is null then 1 else 0 end) as local,
2804
2873
  sum(case when action is null then 1 else 0 end) as undecided
2805
2874
  from swarm_rounds where at >= ? and (? is null or goal_id = ?)
2806
2875
  group by day order by day desc`,
@@ -2810,7 +2879,7 @@ export function openStore(file) {
2810
2879
  ).map((row) => ({
2811
2880
  day: row.day,
2812
2881
  rounds: Number(row.rounds),
2813
- harness: Number(row.harness),
2882
+ jev: Number(row.jev),
2814
2883
  backup: Number(row.backup),
2815
2884
  local: Number(row.local),
2816
2885
  undecided: Number(row.undecided),
package/lib/swarm.mjs CHANGED
@@ -5,7 +5,13 @@ import path from "node:path";
5
5
  import { kept } from "./kept.mjs";
6
6
  import { readRunSteps } from "./runner.mjs";
7
7
  import { createSubagents } from "./subagents.mjs";
8
- import { MACHINE_RUNNERS, member, nameOf, resolveMember } from "./members.mjs";
8
+ import {
9
+ DISPATCHER,
10
+ MACHINE_RUNNERS,
11
+ member,
12
+ nameOf,
13
+ resolveMember,
14
+ } from "./members.mjs";
9
15
  import {
10
16
  agentSpecialties,
11
17
  setNote,
@@ -174,6 +180,8 @@ export function createSwarm({
174
180
  provenanceFor,
175
181
  defaults,
176
182
  coordinator,
183
+ // The dispatcher slot (dispatcher.mjs): who words the swarm's rounds, as the person picked.
184
+ dispatcher = null,
177
185
  worktrees,
178
186
  roster,
179
187
  // The coding agents here waiting to join the swarm, with their last check (readiness.mjs), for the person's browser.
@@ -426,15 +434,15 @@ export function createSwarm({
426
434
  pick: coordinator.pick(),
427
435
  choices: coordinator.choices(),
428
436
  rounds: coordinator.state(thread.id).rounds,
429
- // Who decided this thread's rounds: Harness, a backup here after Harness could not, this computer, no one.
437
+ // Who decided this thread's rounds: Jev on the server, a backup here after Jev could not, this computer, no one.
430
438
  decided: store.roundHealth(thread.id, 3650).reduce(
431
439
  (sum, day) => ({
432
- harness: sum.harness + day.harness,
440
+ jev: sum.jev + day.jev,
433
441
  backup: sum.backup + day.backup,
434
442
  local: sum.local + day.local,
435
443
  undecided: sum.undecided + day.undecided,
436
444
  }),
437
- { harness: 0, backup: 0, local: 0, undecided: 0 }
445
+ { jev: 0, backup: 0, local: 0, undecided: 0 }
438
446
  ),
439
447
  },
440
448
  // The goal as the swarm keeps it (goals.mjs): what the person wants, its checks, where it stands, every version.
@@ -520,7 +528,7 @@ export function createSwarm({
520
528
  const askOf = (run) => askOfRun(store, run);
521
529
  const linkThreads = (from, to, agent) => {
522
530
  const note = (goalId, text) =>
523
- store.roomPost({ goalId, author: "harness", kind: "note", text });
531
+ store.roomPost({ goalId, author: DISPATCHER, kind: "note", text });
524
532
  note(
525
533
  from.id,
526
534
  `${nameOf(agent)} started a thread for part of this: ${to.objective}`
@@ -709,9 +717,10 @@ export function createSwarm({
709
717
  const text = String(request.text || "");
710
718
  if (/(^|\s)@swarm\b/.test(text)) return null;
711
719
  const asked = recipient(request);
712
- // Harness counts as a name like any agent: "@claude-code … for @harness" is for both, and is no steer.
720
+ // Harness is a name like any agent's (owner, November 1: "@harness is just another agent"): "@harness …" while it
721
+ // works in a thread steers it there, and "@claude-code … for @harness" is for both, and is no steer.
713
722
  const named = asked ? [asked] : mentionsIn(text, roomAgents);
714
- if (named.length !== 1 || named[0] === "harness") return null;
723
+ if (named.length !== 1) return null;
715
724
  const [agent] = named;
716
725
  const threads = store
717
726
  .goals({ all: false })
@@ -1120,7 +1129,7 @@ export function createSwarm({
1120
1129
  if (!team.size)
1121
1130
  return {
1122
1131
  ok: false,
1123
- error: `name who the thread is for with @, one of: ${roomAgents.filter((name) => name !== agent && name !== "harness").join(", ")}`,
1132
+ error: `name who the thread is for with @, one of: ${roomAgents.filter((name) => name !== agent).join(", ")}`,
1124
1133
  };
1125
1134
  // Where its agents work is settled before the thread exists: a choice that cannot be read starts nothing.
1126
1135
  const target = request.targetMachine ?? null;
@@ -1139,8 +1148,10 @@ export function createSwarm({
1139
1148
  provenance: provenanceFor(agent, null, null, {
1140
1149
  viaServer: request.hostedCaller === true,
1141
1150
  }),
1142
- team: [...team, agent, "harness"],
1143
- facilitator: "harness",
1151
+ // The dispatcher facilitates (owner, November 1: "facilitator is dispatcher"); Harness joins like any agent, when
1152
+ // it is picked or tagged ("@harness is just another agent. stop giving it preferrential treatment").
1153
+ team: [...new Set([...team, agent])],
1154
+ facilitator: DISPATCHER,
1144
1155
  workspace: folder ? path.resolve(folder) : null,
1145
1156
  maxPosts: defaults.maxPosts,
1146
1157
  maxWakes: defaults.maxWakes,
@@ -1375,6 +1386,39 @@ export function createSwarm({
1375
1386
  request.days
1376
1387
  ),
1377
1388
  };
1389
+ // What fills the dispatcher slot (owner, November 1): the relay's LFM3-Omni (the default) or the person's own GGUF,
1390
+ // a Surplus model paid from their Harness account, an agent here on a model it offers, or an endpoint of theirs.
1391
+ // Only the person changes it.
1392
+ if (command === "board.swarm.dispatcher") {
1393
+ if (!dispatcher) return { ok: false, error: "no dispatcher slot here" };
1394
+ if (request.models)
1395
+ return {
1396
+ pending: dispatcher
1397
+ .surplusModels()
1398
+ .then((surplus) => ({ ok: true, surplus })),
1399
+ };
1400
+ if (request.setting === undefined)
1401
+ return { ok: true, ...dispatcher.state() };
1402
+ if (agent !== "user")
1403
+ return { ok: false, error: "only the person picks the dispatcher" };
1404
+ const choose = () => {
1405
+ const set = dispatcher.set(request.setting);
1406
+ return set.ok ? { ok: true, ...dispatcher.state() } : set;
1407
+ };
1408
+ if (request.setting?.provider !== "surplus") return choose();
1409
+ // A Surplus pick is one Harness runs, when its server can say which.
1410
+ return {
1411
+ pending: dispatcher.surplusModels().then((offered) =>
1412
+ offered &&
1413
+ !offered.some((model) => model.id === request.setting.model)
1414
+ ? {
1415
+ ok: false,
1416
+ error: `${request.setting.model} is not a Surplus model Harness runs (tryharness swarm dispatcher models lists them)`,
1417
+ }
1418
+ : choose()
1419
+ ),
1420
+ };
1421
+ }
1378
1422
  // Who coordinates the threads: Harness (the default), or one of the coding agents here the person picks.
1379
1423
  if (command === "board.swarm.coordinator") {
1380
1424
  const choices = coordinator.choices();
@@ -1484,8 +1528,8 @@ export function createSwarm({
1484
1528
  objective,
1485
1529
  originAgent: "user",
1486
1530
  provenance: provenanceFor("user"),
1487
- team: [...new Set([...team, "harness"])],
1488
- facilitator: "harness",
1531
+ team: [...new Set(team)],
1532
+ facilitator: DISPATCHER,
1489
1533
  workspace: where ? path.resolve(where) : null,
1490
1534
  maxPosts: defaults.maxPosts,
1491
1535
  maxWakes: defaults.maxWakes,
@@ -5,11 +5,13 @@ import { readRunSteps, stopAgentTask } from "./runner.mjs";
5
5
  import { provenanceFor } from "./provenance.mjs";
6
6
  import { LOCAL_WAKE_AGENTS } from "./wakes.mjs";
7
7
  import {
8
+ DISPATCHER,
8
9
  TAGGED_ONLY,
9
10
  aboutOf,
10
11
  member,
11
12
  nameOf,
12
13
  resolveMember,
14
+ speaksFromPersonsSide,
13
15
  speaksThroughHarness,
14
16
  } from "./members.mjs";
15
17
  import { LIVE_AGENTS, sessionOfProcess } from "./live.mjs";
@@ -616,18 +618,16 @@ export function createTaskCommands({
616
618
  }
617
619
  }
618
620
  // A job in a goal's room runs on the goal's authority; anywhere else, standing permission decides. The goal covers
619
- // jobs from the person, Harness and the coding agents on this machine, with the person's go (personsGo) unless an
620
- // agent's words came from above the poster; a job from a member that runs elsewhere (Grok Bot, Muse, a connected
621
- // app), or any job that came through Harness's server whatever name it carries, waits for the person's Start. A job
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
623
+ // came from above the poster; a job from a member that runs elsewhere (Grok Bot, Muse, a connected app), or any job
624
+ // that came through Harness's server whatever name it carries, waits for the person's Start. A job
622
625
  // a restricted run or a review posts carries no go: it runs restricted (a review's job as a review) or waits, as
623
626
  // the run that posted it would. Harness's call as a linked window sealed it (phones.mjs fromWindow) is the served
624
627
  // page's word, never a go.
625
628
  const onGoal =
626
629
  agent === "user" ||
627
- (agent === "harness" &&
628
- !request.hostedCaller &&
629
- request.fromWindow !== true) ||
630
- (!noGo && member(agent)?.runs === "machine");
630
+ (!noGo && request.fromWindow !== true && speaksFromPersonsSide(agent));
631
631
  const agentWritten = task.trust !== "user";
632
632
  const limited = limitedCaller(request);
633
633
  if (limited && request[RUN_CALLER].review)
@@ -745,7 +745,7 @@ export function createTaskCommands({
745
745
  else if (!started.started)
746
746
  store.roomPost({
747
747
  goalId: proposed.parent_id,
748
- author: "harness",
748
+ author: DISPATCHER,
749
749
  kind: "note",
750
750
  text: `${nameOf(target)} waits for your Start: ${started.reason}`,
751
751
  });
package/lib/taskRooms.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { offerable } from "./folders.mjs";
3
+ import { DISPATCHER } from "./members.mjs";
3
4
 
4
5
  // What a thread may hold before it pauses: posts, and wakes of any one agent.
5
6
  export const DEFAULT_MAX_POSTS = 500;
@@ -67,7 +68,7 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
67
68
  worktrees.inPlace(room.id);
68
69
  store.roomPost({
69
70
  goalId: room.id,
70
- author: "harness",
71
+ author: DISPATCHER,
71
72
  kind: "note",
72
73
  text: `Now working in ${adopted}.`,
73
74
  });
@@ -94,13 +95,10 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
94
95
  ? roomOfConversation(conversation)
95
96
  : null;
96
97
  if (joined) return join(joined, task, poster, machine);
97
- // The asker is in the room it opened, roster member or not, so it can follow the work it asked for.
98
+ // The asker is in the room it opened, roster member or not, so it can follow the work it asked for. Harness joins
99
+ // like any agent: as the one asked or the one asking.
98
100
  const team = [
99
- ...new Set([
100
- task.target_agent,
101
- ...(poster !== "user" ? [poster] : []),
102
- "harness",
103
- ]),
101
+ ...new Set([task.target_agent, ...(poster !== "user" ? [poster] : [])]),
104
102
  ];
105
103
  const room = store.createGoal({
106
104
  objective: task.objective,
@@ -108,7 +106,7 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
108
106
  originAgent: poster,
109
107
  provenance,
110
108
  team,
111
- facilitator: "harness",
109
+ facilitator: DISPATCHER,
112
110
  workspace: task.run_workspace || folder,
113
111
  maxPosts: DEFAULT_MAX_POSTS,
114
112
  maxWakes: DEFAULT_MAX_WAKES,
package/lib/team.mjs CHANGED
@@ -350,6 +350,7 @@ export function createTeam({ store, log = () => {} }) {
350
350
  const needed = new Set(remaining.flatMap((step) => step.agents));
351
351
  const history = current.history ?? [];
352
352
  const held = new Set(history.flatMap((entry) => entry.agents));
353
+ const facilitator = store.getTask(goalId)?.goal?.facilitator ?? null;
353
354
  for (const run of store.threadRuns(goalId)) {
354
355
  if (run.kind !== "task" || run.status !== "open") continue;
355
356
  if (run.created_at <= current.at || run.created_at >= current.stepAt)
@@ -360,9 +361,10 @@ export function createTeam({ store, log = () => {} }) {
360
361
  );
361
362
  if (!from || needed.has(run.origin_agent) || needed.has(run.target_agent))
362
363
  continue;
363
- // Harness facilitates handoffs even when it holds no route step. An ask
364
- // to an outside specialist is not a redundant route handoff.
365
- if (run.target_agent !== "harness" && !held.has(run.target_agent))
364
+ // The thread's facilitator takes handoffs though it holds no route step.
365
+ // An ask to any other agent outside the route, Harness as much as any
366
+ // outside specialist, is not a redundant route handoff.
367
+ if (run.target_agent !== facilitator && !held.has(run.target_agent))
366
368
  continue;
367
369
  const task = store.getTask(run.id);
368
370
  if (!task?.context_refs.some((ref) => ref.kind === "ask")) continue;
@@ -1,5 +1,5 @@
1
1
  import { picksIn } from "./models.mjs";
2
- import { MEMBERS, nameOf } from "./members.mjs";
2
+ import { DISPATCHER, MEMBERS, nameOf } from "./members.mjs";
3
3
  import { notifyDesktop } from "./notify.mjs";
4
4
 
5
5
  // A name after @ is an id or a one-word alias ("@grok" is Grok Bot); "@claude" is Claude Code.
@@ -70,7 +70,7 @@ export function createThreadActions({
70
70
  });
71
71
  store.roomPost({
72
72
  goalId,
73
- author: "harness",
73
+ author: DISPATCHER,
74
74
  kind: "note",
75
75
  text: `Paused: ${reason}. Resume it from the thread when you want it to go on.`,
76
76
  });
@@ -179,6 +179,8 @@ export function createThreadActions({
179
179
  const told = [];
180
180
  for (const agent of names) {
181
181
  if (agent === author) continue;
182
+ // A post for the dispatcher reaches it through the thread's round (swarm.mjs heardBy), never as an agent's wake.
183
+ if (agent === DISPATCHER) continue;
182
184
  // The person's words go whole; another agent's mention is cut, its post whole in the thread.
183
185
  const said = author === "user" ? post.text : post.text.slice(0, 300);
184
186
  const reason = why
@@ -192,7 +194,7 @@ export function createThreadActions({
192
194
  const computer = address.ok ? address.forAgent(agent) : null;
193
195
  if (!address.ok && runsHere(agent)) refuse(address.error);
194
196
  // An agent the person took out of their swarm (lineup.mjs) is not woken, whatever names it.
195
- else if (agent !== "harness" && !lineup.has(agent))
197
+ else if (!lineup.has(agent))
196
198
  refuse(
197
199
  `it is not in your swarm. Add it with: npx tryharness agents add ${agent}`
198
200
  );
@@ -297,31 +299,6 @@ export function createThreadActions({
297
299
  if (outcome === "none") wakeFromServer(agent, taskId);
298
300
  });
299
301
 
300
- /**
301
- * Work a woken agent never picked up goes to another in its asker's name. The late agent's task is taken back first,
302
- * so a wake that lands later cannot start the same work twice.
303
- */
304
- const moveHandoff = (task, to) => {
305
- const thread = store.getTask(task.parent_id);
306
- if (thread?.kind !== "goal" || thread.status !== "open") return false;
307
- store.removeTask(task.id);
308
- notifyBoard(store.getTask(task.id));
309
- const prefix = `Asked in "${thread.objective}": `;
310
- const words = task.objective.startsWith(prefix)
311
- ? task.objective.slice(prefix.length)
312
- : task.objective;
313
- const asker =
314
- task.origin_agent === to ? thread.goal.facilitator : task.origin_agent;
315
- ask(
316
- thread.id,
317
- to,
318
- `${nameOf(task.target_agent)} didn't pick this up, so it is yours: ${words}`,
319
- asker,
320
- words
321
- );
322
- return true;
323
- };
324
-
325
302
  /**
326
303
  * Work that stopped moving (stuck.mjs) is said once where it belongs: in its thread by the lead, whose coordinator
327
304
  * looks again; loose work is also told to whoever posted it (the person on the desktop, an agent in the work's room
@@ -384,7 +361,7 @@ export function createThreadActions({
384
361
  store.addContribution({
385
362
  taskId: task.id,
386
363
  kind: "note",
387
- author: "harness",
364
+ author: DISPATCHER,
388
365
  text: finding.text,
389
366
  source: "stuck",
390
367
  });
@@ -403,7 +380,6 @@ export function createThreadActions({
403
380
  wakeFor,
404
381
  say,
405
382
  wakeAgain,
406
- moveHandoff,
407
383
  tellStuck,
408
384
  };
409
385
  }
@@ -1,4 +1,10 @@
1
- import { member, nameOf, speaksThroughHarness } from "./members.mjs";
1
+ import {
2
+ DISPATCHER,
3
+ member,
4
+ nameOf,
5
+ speaksFromPersonsSide,
6
+ speaksThroughHarness,
7
+ } from "./members.mjs";
2
8
 
3
9
  /**
4
10
  * Whose go a run in a thread carries. Work a thread starts on its own runs on the thread's authority only when the
@@ -53,6 +59,12 @@ export function createThreadAuthority({
53
59
  const readByGuard = (asker, hosted) =>
54
60
  fromElsewhere(asker) || (hosted && speaksThroughHarness(asker));
55
61
 
62
+ // Whose asks carry the person's go as they are: the person's own agents whose words reached this computer from the
63
+ // person's own computers or device, not through Harness's server. Read the same for every agent (owner, November 1:
64
+ // "@harness is just another agent").
65
+ const fromPersonsSide = (asker, hosted) =>
66
+ !hosted && speaksFromPersonsSide(asker);
67
+
56
68
  /** Whether `asker`'s request for `agent` carries the person's go. `hosted`: the request came through Harness. */
57
69
  // A coding agent here asking from a restricted run or a review carries no go: that run had none to pass on.
58
70
  // `window`: Harness's call as a linked window sealed it (phones.mjs fromWindow). The page that window runs is served
@@ -65,8 +77,9 @@ export function createThreadAuthority({
65
77
  asker === "user" ||
66
78
  (!window &&
67
79
  !readAsOrders(guard) &&
68
- ((asker === "harness" && !hosted && !limited) ||
69
- (!hosted && !limited && member(asker)?.road === "local") ||
80
+ // The dispatcher hands on the person's own work; every agent is read by where its words came from.
81
+ ((asker === DISPATCHER && !hosted && !limited) ||
82
+ (!limited && fromPersonsSide(asker, hosted)) ||
70
83
  (readByGuard(asker, hosted) && guardPasses(guard))) &&
71
84
  !setToWait(agent));
72
85