claude-mux 0.7.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/.beads/README.md +81 -0
- package/.beads/config.yaml +62 -0
- package/.beads/interactions.jsonl +0 -0
- package/.beads/issues.jsonl +5 -0
- package/.beads/metadata.json +4 -0
- package/.eslintrc.json +25 -0
- package/.gitattributes +3 -0
- package/.prettierrc +7 -0
- package/CLAUDE.md +123 -0
- package/LICENSE +21 -0
- package/PLAN-beads-integration.md +250 -0
- package/README.md +366 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +147 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +5 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/serve.d.ts +8 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +59 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/setup.d.ts +4 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +12 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/tui.d.ts +9 -0
- package/dist/commands/tui.d.ts.map +1 -0
- package/dist/commands/tui.js +234 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/commands/uninstall.d.ts +4 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +12 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/components/Header.d.ts +7 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +14 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/HelpDialog.d.ts +6 -0
- package/dist/components/HelpDialog.d.ts.map +1 -0
- package/dist/components/HelpDialog.js +14 -0
- package/dist/components/HelpDialog.js.map +1 -0
- package/dist/components/SessionEntry.d.ts +17 -0
- package/dist/components/SessionEntry.d.ts.map +1 -0
- package/dist/components/SessionEntry.js +102 -0
- package/dist/components/SessionEntry.js.map +1 -0
- package/dist/components/SessionList.d.ts +14 -0
- package/dist/components/SessionList.d.ts.map +1 -0
- package/dist/components/SessionList.js +57 -0
- package/dist/components/SessionList.js.map +1 -0
- package/dist/components/StatusBar.d.ts +6 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/StatusBar.js +7 -0
- package/dist/components/StatusBar.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +3 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +4 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +23 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sessions-json.d.ts +85 -0
- package/dist/db/sessions-json.d.ts.map +1 -0
- package/dist/db/sessions-json.js +242 -0
- package/dist/db/sessions-json.js.map +1 -0
- package/dist/db/sessions.d.ts +38 -0
- package/dist/db/sessions.d.ts.map +1 -0
- package/dist/db/sessions.js +87 -0
- package/dist/db/sessions.js.map +1 -0
- package/dist/hooks/claude-mux-hook.d.ts +15 -0
- package/dist/hooks/claude-mux-hook.d.ts.map +1 -0
- package/dist/hooks/claude-mux-hook.js +396 -0
- package/dist/hooks/claude-mux-hook.js.map +1 -0
- package/dist/hooks/claude-watch-hook.d.ts +15 -0
- package/dist/hooks/claude-watch-hook.d.ts.map +1 -0
- package/dist/hooks/claude-watch-hook.js +396 -0
- package/dist/hooks/claude-watch-hook.js.map +1 -0
- package/dist/server/custom-server.d.ts +13 -0
- package/dist/server/custom-server.d.ts.map +1 -0
- package/dist/server/custom-server.js +63 -0
- package/dist/server/custom-server.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +1143 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/cors.d.ts +2 -0
- package/dist/server/middleware/cors.d.ts.map +1 -0
- package/dist/server/middleware/cors.js +11 -0
- package/dist/server/middleware/cors.js.map +1 -0
- package/dist/server/routes/sessions.d.ts +3 -0
- package/dist/server/routes/sessions.d.ts.map +1 -0
- package/dist/server/routes/sessions.js +78 -0
- package/dist/server/routes/sessions.js.map +1 -0
- package/dist/server/routes/stream.d.ts +3 -0
- package/dist/server/routes/stream.d.ts.map +1 -0
- package/dist/server/routes/stream.js +45 -0
- package/dist/server/routes/stream.js.map +1 -0
- package/dist/server/types.d.ts +28 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/watcher.d.ts +22 -0
- package/dist/server/watcher.d.ts.map +1 -0
- package/dist/server/watcher.js +119 -0
- package/dist/server/watcher.js.map +1 -0
- package/dist/server/websocket.d.ts +51 -0
- package/dist/server/websocket.d.ts.map +1 -0
- package/dist/server/websocket.js +156 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server/ws-handlers.d.ts +174 -0
- package/dist/server/ws-handlers.d.ts.map +1 -0
- package/dist/server/ws-handlers.js +695 -0
- package/dist/server/ws-handlers.js.map +1 -0
- package/dist/setup/hooks.d.ts +44 -0
- package/dist/setup/hooks.d.ts.map +1 -0
- package/dist/setup/hooks.js +267 -0
- package/dist/setup/hooks.js.map +1 -0
- package/dist/setup/index.d.ts +3 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +3 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/wizard.d.ts +4 -0
- package/dist/setup/wizard.d.ts.map +1 -0
- package/dist/setup/wizard.js +72 -0
- package/dist/setup/wizard.js.map +1 -0
- package/dist/tmux/detect.d.ts +25 -0
- package/dist/tmux/detect.d.ts.map +1 -0
- package/dist/tmux/detect.js +71 -0
- package/dist/tmux/detect.js.map +1 -0
- package/dist/tmux/navigate.d.ts +13 -0
- package/dist/tmux/navigate.d.ts.map +1 -0
- package/dist/tmux/navigate.js +41 -0
- package/dist/tmux/navigate.js.map +1 -0
- package/dist/tmux/pane.d.ts +57 -0
- package/dist/tmux/pane.d.ts.map +1 -0
- package/dist/tmux/pane.js +156 -0
- package/dist/tmux/pane.js.map +1 -0
- package/dist/tmux/resize.d.ts +10 -0
- package/dist/tmux/resize.d.ts.map +1 -0
- package/dist/tmux/resize.js +25 -0
- package/dist/tmux/resize.js.map +1 -0
- package/dist/utils/paths.d.ts +7 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +9 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/pid.d.ts +5 -0
- package/dist/utils/pid.d.ts.map +1 -0
- package/dist/utils/pid.js +14 -0
- package/dist/utils/pid.js.map +1 -0
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +6 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/web/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
- package/dist/web/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
- package/dist/web/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
- package/dist/web/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
- package/dist/web/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
- package/dist/web/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
- package/dist/web/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
- package/dist/web/client/_app/immutable/chunks/C9P-coqM.js +1 -0
- package/dist/web/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
- package/dist/web/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
- package/dist/web/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
- package/dist/web/client/_app/immutable/chunks/HKNo9LID.js +5 -0
- package/dist/web/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
- package/dist/web/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
- package/dist/web/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
- package/dist/web/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
- package/dist/web/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
- package/dist/web/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
- package/dist/web/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
- package/dist/web/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
- package/dist/web/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
- package/dist/web/client/_app/version.json +1 -0
- package/dist/web/client/robots.txt +3 -0
- package/dist/web/env.js +32 -0
- package/dist/web/handler.js +744 -0
- package/dist/web/index.js +49 -0
- package/dist/web/server/chunks/0-BHWsmCJv.js +23 -0
- package/dist/web/server/chunks/0-BHWsmCJv.js.map +1 -0
- package/dist/web/server/chunks/1-YRx6A8Tm.js +17 -0
- package/dist/web/server/chunks/1-YRx6A8Tm.js.map +1 -0
- package/dist/web/server/chunks/2-eC6JuGAo.js +22 -0
- package/dist/web/server/chunks/2-eC6JuGAo.js.map +1 -0
- package/dist/web/server/chunks/3-Bk-wV20p.js +32 -0
- package/dist/web/server/chunks/3-Bk-wV20p.js.map +1 -0
- package/dist/web/server/chunks/4-nteBgDrW.js +21 -0
- package/dist/web/server/chunks/4-nteBgDrW.js.map +1 -0
- package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js +35 -0
- package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js.map +1 -0
- package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js +453 -0
- package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-Be6iabRn.js +34 -0
- package/dist/web/server/chunks/_page.svelte-Be6iabRn.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js +576 -0
- package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js.map +1 -0
- package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js +2722 -0
- package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-3WAmKvn2.js +34 -0
- package/dist/web/server/chunks/_server.ts-3WAmKvn2.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BAWJCSFb.js +29 -0
- package/dist/web/server/chunks/_server.ts-BAWJCSFb.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BPpMOZCm.js +24 -0
- package/dist/web/server/chunks/_server.ts-BPpMOZCm.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BUKgRb6U.js +13 -0
- package/dist/web/server/chunks/_server.ts-BUKgRb6U.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BVHUS8fm.js +41 -0
- package/dist/web/server/chunks/_server.ts-BVHUS8fm.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-BrF3od0O.js +45 -0
- package/dist/web/server/chunks/_server.ts-BrF3od0O.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-C4oPmOJR.js +38 -0
- package/dist/web/server/chunks/_server.ts-C4oPmOJR.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CDAUUmG_.js +21 -0
- package/dist/web/server/chunks/_server.ts-CDAUUmG_.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CR0uWvpz.js +24 -0
- package/dist/web/server/chunks/_server.ts-CR0uWvpz.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-CSqdCNGi.js +21 -0
- package/dist/web/server/chunks/_server.ts-CSqdCNGi.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DI9fzUo9.js +52 -0
- package/dist/web/server/chunks/_server.ts-DI9fzUo9.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DNjJTClI.js +46 -0
- package/dist/web/server/chunks/_server.ts-DNjJTClI.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-DdbOAkOj.js +22 -0
- package/dist/web/server/chunks/_server.ts-DdbOAkOj.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-Df2isGQc.js +41 -0
- package/dist/web/server/chunks/_server.ts-Df2isGQc.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-Vpw25_-3.js +12 -0
- package/dist/web/server/chunks/_server.ts-Vpw25_-3.js.map +1 -0
- package/dist/web/server/chunks/_server.ts-WldRpSRi.js +26 -0
- package/dist/web/server/chunks/_server.ts-WldRpSRi.js.map +1 -0
- package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js +2890 -0
- package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js.map +1 -0
- package/dist/web/server/chunks/auth-DrUf-v4J.js +51 -0
- package/dist/web/server/chunks/auth-DrUf-v4J.js.map +1 -0
- package/dist/web/server/chunks/button-D6xS9rHt.js +2335 -0
- package/dist/web/server/chunks/button-D6xS9rHt.js.map +1 -0
- package/dist/web/server/chunks/chunk-EKzHsMy_.js +42 -0
- package/dist/web/server/chunks/chunks-DmdqVYC7.js +58 -0
- package/dist/web/server/chunks/chunks-DmdqVYC7.js.map +1 -0
- package/dist/web/server/chunks/client-CUrSQijh.js +18 -0
- package/dist/web/server/chunks/client-CUrSQijh.js.map +1 -0
- package/dist/web/server/chunks/clsx-FzI4_gi0.js +332 -0
- package/dist/web/server/chunks/clsx-FzI4_gi0.js.map +1 -0
- package/dist/web/server/chunks/error.svelte-D-c-9pTE.js +27 -0
- package/dist/web/server/chunks/error.svelte-D-c-9pTE.js.map +1 -0
- package/dist/web/server/chunks/events-BDBlYddw.js +89 -0
- package/dist/web/server/chunks/events-BDBlYddw.js.map +1 -0
- package/dist/web/server/chunks/exports-CCurQ-Tl.js +131 -0
- package/dist/web/server/chunks/exports-CCurQ-Tl.js.map +1 -0
- package/dist/web/server/chunks/hooks.server-BK1bopsh.js +86 -0
- package/dist/web/server/chunks/hooks.server-BK1bopsh.js.map +1 -0
- package/dist/web/server/chunks/index2-BQnysSj-.js +2588 -0
- package/dist/web/server/chunks/index2-BQnysSj-.js.map +1 -0
- package/dist/web/server/chunks/internal-DLENj6YI.js +61 -0
- package/dist/web/server/chunks/internal-DLENj6YI.js.map +1 -0
- package/dist/web/server/chunks/pane-Dg3pKvsm.js +94 -0
- package/dist/web/server/chunks/pane-Dg3pKvsm.js.map +1 -0
- package/dist/web/server/chunks/sessions-json-DgfkCLO7.js +107 -0
- package/dist/web/server/chunks/sessions-json-DgfkCLO7.js.map +1 -0
- package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js +178 -0
- package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js.map +1 -0
- package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js +7 -0
- package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js.map +1 -0
- package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js +733 -0
- package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js.map +1 -0
- package/dist/web/server/index.js +4907 -0
- package/dist/web/server/index.js.map +1 -0
- package/dist/web/server/manifest.js +233 -0
- package/dist/web/server/manifest.js.map +1 -0
- package/docs/images/desktop-dashboard.png +0 -0
- package/docs/images/desktop-session.png +0 -0
- package/docs/images/mobile-dashboard.png +0 -0
- package/docs/images/mobile-session.png +0 -0
- package/docs/release-checklist.md +228 -0
- package/docs/removing-hooks.md +135 -0
- package/docs/state-transitions.md +109 -0
- package/package.json +71 -0
- package/src/app.tsx +188 -0
- package/src/cli.ts +83 -0
- package/src/commands/index.ts +4 -0
- package/src/commands/serve.ts +75 -0
- package/src/commands/setup.ts +13 -0
- package/src/commands/tui.ts +255 -0
- package/src/commands/uninstall.ts +13 -0
- package/src/components/Header.tsx +32 -0
- package/src/components/HelpDialog.tsx +45 -0
- package/src/components/SessionEntry.tsx +202 -0
- package/src/components/SessionList.tsx +98 -0
- package/src/components/StatusBar.tsx +26 -0
- package/src/components/index.ts +5 -0
- package/src/db/index.ts +20 -0
- package/src/db/sessions-json.ts +314 -0
- package/src/hooks/claude-mux-hook.ts +498 -0
- package/src/server/watcher.ts +128 -0
- package/src/server/ws-handlers.ts +922 -0
- package/src/setup/hooks.ts +333 -0
- package/src/setup/index.ts +2 -0
- package/src/setup/wizard.ts +81 -0
- package/src/tmux/detect.ts +87 -0
- package/src/tmux/navigate.ts +42 -0
- package/src/tmux/pane.ts +167 -0
- package/src/tmux/resize.ts +28 -0
- package/src/utils/paths.ts +11 -0
- package/src/utils/pid.ts +12 -0
- package/src/utils/version.ts +5 -0
- package/tests/components/Header.test.tsx +42 -0
- package/tests/components/SessionEntry-extended.test.tsx +165 -0
- package/tests/components/SessionEntry.test.tsx +138 -0
- package/tests/components/SessionList.test.tsx +110 -0
- package/tests/components/StatusBar.test.tsx +31 -0
- package/tests/db/index.test.ts +78 -0
- package/tests/db/sessions.test.ts +230 -0
- package/tests/server/integration.test.ts +319 -0
- package/tests/server/sessions.test.ts +114 -0
- package/tests/setup/hooks-integration.test.ts +148 -0
- package/tests/setup/hooks.test.ts +123 -0
- package/tests/tmux/detect.test.ts +54 -0
- package/tests/tmux/navigate.test.ts +30 -0
- package/tests/utils/pid.test.ts +17 -0
- package/tsconfig.cli.json +9 -0
- package/tsconfig.json +22 -0
- package/vitest.config.ts +29 -0
- package/web/.svelte-kit/adapter-bun/.vite/manifest.json +408 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DldLgTc-.css +1 -0
- package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/adapter-bun/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
- package/web/.svelte-kit/adapter-bun/chunks/alert-dialog-description.js +2670 -0
- package/web/.svelte-kit/adapter-bun/chunks/auth.js +59 -0
- package/web/.svelte-kit/adapter-bun/chunks/button.js +82 -0
- package/web/.svelte-kit/adapter-bun/chunks/client.js +29 -0
- package/web/.svelte-kit/adapter-bun/chunks/context.js +133 -0
- package/web/.svelte-kit/adapter-bun/chunks/environment.js +34 -0
- package/web/.svelte-kit/adapter-bun/chunks/events.js +121 -0
- package/web/.svelte-kit/adapter-bun/chunks/exports.js +174 -0
- package/web/.svelte-kit/adapter-bun/chunks/false.js +4 -0
- package/web/.svelte-kit/adapter-bun/chunks/index.js +59 -0
- package/web/.svelte-kit/adapter-bun/chunks/index2.js +2828 -0
- package/web/.svelte-kit/adapter-bun/chunks/internal.js +920 -0
- package/web/.svelte-kit/adapter-bun/chunks/pane.js +82 -0
- package/web/.svelte-kit/adapter-bun/chunks/sessions-json.js +124 -0
- package/web/.svelte-kit/adapter-bun/chunks/sessions.svelte.js +229 -0
- package/web/.svelte-kit/adapter-bun/chunks/shared.js +542 -0
- package/web/.svelte-kit/adapter-bun/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/adapter-bun/chunks/utils.js +43 -0
- package/web/.svelte-kit/adapter-bun/chunks/ws-handlers.js +782 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/login/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/beads/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/chrome/_server.ts.js +30 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/files/image/_server.ts.js +53 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_server.ts.js +49 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/adapter-bun/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
- package/web/.svelte-kit/adapter-bun/entries/fallbacks/error.svelte.js +27 -0
- package/web/.svelte-kit/adapter-bun/entries/hooks.server.js +105 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/_layout.svelte.js +499 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/_page.svelte.js +3057 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.server.ts.js +15 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.svelte.js +37 -0
- package/web/.svelte-kit/adapter-bun/entries/pages/session/_target_/_page.svelte.js +653 -0
- package/web/.svelte-kit/adapter-bun/index.js +3864 -0
- package/web/.svelte-kit/adapter-bun/internal.js +13 -0
- package/web/.svelte-kit/adapter-bun/manifest-full.js +167 -0
- package/web/.svelte-kit/adapter-bun/manifest.js +171 -0
- package/web/.svelte-kit/adapter-bun/nodes/0.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/1.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/2.js +8 -0
- package/web/.svelte-kit/adapter-bun/nodes/3.js +10 -0
- package/web/.svelte-kit/adapter-bun/nodes/4.js +8 -0
- package/web/.svelte-kit/adapter-bun/remote-entry.js +541 -0
- package/web/.svelte-kit/adapter-node/.vite/manifest.json +223 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.4NiX29PU.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.BEMzYUGV.css +1 -0
- package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOJn7TG7.css +1 -0
- package/web/.svelte-kit/adapter-node/chunks/context.js +121 -0
- package/web/.svelte-kit/adapter-node/chunks/environment.js +34 -0
- package/web/.svelte-kit/adapter-node/chunks/exports.js +174 -0
- package/web/.svelte-kit/adapter-node/chunks/false.js +4 -0
- package/web/.svelte-kit/adapter-node/chunks/index.js +59 -0
- package/web/.svelte-kit/adapter-node/chunks/index2.js +2710 -0
- package/web/.svelte-kit/adapter-node/chunks/internal.js +1005 -0
- package/web/.svelte-kit/adapter-node/chunks/sessions-json.js +109 -0
- package/web/.svelte-kit/adapter-node/chunks/sessions.svelte.js +67 -0
- package/web/.svelte-kit/adapter-node/chunks/shared.js +542 -0
- package/web/.svelte-kit/adapter-node/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/adapter-node/chunks/utils.js +43 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +30 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/send/_server.ts.js +22 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_server.ts.js +126 -0
- package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +44 -0
- package/web/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +12 -0
- package/web/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +87 -0
- package/web/.svelte-kit/adapter-node/entries/pages/session/_target_/_page.svelte.js +76 -0
- package/web/.svelte-kit/adapter-node/index.js +3864 -0
- package/web/.svelte-kit/adapter-node/internal.js +13 -0
- package/web/.svelte-kit/adapter-node/manifest-full.js +103 -0
- package/web/.svelte-kit/adapter-node/manifest.js +107 -0
- package/web/.svelte-kit/adapter-node/nodes/0.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/1.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/2.js +8 -0
- package/web/.svelte-kit/adapter-node/nodes/3.js +8 -0
- package/web/.svelte-kit/adapter-node/remote-entry.js +541 -0
- package/web/.svelte-kit/ambient.d.ts +187 -0
- package/web/.svelte-kit/generated/client/app.js +33 -0
- package/web/.svelte-kit/generated/client/matchers.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/0.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/4.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/app.js +33 -0
- package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/0.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/4.js +1 -0
- package/web/.svelte-kit/generated/root.js +3 -0
- package/web/.svelte-kit/generated/root.svelte +68 -0
- package/web/.svelte-kit/generated/server/internal.js +53 -0
- package/web/.svelte-kit/non-ambient.d.ts +73 -0
- package/web/.svelte-kit/output/client/.vite/manifest.json +203 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/C9P-coqM.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/HKNo9LID.js +5 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
- package/web/.svelte-kit/output/client/_app/version.json +1 -0
- package/web/.svelte-kit/output/client/robots.txt +3 -0
- package/web/.svelte-kit/output/server/.vite/manifest.json +408 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DldLgTc-.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
- package/web/.svelte-kit/output/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
- package/web/.svelte-kit/output/server/chunks/alert-dialog-description.js +2670 -0
- package/web/.svelte-kit/output/server/chunks/auth.js +59 -0
- package/web/.svelte-kit/output/server/chunks/button.js +82 -0
- package/web/.svelte-kit/output/server/chunks/client.js +29 -0
- package/web/.svelte-kit/output/server/chunks/context.js +133 -0
- package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
- package/web/.svelte-kit/output/server/chunks/events.js +121 -0
- package/web/.svelte-kit/output/server/chunks/exports.js +174 -0
- package/web/.svelte-kit/output/server/chunks/false.js +4 -0
- package/web/.svelte-kit/output/server/chunks/index.js +59 -0
- package/web/.svelte-kit/output/server/chunks/index2.js +2828 -0
- package/web/.svelte-kit/output/server/chunks/internal.js +920 -0
- package/web/.svelte-kit/output/server/chunks/pane.js +82 -0
- package/web/.svelte-kit/output/server/chunks/sessions-json.js +124 -0
- package/web/.svelte-kit/output/server/chunks/sessions.svelte.js +229 -0
- package/web/.svelte-kit/output/server/chunks/shared.js +542 -0
- package/web/.svelte-kit/output/server/chunks/state.svelte.js +16 -0
- package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
- package/web/.svelte-kit/output/server/chunks/ws-handlers.js +782 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/auth/login/_server.ts.js +22 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/beads/_server.ts.js +22 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/browse/_server.ts.js +50 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/chrome/_server.ts.js +30 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/files/image/_server.ts.js +53 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/health/_server.ts.js +7 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_server.ts.js +49 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
- package/web/.svelte-kit/output/server/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
- package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +27 -0
- package/web/.svelte-kit/output/server/entries/hooks.server.js +105 -0
- package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +499 -0
- package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +3057 -0
- package/web/.svelte-kit/output/server/entries/pages/login/_page.server.ts.js +15 -0
- package/web/.svelte-kit/output/server/entries/pages/login/_page.svelte.js +37 -0
- package/web/.svelte-kit/output/server/entries/pages/session/_target_/_page.svelte.js +653 -0
- package/web/.svelte-kit/output/server/index.js +3864 -0
- package/web/.svelte-kit/output/server/internal.js +13 -0
- package/web/.svelte-kit/output/server/manifest-full.js +167 -0
- package/web/.svelte-kit/output/server/manifest.js +167 -0
- package/web/.svelte-kit/output/server/nodes/0.js +8 -0
- package/web/.svelte-kit/output/server/nodes/1.js +8 -0
- package/web/.svelte-kit/output/server/nodes/2.js +8 -0
- package/web/.svelte-kit/output/server/nodes/3.js +10 -0
- package/web/.svelte-kit/output/server/nodes/4.js +8 -0
- package/web/.svelte-kit/output/server/remote-entry.js +541 -0
- package/web/.svelte-kit/tsconfig.json +58 -0
- package/web/.svelte-kit/types/route_meta_data.json +55 -0
- package/web/.svelte-kit/types/src/routes/$types.d.ts +24 -0
- package/web/.svelte-kit/types/src/routes/api/auth/login/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/auth/logout/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/beads/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/browse/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/chrome/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/files/image/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/health/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/projects/new-session/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/kill/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/restart/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/screenshots/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[id]/send/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/sessions/[target]/output/$types.d.ts +11 -0
- package/web/.svelte-kit/types/src/routes/api/tmux/panes/$types.d.ts +10 -0
- package/web/.svelte-kit/types/src/routes/login/$types.d.ts +25 -0
- package/web/.svelte-kit/types/src/routes/login/proxy+page.server.ts +19 -0
- package/web/.svelte-kit/types/src/routes/session/[target]/$types.d.ts +19 -0
- package/web/README.md +42 -0
- package/web/components.json +16 -0
- package/web/package.json +35 -0
- package/web/src/app.css +128 -0
- package/web/src/app.d.ts +13 -0
- package/web/src/app.html +11 -0
- package/web/src/hooks.server.ts +156 -0
- package/web/src/lib/assets/favicon.svg +1 -0
- package/web/src/lib/components/AllSessionsPanel.svelte +789 -0
- package/web/src/lib/components/BeadsPanel.svelte +146 -0
- package/web/src/lib/components/IssueItem.svelte +287 -0
- package/web/src/lib/components/ScreenshotsPanel.svelte +336 -0
- package/web/src/lib/components/SessionsSidebar.svelte +312 -0
- package/web/src/lib/components/TerminalRenderer.svelte +189 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +18 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +18 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +29 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/alert-dialog.svelte +7 -0
- package/web/src/lib/components/ui/alert-dialog/index.ts +37 -0
- package/web/src/lib/components/ui/badge/badge.svelte +50 -0
- package/web/src/lib/components/ui/badge/index.ts +2 -0
- package/web/src/lib/components/ui/button/button.svelte +86 -0
- package/web/src/lib/components/ui/button/index.ts +17 -0
- package/web/src/lib/components/ui/checkbox/checkbox.svelte +36 -0
- package/web/src/lib/components/ui/checkbox/index.ts +6 -0
- package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
- package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
- package/web/src/lib/components/ui/dialog/index.ts +34 -0
- package/web/src/lib/components/ui/scroll-area/index.ts +10 -0
- package/web/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
- package/web/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
- package/web/src/lib/components/ui/textarea/index.ts +7 -0
- package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
- package/web/src/lib/index.ts +1 -0
- package/web/src/lib/server/auth.ts +90 -0
- package/web/src/lib/stores/beads.svelte.ts +163 -0
- package/web/src/lib/stores/input-injection.svelte.ts +39 -0
- package/web/src/lib/stores/preferences.svelte.ts +55 -0
- package/web/src/lib/stores/sessions.svelte.ts +108 -0
- package/web/src/lib/stores/terminal.svelte.ts +96 -0
- package/web/src/lib/stores/websocket-base.svelte.ts +209 -0
- package/web/src/lib/types/terminal.ts +31 -0
- package/web/src/lib/utils/terminal-parser.ts +239 -0
- package/web/src/lib/utils.ts +13 -0
- package/web/src/routes/+layout.svelte +450 -0
- package/web/src/routes/+page.svelte +19 -0
- package/web/src/routes/api/auth/login/+server.ts +34 -0
- package/web/src/routes/api/auth/logout/+server.ts +10 -0
- package/web/src/routes/api/beads/+server.ts +28 -0
- package/web/src/routes/api/browse/+server.ts +59 -0
- package/web/src/routes/api/chrome/+server.ts +35 -0
- package/web/src/routes/api/files/image/+server.ts +64 -0
- package/web/src/routes/api/health/+server.ts +6 -0
- package/web/src/routes/api/projects/new-session/+server.ts +50 -0
- package/web/src/routes/api/sessions/+server.ts +62 -0
- package/web/src/routes/api/sessions/[id]/+server.ts +19 -0
- package/web/src/routes/api/sessions/[id]/kill/+server.ts +46 -0
- package/web/src/routes/api/sessions/[id]/restart/+server.ts +59 -0
- package/web/src/routes/api/sessions/[id]/screenshots/+server.ts +32 -0
- package/web/src/routes/api/sessions/[id]/send/+server.ts +31 -0
- package/web/src/routes/api/sessions/[target]/output/+server.ts +13 -0
- package/web/src/routes/api/tmux/panes/+server.ts +32 -0
- package/web/src/routes/login/+page.server.ts +18 -0
- package/web/src/routes/login/+page.svelte +69 -0
- package/web/src/routes/session/[target]/+page.svelte +450 -0
- package/web/static/robots.txt +3 -0
- package/web/svelte.config.js +20 -0
- package/web/tsconfig.json +20 -0
- package/web/vite.config.ts +154 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { page } from '$app/stores';
|
|
3
|
+
import { goto } from '$app/navigation';
|
|
4
|
+
import { browser } from '$app/environment';
|
|
5
|
+
import { onDestroy } from 'svelte';
|
|
6
|
+
import { terminalStore } from '$lib/stores/terminal.svelte';
|
|
7
|
+
import { sessionStore, stateColor } from '$lib/stores/sessions.svelte';
|
|
8
|
+
import { preferences } from '$lib/stores/preferences.svelte';
|
|
9
|
+
import { inputInjection } from '$lib/stores/input-injection.svelte';
|
|
10
|
+
import { Button } from '$lib/components/ui/button';
|
|
11
|
+
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
|
12
|
+
import TerminalRenderer from '$lib/components/TerminalRenderer.svelte';
|
|
13
|
+
|
|
14
|
+
const target = $derived($page.params.target ? decodeURIComponent($page.params.target) : null);
|
|
15
|
+
|
|
16
|
+
// Find session state from session store
|
|
17
|
+
const currentSession = $derived(
|
|
18
|
+
sessionStore.sessions.find((s) => s.tmux_target === target || s.id === target)
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
let textInput = $state('');
|
|
22
|
+
let showConfirmKill = $state(false);
|
|
23
|
+
let outputElement: HTMLDivElement | null = $state(null);
|
|
24
|
+
let textareaElement: HTMLTextAreaElement | null = $state(null);
|
|
25
|
+
let userScrolledUp = $state(false);
|
|
26
|
+
let showCopied = $state(false);
|
|
27
|
+
let measureCanvas: HTMLCanvasElement | null = null;
|
|
28
|
+
|
|
29
|
+
// Measure monospace character dimensions using canvas
|
|
30
|
+
function measureFont(): { width: number; height: number } {
|
|
31
|
+
if (!browser) return { width: 7.8, height: 18.2 };
|
|
32
|
+
|
|
33
|
+
if (!measureCanvas) measureCanvas = document.createElement('canvas');
|
|
34
|
+
const ctx = measureCanvas.getContext('2d');
|
|
35
|
+
if (!ctx) return { width: 7.8, height: 18.2 };
|
|
36
|
+
|
|
37
|
+
// Match CSS: font-family from .output, font-size: 13px, line-height: 1.4
|
|
38
|
+
ctx.font = "13px 'SF Mono', Monaco, 'Cascadia Code', monospace";
|
|
39
|
+
const width = ctx.measureText('M').width;
|
|
40
|
+
const height = 13 * 1.4; // 18.2px
|
|
41
|
+
|
|
42
|
+
return { width, height };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Calculate terminal dimensions from output element
|
|
46
|
+
function calculateTerminalSize(): { cols: number; rows: number } | null {
|
|
47
|
+
if (!outputElement) return null;
|
|
48
|
+
|
|
49
|
+
// Padding is 16px on each side (from CSS .output)
|
|
50
|
+
const padding = 32;
|
|
51
|
+
const innerWidth = outputElement.clientWidth - padding;
|
|
52
|
+
const innerHeight = outputElement.clientHeight - padding;
|
|
53
|
+
|
|
54
|
+
if (innerWidth <= 0 || innerHeight <= 0) return null;
|
|
55
|
+
|
|
56
|
+
const { width: charW, height: charH } = measureFont();
|
|
57
|
+
// Subtract 1 col for safety margin (font rendering varies across devices)
|
|
58
|
+
const cols = Math.floor(innerWidth / charW) - 1;
|
|
59
|
+
const rows = Math.floor(innerHeight / charH);
|
|
60
|
+
|
|
61
|
+
if (cols < 10 || rows < 3) return null;
|
|
62
|
+
return { cols, rows };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Send resize to server
|
|
66
|
+
function handleResize() {
|
|
67
|
+
const size = calculateTerminalSize();
|
|
68
|
+
if (size) terminalStore.sendResize(size.cols, size.rows);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Connect to terminal when target changes (including initial mount)
|
|
72
|
+
$effect(() => {
|
|
73
|
+
terminalStore.connect(target);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Watch for issue IDs to inject into input
|
|
77
|
+
$effect(() => {
|
|
78
|
+
const issueId = inputInjection.pendingIssueId;
|
|
79
|
+
if (issueId) {
|
|
80
|
+
// Append issue ID to input (with space if there's existing text)
|
|
81
|
+
textInput = textInput ? textInput + ' ' + issueId : issueId;
|
|
82
|
+
inputInjection.clear();
|
|
83
|
+
// Focus textarea and trigger resize
|
|
84
|
+
if (textareaElement) {
|
|
85
|
+
textareaElement.focus();
|
|
86
|
+
// Use timeout to ensure state is updated before resize
|
|
87
|
+
setTimeout(autoResize, 0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
onDestroy(() => {
|
|
93
|
+
terminalStore.disconnect();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Track if user has scrolled up from bottom
|
|
97
|
+
function handleScroll() {
|
|
98
|
+
if (!outputElement) return;
|
|
99
|
+
const { scrollTop, scrollHeight, clientHeight } = outputElement;
|
|
100
|
+
// Consider "at bottom" if within 50px of the bottom
|
|
101
|
+
userScrolledUp = scrollHeight - scrollTop - clientHeight > 50;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Auto-scroll to bottom only if user hasn't scrolled up
|
|
105
|
+
$effect(() => {
|
|
106
|
+
if (outputElement && terminalStore.output && !userScrolledUp) {
|
|
107
|
+
outputElement.scrollTop = outputElement.scrollHeight;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
async function sendKeys(keys: string) {
|
|
112
|
+
await fetch(`/api/sessions/${encodeURIComponent(target)}/send`, {
|
|
113
|
+
method: 'POST',
|
|
114
|
+
headers: { 'Content-Type': 'application/json' },
|
|
115
|
+
body: JSON.stringify({ keys })
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function sendText() {
|
|
120
|
+
if (!textInput.trim()) {
|
|
121
|
+
// Empty input: just send Enter key
|
|
122
|
+
await sendKeys('Enter');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
await fetch(`/api/sessions/${encodeURIComponent(target)}/send`, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: { 'Content-Type': 'application/json' },
|
|
128
|
+
body: JSON.stringify({ text: textInput })
|
|
129
|
+
});
|
|
130
|
+
textInput = '';
|
|
131
|
+
// Reset textarea height after sending
|
|
132
|
+
if (textareaElement) {
|
|
133
|
+
textareaElement.style.height = 'auto';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
138
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
sendText();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function autoResize() {
|
|
145
|
+
if (!textareaElement) return;
|
|
146
|
+
// Reset to single row to measure actual content height
|
|
147
|
+
textareaElement.style.height = '0';
|
|
148
|
+
const newHeight = Math.max(48, Math.min(textareaElement.scrollHeight, 150));
|
|
149
|
+
textareaElement.style.height = newHeight + 'px';
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async function killSession() {
|
|
153
|
+
if (!currentSession) return;
|
|
154
|
+
await fetch(`/api/sessions/${encodeURIComponent(currentSession.id)}/kill`, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
headers: { 'Content-Type': 'application/json' },
|
|
157
|
+
body: JSON.stringify({ pid: currentSession.pid, tmux_target: currentSession.tmux_target })
|
|
158
|
+
});
|
|
159
|
+
showConfirmKill = false;
|
|
160
|
+
goto('/');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function copyTmuxCmd() {
|
|
164
|
+
if (!target) return;
|
|
165
|
+
const cmd = `tmux attach -t "${target.split(':')[0]}"`;
|
|
166
|
+
if (navigator.clipboard?.writeText) {
|
|
167
|
+
navigator.clipboard.writeText(cmd);
|
|
168
|
+
} else {
|
|
169
|
+
// Fallback for non-secure contexts (HTTP)
|
|
170
|
+
const textarea = document.createElement('textarea');
|
|
171
|
+
textarea.value = cmd;
|
|
172
|
+
textarea.style.position = 'fixed';
|
|
173
|
+
textarea.style.opacity = '0';
|
|
174
|
+
document.body.appendChild(textarea);
|
|
175
|
+
textarea.select();
|
|
176
|
+
document.execCommand('copy');
|
|
177
|
+
document.body.removeChild(textarea);
|
|
178
|
+
}
|
|
179
|
+
showCopied = true;
|
|
180
|
+
setTimeout(() => { showCopied = false; }, 2000);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<svelte:head>
|
|
186
|
+
<title>{currentSession?.pane_title || target || 'Session'}</title>
|
|
187
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
|
188
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
189
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
|
|
190
|
+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
191
|
+
</svelte:head>
|
|
192
|
+
|
|
193
|
+
<div class="session-container">
|
|
194
|
+
<header class="header">
|
|
195
|
+
<div class="title-row">
|
|
196
|
+
<span class="state" style="background: {stateColor(currentSession?.state || 'idle')}"></span>
|
|
197
|
+
<div class="title-info">
|
|
198
|
+
<span class="target">{currentSession?.pane_title || target}</span>
|
|
199
|
+
<span class="status">{currentSession?.current_action || currentSession?.state || 'idle'}</span>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="header-actions">
|
|
203
|
+
<Button variant="secondary" size="toolbar" onclick={copyTmuxCmd} title="Copy tmux attach command" class={showCopied ? 'bg-green-800 text-green-300' : ''}>
|
|
204
|
+
<iconify-icon icon={showCopied ? "mdi:check" : "mdi:content-copy"}></iconify-icon>
|
|
205
|
+
<span>{showCopied ? 'Copied!' : 'Tmux'}</span>
|
|
206
|
+
</Button>
|
|
207
|
+
<Button variant="secondary" size="toolbar" onclick={handleResize} title="Resize tmux pane to fit viewport">
|
|
208
|
+
<iconify-icon icon="mdi:fit-to-screen"></iconify-icon>
|
|
209
|
+
<span>Fit</span>
|
|
210
|
+
</Button>
|
|
211
|
+
<Button
|
|
212
|
+
variant={preferences.terminalTheming ? "secondary" : "ghost"}
|
|
213
|
+
size="toolbar"
|
|
214
|
+
onclick={() => preferences.toggle('terminalTheming')}
|
|
215
|
+
title="Toggle syntax highlighting"
|
|
216
|
+
>
|
|
217
|
+
<iconify-icon icon={preferences.terminalTheming ? "mdi:palette" : "mdi:palette-outline"}></iconify-icon>
|
|
218
|
+
<span>Theme</span>
|
|
219
|
+
</Button>
|
|
220
|
+
<Button variant="ghost-destructive" size="toolbar" onclick={() => (showConfirmKill = true)} title="Kill Session">
|
|
221
|
+
<iconify-icon icon="mdi:power"></iconify-icon>
|
|
222
|
+
<span>Kill</span>
|
|
223
|
+
</Button>
|
|
224
|
+
</div>
|
|
225
|
+
</header>
|
|
226
|
+
|
|
227
|
+
<div class="output" bind:this={outputElement} onscroll={handleScroll}>
|
|
228
|
+
{#if preferences.terminalTheming}
|
|
229
|
+
<TerminalRenderer blocks={terminalStore.parsedBlocks} />
|
|
230
|
+
{:else}
|
|
231
|
+
<pre class="raw-output">{terminalStore.output}</pre>
|
|
232
|
+
{/if}
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div class="toolbar">
|
|
236
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('Up')}>
|
|
237
|
+
<iconify-icon icon="mdi:arrow-up"></iconify-icon>
|
|
238
|
+
<span>Up</span>
|
|
239
|
+
</Button>
|
|
240
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('Down')}>
|
|
241
|
+
<iconify-icon icon="mdi:arrow-down"></iconify-icon>
|
|
242
|
+
<span>Down</span>
|
|
243
|
+
</Button>
|
|
244
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('Space')}>
|
|
245
|
+
<iconify-icon icon="mdi:keyboard-space"></iconify-icon>
|
|
246
|
+
<span>Space</span>
|
|
247
|
+
</Button>
|
|
248
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('Tab')}>
|
|
249
|
+
<iconify-icon icon="mdi:keyboard-tab"></iconify-icon>
|
|
250
|
+
<span>Tab</span>
|
|
251
|
+
</Button>
|
|
252
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('C-l')}>
|
|
253
|
+
<iconify-icon icon="mdi:eraser"></iconify-icon>
|
|
254
|
+
<span>Ctrl-L</span>
|
|
255
|
+
</Button>
|
|
256
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={async () => {
|
|
257
|
+
await fetch(`/api/sessions/${encodeURIComponent(target)}/send`, {
|
|
258
|
+
method: 'POST',
|
|
259
|
+
headers: { 'Content-Type': 'application/json' },
|
|
260
|
+
body: JSON.stringify({ text: '/clear' })
|
|
261
|
+
});
|
|
262
|
+
}}>
|
|
263
|
+
<iconify-icon icon="mdi:broom"></iconify-icon>
|
|
264
|
+
<span>/clear</span>
|
|
265
|
+
</Button>
|
|
266
|
+
<Button variant="secondary" size="toolbar" class="flex-1" onclick={() => sendKeys('Escape')}>
|
|
267
|
+
<iconify-icon icon="mdi:stop"></iconify-icon>
|
|
268
|
+
<span>Esc</span>
|
|
269
|
+
</Button>
|
|
270
|
+
<Button variant="ghost-destructive" size="toolbar" class="flex-1" onclick={() => sendKeys('C-c')}>
|
|
271
|
+
<iconify-icon icon="mdi:cancel"></iconify-icon>
|
|
272
|
+
<span>Ctrl-C</span>
|
|
273
|
+
</Button>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<form class="input-row" onsubmit={(e) => { e.preventDefault(); sendText(); }}>
|
|
277
|
+
<textarea
|
|
278
|
+
bind:this={textareaElement}
|
|
279
|
+
bind:value={textInput}
|
|
280
|
+
placeholder="Type a message..."
|
|
281
|
+
rows={1}
|
|
282
|
+
onkeydown={handleKeydown}
|
|
283
|
+
oninput={autoResize}
|
|
284
|
+
></textarea>
|
|
285
|
+
<Button type="submit" variant="success" class="min-w-[52px] min-h-[48px] text-lg">
|
|
286
|
+
<iconify-icon icon="mdi:send"></iconify-icon>
|
|
287
|
+
</Button>
|
|
288
|
+
</form>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<AlertDialog.Root bind:open={showConfirmKill}>
|
|
292
|
+
<AlertDialog.Content>
|
|
293
|
+
<AlertDialog.Header>
|
|
294
|
+
<AlertDialog.Title>Kill this session?</AlertDialog.Title>
|
|
295
|
+
<AlertDialog.Description>This will terminate the Claude process.</AlertDialog.Description>
|
|
296
|
+
</AlertDialog.Header>
|
|
297
|
+
<AlertDialog.Footer>
|
|
298
|
+
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
|
|
299
|
+
<AlertDialog.Action onclick={killSession} class="bg-destructive text-destructive-foreground hover:bg-destructive/90">Kill</AlertDialog.Action>
|
|
300
|
+
</AlertDialog.Footer>
|
|
301
|
+
</AlertDialog.Content>
|
|
302
|
+
</AlertDialog.Root>
|
|
303
|
+
|
|
304
|
+
<style>
|
|
305
|
+
.session-container {
|
|
306
|
+
height: 100%;
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
background: #000;
|
|
310
|
+
overflow: hidden;
|
|
311
|
+
overscroll-behavior: none;
|
|
312
|
+
touch-action: pan-y;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.header {
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
gap: 12px;
|
|
319
|
+
padding: 12px 16px;
|
|
320
|
+
background: #111;
|
|
321
|
+
border-bottom: 1px solid #222;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/* Make room for hamburger menu on mobile */
|
|
325
|
+
@media (max-width: 768px) {
|
|
326
|
+
.header {
|
|
327
|
+
padding-left: 64px;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.title-row {
|
|
332
|
+
display: flex;
|
|
333
|
+
align-items: center;
|
|
334
|
+
gap: 8px;
|
|
335
|
+
flex: 1;
|
|
336
|
+
min-width: 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.state {
|
|
340
|
+
width: 12px;
|
|
341
|
+
height: 12px;
|
|
342
|
+
border-radius: 50%;
|
|
343
|
+
flex-shrink: 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.title-info {
|
|
347
|
+
display: flex;
|
|
348
|
+
flex-direction: column;
|
|
349
|
+
min-width: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.target {
|
|
353
|
+
font-weight: 600;
|
|
354
|
+
font-size: 16px;
|
|
355
|
+
overflow: hidden;
|
|
356
|
+
text-overflow: ellipsis;
|
|
357
|
+
white-space: nowrap;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.status {
|
|
361
|
+
font-size: 13px;
|
|
362
|
+
color: #888;
|
|
363
|
+
overflow: hidden;
|
|
364
|
+
text-overflow: ellipsis;
|
|
365
|
+
white-space: nowrap;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.header-actions {
|
|
369
|
+
display: flex;
|
|
370
|
+
gap: 6px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.output {
|
|
374
|
+
flex: 1;
|
|
375
|
+
overflow-y: auto;
|
|
376
|
+
overscroll-behavior: none;
|
|
377
|
+
touch-action: pan-y;
|
|
378
|
+
padding: 16px;
|
|
379
|
+
margin: 0;
|
|
380
|
+
font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
|
|
381
|
+
font-size: 13px;
|
|
382
|
+
line-height: 1.4;
|
|
383
|
+
white-space: pre-wrap;
|
|
384
|
+
word-break: break-word;
|
|
385
|
+
background: #000;
|
|
386
|
+
color: #fff;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.raw-output {
|
|
390
|
+
margin: 0;
|
|
391
|
+
font-family: inherit;
|
|
392
|
+
font-size: inherit;
|
|
393
|
+
line-height: inherit;
|
|
394
|
+
white-space: pre-wrap;
|
|
395
|
+
word-break: break-word;
|
|
396
|
+
background: transparent;
|
|
397
|
+
color: inherit;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.toolbar {
|
|
401
|
+
display: flex;
|
|
402
|
+
gap: 6px;
|
|
403
|
+
padding: 8px 12px;
|
|
404
|
+
background: #111;
|
|
405
|
+
border-top: 1px solid #222;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.input-row {
|
|
409
|
+
display: flex;
|
|
410
|
+
align-items: flex-end;
|
|
411
|
+
gap: 8px;
|
|
412
|
+
padding: 12px 16px;
|
|
413
|
+
background: #111;
|
|
414
|
+
border-top: 1px solid #222;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.input-row textarea {
|
|
418
|
+
flex: 1;
|
|
419
|
+
min-width: 0;
|
|
420
|
+
height: 48px;
|
|
421
|
+
background: #222;
|
|
422
|
+
color: #fff;
|
|
423
|
+
border: 1px solid #333;
|
|
424
|
+
padding: 12px 16px;
|
|
425
|
+
border-radius: 8px;
|
|
426
|
+
font-size: 14px;
|
|
427
|
+
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', monospace;
|
|
428
|
+
line-height: 1.5;
|
|
429
|
+
resize: none;
|
|
430
|
+
overflow-y: auto;
|
|
431
|
+
overflow-x: hidden;
|
|
432
|
+
max-height: 150px;
|
|
433
|
+
word-wrap: break-word;
|
|
434
|
+
box-sizing: border-box;
|
|
435
|
+
scrollbar-width: none;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.input-row textarea::-webkit-scrollbar {
|
|
439
|
+
display: none;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.input-row textarea:focus {
|
|
443
|
+
outline: none;
|
|
444
|
+
border-color: #27ae60;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.input-row textarea::placeholder {
|
|
448
|
+
color: #666;
|
|
449
|
+
}
|
|
450
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import adapter from 'svelte-adapter-bun';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
8
|
+
const config = {
|
|
9
|
+
kit: {
|
|
10
|
+
adapter: adapter({
|
|
11
|
+
out: '../dist/web',
|
|
12
|
+
precompress: false
|
|
13
|
+
}),
|
|
14
|
+
alias: {
|
|
15
|
+
$shared: join(__dirname, '../src')
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default config;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rewriteRelativeImportExtensions": true,
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"checkJs": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"moduleResolution": "bundler"
|
|
14
|
+
}
|
|
15
|
+
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
|
16
|
+
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
|
17
|
+
//
|
|
18
|
+
// To make changes to top-level options such as include and exclude, we recommend extending
|
|
19
|
+
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
|
|
20
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
import { defineConfig, type ViteDevServer } from 'vite';
|
|
4
|
+
import { WebSocketServer, WebSocket } from 'ws';
|
|
5
|
+
|
|
6
|
+
// Dev WebSocket plugin - uses shared handlers
|
|
7
|
+
function devWebSocket() {
|
|
8
|
+
let wss: WebSocketServer;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
name: 'dev-websocket',
|
|
12
|
+
|
|
13
|
+
async configureServer(server: ViteDevServer) {
|
|
14
|
+
if (!server.httpServer) return;
|
|
15
|
+
|
|
16
|
+
// Import shared handlers
|
|
17
|
+
const {
|
|
18
|
+
SessionsWsManager,
|
|
19
|
+
TerminalWsManager,
|
|
20
|
+
BeadsWsManager,
|
|
21
|
+
handleWsMessage,
|
|
22
|
+
parseWsPath,
|
|
23
|
+
resizePane
|
|
24
|
+
} = await import('../src/server/ws-handlers.js');
|
|
25
|
+
type WsClient = import('../src/server/ws-handlers.js').WsClient;
|
|
26
|
+
|
|
27
|
+
// Create manager instances with debug enabled for dev
|
|
28
|
+
const sessionsWsManager = new SessionsWsManager({ debug: true });
|
|
29
|
+
const terminalWsManager = new TerminalWsManager({ debug: true });
|
|
30
|
+
const beadsWsManager = new BeadsWsManager({ debug: true });
|
|
31
|
+
|
|
32
|
+
// Track WebSocket -> target mapping for cleanup
|
|
33
|
+
const wsTargets = new WeakMap<WebSocket, string>();
|
|
34
|
+
|
|
35
|
+
// Create WsClient wrapper for ws library
|
|
36
|
+
function createClient(ws: WebSocket): WsClient {
|
|
37
|
+
return {
|
|
38
|
+
send: (msg: string) => ws.send(msg),
|
|
39
|
+
isOpen: () => ws.readyState === WebSocket.OPEN,
|
|
40
|
+
close: () => ws.close(),
|
|
41
|
+
getBufferedAmount: () => ws.bufferedAmount
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Create WebSocket server with compression enabled
|
|
46
|
+
wss = new WebSocketServer({ noServer: true, perMessageDeflate: true });
|
|
47
|
+
|
|
48
|
+
// Handle WebSocketServer-level errors
|
|
49
|
+
wss.on('error', (error) => {
|
|
50
|
+
console.error('[wss] WebSocketServer error:', error.message);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
wss.on('connection', (ws, req) => {
|
|
54
|
+
const url = new URL(req.url || '', 'http://localhost');
|
|
55
|
+
const parsed = parseWsPath(url.pathname, url.searchParams);
|
|
56
|
+
|
|
57
|
+
if (!parsed) {
|
|
58
|
+
ws.close();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const client = createClient(ws);
|
|
63
|
+
|
|
64
|
+
// Handle WebSocket errors to prevent server crashes
|
|
65
|
+
ws.on('error', (error) => {
|
|
66
|
+
console.error('[ws] WebSocket error:', error.message);
|
|
67
|
+
// Don't rethrow - just clean up
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (parsed.type === 'sessions') {
|
|
71
|
+
const accepted = sessionsWsManager.addClient(client);
|
|
72
|
+
if (!accepted) {
|
|
73
|
+
ws.close(1013, 'Max clients reached');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ws.on('message', (data) => {
|
|
78
|
+
const response = handleWsMessage(data.toString());
|
|
79
|
+
if (response === 'pong') ws.send('pong');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
ws.on('close', () => sessionsWsManager.removeClient(client));
|
|
83
|
+
} else if (parsed.type === 'terminal') {
|
|
84
|
+
const { target } = parsed;
|
|
85
|
+
const accepted = terminalWsManager.addClient(client, target);
|
|
86
|
+
if (!accepted) {
|
|
87
|
+
ws.close(1013, 'Max clients reached');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
wsTargets.set(ws, target);
|
|
92
|
+
|
|
93
|
+
ws.on('message', (data) => {
|
|
94
|
+
const response = handleWsMessage(data.toString(), (cols, rows) =>
|
|
95
|
+
resizePane(target, cols, rows)
|
|
96
|
+
);
|
|
97
|
+
if (response === 'pong') ws.send('pong');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
ws.on('close', () => {
|
|
101
|
+
const t = wsTargets.get(ws);
|
|
102
|
+
terminalWsManager.removeClient(client, t);
|
|
103
|
+
});
|
|
104
|
+
} else if (parsed.type === 'beads') {
|
|
105
|
+
const { project } = parsed;
|
|
106
|
+
const accepted = beadsWsManager.addClient(client, project);
|
|
107
|
+
if (!accepted) {
|
|
108
|
+
ws.close(1013, 'Max clients reached');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
ws.on('message', (data) => {
|
|
113
|
+
const response = handleWsMessage(data.toString());
|
|
114
|
+
if (response === 'pong') ws.send('pong');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
ws.on('close', () => {
|
|
118
|
+
beadsWsManager.removeClient(client, project);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Handle upgrade requests (skip Vite HMR)
|
|
124
|
+
server.httpServer.on('upgrade', (req, socket, head) => {
|
|
125
|
+
if (req.headers['sec-websocket-protocol'] === 'vite-hmr') return;
|
|
126
|
+
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
127
|
+
// Attach error handler IMMEDIATELY before emitting 'connection'
|
|
128
|
+
// This catches errors from malformed frames (e.g., mobile browser invalid close codes)
|
|
129
|
+
ws.on('error', (error) => {
|
|
130
|
+
console.log('[ws] WebSocket error (early):', {
|
|
131
|
+
code: (error as { code?: string }).code,
|
|
132
|
+
message: error.message
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
wss.emit('connection', ws, req);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
server.httpServer.on('close', () => wss?.close());
|
|
140
|
+
|
|
141
|
+
console.log('[dev] WebSocket ready at /api/sessions/stream, /api/sessions/[target]/stream, and /api/beads/stream');
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export default defineConfig({
|
|
147
|
+
plugins: [tailwindcss(), sveltekit(), devWebSocket()],
|
|
148
|
+
server: {
|
|
149
|
+
host: '0.0.0.0'
|
|
150
|
+
},
|
|
151
|
+
build: {
|
|
152
|
+
target: 'esnext'
|
|
153
|
+
}
|
|
154
|
+
});
|