@cogitator-ai/bridge 0.4.0 → 0.6.0

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 (100) hide show
  1. package/README.md +87 -35
  2. package/dist/adapter.d.ts +34 -2
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapters/claude.d.ts +95 -2
  5. package/dist/adapters/claude.d.ts.map +1 -1
  6. package/dist/adapters/claude.js +207 -3
  7. package/dist/adapters/claude.js.map +1 -1
  8. package/dist/adapters/hosted.d.ts +38 -5
  9. package/dist/adapters/hosted.d.ts.map +1 -1
  10. package/dist/adapters/hosted.js +190 -10
  11. package/dist/adapters/hosted.js.map +1 -1
  12. package/dist/client.d.ts +26 -1
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/client.js +38 -1
  15. package/dist/client.js.map +1 -1
  16. package/dist/dispatcher.d.ts +145 -3
  17. package/dist/dispatcher.d.ts.map +1 -1
  18. package/dist/dispatcher.js +602 -24
  19. package/dist/dispatcher.js.map +1 -1
  20. package/dist/errors.d.ts +1 -1
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js.map +1 -1
  23. package/dist/guards.d.ts +3 -2
  24. package/dist/guards.d.ts.map +1 -1
  25. package/dist/guards.js +4 -3
  26. package/dist/guards.js.map +1 -1
  27. package/dist/host.d.ts +9 -0
  28. package/dist/host.d.ts.map +1 -1
  29. package/dist/host.js +2 -0
  30. package/dist/host.js.map +1 -1
  31. package/dist/index.d.ts +16 -8
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +8 -4
  34. package/dist/index.js.map +1 -1
  35. package/dist/inputs.d.ts +100 -1
  36. package/dist/inputs.d.ts.map +1 -1
  37. package/dist/inputs.js +35 -1
  38. package/dist/inputs.js.map +1 -1
  39. package/dist/job-record.d.ts +1 -0
  40. package/dist/job-record.d.ts.map +1 -1
  41. package/dist/job-record.js +1 -0
  42. package/dist/job-record.js.map +1 -1
  43. package/dist/letters.d.ts.map +1 -1
  44. package/dist/letters.js +23 -1
  45. package/dist/letters.js.map +1 -1
  46. package/dist/permit.d.ts +43 -0
  47. package/dist/permit.d.ts.map +1 -0
  48. package/dist/permit.js +118 -0
  49. package/dist/permit.js.map +1 -0
  50. package/dist/person-channel.d.ts +45 -0
  51. package/dist/person-channel.d.ts.map +1 -0
  52. package/dist/person-channel.js +160 -0
  53. package/dist/person-channel.js.map +1 -0
  54. package/dist/person-inbox.d.ts +31 -0
  55. package/dist/person-inbox.d.ts.map +1 -0
  56. package/dist/person-inbox.js +69 -0
  57. package/dist/person-inbox.js.map +1 -0
  58. package/dist/person.d.ts +65 -0
  59. package/dist/person.d.ts.map +1 -0
  60. package/dist/person.js +31 -0
  61. package/dist/person.js.map +1 -0
  62. package/dist/protocol.d.ts +8 -1
  63. package/dist/protocol.d.ts.map +1 -1
  64. package/dist/protocol.js +7 -1
  65. package/dist/protocol.js.map +1 -1
  66. package/dist/rights/index.d.ts +36 -0
  67. package/dist/rights/index.d.ts.map +1 -0
  68. package/dist/rights/index.js +186 -0
  69. package/dist/rights/index.js.map +1 -0
  70. package/dist/server.d.ts.map +1 -1
  71. package/dist/server.js +11 -0
  72. package/dist/server.js.map +1 -1
  73. package/dist/setup/claude.d.ts +4 -2
  74. package/dist/setup/claude.d.ts.map +1 -1
  75. package/dist/setup/claude.js +9 -3
  76. package/dist/setup/claude.js.map +1 -1
  77. package/dist/store/sqlite.d.ts +6 -1
  78. package/dist/store/sqlite.d.ts.map +1 -1
  79. package/dist/store/sqlite.js +74 -18
  80. package/dist/store/sqlite.js.map +1 -1
  81. package/dist/store/store.d.ts +6 -2
  82. package/dist/store/store.d.ts.map +1 -1
  83. package/dist/testing/fake-harnesses.d.ts +15 -2
  84. package/dist/testing/fake-harnesses.d.ts.map +1 -1
  85. package/dist/testing/fake-harnesses.js +17 -2
  86. package/dist/testing/fake-harnesses.js.map +1 -1
  87. package/dist/tools/guidance.d.ts.map +1 -1
  88. package/dist/tools/guidance.js +1 -0
  89. package/dist/tools/guidance.js.map +1 -1
  90. package/dist/tools/tools.d.ts.map +1 -1
  91. package/dist/tools/tools.js +27 -4
  92. package/dist/tools/tools.js.map +1 -1
  93. package/dist/types.d.ts +87 -1
  94. package/dist/types.d.ts.map +1 -1
  95. package/dist/types.js +31 -0
  96. package/dist/types.js.map +1 -1
  97. package/fakes/claude.mjs +175 -8
  98. package/fakes/lib.mjs +58 -7
  99. package/fakes/mcp.mjs +5 -1
  100. package/package.json +6 -1
