@pocketcoder/host 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (839) hide show
  1. package/LICENSE +53 -0
  2. package/README.md +1106 -0
  3. package/dist/__tests__/daemon-startup.test.d.ts +2 -0
  4. package/dist/__tests__/daemon-startup.test.d.ts.map +1 -0
  5. package/dist/__tests__/daemon-startup.test.js +339 -0
  6. package/dist/__tests__/daemon-startup.test.js.map +1 -0
  7. package/dist/__tests__/env.test.d.ts +2 -0
  8. package/dist/__tests__/env.test.d.ts.map +1 -0
  9. package/dist/__tests__/env.test.js +44 -0
  10. package/dist/__tests__/env.test.js.map +1 -0
  11. package/dist/auth/__tests__/gateway-auth.test.d.ts +2 -0
  12. package/dist/auth/__tests__/gateway-auth.test.d.ts.map +1 -0
  13. package/dist/auth/__tests__/gateway-auth.test.js +208 -0
  14. package/dist/auth/__tests__/gateway-auth.test.js.map +1 -0
  15. package/dist/auth/__tests__/login-manager.test.d.ts +2 -0
  16. package/dist/auth/__tests__/login-manager.test.d.ts.map +1 -0
  17. package/dist/auth/__tests__/login-manager.test.js +160 -0
  18. package/dist/auth/__tests__/login-manager.test.js.map +1 -0
  19. package/dist/auth/__tests__/login.test.d.ts +2 -0
  20. package/dist/auth/__tests__/login.test.d.ts.map +1 -0
  21. package/dist/auth/__tests__/login.test.js +165 -0
  22. package/dist/auth/__tests__/login.test.js.map +1 -0
  23. package/dist/auth/__tests__/manual-flow.test.d.ts +2 -0
  24. package/dist/auth/__tests__/manual-flow.test.d.ts.map +1 -0
  25. package/dist/auth/__tests__/manual-flow.test.js +72 -0
  26. package/dist/auth/__tests__/manual-flow.test.js.map +1 -0
  27. package/dist/auth/__tests__/oauth-server.test.d.ts +2 -0
  28. package/dist/auth/__tests__/oauth-server.test.d.ts.map +1 -0
  29. package/dist/auth/__tests__/oauth-server.test.js +104 -0
  30. package/dist/auth/__tests__/oauth-server.test.js.map +1 -0
  31. package/dist/auth/__tests__/token-refresh.test.d.ts +2 -0
  32. package/dist/auth/__tests__/token-refresh.test.d.ts.map +1 -0
  33. package/dist/auth/__tests__/token-refresh.test.js +205 -0
  34. package/dist/auth/__tests__/token-refresh.test.js.map +1 -0
  35. package/dist/auth/__tests__/token-storage.test.d.ts +2 -0
  36. package/dist/auth/__tests__/token-storage.test.d.ts.map +1 -0
  37. package/dist/auth/__tests__/token-storage.test.js +145 -0
  38. package/dist/auth/__tests__/token-storage.test.js.map +1 -0
  39. package/dist/auth/gateway-auth.d.ts +38 -0
  40. package/dist/auth/gateway-auth.d.ts.map +1 -0
  41. package/dist/auth/gateway-auth.js +117 -0
  42. package/dist/auth/gateway-auth.js.map +1 -0
  43. package/dist/auth/login.d.ts +43 -0
  44. package/dist/auth/login.d.ts.map +1 -0
  45. package/dist/auth/login.js +180 -0
  46. package/dist/auth/login.js.map +1 -0
  47. package/dist/auth/manual-flow.d.ts +16 -0
  48. package/dist/auth/manual-flow.d.ts.map +1 -0
  49. package/dist/auth/manual-flow.js +44 -0
  50. package/dist/auth/manual-flow.js.map +1 -0
  51. package/dist/auth/oauth-server.d.ts +22 -0
  52. package/dist/auth/oauth-server.d.ts.map +1 -0
  53. package/dist/auth/oauth-server.js +165 -0
  54. package/dist/auth/oauth-server.js.map +1 -0
  55. package/dist/auth/token-refresh.d.ts +36 -0
  56. package/dist/auth/token-refresh.d.ts.map +1 -0
  57. package/dist/auth/token-refresh.js +116 -0
  58. package/dist/auth/token-refresh.js.map +1 -0
  59. package/dist/auth/token-storage.d.ts +20 -0
  60. package/dist/auth/token-storage.d.ts.map +1 -0
  61. package/dist/auth/token-storage.js +71 -0
  62. package/dist/auth/token-storage.js.map +1 -0
  63. package/dist/auth/types.d.ts +12 -0
  64. package/dist/auth/types.d.ts.map +1 -0
  65. package/dist/auth/types.js +2 -0
  66. package/dist/auth/types.js.map +1 -0
  67. package/dist/cli/commands/__tests__/cli-auth.test.d.ts +2 -0
  68. package/dist/cli/commands/__tests__/cli-auth.test.d.ts.map +1 -0
  69. package/dist/cli/commands/__tests__/cli-auth.test.js +135 -0
  70. package/dist/cli/commands/__tests__/cli-auth.test.js.map +1 -0
  71. package/dist/cli/commands/__tests__/cli-autostart.test.d.ts +2 -0
  72. package/dist/cli/commands/__tests__/cli-autostart.test.d.ts.map +1 -0
  73. package/dist/cli/commands/__tests__/cli-autostart.test.js +95 -0
  74. package/dist/cli/commands/__tests__/cli-autostart.test.js.map +1 -0
  75. package/dist/cli/commands/__tests__/cli-daemon.test.d.ts +2 -0
  76. package/dist/cli/commands/__tests__/cli-daemon.test.d.ts.map +1 -0
  77. package/dist/cli/commands/__tests__/cli-daemon.test.js +144 -0
  78. package/dist/cli/commands/__tests__/cli-daemon.test.js.map +1 -0
  79. package/dist/cli/commands/__tests__/cli-logs.test.d.ts +2 -0
  80. package/dist/cli/commands/__tests__/cli-logs.test.d.ts.map +1 -0
  81. package/dist/cli/commands/__tests__/cli-logs.test.js +85 -0
  82. package/dist/cli/commands/__tests__/cli-logs.test.js.map +1 -0
  83. package/dist/cli/commands/__tests__/cli-machine.test.d.ts +2 -0
  84. package/dist/cli/commands/__tests__/cli-machine.test.d.ts.map +1 -0
  85. package/dist/cli/commands/__tests__/cli-machine.test.js +119 -0
  86. package/dist/cli/commands/__tests__/cli-machine.test.js.map +1 -0
  87. package/dist/cli/commands/__tests__/cli-projects.test.d.ts +2 -0
  88. package/dist/cli/commands/__tests__/cli-projects.test.d.ts.map +1 -0
  89. package/dist/cli/commands/__tests__/cli-projects.test.js +246 -0
  90. package/dist/cli/commands/__tests__/cli-projects.test.js.map +1 -0
  91. package/dist/cli/commands/__tests__/cli-status.test.d.ts +2 -0
  92. package/dist/cli/commands/__tests__/cli-status.test.d.ts.map +1 -0
  93. package/dist/cli/commands/__tests__/cli-status.test.js +153 -0
  94. package/dist/cli/commands/__tests__/cli-status.test.js.map +1 -0
  95. package/dist/cli/commands/add.d.ts +7 -0
  96. package/dist/cli/commands/add.d.ts.map +1 -0
  97. package/dist/cli/commands/add.js +37 -0
  98. package/dist/cli/commands/add.js.map +1 -0
  99. package/dist/cli/commands/autostart.d.ts +16 -0
  100. package/dist/cli/commands/autostart.d.ts.map +1 -0
  101. package/dist/cli/commands/autostart.js +47 -0
  102. package/dist/cli/commands/autostart.js.map +1 -0
  103. package/dist/cli/commands/login.d.ts +6 -0
  104. package/dist/cli/commands/login.d.ts.map +1 -0
  105. package/dist/cli/commands/login.js +19 -0
  106. package/dist/cli/commands/login.js.map +1 -0
  107. package/dist/cli/commands/logout.d.ts +7 -0
  108. package/dist/cli/commands/logout.d.ts.map +1 -0
  109. package/dist/cli/commands/logout.js +50 -0
  110. package/dist/cli/commands/logout.js.map +1 -0
  111. package/dist/cli/commands/logs.d.ts +9 -0
  112. package/dist/cli/commands/logs.d.ts.map +1 -0
  113. package/dist/cli/commands/logs.js +113 -0
  114. package/dist/cli/commands/logs.js.map +1 -0
  115. package/dist/cli/commands/machine.d.ts +8 -0
  116. package/dist/cli/commands/machine.d.ts.map +1 -0
  117. package/dist/cli/commands/machine.js +78 -0
  118. package/dist/cli/commands/machine.js.map +1 -0
  119. package/dist/cli/commands/projects.d.ts +6 -0
  120. package/dist/cli/commands/projects.d.ts.map +1 -0
  121. package/dist/cli/commands/projects.js +28 -0
  122. package/dist/cli/commands/projects.js.map +1 -0
  123. package/dist/cli/commands/remove.d.ts +7 -0
  124. package/dist/cli/commands/remove.d.ts.map +1 -0
  125. package/dist/cli/commands/remove.js +31 -0
  126. package/dist/cli/commands/remove.js.map +1 -0
  127. package/dist/cli/commands/start.d.ts +14 -0
  128. package/dist/cli/commands/start.d.ts.map +1 -0
  129. package/dist/cli/commands/start.js +67 -0
  130. package/dist/cli/commands/start.js.map +1 -0
  131. package/dist/cli/commands/status.d.ts +6 -0
  132. package/dist/cli/commands/status.d.ts.map +1 -0
  133. package/dist/cli/commands/status.js +68 -0
  134. package/dist/cli/commands/status.js.map +1 -0
  135. package/dist/cli/commands/stop.d.ts +6 -0
  136. package/dist/cli/commands/stop.d.ts.map +1 -0
  137. package/dist/cli/commands/stop.js +39 -0
  138. package/dist/cli/commands/stop.js.map +1 -0
  139. package/dist/cli/index.d.ts +3 -0
  140. package/dist/cli/index.d.ts.map +1 -0
  141. package/dist/cli/index.js +5 -0
  142. package/dist/cli/index.js.map +1 -0
  143. package/dist/cli/notify-project-sync.d.ts +11 -0
  144. package/dist/cli/notify-project-sync.d.ts.map +1 -0
  145. package/dist/cli/notify-project-sync.js +45 -0
  146. package/dist/cli/notify-project-sync.js.map +1 -0
  147. package/dist/cli/notify-re-register.d.ts +7 -0
  148. package/dist/cli/notify-re-register.d.ts.map +1 -0
  149. package/dist/cli/notify-re-register.js +34 -0
  150. package/dist/cli/notify-re-register.js.map +1 -0
  151. package/dist/cli/program.d.ts +6 -0
  152. package/dist/cli/program.d.ts.map +1 -0
  153. package/dist/cli/program.js +66 -0
  154. package/dist/cli/program.js.map +1 -0
  155. package/dist/config/__tests__/index.test.d.ts +2 -0
  156. package/dist/config/__tests__/index.test.d.ts.map +1 -0
  157. package/dist/config/__tests__/index.test.js +146 -0
  158. package/dist/config/__tests__/index.test.js.map +1 -0
  159. package/dist/config/index.d.ts +13 -0
  160. package/dist/config/index.d.ts.map +1 -0
  161. package/dist/config/index.js +77 -0
  162. package/dist/config/index.js.map +1 -0
  163. package/dist/config/schema.d.ts +26 -0
  164. package/dist/config/schema.d.ts.map +1 -0
  165. package/dist/config/schema.js +54 -0
  166. package/dist/config/schema.js.map +1 -0
  167. package/dist/control-plane/__tests__/server.test.d.ts +2 -0
  168. package/dist/control-plane/__tests__/server.test.d.ts.map +1 -0
  169. package/dist/control-plane/__tests__/server.test.js +64 -0
  170. package/dist/control-plane/__tests__/server.test.js.map +1 -0
  171. package/dist/control-plane/routes/__tests__/status.test.d.ts +2 -0
  172. package/dist/control-plane/routes/__tests__/status.test.d.ts.map +1 -0
  173. package/dist/control-plane/routes/__tests__/status.test.js +152 -0
  174. package/dist/control-plane/routes/__tests__/status.test.js.map +1 -0
  175. package/dist/control-plane/routes/__tests__/stop.test.d.ts +2 -0
  176. package/dist/control-plane/routes/__tests__/stop.test.d.ts.map +1 -0
  177. package/dist/control-plane/routes/__tests__/stop.test.js +92 -0
  178. package/dist/control-plane/routes/__tests__/stop.test.js.map +1 -0
  179. package/dist/control-plane/routes/health.d.ts +3 -0
  180. package/dist/control-plane/routes/health.d.ts.map +1 -0
  181. package/dist/control-plane/routes/health.js +14 -0
  182. package/dist/control-plane/routes/health.js.map +1 -0
  183. package/dist/control-plane/routes/machine-label.d.ts +8 -0
  184. package/dist/control-plane/routes/machine-label.d.ts.map +1 -0
  185. package/dist/control-plane/routes/machine-label.js +32 -0
  186. package/dist/control-plane/routes/machine-label.js.map +1 -0
  187. package/dist/control-plane/routes/project-sync.d.ts +12 -0
  188. package/dist/control-plane/routes/project-sync.d.ts.map +1 -0
  189. package/dist/control-plane/routes/project-sync.js +63 -0
  190. package/dist/control-plane/routes/project-sync.js.map +1 -0
  191. package/dist/control-plane/routes/re-register.d.ts +9 -0
  192. package/dist/control-plane/routes/re-register.d.ts.map +1 -0
  193. package/dist/control-plane/routes/re-register.js +56 -0
  194. package/dist/control-plane/routes/re-register.js.map +1 -0
  195. package/dist/control-plane/routes/status.d.ts +49 -0
  196. package/dist/control-plane/routes/status.d.ts.map +1 -0
  197. package/dist/control-plane/routes/status.js +55 -0
  198. package/dist/control-plane/routes/status.js.map +1 -0
  199. package/dist/control-plane/routes/stop.d.ts +7 -0
  200. package/dist/control-plane/routes/stop.d.ts.map +1 -0
  201. package/dist/control-plane/routes/stop.js +25 -0
  202. package/dist/control-plane/routes/stop.js.map +1 -0
  203. package/dist/control-plane/server.d.ts +10 -0
  204. package/dist/control-plane/server.d.ts.map +1 -0
  205. package/dist/control-plane/server.js +39 -0
  206. package/dist/control-plane/server.js.map +1 -0
  207. package/dist/daemon.d.ts +23 -0
  208. package/dist/daemon.d.ts.map +1 -0
  209. package/dist/daemon.js +533 -0
  210. package/dist/daemon.js.map +1 -0
  211. package/dist/db/__tests__/cleanup.test.d.ts +2 -0
  212. package/dist/db/__tests__/cleanup.test.d.ts.map +1 -0
  213. package/dist/db/__tests__/cleanup.test.js +153 -0
  214. package/dist/db/__tests__/cleanup.test.js.map +1 -0
  215. package/dist/db/__tests__/database.test.d.ts +2 -0
  216. package/dist/db/__tests__/database.test.d.ts.map +1 -0
  217. package/dist/db/__tests__/database.test.js +93 -0
  218. package/dist/db/__tests__/database.test.js.map +1 -0
  219. package/dist/db/__tests__/migrator.test.d.ts +2 -0
  220. package/dist/db/__tests__/migrator.test.d.ts.map +1 -0
  221. package/dist/db/__tests__/migrator.test.js +146 -0
  222. package/dist/db/__tests__/migrator.test.js.map +1 -0
  223. package/dist/db/cleanup.d.ts +20 -0
  224. package/dist/db/cleanup.d.ts.map +1 -0
  225. package/dist/db/cleanup.js +67 -0
  226. package/dist/db/cleanup.js.map +1 -0
  227. package/dist/db/database.d.ts +18 -0
  228. package/dist/db/database.d.ts.map +1 -0
  229. package/dist/db/database.js +41 -0
  230. package/dist/db/database.js.map +1 -0
  231. package/dist/db/migrations.d.ts +7 -0
  232. package/dist/db/migrations.d.ts.map +1 -0
  233. package/dist/db/migrations.js +32 -0
  234. package/dist/db/migrations.js.map +1 -0
  235. package/dist/db/migrator.d.ts +26 -0
  236. package/dist/db/migrator.d.ts.map +1 -0
  237. package/dist/db/migrator.js +105 -0
  238. package/dist/db/migrator.js.map +1 -0
  239. package/dist/db/repositories/__tests__/command-runs.test.d.ts +2 -0
  240. package/dist/db/repositories/__tests__/command-runs.test.d.ts.map +1 -0
  241. package/dist/db/repositories/__tests__/command-runs.test.js +90 -0
  242. package/dist/db/repositories/__tests__/command-runs.test.js.map +1 -0
  243. package/dist/db/repositories/__tests__/fs-state.test.d.ts +2 -0
  244. package/dist/db/repositories/__tests__/fs-state.test.d.ts.map +1 -0
  245. package/dist/db/repositories/__tests__/fs-state.test.js +77 -0
  246. package/dist/db/repositories/__tests__/fs-state.test.js.map +1 -0
  247. package/dist/db/repositories/__tests__/projects.test.d.ts +2 -0
  248. package/dist/db/repositories/__tests__/projects.test.d.ts.map +1 -0
  249. package/dist/db/repositories/__tests__/projects.test.js +84 -0
  250. package/dist/db/repositories/__tests__/projects.test.js.map +1 -0
  251. package/dist/db/repositories/__tests__/terminal-sessions.test.d.ts +2 -0
  252. package/dist/db/repositories/__tests__/terminal-sessions.test.d.ts.map +1 -0
  253. package/dist/db/repositories/__tests__/terminal-sessions.test.js +93 -0
  254. package/dist/db/repositories/__tests__/terminal-sessions.test.js.map +1 -0
  255. package/dist/db/repositories/command-runs.d.ts +28 -0
  256. package/dist/db/repositories/command-runs.d.ts.map +1 -0
  257. package/dist/db/repositories/command-runs.js +42 -0
  258. package/dist/db/repositories/command-runs.js.map +1 -0
  259. package/dist/db/repositories/fs-state.d.ts +28 -0
  260. package/dist/db/repositories/fs-state.d.ts.map +1 -0
  261. package/dist/db/repositories/fs-state.js +48 -0
  262. package/dist/db/repositories/fs-state.js.map +1 -0
  263. package/dist/db/repositories/projects.d.ts +33 -0
  264. package/dist/db/repositories/projects.d.ts.map +1 -0
  265. package/dist/db/repositories/projects.js +50 -0
  266. package/dist/db/repositories/projects.js.map +1 -0
  267. package/dist/db/repositories/terminal-sessions.d.ts +28 -0
  268. package/dist/db/repositories/terminal-sessions.d.ts.map +1 -0
  269. package/dist/db/repositories/terminal-sessions.js +47 -0
  270. package/dist/db/repositories/terminal-sessions.js.map +1 -0
  271. package/dist/db/schema.d.ts +6 -0
  272. package/dist/db/schema.d.ts.map +1 -0
  273. package/dist/db/schema.js +49 -0
  274. package/dist/db/schema.js.map +1 -0
  275. package/dist/env.d.ts +15 -0
  276. package/dist/env.d.ts.map +1 -0
  277. package/dist/env.js +23 -0
  278. package/dist/env.js.map +1 -0
  279. package/dist/errors/__tests__/index.test.d.ts +2 -0
  280. package/dist/errors/__tests__/index.test.d.ts.map +1 -0
  281. package/dist/errors/__tests__/index.test.js +105 -0
  282. package/dist/errors/__tests__/index.test.js.map +1 -0
  283. package/dist/errors/index.d.ts +36 -0
  284. package/dist/errors/index.d.ts.map +1 -0
  285. package/dist/errors/index.js +54 -0
  286. package/dist/errors/index.js.map +1 -0
  287. package/dist/gateway/__tests__/message-router.test.d.ts +2 -0
  288. package/dist/gateway/__tests__/message-router.test.d.ts.map +1 -0
  289. package/dist/gateway/__tests__/message-router.test.js +225 -0
  290. package/dist/gateway/__tests__/message-router.test.js.map +1 -0
  291. package/dist/gateway/__tests__/reconnection.test.d.ts +2 -0
  292. package/dist/gateway/__tests__/reconnection.test.d.ts.map +1 -0
  293. package/dist/gateway/__tests__/reconnection.test.js +244 -0
  294. package/dist/gateway/__tests__/reconnection.test.js.map +1 -0
  295. package/dist/gateway/__tests__/websocket-client.test.d.ts +2 -0
  296. package/dist/gateway/__tests__/websocket-client.test.d.ts.map +1 -0
  297. package/dist/gateway/__tests__/websocket-client.test.js +249 -0
  298. package/dist/gateway/__tests__/websocket-client.test.js.map +1 -0
  299. package/dist/gateway/gateway-request.d.ts +17 -0
  300. package/dist/gateway/gateway-request.d.ts.map +1 -0
  301. package/dist/gateway/gateway-request.js +39 -0
  302. package/dist/gateway/gateway-request.js.map +1 -0
  303. package/dist/gateway/message-router.d.ts +31 -0
  304. package/dist/gateway/message-router.d.ts.map +1 -0
  305. package/dist/gateway/message-router.js +91 -0
  306. package/dist/gateway/message-router.js.map +1 -0
  307. package/dist/gateway/messages/__tests__/daemon-register.test.d.ts +2 -0
  308. package/dist/gateway/messages/__tests__/daemon-register.test.d.ts.map +1 -0
  309. package/dist/gateway/messages/__tests__/daemon-register.test.js +113 -0
  310. package/dist/gateway/messages/__tests__/daemon-register.test.js.map +1 -0
  311. package/dist/gateway/messages/__tests__/project-sync.test.d.ts +2 -0
  312. package/dist/gateway/messages/__tests__/project-sync.test.d.ts.map +1 -0
  313. package/dist/gateway/messages/__tests__/project-sync.test.js +92 -0
  314. package/dist/gateway/messages/__tests__/project-sync.test.js.map +1 -0
  315. package/dist/gateway/messages/daemon-register.d.ts +13 -0
  316. package/dist/gateway/messages/daemon-register.d.ts.map +1 -0
  317. package/dist/gateway/messages/daemon-register.js +39 -0
  318. package/dist/gateway/messages/daemon-register.js.map +1 -0
  319. package/dist/gateway/messages/project-sync.d.ts +16 -0
  320. package/dist/gateway/messages/project-sync.d.ts.map +1 -0
  321. package/dist/gateway/messages/project-sync.js +42 -0
  322. package/dist/gateway/messages/project-sync.js.map +1 -0
  323. package/dist/gateway/types.d.ts +41 -0
  324. package/dist/gateway/types.d.ts.map +1 -0
  325. package/dist/gateway/types.js +5 -0
  326. package/dist/gateway/types.js.map +1 -0
  327. package/dist/gateway/websocket-client.d.ts +55 -0
  328. package/dist/gateway/websocket-client.d.ts.map +1 -0
  329. package/dist/gateway/websocket-client.js +185 -0
  330. package/dist/gateway/websocket-client.js.map +1 -0
  331. package/dist/handlers/__tests__/agent-cancel.test.d.ts +2 -0
  332. package/dist/handlers/__tests__/agent-cancel.test.d.ts.map +1 -0
  333. package/dist/handlers/__tests__/agent-cancel.test.js +152 -0
  334. package/dist/handlers/__tests__/agent-cancel.test.js.map +1 -0
  335. package/dist/handlers/__tests__/agent-message.test.d.ts +2 -0
  336. package/dist/handlers/__tests__/agent-message.test.d.ts.map +1 -0
  337. package/dist/handlers/__tests__/agent-message.test.js +270 -0
  338. package/dist/handlers/__tests__/agent-message.test.js.map +1 -0
  339. package/dist/handlers/__tests__/agent-session-new.test.d.ts +2 -0
  340. package/dist/handlers/__tests__/agent-session-new.test.d.ts.map +1 -0
  341. package/dist/handlers/__tests__/agent-session-new.test.js +185 -0
  342. package/dist/handlers/__tests__/agent-session-new.test.js.map +1 -0
  343. package/dist/handlers/__tests__/agent-sessions-list.test.d.ts +2 -0
  344. package/dist/handlers/__tests__/agent-sessions-list.test.d.ts.map +1 -0
  345. package/dist/handlers/__tests__/agent-sessions-list.test.js +171 -0
  346. package/dist/handlers/__tests__/agent-sessions-list.test.js.map +1 -0
  347. package/dist/handlers/__tests__/command-cancel.test.d.ts +2 -0
  348. package/dist/handlers/__tests__/command-cancel.test.d.ts.map +1 -0
  349. package/dist/handlers/__tests__/command-cancel.test.js +121 -0
  350. package/dist/handlers/__tests__/command-cancel.test.js.map +1 -0
  351. package/dist/handlers/__tests__/command-exec.test.d.ts +2 -0
  352. package/dist/handlers/__tests__/command-exec.test.d.ts.map +1 -0
  353. package/dist/handlers/__tests__/command-exec.test.js +155 -0
  354. package/dist/handlers/__tests__/command-exec.test.js.map +1 -0
  355. package/dist/handlers/__tests__/fs-create.test.d.ts +2 -0
  356. package/dist/handlers/__tests__/fs-create.test.d.ts.map +1 -0
  357. package/dist/handlers/__tests__/fs-create.test.js +147 -0
  358. package/dist/handlers/__tests__/fs-create.test.js.map +1 -0
  359. package/dist/handlers/__tests__/fs-delete.test.d.ts +2 -0
  360. package/dist/handlers/__tests__/fs-delete.test.d.ts.map +1 -0
  361. package/dist/handlers/__tests__/fs-delete.test.js +153 -0
  362. package/dist/handlers/__tests__/fs-delete.test.js.map +1 -0
  363. package/dist/handlers/__tests__/fs-list.test.d.ts +2 -0
  364. package/dist/handlers/__tests__/fs-list.test.d.ts.map +1 -0
  365. package/dist/handlers/__tests__/fs-list.test.js +203 -0
  366. package/dist/handlers/__tests__/fs-list.test.js.map +1 -0
  367. package/dist/handlers/__tests__/fs-read.test.d.ts +2 -0
  368. package/dist/handlers/__tests__/fs-read.test.d.ts.map +1 -0
  369. package/dist/handlers/__tests__/fs-read.test.js +178 -0
  370. package/dist/handlers/__tests__/fs-read.test.js.map +1 -0
  371. package/dist/handlers/__tests__/fs-replace.test.d.ts +2 -0
  372. package/dist/handlers/__tests__/fs-replace.test.d.ts.map +1 -0
  373. package/dist/handlers/__tests__/fs-replace.test.js +201 -0
  374. package/dist/handlers/__tests__/fs-replace.test.js.map +1 -0
  375. package/dist/handlers/__tests__/fs-search.test.d.ts +2 -0
  376. package/dist/handlers/__tests__/fs-search.test.d.ts.map +1 -0
  377. package/dist/handlers/__tests__/fs-search.test.js +195 -0
  378. package/dist/handlers/__tests__/fs-search.test.js.map +1 -0
  379. package/dist/handlers/__tests__/fs-write.test.d.ts +2 -0
  380. package/dist/handlers/__tests__/fs-write.test.d.ts.map +1 -0
  381. package/dist/handlers/__tests__/fs-write.test.js +173 -0
  382. package/dist/handlers/__tests__/fs-write.test.js.map +1 -0
  383. package/dist/handlers/__tests__/git-branch-create.test.d.ts +2 -0
  384. package/dist/handlers/__tests__/git-branch-create.test.d.ts.map +1 -0
  385. package/dist/handlers/__tests__/git-branch-create.test.js +158 -0
  386. package/dist/handlers/__tests__/git-branch-create.test.js.map +1 -0
  387. package/dist/handlers/__tests__/git-branches.test.d.ts +2 -0
  388. package/dist/handlers/__tests__/git-branches.test.d.ts.map +1 -0
  389. package/dist/handlers/__tests__/git-branches.test.js +184 -0
  390. package/dist/handlers/__tests__/git-branches.test.js.map +1 -0
  391. package/dist/handlers/__tests__/git-checkout.test.d.ts +2 -0
  392. package/dist/handlers/__tests__/git-checkout.test.d.ts.map +1 -0
  393. package/dist/handlers/__tests__/git-checkout.test.js +126 -0
  394. package/dist/handlers/__tests__/git-checkout.test.js.map +1 -0
  395. package/dist/handlers/__tests__/git-commit.test.d.ts +2 -0
  396. package/dist/handlers/__tests__/git-commit.test.d.ts.map +1 -0
  397. package/dist/handlers/__tests__/git-commit.test.js +131 -0
  398. package/dist/handlers/__tests__/git-commit.test.js.map +1 -0
  399. package/dist/handlers/__tests__/git-diff.test.d.ts +2 -0
  400. package/dist/handlers/__tests__/git-diff.test.d.ts.map +1 -0
  401. package/dist/handlers/__tests__/git-diff.test.js +185 -0
  402. package/dist/handlers/__tests__/git-diff.test.js.map +1 -0
  403. package/dist/handlers/__tests__/git-discard.test.d.ts +2 -0
  404. package/dist/handlers/__tests__/git-discard.test.d.ts.map +1 -0
  405. package/dist/handlers/__tests__/git-discard.test.js +154 -0
  406. package/dist/handlers/__tests__/git-discard.test.js.map +1 -0
  407. package/dist/handlers/__tests__/git-file-base.test.d.ts +2 -0
  408. package/dist/handlers/__tests__/git-file-base.test.d.ts.map +1 -0
  409. package/dist/handlers/__tests__/git-file-base.test.js +148 -0
  410. package/dist/handlers/__tests__/git-file-base.test.js.map +1 -0
  411. package/dist/handlers/__tests__/git-pull.test.d.ts +2 -0
  412. package/dist/handlers/__tests__/git-pull.test.d.ts.map +1 -0
  413. package/dist/handlers/__tests__/git-pull.test.js +180 -0
  414. package/dist/handlers/__tests__/git-pull.test.js.map +1 -0
  415. package/dist/handlers/__tests__/git-push.test.d.ts +2 -0
  416. package/dist/handlers/__tests__/git-push.test.d.ts.map +1 -0
  417. package/dist/handlers/__tests__/git-push.test.js +177 -0
  418. package/dist/handlers/__tests__/git-push.test.js.map +1 -0
  419. package/dist/handlers/__tests__/git-stage.test.d.ts +2 -0
  420. package/dist/handlers/__tests__/git-stage.test.d.ts.map +1 -0
  421. package/dist/handlers/__tests__/git-stage.test.js +165 -0
  422. package/dist/handlers/__tests__/git-stage.test.js.map +1 -0
  423. package/dist/handlers/__tests__/git-status.test.d.ts +2 -0
  424. package/dist/handlers/__tests__/git-status.test.d.ts.map +1 -0
  425. package/dist/handlers/__tests__/git-status.test.js +182 -0
  426. package/dist/handlers/__tests__/git-status.test.js.map +1 -0
  427. package/dist/handlers/__tests__/machines-list.test.d.ts +2 -0
  428. package/dist/handlers/__tests__/machines-list.test.d.ts.map +1 -0
  429. package/dist/handlers/__tests__/machines-list.test.js +164 -0
  430. package/dist/handlers/__tests__/machines-list.test.js.map +1 -0
  431. package/dist/handlers/__tests__/project-create.test.d.ts +2 -0
  432. package/dist/handlers/__tests__/project-create.test.d.ts.map +1 -0
  433. package/dist/handlers/__tests__/project-create.test.js +166 -0
  434. package/dist/handlers/__tests__/project-create.test.js.map +1 -0
  435. package/dist/handlers/__tests__/project-delete.test.d.ts +2 -0
  436. package/dist/handlers/__tests__/project-delete.test.d.ts.map +1 -0
  437. package/dist/handlers/__tests__/project-delete.test.js +150 -0
  438. package/dist/handlers/__tests__/project-delete.test.js.map +1 -0
  439. package/dist/handlers/__tests__/projects-list.test.d.ts +2 -0
  440. package/dist/handlers/__tests__/projects-list.test.d.ts.map +1 -0
  441. package/dist/handlers/__tests__/projects-list.test.js +145 -0
  442. package/dist/handlers/__tests__/projects-list.test.js.map +1 -0
  443. package/dist/handlers/__tests__/terminal-create.test.d.ts +2 -0
  444. package/dist/handlers/__tests__/terminal-create.test.d.ts.map +1 -0
  445. package/dist/handlers/__tests__/terminal-create.test.js +156 -0
  446. package/dist/handlers/__tests__/terminal-create.test.js.map +1 -0
  447. package/dist/handlers/__tests__/terminal-kill.test.d.ts +2 -0
  448. package/dist/handlers/__tests__/terminal-kill.test.d.ts.map +1 -0
  449. package/dist/handlers/__tests__/terminal-kill.test.js +125 -0
  450. package/dist/handlers/__tests__/terminal-kill.test.js.map +1 -0
  451. package/dist/handlers/__tests__/terminal-resize.test.d.ts +2 -0
  452. package/dist/handlers/__tests__/terminal-resize.test.d.ts.map +1 -0
  453. package/dist/handlers/__tests__/terminal-resize.test.js +128 -0
  454. package/dist/handlers/__tests__/terminal-resize.test.js.map +1 -0
  455. package/dist/handlers/__tests__/terminal-stdin.test.d.ts +2 -0
  456. package/dist/handlers/__tests__/terminal-stdin.test.d.ts.map +1 -0
  457. package/dist/handlers/__tests__/terminal-stdin.test.js +128 -0
  458. package/dist/handlers/__tests__/terminal-stdin.test.js.map +1 -0
  459. package/dist/handlers/agent-cancel.d.ts +11 -0
  460. package/dist/handlers/agent-cancel.d.ts.map +1 -0
  461. package/dist/handlers/agent-cancel.js +67 -0
  462. package/dist/handlers/agent-cancel.js.map +1 -0
  463. package/dist/handlers/agent-message.d.ts +13 -0
  464. package/dist/handlers/agent-message.d.ts.map +1 -0
  465. package/dist/handlers/agent-message.js +119 -0
  466. package/dist/handlers/agent-message.js.map +1 -0
  467. package/dist/handlers/agent-prompt-response.d.ts +13 -0
  468. package/dist/handlers/agent-prompt-response.d.ts.map +1 -0
  469. package/dist/handlers/agent-prompt-response.js +26 -0
  470. package/dist/handlers/agent-prompt-response.js.map +1 -0
  471. package/dist/handlers/agent-session-new.d.ts +13 -0
  472. package/dist/handlers/agent-session-new.d.ts.map +1 -0
  473. package/dist/handlers/agent-session-new.js +106 -0
  474. package/dist/handlers/agent-session-new.js.map +1 -0
  475. package/dist/handlers/agent-sessions-list.d.ts +10 -0
  476. package/dist/handlers/agent-sessions-list.d.ts.map +1 -0
  477. package/dist/handlers/agent-sessions-list.js +78 -0
  478. package/dist/handlers/agent-sessions-list.js.map +1 -0
  479. package/dist/handlers/command-cancel.d.ts +9 -0
  480. package/dist/handlers/command-cancel.d.ts.map +1 -0
  481. package/dist/handlers/command-cancel.js +32 -0
  482. package/dist/handlers/command-cancel.js.map +1 -0
  483. package/dist/handlers/command-exec.d.ts +9 -0
  484. package/dist/handlers/command-exec.d.ts.map +1 -0
  485. package/dist/handlers/command-exec.js +74 -0
  486. package/dist/handlers/command-exec.js.map +1 -0
  487. package/dist/handlers/fs/__tests__/limits.test.d.ts +2 -0
  488. package/dist/handlers/fs/__tests__/limits.test.d.ts.map +1 -0
  489. package/dist/handlers/fs/__tests__/limits.test.js +154 -0
  490. package/dist/handlers/fs/__tests__/limits.test.js.map +1 -0
  491. package/dist/handlers/fs/limits.d.ts +41 -0
  492. package/dist/handlers/fs/limits.d.ts.map +1 -0
  493. package/dist/handlers/fs/limits.js +68 -0
  494. package/dist/handlers/fs/limits.js.map +1 -0
  495. package/dist/handlers/fs-create.d.ts +8 -0
  496. package/dist/handlers/fs-create.d.ts.map +1 -0
  497. package/dist/handlers/fs-create.js +98 -0
  498. package/dist/handlers/fs-create.js.map +1 -0
  499. package/dist/handlers/fs-delete.d.ts +8 -0
  500. package/dist/handlers/fs-delete.d.ts.map +1 -0
  501. package/dist/handlers/fs-delete.js +95 -0
  502. package/dist/handlers/fs-delete.js.map +1 -0
  503. package/dist/handlers/fs-list.d.ts +7 -0
  504. package/dist/handlers/fs-list.d.ts.map +1 -0
  505. package/dist/handlers/fs-list.js +70 -0
  506. package/dist/handlers/fs-list.js.map +1 -0
  507. package/dist/handlers/fs-read.d.ts +7 -0
  508. package/dist/handlers/fs-read.d.ts.map +1 -0
  509. package/dist/handlers/fs-read.js +98 -0
  510. package/dist/handlers/fs-read.js.map +1 -0
  511. package/dist/handlers/fs-replace.d.ts +8 -0
  512. package/dist/handlers/fs-replace.d.ts.map +1 -0
  513. package/dist/handlers/fs-replace.js +178 -0
  514. package/dist/handlers/fs-replace.js.map +1 -0
  515. package/dist/handlers/fs-search.d.ts +10 -0
  516. package/dist/handlers/fs-search.d.ts.map +1 -0
  517. package/dist/handlers/fs-search.js +302 -0
  518. package/dist/handlers/fs-search.js.map +1 -0
  519. package/dist/handlers/fs-write.d.ts +7 -0
  520. package/dist/handlers/fs-write.d.ts.map +1 -0
  521. package/dist/handlers/fs-write.js +74 -0
  522. package/dist/handlers/fs-write.js.map +1 -0
  523. package/dist/handlers/git/__tests__/credentials.test.d.ts +2 -0
  524. package/dist/handlers/git/__tests__/credentials.test.d.ts.map +1 -0
  525. package/dist/handlers/git/__tests__/credentials.test.js +145 -0
  526. package/dist/handlers/git/__tests__/credentials.test.js.map +1 -0
  527. package/dist/handlers/git/__tests__/error-parser.test.d.ts +2 -0
  528. package/dist/handlers/git/__tests__/error-parser.test.d.ts.map +1 -0
  529. package/dist/handlers/git/__tests__/error-parser.test.js +85 -0
  530. package/dist/handlers/git/__tests__/error-parser.test.js.map +1 -0
  531. package/dist/handlers/git/credentials.d.ts +55 -0
  532. package/dist/handlers/git/credentials.d.ts.map +1 -0
  533. package/dist/handlers/git/credentials.js +93 -0
  534. package/dist/handlers/git/credentials.js.map +1 -0
  535. package/dist/handlers/git/error-parser.d.ts +27 -0
  536. package/dist/handlers/git/error-parser.d.ts.map +1 -0
  537. package/dist/handlers/git/error-parser.js +98 -0
  538. package/dist/handlers/git/error-parser.js.map +1 -0
  539. package/dist/handlers/git-branch-create.d.ts +7 -0
  540. package/dist/handlers/git-branch-create.d.ts.map +1 -0
  541. package/dist/handlers/git-branch-create.js +60 -0
  542. package/dist/handlers/git-branch-create.js.map +1 -0
  543. package/dist/handlers/git-branches.d.ts +7 -0
  544. package/dist/handlers/git-branches.d.ts.map +1 -0
  545. package/dist/handlers/git-branches.js +60 -0
  546. package/dist/handlers/git-branches.js.map +1 -0
  547. package/dist/handlers/git-checkout.d.ts +7 -0
  548. package/dist/handlers/git-checkout.d.ts.map +1 -0
  549. package/dist/handlers/git-checkout.js +59 -0
  550. package/dist/handlers/git-checkout.js.map +1 -0
  551. package/dist/handlers/git-commit.d.ts +7 -0
  552. package/dist/handlers/git-commit.d.ts.map +1 -0
  553. package/dist/handlers/git-commit.js +59 -0
  554. package/dist/handlers/git-commit.js.map +1 -0
  555. package/dist/handlers/git-diff.d.ts +7 -0
  556. package/dist/handlers/git-diff.d.ts.map +1 -0
  557. package/dist/handlers/git-diff.js +56 -0
  558. package/dist/handlers/git-diff.js.map +1 -0
  559. package/dist/handlers/git-discard.d.ts +7 -0
  560. package/dist/handlers/git-discard.d.ts.map +1 -0
  561. package/dist/handlers/git-discard.js +56 -0
  562. package/dist/handlers/git-discard.js.map +1 -0
  563. package/dist/handlers/git-file-base.d.ts +7 -0
  564. package/dist/handlers/git-file-base.d.ts.map +1 -0
  565. package/dist/handlers/git-file-base.js +61 -0
  566. package/dist/handlers/git-file-base.js.map +1 -0
  567. package/dist/handlers/git-pull.d.ts +8 -0
  568. package/dist/handlers/git-pull.d.ts.map +1 -0
  569. package/dist/handlers/git-pull.js +69 -0
  570. package/dist/handlers/git-pull.js.map +1 -0
  571. package/dist/handlers/git-push.d.ts +7 -0
  572. package/dist/handlers/git-push.d.ts.map +1 -0
  573. package/dist/handlers/git-push.js +67 -0
  574. package/dist/handlers/git-push.js.map +1 -0
  575. package/dist/handlers/git-stage.d.ts +7 -0
  576. package/dist/handlers/git-stage.d.ts.map +1 -0
  577. package/dist/handlers/git-stage.js +56 -0
  578. package/dist/handlers/git-stage.js.map +1 -0
  579. package/dist/handlers/git-status.d.ts +7 -0
  580. package/dist/handlers/git-status.d.ts.map +1 -0
  581. package/dist/handlers/git-status.js +63 -0
  582. package/dist/handlers/git-status.js.map +1 -0
  583. package/dist/handlers/git-unstage.d.ts +7 -0
  584. package/dist/handlers/git-unstage.d.ts.map +1 -0
  585. package/dist/handlers/git-unstage.js +56 -0
  586. package/dist/handlers/git-unstage.js.map +1 -0
  587. package/dist/handlers/machines-list.d.ts +14 -0
  588. package/dist/handlers/machines-list.d.ts.map +1 -0
  589. package/dist/handlers/machines-list.js +53 -0
  590. package/dist/handlers/machines-list.js.map +1 -0
  591. package/dist/handlers/project-create.d.ts +18 -0
  592. package/dist/handlers/project-create.d.ts.map +1 -0
  593. package/dist/handlers/project-create.js +100 -0
  594. package/dist/handlers/project-create.js.map +1 -0
  595. package/dist/handlers/project-delete.d.ts +19 -0
  596. package/dist/handlers/project-delete.d.ts.map +1 -0
  597. package/dist/handlers/project-delete.js +89 -0
  598. package/dist/handlers/project-delete.js.map +1 -0
  599. package/dist/handlers/projects-list.d.ts +7 -0
  600. package/dist/handlers/projects-list.d.ts.map +1 -0
  601. package/dist/handlers/projects-list.js +42 -0
  602. package/dist/handlers/projects-list.js.map +1 -0
  603. package/dist/handlers/terminal-create.d.ts +8 -0
  604. package/dist/handlers/terminal-create.d.ts.map +1 -0
  605. package/dist/handlers/terminal-create.js +50 -0
  606. package/dist/handlers/terminal-create.js.map +1 -0
  607. package/dist/handlers/terminal-kill.d.ts +10 -0
  608. package/dist/handlers/terminal-kill.d.ts.map +1 -0
  609. package/dist/handlers/terminal-kill.js +32 -0
  610. package/dist/handlers/terminal-kill.js.map +1 -0
  611. package/dist/handlers/terminal-resize.d.ts +8 -0
  612. package/dist/handlers/terminal-resize.d.ts.map +1 -0
  613. package/dist/handlers/terminal-resize.js +29 -0
  614. package/dist/handlers/terminal-resize.js.map +1 -0
  615. package/dist/handlers/terminal-stdin.d.ts +8 -0
  616. package/dist/handlers/terminal-stdin.d.ts.map +1 -0
  617. package/dist/handlers/terminal-stdin.js +29 -0
  618. package/dist/handlers/terminal-stdin.js.map +1 -0
  619. package/dist/index.d.ts +8 -0
  620. package/dist/index.d.ts.map +1 -0
  621. package/dist/index.js +20 -0
  622. package/dist/index.js.map +1 -0
  623. package/dist/opencode/__tests__/check-installed.test.d.ts +2 -0
  624. package/dist/opencode/__tests__/check-installed.test.d.ts.map +1 -0
  625. package/dist/opencode/__tests__/check-installed.test.js +68 -0
  626. package/dist/opencode/__tests__/check-installed.test.js.map +1 -0
  627. package/dist/opencode/__tests__/detect.test.d.ts +2 -0
  628. package/dist/opencode/__tests__/detect.test.d.ts.map +1 -0
  629. package/dist/opencode/__tests__/detect.test.js +147 -0
  630. package/dist/opencode/__tests__/detect.test.js.map +1 -0
  631. package/dist/opencode/__tests__/health-check.test.d.ts +2 -0
  632. package/dist/opencode/__tests__/health-check.test.d.ts.map +1 -0
  633. package/dist/opencode/__tests__/health-check.test.js +143 -0
  634. package/dist/opencode/__tests__/health-check.test.js.map +1 -0
  635. package/dist/opencode/__tests__/permission-reply.test.d.ts +2 -0
  636. package/dist/opencode/__tests__/permission-reply.test.d.ts.map +1 -0
  637. package/dist/opencode/__tests__/permission-reply.test.js +140 -0
  638. package/dist/opencode/__tests__/permission-reply.test.js.map +1 -0
  639. package/dist/opencode/__tests__/proxy.test.d.ts +2 -0
  640. package/dist/opencode/__tests__/proxy.test.d.ts.map +1 -0
  641. package/dist/opencode/__tests__/proxy.test.js +179 -0
  642. package/dist/opencode/__tests__/proxy.test.js.map +1 -0
  643. package/dist/opencode/__tests__/session-filter.test.d.ts +2 -0
  644. package/dist/opencode/__tests__/session-filter.test.d.ts.map +1 -0
  645. package/dist/opencode/__tests__/session-filter.test.js +117 -0
  646. package/dist/opencode/__tests__/session-filter.test.js.map +1 -0
  647. package/dist/opencode/__tests__/spawn.test.d.ts +2 -0
  648. package/dist/opencode/__tests__/spawn.test.d.ts.map +1 -0
  649. package/dist/opencode/__tests__/spawn.test.js +167 -0
  650. package/dist/opencode/__tests__/spawn.test.js.map +1 -0
  651. package/dist/opencode/__tests__/sse.test.d.ts +2 -0
  652. package/dist/opencode/__tests__/sse.test.d.ts.map +1 -0
  653. package/dist/opencode/__tests__/sse.test.js +245 -0
  654. package/dist/opencode/__tests__/sse.test.js.map +1 -0
  655. package/dist/opencode/__tests__/supervisor.test.d.ts +2 -0
  656. package/dist/opencode/__tests__/supervisor.test.d.ts.map +1 -0
  657. package/dist/opencode/__tests__/supervisor.test.js +206 -0
  658. package/dist/opencode/__tests__/supervisor.test.js.map +1 -0
  659. package/dist/opencode/check-installed.d.ts +12 -0
  660. package/dist/opencode/check-installed.d.ts.map +1 -0
  661. package/dist/opencode/check-installed.js +25 -0
  662. package/dist/opencode/check-installed.js.map +1 -0
  663. package/dist/opencode/detect.d.ts +16 -0
  664. package/dist/opencode/detect.d.ts.map +1 -0
  665. package/dist/opencode/detect.js +102 -0
  666. package/dist/opencode/detect.js.map +1 -0
  667. package/dist/opencode/health-check.d.ts +31 -0
  668. package/dist/opencode/health-check.d.ts.map +1 -0
  669. package/dist/opencode/health-check.js +97 -0
  670. package/dist/opencode/health-check.js.map +1 -0
  671. package/dist/opencode/permission-reply.d.ts +14 -0
  672. package/dist/opencode/permission-reply.d.ts.map +1 -0
  673. package/dist/opencode/permission-reply.js +70 -0
  674. package/dist/opencode/permission-reply.js.map +1 -0
  675. package/dist/opencode/proxy.d.ts +45 -0
  676. package/dist/opencode/proxy.d.ts.map +1 -0
  677. package/dist/opencode/proxy.js +99 -0
  678. package/dist/opencode/proxy.js.map +1 -0
  679. package/dist/opencode/session-filter.d.ts +26 -0
  680. package/dist/opencode/session-filter.d.ts.map +1 -0
  681. package/dist/opencode/session-filter.js +20 -0
  682. package/dist/opencode/session-filter.js.map +1 -0
  683. package/dist/opencode/spawn.d.ts +24 -0
  684. package/dist/opencode/spawn.d.ts.map +1 -0
  685. package/dist/opencode/spawn.js +143 -0
  686. package/dist/opencode/spawn.js.map +1 -0
  687. package/dist/opencode/sse.d.ts +42 -0
  688. package/dist/opencode/sse.d.ts.map +1 -0
  689. package/dist/opencode/sse.js +250 -0
  690. package/dist/opencode/sse.js.map +1 -0
  691. package/dist/opencode/supervisor.d.ts +43 -0
  692. package/dist/opencode/supervisor.d.ts.map +1 -0
  693. package/dist/opencode/supervisor.js +153 -0
  694. package/dist/opencode/supervisor.js.map +1 -0
  695. package/dist/services/__tests__/autostart.test.d.ts +2 -0
  696. package/dist/services/__tests__/autostart.test.d.ts.map +1 -0
  697. package/dist/services/__tests__/autostart.test.js +176 -0
  698. package/dist/services/__tests__/autostart.test.js.map +1 -0
  699. package/dist/services/__tests__/file-watcher.test.d.ts +2 -0
  700. package/dist/services/__tests__/file-watcher.test.d.ts.map +1 -0
  701. package/dist/services/__tests__/file-watcher.test.js +265 -0
  702. package/dist/services/__tests__/file-watcher.test.js.map +1 -0
  703. package/dist/services/__tests__/git-pty.test.d.ts +2 -0
  704. package/dist/services/__tests__/git-pty.test.d.ts.map +1 -0
  705. package/dist/services/__tests__/git-pty.test.js +137 -0
  706. package/dist/services/__tests__/git-pty.test.js.map +1 -0
  707. package/dist/services/__tests__/message-queue.test.d.ts +2 -0
  708. package/dist/services/__tests__/message-queue.test.d.ts.map +1 -0
  709. package/dist/services/__tests__/message-queue.test.js +203 -0
  710. package/dist/services/__tests__/message-queue.test.js.map +1 -0
  711. package/dist/services/__tests__/queue-overflow.test.d.ts +2 -0
  712. package/dist/services/__tests__/queue-overflow.test.d.ts.map +1 -0
  713. package/dist/services/__tests__/queue-overflow.test.js +115 -0
  714. package/dist/services/__tests__/queue-overflow.test.js.map +1 -0
  715. package/dist/services/__tests__/shutdown.test.d.ts +2 -0
  716. package/dist/services/__tests__/shutdown.test.d.ts.map +1 -0
  717. package/dist/services/__tests__/shutdown.test.js +181 -0
  718. package/dist/services/__tests__/shutdown.test.js.map +1 -0
  719. package/dist/services/__tests__/terminal-exit.test.d.ts +2 -0
  720. package/dist/services/__tests__/terminal-exit.test.d.ts.map +1 -0
  721. package/dist/services/__tests__/terminal-exit.test.js +150 -0
  722. package/dist/services/__tests__/terminal-exit.test.js.map +1 -0
  723. package/dist/services/__tests__/terminal-stdout.test.d.ts +2 -0
  724. package/dist/services/__tests__/terminal-stdout.test.d.ts.map +1 -0
  725. package/dist/services/__tests__/terminal-stdout.test.js +160 -0
  726. package/dist/services/__tests__/terminal-stdout.test.js.map +1 -0
  727. package/dist/services/autostart.d.ts +42 -0
  728. package/dist/services/autostart.d.ts.map +1 -0
  729. package/dist/services/autostart.js +198 -0
  730. package/dist/services/autostart.js.map +1 -0
  731. package/dist/services/capabilities.d.ts +18 -0
  732. package/dist/services/capabilities.d.ts.map +1 -0
  733. package/dist/services/capabilities.js +38 -0
  734. package/dist/services/capabilities.js.map +1 -0
  735. package/dist/services/command-runner.d.ts +46 -0
  736. package/dist/services/command-runner.d.ts.map +1 -0
  737. package/dist/services/command-runner.js +151 -0
  738. package/dist/services/command-runner.js.map +1 -0
  739. package/dist/services/file-watcher.d.ts +35 -0
  740. package/dist/services/file-watcher.d.ts.map +1 -0
  741. package/dist/services/file-watcher.js +133 -0
  742. package/dist/services/file-watcher.js.map +1 -0
  743. package/dist/services/filesystem.d.ts +68 -0
  744. package/dist/services/filesystem.d.ts.map +1 -0
  745. package/dist/services/filesystem.js +249 -0
  746. package/dist/services/filesystem.js.map +1 -0
  747. package/dist/services/git.d.ts +149 -0
  748. package/dist/services/git.d.ts.map +1 -0
  749. package/dist/services/git.js +589 -0
  750. package/dist/services/git.js.map +1 -0
  751. package/dist/services/message-queue.d.ts +58 -0
  752. package/dist/services/message-queue.d.ts.map +1 -0
  753. package/dist/services/message-queue.js +118 -0
  754. package/dist/services/message-queue.js.map +1 -0
  755. package/dist/services/shutdown.d.ts +40 -0
  756. package/dist/services/shutdown.d.ts.map +1 -0
  757. package/dist/services/shutdown.js +144 -0
  758. package/dist/services/shutdown.js.map +1 -0
  759. package/dist/services/terminal-manager.d.ts +43 -0
  760. package/dist/services/terminal-manager.d.ts.map +1 -0
  761. package/dist/services/terminal-manager.js +118 -0
  762. package/dist/services/terminal-manager.js.map +1 -0
  763. package/dist/utils/__tests__/config.test.d.ts +2 -0
  764. package/dist/utils/__tests__/config.test.d.ts.map +1 -0
  765. package/dist/utils/__tests__/config.test.js +67 -0
  766. package/dist/utils/__tests__/config.test.js.map +1 -0
  767. package/dist/utils/__tests__/diff.test.d.ts +2 -0
  768. package/dist/utils/__tests__/diff.test.d.ts.map +1 -0
  769. package/dist/utils/__tests__/diff.test.js +40 -0
  770. package/dist/utils/__tests__/diff.test.js.map +1 -0
  771. package/dist/utils/__tests__/filename-validation.test.d.ts +2 -0
  772. package/dist/utils/__tests__/filename-validation.test.d.ts.map +1 -0
  773. package/dist/utils/__tests__/filename-validation.test.js +114 -0
  774. package/dist/utils/__tests__/filename-validation.test.js.map +1 -0
  775. package/dist/utils/__tests__/logger.test.d.ts +2 -0
  776. package/dist/utils/__tests__/logger.test.d.ts.map +1 -0
  777. package/dist/utils/__tests__/logger.test.js +254 -0
  778. package/dist/utils/__tests__/logger.test.js.map +1 -0
  779. package/dist/utils/__tests__/machine-key.test.d.ts +2 -0
  780. package/dist/utils/__tests__/machine-key.test.d.ts.map +1 -0
  781. package/dist/utils/__tests__/machine-key.test.js +123 -0
  782. package/dist/utils/__tests__/machine-key.test.js.map +1 -0
  783. package/dist/utils/__tests__/path-sandbox.test.d.ts +2 -0
  784. package/dist/utils/__tests__/path-sandbox.test.d.ts.map +1 -0
  785. package/dist/utils/__tests__/path-sandbox.test.js +97 -0
  786. package/dist/utils/__tests__/path-sandbox.test.js.map +1 -0
  787. package/dist/utils/__tests__/paths.test.d.ts +2 -0
  788. package/dist/utils/__tests__/paths.test.d.ts.map +1 -0
  789. package/dist/utils/__tests__/paths.test.js +87 -0
  790. package/dist/utils/__tests__/paths.test.js.map +1 -0
  791. package/dist/utils/__tests__/pid.test.d.ts +2 -0
  792. package/dist/utils/__tests__/pid.test.d.ts.map +1 -0
  793. package/dist/utils/__tests__/pid.test.js +79 -0
  794. package/dist/utils/__tests__/pid.test.js.map +1 -0
  795. package/dist/utils/__tests__/validate-project-path.test.d.ts +2 -0
  796. package/dist/utils/__tests__/validate-project-path.test.d.ts.map +1 -0
  797. package/dist/utils/__tests__/validate-project-path.test.js +178 -0
  798. package/dist/utils/__tests__/validate-project-path.test.js.map +1 -0
  799. package/dist/utils/config.d.ts +8 -0
  800. package/dist/utils/config.d.ts.map +1 -0
  801. package/dist/utils/config.js +16 -0
  802. package/dist/utils/config.js.map +1 -0
  803. package/dist/utils/diff.d.ts +11 -0
  804. package/dist/utils/diff.d.ts.map +1 -0
  805. package/dist/utils/diff.js +24 -0
  806. package/dist/utils/diff.js.map +1 -0
  807. package/dist/utils/filename-validation.d.ts +10 -0
  808. package/dist/utils/filename-validation.d.ts.map +1 -0
  809. package/dist/utils/filename-validation.js +55 -0
  810. package/dist/utils/filename-validation.js.map +1 -0
  811. package/dist/utils/logger.d.ts +18 -0
  812. package/dist/utils/logger.d.ts.map +1 -0
  813. package/dist/utils/logger.js +104 -0
  814. package/dist/utils/logger.js.map +1 -0
  815. package/dist/utils/machine-info.d.ts +6 -0
  816. package/dist/utils/machine-info.d.ts.map +1 -0
  817. package/dist/utils/machine-info.js +38 -0
  818. package/dist/utils/machine-info.js.map +1 -0
  819. package/dist/utils/machine-key.d.ts +20 -0
  820. package/dist/utils/machine-key.d.ts.map +1 -0
  821. package/dist/utils/machine-key.js +66 -0
  822. package/dist/utils/machine-key.js.map +1 -0
  823. package/dist/utils/path-sandbox.d.ts +24 -0
  824. package/dist/utils/path-sandbox.d.ts.map +1 -0
  825. package/dist/utils/path-sandbox.js +69 -0
  826. package/dist/utils/path-sandbox.js.map +1 -0
  827. package/dist/utils/paths.d.ts +19 -0
  828. package/dist/utils/paths.d.ts.map +1 -0
  829. package/dist/utils/paths.js +52 -0
  830. package/dist/utils/paths.js.map +1 -0
  831. package/dist/utils/pid.d.ts +23 -0
  832. package/dist/utils/pid.d.ts.map +1 -0
  833. package/dist/utils/pid.js +57 -0
  834. package/dist/utils/pid.js.map +1 -0
  835. package/dist/utils/validate-project-path.d.ts +17 -0
  836. package/dist/utils/validate-project-path.d.ts.map +1 -0
  837. package/dist/utils/validate-project-path.js +109 -0
  838. package/dist/utils/validate-project-path.js.map +1 -0
  839. package/package.json +59 -0
