tryharness 0.7.77 → 0.7.81

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.
@@ -49,8 +49,20 @@ export function createThreadRuns({
49
49
  stopRun = () => false,
50
50
  // A folder-less thread's files ({ name, path }), put in its scratch folder when a turn starts here (scratch.mjs).
51
51
  threadFiles = () => [],
52
+ // A turn the thread's computer cannot take goes back to Jev (daemon.mjs).
53
+ unplaced = () => {},
54
+ // A turn waiting for its computer, which is back: whether that computer can do the work, checked before it starts
55
+ // (coordinator.mjs checkWaiting).
56
+ checkBeforeStart = async () => true,
52
57
  }) {
53
58
  const { RUNNERS } = authority;
59
+ const folderAway = (goalId) => {
60
+ try {
61
+ return JSON.parse(store.meta(`thread-folder-on:${goalId}`) || "null");
62
+ } catch {
63
+ return null;
64
+ }
65
+ };
54
66
  const computerOf = (goalId) => {
55
67
  const held = store.meta(`thread-work-computer:${goalId}`);
56
68
  if (held) return held;
@@ -213,13 +225,121 @@ export function createThreadRuns({
213
225
  store.meta("pending-wake:" + key, "");
214
226
  },
215
227
  };
228
+ // The computer a run is on, by id: the one that took it, else the one it waits for, else this one.
229
+ const computerOfRun = (run) =>
230
+ run.claimed_machine ?? run.target_machine ?? computers?.self() ?? null;
231
+ // An agent's turns in a thread: one for each computer the person named (a lane), and one for words that named none.
232
+ const laneKey = (goalId, agent, lane = null) =>
233
+ lane ? `${goalId}:${agent}@${lane}` : `${goalId}:${agent}`;
234
+ const OPEN_WAKE = new Set(["open", "claimed", "running"]);
235
+ const openWakesOf = (goalId, agent) =>
236
+ store
237
+ .threadRuns(goalId)
238
+ .filter(
239
+ (run) =>
240
+ run.kind === "wake" &&
241
+ run.target_agent === agent &&
242
+ OPEN_WAKE.has(run.status)
243
+ );
244
+ // The agent's open turn in a lane: on that computer, else any.
245
+ const openWakeIn = (goalId, agent, lane = null) =>
246
+ lane
247
+ ? (openWakesOf(goalId, agent).find((run) => computerOfRun(run) === lane)
248
+ ?.id ?? null)
249
+ : store.openWake(goalId, agent);
250
+ // Every lane words for the agent may wait in: none, and each computer a turn of its here was placed on.
251
+ const laneKeys = (goalId, agent) => [
252
+ laneKey(goalId, agent),
253
+ ...new Set(
254
+ store
255
+ .threadRuns(goalId)
256
+ .filter((run) => run.target_agent === agent)
257
+ .map((run) => store.meta(`lane:${run.id}`))
258
+ .filter(Boolean)
259
+ .map((lane) => laneKey(goalId, agent, lane))
260
+ ),
261
+ ];
262
+ // Turns waiting for the computer the person named to come back: { goalId, agent, reason, options, at }, kept on the
263
+ // board so a restart keeps them.
264
+ const COMPUTER_WAITS = "computer-waits";
265
+ const computerWaits = () => {
266
+ try {
267
+ const kept = JSON.parse(store.meta(COMPUTER_WAITS) || "[]");
268
+ return Array.isArray(kept) ? kept : [];
269
+ } catch {
270
+ return [];
271
+ }
272
+ };
273
+ const awaitComputer = (goalId, agent, reason, options) =>
274
+ store.meta(
275
+ COMPUTER_WAITS,
276
+ JSON.stringify([
277
+ ...computerWaits().filter(
278
+ (each) => !(each.goalId === goalId && each.agent === agent)
279
+ ),
280
+ { goalId, agent, reason, options, at: new Date().toISOString() },
281
+ ])
282
+ );
283
+ /**
284
+ * The computer holding the thread's checkout (or the route's) cannot take this agent's turn: the thread says why
285
+ * once, and the work goes back to Jev, which passes over this agent in the thread for a while and picks again (owner,
286
+ * November 2: an agent's ask that named no computer used to end at "Its work stays there", with nothing run).
287
+ */
288
+ const notPlaced = (goalId, agent, key, why) => {
289
+ if (!store.meta(key)) {
290
+ store.meta(key, "1");
291
+ store.roomPost({
292
+ goalId,
293
+ author: DISPATCHER,
294
+ kind: "note",
295
+ text: `${why} Jev picks again.`,
296
+ });
297
+ }
298
+ unplaced(goalId, agent);
299
+ notifyBoard(store.getTask(goalId));
300
+ };
301
+ /** Whether an agent's turn in the thread waits for its computer to come back. */
302
+ const waitsForComputer = (goalId) =>
303
+ computerWaits().some((each) => each.goalId === goalId);
304
+ const dropWait = (goalId, agent) =>
305
+ store.meta(
306
+ COMPUTER_WAITS,
307
+ JSON.stringify(
308
+ computerWaits().filter(
309
+ (each) => !(each.goalId === goalId && each.agent === agent)
310
+ )
311
+ )
312
+ );
313
+ // Waiting turns whose computer is being checked now: one change while a check runs does not start a second.
314
+ const checking = new Set();
315
+ /**
316
+ * One of the person's computers came back or said which folders it has: each turn waiting for one is checked there
317
+ * first (the coordinator's capability check kept for it, `checkBeforeStart`), then placed again, and waits again if
318
+ * its computer still cannot take it. A "no" ends the wait: the coordinator has sent the work back to Jev. A thread no
319
+ * longer open drops its waiting turns. The turn stays in the list while it is checked, so the thread still waits.
320
+ */
321
+ const computersChanged = () => {
322
+ for (const each of computerWaits()) {
323
+ const key = `${each.goalId}:${each.agent}`;
324
+ if (checking.has(key)) continue;
325
+ checking.add(key);
326
+ const open = store.getTask(each.goalId)?.status === "open";
327
+ void Promise.resolve(open && checkBeforeStart(each.goalId, each.agent))
328
+ .catch(() => true)
329
+ .then((go) => {
330
+ dropWait(each.goalId, each.agent);
331
+ checking.delete(key);
332
+ if (go) wakeAgent(each.goalId, each.agent, each.reason, each.options);
333
+ });
334
+ }
335
+ };
216
336
  // Another person's agent or the person themselves, by their address ("igor/codex"); the person's own agents are named
217
337
  // without one. A turn such an ask brings runs on this person's own agent settings only (runWorker.mjs).
218
338
  const fromAnotherPerson = (asker) => String(asker ?? "").includes("/");
219
339
  // `only`: one agent's waiting turns, as when its piece of a shared project is released.
220
340
  const discard = (goalId, only = null) => {
221
341
  for (const agent of only ? [only] : RUNNERS)
222
- pendingWakes.delete(goalId + ":" + agent);
342
+ for (const key of laneKeys(goalId, agent)) pendingWakes.delete(key);
223
343
  };
224
344
  // go: the person's go for this turn (personsGo), their own post naming this agent or one of their agents here asking;
225
345
  // any other wake is work another agent asked for and runs restricted or waits.
@@ -232,11 +352,17 @@ export function createThreadRuns({
232
352
  // where it is and the wake kept for the words goes on from there, in the same session. Without their go it reads
233
353
  // them when its turn ends. The thread says which happened; the note is also what the steer's caller is told.
234
354
  const steers = new Map();
235
- const steerRunning = (goalId, agent, words, pending) => {
355
+ // `key`: the lane the words wait in (laneKey). Words naming a computer steer only the turn on it.
356
+ const steerRunning = (goalId, agent, words, pending, key) => {
236
357
  // The agent's turn that does the work, before a read-only review of its own beside it.
237
358
  const running = store
238
359
  .threadRuns(goalId)
239
- .filter((run) => run.target_agent === agent && run.status === "running")
360
+ .filter(
361
+ (run) =>
362
+ run.target_agent === agent &&
363
+ run.status === "running" &&
364
+ (!pending.on || computerOfRun(run) === pending.on)
365
+ )
240
366
  .sort(
241
367
  (a, b) =>
242
368
  Number(store.meta(`review:${a.id}`) === "1") -
@@ -251,16 +377,16 @@ export function createThreadRuns({
251
377
  };
252
378
  const told =
253
379
  store.meta(`t3-run:${running.id}`) === "1"
254
- ? steerT3(goalId, agent, words, pending, running).then(note)
380
+ ? steerT3(goalId, agent, words, pending, running, key).then(note)
255
381
  : Promise.resolve(note(stopToSteer(running, pending, who)));
256
382
  // Kept only until the call that sent the words reads it, which it does as it sends them (board.swarm.steer).
257
- const key = `${goalId}:${agent}`;
258
- steers.set(key, told);
383
+ const toldKey = `${goalId}:${agent}`;
384
+ steers.set(toldKey, told);
259
385
  void told.then(() => {
260
- if (steers.get(key) === told) steers.delete(key);
386
+ if (steers.get(toldKey) === told) steers.delete(toldKey);
261
387
  });
262
388
  };
263
- const steerT3 = async (goalId, agent, words, pending, running) => {
389
+ const steerT3 = async (goalId, agent, words, pending, running, key) => {
264
390
  const who = nameOf(agent);
265
391
  const thread = store.getTask(goalId);
266
392
  const delivery = await steerT3Run(
@@ -269,8 +395,7 @@ export function createThreadRuns({
269
395
  );
270
396
  if (!delivery)
271
397
  return `${who} reads your message when its current turn ends.`;
272
- if (pendingWakes.get(`${goalId}:${agent}`)?.id === pending.id)
273
- pendingWakes.delete(`${goalId}:${agent}`);
398
+ if (pendingWakes.get(key)?.id === pending.id) pendingWakes.delete(key);
274
399
  return delivery === "restarted"
275
400
  ? `${who} restarted its turn to take your message.`
276
401
  : `${who} has your message and reads it at its next step.`;
@@ -316,10 +441,10 @@ export function createThreadRuns({
316
441
  // The person's go reaches a turn another agent's ask left waiting for their Start, so it starts now rather than
317
442
  // after a turn that would never come (Grok Bot's mention once held Claude Code in the person's own folder, and
318
443
  // their @claude-code queued behind it). The pending call stays, so the turn's brief carries the person's words.
319
- const startHeldWake = (goalId, agent) => {
320
- const wake = store.getTask(store.openWake(goalId, agent));
444
+ const startHeldWake = (goalId, agent, lane = null) => {
445
+ const wake = store.getTask(openWakeIn(goalId, agent, lane));
321
446
  if (wake?.status !== "open" || wake.run_authorized_at) return;
322
- const pending = pendingWakes.get(`${goalId}:${agent}`);
447
+ const pending = pendingWakes.get(laneKey(goalId, agent, lane));
323
448
  const answer = Boolean(pending?.answer);
324
449
  const directlyAsked = pending?.asker === "user" && pending.go;
325
450
  if (!directlyAsked && !threadMayRun(store.getTask(goalId), { answer }))
@@ -345,11 +470,8 @@ export function createThreadRuns({
345
470
  }
346
471
  return false;
347
472
  };
348
- const wakeAgent = (
349
- goalId,
350
- agent,
351
- reason,
352
- {
473
+ const wakeAgent = (goalId, agent, reason, options = {}) => {
474
+ const {
353
475
  review = false,
354
476
  go = false,
355
477
  asker = DISPATCHER,
@@ -373,8 +495,7 @@ export function createThreadRuns({
373
495
  // agents elsewhere (runAuthority.mjs PROPOSERS): in a thread another agent wrote, its turn may start on the
374
496
  // agent's standing permission (admitProposal). Never the person's go.
375
497
  proposal = null,
376
- } = {}
377
- ) => {
498
+ } = options;
378
499
  const task = store.getTask(goalId);
379
500
  if (!task || task.status !== "open" || !RUNNERS.has(agent)) return;
380
501
  const proposed =
@@ -443,25 +564,41 @@ export function createThreadRuns({
443
564
  task.goal?.workspace ?? null,
444
565
  routed
445
566
  );
446
- if (!tried || tried.error) {
567
+ const label =
568
+ computers?.labelOf(routed) ?? "the computer holding this checkout";
569
+ // Away for now: the checkout is there, so the turn waits for it, as for a computer the person named.
570
+ if (tried?.waits) {
571
+ awaitComputer(goalId, agent, reason, options);
447
572
  noteOnce(
573
+ `computer-wait:${goalId}:${agent}:${routed}`,
574
+ `${nameOf(agent)} waits for ${label} (${tried.error}) and starts there once it can.`
575
+ );
576
+ return;
577
+ }
578
+ if (!tried || tried.error) {
579
+ notPlaced(
580
+ goalId,
581
+ agent,
448
582
  `route-computer-refused:${goalId}:${agent}:${routed}:${tried?.error}`,
449
- `${nameOf(agent)} cannot continue on ${computers?.labelOf(routed) ?? "the routed computer"}: ${tried?.error ?? "computer is unavailable"}. Its work stays there.`
583
+ `${nameOf(agent)} cannot work on ${label}: ${tried?.error ?? "the computer is unavailable"}.`
450
584
  );
451
585
  return;
452
586
  }
453
587
  routePlacement = tried;
454
588
  }
455
589
  if (routed && routed === self && !installedAgents.includes(agent)) {
456
- noteOnce(
590
+ notPlaced(
591
+ goalId,
592
+ agent,
457
593
  `route-computer-missing:${goalId}:${agent}:${routed}`,
458
- `${nameOf(agent)} is not installed on the computer holding this thread's checkout. Its work stays there.`
594
+ `${nameOf(agent)} is not installed on the computer holding this thread's checkout.`
459
595
  );
460
596
  return;
461
597
  }
462
598
  // Why the named computer cannot take this turn, or null when it can: { machine, folder } goes in `placed`.
463
599
  let placed = null,
464
- refused = null;
600
+ refused = null,
601
+ waits = false;
465
602
  if (named && named === self && !installedAgents.includes(agent))
466
603
  refused = `${nameOf(agent)} is not installed there`;
467
604
  else if (named && named !== self) {
@@ -472,6 +609,18 @@ export function createThreadRuns({
472
609
  );
473
610
  if (tried.error) refused = tried.error;
474
611
  else placed = tried;
612
+ waits = Boolean(tried.waits);
613
+ }
614
+ // Named for this turn and only away for now: the turn waits for that computer and starts there once it is back
615
+ // (A1 run, November 2: "#Sigalas-MBP-2" while it slept paused the thread, and the work never started when it woke).
616
+ if (refused && on && waits) {
617
+ const label = computers.labelOf(named) ?? "that computer";
618
+ awaitComputer(goalId, agent, reason, options);
619
+ noteOnce(
620
+ `computer-wait:${goalId}:${agent}:${named}`,
621
+ `${nameOf(agent)} waits for ${label} (${refused}) and starts there once it can.`
622
+ );
623
+ return;
475
624
  }
476
625
  if (refused) {
477
626
  const label = computers.labelOf(named) ?? "that computer";
@@ -495,27 +644,51 @@ export function createThreadRuns({
495
644
  : null);
496
645
  if (!installedAgents.includes(agent) && !elsewhere) return;
497
646
  const goal = task.goal;
498
- // A thread with no folder works in its own scratch folder on whichever computer takes the turn (scratch.mjs).
499
- const scratch = !goal.workspace;
500
- // A turn waiting for its Start on another computer than the one chosen now is taken back and placed again, so the
501
- // choice is not folded into a turn that would run elsewhere (a hosted agent's thread queued Claude Code on Home
502
- // before its ask named pop-os). One already started or let start keeps going; the call waits for it, still pinned.
503
- const waiting =
504
- on && chosen ? store.getTask(store.openWake(goalId, agent)) : null;
505
- if (
506
- waiting &&
507
- (waiting.target_machine ?? self) !== named &&
508
- waiting.status === "open" &&
509
- !waiting.claimed_by &&
510
- !waiting.run_authorized_at
511
- ) {
512
- store.removeTask(waiting.id);
513
- notifyBoard(store.getTask(waiting.id));
647
+ // A thread whose folder is on another computer (swarm.mjs setFolderAway) works there in it.
648
+ const away = folderAway(goalId);
649
+ const awayFolder =
650
+ away && elsewhere?.machine === away.machine ? away.path : null;
651
+ // A thread with no folder works in its own scratch folder on whichever computer takes the turn (scratch.mjs), as
652
+ // does a turn on a computer with no copy of the thread's folder.
653
+ const scratch =
654
+ !awayFolder &&
655
+ (!goal.workspace || Boolean(elsewhere && !elsewhere.folder));
656
+ if (scratch && (goal.workspace || away)) {
657
+ const where = elsewhere?.machine ?? computers?.self() ?? "here";
658
+ const label = computers?.labelOf(where) ?? "this computer";
659
+ noteOnce(
660
+ `scratch-fallback:${goalId}:${agent}:${where}`,
661
+ goal.workspace
662
+ ? `${nameOf(agent)} works on ${label} in a scratch folder: ${label} has no copy of ${goal.workspace}.`
663
+ : `${nameOf(agent)} works on ${label} in a scratch folder: the thread's folder is on ${computers?.labelOf(away.machine) ?? "another computer"}.`
664
+ );
514
665
  }
515
- if (store.openWake(goalId, agent)) {
666
+ // The computer the person named for this call is its lane: the agent's turn there, beside its turns on other
667
+ // computers, never folded into one of them (a "#pop-os" message once stopped Claude Code's video edit on the Mac,
668
+ // then waited for it to end, November 2).
669
+ const lane = on && chosen ? named : null;
670
+ // A turn waiting for its Start on another computer than the one chosen now, for a call that named none, is taken back
671
+ // and placed again, so the choice is not folded into a turn that would run elsewhere (a hosted agent's thread queued
672
+ // Claude Code on Home before its ask named pop-os). One already started or let start keeps going in its own lane, as
673
+ // does one the person placed on its computer.
674
+ if (lane)
675
+ for (const waiting of openWakesOf(goalId, agent))
676
+ if (
677
+ computerOfRun(waiting) !== lane &&
678
+ !store.meta(`lane:${waiting.id}`) &&
679
+ waiting.status === "open" &&
680
+ !waiting.claimed_by &&
681
+ !waiting.run_authorized_at
682
+ ) {
683
+ store.removeTask(waiting.id);
684
+ notifyBoard(store.getTask(waiting.id));
685
+ }
686
+ const openHere = openWakeIn(goalId, agent, lane);
687
+ if (openHere) {
688
+ const key = laneKey(goalId, agent, lane);
516
689
  if (fromAnotherPerson(asker))
517
- store.meta(`other-person-run:${store.openWake(goalId, agent)}`, "1");
518
- const prior = pendingWakes.get(`${goalId}:${agent}`);
690
+ store.meta(`other-person-run:${openHere}`, "1");
691
+ const prior = pendingWakes.get(key);
519
692
  // Words the guard read as orders keep the next turn waiting for the person, whatever go an earlier call carried;
520
693
  // the person's own call is their go.
521
694
  const flagged = asker === "user" ? null : (held ?? prior?.held ?? null);
@@ -535,11 +708,11 @@ export function createThreadRuns({
535
708
  on: on ?? prior?.on ?? null,
536
709
  at: new Date().toISOString(),
537
710
  };
538
- pendingWakes.set(`${goalId}:${agent}`, pending);
539
- if (pending.go) startHeldWake(goalId, agent);
711
+ pendingWakes.set(key, pending);
712
+ if (pending.go) startHeldWake(goalId, agent, lane);
540
713
  // An ask again for a turn already waiting: the same turn, admitted once at most, and never past words the guard
541
714
  // read as orders before.
542
- const waiting = store.getTask(store.openWake(goalId, agent));
715
+ const waiting = store.getTask(openHere);
543
716
  if (
544
717
  proposed &&
545
718
  !flagged &&
@@ -550,7 +723,7 @@ export function createThreadRuns({
550
723
  )
551
724
  notifyBoard(store.getTask(waiting.id));
552
725
  if (asker === "user" && words)
553
- steerRunning(goalId, agent, words, pending);
726
+ steerRunning(goalId, agent, words, pending, key);
554
727
  return;
555
728
  }
556
729
  // The limit guards against agents waking each other in a loop, so it counts from the thread's last check-in: a thread
@@ -607,7 +780,7 @@ export function createThreadRuns({
607
780
  text: `${nameOf(agent)} is working on this computer, not in T3 Code: ${gap}.`,
608
781
  });
609
782
  }
610
- let folder = elsewhere?.folder ?? goal.workspace;
783
+ let folder = awayFolder ?? elsewhere?.folder ?? goal.workspace;
611
784
  // Another computer makes its own scratch folder for the turn (machineRuns.mjs), so none is named for it here.
612
785
  if (scratch)
613
786
  folder = elsewhere ? null : prepareScratch(goalId, threadFiles(task));
@@ -659,6 +832,7 @@ export function createThreadRuns({
659
832
  if (!scratch && (elsewhere?.machine || self))
660
833
  store.meta(`thread-work-computer:${goalId}`, elsewhere?.machine ?? self);
661
834
  if (t3) store.meta(`t3-run:${wake.id}`, "1");
835
+ if (lane) store.meta(`lane:${wake.id}`, lane);
662
836
  if (fromAnotherPerson(asker))
663
837
  store.meta(`other-person-run:${wake.id}`, "1");
664
838
  store.meta(
@@ -722,7 +896,10 @@ export function createThreadRuns({
722
896
  woken = JSON.parse(store.meta(`wake-reason:${wake.id}`) || "null");
723
897
  } catch {}
724
898
  if (!thread || !woken) return wake.brief;
725
- const later = pendingWakes.get(`${thread.id}:${wake.target_agent}`);
899
+ const later =
900
+ pendingWakes.get(
901
+ laneKey(thread.id, wake.target_agent, store.meta(`lane:${wake.id}`))
902
+ ) ?? pendingWakes.get(laneKey(thread.id, wake.target_agent));
726
903
  const reason =
727
904
  later && later.at > wake.created_at
728
905
  ? `${woken.reason}\n\nSince then: ${later.reason}`
@@ -855,9 +1032,12 @@ export function createThreadRuns({
855
1032
  kind === "failed" &&
856
1033
  (store.getTask(goalId)?.status !== "open" ||
857
1034
  Boolean(store.meta(`steered:${task.id}`)));
1035
+ // The computer the turn ran on (runWorker.mjs claims it there): the same agent may have a turn on another computer
1036
+ // in this thread at once, and that turn's posts are not this one's.
1037
+ const ranOn = store.getTask(task.id)?.claimed_machine ?? null;
858
1038
  if (
859
1039
  !stopped &&
860
- !store.postsBy(goalId, task.target_agent, startedAt) &&
1040
+ !store.postsBy(goalId, task.target_agent, startedAt, ranOn) &&
861
1041
  text
862
1042
  )
863
1043
  store.roomPost({
@@ -865,21 +1045,30 @@ export function createThreadRuns({
865
1045
  author: task.target_agent,
866
1046
  kind: kind === "done" ? "post" : "failed",
867
1047
  text: kind === "done" ? text : `run failed: ${text}`,
868
- // The computer the turn ran on (runWorker.mjs claims it there).
869
- machine: store.getTask(task.id)?.claimed_machine ?? null,
1048
+ machine: ranOn,
870
1049
  });
871
- // Its report: the agent's newest post since the turn began, the one above or its own.
1050
+ // Its report: the agent's newest post from this turn's computer since the turn began, the one above or its own.
872
1051
  if (kind === "done" && !stopped) {
873
1052
  const report = store
874
- .roomPosts(goalId, 0, 500)
875
- .findLast(
1053
+ .recentRoomPosts(goalId, { limit: 500 })
1054
+ .posts.findLast(
876
1055
  (post) =>
877
- post.author === task.target_agent && post.created_at >= startedAt
1056
+ post.author === task.target_agent &&
1057
+ post.created_at >= startedAt &&
1058
+ (!ranOn || !post.machine || post.machine === ranOn)
878
1059
  );
879
1060
  const thread = store.getTask(goalId);
880
1061
  if (report && thread) reported(thread, report);
881
1062
  }
882
- const key = `${goalId}:${task.target_agent}`;
1063
+ // Words that wait in this turn's lane, else words that named no computer.
1064
+ const laned = laneKey(
1065
+ goalId,
1066
+ task.target_agent,
1067
+ store.meta(`lane:${task.id}`)
1068
+ );
1069
+ const key = pendingWakes.get(laned)
1070
+ ? laned
1071
+ : laneKey(goalId, task.target_agent);
883
1072
  const pending = pendingWakes.get(key);
884
1073
  // A call that came before this run's brief read the thread is in it: waking it again repeats its work (Codex was
885
1074
  // once woken a second time for an animatic it had just made). Only a later call wakes it again, as one posted while
@@ -907,40 +1096,44 @@ export function createThreadRuns({
907
1096
  const recover = () => {
908
1097
  for (const goal of store.goals()) {
909
1098
  if (goal.status !== "open") continue;
910
- for (const agent of RUNNERS) {
911
- const key = goal.id + ":" + agent;
912
- const pending = pendingWakes.get(key);
913
- if (!pending) continue;
914
- // A waiting turn never started, so nothing of it is unknown: the person's go still starts it.
915
- if (store.openWake(goal.id, agent)) {
916
- if (pending.go) startHeldWake(goal.id, agent);
917
- continue;
1099
+ for (const agent of RUNNERS)
1100
+ for (const key of laneKeys(goal.id, agent)) {
1101
+ const pending = pendingWakes.get(key);
1102
+ if (!pending) continue;
1103
+ const lane = key.includes("@") ? pending.on : null;
1104
+ // A waiting turn never started, so nothing of it is unknown: the person's go still starts it.
1105
+ if (openWakeIn(goal.id, agent, lane)) {
1106
+ if (pending.go) startHeldWake(goal.id, agent, lane);
1107
+ continue;
1108
+ }
1109
+ // The previous turn's effects are unknown. Preserve the new call, but let the person inspect before starting it.
1110
+ const wakeId = wakeAgent(goal.id, agent, pending.reason, {
1111
+ asker: pending.asker,
1112
+ pick: pending.pick,
1113
+ recovering: true,
1114
+ routeMachine: pending.routeMachine ?? null,
1115
+ on: pending.on ?? null,
1116
+ });
1117
+ if (!wakeId) continue;
1118
+ pendingWakes.delete(key);
1119
+ store.roomPost({
1120
+ goalId: goal.id,
1121
+ author: DISPATCHER,
1122
+ kind: "note",
1123
+ text:
1124
+ nameOf(agent) +
1125
+ "'s later call survived the restart and waits for your Start. Its interrupted turn's outcome is unknown; check the workspace before continuing.",
1126
+ });
1127
+ notifyBoard(store.getTask(goal.id));
918
1128
  }
919
- // The previous turn's effects are unknown. Preserve the new call, but let the person inspect before starting it.
920
- const wakeId = wakeAgent(goal.id, agent, pending.reason, {
921
- asker: pending.asker,
922
- pick: pending.pick,
923
- recovering: true,
924
- routeMachine: pending.routeMachine ?? null,
925
- on: pending.on ?? null,
926
- });
927
- if (!wakeId) continue;
928
- pendingWakes.delete(key);
929
- store.roomPost({
930
- goalId: goal.id,
931
- author: DISPATCHER,
932
- kind: "note",
933
- text:
934
- nameOf(agent) +
935
- "'s later call survived the restart and waits for your Start. Its interrupted turn's outcome is unknown; check the workspace before continuing.",
936
- });
937
- notifyBoard(store.getTask(goal.id));
938
- }
939
1129
  }
940
1130
  };
941
1131
  return {
942
1132
  computerOf,
1133
+ computerOfRun,
943
1134
  wake: wakeAgent,
1135
+ waitsForComputer,
1136
+ computersChanged,
944
1137
  steered,
945
1138
  discard,
946
1139
  recover,
@@ -219,7 +219,7 @@ export function createThreadView({
219
219
  const reason = thread.goal.paused_reason || "";
220
220
  if (thread.status === "paused" && !PERSON_STOPS.includes(reason))
221
221
  items.push({
222
- id: `decide:${thread.id}:${thread.updated_at}`,
222
+ id: `decide:${thread.id}:${store.meta(`paused-note:${thread.id}`) || thread.updated_at}`,
223
223
  kind: "decide",
224
224
  agent: thread.goal.facilitator,
225
225
  text: reason.replace(/^The room is paused:\s*/, "") || "Paused.",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.77",
3
+ "version": "0.7.81",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tryharness",
9
- "version": "0.7.77",
9
+ "version": "0.7.81",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "2.0.0",
@@ -32,9 +32,9 @@
32
32
  "node": ">=18"
33
33
  },
34
34
  "optionalDependencies": {
35
- "tryharness-desktop-darwin-arm64": "0.7.77",
36
- "tryharness-desktop-darwin-x64": "0.7.77",
37
- "tryharness-desktop-linux-x64": "0.7.77"
35
+ "tryharness-desktop-darwin-arm64": "0.7.81",
36
+ "tryharness-desktop-darwin-x64": "0.7.81",
37
+ "tryharness-desktop-linux-x64": "0.7.81"
38
38
  }
39
39
  },
40
40
  "node_modules/@agentclientprotocol/sdk": {
@@ -1051,9 +1051,9 @@
1051
1051
  }
1052
1052
  },
1053
1053
  "node_modules/tryharness-desktop-darwin-arm64": {
1054
- "version": "0.7.77",
1055
- "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.77.tgz",
1056
- "integrity": "sha512-i4kRxn7vxm8sSwPgL7UEexhcGMdvt5klKgeI6E8UWXbMZu1U9i4XfeRIogtZIHECLVPFWaY2Jzk7E7ZvfAqhWg==",
1054
+ "version": "0.7.81",
1055
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.81.tgz",
1056
+ "integrity": "sha512-A4GeHHRt7HWryv7jJIQ6tpb4FqqCu6pbGo6WahFZgaAdLpi0CM3w/osISBufzD1v36SjRn7H4TfLqEHwDM+aRQ==",
1057
1057
  "cpu": [
1058
1058
  "arm64"
1059
1059
  ],
@@ -1064,9 +1064,9 @@
1064
1064
  ]
1065
1065
  },
1066
1066
  "node_modules/tryharness-desktop-darwin-x64": {
1067
- "version": "0.7.77",
1068
- "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.77.tgz",
1069
- "integrity": "sha512-Q3xmyu+ADf7j3mWB7MDBXrNsAF/reNSLC7nhZDZ/2hC+daS+ieu0kCsmxQI2j7edYG2VgxZIffi6QIaq8Exs8w==",
1067
+ "version": "0.7.81",
1068
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.81.tgz",
1069
+ "integrity": "sha512-5s2wnZ89kC5BgqEEaqluanaeGUzmEnLVzgWVJmwL74tRJPTVG7pA3MWXLnN54WYFm4h1nLRcmgqjESSvy1bgMA==",
1070
1070
  "cpu": [
1071
1071
  "x64"
1072
1072
  ],
@@ -1077,9 +1077,9 @@
1077
1077
  ]
1078
1078
  },
1079
1079
  "node_modules/tryharness-desktop-linux-x64": {
1080
- "version": "0.7.77",
1081
- "resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.77.tgz",
1082
- "integrity": "sha512-M3QXQnISASQ2uI/y2tF/9KYs0Teuc4VR8FoLMXPOo01EwfM2Lf1+wy1ZWH2iePkV3o49Verc6DtaP6uM/iKsyw==",
1080
+ "version": "0.7.81",
1081
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.81.tgz",
1082
+ "integrity": "sha512-WofK+LjrQAnAOuACLXjfHB12PMIVusssMDqwVyMsHCJb9RvHIv0orGr7Uq7vBtFHwa1yjutCF/j6IESxAh8hnA==",
1083
1083
  "cpu": [
1084
1084
  "x64"
1085
1085
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.77",
3
+ "version": "0.7.81",
4
4
  "description": "Harness Relay: the daemon that turns the agents on this machine into your personal swarm. Memory, history, and work handed between any of them.",
5
5
  "bin": {
6
6
  "tryharness": "cli.mjs"
@@ -48,8 +48,8 @@
48
48
  "zod": "4.6.7"
49
49
  },
50
50
  "optionalDependencies": {
51
- "tryharness-desktop-darwin-arm64": "0.7.77",
52
- "tryharness-desktop-darwin-x64": "0.7.77",
53
- "tryharness-desktop-linux-x64": "0.7.77"
51
+ "tryharness-desktop-darwin-arm64": "0.7.81",
52
+ "tryharness-desktop-darwin-x64": "0.7.81",
53
+ "tryharness-desktop-linux-x64": "0.7.81"
54
54
  }
55
55
  }