sessionpipe 0.12.0 → 0.13.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.
@@ -0,0 +1,43 @@
1
+ import { type LocalReply, type LocalRequest } from "./local.js";
2
+ /** Said once, in the server's MCP instructions: who writes, and how to answer. */
3
+ export declare const CHANNEL_INSTRUCTIONS: string;
4
+ /** Whether the Claude Code that runs this server took it as a channel: `server:<name>`,
5
+ * or a plugin of that name, follows `--channels` or
6
+ * `--dangerously-load-development-channels` on the command line of an interactive
7
+ * session. The handshake doesn't say (2.1.312 sends a channel and a plain server the
8
+ * same initialize), and Claude Code drops a notification from a server it didn't take,
9
+ * in silence: parked there, this server would swallow every message sent to the
10
+ * session. */
11
+ export declare function namedAsChannel(argv: string[], name: string): boolean;
12
+ /** The parent process's command line, word by word (a channel entry holds no space);
13
+ * nothing when it can't be read, as on Windows. */
14
+ export declare function parentArgv(ppid?: number): string[];
15
+ /** The answer to one message from Claude Code: initialize says this server is a
16
+ * channel, ping and the (empty) tool list are answered, any other request is "method
17
+ * not found", and a notification, or a line that isn't a request, gets nothing.
18
+ * Claude Code 2.1.312 asks `server/discover` (MCP 2026-07-28) first: "not found" keeps
19
+ * it on initialize, whose stdio stream carries the notifications a channel sends
20
+ * unasked. */
21
+ export declare function answer(msg: unknown, version: string): Record<string, unknown> | null;
22
+ /** A waiter's message as a channel notification: the person's words are the content;
23
+ * where they came from and the message's id become attributes of the <channel> tag. */
24
+ export declare function notification(text: string, id: string): Record<string, unknown>;
25
+ export interface ChannelOptions {
26
+ version: string;
27
+ env?: NodeJS.ProcessEnv;
28
+ /** Whether Claude Code took this server as a channel: never park otherwise. */
29
+ registered: () => boolean;
30
+ /** Said to Claude Code's log of this server (its stderr). */
31
+ log?: (line: string) => void;
32
+ /** How long to wait before parking again, after the daemon went away or a
33
+ * `sessionpipe wait` for the same session took over. */
34
+ retryMs?: number;
35
+ /** The local socket's one request, one reply (tests stand a daemon in for it). */
36
+ ask?: (sock: string, req: LocalRequest, timeoutMs: number) => Promise<LocalReply | null>;
37
+ }
38
+ /** Serve one session's channel: MCP over `input` and `write`, and the session's waiter
39
+ * on the daemon's socket. Parking starts when Claude Code says the connection is
40
+ * initialized, so no message goes out before the session can take it. Resolves when
41
+ * `input` ends (Claude Code closed the server). */
42
+ export declare function runChannel(session: string, input: NodeJS.ReadableStream, write: (line: string) => void, o: ChannelOptions): Promise<void>;
43
+ //# sourceMappingURL=channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/control/channel.ts"],"names":[],"mappings":"AAeA,OAAO,EAAO,KAAK,UAAU,EAAE,KAAK,YAAY,EAAc,MAAM,YAAY,CAAC;AAGjF,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,QAGnB,CAAC;AAef;;;;;;eAMe;AACf,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAapE;AAED;oDACoD;AACpD,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAqB,GAAG,MAAM,EAAE,CAGhE;AAED;;;;;eAKe;AACf,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAsBpF;AAED;wFACwF;AACxF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO9E;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,6DAA6D;IAC7D,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B;6DACyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC1F;AAED;;;oDAGoD;AACpD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,CAAC,cAAc,EAC5B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAC7B,CAAC,EAAE,cAAc,GAChB,OAAO,CAAC,IAAI,CAAC,CAyCf"}
@@ -1,5 +1,5 @@
1
1
  import { type Tier } from "@sessionpipe/core";
