sessionpipe 0.10.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.
- package/README.md +74 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5085 -2360
- package/dist/cli.js.map +4 -4
- package/dist/control/cli.d.ts +4 -0
- package/dist/control/cli.d.ts.map +1 -1
- package/dist/control/daemon.d.ts +24 -0
- package/dist/control/daemon.d.ts.map +1 -1
- package/dist/control/local.d.ts +24 -0
- package/dist/control/local.d.ts.map +1 -1
- package/dist/control/pool.d.ts +49 -0
- package/dist/control/pool.d.ts.map +1 -0
- package/dist/control/route.d.ts +1 -1
- package/dist/control/route.d.ts.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +37 -1
- package/dist/hook.js.map +2 -2
- package/dist/index.js +1101 -875
- package/dist/index.js.map +4 -4
- package/dist/pool/cli.d.ts +39 -0
- package/dist/pool/cli.d.ts.map +1 -0
- package/dist/pool/credentials.d.ts +44 -0
- package/dist/pool/credentials.d.ts.map +1 -0
- package/dist/pool/import.d.ts +23 -0
- package/dist/pool/import.d.ts.map +1 -0
- package/dist/pool/index.d.ts +138 -0
- package/dist/pool/index.d.ts.map +1 -0
- package/dist/pool/install.d.ts +46 -0
- package/dist/pool/install.d.ts.map +1 -0
- package/dist/pool/login.d.ts +27 -0
- package/dist/pool/login.d.ts.map +1 -0
- package/dist/pool/policy.d.ts +100 -0
- package/dist/pool/policy.d.ts.map +1 -0
- package/dist/pool/server.d.ts +76 -0
- package/dist/pool/server.d.ts.map +1 -0
- package/dist/pool/store.d.ts +89 -0
- package/dist/pool/store.d.ts.map +1 -0
- package/dist/pool/types.d.ts +92 -0
- package/dist/pool/types.d.ts.map +1 -0
- package/dist/run.d.ts +14 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/worker.js +1096 -870
- package/dist/worker.js.map +4 -4
- package/package.json +1 -1
package/dist/control/cli.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export declare function controlMain(argv: string[], out: (s?: string) => void, d
|
|
|
12
12
|
export declare function enabledHarnesses(harnesses: Record<string, {
|
|
13
13
|
enabled?: boolean;
|
|
14
14
|
}>): string[];
|
|
15
|
+
/** The pool's fake upstream for tests, and only there: honoured under vitest and only
|
|
16
|
+
* when it is a loopback address, so no plist, shell profile or .envrc in the daemon's
|
|
17
|
+
* real environment can send pooled requests (bearers included) anywhere else. */
|
|
18
|
+
export declare function testUpstream(env: NodeJS.ProcessEnv): string | null;
|
|
15
19
|
export declare function waitMain(argv: string[], out: (s?: string) => void): Promise<void>;
|
|
16
20
|
/** Give a sink the key a receiver handed over at pairing. A sink for the receiver that
|
|
17
21
|
* has a key keeps it ("kept"); one without a key gets this one ("filled"); otherwise a
|
|
@@ -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;
|
|
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,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,CAK3F;AAuJD;;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;;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"}
|
package/dist/control/daemon.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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
|
+
import type { Pool } from "../pool/index.js";
|
|
3
4
|
import { type DeliveryMode } from "./route.js";
|
|
4
5
|
import { type ControlConfig, type PairedReceiver } from "./store.js";
|
|
5
6
|
type Caps = claudeControl.Caps;
|
|
@@ -114,6 +115,10 @@ export interface DaemonDeps {
|
|
|
114
115
|
updateStatus?: () => unknown;
|
|
115
116
|
/** Another daemon took the socket path: this one has stopped and should exit. */
|
|
116
117
|
onLostSocket?: () => void;
|
|
118
|
+
/** The machine's account pool (pool/index.ts): its listener runs in this process,
|
|
119
|
+
* every hello carries its state, and `pool` commands and socket ops go to it.
|
|
120
|
+
* Absent: this daemon can't pool (a `pool` command is `unsupported`). */
|
|
121
|
+
pool?: Pool;
|
|
117
122
|
}
|
|
118
123
|
/** Another daemon already answers on the socket: this one must not start. */
|
|
119
124
|
export declare class DaemonRunning extends Error {
|
|
@@ -156,6 +161,17 @@ export interface Status {
|
|
|
156
161
|
/** Null when the daemon could restart now (nothing in hand); otherwise what it holds. */
|
|
157
162
|
busy: string | null;
|
|
158
163
|
update?: unknown;
|
|
164
|
+
/** The account pool, when this daemon has one (`sessionpipe pool` has the whole picture). */
|
|
165
|
+
pool?: {
|
|
166
|
+
on: boolean;
|
|
167
|
+
port: number;
|
|
168
|
+
listening: boolean;
|
|
169
|
+
accounts: number;
|
|
170
|
+
with_room: number;
|
|
171
|
+
in_flight: number;
|
|
172
|
+
/** Another daemon answers on the pool's port; this one doesn't listen. */
|
|
173
|
+
another_daemon?: true;
|
|
174
|
+
};
|
|
159
175
|
}
|
|
160
176
|
/** The machine's own caps (CONTROL.md §6 `start`): every command is the owner's,
|
|
161
177
|
* signed, but a burst of them must not start a crowd of agents. A start beyond the
|
|
@@ -229,6 +245,13 @@ export declare class ControlDaemon {
|
|
|
229
245
|
stop(o?: {
|
|
230
246
|
leaveSocket?: boolean;
|
|
231
247
|
}): Promise<void>;
|
|
248
|
+
/** The pool's listener and its idle usage poll run exactly while the pool is on
|
|
249
|
+
* (PRIVACY.md §3: the vendor is called only for a pool the person turned on):
|
|
250
|
+
* up after `on`, down after `off`, whatever accounts exist. Idempotent either way. */
|
|
251
|
+
private syncPool;
|
|
252
|
+
/** The pool changed what a hello says (pool/index.ts `onChange`): say it now, as a
|
|
253
|
+
* folder change does. */
|
|
254
|
+
poolChanged(): void;
|
|
232
255
|
/** Null when nothing is in hand, so a restart would interrupt nothing; otherwise what
|
|
233
256
|
* is. Parked waiters don't count: a waiter reconnects in silence (CONTROL.md §8). A
|
|
234
257
|
* session someone is working in mid-turn does (a restart forgets it is mid-turn, so a
|
|
@@ -244,6 +267,7 @@ export declare class ControlDaemon {
|
|
|
244
267
|
private checkSocket;
|
|
245
268
|
reload(cfg: ControlConfig): void;
|
|
246
269
|
status(): Status;
|
|
270
|
+
private poolSummary;
|
|
247
271
|
/** One daemon per machine: a daemon that answers on the socket keeps it, and this
|
|
248
272
|
* one doesn't start. A socket file nobody answers on is a dead daemon's; it goes. */
|
|
249
273
|
private listen;
|
|
@@ -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;
|
|
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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AA0E;YAC5D,MAAM;IAYpB,OAAO,CAAC,MAAM;IAUd,mFAAmF;YACrE,IAAI;YAWJ,YAAY;YAwBZ,QAAQ;IAoFtB,sFAAsF;IACtF,OAAO,CAAC,WAAW;IAWnB;gFAC4E;YAC9D,WAAW;IAsCzB;;;uEAGmE;YACrD,QAAQ;IA0CtB;;wFAEoF;YACtE,SAAS;IAmCvB,OAAO,CAAC,OAAO;IAqBf;;;;;gCAK4B;YACd,QAAQ;IA+BtB,OAAO,CAAC,YAAY;CAWrB"}
|
package/dist/control/local.d.ts
CHANGED
|
@@ -33,7 +33,19 @@ export type LocalRequest =
|
|
|
33
33
|
/** `sessionpipe update` installed a new copy: restart onto it once nothing is in hand. */
|
|
34
34
|
| {
|
|
35
35
|
op: "restart";
|
|
36
|
+
}
|
|
37
|
+
/** `sessionpipe pool …` while the daemon runs: the daemon holds the pool's engine
|
|
38
|
+
* (pins, credentials, the listener), so a change goes through it. `status` reads;
|
|
39
|
+
* the rest are CONTROL.md §6's actions, plus `import` (reads this machine's own
|
|
40
|
+
* Claude Code logins, which no receiver may ask for). */
|
|
41
|
+
| {
|
|
42
|
+
op: "pool";
|
|
43
|
+
action: PoolOp;
|
|
44
|
+
account?: string;
|
|
45
|
+
order?: string[];
|
|
46
|
+
code?: string;
|
|
36
47
|
};
|
|
48
|
+
export type PoolOp = "status" | "on" | "off" | "enable" | "disable" | "remove" | "order" | "refresh" | "login.begin" | "login.complete" | "import";
|
|
37
49
|
export type LocalReply = {
|
|
38
50
|
op: "message";
|
|
39
51
|
text: string;
|
|
@@ -58,6 +70,18 @@ export type LocalReply = {
|
|
|
58
70
|
} | {
|
|
59
71
|
op: "status";
|
|
60
72
|
status: unknown;
|
|
73
|
+
}
|
|
74
|
+
/** A pool op's answer: the ack it would earn (CONTROL.md §6) and the pool as it now
|
|
75
|
+
* stands (`status`: the façade's PoolStatus; `detail`: the summary line, or a
|
|
76
|
+
* login.begin's "<pending id> <URL>"). */
|
|
77
|
+
| {
|
|
78
|
+
op: "pool";
|
|
79
|
+
outcome: "delivered" | "refused" | "failed" | "unsupported";
|
|
80
|
+
code?: string;
|
|
81
|
+
detail: string;
|
|
82
|
+
status?: unknown;
|
|
83
|
+
/** `import`: what was added and what was left out (control/pool.ts Imported). */
|
|
84
|
+
imported?: unknown;
|
|
61
85
|
};
|
|
62
86
|
/** Where the daemon listens. `SESSIONPIPE_SOCKET` overrides (tests). */
|
|
63
87
|
export declare function socketPath(state: string, env?: NodeJS.ProcessEnv): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/control/local.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,YAAY;AACtB,8DAA8D;AAC5D;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;AAC/C,yDAAyD;GACvD;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;AAClD,sFAAsF;GACpF;IAAE,EAAE,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AACzE,yEAAyE;GACvE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;AACpF,oCAAoC;GAClC;IAAE,EAAE,EAAE,QAAQ,CAAA;CAAE;AAClB,0FAA0F;GACxF;IAAE,EAAE,EAAE,SAAS,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/control/local.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM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CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,EAAE,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC5E;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;AAChB,qEAAqE;GACnE;IAAE,EAAE,EAAE,UAAU,CAAA;CAAE,GAClB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;AACnC;;2CAE2C;GACzC;IACE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEN,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAItF;AAED;sFACsF;AACtF,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA2BlG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ControlCommand } from "@sessionpipe/core/control";
|
|
2
|
+
import { type Pool, type PoolAccount, type PoolStatus } from "../pool/index.js";
|
|
3
|
+
import type { PoolOp } from "./local.js";
|
|
4
|
+
export interface PoolRequest {
|
|
5
|
+
action: PoolOp;
|
|
6
|
+
account?: string;
|
|
7
|
+
order?: string[];
|
|
8
|
+
code?: string;
|
|
9
|
+
}
|
|
10
|
+
/** What `pool add --import` did, without the credentials the façade also returns:
|
|
11
|
+
* those go to the secrets store and nowhere else, the socket included. */
|
|
12
|
+
export interface Imported {
|
|
13
|
+
added: {
|
|
14
|
+
account: PoolAccount;
|
|
15
|
+
dir: string;
|
|
16
|
+
}[];
|
|
17
|
+
skipped: {
|
|
18
|
+
dir: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
why: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export type PoolOutcome = {
|
|
24
|
+
outcome: "delivered";
|
|
25
|
+
detail: string;
|
|
26
|
+
status: PoolStatus;
|
|
27
|
+
imported?: Imported;
|
|
28
|
+
} | {
|
|
29
|
+
outcome: "refused" | "failed" | "unsupported";
|
|
30
|
+
code?: string;
|
|
31
|
+
detail: string;
|
|
32
|
+
status?: PoolStatus;
|
|
33
|
+
};
|
|
34
|
+
/** A signed `pool` command's fields, as parseCommand already checked them (the action
|
|
35
|
+
* is one of the spec's, and each action carries exactly its own fields). */
|
|
36
|
+
export declare function poolRequestOf(cmd: ControlCommand): PoolRequest;
|
|
37
|
+
/** Run one request against the façade. `unsupported` when this daemon has no pool;
|
|
38
|
+
* a PoolError becomes the ack its code names (refused: pool_account, pool_order,
|
|
39
|
+
* pool_off; failed: login, pool); anything else that throws is `failed` `pool`.
|
|
40
|
+
* `detail` never carries a token, a code or an email the asker didn't name.
|
|
41
|
+
*
|
|
42
|
+
* `terminal`: the person at the machine asked (the local socket, the CLI). The
|
|
43
|
+
* vendor is then called whether or not the pool is on — signing an account in or
|
|
44
|
+
* reading its usage is theirs to ask for, as `pool add` works while off — where a
|
|
45
|
+
* receiver gets `pool_off` (CONTROL.md §6, PRIVACY.md §3). */
|
|
46
|
+
export declare function runPoolRequest(pool: Pool | undefined, req: PoolRequest, o?: {
|
|
47
|
+
terminal?: boolean;
|
|
48
|
+
}): Promise<PoolOutcome>;
|
|
49
|
+
//# sourceMappingUR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c,CAClC,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,GAAG,EAAE,WAAW,EAChB,CAAC,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7B,OAAO,CAAC,WAAW,CAAC,CAoEtB"}
|
package/dist/control/route.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const HEADLESS: Set<string>;
|
|
|
31
31
|
* session gets a fork, never a resume. */
|
|
32
32
|
export declare function routePrompt(s: SessionView): Route;
|
|
33
33
|
/** How each kind is delivered, before the session's state is looked at. */
|
|
34
|
-
export declare function kindPath(kind: ControlKind, harness: string): "prompt" | "permission" | "cancel" | "start" | {
|
|
34
|
+
export declare function kindPath(kind: ControlKind, harness: string): "prompt" | "permission" | "cancel" | "start" | "pool" | {
|
|
35
35
|
unsupported: string;
|
|
36
36
|
};
|
|
37
37
|
/** The framed text a session receives (CONTROL.md §6): the model and the person can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/control/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,GAAG,EAAE,OAAO,CAAC;IACb,2DAA2D;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,IAAI,EAAE,OAAO,CAAC;IACd,0FAA0F;IAC1F,KAAK,EAAE,OAAO,CAAC;IACf,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,MAAM,KAAK,GAAG;IAA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AQ,aAAgF,CAAC;AAEtG;2CAC2C;AAC3C,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,KAAK,CAejD;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CACtB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,GACd,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAoBjF;AAED;+BAC+B;AAC/B;;qFAEqF;AACrF,eAAO,MAAM,eAAe,6KACgJ,CAAC;AAE7K,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;;;;mDAImD;AACnD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMjE"}
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoD/E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAO5F"}
|
package/dist/hook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":";AAkBA,iFAAiF;AACjF,MAAM,WAAW,MAAM;IACrB,KAAK,IAAI,MAAM,CAAC;IAChB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;0FAE0F;AAC1F,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":";AAkBA,iFAAiF;AACjF,MAAM,WAAW,MAAM;IACrB,KAAK,IAAI,MAAM,CAAC;IAChB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;0FAE0F;AAC1F,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwQhG"}
|
package/dist/hook.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// sessionpipe 0.
|
|
2
|
+
// sessionpipe 0.11.0 · Apache-2.0 · https://sessionpipe.org
|
|
3
3
|
|
|
4
4
|
// src/hook.ts
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
@@ -87,6 +87,17 @@ async function hookMain(argv, env, io) {
|
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
if (harness === "claude-code" && event === "StatusLine") {
|
|
91
|
+
const limits = statusLimits(stdin);
|
|
92
|
+
if (limits.line) {
|
|
93
|
+
try {
|
|
94
|
+
io.stdout(`${limits.line}
|
|
95
|
+
`);
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!limits.sig || !anySinkAbove(0) || !limitsDue(limits.sig)) return finish(false);
|
|
100
|
+
}
|
|
90
101
|
const TOOL = /^(PreToolUse|PostToolUse|PostToolUseFailure|BeforeTool|AfterTool|PostInvocation)$/;
|
|
91
102
|
if (TOOL.test(event) && !anySinkAbove(0)) {
|
|
92
103
|
const id = sessionIdOf(stdin);
|
|
@@ -221,6 +232,31 @@ async function hookMain(argv, env, io) {
|
|
|
221
232
|
const m = /"(?:session_id|sessionId|conversationId)"\s*:\s*"([^"]{1,128})"/.exec(stdin);
|
|
222
233
|
return m?.[1] ?? "";
|
|
223
234
|
}
|
|
235
|
+
function statusLimits(stdin) {
|
|
236
|
+
let rl;
|
|
237
|
+
try {
|
|
238
|
+
rl = JSON.parse(stdin).rate_limits;
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
if (!rl || typeof rl !== "object") return { line: "", sig: "" };
|
|
242
|
+
const label = { five_hour: "5h", seven_day: "week", spend_limit: "spend" };
|
|
243
|
+
const parts = Object.entries(rl).filter(([, w]) => typeof w?.used_percentage === "number").map(([id, w]) => `${label[id] ?? id} ${Math.round(w.used_percentage)}%`);
|
|
244
|
+
return parts.length ? { line: parts.join(" \xB7 "), sig: JSON.stringify(rl) } : { line: "", sig: "" };
|
|
245
|
+
}
|
|
246
|
+
function limitsDue(sig) {
|
|
247
|
+
const dir = createHash("sha256").update(env.CLAUDE_CONFIG_DIR ?? "").digest("hex").slice(0, 12);
|
|
248
|
+
const stamp = path2.join(state, "beats", `${harness}-limits-${dir}`);
|
|
249
|
+
try {
|
|
250
|
+
if (readFileSync(stamp, "utf8") === sig || Date.now() - statSync(stamp).mtimeMs < 6e4) return false;
|
|
251
|
+
} catch {
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
mkdirSync(path2.dirname(stamp), { recursive: true, mode: 448 });
|
|
255
|
+
writeFileSync(stamp, sig, { mode: 384 });
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
224
260
|
function beatDue(id) {
|
|
225
261
|
const stamp = path2.join(state, "beats", `${harness}-${id.replace(/[^A-Za-z0-9_-]/g, "_")}`);
|
|
226
262
|
try {
|
package/dist/hook.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/hook.ts", "../src/control/local.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n// SPDX-License-Identifier: Apache-2.0\n// The hook path. A harness runs `node hook.js <harness> <event>`; this reads stdin,\n// writes one job file, spawns the worker detached, prints what the harness needs\n// (Antigravity's answer) and exits 0 \u2014 in milliseconds, with nothing but node:\n// builtins imported (the build checks that). No network, no schema library, no\n// config parsing beyond one small file read for the throttle.\nimport { spawn } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { ask, socketPath } from \"./control/local.js\";\n\n/** A Claude Code session id (the same test as core's notClaudeCode). */\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** The two streams the hook touches: stdin once, whole; stdout for an answer. */\nexport interface HookIO {\n stdin(): Buffer;\n stdout(text: string): void;\n}\n\n/** One hook run: `argv` is [harness, event, ...] as the harness invoked it, `env` the\n * process environment. Resolves once the job is on its way and any answer printed;\n * the process then exits 0, whatever happened (the hook is invisible to the harness). */\nexport async function hookMain(argv: string[], env: NodeJS.ProcessEnv, io: HookIO): Promise<void> {\n const t0 = process.hrtime.bigint();\n /** The hook's own work, when a control wait follows it (the wait is not the hook's cost). */\n let workMs: number | null = null;\n const [harness = \"\", event = \"\", ...rest] = argv;\n\n function stateDir(): string {\n if (env.SESSIONPIPE_STATE) return path.resolve(env.SESSIONPIPE_STATE);\n const home = os.homedir();\n if (process.platform === \"win32\")\n return path.join(env.LOCALAPPDATA || path.join(home, \"AppData\", \"Local\"), \"sessionpipe\");\n return path.join(env.XDG_STATE_HOME || path.join(home, \".local\", \"state\"), \"sessionpipe\");\n }\n function configFile(): string {\n if (env.SESSIONPIPE_CONFIG) return path.resolve(env.SESSIONPIPE_CONFIG);\n const home = os.homedir();\n if (process.platform === \"win32\")\n return path.join(env.APPDATA || path.join(home, \"AppData\", \"Roaming\"), \"sessionpipe\", \"config.json\");\n return path.join(env.XDG_CONFIG_HOME || path.join(home, \".config\"), \"sessionpipe\", \"config.json\");\n }\n\n // Antigravity parses stdout as the hook's answer; `{}` is \"carry on\" for every event we\n // register. PreToolUse is not one of them: `{}` there is a deny, so an entry an older\n // install left behind asks the person instead (core's AG_STALE_PRETOOL, same bytes).\n if (harness === \"antigravity\") {\n try {\n io.stdout(\n event === \"PreToolUse\"\n ? '{\"decision\":\"ask\",\"reason\":\"sessionpipe: an outdated PreToolUse hook is still loaded. Restart this conversation (or run sessionpipe install) to drop it.\"}\\n'\n : \"{}\\n\",\n );\n } catch {}\n }\n\n const state = stateDir();\n try {\n if (!harness || !event) throw new Error(\"usage: hook <harness> <event>\");\n let stdin = \"\";\n if (harness !== \"codex\" || event !== \"notify\") {\n try {\n const buf = io.stdin();\n stdin = buf.subarray(0, 1024 * 1024).toString(\"utf8\");\n } catch {}\n }\n // Tool events are the bulk of what a harness fires. When no sink takes tier \u2265 1\n // they are only a \"still working\" signal: one heartbeat a minute per session.\n const TOOL = /^(PreToolUse|PostToolUse|PostToolUseFailure|BeforeTool|AfterTool|PostInvocation)$/;\n if (TOOL.test(event) && !anySinkAbove(0)) {\n const id = sessionIdOf(stdin);\n if (!id || !beatDue(id)) return finish(false);\n }\n // A Stop asks the daemon BEFORE its event goes to the worker: the worker reports the\n // Stop to the daemon too, and a message queued for this Stop must be taken here,\n // not rerouted because the event got there first.\n const stopAnswer = event === \"Stop\" ? await (controlAsk(stdin) ?? Promise.resolve(null)) : null;\n mkdirSync(path.join(state, \"jobs\"), { recursive: true, mode: 0o700 });\n const job = {\n harness,\n event,\n argv: [harness, event, ...rest],\n stdin,\n cwd: process.cwd(),\n env: pick([\n // Where a harness keeps its config and its sessions, so a job swept by a worker\n // some other harness's hook spawned still resolves this harness's own homes\n // (run.ts sweepJobs runs any stale job file, whatever spawned the worker).\n \"APPDATA\",\n \"CLAUDE_CODE_HOST_SESSION_ID\",\n // session.attended: Claude Code's own word, and SESSIONPIPE_CONTROL_JOB below, the\n // control daemon's mark on a turn it runs for a person's message.\n \"CLAUDE_CODE_SESSION_ATTENDED\",\n \"CLAUDE_CONFIG_DIR\",\n \"CLAUDE_PROJECT_DIR\",\n \"CODEX_HOME\",\n // Devin's payload names no folder at all; this is the only thing that does.\n \"DEVIN_PROJECT_DIR\",\n \"GEMINI_CLI_HOME\",\n \"SESSIONPIPE_CONTROL_JOB\",\n // The launcher a script named for a session it starts (PROTOCOL.md \u00A73 launched_by).\n \"SESSIONPIPE_LAUNCHED_BY\",\n // Devin's config file and session store are both resolved through these.\n \"XDG_CONFIG_HOME\",\n \"XDG_DATA_HOME\",\n ]),\n ppid: process.ppid,\n at: Date.now(),\n };\n const jobFile = path.join(\n state,\n \"jobs\",\n `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}.json`,\n );\n writeFileSync(jobFile, JSON.stringify(job), { mode: 0o600 });\n if (!env.SESSIONPIPE_NO_WORKER) {\n const worker = path.join(path.dirname(fileURLToPath(import.meta.url)), \"worker.js\");\n const p = spawn(process.execPath, [worker, jobFile], { detached: true, stdio: \"ignore\", windowsHide: true, env });\n p.unref();\n }\n if (stopAnswer) {\n try {\n io.stdout(`${stopAnswer}\\n`);\n } catch {}\n }\n // A PermissionRequest waits AFTER its event is on its way, so the receiver already\n // shows the Allow / Deny this answer is for.\n const ctl = event === \"PermissionRequest\" ? controlAsk(stdin) : null;\n if (ctl) {\n workMs = Number(process.hrtime.bigint() - t0) / 1e6;\n const out = await ctl;\n if (out) {\n try {\n io.stdout(`${out}\\n`);\n } catch {}\n }\n }\n return finish(true);\n } catch {\n return finish(false); // the hook must be invisible to the harness\n }\n\n /** Control (spec/CONTROL.md \u00A76, \u00A79): only on a machine with control paired, and only\n * for a message the daemon itself verified. A Stop hook asks for a queued message and\n * answers a block with it; a PermissionRequest hook waits for the person's signed\n * answer while the terminal shows its own prompt, first answer wins. Anything that\n * goes wrong (no daemon, a timeout) prints nothing: the harness carries on as usual. */\n function controlAsk(stdin: string): Promise<string | null> | null {\n if (harness !== \"claude-code\" || (event !== \"Stop\" && event !== \"PermissionRequest\")) return null;\n if (env.SESSIONPIPE_CONTROL_JOB) return null; // a headless turn the daemon itself runs\n const sock = socketPath(state, env);\n if (\n process.platform === \"win32\"\n ? !existsSync(path.join(path.dirname(configFile()), \"control.json\"))\n : !existsSync(sock)\n )\n return null;\n let s: Record<string, unknown>;\n try {\n s = JSON.parse(stdin) as Record<string, unknown>;\n } catch {\n return null;\n }\n const id = typeof s.session_id === \"string\" ? s.session_id : \"\";\n if (!id) return null;\n // Our entry in ~/.claude/settings.json is run by every harness that imports that file\n // \u2014 Devin's `claude` hooks provider is live, not a stub \u2014 and it arrives under the\n // claude-code name. Every Claude Code payload names a transcript and a UUID session;\n // a payload with neither is somebody else's, and must not be parked for up to 125 s\n // waiting on an answer that is not coming. Same test as core's notClaudeCode\n // (claude-code.ts), which the worker applies; repeated here because this file imports\n // nothing but node builtins.\n if (typeof s.transcript_path !== \"string\" && !UUID.test(id)) return null;\n const session = `claude-code:${id}`;\n if (event === \"Stop\")\n return ask(sock, { op: \"stop\", session, active: s.stop_hook_active === true }, 300).then((r) =>\n r?.op === \"block\" ? JSON.stringify({ decision: \"block\", reason: r.reason }) : null,\n );\n // The attention id the adapter puts on attention.needed (claude-code.ts), so the\n // receiver's Allow / Deny names this very prompt.\n const tool =\n typeof s.tool_name === \"string\" && /^[A-Za-z0-9_.:-]{1,120}$/.test(s.tool_name) ? s.tool_name : undefined;\n const turn = typeof s.prompt_id === \"string\" ? s.prompt_id : undefined;\n const attention = `perm-${createHash(\"sha256\")\n .update(`${turn ?? \"\"}|${tool ?? \"\"}|${JSON.stringify(s.tool_input ?? null)}`)\n .digest(\"hex\")\n .slice(0, 16)}`;\n return ask(sock, { op: \"permission\", session, attention, ...(tool ? { tool } : {}) }, 125_000).then((r) =>\n r?.op === \"decision\"\n ? JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"PermissionRequest\",\n decision:\n r.behavior === \"allow\"\n ? { behavior: \"allow\" }\n : { behavior: \"deny\", message: r.message || \"Denied by the owner (sessionpipe control).\" },\n },\n })\n : null,\n );\n }\n\n /** The timing line; the process exits 0 right after. */\n function finish(spawned: boolean): void {\n const total = Number(process.hrtime.bigint() - t0) / 1e6;\n const ms = workMs ?? total;\n try {\n mkdirSync(state, { recursive: true });\n appendFileSync(\n path.join(state, \"timing.jsonl\"),\n `${JSON.stringify({ at: Date.now(), harness, event, ms: Math.round(ms * 10) / 10, spawned, ...(workMs !== null ? { control_wait_ms: Math.round(total - workMs) } : {}) })}\\n`,\n );\n } catch {}\n }\n function pick(names: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const n of names) if (env[n] !== undefined) out[n] = env[n] as string;\n return out;\n }\n function anySinkAbove(tier: number): boolean {\n try {\n const c = JSON.parse(readFileSync(configFile(), \"utf8\")) as { sinks?: { tier?: number; paused?: string }[] };\n return (c.sinks ?? []).some((s) => Number(s.tier) > tier && !s.paused);\n } catch {\n return false;\n }\n }\n function sessionIdOf(stdin: string): string {\n const m = /\"(?:session_id|sessionId|conversationId)\"\\s*:\\s*\"([^\"]{1,128})\"/.exec(stdin);\n return m?.[1] ?? \"\";\n }\n /** One heartbeat per minute per session: the stamp file's mtime is the clock. */\n function beatDue(id: string): boolean {\n const stamp = path.join(state, \"beats\", `${harness}-${id.replace(/[^A-Za-z0-9_-]/g, \"_\")}`);\n try {\n if (Date.now() - statSync(stamp).mtimeMs < 60_000) return false;\n } catch {}\n try {\n mkdirSync(path.dirname(stamp), { recursive: true, mode: 0o700 });\n writeFileSync(stamp, \"\", { mode: 0o600 });\n } catch {}\n return true;\n }\n}\n\n// Run as `node hook.js <harness> <event>`; importing this module runs nothing. The main\n// module is known by its real path: node resolves symlinks for import.meta.url, argv[1]\n// keeps the spelling it was given (/var \u2192 /private/var on macOS).\nif (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href)\n hookMain(process.argv.slice(2), process.env, {\n // fd 0 and 1 are the test runner's own (a read of 0 would block it); launcher.test.ts\n // and the bench run these two through the real binary.\n /* v8 ignore next -- see above */\n stdin: () => readFileSync(0),\n /* v8 ignore next -- see above */\n stdout: (text) => writeFileSync(1, text),\n }).then(() => process.exit(0));\n", "// SPDX-License-Identifier: Apache-2.0\n// The daemon's local socket (spec/CONTROL.md \u00A78): how the waiter, the Stop and\n// PermissionRequest hooks and the worker talk to the one daemon on this machine.\n// Line-delimited JSON, one request per connection. A Unix socket in the state\n// directory (0600, in a 0700 dir); a per-user named pipe on Windows. Only node:\n// builtins \u2014 the hook bundle imports this.\nimport net from \"node:net\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nexport type LocalRequest =\n /** A waiter parks until a message for its session arrives. */\n | { op: \"wait\"; session: string; pid?: number }\n /** A Stop hook asks for a queued message (turn mode). */\n | { op: \"stop\"; session: string; active: boolean }\n /** A PermissionRequest hook parks until a verified answer, or until it's released. */\n | { op: \"permission\"; session: string; attention: string; tool?: string }\n /** The worker reports a hook event: turn state and attention closure. */\n | { op: \"event\"; session: string; event: string; transcript?: string; cwd?: string }\n /** `sessionpipe control status`. */\n | { op: \"status\" }\n /** `sessionpipe update` installed a new copy: restart onto it once nothing is in hand. */\n | { op: \"restart\" };\n\nexport type LocalReply =\n | { op: \"message\"; text: string; id: string }\n | { op: \"block\"; reason: string; id: string }\n | { op: \"decision\"; behavior: \"allow\" | \"deny\"; message?: string; id: string }\n | { op: \"none\" }\n /** A newer waiter for the same session took over; this one stops. */\n | { op: \"replaced\" }\n | { op: \"ok\" }\n | { op: \"status\"; status: unknown };\n\n/** Where the daemon listens. `SESSIONPIPE_SOCKET` overrides (tests). */\nexport function socketPath(state: string, env: NodeJS.ProcessEnv = process.env): string {\n if (env.SESSIONPIPE_SOCKET) return env.SESSIONPIPE_SOCKET;\n if (process.platform === \"win32\") return `\\\\\\\\.\\\\pipe\\\\sessionpipe-control-${os.userInfo().username}`;\n return path.join(state, \"control.sock\");\n}\n\n/** One request, one reply. `timeoutMs` bounds the whole exchange; null on any\n * failure (no daemon, a timeout, a garbled reply) \u2014 callers treat that as \"none\". */\nexport function ask(sock: string, req: LocalRequest, timeoutMs: number): Promise<LocalReply | null> {\n return new Promise((resolve) => {\n let buf = \"\";\n let done = false;\n const s = net.connect(sock);\n const finish = (r: LocalReply | null) => {\n if (done) return;\n done = true;\n clearTimeout(t);\n s.destroy();\n resolve(r);\n };\n const t = setTimeout(() => finish(null), timeoutMs);\n s.on(\"connect\", () => s.write(`${JSON.stringify(req)}\\n`));\n s.on(\"data\", (d) => {\n buf += d.toString(\"utf8\");\n const i = buf.indexOf(\"\\n\");\n if (i < 0) return;\n try {\n finish(JSON.parse(buf.slice(0, i)) as LocalReply);\n } catch {\n finish(null);\n }\n });\n s.on(\"error\", () => finish(null));\n s.on(\"close\", () => finish(null));\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;AAOA,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,YAAY,WAAW,cAAc,cAAc,UAAU,qBAAqB;AAC3G,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,eAAe,qBAAqB;;;ACN7C,OAAO,SAAS;AAChB,OAAO,QAAQ;AACf,OAAO,UAAU;
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n// SPDX-License-Identifier: Apache-2.0\n// The hook path. A harness runs `node hook.js <harness> <event>`; this reads stdin,\n// writes one job file, spawns the worker detached, prints what the harness needs\n// (Antigravity's answer) and exits 0 \u2014 in milliseconds, with nothing but node:\n// builtins imported (the build checks that). No network, no schema library, no\n// config parsing beyond one small file read for the throttle.\nimport { spawn } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { ask, socketPath } from \"./control/local.js\";\n\n/** A Claude Code session id (the same test as core's notClaudeCode). */\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** The two streams the hook touches: stdin once, whole; stdout for an answer. */\nexport interface HookIO {\n stdin(): Buffer;\n stdout(text: string): void;\n}\n\n/** One hook run: `argv` is [harness, event, ...] as the harness invoked it, `env` the\n * process environment. Resolves once the job is on its way and any answer printed;\n * the process then exits 0, whatever happened (the hook is invisible to the harness). */\nexport async function hookMain(argv: string[], env: NodeJS.ProcessEnv, io: HookIO): Promise<void> {\n const t0 = process.hrtime.bigint();\n /** The hook's own work, when a control wait follows it (the wait is not the hook's cost). */\n let workMs: number | null = null;\n const [harness = \"\", event = \"\", ...rest] = argv;\n\n function stateDir(): string {\n if (env.SESSIONPIPE_STATE) return path.resolve(env.SESSIONPIPE_STATE);\n const home = os.homedir();\n if (process.platform === \"win32\")\n return path.join(env.LOCALAPPDATA || path.join(home, \"AppData\", \"Local\"), \"sessionpipe\");\n return path.join(env.XDG_STATE_HOME || path.join(home, \".local\", \"state\"), \"sessionpipe\");\n }\n function configFile(): string {\n if (env.SESSIONPIPE_CONFIG) return path.resolve(env.SESSIONPIPE_CONFIG);\n const home = os.homedir();\n if (process.platform === \"win32\")\n return path.join(env.APPDATA || path.join(home, \"AppData\", \"Roaming\"), \"sessionpipe\", \"config.json\");\n return path.join(env.XDG_CONFIG_HOME || path.join(home, \".config\"), \"sessionpipe\", \"config.json\");\n }\n\n // Antigravity parses stdout as the hook's answer; `{}` is \"carry on\" for every event we\n // register. PreToolUse is not one of them: `{}` there is a deny, so an entry an older\n // install left behind asks the person instead (core's AG_STALE_PRETOOL, same bytes).\n if (harness === \"antigravity\") {\n try {\n io.stdout(\n event === \"PreToolUse\"\n ? '{\"decision\":\"ask\",\"reason\":\"sessionpipe: an outdated PreToolUse hook is still loaded. Restart this conversation (or run sessionpipe install) to drop it.\"}\\n'\n : \"{}\\n\",\n );\n } catch {}\n }\n\n const state = stateDir();\n try {\n if (!harness || !event) throw new Error(\"usage: hook <harness> <event>\");\n let stdin = \"\";\n if (harness !== \"codex\" || event !== \"notify\") {\n try {\n const buf = io.stdin();\n stdin = buf.subarray(0, 1024 * 1024).toString(\"utf8\");\n } catch {}\n }\n // Claude Code's status line (install --status-line) runs on every refresh. It shows\n // the account's limits, and only a change becomes a job (limits.observed): at most\n // one a minute per config dir, and none when no sink takes tier 1.\n if (harness === \"claude-code\" && event === \"StatusLine\") {\n const limits = statusLimits(stdin);\n if (limits.line) {\n try {\n io.stdout(`${limits.line}\\n`);\n } catch {}\n }\n if (!limits.sig || !anySinkAbove(0) || !limitsDue(limits.sig)) return finish(false);\n }\n // Tool events are the bulk of what a harness fires. When no sink takes tier \u2265 1\n // they are only a \"still working\" signal: one heartbeat a minute per session.\n const TOOL = /^(PreToolUse|PostToolUse|PostToolUseFailure|BeforeTool|AfterTool|PostInvocation)$/;\n if (TOOL.test(event) && !anySinkAbove(0)) {\n const id = sessionIdOf(stdin);\n if (!id || !beatDue(id)) return finish(false);\n }\n // A Stop asks the daemon BEFORE its event goes to the worker: the worker reports the\n // Stop to the daemon too, and a message queued for this Stop must be taken here,\n // not rerouted because the event got there first.\n const stopAnswer = event === \"Stop\" ? await (controlAsk(stdin) ?? Promise.resolve(null)) : null;\n mkdirSync(path.join(state, \"jobs\"), { recursive: true, mode: 0o700 });\n const job = {\n harness,\n event,\n argv: [harness, event, ...rest],\n stdin,\n cwd: process.cwd(),\n env: pick([\n // Where a harness keeps its config and its sessions, so a job swept by a worker\n // some other harness's hook spawned still resolves this harness's own homes\n // (run.ts sweepJobs runs any stale job file, whatever spawned the worker).\n \"APPDATA\",\n \"CLAUDE_CODE_HOST_SESSION_ID\",\n // session.attended: Claude Code's own word, and SESSIONPIPE_CONTROL_JOB below, the\n // control daemon's mark on a turn it runs for a person's message.\n \"CLAUDE_CODE_SESSION_ATTENDED\",\n \"CLAUDE_CONFIG_DIR\",\n \"CLAUDE_PROJECT_DIR\",\n \"CODEX_HOME\",\n // Devin's payload names no folder at all; this is the only thing that does.\n \"DEVIN_PROJECT_DIR\",\n \"GEMINI_CLI_HOME\",\n \"SESSIONPIPE_CONTROL_JOB\",\n // The launcher a script named for a session it starts (PROTOCOL.md \u00A73 launched_by).\n \"SESSIONPIPE_LAUNCHED_BY\",\n // Devin's config file and session store are both resolved through these.\n \"XDG_CONFIG_HOME\",\n \"XDG_DATA_HOME\",\n ]),\n ppid: process.ppid,\n at: Date.now(),\n };\n const jobFile = path.join(\n state,\n \"jobs\",\n `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}.json`,\n );\n writeFileSync(jobFile, JSON.stringify(job), { mode: 0o600 });\n if (!env.SESSIONPIPE_NO_WORKER) {\n const worker = path.join(path.dirname(fileURLToPath(import.meta.url)), \"worker.js\");\n const p = spawn(process.execPath, [worker, jobFile], { detached: true, stdio: \"ignore\", windowsHide: true, env });\n p.unref();\n }\n if (stopAnswer) {\n try {\n io.stdout(`${stopAnswer}\\n`);\n } catch {}\n }\n // A PermissionRequest waits AFTER its event is on its way, so the receiver already\n // shows the Allow / Deny this answer is for.\n const ctl = event === \"PermissionRequest\" ? controlAsk(stdin) : null;\n if (ctl) {\n workMs = Number(process.hrtime.bigint() - t0) / 1e6;\n const out = await ctl;\n if (out) {\n try {\n io.stdout(`${out}\\n`);\n } catch {}\n }\n }\n return finish(true);\n } catch {\n return finish(false); // the hook must be invisible to the harness\n }\n\n /** Control (spec/CONTROL.md \u00A76, \u00A79): only on a machine with control paired, and only\n * for a message the daemon itself verified. A Stop hook asks for a queued message and\n * answers a block with it; a PermissionRequest hook waits for the person's signed\n * answer while the terminal shows its own prompt, first answer wins. Anything that\n * goes wrong (no daemon, a timeout) prints nothing: the harness carries on as usual. */\n function controlAsk(stdin: string): Promise<string | null> | null {\n if (harness !== \"claude-code\" || (event !== \"Stop\" && event !== \"PermissionRequest\")) return null;\n if (env.SESSIONPIPE_CONTROL_JOB) return null; // a headless turn the daemon itself runs\n const sock = socketPath(state, env);\n if (\n process.platform === \"win32\"\n ? !existsSync(path.join(path.dirname(configFile()), \"control.json\"))\n : !existsSync(sock)\n )\n return null;\n let s: Record<string, unknown>;\n try {\n s = JSON.parse(stdin) as Record<string, unknown>;\n } catch {\n return null;\n }\n const id = typeof s.session_id === \"string\" ? s.session_id : \"\";\n if (!id) return null;\n // Our entry in ~/.claude/settings.json is run by every harness that imports that file\n // \u2014 Devin's `claude` hooks provider is live, not a stub \u2014 and it arrives under the\n // claude-code name. Every Claude Code payload names a transcript and a UUID session;\n // a payload with neither is somebody else's, and must not be parked for up to 125 s\n // waiting on an answer that is not coming. Same test as core's notClaudeCode\n // (claude-code.ts), which the worker applies; repeated here because this file imports\n // nothing but node builtins.\n if (typeof s.transcript_path !== \"string\" && !UUID.test(id)) return null;\n const session = `claude-code:${id}`;\n if (event === \"Stop\")\n return ask(sock, { op: \"stop\", session, active: s.stop_hook_active === true }, 300).then((r) =>\n r?.op === \"block\" ? JSON.stringify({ decision: \"block\", reason: r.reason }) : null,\n );\n // The attention id the adapter puts on attention.needed (claude-code.ts), so the\n // receiver's Allow / Deny names this very prompt.\n const tool =\n typeof s.tool_name === \"string\" && /^[A-Za-z0-9_.:-]{1,120}$/.test(s.tool_name) ? s.tool_name : undefined;\n const turn = typeof s.prompt_id === \"string\" ? s.prompt_id : undefined;\n const attention = `perm-${createHash(\"sha256\")\n .update(`${turn ?? \"\"}|${tool ?? \"\"}|${JSON.stringify(s.tool_input ?? null)}`)\n .digest(\"hex\")\n .slice(0, 16)}`;\n return ask(sock, { op: \"permission\", session, attention, ...(tool ? { tool } : {}) }, 125_000).then((r) =>\n r?.op === \"decision\"\n ? JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"PermissionRequest\",\n decision:\n r.behavior === \"allow\"\n ? { behavior: \"allow\" }\n : { behavior: \"deny\", message: r.message || \"Denied by the owner (sessionpipe control).\" },\n },\n })\n : null,\n );\n }\n\n /** The timing line; the process exits 0 right after. */\n function finish(spawned: boolean): void {\n const total = Number(process.hrtime.bigint() - t0) / 1e6;\n const ms = workMs ?? total;\n try {\n mkdirSync(state, { recursive: true });\n appendFileSync(\n path.join(state, \"timing.jsonl\"),\n `${JSON.stringify({ at: Date.now(), harness, event, ms: Math.round(ms * 10) / 10, spawned, ...(workMs !== null ? { control_wait_ms: Math.round(total - workMs) } : {}) })}\\n`,\n );\n } catch {}\n }\n function pick(names: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const n of names) if (env[n] !== undefined) out[n] = env[n] as string;\n return out;\n }\n function anySinkAbove(tier: number): boolean {\n try {\n const c = JSON.parse(readFileSync(configFile(), \"utf8\")) as { sinks?: { tier?: number; paused?: string }[] };\n return (c.sinks ?? []).some((s) => Number(s.tier) > tier && !s.paused);\n } catch {\n return false;\n }\n }\n function sessionIdOf(stdin: string): string {\n const m = /\"(?:session_id|sessionId|conversationId)\"\\s*:\\s*\"([^\"]{1,128})\"/.exec(stdin);\n return m?.[1] ?? \"\";\n }\n /** The status line's `rate_limits` as one short line (`5h 23% \u00B7 week 41%`), and as\n * the text a change is told by. Empty when the account has none. */\n function statusLimits(stdin: string): { line: string; sig: string } {\n let rl: unknown;\n try {\n rl = (JSON.parse(stdin) as { rate_limits?: unknown }).rate_limits;\n } catch {}\n if (!rl || typeof rl !== \"object\") return { line: \"\", sig: \"\" };\n const label: Record<string, string> = { five_hour: \"5h\", seven_day: \"week\", spend_limit: \"spend\" };\n const parts = Object.entries(rl as Record<string, { used_percentage?: unknown }>)\n .filter(([, w]) => typeof w?.used_percentage === \"number\")\n .map(([id, w]) => `${label[id] ?? id} ${Math.round(w.used_percentage as number)}%`);\n return parts.length ? { line: parts.join(\" \u00B7 \"), sig: JSON.stringify(rl) } : { line: \"\", sig: \"\" };\n }\n /** A change of limits, at most one a minute per config dir (one account each): the\n * stamp holds the last limits sent, its mtime when. */\n function limitsDue(sig: string): boolean {\n const dir = createHash(\"sha256\")\n .update(env.CLAUDE_CONFIG_DIR ?? \"\")\n .digest(\"hex\")\n .slice(0, 12);\n const stamp = path.join(state, \"beats\", `${harness}-limits-${dir}`);\n try {\n if (readFileSync(stamp, \"utf8\") === sig || Date.now() - statSync(stamp).mtimeMs < 60_000) return false;\n } catch {}\n try {\n mkdirSync(path.dirname(stamp), { recursive: true, mode: 0o700 });\n writeFileSync(stamp, sig, { mode: 0o600 });\n } catch {}\n return true;\n }\n /** One heartbeat per minute per session: the stamp file's mtime is the clock. */\n function beatDue(id: string): boolean {\n const stamp = path.join(state, \"beats\", `${harness}-${id.replace(/[^A-Za-z0-9_-]/g, \"_\")}`);\n try {\n if (Date.now() - statSync(stamp).mtimeMs < 60_000) return false;\n } catch {}\n try {\n mkdirSync(path.dirname(stamp), { recursive: true, mode: 0o700 });\n writeFileSync(stamp, \"\", { mode: 0o600 });\n } catch {}\n return true;\n }\n}\n\n// Run as `node hook.js <harness> <event>`; importing this module runs nothing. The main\n// module is known by its real path: node resolves symlinks for import.meta.url, argv[1]\n// keeps the spelling it was given (/var \u2192 /private/var on macOS).\nif (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href)\n hookMain(process.argv.slice(2), process.env, {\n // fd 0 and 1 are the test runner's own (a read of 0 would block it); launcher.test.ts\n // and the bench run these two through the real binary.\n /* v8 ignore next -- see above */\n stdin: () => readFileSync(0),\n /* v8 ignore next -- see above */\n stdout: (text) => writeFileSync(1, text),\n }).then(() => process.exit(0));\n", "// SPDX-License-Identifier: Apache-2.0\n// The daemon's local socket (spec/CONTROL.md \u00A78): how the waiter, the Stop and\n// PermissionRequest hooks and the worker talk to the one daemon on this machine.\n// Line-delimited JSON, one request per connection. A Unix socket in the state\n// directory (0600, in a 0700 dir); a per-user named pipe on Windows. Only node:\n// builtins \u2014 the hook bundle imports this.\nimport net from \"node:net\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nexport type LocalRequest =\n /** A waiter parks until a message for its session arrives. */\n | { op: \"wait\"; session: string; pid?: number }\n /** A Stop hook asks for a queued message (turn mode). */\n | { op: \"stop\"; session: string; active: boolean }\n /** A PermissionRequest hook parks until a verified answer, or until it's released. */\n | { op: \"permission\"; session: string; attention: string; tool?: string }\n /** The worker reports a hook event: turn state and attention closure. */\n | { op: \"event\"; session: string; event: string; transcript?: string; cwd?: string }\n /** `sessionpipe control status`. */\n | { op: \"status\" }\n /** `sessionpipe update` installed a new copy: restart onto it once nothing is in hand. */\n | { op: \"restart\" }\n /** `sessionpipe pool \u2026` while the daemon runs: the daemon holds the pool's engine\n * (pins, credentials, the listener), so a change goes through it. `status` reads;\n * the rest are CONTROL.md \u00A76's actions, plus `import` (reads this machine's own\n * Claude Code logins, which no receiver may ask for). */\n | { op: \"pool\"; action: PoolOp; account?: string; order?: string[]; code?: string };\n\nexport type PoolOp =\n | \"status\"\n | \"on\"\n | \"off\"\n | \"enable\"\n | \"disable\"\n | \"remove\"\n | \"order\"\n | \"refresh\"\n | \"login.begin\"\n | \"login.complete\"\n | \"import\";\n\nexport type LocalReply =\n | { op: \"message\"; text: string; id: string }\n | { op: \"block\"; reason: string; id: string }\n | { op: \"decision\"; behavior: \"allow\" | \"deny\"; message?: string; id: string }\n | { op: \"none\" }\n /** A newer waiter for the same session took over; this one stops. */\n | { op: \"replaced\" }\n | { op: \"ok\" }\n | { op: \"status\"; status: unknown }\n /** A pool op's answer: the ack it would earn (CONTROL.md \u00A76) and the pool as it now\n * stands (`status`: the fa\u00E7ade's PoolStatus; `detail`: the summary line, or a\n * login.begin's \"<pending id> <URL>\"). */\n | {\n op: \"pool\";\n outcome: \"delivered\" | \"refused\" | \"failed\" | \"unsupported\";\n code?: string;\n detail: string;\n status?: unknown;\n /** `import`: what was added and what was left out (control/pool.ts Imported). */\n imported?: unknown;\n };\n\n/** Where the daemon listens. `SESSIONPIPE_SOCKET` overrides (tests). */\nexport function socketPath(state: string, env: NodeJS.ProcessEnv = process.env): string {\n if (env.SESSIONPIPE_SOCKET) return env.SESSIONPIPE_SOCKET;\n if (process.platform === \"win32\") return `\\\\\\\\.\\\\pipe\\\\sessionpipe-control-${os.userInfo().username}`;\n return path.join(state, \"control.sock\");\n}\n\n/** One request, one reply. `timeoutMs` bounds the whole exchange; null on any\n * failure (no daemon, a timeout, a garbled reply) \u2014 callers treat that as \"none\". */\nexport function ask(sock: string, req: LocalRequest, timeoutMs: number): Promise<LocalReply | null> {\n return new Promise((resolve) => {\n let buf = \"\";\n let done = false;\n const s = net.connect(sock);\n const finish = (r: LocalReply | null) => {\n if (done) return;\n done = true;\n clearTimeout(t);\n s.destroy();\n resolve(r);\n };\n const t = setTimeout(() => finish(null), timeoutMs);\n s.on(\"connect\", () => s.write(`${JSON.stringify(req)}\\n`));\n s.on(\"data\", (d) => {\n buf += d.toString(\"utf8\");\n const i = buf.indexOf(\"\\n\");\n if (i < 0) return;\n try {\n finish(JSON.parse(buf.slice(0, i)) as LocalReply);\n } catch {\n finish(null);\n }\n });\n s.on(\"error\", () => finish(null));\n s.on(\"close\", () => finish(null));\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAOA,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,YAAY,WAAW,cAAc,cAAc,UAAU,qBAAqB;AAC3G,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,eAAe,qBAAqB;;;ACN7C,OAAO,SAAS;AAChB,OAAO,QAAQ;AACf,OAAO,UAAU;AAyDV,SAAS,WAAW,OAAe,MAAyB,QAAQ,KAAa;AACtF,MAAI,IAAI,mBAAoB,QAAO,IAAI;AACvC,MAAI,QAAQ,aAAa,QAAS,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