@threadbase-sh/streamer 1.62.0 → 1.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/dist/agent/agent-client.d.ts +14 -0
  2. package/dist/agent/agent-client.d.ts.map +1 -0
  3. package/dist/agent/agent-config.d.ts +24 -0
  4. package/dist/agent/agent-config.d.ts.map +1 -0
  5. package/dist/agent/conversation-writer.d.ts +13 -0
  6. package/dist/agent/conversation-writer.d.ts.map +1 -0
  7. package/dist/agent/dedupe.d.ts +6 -0
  8. package/dist/agent/dedupe.d.ts.map +1 -0
  9. package/dist/agent/errors.d.ts +23 -0
  10. package/dist/agent/errors.d.ts.map +1 -0
  11. package/dist/agent/handle-send-agent-input.d.ts +21 -0
  12. package/dist/agent/handle-send-agent-input.d.ts.map +1 -0
  13. package/dist/agent/handle-start-agent-session.d.ts +21 -0
  14. package/dist/agent/handle-start-agent-session.d.ts.map +1 -0
  15. package/dist/agent/history-mapper.d.ts +4 -0
  16. package/dist/agent/history-mapper.d.ts.map +1 -0
  17. package/dist/agent/payload-guard.d.ts +29 -0
  18. package/dist/agent/payload-guard.d.ts.map +1 -0
  19. package/dist/api/app.d.ts +28 -0
  20. package/dist/api/app.d.ts.map +1 -0
  21. package/dist/api/handlers/conversations.handlers.d.ts +69 -0
  22. package/dist/api/handlers/conversations.handlers.d.ts.map +1 -0
  23. package/dist/api/handlers/http-helpers.d.ts +50 -0
  24. package/dist/api/handlers/http-helpers.d.ts.map +1 -0
  25. package/dist/api/handlers/sessions.handlers.d.ts +230 -0
  26. package/dist/api/handlers/sessions.handlers.d.ts.map +1 -0
  27. package/dist/api/middleware/auth.middleware.d.ts +5 -0
  28. package/dist/api/middleware/auth.middleware.d.ts.map +1 -0
  29. package/dist/api/middleware/cors.middleware.d.ts +5 -0
  30. package/dist/api/middleware/cors.middleware.d.ts.map +1 -0
  31. package/dist/api/middleware/error.middleware.d.ts +4 -0
  32. package/dist/api/middleware/error.middleware.d.ts.map +1 -0
  33. package/dist/api/routes/backup.routes.d.ts +5 -0
  34. package/dist/api/routes/backup.routes.d.ts.map +1 -0
  35. package/dist/api/routes/browse.routes.d.ts +5 -0
  36. package/dist/api/routes/browse.routes.d.ts.map +1 -0
  37. package/dist/api/routes/cacheAlert.routes.d.ts +5 -0
  38. package/dist/api/routes/cacheAlert.routes.d.ts.map +1 -0
  39. package/dist/api/routes/config.routes.d.ts +5 -0
  40. package/dist/api/routes/config.routes.d.ts.map +1 -0
  41. package/dist/api/routes/conversations.routes.d.ts +5 -0
  42. package/dist/api/routes/conversations.routes.d.ts.map +1 -0
  43. package/dist/api/routes/devices.routes.d.ts +17 -0
  44. package/dist/api/routes/devices.routes.d.ts.map +1 -0
  45. package/dist/api/routes/diagnostics.routes.d.ts +5 -0
  46. package/dist/api/routes/diagnostics.routes.d.ts.map +1 -0
  47. package/dist/api/routes/health.routes.d.ts +5 -0
  48. package/dist/api/routes/health.routes.d.ts.map +1 -0
  49. package/dist/api/routes/logs.routes.d.ts +3 -0
  50. package/dist/api/routes/logs.routes.d.ts.map +1 -0
  51. package/dist/api/routes/misc.routes.d.ts +77 -0
  52. package/dist/api/routes/misc.routes.d.ts.map +1 -0
  53. package/dist/api/routes/pair.routes.d.ts +5 -0
  54. package/dist/api/routes/pair.routes.d.ts.map +1 -0
  55. package/dist/api/routes/progress.routes.d.ts +39 -0
  56. package/dist/api/routes/progress.routes.d.ts.map +1 -0
  57. package/dist/api/routes/projects.routes.d.ts +5 -0
  58. package/dist/api/routes/projects.routes.d.ts.map +1 -0
  59. package/dist/api/routes/providers.routes.d.ts +19 -0
  60. package/dist/api/routes/providers.routes.d.ts.map +1 -0
  61. package/dist/api/routes/scanner.routes.d.ts +5 -0
  62. package/dist/api/routes/scanner.routes.d.ts.map +1 -0
  63. package/dist/api/routes/sessions.routes.d.ts +6 -0
  64. package/dist/api/routes/sessions.routes.d.ts.map +1 -0
  65. package/dist/api/routes/ws.routes.d.ts +7 -0
  66. package/dist/api/routes/ws.routes.d.ts.map +1 -0
  67. package/dist/api/types/api-deps.d.ts +114 -0
  68. package/dist/api/types/api-deps.d.ts.map +1 -0
  69. package/dist/auth.d.ts +81 -0
  70. package/dist/auth.d.ts.map +1 -0
  71. package/dist/browse.d.ts +17 -0
  72. package/dist/browse.d.ts.map +1 -0
  73. package/dist/claude-flags.d.ts +76 -0
  74. package/dist/claude-flags.d.ts.map +1 -0
  75. package/dist/cli.cjs +1917 -1795
  76. package/dist/cli.cjs.map +1 -1
  77. package/dist/codex-pty-runner.d.ts +90 -0
  78. package/dist/codex-pty-runner.d.ts.map +1 -0
  79. package/dist/config/update-config.d.ts +13 -0
  80. package/dist/config/update-config.d.ts.map +1 -0
  81. package/dist/conversation-cache.d.ts +336 -0
  82. package/dist/conversation-cache.d.ts.map +1 -0
  83. package/dist/db/config.d.ts +11 -0
  84. package/dist/db/config.d.ts.map +1 -0
  85. package/dist/db/index.d.ts +5 -0
  86. package/dist/db/index.d.ts.map +1 -0
  87. package/dist/db/migrations.d.ts +3 -0
  88. package/dist/db/migrations.d.ts.map +1 -0
  89. package/dist/db/pool.d.ts +5 -0
  90. package/dist/db/pool.d.ts.map +1 -0
  91. package/dist/db/query-timing.d.ts +52 -0
  92. package/dist/db/query-timing.d.ts.map +1 -0
  93. package/dist/db/repositories/cacheMetadata.repository.d.ts +12 -0
  94. package/dist/db/repositories/cacheMetadata.repository.d.ts.map +1 -0
  95. package/dist/db/repositories/conversations.repository.d.ts +27 -0
  96. package/dist/db/repositories/conversations.repository.d.ts.map +1 -0
  97. package/dist/db/repositories/devices.repository.d.ts +137 -0
  98. package/dist/db/repositories/devices.repository.d.ts.map +1 -0
  99. package/dist/db/repositories/managed-sessions.repository.d.ts +127 -0
  100. package/dist/db/repositories/managed-sessions.repository.d.ts.map +1 -0
  101. package/dist/db/repositories/projects.repository.d.ts +28 -0
  102. package/dist/db/repositories/projects.repository.d.ts.map +1 -0
  103. package/dist/db/repositories/push.repository.d.ts +186 -0
  104. package/dist/db/repositories/push.repository.d.ts.map +1 -0
  105. package/dist/db/repositories/sessions.repository.d.ts +16 -0
  106. package/dist/db/repositories/sessions.repository.d.ts.map +1 -0
  107. package/dist/db/runtime-store.d.ts +80 -0
  108. package/dist/db/runtime-store.d.ts.map +1 -0
  109. package/dist/db/sqlite-migrate.d.ts +13 -0
  110. package/dist/db/sqlite-migrate.d.ts.map +1 -0
  111. package/dist/db/upload-records.d.ts +11 -0
  112. package/dist/db/upload-records.d.ts.map +1 -0
  113. package/dist/e2ee/noise.d.ts +261 -0
  114. package/dist/e2ee/noise.d.ts.map +1 -0
  115. package/dist/e2ee/pair-payload.d.ts +60 -0
  116. package/dist/e2ee/pair-payload.d.ts.map +1 -0
  117. package/dist/e2ee/pair-request.d.ts +24 -0
  118. package/dist/e2ee/pair-request.d.ts.map +1 -0
  119. package/dist/external-tails.d.ts +91 -0
  120. package/dist/external-tails.d.ts.map +1 -0
  121. package/dist/feature-flags.d.ts +212 -0
  122. package/dist/feature-flags.d.ts.map +1 -0
  123. package/dist/handlers/handleListProjects.d.ts +3 -0
  124. package/dist/handlers/handleListProjects.d.ts.map +1 -0
  125. package/dist/index.cjs +84 -15
  126. package/dist/index.cjs.map +1 -1
  127. package/dist/index.d.ts +18 -2571
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +84 -15
  130. package/dist/index.js.map +1 -1
  131. package/dist/lifecycle/constants.d.ts +21 -0
  132. package/dist/lifecycle/constants.d.ts.map +1 -0
  133. package/dist/lifecycle/process-liveness.d.ts +7 -0
  134. package/dist/lifecycle/process-liveness.d.ts.map +1 -0
  135. package/dist/live-session-manager.d.ts +59 -0
  136. package/dist/live-session-manager.d.ts.map +1 -0
  137. package/dist/logger.d.ts +14 -0
  138. package/dist/logger.d.ts.map +1 -0
  139. package/dist/pair-store.d.ts +60 -0
  140. package/dist/pair-store.d.ts.map +1 -0
  141. package/dist/platform.d.ts +25 -0
  142. package/dist/platform.d.ts.map +1 -0
  143. package/dist/process-discovery.d.ts +35 -0
  144. package/dist/process-discovery.d.ts.map +1 -0
  145. package/dist/providers.d.ts +7 -0
  146. package/dist/providers.d.ts.map +1 -0
  147. package/dist/pty-host/protocol.d.ts +270 -0
  148. package/dist/pty-host/protocol.d.ts.map +1 -0
  149. package/dist/pty-host/remote-session-runner.d.ts +133 -0
  150. package/dist/pty-host/remote-session-runner.d.ts.map +1 -0
  151. package/dist/pty-host/socket.d.ts +54 -0
  152. package/dist/pty-host/socket.d.ts.map +1 -0
  153. package/dist/pty-host/spawn-host.d.ts +30 -0
  154. package/dist/pty-host/spawn-host.d.ts.map +1 -0
  155. package/dist/pty-manager.d.ts +65 -0
  156. package/dist/pty-manager.d.ts.map +1 -0
  157. package/dist/pty-shared.d.ts +27 -0
  158. package/dist/pty-shared.d.ts.map +1 -0
  159. package/dist/scanner-manager.d.ts +126 -0
  160. package/dist/scanner-manager.d.ts.map +1 -0
  161. package/dist/schemas/cacheAlert.schema.d.ts +14 -0
  162. package/dist/schemas/cacheAlert.schema.d.ts.map +1 -0
  163. package/dist/schemas/claudeFlags.schema.d.ts +7 -0
  164. package/dist/schemas/claudeFlags.schema.d.ts.map +1 -0
  165. package/dist/schemas/project.schema.d.ts +18 -0
  166. package/dist/schemas/project.schema.d.ts.map +1 -0
  167. package/dist/schemas/updateConfig.schema.d.ts +19 -0
  168. package/dist/schemas/updateConfig.schema.d.ts.map +1 -0
  169. package/dist/seal.d.ts +14 -0
  170. package/dist/seal.d.ts.map +1 -0
  171. package/dist/server-identity.d.ts +43 -0
  172. package/dist/server-identity.d.ts.map +1 -0
  173. package/dist/server-wiring.d.ts +184 -0
  174. package/dist/server-wiring.d.ts.map +1 -0
  175. package/dist/server.d.ts +390 -0
  176. package/dist/server.d.ts.map +1 -0
  177. package/dist/services/backup/backup.d.ts +103 -0
  178. package/dist/services/backup/backup.d.ts.map +1 -0
  179. package/dist/services/cache/cacheMetadata.d.ts +8 -0
  180. package/dist/services/cache/cacheMetadata.d.ts.map +1 -0
  181. package/dist/services/cache-integrity/alertStore.d.ts +24 -0
  182. package/dist/services/cache-integrity/alertStore.d.ts.map +1 -0
  183. package/dist/services/cache-integrity/backup.d.ts +8 -0
  184. package/dist/services/cache-integrity/backup.d.ts.map +1 -0
  185. package/dist/services/cache-integrity/cacheIntegrityMonitor.d.ts +71 -0
  186. package/dist/services/cache-integrity/cacheIntegrityMonitor.d.ts.map +1 -0
  187. package/dist/services/conversations/conversationWatcher.d.ts +99 -0
  188. package/dist/services/conversations/conversationWatcher.d.ts.map +1 -0
  189. package/dist/services/conversations/findSearchTarget.d.ts +30 -0
  190. package/dist/services/conversations/findSearchTarget.d.ts.map +1 -0
  191. package/dist/services/conversations/isAgentConversation.d.ts +8 -0
  192. package/dist/services/conversations/isAgentConversation.d.ts.map +1 -0
  193. package/dist/services/conversations/pruneAgentConversations.d.ts +8 -0
  194. package/dist/services/conversations/pruneAgentConversations.d.ts.map +1 -0
  195. package/dist/services/conversations/refreshConversationCache.d.ts +27 -0
  196. package/dist/services/conversations/refreshConversationCache.d.ts.map +1 -0
  197. package/dist/services/conversations/shouldRefreshProjectsFromHdd.d.ts +33 -0
  198. package/dist/services/conversations/shouldRefreshProjectsFromHdd.d.ts.map +1 -0
  199. package/dist/services/diagnostics/diagnostics.d.ts +66 -0
  200. package/dist/services/diagnostics/diagnostics.d.ts.map +1 -0
  201. package/dist/services/projectChats/deriveProjectChatTitle.d.ts +15 -0
  202. package/dist/services/projectChats/deriveProjectChatTitle.d.ts.map +1 -0
  203. package/dist/services/projects/ensureProjectsForConversations.d.ts +15 -0
  204. package/dist/services/projects/ensureProjectsForConversations.d.ts.map +1 -0
  205. package/dist/services/providers/capabilities.d.ts +105 -0
  206. package/dist/services/providers/capabilities.d.ts.map +1 -0
  207. package/dist/services/providers/providerHealth.d.ts +72 -0
  208. package/dist/services/providers/providerHealth.d.ts.map +1 -0
  209. package/dist/services/push/apnsClient.d.ts +105 -0
  210. package/dist/services/push/apnsClient.d.ts.map +1 -0
  211. package/dist/services/push/expoPushSender.d.ts +37 -0
  212. package/dist/services/push/expoPushSender.d.ts.map +1 -0
  213. package/dist/services/push/liveActivityContentState.d.ts +60 -0
  214. package/dist/services/push/liveActivityContentState.d.ts.map +1 -0
  215. package/dist/services/push/liveActivityNotifier.d.ts +49 -0
  216. package/dist/services/push/liveActivityNotifier.d.ts.map +1 -0
  217. package/dist/services/push/liveActivityRenewal.d.ts +63 -0
  218. package/dist/services/push/liveActivityRenewal.d.ts.map +1 -0
  219. package/dist/services/push/liveActivitySender.d.ts +88 -0
  220. package/dist/services/push/liveActivitySender.d.ts.map +1 -0
  221. package/dist/services/push/waitingInputNotifier.d.ts +41 -0
  222. package/dist/services/push/waitingInputNotifier.d.ts.map +1 -0
  223. package/dist/services/questions/answersToKeystrokes.d.ts +8 -0
  224. package/dist/services/questions/answersToKeystrokes.d.ts.map +1 -0
  225. package/dist/services/questions/codexGateAnswers.d.ts +14 -0
  226. package/dist/services/questions/codexGateAnswers.d.ts.map +1 -0
  227. package/dist/services/questions/codexScreen.d.ts +74 -0
  228. package/dist/services/questions/codexScreen.d.ts.map +1 -0
  229. package/dist/services/questions/detectAskUserQuestion.d.ts +6 -0
  230. package/dist/services/questions/detectAskUserQuestion.d.ts.map +1 -0
  231. package/dist/services/questions/detectPermissionGate.d.ts +62 -0
  232. package/dist/services/questions/detectPermissionGate.d.ts.map +1 -0
  233. package/dist/services/questions/detectQuestionFromScreen.d.ts +30 -0
  234. package/dist/services/questions/detectQuestionFromScreen.d.ts.map +1 -0
  235. package/dist/services/questions/detectShellPrompt.d.ts +18 -0
  236. package/dist/services/questions/detectShellPrompt.d.ts.map +1 -0
  237. package/dist/services/questions/parseAgentPhase.d.ts +12 -0
  238. package/dist/services/questions/parseAgentPhase.d.ts.map +1 -0
  239. package/dist/services/questions/parseStatusLine.d.ts +19 -0
  240. package/dist/services/questions/parseStatusLine.d.ts.map +1 -0
  241. package/dist/services/questions/questionBroadcast.d.ts +18 -0
  242. package/dist/services/questions/questionBroadcast.d.ts.map +1 -0
  243. package/dist/services/questions/resolveAnswer.d.ts +16 -0
  244. package/dist/services/questions/resolveAnswer.d.ts.map +1 -0
  245. package/dist/services/search/searchQuery.d.ts +78 -0
  246. package/dist/services/search/searchQuery.d.ts.map +1 -0
  247. package/dist/services/security/capabilities.d.ts +50 -0
  248. package/dist/services/security/capabilities.d.ts.map +1 -0
  249. package/dist/services/sessions/autoResumeOnBoot.d.ts +28 -0
  250. package/dist/services/sessions/autoResumeOnBoot.d.ts.map +1 -0
  251. package/dist/services/sessions/codexRolloutOwner.d.ts +55 -0
  252. package/dist/services/sessions/codexRolloutOwner.d.ts.map +1 -0
  253. package/dist/services/sessions/conversationBusy.d.ts +32 -0
  254. package/dist/services/sessions/conversationBusy.d.ts.map +1 -0
  255. package/dist/services/sessions/idempotency.d.ts +67 -0
  256. package/dist/services/sessions/idempotency.d.ts.map +1 -0
  257. package/dist/services/sessions/reconcileSessions.d.ts +63 -0
  258. package/dist/services/sessions/reconcileSessions.d.ts.map +1 -0
  259. package/dist/services/sessions/rehydrateSessions.d.ts +68 -0
  260. package/dist/services/sessions/rehydrateSessions.d.ts.map +1 -0
  261. package/dist/services/sessions/resumeIdentity.d.ts +16 -0
  262. package/dist/services/sessions/resumeIdentity.d.ts.map +1 -0
  263. package/dist/session-registry-boot.d.ts +142 -0
  264. package/dist/session-registry-boot.d.ts.map +1 -0
  265. package/dist/session-store.d.ts +32 -0
  266. package/dist/session-store.d.ts.map +1 -0
  267. package/dist/session-watchers.d.ts +60 -0
  268. package/dist/session-watchers.d.ts.map +1 -0
  269. package/dist/types.d.ts +616 -0
  270. package/dist/types.d.ts.map +1 -0
  271. package/dist/uploads.d.ts +16 -0
  272. package/dist/uploads.d.ts.map +1 -0
  273. package/dist/utils/bootToken.d.ts +3 -0
  274. package/dist/utils/bootToken.d.ts.map +1 -0
  275. package/dist/utils/canonicalizeFilePath.d.ts +75 -0
  276. package/dist/utils/canonicalizeFilePath.d.ts.map +1 -0
  277. package/dist/utils/canonicalizeProjectPath.d.ts +13 -0
  278. package/dist/utils/canonicalizeProjectPath.d.ts.map +1 -0
  279. package/dist/utils/codexConversationLine.d.ts +38 -0
  280. package/dist/utils/codexConversationLine.d.ts.map +1 -0
  281. package/dist/utils/conversationEtag.d.ts +19 -0
  282. package/dist/utils/conversationEtag.d.ts.map +1 -0
  283. package/dist/utils/dates.d.ts +12 -0
  284. package/dist/utils/dates.d.ts.map +1 -0
  285. package/dist/utils/debounce.d.ts +15 -0
  286. package/dist/utils/debounce.d.ts.map +1 -0
  287. package/dist/utils/deriveSessionName.d.ts +10 -0
  288. package/dist/utils/deriveSessionName.d.ts.map +1 -0
  289. package/dist/utils/fileIdentity.d.ts +36 -0
  290. package/dist/utils/fileIdentity.d.ts.map +1 -0
  291. package/dist/utils/isScannedSnapshotStale.d.ts +16 -0
  292. package/dist/utils/isScannedSnapshotStale.d.ts.map +1 -0
  293. package/dist/utils/scanProgressThrottle.d.ts +12 -0
  294. package/dist/utils/scanProgressThrottle.d.ts.map +1 -0
  295. package/dist/version.d.ts +3 -0
  296. package/dist/version.d.ts.map +1 -0
  297. package/dist/ws-hub.d.ts +15 -0
  298. package/dist/ws-hub.d.ts.map +1 -0
  299. package/package.json +3 -4
  300. package/dist/index.d.cts +0 -2571
