@ai-devkit/agent-manager 0.43.0 → 0.44.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 (444) hide show
  1. package/package.json +8 -3
  2. package/.swcrc +0 -27
  3. package/dist/__tests__/AgentManager.test.js +0 -1727
  4. package/dist/__tests__/AgentManager.test.js.map +0 -1
  5. package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js +0 -486
  6. package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js.map +0 -1
  7. package/dist/__tests__/adapters/adapterProcessImports.test.js +0 -52
  8. package/dist/__tests__/adapters/adapterProcessImports.test.js.map +0 -1
  9. package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js +0 -247
  10. package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js.map +0 -1
  11. package/dist/__tests__/capacity/anthropic.test.js +0 -115
  12. package/dist/__tests__/capacity/anthropic.test.js.map +0 -1
  13. package/dist/__tests__/capacity/boundaries.test.js +0 -45
  14. package/dist/__tests__/capacity/boundaries.test.js.map +0 -1
  15. package/dist/__tests__/capacity/claude.test.js +0 -485
  16. package/dist/__tests__/capacity/claude.test.js.map +0 -1
  17. package/dist/__tests__/capacity/codex.test.js +0 -339
  18. package/dist/__tests__/capacity/codex.test.js.map +0 -1
  19. package/dist/__tests__/capacity/devin.test.js +0 -239
  20. package/dist/__tests__/capacity/devin.test.js.map +0 -1
  21. package/dist/__tests__/capacity/index.test.js +0 -53
  22. package/dist/__tests__/capacity/index.test.js.map +0 -1
  23. package/dist/__tests__/capacity/openai.test.js +0 -687
  24. package/dist/__tests__/capacity/openai.test.js.map +0 -1
  25. package/dist/__tests__/capacity/wham.test.js +0 -159
  26. package/dist/__tests__/capacity/wham.test.js.map +0 -1
  27. package/dist/__tests__/capacity/zai.test.js +0 -212
  28. package/dist/__tests__/capacity/zai.test.js.map +0 -1
  29. package/dist/__tests__/fixtures.test.js +0 -218
  30. package/dist/__tests__/fixtures.test.js.map +0 -1
  31. package/dist/__tests__/harnesses/BoundedSummarySkip.test.js +0 -568
  32. package/dist/__tests__/harnesses/BoundedSummarySkip.test.js.map +0 -1
  33. package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js +0 -1089
  34. package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js.map +0 -1
  35. package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js +0 -143
  36. package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js.map +0 -1
  37. package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js +0 -462
  38. package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js.map +0 -1
  39. package/dist/__tests__/harnesses/builtinAdapters.test.js +0 -33
  40. package/dist/__tests__/harnesses/builtinAdapters.test.js.map +0 -1
  41. package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js +0 -79
  42. package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js.map +0 -1
  43. package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js +0 -1881
  44. package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js.map +0 -1
  45. package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js +0 -425
  46. package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js.map +0 -1
  47. package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js +0 -314
  48. package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js.map +0 -1
  49. package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js +0 -49
  50. package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js.map +0 -1
  51. package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js +0 -76
  52. package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js.map +0 -1
  53. package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js +0 -173
  54. package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js.map +0 -1
  55. package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js +0 -181
  56. package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js.map +0 -1
  57. package/dist/__tests__/harnesses/codex/CodexAdapter.test.js +0 -685
  58. package/dist/__tests__/harnesses/codex/CodexAdapter.test.js.map +0 -1
  59. package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js +0 -463
  60. package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js.map +0 -1
  61. package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js +0 -86
  62. package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js.map +0 -1
  63. package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js +0 -254
  64. package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js.map +0 -1
  65. package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js +0 -121
  66. package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js.map +0 -1
  67. package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js +0 -84
  68. package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js.map +0 -1
  69. package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js +0 -128
  70. package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js.map +0 -1
  71. package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js +0 -246
  72. package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js.map +0 -1
  73. package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js +0 -384
  74. package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js.map +0 -1
  75. package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js +0 -659
  76. package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js.map +0 -1
  77. package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js +0 -290
  78. package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js.map +0 -1
  79. package/dist/__tests__/harnesses/devin/DevinAdapter.test.js +0 -597
  80. package/dist/__tests__/harnesses/devin/DevinAdapter.test.js.map +0 -1
  81. package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js +0 -99
  82. package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js.map +0 -1
  83. package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js +0 -192
  84. package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js.map +0 -1
  85. package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js +0 -407
  86. package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js.map +0 -1
  87. package/dist/__tests__/harnesses/devin/fixtures.js +0 -95
  88. package/dist/__tests__/harnesses/devin/fixtures.js.map +0 -1
  89. package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js +0 -1454
  90. package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js.map +0 -1
  91. package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js +0 -491
  92. package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js.map +0 -1
  93. package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js +0 -399
  94. package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js.map +0 -1
  95. package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js +0 -56
  96. package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js.map +0 -1
  97. package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js +0 -421
  98. package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js.map +0 -1
  99. package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js +0 -167
  100. package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js.map +0 -1
  101. package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js +0 -133
  102. package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js.map +0 -1
  103. package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js +0 -301
  104. package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js.map +0 -1
  105. package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js +0 -662
  106. package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js.map +0 -1
  107. package/dist/__tests__/harnesses/muse/MuseAdapter.test.js +0 -247
  108. package/dist/__tests__/harnesses/muse/MuseAdapter.test.js.map +0 -1
  109. package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js +0 -81
  110. package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js.map +0 -1
  111. package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js +0 -185
  112. package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js.map +0 -1
  113. package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js +0 -328
  114. package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js.map +0 -1
  115. package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js +0 -213
  116. package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js.map +0 -1
  117. package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js +0 -108
  118. package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js.map +0 -1
  119. package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js +0 -94
  120. package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js.map +0 -1
  121. package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js +0 -147
  122. package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js.map +0 -1
  123. package/dist/__tests__/harnesses/pi/PiAdapter.test.js +0 -367
  124. package/dist/__tests__/harnesses/pi/PiAdapter.test.js.map +0 -1
  125. package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js +0 -382
  126. package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js.map +0 -1
  127. package/dist/__tests__/harnesses/pi/PiSessionParser.test.js +0 -416
  128. package/dist/__tests__/harnesses/pi/PiSessionParser.test.js.map +0 -1
  129. package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js +0 -108
  130. package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js.map +0 -1
  131. package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js +0 -70
  132. package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js.map +0 -1
  133. package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js +0 -43
  134. package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js.map +0 -1
  135. package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js +0 -192
  136. package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js.map +0 -1
  137. package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js +0 -119
  138. package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js.map +0 -1
  139. package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js +0 -382
  140. package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js.map +0 -1
  141. package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js +0 -34
  142. package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js.map +0 -1
  143. package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js +0 -446
  144. package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js.map +0 -1
  145. package/dist/__tests__/harnesses/runtimeProfiles.test.js +0 -101
  146. package/dist/__tests__/harnesses/runtimeProfiles.test.js.map +0 -1
  147. package/dist/__tests__/print/DurableAgent.test.js +0 -15
  148. package/dist/__tests__/print/DurableAgent.test.js.map +0 -1
  149. package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js +0 -186
  150. package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js.map +0 -1
  151. package/dist/__tests__/print/DurableAgentRepository.test.js +0 -249
  152. package/dist/__tests__/print/DurableAgentRepository.test.js.map +0 -1
  153. package/dist/__tests__/readiness-fixtures.test.js +0 -54
  154. package/dist/__tests__/readiness-fixtures.test.js.map +0 -1
  155. package/dist/__tests__/runtime/AgentRuntime.test.js +0 -13
  156. package/dist/__tests__/runtime/AgentRuntime.test.js.map +0 -1
  157. package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js +0 -164
  158. package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js.map +0 -1
  159. package/dist/__tests__/runtime/HerdrAgentRuntime.test.js +0 -488
  160. package/dist/__tests__/runtime/HerdrAgentRuntime.test.js.map +0 -1
  161. package/dist/__tests__/runtime/ManagedAgentRuntime.test.js +0 -637
  162. package/dist/__tests__/runtime/ManagedAgentRuntime.test.js.map +0 -1
  163. package/dist/__tests__/terminal/GhosttyBackend.test.js +0 -334
  164. package/dist/__tests__/terminal/GhosttyBackend.test.js.map +0 -1
  165. package/dist/__tests__/terminal/TerminalFocusManager.test.js +0 -253
  166. package/dist/__tests__/terminal/TerminalFocusManager.test.js.map +0 -1
  167. package/dist/__tests__/terminal/TmuxManager.test.js +0 -168
  168. package/dist/__tests__/terminal/TmuxManager.test.js.map +0 -1
  169. package/dist/__tests__/terminal/TtyWriter.test.js +0 -386
  170. package/dist/__tests__/terminal/TtyWriter.test.js.map +0 -1
  171. package/dist/__tests__/utils/AgentRegistry.test.js +0 -636
  172. package/dist/__tests__/utils/AgentRegistry.test.js.map +0 -1
  173. package/dist/__tests__/utils/IncrementalJsonlSummary.test.js +0 -650
  174. package/dist/__tests__/utils/IncrementalJsonlSummary.test.js.map +0 -1
  175. package/dist/__tests__/utils/agent-requests.test.js +0 -90
  176. package/dist/__tests__/utils/agent-requests.test.js.map +0 -1
  177. package/dist/__tests__/utils/conversationTail.bench.test.js +0 -258
  178. package/dist/__tests__/utils/conversationTail.bench.test.js.map +0 -1
  179. package/dist/__tests__/utils/conversationTailParity.test.js +0 -588
  180. package/dist/__tests__/utils/conversationTailParity.test.js.map +0 -1
  181. package/dist/__tests__/utils/jsonlTail.test.js +0 -360
  182. package/dist/__tests__/utils/jsonlTail.test.js.map +0 -1
  183. package/dist/__tests__/utils/matching.test.js +0 -324
  184. package/dist/__tests__/utils/matching.test.js.map +0 -1
  185. package/dist/__tests__/utils/matchingConstants.test.js +0 -35
  186. package/dist/__tests__/utils/matchingConstants.test.js.map +0 -1
  187. package/dist/__tests__/utils/process.test.js +0 -818
  188. package/dist/__tests__/utils/process.test.js.map +0 -1
  189. package/dist/__tests__/utils/session.test.js +0 -175
  190. package/dist/__tests__/utils/session.test.js.map +0 -1
  191. package/project.json +0 -29
  192. package/scripts/benchmark-cold-start.mjs +0 -350
  193. package/src/AgentManager.ts +0 -559
  194. package/src/__tests__/AgentManager.test.ts +0 -1578
  195. package/src/__tests__/adapters/IncrementalSessionRefresh.test.ts +0 -437
  196. package/src/__tests__/adapters/adapterProcessImports.test.ts +0 -58
  197. package/src/__tests__/adapters/adapterSnapshotCandidates.test.ts +0 -243
  198. package/src/__tests__/capacity/anthropic.test.ts +0 -105
  199. package/src/__tests__/capacity/boundaries.test.ts +0 -36
  200. package/src/__tests__/capacity/claude.test.ts +0 -462
  201. package/src/__tests__/capacity/codex.test.ts +0 -311
  202. package/src/__tests__/capacity/devin.test.ts +0 -210
  203. package/src/__tests__/capacity/fixtures/claude-credentials.json +0 -7
  204. package/src/__tests__/capacity/fixtures/claude-usage-malformed.json +0 -1
  205. package/src/__tests__/capacity/fixtures/claude-usage-partial.json +0 -15
  206. package/src/__tests__/capacity/fixtures/claude-usage.json +0 -63
  207. package/src/__tests__/capacity/fixtures/devin-config.json +0 -6
  208. package/src/__tests__/capacity/fixtures/devin-credentials.toml +0 -4
  209. package/src/__tests__/capacity/fixtures/devin-quota-nonplan.json +0 -5
  210. package/src/__tests__/capacity/fixtures/devin-quota.json +0 -10
  211. package/src/__tests__/capacity/fixtures/openai-auth.json +0 -6
  212. package/src/__tests__/capacity/fixtures/openai-codex-auth.json +0 -9
  213. package/src/__tests__/capacity/fixtures/openai-usage-completions.json +0 -67
  214. package/src/__tests__/capacity/fixtures/openai-usage-responses.json +0 -20
  215. package/src/__tests__/capacity/fixtures/wham-usage.json +0 -45
  216. package/src/__tests__/capacity/fixtures/zai-auth.json +0 -6
  217. package/src/__tests__/capacity/fixtures/zai-quota-invalid.json +0 -7
  218. package/src/__tests__/capacity/fixtures/zai-quota.json +0 -38
  219. package/src/__tests__/capacity/index.test.ts +0 -54
  220. package/src/__tests__/capacity/openai.test.ts +0 -571
  221. package/src/__tests__/capacity/wham.test.ts +0 -122
  222. package/src/__tests__/capacity/zai.test.ts +0 -151
  223. package/src/__tests__/fixtures.test.ts +0 -245
  224. package/src/__tests__/harnesses/BoundedSummarySkip.test.ts +0 -496
  225. package/src/__tests__/harnesses/SessionSummaryEquivalence.test.ts +0 -726
  226. package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.ts +0 -133
  227. package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.ts +0 -396
  228. package/src/__tests__/harnesses/builtinAdapters.test.ts +0 -33
  229. package/src/__tests__/harnesses/claude/ClaudeAgentMapper.test.ts +0 -84
  230. package/src/__tests__/harnesses/claude/ClaudeCodeAdapter.test.ts +0 -1793
  231. package/src/__tests__/harnesses/claude/ClaudeSessionLocator.test.ts +0 -423
  232. package/src/__tests__/harnesses/claude/ClaudeSessionParser.test.ts +0 -300
  233. package/src/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.ts +0 -34
  234. package/src/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.ts +0 -61
  235. package/src/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.ts +0 -129
  236. package/src/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.ts +0 -152
  237. package/src/__tests__/harnesses/codex/CodexAdapter.test.ts +0 -652
  238. package/src/__tests__/harnesses/codex/CodexSessionLocator.test.ts +0 -419
  239. package/src/__tests__/harnesses/codex/CodexSessionMapping.test.ts +0 -63
  240. package/src/__tests__/harnesses/codex/CodexSessionParser.test.ts +0 -192
  241. package/src/__tests__/harnesses/codex/durable/CodexCliProbe.test.ts +0 -80
  242. package/src/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.ts +0 -65
  243. package/src/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.ts +0 -104
  244. package/src/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.ts +0 -201
  245. package/src/__tests__/harnesses/codex/durable/CodexPrintRunner.test.ts +0 -299
  246. package/src/__tests__/harnesses/copilot/CopilotAdapter.test.ts +0 -614
  247. package/src/__tests__/harnesses/copilot/CopilotRefreshIO.test.ts +0 -270
  248. package/src/__tests__/harnesses/devin/DevinAdapter.test.ts +0 -290
  249. package/src/__tests__/harnesses/devin/DevinAgentMapper.test.ts +0 -101
  250. package/src/__tests__/harnesses/devin/DevinSessionLocator.test.ts +0 -139
  251. package/src/__tests__/harnesses/devin/DevinSessionParser.test.ts +0 -212
  252. package/src/__tests__/harnesses/devin/fixtures.ts +0 -144
  253. package/src/__tests__/harnesses/gemini/GeminiCliAdapter.test.ts +0 -1336
  254. package/src/__tests__/harnesses/gemini/GeminiSessionJsonl.test.ts +0 -402
  255. package/src/__tests__/harnesses/gemini/GeminiSessionLocator.test.ts +0 -396
  256. package/src/__tests__/harnesses/grok/GrokAgentMapper.test.ts +0 -57
  257. package/src/__tests__/harnesses/grok/GrokCliAdapter.test.ts +0 -376
  258. package/src/__tests__/harnesses/grok/GrokIncrementalRefresh.test.ts +0 -170
  259. package/src/__tests__/harnesses/grok/GrokSessionLocator.test.ts +0 -106
  260. package/src/__tests__/harnesses/grok/GrokSessionParser.test.ts +0 -230
  261. package/src/__tests__/harnesses/kiro/KiroAdapter.test.ts +0 -552
  262. package/src/__tests__/harnesses/muse/MuseAdapter.test.ts +0 -197
  263. package/src/__tests__/harnesses/muse/MuseAgentMapper.test.ts +0 -83
  264. package/src/__tests__/harnesses/muse/MuseSessionLocator.test.ts +0 -177
  265. package/src/__tests__/harnesses/muse/MuseSessionParser.test.ts +0 -279
  266. package/src/__tests__/harnesses/opencode/OpenCodeAdapter.test.ts +0 -215
  267. package/src/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.ts +0 -101
  268. package/src/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.ts +0 -84
  269. package/src/__tests__/harnesses/opencode/OpenCodeSessionParser.test.ts +0 -149
  270. package/src/__tests__/harnesses/pi/PiAdapter.test.ts +0 -325
  271. package/src/__tests__/harnesses/pi/PiDiscoveryIO.test.ts +0 -337
  272. package/src/__tests__/harnesses/pi/PiSessionParser.test.ts +0 -280
  273. package/src/__tests__/harnesses/pi/PiSessionTracker.test.ts +0 -79
  274. package/src/__tests__/harnesses/pi/durable/PiCliProbe.test.ts +0 -50
  275. package/src/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.ts +0 -33
  276. package/src/__tests__/harnesses/pi/durable/PiPrintAgentService.test.ts +0 -138
  277. package/src/__tests__/harnesses/pi/durable/PiPrintProtocol.test.ts +0 -71
  278. package/src/__tests__/harnesses/pi/durable/PiPrintRunner.test.ts +0 -252
  279. package/src/__tests__/harnesses/pi/durable/PiStreamParser.test.ts +0 -26
  280. package/src/__tests__/harnesses/readiness/AgentReadiness.test.ts +0 -362
  281. package/src/__tests__/harnesses/runtimeProfiles.test.ts +0 -123
  282. package/src/__tests__/print/DurableAgent.test.ts +0 -15
  283. package/src/__tests__/print/DurableAgentRepository.sqlite.test.ts +0 -128
  284. package/src/__tests__/print/DurableAgentRepository.test.ts +0 -184
  285. package/src/__tests__/readiness-fixtures.test.ts +0 -79
  286. package/src/__tests__/runtime/AgentRuntime.test.ts +0 -8
  287. package/src/__tests__/runtime/HerdrAgentDiscovery.test.ts +0 -131
  288. package/src/__tests__/runtime/HerdrAgentRuntime.test.ts +0 -377
  289. package/src/__tests__/runtime/ManagedAgentRuntime.test.ts +0 -590
  290. package/src/__tests__/terminal/GhosttyBackend.test.ts +0 -271
  291. package/src/__tests__/terminal/TerminalFocusManager.test.ts +0 -280
  292. package/src/__tests__/terminal/TmuxManager.test.ts +0 -185
  293. package/src/__tests__/terminal/TtyWriter.test.ts +0 -454
  294. package/src/__tests__/utils/AgentRegistry.test.ts +0 -532
  295. package/src/__tests__/utils/IncrementalJsonlSummary.test.ts +0 -414
  296. package/src/__tests__/utils/agent-requests.test.ts +0 -94
  297. package/src/__tests__/utils/conversationTail.bench.test.ts +0 -193
  298. package/src/__tests__/utils/conversationTailParity.test.ts +0 -365
  299. package/src/__tests__/utils/jsonlTail.test.ts +0 -317
  300. package/src/__tests__/utils/matching.test.ts +0 -234
  301. package/src/__tests__/utils/matchingConstants.test.ts +0 -40
  302. package/src/__tests__/utils/process.test.ts +0 -596
  303. package/src/__tests__/utils/session.test.ts +0 -158
  304. package/src/adapters/AgentAdapter.ts +0 -255
  305. package/src/capacity/index.ts +0 -127
  306. package/src/capacity/providers/anthropic.ts +0 -198
  307. package/src/capacity/providers/devin.ts +0 -121
  308. package/src/capacity/providers/openai-platform.ts +0 -150
  309. package/src/capacity/providers/openai-subscription.ts +0 -184
  310. package/src/capacity/providers/zai.ts +0 -155
  311. package/src/capacity/sources/claude.ts +0 -30
  312. package/src/capacity/sources/codex.ts +0 -251
  313. package/src/capacity/sources/devin.ts +0 -49
  314. package/src/capacity/sources/pi.ts +0 -131
  315. package/src/capacity/types.ts +0 -29
  316. package/src/database/connection.ts +0 -96
  317. package/src/database/index.ts +0 -7
  318. package/src/database/migrations/001_initial.sql +0 -12
  319. package/src/database/migrations/002_pins.sql +0 -1
  320. package/src/database/migrations/003_durable_agents.sql +0 -43
  321. package/src/database/migrations/004_codex_durable_sessions.sql +0 -1
  322. package/src/database/migrations/005_agent_runtime.sql +0 -2
  323. package/src/database/schema.ts +0 -64
  324. package/src/durable/DurableAgent.ts +0 -139
  325. package/src/durable/DurableAgentRepository.ts +0 -485
  326. package/src/durable/process.ts +0 -29
  327. package/src/durable/run.ts +0 -84
  328. package/src/durable/utils.ts +0 -66
  329. package/src/fixtures/bundle.ts +0 -130
  330. package/src/fixtures/capture.ts +0 -364
  331. package/src/harnesses/antigravity/AntigravityAgentMapper.ts +0 -34
  332. package/src/harnesses/antigravity/AntigravityCliAdapter.ts +0 -126
  333. package/src/harnesses/antigravity/AntigravitySessionLocator.ts +0 -75
  334. package/src/harnesses/antigravity/AntigravitySessionParser.ts +0 -252
  335. package/src/harnesses/claude/ClaudeAgentMapper.ts +0 -55
  336. package/src/harnesses/claude/ClaudeCodeAdapter.ts +0 -175
  337. package/src/harnesses/claude/ClaudeSessionLocator.ts +0 -358
  338. package/src/harnesses/claude/ClaudeSessionParser.ts +0 -524
  339. package/src/harnesses/claude/credentials.ts +0 -122
  340. package/src/harnesses/claude/durable/ClaudeCliProbe.ts +0 -57
  341. package/src/harnesses/claude/durable/ClaudePrintAgentService.ts +0 -79
  342. package/src/harnesses/claude/durable/ClaudePrintRunner.ts +0 -102
  343. package/src/harnesses/claude/durable/ClaudeStreamParser.ts +0 -108
  344. package/src/harnesses/claude/readiness.ts +0 -69
  345. package/src/harnesses/codex/CodexAdapter.ts +0 -337
  346. package/src/harnesses/codex/CodexAgentMapper.ts +0 -26
  347. package/src/harnesses/codex/CodexSessionLocator.ts +0 -509
  348. package/src/harnesses/codex/CodexSessionMapping.ts +0 -89
  349. package/src/harnesses/codex/CodexSessionParser.ts +0 -462
  350. package/src/harnesses/codex/credentials.ts +0 -81
  351. package/src/harnesses/codex/durable/CodexCliProbe.ts +0 -68
  352. package/src/harnesses/codex/durable/CodexPrintAgentService.ts +0 -79
  353. package/src/harnesses/codex/durable/CodexPrintRunner.ts +0 -104
  354. package/src/harnesses/codex/durable/CodexStreamParser.ts +0 -117
  355. package/src/harnesses/codex/readiness.ts +0 -72
  356. package/src/harnesses/copilot/CopilotAdapter.ts +0 -161
  357. package/src/harnesses/copilot/CopilotAgentMapper.ts +0 -27
  358. package/src/harnesses/copilot/CopilotSessionLocator.ts +0 -161
  359. package/src/harnesses/copilot/CopilotSessionParser.ts +0 -380
  360. package/src/harnesses/copilot/readiness.ts +0 -33
  361. package/src/harnesses/devin/DevinAdapter.ts +0 -212
  362. package/src/harnesses/devin/DevinAgentMapper.ts +0 -39
  363. package/src/harnesses/devin/DevinSessionLocator.ts +0 -230
  364. package/src/harnesses/devin/DevinSessionParser.ts +0 -227
  365. package/src/harnesses/devin/credentials.ts +0 -88
  366. package/src/harnesses/devin/readiness.ts +0 -36
  367. package/src/harnesses/gemini/GeminiAgentMapper.ts +0 -27
  368. package/src/harnesses/gemini/GeminiCliAdapter.ts +0 -272
  369. package/src/harnesses/gemini/GeminiSessionLocator.ts +0 -394
  370. package/src/harnesses/gemini/GeminiSessionParser.ts +0 -395
  371. package/src/harnesses/gemini/fileSignature.ts +0 -10
  372. package/src/harnesses/grok/GrokAgentMapper.ts +0 -32
  373. package/src/harnesses/grok/GrokCliAdapter.ts +0 -126
  374. package/src/harnesses/grok/GrokSessionLocator.ts +0 -179
  375. package/src/harnesses/grok/GrokSessionParser.ts +0 -251
  376. package/src/harnesses/index.ts +0 -32
  377. package/src/harnesses/kiro/KiroAdapter.ts +0 -143
  378. package/src/harnesses/kiro/KiroAgentMapper.ts +0 -34
  379. package/src/harnesses/kiro/KiroSessionLocator.ts +0 -143
  380. package/src/harnesses/kiro/KiroSessionParser.ts +0 -376
  381. package/src/harnesses/muse/MuseAdapter.ts +0 -157
  382. package/src/harnesses/muse/MuseAgentMapper.ts +0 -33
  383. package/src/harnesses/muse/MuseSessionLocator.ts +0 -286
  384. package/src/harnesses/muse/MuseSessionParser.ts +0 -435
  385. package/src/harnesses/muse/readiness.ts +0 -38
  386. package/src/harnesses/opencode/OpenCodeAdapter.ts +0 -110
  387. package/src/harnesses/opencode/OpenCodeAgentMapper.ts +0 -49
  388. package/src/harnesses/opencode/OpenCodeSessionLocator.ts +0 -151
  389. package/src/harnesses/opencode/OpenCodeSessionParser.ts +0 -146
  390. package/src/harnesses/opencode/readiness.ts +0 -48
  391. package/src/harnesses/pi/PiAdapter.ts +0 -197
  392. package/src/harnesses/pi/PiAgentMapper.ts +0 -27
  393. package/src/harnesses/pi/PiSessionLocator.ts +0 -288
  394. package/src/harnesses/pi/PiSessionParser.ts +0 -488
  395. package/src/harnesses/pi/PiSessionTracker.ts +0 -87
  396. package/src/harnesses/pi/credentials.ts +0 -129
  397. package/src/harnesses/pi/durable/PiCliProbe.ts +0 -56
  398. package/src/harnesses/pi/durable/PiPrintAgentService.ts +0 -77
  399. package/src/harnesses/pi/durable/PiPrintProtocol.ts +0 -41
  400. package/src/harnesses/pi/durable/PiPrintRunner.ts +0 -95
  401. package/src/harnesses/pi/durable/PiStreamParser.ts +0 -94
  402. package/src/harnesses/pi/readiness.ts +0 -104
  403. package/src/harnesses/readiness/AgentReadiness.ts +0 -91
  404. package/src/harnesses/readiness/checks.ts +0 -336
  405. package/src/harnesses/readiness/types.ts +0 -90
  406. package/src/harnesses/runtimeProfiles.ts +0 -105
  407. package/src/harnesses/shared.ts +0 -124
  408. package/src/index.ts +0 -71
  409. package/src/runtime/ManagedAgentRuntime.ts +0 -253
  410. package/src/runtime/RuntimeFactory.ts +0 -13
  411. package/src/runtime/errors.ts +0 -50
  412. package/src/runtime/herdr/HerdrAgentDiscovery.ts +0 -166
  413. package/src/runtime/herdr/HerdrAgentRuntime.ts +0 -216
  414. package/src/runtime/herdr/HerdrCliClient.ts +0 -78
  415. package/src/runtime/herdr/HerdrErrors.ts +0 -9
  416. package/src/runtime/herdr/HerdrResponseParsers.ts +0 -86
  417. package/src/runtime/herdr/HerdrRuntimeRef.ts +0 -41
  418. package/src/runtime/tmux/PidPolling.ts +0 -34
  419. package/src/runtime/tmux/TmuxAgentRuntime.ts +0 -113
  420. package/src/runtime/tmux/TmuxManager.ts +0 -102
  421. package/src/runtime/tmux/TmuxRuntimeRef.ts +0 -9
  422. package/src/runtime/types.ts +0 -56
  423. package/src/terminal/TerminalFocusManager.ts +0 -52
  424. package/src/terminal/TtyWriter.ts +0 -26
  425. package/src/terminal/backends/ghostty.ts +0 -180
  426. package/src/terminal/backends/index.ts +0 -23
  427. package/src/terminal/backends/iterm2.ts +0 -126
  428. package/src/terminal/backends/shared.ts +0 -47
  429. package/src/terminal/backends/terminal-app.ts +0 -122
  430. package/src/terminal/backends/tmux.ts +0 -62
  431. package/src/terminal/backends/wezterm.ts +0 -65
  432. package/src/terminal/types.ts +0 -23
  433. package/src/utils/AgentRegistry.ts +0 -351
  434. package/src/utils/IncrementalJsonlSummary.ts +0 -306
  435. package/src/utils/agent-requests.ts +0 -28
  436. package/src/utils/applescript.ts +0 -10
  437. package/src/utils/jsonlTail.ts +0 -349
  438. package/src/utils/matching.ts +0 -96
  439. package/src/utils/matchingConstants.ts +0 -15
  440. package/src/utils/process.ts +0 -604
  441. package/src/utils/session.ts +0 -144
  442. package/src/utils/sortAgents.ts +0 -54
  443. package/tsconfig.json +0 -11
  444. package/vitest.config.ts +0 -20
