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

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 (386) 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 +30 -0
  46. package/dist/src/cli/commands/menubar.d.ts.map +1 -0
  47. package/dist/src/cli/commands/menubar.js +180 -0
  48. package/dist/src/cli/commands/menubar.js.map +1 -0
  49. package/dist/src/cli/commands/onboard.d.ts +129 -0
  50. package/dist/src/cli/commands/onboard.d.ts.map +1 -1
  51. package/dist/src/cli/commands/onboard.js +752 -171
  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 +113 -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 +378 -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 +39 -0
  116. package/dist/src/cli/postinstall-menubar.js.map +1 -0
  117. package/dist/src/cli/status/friend-header.d.ts +8 -1
  118. package/dist/src/cli/status/friend-header.d.ts.map +1 -1
  119. package/dist/src/cli/status/friend-header.js +334 -26
  120. package/dist/src/cli/status/friend-header.js.map +1 -1
  121. package/dist/src/cli/ui.d.ts +47 -0
  122. package/dist/src/cli/ui.d.ts.map +1 -0
  123. package/dist/src/cli/ui.js +166 -0
  124. package/dist/src/cli/ui.js.map +1 -0
  125. package/dist/src/config/schema.d.ts +79 -0
  126. package/dist/src/config/schema.d.ts.map +1 -1
  127. package/dist/src/config/schema.js +44 -0
  128. package/dist/src/config/schema.js.map +1 -1
  129. package/dist/src/diagnostics/codex-preflight.d.ts +33 -0
  130. package/dist/src/diagnostics/codex-preflight.d.ts.map +1 -0
  131. package/dist/src/diagnostics/codex-preflight.js +75 -0
  132. package/dist/src/diagnostics/codex-preflight.js.map +1 -0
  133. package/dist/src/diagnostics/doctor.d.ts +106 -0
  134. package/dist/src/diagnostics/doctor.d.ts.map +1 -0
  135. package/dist/src/diagnostics/doctor.js +334 -0
  136. package/dist/src/diagnostics/doctor.js.map +1 -0
  137. package/dist/src/diagnostics/notify.d.ts +90 -0
  138. package/dist/src/diagnostics/notify.d.ts.map +1 -0
  139. package/dist/src/diagnostics/notify.js +177 -0
  140. package/dist/src/diagnostics/notify.js.map +1 -0
  141. package/dist/src/diagnostics/repair-prompt.d.ts +49 -0
  142. package/dist/src/diagnostics/repair-prompt.d.ts.map +1 -0
  143. package/dist/src/diagnostics/repair-prompt.js +223 -0
  144. package/dist/src/diagnostics/repair-prompt.js.map +1 -0
  145. package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts +2 -0
  146. package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts.map +1 -0
  147. package/dist/src/ingestion/inbox-core/conversation-fingerprint.js +27 -0
  148. package/dist/src/ingestion/inbox-core/conversation-fingerprint.js.map +1 -0
  149. package/dist/src/ingestion/inbox-core/conversation-key.d.ts +2 -0
  150. package/dist/src/ingestion/inbox-core/conversation-key.d.ts.map +1 -0
  151. package/dist/src/ingestion/inbox-core/conversation-key.js +31 -0
  152. package/dist/src/ingestion/inbox-core/conversation-key.js.map +1 -0
  153. package/dist/src/ingestion/inbox-core/extensions.d.ts +3 -0
  154. package/dist/src/ingestion/inbox-core/extensions.d.ts.map +1 -0
  155. package/dist/src/ingestion/inbox-core/extensions.js +16 -0
  156. package/dist/src/ingestion/inbox-core/extensions.js.map +1 -0
  157. package/dist/src/ingestion/inbox-core/idempotency.d.ts +2 -0
  158. package/dist/src/ingestion/inbox-core/idempotency.d.ts.map +1 -0
  159. package/dist/src/ingestion/inbox-core/idempotency.js +22 -0
  160. package/dist/src/ingestion/inbox-core/idempotency.js.map +1 -0
  161. package/dist/src/ingestion/inbox-core/index.d.ts +20 -0
  162. package/dist/src/ingestion/inbox-core/index.d.ts.map +1 -0
  163. package/dist/src/ingestion/inbox-core/index.js +20 -0
  164. package/dist/src/ingestion/inbox-core/index.js.map +1 -0
  165. package/dist/src/ingestion/inbox-core/source-detection.d.ts +2 -0
  166. package/dist/src/ingestion/inbox-core/source-detection.d.ts.map +1 -0
  167. package/dist/src/ingestion/inbox-core/source-detection.js +23 -0
  168. package/dist/src/ingestion/inbox-core/source-detection.js.map +1 -0
  169. package/dist/src/ingestion/inbox-core/source-sniffer.d.ts +11 -0
  170. package/dist/src/ingestion/inbox-core/source-sniffer.d.ts.map +1 -0
  171. package/dist/src/ingestion/inbox-core/source-sniffer.js +69 -0
  172. package/dist/src/ingestion/inbox-core/source-sniffer.js.map +1 -0
  173. package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts +70 -0
  174. package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts.map +1 -0
  175. package/dist/src/ingestion/inbox-core/zip-sniffer.js +161 -0
  176. package/dist/src/ingestion/inbox-core/zip-sniffer.js.map +1 -0
  177. package/dist/src/ingestion/inbox-watcher.d.ts.map +1 -1
  178. package/dist/src/ingestion/inbox-watcher.js +34 -50
  179. package/dist/src/ingestion/inbox-watcher.js.map +1 -1
  180. package/dist/src/ingestion/indexer.d.ts +7 -0
  181. package/dist/src/ingestion/indexer.d.ts.map +1 -1
  182. package/dist/src/ingestion/indexer.js +36 -2
  183. package/dist/src/ingestion/indexer.js.map +1 -1
  184. package/dist/src/ingestion/metadata-extraction.d.ts +8 -5
  185. package/dist/src/ingestion/metadata-extraction.d.ts.map +1 -1
  186. package/dist/src/ingestion/metadata-extraction.js +24 -5
  187. package/dist/src/ingestion/metadata-extraction.js.map +1 -1
  188. package/dist/src/ingestion/skip-quarantine.d.ts +10 -0
  189. package/dist/src/ingestion/skip-quarantine.d.ts.map +1 -0
  190. package/dist/src/ingestion/skip-quarantine.js +35 -0
  191. package/dist/src/ingestion/skip-quarantine.js.map +1 -0
  192. package/dist/src/jobs/handlers/compact.d.ts.map +1 -1
  193. package/dist/src/jobs/handlers/compact.js +30 -4
  194. package/dist/src/jobs/handlers/compact.js.map +1 -1
  195. package/dist/src/jobs/handlers/dedupe-conversations.d.ts +134 -0
  196. package/dist/src/jobs/handlers/dedupe-conversations.d.ts.map +1 -0
  197. package/dist/src/jobs/handlers/dedupe-conversations.js +371 -0
  198. package/dist/src/jobs/handlers/dedupe-conversations.js.map +1 -0
  199. package/dist/src/jobs/handlers/ingest.d.ts.map +1 -1
  200. package/dist/src/jobs/handlers/ingest.js +295 -41
  201. package/dist/src/jobs/handlers/ingest.js.map +1 -1
  202. package/dist/src/jobs/handlers/reconcile.d.ts +28 -0
  203. package/dist/src/jobs/handlers/reconcile.d.ts.map +1 -1
  204. package/dist/src/jobs/handlers/reconcile.js +145 -19
  205. package/dist/src/jobs/handlers/reconcile.js.map +1 -1
  206. package/dist/src/jobs/handlers/reindex.d.ts.map +1 -1
  207. package/dist/src/jobs/handlers/reindex.js +13 -2
  208. package/dist/src/jobs/handlers/reindex.js.map +1 -1
  209. package/dist/src/jobs/handlers/save.d.ts.map +1 -1
  210. package/dist/src/jobs/handlers/save.js +57 -3
  211. package/dist/src/jobs/handlers/save.js.map +1 -1
  212. package/dist/src/jobs/queue.d.ts +51 -1
  213. package/dist/src/jobs/queue.d.ts.map +1 -1
  214. package/dist/src/jobs/queue.js +466 -26
  215. package/dist/src/jobs/queue.js.map +1 -1
  216. package/dist/src/jobs/worker-entry.d.ts.map +1 -1
  217. package/dist/src/jobs/worker-entry.js +35 -7
  218. package/dist/src/jobs/worker-entry.js.map +1 -1
  219. package/dist/src/jobs/worker-process.d.ts +11 -0
  220. package/dist/src/jobs/worker-process.d.ts.map +1 -1
  221. package/dist/src/jobs/worker-process.js +37 -4
  222. package/dist/src/jobs/worker-process.js.map +1 -1
  223. package/dist/src/main.js +199 -46
  224. package/dist/src/main.js.map +1 -1
  225. package/dist/src/mcp/errors.d.ts.map +1 -1
  226. package/dist/src/mcp/errors.js +20 -1
  227. package/dist/src/mcp/errors.js.map +1 -1
  228. package/dist/src/mcp/server.d.ts.map +1 -1
  229. package/dist/src/mcp/server.js +43 -3
  230. package/dist/src/mcp/server.js.map +1 -1
  231. package/dist/src/mcp/tools/context-pack.d.ts.map +1 -1
  232. package/dist/src/mcp/tools/context-pack.js +164 -23
  233. package/dist/src/mcp/tools/context-pack.js.map +1 -1
  234. package/dist/src/mcp/tools/search.d.ts +6 -2
  235. package/dist/src/mcp/tools/search.d.ts.map +1 -1
  236. package/dist/src/mcp/tools/search.js +35 -4
  237. package/dist/src/mcp/tools/search.js.map +1 -1
  238. package/dist/src/observability/embedding-events.d.ts +52 -0
  239. package/dist/src/observability/embedding-events.d.ts.map +1 -0
  240. package/dist/src/observability/embedding-events.js +149 -0
  241. package/dist/src/observability/embedding-events.js.map +1 -0
  242. package/dist/src/observability/index-events.d.ts +70 -0
  243. package/dist/src/observability/index-events.d.ts.map +1 -0
  244. package/dist/src/observability/index-events.js +148 -0
  245. package/dist/src/observability/index-events.js.map +1 -0
  246. package/dist/src/observability/onboarding-metric.d.ts +131 -0
  247. package/dist/src/observability/onboarding-metric.d.ts.map +1 -0
  248. package/dist/src/observability/onboarding-metric.js +351 -0
  249. package/dist/src/observability/onboarding-metric.js.map +1 -0
  250. package/dist/src/observability/tool-usage-stats.d.ts +77 -4
  251. package/dist/src/observability/tool-usage-stats.d.ts.map +1 -1
  252. package/dist/src/observability/tool-usage-stats.js +112 -32
  253. package/dist/src/observability/tool-usage-stats.js.map +1 -1
  254. package/dist/src/observability/tool-usage.d.ts +100 -7
  255. package/dist/src/observability/tool-usage.d.ts.map +1 -1
  256. package/dist/src/observability/tool-usage.js +196 -33
  257. package/dist/src/observability/tool-usage.js.map +1 -1
  258. package/dist/src/observability/version-check.d.ts +71 -0
  259. package/dist/src/observability/version-check.d.ts.map +1 -0
  260. package/dist/src/observability/version-check.js +198 -0
  261. package/dist/src/observability/version-check.js.map +1 -0
  262. package/dist/src/providers/basic-metadata-extraction.d.ts +60 -0
  263. package/dist/src/providers/basic-metadata-extraction.d.ts.map +1 -0
  264. package/dist/src/providers/basic-metadata-extraction.js +114 -0
  265. package/dist/src/providers/basic-metadata-extraction.js.map +1 -0
  266. package/dist/src/providers/codex-cli-metadata-extraction.d.ts +1 -0
  267. package/dist/src/providers/codex-cli-metadata-extraction.d.ts.map +1 -1
  268. package/dist/src/providers/codex-cli-metadata-extraction.js +6 -2
  269. package/dist/src/providers/codex-cli-metadata-extraction.js.map +1 -1
  270. package/dist/src/providers/codex-cli-model.d.ts +61 -0
  271. package/dist/src/providers/codex-cli-model.d.ts.map +1 -0
  272. package/dist/src/providers/codex-cli-model.js +194 -0
  273. package/dist/src/providers/codex-cli-model.js.map +1 -0
  274. package/dist/src/providers/codex-cli-runner.d.ts +39 -0
  275. package/dist/src/providers/codex-cli-runner.d.ts.map +1 -1
  276. package/dist/src/providers/codex-cli-runner.js +234 -48
  277. package/dist/src/providers/codex-cli-runner.js.map +1 -1
  278. package/dist/src/providers/conversation-generation.d.ts.map +1 -1
  279. package/dist/src/providers/conversation-generation.js +43 -6
  280. package/dist/src/providers/conversation-generation.js.map +1 -1
  281. package/dist/src/providers/ollama-embed.d.ts +2 -1
  282. package/dist/src/providers/ollama-embed.d.ts.map +1 -1
  283. package/dist/src/providers/ollama-embed.js +1 -0
  284. package/dist/src/providers/ollama-embed.js.map +1 -1
  285. package/dist/src/providers/openai-metadata-extraction.d.ts +3 -3
  286. package/dist/src/providers/openai-metadata-extraction.d.ts.map +1 -1
  287. package/dist/src/providers/openai-metadata-extraction.js +18 -3
  288. package/dist/src/providers/openai-metadata-extraction.js.map +1 -1
  289. package/dist/src/providers/placeholder-embed.d.ts +56 -0
  290. package/dist/src/providers/placeholder-embed.d.ts.map +1 -0
  291. package/dist/src/providers/placeholder-embed.js +64 -0
  292. package/dist/src/providers/placeholder-embed.js.map +1 -0
  293. package/dist/src/providers/stub.d.ts +2 -0
  294. package/dist/src/providers/stub.d.ts.map +1 -1
  295. package/dist/src/providers/stub.js +2 -0
  296. package/dist/src/providers/stub.js.map +1 -1
  297. package/dist/src/providers/types.d.ts +11 -0
  298. package/dist/src/providers/types.d.ts.map +1 -1
  299. package/dist/src/providers/voyage.d.ts +2 -1
  300. package/dist/src/providers/voyage.d.ts.map +1 -1
  301. package/dist/src/providers/voyage.js +1 -0
  302. package/dist/src/providers/voyage.js.map +1 -1
  303. package/dist/src/retrieval/compact.d.ts +116 -2
  304. package/dist/src/retrieval/compact.d.ts.map +1 -1
  305. package/dist/src/retrieval/compact.js +158 -5
  306. package/dist/src/retrieval/compact.js.map +1 -1
  307. package/dist/src/retrieval/context-pack.d.ts +114 -0
  308. package/dist/src/retrieval/context-pack.d.ts.map +1 -1
  309. package/dist/src/retrieval/context-pack.js +292 -8
  310. package/dist/src/retrieval/context-pack.js.map +1 -1
  311. package/dist/src/retrieval/current-truth.d.ts +360 -0
  312. package/dist/src/retrieval/current-truth.d.ts.map +1 -0
  313. package/dist/src/retrieval/current-truth.js +766 -0
  314. package/dist/src/retrieval/current-truth.js.map +1 -0
  315. package/dist/src/retrieval/git-state.d.ts +53 -0
  316. package/dist/src/retrieval/git-state.d.ts.map +1 -0
  317. package/dist/src/retrieval/git-state.js +174 -0
  318. package/dist/src/retrieval/git-state.js.map +1 -0
  319. package/dist/src/retrieval/lexical.d.ts.map +1 -1
  320. package/dist/src/retrieval/lexical.js +19 -3
  321. package/dist/src/retrieval/lexical.js.map +1 -1
  322. package/dist/src/retrieval/locator-boost.d.ts +37 -0
  323. package/dist/src/retrieval/locator-boost.d.ts.map +1 -0
  324. package/dist/src/retrieval/locator-boost.js +129 -0
  325. package/dist/src/retrieval/locator-boost.js.map +1 -0
  326. package/dist/src/retrieval/report-demotion.d.ts +46 -0
  327. package/dist/src/retrieval/report-demotion.d.ts.map +1 -0
  328. package/dist/src/retrieval/report-demotion.js +169 -0
  329. package/dist/src/retrieval/report-demotion.js.map +1 -0
  330. package/dist/src/retrieval/vector.d.ts.map +1 -1
  331. package/dist/src/retrieval/vector.js +11 -2
  332. package/dist/src/retrieval/vector.js.map +1 -1
  333. package/dist/src/server/app.d.ts.map +1 -1
  334. package/dist/src/server/app.js +92 -11
  335. package/dist/src/server/app.js.map +1 -1
  336. package/dist/src/server/routes/compact.d.ts.map +1 -1
  337. package/dist/src/server/routes/compact.js +4 -1
  338. package/dist/src/server/routes/compact.js.map +1 -1
  339. package/dist/src/server/routes/context.d.ts +1 -1
  340. package/dist/src/server/routes/context.d.ts.map +1 -1
  341. package/dist/src/server/routes/context.js +2 -1
  342. package/dist/src/server/routes/context.js.map +1 -1
  343. package/dist/src/server/routes/conversations-search.d.ts.map +1 -1
  344. package/dist/src/server/routes/conversations-search.js +28 -3
  345. package/dist/src/server/routes/conversations-search.js.map +1 -1
  346. package/dist/src/server/routes/enqueue.d.ts +11 -0
  347. package/dist/src/server/routes/enqueue.d.ts.map +1 -0
  348. package/dist/src/server/routes/enqueue.js +17 -0
  349. package/dist/src/server/routes/enqueue.js.map +1 -0
  350. package/dist/src/server/routes/friend-status.d.ts +339 -3
  351. package/dist/src/server/routes/friend-status.d.ts.map +1 -1
  352. package/dist/src/server/routes/friend-status.js +447 -13
  353. package/dist/src/server/routes/friend-status.js.map +1 -1
  354. package/dist/src/server/routes/ingest.d.ts.map +1 -1
  355. package/dist/src/server/routes/ingest.js +5 -2
  356. package/dist/src/server/routes/ingest.js.map +1 -1
  357. package/dist/src/server/routes/mcp-usage.d.ts +5 -4
  358. package/dist/src/server/routes/mcp-usage.d.ts.map +1 -1
  359. package/dist/src/server/routes/mcp-usage.js.map +1 -1
  360. package/dist/src/server/routes/reconcile.d.ts.map +1 -1
  361. package/dist/src/server/routes/reconcile.js +20 -1
  362. package/dist/src/server/routes/reconcile.js.map +1 -1
  363. package/dist/src/server/routes/reindex.d.ts.map +1 -1
  364. package/dist/src/server/routes/reindex.js +4 -1
  365. package/dist/src/server/routes/reindex.js.map +1 -1
  366. package/dist/src/server/routes/save.d.ts.map +1 -1
  367. package/dist/src/server/routes/save.js +4 -1
  368. package/dist/src/server/routes/save.js.map +1 -1
  369. package/dist/src/server/routes/search.d.ts +1 -1
  370. package/dist/src/server/routes/search.d.ts.map +1 -1
  371. package/dist/src/server/routes/search.js +253 -29
  372. package/dist/src/server/routes/search.js.map +1 -1
  373. package/dist/src/server/routes/triage.d.ts.map +1 -1
  374. package/dist/src/server/routes/triage.js +4 -1
  375. package/dist/src/server/routes/triage.js.map +1 -1
  376. package/dist/src/storage/rebuild.d.ts +35 -1
  377. package/dist/src/storage/rebuild.d.ts.map +1 -1
  378. package/dist/src/storage/rebuild.js +288 -64
  379. package/dist/src/storage/rebuild.js.map +1 -1
  380. package/dist/src/storage/tables.d.ts +29 -0
  381. package/dist/src/storage/tables.d.ts.map +1 -1
  382. package/dist/src/storage/tables.js +32 -1
  383. package/dist/src/storage/tables.js.map +1 -1
  384. package/operator/swiftbar/render-menu.py +524 -0
  385. package/operator/swiftbar/rift.10s.sh +176 -0
  386. package/package.json +9 -3
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Redacted repair-prompt generator for `rift doctor --copy-prompt`.
3
+ *
4
+ * The output is designed to be pasted straight into Claude or Codex and
5
+ * be safe to do so. It carries enough state to debug Rift but never
6
+ * leaks a secret, and it forbids destructive repair so an over-eager
7
+ * assistant cannot wipe the user's memory.
8
+ *
9
+ * Redaction contract (see the friend-onboarding status-surface plan):
10
+ * - Never include full Voyage keys, auth tokens, bearer tokens, or raw
11
+ * private conversation content.
12
+ * - Voyage keys appear only as a last-4 fingerprint, and only when one
13
+ * is known locally.
14
+ * - Local paths are allowed only when they help repair (data + log
15
+ * locations), because they are not secrets and the assistant needs
16
+ * them to inspect the right folder.
17
+ *
18
+ * Safety contract:
19
+ * - Tell the assistant to inspect before changing anything.
20
+ * - Prefer commands that inspect/repair over commands that reset.
21
+ * - Explicitly forbid destructive resets and
22
+ * `rift uninstall --purge-data`.
23
+ *
24
+ * This module is pure (no IO). Centralizing prompt generation here —
25
+ * rather than in the SwiftBar script or the CLI command — keeps
26
+ * redaction, status interpretation, and future issue classes in one
27
+ * place (Slice C's menu bar will call this same generator).
28
+ */
29
+ import type { FriendStatusPayload } from "../server/routes/friend-status.js";
30
+ import type { DoctorLocalSignals, DoctorReport } from "./doctor.js";
31
+ export type RepairTarget = "claude" | "codex";
32
+ export interface RepairPromptInput {
33
+ report: DoctorReport;
34
+ status: FriendStatusPayload | null;
35
+ localSignals: DoctorLocalSignals;
36
+ }
37
+ /**
38
+ * Commands the assistant must never run from this prompt. Kept as data
39
+ * so the test suite can assert every one is named in the rendered
40
+ * "Constraints" block.
41
+ */
42
+ export declare const FORBIDDEN_COMMANDS: readonly string[];
43
+ /**
44
+ * Build the repair prompt. `target` only changes which assistant the
45
+ * prompt addresses; the state and safety rules are identical so neither
46
+ * tool can be talked into something the other forbids.
47
+ */
48
+ export declare function buildRepairPrompt(input: RepairPromptInput, target: RepairTarget): string;
49
+ //# sourceMappingURL=repair-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-prompt.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/repair-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,kBAAkB,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,YAAY,GACnB,MAAM,CAsER"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Commands the assistant must never run from this prompt. Kept as data
3
+ * so the test suite can assert every one is named in the rendered
4
+ * "Constraints" block.
5
+ */
6
+ export const FORBIDDEN_COMMANDS = [
7
+ "rift uninstall --purge-data",
8
+ "rift rebuild --reset",
9
+ "rm -rf",
10
+ ];
11
+ /**
12
+ * Build the repair prompt. `target` only changes which assistant the
13
+ * prompt addresses; the state and safety rules are identical so neither
14
+ * tool can be talked into something the other forbids.
15
+ */
16
+ export function buildRepairPrompt(input, target) {
17
+ const { report, status, localSignals } = input;
18
+ const assistant = target === "claude" ? "Claude" : "Codex";
19
+ // Open with the right severity. "Rift is not healthy" is correct only
20
+ // when something is actually broken; a warning-only state (e.g. large
21
+ // sessions parked, an available update) must not tell the user their
22
+ // Rift is broken — that copy erodes trust on a working install.
23
+ const hasBroken = report.issues.some((i) => i.severity === "broken");
24
+ const onlyParked = !hasBroken &&
25
+ report.issues.some((i) => i.kind === "capture_quarantined" || i.kind === "capture_repairing");
26
+ const opener = hasBroken
27
+ ? `Rift is not healthy on this Mac. Please help me fix it, ${assistant}.`
28
+ : onlyParked
29
+ ? `Rift is working, but some large Codex sessions are not searchable yet. ` +
30
+ `Please help me recover them, ${assistant}.`
31
+ : `Rift is working, but a few things could use attention. ` +
32
+ `Please help me sort them out, ${assistant}.`;
33
+ const lines = [];
34
+ lines.push(opener);
35
+ lines.push("");
36
+ // --- Symptoms: the diagnosed issues, plain-language, no secrets. ---
37
+ lines.push("Symptoms:");
38
+ if (report.issues.length === 0) {
39
+ lines.push("- rift doctor found no specific broken signal, but I think something " +
40
+ "is off. Please investigate.");
41
+ }
42
+ else {
43
+ for (const issue of report.issues) {
44
+ lines.push(`- ${issue.title}. ${issue.detail}`);
45
+ }
46
+ }
47
+ lines.push("");
48
+ // --- State: redacted, debug-useful facts. ---
49
+ lines.push("Current state:");
50
+ for (const line of renderStateLines(report, status, localSignals)) {
51
+ lines.push(`- ${line}`);
52
+ }
53
+ lines.push("");
54
+ // --- Inspect-first checklist, ordered by the primary issue. ---
55
+ lines.push("Start by inspecting, in this order:");
56
+ let step = 1;
57
+ lines.push(`${step++}. \`rift status\` — confirm the current state for yourself.`);
58
+ lines.push(`${step++}. \`rift doctor\` — read the plain-language diagnosis.`);
59
+ for (const cmd of inspectionCommandsFor(report)) {
60
+ lines.push(`${step++}. ${cmd}`);
61
+ }
62
+ lines.push(`${step++}. Rift logs only if the above is not enough.`);
63
+ lines.push("");
64
+ // --- Hard constraints. ---
65
+ lines.push("Constraints:");
66
+ lines.push("- Explain the failure to me in plain English BEFORE changing anything.");
67
+ lines.push("- Inspect first; prefer commands that inspect and repair over commands that reset.");
68
+ lines.push("- Do not print or echo secrets (Voyage key, tokens).");
69
+ lines.push("- Do not delete or reset my Rift data.");
70
+ for (const forbidden of FORBIDDEN_COMMANDS) {
71
+ lines.push(`- Do not run \`${forbidden}\`.`);
72
+ }
73
+ lines.push("- If a fix is risky or irreversible, stop and ask me first.");
74
+ return lines.join("\n");
75
+ }
76
+ /**
77
+ * Render the redacted "Current state" facts. Every value here is either
78
+ * non-sensitive (versions, ports, booleans, ages) or already reduced to
79
+ * a safe fingerprint (Voyage last-4). Raw keys, tokens, and conversation
80
+ * content never reach this function.
81
+ */
82
+ function renderStateLines(report, status, localSignals) {
83
+ const out = [];
84
+ if (!status) {
85
+ // The reason /status/friend could not be read drives the state copy:
86
+ // "not responding" is only true for a genuinely down daemon, not for
87
+ // an auth/config failure where the daemon may be perfectly alive.
88
+ switch (report.primary?.kind) {
89
+ case "config_missing":
90
+ out.push("Rift config: missing (could not resolve the daemon URL).");
91
+ out.push("This Mac looks like onboarding never completed.");
92
+ break;
93
+ case "daemon_auth_failed":
94
+ out.push("Rift daemon: reachable, but this command could not authenticate " +
95
+ "to it (missing or rejected token). The daemon itself may be fine.");
96
+ break;
97
+ default:
98
+ out.push("Rift daemon: not responding (could not reach /status/friend).");
99
+ break;
100
+ }
101
+ out.push("Expected daemon label: com.getrift.daemon (managed by launchd on port 3577).");
102
+ out.push(voyageFingerprintLine(localSignals));
103
+ out.push(mcpLine(localSignals));
104
+ return out;
105
+ }
106
+ out.push(`Rift version: ${status.build.version} (node ${status.build.node}).`);
107
+ out.push(`Daemon: running on port ${status.daemon.port}, up ${formatSeconds(status.daemon.uptime_seconds)}.`);
108
+ // data_dir is a local path, not a secret, and the assistant needs it
109
+ // to inspect the right data root (a stale Application Support copy is
110
+ // a real false-alarm source).
111
+ out.push(`Data directory: ${status.daemon.data_dir}`);
112
+ out.push(`Voyage key present in daemon env: ${status.daemon.voyage_key_present ? "yes" : "no"}.`);
113
+ out.push(voyageFingerprintLine(localSignals));
114
+ if (status.voyage.last_embed_at) {
115
+ out.push(`Last successful embed: ${status.voyage.last_embed_at}.`);
116
+ }
117
+ if (status.voyage.last_error_at) {
118
+ out.push(`Last Voyage error: ${status.voyage.last_error_at} (${status.voyage.last_error_reason ?? "unknown"}).`);
119
+ }
120
+ if (status.index.last_update_at) {
121
+ out.push(`Last index write: ${status.index.last_update_at}.`);
122
+ }
123
+ if (status.index.last_error_at) {
124
+ out.push(`Last index error: ${status.index.last_error_at} (${status.index.last_error_reason ?? "unknown"}).`);
125
+ }
126
+ out.push(`Codex CLI auth: ${codexAuthLabel(status.codex.last_preflight_ok)}${status.codex.last_preflight_at
127
+ ? ` (last checked ${status.codex.last_preflight_at})`
128
+ : ""}.`);
129
+ if (status.capture.last_run_at) {
130
+ out.push(`Last capture run: ${status.capture.last_run_at} — ${status.capture.last_saved} saved, ` +
131
+ `${status.capture.last_review} for review, ${status.capture.last_errors} errors.`);
132
+ }
133
+ else {
134
+ out.push("Last capture run: none yet.");
135
+ }
136
+ out.push(mcpLine(localSignals));
137
+ return out;
138
+ }
139
+ function voyageFingerprintLine(localSignals) {
140
+ return localSignals.voyageLast4
141
+ ? `Voyage key fingerprint (last 4 only): …${localSignals.voyageLast4}.`
142
+ : "Voyage key fingerprint: not found locally.";
143
+ }
144
+ function mcpLine(localSignals) {
145
+ if (localSignals.mcpClients.length === 0) {
146
+ return "MCP clients: none detected.";
147
+ }
148
+ const parts = localSignals.mcpClients.map((c) => `${c.client}=${c.installed ? "connected" : "not connected"}`);
149
+ return `MCP clients: ${parts.join(", ")}.`;
150
+ }
151
+ function codexAuthLabel(ok) {
152
+ if (ok === null)
153
+ return "unknown (not checked yet)";
154
+ return ok ? "looks authenticated" : "appears expired";
155
+ }
156
+ /**
157
+ * Issue-specific inspection commands, deduped and ordered by the issues
158
+ * present. Inspection/repair only — nothing here resets state.
159
+ */
160
+ function inspectionCommandsFor(report) {
161
+ const cmds = [];
162
+ const seen = new Set();
163
+ const add = (cmd) => {
164
+ if (!seen.has(cmd)) {
165
+ seen.add(cmd);
166
+ cmds.push(cmd);
167
+ }
168
+ };
169
+ for (const issue of report.issues) {
170
+ switch (issue.kind) {
171
+ case "daemon_unreachable":
172
+ add("`launchctl print gui/$UID/com.getrift.daemon` — check the daemon is loaded and not crash-looping.");
173
+ break;
174
+ case "daemon_auth_failed":
175
+ add("`rift token issue` — re-issue an access token (the existing one is missing or rejected); do not restart the daemon for this.");
176
+ break;
177
+ case "config_missing":
178
+ add("`rift onboard` — finish setup; there is no config for this command to read yet.");
179
+ break;
180
+ case "codex_auth_expired":
181
+ add("`codex login` — re-authenticate the codex CLI, then `rift capture`.");
182
+ break;
183
+ case "codex_preflight_failed":
184
+ add("Codex capture probe failed (NOT an auth problem — do not re-run `codex login`). If it mentions a rejected model, set `codex_cli.model` in the Rift config to a supported model; otherwise it is usually a transient backend/timeout — re-run `rift capture`.");
185
+ break;
186
+ case "voyage_key_missing":
187
+ case "voyage_embed_errors":
188
+ add("`rift onboard --reconfigure-voyage` — re-check the Voyage key (it will not be printed).");
189
+ break;
190
+ case "index_write_errors":
191
+ add("`rift reindex` — only after confirming the cause; this rebuilds the index, it does not delete data.");
192
+ break;
193
+ case "capture_failed":
194
+ add("`rift capture` — re-run capture and read the per-session output.");
195
+ break;
196
+ case "capture_quarantined":
197
+ case "capture_repairing":
198
+ // Rift self-repairs these in the background, but a user who is
199
+ // explicitly assembling a repair prompt wants the manual escape hatch
200
+ // named — it is idempotent and non-destructive, so it is safe to run
201
+ // even while a background pass is in flight.
202
+ add("`rift doctor repair capture-large-sessions` — summarize and save the oversized sessions Rift had to skip; it reads them in safe chunks and does not delete or modify the originals.");
203
+ break;
204
+ default:
205
+ break;
206
+ }
207
+ }
208
+ return cmds;
209
+ }
210
+ function formatSeconds(seconds) {
211
+ if (seconds < 60)
212
+ return `${seconds}s`;
213
+ const minutes = Math.floor(seconds / 60);
214
+ if (minutes < 60)
215
+ return `${minutes}m`;
216
+ const hours = Math.floor(minutes / 60);
217
+ const remMin = minutes % 60;
218
+ if (hours < 24)
219
+ return remMin > 0 ? `${hours}h ${remMin}m` : `${hours}h`;
220
+ const days = Math.floor(hours / 24);
221
+ return `${days}d`;
222
+ }
223
+ //# sourceMappingURL=repair-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-prompt.js","sourceRoot":"","sources":["../../../src/diagnostics/repair-prompt.ts"],"names":[],"mappings":"AAuCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,6BAA6B;IAC7B,sBAAsB;IACtB,QAAQ;CACT,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAwB,EACxB,MAAoB;IAEpB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAE3D,sEAAsE;IACtE,sEAAsE;IACtE,qEAAqE;IACrE,gEAAgE;IAChE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACrE,MAAM,UAAU,GACd,CAAC,SAAS;QACV,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAqB,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAC1E,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AAG,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,GAAG,IAAI,GAAG,CAAC;AACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function conversationContentFingerprint(content: string): string;
2
+ //# sourceMappingURL=conversation-fingerprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-fingerprint.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-fingerprint.ts"],"names":[],"mappings":"AAwBA,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Canonical content fingerprint for a parsed conversation.
3
+ *
4
+ * Pure: takes the parser-emitted role-prefixed conversation text and
5
+ * returns a stable hex sha256. No filesystem, no clock, no random input.
6
+ *
7
+ * Why content-only:
8
+ * The fingerprint must change iff the conversation's substance changes.
9
+ * Title / createdAt are stable across re-exports of the same provider
10
+ * conversation, so they are not part of the input. Including them would
11
+ * produce false "grew" signals on metadata-only refreshes.
12
+ *
13
+ * Why role-prefixed text:
14
+ * Every parser already normalises its source format into the same
15
+ * `content` shape (`User: ...\n\nAssistant: ...`). That makes the
16
+ * fingerprint source-agnostic — two parsers producing identical
17
+ * content for the same conversation hash to the same value.
18
+ *
19
+ * Used by the ingest handler's refresh-on-grow logic: if a re-imported
20
+ * conversation has the same content as the version we already stored,
21
+ * skip it; if it has new messages appended, refresh the row.
22
+ */
23
+ import crypto from "node:crypto";
24
+ export function conversationContentFingerprint(content) {
25
+ return crypto.createHash("sha256").update(content, "utf8").digest("hex");
26
+ }
27
+ //# sourceMappingURL=conversation-fingerprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-fingerprint.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,8BAA8B,CAAC,OAAe;IAC5D,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function stableConversationRowId(source: string, conversationId: string): string;
2
+ //# sourceMappingURL=conversation-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-key.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-key.ts"],"names":[],"mappings":"AAwBA,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GACrB,MAAM,CAMR"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Stable row id for an indexed conversation.
3
+ *
4
+ * Pure: takes the source provider name and the provider's own
5
+ * conversation id, returns a deterministic row id. No filesystem,
6
+ * no clock, no random input.
7
+ *
8
+ * The key is `sha256("${source}:${conversationId}").slice(0, 32)` so:
9
+ * - re-imports of the same conversation (e.g. monthly full-export
10
+ * from ChatGPT/Claude/Grok/Gemini that re-includes everything
11
+ * the user has) collapse to the same row id and short-circuit
12
+ * on the existing "skip if already indexed" replay guard;
13
+ * - the same conversation id from two providers (Grok and Gemini
14
+ * both expose plain UUID-shaped ids) cannot collide because
15
+ * `source` is part of the hash input.
16
+ *
17
+ * Note: this dedupe is skip-if-exists. A conversation that has
18
+ * grown new messages between two exports keeps its older
19
+ * snapshot until a future refresh-on-grow slice lands. The
20
+ * duplicate-rows correctness gap is what this helper closes;
21
+ * stale-content is tracked separately.
22
+ */
23
+ import crypto from "node:crypto";
24
+ export function stableConversationRowId(source, conversationId) {
25
+ return crypto
26
+ .createHash("sha256")
27
+ .update(`${source}:${conversationId}`)
28
+ .digest("hex")
29
+ .slice(0, 32);
30
+ }
31
+ //# sourceMappingURL=conversation-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-key.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CACrC,MAAc,EACd,cAAsB;IAEtB,OAAO,MAAM;SACV,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,GAAG,MAAM,IAAI,cAAc,EAAE,CAAC;SACrC,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const SUPPORTED_INBOX_EXTENSIONS: ReadonlySet<string>;
2
+ export declare function isSupportedInboxExtension(filePath: string): boolean;
3
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/extensions.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAGzD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Inbox file extension policy.
3
+ *
4
+ * Web conversation exports are always JSON or an archive of JSON.
5
+ * Markdown / images / arbitrary text are rejected at the watcher
6
+ * boundary so they never reach the parser layer.
7
+ */
8
+ import path from "node:path";
9
+ export const SUPPORTED_INBOX_EXTENSIONS = new Set([
10
+ ".json",
11
+ ".zip",
12
+ ]);
13
+ export function isSupportedInboxExtension(filePath) {
14
+ return SUPPORTED_INBOX_EXTENSIONS.has(path.extname(filePath).toLowerCase());
15
+ }
16
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IACrE,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function inboxIdempotencyKey(filePath: string, mtimeMs: number): string;
2
+ //# sourceMappingURL=idempotency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idempotency.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/idempotency.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO7E"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Stable idempotency key for a file dropped into an inbox folder.
3
+ *
4
+ * Pure: takes path + mtime as input, does no filesystem access. The
5
+ * caller (Rift adapter or a future standalone shell) is responsible
6
+ * for stat'ing the file.
7
+ *
8
+ * The key combines path and mtimeMs so re-dropping the same filename
9
+ * with new content gets a fresh key, while a watcher restart on
10
+ * unchanged files produces the same key and short-circuits as a
11
+ * duplicate at the queue layer.
12
+ */
13
+ import crypto from "node:crypto";
14
+ export function inboxIdempotencyKey(filePath, mtimeMs) {
15
+ const hash = crypto
16
+ .createHash("sha256")
17
+ .update(`${filePath}:${mtimeMs}`)
18
+ .digest("hex")
19
+ .slice(0, 16);
20
+ return `inbox:${hash}`;
21
+ }
22
+ //# sourceMappingURL=idempotency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/idempotency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,OAAe;IACnE,MAAM,IAAI,GAAG,MAAM;SAChB,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;SAChC,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,OAAO,SAAS,IAAI,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * inbox-core — pure file-detection primitives for an inbox watcher.
3
+ *
4
+ * Carved as a seam so the same logic can power both Rift's
5
+ * inbox-watcher.ts (which hands off to the job queue + ingest route)
6
+ * and a future standalone "AI Chat Backup Inbox" shell (which hands
7
+ * off to a local archive folder, with optional Rift indexing).
8
+ *
9
+ * Invariant: this module has zero Rift internals — no Fastify, no
10
+ * LanceDB, no Voyage, no JobQueue, no config loader, no parser
11
+ * registry. Only `node:` stdlib. The adapter wires it up.
12
+ */
13
+ export { inboxIdempotencyKey } from "./idempotency.js";
14
+ export { stableConversationRowId } from "./conversation-key.js";
15
+ export { conversationContentFingerprint } from "./conversation-fingerprint.js";
16
+ export { detectSourceFromSubdir } from "./source-detection.js";
17
+ export { SUPPORTED_INBOX_EXTENSIONS, isSupportedInboxExtension, } from "./extensions.js";
18
+ export { sniffInboxSource, type SniffedProvider } from "./source-sniffer.js";
19
+ export { readZipCentralDirectoryFilenames, sniffProviderFromZipEntries, sniffZipBuffer, } from "./zip-sniffer.js";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * inbox-core — pure file-detection primitives for an inbox watcher.
3
+ *
4
+ * Carved as a seam so the same logic can power both Rift's
5
+ * inbox-watcher.ts (which hands off to the job queue + ingest route)
6
+ * and a future standalone "AI Chat Backup Inbox" shell (which hands
7
+ * off to a local archive folder, with optional Rift indexing).
8
+ *
9
+ * Invariant: this module has zero Rift internals — no Fastify, no
10
+ * LanceDB, no Voyage, no JobQueue, no config loader, no parser
11
+ * registry. Only `node:` stdlib. The adapter wires it up.
12
+ */
13
+ export { inboxIdempotencyKey } from "./idempotency.js";
14
+ export { stableConversationRowId } from "./conversation-key.js";
15
+ export { conversationContentFingerprint } from "./conversation-fingerprint.js";
16
+ export { detectSourceFromSubdir } from "./source-detection.js";
17
+ export { SUPPORTED_INBOX_EXTENSIONS, isSupportedInboxExtension, } from "./extensions.js";
18
+ export { sniffInboxSource } from "./source-sniffer.js";
19
+ export { readZipCentralDirectoryFilenames, sniffProviderFromZipEntries, sniffZipBuffer, } from "./zip-sniffer.js";
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAwB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function detectSourceFromSubdir(filePath: string, inboxDir: string, knownSources: readonly string[]): string | null;
2
+ //# sourceMappingURL=source-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-detection.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/source-detection.ts"],"names":[],"mappings":"AAaA,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,SAAS,MAAM,EAAE,GAC9B,MAAM,GAAG,IAAI,CAWf"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Subdirectory-based source detection for inbox drops.
3
+ *
4
+ * If `data/inbox/<source>/file.json` exists and `<source>` is in
5
+ * `knownSources`, the source is `<source>`. Otherwise returns null
6
+ * and the caller decides on a default.
7
+ *
8
+ * Pure: no filesystem access, no Rift coupling. `knownSources` is
9
+ * passed in so the standalone shell can supply its own provider list
10
+ * without dragging in `parsers/types.ts`.
11
+ */
12
+ import path from "node:path";
13
+ export function detectSourceFromSubdir(filePath, inboxDir, knownSources) {
14
+ const relative = path.relative(inboxDir, filePath);
15
+ const firstSegment = relative.split(path.sep)[0];
16
+ if (firstSegment &&
17
+ firstSegment !== path.basename(filePath) &&
18
+ knownSources.includes(firstSegment)) {
19
+ return firstSegment;
20
+ }
21
+ return null;
22
+ }
23
+ //# sourceMappingURL=source-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-detection.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/source-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,sBAAsB,CACpC,QAAgB,EAChB,QAAgB,EAChB,YAA+B;IAE/B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,IACE,YAAY;QACZ,YAAY,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACxC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EACnC,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type SniffedProvider = "claude_web" | "grok_web" | "gemini_web";
2
+ /**
3
+ * Attempt to identify a non-ChatGPT provider for a file dropped in
4
+ * the inbox root. Returns null if no confident match — caller should
5
+ * fall back to its default (chatgpt_web in Rift's adapter).
6
+ *
7
+ * `data` may be undefined when the caller has only the filename
8
+ * (e.g., before reading the file). Filename-only heuristics still run.
9
+ */
10
+ export declare function sniffInboxSource(filename: string, data?: Buffer, peekBytes?: number): SniffedProvider | null;
11
+ //# sourceMappingURL=source-sniffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-sniffer.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/source-sniffer.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAIvE;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,GAAE,MAA2B,GACrC,eAAe,GAAG,IAAI,CAuCxB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Conservative content/filename sniffer for inbox drops.
3
+ *
4
+ * Purpose: when a file lands in the inbox root (no subdirectory hint),
5
+ * identify non-ChatGPT providers so they reach the right parser
6
+ * instead of silently failing under the ChatGPT default.
7
+ *
8
+ * Design: identify ONLY non-default providers (claude_web, grok_web,
9
+ * gemini_web). ChatGPT shapes are not matched here — the adapter's
10
+ * default fallback already handles them. Returning null means "no
11
+ * confident match; let the caller decide."
12
+ *
13
+ * Heuristics are cheap and ordered most-specific first:
14
+ * 1. Filename pattern (no I/O)
15
+ * 2. JSON content head substring match (bounded peek)
16
+ *
17
+ * Pure: no filesystem access, no Rift internals. The buffer is passed
18
+ * in by the caller — Rift's adapter reads with `fs`, a standalone
19
+ * shell would read however it likes.
20
+ */
21
+ import path from "node:path";
22
+ import { sniffZipBuffer } from "./zip-sniffer.js";
23
+ const DEFAULT_PEEK_BYTES = 64 * 1024;
24
+ /**
25
+ * Attempt to identify a non-ChatGPT provider for a file dropped in
26
+ * the inbox root. Returns null if no confident match — caller should
27
+ * fall back to its default (chatgpt_web in Rift's adapter).
28
+ *
29
+ * `data` may be undefined when the caller has only the filename
30
+ * (e.g., before reading the file). Filename-only heuristics still run.
31
+ */
32
+ export function sniffInboxSource(filename, data, peekBytes = DEFAULT_PEEK_BYTES) {
33
+ const fnameLower = path.basename(filename).toLowerCase();
34
+ const ext = path.extname(fnameLower);
35
+ // --- Filename hints (cheap, no I/O) ---
36
+ if (fnameLower.startsWith("prod-grok-backend"))
37
+ return "grok_web";
38
+ if (fnameLower.includes("claude"))
39
+ return "claude_web";
40
+ if (fnameLower.includes("takeout"))
41
+ return "gemini_web";
42
+ // --- Content hints ---
43
+ if (!data || data.length === 0)
44
+ return null;
45
+ // ZIPs: walk the central directory and match on marker filenames.
46
+ // We never decompress here — the parser layer handles extraction.
47
+ if (ext === ".zip") {
48
+ return sniffZipBuffer(data);
49
+ }
50
+ if (ext !== ".json")
51
+ return null;
52
+ const head = data.subarray(0, Math.min(peekBytes, data.length)).toString("utf-8");
53
+ // Claude exports always carry chat_messages arrays on every conversation.
54
+ if (head.includes('"chat_messages"'))
55
+ return "claude_web";
56
+ // Gemini activity cards carry timestamp_text or assistant_turns.
57
+ if (head.includes('"timestamp_text"') || head.includes('"assistant_turns"')) {
58
+ return "gemini_web";
59
+ }
60
+ // Grok exports nest responses[] inside each conversation. The
61
+ // combined presence of both top-level keys is what distinguishes
62
+ // them from the (rare) ChatGPT JSON that happens to mention
63
+ // "conversations" or "responses" in isolation.
64
+ if (head.includes('"conversations"') && head.includes('"responses"')) {
65
+ return "grok_web";
66
+ }
67
+ return null;
68
+ }
69
+ //# sourceMappingURL=source-sniffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-sniffer.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/source-sniffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,IAAa,EACb,YAAoB,kBAAkB;IAEtC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACzD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAErC,yCAAyC;IACzC,IAAI,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC;QAAE,OAAO,UAAU,CAAC;IAClE,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,YAAY,CAA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