@bastani/atomic 0.9.2-alpha.1 → 0.9.3-alpha.1

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 (455) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +2 -2
  3. package/dist/builtin/cursor/CHANGELOG.md +6 -0
  4. package/dist/builtin/cursor/package.json +2 -2
  5. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  6. package/dist/builtin/intercom/package.json +1 -1
  7. package/dist/builtin/mcp/CHANGELOG.md +12 -0
  8. package/dist/builtin/mcp/direct-tools.ts +4 -2
  9. package/dist/builtin/mcp/package.json +1 -1
  10. package/dist/builtin/mcp/proxy-call.ts +3 -1
  11. package/dist/builtin/mcp/utils.ts +18 -7
  12. package/dist/builtin/subagents/CHANGELOG.md +17 -0
  13. package/dist/builtin/subagents/README.md +6 -6
  14. package/dist/builtin/subagents/agents/code-simplifier.md +7 -6
  15. package/dist/builtin/subagents/agents/codebase-analyzer.md +5 -4
  16. package/dist/builtin/subagents/agents/codebase-locator.md +3 -3
  17. package/dist/builtin/subagents/agents/codebase-online-researcher.md +10 -10
  18. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +4 -4
  19. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +3 -3
  20. package/dist/builtin/subagents/agents/codebase-research-locator.md +4 -4
  21. package/dist/builtin/subagents/agents/debugger.md +5 -5
  22. package/dist/builtin/subagents/agents/worker.md +56 -0
  23. package/dist/builtin/subagents/package.json +1 -1
  24. package/dist/builtin/subagents/skills/subagent/SKILL.md +11 -11
  25. package/dist/builtin/subagents/src/agents/agent-loaders.ts +3 -5
  26. package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +3 -3
  27. package/dist/builtin/subagents/src/extension/schemas.ts +2 -2
  28. package/dist/builtin/subagents/src/intercom/result-intercom.ts +4 -3
  29. package/dist/builtin/subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +1 -1
  30. package/dist/builtin/subagents/src/runs/shared/nested-render.ts +2 -2
  31. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +2 -1
  32. package/dist/builtin/subagents/src/shared/types-depth.ts +5 -5
  33. package/dist/builtin/subagents/src/shared/types-runtime.ts +2 -1
  34. package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -2
  35. package/dist/builtin/web-access/CHANGELOG.md +6 -0
  36. package/dist/builtin/web-access/package.json +1 -1
  37. package/dist/builtin/workflows/CHANGELOG.md +21 -0
  38. package/dist/builtin/workflows/README.md +2 -2
  39. package/dist/builtin/workflows/builtin/goal-artifacts.ts +11 -6
  40. package/dist/builtin/workflows/builtin/goal-ledger.ts +33 -1
  41. package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -28
  42. package/dist/builtin/workflows/builtin/goal-reducer.ts +2 -2
  43. package/dist/builtin/workflows/builtin/goal-reports.ts +2 -5
  44. package/dist/builtin/workflows/builtin/goal-review.ts +1 -1
  45. package/dist/builtin/workflows/builtin/goal-runner.ts +10 -17
  46. package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +3 -3
  47. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +1 -3
  48. package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +1 -1
  49. package/dist/builtin/workflows/builtin/ralph-core.ts +7 -17
  50. package/dist/builtin/workflows/builtin/ralph-runner.ts +11 -18
  51. package/dist/builtin/workflows/builtin/shared-prompts.ts +1 -1
  52. package/dist/builtin/workflows/package.json +1 -1
  53. package/dist/builtin/workflows/src/extension/config-loader.ts +35 -15
  54. package/dist/builtin/workflows/src/extension/discovery.ts +20 -8
  55. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +1 -2
  56. package/dist/builtin/workflows/src/extension/wiring.ts +1 -1
  57. package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +11 -10
  58. package/dist/cli/args.d.ts.map +1 -1
  59. package/dist/cli/args.js +9 -9
  60. package/dist/cli/args.js.map +1 -1
  61. package/dist/config-self-update.d.ts.map +1 -1
  62. package/dist/config-self-update.js +3 -4
  63. package/dist/config-self-update.js.map +1 -1
  64. package/dist/config.d.ts.map +1 -1
  65. package/dist/config.js +4 -5
  66. package/dist/config.js.map +1 -1
  67. package/dist/core/agent-session-bash.d.ts +1 -0
  68. package/dist/core/agent-session-bash.d.ts.map +1 -1
  69. package/dist/core/agent-session-bash.js +1 -0
  70. package/dist/core/agent-session-bash.js.map +1 -1
  71. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  72. package/dist/core/agent-session-tool-registry.js +23 -0
  73. package/dist/core/agent-session-tool-registry.js.map +1 -1
  74. package/dist/core/bash-executor.d.ts +2 -0
  75. package/dist/core/bash-executor.d.ts.map +1 -1
  76. package/dist/core/bash-executor.js +1 -0
  77. package/dist/core/bash-executor.js.map +1 -1
  78. package/dist/core/compaction/compaction.d.ts +29 -0
  79. package/dist/core/compaction/compaction.d.ts.map +1 -1
  80. package/dist/core/compaction/compaction.js +36 -1
  81. package/dist/core/compaction/compaction.js.map +1 -1
  82. package/dist/core/compaction/context-compaction-metrics.d.ts +14 -2
  83. package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -1
  84. package/dist/core/compaction/context-compaction-metrics.js +50 -1
  85. package/dist/core/compaction/context-compaction-metrics.js.map +1 -1
  86. package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -1
  87. package/dist/core/compaction/context-compaction-prompt.js +2 -0
  88. package/dist/core/compaction/context-compaction-prompt.js.map +1 -1
  89. package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
  90. package/dist/core/compaction/context-compaction-runner.js +1 -1
  91. package/dist/core/compaction/context-compaction-runner.js.map +1 -1
  92. package/dist/core/compaction/context-deletion-application.d.ts.map +1 -1
  93. package/dist/core/compaction/context-deletion-application.js +5 -5
  94. package/dist/core/compaction/context-deletion-application.js.map +1 -1
  95. package/dist/core/compaction/context-deletion-targets.d.ts +2 -0
  96. package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -1
  97. package/dist/core/compaction/context-deletion-targets.js +23 -3
  98. package/dist/core/compaction/context-deletion-targets.js.map +1 -1
  99. package/dist/core/compaction/context-deletion-tool-definitions.d.ts +6 -0
  100. package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -1
  101. package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -1
  102. package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -1
  103. package/dist/core/compaction/context-deletion-tools.js +18 -10
  104. package/dist/core/compaction/context-deletion-tools.js.map +1 -1
  105. package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -1
  106. package/dist/core/compaction/context-transcript-analysis.js +2 -4
  107. package/dist/core/compaction/context-transcript-analysis.js.map +1 -1
  108. package/dist/core/copilot-gemini-tool-arguments.d.ts.map +1 -1
  109. package/dist/core/copilot-gemini-tool-arguments.js +2 -60
  110. package/dist/core/copilot-gemini-tool-arguments.js.map +1 -1
  111. package/dist/core/extensions/context-types.d.ts +2 -0
  112. package/dist/core/extensions/context-types.d.ts.map +1 -1
  113. package/dist/core/extensions/context-types.js.map +1 -1
  114. package/dist/core/extensions/index.d.ts +2 -2
  115. package/dist/core/extensions/index.d.ts.map +1 -1
  116. package/dist/core/extensions/index.js +1 -1
  117. package/dist/core/extensions/index.js.map +1 -1
  118. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  119. package/dist/core/extensions/loader-virtual-modules.js +11 -3
  120. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  121. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  122. package/dist/core/extensions/runner-context.js +11 -0
  123. package/dist/core/extensions/runner-context.js.map +1 -1
  124. package/dist/core/extensions/tool-events.d.ts +13 -13
  125. package/dist/core/extensions/tool-events.d.ts.map +1 -1
  126. package/dist/core/extensions/tool-events.js +3 -3
  127. package/dist/core/extensions/tool-events.js.map +1 -1
  128. package/dist/core/extensions/types.d.ts +1 -1
  129. package/dist/core/extensions/types.d.ts.map +1 -1
  130. package/dist/core/extensions/types.js +1 -1
  131. package/dist/core/extensions/types.js.map +1 -1
  132. package/dist/core/flattened-tool-arguments.d.ts +18 -0
  133. package/dist/core/flattened-tool-arguments.d.ts.map +1 -1
  134. package/dist/core/flattened-tool-arguments.js +104 -0
  135. package/dist/core/flattened-tool-arguments.js.map +1 -1
  136. package/dist/core/sdk-exports.d.ts +1 -1
  137. package/dist/core/sdk-exports.d.ts.map +1 -1
  138. package/dist/core/sdk-exports.js +1 -1
  139. package/dist/core/sdk-exports.js.map +1 -1
  140. package/dist/core/sdk-types.d.ts +2 -2
  141. package/dist/core/sdk-types.d.ts.map +1 -1
  142. package/dist/core/sdk-types.js.map +1 -1
  143. package/dist/core/settings-manager-basic-accessors.d.ts +4 -0
  144. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  145. package/dist/core/settings-manager-basic-accessors.js +18 -0
  146. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  147. package/dist/core/settings-manager-resource-accessors.d.ts +4 -0
  148. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
  149. package/dist/core/settings-manager-resource-accessors.js +15 -0
  150. package/dist/core/settings-manager-resource-accessors.js.map +1 -1
  151. package/dist/core/settings-types.d.ts +11 -0
  152. package/dist/core/settings-types.d.ts.map +1 -1
  153. package/dist/core/settings-types.js.map +1 -1
  154. package/dist/core/system-prompt.d.ts +1 -1
  155. package/dist/core/system-prompt.d.ts.map +1 -1
  156. package/dist/core/system-prompt.js +3 -2
  157. package/dist/core/system-prompt.js.map +1 -1
  158. package/dist/core/tools/artifact-protocol.d.ts +11 -0
  159. package/dist/core/tools/artifact-protocol.d.ts.map +1 -0
  160. package/dist/core/tools/artifact-protocol.js +76 -0
  161. package/dist/core/tools/artifact-protocol.js.map +1 -0
  162. package/dist/core/tools/artifacts.d.ts +18 -0
  163. package/dist/core/tools/artifacts.d.ts.map +1 -0
  164. package/dist/core/tools/artifacts.js +90 -0
  165. package/dist/core/tools/artifacts.js.map +1 -0
  166. package/dist/core/tools/bash-async-jobs.d.ts +20 -0
  167. package/dist/core/tools/bash-async-jobs.d.ts.map +1 -0
  168. package/dist/core/tools/bash-async-jobs.js +59 -0
  169. package/dist/core/tools/bash-async-jobs.js.map +1 -0
  170. package/dist/core/tools/bash-async-output.d.ts +10 -0
  171. package/dist/core/tools/bash-async-output.d.ts.map +1 -0
  172. package/dist/core/tools/bash-async-output.js +80 -0
  173. package/dist/core/tools/bash-async-output.js.map +1 -0
  174. package/dist/core/tools/bash-interceptor.d.ts +10 -0
  175. package/dist/core/tools/bash-interceptor.d.ts.map +1 -0
  176. package/dist/core/tools/bash-interceptor.js +39 -0
  177. package/dist/core/tools/bash-interceptor.js.map +1 -0
  178. package/dist/core/tools/bash-leading-cd.d.ts +7 -0
  179. package/dist/core/tools/bash-leading-cd.d.ts.map +1 -0
  180. package/dist/core/tools/bash-leading-cd.js +59 -0
  181. package/dist/core/tools/bash-leading-cd.js.map +1 -0
  182. package/dist/core/tools/bash-pty-native.d.ts +14 -0
  183. package/dist/core/tools/bash-pty-native.d.ts.map +1 -0
  184. package/dist/core/tools/bash-pty-native.js +71 -0
  185. package/dist/core/tools/bash-pty-native.js.map +1 -0
  186. package/dist/core/tools/bash.d.ts +28 -17
  187. package/dist/core/tools/bash.d.ts.map +1 -1
  188. package/dist/core/tools/bash.js +152 -35
  189. package/dist/core/tools/bash.js.map +1 -1
  190. package/dist/core/tools/block-resolver.d.ts +16 -0
  191. package/dist/core/tools/block-resolver.d.ts.map +1 -0
  192. package/dist/core/tools/block-resolver.js +74 -0
  193. package/dist/core/tools/block-resolver.js.map +1 -0
  194. package/dist/core/tools/conflict-registry.d.ts +16 -0
  195. package/dist/core/tools/conflict-registry.d.ts.map +1 -0
  196. package/dist/core/tools/conflict-registry.js +44 -0
  197. package/dist/core/tools/conflict-registry.js.map +1 -0
  198. package/dist/core/tools/directory-tree.d.ts +13 -0
  199. package/dist/core/tools/directory-tree.d.ts.map +1 -0
  200. package/dist/core/tools/directory-tree.js +81 -0
  201. package/dist/core/tools/directory-tree.js.map +1 -0
  202. package/dist/core/tools/edit.d.ts +4 -29
  203. package/dist/core/tools/edit.d.ts.map +1 -1
  204. package/dist/core/tools/edit.js +136 -228
  205. package/dist/core/tools/edit.js.map +1 -1
  206. package/dist/core/tools/fetch-url.d.ts +74 -0
  207. package/dist/core/tools/fetch-url.d.ts.map +1 -0
  208. package/dist/core/tools/fetch-url.js +518 -0
  209. package/dist/core/tools/fetch-url.js.map +1 -0
  210. package/dist/core/tools/find.d.ts +27 -9
  211. package/dist/core/tools/find.d.ts.map +1 -1
  212. package/dist/core/tools/find.js +400 -176
  213. package/dist/core/tools/find.js.map +1 -1
  214. package/dist/core/tools/glob-path-utils.d.ts +8 -0
  215. package/dist/core/tools/glob-path-utils.d.ts.map +1 -0
  216. package/dist/core/tools/glob-path-utils.js +26 -0
  217. package/dist/core/tools/glob-path-utils.js.map +1 -0
  218. package/dist/core/tools/grep.d.ts +12 -0
  219. package/dist/core/tools/grep.d.ts.map +1 -1
  220. package/dist/core/tools/grep.js +141 -17
  221. package/dist/core/tools/grep.js.map +1 -1
  222. package/dist/core/tools/hashline-engine/apply.d.ts +11 -0
  223. package/dist/core/tools/hashline-engine/apply.d.ts.map +1 -0
  224. package/dist/core/tools/hashline-engine/apply.js +752 -0
  225. package/dist/core/tools/hashline-engine/apply.js.map +1 -0
  226. package/dist/core/tools/hashline-engine/block.d.ts +40 -0
  227. package/dist/core/tools/hashline-engine/block.d.ts.map +1 -0
  228. package/dist/core/tools/hashline-engine/block.js +117 -0
  229. package/dist/core/tools/hashline-engine/block.js.map +1 -0
  230. package/dist/core/tools/hashline-engine/diff-preview.d.ts +15 -0
  231. package/dist/core/tools/hashline-engine/diff-preview.d.ts.map +1 -0
  232. package/dist/core/tools/hashline-engine/diff-preview.js +98 -0
  233. package/dist/core/tools/hashline-engine/diff-preview.js.map +1 -0
  234. package/dist/core/tools/hashline-engine/format.d.ts +71 -0
  235. package/dist/core/tools/hashline-engine/format.d.ts.map +1 -0
  236. package/dist/core/tools/hashline-engine/format.js +178 -0
  237. package/dist/core/tools/hashline-engine/format.js.map +1 -0
  238. package/dist/core/tools/hashline-engine/fs.d.ts +81 -0
  239. package/dist/core/tools/hashline-engine/fs.d.ts.map +1 -0
  240. package/dist/core/tools/hashline-engine/fs.js +143 -0
  241. package/dist/core/tools/hashline-engine/fs.js.map +1 -0
  242. package/dist/core/tools/hashline-engine/index.d.ts +18 -0
  243. package/dist/core/tools/hashline-engine/index.d.ts.map +1 -0
  244. package/dist/core/tools/hashline-engine/index.js +20 -0
  245. package/dist/core/tools/hashline-engine/index.js.map +1 -0
  246. package/dist/core/tools/hashline-engine/input.d.ts +101 -0
  247. package/dist/core/tools/hashline-engine/input.d.ts.map +1 -0
  248. package/dist/core/tools/hashline-engine/input.js +398 -0
  249. package/dist/core/tools/hashline-engine/input.js.map +1 -0
  250. package/dist/core/tools/hashline-engine/messages.d.ts +99 -0
  251. package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -0
  252. package/dist/core/tools/hashline-engine/messages.js +144 -0
  253. package/dist/core/tools/hashline-engine/messages.js.map +1 -0
  254. package/dist/core/tools/hashline-engine/mismatch.d.ts +45 -0
  255. package/dist/core/tools/hashline-engine/mismatch.d.ts.map +1 -0
  256. package/dist/core/tools/hashline-engine/mismatch.js +90 -0
  257. package/dist/core/tools/hashline-engine/mismatch.js.map +1 -0
  258. package/dist/core/tools/hashline-engine/normalize.d.ts +21 -0
  259. package/dist/core/tools/hashline-engine/normalize.d.ts.map +1 -0
  260. package/dist/core/tools/hashline-engine/normalize.js +33 -0
  261. package/dist/core/tools/hashline-engine/normalize.js.map +1 -0
  262. package/dist/core/tools/hashline-engine/parser.d.ts +24 -0
  263. package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -0
  264. package/dist/core/tools/hashline-engine/parser.js +381 -0
  265. package/dist/core/tools/hashline-engine/parser.js.map +1 -0
  266. package/dist/core/tools/hashline-engine/patcher.d.ts +118 -0
  267. package/dist/core/tools/hashline-engine/patcher.d.ts.map +1 -0
  268. package/dist/core/tools/hashline-engine/patcher.js +341 -0
  269. package/dist/core/tools/hashline-engine/patcher.js.map +1 -0
  270. package/dist/core/tools/hashline-engine/prefixes.d.ts +43 -0
  271. package/dist/core/tools/hashline-engine/prefixes.d.ts.map +1 -0
  272. package/dist/core/tools/hashline-engine/prefixes.js +135 -0
  273. package/dist/core/tools/hashline-engine/prefixes.js.map +1 -0
  274. package/dist/core/tools/hashline-engine/recovery.d.ts +41 -0
  275. package/dist/core/tools/hashline-engine/recovery.d.ts.map +1 -0
  276. package/dist/core/tools/hashline-engine/recovery.js +168 -0
  277. package/dist/core/tools/hashline-engine/recovery.js.map +1 -0
  278. package/dist/core/tools/hashline-engine/snapshots.d.ts +65 -0
  279. package/dist/core/tools/hashline-engine/snapshots.d.ts.map +1 -0
  280. package/dist/core/tools/hashline-engine/snapshots.js +108 -0
  281. package/dist/core/tools/hashline-engine/snapshots.js.map +1 -0
  282. package/dist/core/tools/hashline-engine/stream.d.ts +3 -0
  283. package/dist/core/tools/hashline-engine/stream.d.ts.map +1 -0
  284. package/dist/core/tools/hashline-engine/stream.js +111 -0
  285. package/dist/core/tools/hashline-engine/stream.js.map +1 -0
  286. package/dist/core/tools/hashline-engine/tokenizer.d.ts +69 -0
  287. package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -0
  288. package/dist/core/tools/hashline-engine/tokenizer.js +430 -0
  289. package/dist/core/tools/hashline-engine/tokenizer.js.map +1 -0
  290. package/dist/core/tools/hashline-engine/types.d.ts +166 -0
  291. package/dist/core/tools/hashline-engine/types.d.ts.map +1 -0
  292. package/dist/core/tools/hashline-engine/types.js +9 -0
  293. package/dist/core/tools/hashline-engine/types.js.map +1 -0
  294. package/dist/core/tools/hashline.d.ts +29 -0
  295. package/dist/core/tools/hashline.d.ts.map +1 -0
  296. package/dist/core/tools/hashline.js +110 -0
  297. package/dist/core/tools/hashline.js.map +1 -0
  298. package/dist/core/tools/index.d.ts +6 -4
  299. package/dist/core/tools/index.d.ts.map +1 -1
  300. package/dist/core/tools/index.js +52 -35
  301. package/dist/core/tools/index.js.map +1 -1
  302. package/dist/core/tools/notebook.d.ts +38 -0
  303. package/dist/core/tools/notebook.d.ts.map +1 -0
  304. package/dist/core/tools/notebook.js +125 -0
  305. package/dist/core/tools/notebook.js.map +1 -0
  306. package/dist/core/tools/read-document-extract.d.ts +9 -0
  307. package/dist/core/tools/read-document-extract.d.ts.map +1 -0
  308. package/dist/core/tools/read-document-extract.js +212 -0
  309. package/dist/core/tools/read-document-extract.js.map +1 -0
  310. package/dist/core/tools/read-selectors.d.ts +24 -0
  311. package/dist/core/tools/read-selectors.d.ts.map +1 -0
  312. package/dist/core/tools/read-selectors.js +277 -0
  313. package/dist/core/tools/read-selectors.js.map +1 -0
  314. package/dist/core/tools/read-url.d.ts +37 -0
  315. package/dist/core/tools/read-url.d.ts.map +1 -0
  316. package/dist/core/tools/read-url.js +39 -0
  317. package/dist/core/tools/read-url.js.map +1 -0
  318. package/dist/core/tools/read.d.ts +11 -11
  319. package/dist/core/tools/read.d.ts.map +1 -1
  320. package/dist/core/tools/read.js +224 -94
  321. package/dist/core/tools/read.js.map +1 -1
  322. package/dist/core/tools/resource-selectors.d.ts +44 -0
  323. package/dist/core/tools/resource-selectors.d.ts.map +1 -0
  324. package/dist/core/tools/resource-selectors.js +808 -0
  325. package/dist/core/tools/resource-selectors.js.map +1 -0
  326. package/dist/core/tools/search-details.d.ts +26 -0
  327. package/dist/core/tools/search-details.d.ts.map +1 -0
  328. package/dist/core/tools/search-details.js +24 -0
  329. package/dist/core/tools/search-details.js.map +1 -0
  330. package/dist/core/tools/search-line-ranges.d.ts +11 -0
  331. package/dist/core/tools/search-line-ranges.d.ts.map +1 -0
  332. package/dist/core/tools/search-line-ranges.js +65 -0
  333. package/dist/core/tools/search-line-ranges.js.map +1 -0
  334. package/dist/core/tools/search-native.d.ts +97 -0
  335. package/dist/core/tools/search-native.d.ts.map +1 -0
  336. package/dist/core/tools/search-native.js +27 -0
  337. package/dist/core/tools/search-native.js.map +1 -0
  338. package/dist/core/tools/search.d.ts +24 -0
  339. package/dist/core/tools/search.d.ts.map +1 -0
  340. package/dist/core/tools/search.js +573 -0
  341. package/dist/core/tools/search.js.map +1 -0
  342. package/dist/core/tools/truncate.d.ts +4 -4
  343. package/dist/core/tools/truncate.d.ts.map +1 -1
  344. package/dist/core/tools/truncate.js +3 -3
  345. package/dist/core/tools/truncate.js.map +1 -1
  346. package/dist/core/tools/url-ip-guards.d.ts +4 -0
  347. package/dist/core/tools/url-ip-guards.d.ts.map +1 -0
  348. package/dist/core/tools/url-ip-guards.js +126 -0
  349. package/dist/core/tools/url-ip-guards.js.map +1 -0
  350. package/dist/core/tools/write.d.ts +12 -2
  351. package/dist/core/tools/write.d.ts.map +1 -1
  352. package/dist/core/tools/write.js +166 -14
  353. package/dist/core/tools/write.js.map +1 -1
  354. package/dist/core/trust-manager.d.ts.map +1 -1
  355. package/dist/core/trust-manager.js +2 -3
  356. package/dist/core/trust-manager.js.map +1 -1
  357. package/dist/index-extensions.d.ts +2 -2
  358. package/dist/index-extensions.d.ts.map +1 -1
  359. package/dist/index-extensions.js +1 -1
  360. package/dist/index-extensions.js.map +1 -1
  361. package/dist/index.d.ts +3 -3
  362. package/dist/index.d.ts.map +1 -1
  363. package/dist/index.js +3 -3
  364. package/dist/index.js.map +1 -1
  365. package/dist/modes/interactive/components/custom-editor.d.ts +1 -0
  366. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/custom-editor.js +9 -2
  368. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  369. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
  370. package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
  371. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  372. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/settings-selector-items.js +7 -0
  374. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  375. package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -0
  376. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  377. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  378. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/tree-selector-content.js +0 -5
  380. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  381. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
  382. package/dist/modes/interactive/interactive-auth-login.js +1 -0
  383. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  384. package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
  385. package/dist/modes/interactive/interactive-autocomplete.js +80 -2
  386. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  387. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -1
  388. package/dist/modes/interactive/interactive-hotkeys-debug.js +3 -0
  389. package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
  390. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  391. package/dist/modes/interactive/interactive-input-handling.js +51 -0
  392. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  393. package/dist/modes/interactive/interactive-mode-base.d.ts +5 -0
  394. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  395. package/dist/modes/interactive/interactive-mode-base.js +5 -0
  396. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  397. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  398. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  399. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  400. package/dist/modes/interactive/interactive-mode-surface.d.ts +12 -0
  401. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  402. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  403. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  404. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  405. package/dist/modes/interactive/interactive-mode.js +1 -0
  406. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  407. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  408. package/dist/modes/interactive/interactive-model-routing.js +4 -1
  409. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  410. package/dist/modes/interactive/interactive-onboarding.d.ts +11 -0
  411. package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -0
  412. package/dist/modes/interactive/interactive-onboarding.js +220 -0
  413. package/dist/modes/interactive/interactive-onboarding.js.map +1 -0
  414. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  415. package/dist/modes/interactive/interactive-selectors.js +4 -0
  416. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  417. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
  418. package/dist/modes/interactive/interactive-session-routing.js +6 -0
  419. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  420. package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -1
  421. package/dist/modes/interactive/interactive-slash-commands.js +9 -4
  422. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  423. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  424. package/dist/modes/interactive/interactive-startup.js +28 -0
  425. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  426. package/dist/utils/child-process.d.ts.map +1 -1
  427. package/dist/utils/child-process.js +21 -1
  428. package/dist/utils/child-process.js.map +1 -1
  429. package/dist/utils/markit.d.ts +8 -0
  430. package/dist/utils/markit.d.ts.map +1 -0
  431. package/dist/utils/markit.js +53 -0
  432. package/dist/utils/markit.js.map +1 -0
  433. package/dist/utils/paths.d.ts +2 -1
  434. package/dist/utils/paths.d.ts.map +1 -1
  435. package/dist/utils/paths.js +14 -1
  436. package/dist/utils/paths.js.map +1 -1
  437. package/docs/compaction.md +16 -1
  438. package/docs/containerization.md +1 -1
  439. package/docs/docs.json +1 -0
  440. package/docs/extensions.md +25 -36
  441. package/docs/quickstart.md +11 -6
  442. package/docs/sdk.md +5 -5
  443. package/docs/settings.md +7 -0
  444. package/docs/subagents.md +3 -2
  445. package/docs/tools.md +49 -0
  446. package/docs/usage.md +3 -3
  447. package/docs/workflows.md +7 -5
  448. package/examples/extensions/subagent/README.md +5 -5
  449. package/examples/extensions/subagent/agents/planner.md +1 -1
  450. package/examples/extensions/subagent/agents/reviewer.md +1 -1
  451. package/examples/extensions/subagent/agents/scout.md +2 -2
  452. package/examples/extensions/subagent/display.ts +3 -3
  453. package/examples/sdk/05-tools.ts +3 -3
  454. package/examples/sdk/README.md +1 -1
  455. package/package.json +3 -2
