parasor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (633) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/THIRD-PARTY-NOTICES.md +138 -0
  4. package/bin/parasor.mjs +3 -0
  5. package/node_modules/@parasor/shared/dist/client.d.ts +8 -0
  6. package/node_modules/@parasor/shared/dist/client.d.ts.map +1 -0
  7. package/node_modules/@parasor/shared/dist/client.js +2 -0
  8. package/node_modules/@parasor/shared/dist/client.js.map +1 -0
  9. package/node_modules/@parasor/shared/dist/drops.d.ts +24 -0
  10. package/node_modules/@parasor/shared/dist/drops.d.ts.map +1 -0
  11. package/node_modules/@parasor/shared/dist/drops.js +2 -0
  12. package/node_modules/@parasor/shared/dist/drops.js.map +1 -0
  13. package/node_modules/@parasor/shared/dist/file-uploads.d.ts +56 -0
  14. package/node_modules/@parasor/shared/dist/file-uploads.d.ts.map +1 -0
  15. package/node_modules/@parasor/shared/dist/file-uploads.js +13 -0
  16. package/node_modules/@parasor/shared/dist/file-uploads.js.map +1 -0
  17. package/node_modules/@parasor/shared/dist/ide-commands.d.ts +8 -0
  18. package/node_modules/@parasor/shared/dist/ide-commands.d.ts.map +1 -0
  19. package/node_modules/@parasor/shared/dist/ide-commands.js +59 -0
  20. package/node_modules/@parasor/shared/dist/ide-commands.js.map +1 -0
  21. package/node_modules/@parasor/shared/dist/pane-commands.d.ts +7 -0
  22. package/node_modules/@parasor/shared/dist/pane-commands.d.ts.map +1 -0
  23. package/node_modules/@parasor/shared/dist/pane-commands.js +47 -0
  24. package/node_modules/@parasor/shared/dist/pane-commands.js.map +1 -0
  25. package/node_modules/@parasor/shared/dist/pane-model.d.ts +63 -0
  26. package/node_modules/@parasor/shared/dist/pane-model.d.ts.map +1 -0
  27. package/node_modules/@parasor/shared/dist/pane-model.js +89 -0
  28. package/node_modules/@parasor/shared/dist/pane-model.js.map +1 -0
  29. package/node_modules/@parasor/shared/dist/panes.d.ts +33 -0
  30. package/node_modules/@parasor/shared/dist/panes.d.ts.map +1 -0
  31. package/node_modules/@parasor/shared/dist/panes.js +2 -0
  32. package/node_modules/@parasor/shared/dist/panes.js.map +1 -0
  33. package/node_modules/@parasor/shared/dist/runtime.d.ts +180 -0
  34. package/node_modules/@parasor/shared/dist/runtime.d.ts.map +1 -0
  35. package/node_modules/@parasor/shared/dist/runtime.js +2 -0
  36. package/node_modules/@parasor/shared/dist/runtime.js.map +1 -0
  37. package/node_modules/@parasor/shared/dist/state.d.ts +192 -0
  38. package/node_modules/@parasor/shared/dist/state.d.ts.map +1 -0
  39. package/node_modules/@parasor/shared/dist/state.js +10 -0
  40. package/node_modules/@parasor/shared/dist/state.js.map +1 -0
  41. package/node_modules/@parasor/shared/dist/terminal.d.ts +191 -0
  42. package/node_modules/@parasor/shared/dist/terminal.d.ts.map +1 -0
  43. package/node_modules/@parasor/shared/dist/terminal.js +174 -0
  44. package/node_modules/@parasor/shared/dist/terminal.js.map +1 -0
  45. package/node_modules/@parasor/shared/dist/types.d.ts +13 -0
  46. package/node_modules/@parasor/shared/dist/types.d.ts.map +1 -0
  47. package/node_modules/@parasor/shared/dist/types.js +13 -0
  48. package/node_modules/@parasor/shared/dist/types.js.map +1 -0
  49. package/node_modules/@parasor/shared/dist/worktree-local-files.d.ts +14 -0
  50. package/node_modules/@parasor/shared/dist/worktree-local-files.d.ts.map +1 -0
  51. package/node_modules/@parasor/shared/dist/worktree-local-files.js +41 -0
  52. package/node_modules/@parasor/shared/dist/worktree-local-files.js.map +1 -0
  53. package/node_modules/@parasor/shared/dist/ws-events.d.ts +152 -0
  54. package/node_modules/@parasor/shared/dist/ws-events.d.ts.map +1 -0
  55. package/node_modules/@parasor/shared/dist/ws-events.js +2 -0
  56. package/node_modules/@parasor/shared/dist/ws-events.js.map +1 -0
  57. package/node_modules/@parasor/shared/package.json +13 -0
  58. package/package.json +61 -0
  59. package/server/agent-detector/agent-state-store.d.ts +23 -0
  60. package/server/agent-detector/agent-state-store.d.ts.map +1 -0
  61. package/server/agent-detector/agent-state-store.js +110 -0
  62. package/server/agent-detector/agent-state-store.js.map +1 -0
  63. package/server/agent-detector/detector.d.ts +80 -0
  64. package/server/agent-detector/detector.d.ts.map +1 -0
  65. package/server/agent-detector/detector.js +219 -0
  66. package/server/agent-detector/detector.js.map +1 -0
  67. package/server/agent-detector/event-map.d.ts +25 -0
  68. package/server/agent-detector/event-map.d.ts.map +1 -0
  69. package/server/agent-detector/event-map.js +136 -0
  70. package/server/agent-detector/event-map.js.map +1 -0
  71. package/server/agent-detector/manual-agent-tracker.d.ts +19 -0
  72. package/server/agent-detector/manual-agent-tracker.d.ts.map +1 -0
  73. package/server/agent-detector/manual-agent-tracker.js +123 -0
  74. package/server/agent-detector/manual-agent-tracker.js.map +1 -0
  75. package/server/agent-detector/output-eligibility.d.ts +3 -0
  76. package/server/agent-detector/output-eligibility.d.ts.map +1 -0
  77. package/server/agent-detector/output-eligibility.js +39 -0
  78. package/server/agent-detector/output-eligibility.js.map +1 -0
  79. package/server/application/files/errors.d.ts +28 -0
  80. package/server/application/files/errors.d.ts.map +1 -0
  81. package/server/application/files/errors.js +55 -0
  82. package/server/application/files/errors.js.map +1 -0
  83. package/server/application/files/local-filesystem.d.ts +36 -0
  84. package/server/application/files/local-filesystem.d.ts.map +1 -0
  85. package/server/application/files/local-filesystem.js +171 -0
  86. package/server/application/files/local-filesystem.js.map +1 -0
  87. package/server/application/files/project-file-queries.d.ts +16 -0
  88. package/server/application/files/project-file-queries.d.ts.map +1 -0
  89. package/server/application/files/project-file-queries.js +126 -0
  90. package/server/application/files/project-file-queries.js.map +1 -0
  91. package/server/application/integrations/errors.d.ts +16 -0
  92. package/server/application/integrations/errors.d.ts.map +1 -0
  93. package/server/application/integrations/errors.js +31 -0
  94. package/server/application/integrations/errors.js.map +1 -0
  95. package/server/application/integrations/hook-notify.d.ts +32 -0
  96. package/server/application/integrations/hook-notify.d.ts.map +1 -0
  97. package/server/application/integrations/hook-notify.js +118 -0
  98. package/server/application/integrations/hook-notify.js.map +1 -0
  99. package/server/application/integrations/open-url.d.ts +11 -0
  100. package/server/application/integrations/open-url.d.ts.map +1 -0
  101. package/server/application/integrations/open-url.js +23 -0
  102. package/server/application/integrations/open-url.js.map +1 -0
  103. package/server/application/ports.d.ts +11 -0
  104. package/server/application/ports.d.ts.map +1 -0
  105. package/server/application/ports.js +2 -0
  106. package/server/application/ports.js.map +1 -0
  107. package/server/application/workspace/errors.d.ts +21 -0
  108. package/server/application/workspace/errors.d.ts.map +1 -0
  109. package/server/application/workspace/errors.js +21 -0
  110. package/server/application/workspace/errors.js.map +1 -0
  111. package/server/application/workspace/pane-commands.d.ts +47 -0
  112. package/server/application/workspace/pane-commands.d.ts.map +1 -0
  113. package/server/application/workspace/pane-commands.js +193 -0
  114. package/server/application/workspace/pane-commands.js.map +1 -0
  115. package/server/application/workspace/project-commands.d.ts +34 -0
  116. package/server/application/workspace/project-commands.d.ts.map +1 -0
  117. package/server/application/workspace/project-commands.js +81 -0
  118. package/server/application/workspace/project-commands.js.map +1 -0
  119. package/server/application/workspace/project-queries.d.ts +21 -0
  120. package/server/application/workspace/project-queries.d.ts.map +1 -0
  121. package/server/application/workspace/project-queries.js +216 -0
  122. package/server/application/workspace/project-queries.js.map +1 -0
  123. package/server/application/workspace/session-commands.d.ts +24 -0
  124. package/server/application/workspace/session-commands.d.ts.map +1 -0
  125. package/server/application/workspace/session-commands.js +123 -0
  126. package/server/application/workspace/session-commands.js.map +1 -0
  127. package/server/application/workspace/session-queries.d.ts +14 -0
  128. package/server/application/workspace/session-queries.d.ts.map +1 -0
  129. package/server/application/workspace/session-queries.js +47 -0
  130. package/server/application/workspace/session-queries.js.map +1 -0
  131. package/server/application/workspace/worktree-commands.d.ts +98 -0
  132. package/server/application/workspace/worktree-commands.d.ts.map +1 -0
  133. package/server/application/workspace/worktree-commands.js +323 -0
  134. package/server/application/workspace/worktree-commands.js.map +1 -0
  135. package/server/application/workspace/worktree-local-files.d.ts +11 -0
  136. package/server/application/workspace/worktree-local-files.d.ts.map +1 -0
  137. package/server/application/workspace/worktree-local-files.js +223 -0
  138. package/server/application/workspace/worktree-local-files.js.map +1 -0
  139. package/server/application/workspace/worktree-reconcile.d.ts +21 -0
  140. package/server/application/workspace/worktree-reconcile.d.ts.map +1 -0
  141. package/server/application/workspace/worktree-reconcile.js +49 -0
  142. package/server/application/workspace/worktree-reconcile.js.map +1 -0
  143. package/server/auth/origin.d.ts +17 -0
  144. package/server/auth/origin.d.ts.map +1 -0
  145. package/server/auth/origin.js +93 -0
  146. package/server/auth/origin.js.map +1 -0
  147. package/server/auth/pairing-token.d.ts +28 -0
  148. package/server/auth/pairing-token.d.ts.map +1 -0
  149. package/server/auth/pairing-token.js +46 -0
  150. package/server/auth/pairing-token.js.map +1 -0
  151. package/server/auth/token-exchange.d.ts +11 -0
  152. package/server/auth/token-exchange.d.ts.map +1 -0
  153. package/server/auth/token-exchange.js +27 -0
  154. package/server/auth/token-exchange.js.map +1 -0
  155. package/server/auth/token.d.ts +18 -0
  156. package/server/auth/token.d.ts.map +1 -0
  157. package/server/auth/token.js +115 -0
  158. package/server/auth/token.js.map +1 -0
  159. package/server/bootstrap/create-app-server.d.ts +49 -0
  160. package/server/bootstrap/create-app-server.d.ts.map +1 -0
  161. package/server/bootstrap/create-app-server.js +154 -0
  162. package/server/bootstrap/create-app-server.js.map +1 -0
  163. package/server/bootstrap/project-runtime.d.ts +29 -0
  164. package/server/bootstrap/project-runtime.d.ts.map +1 -0
  165. package/server/bootstrap/project-runtime.js +253 -0
  166. package/server/bootstrap/project-runtime.js.map +1 -0
  167. package/server/bootstrap/pty-env.d.ts +3 -0
  168. package/server/bootstrap/pty-env.d.ts.map +1 -0
  169. package/server/bootstrap/pty-env.js +15 -0
  170. package/server/bootstrap/pty-env.js.map +1 -0
  171. package/server/bootstrap/reconcile-state.d.ts +16 -0
  172. package/server/bootstrap/reconcile-state.d.ts.map +1 -0
  173. package/server/bootstrap/reconcile-state.js +73 -0
  174. package/server/bootstrap/reconcile-state.js.map +1 -0
  175. package/server/bootstrap/runtime-loops.d.ts +51 -0
  176. package/server/bootstrap/runtime-loops.d.ts.map +1 -0
  177. package/server/bootstrap/runtime-loops.js +189 -0
  178. package/server/bootstrap/runtime-loops.js.map +1 -0
  179. package/server/bootstrap/runtime-port.d.ts +4 -0
  180. package/server/bootstrap/runtime-port.d.ts.map +1 -0
  181. package/server/bootstrap/runtime-port.js +52 -0
  182. package/server/bootstrap/runtime-port.js.map +1 -0
  183. package/server/bootstrap/safety-gate.d.ts +22 -0
  184. package/server/bootstrap/safety-gate.d.ts.map +1 -0
  185. package/server/bootstrap/safety-gate.js +43 -0
  186. package/server/bootstrap/safety-gate.js.map +1 -0
  187. package/server/bootstrap/shutdown-marker.d.ts +35 -0
  188. package/server/bootstrap/shutdown-marker.d.ts.map +1 -0
  189. package/server/bootstrap/shutdown-marker.js +100 -0
  190. package/server/bootstrap/shutdown-marker.js.map +1 -0
  191. package/server/bootstrap/shutdown-runtime.d.ts +62 -0
  192. package/server/bootstrap/shutdown-runtime.d.ts.map +1 -0
  193. package/server/bootstrap/shutdown-runtime.js +66 -0
  194. package/server/bootstrap/shutdown-runtime.js.map +1 -0
  195. package/server/bootstrap/startup-banner.d.ts +34 -0
  196. package/server/bootstrap/startup-banner.d.ts.map +1 -0
  197. package/server/bootstrap/startup-banner.js +114 -0
  198. package/server/bootstrap/startup-banner.js.map +1 -0
  199. package/server/bootstrap/wire-runtime.d.ts +42 -0
  200. package/server/bootstrap/wire-runtime.d.ts.map +1 -0
  201. package/server/bootstrap/wire-runtime.js +205 -0
  202. package/server/bootstrap/wire-runtime.js.map +1 -0
  203. package/server/cli/help.d.ts +3 -0
  204. package/server/cli/help.d.ts.map +1 -0
  205. package/server/cli/help.js +39 -0
  206. package/server/cli/help.js.map +1 -0
  207. package/server/cli/hook-client.d.ts +12 -0
  208. package/server/cli/hook-client.d.ts.map +1 -0
  209. package/server/cli/hook-client.js +81 -0
  210. package/server/cli/hook-client.js.map +1 -0
  211. package/server/cli/hook.d.ts +3 -0
  212. package/server/cli/hook.d.ts.map +1 -0
  213. package/server/cli/hook.js +152 -0
  214. package/server/cli/hook.js.map +1 -0
  215. package/server/cli/main.d.ts +2 -0
  216. package/server/cli/main.d.ts.map +1 -0
  217. package/server/cli/main.js +133 -0
  218. package/server/cli/main.js.map +1 -0
  219. package/server/cli/notify.d.ts +19 -0
  220. package/server/cli/notify.d.ts.map +1 -0
  221. package/server/cli/notify.js +77 -0
  222. package/server/cli/notify.js.map +1 -0
  223. package/server/cli/open.d.ts +2 -0
  224. package/server/cli/open.d.ts.map +1 -0
  225. package/server/cli/open.js +47 -0
  226. package/server/cli/open.js.map +1 -0
  227. package/server/cli/probe-daemon-version.d.ts +46 -0
  228. package/server/cli/probe-daemon-version.d.ts.map +1 -0
  229. package/server/cli/probe-daemon-version.js +167 -0
  230. package/server/cli/probe-daemon-version.js.map +1 -0
  231. package/server/cli/pty-host.d.ts +36 -0
  232. package/server/cli/pty-host.d.ts.map +1 -0
  233. package/server/cli/pty-host.js +390 -0
  234. package/server/cli/pty-host.js.map +1 -0
  235. package/server/cli/qr.d.ts +2 -0
  236. package/server/cli/qr.d.ts.map +1 -0
  237. package/server/cli/qr.js +70 -0
  238. package/server/cli/qr.js.map +1 -0
  239. package/server/cli/restart-confirm.d.ts +33 -0
  240. package/server/cli/restart-confirm.d.ts.map +1 -0
  241. package/server/cli/restart-confirm.js +107 -0
  242. package/server/cli/restart-confirm.js.map +1 -0
  243. package/server/cli/restart.d.ts +17 -0
  244. package/server/cli/restart.d.ts.map +1 -0
  245. package/server/cli/restart.js +145 -0
  246. package/server/cli/restart.js.map +1 -0
  247. package/server/cli/service-darwin.d.ts +70 -0
  248. package/server/cli/service-darwin.d.ts.map +1 -0
  249. package/server/cli/service-darwin.js +562 -0
  250. package/server/cli/service-darwin.js.map +1 -0
  251. package/server/cli/service-linux.d.ts +81 -0
  252. package/server/cli/service-linux.d.ts.map +1 -0
  253. package/server/cli/service-linux.js +412 -0
  254. package/server/cli/service-linux.js.map +1 -0
  255. package/server/cli/service.d.ts +33 -0
  256. package/server/cli/service.d.ts.map +1 -0
  257. package/server/cli/service.js +133 -0
  258. package/server/cli/service.js.map +1 -0
  259. package/server/cli/shim-installer.d.ts +35 -0
  260. package/server/cli/shim-installer.d.ts.map +1 -0
  261. package/server/cli/shim-installer.js +662 -0
  262. package/server/cli/shim-installer.js.map +1 -0
  263. package/server/cli/shim-open.d.ts +2 -0
  264. package/server/cli/shim-open.d.ts.map +1 -0
  265. package/server/cli/shim-open.js +128 -0
  266. package/server/cli/shim-open.js.map +1 -0
  267. package/server/cli/shutdown-deps.d.ts +41 -0
  268. package/server/cli/shutdown-deps.d.ts.map +1 -0
  269. package/server/cli/shutdown-deps.js +158 -0
  270. package/server/cli/shutdown-deps.js.map +1 -0
  271. package/server/cli/stop.d.ts +11 -0
  272. package/server/cli/stop.d.ts.map +1 -0
  273. package/server/cli/stop.js +123 -0
  274. package/server/cli/stop.js.map +1 -0
  275. package/server/cli/unknown-command.d.ts +8 -0
  276. package/server/cli/unknown-command.d.ts.map +1 -0
  277. package/server/cli/unknown-command.js +14 -0
  278. package/server/cli/unknown-command.js.map +1 -0
  279. package/server/debug/agent-status-recorder.d.ts +57 -0
  280. package/server/debug/agent-status-recorder.d.ts.map +1 -0
  281. package/server/debug/agent-status-recorder.js +209 -0
  282. package/server/debug/agent-status-recorder.js.map +1 -0
  283. package/server/debug/terminal-trace-recorder.d.ts +41 -0
  284. package/server/debug/terminal-trace-recorder.d.ts.map +1 -0
  285. package/server/debug/terminal-trace-recorder.js +112 -0
  286. package/server/debug/terminal-trace-recorder.js.map +1 -0
  287. package/server/fonts/catalog.d.ts +35 -0
  288. package/server/fonts/catalog.d.ts.map +1 -0
  289. package/server/fonts/catalog.js +76 -0
  290. package/server/fonts/catalog.js.map +1 -0
  291. package/server/fonts/installer.d.ts +45 -0
  292. package/server/fonts/installer.d.ts.map +1 -0
  293. package/server/fonts/installer.js +201 -0
  294. package/server/fonts/installer.js.map +1 -0
  295. package/server/fonts/routes.d.ts +4 -0
  296. package/server/fonts/routes.d.ts.map +1 -0
  297. package/server/fonts/routes.js +91 -0
  298. package/server/fonts/routes.js.map +1 -0
  299. package/server/fs/drops.d.ts +50 -0
  300. package/server/fs/drops.d.ts.map +1 -0
  301. package/server/fs/drops.js +137 -0
  302. package/server/fs/drops.js.map +1 -0
  303. package/server/fs/file-uploads.d.ts +57 -0
  304. package/server/fs/file-uploads.d.ts.map +1 -0
  305. package/server/fs/file-uploads.js +214 -0
  306. package/server/fs/file-uploads.js.map +1 -0
  307. package/server/fs/file-watcher.d.ts +22 -0
  308. package/server/fs/file-watcher.d.ts.map +1 -0
  309. package/server/fs/file-watcher.js +105 -0
  310. package/server/fs/file-watcher.js.map +1 -0
  311. package/server/fs/git-watcher.d.ts +76 -0
  312. package/server/fs/git-watcher.d.ts.map +1 -0
  313. package/server/fs/git-watcher.js +356 -0
  314. package/server/fs/git-watcher.js.map +1 -0
  315. package/server/fs/media.d.ts +35 -0
  316. package/server/fs/media.d.ts.map +1 -0
  317. package/server/fs/media.js +271 -0
  318. package/server/fs/media.js.map +1 -0
  319. package/server/fs/service.d.ts +97 -0
  320. package/server/fs/service.d.ts.map +1 -0
  321. package/server/fs/service.js +306 -0
  322. package/server/fs/service.js.map +1 -0
  323. package/server/fs/upload-staging.d.ts +76 -0
  324. package/server/fs/upload-staging.d.ts.map +1 -0
  325. package/server/fs/upload-staging.js +283 -0
  326. package/server/fs/upload-staging.js.map +1 -0
  327. package/server/fs/watcher-lifecycle.d.ts +24 -0
  328. package/server/fs/watcher-lifecycle.d.ts.map +1 -0
  329. package/server/fs/watcher-lifecycle.js +105 -0
  330. package/server/fs/watcher-lifecycle.js.map +1 -0
  331. package/server/index.d.ts +17 -0
  332. package/server/index.d.ts.map +1 -0
  333. package/server/index.js +510 -0
  334. package/server/index.js.map +1 -0
  335. package/server/ipc/socket-server.d.ts +28 -0
  336. package/server/ipc/socket-server.d.ts.map +1 -0
  337. package/server/ipc/socket-server.js +206 -0
  338. package/server/ipc/socket-server.js.map +1 -0
  339. package/server/lib/git-exec.d.ts +38 -0
  340. package/server/lib/git-exec.d.ts.map +1 -0
  341. package/server/lib/git-exec.js +96 -0
  342. package/server/lib/git-exec.js.map +1 -0
  343. package/server/lib/open-in-ide.d.ts +22 -0
  344. package/server/lib/open-in-ide.d.ts.map +1 -0
  345. package/server/lib/open-in-ide.js +90 -0
  346. package/server/lib/open-in-ide.js.map +1 -0
  347. package/server/lib/open-in-os.d.ts +20 -0
  348. package/server/lib/open-in-os.d.ts.map +1 -0
  349. package/server/lib/open-in-os.js +51 -0
  350. package/server/lib/open-in-os.js.map +1 -0
  351. package/server/lib/path.d.ts +2 -0
  352. package/server/lib/path.d.ts.map +1 -0
  353. package/server/lib/path.js +10 -0
  354. package/server/lib/path.js.map +1 -0
  355. package/server/lib/promise-mutex.d.ts +7 -0
  356. package/server/lib/promise-mutex.d.ts.map +1 -0
  357. package/server/lib/promise-mutex.js +26 -0
  358. package/server/lib/promise-mutex.js.map +1 -0
  359. package/server/lib/sd-notify.d.ts +8 -0
  360. package/server/lib/sd-notify.d.ts.map +1 -0
  361. package/server/lib/sd-notify.js +27 -0
  362. package/server/lib/sd-notify.js.map +1 -0
  363. package/server/net/local-machine.d.ts +7 -0
  364. package/server/net/local-machine.d.ts.map +1 -0
  365. package/server/net/local-machine.js +79 -0
  366. package/server/net/local-machine.js.map +1 -0
  367. package/server/net/reachable-host.d.ts +12 -0
  368. package/server/net/reachable-host.d.ts.map +1 -0
  369. package/server/net/reachable-host.js +25 -0
  370. package/server/net/reachable-host.js.map +1 -0
  371. package/server/network/endpoints.d.ts +14 -0
  372. package/server/network/endpoints.d.ts.map +1 -0
  373. package/server/network/endpoints.js +104 -0
  374. package/server/network/endpoints.js.map +1 -0
  375. package/server/network/qr.d.ts +16 -0
  376. package/server/network/qr.d.ts.map +1 -0
  377. package/server/network/qr.js +89 -0
  378. package/server/network/qr.js.map +1 -0
  379. package/server/port-forwarder/forwarder.d.ts +47 -0
  380. package/server/port-forwarder/forwarder.d.ts.map +1 -0
  381. package/server/port-forwarder/forwarder.js +159 -0
  382. package/server/port-forwarder/forwarder.js.map +1 -0
  383. package/server/port-scanner/scanner.d.ts +24 -0
  384. package/server/port-scanner/scanner.d.ts.map +1 -0
  385. package/server/port-scanner/scanner.js +193 -0
  386. package/server/port-scanner/scanner.js.map +1 -0
  387. package/server/pty/connection-lifecycle.d.ts +50 -0
  388. package/server/pty/connection-lifecycle.d.ts.map +1 -0
  389. package/server/pty/connection-lifecycle.js +113 -0
  390. package/server/pty/connection-lifecycle.js.map +1 -0
  391. package/server/pty/daemon-connect.d.ts +52 -0
  392. package/server/pty/daemon-connect.d.ts.map +1 -0
  393. package/server/pty/daemon-connect.js +62 -0
  394. package/server/pty/daemon-connect.js.map +1 -0
  395. package/server/pty/handshake-timeout-race.d.ts +22 -0
  396. package/server/pty/handshake-timeout-race.d.ts.map +1 -0
  397. package/server/pty/handshake-timeout-race.js +23 -0
  398. package/server/pty/handshake-timeout-race.js.map +1 -0
  399. package/server/pty/headless-replay-snapshot.d.ts +28 -0
  400. package/server/pty/headless-replay-snapshot.d.ts.map +1 -0
  401. package/server/pty/headless-replay-snapshot.js +285 -0
  402. package/server/pty/headless-replay-snapshot.js.map +1 -0
  403. package/server/pty/headless-terminal-state-cache.d.ts +31 -0
  404. package/server/pty/headless-terminal-state-cache.d.ts.map +1 -0
  405. package/server/pty/headless-terminal-state-cache.js +119 -0
  406. package/server/pty/headless-terminal-state-cache.js.map +1 -0
  407. package/server/pty/hello-ack-validator.d.ts +15 -0
  408. package/server/pty/hello-ack-validator.d.ts.map +1 -0
  409. package/server/pty/hello-ack-validator.js +30 -0
  410. package/server/pty/hello-ack-validator.js.map +1 -0
  411. package/server/pty/host-daemon/bootstrap.d.ts +100 -0
  412. package/server/pty/host-daemon/bootstrap.d.ts.map +1 -0
  413. package/server/pty/host-daemon/bootstrap.js +611 -0
  414. package/server/pty/host-daemon/bootstrap.js.map +1 -0
  415. package/server/pty/host-daemon/daemon.d.ts +111 -0
  416. package/server/pty/host-daemon/daemon.d.ts.map +1 -0
  417. package/server/pty/host-daemon/daemon.js +648 -0
  418. package/server/pty/host-daemon/daemon.js.map +1 -0
  419. package/server/pty/host-daemon/entry.d.ts +3 -0
  420. package/server/pty/host-daemon/entry.d.ts.map +1 -0
  421. package/server/pty/host-daemon/entry.js +72 -0
  422. package/server/pty/host-daemon/entry.js.map +1 -0
  423. package/server/pty/host-daemon/lockfile.d.ts +12 -0
  424. package/server/pty/host-daemon/lockfile.d.ts.map +1 -0
  425. package/server/pty/host-daemon/lockfile.js +120 -0
  426. package/server/pty/host-daemon/lockfile.js.map +1 -0
  427. package/server/pty/host-daemon/mode-marker.d.ts +77 -0
  428. package/server/pty/host-daemon/mode-marker.d.ts.map +1 -0
  429. package/server/pty/host-daemon/mode-marker.js +228 -0
  430. package/server/pty/host-daemon/mode-marker.js.map +1 -0
  431. package/server/pty/host-daemon/orphan-cleanup.d.ts +42 -0
  432. package/server/pty/host-daemon/orphan-cleanup.d.ts.map +1 -0
  433. package/server/pty/host-daemon/orphan-cleanup.js +84 -0
  434. package/server/pty/host-daemon/orphan-cleanup.js.map +1 -0
  435. package/server/pty/host-daemon/paths.d.ts +10 -0
  436. package/server/pty/host-daemon/paths.d.ts.map +1 -0
  437. package/server/pty/host-daemon/paths.js +56 -0
  438. package/server/pty/host-daemon/paths.js.map +1 -0
  439. package/server/pty/host-daemon/server-connection.d.ts +44 -0
  440. package/server/pty/host-daemon/server-connection.d.ts.map +1 -0
  441. package/server/pty/host-daemon/server-connection.js +100 -0
  442. package/server/pty/host-daemon/server-connection.js.map +1 -0
  443. package/server/pty/host-daemon/service-detection.d.ts +24 -0
  444. package/server/pty/host-daemon/service-detection.d.ts.map +1 -0
  445. package/server/pty/host-daemon/service-detection.js +16 -0
  446. package/server/pty/host-daemon/service-detection.js.map +1 -0
  447. package/server/pty/host-daemon/socket-ready.d.ts +22 -0
  448. package/server/pty/host-daemon/socket-ready.d.ts.map +1 -0
  449. package/server/pty/host-daemon/socket-ready.js +33 -0
  450. package/server/pty/host-daemon/socket-ready.js.map +1 -0
  451. package/server/pty/host-daemon/spawn-daemon.d.ts +45 -0
  452. package/server/pty/host-daemon/spawn-daemon.d.ts.map +1 -0
  453. package/server/pty/host-daemon/spawn-daemon.js +155 -0
  454. package/server/pty/host-daemon/spawn-daemon.js.map +1 -0
  455. package/server/pty/host-daemon/terminate-daemon.d.ts +16 -0
  456. package/server/pty/host-daemon/terminate-daemon.d.ts.map +1 -0
  457. package/server/pty/host-daemon/terminate-daemon.js +128 -0
  458. package/server/pty/host-daemon/terminate-daemon.js.map +1 -0
  459. package/server/pty/host-protocol/frames.d.ts +110 -0
  460. package/server/pty/host-protocol/frames.d.ts.map +1 -0
  461. package/server/pty/host-protocol/frames.js +255 -0
  462. package/server/pty/host-protocol/frames.js.map +1 -0
  463. package/server/pty/host-protocol/messages.d.ts +140 -0
  464. package/server/pty/host-protocol/messages.d.ts.map +1 -0
  465. package/server/pty/host-protocol/messages.js +117 -0
  466. package/server/pty/host-protocol/messages.js.map +1 -0
  467. package/server/pty/host.d.ts +273 -0
  468. package/server/pty/host.d.ts.map +1 -0
  469. package/server/pty/host.js +184 -0
  470. package/server/pty/host.js.map +1 -0
  471. package/server/pty/in-process-host.d.ts +224 -0
  472. package/server/pty/in-process-host.d.ts.map +1 -0
  473. package/server/pty/in-process-host.js +1183 -0
  474. package/server/pty/in-process-host.js.map +1 -0
  475. package/server/pty/osc7-lifecycle.d.ts +8 -0
  476. package/server/pty/osc7-lifecycle.d.ts.map +1 -0
  477. package/server/pty/osc7-lifecycle.js +22 -0
  478. package/server/pty/osc7-lifecycle.js.map +1 -0
  479. package/server/pty/osc7-parser.d.ts +23 -0
  480. package/server/pty/osc7-parser.d.ts.map +1 -0
  481. package/server/pty/osc7-parser.js +91 -0
  482. package/server/pty/osc7-parser.js.map +1 -0
  483. package/server/pty/remote-host.d.ts +188 -0
  484. package/server/pty/remote-host.d.ts.map +1 -0
  485. package/server/pty/remote-host.js +810 -0
  486. package/server/pty/remote-host.js.map +1 -0
  487. package/server/pty/request-correlator.d.ts +59 -0
  488. package/server/pty/request-correlator.d.ts.map +1 -0
  489. package/server/pty/request-correlator.js +75 -0
  490. package/server/pty/request-correlator.js.map +1 -0
  491. package/server/pty/scrollback-log.d.ts +130 -0
  492. package/server/pty/scrollback-log.d.ts.map +1 -0
  493. package/server/pty/scrollback-log.js +344 -0
  494. package/server/pty/scrollback-log.js.map +1 -0
  495. package/server/pty/scrollback-sanitize.d.ts +2 -0
  496. package/server/pty/scrollback-sanitize.d.ts.map +1 -0
  497. package/server/pty/scrollback-sanitize.js +54 -0
  498. package/server/pty/scrollback-sanitize.js.map +1 -0
  499. package/server/pty/session-mirror.d.ts +67 -0
  500. package/server/pty/session-mirror.d.ts.map +1 -0
  501. package/server/pty/session-mirror.js +112 -0
  502. package/server/pty/session-mirror.js.map +1 -0
  503. package/server/pty/session-policy.d.ts +85 -0
  504. package/server/pty/session-policy.d.ts.map +1 -0
  505. package/server/pty/session-policy.js +186 -0
  506. package/server/pty/session-policy.js.map +1 -0
  507. package/server/pty/version-mismatch-recovery.d.ts +71 -0
  508. package/server/pty/version-mismatch-recovery.d.ts.map +1 -0
  509. package/server/pty/version-mismatch-recovery.js +63 -0
  510. package/server/pty/version-mismatch-recovery.js.map +1 -0
  511. package/server/routes/debug-agent-status.d.ts +5 -0
  512. package/server/routes/debug-agent-status.d.ts.map +1 -0
  513. package/server/routes/debug-agent-status.js +22 -0
  514. package/server/routes/debug-agent-status.js.map +1 -0
  515. package/server/routes/debug-diagnostics.d.ts +8 -0
  516. package/server/routes/debug-diagnostics.d.ts.map +1 -0
  517. package/server/routes/debug-diagnostics.js +34 -0
  518. package/server/routes/debug-diagnostics.js.map +1 -0
  519. package/server/routes/debug-terminal-trace.d.ts +16 -0
  520. package/server/routes/debug-terminal-trace.d.ts.map +1 -0
  521. package/server/routes/debug-terminal-trace.js +545 -0
  522. package/server/routes/debug-terminal-trace.js.map +1 -0
  523. package/server/routes/drops.d.ts +13 -0
  524. package/server/routes/drops.d.ts.map +1 -0
  525. package/server/routes/drops.js +126 -0
  526. package/server/routes/drops.js.map +1 -0
  527. package/server/routes/file-uploads.d.ts +9 -0
  528. package/server/routes/file-uploads.d.ts.map +1 -0
  529. package/server/routes/file-uploads.js +119 -0
  530. package/server/routes/file-uploads.js.map +1 -0
  531. package/server/routes/files.d.ts +9 -0
  532. package/server/routes/files.d.ts.map +1 -0
  533. package/server/routes/files.js +441 -0
  534. package/server/routes/files.js.map +1 -0
  535. package/server/routes/filesystem.d.ts +6 -0
  536. package/server/routes/filesystem.d.ts.map +1 -0
  537. package/server/routes/filesystem.js +76 -0
  538. package/server/routes/filesystem.js.map +1 -0
  539. package/server/routes/git.d.ts +38 -0
  540. package/server/routes/git.d.ts.map +1 -0
  541. package/server/routes/git.js +585 -0
  542. package/server/routes/git.js.map +1 -0
  543. package/server/routes/healthz.d.ts +8 -0
  544. package/server/routes/healthz.d.ts.map +1 -0
  545. package/server/routes/healthz.js +24 -0
  546. package/server/routes/healthz.js.map +1 -0
  547. package/server/routes/hook.d.ts +14 -0
  548. package/server/routes/hook.d.ts.map +1 -0
  549. package/server/routes/hook.js +86 -0
  550. package/server/routes/hook.js.map +1 -0
  551. package/server/routes/ide-commands.d.ts +9 -0
  552. package/server/routes/ide-commands.d.ts.map +1 -0
  553. package/server/routes/ide-commands.js +23 -0
  554. package/server/routes/ide-commands.js.map +1 -0
  555. package/server/routes/lib/resolve-worktree.d.ts +30 -0
  556. package/server/routes/lib/resolve-worktree.d.ts.map +1 -0
  557. package/server/routes/lib/resolve-worktree.js +35 -0
  558. package/server/routes/lib/resolve-worktree.js.map +1 -0
  559. package/server/routes/open.d.ts +4 -0
  560. package/server/routes/open.d.ts.map +1 -0
  561. package/server/routes/open.js +21 -0
  562. package/server/routes/open.js.map +1 -0
  563. package/server/routes/pane-commands.d.ts +9 -0
  564. package/server/routes/pane-commands.d.ts.map +1 -0
  565. package/server/routes/pane-commands.js +23 -0
  566. package/server/routes/pane-commands.js.map +1 -0
  567. package/server/routes/projects.d.ts +15 -0
  568. package/server/routes/projects.d.ts.map +1 -0
  569. package/server/routes/projects.js +363 -0
  570. package/server/routes/projects.js.map +1 -0
  571. package/server/routes/server-notices.d.ts +4 -0
  572. package/server/routes/server-notices.d.ts.map +1 -0
  573. package/server/routes/server-notices.js +29 -0
  574. package/server/routes/server-notices.js.map +1 -0
  575. package/server/routes/service-config.d.ts +11 -0
  576. package/server/routes/service-config.d.ts.map +1 -0
  577. package/server/routes/service-config.js +64 -0
  578. package/server/routes/service-config.js.map +1 -0
  579. package/server/routes/sessions.d.ts +7 -0
  580. package/server/routes/sessions.d.ts.map +1 -0
  581. package/server/routes/sessions.js +218 -0
  582. package/server/routes/sessions.js.map +1 -0
  583. package/server/service/caffeinate.d.ts +33 -0
  584. package/server/service/caffeinate.d.ts.map +1 -0
  585. package/server/service/caffeinate.js +72 -0
  586. package/server/service/caffeinate.js.map +1 -0
  587. package/server/state/app-state.d.ts +167 -0
  588. package/server/state/app-state.d.ts.map +1 -0
  589. package/server/state/app-state.js +335 -0
  590. package/server/state/app-state.js.map +1 -0
  591. package/server/state/project-manager.d.ts +30 -0
  592. package/server/state/project-manager.d.ts.map +1 -0
  593. package/server/state/project-manager.js +128 -0
  594. package/server/state/project-manager.js.map +1 -0
  595. package/server/state/server-notices.d.ts +12 -0
  596. package/server/state/server-notices.d.ts.map +1 -0
  597. package/server/state/server-notices.js +32 -0
  598. package/server/state/server-notices.js.map +1 -0
  599. package/server/state/worktree-cache.d.ts +25 -0
  600. package/server/state/worktree-cache.d.ts.map +1 -0
  601. package/server/state/worktree-cache.js +53 -0
  602. package/server/state/worktree-cache.js.map +1 -0
  603. package/server/ws/events.d.ts +45 -0
  604. package/server/ws/events.d.ts.map +1 -0
  605. package/server/ws/events.js +134 -0
  606. package/server/ws/events.js.map +1 -0
  607. package/server/ws/keepalive.d.ts +27 -0
  608. package/server/ws/keepalive.d.ts.map +1 -0
  609. package/server/ws/keepalive.js +63 -0
  610. package/server/ws/keepalive.js.map +1 -0
  611. package/server/ws/terminal-attach.d.ts +13 -0
  612. package/server/ws/terminal-attach.d.ts.map +1 -0
  613. package/server/ws/terminal-attach.js +233 -0
  614. package/server/ws/terminal-attach.js.map +1 -0
  615. package/server/ws/terminal-flow.d.ts +17 -0
  616. package/server/ws/terminal-flow.d.ts.map +1 -0
  617. package/server/ws/terminal-flow.js +64 -0
  618. package/server/ws/terminal-flow.js.map +1 -0
  619. package/server/ws/terminal.d.ts +69 -0
  620. package/server/ws/terminal.d.ts.map +1 -0
  621. package/server/ws/terminal.js +311 -0
  622. package/server/ws/terminal.js.map +1 -0
  623. package/web/assets/EditorPane-CzzT3iYY.js +123 -0
  624. package/web/assets/SymbolsNerdFontMono-Regular-CwEZqMeU.woff2 +0 -0
  625. package/web/assets/TerminalPane-CjbYzePr.js +68 -0
  626. package/web/assets/TerminalPane-DkTCHfhq.css +1 -0
  627. package/web/assets/file-icons-JBi09j0r.js +6 -0
  628. package/web/assets/index-CTTkRpnn.css +2 -0
  629. package/web/assets/index-CmhewzMp.js +34 -0
  630. package/web/assets/session-resume-7f-tB-ZU.js +2 -0
  631. package/web/assets/terminal-trace-PuuFRybC.js +2803 -0
  632. package/web/assets/useVirtualKeyboard-DgJb9u9d.js +1 -0
  633. package/web/index.html +52 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-daemon.js","sourceRoot":"","sources":["../../../src/pty/host-daemon/spawn-daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;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AKuB;AACvB,SAAS,sBAAsB;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { DaemonPaths } from "./paths.js";
