sealkeep 0.5.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 (180) hide show
  1. package/ARCHITECTURE.md +201 -0
  2. package/CHANGELOG.md +218 -0
  3. package/CONTROL_PLANE.md +86 -0
  4. package/LICENSE +34 -0
  5. package/README.md +249 -0
  6. package/THIRD_PARTY.md +22 -0
  7. package/THREAT_MODEL.md +107 -0
  8. package/dist/packages/vaultline-crypto/src/aead.d.ts +12 -0
  9. package/dist/packages/vaultline-crypto/src/aead.js +24 -0
  10. package/dist/packages/vaultline-crypto/src/chunk-access.d.ts +39 -0
  11. package/dist/packages/vaultline-crypto/src/chunk-access.js +93 -0
  12. package/dist/packages/vaultline-crypto/src/envelope.d.ts +71 -0
  13. package/dist/packages/vaultline-crypto/src/envelope.js +188 -0
  14. package/dist/packages/vaultline-crypto/src/format.d.ts +106 -0
  15. package/dist/packages/vaultline-crypto/src/format.js +43 -0
  16. package/dist/packages/vaultline-crypto/src/index.d.ts +5 -0
  17. package/dist/packages/vaultline-crypto/src/index.js +5 -0
  18. package/dist/packages/vaultline-crypto/src/recipients.d.ts +42 -0
  19. package/dist/packages/vaultline-crypto/src/recipients.js +129 -0
  20. package/dist/packages/vaultline-crypto/src/sha256-stream.d.ts +41 -0
  21. package/dist/packages/vaultline-crypto/src/sha256-stream.js +206 -0
  22. package/dist/packages/vaultline-crypto/src/stream.d.ts +139 -0
  23. package/dist/packages/vaultline-crypto/src/stream.js +477 -0
  24. package/dist/site/index.html +1542 -0
  25. package/dist/site.zip +0 -0
  26. package/dist/src/activity.d.ts +22 -0
  27. package/dist/src/activity.js +52 -0
  28. package/dist/src/adapters.d.ts +212 -0
  29. package/dist/src/adapters.js +533 -0
  30. package/dist/src/audit.d.ts +24 -0
  31. package/dist/src/audit.js +41 -0
  32. package/dist/src/autopilot.d.ts +77 -0
  33. package/dist/src/autopilot.js +148 -0
  34. package/dist/src/bip39-wordlist.d.ts +15 -0
  35. package/dist/src/bip39-wordlist.js +272 -0
  36. package/dist/src/branding.d.ts +31 -0
  37. package/dist/src/branding.js +31 -0
  38. package/dist/src/chunk-store.d.ts +142 -0
  39. package/dist/src/chunk-store.js +502 -0
  40. package/dist/src/cli.d.ts +2 -0
  41. package/dist/src/cli.js +2035 -0
  42. package/dist/src/cloud.d.ts +434 -0
  43. package/dist/src/cloud.js +851 -0
  44. package/dist/src/control-plane/auth.d.ts +62 -0
  45. package/dist/src/control-plane/auth.js +123 -0
  46. package/dist/src/control-plane/server.d.ts +31 -0
  47. package/dist/src/control-plane/server.js +263 -0
  48. package/dist/src/control-plane/store.d.ts +101 -0
  49. package/dist/src/control-plane/store.js +82 -0
  50. package/dist/src/control-plane-cli.d.ts +2 -0
  51. package/dist/src/control-plane-cli.js +37 -0
  52. package/dist/src/control-plane-server.d.ts +10 -0
  53. package/dist/src/control-plane-server.js +11 -0
  54. package/dist/src/control-plane.d.ts +78 -0
  55. package/dist/src/control-plane.js +61 -0
  56. package/dist/src/crypto.d.ts +56 -0
  57. package/dist/src/crypto.js +132 -0
  58. package/dist/src/daemon.d.ts +52 -0
  59. package/dist/src/daemon.js +142 -0
  60. package/dist/src/dashboard-cli.d.ts +2 -0
  61. package/dist/src/dashboard-cli.js +20 -0
  62. package/dist/src/disk.d.ts +110 -0
  63. package/dist/src/disk.js +169 -0
  64. package/dist/src/doctor.d.ts +11 -0
  65. package/dist/src/doctor.js +198 -0
  66. package/dist/src/enroll.d.ts +27 -0
  67. package/dist/src/enroll.js +136 -0
  68. package/dist/src/errors.d.ts +26 -0
  69. package/dist/src/errors.js +23 -0
  70. package/dist/src/heartbeat.d.ts +89 -0
  71. package/dist/src/heartbeat.js +120 -0
  72. package/dist/src/index-sync.d.ts +53 -0
  73. package/dist/src/index-sync.js +147 -0
  74. package/dist/src/leakscan.d.ts +48 -0
  75. package/dist/src/leakscan.js +222 -0
  76. package/dist/src/local-api.d.ts +132 -0
  77. package/dist/src/local-api.js +1757 -0
  78. package/dist/src/managed-chunks.d.ts +55 -0
  79. package/dist/src/managed-chunks.js +108 -0
  80. package/dist/src/mcp-install.d.ts +52 -0
  81. package/dist/src/mcp-install.js +140 -0
  82. package/dist/src/mcp.d.ts +1 -0
  83. package/dist/src/mcp.js +59 -0
  84. package/dist/src/migrate.d.ts +35 -0
  85. package/dist/src/migrate.js +88 -0
  86. package/dist/src/mnemonic.d.ts +60 -0
  87. package/dist/src/mnemonic.js +134 -0
  88. package/dist/src/net.d.ts +2 -0
  89. package/dist/src/net.js +16 -0
  90. package/dist/src/notify.d.ts +46 -0
  91. package/dist/src/notify.js +84 -0
  92. package/dist/src/offload.d.ts +117 -0
  93. package/dist/src/offload.js +331 -0
  94. package/dist/src/onboarding.d.ts +10 -0
  95. package/dist/src/onboarding.js +44 -0
  96. package/dist/src/packages.d.ts +126 -0
  97. package/dist/src/packages.js +114 -0
  98. package/dist/src/passkey.d.ts +26 -0
  99. package/dist/src/passkey.js +54 -0
  100. package/dist/src/password-lock.d.ts +19 -0
  101. package/dist/src/password-lock.js +156 -0
  102. package/dist/src/paths.d.ts +9 -0
  103. package/dist/src/paths.js +24 -0
  104. package/dist/src/providers/gcs.d.ts +133 -0
  105. package/dist/src/providers/gcs.js +235 -0
  106. package/dist/src/providers/gdrive.d.ts +156 -0
  107. package/dist/src/providers/gdrive.js +335 -0
  108. package/dist/src/providers/index.d.ts +45 -0
  109. package/dist/src/providers/index.js +74 -0
  110. package/dist/src/providers/s3.d.ts +174 -0
  111. package/dist/src/providers/s3.js +345 -0
  112. package/dist/src/providers/sigv4.d.ts +78 -0
  113. package/dist/src/providers/sigv4.js +112 -0
  114. package/dist/src/queue.d.ts +185 -0
  115. package/dist/src/queue.js +286 -0
  116. package/dist/src/recovery.d.ts +40 -0
  117. package/dist/src/recovery.js +132 -0
  118. package/dist/src/rehydrate.d.ts +43 -0
  119. package/dist/src/rehydrate.js +66 -0
  120. package/dist/src/restore.d.ts +34 -0
  121. package/dist/src/restore.js +80 -0
  122. package/dist/src/retention.d.ts +251 -0
  123. package/dist/src/retention.js +446 -0
  124. package/dist/src/rotate.d.ts +47 -0
  125. package/dist/src/rotate.js +95 -0
  126. package/dist/src/search.d.ts +147 -0
  127. package/dist/src/search.js +677 -0
  128. package/dist/src/secrets.d.ts +86 -0
  129. package/dist/src/secrets.js +220 -0
  130. package/dist/src/service.d.ts +73 -0
  131. package/dist/src/service.js +197 -0
  132. package/dist/src/share.d.ts +34 -0
  133. package/dist/src/share.js +68 -0
  134. package/dist/src/spool.d.ts +97 -0
  135. package/dist/src/spool.js +213 -0
  136. package/dist/src/start-tui.d.ts +17 -0
  137. package/dist/src/start-tui.js +113 -0
  138. package/dist/src/start.d.ts +75 -0
  139. package/dist/src/start.js +101 -0
  140. package/dist/src/storage-setup.d.ts +49 -0
  141. package/dist/src/storage-setup.js +222 -0
  142. package/dist/src/storage-targets.d.ts +40 -0
  143. package/dist/src/storage-targets.js +147 -0
  144. package/dist/src/stream-to-cloud.d.ts +76 -0
  145. package/dist/src/stream-to-cloud.js +820 -0
  146. package/dist/src/sync-rules.d.ts +85 -0
  147. package/dist/src/sync-rules.js +125 -0
  148. package/dist/src/trash.d.ts +15 -0
  149. package/dist/src/trash.js +63 -0
  150. package/dist/src/tui.d.ts +18 -0
  151. package/dist/src/tui.js +179 -0
  152. package/dist/src/types.d.ts +191 -0
  153. package/dist/src/types.js +3 -0
  154. package/dist/src/ui-server.d.ts +187 -0
  155. package/dist/src/ui-server.js +293 -0
  156. package/dist/src/ui.d.ts +41 -0
  157. package/dist/src/ui.js +102 -0
  158. package/dist/src/update.d.ts +30 -0
  159. package/dist/src/update.js +56 -0
  160. package/dist/src/upload.d.ts +46 -0
  161. package/dist/src/upload.js +80 -0
  162. package/dist/src/vault.d.ts +208 -0
  163. package/dist/src/vault.js +812 -0
  164. package/dist/src/watcher.d.ts +34 -0
  165. package/dist/src/watcher.js +121 -0
  166. package/dist/src/worker.d.ts +52 -0
  167. package/dist/src/worker.js +190 -0
  168. package/package.json +65 -0
  169. package/web/app.js +1372 -0
  170. package/web/index.html +476 -0
  171. package/web/rail.js +308 -0
  172. package/web/retention.html +17 -0
  173. package/web/rules-view.js +249 -0
  174. package/web/sessions-view.js +448 -0
  175. package/web/sessions.html +17 -0
  176. package/web/setup-api.js +181 -0
  177. package/web/setup-logic.js +394 -0
  178. package/web/setup.html +419 -0
  179. package/web/setup.js +697 -0
  180. package/web/style.css +990 -0
