@bridge4dev/runner 0.13.1 → 0.26.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 (49) hide show
  1. package/dist/adapters/claude.d.ts +15 -7
  2. package/dist/adapters/claude.js +1024 -70
  3. package/dist/adapters/codex.d.ts +18 -3
  4. package/dist/adapters/codex.js +224 -65
  5. package/dist/adapters/questions.d.ts +42 -0
  6. package/dist/adapters/questions.js +86 -0
  7. package/dist/adapters/types.d.ts +200 -4
  8. package/dist/attachments.d.ts +8 -1
  9. package/dist/attachments.js +22 -4
  10. package/dist/auth-relay.d.ts +33 -3
  11. package/dist/auth-relay.js +199 -16
  12. package/dist/auto-resume.d.ts +18 -0
  13. package/dist/auto-resume.js +104 -0
  14. package/dist/commit-message.d.ts +51 -0
  15. package/dist/commit-message.js +224 -0
  16. package/dist/config.d.ts +29 -6
  17. package/dist/config.js +15 -0
  18. package/dist/crash-note.d.ts +54 -0
  19. package/dist/crash-note.js +105 -0
  20. package/dist/environment.d.ts +171 -0
  21. package/dist/environment.js +409 -0
  22. package/dist/git.d.ts +81 -0
  23. package/dist/git.js +301 -15
  24. package/dist/gitops.d.ts +489 -12
  25. package/dist/gitops.js +1717 -96
  26. package/dist/index.js +715 -8
  27. package/dist/paths.d.ts +35 -0
  28. package/dist/paths.js +45 -0
  29. package/dist/policy.d.ts +63 -0
  30. package/dist/policy.js +412 -10
  31. package/dist/protocol.d.ts +382 -60
  32. package/dist/protocol.js +104 -1
  33. package/dist/recipe-schema.d.ts +310 -0
  34. package/dist/recipe-schema.js +103 -0
  35. package/dist/recipe.d.ts +94 -0
  36. package/dist/recipe.js +238 -0
  37. package/dist/self-update.d.ts +21 -0
  38. package/dist/self-update.js +73 -1
  39. package/dist/service-unit.d.ts +61 -2
  40. package/dist/service-unit.js +150 -14
  41. package/dist/supervisor.d.ts +108 -1
  42. package/dist/supervisor.js +1045 -57
  43. package/dist/verify-queue.d.ts +17 -0
  44. package/dist/verify-queue.js +100 -0
  45. package/dist/verify.d.ts +203 -0
  46. package/dist/verify.js +788 -0
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { JournalStore } from './journal.js';
2
+ import { proposeCommitMessage } from './commit-message.js';
2
3
  import { selfUpdate, type SelfUpdateOutcome } from './self-update.js';
3
4
  import type { RunnerWsClient } from './ws-client.js';
4
5
  import type { SessionDescriptor } from './protocol.js';
@@ -30,6 +31,14 @@ export interface SupervisorOptions {
30
31
  * machine's owner decides how much of their machine an agent fleet may take.
31
32
  */
32
33
  maxSessionsLimit?: number;
34
+ /**
35
+ * `[verify] enabled` from the runner's own config (session 14). The machine's
36
+ * owner has the last word on whether project recipes run here at all;
37
+ * `false` means the capability is not announced and no run can be started.
38
+ */
39
+ verifyEnabled?: boolean;
40
+ /** Test seam for the one-shot commit-message run. */
41
+ proposeCommitMessage?: typeof proposeCommitMessage;
33
42
  }
