sessionpipe-core 0.9.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.
Files changed (40) hide show
  1. package/dist/control.js +121 -12
  2. package/dist/control.js.map +2 -2
  3. package/dist/index.js +846 -308
  4. package/dist/index.js.map +4 -4
  5. package/dist/schema/v1.d.ts +266 -33
  6. package/dist/schema/v1.d.ts.map +1 -1
  7. package/dist/schema.js +128 -33
  8. package/dist/schema.js.map +2 -2
  9. package/dist/service.js +155 -0
  10. package/dist/service.js.map +7 -0
  11. package/dist/src/adapters/acp-control.d.ts +87 -0
  12. package/dist/src/adapters/acp-control.d.ts.map +1 -0
  13. package/dist/src/adapters/antigravity-control.d.ts +15 -5
  14. package/dist/src/adapters/antigravity-control.d.ts.map +1 -1
  15. package/dist/src/adapters/claude-code-control.d.ts +39 -4
  16. package/dist/src/adapters/claude-code-control.d.ts.map +1 -1
  17. package/dist/src/adapters/claude-code.d.ts.map +1 -1
  18. package/dist/src/adapters/codex-control.d.ts +23 -7
  19. package/dist/src/adapters/codex-control.d.ts.map +1 -1
  20. package/dist/src/adapters/codex.d.ts.map +1 -1
  21. package/dist/src/adapters/headless.d.ts +4 -1
  22. package/dist/src/adapters/headless.d.ts.map +1 -1
  23. package/dist/src/adapters/index.d.ts +7 -1
  24. package/dist/src/adapters/index.d.ts.map +1 -1
  25. package/dist/src/control/verify.d.ts +72 -16
  26. package/dist/src/control/verify.d.ts.map +1 -1
  27. package/dist/src/index.d.ts +2 -1
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/launched-by.d.ts +12 -0
  30. package/dist/src/launched-by.d.ts.map +1 -0
  31. package/dist/src/paths.d.ts +4 -0
  32. package/dist/src/paths.d.ts.map +1 -1
  33. package/dist/src/privacy/filter.d.ts.map +1 -1
  34. package/dist/src/service/index.d.ts +83 -0
  35. package/dist/src/service/index.d.ts.map +1 -0
  36. package/dist/src/version.d.ts +39 -0
  37. package/dist/src/version.d.ts.map +1 -0
  38. package/dist/version.js +75 -0
  39. package/dist/version.js.map +7 -0
  40. package/package.json +9 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/service/index.ts"],
