@thaut/claude-ide 0.0.0-stage → 1.0.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/bin/claude-ide.js +23 -0
- package/package.json +75 -4
- package/server/add-dirs.ts +126 -0
- package/server/auth.test.ts +148 -0
- package/server/auth.ts +235 -0
- package/server/bang.ts +54 -0
- package/server/btw-instructions.ts +19 -0
- package/server/btw-policy.ts +17 -0
- package/server/btw.ts +143 -0
- package/server/child-env.ts +29 -0
- package/server/cli-control.ts +255 -0
- package/server/cli-files.ts +55 -0
- package/server/cli-info.ts +73 -0
- package/server/config/account.ts +65 -0
- package/server/config/agents.ts +186 -0
- package/server/config/mcp.ts +86 -0
- package/server/config/memory.ts +193 -0
- package/server/config/paths.ts +156 -0
- package/server/config/plugins.ts +204 -0
- package/server/config/routes.ts +95 -0
- package/server/config/settings.ts +246 -0
- package/server/config.ts +46 -0
- package/server/db.ts +121 -0
- package/server/directories.test.ts +180 -0
- package/server/directories.ts +87 -0
- package/server/dist-version.ts +69 -0
- package/server/durable-tasks.ts +61 -0
- package/server/file-transfers.ts +79 -0
- package/server/files.test.ts +127 -0
- package/server/files.ts +386 -0
- package/server/fs-queue.ts +14 -0
- package/server/fsutil.ts +144 -0
- package/server/git.ts +86 -0
- package/server/goal-state.test.ts +64 -0
- package/server/goal-state.ts +78 -0
- package/server/history-pages.test.ts +619 -0
- package/server/history-pages.ts +513 -0
- package/server/http-channel-manager.ts +468 -0
- package/server/http-channel-pull.test.ts +314 -0
- package/server/http-channel-push.test.ts +364 -0
- package/server/http-channel-registration.test.ts +291 -0
- package/server/http-channel-routes.ts +73 -0
- package/server/http-channel-store.ts +142 -0
- package/server/http-channel-test-fixture.ts +103 -0
- package/server/ide-messages-mcp.test.ts +82 -0
- package/server/ide-messages-mcp.ts +47 -0
- package/server/idecron-mcp.ts +65 -0
- package/server/idecron.test.ts +79 -0
- package/server/idecron.ts +271 -0
- package/server/index.ts +336 -0
- package/server/live-session.test.ts +1126 -0
- package/server/live-session.ts +1165 -0
- package/server/project-routes.ts +46 -0
- package/server/projects.test.ts +28 -0
- package/server/push.ts +315 -0
- package/server/report-cache.ts +28 -0
- package/server/session-aliases.test.ts +57 -0
- package/server/session-aliases.ts +50 -0
- package/server/session-branch.ts +71 -0
- package/server/session-dirs.ts +189 -0
- package/server/session-file.test.ts +134 -0
- package/server/session-file.ts +113 -0
- package/server/session-messaging.test.ts +297 -0
- package/server/session-messaging.ts +165 -0
- package/server/sessions.ts +638 -0
- package/server/subagents.test.ts +43 -0
- package/server/subagents.ts +58 -0
- package/server/tool-images.test.ts +76 -0
- package/server/tool-images.ts +45 -0
- package/server/turn-changes.ts +308 -0
- package/server/worktree-git.ts +87 -0
- package/server/worktrees.ts +138 -0
- package/server/ws.test.ts +195 -0
- package/server/ws.ts +197 -0
- package/shared/agent-model.ts +15 -0
- package/shared/agent-tasks.ts +12 -0
- package/shared/config.ts +175 -0
- package/shared/directories.ts +12 -0
- package/shared/files.ts +51 -0
- package/shared/http-channels.ts +63 -0
- package/shared/message-window.ts +189 -0
- package/shared/project.ts +77 -0
- package/shared/protocol.ts +203 -0
- package/shared/task-types.ts +4 -0
- package/shared/todos.ts +40 -0
- package/shared/write-policy.ts +9 -0
- package/web/dist/assets/AgentView-wrTKgcJ3.js +1 -0
- package/web/dist/assets/AnnotationSelection-BZmNmwVW.js +7 -0
- package/web/dist/assets/ChangesView-G1WTzh4q.js +2 -0
- package/web/dist/assets/FilesView-DPgAbYt_.js +6 -0
- package/web/dist/assets/Form-BKTwiYyw.js +1 -0
- package/web/dist/assets/HomePage-Dq2apjBe.js +1 -0
- package/web/dist/assets/Markdown-IwP-xF29.js +67 -0
- package/web/dist/assets/MessageList-DD9GypSy.js +15 -0
- package/web/dist/assets/Modal-g2rv8I_n.js +1 -0
- package/web/dist/assets/NotificationSettings-DpuLO_Bv.js +1 -0
- package/web/dist/assets/OverviewPage-Dx6miabE.js +1 -0
- package/web/dist/assets/ProjectHome-CousyTLL.js +1 -0
- package/web/dist/assets/SessionView-CPVL7_HO.js +2 -0
- package/web/dist/assets/SettingsPage-D_oYSnW2.js +7 -0
- package/web/dist/assets/WorktreesView-C7e0HV__.js +1 -0
- package/web/dist/assets/abap-CLvhMVsD.js +1 -0
- package/web/dist/assets/actionscript-3-Cs6JJXT5.js +1 -0
- package/web/dist/assets/ada-X3Y2mlq2.js +1 -0
- package/web/dist/assets/ahk-DwADkxyd.js +1 -0
- package/web/dist/assets/ahk2-_6rzW9BS.js +1 -0
- package/web/dist/assets/andromeeda-vGVdxbeo.js +1 -0
- package/web/dist/assets/angular-html-Cw29lun8.js +1 -0
- package/web/dist/assets/angular-ts-BXz-O3SJ.js +1 -0
- package/web/dist/assets/apache-U0d_L8uA.js +1 -0
- package/web/dist/assets/apex-KFGFyKwG.js +1 -0
- package/web/dist/assets/apl-xBchdRhy.js +1 -0
- package/web/dist/assets/applescript-CCn79oCD.js +1 -0
- package/web/dist/assets/ara-4CJ0cIlV.js +1 -0
- package/web/dist/assets/asciidoc-SCjQUq34.js +1 -0
- package/web/dist/assets/asm-Cmm7eHzH.js +1 -0
- package/web/dist/assets/astro-1q6DGuN3.js +1 -0
- package/web/dist/assets/aurora-x-CDeNXAV0.js +1 -0
- package/web/dist/assets/awk-BWXHIvNe.js +1 -0
- package/web/dist/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/web/dist/assets/ayu-light-C3h-C4tm.js +1 -0
- package/web/dist/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/web/dist/assets/ballerina-B7ZEbQpA.js +1 -0
- package/web/dist/assets/bat-qdxAdBWQ.js +1 -0
- package/web/dist/assets/beancount-C2IN4Vk8.js +1 -0
- package/web/dist/assets/berry-DKpUyyne.js +1 -0
- package/web/dist/assets/bibtex-Ci_nEsc7.js +1 -0
- package/web/dist/assets/bicep-CUHmPFLl.js +1 -0
- package/web/dist/assets/bird2-CYIUgYqB.js +1 -0
- package/web/dist/assets/blade-Cqdv4oZN.js +1 -0
- package/web/dist/assets/bsl-CVED6lJ1.js +1 -0
- package/web/dist/assets/c-D9gIxSfx.js +1 -0
- package/web/dist/assets/c3-D0apG41V.js +1 -0
- package/web/dist/assets/cadence-CQ2zXKGN.js +1 -0
- package/web/dist/assets/cairo-DRAZz75c.js +1 -0
- package/web/dist/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/web/dist/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/web/dist/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/web/dist/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/web/dist/assets/chapel-CuseGurG.js +1 -0
- package/web/dist/assets/clarity-CtfBBspg.js +1 -0
- package/web/dist/assets/clojure-DqKBuwfJ.js +1 -0
- package/web/dist/assets/cmake-Bj61d0ZC.js +1 -0
- package/web/dist/assets/cobol-Bdpj3Qoh.js +1 -0
- package/web/dist/assets/codeowners-C8r90Shi.js +1 -0
- package/web/dist/assets/codeql-oeQT6MSM.js +1 -0
- package/web/dist/assets/coffee-Sk8pHFjs.js +1 -0
- package/web/dist/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/web/dist/assets/coq-CGaSfhwR.js +1 -0
- package/web/dist/assets/core-BxI4V4-T.js +12 -0
- package/web/dist/assets/cpp-BQfBYKx3.js +1 -0
- package/web/dist/assets/crystal-B3j7DoOZ.js +1 -0
- package/web/dist/assets/csharp-dmMxLVLW.js +1 -0
- package/web/dist/assets/css-DpFbYmRh.js +1 -0
- package/web/dist/assets/csv-Dx-8-gkx.js +1 -0
- package/web/dist/assets/cue-CE9AQfxI.js +1 -0
- package/web/dist/assets/cypher-ClKdZ_lG.js +1 -0
- package/web/dist/assets/d-qD-0Kul2.js +1 -0
- package/web/dist/assets/dark-plus-Cs2F2srj.js +1 -0
- package/web/dist/assets/dart-CHZY9Xhz.js +1 -0
- package/web/dist/assets/dax-BkyTk9wS.js +1 -0
- package/web/dist/assets/desktop-Dlh5hvp9.js +1 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/docker-IyjqRm3v.js +1 -0
- package/web/dist/assets/dotenv-CuH5my32.js +1 -0
- package/web/dist/assets/dracula-BHWKrbxM.js +1 -0
- package/web/dist/assets/dracula-soft-5eyTD99u.js +1 -0
- package/web/dist/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/web/dist/assets/edge-DXQWmXTB.js +1 -0
- package/web/dist/assets/elixir-CrDIY2Vo.js +1 -0
- package/web/dist/assets/elm-BslFEg8K.js +1 -0
- package/web/dist/assets/emacs-lisp-DR2vtWaj.js +1 -0
- package/web/dist/assets/engine-javascript-DJg3-Vu2.js +141 -0
- package/web/dist/assets/erb-CUYhg0Ws.js +1 -0
- package/web/dist/assets/erlang-BXdgHVfi.js +1 -0
- package/web/dist/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/web/dist/assets/everforest-light-Df2xbC6M.js +1 -0
- package/web/dist/assets/fennel-DQxkIbk2.js +1 -0
- package/web/dist/assets/fish-BJitypiv.js +1 -0
- package/web/dist/assets/fluent-C03EYrpw.js +1 -0
- package/web/dist/assets/format-DrBC7w0A.js +1 -0
- package/web/dist/assets/fortran-fixed-form-D6mN0kjy.js +1 -0
- package/web/dist/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/web/dist/assets/fsharp-CwoEF39o.js +1 -0
- package/web/dist/assets/gdresource-CZkFGo3B.js +1 -0
- package/web/dist/assets/gdscript-DYvRD3hg.js +1 -0
- package/web/dist/assets/gdshader-CBce3t8t.js +1 -0
- package/web/dist/assets/genie-CV2tkWYe.js +1 -0
- package/web/dist/assets/gherkin-DExj1W_8.js +1 -0
- package/web/dist/assets/git-commit-dUGrvm6Q.js +1 -0
- package/web/dist/assets/git-rebase-4zCRqF28.js +1 -0
- package/web/dist/assets/github-dark-C-LZuMrd.js +1 -0
- package/web/dist/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/web/dist/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/web/dist/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/web/dist/assets/github-light-EUqPIrTm.js +1 -0
- package/web/dist/assets/github-light-default-BXViO-2h.js +1 -0
- package/web/dist/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/web/dist/assets/gleam-CSRkHgEL.js +1 -0
- package/web/dist/assets/glimmer-js-7adTRvH4.js +1 -0
- package/web/dist/assets/glimmer-ts-IdSskDYw.js +1 -0
- package/web/dist/assets/glsl-Qzy53KDt.js +1 -0
- package/web/dist/assets/gn-CAXYAgV-.js +1 -0
- package/web/dist/assets/gnuplot-7GGW24-e.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/graphql-CV_puxbB.js +1 -0
- package/web/dist/assets/groovy-CacY0gHj.js +1 -0
- package/web/dist/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/web/dist/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/web/dist/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/web/dist/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/web/dist/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/web/dist/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/web/dist/assets/hack-C5GPjiLV.js +1 -0
- package/web/dist/assets/haml-BQ5YR1DQ.js +1 -0
- package/web/dist/assets/handlebars-DnhRK9A1.js +1 -0
- package/web/dist/assets/haskell-D8IpX4py.js +1 -0
- package/web/dist/assets/haxe-C8oCnwJJ.js +1 -0
- package/web/dist/assets/hcl-Dh228itO.js +1 -0
- package/web/dist/assets/highlight.worker-CY-ZeDAl.js +1 -0
- package/web/dist/assets/hjson-CxZEssPk.js +1 -0
- package/web/dist/assets/hlsl-Cvrh5tZx.js +1 -0
- package/web/dist/assets/horizon-CE9ld1lL.js +1 -0
- package/web/dist/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/web/dist/assets/houston-CsvMBhTu.js +1 -0
- package/web/dist/assets/html-CmHiEKV9.js +1 -0
- package/web/dist/assets/html-derivative-BXE-rYIK.js +1 -0
- package/web/dist/assets/http-DPjjqtcL.js +1 -0
- package/web/dist/assets/hurl-AMBpSloO.js +1 -0
- package/web/dist/assets/hxml-D7Y24wKF.js +1 -0
- package/web/dist/assets/hy-CZbG8q4J.js +1 -0
- package/web/dist/assets/imba-DsUTQ-LC.js +1 -0
- package/web/dist/assets/index-DNPnl4sh.css +2 -0
- package/web/dist/assets/index-DQh72lEx.js +14 -0
- package/web/dist/assets/ini-B5eOa1yu.js +1 -0
- package/web/dist/assets/java-CEM7Tdw_.js +1 -0
- package/web/dist/assets/javascript-CU3PLowd.js +1 -0
- package/web/dist/assets/jinja-fR0x_9Xy.js +1 -0
- package/web/dist/assets/jison-BoKsxs5M.js +1 -0
- package/web/dist/assets/json-BM2FWsRB.js +1 -0
- package/web/dist/assets/json5-BR5RXkoi.js +1 -0
- package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/dist/assets/jsonl-CmCQp5Yx.js +1 -0
- package/web/dist/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/web/dist/assets/jssm-DXw9l8Rf.js +1 -0
- package/web/dist/assets/jsx-B5fTecQP.js +1 -0
- package/web/dist/assets/julia-DGyDG39_.js +1 -0
- package/web/dist/assets/just-B-RyLcSR.js +1 -0
- package/web/dist/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/web/dist/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/web/dist/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/web/dist/assets/kdl-CsD5j6eV.js +1 -0
- package/web/dist/assets/kotlin-DhhofPvG.js +1 -0
- package/web/dist/assets/kusto-C7mF5XQf.js +1 -0
- package/web/dist/assets/langs-CciPKqaF.js +1 -0
- package/web/dist/assets/laserwave-C_8bwKvT.js +1 -0
- package/web/dist/assets/latex-CV1pQelm.js +1 -0
- package/web/dist/assets/lean-CewbzKMR.js +1 -0
- package/web/dist/assets/less-DVTAwKKz.js +1 -0
- package/web/dist/assets/lib-DlcVMUqT.js +1 -0
- package/web/dist/assets/light-plus-DVQuIRkW.js +1 -0
- package/web/dist/assets/liquid-9p05RSzQ.js +1 -0
- package/web/dist/assets/llvm-DqHOMS-s.js +1 -0
- package/web/dist/assets/log-BNLmms1o.js +1 -0
- package/web/dist/assets/logo-Cluzi2Zq.js +1 -0
- package/web/dist/assets/lua-CIPVh0S-.js +1 -0
- package/web/dist/assets/luau-VGWVLoqX.js +1 -0
- package/web/dist/assets/make-Dixweg8N.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/marko-h2h6YUMS.js +1 -0
- package/web/dist/assets/material-theme-Bm3Qr25_.js +1 -0
- package/web/dist/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/web/dist/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/web/dist/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/web/dist/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/web/dist/assets/matlab-D7qyCx1q.js +1 -0
- package/web/dist/assets/mdc-yAyZMdoC.js +1 -0
- package/web/dist/assets/mdx-DQZ5AkYe.js +1 -0
- package/web/dist/assets/mermaid-BxpfTIzt.js +1 -0
- package/web/dist/assets/message-font-size-DoaZfwkT.js +1 -0
- package/web/dist/assets/min-dark-BSWPekZh.js +1 -0
- package/web/dist/assets/min-light-DDpmG2fV.js +1 -0
- package/web/dist/assets/mipsasm-BMqwQI7S.js +1 -0
- package/web/dist/assets/mojo-fg40_ntQ.js +1 -0
- package/web/dist/assets/monokai-BscAjiQZ.js +1 -0
- package/web/dist/assets/moonbit-D9W784E_.js +1 -0
- package/web/dist/assets/move-BYnGhZoM.js +1 -0
- package/web/dist/assets/narrat-_X_XdTYD.js +1 -0
- package/web/dist/assets/nextflow-BoTnSBQ_.js +1 -0
- package/web/dist/assets/nextflow-groovy-D7IRt6Pp.js +1 -0
- package/web/dist/assets/nginx-jWINucNT.js +1 -0
- package/web/dist/assets/night-owl-DhmEMT88.js +1 -0
- package/web/dist/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/web/dist/assets/nim-Dtt9DZ0t.js +1 -0
- package/web/dist/assets/nix-Cl_7024t.js +1 -0
- package/web/dist/assets/nord-Cb4Vim4T.js +1 -0
- package/web/dist/assets/nsis-CjNLYCLg.js +1 -0
- package/web/dist/assets/nushell--0fT3PI1.js +1 -0
- package/web/dist/assets/objective-c-D1A_Heim.js +1 -0
- package/web/dist/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/web/dist/assets/ocaml-O90oeIOV.js +1 -0
- package/web/dist/assets/odin-B1RWQWA5.js +1 -0
- package/web/dist/assets/one-dark-pro-C6YyR8OD.js +1 -0
- package/web/dist/assets/one-light-D7Lr4KcI.js +1 -0
- package/web/dist/assets/openscad-BUDT5pXO.js +1 -0
- package/web/dist/assets/org-ClD5huOa.js +1 -0
- package/web/dist/assets/pascal-4ZHwLPI5.js +1 -0
- package/web/dist/assets/perl-BFegxyeJ.js +1 -0
- package/web/dist/assets/php-B-qOA3Y4.js +1 -0
- package/web/dist/assets/pkl-ot-7Btpt.js +1 -0
- package/web/dist/assets/plastic-DQwYfKfQ.js +1 -0
- package/web/dist/assets/plsql-DGHpHOYJ.js +1 -0
- package/web/dist/assets/po-BiJDBrnU.js +1 -0
- package/web/dist/assets/poimandres-DRFjx7u4.js +1 -0
- package/web/dist/assets/polar-C7UOKdEL.js +1 -0
- package/web/dist/assets/postcss-BXeXVLqQ.js +1 -0
- package/web/dist/assets/powerquery-DNMTfnFr.js +1 -0
- package/web/dist/assets/powershell-QtSnmXcu.js +1 -0
- package/web/dist/assets/prisma-DMgNhnYS.js +1 -0
- package/web/dist/assets/prolog-iXnhIJG7.js +1 -0
- package/web/dist/assets/proto-DB4EqR-F.js +1 -0
- package/web/dist/assets/pug-Cq0NBPu-.js +1 -0
- package/web/dist/assets/puppet-CDv2pdJW.js +1 -0
- package/web/dist/assets/purescript-9MfHhQsQ.js +1 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/qml-CYUsa87k.js +1 -0
- package/web/dist/assets/qmldir-DCQb3MpD.js +1 -0
- package/web/dist/assets/qss-Fe1Jh2GI.js +1 -0
- package/web/dist/assets/r-4xJhgbOf.js +1 -0
- package/web/dist/assets/racket-DcIDlBhZ.js +1 -0
- package/web/dist/assets/raku-B3gFvitq.js +1 -0
- package/web/dist/assets/razor-BlHaOHx8.js +1 -0
- package/web/dist/assets/rbs-C0MpOrj4.js +1 -0
- package/web/dist/assets/react-B4UGpcWC.js +1 -0
- package/web/dist/assets/red-CYlAq2b0.js +1 -0
- package/web/dist/assets/reg-CRGYupPL.js +1 -0
- package/web/dist/assets/regexp-BUSxjv2o.js +1 -0
- package/web/dist/assets/rel-BtDbiS_P.js +1 -0
- package/web/dist/assets/riscv-Ckw8ddFX.js +1 -0
- package/web/dist/assets/ron-VUp2lXgN.js +1 -0
- package/web/dist/assets/rose-pine-aMsaMD1D.js +1 -0
- package/web/dist/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/web/dist/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/web/dist/assets/rosmsg-CAekHB0j.js +1 -0
- package/web/dist/assets/rst-zjfguEh7.js +1 -0
- package/web/dist/assets/ruby-4oR9waBK.js +1 -0
- package/web/dist/assets/rust-DpiIf5JO.js +1 -0
- package/web/dist/assets/sas-Do4V_2i9.js +1 -0
- package/web/dist/assets/sass-DXrisJhu.js +1 -0
- package/web/dist/assets/scala-BiFt_7mu.js +1 -0
- package/web/dist/assets/scheme-DQCgrYNe.js +1 -0
- package/web/dist/assets/scss-CW6JPtag.js +1 -0
- package/web/dist/assets/sdbl-bTVj8UrX.js +1 -0
- package/web/dist/assets/shaderlab-C4rnI7x0.js +1 -0
- package/web/dist/assets/shellscript-zBmOMFJh.js +1 -0
- package/web/dist/assets/shellsession-DxGUTWaf.js +1 -0
- package/web/dist/assets/slack-dark-DnToyrRv.js +1 -0
- package/web/dist/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/web/dist/assets/smalltalk-BHpQb5nM.js +1 -0
- package/web/dist/assets/smithy-Dgaz7aur.js +1 -0
- package/web/dist/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/web/dist/assets/solarized-dark-b97czJOk.js +1 -0
- package/web/dist/assets/solarized-light-DFPxpIYQ.js +1 -0
- package/web/dist/assets/solidity-Bj7E1mRn.js +1 -0
- package/web/dist/assets/soy-DVtw20Yn.js +1 -0
- package/web/dist/assets/sparql-C0ia5K60.js +1 -0
- package/web/dist/assets/splunk-BC2Px7Mm.js +1 -0
- package/web/dist/assets/sql-DGCM-jag.js +1 -0
- package/web/dist/assets/ssh-config-BgfXC-Er.js +1 -0
- package/web/dist/assets/stata-DfuMOXna.js +1 -0
- package/web/dist/assets/stylus-B6D30XZt.js +1 -0
- package/web/dist/assets/surrealql-CBoRWxfR.js +1 -0
- package/web/dist/assets/svelte-g_uCUem5.js +1 -0
- package/web/dist/assets/swift-CyEgAFGc.js +1 -0
- package/web/dist/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/web/dist/assets/system-verilog-Dh5ihWbf.js +1 -0
- package/web/dist/assets/systemd-BxMlprV5.js +1 -0
- package/web/dist/assets/talonscript-CohzipZa.js +1 -0
- package/web/dist/assets/tasl-DMoTqEGO.js +1 -0
- package/web/dist/assets/tcl-CZd0xW_V.js +1 -0
- package/web/dist/assets/templ-N5C1hJ4Y.js +1 -0
- package/web/dist/assets/terraform-DswuEJGm.js +1 -0
- package/web/dist/assets/tex-mx6xDwuK.js +1 -0
- package/web/dist/assets/themes-CNElGaXw.js +1 -0
- package/web/dist/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/web/dist/assets/toml-CcmNWLt0.js +1 -0
- package/web/dist/assets/ts-tags-C-j71FRb.js +1 -0
- package/web/dist/assets/tsv-sltzmVWM.js +1 -0
- package/web/dist/assets/tsx-z04y7qR9.js +1 -0
- package/web/dist/assets/turtle-ByJddavk.js +1 -0
- package/web/dist/assets/twig-Bz57G_nl.js +1 -0
- package/web/dist/assets/typescript-RMqVTmzR.js +1 -0
- package/web/dist/assets/typespec-BGhR2SqG.js +1 -0
- package/web/dist/assets/typst-BgkqA2Pg.js +1 -0
- package/web/dist/assets/v-DBj4K9d_.js +1 -0
- package/web/dist/assets/vala-zf12oZj6.js +1 -0
- package/web/dist/assets/vb-DOwzaHZ0.js +1 -0
- package/web/dist/assets/verilog-B2gwz-sJ.js +1 -0
- package/web/dist/assets/vesper-DdrHHSXu.js +1 -0
- package/web/dist/assets/vhdl-BroJfC0k.js +1 -0
- package/web/dist/assets/viml-DvXPmvsu.js +1 -0
- package/web/dist/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/web/dist/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/web/dist/assets/vitesse-light-VbXTXTou.js +1 -0
- package/web/dist/assets/vue-CQgvQytb.js +1 -0
- package/web/dist/assets/vue-html-Dhl6fh9l.js +1 -0
- package/web/dist/assets/vue-vine-Dw_uU59K.js +1 -0
- package/web/dist/assets/vyper-CgoNMtux.js +1 -0
- package/web/dist/assets/wasm-ByWQv1Qj.js +1 -0
- package/web/dist/assets/wenyan-C8pVoKbM.js +1 -0
- package/web/dist/assets/wgsl-BsKzXJz4.js +1 -0
- package/web/dist/assets/wikitext-ClFFjSW2.js +1 -0
- package/web/dist/assets/wit-DdvCle-K.js +1 -0
- package/web/dist/assets/wolfram-DLL8P-h_.js +1 -0
- package/web/dist/assets/xml-B49klYQ3.js +1 -0
- package/web/dist/assets/xsl-D7tnD3qq.js +1 -0
- package/web/dist/assets/yaml-DNQ5_xkL.js +1 -0
- package/web/dist/assets/zenscript-BnlCZFoB.js +1 -0
- package/web/dist/assets/zig-CMLA9XwU.js +1 -0
- package/web/dist/icons/apple-touch-icon.png +0 -0
- package/web/dist/icons/badge-96.png +0 -0
- package/web/dist/icons/icon-192.png +0 -0
- package/web/dist/icons/icon-512.png +0 -0
- package/web/dist/icons/icon.svg +4 -0
- package/web/dist/icons/maskable-192.png +0 -0
- package/web/dist/icons/maskable-512.png +0 -0
- package/web/dist/index.html +30 -0
- package/web/dist/manifest.webmanifest +20 -0
- package/web/dist/sw.js +176 -0
- package/web/dist/version.json +1 -0
- package/web/src/App.tsx +97 -0
- package/web/src/agent-history-flow.test.ts +191 -0
- package/web/src/agent-history-flow.ts +58 -0
- package/web/src/agent-owners.ts +30 -0
- package/web/src/annotation-selection.test.ts +36 -0
- package/web/src/annotation-selection.ts +123 -0
- package/web/src/annotations.test.ts +279 -0
- package/web/src/annotations.ts +191 -0
- package/web/src/api.ts +27 -0
- package/web/src/auth-events.ts +11 -0
- package/web/src/auth-lifecycle.test.ts +105 -0
- package/web/src/clipboard.ts +32 -0
- package/web/src/components/ActivityNotifier.tsx +22 -0
- package/web/src/components/AnnotationEditor.tsx +135 -0
- package/web/src/components/AnnotationSelection.tsx +122 -0
- package/web/src/components/Automation.tsx +390 -0
- package/web/src/components/CodeView.tsx +121 -0
- package/web/src/components/Composer.tsx +552 -0
- package/web/src/components/ComposerAnnotations.tsx +45 -0
- package/web/src/components/Confirmation.tsx +91 -0
- package/web/src/components/CopyButton.tsx +23 -0
- package/web/src/components/DiffView.tsx +94 -0
- package/web/src/components/DirectoryPicker.tsx +230 -0
- package/web/src/components/FileCopyMenu.tsx +58 -0
- package/web/src/components/FileEntryActions.tsx +95 -0
- package/web/src/components/ImagePreview.tsx +68 -0
- package/web/src/components/Items.tsx +608 -0
- package/web/src/components/Markdown.tsx +73 -0
- package/web/src/components/MessageList.tsx +458 -0
- package/web/src/components/Modal.tsx +72 -0
- package/web/src/components/NotificationEntry.tsx +31 -0
- package/web/src/components/NotificationSettings.tsx +226 -0
- package/web/src/components/NotificationToasts.tsx +59 -0
- package/web/src/components/OpenTabs.tsx +112 -0
- package/web/src/components/Pending.tsx +175 -0
- package/web/src/components/ProjectExtras.tsx +299 -0
- package/web/src/components/ProjectNav.tsx +47 -0
- package/web/src/components/SessionActions.tsx +271 -0
- package/web/src/components/SessionChannels.tsx +288 -0
- package/web/src/components/SessionExtras.tsx +263 -0
- package/web/src/components/SettingsLink.tsx +21 -0
- package/web/src/components/Shell.tsx +320 -0
- package/web/src/components/SvgPreview.tsx +18 -0
- package/web/src/components/TodoPanel.tsx +37 -0
- package/web/src/components/VersionNotice.tsx +40 -0
- package/web/src/components/icons.tsx +43 -0
- package/web/src/diff.ts +62 -0
- package/web/src/drafts.test.ts +80 -0
- package/web/src/drafts.ts +64 -0
- package/web/src/format.ts +5 -0
- package/web/src/highlight.worker.ts +49 -0
- package/web/src/hooks.ts +59 -0
- package/web/src/item-view-state.test.ts +51 -0
- package/web/src/item-view-state.ts +43 -0
- package/web/src/live-history-flow.test.ts +77 -0
- package/web/src/live-merge.test.ts +64 -0
- package/web/src/live-merge.ts +50 -0
- package/web/src/live-message-hydration.test.ts +253 -0
- package/web/src/live.ts +404 -0
- package/web/src/main.tsx +27 -0
- package/web/src/markdown-assets.test.ts +70 -0
- package/web/src/markdown-assets.ts +78 -0
- package/web/src/markdown-html.test.ts +84 -0
- package/web/src/markdown-html.ts +60 -0
- package/web/src/markdown-svg.test.ts +37 -0
- package/web/src/markdown-svg.ts +42 -0
- package/web/src/markdown-tables.test.ts +34 -0
- package/web/src/markdown-tables.ts +17 -0
- package/web/src/message-bodies.ts +117 -0
- package/web/src/message-cache.test.ts +208 -0
- package/web/src/message-cache.ts +158 -0
- package/web/src/message-font-size.test.ts +41 -0
- package/web/src/message-font-size.ts +57 -0
- package/web/src/message-time.test.ts +32 -0
- package/web/src/message-time.ts +26 -0
- package/web/src/notify.ts +132 -0
- package/web/src/open-tabs.test.ts +69 -0
- package/web/src/open-tabs.ts +110 -0
- package/web/src/pages/AgentView.tsx +138 -0
- package/web/src/pages/ChangesView.tsx +193 -0
- package/web/src/pages/FilesView.tsx +406 -0
- package/web/src/pages/HomePage.tsx +96 -0
- package/web/src/pages/LoginPage.tsx +56 -0
- package/web/src/pages/OverviewPage.tsx +124 -0
- package/web/src/pages/ProjectHome.tsx +136 -0
- package/web/src/pages/SessionView.tsx +238 -0
- package/web/src/pages/WorktreesView.tsx +197 -0
- package/web/src/pages/settings/AccountPage.tsx +149 -0
- package/web/src/pages/settings/AgentsPage.tsx +182 -0
- package/web/src/pages/settings/ConfigPage.tsx +181 -0
- package/web/src/pages/settings/GeneralPage.tsx +27 -0
- package/web/src/pages/settings/HooksPage.tsx +244 -0
- package/web/src/pages/settings/McpPage.tsx +310 -0
- package/web/src/pages/settings/MemoryPage.tsx +309 -0
- package/web/src/pages/settings/PermissionsPage.tsx +160 -0
- package/web/src/pages/settings/PluginsPage.tsx +251 -0
- package/web/src/pages/settings/SettingsPage.tsx +141 -0
- package/web/src/pages/settings/SkillsPage.tsx +142 -0
- package/web/src/pages/settings/ui.tsx +165 -0
- package/web/src/preference-document.ts +133 -0
- package/web/src/project-actions.ts +18 -0
- package/web/src/project-files-state.test.ts +49 -0
- package/web/src/project-files-state.ts +64 -0
- package/web/src/project-images.ts +13 -0
- package/web/src/pwa.ts +33 -0
- package/web/src/queryClient.ts +5 -0
- package/web/src/reasoning-preference.test.ts +39 -0
- package/web/src/reasoning-preference.ts +42 -0
- package/web/src/session-confirmations.ts +36 -0
- package/web/src/stream-replay.test.ts +163 -0
- package/web/src/styles.css +231 -0
- package/web/src/tool-result-body.test.ts +115 -0
- package/web/src/transcript.test.ts +186 -0
- package/web/src/transcript.ts +583 -0
- package/web/src/turns.test.ts +338 -0
- package/web/src/turns.ts +178 -0
- package/web/src/ui/Button.tsx +60 -0
- package/web/src/ui/Controls.tsx +227 -0
- package/web/src/ui/Form.tsx +203 -0
- package/web/src/ui/MenuPopover.tsx +144 -0
- package/web/src/ui/Popover.tsx +147 -0
- package/web/src/ui/ResizablePane.tsx +110 -0
- package/web/src/ui/Select.tsx +150 -0
- package/web/src/ui/icons.tsx +270 -0
- package/web/src/unsaved.tsx +99 -0
- package/web/src/user-text.test.ts +60 -0
- package/web/src/user-text.ts +35 -0
- package/web/src/uuid.ts +12 -0
- package/README.md +0 -3
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { api, ApiError } from "../api.ts";
|
|
3
|
+
import { currentPushSubscription, pushAvailable, registerServiceWorker } from "../pwa.ts";
|
|
4
|
+
import { Button } from "../ui/Button.tsx";
|
|
5
|
+
import { ConfirmButton, SwitchRow, Tag } from "../ui/Form.tsx";
|
|
6
|
+
import { AlertIcon, BellIcon, CheckIcon } from "../ui/icons.tsx";
|
|
7
|
+
import { getNotifyKinds, NOTIFY_KIND_LABELS, notifyInPage, setNotifyKinds, type NotifyKind, type NotifyKinds } from "../notify.ts";
|
|
8
|
+
|
|
9
|
+
type Device = { id: string; device: string; userAgent: string; createdAt: number; lastSuccessAt: number | null; kinds: NotifyKinds };
|
|
10
|
+
type Settings = ({ subscribed: true } & Device) | { subscribed: false };
|
|
11
|
+
|
|
12
|
+
function keyBytes(base64url: string): Uint8Array<ArrayBuffer> {
|
|
13
|
+
const b64 = (base64url + "=".repeat((4 - (base64url.length % 4)) % 4)).replace(/-/g, "+").replace(/_/g, "/");
|
|
14
|
+
const raw = atob(b64);
|
|
15
|
+
const out = new Uint8Array(new ArrayBuffer(raw.length));
|
|
16
|
+
for (let i = 0; i < raw.length; i++) out[i] = raw.charCodeAt(i);
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function sameKey(a: ArrayBuffer | null | undefined, b: Uint8Array): boolean {
|
|
21
|
+
if (!a) return false;
|
|
22
|
+
const x = new Uint8Array(a);
|
|
23
|
+
return x.length === b.length && x.every((v, i) => v === b[i]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const errText = (e: unknown) => (e instanceof ApiError || e instanceof Error ? e.message : String(e));
|
|
27
|
+
|
|
28
|
+
type Env = "insecure" | "unsupported" | "ok";
|
|
29
|
+
function environment(): Env {
|
|
30
|
+
if (!window.isSecureContext) return "insecure";
|
|
31
|
+
return pushAvailable() ? "ok" : "unsupported";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const isIOS = () => /iPhone|iPad|iPod/.test(navigator.userAgent) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
35
|
+
|
|
36
|
+
/** Notification preferences of this device: Web Push subscription, per-kind switches, test, other devices. */
|
|
37
|
+
export function NotificationSettings() {
|
|
38
|
+
const env = environment();
|
|
39
|
+
const [kinds, setKinds] = useState<NotifyKinds>(getNotifyKinds);
|
|
40
|
+
const [sub, setSub] = useState<PushSubscription | null>(null);
|
|
41
|
+
const [permission, setPermission] = useState<NotificationPermission | "unavailable">(() => ("Notification" in window ? Notification.permission : "unavailable"));
|
|
42
|
+
const [busy, setBusy] = useState(false);
|
|
43
|
+
const [message, setMessage] = useState<{ ok: boolean; text: string } | null>(null);
|
|
44
|
+
const [devices, setDevices] = useState<Device[]>([]);
|
|
45
|
+
const [currentId, setCurrentId] = useState<string | null>(null);
|
|
46
|
+
|
|
47
|
+
const refresh = useCallback(async () => {
|
|
48
|
+
const s = env === "ok" ? await currentPushSubscription() : null;
|
|
49
|
+
// The server may have dropped it (expired, data dir wiped): then this device is not subscribed.
|
|
50
|
+
const st = s ? await api<Settings>(`/api/push/settings?endpoint=${encodeURIComponent(s.endpoint)}`).catch(() => null) : null;
|
|
51
|
+
if (st?.subscribed) {
|
|
52
|
+
setKinds(st.kinds);
|
|
53
|
+
setNotifyKinds(st.kinds);
|
|
54
|
+
}
|
|
55
|
+
setSub(st?.subscribed ? s : null);
|
|
56
|
+
setCurrentId(st?.subscribed ? st.id : null);
|
|
57
|
+
setDevices(await api<Device[]>("/api/push/subscriptions").catch(() => []));
|
|
58
|
+
}, [env]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
void refresh();
|
|
62
|
+
}, [refresh]);
|
|
63
|
+
|
|
64
|
+
async function enable() {
|
|
65
|
+
setBusy(true);
|
|
66
|
+
setMessage(null);
|
|
67
|
+
try {
|
|
68
|
+
// iOS only shows the permission prompt when requested directly from the tap.
|
|
69
|
+
const perm = await Notification.requestPermission();
|
|
70
|
+
setPermission(perm);
|
|
71
|
+
if (perm !== "granted") throw new Error(perm === "denied" ? "通知权限被拒绝,请在浏览器或系统设置里允许本站通知" : "没有获得通知权限");
|
|
72
|
+
const reg = await registerServiceWorker();
|
|
73
|
+
if (!reg) throw new Error("Service Worker 未注册成功");
|
|
74
|
+
await navigator.serviceWorker.ready;
|
|
75
|
+
const { publicKey } = await api<{ publicKey: string }>("/api/push/key");
|
|
76
|
+
const key = keyBytes(publicKey);
|
|
77
|
+
let s = await reg.pushManager.getSubscription();
|
|
78
|
+
if (s && !sameKey(s.options.applicationServerKey, key)) {
|
|
79
|
+
await s.unsubscribe();
|
|
80
|
+
s = null;
|
|
81
|
+
}
|
|
82
|
+
s ??= await reg.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: key });
|
|
83
|
+
await api("/api/push/subscribe", { method: "POST", json: { subscription: s.toJSON(), kinds } });
|
|
84
|
+
setMessage({ ok: true, text: "已在此设备开启推送" });
|
|
85
|
+
await refresh();
|
|
86
|
+
} catch (e) {
|
|
87
|
+
setMessage({ ok: false, text: `开启失败:${errText(e)}` });
|
|
88
|
+
} finally {
|
|
89
|
+
setBusy(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function disable() {
|
|
94
|
+
setBusy(true);
|
|
95
|
+
setMessage(null);
|
|
96
|
+
try {
|
|
97
|
+
if (sub) {
|
|
98
|
+
await api("/api/push/subscribe", { method: "DELETE", json: { endpoint: sub.endpoint } });
|
|
99
|
+
await sub.unsubscribe().catch(() => {});
|
|
100
|
+
}
|
|
101
|
+
setMessage({ ok: true, text: "已关闭此设备的推送" });
|
|
102
|
+
await refresh();
|
|
103
|
+
} catch (e) {
|
|
104
|
+
setMessage({ ok: false, text: errText(e) });
|
|
105
|
+
} finally {
|
|
106
|
+
setBusy(false);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function toggleKind(k: NotifyKind, on: boolean) {
|
|
111
|
+
const next = { ...kinds, [k]: on };
|
|
112
|
+
setKinds(next);
|
|
113
|
+
setNotifyKinds(next);
|
|
114
|
+
if (sub) await api("/api/push/settings", { method: "PATCH", json: { endpoint: sub.endpoint, kinds: { [k]: on } } }).catch((e) => setMessage({ ok: false, text: errText(e) }));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function test() {
|
|
118
|
+
setBusy(true);
|
|
119
|
+
setMessage(null);
|
|
120
|
+
try {
|
|
121
|
+
if (sub) {
|
|
122
|
+
await api("/api/push/test", { method: "POST", json: { endpoint: sub.endpoint } });
|
|
123
|
+
setMessage({ ok: true, text: "测试通知已发出,几秒内应在系统通知里出现" });
|
|
124
|
+
} else {
|
|
125
|
+
await notifyInPage({ kind: "done", title: "测试通知", body: "页面打开时,提醒会这样出现。", tag: "test" }, { force: true });
|
|
126
|
+
setMessage({ ok: true, text: "已显示页面内提醒" });
|
|
127
|
+
}
|
|
128
|
+
} catch (e) {
|
|
129
|
+
setMessage({ ok: false, text: errText(e) });
|
|
130
|
+
if (e instanceof ApiError && e.status === 410) await refresh();
|
|
131
|
+
} finally {
|
|
132
|
+
setBusy(false);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function removeDevice(id: string) {
|
|
137
|
+
await api("/api/push/subscribe", { method: "DELETE", json: { id } }).catch(() => {});
|
|
138
|
+
await refresh();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="space-y-5 text-sm" data-testid="notification-settings">
|
|
143
|
+
<section className="space-y-2">
|
|
144
|
+
<h3 className="text-base">此设备的推送</h3>
|
|
145
|
+
<p className="text-xs leading-relaxed text-muted">会话完成、需要你回答问题或审批计划、出错时提醒你。页面打开时在页面内提醒;开启推送后,关掉页面也能在系统通知里收到。</p>
|
|
146
|
+
{env === "insecure" && (
|
|
147
|
+
<p className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 p-3 leading-relaxed" data-testid="push-insecure">
|
|
148
|
+
<AlertIcon className="mt-0.5 shrink-0 text-muted" />
|
|
149
|
+
当前通过 http 访问,浏览器不允许推送。需要 https(例如 Tailscale serve)才能在手机上收推送。页面打开时仍会在页面内提醒。
|
|
150
|
+
</p>
|
|
151
|
+
)}
|
|
152
|
+
{env === "unsupported" && (
|
|
153
|
+
<p className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 p-3 leading-relaxed">
|
|
154
|
+
<AlertIcon className="mt-0.5 shrink-0 text-muted" />
|
|
155
|
+
{isIOS() ? "iPhone / iPad 上需要先在 Safari 里「添加到主屏幕」,再从主屏图标打开,才能开启推送(iOS 16.4 及以上)。" : "这个浏览器不支持 Web Push。页面打开时仍会在页面内提醒。"}
|
|
156
|
+
</p>
|
|
157
|
+
)}
|
|
158
|
+
{env === "ok" && (
|
|
159
|
+
<div className="flex flex-wrap items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2.5">
|
|
160
|
+
<BellIcon className={sub ? "text-accent" : "text-muted"} />
|
|
161
|
+
<span className="min-w-0 flex-1">
|
|
162
|
+
<span className={sub ? "font-medium text-ok" : "text-muted"} data-testid="push-status">
|
|
163
|
+
{sub ? "已开启" : permission === "denied" ? "通知权限被拒绝" : "未开启"}
|
|
164
|
+
</span>
|
|
165
|
+
</span>
|
|
166
|
+
{sub ? (
|
|
167
|
+
<Button loading={busy} onClick={disable}>
|
|
168
|
+
关闭推送
|
|
169
|
+
</Button>
|
|
170
|
+
) : (
|
|
171
|
+
<Button variant="primary" loading={busy} onClick={enable}>
|
|
172
|
+
开启推送
|
|
173
|
+
</Button>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
)}
|
|
177
|
+
</section>
|
|
178
|
+
|
|
179
|
+
<section>
|
|
180
|
+
<h3 className="mb-1 text-base">提醒哪些事</h3>
|
|
181
|
+
<div className="divide-y divide-border rounded-lg border border-border bg-surface px-3">
|
|
182
|
+
{(Object.keys(NOTIFY_KIND_LABELS) as NotifyKind[]).map((k) => (
|
|
183
|
+
<SwitchRow key={k} label={NOTIFY_KIND_LABELS[k]} checked={kinds[k]} onChange={(v) => void toggleKind(k, v)} />
|
|
184
|
+
))}
|
|
185
|
+
</div>
|
|
186
|
+
</section>
|
|
187
|
+
|
|
188
|
+
<section className="flex flex-wrap items-center gap-3">
|
|
189
|
+
<Button disabled={busy} onClick={test} icon={<BellIcon size={14} />}>
|
|
190
|
+
发送测试通知
|
|
191
|
+
</Button>
|
|
192
|
+
{message && (
|
|
193
|
+
<p role={message.ok ? "status" : "alert"} className={`flex items-center gap-1.5 ${message.ok ? "text-ok" : "text-danger"}`}>
|
|
194
|
+
{message.ok ? <CheckIcon className="shrink-0" /> : <AlertIcon className="shrink-0" />}
|
|
195
|
+
{message.text}
|
|
196
|
+
</p>
|
|
197
|
+
)}
|
|
198
|
+
</section>
|
|
199
|
+
|
|
200
|
+
{devices.length > 0 && (
|
|
201
|
+
<section>
|
|
202
|
+
<h3 className="mb-1 text-base">已开启推送的设备</h3>
|
|
203
|
+
<ul className="divide-y divide-border rounded-lg border border-border bg-surface">
|
|
204
|
+
{devices.map((d) => (
|
|
205
|
+
<li key={d.id} className="flex flex-wrap items-center gap-2 py-1.5 pl-3 pr-1.5">
|
|
206
|
+
<span className="min-w-0 flex-1">
|
|
207
|
+
<span className="flex min-w-0 items-center gap-1.5">
|
|
208
|
+
<span className="truncate">{d.device}</span>
|
|
209
|
+
{currentId === d.id && <Tag tone="accent">(此设备)</Tag>}
|
|
210
|
+
</span>
|
|
211
|
+
<span className="block text-xs text-muted">
|
|
212
|
+
{new Date(d.createdAt).toLocaleDateString()} 开启
|
|
213
|
+
{d.lastSuccessAt ? ` · 最近送达 ${new Date(d.lastSuccessAt).toLocaleString()}` : " · 还没有送达记录"}
|
|
214
|
+
</span>
|
|
215
|
+
</span>
|
|
216
|
+
<ConfirmButton variant="ghost" confirmText="停止推送到这台设备?" onConfirm={() => void removeDevice(d.id)} label={`移除 ${d.device}`}>
|
|
217
|
+
移除
|
|
218
|
+
</ConfirmButton>
|
|
219
|
+
</li>
|
|
220
|
+
))}
|
|
221
|
+
</ul>
|
|
222
|
+
</section>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useNavigate } from "react-router";
|
|
3
|
+
import { dismissToast, openNoticeUrl, setNotifyNavigator, useToasts, type NotifyKind } from "../notify.ts";
|
|
4
|
+
import { CloseIcon } from "./icons.tsx";
|
|
5
|
+
|
|
6
|
+
const DOT: Record<NotifyKind, string> = { done: "bg-ok", attention: "bg-amber-500", error: "bg-danger" };
|
|
7
|
+
|
|
8
|
+
/** In-page toasts, plus routing of notification clicks (service worker messages) through the router. */
|
|
9
|
+
export function NotificationToasts() {
|
|
10
|
+
const toasts = useToasts((s) => s.toasts);
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setNotifyNavigator((url) => navigate(url));
|
|
15
|
+
const onMessage = (e: MessageEvent) => {
|
|
16
|
+
const d = e.data as { type?: string; url?: string } | undefined;
|
|
17
|
+
if (d?.type === "cide:navigate" && typeof d.url === "string" && d.url.startsWith("/")) navigate(d.url);
|
|
18
|
+
};
|
|
19
|
+
navigator.serviceWorker?.addEventListener("message", onMessage);
|
|
20
|
+
return () => {
|
|
21
|
+
setNotifyNavigator(undefined);
|
|
22
|
+
navigator.serviceWorker?.removeEventListener("message", onMessage);
|
|
23
|
+
};
|
|
24
|
+
}, [navigate]);
|
|
25
|
+
|
|
26
|
+
if (toasts.length === 0) return null;
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className="pointer-events-none fixed inset-x-0 top-[max(0.5rem,env(safe-area-inset-top))] z-50 flex flex-col items-center gap-2 px-3 md:inset-x-auto md:top-auto md:right-4 md:bottom-4 md:items-end"
|
|
30
|
+
aria-live="polite"
|
|
31
|
+
>
|
|
32
|
+
{toasts.map((t) => (
|
|
33
|
+
<div
|
|
34
|
+
key={t.id}
|
|
35
|
+
role="status"
|
|
36
|
+
data-testid="toast"
|
|
37
|
+
data-tag={t.tag}
|
|
38
|
+
data-kind={t.kind}
|
|
39
|
+
className="pointer-events-auto flex w-full max-w-sm items-start gap-2.5 rounded-lg border border-border bg-surface px-3 py-2.5 shadow-lg"
|
|
40
|
+
>
|
|
41
|
+
<span className={`mt-1.5 size-2 shrink-0 rounded-full ${DOT[t.kind]}`} aria-hidden />
|
|
42
|
+
<button
|
|
43
|
+
className="min-w-0 flex-1 text-left"
|
|
44
|
+
onClick={() => {
|
|
45
|
+
dismissToast(t.id);
|
|
46
|
+
openNoticeUrl(t.url);
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<div className="truncate text-sm font-medium">{t.title}</div>
|
|
50
|
+
{t.body && <div className="mt-0.5 line-clamp-2 text-xs text-muted">{t.body}</div>}
|
|
51
|
+
</button>
|
|
52
|
+
<button className="-mr-1 shrink-0 rounded p-1 text-muted hover:bg-surface-2" onClick={() => dismissToast(t.id)} aria-label="关闭提醒">
|
|
53
|
+
<CloseIcon size={14} />
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type PointerEvent } from "react";
|
|
2
|
+
import { Link, useLocation, useMatch, useNavigate } from "react-router";
|
|
3
|
+
import { openTabFromUrl, openTabs, useOpenTabs, type OpenTab } from "../open-tabs.ts";
|
|
4
|
+
import { useSessions } from "../hooks.ts";
|
|
5
|
+
import { Button, cx } from "../ui/Button.tsx";
|
|
6
|
+
import { ChatIcon, FileIcon, GripIcon, XIcon } from "../ui/icons.tsx";
|
|
7
|
+
|
|
8
|
+
const CLOSE_INTENT = "claude-ide:close-tab";
|
|
9
|
+
|
|
10
|
+
/** One tracker outside both sidebars; route commits are the only events that open tabs. */
|
|
11
|
+
export function OpenTabsTracker() {
|
|
12
|
+
const location = useLocation(), navigate = useNavigate();
|
|
13
|
+
const pid = useMatch("/p/:pid/*")?.params.pid;
|
|
14
|
+
const sessions = useSessions(pid);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const state = location.state;
|
|
17
|
+
const close = state?.[CLOSE_INTENT];
|
|
18
|
+
if (close && typeof close.pid === "string" && typeof close.id === "string") {
|
|
19
|
+
openTabs.close(close.pid, close.id);
|
|
20
|
+
const next = { ...state }; delete next[CLOSE_INTENT];
|
|
21
|
+
void navigate(location.pathname + location.search + location.hash, { replace: true, state: next });
|
|
22
|
+
}
|
|
23
|
+
openTabs.open(location.pathname + location.search + location.hash);
|
|
24
|
+
}, [location.pathname, location.search, location.hash, location.state, navigate]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (pid && sessions.data) openTabs.titles(pid, new Map(sessions.data.map((session) => [session.id, session.title || (session.draft ? "新会话" : "未命名会话")])));
|
|
27
|
+
}, [pid, sessions.data, location.pathname]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Drag = { id: string; pointer: number; start: number; y: number; moved: boolean; index: number };
|
|
32
|
+
|
|
33
|
+
export function OpenTabs({ pid, onNavigate }: { pid: string; onNavigate?: () => void }) {
|
|
34
|
+
const tabs = useOpenTabs(pid), location = useLocation(), navigate = useNavigate();
|
|
35
|
+
const current = openTabFromUrl(location.pathname + location.search + location.hash);
|
|
36
|
+
const list = useRef<HTMLElement>(null), drag = useRef<Drag | null>(null);
|
|
37
|
+
const [moving, setMoving] = useState<{ id: string; index: number } | null>(null);
|
|
38
|
+
const finish = (commit = false) => {
|
|
39
|
+
const pending = drag.current;
|
|
40
|
+
drag.current = null; setMoving(null);
|
|
41
|
+
if (commit && pending?.moved) openTabs.move(pid, pending.id, pending.index);
|
|
42
|
+
};
|
|
43
|
+
const update = () => {
|
|
44
|
+
const pending = drag.current;
|
|
45
|
+
if (!pending || !list.current) return;
|
|
46
|
+
const rows = [...list.current.querySelectorAll<HTMLElement>("[data-tab-id]")].filter((row) => row.dataset.tabId !== pending.id);
|
|
47
|
+
const at = rows.findIndex((row) => pending.y < row.getBoundingClientRect().top + row.getBoundingClientRect().height / 2);
|
|
48
|
+
pending.index = at < 0 ? rows.length : at;
|
|
49
|
+
setMoving((previous) => previous?.id === pending.id && previous.index === pending.index ? previous : { id: pending.id, index: pending.index });
|
|
50
|
+
};
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!moving) return;
|
|
53
|
+
let frame: number;
|
|
54
|
+
const tick = () => {
|
|
55
|
+
const pending = drag.current, element = list.current;
|
|
56
|
+
if (!pending || !element) return;
|
|
57
|
+
const bounds = element.getBoundingClientRect();
|
|
58
|
+
const delta = pending.y < bounds.top + 32 ? -8 : pending.y > bounds.bottom - 32 ? 8 : 0;
|
|
59
|
+
if (delta) { element.scrollTop += delta; update(); }
|
|
60
|
+
frame = requestAnimationFrame(tick);
|
|
61
|
+
};
|
|
62
|
+
frame = requestAnimationFrame(tick);
|
|
63
|
+
return () => cancelAnimationFrame(frame);
|
|
64
|
+
}, [moving?.id]);
|
|
65
|
+
useEffect(() => () => { drag.current = null; }, [pid]);
|
|
66
|
+
|
|
67
|
+
const close = (tab: OpenTab) => {
|
|
68
|
+
if (current?.pid !== pid || current.tab.id !== tab.id) { openTabs.close(pid, tab.id); return; }
|
|
69
|
+
const index = tabs.findIndex((item) => item.id === tab.id), next = tabs[index + 1] ?? tabs[index - 1];
|
|
70
|
+
// Apply the close only after navigation commits. A canceled unsaved-editor
|
|
71
|
+
// prompt must leave the current tab intact; consume the intent in the tracker.
|
|
72
|
+
onNavigate?.();
|
|
73
|
+
void navigate(next?.href ?? `/p/${encodeURIComponent(pid)}`, { replace: true, state: { [CLOSE_INTENT]: { pid, id: tab.id } } });
|
|
74
|
+
};
|
|
75
|
+
const pointerMove = (event: PointerEvent<HTMLButtonElement>) => {
|
|
76
|
+
const pending = drag.current;
|
|
77
|
+
if (!pending || pending.pointer !== event.pointerId) return;
|
|
78
|
+
pending.y = event.clientY;
|
|
79
|
+
if (Math.abs(pending.y - pending.start) < 4 && !pending.moved) return;
|
|
80
|
+
pending.moved = true; update();
|
|
81
|
+
};
|
|
82
|
+
const before = moving ? tabs.filter((tab) => tab.id !== moving.id)[moving.index]?.id : undefined;
|
|
83
|
+
return <nav ref={list} className="sidebar-session-list mr-1 mt-2 min-h-0 flex-1 overflow-y-auto px-2 pb-2" aria-label="活跃 Tab">
|
|
84
|
+
{!tabs.length && <p className="px-2 py-1 text-xs text-muted">打开的会话和文件会出现在这里。</p>}
|
|
85
|
+
<ol className={cx("min-h-0", moving && !before && "border-b-2 border-accent")}>
|
|
86
|
+
{tabs.map((tab, index) => <li key={tab.id} data-tab-id={tab.id} className={cx(
|
|
87
|
+
"group mt-px flex h-8 min-w-0 items-center rounded border-t-2 border-transparent md:h-7",
|
|
88
|
+
before === tab.id && "border-t-accent!", moving?.id === tab.id && "opacity-45",
|
|
89
|
+
current?.pid === pid && current.tab.id === tab.id ? "bg-surface shadow-sm ring-1 ring-border" : "hover:bg-surface/70",
|
|
90
|
+
)}>
|
|
91
|
+
<Button variant="ghost" size="sm" iconOnly className="h-6! w-5! touch-none cursor-grab text-muted/50 active:cursor-grabbing md:h-5! md:w-4!" aria-label={`调整 ${tab.title} 顺序`} title="拖动排序,或用方向键移动"
|
|
92
|
+
onPointerDown={(event) => {
|
|
93
|
+
if (!event.isPrimary || event.button !== 0) return;
|
|
94
|
+
event.preventDefault(); event.currentTarget.focus(); event.currentTarget.setPointerCapture(event.pointerId);
|
|
95
|
+
drag.current = { id: tab.id, pointer: event.pointerId, start: event.clientY, y: event.clientY, moved: false, index };
|
|
96
|
+
}} onPointerMove={pointerMove} onPointerUp={() => finish(true)} onPointerCancel={() => finish()} onLostPointerCapture={() => finish()}
|
|
97
|
+
onKeyDown={(event) => {
|
|
98
|
+
if (event.key === "Escape") { finish(); return; }
|
|
99
|
+
if (!["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
openTabs.move(pid, tab.id, event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : index + (event.key === "ArrowUp" ? -1 : 1));
|
|
102
|
+
}}><GripIcon size={12} /></Button>
|
|
103
|
+
<Link to={tab.href} draggable={false} aria-current={current?.pid === pid && current.tab.id === tab.id ? "page" : undefined}
|
|
104
|
+
title={tab.kind === "file" ? tab.target : tab.title} className="flex h-full min-w-0 flex-1 items-center gap-1.5 text-xs leading-none">
|
|
105
|
+
<span className="shrink-0 text-muted">{tab.kind === "file" ? <FileIcon size={12} /> : <ChatIcon size={12} />}</span>
|
|
106
|
+
<span className="min-w-0 flex-1 truncate">{tab.kind === "file" ? tab.target : tab.title}</span>
|
|
107
|
+
</Link>
|
|
108
|
+
<Button variant="ghost" size="sm" iconOnly className="mr-0.5 size-6! md:size-5!" aria-label={`关闭 ${tab.title}`} title="关闭 Tab" onClick={() => close(tab)}><XIcon size={12} /></Button>
|
|
109
|
+
</li>)}
|
|
110
|
+
</ol>
|
|
111
|
+
</nav>;
|
|
112
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import type { AskQuestion, PendingRequest } from "@shared/protocol.ts";
|
|
3
|
+
import { sendClient } from "../live.ts";
|
|
4
|
+
import { Markdown } from "./Markdown.tsx";
|
|
5
|
+
import { Button } from "../ui/Button.tsx";
|
|
6
|
+
import { CheckIcon } from "../ui/icons.tsx";
|
|
7
|
+
|
|
8
|
+
export function PendingCard({ req, sessionId }: { req: PendingRequest; sessionId: string }) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={`mb-3 overflow-hidden rounded-xl border border-accent/40 bg-surface shadow-sm ${req.kind === "ask" ? "flex max-h-[min(55dvh,32rem)] min-h-0 flex-col" : ""}`} data-testid={`pending-${req.kind}`}>
|
|
11
|
+
<div className="flex shrink-0 items-center gap-2 border-b border-border bg-accent/5 px-4 py-2 text-xs font-medium text-accent">
|
|
12
|
+
<span className="size-1.5 animate-pulse rounded-full bg-accent" aria-hidden />
|
|
13
|
+
{req.kind === "ask" ? "Claude 在等你回答" : "Claude 在等你审批计划"}
|
|
14
|
+
</div>
|
|
15
|
+
<div className={req.kind === "ask" ? "flex min-h-0 flex-col" : "p-4"}>
|
|
16
|
+
{req.kind === "ask" ? <AskForm key={req.id} req={req} sessionId={sessionId} /> : <PlanReview req={req} sessionId={sessionId} />}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function AskForm({ req, sessionId }: { req: Extract<PendingRequest, { kind: "ask" }>; sessionId: string }) {
|
|
23
|
+
const questions = req.input.questions ?? [];
|
|
24
|
+
const [picked, setPicked] = useState<Record<string, string[]>>({});
|
|
25
|
+
const [other, setOther] = useState<Record<string, string>>({});
|
|
26
|
+
const [activePage, setPage] = useState(0);
|
|
27
|
+
const page = Math.min(activePage, Math.max(0, questions.length - 1));
|
|
28
|
+
const question = questions[page];
|
|
29
|
+
const bodyRef = useRef<HTMLDivElement>(null);
|
|
30
|
+
useEffect(() => { if (bodyRef.current) bodyRef.current.scrollTop = 0; }, [page]);
|
|
31
|
+
|
|
32
|
+
const answerFor = (q: AskQuestion) => {
|
|
33
|
+
const labels = [...(picked[q.question] ?? [])];
|
|
34
|
+
const free = other[q.question]?.trim();
|
|
35
|
+
if (free) labels.push(free);
|
|
36
|
+
return labels.join(", ");
|
|
37
|
+
};
|
|
38
|
+
const answered = questions.filter((q) => answerFor(q)).length;
|
|
39
|
+
const complete = questions.length > 0 && answered === questions.length;
|
|
40
|
+
|
|
41
|
+
function toggle(q: AskQuestion, label: string) {
|
|
42
|
+
setPicked((p) => {
|
|
43
|
+
const cur = p[q.question] ?? [];
|
|
44
|
+
if (!q.multiSelect) return { ...p, [q.question]: [label] };
|
|
45
|
+
return { ...p, [q.question]: cur.includes(label) ? cur.filter((l) => l !== label) : [...cur, label] };
|
|
46
|
+
});
|
|
47
|
+
if (!q.multiSelect) setOther((o) => ({ ...o, [q.question]: "" }));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="flex min-h-0 flex-col">
|
|
52
|
+
{questions.length > 1 && <div className="flex shrink-0 flex-wrap items-center justify-between gap-2 px-4 pb-2 pt-3">
|
|
53
|
+
<p className="text-xs text-muted" role="status">第 {page + 1} / {questions.length} 题 · 已答 {answered} 题</p>
|
|
54
|
+
<nav className="flex gap-1" aria-label="问题分页">
|
|
55
|
+
{questions.map((q, index) => <Button
|
|
56
|
+
key={index}
|
|
57
|
+
size="sm"
|
|
58
|
+
iconOnly
|
|
59
|
+
variant={index === page ? "primary" : "ghost"}
|
|
60
|
+
aria-label={`第 ${index + 1} 题${q.header ? `:${q.header}` : ""}(${answerFor(q) ? "已回答" : "未回答"})`}
|
|
61
|
+
aria-current={index === page ? "step" : undefined}
|
|
62
|
+
title={q.header ?? q.question}
|
|
63
|
+
onClick={() => setPage(index)}
|
|
64
|
+
>{index + 1}{answerFor(q) && <span className="sr-only">,已回答</span>}</Button>)}
|
|
65
|
+
</nav>
|
|
66
|
+
</div>}
|
|
67
|
+
<div ref={bodyRef} className="min-h-0 overflow-y-auto overscroll-contain px-4 py-3" data-testid="ask-question-body">
|
|
68
|
+
{question ? (
|
|
69
|
+
<fieldset key={page} className="min-w-0 space-y-2">
|
|
70
|
+
<legend className="max-w-full break-words font-medium">
|
|
71
|
+
{question.header && <span className="mr-2 rounded bg-surface-2 px-1.5 py-0.5 text-xs text-muted">{question.header}</span>}
|
|
72
|
+
{question.question}
|
|
73
|
+
</legend>
|
|
74
|
+
<div className="grid gap-2">
|
|
75
|
+
{question.options.map((o) => {
|
|
76
|
+
const on = picked[question.question]?.includes(o.label);
|
|
77
|
+
return (
|
|
78
|
+
<button
|
|
79
|
+
key={o.label}
|
|
80
|
+
type="button"
|
|
81
|
+
role={question.multiSelect ? "checkbox" : "radio"}
|
|
82
|
+
aria-checked={!!on}
|
|
83
|
+
onClick={() => toggle(question, o.label)}
|
|
84
|
+
className={`flex items-start gap-3 rounded-lg border px-3.5 py-2.5 text-left transition-colors ${on ? "border-accent/60 bg-accent/5" : "border-border hover:border-muted/40"}`}
|
|
85
|
+
>
|
|
86
|
+
<span
|
|
87
|
+
className={`mt-0.5 flex size-4 shrink-0 items-center justify-center border ${question.multiSelect ? "rounded" : "rounded-full"} ${on ? "border-accent bg-accent text-accent-text" : "border-muted/50"}`}
|
|
88
|
+
aria-hidden
|
|
89
|
+
>
|
|
90
|
+
{on && (question.multiSelect ? <CheckIcon size={11} /> : <span className="size-1.5 rounded-full bg-accent-text" />)}
|
|
91
|
+
</span>
|
|
92
|
+
<span className="min-w-0 break-words">
|
|
93
|
+
<div className="text-sm font-medium">{o.label}</div>
|
|
94
|
+
{o.description && <div className="mt-0.5 text-xs text-muted">{o.description}</div>}
|
|
95
|
+
</span>
|
|
96
|
+
</button>
|
|
97
|
+
);
|
|
98
|
+
})}
|
|
99
|
+
<input
|
|
100
|
+
aria-label={`其他回答:${question.question}`}
|
|
101
|
+
placeholder="其他(自由输入)"
|
|
102
|
+
value={other[question.question] ?? ""}
|
|
103
|
+
onChange={(e) => {
|
|
104
|
+
const v = e.target.value;
|
|
105
|
+
setOther((o) => ({ ...o, [question.question]: v }));
|
|
106
|
+
if (!question.multiSelect && v) setPicked((p) => ({ ...p, [question.question]: [] }));
|
|
107
|
+
}}
|
|
108
|
+
className="h-10 min-w-0 rounded-lg border border-border bg-bg px-3 text-base outline-none focus:border-accent/60 focus:ring-2 focus:ring-accent/20 md:h-9 md:text-sm"
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
</fieldset>
|
|
112
|
+
) : <p className="text-sm text-muted">当前没有可回答的问题。</p>}
|
|
113
|
+
</div>
|
|
114
|
+
<div className="flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3">
|
|
115
|
+
<Button
|
|
116
|
+
variant="ghost"
|
|
117
|
+
className="mr-auto"
|
|
118
|
+
onClick={() => sendClient({ t: "answer", sessionId, requestId: req.id, answer: { kind: "cancel" } })}
|
|
119
|
+
>
|
|
120
|
+
{questions.length > 1 ? "跳过全部" : "跳过"}
|
|
121
|
+
</Button>
|
|
122
|
+
{questions.length > 1 && <Button disabled={page === 0} onClick={() => setPage(page - 1)}>上一步</Button>}
|
|
123
|
+
{page < questions.length - 1 ? <Button key="next" variant="primary" disabled={!question || !answerFor(question)} onClick={() => setPage(page + 1)}>下一步</Button> : <Button
|
|
124
|
+
key="submit"
|
|
125
|
+
variant="primary"
|
|
126
|
+
disabled={!complete}
|
|
127
|
+
onClick={() =>
|
|
128
|
+
sendClient({
|
|
129
|
+
t: "answer",
|
|
130
|
+
sessionId,
|
|
131
|
+
requestId: req.id,
|
|
132
|
+
answer: { kind: "ask", answers: Object.fromEntries(questions.map((q) => [q.question, answerFor(q)])) },
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
>
|
|
136
|
+
{questions.length > 1 ? "提交全部" : "提交"}
|
|
137
|
+
</Button>}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function PlanReview({ req, sessionId }: { req: Extract<PendingRequest, { kind: "plan" }>; sessionId: string }) {
|
|
144
|
+
const [feedback, setFeedback] = useState("");
|
|
145
|
+
return (
|
|
146
|
+
<div className="space-y-3">
|
|
147
|
+
<h2 className="text-lg">Claude 的计划</h2>
|
|
148
|
+
<div className="max-h-[50dvh] overflow-y-auto rounded-lg bg-bg p-3">
|
|
149
|
+
<Markdown text={req.input.plan} />
|
|
150
|
+
</div>
|
|
151
|
+
<textarea
|
|
152
|
+
aria-label="修改意见"
|
|
153
|
+
placeholder="需要修改的地方(打回时必填)"
|
|
154
|
+
value={feedback}
|
|
155
|
+
onChange={(e) => setFeedback(e.target.value)}
|
|
156
|
+
rows={2}
|
|
157
|
+
className="w-full resize-none rounded-lg border border-border bg-bg px-3 py-2 text-sm outline-none focus:border-accent"
|
|
158
|
+
/>
|
|
159
|
+
<div className="flex justify-end gap-2">
|
|
160
|
+
<Button
|
|
161
|
+
disabled={!feedback.trim()}
|
|
162
|
+
onClick={() => sendClient({ t: "answer", sessionId, requestId: req.id, answer: { kind: "plan", approve: false, feedback } })}
|
|
163
|
+
>
|
|
164
|
+
打回修改
|
|
165
|
+
</Button>
|
|
166
|
+
<Button
|
|
167
|
+
variant="primary"
|
|
168
|
+
onClick={() => sendClient({ t: "answer", sessionId, requestId: req.id, answer: { kind: "plan", approve: true } })}
|
|
169
|
+
>
|
|
170
|
+
批准执行
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|