tryharness 0.7.53 → 0.7.57

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 (167) hide show
  1. package/README.md +23 -19
  2. package/assets/dsh-plugin.mjs +72 -0
  3. package/assets/opencode-plugin.js +4 -3
  4. package/cli.mjs +484 -90
  5. package/lib/activity.mjs +10 -10
  6. package/lib/adapters.mjs +173 -222
  7. package/lib/agentBinaries.mjs +71 -0
  8. package/lib/agentRuntimeConfig.mjs +1 -1
  9. package/lib/agentRuntimes.mjs +34 -18
  10. package/lib/agentSignIn.mjs +456 -0
  11. package/lib/answers.mjs +5 -5
  12. package/lib/archetypes.d.ts +64 -0
  13. package/lib/archetypes.js +989 -0
  14. package/lib/asks.mjs +4 -4
  15. package/lib/audit.mjs +666 -0
  16. package/lib/backupSetup.mjs +143 -0
  17. package/lib/boardAccess.mjs +24 -11
  18. package/lib/boardBackup.mjs +283 -0
  19. package/lib/boardFileCommands.mjs +6 -6
  20. package/lib/boardFiles.mjs +13 -12
  21. package/lib/boardMirror.mjs +124 -25
  22. package/lib/boardProtocol.json +88 -2
  23. package/lib/boardWaits.mjs +101 -0
  24. package/lib/book.mjs +659 -0
  25. package/lib/bridge.mjs +6 -6
  26. package/lib/cards.mjs +138 -28
  27. package/lib/cloudAgents.mjs +216 -0
  28. package/lib/cloudAi.mjs +1312 -0
  29. package/lib/cloudAssistants.mjs +242 -0
  30. package/lib/cloudBoot.mjs +119 -0
  31. package/lib/cloudSave.mjs +197 -0
  32. package/lib/cloudSsh.mjs +178 -0
  33. package/lib/commands.mjs +7 -2
  34. package/lib/context.mjs +19 -5
  35. package/lib/contractGate.mjs +399 -0
  36. package/lib/control-client.mjs +9 -1
  37. package/lib/controlSocket.mjs +86 -0
  38. package/lib/coordinator.mjs +252 -144
  39. package/lib/daemon.mjs +1351 -2767
  40. package/lib/desk.mjs +240 -0
  41. package/lib/desktop.mjs +178 -74
  42. package/lib/directLink.mjs +16 -5
  43. package/lib/environment.mjs +2 -1
  44. package/lib/environments.mjs +247 -9
  45. package/lib/firewall.mjs +9 -9
  46. package/lib/folders.mjs +20 -16
  47. package/lib/frames.mjs +2 -3
  48. package/lib/gitHost.mjs +174 -0
  49. package/lib/goalCommands.mjs +25 -7
  50. package/lib/goals.mjs +7 -7
  51. package/lib/guestRequests.mjs +94 -0
  52. package/lib/handoffs.mjs +8 -7
  53. package/lib/handover.mjs +4 -4
  54. package/lib/harnessModel.mjs +6 -6
  55. package/lib/harnessOffers.mjs +266 -0
  56. package/lib/hookDialects.mjs +298 -0
  57. package/lib/inference.mjs +26 -8
  58. package/lib/jobAnswers.mjs +190 -0
  59. package/lib/landed.mjs +887 -0
  60. package/lib/lane.mjs +42 -11
  61. package/lib/lessons.mjs +16 -16
  62. package/lib/library.mjs +3 -3
  63. package/lib/lineup.mjs +3 -0
  64. package/lib/linkRelay.mjs +574 -0
  65. package/lib/live.mjs +284 -13
  66. package/lib/localAgentAsk.mjs +74 -0
  67. package/lib/localStack.mjs +536 -0
  68. package/lib/localmodels.mjs +6 -4
  69. package/lib/loopBackstop.mjs +4 -4
  70. package/lib/machineIdentity.mjs +9 -1
  71. package/lib/machineRoutes.mjs +181 -2
  72. package/lib/machineRuns.mjs +76 -1
  73. package/lib/machineSeal.mjs +39 -12
  74. package/lib/mcp-stdio.mjs +163 -27
  75. package/lib/mcpRelay.mjs +1 -1
  76. package/lib/members.json +29 -2
  77. package/lib/members.mjs +1 -1
  78. package/lib/models.mjs +85 -31
  79. package/lib/museSession.mjs +21 -13
  80. package/lib/nativeHost.mjs +36 -8
  81. package/lib/neovim.mjs +126 -0
  82. package/lib/network.mjs +50 -5
  83. package/lib/notify.mjs +7 -5
  84. package/lib/nudge.mjs +50 -19
  85. package/lib/ocr.mjs +9 -9
  86. package/lib/onboard.mjs +26 -20
  87. package/lib/oneLine.mjs +7 -7
  88. package/lib/ownMachines.mjs +1223 -140
  89. package/lib/pairing.mjs +60 -16
  90. package/lib/paths.mjs +19 -1
  91. package/lib/peerProcess.mjs +124 -0
  92. package/lib/personModel.mjs +89 -0
  93. package/lib/personNotices.mjs +151 -0
  94. package/lib/phones.mjs +538 -31
  95. package/lib/placeCommands.mjs +4 -4
  96. package/lib/places.mjs +400 -12
  97. package/lib/profile.mjs +67 -14
  98. package/lib/projectGit.mjs +158 -14
  99. package/lib/projectPieces.mjs +902 -0
  100. package/lib/projectSettings.mjs +7 -4
  101. package/lib/projects.mjs +384 -62
  102. package/lib/provenance.mjs +5 -1
  103. package/lib/proxyLinks.mjs +267 -0
  104. package/lib/reactions.mjs +7 -5
  105. package/lib/readiness.mjs +145 -23
  106. package/lib/record.mjs +128 -0
  107. package/lib/redact.mjs +4 -4
  108. package/lib/relayLimits.mjs +62 -0
  109. package/lib/release.mjs +170 -0
  110. package/lib/releaseKeys.json +6 -0
  111. package/lib/repoLinks.mjs +4 -4
  112. package/lib/roomChannels.mjs +24 -0
  113. package/lib/roomPage.mjs +1 -1
  114. package/lib/runAuthority.mjs +101 -0
  115. package/lib/runBrief.mjs +19 -8
  116. package/lib/runWorker.mjs +31 -7
  117. package/lib/runner.mjs +223 -29
  118. package/lib/runtime-install.mjs +143 -9
  119. package/lib/schedules.mjs +2 -2
  120. package/lib/screens.mjs +1 -1
  121. package/lib/sealed.mjs +11 -2
  122. package/lib/sealedThreads.mjs +671 -0
  123. package/lib/secretPatterns.json +1 -1
  124. package/lib/secrets.mjs +4 -4
  125. package/lib/seen.mjs +6 -6
  126. package/lib/serverWords.mjs +175 -0
  127. package/lib/service.mjs +22 -12
  128. package/lib/sessionControl.mjs +378 -90
  129. package/lib/specialties.json +74 -0
  130. package/lib/specialties.mjs +477 -0
  131. package/lib/specialtyKeys.d.ts +3 -0
  132. package/lib/specialtyKeys.js +57 -0
  133. package/lib/specialtyNotice.mjs +147 -0
  134. package/lib/specialtySnapshot.mjs +138 -0
  135. package/lib/speech.mjs +5 -5
  136. package/lib/store.mjs +420 -36
  137. package/lib/stuck.mjs +1 -1
  138. package/lib/swarm.mjs +304 -37
  139. package/lib/swarmDevices.mjs +319 -0
  140. package/lib/swarmMemory.mjs +27 -25
  141. package/lib/t3.mjs +24 -15
  142. package/lib/taskCommands.mjs +80 -20
  143. package/lib/taskRooms.mjs +125 -0
  144. package/lib/taskRuns.mjs +45 -3
  145. package/lib/team.json +255 -148
  146. package/lib/team.mjs +554 -190
  147. package/lib/threadActions.mjs +315 -0
  148. package/lib/threadAuthority.mjs +101 -0
  149. package/lib/threadBriefs.mjs +178 -0
  150. package/lib/threadLine.mjs +116 -0
  151. package/lib/threadRuns.mjs +209 -50
  152. package/lib/threadView.mjs +20 -7
  153. package/lib/usageTotals.mjs +2 -3
  154. package/lib/vault.mjs +101 -10
  155. package/lib/vaultCloud.mjs +2 -2
  156. package/lib/vaultCommands.mjs +15 -6
  157. package/lib/vaultTools.js +2 -2
  158. package/lib/verdicts.mjs +328 -0
  159. package/lib/wakes.mjs +1 -1
  160. package/lib/watches.mjs +2 -2
  161. package/lib/windowAsks.mjs +13 -5
  162. package/lib/worktrees.mjs +157 -25
  163. package/npm-shrinkwrap.json +1093 -0
  164. package/package.json +12 -11
  165. package/release.json +220 -0
  166. package/lib/modelTiers.json +0 -1183
  167. package/lib/modelTiers.mjs +0 -133
