opentasks 0.0.5 → 0.0.7

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 (406) hide show
  1. package/README.md +108 -0
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +217 -8
  5. package/dist/cli.js.map +1 -1
  6. package/dist/client/client.d.ts +47 -1
  7. package/dist/client/client.d.ts.map +1 -1
  8. package/dist/client/client.js +71 -0
  9. package/dist/client/client.js.map +1 -1
  10. package/dist/client/index.d.ts +1 -1
  11. package/dist/client/index.d.ts.map +1 -1
  12. package/dist/config/schema.d.ts +232 -4
  13. package/dist/config/schema.d.ts.map +1 -1
  14. package/dist/config/schema.js +161 -7
  15. package/dist/config/schema.js.map +1 -1
  16. package/dist/context-files/context-files.d.ts +72 -0
  17. package/dist/context-files/context-files.d.ts.map +1 -0
  18. package/dist/context-files/context-files.js +145 -0
  19. package/dist/context-files/context-files.js.map +1 -0
  20. package/dist/context-files/index.d.ts +16 -0
  21. package/dist/context-files/index.d.ts.map +1 -0
  22. package/dist/context-files/index.js +14 -0
  23. package/dist/context-files/index.js.map +1 -0
  24. package/dist/context-files/resolver.d.ts +43 -0
  25. package/dist/context-files/resolver.d.ts.map +1 -0
  26. package/dist/context-files/resolver.js +127 -0
  27. package/dist/context-files/resolver.js.map +1 -0
  28. package/dist/context-files/types.d.ts +94 -0
  29. package/dist/context-files/types.d.ts.map +1 -0
  30. package/dist/context-files/types.js +10 -0
  31. package/dist/context-files/types.js.map +1 -0
  32. package/dist/context-files/watcher-integration.d.ts +47 -0
  33. package/dist/context-files/watcher-integration.d.ts.map +1 -0
  34. package/dist/context-files/watcher-integration.js +47 -0
  35. package/dist/context-files/watcher-integration.js.map +1 -0
  36. package/dist/core/merge-driver.d.ts +11 -2
  37. package/dist/core/merge-driver.d.ts.map +1 -1
  38. package/dist/core/merge-driver.js +46 -7
  39. package/dist/core/merge-driver.js.map +1 -1
  40. package/dist/core/worktree.js +1 -1
  41. package/dist/core/worktree.js.map +1 -1
  42. package/dist/daemon/index.d.ts +6 -4
  43. package/dist/daemon/index.d.ts.map +1 -1
  44. package/dist/daemon/index.js +3 -2
  45. package/dist/daemon/index.js.map +1 -1
  46. package/dist/daemon/ipc.d.ts.map +1 -1
  47. package/dist/daemon/ipc.js +12 -2
  48. package/dist/daemon/ipc.js.map +1 -1
  49. package/dist/daemon/lifecycle.d.ts.map +1 -1
  50. package/dist/daemon/lifecycle.js +143 -25
  51. package/dist/daemon/lifecycle.js.map +1 -1
  52. package/dist/daemon/location-state.d.ts +12 -6
  53. package/dist/daemon/location-state.d.ts.map +1 -1
  54. package/dist/daemon/location-state.js +50 -20
  55. package/dist/daemon/location-state.js.map +1 -1
  56. package/dist/daemon/methods/context-files.d.ts +14 -0
  57. package/dist/daemon/methods/context-files.d.ts.map +1 -0
  58. package/dist/daemon/methods/context-files.js +95 -0
  59. package/dist/daemon/methods/context-files.js.map +1 -0
  60. package/dist/daemon/methods/provider.d.ts.map +1 -1
  61. package/dist/daemon/methods/provider.js +15 -0
  62. package/dist/daemon/methods/provider.js.map +1 -1
  63. package/dist/daemon/methods/tools.d.ts +1 -1
  64. package/dist/daemon/methods/tools.d.ts.map +1 -1
  65. package/dist/daemon/methods/tools.js +3 -2
  66. package/dist/daemon/methods/tools.js.map +1 -1
  67. package/dist/daemon/sessionlog-linker.d.ts +71 -0
  68. package/dist/daemon/sessionlog-linker.d.ts.map +1 -0
  69. package/dist/daemon/sessionlog-linker.js +472 -0
  70. package/dist/daemon/sessionlog-linker.js.map +1 -0
  71. package/dist/daemon/sessionlog-watcher.d.ts +79 -0
  72. package/dist/daemon/sessionlog-watcher.d.ts.map +1 -0
  73. package/dist/daemon/sessionlog-watcher.js +289 -0
  74. package/dist/daemon/sessionlog-watcher.js.map +1 -0
  75. package/dist/graph/git-graph-syncer.js +1 -1
  76. package/dist/graph/git-graph-syncer.js.map +1 -1
  77. package/dist/graph/index.d.ts +1 -1
  78. package/dist/graph/index.d.ts.map +1 -1
  79. package/dist/graph/index.js.map +1 -1
  80. package/dist/graph/provider-store.d.ts +78 -4
  81. package/dist/graph/provider-store.d.ts.map +1 -1
  82. package/dist/graph/provider-store.js +579 -55
  83. package/dist/graph/provider-store.js.map +1 -1
  84. package/dist/graph/store.d.ts.map +1 -1
  85. package/dist/graph/store.js +3 -0
  86. package/dist/graph/store.js.map +1 -1
  87. package/dist/graph/types.d.ts +16 -0
  88. package/dist/graph/types.d.ts.map +1 -1
  89. package/dist/graph/types.js.map +1 -1
  90. package/dist/index.d.ts +4 -2
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +9 -3
  93. package/dist/index.js.map +1 -1
  94. package/dist/materialization/git-archive-store.js +2 -2
  95. package/dist/materialization/git-archive-store.js.map +1 -1
  96. package/dist/materialization/git-remote-store.js +2 -2
  97. package/dist/materialization/git-remote-store.js.map +1 -1
  98. package/dist/materialization/snapshot.js +4 -4
  99. package/dist/materialization/snapshot.js.map +1 -1
  100. package/dist/mcp/index.d.ts +8 -0
  101. package/dist/mcp/index.d.ts.map +1 -0
  102. package/dist/mcp/index.js +8 -0
  103. package/dist/mcp/index.js.map +1 -0
  104. package/dist/mcp/server.d.ts +39 -0
  105. package/dist/mcp/server.d.ts.map +1 -0
  106. package/dist/mcp/server.js +677 -0
  107. package/dist/mcp/server.js.map +1 -0
  108. package/dist/mcp/stdio.d.ts +14 -0
  109. package/dist/mcp/stdio.d.ts.map +1 -0
  110. package/dist/mcp/stdio.js +19 -0
  111. package/dist/mcp/stdio.js.map +1 -0
  112. package/dist/providers/beads.d.ts.map +1 -1
  113. package/dist/providers/beads.js +17 -1
  114. package/dist/providers/beads.js.map +1 -1
  115. package/dist/providers/claude-tasks-fs.d.ts +22 -0
  116. package/dist/providers/claude-tasks-fs.d.ts.map +1 -0
  117. package/dist/providers/claude-tasks-fs.js +158 -0
  118. package/dist/providers/claude-tasks-fs.js.map +1 -0
  119. package/dist/providers/claude-tasks.d.ts +13 -4
  120. package/dist/providers/claude-tasks.d.ts.map +1 -1
  121. package/dist/providers/claude-tasks.js +318 -5
  122. package/dist/providers/claude-tasks.js.map +1 -1
  123. package/dist/providers/from-config.d.ts +3 -0
  124. package/dist/providers/from-config.d.ts.map +1 -1
  125. package/dist/providers/from-config.js +64 -17
  126. package/dist/providers/from-config.js.map +1 -1
  127. package/dist/providers/global.d.ts.map +1 -1
  128. package/dist/providers/global.js +5 -0
  129. package/dist/providers/global.js.map +1 -1
  130. package/dist/providers/index.d.ts +9 -4
  131. package/dist/providers/index.d.ts.map +1 -1
  132. package/dist/providers/index.js +10 -3
  133. package/dist/providers/index.js.map +1 -1
  134. package/dist/providers/map-client-factory.d.ts +55 -0
  135. package/dist/providers/map-client-factory.d.ts.map +1 -0
  136. package/dist/providers/map-client-factory.js +123 -0
  137. package/dist/providers/map-client-factory.js.map +1 -0
  138. package/dist/providers/map-event-bridge.d.ts +146 -0
  139. package/dist/providers/map-event-bridge.d.ts.map +1 -0
  140. package/dist/providers/map-event-bridge.js +208 -0
  141. package/dist/providers/map-event-bridge.js.map +1 -0
  142. package/dist/providers/map.d.ts +115 -0
  143. package/dist/providers/map.d.ts.map +1 -0
  144. package/dist/providers/map.js +381 -0
  145. package/dist/providers/map.js.map +1 -0
  146. package/dist/providers/materialization.d.ts +23 -5
  147. package/dist/providers/materialization.d.ts.map +1 -1
  148. package/dist/providers/materialization.js +95 -4
  149. package/dist/providers/materialization.js.map +1 -1
  150. package/dist/providers/native.d.ts.map +1 -1
  151. package/dist/providers/native.js +5 -0
  152. package/dist/providers/native.js.map +1 -1
  153. package/dist/providers/sessionlog.d.ts +81 -0
  154. package/dist/providers/sessionlog.d.ts.map +1 -0
  155. package/dist/providers/sessionlog.js +478 -0
  156. package/dist/providers/sessionlog.js.map +1 -0
  157. package/dist/providers/sudocode.d.ts.map +1 -1
  158. package/dist/providers/sudocode.js +17 -1
  159. package/dist/providers/sudocode.js.map +1 -1
  160. package/dist/providers/traits/Reconcilable.d.ts +57 -0
  161. package/dist/providers/traits/Reconcilable.d.ts.map +1 -0
  162. package/dist/providers/traits/Reconcilable.js +18 -0
  163. package/dist/providers/traits/Reconcilable.js.map +1 -0
  164. package/dist/providers/traits/index.d.ts +2 -0
  165. package/dist/providers/traits/index.d.ts.map +1 -1
  166. package/dist/providers/traits/index.js +1 -0
  167. package/dist/providers/traits/index.js.map +1 -1
  168. package/dist/providers/types.d.ts +63 -0
  169. package/dist/providers/types.d.ts.map +1 -1
  170. package/dist/providers/types.js +22 -0
  171. package/dist/providers/types.js.map +1 -1
  172. package/dist/schema/edges.d.ts +3 -3
  173. package/dist/schema/edges.d.ts.map +1 -1
  174. package/dist/sessionlog/agent/agents/claude-code.d.ts +76 -0
  175. package/dist/sessionlog/agent/agents/claude-code.d.ts.map +1 -0
  176. package/dist/sessionlog/agent/agents/claude-code.js +759 -0
  177. package/dist/sessionlog/agent/agents/claude-code.js.map +1 -0
  178. package/dist/sessionlog/agent/agents/cursor.d.ts +35 -0
  179. package/dist/sessionlog/agent/agents/cursor.d.ts.map +1 -0
  180. package/dist/sessionlog/agent/agents/cursor.js +294 -0
  181. package/dist/sessionlog/agent/agents/cursor.js.map +1 -0
  182. package/dist/sessionlog/agent/agents/gemini-cli.d.ts +62 -0
  183. package/dist/sessionlog/agent/agents/gemini-cli.d.ts.map +1 -0
  184. package/dist/sessionlog/agent/agents/gemini-cli.js +462 -0
  185. package/dist/sessionlog/agent/agents/gemini-cli.js.map +1 -0
  186. package/dist/sessionlog/agent/agents/opencode.d.ts +100 -0
  187. package/dist/sessionlog/agent/agents/opencode.d.ts.map +1 -0
  188. package/dist/sessionlog/agent/agents/opencode.js +423 -0
  189. package/dist/sessionlog/agent/agents/opencode.js.map +1 -0
  190. package/dist/sessionlog/agent/registry.d.ts +54 -0
  191. package/dist/sessionlog/agent/registry.d.ts.map +1 -0
  192. package/dist/sessionlog/agent/registry.js +123 -0
  193. package/dist/sessionlog/agent/registry.js.map +1 -0
  194. package/dist/sessionlog/agent/session-types.d.ts +45 -0
  195. package/dist/sessionlog/agent/session-types.d.ts.map +1 -0
  196. package/dist/sessionlog/agent/session-types.js +50 -0
  197. package/dist/sessionlog/agent/session-types.js.map +1 -0
  198. package/dist/sessionlog/agent/types.d.ts +126 -0
  199. package/dist/sessionlog/agent/types.d.ts.map +1 -0
  200. package/dist/sessionlog/agent/types.js +39 -0
  201. package/dist/sessionlog/agent/types.js.map +1 -0
  202. package/dist/sessionlog/commands/clean.d.ts +40 -0
  203. package/dist/sessionlog/commands/clean.d.ts.map +1 -0
  204. package/dist/sessionlog/commands/clean.js +105 -0
  205. package/dist/sessionlog/commands/clean.js.map +1 -0
  206. package/dist/sessionlog/commands/disable.d.ts +23 -0
  207. package/dist/sessionlog/commands/disable.d.ts.map +1 -0
  208. package/dist/sessionlog/commands/disable.js +57 -0
  209. package/dist/sessionlog/commands/disable.js.map +1 -0
  210. package/dist/sessionlog/commands/doctor.d.ts +43 -0
  211. package/dist/sessionlog/commands/doctor.d.ts.map +1 -0
  212. package/dist/sessionlog/commands/doctor.js +97 -0
  213. package/dist/sessionlog/commands/doctor.js.map +1 -0
  214. package/dist/sessionlog/commands/enable.d.ts +31 -0
  215. package/dist/sessionlog/commands/enable.d.ts.map +1 -0
  216. package/dist/sessionlog/commands/enable.js +102 -0
  217. package/dist/sessionlog/commands/enable.js.map +1 -0
  218. package/dist/sessionlog/commands/explain.d.ts +69 -0
  219. package/dist/sessionlog/commands/explain.d.ts.map +1 -0
  220. package/dist/sessionlog/commands/explain.js +185 -0
  221. package/dist/sessionlog/commands/explain.js.map +1 -0
  222. package/dist/sessionlog/commands/reset.d.ts +23 -0
  223. package/dist/sessionlog/commands/reset.d.ts.map +1 -0
  224. package/dist/sessionlog/commands/reset.js +68 -0
  225. package/dist/sessionlog/commands/reset.js.map +1 -0
  226. package/dist/sessionlog/commands/resume.d.ts +42 -0
  227. package/dist/sessionlog/commands/resume.d.ts.map +1 -0
  228. package/dist/sessionlog/commands/resume.js +134 -0
  229. package/dist/sessionlog/commands/resume.js.map +1 -0
  230. package/dist/sessionlog/commands/rewind.d.ts +40 -0
  231. package/dist/sessionlog/commands/rewind.d.ts.map +1 -0
  232. package/dist/sessionlog/commands/rewind.js +155 -0
  233. package/dist/sessionlog/commands/rewind.js.map +1 -0
  234. package/dist/sessionlog/commands/status.d.ts +54 -0
  235. package/dist/sessionlog/commands/status.d.ts.map +1 -0
  236. package/dist/sessionlog/commands/status.js +95 -0
  237. package/dist/sessionlog/commands/status.js.map +1 -0
  238. package/dist/sessionlog/config.d.ts +40 -0
  239. package/dist/sessionlog/config.d.ts.map +1 -0
  240. package/dist/sessionlog/config.js +126 -0
  241. package/dist/sessionlog/config.js.map +1 -0
  242. package/dist/sessionlog/git-operations.d.ts +173 -0
  243. package/dist/sessionlog/git-operations.d.ts.map +1 -0
  244. package/dist/sessionlog/git-operations.js +399 -0
  245. package/dist/sessionlog/git-operations.js.map +1 -0
  246. package/dist/sessionlog/hooks/git-hooks.d.ts +22 -0
  247. package/dist/sessionlog/hooks/git-hooks.d.ts.map +1 -0
  248. package/dist/sessionlog/hooks/git-hooks.js +145 -0
  249. package/dist/sessionlog/hooks/git-hooks.js.map +1 -0
  250. package/dist/sessionlog/hooks/lifecycle.d.ts +21 -0
  251. package/dist/sessionlog/hooks/lifecycle.d.ts.map +1 -0
  252. package/dist/sessionlog/hooks/lifecycle.js +179 -0
  253. package/dist/sessionlog/hooks/lifecycle.js.map +1 -0
  254. package/dist/sessionlog/index.d.ts +69 -0
  255. package/dist/sessionlog/index.d.ts.map +1 -0
  256. package/dist/sessionlog/index.js +154 -0
  257. package/dist/sessionlog/index.js.map +1 -0
  258. package/dist/sessionlog/security/redaction.d.ts +35 -0
  259. package/dist/sessionlog/security/redaction.d.ts.map +1 -0
  260. package/dist/sessionlog/security/redaction.js +221 -0
  261. package/dist/sessionlog/security/redaction.js.map +1 -0
  262. package/dist/sessionlog/session/state-machine.d.ts +90 -0
  263. package/dist/sessionlog/session/state-machine.d.ts.map +1 -0
  264. package/dist/sessionlog/session/state-machine.js +347 -0
  265. package/dist/sessionlog/session/state-machine.js.map +1 -0
  266. package/dist/sessionlog/store/checkpoint-store.d.ts +47 -0
  267. package/dist/sessionlog/store/checkpoint-store.d.ts.map +1 -0
  268. package/dist/sessionlog/store/checkpoint-store.js +309 -0
  269. package/dist/sessionlog/store/checkpoint-store.js.map +1 -0
  270. package/dist/sessionlog/store/native-store.d.ts +21 -0
  271. package/dist/sessionlog/store/native-store.d.ts.map +1 -0
  272. package/dist/sessionlog/store/native-store.js +162 -0
  273. package/dist/sessionlog/store/native-store.js.map +1 -0
  274. package/dist/sessionlog/store/provider-types.d.ts +78 -0
  275. package/dist/sessionlog/store/provider-types.d.ts.map +1 -0
  276. package/dist/sessionlog/store/provider-types.js +12 -0
  277. package/dist/sessionlog/store/provider-types.js.map +1 -0
  278. package/dist/sessionlog/store/session-store.d.ts +28 -0
  279. package/dist/sessionlog/store/session-store.d.ts.map +1 -0
  280. package/dist/sessionlog/store/session-store.js +187 -0
  281. package/dist/sessionlog/store/session-store.js.map +1 -0
  282. package/dist/sessionlog/strategy/attribution.d.ts +39 -0
  283. package/dist/sessionlog/strategy/attribution.d.ts.map +1 -0
  284. package/dist/sessionlog/strategy/attribution.js +227 -0
  285. package/dist/sessionlog/strategy/attribution.js.map +1 -0
  286. package/dist/sessionlog/strategy/common.d.ts +60 -0
  287. package/dist/sessionlog/strategy/common.d.ts.map +1 -0
  288. package/dist/sessionlog/strategy/common.js +162 -0
  289. package/dist/sessionlog/strategy/common.js.map +1 -0
  290. package/dist/sessionlog/strategy/content-overlap.d.ts +33 -0
  291. package/dist/sessionlog/strategy/content-overlap.d.ts.map +1 -0
  292. package/dist/sessionlog/strategy/content-overlap.js +168 -0
  293. package/dist/sessionlog/strategy/content-overlap.js.map +1 -0
  294. package/dist/sessionlog/strategy/manual-commit.d.ts +35 -0
  295. package/dist/sessionlog/strategy/manual-commit.d.ts.map +1 -0
  296. package/dist/sessionlog/strategy/manual-commit.js +732 -0
  297. package/dist/sessionlog/strategy/manual-commit.js.map +1 -0
  298. package/dist/sessionlog/strategy/types.d.ts +163 -0
  299. package/dist/sessionlog/strategy/types.d.ts.map +1 -0
  300. package/dist/sessionlog/strategy/types.js +49 -0
  301. package/dist/sessionlog/strategy/types.js.map +1 -0
  302. package/dist/sessionlog/summarize/claude-generator.d.ts +25 -0
  303. package/dist/sessionlog/summarize/claude-generator.d.ts.map +1 -0
  304. package/dist/sessionlog/summarize/claude-generator.js +87 -0
  305. package/dist/sessionlog/summarize/claude-generator.js.map +1 -0
  306. package/dist/sessionlog/summarize/summarize.d.ts +52 -0
  307. package/dist/sessionlog/summarize/summarize.d.ts.map +1 -0
  308. package/dist/sessionlog/summarize/summarize.js +335 -0
  309. package/dist/sessionlog/summarize/summarize.js.map +1 -0
  310. package/dist/sessionlog/types.d.ts +298 -0
  311. package/dist/sessionlog/types.d.ts.map +1 -0
  312. package/dist/sessionlog/types.js +104 -0
  313. package/dist/sessionlog/types.js.map +1 -0
  314. package/dist/sessionlog/utils/chunk-files.d.ts +25 -0
  315. package/dist/sessionlog/utils/chunk-files.d.ts.map +1 -0
  316. package/dist/sessionlog/utils/chunk-files.js +47 -0
  317. package/dist/sessionlog/utils/chunk-files.js.map +1 -0
  318. package/dist/sessionlog/utils/commit-message.d.ts +11 -0
  319. package/dist/sessionlog/utils/commit-message.d.ts.map +1 -0
  320. package/dist/sessionlog/utils/commit-message.js +54 -0
  321. package/dist/sessionlog/utils/commit-message.js.map +1 -0
  322. package/dist/sessionlog/utils/detect-agent.d.ts +19 -0
  323. package/dist/sessionlog/utils/detect-agent.d.ts.map +1 -0
  324. package/dist/sessionlog/utils/detect-agent.js +34 -0
  325. package/dist/sessionlog/utils/detect-agent.js.map +1 -0
  326. package/dist/sessionlog/utils/hook-managers.d.ts +24 -0
  327. package/dist/sessionlog/utils/hook-managers.d.ts.map +1 -0
  328. package/dist/sessionlog/utils/hook-managers.js +87 -0
  329. package/dist/sessionlog/utils/hook-managers.js.map +1 -0
  330. package/dist/sessionlog/utils/ide-tags.d.ts +12 -0
  331. package/dist/sessionlog/utils/ide-tags.d.ts.map +1 -0
  332. package/dist/sessionlog/utils/ide-tags.js +30 -0
  333. package/dist/sessionlog/utils/ide-tags.js.map +1 -0
  334. package/dist/sessionlog/utils/paths.d.ts +32 -0
  335. package/dist/sessionlog/utils/paths.d.ts.map +1 -0
  336. package/dist/sessionlog/utils/paths.js +55 -0
  337. package/dist/sessionlog/utils/paths.js.map +1 -0
  338. package/dist/sessionlog/utils/preview-rewind.d.ts +23 -0
  339. package/dist/sessionlog/utils/preview-rewind.d.ts.map +1 -0
  340. package/dist/sessionlog/utils/preview-rewind.js +63 -0
  341. package/dist/sessionlog/utils/preview-rewind.js.map +1 -0
  342. package/dist/sessionlog/utils/rewind-conflict.d.ts +52 -0
  343. package/dist/sessionlog/utils/rewind-conflict.d.ts.map +1 -0
  344. package/dist/sessionlog/utils/rewind-conflict.js +79 -0
  345. package/dist/sessionlog/utils/rewind-conflict.js.map +1 -0
  346. package/dist/sessionlog/utils/shadow-branch.d.ts +53 -0
  347. package/dist/sessionlog/utils/shadow-branch.d.ts.map +1 -0
  348. package/dist/sessionlog/utils/shadow-branch.js +97 -0
  349. package/dist/sessionlog/utils/shadow-branch.js.map +1 -0
  350. package/dist/sessionlog/utils/string-utils.d.ts +24 -0
  351. package/dist/sessionlog/utils/string-utils.d.ts.map +1 -0
  352. package/dist/sessionlog/utils/string-utils.js +47 -0
  353. package/dist/sessionlog/utils/string-utils.js.map +1 -0
  354. package/dist/sessionlog/utils/todo-extract.d.ts +52 -0
  355. package/dist/sessionlog/utils/todo-extract.d.ts.map +1 -0
  356. package/dist/sessionlog/utils/todo-extract.js +167 -0
  357. package/dist/sessionlog/utils/todo-extract.js.map +1 -0
  358. package/dist/sessionlog/utils/trailers.d.ts +36 -0
  359. package/dist/sessionlog/utils/trailers.d.ts.map +1 -0
  360. package/dist/sessionlog/utils/trailers.js +149 -0
  361. package/dist/sessionlog/utils/trailers.js.map +1 -0
  362. package/dist/sessionlog/utils/transcript-parse.d.ts +57 -0
  363. package/dist/sessionlog/utils/transcript-parse.d.ts.map +1 -0
  364. package/dist/sessionlog/utils/transcript-parse.js +126 -0
  365. package/dist/sessionlog/utils/transcript-parse.js.map +1 -0
  366. package/dist/sessionlog/utils/transcript-timestamp.d.ts +22 -0
  367. package/dist/sessionlog/utils/transcript-timestamp.d.ts.map +1 -0
  368. package/dist/sessionlog/utils/transcript-timestamp.js +56 -0
  369. package/dist/sessionlog/utils/transcript-timestamp.js.map +1 -0
  370. package/dist/sessionlog/utils/tree-ops.d.ts +47 -0
  371. package/dist/sessionlog/utils/tree-ops.d.ts.map +1 -0
  372. package/dist/sessionlog/utils/tree-ops.js +145 -0
  373. package/dist/sessionlog/utils/tree-ops.js.map +1 -0
  374. package/dist/sessionlog/utils/tty.d.ts +25 -0
  375. package/dist/sessionlog/utils/tty.d.ts.map +1 -0
  376. package/dist/sessionlog/utils/tty.js +70 -0
  377. package/dist/sessionlog/utils/tty.js.map +1 -0
  378. package/dist/sessionlog/utils/validation.d.ts +31 -0
  379. package/dist/sessionlog/utils/validation.d.ts.map +1 -0
  380. package/dist/sessionlog/utils/validation.js +59 -0
  381. package/dist/sessionlog/utils/validation.js.map +1 -0
  382. package/dist/sessionlog/utils/worktree.d.ts +16 -0
  383. package/dist/sessionlog/utils/worktree.d.ts.map +1 -0
  384. package/dist/sessionlog/utils/worktree.js +50 -0
  385. package/dist/sessionlog/utils/worktree.js.map +1 -0
  386. package/dist/storage/sqlite-schema.d.ts.map +1 -1
  387. package/dist/storage/sqlite-schema.js +2 -0
  388. package/dist/storage/sqlite-schema.js.map +1 -1
  389. package/dist/storage/sqlite.d.ts.map +1 -1
  390. package/dist/storage/sqlite.js +18 -4
  391. package/dist/storage/sqlite.js.map +1 -1
  392. package/dist/tools/index.d.ts +1 -1
  393. package/dist/tools/index.d.ts.map +1 -1
  394. package/dist/tools/index.js.map +1 -1
  395. package/dist/tools/query.d.ts +2 -1
  396. package/dist/tools/query.d.ts.map +1 -1
  397. package/dist/tools/query.js +217 -7
  398. package/dist/tools/query.js.map +1 -1
  399. package/dist/tools/types.d.ts +57 -0
  400. package/dist/tools/types.d.ts.map +1 -1
  401. package/dist/tools/types.js.map +1 -1
  402. package/dist/tracking/transcript-extractor.d.ts +3 -3
  403. package/dist/tracking/transcript-extractor.d.ts.map +1 -1
  404. package/dist/tracking/transcript-extractor.js +1 -1
  405. package/dist/tracking/transcript-extractor.js.map +1 -1
  406. package/package.json +3 -1
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Rewind Preview
3
+ *
4
+ * Preview what files would change when rewinding to a checkpoint.
5
+ * Shows files that would be restored and untracked files that would be deleted.
6
+ *
7
+ * Ported from Go: strategy/manual_commit_rewind.go
8
+ */
9
+ import { getHead, lsTree, getUntrackedFiles, } from '../git-operations.js';
10
+ import { isInfrastructurePath } from './paths.js';
11
+ /**
12
+ * Preview what will happen when rewinding to the given commit.
13
+ *
14
+ * Returns the list of files that would be restored from the checkpoint
15
+ * and untracked files that would be deleted.
16
+ *
17
+ * For logs-only rewind points, returns empty arrays since the working
18
+ * directory is not modified.
19
+ */
20
+ export async function previewRewind(commitHash, isLogsOnly, preservedUntrackedFiles, cwd) {
21
+ // Logs-only points don't modify the working directory
22
+ if (isLogsOnly) {
23
+ return { filesToRestore: [], filesToDelete: [] };
24
+ }
25
+ // Get files in the checkpoint tree (excluding infrastructure)
26
+ const checkpointEntries = await lsTree(commitHash, undefined, cwd);
27
+ const checkpointFiles = new Set();
28
+ const filesToRestore = [];
29
+ for (const entry of checkpointEntries) {
30
+ if (!isInfrastructurePath(entry.name)) {
31
+ checkpointFiles.add(entry.name);
32
+ filesToRestore.push(entry.name);
33
+ }
34
+ }
35
+ // Get HEAD tree to identify tracked files
36
+ const headHash = await getHead(cwd);
37
+ const headEntries = await lsTree(headHash, undefined, cwd);
38
+ const trackedFiles = new Set();
39
+ for (const entry of headEntries) {
40
+ trackedFiles.add(entry.name);
41
+ }
42
+ // Build set of preserved untracked files
43
+ const preserved = new Set(preservedUntrackedFiles ?? []);
44
+ // Find untracked files that would be deleted
45
+ const untrackedNow = await getUntrackedFiles(cwd);
46
+ const filesToDelete = [];
47
+ for (const relPath of untrackedNow) {
48
+ // Skip if file exists in the checkpoint
49
+ if (checkpointFiles.has(relPath))
50
+ continue;
51
+ // Skip if file is tracked in HEAD
52
+ if (trackedFiles.has(relPath))
53
+ continue;
54
+ // Skip if file was preserved from session start
55
+ if (preserved.has(relPath))
56
+ continue;
57
+ filesToDelete.push(relPath);
58
+ }
59
+ filesToRestore.sort();
60
+ filesToDelete.sort();
61
+ return { filesToRestore, filesToDelete };
62
+ }
63
+ //# sourceMappingURL=preview-rewind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-rewind.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/preview-rewind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAGL,OAAO,EACP,MAAM,EACN,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAOlD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAAkB,EAClB,UAAmB,EACnB,uBAAkC,EAClC,GAAY;IAEZ,sDAAsD;IACtD,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;IACnD,CAAC;IAED,8DAA8D;IAC9D,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACnE,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,MAAM,cAAc,GAAa,EAAE,CAAC;IAEpC,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;QACtC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,yCAAyC;IACzC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IAEzD,6CAA6C;IAC7C,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,wCAAwC;QACxC,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QAC3C,kCAAkC;QAClC,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QACxC,gDAAgD;QAChD,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QAErC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,cAAc,CAAC,IAAI,EAAE,CAAC;IACtB,aAAa,CAAC,IAAI,EAAE,CAAC;IAErB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Rewind Conflict Detection
3
+ *
4
+ * Utilities for detecting timestamp conflicts when restoring session logs
5
+ * from checkpoints. Prevents silent overwrites of newer local transcripts.
6
+ *
7
+ * Ported from Go: strategy/manual_commit_rewind.go
8
+ */
9
+ export declare const enum SessionRestoreStatus {
10
+ /** Local file doesn't exist */
11
+ New = 0,
12
+ /** Local and checkpoint are the same */
13
+ Unchanged = 1,
14
+ /** Checkpoint has newer entries */
15
+ CheckpointNewer = 2,
16
+ /** Local has newer entries (conflict) */
17
+ LocalNewer = 3
18
+ }
19
+ export interface SessionRestoreInfo {
20
+ sessionID: string;
21
+ prompt: string;
22
+ status: SessionRestoreStatus;
23
+ localTime: Date;
24
+ checkpointTime: Date;
25
+ }
26
+ /**
27
+ * Determine the restore status based on local and checkpoint timestamps.
28
+ */
29
+ export declare function classifyTimestamps(localTime: Date | null, checkpointTime: Date | null): SessionRestoreStatus;
30
+ /**
31
+ * Returns a human-readable status string.
32
+ */
33
+ export declare function statusToText(status: SessionRestoreStatus): string;
34
+ /**
35
+ * Check if any sessions have conflicts (local is newer than checkpoint).
36
+ */
37
+ export declare function hasConflicts(sessions: SessionRestoreInfo[]): boolean;
38
+ /**
39
+ * Separate sessions into conflicting and non-conflicting lists.
40
+ */
41
+ export declare function partitionConflicts(sessions: SessionRestoreInfo[]): {
42
+ conflicting: SessionRestoreInfo[];
43
+ nonConflicting: SessionRestoreInfo[];
44
+ };
45
+ import type { Agent } from '../agent/types.js';
46
+ import type { AgentType } from '../types.js';
47
+ /**
48
+ * Resolve the agent from checkpoint metadata agent type string.
49
+ * Returns null if the agent type is not registered.
50
+ */
51
+ export declare function resolveAgentForRewind(agentType: AgentType): Agent | null;
52
+ //# sourceMappingURL=rewind-conflict.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewind-conflict.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/rewind-conflict.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,0BAAkB,oBAAoB;IACpC,+BAA+B;IAC/B,GAAG,IAAI;IACP,wCAAwC;IACxC,SAAS,IAAI;IACb,mCAAmC;IACnC,eAAe,IAAI;IACnB,yCAAyC;IACzC,UAAU,IAAI;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,oBAAoB,CAAC;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,cAAc,EAAE,IAAI,CAAC;CACtB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,IAAI,GAAG,IAAI,EACtB,cAAc,EAAE,IAAI,GAAG,IAAI,GAC1B,oBAAoB,CAkBtB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAajE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG;IAClE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,cAAc,EAAE,kBAAkB,EAAE,CAAC;CACtC,CAWA;AAMD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI,CAExE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Rewind Conflict Detection
3
+ *
4
+ * Utilities for detecting timestamp conflicts when restoring session logs
5
+ * from checkpoints. Prevents silent overwrites of newer local transcripts.
6
+ *
7
+ * Ported from Go: strategy/manual_commit_rewind.go
8
+ */
9
+ // ============================================================================
10
+ // Classification
11
+ // ============================================================================
12
+ /**
13
+ * Determine the restore status based on local and checkpoint timestamps.
14
+ */
15
+ export function classifyTimestamps(localTime, checkpointTime) {
16
+ // Local file doesn't exist
17
+ if (!localTime || localTime.getTime() === 0) {
18
+ return 0 /* SessionRestoreStatus.New */;
19
+ }
20
+ // Can't determine checkpoint time
21
+ if (!checkpointTime || checkpointTime.getTime() === 0) {
22
+ return 0 /* SessionRestoreStatus.New */;
23
+ }
24
+ if (localTime.getTime() > checkpointTime.getTime()) {
25
+ return 3 /* SessionRestoreStatus.LocalNewer */;
26
+ }
27
+ if (checkpointTime.getTime() > localTime.getTime()) {
28
+ return 2 /* SessionRestoreStatus.CheckpointNewer */;
29
+ }
30
+ return 1 /* SessionRestoreStatus.Unchanged */;
31
+ }
32
+ /**
33
+ * Returns a human-readable status string.
34
+ */
35
+ export function statusToText(status) {
36
+ switch (status) {
37
+ case 0 /* SessionRestoreStatus.New */:
38
+ return '(new)';
39
+ case 1 /* SessionRestoreStatus.Unchanged */:
40
+ return '(unchanged)';
41
+ case 2 /* SessionRestoreStatus.CheckpointNewer */:
42
+ return '(checkpoint is newer)';
43
+ case 3 /* SessionRestoreStatus.LocalNewer */:
44
+ return '(local is newer)';
45
+ default:
46
+ return '';
47
+ }
48
+ }
49
+ /**
50
+ * Check if any sessions have conflicts (local is newer than checkpoint).
51
+ */
52
+ export function hasConflicts(sessions) {
53
+ return sessions.some(s => s.status === 3 /* SessionRestoreStatus.LocalNewer */);
54
+ }
55
+ /**
56
+ * Separate sessions into conflicting and non-conflicting lists.
57
+ */
58
+ export function partitionConflicts(sessions) {
59
+ const conflicting = [];
60
+ const nonConflicting = [];
61
+ for (const s of sessions) {
62
+ if (s.status === 3 /* SessionRestoreStatus.LocalNewer */) {
63
+ conflicting.push(s);
64
+ }
65
+ else {
66
+ nonConflicting.push(s);
67
+ }
68
+ }
69
+ return { conflicting, nonConflicting };
70
+ }
71
+ import { getAgentByType } from '../agent/registry.js';
72
+ /**
73
+ * Resolve the agent from checkpoint metadata agent type string.
74
+ * Returns null if the agent type is not registered.
75
+ */
76
+ export function resolveAgentForRewind(agentType) {
77
+ return getAgentByType(agentType);
78
+ }
79
+ //# sourceMappingURL=rewind-conflict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewind-conflict.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/rewind-conflict.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyBH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAsB,EACtB,cAA2B;IAE3B,2BAA2B;IAC3B,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;QAC5C,wCAAgC;IAClC,CAAC;IAED,kCAAkC;IAClC,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;QACtD,wCAAgC;IAClC,CAAC;IAED,IAAI,SAAS,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,+CAAuC;IACzC,CAAC;IACD,IAAI,cAAc,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,oDAA4C;IAC9C,CAAC;IACD,8CAAsC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAA4B;IACvD,QAAQ,MAAM,EAAE,CAAC;QACf;YACE,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,aAAa,CAAC;QACvB;YACE,OAAO,uBAAuB,CAAC;QACjC;YACE,OAAO,kBAAkB,CAAC;QAC5B;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,QAA8B;IACzD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,4CAAoC,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA8B;IAI/D,MAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAyB,EAAE,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,MAAM,4CAAoC,EAAE,CAAC;YACjD,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AACzC,CAAC;AAOD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAoB;IACxD,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shadow Branch Utilities
3
+ *
4
+ * Standalone utilities for shadow branch name generation, parsing,
5
+ * and classification. Extracted from checkpoint-store.ts for reuse.
6
+ *
7
+ * Ported from Go: checkpoint/temporary.go, strategy/cleanup.go
8
+ */
9
+ /**
10
+ * Options for overriding default branch naming.
11
+ */
12
+ export interface ShadowBranchOptions {
13
+ /** Prefix for shadow branches (default: SHADOW_BRANCH_PREFIX from types) */
14
+ shadowBranchPrefix?: string;
15
+ /** Git branch for committed checkpoints (default: CHECKPOINTS_BRANCH from types) */
16
+ checkpointsBranch?: string;
17
+ }
18
+ /**
19
+ * Hash a worktree identifier to a short hex string.
20
+ */
21
+ export declare function hashWorktreeID(worktreeID: string): string;
22
+ /**
23
+ * Returns the shadow branch name for a base commit hash and worktree identifier.
24
+ * Format: <prefix><commit[:7]>-<hash(worktreeID)[:6]>
25
+ */
26
+ export declare function shadowBranchNameForCommit(baseCommit: string, worktreeID?: string, options?: ShadowBranchOptions): string;
27
+ /**
28
+ * Parse a shadow branch name to extract commit prefix and worktree hash.
29
+ * Returns null if the branch name doesn't match the shadow branch pattern.
30
+ */
31
+ export declare function parseShadowBranchName(branchName: string, options?: ShadowBranchOptions): {
32
+ commitPrefix: string;
33
+ worktreeHash: string;
34
+ } | null;
35
+ /**
36
+ * Returns true if the branch name matches the shadow branch pattern.
37
+ * The checkpoints branch is NOT a shadow branch.
38
+ */
39
+ export declare function isShadowBranch(branchName: string, options?: ShadowBranchOptions): boolean;
40
+ /**
41
+ * List all shadow branches in the repository.
42
+ * Returns an empty array if no shadow branches exist.
43
+ */
44
+ export declare function listShadowBranches(cwd?: string, options?: ShadowBranchOptions): Promise<string[]>;
45
+ /**
46
+ * Delete the specified shadow branches from the repository.
47
+ * Returns two arrays: successfully deleted and failed to delete.
48
+ */
49
+ export declare function deleteShadowBranches(branches: string[], cwd?: string): Promise<{
50
+ deleted: string[];
51
+ failed: string[];
52
+ }>;
53
+ //# sourceMappingURL=shadow-branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-branch.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/shadow-branch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAmBvD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CASzF;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGvG;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAAE,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAclD"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Shadow Branch Utilities
3
+ *
4
+ * Standalone utilities for shadow branch name generation, parsing,
5
+ * and classification. Extracted from checkpoint-store.ts for reuse.
6
+ *
7
+ * Ported from Go: checkpoint/temporary.go, strategy/cleanup.go
8
+ */
9
+ import * as crypto from 'node:crypto';
10
+ import { SHADOW_BRANCH_PREFIX, SHADOW_BRANCH_HASH_LENGTH, CHECKPOINTS_BRANCH, } from '../types.js';
11
+ import { listBranches, deleteBranch } from '../git-operations.js';
12
+ /** Worktree ID hash length (6 hex characters) */
13
+ const WORKTREE_ID_HASH_LENGTH = 6;
14
+ /**
15
+ * Hash a worktree identifier to a short hex string.
16
+ */
17
+ export function hashWorktreeID(worktreeID) {
18
+ return crypto
19
+ .createHash('sha256')
20
+ .update(worktreeID)
21
+ .digest('hex')
22
+ .slice(0, WORKTREE_ID_HASH_LENGTH);
23
+ }
24
+ /**
25
+ * Returns the shadow branch name for a base commit hash and worktree identifier.
26
+ * Format: <prefix><commit[:7]>-<hash(worktreeID)[:6]>
27
+ */
28
+ export function shadowBranchNameForCommit(baseCommit, worktreeID, options) {
29
+ const prefix = options?.shadowBranchPrefix ?? SHADOW_BRANCH_PREFIX;
30
+ const commitPart = baseCommit.slice(0, SHADOW_BRANCH_HASH_LENGTH);
31
+ if (worktreeID) {
32
+ const worktreeHash = hashWorktreeID(worktreeID);
33
+ return `${prefix}${commitPart}-${worktreeHash}`;
34
+ }
35
+ return `${prefix}${commitPart}`;
36
+ }
37
+ /**
38
+ * Parse a shadow branch name to extract commit prefix and worktree hash.
39
+ * Returns null if the branch name doesn't match the shadow branch pattern.
40
+ */
41
+ export function parseShadowBranchName(branchName, options) {
42
+ const prefix = options?.shadowBranchPrefix ?? SHADOW_BRANCH_PREFIX;
43
+ const checkpointsBranch = options?.checkpointsBranch ?? CHECKPOINTS_BRANCH;
44
+ if (!branchName.startsWith(prefix))
45
+ return null;
46
+ if (branchName === checkpointsBranch)
47
+ return null;
48
+ const suffix = branchName.slice(prefix.length);
49
+ const lastDash = suffix.lastIndexOf('-');
50
+ if (lastDash === -1 || lastDash === 0 || lastDash === suffix.length - 1) {
51
+ // No dash or dash at boundary — old format with just commit prefix
52
+ return { commitPrefix: suffix, worktreeHash: '' };
53
+ }
54
+ return {
55
+ commitPrefix: suffix.slice(0, lastDash),
56
+ worktreeHash: suffix.slice(lastDash + 1),
57
+ };
58
+ }
59
+ /**
60
+ * Returns true if the branch name matches the shadow branch pattern.
61
+ * The checkpoints branch is NOT a shadow branch.
62
+ */
63
+ export function isShadowBranch(branchName, options) {
64
+ const prefix = options?.shadowBranchPrefix ?? SHADOW_BRANCH_PREFIX;
65
+ const checkpointsBranch = options?.checkpointsBranch ?? CHECKPOINTS_BRANCH;
66
+ if (branchName === checkpointsBranch)
67
+ return false;
68
+ const pattern = new RegExp(`^${prefix.replace('/', '\\/')}[0-9a-f]{${SHADOW_BRANCH_HASH_LENGTH},}(-[0-9a-f]{${WORKTREE_ID_HASH_LENGTH},})?$`);
69
+ return pattern.test(branchName);
70
+ }
71
+ /**
72
+ * List all shadow branches in the repository.
73
+ * Returns an empty array if no shadow branches exist.
74
+ */
75
+ export async function listShadowBranches(cwd, options) {
76
+ const allBranches = await listBranches(cwd);
77
+ return allBranches.filter((b) => isShadowBranch(b, options));
78
+ }
79
+ /**
80
+ * Delete the specified shadow branches from the repository.
81
+ * Returns two arrays: successfully deleted and failed to delete.
82
+ */
83
+ export async function deleteShadowBranches(branches, cwd) {
84
+ const deleted = [];
85
+ const failed = [];
86
+ for (const branch of branches) {
87
+ try {
88
+ await deleteBranch(branch, false, cwd);
89
+ deleted.push(branch);
90
+ }
91
+ catch {
92
+ failed.push(branch);
93
+ }
94
+ }
95
+ return { deleted, failed };
96
+ }
97
+ //# sourceMappingURL=shadow-branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-branch.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/shadow-branch.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * String Utilities
3
+ *
4
+ * Rune-safe string operations for multi-byte character handling.
5
+ */
6
+ /**
7
+ * Truncate a string to a maximum number of Unicode code points (runes).
8
+ * Avoids splitting multi-byte UTF-8 characters.
9
+ */
10
+ export declare function truncateRunes(s: string, maxRunes: number, suffix?: string): string;
11
+ /**
12
+ * Collapse all whitespace sequences (including newlines) to single spaces.
13
+ */
14
+ export declare function collapseWhitespace(s: string): string;
15
+ /**
16
+ * Capitalize the first character of a string.
17
+ */
18
+ export declare function capitalizeFirst(s: string): string;
19
+ /**
20
+ * Count lines in a string.
21
+ * Empty string = 0 lines. String without newline = 1 line.
22
+ */
23
+ export declare function countLines(content: string): number;
24
+ //# sourceMappingURL=string-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/string-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAc,GAAG,MAAM,CAMzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQlD"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * String Utilities
3
+ *
4
+ * Rune-safe string operations for multi-byte character handling.
5
+ */
6
+ /**
7
+ * Truncate a string to a maximum number of Unicode code points (runes).
8
+ * Avoids splitting multi-byte UTF-8 characters.
9
+ */
10
+ export function truncateRunes(s, maxRunes, suffix = '...') {
11
+ const runes = [...s];
12
+ if (runes.length <= maxRunes) {
13
+ return s;
14
+ }
15
+ return runes.slice(0, maxRunes).join('') + suffix;
16
+ }
17
+ /**
18
+ * Collapse all whitespace sequences (including newlines) to single spaces.
19
+ */
20
+ export function collapseWhitespace(s) {
21
+ return s.replace(/\s+/g, ' ').trim();
22
+ }
23
+ /**
24
+ * Capitalize the first character of a string.
25
+ */
26
+ export function capitalizeFirst(s) {
27
+ if (s.length === 0)
28
+ return s;
29
+ return s[0].toUpperCase() + s.slice(1);
30
+ }
31
+ /**
32
+ * Count lines in a string.
33
+ * Empty string = 0 lines. String without newline = 1 line.
34
+ */
35
+ export function countLines(content) {
36
+ if (content === '')
37
+ return 0;
38
+ let lines = 0;
39
+ for (let i = 0; i < content.length; i++) {
40
+ if (content[i] === '\n')
41
+ lines++;
42
+ }
43
+ if (!content.endsWith('\n'))
44
+ lines++;
45
+ return lines;
46
+ }
47
+ //# sourceMappingURL=string-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-utils.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/string-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,QAAgB,EAAE,SAAiB,KAAK;IAC/E,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAS;IAC1C,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS;IACvC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,KAAK,EAAE,CAAC;IACrC,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Todo Extraction
3
+ *
4
+ * Parses TodoWrite tool_input JSON to extract todo content for
5
+ * incremental checkpoint commit messages.
6
+ *
7
+ * Ported from Go: strategy/messages.go
8
+ */
9
+ /**
10
+ * Extract the content of the last completed todo item from a todos JSON array.
11
+ * Returns the work that was just finished (used for commit messages).
12
+ *
13
+ * Returns empty string if no completed items exist or JSON is invalid.
14
+ */
15
+ export declare function extractLastCompletedTodo(todosJSON: string | Buffer): string;
16
+ /**
17
+ * Return the number of todo items in the JSON array.
18
+ * Returns 0 if the JSON is invalid or empty.
19
+ */
20
+ export declare function countTodos(todosJSON: string | Buffer): number;
21
+ /**
22
+ * Extract the content of the in-progress todo item from tool_input.
23
+ * Used for commit messages in incremental checkpoints.
24
+ *
25
+ * Priority order:
26
+ * 1. in_progress item (current work)
27
+ * 2. first pending item (next work - fallback)
28
+ * 3. last completed item (work just finished)
29
+ * 4. first item with unknown status (edge case)
30
+ * 5. empty string (no items)
31
+ */
32
+ export declare function extractInProgressTodo(todosJSON: string | Buffer): string;
33
+ /**
34
+ * Extract todo content from a TodoWrite tool_input object.
35
+ * Handles unwrapping the outer { todos: [...] } structure.
36
+ */
37
+ export declare function extractTodoContentFromToolInput(toolInput: unknown): string;
38
+ /**
39
+ * Extract last completed todo from a TodoWrite tool_input object.
40
+ */
41
+ export declare function extractLastCompletedTodoFromToolInput(toolInput: unknown): string;
42
+ /**
43
+ * Count todos from a TodoWrite tool_input object.
44
+ */
45
+ export declare function countTodosFromToolInput(toolInput: unknown): number;
46
+ /**
47
+ * Format a commit message for an incremental checkpoint.
48
+ * Format: "<todo-content> (<tool-use-id>)"
49
+ * Fallback: "Checkpoint #<sequence>: <tool-use-id>"
50
+ */
51
+ export declare function formatIncrementalMessage(todoContent: string, sequence: number, toolUseID: string): string;
52
+ //# sourceMappingURL=todo-extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todo-extract.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/todo-extract.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAW3E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAG7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA+BxE;AAMD;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,OAAO,GACjB,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,OAAO,GACjB,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAIlE;AASD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,MAAM,CAOR"}