package/README.md CHANGED
@@ -24,6 +24,7 @@ cogitator bridge status # the dispatcher, the sessions it knows, the job
24
24
  cogitator bridge log --follow # every letter as it goes
25
25
  cogitator bridge log --job 12 # everything about one job
26
26
  cogitator bridge doctor # whether Claude Code and Codex can be reached, and what to fix
27
+ cogitator bridge asks # what waits for your word: permission requests, questions left to you
27
28
  ```
28
29
 
29
30
  `cogitator daemon start --bridge` hosts it inside the assistant daemon instead. Its files live in `~/.cogitator/bridge` (`COGITATOR_BRIDGE_HOME` moves them): `bridge.db` and `bridge.sock`, both kept to their owner.
@@ -50,18 +51,18 @@ What names a path of this machine goes where only you have it, never into a file
50
51
 
51
52
  ### The tools
52
53
 
53
- | Tool | What it does |
54
- | ---------- | ------------------------------------------------------------------------------------------------ |
55
- | `delegate` | Hands a job to `codex`, `claude` or an agent by name, and returns its number at once |
56
- | `ask` | Asks the other agent of a job a question. The answer wakes the session |
57
- | `answer` | Answers a question another agent asked |
58
- | `report` | Reports the result of a job handed to this session, which ends the job. `failed` says it did not |
59
- | `note` | Tells the other agent something it need not answer |
60
- | `inbox` | Reads the letters that wait, when nothing woke the session |
61
- | `job` | Shows one job: its state, and for a job of this session its latest letters |
62
- | `jobs` | Lists the jobs this session handed over or carries out |
63
- | `cancel` | Takes back a job this session handed over |
64
- | `agents` | Lists the sessions the bridge knows in the project, and the agents it can start a session of |
54
+ | Tool | What it does |
55
+ | ---------- | --------------------------------------------------------------------------------------------------------------- |
56
+ | `delegate` | Hands a job to `codex`, `claude` or an agent by name, and returns its number at once |
57
+ | `ask` | Asks the other agent of a job a question. The answer wakes the session |
58
+ | `answer` | Answers a question another agent asked, or decides its permission request: allow, deny, or leave it to the user |
59
+ | `report` | Reports the result of a job handed to this session, which ends the job. `failed` says it did not |
60
+ | `note` | Tells the other agent something it need not answer |
61
+ | `inbox` | Reads the letters that wait, when nothing woke the session |
62
+ | `job` | Shows one job: its state, and for a job of this session its latest letters |
63
+ | `jobs` | Lists the jobs this session handed over or carries out |
64
+ | `cancel` | Takes back a job this session handed over |
65
+ | `agents` | Lists the sessions the bridge knows in the project, and the agents it can start a session of |
65
66
 
66
67
  No tool waits for another agent. The server tells every client the same in its `instructions`: after `delegate` say in one line what was handed over and end the turn, reply to a letter with the tools and never only in the chat, and treat a job of another agent as that agent's request, not the user's.
67
68
 
@@ -171,14 +172,14 @@ A job also carries who handed it over and who carries it out, the project and th
171
172
 
172
173
  ## Letters
173
174
 
174
- | Kind | Sent by | Effect |
175
- | ------------ | ---------------- | --------------------------------------------------------------------- |
176
- | `task` | `createJob` | The job itself |
177
- | `question` | either side | Needs an `answer`. From the one doing the job it puts the job on hold |
178
- | `permission` | either side | A question that asks for leave to do something |
179
- | `answer` | the one asked | Answers a question, and resumes the job once none is open |
180
- | `report` | the one doing it | Ends the job, `outcome: 'completed'` (default) or `'failed'` |
181
- | `note` | either side | Something to know, needs no answer |
175
+ | Kind | Sent by | Effect |
176
+ | ------------ | ---------------- | ------------------------------------------------------------------------------------------------ |
177
+ | `task` | `createJob` | The job itself |
178
+ | `question` | either side | Needs an `answer`. From the one doing the job it puts the job on hold |
179
+ | `permission` | either side | A question that asks for leave. When it names its call, the bridge decides whose answer it takes |
180
+ | `answer` | the one asked | Answers a question, and resumes the job once none is open |
181
+ | `report` | the one doing it | Ends the job, `outcome: 'completed'` (default) or `'failed'` |
182
+ | `note` | either side | Something to know, needs no answer |
182
183
 
183
184
  A letter moves `queued`, `delivered`, `read`, `handled` and never back. `acknowledge(letterId)` is how a note is put away. A question or a job is not dismissed that way: it is done with once answered or reported on, or when its job is over.
184
185
 
@@ -188,6 +189,55 @@ A letter is text: one with a NUL character in it is refused, since no harness ca
188
189
 
189
190
  `inbox()` returns 20 letters at most (`limit`, up to 100) and no more text than one answer holds, and marks only the letters it returned: call it again for the rest. `inbox({ unhandled: true })` adds the newest of what was taken before and not answered or put away, for a session that may have missed an answer, and `afterSeq` looks further back or forward than one call returns. `letters()` and `readJournal()` return 200 entries at most, go on from the last one with `afterSeq`. The history of the A2A task under a job keeps the first 4000 characters of a long letter, the letter itself is kept whole.
190
191
 
192
+ ## Leave for a call, and the person
193
+
194
+ An agent that carries a job out sometimes needs leave for one call: to run a command, to change a file its own rules do not let it change. It asks with a `permission` letter that names the call (`ask`), and the bridge decides whose answer that takes before anybody is woken. The measure is the rights of the agent that handed the job over, read from the permission settings of the job's project (`.claude/settings.json`, `.cogitator/settings.json`, their `.local` files, the person's and the machine's), in the permission mode that agent runs in:
195
+
196
+ | Its rules say | What happens |
197
+ | ------------- | --------------------------------------------------------------------- |
198
+ | forbidden | The call is refused at once, in the bridge's name. Nobody is asked |
199
+ | allowed | The request goes to that agent, which answers `allow` or `deny` |
200
+ | ask a person | Only the person can allow it. The agent is told, and can still refuse |
201
+
202
+ So an agent never gets leave from another agent that the other one does not have itself. A job handed over from inside a job is bound by every agent up the chain. Without a rule the person is asked what a person at a session would be asked: a command, an address to fetch, a file outside the project. A change to the settings files themselves is always the person's to allow, whatever the rules and the mode say, and so is a command that names their folders: an agent does not write the rules it is judged by. For a command this reads the words of the command line and no more, as every rule on a command does.
203
+
204
+ The one who asked does not get the answer as mail: it waits for it with `verdict({ letter })`, which answers the moment the request is decided. A request whose job ends first counts as refused. One that stops waiting takes its request back with `withdraw({ letter })`: nobody is asked to decide it any more, and an answer that comes late is refused instead of looking as if it let the call through. The same call may be asked for again once it was allowed, and is held back as a repeat once it was refused.
205
+
206
+ A Claude Code session the bridge starts asks the same way. It gets a `PermissionRequest` hook (`cogitator bridge permit`), so a call its mode and rules would show the permission dialog for becomes a request on its job, and the session goes on with the verdict. A session you opened keeps its dialog, which is yours to answer. When it opens one while it carries out a job, a `Notification` hook that `cogitator bridge install` adds (`cogitator bridge stuck`) tells the bridge: the agent that handed the job over gets a note that the job stands still, and you a notice in the inbox and the chat. A background session is noticed the same way in what `claude agents --json` lists. Codex gives no such signal yet, so a thread that waits at its own approval prompt is noticed by the reply timeout.
207
+
208
+ An agent can also leave a letter to the person itself: `answer` with the decision `person` (`escalate` in code) passes a question or a request on, and the person's answer goes straight to the one who asked.
209
+
210
+ What waits for the person is theirs to answer from a terminal:
211
+
212
+ ```bash
213
+ cogitator bridge asks # what waits for your word
214
+ cogitator bridge allow 12 # allow the call job 12 asks leave for
215
+ cogitator bridge deny 12 "not on a Friday"
216
+ cogitator bridge reply 12 "the release in March"
217
+ ```
218
+
219
+ `serve` and the daemon also keep these letters in an inbox, `inbox.json` next to the database (an `experimental_Inbox` of core, so its sinks and whatever reads the file see them), and send them to a Telegram chat when `COGITATOR_BRIDGE_TELEGRAM_TOKEN` and `COGITATOR_BRIDGE_TELEGRAM_CHAT` name a bot and a chat: a permission request with Allow and Refuse buttons, a question to be answered by replying to it. `COGITATOR_BRIDGE_TELEGRAM_USERS` limits who in that chat is listened to. Give the bridge a bot of its own.
220
+
221
+ Waiting for the person does not spend the job's time: the deadline does not fail a job that waits for them, nor the jobs it is part of, and moves by as long as they waited once the person answered. An agent that takes a letter back from the person and answers it itself gets no time for it. The person has a limit of their own instead: after 4 hours they are reminded, after as long again the job fails. A permission request is a letter of the job like any other and counts against its letters.
222
+
223
+ In your own process the pieces are `hostBridge({ rights, person })`:
224
+
225
+ ```typescript
226
+ import { channelRoute, hostBridge, inboxRoute, personRoutes } from '@cogitator-ai/bridge';
227
+ import { settingsRights } from '@cogitator-ai/bridge/rights';
228
+ import { telegramChannel } from '@cogitator-ai/channels';
229
+ import { experimental_Inbox } from '@cogitator-ai/core';
230
+
231
+ const telegram = channelRoute({ channel: telegramChannel({ token }), chatId: '123456' });
232
+ const host = await hostBridge({
233
+ rights: settingsRights(),
234
+ person: personRoutes([inboxRoute(new experimental_Inbox()), telegram]),
235
+ });
236
+ await telegram.start();
237
+ ```
238
+
239
+ `rights` is any function from a job and a call to `allow`, `ask` or `deny`. Without one every call is the person's, and without `person` what only they could allow is refused. A route is anything with `ask` and `settle`, and `host.dispatcher.personAnswer({ letter, verdict })` takes the answer.
240
+
191
241
  ## Who a letter is for
192
242
 
193
243
  A session enters the address book the first time it calls the bridge, and gets a name: `codex@my-project`, then `codex-2@my-project`. An address is:
@@ -207,18 +257,20 @@ Folders are compared by their real path, so a project reached through a symlink
207
257
 
208
258
  Each number is a default that `hostBridge({ limits })` changes.
209
259
 
210
- | Limit | Default | What happens |
211
- | ----------------- | ---------- | ---------------------------------------------------------------------------------------------------- |
212
- | Depth | 3 | A job handed over from inside a job from inside a job is the deepest. One more is refused |
213
- | Letters per job | 60 | The job fails, both sides are told. The report that ends the job always goes through |
214
- | Time per job | 4 hours | The job fails, both sides are told |
215
- | 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 |
216
- | Jobs out | 20 | An agent with that many jobs still in progress cannot hand over another |
217
- | Jobs per hour | 60 | Handing over faster is refused as a loop |
218
- | Sessions starting | 2 | No more sessions are started at once |
219
- | Silence | 12 hours | A session with no job in progress is taken for gone, unless its harness lists it or its hook waits |
220
- | Session check | 1 minute | How often a harness that can list its sessions is asked which of them still run |
221
- | Delivery | 5 attempts | Retried with a growing wait, then left for the inbox |
260
+ | Limit | Default | What happens |
261
+ | ----------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------ |
262
+ | Depth | 3 | A job handed over from inside a job from inside a job is the deepest. One more is refused |
263
+ | Letters per job | 60 | The job fails, both sides are told. The report that ends the job always goes through |
264
+ | Time per job | 4 hours | The job fails, both sides are told |
265
+ | 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 |
266
+ | Jobs out | 20 | An agent with that many jobs still in progress cannot hand over another |
267
+ | Jobs per hour | 60 | Handing over faster is refused as a loop |
268
+ | Sessions starting | 2 | No more sessions are started at once |
269
+ | Silence | 12 hours | A session with no job in progress is taken for gone, unless its harness lists it or its hook waits |
270
+ | Session check | 1 minute | How often a harness that can list its sessions is asked which of them still run |
271
+ | 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 |
272
+ | Person's answer | 4 hours | The person is reminded of a letter that waits for them. After as long again the job fails |
273
+ | Delivery | 5 attempts | Retried with a growing wait, then left for the inbox |
222
274
 
223
275
  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.
224
276
 
@@ -268,7 +320,7 @@ const host = await hostBridge({
268
320
 
269
321
  Now `delegate qwen "Review the diff"` from a Claude Code window starts a run of `reviewer` and wakes the window with its answer. Every session keeps its own thread, so with memory configured the agent remembers its earlier turns. An answer or a note that arrives while a run goes on steers it in the middle, a second job waits for its own turn, and so does what is written about it meanwhile. A job that is canceled stops the run that carries it out, and one canceled before its turn is never started. A run that pauses for an approval or for a question of a tool fails its job, since nobody is there to answer: give a hosted agent the permission rules it needs before it starts.
270
322
 
271
- An agent of the [Agent Client Protocol](https://www.npmjs.com/package/@cogitator-ai/acp), such as Gemini CLI, is hosted the same way through `AcpAgentProvider`. Its permissions are decided by the provider's rules, since no person sits at a session the bridge started. A provider works in the folder of its workspace whatever folder a job names, so say where that is with `root` (a job for another folder is refused), or give `provider` as a function that makes one for the folder of each session:
323
+ An agent of the [Agent Client Protocol](https://www.npmjs.com/package/@cogitator-ai/acp), such as Gemini CLI, is hosted the same way through `AcpAgentProvider`. Nobody sits at a session the bridge started, so a call the provider's rules do not settle is asked through the bridge: the agent that handed the job over answers within its own rights, the person for the rest. A tool call of a runtime agent that needs approval goes the same way. A provider works in the folder of its workspace whatever folder a job names, so say where that is with `root` (a job for another folder is refused), or give `provider` as a function that makes one for the folder of each session:
272
324
 
273
325
  ```typescript
