@getengram/cli 0.6.1 → 0.7.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 (206) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/auth.d.ts.map +1 -1
  3. package/dist/commands/auth.js +38 -11
  4. package/dist/commands/auth.js.map +1 -1
  5. package/dist/commands/conversations.d.ts.map +1 -1
  6. package/dist/commands/conversations.js +8 -2
  7. package/dist/commands/conversations.js.map +1 -1
  8. package/dist/commands/exclude.d.ts.map +1 -1
  9. package/dist/commands/exclude.js +73 -21
  10. package/dist/commands/exclude.js.map +1 -1
  11. package/dist/commands/import.d.ts +30 -3
  12. package/dist/commands/import.d.ts.map +1 -1
  13. package/dist/commands/import.js +374 -45
  14. package/dist/commands/import.js.map +1 -1
  15. package/dist/commands/login.d.ts.map +1 -1
  16. package/dist/commands/login.js +144 -29
  17. package/dist/commands/login.js.map +1 -1
  18. package/dist/commands/search.js +2 -2
  19. package/dist/commands/search.js.map +1 -1
  20. package/dist/commands/status.d.ts +16 -0
  21. package/dist/commands/status.d.ts.map +1 -0
  22. package/dist/commands/status.js +51 -0
  23. package/dist/commands/status.js.map +1 -0
  24. package/dist/commands/store.d.ts.map +1 -1
  25. package/dist/commands/store.js +19 -3
  26. package/dist/commands/store.js.map +1 -1
  27. package/dist/commands/upgrade.d.ts +24 -0
  28. package/dist/commands/upgrade.d.ts.map +1 -1
  29. package/dist/commands/upgrade.js +64 -15
  30. package/dist/commands/upgrade.js.map +1 -1
  31. package/dist/commands/usage.d.ts +44 -0
  32. package/dist/commands/usage.d.ts.map +1 -1
  33. package/dist/commands/usage.js +79 -19
  34. package/dist/commands/usage.js.map +1 -1
  35. package/dist/commands/vault.d.ts +11 -2
  36. package/dist/commands/vault.d.ts.map +1 -1
  37. package/dist/commands/vault.js +372 -53
  38. package/dist/commands/vault.js.map +1 -1
  39. package/dist/config-file.d.ts +74 -0
  40. package/dist/config-file.d.ts.map +1 -0
  41. package/dist/config-file.js +152 -0
  42. package/dist/config-file.js.map +1 -0
  43. package/dist/config-guard.d.ts +96 -0
  44. package/dist/config-guard.d.ts.map +1 -0
  45. package/dist/config-guard.js +184 -0
  46. package/dist/config-guard.js.map +1 -0
  47. package/dist/config.d.ts +48 -4
  48. package/dist/config.d.ts.map +1 -1
  49. package/dist/config.js +101 -12
  50. package/dist/config.js.map +1 -1
  51. package/dist/daemon/as-root.d.ts +46 -0
  52. package/dist/daemon/as-root.d.ts.map +1 -0
  53. package/dist/daemon/as-root.js +64 -0
  54. package/dist/daemon/as-root.js.map +1 -0
  55. package/dist/daemon/backoff.d.ts +26 -0
  56. package/dist/daemon/backoff.d.ts.map +1 -0
  57. package/dist/daemon/backoff.js +37 -0
  58. package/dist/daemon/backoff.js.map +1 -0
  59. package/dist/daemon/codex-parser.d.ts +38 -4
  60. package/dist/daemon/codex-parser.d.ts.map +1 -1
  61. package/dist/daemon/codex-parser.js +111 -23
  62. package/dist/daemon/codex-parser.js.map +1 -1
  63. package/dist/daemon/command-path.d.ts +13 -0
  64. package/dist/daemon/command-path.d.ts.map +1 -0
  65. package/dist/daemon/command-path.js +35 -0
  66. package/dist/daemon/command-path.js.map +1 -0
  67. package/dist/daemon/commands.d.ts +146 -5
  68. package/dist/daemon/commands.d.ts.map +1 -1
  69. package/dist/daemon/commands.js +2766 -316
  70. package/dist/daemon/commands.js.map +1 -1
  71. package/dist/daemon/db.d.ts +255 -27
  72. package/dist/daemon/db.d.ts.map +1 -1
  73. package/dist/daemon/db.js +749 -53
  74. package/dist/daemon/db.js.map +1 -1
  75. package/dist/daemon/exclusions.d.ts +23 -3
  76. package/dist/daemon/exclusions.d.ts.map +1 -1
  77. package/dist/daemon/exclusions.js +91 -21
  78. package/dist/daemon/exclusions.js.map +1 -1
  79. package/dist/daemon/homebrew.d.ts +26 -0
  80. package/dist/daemon/homebrew.d.ts.map +1 -0
  81. package/dist/daemon/homebrew.js +43 -0
  82. package/dist/daemon/homebrew.js.map +1 -0
  83. package/dist/daemon/instance.d.ts +427 -0
  84. package/dist/daemon/instance.d.ts.map +1 -0
  85. package/dist/daemon/instance.js +1201 -0
  86. package/dist/daemon/instance.js.map +1 -0
  87. package/dist/daemon/key-source.d.ts +41 -0
  88. package/dist/daemon/key-source.d.ts.map +1 -0
  89. package/dist/daemon/key-source.js +89 -0
  90. package/dist/daemon/key-source.js.map +1 -0
  91. package/dist/daemon/launch.d.ts +56 -0
  92. package/dist/daemon/launch.d.ts.map +1 -0
  93. package/dist/daemon/launch.js +153 -0
  94. package/dist/daemon/launch.js.map +1 -0
  95. package/dist/daemon/launchd.d.ts +215 -0
  96. package/dist/daemon/launchd.d.ts.map +1 -0
  97. package/dist/daemon/launchd.js +527 -0
  98. package/dist/daemon/launchd.js.map +1 -0
  99. package/dist/daemon/login-start.d.ts +2 -0
  100. package/dist/daemon/login-start.d.ts.map +1 -0
  101. package/dist/daemon/login-start.js +25 -0
  102. package/dist/daemon/login-start.js.map +1 -0
  103. package/dist/daemon/ownership.d.ts +123 -0
  104. package/dist/daemon/ownership.d.ts.map +1 -0
  105. package/dist/daemon/ownership.js +245 -0
  106. package/dist/daemon/ownership.js.map +1 -0
  107. package/dist/daemon/package-runner.d.ts +28 -0
  108. package/dist/daemon/package-runner.d.ts.map +1 -0
  109. package/dist/daemon/package-runner.js +113 -0
  110. package/dist/daemon/package-runner.js.map +1 -0
  111. package/dist/daemon/parser.d.ts +45 -7
  112. package/dist/daemon/parser.d.ts.map +1 -1
  113. package/dist/daemon/parser.js +153 -53
  114. package/dist/daemon/parser.js.map +1 -1
  115. package/dist/daemon/powershell.d.ts +25 -0
  116. package/dist/daemon/powershell.d.ts.map +1 -0
  117. package/dist/daemon/powershell.js +30 -0
  118. package/dist/daemon/powershell.js.map +1 -0
  119. package/dist/daemon/preflight.d.ts.map +1 -1
  120. package/dist/daemon/preflight.js +5 -1
  121. package/dist/daemon/preflight.js.map +1 -1
  122. package/dist/daemon/prune.d.ts +101 -0
  123. package/dist/daemon/prune.d.ts.map +1 -0
  124. package/dist/daemon/prune.js +287 -0
  125. package/dist/daemon/prune.js.map +1 -0
  126. package/dist/daemon/queue-error.d.ts +47 -0
  127. package/dist/daemon/queue-error.d.ts.map +1 -0
  128. package/dist/daemon/queue-error.js +59 -0
  129. package/dist/daemon/queue-error.js.map +1 -0
  130. package/dist/daemon/root-daemon.d.ts +60 -0
  131. package/dist/daemon/root-daemon.d.ts.map +1 -0
  132. package/dist/daemon/root-daemon.js +86 -0
  133. package/dist/daemon/root-daemon.js.map +1 -0
  134. package/dist/daemon/scoop.d.ts +52 -0
  135. package/dist/daemon/scoop.d.ts.map +1 -0
  136. package/dist/daemon/scoop.js +84 -0
  137. package/dist/daemon/scoop.js.map +1 -0
  138. package/dist/daemon/scrubber.d.ts +396 -14
  139. package/dist/daemon/scrubber.d.ts.map +1 -1
  140. package/dist/daemon/scrubber.js +915 -52
  141. package/dist/daemon/scrubber.js.map +1 -1
  142. package/dist/daemon/status.d.ts +306 -11
  143. package/dist/daemon/status.d.ts.map +1 -1
  144. package/dist/daemon/status.js +568 -43
  145. package/dist/daemon/status.js.map +1 -1
  146. package/dist/daemon/supervise.d.ts +78 -0
  147. package/dist/daemon/supervise.d.ts.map +1 -0
  148. package/dist/daemon/supervise.js +121 -0
  149. package/dist/daemon/supervise.js.map +1 -0
  150. package/dist/daemon/supervisor.d.ts +18 -0
  151. package/dist/daemon/supervisor.d.ts.map +1 -0
  152. package/dist/daemon/supervisor.js +56 -0
  153. package/dist/daemon/supervisor.js.map +1 -0
  154. package/dist/daemon/syncer.d.ts +380 -21
  155. package/dist/daemon/syncer.d.ts.map +1 -1
  156. package/dist/daemon/syncer.js +1432 -182
  157. package/dist/daemon/syncer.js.map +1 -1
  158. package/dist/daemon/systemd.d.ts +109 -0
  159. package/dist/daemon/systemd.d.ts.map +1 -0
  160. package/dist/daemon/systemd.js +363 -0
  161. package/dist/daemon/systemd.js.map +1 -0
  162. package/dist/daemon/types.d.ts +58 -6
  163. package/dist/daemon/types.d.ts.map +1 -1
  164. package/dist/daemon/vault-changed.d.ts +29 -0
  165. package/dist/daemon/vault-changed.d.ts.map +1 -0
  166. package/dist/daemon/vault-changed.js +47 -0
  167. package/dist/daemon/vault-changed.js.map +1 -0
  168. package/dist/daemon/vault-key-missing.d.ts +70 -0
  169. package/dist/daemon/vault-key-missing.d.ts.map +1 -0
  170. package/dist/daemon/vault-key-missing.js +125 -0
  171. package/dist/daemon/vault-key-missing.js.map +1 -0
  172. package/dist/daemon/watcher.d.ts +87 -4
  173. package/dist/daemon/watcher.d.ts.map +1 -1
  174. package/dist/daemon/watcher.js +286 -36
  175. package/dist/daemon/watcher.js.map +1 -1
  176. package/dist/daemon/worker-main.js +352 -64
  177. package/dist/daemon/worker-main.js.map +1 -1
  178. package/dist/daemon/worker.js +19 -1
  179. package/dist/daemon/worker.js.map +1 -1
  180. package/dist/import-resume.d.ts +163 -0
  181. package/dist/import-resume.d.ts.map +1 -0
  182. package/dist/import-resume.js +267 -0
  183. package/dist/import-resume.js.map +1 -0
  184. package/dist/index.js +242 -33
  185. package/dist/index.js.map +1 -1
  186. package/dist/message-bounds.d.ts +52 -0
  187. package/dist/message-bounds.d.ts.map +1 -0
  188. package/dist/message-bounds.js +157 -0
  189. package/dist/message-bounds.js.map +1 -0
  190. package/dist/output.d.ts +14 -0
  191. package/dist/output.d.ts.map +1 -1
  192. package/dist/output.js +33 -5
  193. package/dist/output.js.map +1 -1
  194. package/dist/private-files.d.ts +126 -0
  195. package/dist/private-files.d.ts.map +1 -0
  196. package/dist/private-files.js +372 -0
  197. package/dist/private-files.js.map +1 -0
  198. package/dist/server-url.d.ts +31 -0
  199. package/dist/server-url.d.ts.map +1 -0
  200. package/dist/server-url.js +47 -0
  201. package/dist/server-url.js.map +1 -0
  202. package/dist/vault-key.d.ts +122 -0
  203. package/dist/vault-key.d.ts.map +1 -0
  204. package/dist/vault-key.js +273 -0
  205. package/dist/vault-key.js.map +1 -0
  206. package/package.json +2 -2