2
- export declare const CONTROL_HELP = " sessionpipe control pair <receiver> [--folder DIR]\u2026 [--mode safe|auto|inherit] [--tier 0-3] [--token T] [--name N] [--no-service]\n sessionpipe control mode auto|safe|inherit (how sessions run when you message them)\n sessionpipe control folders [add|remove DIR\u2026] (where sessions you message may run)\n sessionpipe control status | keys [remove <id>] | off [<receiver>] | run\n sessionpipe wait [--session <harness>:<id>] (a session runs this in the background)";
2
+ export declare const CONTROL_HELP = " sessionpipe control pair <receiver> [--folder DIR]\u2026 [--mode safe|auto|inherit] [--tier 0-3] [--token T] [--name N] [--no-service]\n sessionpipe control mode auto|safe|inherit (how sessions run when you message them)\n sessionpipe control folders [add|remove DIR\u2026] (where sessions you message may run)\n sessionpipe control status | keys [remove <id>] | off [<receiver>] | run\n sessionpipe wait [--session <harness>:<id>] (a session runs this in the background)\n sessionpipe channel [--session claude-code:<id>] [--name N] (Claude Code runs this as a channel)";
3
3
  /** `control folders add|remove`: the new list, and a line per folder saying what became
4
4
  * of it. A folder to add must exist and be a project, never the home folder or above
5
5
  * it (pair's rule); folders are compared as real paths, as the daemon compares them. */