274
326
  import { AcpAgentProvider, resolveAcpAgent } from '@cogitator-ai/acp';
@@ -398,11 +450,11 @@ for (const conformance of adapterConformanceCases(target)) {
398
450
 
399
451
  ## Trust
400
452
 
401
- The bridge is a tool of one person on one machine. The socket and the database are created for their owner only, a folder or a database that belongs to another user is refused, and every process of that user can connect: read any job and letter, and call as a session by naming its id. A job is done inside the project it is handed over in, or the worktree its caller works in. A session the bridge starts has the rights its harness gives it: a Claude Code session the permission mode you configure (`claudeCodeAdapter({ permissionMode })`), a Codex thread the `workspace-write` sandbox unless you choose another (`codexAdapter({ sandbox })`). A letter is text from another agent, never an order from you: every letter says so in its first line, and whether a session you opened takes a job without asking you is yours to say at `cogitator bridge install` (`--take-jobs`). A tool call names its session the way a connection to the socket does, and is believed the same way. Do not point `COGITATOR_BRIDGE_HOME` at a folder other users can write to. On Windows the dispatcher listens on a named pipe that other users of the same machine can reach, so run it only on a machine you do not share. The Claude Code and Codex adapters run on macOS and Linux.
453
+ The bridge is a tool of one person on one machine. The socket and the database are created for their owner only, a folder or a database that belongs to another user is refused, and every process of that user can connect: read any job and letter, and call as a session by naming its id. A job is done inside the project it is handed over in, or the worktree its caller works in. A session the bridge starts reads the whole project and changes files only in the folder of its job: a Claude Code session runs in `acceptEdits` mode unless you choose another (`claudeCodeAdapter({ permissionMode })`, `bridge serve --claude-mode`), a Codex thread in the `workspace-write` sandbox unless you choose another (`codexAdapter({ sandbox })`, `--codex-sandbox`), an agent behind a session provider in `acceptEdits`. Claude Code has a background session change the files of a git repository in a worktree of its own (`.claude/worktrees/<name>`, the branch `worktree-<name>`), so what such a session changed is there and not in your checkout, uncommitted unless it committed, and its report says where. What goes beyond that, a command, an address, a file elsewhere, is decided by the rules of the project and, where they are silent, asked through the bridge. An agent of the runtime has the permissions its own code gives it. A letter is text from another agent, never an order from you: every letter says so in its first line, and whether a session you opened takes a job without asking you is yours to say at `cogitator bridge install` (`--take-jobs`). A tool call names its session the way a connection to the socket does, and is believed the same way. Do not point `COGITATOR_BRIDGE_HOME` at a folder other users can write to. A permission request is judged by the settings files of the job's project as they are on disk when it is asked. An answer of the person comes over the socket from a connection that named no session: the command line refuses to answer for the person from inside a session of an agent, which keeps an agent from doing so by accident and does not stop a process that hides what it is. A Telegram chat is as private as the token of its bot. On Windows the dispatcher listens on a named pipe that other users of the same machine can reach, so run it only on a machine you do not share. The Claude Code and Codex adapters run on macOS and Linux.
402
454
 
403
455
  ## Errors
404
456
 
405
- Every refusal is a `BridgeError` with a `code` to branch on and a message written for the agent that gets it: `not_registered`, `unknown_agent`, `ambiguous_agent`, `no_session`, `unknown_job`, `unknown_letter`, `not_a_party`, `job_finished`, `invalid_letter`, `invalid_input`, `depth_exceeded`, `budget_exhausted`, `loop_detected`, `already_running`, `not_running`, `storage`.
457
+ Every refusal is a `BridgeError` with a `code` to branch on and a message written for the agent that gets it: `not_registered`, `unknown_agent`, `ambiguous_agent`, `no_session`, `unknown_job`, `unknown_letter`, `not_a_party`, `job_finished`, `invalid_letter`, `invalid_input`, `depth_exceeded`, `budget_exhausted`, `loop_detected`, `needs_person`, `no_person`, `already_running`, `not_running`, `storage`.
406
458
 
407
459
  ## Documentation
408
460
 
package/dist/adapter.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { CreateJobInput, CreateJobResult, InboxInput, SendLetterInput, SendLetterResult } from './inputs.js';
1
+ import type { CreateJobInput, CreateJobResult, InboxInput, SendLetterInput, SendLetterResult, VerdictInput, VerdictResult, WithdrawInput, WithdrawResult } from './inputs.js';
2
2
  import type { LetterFilter } from './store/store.js';
3
- import type { AdapterCapabilities, AgentRecord, BridgeJob, CallerIdentity, Letter, RenderedLetter } from './types.js';
3
+ import type { AdapterCapabilities, AgentRecord, BridgeJob, CallerIdentity, Letter, PermissionAsk, RenderedLetter, Verdict } from './types.js';
4
4
  /** A letter on its way to a session, as an adapter gets it. */
5
5
  export interface LetterDelivery {
6
6
  agent: AgentRecord;
@@ -30,6 +30,16 @@ export interface CreatedSession {
30
30
  /** Whether the session got `firstLetter` when it started, so the bridge does not deliver it again */
31
31
  deliveredFirstLetter?: boolean;
32
32
  }
33
+ /** A call a session needs leave for, as its harness told a hook. */
34
+ export interface PermissionHookCall {
35
+ /** The session that makes the call */
36
+ caller: CallerIdentity;
37
+ ask: PermissionAsk;
38
+ /** The words of the letter that asks leave */
39
+ body: string;
40
+ /** What the hook writes to tell the harness the decision */
41
+ answer(verdict: Verdict, reason: string): string;
42
+ }
33
43
  /** A session of a harness that runs on this machine right now, as the harness lists it. */
34
44
  export interface LiveSession {
35
45
  sessionId: string;
@@ -37,6 +47,11 @@ export interface LiveSession {
37
47
  name?: string;
38
48
  /** In the middle of a turn */
39
49
  busy?: boolean;
50
+ /**
51
+ * What the session waits for from a person at its window, in the words of its harness, such
52
+ * as `permission prompt`. Absent for a session that waits for nobody
53
+ */
54
+ waitingFor?: string;
40
55
  }
41
56
  /** What tells a process of a harness apart: its environment and, for a hook, what the harness wrote to it. */
42
57
  export interface IdentifyContext {
@@ -71,6 +86,8 @@ export interface BridgeCalls {
71
86
  register(identity: CallerIdentity): Promise<AgentRecord>;
72
87
  createJob(caller: string, input: CreateJobInput): Promise<CreateJobResult>;
73
88
  send(caller: string, input: SendLetterInput): Promise<SendLetterResult>;
89
+ verdict(caller: string, input: VerdictInput, signal?: AbortSignal): Promise<VerdictResult>;
90
+ withdraw(caller: string, input: WithdrawInput): Promise<WithdrawResult>;
74
91
  inbox(caller: string, input?: InboxInput): Promise<RenderedLetter[]>;
75
92
  acknowledge(caller: string, letterId: string): Promise<Letter>;
76
93
  cancel(caller: string, job: number, reason?: string): Promise<BridgeJob>;
@@ -114,6 +131,21 @@ export interface BridgeAdapter {
114
131
  * on as it was. For a harness whose server of tools outlives its sessions
115
132
  */
116
133
  toolCallHook?(context: IdentifyContext): string | undefined;
134
+ /**
135
+ * Reads what the harness wrote to a hook that runs when a session needs leave for a call: who
136
+ * asks, for what, and how to tell the harness the decision. Undefined when the input is not
137
+ * that of such a hook
138
+ */
139
+ permissionHook?(context: IdentifyContext): PermissionHookCall | undefined;
140
+ /**
141
+ * Reads what the harness wrote to a hook that runs when a session begins to wait for a person
142
+ * at its own window: who waits, and for what. Undefined when the input is not that of such a
143
+ * hook
144
+ */
145
+ stuckHook?(context: IdentifyContext): {
146
+ caller: CallerIdentity;
147
+ what: string;
148
+ } | undefined;
117
149
  /**
118
150
  * The sessions of the harness running on this machine, when the harness can list them. The
119
151
  * bridge keeps a listed session in its address book however long it is silent, and takes one
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,cAAc,EACd,MAAM,EACN,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,SAAS,CAAC;IACf,kGAAkG;IAClG,WAAW,EAAE,cAAc,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,W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,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACpE,oFAAoF;IACpF,aAAa,CAAC,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACjE;;;;OAIG;IACH,QAAQ,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,GAAG,SAAS,CAAC;IAChE;;;;;OAKG;IACH,YAAY,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5D;;;;OAIG;IACH,cAAc,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAC1E;;;;OAIG;IACH,SAAS,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAC3F;;;;OAIG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,oGAAoG;IACpG,MAAM,CAAC,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxD,gGAAgG;IAChG,MAAM,CAAC,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,oEAAoE;IACpE,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
@@ -1,4 +1,5 @@
1
- import type { BridgeAdapter } from '../adapter.js';
1
+ import type { BridgeAdapter, PermissionHookCall } from '../adapter.js';
2
+ import { type CallerIdentity } from '../types.js';
2
3
  import { type ToolsServerCommand } from './tools-server.js';
3
4
  /** How letters reach a Claude Code session: a hook of the session waits for them. */
4
5
  export declare const CLAUDE_DELIVERY = "hook";
@@ -81,6 +82,94 @@ export declare function hasClaudeToolsHook(settings: unknown): boolean;
81
82
  * @param hookInput what Claude Code wrote to the hook's stdin
82
83
  */
83
84
  export declare function claudeToolCallHook(hookInput: string): string | undefined;
85
+ export interface ClaudePermitHookOptions {
86
+ /** How the bridge's command line is run, `cogitator bridge` by default */
87
+ bridgeCommand?: string;
88
+ /**
89
+ * The name the bridge gave the session it starts. With it a call the session asks leave for
90
+ * before the bridge has learned its id still belongs to the job it was started for
91
+ */
92
+ agentName?: string;
93
+ /** The folder of the bridge's files, when it is not the default one */
94
+ bridgeHome?: string;
95
+ /** Seconds the hook may wait for the decision before Claude Code ends it, 12 hours by default */
96
+ timeoutS?: number;
97
+ }
98
+ export interface ClaudePermitHookSettings {
99
+ hooks: {
100
+ PermissionRequest: {
101
+ hooks: {
102
+ type: 'command';
103
+ command: string;
104
+ timeout: number;
105
+ }[];
106
+ }[];
107
+ };
108
+ }
109
+ /** The command a hook of a Claude Code session runs to ask leave for a call through the bridge. */
110
+ export declare function claudePermitCommand(options?: ClaudePermitHookOptions): string;
111
+ /**
112
+ * The settings that make a Claude Code session ask leave through the bridge: a
113
+ * `PermissionRequest` hook, which Claude Code runs for every call its mode and rules would
114
+ * show the permission dialog for. The hook takes the call to the bridge and answers with the
115
+ * verdict. They are for a session the bridge starts, where nobody sits to answer the dialog: a
116
+ * session without them waits on its first dialog until its job fails. A session a person opened
117
+ * does not get them, the dialog there is the person's.
118
+ */
119
+ export declare function claudePermitHook(options?: ClaudePermitHookOptions): ClaudePermitHookSettings;
120
+ export interface ClaudeStuckHookOptions {
121
+ /** How the bridge's command line is run, `cogitator bridge` by default */
122
+ bridgeCommand?: string;
123
+ /** The folder of the bridge's files, when it is not the default one */
124
+ bridgeHome?: string;
125
+ }
126
+ export interface ClaudeStuckHookSettings {
127
+ hooks: {
128
+ Notification: {
129
+ matcher: string;
130
+ hooks: {
131
+ type: 'command';
132
+ command: string;
133
+ timeout: number;
134
+ async: true;
135
+ }[];
136
+ }[];
137
+ };
138
+ }
139
+ /**
140
+ * The permission mode of a Claude Code session the bridge starts, unless the adapter is told
141
+ * another: edits inside the folder of the job need no leave, everything else goes by the rules
142
+ * of the project and, where they are silent, through the bridge.
143
+ */
144
+ export declare const CLAUDE_SESSION_MODE = "acceptEdits";
145
+ /** The command a hook of a Claude Code session runs when the session waits for a person. */
146
+ export declare function claudeStuckCommand(options?: ClaudeStuckHookOptions): string;
147
+ /**
148
+ * The settings that tell the bridge a Claude Code session waits for a person at its window: a
149
+ * `Notification` hook for permission prompts, which Claude Code runs when it opens its
150
+ * permission dialog. The hook runs in the background and decides nothing: it only lets the
151
+ * agent that handed the session a job know that the job stands still until a person answers.
152
+ * For the sessions a person opens, where the dialog is theirs.
153
+ */
154
+ export declare function claudeStuckHook(options?: ClaudeStuckHookOptions): ClaudeStuckHookSettings;
155
+ /**
156
+ * What Claude Code wrote to a `Notification` hook when it opened its permission dialog: the
157
+ * session that waits, and what it shows. Undefined for any other input, other notifications
158
+ * included.
159
+ *
160
+ * @param hookInput what Claude Code wrote to the hook's stdin
161
+ */
162
+ export declare function claudeStuckCall(hookInput: string): {
163
+ caller: CallerIdentity;
164
+ what: string;
165
+ } | undefined;
166
+ /**
167
+ * What Claude Code wrote to a `PermissionRequest` hook, as a call to ask leave for: the session,
168
+ * the call, and how to answer Claude Code. Undefined for any other input.
169
+ *
170
+ * @param hookInput what Claude Code wrote to the hook's stdin
171
+ */
172
+ export declare function claudePermissionCall(hookInput: string): PermissionHookCall | undefined;
84
173
  /**
85
174
  * Where Claude Code has the bridge's server of tools for the sessions of a folder: `local`
86
175
  * (this person, this project), `project` (the project's `.mcp.json`) or `user` (this person,
@@ -107,7 +196,11 @@ export interface ClaudeCodeAdapterOptions {
107
196
  bridgeHome?: string;
108
197
  /** The environment of the commands and of the sessions it starts, `process.env` by default */
109
198
  env?: NodeJS.ProcessEnv;
110
- /** The permission mode of the sessions it starts, Claude Code's own default when absent */
199
+ /**
200
+ * The permission mode of the sessions it starts, `acceptEdits` by default: a session changes
201
+ * files in the folder of its job without asking, and asks leave through the bridge for the
202
+ * rest. `default` asks for every change too, `plan` lets it change nothing
203
+ */
111
204
  permissionMode?: string;
112
205
  /** More arguments for `claude --bg`, such as `['--model', 'sonnet']` */
113
206
  sessionArgs?: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EAOd,MAAM,eAAe,CAAC;AAcvB,OAAO,EAAuC,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEjG,qFAAqF;AACrF,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,QAAY,CAAC;AAKhD,MAAM,WAAW,qBAAqB;IACpC,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS,CAAC;gBAChB,OAAO,EAAE,MAAM,CAAC;gBAChB,OAAO,EAAE,MAAM,CAAC;gBAChB,KAAK,EAAE,IAAI,CAAC;gBACZ,WAAW,EAAE,IAAI,CAAC;aACnB,EAAE,CAAC;SACL,EAAE,CAAC;KACL,CAAC;CACH;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,CAY7E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,kBAAkB,CAkBtF;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAQ5D;AAgBD,sGAAsG;AACtG,eAAO,MAAM,mBAA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