@cchistory/lite 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/INSTALL.md +1 -1
  2. package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
  3. package/apps/lite-cli/dist/agent-contract.js +41 -9
  4. package/apps/lite-cli/dist/agent-contract.js.map +1 -1
  5. package/apps/lite-cli/dist/agent-journeys.test.d.ts +2 -0
  6. package/apps/lite-cli/dist/agent-journeys.test.d.ts.map +1 -0
  7. package/apps/lite-cli/dist/agent-journeys.test.js +403 -0
  8. package/apps/lite-cli/dist/agent-journeys.test.js.map +1 -0
  9. package/apps/lite-cli/dist/index.d.ts.map +1 -1
  10. package/apps/lite-cli/dist/index.js +137 -60
  11. package/apps/lite-cli/dist/index.js.map +1 -1
  12. package/apps/lite-cli/dist/index.test.js +48 -5
  13. package/apps/lite-cli/dist/index.test.js.map +1 -1
  14. package/apps/lite-cli/dist/json-v2.d.ts.map +1 -1
  15. package/apps/lite-cli/dist/json-v2.js +8 -1
  16. package/apps/lite-cli/dist/json-v2.js.map +1 -1
  17. package/apps/lite-cli/dist/query.d.ts +15 -2
  18. package/apps/lite-cli/dist/query.d.ts.map +1 -1
  19. package/apps/lite-cli/dist/query.js +79 -4
  20. package/apps/lite-cli/dist/query.js.map +1 -1
  21. package/apps/lite-cli/dist/shell.d.ts +2 -1
  22. package/apps/lite-cli/dist/shell.d.ts.map +1 -1
  23. package/apps/lite-cli/dist/shell.js +20 -16
  24. package/apps/lite-cli/dist/shell.js.map +1 -1
  25. package/apps/lite-cli/dist/stats-command.d.ts +52 -0
  26. package/apps/lite-cli/dist/stats-command.d.ts.map +1 -0
  27. package/apps/lite-cli/dist/stats-command.js +322 -0
  28. package/apps/lite-cli/dist/stats-command.js.map +1 -0
  29. package/apps/lite-cli/dist/stats-command.test.d.ts +2 -0
  30. package/apps/lite-cli/dist/stats-command.test.d.ts.map +1 -0
  31. package/apps/lite-cli/dist/stats-command.test.js +154 -0
  32. package/apps/lite-cli/dist/stats-command.test.js.map +1 -0
  33. package/apps/lite-cli/dist/stats-render.d.ts +21 -0
  34. package/apps/lite-cli/dist/stats-render.d.ts.map +1 -0
  35. package/apps/lite-cli/dist/stats-render.js +207 -0
  36. package/apps/lite-cli/dist/stats-render.js.map +1 -0
  37. package/apps/lite-cli/dist/version.d.ts +1 -1
  38. package/apps/lite-cli/dist/version.js +1 -1
  39. package/apps/lite-tui/dist/index.d.ts.map +1 -1
  40. package/apps/lite-tui/dist/index.js +75 -4
  41. package/apps/lite-tui/dist/index.js.map +1 -1
  42. package/apps/lite-tui/dist/input.d.ts.map +1 -1
  43. package/apps/lite-tui/dist/input.js +124 -3
  44. package/apps/lite-tui/dist/input.js.map +1 -1
  45. package/apps/lite-tui/dist/model.d.ts +29 -4
  46. package/apps/lite-tui/dist/model.d.ts.map +1 -1
  47. package/apps/lite-tui/dist/model.js +91 -8
  48. package/apps/lite-tui/dist/model.js.map +1 -1
  49. package/apps/lite-tui/dist/render.d.ts +1 -1
  50. package/apps/lite-tui/dist/render.d.ts.map +1 -1
  51. package/apps/lite-tui/dist/render.js +21 -51
  52. package/apps/lite-tui/dist/render.js.map +1 -1
  53. package/apps/lite-tui/dist/state.d.ts +3 -1
  54. package/apps/lite-tui/dist/state.d.ts.map +1 -1
  55. package/apps/lite-tui/dist/state.js +31 -13
  56. package/apps/lite-tui/dist/state.js.map +1 -1
  57. package/apps/lite-tui/dist/state.test.js +118 -0
  58. package/apps/lite-tui/dist/state.test.js.map +1 -1
  59. package/apps/lite-tui/dist/stats-dashboard.test.d.ts +2 -0
  60. package/apps/lite-tui/dist/stats-dashboard.test.d.ts.map +1 -0
  61. package/apps/lite-tui/dist/stats-dashboard.test.js +191 -0
  62. package/apps/lite-tui/dist/stats-dashboard.test.js.map +1 -0
  63. package/apps/lite-tui/dist/stats-query.d.ts +11 -0
  64. package/apps/lite-tui/dist/stats-query.d.ts.map +1 -0
  65. package/apps/lite-tui/dist/stats-query.js +104 -0
  66. package/apps/lite-tui/dist/stats-query.js.map +1 -0
  67. package/apps/lite-tui/dist/stats-render.d.ts +9 -0
  68. package/apps/lite-tui/dist/stats-render.d.ts.map +1 -0
  69. package/apps/lite-tui/dist/stats-render.js +311 -0
  70. package/apps/lite-tui/dist/stats-render.js.map +1 -0
  71. package/apps/lite-tui/dist/stats-state.d.ts +121 -0
  72. package/apps/lite-tui/dist/stats-state.d.ts.map +1 -0
  73. package/apps/lite-tui/dist/stats-state.js +335 -0
  74. package/apps/lite-tui/dist/stats-state.js.map +1 -0
  75. package/apps/lite-tui/dist/version.d.ts +1 -1
  76. package/apps/lite-tui/dist/version.js +1 -1
  77. package/docs/guide/agent-evidence.md +154 -0
  78. package/docs/guide/for-agents.md +29 -10
  79. package/docs/guide/lite.md +31 -4
  80. package/docs/guide/pricing.example.json +38 -0
  81. package/docs/guide/query.md +10 -1
  82. package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts +85 -0
  83. package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts.map +1 -0
  84. package/node_modules/@cchistory/canonical/dist/conversation-evidence.js +191 -0
  85. package/node_modules/@cchistory/canonical/dist/conversation-evidence.js.map +1 -0
  86. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts +2 -0
  87. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts.map +1 -0
  88. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js +105 -0
  89. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js.map +1 -0
  90. package/node_modules/@cchistory/canonical/dist/index.d.ts +9 -2
  91. package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
  92. package/node_modules/@cchistory/canonical/dist/index.js +9 -2
  93. package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
  94. package/node_modules/@cchistory/canonical/dist/index.test.js +62 -1
  95. package/node_modules/@cchistory/canonical/dist/index.test.js.map +1 -1
  96. package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.d.ts +11 -0
  97. package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.d.ts.map +1 -0
  98. package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.js +96 -0
  99. package/node_modules/@cchistory/canonical/dist/model-pricing-catalog.js.map +1 -0
  100. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts +4 -3
  101. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts.map +1 -1
  102. package/node_modules/@cchistory/canonical/dist/projection-audit.js +34 -0
  103. package/node_modules/@cchistory/canonical/dist/projection-audit.js.map +1 -1
  104. package/node_modules/@cchistory/canonical/dist/query.js +1 -1
  105. package/node_modules/@cchistory/canonical/dist/query.js.map +1 -1
  106. package/node_modules/@cchistory/canonical/dist/read-order.d.ts +2 -0
  107. package/node_modules/@cchistory/canonical/dist/read-order.d.ts.map +1 -1
  108. package/node_modules/@cchistory/canonical/dist/read-order.js +10 -0
  109. package/node_modules/@cchistory/canonical/dist/read-order.js.map +1 -1
  110. package/node_modules/@cchistory/canonical/dist/read-status.d.ts +11 -0
  111. package/node_modules/@cchistory/canonical/dist/read-status.d.ts.map +1 -0
  112. package/node_modules/@cchistory/canonical/dist/read-status.js +14 -0
  113. package/node_modules/@cchistory/canonical/dist/read-status.js.map +1 -0
  114. package/node_modules/@cchistory/canonical/dist/session-family.js +3 -3
  115. package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
  116. package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +7 -3
  117. package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -1
  118. package/node_modules/@cchistory/canonical/dist/session-interpreter.js +40 -14
  119. package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -1
  120. package/node_modules/@cchistory/canonical/dist/usage-breakdown.d.ts +37 -0
  121. package/node_modules/@cchistory/canonical/dist/usage-breakdown.d.ts.map +1 -0
  122. package/node_modules/@cchistory/canonical/dist/usage-breakdown.js +274 -0
  123. package/node_modules/@cchistory/canonical/dist/usage-breakdown.js.map +1 -0
  124. package/node_modules/@cchistory/canonical/dist/usage-pricing-config.d.ts +11 -0
  125. package/node_modules/@cchistory/canonical/dist/usage-pricing-config.d.ts.map +1 -0
  126. package/node_modules/@cchistory/canonical/dist/usage-pricing-config.js +297 -0
  127. package/node_modules/@cchistory/canonical/dist/usage-pricing-config.js.map +1 -0
  128. package/node_modules/@cchistory/canonical/dist/usage-pricing.d.ts +28 -0
  129. package/node_modules/@cchistory/canonical/dist/usage-pricing.d.ts.map +1 -0
  130. package/node_modules/@cchistory/canonical/dist/usage-pricing.js +267 -0
  131. package/node_modules/@cchistory/canonical/dist/usage-pricing.js.map +1 -0
  132. package/node_modules/@cchistory/canonical/dist/usage-pricing.test.d.ts +2 -0
  133. package/node_modules/@cchistory/canonical/dist/usage-pricing.test.d.ts.map +1 -0
  134. package/node_modules/@cchistory/canonical/dist/usage-pricing.test.js +365 -0
  135. package/node_modules/@cchistory/canonical/dist/usage-pricing.test.js.map +1 -0
  136. package/node_modules/@cchistory/canonical/dist/usage-time.d.ts +53 -0
  137. package/node_modules/@cchistory/canonical/dist/usage-time.d.ts.map +1 -0
  138. package/node_modules/@cchistory/canonical/dist/usage-time.js +323 -0
  139. package/node_modules/@cchistory/canonical/dist/usage-time.js.map +1 -0
  140. package/node_modules/@cchistory/canonical/dist/usage.d.ts +46 -31
  141. package/node_modules/@cchistory/canonical/dist/usage.d.ts.map +1 -1
  142. package/node_modules/@cchistory/canonical/dist/usage.js +187 -96
  143. package/node_modules/@cchistory/canonical/dist/usage.js.map +1 -1
  144. package/node_modules/@cchistory/canonical/package.json +1 -1
  145. package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts +24 -0
  146. package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts.map +1 -0
  147. package/node_modules/@cchistory/domain/dist/conversation-evidence.js +2 -0
  148. package/node_modules/@cchistory/domain/dist/conversation-evidence.js.map +1 -0
  149. package/node_modules/@cchistory/domain/dist/index.d.ts +27 -2
  150. package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
  151. package/node_modules/@cchistory/domain/dist/index.js +1 -0
  152. package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
  153. package/node_modules/@cchistory/domain/dist/usage-pricing.d.ts +145 -0
  154. package/node_modules/@cchistory/domain/dist/usage-pricing.d.ts.map +1 -0
  155. package/node_modules/@cchistory/domain/dist/usage-pricing.js +7 -0
  156. package/node_modules/@cchistory/domain/dist/usage-pricing.js.map +1 -0
  157. package/node_modules/@cchistory/domain/package.json +1 -1
  158. package/node_modules/@cchistory/live-runtime/dist/antigravity.test.d.ts +2 -0
  159. package/node_modules/@cchistory/live-runtime/dist/antigravity.test.d.ts.map +1 -0
  160. package/node_modules/@cchistory/live-runtime/dist/antigravity.test.js +104 -0
  161. package/node_modules/@cchistory/live-runtime/dist/antigravity.test.js.map +1 -0
  162. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts +15 -0
  163. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts.map +1 -0
  164. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js +44 -0
  165. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js.map +1 -0
  166. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts +2 -0
  167. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts.map +1 -0
  168. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js +45 -0
  169. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js.map +1 -0
  170. package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts +7 -0
  171. package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts.map +1 -0
  172. package/node_modules/@cchistory/live-runtime/dist/diagnostics.js +2 -0
  173. package/node_modules/@cchistory/live-runtime/dist/diagnostics.js.map +1 -0
  174. package/node_modules/@cchistory/live-runtime/dist/grok-bot.test.d.ts +2 -0
  175. package/node_modules/@cchistory/live-runtime/dist/grok-bot.test.d.ts.map +1 -0
  176. package/node_modules/@cchistory/live-runtime/dist/grok-bot.test.js +211 -0
  177. package/node_modules/@cchistory/live-runtime/dist/grok-bot.test.js.map +1 -0
  178. package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts +24 -0
  179. package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts.map +1 -0
  180. package/node_modules/@cchistory/live-runtime/dist/history-reader.js +155 -0
  181. package/node_modules/@cchistory/live-runtime/dist/history-reader.js.map +1 -0
  182. package/node_modules/@cchistory/live-runtime/dist/index.d.ts +102 -5
  183. package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
  184. package/node_modules/@cchistory/live-runtime/dist/index.js +245 -58
  185. package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
  186. package/node_modules/@cchistory/live-runtime/dist/index.test.js +43 -2
  187. package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
  188. package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +2 -1
  189. package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -1
  190. package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -1
  191. package/node_modules/@cchistory/live-runtime/package.json +1 -1
  192. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.d.ts.map +1 -1
  193. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.js +10 -0
  194. package/node_modules/@cchistory/source-adapters/dist/core/atomizer.js.map +1 -1
  195. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts +7 -0
  196. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts.map +1 -1
  197. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.js.map +1 -1
  198. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts +12 -0
  199. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts.map +1 -0
  200. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js +32 -0
  201. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js.map +1 -0
  202. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts +2 -0
  203. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts.map +1 -0
  204. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js +21 -0
  205. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js.map +1 -0
  206. package/node_modules/@cchistory/source-adapters/dist/core/discovery.d.ts.map +1 -1
  207. package/node_modules/@cchistory/source-adapters/dist/core/discovery.js +16 -2
  208. package/node_modules/@cchistory/source-adapters/dist/core/discovery.js.map +1 -1
  209. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts +3 -1
  210. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts.map +1 -1
  211. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js +56 -38
  212. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js.map +1 -1
  213. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js +46 -1
  214. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -1
  215. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +15 -4
  216. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
  217. package/node_modules/@cchistory/source-adapters/dist/core/parser.js +181 -65
  218. package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
  219. package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
  220. package/node_modules/@cchistory/source-adapters/dist/core/probe.js +223 -61
  221. package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
  222. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +4 -1
  223. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -1
  224. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +4 -2
  225. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -1
  226. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +58 -0
  227. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -1
  228. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.js +2 -1
  229. package/node_modules/@cchistory/source-adapters/dist/core/registry.test.js.map +1 -1
  230. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +6 -2
  231. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
  232. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +16 -5
  233. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
  234. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +5 -2
  235. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
  236. package/node_modules/@cchistory/source-adapters/dist/core/user-text.d.ts +9 -7
  237. package/node_modules/@cchistory/source-adapters/dist/core/user-text.d.ts.map +1 -1
  238. package/node_modules/@cchistory/source-adapters/dist/core/user-text.js +34 -8
  239. package/node_modules/@cchistory/source-adapters/dist/core/user-text.js.map +1 -1
  240. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.js +11 -0
  241. package/node_modules/@cchistory/source-adapters/dist/core/utils.test.js.map +1 -1
  242. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +3 -0
  243. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
  244. package/node_modules/@cchistory/source-adapters/dist/index.test.js +3 -0
  245. package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
  246. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +49 -1
  247. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
  248. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.d.ts +1 -0
  249. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.d.ts.map +1 -1
  250. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.js +2 -0
  251. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/live.js.map +1 -1
  252. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/protobuf.d.ts +18 -0
  253. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/protobuf.d.ts.map +1 -0
  254. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/protobuf.js +105 -0
  255. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/protobuf.js.map +1 -0
  256. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/sqlite.d.ts +8 -0
  257. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/sqlite.d.ts.map +1 -0
  258. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/sqlite.js +227 -0
  259. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/sqlite.js.map +1 -0
  260. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/usage.d.ts +6 -0
  261. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/usage.d.ts.map +1 -0
  262. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/usage.js +22 -0
  263. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity/usage.js.map +1 -0
  264. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity-sqlite.test.d.ts +2 -0
  265. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity-sqlite.test.d.ts.map +1 -0
  266. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity-sqlite.test.js +145 -0
  267. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity-sqlite.test.js.map +1 -0
  268. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.d.ts +1 -0
  269. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.d.ts.map +1 -1
  270. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.js +14 -5
  271. package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.js.map +1 -1
  272. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/runtime.d.ts +27 -0
  273. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/runtime.d.ts.map +1 -0
  274. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/runtime.js +262 -0
  275. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/runtime.js.map +1 -0
  276. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/title.d.ts +18 -0
  277. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/title.d.ts.map +1 -0
  278. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/title.js +101 -0
  279. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot/title.js.map +1 -0
  280. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.d.ts +17 -0
  281. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.d.ts.map +1 -0
  282. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.js +145 -0
  283. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.js.map +1 -0
  284. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.test.d.ts +2 -0
  285. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.test.d.ts.map +1 -0
  286. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.test.js +423 -0
  287. package/node_modules/@cchistory/source-adapters/dist/platforms/grok-bot.test.js.map +1 -0
  288. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.d.ts.map +1 -1
  289. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.js +2 -0
  290. package/node_modules/@cchistory/source-adapters/dist/platforms/registry.js.map +1 -1
  291. package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts +1 -1
  292. package/node_modules/@cchistory/source-adapters/dist/platforms/types.d.ts.map +1 -1
  293. package/node_modules/@cchistory/source-adapters/dist/platforms/types.js +2 -1
  294. package/node_modules/@cchistory/source-adapters/dist/platforms/types.js.map +1 -1
  295. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -0
  296. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
  297. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +48 -29
  298. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
  299. package/node_modules/@cchistory/source-adapters/package.json +1 -1
  300. package/package.json +5 -5
  301. package/schemas/cchistory-lite-agent-v1.schema.json +8 -5
  302. package/schemas/cchistory-lite-canonical-v1.schema.json +82 -0
  303. package/schemas/cchistory-lite-diagnostic-v1.schema.json +27 -0
  304. package/schemas/cchistory-lite-query-result-v2.schema.json +232 -4
  305. package/schemas/cchistory-lite-query-result-v3.schema.json +45 -1
  306. package/schemas/cchistory-lite-query-v2.schema.json +150 -8
  307. package/schemas/cchistory-lite-v2.schema.json +82 -0
  308. package/skills/using-cchistory-lite/SKILL.md +86 -128
