sealkeep 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/ARCHITECTURE.md +163 -14
  2. package/CHANGELOG.md +223 -1
  3. package/CONTROL_PLANE.md +2 -2
  4. package/LICENSE +1 -1
  5. package/README.md +108 -22
  6. package/THIRD_PARTY.md +2 -2
  7. package/THREAT_MODEL.md +23 -4
  8. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/chunk-access.d.ts +26 -4
  9. package/dist/packages/sealkeep-crypto/src/chunk-access.js +219 -0
  10. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/envelope.d.ts +11 -1
  11. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/envelope.js +58 -21
  12. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/format.d.ts +2 -2
  13. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/index.d.ts +1 -0
  14. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/index.js +1 -0
  15. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/recipients.js +4 -4
  16. package/dist/packages/sealkeep-crypto/src/squeeze.d.ts +6 -0
  17. package/dist/packages/sealkeep-crypto/src/squeeze.js +39 -0
  18. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/stream.d.ts +36 -3
  19. package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/stream.js +196 -37
  20. package/dist/site/index.html +1808 -1904
  21. package/dist/site/llms.txt +67 -0
  22. package/dist/site/trust/architecture-data-flow.html +53 -0
  23. package/dist/site/trust/audit-roadmap.html +37 -0
  24. package/dist/site/trust/deployment-responsibility.html +11 -0
  25. package/dist/site/trust/dpa-sample.html +30 -0
  26. package/dist/site/trust/release-provenance.html +21 -0
  27. package/dist/site/trust/subprocessors.html +15 -0
  28. package/dist/site/trust/threat-model.html +34 -0
  29. package/dist/site/trust/toms.html +41 -0
  30. package/dist/site/trust-document.css +32 -0
  31. package/dist/site/trust.html +73 -0
  32. package/dist/site/visual/assets/index-8Nxnkc7o.js +207 -0
  33. package/dist/site/visual/assets/index-oxLy1bpy.css +1 -0
  34. package/dist/site/visual/index.html +18 -0
  35. package/dist/site.zip +0 -0
  36. package/dist/src/activity.d.ts +9 -0
  37. package/dist/src/activity.js +90 -1
  38. package/dist/src/adapters.d.ts +175 -5
  39. package/dist/src/adapters.js +961 -73
  40. package/dist/src/agent-context.d.ts +135 -0
  41. package/dist/src/agent-context.js +1059 -0
  42. package/dist/src/archive-copies.d.ts +47 -0
  43. package/dist/src/archive-copies.js +179 -0
  44. package/dist/src/audit.d.ts +1 -1
  45. package/dist/src/audit.js +29 -4
  46. package/dist/src/autopilot.d.ts +52 -7
  47. package/dist/src/autopilot.js +143 -25
  48. package/dist/src/background-bandwidth.d.ts +46 -0
  49. package/dist/src/background-bandwidth.js +301 -0
  50. package/dist/src/background-cpu.d.ts +82 -0
  51. package/dist/src/background-cpu.js +212 -0
  52. package/dist/src/background-worker-error.d.ts +12 -0
  53. package/dist/src/background-worker-error.js +18 -0
  54. package/dist/src/branding.d.ts +24 -1
  55. package/dist/src/branding.js +31 -1
  56. package/dist/src/bridge.d.ts +233 -0
  57. package/dist/src/bridge.js +604 -0
  58. package/dist/src/byte-stream.d.ts +91 -0
  59. package/dist/src/byte-stream.js +385 -0
  60. package/dist/src/chunk-store.d.ts +41 -8
  61. package/dist/src/chunk-store.js +161 -65
  62. package/dist/src/cli.js +1698 -163
  63. package/dist/src/cloud.d.ts +841 -31
  64. package/dist/src/cloud.js +3196 -277
  65. package/dist/src/context-background.d.ts +37 -0
  66. package/dist/src/context-background.js +309 -0
  67. package/dist/src/context-drain-child.d.ts +1 -0
  68. package/dist/src/context-drain-child.js +98 -0
  69. package/dist/src/context-reader.d.ts +118 -0
  70. package/dist/src/context-reader.js +447 -0
  71. package/dist/src/control-plane/auth.d.ts +32 -4
  72. package/dist/src/control-plane/auth.js +85 -24
  73. package/dist/src/control-plane/server.js +19 -6
  74. package/dist/src/control-plane.d.ts +17 -1
  75. package/dist/src/control-plane.js +32 -6
  76. package/dist/src/crypto.d.ts +1 -1
  77. package/dist/src/crypto.js +5 -5
  78. package/dist/src/daemon-lease.d.ts +70 -0
  79. package/dist/src/daemon-lease.js +420 -0
  80. package/dist/src/daemon.d.ts +94 -1
  81. package/dist/src/daemon.js +1082 -105
  82. package/dist/src/darwin-service-policy.d.ts +41 -0
  83. package/dist/src/darwin-service-policy.js +60 -0
  84. package/dist/src/dashboard-cli.js +15 -15
  85. package/dist/src/device-authorization.d.ts +37 -0
  86. package/dist/src/device-authorization.js +199 -0
  87. package/dist/src/device-enrollment.d.ts +91 -0
  88. package/dist/src/device-enrollment.js +349 -0
  89. package/dist/src/disk.d.ts +17 -12
  90. package/dist/src/disk.js +43 -17
  91. package/dist/src/doctor.d.ts +35 -1
  92. package/dist/src/doctor.js +316 -41
  93. package/dist/src/durable-ticket-lock.d.ts +24 -0
  94. package/dist/src/durable-ticket-lock.js +232 -0
  95. package/dist/src/enroll.d.ts +1 -1
  96. package/dist/src/enroll.js +13 -7
  97. package/dist/src/env.d.ts +10 -1
  98. package/dist/src/env.js +11 -3
  99. package/dist/src/errors.d.ts +8 -8
  100. package/dist/src/errors.js +6 -6
  101. package/dist/src/flush.d.ts +12 -0
  102. package/dist/src/flush.js +37 -0
  103. package/dist/src/heartbeat.d.ts +86 -12
  104. package/dist/src/heartbeat.js +415 -29
  105. package/dist/src/index-background-watchdog.d.ts +1 -0
  106. package/dist/src/index-background-watchdog.js +94 -0
  107. package/dist/src/index-background-work.d.ts +21 -0
  108. package/dist/src/index-background-work.js +25 -0
  109. package/dist/src/index-background.d.ts +64 -0
  110. package/dist/src/index-background.js +394 -0
  111. package/dist/src/index-build-child.d.ts +1 -0
  112. package/dist/src/index-build-child.js +109 -0
  113. package/dist/src/index-manifest.d.ts +52 -0
  114. package/dist/src/index-manifest.js +444 -0
  115. package/dist/src/index-publication-proof.d.ts +84 -0
  116. package/dist/src/index-publication-proof.js +380 -0
  117. package/dist/src/index-publication-state.d.ts +149 -0
  118. package/dist/src/index-publication-state.js +696 -0
  119. package/dist/src/index-publication-verifier.d.ts +89 -0
  120. package/dist/src/index-publication-verifier.js +341 -0
  121. package/dist/src/index-publish.d.ts +62 -0
  122. package/dist/src/index-publish.js +540 -0
  123. package/dist/src/index-scratch-cleanup.d.ts +19 -0
  124. package/dist/src/index-scratch-cleanup.js +166 -0
  125. package/dist/src/index-segment-types.d.ts +132 -0
  126. package/dist/src/index-segment-types.js +21 -0
  127. package/dist/src/index-segments.d.ts +9 -0
  128. package/dist/src/index-segments.js +516 -0
  129. package/dist/src/index-store.d.ts +123 -0
  130. package/dist/src/index-store.js +495 -0
  131. package/dist/src/index-sync.d.ts +91 -15
  132. package/dist/src/index-sync.js +286 -53
  133. package/dist/src/index-upgrade-publication.d.ts +30 -0
  134. package/dist/src/index-upgrade-publication.js +179 -0
  135. package/dist/src/integration-manager.d.ts +32 -0
  136. package/dist/src/integration-manager.js +394 -0
  137. package/dist/src/leakscan.js +1 -1
  138. package/dist/src/local-api.d.ts +56 -15
  139. package/dist/src/local-api.js +4979 -541
  140. package/dist/src/machine-settings.d.ts +51 -0
  141. package/dist/src/machine-settings.js +166 -0
  142. package/dist/src/managed-chunks.d.ts +5 -2
  143. package/dist/src/managed-chunks.js +14 -14
  144. package/dist/src/mcp-install.d.ts +11 -9
  145. package/dist/src/mcp-install.js +73 -28
  146. package/dist/src/mcp-workspace.d.ts +18 -0
  147. package/dist/src/mcp-workspace.js +50 -0
  148. package/dist/src/mcp.js +294 -25
  149. package/dist/src/migrate.js +27 -21
  150. package/dist/src/notify.d.ts +1 -1
  151. package/dist/src/notify.js +5 -5
  152. package/dist/src/offload.d.ts +201 -14
  153. package/dist/src/offload.js +1848 -140
  154. package/dist/src/onboarding.d.ts +8 -1
  155. package/dist/src/onboarding.js +4 -4
  156. package/dist/src/packages.d.ts +2 -2
  157. package/dist/src/packages.js +10 -2
  158. package/dist/src/passkey.d.ts +0 -1
  159. package/dist/src/passkey.js +2 -7
  160. package/dist/src/password-lock.d.ts +2 -2
  161. package/dist/src/password-lock.js +6 -6
  162. package/dist/src/paths.d.ts +2 -0
  163. package/dist/src/paths.js +2 -0
  164. package/dist/src/presence.d.ts +86 -0
  165. package/dist/src/presence.js +240 -0
  166. package/dist/src/progress-deadline.d.ts +21 -0
  167. package/dist/src/progress-deadline.js +91 -0
  168. package/dist/src/project-repair.d.ts +55 -0
  169. package/dist/src/project-repair.js +131 -0
  170. package/dist/src/providers/gcs.d.ts +28 -7
  171. package/dist/src/providers/gcs.js +35 -24
  172. package/dist/src/providers/gdrive.d.ts +71 -8
  173. package/dist/src/providers/gdrive.js +223 -50
  174. package/dist/src/providers/index.d.ts +11 -3
  175. package/dist/src/providers/index.js +30 -10
  176. package/dist/src/providers/s3.d.ts +30 -8
  177. package/dist/src/providers/s3.js +41 -30
  178. package/dist/src/providers/safe-storage-fetch.d.ts +12 -0
  179. package/dist/src/providers/safe-storage-fetch.js +72 -0
  180. package/dist/src/queue.d.ts +136 -19
  181. package/dist/src/queue.js +862 -96
  182. package/dist/src/reclaim-transaction.d.ts +156 -0
  183. package/dist/src/reclaim-transaction.js +1027 -0
  184. package/dist/src/recovery-codes.d.ts +32 -0
  185. package/dist/src/recovery-codes.js +338 -0
  186. package/dist/src/recovery.js +12 -9
  187. package/dist/src/rehydrate.d.ts +25 -22
  188. package/dist/src/rehydrate.js +319 -23
  189. package/dist/src/restore.d.ts +57 -4
  190. package/dist/src/restore.js +272 -36
  191. package/dist/src/resume-stub.d.ts +92 -0
  192. package/dist/src/resume-stub.js +417 -0
  193. package/dist/src/retention.d.ts +98 -7
  194. package/dist/src/retention.js +1066 -62
  195. package/dist/src/rotate.js +3 -3
  196. package/dist/src/search.d.ts +566 -8
  197. package/dist/src/search.js +5897 -290
  198. package/dist/src/secrets.d.ts +51 -7
  199. package/dist/src/secrets.js +316 -24
  200. package/dist/src/service.d.ts +49 -11
  201. package/dist/src/service.js +776 -35
  202. package/dist/src/share.js +3 -3
  203. package/dist/src/shared-spaces.d.ts +98 -0
  204. package/dist/src/shared-spaces.js +214 -0
  205. package/dist/src/source-reader.d.ts +73 -0
  206. package/dist/src/source-reader.js +715 -0
  207. package/dist/src/spool.d.ts +1 -1
  208. package/dist/src/spool.js +1 -1
  209. package/dist/src/start-tui.js +2 -1
  210. package/dist/src/start.js +2 -2
  211. package/dist/src/storage-endpoint.d.ts +21 -0
  212. package/dist/src/storage-endpoint.js +122 -0
  213. package/dist/src/storage-setup.js +12 -12
  214. package/dist/src/storage-targets.d.ts +109 -6
  215. package/dist/src/storage-targets.js +975 -67
  216. package/dist/src/stream-to-cloud.d.ts +5 -1
  217. package/dist/src/stream-to-cloud.js +34 -14
  218. package/dist/src/sync-rules.d.ts +31 -6
  219. package/dist/src/sync-rules.js +153 -14
  220. package/dist/src/team-backfill-scheduling.d.ts +8 -0
  221. package/dist/src/team-backfill-scheduling.js +33 -0
  222. package/dist/src/team-backfill.d.ts +116 -0
  223. package/dist/src/team-backfill.js +1429 -0
  224. package/dist/src/team-index-cache.d.ts +16 -0
  225. package/dist/src/team-index-cache.js +152 -0
  226. package/dist/src/team-offboarding.d.ts +38 -0
  227. package/dist/src/team-offboarding.js +1043 -0
  228. package/dist/src/team-presence.d.ts +127 -0
  229. package/dist/src/team-presence.js +904 -0
  230. package/dist/src/team-publication-policy.d.ts +20 -0
  231. package/dist/src/team-publication-policy.js +140 -0
  232. package/dist/src/team-realtime.d.ts +68 -0
  233. package/dist/src/team-realtime.js +816 -0
  234. package/dist/src/team-source-facts-cache.d.ts +23 -0
  235. package/dist/src/team-source-facts-cache.js +255 -0
  236. package/dist/src/trash.d.ts +1 -1
  237. package/dist/src/trash.js +2 -2
  238. package/dist/src/tui.js +11 -12
  239. package/dist/src/types.d.ts +173 -7
  240. package/dist/src/types.js +20 -0
  241. package/dist/src/ui-server.d.ts +163 -35
  242. package/dist/src/ui-server.js +712 -72
  243. package/dist/src/ui.d.ts +1 -2
  244. package/dist/src/ui.js +1 -2
  245. package/dist/src/upload.d.ts +27 -0
  246. package/dist/src/upload.js +383 -43
  247. package/dist/src/vault.d.ts +226 -30
  248. package/dist/src/vault.js +1776 -192
  249. package/dist/src/watcher.d.ts +7 -1
  250. package/dist/src/watcher.js +198 -55
  251. package/dist/src/worker.d.ts +27 -3
  252. package/dist/src/worker.js +274 -55
  253. package/package.json +33 -12
  254. package/scripts/native-reboot-rehearsal.mjs +90 -0
  255. package/web/app.js +6032 -343
  256. package/web/bootstrap.js +17 -0
  257. package/web/index.html +255 -57
  258. package/web/rail.js +317 -40
  259. package/web/retention.html +2 -2
  260. package/web/rules-view.js +188 -16
  261. package/web/sessions-view.js +485 -62
  262. package/web/sessions.html +2 -2
  263. package/web/setup-api.js +152 -29
  264. package/web/setup-logic.js +68 -9
  265. package/web/setup.html +113 -44
  266. package/web/setup.js +604 -71
  267. package/web/style.css +513 -98
  268. package/dist/packages/vaultline-crypto/src/chunk-access.js +0 -93
  269. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/aead.d.ts +0 -0
  270. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/aead.js +0 -0
  271. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/format.js +0 -0
  272. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/recipients.d.ts +0 -0
  273. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/sha256-stream.d.ts +0 -0
  274. /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/sha256-stream.js +0 -0