@@ -17,6 +17,18 @@ export declare function enabledHarnesses(harnesses: Record<string, {
17
17
  * real environment can send pooled requests (bearers included) anywhere else. */
18
18
  export declare function testUpstream(env: NodeJS.ProcessEnv): string | null;
19
19
  export declare function waitMain(argv: string[], out: (s?: string) => void): Promise<void>;
20
+ /** The process as `sessionpipe channel` uses it. Stdout is the MCP connection, so
21
+ * anything said to the person goes to stderr. */
22
+ export declare const channelIo: {
23
+ input: () => NodeJS.ReadableStream;
24
+ write: (s: string) => void;
25
+ err: (s: string) => void;
26
+ exit: (code: number) => void;
27
+ };
28
+ /** `sessionpipe channel`. `--name` is the name the server was added under, if not
29
+ * `sessionpipe`: the session's `--channels` list names it so. It ends when Claude Code
30
+ * closes the server, whether or not a wait is parked on the daemon. */
31
+ export declare function channelMain(argv: string[], io: typeof channelIo, parent?: () => string[]): Promise<void>;
20
32
  /** Give a sink the key a receiver handed over at pairing. A sink for the receiver that
21
33
  * has a key keeps it ("kept"); one without a key gets this one ("filled"); otherwise a
22
34
  * new sink at `tier` ("added"). */
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/control/cli.ts"],"names":[],"mappings":"AAKA,OAAO,EAWL,KAAK,IAAI,EAEV,MAAM,mBAAmB,CAAC;AA0B3B,eAAO,MAAM,YAAY,kfAIkE,CAAC;AAuD5F;;yFAEyF;AACzF,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,EAAE,EAAE,KAAK,GAAG,QAAQ,EACpB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,SAAe,GAClB;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAkCvC;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkK3G;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC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AC,GAAG,MAAM,EAAE,CAK3F;AAwKD;;kFAEkF;AAClF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,CASlE;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CASvF;AAED;kDACkD;AAClD,eAAO,MAAM,SAAS;IACpB,KAAK,QAAM,MAAM,CAAC,cAAc;IAChC,KAAK,MAAM,MAAM,KAAG,IAAI;IACxB,GAAG,MAAM,MAAM,KAAG,IAAI;IACtB,IAAI,SAAS,MAAM,KAAG,IAAI;CAC3B,CAAC;AAEF;;wEAEwE;AACxE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,EAAE,OAAO,SAAS,EACpB,MAAM,GAAE,MAAM,MAAM,EAAe,GAClC,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;oCAEoC;AACpC,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CASjH"}
@@ -1,8 +1,10 @@
1
1
  import { claudeControl, type HarnessAccount, type Login, type RunOptions, type RunResult } from "@sessionpipe/core";
2
2
  import { type RunLevel, type StartPermission } from "@sessionpipe/core/control";
3
3
  import type { Pool } from "../pool/index.js";
4
+ import * as inbox from "./inbox.js";
5
+ import { type AskRequest } from "./local.js";
4
6
  import { type DeliveryMode } from "./route.js";
5
- import { type ControlConfig, type PairedReceiver } from "./store.js";
7
+ import { type Ack, type ControlConfig, type PairedReceiver } from "./store.js";
6
8
  type Caps = claudeControl.Caps;
7
9
  /** One harness's entry in the hello's `start` (CONTROL.md §2). */
8
10
  export interface StartEntry {
@@ -60,8 +62,38 @@ export interface SdkHost {
60
62
  model?: string;
61
63
  configDir?: string;
62
64
  allowedTools?: string[];
65
+ /** Over the process's own: an ask's lineage for the session's hooks (CONTROL.md §13). */
66
+ env?: Record<string, string>;
63
67
  }): SdkSession;
64
68
  }
69
+ /** Where a command's acks go, besides a paired receiver (store.ts PairedReceiver: the ack
70
+ * outbox, then `POST /ack`): an asker on the local socket (CONTROL.md §13) or a handoff's
71
+ * relay (§6 `reply_to`), each a sink of the daemon's own. The start, prompt and headless
72
+ * paths are written once, against a Caller, so a run acks the same way wherever it came
73
+ * from and there is no second copy of any of them. */
74
+ export interface AckSink {
75
+ /** Names it in the log and the acks' `receiver`. */
76
+ label: string;
77
+ /** The text as the session gets it: a new session's first message, or a later one. */
78
+ frame(text: string, first: boolean): string;
79
+ /** What a child the run starts gets in its environment, over the job's own. */
80
+ env?: Record<string, string>;
81
+ /** The answer so far (§10 `progress`), redacted and capped like an ack's reply. */
82
+ progress(text: string, seq: number): void;
83
+ /** `taken`, then exactly one final outcome: the acks a receiver would get. */
84
+ ack(a: Omit<Ack, "receiver">): void;
85
+ /** False when the message reaching the session is the whole job and its reply isn't
86
+ * waited for (a relay). */
87
+ wantsReply: boolean;
88
+ }
89
+ /** An ask's fields as the wire has them (local.ts), checked before any rule: what is
90
+ * wrong, in words, or null. The CLI builds them, but the socket takes any process of
91
+ * the person's own, so nothing here is trusted by shape. */
92
+ export declare function askProblem(req: AskRequest): string | null;
93
+ /** A run's refusal (CONTROL.md §5, §6) in the ask's own words (§13): a session the daemon
94
+ * can't deliver to falls under the `harness` rule, a level or model it won't run with is
95
+ * the request's own fault; the start caps keep their name. */
96
+ export declare const askCode: (code: string | undefined) => string;
65
97
  export interface DaemonDeps {
66
98
  now: () => number;
67
99
  fetch: typeof fetch;
@@ -93,6 +125,10 @@ export interface DaemonDeps {
93
125
  codexModels?: () => string[];
94
126
  run: (bin: string, args: string[], o: RunOptions) => Promise<RunResult>;
95
127
  sdk?: SdkHost | null;
128
+ /** How a message is written into a live session's own inbox (inbox.ts). A test passes
129
+ * its own, to drive the one refusal that can only happen between the look and the
130
+ * first byte: the session ending in between. */
131
+ writeInbox?: typeof inbox.writeInbox;
96
132
  /** How long to follow a live session's turn for an in-place answer (tests shorten it). */
97
133
  answerWaitMs?: number;
98
134
  /** Close an SDK session idle this long (a held session costs ~300 MB). */
@@ -158,6 +194,11 @@ export interface Status {
158
194
  delivered: Record<string, number>;
159
195
  /** What a start may carry per harness, as the last hello said (CONTROL.md §2). */
160
196
  start: Record<string, StartEntry>;
197
+ /** Whether a session here may ask another agent, and which agents (CONTROL.md §13). */
198
+ ask: {
199
+ on: boolean;
200
+ harnesses: string[];
201
+ };
161
202
  /** Null when the daemon could restart now (nothing in hand); otherwise what it holds. */
162
203
  busy: string | null;
163
204
  update?: unknown;
@@ -185,6 +226,7 @@ export declare const LIMITS: {
185
226
  readonly startConcurrent: 2;
186
227
  readonly startPerHour: 10;
187
228
  readonly headless: 3;
229
+ readonly copiesPerDay: 10;
188
230
  };
189
231
  export declare class ControlDaemon {
190
232
  private cfg;
@@ -200,6 +242,23 @@ export declare class ControlDaemon {
200
242
  private readonly inflight;
201
243
  private readonly queues;
202
244
  private readonly lastEnd;
245
+ /** Per session: who is waiting for its next `UserPromptSubmit` — the first half of an
246
+ * in-place delivery's proof. At most ONE per session: two waiters would both be
247
+ * settled by one turn, and that turn's answer acked as the answer to both. */
248
+ private readonly prompted;
249
+ /** Per session: a message written into its own inbox that it has not taken yet. The
250
+ * receiving inbox parks one whose class it can't match and drops it after five
251
+ * minutes, and a hold can be RELEASED later (a mode change does it), so for that long
252
+ * another write would mean the person's words arriving twice (CONTROL.md §6.3). */
253
+ private readonly parked;
254
+ /** `sessionpipe channel` processes that took a message and no turn began for it:
255
+ * Claude Code drops a channel's notification in silence when it didn't register the
256
+ * channel (a `--print` session, an organization that turns channels off), so this one
257
+ * would swallow every message after it too. A new channel process starts trusted. */
258
+ private readonly mutedChannels;
259
+ /** Things said once in the log however many acks carry them (a mode the settings turn
260
+ * off): the person reads the ack, the machine's log doesn't need it every time. */
261
+ private readonly warned;
203
262
  private state;
204
263
  private running;
205
264
  private readonly polling;
@@ -237,6 +296,14 @@ export declare class ControlDaemon {
237
296
  * for that session that came in the same poll waits for its start rather than
238
297
  * finding no session (2026-10-04: a start and a prompt queued back to back). */
239
298
  private readonly startsPending;
299
+ /** Commands with `reply_to` in hand, by message id: their reply follows into that
300
+ * session after their own final ack (CONTROL.md §6). */
301
+ private readonly handoffs;
302
+ /** Asks in hand, by ask id: who asked whom. The depth and loop rules (§13) count from
303
+ * here as well as from the chain the caller reports, which is the caller's own to
304
+ * clear: B, asked by A, can't ask A back from a clean environment, and C, asked by B
305
+ * under A, can't ask on by forgetting its chain. */
306
+ private readonly asks;
240
307
  constructor(cfg: ControlConfig, dir: string, sock: string, deps: DaemonDeps);
241
308
  start(): Promise<void>;
242
309
  /** `leaveSocket`: the socket path is another daemon's now. Closing a Unix-socket
@@ -282,6 +349,7 @@ export declare class ControlDaemon {
282
349
  private scheduleHello;
283
350
  /** Read each receiver's well-known for its session tools (at start, then with every hello). */
284
351
  private refreshSessionTools;
352
+ /** A receiver's own MCP servers; an ask or a relay brings none. */
285
353
  private allowedFor;
286
354
  private helloAll;
287
355
  private post;
@@ -298,6 +366,15 @@ export declare class ControlDaemon {
298
366
  * (the harness's id and the start's folder); one the hooks reported is Codex's
299
367
  * rollout (its `session_meta` cwd) or, for the others, the folder its hooks gave. */
300
368
  private placeDriven;
369
+ /** Keep what a session's own hooks said its permission mode is (CONTROL.md §6, The
370
+ * session's mode). The latest word wins, and a mode this daemon has no meaning for
371
+ * is not kept at all.
372
+ *
373
+ * The compare and the write are one step of this process's own event loop — one
374
+ * daemon serves a machine, and it is the one holding the socket — so a burst of hook
375
+ * events cannot interleave a read with a write; and an unchanged mode writes nothing,
376
+ * which matters because a hook fires for every tool call of every session. */
377
+ private recordMode;
301
378
  /** The folder the worker recorded for a session from its hooks (run.ts, facts). */
302
379
  private factsCwd;
303
380
  /** A driven harness, as the person knows it. */
@@ -342,12 +419,67 @@ export declare class ControlDaemon {
342
419
  private allowed;
343
420
  private permission;
344
421
  private cancel;
422
+ /** The permission mode a session's own hooks last reported, or null. Keyed by the
423
+ * session ref the hooks report under, which for a copy is the copy's own. */
424
+ private modeOf;
425
+ /** The permission class THIS MACHINE would declare to a session in `configDir`
426
+ * (CONTROL.md §6.3) — never the target's own, which it would then be echoing back,
427
+ * leaving the receiver's own check with nothing to compare.
428
+ *
429
+ * `bypass` only where the person set this machine to `inherit`, so nothing here picks
430
+ * a mode at all, and that account's own default is bypass and is allowed to be. Every
431
+ * other machine is `prompting`: on `safe` and `auto` the daemon names a mode of its
432
+ * own for the runs it starts, so it is not a machine that leaves sessions as it finds
433
+ * them. */
434
+ private machineClass;
435
+ /** What the `inbox` lane found when it looked at this session, BEFORE anything was
436
+ * written (CONTROL.md §6.3): the one process that holds it and the class to declare,
437
+ * or why not. `null` means the lane does not apply at all.
438
+ *
439
+ * EVERY reason not to write belongs here rather than at the write site: a refusal
440
+ * found here leaves `inbox` out of the ladder, so the message takes the next rung,
441
+ * while one found after the lane was chosen would end the message. */
442
+ private inboxLook;
443
+ /** A write into this session's inbox that it has not taken, inside the receiving
444
+ * inbox's own hold window. Kept in the daemon's state, not in memory: an update
445
+ * restarts the daemon, and a resend inside the window would otherwise put a second
446
+ * copy of the person's words in the same inbox (CONTROL.md §6.3). */
447
+ private parkedFor;
448
+ /** How long ago that message was written. `park` writes the stamp and `readState`
449
+ * admits only one that parses, so there is no third answer. */
450
+ private heldFor;
451
+ private park;
452
+ private unpark;
453
+ /** The daemon's own state, written where a restart will read it again. A failure is
454
+ * logged and nothing else: it costs a record, never a delivery. */
455
+ private saveState;
456
+ /** Resolves true when this session begins a turn of its own within `ms` — the first
457
+ * half of the proof that a message written to its inbox became a prompt (§6.3). Null
458
+ * when one message is already waiting on this session's next turn. */
459
+ private awaitPrompted;
460
+ /** Did the session take the message that was just handed over, or only begin some
461
+ * other turn? `UserPromptSubmit` says a turn began; it carries no text, so the proof
462
+ * that it is OUR turn is the row the harness wrote for it — a `user` row whose origin
463
+ * is a peer (the inbox) or a channel (`sessionpipe channel`), carrying this message's
464
+ * own mark. Anything else (the person typing in the same second, another local
465
+ * process's message) means the message is still parked, and the answer to THEIR
466
+ * prompt must not be sent back as the answer to this one. */
467
+ private tookIt;
468
+ /** A parked waiter that may take a message now. `sessionpipe wait` always may: the
469
+ * session asked for it. A channel only while the session is idle, and never one that
470
+ * already swallowed a message (CONTROL.md §8): Claude Code folds a channel message that
471
+ * arrives during a turn into that turn as a queued command, which the model need not
472
+ * answer (on 2.1.314 it didn't), so a running turn takes the message at its Stop. */
473
+ private waiterFits;
345
474
  private view;
346
475
  private prompt;
347
476
  /** One message through a held session; one whose process left is let go of, so the
348
477
  * next message reopens the session instead of finding it closed. */
349
478
  private sendHeld;
350
- /** A turn message whose Stop never took it: route again, now that it isn't mid-turn. */
479
+ /** A turn message whose Stop never took it: route again, now that it isn't mid-turn.
480
+ * In the session's own delivery queue, like every other prompt — two messages
481
+ * rerouted at one Stop would otherwise both take an in-place lane at once, and one
482
+ * turn's answer would be acked as the answer to both. */
351
483
  private reroute;
352
484
  /** Jobs for one session (and its copy) run one at a time, in order. */
353
485
  private serial;
@@ -367,6 +499,14 @@ export declare class ControlDaemon {
367
499
  * becomes its alias, so the next message resumes it. */
368
500
  private drive;
369
501
  private headless;
502
+ /** What the ack says about the mode a cold run turned out to have (CONTROL.md §6
503
+ * `prompt`): what the new turn's own row recorded, which is what it ran in rather
504
+ * than what was asked for — and, on a machine set to auto whose Claude Code has auto
505
+ * turned off, that the turn ran in Manual mode and what fixes it. */
506
+ private ranNote;
507
+ /** Why no copy may be made right now, or null. A copy replays a whole conversation, so
508
+ * the machine caps them itself whatever a receiver sends. */
509
+ private copyLimit;
370
510
  private outcome;
371
511
  private addKey;
372
512
  /** Where the session's transcript ends right now: its answer starts after this. */
@@ -408,6 +548,53 @@ export declare class ControlDaemon {
408
548
  * is acked `failed` with code `file`, nothing is kept, no session starts and no
409
549
  * message is delivered. */
410
550
  private attached;
551
+ /** The text as the session gets it: a receiver's framing (route.ts), or the sink's own. */
552
+ private framed;
553
+ /** What a child run gets in its environment beyond the job's: its lineage, for its
554
+ * hooks to stamp `delegated_by` (§13). An ask's sink says who asked; a receiver's
555
+ * command with `reply_to` was asked, as far as the child knows, by that session (§6). */
556
+ private childEnv;
557
+ /** An ask's `permission` on a prompt (CONTROL.md §13; an ask always names one, safe
558
+ * unless it says read) caps the run of the session it names: narrower than the
559
+ * session's own level, never wider. A receiver's prompt carries none (the verifier
560
+ * refuses it), so this leaves it alone. */
561
+ private capped;
562
+ /** The agents an ask may start here: the hello's harnesses that run headlessly. */
563
+ private askable;
564
+ /** A session under the name the daemon itself knows it by: the copy a Claude Code
565
+ * session's later runs moved to, the id a driven harness picked behind the daemon's
566
+ * alias — so a Codex session asked under its start's name and asking under its own
567
+ * rollout id is one session to the depth and loop rules. */
568
+ private realRef;
569
+ /** How many asks in hand `from` is already answering: the ask that targets it, the
570
+ * one that targets that ask's asker, and so on up. Nothing for nobody's session. */
571
+ private askDepth;
572
+ /** `sessionpipe ask`: a session on this machine hands a task to another agent and gets
573
+ * the answer back on this connection. The trust boundary is the socket's, the one
574
+ * `wait` and the hooks cross (a process of the person's own user); nothing a receiver
575
+ * sends gets here. Every rule in order, each with its own refusal; then the run goes
576
+ * down the same start and prompt paths a receiver's command takes, acked to the
577
+ * socket, and its events go on the asking session. */
578
+ private onAsk;
579
+ /** The asker's end of an ask: the run's acks as the wire replies (local.ts), in order
580
+ * and exactly one final; the child's environment and framing; the events on the
581
+ * asking session when it is known. The connection is closed after the final reply. */
582
+ private askSink;
583
+ /** A command with `reply_to`: remembered until its final ack (finish()), and announced
584
+ * on the session that gets the answer, as an ask is on the session that asked. */
585
+ private handoff;
586
+ /** The reply into `reply_to`, once the command's own final ack is out: framed as a
587
+ * handoff's answer and routed like any message (§6 modes, the folder rule, never a
588
+ * resume of a live session), acked to a sink that only notes how it went. Then
589
+ * delegation.ended on `reply_to`, `relayed` saying delivered, unsupported or failed. */
590
+ private relay;
591
+ /** delegation.started / delegation.ended (PROTOCOL.md §4) on a session here, the way a
592
+ * hook's events travel (run.ts runJob): the session block the worker last saved, a seq
593
+ * of its own from the outbox under the session's lock, redacted at rest, then every
594
+ * sink drained from its cursor. Best effort: a lock that stays taken or a disk that
595
+ * won't write is logged, never a reason to hold the ask or the relay. */
596
+ private emitDelegation;
597
+ private record;
411
598
  private closeIdleSdk;
412
599
  }
413
600
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/control/daemon.ts"],"names":[],"mappings":"AAcA,OAAO,EAIL,aAAa,EAGb,KAAK,cAAc,EAInB,KAAK,KAAK,EAEV,KAAK,UAAU,EACf,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAM7C,OAAO,EAAE,KAAK,YAAY,EAA6D,MAAM,YAAY,CAAC;AAC1G,OAAO,EAGL,KAAK,aAAa,EAIlB,KAAK,cAAc,EAMpB,MAAM,YAAY,CAAC;AAcpB,KAAK,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;AA+B/B,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,sFAAsF;IACtF,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAsDD,6DAA6D;AAC7D,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAA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AAK;IA4DnB;;;;8EAI0E;IAC1E,OAAO,CAAC,cAAc;YAaR,MAAM;IAwCpB,OAAO,CAAC,YAAY;CAWrB"}
@@ -0,0 +1,119 @@
1
+ import net from "node:net";
2
+ import type { claudeControl } from "@sessionpipe/core";
3
+ type LiveRecord = claudeControl.LiveRecord;
4
+ /** The only inbox protocol this code speaks. */
5
+ export declare const PEER_PROTOCOL = 1;
6
+ /** How long the daemon waits for the session's own turn to begin before it says the
7
+ * message may be held (measured deliveries were sub-second; 340 ms end to end). */
8
+ export declare const CONFIRM_MS = 8000;
9
+ /** A registry row has to say this before anything is written: a message written into a
10
+ * running turn joins that turn, which is the `turn` lane's job, not this one's. */
11
+ export declare const IDLE_STATUS = "idle";
12
+ /** What a registry row says about a session Claude Code holds open for the person. Every
13
+ * row that publishes an inbox carries it — terminal windows and claude.ai bridge workers
14
+ * alike, 47 of 47 measured — and a row that doesn't is not ours to write to, since a
15
+ * registry row is a file any process of this uid can write. A desktop-app session
16
+ * publishes no inbox at all (none in three sweeps of 47–53 rows), so it is refused here
17
+ * like anything else without one. */
18
+ export declare const INTERACTIVE_KIND = "interactive";
19
+ export type PeerClass = "bypass" | "prompting";
20
+ /** What an envelope says, or null when the text is not one. */
21
+ export declare function readEnvelope(s: string): {
22
+ attrs: Record<string, string>;
23
+ body: string;
24
+ } | null;
25
+ /** The envelope to write, or null when this message cannot be put in one that reads
26
+ * back as itself — a body that closes the tag early, say. The round trip is the check:
27
+ * the receiver parses what it is sent by rebuilding it, so anything that does not
28
+ * come back byte for byte would be parked unread rather than refused out loud. */
29
+ export declare function envelope(o: {
30
+ fromName?: string;
31
+ fromMode: PeerClass;
32
+ body: string;
33
+ }): string | null;
34
+ /** Who the message is from, for `from-name`: the board the person typed it on, by the
35
+ * receiver's own host. The session's window shows it, so it is cleaned to what can sit
36
+ * in an attribute and read as a name — no quotes or angle brackets to break out of the
37
+ * envelope, no control or formatting characters to hide what it says, and short. */
38
+ export declare function senderName(receiver: string): string;
39
+ export declare const cleanName: (s: string) => string;
40
+ /** Why this live session may not be written to, or null when it may. Everything here is
41
+ * read before the first byte (rule 2 above), and every refusal means the lane does not
42
+ * apply — the message takes the next rung, which is not the same as failing. */
43
+ export declare function vetInbox(rec: LiveRecord | null, o: {
44
+ /** The session's own permission class, from the mode its hooks reported. */
45
+ sessionClass: PeerClass | null;
46
+ /** The class this machine would declare. The two must be equal: a declaration the
47
+ * receiver cannot match is parked, and one it can is still only a declaration. */
48
+ machineClass: PeerClass | null;
49
+ /** The account the session's transcript was resolved in: the lane never crosses one. */
50
+ configDir?: string;
51
+ uid?: number | undefined;
52
+ platform?: NodeJS.Platform;
53
+ /** The process's real start time, to compare with the registry's. Null when it
54
+ * can't be read, which is not by itself a refusal. */
55
+ procStart?: string | null;
56
+ alive?: (pid: number) => boolean;
57
+ stat?: (p: string) => {
58
+ isSocket: boolean;
59
+ uid: number;
60
+ } | null;
61
+ /** The inbox's auth token, asked for only off macOS, where the inbox cannot vet a
62
+ * peer by its uid. Read HERE, before the lane is chosen: no key, no lane. */
63
+ token?: (() => string | null) | undefined;
64
+ }): {
65
+ code: string;
66
+ detail: string;
67
+ } | null;
68
+ /** The same process, as two start times that may be spelled differently. Claude Code
69
+ * writes `procStart` in UTC; a `ps` reading it back says the same instant, and this
70
+ * accepts that instant however it is punctuated. Only a DIFFERENT instant is a
71
+ * recycled pid. */
72
+ export declare function sameStart(a: string, b: string): boolean;
73
+ /** The process's start time in the spelling the registry uses (`procStart`), so a
74
+ * recycled pid can be told from the process that filed the row. Best effort: a `ps`
75
+ * this platform spells differently is "don't know", not a refusal. */
76
+ export declare function procStartOf(pid: number, run?: (pid: number) => string): string | null;
77
+ /** The token that lets a line in where the inbox asks for one (`<pid>.<sha>.key`, the
78
+ * same uid, 0600). macOS vets the peer's uid instead and needs none. */
79
+ export declare function peerToken(rec: LiveRecord): string | null;
80
+ export type WriteResult = {
81
+ written: true;
82
+ bytes: number;
83
+ } | {
84
+ code: string;
85
+ detail: string;
86
+ };
87
+ /** Write ONE message into a live session's inbox and nothing else. `priority: "later"`
88
+ * on purpose: the message becomes a turn of its own rather than joining one in flight.
89
+ *
90
+ * Vetting happens here too, before the socket is opened; once a byte is written the
91
+ * result is `written`, whatever the session then does with it — the caller confirms
92
+ * delivery by the row the session writes for the turn, and never falls through to
93
+ * another lane. No `session_id` is sent: the measured deliveries carried none, and the
94
+ * one process that holds the session is already settled by the registry row and its
95
+ * start time. */
96
+ export declare function writeInbox(rec: LiveRecord | null, o: {
97
+ /** The text the person typed, already framed for the session (route.ts). */
98
+ body: string;
99
+ /** Who it is from, as the session's window shows it (`senderName`). */
100
+ fromName?: string;
101
+ sessionClass: PeerClass | null;
102
+ machineClass: PeerClass | null;
103
+ configDir?: string;
104
+ timeoutMs?: number;
105
+ /** Off macOS: the inbox may ask for this first. Read with `peerToken`. */
106
+ token?: string | null;
107
+ platform?: NodeJS.Platform;
108
+ procStart?: string | null;
109
+ /** Test seams. */
110
+ uid?: number | undefined;
111
+ alive?: (pid: number) => boolean;
112
+ stat?: (p: string) => {
113
+ isSocket: boolean;
114
+ uid: number;
115
+ } | null;
116
+ connect?: (p: string) => net.Socket;
117
+ }): Promise<WriteResult>;
118
+ export {};
119
+ //# sourceMappingURL=inbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/control/inbox.ts"],"names":[],"mappings":"AAyBA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,KAAK,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;AAE3C,gDAAgD;AAChD,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B;oFACoF;AACpF,eAAO,MAAM,UAAU,OAAQ,CAAC;AAChC;oFACoF;AACpF,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC;;;;;sCAKsC;AACtC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAM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