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,510 @@
1
+ import { existsSync, mkdirSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { isAbsolute, join, resolve } from "node:path";
4
+ import { serve } from "@hono/node-server";
5
+ import { AgentStateStore } from "./agent-detector/agent-state-store.js";
6
+ import { AgentDetector, } from "./agent-detector/detector.js";
7
+ import { createProjectQueries } from "./application/workspace/project-queries.js";
8
+ import { createWorktreeReconciler } from "./application/workspace/worktree-reconcile.js";
9
+ import { buildAllowedOrigins, normalizeOrigin, parseAllowedOriginsEnv, } from "./auth/origin.js";
10
+ import { PairingTokenStore } from "./auth/pairing-token.js";
11
+ import { TokenAuth } from "./auth/token.js";
12
+ import { createAppServer } from "./bootstrap/create-app-server.js";
13
+ import { createProjectRuntime } from "./bootstrap/project-runtime.js";
14
+ import { buildStaticPtyEnv } from "./bootstrap/pty-env.js";
15
+ import { reconcileStartupState } from "./bootstrap/reconcile-state.js";
16
+ import { startRuntimeLoops } from "./bootstrap/runtime-loops.js";
17
+ import { probePort, removeRuntimeFile, writeRuntimeFile, } from "./bootstrap/runtime-port.js";
18
+ import { enforceSafetyGate, selectBindAddress, } from "./bootstrap/safety-gate.js";
19
+ import { readAndClearShutdownMarker } from "./bootstrap/shutdown-marker.js";
20
+ import { createShutdownHandler, registerShutdownSignals, } from "./bootstrap/shutdown-runtime.js";
21
+ import { printStartupBanner } from "./bootstrap/startup-banner.js";
22
+ import { wireRuntime } from "./bootstrap/wire-runtime.js";
23
+ import { installShims } from "./cli/shim-installer.js";
24
+ import { AgentStatusRecorder } from "./debug/agent-status-recorder.js";
25
+ import { TerminalTraceRecorder } from "./debug/terminal-trace-recorder.js";
26
+ import { removeLegacyDropsDir, UploadStaging } from "./fs/upload-staging.js";
27
+ import { IpcServer } from "./ipc/socket-server.js";
28
+ import { notifyReady, notifyWatchdog } from "./lib/sd-notify.js";
29
+ import { resolveForwarderBindHost } from "./net/reachable-host.js";
30
+ import { checkTailscale, classifyInterfaces, withMagicDNS, } from "./network/endpoints.js";
31
+ import { buildPairingUrl } from "./network/qr.js";
32
+ import { PortForwarder } from "./port-forwarder/forwarder.js";
33
+ import { PortScanner } from "./port-scanner/scanner.js";
34
+ import { createPtyHost, resolvePtyHostMode } from "./pty/host.js";
35
+ import { AppStateOwnerConflictError, acquireAppStateOwnership, markerFileFor, } from "./pty/host-daemon/mode-marker.js";
36
+ import { ScrollbackLog } from "./pty/scrollback-log.js";
37
+ import { CaffeinateController } from "./service/caffeinate.js";
38
+ import { AppStateStore } from "./state/app-state.js";
39
+ import { ProjectManager } from "./state/project-manager.js";
40
+ import { ServerNoticesStore } from "./state/server-notices.js";
41
+ import { WorktreeCache } from "./state/worktree-cache.js";
42
+ import { EventBus } from "./ws/events.js";
43
+ function summarizeDetectorTrace(event) {
44
+ switch (event.kind) {
45
+ case "feed-skip-source":
46
+ return {
47
+ reason: event.kind,
48
+ current: event.current,
49
+ currentLifecycle: event.currentLifecycle,
50
+ };
51
+ case "feed-control-only":
52
+ return { reason: event.kind };
53
+ case "applied-skip-source":
54
+ return {
55
+ reason: event.kind,
56
+ incoming: event.incoming,
57
+ incomingLifecycle: event.incomingLifecycle,
58
+ current: event.current,
59
+ currentLifecycle: event.currentLifecycle,
60
+ };
61
+ case "feed-observed":
62
+ // feed-observed is handled by the detector-feed branch in the
63
+ // onTrace callback and never reaches this serializer; the case is
64
+ // listed so TS exhaustiveness flags a future kind that isn't routed.
65
+ return { reason: event.kind };
66
+ }
67
+ }
68
+ // Web assets -- resolved relative to this file so both the monorepo layout
69
+ // (packages/server/dist/index.js + packages/web/dist) and the packaged layout
70
+ // (dist/server/index.js + dist/web) work without env configuration.
71
+ function resolveWebDistPath() {
72
+ const envOverride = process.env.PARASOR_WEB_DIST;
73
+ if (envOverride)
74
+ return envOverride;
75
+ const candidates = [
76
+ new URL("../../web/dist", import.meta.url).pathname, // monorepo
77
+ new URL("../web", import.meta.url).pathname, // packaged
78
+ ];
79
+ for (const c of candidates) {
80
+ if (existsSync(c))
81
+ return c;
82
+ }
83
+ return candidates[0];
84
+ }
85
+ // Config dir
86
+ const rawConfigDir = process.env.PARASOR_CONFIG_DIR ?? join(homedir(), ".config", "parasor");
87
+ const configDir = resolve(rawConfigDir);
88
+ if (!isAbsolute(configDir))
89
+ throw new Error("PARASOR_CONFIG_DIR must be an absolute path");
90
+ mkdirSync(configDir, { recursive: true });
91
+ // Auth
92
+ const authMode = (process.env.PARASOR_AUTH ?? "token");
93
+ const ephemeral = process.env.PARASOR_EPHEMERAL_TOKEN === "1";
94
+ const tokenAuth = new TokenAuth({ dir: configDir, ephemeral });
95
+ const pairingTokens = new PairingTokenStore();
96
+ // Bind address: explicit (CLI/env) > default 0.0.0.0 (all interfaces).
97
+ // `bin/parasor.ts` translates `--host` into env HOST before we get here.
98
+ const explicitHost = process.env.HOST;
99
+ const hostname = selectBindAddress({ explicit: explicitHost });
100
+ const explicitBind = !!(explicitHost && explicitHost.length > 0);
101
+ enforceSafetyGate({
102
+ authMode,
103
+ bindHost: hostname,
104
+ allowUnsafe: process.env.PARASOR_ALLOW_UNSAFE === "1",
105
+ });
106
+ // IPC
107
+ const ipcServer = new IpcServer({ dir: configDir });
108
+ // Port Scanner + per-port TCP forwarder (Tier A .). One
109
+ // shared instance: `startRuntimeLoops` drives it from port-scan ticks and the
110
+ // `portDetection` setting; `wireRuntime` reads it to enrich the hydration
111
+ // snapshot's ports. Loopback-bound parasor ⇒ inert (no forwarders).
112
+ const portScanner = new PortScanner();
113
+ const portForwarder = new PortForwarder(resolveForwarderBindHost(hostname));
114
+ // Shims
115
+ const shims = installShims(configDir);
116
+ /*
117
+ * Image / file drops attached from the chat composer are persisted under
118
+ * `<rootDir>/uploads/<sessionId>/`, NOT inside any project tree
119
+ * (upload staging isolation). Each PTY only sees its own per-session subdir
120
+ * via the env var `PARASOR_UPLOAD_DIR` injected by
121
+ * `InProcessPtyHost.buildSessionEnv` -- never the shared root -- so an agent
122
+ * runner's `--add-dir` cannot widen one PTY's cwd allowlist to a sibling
123
+ * session's drops.
124
+ *
125
+ * Boot performs an L2 sweep of stale entries (>24h old) to clean up
126
+ * after a SIGKILL'd predecessor that never got to run L1. Awaited so
127
+ * stale entries are gone before any PTY is spawned.
128
+ */
129
+ const uploadStaging = new UploadStaging({
130
+ rootDir: process.env.PARASOR_UPLOAD_ROOT_DIR,
131
+ });
132
+ try {
133
+ const { swept } = await uploadStaging.sweepStale();
134
+ if (swept.length > 0) {
135
+ console.log(`[upload-staging] L2 boot sweep: removed ${swept.length} stale entries`);
136
+ }
137
+ }
138
+ catch (err) {
139
+ console.error("[upload-staging] L2 boot sweep failed:", err);
140
+ }
141
+ /*
142
+ * -- cross-mode mutual exclusion. The marker check
143
+ * runs BEFORE `new AppStateStore` so the store's `load()` (which renames
144
+ * a corrupted state.json out of the way) cannot fire while a live daemon
145
+ * still owns the same `state.json`. *
146
+ * The marker file lives next to `state.json` (i.e. inside `configDir`)
147
+ * so any process that opens the same AppState -- regardless of
148
+ * `XDG_RUNTIME_DIR` or `PARASOR_PTY_SOCK` overrides -- collides on the
149
+ * same marker. In remote mode the daemon owns the marker, so the server
150
+ * skips the write entirely; the `RemotePtyHost.connect()` socket probe
151
+ * is the interlock for that direction.
152
+ */
153
+ const ptyHostMode = resolvePtyHostMode();
154
+ let appStateOwner = null;
155
+ if (ptyHostMode === "in-process") {
156
+ const modeMarkerFile = markerFileFor(configDir);
157
+ try {
158
+ appStateOwner = await acquireAppStateOwnership(modeMarkerFile, "in-process");
159
+ }
160
+ catch (err) {
161
+ if (err instanceof AppStateOwnerConflictError) {
162
+ console.error(err.message);
163
+ process.exit(1);
164
+ }
165
+ throw err;
166
+ }
167
+ }
168
+ // State
169
+ const appStateStore = new AppStateStore({ dir: configDir });
170
+ if (appStateOwner) {
171
+ /*
172
+ * `reconcileStartupState` mutates the store; running it inside the
173
+ * owner-lock gate means a daemon that races for the marker after us
174
+ * cannot observe a half-reconciled state.json. We *also* defer past
175
+ * the in-process branch so remote mode never reconciles --
176
+ * `createPtyHost("remote")` flips the store to read-only and the
177
+ * daemon owns reconciliation in that path (reviewed for correctness).
178
+ */
179
+ await reconcileStartupState(appStateStore);
180
+ }
181
+ // Services
182
+ const scrollbackLog = new ScrollbackLog(configDir);
183
+ // Pick the PTY host implementation from PARASOR_PTY_DAEMON.
184
+ /*
185
+ * In remote mode `createPtyHost()` pivots the AppStateStore session
186
+ * domain into read-only mirror BEFORE returning (daemon state ownership: project /
187
+ * projectStates / serviceConfig stay writable). Any subsequent server-
188
+ * side `mutateSessions()` call (notably `reconcileStartupState`) would
189
+ * throw. That's intentional -- the daemon is the writer for sessions
190
+ * and runs its own orphan reconciliation at boot. The in-process
191
+ * branch above already ran `reconcileStartupState` while the store
192
+ * session domain was still writable.
193
+ */
194
+ /*
195
+ * -- even in-process mode persists SessionRecord
196
+ * so `parasor pty-host doctor` returns a meaningful list regardless of
197
+ * whether the user has opted into the daemon. The (pid, startedAt)
198
+ * tuple identifies *this* server generation; orphan-cleanup at next
199
+ * boot uses it to detect inherited PTYs from a crashed predecessor.
200
+ */
201
+ const ptyHostDaemonContext = {
202
+ pid: process.pid,
203
+ startedAt: new Date().toISOString(),
204
+ };
205
+ const serverNoticesStore = new ServerNoticesStore();
206
+ let ptyManager;
207
+ try {
208
+ ptyManager = await createPtyHost({
209
+ store: appStateStore,
210
+ scrollbackLog,
211
+ daemonContext: ptyHostDaemonContext,
212
+ uploadsDir: uploadStaging.uploadsDir,
213
+ onDaemonAutoRestarted: (detail) => {
214
+ serverNoticesStore.recordDaemonAutoRestarted(detail);
215
+ },
216
+ });
217
+ }
218
+ catch (err) {
219
+ /*
220
+ * daemon protocol mismatch recovery -- keep the failure surface a single user-readable line instead
221
+ * of a node stack trace at module top-level. createPtyHost already
222
+ * translates known cases (handshake-timeout, version-mismatch
223
+ * recovery failures) into actionable Errors; everything else falls
224
+ * through here.
225
+ */
226
+ process.stderr.write(`parasor: failed to start pty host -- ${err.message}\n`);
227
+ process.exit(1);
228
+ }
229
+ ptyManager.setPtyEnv(buildStaticPtyEnv(shims, configDir));
230
+ // PARASOR_UPLOAD_DIR is intentionally NOT here -- InProcessPtyHost
231
+ // injects it per-session in `buildSessionEnv` so each PTY only sees its
232
+ // own subdir (upload staging isolation reviewed for correctness 1).
233
+ const eventBus = new EventBus();
234
+ // Persistent JSONL debug logging is opt-in because hook/debug payloads and
235
+ // detector samples can contain snippets of terminal output. Set
236
+ // PARASOR_AGENT_STATUS_LOG=default to write under configDir, or set it to an
237
+ // absolute/relative path. Empty or unset keeps logs memory-only.
238
+ const debugLogPath = (() => {
239
+ const override = process.env.PARASOR_AGENT_STATUS_LOG;
240
+ if (!override)
241
+ return undefined;
242
+ if (override === "default")
243
+ return join(configDir, "debug", "agent-status.jsonl");
244
+ return isAbsolute(override) ? override : resolve(override);
245
+ })();
246
+ const debugRecorder = new AgentStatusRecorder({ logPath: debugLogPath });
247
+ const terminalTraceRecorder = new TerminalTraceRecorder({
248
+ enabled: process.env.PARASOR_TERMINAL_TRACE === "1",
249
+ });
250
+ const agentDetector = new AgentDetector({
251
+ onTrace: (event) => {
252
+ // Route detector silent-return paths through the same recorder used by
253
+ // /hook/notify so /api/debug/agent-status is the single audit surface.
254
+ if (event.kind === "feed-observed") {
255
+ debugRecorder.record("detector-feed", {
256
+ lifecycle: event.lifecycle,
257
+ sampleTail: event.sampleTail,
258
+ }, event.sessionId);
259
+ return;
260
+ }
261
+ debugRecorder.record("detector-skip", summarizeDetectorTrace(event), event.sessionId);
262
+ },
263
+ });
264
+ const agentStateStore = new AgentStateStore({ dir: configDir });
265
+ const projectManager = new ProjectManager(appStateStore);
266
+ const caffeinate = new CaffeinateController();
267
+ caffeinate.setEnabled(appStateStore.get().serviceConfig.preventIdleSleep);
268
+ caffeinate.setClientCount(eventBus.getClientCount());
269
+ eventBus.onClientCountChanged((count) => caffeinate.setClientCount(count));
270
+ // Detect whether the previous exit was graceful (marker present) or a
271
+ // crash (marker absent). Sessions restored without a prior endReason are
272
+ // labeled accordingly so the UI can decide whether a silent re-spawn is
273
+ // safe or the pane should surface an error instead.
274
+ const wasGracefulShutdown = readAndClearShutdownMarker(configDir);
275
+ // Load persisted sessions into the in-process PTY host
276
+ for (const session of appStateStore.get().sessions) {
277
+ ptyManager.loadPersistedSession(session, wasGracefulShutdown);
278
+ }
279
+ const liveAgentSessionIds = () => ptyManager
280
+ .list()
281
+ .flatMap((session) => (session.state === "ended" ? [] : [session.id]));
282
+ agentDetector.restoreStates(agentStateStore.getStates({ liveSessionIds: liveAgentSessionIds() }));
283
+ agentStateStore.replace(agentDetector.getStates());
284
+ // Prime the worktree cache before wiring so the first WS client sees a
285
+ // fully populated `getWorktrees()` snapshot. Keeping this sync downstream
286
+ // avoids the broadcast/snapshot race that an async `getWorktrees` would
287
+ // reintroduce inside `EventBus.addClient`. The project runtime needs the
288
+ // cache to enumerate per-worktree FileWatchers on activation, so it is
289
+ // created after priming.
290
+ const worktreeCache = new WorktreeCache();
291
+ worktreeCache.setAll(await createProjectQueries({ projectManager }).listAllWorktrees());
292
+ const projectRuntime = createProjectRuntime({
293
+ projectManager,
294
+ eventBus,
295
+ worktreeCache,
296
+ });
297
+ wireRuntime({
298
+ appStateStore,
299
+ eventBus,
300
+ portScanner,
301
+ portForwarder,
302
+ ptyManager,
303
+ agentDetector,
304
+ agentStateStore,
305
+ debugRecorder,
306
+ ipcServer,
307
+ projectManager,
308
+ projectRuntime,
309
+ worktreeCache,
310
+ uploadStaging,
311
+ });
312
+ const projectQueriesForReconcile = createProjectQueries({ projectManager });
313
+ const worktreeReconciler = createWorktreeReconciler({
314
+ projectManager,
315
+ worktreeCache,
316
+ eventBus,
317
+ liveList: async (projectId) => {
318
+ if (!projectManager.get(projectId))
319
+ return null;
320
+ try {
321
+ return await projectQueriesForReconcile.getProjectWorktrees(projectId);
322
+ }
323
+ catch {
324
+ return null;
325
+ }
326
+ },
327
+ });
328
+ const runtimeLoops = startRuntimeLoops({
329
+ appStateStore,
330
+ eventBus,
331
+ portScanner,
332
+ ptyManager,
333
+ projectRuntime,
334
+ uploadStaging,
335
+ portForwarder,
336
+ reconcileWorktrees: (projectId, prefetched) => worktreeReconciler.reconcile(projectId, prefetched),
337
+ });
338
+ projectRuntime.activatePersistedProjects(appStateStore.get().projects.map((project) => project.id));
339
+ /*
340
+ * Upload staging isolation -- retire the in-tree drop layout. For every project we know
341
+ * about, best-effort delete the legacy `<projectRoot>/.parasor/drops/`
342
+ * tree (and the now-empty `.parasor/` namespace). Errors are swallowed
343
+ * (logged) because the dir is already `.gitignore`d and a failed
344
+ * delete is non-fatal.
345
+ */
346
+ for (const project of appStateStore.get().projects) {
347
+ removeLegacyDropsDir(project.path).then(({ removed }) => {
348
+ if (removed) {
349
+ console.log(`[upload-staging] removed legacy .parasor/ from ${project.path}`);
350
+ }
351
+ }, (err) => {
352
+ console.warn(`[upload-staging] removeLegacyDropsDir failed for ${project.path}:`, err);
353
+ });
354
+ }
355
+ const webDistPath = resolveWebDistPath();
356
+ function parseNonNegativeInt(raw, fallback) {
357
+ if (raw === undefined)
358
+ return fallback;
359
+ const parsed = Number(raw);
360
+ if (!Number.isFinite(parsed) || parsed < 0)
361
+ return fallback;
362
+ return Math.floor(parsed);
363
+ }
364
+ const wsPingIntervalMs = parseNonNegativeInt(process.env.PARASOR_WS_PING_INTERVAL_MS, 20_000);
365
+ const wsPongTimeoutMs = parseNonNegativeInt(process.env.PARASOR_WS_PONG_TIMEOUT_MS, 10_000);
366
+ // Server start
367
+ const requestedPort = Number(process.env.PORT ?? 7681);
368
+ await ipcServer.start();
369
+ const port = await probePort(requestedPort, 10, hostname);
370
+ if (port !== requestedPort) {
371
+ console.log(`\nPort ${requestedPort} is in use, falling back to ${port}.`);
372
+ }
373
+ // Now that we know the actual port, expose it to PTY children so the
374
+ // `parasor notify` and `parasor hook` CLIs (called from agent hook
375
+ // scripts) can talk back to /hook/notify over loopback HTTP.
376
+ ptyManager.setPtyEnv({ PARASOR_PORT: String(port) });
377
+ const allowedOrigins = buildAllowedOrigins({
378
+ bindHost: hostname,
379
+ port,
380
+ extra: parseAllowedOriginsEnv(process.env.PARASOR_ALLOWED_ORIGINS),
381
+ });
382
+ const { app, injectWebSocket } = createAppServer({
383
+ authMode,
384
+ tokenAuth,
385
+ pairingTokens,
386
+ ptyManager,
387
+ agentDetector,
388
+ getAgentStates: () => agentStateStore.getStates({ liveSessionIds: liveAgentSessionIds() }),
389
+ debugRecorder,
390
+ terminalTraceRecorder,
391
+ eventBus,
392
+ projectManager,
393
+ appStateStore,
394
+ serverNoticesStore,
395
+ worktreeCache,
396
+ projectRuntime,
397
+ uploadStaging,
398
+ reconcileWorktrees: (projectId, prefetched) => worktreeReconciler.reconcile(projectId, prefetched),
399
+ getFilesystemService: (id, worktreePath) => projectRuntime.getFilesystemService(id, worktreePath),
400
+ webDistPath,
401
+ allowedOrigins,
402
+ wsKeepalive: {
403
+ pingIntervalMs: wsPingIntervalMs,
404
+ pongTimeoutMs: wsPongTimeoutMs,
405
+ },
406
+ onServiceConfigChanged: (config) => {
407
+ caffeinate.setEnabled(config.preventIdleSleep);
408
+ runtimeLoops.onServiceConfigChanged(config);
409
+ },
410
+ });
411
+ /*
412
+ * Runtime file: the single source of truth for "how do local tooling/processes
413
+ * reach this backend?". Written synchronously after listen() confirms and
414
+ * removed on graceful shutdown. The Vite dev proxy and (eventually) Electron
415
+ * main process read this file to route requests to the right port regardless
416
+ * of what auto-bump chose.
417
+ *
418
+ * Remote / Tailscale clients do NOT consume this file -- they pick a URL from
419
+ * the startup banner's classifyInterfaces() output. runtime.json is loopback-
420
+ * only by design (consumers always construct http://127.0.0.1:${port}).
421
+ */
422
+ const runtimeFile = join(configDir, "runtime.json");
423
+ const qrEnabled = process.env.PARASOR_QR !== "0";
424
+ const qrIface = process.env.PARASOR_QR_IFACE || undefined;
425
+ ipcServer.onCommand("qr", async (args) => {
426
+ const ifaceArg = typeof args.iface === "string" && args.iface.length > 0
427
+ ? args.iface
428
+ : undefined;
429
+ const tailscaleStatus = await checkTailscale();
430
+ return {
431
+ ok: true,
432
+ port,
433
+ token: authMode === "token" ? pairingTokens.issue().token : tokenAuth.token,
434
+ tokenKind: authMode === "token" ? "pairing" : "auth",
435
+ authMode,
436
+ endpoints: withMagicDNS(classifyInterfaces(), tailscaleStatus.magicDNS),
437
+ tailscaleStatus,
438
+ iface: ifaceArg,
439
+ };
440
+ });
441
+ const server = serve({ fetch: app.fetch, port, hostname }, async (info) => {
442
+ writeRuntimeFile(runtimeFile, hostname, info.port);
443
+ const tailscaleStatus = await checkTailscale();
444
+ if (tailscaleStatus.magicDNS) {
445
+ // Tailscale MagicDNS hostname is a legitimate Origin for mobile clients
446
+ // that bookmark or manually open the friendly URL. Inject it into the
447
+ // allowlist post-listen so operators don't need PARASOR_ALLOWED_ORIGINS.
448
+ for (const scheme of ["http", "https"]) {
449
+ const origin = normalizeOrigin(`${scheme}://${tailscaleStatus.magicDNS}:${info.port}`);
450
+ if (origin)
451
+ allowedOrigins.add(origin);
452
+ }
453
+ }
454
+ printStartupBanner({
455
+ authMode,
456
+ configDir,
457
+ endpoints: withMagicDNS(classifyInterfaces(), tailscaleStatus.magicDNS),
458
+ port: info.port,
459
+ tailscaleStatus,
460
+ makeAccessUrl: authMode === "token"
461
+ ? (endpoint) => buildPairingUrl(endpoint.address, info.port, pairingTokens.issue().token)
462
+ : undefined,
463
+ token: authMode === "token" ? undefined : tokenAuth.token,
464
+ qr: { enabled: qrEnabled, iface: qrIface },
465
+ bind: { explicit: explicitBind, host: hostname },
466
+ });
467
+ /*
468
+ * Tell systemd the server is up. WatchdogSec=30 in the unit file means
469
+ * we must ping every 30s or systemd assumes we hung. 10s gives us 3x
470
+ * margin per systemd's own recommendation.
471
+ */
472
+ notifyReady();
473
+ });
474
+ /*
475
+ * Hold a reference so the timer isn't GC'd; we clear it on shutdown below.
476
+ */
477
+ const watchdogTimer = setInterval(() => {
478
+ notifyWatchdog();
479
+ }, 10_000);
480
+ watchdogTimer.unref();
481
+ injectWebSocket(server);
482
+ // Graceful shutdown
483
+ const shutdown = createShutdownHandler({
484
+ appStateStore,
485
+ caffeinate,
486
+ configDir,
487
+ ipcServer,
488
+ projectRuntime,
489
+ ptyManager,
490
+ removeRuntime: removeRuntimeFile,
491
+ runtimeFile,
492
+ runtimeLoops,
493
+ releaseModeMarker: appStateOwner
494
+ ? async () => {
495
+ await appStateOwner.release();
496
+ }
497
+ : undefined,
498
+ });
499
+ registerShutdownSignals(shutdown);
500
+ // `parasor restart` sends this. Flush the response before tearing the socket
501
+ // down so the CLI client sees `{ok:true}` rather than an ECONNRESET.
502
+ ipcServer.onCommand("shutdown", () => {
503
+ setImmediate(() => {
504
+ void shutdown();
505
+ });
506
+ return { ok: true };
507
+ });
508
+ // Exports
509
+ export { app, appStateStore, eventBus, ipcServer, portScanner, projectManager, ptyManager, tokenAuth, };
510
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EACL,aAAa,GAEd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACL,SAAS,EACT,iBAAi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AAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjD,CAAC,CAAC;IACH;;;;OAIG;IACH,WAAW,EAAE,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,aAAa,GAAmB,WAAW,CAAC,GAAG,EAAE;IACrD,cAAc,EAAE,CAAC;AACnB,CAAC,EAAE,MAAM,CAAC,CAAC;AACX,aAAa,CAAC,KAAK,EAAE,CAAC;AAEtB,eAAe,CAAC,MAAM,CAAC,CAAC;AAExB,oBAAoB;AAEpB,MAAM,QAAQ,GAAG,qBAAqB,CAAC;IACrC,aAAa;IACb,UAAU;IACV,SAAS;IACT,SAAS;IACT,cAAc;IACd,UAAU;IACV,aAAa,EAAE,iBAAiB;IAChC,WAAW;IACX,YAAY;IACZ,iBAAiB,EAAE,aAAa;QAC9B,CAAC,CAAC,KAAK,IAAI,EAAE;YACT,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;QACH,CAAC,CAAC,SAAS;CACd,CAAC,CAAC;AAEH,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAElC,6EAA6E;AAC7E,qEAAqE;AACrE,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE;IACnC,YAAY,CAAC,GAAG,EAAE;QAChB,KAAK,QAAQ,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEH,UAAU;AAEV,OAAO,EACL,GAAG,EACH,aAAa,EACb,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,GACV,CAAC"}
@@ -0,0 +1,28 @@
1
+ interface IpcResponse {
2
+ ok: boolean;
3
+ error?: string;
4
+ [key: string]: unknown;
5
+ }
6
+ type CommandHandler = (args: Record<string, unknown>) => IpcResponse | Promise<IpcResponse>;
7
+ export declare class IpcServer {
8
+ private server;
9
+ private readonly socketPath;
10
+ private readonly lockPath;
11
+ private lockRelease;
12
+ private readonly handlers;
13
+ constructor(opts: {
14
+ dir: string;
15
+ });
16
+ onCommand(cmd: string, handler: CommandHandler): void;
17
+ start(): Promise<void>;
18
+ stop(): Promise<void>;
19
+ private probeSocket;
20
+ private readHolderPid;
21
+ private formatAlreadyRunningError;
22
+ private releaseLockSafely;
23
+ private handleConnection;
24
+ private processRequest;
25
+ private respond;
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=socket-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket-server.d.ts","sourceRoot":"","sources":["../../src/ipc/socket-server.ts"],"names":[],"mappings":"AAyBA,UAAU,WAAW;IACnB,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,KAAK,cAAc,GAAG,CACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAcxC,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;gBAElD,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IAKjC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI;IAI/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqEtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,yBAAyB;YAiBnB,iBAAiB;IAW/B,OAAO,CAAC,gBAAgB;YAuBV,cAAc;IAuB5B,OAAO,CAAC,OAAO;CAGhB"}