@agimon-ai/doompi-git 0.0.1-alpha.7 → 0.0.1-alpha.9

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 (325) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -1
  2. package/dist/api-contracts.cjs +7 -1
  3. package/dist/api-contracts.d.cts +1 -1
  4. package/dist/api-contracts.d.mts +1 -1
  5. package/dist/api-contracts.mjs +2 -1
  6. package/dist/extensions/pi.cjs +38 -1
  7. package/dist/extensions/pi.cjs.map +1 -1
  8. package/dist/extensions/pi.d.cts +5 -4
  9. package/dist/extensions/pi.d.cts.map +1 -1
  10. package/dist/extensions/pi.d.mts +5 -4
  11. package/dist/extensions/pi.d.mts.map +1 -1
  12. package/dist/extensions/pi.mjs +33 -1
  13. package/dist/extensions/pi.mjs.map +1 -1
  14. package/dist/extensions/server.cjs +72 -1
  15. package/dist/extensions/server.cjs.map +1 -1
  16. package/dist/extensions/server.d.cts +3 -3
  17. package/dist/extensions/server.d.cts.map +1 -1
  18. package/dist/extensions/server.d.mts +3 -3
  19. package/dist/extensions/server.d.mts.map +1 -1
  20. package/dist/extensions/server.mjs +67 -1
  21. package/dist/extensions/server.mjs.map +1 -1
  22. package/dist/extensions/web.mjs +485 -0
  23. package/dist/extensions/web.mjs.map +1 -0
  24. package/dist/index.cjs +5 -1
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.mts +3 -3
  27. package/dist/index.mjs +3 -1
  28. package/dist/src/constants/git.cjs +8 -0
  29. package/dist/src/constants/git.cjs.map +1 -0
  30. package/dist/src/constants/git.mjs +7 -0
  31. package/dist/src/constants/git.mjs.map +1 -0
  32. package/dist/src/extensions/(backend)/api/_lib/route.server.cjs +93 -0
  33. package/dist/src/extensions/(backend)/api/_lib/route.server.cjs.map +1 -0
  34. package/dist/src/extensions/(backend)/api/_lib/route.server.mjs +92 -0
  35. package/dist/src/extensions/(backend)/api/_lib/route.server.mjs.map +1 -0
  36. package/dist/src/extensions/(backend)/api/route.server.cjs +7 -0
  37. package/dist/src/extensions/(backend)/api/route.server.cjs.map +1 -0
  38. package/dist/src/extensions/(backend)/api/route.server.mjs +8 -0
  39. package/dist/src/extensions/(backend)/api/route.server.mjs.map +1 -0
  40. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs +195 -0
  41. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs.map +1 -0
  42. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs +194 -0
  43. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs.map +1 -0
  44. package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs +7 -0
  45. package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs.map +1 -0
  46. package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs +8 -0
  47. package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs.map +1 -0
  48. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs +7 -0
  49. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs.map +1 -0
  50. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs +8 -0
  51. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs.map +1 -0
  52. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs +71 -0
  53. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs.map +1 -0
  54. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs +70 -0
  55. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs.map +1 -0
  56. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs +17 -0
  57. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs.map +1 -0
  58. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs +16 -0
  59. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs.map +1 -0
  60. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs +7 -0
  61. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs.map +1 -0
  62. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs +8 -0
  63. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs.map +1 -0
  64. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs +15 -0
  65. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs.map +1 -0
  66. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs +15 -0
  67. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs.map +1 -0
  68. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs +6 -0
  69. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs.map +1 -0
  70. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs +6 -0
  71. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs.map +1 -0
  72. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs +6 -0
  73. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs.map +1 -0
  74. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs +6 -0
  75. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs.map +1 -0
  76. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs +6 -0
  77. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs.map +1 -0
  78. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs +6 -0
  79. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs.map +1 -0
  80. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs +7 -0
  81. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs.map +1 -0
  82. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs +8 -0
  83. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs.map +1 -0
  84. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs +7 -0
  85. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs.map +1 -0
  86. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs +8 -0
  87. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs.map +1 -0
  88. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs +7 -0
  89. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs.map +1 -0
  90. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs +8 -0
  91. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs.map +1 -0
  92. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs +7 -0
  93. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs.map +1 -0
  94. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs +8 -0
  95. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs.map +1 -0
  96. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +7 -0
  97. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +1 -0
  98. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +8 -0
  99. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs.map +1 -0
  100. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs +7 -0
  101. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs.map +1 -0
  102. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs +8 -0
  103. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs.map +1 -0
  104. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs +38 -0
  105. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs.map +1 -0
  106. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs +36 -0
  107. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs.map +1 -0
  108. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs +7 -0
  109. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs.map +1 -0
  110. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs +8 -0
  111. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs.map +1 -0
  112. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs +6 -0
  113. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs.map +1 -0
  114. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs +7 -0
  115. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs.map +1 -0
  116. package/dist/src/schemas/apiContracts.cjs +138 -0
  117. package/dist/src/schemas/apiContracts.cjs.map +1 -0
  118. package/dist/{schemas → src/schemas}/apiContracts.d.cts +2 -2
  119. package/dist/{schemas → src/schemas}/apiContracts.d.cts.map +1 -1
  120. package/dist/{schemas → src/schemas}/apiContracts.d.mts +2 -2
  121. package/dist/{schemas → src/schemas}/apiContracts.d.mts.map +1 -1
  122. package/dist/src/schemas/apiContracts.mjs +135 -0
  123. package/dist/src/schemas/apiContracts.mjs.map +1 -0
  124. package/dist/src/schemas/runWorktreeTool.cjs +152 -0
  125. package/dist/src/schemas/runWorktreeTool.cjs.map +1 -0
  126. package/dist/src/schemas/runWorktreeTool.mjs +150 -0
  127. package/dist/src/schemas/runWorktreeTool.mjs.map +1 -0
  128. package/dist/src/services/atomicJson/index.cjs +42 -0
  129. package/dist/src/services/atomicJson/index.cjs.map +1 -0
  130. package/dist/src/services/atomicJson/index.mjs +38 -0
  131. package/dist/src/services/atomicJson/index.mjs.map +1 -0
  132. package/dist/src/services/compositionMirror/index.cjs +119 -0
  133. package/dist/src/services/compositionMirror/index.cjs.map +1 -0
  134. package/dist/src/services/compositionMirror/index.mjs +116 -0
  135. package/dist/src/services/compositionMirror/index.mjs.map +1 -0
  136. package/dist/src/services/errors/index.cjs +29 -0
  137. package/dist/src/services/errors/index.cjs.map +1 -0
  138. package/dist/src/services/errors/index.mjs +27 -0
  139. package/dist/src/services/errors/index.mjs.map +1 -0
  140. package/dist/src/services/extensionService/index.cjs +13 -0
  141. package/dist/src/services/extensionService/index.cjs.map +1 -0
  142. package/dist/{services → src/services}/extensionService/index.d.cts +1 -2
  143. package/dist/src/services/extensionService/index.d.cts.map +1 -0
  144. package/dist/{services → src/services}/extensionService/index.d.mts +1 -2
  145. package/dist/src/services/extensionService/index.d.mts.map +1 -0
  146. package/dist/src/services/extensionService/index.mjs +13 -0
  147. package/dist/src/services/extensionService/index.mjs.map +1 -0
  148. package/dist/src/services/gitCli/index.cjs +144 -0
  149. package/dist/src/services/gitCli/index.cjs.map +1 -0
  150. package/dist/src/services/gitCli/index.mjs +142 -0
  151. package/dist/src/services/gitCli/index.mjs.map +1 -0
  152. package/dist/src/services/gitDependencies/index.cjs +14 -0
  153. package/dist/src/services/gitDependencies/index.cjs.map +1 -0
  154. package/dist/src/services/gitDependencies/index.d.cts +5 -0
  155. package/dist/src/services/gitDependencies/index.d.cts.map +1 -0
  156. package/dist/src/services/gitDependencies/index.d.mts +5 -0
  157. package/dist/src/services/gitDependencies/index.d.mts.map +1 -0
  158. package/dist/src/services/gitDependencies/index.mjs +14 -0
  159. package/dist/src/services/gitDependencies/index.mjs.map +1 -0
  160. package/dist/src/services/paths/index.cjs +35 -0
  161. package/dist/src/services/paths/index.cjs.map +1 -0
  162. package/dist/src/services/paths/index.mjs +30 -0
  163. package/dist/src/services/paths/index.mjs.map +1 -0
  164. package/dist/src/services/repositoryIdentity/index.cjs +71 -0
  165. package/dist/src/services/repositoryIdentity/index.cjs.map +1 -0
  166. package/dist/src/services/repositoryIdentity/index.mjs +65 -0
  167. package/dist/src/services/repositoryIdentity/index.mjs.map +1 -0
  168. package/dist/src/services/runWorktree/index.cjs +145 -0
  169. package/dist/src/services/runWorktree/index.cjs.map +1 -0
  170. package/dist/src/services/runWorktree/index.mjs +142 -0
  171. package/dist/src/services/runWorktree/index.mjs.map +1 -0
  172. package/dist/src/services/worktreeEvents/index.cjs +64 -0
  173. package/dist/src/services/worktreeEvents/index.cjs.map +1 -0
  174. package/dist/{services → src/services}/worktreeEvents/index.d.cts +3 -4
  175. package/dist/src/services/worktreeEvents/index.d.cts.map +1 -0
  176. package/dist/{services → src/services}/worktreeEvents/index.d.mts +3 -4
  177. package/dist/src/services/worktreeEvents/index.d.mts.map +1 -0
  178. package/dist/src/services/worktreeEvents/index.mjs +60 -0
  179. package/dist/src/services/worktreeEvents/index.mjs.map +1 -0
  180. package/dist/src/services/worktreeNaming/index.cjs +99 -0
  181. package/dist/src/services/worktreeNaming/index.cjs.map +1 -0
  182. package/dist/{services → src/services}/worktreeNaming/index.d.cts +2 -3
  183. package/dist/src/services/worktreeNaming/index.d.cts.map +1 -0
  184. package/dist/{services → src/services}/worktreeNaming/index.d.mts +2 -3
  185. package/dist/src/services/worktreeNaming/index.d.mts.map +1 -0
  186. package/dist/src/services/worktreeNaming/index.mjs +94 -0
  187. package/dist/src/services/worktreeNaming/index.mjs.map +1 -0
  188. package/dist/src/services/worktreeOperations/index.cjs +263 -0
  189. package/dist/src/services/worktreeOperations/index.cjs.map +1 -0
  190. package/dist/{services → src/services}/worktreeOperations/index.d.cts +4 -5
  191. package/dist/src/services/worktreeOperations/index.d.cts.map +1 -0
  192. package/dist/{services → src/services}/worktreeOperations/index.d.mts +4 -5
  193. package/dist/src/services/worktreeOperations/index.d.mts.map +1 -0
  194. package/dist/src/services/worktreeOperations/index.mjs +261 -0
  195. package/dist/src/services/worktreeOperations/index.mjs.map +1 -0
  196. package/dist/src/services/worktreeRegistry/index.cjs +38 -0
  197. package/dist/src/services/worktreeRegistry/index.cjs.map +1 -0
  198. package/dist/src/services/worktreeRegistry/index.mjs +38 -0
  199. package/dist/src/services/worktreeRegistry/index.mjs.map +1 -0
  200. package/dist/{types → src/types}/extension.d.cts +4 -5
  201. package/dist/src/types/extension.d.cts.map +1 -0
  202. package/dist/{types → src/types}/extension.d.mts +4 -5
  203. package/dist/src/types/extension.d.mts.map +1 -0
  204. package/dist/src/types/webWorktrees.cjs +20 -0
  205. package/dist/src/types/webWorktrees.cjs.map +1 -0
  206. package/dist/src/types/webWorktrees.mjs +20 -0
  207. package/dist/src/types/webWorktrees.mjs.map +1 -0
  208. package/dist/{types → src/types}/worktreeRegistry.d.cts +3 -4
  209. package/dist/src/types/worktreeRegistry.d.cts.map +1 -0
  210. package/dist/{types → src/types}/worktreeRegistry.d.mts +3 -4
  211. package/dist/src/types/worktreeRegistry.d.mts.map +1 -0
  212. package/package.json +31 -26
  213. package/dist/constants/git.cjs +0 -2
  214. package/dist/constants/git.cjs.map +0 -1
  215. package/dist/constants/git.mjs +0 -2
  216. package/dist/constants/git.mjs.map +0 -1
  217. package/dist/controllers/gitCommand.cjs +0 -2
  218. package/dist/controllers/gitCommand.cjs.map +0 -1
  219. package/dist/controllers/gitCommand.mjs +0 -2
  220. package/dist/controllers/gitCommand.mjs.map +0 -1
  221. package/dist/controllers/gitSession.cjs +0 -2
  222. package/dist/controllers/gitSession.cjs.map +0 -1
  223. package/dist/controllers/gitSession.mjs +0 -2
  224. package/dist/controllers/gitSession.mjs.map +0 -1
  225. package/dist/controllers/hubApi.cjs +0 -2
  226. package/dist/controllers/hubApi.cjs.map +0 -1
  227. package/dist/controllers/hubApi.mjs +0 -2
  228. package/dist/controllers/hubApi.mjs.map +0 -1
  229. package/dist/controllers/worktreesChannel.cjs +0 -2
  230. package/dist/controllers/worktreesChannel.cjs.map +0 -1
  231. package/dist/controllers/worktreesChannel.mjs +0 -2
  232. package/dist/controllers/worktreesChannel.mjs.map +0 -1
  233. package/dist/schemas/apiContracts.cjs +0 -2
  234. package/dist/schemas/apiContracts.cjs.map +0 -1
  235. package/dist/schemas/apiContracts.mjs +0 -2
  236. package/dist/schemas/apiContracts.mjs.map +0 -1
  237. package/dist/schemas/runWorktreeTool.cjs +0 -2
  238. package/dist/schemas/runWorktreeTool.cjs.map +0 -1
  239. package/dist/schemas/runWorktreeTool.mjs +0 -2
  240. package/dist/schemas/runWorktreeTool.mjs.map +0 -1
  241. package/dist/services/atomicJson/index.cjs +0 -2
  242. package/dist/services/atomicJson/index.cjs.map +0 -1
  243. package/dist/services/atomicJson/index.mjs +0 -2
  244. package/dist/services/atomicJson/index.mjs.map +0 -1
  245. package/dist/services/compositionMirror/index.cjs +0 -2
  246. package/dist/services/compositionMirror/index.cjs.map +0 -1
  247. package/dist/services/compositionMirror/index.mjs +0 -2
  248. package/dist/services/compositionMirror/index.mjs.map +0 -1
  249. package/dist/services/errors/index.cjs +0 -2
  250. package/dist/services/errors/index.cjs.map +0 -1
  251. package/dist/services/errors/index.mjs +0 -2
  252. package/dist/services/errors/index.mjs.map +0 -1
  253. package/dist/services/extensionService/index.cjs +0 -2
  254. package/dist/services/extensionService/index.cjs.map +0 -1
  255. package/dist/services/extensionService/index.d.cts.map +0 -1
  256. package/dist/services/extensionService/index.d.mts.map +0 -1
  257. package/dist/services/extensionService/index.mjs +0 -2
  258. package/dist/services/extensionService/index.mjs.map +0 -1
  259. package/dist/services/gitCli/index.cjs +0 -4
  260. package/dist/services/gitCli/index.cjs.map +0 -1
  261. package/dist/services/gitCli/index.mjs +0 -4
  262. package/dist/services/gitCli/index.mjs.map +0 -1
  263. package/dist/services/gitDependencies/index.cjs +0 -2
  264. package/dist/services/gitDependencies/index.cjs.map +0 -1
  265. package/dist/services/gitDependencies/index.d.cts +0 -6
  266. package/dist/services/gitDependencies/index.d.cts.map +0 -1
  267. package/dist/services/gitDependencies/index.d.mts +0 -6
  268. package/dist/services/gitDependencies/index.d.mts.map +0 -1
  269. package/dist/services/gitDependencies/index.mjs +0 -2
  270. package/dist/services/gitDependencies/index.mjs.map +0 -1
  271. package/dist/services/paths/index.cjs +0 -2
  272. package/dist/services/paths/index.cjs.map +0 -1
  273. package/dist/services/paths/index.mjs +0 -2
  274. package/dist/services/paths/index.mjs.map +0 -1
  275. package/dist/services/repositoryIdentity/index.cjs +0 -2
  276. package/dist/services/repositoryIdentity/index.cjs.map +0 -1
  277. package/dist/services/repositoryIdentity/index.mjs +0 -2
  278. package/dist/services/repositoryIdentity/index.mjs.map +0 -1
  279. package/dist/services/runWorktree/index.cjs +0 -15
  280. package/dist/services/runWorktree/index.cjs.map +0 -1
  281. package/dist/services/runWorktree/index.mjs +0 -15
  282. package/dist/services/runWorktree/index.mjs.map +0 -1
  283. package/dist/services/worktreeEvents/index.cjs +0 -2
  284. package/dist/services/worktreeEvents/index.cjs.map +0 -1
  285. package/dist/services/worktreeEvents/index.d.cts.map +0 -1
  286. package/dist/services/worktreeEvents/index.d.mts.map +0 -1
  287. package/dist/services/worktreeEvents/index.mjs +0 -2
  288. package/dist/services/worktreeEvents/index.mjs.map +0 -1
  289. package/dist/services/worktreeNaming/index.cjs +0 -2
  290. package/dist/services/worktreeNaming/index.cjs.map +0 -1
  291. package/dist/services/worktreeNaming/index.d.cts.map +0 -1
  292. package/dist/services/worktreeNaming/index.d.mts.map +0 -1
  293. package/dist/services/worktreeNaming/index.mjs +0 -2
  294. package/dist/services/worktreeNaming/index.mjs.map +0 -1
  295. package/dist/services/worktreeOperations/index.cjs +0 -2
  296. package/dist/services/worktreeOperations/index.cjs.map +0 -1
  297. package/dist/services/worktreeOperations/index.d.cts.map +0 -1
  298. package/dist/services/worktreeOperations/index.d.mts.map +0 -1
  299. package/dist/services/worktreeOperations/index.mjs +0 -2
  300. package/dist/services/worktreeOperations/index.mjs.map +0 -1
  301. package/dist/services/worktreeRegistry/index.cjs +0 -2
  302. package/dist/services/worktreeRegistry/index.cjs.map +0 -1
  303. package/dist/services/worktreeRegistry/index.mjs +0 -2
  304. package/dist/services/worktreeRegistry/index.mjs.map +0 -1
  305. package/dist/tools/runWorktree.cjs +0 -2
  306. package/dist/tools/runWorktree.cjs.map +0 -1
  307. package/dist/tools/runWorktree.mjs +0 -2
  308. package/dist/tools/runWorktree.mjs.map +0 -1
  309. package/dist/types/extension.d.cts.map +0 -1
  310. package/dist/types/extension.d.mts.map +0 -1
  311. package/dist/types/webWorktrees.cjs +0 -2
  312. package/dist/types/webWorktrees.cjs.map +0 -1
  313. package/dist/types/webWorktrees.mjs +0 -2
  314. package/dist/types/webWorktrees.mjs.map +0 -1
  315. package/dist/types/worktreeRegistry.d.cts.map +0 -1
  316. package/dist/types/worktreeRegistry.d.mts.map +0 -1
  317. package/src/extensions/web.ts +0 -33
  318. package/src/types/webWorktrees.ts +0 -55
  319. package/src/types/worktreeRegistry.ts +0 -78
  320. package/src/web/components/RunWorktreeToolMessage.tsx +0 -45
  321. package/src/web/components/WorktreesActivitySection.tsx +0 -80
  322. package/src/web/components/WorktreesPanel.tsx +0 -175
  323. package/src/web/components/toolRenderers.ts +0 -8
  324. package/src/web/stores/worktreesActivityStore.ts +0 -125
  325. package/src/web/tsconfig.json +0 -22