@@ -0,0 +1,147 @@
1
+ export type SearchMode = "metadata" | "content";
2
+ type HitBase = {
3
+ id: string;
4
+ agent: string;
5
+ path: string;
6
+ bytes: number;
7
+ createdAt: string;
8
+ };
9
+ export type MetadataHit = HitBase & {
10
+ matched: "metadata";
11
+ };
12
+ export type ContentHit = HitBase & {
13
+ matched: "content";
14
+ snippets: string[];
15
+ };
16
+ export type SearchHit = MetadataHit | ContentHit;
17
+ /**
18
+ * The on-disk content index.
19
+ *
20
+ * It stores only lowercased tokens mapped to archive ids: no transcript text, no
21
+ * line contents. Snippets are produced at query time by decrypting the matching
22
+ * archive, which already requires the recovery phrase.
23
+ */
24
+ /**
25
+ * v2 entries may read "archiveId@c3": the token was seen inside chunk 3 of a
26
+ * chunk-independent archive. That one tag is what turns a search over cold
27
+ * storage into a ranged fetch of a few chunks instead of a full restore.
28
+ * Bare ids (v1, or legacy archives) still mean "somewhere in the archive".
29
+ */
30
+ export type ContentIndex = {
31
+ version: 1 | 2;
32
+ builtAt: string;
33
+ archives: Record<string, string[]>;
34
+ tokens: Record<string, string[]>;
35
+ };
36
+ /**
37
+ * What deserves an index slot. Transcripts are full of hex digests, base64
38
+ * blobs, and minified identifiers; every one of those admitted is a real word
39
+ * crowded out of the cap. Queries still tokenize unfiltered — searching FOR a
40
+ * long id simply misses content and falls to metadata search, which owns ids.
41
+ */
42
+ export declare function indexableToken(token: string): boolean;
43
+ /**
44
+ * Round-robin merge of per-chunk token sets: every chunk gets a fair slice of
45
+ * the archive's token budget. First-chunks-win was the live finding — with a
46
+ * 40k budget, chunks 0–7 of a 399-chunk archive consumed everything and a
47
+ * word living in chunk 50 stayed unsearchable.
48
+ */
49
+ export declare function mergeChunkTokens(byChunk: ReadonlyMap<number, ReadonlySet<string>>, cap: number): Map<string, Set<number>>;
50
+ /**
51
+ * The token budget grows with the archive: a 40 KB session and a 1.7 GB one
52
+ * do not deserve the same 4000 slots — the live drill proved the flat cap
53
+ * starves everything past the first chunk of a big archive ("retention"
54
+ * indexed, "chunk" lost). Bounded so the phonebook stays a phonebook.
55
+ */
56
+ export declare function tokenCapFor(sourceBytes: number): number;
57
+ /** Own-property-safe read: inherited names ("constructor", "toString") answer as absent. */
58
+ export declare function tokenEntries(tokens: Record<string, string[]>, token: string): string[];
59
+ /**
60
+ * A query term also matches indexed tokens it prefixes — "chunk" finds
61
+ * "chunks" and "chunkbytes", which is what a person typing it meant. Bounded
62
+ * fan-out; exact entries come first so precise queries stay precise.
63
+ */
64
+ export declare function tokenEntriesExpanded(tokens: Record<string, string[]>, term: string): string[];
65
+ export declare function tokenize(text: string): string[];
66
+ /** Metadata search needs no secret and never touches an archive's contents. */
67
+ export declare function searchMetadata(dataDir: string, query: string, options?: {
68
+ agent?: string;
69
+ }): Promise<MetadataHit[]>;
70
+ /**
71
+ * Builds the opt-in content index.
72
+ *
73
+ * This decrypts every archive locally, so it requires the recovery phrase. The
74
+ * resulting index is itself encrypted with the same envelope before it touches the
75
+ * disk, and it is never uploaded: `sealkeep upload` only ever sends archive objects.
76
+ */
77
+ export declare function buildContentIndex(dataDir: string, rawPhrase: string, options?: {
78
+ sync?: boolean;
79
+ }): Promise<{
80
+ archives: number;
81
+ tokens: number;
82
+ builtAt: string;
83
+ indexedNow: number;
84
+ skipped: number;
85
+ pulled: boolean;
86
+ pushed: boolean;
87
+ }>;
88
+ /**
89
+ * Seal-time indexing: the seal already held every plaintext slice in its
90
+ * hands, so the tokens arrive here for free — no downloading an archive back
91
+ * just to read what was just read. Merges one archive's chunk-tagged tokens
92
+ * into the index (pulling a newer remote first, exactly like a build) and
93
+ * persists. Failure must never fail a seal; callers treat this as advisory.
94
+ */
95
+ export declare function indexArchiveTokens(dataDir: string, rawPhrase: string, record: {
96
+ id: string;
97
+ source: {
98
+ agent: string;
99
+ path: string;
100
+ bytes: number;
101
+ };
102
+ }, tokensByChunk: ReadonlyMap<number, ReadonlySet<string>>, options?: {
103
+ sync?: boolean;
104
+ }): Promise<{
105
+ pushed: boolean;
106
+ }>;
107
+ /**
108
+ * Whatever shape an old index decrypts to, the build merges only what it can
109
+ * use: token entries must be arrays of archive tags, archive entries must
110
+ * exist. The live rebuild found a version-1 index whose token values were not
111
+ * arrays — `.push is not a function`, four archives in. Anything unusable is
112
+ * dropped here and simply re-indexed, which is what "incremental" owes its
113
+ * caller anyway.
114
+ */
115
+ export declare function normalizeContentIndex(raw: unknown): ContentIndex;
116
+ export declare function loadContentIndex(dataDir: string, rawPhrase: string): Promise<ContentIndex>;
117
+ export declare function dropContentIndex(dataDir: string): Promise<void>;
118
+ /**
119
+ * Content search over the opt-in index. Every returned snippet is read from the
120
+ * archive at query time, so nothing readable is kept on disk between searches.
121
+ */
122
+ export declare function searchContent(dataDir: string, query: string, rawPhrase: string, options?: {
123
+ agent?: string;
124
+ snippets?: boolean;
125
+ }): Promise<SearchHit[]>;
126
+ export declare function search(dataDir: string, query: string, options?: {
127
+ mode?: SearchMode;
128
+ phrase?: string;
129
+ agent?: string;
130
+ }): Promise<SearchHit[]>;
131
+ /**
132
+ * What the index covers, from the unsealed sidecar — no phrase required.
133
+ * "Missing" means sealed and durable yet not yet searchable, which is exactly
134
+ * the list `sealkeep index build` would work through.
135
+ */
136
+ export declare function indexCoverage(dataDir: string): Promise<{
137
+ total: number;
138
+ indexed: number;
139
+ builtAt: string | null;
140
+ indexBytes: number;
141
+ missing: {
142
+ id: string;
143
+ path: string;
144
+ agent: string;
145
+ }[];
146
+ }>;
147
+ export {};