sessionpipe 0.9.0 → 0.11.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 (58) hide show
  1. package/README.md +99 -2
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +8737 -4942
  4. package/dist/cli.js.map +4 -4
  5. package/dist/control/aliases.d.ts +5 -0
  6. package/dist/control/aliases.d.ts.map +1 -1
  7. package/dist/control/autoupdate.d.ts +1 -18
  8. package/dist/control/autoupdate.d.ts.map +1 -1
  9. package/dist/control/cli.d.ts +5 -1
  10. package/dist/control/cli.d.ts.map +1 -1
  11. package/dist/control/daemon.d.ts +107 -12
  12. package/dist/control/daemon.d.ts.map +1 -1
  13. package/dist/control/files.d.ts +6 -4
  14. package/dist/control/files.d.ts.map +1 -1
  15. package/dist/control/local.d.ts +24 -0
  16. package/dist/control/local.d.ts.map +1 -1
  17. package/dist/control/pair.d.ts +15 -23
  18. package/dist/control/pair.d.ts.map +1 -1
  19. package/dist/control/pool.d.ts +49 -0
  20. package/dist/control/pool.d.ts.map +1 -0
  21. package/dist/control/route.d.ts +2 -2
  22. package/dist/control/route.d.ts.map +1 -1
  23. package/dist/control/sdk.d.ts.map +1 -1
  24. package/dist/control/store.d.ts +21 -2
  25. package/dist/control/store.d.ts.map +1 -1
  26. package/dist/help.d.ts.map +1 -1
  27. package/dist/hook.d.ts.map +1 -1
  28. package/dist/hook.js +43 -1
  29. package/dist/hook.js.map +2 -2
  30. package/dist/index.js +1179 -847
  31. package/dist/index.js.map +4 -4
  32. package/dist/pool/cli.d.ts +39 -0
  33. package/dist/pool/cli.d.ts.map +1 -0
  34. package/dist/pool/credentials.d.ts +44 -0
  35. package/dist/pool/credentials.d.ts.map +1 -0
  36. package/dist/pool/import.d.ts +23 -0
  37. package/dist/pool/import.d.ts.map +1 -0
  38. package/dist/pool/index.d.ts +138 -0
  39. package/dist/pool/index.d.ts.map +1 -0
  40. package/dist/pool/install.d.ts +46 -0
  41. package/dist/pool/install.d.ts.map +1 -0
  42. package/dist/pool/login.d.ts +27 -0
  43. package/dist/pool/login.d.ts.map +1 -0
  44. package/dist/pool/policy.d.ts +100 -0
  45. package/dist/pool/policy.d.ts.map +1 -0
  46. package/dist/pool/server.d.ts +76 -0
  47. package/dist/pool/server.d.ts.map +1 -0
  48. package/dist/pool/store.d.ts +89 -0
  49. package/dist/pool/store.d.ts.map +1 -0
  50. package/dist/pool/types.d.ts +92 -0
  51. package/dist/pool/types.d.ts.map +1 -0
  52. package/dist/run.d.ts +14 -1
  53. package/dist/run.d.ts.map +1 -1
  54. package/dist/update.d.ts +1 -7
  55. package/dist/update.d.ts.map +1 -1
  56. package/dist/worker.js +1182 -850
  57. package/dist/worker.js.map +4 -4
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -92,7 +92,13 @@ Permission prompts can be answered from the receiver too: while the terminal sho
92
92
  its prompt, the PermissionRequest hook waits for your signed answer, and whichever
93
93
  comes first wins. Nothing is ever auto-allowed. Safe mode (the default) runs headless
94
94
  turns with `--permission-mode dontAsk`, so nothing that needs approval runs while
95
- you're away.
95
+ you're away. Auto mode runs them with `--permission-mode auto`; where Claude Code's
96
+ settings turn auto mode off (`permissions.disableAutoMode`), Claude Code runs them in
97
+ its default mode instead, which refuses whatever needs approval. Inherit mode
98
+ (`sessionpipe control mode inherit`, chosen only at the machine) passes no permission
99
+ flag, so each turn starts in the mode Claude Code picks by itself there, its
100
+ settings' `permissions.defaultMode`: messaged sessions run the way your own do,
101
+ `bypassPermissions` included if that is what you set.
96
102
 