package/lib/projects.mjs CHANGED
@@ -4,6 +4,7 @@ import { randomUUID } from "node:crypto";
4
4
  import { nameOf } from "./members.mjs";
5
5
  import { secretReason } from "./secrets.mjs";
6
6
  import { createRoomChannels, agreementHash } from "./roomChannels.mjs";
7
+ import { createPieces, RECORD_KINDS } from "./projectPieces.mjs";
7
8
  import {
8
9
  SETTINGS,
9
10
  SETTING_KEYS,
@@ -24,16 +25,19 @@ import {
24
25
  findCheckout,
25
26
  holds,
26
27
  laneFor,
28
+ laneHead,
27
29
  openPullRequest,
28
30
  pullRequestState,
29
31
  pushLane,
30
32
  removeLane,
33
+ validBranch,
34
+ validRemote,
31
35
  validSha,
32
36
  } from "./projectGit.mjs";
33
37
 
34
- // A project two people's swarms share (owner, October 20). One room both swarms read and write, mirrored on each
35
- // computer; a record both keep (who is building what, what the two people decided, notes, the settings they agreed);
36
- // and a check before any agent starts work, so the two sides never build two systems that later have to be made one.
38
+ // A project two people's swarms share. One room both swarms read and write, mirrored on each computer; a record both
39
+ // keep (who is building what, what the two people decided, notes, the settings they agreed); and a check before any
40
+ // agent starts work, so the two sides never build two systems that later have to be made one.
37
41
  //
38
42
  // Everything crosses sealed, on a thread between the two people (the relay's person thread): an event per post or
39
43
  // record change, each carried until the other computer has it. Harness's server carries ciphertext and never learns
@@ -52,6 +56,8 @@ const OPEN_ONLY = new Set([
52
56
  "board.project.decide",
53
57
  "board.project.note",
54
58
  "board.project.goal",
59
+ "board.project.piece",
60
+ "board.project.release",
55
61
  ]);
56
62
  // Room posts both sides see; notes, held posts and the coordinator's bookkeeping stay on the computer that made them.
57
63
  const SHARED_KINDS = new Set([
@@ -66,6 +72,20 @@ const OPEN_WORK = ["checking", "clear", "overlap", "clash", "unchecked"];
66
72
  const REFRESH_MS = 5 * 60_000;
67
73
  const SUMMARY_CHARS = 600;
68
74
  const PROPOSAL_CHARS = 4_000;
75
+ // What one other person's computer may put in a project on this one (security audit, October 25: nothing bounded it).
76
+ // Past a limit an entry or post is refused, and Harness keeps it for a few tries then sets it aside. The largest honest
77
+ // entry is a work entry naming 200 changed files (about 15,000 characters); a long project with active agents makes a
78
+ // few hundred entries and posts. For owner review.
79
+ const PEER_LIMITS = {
80
+ // Characters of one record entry's body, as JSON.
81
+ entryChars: 32_000,
82
+ // Record entries (work, proposals, answers, notes, settings) one person's side keeps in one project.
83
+ entries: 2_000,
84
+ // Posts from one person into one project's room.
85
+ posts: 2_000,
86
+ // Characters of everything one person sent into one project: entries and posts together.
87
+ totalChars: 20_000_000,
88
+ };
69
89
 
70
90
  const now = () => new Date().toISOString();
71
91
  const json = (value, fallback) => {
@@ -96,17 +116,22 @@ export function createProjects({
96
116
  sendEvent,
97
117
  endChannel = () => {},
98
118
  stopRoom = () => {},
119
+ // Stops one agent's run in a room (a piece released or lost), leaving the rest of the room's work going.
120
+ stopRun = () => {},
99
121
  wake,
100
122
  wakeRun,
101
123
  notifyBoard = () => {},
102
124
  notifyDesktop = () => {},
103
125
  // Harness's judgment of planned work against the record; null when Harness cannot judge now.
104
126
  checkWork = async () => null,
127
+ // The injection guard's reading of another person's words (firewall.mjs), so a run's brief can say they were flagged.
128
+ guard = async () => ({ verdict: "clean", unavailable: true }),
105
129
  knownFolders = () => [],
106
130
  agents = () => [],
107
131
  worktreeRoot,
108
132
  maxPosts = 500,
109
133
  maxWakes = 50,
134
+ verdicts = null,
110
135
  }) {
111
136
  const db = store.db;
112
137
  db.exec(`
@@ -157,6 +182,8 @@ export function createProjects({
157
182
  primary key(channel_id, message_id)
158
183
  );
159
184
  `);
185
+ // Open pieces, claims and handoffs (projectPieces.mjs), made once the record below is.
186
+ let pieces = null;
160
187
  const all = (sql, ...values) =>
161
188
  db.all(sql, values.length ? values : undefined);
162
189
  const run = (sql, ...values) =>
@@ -194,6 +221,7 @@ export function createProjects({
194
221
  hello(opened, true, peer);
195
222
  replay(opened, peer);
196
223
  resend();
224
+ pieces.refresh(opened);
197
225
  notifyBoard(store.getTask(opened.roomId));
198
226
  },
199
227
  onChange: (id, before, after) => {
@@ -374,6 +402,7 @@ export function createProjects({
374
402
  };
375
403
  keep(entry);
376
404
  send(p, { type: "item", item: entry });
405
+ pieces?.changed(project(p.id), item(id));
377
406
  // Every screen open on the room follows a change made here, as it does one from the other side.
378
407
  if (p.roomId) notifyBoard(store.getTask(p.roomId));
379
408
  return item(id);
@@ -453,14 +482,14 @@ export function createProjects({
453
482
  if (handle !== p.me || !who) return String(name);
454
483
  return who === "person" ? "user" : who;
455
484
  };
456
- /** How a name reads to the person: their own agents by name, the other side's as "igor's Codex". */
485
+ /** How a name reads to the person: their own agents by name, the other side's as "maya's Codex". */
457
486
  const display = (p, name) => {
458
487
  const [handle, who] = String(name).split("/");
459
488
  if (!who) return name === "user" ? "You" : nameOf(name);
460
489
  if (handle === p.me) return who === "person" ? "You" : nameOf(who);
461
490
  return who === "person" ? handle : `${handle}'s ${nameOf(who)}`;
462
491
  };
463
- // The other side's agents a post names, by their address: "@igor/codex".
492
+ // The other side's agents a post names, by their address: "@maya/codex".
464
493
  const partnerMentions = (p, text) =>
465
494
  [
466
495
  ...remoteAgents(p).map((entry) => entry.address),
@@ -498,21 +527,63 @@ export function createProjects({
498
527
  yes: answer.body.yes,
499
528
  at: answer.updatedAt,
500
529
  }));
530
+ // The work a fix changes: what it names as changing, else what it is about. Only that work is released by it.
531
+ const changedBy = (body) =>
532
+ (Array.isArray(body.changes) ? body.changes : (body.about ?? [])).map(
533
+ String
534
+ );
535
+ // A fix that changes only pieces of work: the people whose work it changes. Anything else (a decision, a setting, the
536
+ // goal, or a fix naming no work known here) needs everyone in the project.
537
+ const isFix = (body) =>
538
+ body.type === "fix" && !body.decision && !body.goal && !body.key;
539
+ /**
540
+ * Who a proposal needs, worked out on this computer from the record it holds, never taken from the proposal: a
541
+ * proposal from the other side that said it needed only them could otherwise release this person's held work or
542
+ * replace the goal (security audit P1/P10, October 25).
543
+ */
544
+ // `side`: whose record entry the proposal is, as the record holds it (never what the proposal says of itself).
545
+ const needsOf = (p, body, side = null) => {
546
+ // A handoff waits on one person, worked out from the record, never from who the proposal says it needs: past the
547
+ // handoff limit, the person whose agent hands the piece on; a guarded piece offered across, the person whose agent
548
+ // would take it (projectPieces.mjs). Either way that person's own agent's work is what moves.
549
+ if (body.type === "handoff") {
550
+ const offered = body.handoff ? item(body.handoff) : null;
551
+ const decider = offered
552
+ ? offered.projectId === p.id &&
553
+ String(offered.body?.to ?? "").split("/")[0]
554
+ : String(body.from ?? "").split("/")[0];
555
+ if (decider && peopleOf(p).includes(decider)) return [decider];
556
+ }
557
+ // A claim of a guarded piece waits on the person whose swarm would take it: the side that proposed it.
558
+ if (body.type === "claim" && side && peopleOf(p).includes(side))
559
+ return [side];
560
+ if (isFix(body)) {
561
+ const owners = new Set(
562
+ changedBy(body)
563
+ .map((id) => item(id))
564
+ .filter((entry) => entry?.projectId === p.id && entry.kind === "work")
565
+ .map((entry) => entry.side)
566
+ );
567
+ if (owners.size) return [...owners].sort();
568
+ }
569
+ return peopleOf(p);
570
+ };
501
571
  const stateOf = (p, proposal) => {
502
572
  const body = proposal.body;
503
- const sharedDecision =
504
- body.type === "setting" || body.type === "decision" || body.decision;
505
573
  const group = groupOf(p);
506
- const needs = group && sharedDecision ? peopleOf(p) : body.needs;
507
- const implicit = group
508
- ? Object.entries(group.consents ?? {})
509
- .filter(([, consent]) => consent[proposal.id] === agreementHash(body))
510
- .map(([side]) => ({ side, yes: true, at: proposal.at }))
511
- : [];
512
- return proposalState({ ...body, needs, at: proposal.at }, [
513
- ...implicit,
514
- ...answersTo(p, proposal.id),
515
- ]);
574
+ // An agreement the invitation carried counts as agreed by whoever joined with it; a fix to work is never one.
575
+ const implicit =
576
+ group && !isFix(body)
577
+ ? Object.entries(group.consents ?? {})
578
+ .filter(
579
+ ([, consent]) => consent[proposal.id] === agreementHash(body)
580
+ )
581
+ .map(([side]) => ({ side, yes: true, at: proposal.at }))
582
+ : [];
583
+ return proposalState(
584
+ { ...body, needs: needsOf(p, body, proposal.side), at: proposal.at },
585
+ [...implicit, ...answersTo(p, proposal.id)]
586
+ );
516
587
  };
517
588
 
518
589
  // ---- the room ----
@@ -606,7 +677,7 @@ export function createProjects({
606
677
  };
607
678
  const settleKey = (p, agent) => `project-settle:${p.id}:${agent}`;
608
679
  /**
609
- * The other side's words with their names as they read here: their "@codex" is "@igor/codex" on this computer, and
680
+ * The other side's words with their names as they read here: their "@codex" is "@maya/codex" on this computer, and
610
681
  * their "@sig/codex" is this person's own "@codex".
611
682
  */
612
683
  const addressedHere = (p, text) => {
@@ -707,6 +778,34 @@ export function createProjects({
707
778
  .slice(0, 20)
708
779
  .map((entry) => ({ id: String(entry.id) })),
709
780
  });
781
+ // What one person sent into a project so far: their record entries, and their posts as counted when they came.
782
+ const postsIn = (p, peer) =>
783
+ json(store.meta(`project-intake:${p.id}:${peer}`), { posts: 0, chars: 0 });
784
+ const intakeOf = (p, peer) => {
785
+ const entries = all(
786
+ "select count(*) as n, coalesce(sum(length(body)), 0) as chars from project_items where project_id = ? and side = ?",
787
+ p.id,
788
+ peer
789
+ )[0];
790
+ const posts = postsIn(p, peer);
791
+ return {
792
+ entries: Number(entries.n),
793
+ posts: posts.posts,
794
+ chars: Number(entries.chars) + posts.chars,
795
+ };
796
+ };
797
+ const overLimit = (p, peer, { entry = 0, post = 0 }) => {
798
+ const intake = intakeOf(p, peer);
799
+ if (entry > PEER_LIMITS.entryChars)
800
+ return "a record entry larger than a project takes";
801
+ if (entry && intake.entries >= PEER_LIMITS.entries)
802
+ return "more record entries than a project takes from one person";
803
+ if (post && intake.posts >= PEER_LIMITS.posts)
804
+ return "more posts than a project takes from one person";
805
+ if (intake.chars + entry + post > PEER_LIMITS.totalChars)
806
+ return "more than a project takes from one person";
807
+ return null;
808
+ };
710
809
  const receivePost = (p, event) => {
711
810
  if (!String(event.author || "").startsWith(`${p.partner}/`))
712
811
  return {
@@ -720,6 +819,20 @@ export function createProjects({
720
819
  return { ok: true, duplicate: true };
721
820
  const room = roomOf(p);
722
821
  if (!room) return { ok: false, error: "the project has no room here yet" };
822
+ const words = addressedHere(p, String(event.text || "")).slice(0, 20_000);
823
+ const over = overLimit(p, p.partner, { post: words.length || 1 });
824
+ if (over) {
825
+ log(`project ${p.id}: refused ${p.partner}'s post: ${over}`);
826
+ return { ok: false, error: `Refused: ${over}.` };
827
+ }
828
+ const counted = postsIn(p, p.partner);
829
+ store.meta(
830
+ `project-intake:${p.id}:${p.partner}`,
831
+ JSON.stringify({
832
+ posts: counted.posts + 1,
833
+ chars: counted.chars + words.length,
834
+ })
835
+ );
723
836
  const mentions = (Array.isArray(event.mentions) ? event.mentions : [])
724
837
  .map(String)
725
838
  .map((name) => local(p, name));
@@ -727,7 +840,7 @@ export function createProjects({
727
840
  goalId: room.id,
728
841
  author: String(event.author),
729
842
  kind: SHARED_KINDS.has(event.kind) ? event.kind : "post",
730
- text: addressedHere(p, String(event.text || "")).slice(0, 20_000),
843
+ text: words,
731
844
  mentions,
732
845
  });
733
846
  run(
@@ -764,10 +877,20 @@ export function createProjects({
764
877
  const joining = named.filter((agent) => !room.goal.team.includes(agent));
765
878
  if (joining.length)
766
879
  store.setGoalTeam(room.id, [...room.goal.team, ...joining]);
767
- if (named.length && room.status === "open")
768
- wake(room.id, post, String(event.author), named, {
769
- go: settingsOf(p).start || inClash(p, named) || settling.length > 0,
770
- partner: true,
880
+ // Another person's words are read by the guard like any words from outside, before an agent here is told of them;
881
+ // their ask never carries this person's go (the project's gate decides whether it waits for the Start).
882
+ void guard(post.text)
883
+ .catch(() => null)
884
+ .then((reading) => {
885
+ if (reading?.verdict === "flag" || reading?.verdict === "hold")
886
+ store.meta(`flagged:${post.id}`, String(reading.score));
887
+ const fresh = roomOf(p);
888
+ if (named.length && fresh?.status === "open")
889
+ wake(room.id, post, String(event.author), named, {
890
+ go: false,
891
+ partner: true,
892
+ });
893
+ notifyBoard(store.getTask(room.id));
771
894
  });
772
895
  notifyBoard(store.getTask(room.id));
773
896
  return { ok: true };
@@ -778,11 +901,26 @@ export function createProjects({
778
901
  ok: false,
779
902
  error: "a record entry in the other side's name only comes from them",
780
903
  };
781
- if (!["work", "proposal", "answer", "setting", "note"].includes(entry.kind))
904
+ if (
905
+ ![
906
+ "work",
907
+ "proposal",
908
+ "answer",
909
+ "setting",
910
+ "note",
911
+ ...RECORD_KINDS,
912
+ ].includes(entry.kind)
913
+ )
782
914
  return { ok: true };
915
+ // An answer is its side's own entry for one proposal; one under another id could stand in for this person's.
916
+ if (
917
+ entry.kind === "answer" &&
918
+ entry.id !== `${entry.body?.proposal}:${entry.side}`
919
+ )
920
+ return { ok: false, error: "an answer in the wrong place" };
783
921
  const before = settingsOf(p);
922
+ // On every project, shared room or two-person: one side alone only narrows what agents may do.
784
923
  if (
785
- groupOf(p) &&
786
924
  entry.kind === "setting" &&
787
925
  (!validSetting(entry.body?.key, entry.body?.value) ||
788
926
  widens(entry.body.key, before[entry.body.key], entry.body.value))
@@ -791,6 +929,16 @@ export function createProjects({
791
929
  ok: false,
792
930
  error: "Giving agents more reach requires everyone's agreement.",
793
931
  };
932
+ const chars = JSON.stringify(entry.body ?? {}).length;
933
+ const over = item(entry.id)
934
+ ? chars > PEER_LIMITS.entryChars
935
+ ? "a record entry larger than a project takes"
936
+ : null
937
+ : overLimit(p, p.partner, { entry: chars });
938
+ if (over) {
939
+ log(`project ${p.id}: refused ${p.partner}'s entry: ${over}`);
940
+ return { ok: false, error: `Refused: ${over}.` };
941
+ }
794
942
  const previous = item(entry.id);
795
943
  const kept = keep({
796
944
  ...entry,
@@ -803,6 +951,7 @@ export function createProjects({
803
951
  if (entry.kind === "answer") answered(fresh, item(entry.body.proposal));
804
952
  if (entry.kind === "setting") settingChanged(fresh, before);
805
953
  if (entry.kind === "work") workChanged(fresh, item(entry.id), previous);
954
+ pieces.changed(fresh, item(entry.id));
806
955
  if (fresh.roomId) notifyBoard(store.getTask(fresh.roomId));
807
956
  return { ok: true };
808
957
  };
@@ -845,6 +994,7 @@ export function createProjects({
845
994
  if (standing.state === "accepted") accepted(p, proposal);
846
995
  if (standing.state === "declined" && proposal.side === p.me)
847
996
  note(p, `Not agreed: ${oneLine(proposal.body.text, 200)}`);
997
+ if (standing.state === "declined") pieces.declined(p, proposal);
848
998
  };
849
999
  // An agreed proposal takes effect on each computer for what that computer owns: a fix releases this side's work.
850
1000
  const accepted = (p, proposal) => {
@@ -863,9 +1013,10 @@ export function createProjects({
863
1013
  p,
864
1014
  `Decided: ${oneLine(proposal.body.decision || proposal.body.text, 300)}`
865
1015
  );
866
- if (proposal.body.type === "fix")
867
- for (const id of proposal.body.about ?? [])
868
- release(p, item(id), proposal);
1016
+ if (isFix(proposal.body))
1017
+ for (const id of changedBy(proposal.body)) release(p, item(id), proposal);
1018
+ if (["claim", "handoff"].includes(proposal.body.type))
1019
+ pieces.accepted(p, proposal);
869
1020
  };
870
1021
  const settingLine = (key, value) =>
871
1022
  SETTINGS[key].choices
@@ -879,7 +1030,7 @@ export function createProjects({
879
1030
  };
880
1031
  /**
881
1032
  * The people a proposal needs: a change to what both decided, or to a setting, needs both; a fix that reshapes only
882
- * one side's work needs that side's person (owner, October 20: agents settle it first, a person OKs it).
1033
+ * one side's work needs that side's person (agents settle it first, a person OKs it).
883
1034
  */
884
1035
  const needsFor = (p, { decision, changes }) => {
885
1036
  if (decision) return peopleOf(p);
@@ -915,8 +1066,6 @@ export function createProjects({
915
1066
  entry.body.agent === agent &&
916
1067
  OPEN_WORK.includes(entry.body.status)
917
1068
  ) ?? null;
918
- const inClash = (p, names) =>
919
- names.some((agent) => openWork(p, agent)?.body.status === "clash");
920
1069
  const laneOf = (p, work) =>
921
1070
  path.join(worktreeRoot, p.id.slice(0, 8), branchSlug(work.body.branch));
922
1071
  const describe = (p, work) => ({
@@ -1078,15 +1227,19 @@ export function createProjects({
1078
1227
  error: "This agent has not been selected for the shared room.",
1079
1228
  };
1080
1229
  const settings = settingsOf(p);
1081
- // The other side asking: it waits for the person unless they both let agents start such work. Talking out a clash
1082
- // the other side found is read-only, and never waits.
1230
+ // The other side asking: it waits for the person's Start, talking out a clash included (security audit P2, October
1231
+ // 25: a clash post started a review run on its own). Where both people let agents start work the other side asks
1232
+ // for, it goes without the person's go, so only an agent that can run restricted in a copy here starts; the rest
1233
+ // wait. Tier 4 hardens that restricted mode; this is where a partner's run would take it.
1083
1234
  const fromPartner = isPeer(p, asker);
1235
+ // A piece this side's own swarm claimed or accepted carries this side's go (projectPieces.mjs): the decision to take
1236
+ // it was made here, though its words are the other side's, so its run still loads only this person's settings.
1237
+ const needsStart = fromPartner && !settings.start && go !== true;
1084
1238
  if (fromPartner && store.meta(settleKey(p, agent))) {
1085
1239
  store.meta(settleKey(p, agent), "");
1086
- return start("review");
1240
+ return start("review", null, needsStart);
1087
1241
  }
1088
1242
  // Checked like any work, so the person sees whether it clashes before they press Start.
1089
- const needsStart = fromPartner && !settings.start && !go;
1090
1243
  if (needsStart && !store.meta(`project-asked-note:${p.id}:${agent}`)) {
1091
1244
  store.meta(`project-asked-note:${p.id}:${agent}`, "1");
1092
1245
  note(
@@ -1111,7 +1264,7 @@ export function createProjects({
1111
1264
  let current = openWork(p, agent);
1112
1265
  if (current?.body.status === "clash") {
1113
1266
  write(p, "work", { waiting: { reason, asker, go } }, current.id);
1114
- return start("review");
1267
+ return start("review", null, needsStart);
1115
1268
  }
1116
1269
  // The asker's own words when the wake carries them, else the wake's reason without its "… asked you:" lead.
1117
1270
  const summary = String(
@@ -1125,7 +1278,13 @@ export function createProjects({
1125
1278
  // A person's new ask is what the agent builds next: its piece of work takes those words and is checked again; its
1126
1279
  // branch takes the new name while nothing is on it yet. An agent's follow-up goes on with the piece as it is.
1127
1280
  const person = asker === "user" || String(asker).endsWith("/person");
1128
- if (current && person && summary !== current.body.summary)
1281
+ // A claimed piece keeps its own words: a new ask goes on beside it.
1282
+ if (
1283
+ current &&
1284
+ person &&
1285
+ !current.body.piece &&
1286
+ summary !== current.body.summary
1287
+ )
1129
1288
  current = write(
1130
1289
  p,
1131
1290
  "work",
@@ -1200,7 +1359,8 @@ export function createProjects({
1200
1359
  );
1201
1360
  start(
1202
1361
  "review",
1203
- `Your planned work clashes, so it waits. ${result.reason ?? ""} Read the thread, agree with the other agent how the two pieces fit, and propose it (propose, about work ${work.id}). Do not change files until it is agreed.`
1362
+ `Your planned work clashes, so it waits. ${result.reason ?? ""} Read the thread, agree with the other agent how the two pieces fit, and propose it (propose, about work ${work.id}). Do not change files until it is agreed.`,
1363
+ needsStart
1204
1364
  );
1205
1365
  })();
1206
1366
  };
@@ -1222,9 +1382,14 @@ export function createProjects({
1222
1382
  notifyBoard(store.getTask(p.roomId));
1223
1383
  return post;
1224
1384
  };
1225
- // A fix both sides agreed: this side's work held by the clash starts.
1385
+ // A fix both sides agreed: this side's work held by the clash starts, only on this person's own yes here, and with the
1386
+ // go its ask had: work the other side asked for still waits for the Start (or runs restricted where both let it).
1226
1387
  const release = (p, work, proposal) => {
1227
1388
  if (!work || work.side !== p.me || work.body.status !== "clash") return;
1389
+ const mine = answersTo(p, proposal.id).some(
1390
+ (answer) => answer.side === p.me && answer.yes === true
1391
+ );
1392
+ if (!mine) return;
1228
1393
  const waiting = work.body.waiting;
1229
1394
  write(
1230
1395
  p,
@@ -1232,16 +1397,20 @@ export function createProjects({
1232
1397
  { status: "clear", fix: proposal.id, waiting: null },
1233
1398
  work.id
1234
1399
  );
1235
- if (waiting && p.roomId)
1236
- wakeRun(
1237
- p.roomId,
1238
- work.body.agent,
1239
- `The fix is agreed: ${oneLine(proposal.body.text, 400)}. Go ahead with your work in that light.`,
1240
- {
1241
- go: true,
1242
- checked: true,
1243
- }
1244
- );
1400
+ if (!waiting || !p.roomId) return;
1401
+ const asker = String(waiting.asker || "harness");
1402
+ const fromPartner = isPeer(p, asker);
1403
+ wakeRun(
1404
+ p.roomId,
1405
+ work.body.agent,
1406
+ `The fix is agreed: ${oneLine(proposal.body.text, 400)}. Go ahead with your work in that light.`,
1407
+ {
1408
+ go: !fromPartner && waiting.go === true,
1409
+ asker,
1410
+ checked: true,
1411
+ wait: fromPartner && !settingsOf(p).start,
1412
+ }
1413
+ );
1245
1414
  };
1246
1415
  /**
1247
1416
  * The other side's work, new or with a new plan, arrived here. Each side's check sees only what has reached it, so two
@@ -1321,17 +1490,30 @@ export function createProjects({
1321
1490
  const committed = (task) => {
1322
1491
  const p = projectOfRoom(task.parent_id);
1323
1492
  if (!p || !p.folder) return undefined;
1324
- const work = openWork(p, task.target_agent);
1493
+ const work =
1494
+ verdictContext({
1495
+ id: p.id,
1496
+ work: store.getTask(task.id)?.returned?.work,
1497
+ agent: task.target_agent,
1498
+ run: task.id,
1499
+ before: task.claimed_at,
1500
+ })?.work ?? pieces.stoppedWork(p, task.target_agent);
1325
1501
  // A run with no piece of work of its own (a review) worked in the thread's copy, which commits as any thread's does.
1326
1502
  if (!work) return undefined;
1327
1503
  const where = laneOf(p, work);
1504
+ if (
1505
+ !task.run_workspace ||
1506
+ path.resolve(task.run_workspace) !== path.resolve(where)
1507
+ )
1508
+ return undefined;
1328
1509
  const sha = commitLane(
1329
1510
  where,
1330
1511
  `${task.target_agent}: ${oneLine(work.body.summary, 150)}`
1331
1512
  );
1332
- if (!sha) return null;
1513
+ const head = sha ?? laneHead(where);
1514
+ if (!head) return null;
1333
1515
  const files = changedFiles(where, work.body.base);
1334
- write(p, "work", { head: sha, files }, work.id);
1516
+ write(p, "work", { head, files }, work.id);
1335
1517
  if (settingsOf(p).push) void push(p, item(work.id));
1336
1518
  return sha;
1337
1519
  };
@@ -1482,7 +1664,7 @@ export function createProjects({
1482
1664
  .replace(/^@/, "")
1483
1665
  .trim();
1484
1666
  if (!HANDLE.test(handle))
1485
- throw new Error("Write the other person's swarm name, for example igor.");
1667
+ throw new Error("Write the other person's swarm name, for example maya.");
1486
1668
  const anchored = anchorOf(String(folder || ""));
1487
1669
  if (!anchored.ok) throw new Error(anchored.error);
1488
1670
  const me = await myHandle();
@@ -1536,6 +1718,8 @@ export function createProjects({
1536
1718
  const join = async ({ id, folder, clone, selectedAgents }) => {
1537
1719
  const invite = (await listInvites()).find((entry) => entry.id === id);
1538
1720
  if (!invite) throw new Error("That invitation is no longer waiting.");
1721
+ const refused = offerRefusal(invite, await myHandle());
1722
+ if (refused) throw new Error(refused);
1539
1723
  const offer = invite.project;
1540
1724
  const groupId = offer.v === 2 ? offer.id : id;
1541
1725
  let checkout =
@@ -1585,6 +1769,36 @@ export function createProjects({
1585
1769
  return { ok: true, project: view(project(groupId)) };
1586
1770
  };
1587
1771
 
1772
+ /**
1773
+ * Why an invitation can't be taken, or null. It names the person who sent it and the person it is for, as the relay
1774
+ * thread under it does (security audit P3: a v1 offer could claim to come from anyone); its repository is named by
1775
+ * a commit, a branch git reads as a branch, and an address git fetches from (P5: a branch starting with "-" reached
1776
+ * git as an option).
1777
+ */
1778
+ const offerRefusal = (invite, me) => {
1779
+ const offer = invite?.project;
1780
+ if (!offer || typeof offer !== "object")
1781
+ return "That invitation can't be read.";
1782
+ if (offer.v !== 2 && (offer.from !== invite.sender || offer.to !== me))
1783
+ return "That invitation doesn't match who sent it.";
1784
+ if (offer.v === 2) {
1785
+ try {
1786
+ channels.validate(invite, me);
1787
+ } catch (error) {
1788
+ return error.message;
1789
+ }
1790
+ }
1791
+ const repo = offer.repo ?? {};
1792
+ if (
1793
+ repo.first &&
1794
+ (!validSha(repo.first) ||
1795
+ !validBranch(repo.canon) ||
1796
+ (repo.remote && !validRemote(repo.remote)))
1797
+ )
1798
+ return "That invitation's repository isn't named in a way Harness can use safely.";
1799
+ return null;
1800
+ };
1801
+
1588
1802
  /** The person thread under a project opened on this computer: the project is open, and the other side hears so. */
1589
1803
  const channelOpened = (taskId) => {
1590
1804
  if (channels.opened(taskId)) return;
@@ -1629,6 +1843,8 @@ export function createProjects({
1629
1843
  if (p.status === "open") send(p, { type: "left", at: now() });
1630
1844
  save(p.id, { status: "left" });
1631
1845
  store.meta(`project-ended:${p.id}`, "you_left");
1846
+ // As a shared room does on leaving (onChange): what waits or runs in the room for the project stops with it.
1847
+ if (p.roomId) stopRoom(p.roomId);
1632
1848
  endChannel(p.id, "Left the project.");
1633
1849
  note(
1634
1850
  project(p.id),
@@ -1671,7 +1887,7 @@ export function createProjects({
1671
1887
  const proposal = item(proposalId);
1672
1888
  if (!proposal || proposal.projectId !== p.id)
1673
1889
  throw new Error("That proposal isn't here.");
1674
- if (!(proposal.body.needs ?? []).includes(p.me))
1890
+ if (!needsOf(p, proposal.body, proposal.side).includes(p.me))
1675
1891
  throw new Error("That one doesn't need your OK.");
1676
1892
  write(
1677
1893
  p,
@@ -1755,6 +1971,7 @@ export function createProjects({
1755
1971
  p,
1756
1972
  "work",
1757
1973
  {
1974
+ ...(changed ? { returned: null, verdict: null } : {}),
1758
1975
  ...(summary
1759
1976
  ? { summary: String(summary).slice(0, SUMMARY_CHARS) }
1760
1977
  : {}),
@@ -1789,9 +2006,13 @@ export function createProjects({
1789
2006
  const agentPropose = (p, agent, { text, decision, about, changes }) => {
1790
2007
  const body = String(text || "").trim();
1791
2008
  if (!body) throw new Error("say what you propose (text)");
1792
- const named = [
1793
- ...new Set([...(about ?? []), ...(changes ?? [])].map(String)),
1794
- ].filter((id) => item(id)?.projectId === p.id);
2009
+ const known = (ids) =>
2010
+ [...new Set((Array.isArray(ids) ? ids : []).map(String))].filter(
2011
+ (id) => item(id)?.projectId === p.id
2012
+ );
2013
+ const named = known([...(about ?? []), ...(changes ?? [])]);
2014
+ // The work it changes is what it releases once agreed, and whose people it needs: never more than it names.
2015
+ const changing = changes?.length ? known(changes) : named;
1795
2016
  const proposal = propose(
1796
2017
  p,
1797
2018
  {
@@ -1801,9 +2022,11 @@ export function createProjects({
1801
2022
  ? { decision: String(decision).slice(0, PROPOSAL_CHARS) }
1802
2023
  : {}),
1803
2024
  about: named,
2025
+ changes: changing,
2026
+ // Older computers read who it needs from here; this one works it out itself (needsOf).
1804
2027
  needs: needsFor(p, {
1805
2028
  decision: decision || !named.length,
1806
- changes: changes?.length ? changes : named,
2029
+ changes: changing,
1807
2030
  }),
1808
2031
  },
1809
2032
  agent
@@ -1853,6 +2076,7 @@ export function createProjects({
1853
2076
  : null,
1854
2077
  needsDecision: Boolean(work.body.mergeCheck?.decision),
1855
2078
  folder: where,
2079
+ ...verdicts?.view(p, work, where),
1856
2080
  updatedAt: work.updatedAt,
1857
2081
  };
1858
2082
  };
@@ -1958,6 +2182,8 @@ export function createProjects({
1958
2182
  },
1959
2183
  ],
1960
2184
  work,
2185
+ pieces: pieces.view(p),
2186
+ strengths: pieces.strengthsOf(p),
1961
2187
  decisions: decisionsOf(p).map((entry) => ({
1962
2188
  ...entry,
1963
2189
  by: display(p, entry.by),
@@ -2065,6 +2291,7 @@ export function createProjects({
2065
2291
  notes.length
2066
2292
  ? `Project notes:\n${notes.map((entry) => `- ${oneLine(entry.body.text, 300)}`).join("\n")}`
2067
2293
  : "",
2294
+ pieces.brief(p, agent),
2068
2295
  [
2069
2296
  "In this project:",
2070
2297
  "- Before you change code for something new, say what you plan with plan_work (summary, and the files or interfaces it touches). It is checked against the decisions and the other side's work; if it clashes, it waits.",
@@ -2110,7 +2337,9 @@ export function createProjects({
2110
2337
  if (!pr) continue;
2111
2338
  if (
2112
2339
  pr.state !== work.body.pr.state ||
2113
- pr.checks !== work.body.pr.checks
2340
+ pr.checks !== work.body.pr.checks ||
2341
+ JSON.stringify(pr.review) !== JSON.stringify(work.body.pr.review) ||
2342
+ pr.reviewDecision !== work.body.pr.reviewDecision
2114
2343
  )
2115
2344
  write(
2116
2345
  project(p.id),
@@ -2121,6 +2350,7 @@ export function createProjects({
2121
2350
  },
2122
2351
  work.id
2123
2352
  );
2353
+ await verdicts?.detect({ id: p.id, work: work.id });
2124
2354
  if (pr.state === "merged") {
2125
2355
  removeLane(p.folder, laneOf(p, work));
2126
2356
  note(
@@ -2129,6 +2359,11 @@ export function createProjects({
2129
2359
  );
2130
2360
  }
2131
2361
  }
2362
+ for (const work of items(p.id, "work").filter(
2363
+ (entry) => entry.side === p.me
2364
+ ))
2365
+ await verdicts?.detect({ id: p.id, work: work.id });
2366
+ pieces.refresh(project(p.id));
2132
2367
  // A roster that changed (an agent set up here since) goes across.
2133
2368
  const roster = JSON.stringify(ownAgents(p));
2134
2369
  if (store.meta(`project-roster:${p.id}`) !== roster) {
@@ -2143,6 +2378,29 @@ export function createProjects({
2143
2378
  );
2144
2379
  timer.unref?.();
2145
2380
 
2381
+ pieces = createPieces({
2382
+ store,
2383
+ log,
2384
+ project,
2385
+ items,
2386
+ item,
2387
+ write,
2388
+ propose,
2389
+ note,
2390
+ display,
2391
+ shared,
2392
+ local,
2393
+ ownAgents,
2394
+ remoteAgents,
2395
+ peopleOf,
2396
+ wakeRun,
2397
+ stopRun,
2398
+ laneOf,
2399
+ commitLane,
2400
+ changedFiles,
2401
+ branchSlug,
2402
+ });
2403
+
2146
2404
  // ---- the board commands ----
2147
2405
 
2148
2406
  const answeredWith = (promise) => ({
@@ -2184,8 +2442,8 @@ export function createProjects({
2184
2442
  return answeredWith(
2185
2443
  noteAnswers()
2186
2444
  .then(() => channels.sync())
2187
- .then(listInvites)
2188
- .then((invites) => ({
2445
+ .then(async () => [await listInvites(), await myHandle()])
2446
+ .then(([invites, me]) => ({
2189
2447
  projects: projects()
2190
2448
  .filter((p) => p.status !== "joining")
2191
2449
  .map(summaryOf),
@@ -2193,6 +2451,7 @@ export function createProjects({
2193
2451
  .filter(
2194
2452
  (invite) =>
2195
2453
  invite.project.purpose !== "link" &&
2454
+ !offerRefusal(invite, me) &&
2196
2455
  (!project(
2197
2456
  invite.project.v === 2 ? invite.project.id : invite.id
2198
2457
  ) ||
@@ -2212,6 +2471,8 @@ export function createProjects({
2212
2471
  )?.status === "joining",
2213
2472
  title: invite.project.title,
2214
2473
  from: invite.project.from,
2474
+ // The sender's computer's key, to compare with them before joining (pinned only on joining).
2475
+ fingerprint: invite.fingerprint ?? null,
2215
2476
  kind: invite.project.repo?.first ? "project" : "room",
2216
2477
  people: invite.project.members,
2217
2478
  history: invite.project.history,
@@ -2289,6 +2550,8 @@ export function createProjects({
2289
2550
  : `This waits until ${p.partner} joins.`,
2290
2551
  };
2291
2552
  try {
2553
+ const piece = pieces.command(p, name, request, "user");
2554
+ if (piece) return piece;
2292
2555
  switch (name) {
2293
2556
  case "board.project.retry":
2294
2557
  return answeredWith(
@@ -2337,10 +2600,19 @@ export function createProjects({
2337
2600
  case "board.project.agents": {
2338
2601
  channels.setAgents(p.id, request.agents);
2339
2602
  hello(p);
2603
+ pieces.refresh(project(p.id));
2340
2604
  return { ok: true, project: view(project(p.id)) };
2341
2605
  }
2342
2606
  case "board.project.read":
2343
- return { ok: true, project: view(p) };
2607
+ return answeredWith(
2608
+ (async () => {
2609
+ for (const work of items(p.id, "work").filter(
2610
+ (entry) => entry.side === p.me
2611
+ ))
2612
+ await verdicts?.detect({ id: p.id, work: work.id });
2613
+ return { project: view(project(p.id)) };
2614
+ })()
2615
+ );
2344
2616
  case "board.project.answer":
2345
2617
  return answer(
2346
2618
  p,
@@ -2445,10 +2717,51 @@ export function createProjects({
2445
2717
  } catch (error) {
2446
2718
  return { ok: false, error: error.message };
2447
2719
  }
2720
+ try {
2721
+ const piece = pieces.command(p, name, request, agent);
2722
+ if (piece) return piece;
2723
+ } catch (error) {
2724
+ return { ok: false, error: error.message };
2725
+ }
2448
2726
  return { ok: false, error: `unknown command ${name}` };
2449
2727
  };
2450
2728
 
2729
+ // The verdict module crosses this seam to read a local piece and publish its state through the existing sealed event.
2730
+ const verdictContext = ({
2731
+ id,
2732
+ work: workId,
2733
+ agent,
2734
+ run: runId,
2735
+ before = null,
2736
+ }) => {
2737
+ const p = projectFor({ id });
2738
+ if (!p) return null;
2739
+ const candidates = items(p.id, "work").filter(
2740
+ (entry) =>
2741
+ entry.side === p.me &&
2742
+ entry.body.agent === agent &&
2743
+ (!before || entry.at <= before)
2744
+ );
2745
+ const judged = runId
2746
+ ? candidates.findLast((entry) => entry.body.returned?.run === runId)
2747
+ : null;
2748
+ const work = workId
2749
+ ? item(workId)
2750
+ : (judged ??
2751
+ candidates.findLast((entry) =>
2752
+ [...OPEN_WORK, "review"].includes(entry.body.status)
2753
+ ));
2754
+ if (!work || work.kind !== "work" || work.projectId !== p.id) return null;
2755
+ return {
2756
+ project: p,
2757
+ work,
2758
+ where: p.repo.first && work.side === p.me ? laneOf(p, work) : null,
2759
+ update: (fields) => write(project(p.id), "work", fields, work.id),
2760
+ };
2761
+ };
2762
+
2451
2763
  return {
2764
+ verdictContext,
2452
2765
  command,
2453
2766
  receive,
2454
2767
  delivered,
@@ -2527,12 +2840,21 @@ export function createProjects({
2527
2840
  isChannel: (threadId) =>
2528
2841
  Boolean(project(threadId) || channels.knowsChannel(threadId)),
2529
2842
  // A post from the other side: its own swarm sorts it; this side's coordinator does not take a round on it.
2843
+ /** The person blocked a handle: every project with them ends with them here (security audit P9). */
2844
+ blocked: (handle) => {
2845
+ for (const p of projects()) {
2846
+ if (p.status === "left" || p.status === "declined") continue;
2847
+ if (groupOf(p)) channels.block(p.id, handle);
2848
+ else if (p.partner === handle) leave(p);
2849
+ }
2850
+ },
2530
2851
  fromPartner: (goalId, post) => {
2531
2852
  const p = projectOfRoom(goalId);
2532
2853
  return Boolean(p) && isPeer(p, post.author);
2533
2854
  },
2534
2855
  stop: () => {
2535
2856
  clearInterval(timer);
2857
+ pieces.stop();
2536
2858
  channels.stop();
2537
2859
  },
2538
2860
  };