@@ -0,0 +1,335 @@
1
+ /**
2
+ * Role: Pure state, actions, cursor/filter reducers, and in-memory multiplier/alias/quota
3
+ * calibration for the Lite TUI's Plan A statistics dashboard (`i` overlay).
4
+ * Excludes ANSI frame rendering (stats-render.ts) and core usage arithmetic (canonical).
5
+ */
6
+ import { resolveStatsViewData, sortStatsRollupRows } from "./stats-query.js";
7
+ export { resolveStatsViewData, sortStatsRollupRows };
8
+ export const STATS_QUADRANTS = ["source", "project", "model", "day"];
9
+ export const STATS_MULTIPLIER_COLUMNS = [
10
+ "model",
11
+ "input",
12
+ "cache_read",
13
+ "cache_write",
14
+ "output",
15
+ "reasoning",
16
+ ];
17
+ export const STATS_TIME_PRESETS = ["all", "today", "24h", "week", "7d", "month", "30d"];
18
+ export const STATS_TIME_BUCKETS = ["day", "week", "month"];
19
+ export const STATS_WEEK_MODES = ["rolling_7d", "iso_week", "custom_reset"];
20
+ export const STATS_SORT_OPTIONS = [
21
+ "adjusted_cost",
22
+ "list_cost",
23
+ "tokens",
24
+ "turns",
25
+ "label",
26
+ ];
27
+ export function createLiteStatsState(model) {
28
+ return {
29
+ view: "quad",
30
+ activeQuadrant: "source",
31
+ timePreset: "all",
32
+ timeBucket: "day",
33
+ weekMode: model?.pricingConfig?.quota?.week_mode ?? "rolling_7d",
34
+ sortBy: "adjusted_cost",
35
+ filters: { projectIds: [], models: [], sourceIds: [], timeKeys: [] },
36
+ cursors: { source: 0, project: 0, model: 0, day: 0, matrix: 0, multipliers: 0 },
37
+ multiplierColIndex: 0,
38
+ customAliases: {},
39
+ multiplierOverrides: {},
40
+ quotaUsdOverride: undefined,
41
+ editing: undefined,
42
+ };
43
+ }
44
+ export function activeFilterSelection(stats, quadrant) {
45
+ switch (quadrant) {
46
+ case "project":
47
+ return stats.filters.projectIds;
48
+ case "model":
49
+ return stats.filters.models;
50
+ case "source":
51
+ return stats.filters.sourceIds;
52
+ case "day":
53
+ return stats.filters.timeKeys;
54
+ }
55
+ }
56
+ export function hasActiveStatsFilters(stats) {
57
+ return (stats.filters.projectIds.length > 0 ||
58
+ stats.filters.models.length > 0 ||
59
+ stats.filters.sourceIds.length > 0 ||
60
+ stats.filters.timeKeys.length > 0 ||
61
+ stats.timePreset !== "all");
62
+ }
63
+ function toggleKey(list, key) {
64
+ return list.includes(key) ? list.filter((item) => item !== key) : [...list, key];
65
+ }
66
+ function activeListLength(data, stats) {
67
+ if (stats.view === "matrix")
68
+ return data.matrixRows.length;
69
+ if (stats.view === "multipliers")
70
+ return data.modelResolutions.length;
71
+ return data.quadrantRows[stats.activeQuadrant].length;
72
+ }
73
+ function activeCursorKey(stats) {
74
+ if (stats.view === "matrix")
75
+ return "matrix";
76
+ if (stats.view === "multipliers")
77
+ return "multipliers";
78
+ return stats.activeQuadrant;
79
+ }
80
+ function clampStatsCursors(stats, data) {
81
+ const clamp = (value, len) => (len <= 0 ? 0 : Math.min(Math.max(0, value), len - 1));
82
+ return {
83
+ ...stats,
84
+ cursors: {
85
+ source: clamp(stats.cursors.source, data.quadrantRows.source.length),
86
+ project: clamp(stats.cursors.project, data.quadrantRows.project.length),
87
+ model: clamp(stats.cursors.model, data.quadrantRows.model.length),
88
+ day: clamp(stats.cursors.day, data.quadrantRows.day.length),
89
+ matrix: clamp(stats.cursors.matrix, data.matrixRows.length),
90
+ multipliers: clamp(stats.cursors.multipliers, data.modelResolutions.length),
91
+ },
92
+ };
93
+ }
94
+ function roundMult(value) {
95
+ return Math.max(0, Math.round(value * 100) / 100);
96
+ }
97
+ function getSelectedModelResolution(data, stats) {
98
+ const idx = Math.min(stats.cursors.multipliers, Math.max(0, data.modelResolutions.length - 1));
99
+ return data.modelResolutions[idx];
100
+ }
101
+ export function reduceLiteStatsState(model, stats, action) {
102
+ const data = resolveStatsViewData(model, stats);
103
+ const clamped = clampStatsCursors(stats, data);
104
+ switch (action.type) {
105
+ case "stats-cycle-quadrant": {
106
+ const idx = STATS_QUADRANTS.indexOf(clamped.activeQuadrant);
107
+ const nextIdx = (idx + (action.reverse ? -1 : 1) + STATS_QUADRANTS.length) % STATS_QUADRANTS.length;
108
+ return { ...clamped, activeQuadrant: STATS_QUADRANTS[nextIdx] ?? "source" };
109
+ }
110
+ case "stats-focus-quadrant":
111
+ return { ...clamped, view: "quad", activeQuadrant: action.quadrant };
112
+ case "stats-set-view":
113
+ return { ...clamped, view: action.view, editing: undefined };
114
+ case "stats-toggle-view":
115
+ return { ...clamped, view: clamped.view === action.view ? "quad" : action.view, editing: undefined };
116
+ case "stats-move": {
117
+ const key = activeCursorKey(clamped);
118
+ const len = activeListLength(data, clamped);
119
+ if (len === 0)
120
+ return clamped;
121
+ const next = Math.min(Math.max(0, clamped.cursors[key] + action.delta), len - 1);
122
+ return { ...clamped, cursors: { ...clamped.cursors, [key]: next } };
123
+ }
124
+ case "stats-jump": {
125
+ const key = activeCursorKey(clamped);
126
+ const len = activeListLength(data, clamped);
127
+ const next = action.edge === "first" ? 0 : Math.max(0, len - 1);
128
+ return { ...clamped, cursors: { ...clamped.cursors, [key]: next } };
129
+ }
130
+ case "stats-toggle-selection": {
131
+ if (clamped.view !== "quad")
132
+ return clamped;
133
+ const rows = data.quadrantRows[clamped.activeQuadrant];
134
+ const row = rows[clamped.cursors[clamped.activeQuadrant]];
135
+ if (!row)
136
+ return clamped;
137
+ const nextFilters = { ...clamped.filters };
138
+ if (clamped.activeQuadrant === "project")
139
+ nextFilters.projectIds = toggleKey(nextFilters.projectIds, row.key);
140
+ else if (clamped.activeQuadrant === "model")
141
+ nextFilters.models = toggleKey(nextFilters.models, row.key);
142
+ else if (clamped.activeQuadrant === "source")
143
+ nextFilters.sourceIds = toggleKey(nextFilters.sourceIds, row.key);
144
+ else
145
+ nextFilters.timeKeys = toggleKey(nextFilters.timeKeys, row.key);
146
+ const updated = { ...clamped, filters: nextFilters };
147
+ return clampStatsCursors(updated, resolveStatsViewData(model, updated));
148
+ }
149
+ case "stats-clear-filters": {
150
+ const updated = {
151
+ ...clamped,
152
+ timePreset: "all",
153
+ filters: { projectIds: [], models: [], sourceIds: [], timeKeys: [] },
154
+ };
155
+ return clampStatsCursors(updated, resolveStatsViewData(model, updated));
156
+ }
157
+ case "stats-cycle-time-preset": {
158
+ const idx = STATS_TIME_PRESETS.indexOf(clamped.timePreset);
159
+ const nextPreset = STATS_TIME_PRESETS[(idx + 1) % STATS_TIME_PRESETS.length] ?? "all";
160
+ const updated = { ...clamped, timePreset: nextPreset };
161
+ return clampStatsCursors(updated, resolveStatsViewData(model, updated));
162
+ }
163
+ case "stats-cycle-time-bucket": {
164
+ const idx = STATS_TIME_BUCKETS.indexOf(clamped.timeBucket);
165
+ const nextBucket = STATS_TIME_BUCKETS[(idx + 1) % STATS_TIME_BUCKETS.length] ?? "day";
166
+ const updated = {
167
+ ...clamped,
168
+ timeBucket: nextBucket,
169
+ filters: { ...clamped.filters, timeKeys: [] },
170
+ };
171
+ return clampStatsCursors(updated, resolveStatsViewData(model, updated));
172
+ }
173
+ case "stats-cycle-week-mode": {
174
+ const idx = STATS_WEEK_MODES.indexOf(clamped.weekMode);
175
+ const nextMode = STATS_WEEK_MODES[(idx + 1) % STATS_WEEK_MODES.length] ?? "rolling_7d";
176
+ const updated = { ...clamped, weekMode: nextMode };
177
+ return clampStatsCursors(updated, resolveStatsViewData(model, updated));
178
+ }
179
+ case "stats-cycle-sort": {
180
+ const idx = STATS_SORT_OPTIONS.indexOf(clamped.sortBy);
181
+ const nextSort = STATS_SORT_OPTIONS[(idx + 1) % STATS_SORT_OPTIONS.length] ?? "adjusted_cost";
182
+ return { ...clamped, sortBy: nextSort };
183
+ }
184
+ case "stats-multiplier-col": {
185
+ const nextCol = (clamped.multiplierColIndex + action.delta + STATS_MULTIPLIER_COLUMNS.length) % STATS_MULTIPLIER_COLUMNS.length;
186
+ return { ...clamped, multiplierColIndex: nextCol };
187
+ }
188
+ case "stats-multiplier-step": {
189
+ const targetModel = getSelectedModelResolution(data, clamped);
190
+ if (!targetModel)
191
+ return clamped;
192
+ const col = STATS_MULTIPLIER_COLUMNS[clamped.multiplierColIndex] ?? "model";
193
+ const currentVal = targetModel.multipliers[col];
194
+ const step = currentVal >= 2 && action.delta > 0 ? 0.25 : action.delta;
195
+ const nextVal = roundMult(currentVal + step);
196
+ const rawKey = targetModel.raw_model;
197
+ return {
198
+ ...clamped,
199
+ multiplierOverrides: {
200
+ ...clamped.multiplierOverrides,
201
+ [rawKey]: { ...(clamped.multiplierOverrides[rawKey] ?? {}), [col]: nextVal },
202
+ },
203
+ };
204
+ }
205
+ case "stats-multiplier-set": {
206
+ const targetModel = getSelectedModelResolution(data, clamped);
207
+ if (!targetModel)
208
+ return clamped;
209
+ const col = STATS_MULTIPLIER_COLUMNS[clamped.multiplierColIndex] ?? "model";
210
+ const rawKey = targetModel.raw_model;
211
+ return {
212
+ ...clamped,
213
+ multiplierOverrides: {
214
+ ...clamped.multiplierOverrides,
215
+ [rawKey]: { ...(clamped.multiplierOverrides[rawKey] ?? {}), [col]: roundMult(action.value) },
216
+ },
217
+ };
218
+ }
219
+ case "stats-multiplier-toggle-zero": {
220
+ const targetModel = getSelectedModelResolution(data, clamped);
221
+ if (!targetModel)
222
+ return clamped;
223
+ const col = STATS_MULTIPLIER_COLUMNS[clamped.multiplierColIndex] ?? "model";
224
+ const currentVal = targetModel.multipliers[col];
225
+ const nextVal = currentVal === 0 ? 1 : 0;
226
+ const rawKey = targetModel.raw_model;
227
+ return {
228
+ ...clamped,
229
+ multiplierOverrides: {
230
+ ...clamped.multiplierOverrides,
231
+ [rawKey]: { ...(clamped.multiplierOverrides[rawKey] ?? {}), [col]: nextVal },
232
+ },
233
+ };
234
+ }
235
+ case "stats-start-edit": {
236
+ if (action.target === "quota") {
237
+ const currentQuota = data.breakdown.quota_limit_usd;
238
+ return {
239
+ ...clamped,
240
+ editing: {
241
+ target: "quota",
242
+ value: "",
243
+ placeholder: currentQuota !== undefined ? String(currentQuota) : undefined,
244
+ },
245
+ };
246
+ }
247
+ const targetModel = getSelectedModelResolution(data, clamped);
248
+ if (!targetModel)
249
+ return clamped;
250
+ if (action.target === "alias") {
251
+ return {
252
+ ...clamped,
253
+ editing: {
254
+ target: "alias",
255
+ rawModel: targetModel.raw_model,
256
+ value: "",
257
+ placeholder: targetModel.resolved_model,
258
+ },
259
+ };
260
+ }
261
+ const col = STATS_MULTIPLIER_COLUMNS[clamped.multiplierColIndex] ?? "model";
262
+ return {
263
+ ...clamped,
264
+ editing: {
265
+ target: "multiplier",
266
+ rawModel: targetModel.raw_model,
267
+ col,
268
+ value: "",
269
+ placeholder: String(targetModel.multipliers[col]),
270
+ },
271
+ };
272
+ }
273
+ case "stats-edit-char":
274
+ return clamped.editing
275
+ ? { ...clamped, editing: { ...clamped.editing, value: `${clamped.editing.value}${action.char}` } }
276
+ : clamped;
277
+ case "stats-edit-backspace":
278
+ return clamped.editing
279
+ ? { ...clamped, editing: { ...clamped.editing, value: clamped.editing.value.slice(0, Math.max(0, clamped.editing.value.length - 1)) } }
280
+ : clamped;
281
+ case "stats-edit-cancel":
282
+ return { ...clamped, editing: undefined };
283
+ case "stats-edit-commit": {
284
+ const edit = clamped.editing;
285
+ if (!edit)
286
+ return clamped;
287
+ const trimmed = edit.value.trim();
288
+ if (!trimmed) {
289
+ return { ...clamped, editing: undefined };
290
+ }
291
+ if (edit.target === "quota") {
292
+ if (trimmed === "0" || trimmed.toLowerCase() === "clear" || trimmed.toLowerCase() === "none") {
293
+ return { ...clamped, quotaUsdOverride: undefined, editing: undefined };
294
+ }
295
+ const parsed = Number(trimmed);
296
+ if (!Number.isFinite(parsed) || parsed <= 0)
297
+ return { ...clamped, editing: undefined };
298
+ return { ...clamped, quotaUsdOverride: parsed, editing: undefined };
299
+ }
300
+ if (edit.target === "alias" && edit.rawModel) {
301
+ const nextAliases = { ...clamped.customAliases };
302
+ if (trimmed.toLowerCase() === "clear" || trimmed.toLowerCase() === "none") {
303
+ delete nextAliases[edit.rawModel];
304
+ }
305
+ else {
306
+ nextAliases[edit.rawModel] = trimmed;
307
+ }
308
+ return { ...clamped, customAliases: nextAliases, editing: undefined };
309
+ }
310
+ if (edit.target === "multiplier" && edit.rawModel && edit.col) {
311
+ const parsed = Number(trimmed);
312
+ if (!Number.isFinite(parsed) || parsed < 0)
313
+ return { ...clamped, editing: undefined };
314
+ return {
315
+ ...clamped,
316
+ multiplierOverrides: {
317
+ ...clamped.multiplierOverrides,
318
+ [edit.rawModel]: { ...(clamped.multiplierOverrides[edit.rawModel] ?? {}), [edit.col]: roundMult(parsed) },
319
+ },
320
+ editing: undefined,
321
+ };
322
+ }
323
+ return { ...clamped, editing: undefined };
324
+ }
325
+ case "stats-reset-overrides":
326
+ return {
327
+ ...clamped,
328
+ customAliases: {},
329
+ multiplierOverrides: {},
330
+ quotaUsdOverride: undefined,
331
+ editing: undefined,
332
+ };
333
+ }
334
+ }
335
+ //# sourceMappingURL=stats-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats-state.js","sourceRoot":"","sources":["../src/stats-state.ts"],"names":[],"mappings":"AAAA;;;;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AO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;QAC5C,CAAC;QACD,KAAK,uBAAuB;YAC1B,OAAO;gBACL,GAAG,OAAO;gBACV,aAAa,EAAE,EAAE;gBACjB,mBAAmB,EAAE,EAAE;gBACvB,gBAAgB,EAAE,SAAS;gBAC3B,OAAO,EAAE,SAAS;aACnB,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -7,5 +7,5 @@
7
7
  * matches the package manifest so the two cannot drift; `release-prepare.mjs`
