sessionpipe 0.7.0 → 0.10.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 +83 -6
- package/dist/cli.d.ts +11 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5043 -2609
- package/dist/cli.js.map +4 -4
- package/dist/connect.d.ts.map +1 -1
- package/dist/control/aliases.d.ts +5 -0
- package/dist/control/aliases.d.ts.map +1 -1
- package/dist/control/autoupdate.d.ts +1 -18
- package/dist/control/autoupdate.d.ts.map +1 -1
- package/dist/control/cli.d.ts +8 -1
- package/dist/control/cli.d.ts.map +1 -1
- package/dist/control/daemon.d.ts +95 -9
- package/dist/control/daemon.d.ts.map +1 -1
- package/dist/control/files.d.ts +35 -0
- package/dist/control/files.d.ts.map +1 -0
- package/dist/control/pair.d.ts +22 -23
- package/dist/control/pair.d.ts.map +1 -1
- package/dist/control/route.d.ts +1 -1
- package/dist/control/route.d.ts.map +1 -1
- package/dist/control/sdk.d.ts.map +1 -1
- package/dist/control/store.d.ts +21 -2
- package/dist/control/store.d.ts.map +1 -1
- package/dist/control/stream.d.ts.map +1 -1
- package/dist/help.d.ts +3 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/hook.d.ts +9 -1
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +190 -158
- package/dist/hook.js.map +3 -3
- package/dist/http-sink.d.ts +3 -0
- package/dist/http-sink.d.ts.map +1 -1
- package/dist/index.js +1038 -237
- package/dist/index.js.map +4 -4
- package/dist/launcher.d.ts.map +1 -1
- package/dist/run.d.ts +70 -8
- package/dist/run.d.ts.map +1 -1
- package/dist/runtime.d.ts +5 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/update.d.ts +1 -6
- package/dist/update.d.ts.map +1 -1
- package/dist/worker.d.ts +3 -1
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +1127 -287
- package/dist/worker.js.map +4 -4
- package/package.json +5 -4
package/dist/connect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAMA,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAMA,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM1D;AAMD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;0DACsD;IACtD,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;CACzD;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,CAAC,EAAE;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,YAAY,CAiBf;AAED;2FAC2F;AAC3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAIhG"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { type StartOptions } from "./store.js";
|
|
1
2
|
export interface Alias {
|
|
2
3
|
/** The harness's own session id. */
|
|
3
4
|
id: string;
|
|
4
5
|
/** The folder the session runs in (the start's). */
|
|
5
6
|
cwd: string;
|
|
6
7
|
at: string;
|
|
8
|
+
/** What the start ran with (CONTROL.md §6, Options); absent for an alias recorded
|
|
9
|
+
* before 0.10.0, whose later runs keep the machine's mode. */
|
|
10
|
+
permission?: StartOptions["permission"];
|
|
11
|
+
model?: string;
|
|
7
12
|
}
|
|
8
13
|
export type Aliases = Record<string, Alias>;
|
|
9
14
|
export declare const aliasFile: (controlDir: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../src/control/aliases.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,KAAK;IACpB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../src/control/aliases.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,YAAY,CAAC;AAE/D,MAAM,WAAW,KAAK;IACpB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX;mEAC+D;IAC/D,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5C,eAAO,MAAM,SAAS,eAAgB,MAAM,KAAG,MAA+C,CAAC;AAE/F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAcjD;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAQ7D;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIrF"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
1
|
import type { Config } from "@sessionpipe/core";
|
|
3
|
-
|
|
4
|
-
export declare const UPDATE_EXIT = 75;
|
|
2
|
+
export { supervise, UPDATE_EXIT } from "@sessionpipe/core/version";
|
|
5
3
|
export declare const DAY_MS: number;
|
|
6
4
|
/** What the daemon remembers about updating, in state/control/update.json. */
|
|
7
5
|
export interface UpdateRecord {
|
|
@@ -138,19 +136,4 @@ export declare class AutoUpdater {
|
|
|
138
136
|
private apply;
|
|
139
137
|
private installAndRestart;
|
|
140
138
|
}
|
|
141
|
-
/** The parent left behind when no service manager will restart the daemon: runs
|
|
142
|
-
* `control run` as a child with the same env and output, starts it again when it exits
|
|
143
|
-
* UPDATE_EXIT (an update) or fails (after 5 s, like the service files), and exits
|
|
144
|
-
* with it when it exits cleanly or is told to stop. */
|
|
145
|
-
export declare function supervise(o: {
|
|
146
|
-
node: string;
|
|
147
|
-
args: string[];
|
|
148
|
-
env: NodeJS.ProcessEnv;
|
|
149
|
-
log: (line: string) => void;
|
|
150
|
-
spawn?: typeof spawn;
|
|
151
|
-
exit?: (code: number) => void;
|
|
152
|
-
failDelayMs?: number;
|
|
153
|
-
}): {
|
|
154
|
-
stop: (sig?: NodeJS.Signals) => void;
|
|
155
|
-
};
|
|
156
139
|
//# sourceMappingURL=autoupdate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoupdate.d.ts","sourceRoot":"","sources":["../../src/control/autoupdate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autoupdate.d.ts","sourceRoot":"","sources":["../../src/control/autoupdate.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CA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C,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,OAAO,CAAwC;IAEvD,YAA6B,CAAC,EAAE,WAAW,EAAI;IAE/C,KAAK,IAAI,IAAI,CASZ;IAED,IAAI,IAAI,IAAI,CAIX;IAED,MAAM,IAAI,YAAY,CAErB;IAED,OAAO,CAAC,IAAI;IAMZ,iFAAiF;IAC3E,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB1B;IAED,oFAAoF;IACpF,OAAO,CAAC,KAAK;IAYb,kFAAkF;IAClF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBrB;IAED,mFAAmF;IACnF,eAAe,IAAI,OAAO,CAkBzB;IAED;;8DAE0D;YAC5C,OAAO;IAwBrB,mFAAmF;YACrE,aAAa;YASb,KAAK;YAML,iBAAiB;CAwChC"}
|
package/dist/control/cli.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type Tier } from "@sessionpipe/core";
|
|
2
|
-
export declare const CONTROL_HELP = " sessionpipe control pair <receiver> [--folder DIR]\u2026 [--mode safe|auto] [--tier 0-3] [--token T] [--name N] [--no-service]\n sessionpipe control mode auto|safe
|
|
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)";
|
|
3
|
+
/** `control folders add|remove`: the new list, and a line per folder saying what became
|
|
4
|
+
* of it. A folder to add must exist and be a project, never the home folder or above
|
|
5
|
+
* it (pair's rule); folders are compared as real paths, as the daemon compares them. */
|
|
6
|
+
export declare function changeFolders(folders: string[], op: "add" | "remove", dirs: string[], home?: string): {
|
|
7
|
+
folders: string[];
|
|
8
|
+
said: string[];
|
|
9
|
+
};
|
|
3
10
|
export declare function controlMain(argv: string[], out: (s?: string) => void, distDir: string): Promise<void>;
|
|
4
11
|
/** The harnesses set up on this machine, whose hooks an update re-arms. */
|
|
5
12
|
export declare function enabledHarnesses(harnesses: Record<string, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/control/cli.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/control/cli.ts"],"names":[],"mappings":"AAKA,OAAO,EAWL,KAAK,IAAI,EAEV,MAAM,mBAAmB,CAAC;AAiB3B,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,CA6J3G;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,CAK3F;AAgHD,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,6 +1,16 @@
|
|
|
1
|
-
import { claudeControl, type Login, type RunOptions, type RunResult } from "@sessionpipe/core";
|
|
1
|
+
import { claudeControl, type HarnessAccount, type Login, type RunOptions, type RunResult } from "@sessionpipe/core";
|
|
2
|
+
import { type RunLevel, type StartPermission } from "@sessionpipe/core/control";
|
|
3
|
+
import { type DeliveryMode } from "./route.js";
|
|
2
4
|
import { type ControlConfig, type PairedReceiver } from "./store.js";
|
|
3
5
|
type Caps = claudeControl.Caps;
|
|
6
|
+
/** One harness's entry in the hello's `start` (CONTROL.md §2). */
|
|
7
|
+
export interface StartEntry {
|
|
8
|
+
permissions: StartPermission[];
|
|
9
|
+
/** What a start that names none gets: a level, or `inherit` on an inherit machine. */
|
|
10
|
+
permission: RunLevel;
|
|
11
|
+
models?: string[];
|
|
12
|
+
any_model?: boolean;
|
|
13
|
+
}
|
|
4
14
|
/** The message as the receiver carried it (control.json). */
|
|
5
15
|
export interface Carried {
|
|
6
16
|
id: string;
|
|
@@ -22,7 +32,8 @@ export interface Carried {
|
|
|
22
32
|
at: string;
|
|
23
33
|
expires_at: string;
|
|
24
34
|
}
|
|
25
|
-
/** A session the
|
|
35
|
+
/** A session the daemon holds: through the Agent SDK (sdk.ts; a fake in tests), or an
|
|
36
|
+
* ACP agent it runs (core's acp-control.ts), which says so in `mode`. */
|
|
26
37
|
export interface SdkSession {
|
|
27
38
|
/** Deliver one message; resolves with the agent's reply when the turn ends. */
|
|
28
39
|
send(text: string): Promise<{
|
|
@@ -33,12 +44,19 @@ export interface SdkSession {
|
|
|
33
44
|
close(): void;
|
|
34
45
|
readonly busy: boolean;
|
|
35
46
|
readonly lastUsed: number;
|
|
47
|
+
/** How a message through it is acked; `sdk` when unsaid. */
|
|
48
|
+
readonly mode?: DeliveryMode;
|
|
49
|
+
/** Gone for good (the process left): drop it, a later message reopens the session. */
|
|
50
|
+
readonly closed?: boolean;
|
|
36
51
|
}
|
|
37
52
|
export interface SdkHost {
|
|
38
53
|
start(o: {
|
|
39
54
|
session: string;
|
|
40
55
|
cwd: string;
|
|
41
|
-
|
|
56
|
+
/** The level the session runs at (CONTROL.md §3.1), as its `permissionMode`; none in inherit. */
|
|
57
|
+
permission: RunLevel;
|
|
58
|
+
/** The model, when the start asked for one. */
|
|
59
|
+
model?: string;
|
|
42
60
|
configDir?: string;
|
|
43
61
|
allowedTools?: string[];
|
|
44
62
|
}): SdkSession;
|
|
@@ -58,15 +76,28 @@ export interface DaemonDeps {
|
|
|
58
76
|
agy?: () => string | null;
|
|
59
77
|
/** Is Codex signed in as this process sees it? Asked before a run. */
|
|
60
78
|
codexLogin?: (bin: string) => Promise<Login>;
|
|
79
|
+
/** An ACP agent's CLI on this machine, by harness name (core's findAcpAgent; null:
|
|
80
|
+
* not installed). Absent: this daemon drives none of them. */
|
|
81
|
+
acp?: (harness: string) => {
|
|
82
|
+
bin: string;
|
|
83
|
+
args: string[];
|
|
84
|
+
} | null;
|
|
61
85
|
/** The harnesses every hello advertises (core's drivableHarnesses); by default, the
|
|
62
86
|
* ones the finders above find. */
|
|
63
87
|
harnesses?: () => string[];
|
|
88
|
+
/** The harness accounts every hello names; by default, those signed in across
|
|
89
|
+
* `claudeDirs`, read again for each hello. */
|
|
90
|
+
accounts?: () => HarnessAccount[];
|
|
91
|
+
/** The models a hello suggests for Codex; by default, its own models cache. */
|
|
92
|
+
codexModels?: () => string[];
|
|
64
93
|
run: (bin: string, args: string[], o: RunOptions) => Promise<RunResult>;
|
|
65
94
|
sdk?: SdkHost | null;
|
|
66
95
|
/** How long to follow a live session's turn for an in-place answer (tests shorten it). */
|
|
67
96
|
answerWaitMs?: number;
|
|
68
97
|
/** Close an SDK session idle this long (a held session costs ~300 MB). */
|
|
69
98
|
sdkIdleMs?: number;
|
|
99
|
+
/** How long one of a start's files may take to download (tests shorten it). */
|
|
100
|
+
fileTimeoutMs?: number;
|
|
70
101
|
env?: NodeJS.ProcessEnv;
|
|
71
102
|
/** Is Claude Code signed in for this account, as this process sees it? Asked before
|
|
72
103
|
* a headless run, so a login the daemon can't read (a macOS keychain with nobody at
|
|
@@ -104,7 +135,10 @@ export interface Status {
|
|
|
104
135
|
machine: string;
|
|
105
136
|
keys: number;
|
|
106
137
|
polling: boolean;
|
|
138
|
+
/** Last successful poll; failed responses must not conceal a control outage. */
|
|
107
139
|
last_poll: number | null;
|
|
140
|
+
/** Time since success, or since this loop started if it has never succeeded. */
|
|
141
|
+
last_poll_age_ms: number;
|
|
108
142
|
last_error: string | null;
|
|
109
143
|
}[];
|
|
110
144
|
waiting: string[];
|
|
@@ -117,6 +151,8 @@ export interface Status {
|
|
|
117
151
|
nonces: number;
|
|
118
152
|
acks_pending: number;
|
|
119
153
|
delivered: Record<string, number>;
|
|
154
|
+
/** What a start may carry per harness, as the last hello said (CONTROL.md §2). */
|
|
155
|
+
start: Record<string, StartEntry>;
|
|
120
156
|
/** Null when the daemon could restart now (nothing in hand); otherwise what it holds. */
|
|
121
157
|
busy: string | null;
|
|
122
158
|
update?: unknown;
|
|
@@ -234,12 +270,14 @@ export declare class ControlDaemon {
|
|
|
234
270
|
* session's own transcript (Claude Code, Codex), the folder its start recorded, or
|
|
235
271
|
* the hooks' cwd, never the command. */
|
|
236
272
|
private place;
|
|
237
|
-
/** A Codex or
|
|
238
|
-
* id and the start's folder); one the hooks reported is Codex's
|
|
239
|
-
* `session_meta` cwd) or, for
|
|
273
|
+
/** A Codex, Antigravity or ACP-driven session: one the daemon started is its alias
|
|
274
|
+
* (the harness's id and the start's folder); one the hooks reported is Codex's
|
|
275
|
+
* rollout (its `session_meta` cwd) or, for the others, the folder its hooks gave. */
|
|
240
276
|
private placeDriven;
|
|
241
277
|
/** The folder the worker recorded for a session from its hooks (run.ts, facts). */
|
|
242
278
|
private factsCwd;
|
|
279
|
+
/** A driven harness, as the person knows it. */
|
|
280
|
+
private label;
|
|
243
281
|
private aliasOf;
|
|
244
282
|
/** The harness revealed its own id for a session the command named: from now on that
|
|
245
283
|
* is where the command's id leads (aliases.ts). Written before anything else reads it. */
|
|
@@ -247,13 +285,44 @@ export declare class ControlDaemon {
|
|
|
247
285
|
/** `<harness>:<harness's id>` → `<harness>:<the start's id>` for a session the daemon named. */
|
|
248
286
|
private named;
|
|
249
287
|
private driver;
|
|
250
|
-
/**
|
|
288
|
+
/** Who is signed in here, for hello. A bad .claude.json names nobody, never fails a hello. */
|
|
289
|
+
private accounts;
|
|
290
|
+
/** The harnesses this machine can run a message in, for hello: at most
|
|
291
|
+
* HELLO_HARNESSES_MAX, the three with their own drivers first. */
|
|
251
292
|
private harnesses;
|
|
293
|
+
/** The caps a new Claude Code session is started with: the Agent SDK's when the
|
|
294
|
+
* daemon has it, else what this machine's `claude --help` lists. */
|
|
295
|
+
private startCaps;
|
|
296
|
+
/** What a start may carry for one harness here (CONTROL.md §2 `start`), capped by the
|
|
297
|
+
* machine's mode; null when it takes neither option, or when a start without one
|
|
298
|
+
* would be refused (an auto machine whose Claude Code has no auto mode). */
|
|
299
|
+
private startEntry;
|
|
300
|
+
/** The hello's `start`: an entry for each harness it lists that takes options. */
|
|
301
|
+
private startOptions;
|
|
302
|
+
/** The options a start runs with, or the refusal (CONTROL.md §5 step 8): a level the
|
|
303
|
+
* machine offers for that harness, never above its mode, and a model only where the
|
|
304
|
+
* harness takes one. Never another level or model than the one asked for. */
|
|
305
|
+
private startChoice;
|
|
306
|
+
/** Why a harness has no such level here, though the machine's mode would allow it. */
|
|
307
|
+
private levelMissing;
|
|
308
|
+
/** The options a later run of a session gets: the narrower of what its start recorded
|
|
309
|
+
* and what the machine's mode means now, with the recorded model. A session with no
|
|
310
|
+
* record (the hooks reported it, or it predates 0.10.0) runs at the machine's mode. */
|
|
311
|
+
private laterOptions;
|
|
312
|
+
/** What the acks carry as `applied`: the model only when one was asked for. */
|
|
313
|
+
private applied;
|
|
314
|
+
/** A failed run that asked for a model, put down to the model: acked with code `model`. */
|
|
315
|
+
private failedRun;
|
|
316
|
+
/** The real folder a command or a session names, when it is one this machine allows:
|
|
317
|
+
* absolute, or under this user's home as `~/…` (a start's `cwd` may say either). */
|
|
252
318
|
private allowed;
|
|
253
319
|
private permission;
|
|
254
320
|
private cancel;
|
|
255
321
|
private view;
|
|
256
322
|
private prompt;
|
|
323
|
+
/** One message through a held session; one whose process left is let go of, so the
|
|
324
|
+
* next message reopens the session instead of finding it closed. */
|
|
325
|
+
private sendHeld;
|
|
257
326
|
/** A turn message whose Stop never took it: route again, now that it isn't mid-turn. */
|
|
258
327
|
private reroute;
|
|
259
328
|
/** Jobs for one session (and its copy) run one at a time, in order. */
|
|
@@ -286,8 +355,6 @@ export declare class ControlDaemon {
|
|
|
286
355
|
/** The answer so far, sent as a `progress` ack: whole, with a rising seq, at most
|
|
287
356
|
* one in flight. Fire-and-forget — the final ack carries everything. */
|
|
288
357
|
private answerStream;
|
|
289
|
-
/** How a headless run prints: streamed where this Claude Code can, else one JSON at the end. */
|
|
290
|
-
private outputArgs;
|
|
291
358
|
/** Mark a session as held by one of the daemon's runs while `fn` runs. */
|
|
292
359
|
private owning;
|
|
293
360
|
private limits;
|
|
@@ -295,9 +362,28 @@ export declare class ControlDaemon {
|
|
|
295
362
|
private slot;
|
|
296
363
|
private startSession;
|
|
297
364
|
private startOne;
|
|
365
|
+
/** A Claude Code session the daemon starts: what it runs with, for its later runs. */
|
|
366
|
+
private recordStart;
|
|
298
367
|
/** A new Codex or Antigravity session: the harness picks its id, and the start's id
|
|
299
368
|
* becomes its name (aliases.ts) as soon as the run says what it picked. */
|
|
300
369
|
private startDriven;
|
|
370
|
+
/** A new session of an ACP agent (CONTROL.md §6): the agent's CLI as a child the
|
|
371
|
+
* daemon keeps, the start's id as the session's name the moment the agent names its
|
|
372
|
+
* own (aliases.ts), and the first turn through it. Acked `delivered` in `api` mode;
|
|
373
|
+
* later messages go through the same process while it is held. */
|
|
374
|
+
private startAcp;
|
|
375
|
+
/** The next message for an ACP-driven session no process holds: the agent run again
|
|
376
|
+
* and the session reopened in it (`session/load`), then held like a new one. Acked
|
|
377
|
+
* `resume`, as any cold start. An agent that can't reopen one is `unsupported`. */
|
|
378
|
+
private resumeAcp;
|
|
379
|
+
private openAcp;
|
|
380
|
+
/** A start's or a prompt's text, with its files (CONTROL.md §6) fetched, checked and
|
|
381
|
+
* written under `cwd` first (a prompt's in a folder of its own, named by its signed
|
|
382
|
+
* nonce) — every check in §5 passed and the nonce is recorded by now, so the `taken`
|
|
383
|
+
* ack is out and the download may take its time. Null when a file failed: the command
|
|
384
|
+
* is acked `failed` with code `file`, nothing is kept, no session starts and no
|
|
385
|
+
* message is delivered. */
|
|
386
|
+
private attached;
|
|
301
387
|
private closeIdleSdk;
|
|
302
388
|
}
|
|
303
389
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/control/daemon.ts"],"names":[],"mappings":"
|
|
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;AAKnC,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;IA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OAAO;IAqBf;;;;;gCAK4B;YACd,QAAQ;IA+BtB,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ControlFile } from "@sessionpipe/core/control";
|
|
2
|
+
/** One file's download may take this long (25 MiB on a slow link). */
|
|
3
|
+
export declare const FETCH_TIMEOUT_MS: number;
|
|
4
|
+
/** A file could not be fetched, checked or written: the ack's `detail`, code `file`. */
|
|
5
|
+
export declare class FileProblem extends Error {
|
|
6
|
+
}
|
|
7
|
+
export interface Fetched {
|
|
8
|
+
file: ControlFile;
|
|
9
|
+
/** The name as written: NFC. */
|
|
10
|
+
name: string;
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export interface FetchOptions {
|
|
14
|
+
control: string;
|
|
15
|
+
token: string;
|
|
16
|
+
fetch: typeof fetch;
|
|
17
|
+
/** Per file; tests shorten it. */
|
|
18
|
+
timeoutMs?: number | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Fetch every file, in order, and check each against the signed size and hash.
|
|
21
|
+
* Every failure is a FileProblem naming the file. */
|
|
22
|
+
export declare function fetchFiles(files: ControlFile[], o: FetchOptions): Promise<Fetched[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Write the checked files to <cwd>/.sessionpipe/files/<session>/ (a start's, which must
|
|
25
|
+
* be new) or <session>/<message>/ (a prompt's: the session's folder may be there, the
|
|
26
|
+
* message's must be new), and answer their paths relative to cwd. `cwd` is already
|
|
27
|
+
* resolved (realpath) and allowed. On any problem everything written here is removed
|
|
28
|
+
* and FileProblem thrown.
|
|
29
|
+
*/
|
|
30
|
+
export declare function writeFiles(cwd: string, session: string, files: Fetched[], message?: string): string[];
|
|
31
|
+
/** 183402 → "179 KB", 1258291 → "1.2 MB" (units of 1024). */
|
|
32
|
+
export declare function humanSize(n: number): string;
|
|
33
|
+
/** The command's text followed by the list of files the session can read. */
|
|
34
|
+
export declare function withFiles(text: string, files: Fetched[], rel: string[]): string;
|
|
35
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/control/files.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,QAAa,CAAC;AAE3C,wFAAwF;AACxF,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAEzC,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAKD;sDACsD;AACtD,wBAAsB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAa1F;AA+CD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAiCrG;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI3C;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAG/E"}
|
package/dist/control/pair.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HarnessAccount } from "@sessionpipe/core";
|
|
2
|
+
import type { Exec } from "@sessionpipe/core/service";
|
|
3
|
+
import * as core from "@sessionpipe/core/service";
|
|
4
|
+
import { type ControlConfig, type ControlMode } from "./store.js";
|
|
2
5
|
export interface PairOptions {
|
|
3
6
|
url: string;
|
|
4
7
|
/** The person's sink token for this receiver (from `sink add`, or --token). Null:
|
|
@@ -6,7 +9,7 @@ export interface PairOptions {
|
|
|
6
9
|
* is the whole setup (CONTROL.md §2). */
|
|
7
10
|
token: string | null;
|
|
8
11
|
folders: string[];
|
|
9
|
-
mode:
|
|
12
|
+
mode: ControlMode;
|
|
10
13
|
name: string;
|
|
11
14
|
out: (s: string) => void;
|
|
12
15
|
fetch?: typeof fetch;
|
|
@@ -16,13 +19,26 @@ export interface PairOptions {
|
|
|
16
19
|
addSink?: (token: string) => void;
|
|
17
20
|
/** The harnesses this machine can run a message in (default: those installed here). */
|
|
18
21
|
harnesses?: string[];
|
|
22
|
+
/** The harness accounts signed in here (default: every Claude Code config dir's). */
|
|
23
|
+
accounts?: HarnessAccount[];
|
|
24
|
+
/** How long expired codes are renewed for (default RENEW_FOR_MS). */
|
|
25
|
+
renewFor?: number;
|
|
19
26
|
}
|
|
27
|
+
/** How long `control pair` keeps asking for fresh codes when nobody approves one. */
|
|
28
|
+
export declare const RENEW_FOR_MS: number;
|
|
20
29
|
export declare function discover(url: string, f: typeof fetch): Promise<{
|
|
21
30
|
control: string;
|
|
22
31
|
rpId: string;
|
|
23
32
|
open: boolean;
|
|
33
|
+
inherit: boolean;
|
|
24
34
|
events: string | null;
|
|
25
35
|
}>;
|
|
36
|
+
/** Why a machine won't run in inherit mode with this receiver (CONTROL.md §2): a
|
|
37
|
+
* receiver that doesn't know the mode would show the machine as safe. */
|
|
38
|
+
export declare const inheritRefused: (url: string) => string;
|
|
39
|
+
/** The paired receivers that don't say they show inherit mode (`control.inherit` in
|
|
40
|
+
* their well-known file), with why. A receiver that can't be read counts as one. */
|
|
41
|
+
export declare function withoutInherit(urls: string[], f?: typeof fetch): Promise<string[]>;
|
|
26
42
|
/** Pair (or add a key to) this machine with one receiver. Returns the saved config. */
|
|
27
43
|
export declare function pair(o: PairOptions): Promise<ControlConfig>;
|
|
28
44
|
/** `control off [<receiver>]`: tell the receiver, forget its token and keys. */
|
|
@@ -33,32 +49,15 @@ export declare function off(o: {
|
|
|
33
49
|
env?: NodeJS.ProcessEnv;
|
|
34
50
|
}): Promise<void | ControlConfig>;
|
|
35
51
|
export declare function removeKey(id: string, env?: NodeJS.ProcessEnv): number;
|
|
36
|
-
|
|
37
|
-
* (75, autoupdate.ts) to come back on the new code. SESSIONPIPE_SERVICE tells the
|
|
38
|
-
* daemon which manager that is (files from before it are recognized without it). */
|
|
52
|
+
export { type Exec, ensureLinger } from "@sessionpipe/core/service";
|
|
39
53
|
export declare function serviceFiles(o: {
|
|
40
54
|
node: string;
|
|
41
55
|
cli: string;
|
|
42
56
|
logDir: string;
|
|
43
57
|
home?: string;
|
|
44
58
|
}): {
|
|
45
|
-
plist:
|
|
46
|
-
|
|
47
|
-
body: string;
|
|
48
|
-
};
|
|
49
|
-
unit: {
|
|
50
|
-
file: string;
|
|
51
|
-
body: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
export type Exec = (cmd: string, args: string[]) => string;
|
|
55
|
-
/** A systemd user service stops when its person's last login ends — closing the ssh
|
|
56
|
-
* session to a lab workstation or a cloud machine stopped the daemon with it — unless
|
|
57
|
-
* the user lingers. `loginctl enable-linger` for yourself needs no root on systemd's
|
|
58
|
-
* default policy; where it does, say the one command that does it. */
|
|
59
|
-
export declare function ensureLinger(user: string, exec?: Exec): {
|
|
60
|
-
on: boolean;
|
|
61
|
-
note: string;
|
|
59
|
+
plist: core.ServiceFile;
|
|
60
|
+
unit: core.ServiceFile;
|
|
62
61
|
};
|
|
63
62
|
/** Write and start the service for this platform. Returns what it did, in words. */
|
|
64
63
|
export declare function installService(o: {
|
|
@@ -68,5 +67,5 @@ export declare function installService(o: {
|
|
|
68
67
|
exec?: Exec;
|
|
69
68
|
platform?: NodeJS.Platform;
|
|
70
69
|
}): string;
|
|
71
|
-
export declare function uninstallService(
|
|
70
|
+
export declare function uninstallService(_env?: NodeJS.ProcessEnv): void;
|
|
72
71
|
//# sourceMappingURL=pair.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../../src/control/pair.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../../src/control/pair.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAMjB,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ;;8CAE0C;IAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,cAAc,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AAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAE3F;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,CAAC,EAAE;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC5B,GAAG,MAAM,CAiBT;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAE/D"}
|
package/dist/control/route.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type Route = {
|
|
|
25
25
|
refused: "no_session";
|
|
26
26
|
};
|
|
27
27
|
/** The harnesses the daemon can run a turn of by itself: resume an idle session, start a
|
|
28
|
-
* new one (`claude -p`, `codex exec`, `agy -p
|
|
28
|
+
* new one (`claude -p`, `codex exec`, `agy -p`, or any ACP agent as its client). */
|
|
29
29
|
export declare const HEADLESS: Set<string>;
|
|
30
30
|
/** Where a prompt (or a start) goes. Never two writers on one transcript: a live
|
|
31
31
|
* session gets a fork, never a resume. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/control/route.ts"],"names":[],"mappings":"
|
|
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;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAEjG;qFACqF;AACrF,eAAO,MAAM,QAAQ,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;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAiBxE;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/control/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/control/sdk.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAmBvD,wBAAsB,OAAO,CAAC,CAAC,EAAE;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1B,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA8F1B"}
|
package/dist/control/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TrustedKey } from "@sessionpipe/core/control";
|
|
1
|
+
import { type RunLevel, type TrustedKey } from "@sessionpipe/core/control";
|
|
2
2
|
import { type Runner, type SecretStore, type StoreName } from "../secrets.js";
|
|
3
3
|
export interface PairedReceiver {
|
|
4
4
|
/** The receiver's origin, as the person typed it. */
|
|
@@ -18,11 +18,16 @@ export interface PairedReceiver {
|
|
|
18
18
|
})[];
|
|
19
19
|
paired_at: string;
|
|
20
20
|
}
|
|
21
|
+
/** How sessions run when a message arrives (CONTROL.md §2): the person's choice at
|
|
22
|
+
* this machine, never a receiver's. */
|
|
23
|
+
export declare const MODES: readonly ["safe", "auto", "inherit"];
|
|
24
|
+
export type ControlMode = (typeof MODES)[number];
|
|
25
|
+
export declare const parseMode: (m: unknown) => ControlMode | null;
|
|
21
26
|
export interface ControlConfig {
|
|
22
27
|
name: string;
|
|
23
28
|
/** Folders sessions may run in; compared on whole path segments, real paths. */
|
|
24
29
|
folders: string[];
|
|
25
|
-
mode:
|
|
30
|
+
mode: ControlMode;
|
|
26
31
|
receivers: PairedReceiver[];
|
|
27
32
|
/** Caps this machine keeps whatever a receiver sends (defaults in daemon.ts,
|
|
28
33
|
* LIMITS): new sessions running at once and per hour, headless Claude Code runs
|
|
@@ -76,7 +81,18 @@ export interface Ack {
|
|
|
76
81
|
code?: string;
|
|
77
82
|
detail?: string;
|
|
78
83
|
reply?: string;
|
|
84
|
+
/** A start's taken and delivered: what it ran with (CONTROL.md §6, Options). */
|
|
85
|
+
applied?: StartOptions;
|
|
79
86
|
}
|
|
87
|
+
/** What a session the daemon started runs with: its level and, when one was asked for,
|
|
88
|
+
* its model. Recorded at the start; every later run of the session reads it. */
|
|
89
|
+
export interface StartOptions {
|
|
90
|
+
/** A level, or `inherit`: started on an inherit machine with none named. */
|
|
91
|
+
permission: RunLevel;
|
|
92
|
+
model?: string;
|
|
93
|
+
}
|
|
94
|
+
/** A recorded entry as read back from disk, or null when it isn't one. */
|
|
95
|
+
export declare function startOptionsOf(v: unknown): StartOptions | null;
|
|
80
96
|
/** Acks not yet accepted: appended before they are sent, rewritten when sent, so a
|
|
81
97
|
* daemon restart re-sends rather than forgets (every message is acked exactly once
|
|
82
98
|
* with a final outcome; a duplicate is tolerated by the receiver). */
|
|
@@ -90,6 +106,9 @@ export declare class AckOutbox {
|
|
|
90
106
|
export interface DaemonState {
|
|
91
107
|
/** Original session → the fork its messages go to. */
|
|
92
108
|
copies: Record<string, string>;
|
|
109
|
+
/** Claude Code sessions the daemon started → what they run with (Codex and
|
|
110
|
+
* Antigravity keep theirs in the alias entry, aliases.ts). */
|
|
111
|
+
started: Record<string, StartOptions>;
|
|
93
112
|
}
|
|
94
113
|
export declare function readState(file: string): DaemonState;
|
|
95
114
|
export declare const writeState: (file: string, s: DaemonState) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/control/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/control/store.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAqC,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC9G,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;I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AAQ,CAAC,OAAO;IAT1B,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/control/stream.ts"],"names":[],"mappings":"AASA;mEACmE;AACnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAmB1F;AAED,qBAAa,YAAY;IASrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAT1B,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IAEvB,YACmB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAClD,OAAO,SAAM,EAC5B;IAEJ,8CAA8C;IAC9C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAWvB;IAED,6DAA6D;IAC7D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAItB;IAED,+CAA+C;IAC/C,KAAK,IAAI,IAAI,CAIZ;IAED,OAAO,CAAC,QAAQ;YASF,KAAK;CAcpB"}
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +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,CAqC/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
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
/** The two streams the hook touches: stdin once, whole; stdout for an answer. */
|
|
3
|
+
export interface HookIO {
|
|
4
|
+
stdin(): Buffer;
|
|
5
|
+
stdout(text: string): void;
|
|
6
|
+
}
|
|
7
|
+
/** One hook run: `argv` is [harness, event, ...] as the harness invoked it, `env` the
|
|
8
|
+
* process environment. Resolves once the job is on its way and any answer printed;
|
|
9
|
+
* the process then exits 0, whatever happened (the hook is invisible to the harness). */
|
|
10
|
+
export declare function hookMain(argv: string[], env: NodeJS.ProcessEnv, io: HookIO): Promise<void>;
|
|
3
11
|
//# sourceMappingURL=hook.d.ts.map
|
package/dist/hook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":""}
|
|
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,CA6NhG"}
|