@cchistory/lite 0.4.2

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 (533) hide show
  1. package/INSTALL.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +16 -0
  4. package/apps/lite-cli/dist/bin.d.ts +3 -0
  5. package/apps/lite-cli/dist/bin.d.ts.map +1 -0
  6. package/apps/lite-cli/dist/bin.js +7 -0
  7. package/apps/lite-cli/dist/bin.js.map +1 -0
  8. package/apps/lite-cli/dist/index.d.ts +21 -0
  9. package/apps/lite-cli/dist/index.d.ts.map +1 -0
  10. package/apps/lite-cli/dist/index.js +1812 -0
  11. package/apps/lite-cli/dist/index.js.map +1 -0
  12. package/apps/lite-cli/dist/index.test.d.ts +2 -0
  13. package/apps/lite-cli/dist/index.test.d.ts.map +1 -0
  14. package/apps/lite-cli/dist/index.test.js +1290 -0
  15. package/apps/lite-cli/dist/index.test.js.map +1 -0
  16. package/apps/lite-cli/dist/json-v2.d.ts +17 -0
  17. package/apps/lite-cli/dist/json-v2.d.ts.map +1 -0
  18. package/apps/lite-cli/dist/json-v2.js +352 -0
  19. package/apps/lite-cli/dist/json-v2.js.map +1 -0
  20. package/apps/lite-cli/dist/query.d.ts +50 -0
  21. package/apps/lite-cli/dist/query.d.ts.map +1 -0
  22. package/apps/lite-cli/dist/query.js +297 -0
  23. package/apps/lite-cli/dist/query.js.map +1 -0
  24. package/apps/lite-cli/dist/shell.d.ts +18 -0
  25. package/apps/lite-cli/dist/shell.d.ts.map +1 -0
  26. package/apps/lite-cli/dist/shell.js +276 -0
  27. package/apps/lite-cli/dist/shell.js.map +1 -0
  28. package/apps/lite-tui/dist/bin.d.ts +3 -0
  29. package/apps/lite-tui/dist/bin.d.ts.map +1 -0
  30. package/apps/lite-tui/dist/bin.js +7 -0
  31. package/apps/lite-tui/dist/bin.js.map +1 -0
  32. package/apps/lite-tui/dist/colors.d.ts +49 -0
  33. package/apps/lite-tui/dist/colors.d.ts.map +1 -0
  34. package/apps/lite-tui/dist/colors.js +70 -0
  35. package/apps/lite-tui/dist/colors.js.map +1 -0
  36. package/apps/lite-tui/dist/index.d.ts +23 -0
  37. package/apps/lite-tui/dist/index.d.ts.map +1 -0
  38. package/apps/lite-tui/dist/index.js +519 -0
  39. package/apps/lite-tui/dist/index.js.map +1 -0
  40. package/apps/lite-tui/dist/index.test.d.ts +2 -0
  41. package/apps/lite-tui/dist/index.test.d.ts.map +1 -0
  42. package/apps/lite-tui/dist/index.test.js +487 -0
  43. package/apps/lite-tui/dist/index.test.js.map +1 -0
  44. package/apps/lite-tui/dist/input.d.ts +23 -0
  45. package/apps/lite-tui/dist/input.d.ts.map +1 -0
  46. package/apps/lite-tui/dist/input.js +98 -0
  47. package/apps/lite-tui/dist/input.js.map +1 -0
  48. package/apps/lite-tui/dist/keys.d.ts +32 -0
  49. package/apps/lite-tui/dist/keys.d.ts.map +1 -0
  50. package/apps/lite-tui/dist/keys.js +136 -0
  51. package/apps/lite-tui/dist/keys.js.map +1 -0
  52. package/apps/lite-tui/dist/keys.test.d.ts +2 -0
  53. package/apps/lite-tui/dist/keys.test.d.ts.map +1 -0
  54. package/apps/lite-tui/dist/keys.test.js +67 -0
  55. package/apps/lite-tui/dist/keys.test.js.map +1 -0
  56. package/apps/lite-tui/dist/model.d.ts +88 -0
  57. package/apps/lite-tui/dist/model.d.ts.map +1 -0
  58. package/apps/lite-tui/dist/model.js +146 -0
  59. package/apps/lite-tui/dist/model.js.map +1 -0
  60. package/apps/lite-tui/dist/render.d.ts +46 -0
  61. package/apps/lite-tui/dist/render.d.ts.map +1 -0
  62. package/apps/lite-tui/dist/render.js +706 -0
  63. package/apps/lite-tui/dist/render.js.map +1 -0
  64. package/apps/lite-tui/dist/render.test.d.ts +2 -0
  65. package/apps/lite-tui/dist/render.test.d.ts.map +1 -0
  66. package/apps/lite-tui/dist/render.test.js +594 -0
  67. package/apps/lite-tui/dist/render.test.js.map +1 -0
  68. package/apps/lite-tui/dist/state.d.ts +127 -0
  69. package/apps/lite-tui/dist/state.d.ts.map +1 -0
  70. package/apps/lite-tui/dist/state.js +391 -0
  71. package/apps/lite-tui/dist/state.js.map +1 -0
  72. package/apps/lite-tui/dist/state.test.d.ts +2 -0
  73. package/apps/lite-tui/dist/state.test.d.ts.map +1 -0
  74. package/apps/lite-tui/dist/state.test.js +331 -0
  75. package/apps/lite-tui/dist/state.test.js.map +1 -0
  76. package/apps/lite-tui/dist/text.d.ts +38 -0
  77. package/apps/lite-tui/dist/text.d.ts.map +1 -0
  78. package/apps/lite-tui/dist/text.js +246 -0
  79. package/apps/lite-tui/dist/text.js.map +1 -0
  80. package/apps/lite-tui/dist/version.d.ts +10 -0
  81. package/apps/lite-tui/dist/version.d.ts.map +1 -0
  82. package/apps/lite-tui/dist/version.js +10 -0
  83. package/apps/lite-tui/dist/version.js.map +1 -0
  84. package/apps/lite-tui/dist/view-model.d.ts +26 -0
  85. package/apps/lite-tui/dist/view-model.d.ts.map +1 -0
  86. package/apps/lite-tui/dist/view-model.js +87 -0
  87. package/apps/lite-tui/dist/view-model.js.map +1 -0
  88. package/bin/cchistory-lite +3 -0
  89. package/bin/cchistory-lite-tui +3 -0
  90. package/bin/cchistory-lite-tui.cmd +3 -0
  91. package/bin/cchistory-lite-tui.mjs +7 -0
  92. package/bin/cchistory-lite.cmd +3 -0
  93. package/bin/cchistory-lite.mjs +11 -0
  94. package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts +33 -0
  95. package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts.map +1 -0
  96. package/node_modules/@cchistory/canonical/dist/directory-scope.js +95 -0
  97. package/node_modules/@cchistory/canonical/dist/directory-scope.js.map +1 -0
  98. package/node_modules/@cchistory/canonical/dist/fallback-projects.d.ts +14 -0
  99. package/node_modules/@cchistory/canonical/dist/fallback-projects.d.ts.map +1 -0
  100. package/node_modules/@cchistory/canonical/dist/fallback-projects.js +120 -0
  101. package/node_modules/@cchistory/canonical/dist/fallback-projects.js.map +1 -0
  102. package/node_modules/@cchistory/canonical/dist/index.d.ts +12 -0
  103. package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -0
  104. package/node_modules/@cchistory/canonical/dist/index.js +12 -0
  105. package/node_modules/@cchistory/canonical/dist/index.js.map +1 -0
  106. package/node_modules/@cchistory/canonical/dist/index.test.d.ts +2 -0
  107. package/node_modules/@cchistory/canonical/dist/index.test.d.ts.map +1 -0
  108. package/node_modules/@cchistory/canonical/dist/index.test.js +901 -0
  109. package/node_modules/@cchistory/canonical/dist/index.test.js.map +1 -0
  110. package/node_modules/@cchistory/canonical/dist/project-linker.d.ts +30 -0
  111. package/node_modules/@cchistory/canonical/dist/project-linker.d.ts.map +1 -0
  112. package/node_modules/@cchistory/canonical/dist/project-linker.js +720 -0
  113. package/node_modules/@cchistory/canonical/dist/project-linker.js.map +1 -0
  114. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts +23 -0
  115. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts.map +1 -0
  116. package/node_modules/@cchistory/canonical/dist/projection-audit.js +192 -0
  117. package/node_modules/@cchistory/canonical/dist/projection-audit.js.map +1 -0
  118. package/node_modules/@cchistory/canonical/dist/read-order.d.ts +19 -0
  119. package/node_modules/@cchistory/canonical/dist/read-order.d.ts.map +1 -0
  120. package/node_modules/@cchistory/canonical/dist/read-order.js +73 -0
  121. package/node_modules/@cchistory/canonical/dist/read-order.js.map +1 -0
  122. package/node_modules/@cchistory/canonical/dist/related-work.d.ts +4 -0
  123. package/node_modules/@cchistory/canonical/dist/related-work.d.ts.map +1 -0
  124. package/node_modules/@cchistory/canonical/dist/related-work.js +232 -0
  125. package/node_modules/@cchistory/canonical/dist/related-work.js.map +1 -0
  126. package/node_modules/@cchistory/canonical/dist/runtime-warning-filter.d.ts +10 -0
  127. package/node_modules/@cchistory/canonical/dist/runtime-warning-filter.d.ts.map +1 -0
  128. package/node_modules/@cchistory/canonical/dist/runtime-warning-filter.js +34 -0
  129. package/node_modules/@cchistory/canonical/dist/runtime-warning-filter.js.map +1 -0
  130. package/node_modules/@cchistory/canonical/dist/search.d.ts +69 -0
  131. package/node_modules/@cchistory/canonical/dist/search.d.ts.map +1 -0
  132. package/node_modules/@cchistory/canonical/dist/search.js +337 -0
  133. package/node_modules/@cchistory/canonical/dist/search.js.map +1 -0
  134. package/node_modules/@cchistory/canonical/dist/session-collections.d.ts +8 -0
  135. package/node_modules/@cchistory/canonical/dist/session-collections.d.ts.map +1 -0
  136. package/node_modules/@cchistory/canonical/dist/session-collections.js +21 -0
  137. package/node_modules/@cchistory/canonical/dist/session-collections.js.map +1 -0
  138. package/node_modules/@cchistory/canonical/dist/session-family.d.ts +23 -0
  139. package/node_modules/@cchistory/canonical/dist/session-family.d.ts.map +1 -0
  140. package/node_modules/@cchistory/canonical/dist/session-family.js +808 -0
  141. package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -0
  142. package/node_modules/@cchistory/canonical/dist/session-family.test.d.ts +2 -0
  143. package/node_modules/@cchistory/canonical/dist/session-family.test.d.ts.map +1 -0
  144. package/node_modules/@cchistory/canonical/dist/session-family.test.js +650 -0
  145. package/node_modules/@cchistory/canonical/dist/session-family.test.js.map +1 -0
  146. package/node_modules/@cchistory/canonical/dist/usage.d.ts +79 -0
  147. package/node_modules/@cchistory/canonical/dist/usage.d.ts.map +1 -0
  148. package/node_modules/@cchistory/canonical/dist/usage.js +232 -0
  149. package/node_modules/@cchistory/canonical/dist/usage.js.map +1 -0
  150. package/node_modules/@cchistory/canonical/dist/utils.d.ts +5 -0
  151. package/node_modules/@cchistory/canonical/dist/utils.d.ts.map +1 -0
  152. package/node_modules/@cchistory/canonical/dist/utils.js +18 -0
  153. package/node_modules/@cchistory/canonical/dist/utils.js.map +1 -0
  154. package/node_modules/@cchistory/canonical/package.json +14 -0
  155. package/node_modules/@cchistory/domain/dist/index.d.ts +943 -0
  156. package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -0
  157. package/node_modules/@cchistory/domain/dist/index.js +238 -0
  158. package/node_modules/@cchistory/domain/dist/index.js.map +1 -0
  159. package/node_modules/@cchistory/domain/dist/index.test.d.ts +2 -0
  160. package/node_modules/@cchistory/domain/dist/index.test.d.ts.map +1 -0
  161. package/node_modules/@cchistory/domain/dist/index.test.js +423 -0
  162. package/node_modules/@cchistory/domain/dist/index.test.js.map +1 -0
  163. package/node_modules/@cchistory/domain/package.json +14 -0
  164. package/node_modules/@cchistory/live-runtime/dist/async-pool.d.ts +3 -0
  165. package/node_modules/@cchistory/live-runtime/dist/async-pool.d.ts.map +1 -0
  166. package/node_modules/@cchistory/live-runtime/dist/async-pool.js +19 -0
  167. package/node_modules/@cchistory/live-runtime/dist/async-pool.js.map +1 -0
  168. package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +3 -0
  169. package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -0
  170. package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +22 -0
  171. package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -0
  172. package/node_modules/@cchistory/live-runtime/dist/index.d.ts +149 -0
  173. package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -0
  174. package/node_modules/@cchistory/live-runtime/dist/index.js +1180 -0
  175. package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -0
  176. package/node_modules/@cchistory/live-runtime/dist/index.test.d.ts +2 -0
  177. package/node_modules/@cchistory/live-runtime/dist/index.test.d.ts.map +1 -0
  178. package/node_modules/@cchistory/live-runtime/dist/index.test.js +1819 -0
  179. package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -0
  180. package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts +5 -0
  181. package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts.map +1 -0
  182. package/node_modules/@cchistory/live-runtime/dist/node-memory.js +83 -0
  183. package/node_modules/@cchistory/live-runtime/dist/node-memory.js.map +1 -0
  184. package/node_modules/@cchistory/live-runtime/package.json +18 -0
  185. package/node_modules/@cchistory/source-adapters/dist/core/antigravity-logic.d.ts +8 -0
  186. package/node_modules/@cchistory/source-adapters/dist/core/antigravity-logic.d.ts.map +1 -0
  187. package/node_modules/@cchistory/source-adapters/dist/core/antigravity-logic.js +115 -0
  188. package/node_modules/@cchistory/source-adapters/dist/core/antigravity-logic.js.map +1 -0
  189. package/node_modules/@cchistory/source-adapters/dist/core/ask-user-registry.d.ts +9 -0
  190. package/node_modules/@cchistory/source-adapters/dist/core/ask-user-registry.d.ts.map +1 -0
  191. package/node_modules/@cchistory/source-adapters/dist/core/ask-user-registry.js +223 -0
  192. package/node_modules/@cchistory/source-adapters/dist/core/ask-user-registry.js.map +1 -0
  193. package/node_modules/@cchistory/source-adapters/dist/core/ask-user.test.d.ts +2 -0
  194. package/node_modules/@cchistory/source-adapters/dist/core/ask-user.test.d.ts.map +1 -0
  195. package/node_modules/@cchistory/source-adapters/dist/core/ask-user.test.js +318 -0
  196. package/node_modules/@cchistory/source-adapters/dist/core/ask-user.test.js.map +1 -0
  197. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.d.ts +11 -0
  198. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.d.ts.map +1 -0
  199. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.js +206 -0
  200. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.js.map +1 -0
  201. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts +62 -0
  202. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts.map +1 -0
  203. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.js +224 -0
  204. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.js.map +1 -0
  205. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.d.ts +15 -0
  206. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.d.ts.map +1 -0
  207. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.js +96 -0
  208. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.js.map +1 -0
  209. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.test.d.ts +2 -0
  210. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.test.d.ts.map +1 -0
  211. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.test.js +97 -0
  212. package/node_modules/@cchistory/source-adapters/dist/core/directory-preview.test.js.map +1 -0
  213. package/node_modules/@cchistory/source-adapters/dist/core/discovery.d.ts +11 -0
  214. package/node_modules/@cchistory/source-adapters/dist/core/discovery.d.ts.map +1 -0
  215. package/node_modules/@cchistory/source-adapters/dist/core/discovery.js +412 -0
  216. package/node_modules/@cchistory/source-adapters/dist/core/discovery.js.map +1 -0
  217. package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.d.ts +2 -0
  218. package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.d.ts.map +1 -0
  219. package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js +552 -0
  220. package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js.map +1 -0
  221. package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts +10 -0
  222. package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts.map +1 -0
  223. package/node_modules/@cchistory/source-adapters/dist/core/factories.js +83 -0
  224. package/node_modules/@cchistory/source-adapters/dist/core/factories.js.map +1 -0
  225. package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts +5 -0
  226. package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts.map +1 -0
  227. package/node_modules/@cchistory/source-adapters/dist/core/git-project.js +86 -0
  228. package/node_modules/@cchistory/source-adapters/dist/core/git-project.js.map +1 -0
  229. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts +31 -0
  230. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts.map +1 -0
  231. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js +216 -0
  232. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js.map +1 -0
  233. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.d.ts +2 -0
  234. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.d.ts.map +1 -0
  235. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js +367 -0
  236. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -0
  237. package/node_modules/@cchistory/source-adapters/dist/core/legacy.d.ts +10 -0
  238. package/node_modules/@cchistory/source-adapters/dist/core/legacy.d.ts.map +1 -0
  239. package/node_modules/@cchistory/source-adapters/dist/core/legacy.js +10 -0
  240. package/node_modules/@cchistory/source-adapters/dist/core/legacy.js.map +1 -0
  241. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +70 -0
  242. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -0
  243. package/node_modules/@cchistory/source-adapters/dist/core/parser.js +1389 -0
  244. package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -0
  245. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.d.ts +15 -0
  246. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.d.ts.map +1 -0
  247. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.js +76 -0
  248. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.js.map +1 -0
  249. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.test.d.ts +2 -0
  250. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.test.d.ts.map +1 -0
  251. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.test.js +33 -0
  252. package/node_modules/@cchistory/source-adapters/dist/core/path-utils.test.js.map +1 -0
  253. package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts +24 -0
  254. package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -0
  255. package/node_modules/@cchistory/source-adapters/dist/core/probe.js +1829 -0
  256. package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -0
  257. package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts +39 -0
  258. package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts.map +1 -0
  259. package/node_modules/@cchistory/source-adapters/dist/core/projections.js +873 -0
  260. package/node_modules/@cchistory/source-adapters/dist/core/projections.js.map +1 -0
  261. package/node_modules/@cchistory/source-adapters/dist/core/projections.test.d.ts +2 -0
  262. package/node_modules/@cchistory/source-adapters/dist/core/projections.test.d.ts.map +1 -0
  263. package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js +165 -0
  264. package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js.map +1 -0
  265. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.d.ts +2 -0
  266. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.d.ts.map +1 -0
  267. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.js +87 -0
  268. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.js.map +1 -0
  269. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping-worker.d.ts +2 -0
  270. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping-worker.d.ts.map +1 -0
  271. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping-worker.js +10 -0
  272. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping-worker.js.map +1 -0
  273. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts +29 -0
  274. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts.map +1 -0
  275. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js +455 -0
  276. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js.map +1 -0
  277. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.d.ts +2 -0
  278. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.d.ts.map +1 -0
  279. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js +357 -0
  280. package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js.map +1 -0
  281. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +25 -0
  282. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -0
  283. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +144 -0
  284. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -0
  285. package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts +14 -0
  286. package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts.map +1 -0
  287. package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js +247 -0
  288. package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js.map +1 -0
  289. package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.d.ts +2 -0
  290. package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.d.ts.map +1 -0
  291. package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js +323 -0
  292. package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js.map +1 -0
  293. package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts +26 -0
  294. package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts.map +1 -0
  295. package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js +80 -0
  296. package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js.map +1 -0
  297. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +226 -0
  298. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -0
  299. package/node_modules/@cchistory/source-adapters/dist/core/types.js +2 -0
  300. package/node_modules/@cchistory/source-adapters/dist/core/types.js.map +1 -0
  301. package/node_modules/@cchistory/source-adapters/dist/core/user-text.d.ts +29 -0
  302. package/node_modules/@cchistory/source-adapters/dist/core/user-text.d.ts.map +1 -0
  303. package/node_modules/@cchistory/source-adapters/dist/core/user-text.js +327 -0
  304. package/node_modules/@cchistory/source-adapters/dist/core/user-text.js.map +1 -0
  305. package/node_modules/@cchistory/source-adapters/dist/core/utils.d.ts +11 -0
  306. package/node_modules/@cchistory/source-adapters/dist/core/utils.d.ts.map +1 -0
  307. package/node_modules/@cchistory/source-adapters/dist/core/utils.js +19 -0
  308. package/node_modules/@cchistory/source-adapters/dist/core/utils.js.map +1 -0
  309. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.d.ts +2 -0
  310. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.d.ts.map +1 -0
  311. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.js +289 -0
  312. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.js.map +1 -0
  313. package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts +43 -0
  314. package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts.map +1 -0
  315. package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js +520 -0
  316. package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js.map +1 -0
  317. package/node_modules/@cchistory/source-adapters/dist/index.d.ts +13 -0
  318. package/node_modules/@cchistory/source-adapters/dist/index.d.ts.map +1 -0
  319. package/node_modules/@cchistory/source-adapters/dist/index.js +8 -0
  320. package/node_modules/@cchistory/source-adapters/dist/index.js.map +1 -0
  321. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +31 -0
  322. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -0
  323. package/node_modules/@cchistory/source-adapters/dist/index.test.js +31 -0
  324. package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -0
  325. package/node_modules/@cchistory/source-adapters/dist/masks.d.ts +31 -0
  326. package/node_modules/@cchistory/source-adapters/dist/masks.d.ts.map +1 -0
  327. package/node_modules/@cchistory/source-adapters/dist/masks.js +342 -0
  328. package/node_modules/@cchistory/source-adapters/dist/masks.js.map +1 -0
  329. package/node_modules/@cchistory/source-adapters/dist/platforms/accio/runtime.d.ts +31 -0
  330. package/node_modules/@cchistory/source-adapters/dist/platforms/accio/runtime.d.ts.map +1 -0
  331. package/node_modules/@cchistory/source-adapters/dist/platforms/accio/runtime.js +161 -0
  332. package/node_modules/@cchistory/source-adapters/dist/platforms/accio/runtime.js.map +1 -0
  333. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.d.ts +3 -0
  334. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.d.ts.map +1 -0
  335. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.js +107 -0
  336. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.js.map +1 -0
  337. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.d.ts +2 -0
  338. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.d.ts.map +1 -0
  339. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js +202 -0
  340. package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js.map +1 -0
  341. package/node_modules/@cchistory/source-adapters/dist/platforms/amp/runtime.d.ts +4 -0
  342. package/node_modules/@cchistory/source-adapters/dist/platforms/amp/runtime.d.ts.map +1 -0
  343. package/node_modules/@cchistory/source-adapters/dist/platforms/amp/runtime.js +85 -0
  344. package/node_modules/@cchistory/source-adapters/dist/platforms/amp/runtime.js.map +1 -0
  345. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.d.ts +3 -0
  346. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.d.ts.map +1 -0
  347. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.js +10 -0
  348. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.js.map +1 -0
  349. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.d.ts +2 -0
  350. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.d.ts.map +1 -0
  351. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +105 -0
  352. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -0
  353. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.d.ts +45 -0
  354. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.d.ts.map +1 -0
  355. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.js +609 -0
  356. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.js.map +1 -0
  357. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/runtime.d.ts +16 -0
  358. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/runtime.d.ts.map +1 -0
  359. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/runtime.js +534 -0
  360. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/runtime.js.map +1 -0
  361. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.d.ts +12 -0
  362. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.d.ts.map +1 -0
  363. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.js +105 -0
  364. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.js.map +1 -0
  365. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.d.ts +2 -0
  366. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.d.ts.map +1 -0
  367. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js +820 -0
  368. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js.map +1 -0
  369. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code/runtime.d.ts +4 -0
  370. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code/runtime.d.ts.map +1 -0
  371. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code/runtime.js +130 -0
  372. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code/runtime.js.map +1 -0
  373. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code.d.ts +3 -0
  374. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code.d.ts.map +1 -0
  375. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code.js +10 -0
  376. package/node_modules/@cchistory/source-adapters/dist/platforms/claude-code.js.map +1 -0
  377. package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.d.ts +2 -0
  378. package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.d.ts.map +1 -0
  379. package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js +357 -0
  380. package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js.map +1 -0
  381. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.d.ts +4 -0
  382. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.d.ts.map +1 -0
  383. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.js +27 -0
  384. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.js.map +1 -0
  385. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.d.ts +2 -0
  386. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.d.ts.map +1 -0
  387. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js +49 -0
  388. package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js.map +1 -0
  389. package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.d.ts +4 -0
  390. package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.d.ts.map +1 -0
  391. package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.js +555 -0
  392. package/node_modules/@cchistory/source-adapters/dist/platforms/codex/runtime.js.map +1 -0
  393. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.d.ts +3 -0
  394. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.d.ts.map +1 -0
  395. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.js +15 -0
  396. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.js.map +1 -0
  397. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.d.ts +2 -0
  398. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.d.ts.map +1 -0
  399. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js +893 -0
  400. package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js.map +1 -0
  401. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts +70 -0
  402. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts.map +1 -0
  403. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js +786 -0
  404. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js.map +1 -0
  405. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.d.ts +4 -0
  406. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.d.ts.map +1 -0
  407. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.js +14 -0
  408. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.js.map +1 -0
  409. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.d.ts +2 -0
  410. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.d.ts.map +1 -0
  411. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js +154 -0
  412. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js.map +1 -0
  413. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.d.ts +4 -0
  414. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.d.ts.map +1 -0
  415. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.js +151 -0
  416. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.js.map +1 -0
  417. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.d.ts +2 -0
  418. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.d.ts.map +1 -0
  419. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js +1486 -0
  420. package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js.map +1 -0
  421. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid/runtime.d.ts +4 -0
  422. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid/runtime.d.ts.map +1 -0
  423. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid/runtime.js +229 -0
  424. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid/runtime.js.map +1 -0
  425. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.d.ts +3 -0
  426. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.d.ts.map +1 -0
  427. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.js +10 -0
  428. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.js.map +1 -0
  429. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.d.ts +2 -0
  430. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.d.ts.map +1 -0
  431. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js +222 -0
  432. package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js.map +1 -0
  433. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.d.ts +7 -0
  434. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.d.ts.map +1 -0
  435. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.js +65 -0
  436. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.js.map +1 -0
  437. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.d.ts +2 -0
  438. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.d.ts.map +1 -0
  439. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js +220 -0
  440. package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js.map +1 -0
  441. package/node_modules/@cchistory/source-adapters/dist/platforms/generic/runtime.d.ts +20 -0
  442. package/node_modules/@cchistory/source-adapters/dist/platforms/generic/runtime.d.ts.map +1 -0
  443. package/node_modules/@cchistory/source-adapters/dist/platforms/generic/runtime.js +365 -0
  444. package/node_modules/@cchistory/source-adapters/dist/platforms/generic/runtime.js.map +1 -0
  445. package/node_modules/@cchistory/source-adapters/dist/platforms/grok/runtime.d.ts +17 -0
  446. package/node_modules/@cchistory/source-adapters/dist/platforms/grok/runtime.d.ts.map +1 -0
  447. package/node_modules/@cchistory/source-adapters/dist/platforms/grok/runtime.js +498 -0
  448. package/node_modules/@cchistory/source-adapters/dist/platforms/grok/runtime.js.map +1 -0
  449. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.d.ts +36 -0
  450. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.d.ts.map +1 -0
  451. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js +261 -0
  452. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js.map +1 -0
  453. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.d.ts +2 -0
  454. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.d.ts.map +1 -0
  455. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js +565 -0
  456. package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js.map +1 -0
  457. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi/runtime.d.ts +4 -0
  458. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi/runtime.d.ts.map +1 -0
  459. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi/runtime.js +193 -0
  460. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi/runtime.js.map +1 -0
  461. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.d.ts +7 -0
  462. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.d.ts.map +1 -0
  463. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.js +55 -0
  464. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.js.map +1 -0
  465. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.d.ts +2 -0
  466. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.d.ts.map +1 -0
  467. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js +163 -0
  468. package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js.map +1 -0
  469. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.d.ts +3 -0
  470. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.d.ts.map +1 -0
  471. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.js +10 -0
  472. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.js.map +1 -0
  473. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.d.ts +2 -0
  474. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.d.ts.map +1 -0
  475. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js +179 -0
  476. package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js.map +1 -0
  477. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw/runtime.d.ts +4 -0
  478. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw/runtime.d.ts.map +1 -0
  479. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw/runtime.js +44 -0
  480. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw/runtime.js.map +1 -0
  481. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.d.ts +3 -0
  482. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.d.ts.map +1 -0
  483. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.js +60 -0
  484. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.js.map +1 -0
  485. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.d.ts +2 -0
  486. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.d.ts.map +1 -0
  487. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js +39 -0
  488. package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js.map +1 -0
  489. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.d.ts +3 -0
  490. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.d.ts.map +1 -0
  491. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.js +45 -0
  492. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.js.map +1 -0
  493. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.d.ts +2 -0
  494. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.d.ts.map +1 -0
  495. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js +170 -0
  496. package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js.map +1 -0
  497. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.d.ts +7 -0
  498. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.d.ts.map +1 -0
  499. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.js +52 -0
  500. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.js.map +1 -0
  501. package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.d.ts +104 -0
  502. package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.d.ts.map +1 -0
  503. package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.js +2 -0
  504. package/node_modules/@cchistory/source-adapters/dist/platforms/runtime-types.js.map +1 -0
  505. package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts +38 -0
  506. package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts.map +1 -0
  507. package/node_modules/@cchistory/source-adapters/dist/platforms/types.js +19 -0
  508. package/node_modules/@cchistory/source-adapters/dist/platforms/types.js.map +1 -0
  509. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +14 -0
  510. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -0
  511. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +283 -0
  512. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -0
  513. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.d.ts +3 -0
  514. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.d.ts.map +1 -0
  515. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.js +26 -0
  516. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.js.map +1 -0
  517. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.d.ts +2 -0
  518. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.d.ts.map +1 -0
  519. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js +411 -0
  520. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js.map +1 -0
  521. package/node_modules/@cchistory/source-adapters/dist/test-helpers.d.ts +85 -0
  522. package/node_modules/@cchistory/source-adapters/dist/test-helpers.d.ts.map +1 -0
  523. package/node_modules/@cchistory/source-adapters/dist/test-helpers.js +2106 -0
  524. package/node_modules/@cchistory/source-adapters/dist/test-helpers.js.map +1 -0
  525. package/node_modules/@cchistory/source-adapters/package.json +14 -0
  526. package/package.json +38 -0
  527. package/schemas/cchistory-lite-canonical-v1.schema.json +13 -0
  528. package/schemas/cchistory-lite-error-v1.schema.json +30 -0
  529. package/schemas/cchistory-lite-query-result-v1.schema.json +29 -0
  530. package/schemas/cchistory-lite-query-result-v2.schema.json +29 -0
  531. package/schemas/cchistory-lite-query-v1.schema.json +62 -0
  532. package/schemas/cchistory-lite-query-v2.schema.json +82 -0
  533. package/schemas/cchistory-lite-v2.schema.json +176 -0
