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,662 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const CLAUDE_HOOK_SCRIPT_NAME = "parasor-claude-hook.sh";
|
|
5
|
+
const CODEX_EVENT_SCRIPT_NAME = "parasor-codex-event.sh";
|
|
6
|
+
const CODEX_NOTIFY_SCRIPT_NAME = "parasor-codex-notify.sh";
|
|
7
|
+
export function installShims(configDir) {
|
|
8
|
+
const binDir = join(configDir, "bin");
|
|
9
|
+
const shellDir = join(configDir, "shell");
|
|
10
|
+
const zshDotdir = join(shellDir, "zsh");
|
|
11
|
+
const bashDir = join(shellDir, "bash");
|
|
12
|
+
const bashRcPath = join(bashDir, ".bashrc");
|
|
13
|
+
mkdirSync(binDir, { recursive: true });
|
|
14
|
+
mkdirSync(zshDotdir, { recursive: true });
|
|
15
|
+
mkdirSync(bashDir, { recursive: true });
|
|
16
|
+
const realOpen = resolveRealBinary("open", binDir);
|
|
17
|
+
const realXdgOpen = resolveRealBinary("xdg-open", binDir);
|
|
18
|
+
if (realOpen) {
|
|
19
|
+
writeFileSync(join(binDir, "open"), `#!/bin/sh\nexec parasor shim-open --kind=macos-open -- "$@"\n`, { mode: 0o755 });
|
|
20
|
+
}
|
|
21
|
+
if (realXdgOpen) {
|
|
22
|
+
writeFileSync(join(binDir, "xdg-open"), `#!/bin/sh\nexec parasor shim-open --kind=xdg-open -- "$@"\n`, { mode: 0o755 });
|
|
23
|
+
}
|
|
24
|
+
// Standalone Claude Code hook bridge. The Claude wrapper points its
|
|
25
|
+
// hooks JSON at this script directly instead of `parasor hook claude`,
|
|
26
|
+
// because Node.js cold start (100-300ms per invocation) is the bottleneck
|
|
27
|
+
// for sidebar status latency -- every PreToolUse / PostToolUse / Stop
|
|
28
|
+
// pays the boot cost while Claude Code blocks on hook completion. A
|
|
29
|
+
// posix shell + curl one-shot runs in single-digit milliseconds.
|
|
30
|
+
const claudeHookPath = join(binDir, CLAUDE_HOOK_SCRIPT_NAME);
|
|
31
|
+
writeFileSync(claudeHookPath, buildClaudeHookBridge(), { mode: 0o755 });
|
|
32
|
+
// Claude Code wrapper. Sits in PATH ahead of the real `claude` binary,
|
|
33
|
+
// injects per-invocation `--settings <hooks JSON>` so Claude Code's hook
|
|
34
|
+
// events fire the bridge script for each state transition. We do not
|
|
35
|
+
// touch the user's `~/.claude/settings.json` -- Claude Code's `--settings`
|
|
36
|
+
// flag accepts an inline JSON string and merges additively at runtime.
|
|
37
|
+
writeFileSync(join(binDir, "claude"), buildClaudeWrapper(binDir, claudeHookPath), {
|
|
38
|
+
mode: 0o755,
|
|
39
|
+
});
|
|
40
|
+
// Codex wrapper. Unlike Claude, Codex's native hooks currently require a
|
|
41
|
+
// hooks.json layer, which would either mutate the user's ~/.codex or force
|
|
42
|
+
// us to swap CODEX_HOME (and therefore auth/config) for the whole process.
|
|
43
|
+
// To stay app-contained, we follow a runtime-only path instead:
|
|
44
|
+
// inject a per-process notify command and record the TUI session log, then
|
|
45
|
+
// translate the explicit task/approval events into parasor hook-notify
|
|
46
|
+
// signals.
|
|
47
|
+
const codexEventPath = join(binDir, CODEX_EVENT_SCRIPT_NAME);
|
|
48
|
+
const codexNotifyPath = join(binDir, CODEX_NOTIFY_SCRIPT_NAME);
|
|
49
|
+
writeFileSync(codexEventPath, buildCodexEventBridge(), { mode: 0o755 });
|
|
50
|
+
writeFileSync(codexNotifyPath, buildCodexNotifyBridge(), { mode: 0o755 });
|
|
51
|
+
writeFileSync(join(binDir, "codex"), buildCodexWrapper(binDir, codexEventPath, codexNotifyPath), {
|
|
52
|
+
mode: 0o755,
|
|
53
|
+
});
|
|
54
|
+
writeFileSync(join(zshDotdir, ".zshenv"), buildParasorZshEnv(binDir), {
|
|
55
|
+
mode: 0o644,
|
|
56
|
+
});
|
|
57
|
+
writeFileSync(join(zshDotdir, ".zshrc"), buildParasorZshRc(binDir), {
|
|
58
|
+
mode: 0o644,
|
|
59
|
+
});
|
|
60
|
+
writeFileSync(bashRcPath, buildParasorBashRc(binDir), {
|
|
61
|
+
mode: 0o644,
|
|
62
|
+
});
|
|
63
|
+
return { bashRcPath, binDir, realOpen, realXdgOpen, zshDotdir };
|
|
64
|
+
}
|
|
65
|
+
export function buildCodexEventBridge() {
|
|
66
|
+
return `#!/bin/sh
|
|
67
|
+
# parasor Codex event bridge.
|
|
68
|
+
#
|
|
69
|
+
# Receives a normalized Codex event name as argv[1] and POSTs it directly
|
|
70
|
+
# to parasor's loopback hook endpoint. Used by the Codex wrapper's session
|
|
71
|
+
# log watcher for task_started / task_complete / *_approval_request events.
|
|
72
|
+
|
|
73
|
+
set -u
|
|
74
|
+
|
|
75
|
+
[ -z "\${PARASOR_PORT:-}" ] && exit 0
|
|
76
|
+
[ -z "\${PARASOR_SESSION_ID:-}" ] && exit 0
|
|
77
|
+
|
|
78
|
+
EVENT="\${1:-}"
|
|
79
|
+
[ -z "$EVENT" ] && exit 0
|
|
80
|
+
|
|
81
|
+
BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"agent\\":\\"codex\\",\\"event\\":\\"$EVENT\\"}"
|
|
82
|
+
DEBUG_BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"label\\":\\"codex-session-log\\",\\"detail\\":\\"$EVENT\\"}"
|
|
83
|
+
|
|
84
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/debug" \\
|
|
85
|
+
-H "Content-Type: application/json" \\
|
|
86
|
+
-d "$DEBUG_BODY" \\
|
|
87
|
+
--connect-timeout 1 \\
|
|
88
|
+
--max-time 2 \\
|
|
89
|
+
-o /dev/null \\
|
|
90
|
+
>/dev/null 2>&1 || true
|
|
91
|
+
|
|
92
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/notify" \\
|
|
93
|
+
-H "Content-Type: application/json" \\
|
|
94
|
+
-d "$BODY" \\
|
|
95
|
+
--connect-timeout 1 \\
|
|
96
|
+
--max-time 2 \\
|
|
97
|
+
-o /dev/null \\
|
|
98
|
+
>/dev/null 2>&1 || true
|
|
99
|
+
|
|
100
|
+
exit 0
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
export function buildCodexNotifyBridge() {
|
|
104
|
+
return `#!/bin/sh
|
|
105
|
+
# parasor Codex notify bridge.
|
|
106
|
+
#
|
|
107
|
+
# Codex's runtime \`notify\` config appends a single JSON payload argument
|
|
108
|
+
# after each completed turn. We extract the payload's event type (usually
|
|
109
|
+
# agent-turn-complete) and forward it to parasor as a high-confidence Codex
|
|
110
|
+
# lifecycle event.
|
|
111
|
+
|
|
112
|
+
set -u
|
|
113
|
+
|
|
114
|
+
[ -z "\${PARASOR_PORT:-}" ] && exit 0
|
|
115
|
+
[ -z "\${PARASOR_SESSION_ID:-}" ] && exit 0
|
|
116
|
+
|
|
117
|
+
PAYLOAD="\${1:-}"
|
|
118
|
+
[ -z "$PAYLOAD" ] && exit 0
|
|
119
|
+
|
|
120
|
+
field() {
|
|
121
|
+
printf '%s' "$PAYLOAD" \\
|
|
122
|
+
| grep -oE "\\"$1\\"[[:space:]]*:[[:space:]]*\\"[^\\"]*\\"" \\
|
|
123
|
+
| head -n1 \\
|
|
124
|
+
| sed -E "s/^\\"$1\\"[[:space:]]*:[[:space:]]*\\"([^\\"]*)\\"$/\\1/"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
EVENT=$(field type)
|
|
128
|
+
[ -z "$EVENT" ] && EVENT=$(field event)
|
|
129
|
+
[ -z "$EVENT" ] && EVENT=$(field hook_event_name)
|
|
130
|
+
[ -z "$EVENT" ] && exit 0
|
|
131
|
+
|
|
132
|
+
BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"agent\\":\\"codex\\",\\"event\\":\\"$EVENT\\"}"
|
|
133
|
+
DEBUG_BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"label\\":\\"codex-notify\\",\\"detail\\":\\"$EVENT\\"}"
|
|
134
|
+
|
|
135
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/debug" \\
|
|
136
|
+
-H "Content-Type: application/json" \\
|
|
137
|
+
-d "$DEBUG_BODY" \\
|
|
138
|
+
--connect-timeout 1 \\
|
|
139
|
+
--max-time 2 \\
|
|
140
|
+
-o /dev/null \\
|
|
141
|
+
>/dev/null 2>&1 || true
|
|
142
|
+
|
|
143
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/notify" \\
|
|
144
|
+
-H "Content-Type: application/json" \\
|
|
145
|
+
-d "$BODY" \\
|
|
146
|
+
--connect-timeout 1 \\
|
|
147
|
+
--max-time 2 \\
|
|
148
|
+
-o /dev/null \\
|
|
149
|
+
>/dev/null 2>&1 || true
|
|
150
|
+
|
|
151
|
+
exit 0
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Build the posix-shell source of the Claude Code hook bridge. Reads a
|
|
156
|
+
* Claude Code hook payload on stdin, extracts the event name (plus a
|
|
157
|
+
* payload-driven discriminator for PreToolUse/Notification), and POSTs
|
|
158
|
+
* the normalized {sessionId, agent, event} triple to the loopback
|
|
159
|
+
* /hook/notify endpoint. Always exits 0 so a hook failure never breaks
|
|
160
|
+
* the agent. Returns inline so the script content can be unit-tested.
|
|
161
|
+
*
|
|
162
|
+
* Why this is a separate file and not inlined into the wrapper's hooks
|
|
163
|
+
* JSON: hook commands are a single argv[0], not a shell snippet, and
|
|
164
|
+
* embedding multi-line shell into JSON is illegible. Keeping it in its
|
|
165
|
+
* own file under the shim binDir also lets users inspect what they're
|
|
166
|
+
* running.
|
|
167
|
+
*/
|
|
168
|
+
export function buildClaudeHookBridge() {
|
|
169
|
+
// Composed as a string template so the script can grow without
|
|
170
|
+
// fighting JS escape rules. The shell-side variables are all
|
|
171
|
+
// unprefixed identifiers (PAYLOAD, EVENT, ...) so backticks stay free.
|
|
172
|
+
return `#!/bin/sh
|
|
173
|
+
# parasor Claude Code hook bridge.
|
|
174
|
+
#
|
|
175
|
+
# Auto-installed by parasor into its shim binDir. Claude Code invokes
|
|
176
|
+
# this script for each subscribed hook event with a JSON payload on
|
|
177
|
+
# stdin. We extract the event name (plus a payload-driven discriminator
|
|
178
|
+
# where the downstream state mapping needs one) and POST it to the
|
|
179
|
+
# loopback parasor server. Always exits 0 -- a hook failure must never
|
|
180
|
+
# break the agent.
|
|
181
|
+
#
|
|
182
|
+
# Why a shell script and not the typed \`parasor hook claude\` Node CLI:
|
|
183
|
+
# Claude Code blocks on hook completion before advancing the agent loop,
|
|
184
|
+
# and a Node cold start of 100-300ms per hook is enough to make the
|
|
185
|
+
# sidebar's running/idle indicator visibly lag. A posix shell + curl
|
|
186
|
+
# one-shot runs in single-digit milliseconds.
|
|
187
|
+
|
|
188
|
+
set -u
|
|
189
|
+
|
|
190
|
+
# Bail when the parasor server isn't reachable. PARASOR_PORT and
|
|
191
|
+
# PARASOR_SESSION_ID are set on every PTY parasor spawns; if they're
|
|
192
|
+
# missing we're not running under a live parasor session.
|
|
193
|
+
[ -z "\${PARASOR_PORT:-}" ] && exit 0
|
|
194
|
+
[ -z "\${PARASOR_SESSION_ID:-}" ] && exit 0
|
|
195
|
+
|
|
196
|
+
PAYLOAD=$(cat)
|
|
197
|
+
[ -z "$PAYLOAD" ] && exit 0
|
|
198
|
+
|
|
199
|
+
# Extract a single \`"key":"value"\` string field from PAYLOAD by name.
|
|
200
|
+
# Tolerates whitespace around the colon. The fields we actually read
|
|
201
|
+
# (hook_event_name, tool_name, notification_type) are short snake_case
|
|
202
|
+
# identifiers from Claude Code's own enums and never contain escaped
|
|
203
|
+
# quotes, so a regex extractor is safe -- we explicitly accept that this
|
|
204
|
+
# would not survive arbitrary JSON.
|
|
205
|
+
field() {
|
|
206
|
+
printf '%s' "$PAYLOAD" \\
|
|
207
|
+
| grep -oE "\\"$1\\"[[:space:]]*:[[:space:]]*\\"[^\\"]*\\"" \\
|
|
208
|
+
| head -n1 \\
|
|
209
|
+
| sed -E "s/^\\"$1\\"[[:space:]]*:[[:space:]]*\\"([^\\"]*)\\"$/\\1/"
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
EVENT=$(field hook_event_name)
|
|
213
|
+
[ -z "$EVENT" ] && exit 0
|
|
214
|
+
|
|
215
|
+
# Discriminate events whose downstream state mapping depends on a
|
|
216
|
+
# payload field (see agent-detector/event-map.ts). The composite key
|
|
217
|
+
# is parsed in mapEventType() with a fallback to the bare event class,
|
|
218
|
+
# so adding a new tool here just lets future overrides specialize it.
|
|
219
|
+
case "$EVENT" in
|
|
220
|
+
PreToolUse)
|
|
221
|
+
TOOL=$(field tool_name)
|
|
222
|
+
[ -n "$TOOL" ] && EVENT="$EVENT:$TOOL"
|
|
223
|
+
;;
|
|
224
|
+
Notification)
|
|
225
|
+
NTYPE=$(field notification_type)
|
|
226
|
+
[ -n "$NTYPE" ] && EVENT="$EVENT:$NTYPE"
|
|
227
|
+
;;
|
|
228
|
+
esac
|
|
229
|
+
|
|
230
|
+
# Hand-built JSON body. Every value comes from a server-set env var
|
|
231
|
+
# or one of Claude Code's enum strings, so there's no quoting hazard.
|
|
232
|
+
BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"agent\\":\\"claude\\",\\"event\\":\\"$EVENT\\"}"
|
|
233
|
+
DEBUG_BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"label\\":\\"claude-hook-bridge\\",\\"detail\\":\\"$EVENT\\"}"
|
|
234
|
+
|
|
235
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/debug" \\
|
|
236
|
+
-H "Content-Type: application/json" \\
|
|
237
|
+
-d "$DEBUG_BODY" \\
|
|
238
|
+
--connect-timeout 1 \\
|
|
239
|
+
--max-time 2 \\
|
|
240
|
+
-o /dev/null \\
|
|
241
|
+
>/dev/null 2>&1 || true
|
|
242
|
+
|
|
243
|
+
# Short timeouts so a flaky local server can't stall the agent loop.
|
|
244
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/notify" \\
|
|
245
|
+
-H "Content-Type: application/json" \\
|
|
246
|
+
-d "$BODY" \\
|
|
247
|
+
--connect-timeout 1 \\
|
|
248
|
+
--max-time 2 \\
|
|
249
|
+
-o /dev/null \\
|
|
250
|
+
>/dev/null 2>&1 || true
|
|
251
|
+
|
|
252
|
+
if [ "\${PARASOR_HOOK_DEBUG:-}" = "1" ]; then
|
|
253
|
+
printf '[parasor-hook] %s\\n' "$EVENT" >&2
|
|
254
|
+
fi
|
|
255
|
+
|
|
256
|
+
exit 0
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Build the bash source of the claude wrapper. Inline so it can read the
|
|
261
|
+
* shim binDir at install time and avoid self-reference loops.
|
|
262
|
+
*/
|
|
263
|
+
export function buildClaudeWrapper(binDir, hookScriptPath) {
|
|
264
|
+
// Hooks JSON. Every event uses the same command (the inline bash hook
|
|
265
|
+
// bridge above), which parses Claude Code's stdin payload and forwards
|
|
266
|
+
// a normalized event to the loopback /hook/notify endpoint.
|
|
267
|
+
//
|
|
268
|
+
// Nine core events are subscribed (server-side normalized via
|
|
269
|
+
// agent-detector/event-map.ts -> AgentState.lifecycle):
|
|
270
|
+
// SessionStart -> noop on the server (no visible status flash)
|
|
271
|
+
// UserPromptSubmit -> running (user typed a prompt)
|
|
272
|
+
// PreToolUse -> usually running; only explicit hand-off tools
|
|
273
|
+
// (AskUserQuestion / ExitPlanMode)
|
|
274
|
+
// are elevated to waiting by the event
|
|
275
|
+
// map after we include tool_name in the
|
|
276
|
+
// forwarded event string.
|
|
277
|
+
// PermissionRequest -> waiting (official Claude permission dialog)
|
|
278
|
+
// PermissionDenied -> running (auto-mode denial; Claude keeps going)
|
|
279
|
+
// PostToolUse -> running (tool finished, agent thinking again)
|
|
280
|
+
// Stop -> completed (assistant finished its turn)
|
|
281
|
+
// Notification -> only specific user-input-required subtypes map
|
|
282
|
+
// to waiting; generic notifications are
|
|
283
|
+
// ignored conservatively.
|
|
284
|
+
// Elicitation -> waiting (MCP asked the user a question)
|
|
285
|
+
// ElicitationResult -> running (user answered; Claude resumes)
|
|
286
|
+
// SessionEnd -> idle (Ctrl+C cleanup -- Stop does not fire)
|
|
287
|
+
const hookEntry = {
|
|
288
|
+
matcher: "",
|
|
289
|
+
hooks: [{ type: "command", command: hookScriptPath, timeout: 5 }],
|
|
290
|
+
};
|
|
291
|
+
const hooksJson = JSON.stringify({
|
|
292
|
+
hooks: {
|
|
293
|
+
SessionStart: [hookEntry],
|
|
294
|
+
UserPromptSubmit: [hookEntry],
|
|
295
|
+
PreToolUse: [hookEntry],
|
|
296
|
+
PermissionRequest: [hookEntry],
|
|
297
|
+
PermissionDenied: [hookEntry],
|
|
298
|
+
PostToolUse: [hookEntry],
|
|
299
|
+
Stop: [hookEntry],
|
|
300
|
+
Notification: [hookEntry],
|
|
301
|
+
Elicitation: [hookEntry],
|
|
302
|
+
ElicitationResult: [hookEntry],
|
|
303
|
+
SessionEnd: [hookEntry],
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
// `find_real_claude` walks PATH skipping our own binDir so we never
|
|
307
|
+
// exec ourselves recursively. `inside_parasor` confirms we're still
|
|
308
|
+
// running under a live parasor server before injecting hooks -- if the
|
|
309
|
+
// server crashed mid-session and PARASOR_PORT is stale, fall through
|
|
310
|
+
// to the real claude unmodified rather than silently breaking every
|
|
311
|
+
// prompt.
|
|
312
|
+
return `#!/usr/bin/env bash
|
|
313
|
+
# parasor claude wrapper -- injects --settings hooks JSON so Claude Code's
|
|
314
|
+
# SessionStart / UserPromptSubmit / PreToolUse / PermissionRequest /
|
|
315
|
+
# PermissionDenied / Stop / Notification / Elicitation /
|
|
316
|
+
# ElicitationResult / SessionEnd hooks call back into parasor via the
|
|
317
|
+
# typed \`parasor hook claude\` bridge. Auto-installed by parasor into its
|
|
318
|
+
# shim binDir, which the server prepends to PATH for every PTY it spawns.
|
|
319
|
+
# No global Claude config (~/.claude/settings.json) is modified.
|
|
320
|
+
|
|
321
|
+
set -u
|
|
322
|
+
|
|
323
|
+
SHIM_DIR='${binDir}'
|
|
324
|
+
# HOOKS_JSON is embedded as a bash single-quoted string. Single-quoted
|
|
325
|
+
# strings in bash don't interpret backslashes, so JSON escapes (e.g. \\n)
|
|
326
|
+
# survive intact. The only character that needs escaping is the literal
|
|
327
|
+
# single quote, which we close-quote-escape-reopen with the standard
|
|
328
|
+
# '\\'' trick. The embedded JSON below is produced by JSON.stringify
|
|
329
|
+
# from a fixed object literal in shim-installer.ts, so no user-controlled
|
|
330
|
+
# content lands here -- the escape pass is a future-proofing belt.
|
|
331
|
+
HOOKS_JSON='${hooksJson.replace(/'/g, "'\\''")}'
|
|
332
|
+
|
|
333
|
+
find_real_claude() {
|
|
334
|
+
local IFS=:
|
|
335
|
+
for d in $PATH; do
|
|
336
|
+
[ -z "$d" ] && continue
|
|
337
|
+
[ "$d" = "$SHIM_DIR" ] && continue
|
|
338
|
+
if [ -x "$d/claude" ] && [ "$d/claude" != "$0" ]; then
|
|
339
|
+
printf '%s\\n' "$d/claude"
|
|
340
|
+
return 0
|
|
341
|
+
fi
|
|
342
|
+
done
|
|
343
|
+
return 1
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
inside_parasor() {
|
|
347
|
+
[ -n "\${PARASOR_PORT:-}" ] || return 1
|
|
348
|
+
[ -n "\${PARASOR_SESSION_ID:-}" ] || return 1
|
|
349
|
+
return 0
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
REAL_CLAUDE="$(find_real_claude)" || {
|
|
353
|
+
echo 'parasor claude shim: real claude binary not found in PATH' >&2
|
|
354
|
+
exit 127
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
# Pass through subcommands that don't accept --settings (or where
|
|
358
|
+
# injecting hooks would be meaningless).
|
|
359
|
+
case "\${1:-}" in
|
|
360
|
+
mcp|config|api-key|migrate-installer|update|doctor|help|--help|-h|--version|-v)
|
|
361
|
+
exec "$REAL_CLAUDE" "$@"
|
|
362
|
+
;;
|
|
363
|
+
esac
|
|
364
|
+
|
|
365
|
+
# Outside parasor: passthrough cleanly.
|
|
366
|
+
if ! inside_parasor; then
|
|
367
|
+
exec "$REAL_CLAUDE" "$@"
|
|
368
|
+
fi
|
|
369
|
+
|
|
370
|
+
DEBUG_BODY="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"label\\":\\"claude-wrapper-exec\\",\\"detail\\":\\"\${1:-}\\"}"
|
|
371
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/debug" \\
|
|
372
|
+
-H "Content-Type: application/json" \\
|
|
373
|
+
-d "$DEBUG_BODY" \\
|
|
374
|
+
--connect-timeout 1 \\
|
|
375
|
+
--max-time 2 \\
|
|
376
|
+
-o /dev/null \\
|
|
377
|
+
>/dev/null 2>&1 || true
|
|
378
|
+
|
|
379
|
+
# Parasor active -- inject hooks. \`parasor hook claude\` reads each hook's
|
|
380
|
+
# stdin payload (which Claude Code populates with hook_event_name etc.)
|
|
381
|
+
# and forwards the normalized state via the loopback HTTP endpoint.
|
|
382
|
+
#
|
|
383
|
+
# When PARASOR_UPLOAD_DIR is set (upload staging isolation -- chat composer drops live
|
|
384
|
+
# under $TMPDIR/parasor/uploads/, outside the project tree), extend
|
|
385
|
+
# Claude Code's cwd allowlist with --add-dir so the agent can read files
|
|
386
|
+
# the user just dropped. PARASOR_UPLOAD_DIR is exported by the parasor
|
|
387
|
+
# server for every PTY it spawns; absent on legacy installs, in which case
|
|
388
|
+
# we omit the flag.
|
|
389
|
+
EXTRA_ARGS=()
|
|
390
|
+
if [ -n "\${PARASOR_UPLOAD_DIR:-}" ]; then
|
|
391
|
+
EXTRA_ARGS+=(--add-dir "$PARASOR_UPLOAD_DIR")
|
|
392
|
+
fi
|
|
393
|
+
exec "$REAL_CLAUDE" --settings "$HOOKS_JSON" "\${EXTRA_ARGS[@]}" "$@"
|
|
394
|
+
`;
|
|
395
|
+
}
|
|
396
|
+
export function buildCodexWrapper(binDir, eventScriptPath, notifyScriptPath) {
|
|
397
|
+
const notifyConfig = JSON.stringify(["bash", notifyScriptPath]);
|
|
398
|
+
return `#!/usr/bin/env bash
|
|
399
|
+
# parasor codex wrapper -- injects a per-process notify command and records
|
|
400
|
+
# the Codex TUI session log so task_started / task_complete /
|
|
401
|
+
# *_approval_request can be mirrored into parasor without editing the
|
|
402
|
+
# user's ~/.codex files. This follows the same runtime-only approach
|
|
403
|
+
# the runtime-only wrapper uses when native hooks are unavailable or undesirable.
|
|
404
|
+
|
|
405
|
+
set -u
|
|
406
|
+
|
|
407
|
+
SHIM_DIR='${binDir}'
|
|
408
|
+
CODEX_EVENT_SCRIPT='${eventScriptPath}'
|
|
409
|
+
NOTIFY_ARG='${notifyConfig.replace(/'/g, "'\\''")}'
|
|
410
|
+
|
|
411
|
+
find_real_codex() {
|
|
412
|
+
local IFS=:
|
|
413
|
+
for d in $PATH; do
|
|
414
|
+
[ -z "$d" ] && continue
|
|
415
|
+
[ "$d" = "$SHIM_DIR" ] && continue
|
|
416
|
+
if [ -x "$d/codex" ] && [ "$d/codex" != "$0" ]; then
|
|
417
|
+
printf '%s\\n' "$d/codex"
|
|
418
|
+
return 0
|
|
419
|
+
fi
|
|
420
|
+
done
|
|
421
|
+
return 1
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
inside_parasor() {
|
|
425
|
+
[ -n "\${PARASOR_PORT:-}" ] || return 1
|
|
426
|
+
[ -n "\${PARASOR_SESSION_ID:-}" ] || return 1
|
|
427
|
+
return 0
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
emit_debug() {
|
|
431
|
+
[ -n "\${PARASOR_PORT:-}" ] || return 0
|
|
432
|
+
[ -n "\${PARASOR_SESSION_ID:-}" ] || return 0
|
|
433
|
+
local label
|
|
434
|
+
local detail
|
|
435
|
+
label="\${1:-codex-wrapper-exec}"
|
|
436
|
+
detail="\${2:-}"
|
|
437
|
+
local body
|
|
438
|
+
body="{\\"sessionId\\":\\"$PARASOR_SESSION_ID\\",\\"label\\":\\"$label\\",\\"detail\\":\\"$detail\\"}"
|
|
439
|
+
curl -s -X POST "http://127.0.0.1:$PARASOR_PORT/hook/debug" \\
|
|
440
|
+
-H "Content-Type: application/json" \\
|
|
441
|
+
-d "$body" \\
|
|
442
|
+
--connect-timeout 1 \\
|
|
443
|
+
--max-time 2 \\
|
|
444
|
+
-o /dev/null \\
|
|
445
|
+
>/dev/null 2>&1 || true
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
start_session_log_watcher() {
|
|
449
|
+
export CODEX_TUI_RECORD_SESSION=1
|
|
450
|
+
|
|
451
|
+
if [ -z "\${CODEX_TUI_SESSION_LOG_PATH:-}" ]; then
|
|
452
|
+
local stamp
|
|
453
|
+
stamp="$(date +%s 2>/dev/null || printf '%s' "$$")"
|
|
454
|
+
export CODEX_TUI_SESSION_LOG_PATH="\${TMPDIR:-/tmp}/parasor-codex-session-$PARASOR_SESSION_ID-$stamp.jsonl"
|
|
455
|
+
emit_debug codex-wrapper-session-log-path created
|
|
456
|
+
else
|
|
457
|
+
emit_debug codex-wrapper-session-log-path provided
|
|
458
|
+
fi
|
|
459
|
+
emit_debug codex-wrapper-watcher-start
|
|
460
|
+
|
|
461
|
+
(
|
|
462
|
+
local log_path="$CODEX_TUI_SESSION_LOG_PATH"
|
|
463
|
+
local last_turn_id=""
|
|
464
|
+
local last_completion_id=""
|
|
465
|
+
local last_approval_id=""
|
|
466
|
+
local last_exec_call_id=""
|
|
467
|
+
local fallback_seq=0
|
|
468
|
+
local saw_line=0
|
|
469
|
+
local i=0
|
|
470
|
+
|
|
471
|
+
while [ ! -f "$log_path" ] && [ "$i" -lt 200 ]; do
|
|
472
|
+
i=$((i + 1))
|
|
473
|
+
sleep 0.05
|
|
474
|
+
done
|
|
475
|
+
if [ ! -f "$log_path" ]; then
|
|
476
|
+
emit_debug codex-wrapper-watcher-timeout
|
|
477
|
+
exit 0
|
|
478
|
+
fi
|
|
479
|
+
emit_debug codex-wrapper-watcher-ready "$i"
|
|
480
|
+
|
|
481
|
+
tail -n 0 -F "$log_path" 2>/dev/null | while IFS= read -r line; do
|
|
482
|
+
if [ "$saw_line" -eq 0 ]; then
|
|
483
|
+
saw_line=1
|
|
484
|
+
emit_debug codex-wrapper-session-log-line first
|
|
485
|
+
fi
|
|
486
|
+
case "$line" in
|
|
487
|
+
*'"dir":"from_tui"'*'"kind":"op"'*'"UserTurn"'*)
|
|
488
|
+
emit_debug codex-wrapper-session-log-event task_started_from_tui
|
|
489
|
+
"$CODEX_EVENT_SCRIPT" task_started >/dev/null 2>&1 || true
|
|
490
|
+
;;
|
|
491
|
+
*'"dir":"to_tui"'*'"kind":"codex_event"'*'"msg":{"type":"task_started"'*)
|
|
492
|
+
turn_id=$(printf '%s\\n' "$line" | awk -F'"turn_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
493
|
+
[ -n "$turn_id" ] || turn_id=$(printf '%s\\n' "$line" | awk -F'"id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
494
|
+
[ -n "$turn_id" ] || turn_id="task_started"
|
|
495
|
+
if [ "$turn_id" != "$last_turn_id" ]; then
|
|
496
|
+
last_turn_id="$turn_id"
|
|
497
|
+
emit_debug codex-wrapper-session-log-event task_started
|
|
498
|
+
"$CODEX_EVENT_SCRIPT" task_started >/dev/null 2>&1 || true
|
|
499
|
+
fi
|
|
500
|
+
;;
|
|
501
|
+
*'"dir":"to_tui"'*'"kind":"codex_event"'*'"msg":{"type":"task_complete"'*)
|
|
502
|
+
completion_id=$(printf '%s\\n' "$line" | awk -F'"turn_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
503
|
+
[ -n "$completion_id" ] || completion_id=$(printf '%s\\n' "$line" | awk -F'"id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
504
|
+
[ -n "$completion_id" ] || completion_id="task_complete"
|
|
505
|
+
if [ "$completion_id" != "$last_completion_id" ]; then
|
|
506
|
+
last_completion_id="$completion_id"
|
|
507
|
+
emit_debug codex-wrapper-session-log-event task_complete
|
|
508
|
+
"$CODEX_EVENT_SCRIPT" task_complete >/dev/null 2>&1 || true
|
|
509
|
+
fi
|
|
510
|
+
;;
|
|
511
|
+
*'"dir":"to_tui"'*'"kind":"codex_event"'*'"msg":{"type":"'*'_approval_request"'*)
|
|
512
|
+
approval_event=$(printf '%s\\n' "$line" | awk -F'"type":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
513
|
+
[ -n "$approval_event" ] || approval_event="request_user_input"
|
|
514
|
+
approval_id=$(printf '%s\\n' "$line" | awk -F'"id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
515
|
+
[ -n "$approval_id" ] || approval_id=$(printf '%s\\n' "$line" | awk -F'"approval_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
516
|
+
[ -n "$approval_id" ] || approval_id=$(printf '%s\\n' "$line" | awk -F'"call_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
517
|
+
if [ -z "$approval_id" ]; then
|
|
518
|
+
fallback_seq=$((fallback_seq + 1))
|
|
519
|
+
approval_id="approval_request_$fallback_seq"
|
|
520
|
+
fi
|
|
521
|
+
if [ "$approval_id" != "$last_approval_id" ]; then
|
|
522
|
+
last_approval_id="$approval_id"
|
|
523
|
+
emit_debug codex-wrapper-session-log-event "$approval_event"
|
|
524
|
+
"$CODEX_EVENT_SCRIPT" "$approval_event" >/dev/null 2>&1 || true
|
|
525
|
+
fi
|
|
526
|
+
;;
|
|
527
|
+
*'"dir":"to_tui"'*'"kind":"codex_event"'*'"msg":{"type":"request_user_input"'*)
|
|
528
|
+
approval_id=$(printf '%s\\n' "$line" | awk -F'"call_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
529
|
+
[ -n "$approval_id" ] || approval_id=$(printf '%s\\n' "$line" | awk -F'"id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
530
|
+
[ -n "$approval_id" ] || approval_id="request_user_input"
|
|
531
|
+
if [ "$approval_id" != "$last_approval_id" ]; then
|
|
532
|
+
last_approval_id="$approval_id"
|
|
533
|
+
emit_debug codex-wrapper-session-log-event request_user_input
|
|
534
|
+
"$CODEX_EVENT_SCRIPT" request_user_input >/dev/null 2>&1 || true
|
|
535
|
+
fi
|
|
536
|
+
;;
|
|
537
|
+
*'"dir":"to_tui"'*'"kind":"codex_event"'*'"msg":{"type":"exec_command_begin"'*)
|
|
538
|
+
exec_call_id=$(printf '%s\\n' "$line" | awk -F'"call_id":"' 'NF > 1 { sub(/".*/, "", $2); print $2; exit }')
|
|
539
|
+
if [ -n "$exec_call_id" ]; then
|
|
540
|
+
if [ "$exec_call_id" != "$last_exec_call_id" ]; then
|
|
541
|
+
last_exec_call_id="$exec_call_id"
|
|
542
|
+
emit_debug codex-wrapper-session-log-event exec_command_begin
|
|
543
|
+
"$CODEX_EVENT_SCRIPT" exec_command_begin >/dev/null 2>&1 || true
|
|
544
|
+
fi
|
|
545
|
+
else
|
|
546
|
+
emit_debug codex-wrapper-session-log-event exec_command_begin
|
|
547
|
+
"$CODEX_EVENT_SCRIPT" exec_command_begin >/dev/null 2>&1 || true
|
|
548
|
+
fi
|
|
549
|
+
;;
|
|
550
|
+
esac
|
|
551
|
+
done
|
|
552
|
+
) &
|
|
553
|
+
|
|
554
|
+
PARASOR_CODEX_WATCHER_PID=$!
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
stop_session_log_watcher() {
|
|
558
|
+
if [ -n "\${PARASOR_CODEX_WATCHER_PID:-}" ]; then
|
|
559
|
+
kill "$PARASOR_CODEX_WATCHER_PID" >/dev/null 2>&1 || true
|
|
560
|
+
wait "$PARASOR_CODEX_WATCHER_PID" 2>/dev/null || true
|
|
561
|
+
fi
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if inside_parasor; then
|
|
565
|
+
emit_debug codex-wrapper-entry "\${1:-}"
|
|
566
|
+
emit_debug codex-wrapper-realpath-start
|
|
567
|
+
fi
|
|
568
|
+
|
|
569
|
+
REAL_CODEX="$(find_real_codex)" || {
|
|
570
|
+
echo 'parasor codex shim: real codex binary not found in PATH' >&2
|
|
571
|
+
emit_debug codex-wrapper-realpath missing
|
|
572
|
+
exit 127
|
|
573
|
+
}
|
|
574
|
+
emit_debug codex-wrapper-realpath found
|
|
575
|
+
|
|
576
|
+
case "\${1:-}" in
|
|
577
|
+
exec|review|login|logout|mcp|marketplace|mcp-server|app-server|app|completion|sandbox|debug|apply|cloud|exec-server|features|help|--help|-h|--version|-V)
|
|
578
|
+
exec "$REAL_CODEX" "$@"
|
|
579
|
+
;;
|
|
580
|
+
esac
|
|
581
|
+
|
|
582
|
+
if ! inside_parasor; then
|
|
583
|
+
exec "$REAL_CODEX" "$@"
|
|
584
|
+
fi
|
|
585
|
+
|
|
586
|
+
emit_debug codex-wrapper-exec "\${1:-}"
|
|
587
|
+
start_session_log_watcher
|
|
588
|
+
|
|
589
|
+
emit_debug codex-wrapper-exec-start "\${1:-}"
|
|
590
|
+
"$REAL_CODEX" -c "notify=$NOTIFY_ARG" "$@"
|
|
591
|
+
PARASOR_CODEX_STATUS=$?
|
|
592
|
+
emit_debug codex-wrapper-exit "$PARASOR_CODEX_STATUS"
|
|
593
|
+
|
|
594
|
+
stop_session_log_watcher
|
|
595
|
+
exit "$PARASOR_CODEX_STATUS"
|
|
596
|
+
`;
|
|
597
|
+
}
|
|
598
|
+
export function buildParasorZshEnv(binDir) {
|
|
599
|
+
return `# parasor zsh env overlay
|
|
600
|
+
if [ -f "$HOME/.zshenv" ]; then
|
|
601
|
+
source "$HOME/.zshenv"
|
|
602
|
+
fi
|
|
603
|
+
export PATH='${binDir}':"$PATH"
|
|
604
|
+
`;
|
|
605
|
+
}
|
|
606
|
+
export function buildParasorZshRc(binDir) {
|
|
607
|
+
return `# parasor zsh rc overlay
|
|
608
|
+
if [ -f "$HOME/.zshrc" ]; then
|
|
609
|
+
source "$HOME/.zshrc"
|
|
610
|
+
fi
|
|
611
|
+
export PATH='${binDir}':"$PATH"
|
|
612
|
+
unalias claude 2>/dev/null || true
|
|
613
|
+
unalias codex 2>/dev/null || true
|
|
614
|
+
claude() {
|
|
615
|
+
command '${join(binDir, "claude")}' "$@"
|
|
616
|
+
}
|
|
617
|
+
codex() {
|
|
618
|
+
command '${join(binDir, "codex")}' "$@"
|
|
619
|
+
}
|
|
620
|
+
rehash 2>/dev/null || true
|
|
621
|
+
`;
|
|
622
|
+
}
|
|
623
|
+
export function buildParasorBashRc(binDir) {
|
|
624
|
+
return `# parasor bash rc overlay
|
|
625
|
+
if [ -f "$HOME/.bashrc" ]; then
|
|
626
|
+
source "$HOME/.bashrc"
|
|
627
|
+
fi
|
|
628
|
+
export PATH='${binDir}':"$PATH"
|
|
629
|
+
unalias claude 2>/dev/null || true
|
|
630
|
+
unalias codex 2>/dev/null || true
|
|
631
|
+
claude() {
|
|
632
|
+
command '${join(binDir, "claude")}' "$@"
|
|
633
|
+
}
|
|
634
|
+
codex() {
|
|
635
|
+
command '${join(binDir, "codex")}' "$@"
|
|
636
|
+
}
|
|
637
|
+
hash -r 2>/dev/null || true
|
|
638
|
+
`;
|
|
639
|
+
}
|
|
640
|
+
function resolveRealBinary(name, shimBinDir) {
|
|
641
|
+
try {
|
|
642
|
+
const allPaths = execFileSync("which", ["-a", name], {
|
|
643
|
+
encoding: "utf-8",
|
|
644
|
+
timeout: 3000,
|
|
645
|
+
env: {
|
|
646
|
+
...process.env,
|
|
647
|
+
PATH: (process.env.PATH ?? "")
|
|
648
|
+
.split(":")
|
|
649
|
+
.filter((p) => p !== shimBinDir)
|
|
650
|
+
.join(":"),
|
|
651
|
+
},
|
|
652
|
+
})
|
|
653
|
+
.trim()
|
|
654
|
+
.split("\n")
|
|
655
|
+
.filter((p) => p && !p.startsWith(shimBinDir));
|
|
656
|
+
return allPaths[0] ?? null;
|
|
657
|
+
}
|
|
658
|
+
catch {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
//# sourceMappingURL=shim-installer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-installer.js","sourceRoot":"","sources":["../../src/cli/shim-installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUjC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AACzD,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AACzD,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAE3D,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,KAA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