@getrift/rift 0.1.0-beta.2 → 0.1.0-beta.21

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 (390) hide show
  1. package/README.md +35 -9
  2. package/dist/src/auth/keychain.d.ts +9 -0
  3. package/dist/src/auth/keychain.d.ts.map +1 -1
  4. package/dist/src/auth/keychain.js +37 -0
  5. package/dist/src/auth/keychain.js.map +1 -1
  6. package/dist/src/capture/auto-capture.d.ts +7 -0
  7. package/dist/src/capture/auto-capture.d.ts.map +1 -1
  8. package/dist/src/capture/auto-capture.js +82 -15
  9. package/dist/src/capture/auto-capture.js.map +1 -1
  10. package/dist/src/capture/auto-repair.d.ts +110 -0
  11. package/dist/src/capture/auto-repair.d.ts.map +1 -0
  12. package/dist/src/capture/auto-repair.js +269 -0
  13. package/dist/src/capture/auto-repair.js.map +1 -0
  14. package/dist/src/capture/codex-cli-triage-provider.d.ts.map +1 -1
  15. package/dist/src/capture/codex-cli-triage-provider.js +4 -3
  16. package/dist/src/capture/codex-cli-triage-provider.js.map +1 -1
  17. package/dist/src/capture/observability.d.ts +42 -0
  18. package/dist/src/capture/observability.d.ts.map +1 -1
  19. package/dist/src/capture/observability.js +45 -4
  20. package/dist/src/capture/observability.js.map +1 -1
  21. package/dist/src/capture/recover-quarantine.d.ts +260 -0
  22. package/dist/src/capture/recover-quarantine.d.ts.map +1 -0
  23. package/dist/src/capture/recover-quarantine.js +522 -0
  24. package/dist/src/capture/recover-quarantine.js.map +1 -0
  25. package/dist/src/cli/commands/backfill.d.ts.map +1 -1
  26. package/dist/src/cli/commands/backfill.js +5 -2
  27. package/dist/src/cli/commands/backfill.js.map +1 -1
  28. package/dist/src/cli/commands/capture-recover.d.ts +40 -0
  29. package/dist/src/cli/commands/capture-recover.d.ts.map +1 -0
  30. package/dist/src/cli/commands/capture-recover.js +184 -0
  31. package/dist/src/cli/commands/capture-recover.js.map +1 -0
  32. package/dist/src/cli/commands/capture.d.ts.map +1 -1
  33. package/dist/src/cli/commands/capture.js +96 -5
  34. package/dist/src/cli/commands/capture.js.map +1 -1
  35. package/dist/src/cli/commands/doctor.d.ts +6 -0
  36. package/dist/src/cli/commands/doctor.d.ts.map +1 -0
  37. package/dist/src/cli/commands/doctor.js +242 -0
  38. package/dist/src/cli/commands/doctor.js.map +1 -0
  39. package/dist/src/cli/commands/feedback.d.ts +12 -0
  40. package/dist/src/cli/commands/feedback.d.ts.map +1 -1
  41. package/dist/src/cli/commands/feedback.js +93 -4
  42. package/dist/src/cli/commands/feedback.js.map +1 -1
  43. package/dist/src/cli/commands/mcp-install.js +5 -2
  44. package/dist/src/cli/commands/mcp-install.js.map +1 -1
  45. package/dist/src/cli/commands/menubar.d.ts +80 -0
  46. package/dist/src/cli/commands/menubar.d.ts.map +1 -0
  47. package/dist/src/cli/commands/menubar.js +388 -0
  48. package/dist/src/cli/commands/menubar.js.map +1 -0
  49. package/dist/src/cli/commands/onboard.d.ts +143 -5
  50. package/dist/src/cli/commands/onboard.d.ts.map +1 -1
  51. package/dist/src/cli/commands/onboard.js +844 -188
  52. package/dist/src/cli/commands/onboard.js.map +1 -1
  53. package/dist/src/cli/commands/rebuild.d.ts.map +1 -1
  54. package/dist/src/cli/commands/rebuild.js +6 -3
  55. package/dist/src/cli/commands/rebuild.js.map +1 -1
  56. package/dist/src/cli/commands/reconcile.d.ts.map +1 -1
  57. package/dist/src/cli/commands/reconcile.js +12 -0
  58. package/dist/src/cli/commands/reconcile.js.map +1 -1
  59. package/dist/src/cli/commands/review.d.ts.map +1 -1
  60. package/dist/src/cli/commands/review.js +22 -7
  61. package/dist/src/cli/commands/review.js.map +1 -1
  62. package/dist/src/cli/commands/search.d.ts +2 -0
  63. package/dist/src/cli/commands/search.d.ts.map +1 -1
  64. package/dist/src/cli/commands/search.js +34 -4
  65. package/dist/src/cli/commands/search.js.map +1 -1
  66. package/dist/src/cli/commands/status.d.ts +9 -7
  67. package/dist/src/cli/commands/status.d.ts.map +1 -1
  68. package/dist/src/cli/commands/status.js +117 -12
  69. package/dist/src/cli/commands/status.js.map +1 -1
  70. package/dist/src/cli/commands/token-issue.d.ts.map +1 -1
  71. package/dist/src/cli/commands/token-issue.js +9 -1
  72. package/dist/src/cli/commands/token-issue.js.map +1 -1
  73. package/dist/src/cli/commands/triage.d.ts.map +1 -1
  74. package/dist/src/cli/commands/triage.js +7 -5
  75. package/dist/src/cli/commands/triage.js.map +1 -1
  76. package/dist/src/cli/commands/update.d.ts +80 -0
  77. package/dist/src/cli/commands/update.d.ts.map +1 -0
  78. package/dist/src/cli/commands/update.js +390 -0
  79. package/dist/src/cli/commands/update.js.map +1 -0
  80. package/dist/src/cli/default-config-path.d.ts +15 -0
  81. package/dist/src/cli/default-config-path.d.ts.map +1 -0
  82. package/dist/src/cli/default-config-path.js +27 -0
  83. package/dist/src/cli/default-config-path.js.map +1 -0
  84. package/dist/src/cli/feedback/feedback-config.d.ts +46 -0
  85. package/dist/src/cli/feedback/feedback-config.d.ts.map +1 -1
  86. package/dist/src/cli/feedback/feedback-config.js +130 -4
  87. package/dist/src/cli/feedback/feedback-config.js.map +1 -1
  88. package/dist/src/cli/feedback/feedback-history.d.ts +7 -0
  89. package/dist/src/cli/feedback/feedback-history.d.ts.map +1 -1
  90. package/dist/src/cli/feedback/feedback-history.js +39 -9
  91. package/dist/src/cli/feedback/feedback-history.js.map +1 -1
  92. package/dist/src/cli/feedback/feedback-payload.d.ts +22 -1
  93. package/dist/src/cli/feedback/feedback-payload.d.ts.map +1 -1
  94. package/dist/src/cli/feedback/feedback-payload.js.map +1 -1
  95. package/dist/src/cli/feedback/feedback-relay.d.ts +2 -2
  96. package/dist/src/cli/feedback/feedback-relay.d.ts.map +1 -1
  97. package/dist/src/cli/feedback/feedback-relay.js.map +1 -1
  98. package/dist/src/cli/feedback/invite.d.ts +17 -0
  99. package/dist/src/cli/feedback/invite.d.ts.map +1 -0
  100. package/dist/src/cli/feedback/invite.js +67 -0
  101. package/dist/src/cli/feedback/invite.js.map +1 -0
  102. package/dist/src/cli/feedback/relay-secret-store.d.ts +32 -0
  103. package/dist/src/cli/feedback/relay-secret-store.d.ts.map +1 -0
  104. package/dist/src/cli/feedback/relay-secret-store.js +137 -0
  105. package/dist/src/cli/feedback/relay-secret-store.js.map +1 -0
  106. package/dist/src/cli/http-client.d.ts +93 -1
  107. package/dist/src/cli/http-client.d.ts.map +1 -1
  108. package/dist/src/cli/http-client.js +254 -6
  109. package/dist/src/cli/http-client.js.map +1 -1
  110. package/dist/src/cli/index.d.ts.map +1 -1
  111. package/dist/src/cli/index.js +29 -6
  112. package/dist/src/cli/index.js.map +1 -1
  113. package/dist/src/cli/postinstall-menubar.d.ts +22 -0
  114. package/dist/src/cli/postinstall-menubar.d.ts.map +1 -0
  115. package/dist/src/cli/postinstall-menubar.js +53 -0
  116. package/dist/src/cli/postinstall-menubar.js.map +1 -0
  117. package/dist/src/cli/status/friend-header.d.ts +16 -1
  118. package/dist/src/cli/status/friend-header.d.ts.map +1 -1
  119. package/dist/src/cli/status/friend-header.js +354 -26
  120. package/dist/src/cli/status/friend-header.js.map +1 -1
  121. package/dist/src/cli/status/local-signals.d.ts +18 -0
  122. package/dist/src/cli/status/local-signals.d.ts.map +1 -1
  123. package/dist/src/cli/status/local-signals.js +29 -0
  124. package/dist/src/cli/status/local-signals.js.map +1 -1
  125. package/dist/src/cli/ui.d.ts +47 -0
  126. package/dist/src/cli/ui.d.ts.map +1 -0
  127. package/dist/src/cli/ui.js +166 -0
  128. package/dist/src/cli/ui.js.map +1 -0
  129. package/dist/src/config/schema.d.ts +79 -0
  130. package/dist/src/config/schema.d.ts.map +1 -1
  131. package/dist/src/config/schema.js +44 -0
  132. package/dist/src/config/schema.js.map +1 -1
  133. package/dist/src/diagnostics/codex-preflight.d.ts +33 -0
  134. package/dist/src/diagnostics/codex-preflight.d.ts.map +1 -0
  135. package/dist/src/diagnostics/codex-preflight.js +75 -0
  136. package/dist/src/diagnostics/codex-preflight.js.map +1 -0
  137. package/dist/src/diagnostics/doctor.d.ts +114 -0
  138. package/dist/src/diagnostics/doctor.d.ts.map +1 -0
  139. package/dist/src/diagnostics/doctor.js +352 -0
  140. package/dist/src/diagnostics/doctor.js.map +1 -0
  141. package/dist/src/diagnostics/notify.d.ts +90 -0
  142. package/dist/src/diagnostics/notify.d.ts.map +1 -0
  143. package/dist/src/diagnostics/notify.js +177 -0
  144. package/dist/src/diagnostics/notify.js.map +1 -0
  145. package/dist/src/diagnostics/repair-prompt.d.ts +49 -0
  146. package/dist/src/diagnostics/repair-prompt.d.ts.map +1 -0
  147. package/dist/src/diagnostics/repair-prompt.js +223 -0
  148. package/dist/src/diagnostics/repair-prompt.js.map +1 -0
  149. package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts +2 -0
  150. package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts.map +1 -0
  151. package/dist/src/ingestion/inbox-core/conversation-fingerprint.js +27 -0
  152. package/dist/src/ingestion/inbox-core/conversation-fingerprint.js.map +1 -0
  153. package/dist/src/ingestion/inbox-core/conversation-key.d.ts +2 -0
  154. package/dist/src/ingestion/inbox-core/conversation-key.d.ts.map +1 -0
  155. package/dist/src/ingestion/inbox-core/conversation-key.js +31 -0
  156. package/dist/src/ingestion/inbox-core/conversation-key.js.map +1 -0
  157. package/dist/src/ingestion/inbox-core/extensions.d.ts +3 -0
  158. package/dist/src/ingestion/inbox-core/extensions.d.ts.map +1 -0
  159. package/dist/src/ingestion/inbox-core/extensions.js +16 -0
  160. package/dist/src/ingestion/inbox-core/extensions.js.map +1 -0
  161. package/dist/src/ingestion/inbox-core/idempotency.d.ts +2 -0
  162. package/dist/src/ingestion/inbox-core/idempotency.d.ts.map +1 -0
  163. package/dist/src/ingestion/inbox-core/idempotency.js +22 -0
  164. package/dist/src/ingestion/inbox-core/idempotency.js.map +1 -0
  165. package/dist/src/ingestion/inbox-core/index.d.ts +20 -0
  166. package/dist/src/ingestion/inbox-core/index.d.ts.map +1 -0
  167. package/dist/src/ingestion/inbox-core/index.js +20 -0
  168. package/dist/src/ingestion/inbox-core/index.js.map +1 -0
  169. package/dist/src/ingestion/inbox-core/source-detection.d.ts +2 -0
  170. package/dist/src/ingestion/inbox-core/source-detection.d.ts.map +1 -0
  171. package/dist/src/ingestion/inbox-core/source-detection.js +23 -0
  172. package/dist/src/ingestion/inbox-core/source-detection.js.map +1 -0
  173. package/dist/src/ingestion/inbox-core/source-sniffer.d.ts +11 -0
  174. package/dist/src/ingestion/inbox-core/source-sniffer.d.ts.map +1 -0
  175. package/dist/src/ingestion/inbox-core/source-sniffer.js +69 -0
  176. package/dist/src/ingestion/inbox-core/source-sniffer.js.map +1 -0
  177. package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts +70 -0
  178. package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts.map +1 -0
  179. package/dist/src/ingestion/inbox-core/zip-sniffer.js +161 -0
  180. package/dist/src/ingestion/inbox-core/zip-sniffer.js.map +1 -0
  181. package/dist/src/ingestion/inbox-watcher.d.ts.map +1 -1
  182. package/dist/src/ingestion/inbox-watcher.js +34 -50
  183. package/dist/src/ingestion/inbox-watcher.js.map +1 -1
  184. package/dist/src/ingestion/indexer.d.ts +7 -0
  185. package/dist/src/ingestion/indexer.d.ts.map +1 -1
  186. package/dist/src/ingestion/indexer.js +36 -2
  187. package/dist/src/ingestion/indexer.js.map +1 -1
  188. package/dist/src/ingestion/metadata-extraction.d.ts +8 -5
  189. package/dist/src/ingestion/metadata-extraction.d.ts.map +1 -1
  190. package/dist/src/ingestion/metadata-extraction.js +24 -5
  191. package/dist/src/ingestion/metadata-extraction.js.map +1 -1
  192. package/dist/src/ingestion/skip-quarantine.d.ts +10 -0
  193. package/dist/src/ingestion/skip-quarantine.d.ts.map +1 -0
  194. package/dist/src/ingestion/skip-quarantine.js +35 -0
  195. package/dist/src/ingestion/skip-quarantine.js.map +1 -0
  196. package/dist/src/jobs/handlers/compact.d.ts.map +1 -1
  197. package/dist/src/jobs/handlers/compact.js +30 -4
  198. package/dist/src/jobs/handlers/compact.js.map +1 -1
  199. package/dist/src/jobs/handlers/dedupe-conversations.d.ts +134 -0
  200. package/dist/src/jobs/handlers/dedupe-conversations.d.ts.map +1 -0
  201. package/dist/src/jobs/handlers/dedupe-conversations.js +371 -0
  202. package/dist/src/jobs/handlers/dedupe-conversations.js.map +1 -0
  203. package/dist/src/jobs/handlers/ingest.d.ts.map +1 -1
  204. package/dist/src/jobs/handlers/ingest.js +295 -41
  205. package/dist/src/jobs/handlers/ingest.js.map +1 -1
  206. package/dist/src/jobs/handlers/reconcile.d.ts +28 -0
  207. package/dist/src/jobs/handlers/reconcile.d.ts.map +1 -1
  208. package/dist/src/jobs/handlers/reconcile.js +145 -19
  209. package/dist/src/jobs/handlers/reconcile.js.map +1 -1
  210. package/dist/src/jobs/handlers/reindex.d.ts.map +1 -1
  211. package/dist/src/jobs/handlers/reindex.js +13 -2
  212. package/dist/src/jobs/handlers/reindex.js.map +1 -1
  213. package/dist/src/jobs/handlers/save.d.ts.map +1 -1
  214. package/dist/src/jobs/handlers/save.js +57 -3
  215. package/dist/src/jobs/handlers/save.js.map +1 -1
  216. package/dist/src/jobs/queue.d.ts +51 -1
  217. package/dist/src/jobs/queue.d.ts.map +1 -1
  218. package/dist/src/jobs/queue.js +466 -26
  219. package/dist/src/jobs/queue.js.map +1 -1
  220. package/dist/src/jobs/worker-entry.d.ts.map +1 -1
  221. package/dist/src/jobs/worker-entry.js +35 -7
  222. package/dist/src/jobs/worker-entry.js.map +1 -1
  223. package/dist/src/jobs/worker-process.d.ts +11 -0
  224. package/dist/src/jobs/worker-process.d.ts.map +1 -1
  225. package/dist/src/jobs/worker-process.js +37 -4
  226. package/dist/src/jobs/worker-process.js.map +1 -1
  227. package/dist/src/main.js +199 -46
  228. package/dist/src/main.js.map +1 -1
  229. package/dist/src/mcp/errors.d.ts.map +1 -1
  230. package/dist/src/mcp/errors.js +20 -1
  231. package/dist/src/mcp/errors.js.map +1 -1
  232. package/dist/src/mcp/server.d.ts.map +1 -1
  233. package/dist/src/mcp/server.js +43 -3
  234. package/dist/src/mcp/server.js.map +1 -1
  235. package/dist/src/mcp/tools/context-pack.d.ts.map +1 -1
  236. package/dist/src/mcp/tools/context-pack.js +164 -23
  237. package/dist/src/mcp/tools/context-pack.js.map +1 -1
  238. package/dist/src/mcp/tools/search.d.ts +6 -2
  239. package/dist/src/mcp/tools/search.d.ts.map +1 -1
  240. package/dist/src/mcp/tools/search.js +35 -4
  241. package/dist/src/mcp/tools/search.js.map +1 -1
  242. package/dist/src/observability/embedding-events.d.ts +52 -0
  243. package/dist/src/observability/embedding-events.d.ts.map +1 -0
  244. package/dist/src/observability/embedding-events.js +149 -0
  245. package/dist/src/observability/embedding-events.js.map +1 -0
  246. package/dist/src/observability/index-events.d.ts +70 -0
  247. package/dist/src/observability/index-events.d.ts.map +1 -0
  248. package/dist/src/observability/index-events.js +148 -0
  249. package/dist/src/observability/index-events.js.map +1 -0
  250. package/dist/src/observability/onboarding-metric.d.ts +131 -0
  251. package/dist/src/observability/onboarding-metric.d.ts.map +1 -0
  252. package/dist/src/observability/onboarding-metric.js +351 -0
  253. package/dist/src/observability/onboarding-metric.js.map +1 -0
  254. package/dist/src/observability/tool-usage-stats.d.ts +77 -4
  255. package/dist/src/observability/tool-usage-stats.d.ts.map +1 -1
  256. package/dist/src/observability/tool-usage-stats.js +112 -32
  257. package/dist/src/observability/tool-usage-stats.js.map +1 -1
  258. package/dist/src/observability/tool-usage.d.ts +100 -7
  259. package/dist/src/observability/tool-usage.d.ts.map +1 -1
  260. package/dist/src/observability/tool-usage.js +196 -33
  261. package/dist/src/observability/tool-usage.js.map +1 -1
  262. package/dist/src/observability/version-check.d.ts +71 -0
  263. package/dist/src/observability/version-check.d.ts.map +1 -0
  264. package/dist/src/observability/version-check.js +198 -0
  265. package/dist/src/observability/version-check.js.map +1 -0
  266. package/dist/src/providers/basic-metadata-extraction.d.ts +60 -0
  267. package/dist/src/providers/basic-metadata-extraction.d.ts.map +1 -0
  268. package/dist/src/providers/basic-metadata-extraction.js +114 -0
  269. package/dist/src/providers/basic-metadata-extraction.js.map +1 -0
  270. package/dist/src/providers/codex-cli-metadata-extraction.d.ts +1 -0
  271. package/dist/src/providers/codex-cli-metadata-extraction.d.ts.map +1 -1
  272. package/dist/src/providers/codex-cli-metadata-extraction.js +6 -2
  273. package/dist/src/providers/codex-cli-metadata-extraction.js.map +1 -1
  274. package/dist/src/providers/codex-cli-model.d.ts +61 -0
  275. package/dist/src/providers/codex-cli-model.d.ts.map +1 -0
  276. package/dist/src/providers/codex-cli-model.js +194 -0
  277. package/dist/src/providers/codex-cli-model.js.map +1 -0
  278. package/dist/src/providers/codex-cli-runner.d.ts +39 -0
  279. package/dist/src/providers/codex-cli-runner.d.ts.map +1 -1
  280. package/dist/src/providers/codex-cli-runner.js +234 -48
  281. package/dist/src/providers/codex-cli-runner.js.map +1 -1
  282. package/dist/src/providers/conversation-generation.d.ts.map +1 -1
  283. package/dist/src/providers/conversation-generation.js +43 -6
  284. package/dist/src/providers/conversation-generation.js.map +1 -1
  285. package/dist/src/providers/ollama-embed.d.ts +2 -1
  286. package/dist/src/providers/ollama-embed.d.ts.map +1 -1
  287. package/dist/src/providers/ollama-embed.js +1 -0
  288. package/dist/src/providers/ollama-embed.js.map +1 -1
  289. package/dist/src/providers/openai-metadata-extraction.d.ts +3 -3
  290. package/dist/src/providers/openai-metadata-extraction.d.ts.map +1 -1
  291. package/dist/src/providers/openai-metadata-extraction.js +18 -3
  292. package/dist/src/providers/openai-metadata-extraction.js.map +1 -1
  293. package/dist/src/providers/placeholder-embed.d.ts +56 -0
  294. package/dist/src/providers/placeholder-embed.d.ts.map +1 -0
  295. package/dist/src/providers/placeholder-embed.js +64 -0
  296. package/dist/src/providers/placeholder-embed.js.map +1 -0
  297. package/dist/src/providers/stub.d.ts +2 -0
  298. package/dist/src/providers/stub.d.ts.map +1 -1
  299. package/dist/src/providers/stub.js +2 -0
  300. package/dist/src/providers/stub.js.map +1 -1
  301. package/dist/src/providers/types.d.ts +11 -0
  302. package/dist/src/providers/types.d.ts.map +1 -1
  303. package/dist/src/providers/voyage.d.ts +2 -1
  304. package/dist/src/providers/voyage.d.ts.map +1 -1
  305. package/dist/src/providers/voyage.js +1 -0
  306. package/dist/src/providers/voyage.js.map +1 -1
  307. package/dist/src/retrieval/compact.d.ts +116 -2
  308. package/dist/src/retrieval/compact.d.ts.map +1 -1
  309. package/dist/src/retrieval/compact.js +158 -5
  310. package/dist/src/retrieval/compact.js.map +1 -1
  311. package/dist/src/retrieval/context-pack.d.ts +114 -0
  312. package/dist/src/retrieval/context-pack.d.ts.map +1 -1
  313. package/dist/src/retrieval/context-pack.js +292 -8
  314. package/dist/src/retrieval/context-pack.js.map +1 -1
  315. package/dist/src/retrieval/current-truth.d.ts +360 -0
  316. package/dist/src/retrieval/current-truth.d.ts.map +1 -0
  317. package/dist/src/retrieval/current-truth.js +766 -0
  318. package/dist/src/retrieval/current-truth.js.map +1 -0
  319. package/dist/src/retrieval/git-state.d.ts +53 -0
  320. package/dist/src/retrieval/git-state.d.ts.map +1 -0
  321. package/dist/src/retrieval/git-state.js +174 -0
  322. package/dist/src/retrieval/git-state.js.map +1 -0
  323. package/dist/src/retrieval/lexical.d.ts.map +1 -1
  324. package/dist/src/retrieval/lexical.js +19 -3
  325. package/dist/src/retrieval/lexical.js.map +1 -1
  326. package/dist/src/retrieval/locator-boost.d.ts +37 -0
  327. package/dist/src/retrieval/locator-boost.d.ts.map +1 -0
  328. package/dist/src/retrieval/locator-boost.js +129 -0
  329. package/dist/src/retrieval/locator-boost.js.map +1 -0
  330. package/dist/src/retrieval/report-demotion.d.ts +46 -0
  331. package/dist/src/retrieval/report-demotion.d.ts.map +1 -0
  332. package/dist/src/retrieval/report-demotion.js +169 -0
  333. package/dist/src/retrieval/report-demotion.js.map +1 -0
  334. package/dist/src/retrieval/vector.d.ts.map +1 -1
  335. package/dist/src/retrieval/vector.js +11 -2
  336. package/dist/src/retrieval/vector.js.map +1 -1
  337. package/dist/src/server/app.d.ts.map +1 -1
  338. package/dist/src/server/app.js +92 -11
  339. package/dist/src/server/app.js.map +1 -1
  340. package/dist/src/server/routes/compact.d.ts.map +1 -1
  341. package/dist/src/server/routes/compact.js +4 -1
  342. package/dist/src/server/routes/compact.js.map +1 -1
  343. package/dist/src/server/routes/context.d.ts +1 -1
  344. package/dist/src/server/routes/context.d.ts.map +1 -1
  345. package/dist/src/server/routes/context.js +2 -1
  346. package/dist/src/server/routes/context.js.map +1 -1
  347. package/dist/src/server/routes/conversations-search.d.ts.map +1 -1
  348. package/dist/src/server/routes/conversations-search.js +28 -3
  349. package/dist/src/server/routes/conversations-search.js.map +1 -1
  350. package/dist/src/server/routes/enqueue.d.ts +11 -0
  351. package/dist/src/server/routes/enqueue.d.ts.map +1 -0
  352. package/dist/src/server/routes/enqueue.js +17 -0
  353. package/dist/src/server/routes/enqueue.js.map +1 -0
  354. package/dist/src/server/routes/friend-status.d.ts +339 -3
  355. package/dist/src/server/routes/friend-status.d.ts.map +1 -1
  356. package/dist/src/server/routes/friend-status.js +447 -13
  357. package/dist/src/server/routes/friend-status.js.map +1 -1
  358. package/dist/src/server/routes/ingest.d.ts.map +1 -1
  359. package/dist/src/server/routes/ingest.js +5 -2
  360. package/dist/src/server/routes/ingest.js.map +1 -1
  361. package/dist/src/server/routes/mcp-usage.d.ts +5 -4
  362. package/dist/src/server/routes/mcp-usage.d.ts.map +1 -1
  363. package/dist/src/server/routes/mcp-usage.js.map +1 -1
  364. package/dist/src/server/routes/reconcile.d.ts.map +1 -1
  365. package/dist/src/server/routes/reconcile.js +20 -1
  366. package/dist/src/server/routes/reconcile.js.map +1 -1
  367. package/dist/src/server/routes/reindex.d.ts.map +1 -1
  368. package/dist/src/server/routes/reindex.js +4 -1
  369. package/dist/src/server/routes/reindex.js.map +1 -1
  370. package/dist/src/server/routes/save.d.ts.map +1 -1
  371. package/dist/src/server/routes/save.js +4 -1
  372. package/dist/src/server/routes/save.js.map +1 -1
  373. package/dist/src/server/routes/search.d.ts +1 -1
  374. package/dist/src/server/routes/search.d.ts.map +1 -1
  375. package/dist/src/server/routes/search.js +253 -29
  376. package/dist/src/server/routes/search.js.map +1 -1
  377. package/dist/src/server/routes/triage.d.ts.map +1 -1
  378. package/dist/src/server/routes/triage.js +4 -1
  379. package/dist/src/server/routes/triage.js.map +1 -1
  380. package/dist/src/storage/rebuild.d.ts +35 -1
  381. package/dist/src/storage/rebuild.d.ts.map +1 -1
  382. package/dist/src/storage/rebuild.js +288 -64
  383. package/dist/src/storage/rebuild.js.map +1 -1
  384. package/dist/src/storage/tables.d.ts +29 -0
  385. package/dist/src/storage/tables.d.ts.map +1 -1
  386. package/dist/src/storage/tables.js +32 -1
  387. package/dist/src/storage/tables.js.map +1 -1
  388. package/operator/swiftbar/render-menu.py +524 -0
  389. package/operator/swiftbar/rift.10s.sh +176 -0
  390. package/package.json +9 -3
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Pure diagnosis layer shared by `rift doctor`, the repair-prompt
3
+ * generator, and the daemon's failure notifier.
4
+ *
5
+ * It consumes exactly what `rift status` already consumes — the
6
+ * `/status/friend` payload plus the friend's local signals (Voyage key
7
+ * last-4, MCP-client install presence) — and folds them into a small,
8
+ * severity-ordered list of issues. Each issue carries plain-language
9
+ * copy and one next action, so every surface (CLI, prompt, notification)
10
+ * tells the same story.
11
+ *
12
+ * Issue ordering follows `decideNextLine` in `friend-header.ts` so the
13
+ * two surfaces tell the same story, with one deliberate policy on top:
14
+ * `primary` (the "do this first" action) is always the highest-SEVERITY
15
+ * issue — a `broken` failure outranks any `warning`, regardless of
16
+ * positional order. This is why `rift doctor` can lead with a broken
17
+ * capture failure where `rift status`'s flat, positional Next: line
18
+ * might surface a warning-level inbox rejection first. The lists never
19
+ * contradict each other; `doctor` simply elevates "what is actually
20
+ * broken" to the lead, which is its whole job.
21
+ *
22
+ * This module is intentionally side-effect free: no IO, no clock except
23
+ * the injected `now`, no daemon access. Callers fetch the payload and
24
+ * pass it in.
25
+ */
26
+ import type { FriendStatusPayload } from "../server/routes/friend-status.js";
27
+ /** Stable identifiers for each diagnosable condition. */
28
+ export type DoctorIssueKind = "daemon_unreachable" | "daemon_auth_failed" | "config_missing" | "voyage_key_missing" | "codex_auth_expired" | "codex_preflight_failed" | "voyage_embed_errors" | "index_write_errors" | "inbox_import_errors" | "capture_failed" | "capture_daemon_stale" | "mcp_not_installed" | "menu_bar_unavailable" | "capture_quarantined" | "capture_repairing" | "update_available";
29
+ /**
30
+ * `broken` blocks Rift from doing its job (no capture, no search, no
31
+ * memory). `warning` is degraded-but-working or user-side (a rejected
32
+ * import, a missing optional client, an available update).
33
+ */
34
+ export type DoctorSeverity = "broken" | "warning";
35
+ export interface DoctorIssue {
36
+ kind: DoctorIssueKind;
37
+ severity: DoctorSeverity;
38
+ /** One-line plain-language headline a friend can read. */
39
+ title: string;
40
+ /** Plain-language explanation of what is wrong and why it matters. */
41
+ detail: string;
42
+ /** Exactly one next action — a command or a concrete step. */
43
+ nextAction: string;
44
+ /**
45
+ * Stable identity of the *cause*, not just the subsystem. For most
46
+ * issues this is the kind, but error-bearing issues fold in the error
47
+ * class (e.g. `voyage_embed_errors:provider_400`) so the notifier can
48
+ * tell "same subsystem, new cause" apart from a still-unresolved
49
+ * repeat. Optional so hand-built issues fall back to `kind`.
50
+ */
51
+ fingerprint?: string;
52
+ /**
53
+ * True when a *running* daemon can observe this failure and is
54
+ * therefore allowed to raise a native notification about it. A fully
55
+ * dead daemon cannot observe anything, so `daemon_unreachable` is
56
+ * false here — that case needs the Slice D watchdog, not this path.
57
+ */
58
+ daemonObservable: boolean;
59
+ }
60
+ /** Local-only signals the friend's machine answers without the daemon. */
61
+ export interface DoctorLocalSignals {
62
+ voyageLast4: string | null;
63
+ mcpClients: Array<{
64
+ client: string;
65
+ installed: boolean;
66
+ }>;
67
+ /**
68
+ * SwiftBar presence — null when not applicable (non-macOS, or a caller that
69
+ * does not probe it, e.g. the daemon notifier). Only `{ installed: false }`
70
+ * raises the menu-bar advisory.
71
+ */
72
+ swiftBar?: {
73
+ installed: boolean;
74
+ } | null;
75
+ }
76
+ /**
77
+ * Why `/status/friend` could not be read. A null status is NOT always
78
+ * "the daemon is down" — the request can fail because there is no config,
79
+ * no token has been issued, or the daemon rejected our auth. Each needs a
80
+ * different next action, so the caller classifies the failure and the
81
+ * diagnosis turns it into the right issue. Defaults to `connection_refused`
82
+ * (the in-process daemon caller never passes null, so this only matters
83
+ * for the CLI).
84
+ */
85
+ export type DoctorUnreachableReason = "connection_refused" | "auth_failed" | "not_authenticated" | "config_missing" | "unknown";
86
+ export interface DoctorInput {
87
+ /** `/status/friend` payload, or null when it could not be read. */
88
+ status: FriendStatusPayload | null;
89
+ /**
90
+ * When `status` is null, why. Lets the diagnosis distinguish "daemon
91
+ * down" from "cannot authenticate to the daemon" from "no config yet".
92
+ */
93
+ unreachableReason?: DoctorUnreachableReason;
94
+ localSignals: DoctorLocalSignals;
95
+ /** Injected clock; defaults to Date.now() at the call site. */
96
+ now: number;
97
+ }
98
+ export interface DoctorReport {
99
+ /** True when no `broken` issue is present. Warnings do not flip this. */
100
+ healthy: boolean;
101
+ /**
102
+ * The single most important issue — the one whose `nextAction` a
103
+ * surface should lead with. Null only when there are no issues at all.
104
+ */
105
+ primary: DoctorIssue | null;
106
+ /** All detected issues, highest priority first. */
107
+ issues: DoctorIssue[];
108
+ }
109
+ /**
110
+ * Diagnose Rift health from the same inputs `rift status` uses. Pure:
111
+ * given identical inputs it always returns the same report.
112
+ */
113
+ export declare function diagnose(input: DoctorInput): DoctorReport;
114
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,yDAAyD;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BAAkB,CAAC;IACjC,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,mDAAmD;IACnD,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AA+GD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CA4RzD"}
@@ -0,0 +1,352 @@
1
+ /**
2
+ * True only when `iso` parses to a timestamp at/after the daemon's
3
+ * current start. Historical errors that predate the running process are
4
+ * not current and must not be reported as live failures — a healthy
5
+ * respawn should clear them. Mirrors `friend-header.isCurrentUptime`.
6
+ */
7
+ function isCurrentUptime(iso, daemonStartMs) {
8
+ if (!iso)
9
+ return false;
10
+ const ts = Date.parse(iso);
11
+ if (Number.isNaN(ts))
12
+ return false;
13
+ return ts >= daemonStartMs;
14
+ }
15
+ /**
16
+ * Translate internal error-class names into copy a friend can act on.
17
+ * Falls back to the raw class so a new/unknown value still surfaces.
18
+ * Kept in sync with `friend-header.humanizeErrorClass`.
19
+ */
20
+ /** Next action for a non-auth codex preflight failure, by class. */
21
+ function codexPreflightNextAction(cls) {
22
+ switch (cls) {
23
+ case "model":
24
+ return "Set codex_cli.model in your Rift config to a model your Codex plan supports, then: rift capture";
25
+ case "binary":
26
+ return "Codex CLI could not be launched — check it is installed and on PATH (e.g. brew upgrade codex, or reinstall), then: rift capture";
27
+ case "timeout":
28
+ case "backend":
29
+ return "Usually transient — re-run: rift capture (the daemon also retries on its next pass)";
30
+ default:
31
+ return "Re-run and watch the output: rift capture";
32
+ }
33
+ }
34
+ function humanizeErrorClass(reason) {
35
+ if (!reason)
36
+ return "unknown";
37
+ switch (reason) {
38
+ case "schema_mismatch":
39
+ return "index format changed by an update";
40
+ case "lock_conflict":
41
+ return "index busy (a concurrent write held the lock)";
42
+ case "provider_400":
43
+ return "Voyage rejected the request (often an invalid or revoked key)";
44
+ case "network":
45
+ return "a network error reaching Voyage";
46
+ default:
47
+ return reason;
48
+ }
49
+ }
50
+ /**
51
+ * Build the single issue for a null `/status/friend`, tailored to *why*
52
+ * the read failed so the next action actually fixes the problem.
53
+ */
54
+ function unreachableIssue(reason) {
55
+ switch (reason) {
56
+ case "config_missing":
57
+ return {
58
+ kind: "config_missing",
59
+ severity: "broken",
60
+ title: "Rift is not set up on this Mac yet",
61
+ detail: "Rift has no config file, so the command does not know how to " +
62
+ "reach the daemon. This usually means onboarding never finished.",
63
+ nextAction: "Set it up: rift onboard",
64
+ daemonObservable: false,
65
+ };
66
+ case "not_authenticated":
67
+ return {
68
+ kind: "daemon_auth_failed",
69
+ severity: "broken",
70
+ title: "Rift has no access token on this Mac",
71
+ detail: "The daemon may be running, but this command has no token to " +
72
+ "authenticate with it, so it cannot read Rift's status.",
73
+ nextAction: "Issue a token: rift token issue",
74
+ daemonObservable: false,
75
+ };
76
+ case "auth_failed":
77
+ return {
78
+ kind: "daemon_auth_failed",
79
+ severity: "broken",
80
+ title: "Rift's daemon rejected this command's token",
81
+ detail: "The daemon is reachable but refused the token (it may be stale " +
82
+ "or from a different install). This is an authentication problem, " +
83
+ "not a crashed daemon — restarting will not fix it.",
84
+ nextAction: "Re-issue a token: rift token issue",
85
+ daemonObservable: false,
86
+ };
87
+ case "connection_refused":
88
+ case "unknown":
89
+ default:
90
+ return {
91
+ kind: "daemon_unreachable",
92
+ severity: "broken",
93
+ title: "Rift's background engine is not responding",
94
+ detail: "The Rift daemon is the always-on process that captures sessions, " +
95
+ "keeps the search index fresh, and answers your AI tools. Right now " +
96
+ "nothing can reach it, so capture and memory are paused.",
97
+ nextAction: "Restart it: launchctl kickstart -k gui/$UID/com.getrift.daemon",
98
+ daemonObservable: false,
99
+ };
100
+ }
101
+ }
102
+ /**
103
+ * Diagnose Rift health from the same inputs `rift status` uses. Pure:
104
+ * given identical inputs it always returns the same report.
105
+ */
106
+ export function diagnose(input) {
107
+ const { status, localSignals, now } = input;
108
+ const issues = [];
109
+ // No payload is a root failure, but the *reason* changes the fix:
110
+ // a down daemon needs a restart, an auth failure needs a fresh token,
111
+ // and a missing config needs onboarding. Reporting all three as
112
+ // "restart the daemon" is exactly the misdirection Slice B removes.
113
+ // All are CLI-side diagnoses (the in-process daemon caller always has a
114
+ // payload), so none are daemon-observable — a dead/unauthable daemon
115
+ // cannot notify about itself; that is the Slice D watchdog's job.
116
+ if (!status) {
117
+ const issue = unreachableIssue(input.unreachableReason ?? "connection_refused");
118
+ return { healthy: false, primary: issue, issues: [issue] };
119
+ }
120
+ const daemonStartMs = now - status.daemon.uptime_seconds * 1000;
121
+ // 1. Voyage key missing — without it nothing can be embedded or
122
+ // searched. Highest-priority broken state.
123
+ if (!status.daemon.voyage_key_present) {
124
+ issues.push({
125
+ kind: "voyage_key_missing",
126
+ severity: "broken",
127
+ title: "Voyage search key is missing",
128
+ detail: "Rift uses a Voyage key to turn your text into searchable meaning. " +
129
+ "Without it, nothing new can be indexed and search will not work.",
130
+ nextAction: "Re-add the key: rift onboard --reconfigure-voyage",
131
+ daemonObservable: true,
132
+ });
133
+ }
134
+ // 2. Codex preflight failed — auto-capture triage runs through the
135
+ // locally-authenticated codex CLI. A failed preflight halts capture, but
136
+ // the CAUSE matters: only an actual auth signal warrants "run codex
137
+ // login". Everything else (a rejected model, a backend timeout, MCP
138
+ // noise) gets a neutral, honest message — never a false login nag.
139
+ if (status.codex.last_preflight_ok === false) {
140
+ if (status.codex.last_preflight_error_class === "auth") {
141
+ issues.push({
142
+ kind: "codex_auth_expired",
143
+ severity: "broken",
144
+ title: "Codex login has expired",
145
+ detail: "Rift reads your new Claude Code / Codex sessions through the codex " +
146
+ "CLI. Its login has expired, so automatic capture cannot run and new " +
147
+ "conversations are not being saved.",
148
+ nextAction: "Sign back in: codex login (then run: rift capture)",
149
+ daemonObservable: true,
150
+ });
151
+ }
152
+ else {
153
+ issues.push({
154
+ kind: "codex_preflight_failed",
155
+ severity: "broken",
156
+ fingerprint: `codex_preflight_failed:${status.codex.last_preflight_error_class ?? "unknown"}`,
157
+ title: "Codex capture probe is failing",
158
+ detail: `${status.codex.last_preflight_error_summary ?? "Codex preflight failed."} ` +
159
+ "Your codex login looks fine — this is not an auth problem. " +
160
+ "Automatic capture is paused until a probe succeeds; recent " +
161
+ "conversations are safe on disk and will be captured once it clears.",
162
+ nextAction: codexPreflightNextAction(status.codex.last_preflight_error_class ?? null),
163
+ daemonObservable: true,
164
+ });
165
+ }
166
+ }
167
+ // 3. Voyage embedding errors during this uptime — the key is present
168
+ // but Voyage is rejecting/dropping calls (often an invalid key or
169
+ // a network problem). Recency-gated so a prior process's error
170
+ // does not haunt a healthy respawn.
171
+ if (isCurrentUptime(status.voyage.last_error_at, daemonStartMs)) {
172
+ issues.push({
173
+ kind: "voyage_embed_errors",
174
+ severity: "broken",
175
+ fingerprint: `voyage_embed_errors:${status.voyage.last_error_reason ?? "unknown"}`,
176
+ title: "Search indexing is failing at the Voyage step",
177
+ detail: "Rift could not turn recent text into searchable meaning: " +
178
+ `${humanizeErrorClass(status.voyage.last_error_reason)}. New content ` +
179
+ "may not be findable until this clears.",
180
+ nextAction: "Inspect with rift status, then check the Voyage key with " +
181
+ "rift onboard --reconfigure-voyage if errors mention the key",
182
+ daemonObservable: true,
183
+ });
184
+ }
185
+ // 4. Index write errors during this uptime — text embedded fine, but
186
+ // the LanceDB write failed (schema mismatch, lock, IO). Distinct
187
+ // from Voyage: "embedded" does not imply "searchable".
188
+ if (isCurrentUptime(status.index.last_error_at, daemonStartMs)) {
189
+ issues.push({
190
+ kind: "index_write_errors",
191
+ severity: "broken",
192
+ fingerprint: `index_write_errors:${status.index.last_error_reason ?? "unknown"}`,
193
+ title: "Search index writes are failing",
194
+ detail: "Rift embedded recent text but could not write it to the search " +
195
+ `index: ${humanizeErrorClass(status.index.last_error_reason)}. ` +
196
+ "Recently captured items may not be searchable yet.",
197
+ nextAction: "Inspect with rift status, then try: rift reindex",
198
+ daemonObservable: true,
199
+ });
200
+ }
201
+ // 5. Capture run failed during this uptime — the auto-capture loop
202
+ // itself threw (distinct from a Codex preflight failure, which is
203
+ // reported above with a more specific action).
204
+ if (status.capture.last_errors > 0 &&
205
+ isCurrentUptime(status.capture.last_run_at, daemonStartMs)) {
206
+ issues.push({
207
+ kind: "capture_failed",
208
+ severity: "broken",
209
+ title: "The last capture run reported errors",
210
+ detail: "Rift's automatic capture ran but hit errors while saving sessions, " +
211
+ "so some recent conversations may not have been stored.",
212
+ nextAction: "Re-run it and watch the output: rift capture",
213
+ daemonObservable: true,
214
+ });
215
+ }
216
+ // 5b. Scheduled capture is failing, but a more recent manual `rift
217
+ // capture` succeeded. The honest middle state: capture works right
218
+ // now (so this is NOT broken), but the daemon's own loop is still
219
+ // failing and must not be laundered green by the manual success. It
220
+ // clears itself once the daemon records a healthy run. CLI-side
221
+ // reconciliation, so not daemon-observable — the daemon never sees
222
+ // the manual run, and its own failures already notify via
223
+ // capture_failed/codex_auth_expired while they are the newest row.
224
+ if (status.capture.last_daemon_failed === true &&
225
+ isCurrentUptime(status.capture.last_daemon_run_at ?? null, daemonStartMs) &&
226
+ status.capture.last_run_trigger != null &&
227
+ status.capture.last_run_trigger !== "daemon" &&
228
+ status.capture.last_run_ok === true &&
229
+ status.capture.last_errors === 0) {
230
+ issues.push({
231
+ kind: "capture_daemon_stale",
232
+ severity: "warning",
233
+ title: "Automatic capture last failed — recent capture is working",
234
+ detail: "Your most recent capture ran fine, but the daemon's last scheduled " +
235
+ "capture failed. Capture works right now; the automatic loop will " +
236
+ "re-check on its next scheduled run.",
237
+ // Capture is working, so the calm, friend-facing action is to do
238
+ // nothing: the next scheduled tick re-checks and clears this on its
239
+ // own. Deliberately NO `launchctl kickstart` here — that operator
240
+ // machinery is too scary for a recovery path where nothing is broken
241
+ // right now. (A friend-safe `rift daemon restart` is a future affordance.)
242
+ nextAction: "Nothing to do — the next automatic capture will re-check and clear " +
243
+ "this on its own.",
244
+ daemonObservable: false,
245
+ });
246
+ }
247
+ // 6. Inbox import errors — user-side: a dropped export was rejected
248
+ // (malformed JSON, corrupt zip, unsupported source). The fix is to
249
+ // re-drop a fresh export, not to repair the engine. Warning.
250
+ if (status.inbox &&
251
+ isCurrentUptime(status.inbox.last_error_at, daemonStartMs)) {
252
+ issues.push({
253
+ kind: "inbox_import_errors",
254
+ severity: "warning",
255
+ title: "A dropped import could not be read",
256
+ detail: "Rift tried to import a file from your inbox folder but could not " +
257
+ `read it (${status.inbox.last_error_reason ?? "unknown reason"}). ` +
258
+ "This is usually a corrupt or unsupported export, not a Rift fault.",
259
+ nextAction: "Re-export and drop a fresh archive under data/inbox/",
260
+ // User-side; the daemon observes it but the plan scopes
261
+ // notifications to engine failures, not rejected user input.
262
+ daemonObservable: false,
263
+ });
264
+ }
265
+ // 7. MCP not installed for one or more clients — degraded reach, not a
266
+ // broken engine. Warning.
267
+ const missing = localSignals.mcpClients
268
+ .filter((c) => !c.installed)
269
+ .map((c) => c.client);
270
+ if (missing.length > 0) {
271
+ issues.push({
272
+ kind: "mcp_not_installed",
273
+ severity: "warning",
274
+ title: `Rift is not connected to ${missing.join(", ")}`,
275
+ detail: "MCP is the connection that lets your AI tools ask Rift for memory. " +
276
+ `These tools are not wired up yet: ${missing.join(", ")}.`,
277
+ nextAction: `Connect one: rift mcp install --client=${missing[0]}`,
278
+ daemonObservable: false,
279
+ });
280
+ }
281
+ // 7b. SwiftBar missing — the menu plugin is installed but the app that
282
+ // draws it is not, so the Rift menu bar icon will never appear. Degraded
283
+ // surface, not a broken engine (capture/search/memory all work headless),
284
+ // so it is a warning. Only fires when we actually probed it on macOS and
285
+ // found it absent; null (non-macOS / unprobed) stays silent.
286
+ if (localSignals.swiftBar && localSignals.swiftBar.installed === false) {
287
+ issues.push({
288
+ kind: "menu_bar_unavailable",
289
+ severity: "warning",
290
+ title: "Rift's menu bar icon can't show — SwiftBar isn't installed",
291
+ detail: "Rift installed its menu plugin, but SwiftBar — the free app that " +
292
+ "draws the icon in your menu bar — is not present, so the icon will " +
293
+ "not appear. Rift still captures and searches in the background.",
294
+ nextAction: "Install SwiftBar from swiftbar.app (or brew install --cask swiftbar if " +
295
+ "you use Homebrew), then: rift menubar install",
296
+ daemonObservable: false,
297
+ });
298
+ }
299
+ // 8. Oversized sessions parked in quarantine — not in memory yet, but a
300
+ // graceful skip rather than an error, and one that now SELF-REPAIRS in
301
+ // the background. So the copy follows the repair state, not a bare count:
302
+ // - still within the retry budget → "Rift is saving these", no command;
303
+ // - retries exhausted → the honest manual fallback (and only then does
304
+ // the obscure repair command appear).
305
+ // Counts distinct sessions whose latest version is still un-recovered
306
+ // (state of the world), not the most recent run's quarantine count.
307
+ const parked = status.capture.oversized_parked ?? 0;
308
+ const repairFailed = status.capture.oversized_repair_failed ?? 0;
309
+ const repairing = status.capture.oversized_repairing ?? Math.max(parked - repairFailed, 0);
310
+ if (repairFailed > 0) {
311
+ issues.push({
312
+ kind: "capture_quarantined",
313
+ severity: "warning",
314
+ title: `${repairFailed} large Codex session${repairFailed === 1 ? "" : "s"} could not be saved automatically`,
315
+ detail: "Rift tried several times to save these large sessions in the " +
316
+ "background and could not. They are safe on disk, just not searchable " +
317
+ "yet — a manual run will summarize and save them.",
318
+ nextAction: "Save them now: rift doctor repair capture-large-sessions",
319
+ daemonObservable: false,
320
+ });
321
+ }
322
+ if (repairing > 0) {
323
+ issues.push({
324
+ kind: "capture_repairing",
325
+ severity: "warning",
326
+ title: `Rift is saving ${repairing} large Codex session${repairing === 1 ? "" : "s"} to memory`,
327
+ detail: "These sessions were too large to capture in one pass, so Rift is " +
328
+ "recovering them in the background. They are safe on disk and will " +
329
+ "become searchable once recovery finishes — no action needed.",
330
+ nextAction: "Nothing to do — Rift is saving these in the background and will keep retrying.",
331
+ daemonObservable: false,
332
+ });
333
+ }
334
+ // 9. Update available — informational nudge, lowest priority.
335
+ if (status.update.available && status.update.latest_beta) {
336
+ issues.push({
337
+ kind: "update_available",
338
+ severity: "warning",
339
+ title: `A newer Rift is available (${status.update.installed} → ${status.update.latest_beta})`,
340
+ detail: "A newer beta build is published.",
341
+ nextAction: "Update now: rift update",
342
+ daemonObservable: false,
343
+ });
344
+ }
345
+ const healthy = !issues.some((i) => i.severity === "broken");
346
+ // Lead with the most severe issue: the first `broken` if any, else the
347
+ // first issue. Broken issues are already pushed ahead of warnings, so
348
+ // this also keeps `primary` stable if the positional order ever shifts.
349
+ const primary = issues.find((i) => i.severity === "broken") ?? issues[0] ?? null;
350
+ return { healthy, primary, issues };
351
+ }
352
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/diagnostics/doctor.ts"],"names":[],"mappings":"AAqIA;;;;;GAKG;AACH,SAAS,eAAe,CAAC,GAAkB,EAAE,aAAqB;IAChE,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,EAAE,IAAI,aAAa,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,oEAAoE;AACpE,SAAS,wBAAwB,CAC/B,GAAoC;IAEpC,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,iGAAiG,CAAC;QAC3G,KAAK,QAAQ;YACX,OAAO,iIAAiI,CAAC;QAC3I,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,qFAAqF,CAAC;QAC/F;YACE,OAAO,2CAA2C,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAqB;IAC/C,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,iBAAiB;YACpB,OAAO,mCAAm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AuE;IACvE,sEAAsE;IACtE,wEAAwE;IACxE,MAAM,OAAO,GACX,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,90 @@
1
+ import type { DoctorIssue, DoctorIssueKind } from "./doctor.js";
2
+ /** Re-notify cadence for an issue that stays unresolved. */
3
+ export declare const RENOTIFY_INTERVAL_MS: number;
4
+ export interface NotificationPayload {
5
+ /** macOS notification title — always the same friend-facing banner. */
6
+ title: string;
7
+ /** One-line subtitle naming the failing subsystem. */
8
+ subtitle: string;
9
+ /** Body: the issue's next action, so the notification is actionable. */
10
+ message: string;
11
+ }
12
+ /** Per-subsystem dedup record. */
13
+ export interface NotifyRecord {
14
+ last_notified_at: string;
15
+ /**
16
+ * The cause fingerprint last notified for this kind (e.g.
17
+ * `voyage_embed_errors:provider_400`). When the live issue's
18
+ * fingerprint differs, the cause changed and the friend should be
19
+ * re-notified immediately — the repair action/risk is now different —
20
+ * rather than staying silent for the rest of the 24h window. Optional
21
+ * for backward compatibility with state written before fingerprinting.
22
+ */
23
+ fingerprint?: string;
24
+ }
25
+ /**
26
+ * Persisted dedup state. Presence of a kind means it is currently in a
27
+ * failing state and was last notified at `last_notified_at`. Absence
28
+ * means resolved-or-never — so the next occurrence notifies fresh.
29
+ */
30
+ export interface NotifyState {
31
+ active: Partial<Record<DoctorIssueKind, NotifyRecord>>;
32
+ }
33
+ export interface PlanNotificationsInput {
34
+ /** All diagnosed issues (the full report list, any severity). */
35
+ issues: DoctorIssue[];
36
+ /** Previously persisted dedup state. */
37
+ state: NotifyState;
38
+ now: number;
39
+ }
40
+ export interface PlanNotificationsResult {
41
+ /** Payloads to actually send this tick (already rate-limited). */
42
+ notifications: NotificationPayload[];
43
+ /** State to persist after sending. */
44
+ nextState: NotifyState;
45
+ }
46
+ /**
47
+ * Build the friend-facing notification for an issue. Pure. The title is
48
+ * intentionally constant ("Rift needs attention") so the friend learns
49
+ * to recognise it; the subtitle and body carry the specifics.
50
+ */
51
+ export declare function buildNotificationPayload(issue: DoctorIssue): NotificationPayload;
52
+ /**
53
+ * Decide which notifications to send this tick and what state to persist.
54
+ * Pure: no IO, no clock except the injected `now`.
55
+ *
56
+ * Only `daemonObservable` issues are eligible — the daemon must not
57
+ * notify about things it cannot itself observe (e.g. a dead daemon, or
58
+ * user-side rejected imports).
59
+ */
60
+ export declare function planNotifications(input: PlanNotificationsInput): PlanNotificationsResult;
61
+ /** Absolute path to the dedup-state file under the data dir. */
62
+ export declare function notifyStatePath(dataDir: string): string;
63
+ /** Read dedup state; returns empty state on any read/parse failure. */
64
+ export declare function readNotifyState(dataDir: string): NotifyState;
65
+ /** Persist dedup state best-effort; swallows IO errors. */
66
+ export declare function writeNotifyState(dataDir: string, state: NotifyState): void;
67
+ /**
68
+ * Send a single notification via macOS `osascript`. Best-effort and
69
+ * fire-and-forget — any failure (non-macOS, osascript missing, user has
70
+ * notifications disabled) is swallowed so capture is never affected.
71
+ *
72
+ * Strings are passed as argv to `execFile` (not interpolated into a
73
+ * shell), and AppleScript string literals are escaped, so notification
74
+ * text cannot inject shell or AppleScript.
75
+ */
76
+ export declare function sendNotification(payload: NotificationPayload, opts?: {
77
+ platform?: NodeJS.Platform;
78
+ }): void;
79
+ /** Escape a string into an AppleScript double-quoted literal. */
80
+ export declare function asAppleScriptString(value: string): string;
81
+ /**
82
+ * End-to-end daemon helper: given the diagnosed issues, send any due
83
+ * notifications and persist updated dedup state. Best-effort throughout
84
+ * — wired into the capture loop, so it must never throw.
85
+ */
86
+ export declare function notifyDaemonFailures(dataDir: string, issues: DoctorIssue[], opts?: {
87
+ now?: number;
88
+ platform?: NodeJS.Platform;
89
+ }): void;
90
+ //# sourceMappingURL=notify.d.ts.map
@@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