34
43
  export declare class Supervisor {
35
44
  private readonly ws;
@@ -54,10 +63,32 @@ export declare class Supervisor {
54
63
  private readonly repoLocks;
55
64
  /** An update is installing right now — a second one would fight it. */
56
65
  private selfUpdateInFlight;
66
+ /** Session 14: one project-recipe run per machine, and its verdict queue. */
67
+ private readonly verify;
68
+ private readonly verifyReports;
57
69
  constructor(ws: RunnerWsClient, opts: SupervisorOptions);
70
+ /**
71
+ * Push every unacked verdict at the API.
72
+ *
73
+ * Called on each reconnect and whenever a run finishes. Sending a report the
74
+ * API already has is harmless — it is keyed by `runId` and stored idempotently
75
+ * — while not sending one is a verdict that never existed.
76
+ */
77
+ private flushVerifyReports;
58
78
  get activeSessionIds(): string[];
59
79
  private onFrame;
60
80
  private startSession;
81
+ /**
82
+ * Where this session is going to work — a worktree of its own, or the project
83
+ * folder itself (session 16).
84
+ *
85
+ * The BRANCH path takes the repo lock because `worktree add` writes into the
86
+ * shared `.git` (registration + prune), exactly like commit/apply/revert. The
87
+ * DIRECT path takes none: it only READS which branch a folder is on, and
88
+ * queueing every session start behind whatever merge happens to be running
89
+ * would be a lock bought for nothing.
90
+ */
91
+ private prepareWorkspace;
61
92
  /**
62
93
  * Spin the adapter up — for a fresh session, a resume-on-next-message, or a
63
94
  * free CHAT session with no prompt at all (the agent boots, reports its
@@ -100,6 +131,23 @@ export declare class Supervisor {
100
131
  */
101
132
  private pauseForBudget;
102
133
  private pumpEvents;
134
+ /**
135
+ * "…and N of them are waiting for an answer from you."
136
+ *
137
+ * An open question pins its slot deliberately (`isParkable`), so a message
138
+ * that blames a running turn sends the user to wait for something that will
139
+ * never happen. Empty when nothing is waiting.
140
+ */
141
+ private waitingForAnswerSuffix;
142
+ /**
143
+ * Close out every ask this session still has open, with a stated cause.
144
+ *
145
+ * Idempotent: the adapter reports its own `question_resolved` when it can, and
146
+ * `forwardEvent` clears the id — so by the time this runs the set is usually
147
+ * already empty. What it catches is the path where the adapter never got the
148
+ * chance, and the alternative there is a card that stays clickable forever.
149
+ */
150
+ private withdrawOpenQuestions;
103
151
  /**
104
152
  * Deliver messages that were held because every slot was taken.
105
153
  *
@@ -140,10 +188,27 @@ export declare class Supervisor {
140
188
  * returns false and the caller tells the user rather than thrashing.
141
189
  */
142
190
  private ensureCapacity;
143
- /** Idle after a finished turn — safe to kill the process and resume later. */
191
+ /**
192
+ * Idle after a finished turn — safe to kill the process and resume later.
193
+ *
194
+ * An open question is the exception (session 12): WAITING_INPUT there does
195
+ * NOT mean "the turn is over", it means the agent's tool call is parked on a
196
+ * human. Parking such a session killed a live turn — and, worse, killed the
197
+ * card the user was about to answer — the moment another session wanted a
198
+ * slot.
199
+ */
144
200
  private isParkable;
145
201
  private park;
146
202
  private forwardEvent;
203
+ /**
204
+ * The dashboard's answer to a parked question (session 12).
205
+ *
206
+ * A miss is reported in the feed rather than swallowed: the three cases that
207
+ * get here — a card from a previous life of the session, a second click, an
208
+ * ask the runner already withdrew — all look identical to the user unless
209
+ * somebody says so.
210
+ */
211
+ private onQuestionAnswer;
147
212
  private onUserMessage;
148
213
  /**
149
214
  * Run delivery work for one session, strictly after whatever is already
@@ -212,5 +277,47 @@ export declare class Supervisor {
212
277
  /** Graceful daemon shutdown: kill agents, keep sessions resumable server-side. */
213
278
  shutdown(): void;
214
279
  }
280
+ /**
281
+ * The first message the agent gets.
282
+ *
283
+ * Two shapes, and the difference is whether tickets were handed over
284
+ * (session 16, owner's decision):
285
+ *
286
+ * - **No tickets** — exactly what the human typed, and an empty prompt stays
287
+ * empty. That is how you get a session that boots and waits for you to talk
288
+ * first; it is a feature, not an oversight.
289
+ * - **Tickets handed to a TICKET session** — the assignment is always sent and
290
+ * cannot be removed: «Implement ticket #28.» Handing a ticket over IS the
291
+ * instruction, so making the human retype it was ceremony. Anything they
292
+ * typed follows underneath.
293
+ *
294
+ * What is NOT here any more: eight lines about which MCP tools to call and
295
+ * which statuses to move through. That is a standing convention of the project,
296
+ * true on the twentieth turn as much as the first, so it moved to the system
297
+ * prompt beside `CLAUDE.md` — which is read last and therefore overrides ours.
298
+ */
215
299
  export declare function composeInitialPrompt(descriptor: SessionDescriptor): string;
300
+ /**
301
+ * Extra system-prompt material: where this session is in git, and how tickets
302
+ * are meant to move (session 13).
303
+ *
304
+ * Facts about THIS SESSION, and nothing else. They exist in no file on disk —
305
+ * which branch the agent is on, that it must not push, where a plan belongs,
306
+ * what to do with the tickets it was given — so somebody has to say them, and
307
+ * that somebody is us.
308
+ *
309
+ * The project's own documentation is deliberately NOT here. Both agents read
310
+ * their own file natively, verified live: Claude picks up `CLAUDE.md` through
311
+ * its memory mechanism (since `settingSources` includes `'project'`), and Codex
312
+ * picks up `AGENTS.md` even under the runner's isolated `CODEX_HOME`. Pasting a
313
+ * copy on top of that was work we were doing for no one — and when it was
314
+ * switched off for Claude alone it briefly left repositories that carry only
315
+ * `AGENTS.md` with nothing at all, which is precisely the kind of hole a
316
+ * half-measure digs.
317
+ *
318
+ * A repository that wants both agents equipped ships both files, or symlinks
319
+ * one to the other. That is a repository convention and not something a runner
320
+ * should paper over.
321
+ */
322
+ export declare function composeWorkspaceContext(descriptor: SessionDescriptor): string;
216
323
  //# sourceMappingURL=supervisor.d.ts.map