2
+ export type TerminateDaemonOutcome = "no-pidfile" | "already-dead" | "stopped" | "killed-after-timeout" | "still-alive";
3
+ export interface TerminateDaemonResult {
4
+ outcome: TerminateDaemonOutcome;
5
+ pid: number | null;
6
+ }
7
+ export interface TerminateDaemonDeps {
8
+ killProcess: (pid: number, signal: NodeJS.Signals | 0) => boolean;
9
+ readPidFile: (path: string) => number | null;
10
+ unlinkSocket: (path: string) => void;
11
+ unlinkLockFile: (lockFile: string) => void;
12
+ sleep: (ms: number) => Promise<void>;
13
+ now: () => number;
14
+ }
15
+ export declare function terminateDaemon(paths: DaemonPaths, partial?: Partial<TerminateDaemonDeps>): Promise<TerminateDaemonResult>;
16
+ //# sourceMappingURL=terminate-daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminate-daemon.d.ts","sourceRoot":"","sources":["../../../src/pty/host-daemon/terminate-daemon.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM9C,MAAM,MAAM,sBAAsB,GAC9B,YAAY,GACZ,cAAc,GACd,SAAS,GACT,sBAAsB,GACtB,aAAa,CAAC;AAElB,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,sBAAsB,CAAC;IAChC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC;IAClE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC7C,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,GAAG,EAAE,MAAM,MAAM,CAAC;CACnB;AAmDD,wBAAsB,eAAe,CACnC,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACrC,OAAO,CAAC,qBAAqB,CAAC,CA8ChC"}
@@ -0,0 +1,128 @@
1
+ /*
2
+ * daemon protocol mismatch recovery -- server-side daemon force-termination used by the
3
+ * `version-mismatch` auto-recovery path in createPtyHost. The CLI's
4
+ * `stopCmd` is the user-facing entry point; this is the in-process
5
+ * variant the server invokes when handshake NACK proves the running
6
+ * daemon is incompatible with the freshly-installed binary.
7
+ *
8
+ * Behaviour:
9
+ * 1. Read pidfile. Missing -> unlink stale socket + lock, return "no-pidfile".
10
+ * 2. probe `kill(pid, 0)` -- already dead -> unlink socket + lock, return.
11
+ * 3. SIGTERM, poll ≤ SIGTERM_TIMEOUT_MS for the pid to die.
12
+ * 4. Still alive -> SIGKILL, poll ≤ SIGKILL_TIMEOUT_MS.
13
+ * 5. Still alive after SIGKILL -> still unlink socket + lock and return
14
+ * "still-alive". Caller treats this as fatal so the user sees a
15
+ * clear failure, but we leave no stale inodes/lockdir behind that
16
+ * would block a manual `parasor pty-host stop --force` recovery.
17
+ *
18
+ * Why we also break the proper-lockfile directory: a SIGKILLed daemon
19
+ * cannot release its `proper-lockfile` flock, and the stale-mtime
20
+ * window is up to 30s (refresh interval) before the next acquire would
21
+ * succeed. spawnDaemon does not retry on ELOCKED, so without explicit
22
+ * cleanup the immediate post-kill respawn would fail with
23
+ * `DaemonAlreadyRunningError`. We forcibly remove the
24
+ * `<lockFile>.lock` state directory proper-lockfile creates, which is
25
+ * safe because we just confirmed (or attempted to confirm) the holder
26
+ * is dead.
27
+ */
28
+ import { existsSync, readFileSync, rmSync, unlinkSync } from "node:fs";
29
+ const SIGTERM_TIMEOUT_MS = 5_000;
30
+ const SIGKILL_TIMEOUT_MS = 2_000;
31
+ const POLL_INTERVAL_MS = 50;
32
+ function defaultReadPidFile(path) {
33
+ if (!existsSync(path))
34
+ return null;
35
+ try {
36
+ const pid = Number(readFileSync(path, "utf8").trim());
37
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
43
+ function defaultKillProcess(pid, signal) {
44
+ try {
45
+ process.kill(pid, signal);
46
+ return true;
47
+ }
48
+ catch (err) {
49
+ return err.code === "EPERM";
50
+ }
51
+ }
52
+ function defaultUnlinkSocket(path) {
53
+ try {
54
+ unlinkSync(path);
55
+ }
56
+ catch {
57
+ /* ENOENT or owned-by-other-fd; spawnDaemon's lock arbitration owns the rest */
58
+ }
59
+ }
60
+ function defaultUnlinkLockFile(lockFile) {
61
+ // proper-lockfile records its held state as a `<lockFile>.lock` directory
62
+ // (see `acquireDaemonLock` in lockfile.ts). The stamp file at `lockFile`
63
+ // is just a touchpoint we created; the real lock is the directory. Both
64
+ // are safe to remove here because the daemon that owned them is dead
65
+ // (or assumed dead -- this is the force-termination path).
66
+ try {
67
+ rmSync(`${lockFile}.lock`, { recursive: true, force: true });
68
+ }
69
+ catch {
70
+ /* nothing to clean up */
71
+ }
72
+ try {
73
+ unlinkSync(lockFile);
74
+ }
75
+ catch {
76
+ /* nothing to clean up */
77
+ }
78
+ }
79
+ function defaultSleep(ms) {
80
+ return new Promise((r) => setTimeout(r, ms));
81
+ }
82
+ export async function terminateDaemon(paths, partial) {
83
+ const deps = {
84
+ killProcess: partial?.killProcess ?? defaultKillProcess,
85
+ readPidFile: partial?.readPidFile ?? defaultReadPidFile,
86
+ unlinkSocket: partial?.unlinkSocket ?? defaultUnlinkSocket,
87
+ unlinkLockFile: partial?.unlinkLockFile ?? defaultUnlinkLockFile,
88
+ sleep: partial?.sleep ?? defaultSleep,
89
+ now: partial?.now ?? Date.now,
90
+ };
91
+ const cleanup = () => {
92
+ deps.unlinkSocket(paths.socketPath);
93
+ deps.unlinkLockFile(paths.lockFile);
94
+ };
95
+ const pid = deps.readPidFile(paths.pidFile);
96
+ if (pid === null) {
97
+ cleanup();
98
+ return { outcome: "no-pidfile", pid: null };
99
+ }
100
+ if (!deps.killProcess(pid, 0)) {
101
+ cleanup();
102
+ return { outcome: "already-dead", pid };
103
+ }
104
+ deps.killProcess(pid, "SIGTERM");
105
+ const sigtermDeadline = deps.now() + SIGTERM_TIMEOUT_MS;
106
+ while (deps.now() < sigtermDeadline) {
107
+ if (!deps.killProcess(pid, 0)) {
108
+ cleanup();
109
+ return { outcome: "stopped", pid };
110
+ }
111
+ await deps.sleep(POLL_INTERVAL_MS);
112
+ }
113
+ deps.killProcess(pid, "SIGKILL");
114
+ const sigkillDeadline = deps.now() + SIGKILL_TIMEOUT_MS;
115
+ while (deps.now() < sigkillDeadline) {
116
+ if (!deps.killProcess(pid, 0)) {
117
+ cleanup();
118
+ return { outcome: "killed-after-timeout", pid };
119
+ }
120
+ await deps.sleep(POLL_INTERVAL_MS);
121
+ }
122
+ // Surviving SIGKILL is the abort signal for host.ts, but we still
123
+ // sweep socket + lockfile so a manual `parasor pty-host stop --force`
124
+ // afterward does not need to break a stale lock too.
125
+ cleanup();
126
+ return { outcome: "still-alive", pid };
127
+ }
128
+ //# sourceMappingURL=terminate-daemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminate-daemon.js","sourceRoot":"","sources":["../../../src/pty/host-daemon/terminate-daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGvE,MAAM,kB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EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACjC,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;QACrC,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACjC,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,EAAE,CAAC;QAClD,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACrC,CAAC;IACD,kEAAkE;IAClE,sEAAsE;IACtE,qDAAqD;IACrD,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,110 @@
1
+ export declare const FRAME_HEADER_BYTES: number;
2
+ /**
3
+ * Hard cap on payload size. Defends against a malformed/hostile sender
4
+ * advertising a huge `len` and forcing the peer to allocate. 16 MiB is
5
+ * far above any legitimate frame (the largest realistic payload is a
6
+ * scrollback snapshot, which is line-segmented and typically <1 MiB).
7
+ */
8
+ export declare const MAX_PAYLOAD_BYTES: number;
9
+ export declare const FrameType: {
10
+ readonly HELLO: 1;
11
+ readonly HELLO_ACK: 2;
12
+ readonly NACK: 3;
13
+ readonly CREATE_REQ: 16;
14
+ readonly CREATE_ACK: 17;
15
+ readonly RESTART_REQ: 18;
16
+ readonly RESTART_ACK: 19;
17
+ readonly DISPOSE_REQ: 20;
18
+ readonly DISPOSE_ACK: 21;
19
+ readonly DISPOSE_ALL_REQ: 22;
20
+ readonly DISPOSE_ALL_ACK: 23;
21
+ readonly SHUTDOWN_ALL_REQ: 24;
22
+ readonly SHUTDOWN_ALL_ACK: 25;
23
+ readonly INIT_CLIENT_REQ: 26;
24
+ readonly INIT_CLIENT_ACK: 27;
25
+ readonly PERSIST_PROJECT_DOMAINS_REQ: 28;
26
+ readonly PERSIST_PROJECT_DOMAINS_ACK: 29;
27
+ readonly WRITE: 32;
28
+ readonly RESIZE: 33;
29
+ readonly REFRESH: 34;
30
+ readonly DETACH_CLIENT: 35;
31
+ readonly SET_TITLE: 36;
32
+ readonly SET_PINNED: 37;
33
+ readonly SET_PTY_ENV: 38;
34
+ readonly PAUSE_OUTPUT: 39;
35
+ readonly RESUME_OUTPUT: 40;
36
+ readonly DATA: 48;
37
+ readonly SESSION_UPDATE: 49;
38
+ readonly SESSION_LIST: 50;
39
+ readonly SESSION_EXIT: 51;
40
+ readonly SESSION_INPUT: 52;
41
+ };
42
+ export type FrameTypeValue = (typeof FrameType)[keyof typeof FrameType];
43
+ /**
44
+ * Stream-payload frames carry session-routed binary data. Format:
45
+ * `[sessionIdLen:u8][sessionId:utf8][raw bytes]`
46
+ *
47
+ * Avoids JSON+base64 (~33% inflation) and UTF-8 boundary corruption on
48
+ * partial writes. Used by WRITE / DATA / SESSION_INPUT -- every other
49
+ * frame type carries a JSON payload (see `messages.ts`).
50
+ */
51
+ export declare const STREAM_FRAME_TYPES: ReadonlySet<number>;
52
+ /**
53
+ * Generation-tagged stream payload (PTY generation gate). Wire format:
54
+ * `[sessionIdLen:u8][sessionId:utf8][generation:u32 BE][raw bytes]`
55
+ *
56
+ * Used by both directions of the auto-resume race fix:
57
+ * - WRITE (server -> daemon): `generation` tags the PTY generation the
58
+ * client believes is current. Daemon drops on mismatch.
59
+ * - DATA (daemon -> server): `generation` tags the PTY generation that
60
+ * produced this OUTPUT batch. Server forwards to the WS client so
61
+ * the client knows which generation to echo back on subsequent
62
+ * INPUT.
63
+ *
64
+ * Kept separate from `encodeStreamPayload` because SESSION_INPUT does
65
+ * not need a generation tag -- it is a server-side echo for hooks
66
+ * (osc7 / port-detect) and never feeds back into the input gate.
67
+ */
68
+ export declare const STREAM_GENERATION_BYTES = 4;
69
+ export declare function encodeGenerationStreamPayload(sessionId: string, data: Buffer, generation: number): Buffer;
70
+ export declare function decodeGenerationStreamPayload(payload: Buffer): {
71
+ sessionId: string;
72
+ generation: number;
73
+ data: Buffer;
74
+ };
75
+ export declare function encodeStreamPayload(sessionId: string, data: Buffer): Buffer;
76
+ export declare function decodeStreamPayload(payload: Buffer): {
77
+ sessionId: string;
78
+ data: Buffer;
79
+ };
80
+ export interface Frame {
81
+ type: number;
82
+ connectionId: number;
83
+ generation: bigint;
84
+ requestId: number;
85
+ payload: Buffer;
86
+ }
87
+ export declare class FrameError extends Error {
88
+ readonly code: "FRAME_TOO_LARGE" | "FRAME_INVALID";
89
+ constructor(code: "FRAME_TOO_LARGE" | "FRAME_INVALID", message: string);
90
+ }
91
+ export declare function encodeFrame(frame: Frame): Buffer;
92
+ /**
93
+ * Stream-safe frame decoder. Push raw chunks as they arrive on the
94
+ * socket; the parser yields zero or more complete frames per push and
95
+ * keeps any trailing partial frame buffered for the next push.
96
+ *
97
+ * Throws `FrameError("FRAME_TOO_LARGE")` synchronously from `push()` if
98
+ * a peer advertises a length above the cap -- caller MUST close the
99
+ * connection rather than continue draining the buffer.
100
+ */
101
+ export declare class FrameParser {
102
+ private chunks;
103
+ private size;
104
+ push(chunk: Buffer): Frame[];
105
+ /** Bytes currently buffered (partial/unparsed). Useful for diagnostics. */
106
+ bufferedBytes(): number;
107
+ private takeOne;
108
+ private materialize;
109
+ }
110
+ //# sourceMappingURL=frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/pty/host-protocol/frames.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,kBAAkB,QAAgB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAmB,CAAC;AAclD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CZ,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAIjD,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,MAAM,CAgBR;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAoBA;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAa3E;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAiBA;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,UAAW,SAAQ,KAAK;aAEjB,IAAI,EAAE,iBAAiB,GAAG,eAAe;gBAAzC,IAAI,EAAE,iBAAiB,GAAG,eAAe,EACzD,OAAO,EAAE,MAAM;CAKlB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAqChD;AAED;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,IAAI,CAAK;IAEjB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE;IAa5B,2EAA2E;IAC3E,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,OAAO;IAmCf,OAAO,CAAC,WAAW;CAMpB"}
@@ -0,0 +1,255 @@
1
+ /*
2
+ * Wire frame format for the PtyHost daemon IPC.
3
+ *
4
+ * [len:u32be][type:u8][connectionId:u32be][generation:u64be][requestId:u32be][payload]
5
+ *
6
+ * `len` covers everything after itself (type + connectionId + generation +
7
+ * requestId + payload). One TCP/Unix-socket recv may deliver any number
8
+ * of bytes -- fewer than one frame, exactly one, or several plus a partial
9
+ * tail. `FrameParser` buffers raw chunks and yields whole frames only.
10
+ *
11
+ * The envelope is fixed for every frame type. HELLO (the first frame on a
12
+ * fresh connection) uses connectionId=0 / generation=0n / requestId=0
13
+ * because daemon assigns them in HELLO_ACK; subsequent frames carry the
14
+ * assigned triple verbatim, which is what epoch fencing relies on.
15
+ */
16
+ export const FRAME_HEADER_BYTES = 1 + 4 + 8 + 4; // type + connId + generation + reqId
17
+ /**
18
+ * Hard cap on payload size. Defends against a malformed/hostile sender
19
+ * advertising a huge `len` and forcing the peer to allocate. 16 MiB is
20
+ * far above any legitimate frame (the largest realistic payload is a
21
+ * scrollback snapshot, which is line-segmented and typically <1 MiB).
22
+ */
23
+ export const MAX_PAYLOAD_BYTES = 16 * 1024 * 1024;
24
+ /*
25
+ * Frame type registry. Numbering blocks:
26
+ * 0x01-0x0F handshake / control
27
+ * 0x10-0x1F request frames (paired with 0x10|0x01 = ACK pattern below)
28
+ * 0x20-0x2F fire-and-forget mutators (no ack)
29
+ * 0x30-0x3F daemon->server one-way events / streams
30
+ *
31
+ * Per the ack-semantics decision: only Promise<X>-returning PtyHost
32
+ * methods get a request/ACK pair. Sync-returning methods (write/resize/
33
+ * setTitle/setPinned/...) ride on fire-and-forget mutators and rely on
34
+ * SESSION_UPDATE broadcasts to reconcile the optimistic mirror.
35
+ */
36
+ export const FrameType = {
37
+ // 0x01-0x0F handshake / control
38
+ HELLO: 0x01,
39
+ HELLO_ACK: 0x02,
40
+ NACK: 0x03,
41
+ // 0x10-0x1F request -> ack pairs (request awaits ACK with same requestId)
42
+ CREATE_REQ: 0x10,
43
+ CREATE_ACK: 0x11,
44
+ RESTART_REQ: 0x12,
45
+ RESTART_ACK: 0x13,
46
+ DISPOSE_REQ: 0x14,
47
+ DISPOSE_ACK: 0x15,
48
+ DISPOSE_ALL_REQ: 0x16,
49
+ DISPOSE_ALL_ACK: 0x17,
50
+ SHUTDOWN_ALL_REQ: 0x18, // Remote: detach-only (by design). Daemon does NOT kill sessions.
51
+ SHUTDOWN_ALL_ACK: 0x19,
52
+ INIT_CLIENT_REQ: 0x1a,
53
+ INIT_CLIENT_ACK: 0x1b,
54
+ // daemon state ownership -- server forwards project-domain snapshot for daemon to persist
55
+ // (single-writer-of-state.json invariant). Daemon adopts via
56
+ // internalMutate + flush; ACK gates on persistence success.
57
+ PERSIST_PROJECT_DOMAINS_REQ: 0x1c,
58
+ PERSIST_PROJECT_DOMAINS_ACK: 0x1d,
59
+ // 0x20-0x2F fire-and-forget mutators (caller does not await; epoch fencing only)
60
+ WRITE: 0x20,
61
+ RESIZE: 0x21,
62
+ REFRESH: 0x22,
63
+ DETACH_CLIENT: 0x23,
64
+ SET_TITLE: 0x24,
65
+ SET_PINNED: 0x25,
66
+ SET_PTY_ENV: 0x26,
67
+ PAUSE_OUTPUT: 0x27,
68
+ RESUME_OUTPUT: 0x28,
69
+ // 0x30-0x3F daemon -> server events (no ack expected)
70
+ DATA: 0x30,
71
+ SESSION_UPDATE: 0x31,
72
+ SESSION_LIST: 0x32,
73
+ SESSION_EXIT: 0x33,
74
+ SESSION_INPUT: 0x34, // echo of WRITE input for server hooks (osc7 / port detect)
75
+ };
76
+ /**
77
+ * Stream-payload frames carry session-routed binary data. Format:
78
+ * `[sessionIdLen:u8][sessionId:utf8][raw bytes]`
79
+ *
80
+ * Avoids JSON+base64 (~33% inflation) and UTF-8 boundary corruption on
81
+ * partial writes. Used by WRITE / DATA / SESSION_INPUT -- every other
82
+ * frame type carries a JSON payload (see `messages.ts`).
83
+ */
84
+ export const STREAM_FRAME_TYPES = new Set([
85
+ FrameType.WRITE,
86
+ FrameType.DATA,
87
+ FrameType.SESSION_INPUT,
88
+ ]);
89
+ /**
90
+ * Generation-tagged stream payload (PTY generation gate). Wire format:
91
+ * `[sessionIdLen:u8][sessionId:utf8][generation:u32 BE][raw bytes]`
92
+ *
93
+ * Used by both directions of the auto-resume race fix:
94
+ * - WRITE (server -> daemon): `generation` tags the PTY generation the
95
+ * client believes is current. Daemon drops on mismatch.
96
+ * - DATA (daemon -> server): `generation` tags the PTY generation that
97
+ * produced this OUTPUT batch. Server forwards to the WS client so
98
+ * the client knows which generation to echo back on subsequent
99
+ * INPUT.
100
+ *
101
+ * Kept separate from `encodeStreamPayload` because SESSION_INPUT does
102
+ * not need a generation tag -- it is a server-side echo for hooks
103
+ * (osc7 / port-detect) and never feeds back into the input gate.
104
+ */
105
+ export const STREAM_GENERATION_BYTES = 4;
106
+ export function encodeGenerationStreamPayload(sessionId, data, generation) {
107
+ const idBuf = Buffer.from(sessionId, "utf8");
108
+ if (idBuf.length > 0xff) {
109
+ throw new FrameError("FRAME_INVALID", `sessionId byte length ${idBuf.length} exceeds u8 max 255`);
110
+ }
111
+ const out = Buffer.allocUnsafe(1 + idBuf.length + STREAM_GENERATION_BYTES + data.length);
112
+ out.writeUInt8(idBuf.length, 0);
113
+ idBuf.copy(out, 1);
114
+ out.writeUInt32BE(generation >>> 0, 1 + idBuf.length);
115
+ data.copy(out, 1 + idBuf.length + STREAM_GENERATION_BYTES);
116
+ return out;
117
+ }
118
+ export function decodeGenerationStreamPayload(payload) {
119
+ if (payload.length < 1) {
120
+ throw new FrameError("FRAME_INVALID", "generation stream payload missing sessionIdLen");
121
+ }
122
+ const idLen = payload.readUInt8(0);
123
+ if (payload.length < 1 + idLen + STREAM_GENERATION_BYTES) {
124
+ throw new FrameError("FRAME_INVALID", `generation stream payload truncated (need 1+${idLen}+${STREAM_GENERATION_BYTES}, got ${payload.length})`);
125
+ }
126
+ const sessionId = payload.subarray(1, 1 + idLen).toString("utf8");
127
+ const generation = payload.readUInt32BE(1 + idLen);
128
+ const data = Buffer.from(payload.subarray(1 + idLen + STREAM_GENERATION_BYTES));
129
+ return { sessionId, generation, data };
130
+ }
131
+ export function encodeStreamPayload(sessionId, data) {
132
+ const idBuf = Buffer.from(sessionId, "utf8");
133
+ if (idBuf.length > 0xff) {
134
+ throw new FrameError("FRAME_INVALID", `sessionId byte length ${idBuf.length} exceeds u8 max 255`);
135
+ }
136
+ const out = Buffer.allocUnsafe(1 + idBuf.length + data.length);
137
+ out.writeUInt8(idBuf.length, 0);
138
+ idBuf.copy(out, 1);
139
+ data.copy(out, 1 + idBuf.length);
140
+ return out;
141
+ }
142
+ export function decodeStreamPayload(payload) {
143
+ if (payload.length < 1) {
144
+ throw new FrameError("FRAME_INVALID", "stream payload missing sessionIdLen");
145
+ }
146
+ const idLen = payload.readUInt8(0);
147
+ if (payload.length < 1 + idLen) {
148
+ throw new FrameError("FRAME_INVALID", `stream payload truncated (need 1+${idLen}, got ${payload.length})`);
149
+ }
150
+ const sessionId = payload.subarray(1, 1 + idLen).toString("utf8");
151
+ const data = Buffer.from(payload.subarray(1 + idLen));
152
+ return { sessionId, data };
153
+ }
154
+ export class FrameError extends Error {
155
+ code;
156
+ constructor(code, message) {
157
+ super(message);
158
+ this.code = code;
159
+ this.name = "FrameError";
160
+ }
161
+ }
162
+ export function encodeFrame(frame) {
163
+ if (frame.payload.length > MAX_PAYLOAD_BYTES) {
164
+ throw new FrameError("FRAME_TOO_LARGE", `payload size ${frame.payload.length} exceeds cap ${MAX_PAYLOAD_BYTES}`);
165
+ }
166
+ if (frame.type < 0 || frame.type > 0xff) {
167
+ throw new FrameError("FRAME_INVALID", `type ${frame.type} out of u8 range`);
168
+ }
169
+ if (frame.connectionId < 0 || frame.connectionId > 0xffffffff) {
170
+ throw new FrameError("FRAME_INVALID", `connectionId ${frame.connectionId} out of u32 range`);
171
+ }
172
+ if (frame.generation < 0n || frame.generation > 0xffffffffffffffffn) {
173
+ throw new FrameError("FRAME_INVALID", `generation ${frame.generation} out of u64 range`);
174
+ }
175
+ if (frame.requestId < 0 || frame.requestId > 0xffffffff) {
176
+ throw new FrameError("FRAME_INVALID", `requestId ${frame.requestId} out of u32 range`);
177
+ }
178
+ const totalAfterLen = FRAME_HEADER_BYTES + frame.payload.length;
179
+ const buf = Buffer.allocUnsafe(4 + totalAfterLen);
180
+ buf.writeUInt32BE(totalAfterLen, 0);
181
+ buf.writeUInt8(frame.type, 4);
182
+ buf.writeUInt32BE(frame.connectionId, 5);
183
+ buf.writeBigUInt64BE(frame.generation, 9);
184
+ buf.writeUInt32BE(frame.requestId, 17);
185
+ frame.payload.copy(buf, 21);
186
+ return buf;
187
+ }
188
+ /**
189
+ * Stream-safe frame decoder. Push raw chunks as they arrive on the
190
+ * socket; the parser yields zero or more complete frames per push and
191
+ * keeps any trailing partial frame buffered for the next push.
192
+ *
193
+ * Throws `FrameError("FRAME_TOO_LARGE")` synchronously from `push()` if
194
+ * a peer advertises a length above the cap -- caller MUST close the
195
+ * connection rather than continue draining the buffer.
196
+ */
197
+ export class FrameParser {
198
+ chunks = [];
199
+ size = 0;
200
+ push(chunk) {
201
+ if (chunk.length === 0)
202
+ return [];
203
+ this.chunks.push(chunk);
204
+ this.size += chunk.length;
205
+ const out = [];
206
+ for (;;) {
207
+ const frame = this.takeOne();
208
+ if (!frame)
209
+ break;
210
+ out.push(frame);
211
+ }
212
+ return out;
213
+ }
214
+ /** Bytes currently buffered (partial/unparsed). Useful for diagnostics. */
215
+ bufferedBytes() {
216
+ return this.size;
217
+ }
218
+ takeOne() {
219
+ if (this.size < 4)
220
+ return null;
221
+ const buf = this.materialize();
222
+ const totalAfterLen = buf.readUInt32BE(0);
223
+ if (totalAfterLen < FRAME_HEADER_BYTES) {
224
+ throw new FrameError("FRAME_INVALID", `len=${totalAfterLen} smaller than header (${FRAME_HEADER_BYTES})`);
225
+ }
226
+ if (totalAfterLen - FRAME_HEADER_BYTES > MAX_PAYLOAD_BYTES) {
227
+ throw new FrameError("FRAME_TOO_LARGE", `payload size ${totalAfterLen - FRAME_HEADER_BYTES} exceeds cap ${MAX_PAYLOAD_BYTES}`);
228
+ }
229
+ if (buf.length < 4 + totalAfterLen)
230
+ return null;
231
+ const type = buf.readUInt8(4);
232
+ const connectionId = buf.readUInt32BE(5);
233
+ const generation = buf.readBigUInt64BE(9);
234
+ const requestId = buf.readUInt32BE(17);
235
+ const payload = Buffer.from(buf.subarray(21, 4 + totalAfterLen));
236
+ const remainder = buf.subarray(4 + totalAfterLen);
237
+ if (remainder.length > 0) {
238
+ this.chunks = [Buffer.from(remainder)];
239
+ this.size = remainder.length;
240
+ }
241
+ else {
242
+ this.chunks = [];
243
+ this.size = 0;
244
+ }
245
+ return { type, connectionId, generation, requestId, payload };
246
+ }
247
+ materialize() {
248
+ if (this.chunks.length === 1)
249
+ return this.chunks[0];
250
+ const merged = Buffer.concat(this.chunks, this.size);
251
+ this.chunks = [merged];
252
+ return merged;
253
+ }
254
+ }
255
+ //# sourceMappingURL=frames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/pty/host-protocol/frames.ts"],"names":[],"mappings":"AAAA;;;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