@@ -0,0 +1,135 @@
1
+ import { defineApiContract, jsonApiResponses } from "@agimon-ai/doompi-core/api-contracts";
2
+ import { Type } from "typebox";
3
+ //#region src/schemas/apiContracts.ts
4
+ const S = Type.String();
5
+ const B = Type.Boolean();
6
+ const O = Type.Optional;
7
+ const literals = (values) => Type.Union(values.map((value) => Type.Literal(value)));
8
+ const RecordSchema = Type.Object({
9
+ version: Type.Literal(1),
10
+ id: S,
11
+ branch: S,
12
+ baseRef: S,
13
+ path: S,
14
+ repositoryRoot: S,
15
+ sessionId: S,
16
+ parentSessionId: S,
17
+ status: literals([
18
+ "spawning",
19
+ "running",
20
+ "closing",
21
+ "orphaned"
22
+ ]),
23
+ createdAt: S
24
+ });
25
+ const WorktreesPayloadSchema = Type.Object({
26
+ worktrees: Type.Array(Type.Object({
27
+ id: S,
28
+ branch: S,
29
+ path: S,
30
+ sessionId: Type.Union([S, Type.Null()]),
31
+ orphaned: B,
32
+ unowned: B
33
+ })),
34
+ pending: O(S),
35
+ error: O(S)
36
+ });
37
+ const WorktreesCommandSchema = Type.Union([Type.Object({
38
+ action: Type.Literal("create"),
39
+ branch: S,
40
+ baseRef: O(S)
41
+ }), Type.Object({
42
+ action: Type.Literal("close"),
43
+ id: S,
44
+ force: O(B)
45
+ })]);
46
+ const query = [{
47
+ name: "repositoryId",
48
+ in: "query",
49
+ required: true,
50
+ schema: S
51
+ }, {
52
+ name: "sessionId",
53
+ in: "query",
54
+ required: true,
55
+ schema: S
56
+ }];
57
+ const apiContracts = defineApiContract({
58
+ version: 1,
59
+ dynamic: [],
60
+ http: ["global", "workspace"].flatMap((scope) => [
61
+ {
62
+ id: "git.list",
63
+ scope,
64
+ basePath: "git",
65
+ path: "/worktrees",
66
+ method: "GET",
67
+ authentication: "owner",
68
+ description: "List admitted repository worktrees.",
69
+ parameters: query.map((item) => ({
70
+ ...item,
71
+ required: item.name === "repositoryId"
72
+ })),
73
+ responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(RecordSchema) }))
74
+ },
75
+ {
76
+ id: "git.create",
77
+ scope,
78
+ basePath: "git",
79
+ path: "/worktrees",
80
+ method: "POST",
81
+ authentication: "owner",
82
+ description: "Create a worktree and session.",
83
+ parameters: query,
84
+ body: {
85
+ required: true,
86
+ contentType: "application/json",
87
+ schema: Type.Object({
88
+ branch: Type.String({ minLength: 1 }),
89
+ baseRef: O(S),
90
+ name: O(S)
91
+ })
92
+ },
93
+ responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }), 201)
94
+ },
95
+ {
96
+ id: "git.close",
97
+ scope,
98
+ basePath: "git",
99
+ path: "/worktrees/{id}",
100
+ method: "DELETE",
101
+ authentication: "owner",
102
+ description: "Close a worktree.",
103
+ parameters: [...query, {
104
+ name: "force",
105
+ in: "query",
106
+ required: false,
107
+ schema: B
108
+ }],
109
+ responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }))
110
+ }
111
+ ]),
112
+ sockets: ["global", "workspace"].flatMap((scope) => [{
113
+ id: "git.channel",
114
+ scope,
115
+ service: "doompi.hub.v1",
116
+ member: "git_worktrees",
117
+ kind: "channel",
118
+ direction: "server-to-client",
119
+ description: "Worktree channel payload.",
120
+ input: WorktreesPayloadSchema
121
+ }, {
122
+ id: "git.command",
123
+ scope,
124
+ service: "doompi.hub.v1",
125
+ member: "git_worktrees",
126
+ kind: "channel",
127
+ direction: "client-to-server",
128
+ description: "Worktree channel command payload.",
129
+ input: WorktreesCommandSchema
130
+ }])
131
+ });
132
+ //#endregion
133
+ export { WorktreesCommandSchema, WorktreesPayloadSchema, apiContracts, apiContracts as default };
134
+
135
+ //# sourceMappingURL=apiContracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../../../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/doompi-core/api-contracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst RecordSchema = Type.Object({\n version: Type.Literal(1),\n id: S,\n branch: S,\n baseRef: S,\n path: S,\n repositoryRoot: S,\n sessionId: S,\n parentSessionId: S,\n status: literals(['spawning', 'running', 'closing', 'orphaned']),\n createdAt: S,\n});\nexport const WorktreesPayloadSchema = Type.Object({\n worktrees: Type.Array(\n Type.Object({ id: S, branch: S, path: S, sessionId: Type.Union([S, Type.Null()]), orphaned: B, unowned: B }),\n ),\n pending: O(S),\n error: O(S),\n});\nexport const WorktreesCommandSchema = Type.Union([\n Type.Object({ action: Type.Literal('create'), branch: S, baseRef: O(S) }),\n Type.Object({ action: Type.Literal('close'), id: S, force: O(B) }),\n]);\nconst query = [\n { name: 'repositoryId', in: 'query' as const, required: true, schema: S },\n { name: 'sessionId', in: 'query' as const, required: true, schema: S },\n];\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.list',\n scope,\n basePath: 'git',\n path: '/worktrees',\n method: 'GET',\n authentication: 'owner',\n description: 'List admitted repository worktrees.',\n parameters: query.map((item) => ({ ...item, required: item.name === 'repositoryId' })),\n responses: jsonApiResponses(Type.Object({ worktrees: Type.Array(RecordSchema) })),\n },\n {\n id: 'git.create',\n scope,\n basePath: 'git',\n path: '/worktrees',\n method: 'POST',\n authentication: 'owner',\n description: 'Create a worktree and session.',\n parameters: query,\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ branch: Type.String({ minLength: 1 }), baseRef: O(S), name: O(S) }),\n },\n responses: jsonApiResponses(Type.Object({ worktree: RecordSchema }), 201),\n },\n {\n id: 'git.close',\n scope,\n basePath: 'git',\n path: '/worktrees/{id}',\n method: 'DELETE',\n authentication: 'owner',\n description: 'Close a worktree.',\n parameters: [...query, { name: 'force', in: 'query', required: false, schema: B }],\n responses: jsonApiResponses(Type.Object({ worktree: RecordSchema })),\n },\n ]),\n sockets: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'git.channel',\n scope,\n service: 'doompi.hub.v1',\n member: 'git_worktrees',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Worktree channel payload.',\n input: WorktreesPayloadSchema,\n },\n {\n id: 'git.command',\n scope,\n service: 'doompi.hub.v1',\n member: 'git_worktrees',\n kind: 'channel',\n direction: 'client-to-server',\n description: 'Worktree channel command payload.',\n input: WorktreesCommandSchema,\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK,QAAQ;AACvB,MAAM,IAAI,KAAK;AACf,MAAM,YAA8B,WAAgB,KAAK,MAAM,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;AACzG,MAAM,eAAe,KAAK,OAAO;CAC/B,SAAS,KAAK,QAAQ,CAAC;CACvB,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,MAAM;CACN,gBAAgB;CAChB,WAAW;CACX,iBAAiB;CACjB,QAAQ,SAAS;EAAC;EAAY;EAAW;EAAW;CAAU,CAAC;CAC/D,WAAW;AACb,CAAC;AACD,MAAa,yBAAyB,KAAK,OAAO;CAChD,WAAW,KAAK,MACd,KAAK,OAAO;EAAE,IAAI;EAAG,QAAQ;EAAG,MAAM;EAAG,WAAW,KAAK,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC;EAAG,UAAU;EAAG,SAAS;CAAE,CAAC,CAC7G;CACA,SAAS,EAAE,CAAC;CACZ,OAAO,EAAE,CAAC;AACZ,CAAC;AACD,MAAa,yBAAyB,KAAK,MAAM,CAC/C,KAAK,OAAO;CAAE,QAAQ,KAAK,QAAQ,QAAQ;CAAG,QAAQ;CAAG,SAAS,EAAE,CAAC;AAAE,CAAC,GACxE,KAAK,OAAO;CAAE,QAAQ,KAAK,QAAQ,OAAO;CAAG,IAAI;CAAG,OAAO,EAAE,CAAC;AAAE,CAAC,CACnE,CAAC;AACD,MAAM,QAAQ,CACZ;CAAE,MAAM;CAAgB,IAAI;CAAkB,UAAU;CAAM,QAAQ;AAAE,GACxE;CAAE,MAAM;CAAa,IAAI;CAAkB,UAAU;CAAM,QAAQ;AAAE,CACvE;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
+ let typebox = require("typebox");
2
+ //#region src/schemas/runWorktreeTool.ts
3
+ /**
4
+ * The tool's action vocabulary.
5
+ *
6
+ * One tool with an action field rather than six tools, matching `subagent`:
7
+ * the actions share a subject and are meaningless apart from it, and six
8
+ * separate tools would spend six description budgets teaching the same nouns.
9
+ */
10
+ const WORKTREE_ACTIONS = {
11
+ spawn_worktree: "spawn_worktree",
12
+ close_worktree: "close_worktree",
13
+ list: "list",
14
+ status: "status",
15
+ merge: "merge",
16
+ prune: "prune",
17
+ send: "send",
18
+ messages: "messages"
19
+ };
20
+ /**
21
+ * Which fields each action accepts.
22
+ *
23
+ * Rejecting an unknown field is what stops a plausible-looking call from doing
24
+ * something other than what it reads like: `close_worktree` with `branch`
25
+ * instead of `id` would otherwise close whatever the default resolved to.
26
+ */
27
+ const WORKTREE_ACTION_FIELDS = {
28
+ spawn_worktree: [
29
+ "action",
30
+ "branch",
31
+ "baseRef",
32
+ "task",
33
+ "name"
34
+ ],
35
+ close_worktree: [
36
+ "action",
37
+ "id",
38
+ "force"
39
+ ],
40
+ list: ["action"],
41
+ status: ["action", "id"],
42
+ merge: [
43
+ "action",
44
+ "id",
45
+ "message"
46
+ ],
47
+ prune: ["action", "dryRun"],
48
+ send: [
49
+ "action",
50
+ "id",
51
+ "message"
52
+ ],
53
+ messages: ["action", "id"]
54
+ };
55
+ const SpawnParams = typebox.Type.Object({
56
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.spawn_worktree),
57
+ branch: typebox.Type.String({ minLength: 1 }),
58
+ baseRef: typebox.Type.Optional(typebox.Type.String({ minLength: 1 })),
59
+ task: typebox.Type.Optional(typebox.Type.String({ minLength: 1 })),
60
+ name: typebox.Type.Optional(typebox.Type.String({ minLength: 1 }))
61
+ }, { additionalProperties: false });
62
+ const CloseParams = typebox.Type.Object({
63
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.close_worktree),
64
+ id: typebox.Type.String({ minLength: 1 }),
65
+ force: typebox.Type.Optional(typebox.Type.Boolean())
66
+ }, { additionalProperties: false });
67
+ const ListParams = typebox.Type.Object({ action: typebox.Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });
68
+ const StatusParams = typebox.Type.Object({
69
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.status),
70
+ id: typebox.Type.String({ minLength: 1 })
71
+ }, { additionalProperties: false });
72
+ const MergeParams = typebox.Type.Object({
73
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.merge),
74
+ id: typebox.Type.String({ minLength: 1 }),
75
+ message: typebox.Type.Optional(typebox.Type.String({ minLength: 1 }))
76
+ }, { additionalProperties: false });
77
+ const PruneParams = typebox.Type.Object({
78
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.prune),
79
+ dryRun: typebox.Type.Optional(typebox.Type.Boolean())
80
+ }, { additionalProperties: false });
81
+ const SendParams = typebox.Type.Object({
82
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.send),
83
+ id: typebox.Type.String({ minLength: 1 }),
84
+ message: typebox.Type.String({ minLength: 1 })
85
+ }, { additionalProperties: false });
86
+ const MessagesParams = typebox.Type.Object({
87
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.messages),
88
+ id: typebox.Type.String({ minLength: 1 })
89
+ }, { additionalProperties: false });
90
+ typebox.Type.Union([
91
+ SpawnParams,
92
+ CloseParams,
93
+ ListParams,
94
+ StatusParams,
95
+ MergeParams,
96
+ PruneParams,
97
+ SendParams,
98
+ MessagesParams
99
+ ]);
100
+ /** The actions that accept `field`, so the declared docs cannot drift from the validator. */
101
+ function acceptingActions(field) {
102
+ return Object.values(WORKTREE_ACTIONS).filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field)).join(", ");
103
+ }
104
+ /**
105
+ * The schema declared to the model.
106
+ *
107
+ * A flat object rather than `RunWorktreeParams` itself. A top-level union is
108
+ * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter
109
+ * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},
110
+ * required: schema.required ?? []}`, so the union arrived at the model as an
111
+ * empty object while the host went on validating calls against it. Nothing here
112
+ * relaxes what is accepted: `validateParams` still rejects an unknown action, a
113
+ * field the action does not take, and a missing required one.
114
+ */
115
+ const RunWorktreeToolSchema = typebox.Type.Object({
116
+ action: typebox.Type.String({
117
+ enum: Object.values(WORKTREE_ACTIONS),
118
+ description: "The operation to run. Every other field is accepted only by the actions its description names."
119
+ }),
120
+ branch: typebox.Type.Optional(typebox.Type.String({
121
+ minLength: 1,
122
+ description: `New branch to create. Actions: ${acceptingActions("branch")}.`
123
+ })),
124
+ baseRef: typebox.Type.Optional(typebox.Type.String({
125
+ minLength: 1,
126
+ description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions("baseRef")}.`
127
+ })),
128
+ task: typebox.Type.Optional(typebox.Type.String({
129
+ minLength: 1,
130
+ description: `First message for the new session. Actions: ${acceptingActions("task")}.`
131
+ })),
132
+ name: typebox.Type.Optional(typebox.Type.String({
133
+ minLength: 1,
134
+ description: `Rail label for the worktree. Actions: ${acceptingActions("name")}.`
135
+ })),
136
+ id: typebox.Type.Optional(typebox.Type.String({
137
+ minLength: 1,
138
+ description: `Worktree id. Actions: ${acceptingActions("id")}.`
139
+ })),
140
+ force: typebox.Type.Optional(typebox.Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions("force")}.` })),
141
+ message: typebox.Type.Optional(typebox.Type.String({
142
+ minLength: 1,
143
+ description: `Merge commit message, or the text to send. Actions: ${acceptingActions("message")}.`
144
+ })),
145
+ dryRun: typebox.Type.Optional(typebox.Type.Boolean({ description: `Report the plan without destroying anything. Actions: ${acceptingActions("dryRun")}.` }))
146
+ }, { additionalProperties: false });
147
+ //#endregion
148
+ exports.RunWorktreeToolSchema = RunWorktreeToolSchema;
149
+ exports.WORKTREE_ACTIONS = WORKTREE_ACTIONS;
150
+ exports.WORKTREE_ACTION_FIELDS = WORKTREE_ACTION_FIELDS;
151
+
152
+ //# sourceMappingURL=runWorktreeTool.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWorktreeTool.cjs","names":["Type"],"sources":["../../../src/schemas/runWorktreeTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\n/**\n * The tool's action vocabulary.\n *\n * One tool with an action field rather than six tools, matching `subagent`:\n * the actions share a subject and are meaningless apart from it, and six\n * separate tools would spend six description budgets teaching the same nouns.\n */\nexport const WORKTREE_ACTIONS = {\n spawn_worktree: 'spawn_worktree',\n close_worktree: 'close_worktree',\n list: 'list',\n status: 'status',\n merge: 'merge',\n prune: 'prune',\n send: 'send',\n messages: 'messages',\n} as const;\n\nexport type WorktreeAction = (typeof WORKTREE_ACTIONS)[keyof typeof WORKTREE_ACTIONS];\n\n/**\n * Which fields each action accepts.\n *\n * Rejecting an unknown field is what stops a plausible-looking call from doing\n * something other than what it reads like: `close_worktree` with `branch`\n * instead of `id` would otherwise close whatever the default resolved to.\n */\nexport const WORKTREE_ACTION_FIELDS: Record<WorktreeAction, readonly string[]> = {\n spawn_worktree: ['action', 'branch', 'baseRef', 'task', 'name'],\n close_worktree: ['action', 'id', 'force'],\n list: ['action'],\n status: ['action', 'id'],\n merge: ['action', 'id', 'message'],\n prune: ['action', 'dryRun'],\n send: ['action', 'id', 'message'],\n messages: ['action', 'id'],\n};\n\nconst SpawnParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),\n branch: Type.String({ minLength: 1 }),\n baseRef: Type.Optional(Type.String({ minLength: 1 })),\n task: Type.Optional(Type.String({ minLength: 1 })),\n name: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst CloseParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.close_worktree),\n id: Type.String({ minLength: 1 }),\n force: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\n\nconst ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });\n\nconst StatusParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.status), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nconst MergeParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.merge),\n id: Type.String({ minLength: 1 }),\n message: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst PruneParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.prune), dryRun: Type.Optional(Type.Boolean()) },\n { additionalProperties: false },\n);\n\nconst SendParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.send),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst MessagesParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.messages), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const RunWorktreeParams = Type.Union([\n SpawnParams,\n CloseParams,\n ListParams,\n StatusParams,\n MergeParams,\n PruneParams,\n SendParams,\n MessagesParams,\n]);\n\n/** The actions that accept `field`, so the declared docs cannot drift from the validator. */\nfunction acceptingActions(field: string): string {\n return Object.values(WORKTREE_ACTIONS)\n .filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field))\n .join(', ');\n}\n\n/**\n * The schema declared to the model.\n *\n * A flat object rather than `RunWorktreeParams` itself. A top-level union is\n * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter\n * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},\n * required: schema.required ?? []}`, so the union arrived at the model as an\n * empty object while the host went on validating calls against it. Nothing here\n * relaxes what is accepted: `validateParams` still rejects an unknown action, a\n * field the action does not take, and a missing required one.\n */\nexport const RunWorktreeToolSchema = Type.Object(\n {\n action: Type.String({\n enum: Object.values(WORKTREE_ACTIONS),\n description: 'The operation to run. Every other field is accepted only by the actions its description names.',\n }),\n branch: Type.Optional(\n Type.String({ minLength: 1, description: `New branch to create. Actions: ${acceptingActions('branch')}.` }),\n ),\n baseRef: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions('baseRef')}.`,\n }),\n ),\n task: Type.Optional(\n Type.String({\n minLength: 1,\n description: `First message for the new session. Actions: ${acceptingActions('task')}.`,\n }),\n ),\n name: Type.Optional(\n Type.String({ minLength: 1, description: `Rail label for the worktree. Actions: ${acceptingActions('name')}.` }),\n ),\n id: Type.Optional(Type.String({ minLength: 1, description: `Worktree id. Actions: ${acceptingActions('id')}.` })),\n force: Type.Optional(\n Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions('force')}.` }),\n ),\n message: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Merge commit message, or the text to send. Actions: ${acceptingActions('message')}.`,\n }),\n ),\n dryRun: Type.Optional(\n Type.Boolean({\n description: `Report the plan without destroying anything. Actions: ${acceptingActions('dryRun')}.`,\n }),\n ),\n },\n { additionalProperties: false },\n);\n\nexport type RunWorktreeToolParams = Static<typeof RunWorktreeParams>;\n"],"mappings":";;;;;;;;;AASA,MAAa,mBAAmB;CAC9B,gBAAgB;CAChB,gBAAgB;CAChB,MAAM;CACN,QAAQ;CACR,OAAO;CACP,OAAO;CACP,MAAM;CACN,UAAU;AACZ;;;;;;;;AAWA,MAAa,yBAAoE;CAC/E,gBAAgB;EAAC;EAAU;EAAU;EAAW;EAAQ;CAAM;CAC9D,gBAAgB;EAAC;EAAU;EAAM;CAAO;CACxC,MAAM,CAAC,QAAQ;CACf,QAAQ,CAAC,UAAU,IAAI;CACvB,OAAO;EAAC;EAAU;EAAM;CAAS;CACjC,OAAO,CAAC,UAAU,QAAQ;CAC1B,MAAM;EAAC;EAAU;EAAM;CAAS;CAChC,UAAU,CAAC,UAAU,IAAI;AAC3B;AAEA,MAAM,cAAcA,QAAAA,KAAK,OACvB;CACE,QAAQA,QAAAA,KAAK,QAAQ,iBAAiB,cAAc;CACpD,QAAQA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;CACpC,S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K,OAAO;EAAE,WAAW;EAAG,aAAa,yCAAyC,iBAAiB,MAAM,EAAE;CAAG,CAAC,CACjH;CACA,IAAIA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO;EAAE,WAAW;EAAG,aAAa,yBAAyB,iBAAiB,IAAI,EAAE;CAAG,CAAC,CAAC;CAChH,OAAOA,QAAAA,KAAK,SACVA,QAAAA,KAAK,QAAQ,EAAE,aAAa,+CAA+C,iBAAiB,OAAO,EAAE,GAAG,CAAC,CAC3G;CACA,SAASA,QAAAA,KAAK,SACZA,QAAAA,KAAK,OAAO;EACV,WAAW;EACX,aAAa,uDAAuD,iBAAiB,SAAS,EAAE;CAClG,CAAC,CACH;CACA,QAAQA,QAAAA,KAAK,SACXA,QAAAA,KAAK,QAAQ,EACX,aAAa,yDAAyD,iBAAiB,QAAQ,EAAE,GACnG,CAAC,CACH;AACF,GACA,EAAE,sBAAsB,MAAM,CAChC"}
@@ -0,0 +1,150 @@
1
+ import { Type } from "typebox";
2
+ //#region src/schemas/runWorktreeTool.ts
3
+ /**
4
+ * The tool's action vocabulary.
5
+ *
6
+ * One tool with an action field rather than six tools, matching `subagent`:
7
+ * the actions share a subject and are meaningless apart from it, and six
8
+ * separate tools would spend six description budgets teaching the same nouns.
9
+ */
10
+ const WORKTREE_ACTIONS = {
11
+ spawn_worktree: "spawn_worktree",
12
+ close_worktree: "close_worktree",
13
+ list: "list",
14
+ status: "status",
15
+ merge: "merge",
16
+ prune: "prune",
17
+ send: "send",
18
+ messages: "messages"
19
+ };
20
+ /**
21
+ * Which fields each action accepts.
22
+ *
23
+ * Rejecting an unknown field is what stops a plausible-looking call from doing
24
+ * something other than what it reads like: `close_worktree` with `branch`
25
+ * instead of `id` would otherwise close whatever the default resolved to.
26
+ */
27
+ const WORKTREE_ACTION_FIELDS = {
28
+ spawn_worktree: [
29
+ "action",
30
+ "branch",
31
+ "baseRef",
32
+ "task",
33
+ "name"
34
+ ],
35
+ close_worktree: [
36
+ "action",
37
+ "id",
38
+ "force"
39
+ ],
40
+ list: ["action"],
41
+ status: ["action", "id"],
42
+ merge: [
43
+ "action",
44
+ "id",
45
+ "message"
46
+ ],
47
+ prune: ["action", "dryRun"],
48
+ send: [
49
+ "action",
50
+ "id",
51
+ "message"
52
+ ],
53
+ messages: ["action", "id"]
54
+ };
55
+ const SpawnParams = Type.Object({
56
+ action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),
57
+ branch: Type.String({ minLength: 1 }),
58
+ baseRef: Type.Optional(Type.String({ minLength: 1 })),
59
+ task: Type.Optional(Type.String({ minLength: 1 })),
60
+ name: Type.Optional(Type.String({ minLength: 1 }))
61
+ }, { additionalProperties: false });
62
+ const CloseParams = Type.Object({
63
+ action: Type.Literal(WORKTREE_ACTIONS.close_worktree),
64
+ id: Type.String({ minLength: 1 }),
65
+ force: Type.Optional(Type.Boolean())
66
+ }, { additionalProperties: false });
67
+ const ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });
68
+ const StatusParams = Type.Object({
69
+ action: Type.Literal(WORKTREE_ACTIONS.status),
70
+ id: Type.String({ minLength: 1 })
71
+ }, { additionalProperties: false });
72
+ const MergeParams = Type.Object({
73
+ action: Type.Literal(WORKTREE_ACTIONS.merge),
74
+ id: Type.String({ minLength: 1 }),
75
+ message: Type.Optional(Type.String({ minLength: 1 }))
76
+ }, { additionalProperties: false });
77
+ const PruneParams = Type.Object({
78
+ action: Type.Literal(WORKTREE_ACTIONS.prune),
79
+ dryRun: Type.Optional(Type.Boolean())
80
+ }, { additionalProperties: false });
81
+ const SendParams = Type.Object({
82
+ action: Type.Literal(WORKTREE_ACTIONS.send),
83
+ id: Type.String({ minLength: 1 }),
84
+ message: Type.String({ minLength: 1 })
85
+ }, { additionalProperties: false });
86
+ const MessagesParams = Type.Object({
87
+ action: Type.Literal(WORKTREE_ACTIONS.messages),
88
+ id: Type.String({ minLength: 1 })
89
+ }, { additionalProperties: false });
90
+ Type.Union([
91
+ SpawnParams,
92
+ CloseParams,
93
+ ListParams,
94
+ StatusParams,
95
+ MergeParams,
96
+ PruneParams,
97
+ SendParams,
98
+ MessagesParams
99
+ ]);
100
+ /** The actions that accept `field`, so the declared docs cannot drift from the validator. */
101
+ function acceptingActions(field) {
102
+ return Object.values(WORKTREE_ACTIONS).filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field)).join(", ");
103
+ }
104
+ /**
105
+ * The schema declared to the model.
106
+ *
107
+ * A flat object rather than `RunWorktreeParams` itself. A top-level union is
108
+ * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter
109
+ * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},
110
+ * required: schema.required ?? []}`, so the union arrived at the model as an
111
+ * empty object while the host went on validating calls against it. Nothing here
112
+ * relaxes what is accepted: `validateParams` still rejects an unknown action, a
113
+ * field the action does not take, and a missing required one.
114
+ */
115
+ const RunWorktreeToolSchema = Type.Object({
116
+ action: Type.String({
117
+ enum: Object.values(WORKTREE_ACTIONS),
118
+ description: "The operation to run. Every other field is accepted only by the actions its description names."
119
+ }),
120
+ branch: Type.Optional(Type.String({
121
+ minLength: 1,
122
+ description: `New branch to create. Actions: ${acceptingActions("branch")}.`
123
+ })),
124
+ baseRef: Type.Optional(Type.String({
125
+ minLength: 1,
126
+ description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions("baseRef")}.`
127
+ })),
128
+ task: Type.Optional(Type.String({
129
+ minLength: 1,
130
+ description: `First message for the new session. Actions: ${acceptingActions("task")}.`
131
+ })),
132
+ name: Type.Optional(Type.String({
133
+ minLength: 1,
134
+ description: `Rail label for the worktree. Actions: ${acceptingActions("name")}.`
135
+ })),
136
+ id: Type.Optional(Type.String({
137
+ minLength: 1,
138
+ description: `Worktree id. Actions: ${acceptingActions("id")}.`
139
+ })),
140
+ force: Type.Optional(Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions("force")}.` })),
141
+ message: Type.Optional(Type.String({
142
+ minLength: 1,
143
+ description: `Merge commit message, or the text to send. Actions: ${acceptingActions("message")}.`
144
+ })),
145
+ dryRun: Type.Optional(Type.Boolean({ description: `Report the plan without destroying anything. Actions: ${acceptingActions("dryRun")}.` }))
146
+ }, { additionalProperties: false });
147
+ //#endregion
148
+ export { RunWorktreeToolSchema, WORKTREE_ACTIONS, WORKTREE_ACTION_FIELDS };
149
+
150
+ //# sourceMappingURL=runWorktreeTool.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWorktreeTool.mjs","names":[],"sources":["../../../src/schemas/runWorktreeTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\n/**\n * The tool's action vocabulary.\n *\n * One tool with an action field rather than six tools, matching `subagent`:\n * the actions share a subject and are meaningless apart from it, and six\n * separate tools would spend six description budgets teaching the same nouns.\n */\nexport const WORKTREE_ACTIONS = {\n spawn_worktree: 'spawn_worktree',\n close_worktree: 'close_worktree',\n list: 'list',\n status: 'status',\n merge: 'merge',\n prune: 'prune',\n send: 'send',\n messages: 'messages',\n} as const;\n\nexport type WorktreeAction = (typeof WORKTREE_ACTIONS)[keyof typeof WORKTREE_ACTIONS];\n\n/**\n * Which fields each action accepts.\n *\n * Rejecting an unknown field is what stops a plausible-looking call from doing\n * something other than what it reads like: `close_worktree` with `branch`\n * instead of `id` would otherwise close whatever the default resolved to.\n */\nexport const WORKTREE_ACTION_FIELDS: Record<WorktreeAction, readonly string[]> = {\n spawn_worktree: ['action', 'branch', 'baseRef', 'task', 'name'],\n close_worktree: ['action', 'id', 'force'],\n list: ['action'],\n status: ['action', 'id'],\n merge: ['action', 'id', 'message'],\n prune: ['action', 'dryRun'],\n send: ['action', 'id', 'message'],\n messages: ['action', 'id'],\n};\n\nconst SpawnParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),\n branch: Type.String({ minLength: 1 }),\n baseRef: Type.Optional(Type.String({ minLength: 1 })),\n task: Type.Optional(Type.String({ minLength: 1 })),\n name: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst CloseParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.close_worktree),\n id: Type.String({ minLength: 1 }),\n force: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\n\nconst ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });\n\nconst StatusParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.status), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nconst MergeParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.merge),\n id: Type.String({ minLength: 1 }),\n message: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst PruneParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.prune), dryRun: Type.Optional(Type.Boolean()) },\n { additionalProperties: false },\n);\n\nconst SendParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.send),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst MessagesParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.messages), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const RunWorktreeParams = Type.Union([\n SpawnParams,\n CloseParams,\n ListParams,\n StatusParams,\n MergeParams,\n PruneParams,\n SendParams,\n MessagesParams,\n]);\n\n/** The actions that accept `field`, so the declared docs cannot drift from the validator. */\nfunction acceptingActions(field: string): string {\n return Object.values(WORKTREE_ACTIONS)\n .filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field))\n .join(', ');\n}\n\n/**\n * The schema declared to the model.\n *\n * A flat object rather than `RunWorktreeParams` itself. A top-level union is\n * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter\n * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},\n * required: schema.required ?? []}`, so the union arrived at the model as an\n * empty object while the host went on validating calls against it. Nothing here\n * relaxes what is accepted: `validateParams` still rejects an unknown action, a\n * field the action does not take, and a missing required one.\n */\nexport const RunWorktreeToolSchema = Type.Object(\n {\n action: Type.String({\n enum: Object.values(WORKTREE_ACTIONS),\n description: 'The operation to run. Every other field is accepted only by the actions its description names.',\n }),\n branch: Type.Optional(\n Type.String({ minLength: 1, description: `New branch to create. Actions: ${acceptingActions('branch')}.` }),\n ),\n baseRef: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions('baseRef')}.`,\n }),\n ),\n task: Type.Optional(\n Type.String({\n minLength: 1,\n description: `First message for the new session. Actions: ${acceptingActions('task')}.`,\n }),\n ),\n name: Type.Optional(\n Type.String({ minLength: 1, description: `Rail label for the worktree. Actions: ${acceptingActions('name')}.` }),\n ),\n id: Type.Optional(Type.String({ minLength: 1, description: `Worktree id. Actions: ${acceptingActions('id')}.` })),\n force: Type.Optional(\n Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions('force')}.` }),\n ),\n message: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Merge commit message, or the text to send. Actions: ${acceptingActions('message')}.`,\n }),\n ),\n dryRun: Type.Optional(\n Type.Boolean({\n description: `Report the plan without destroying anything. Actions: ${acceptingActions('dryRun')}.`,\n }),\n ),\n },\n { additionalProperties: false },\n);\n\nexport type RunWorktreeToolParams = Static<typeof RunWorktreeParams>;\n"],"mappings":";;;;;;;;;AASA,MAAa,mBAAmB;CAC9B,gBAAgB;CAChB,gBAAgB;CAChB,MAAM;CACN,QAAQ;CACR,OAAO;CACP,OAAO;CACP,MAAM;CACN,UAAU;AACZ;;;;;;;;AAWA,MAAa,yBAAoE;CAC/E,gBAAgB;EAAC;EAAU;EAAU;EAAW;EAAQ;CAAM;CAC9D,gBAAgB;EAAC;EAAU;EAAM;CAAO;CACxC,MAAM,CAAC,QAAQ;CACf,QAAQ,CAAC,UAAU,IAAI;CACvB,OAAO;EAAC;EAAU;EAAM;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AS,KAAK,OAAO;EAAE,WAAW;EAAG,aAAa,yBAAyB,iBAAiB,IAAI,EAAE;CAAG,CAAC,CAAC;CAChH,OAAO,KAAK,SACV,KAAK,QAAQ,EAAE,aAAa,+CAA+C,iBAAiB,OAAO,EAAE,GAAG,CAAC,CAC3G;CACA,SAAS,KAAK,SACZ,KAAK,OAAO;EACV,WAAW;EACX,aAAa,uDAAuD,iBAAiB,SAAS,EAAE;CAClG,CAAC,CACH;CACA,QAAQ,KAAK,SACX,KAAK,QAAQ,EACX,aAAa,yDAAyD,iBAAiB,QAAQ,EAAE,GACnG,CAAC,CACH;AACF,GACA,EAAE,sBAAsB,MAAM,CAChC"}
@@ -0,0 +1,42 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ let node_fs = require("node:fs");
3
+ node_fs = require_runtime.__toESM(node_fs, 1);
4
+ let node_path = require("node:path");
5
+ node_path = require_runtime.__toESM(node_path, 1);
6
+ //#region src/services/atomicJson/index.ts
7
+ const OWNER_ONLY_FILE = 384;
8
+ /**
9
+ * Writes JSON so a reader never sees a half-written file.
10
+ *
11
+ * The registry is read by the same process that writes it, and by a later
12
+ * process after a crash. A plain write can be interrupted between the truncate
13
+ * and the last byte, which leaves a file that parses as nothing and loses every
14
+ * record in it. Writing beside the target and renaming makes the swap atomic on
15
+ * the same filesystem, so a reader sees either the old file or the new one.
16
+ */
17
+ function writeJsonAtomic(file, value) {
18
+ const directory = node_path.default.dirname(file);
19
+ node_fs.default.mkdirSync(directory, { recursive: true });
20
+ const temporary = node_path.default.join(directory, `.${node_path.default.basename(file)}.${String(process.pid)}.tmp`);
21
+ node_fs.default.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: OWNER_ONLY_FILE });
22
+ node_fs.default.renameSync(temporary, file);
23
+ }
24
+ /**
25
+ * Reads JSON, treating every failure as absent.
26
+ *
27
+ * A missing file and an unparseable one mean the same thing to every caller
28
+ * here: there is nothing to act on. Distinguishing them would only offer a
29
+ * choice no caller wants to make.
30
+ */
31
+ function readJson(file) {
32
+ try {
33
+ return JSON.parse(node_fs.default.readFileSync(file, "utf8"));
34
+ } catch {
35
+ return;
36
+ }
37
+ }
38
+ //#endregion
39
+ exports.readJson = readJson;
40
+ exports.writeJsonAtomic = writeJsonAtomic;
41
+
42
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["path","fs"],"sources":["../../../../src/services/atomicJson/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nconst OWNER_ONLY_FILE = 0o600;\n\n/**\n * Writes JSON so a reader never sees a half-written file.\n *\n * The registry is read by the same process that writes it, and by a later\n * process after a crash. A plain write can be interrupted between the truncate\n * and the last byte, which leaves a file that parses as nothing and loses every\n * record in it. Writing beside the target and renaming makes the swap atomic on\n * the same filesystem, so a reader sees either the old file or the new one.\n */\nexport function writeJsonAtomic(file: string, value: unknown): void {\n const directory = path.dirname(file);\n fs.mkdirSync(directory, { recursive: true });\n const temporary = path.join(directory, `.${path.basename(file)}.${String(process.pid)}.tmp`);\n fs.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\\n`, { mode: OWNER_ONLY_FILE });\n fs.renameSync(temporary, file);\n}\n\n/**\n * Reads JSON, treating every failure as absent.\n *\n * A missing file and an unparseable one mean the same thing to every caller\n * here: there is nothing to act on. Distinguishing them would only offer a\n * choice no caller wants to make.\n */\nexport function readJson<T>(file: string): T | undefined {\n try {\n return JSON.parse(fs.readFileSync(file, 'utf8')) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;AAGA,MAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,gBAAgB,MAAc,OAAsB;CAClE,MAAM,YAAYA,UAAAA,QAAK,QAAQ,IAAI;CACnC,QAAA,QAAG,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;CAC3C,MAAM,YAAYA,UAAAA,QAAK,KAAK,WAAW,IAAIA,UAAAA,QAAK,SAAS,IAAI,EAAE,GAAG,OAAO,QAAQ,GAAG,EAAE,KAAK;CAC3F,QAAA,QAAG,cAAc,WAAW,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;CAC5F,QAAA,QAAG,WAAW,WAAW,IAAI;AAC/B;;;;;;;;AASA,SAAgB,SAAY,MAA6B;CACvD,IAAI;EACF,OAAO,KAAK,MAAMC,QAAAA,QAAG,aAAa,MAAM,MAAM,CAAC;CACjD,QAAQ;EACN;CACF;AACF"}
@@ -0,0 +1,38 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ //#region src/services/atomicJson/index.ts
4
+ const OWNER_ONLY_FILE = 384;
5
+ /**
6
+ * Writes JSON so a reader never sees a half-written file.
7
+ *
8
+ * The registry is read by the same process that writes it, and by a later
9
+ * process after a crash. A plain write can be interrupted between the truncate
10
+ * and the last byte, which leaves a file that parses as nothing and loses every
11
+ * record in it. Writing beside the target and renaming makes the swap atomic on
12
+ * the same filesystem, so a reader sees either the old file or the new one.
13
+ */
14
+ function writeJsonAtomic(file, value) {
15
+ const directory = path.dirname(file);
16
+ fs.mkdirSync(directory, { recursive: true });
17
+ const temporary = path.join(directory, `.${path.basename(file)}.${String(process.pid)}.tmp`);
18
+ fs.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: OWNER_ONLY_FILE });
19
+ fs.renameSync(temporary, file);
20
+ }
21
+ /**
22
+ * Reads JSON, treating every failure as absent.
23
+ *
24
+ * A missing file and an unparseable one mean the same thing to every caller
25
+ * here: there is nothing to act on. Distinguishing them would only offer a
26
+ * choice no caller wants to make.
27
+ */
28
+ function readJson(file) {
29
+ try {
30
+ return JSON.parse(fs.readFileSync(file, "utf8"));
31
+ } catch {
32
+ return;
33
+ }
34
+ }
35
+ //#endregion
36
+ export { readJson, writeJsonAtomic };
37
+
38
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/atomicJson/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nconst OWNER_ONLY_FILE = 0o600;\n\n/**\n * Writes JSON so a reader never sees a half-written file.\n *\n * The registry is read by the same process that writes it, and by a later\n * process after a crash. A plain write can be interrupted between the truncate\n * and the last byte, which leaves a file that parses as nothing and loses every\n * record in it. Writing beside the target and renaming makes the swap atomic on\n * the same filesystem, so a reader sees either the old file or the new one.\n */\nexport function writeJsonAtomic(file: string, value: unknown): void {\n const directory = path.dirname(file);\n fs.mkdirSync(directory, { recursive: true });\n const temporary = path.join(directory, `.${path.basename(file)}.${String(process.pid)}.tmp`);\n fs.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\\n`, { mode: OWNER_ONLY_FILE });\n fs.renameSync(temporary, file);\n}\n\n/**\n * Reads JSON, treating every failure as absent.\n *\n * A missing file and an unparseable one mean the same thing to every caller\n * here: there is nothing to act on. Distinguishing them would only offer a\n * choice no caller wants to make.\n */\nexport function readJson<T>(file: string): T | undefined {\n try {\n return JSON.parse(fs.readFileSync(file, 'utf8')) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;AAGA,MAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,gBAAgB,MAAc,OAAsB;CAClE,MAAM,YAAY,KAAK,QAAQ,IAAI;CACnC,GAAG,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;CAC3C,MAAM,YAAY,KAAK,KAAK,WAAW,IAAI,KAAK,SAAS,IAAI,EAAE,GAAG,OAAO,QAAQ,GAAG,EAAE,KAAK;CAC3F,GAAG,cAAc,WAAW,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;CAC5F,GAAG,WAAW,WAAW,IAAI;AAC/B;;;;;;;;AASA,SAAgB,SAAY,MAA6B;CACvD,IAAI;EACF,OAAO,KAAK,MAAM,GAAG,aAAa,MAAM,MAAM,CAAC;CACjD,QAAQ;EACN;CACF;AACF"}