@@ -26,6 +26,7 @@ export type AgentInstall = {
26
26
  export declare const SETUP_AGENT_IDS: SetupAgentId[];
27
27
  /** The subset with a session adapter. Mirrors `AgentId` at runtime for schema use. */
28
28
  export declare const ARCHIVING_AGENT_IDS: readonly ["codex", "claude"];
29
+ export declare const HOOK_LIFECYCLE_VERSION = 3;
29
30
  /** Narrows a setup id to an archiving one, so callers prove the subset rather than casting to it. */
30
31
  export declare function isArchivingAgent(agent: SetupAgentId): agent is AgentId;
31
32
  /** Detect only well-known local roots; it never reads transcript contents. */
@@ -42,11 +43,14 @@ export type TranscriptCandidate = {
42
43
  * `findTranscripts` returns has both fields resolved.
43
44
  */
44
45
  project?: string | null;
46
+ /** Stable, opaque identity used for access decisions. `project` remains display-only. */
47
+ projectKey?: string | null;
45
48
  /** The working directory behind `project`, best-effort. See the decode caveat on `claudeProjectFromPath`. */
46
49
  projectPath?: string | null;
47
50
  };
48
51
  export type ProjectIdentity = {
49
52
  project: string | null;
53
+ projectKey: string | null;
50
54
  projectPath: string | null;
51
55
  };
52
56
  /**
@@ -58,14 +62,30 @@ export type ProjectIdentity = {
58
62
  * the naive re-expansion, kept because "which /Users/… did this come from" is
59
63
  * still worth answering approximately.
60
64
  */
65
+ /**
66
+ * Which archiving agent wrote a transcript, judged by where it lives. A file
67
+ * under `~/.claude/projects` is Claude's; under `~/.codex/sessions` (or its
68
+ * archived sibling) it is Codex's. This is what lets a hand-sealed
69
+ * `sealkeep archive <file>` carry the same agent — and therefore the same
70
+ * project derivation — as the watcher would have given it, instead of the
71
+ * "custom" label that leaves the session untagged and invisible to every
72
+ * project-scoped recall.
73
+ */
74
+ export declare function agentForTranscriptPath(path: string, home?: string): AgentId | null;
61
75
  export declare function claudeProjectFromPath(path: string): ProjectIdentity;
76
+ /** The project for a session's recorded cwd: the git remote's repo name, else the folder name. */
77
+ export declare function projectFromCwd(cwd: string): Promise<ProjectIdentity>;
78
+ export declare function claudeProjectFromTranscript(path: string, modifiedAt: string): Promise<ProjectIdentity>;
62
79
  export declare function codexProjectFromRollout(path: string, modifiedAt: string): Promise<ProjectIdentity>;
63
80
  /**
64
81
  * Lists metadata for recent transcripts, never their conversations. The one
65
82
  * read into a file is the codex rollout's first line, which is the session's
66
83
  * own metadata record — what was said in the session stays unread.
67
84
  */
68
- export declare function findTranscripts(agent: AgentId, home?: string, limit?: number): Promise<TranscriptCandidate[]>;
85
+ export declare function findTranscripts(agent: AgentId, home?: string, limit?: number, options?: {
86
+ exclude?: (path: string) => boolean;
87
+ includeProjects?: boolean;
88
+ }): Promise<TranscriptCandidate[]>;
69
89
  /**
70
90
  * The one command a Sealkeep hook ever runs, built in one place.
71
91
  *
@@ -105,10 +125,38 @@ export declare function hookConfig(agent: AgentId, executable?: string, dataDir?
105
125
  type: "command";
106
126
  command: string;
107
127
  timeout: number;
128
+ async: boolean;
108
129
  }[];
109
130
  }[];
131
+ UserPromptSubmit: {
132
+ hooks: ({
133
+ additionalContextLimit?: number | undefined;
134
+ type: "command";
135
+ command: string;
136
+ timeout: number;
137
+ } | {
138
+ type: "command";
139
+ command: string;
140
+ timeout: number;
141
+ async: boolean;
142
+ })[];
143
+ }[];
144
+ PostToolUse: {
145
+ matcher: string;
146
+ hooks: ({
147
+ additionalContextLimit?: number | undefined;
148
+ type: "command";
149
+ command: string;
150
+ timeout: number;
151
+ } | {
152
+ type: "command";
153
+ command: string;
154
+ timeout: number;
155
+ async: boolean;
156
+ })[];
157
+ }[];
110
158
  };
111
- _vaultlineNote: string;
159
+ _sealkeepNote: string;
112
160
  } | {
113
161
  hooks: {
114
162
  SessionEnd: {
@@ -124,11 +172,39 @@ export declare function hookConfig(agent: AgentId, executable?: string, dataDir?
124
172
  type: "command";
125
173
  command: string;
126
174
  timeout: number;
175
+ async: boolean;
127
176
  }[];
128
177
  }[];
178
+ UserPromptSubmit: {
179
+ hooks: ({
180
+ additionalContextLimit?: number | undefined;
181
+ type: "command";
182
+ command: string;
183
+ timeout: number;
184
+ } | {
185
+ type: "command";
186
+ command: string;
187
+ timeout: number;
188
+ async: boolean;
189
+ })[];
190
+ }[];
191
+ PostToolUse: {
192
+ matcher: string;
193
+ hooks: ({
194
+ additionalContextLimit?: number | undefined;
195
+ type: "command";
196
+ command: string;
197
+ timeout: number;
198
+ } | {
199
+ type: "command";
200
+ command: string;
201
+ timeout: number;
202
+ async: boolean;
203
+ })[];
204
+ }[];
129
205
  PostCompact?: undefined;
130
206
  };
131
- _vaultlineNote: string;
207
+ _sealkeepNote: string;
132
208
  description?: undefined;
133
209
  };
134
210
  /**
@@ -140,8 +216,12 @@ export declare function hookConfig(agent: AgentId, executable?: string, dataDir?
140
216
  export type AgentHookStatus =
141
217
  /** No root directory: this agent is not on the machine. */
142
218
  "not-installed"
143
- /** Sealkeep's hook is already in this agent's config. */
219
+ /** Sealkeep's complete lifecycle is configured and active in this agent. */
144
220
  | "hooked"
221
+ /** Sealkeep's lifecycle is configured, but the user disabled at least one Codex handler. */
222
+ | "hooked-but-disabled"
223
+ /** Sealkeep's lifecycle is configured, but Codex has not trusted its exact current definitions. */
224
+ | "hooked-awaiting-review"
145
225
  /** Found, but its hook file can neither be written nor created. */
146
226
  | "found-but-unwritable"
147
227
  /** Found and writable, but this build cannot process a hook from it. */
@@ -159,7 +239,26 @@ export type AgentDetection = {
159
239
  hookFileFormat: "json" | "toml";
160
240
  hookFileExists: boolean;
161
241
  hookFileWritable: boolean;
242
+ /** The complete current Sealkeep lifecycle is present in the agent's config. */
162
243
  hooksInstalled: boolean;
244
+ /** Present lifecycle handlers will actually be dispatched by the agent. */
245
+ hooksActive: boolean;
246
+ /**
247
+ * The one data directory every owned lifecycle command routes to, or null
248
+ * when the commands are absent or disagree. Presence alone says nothing about
249
+ * WHICH vault a hook feeds; this is what does.
250
+ */
251
+ hooksDataDir: string | null;
252
+ /**
253
+ * The complete lifecycle is present but routes to a data directory other
254
+ * than the one asked about. Only ever true when `detectSetupAgents` was given
255
+ * a data directory to compare against. A hook in this state reports
256
+ * "installed" and "active" while injecting and capturing nothing for this
257
+ * vault — the exact silent failure the fail-open hook contract cannot surface.
258
+ */
259
+ hooksAimedElsewhere: boolean;
260
+ /** Per-handler execution problems, never inferred from command presence alone. */
261
+ hookIssues: AgentHookIssue[];
163
262
  /** True when Sealkeep can archive this agent's sessions, not merely find it. */
164
263
  archivable: boolean;
165
264
  /** Disk this agent's transcripts occupy right now. Zero for anything not archivable. */
@@ -169,7 +268,12 @@ export type AgentDetection = {
169
268
  /** Why the status is what it is, whenever it is not simply "ready". */
170
269
  note: string | null;
171
270
  };
172
- export declare function detectSetupAgents(home?: string): Promise<AgentDetection[]>;
271
+ export type AgentHookIssue = {
272
+ event: string;
273
+ action: "enqueue" | "rehydrate" | "context" | "context-sync";
274
+ reason: "disabled" | "untrusted" | "modified";
275
+ };
276
+ export declare function detectSetupAgents(home?: string, dataDir?: string): Promise<AgentDetection[]>;
173
277
  export type HookInstallOutcome = {
174
278
  agent: SetupAgentId;
175
279
  /** True only when the agent's own config now carries the hook. */
@@ -177,12 +281,16 @@ export type HookInstallOutcome = {
177
281
  hookFile: string;
178
282
  /** True when the hook was already there and nothing was written. */
179
283
  alreadyInstalled: boolean;
284
+ /** True only when the agent will dispatch every configured Sealkeep handler. */
285
+ active: boolean;
180
286
  /** The copy taken before the agent's config was edited, when one was needed. */
181
287
  backupPath: string | null;
182
288
  /** A reviewable document under the vault, for a config this build will not edit. */
183
289
  fragmentPath: string | null;
184
290
  /** Why `installed` is false. Null when it is true. */
185
291
  reason: string | null;
292
+ /** A consent/review action still needed after a successful config write. */
293
+ attention: string | null;
186
294
  };
187
295
  /**
188
296
  * Installs Sealkeep's hook into the agents it can, and says why for the rest.
@@ -197,6 +305,36 @@ export declare function installAgentHooks(agents: readonly SetupAgentId[], optio
197
305
  home?: string;
198
306
  executable?: string;
199
307
  }): Promise<HookInstallOutcome[]>;
308
+ /**
309
+ * Upgrades only hook files that already contain a Sealkeep archive hook.
310
+ *
311
+ * This is the package-upgrade path: an earlier explicit install is continuing
312
+ * to consent to Sealkeep-owned lifecycle entries, but a machine that never
313
+ * installed them is left completely untouched. The daemon calls this once at
314
+ * startup, so upgrading the package does not require revisiting setup.
315
+ */
316
+ export declare function upgradeOwnedAgentHooks(options: {
317
+ dataDir: string;
318
+ home?: string;
319
+ executable?: string;
320
+ }): Promise<HookInstallOutcome[]>;
321
+ export type HookRemoveOutcome = {
322
+ agent: AgentId;
323
+ hookFile: string;
324
+ removed: boolean;
325
+ backupPath: string | null;
326
+ reason: string | null;
327
+ };
328
+ /**
329
+ * Removes Sealkeep-owned lifecycle handlers and nothing else.
330
+ *
331
+ * This is intentionally structural rather than a text replacement: if a user
332
+ * placed their own handler beside Sealkeep's in one matcher group, their
333
+ * handler and matcher survive. The original file is backed up before a write.
334
+ */
335
+ export declare function removeOwnedAgentHooks(options: {
336
+ home?: string;
337
+ }): Promise<HookRemoveOutcome[]>;
200
338
  /** A normalized archive intent. Sealkeep reads lifecycle metadata only, never transcript bodies. */
201
339
  export type HookEvent = {
202
340
  agent: AgentId;
@@ -204,9 +342,41 @@ export type HookEvent = {
204
342
  sourcePath: string;
205
343
  sessionId?: string;
206
344
  };
345
+ /** The lifecycle event a hook payload names; undefined when it names none or is not JSON. */
346
+ export declare function hookEventNameOf(stdin: string): string | undefined;
207
347
  /**
208
348
  * Accepts Codex `SessionEnd`/`PostCompact` and Claude `SessionEnd` payloads. Unknown
209
349
  * vendor fields are ignored rather than parsed, so a schema change cannot break preservation.
210
350
  */
211
351
  export declare function hookEventFromStdin(agent: AgentId, stdin: string): Promise<HookEvent>;
212
352
  export declare function transcriptPathFromHook(stdin: string, agent?: AgentId): Promise<string>;
353
+ /**
354
+ * The project an archive belongs to: what the seal recorded, or failing that
355
+ * what its path implies.
356
+ *
357
+ * Deriving it from the path is guesswork that only works inside an agent's own
358
+ * directories — a rehearsal of a company setup archived six sessions into a
359
+ * shared project and every one of them came back "no project", so membership
360
+ * could never bind and `rewrap --project` re-keyed nothing while reporting
361
+ * that the archives "belong to another project". Records written since carry
362
+ * the answer; older ones still fall back to the path.
363
+ */
364
+ export declare function projectIdentityOfRecord(record: {
365
+ source: {
366
+ path: string;
367
+ agent: string;
368
+ project?: string;
369
+ projectKey?: string;
370
+ };
371
+ createdAt: string;
372
+ }): Promise<ProjectIdentity>;
373
+ /** Backward-compatible display-label helper. Access-control callers use projectIdentityOfRecord. */
374
+ export declare function projectOfRecord(record: {
375
+ source: {
376
+ path: string;
377
+ agent: string;
378
+ project?: string;
379
+ projectKey?: string;
380
+ };
381
+ createdAt: string;
382
+ }): Promise<string | null>;