@cogitator-ai/bridge 0.9.0 → 0.10.1

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 (41) hide show
  1. package/README.md +47 -32
  2. package/dist/dispatcher.d.ts +25 -0
  3. package/dist/dispatcher.d.ts.map +1 -1
  4. package/dist/dispatcher.js +93 -4
  5. package/dist/dispatcher.js.map +1 -1
  6. package/dist/job-record.d.ts +1 -0
  7. package/dist/job-record.d.ts.map +1 -1
  8. package/dist/job-record.js +1 -0
  9. package/dist/job-record.js.map +1 -1
  10. package/dist/recipes/built-in.d.ts.map +1 -1
  11. package/dist/recipes/built-in.js +14 -67
  12. package/dist/recipes/built-in.js.map +1 -1
  13. package/dist/recipes/conductor.d.ts.map +1 -1
  14. package/dist/recipes/conductor.js +17 -8
  15. package/dist/recipes/conductor.js.map +1 -1
  16. package/dist/recipes/debate.d.ts +21 -0
  17. package/dist/recipes/debate.d.ts.map +1 -0
  18. package/dist/recipes/debate.js +232 -0
  19. package/dist/recipes/debate.js.map +1 -0
  20. package/dist/recipes/index.d.ts +2 -0
  21. package/dist/recipes/index.d.ts.map +1 -1
  22. package/dist/recipes/index.js +2 -0
  23. package/dist/recipes/index.js.map +1 -1
  24. package/dist/recipes/race.d.ts +18 -0
  25. package/dist/recipes/race.d.ts.map +1 -0
  26. package/dist/recipes/race.js +180 -0
  27. package/dist/recipes/race.js.map +1 -0
  28. package/dist/recipes/steps.d.ts +50 -0
  29. package/dist/recipes/steps.d.ts.map +1 -0
  30. package/dist/recipes/steps.js +88 -0
  31. package/dist/recipes/steps.js.map +1 -0
  32. package/dist/tools/guidance.js +1 -1
  33. package/dist/tools/guidance.js.map +1 -1
  34. package/dist/tools/tools.d.ts.map +1 -1
  35. package/dist/tools/tools.js +115 -0
  36. package/dist/tools/tools.js.map +1 -1
  37. package/dist/types.d.ts +12 -0
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/types.js +2 -0
  40. package/dist/types.js.map +1 -1
  41. package/package.json +11 -11
package/README.md CHANGED
@@ -56,6 +56,8 @@ What names a path of this machine goes where only you have it, never into a file
56
56
  | `delegate` | Hands a job to `codex`, `claude` or an agent by name, with its context, its checks and, when asked, a worktree |
57
57
  | `build` | Has a job done in a worktree, checked, reviewed by another agent and fixed by its author, in one go |
58
58
  | `review` | Has the work of a finished job reviewed by another agent, and its author fix what was found |
59
+ | `race` | Hands the same job to several agents at once, each in a worktree of its own, and lays the results side by side |
60
+ | `debate` | Puts a question to several agents, who answer each other round by round until they agree |
59
61
  | `ask` | Asks the other agent of a job a question. The answer wakes the session |
60
62
  | `answer` | Answers a question another agent asked, or decides its permission request: allow, deny, or leave it to the user |
61
63
  | `report` | Reports the result of a job handed to this session, which ends the job, with its lessons and, of a review, its findings |
@@ -86,7 +88,7 @@ The dispatcher of `cogitator bridge serve` reaches both harnesses with the comma
86
88
  | The tools know it by | a hook that adds the session to every tool call | the thread Codex names in every tool call |
87
89
  | Before it can start | Claude Code must trust the folder | nothing |
88
90
 