@@ -0,0 +1,75 @@
1
+ /**
2
+ * File-path identity across the scanner/cache boundary.
3
+ *
4
+ * Two path forms exist in this process and they are NOT interchangeable on
5
+ * Windows:
6
+ *
7
+ * - **canonical** (forward slashes) — every cache key: conversation_meta
8
+ * .file_path, the fileIndex, watcher keys, externalTails.
9
+ * - **native** (the platform separator) — what the scanner emits in
10
+ * ConversationMeta.filePath, and what chokidar delivers.
11
+ *
12
+ * Both writers of conversation_meta.file_path (upsertFull, insertSkeleton)
13
+ * store the canonical form, so the storage invariant is "cache keys are always
14
+ * canonical". The scanner has no such rule: it emits native paths, verified by
15
+ * measurement on win32.
16
+ *
17
+ * The rule when the two meet: **normalize for the comparison, emit in the
18
+ * consumer's form.** Canonicalize both sides to join them, then key the result
19
+ * with whichever form the code receiving it will look up by. Joining a
20
+ * scanner-derived path against a cache-derived one without normalizing fails
21
+ * silently — an empty map or a false, never an exception — and is invisible on
22
+ * POSIX, where the two forms are identical.
23
+ */
24
+ /**
25
+ * Canonicalize a path for use as a cache/DB/watcher key.
26
+ *
27
+ * Rules:
28
+ * - Trim surrounding whitespace
29
+ * - Convert backslashes to forward slashes
30
+ *
31
+ * Do NOT lowercase: even on case-insensitive Windows filesystems, lowercasing
32
+ * would diverge the key from the scanner's case-preserved file_path. Only the
33
+ * separator is normalized; case is preserved.
34
+ */
35
+ export declare function canonicalizeFilePath(filePath: string): string;
36
+ /**
37
+ * Convert a canonical path back to the platform-native form.
38
+ *
39
+ * Use only when handing a path *back* to something that keys by native paths —
40
+ * in practice the scanner's statCache, whose entries it looks up by its own
41
+ * ConversationMeta.filePath. A no-op on POSIX; on win32 `normalize` rewrites
42
+ * forward slashes to backslashes.
43
+ */
44
+ export declare function toNativeFilePath(filePath: string): string;
45
+ /**
46
+ * Build the canonical live-path set that `reconcileDeletions` compares against
47
+ * `conversation_meta.file_path`.
48
+ *
49
+ * Exists as a named function rather than an inline `.map()` so the conversion
50
+ * has one place to be tested and one place to be got wrong: the scanner's
51
+ * filePath is native, the rows it is checked against are canonical, and a
52
+ * missed conversion here means every row falls through to the existsSync
53
+ * backstop instead of being recognised as live.
54
+ */
55
+ export declare function canonicalLivePathSet(metas: Iterable<{
56
+ filePath?: string | null;
57
+ }>): Set<string>;
58
+ /**
59
+ * Join scanner metadata against canonically-keyed stat rows, producing the map
60
+ * the scanner expects back as `statCache`.
61
+ *
62
+ * This is the boundary rule made concrete: the lookup is done in canonical
63
+ * form (because that is how the rows are keyed) while the result is keyed by
64
+ * the meta's own native path (because that is what the scanner looks up by).
65
+ * Getting either half wrong yields an empty or unusable map and silently
66
+ * disables the scanner's stat cache — no error, just a full re-parse of every
67
+ * conversation on every rescan.
68
+ */
69
+ export declare function joinStatCacheByNativePath<TStat, TMeta extends {
70
+ filePath?: string | null;
71
+ }>(metas: Iterable<TMeta>, canonicalStats: Map<string, TStat>): Map<string, {
72
+ stat: TStat;
73
+ meta: TMeta;
74
+ }>;
75
+ //# sourceMappingURL=canonicalizeFilePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalizeFilePath.d.ts","sourceRoot":"","sources":["../../src/utils/canonicalizeFilePath.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAM/F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACzF,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EACtB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GACjC,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAQ3C"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Canonicalize a project path so the same project always dedupes to the
3
+ * same key, regardless of trailing slashes or surrounding whitespace.
4
+ *
5
+ * Rules:
6
+ * - Trim surrounding whitespace
7
+ * - Remove trailing forward or back slashes (one or more)
8
+ *
9
+ * Do NOT lowercase: project paths can be case-sensitive on Linux/macOS
10
+ * and lowercasing them would silently merge two distinct real projects.
11
+ */
12
+ export declare function canonicalizeProjectPath(projectPath: string): string;
13
+ //# sourceMappingURL=canonicalizeProjectPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalizeProjectPath.d.ts","sourceRoot":"","sources":["../../src/utils/canonicalizeProjectPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Codex rollout JSONL → Claude-shaped conversation lines for WS clients.
3
+ *
4
+ * Mobile's `parseLineToMessage` only understands Claude Code JSONL
5
+ * (`type: "user"|"assistant"`, `message.role`, text blocks). Codex writes
6
+ * `response_item` / `event_msg` / `session_meta` instead, so raw Codex lines
7
+ * never become live bubbles. This helper normalizes chat-bearing Codex lines
8
+ * into the Claude shape and drops everything else (including the duplicate
9
+ * `event_msg` copies of each turn and `developer` role payloads).
10
+ */
11
+ import type { NormalizeResult } from "../services/providers/capabilities";
12
+ /**
13
+ * Classify one Codex rollout line (C2).
14
+ *
15
+ * Distinguishes "recognized, deliberately not rendered" (`ignored`) from "this
16
+ * adapter has never seen this shape" (`unknown`). Both were `null` before, which
17
+ * is why provider schema drift used to surface as an empty screen with no error.
18
+ */
19
+ export declare function classifyCodexLine(line: string): NormalizeResult;
20
+ /**
21
+ * Returns a Claude-shaped JSONL line, or null when the input is not a
22
+ * user/assistant chat message that clients should render.
23
+ *
24
+ * Thin wrapper over classifyCodexLine so existing callers keep their signature.
25
+ * New code should prefer classifyCodexLine, which explains WHY a line produced
26
+ * nothing.
27
+ */
28
+ export declare function normalizeCodexLineToClaudeShape(line: string): string | null;
29
+ /** True when a Codex rollout line is Codex-shaped (not Claude JSONL). */
30
+ export declare function isCodexRolloutLine(line: string): boolean;
31
+ /**
32
+ * Map a batch of raw JSONL lines to client-facing lines. Codex batches are
33
+ * normalized (and filtered); Claude batches pass through unchanged so seq
34
+ * alignment is preserved.
35
+ */
36
+ export declare function toClientConversationLines(lines: string[]): string[];
37
+ export declare function isCodexInjectedContext(text: string): boolean;
38
+ //# sourceMappingURL=codexConversationLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codexConversationLine.d.ts","sourceRoot":"","sources":["../../src/utils/codexConversationLine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAkC1E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAuD/D;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG3E;AA6BD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYxD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAYnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAsB5D"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Inputs that uniquely identify a conversation's current state for the
3
+ * purpose of a conditional fetch. These all live on the parsed `Conversation`
4
+ * and must be read AFTER `findConversationByUuid`'s staleness refresh — never
5
+ * from a pre-refresh snapshot — so the validator reflects the same state the
6
+ * response body would.
7
+ */
8
+ export interface ConversationEtagInput {
9
+ filePath: string;
10
+ messageCount: number;
11
+ timestamp: string;
12
+ }
13
+ /**
14
+ * Derive a stable, opaque ETag for a conversation. The client never parses it;
15
+ * it only echoes the value back via `If-None-Match`. Wrapping the inputs in a
16
+ * hash keeps the formula changeable without the client caring.
17
+ */
18
+ export declare function computeConversationEtag({ filePath, messageCount, timestamp, }: ConversationEtagInput): string;
19
+ //# sourceMappingURL=conversationEtag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversationEtag.d.ts","sourceRoot":"","sources":["../../src/utils/conversationEtag.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,qBAAqB,GAAG,MAAM,CAMhC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Parse an ISO timestamp string. Returns null for null/undefined input or
3
+ * an unparseable value rather than throwing — callers can fall back.
4
+ */
5
+ export declare function parseIsoDateOrNull(value?: string | null): Date | null;
6
+ /**
7
+ * Compare two ISO timestamp strings descending. Null/undefined values sort
8
+ * last regardless of order. Used for ProjectChat list ordering and latest
9
+ * conversation selection.
10
+ */
11
+ export declare function compareIsoDesc(a?: string | null, b?: string | null): number;
12
+ //# sourceMappingURL=dates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/utils/dates.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAIrE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAS3E"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Trailing-edge debounce: collapses calls that arrive within `waitMs` of each
3
+ * other into a single invocation, scheduled `waitMs` after the most recent
4
+ * call. The last call's arguments win.
5
+ *
6
+ * The returned function carries two extra methods:
7
+ * - cancel(): drop any pending invocation (use on shutdown so a timer
8
+ * doesn't keep the process alive).
9
+ * - flush(): run any pending invocation immediately (useful in tests).
10
+ */
11
+ export declare function debounce<A extends unknown[]>(fn: (...args: A) => void, waitMs: number): ((...args: A) => void) & {
12
+ flush: () => void;
13
+ cancel: () => void;
14
+ };
15
+ //# sourceMappingURL=debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAC1C,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EACxB,MAAM,EAAE,MAAM,GACb,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAiCpE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Derive a session title from its first user message.
3
+ *
4
+ * Mirrors `@threadbase-sh/scanner`'s `deriveSessionNameFromFirstMessage`
5
+ * (first line of the first user message, truncated) so a live session gets
6
+ * the same title a resumed/scanned one would compute from the same JSONL —
7
+ * without waiting on the scanner or cache to observe the line.
8
+ */
9
+ export declare function deriveSessionName(firstMessageText: string): string;
10
+ //# sourceMappingURL=deriveSessionName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveSessionName.d.ts","sourceRoot":"","sources":["../../src/utils/deriveSessionName.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAGlE"}
@@ -0,0 +1,36 @@
1
+ import type { Stats } from "fs";
2
+ /**
3
+ * Stable identity for a JSONL file, used to detect replacement (a new file at
4
+ * the same path) vs. mere growth. Prefer the inode (dev:ino) — cheap and exact.
5
+ * When the inode is unavailable (ino === 0, e.g. some network/virtual FS), fall
6
+ * back to a fingerprint of the first bytes supplied by the caller.
7
+ */
8
+ export declare function fileIdentity(stat: Pick<Stats, "dev" | "ino">, headBytes?: Buffer): string;
9
+ export interface LineSpan {
10
+ /** Absolute byte offset of the line's first byte in the file. */
11
+ byteOffset: number;
12
+ /** Byte length of the line content, excluding the trailing "\n". */
13
+ byteLength: number;
14
+ /** The decoded line text (no trailing "\n"). */
15
+ text: string;
16
+ }
17
+ export interface SplitResult {
18
+ spans: LineSpan[];
19
+ /**
20
+ * Bytes consumed = up to and including the last "\n" in `buf`. A trailing
21
+ * partial line (no newline yet) is NOT consumed, so the caller's byte offset
22
+ * never advances past an incomplete line. Those bytes arrive again, whole, on
23
+ * the next read.
24
+ */
25
+ consumed: number;
26
+ }
27
+ /**
28
+ * Split a buffer of appended bytes into complete-line spans with absolute byte
29
+ * offsets. `baseOffset` is the file position of `buf`'s first byte.
30
+ *
31
+ * Only lines terminated by "\n" produce a span; the remainder after the final
32
+ * newline is left for the next read (torn-write safety, design §7.5 #4). Empty
33
+ * lines (a bare "\n") produce no span but are still consumed.
34
+ */
35
+ export declare function splitCompleteLines(buf: Buffer, baseOffset: number): SplitResult;
36
+ //# sourceMappingURL=fileIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileIdentity.d.ts","sourceRoot":"","sources":["../../src/utils/fileIdentity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAIzF;AAED,MAAM,WAAW,QAAQ;IACvB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAoB/E"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Decide whether a scanned conversation snapshot is stale relative to the
3
+ * JSONL on disk. The scanner memoizes both its metadata index and parsed
4
+ * conversations for the server's lifetime, so a conversation that grows after
5
+ * the initial scan keeps serving the startup snapshot from
6
+ * `/api/conversations/{id}`. We compare the file's mtime against the
7
+ * snapshot's last-activity timestamp to detect that drift.
8
+ *
9
+ * Returns true when the file is meaningfully newer than the snapshot (a
10
+ * re-scan is warranted). Returns false when the snapshot is current, when the
11
+ * snapshot timestamp is unparseable (nothing to compare against — leave it),
12
+ * or when mtime is null (stat failed — don't churn the index on a transient
13
+ * read error).
14
+ */
15
+ export declare function isScannedSnapshotStale(snapshotTimestamp: string | null | undefined, fileMtimeMs: number | null): boolean;
16
+ //# sourceMappingURL=isScannedSnapshotStale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isScannedSnapshotStale.d.ts","sourceRoot":"","sources":["../../src/utils/isScannedSnapshotStale.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5C,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAKT"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The scanner fires onProgress once per file, so a large scan would otherwise
3
+ * broadcast thousands of scan_progress WebSocket frames. This throttle collapses
4
+ * them to at most one per whole-percent step, plus a guaranteed final frame when
5
+ * the scan completes (scanned === total). Caps frames at ~101 regardless of the
6
+ * file count, while always delivering the terminal 100% update.
7
+ *
8
+ * Returns a predicate: call it with each (scanned, total) tick; it returns true
9
+ * when that tick should be broadcast. Stateful — create one per scan.
10
+ */
11
+ export declare function createScanProgressThrottle(): (scanned: number, total: number) => boolean;
12
+ //# sourceMappingURL=scanProgressThrottle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanProgressThrottle.d.ts","sourceRoot":"","sources":["../../src/utils/scanProgressThrottle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAoBxF"}
@@ -0,0 +1,3 @@
1
+ export declare function getVersion(): string;
2
+ export declare function resetVersionCache(): void;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAuBA,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAGD,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -0,0 +1,15 @@
1
+ import type { WebSocket } from "ws";
2
+ import type { WSMessage } from "./types";
3
+ export declare class WSHub {
4
+ private clients;
5
+ private pingTimer;
6
+ private pongTimers;
7
+ addClient(ws: WebSocket): void;
8
+ broadcast(message: WSMessage): void;
9
+ broadcastToClients(clients: Iterable<WebSocket>, message: WSMessage): void;
10
+ unicast(ws: WebSocket, message: WSMessage): void;
11
+ get connectionCount(): number;
12
+ dispose(): void;
13
+ private startPing;
14
+ }
15
+ //# sourceMappingURL=ws-hub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-hub.d.ts","sourceRoot":"","sources":["../src/ws-hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOzC,qBAAa,KAAK;IAChB,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAA+C;IAEhE,OAAO,CAAC,UAAU,CAAuD;IAEzE,SAAS,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAgC7B;IAED,SAAS,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAmBlC;IAMD,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAazE;IAED,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAQ/C;IAED,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,OAAO,IAAI,IAAI,CAuBd;IAED,OAAO,CAAC,SAAS;CAsBlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadbase-sh/streamer",
3
- "version": "1.62.0",
3
+ "version": "1.64.0",
4
4
  "description": "PTY session management, WebSocket streaming, and REST API server for Claude Code conversations",
5
5
  "license": "MIT",
6
6
  "author": "Ronen Mars",
@@ -46,7 +46,7 @@
46
46
  "node": ">=22 <25"
47
47
  },