@@ -0,0 +1,84 @@
1
+ import { realpathSync } from "node:fs";
2
+ /**
3
+ * Node from Scoop by the name that outlasts its version (engram#664):
4
+ * `<root>\apps\<app>\<version>\node.exe` through
5
+ * `<root>\apps\<app>\current\node.exe`, the junction `scoop update` moves to
6
+ * each new version of the app. Any other path is returned as it is.
7
+ *
8
+ * The Windows sign-in entry names Node by its real path, through any links
9
+ * (nodePathForEntry), and on Windows that resolves Scoop's junction too. So
10
+ * the entry named a version that `scoop cleanup` removes after the next
11
+ * update: from the next sign-in, Windows ran a program that was gone.
12
+ *
13
+ * Only a file at the top of a version, where Scoop's Node apps (nodejs,
14
+ * nodejs-lts) keep node.exe: a file deeper in can be one the app left there
15
+ * that the next version doesn't have. And only when `current` leads to this
16
+ * very file: a version that is installed but isn't the app's current one,
17
+ * or an app with no `current` (Scoop's no_junction setting), keeps its own
18
+ * path. `current` is Scoop's, as the version is, so it hands the program to
19
+ * no one who couldn't change it already.
20
+ *
21
+ * The CLI needs nothing of the kind: Scoop's Node apps keep npm's global
22
+ * packages in their persist folder, which every version shares. A new
23
+ * version can be a new major of Node, for which the worker rebuilds
24
+ * better-sqlite3 before loading it (preflight.ts); the sign-in entry and the
25
+ * supervisor use only Node's built-ins.
26
+ *
27
+ * nvm-windows's link isn't followed: `nvm use` moves it to whichever version
28
+ * the user works with, and each version has its own global packages, this
29
+ * CLI among them. Its entry keeps the version it was written with.
30
+ *
31
+ * Either separator: Windows takes both, and the tests run this on every OS.
32
+ */
33
+ export function throughScoopCurrent(path) {
34
+ const v = inVersion(path);
35
+ if (v === null || isCurrent(v.version))
36
+ return path;
37
+ const current = `${v.app}${v.sep}current${v.sep}${v.file}`;
38
+ try {
39
+ return realpathSync.native(current) === path ? current : path;
40
+ }
41
+ catch {
42
+ return path; // no current, or nothing there
43
+ }
44
+ }
45
+ /**
46
+ * `entry` names the program `ours` names by a Scoop app's `current`
47
+ * (throughScoopCurrent), by a version of that same app instead: the version
48
+ * `current` leads to now, or one it led to before the last update. The next
49
+ * update and `scoop cleanup` remove either, and `current` outlasts them. A
50
+ * sign-in entry from before engram#664 names one, or one a CLI wrote that
51
+ * ran on a version that wasn't current; this CLI's entry, which names
52
+ * `ours`, replaces it.
53
+ *
54
+ * Never of `ours` itself, so a CLI never rewrites the entry it just wrote.
55
+ * And never when `ours` isn't by a `current`: a CLI run on a version that
56
+ * isn't current, or on a Node that isn't Scoop's, would trade an entry that
57
+ * works for one no more lasting, so the entry stays until it breaks and is
58
+ * repaired then.
59
+ *
60
+ * The paths alone, looked up nowhere. Windows paths, the same whatever
61
+ * their case or separators.
62
+ */
63
+ export function scoopVersionOf(entry, ours) {
64
+ const o = inVersion(ours);
65
+ const e = inVersion(entry);
66
+ return (o !== null &&
67
+ e !== null &&
68
+ isCurrent(o.version) &&
69
+ !isCurrent(e.version) &&
70
+ samePath(o.app, e.app) &&
71
+ samePath(o.file, e.file));
72
+ }
73
+ /** A file at the top of a version of a Scoop app: <root>\apps\<app>\<version>\<file>. */
74
+ function inVersion(path) {
75
+ const m = /^(.*[\\/]apps[\\/][^\\/]+)([\\/])([^\\/]+)[\\/]([^\\/]+)$/i.exec(path);
76
+ return m === null ? null : { app: m[1], sep: m[2], version: m[3], file: m[4] };
77
+ }
78
+ function isCurrent(version) {
79
+ return version.toLowerCase() === "current";
80
+ }
81
+ function samePath(a, b) {
82
+ return a.replace(/\//g, "\\").toLowerCase() === b.replace(/\//g, "\\").toLowerCase();
83
+ }
84
+ //# sourceMappingURL=scoop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoop.js","sourceRoot":"","sources":["../../src/daemon/scoop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,IAAI,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E,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,OAAO,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AACvF,CAAC"}
@@ -16,10 +16,84 @@
16
16
  * this machine every day. So this is where the exact match belongs.
17
17
  *
18
18
  * What it does: holds the plaintext of every named vault secret (and the
19
- * vault key itself) in memory, and replaces exact occurrences in outgoing
20
- * message content with `[VAULT:name]` before anything is queued. That is the
21
- * same token form the SDK's resolveSecrets understands, so a recalled memory
22
- * still reads coherently and can still be resolved by a client with the key.
19
+ * vault key itself) in memory, and replaces exact occurrences in captured
20
+ * message content with `[VAULT:name]`: when a message is queued, and again
21
+ * when it is sent. That is the same token form the SDK's resolveSecrets
22
+ * understands, so a recalled memory still reads coherently and can still be
23
+ * resolved by a client with the key.
24
+ *
25
+ * Why twice (engram#588): a message can be queued before the vault has been
26
+ * read. Everything the watcher's first scan finds at start is, and so is
27
+ * anything captured while a read fails or while a replaced key's first read
28
+ * is in flight. Queueing can't wait for the read (the watcher's offset
29
+ * bookkeeping needs it synchronous, engram#370), so sending does: the syncer
30
+ * sends nothing until ready(), and scrubs each batch again against the set
31
+ * held at that moment. A token holds no value, so the second pass changes
32
+ * nothing else.
33
+ *
34
+ * ready() is true once a read through the current client has completed, or
35
+ * has failed in a way waiting can't fix: the server's own refusal, such as a
36
+ * key without the read scope. A failure that may pass is retried within
37
+ * seconds (READ_RETRY_MS), and sends wait:
38
+ * - until a read goes through, when the server couldn't be reached — the
39
+ * sends couldn't have gone out either;
40
+ * - for at most MAX_SERVER_HOLD_MS while the server answers with errors
41
+ * (an attempt that can't reach it starts that count again). Then sends
42
+ * resume with the secrets already known, so a broken vault endpoint
43
+ * can't stop capture, and the interval keeps reading.
44
+ *
45
+ * A vault key that is there but can't be read (engram#677) — a file of
46
+ * mode 000, a folder in its place, a link to nothing, an empty file —
47
+ * leaves nothing to read the vault with, nor to scrub its secrets with. It
48
+ * used to count as no key, and every secret went out as it was. Now sends
49
+ * wait for as long as it lasts: no bound releases them, since nothing
50
+ * would make them safe to send. Captures keep queueing meanwhile. The key
51
+ * is read again on READ_RETRY_MS; once it reads, the vault is read through
52
+ * it, and sends wait for that read like any other. A key file gone by then
53
+ * holds them still: it is likely being put back, and sending in between
54
+ * would send what the key protects. A restart starts without a key.
55
+ *
56
+ * The key is read again before each send, and on the interval (engram#693).
57
+ * It used to be read only at start: a key saved while the daemon ran went
58
+ * unused until a restart, and the secrets of the vault it opens went out as
59
+ * they were meanwhile. Now a key saved, or put in place of another, is used
60
+ * from the next send on: the vault is read through it first, and sends wait
61
+ * for that read, as at a start with a key. A key it replaced is scrubbed
62
+ * still, as is each way a key may be written. A key file deleted while its
63
+ * key is in use leaves that key in use, with the secrets read through it: a
64
+ * restart starts without it, and `engram status` says so. A key file that
65
+ * can't be read any more holds sends, as at start: the key in it may not be
66
+ * the one in use.
67
+ *
68
+ * A vault key that reads, but decrypts none of the vault's secrets
69
+ * (engram#694) — another machine's, or a new one made after the key was
70
+ * lost — sent every secret as it was, and only the log said so. Now sends
71
+ * wait while it lasts, as for a key that can't be read: no bound releases
72
+ * them. A secret that decrypted before, through this account, and hasn't
73
+ * been saved again since, is scrubbed with the value read then: a key
74
+ * replaced while the daemon runs holds sends only once a secret it can't
75
+ * scrub is saved, or at a restart. The hold lifts once a complete read
76
+ * finds none it can't scrub: each decrypts, or was deleted, or saved
77
+ * again with this key. Saved again one at a time, the first that decrypts
78
+ * doesn't lift it: what waits would go with the others in it. Nor does a
79
+ * restart meanwhile: status.json says the daemon before held, and
80
+ * worker-main goes on holding (continueMismatchHold). While it holds, the
81
+ * vault is listed again on
82
+ * MISMATCH_RETRY_MS, and read in full when the list changes, and at least
83
+ * every MISMATCH_REREAD_MS. A key that decrypts some of the secrets but
84
+ * not others, with no hold before, doesn't hold; `engram status` says how
85
+ * many it can't scrub.
86
+ *
87
+ * A secret saved with `engram vault set` while the daemon runs
88
+ * (engram#701) used to go out as it was until the interval read the vault
89
+ * again, up to 10 minutes later. Now `engram vault set` and `engram vault
90
+ * delete` leave a notice in ~/.engram (vault-changed.ts), which is looked
91
+ * for before each send and on the interval. A new one makes the next send
92
+ * wait for a read of the vault begun after it, as the first send waits
93
+ * for the first read. A read already under way when it came may have
94
+ * listed the vault before the change, so it doesn't count, and another
95
+ * follows it. A secret saved anywhere else, such as on another machine,
96
+ * is read on the interval still.
23
97
  *
24
98
  * What it never does: write a value to disk, include one in a log line, or
25
99
  * send one anywhere. Values are refreshed from the vault on an interval and
@@ -28,11 +102,27 @@
28
102
  * only closes a leak inside the existing one.
29
103
  */
30
104
  export interface VaultLike {
105
+ /**
106
+ * `updatedAt`: when the secret was last saved, as the server says it. It
107
+ * tells a secret saved again from one that wasn't (engram#694).
108
+ */
31
109
  list(): Promise<Array<{
32
110
  name: string;
111
+ updatedAt?: string;
33
112
  }>>;
34
113
  get(name: string): Promise<string | null>;
35
114
  }
115
+ /**
116
+ * Where the key is read again (engram#677, engram#693). read(): the key,
117
+ * undefined when the file isn't there, and throws when it can't be read.
118
+ * vaultWith(): the vault, read with that key, of the account in use now;
119
+ * null when signed out. From then on, the key is the one the vault is read
120
+ * with, after an account switch too.
121
+ */
122
+ export interface VaultKeySource {
123
+ read(): Promise<string | undefined>;
124
+ vaultWith(key: string): VaultLike | null;
125
+ }
36
126
  export interface ScrubResult {
37
127
  text: string;
38
128
  /** Number of replacements made. Names only — never the values. */
@@ -43,32 +133,324 @@ export interface ScrubResult {
43
133
  }
44
134
  /** Values shorter than this are not scrubbed: too likely to be coincidence. */
45
135
  export declare const MIN_SCRUB_LENGTH = 4;
136
+ /** After a read that may pass: retry in 10s → 30s → 1min → 1min … */
137
+ export declare const READ_RETRY_MS: number[];
138
+ /** The longest sends wait while the server answers but the vault won't read. */
139
+ export declare const MAX_SERVER_HOLD_MS: number;
140
+ /**
141
+ * What a complete read found of the secrets the vault key doesn't decrypt
142
+ * (engram#694): how many, how many of those have no value known from
143
+ * before, so can't be scrubbed, and how many it does decrypt. Counts only,
144
+ * never a name. `held`: sends wait for them.
145
+ */
146
+ export interface Undecryptable {
147
+ secrets: number;
148
+ unscrubbed: number;
149
+ decrypted: number;
150
+ held: boolean;
151
+ }
152
+ /**
153
+ * While sends wait for secrets the key doesn't decrypt (engram#694): list
154
+ * the vault again in 10 s → 30 s → 1 min → 2 min → 5 min → 5 min …
155
+ */
156
+ export declare const MISMATCH_RETRY_MS: number[];
157
+ /** …and read each secret again at least this often, though the list is the same. */
158
+ export declare const MISMATCH_REREAD_MS: number;
159
+ /**
160
+ * While sends go, each secret is read again at least this often (engram#704).
161
+ * Between those reads, the interval lists the vault and reads no secret while
162
+ * the list is the same as at the last of them: a secret isn't saved again
163
+ * without its updatedAt changing. This covers what a list can't tell.
164
+ */
165
+ export declare const FULL_READ_MS: number;
166
+ /**
167
+ * A read of each secret stands for a list the same as its own only when
168
+ * that list had been found this long before it (engram#704). updatedAt is
169
+ * to the second: a secret saved twice within the second it was read lists
170
+ * the same after as before. Once a second has passed since the list was
171
+ * first found, a secret saved again lists another updatedAt. The margin is
172
+ * for the time a request takes, and the clock.
173
+ */
174
+ export declare const SAME_LIST_MS = 60000;
175
+ /**
176
+ * A vault read that failed here, not in the request: the value doesn't
177
+ * decrypt with this vault key (engram#694). `engram vault list --check`
178
+ * judges each secret as the daemon does.
179
+ */
180
+ export declare function decryptFailed(err: unknown): boolean;
181
+ /**
182
+ * The notice that the vault changed there now (engram#701), as a value
183
+ * that differs from the last for each new one; null when there is none.
184
+ */
185
+ export type VaultChanges = () => string | null;
46
186
  export declare class SecretScrubber {
47
- private readonly vault;
48
- private readonly vaultKey;
187
+ private vault;
49
188
  private readonly log;
189
+ private readonly report?;
50
190
  /** name → plaintext. The only place plaintext lives, and only in memory. */
51
191
  private values;
52
192
  private timer;
53
- constructor(vault: VaultLike | null, vaultKey: string | undefined, log?: (msg: string) => void);
193
+ private stopped;
194
+ /** The read in flight, and the client it goes through. */
195
+ private reading;
196
+ /**
197
+ * The client the set was read through in full, or that can't read the
198
+ * vault at all. Compared by identity: a replaced client isn't ready until
199
+ * a read through it settles.
200
+ */
201
+ private settledFor;
202
+ /**
203
+ * The list that, found again by a re-read, stands for the value of each
204
+ * secret the read that settled read, and when that read was (engram#704).
205
+ * Set with settledFor, so a read through another client never finds it.
206
+ * Undefined: each secret is read next time.
207
+ */
208
+ private settledPrint;
209
+ private settledAt;
210
+ /**
211
+ * The list the reads through the current client have found each time
212
+ * since it first did, and when that was: after the list that first found
213
+ * it came back (engram#704).
214
+ */
215
+ private seenPrint;
216
+ private seenAt;
217
+ /** Why the last read through the current client fell short. */
218
+ private lastFailure;
219
+ private retryAt;
220
+ private retryStep;
221
+ /** Since when reads have failed with an answer from the server; 0 if not. */
222
+ private serverFailingSince;
223
+ /** The hold outlasted MAX_SERVER_HOLD_MS: sends go with what's known. */
224
+ private released;
225
+ private refusalLogged;
226
+ /** How many secrets don't decrypt with the key, as last said. */
227
+ private undecryptable;
228
+ /** Of those, how many have no value known from before, as last said. */
229
+ private unscrubbed;
230
+ /**
231
+ * Sends wait for secrets the key doesn't decrypt, with no value known
232
+ * from before (engram#694): from a complete read that found it decrypts
233
+ * none of the vault's secrets, or from the daemon before, until one finds
234
+ * none it can't scrub.
235
+ */
236
+ private mismatch;
237
+ /** The list it was found with. Undefined: read each secret next time. */
238
+ private mismatchPrint;
239
+ /** When each secret was last read while it holds. */
240
+ private fullReadAt;
241
+ /**
242
+ * The secrets whose value is known: name → when it was last saved, as
243
+ * listed when it decrypted through this account, with the key in use or
244
+ * one before it. Not saved again since, the value read then is its value.
245
+ */
246
+ private own;
247
+ /** The vault key in use, trimmed: the one the vault is read with. */
248
+ private vaultKey;
249
+ /**
250
+ * Each way the key in use, and each key before it, may be written
251
+ * (engram#693): scrubbed as "vault-key" along with the set. Only in
252
+ * memory, like the set, and dropped on stop.
253
+ */
254
+ private keyForms;
255
+ /** Where the key is read again: before each send, and on the interval. */
256
+ private readonly keySource;
257
+ /** Why the vault key can't be read, while sends wait for it (engram#677). */
258
+ private keyProblem;
259
+ private keyRetryAt;
260
+ private keyRetryStep;
261
+ /** The read of the key in flight. */
262
+ private keyRead;
263
+ /** The key file went while its key was in use: said once (engram#693). */
264
+ private keyGone;
265
+ /** Where to look for notices that the vault changed (engram#701). */
266
+ private changes;
267
+ /** The notice last seen. */
268
+ private changeSeen;
269
+ /** How many new notices have been seen. */
270
+ private changeCount;
271
+ /** Told of each new notice (engram#698). */
272
+ private onChange;
273
+ /**
274
+ * `key.source`: where the key is read again, before each send and on the
275
+ * interval (engram#693). Without one, `vaultKey` is the key for as long
276
+ * as the scrubber runs. `key.problem`: the key couldn't be read at start,
277
+ * so sends wait until it can be (engram#677); `vault` is null then, and
278
+ * `vaultKey` undefined. `report`: told what each complete read finds of
279
+ * secrets the key doesn't decrypt, and nothing on a new client
280
+ * (engram#694).
281
+ */
282
+ constructor(vault: VaultLike | null, vaultKey: string | undefined, log?: (msg: string) => void, key?: {
283
+ source: VaultKeySource;
284
+ problem?: unknown;
285
+ }, report?: ((found: Undecryptable) => void) | undefined);
54
286
  /** True when there is anything to scrub against. */
55
287
  get active(): boolean;
56
288
  /** Names currently loaded. Safe to log. */
57
289
  get names(): string[];
58
290
  /**
59
- * Load every secret's plaintext. Failures are non-fatal: the previous set
60
- * stays in force, so a transient network error can never turn scrubbing
61
- * off silently in the middle of a session.
291
+ * Why sends wait, while ready() is false: a VaultKeyUnreadable while the
292
+ * key can't be read, a VaultKeyMismatch while they wait for secrets it
293
+ * doesn't decrypt (engram#694), else why the vault couldn't be read
294
+ * through the current client.
295
+ */
296
+ get failure(): unknown;
297
+ /**
298
+ * Read every secret's plaintext. A call while a read through the same
299
+ * client is in flight joins it. Failures are non-fatal and never shrink
300
+ * the set: a secret that can't be read keeps the value already known for
301
+ * it, so a transient error can never turn scrubbing off silently in the
302
+ * middle of a session.
62
303
  */
63
304
  refresh(): Promise<void>;
64
- /** Refresh now and on an interval. */
305
+ /**
306
+ * Whether captured messages may be sent now (engram#588). True once the
307
+ * set covers the vault, or the vault can't be read with this key at all,
308
+ * or the server has failed the read for MAX_SERVER_HOLD_MS. Until then it
309
+ * waits for a read through the current client that is in flight, and
310
+ * retries a failed one when its retry is due — at the bound too, so the
311
+ * hold isn't released on an answer that's out of date.
312
+ *
313
+ * A set already read in full doesn't wait for the periodic re-read: that
314
+ * only refreshes it. A released hold doesn't retry either: the interval
315
+ * reads, and the flush loop doesn't add a read every few seconds.
316
+ *
317
+ * Before any of it, the key is read again (engram#693): one saved, or put
318
+ * in place of the one in use, since the last send is the one the vault is
319
+ * read with now, and ready() waits for that read. A key that can't be read
320
+ * (engram#677) is read again only when its retry is due, and until it
321
+ * reads, ready() is false, however long that takes.
322
+ *
323
+ * A key that decrypts none of the vault's secrets (engram#694) holds the
324
+ * same way: no bound releases it. The vault is listed again when its
325
+ * retry is due, on MISMATCH_RETRY_MS.
326
+ *
327
+ * First of all, a new notice that the vault changed (engram#701) means
328
+ * the set no longer covers it: ready() waits for a read begun after the
329
+ * notice, at once, and as for the first read.
330
+ */
331
+ ready(): Promise<boolean>;
332
+ /**
333
+ * Read the vault through a new client: the daemon's API key was replaced
334
+ * (engram#587), or it signed out. Reads at once, and ready() waits for
335
+ * that read. Until it settles, the current set stays in force, and a read
336
+ * that fails keeps it too. What was found of the key against the vault
337
+ * goes (engram#694): it may be another account's vault.
338
+ */
339
+ reconnect(vault: VaultLike | null): Promise<void>;
340
+ /**
341
+ * Read through `vault` from now on: a new client, or the vault read with
342
+ * a new key. Reads each secret, though the list is the same: a new key
343
+ * may decrypt what the last one didn't (engram#694).
344
+ */
345
+ private readThrough;
346
+ /**
347
+ * The daemon before this one held sends for secrets its vault key didn't
348
+ * decrypt (engram#694), and `found` is what its last complete read found.
349
+ * They wait still, as if this one had held them: no bound releases them,
350
+ * until a complete read finds none it can't scrub. One that finds a
351
+ * secret it can't scrub goes on holding, though the key decrypts others,
352
+ * as saving them again one at a time does. Call before start().
353
+ */
354
+ continueMismatchHold(found: {
355
+ secrets: number;
356
+ unscrubbed: number;
357
+ decrypted: number;
358
+ }): void;
359
+ /**
360
+ * Look for notices that the vault changed (engram#701), before each send
361
+ * and on the interval: `engram vault set` and `engram vault delete` leave
362
+ * one. The notice there now changes nothing: start() reads the vault
363
+ * anyway. Call before start(). `onChange`: told of each new notice, after
364
+ * the scrubber has taken it in (engram#698).
365
+ */
366
+ followChanges(changes: VaultChanges, onChange?: () => void): void;
367
+ /** The notice there now. A reader that throws finds none. */
368
+ private noticeNow;
369
+ /**
370
+ * A new notice that the vault changed (engram#701): the set may not cover
371
+ * the vault now. The next send waits for a read begun after it, which
372
+ * ready() starts at once. A hold released at the bound tries once more
373
+ * before it lets sends go, and one for secrets the key doesn't decrypt
374
+ * reads each secret, though the list is the same. A notice removed, or
375
+ * one that can't be read, changes nothing, nor does the same one read
376
+ * again after: each notice says something of its own.
377
+ */
378
+ private checkChanges;
379
+ /** Read now and on an interval: the key too, on the interval. */
65
380
  start(intervalMs?: number): void;
381
+ /** The interval's read: the key, then the vault (engram#693). */
382
+ private tick;
66
383
  stop(): void;
67
384
  /**
68
- * Replace every exact occurrence of a known secret with its token.
69
- * Longest values first, so a secret that contains another secret is
70
- * replaced whole rather than leaving a readable fragment behind.
385
+ * Replace every exact occurrence of a known secret with its token, and of
386
+ * each way a vault key in use, or used before, may be written. Longest
387
+ * values first, so a secret that contains another secret is replaced
388
+ * whole rather than leaving a readable fragment behind.
71
389
  */
72
390
  scrub(text: string): ScrubResult;
391
+ /**
392
+ * Scrub `key` from now on, each way it may be written, and the keys
393
+ * before it still (engram#693): a key quoted after it was replaced is no
394
+ * less a leak.
395
+ */
396
+ private useKey;
397
+ /** Read the key again: one read at a time. */
398
+ private checkKey;
399
+ /**
400
+ * The key, read again. The one in use, however written: nothing more to
401
+ * read, and a hold for it is lifted. The first, or another: scrub it from
402
+ * now on (and the one before it still), and read the vault with it, which
403
+ * sends wait for. It can't be read: hold sends, and try again on
404
+ * READ_RETRY_MS. It isn't there: while holding, still wait, for the key
405
+ * put back or a restart (engram#677); else go on with the key in use.
406
+ */
407
+ private readKey;
408
+ /**
409
+ * Sends wait for the key (engram#677): said when it starts, and again
410
+ * when why changes.
411
+ */
412
+ private holdForKey;
413
+ private liftKeyHold;
414
+ private settled;
415
+ /** Wait for reads through the current client, including one a reconnect
416
+ * starts meanwhile. */
417
+ private inFlight;
418
+ /**
419
+ * A read through `vault` fell short of the vault: not ready, and retry on
420
+ * READ_RETRY_MS. Only the server's answers count toward the bound — while
421
+ * it can't be reached, nothing can be sent anyway, and a set cut short by
422
+ * an outage mustn't go out the moment the network returns.
423
+ */
424
+ private fellShort;
425
+ /**
426
+ * The server has failed the read for MAX_SERVER_HOLD_MS, and sends don't
427
+ * wait for secrets the key doesn't decrypt (engram#694): sending then
428
+ * would send what can't be scrubbed.
429
+ */
430
+ private pastBound;
431
+ private read;
432
+ /**
433
+ * Sends wait for secrets the key doesn't decrypt, with no value known
434
+ * from before (engram#694): no bound releases them. Said when it starts,
435
+ * and again when the count changes, or the vault read with a new key
436
+ * finds the same. The vault is listed again on MISMATCH_RETRY_MS.
437
+ */
438
+ private holdForMismatch;
439
+ /** The next read while sends wait for secrets the key doesn't decrypt. */
440
+ private mismatchRetry;
441
+ /**
442
+ * A complete read finds none it can't scrub (engram#694): what waits goes.
443
+ * Those the key doesn't decrypt, if any, have a value known from before.
444
+ */
445
+ private liftMismatch;
446
+ /**
447
+ * Say what a complete read finds of the secrets the key doesn't decrypt,
448
+ * when that changes: those with no value known from before go out as
449
+ * they are; the rest are scrubbed with the value read before, until a
450
+ * restart (engram#694).
451
+ */
452
+ private sayUndecryptable;
453
+ /** Tell the daemon's status what a read found (engram#694). */
454
+ private tell;
73
455
  }
74
456
  //# sourceMappingURL=scrubber.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scrubber.d.ts","sourceRoot":"","sources":["../../src/daemon/scrubber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACzC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,qBAAa,cAAc;IAMvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPtB,4EAA4E;IAC5E,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,KAAK,CAA+B;gBAGzB,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,GAAG,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAe;IAGxD,oDAAoD;IACpD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,2CAA2C;IAC3C,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkC9B,sCAAsC;IACtC,KAAK,CAAC,UAAU,SAA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