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,542 @@
|
|
|
1
|
+
import * as devalue from "devalue";
|
|
2
|
+
import { t as text_decoder, b as base64_encode, c as base64_decode } from "./utils.js";
|
|
3
|
+
import { SvelteKitError } from "@sveltejs/kit/internal";
|
|
4
|
+
function set_nested_value(object, path_string, value) {
|
|
5
|
+
if (path_string.startsWith("n:")) {
|
|
6
|
+
path_string = path_string.slice(2);
|
|
7
|
+
value = value === "" ? void 0 : parseFloat(value);
|
|
8
|
+
} else if (path_string.startsWith("b:")) {
|
|
9
|
+
path_string = path_string.slice(2);
|
|
10
|
+
value = value === "on";
|
|
11
|
+
}
|
|
12
|
+
deep_set(object, split_path(path_string), value);
|
|
13
|
+
}
|
|
14
|
+
function convert_formdata(data) {
|
|
15
|
+
const result = {};
|
|
16
|
+
for (let key of data.keys()) {
|
|
17
|
+
const is_array = key.endsWith("[]");
|
|
18
|
+
let values = data.getAll(key);
|
|
19
|
+
if (is_array) key = key.slice(0, -2);
|
|
20
|
+
if (values.length > 1 && !is_array) {
|
|
21
|
+
throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
|
|
22
|
+
}
|
|
23
|
+
values = values.filter(
|
|
24
|
+
(entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0
|
|
25
|
+
);
|
|
26
|
+
if (key.startsWith("n:")) {
|
|
27
|
+
key = key.slice(2);
|
|
28
|
+
values = values.map((v) => v === "" ? void 0 : parseFloat(
|
|
29
|
+
/** @type {string} */
|
|
30
|
+
v
|
|
31
|
+
));
|
|
32
|
+
} else if (key.startsWith("b:")) {
|
|
33
|
+
key = key.slice(2);
|
|
34
|
+
values = values.map((v) => v === "on");
|
|
35
|
+
}
|
|
36
|
+
set_nested_value(result, key, is_array ? values : values[0]);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
const BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
|
41
|
+
const BINARY_FORM_VERSION = 0;
|
|
42
|
+
const HEADER_BYTES = 1 + 4 + 2;
|
|
43
|
+
async function deserialize_binary_form(request) {
|
|
44
|
+
if (request.headers.get("content-type") !== BINARY_FORM_CONTENT_TYPE) {
|
|
45
|
+
const form_data = await request.formData();
|
|
46
|
+
return { data: convert_formdata(form_data), meta: {}, form_data };
|
|
47
|
+
}
|
|
48
|
+
if (!request.body) {
|
|
49
|
+
throw deserialize_error("no body");
|
|
50
|
+
}
|
|
51
|
+
const content_length = parseInt(request.headers.get("content-length") ?? "");
|
|
52
|
+
if (Number.isNaN(content_length)) {
|
|
53
|
+
throw deserialize_error("invalid Content-Length header");
|
|
54
|
+
}
|
|
55
|
+
const reader = request.body.getReader();
|
|
56
|
+
const chunks = [];
|
|
57
|
+
function get_chunk(index) {
|
|
58
|
+
if (index in chunks) return chunks[index];
|
|
59
|
+
let i = chunks.length;
|
|
60
|
+
while (i <= index) {
|
|
61
|
+
chunks[i] = reader.read().then((chunk) => chunk.value);
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
return chunks[index];
|
|
65
|
+
}
|
|
66
|
+
async function get_buffer(offset, length) {
|
|
67
|
+
let start_chunk;
|
|
68
|
+
let chunk_start = 0;
|
|
69
|
+
let chunk_index;
|
|
70
|
+
for (chunk_index = 0; ; chunk_index++) {
|
|
71
|
+
const chunk = await get_chunk(chunk_index);
|
|
72
|
+
if (!chunk) return null;
|
|
73
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
74
|
+
if (offset >= chunk_start && offset < chunk_end) {
|
|
75
|
+
start_chunk = chunk;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
chunk_start = chunk_end;
|
|
79
|
+
}
|
|
80
|
+
if (offset + length <= chunk_start + start_chunk.byteLength) {
|
|
81
|
+
return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
|
|
82
|
+
}
|
|
83
|
+
const chunks2 = [start_chunk.subarray(offset - chunk_start)];
|
|
84
|
+
let cursor = start_chunk.byteLength - offset + chunk_start;
|
|
85
|
+
while (cursor < length) {
|
|
86
|
+
chunk_index++;
|
|
87
|
+
let chunk = await get_chunk(chunk_index);
|
|
88
|
+
if (!chunk) return null;
|
|
89
|
+
if (chunk.byteLength > length - cursor) {
|
|
90
|
+
chunk = chunk.subarray(0, length - cursor);
|
|
91
|
+
}
|
|
92
|
+
chunks2.push(chunk);
|
|
93
|
+
cursor += chunk.byteLength;
|
|
94
|
+
}
|
|
95
|
+
const buffer = new Uint8Array(length);
|
|
96
|
+
cursor = 0;
|
|
97
|
+
for (const chunk of chunks2) {
|
|
98
|
+
buffer.set(chunk, cursor);
|
|
99
|
+
cursor += chunk.byteLength;
|
|
100
|
+
}
|
|
101
|
+
return buffer;
|
|
102
|
+
}
|
|
103
|
+
const header = await get_buffer(0, HEADER_BYTES);
|
|
104
|
+
if (!header) throw deserialize_error("too short");
|
|
105
|
+
if (header[0] !== BINARY_FORM_VERSION) {
|
|
106
|
+
throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
|
107
|
+
}
|
|
108
|
+
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
109
|
+
const data_length = header_view.getUint32(1, true);
|
|
110
|
+
if (HEADER_BYTES + data_length > content_length) {
|
|
111
|
+
throw deserialize_error("data overflow");
|
|
112
|
+
}
|
|
113
|
+
const file_offsets_length = header_view.getUint16(5, true);
|
|
114
|
+
if (HEADER_BYTES + data_length + file_offsets_length > content_length) {
|
|
115
|
+
throw deserialize_error("file offset table overflow");
|
|
116
|
+
}
|
|
117
|
+
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
|
118
|
+
if (!data_buffer) throw deserialize_error("data too short");
|
|
119
|
+
let file_offsets;
|
|
120
|
+
let files_start_offset;
|
|
121
|
+
if (file_offsets_length > 0) {
|
|
122
|
+
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
123
|
+
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
|
124
|
+
file_offsets = /** @type {Array<number>} */
|
|
125
|
+
JSON.parse(text_decoder.decode(file_offsets_buffer));
|
|
126
|
+
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
127
|
+
}
|
|
128
|
+
const [data, meta] = devalue.parse(text_decoder.decode(data_buffer), {
|
|
129
|
+
File: ([name, type, size, last_modified, index]) => {
|
|
130
|
+
if (files_start_offset + file_offsets[index] + size > content_length) {
|
|
131
|
+
throw deserialize_error("file data overflow");
|
|
132
|
+
}
|
|
133
|
+
return new Proxy(
|
|
134
|
+
new LazyFile(
|
|
135
|
+
name,
|
|
136
|
+
type,
|
|
137
|
+
size,
|
|
138
|
+
last_modified,
|
|
139
|
+
get_chunk,
|
|
140
|
+
files_start_offset + file_offsets[index]
|
|
141
|
+
),
|
|
142
|
+
{
|
|
143
|
+
getPrototypeOf() {
|
|
144
|
+
return File.prototype;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
void (async () => {
|
|
151
|
+
let has_more = true;
|
|
152
|
+
while (has_more) {
|
|
153
|
+
const chunk = await get_chunk(chunks.length);
|
|
154
|
+
has_more = !!chunk;
|
|
155
|
+
}
|
|
156
|
+
})();
|
|
157
|
+
return { data, meta, form_data: null };
|
|
158
|
+
}
|
|
159
|
+
function deserialize_error(message) {
|
|
160
|
+
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
|
161
|
+
}
|
|
162
|
+
class LazyFile {
|
|
163
|
+
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
|
164
|
+
#get_chunk;
|
|
165
|
+
/** @type {number} */
|
|
166
|
+
#offset;
|
|
167
|
+
/**
|
|
168
|
+
* @param {string} name
|
|
169
|
+
* @param {string} type
|
|
170
|
+
* @param {number} size
|
|
171
|
+
* @param {number} last_modified
|
|
172
|
+
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
|
173
|
+
* @param {number} offset
|
|
174
|
+
*/
|
|
175
|
+
constructor(name, type, size, last_modified, get_chunk, offset) {
|
|
176
|
+
this.name = name;
|
|
177
|
+
this.type = type;
|
|
178
|
+
this.size = size;
|
|
179
|
+
this.lastModified = last_modified;
|
|
180
|
+
this.webkitRelativePath = "";
|
|
181
|
+
this.#get_chunk = get_chunk;
|
|
182
|
+
this.#offset = offset;
|
|
183
|
+
this.arrayBuffer = this.arrayBuffer.bind(this);
|
|
184
|
+
this.bytes = this.bytes.bind(this);
|
|
185
|
+
this.slice = this.slice.bind(this);
|
|
186
|
+
this.stream = this.stream.bind(this);
|
|
187
|
+
this.text = this.text.bind(this);
|
|
188
|
+
}
|
|
189
|
+
/** @type {ArrayBuffer | undefined} */
|
|
190
|
+
#buffer;
|
|
191
|
+
async arrayBuffer() {
|
|
192
|
+
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
|
193
|
+
return this.#buffer;
|
|
194
|
+
}
|
|
195
|
+
async bytes() {
|
|
196
|
+
return new Uint8Array(await this.arrayBuffer());
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @param {number=} start
|
|
200
|
+
* @param {number=} end
|
|
201
|
+
* @param {string=} contentType
|
|
202
|
+
*/
|
|
203
|
+
slice(start = 0, end = this.size, contentType = this.type) {
|
|
204
|
+
if (start < 0) {
|
|
205
|
+
start = Math.max(this.size + start, 0);
|
|
206
|
+
} else {
|
|
207
|
+
start = Math.min(start, this.size);
|
|
208
|
+
}
|
|
209
|
+
if (end < 0) {
|
|
210
|
+
end = Math.max(this.size + end, 0);
|
|
211
|
+
} else {
|
|
212
|
+
end = Math.min(end, this.size);
|
|
213
|
+
}
|
|
214
|
+
const size = Math.max(end - start, 0);
|
|
215
|
+
const file = new LazyFile(
|
|
216
|
+
this.name,
|
|
217
|
+
contentType,
|
|
218
|
+
size,
|
|
219
|
+
this.lastModified,
|
|
220
|
+
this.#get_chunk,
|
|
221
|
+
this.#offset + start
|
|
222
|
+
);
|
|
223
|
+
return file;
|
|
224
|
+
}
|
|
225
|
+
stream() {
|
|
226
|
+
let cursor = 0;
|
|
227
|
+
let chunk_index = 0;
|
|
228
|
+
return new ReadableStream({
|
|
229
|
+
start: async (controller) => {
|
|
230
|
+
let chunk_start = 0;
|
|
231
|
+
let start_chunk = null;
|
|
232
|
+
for (chunk_index = 0; ; chunk_index++) {
|
|
233
|
+
const chunk = await this.#get_chunk(chunk_index);
|
|
234
|
+
if (!chunk) return null;
|
|
235
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
236
|
+
if (this.#offset >= chunk_start && this.#offset < chunk_end) {
|
|
237
|
+
start_chunk = chunk;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
chunk_start = chunk_end;
|
|
241
|
+
}
|
|
242
|
+
if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
|
|
243
|
+
controller.enqueue(
|
|
244
|
+
start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start)
|
|
245
|
+
);
|
|
246
|
+
controller.close();
|
|
247
|
+
} else {
|
|
248
|
+
controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
|
|
249
|
+
cursor = start_chunk.byteLength - this.#offset + chunk_start;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
pull: async (controller) => {
|
|
253
|
+
chunk_index++;
|
|
254
|
+
let chunk = await this.#get_chunk(chunk_index);
|
|
255
|
+
if (!chunk) {
|
|
256
|
+
controller.error("incomplete file data");
|
|
257
|
+
controller.close();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (chunk.byteLength > this.size - cursor) {
|
|
261
|
+
chunk = chunk.subarray(0, this.size - cursor);
|
|
262
|
+
}
|
|
263
|
+
controller.enqueue(chunk);
|
|
264
|
+
cursor += chunk.byteLength;
|
|
265
|
+
if (cursor >= this.size) {
|
|
266
|
+
controller.close();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
async text() {
|
|
272
|
+
return text_decoder.decode(await this.arrayBuffer());
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
|
|
276
|
+
function split_path(path) {
|
|
277
|
+
if (!path_regex.test(path)) {
|
|
278
|
+
throw new Error(`Invalid path ${path}`);
|
|
279
|
+
}
|
|
280
|
+
return path.split(/\.|\[|\]/).filter(Boolean);
|
|
281
|
+
}
|
|
282
|
+
function check_prototype_pollution(key) {
|
|
283
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
284
|
+
throw new Error(
|
|
285
|
+
`Invalid key "${key}"`
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function deep_set(object, keys, value) {
|
|
290
|
+
let current = object;
|
|
291
|
+
for (let i = 0; i < keys.length - 1; i += 1) {
|
|
292
|
+
const key = keys[i];
|
|
293
|
+
check_prototype_pollution(key);
|
|
294
|
+
const is_array = /^\d+$/.test(keys[i + 1]);
|
|
295
|
+
const exists = Object.hasOwn(current, key);
|
|
296
|
+
const inner = current[key];
|
|
297
|
+
if (exists && is_array !== Array.isArray(inner)) {
|
|
298
|
+
throw new Error(`Invalid array key ${keys[i + 1]}`);
|
|
299
|
+
}
|
|
300
|
+
if (!exists) {
|
|
301
|
+
current[key] = is_array ? [] : {};
|
|
302
|
+
}
|
|
303
|
+
current = current[key];
|
|
304
|
+
}
|
|
305
|
+
const final_key = keys[keys.length - 1];
|
|
306
|
+
check_prototype_pollution(final_key);
|
|
307
|
+
current[final_key] = value;
|
|
308
|
+
}
|
|
309
|
+
function normalize_issue(issue, server = false) {
|
|
310
|
+
const normalized = { name: "", path: [], message: issue.message, server };
|
|
311
|
+
if (issue.path !== void 0) {
|
|
312
|
+
let name = "";
|
|
313
|
+
for (const segment of issue.path) {
|
|
314
|
+
const key = (
|
|
315
|
+
/** @type {string | number} */
|
|
316
|
+
typeof segment === "object" ? segment.key : segment
|
|
317
|
+
);
|
|
318
|
+
normalized.path.push(key);
|
|
319
|
+
if (typeof key === "number") {
|
|
320
|
+
name += `[${key}]`;
|
|
321
|
+
} else if (typeof key === "string") {
|
|
322
|
+
name += name === "" ? key : "." + key;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
normalized.name = name;
|
|
326
|
+
}
|
|
327
|
+
return normalized;
|
|
328
|
+
}
|
|
329
|
+
function flatten_issues(issues) {
|
|
330
|
+
const result = {};
|
|
331
|
+
for (const issue of issues) {
|
|
332
|
+
(result.$ ??= []).push(issue);
|
|
333
|
+
let name = "";
|
|
334
|
+
if (issue.path !== void 0) {
|
|
335
|
+
for (const key of issue.path) {
|
|
336
|
+
if (typeof key === "number") {
|
|
337
|
+
name += `[${key}]`;
|
|
338
|
+
} else if (typeof key === "string") {
|
|
339
|
+
name += name === "" ? key : "." + key;
|
|
340
|
+
}
|
|
341
|
+
(result[name] ??= []).push(issue);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
function deep_get(object, path) {
|
|
348
|
+
let current = object;
|
|
349
|
+
for (const key of path) {
|
|
350
|
+
if (current == null || typeof current !== "object") {
|
|
351
|
+
return current;
|
|
352
|
+
}
|
|
353
|
+
current = current[key];
|
|
354
|
+
}
|
|
355
|
+
return current;
|
|
356
|
+
}
|
|
357
|
+
function create_field_proxy(target, get_input, set_input, get_issues, path = []) {
|
|
358
|
+
const get_value = () => {
|
|
359
|
+
return deep_get(get_input(), path);
|
|
360
|
+
};
|
|
361
|
+
return new Proxy(target, {
|
|
362
|
+
get(target2, prop) {
|
|
363
|
+
if (typeof prop === "symbol") return target2[prop];
|
|
364
|
+
if (/^\d+$/.test(prop)) {
|
|
365
|
+
return create_field_proxy({}, get_input, set_input, get_issues, [
|
|
366
|
+
...path,
|
|
367
|
+
parseInt(prop, 10)
|
|
368
|
+
]);
|
|
369
|
+
}
|
|
370
|
+
const key = build_path_string(path);
|
|
371
|
+
if (prop === "set") {
|
|
372
|
+
const set_func = function(newValue) {
|
|
373
|
+
set_input(path, newValue);
|
|
374
|
+
return newValue;
|
|
375
|
+
};
|
|
376
|
+
return create_field_proxy(set_func, get_input, set_input, get_issues, [...path, prop]);
|
|
377
|
+
}
|
|
378
|
+
if (prop === "value") {
|
|
379
|
+
return create_field_proxy(get_value, get_input, set_input, get_issues, [...path, prop]);
|
|
380
|
+
}
|
|
381
|
+
if (prop === "issues" || prop === "allIssues") {
|
|
382
|
+
const issues_func = () => {
|
|
383
|
+
const all_issues = get_issues()[key === "" ? "$" : key];
|
|
384
|
+
if (prop === "allIssues") {
|
|
385
|
+
return all_issues?.map((issue) => ({
|
|
386
|
+
path: issue.path,
|
|
387
|
+
message: issue.message
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
return all_issues?.filter((issue) => issue.name === key)?.map((issue) => ({
|
|
391
|
+
path: issue.path,
|
|
392
|
+
message: issue.message
|
|
393
|
+
}));
|
|
394
|
+
};
|
|
395
|
+
return create_field_proxy(issues_func, get_input, set_input, get_issues, [...path, prop]);
|
|
396
|
+
}
|
|
397
|
+
if (prop === "as") {
|
|
398
|
+
const as_func = (type, input_value) => {
|
|
399
|
+
const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string";
|
|
400
|
+
const prefix = type === "number" || type === "range" ? "n:" : type === "checkbox" && !is_array ? "b:" : "";
|
|
401
|
+
const base_props = {
|
|
402
|
+
name: prefix + key + (is_array ? "[]" : ""),
|
|
403
|
+
get "aria-invalid"() {
|
|
404
|
+
const issues = get_issues();
|
|
405
|
+
return key in issues ? "true" : void 0;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
if (type !== "text" && type !== "select" && type !== "select multiple") {
|
|
409
|
+
base_props.type = type === "file multiple" ? "file" : type;
|
|
410
|
+
}
|
|
411
|
+
if (type === "submit" || type === "hidden") {
|
|
412
|
+
return Object.defineProperties(base_props, {
|
|
413
|
+
value: { value: input_value, enumerable: true }
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (type === "select" || type === "select multiple") {
|
|
417
|
+
return Object.defineProperties(base_props, {
|
|
418
|
+
multiple: { value: is_array, enumerable: true },
|
|
419
|
+
value: {
|
|
420
|
+
enumerable: true,
|
|
421
|
+
get() {
|
|
422
|
+
return get_value();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (type === "checkbox" || type === "radio") {
|
|
428
|
+
return Object.defineProperties(base_props, {
|
|
429
|
+
value: { value: input_value ?? "on", enumerable: true },
|
|
430
|
+
checked: {
|
|
431
|
+
enumerable: true,
|
|
432
|
+
get() {
|
|
433
|
+
const value = get_value();
|
|
434
|
+
if (type === "radio") {
|
|
435
|
+
return value === input_value;
|
|
436
|
+
}
|
|
437
|
+
if (is_array) {
|
|
438
|
+
return (value ?? []).includes(input_value);
|
|
439
|
+
}
|
|
440
|
+
return value;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
if (type === "file" || type === "file multiple") {
|
|
446
|
+
return Object.defineProperties(base_props, {
|
|
447
|
+
multiple: { value: is_array, enumerable: true },
|
|
448
|
+
files: {
|
|
449
|
+
enumerable: true,
|
|
450
|
+
get() {
|
|
451
|
+
const value = get_value();
|
|
452
|
+
if (value instanceof File) {
|
|
453
|
+
if (typeof DataTransfer !== "undefined") {
|
|
454
|
+
const fileList = new DataTransfer();
|
|
455
|
+
fileList.items.add(value);
|
|
456
|
+
return fileList.files;
|
|
457
|
+
}
|
|
458
|
+
return { 0: value, length: 1 };
|
|
459
|
+
}
|
|
460
|
+
if (Array.isArray(value) && value.every((f) => f instanceof File)) {
|
|
461
|
+
if (typeof DataTransfer !== "undefined") {
|
|
462
|
+
const fileList = new DataTransfer();
|
|
463
|
+
value.forEach((file) => fileList.items.add(file));
|
|
464
|
+
return fileList.files;
|
|
465
|
+
}
|
|
466
|
+
const fileListLike = { length: value.length };
|
|
467
|
+
value.forEach((file, index) => {
|
|
468
|
+
fileListLike[index] = file;
|
|
469
|
+
});
|
|
470
|
+
return fileListLike;
|
|
471
|
+
}
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
return Object.defineProperties(base_props, {
|
|
478
|
+
value: {
|
|
479
|
+
enumerable: true,
|
|
480
|
+
get() {
|
|
481
|
+
const value = get_value();
|
|
482
|
+
return value != null ? String(value) : "";
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
return create_field_proxy(as_func, get_input, set_input, get_issues, [...path, "as"]);
|
|
488
|
+
}
|
|
489
|
+
return create_field_proxy({}, get_input, set_input, get_issues, [...path, prop]);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function build_path_string(path) {
|
|
494
|
+
let result = "";
|
|
495
|
+
for (const segment of path) {
|
|
496
|
+
if (typeof segment === "number") {
|
|
497
|
+
result += `[${segment}]`;
|
|
498
|
+
} else {
|
|
499
|
+
result += result === "" ? segment : "." + segment;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return result;
|
|
503
|
+
}
|
|
504
|
+
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
505
|
+
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
506
|
+
function stringify(data, transport) {
|
|
507
|
+
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
508
|
+
return devalue.stringify(data, encoders);
|
|
509
|
+
}
|
|
510
|
+
function stringify_remote_arg(value, transport) {
|
|
511
|
+
if (value === void 0) return "";
|
|
512
|
+
const json_string = stringify(value, transport);
|
|
513
|
+
const bytes = new TextEncoder().encode(json_string);
|
|
514
|
+
return base64_encode(bytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
|
|
515
|
+
}
|
|
516
|
+
function parse_remote_arg(string, transport) {
|
|
517
|
+
if (!string) return void 0;
|
|
518
|
+
const json_string = text_decoder.decode(
|
|
519
|
+
// no need to add back `=` characters, atob can handle it
|
|
520
|
+
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
|
521
|
+
);
|
|
522
|
+
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
|
523
|
+
return devalue.parse(json_string, decoders);
|
|
524
|
+
}
|
|
525
|
+
function create_remote_key(id, payload) {
|
|
526
|
+
return id + "/" + payload;
|
|
527
|
+
}
|
|
528
|
+
export {
|
|
529
|
+
BINARY_FORM_CONTENT_TYPE as B,
|
|
530
|
+
INVALIDATED_PARAM as I,
|
|
531
|
+
TRAILING_SLASH_PARAM as T,
|
|
532
|
+
stringify_remote_arg as a,
|
|
533
|
+
create_field_proxy as b,
|
|
534
|
+
create_remote_key as c,
|
|
535
|
+
deserialize_binary_form as d,
|
|
536
|
+
set_nested_value as e,
|
|
537
|
+
flatten_issues as f,
|
|
538
|
+
deep_set as g,
|
|
539
|
+
normalize_issue as n,
|
|
540
|
+
parse_remote_arg as p,
|
|
541
|
+
stringify as s
|
|
542
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "clsx";
|
|
2
|
+
import { n as noop } from "./context.js";
|
|
3
|
+
import "@sveltejs/kit/internal/server";
|
|
4
|
+
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
|
5
|
+
if (is_legacy) {
|
|
6
|
+
({
|
|
7
|
+
data: {},
|
|
8
|
+
form: null,
|
|
9
|
+
error: null,
|
|
10
|
+
params: {},
|
|
11
|
+
route: { id: null },
|
|
12
|
+
state: {},
|
|
13
|
+
status: -1,
|
|
14
|
+
url: new URL("https://example.com")
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const text_encoder = new TextEncoder();
|
|
2
|
+
const text_decoder = new TextDecoder();
|
|
3
|
+
function get_relative_path(from, to) {
|
|
4
|
+
const from_parts = from.split(/[/\\]/);
|
|
5
|
+
const to_parts = to.split(/[/\\]/);
|
|
6
|
+
from_parts.pop();
|
|
7
|
+
while (from_parts[0] === to_parts[0]) {
|
|
8
|
+
from_parts.shift();
|
|
9
|
+
to_parts.shift();
|
|
10
|
+
}
|
|
11
|
+
let i = from_parts.length;
|
|
12
|
+
while (i--) from_parts[i] = "..";
|
|
13
|
+
return from_parts.concat(to_parts).join("/");
|
|
14
|
+
}
|
|
15
|
+
function base64_encode(bytes) {
|
|
16
|
+
if (globalThis.Buffer) {
|
|
17
|
+
return globalThis.Buffer.from(bytes).toString("base64");
|
|
18
|
+
}
|
|
19
|
+
let binary = "";
|
|
20
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
21
|
+
binary += String.fromCharCode(bytes[i]);
|
|
22
|
+
}
|
|
23
|
+
return btoa(binary);
|
|
24
|
+
}
|
|
25
|
+
function base64_decode(encoded) {
|
|
26
|
+
if (globalThis.Buffer) {
|
|
27
|
+
const buffer = globalThis.Buffer.from(encoded, "base64");
|
|
28
|
+
return new Uint8Array(buffer);
|
|
29
|
+
}
|
|
30
|
+
const binary = atob(encoded);
|
|
31
|
+
const bytes = new Uint8Array(binary.length);
|
|
32
|
+
for (let i = 0; i < binary.length; i++) {
|
|
33
|
+
bytes[i] = binary.charCodeAt(i);
|
|
34
|
+
}
|
|
35
|
+
return bytes;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
text_encoder as a,
|
|
39
|
+
base64_encode as b,
|
|
40
|
+
base64_decode as c,
|
|
41
|
+
get_relative_path as g,
|
|
42
|
+
text_decoder as t
|
|
43
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { json } from "@sveltejs/kit";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { existsSync, statSync, readdirSync } from "fs";
|
|
4
|
+
import { resolve, join, dirname } from "path";
|
|
5
|
+
const GET = async ({ url }) => {
|
|
6
|
+
let targetPath = url.searchParams.get("path") || homedir();
|
|
7
|
+
const showHidden = url.searchParams.get("showHidden") === "true";
|
|
8
|
+
if (targetPath.startsWith("~")) {
|
|
9
|
+
targetPath = targetPath.replace("~", homedir());
|
|
10
|
+
}
|
|
11
|
+
targetPath = resolve(targetPath);
|
|
12
|
+
try {
|
|
13
|
+
if (!existsSync(targetPath)) {
|
|
14
|
+
return json({ error: "Directory not found" }, { status: 404 });
|
|
15
|
+
}
|
|
16
|
+
const stat = statSync(targetPath);
|
|
17
|
+
if (!stat.isDirectory()) {
|
|
18
|
+
return json({ error: "Not a directory" }, { status: 400 });
|
|
19
|
+
}
|
|
20
|
+
const entries = readdirSync(targetPath, { withFileTypes: true });
|
|
21
|
+
const folders = entries.filter((e) => {
|
|
22
|
+
if (!e.isDirectory()) return false;
|
|
23
|
+
if (!showHidden && e.name.startsWith(".")) return false;
|
|
24
|
+
return true;
|
|
25
|
+
}).map((e) => ({
|
|
26
|
+
name: e.name,
|
|
27
|
+
path: join(targetPath, e.name)
|
|
28
|
+
})).sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
29
|
+
const parent = dirname(targetPath);
|
|
30
|
+
const isRoot = targetPath === "/" || targetPath === parent;
|
|
31
|
+
return json({
|
|
32
|
+
current: targetPath,
|
|
33
|
+
parent: isRoot ? null : parent,
|
|
34
|
+
isRoot,
|
|
35
|
+
folders
|
|
36
|
+
});
|
|
37
|
+
} catch (err) {
|
|
38
|
+
const error = err;
|
|
39
|
+
if (error.code === "ENOENT") {
|
|
40
|
+
return json({ error: "Directory not found" }, { status: 404 });
|
|
41
|
+
}
|
|
42
|
+
if (error.code === "EACCES") {
|
|
43
|
+
return json({ error: "Permission denied" }, { status: 403 });
|
|
44
|
+
}
|
|
45
|
+
return json({ error: "Failed to read directory" }, { status: 500 });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
GET
|
|
50
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { json } from "@sveltejs/kit";
|
|
2
|
+
import { existsSync, statSync } from "fs";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { u as upsertSession } from "../../../../../chunks/sessions-json.js";
|
|
5
|
+
const POST = async ({ request }) => {
|
|
6
|
+
const { cwd } = await request.json();
|
|
7
|
+
if (!cwd) {
|
|
8
|
+
return json({ error: "cwd required" }, { status: 400 });
|
|
9
|
+
}
|
|
10
|
+
if (!existsSync(cwd)) {
|
|
11
|
+
return json({ error: "Folder does not exist" }, { status: 400 });
|
|
12
|
+
}
|
|
13
|
+
const stat = statSync(cwd);
|
|
14
|
+
if (!stat.isDirectory()) {
|
|
15
|
+
return json({ error: "Path is not a directory" }, { status: 400 });
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const sessionName = "claude-" + Date.now();
|
|
19
|
+
const tmuxTarget = sessionName + ":1.1";
|
|
20
|
+
execSync(`tmux new-session -d -s "${sessionName}" -c "${cwd}" -- claude --dangerously-skip-permissions`, {
|
|
21
|
+
stdio: "ignore"
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
const id = crypto.randomUUID();
|
|
25
|
+
console.log("[new-session] Creating session:", { id, cwd, tmuxTarget });
|
|
26
|
+
upsertSession({
|
|
27
|
+
id,
|
|
28
|
+
pid: 0,
|
|
29
|
+
cwd,
|
|
30
|
+
tmux_target: tmuxTarget,
|
|
31
|
+
state: "idle"
|
|
32
|
+
});
|
|
33
|
+
console.log("[new-session] Session created successfully");
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error("[new-session] Session creation failed:", err);
|
|
36
|
+
}
|
|
37
|
+
return json({ ok: true, session: sessionName });
|
|
38
|
+
} catch {
|
|
39
|
+
return json({ error: "Failed to create session" }, { status: 500 });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
POST
|
|
44
|
+
};
|