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.
package/README.md CHANGED
@@ -72,17 +72,36 @@ is missing or doesn't match, the session doesn't start.
72
72
 
73
73
  One daemon per computer holds one long-poll per receiver and delivers each message the
74
74
  cheapest way the session allows: to `sessionpipe wait` parked in the session's
75
- background (in place, ~60 ms, no network), at the session's next Stop if it is
76
- mid-turn, through the Agent SDK for a session it started (if the SDK is installed), or
77
- as a headless `claude -p --resume` (a `--fork-session` copy when a live process holds
78
- it). A session stays reachable in place with zero idle turns by running, as a
79
- background command with the longest timeout it can (Claude Code: raise
80
- `BASH_MAX_TIMEOUT_MS`, else a background command is stopped after 2 hours at most):
75
+ background (in place, ~60 ms, no network), at the session's next Stop if it is mid-turn,
76
+ through its channel if it has one (below), into the live session's own inbox if it is
77
+ idle (every Claude Code session on macOS and Linux has one, the Claude app's included;
78
+ the session reads such a message as a teammate's request, so it won't change its
79
+ settings or CLAUDE.md for it), through the Agent SDK for a session it started (if the
80
+ SDK is installed), or as a headless `claude -p --resume` (a `--fork-session` copy when a
81
+ live process holds it and nothing else reaches it). A session stays reachable in place
82
+ with zero idle turns by running, as a background command with the longest timeout it can
83
+ (Claude Code: raise `BASH_MAX_TIMEOUT_MS`, else a background command is stopped after 2
84
+ hours at most):
81
85
 
82
86
  ```sh
83
87
  sessionpipe wait # Claude Code: the session id comes from CLAUDE_CODE_SESSION_ID
84
88
  ```
85
89
 
90
+ Or let Claude Code keep the waiter for you, the way its Telegram plugin reaches a
91
+ session: `sessionpipe channel` is a Claude Code channel (an MCP server that pushes
92
+ messages in). It parks for its session the whole time the session runs, and each message
93
+ sent while the session is idle arrives in the session's own thread, in the terminal and
94
+ in the Claude app, as a message from `sessionpipe`, in the session's own permission
95
+ mode, and the session reads it as your own words. Channels are a research preview: a
96
+ channel that isn't on Anthropic's allowlist loads only with
97
+ `--dangerously-load-development-channels`, which asks once at startup, and a session the
98
+ Claude app starts through `claude remote-control` can't be given one yet.
99
+
100
+ ```sh
101
+ claude mcp add --scope user sessionpipe -- sessionpipe channel
102
+ claude --dangerously-load-development-channels server:sessionpipe
103
+ ```
104
+
86
105
  The waiter and next-Stop modes work in any Claude Code session that runs your hooks,
87
106
  the Claude desktop app's included, and need nothing else. The Agent SDK, resume and fork
88
107
  modes run the `claude` command, which has its own login (`claude auth login`); the
@@ -178,6 +197,29 @@ a signed `pool` command; turning it on or off, removing or reordering accounts,
178
197
  finishing a sign-in need a fresh confirm with your passkey or device key, never a day
179
198
  grant alone. `sessionpipe uninstall` runs `pool off` first.
180
199
 