@@ -1,1089 +0,0 @@
1
- /**
2
- * Equivalence between the incremental session summaries used on refresh and
3
- * the full-file parse of Claude, Codex, Kiro and Antigravity transcripts.
4
- *
5
- * `legacyClaudeReadSession` / `legacyCodexReadSession` are verbatim copies of
6
- * the pre-incremental `readSession` algorithms, kept here as an oracle. Kiro
7
- * and Antigravity are checked against their own full `readSession`.
8
- */ import * as fs from "fs";
9
- import * as os from "os";
10
- import * as path from "path";
11
- import { AntigravitySessionParser } from "../../harnesses/antigravity/AntigravitySessionParser.js";
12
- import { ClaudeSessionParser } from "../../harnesses/claude/ClaudeSessionParser.js";
13
- import { CodexSessionParser } from "../../harnesses/codex/CodexSessionParser.js";
14
- import { KiroSessionParser } from "../../harnesses/kiro/KiroSessionParser.js";
15
- import { parseTimestamp, truncate } from "../../harnesses/shared.js";
16
- const CONVERSATION_ENTRY_TYPES = new Set([
17
- "user",
18
- "assistant",
19
- "system",
20
- "progress",
21
- "thinking"
22
- ]);
23
- function legacyClaudeReadSession(parser, filePath, projectPath) {
24
- const p = parser;
25
- const sessionId = path.basename(filePath, ".jsonl");
26
- const content = fs.readFileSync(filePath, "utf-8");
27
- const allLines = content.trim().split("\n");
28
- let sessionStart = null;
29
- try {
30
- const firstEntry = JSON.parse(allLines[0]);
31
- const rawTs = firstEntry.timestamp || firstEntry.snapshot?.timestamp;
32
- if (rawTs && !Number.isNaN(new Date(rawTs).getTime())) sessionStart = new Date(rawTs);
33
- } catch {
34
- /* malformed first line */ }
35
- let lastEntryType;
36
- let lastActive;
37
- let lastCwd;
38
- let isInterrupted = false;
39
- let lastUserMessage;
40
- let firstUserMessage;
41
- for (const line of allLines){
42
- try {
43
- const entry = JSON.parse(line);
44
- if (entry.timestamp) {
45
- const ts = new Date(entry.timestamp);
46
- if (!Number.isNaN(ts.getTime())) lastActive = ts;
47
- }
48
- if (typeof entry.cwd === "string" && entry.cwd.trim().length > 0) lastCwd = entry.cwd;
49
- if (entry.type && CONVERSATION_ENTRY_TYPES.has(entry.type)) {
50
- lastEntryType = entry.type;
51
- if (entry.type === "user") {
52
- const msgContent = entry.message?.content;
53
- isInterrupted = Array.isArray(msgContent) && msgContent.some((c)=>c.type === "text" && c.text?.includes("[Request interrupted") || c.type === "tool_result" && c.content?.includes("[Request interrupted"));
54
- const text = p.extractUserMessageText(msgContent);
55
- if (text) {
56
- lastUserMessage = text;
57
- if (!firstUserMessage) firstUserMessage = text;
58
- }
59
- } else {
60
- isInterrupted = false;
61
- }
62
- }
63
- } catch {
64
- continue;
65
- }
66
- }
67
- return {
68
- sessionId,
69
- projectPath: projectPath || lastCwd || "",
70
- lastCwd,
71
- sessionStart: sessionStart || lastActive || new Date(),
72
- lastActive: lastActive || new Date(),
73
- lastEntryType,
74
- isInterrupted,
75
- lastUserMessage,
76
- firstUserMessage
77
- };
78
- }
79
- function legacyCodexReadSession(parser, filePath) {
80
- const p = parser;
81
- const content = fs.readFileSync(filePath, "utf-8");
82
- const allLines = content.trim().split("\n");
83
- if (!allLines[0]) return null;
84
- let metaEntry;
85
- try {
86
- metaEntry = JSON.parse(allLines[0]);
87
- } catch {
88
- return null;
89
- }
90
- if (metaEntry?.type !== "session_meta" || !metaEntry.payload?.id) return null;
91
- const entries = [];
92
- for (const line of allLines){
93
- try {
94
- entries.push(JSON.parse(line));
95
- } catch {
96
- continue;
97
- }
98
- }
99
- let lastEntry;
100
- for(let i = entries.length - 1; i >= 0; i--){
101
- if (entries[i] && typeof entries[i].type === "string") {
102
- lastEntry = entries[i];
103
- break;
104
- }
105
- }
106
- let summary = "Codex session active";
107
- for(let i = entries.length - 1; i >= 0; i--){
108
- const message = p.extractEntryText(entries[i]);
109
- if (message) {
110
- summary = truncate(message, 120);
111
- break;
112
- }
113
- }
114
- const lastActive = parseTimestamp(lastEntry?.timestamp) || parseTimestamp(metaEntry.payload.timestamp) || fs.statSync(filePath).mtime;
115
- const sessionStart = parseTimestamp(metaEntry.payload.timestamp) || lastActive;
116
- return {
117
- sessionId: metaEntry.payload.id,
118
- projectPath: metaEntry.payload.cwd || "",
119
- summary,
120
- sessionStart,
121
- lastActive,
122
- lastPayloadType: lastEntry ? p.normalizedPayloadType(lastEntry) : undefined
123
- };
124
- }
125
- const text = (value)=>[
126
- {
127
- type: "text",
128
- text: value
129
- }
130
- ];
131
- /** Synthetic transcripts covering the shapes used by the existing Claude fixtures. */ const claudeFixtures = {
132
- basic: [
133
- {
134
- type: "user",
135
- timestamp: "2026-03-10T10:00:00Z",
136
- cwd: "/my/project",
137
- message: {
138
- content: "hello"
139
- }
140
- },
141
- {
142
- type: "assistant",
143
- timestamp: "2026-03-10T10:01:00Z",
144
- message: {
145
- content: text("hi")
146
- }
147
- }
148
- ],
149
- interrupted: [
150
- {
151
- type: "assistant",
152
- timestamp: "2026-03-10T10:00:00Z"
153
- },
154
- {
155
- type: "user",
156
- timestamp: "2026-03-10T10:01:00Z",
157
- message: {
158
- content: text("[Request interrupted by user for tool use]")
159
- }
160
- }
161
- ],
162
- interruptedToolResult: [
163
- {
164
- type: "user",
165
- timestamp: "2026-03-10T10:00:00Z",
166
- message: {
167
- content: [
168
- {
169
- type: "tool_result",
170
- content: "[Request interrupted by user]"
171
- }
172
- ]
173
- }
174
- }
175
- ],
176
- metadataTail: [
177
- {
178
- type: "user",
179
- timestamp: "2026-03-10T10:00:00Z",
180
- message: {
181
- content: text("question")
182
- }
183
- },
184
- {
185
- type: "assistant",
186
- timestamp: "2026-03-10T10:01:00Z"
187
- },
188
- {
189
- type: "last-prompt",
190
- timestamp: "2026-03-10T10:02:00Z"
191
- },
192
- {
193
- type: "file-history-snapshot",
194
- timestamp: "2026-03-10T10:03:00Z"
195
- }
196
- ],
197
- snapshotFirst: [
198
- {
199
- type: "file-history-snapshot",
200
- snapshot: {
201
- timestamp: "2026-03-10T09:59:00Z"
202
- }
203
- },
204
- {
205
- type: "user",
206
- timestamp: "2026-03-10T10:00:00Z",
207
- cwd: "/repo",
208
- message: {
209
- content: "start"
210
- }
211
- },
212
- {
213
- type: "assistant",
214
- timestamp: "2026-03-10T10:01:00Z"
215
- }
216
- ],
217
- multipleUsers: [
218
- {
219
- type: "user",
220
- timestamp: "2026-03-10T10:00:00Z",
221
- message: {
222
- content: text("first question")
223
- }
224
- },
225
- {
226
- type: "assistant",
227
- timestamp: "2026-03-10T10:01:00Z"
228
- },
229
- {
230
- type: "user",
231
- timestamp: "2026-03-10T10:02:00Z",
232
- message: {
233
- content: text("second question")
234
- }
235
- },
236
- {
237
- type: "assistant",
238
- timestamp: "2026-03-10T10:03:00Z"
239
- }
240
- ],
241
- commandsAndSkills: [
242
- {
243
- type: "user",
244
- timestamp: "2026-03-10T10:00:00Z",
245
- message: {
246
- content: "<command-message>review</command-message><command-name>/review</command-name><command-args>src</command-args>"
247
- }
248
- },
249
- {
250
- type: "user",
251
- timestamp: "2026-03-10T10:01:00Z",
252
- message: {
253
- content: text("Base directory for this skill: /skills/x\n\nARGUMENTS: do the thing")
254
- }
255
- },
256
- {
257
- type: "user",
258
- timestamp: "2026-03-10T10:02:00Z",
259
- message: {
260
- content: "Tool loaded."
261
- }
262
- },
263
- {
264
- type: "user",
265
- timestamp: "2026-03-10T10:03:00Z",
266
- message: {
267
- content: "This session is being continued from a previous one"
268
- }
269
- }
270
- ],
271
- uiStateTail: [
272
- {
273
- type: "user",
274
- timestamp: "2026-05-30T06:17:57.189Z",
275
- message: {
276
- content: "hello"
277
- }
278
- },
279
- {
280
- type: "attachment",
281
- timestamp: "2026-05-30T06:17:57.200Z",
282
- attachment: {
283
- type: "task_reminder",
284
- content: []
285
- }
286
- },
287
- {
288
- type: "permission-mode",
289
- timestamp: "2026-05-30T06:17:57.210Z",
290
- permissionMode: "default"
291
- },
292
- {
293
- type: "ai-title",
294
- timestamp: "2026-05-30T06:17:57.220Z"
295
- }
296
- ],
297
- progressAndSystem: [
298
- {
299
- type: "user",
300
- timestamp: "2026-03-10T10:00:00Z",
301
- message: {
302
- content: "go"
303
- }
304
- },
305
- {
306
- type: "progress",
307
- timestamp: "2026-03-10T10:00:01Z"
308
- },
309
- {
310
- type: "thinking",
311
- timestamp: "2026-03-10T10:00:02Z"
312
- },
313
- {
314
- type: "system",
315
- timestamp: "2026-03-10T10:00:03Z",
316
- cwd: " "
317
- }
318
- ],
319
- noTimestamps: [
320
- {
321
- type: "assistant"
322
- },
323
- {
324
- type: "user",
325
- message: {
326
- content: "no time"
327
- }
328
- }
329
- ],
330
- invalidTimestamp: [
331
- {
332
- type: "user",
333
- timestamp: "not-a-date",
334
- message: {
335
- content: "bad time"
336
- }
337
- },
338
- {
339
- type: "assistant",
340
- timestamp: "2026-03-10T10:01:00Z"
341
- }
342
- ],
343
- cwdChanges: [
344
- {
345
- type: "user",
346
- timestamp: "2026-03-10T10:00:00Z",
347
- cwd: "/a"
348
- },
349
- {
350
- type: "assistant",
351
- timestamp: "2026-03-10T10:01:00Z",
352
- cwd: "/b"
353
- }
354
- ],
355
- empty: []
356
- };
357
- /** Synthetic transcripts covering the shapes used by the existing Codex fixtures. */ const codexFixtures = {
358
- legacyEvents: [
359
- {
360
- type: "session_meta",
361
- payload: {
362
- id: "sess-1",
363
- timestamp: "2026-03-18T15:00:00Z",
364
- cwd: "/repo"
365
- }
366
- },
367
- {
368
- type: "event",
369
- timestamp: "2026-03-18T15:01:00Z",
370
- payload: {
371
- type: "agent_reasoning",
372
- message: "Working on feature"
373
- }
374
- }
375
- ],
376
- responseItems: [
377
- {
378
- type: "session_meta",
379
- payload: {
380
- id: "sess-2",
381
- cwd: "/repo",
382
- timestamp: "2026-03-27T10:00:00Z"
383
- }
384
- },
385
- {
386
- type: "response_item",
387
- timestamp: "2026-03-27T10:00:01Z",
388
- payload: {
389
- type: "message",
390
- role: "user",
391
- content: [
392
- {
393
- type: "input_text",
394
- text: "Fix the bug"
395
- }
396
- ]
397
- }
398
- },
399
- {
400
- type: "event_msg",
401
- timestamp: "2026-03-27T10:00:02Z",
402
- payload: {
403
- type: "user_message",
404
- message: "Fix the bug"
405
- }
406
- },
407
- {
408
- type: "response_item",
409
- timestamp: "2026-03-27T10:00:03Z",
410
- payload: {
411
- type: "message",
412
- role: "assistant",
413
- content: [
414
- {
415
- type: "output_text",
416
- text: "Done. ".repeat(40)
417
- }
418
- ]
419
- }
420
- },
421
- {
422
- type: "event_msg",
423
- timestamp: "2026-03-27T10:00:04Z",
424
- payload: {
425
- type: "token_count"
426
- }
427
- }
428
- ],
429
- itemCompleted: [
430
- {
431
- type: "session_meta",
432
- payload: {
433
- id: "sess-3",
434
- cwd: "/repo"
435
- }
436
- },
437
- {
438
- type: "event_msg",
439
- timestamp: "2026-03-27T10:00:01Z",
440
- payload: {
441
- type: "item_completed",
442
- item: {
443
- type: "UserMessage",
444
- content: "hello"
445
- }
446
- }
447
- },
448
- {
449
- type: "event_msg",
450
- timestamp: "2026-03-27T10:00:02Z",
451
- payload: {
452
- type: "item_completed",
453
- item: {
454
- type: "AgentMessage",
455
- content: [
456
- {
457
- type: "text",
458
- text: "answer"
459
- }
460
- ]
461
- }
462
- }
463
- },
464
- {
465
- type: "event_msg",
466
- payload: {
467
- type: "item_completed",
468
- item: {
469
- type: "Reasoning"
470
- }
471
- }
472
- }
473
- ],
474
- turnAborted: [
475
- {
476
- type: "session_meta",
477
- payload: {
478
- id: "sess-4",
479
- timestamp: "2026-03-18T15:00:00Z"
480
- }
481
- },
482
- {
483
- type: "event_msg",
484
- timestamp: "2026-03-18T15:01:00Z",
485
- payload: {
486
- type: "task_complete",
487
- message: "finished"
488
- }
489
- },
490
- {
491
- type: "event_msg",
492
- timestamp: "2026-03-18T15:02:00Z",
493
- payload: {
494
- type: "turn_aborted"
495
- }
496
- }
497
- ],
498
- untypedTail: [
499
- {
500
- type: "session_meta",
501
- payload: {
502
- id: "sess-5",
503
- timestamp: "2026-03-18T15:00:00Z"
504
- }
505
- },
506
- {
507
- type: "event",
508
- timestamp: "2026-03-18T15:01:00Z",
509
- payload: {
510
- type: "agent_message",
511
- message: "hi"
512
- }
513
- },
514
- {
515
- payload: {
516
- message: "untyped trailing line"
517
- }
518
- }
519
- ],
520
- metaOnlyNoTimestamp: [
521
- {
522
- type: "session_meta",
523
- payload: {
524
- id: "sess-6"
525
- }
526
- }
527
- ],
528
- notSessionMeta: [
529
- {
530
- type: "event",
531
- payload: {}
532
- }
533
- ],
534
- metaWithoutId: [
535
- {
536
- type: "session_meta",
537
- payload: {
538
- cwd: "/repo"
539
- }
540
- }
541
- ],
542
- empty: []
543
- };
544
- const kiroText = (value)=>[
545
- {
546
- kind: "text",
547
- data: value
548
- }
549
- ];
550
- const kiroFixtures = {
551
- promptAndReply: [
552
- {
553
- kind: "Prompt",
554
- data: {
555
- content: kiroText("first"),
556
- meta: {
557
- timestamp: 1781098057
558
- }
559
- }
560
- },
561
- {
562
- kind: "AssistantMessage",
563
- timestamp: "2026-06-10T13:28:00Z",
564
- data: {
565
- content: kiroText("ok")
566
- }
567
- },
568
- {
569
- kind: "Prompt",
570
- data: {
571
- content: kiroText("second"),
572
- meta: {
573
- timestamp: 1781098200
574
- }
575
- }
576
- }
577
- ],
578
- toolUseLast: [
579
- {
580
- kind: "Prompt",
581
- data: {
582
- content: kiroText("read it"),
583
- meta: {
584
- timestamp: 1781098057
585
- }
586
- }
587
- },
588
- {
589
- kind: "AssistantMessage",
590
- data: {
591
- content: [
592
- {
593
- kind: "toolUse",
594
- data: {
595
- name: "fs_read",
596
- input: {
597
- path: "a"
598
- }
599
- }
600
- }
601
- ]
602
- }
603
- },
604
- {
605
- kind: "ToolResults",
606
- data: {
607
- content: [
608
- {
609
- kind: "toolResult",
610
- data: {
611
- result: "x"
612
- }
613
- }
614
- ]
615
- }
616
- }
617
- ],
618
- untimedWithNonObjects: [
619
- {
620
- kind: "Prompt",
621
- data: {
622
- content: kiroText("no clock")
623
- }
624
- },
625
- null,
626
- [
627
- 1,
628
- 2
629
- ],
630
- "a string",
631
- {
632
- kind: "AssistantMessage",
633
- data: {
634
- content: kiroText("reply")
635
- }
636
- }
637
- ]
638
- };
639
- const agyFixtures = {
640
- requestAndReply: [
641
- {
642
- type: "USER_INPUT",
643
- created_at: "2026-09-28T10:00:00Z",
644
- content: "<USER_REQUEST>\nfirst\n</USER_REQUEST>"
645
- },
646
- {
647
- type: "RUN_COMMAND",
648
- created_at: "2026-09-28T10:00:05Z",
649
- content: "ls"
650
- },
651
- {
652
- type: "PLANNER_RESPONSE",
653
- created_at: "2026-09-28T10:00:09Z",
654
- content: "done"
655
- },
656
- {
657
- type: "USER_INPUT",
658
- created_at: "2026-09-28T10:01:00Z",
659
- content: [
660
- {
661
- text: "second"
662
- }
663
- ]
664
- }
665
- ],
666
- outOfOrderTimestamps: [
667
- {
668
- type: "USER_INPUT",
669
- created_at: "2026-09-28T10:05:00Z",
670
- content: "late"
671
- },
672
- {
673
- type: "PLANNER_RESPONSE",
674
- created_at: "2026-09-28T10:01:00Z",
675
- content: "early"
676
- }
677
- ],
678
- untimedWithNonObjects: [
679
- {
680
- type: "USER_INPUT",
681
- content: " "
682
- },
683
- null,
684
- {
685
- type: "USER_INPUT",
686
- content: "<USER_REQUEST></USER_REQUEST>"
687
- },
688
- "a string",
689
- {
690
- type: "PLANNER_RESPONSE",
691
- content: "reply"
692
- }
693
- ]
694
- };
695
- function variants(fixtures) {
696
- const out = [];
697
- for (const [name, entries] of Object.entries(fixtures)){
698
- const lines = entries.map((entry)=>JSON.stringify(entry));
699
- out.push({
700
- name,
701
- lines,
702
- trailingNewline: true
703
- });
704
- out.push({
705
- name: `${name} (no trailing newline)`,
706
- lines,
707
- trailingNewline: false
708
- });
709
- if (lines.length > 1) {
710
- const noisy = [
711
- ...lines
712
- ];
713
- noisy.splice(1, 0, "{not json", "", " ");
714
- out.push({
715
- name: `${name} (malformed + blank lines)`,
716
- lines: noisy,
717
- trailingNewline: true
718
- });
719
- }
720
- }
721
- return out;
722
- }
723
- function render(fixture) {
724
- return Buffer.from(fixture.lines.join("\n") + (fixture.trailingNewline ? "\n" : ""));
725
- }
726
- /** Byte offsets to split an append at: every line boundary plus mid-line offsets. */ function splitPoints(buffer) {
727
- const points = new Set([
728
- 0,
729
- buffer.length
730
- ]);
731
- for(let i = 0; i < buffer.length; i++){
732
- if (buffer[i] === 0x0a) {
733
- points.add(i);
734
- points.add(i + 1);
735
- }
736
- }
737
- for(let i = 1; i < 8; i++)points.add(Math.floor(buffer.length * i / 8));
738
- return [
739
- ...points
740
- ].sort((a, b)=>a - b);
741
- }
742
- describe("incremental session summaries match the full-file parse", ()=>{
743
- let tmpDir;
744
- beforeEach(()=>{
745
- vi.useFakeTimers({
746
- toFake: [
747
- "Date"
748
- ]
749
- });
750
- vi.setSystemTime(new Date("2026-09-28T00:00:00Z"));
751
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "summary-equivalence-"));
752
- });
753
- afterEach(()=>{
754
- vi.useRealTimers();
755
- fs.rmSync(tmpDir, {
756
- recursive: true,
757
- force: true
758
- });
759
- });
760
- it.each(variants(claudeFixtures))("Claude: $name", (fixture)=>{
761
- const buffer = render(fixture);
762
- const filePath = path.join(tmpDir, "11111111-2222-3333-4444-555555555555.jsonl");
763
- fs.writeFileSync(filePath, buffer);
764
- const oracle = legacyClaudeReadSession(new ClaudeSessionParser(), filePath, "");
765
- expect(new ClaudeSessionParser().readSession(filePath, "")).toEqual(oracle);
766
- for (const split of splitPoints(buffer)){
767
- const parser = new ClaudeSessionParser();
768
- fs.writeFileSync(filePath, buffer.subarray(0, split));
769
- parser.readSessionIncremental(filePath, "");
770
- fs.appendFileSync(filePath, buffer.subarray(split));
771
- expect(parser.readSessionIncremental(filePath, ""), `split at ${split}`).toEqual(oracle);
772
- expect(parser.readSessionIncremental(filePath, "")).toEqual(oracle);
773
- }
774
- });
775
- it.each(variants(codexFixtures))("Codex: $name", (fixture)=>{
776
- const buffer = render(fixture);
777
- const filePath = path.join(tmpDir, "rollout.jsonl");
778
- fs.writeFileSync(filePath, buffer);
779
- const oracle = legacyCodexReadSession(new CodexSessionParser(), filePath);
780
- expect(new CodexSessionParser().readSession(filePath)).toEqual(oracle);
781
- for (const split of splitPoints(buffer)){
782
- const parser = new CodexSessionParser();
783
- fs.writeFileSync(filePath, buffer.subarray(0, split));
784
- parser.readSessionIncremental(filePath);
785
- fs.appendFileSync(filePath, buffer.subarray(split));
786
- const expected = legacyCodexReadSession(parser, filePath);
787
- expect(parser.readSessionIncremental(filePath), `split at ${split}`).toEqual(expected);
788
- expect(parser.readSessionIncremental(filePath)).toEqual(expected);
789
- }
790
- });
791
- it.each(variants(kiroFixtures))("Kiro: $name", (fixture)=>{
792
- const buffer = render(fixture);
793
- const paths = {
794
- sessionId: "kiro-session",
795
- transcriptPath: path.join(tmpDir, "kiro-session.jsonl"),
796
- metadataPath: path.join(tmpDir, "kiro-session.json")
797
- };
798
- for (const split of splitPoints(buffer)){
799
- const parser = new KiroSessionParser();
800
- fs.writeFileSync(paths.transcriptPath, buffer.subarray(0, split));
801
- parser.readSessionIncremental(paths, "/repo");
802
- fs.appendFileSync(paths.transcriptPath, buffer.subarray(split));
803
- const expected = new KiroSessionParser().readSession(paths, "/repo");
804
- expect(parser.readSessionIncremental(paths, "/repo"), `split at ${split}`).toEqual(expected);
805
- expect(parser.readSessionIncremental(paths, "/repo")).toEqual(expected);
806
- }
807
- });
808
- it.each(variants(agyFixtures))("Antigravity: $name", (fixture)=>{
809
- const buffer = render(fixture);
810
- const filePath = path.join(tmpDir, "transcript.jsonl");
811
- const read = (parser, incremental)=>incremental ? parser.readSessionIncremental("conv", filePath, "/repo") : parser.readSession("conv", filePath, "/repo");
812
- for (const split of splitPoints(buffer)){
813
- const parser = new AntigravitySessionParser();
814
- fs.writeFileSync(filePath, buffer.subarray(0, split));
815
- read(parser, true);
816
- fs.appendFileSync(filePath, buffer.subarray(split));
817
- const expected = read(new AntigravitySessionParser(), false);
818
- expect(read(parser, true), `split at ${split}`).toEqual(expected);
819
- expect(read(parser, true)).toEqual(expected);
820
- }
821
- });
822
- });
823
- /**
824
- * Bounded cold start: `[fixture, neutral padding, fixture]` is larger than the
825
- * head + tail windows, each window covers one full copy of the fixture, and
826
- * the padding never changes a summary field. The bounded summary (which skips
827
- * the middle) must therefore equal the full-file parse.
828
- */ describe("bounded cold-start summaries match the full-file parse", ()=>{
829
- let tmpDir;
830
- beforeEach(()=>{
831
- vi.useFakeTimers({
832
- toFake: [
833
- "Date"
834
- ]
835
- });
836
- vi.setSystemTime(new Date("2026-09-28T00:00:00Z"));
837
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "bounded-equivalence-"));
838
- });
839
- afterEach(()=>{
840
- vi.useRealTimers();
841
- fs.rmSync(tmpDir, {
842
- recursive: true,
843
- force: true
844
- });
845
- });
846
- function mirrored(fixture, padLine) {
847
- const window = Buffer.byteLength(fixture.lines.join("\n") + "\n") + 16;
848
- const padCount = Math.ceil(2 * window / padLine.length) + 4;
849
- const padding = Array.from({
850
- length: padCount
851
- }, ()=>padLine);
852
- const buffer = render({
853
- ...fixture,
854
- lines: [
855
- ...fixture.lines,
856
- ...padding,
857
- ...fixture.lines
858
- ]
859
- });
860
- expect(buffer.length).toBeGreaterThan(2 * window);
861
- return {
862
- buffer,
863
- bounds: {
864
- headBytes: window,
865
- tailBytes: window
866
- }
867
- };
868
- }
869
- it.each(variants(claudeFixtures))("Claude: $name", (fixture)=>{
870
- const { buffer, bounds } = mirrored(fixture, JSON.stringify({
871
- type: "attachment"
872
- }));
873
- const filePath = path.join(tmpDir, "11111111-2222-3333-4444-555555555555.jsonl");
874
- fs.writeFileSync(filePath, buffer);
875
- const parser = new ClaudeSessionParser({
876
- summaryBounds: bounds
877
- });
878
- const oracle = legacyClaudeReadSession(parser, filePath, "");
879
- expect(parser.readSessionIncremental(filePath, "")).toEqual(oracle);
880
- expect(parser.sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
881
- });
882
- it.each(variants(codexFixtures))("Codex: $name", (fixture)=>{
883
- const { buffer, bounds } = mirrored(fixture, JSON.stringify({
884
- payload: {}
885
- }));
886
- const filePath = path.join(tmpDir, "rollout.jsonl");
887
- fs.writeFileSync(filePath, buffer);
888
- const parser = new CodexSessionParser({
889
- summaryBounds: bounds
890
- });
891
- const oracle = legacyCodexReadSession(parser, filePath);
892
- expect(parser.readSessionIncremental(filePath)).toEqual(oracle);
893
- expect(parser.sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
894
- });
895
- it.each(variants(kiroFixtures))("Kiro: $name", (fixture)=>{
896
- const { buffer, bounds } = mirrored(fixture, JSON.stringify({
897
- kind: "Checkpoint"
898
- }));
899
- const paths = {
900
- sessionId: "kiro-session",
901
- transcriptPath: path.join(tmpDir, "kiro-session.jsonl"),
902
- metadataPath: path.join(tmpDir, "kiro-session.json")
903
- };
904
- fs.writeFileSync(paths.transcriptPath, buffer);
905
- const parser = new KiroSessionParser({
906
- summaryBounds: bounds
907
- });
908
- expect(parser.readSessionIncremental(paths, "/repo")).toEqual(new KiroSessionParser().readSession(paths, "/repo"));
909
- expect(parser.sessionCache.read(paths.transcriptPath).skippedBytes).toBeGreaterThan(0);
910
- });
911
- it.each(variants(agyFixtures))("Antigravity: $name", (fixture)=>{
912
- const { buffer, bounds } = mirrored(fixture, JSON.stringify({
913
- type: "CHECKPOINT"
914
- }));
915
- const filePath = path.join(tmpDir, "transcript.jsonl");
916
- fs.writeFileSync(filePath, buffer);
917
- const parser = new AntigravitySessionParser({
918
- summaryBounds: bounds
919
- });
920
- expect(parser.readSessionIncremental("conv", filePath, "/repo")).toEqual(new AntigravitySessionParser().readSession("conv", filePath, "/repo"));
921
- expect(parser.sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
922
- });
923
- });
924
- /**
925
- * Documented fallbacks when an entry lies only in the skipped middle of a
926
- * bounded cold start: the field stays undefined (or its existing default); it
927
- * is never filled from a later entry and never by a full scan.
928
- */ describe("bounded cold start: cap-reached fallbacks", ()=>{
929
- const bounds = {
930
- headBytes: 256,
931
- tailBytes: 256
932
- };
933
- const filler = (n, entry)=>Array.from({
934
- length: n
935
- }, ()=>JSON.stringify(entry));
936
- const claudeFile = "11111111-2222-3333-4444-555555555555.jsonl";
937
- let tmpDir;
938
- beforeEach(()=>{
939
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "bounded-fallback-"));
940
- });
941
- afterEach(()=>{
942
- fs.rmSync(tmpDir, {
943
- recursive: true,
944
- force: true
945
- });
946
- });
947
- function write(name, entries) {
948
- const filePath = path.join(tmpDir, name);
949
- fs.writeFileSync(filePath, entries.map((entry)=>JSON.stringify(entry)).join("\n") + "\n");
950
- return filePath;
951
- }
952
- it("Claude: a first user message beyond the head cap stays undefined", ()=>{
953
- const pad = filler(20, {
954
- type: "attachment",
955
- note: "x".repeat(40)
956
- }).map((l)=>JSON.parse(l));
957
- const filePath = write(claudeFile, [
958
- {
959
- type: "file-history-snapshot",
960
- snapshot: {
961
- timestamp: "2026-03-10T09:00:00Z"
962
- }
963
- },
964
- ...pad,
965
- {
966
- type: "user",
967
- timestamp: "2026-03-10T10:00:00Z",
968
- message: {
969
- content: "first"
970
- }
971
- },
972
- ...pad,
973
- {
974
- type: "user",
975
- timestamp: "2026-03-10T11:00:00Z",
976
- message: {
977
- content: "latest"
978
- }
979
- },
980
- {
981
- type: "assistant",
982
- timestamp: "2026-03-10T11:01:00Z",
983
- cwd: "/repo"
984
- }
985
- ]);
986
- const session = new ClaudeSessionParser({
987
- summaryBounds: bounds
988
- }).readSessionIncremental(filePath, "");
989
- expect(new ClaudeSessionParser().readSession(filePath, "")?.firstUserMessage).toBe("first");
990
- expect(session).toMatchObject({
991
- firstUserMessage: undefined,
992
- lastUserMessage: "latest",
993
- sessionStart: new Date("2026-03-10T09:00:00Z"),
994
- lastActive: new Date("2026-03-10T11:01:00Z"),
995
- lastEntryType: "assistant",
996
- lastCwd: "/repo"
997
- });
998
- });
999
- it("Claude: latest fields before the tail window stay undefined", ()=>{
1000
- const pad = filler(40, {
1001
- type: "attachment",
1002
- note: "x".repeat(40)
1003
- }).map((l)=>JSON.parse(l));
1004
- const filePath = write(claudeFile, [
1005
- {
1006
- type: "user",
1007
- timestamp: "2026-03-10T10:00:00Z",
1008
- cwd: "/repo",
1009
- message: {
1010
- content: "only"
1011
- }
1012
- },
1013
- ...pad
1014
- ]);
1015
- const session = new ClaudeSessionParser({
1016
- summaryBounds: bounds
1017
- }).readSessionIncremental(filePath, "");
1018
- // The head still supplies the session start and the first user message
1019
- expect(session).toMatchObject({
1020
- firstUserMessage: "only",
1021
- lastUserMessage: undefined,
1022
- lastEntryType: undefined,
1023
- lastCwd: undefined,
1024
- isInterrupted: false,
1025
- sessionStart: new Date("2026-03-10T10:00:00Z")
1026
- });
1027
- });
1028
- it("Codex: keeps session_meta from the head and defaults fields missing from the tail", ()=>{
1029
- const pad = filler(40, {
1030
- payload: {
1031
- note: "x".repeat(40)
1032
- }
1033
- }).map((l)=>JSON.parse(l));
1034
- const filePath = write("rollout.jsonl", [
1035
- {
1036
- type: "session_meta",
1037
- payload: {
1038
- id: "sess-1",
1039
- cwd: "/repo",
1040
- timestamp: "2026-03-18T15:00:00Z"
1041
- }
1042
- },
1043
- {
1044
- type: "event_msg",
1045
- timestamp: "2026-03-18T15:01:00Z",
1046
- payload: {
1047
- type: "agent_message",
1048
- message: "early"
1049
- }
1050
- },
1051
- ...pad
1052
- ]);
1053
- const session = new CodexSessionParser({
1054
- summaryBounds: bounds
1055
- }).readSessionIncremental(filePath);
1056
- expect(session).toMatchObject({
1057
- sessionId: "sess-1",
1058
- projectPath: "/repo",
1059
- summary: "Codex session active",
1060
- lastPayloadType: undefined,
1061
- sessionStart: new Date("2026-03-18T15:00:00Z"),
1062
- lastActive: new Date("2026-03-18T15:00:00Z")
1063
- });
1064
- });
1065
- it("Codex: a session_meta line longer than the head cap yields no session", ()=>{
1066
- const pad = filler(40, {
1067
- type: "event_msg",
1068
- payload: {
1069
- type: "agent_message",
1070
- message: "hi"
1071
- }
1072
- });
1073
- const filePath = write("rollout.jsonl", [
1074
- {
1075
- type: "session_meta",
1076
- payload: {
1077
- id: "sess-1",
1078
- base: "x".repeat(400)
1079
- }
1080
- },
1081
- ...pad.map((l)=>JSON.parse(l))
1082
- ]);
1083
- expect(new CodexSessionParser({
1084
- summaryBounds: bounds
1085
- }).readSessionIncremental(filePath)).toBeNull();
1086
- });
1087
- });
1088
-
1089
- //# sourceMappingURL=SessionSummaryEquivalence.test.js.map