89
- **Claude Code.** Nothing is pushed into a window from outside. After every turn a background hook of the session runs `cogitator bridge wait`, which waits at the dispatcher and, when a letter comes, exits with code 2 and the letter on stderr: that wakes the session with the letter as its next input (`asyncRewake` in Claude Code's hooks). Under the letter it adds one line saying how to answer through the bridge. While the hook waits the session is free, you can talk to it. A session the bridge starts carries the hook itself. For the sessions you open yourself, `cogitator bridge install` puts it into the project's `.claude/settings.local.json`:
91
+ **Claude Code.** Nothing is pushed into a window from outside. After every turn a background hook of the session runs `cogitator bridge wait`, which waits at the dispatcher and, when a letter comes, exits with code 2 and the letter on stderr: that wakes the session with the letter as its next input (`asyncRewake` in Claude Code's hooks). Under the letter it adds one line saying how to answer through the bridge. While the hook waits the session is free, you can talk to it. A session sometimes ends its turn with its answer said only in its own window, where the agent that waits for the job does not read. So a session that has waited for mail for a minute with a job it has not reported on gets a reminder to report, as a letter that wakes it. When it does not react within the reply timeout of the job, the job fails with that reason, rather than staying open until its deadline. A session the bridge starts carries the hook itself. For the sessions you open yourself, `cogitator bridge install` puts it into the project's `.claude/settings.local.json`:
90
92
 
91
93
  ```json
92
94
  {
@@ -252,7 +254,7 @@ await bridge.send({
252
254
 
253
255
  ## Recipes: do, check, review, fix
254
256
 
255
- A recipe is a job the bridge itself carries out by fixed steps: it hands jobs of its own to the agents, waits for their reports and reports once at the end. No model decides what comes next.
257
+ A recipe is a job the bridge itself carries out by fixed steps: it hands jobs of its own to the agents, waits for their reports and reports once at the end. No model decides what comes next. Four come with the bridge: `build` and `review` for work that is checked by another agent, `race` for the same job done several times side by side, `debate` for a question worth more than one opinion.
256
258
 
257
259
  ```typescript
258
260
  import { hostBridge } from '@cogitator-ai/bridge';
@@ -279,22 +281,34 @@ await bridge.createJob({
279
281
 
280
282
  **`review`.** The same rounds for a job that is done already: `input.job` names it, and its author fixes what the review finds. Whoever handed that job over, carried it out, or started the recipe it was a step of may have it reviewed. The review and the fixes are done in the folder the job was done in. While a job still works on what another job left in its worktree, that worktree stays: `accept` and `reject` are refused until the review has reported or is canceled.
281
283
 
282
- | Input | Recipe | What it says |
283
- | ----------- | -------- | ---------------------------------------------------------------------------------------------------------- |
284
- | `to` | `build` | Who does the work: a harness word such as `claude`, for a session started for the job |
285
- | `job` | `review` | The job whose work is reviewed |
286
- | `by` | both | Who reviews: an agent, or a harness word for a fresh session. Another harness than the author's by default |
287
- | `rounds` | both | How many times the author is sent back at most, 2 by default, 0 for a review that sends nothing back |
288
- | `threshold` | both | The lightest finding worth sending back: `blocker`, `major` (the default), `minor` or `nit` |
289
- | `focus` | both | What the reviewer looks at above all |
290
- | `checks` | `build` | The commands that show the result holds, run after the work and after every round of fixes |
291
- | `worktree` | `build` | `false` to have the work done in the caller's folder |
292
- | `context` | `build` | What the caller knows and the agent does not, as `createJob` takes it |
284
+ **`race`: the same job, side by side.** The text of the job goes to every agent of `to` at the same time, each in a git worktree of its own, with the `checks` of the input. The report lays the attempts side by side: which finished, what its checks showed, how much it changed. With a `judge`, another agent reads the attempts that finished and ends with the one it would take. The recipe takes none itself: whoever started it takes one with `accept` and drops the others with `reject`. The same harness word twice means two sessions of that harness. The bridge keeps two worktrees of a project in progress and starts two sessions at once (see the limits), so attempts beyond that wait their turn. An attempt the bridge refuses, and a judge it cannot reach, are said in the report, which still lays out the rest. The recipe fails when no attempt finished.
285
+
286
+ **`debate`: a question, round by round.** The rules are those of the `debate` strategy of [`@cogitator-ai/swarms`](https://www.npmjs.com/package/@cogitator-ai/swarms), with sessions of any harness as the debaters. In the first round each debater answers the question alone. From the second on each sees what the others said in the rounds before, answers them, and ends its turn with `STANCE: agree` or `STANCE: disagree`. The debate ends when every debater that took part agrees in the same round, or after `rounds` rounds: one that argued before and gives no answer now has not agreed. An `advocate` argues for, a `critic` against, any other `role` is told to the agent as it is. With a `moderator`, another agent sums the debate up: the positions, what is agreed and what is not, the strongest arguments and a recommendation. Without one the report carries the positions of the last round. No file is changed. Every debater reads the question whole in every round, so it takes 20000 characters at most, and debaters times rounds is 40 at most. A turn the bridge refuses to hand over, and a moderator it cannot reach, are said in the report, which still carries what the others said. The recipe fails when fewer than two debaters answered.
287
+
288
+ | Input | Recipe | What it says |
289
+ | ------------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
290
+ | `to` | `build` | Who does the work: a harness word such as `claude`, for a session started for the job |
291
+ | `job` | `review` | The job whose work is reviewed |
292
+ | `by` | both | Who reviews: an agent, or a harness word for a fresh session. Another harness than the author's by default |
293
+ | `rounds` | both | How many times the author is sent back at most, 2 by default, 0 for a review that sends nothing back |
294
+ | `threshold` | both | The lightest finding worth sending back: `blocker`, `major` (the default), `minor` or `nit` |
295
+ | `focus` | both | What the reviewer looks at above all |
296
+ | `checks` | `build` | The commands that show the result holds, run after the work and after every round of fixes |
297
+ | `worktree` | `build` | `false` to have the work done in the caller's folder |
298
+ | `context` | `build` | What the caller knows and the agent does not, as `createJob` takes it |
299
+ | `to` | `race` | Who does the job: two to six harness words, the same one twice for two sessions of one harness |
300
+ | `checks`, `context` | `race` | As for `build`, for every attempt |
301
+ | `judge` | `race` | Who compares the attempts and says which to take, nobody by default |
302
+ | `debaters` | `debate` | Who debates, two to six: each a harness word or an agent, or `{ to, role }` |
303
+ | `rounds` | `debate` | How many rounds at most, 3 by default |
304
+ | `moderator` | `debate` | Who sums the debate up, nobody by default |
293
305
 
294
306
  **Findings.** A reviewer names what it found in the `findings` of its report, each with a severity (`blocker`, `major`, `minor`, `nit`), a line of what is wrong and, where it has one, the file and the line. An agent without the tools writes one line for each, `[major] src/limiter.ts:12 - The window never resets`, or the single line `[none]`: `parseFindings` reads them. An empty list says the review found nothing. A report that names no findings in either form is not a clean review: the recipe then sends nothing back and hands the report on as it is. The findings of a report are kept on its job (`job.findings`) and shown under the report.
295
307
 
296
308
  **Who does a later step.** The fixes go back to the author and the second look to the first reviewer when the bridge can wake them: `wakes(agent)` says whether a session waits for its mail or its harness wakes it for a letter. One that would only find the letter when a person opens it, such as a Codex thread that is open nowhere while no local daemon runs, is not waited for. A fresh session of the same harness gets the step then, with what it needs to know in the letter: what the job was, where the work lies, and what was found.
297
309
 
310
+ **Leave for what a step runs.** An agent that works on a step asks leave for a call its rules do not settle, and the rules that count are those of whoever started the recipe. A reviewer nearly always starts with `git diff` and the tests of the project, so allow those in the settings of the project (`Bash(git diff:*)`, `Bash(git status:*)`, `Bash(npm test:*)`) for a recipe to run without you. What they do not allow waits for you in `cogitator bridge asks`, and the step waits with it.
311
+
298
312
  **After a restart.** Every run is a workflow of [`@cogitator-ai/workflows`](https://www.npmjs.com/package/@cogitator-ai/workflows), an optional peer dependency, with a checkpoint after each step. A step hands its job over under an id made of the run and the step, so a step that runs again finds the job it handed over the first time. With checkpoints that outlive the process (`FileCheckpointStore`), a dispatcher that is started again picks every open recipe up where it was, and nothing is done twice. `cogitator bridge serve` keeps them in `recipes` in the folder of the bridge. In memory, the default, a run that was cut off starts its steps over and still finds the jobs it handed over.
299
313
 
300
314
  **A recipe of your own** is a workflow whose steps hand jobs over through the run:
@@ -418,25 +432,26 @@ Folders are compared by their real path, so a project reached through a symlink
418
432
 
419
433
  Each number is a default that `hostBridge({ limits })` changes.
420
434
 
421
- | Limit | Default | What happens |
422
- | ----------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------ |
423
- | Depth | 3 | A job handed over from inside a job from inside a job is the deepest. One more is refused |
424
- | Letters per job | 60 | The job fails, both sides are told. The report that ends the job always goes through |
425
- | Time per job | 4 hours | The job fails, both sides are told |
426
- | Reply timeout | 30 minutes | The one who owes an answer, or did not pick a job up, is reminded. After as long again the job fails |
427
- | Jobs out | 20 | An agent with that many jobs still in progress cannot hand over another |
428
- | Jobs per hour | 60 | Handing over faster is refused as a loop |
429
- | Sessions starting | 2 | No more sessions are started at once |
430
- | Silence | 12 hours | A session with no job in progress is taken for gone, unless its harness lists it or its hook waits |
431
- | Session check | 1 minute | How often a harness that can list its sessions is asked which of them still run |
432
- | Window notice | 10 minutes | An agent that waits for a person at its own window is said so to whoever handed it a job, and not again within this time |
433
- | Person's answer | 4 hours | The person is reminded of a letter that waits for them. After as long again the job fails |
434
- | Delivery | 5 attempts | Retried with a growing wait, then left for the inbox |
435
- | Worktrees | 2 | A third job of the project that asks for a worktree of its own is refused while two are in progress |
436
- | Check | 10 minutes | A check that runs longer is ended with everything it started, and fails |
437
- | Worktree kept | 7 days | The worktree of a finished job nobody took or dropped is removed, its work kept under a ref |
438
- | Context | 6000 tokens | The block the bridge adds under a job keeps to it: files are cut or only named, notes stop when it is full |
439
- | Context wait | 10 seconds | A job whose context could not be put together in that time is handed over without it |
435
+ | Limit | Default | What happens |
436
+ | ----------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
437
+ | Depth | 3 | A job handed over from inside a job from inside a job is the deepest. One more is refused |
438
+ | Letters per job | 60 | The job fails, both sides are told. The report that ends the job always goes through |
439
+ | Time per job | 4 hours | The job fails, both sides are told |
440
+ | Reply timeout | 30 minutes | The one who owes an answer, or did not pick a job up, is reminded. After as long again the job fails |
441
+ | Jobs out | 20 | An agent with that many jobs still in progress cannot hand over another |
442
+ | Jobs per hour | 60 | Handing over faster is refused as a loop |
443
+ | Sessions starting | 2 | No more sessions are started at once |
444
+ | Silence | 12 hours | A session with no job in progress is taken for gone, unless its harness lists it or its hook waits |
445
+ | Session check | 1 minute | How often a harness that can list its sessions is asked which of them still run |
446
+ | Window notice | 10 minutes | An agent that waits for a person at its own window is said so to whoever handed it a job, and not again within this time |
447
+ | Person's answer | 4 hours | The person is reminded of a letter that waits for them. After as long again the job fails |
448
+ | Delivery | 5 attempts | Retried with a growing wait, then left for the inbox |
449
+ | Worktrees | 2 | A third job of the project that asks for a worktree of its own is refused while two are in progress |
450
+ | Check | 10 minutes | A check that runs longer is ended with everything it started, and fails |
451
+ | Worktree kept | 7 days | The worktree of a finished job nobody took or dropped is removed, its work kept under a ref |
452
+ | Context | 6000 tokens | The block the bridge adds under a job keeps to it: files are cut or only named, notes stop when it is full |
453
+ | Context wait | 10 seconds | A job whose context could not be put together in that time is handed over without it |
454
+ | Report reminder | 1 minute | A session that has waited for mail that long with a job it has not reported on is reminded to report. No reaction within the reply timeout fails the job |
440
455
 
441
456
  Two more rules have no number. A letter that says what the previous one in the same direction said is not delivered, and neither is a job the same agent already has from the caller and has not finished.
442
457
 
@@ -583,6 +583,31 @@ export declare class BridgeDispatcher extends EventEmitter<BridgeDispatcherEvent
583
583
  * the deliveries that are due again. The host calls it on a timer.
584
584
  */
585
585
  sweep(): Promise<SweepResult>;
586
+ /**
587
+ * Reminds a session to report on a job it carries out and went quiet on. A session whose
588
+ * waiter has been armed for `limits.reportReminderMs` has ended its turn, and when a job of it
589
+ * is still in progress with nothing owed to it, its answer was most likely said only in its
590
+ * own window, where whoever waits for the job does not read. The reminder is a letter, so it
591
+ * wakes the session. One that does not react to it within the reply timeout of the job fails
592
+ * the job, rather than leaving it open until its deadline, whether or not it waits for mail by
593
+ * then: the hook of a session waits a shorter while than that. A session that reacts with
594
+ * anything but a report is reminded again no sooner than that timeout.
595
+ *
596
+ * A session is left alone while its harness lists it in the middle of a turn, while it waits
597
+ * for jobs it handed over from inside the job or for the person, and while mail for it is on
598
+ * its way. Returns the jobs it failed.
599
+ */
600
+ private remindOfReports;
601
+ /**
602
+ * Whether a job waits for nothing but the word of the agent that carries it out: its checks
603
+ * do not run, it waits for no job handed over from inside it and for no answer of the person,
604
+ * and no letter for the agent is on its way.
605
+ */
606
+ private owesReport;
607
+ /** Whether the agent that carries a job out wrote a letter on it at or after a time. */
608
+ private wroteSince;
609
+ /** Whether the harness of a session listed it in the middle of a turn the last time. */
610
+ private inTurn;
586
611
  /**
587
612
  * Asks the adapters that can list their sessions which of them still run, once in
588
613
  * `limits.presenceCheckMs`. A session that was listed and then is not, two times in a row, is
@@ -1 +1 @@
1
- {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAGjG,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EA0BL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAiCrB,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY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;YAsCP,aAAa;IA+B3B;;;;;OAKG;YACW,YAAY;IA+B1B,uFAAuF;YACzE,SAAS;IAavB,+FAA+F;IACzF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB5B,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,SAAS;YASH,OAAO;IAOrB,OAAO,CAAC,MAAM;IAId;;;OAGG;IACH,OAAO,CAAC,QAAQ;YAOF,QAAQ;IAkCtB,8EAA8E;IAC9E,OAAO,CAAC,QAAQ;IAOhB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAsClB,OAAO,CAAC,OAAO;IAIf;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,OAAO;YAMD,WAAW;YASX,UAAU;YA0BV,MAAM;YAQN,OAAO;YAcP,SAAS;IAiBvB,mGAAmG;YACrF,cAAc;IAgB5B;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAuDvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,YAAY;IA2CpB,sGAAsG;IACtG,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,cAAc;IAyCtB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,WAAW;IAoBnB;;;;OAIG;YACW,aAAa;IA0B3B,OAAO,CAAC,KAAK;IAOb,mGAAmG;IACnG,OAAO,CAAC,IAAI;YAWE,SAAS;IAyDvB,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;YASL,eAAe;CA0E9B"}
@@ -1263,6 +1263,7 @@ export class BridgeDispatcher extends EventEmitter {
1263
1263
  const waiter = {
1264
1264
  limit,
1265
1265
  signal,
1266
+ armedAt: this.now(),
1266
1267
  end: (reason, letters = []) => {
1267
1268
  if (this.waiters.get(name) === waiter)
1268
1269
  this.waiters.delete(name);
@@ -2441,6 +2442,7 @@ export class BridgeDispatcher extends EventEmitter {
2441
2442
  await this.failJob(tx, job.number, `${letter.to} did not ${pickup ? 'take' : 'answer'} the ${letter.kind} ${letter.id} in ${formatDuration(2 * job.budget.replyTimeoutMs)}`);
2442
2443
  failed.push(job.number);
2443
2444
  }
2445
+ failed.push(...(await this.remindOfReports(tx, now)));
2444
2446
  failed.push(...(await this.retireAgents(tx, now)));
2445
2447
  for (const agent of this.store.queuedRecipients())
2446
2448
  tx.wake.add(agent);
@@ -2449,6 +2451,88 @@ export class BridgeDispatcher extends EventEmitter {
2449
2451
  this.checkPresence();
2450
2452
  return result;
2451
2453
  }
2454
+ /**
2455
+ * Reminds a session to report on a job it carries out and went quiet on. A session whose
2456
+ * waiter has been armed for `limits.reportReminderMs` has ended its turn, and when a job of it
2457
+ * is still in progress with nothing owed to it, its answer was most likely said only in its
2458
+ * own window, where whoever waits for the job does not read. The reminder is a letter, so it
2459
+ * wakes the session. One that does not react to it within the reply timeout of the job fails
2460
+ * the job, rather than leaving it open until its deadline, whether or not it waits for mail by
2461
+ * then: the hook of a session waits a shorter while than that. A session that reacts with
2462
+ * anything but a report is reminded again no sooner than that timeout.
2463
+ *
2464
+ * A session is left alone while its harness lists it in the middle of a turn, while it waits
2465
+ * for jobs it handed over from inside the job or for the person, and while mail for it is on
2466
+ * its way. Returns the jobs it failed.
2467
+ */
2468
+ async remindOfReports(tx, now) {
2469
+ const failed = [];
2470
+ const reminded = this.store
2471
+ .jobTasks({ states: ['working'] })
2472
+ .flatMap((task) => jobOf(task) ?? [])
2473
+ .filter((job) => job.reportAskedAt !== undefined);
2474
+ for (const job of reminded) {
2475
+ const asked = Date.parse(job.reportAskedAt ?? '');
2476
+ const patience = job.budget.replyTimeoutMs;
2477
+ if (now - asked < patience || this.wroteSince(job, asked) || !this.owesReport(job))
2478
+ continue;
2479
+ if (this.inTurn(this.store.getAgent(job.to)))
2480
+ continue;
2481
+ await this.failJob(tx, job.number, `${job.to} ended its turn without a report and did not react to the reminder in ${formatDuration(patience)}`);
2482
+ failed.push(job.number);
2483
+ }
2484
+ for (const [name, waiter] of this.waiters) {
2485
+ if (now - waiter.armedAt < this.limits.reportReminderMs)
2486
+ continue;
2487
+ const agent = this.store.getAgent(name);
2488
+ if (agent?.status !== 'active' || this.conducts(agent) || this.inTurn(agent))
2489
+ continue;
2490
+ const carried = this.store
2491
+ .jobTasks({ to: name, states: ['working'] })
2492
+ .flatMap((task) => jobOf(task) ?? []);
2493
+ for (const job of carried) {
2494
+ if (!this.owesReport(job))
2495
+ continue;
2496
+ if (job.reportAskedAt && now - Date.parse(job.reportAskedAt) < job.budget.replyTimeoutMs) {
2497
+ continue;
2498
+ }
2499
+ this.systemNote(tx, job, name, `You ended your turn, and job #${job.number} is still in progress: ${job.from} has no report from you. What you said in your own window nobody else reads. Report on the job with the report tool: when your answer is written there already, send that answer itself, whole, not a word about it. If you are not done, ask what you need, or say in a note what you wait for.`);
2500
+ await this.patchRecord(job.taskId, { reportAskedAt: this.iso(now) });
2501
+ }
2502
+ }
2503
+ return failed;
2504
+ }
2505
+ /**
2506
+ * Whether a job waits for nothing but the word of the agent that carries it out: its checks
2507
+ * do not run, it waits for no job handed over from inside it and for no answer of the person,
2508
+ * and no letter for the agent is on its way.
2509
+ */
2510
+ owesReport(job) {
2511
+ if (job.checking || this.waitsForPerson(job.number))
2512
+ return false;
2513
+ const parts = this.store.jobTasks({
2514
+ parent: job.number,
2515
+ states: ACTIVE_JOB_STATES,
2516
+ limit: 1,
2517
+ });
2518
+ if (parts.length > 0)
2519
+ return false;
2520
+ return this.store.countLetters({ to: job.to, states: ['queued'] }) === 0;
2521
+ }
2522
+ /** Whether the agent that carries a job out wrote a letter on it at or after a time. */
2523
+ wroteSince(job, since) {
2524
+ const [last] = this.store.listLetters({
2525
+ job: job.number,
2526
+ from: job.to,
2527
+ newestFirst: true,
2528
+ limit: 1,
2529
+ });
2530
+ return last !== undefined && Date.parse(last.createdAt) >= since;
2531
+ }
2532
+ /** Whether the harness of a session listed it in the middle of a turn the last time. */
2533
+ inTurn(agent) {
2534
+ return (agent !== undefined && this.presence.get(agent.harness)?.busy.has(agent.sessionId) === true);
2535
+ }
2452
2536
  /**
2453
2537
  * Asks the adapters that can list their sessions which of them still run, once in
2454
2538
  * `limits.presenceCheckMs`. A session that was listed and then is not, two times in a row, is
@@ -2473,7 +2557,7 @@ export class BridgeDispatcher extends EventEmitter {
2473
2557
  const asked = now;
2474
2558
  this.track(within(adapter.liveSessions(), this.limits.deliveryTimeoutMs, `Listing the ${harness} sessions`)
2475
2559
  .then((sessions) => this.mutate(async (tx) => {
2476
- await this.applyPresence(tx, harness, new Set(sessions.map((session) => session.sessionId)), adapter.ownsSessions === true, asked);
2560
+ await this.applyPresence(tx, harness, new Set(sessions.map((session) => session.sessionId)), adapter.ownsSessions === true, asked, new Set(sessions.flatMap((session) => (session.busy ? [session.sessionId] : []))));
2477
2561
  for (const session of sessions) {
2478
2562
  if (!session.waitingFor)
2479
2563
  continue;
@@ -2486,8 +2570,13 @@ export class BridgeDispatcher extends EventEmitter {
2486
2570
  .finally(() => this.listing.delete(harness)));
2487
2571
  }
2488
2572
  }
2489
- async applyPresence(tx, harness, live, certain, asked) {
2490
- const known = this.presence.get(harness) ?? { live, seen: new Set(), missed: new Set() };
2573
+ async applyPresence(tx, harness, live, certain, asked, busy = new Set()) {
2574
+ const known = this.presence.get(harness) ?? {
2575
+ live,
2576
+ seen: new Set(),
2577
+ missed: new Set(),
2578
+ busy: new Set(),
2579
+ };
2491
2580
  const missed = new Set();
2492
2581
  for (const sessionId of live)
2493
2582
  known.seen.add(sessionId);
@@ -2506,7 +2595,7 @@ export class BridgeDispatcher extends EventEmitter {
2506
2595
  known.seen.delete(id);
2507
2596
  await this.agentGone(tx, agent, `the session of ${agent.name} is not running any more`);
2508
2597
  }
2509
- this.presence.set(harness, { live, seen: known.seen, missed });
2598
+ this.presence.set(harness, { live, seen: known.seen, missed, busy });
2510
2599
  }
2511
2600
  /**
2512
2601
  * Takes sessions that are not there out of the address book, so a harness word keeps reaching