48
48
  "scripts": {
49
- "build": "tsup && node -e \"const{cpSync}=require('fs');cpSync('src/db/migrations','dist/migrations',{recursive:true});cpSync('src/db/runtime-migrations','dist/runtime-migrations',{recursive:true});cpSync('src/db/pg-migrations','dist/pg-migrations',{recursive:true})\"",
49
+ "build": "tsup && tsc -p tsconfig.build.json && node -e \"const{cpSync}=require('fs');cpSync('src/db/migrations','dist/migrations',{recursive:true});cpSync('src/db/runtime-migrations','dist/runtime-migrations',{recursive:true});cpSync('src/db/pg-migrations','dist/pg-migrations',{recursive:true})\"",
50
50
  "dev": "tsup --watch",
51
51
  "dev:verbose": "npm run build && mkdir -p ~/.threadbase/logs && node dist/cli.cjs serve --verbose 2>&1 | tee -a ~/.threadbase/logs/dev.log",
52
52
  "preinstall": "node scripts/check-node-version.mjs --warn && node scripts/check-native-abi.mjs --warn",
@@ -138,7 +138,7 @@
138
138
  "semantic-release": "^25.0.5",
139
139
  "tsup": "^8.0.0",
140
140
  "tsx": "^4.21.0",
141
- "typescript": "^6.0.3",
141
+ "typescript": "^7.0.2",
142
142
  "vitest": "^4.1.10"
143
143
  },
144
144
  "overrides": {
@@ -147,7 +147,6 @@
147
147
  }
148
148
  },
149
149
  "allowScripts": {
150
- "better-sqlite3": true,
151
150
  "node-pty": true
152
151
  }
153
152
  }