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.
- package/LICENSE +21 -0
- package/README.md +208 -0
- package/THIRD-PARTY-NOTICES.md +138 -0
- package/bin/parasor.mjs +3 -0
- package/node_modules/@parasor/shared/dist/client.d.ts +8 -0
- package/node_modules/@parasor/shared/dist/client.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/client.js +2 -0
- package/node_modules/@parasor/shared/dist/client.js.map +1 -0
- package/node_modules/@parasor/shared/dist/drops.d.ts +24 -0
- package/node_modules/@parasor/shared/dist/drops.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/drops.js +2 -0
- package/node_modules/@parasor/shared/dist/drops.js.map +1 -0
- package/node_modules/@parasor/shared/dist/file-uploads.d.ts +56 -0
- package/node_modules/@parasor/shared/dist/file-uploads.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/file-uploads.js +13 -0
- package/node_modules/@parasor/shared/dist/file-uploads.js.map +1 -0
- package/node_modules/@parasor/shared/dist/ide-commands.d.ts +8 -0
- package/node_modules/@parasor/shared/dist/ide-commands.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/ide-commands.js +59 -0
- package/node_modules/@parasor/shared/dist/ide-commands.js.map +1 -0
- package/node_modules/@parasor/shared/dist/pane-commands.d.ts +7 -0
- package/node_modules/@parasor/shared/dist/pane-commands.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/pane-commands.js +47 -0
- package/node_modules/@parasor/shared/dist/pane-commands.js.map +1 -0
- package/node_modules/@parasor/shared/dist/pane-model.d.ts +63 -0
- package/node_modules/@parasor/shared/dist/pane-model.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/pane-model.js +89 -0
- package/node_modules/@parasor/shared/dist/pane-model.js.map +1 -0
- package/node_modules/@parasor/shared/dist/panes.d.ts +33 -0
- package/node_modules/@parasor/shared/dist/panes.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/panes.js +2 -0
- package/node_modules/@parasor/shared/dist/panes.js.map +1 -0
- package/node_modules/@parasor/shared/dist/runtime.d.ts +180 -0
- package/node_modules/@parasor/shared/dist/runtime.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/runtime.js +2 -0
- package/node_modules/@parasor/shared/dist/runtime.js.map +1 -0
- package/node_modules/@parasor/shared/dist/state.d.ts +192 -0
- package/node_modules/@parasor/shared/dist/state.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/state.js +10 -0
- package/node_modules/@parasor/shared/dist/state.js.map +1 -0
- package/node_modules/@parasor/shared/dist/terminal.d.ts +191 -0
- package/node_modules/@parasor/shared/dist/terminal.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/terminal.js +174 -0
- package/node_modules/@parasor/shared/dist/terminal.js.map +1 -0
- package/node_modules/@parasor/shared/dist/types.d.ts +13 -0
- package/node_modules/@parasor/shared/dist/types.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/types.js +13 -0
- package/node_modules/@parasor/shared/dist/types.js.map +1 -0
- package/node_modules/@parasor/shared/dist/worktree-local-files.d.ts +14 -0
- package/node_modules/@parasor/shared/dist/worktree-local-files.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/worktree-local-files.js +41 -0
- package/node_modules/@parasor/shared/dist/worktree-local-files.js.map +1 -0
- package/node_modules/@parasor/shared/dist/ws-events.d.ts +152 -0
- package/node_modules/@parasor/shared/dist/ws-events.d.ts.map +1 -0
- package/node_modules/@parasor/shared/dist/ws-events.js +2 -0
- package/node_modules/@parasor/shared/dist/ws-events.js.map +1 -0
- package/node_modules/@parasor/shared/package.json +13 -0
- package/package.json +61 -0
- package/server/agent-detector/agent-state-store.d.ts +23 -0
- package/server/agent-detector/agent-state-store.d.ts.map +1 -0
- package/server/agent-detector/agent-state-store.js +110 -0
- package/server/agent-detector/agent-state-store.js.map +1 -0
- package/server/agent-detector/detector.d.ts +80 -0
- package/server/agent-detector/detector.d.ts.map +1 -0
- package/server/agent-detector/detector.js +219 -0
- package/server/agent-detector/detector.js.map +1 -0
- package/server/agent-detector/event-map.d.ts +25 -0
- package/server/agent-detector/event-map.d.ts.map +1 -0
- package/server/agent-detector/event-map.js +136 -0
- package/server/agent-detector/event-map.js.map +1 -0
- package/server/agent-detector/manual-agent-tracker.d.ts +19 -0
- package/server/agent-detector/manual-agent-tracker.d.ts.map +1 -0
- package/server/agent-detector/manual-agent-tracker.js +123 -0
- package/server/agent-detector/manual-agent-tracker.js.map +1 -0
- package/server/agent-detector/output-eligibility.d.ts +3 -0
- package/server/agent-detector/output-eligibility.d.ts.map +1 -0
- package/server/agent-detector/output-eligibility.js +39 -0
- package/server/agent-detector/output-eligibility.js.map +1 -0
- package/server/application/files/errors.d.ts +28 -0
- package/server/application/files/errors.d.ts.map +1 -0
- package/server/application/files/errors.js +55 -0
- package/server/application/files/errors.js.map +1 -0
- package/server/application/files/local-filesystem.d.ts +36 -0
- package/server/application/files/local-filesystem.d.ts.map +1 -0
- package/server/application/files/local-filesystem.js +171 -0
- package/server/application/files/local-filesystem.js.map +1 -0
- package/server/application/files/project-file-queries.d.ts +16 -0
- package/server/application/files/project-file-queries.d.ts.map +1 -0
- package/server/application/files/project-file-queries.js +126 -0
- package/server/application/files/project-file-queries.js.map +1 -0
- package/server/application/integrations/errors.d.ts +16 -0
- package/server/application/integrations/errors.d.ts.map +1 -0
- package/server/application/integrations/errors.js +31 -0
- package/server/application/integrations/errors.js.map +1 -0
- package/server/application/integrations/hook-notify.d.ts +32 -0
- package/server/application/integrations/hook-notify.d.ts.map +1 -0
- package/server/application/integrations/hook-notify.js +118 -0
- package/server/application/integrations/hook-notify.js.map +1 -0
- package/server/application/integrations/open-url.d.ts +11 -0
- package/server/application/integrations/open-url.d.ts.map +1 -0
- package/server/application/integrations/open-url.js +23 -0
- package/server/application/integrations/open-url.js.map +1 -0
- package/server/application/ports.d.ts +11 -0
- package/server/application/ports.d.ts.map +1 -0
- package/server/application/ports.js +2 -0
- package/server/application/ports.js.map +1 -0
- package/server/application/workspace/errors.d.ts +21 -0
- package/server/application/workspace/errors.d.ts.map +1 -0
- package/server/application/workspace/errors.js +21 -0
- package/server/application/workspace/errors.js.map +1 -0
- package/server/application/workspace/pane-commands.d.ts +47 -0
- package/server/application/workspace/pane-commands.d.ts.map +1 -0
- package/server/application/workspace/pane-commands.js +193 -0
- package/server/application/workspace/pane-commands.js.map +1 -0
- package/server/application/workspace/project-commands.d.ts +34 -0
- package/server/application/workspace/project-commands.d.ts.map +1 -0
- package/server/application/workspace/project-commands.js +81 -0
- package/server/application/workspace/project-commands.js.map +1 -0
- package/server/application/workspace/project-queries.d.ts +21 -0
- package/server/application/workspace/project-queries.d.ts.map +1 -0
- package/server/application/workspace/project-queries.js +216 -0
- package/server/application/workspace/project-queries.js.map +1 -0
- package/server/application/workspace/session-commands.d.ts +24 -0
- package/server/application/workspace/session-commands.d.ts.map +1 -0
- package/server/application/workspace/session-commands.js +123 -0
- package/server/application/workspace/session-commands.js.map +1 -0
- package/server/application/workspace/session-queries.d.ts +14 -0
- package/server/application/workspace/session-queries.d.ts.map +1 -0
- package/server/application/workspace/session-queries.js +47 -0
- package/server/application/workspace/session-queries.js.map +1 -0
- package/server/application/workspace/worktree-commands.d.ts +98 -0
- package/server/application/workspace/worktree-commands.d.ts.map +1 -0
- package/server/application/workspace/worktree-commands.js +323 -0
- package/server/application/workspace/worktree-commands.js.map +1 -0
- package/server/application/workspace/worktree-local-files.d.ts +11 -0
- package/server/application/workspace/worktree-local-files.d.ts.map +1 -0
- package/server/application/workspace/worktree-local-files.js +223 -0
- package/server/application/workspace/worktree-local-files.js.map +1 -0
- package/server/application/workspace/worktree-reconcile.d.ts +21 -0
- package/server/application/workspace/worktree-reconcile.d.ts.map +1 -0
- package/server/application/workspace/worktree-reconcile.js +49 -0
- package/server/application/workspace/worktree-reconcile.js.map +1 -0
- package/server/auth/origin.d.ts +17 -0
- package/server/auth/origin.d.ts.map +1 -0
- package/server/auth/origin.js +93 -0
- package/server/auth/origin.js.map +1 -0
- package/server/auth/pairing-token.d.ts +28 -0
- package/server/auth/pairing-token.d.ts.map +1 -0
- package/server/auth/pairing-token.js +46 -0
- package/server/auth/pairing-token.js.map +1 -0
- package/server/auth/token-exchange.d.ts +11 -0
- package/server/auth/token-exchange.d.ts.map +1 -0
- package/server/auth/token-exchange.js +27 -0
- package/server/auth/token-exchange.js.map +1 -0
- package/server/auth/token.d.ts +18 -0
- package/server/auth/token.d.ts.map +1 -0
- package/server/auth/token.js +115 -0
- package/server/auth/token.js.map +1 -0
- package/server/bootstrap/create-app-server.d.ts +49 -0
- package/server/bootstrap/create-app-server.d.ts.map +1 -0
- package/server/bootstrap/create-app-server.js +154 -0
- package/server/bootstrap/create-app-server.js.map +1 -0
- package/server/bootstrap/project-runtime.d.ts +29 -0
- package/server/bootstrap/project-runtime.d.ts.map +1 -0
- package/server/bootstrap/project-runtime.js +253 -0
- package/server/bootstrap/project-runtime.js.map +1 -0
- package/server/bootstrap/pty-env.d.ts +3 -0
- package/server/bootstrap/pty-env.d.ts.map +1 -0
- package/server/bootstrap/pty-env.js +15 -0
- package/server/bootstrap/pty-env.js.map +1 -0
- package/server/bootstrap/reconcile-state.d.ts +16 -0
- package/server/bootstrap/reconcile-state.d.ts.map +1 -0
- package/server/bootstrap/reconcile-state.js +73 -0
- package/server/bootstrap/reconcile-state.js.map +1 -0
- package/server/bootstrap/runtime-loops.d.ts +51 -0
- package/server/bootstrap/runtime-loops.d.ts.map +1 -0
- package/server/bootstrap/runtime-loops.js +189 -0
- package/server/bootstrap/runtime-loops.js.map +1 -0
- package/server/bootstrap/runtime-port.d.ts +4 -0
- package/server/bootstrap/runtime-port.d.ts.map +1 -0
- package/server/bootstrap/runtime-port.js +52 -0
- package/server/bootstrap/runtime-port.js.map +1 -0
- package/server/bootstrap/safety-gate.d.ts +22 -0
- package/server/bootstrap/safety-gate.d.ts.map +1 -0
- package/server/bootstrap/safety-gate.js +43 -0
- package/server/bootstrap/safety-gate.js.map +1 -0
- package/server/bootstrap/shutdown-marker.d.ts +35 -0
- package/server/bootstrap/shutdown-marker.d.ts.map +1 -0
- package/server/bootstrap/shutdown-marker.js +100 -0
- package/server/bootstrap/shutdown-marker.js.map +1 -0
- package/server/bootstrap/shutdown-runtime.d.ts +62 -0
- package/server/bootstrap/shutdown-runtime.d.ts.map +1 -0
- package/server/bootstrap/shutdown-runtime.js +66 -0
- package/server/bootstrap/shutdown-runtime.js.map +1 -0
- package/server/bootstrap/startup-banner.d.ts +34 -0
- package/server/bootstrap/startup-banner.d.ts.map +1 -0
- package/server/bootstrap/startup-banner.js +114 -0
- package/server/bootstrap/startup-banner.js.map +1 -0
- package/server/bootstrap/wire-runtime.d.ts +42 -0
- package/server/bootstrap/wire-runtime.d.ts.map +1 -0
- package/server/bootstrap/wire-runtime.js +205 -0
- package/server/bootstrap/wire-runtime.js.map +1 -0
- package/server/cli/help.d.ts +3 -0
- package/server/cli/help.d.ts.map +1 -0
- package/server/cli/help.js +39 -0
- package/server/cli/help.js.map +1 -0
- package/server/cli/hook-client.d.ts +12 -0
- package/server/cli/hook-client.d.ts.map +1 -0
- package/server/cli/hook-client.js +81 -0
- package/server/cli/hook-client.js.map +1 -0
- package/server/cli/hook.d.ts +3 -0
- package/server/cli/hook.d.ts.map +1 -0
- package/server/cli/hook.js +152 -0
- package/server/cli/hook.js.map +1 -0
- package/server/cli/main.d.ts +2 -0
- package/server/cli/main.d.ts.map +1 -0
- package/server/cli/main.js +133 -0
- package/server/cli/main.js.map +1 -0
- package/server/cli/notify.d.ts +19 -0
- package/server/cli/notify.d.ts.map +1 -0
- package/server/cli/notify.js +77 -0
- package/server/cli/notify.js.map +1 -0
- package/server/cli/open.d.ts +2 -0
- package/server/cli/open.d.ts.map +1 -0
- package/server/cli/open.js +47 -0
- package/server/cli/open.js.map +1 -0
- package/server/cli/probe-daemon-version.d.ts +46 -0
- package/server/cli/probe-daemon-version.d.ts.map +1 -0
- package/server/cli/probe-daemon-version.js +167 -0
- package/server/cli/probe-daemon-version.js.map +1 -0
- package/server/cli/pty-host.d.ts +36 -0
- package/server/cli/pty-host.d.ts.map +1 -0
- package/server/cli/pty-host.js +390 -0
- package/server/cli/pty-host.js.map +1 -0
- package/server/cli/qr.d.ts +2 -0
- package/server/cli/qr.d.ts.map +1 -0
- package/server/cli/qr.js +70 -0
- package/server/cli/qr.js.map +1 -0
- package/server/cli/restart-confirm.d.ts +33 -0
- package/server/cli/restart-confirm.d.ts.map +1 -0
- package/server/cli/restart-confirm.js +107 -0
- package/server/cli/restart-confirm.js.map +1 -0
- package/server/cli/restart.d.ts +17 -0
- package/server/cli/restart.d.ts.map +1 -0
- package/server/cli/restart.js +145 -0
- package/server/cli/restart.js.map +1 -0
- package/server/cli/service-darwin.d.ts +70 -0
- package/server/cli/service-darwin.d.ts.map +1 -0
- package/server/cli/service-darwin.js +562 -0
- package/server/cli/service-darwin.js.map +1 -0
- package/server/cli/service-linux.d.ts +81 -0
- package/server/cli/service-linux.d.ts.map +1 -0
- package/server/cli/service-linux.js +412 -0
- package/server/cli/service-linux.js.map +1 -0
- package/server/cli/service.d.ts +33 -0
- package/server/cli/service.d.ts.map +1 -0
- package/server/cli/service.js +133 -0
- package/server/cli/service.js.map +1 -0
- package/server/cli/shim-installer.d.ts +35 -0
- package/server/cli/shim-installer.d.ts.map +1 -0
- package/server/cli/shim-installer.js +662 -0
- package/server/cli/shim-installer.js.map +1 -0
- package/server/cli/shim-open.d.ts +2 -0
- package/server/cli/shim-open.d.ts.map +1 -0
- package/server/cli/shim-open.js +128 -0
- package/server/cli/shim-open.js.map +1 -0
- package/server/cli/shutdown-deps.d.ts +41 -0
- package/server/cli/shutdown-deps.d.ts.map +1 -0
- package/server/cli/shutdown-deps.js +158 -0
- package/server/cli/shutdown-deps.js.map +1 -0
- package/server/cli/stop.d.ts +11 -0
- package/server/cli/stop.d.ts.map +1 -0
- package/server/cli/stop.js +123 -0
- package/server/cli/stop.js.map +1 -0
- package/server/cli/unknown-command.d.ts +8 -0
- package/server/cli/unknown-command.d.ts.map +1 -0
- package/server/cli/unknown-command.js +14 -0
- package/server/cli/unknown-command.js.map +1 -0
- package/server/debug/agent-status-recorder.d.ts +57 -0
- package/server/debug/agent-status-recorder.d.ts.map +1 -0
- package/server/debug/agent-status-recorder.js +209 -0
- package/server/debug/agent-status-recorder.js.map +1 -0
- package/server/debug/terminal-trace-recorder.d.ts +41 -0
- package/server/debug/terminal-trace-recorder.d.ts.map +1 -0
- package/server/debug/terminal-trace-recorder.js +112 -0
- package/server/debug/terminal-trace-recorder.js.map +1 -0
- package/server/fonts/catalog.d.ts +35 -0
- package/server/fonts/catalog.d.ts.map +1 -0
- package/server/fonts/catalog.js +76 -0
- package/server/fonts/catalog.js.map +1 -0
- package/server/fonts/installer.d.ts +45 -0
- package/server/fonts/installer.d.ts.map +1 -0
- package/server/fonts/installer.js +201 -0
- package/server/fonts/installer.js.map +1 -0
- package/server/fonts/routes.d.ts +4 -0
- package/server/fonts/routes.d.ts.map +1 -0
- package/server/fonts/routes.js +91 -0
- package/server/fonts/routes.js.map +1 -0
- package/server/fs/drops.d.ts +50 -0
- package/server/fs/drops.d.ts.map +1 -0
- package/server/fs/drops.js +137 -0
- package/server/fs/drops.js.map +1 -0
- package/server/fs/file-uploads.d.ts +57 -0
- package/server/fs/file-uploads.d.ts.map +1 -0
- package/server/fs/file-uploads.js +214 -0
- package/server/fs/file-uploads.js.map +1 -0
- package/server/fs/file-watcher.d.ts +22 -0
- package/server/fs/file-watcher.d.ts.map +1 -0
- package/server/fs/file-watcher.js +105 -0
- package/server/fs/file-watcher.js.map +1 -0
- package/server/fs/git-watcher.d.ts +76 -0
- package/server/fs/git-watcher.d.ts.map +1 -0
- package/server/fs/git-watcher.js +356 -0
- package/server/fs/git-watcher.js.map +1 -0
- package/server/fs/media.d.ts +35 -0
- package/server/fs/media.d.ts.map +1 -0
- package/server/fs/media.js +271 -0
- package/server/fs/media.js.map +1 -0
- package/server/fs/service.d.ts +97 -0
- package/server/fs/service.d.ts.map +1 -0
- package/server/fs/service.js +306 -0
- package/server/fs/service.js.map +1 -0
- package/server/fs/upload-staging.d.ts +76 -0
- package/server/fs/upload-staging.d.ts.map +1 -0
- package/server/fs/upload-staging.js +283 -0
- package/server/fs/upload-staging.js.map +1 -0
- package/server/fs/watcher-lifecycle.d.ts +24 -0
- package/server/fs/watcher-lifecycle.d.ts.map +1 -0
- package/server/fs/watcher-lifecycle.js +105 -0
- package/server/fs/watcher-lifecycle.js.map +1 -0
- package/server/index.d.ts +17 -0
- package/server/index.d.ts.map +1 -0
- package/server/index.js +510 -0
- package/server/index.js.map +1 -0
- package/server/ipc/socket-server.d.ts +28 -0
- package/server/ipc/socket-server.d.ts.map +1 -0
- package/server/ipc/socket-server.js +206 -0
- package/server/ipc/socket-server.js.map +1 -0
- package/server/lib/git-exec.d.ts +38 -0
- package/server/lib/git-exec.d.ts.map +1 -0
- package/server/lib/git-exec.js +96 -0
- package/server/lib/git-exec.js.map +1 -0
- package/server/lib/open-in-ide.d.ts +22 -0
- package/server/lib/open-in-ide.d.ts.map +1 -0
- package/server/lib/open-in-ide.js +90 -0
- package/server/lib/open-in-ide.js.map +1 -0
- package/server/lib/open-in-os.d.ts +20 -0
- package/server/lib/open-in-os.d.ts.map +1 -0
- package/server/lib/open-in-os.js +51 -0
- package/server/lib/open-in-os.js.map +1 -0
- package/server/lib/path.d.ts +2 -0
- package/server/lib/path.d.ts.map +1 -0
- package/server/lib/path.js +10 -0
- package/server/lib/path.js.map +1 -0
- package/server/lib/promise-mutex.d.ts +7 -0
- package/server/lib/promise-mutex.d.ts.map +1 -0
- package/server/lib/promise-mutex.js +26 -0
- package/server/lib/promise-mutex.js.map +1 -0
- package/server/lib/sd-notify.d.ts +8 -0
- package/server/lib/sd-notify.d.ts.map +1 -0
- package/server/lib/sd-notify.js +27 -0
- package/server/lib/sd-notify.js.map +1 -0
- package/server/net/local-machine.d.ts +7 -0
- package/server/net/local-machine.d.ts.map +1 -0
- package/server/net/local-machine.js +79 -0
- package/server/net/local-machine.js.map +1 -0
- package/server/net/reachable-host.d.ts +12 -0
- package/server/net/reachable-host.d.ts.map +1 -0
- package/server/net/reachable-host.js +25 -0
- package/server/net/reachable-host.js.map +1 -0
- package/server/network/endpoints.d.ts +14 -0
- package/server/network/endpoints.d.ts.map +1 -0
- package/server/network/endpoints.js +104 -0
- package/server/network/endpoints.js.map +1 -0
- package/server/network/qr.d.ts +16 -0
- package/server/network/qr.d.ts.map +1 -0
- package/server/network/qr.js +89 -0
- package/server/network/qr.js.map +1 -0
- package/server/port-forwarder/forwarder.d.ts +47 -0
- package/server/port-forwarder/forwarder.d.ts.map +1 -0
- package/server/port-forwarder/forwarder.js +159 -0
- package/server/port-forwarder/forwarder.js.map +1 -0
- package/server/port-scanner/scanner.d.ts +24 -0
- package/server/port-scanner/scanner.d.ts.map +1 -0
- package/server/port-scanner/scanner.js +193 -0
- package/server/port-scanner/scanner.js.map +1 -0
- package/server/pty/connection-lifecycle.d.ts +50 -0
- package/server/pty/connection-lifecycle.d.ts.map +1 -0
- package/server/pty/connection-lifecycle.js +113 -0
- package/server/pty/connection-lifecycle.js.map +1 -0
- package/server/pty/daemon-connect.d.ts +52 -0
- package/server/pty/daemon-connect.d.ts.map +1 -0
- package/server/pty/daemon-connect.js +62 -0
- package/server/pty/daemon-connect.js.map +1 -0
- package/server/pty/handshake-timeout-race.d.ts +22 -0
- package/server/pty/handshake-timeout-race.d.ts.map +1 -0
- package/server/pty/handshake-timeout-race.js +23 -0
- package/server/pty/handshake-timeout-race.js.map +1 -0
- package/server/pty/headless-replay-snapshot.d.ts +28 -0
- package/server/pty/headless-replay-snapshot.d.ts.map +1 -0
- package/server/pty/headless-replay-snapshot.js +285 -0
- package/server/pty/headless-replay-snapshot.js.map +1 -0
- package/server/pty/headless-terminal-state-cache.d.ts +31 -0
- package/server/pty/headless-terminal-state-cache.d.ts.map +1 -0
- package/server/pty/headless-terminal-state-cache.js +119 -0
- package/server/pty/headless-terminal-state-cache.js.map +1 -0
- package/server/pty/hello-ack-validator.d.ts +15 -0
- package/server/pty/hello-ack-validator.d.ts.map +1 -0
- package/server/pty/hello-ack-validator.js +30 -0
- package/server/pty/hello-ack-validator.js.map +1 -0
- package/server/pty/host-daemon/bootstrap.d.ts +100 -0
- package/server/pty/host-daemon/bootstrap.d.ts.map +1 -0
- package/server/pty/host-daemon/bootstrap.js +611 -0
- package/server/pty/host-daemon/bootstrap.js.map +1 -0
- package/server/pty/host-daemon/daemon.d.ts +111 -0
- package/server/pty/host-daemon/daemon.d.ts.map +1 -0
- package/server/pty/host-daemon/daemon.js +648 -0
- package/server/pty/host-daemon/daemon.js.map +1 -0
- package/server/pty/host-daemon/entry.d.ts +3 -0
- package/server/pty/host-daemon/entry.d.ts.map +1 -0
- package/server/pty/host-daemon/entry.js +72 -0
- package/server/pty/host-daemon/entry.js.map +1 -0
- package/server/pty/host-daemon/lockfile.d.ts +12 -0
- package/server/pty/host-daemon/lockfile.d.ts.map +1 -0
- package/server/pty/host-daemon/lockfile.js +120 -0
- package/server/pty/host-daemon/lockfile.js.map +1 -0
- package/server/pty/host-daemon/mode-marker.d.ts +77 -0
- package/server/pty/host-daemon/mode-marker.d.ts.map +1 -0
- package/server/pty/host-daemon/mode-marker.js +228 -0
- package/server/pty/host-daemon/mode-marker.js.map +1 -0
- package/server/pty/host-daemon/orphan-cleanup.d.ts +42 -0
- package/server/pty/host-daemon/orphan-cleanup.d.ts.map +1 -0
- package/server/pty/host-daemon/orphan-cleanup.js +84 -0
- package/server/pty/host-daemon/orphan-cleanup.js.map +1 -0
- package/server/pty/host-daemon/paths.d.ts +10 -0
- package/server/pty/host-daemon/paths.d.ts.map +1 -0
- package/server/pty/host-daemon/paths.js +56 -0
- package/server/pty/host-daemon/paths.js.map +1 -0
- package/server/pty/host-daemon/server-connection.d.ts +44 -0
- package/server/pty/host-daemon/server-connection.d.ts.map +1 -0
- package/server/pty/host-daemon/server-connection.js +100 -0
- package/server/pty/host-daemon/server-connection.js.map +1 -0
- package/server/pty/host-daemon/service-detection.d.ts +24 -0
- package/server/pty/host-daemon/service-detection.d.ts.map +1 -0
- package/server/pty/host-daemon/service-detection.js +16 -0
- package/server/pty/host-daemon/service-detection.js.map +1 -0
- package/server/pty/host-daemon/socket-ready.d.ts +22 -0
- package/server/pty/host-daemon/socket-ready.d.ts.map +1 -0
- package/server/pty/host-daemon/socket-ready.js +33 -0
- package/server/pty/host-daemon/socket-ready.js.map +1 -0
- package/server/pty/host-daemon/spawn-daemon.d.ts +45 -0
- package/server/pty/host-daemon/spawn-daemon.d.ts.map +1 -0
- package/server/pty/host-daemon/spawn-daemon.js +155 -0
- package/server/pty/host-daemon/spawn-daemon.js.map +1 -0
- package/server/pty/host-daemon/terminate-daemon.d.ts +16 -0
- package/server/pty/host-daemon/terminate-daemon.d.ts.map +1 -0
- package/server/pty/host-daemon/terminate-daemon.js +128 -0
- package/server/pty/host-daemon/terminate-daemon.js.map +1 -0
- package/server/pty/host-protocol/frames.d.ts +110 -0
- package/server/pty/host-protocol/frames.d.ts.map +1 -0
- package/server/pty/host-protocol/frames.js +255 -0
- package/server/pty/host-protocol/frames.js.map +1 -0
- package/server/pty/host-protocol/messages.d.ts +140 -0
- package/server/pty/host-protocol/messages.d.ts.map +1 -0
- package/server/pty/host-protocol/messages.js +117 -0
- package/server/pty/host-protocol/messages.js.map +1 -0
- package/server/pty/host.d.ts +273 -0
- package/server/pty/host.d.ts.map +1 -0
- package/server/pty/host.js +184 -0
- package/server/pty/host.js.map +1 -0
- package/server/pty/in-process-host.d.ts +224 -0
- package/server/pty/in-process-host.d.ts.map +1 -0
- package/server/pty/in-process-host.js +1183 -0
- package/server/pty/in-process-host.js.map +1 -0
- package/server/pty/osc7-lifecycle.d.ts +8 -0
- package/server/pty/osc7-lifecycle.d.ts.map +1 -0
- package/server/pty/osc7-lifecycle.js +22 -0
- package/server/pty/osc7-lifecycle.js.map +1 -0
- package/server/pty/osc7-parser.d.ts +23 -0
- package/server/pty/osc7-parser.d.ts.map +1 -0
- package/server/pty/osc7-parser.js +91 -0
- package/server/pty/osc7-parser.js.map +1 -0
- package/server/pty/remote-host.d.ts +188 -0
- package/server/pty/remote-host.d.ts.map +1 -0
- package/server/pty/remote-host.js +810 -0
- package/server/pty/remote-host.js.map +1 -0
- package/server/pty/request-correlator.d.ts +59 -0
- package/server/pty/request-correlator.d.ts.map +1 -0
- package/server/pty/request-correlator.js +75 -0
- package/server/pty/request-correlator.js.map +1 -0
- package/server/pty/scrollback-log.d.ts +130 -0
- package/server/pty/scrollback-log.d.ts.map +1 -0
- package/server/pty/scrollback-log.js +344 -0
- package/server/pty/scrollback-log.js.map +1 -0
- package/server/pty/scrollback-sanitize.d.ts +2 -0
- package/server/pty/scrollback-sanitize.d.ts.map +1 -0
- package/server/pty/scrollback-sanitize.js +54 -0
- package/server/pty/scrollback-sanitize.js.map +1 -0
- package/server/pty/session-mirror.d.ts +67 -0
- package/server/pty/session-mirror.d.ts.map +1 -0
- package/server/pty/session-mirror.js +112 -0
- package/server/pty/session-mirror.js.map +1 -0
- package/server/pty/session-policy.d.ts +85 -0
- package/server/pty/session-policy.d.ts.map +1 -0
- package/server/pty/session-policy.js +186 -0
- package/server/pty/session-policy.js.map +1 -0
- package/server/pty/version-mismatch-recovery.d.ts +71 -0
- package/server/pty/version-mismatch-recovery.d.ts.map +1 -0
- package/server/pty/version-mismatch-recovery.js +63 -0
- package/server/pty/version-mismatch-recovery.js.map +1 -0
- package/server/routes/debug-agent-status.d.ts +5 -0
- package/server/routes/debug-agent-status.d.ts.map +1 -0
- package/server/routes/debug-agent-status.js +22 -0
- package/server/routes/debug-agent-status.js.map +1 -0
- package/server/routes/debug-diagnostics.d.ts +8 -0
- package/server/routes/debug-diagnostics.d.ts.map +1 -0
- package/server/routes/debug-diagnostics.js +34 -0
- package/server/routes/debug-diagnostics.js.map +1 -0
- package/server/routes/debug-terminal-trace.d.ts +16 -0
- package/server/routes/debug-terminal-trace.d.ts.map +1 -0
- package/server/routes/debug-terminal-trace.js +545 -0
- package/server/routes/debug-terminal-trace.js.map +1 -0
- package/server/routes/drops.d.ts +13 -0
- package/server/routes/drops.d.ts.map +1 -0
- package/server/routes/drops.js +126 -0
- package/server/routes/drops.js.map +1 -0
- package/server/routes/file-uploads.d.ts +9 -0
- package/server/routes/file-uploads.d.ts.map +1 -0
- package/server/routes/file-uploads.js +119 -0
- package/server/routes/file-uploads.js.map +1 -0
- package/server/routes/files.d.ts +9 -0
- package/server/routes/files.d.ts.map +1 -0
- package/server/routes/files.js +441 -0
- package/server/routes/files.js.map +1 -0
- package/server/routes/filesystem.d.ts +6 -0
- package/server/routes/filesystem.d.ts.map +1 -0
- package/server/routes/filesystem.js +76 -0
- package/server/routes/filesystem.js.map +1 -0
- package/server/routes/git.d.ts +38 -0
- package/server/routes/git.d.ts.map +1 -0
- package/server/routes/git.js +585 -0
- package/server/routes/git.js.map +1 -0
- package/server/routes/healthz.d.ts +8 -0
- package/server/routes/healthz.d.ts.map +1 -0
- package/server/routes/healthz.js +24 -0
- package/server/routes/healthz.js.map +1 -0
- package/server/routes/hook.d.ts +14 -0
- package/server/routes/hook.d.ts.map +1 -0
- package/server/routes/hook.js +86 -0
- package/server/routes/hook.js.map +1 -0
- package/server/routes/ide-commands.d.ts +9 -0
- package/server/routes/ide-commands.d.ts.map +1 -0
- package/server/routes/ide-commands.js +23 -0
- package/server/routes/ide-commands.js.map +1 -0
- package/server/routes/lib/resolve-worktree.d.ts +30 -0
- package/server/routes/lib/resolve-worktree.d.ts.map +1 -0
- package/server/routes/lib/resolve-worktree.js +35 -0
- package/server/routes/lib/resolve-worktree.js.map +1 -0
- package/server/routes/open.d.ts +4 -0
- package/server/routes/open.d.ts.map +1 -0
- package/server/routes/open.js +21 -0
- package/server/routes/open.js.map +1 -0
- package/server/routes/pane-commands.d.ts +9 -0
- package/server/routes/pane-commands.d.ts.map +1 -0
- package/server/routes/pane-commands.js +23 -0
- package/server/routes/pane-commands.js.map +1 -0
- package/server/routes/projects.d.ts +15 -0
- package/server/routes/projects.d.ts.map +1 -0
- package/server/routes/projects.js +363 -0
- package/server/routes/projects.js.map +1 -0
- package/server/routes/server-notices.d.ts +4 -0
- package/server/routes/server-notices.d.ts.map +1 -0
- package/server/routes/server-notices.js +29 -0
- package/server/routes/server-notices.js.map +1 -0
- package/server/routes/service-config.d.ts +11 -0
- package/server/routes/service-config.d.ts.map +1 -0
- package/server/routes/service-config.js +64 -0
- package/server/routes/service-config.js.map +1 -0
- package/server/routes/sessions.d.ts +7 -0
- package/server/routes/sessions.d.ts.map +1 -0
- package/server/routes/sessions.js +218 -0
- package/server/routes/sessions.js.map +1 -0
- package/server/service/caffeinate.d.ts +33 -0
- package/server/service/caffeinate.d.ts.map +1 -0
- package/server/service/caffeinate.js +72 -0
- package/server/service/caffeinate.js.map +1 -0
- package/server/state/app-state.d.ts +167 -0
- package/server/state/app-state.d.ts.map +1 -0
- package/server/state/app-state.js +335 -0
- package/server/state/app-state.js.map +1 -0
- package/server/state/project-manager.d.ts +30 -0
- package/server/state/project-manager.d.ts.map +1 -0
- package/server/state/project-manager.js +128 -0
- package/server/state/project-manager.js.map +1 -0
- package/server/state/server-notices.d.ts +12 -0
- package/server/state/server-notices.d.ts.map +1 -0
- package/server/state/server-notices.js +32 -0
- package/server/state/server-notices.js.map +1 -0
- package/server/state/worktree-cache.d.ts +25 -0
- package/server/state/worktree-cache.d.ts.map +1 -0
- package/server/state/worktree-cache.js +53 -0
- package/server/state/worktree-cache.js.map +1 -0
- package/server/ws/events.d.ts +45 -0
- package/server/ws/events.d.ts.map +1 -0
- package/server/ws/events.js +134 -0
- package/server/ws/events.js.map +1 -0
- package/server/ws/keepalive.d.ts +27 -0
- package/server/ws/keepalive.d.ts.map +1 -0
- package/server/ws/keepalive.js +63 -0
- package/server/ws/keepalive.js.map +1 -0
- package/server/ws/terminal-attach.d.ts +13 -0
- package/server/ws/terminal-attach.d.ts.map +1 -0
- package/server/ws/terminal-attach.js +233 -0
- package/server/ws/terminal-attach.js.map +1 -0
- package/server/ws/terminal-flow.d.ts +17 -0
- package/server/ws/terminal-flow.d.ts.map +1 -0
- package/server/ws/terminal-flow.js +64 -0
- package/server/ws/terminal-flow.js.map +1 -0
- package/server/ws/terminal.d.ts +69 -0
- package/server/ws/terminal.d.ts.map +1 -0
- package/server/ws/terminal.js +311 -0
- package/server/ws/terminal.js.map +1 -0
- package/web/assets/EditorPane-CzzT3iYY.js +123 -0
- package/web/assets/SymbolsNerdFontMono-Regular-CwEZqMeU.woff2 +0 -0
- package/web/assets/TerminalPane-CjbYzePr.js +68 -0
- package/web/assets/TerminalPane-DkTCHfhq.css +1 -0
- package/web/assets/file-icons-JBi09j0r.js +6 -0
- package/web/assets/index-CTTkRpnn.css +2 -0
- package/web/assets/index-CmhewzMp.js +34 -0
- package/web/assets/session-resume-7f-tB-ZU.js +2 -0
- package/web/assets/terminal-trace-PuuFRybC.js +2803 -0
- package/web/assets/useVirtualKeyboard-DgJb9u9d.js +1 -0
- package/web/index.html +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarder.js","sourceRoot":"","sources":["../../src/port-forwarder/forwarder.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAiB3B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IAIK;IAHZ,SAAS,GAAG,IAAI,GAAG,EAAsC,CAAC;IACnE,QAAQ,GAAyC,IAAI,CAAC;IAE9D,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAExD,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,EAA+B;QACzC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,SAAiB,EAAE,KAA0B;QAChD,IAAI,IAAI,CAAC,QAAQ,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CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,QAAQ,CACd,OAAwB,EACxB,YAAwB,EACxB,QAAoB;QAEpB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,SAAS,GAAG,CAAC,IAAgB,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC;QACF,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QACpD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC5B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACzB,SAAS,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PortInfo, Session } from "@parasor/shared";
|
|
2
|
+
export interface LsofEntry {
|
|
3
|
+
pid: number;
|
|
4
|
+
port: number;
|
|
5
|
+
bindsAll: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseLsofOutput(output: string): LsofEntry[];
|
|
8
|
+
export declare function buildProcessTree(psOutput: string): Map<number, Set<number>>;
|
|
9
|
+
export declare function findDescendantPids(root: number, tree: Map<number, Set<number>>, maxDepth: number): Set<number>;
|
|
10
|
+
export declare class PortScanner {
|
|
11
|
+
private lastResult;
|
|
12
|
+
private timer;
|
|
13
|
+
private readonly activeInterval;
|
|
14
|
+
private readonly idleInterval;
|
|
15
|
+
private onChange;
|
|
16
|
+
onPortsChanged(cb: (projectId: string, ports: PortInfo[]) => void): void;
|
|
17
|
+
start(getSessions: () => Session[], hasRecentActivity?: () => boolean): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
getProjectPorts(projectId: string): PortInfo[];
|
|
20
|
+
getAllPorts(): Record<string, PortInfo[]>;
|
|
21
|
+
private scan;
|
|
22
|
+
private diffAndNotify;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/port-scanner/scanner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAIzD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CAyB3D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAiB3E;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC9B,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,CAAC,CAsBb;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CACT;IAEP,cAAc,CAAC,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,GAAG,IAAI;IAIxE,KAAK,CAAC,WAAW,EAAE,MAAM,OAAO,EAAE,EAAE,iBAAiB,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI;IAqC5E,IAAI,IAAI,IAAI;IAOZ,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAI9C,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;YAQ3B,IAAI;IA4DlB,OAAO,CAAC,aAAa;CAiBtB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
const execFileAsync = promisify(execFile);
|
|
4
|
+
export function parseLsofOutput(output) {
|
|
5
|
+
const entries = [];
|
|
6
|
+
let currentPid = null;
|
|
7
|
+
for (const line of output.split("\n")) {
|
|
8
|
+
if (!line.trim())
|
|
9
|
+
continue;
|
|
10
|
+
if (line.startsWith("p")) {
|
|
11
|
+
currentPid = parseInt(line.slice(1), 10);
|
|
12
|
+
}
|
|
13
|
+
else if (line.startsWith("n") && currentPid !== null) {
|
|
14
|
+
const addr = line.slice(1);
|
|
15
|
+
const colonIdx = addr.lastIndexOf(":");
|
|
16
|
+
if (colonIdx === -1)
|
|
17
|
+
continue;
|
|
18
|
+
const host = addr.slice(0, colonIdx);
|
|
19
|
+
const port = parseInt(addr.slice(colonIdx + 1), 10);
|
|
20
|
+
if (Number.isNaN(port))
|
|
21
|
+
continue;
|
|
22
|
+
const bindsAll = host === "*" || host === "0.0.0.0" || host === "[::]" || host === "";
|
|
23
|
+
entries.push({ pid: currentPid, port, bindsAll });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return entries;
|
|
27
|
+
}
|
|
28
|
+
export function buildProcessTree(psOutput) {
|
|
29
|
+
const tree = new Map();
|
|
30
|
+
for (const line of psOutput.split("\n")) {
|
|
31
|
+
const trimmed = line.trim();
|
|
32
|
+
const parts = trimmed.split(/\s+/);
|
|
33
|
+
if (parts.length < 2)
|
|
34
|
+
continue;
|
|
35
|
+
const pid = parseInt(parts[0], 10);
|
|
36
|
+
const ppid = parseInt(parts[1], 10);
|
|
37
|
+
if (Number.isNaN(pid) || Number.isNaN(ppid))
|
|
38
|
+
continue;
|
|
39
|
+
if (!tree.has(ppid))
|
|
40
|
+
tree.set(ppid, new Set());
|
|
41
|
+
tree.get(ppid)?.add(pid);
|
|
42
|
+
}
|
|
43
|
+
return tree;
|
|
44
|
+
}
|
|
45
|
+
export function findDescendantPids(root, tree, maxDepth) {
|
|
46
|
+
const result = new Set();
|
|
47
|
+
const queue = [
|
|
48
|
+
{ pid: root, depth: 0 },
|
|
49
|
+
];
|
|
50
|
+
while (queue.length > 0) {
|
|
51
|
+
const next = queue.shift();
|
|
52
|
+
if (!next)
|
|
53
|
+
break;
|
|
54
|
+
const { pid, depth } = next;
|
|
55
|
+
if (depth >= maxDepth)
|
|
56
|
+
continue;
|
|
57
|
+
const children = tree.get(pid);
|
|
58
|
+
if (!children)
|
|
59
|
+
continue;
|
|
60
|
+
for (const child of children) {
|
|
61
|
+
result.add(child);
|
|
62
|
+
queue.push({ pid: child, depth: depth + 1 });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
export class PortScanner {
|
|
68
|
+
lastResult = new Map();
|
|
69
|
+
timer = null;
|
|
70
|
+
activeInterval = 3000;
|
|
71
|
+
idleInterval = 10000;
|
|
72
|
+
onChange = null;
|
|
73
|
+
onPortsChanged(cb) {
|
|
74
|
+
this.onChange = cb;
|
|
75
|
+
}
|
|
76
|
+
start(getSessions, hasRecentActivity) {
|
|
77
|
+
let currentInterval = this.activeInterval;
|
|
78
|
+
const tick = async () => {
|
|
79
|
+
const sessions = getSessions().filter((s) => s.state === "running" && s.pid !== null);
|
|
80
|
+
if (sessions.length === 0) {
|
|
81
|
+
for (const projectId of this.lastResult.keys()) {
|
|
82
|
+
this.onChange?.(projectId, []);
|
|
83
|
+
}
|
|
84
|
+
this.lastResult.clear();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const result = await this.scan(sessions);
|
|
89
|
+
this.diffAndNotify(result);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// scan failure -- skip silently
|
|
93
|
+
}
|
|
94
|
+
const wantedInterval = hasRecentActivity?.()
|
|
95
|
+
? this.activeInterval
|
|
96
|
+
: this.idleInterval;
|
|
97
|
+
if (wantedInterval !== currentInterval) {
|
|
98
|
+
currentInterval = wantedInterval;
|
|
99
|
+
if (this.timer)
|
|
100
|
+
clearInterval(this.timer);
|
|
101
|
+
this.timer = setInterval(tick, currentInterval);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
this.timer = setInterval(tick, currentInterval);
|
|
105
|
+
tick();
|
|
106
|
+
}
|
|
107
|
+
stop() {
|
|
108
|
+
if (this.timer) {
|
|
109
|
+
clearInterval(this.timer);
|
|
110
|
+
this.timer = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
getProjectPorts(projectId) {
|
|
114
|
+
return this.lastResult.get(projectId) ?? [];
|
|
115
|
+
}
|
|
116
|
+
getAllPorts() {
|
|
117
|
+
const result = {};
|
|
118
|
+
for (const [k, v] of this.lastResult) {
|
|
119
|
+
result[k] = v;
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
async scan(sessions) {
|
|
124
|
+
const [lsofOut, psOut] = await Promise.all([
|
|
125
|
+
execFileAsync("lsof", ["-iTCP", "-sTCP:LISTEN", "-n", "-P", "-Fpn"], {
|
|
126
|
+
timeout: 5000,
|
|
127
|
+
})
|
|
128
|
+
.then((r) => r.stdout)
|
|
129
|
+
.catch(() => ""),
|
|
130
|
+
execFileAsync("ps", ["-eo", "pid,ppid"], { timeout: 5000 })
|
|
131
|
+
.then((r) => r.stdout)
|
|
132
|
+
.catch(() => ""),
|
|
133
|
+
]);
|
|
134
|
+
const listenEntries = parseLsofOutput(lsofOut);
|
|
135
|
+
const listenByPid = new Map();
|
|
136
|
+
for (const entry of listenEntries) {
|
|
137
|
+
if (!listenByPid.has(entry.pid))
|
|
138
|
+
listenByPid.set(entry.pid, []);
|
|
139
|
+
listenByPid.get(entry.pid)?.push(entry);
|
|
140
|
+
}
|
|
141
|
+
const processTree = buildProcessTree(psOut);
|
|
142
|
+
const projectPorts = new Map();
|
|
143
|
+
const sessionsByProject = new Map();
|
|
144
|
+
for (const s of sessions) {
|
|
145
|
+
if (!sessionsByProject.has(s.projectId))
|
|
146
|
+
sessionsByProject.set(s.projectId, []);
|
|
147
|
+
sessionsByProject.get(s.projectId)?.push(s);
|
|
148
|
+
}
|
|
149
|
+
for (const [projectId, projectSessions] of sessionsByProject) {
|
|
150
|
+
const ports = [];
|
|
151
|
+
const seenPorts = new Set();
|
|
152
|
+
for (const session of projectSessions) {
|
|
153
|
+
if (!session.pid)
|
|
154
|
+
continue;
|
|
155
|
+
const descendants = findDescendantPids(session.pid, processTree, 5);
|
|
156
|
+
descendants.add(session.pid);
|
|
157
|
+
for (const pid of descendants) {
|
|
158
|
+
const entries = listenByPid.get(pid);
|
|
159
|
+
if (!entries)
|
|
160
|
+
continue;
|
|
161
|
+
for (const entry of entries) {
|
|
162
|
+
if (seenPorts.has(entry.port))
|
|
163
|
+
continue;
|
|
164
|
+
seenPorts.add(entry.port);
|
|
165
|
+
ports.push({
|
|
166
|
+
port: entry.port,
|
|
167
|
+
pid: entry.pid,
|
|
168
|
+
bindsAll: entry.bindsAll,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
ports.sort((a, b) => a.port - b.port);
|
|
174
|
+
projectPorts.set(projectId, ports);
|
|
175
|
+
}
|
|
176
|
+
return projectPorts;
|
|
177
|
+
}
|
|
178
|
+
diffAndNotify(newResult) {
|
|
179
|
+
const allProjectIds = new Set([
|
|
180
|
+
...this.lastResult.keys(),
|
|
181
|
+
...newResult.keys(),
|
|
182
|
+
]);
|
|
183
|
+
for (const projectId of allProjectIds) {
|
|
184
|
+
const oldPorts = this.lastResult.get(projectId) ?? [];
|
|
185
|
+
const newPorts = newResult.get(projectId) ?? [];
|
|
186
|
+
if (JSON.stringify(oldPorts) !== JSON.stringify(newPorts)) {
|
|
187
|
+
this.onChange?.(projectId, newPorts);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
this.lastResult = newResult;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/port-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQ1C,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,IAAI,UAAU,GAAkB,IAAI,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAS;QAE3B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,UAAU,GAAG,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,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACzB,GAAG,SAAS,CAAC,IAAI,EAAE;SACpB,CAAC,CAAC;QAEH,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACtD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YAEhD,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type RemoteConnState = "connecting" | "snapshot-pending" | "ready" | "dropped";
|
|
2
|
+
export declare class ConnectionLifecycle {
|
|
3
|
+
private state;
|
|
4
|
+
private _connectionId;
|
|
5
|
+
private _generation;
|
|
6
|
+
private readonly handshakePromise;
|
|
7
|
+
private resolveHandshake;
|
|
8
|
+
private rejectHandshakePromise;
|
|
9
|
+
constructor();
|
|
10
|
+
/** Current state token. Kept as a getter so callers cannot mutate it. */
|
|
11
|
+
get current(): RemoteConnState;
|
|
12
|
+
/** Daemon-assigned connection identifier, stamped at HELLO_ACK time.
|
|
13
|
+
* Zero before HELLO_ACK; used by the host to fill outgoing frame headers. */
|
|
14
|
+
get connectionId(): number;
|
|
15
|
+
/** Generation latch stamped at HELLO_ACK time; included in every outgoing
|
|
16
|
+
* frame header so a fenced daemon can recognize stale connections. */
|
|
17
|
+
get generation(): bigint;
|
|
18
|
+
/** Promise that resolves once handshake completes (HELLO_ACK + first
|
|
19
|
+
* SESSION_LIST applied) and rejects on connection drop / handshake error. */
|
|
20
|
+
get awaitReady(): Promise<void>;
|
|
21
|
+
get isDropped(): boolean;
|
|
22
|
+
get isReady(): boolean;
|
|
23
|
+
/** True iff the handshake is still in-flight (HELLO_ACK or first
|
|
24
|
+
* SESSION_LIST has not yet been processed). */
|
|
25
|
+
get isAwaitingHandshake(): boolean;
|
|
26
|
+
/** HELLO_ACK arrived and validated by the caller. Stamps connectionId +
|
|
27
|
+
* generation and transitions `connecting -> snapshot-pending`. Returns
|
|
28
|
+
* false if the current state is not `connecting` (stale / duplicate ack
|
|
29
|
+
* is silently ignored, matching the prior inline guard). */
|
|
30
|
+
applyHelloAck(connectionId: number, generation: bigint): boolean;
|
|
31
|
+
/** First SESSION_LIST applied in `snapshot-pending` -- transition to
|
|
32
|
+
* `ready` and resolve the handshake Promise. Returns false on any other
|
|
33
|
+
* current state (later SESSION_LIST frames just update the mirror). */
|
|
34
|
+
markReady(): boolean;
|
|
35
|
+
/** Reject the handshake Promise with `err` without changing state.
|
|
36
|
+
* Used so a connection-level NACK (requestId=0) can surface the daemon's
|
|
37
|
+
* specific NACK code on the awaiter, before the subsequent `drop()` chain
|
|
38
|
+
* would otherwise reject with the generic "connection-dropped" error.
|
|
39
|
+
* The second reject from `drop()` is a no-op because Promise rejection
|
|
40
|
+
* is idempotent. */
|
|
41
|
+
rejectHandshakeOnly(err: Error): void;
|
|
42
|
+
/** Transition to `dropped`. Idempotent -- returns false if already dropped.
|
|
43
|
+
* If the handshake was still awaiting, rejects the Promise with `err`
|
|
44
|
+
* (Promise reject is itself idempotent, so a prior `rejectHandshakeOnly`
|
|
45
|
+
* takes precedence on the awaiter side). Returns true iff state actually
|
|
46
|
+
* transitioned, so callers can gate side effects (correlator.rejectAll,
|
|
47
|
+
* etc.) on the transition rather than on the previous state. */
|
|
48
|
+
drop(err: Error): boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=connection-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-lifecycle.d.ts","sourceRoot":"","sources":["../../src/pty/connection-lifecycle.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,kBAAkB,GAClB,OAAO,GACP,SAAS,CAAC;AAEd,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAgB;IACjD,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,sBAAsB,CAAwB;;IAStD,yEAAyE;IACzE,IAAI,OAAO,IAAI,eAAe,CAE7B;IAED;kFAC8E;IAC9E,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;2EACuE;IACvE,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;kFAC8E;IAC9E,IAAI,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;oDACgD;IAChD,IAAI,mBAAmB,IAAI,OAAO,CAEjC;IAED;;;iEAG6D;IAC7D,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAQhE;;4EAEwE;IACxE,SAAS,IAAI,OAAO;IAOpB;;;;;yBAKqB;IACrB,mBAAmB,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI;IAIrC;;;;;qEAKiE;IACjE,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO;CAO1B"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Handshake state machine for {@link RemotePtyHost}.
|
|
3
|
+
*
|
|
4
|
+
* States:
|
|
5
|
+
* connecting -- HELLO sent, awaiting HELLO_ACK
|
|
6
|
+
* snapshot-pending -- HELLO_ACK received, awaiting first SESSION_LIST
|
|
7
|
+
* ready -- initial SESSION_LIST applied; mirror reflects daemon snapshot.
|
|
8
|
+
* `awaitReady` resolves only at this point so callers never
|
|
9
|
+
* observe a stale (= empty) mirror after await.
|
|
10
|
+
* dropped -- wire dead; pending requests rejected by the host.
|
|
11
|
+
*
|
|
12
|
+
* The two-step "ack then snapshot" handshake closes a race: HELLO_ACK alone
|
|
13
|
+
* leaves `list()` returning [] until the SESSION_LIST broadcast arrives a tick
|
|
14
|
+
* later, so any caller running sync accessors immediately after
|
|
15
|
+
* `await connect()` would see a phantom empty world.
|
|
16
|
+
*
|
|
17
|
+
* Pure with respect to socket / wire -- this class owns the state machine,
|
|
18
|
+
* the connectionId + generation stamped at HELLO_ACK time (used by the host
|
|
19
|
+
* to fill outgoing frames), and the deferred handshake Promise. It does NOT
|
|
20
|
+
* write to the socket, reject correlator entries, or touch the session
|
|
21
|
+
* mirror -- those stay on {@link RemotePtyHost}.
|
|
22
|
+
*/
|
|
23
|
+
export class ConnectionLifecycle {
|
|
24
|
+
state = "connecting";
|
|
25
|
+
_connectionId = 0;
|
|
26
|
+
_generation = 0n;
|
|
27
|
+
handshakePromise;
|
|
28
|
+
resolveHandshake;
|
|
29
|
+
rejectHandshakePromise;
|
|
30
|
+
constructor() {
|
|
31
|
+
this.handshakePromise = new Promise((resolve, reject) => {
|
|
32
|
+
this.resolveHandshake = resolve;
|
|
33
|
+
this.rejectHandshakePromise = reject;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Current state token. Kept as a getter so callers cannot mutate it. */
|
|
37
|
+
get current() {
|
|
38
|
+
return this.state;
|
|
39
|
+
}
|
|
40
|
+
/** Daemon-assigned connection identifier, stamped at HELLO_ACK time.
|
|
41
|
+
* Zero before HELLO_ACK; used by the host to fill outgoing frame headers. */
|
|
42
|
+
get connectionId() {
|
|
43
|
+
return this._connectionId;
|
|
44
|
+
}
|
|
45
|
+
/** Generation latch stamped at HELLO_ACK time; included in every outgoing
|
|
46
|
+
* frame header so a fenced daemon can recognize stale connections. */
|
|
47
|
+
get generation() {
|
|
48
|
+
return this._generation;
|
|
49
|
+
}
|
|
50
|
+
/** Promise that resolves once handshake completes (HELLO_ACK + first
|
|
51
|
+
* SESSION_LIST applied) and rejects on connection drop / handshake error. */
|
|
52
|
+
get awaitReady() {
|
|
53
|
+
return this.handshakePromise;
|
|
54
|
+
}
|
|
55
|
+
get isDropped() {
|
|
56
|
+
return this.state === "dropped";
|
|
57
|
+
}
|
|
58
|
+
get isReady() {
|
|
59
|
+
return this.state === "ready";
|
|
60
|
+
}
|
|
61
|
+
/** True iff the handshake is still in-flight (HELLO_ACK or first
|
|
62
|
+
* SESSION_LIST has not yet been processed). */
|
|
63
|
+
get isAwaitingHandshake() {
|
|
64
|
+
return this.state === "connecting" || this.state === "snapshot-pending";
|
|
65
|
+
}
|
|
66
|
+
/** HELLO_ACK arrived and validated by the caller. Stamps connectionId +
|
|
67
|
+
* generation and transitions `connecting -> snapshot-pending`. Returns
|
|
68
|
+
* false if the current state is not `connecting` (stale / duplicate ack
|
|
69
|
+
* is silently ignored, matching the prior inline guard). */
|
|
70
|
+
applyHelloAck(connectionId, generation) {
|
|
71
|
+
if (this.state !== "connecting")
|
|
72
|
+
return false;
|
|
73
|
+
this._connectionId = connectionId;
|
|
74
|
+
this._generation = generation;
|
|
75
|
+
this.state = "snapshot-pending";
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
/** First SESSION_LIST applied in `snapshot-pending` -- transition to
|
|
79
|
+
* `ready` and resolve the handshake Promise. Returns false on any other
|
|
80
|
+
* current state (later SESSION_LIST frames just update the mirror). */
|
|
81
|
+
markReady() {
|
|
82
|
+
if (this.state !== "snapshot-pending")
|
|
83
|
+
return false;
|
|
84
|
+
this.state = "ready";
|
|
85
|
+
this.resolveHandshake();
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
/** Reject the handshake Promise with `err` without changing state.
|
|
89
|
+
* Used so a connection-level NACK (requestId=0) can surface the daemon's
|
|
90
|
+
* specific NACK code on the awaiter, before the subsequent `drop()` chain
|
|
91
|
+
* would otherwise reject with the generic "connection-dropped" error.
|
|
92
|
+
* The second reject from `drop()` is a no-op because Promise rejection
|
|
93
|
+
* is idempotent. */
|
|
94
|
+
rejectHandshakeOnly(err) {
|
|
95
|
+
this.rejectHandshakePromise(err);
|
|
96
|
+
}
|
|
97
|
+
/** Transition to `dropped`. Idempotent -- returns false if already dropped.
|
|
98
|
+
* If the handshake was still awaiting, rejects the Promise with `err`
|
|
99
|
+
* (Promise reject is itself idempotent, so a prior `rejectHandshakeOnly`
|
|
100
|
+
* takes precedence on the awaiter side). Returns true iff state actually
|
|
101
|
+
* transitioned, so callers can gate side effects (correlator.rejectAll,
|
|
102
|
+
* etc.) on the transition rather than on the previous state. */
|
|
103
|
+
drop(err) {
|
|
104
|
+
if (this.state === "dropped")
|
|
105
|
+
return false;
|
|
106
|
+
const wasAwaiting = this.isAwaitingHandshake;
|
|
107
|
+
this.state = "dropped";
|
|
108
|
+
if (wasAwaiting)
|
|
109
|
+
this.rejectHandshakePromise(err);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=connection-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-lifecycle.js","sourceRoot":"","sources":["../../src/pty/connection-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH,MAAM,OAAO,mBAAmB;IACtB,KAAK,GAAoB,YAAY,CAAC;IACtC,aAAa,GAAG,CAAC,CAAC;IAClB,WAAW,GAAG,EAAE,CAAC;IACR,gBAAgB,CAAgB;IACzC,gBAAgB,CAAc;IAC9B,sBAAsB,CAAwB;IAEtD;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;YAChC,IAAI,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C,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;;qEAKiE;IACjE,IAAI,CAAC,GAAU;QACb,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,WAAW;YAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as net from "node:net";
|
|
2
|
+
/**
|
|
3
|
+
* Promise-wrap `net.connect(socketPath)`. Resolves once the socket emits
|
|
4
|
+
* `connect`, rejects with the `NodeJS.ErrnoException` from the first
|
|
5
|
+
* `error`. The success path removes the one-shot `error` listener so a
|
|
6
|
+
* later transport fault on the same socket reaches the caller's own
|
|
7
|
+
* listeners instead of an orphaned rejector.
|
|
8
|
+
*/
|
|
9
|
+
export declare function connectToDaemonSocket(socketPath: string): Promise<net.Socket>;
|
|
10
|
+
export interface AutoSpawnInput {
|
|
11
|
+
/** `(err as NodeJS.ErrnoException).code` from the failed first connect. */
|
|
12
|
+
code: string | undefined;
|
|
13
|
+
/** Value of `process.env.PARASOR_PTY_AUTOSTART`. `"1"` forces ON, `"0"`
|
|
14
|
+
* forces OFF, anything else (including undefined) falls back to the
|
|
15
|
+
* default rule. */
|
|
16
|
+
explicit: string | undefined;
|
|
17
|
+
/** Result of {@link isServiceManagedDaemonInstalled} -- when true the
|
|
18
|
+
* default is OFF (service unit is the canonical owner, spawning here
|
|
19
|
+
* would create the unmanaged-daemon split-brain `service install` /
|
|
20
|
+
* `restart --all` are meant to heal). */
|
|
21
|
+
serviceInstalled: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface AutoSpawnDecision {
|
|
24
|
+
/** True iff the errno code matched "daemon not running"
|
|
25
|
+
* (`ECONNREFUSED` / `ENOENT`). Other codes signal "socket file exists
|
|
26
|
+
* but daemon is unhealthy" -> never auto-spawn. */
|
|
27
|
+
noDaemon: boolean;
|
|
28
|
+
/** True iff the caller should fork the daemon and retry once. */
|
|
29
|
+
autoStart: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Pure derivation of the auto-spawn policy. Explicit env override always
|
|
32
|
+
* wins; otherwise default depends on whether a service-managed daemon
|
|
33
|
+
* unit is installed. */
|
|
34
|
+
export declare function decideAutoSpawn(input: AutoSpawnInput): AutoSpawnDecision;
|
|
35
|
+
export interface NoDaemonErrorMessageInput {
|
|
36
|
+
/** Original connect error -- only `.message` is read. */
|
|
37
|
+
err: Error;
|
|
38
|
+
/** Unix-domain socket path the caller was trying to reach. */
|
|
39
|
+
socketPath: string;
|
|
40
|
+
/** Output of {@link decideAutoSpawn} for the same error (drives the
|
|
41
|
+
* "service installed but unreachable" vs "no daemon at all" branch). */
|
|
42
|
+
noDaemon: boolean;
|
|
43
|
+
/** Result of {@link isServiceManagedDaemonInstalled} -- selects between
|
|
44
|
+
* the service-managed guidance and the casual `parasor` guidance. */
|
|
45
|
+
serviceInstalled: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Build the user-facing "cannot connect to daemon" message. Three
|
|
48
|
+
* branches: noDaemon + serviceInstalled (service-managed but down),
|
|
49
|
+
* noDaemon + !serviceInstalled (casual install path), and !noDaemon
|
|
50
|
+
* (unhealthy socket -- daemon log is the next step). */
|
|
51
|
+
export declare function formatNoDaemonError(input: NoDaemonErrorMessageInput): string;
|
|
52
|
+
//# sourceMappingURL=daemon-connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-connect.d.ts","sourceRoot":"","sources":["../../src/pty/daemon-connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAehC;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAW7E;AAED,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB;;wBAEoB;IACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;8CAG0C;IAC1C,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC;;wDAEoD;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;yBAEyB;AACzB,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,CASxE;AAED,MAAM,WAAW,yBAAyB;IACxC,yDAAyD;IACzD,GAAG,EAAE,KAAK,CAAC;IACX,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB;6EACyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB;0EACsE;IACtE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;yDAGyD;AACzD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,GAAG,MAAM,CAc5E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as net from "node:net";
|
|
2
|
+
/*
|
|
3
|
+
* Connect-side helpers split out of {@link createPtyHost}.
|
|
4
|
+
*
|
|
5
|
+
* These three pure-ish helpers cover the "first connect to the daemon
|
|
6
|
+
* Unix-domain socket" path (auto-spawn decision + connect retry + the
|
|
7
|
+
* user-facing "cannot connect" guidance string). They do NOT cover the
|
|
8
|
+
* version-mismatch recovery flow -- that orchestrator stays inline in
|
|
9
|
+
* {@link createPtyHost} (4-step sequential teardown/respawn/reconnect
|
|
10
|
+
* with per-step error wrapping) since each step injects a distinct
|
|
11
|
+
* dependency module and the value of unit-testing it is the orchestrator
|
|
12
|
+
* itself, not the leaves.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Promise-wrap `net.connect(socketPath)`. Resolves once the socket emits
|
|
16
|
+
* `connect`, rejects with the `NodeJS.ErrnoException` from the first
|
|
17
|
+
* `error`. The success path removes the one-shot `error` listener so a
|
|
18
|
+
* later transport fault on the same socket reaches the caller's own
|
|
19
|
+
* listeners instead of an orphaned rejector.
|
|
20
|
+
*/
|
|
21
|
+
export function connectToDaemonSocket(socketPath) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
const s = net.connect(socketPath);
|
|
24
|
+
s.once("connect", () => {
|
|
25
|
+
s.removeAllListeners("error");
|
|
26
|
+
resolve(s);
|
|
27
|
+
});
|
|
28
|
+
s.once("error", (err) => {
|
|
29
|
+
reject(err);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Pure derivation of the auto-spawn policy. Explicit env override always
|
|
34
|
+
* wins; otherwise default depends on whether a service-managed daemon
|
|
35
|
+
* unit is installed. */
|
|
36
|
+
export function decideAutoSpawn(input) {
|
|
37
|
+
const noDaemon = input.code === "ECONNREFUSED" || input.code === "ENOENT";
|
|
38
|
+
const autoStart = input.explicit === "1"
|
|
39
|
+
? true
|
|
40
|
+
: input.explicit === "0"
|
|
41
|
+
? false
|
|
42
|
+
: !input.serviceInstalled;
|
|
43
|
+
return { noDaemon, autoStart };
|
|
44
|
+
}
|
|
45
|
+
/** Build the user-facing "cannot connect to daemon" message. Three
|
|
46
|
+
* branches: noDaemon + serviceInstalled (service-managed but down),
|
|
47
|
+
* noDaemon + !serviceInstalled (casual install path), and !noDaemon
|
|
48
|
+
* (unhealthy socket -- daemon log is the next step). */
|
|
49
|
+
export function formatNoDaemonError(input) {
|
|
50
|
+
return (`parasor-pty-host: cannot connect to ${input.socketPath}: ${input.err.message}. ` +
|
|
51
|
+
(input.noDaemon
|
|
52
|
+
? input.serviceInstalled
|
|
53
|
+
? "A service-managed daemon is installed but not reachable. " +
|
|
54
|
+
"Run `parasor service restart --all` to bring it back up, " +
|
|
55
|
+
"or set PARASOR_PTY_AUTOSTART=1 to override (not recommended -- " +
|
|
56
|
+
"bypasses the service manager and risks split-brain)."
|
|
57
|
+
: "Set PARASOR_PTY_AUTOSTART=1 (default) or start the daemon " +
|
|
58
|
+
"(`parasor-pty-host` entry script). " +
|
|
59
|
+
"Set PARASOR_PTY_DAEMON=0 to fall back to in-process mode."
|
|
60
|
+
: "Daemon socket is unhealthy; check the daemon log."));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=daemon-connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-connect.js","sourceRoot":"","sources":["../../src/pty/daemon-connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjD,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;YACrB,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;YAC7C,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAyBD;;yBAEyB;AACzB,MAAM,UAAU,eAAe,CAAC,KAAqB;IACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC1E,MAAM,SAAS,GACb,KAAK,CAAC,QAAQ,KAAK,GAAG;QACpB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,KAAK,CAAC,QAAQ,KAAK,GAAG;YACtB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC;AAeD;;;yDAGyD;AACzD,MAAM,UAAU,mBAAmB,CAAC,KAAgC;IAClE,OAAO,CACL,uCAAuC,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI;QACjF,CAAC,KAAK,CAAC,QAAQ;YACb,CAAC,CAAC,KAAK,CAAC,gBAAgB;gBACtB,CAAC,CAAC,2DAA2D;oBAC3D,2DAA2D;oBAC3D,iEAAiE;oBACjE,sDAAsD;gBACxD,CAAC,CAAC,4DAA4D;oBAC5D,qCAAqC;oBACrC,2DAA2D;YAC/D,CAAC,CAAC,mDAAmD,CAAC,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface RaceHandshakeWithTimeoutOpts {
|
|
2
|
+
/** Promise that resolves once the handshake completes successfully or
|
|
3
|
+
* rejects on a wire / protocol fault detected by the caller. */
|
|
4
|
+
awaiter: Promise<void>;
|
|
5
|
+
/** Wall-clock deadline in milliseconds. */
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
/** Side effect invoked exactly once when the deadline fires before
|
|
8
|
+
* `awaiter` settles. Production: `() => socket.destroy()`. Thrown errors
|
|
9
|
+
* are swallowed -- the socket may already be in an error state, and the
|
|
10
|
+
* caller still needs the typed timeout error to propagate. */
|
|
11
|
+
onTimeout: () => void;
|
|
12
|
+
/** Build the typed error rejected when the deadline fires. The configured
|
|
13
|
+
* `timeoutMs` is passed back so the message can include it without the
|
|
14
|
+
* caller re-encoding the value. */
|
|
15
|
+
buildTimeoutError: (timeoutMs: number) => Error;
|
|
16
|
+
}
|
|
17
|
+
/** Race `awaiter` against `timeoutMs`. On deadline: run `onTimeout`
|
|
18
|
+
* (swallowing throws), then reject with `buildTimeoutError(timeoutMs)`.
|
|
19
|
+
* The internal timer is cleared in `finally` so a late timeout cannot
|
|
20
|
+
* resolve the race after the awaiter settled first. */
|
|
21
|
+
export declare function raceHandshakeWithTimeout(opts: RaceHandshakeWithTimeoutOpts): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=handshake-timeout-race.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-timeout-race.d.ts","sourceRoot":"","sources":["../../src/pty/handshake-timeout-race.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,4BAA4B;IAC3C;qEACiE;IACjE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB;;;mEAG+D;IAC/D,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;wCAEoC;IACpC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC;CACjD;AAED;;;wDAGwD;AACxD,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Race `awaiter` against `timeoutMs`. On deadline: run `onTimeout`
|
|
2
|
+
* (swallowing throws), then reject with `buildTimeoutError(timeoutMs)`.
|
|
3
|
+
* The internal timer is cleared in `finally` so a late timeout cannot
|
|
4
|
+
* resolve the race after the awaiter settled first. */
|
|
5
|
+
export function raceHandshakeWithTimeout(opts) {
|
|
6
|
+
let timer = null;
|
|
7
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
8
|
+
timer = setTimeout(() => {
|
|
9
|
+
try {
|
|
10
|
+
opts.onTimeout();
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
/* swallowed -- see opts.onTimeout doc */
|
|
14
|
+
}
|
|
15
|
+
reject(opts.buildTimeoutError(opts.timeoutMs));
|
|
16
|
+
}, opts.timeoutMs);
|
|
17
|
+
});
|
|
18
|
+
return Promise.race([opts.awaiter, timeoutPromise]).finally(() => {
|
|
19
|
+
if (timer !== null)
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=handshake-timeout-race.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-timeout-race.js","sourceRoot":"","sources":["../../src/pty/handshake-timeout-race.ts"],"names":[],"mappings":"AAiCA;;;wDAGwD;AACxD,MAAM,UAAU,wBAAwB,CACtC,IAAkC;IAElC,IAAI,KAAK,GAAyC,IAAI,CAAC;IACvD,MAAM,cAAc,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACtD,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,IAAI,CAAC;gBACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,yCAAyC;YAC3C,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;QAC/D,IAAI,KAAK,KAAK,IAAI;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface HeadlessReplaySnapshotOptions {
|
|
2
|
+
cols: number;
|
|
3
|
+
rows: number;
|
|
4
|
+
scrollbackLines: number;
|
|
5
|
+
maxBytes: number;
|
|
6
|
+
}
|
|
7
|
+
export interface HeadlessReplaySnapshot {
|
|
8
|
+
text: string;
|
|
9
|
+
rawBytes: number;
|
|
10
|
+
snapshotBytes: number;
|
|
11
|
+
bufferLines: number;
|
|
12
|
+
emittedLines: number;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class HeadlessTerminalState {
|
|
16
|
+
private readonly term;
|
|
17
|
+
private readonly cols;
|
|
18
|
+
private readonly rows;
|
|
19
|
+
private readonly scrollbackLines;
|
|
20
|
+
private readonly maxBytes;
|
|
21
|
+
private rawBytes;
|
|
22
|
+
private pendingWrite;
|
|
23
|
+
constructor(options: HeadlessReplaySnapshotOptions);
|
|
24
|
+
write(data: string): Promise<void>;
|
|
25
|
+
snapshot(): Promise<HeadlessReplaySnapshot>;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildHeadlessReplaySnapshot(raw: string, options: HeadlessReplaySnapshotOptions): Promise<HeadlessReplaySnapshot>;
|
|
28
|
+
//# sourceMappingURL=headless-replay-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-replay-snapshot.d.ts","sourceRoot":"","sources":["../../src/pty/headless-replay-snapshot.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAiQD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqC;IAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,YAAY,CAAqB;gBAE7B,OAAO,EAAE,6BAA6B;IAgBlD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5B,QAAQ,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAalD;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,sBAAsB,CAAC,CAmBjC"}
|