@@ -0,0 +1,2106 @@
1
+ import assert from "node:assert/strict";
2
+ import { execFile } from "node:child_process";
3
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { DatabaseSync } from "node:sqlite";
6
+ import { fileURLToPath } from "node:url";
7
+ import { promisify } from "node:util";
8
+ import { getSourceFormatProfiles } from "./index.js";
9
+ export const execFileAsync = promisify(execFile);
10
+ export async function seedSupportedSourceFixtures(tempRoot) {
11
+ const codexDir = path.join(tempRoot, "codex");
12
+ const claudeDir = path.join(tempRoot, "claude");
13
+ const factoryDir = path.join(tempRoot, "factory");
14
+ const ampDir = path.join(tempRoot, "amp");
15
+ await mkdir(codexDir, { recursive: true });
16
+ await mkdir(claudeDir, { recursive: true });
17
+ await mkdir(factoryDir, { recursive: true });
18
+ await mkdir(ampDir, { recursive: true });
19
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-session-1.jsonl"), [
20
+ {
21
+ timestamp: "2026-03-09T00:00:00.000Z",
22
+ type: "session_meta",
23
+ payload: {
24
+ id: "codex-session-1",
25
+ cwd: "/workspace/codex",
26
+ model: "gpt-5",
27
+ },
28
+ },
29
+ {
30
+ timestamp: "2026-03-09T00:00:00.500Z",
31
+ type: "turn_context",
32
+ payload: {
33
+ cwd: "/workspace/codex",
34
+ model: "gpt-5",
35
+ },
36
+ },
37
+ {
38
+ timestamp: "2026-03-09T00:00:01.000Z",
39
+ type: "response_item",
40
+ payload: {
41
+ type: "message",
42
+ role: "user",
43
+ content: [{ type: "input_text", text: "How do I continue?" }],
44
+ },
45
+ },
46
+ {
47
+ timestamp: "2026-03-09T00:00:02.000Z",
48
+ type: "response_item",
49
+ payload: {
50
+ type: "message",
51
+ role: "assistant",
52
+ content: [
53
+ { type: "output_text", text: "Start with the validation harness." },
54
+ { type: "image", url: "file:///tmp/codex.png" },
55
+ ],
56
+ },
57
+ },
58
+ {
59
+ timestamp: "2026-03-09T00:00:03.000Z",
60
+ type: "response_item",
61
+ payload: {
62
+ type: "function_call",
63
+ call_id: "codex-call-1",
64
+ name: "read_file",
65
+ arguments: "{\"path\":\"README.md\"}",
66
+ },
67
+ },
68
+ {
69
+ timestamp: "2026-03-09T00:00:04.000Z",
70
+ type: "response_item",
71
+ payload: {
72
+ type: "function_call_output",
73
+ call_id: "codex-call-1",
74
+ output: "README.md loaded",
75
+ },
76
+ },
77
+ ]
78
+ .map((line) => JSON.stringify(line))
79
+ .join("\n"), "utf8");
80
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
81
+ {
82
+ timestamp: "2026-03-09T01:00:00.000Z",
83
+ type: "user",
84
+ cwd: "/workspace/claude",
85
+ parentUuid: "claude-parent-1",
86
+ message: {
87
+ role: "user",
88
+ content: [{ type: "text", text: "Review the probe output." }],
89
+ },
90
+ },
91
+ {
92
+ timestamp: "2026-03-09T01:00:01.000Z",
93
+ type: "assistant",
94
+ cwd: "/workspace/claude",
95
+ message: {
96
+ role: "assistant",
97
+ content: [
98
+ { type: "text", text: "Probe output looks healthy." },
99
+ {
100
+ type: "tool_use",
101
+ id: "claude-tool-1",
102
+ name: "shell",
103
+ input: { cmd: "pwd" },
104
+ },
105
+ {
106
+ type: "tool_result",
107
+ tool_use_id: "claude-tool-1",
108
+ content: [{ type: "text", text: "/workspace/claude" }],
109
+ },
110
+ { type: "image", url: "file:///tmp/claude.png" },
111
+ ],
112
+ },
113
+ },
114
+ ]
115
+ .map((line) => JSON.stringify(line))
116
+ .join("\n"), "utf8");
117
+ await writeFile(path.join(factoryDir, "session.jsonl"), [
118
+ {
119
+ timestamp: "2026-03-09T02:00:00.000Z",
120
+ type: "session_start",
121
+ sessionTitle: "Factory session",
122
+ cwd: "/workspace/factory",
123
+ },
124
+ {
125
+ timestamp: "2026-03-09T02:00:01.000Z",
126
+ type: "message",
127
+ message: {
128
+ role: "user",
129
+ content: [{ type: "text", text: "Run the build safely." }],
130
+ },
131
+ },
132
+ {
133
+ timestamp: "2026-03-09T02:00:02.000Z",
134
+ type: "message",
135
+ message: {
136
+ role: "assistant",
137
+ content: [
138
+ { type: "text", text: "Running a scoped build now." },
139
+ { type: "thinking", thinking: "Checking package boundaries." },
140
+ {
141
+ type: "tool_use",
142
+ id: "factory-tool-1",
143
+ name: "shell",
144
+ input: { cmd: "pnpm --filter @cchistory/api build" },
145
+ },
146
+ {
147
+ type: "tool_result",
148
+ tool_use_id: "factory-tool-1",
149
+ content: [{ type: "text", text: "Build complete." }],
150
+ },
151
+ { type: "diagram", title: "unsupported" },
152
+ ],
153
+ },
154
+ },
155
+ ]
156
+ .map((line) => JSON.stringify(line))
157
+ .join("\n"), "utf8");
158
+ await writeFile(path.join(factoryDir, "session.settings.json"), JSON.stringify({ model: "sonnet-4" }), "utf8");
159
+ await writeFile(path.join(ampDir, "thread.json"), JSON.stringify({
160
+ id: "amp-thread-1",
161
+ created: 1741492800000,
162
+ title: "AMP thread",
163
+ env: {
164
+ initial: {
165
+ trees: [{ uri: "file:///workspace/amp", displayName: "amp" }],
166
+ },
167
+ },
168
+ messages: [
169
+ {
170
+ timestamp: "2026-03-09T03:00:01.000Z",
171
+ role: "user",
172
+ content: [{ type: "text", text: "Summarize the current plan." }],
173
+ },
174
+ {
175
+ timestamp: "2026-03-09T03:00:02.000Z",
176
+ role: "assistant",
177
+ content: [
178
+ { type: "text", text: "Validation comes before integration." },
179
+ {
180
+ type: "tool_use",
181
+ id: "amp-tool-1",
182
+ name: "search",
183
+ input: { query: "implementation plan" },
184
+ },
185
+ {
186
+ type: "tool_result",
187
+ tool_use_id: "amp-tool-1",
188
+ content: [{ type: "text", text: "docs/IMPLEMENTATION_PLAN.md" }],
189
+ },
190
+ { type: "chart", data: [] },
191
+ ],
192
+ },
193
+ ],
194
+ }), "utf8");
195
+ return [
196
+ createSourceDefinition("src-codex-test", "codex", codexDir),
197
+ createSourceDefinition("src-claude-test", "claude_code", claudeDir),
198
+ createSourceDefinition("src-factory-test", "factory_droid", factoryDir),
199
+ createSourceDefinition("src-amp-test", "amp", ampDir),
200
+ ];
201
+ }
202
+ export async function seedMalformedSourceFixtures(tempRoot) {
203
+ const codexDir = path.join(tempRoot, "codex-malformed");
204
+ const claudeDir = path.join(tempRoot, "claude-malformed");
205
+ const factoryDir = path.join(tempRoot, "factory-malformed");
206
+ const ampDir = path.join(tempRoot, "amp-malformed");
207
+ await mkdir(codexDir, { recursive: true });
208
+ await mkdir(claudeDir, { recursive: true });
209
+ await mkdir(factoryDir, { recursive: true });
210
+ await mkdir(ampDir, { recursive: true });
211
+ await writeFile(path.join(codexDir, "broken-session.jsonl"), '{"timestamp":"2026-03-09T04:00:00.000Z","type":"response_item"', "utf8");
212
+ await writeFile(path.join(claudeDir, "unsupported.jsonl"), JSON.stringify({
213
+ timestamp: "2026-03-09T05:00:00.000Z",
214
+ type: "assistant",
215
+ cwd: "/workspace/claude-malformed",
216
+ message: {
217
+ role: "assistant",
218
+ content: [{ type: "image", url: "file:///tmp/unsupported.png" }],
219
+ },
220
+ }), "utf8");
221
+ await writeFile(path.join(factoryDir, "missing-fields.jsonl"), [
222
+ {
223
+ timestamp: "2026-03-09T06:00:00.000Z",
224
+ type: "session_start",
225
+ sessionTitle: "Factory malformed",
226
+ cwd: "/workspace/factory-malformed",
227
+ },
228
+ {
229
+ timestamp: "2026-03-09T06:00:01.000Z",
230
+ type: "message",
231
+ message: {
232
+ role: "assistant",
233
+ content: [{ type: "tool_result" }],
234
+ },
235
+ },
236
+ ]
237
+ .map((line) => JSON.stringify(line))
238
+ .join("\n"), "utf8");
239
+ await writeFile(path.join(factoryDir, "missing-fields.settings.json"), JSON.stringify({}), "utf8");
240
+ await writeFile(path.join(ampDir, "broken-thread.json"), "{not valid json", "utf8");
241
+ return [
242
+ createSourceDefinition("src-codex-malformed", "codex", codexDir),
243
+ createSourceDefinition("src-claude-malformed", "claude_code", claudeDir),
244
+ createSourceDefinition("src-factory-malformed", "factory_droid", factoryDir),
245
+ createSourceDefinition("src-amp-malformed", "amp", ampDir),
246
+ ];
247
+ }
248
+ export async function seedMultiTurnCodexFixture(tempRoot) {
249
+ const codexDir = path.join(tempRoot, "codex-multi-turn");
250
+ await mkdir(codexDir, { recursive: true });
251
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
252
+ {
253
+ timestamp: "2026-03-09T07:00:00.000Z",
254
+ type: "session_meta",
255
+ payload: {
256
+ id: "codex-multi-turn-session",
257
+ cwd: "/workspace/multi-turn",
258
+ model: "gpt-5",
259
+ },
260
+ },
261
+ {
262
+ timestamp: "2026-03-09T07:00:00.500Z",
263
+ type: "turn_context",
264
+ payload: {
265
+ cwd: "/workspace/multi-turn",
266
+ model: "gpt-5",
267
+ },
268
+ },
269
+ {
270
+ timestamp: "2026-03-09T07:00:01.000Z",
271
+ type: "response_item",
272
+ payload: {
273
+ type: "message",
274
+ role: "user",
275
+ content: [
276
+ {
277
+ type: "input_text",
278
+ text: "[Assistant Rules - hidden]\n[User Request]\nShip the fix.",
279
+ },
280
+ ],
281
+ },
282
+ },
283
+ {
284
+ timestamp: "2026-03-09T07:00:01.500Z",
285
+ type: "response_item",
286
+ payload: {
287
+ type: "message",
288
+ role: "user",
289
+ content: [{ type: "input_text", text: "Also cover tests." }],
290
+ },
291
+ },
292
+ {
293
+ timestamp: "2026-03-09T07:00:02.000Z",
294
+ type: "response_item",
295
+ payload: {
296
+ type: "message",
297
+ role: "assistant",
298
+ content: [{ type: "output_text", text: "I will patch it." }],
299
+ },
300
+ },
301
+ {
302
+ timestamp: "2026-03-09T07:00:02.500Z",
303
+ type: "response_item",
304
+ payload: {
305
+ type: "function_call",
306
+ call_id: "codex-multi-call-1",
307
+ name: "read_file",
308
+ arguments: "{\"path\":\"tasks.csv\"}",
309
+ },
310
+ },
311
+ {
312
+ timestamp: "2026-03-09T07:00:03.000Z",
313
+ type: "response_item",
314
+ payload: {
315
+ type: "function_call_output",
316
+ call_id: "codex-multi-call-1",
317
+ output: "tasks.csv loaded",
318
+ },
319
+ },
320
+ {
321
+ timestamp: "2026-03-09T07:00:04.000Z",
322
+ type: "response_item",
323
+ payload: {
324
+ type: "message",
325
+ role: "user",
326
+ content: [{ type: "input_text", text: "What's next?" }],
327
+ },
328
+ },
329
+ {
330
+ timestamp: "2026-03-09T07:00:05.000Z",
331
+ type: "response_item",
332
+ payload: {
333
+ type: "message",
334
+ role: "assistant",
335
+ content: [{ type: "output_text", text: "Validate the API route." }],
336
+ },
337
+ },
338
+ ]
339
+ .map((line) => JSON.stringify(line))
340
+ .join("\n"), "utf8");
341
+ return createSourceDefinition("src-codex-multi-turn", "codex", codexDir);
342
+ }
343
+ export async function seedCodexInjectedScaffoldFixture(tempRoot) {
344
+ const codexDir = path.join(tempRoot, "codex-injected-scaffold");
345
+ await mkdir(codexDir, { recursive: true });
346
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
347
+ {
348
+ timestamp: "2026-03-09T08:00:00.000Z",
349
+ type: "session_meta",
350
+ payload: {
351
+ id: "codex-injected-scaffold-session",
352
+ cwd: "/workspace/injected-scaffold",
353
+ model: "gpt-5",
354
+ },
355
+ },
356
+ {
357
+ timestamp: "2026-03-09T08:00:01.000Z",
358
+ type: "response_item",
359
+ payload: {
360
+ type: "message",
361
+ role: "user",
362
+ content: [
363
+ {
364
+ type: "input_text",
365
+ text: "<recommended_plugins>\nHere is a list of plugins that are available but not installed.\n\n- Airtable (airtable@openai-curated-remote)\n</recommended_plugins>\n\n# AGENTS.md instructions for /workspace/injected-scaffold\n\n<INSTRUCTIONS>\nBe precise.\n</INSTRUCTIONS>\n\n<environment_context>\n <cwd>/workspace/injected-scaffold</cwd>\n <shell>zsh</shell>\n</environment_context>\n\nPlease review the patch plan only.",
366
+ },
367
+ ],
368
+ },
369
+ },
370
+ {
371
+ timestamp: "2026-03-09T08:00:02.000Z",
372
+ type: "response_item",
373
+ payload: {
374
+ type: "message",
375
+ role: "assistant",
376
+ content: [{ type: "output_text", text: "I will review the plan." }],
377
+ },
378
+ },
379
+ ]
380
+ .map((line) => JSON.stringify(line))
381
+ .join("\n"), "utf8");
382
+ return createSourceDefinition("src-codex-injected-scaffold", "codex", codexDir);
383
+ }
384
+ export async function seedCodexInjectedOnlyFixture(tempRoot) {
385
+ const codexDir = path.join(tempRoot, "codex-injected-only");
386
+ await mkdir(codexDir, { recursive: true });
387
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
388
+ {
389
+ timestamp: "2026-03-09T08:10:00.000Z",
390
+ type: "session_meta",
391
+ payload: {
392
+ id: "codex-injected-only-session",
393
+ cwd: "/workspace/injected-only",
394
+ model: "gpt-5",
395
+ },
396
+ },
397
+ {
398
+ timestamp: "2026-03-09T08:10:01.000Z",
399
+ type: "response_item",
400
+ payload: {
401
+ type: "message",
402
+ role: "user",
403
+ content: [
404
+ {
405
+ type: "input_text",
406
+ text: "# AGENTS.md instructions for /workspace/injected-only\n\n<INSTRUCTIONS>\nBe precise.\n</INSTRUCTIONS>\n\n<environment_context>\n <cwd>/workspace/injected-only</cwd>\n <shell>zsh</shell>\n</environment_context>",
407
+ },
408
+ ],
409
+ },
410
+ },
411
+ ]
412
+ .map((line) => JSON.stringify(line))
413
+ .join("\n"), "utf8");
414
+ return createSourceDefinition("src-codex-injected-only", "codex", codexDir);
415
+ }
416
+ export async function seedCodexInjectedOnlyWithSystemContextFixture(tempRoot) {
417
+ const codexDir = path.join(tempRoot, "codex-injected-only-system-context");
418
+ await mkdir(codexDir, { recursive: true });
419
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
420
+ {
421
+ timestamp: "2026-03-09T08:20:00.000Z",
422
+ type: "session_meta",
423
+ payload: {
424
+ id: "codex-injected-only-system-context-session",
425
+ cwd: "/workspace/injected-only-system-context",
426
+ model: "gpt-5",
427
+ },
428
+ },
429
+ {
430
+ timestamp: "2026-03-09T08:20:01.000Z",
431
+ type: "response_item",
432
+ payload: {
433
+ type: "message",
434
+ role: "user",
435
+ content: [
436
+ {
437
+ type: "input_text",
438
+ text: "# AGENTS.md instructions for /workspace/injected-only-system-context\n\n<INSTRUCTIONS>\nBe precise.\n</INSTRUCTIONS>\n\n<environment_context>\n <cwd>/workspace/injected-only-system-context</cwd>\n <shell>zsh</shell>\n</environment_context>",
439
+ },
440
+ ],
441
+ },
442
+ },
443
+ {
444
+ timestamp: "2026-03-09T08:20:02.000Z",
445
+ type: "response_item",
446
+ payload: {
447
+ type: "message",
448
+ role: "system",
449
+ content: [
450
+ {
451
+ type: "output_text",
452
+ text: "Continue working toward the active thread goal.",
453
+ },
454
+ ],
455
+ },
456
+ },
457
+ ]
458
+ .map((line) => JSON.stringify(line))
459
+ .join("\n"), "utf8");
460
+ return createSourceDefinition("src-codex-injected-only-system-context", "codex", codexDir);
461
+ }
462
+ export async function seedClaudeInterruptedFixture(tempRoot) {
463
+ const claudeDir = path.join(tempRoot, "claude-interrupted");
464
+ await mkdir(claudeDir, { recursive: true });
465
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
466
+ {
467
+ timestamp: "2026-03-09T08:00:00.000Z",
468
+ type: "user",
469
+ cwd: "/workspace/claude-interrupted",
470
+ message: {
471
+ role: "user",
472
+ content: [{ type: "text", text: "Ship the fix." }],
473
+ },
474
+ },
475
+ {
476
+ timestamp: "2026-03-09T08:00:02.000Z",
477
+ type: "assistant",
478
+ cwd: "/workspace/claude-interrupted",
479
+ message: {
480
+ role: "assistant",
481
+ content: [{ type: "text", text: "I will patch it." }],
482
+ },
483
+ },
484
+ {
485
+ timestamp: "2026-03-09T08:00:03.000Z",
486
+ type: "user",
487
+ cwd: "/workspace/claude-interrupted",
488
+ message: {
489
+ role: "user",
490
+ content: [{ type: "text", text: "[Request interrupted by user]" }],
491
+ },
492
+ },
493
+ ]
494
+ .map((line) => JSON.stringify(line))
495
+ .join("\n"), "utf8");
496
+ return createSourceDefinition("src-claude-interrupted", "claude_code", claudeDir);
497
+ }
498
+ export async function seedWindowsNormalizedWorkspaceFixtures(tempRoot) {
499
+ const codexDir = path.join(tempRoot, "codex-win-normalized");
500
+ const claudeDir = path.join(tempRoot, "claude-win-normalized");
501
+ const factoryDir = path.join(tempRoot, "factory-win-normalized");
502
+ const ampDir = path.join(tempRoot, "amp-win-normalized");
503
+ await mkdir(codexDir, { recursive: true });
504
+ await mkdir(claudeDir, { recursive: true });
505
+ await mkdir(factoryDir, { recursive: true });
506
+ await mkdir(ampDir, { recursive: true });
507
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
508
+ {
509
+ timestamp: "2026-03-09T10:00:00.000Z",
510
+ type: "session_meta",
511
+ payload: {
512
+ id: "codex-win-normalized-session",
513
+ cwd: "C:\\Users\\dev\\workspace\\normalized-project\\",
514
+ model: "gpt-5",
515
+ },
516
+ },
517
+ {
518
+ timestamp: "2026-03-09T10:00:01.000Z",
519
+ type: "response_item",
520
+ payload: {
521
+ type: "message",
522
+ role: "user",
523
+ content: [{ type: "input_text", text: "Normalize Windows codex paths." }],
524
+ },
525
+ },
526
+ ]
527
+ .map((line) => JSON.stringify(line))
528
+ .join("\n"), "utf8");
529
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
530
+ {
531
+ timestamp: "2026-03-09T10:10:00.000Z",
532
+ type: "user",
533
+ cwd: "file:///C:/Users/dev/workspace/normalized-project/./",
534
+ message: {
535
+ role: "user",
536
+ content: [{ type: "text", text: "Normalize Windows claude paths." }],
537
+ },
538
+ },
539
+ ]
540
+ .map((line) => JSON.stringify(line))
541
+ .join("\n"), "utf8");
542
+ await writeFile(path.join(factoryDir, "session.jsonl"), [
543
+ {
544
+ timestamp: "2026-03-09T10:20:00.000Z",
545
+ type: "session_start",
546
+ sessionTitle: "Factory Windows normalized",
547
+ cwd: "file://localhost/C:/Users/dev/workspace/normalized-project/subdir/..",
548
+ },
549
+ {
550
+ timestamp: "2026-03-09T10:20:01.000Z",
551
+ type: "message",
552
+ message: {
553
+ role: "user",
554
+ content: [{ type: "text", text: "Normalize Windows factory paths." }],
555
+ },
556
+ },
557
+ ]
558
+ .map((line) => JSON.stringify(line))
559
+ .join("\n"), "utf8");
560
+ await writeFile(path.join(factoryDir, "session.settings.json"), JSON.stringify({ model: "sonnet-4" }), "utf8");
561
+ await writeFile(path.join(ampDir, "thread.json"), JSON.stringify({
562
+ id: "amp-win-normalized-thread",
563
+ created: 1741492800000,
564
+ title: "AMP Windows normalized",
565
+ env: {
566
+ initial: {
567
+ trees: [{ uri: "file:///C:/Users/dev/workspace/normalized-project/", displayName: "normalized" }],
568
+ },
569
+ },
570
+ messages: [
571
+ {
572
+ timestamp: "2026-03-09T10:30:01.000Z",
573
+ role: "user",
574
+ content: [{ type: "text", text: "Normalize Windows amp paths." }],
575
+ },
576
+ ],
577
+ }), "utf8");
578
+ return [
579
+ createSourceDefinition("src-codex-win-normalized", "codex", codexDir),
580
+ createSourceDefinition("src-claude-win-normalized", "claude_code", claudeDir),
581
+ createSourceDefinition("src-factory-win-normalized", "factory_droid", factoryDir),
582
+ createSourceDefinition("src-amp-win-normalized", "amp", ampDir),
583
+ ];
584
+ }
585
+ export async function seedNormalizedWorkspaceFixtures(tempRoot) {
586
+ const codexDir = path.join(tempRoot, "codex-normalized");
587
+ const claudeDir = path.join(tempRoot, "claude-normalized");
588
+ const factoryDir = path.join(tempRoot, "factory-normalized");
589
+ const ampDir = path.join(tempRoot, "amp-normalized");
590
+ await mkdir(codexDir, { recursive: true });
591
+ await mkdir(claudeDir, { recursive: true });
592
+ await mkdir(factoryDir, { recursive: true });
593
+ await mkdir(ampDir, { recursive: true });
594
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
595
+ {
596
+ timestamp: "2026-03-09T10:00:00.000Z",
597
+ type: "session_meta",
598
+ payload: {
599
+ id: "codex-normalized-session",
600
+ cwd: "/workspace/normalized-project/",
601
+ model: "gpt-5",
602
+ },
603
+ },
604
+ {
605
+ timestamp: "2026-03-09T10:00:01.000Z",
606
+ type: "response_item",
607
+ payload: {
608
+ type: "message",
609
+ role: "user",
610
+ content: [{ type: "input_text", text: "Normalize codex paths." }],
611
+ },
612
+ },
613
+ ]
614
+ .map((line) => JSON.stringify(line))
615
+ .join("\n"), "utf8");
616
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
617
+ {
618
+ timestamp: "2026-03-09T10:10:00.000Z",
619
+ type: "user",
620
+ cwd: "/workspace/normalized-project/./",
621
+ message: {
622
+ role: "user",
623
+ content: [{ type: "text", text: "Normalize claude paths." }],
624
+ },
625
+ },
626
+ ]
627
+ .map((line) => JSON.stringify(line))
628
+ .join("\n"), "utf8");
629
+ await writeFile(path.join(factoryDir, "session.jsonl"), [
630
+ {
631
+ timestamp: "2026-03-09T10:20:00.000Z",
632
+ type: "session_start",
633
+ sessionTitle: "Factory normalized",
634
+ cwd: "/workspace/normalized-project/subdir/..",
635
+ },
636
+ {
637
+ timestamp: "2026-03-09T10:20:01.000Z",
638
+ type: "message",
639
+ message: {
640
+ role: "user",
641
+ content: [{ type: "text", text: "Normalize factory paths." }],
642
+ },
643
+ },
644
+ ]
645
+ .map((line) => JSON.stringify(line))
646
+ .join("\n"), "utf8");
647
+ await writeFile(path.join(factoryDir, "session.settings.json"), JSON.stringify({ model: "sonnet-4" }), "utf8");
648
+ await writeFile(path.join(ampDir, "thread.json"), JSON.stringify({
649
+ id: "amp-normalized-thread",
650
+ created: 1741492800000,
651
+ title: "AMP normalized",
652
+ env: {
653
+ initial: {
654
+ trees: [{ uri: "file:///workspace/normalized-project/", displayName: "normalized" }],
655
+ },
656
+ },
657
+ messages: [
658
+ {
659
+ timestamp: "2026-03-09T10:30:01.000Z",
660
+ role: "user",
661
+ content: [{ type: "text", text: "Normalize amp paths." }],
662
+ },
663
+ ],
664
+ }), "utf8");
665
+ return [
666
+ createSourceDefinition("src-codex-normalized", "codex", codexDir),
667
+ createSourceDefinition("src-claude-normalized", "claude_code", claudeDir),
668
+ createSourceDefinition("src-factory-normalized", "factory_droid", factoryDir),
669
+ createSourceDefinition("src-amp-normalized", "amp", ampDir),
670
+ ];
671
+ }
672
+ export async function seedRepoEvidenceFixtures(tempRoot) {
673
+ const repoRoot = path.join(tempRoot, "git-project");
674
+ const repoWorkspace = path.join(repoRoot, "packages", "app");
675
+ await mkdir(repoWorkspace, { recursive: true });
676
+ await initGitRepo(repoRoot, "https://example.com/org/normalized-project.git");
677
+ const codexDir = path.join(tempRoot, "codex-repo");
678
+ const claudeDir = path.join(tempRoot, "claude-repo");
679
+ const factoryDir = path.join(tempRoot, "factory-repo");
680
+ const ampDir = path.join(tempRoot, "amp-repo");
681
+ await mkdir(codexDir, { recursive: true });
682
+ await mkdir(claudeDir, { recursive: true });
683
+ await mkdir(factoryDir, { recursive: true });
684
+ await mkdir(ampDir, { recursive: true });
685
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
686
+ {
687
+ timestamp: "2026-03-09T11:00:00.000Z",
688
+ type: "session_meta",
689
+ payload: {
690
+ id: "codex-repo-session",
691
+ cwd: `${repoWorkspace}/`,
692
+ model: "gpt-5",
693
+ },
694
+ },
695
+ {
696
+ timestamp: "2026-03-09T11:00:01.000Z",
697
+ type: "response_item",
698
+ payload: {
699
+ type: "message",
700
+ role: "user",
701
+ content: [{ type: "input_text", text: "Collect repo evidence." }],
702
+ },
703
+ },
704
+ ]
705
+ .map((line) => JSON.stringify(line))
706
+ .join("\n"), "utf8");
707
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
708
+ {
709
+ timestamp: "2026-03-09T11:10:00.000Z",
710
+ type: "user",
711
+ cwd: `${repoWorkspace}/./`,
712
+ message: {
713
+ role: "user",
714
+ content: [{ type: "text", text: "Collect claude repo evidence." }],
715
+ },
716
+ },
717
+ ]
718
+ .map((line) => JSON.stringify(line))
719
+ .join("\n"), "utf8");
720
+ await writeFile(path.join(factoryDir, "session.jsonl"), [
721
+ {
722
+ timestamp: "2026-03-09T11:20:00.000Z",
723
+ type: "session_start",
724
+ sessionTitle: "Factory repo evidence",
725
+ cwd: path.join(repoWorkspace, "..", "app"),
726
+ },
727
+ {
728
+ timestamp: "2026-03-09T11:20:01.000Z",
729
+ type: "message",
730
+ message: {
731
+ role: "user",
732
+ content: [{ type: "text", text: "Collect factory repo evidence." }],
733
+ },
734
+ },
735
+ ]
736
+ .map((line) => JSON.stringify(line))
737
+ .join("\n"), "utf8");
738
+ await writeFile(path.join(factoryDir, "session.settings.json"), JSON.stringify({ model: "sonnet-4" }), "utf8");
739
+ await writeFile(path.join(ampDir, "thread.json"), JSON.stringify({
740
+ id: "amp-repo-thread",
741
+ created: 1741492800000,
742
+ title: "AMP repo evidence",
743
+ env: {
744
+ initial: {
745
+ trees: [{ uri: `file://${repoWorkspace}/`, displayName: "normalized" }],
746
+ },
747
+ },
748
+ messages: [
749
+ {
750
+ timestamp: "2026-03-09T11:30:01.000Z",
751
+ role: "user",
752
+ content: [{ type: "text", text: "Collect amp repo evidence." }],
753
+ },
754
+ ],
755
+ }), "utf8");
756
+ return [
757
+ createSourceDefinition("src-codex-repo", "codex", codexDir),
758
+ createSourceDefinition("src-claude-repo", "claude_code", claudeDir),
759
+ createSourceDefinition("src-factory-repo", "factory_droid", factoryDir),
760
+ createSourceDefinition("src-amp-repo", "amp", ampDir),
761
+ ];
762
+ }
763
+ export async function seedTokenProjectionFixtures(tempRoot) {
764
+ const codexDir = path.join(tempRoot, "codex-tokens");
765
+ const claudeDir = path.join(tempRoot, "claude-tokens");
766
+ const factoryDir = path.join(tempRoot, "factory-tokens");
767
+ const ampDir = path.join(tempRoot, "amp-tokens");
768
+ await mkdir(codexDir, { recursive: true });
769
+ await mkdir(claudeDir, { recursive: true });
770
+ await mkdir(factoryDir, { recursive: true });
771
+ await mkdir(ampDir, { recursive: true });
772
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
773
+ {
774
+ timestamp: "2026-03-10T00:00:00.000Z",
775
+ type: "session_meta",
776
+ payload: {
777
+ id: "codex-token-session",
778
+ cwd: "/workspace/codex-token",
779
+ model: "gpt-5",
780
+ },
781
+ },
782
+ {
783
+ timestamp: "2026-03-10T00:00:01.000Z",
784
+ type: "response_item",
785
+ payload: {
786
+ type: "message",
787
+ role: "user",
788
+ content: [{ type: "input_text", text: "Count the codex tokens." }],
789
+ },
790
+ },
791
+ {
792
+ timestamp: "2026-03-10T00:00:02.000Z",
793
+ type: "response_item",
794
+ payload: {
795
+ type: "message",
796
+ role: "assistant",
797
+ stop_reason: "end_turn",
798
+ content: [{ type: "output_text", text: "Codex token event recorded." }],
799
+ },
800
+ },
801
+ {
802
+ timestamp: "2026-03-10T00:00:03.000Z",
803
+ type: "event_msg",
804
+ payload: {
805
+ type: "token_count",
806
+ info: {
807
+ last_token_usage: {
808
+ input_tokens: 12,
809
+ cached_input_tokens: 5,
810
+ output_tokens: 8,
811
+ reasoning_output_tokens: 3,
812
+ total_tokens: 20,
813
+ },
814
+ },
815
+ },
816
+ },
817
+ ]
818
+ .map((line) => JSON.stringify(line))
819
+ .join("\n"), "utf8");
820
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
821
+ {
822
+ timestamp: "2026-03-10T01:00:00.000Z",
823
+ type: "user",
824
+ cwd: "/workspace/claude-token",
825
+ message: {
826
+ role: "user",
827
+ content: [{ type: "text", text: "Count the claude tokens." }],
828
+ },
829
+ },
830
+ {
831
+ timestamp: "2026-03-10T01:00:01.000Z",
832
+ type: "assistant",
833
+ cwd: "/workspace/claude-token",
834
+ message: {
835
+ role: "assistant",
836
+ model: "claude-sonnet-4-6",
837
+ stop_reason: "tool_use",
838
+ usage: {
839
+ input_tokens: 30,
840
+ cache_creation_input_tokens: 5,
841
+ cache_read_input_tokens: 2,
842
+ output_tokens: 10,
843
+ },
844
+ content: [{ type: "text", text: "Claude token usage attached." }],
845
+ },
846
+ },
847
+ ]
848
+ .map((line) => JSON.stringify(line))
849
+ .join("\n"), "utf8");
850
+ await writeFile(path.join(factoryDir, "session.jsonl"), [
851
+ {
852
+ timestamp: "2026-03-10T02:00:00.000Z",
853
+ type: "session_start",
854
+ sessionTitle: "Factory tokens",
855
+ cwd: "/workspace/factory-token",
856
+ },
857
+ {
858
+ timestamp: "2026-03-10T02:00:01.000Z",
859
+ type: "message",
860
+ message: {
861
+ role: "user",
862
+ content: [{ type: "text", text: "Count the factory tokens." }],
863
+ },
864
+ },
865
+ {
866
+ timestamp: "2026-03-10T02:00:02.000Z",
867
+ type: "message",
868
+ message: {
869
+ role: "assistant",
870
+ model: "claude-opus-4-6",
871
+ stop_reason: "end_turn",
872
+ usage: {
873
+ inputTokens: 9,
874
+ outputTokens: 6,
875
+ cacheCreationTokens: 1,
876
+ cacheReadTokens: 2,
877
+ thinkingTokens: 3,
878
+ },
879
+ content: [{ type: "text", text: "Factory token usage attached." }],
880
+ },
881
+ },
882
+ ]
883
+ .map((line) => JSON.stringify(line))
884
+ .join("\n"), "utf8");
885
+ await writeFile(path.join(factoryDir, "session.settings.json"), JSON.stringify({ model: "sonnet-4" }), "utf8");
886
+ await writeFile(path.join(ampDir, "thread.json"), JSON.stringify({
887
+ id: "amp-token-thread",
888
+ created: 1741492800000,
889
+ title: "AMP tokens",
890
+ env: {
891
+ initial: {
892
+ trees: [{ uri: "file:///workspace/amp-token", displayName: "amp-token" }],
893
+ },
894
+ },
895
+ messages: [
896
+ {
897
+ timestamp: "2026-03-10T03:00:01.000Z",
898
+ role: "user",
899
+ content: [{ type: "text", text: "Count the amp tokens." }],
900
+ },
901
+ {
902
+ timestamp: "2026-03-10T03:00:02.000Z",
903
+ role: "assistant",
904
+ stopReason: "max_tokens",
905
+ usage: {
906
+ model: "claude-opus-4-6",
907
+ inputTokens: 14,
908
+ outputTokens: 7,
909
+ cacheCreationInputTokens: 2,
910
+ cacheReadInputTokens: 1,
911
+ },
912
+ content: [{ type: "text", text: "AMP token usage attached." }],
913
+ },
914
+ ],
915
+ }), "utf8");
916
+ return [
917
+ createSourceDefinition("src-codex-tokens", "codex", codexDir),
918
+ createSourceDefinition("src-claude-tokens", "claude_code", claudeDir),
919
+ createSourceDefinition("src-factory-tokens", "factory_droid", factoryDir),
920
+ createSourceDefinition("src-amp-tokens", "amp", ampDir),
921
+ ];
922
+ }
923
+ export async function seedClaudeModelSwitchFixture(tempRoot) {
924
+ const claudeDir = path.join(tempRoot, "claude-model-switch");
925
+ await mkdir(claudeDir, { recursive: true });
926
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), [
927
+ {
928
+ timestamp: "2026-03-10T04:00:00.000Z",
929
+ type: "user",
930
+ cwd: "/workspace/claude-model-switch",
931
+ message: {
932
+ role: "user",
933
+ content: [{ type: "text", text: "Handle the first turn." }],
934
+ },
935
+ },
936
+ {
937
+ timestamp: "2026-03-10T04:00:01.000Z",
938
+ type: "assistant",
939
+ cwd: "/workspace/claude-model-switch",
940
+ message: {
941
+ role: "assistant",
942
+ model: "claude-sonnet-4-6",
943
+ stop_reason: "end_turn",
944
+ usage: {
945
+ input_tokens: 10,
946
+ output_tokens: 4,
947
+ },
948
+ content: [{ type: "text", text: "First Claude reply." }],
949
+ },
950
+ },
951
+ {
952
+ timestamp: "2026-03-10T04:00:02.000Z",
953
+ type: "user",
954
+ cwd: "/workspace/claude-model-switch",
955
+ message: {
956
+ role: "user",
957
+ content: [{ type: "text", text: "Handle the second turn." }],
958
+ },
959
+ },
960
+ {
961
+ timestamp: "2026-03-10T04:00:03.000Z",
962
+ type: "assistant",
963
+ cwd: "/workspace/claude-model-switch",
964
+ message: {
965
+ role: "assistant",
966
+ model: "claude-opus-4-6",
967
+ stop_reason: "end_turn",
968
+ usage: {
969
+ input_tokens: 20,
970
+ output_tokens: 8,
971
+ },
972
+ content: [{ type: "text", text: "Second Claude reply." }],
973
+ },
974
+ },
975
+ ]
976
+ .map((line) => JSON.stringify(line))
977
+ .join("\n"), "utf8");
978
+ return createSourceDefinition("src-claude-model-switch", "claude_code", claudeDir);
979
+ }
980
+ // Reproduces the Claude Code multi-chunk logging pattern: one logical assistant
981
+ // message with thinking + text + N tool_use blocks gets written as one JSONL line
982
+ // per block, all sharing the same Anthropic `message.id` and the same final usage.
983
+ // Without per-message.id dedup, each non-text block re-emits a token_usage_signal
984
+ // fragment and the same API call is counted many times.
985
+ export async function seedClaudeMultiChunkMessageFixture(tempRoot) {
986
+ const claudeDir = path.join(tempRoot, "claude-multi-chunk");
987
+ await mkdir(claudeDir, { recursive: true });
988
+ const records = [
989
+ {
990
+ timestamp: "2026-03-10T04:00:00.000Z",
991
+ type: "user",
992
+ cwd: "/workspace/claude-multi-chunk",
993
+ message: { role: "user", content: [{ type: "text", text: "Schedule all leaf tasks." }] },
994
+ },
995
+ ];
996
+ // 1 assistant message with id "msg_abc", written as 5 chunks:
997
+ // thinking, text, tool_use, tool_use, tool_use
998
+ // Each chunk carries the same final usage {in:9, cache_read:132160, out:1824}.
999
+ const sharedUsage = {
1000
+ input_tokens: 9,
1001
+ cache_read_input_tokens: 132160,
1002
+ cache_creation_input_tokens: 0,
1003
+ output_tokens: 1824,
1004
+ };
1005
+ const chunks = [
1006
+ { type: "thinking", thinking: "Planning the schedule." },
1007
+ { type: "text", text: "Scheduling all leaf tasks now." },
1008
+ { type: "tool_use", id: "tool_1", name: "schedule_task", input: { id: "t1" } },
1009
+ { type: "tool_use", id: "tool_2", name: "schedule_task", input: { id: "t2" } },
1010
+ { type: "tool_use", id: "tool_3", name: "schedule_task", input: { id: "t3" } },
1011
+ ];
1012
+ for (let i = 0; i < chunks.length; i++) {
1013
+ const chunk = chunks[i];
1014
+ if (!chunk)
1015
+ continue;
1016
+ records.push({
1017
+ timestamp: `2026-03-10T04:00:0${i + 1}.000Z`,
1018
+ type: "assistant",
1019
+ cwd: "/workspace/claude-multi-chunk",
1020
+ message: {
1021
+ id: "msg_abc",
1022
+ role: "assistant",
1023
+ model: "glm-5.2",
1024
+ stop_reason: "tool_use",
1025
+ usage: sharedUsage,
1026
+ content: [chunk],
1027
+ },
1028
+ });
1029
+ }
1030
+ await writeFile(path.join(claudeDir, "conversation.jsonl"), records.map((r) => JSON.stringify(r)).join("\n") + "\n", "utf8");
1031
+ return createSourceDefinition("src-claude-multi-chunk", "claude_code", claudeDir);
1032
+ }
1033
+ export async function seedClaudeCcusageConformanceFixture(tempRoot) {
1034
+ const claudeDir = path.join(tempRoot, "claude-ccusage-conformance");
1035
+ const subagentDir = path.join(claudeDir, "subagents");
1036
+ await mkdir(subagentDir, { recursive: true });
1037
+ const sessionId = "11111111-2222-4333-8444-555555555555";
1038
+ const messageId = "msg_shared_identity";
1039
+ const assistant = (timestamp, requestId, usage, text, isSidechain = false) => ({
1040
+ timestamp,
1041
+ sessionId,
1042
+ requestId,
1043
+ isSidechain,
1044
+ type: "assistant",
1045
+ message: {
1046
+ id: messageId,
1047
+ role: "assistant",
1048
+ model: "claude-sonnet-4-6",
1049
+ stop_reason: "end_turn",
1050
+ usage,
1051
+ content: [{ type: "text", text }],
1052
+ },
1053
+ });
1054
+ const requestAFinal = {
1055
+ input_tokens: 1,
1056
+ cache_read_input_tokens: 10,
1057
+ cache_creation_input_tokens: 2,
1058
+ output_tokens: 7,
1059
+ };
1060
+ const requestB = {
1061
+ input_tokens: 3,
1062
+ cache_read_input_tokens: 20,
1063
+ cache_creation_input_tokens: 4,
1064
+ output_tokens: 5,
1065
+ };
1066
+ await writeFile(path.join(claudeDir, `${sessionId}.jsonl`), [
1067
+ {
1068
+ timestamp: "2026-03-10T05:00:00.000Z",
1069
+ sessionId,
1070
+ isSidechain: false,
1071
+ type: "user",
1072
+ message: { role: "user", content: "Check token accounting." },
1073
+ },
1074
+ assistant("2026-03-10T05:00:01.000Z", "req-a", {
1075
+ input_tokens: 1,
1076
+ cache_read_input_tokens: 10,
1077
+ cache_creation_input_tokens: 2,
1078
+ output_tokens: 2,
1079
+ }, "Partial checkpoint."),
1080
+ assistant("2026-03-10T05:00:02.000Z", "req-a", requestAFinal, "Final checkpoint."),
1081
+ assistant("2026-03-10T05:00:03.000Z", "req-b", requestB, "A distinct request."),
1082
+ ].map((record) => JSON.stringify(record)).join("\n") + "\n", "utf8");
1083
+ await writeFile(path.join(claudeDir, "copied-record.jsonl"), `${JSON.stringify(assistant("2026-03-10T05:00:04.000Z", "req-a", requestAFinal, "Copied final checkpoint."))}\n`, "utf8");
1084
+ await writeFile(path.join(subagentDir, "agent-replay.jsonl"), `${JSON.stringify(assistant("2026-03-10T05:00:05.000Z", "req-sidechain-replay", requestB, "Sidechain replay.", true))}\n`, "utf8");
1085
+ return createSourceDefinition("src-claude-ccusage-conformance", "claude_code", claudeDir);
1086
+ }
1087
+ export async function seedMultiTurnCodexTokenFixture(tempRoot) {
1088
+ const codexDir = path.join(tempRoot, "codex-token-checkpoints");
1089
+ await mkdir(codexDir, { recursive: true });
1090
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
1091
+ {
1092
+ timestamp: "2026-03-10T04:00:00.000Z",
1093
+ type: "session_meta",
1094
+ payload: {
1095
+ id: "codex-token-checkpoints-session",
1096
+ cwd: "/workspace/codex-token-checkpoints",
1097
+ model: "gpt-5",
1098
+ },
1099
+ },
1100
+ {
1101
+ timestamp: "2026-03-10T04:00:01.000Z",
1102
+ type: "response_item",
1103
+ payload: {
1104
+ type: "message",
1105
+ role: "user",
1106
+ content: [{ type: "input_text", text: "First tokenized turn." }],
1107
+ },
1108
+ },
1109
+ {
1110
+ timestamp: "2026-03-10T04:00:02.000Z",
1111
+ type: "response_item",
1112
+ payload: {
1113
+ type: "message",
1114
+ role: "assistant",
1115
+ stop_reason: "end_turn",
1116
+ content: [{ type: "output_text", text: "First answer." }],
1117
+ },
1118
+ },
1119
+ {
1120
+ timestamp: "2026-03-10T04:00:02.500Z",
1121
+ type: "event_msg",
1122
+ payload: {
1123
+ type: "token_count",
1124
+ info: {
1125
+ last_token_usage: {
1126
+ input_tokens: 40,
1127
+ cached_input_tokens: 20,
1128
+ output_tokens: 5,
1129
+ total_tokens: 45,
1130
+ },
1131
+ },
1132
+ },
1133
+ },
1134
+ {
1135
+ timestamp: "2026-03-10T04:00:03.000Z",
1136
+ type: "event_msg",
1137
+ payload: {
1138
+ type: "token_count",
1139
+ info: {
1140
+ last_token_usage: {
1141
+ input_tokens: 120,
1142
+ cached_input_tokens: 90,
1143
+ output_tokens: 15,
1144
+ total_tokens: 135,
1145
+ },
1146
+ },
1147
+ },
1148
+ },
1149
+ {
1150
+ timestamp: "2026-03-10T04:00:04.000Z",
1151
+ type: "response_item",
1152
+ payload: {
1153
+ type: "message",
1154
+ role: "user",
1155
+ content: [{ type: "input_text", text: "Second tokenized turn." }],
1156
+ },
1157
+ },
1158
+ {
1159
+ timestamp: "2026-03-10T04:00:05.000Z",
1160
+ type: "response_item",
1161
+ payload: {
1162
+ type: "message",
1163
+ role: "assistant",
1164
+ stop_reason: "end_turn",
1165
+ content: [{ type: "output_text", text: "Second answer." }],
1166
+ },
1167
+ },
1168
+ {
1169
+ timestamp: "2026-03-10T04:00:05.500Z",
1170
+ type: "event_msg",
1171
+ payload: {
1172
+ type: "token_count",
1173
+ info: {
1174
+ last_token_usage: {
1175
+ input_tokens: 70,
1176
+ cached_input_tokens: 30,
1177
+ output_tokens: 8,
1178
+ total_tokens: 78,
1179
+ },
1180
+ },
1181
+ },
1182
+ },
1183
+ {
1184
+ timestamp: "2026-03-10T04:00:06.000Z",
1185
+ type: "event_msg",
1186
+ payload: {
1187
+ type: "token_count",
1188
+ info: {
1189
+ last_token_usage: {
1190
+ input_tokens: 210,
1191
+ cached_input_tokens: 150,
1192
+ output_tokens: 25,
1193
+ total_tokens: 235,
1194
+ },
1195
+ },
1196
+ },
1197
+ },
1198
+ ]
1199
+ .map((line) => JSON.stringify(line))
1200
+ .join("\n"), "utf8");
1201
+ return createSourceDefinition("src-codex-token-checkpoints", "codex", codexDir);
1202
+ }
1203
+ export async function seedMultiReplyCodexTokenFixture(tempRoot) {
1204
+ const codexDir = path.join(tempRoot, "codex-token-multi-reply");
1205
+ await mkdir(codexDir, { recursive: true });
1206
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
1207
+ {
1208
+ timestamp: "2026-03-10T05:00:00.000Z",
1209
+ type: "session_meta",
1210
+ payload: {
1211
+ id: "codex-token-multi-reply-session",
1212
+ cwd: "/workspace/codex-token-multi-reply",
1213
+ model: "gpt-5",
1214
+ },
1215
+ },
1216
+ {
1217
+ timestamp: "2026-03-10T05:00:01.000Z",
1218
+ type: "response_item",
1219
+ payload: {
1220
+ type: "message",
1221
+ role: "user",
1222
+ content: [{ type: "input_text", text: "Keep working on the same turn." }],
1223
+ },
1224
+ },
1225
+ {
1226
+ timestamp: "2026-03-10T05:00:02.000Z",
1227
+ type: "response_item",
1228
+ payload: {
1229
+ type: "message",
1230
+ role: "assistant",
1231
+ stop_reason: "end_turn",
1232
+ usage: {
1233
+ input_tokens: 12,
1234
+ cached_input_tokens: 5,
1235
+ output_tokens: 2,
1236
+ total_tokens: 14,
1237
+ },
1238
+ content: [{ type: "output_text", text: "First reply." }],
1239
+ },
1240
+ },
1241
+ {
1242
+ timestamp: "2026-03-10T05:00:02.500Z",
1243
+ type: "event_msg",
1244
+ payload: {
1245
+ type: "token_count",
1246
+ info: {
1247
+ total_token_usage: {
1248
+ input_tokens: 40,
1249
+ cached_input_tokens: 20,
1250
+ output_tokens: 5,
1251
+ total_tokens: 45,
1252
+ },
1253
+ last_token_usage: {
1254
+ input_tokens: 40,
1255
+ cached_input_tokens: 20,
1256
+ output_tokens: 5,
1257
+ total_tokens: 45,
1258
+ },
1259
+ },
1260
+ },
1261
+ },
1262
+ {
1263
+ timestamp: "2026-03-10T05:00:03.000Z",
1264
+ type: "event_msg",
1265
+ payload: {
1266
+ type: "token_count",
1267
+ info: {
1268
+ total_token_usage: {
1269
+ input_tokens: 120,
1270
+ cached_input_tokens: 90,
1271
+ output_tokens: 15,
1272
+ total_tokens: 135,
1273
+ },
1274
+ last_token_usage: {
1275
+ input_tokens: 120,
1276
+ cached_input_tokens: 90,
1277
+ output_tokens: 15,
1278
+ total_tokens: 135,
1279
+ },
1280
+ },
1281
+ },
1282
+ },
1283
+ {
1284
+ timestamp: "2026-03-10T05:00:04.000Z",
1285
+ type: "response_item",
1286
+ payload: {
1287
+ type: "message",
1288
+ role: "assistant",
1289
+ stop_reason: "end_turn",
1290
+ content: [{ type: "output_text", text: "Second reply." }],
1291
+ },
1292
+ },
1293
+ {
1294
+ timestamp: "2026-03-10T05:00:04.500Z",
1295
+ type: "event_msg",
1296
+ payload: {
1297
+ type: "token_count",
1298
+ info: {
1299
+ total_token_usage: {
1300
+ input_tokens: 190,
1301
+ cached_input_tokens: 120,
1302
+ output_tokens: 23,
1303
+ total_tokens: 213,
1304
+ },
1305
+ last_token_usage: {
1306
+ input_tokens: 70,
1307
+ cached_input_tokens: 30,
1308
+ output_tokens: 8,
1309
+ total_tokens: 78,
1310
+ },
1311
+ },
1312
+ },
1313
+ },
1314
+ {
1315
+ timestamp: "2026-03-10T05:00:05.000Z",
1316
+ type: "event_msg",
1317
+ payload: {
1318
+ type: "token_count",
1319
+ info: {
1320
+ total_token_usage: {
1321
+ input_tokens: 330,
1322
+ cached_input_tokens: 240,
1323
+ output_tokens: 40,
1324
+ total_tokens: 370,
1325
+ },
1326
+ last_token_usage: {
1327
+ input_tokens: 210,
1328
+ cached_input_tokens: 150,
1329
+ output_tokens: 25,
1330
+ total_tokens: 235,
1331
+ },
1332
+ },
1333
+ },
1334
+ },
1335
+ ]
1336
+ .map((line) => JSON.stringify(line))
1337
+ .join("\n"), "utf8");
1338
+ return createSourceDefinition("src-codex-token-multi-reply", "codex", codexDir);
1339
+ }
1340
+ export async function seedCodexCumulativeTokenFixture(tempRoot) {
1341
+ const codexDir = path.join(tempRoot, "codex-token-cumulative");
1342
+ await mkdir(codexDir, { recursive: true });
1343
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
1344
+ {
1345
+ timestamp: "2026-03-10T06:00:00.000Z",
1346
+ type: "session_meta",
1347
+ payload: {
1348
+ id: "codex-token-cumulative-session",
1349
+ cwd: "/workspace/codex-token-cumulative",
1350
+ model: "gpt-5",
1351
+ },
1352
+ },
1353
+ {
1354
+ timestamp: "2026-03-10T06:00:01.000Z",
1355
+ type: "response_item",
1356
+ payload: {
1357
+ type: "message",
1358
+ role: "user",
1359
+ content: [{ type: "input_text", text: "Track the hidden billed work." }],
1360
+ },
1361
+ },
1362
+ {
1363
+ timestamp: "2026-03-10T06:00:02.000Z",
1364
+ type: "response_item",
1365
+ payload: {
1366
+ type: "message",
1367
+ role: "assistant",
1368
+ stop_reason: "end_turn",
1369
+ content: [{ type: "output_text", text: "One visible reply." }],
1370
+ },
1371
+ },
1372
+ {
1373
+ timestamp: "2026-03-10T06:00:02.500Z",
1374
+ type: "event_msg",
1375
+ payload: {
1376
+ type: "token_count",
1377
+ info: {
1378
+ total_token_usage: {
1379
+ input_tokens: 40,
1380
+ cached_input_tokens: 20,
1381
+ output_tokens: 5,
1382
+ total_tokens: 45,
1383
+ },
1384
+ last_token_usage: {
1385
+ input_tokens: 40,
1386
+ cached_input_tokens: 20,
1387
+ output_tokens: 5,
1388
+ total_tokens: 45,
1389
+ },
1390
+ },
1391
+ },
1392
+ },
1393
+ {
1394
+ timestamp: "2026-03-10T06:00:03.000Z",
1395
+ type: "event_msg",
1396
+ payload: {
1397
+ type: "token_count",
1398
+ info: {
1399
+ total_token_usage: {
1400
+ input_tokens: 80,
1401
+ cached_input_tokens: 40,
1402
+ output_tokens: 10,
1403
+ total_tokens: 90,
1404
+ },
1405
+ last_token_usage: {
1406
+ input_tokens: 40,
1407
+ cached_input_tokens: 20,
1408
+ output_tokens: 5,
1409
+ total_tokens: 45,
1410
+ },
1411
+ },
1412
+ },
1413
+ },
1414
+ {
1415
+ timestamp: "2026-03-10T06:00:03.500Z",
1416
+ type: "event_msg",
1417
+ payload: {
1418
+ type: "token_count",
1419
+ info: {
1420
+ total_token_usage: {
1421
+ input_tokens: 120,
1422
+ cached_input_tokens: 60,
1423
+ output_tokens: 15,
1424
+ total_tokens: 135,
1425
+ },
1426
+ last_token_usage: {
1427
+ input_tokens: 40,
1428
+ cached_input_tokens: 20,
1429
+ output_tokens: 5,
1430
+ total_tokens: 45,
1431
+ },
1432
+ },
1433
+ },
1434
+ },
1435
+ ]
1436
+ .map((line) => JSON.stringify(line))
1437
+ .join("\n"), "utf8");
1438
+ return createSourceDefinition("src-codex-token-cumulative", "codex", codexDir);
1439
+ }
1440
+ export async function seedCodexInterleavedCumulativeTokenFixture(tempRoot) {
1441
+ const codexDir = path.join(tempRoot, "codex-token-interleaved-cumulative");
1442
+ await mkdir(codexDir, { recursive: true });
1443
+ const tokenCheckpoint = (timestamp, baseline, last) => ({
1444
+ timestamp,
1445
+ type: "event_msg",
1446
+ payload: {
1447
+ type: "token_count",
1448
+ info: {
1449
+ total_token_usage: {
1450
+ input_tokens: baseline.input_tokens + last.input_tokens,
1451
+ cached_input_tokens: baseline.cached_input_tokens + last.cached_input_tokens,
1452
+ output_tokens: baseline.output_tokens + last.output_tokens,
1453
+ total_tokens: baseline.total_tokens + last.total_tokens,
1454
+ },
1455
+ last_token_usage: last,
1456
+ },
1457
+ },
1458
+ });
1459
+ const firstCheckpoint = {
1460
+ input_tokens: 40,
1461
+ cached_input_tokens: 30,
1462
+ output_tokens: 10,
1463
+ total_tokens: 50,
1464
+ };
1465
+ const finalCheckpoint = {
1466
+ input_tokens: 80,
1467
+ cached_input_tokens: 60,
1468
+ output_tokens: 20,
1469
+ total_tokens: 100,
1470
+ };
1471
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
1472
+ {
1473
+ timestamp: "2026-03-10T06:30:00.000Z",
1474
+ type: "session_meta",
1475
+ payload: {
1476
+ id: "codex-token-interleaved-cumulative-session",
1477
+ cwd: "/workspace/codex-token-interleaved-cumulative",
1478
+ model: "gpt-5",
1479
+ },
1480
+ },
1481
+ {
1482
+ timestamp: "2026-03-10T06:30:01.000Z",
1483
+ type: "response_item",
1484
+ payload: {
1485
+ type: "message",
1486
+ role: "user",
1487
+ content: [{ type: "input_text", text: "Track interleaved cumulative branches." }],
1488
+ },
1489
+ },
1490
+ {
1491
+ timestamp: "2026-03-10T06:30:02.000Z",
1492
+ type: "response_item",
1493
+ payload: {
1494
+ type: "message",
1495
+ role: "assistant",
1496
+ stop_reason: "end_turn",
1497
+ content: [{ type: "output_text", text: "One visible reply with four billed updates." }],
1498
+ },
1499
+ },
1500
+ tokenCheckpoint("2026-03-10T06:30:02.500Z", { input_tokens: 800, cached_input_tokens: 600, output_tokens: 100, total_tokens: 900 }, firstCheckpoint),
1501
+ tokenCheckpoint("2026-03-10T06:30:03.000Z", { input_tokens: 800, cached_input_tokens: 600, output_tokens: 100, total_tokens: 900 }, finalCheckpoint),
1502
+ tokenCheckpoint("2026-03-10T06:30:03.500Z", { input_tokens: 360, cached_input_tokens: 260, output_tokens: 40, total_tokens: 400 }, firstCheckpoint),
1503
+ tokenCheckpoint("2026-03-10T06:30:04.000Z", { input_tokens: 360, cached_input_tokens: 260, output_tokens: 40, total_tokens: 400 }, finalCheckpoint),
1504
+ tokenCheckpoint("2026-03-10T06:30:04.500Z", { input_tokens: 880, cached_input_tokens: 660, output_tokens: 120, total_tokens: 1_000 }, firstCheckpoint),
1505
+ tokenCheckpoint("2026-03-10T06:30:05.000Z", { input_tokens: 880, cached_input_tokens: 660, output_tokens: 120, total_tokens: 1_000 }, finalCheckpoint),
1506
+ tokenCheckpoint("2026-03-10T06:30:05.500Z", { input_tokens: 440, cached_input_tokens: 320, output_tokens: 60, total_tokens: 500 }, firstCheckpoint),
1507
+ tokenCheckpoint("2026-03-10T06:30:06.000Z", { input_tokens: 440, cached_input_tokens: 320, output_tokens: 60, total_tokens: 500 }, finalCheckpoint),
1508
+ ]
1509
+ .map((line) => JSON.stringify(line))
1510
+ .join("\n"), "utf8");
1511
+ return createSourceDefinition("src-codex-token-interleaved-cumulative", "codex", codexDir);
1512
+ }
1513
+ export async function seedCodexDelayedInterleavedTokenFixture(tempRoot) {
1514
+ const codexDir = path.join(tempRoot, "codex-token-delayed-interleaved");
1515
+ await mkdir(codexDir, { recursive: true });
1516
+ const largeReply = Array.from({ length: 500 }, () => "Large token reply segment.").join(" ");
1517
+ await writeFile(path.join(codexDir, "rollout-2026-03-09T00-00-00-codex-fixture.jsonl"), [
1518
+ {
1519
+ timestamp: "2026-03-10T07:00:00.000Z",
1520
+ type: "session_meta",
1521
+ payload: {
1522
+ id: "codex-token-delayed-interleaved-session",
1523
+ cwd: "/workspace/codex-token-delayed-interleaved",
1524
+ model: "gpt-5",
1525
+ },
1526
+ },
1527
+ {
1528
+ timestamp: "2026-03-10T07:00:01.000Z",
1529
+ type: "response_item",
1530
+ payload: {
1531
+ type: "message",
1532
+ role: "user",
1533
+ content: [{ type: "input_text", text: "Exercise delayed token signals around tool work." }],
1534
+ },
1535
+ },
1536
+ {
1537
+ timestamp: "2026-03-10T07:00:02.000Z",
1538
+ type: "response_item",
1539
+ payload: {
1540
+ type: "message",
1541
+ role: "assistant",
1542
+ stop_reason: "tool_use",
1543
+ content: [{ type: "output_text", text: "I need to inspect the workspace first." }],
1544
+ },
1545
+ },
1546
+ {
1547
+ timestamp: "2026-03-10T07:00:02.500Z",
1548
+ type: "response_item",
1549
+ payload: {
1550
+ type: "function_call",
1551
+ call_id: "delayed-token-tool",
1552
+ name: "shell",
1553
+ arguments: JSON.stringify({ cmd: "pwd" }),
1554
+ },
1555
+ },
1556
+ {
1557
+ timestamp: "2026-03-10T07:00:03.000Z",
1558
+ type: "response_item",
1559
+ payload: {
1560
+ type: "function_call_output",
1561
+ call_id: "delayed-token-tool",
1562
+ output: "/workspace/codex-token-delayed-interleaved",
1563
+ },
1564
+ },
1565
+ {
1566
+ timestamp: "2026-03-10T07:00:03.500Z",
1567
+ type: "event_msg",
1568
+ payload: {
1569
+ type: "token_count",
1570
+ info: {
1571
+ total_token_usage: {
1572
+ input_tokens: 70,
1573
+ cached_input_tokens: 20,
1574
+ output_tokens: 5,
1575
+ total_tokens: 75,
1576
+ },
1577
+ last_token_usage: {
1578
+ input_tokens: 70,
1579
+ cached_input_tokens: 20,
1580
+ output_tokens: 5,
1581
+ total_tokens: 75,
1582
+ },
1583
+ },
1584
+ },
1585
+ },
1586
+ {
1587
+ timestamp: "2026-03-10T07:00:04.000Z",
1588
+ type: "event_msg",
1589
+ payload: {
1590
+ type: "token_count",
1591
+ info: {
1592
+ total_token_usage: {
1593
+ input_tokens: 100,
1594
+ cached_input_tokens: 40,
1595
+ output_tokens: 10,
1596
+ total_tokens: 110,
1597
+ },
1598
+ last_token_usage: {
1599
+ input_tokens: 100,
1600
+ cached_input_tokens: 40,
1601
+ output_tokens: 10,
1602
+ total_tokens: 110,
1603
+ },
1604
+ },
1605
+ },
1606
+ },
1607
+ {
1608
+ timestamp: "2026-03-10T07:00:05.000Z",
1609
+ type: "response_item",
1610
+ payload: {
1611
+ type: "message",
1612
+ role: "assistant",
1613
+ stop_reason: "end_turn",
1614
+ usage: {
1615
+ input_tokens: 200,
1616
+ cache_read_input_tokens: 60,
1617
+ cache_creation_input_tokens: 10,
1618
+ output_tokens: 200,
1619
+ total_tokens: 470,
1620
+ },
1621
+ content: [{ type: "output_text", text: largeReply }],
1622
+ },
1623
+ },
1624
+ ]
1625
+ .map((line) => JSON.stringify(line))
1626
+ .join("\n"), "utf8");
1627
+ return createSourceDefinition("src-codex-token-delayed-interleaved", "codex", codexDir);
1628
+ }
1629
+ export async function seedExpandedSourceFixtures(tempRoot) {
1630
+ const cursorDir = path.join(tempRoot, "cursor", "workspaceStorage", "cursor-workspace");
1631
+ const antigravityDir = path.join(tempRoot, "antigravity", "User");
1632
+ const antigravityGlobalDir = path.join(antigravityDir, "globalStorage");
1633
+ const openclawDir = path.join(tempRoot, "openclaw", "agent-a", "sessions");
1634
+ const opencodeRoot = path.join(tempRoot, "opencode");
1635
+ const opencodeStorageRoot = path.join(opencodeRoot, "storage");
1636
+ const opencodeSessionDir = path.join(opencodeStorageRoot, "session", "global");
1637
+ const opencodeMessageDir = path.join(opencodeStorageRoot, "message", "opencode-fixture");
1638
+ const opencodeUserPartDir = path.join(opencodeStorageRoot, "part", "opencode-user-1");
1639
+ const opencodeAssistantPartDir = path.join(opencodeStorageRoot, "part", "opencode-assistant-1");
1640
+ const opencodeTodoDir = path.join(opencodeStorageRoot, "todo");
1641
+ const opencodeSessionDiffDir = path.join(opencodeStorageRoot, "session_diff");
1642
+ const lobechatDir = path.join(tempRoot, "lobechat");
1643
+ const geminiRoot = path.join(tempRoot, ".gemini");
1644
+ const geminiChatDir = path.join(geminiRoot, "tmp", "gemini-fixture", "chats");
1645
+ const geminiHistoryDir = path.join(geminiRoot, "history", "gemini-fixture");
1646
+ await mkdir(cursorDir, { recursive: true });
1647
+ await mkdir(antigravityGlobalDir, { recursive: true });
1648
+ await mkdir(openclawDir, { recursive: true });
1649
+ await mkdir(opencodeSessionDir, { recursive: true });
1650
+ await mkdir(opencodeMessageDir, { recursive: true });
1651
+ await mkdir(opencodeUserPartDir, { recursive: true });
1652
+ await mkdir(opencodeAssistantPartDir, { recursive: true });
1653
+ await mkdir(opencodeTodoDir, { recursive: true });
1654
+ await mkdir(opencodeSessionDiffDir, { recursive: true });
1655
+ await mkdir(lobechatDir, { recursive: true });
1656
+ await mkdir(geminiChatDir, { recursive: true });
1657
+ await mkdir(geminiHistoryDir, { recursive: true });
1658
+ seedCursorStyleStateDb(path.join(cursorDir, "state.vscdb"), {
1659
+ workspacePath: "/workspace/cursor",
1660
+ composerId: "cursor-fixture",
1661
+ title: "Cursor fixture",
1662
+ storageMode: "composerData",
1663
+ });
1664
+ await writeFile(path.join(cursorDir, "workspace.json"), JSON.stringify({ folder: "/workspace/cursor" }), "utf8");
1665
+ seedAntigravityTrajectoryStateDb(path.join(antigravityGlobalDir, "state.vscdb"), {
1666
+ trajectoryId: "antigravity-fixture",
1667
+ title: "Antigravity fixture",
1668
+ workspacePath: "/workspace/antigravity",
1669
+ createdAt: "2026-03-10T03:29:59.000Z",
1670
+ updatedAt: "2026-03-10T03:30:01.000Z",
1671
+ });
1672
+ await writeFile(path.join(openclawDir, "openclaw-fixture.jsonl"), [
1673
+ {
1674
+ type: "session",
1675
+ version: 3,
1676
+ id: "openclaw-fixture",
1677
+ timestamp: "2026-03-10T04:00:00.000Z",
1678
+ cwd: "/workspace/openclaw",
1679
+ },
1680
+ {
1681
+ type: "model_change",
1682
+ id: "openclaw-model-1",
1683
+ parentId: null,
1684
+ timestamp: "2026-03-10T04:00:00.001Z",
1685
+ provider: "zai",
1686
+ modelId: "glm-5-turbo",
1687
+ },
1688
+ {
1689
+ type: "thinking_level_change",
1690
+ id: "openclaw-thinking-1",
1691
+ parentId: "openclaw-model-1",
1692
+ timestamp: "2026-03-10T04:00:00.002Z",
1693
+ thinkingLevel: "low",
1694
+ },
1695
+ {
1696
+ type: "custom",
1697
+ customType: "model-snapshot",
1698
+ data: { timestamp: 1773115200003, provider: "zai", modelId: "glm-5-turbo" },
1699
+ id: "openclaw-snapshot-1",
1700
+ parentId: "openclaw-thinking-1",
1701
+ timestamp: "2026-03-10T04:00:00.003Z",
1702
+ },
1703
+ {
1704
+ type: "message",
1705
+ id: "openclaw-user-1",
1706
+ parentId: "openclaw-snapshot-1",
1707
+ timestamp: "2026-03-10T04:00:00.010Z",
1708
+ message: {
1709
+ role: "user",
1710
+ content: [{ type: "text", text: "Inspect OpenClaw history." }],
1711
+ },
1712
+ },
1713
+ {
1714
+ type: "message",
1715
+ id: "openclaw-assistant-1",
1716
+ parentId: "openclaw-user-1",
1717
+ timestamp: "2026-03-10T04:00:01.000Z",
1718
+ message: {
1719
+ role: "assistant",
1720
+ content: [
1721
+ { type: "thinking", thinking: "Review the queued history before replying.", thinkingSignature: "mock-openclaw-thinking" },
1722
+ { type: "text", text: "I will inspect the queued history first." },
1723
+ { type: "toolCall", id: "call-openclaw-read-1", name: "read", arguments: { path: "/workspace/openclaw/notes.md" } },
1724
+ ],
1725
+ model: "glm-5-turbo",
1726
+ usage: { input: 7, output: 3, totalTokens: 10 },
1727
+ stopReason: "tool_use",
1728
+ },
1729
+ },
1730
+ {
1731
+ type: "message",
1732
+ id: "openclaw-tool-result-1",
1733
+ parentId: "openclaw-assistant-1",
1734
+ timestamp: "2026-03-10T04:00:01.200Z",
1735
+ message: {
1736
+ role: "toolResult",
1737
+ toolCallId: "call-openclaw-read-1",
1738
+ toolName: "read",
1739
+ content: [{ type: "text", text: "OpenClaw history loaded." }],
1740
+ },
1741
+ },
1742
+ {
1743
+ type: "message",
1744
+ id: "openclaw-assistant-2",
1745
+ parentId: "openclaw-tool-result-1",
1746
+ timestamp: "2026-03-10T04:00:01.400Z",
1747
+ message: {
1748
+ role: "assistant",
1749
+ content: [{ type: "text", text: "OpenClaw history loaded." }],
1750
+ model: "glm-5-turbo",
1751
+ usage: { input: 3, output: 3, totalTokens: 6 },
1752
+ stopReason: "end_turn",
1753
+ },
1754
+ },
1755
+ ]
1756
+ .map((line) => JSON.stringify(line))
1757
+ .join("\n"), "utf8");
1758
+ await writeFile(path.join(opencodeSessionDir, "opencode-fixture.json"), JSON.stringify({
1759
+ id: "opencode-fixture",
1760
+ title: "OpenCode fixture",
1761
+ directory: "/workspace/opencode",
1762
+ version: "1.0.114",
1763
+ time: {
1764
+ created: 1771000000000,
1765
+ updated: 1771000002000,
1766
+ },
1767
+ }), "utf8");
1768
+ await writeFile(path.join(opencodeMessageDir, "0001.json"), JSON.stringify({
1769
+ id: "opencode-user-1",
1770
+ sessionID: "opencode-fixture",
1771
+ role: "user",
1772
+ time: {
1773
+ created: 1771000001000,
1774
+ },
1775
+ path: {
1776
+ cwd: "/workspace/opencode",
1777
+ root: "/",
1778
+ },
1779
+ }), "utf8");
1780
+ await writeFile(path.join(opencodeUserPartDir, "0001.json"), JSON.stringify({
1781
+ id: "opencode-user-1-part-1",
1782
+ sessionID: "opencode-fixture",
1783
+ messageID: "opencode-user-1",
1784
+ type: "text",
1785
+ text: "Inspect OpenCode history.",
1786
+ }), "utf8");
1787
+ await writeFile(path.join(opencodeMessageDir, "0002.json"), JSON.stringify({
1788
+ id: "opencode-assistant-1",
1789
+ sessionID: "opencode-fixture",
1790
+ role: "assistant",
1791
+ time: {
1792
+ created: 1771000002000,
1793
+ completed: 1771000003000,
1794
+ },
1795
+ modelID: "sonnet-4",
1796
+ path: {
1797
+ cwd: "/workspace/opencode",
1798
+ root: "/",
1799
+ },
1800
+ finish: "tool-calls",
1801
+ tokens: {
1802
+ input: 8,
1803
+ output: 4,
1804
+ reasoning: 0,
1805
+ cache: {
1806
+ read: 2,
1807
+ write: 0,
1808
+ },
1809
+ },
1810
+ }), "utf8");
1811
+ await writeFile(path.join(opencodeAssistantPartDir, "0001.json"), JSON.stringify({
1812
+ id: "opencode-assistant-1-part-1",
1813
+ sessionID: "opencode-fixture",
1814
+ messageID: "opencode-assistant-1",
1815
+ type: "tool",
1816
+ callID: "call-opencode-read-1",
1817
+ tool: "read",
1818
+ state: {
1819
+ status: "completed",
1820
+ input: {
1821
+ filePath: "/workspace/opencode/notes.md",
1822
+ limit: 20,
1823
+ },
1824
+ output: "<file>\n00001| OpenCode history loaded.\n</file>",
1825
+ },
1826
+ }), "utf8");
1827
+ await writeFile(path.join(opencodeAssistantPartDir, "0002.json"), JSON.stringify({
1828
+ id: "opencode-assistant-1-part-2",
1829
+ sessionID: "opencode-fixture",
1830
+ messageID: "opencode-assistant-1",
1831
+ type: "text",
1832
+ text: "OpenCode history loaded.",
1833
+ }), "utf8");
1834
+ await writeFile(path.join(opencodeSessionDiffDir, "opencode-fixture.json"), "[]\n", "utf8");
1835
+ await writeFile(path.join(opencodeTodoDir, "opencode-fixture.json"), JSON.stringify([{ id: "todo-1", content: "Capture supporting checklist", status: "pending" }]), "utf8");
1836
+ await writeFile(path.join(geminiRoot, "projects.json"), JSON.stringify({
1837
+ projects: {
1838
+ "/workspace/gemini-fixture": "gemini-fixture",
1839
+ },
1840
+ }), "utf8");
1841
+ await writeFile(path.join(geminiRoot, "tmp", "gemini-fixture", ".project_root"), "/workspace/gemini-fixture\n", "utf8");
1842
+ await writeFile(path.join(geminiHistoryDir, ".project_root"), "/workspace/gemini-fixture\n", "utf8");
1843
+ await writeFile(path.join(geminiChatDir, "session-2026-03-10T07-00-gemini-fixture.json"), JSON.stringify({
1844
+ sessionId: "gemini-fixture",
1845
+ projectHash: "abc123",
1846
+ startTime: "2026-03-10T07:00:00.000Z",
1847
+ lastUpdated: "2026-03-10T07:00:01.000Z",
1848
+ messages: [
1849
+ {
1850
+ id: "gemini-user-1",
1851
+ timestamp: "2026-03-10T07:00:00.000Z",
1852
+ type: "user",
1853
+ content: [{ text: "Inspect Gemini CLI history." }],
1854
+ },
1855
+ {
1856
+ id: "gemini-assistant-1",
1857
+ timestamp: "2026-03-10T07:00:01.000Z",
1858
+ type: "assistant",
1859
+ content: [{ text: "Gemini CLI history loaded." }],
1860
+ },
1861
+ ],
1862
+ }), "utf8");
1863
+ await writeFile(path.join(lobechatDir, "lobechat-export.json"), JSON.stringify({
1864
+ id: "lobechat-fixture",
1865
+ title: "LobeChat fixture",
1866
+ model: "gpt-4.1",
1867
+ messages: [
1868
+ {
1869
+ id: "lobechat-user-1",
1870
+ role: "user",
1871
+ createdAt: "2026-03-10T06:00:00.000Z",
1872
+ content: "Inspect LobeChat history.",
1873
+ },
1874
+ {
1875
+ id: "lobechat-assistant-1",
1876
+ role: "assistant",
1877
+ createdAt: "2026-03-10T06:00:01.000Z",
1878
+ usage: {
1879
+ inputTokens: 11,
1880
+ outputTokens: 4,
1881
+ totalTokens: 15,
1882
+ },
1883
+ stopReason: "end_turn",
1884
+ content: "LobeChat history loaded.",
1885
+ },
1886
+ ],
1887
+ }), "utf8");
1888
+ return [
1889
+ createSourceDefinition("src-cursor-fixture", "cursor", path.join(tempRoot, "cursor")),
1890
+ createSourceDefinition("src-antigravity-fixture", "antigravity", antigravityDir),
1891
+ createSourceDefinition("src-gemini-fixture", "gemini", geminiRoot),
1892
+ createSourceDefinition("src-openclaw-fixture", "openclaw", path.join(tempRoot, "openclaw")),
1893
+ createSourceDefinition("src-opencode-fixture", "opencode", opencodeStorageRoot),
1894
+ createSourceDefinition("src-lobechat-fixture", "lobechat", lobechatDir, "conversational_export"),
1895
+ ];
1896
+ }
1897
+ export function seedCursorStyleStateDb(dbPath, options) {
1898
+ const db = new DatabaseSync(dbPath);
1899
+ try {
1900
+ db.exec("CREATE TABLE ItemTable (key TEXT PRIMARY KEY, value BLOB NOT NULL)");
1901
+ const insert = db.prepare("INSERT INTO ItemTable (key, value) VALUES (?, ?)");
1902
+ const composer = {
1903
+ composerId: options.composerId,
1904
+ title: options.title,
1905
+ bubbleIds: [`${options.composerId}-user`, `${options.composerId}-assistant`],
1906
+ };
1907
+ if (options.storageMode === "composerData") {
1908
+ insert.run(`composerData:${options.composerId}`, JSON.stringify(composer));
1909
+ }
1910
+ else {
1911
+ insert.run("composer.composerData", JSON.stringify({ allComposers: [composer] }));
1912
+ }
1913
+ insert.run(`bubbleId:${options.composerId}-user`, JSON.stringify({
1914
+ bubbleId: `${options.composerId}-user`,
1915
+ type: 1,
1916
+ createdAt: "2026-03-10T03:30:00.000Z",
1917
+ text: `Inspect ${options.title}.`,
1918
+ }));
1919
+ insert.run(`bubbleId:${options.composerId}-assistant`, JSON.stringify({
1920
+ bubbleId: `${options.composerId}-assistant`,
1921
+ type: 2,
1922
+ createdAt: "2026-03-10T03:30:01.000Z",
1923
+ text: `${options.title} loaded.`,
1924
+ usage: {
1925
+ inputTokens: 10,
1926
+ outputTokens: 5,
1927
+ totalTokens: 15,
1928
+ },
1929
+ stopReason: "end_turn",
1930
+ }));
1931
+ }
1932
+ finally {
1933
+ db.close();
1934
+ }
1935
+ }
1936
+ export function seedCursorPromptHistoryDb(dbPath, options) {
1937
+ const observedAtMs = Date.parse(options.observedAt);
1938
+ const db = new DatabaseSync(dbPath);
1939
+ try {
1940
+ db.exec("CREATE TABLE ItemTable (key TEXT PRIMARY KEY, value BLOB NOT NULL)");
1941
+ const insert = db.prepare("INSERT INTO ItemTable (key, value) VALUES (?, ?)");
1942
+ insert.run("composer.composerData", JSON.stringify({
1943
+ allComposers: [
1944
+ {
1945
+ composerId: "cursor-prompt-history",
1946
+ name: options.title,
1947
+ lastUpdatedAt: observedAtMs,
1948
+ createdAt: observedAtMs,
1949
+ },
1950
+ ],
1951
+ }));
1952
+ insert.run("aiService.generations", JSON.stringify([
1953
+ {
1954
+ unixMs: observedAtMs,
1955
+ generationUUID: "cursor-prompt-history-gen-1",
1956
+ type: "composer",
1957
+ textDescription: options.prompt,
1958
+ },
1959
+ ]));
1960
+ insert.run("aiService.prompts", JSON.stringify([
1961
+ {
1962
+ text: options.prompt,
1963
+ commandType: 4,
1964
+ },
1965
+ ]));
1966
+ }
1967
+ finally {
1968
+ db.close();
1969
+ }
1970
+ }
1971
+ export function seedAntigravityTrajectoryStateDb(dbPath, options) {
1972
+ const db = new DatabaseSync(dbPath);
1973
+ try {
1974
+ db.exec("CREATE TABLE ItemTable (key TEXT PRIMARY KEY, value BLOB NOT NULL)");
1975
+ const insert = db.prepare("INSERT INTO ItemTable (key, value) VALUES (?, ?)");
1976
+ insert.run("antigravityUnifiedStateSync.trajectorySummaries", encodeAntigravityTrajectorySummary({
1977
+ trajectoryId: options.trajectoryId,
1978
+ title: options.title,
1979
+ workspacePath: options.workspacePath,
1980
+ createdAt: options.createdAt,
1981
+ updatedAt: options.updatedAt,
1982
+ }));
1983
+ }
1984
+ finally {
1985
+ db.close();
1986
+ }
1987
+ }
1988
+ export function seedAntigravityHistoryStateDb(dbPath, options) {
1989
+ const db = new DatabaseSync(dbPath);
1990
+ try {
1991
+ db.exec("CREATE TABLE ItemTable (key TEXT PRIMARY KEY, value BLOB NOT NULL)");
1992
+ const insert = db.prepare("INSERT INTO ItemTable (key, value) VALUES (?, ?)");
1993
+ insert.run("history.entries", JSON.stringify([
1994
+ {
1995
+ editor: {
1996
+ resource: `file:///Users/mock_user/.gemini/antigravity/brain/${options.sessionId}/implementation_plan.md.resolved`,
1997
+ label: "Implementation Plan",
1998
+ description: options.description,
1999
+ options: {
2000
+ override: "antigravity.artifactsEditorInput",
2001
+ },
2002
+ },
2003
+ timestamp: Date.parse(options.observedAt),
2004
+ },
2005
+ ]));
2006
+ }
2007
+ finally {
2008
+ db.close();
2009
+ }
2010
+ }
2011
+ export function seedAntigravityEmptyStateDb(dbPath) {
2012
+ const db = new DatabaseSync(dbPath);
2013
+ try {
2014
+ db.exec("CREATE TABLE ItemTable (key TEXT PRIMARY KEY, value BLOB NOT NULL)");
2015
+ }
2016
+ finally {
2017
+ db.close();
2018
+ }
2019
+ }
2020
+ export function encodeAntigravityTrajectorySummary(options) {
2021
+ const innerPayload = encodeLengthDelimitedFields([
2022
+ [1, Buffer.from(options.title, "utf8")],
2023
+ [7, encodeTimestamp(options.createdAt)],
2024
+ [9, encodeLengthDelimitedFields([[1, Buffer.from(`file://${options.workspacePath}`, "utf8")]])],
2025
+ [10, encodeTimestamp(options.updatedAt)],
2026
+ ]);
2027
+ const wrapper = encodeLengthDelimitedFields([
2028
+ [1, Buffer.from(innerPayload.toString("base64"), "utf8")],
2029
+ [2, innerPayload.length],
2030
+ ]);
2031
+ const outer = encodeLengthDelimitedFields([
2032
+ [1, Buffer.from(options.trajectoryId, "utf8")],
2033
+ [2, wrapper],
2034
+ ]);
2035
+ return encodeLengthDelimitedFields([[1, outer]]).toString("base64");
2036
+ }
2037
+ export function encodeTimestamp(value) {
2038
+ const millis = Date.parse(value);
2039
+ const seconds = Math.floor(millis / 1000);
2040
+ const nanos = (millis % 1000) * 1_000_000;
2041
+ return encodeLengthDelimitedFields([
2042
+ [1, seconds],
2043
+ [2, nanos],
2044
+ ]);
2045
+ }
2046
+ export function encodeLengthDelimitedFields(fields) {
2047
+ const chunks = [];
2048
+ for (const [fieldNumber, value] of fields) {
2049
+ if (typeof value === "number") {
2050
+ chunks.push(encodeVarint((fieldNumber << 3) | 0), encodeVarint(value));
2051
+ continue;
2052
+ }
2053
+ chunks.push(encodeVarint((fieldNumber << 3) | 2), encodeVarint(value.length), value);
2054
+ }
2055
+ return Buffer.concat(chunks);
2056
+ }
2057
+ export function encodeVarint(value) {
2058
+ const bytes = [];
2059
+ let remaining = value >>> 0;
2060
+ while (remaining >= 0x80) {
2061
+ bytes.push((remaining & 0x7f) | 0x80);
2062
+ remaining >>>= 7;
2063
+ }
2064
+ bytes.push(remaining);
2065
+ return Buffer.from(bytes);
2066
+ }
2067
+ export function createSourceDefinition(id, platform, baseDir, family = "local_coding_agent") {
2068
+ return {
2069
+ id,
2070
+ slot_id: platform,
2071
+ family,
2072
+ platform,
2073
+ display_name: `${platform} fixture`,
2074
+ base_dir: baseDir,
2075
+ };
2076
+ }
2077
+ export function getRepoMockDataRoot() {
2078
+ return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../mock_data");
2079
+ }
2080
+ export async function readStableAdapterValidationManifest() {
2081
+ return readJsonFixture(path.join(getRepoMockDataRoot(), "stable-adapter-validation.json"));
2082
+ }
2083
+ export async function readJsonFixture(filePath) {
2084
+ return JSON.parse(await readFile(filePath, "utf8"));
2085
+ }
2086
+ export function assertFragmentKinds(payload, expectedKinds) {
2087
+ assert.ok(payload);
2088
+ const fragmentKinds = new Set(payload.fragments.map((fragment) => fragment.fragment_kind));
2089
+ for (const fragmentKind of expectedKinds) {
2090
+ assert.ok(fragmentKinds.has(fragmentKind), `expected ${payload.source.platform} to emit ${fragmentKind}`);
2091
+ }
2092
+ }
2093
+ export async function initGitRepo(repoRoot, remoteUrl) {
2094
+ await execFileAsync("git", ["init", repoRoot]);
2095
+ await execFileAsync("git", ["-C", repoRoot, "remote", "add", "origin", remoteUrl]);
2096
+ }
2097
+ export function assertParserMetadata(payload) {
2098
+ const knownProfileIds = new Set(getSourceFormatProfiles().map((profile) => profile.id));
2099
+ for (const stageRun of payload.stage_runs) {
2100
+ assert.ok(stageRun.parser_version, `expected parser version for ${payload.source.platform}:${stageRun.stage_kind}`);
2101
+ assert.ok(stageRun.parser_capabilities?.length, `expected parser capabilities for ${payload.source.platform}:${stageRun.stage_kind}`);
2102
+ assert.equal(stageRun.source_format_profile_ids?.length, 1);
2103
+ assert.ok(knownProfileIds.has(stageRun.source_format_profile_ids[0]), `expected known source format profile for ${payload.source.platform}:${stageRun.stage_kind}`);
2104
+ }
2105
+ }
2106
+ //# sourceMappingURL=test-helpers.js.map