200
+ ### Agents that ask agents
201
+
202
+ A session can hand a task to another agent on this machine and get the answer back:
203
+ `sessionpipe ask codex "review the diff on this branch"` runs Codex headlessly, waits,
204
+ and prints its reply on stdout (the child's id and progress on stderr), so Claude Code
205
+ can use Codex for a review, Codex can ask Gemini, and any harness with a shell can use
206
+ any other. The request never leaves the machine: it goes over the daemon's local socket
207
+ (the one `wait` uses), the daemon runs the agent in an allowed folder at `safe` (or
208
+ `read`; never wider than the machine's mode), caps it as it caps a start, and stops a
209
+ chain at two deep. Both
210
+ sessions' events say what happened (`delegation.started` / `delegation.ended` on the
211
+ asker, `delegated_by` on the answerer). A receiver can do the same from outside with
212
+ `reply_to` on a `start` or a `prompt`: the answer comes back into that session as a
213
+ message. `sessionpipe ask on` turns it on, with or without a receiver; `sessionpipe ask
214
+ setup` tells Claude Code and Codex the command exists, in their own instruction files,
215
+ since hooks never inject anything.
216
+
217
+ ```sh
218
+ sessionpipe ask on # once; the daemon runs as a service
219
+ sessionpipe ask codex "review the diff on this branch" # from inside any session; the answer is stdout
220
+ sessionpipe ask status # on or off, the daemon, the agents it can ask
221
+ ```
222
+
181
223
  ## Updates
182
224
 
183
225
  The control daemon keeps its own copy current. About a minute after it starts, and then
package/dist/ask.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ export declare const ASK_HELP = " sessionpipe ask <agent|harness:id> \"<task>\" [--cwd DIR] [--permission read|safe] [--model M] [--json] [--quiet]\n (hand a task to another agent here; its answer comes back on stdout;\n `--text -` reads the task from stdin, words after `--` are the task)\n sessionpipe ask on | off | status (whether sessions on this machine may ask each other; `on` is the\n person's to run at the terminal, never a session's)\n sessionpipe ask setup [--remove] (tell Claude Code and Codex the command exists)";
2
+ /** What the asker writes where. `out` is one line on stdout: the answer, or a status
3
+ * line of on/off/status/setup. `err` is stderr, raw: progress and what went wrong. */
4
+ export interface AskIo {
5
+ out: (s?: string) => void;
6
+ err: (s: string) => void;
7
+ /** Stdin, whole, for `--text -`. */
8
+ stdin?: () => string;
9
+ }
10
+ export interface AskOptions {
11
+ env?: NodeJS.ProcessEnv;
12
+ /** Where the CLI's dist lives: the service points at its cli.js. */
13
+ distDir?: string;
14
+ /** The agents this machine can run headlessly (tests stand in for the PATH walk). */
15
+ harnesses?: (env: NodeJS.ProcessEnv) => string[];
16
+ }
17
+ /** Run `sessionpipe ask …`; `argv` starts with "ask". Returns the exit code: 0 with the
18
+ * answer on stdout, 1 when the daemon refused or the run failed, 2 for a usage error. */
19
+ export declare function askMain(argv: string[], io: AskIo, o?: AskOptions): Promise<number>;
20
+ export declare const ASK_OPEN = "<!-- sessionpipe ask -->";
21
+ export declare const ASK_CLOSE = "<!-- /sessionpipe ask -->";
22
+ /** The section a model reads, between the markers; `agents` is what this machine can run. */
23
+ export declare function askSection(agents: string[]): string;
24
+ /** The files `ask setup` writes: every Claude Code config dir's CLAUDE.md, and Codex's
25
+ * AGENTS.md. A file is written when it exists or its harness dir does; a harness that
26
+ * isn't here is left alone. */
27
+ export declare function setupFiles(env?: NodeJS.ProcessEnv): string[];
28
+ /** `text` with the section in: replaced in place when one is there, else after what is
29
+ * there with one newline between (reversible byte for byte by withoutAskSection). */
30
+ export declare function withAskSection(text: string | null, section: string): string;
31
+ /** `text` without the section and the newline that joined it on: what the file held
32
+ * before setup wrote it. Unchanged when there is no section. */
33
+ export declare function withoutAskSection(text: string): string;
34
+ export type SetupDid = "added" | "updated" | "unchanged" | "removed" | "absent" | "skipped";
35
+ /** Write (or take out) the section in every file setupFiles names. */
36
+ export declare function setupAsk(env: NodeJS.ProcessEnv, agents: string[], remove: boolean): {
37
+ file: string;
38
+ did: SetupDid;
39
+ }[];
40
+ //# sourceMappingURL=ask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,QAAQ,8qBAK8E,CAAC;AAEpG;uFACuF;AACvF,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;CAClD;AAUD;0FAC0F;AAC1F,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,GAAE,UAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC5F;AAmPD,eAAO,MAAM,QAAQ,6BAA6B,CAAC;AACnD,eAAO,MAAM,SAAS,8BAA8B,CAAC;AAErD,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAenD;AAED;;gCAEgC;AAChC,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,EAAE,CAMzE;AAQD;sFACsF;AACtF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED;iEACiE;AACjE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5F,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,EAAE,CA8BrH"}
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAwEA,MAAM,WAAW,EAAE;IACjB,0BAA0B;IAC1B,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,kDAAkD;IAClD,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,8FAA8F;AAC9F,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,EAA2F,GAC9F,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAM5E"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAyEA,MAAM,WAAW,EAAE;IACjB,0BAA0B;IAC1B,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,kDAAkD;IAClD,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,8FAA8F;AAC9F,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,EAA2F,GAC9F,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAM5E"}