package/README.md ADDED
@@ -0,0 +1,1106 @@
1
+ # PocketCoder Daemon
2
+
3
+ The PocketCoder Daemon is a local Node.js process that acts as a bridge between Claude Code and the mobile PWA client. It manages Claude Code execution, file synchronization, and real-time communication with the cloud relay server.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Tech Stack](#tech-stack)
9
+ - [Installation & Usage](#installation--usage)
10
+ - [Architecture](#architecture)
11
+ - [Startup Sequence](#startup-sequence)
12
+ - [Authentication](#authentication)
13
+ - [Relay Connection](#relay-connection)
14
+ - [Message Handling](#message-handling)
15
+ - [Features](#features)
16
+ - [Filesystem Operations](#filesystem-operations)
17
+ - [File Watcher](#file-watcher)
18
+ - [Command Runner](#command-runner)
19
+ - [Git Integration](#git-integration)
20
+ - [Claude Code Integration](#claude-code-integration)
21
+ - [Control Plane HTTP API](#control-plane-http-api)
22
+ - [Database Schema](#database-schema)
23
+ - [CLI Commands](#cli-commands)
24
+ - [Error Handling](#error-handling)
25
+ - [Configuration](#configuration)
26
+ - [Testing](#testing)
27
+
28
+ ---
29
+
30
+ ## Overview
31
+
32
+ ```mermaid
33
+ flowchart LR
34
+ subgraph Internet
35
+ Client["Client<br/>(PWA)"]
36
+ Relay["Relay<br/>(Fly.io)"]
37
+ end
38
+
39
+ subgraph Local
40
+ Daemon["Daemon<br/>(Local)"]
41
+ Claude["Claude<br/>Code"]
42
+ end
43
+
44
+ subgraph Cloud
45
+ Supabase["Supabase<br/>(Auth/DB)"]
46
+ end
47
+
48
+ Client <-->|WebSocket| Relay
49
+ Relay <-->|WebSocket| Daemon
50
+ Relay -->|Auth| Supabase
51
+ Daemon -->|Spawn| Claude
52
+ ```
53
+
54
+ **Key Responsibilities:**
55
+
56
+ - **Claude Code Management**: Spawning and managing Claude Code CLI processes
57
+ - **Filesystem Operations**: Reading, writing, and watching project files
58
+ - **Shell Commands**: Executing shell commands with streaming output
59
+ - **Git Operations**: Status, branching, staging, committing, and pushing
60
+ - **Relay Communication**: Maintaining WebSocket connection with the cloud relay
61
+ - **Local Storage**: Persisting projects, command history, and auth tokens in SQLite
62
+
63
+ ---
64
+
65
+ ## Tech Stack
66
+
67
+ | Component | Library | Purpose |
68
+ | -------------------- | ------------------- | ---------------------------- |
69
+ | **Runtime** | Node.js 24 LTS | JavaScript runtime |
70
+ | **Language** | TypeScript (strict) | Type-safe development |
71
+ | **WebSocket** | `ws` | Relay connection |
72
+ | **Database** | `better-sqlite3` | Local persistence |
73
+ | **File Watcher** | `chokidar` | Filesystem change detection |
74
+ | **CLI Framework** | `commander` | Command-line interface |
75
+ | **Process Spawning** | `execa` | Claude Code & shell commands |
76
+ | **HTTP Server** | `fastify` | Control plane API |
77
+ | **Testing** | `vitest` | Unit and integration tests |
78
+ | **Build** | `tsc` | TypeScript compilation |
79
+
80
+ ---
81
+
82
+ ## Installation & Usage
83
+
84
+ ### Prerequisites
85
+
86
+ - Node.js 24 LTS or later
87
+ - Claude Code CLI installed and configured
88
+ - Git (for git operations)
89
+
90
+ ### Installation
91
+
92
+ ```bash
93
+ # Install globally
94
+ npm install -g pocketcoder
95
+
96
+ # Or run without install
97
+ npx pocketcoder start
98
+ ```
99
+
100
+ ### Basic Usage
101
+
102
+ ```bash
103
+ # Login with GitHub (opens browser)
104
+ pocketcoder login
105
+
106
+ # Start the daemon (runs in background)
107
+ pocketcoder start
108
+
109
+ # Start in foreground (for debugging)
110
+ pocketcoder start --foreground
111
+
112
+ # Register a project
113
+ pocketcoder add /path/to/project
114
+ pocketcoder add . # Current directory
115
+
116
+ # List registered projects
117
+ pocketcoder projects
118
+
119
+ # Check daemon status
120
+ pocketcoder status
121
+
122
+ # View logs
123
+ pocketcoder logs --tail 100 -f
124
+
125
+ # Stop the daemon
126
+ pocketcoder stop
127
+
128
+ # Remove a project
129
+ pocketcoder remove <projectId>
130
+
131
+ # Set machine label
132
+ pocketcoder machine label "Work Laptop"
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Architecture
138
+
139
+ ```mermaid
140
+ graph TB
141
+ subgraph "Local Machine"
142
+ CLI["CLI Commands<br/>(pocketcoder)"]
143
+ CP["Control Plane HTTP<br/>:17333"]
144
+ Daemon["Daemon Core"]
145
+
146
+ subgraph "Services"
147
+ CR["Claude Runner"]
148
+ CMD["Command Runner"]
149
+ FW["File Watcher"]
150
+ GIT["Git Service"]
151
+ MQ["Message Queue"]
152
+ end
153
+
154
+ subgraph "Data Layer"
155
+ DB["SQLite Database<br/>(daemon.db)"]
156
+ AUTH["Auth Storage<br/>(auth.json)"]
157
+ end
158
+
159
+ CLI -->|HTTP| CP
160
+ CP -->|Control| Daemon
161
+ Daemon -->|Spawn| CR
162
+ Daemon -->|Execute| CMD
163
+ Daemon -->|Watch| FW
164
+ Daemon -->|Exec| GIT
165
+ Daemon -->|Queue| MQ
166
+ CR -->|Stream Events| MQ
167
+ Daemon -->|Read/Write| DB
168
+ Daemon -->|Load/Save| AUTH
169
+ end
170
+
171
+ subgraph "Cloud"
172
+ Relay["Relay Server<br/>WebSocket"]
173
+ end
174
+
175
+ Daemon <-->|WebSocket| Relay
176
+ ```
177
+
178
+ ### Directory Structure
179
+
180
+ ```
181
+ apps/host/
182
+ ├── src/
183
+ │ ├── index.ts # Entry point
184
+ │ ├── daemon.ts # Main startup orchestration
185
+ │ ├── cli/ # CLI command handlers
186
+ │ │ ├── index.ts
187
+ │ │ ├── start.ts
188
+ │ │ ├── stop.ts
189
+ │ │ ├── add.ts
190
+ │ │ └── ...
191
+ │ ├── relay/ # Relay communication
192
+ │ │ ├── websocket-client.ts
193
+ │ │ ├── message-router.ts
194
+ │ │ ├── relay-request.ts
195
+ │ │ └── messages/
196
+ │ │ ├── daemon-register.ts
197
+ │ │ └── ...
198
+ │ ├── handlers/ # Message handlers
199
+ │ │ ├── fs-list.ts
200
+ │ │ ├── fs-read.ts
201
+ │ │ ├── fs-write.ts
202
+ │ │ ├── git-status.ts
203
+ │ │ ├── command-exec.ts
204
+ │ │ ├── agent-session-new.ts
205
+ │ │ └── ...
206
+ │ ├── services/ # Core services
207
+ │ │ ├── claude-runner.ts
208
+ │ │ ├── command-runner.ts
209
+ │ │ ├── file-watcher.ts
210
+ │ │ ├── git.ts
211
+ │ │ ├── message-queue.ts
212
+ │ │ ├── stream-json-parser.ts
213
+ │ │ └── shutdown.ts
214
+ │ ├── auth/ # Authentication
215
+ │ │ ├── login.ts
216
+ │ │ ├── relay-auth.ts
217
+ │ │ ├── token-storage.ts
218
+ │ │ └── token-refresh.ts
219
+ │ ├── db/ # Database layer
220
+ │ │ ├── database.ts
221
+ │ │ └── repositories/
222
+ │ │ ├── projects.ts
223
+ │ │ ├── command-runs.ts
224
+ │ │ └── fs-state.ts
225
+ │ ├── control-plane/ # HTTP control plane
226
+ │ │ ├── server.ts
227
+ │ │ └── routes/
228
+ │ └── utils/ # Utilities
229
+ │ ├── logger.ts
230
+ │ ├── paths.ts
231
+ │ ├── machine-info.ts
232
+ │ └── config.ts
233
+ └── tests/ # Test files
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Startup Sequence
239
+
240
+ The daemon startup follows a 3-phase process:
241
+
242
+ ```mermaid
243
+ sequenceDiagram
244
+ participant CLI as CLI
245
+ participant Daemon as Daemon
246
+ participant DB as SQLite
247
+ participant Auth as Auth
248
+ participant Relay as Relay
249
+
250
+ Note over Daemon: Phase 1 - Local Init
251
+ Daemon->>Daemon: Create config dirs
252
+ Daemon->>DB: Open/Migrate database
253
+ Daemon->>Daemon: Clean old command runs
254
+ Daemon->>Daemon: Start Control Plane HTTP :17333
255
+ Daemon->>Daemon: Write PID file
256
+
257
+ Note over Daemon: Phase 2 - Authentication
258
+ Daemon->>Auth: Load existing tokens
259
+ alt Has valid tokens
260
+ Daemon->>Relay: token_refresh (if expired)
261
+ Relay-->>Daemon: New tokens
262
+ else No tokens / invalid
263
+ Daemon->>Daemon: Start OAuth server
264
+ Daemon->>Daemon: Open browser
265
+ Note over Daemon: User completes OAuth
266
+ Daemon->>Relay: auth_exchange {code}
267
+ Relay-->>Daemon: tokens + user info
268
+ end
269
+ Daemon->>Auth: Save tokens
270
+
271
+ Note over Daemon: Phase 3 - Relay Connection
272
+ Daemon->>Daemon: Setup message router
273
+ Daemon->>Relay: Connect WebSocket
274
+ Relay-->>Daemon: connected
275
+ Daemon->>Relay: daemon_register
276
+ Daemon->>Daemon: Start file watchers
277
+ Daemon->>Daemon: Register signal handlers
278
+
279
+ Note over Daemon: Ready ✓
280
+ ```
281
+
282
+ ### Shutdown Sequence
283
+
284
+ ```mermaid
285
+ sequenceDiagram
286
+ participant Signal as SIGTERM/SIGINT
287
+ participant Daemon as Daemon
288
+ participant Services as Services
289
+ participant DB as Database
290
+
291
+ Signal->>Daemon: Shutdown signal
292
+ Daemon->>Daemon: Stop accepting requests
293
+
294
+ Note over Daemon,Services: LIFO cleanup order
295
+ Daemon->>Services: Stop file watchers
296
+ Daemon->>Services: Clear message queues
297
+ Daemon->>Services: Kill Claude processes
298
+ Daemon->>Services: Kill running commands
299
+ Daemon->>Services: Close relay connection
300
+
301
+ Daemon->>DB: Close database
302
+ Daemon->>Daemon: Remove PID file
303
+ Daemon->>Signal: Exit 0
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Authentication
309
+
310
+ The daemon uses GitHub OAuth via Supabase Auth. **Important:** The daemon does NOT interact with Supabase directly - all token exchange goes through the Relay.
311
+
312
+ ```mermaid
313
+ sequenceDiagram
314
+ participant User as User
315
+ participant Daemon as Daemon
316
+ participant OAuth as OAuth Server
317
+ participant Supabase as Supabase
318
+ participant Relay as Relay
319
+
320
+ User->>Daemon: pocketcoder login
321
+ Daemon->>Daemon: Start local callback server :random
322
+ Daemon->>OAuth: Open browser to auth URL
323
+ User->>OAuth: Sign in with GitHub
324
+ OAuth->>Daemon: Callback with code
325
+ Daemon->>Relay: auth_exchange { code }
326
+ Relay->>Supabase: Exchange code for tokens
327
+ Supabase-->>Relay: access_token, refresh_token
328
+ Relay-->>Daemon: auth_exchange_response
329
+ Daemon->>Daemon: Generate machineKey (UUID v4)
330
+ Daemon->>Daemon: Save tokens to auth.json
331
+ Daemon-->>User: Login complete
332
+ ```
333
+
334
+ ### Token Storage
335
+
336
+ Tokens are stored with restrictive permissions (0600):
337
+
338
+ | OS | Path |
339
+ | ------- | ----------------------------------------------------- |
340
+ | macOS | `~/Library/Application Support/pocketcoder/auth.json` |
341
+ | Linux | `~/.config/pocketcoder/auth.json` |
342
+ | Windows | `%APPDATA%\pocketcoder\auth.json` |
343
+
344
+ ```json
345
+ {
346
+ "machine_key": "550e8400-e29b-41d4-a716-446655440000",
347
+ "access_token": "eyJ...",
348
+ "refresh_token": "...",
349
+ "expires_at": 1707666000,
350
+ "user_id": "github|12345"
351
+ }
352
+ ```
353
+
354
+ ### Automatic Token Refresh
355
+
356
+ ```mermaid
357
+ sequenceDiagram
358
+ participant Daemon as Daemon
359
+ participant Relay as Relay
360
+ participant Supabase as Supabase
361
+
362
+ Note over Daemon: Token expired
363
+ Daemon->>Relay: token_refresh {refresh_token}
364
+ Relay->>Supabase: POST /auth/v1/token
365
+ Supabase-->>Relay: New tokens
366
+ Relay-->>Daemon: token_refresh_response
367
+ Daemon->>Daemon: Update auth.json
368
+ ```
369
+
370
+ ---
371
+
372
+ ## Relay Connection
373
+
374
+ ### Connection State Machine
375
+
376
+ ```mermaid
377
+ stateDiagram-v2
378
+ [*] --> disconnected
379
+
380
+ disconnected --> connecting: connect()
381
+ connecting --> connected: WebSocket opens
382
+ connecting --> disconnected: Error/Close
383
+
384
+ connected --> connected: Heartbeat ping/pong
385
+ connected --> reconnecting: Unexpected disconnect
386
+
387
+ reconnecting --> connected: Reconnect success
388
+ reconnecting --> reconnecting: Retry with backoff
389
+
390
+ reconnecting --> disconnected: Manual disconnect()
391
+ connected --> disconnected: Manual disconnect()
392
+ disconnected --> [*]
393
+ ```
394
+
395
+ ### Reconnection Strategy
396
+
397
+ - **Exponential backoff**: 1s, 2s, 4s, 8s... maximum 60s
398
+ - **On reconnect**: Re-sends `daemon_register` with full state
399
+ - **File watchers**: Continue running (local state preserved)
400
+ - **Message queue**: Maintained, processed on reconnect
401
+
402
+ ### Daemon Registration
403
+
404
+ ```mermaid
405
+ sequenceDiagram
406
+ participant Daemon as Daemon
407
+ participant Relay as Relay
408
+ participant Client as Client
409
+
410
+ Daemon->>Relay: Connect WebSocket
411
+ Daemon->>Relay: daemon_register
412
+ Note right of Daemon: machineKey, token,<br/>machine info, projects
413
+
414
+ Note over Relay: Validate JWT<br/>Store in map
415
+
416
+ Relay--)Client: daemon_status {connected: true}
417
+ Relay-->>Daemon: Ready
418
+ ```
419
+
420
+ ---
421
+
422
+ ## Message Handling
423
+
424
+ ### Message Flow
425
+
426
+ ```mermaid
427
+ graph TB
428
+ subgraph "Relay Server"
429
+ RRelay["Relay WebSocket"]
430
+ end
431
+
432
+ subgraph "Daemon"
433
+ WS["WebSocket Client"]
434
+ Router["Message Router"]
435
+
436
+ subgraph "Handlers"
437
+ H1["fs_* Handlers"]
438
+ H2["git_* Handlers"]
439
+ H3["command_exec"]
440
+ H4["agent_* Handlers"]
441
+ end
442
+
443
+ subgraph "Services"
444
+ CR["Claude Runner"]
445
+ CMD["Command Runner"]
446
+ FW["File Watcher"]
447
+ end
448
+ end
449
+
450
+ RRelay -->|Message| WS
451
+ WS -->|message event| Router
452
+ Router -->|Dispatch| H1
453
+ Router -->|Dispatch| H2
454
+ Router -->|Dispatch| H3
455
+ Router -->|Dispatch| H4
456
+
457
+ H3 -->|Execute| CMD
458
+ H4 -->|Spawn| CR
459
+
460
+ CR -->|Events| Router
461
+ CMD -->|Output| Router
462
+ FW -->|fs_changed| WS
463
+
464
+ Router -->|send| WS
465
+ WS -->|JSON| RRelay
466
+ ```
467
+
468
+ ### Handler Pattern
469
+
470
+ All message handlers follow this signature:
471
+
472
+ ```typescript
473
+ export async function handleMessageType(
474
+ message: RequestMessage,
475
+ send: (response: Message) => void
476
+ ): Promise<void> {
477
+ // 1. Extract and validate payload
478
+ // 2. Query database / filesystem
479
+ // 3. Perform operation
480
+ // 4. Send response via send()
481
+ // 5. Stream events (if applicable)
482
+ }
483
+ ```
484
+
485
+ ### Supported Message Types
486
+
487
+ | Category | Message Type | Description |
488
+ | -------------- | ----------------------- | ------------------------ |
489
+ | **Filesystem** | `fs_list` | List directory contents |
490
+ | | `fs_read` | Read file content |
491
+ | | `fs_write` | Write file content |
492
+ | **Git** | `git_status` | Get git status |
493
+ | | `git_branches` | List branches |
494
+ | | `git_branch_create` | Create new branch |
495
+ | | `git_checkout` | Checkout branch/ref |
496
+ | | `git_stage` | Stage files |
497
+ | | `git_unstage` | Unstage files |
498
+ | | `git_commit` | Create commit |
499
+ | | `git_push` | Push to remote |
500
+ | | `git_file_base` | Get file at HEAD |
501
+ | **Commands** | `command_exec` | Execute shell command |
502
+ | | `command_cancel` | Cancel running command |
503
+ | **Agent** | `agent_session_new` | Start new Claude session |
504
+ | | `agent_message` | Send message to session |
505
+ | | `agent_sessions_list` | List existing sessions |
506
+ | | `agent_cancel` | Cancel running session |
507
+ | | `agent_prompt_response` | Respond to Claude prompt |
508
+ | **System** | `machines_list` | List user's machines |
509
+ | | `projects_list` | List projects |
510
+
511
+ ---
512
+
513
+ ## Features
514
+
515
+ ### Filesystem Operations
516
+
517
+ ```mermaid
518
+ sequenceDiagram
519
+ participant Client as Client
520
+ participant Relay as Relay
521
+ participant Daemon as Daemon
522
+
523
+ Note over Client,Daemon: READ OPERATIONS
524
+ Client->>Relay: fs_list {path: "src"}
525
+ Relay->>Daemon: forward
526
+ Note over Daemon: Read directory
527
+ Daemon-->>Relay: fs_list_response
528
+ Relay-->>Client: {children: [...]}
529
+
530
+ Client->>Relay: fs_read {path: "src/app.ts"}
531
+ Relay->>Daemon: forward
532
+ Daemon-->>Relay: fs_read_response
533
+ Relay-->>Client: {content: "..."}
534
+
535
+ Note over Client,Daemon: WRITE OPERATIONS
536
+ Client->>Relay: fs_write {path, content}
537
+ Relay->>Daemon: forward
538
+ Note over Daemon: Write to disk
539
+ Daemon-->>Relay: fs_write_response
540
+ Relay-->>Client: {success: true}
541
+ ```
542
+
543
+ #### Lazy Tree Loading
544
+
545
+ The filesystem is loaded lazily for performance:
546
+
547
+ - Root: `fs_list(path="")` returns only root level
548
+ - Expand folder: `fs_list(path="src")` loads that directory
549
+ - Prevents sending large `node_modules` directories
550
+
551
+ #### Limits
552
+
553
+ | Limit | Value |
554
+ | --------------------------- | --------- |
555
+ | Maximum file read size | 10 MB |
556
+ | Maximum file write size | 1 MB |
557
+ | Maximum tree depth | 20 levels |
558
+ | Maximum entries per listing | 10,000 |
559
+
560
+ ---
561
+
562
+ ### File Watcher
563
+
564
+ The daemon uses chokidar to monitor filesystem changes in real-time.
565
+
566
+ ```mermaid
567
+ graph TB
568
+ subgraph "Chokidar Watch"
569
+ WATCH["watch(projectPath)"]
570
+ IGNORE["Ignored Patterns:<br/>node_modules, .git,<br/>dist, build, .next"]
571
+ end
572
+
573
+ subgraph "Change Detection"
574
+ ADD["add/addDir → create"]
575
+ MOD["change → modify"]
576
+ DEL["unlink/unlinkDir → delete"]
577
+ end
578
+
579
+ subgraph "Accumulation"
580
+ PEND["Pending Changes"]
581
+ DEBOUNCE["Debounce Timer<br/>(250ms)"]
582
+ end
583
+
584
+ subgraph "Event Generation"
585
+ SEQ["Increment sequence"]
586
+ TRUNC["Truncate if > 500"]
587
+ EVENT["fs_changed event"]
588
+ end
589
+
590
+ WATCH -->|Event| ADD
591
+ WATCH -->|Event| MOD
592
+ WATCH -->|Event| DEL
593
+
594
+ ADD --> PEND
595
+ MOD --> PEND
596
+ DEL --> PEND
597
+
598
+ PEND -->|Schedule| DEBOUNCE
599
+ DEBOUNCE -->|Fire| SEQ
600
+ SEQ --> TRUNC
601
+ TRUNC --> EVENT
602
+
603
+ IGNORE -.->|Filters| WATCH
604
+ ```
605
+
606
+ #### Event Message
607
+
608
+ ```typescript
609
+ {
610
+ type: 'fs_changed',
611
+ sessionId: 'proj_abc',
612
+ payload: {
613
+ seq: 43, // Incremental sequence
614
+ changes: [
615
+ { kind: 'create', path: 'src/new.ts' },
616
+ { kind: 'modify', path: 'src/app.ts' },
617
+ { kind: 'delete', path: 'src/old.ts' }
618
+ ],
619
+ changesTruncated?: boolean // true if >500 changes
620
+ }
621
+ }
622
+ ```
623
+
624
+ #### Synchronization
625
+
626
+ - Each change increments `seq` globally per project
627
+ - Client tracks last `seq` received
628
+ - On seq gap: client triggers full `fs_list` refresh
629
+
630
+ ---
631
+
632
+ ### Command Runner
633
+
634
+ Non-interactive shell command execution with streaming output.
635
+
636
+ ```mermaid
637
+ sequenceDiagram
638
+ participant Client as Client
639
+ participant Relay as Relay
640
+ participant Daemon as Daemon
641
+
642
+ Client->>Relay: command_exec {command: "npm test"}
643
+ Relay->>Daemon: forward
644
+ Note over Daemon: Spawn process
645
+
646
+ loop Streaming output
647
+ Daemon--)Relay: command_output {stdoutChunk}
648
+ Relay--)Client: forward
649
+ Daemon--)Relay: command_output {stderrChunk}
650
+ Relay--)Client: forward
651
+ end
652
+
653
+ Daemon-->>Relay: command_exit {exitCode: 0}
654
+ Relay-->>Client: forward
655
+
656
+ Note over Client,Daemon: CANCELLATION
657
+ Client->>Relay: command_cancel {requestId}
658
+ Relay->>Daemon: forward
659
+ Note over Daemon: kill (SIGTERM)
660
+ Daemon-->>Relay: command_exit {exitCode: null, signal: "SIGTERM"}
661
+ Relay-->>Client: forward
662
+ ```
663
+
664
+ #### Design Principles
665
+
666
+ - **One-shot execution**: Command must terminate on its own
667
+ - **No interactive TTY**: stdout/stderr captured and streamed
668
+ - **Cancellation support**: Kill process on request
669
+ - **Timeout protection**: 120 second default timeout
670
+
671
+ #### Limits
672
+
673
+ | Limit | Value |
674
+ | ----------------- | --------------------- |
675
+ | Default timeout | 120 seconds |
676
+ | Maximum output | 300 KB (truncated) |
677
+ | Working directory | Fixed to project path |
678
+
679
+ ---
680
+
681
+ ### Git Integration
682
+
683
+ ```mermaid
684
+ sequenceDiagram
685
+ participant Client as Client
686
+ participant Relay as Relay
687
+ participant Daemon as Daemon
688
+
689
+ Note over Client,Daemon: STATUS & BRANCHES
690
+ Client->>Relay: git_status
691
+ Relay->>Daemon: forward
692
+ Note over Daemon: git status --porcelain
693
+ Daemon-->>Relay: git_status_response
694
+ Relay-->>Client: {branch, staged, unstaged}
695
+
696
+ Note over Client,Daemon: STAGE & COMMIT
697
+ Client->>Relay: git_stage {paths}
698
+ Relay->>Daemon: forward
699
+ Note over Daemon: git add
700
+ Daemon-->>Relay: git_stage_response
701
+ Relay-->>Client: success
702
+
703
+ Client->>Relay: git_commit {message}
704
+ Relay->>Daemon: forward
705
+ Note over Daemon: git commit -m
706
+ Daemon-->>Relay: git_commit_response
707
+ Relay-->>Client: {sha: "abc123"}
708
+
709
+ Note over Client,Daemon: PUSH
710
+ Client->>Relay: git_push
711
+ Relay->>Daemon: forward
712
+ Note over Daemon: git push
713
+ Daemon-->>Relay: git_push_response
714
+ Relay-->>Client: success
715
+
716
+ Note over Client,Daemon: DIFF (via file base)
717
+ Client->>Relay: git_file_base {path}
718
+ Relay->>Daemon: forward
719
+ Note over Daemon: git show HEAD:path
720
+ Daemon-->>Relay: git_file_base_response
721
+ Relay-->>Client: {content}
722
+ ```
723
+
724
+ #### Git Operations
725
+
726
+ | Operation | Git Command | Description |
727
+ | ------------------- | --------------------------- | ------------------------------ |
728
+ | `git_status` | `git status --porcelain=v1` | Branch, staged, unstaged files |
729
+ | `git_branches` | `git for-each-ref` | List all branches |
730
+ | `git_branch_create` | `git branch <name>` | Create new branch |
731
+ | `git_checkout` | `git checkout <ref>` | Switch branch/commit |
732
+ | `git_stage` | `git add <paths>` | Stage files |
733
+ | `git_unstage` | `git reset HEAD <paths>` | Unstage files |
734
+ | `git_commit` | `git commit -m` | Create commit |
735
+ | `git_push` | `git push` | Push to remote |
736
+ | `git_file_base` | `git show HEAD:<path>` | Get file at HEAD |
737
+
738
+ ---
739
+
740
+ ### Claude Code Integration
741
+
742
+ ```mermaid
743
+ sequenceDiagram
744
+ participant Client as Client
745
+ participant Relay as Relay
746
+ participant Daemon as Daemon
747
+ participant Claude as Claude CLI
748
+
749
+ Note over Client,Claude: NEW SESSION
750
+ Client->>Relay: agent_session_new {content}
751
+ Relay->>Daemon: forward
752
+ Note over Daemon: Generate agentSessionId
753
+ Daemon->>Claude: claude -p --output-format stream-json --session-id uuid "prompt"
754
+ Daemon-->>Relay: agent_session_new_response {agentSessionId}
755
+ Relay-->>Client: forward
756
+
757
+ loop Streaming events
758
+ Claude-->>Daemon: JSON line
759
+ Daemon--)Relay: agent_event {type: "text"}
760
+ Relay--)Client: forward
761
+ Daemon--)Relay: agent_event {type: "tool_use"}
762
+ Relay--)Client: forward
763
+ end
764
+
765
+ Claude-->>Daemon: result line
766
+ Daemon--)Relay: agent_event {type: "done"}
767
+ Relay--)Client: forward
768
+
769
+ Note over Client,Claude: CONTINUE SESSION
770
+ Client->>Relay: agent_message {agentSessionId, content}
771
+ Relay->>Daemon: forward
772
+ Daemon->>Claude: claude -p --resume sessionId "prompt"
773
+ loop Streaming
774
+ Daemon--)Relay: agent_event
775
+ Relay--)Client: forward
776
+ end
777
+
778
+ Note over Client,Claude: CANCEL
779
+ Client->>Relay: agent_cancel
780
+ Relay->>Daemon: forward
781
+ Note over Daemon: kill (SIGTERM)
782
+ Daemon--)Relay: agent_event {type: "done", cancelled: true}
783
+ Relay--)Client: forward
784
+ ```
785
+
786
+ #### Execution Model
787
+
788
+ The daemon does NOT keep Claude Code processes alive permanently:
789
+
790
+ 1. Message arrives from client
791
+ 2. Daemon spawns `claude -p --output-format stream-json --verbose ...`
792
+ 3. Streaming response to client
793
+ 4. Process terminates
794
+ 5. Next message resumes with `--resume <agentSessionId>`
795
+
796
+ #### Claude CLI Flags
797
+
798
+ | Flag | Description |
799
+ | ----------------------------- | ------------------------- |
800
+ | `-p, --print` | Non-interactive mode |
801
+ | `--output-format stream-json` | Structured JSON output |
802
+ | `--verbose` | Required with stream-json |
803
+ | `--session-id <uuid>` | Create specific session |
804
+ | `-r, --resume <uuid>` | Resume existing session |
805
+
806
+ #### Stream JSON Parser
807
+
808
+ Claude Code emits line-delimited JSON. The daemon parses and transforms:
809
+
810
+ ```mermaid
811
+ graph LR
812
+ subgraph "Claude stdout"
813
+ SYS["system init"]
814
+ ASS["assistant"]
815
+ USER["user"]
816
+ RES["result"]
817
+ end
818
+
819
+ subgraph "StreamJsonBuffer"
820
+ BUF["Parse lines"]
821
+ end
822
+
823
+ subgraph "AgentEvents"
824
+ INIT["init"]
825
+ TEXT["text"]
826
+ FC["file_create"]
827
+ FE["file_edit"]
828
+ TU["tool_use"]
829
+ PROMPT["prompt"]
830
+ DONE["done"]
831
+ end
832
+
833
+ SYS --> BUF
834
+ ASS --> BUF
835
+ USER --> BUF
836
+ RES --> BUF
837
+
838
+ BUF --> INIT
839
+ BUF --> TEXT
840
+ BUF --> FC
841
+ BUF --> FE
842
+ BUF --> TU
843
+ BUF --> PROMPT
844
+ BUF --> DONE
845
+ ```
846
+
847
+ #### Message Queue
848
+
849
+ - **FIFO queue per session**: Max 50 messages
850
+ - **One Claude process per agentSessionId**
851
+ - **Queue drains after process completes**
852
+ - **If queue full**: Reject with `DAEMON_BUSY`
853
+
854
+ ---
855
+
856
+ ## Control Plane HTTP API
857
+
858
+ Local HTTP server on `127.0.0.1:17333` for daemon management.
859
+
860
+ | Route | Method | Description |
861
+ | ---------------- | ------ | ------------------------ |
862
+ | `/health` | GET | Health check (empty 200) |
863
+ | `/status` | GET | Detailed daemon status |
864
+ | `/stop` | POST | Graceful shutdown |
865
+ | `/machine-label` | GET | Get machine label |
866
+ | `/machine-label` | POST | Set machine label |
867
+ | `/re-register` | POST | Re-register with relay |
868
+
869
+ ### Status Response
870
+
871
+ ```json
872
+ {
873
+ "version": "1.0.0",
874
+ "machineKey": "550e8400-e29b-41d4-a716-446655440000",
875
+ "loggedIn": true,
876
+ "relay": {
877
+ "connected": true,
878
+ "lastConnectedAt": "2026-02-12T10:00:00Z",
879
+ "lastHeartbeatAt": "2026-02-12T10:15:00Z"
880
+ },
881
+ "capabilities": {
882
+ "hasGit": true,
883
+ "hasClaude": true,
884
+ "claudeStoreFound": true,
885
+ "warnings": []
886
+ },
887
+ "projects": [
888
+ {
889
+ "projectId": "550e8400-...",
890
+ "name": "my-app",
891
+ "path": "/Users/dev/my-app",
892
+ "watcherRunning": true,
893
+ "lastFsSeq": 123
894
+ }
895
+ ]
896
+ }
897
+ ```
898
+
899
+ ---
900
+
901
+ ## Database Schema
902
+
903
+ SQLite database at `~/.pocketcoder/daemon.db`:
904
+
905
+ ```mermaid
906
+ erDiagram
907
+ PROJECTS ||--o{ FS_STATE : "1:1"
908
+ PROJECTS ||--o{ COMMAND_RUNS : "1:N"
909
+ PROJECTS ||--o{ CLAUDE_PROJECT_DIRS : "1:N"
910
+
911
+ PROJECTS {
912
+ text project_id PK
913
+ text name
914
+ text path UK
915
+ datetime created_at
916
+ datetime last_opened_at
917
+ }
918
+
919
+ FS_STATE {
920
+ text project_id PK,FK
921
+ integer last_seq
922
+ }
923
+
924
+ COMMAND_RUNS {
925
+ text request_id PK
926
+ text project_id FK
927
+ text command
928
+ datetime started_at
929
+ datetime ended_at
930
+ integer exit_code
931
+ boolean truncated
932
+ text output_preview
933
+ }
934
+
935
+ CLAUDE_PROJECT_DIRS {
936
+ text project_id PK,FK
937
+ text claude_dir_path PK
938
+ datetime last_verified_at
939
+ }
940
+ ```
941
+
942
+ ### Retention Policy
943
+
944
+ | Table | Policy |
945
+ | --------------------- | ---------------------------- |
946
+ | `projects` | No limit |
947
+ | `fs_state` | No limit (1 row per project) |
948
+ | `claude_project_dirs` | No limit |
949
+ | `command_runs` | 7 days or max 10,000 rows |
950
+
951
+ Cleanup runs on startup and every 6 hours.
952
+
953
+ ---
954
+
955
+ ## CLI Commands
956
+
957
+ | Command | Description |
958
+ | ---------------------------------- | ------------------------- |
959
+ | `pocketcoder login` | Authenticate with GitHub |
960
+ | `pocketcoder logout` | Delete stored credentials |
961
+ | `pocketcoder start` | Start daemon (background) |
962
+ | `pocketcoder start --foreground` | Start in foreground |
963
+ | `pocketcoder stop` | Stop daemon gracefully |
964
+ | `pocketcoder status` | Show daemon status |
965
+ | `pocketcoder add <path>` | Register project |
966
+ | `pocketcoder remove <projectId>` | Unregister project |
967
+ | `pocketcoder projects` | List registered projects |
968
+ | `pocketcoder logs [--tail N] [-f]` | View daemon logs |
969
+ | `pocketcoder machine label <text>` | Set machine label |
970
+ | `pocketcoder enable-autostart` | Enable autostart |
971
+ | `pocketcoder disable-autostart` | Disable autostart |
972
+
973
+ ---
974
+
975
+ ## Error Handling
976
+
977
+ All errors are caught at router level and converted to error responses:
978
+
979
+ ```typescript
980
+ {
981
+ type: "error",
982
+ requestId: "req_123",
983
+ error: {
984
+ code: "FILE_NOT_FOUND",
985
+ message: "File does not exist",
986
+ details?: { path: "src/missing.ts" }
987
+ }
988
+ }
989
+ ```
990
+
991
+ ### Error Codes
992
+
993
+ | Code | Description |
994
+ | ---------------------- | ------------------------ |
995
+ | `UNKNOWN_ERROR` | Generic error |
996
+ | `INVALID_REQUEST` | Missing/invalid payload |
997
+ | `UNAUTHORIZED` | Authentication failed |
998
+ | `PROJECT_NOT_FOUND` | Project doesn't exist |
999
+ | `FILE_NOT_FOUND` | File doesn't exist |
1000
+ | `FILE_TOO_LARGE` | File exceeds 10MB |
1001
+ | `OUTSIDE_PROJECT_ROOT` | Path escape attempt |
1002
+ | `GIT_NOT_INITIALIZED` | Not a git repo |
1003
+ | `COMMAND_TIMEOUT` | Command exceeded timeout |
1004
+ | `DAEMON_BUSY` | Queue full (50 max) |
1005
+
1006
+ ---
1007
+
1008
+ ## Configuration
1009
+
1010
+ ### Environment Variables
1011
+
1012
+ | Variable | Description | Default |
1013
+ | ------------- | --------------------- | ------------------------------- |
1014
+ | `GATEWAY_URL` | Gateway WebSocket URL | `wss://gateway.pocketcoder.dev` |
1015
+ | `LOG_LEVEL` | Logging level | `info` |
1016
+
1017
+ ### Config Directory
1018
+
1019
+ | OS | Path |
1020
+ | ------- | -------------------------------------------- |
1021
+ | macOS | `~/Library/Application Support/pocketcoder/` |
1022
+ | Linux | `~/.config/pocketcoder/` |
1023
+ | Windows | `%APPDATA%\pocketcoder\` |
1024
+
1025
+ ### Files
1026
+
1027
+ | File | Purpose |
1028
+ | ------------------- | ---------------------------- |
1029
+ | `daemon.db` | SQLite database |
1030
+ | `auth.json` | Authentication tokens |
1031
+ | `machine-label.txt` | User-set machine name |
1032
+ | `daemon.pid` | PID file (running indicator) |
1033
+ | `logs/daemon.log` | Log file |
1034
+
1035
+ ---
1036
+
1037
+ ## Testing
1038
+
1039
+ ```bash
1040
+ # Run all tests
1041
+ pnpm test
1042
+
1043
+ # Run tests in watch mode
1044
+ pnpm test -- --watch
1045
+
1046
+ # Run specific test file
1047
+ pnpm test -- --run src/handlers/fs-list.test.ts
1048
+
1049
+ # Run with coverage
1050
+ pnpm test -- --coverage
1051
+ ```
1052
+
1053
+ ### Test Structure
1054
+
1055
+ ```
1056
+ tests/
1057
+ ├── handlers/ # Message handler tests
1058
+ ├── services/ # Service tests
1059
+ ├── auth/ # Auth flow tests
1060
+ ├── relay/ # Relay connection tests
1061
+ ├── db/ # Database tests
1062
+ ├── cli/ # CLI command tests
1063
+ └── utils/ # Utility tests
1064
+ ```
1065
+
1066
+ ---
1067
+
1068
+ ## Security
1069
+
1070
+ ### Network Security
1071
+
1072
+ - **Outbound-only**: Daemon only makes outbound WebSocket connection
1073
+ - **No public listeners**: Control plane bound to `127.0.0.1` only
1074
+ - **JWT authentication**: All relay communication authenticated
1075
+
1076
+ ### File Security
1077
+
1078
+ - **Path validation**: All paths validated to be within project root
1079
+ - **Symlink protection**: No escape via symlinks
1080
+ - **Token storage**: Restrictive permissions (0600)
1081
+
1082
+ ### Threat Model
1083
+
1084
+ - Without stolen JWT: Access probability = 0
1085
+ - With stolen JWT: Full access (focus on secure storage)
1086
+ - Anti-enumeration: Always respond `not_found` on auth errors
1087
+
1088
+ ---
1089
+
1090
+ ## Performance Limits
1091
+
1092
+ | Aspect | Limit | Rationale |
1093
+ | --------------------- | -------------- | ------------------------ |
1094
+ | Message Queue | 50 per session | Prevent unbounded memory |
1095
+ | File Changes | 500 per event | Batch large fs events |
1096
+ | Command Output | 300 KB | Prevent huge payloads |
1097
+ | Command Timeout | 120s | Prevent stuck processes |
1098
+ | File Size | 10 MB | Binary detection |
1099
+ | Debounce Delay | 250ms | Batch file events |
1100
+ | Relay Request Timeout | 15s | Prevent blocking |
1101
+
1102
+ ---
1103
+
1104
+ ## License
1105
+
1106
+ See the root [LICENSE](../../LICENSE) file.