4
+ "sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n/** sessionpipe-core/service \u2014 a per-user background service for a sessionpipe process:\n * a launchd agent on macOS, a systemd user unit on Linux. The control daemon runs\n * under it (`org.sessionpipe.control`), and so can a receiver of the person's own (a\n * board on their machine), with the same files and the same commands. Node only: it\n * writes files and runs launchctl, systemctl and loginctl, so it is never part of the\n * root export, which stays Worker- and browser-safe.\n *\n * Both files restart the process when it exits non-zero, and when it exits\n * UPDATE_EXIT (75, sessionpipe-core/version) to come back on new code. The process is\n * told which manager that is in SESSIONPIPE_SERVICE (`launchd`, `systemd`). Nothing\n * here needs root, and a dry run touches nothing: it answers the files it would write\n * and the commands it would run. */\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** One service, as both managers need it. */\nexport interface ServiceSpec {\n /** The launchd label, also the plist's name: `org.sessionpipe.control`. */\n label: string;\n /** The systemd user unit's file name: `sessionpipe-control.service`. */\n unit: string;\n /** The unit's Description line. */\n description: string;\n /** The program and its arguments, each one argument (never through a shell). */\n argv: string[];\n /** More environment for the process, beside SESSIONPIPE_SERVICE. */\n env?: Record<string, string>;\n /** Where launchd writes its stdout and stderr (journald keeps a unit's). */\n logPath: string;\n /** The home the files go under; the user's own by default. */\n home?: string;\n}\n\n/** A file the service writes, and what is in it. */\nexport interface ServiceFile {\n path: string;\n text: string;\n}\n\n/** Runs one command and answers its stdout; throws when it fails. */\nexport type Exec = (cmd: string, args: string[]) => string;\n\nconst execQuiet: Exec = (cmd, args) =>\n execFileSync(cmd, args, { encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"], timeout: 15_000 });\n\nconst xml = (s: string) => s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n/** One systemd argument, quoted: backslashes and quotes escaped, `%` doubled (a specifier otherwise). */\nconst sd = (s: string) => `\"${s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/%/g, \"%%\")}\"`;\n\n/** The plist and the unit for a service, and where each goes. */\nexport function serviceFiles(s: ServiceSpec): { plist: ServiceFile; unit: ServiceFile } {\n const home = s.home ?? os.homedir();\n const env = (manager: string) => ({ SESSIONPIPE_SERVICE: manager, ...s.env });\n const plistEnv = Object.entries(env(\"launchd\"))\n .map(([k, v]) => `<key>${xml(k)}</key><string>${xml(v)}</string>`)\n .join(\"\");\n const plist = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key><string>${xml(s.label)}</string>\n <key>ProgramArguments</key>\n <array>${s.argv.map((a) => `<string>${xml(a)}</string>`).join(\"\")}</array>\n <key>EnvironmentVariables</key><dict>${plistEnv}</dict>\n <key>RunAtLoad</key><true/>\n <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>\n <key>ProcessType</key><string>Background</string>\n <key>StandardOutPath</key><string>${xml(s.logPath)}</string>\n <key>StandardErrorPath</key><string>${xml(s.logPath)}</string>\n</dict>\n</plist>\n`;\n const unitEnv = Object.entries(env(\"systemd\"))\n .map(([k, v]) => `Environment=${k === \"SESSIONPIPE_SERVICE\" ? `${k}=${v}` : sd(`${k}=${v}`)}`)\n .join(\"\\n\");\n const unit = `[Unit]\nDescription=${s.description.replace(/\\n/g, \" \")}\nAfter=network-online.target\n\n[Service]\nExecStart=${s.argv.map(sd).join(\" \")}\n${unitEnv}\nRestart=on-failure\nRestartForceExitStatus=75\nRestartSec=5\n\n[Install]\nWantedBy=default.target\n`;\n return {\n plist: { path: path.join(home, \"Library\", \"LaunchAgents\", `${s.label}.plist`), text: plist },\n unit: { path: path.join(home, \".config\", \"systemd\", \"user\", s.unit), text: unit },\n };\n}\n\n/** A systemd user service stops when its person's last login ends \u2014 closing the ssh\n * session to a lab workstation or a cloud machine stopped the daemon with it \u2014 unless\n * the user lingers. `loginctl enable-linger` for yourself needs no root on systemd's\n * default policy; where it does, say the one command that does it. */\nexport function ensureLinger(user: string, exec: Exec = execQuiet): { on: boolean; note: string } {\n const lingering = () => {\n try {\n return /^Linger=yes/m.test(exec(\"loginctl\", [\"show-user\", user, \"--property=Linger\"]));\n } catch {\n return false;\n }\n };\n if (lingering()) return { on: true, note: \"it keeps running after you log out (linger was already on)\" };\n try {\n exec(\"loginctl\", [\"enable-linger\", user]);\n } catch {}\n if (lingering()) return { on: true, note: \"it keeps running after you log out (turned linger on)\" };\n return {\n on: false,\n note: `it stops when you log out: run \\`sudo loginctl enable-linger ${user}\\` once to keep it running`,\n };\n}\n\n/** What an install did, or would do in a dry run. */\nexport interface ServicePlan {\n /** The files written (or that would be). */\n files: ServiceFile[];\n /** The commands run (or that would be), one string each, in order. */\n commands: string[];\n /** Which manager runs it now: null on a platform with none, or where it isn't reachable. */\n manager: \"launchd\" | \"systemd\" | null;\n /** launchd: `gui` when someone is at the screen, else `user` (it starts again at the next login there). */\n domain?: \"gui\" | \"user\";\n /** systemd: whether it outlives the login, in words. */\n linger?: { on: boolean; note: string };\n /** The file that was written for a manager that couldn't be reached. */\n unreachable?: string;\n}\n\nexport interface InstallOptions extends ServiceSpec {\n /** Answer the plan and touch nothing. */\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n /** The user's id (launchd's domains) and name (linger); this process's by default. */\n uid?: string;\n user?: string;\n}\n\nconst line = (cmd: string, args: string[]) => [cmd, ...args].join(\" \");\n\n/** Write the service for this platform and start it now; a service already there is\n * replaced (launchd: booted out first). */\nexport function installService(o: InstallOptions): ServicePlan {\n const f = serviceFiles(o);\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const real = o.exec ?? execQuiet;\n const run: Exec = (cmd, args) => {\n commands.push(line(cmd, args));\n return o.dryRun ? \"\" : real(cmd, args);\n };\n const write = (file: ServiceFile) => {\n if (o.dryRun) return;\n mkdirSync(path.dirname(file.path), { recursive: true });\n writeFileSync(file.path, file.text);\n };\n if (platform === \"darwin\") {\n write(f.plist);\n for (const d of [\"gui\", \"user\"])\n try {\n run(\"launchctl\", [\"bootout\", `${d}/${uid}/${o.label}`]);\n } catch {}\n try {\n run(\"launchctl\", [\"bootstrap\", `gui/${uid}`, f.plist.path]);\n return { files: [f.plist], commands, manager: \"launchd\", domain: \"gui\" };\n } catch {}\n // No one logged in at the screen (an ssh session to a Mac mini): the gui domain\n // doesn't exist. The user domain runs it now; after a restart it starts again at\n // the next login at the screen.\n run(\"launchctl\", [\"bootstrap\", `user/${uid}`, f.plist.path]);\n return { files: [f.plist], commands, manager: \"launchd\", domain: \"user\" };\n }\n if (platform === \"linux\") {\n write(f.unit);\n try {\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n run(\"systemctl\", [\"--user\", \"enable\", \"--now\", o.unit]);\n } catch {\n return { files: [f.unit], commands, manager: null, unreachable: f.unit.path };\n }\n const user = o.user ?? os.userInfo().username;\n if (o.dryRun) {\n commands.push(line(\"loginctl\", [\"enable-linger\", user]));\n return { files: [f.unit], commands, manager: \"systemd\", linger: { on: false, note: \"dry run\" } };\n }\n return { files: [f.unit], commands, manager: \"systemd\", linger: ensureLinger(user, run) };\n }\n return { files: [], commands, manager: null };\n}\n\nexport interface UninstallOptions {\n label: string;\n unit: string;\n home?: string;\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n uid?: string;\n}\n\n/** Stop the service and remove its file, where this platform has one; nothing where\n * there is none. A manager that says it wasn't loaded is no failure. */\nexport function uninstallService(o: UninstallOptions): { files: string[]; commands: string[] } {\n const f = serviceFiles({ ...o, description: \"\", argv: [], logPath: \"\" });\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const files: string[] = [];\n const real = o.exec ?? execQuiet;\n const run = (cmd: string, args: string[]) => {\n commands.push(line(cmd, args));\n if (o.dryRun) return;\n try {\n real(cmd, args);\n } catch {}\n };\n const remove = (file: string) => {\n files.push(file);\n if (!o.dryRun) unlinkSync(file);\n };\n if (platform === \"darwin\" && existsSync(f.plist.path)) {\n run(\"launchctl\", [\"bootout\", `gui/${uid}/${o.label}`]);\n run(\"launchctl\", [\"bootout\", `user/${uid}/${o.label}`]);\n remove(f.plist.path);\n }\n if (platform === \"linux\" && existsSync(f.unit.path)) {\n run(\"systemctl\", [\"--user\", \"disable\", \"--now\", o.unit]);\n remove(f.unit.path);\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n }\n return { files, commands };\n}\n"],
5
+ "mappings": ";;;AAaA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,YAAY,qBAAqB;AACjE,OAAO,QAAQ;AACf,OAAO,UAAU;AA6BjB,IAAM,YAAkB,CAAC,KAAK,SAC5B,aAAa,KAAK,MAAM,EAAE,UAAU,QAAQ,OAAO,CAAC,UAAU,QAAQ,QAAQ,GAAG,SAAS,KAAO,CAAC;AAEpG,IAAM,MAAM,CAAC,MAAc,EAAE,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAE9F,IAAM,KAAK,CAAC,MAAc,IAAI,EAAE,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,CAAC;AAGxF,SAAS,aAAa,GAA2D;AACtF,QAAM,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAClC,QAAM,MAAM,CAAC,aAAqB,EAAE,qBAAqB,SAAS,GAAG,EAAE,IAAI;AAC3E,QAAM,WAAW,OAAO,QAAQ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,QAAM,WAAqB,CAAC;AAC5B,QAAM,QAAkB,CAAC;AACzB,QAAM,OAAO,EAAE,QAAQ;AACvB,QAAM,MAAM,CAAC,KAAa,SAAmB;AAC3C,aAAS,KAAK,KAAK,KAAK,IAAI,CAAC;AAC7B,QAAI,EAAE,OAAQ;AACd,QAAI;AACF,WAAK,KAAK,IAAI;AAAA,IAChB,QAAQ;AAAA,IAAC;AAAA,EACX;AACA,QAAM,SAAS,CAAC,SAAiB;AAC/B,UAAM,KAAK,IAAI;AACf,QAAI,CAAC,EAAE,OAAQ,YAAW,IAAI;AAAA,EAChC;AACA,MAAI,aAAa,YAAY,WAAW,EAAE,MAAM,IAAI,GAAG;AACrD,QAAI,aAAa,CAAC,WAAW,OAAO,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AACrD,QAAI,aAAa,CAAC,WAAW,QAAQ,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AACtD,WAAO,EAAE,MAAM,IAAI;AAAA,EACrB;AACA,MAAI,aAAa,WAAW,WAAW,EAAE,KAAK,IAAI,GAAG;AACnD,QAAI,aAAa,CAAC,UAAU,WAAW,SAAS,EAAE,IAAI,CAAC;AACvD,WAAO,EAAE,KAAK,IAAI;AAClB,QAAI,aAAa,CAAC,UAAU,eAAe,CAAC;AAAA,EAC9C;AACA,SAAO,EAAE,OAAO,SAAS;AAC3B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,87 @@
1
+ import { type Mode } from "./headless.js";
2
+ export interface AcpAgent {
3
+ /** sessionpipe's harness name (ADAPTERS.md): the registry's id unless a hook adapter already named it. */
4
+ harness: string;
5
+ /** The registry's id. */
6
+ registry: string;
7
+ label: string;
8
+ /** The CLI's name on PATH. */
9
+ bin: string;
10
+ args: string[];
11
+ }
12
+ /** The agents the daemon can drive, with the launch line the registry publishes. */
13
+ export declare const ACP_AGENTS: readonly AcpAgent[];
14
+ export declare const ACP_HARNESSES: readonly string[];
15
+ export declare const acpAgent: (harness: string) => AcpAgent | undefined;
16
+ /** The env var that names an agent's CLI by hand: `SESSIONPIPE_ACP_GEMINI_CLI`. */
17
+ export declare const acpOverride: (harness: string) => string;
18
+ /** An agent's CLI on this machine: the override, else on PATH, else beside the node
19
+ * running this (an `npm install -g` there) or where the installers put it. */
20
+ export declare function findAcpAgent(harness: string, env?: NodeJS.ProcessEnv, home?: string, nodeDir?: string): {
21
+ bin: string;
22
+ args: string[];
23
+ } | null;
24
+ /** The ACP agents installed here, by harness name, for the daemon's hello. */
25
+ export declare function acpHarnesses(env?: NodeJS.ProcessEnv): string[];
26
+ type Json = Record<string, unknown>;
27
+ interface Option {
28
+ optionId: string;
29
+ kind: string;
30
+ }
31
+ /** Which permission option the machine's mode picks, or null for `cancelled`: safe
32
+ * refuses (once, else always), auto allows (once, else always). Inherit refuses as safe
33
+ * does: the agent asked because its own settings want a person, and none is there.
34
+ * Never the other way. */
35
+ export declare function permissionChoice(options: unknown, mode: Mode): Option | null;
36
+ /** A JSON-RPC error in words: its message, and its `data` where that says more (goose
37
+ * 1.55 answers session/new with "Internal error" and the reason in `data`). */
38
+ export declare function errorWords(err: Json): string;
39
+ /** A session the daemon holds (the shape of daemon.ts's SdkSession, plus the agent's own id). */
40
+ export interface AcpHeld {
41
+ /** Deliver one message; resolves with the agent's reply when the turn ends. */
42
+ send(text: string): Promise<{
43
+ reply: string;
44
+ error?: string;
45
+ }>;
46
+ interrupt(): Promise<void>;
47
+ close(): void;
48
+ readonly busy: boolean;
49
+ readonly lastUsed: number;
50
+ readonly mode: "api";
51
+ /** The id the agent gave the session. */
52
+ readonly session: string;
53
+ /** The process is gone or was closed: nothing more can be sent. */
54
+ readonly closed: boolean;
55
+ }
56
+ export interface AcpOptions {
57
+ bin: string;
58
+ args: string[];
59
+ cwd: string;
60
+ mode: Mode;
61
+ label: string;
62
+ env?: NodeJS.ProcessEnv;
63
+ /** Reopen this session of the agent's (`session/load`) instead of starting a new one. */
64
+ load?: string;
65
+ /** The reply so far, each time it grows. */
66
+ onText?: (text: string) => void;
67
+ log?: (line: string) => void;
68
+ now?: () => number;
69
+ /** A turn still running after this is cancelled, then stopped. */
70
+ timeoutMs?: number;
71
+ /** How long the agent may take to answer `initialize` and open the session. */
72
+ openTimeoutMs?: number;
73
+ /** On close, how long the agent gets to leave by itself before SIGTERM (then SIGKILL). */
74
+ closeGraceMs?: number;
75
+ }
76
+ export type AcpStart = {
77
+ held: AcpHeld;
78
+ } | {
79
+ failed: string;
80
+ } | {
81
+ unsupported: string;
82
+ };
83
+ /** Run an ACP agent and open a session in it. Resolves once the agent has answered
84
+ * `session/new` (or `session/load`); every later turn goes through `held.send`. */
85
+ export declare function startAcp(o: AcpOptions): Promise<AcpStart>;
86
+ export {};
87
+ //# sourceMappingURL=acp-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/acp-control.ts"],"names":[],"mappings":"AAeA,OAAO,EAAkD,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1F,MAAM,WAAW,QAAQ;IACvB,0GAA0G;IAC1G,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EA0CzC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAqC,CAAC;AAEjF,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,QAAQ,GAAG,SAA0D,CAAC;AAEjH,mFAAmF;AACnF,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,MAAuE,CAAC;AAEtH;+EAC+E;AAC/E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI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I,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAIxF;oFACoF;AACpF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+QzD"}
@@ -1,14 +1,24 @@
1
+ import type { RunLevel, StartPermission } from "../control/verify.js";
1
2
  import { type Mode, type Reading, type RunResult } from "./headless.js";
2
3
  /** The `agy` to run: SESSIONPIPE_AGY, else on PATH, else where its installer puts it. */
3
4
  export declare function findAgy(env?: NodeJS.ProcessEnv, home?: string): string | null;
4
- /** Permission flags for the machine's mode. Safe: none — agy denies every tool call
5
- * nobody is there to approve, and says which. Auto: `--mode accept-edits`. Never
6
- * `--dangerously-skip-permissions`: no path here writes it. */
7
- export declare function agyModeFlags(mode: Mode): string[];
5
+ /** Permission flags for a level. Safe: none — agy denies every tool call nobody is
6
+ * there to approve, and says which. Edits: `--mode accept-edits`, its widest, which is
7
+ * also what an auto machine's mode means for it. Inherit: none either, so agy runs as
8
+ * it would by itself. agy has no read-only mode known, so `read` is never offered and
9
+ * throws rather than run at safe. Never `--dangerously-skip-permissions`: no path here
10
+ * writes it. */
11
+ export declare function agyModeFlags(level: RunLevel): string[];
12
+ /** The levels a start may ask agy for on a machine in `mode`: safe, and edits on an
13
+ * auto machine. */
14
+ export declare const offeredLevels: (mode: Mode) => StartPermission[];
15
+ /** What a start that names no level gets, said as what it is: edits on an auto machine,
16
+ * no flag on an inherit one. */
17
+ export declare const defaultLevel: (mode: Mode) => RunLevel;
8
18
  /** One headless turn in the folder it is spawned in. A message that starts with a dash
9
19
  * would read as a flag after `-p`; a leading space keeps it the prompt. */
10
20
  export declare function agyArgs(o: {
11
- mode: Mode;
21
+ permission: RunLevel;
12
22
  prompt: string;
13
23
  resume?: string;
14
24
  }): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/antigravity-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkC,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,eAAe,CAAC;AAIpH,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,SAAe,GAAG,MAAM,GAAG,IAAI,CAOhG;AAED;;gEAEgE;AAChE,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAEjD;AAED;4EAC4E;AAC5E,wBAAgB,OAAO,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAUpF;AAED,yCAAyC;AACzC,eAAO,MAAM,MAAM,SAAS,MAAM,CAAC,UAAU,KAAiB,MAAM,CAAC,UAAyB,CAAC;AAE/F,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC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gCrD;AAYD,6DAA6D;AAC7D,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU3D;AAED;yCACyC;AACzC,qBAAa,UAAW,YAAW,OAAO;IACxC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC9B,KAAK,SAAK;IACV,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,IAAI,CAAuB;IAEnC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAa1B;IAED,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAiB9D;CACF;AAED,eAAO,MAAM,OAAO,QAAO,UAA8B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type RunLevel, type StartPermission } from "../control/verify.js";
1
2
  import { JOB_TIMEOUT_MS, type Login, type Mode, type RunOptions, type RunResult } from "./headless.js";
2
3
  export { JOB_TIMEOUT_MS, type Login, type Mode, type RunResult };
3
4
  /** Dotted versions by number, a missing part as 0: 1.9.0 < 1.10 = 1.10.0. */
@@ -15,10 +16,44 @@ export interface Caps {
15
16
  stream?: boolean;
16
17
  }
17
18
  export declare function parseCaps(help: string): Caps;
18
- /** Permission flags for the machine's mode. Safe: `dontAsk` (nothing that needs
19
- * approval runs). Auto: Claude Code's own auto mode, or a refusal. Never
20
- * bypassPermissions — no path here writes it. */
21
- export declare function modeFlags(mode: Mode, caps: Caps): {
19
+ /** Permission flags for a level (a machine's mode is one: safe, auto, inherit). Read:
20
+ * plan mode. Safe: `dontAsk` (nothing that needs approval runs). Edits: acceptEdits.
21
+ * Auto: Claude Code's own auto mode. Inherit: none, so the turn starts in the mode
22
+ * Claude Code picks by itself here, its settings' `permissions.defaultMode` (a resume
23
+ * too: Claude Code never restores a session's earlier mode). A level this Claude Code
24
+ * has no mode for is a refusal, never another level. Never bypassPermissions — no path
25
+ * here writes it. */
26
+ export declare function modeFlags(level: RunLevel, caps: Caps): {
27
+ args: string[];
28
+ } | {
29
+ error: string;
30
+ };
31
+ /** The widest level a start may name on a machine in `mode`: the mode itself, and safe
32
+ * on an inherit machine, whose own default sessionpipe can't rank, so a message there may
33
+ * only narrow to a level that never runs anything needing approval. */
34
+ export declare const ceilingLevel: (mode: Mode) => StartPermission;
35
+ /** The levels a start may ask Claude Code for on a machine in `mode`: never above its
36
+ * ceiling, and each only where `claude --help` lists the mode it maps to (safe always). */
37
+ export declare function offeredLevels(mode: Mode, caps: Caps): StartPermission[];
38
+ /** What a start that names no level gets: what the machine's mode means for Claude Code. */
39
+ export declare const defaultLevel: (mode: Mode) => RunLevel;
40
+ /** How a headless run prints: streamed where this Claude Code can, else one JSON at the end. */
41
+ export declare function outputArgs(caps: {
42
+ stream?: boolean;
43
+ }): string[];
44
+ /** One headless `claude -p` run: a new session (`session`), or the next message of one
45
+ * (`resume`, optionally as a fork). The model is its own argument after `--model`, and
46
+ * a prompt that starts with a dash gets a leading space, so it is never read as a flag. */
47
+ export declare function claudeArgs(o: {
48
+ caps: Caps;
49
+ level: RunLevel;
50
+ prompt: string;
51
+ session?: string;
52
+ resume?: string;
53
+ fork?: boolean;
54
+ model?: string;
55
+ allowedTools?: string[];
56
+ }): {
22
57
  args: string[];
23
58
  } | {
24
59
  error: string;
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code-control.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,cAAc,EACd,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,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AAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,UAAU,GAChB,YAAY,CA6Fd;AAED,6GAA6G;AAC7G,eAAO,MAAM,kBAAkB,QAAO,IAGrC,CAAC"}
@@ -1,21 +1,37 @@
1
+ import { type RunLevel, type StartPermission } from "../control/verify.js";
1
2
  import { type Login, type Mode, type Reading, type RunResult } from "./headless.js";
2
3
  export { codexFacts, findRollout } from "./codex.js";
3
4
  /** The `codex` to run: SESSIONPIPE_CODEX, else on PATH, else beside the node running
4
5
  * this (an `npm install -g` there) or where the installers put it. */
5
6
  export declare function findCodex(env?: NodeJS.ProcessEnv, home?: string, nodeDir?: string): string | null;
6
- /** Sandbox flags for the machine's mode. Safe: workspace-write, and nothing escalates
7
- * unattended (exec never asks). Auto: approval requests go through Codex's own
8
- * automatic review. Never `--dangerously-bypass-approvals-and-sandbox` or
9
- * `--dangerously-bypass-hook-trust`: no path here writes them. */
10
- export declare function codexModeFlags(mode: Mode, resume?: boolean): string[];
7
+ /** Sandbox flags for a level (a machine's mode is one: safe, auto, inherit). Read: the
8
+ * read-only sandbox. Safe: workspace-write, and nothing escalates unattended (exec never
9
+ * asks); that sandbox already edits inside the folder, so `edits` is never offered and
10
+ * means the same. Auto: approval requests go through Codex's own automatic review.
11
+ * Inherit: none, so `sandbox_mode` and `approval_policy` come from the person's own
12
+ * config.toml, a new session's and a resume's alike. Never
13
+ * `--dangerously-bypass-approvals-and-sandbox`, `--dangerously-bypass-hook-trust` or
14
+ * `danger-full-access`: no path here writes them. */
15
+ export declare function codexModeFlags(level: RunLevel, resume?: boolean): string[];
16
+ /** The levels a start may ask Codex for on a machine in `mode`: read and safe, and auto
17
+ * on an auto machine. */
18
+ export declare const offeredLevels: (mode: Mode) => StartPermission[];
19
+ /** What a start that names no level gets: what the machine's mode means for Codex. */
20
+ export declare const defaultLevel: (mode: Mode) => RunLevel;
11
21
  /** One headless turn. A new session runs in `cwd` (`-C`); a resume names the thread.
12
- * The prompt goes after `--`, so a message that starts with a dash is never a flag. */
22
+ * The model is its own argument after `-m`. The prompt goes after `--`, so a message
23
+ * that starts with a dash is never a flag. */
13
24
  export declare function codexArgs(o: {
14
- mode: Mode;
25
+ permission: RunLevel;
15
26
  prompt: string;
16
27
  cwd?: string;
17
28
  resume?: string;
29
+ model?: string;
18
30
  }): string[];
31
+ /** The models a hello offers for Codex (CONTROL.md §2 `start`): the slugs Codex's own
32
+ * picker lists, from `$CODEX_HOME/models_cache.json` (visibility `list`; hidden ones,
33
+ * such as its review model, left out), at most 50. Empty when there is no cache. */
34
+ export declare function codexModels(env?: NodeJS.ProcessEnv, home?: string): string[];
19
35
  /** The env a headless turn runs with. */
20
36
  export declare const codexEnv: (env?: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
21
37
  export declare const LOGIN_HINT = "Codex isn't signed in on this machine: run `codex login --device-auth` there.";
@@ -1 +1 @@
1
- {"version":3,"file":"codex-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,SAAS,EAGf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIrD;uEACuE;AACvE,wBAAgB,SAAS,CACvB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,SAAe,EACnB,OAAO,SAAiC,GACvC,MAAM,GAAG,IAAI,CAOf;AAED;;;mEAGmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,UAAQ,GAAG,MAAM,EAAE,CAenE;AAED;wFACwF;AACxF,wBAAgB,SAAS,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG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d.ts","sourceRoot":"","sources":["../../../src/adapters/codex.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,CACJ,CAAC;AAmFX;;gEAEgE;AAChE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAwBjG;AAeD,eAAO,MAAM,KAAK,EAAE,OAsMnB,CAAC;AAOF,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2DrD"}
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,CACJ,CAAC;AAmFX;;gEAEgE;AAChE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAwBjG;AAeD,eAAO,MAAM,KAAK,EAAE,OAwMnB,CAAC;AAOF,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2DrD"}
@@ -1,6 +1,9 @@
1
1
  /** A headless turn still running after this is stopped. */
2
2
  export declare const JOB_TIMEOUT_MS: number;
3
- export type Mode = "safe" | "auto";
3
+ /** How a turn the daemon runs may act (spec/CONTROL.md §2), chosen at the machine's own
4
+ * terminal: safe, the harness's auto mode, or inherit (no permission flag, so the
5
+ * harness starts in its own default on this machine). */
6
+ export type Mode = "safe" | "auto" | "inherit";
4
7
  export declare function isExe(p: string): boolean;
5
8
  /** A harness's CLI: the override the person set (`SESSIONPIPE_<NAME>`), else the first
6
9
  * of `names` on PATH, else the first of `dirs` that holds one. A launchd or systemd
@@ -1 +1 @@
1
- {"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../../src/adapters/headless.ts"],"names":[],"mappings":"AASA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,QAAc,CAAC;AAG1C,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnC,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAQxC;AAED;;0FAE0F;AAC1F,wBAAgB,UAAU,CAAC,CAAC,EAAE;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,MAAM,GAAG,IAAI,CAQhB;AAED;;0CAE0C;AAC1C,wBAAgB,MAAM,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,UAAU,CAE9E;AAED;oEACoE;AACpE,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI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"}
@@ -6,6 +6,7 @@ import { geminiCli } from "./gemini-cli.js";
6
6
  import type { Adapter } from "./types.js";
7
7
  export declare const ADAPTERS: readonly Adapter[];
8
8
  export declare const adapterByName: (name: string) => Adapter | undefined;
9
+ export * as acpControl from "./acp-control.js";
9
10
  export { AG_STALE_PRETOOL, antigravityAnswer } from "./antigravity.js";
10
11
  export * as antigravityControl from "./antigravity-control.js";
11
12
  export { claudeAccounts, claudeDirs, notClaudeCode } from "./claude-code.js";
@@ -13,8 +14,13 @@ export * as claudeControl from "./claude-code-control.js";
13
14
  export * as codexControl from "./codex-control.js";
14
15
  export { DEVIN_EVENTS, devinConfigDir, devinDataDir, readDevinChain } from "./devin.js";
15
16
  export { deniedNote, JOB_TIMEOUT_MS, jobEnv, type Login, type Reading, type RunOptions, type RunResult, runHeadless, } from "./headless.js";
17
+ /** How many harnesses a pairing request or a hello lists at most (control-pair.json,
18
+ * control-hello.json). */
19
+ export declare const HELLO_HARNESSES_MAX = 20;
16
20
  /** The harnesses a control daemon here can drive headlessly (CONTROL.md §6): each whose
17
- * CLI is installed on this machine. What `control pair` and every hello advertise. */
21
+ * CLI is installed on this machine, and every ACP agent that is. What `control pair`
22
+ * and every hello advertise: the three with their own drivers first, then the ACP
23
+ * agents in the registry's order, at most HELLO_HARNESSES_MAX of them. */
18
24
  export declare function drivableHarnesses(env?: NodeJS.ProcessEnv): string[];
19
25
  export type { Adapter, AdapterEvent, BackfillRow, FactsState, HookCommand, HookInput, HookResult, InstallReport, SessionFacts, TranscriptRead, Turn, } from "./types.js";
20
26
  export { antigravity, claudeCode, codex, devin, geminiCli };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CA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a,EACb,YAAY,EACZ,cAAc,EACd,IAAI,GACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
@@ -18,7 +18,7 @@ export declare const TEXT_MAX = 20000;
18
18
  export declare const NOTE_MAX = 2000;
19
19
  /** A grant string. */
20
20
  export declare const GRANT_STR_MAX = 2000;
21
- /** Attachments on a `start` (CONTROL.md §3.1): at most this many files, */
21
+ /** Attachments on a `start` or a `prompt` (CONTROL.md §3.1): at most this many files, */
22
22
  export declare const FILES_MAX = 10;
23
23
  /** each at most this many bytes, */
24
24
  export declare const FILE_SIZE_MAX = 26214400;
@@ -28,6 +28,23 @@ export declare const FILES_TOTAL_MAX = 52428800;
28
28
  export declare const FILE_NAME_MAX = 200;
29
29
  /** and a media type of at most this many. */
30
30
  export declare const FILE_TYPE_MAX = 100;
31
+ /** A start's `model` (CONTROL.md §3.1): at most this many characters, */
32
+ export declare const MODEL_MAX = 100;
33
+ /** in this alphabet, never starting with a dash, so it can never read as a flag. */
34
+ export declare const MODEL_RE: RegExp;
35
+ /** The levels a start may ask for (CONTROL.md §3.1), narrowest first. Closed: no level
36
+ * is wider than `auto`, and none turns a harness's approval off. */
37
+ export declare const START_PERMISSIONS: readonly ["read", "safe", "edits", "auto"];
38
+ export type StartPermission = (typeof START_PERMISSIONS)[number];
39
+ /** What a run is started with: a level, or `inherit` (CONTROL.md §2) — no permission
40
+ * flag at all, so the harness starts in its own default on the machine. Only a machine
41
+ * the person put in inherit mode runs that way; a command never names it. */
42
+ export type RunLevel = StartPermission | "inherit";
43
+ /** Where a level sits, narrowest (0) to widest; -1 for anything that isn't one. */
44
+ export declare const levelRank: (l: unknown) => number;
45
+ /** The narrower of two levels: what a later run of a session gets, its recorded level
46
+ * against what the machine's mode allows now. */
47
+ export declare const narrower: (a: StartPermission, b: StartPermission) => StartPermission;
31
48
  export declare const COMMAND_TYPE = "sessionpipe.control";
32
49
  export declare const GRANT_TYPE = "sessionpipe.grant";
33
50
  export declare const CONTROL_KINDS: readonly ["prompt", "permission.answer", "cancel", "start", "key.add"];
@@ -37,11 +54,21 @@ export type ControlKind = (typeof CONTROL_KINDS)[number];
37
54
  /** COSE algorithm ids a trusted key may use. */
38
55
  export declare const ES256 = -7;
39
56
  export declare const RS256 = -257;
40
- /** A key enrolled on the machine: a passkey's credential id, COSE alg and SPKI (base64url). */
57
+ /** The kinds of key a machine may trust (CONTROL.md §2): a WebAuthn passkey, or a
58
+ * device key an app holds in hardware where it has no passkey to offer. */
59
+ export declare const KEY_TYPES: readonly ["passkey", "device"];
60
+ export type KeyType = (typeof KEY_TYPES)[number];
61
+ /** A key enrolled on the machine: a passkey's credential id, COSE alg and SPKI
62
+ * (base64url); a device key also says so (`type`), and what its app declared about
63
+ * it (`store`, `uv`). The machine verifies by its own record, never by a message. */
41
64
  export interface TrustedKey {
42
65
  id: string;
43
66
  alg: number;
44
67
  spki: string;
68
+ /** Present only on a device key (CONTROL.md §2 "Device keys"). */
69
+ type?: "device";
70
+ store?: "hardware";
71
+ uv?: "each-use";
45
72
  }
46
73
  /** A WebAuthn assertion: credential id, authenticatorData, clientDataJSON, signature (base64url). */
47
74
  export interface Assertion {
@@ -50,16 +77,25 @@ export interface Assertion {
50
77
  cd: string;
51
78
  sig: string;
52
79
  }
80
+ /** A device key's signature (CONTROL.md §3.2): its id and 64 bytes r‖s over deviceMessage(). */
81
+ export interface DeviceSignature {
82
+ cred: string;
83
+ sig: string;
84
+ }
53
85
  /** The day's grant: a passkey's assertion over sha256(str), where str names the day key. */
54
86
  export interface GrantBundle extends Assertion {
55
87
  str: string;
56
88
  }
89
+ /** The day's grant from a device key: its signature over deviceMessage("grant", rp, sha256(str)). */
90
+ export interface DeviceGrant extends DeviceSignature {
91
+ str: string;
92
+ }
57
93
  /** What a receiver carries for one command (control.json minus the receiver's envelope). */
58
94
  export interface SignedCommand {
59
95
  cmd: string;
60
96
  csig?: string | null;
61
- grant?: GrantBundle | null;
62
- confirm?: Assertion | null;
97
+ grant?: GrantBundle | DeviceGrant | null;
98
+ confirm?: Assertion | DeviceSignature | null;
63
99
  }
64
100
  export interface Grant {
65
101
  v: 1;
@@ -92,16 +128,17 @@ export interface ControlCommand {
92
128
  decision?: "allow" | "deny";
93
129
  note?: string;
94
130
  cwd?: string;
95
- /** key.add only: the passkey to trust from now on, as the receiver holds it. */
96
- key?: {
97
- id: string;
98
- alg: -7 | -257;
99
- spki: string;
100
- };
131
+ /** key.add only: the key to trust from now on, as the receiver holds it (a passkey,
132
+ * or a device key with its `type`, `store` and `uv`). */
133
+ key?: TrustedKey;
101
134
  /** key.add only: what the person calls the device ("iPhone"), for `control keys`. */
102
135
  name?: string;
103
- /** start only: files to download, verify and write into the new session's folder. */
136
+ /** start, prompt: files to download, verify and write into the session's folder. */
104
137
  files?: ControlFile[];
138
+ /** start only: the level the new session runs at (never above the machine's mode). */
139
+ permission?: StartPermission;
140
+ /** start only: the model the harness runs, as the harness names it. */
141
+ model?: string;
105
142
  nonce: string;
106
143
  iat: number;
107
144
  }
@@ -144,7 +181,14 @@ export declare function sameBytes(a: Uint8Array, b: Uint8Array): boolean;
144
181
  * Strict: every length must match the bytes, so one signature has one encoding (a
145
182
  * P-256 signature is at most 72 bytes, so the short length form is the only one). */
146
183
  export declare function derToRaw(der: Uint8Array): Uint8Array | null;
147
- /** Can this key be enrolled at all? A machine refuses to trust a key it could never verify with. */
184
+ /** The only fields a device signature has (`str` only in a grant). */
185
+ export declare const DEVICE_SIG_FIELDS: readonly ["cred", "sig", "str"];
186
+ /** A device key's id: the SHA-256 of its SPKI bytes, base64url without padding. */
187
+ export declare function deviceKeyId(spki: string): Promise<string>;
188
+ /** Can this key be enrolled at all? A machine refuses to trust a key it could never
189
+ * verify with. The key's fields are closed: a passkey is `id`, `alg`, `spki` and
190
+ * nothing else; a device key adds exactly `type`, `store` and `uv` (CONTROL.md §2),
191
+ * so a kind added later is refused by every machine that predates it. */
148
192
  export declare function keyUsable(key: TrustedKey): Promise<boolean>;
149
193
  /** A WebAuthn origin a key may have been used from: https on the rp id or a subdomain;
150
194
  * for rp id `localhost`, plain http on any port too. A bare origin, as a browser writes it. */
@@ -155,8 +199,18 @@ type Check = {
155
199
  ok: false;
156
200
  why: string;
157
201
  };
158
- /** One passkey assertion over `challenge`, made with `key`, by a verified person. */
159
- export declare function verifyAssertion(challenge: Uint8Array, a: Assertion | null | undefined, key: TrustedKey, rpId: string): Promise<Check>;
202
+ /** The first line of every message a device key signs. */
203
+ export declare const DEVICE_CONTEXT = "sessionpipe.device.v1";
204
+ /** What a device signature is for: one use can never answer for another. */
205
+ export type DevicePurpose = "grant" | "confirm" | "pair";
206
+ /** The exact bytes a device key signs: the context, the purpose, the rp id as the
207
+ * machine recorded it, and the base64url (no padding) of the 32-byte challenge a
208
+ * passkey would sign for that purpose, joined by single line feeds, none at the end. */
209
+ export declare function deviceMessage(purpose: DevicePurpose, rpId: string, challenge: Uint8Array): Uint8Array;
210
+ /** One signature over `challenge` by `key`, chosen from the machine's own record of
211
+ * the key, never from the signature: a device key's signature for `purpose`
212
+ * (CONTROL.md §3.2), or a passkey assertion made by a verified person. */
213
+ export declare function verifyAssertion(challenge: Uint8Array, a: Assertion | DeviceSignature | null | undefined, key: TrustedKey, rpId: string, purpose: DevicePurpose): Promise<Check>;
160
214
  /** What a passkey signs to enroll on a machine: bound to that machine and that pairing code. */
161
215
  export declare function pairChallenge(machine: string, code: string): Promise<Uint8Array>;
162
216
  /** The enrollment proof: the new key's assertion over pairChallenge(machine, code).
@@ -165,7 +219,7 @@ export declare function verifyEnrollment(o: {
165
219
  machine: string;
166
220
  code: string;
167
221
  key: TrustedKey;
168
- proof: Assertion;
222
+ proof: Assertion | DeviceSignature;
169
223
  rpId: string;
170
224
  }): Promise<Check>;
171
225
  type Parsed = {
@@ -185,8 +239,10 @@ export declare function parseSessionRef(ref: unknown): {
185
239
  } | null;
186
240
  /** Read the command's fields from the exact string. Structure only; no clock, no keys. */
187
241
  export declare function parseCommand(str: unknown): Parsed;
188
- /** Why a start's `files` breaks the rules (CONTROL.md §3.1), or null when it doesn't. */
242
+ /** Why a start's or a prompt's `files` breaks the rules (CONTROL.md §3.1), or null when it doesn't. */
189
243
  export declare function filesProblem(files: unknown): string | null;
244
+ /** A `start`'s `cwd` under the machine's home: `~` alone, or `~/…` (`~\…`). Never `~user`. */
245
+ export declare const HOME_RELATIVE_RE: RegExp;
190
246
  /** The grant's fields, read from its exact string. */
191
247
  export declare function parseGrant(str: unknown, rpId: string): {
192
248
  ok: true;
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/control/verify.ts"],"names":[],"mappings":"AAYA,mEAAmE;AACnE,eAAO,MAAM,YAAY,QAAgB,CAAC;AAC1C,4EAA4E;AAC5E,eAAO,MAAM,OAAO,QAAa,CAAC;AAClC;qEACqE;AACrE,eAAO,MAAM,kBAAkB,QAAgB,CAAC;AAChD;mCACmC;AACnC,eAAO,MAAM,mBAAmB,QAAc,CAAC;AAC/C,sFAAsF;AACtF,eAAO,MAAM,YAAY,QAAgB,CAAC;AAC1C,6EAA6E;AAC7E,eAAO,MAAM,OAAO,QAAS,CAAC;AAC9B,sCAAsC;AACtC,eAAO,MAAM,QAAQ,QAAS,CAAC;AAC/B,kCAAkC;AAClC,eAAO,MAAM,QAAQ,OAAQ,CAAC;AAC9B,sBAAsB;AACtB,eAAO,MAAM,aAAa,OAAQ,CAAC;AACnC,2EAA2E;AAC3E,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,oCAAoC;AACpC,eAAO,MAAM,aAAa,WAAa,CAAC;AACxC,kCAAkC;AAClC,eAAO,MAAM,eAAe,WAAa,CAAC;AAC1C,8DAA8D;AAC9D,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,6CAA6C;AAC7C,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAClD,eAAO,MA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AM,GAAG,OAAO,CAIhE;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOpF;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAmGjD;AAED,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAsB1D;AAYD,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB,QAAkB,CAAC;AAMhD,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAiB9G;AAgBD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAgD3G"}
@@ -3,8 +3,9 @@ export declare const PROTOCOL_VERSION: 1;
3
3
  export * from "./adapters/index.js";
4
4
  export { type Config, DEFAULT_CONFIG, machineName, readConfig, type SinkConfig, writeConfig } from "./config.js";
5
5
  export { type EventContext, makeEvent } from "./events.js";
6
+ export { LAUNCHED_BY_ENV, launchedBy, readHook } from "./launched-by.js";
6
7
  export { Cursors, Outbox, type OutboxRef, processAlive, takeLock, takeNamedLock } from "./outbox.js";
7
- export { configFile, homeDir, safeId, stateDir, tilde } from "./paths.js";
8
+ export { configFile, homeDir, safeId, stateDir, tilde, untilde } from "./paths.js";
8
9
  export * from "./privacy/index.js";
9
10
  export { gitFacts, stripCredentials } from "./readers/git.js";
10
11
  export { isInjected, pairTurns, readAntigravity, readClaude, readCodex, readGemini } from "./readers/transcripts.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1E,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,WA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