@@ -0,0 +1,178 @@
1
+ // @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.
2
+ // Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).
3
+ /**
4
+ * Hashline format primitives: sigils, separators, regex fragments, and
5
+ * display helpers. These are the single source of truth for the parser, the
6
+ * tokenizer, the prompt, and the formal grammar.
7
+ */
8
+ /** File-section header delimiters: `[path#hash]`. */
9
+ export const HL_FILE_PREFIX = "[";
10
+ export const HL_FILE_SUFFIX = "]";
11
+ /** Payload sigil for literal body rows. */
12
+ export const HL_PAYLOAD_REPLACE = "+";
13
+ /** Hunk-header keyword for concrete line replacement. */
14
+ export const HL_REPLACE_KEYWORD = "replace";
15
+ /** Hunk-header sub-keyword: `replace block N:` resolves N to a tree-sitter block range. */
16
+ export const HL_BLOCK_KEYWORD = "block";
17
+ /** Hunk-header keyword for concrete line deletion. */
18
+ export const HL_DELETE_KEYWORD = "delete";
19
+ /** Hunk-header keyword for insertion operations. */
20
+ export const HL_INSERT_KEYWORD = "insert";
21
+ /** Insert position keyword for inserting before a concrete line. */
22
+ export const HL_INSERT_BEFORE = "before";
23
+ /** Insert position keyword for inserting after a concrete line. */
24
+ export const HL_INSERT_AFTER = "after";
25
+ /** Insert position keyword for inserting at the start of the file. */
26
+ export const HL_INSERT_HEAD = "head";
27
+ /** Insert position keyword for inserting at the end of the file. */
28
+ export const HL_INSERT_TAIL = "tail";
29
+ /** Hunk-header terminator for body-bearing operations. */
30
+ export const HL_HEADER_COLON = ":";
31
+ /** Separator between a hashline file path and its opaque snapshot tag. */
32
+ export const HL_FILE_HASH_SEP = "#";
33
+ /** Separator between two line numbers in a range, e.g. `5..10`. */
34
+ export const HL_RANGE_SEP = "..";
35
+ /** Separator between a line number and displayed line content in hashline mode. */
36
+ export const HL_LINE_BODY_SEP = ":";
37
+ function regexEscape(str) {
38
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39
+ }
40
+ /** Bare positive line-number Lid (no decorations, no captures, no anchors). */
41
+ export const HL_LINE_RE_RAW = `[1-9]\\d*`;
42
+ /** Capture-group form of {@link HL_LINE_RE_RAW}. */
43
+ export const HL_LINE_CAPTURE_RE_RAW = `(${HL_LINE_RE_RAW})`;
44
+ /** Format a concrete replacement hunk header. */
45
+ export function formatReplaceHeader(start, end) {
46
+ return `${HL_REPLACE_KEYWORD} ${start}${HL_RANGE_SEP}${end}${HL_HEADER_COLON}`;
47
+ }
48
+ /** Format a concrete deletion hunk header. */
49
+ export function formatDeleteHeader(start, end = start) {
50
+ return start === end ? `${HL_DELETE_KEYWORD} ${start}` : `${HL_DELETE_KEYWORD} ${start}${HL_RANGE_SEP}${end}`;
51
+ }
52
+ /** Format an insertion hunk header for a cursor position. */
53
+ export function formatInsertHeader(cursor) {
54
+ switch (cursor.kind) {
55
+ case "before_anchor":
56
+ return `${HL_INSERT_KEYWORD} ${HL_INSERT_BEFORE} ${cursor.anchor.line}${HL_HEADER_COLON}`;
57
+ case "after_anchor":
58
+ return `${HL_INSERT_KEYWORD} ${HL_INSERT_AFTER} ${cursor.anchor.line}${HL_HEADER_COLON}`;
59
+ case "bof":
60
+ return `${HL_INSERT_KEYWORD} ${HL_INSERT_HEAD}${HL_HEADER_COLON}`;
61
+ case "eof":
62
+ return `${HL_INSERT_KEYWORD} ${HL_INSERT_TAIL}${HL_HEADER_COLON}`;
63
+ }
64
+ }
65
+ /** Number of hex characters in a content-derived file-hash tag. */
66
+ export const HL_FILE_HASH_LENGTH = 4;
67
+ /** Canonical uppercase hexadecimal content-hash tag carried by a hashline section header. */
68
+ export const HL_FILE_HASH_RE_RAW = `[0-9A-F]{${HL_FILE_HASH_LENGTH}}`;
69
+ /** Capture-group form of {@link HL_FILE_HASH_RE_RAW}. */
70
+ export const HL_FILE_HASH_CAPTURE_RE_RAW = `(${HL_FILE_HASH_RE_RAW})`;
71
+ /** Regex-escaped form of {@link HL_LINE_BODY_SEP}, safe for embedding inside a regex. */
72
+ export const HL_LINE_BODY_SEP_RE_RAW = regexEscape(HL_LINE_BODY_SEP);
73
+ /**
74
+ * Representative file-hash tags for use in user-facing error messages and
75
+ * prompt examples.
76
+ */
77
+ export const HL_FILE_HASH_EXAMPLES = ["1A2B", "3C4D", "9F3E"];
78
+ /**
79
+ * Normalize text before hashing: trim trailing `[ \t\r]` from every line (and
80
+ * the final line) in a single pass so CRLF endings and display-trimmed lines
81
+ * do not invalidate a tag.
82
+ */
83
+ function normalizeFileHashText(text) {
84
+ return text.replace(/[ \t\r]+(?=\n|$)/g, "");
85
+ }
86
+ /**
87
+ * Compute the content-derived hash tag carried by a hashline section header.
88
+ * The tag is a 4-hex fingerprint of the whole file's normalized text: any read
89
+ * of byte-identical content mints the same tag, and a follow-up edit anchored
90
+ * at any line validates whenever the live file still hashes to it.
91
+ */
92
+ // xxHash32 (canonical, seed 0) to match upstream Bun.hash.xxHash32 so section tags
93
+ // are byte-identical to oh-my-pi for identical content. Pure-JS for Node runtime.
94
+ const XXH_PRIME32_1 = 0x9e3779b1;
95
+ const XXH_PRIME32_2 = 0x85ebca77;
96
+ const XXH_PRIME32_3 = 0xc2b2ae3d;
97
+ const XXH_PRIME32_4 = 0x27d4eb2f;
98
+ const XXH_PRIME32_5 = 0x165667b1;
99
+ function xxhRotl(value, bits) {
100
+ return (value << bits) | (value >>> (32 - bits));
101
+ }
102
+ function xxhRound(acc, input) {
103
+ acc = (acc + Math.imul(input, XXH_PRIME32_2)) | 0;
104
+ acc = xxhRotl(acc, 13);
105
+ return Math.imul(acc, XXH_PRIME32_1) | 0;
106
+ }
107
+ function xxHash32(bytes) {
108
+ const len = bytes.length;
109
+ let index = 0;
110
+ let h32;
111
+ const readU32 = (offset) => (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)) >>> 0;
112
+ if (len >= 16) {
113
+ let v1 = (XXH_PRIME32_1 + XXH_PRIME32_2) | 0;
114
+ let v2 = XXH_PRIME32_2 | 0;
115
+ let v3 = 0;
116
+ let v4 = -XXH_PRIME32_1 | 0;
117
+ const limit = len - 16;
118
+ while (index <= limit) {
119
+ v1 = xxhRound(v1, readU32(index));
120
+ index += 4;
121
+ v2 = xxhRound(v2, readU32(index));
122
+ index += 4;
123
+ v3 = xxhRound(v3, readU32(index));
124
+ index += 4;
125
+ v4 = xxhRound(v4, readU32(index));
126
+ index += 4;
127
+ }
128
+ h32 = (xxhRotl(v1, 1) + xxhRotl(v2, 7) + xxhRotl(v3, 12) + xxhRotl(v4, 18)) | 0;
129
+ }
130
+ else {
131
+ h32 = XXH_PRIME32_5 | 0;
132
+ }
133
+ h32 = (h32 + len) | 0;
134
+ while (index + 4 <= len) {
135
+ h32 = (h32 + Math.imul(readU32(index), XXH_PRIME32_3)) | 0;
136
+ h32 = Math.imul(xxhRotl(h32, 17), XXH_PRIME32_4) | 0;
137
+ index += 4;
138
+ }
139
+ while (index < len) {
140
+ h32 = (h32 + Math.imul(bytes[index], XXH_PRIME32_5)) | 0;
141
+ h32 = Math.imul(xxhRotl(h32, 11), XXH_PRIME32_1) | 0;
142
+ index += 1;
143
+ }
144
+ h32 ^= h32 >>> 15;
145
+ h32 = Math.imul(h32, XXH_PRIME32_2);
146
+ h32 ^= h32 >>> 13;
147
+ h32 = Math.imul(h32, XXH_PRIME32_3);
148
+ h32 ^= h32 >>> 16;
149
+ return h32 >>> 0;
150
+ }
151
+ const xxhEncoder = new TextEncoder();
152
+ export function computeFileHash(text) {
153
+ const normalized = normalizeFileHashText(text);
154
+ const low16 = xxHash32(xxhEncoder.encode(normalized)) & 0xffff;
155
+ return low16.toString(16).padStart(HL_FILE_HASH_LENGTH, "0").toUpperCase();
156
+ }
157
+ /**
158
+ * Format a comma-separated list of example anchors with an optional line-number
159
+ * prefix, quoted for inclusion in error messages: `"160", "42", "7"`.
160
+ */
161
+ export function describeAnchorExamples(linePrefix = "") {
162
+ const examples = linePrefix ? [linePrefix, `${linePrefix.slice(0, -1) || "4"}2`, "7"] : ["160", "42", "7"];
163
+ return examples.map(e => `"${e}"`).join(", ");
164
+ }
165
+ /** Format a hashline section header for a file path and snapshot tag. */
166
+ export function formatHashlineHeader(filePath, fileHash) {
167
+ return `${HL_FILE_PREFIX}${filePath}${HL_FILE_HASH_SEP}${fileHash}${HL_FILE_SUFFIX}`;
168
+ }
169
+ /** Formats a single numbered line as `LINE:TEXT`. */
170
+ export function formatNumberedLine(lineNumber, line) {
171
+ return `${lineNumber}${HL_LINE_BODY_SEP}${line}`;
172
+ }
173
+ /** Format file text with hashline-mode line-number prefixes for display. */
174
+ export function formatNumberedLines(text, startLine = 1) {
175
+ const lines = text.split("\n");
176
+ return lines.map((line, i) => formatNumberedLine(startLine + i, line)).join("\n");
177
+ }
178
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/format.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,iLAAiL;AACjL;;;;GAIG;AAIH,qDAAqD;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,2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E,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAU,GAAG,EAAE;IACrD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3G,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,QAAgB;IACtE,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,gBAAgB,GAAG,QAAQ,GAAG,cAAc,EAAE,CAAC;AACtF,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,IAAY;IAClE,OAAO,GAAG,UAAU,GAAG,gBAAgB,GAAG,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,SAAS,GAAG,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/**\n * Hashline format primitives: sigils, separators, regex fragments, and\n * display helpers. These are the single source of truth for the parser, the\n * tokenizer, the prompt, and the formal grammar.\n */\n\nimport type { Cursor } from \"./types.js\";\n\n/** File-section header delimiters: `[path#hash]`. */\nexport const HL_FILE_PREFIX = \"[\";\nexport const HL_FILE_SUFFIX = \"]\";\n\n/** Payload sigil for literal body rows. */\nexport const HL_PAYLOAD_REPLACE = \"+\";\n\n/** Hunk-header keyword for concrete line replacement. */\nexport const HL_REPLACE_KEYWORD = \"replace\";\n/** Hunk-header sub-keyword: `replace block N:` resolves N to a tree-sitter block range. */\nexport const HL_BLOCK_KEYWORD = \"block\";\n/** Hunk-header keyword for concrete line deletion. */\nexport const HL_DELETE_KEYWORD = \"delete\";\n/** Hunk-header keyword for insertion operations. */\nexport const HL_INSERT_KEYWORD = \"insert\";\n/** Insert position keyword for inserting before a concrete line. */\nexport const HL_INSERT_BEFORE = \"before\";\n/** Insert position keyword for inserting after a concrete line. */\nexport const HL_INSERT_AFTER = \"after\";\n/** Insert position keyword for inserting at the start of the file. */\nexport const HL_INSERT_HEAD = \"head\";\n/** Insert position keyword for inserting at the end of the file. */\nexport const HL_INSERT_TAIL = \"tail\";\n/** Hunk-header terminator for body-bearing operations. */\nexport const HL_HEADER_COLON = \":\";\n\n/** Separator between a hashline file path and its opaque snapshot tag. */\nexport const HL_FILE_HASH_SEP = \"#\";\n\n/** Separator between two line numbers in a range, e.g. `5..10`. */\nexport const HL_RANGE_SEP = \"..\";\n\n/** Separator between a line number and displayed line content in hashline mode. */\nexport const HL_LINE_BODY_SEP = \":\";\n\nfunction regexEscape(str: string): string {\n\treturn str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Bare positive line-number Lid (no decorations, no captures, no anchors). */\nexport const HL_LINE_RE_RAW = `[1-9]\\\\d*`;\n\n/** Capture-group form of {@link HL_LINE_RE_RAW}. */\nexport const HL_LINE_CAPTURE_RE_RAW = `(${HL_LINE_RE_RAW})`;\n\n/** Format a concrete replacement hunk header. */\nexport function formatReplaceHeader(start: number, end: number): string {\n\treturn `${HL_REPLACE_KEYWORD} ${start}${HL_RANGE_SEP}${end}${HL_HEADER_COLON}`;\n}\n\n/** Format a concrete deletion hunk header. */\nexport function formatDeleteHeader(start: number, end = start): string {\n\treturn start === end ? `${HL_DELETE_KEYWORD} ${start}` : `${HL_DELETE_KEYWORD} ${start}${HL_RANGE_SEP}${end}`;\n}\n\n/** Format an insertion hunk header for a cursor position. */\nexport function formatInsertHeader(cursor: Cursor): string {\n\tswitch (cursor.kind) {\n\t\tcase \"before_anchor\":\n\t\t\treturn `${HL_INSERT_KEYWORD} ${HL_INSERT_BEFORE} ${cursor.anchor.line}${HL_HEADER_COLON}`;\n\t\tcase \"after_anchor\":\n\t\t\treturn `${HL_INSERT_KEYWORD} ${HL_INSERT_AFTER} ${cursor.anchor.line}${HL_HEADER_COLON}`;\n\t\tcase \"bof\":\n\t\t\treturn `${HL_INSERT_KEYWORD} ${HL_INSERT_HEAD}${HL_HEADER_COLON}`;\n\t\tcase \"eof\":\n\t\t\treturn `${HL_INSERT_KEYWORD} ${HL_INSERT_TAIL}${HL_HEADER_COLON}`;\n\t}\n}\n\n/** Number of hex characters in a content-derived file-hash tag. */\nexport const HL_FILE_HASH_LENGTH = 4;\n/** Canonical uppercase hexadecimal content-hash tag carried by a hashline section header. */\nexport const HL_FILE_HASH_RE_RAW = `[0-9A-F]{${HL_FILE_HASH_LENGTH}}`;\n/** Capture-group form of {@link HL_FILE_HASH_RE_RAW}. */\nexport const HL_FILE_HASH_CAPTURE_RE_RAW = `(${HL_FILE_HASH_RE_RAW})`;\n/** Regex-escaped form of {@link HL_LINE_BODY_SEP}, safe for embedding inside a regex. */\nexport const HL_LINE_BODY_SEP_RE_RAW = regexEscape(HL_LINE_BODY_SEP);\n/**\n * Representative file-hash tags for use in user-facing error messages and\n * prompt examples.\n */\nexport const HL_FILE_HASH_EXAMPLES = [\"1A2B\", \"3C4D\", \"9F3E\"] as const;\n/**\n * Normalize text before hashing: trim trailing `[ \\t\\r]` from every line (and\n * the final line) in a single pass so CRLF endings and display-trimmed lines\n * do not invalidate a tag.\n */\nfunction normalizeFileHashText(text: string): string {\n\treturn text.replace(/[ \\t\\r]+(?=\\n|$)/g, \"\");\n}\n/**\n * Compute the content-derived hash tag carried by a hashline section header.\n * The tag is a 4-hex fingerprint of the whole file's normalized text: any read\n * of byte-identical content mints the same tag, and a follow-up edit anchored\n * at any line validates whenever the live file still hashes to it.\n */\n// xxHash32 (canonical, seed 0) to match upstream Bun.hash.xxHash32 so section tags\n// are byte-identical to oh-my-pi for identical content. Pure-JS for Node runtime.\nconst XXH_PRIME32_1 = 0x9e3779b1;\nconst XXH_PRIME32_2 = 0x85ebca77;\nconst XXH_PRIME32_3 = 0xc2b2ae3d;\nconst XXH_PRIME32_4 = 0x27d4eb2f;\nconst XXH_PRIME32_5 = 0x165667b1;\nfunction xxhRotl(value: number, bits: number): number {\n\treturn (value << bits) | (value >>> (32 - bits));\n}\nfunction xxhRound(acc: number, input: number): number {\n\tacc = (acc + Math.imul(input, XXH_PRIME32_2)) | 0;\n\tacc = xxhRotl(acc, 13);\n\treturn Math.imul(acc, XXH_PRIME32_1) | 0;\n}\nfunction xxHash32(bytes: Uint8Array): number {\n\tconst len = bytes.length;\n\tlet index = 0;\n\tlet h32: number;\n\tconst readU32 = (offset: number): number =>\n\t\t(bytes[offset]! | (bytes[offset + 1]! << 8) | (bytes[offset + 2]! << 16) | (bytes[offset + 3]! << 24)) >>> 0;\n\tif (len >= 16) {\n\t\tlet v1 = (XXH_PRIME32_1 + XXH_PRIME32_2) | 0;\n\t\tlet v2 = XXH_PRIME32_2 | 0;\n\t\tlet v3 = 0;\n\t\tlet v4 = -XXH_PRIME32_1 | 0;\n\t\tconst limit = len - 16;\n\t\twhile (index <= limit) {\n\t\t\tv1 = xxhRound(v1, readU32(index)); index += 4;\n\t\t\tv2 = xxhRound(v2, readU32(index)); index += 4;\n\t\t\tv3 = xxhRound(v3, readU32(index)); index += 4;\n\t\t\tv4 = xxhRound(v4, readU32(index)); index += 4;\n\t\t}\n\t\th32 = (xxhRotl(v1, 1) + xxhRotl(v2, 7) + xxhRotl(v3, 12) + xxhRotl(v4, 18)) | 0;\n\t} else {\n\t\th32 = XXH_PRIME32_5 | 0;\n\t}\n\th32 = (h32 + len) | 0;\n\twhile (index + 4 <= len) {\n\t\th32 = (h32 + Math.imul(readU32(index), XXH_PRIME32_3)) | 0;\n\t\th32 = Math.imul(xxhRotl(h32, 17), XXH_PRIME32_4) | 0;\n\t\tindex += 4;\n\t}\n\twhile (index < len) {\n\t\th32 = (h32 + Math.imul(bytes[index]!, XXH_PRIME32_5)) | 0;\n\t\th32 = Math.imul(xxhRotl(h32, 11), XXH_PRIME32_1) | 0;\n\t\tindex += 1;\n\t}\n\th32 ^= h32 >>> 15;\n\th32 = Math.imul(h32, XXH_PRIME32_2);\n\th32 ^= h32 >>> 13;\n\th32 = Math.imul(h32, XXH_PRIME32_3);\n\th32 ^= h32 >>> 16;\n\treturn h32 >>> 0;\n}\nconst xxhEncoder = new TextEncoder();\nexport function computeFileHash(text: string): string {\n\tconst normalized = normalizeFileHashText(text);\n\tconst low16 = xxHash32(xxhEncoder.encode(normalized)) & 0xffff;\n\treturn low16.toString(16).padStart(HL_FILE_HASH_LENGTH, \"0\").toUpperCase();\n}\n\n/**\n * Format a comma-separated list of example anchors with an optional line-number\n * prefix, quoted for inclusion in error messages: `\"160\", \"42\", \"7\"`.\n */\nexport function describeAnchorExamples(linePrefix = \"\"): string {\n\tconst examples = linePrefix ? [linePrefix, `${linePrefix.slice(0, -1) || \"4\"}2`, \"7\"] : [\"160\", \"42\", \"7\"];\n\treturn examples.map(e => `\"${e}\"`).join(\", \");\n}\n\n/** Format a hashline section header for a file path and snapshot tag. */\nexport function formatHashlineHeader(filePath: string, fileHash: string): string {\n\treturn `${HL_FILE_PREFIX}${filePath}${HL_FILE_HASH_SEP}${fileHash}${HL_FILE_SUFFIX}`;\n}\n\n/** Formats a single numbered line as `LINE:TEXT`. */\nexport function formatNumberedLine(lineNumber: number, line: string): string {\n\treturn `${lineNumber}${HL_LINE_BODY_SEP}${line}`;\n}\n\n/** Format file text with hashline-mode line-number prefixes for display. */\nexport function formatNumberedLines(text: string, startLine = 1): string {\n\tconst lines = text.split(\"\\n\");\n\treturn lines.map((line, i) => formatNumberedLine(startLine + i, line)).join(\"\\n\");\n}\n"]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Result returned by {@link Filesystem.writeText}. The patcher echoes back
3
+ * `text` so adapters that transform on serialization (e.g. notebooks) can
4
+ * report what actually landed on disk.
5
+ */
6
+ export interface WriteResult {
7
+ /** Final text that was persisted. May differ from the input if the FS transformed it. */
8
+ text: string;
9
+ }
10
+ /**
11
+ * ENOENT-like error thrown by {@link Filesystem.readText} when a path is
12
+ * missing. Carrying a `code` property keeps the contract compatible with
13
+ * `node:fs` callers that already check `err.code === "ENOENT"`.
14
+ */
15
+ export declare class NotFoundError extends Error {
16
+ readonly code = "ENOENT";
17
+ constructor(path: string, cause?: unknown);
18
+ }
19
+ /** Type guard for {@link NotFoundError} and structurally-compatible errors. */
20
+ export declare function isNotFound(error: unknown): boolean;
21
+ /**
22
+ * Abstract storage backend the {@link Patcher} reads from and writes to.
23
+ * Subclass for new backends; the package ships {@link InMemoryFilesystem} and
24
+ * {@link NodeFilesystem} for the most common cases.
25
+ *
26
+ * Implementations work with raw text — the patcher handles BOM stripping and
27
+ * line-ending normalization itself. `readText` MUST throw {@link
28
+ * NotFoundError} (or any error for which {@link isNotFound} returns true)
29
+ * when the path doesn't exist; that's how the patcher detects a create-vs-
30
+ * update.
31
+ */
32
+ export declare abstract class Filesystem {
33
+ /** Read the file's full text content. Throw on missing file. */
34
+ abstract readText(path: string): Promise<string>;
35
+ /** Validate that `path` is writable before a prepared batch starts committing. */
36
+ preflightWrite(_path: string): Promise<void>;
37
+ /** Persist `content` at `path`. Returns the actual final text that was written. */
38
+ abstract writeText(path: string, content: string): Promise<WriteResult>;
39
+ /** Return true when the path exists and can be read. Default: probe via {@link readText}. */
40
+ exists(path: string): Promise<boolean>;
41
+ /**
42
+ * Canonical path used as a key by external caches (e.g. snapshot
43
+ * stores). The default is identity; override to return an absolute or
44
+ * otherwise canonicalised path so producers and consumers of cached
45
+ * snapshots agree on the key without each having to redo the resolution.
46
+ */
47
+ canonicalPath(path: string): string;
48
+ }
49
+ /**
50
+ * In-memory {@link Filesystem}. Useful for tests, sandboxes, dry-runs, and as
51
+ * a building block for stacked adapters (e.g. an LRU layer on top).
52
+ */
53
+ export declare class InMemoryFilesystem extends Filesystem {
54
+ #private;
55
+ constructor(initial?: Iterable<readonly [string, string]>);
56
+ readText(path: string): Promise<string>;
57
+ writeText(path: string, content: string): Promise<WriteResult>;
58
+ exists(path: string): Promise<boolean>;
59
+ /** Synchronous helper for setting up fixtures without awaiting. */
60
+ set(path: string, content: string): void;
61
+ /** Synchronous helper for inspecting state without awaiting. */
62
+ get(path: string): string | undefined;
63
+ /** Remove a single entry. Returns true when something was removed. */
64
+ delete(path: string): boolean;
65
+ /** Wipe all entries. */
66
+ clear(): void;
67
+ /** Iterate `[path, content]` pairs. */
68
+ entries(): IterableIterator<[string, string]>;
69
+ }
70
+ /**
71
+ * Disk-backed {@link Filesystem} using Bun's file APIs. The default for CLI
72
+ * use. Paths are accepted as-is; callers responsible for any cwd or
73
+ * jail/sandbox resolution should wrap this with their own subclass.
74
+ */
75
+ export declare class NodeFilesystem extends Filesystem {
76
+ readText(path: string): Promise<string>;
77
+ writeText(path: string, content: string): Promise<WriteResult>;
78
+ canonicalPath(path: string): string;
79
+ exists(path: string): Promise<boolean>;
80
+ }
81
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/fs.ts"],"names":[],"mappings":"AAgBA;;;;GAIG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G,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEvC;IAED,gEAAgE;IAChE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpC;IAED,sEAAsE;IACtE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5B;IAED,wBAAwB;IACxB,KAAK,IAAI,IAAI,CAEZ;IAED,uCAAuC;IACvC,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAE5C;CACD;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,UAAU;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG5C;IAEK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAGnE;IAED,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElC;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3C;CACD","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\nimport { existsSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\n/**\n * Storage seam for the hashline patcher. {@link Filesystem} is intentionally\n * minimal — `readText`, `writeText`, `exists` — so any backing store can be\n * adapted: disk, memory, S3, an LSP text-document protocol, a Git tree, a\n * VFS, etc.\n *\n * The patcher does its own BOM stripping and LF normalization between\n * {@link Filesystem.readText} and {@link Filesystem.writeText}; the FS deals\n * only in raw text strings.\n */\nimport * as pathModule from \"node:path\";\n\n/**\n * Result returned by {@link Filesystem.writeText}. The patcher echoes back\n * `text` so adapters that transform on serialization (e.g. notebooks) can\n * report what actually landed on disk.\n */\nexport interface WriteResult {\n\t/** Final text that was persisted. May differ from the input if the FS transformed it. */\n\ttext: string;\n}\n\n/**\n * ENOENT-like error thrown by {@link Filesystem.readText} when a path is\n * missing. Carrying a `code` property keeps the contract compatible with\n * `node:fs` callers that already check `err.code === \"ENOENT\"`.\n */\nexport class NotFoundError extends Error {\n\treadonly code = \"ENOENT\";\n\n\tconstructor(path: string, cause?: unknown) {\n\t\tsuper(`File not found: ${path}`);\n\t\tthis.name = \"NotFoundError\";\n\t\tif (cause !== undefined) (this as Error & { cause?: unknown }).cause = cause;\n\t}\n}\n\n/** Type guard for {@link NotFoundError} and structurally-compatible errors. */\nexport function isNotFound(error: unknown): boolean {\n\tif (error instanceof NotFoundError) return true;\n\tif (error instanceof Error && (error as Error & { code?: string }).code === \"ENOENT\") return true;\n\treturn false;\n}\n\n/**\n * Abstract storage backend the {@link Patcher} reads from and writes to.\n * Subclass for new backends; the package ships {@link InMemoryFilesystem} and\n * {@link NodeFilesystem} for the most common cases.\n *\n * Implementations work with raw text — the patcher handles BOM stripping and\n * line-ending normalization itself. `readText` MUST throw {@link\n * NotFoundError} (or any error for which {@link isNotFound} returns true)\n * when the path doesn't exist; that's how the patcher detects a create-vs-\n * update.\n */\nexport abstract class Filesystem {\n\t/** Read the file's full text content. Throw on missing file. */\n\tabstract readText(path: string): Promise<string>;\n\n\t/** Validate that `path` is writable before a prepared batch starts committing. */\n\tasync preflightWrite(_path: string): Promise<void> {}\n\n\t/** Persist `content` at `path`. Returns the actual final text that was written. */\n\tabstract writeText(path: string, content: string): Promise<WriteResult>;\n\n\t/** Return true when the path exists and can be read. Default: probe via {@link readText}. */\n\tasync exists(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait this.readText(path);\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tif (isNotFound(error)) return false;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Canonical path used as a key by external caches (e.g. snapshot\n\t * stores). The default is identity; override to return an absolute or\n\t * otherwise canonicalised path so producers and consumers of cached\n\t * snapshots agree on the key without each having to redo the resolution.\n\t */\n\tcanonicalPath(path: string): string {\n\t\treturn path;\n\t}\n}\n\n/**\n * In-memory {@link Filesystem}. Useful for tests, sandboxes, dry-runs, and as\n * a building block for stacked adapters (e.g. an LRU layer on top).\n */\nexport class InMemoryFilesystem extends Filesystem {\n\t#files = new Map<string, string>();\n\n\tconstructor(initial?: Iterable<readonly [string, string]>) {\n\t\tsuper();\n\t\tif (initial) {\n\t\t\tfor (const [path, content] of initial) this.#files.set(path, content);\n\t\t}\n\t}\n\n\tasync readText(path: string): Promise<string> {\n\t\tconst text = this.#files.get(path);\n\t\tif (text === undefined) throw new NotFoundError(path);\n\t\treturn text;\n\t}\n\n\tasync writeText(path: string, content: string): Promise<WriteResult> {\n\t\tthis.#files.set(path, content);\n\t\treturn { text: content };\n\t}\n\n\tasync exists(path: string): Promise<boolean> {\n\t\treturn this.#files.has(path);\n\t}\n\n\t/** Synchronous helper for setting up fixtures without awaiting. */\n\tset(path: string, content: string): void {\n\t\tthis.#files.set(path, content);\n\t}\n\n\t/** Synchronous helper for inspecting state without awaiting. */\n\tget(path: string): string | undefined {\n\t\treturn this.#files.get(path);\n\t}\n\n\t/** Remove a single entry. Returns true when something was removed. */\n\tdelete(path: string): boolean {\n\t\treturn this.#files.delete(path);\n\t}\n\n\t/** Wipe all entries. */\n\tclear(): void {\n\t\tthis.#files.clear();\n\t}\n\n\t/** Iterate `[path, content]` pairs. */\n\tentries(): IterableIterator<[string, string]> {\n\t\treturn this.#files.entries();\n\t}\n}\n\n/**\n * Disk-backed {@link Filesystem} using Bun's file APIs. The default for CLI\n * use. Paths are accepted as-is; callers responsible for any cwd or\n * jail/sandbox resolution should wrap this with their own subclass.\n */\nexport class NodeFilesystem extends Filesystem {\n\tasync readText(path: string): Promise<string> {\n\t\tif (!existsSync(path)) throw new NotFoundError(path);\n\t\treturn readFile(path, \"utf8\");\n\t}\n\n\tasync writeText(path: string, content: string): Promise<WriteResult> {\n\t\tawait writeFile(path, content, \"utf8\");\n\t\treturn { text: content };\n\t}\n\n\tcanonicalPath(path: string): string {\n\t\treturn pathModule.resolve(path);\n\t}\n\n\tasync exists(path: string): Promise<boolean> {\n\t\treturn existsSync(path);\n\t}\n}\n"]}
@@ -0,0 +1,143 @@
1
+ // @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.
2
+ // Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).
3
+ import { existsSync } from "node:fs";
4
+ import { readFile, writeFile } from "node:fs/promises";
5
+ /**
6
+ * Storage seam for the hashline patcher. {@link Filesystem} is intentionally
7
+ * minimal — `readText`, `writeText`, `exists` — so any backing store can be
8
+ * adapted: disk, memory, S3, an LSP text-document protocol, a Git tree, a
9
+ * VFS, etc.
10
+ *
11
+ * The patcher does its own BOM stripping and LF normalization between
12
+ * {@link Filesystem.readText} and {@link Filesystem.writeText}; the FS deals
13
+ * only in raw text strings.
14
+ */
15
+ import * as pathModule from "node:path";
16
+ /**
17
+ * ENOENT-like error thrown by {@link Filesystem.readText} when a path is
18
+ * missing. Carrying a `code` property keeps the contract compatible with
19
+ * `node:fs` callers that already check `err.code === "ENOENT"`.
20
+ */
21
+ export class NotFoundError extends Error {
22
+ constructor(path, cause) {
23
+ super(`File not found: ${path}`);
24
+ this.code = "ENOENT";
25
+ this.name = "NotFoundError";
26
+ if (cause !== undefined)
27
+ this.cause = cause;
28
+ }
29
+ }
30
+ /** Type guard for {@link NotFoundError} and structurally-compatible errors. */
31
+ export function isNotFound(error) {
32
+ if (error instanceof NotFoundError)
33
+ return true;
34
+ if (error instanceof Error && error.code === "ENOENT")
35
+ return true;
36
+ return false;
37
+ }
38
+ /**
39
+ * Abstract storage backend the {@link Patcher} reads from and writes to.
40
+ * Subclass for new backends; the package ships {@link InMemoryFilesystem} and
41
+ * {@link NodeFilesystem} for the most common cases.
42
+ *
43
+ * Implementations work with raw text — the patcher handles BOM stripping and
44
+ * line-ending normalization itself. `readText` MUST throw {@link
45
+ * NotFoundError} (or any error for which {@link isNotFound} returns true)
46
+ * when the path doesn't exist; that's how the patcher detects a create-vs-
47
+ * update.
48
+ */
49
+ export class Filesystem {
50
+ /** Validate that `path` is writable before a prepared batch starts committing. */
51
+ async preflightWrite(_path) { }
52
+ /** Return true when the path exists and can be read. Default: probe via {@link readText}. */
53
+ async exists(path) {
54
+ try {
55
+ await this.readText(path);
56
+ return true;
57
+ }
58
+ catch (error) {
59
+ if (isNotFound(error))
60
+ return false;
61
+ throw error;
62
+ }
63
+ }
64
+ /**
65
+ * Canonical path used as a key by external caches (e.g. snapshot
66
+ * stores). The default is identity; override to return an absolute or
67
+ * otherwise canonicalised path so producers and consumers of cached
68
+ * snapshots agree on the key without each having to redo the resolution.
69
+ */
70
+ canonicalPath(path) {
71
+ return path;
72
+ }
73
+ }
74
+ /**
75
+ * In-memory {@link Filesystem}. Useful for tests, sandboxes, dry-runs, and as
76
+ * a building block for stacked adapters (e.g. an LRU layer on top).
77
+ */
78
+ export class InMemoryFilesystem extends Filesystem {
79
+ #files = new Map();
80
+ constructor(initial) {
81
+ super();
82
+ if (initial) {
83
+ for (const [path, content] of initial)
84
+ this.#files.set(path, content);
85
+ }
86
+ }
87
+ async readText(path) {
88
+ const text = this.#files.get(path);
89
+ if (text === undefined)
90
+ throw new NotFoundError(path);
91
+ return text;
92
+ }
93
+ async writeText(path, content) {
94
+ this.#files.set(path, content);
95
+ return { text: content };
96
+ }
97
+ async exists(path) {
98
+ return this.#files.has(path);
99
+ }
100
+ /** Synchronous helper for setting up fixtures without awaiting. */
101
+ set(path, content) {
102
+ this.#files.set(path, content);
103
+ }
104
+ /** Synchronous helper for inspecting state without awaiting. */
105
+ get(path) {
106
+ return this.#files.get(path);
107
+ }
108
+ /** Remove a single entry. Returns true when something was removed. */
109
+ delete(path) {
110
+ return this.#files.delete(path);
111
+ }
112
+ /** Wipe all entries. */
113
+ clear() {
114
+ this.#files.clear();
115
+ }
116
+ /** Iterate `[path, content]` pairs. */
117
+ entries() {
118
+ return this.#files.entries();
119
+ }
120
+ }
121
+ /**
122
+ * Disk-backed {@link Filesystem} using Bun's file APIs. The default for CLI
123
+ * use. Paths are accepted as-is; callers responsible for any cwd or
124
+ * jail/sandbox resolution should wrap this with their own subclass.
125
+ */
126
+ export class NodeFilesystem extends Filesystem {
127
+ async readText(path) {
128
+ if (!existsSync(path))
129
+ throw new NotFoundError(path);
130
+ return readFile(path, "utf8");
131
+ }
132
+ async writeText(path, content) {
133
+ await writeFile(path, content, "utf8");
134
+ return { text: content };
135
+ }
136
+ canonicalPath(path) {
137
+ return pathModule.resolve(path);
138
+ }
139
+ async exists(path) {
140
+ return existsSync(path);
141
+ }
142
+ }
143
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/fs.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,iLAAiL;AACjL,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD;;;;;;;;;GASG;AACH,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AAYxC;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGvC,YAAY,IAAY,EAAE,KAAe;QACxC,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAHzB,SAAI,GAAG,QAAQ,CAAC;QAIxB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,KAAK,KAAK,SAAS;YAAG,IAAoC,CAAC,KAAK,GAAG,KAAK,CAAC;IAC9E,CAAC;CACD;AAED,+EAA+E;AAC/E,MAAM,UAAU,UAAU,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,aAAa;QAAE,O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CAAC,IAAY;QACzB,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACxB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\nimport { existsSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\n/**\n * Storage seam for the hashline patcher. {@link Filesystem} is intentionally\n * minimal — `readText`, `writeText`, `exists` — so any backing store can be\n * adapted: disk, memory, S3, an LSP text-document protocol, a Git tree, a\n * VFS, etc.\n *\n * The patcher does its own BOM stripping and LF normalization between\n * {@link Filesystem.readText} and {@link Filesystem.writeText}; the FS deals\n * only in raw text strings.\n */\nimport * as pathModule from \"node:path\";\n\n/**\n * Result returned by {@link Filesystem.writeText}. The patcher echoes back\n * `text` so adapters that transform on serialization (e.g. notebooks) can\n * report what actually landed on disk.\n */\nexport interface WriteResult {\n\t/** Final text that was persisted. May differ from the input if the FS transformed it. */\n\ttext: string;\n}\n\n/**\n * ENOENT-like error thrown by {@link Filesystem.readText} when a path is\n * missing. Carrying a `code` property keeps the contract compatible with\n * `node:fs` callers that already check `err.code === \"ENOENT\"`.\n */\nexport class NotFoundError extends Error {\n\treadonly code = \"ENOENT\";\n\n\tconstructor(path: string, cause?: unknown) {\n\t\tsuper(`File not found: ${path}`);\n\t\tthis.name = \"NotFoundError\";\n\t\tif (cause !== undefined) (this as Error & { cause?: unknown }).cause = cause;\n\t}\n}\n\n/** Type guard for {@link NotFoundError} and structurally-compatible errors. */\nexport function isNotFound(error: unknown): boolean {\n\tif (error instanceof NotFoundError) return true;\n\tif (error instanceof Error && (error as Error & { code?: string }).code === \"ENOENT\") return true;\n\treturn false;\n}\n\n/**\n * Abstract storage backend the {@link Patcher} reads from and writes to.\n * Subclass for new backends; the package ships {@link InMemoryFilesystem} and\n * {@link NodeFilesystem} for the most common cases.\n *\n * Implementations work with raw text — the patcher handles BOM stripping and\n * line-ending normalization itself. `readText` MUST throw {@link\n * NotFoundError} (or any error for which {@link isNotFound} returns true)\n * when the path doesn't exist; that's how the patcher detects a create-vs-\n * update.\n */\nexport abstract class Filesystem {\n\t/** Read the file's full text content. Throw on missing file. */\n\tabstract readText(path: string): Promise<string>;\n\n\t/** Validate that `path` is writable before a prepared batch starts committing. */\n\tasync preflightWrite(_path: string): Promise<void> {}\n\n\t/** Persist `content` at `path`. Returns the actual final text that was written. */\n\tabstract writeText(path: string, content: string): Promise<WriteResult>;\n\n\t/** Return true when the path exists and can be read. Default: probe via {@link readText}. */\n\tasync exists(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait this.readText(path);\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tif (isNotFound(error)) return false;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Canonical path used as a key by external caches (e.g. snapshot\n\t * stores). The default is identity; override to return an absolute or\n\t * otherwise canonicalised path so producers and consumers of cached\n\t * snapshots agree on the key without each having to redo the resolution.\n\t */\n\tcanonicalPath(path: string): string {\n\t\treturn path;\n\t}\n}\n\n/**\n * In-memory {@link Filesystem}. Useful for tests, sandboxes, dry-runs, and as\n * a building block for stacked adapters (e.g. an LRU layer on top).\n */\nexport class InMemoryFilesystem extends Filesystem {\n\t#files = new Map<string, string>();\n\n\tconstructor(initial?: Iterable<readonly [string, string]>) {\n\t\tsuper();\n\t\tif (initial) {\n\t\t\tfor (const [path, content] of initial) this.#files.set(path, content);\n\t\t}\n\t}\n\n\tasync readText(path: string): Promise<string> {\n\t\tconst text = this.#files.get(path);\n\t\tif (text === undefined) throw new NotFoundError(path);\n\t\treturn text;\n\t}\n\n\tasync writeText(path: string, content: string): Promise<WriteResult> {\n\t\tthis.#files.set(path, content);\n\t\treturn { text: content };\n\t}\n\n\tasync exists(path: string): Promise<boolean> {\n\t\treturn this.#files.has(path);\n\t}\n\n\t/** Synchronous helper for setting up fixtures without awaiting. */\n\tset(path: string, content: string): void {\n\t\tthis.#files.set(path, content);\n\t}\n\n\t/** Synchronous helper for inspecting state without awaiting. */\n\tget(path: string): string | undefined {\n\t\treturn this.#files.get(path);\n\t}\n\n\t/** Remove a single entry. Returns true when something was removed. */\n\tdelete(path: string): boolean {\n\t\treturn this.#files.delete(path);\n\t}\n\n\t/** Wipe all entries. */\n\tclear(): void {\n\t\tthis.#files.clear();\n\t}\n\n\t/** Iterate `[path, content]` pairs. */\n\tentries(): IterableIterator<[string, string]> {\n\t\treturn this.#files.entries();\n\t}\n}\n\n/**\n * Disk-backed {@link Filesystem} using Bun's file APIs. The default for CLI\n * use. Paths are accepted as-is; callers responsible for any cwd or\n * jail/sandbox resolution should wrap this with their own subclass.\n */\nexport class NodeFilesystem extends Filesystem {\n\tasync readText(path: string): Promise<string> {\n\t\tif (!existsSync(path)) throw new NotFoundError(path);\n\t\treturn readFile(path, \"utf8\");\n\t}\n\n\tasync writeText(path: string, content: string): Promise<WriteResult> {\n\t\tawait writeFile(path, content, \"utf8\");\n\t\treturn { text: content };\n\t}\n\n\tcanonicalPath(path: string): string {\n\t\treturn pathModule.resolve(path);\n\t}\n\n\tasync exists(path: string): Promise<boolean> {\n\t\treturn existsSync(path);\n\t}\n}\n"]}
@@ -0,0 +1,18 @@
1
+ export * from "./apply.js";
2
+ export * from "./block.js";
3
+ export * from "./diff-preview.js";
4
+ export * from "./format.js";
5
+ export * from "./fs.js";
6
+ export * from "./input.js";
7
+ export * from "./messages.js";
8
+ export * from "./mismatch.js";
9
+ export * from "./normalize.js";
10
+ export * from "./parser.js";
11
+ export * from "./patcher.js";
12
+ export * from "./prefixes.js";
13
+ export * from "./recovery.js";
14
+ export * from "./snapshots.js";
15
+ export * from "./stream.js";
16
+ export * from "./tokenizer.js";
17
+ export * from "./types.js";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\nexport * from \"./apply.js\";\nexport * from \"./block.js\";\nexport * from \"./diff-preview.js\";\nexport * from \"./format.js\";\nexport * from \"./fs.js\";\nexport * from \"./input.js\";\nexport * from \"./messages.js\";\nexport * from \"./mismatch.js\";\nexport * from \"./normalize.js\";\nexport * from \"./parser.js\";\nexport * from \"./patcher.js\";\nexport * from \"./prefixes.js\";\nexport * from \"./recovery.js\";\nexport * from \"./snapshots.js\";\nexport * from \"./stream.js\";\nexport * from \"./tokenizer.js\";\nexport * from \"./types.js\";\n"]}
@@ -0,0 +1,20 @@
1
+ // @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.
2
+ // Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).
3
+ export * from "./apply.js";
4
+ export * from "./block.js";
5
+ export * from "./diff-preview.js";
6
+ export * from "./format.js";
7
+ export * from "./fs.js";
8
+ export * from "./input.js";
9
+ export * from "./messages.js";
10
+ export * from "./mismatch.js";
11
+ export * from "./normalize.js";
12
+ export * from "./parser.js";
13
+ export * from "./patcher.js";
14
+ export * from "./prefixes.js";
15
+ export * from "./recovery.js";
16
+ export * from "./snapshots.js";
17
+ export * from "./stream.js";
18
+ export * from "./tokenizer.js";
19
+ export * from "./types.js";
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,iLAAiL;AACjL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\nexport * from \"./apply.js\";\nexport * from \"./block.js\";\nexport * from \"./diff-preview.js\";\nexport * from \"./format.js\";\nexport * from \"./fs.js\";\nexport * from \"./input.js\";\nexport * from \"./messages.js\";\nexport * from \"./mismatch.js\";\nexport * from \"./normalize.js\";\nexport * from \"./parser.js\";\nexport * from \"./patcher.js\";\nexport * from \"./prefixes.js\";\nexport * from \"./recovery.js\";\nexport * from \"./snapshots.js\";\nexport * from \"./stream.js\";\nexport * from \"./tokenizer.js\";\nexport * from \"./types.js\";\n"]}
@@ -0,0 +1,101 @@
1
+ import type { ApplyResult, BlockResolver, Edit, SplitOptions } from "./types.js";
2
+ interface RawSection {
3
+ path: string;
4
+ fileHash?: string;
5
+ diff: string;
6
+ }
7
+ /**
8
+ * Returns true when the input contains at least one line that the tokenizer
9
+ * recognizes as a hashline op. Used by streaming previews to decide whether
10
+ * the partial input is worth treating as a hashline patch yet.
11
+ */
12
+ export declare function containsRecognizableHashlineOperations(input: string): boolean;
13
+ /**
14
+ * Snapshot of one section in a parsed {@link Patch}: a target file plus the
15
+ * lazily-parsed list of edits that should land on it. Constructed by
16
+ * {@link Patch.parse}; consumers usually iterate `patch.sections` rather
17
+ * than build these directly.
18
+ */
19
+ export declare class PatchSection {
20
+ #private;
21
+ readonly path: string;
22
+ readonly fileHash: string | undefined;
23
+ readonly diff: string;
24
+ constructor(raw: RawSection);
25
+ /**
26
+ * Parse this section's diff body. Cached: subsequent calls return the
27
+ * same `{ edits, warnings }` object so callers can safely call this from
28
+ * multiple paths (preflight, apply, diff-preview).
29
+ */
30
+ parse(): {
31
+ edits: Edit[];
32
+ warnings: readonly string[];
33
+ };
34
+ /** Parsed edits for this section. */
35
+ get edits(): readonly Edit[];
36
+ /** Warnings emitted during parsing of this section. */
37
+ get warnings(): readonly string[];
38
+ /**
39
+ * True when at least one edit anchors to concrete file content. Pure
40
+ * `insert head:` / `insert tail:` literal inserts do not count: those are
41
+ * safe to apply to files that don't yet exist.
42
+ */
43
+ get hasAnchorScopedEdit(): boolean;
44
+ /** Anchor lines touched by this section, sorted ascending and deduplicated. */
45
+ collectAnchorLines(): readonly number[];
46
+ /**
47
+ * Apply this section's edits to `text` and return the post-edit result.
48
+ * Pure: does no I/O, does not validate the section snapshot tag. The
49
+ * {@link Patcher} owns tag validation and recovery; reach for this
50
+ * method directly when you've already validated the file content and
51
+ * just want the result.
52
+ *
53
+ * `blockResolver` resolves any `replace block N:` edits against `text`; an
54
+ * unresolvable block throws (this is the final, authoritative preview path).
55
+ */
56
+ applyTo(text: string, blockResolver?: BlockResolver): ApplyResult;
57
+ /**
58
+ * Streaming-tolerant counterpart to {@link applyTo}. Uses
59
+ * {@link parsePatchStreaming} so a trailing in-flight op (no payload yet,
60
+ * or a per-token parse error mid-stream) does not throw or emit a phantom
61
+ * empty-payload edit. Intended for incremental diff previews; the writer
62
+ * path should always use {@link applyTo}.
63
+ *
64
+ * `blockResolver` resolves any `replace block N:` edits against `text`; an
65
+ * unresolvable block is silently dropped so a half-written file does not
66
+ * throw mid-stream.
67
+ */
68
+ applyPartialTo(text: string, blockResolver?: BlockResolver): ApplyResult;
69
+ }
70
+ /**
71
+ * A parsed hashline patch — zero or more {@link PatchSection}s, each rooted
72
+ * at a `[PATH#HASH]` header. Construct via {@link Patch.parse}.
73
+ *
74
+ * `Patch` is pure data: parsing is line-anchored and does not look at the
75
+ * filesystem. To apply a patch, hand it to {@link Patcher.apply}.
76
+ */
77
+ export declare class Patch {
78
+ readonly sections: readonly PatchSection[];
79
+ private constructor();
80
+ /**
81
+ * Parse `input` into a {@link Patch}. `options.cwd` resolves absolute
82
+ * paths inside headers to cwd-relative form; `options.path` provides a
83
+ * fallback when the input lacks a header but contains hashline ops
84
+ * (useful for streaming previews).
85
+ *
86
+ * Consecutive sections targeting the same path are merged into a single
87
+ * section with concatenated diff bodies. Anchors authored against the
88
+ * same file snapshot must be applied as one batch; otherwise the first
89
+ * sub-edit shifts line numbers out from under the second's anchors and
90
+ * validation fails.
91
+ */
92
+ static parse(input: string, options?: SplitOptions): Patch;
93
+ /**
94
+ * Parse `input` and return only the first section. Throws if the input
95
+ * has zero sections. Convenience for the single-section case where the
96
+ * caller already knows the patch is one hunk.
97
+ */
98
+ static parseSingle(input: string, options?: SplitOptions): PatchSection;
99
+ }
100
+ export {};
101
+ //# sourceMappingURL=input.d.ts.map