97
103
  Codex and Antigravity sessions are reached headlessly too, when `codex` or `agy` is
98
104
  installed (the daemon looks on PATH, beside its own Node, in `~/.local/bin`, or where
@@ -101,7 +107,9 @@ installed (the daemon looks on PATH, beside its own Node, in `~/.local/bin`, or
101
107
  message is `codex exec resume <thread>` or `agy --conversation <id>`. Safe mode runs
102
108
  Codex in its `workspace-write` sandbox and agy with no permission flag (it denies, and
103
109
  the reply lists, what it wasn't allowed to do); auto mode passes `--approve-for-me` /
104
- `--mode accept-edits`. The bypass flags are never passed. Both CLIs pick a new
110
+ `--mode accept-edits`; inherit mode passes no flag, so Codex follows the
111
+ `approval_policy` and `sandbox_mode` in your `config.toml`. The bypass flags are never
112
+ passed. Both CLIs pick a new
105
113
  session's id themselves, so the daemon keeps the one your start named: it records the
106
114
  pair in `~/.local/state/sessionpipe/control/aliases.json`, and your receiver keeps
107
115
  seeing one session under one id. A message to a Codex session someone has open (its
@@ -109,6 +117,67 @@ rollout written in the last 90 seconds) is acked `unsupported` rather than resum
109
117
  Before a Codex run the daemon checks `codex login status` (or `CODEX_API_KEY`) and says
110
118
  `codex login --device-auth` if it isn't signed in.
111
119
 
120
+ Any other agent that speaks the [Agent Client Protocol](https://agentclientprotocol.com)
121
+ is reached the same way: Gemini CLI, OpenCode, goose, Copilot CLI, Cursor, Droid, Devin,
122
+ Kilo, Qwen Code, Cline and the rest of the ACP registry ([the list, with each one's
123
+ launch line](../../spec/ADAPTERS.md#agents-driven-through-acp-control-only)). The daemon
124
+ runs the agent's own CLI (`gemini --acp`, `opencode acp`, …) when it is installed, on
125
+ PATH or where `SESSIONPIPE_ACP_<HARNESS>` points (`SESSIONPIPE_ACP_GEMINI_CLI`), and
126
+ never downloads one. It is the agent's client: a start opens a session in your folder,
127
+ the reply streams back as the agent writes it, and the process stays up so the next
128
+ message lands in it with no cold start (`api` mode); `cancel` works there too. An agent
129
+ idle for ten minutes is closed, and a later message reopens the session where the agent
130
+ supports `session/load`. Safe mode answers every permission the agent asks with a
131
+ refusal, listed in the reply; auto mode allows. An agent that never asks (OpenCode, by
132
+ its own settings) runs its tools as it would at your terminal. Signing in is yours to do
133
+ at the terminal: an agent that wants it says so in the reply.
134
+
135
+ ## The pool: several Claude accounts, one session that keeps going
136
+
137
+ Claude Code can't change account mid-session, but its requests can. `sessionpipe pool`
138
+ keeps several Claude accounts behind one loopback listener the control daemon runs on
139
+ this machine; Claude Code is pointed at it through the `env` block of its
140
+ `settings.json` (`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, and the one flag that
141
+ keeps its first-party features on). Each request goes to the first account in your order
142
+ that has room, a session stays on its account while that account has room, and when the
143
+ account's 5-hour or weekly window is used up the next request simply goes to the next
144
+ account: the session notices nothing. The numbers each account reports arrive as
145
+ `limits.observed` with `account_id`, so a receiver's usage page shows every account
146
+ ([spec](../../spec/CONTROL.md#pool), [what it reads](../../spec/ADAPTERS.md),
147
+ [privacy](../../spec/PRIVACY.md)).
148
+
149
+ ```sh
150
+ sessionpipe pool add --import # copy every Claude Code login on this machine into the pool
151
+ sessionpipe pool add --login # sign in to another account: a URL, then paste the code to --code -
152
+ sessionpipe pool on # write the env block; installs the daemon's service if it isn't there
153
+ sessionpipe pool # the accounts in order, each with its room left and reset times
154
+ sessionpipe pool order <id|email>… # the complete order; enable | disable | remove | refresh too
155
+ sessionpipe pool off # remove exactly what `on` wrote; the accounts stay
156
+ ```
157
+
158
+ Nothing here happens until you run `pool add` or `pool on` yourself: `install` and
159
+ `connect` never touch the pool. The credentials you add live in sessionpipe's own secrets
160
+ store (the keychain where there is one), are sent only to the vendor's own endpoints for
161
+ your own requests, and never appear on an event, in an ack or on the terminal. The
162
+ vendor is called (requests forwarded, idle usage read every five minutes) only while the
163
+ pool is on; `pool add --login` and `pool refresh` at the terminal are the exceptions,
164
+ because you asked. Whether pooling is allowed by each account's plan is yours to check;
165
+ sessionpipe doesn't change any limit.
166
+
167
+ New Claude Code sessions use the pool from the moment `pool on` returns; sessions
168
+ already running pick it up at their next start, since Claude Code reads
169
+ `settings.json`'s `env` when it starts. While the pool is on, every Claude Code request
170
+ on the machine depends on the daemon: if it isn't running, Claude Code gets "connection
171
+ refused", and `sessionpipe pool` says so (`sessionpipe control run` in a terminal, or the
172
+ service `pool on` installs). The daemon runs for the pool alone, with no receiver
173
+ paired; `control off` keeps the service while the pool is on. While the daemon runs,
174
+ every `sessionpipe pool` command goes to it over the local socket, since it holds the
175
+ listener, the session pins and the credentials; with no daemon the command runs here and
176
+ the daemon reads the result when it starts. From a receiver, the same actions arrive as
177
+ a signed `pool` command; turning it on or off, removing or reordering accounts, and
178
+ finishing a sign-in need a fresh confirm with your passkey or device key, never a day
179
+ grant alone. `sessionpipe uninstall` runs `pool off` first.
180
+
112
181
  ## Updates
113
182
 
114
183
  The control daemon keeps its own copy current. About a minute after it starts, and then
@@ -153,6 +222,34 @@ sessionpipe update # install the latest now; the daemon restarts onto i
153
222
  a launchd or systemd service doesn't inherit your shell's variables, while
154
223
  `sessionpipe update off` reaches it (it re-reads the config every ten minutes).
155
224
 
225
+ ## Session names from claude.ai
226
+
227
+ A session the Claude app starts on this machine gets its name from claude.ai, a few
228
+ seconds after its first message, and claude.ai never writes that name to the machine.
229
+ Out of the box sessionpipe reads only local files, so such a session goes out under
230
+ your first prompt cut to 50 characters while the Claude app shows another name.
231
+
232
+ ```sh
233
+ sessionpipe titles on # Claude Code sessions with a claude.ai link take claude.ai's name
234
+ sessionpipe titles refresh # ask again about the last 30 days' sessions (--days N)
235
+ sessionpipe titles off # local files only again (the default)
236
+ sessionpipe titles # which one holds
237
+ ```
238
+
239
+ With it on, the worker asks claude.ai for the name of each Claude Code session that has
240
+ a claude.ai link, a minute apart until claude.ai has named it, then every half hour. To
241
+ ask, it reads the sign-in Claude Code keeps for that config dir (the macOS keychain item
242
+ Claude Code writes, else `.credentials.json` in the config dir). It sends that token to
243
+ `api.anthropic.com` alone and keeps it nowhere: not in a file, an event, a log or a
244
+ sink. A token about to expire is skipped, never refreshed, so Claude Code's own login is
245
+ never touched. A name you gave the session here (`/rename`) still wins, and so does a
246
+ rename in the Claude app, which reaches the transcript without any of this.
247
+
248
+ `titles on` (and `titles refresh`) also asks about every session of the last 30 days
249
+ and sends each one a receiver already has under another name again, as
250
+ `session.backfill` with claude.ai's name, so finished sessions are renamed too, not only
251
+ the ones that run again. It prints how many it found named and how many it sent.
252
+
156
253
  ## Help and status JSON
157
254
 
158
255
  `sessionpipe <command> --help` (or `-h`) prints usage and exits successfully before
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAoEA,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":";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"}