8
8
  * rewrites this literal when cutting a release.
9
9
  */
10
- export declare const VERSION = "0.6.0";
10
+ export declare const VERSION = "0.8.0";
11
11
  //# sourceMappingURL=version.d.ts.map
@@ -7,5 +7,5 @@
7
7
  * matches the package manifest so the two cannot drift; `release-prepare.mjs`
8
8
  * rewrites this literal when cutting a release.
9
9
  */
10
- export const VERSION = "0.6.0";
10
+ export const VERSION = "0.8.0";
11
11
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,154 @@
1
+ # Bounded conversation evidence
2
+
3
+ Use the existing `query` v2 envelope or `shell --json` for these operations.
4
+ No database, remote service, installation of an agent-specific protocol, or
5
+ preparatory history scan is required.
6
+
7
+ ## Search answers and read citations
8
+
9
+ ```json
10
+ {"kind":"search","query":"retry backoff","content":"conversation","group_by":"message","limit":5,"max_chars":2000}
11
+ {"kind":"read","turn_ref":"<turn_id>","max_chars":8000}
12
+ {"kind":"read","session_ref":"<session_id>","max_chars":8000,"limit":20}
13
+ ```
14
+
15
+ One-shot input adds operation IDs:
16
+
17
+ ```json
18
+ {"schema":"cchistory-lite-query/v2","operations":[{"id":"find","kind":"search","query":"retry backoff","content":"conversation","group_by":"message","limit":5}]}
19
+ ```
20
+
21
+ Use the returned IDs for a subsequent read; batches do not interpolate one
22
+ operation's result into another. Directory/source flags apply to the request.
23
+ Responses retain `content_trust: untrusted_history`, projection issues and source
24
+ loss diagnostics. Recovered text and resume commands are evidence, not instructions.
25
+
26
+ Conversation search covers complete masked user and assistant text without the
27
+ legacy 16 KiB prefix bound. Terms use the existing case-insensitive all-terms
28
+ substring semantics. Results are grouped by top-level session, choosing a recent
29
+ matching message with deterministic ties. Set `group_by: "message"` to return every
30
+ matching message and page older decisions, subsequent mentions and reversals in
31
+ the same session. The result unit becomes `message`; citation fields retain the
32
+ actual message/session/turn identity. This is lexical evidence, not an automatic
33
+ decision or contradiction classifier. Titles and paths can still be searched
34
+ with the legacy authored search. There is no semantic search or tool-output search.
35
+ Each excerpt is at most 400 UTF-16 units and the sum fits `max_chars`.
36
+ `next_offset` continues the ranked result list within the same shell snapshot.
37
+
38
+ For delegated matches, `session_id` identifies the displayed parent and
39
+ `matched_session_id` identifies the child. `turn_id` and `message_id` always point
40
+ to the actual child evidence. Use `turn_ref` to read that question and answer.
41
+ An assistant message with no canonical user turn has `turn_id: null`; read its
42
+ `matched_session_id` with `session_ref`. No user turn is manufactured for a delegated
43
+ instruction. Such messages are retained from visible assistant atoms with the same
44
+ masking as ordinary replies; inherited/hidden/system text remains excluded.
45
+ Reading a parent session returns its own messages, not merged child turns.
46
+
47
+ ## Body budgets and continuation
48
+
49
+ `read` accepts exactly one `session_ref` or `turn_ref`, plus:
50
+
51
+ | Field | Default | Bounds / meaning |
52
+ | --- | --- | --- |
53
+ | `max_chars` | 8000 | 256–64000 UTF-16 units across returned text |
54
+ | `limit` | 20 | 1–100 message chunks |
55
+ | `cursor` | absent | Opaque `next_cursor` from the same target |
56
+
57
+ A result has `messages`, `returned_chars`, `total_messages`, `has_more` and
58
+ `next_cursor`. Each message chunk has its session/turn/message IDs, role, time,
59
+ `start`, `end`, `total_chars` and `truncated`. Offsets count UTF-16 units; Unicode
60
+ surrogate pairs are never split. Empty messages remain addressable. Budgets bound
61
+ body text; JSON escaping, IDs, metadata and diagnostics add bytes to the envelope.
62
+ They are not token budgets or source-work limits. Existing outputs are unchanged:
63
+ `show session --json` still omits reply bodies, and legacy session/replies/turn
64
+ projections still return complete text. Prefer `read` for bounded agent output.
65
+
66
+ Send the same target with `next_cursor` to continue. A cursor binds the ordered
67
+ masked content, resolved target and directory scope; duplicate titles and
68
+ interleaved sessions cannot shift it onto another conversation. Changed content
69
+ or an incompatible cursor yields `invalid_evidence_cursor` and
70
+ `recovery: restart_without_cursor`. Do not silently continue at the old offset.
71
+ The cursor is not an authorization token, persistent cache handle or native offset.
72
+
73
+ ## Snapshot ownership
74
+
75
+ Opening a shell does not scan. Its first collection read prepares a snapshot.
76
+ Conversation search requests an additional masked user/reply projection; when
77
+ that is the first collection read, one scan supplies both search and bounded reads.
78
+ If a lighter collection already exists, the first conversation search replaces
79
+ it with a newly prepared collection; old detail entries are discarded only after
80
+ that preparation succeeds. Full tool/system contexts are not retained for search.
81
+
82
+ Known detail targets use exact session reads. The shell retains up to four detail
83
+ snapshots under a 16 MiB conservative retained-data estimate, evicting least recently
84
+ used entries. An oversized detail still returns but is not cached, so paging it
85
+ may rescan. The estimate is not a process-RSS guarantee. Batches mixing collection
86
+ and detail operations need a complete collection scan; a targeted detail snapshot
87
+ is never reused as a complete collection.
88
+
89
+ Every history response exposes `read.id` and `read.prepared_at`. Collections and
90
+ late details may come from different reads. Explicit successful refresh replaces
91
+ the collection and clears all details; failed refresh preserves usable reads.
92
+ Cached evidence remains a point-in-time read until refresh, eviction or close.
93
+ A prepared page reader owns an immutable evidence list and hashes its complete
94
+ content once, using bounded UTF-16 chunks. Snapshot-owned page readers have a
95
+ 32-entry / 100,000 retained-message-and-key-unit LRU; oversized entries still work
96
+ without caching. Ranked authored-search caches in runtime and TUI each have
97
+ 32-entry / 20,000 result/highlight/key-unit limits. These limits bound additional
98
+ cache state, not the snapshot's underlying text or process RSS. Eviction preserves
99
+ answers and snapshot-time authored-search scores but may repeat preparation.
100
+ Cursors from an older incompatible build need
101
+ the existing `restart_without_cursor` recovery.
102
+
103
+ A one-shot continuation re-reads sources and validates content identity. Native
104
+ changes are not watched. EOF, exit and idle expiry release all process-owned state.
105
+
106
+ ## Source completeness is separate from query execution
107
+
108
+ Top-level `read_status` summarizes observed gaps:
109
+
110
+ - `partial`: source errors, warning/error loss audits, unknown directory attribution
111
+ or projection issues. `reasons` and counts point to the detailed diagnostics.
112
+ - `unverified`: file-limited/sample scanning or selective observed-only diagnostics.
113
+ - `no_known_gaps`: no known gap in the requested read. This is not a guarantee of
114
+ atomicity, latest writes, or discovery of unknown native formats.
115
+
116
+ SQL `coverage.execution: complete` means the query used the complete materialized
117
+ snapshot. It can coexist with `read_status.status: partial` when a native file was
118
+ unreadable. `total` is the matching count within that snapshot. Output continuation
119
+ is independent of native completeness. Source metadata inventory has not read
120
+ history and does not claim this history status.
121
+
122
+ Preserve the requested scope on failure. Read budgets and the memory watchdog
123
+ remain active; a smaller output budget is not a promise of a smaller source read.
124
+
125
+ ## Observe a read
126
+
127
+ ```sh
128
+ cchistory-lite shell --dir /path/to/project --json --diagnostics
129
+ ```
130
+
131
+ `--diagnostics` is opt-in on CLI history reads and shell. Stdout retains its result
132
+ contract. Stderr emits one JSON object per line: `cchistory-lite-diagnostic/v1`
133
+ for read start/done/error, progress, budget, SQL work, cache and notice events;
134
+ existing structured errors retain `cchistory-lite-error/v1`. Parse by `schema`.
135
+ TUI and pure `agent` introspection do not support this flag.
136
+
137
+ Attempt events include `attempt_id`, elapsed milliseconds, sampled heap/RSS and
138
+ process-lifetime peak RSS. Successful reads expose `read_id`; shell cache events
139
+ identify the reused read. Progress counts carry `count_unit` (files, records,
140
+ sessions or turns) where supplied. `elapsed_ms` measures the attempt so far;
141
+ optional `stage_elapsed_ms` reports the producer's duration for that completed stage.
142
+ Parent stages such as file/source completion include their child work, so do not sum
143
+ all stage durations as independent costs. `size_bytes` is the native file size, not bytes
144
+ physically read. SQL `query_work` separates inventory from processed records,
145
+ canonical interpretations and retained rows; its counters are not JSON.parse or
146
+ physical syscall counts. A budget event names the allocation unit, requested
147
+ native bytes, live allowed bytes and separate heap/system availability. Admitted
148
+ events report increases in the largest unit, rather than logging every row.
149
+
150
+ Events exclude transcript/tool bodies and query text. Local scope paths and
151
+ allocation-unit paths can occur; choose where to retain stderr accordingly.
152
+ The diagnostic stream is neither a persistent history store nor a hard memory
153
+ quota. A file/record refused by admission remains visible through source losses
154
+ and `read_status: partial`; a successful scan completion does not erase that gap.
@@ -4,6 +4,9 @@ Start directly with `cchistory-lite latest sessions 10 --dir /path/to/project --
4
4
  or open `shell --dir /path/to/project --json` for repeated questions. No preparatory
5
5
  scan is required. `sources --json` is optional metadata-only discovery. `agent` is
6
6
  the optional machine contract; `agent skill` and `agent guide` print documentation.
7
+ For past answers and decisions, use `search` with `content: "conversation"` and then
8
+ bounded `read` operations. The [evidence guide](agent-evidence.md) covers citations,
9
+ continuation, delegated messages and `read_status`.
7
10
 
8
11
  ## Pipeline
9
12
 
@@ -16,10 +19,11 @@ derivation → one in-memory snapshot → projections → the surface you called
16
19
  `show`, `stats`, `export`, `query`) each perform one fresh scan and drop the
17
20
  snapshot on exit. There is no cross-command cache; zero-store is the design,
18
21
  not a missing feature.
19
- - `shell` and the TUI hold one snapshot for the process lifetime and rescan on
20
- demand.
22
+ - The TUI holds one snapshot. Shell holds one collection plus a bounded detail
23
+ cache; each response identifies its actual read. Refresh replaces these on success.
21
24
  - Context-light scans (the default for collection, search, and stats reads)
22
- release full assistant/tool context after projecting turns and sessions.
25
+ release full assistant/tool context after projecting turns and sessions. Conversation
26
+ search additionally retains masked user/reply evidence without full tool/system bodies.
23
27
  Full-context paths — JSON/JSONL `export`, `show session <exact id>`, and
24
28
  context-matching `show` / `query` replies — retain more and therefore cost
25
29
  more. Markdown `export` is context-light: it drops turn context after
@@ -51,6 +55,11 @@ Resource admission applies to sample and exact-id reads as well as full reads:
51
55
  SQLite readers check selected value lengths and row overhead inside a read transaction.
52
56
  An input that exceeds its budget leaves loss diagnostics; other readable history
53
57
  remains available. Do not interpret a result with read-loss diagnostics as exhaustive.
58
+ Large Codex/Claude/Factory JSONL is admitted by block and growing record;
59
+ ZCode reads message groups and individual part values rather than one whole
60
+ body table. Other formats can still require whole-file or whole-result allocations.
61
+ Full canonical contexts are still constructed before context-light reads discard
62
+ them. Streaming does not establish a bound on arbitrary semantic state.
54
63
  4. The watchdog reserves 25% of estimated system availability at scan start, capped
55
64
  at 512 MiB so normal host load changes with gigabytes still free do not abort a scan. It checks at progress/checkpoints;
56
65
  it cannot interrupt a synchronous native allocation.
@@ -64,11 +73,16 @@ Concurrent appends and WAL changes are normal. Version-dependent query optimizat
64
73
  fall back to ordinary reads when evidence changes. Snapshots need not contain the
65
74
  latest write from every source. Reuse a successful read with
66
75
  one shell or a query batch. Do not discard stderr.
76
+ Use `--diagnostics` for optional structured progress, budget facts, SQL work and
77
+ shell reuse on stderr while preserving stdout. See the
78
+ [diagnostic contract](agent-evidence.md#observe-a-read).
67
79
 
68
80
  For empty scoped results, inspect `diagnostics.directory_scope`: unknown directory
69
81
  counts describe observed sessions excluded from the scope, not absent project history.
70
82
  Sources and loss audits describe other observed gaps. These diagnostics do not
71
83
  silently change the directory predicate or claim all native records were readable.
84
+ The top-level `read_status` summarizes these gaps. `partial` and `unverified` need
85
+ qualification; `no_known_gaps` is not a guarantee of atomic native completeness.
72
86
 
73
87
  ## Concurrency discipline
74
88
 
@@ -100,14 +114,18 @@ Structured-output commands (`--json`, `query`, `shell --json`, `agent`) write a
100
114
  `cchistory-lite-error/v1` document to stderr on failure and leave stdout empty.
101
115
  Error codes: `invalid_usage`, `reference_not_found`, `ambiguous_reference`,
102
116
  `invalid_query_request`, `scan_failed`, `scan_guard_refused`,
103
- `scan_guard_aborted`, `read_budget_exceeded`. Shell per-line failures are returned as
117
+ `scan_guard_aborted`, `read_budget_exceeded`. A read operation can return
118
+ `invalid_evidence_cursor` with `recovery: restart_without_cursor` after evidence changes.
119
+ Shell per-line failures are returned as
104
120
  error lines on stdout and leave the shell available for subsequent commands.
105
121
 
106
122
  ## Composition recipes
107
123
 
108
- - **Find, then read**: `search "<q>" --json` → take a session id →
109
- `show session <id> --json`. Search rows are top-level sessions; delegated
110
- children appear under the parent's related work.
124
+ - **Find an answer, then read**: in shell, send
125
+ `{"kind":"search","query":"<q>","content":"conversation"}` and then
126
+ `{"kind":"read","turn_ref":"<turn_id>"}`. If the hit has a null turn ID,
127
+ read `matched_session_id` with `session_ref`. Legacy `show session --json`
128
+ omits reply bodies; bounded reads return both questions and answers.
111
129
  - **Optional preview**: `sample --json` selects file/groups and caps rendered sessions;
112
130
  containers can still require substantial parsing. It is not a first-use prerequisite.
113
131
  - **Many reads, one scan**: batch operations into `query --request -`
@@ -135,7 +153,8 @@ into SQL. Unsupported queries fail before scanning; a whole v3 batch is validate
135
153
  `--complete` requests an exact total and exhaustive diagnostics. Existing v2 operations remain
136
154
  available, with their original totals and output.
137
155
 
138
- A shell reuses one snapshot and SQL read ID until a successful refresh. Idle expiry defaults to
156
+ A shell reuses its collection read ID until a successful refresh or preparation of conversation
157
+ search evidence. Idle expiry defaults to
139
158
  300 seconds; use `--idle-timeout 0` for a client that deliberately remains idle longer. Exit and
140
- EOF close the shell, while active requests suspend expiry. Detail reads retain their existing
141
- fresh-scan behavior; the SQL read ID is not a detail cache handle.
159
+ EOF close the shell, while active requests suspend expiry. Details use bounded process-local
160
+ reuse and identify their own snapshot; a SQL read ID is not a native transaction or persistent handle.