offsite 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +40 -2
- package/apps/server/dist/args.js +11 -0
- package/apps/server/dist/claude.js +196 -0
- package/apps/server/dist/config.js +184 -0
- package/apps/server/dist/content.js +172 -0
- package/apps/server/dist/files.js +50 -0
- package/apps/server/dist/folders.js +12 -0
- package/apps/server/dist/git.js +133 -0
- package/apps/server/dist/history.js +103 -0
- package/apps/server/dist/hub.js +10 -0
- package/apps/server/dist/main.js +64 -0
- package/apps/server/dist/protocol.js +20 -0
- package/apps/server/dist/push.js +152 -0
- package/apps/server/dist/run.js +371 -0
- package/apps/server/dist/runs.js +102 -0
- package/apps/server/dist/schemes.js +262 -0
- package/apps/server/dist/sessions.js +64 -0
- package/apps/server/dist/socket.js +139 -0
- package/apps/server/dist/storage.js +22 -0
- package/apps/server/dist/terminal/alerts.js +145 -0
- package/apps/server/dist/terminal/process.js +207 -0
- package/apps/server/dist/terminal/shell-check.js +91 -0
- package/apps/server/dist/terminal/shell-integration.js +112 -0
- package/apps/server/dist/terminal/terminal.js +402 -0
- package/apps/server/src/terminal/shell-integration/bash/offsite.bash +112 -0
- package/apps/server/src/terminal/shell-integration/fish/offsite.fish +22 -0
- package/apps/server/src/terminal/shell-integration/zsh/.zshenv +100 -0
- package/apps/web/dist/assets/CaskaydiaCove-Bold-EtG3C8NJ.woff2 +0 -0
- package/apps/web/dist/assets/CaskaydiaCove-Regular-C8p8BuDw.woff2 +0 -0
- package/apps/web/dist/assets/FiraCode-Bold-CWkMdXEH.woff2 +0 -0
- package/apps/web/dist/assets/FiraCode-Regular-DlIV_a-6.woff2 +0 -0
- package/apps/web/dist/assets/Hack-Bold-CJ2nw9Fn.woff2 +0 -0
- package/apps/web/dist/assets/Hack-Regular-DQT7wDXD.woff2 +0 -0
- package/apps/web/dist/assets/JetBrainsMono-Bold-C3RVijod.woff2 +0 -0
- package/apps/web/dist/assets/JetBrainsMono-Regular-BhNseNRl.woff2 +0 -0
- package/apps/web/dist/assets/abap-CLvhMVsD.js +1 -0
- package/apps/web/dist/assets/actionscript-3-Cs6JJXT5.js +1 -0
- package/apps/web/dist/assets/ada-X3Y2mlq2.js +1 -0
- package/apps/web/dist/assets/ahk-DwADkxyd.js +1 -0
- package/apps/web/dist/assets/ahk2-_6rzW9BS.js +1 -0
- package/apps/web/dist/assets/andromeeda-vGVdxbeo.js +1 -0
- package/apps/web/dist/assets/angular-html-_TZra42G.js +1 -0
- package/apps/web/dist/assets/angular-ts-CVVZOQsp.js +1 -0
- package/apps/web/dist/assets/apache-U0d_L8uA.js +1 -0
- package/apps/web/dist/assets/apex-KFGFyKwG.js +1 -0
- package/apps/web/dist/assets/apl-Cyzt__4P.js +1 -0
- package/apps/web/dist/assets/applescript-CCn79oCD.js +1 -0
- package/apps/web/dist/assets/ara-4CJ0cIlV.js +1 -0
- package/apps/web/dist/assets/asciidoc-SCjQUq34.js +1 -0
- package/apps/web/dist/assets/asm-Cmm7eHzH.js +1 -0
- package/apps/web/dist/assets/astro-DvoD4nYz.js +1 -0
- package/apps/web/dist/assets/aurora-x-CDeNXAV0.js +1 -0
- package/apps/web/dist/assets/awk-BWXHIvNe.js +1 -0
- package/apps/web/dist/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/apps/web/dist/assets/ayu-light-C3h-C4tm.js +1 -0
- package/apps/web/dist/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/apps/web/dist/assets/ballerina-B7ZEbQpA.js +1 -0
- package/apps/web/dist/assets/bat-qdxAdBWQ.js +1 -0
- package/apps/web/dist/assets/beancount-C2IN4Vk8.js +1 -0
- package/apps/web/dist/assets/berry-DKpUyyne.js +1 -0
- package/apps/web/dist/assets/bibtex-Ci_nEsc7.js +1 -0
- package/apps/web/dist/assets/bicep-CUHmPFLl.js +1 -0
- package/apps/web/dist/assets/bird2-CYIUgYqB.js +1 -0
- package/apps/web/dist/assets/blade-SFrvNJcM.js +1 -0
- package/apps/web/dist/assets/bsl-_VjlB9mv.js +1 -0
- package/apps/web/dist/assets/c-BzXljoEl.js +1 -0
- package/apps/web/dist/assets/c3-D0apG41V.js +1 -0
- package/apps/web/dist/assets/cadence-CQ2zXKGN.js +1 -0
- package/apps/web/dist/assets/cairo-DLTphjLi.js +1 -0
- package/apps/web/dist/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/apps/web/dist/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/apps/web/dist/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/apps/web/dist/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/apps/web/dist/assets/chapel-CSqeAvDr.js +1 -0
- package/apps/web/dist/assets/clarity-CtfBBspg.js +1 -0
- package/apps/web/dist/assets/clojure-DqKBuwfJ.js +1 -0
- package/apps/web/dist/assets/cmake-Bj61d0ZC.js +1 -0
- package/apps/web/dist/assets/cobol-DnK1h_4j.js +1 -0
- package/apps/web/dist/assets/codeowners-C8r90Shi.js +1 -0
- package/apps/web/dist/assets/codeql-oeQT6MSM.js +1 -0
- package/apps/web/dist/assets/coffee-BrM2hs_V.js +1 -0
- package/apps/web/dist/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/apps/web/dist/assets/coq-CGaSfhwR.js +1 -0
- package/apps/web/dist/assets/cpp-C_7gVSp4.js +1 -0
- package/apps/web/dist/assets/crystal-DbpY_y_D.js +1 -0
- package/apps/web/dist/assets/csharp-dmMxLVLW.js +1 -0
- package/apps/web/dist/assets/css-CcKWTG1c.js +1 -0
- package/apps/web/dist/assets/csv-Dx-8-gkx.js +1 -0
- package/apps/web/dist/assets/cue-CE9AQfxI.js +1 -0
- package/apps/web/dist/assets/cypher-ClKdZ_lG.js +1 -0
- package/apps/web/dist/assets/d-qD-0Kul2.js +1 -0
- package/apps/web/dist/assets/dark-plus-Cs2F2srj.js +1 -0
- package/apps/web/dist/assets/dart-CHZY9Xhz.js +1 -0
- package/apps/web/dist/assets/dax-BkyTk9wS.js +1 -0
- package/apps/web/dist/assets/desktop-Dlh5hvp9.js +1 -0
- package/apps/web/dist/assets/diff-woXpYk--.js +1 -0
- package/apps/web/dist/assets/docker-IyjqRm3v.js +1 -0
- package/apps/web/dist/assets/dotenv-CuH5my32.js +1 -0
- package/apps/web/dist/assets/dracula-BHWKrbxM.js +1 -0
- package/apps/web/dist/assets/dracula-soft-5eyTD99u.js +1 -0
- package/apps/web/dist/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/apps/web/dist/assets/edge-CqcnepJa.js +1 -0
- package/apps/web/dist/assets/elixir-DG0UMMTO.js +1 -0
- package/apps/web/dist/assets/elm-D81_16hi.js +1 -0
- package/apps/web/dist/assets/emacs-lisp-DR2vtWaj.js +1 -0
- package/apps/web/dist/assets/erb-BHb0Ji2T.js +1 -0
- package/apps/web/dist/assets/erlang-Cphh6RMH.js +1 -0
- package/apps/web/dist/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/apps/web/dist/assets/everforest-light-Df2xbC6M.js +1 -0
- package/apps/web/dist/assets/fennel-DQxkIbk2.js +1 -0
- package/apps/web/dist/assets/fish-BJitypiv.js +1 -0
- package/apps/web/dist/assets/fluent-C03EYrpw.js +1 -0
- package/apps/web/dist/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/apps/web/dist/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/apps/web/dist/assets/fsharp-D13ZGOAj.js +1 -0
- package/apps/web/dist/assets/gdresource-xMC7jr7x.js +1 -0
- package/apps/web/dist/assets/gdscript-DYvRD3hg.js +1 -0
- package/apps/web/dist/assets/gdshader-CBce3t8t.js +1 -0
- package/apps/web/dist/assets/genie-CV2tkWYe.js +1 -0
- package/apps/web/dist/assets/gherkin-DExj1W_8.js +1 -0
- package/apps/web/dist/assets/ghostty-vt-CQAu1Gs5.wasm +0 -0
- package/apps/web/dist/assets/git-commit-BSykSTBG.js +1 -0
- package/apps/web/dist/assets/git-rebase-Bzcz_AWI.js +1 -0
- package/apps/web/dist/assets/github-dark-C-LZuMrd.js +1 -0
- package/apps/web/dist/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/apps/web/dist/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/apps/web/dist/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/apps/web/dist/assets/github-light-EUqPIrTm.js +1 -0
- package/apps/web/dist/assets/github-light-default-BXViO-2h.js +1 -0
- package/apps/web/dist/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/apps/web/dist/assets/gleam-CSRkHgEL.js +1 -0
- package/apps/web/dist/assets/glimmer-js-BbGaPXN7.js +1 -0
- package/apps/web/dist/assets/glimmer-ts-B2OBt1Cw.js +1 -0
- package/apps/web/dist/assets/glsl-Cuu3Xc_3.js +1 -0
- package/apps/web/dist/assets/gn-CAXYAgV-.js +1 -0
- package/apps/web/dist/assets/gnuplot-7GGW24-e.js +1 -0
- package/apps/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/apps/web/dist/assets/graphql-XBGrkq1T.js +1 -0
- package/apps/web/dist/assets/groovy-CacY0gHj.js +1 -0
- package/apps/web/dist/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/apps/web/dist/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/apps/web/dist/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/apps/web/dist/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/apps/web/dist/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/apps/web/dist/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/apps/web/dist/assets/hack-D-n58M0B.js +1 -0
- package/apps/web/dist/assets/haml-06aMoWFC.js +1 -0
- package/apps/web/dist/assets/handlebars-BSCSPRHp.js +1 -0
- package/apps/web/dist/assets/haskell-D8IpX4py.js +1 -0
- package/apps/web/dist/assets/haxe-C8oCnwJJ.js +1 -0
- package/apps/web/dist/assets/hcl-Dh228itO.js +1 -0
- package/apps/web/dist/assets/hjson-CxZEssPk.js +1 -0
- package/apps/web/dist/assets/hlsl-Cvrh5tZx.js +1 -0
- package/apps/web/dist/assets/horizon-CE9ld1lL.js +1 -0
- package/apps/web/dist/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/apps/web/dist/assets/houston-CsvMBhTu.js +1 -0
- package/apps/web/dist/assets/html-CRYhxgas.js +1 -0
- package/apps/web/dist/assets/html-derivative-El-EKb6H.js +1 -0
- package/apps/web/dist/assets/http-Cj-Wbb2c.js +1 -0
- package/apps/web/dist/assets/hurl--dF5MzC1.js +1 -0
- package/apps/web/dist/assets/hxml-Dcm88srW.js +1 -0
- package/apps/web/dist/assets/hy-CZbG8q4J.js +1 -0
- package/apps/web/dist/assets/imba-DsUTQ-LC.js +1 -0
- package/apps/web/dist/assets/index-CN9uEzWa.js +899 -0
- package/apps/web/dist/assets/index-Ck79gpc3.css +2 -0
- package/apps/web/dist/assets/ini-B5eOa1yu.js +1 -0
- package/apps/web/dist/assets/java-_zuIdTC3.js +1 -0
- package/apps/web/dist/assets/javascript-Dw2bor_9.js +1 -0
- package/apps/web/dist/assets/jinja-CtYhL6FS.js +1 -0
- package/apps/web/dist/assets/jison-BS6VCOAt.js +1 -0
- package/apps/web/dist/assets/json-D6Mznwzn.js +1 -0
- package/apps/web/dist/assets/json5-BR5RXkoi.js +1 -0
- package/apps/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/apps/web/dist/assets/jsonl-CmCQp5Yx.js +1 -0
- package/apps/web/dist/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/apps/web/dist/assets/jssm-DXw9l8Rf.js +1 -0
- package/apps/web/dist/assets/jsx-DLuxOqjU.js +1 -0
- package/apps/web/dist/assets/julia-CMgTtdec.js +1 -0
- package/apps/web/dist/assets/just-D_e2Cdol.js +1 -0
- package/apps/web/dist/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/apps/web/dist/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/apps/web/dist/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/apps/web/dist/assets/kdl-CsD5j6eV.js +1 -0
- package/apps/web/dist/assets/kotlin-DhhofPvG.js +1 -0
- package/apps/web/dist/assets/kusto-C7mF5XQf.js +1 -0
- package/apps/web/dist/assets/laserwave-C_8bwKvT.js +1 -0
- package/apps/web/dist/assets/latex-C7F9cbcZ.js +1 -0
- package/apps/web/dist/assets/lean-CewbzKMR.js +1 -0
- package/apps/web/dist/assets/less-DVTAwKKz.js +1 -0
- package/apps/web/dist/assets/light-plus-DVQuIRkW.js +1 -0
- package/apps/web/dist/assets/liquid-DZ0eHbL-.js +1 -0
- package/apps/web/dist/assets/llvm-DqHOMS-s.js +1 -0
- package/apps/web/dist/assets/log-BNLmms1o.js +1 -0
- package/apps/web/dist/assets/logo-Cluzi2Zq.js +1 -0
- package/apps/web/dist/assets/lua-DA_XbnYa.js +1 -0
- package/apps/web/dist/assets/luau-VGWVLoqX.js +1 -0
- package/apps/web/dist/assets/make-Dixweg8N.js +1 -0
- package/apps/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/apps/web/dist/assets/marko-BOjbwMe_.js +1 -0
- package/apps/web/dist/assets/material-theme-Bm3Qr25_.js +1 -0
- package/apps/web/dist/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/apps/web/dist/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/apps/web/dist/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/apps/web/dist/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/apps/web/dist/assets/matlab-D7qyCx1q.js +1 -0
- package/apps/web/dist/assets/mdc-BLQdrSL9.js +1 -0
- package/apps/web/dist/assets/mdx-DQZ5AkYe.js +1 -0
- package/apps/web/dist/assets/mermaid-BxpfTIzt.js +1 -0
- package/apps/web/dist/assets/min-dark-BSWPekZh.js +1 -0
- package/apps/web/dist/assets/min-light-DDpmG2fV.js +1 -0
- package/apps/web/dist/assets/mipsasm-BMqwQI7S.js +1 -0
- package/apps/web/dist/assets/mojo-fg40_ntQ.js +1 -0
- package/apps/web/dist/assets/monokai-BscAjiQZ.js +1 -0
- package/apps/web/dist/assets/moonbit-D9W784E_.js +1 -0
- package/apps/web/dist/assets/move-BYnGhZoM.js +1 -0
- package/apps/web/dist/assets/narrat-_X_XdTYD.js +1 -0
- package/apps/web/dist/assets/nextflow-CSgcYZcx.js +1 -0
- package/apps/web/dist/assets/nextflow-groovy-D7IRt6Pp.js +1 -0
- package/apps/web/dist/assets/nginx-CRuAoyv9.js +1 -0
- package/apps/web/dist/assets/night-owl-DhmEMT88.js +1 -0
- package/apps/web/dist/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/apps/web/dist/assets/nim--m3L_KpX.js +1 -0
- package/apps/web/dist/assets/nix-IvuFDN5E.js +1 -0
- package/apps/web/dist/assets/nord-Cb4Vim4T.js +1 -0
- package/apps/web/dist/assets/nsis-CjNLYCLg.js +1 -0
- package/apps/web/dist/assets/nushell--0fT3PI1.js +1 -0
- package/apps/web/dist/assets/objective-c-D1A_Heim.js +1 -0
- package/apps/web/dist/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/apps/web/dist/assets/ocaml-O90oeIOV.js +1 -0
- package/apps/web/dist/assets/odin-B1RWQWA5.js +1 -0
- package/apps/web/dist/assets/one-dark-pro-C6YyR8OD.js +1 -0
- package/apps/web/dist/assets/one-light-D7Lr4KcI.js +1 -0
- package/apps/web/dist/assets/openscad-BUDT5pXO.js +1 -0
- package/apps/web/dist/assets/org-BNxSv-BH.js +1 -0
- package/apps/web/dist/assets/pascal-4ZHwLPI5.js +1 -0
- package/apps/web/dist/assets/perl-DEB_cAoG.js +1 -0
- package/apps/web/dist/assets/php-Cei4P5ds.js +1 -0
- package/apps/web/dist/assets/pierre-dark-CpLgRqie.js +1 -0
- package/apps/web/dist/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/apps/web/dist/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/apps/web/dist/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/apps/web/dist/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/apps/web/dist/assets/pierre-light-CoaEpmwp.js +1 -0
- package/apps/web/dist/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/apps/web/dist/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/apps/web/dist/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/apps/web/dist/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/apps/web/dist/assets/pkl-ot-7Btpt.js +1 -0
- package/apps/web/dist/assets/plastic-DQwYfKfQ.js +1 -0
- package/apps/web/dist/assets/plsql-DGHpHOYJ.js +1 -0
- package/apps/web/dist/assets/po-BiJDBrnU.js +1 -0
- package/apps/web/dist/assets/poimandres-DRFjx7u4.js +1 -0
- package/apps/web/dist/assets/polar-C7UOKdEL.js +1 -0
- package/apps/web/dist/assets/postcss-BXeXVLqQ.js +1 -0
- package/apps/web/dist/assets/powerquery-DNMTfnFr.js +1 -0
- package/apps/web/dist/assets/powershell-QtSnmXcu.js +1 -0
- package/apps/web/dist/assets/prisma-DMgNhnYS.js +1 -0
- package/apps/web/dist/assets/prolog-iXnhIJG7.js +1 -0
- package/apps/web/dist/assets/proto-DB4EqR-F.js +1 -0
- package/apps/web/dist/assets/pug-BtkQ8Y8B.js +1 -0
- package/apps/web/dist/assets/puppet-CDv2pdJW.js +1 -0
- package/apps/web/dist/assets/purescript-9MfHhQsQ.js +1 -0
- package/apps/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/apps/web/dist/assets/qml-yI-6sShm.js +1 -0
- package/apps/web/dist/assets/qmldir-DCQb3MpD.js +1 -0
- package/apps/web/dist/assets/qss-Fe1Jh2GI.js +1 -0
- package/apps/web/dist/assets/r-CJ8zo4yy.js +1 -0
- package/apps/web/dist/assets/racket-DcIDlBhZ.js +1 -0
- package/apps/web/dist/assets/raku-B3gFvitq.js +1 -0
- package/apps/web/dist/assets/razor-CTPI_hHO.js +1 -0
- package/apps/web/dist/assets/rbs-C0MpOrj4.js +1 -0
- package/apps/web/dist/assets/red-CYlAq2b0.js +1 -0
- package/apps/web/dist/assets/reg-CRGYupPL.js +1 -0
- package/apps/web/dist/assets/regexp-j43xPEIH.js +1 -0
- package/apps/web/dist/assets/rel-BtDbiS_P.js +1 -0
- package/apps/web/dist/assets/riscv-Ckw8ddFX.js +1 -0
- package/apps/web/dist/assets/ron-VUp2lXgN.js +1 -0
- package/apps/web/dist/assets/rose-pine-aMsaMD1D.js +1 -0
- package/apps/web/dist/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/apps/web/dist/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/apps/web/dist/assets/rosmsg-CAekHB0j.js +1 -0
- package/apps/web/dist/assets/rst-CfIeFcNC.js +1 -0
- package/apps/web/dist/assets/ruby-CtmudUkS.js +1 -0
- package/apps/web/dist/assets/rust-DpiIf5JO.js +1 -0
- package/apps/web/dist/assets/sas-BBgd1Oa5.js +1 -0
- package/apps/web/dist/assets/sass-DXrisJhu.js +1 -0
- package/apps/web/dist/assets/scala-BiFt_7mu.js +1 -0
- package/apps/web/dist/assets/scheme-DQCgrYNe.js +1 -0
- package/apps/web/dist/assets/scss-BOSyZrIf.js +1 -0
- package/apps/web/dist/assets/sdbl-bTVj8UrX.js +1 -0
- package/apps/web/dist/assets/shaderlab-TOUzSsQk.js +1 -0
- package/apps/web/dist/assets/shellscript-BES_U9_l.js +1 -0
- package/apps/web/dist/assets/shellsession-CdF1AgdN.js +1 -0
- package/apps/web/dist/assets/slack-dark-DnToyrRv.js +1 -0
- package/apps/web/dist/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/apps/web/dist/assets/smalltalk-BHpQb5nM.js +1 -0
- package/apps/web/dist/assets/smithy-Dgaz7aur.js +1 -0
- package/apps/web/dist/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/apps/web/dist/assets/solarized-dark-b97czJOk.js +1 -0
- package/apps/web/dist/assets/solarized-light-DFPxpIYQ.js +1 -0
- package/apps/web/dist/assets/solidity-Bj7E1mRn.js +1 -0
- package/apps/web/dist/assets/soy-hqjXYWz3.js +1 -0
- package/apps/web/dist/assets/sparql-D_iOobhT.js +1 -0
- package/apps/web/dist/assets/splunk-BC2Px7Mm.js +1 -0
- package/apps/web/dist/assets/sql-D5hYy2r7.js +1 -0
- package/apps/web/dist/assets/ssh-config-BgfXC-Er.js +1 -0
- package/apps/web/dist/assets/stata-GNNI7e-r.js +1 -0
- package/apps/web/dist/assets/stylus-B6D30XZt.js +1 -0
- package/apps/web/dist/assets/surrealql-gm8__PDR.js +1 -0
- package/apps/web/dist/assets/svelte-DK6xQ-Vs.js +1 -0
- package/apps/web/dist/assets/swift-CyEgAFGc.js +1 -0
- package/apps/web/dist/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/apps/web/dist/assets/system-verilog-Dh5ihWbf.js +1 -0
- package/apps/web/dist/assets/systemd-BxMlprV5.js +1 -0
- package/apps/web/dist/assets/talonscript-CohzipZa.js +1 -0
- package/apps/web/dist/assets/tasl-DMoTqEGO.js +1 -0
- package/apps/web/dist/assets/tcl-CZd0xW_V.js +1 -0
- package/apps/web/dist/assets/templ-Dy-PHEH0.js +1 -0
- package/apps/web/dist/assets/terraform-DswuEJGm.js +1 -0
- package/apps/web/dist/assets/tex-gYu3IM_T.js +1 -0
- package/apps/web/dist/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/apps/web/dist/assets/toml-CcmNWLt0.js +1 -0
- package/apps/web/dist/assets/ts-tags-C8akqtaV.js +1 -0
- package/apps/web/dist/assets/tsv-sltzmVWM.js +1 -0
- package/apps/web/dist/assets/tsx-CtF99HYc.js +1 -0
- package/apps/web/dist/assets/turtle-ByJddavk.js +1 -0
- package/apps/web/dist/assets/twig-D7-O9s37.js +1 -0
- package/apps/web/dist/assets/typescript-o4QHcKOF.js +1 -0
- package/apps/web/dist/assets/typespec-BGhR2SqG.js +1 -0
- package/apps/web/dist/assets/typst-CsLzgkYX.js +1 -0
- package/apps/web/dist/assets/v-DBj4K9d_.js +1 -0
- package/apps/web/dist/assets/vala-zf12oZj6.js +1 -0
- package/apps/web/dist/assets/vb-DOwzaHZ0.js +1 -0
- package/apps/web/dist/assets/verilog-B2gwz-sJ.js +1 -0
- package/apps/web/dist/assets/vesper-DdrHHSXu.js +1 -0
- package/apps/web/dist/assets/vhdl-BroJfC0k.js +1 -0
- package/apps/web/dist/assets/viml-DvXPmvsu.js +1 -0
- package/apps/web/dist/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/apps/web/dist/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/apps/web/dist/assets/vitesse-light-VbXTXTou.js +1 -0
- package/apps/web/dist/assets/vue-C67X0ZYE.js +1 -0
- package/apps/web/dist/assets/vue-html-3wcw93oK.js +1 -0
- package/apps/web/dist/assets/vue-vine-Bq8-4EKU.js +1 -0
- package/apps/web/dist/assets/vyper-CgoNMtux.js +1 -0
- package/apps/web/dist/assets/wasm-BnjxR4X6.js +1 -0
- package/apps/web/dist/assets/wasm-ByWQv1Qj.js +1 -0
- package/apps/web/dist/assets/wenyan-C8pVoKbM.js +1 -0
- package/apps/web/dist/assets/wgsl-BsKzXJz4.js +1 -0
- package/apps/web/dist/assets/wikitext-ClFFjSW2.js +1 -0
- package/apps/web/dist/assets/wit-DdvCle-K.js +1 -0
- package/apps/web/dist/assets/wolfram-DLL8P-h_.js +1 -0
- package/apps/web/dist/assets/xml-DXCI-6Wi.js +1 -0
- package/apps/web/dist/assets/xsl-Dr0qfgBg.js +1 -0
- package/apps/web/dist/assets/yaml-DHhOWIuf.js +1 -0
- package/apps/web/dist/assets/zenscript-BnlCZFoB.js +1 -0
- package/apps/web/dist/assets/zig-CMLA9XwU.js +1 -0
- package/apps/web/dist/index.html +17 -0
- package/apps/web/dist/sw.js +81 -0
- package/bin/offsite.js +2 -0
- package/package.json +20 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nazmus Sayad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# offsite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Claude Code in your browser. It uses the same sessions as the CLI, so you can start in one and resume in the other.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Requires Node.js 24+ and [Claude Code](https://code.claude.com), installed and logged in.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx offsite
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then open [http://127.0.0.1:47841](http://127.0.0.1:47841).
|
|
14
|
+
|
|
15
|
+
| Flag | Default | What it sets |
|
|
16
|
+
| -------- | ------------ | -------------------------------- |
|
|
17
|
+
| `--host` | `127.0.0.1` | Address to listen on |
|
|
18
|
+
| `--port` | `47841` | Port to listen on |
|
|
19
|
+
| `--dir` | `~/.offsite` | Folder for settings and accounts |
|
|
20
|
+
|
|
21
|
+
> [!WARNING]
|
|
22
|
+
> offsite has no login. Anyone who can reach its port can run Claude Code and open a terminal on your machine. Keep the default host.
|
|
23
|
+
|
|
24
|
+
Don't use the same session in offsite and the CLI at the same time. Switching between them is fine.
|
|
25
|
+
|
|
26
|
+
## Separate instances
|
|
27
|
+
|
|
28
|
+
Give each instance its own port and `--dir`. Set `CLAUDE_CONFIG_DIR` too if it should have its own Claude Code sessions and login.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
CLAUDE_CONFIG_DIR=~/.claude-work npx offsite --port 47850 --dir ~/.offsite-work
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pnpm install
|
|
38
|
+
pnpm dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The web app runs at [http://localhost:5173](http://localhost:5173). The server runs on port 47842 and keeps its data in `~/.offsite-dev` and `~/.claude-test`, apart from your main instance.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
const { values } = parseArgs({
|
|
5
|
+
options: {
|
|
6
|
+
host: { type: 'string', default: '127.0.0.1' },
|
|
7
|
+
port: { type: 'string', default: '47841' },
|
|
8
|
+
dir: { type: 'string', default: path.join(os.homedir(), '.offsite') },
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export const args = { ...values, dir: path.resolve(values.dir) };
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { statSync } from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { query, } from '@anthropic-ai/claude-agent-sdk';
|
|
6
|
+
import { broadcast } from './hub.js';
|
|
7
|
+
import { readJson, writeJson } from './storage.js';
|
|
8
|
+
export const DEFAULT_ACCOUNT = 'default';
|
|
9
|
+
const probes = new Map();
|
|
10
|
+
const limits = new Map();
|
|
11
|
+
let executable = '';
|
|
12
|
+
export function findClaude() {
|
|
13
|
+
const name = process.platform === 'win32' ? 'claude.exe' : 'claude';
|
|
14
|
+
for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
|
|
15
|
+
const candidate = path.join(dir, name);
|
|
16
|
+
if (statSync(candidate, { throwIfNoEntry: false })?.isFile()) {
|
|
17
|
+
executable = candidate;
|
|
18
|
+
return candidate;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
export function claudeOptions(accountId, cwd) {
|
|
24
|
+
const env = {
|
|
25
|
+
...process.env,
|
|
26
|
+
CLAUDE_CODE_ENTRYPOINT: 'offsite',
|
|
27
|
+
};
|
|
28
|
+
if (accountId !== DEFAULT_ACCOUNT) {
|
|
29
|
+
const account = storedAccounts().find((item) => item.id === accountId);
|
|
30
|
+
if (account === undefined)
|
|
31
|
+
throw new Error('That account was removed');
|
|
32
|
+
env.CLAUDE_CODE_OAUTH_TOKEN = account.token;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
cwd,
|
|
36
|
+
env,
|
|
37
|
+
pathToClaudeCodeExecutable: executable,
|
|
38
|
+
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
39
|
+
hooks: {
|
|
40
|
+
PostToolUse: [
|
|
41
|
+
{
|
|
42
|
+
matcher: 'PushNotification',
|
|
43
|
+
hooks: [
|
|
44
|
+
async (input) => {
|
|
45
|
+
if (input.hook_event_name !== 'PostToolUse' ||
|
|
46
|
+
typeof input.tool_input !== 'object' ||
|
|
47
|
+
input.tool_input === null ||
|
|
48
|
+
!('message' in input.tool_input) ||
|
|
49
|
+
typeof input.tool_input.message !== 'string')
|
|
50
|
+
throw new Error('Unexpected PushNotification hook input');
|
|
51
|
+
broadcast({
|
|
52
|
+
type: 'notification',
|
|
53
|
+
sessionId: input.session_id,
|
|
54
|
+
message: input.tool_input.message,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
hookSpecificOutput: {
|
|
58
|
+
hookEventName: 'PostToolUse',
|
|
59
|
+
updatedToolOutput: {
|
|
60
|
+
message: input.tool_input.message,
|
|
61
|
+
localSent: true,
|
|
62
|
+
disabledReason: 'no_transport',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export async function capabilities(accountId, cwd) {
|
|
74
|
+
const result = await initialization(accountId, cwd);
|
|
75
|
+
return {
|
|
76
|
+
models: result.models.map((model) => ({
|
|
77
|
+
value: model.value,
|
|
78
|
+
name: model.displayName,
|
|
79
|
+
description: model.description,
|
|
80
|
+
efforts: model.supportedEffortLevels ?? [],
|
|
81
|
+
})),
|
|
82
|
+
commands: result.commands.map((command) => ({
|
|
83
|
+
name: command.name,
|
|
84
|
+
description: command.description,
|
|
85
|
+
hint: command.argumentHint,
|
|
86
|
+
})),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export async function accounts() {
|
|
90
|
+
const all = [
|
|
91
|
+
{ id: DEFAULT_ACCOUNT, name: 'Claude login' },
|
|
92
|
+
...storedAccounts().map(({ id, name }) => ({ id, name })),
|
|
93
|
+
];
|
|
94
|
+
return Promise.all(all.map(async (account) => {
|
|
95
|
+
try {
|
|
96
|
+
const info = (await initialization(account.id, os.homedir())).account;
|
|
97
|
+
return {
|
|
98
|
+
...account,
|
|
99
|
+
email: info.email ?? null,
|
|
100
|
+
plan: info.subscriptionType ?? null,
|
|
101
|
+
error: null,
|
|
102
|
+
limits: accountLimits(account.id),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return {
|
|
107
|
+
...account,
|
|
108
|
+
email: null,
|
|
109
|
+
plan: null,
|
|
110
|
+
error: error instanceof Error ? error.message : String(error),
|
|
111
|
+
limits: accountLimits(account.id),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
export function addAccount(name, token) {
|
|
117
|
+
if (name.trim() === '')
|
|
118
|
+
throw new Error('Give the account a name');
|
|
119
|
+
if (!token.trim().startsWith('sk-ant-'))
|
|
120
|
+
throw new Error('Paste the token printed by `claude setup-token`');
|
|
121
|
+
saveAccounts([
|
|
122
|
+
...storedAccounts(),
|
|
123
|
+
{ id: randomUUID(), name: name.trim(), token: token.trim() },
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
export function removeAccount(id) {
|
|
127
|
+
saveAccounts(storedAccounts().filter((item) => item.id !== id));
|
|
128
|
+
for (const key of probes.keys())
|
|
129
|
+
if (key.startsWith(`${id}\n`))
|
|
130
|
+
probes.delete(key);
|
|
131
|
+
limits.delete(id);
|
|
132
|
+
}
|
|
133
|
+
export function recordLimit(accountId, info) {
|
|
134
|
+
const current = limits.get(accountId) ?? new Map();
|
|
135
|
+
const windows = info.unifiedWindows;
|
|
136
|
+
if (isRecord(windows))
|
|
137
|
+
for (const [name, value] of Object.entries(windows))
|
|
138
|
+
if (isRecord(value))
|
|
139
|
+
current.set(name, {
|
|
140
|
+
window: name,
|
|
141
|
+
utilization: typeof value.utilization === 'number' ? value.utilization : null,
|
|
142
|
+
resetsAt: typeof value.resetsAt === 'number' ? value.resetsAt : null,
|
|
143
|
+
rejected: current.get(name)?.rejected ?? false,
|
|
144
|
+
});
|
|
145
|
+
if (info.rateLimitType !== undefined) {
|
|
146
|
+
const existing = current.get(info.rateLimitType);
|
|
147
|
+
current.set(info.rateLimitType, {
|
|
148
|
+
window: info.rateLimitType,
|
|
149
|
+
utilization: info.utilization ?? existing?.utilization ?? null,
|
|
150
|
+
resetsAt: info.resetsAt ?? existing?.resetsAt ?? null,
|
|
151
|
+
rejected: info.status === 'rejected',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
limits.set(accountId, current);
|
|
155
|
+
return accountLimits(accountId);
|
|
156
|
+
}
|
|
157
|
+
function accountLimits(accountId) {
|
|
158
|
+
return [...(limits.get(accountId)?.values() ?? [])];
|
|
159
|
+
}
|
|
160
|
+
function initialization(accountId, cwd) {
|
|
161
|
+
const key = `${accountId}\n${cwd}`;
|
|
162
|
+
const existing = probes.get(key);
|
|
163
|
+
if (existing !== undefined)
|
|
164
|
+
return existing;
|
|
165
|
+
const probe = runProbe(accountId, cwd);
|
|
166
|
+
probes.set(key, probe);
|
|
167
|
+
probe.catch(() => probes.delete(key));
|
|
168
|
+
return probe;
|
|
169
|
+
}
|
|
170
|
+
async function runProbe(accountId, cwd) {
|
|
171
|
+
const closed = Promise.withResolvers();
|
|
172
|
+
const probe = query({
|
|
173
|
+
prompt: idle(closed.promise),
|
|
174
|
+
options: claudeOptions(accountId, cwd),
|
|
175
|
+
});
|
|
176
|
+
try {
|
|
177
|
+
return await probe.initializationResult();
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
closed.resolve();
|
|
181
|
+
probe.close();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function* idle(until) {
|
|
185
|
+
await until;
|
|
186
|
+
yield* [];
|
|
187
|
+
}
|
|
188
|
+
function storedAccounts() {
|
|
189
|
+
return readJson('accounts.json') ?? [];
|
|
190
|
+
}
|
|
191
|
+
function saveAccounts(items) {
|
|
192
|
+
writeJson('accounts.json', items);
|
|
193
|
+
}
|
|
194
|
+
function isRecord(value) {
|
|
195
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
196
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { broadcast } from './hub.js';
|
|
4
|
+
import { schemes } from './schemes.js';
|
|
5
|
+
import { home, readJson, writeJson } from './storage.js';
|
|
6
|
+
export const version = '0.0.0';
|
|
7
|
+
const configFile = path.join(home, 'config.json');
|
|
8
|
+
export const defaults = {
|
|
9
|
+
theme: schemes[0].id,
|
|
10
|
+
composer: {
|
|
11
|
+
accountId: 'default',
|
|
12
|
+
model: 'haiku',
|
|
13
|
+
effort: 'low',
|
|
14
|
+
permissionMode: 'bypassPermissions',
|
|
15
|
+
},
|
|
16
|
+
terminal: {
|
|
17
|
+
shell: { macos: null, linux: null, windows: null },
|
|
18
|
+
font: {
|
|
19
|
+
family: 'FiraCode Nerd Font',
|
|
20
|
+
size: 14,
|
|
21
|
+
lineHeight: 1.35,
|
|
22
|
+
ligatures: true,
|
|
23
|
+
},
|
|
24
|
+
cursor: { style: 'bar', blink: true },
|
|
25
|
+
padding: { top: 4, right: 4, bottom: 0, left: 4 },
|
|
26
|
+
scrollback: 1000,
|
|
27
|
+
boldIsBright: true,
|
|
28
|
+
behavior: {
|
|
29
|
+
modernizeShiftEnter: true,
|
|
30
|
+
pasteBrowserImages: true,
|
|
31
|
+
showGitBranch: true,
|
|
32
|
+
captureShortcuts: true,
|
|
33
|
+
bellFlash: true,
|
|
34
|
+
bellSound: true,
|
|
35
|
+
terminalIdentity: 'offsite',
|
|
36
|
+
shellIntegration: true,
|
|
37
|
+
clickToMoveCursor: true,
|
|
38
|
+
optionAsMeta: 'off',
|
|
39
|
+
confirmCloseBusyTab: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const choices = {
|
|
44
|
+
theme: schemes.map((scheme) => scheme.id),
|
|
45
|
+
'composer.effort': ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
46
|
+
'composer.permissionMode': [
|
|
47
|
+
'default',
|
|
48
|
+
'acceptEdits',
|
|
49
|
+
'bypassPermissions',
|
|
50
|
+
'plan',
|
|
51
|
+
'dontAsk',
|
|
52
|
+
'auto',
|
|
53
|
+
],
|
|
54
|
+
'terminal.cursor.style': ['block', 'bar', 'underline'],
|
|
55
|
+
'terminal.behavior.terminalIdentity': ['offsite', 'ghostty', 'iterm2'],
|
|
56
|
+
'terminal.behavior.optionAsMeta': ['off', 'left', 'right', 'both'],
|
|
57
|
+
};
|
|
58
|
+
const nullable = [
|
|
59
|
+
'composer.model',
|
|
60
|
+
'composer.effort',
|
|
61
|
+
'composer.permissionMode',
|
|
62
|
+
'terminal.shell.macos',
|
|
63
|
+
'terminal.shell.linux',
|
|
64
|
+
'terminal.shell.windows',
|
|
65
|
+
];
|
|
66
|
+
const integers = [
|
|
67
|
+
'terminal.scrollback',
|
|
68
|
+
'terminal.padding.top',
|
|
69
|
+
'terminal.padding.right',
|
|
70
|
+
'terminal.padding.bottom',
|
|
71
|
+
'terminal.padding.left',
|
|
72
|
+
];
|
|
73
|
+
export function platform() {
|
|
74
|
+
if (process.platform === 'darwin')
|
|
75
|
+
return 'macos';
|
|
76
|
+
if (process.platform === 'linux')
|
|
77
|
+
return 'linux';
|
|
78
|
+
if (process.platform === 'win32')
|
|
79
|
+
return 'windows';
|
|
80
|
+
throw new Error(`unsupported platform ${process.platform}`);
|
|
81
|
+
}
|
|
82
|
+
export function defaultShell() {
|
|
83
|
+
if (process.platform === 'win32')
|
|
84
|
+
return process.env.COMSPEC ?? 'cmd.exe';
|
|
85
|
+
return os.userInfo().shell ?? '/bin/sh';
|
|
86
|
+
}
|
|
87
|
+
export function configInfo() {
|
|
88
|
+
return {
|
|
89
|
+
config: readConfig(),
|
|
90
|
+
defaults,
|
|
91
|
+
platform: platform(),
|
|
92
|
+
version,
|
|
93
|
+
defaultShell: defaultShell(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function readConfig() {
|
|
97
|
+
let user;
|
|
98
|
+
try {
|
|
99
|
+
user = readJson('config.json');
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.warn(`invalid ${configFile}, using the default config: ${error}`);
|
|
103
|
+
return structuredClone(defaults);
|
|
104
|
+
}
|
|
105
|
+
if (user === null)
|
|
106
|
+
return structuredClone(defaults);
|
|
107
|
+
if (!isObject(user)) {
|
|
108
|
+
console.warn(`${configFile} is not an object, using the default config`);
|
|
109
|
+
return structuredClone(defaults);
|
|
110
|
+
}
|
|
111
|
+
let config = structuredClone(defaults);
|
|
112
|
+
for (const [key, value] of Object.entries(user))
|
|
113
|
+
config = merge(config, [key], value);
|
|
114
|
+
return config;
|
|
115
|
+
}
|
|
116
|
+
export function saveConfig(value) {
|
|
117
|
+
const error = invalid(value, defaults, []);
|
|
118
|
+
if (error !== null)
|
|
119
|
+
throw new Error(error);
|
|
120
|
+
writeJson('config.json', value);
|
|
121
|
+
broadcast({ type: 'config', config: value });
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
function merge(config, keys, user) {
|
|
125
|
+
const template = keys.reduce((value, key) => (isObject(value) ? value[key] : undefined), config);
|
|
126
|
+
if (isObject(template) && isObject(user)) {
|
|
127
|
+
let next = config;
|
|
128
|
+
for (const [key, value] of Object.entries(user))
|
|
129
|
+
next = merge(next, [...keys, key], value);
|
|
130
|
+
return next;
|
|
131
|
+
}
|
|
132
|
+
const candidate = structuredClone(config);
|
|
133
|
+
const parent = keys
|
|
134
|
+
.slice(0, -1)
|
|
135
|
+
.reduce((value, key) => value[key], candidate);
|
|
136
|
+
parent[keys[keys.length - 1]] = user;
|
|
137
|
+
const error = invalid(candidate, defaults, []);
|
|
138
|
+
if (error === null)
|
|
139
|
+
return candidate;
|
|
140
|
+
console.warn(`invalid ${keys.join('.')} in ${configFile}, using its default: ${error}`);
|
|
141
|
+
return config;
|
|
142
|
+
}
|
|
143
|
+
function invalid(value, template, keys) {
|
|
144
|
+
const name = keys.join('.');
|
|
145
|
+
if (isObject(template)) {
|
|
146
|
+
if (!isObject(value))
|
|
147
|
+
return `${name || 'config'} must be an object`;
|
|
148
|
+
for (const key of Object.keys(value))
|
|
149
|
+
if (!(key in template))
|
|
150
|
+
return `unknown setting ${[...keys, key].join('.')}`;
|
|
151
|
+
for (const key of Object.keys(template)) {
|
|
152
|
+
if (!(key in value))
|
|
153
|
+
return `missing setting ${[...keys, key].join('.')}`;
|
|
154
|
+
const error = invalid(value[key], template[key], [...keys, key]);
|
|
155
|
+
if (error !== null)
|
|
156
|
+
return error;
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
if (nullable.includes(name) && value === null)
|
|
161
|
+
return null;
|
|
162
|
+
if (name in choices) {
|
|
163
|
+
if (choices[name].includes(value))
|
|
164
|
+
return null;
|
|
165
|
+
return `${name} must be one of ${choices[name].join(', ')}`;
|
|
166
|
+
}
|
|
167
|
+
if (template === null) {
|
|
168
|
+
if (typeof value === 'string')
|
|
169
|
+
return null;
|
|
170
|
+
return `${name} must be text or null`;
|
|
171
|
+
}
|
|
172
|
+
if (typeof value !== typeof template)
|
|
173
|
+
return `${name} must be a ${typeof template}`;
|
|
174
|
+
if (typeof value !== 'number')
|
|
175
|
+
return null;
|
|
176
|
+
if (!Number.isFinite(value) || value < 0)
|
|
177
|
+
return `${name} must be a number of at least 0`;
|
|
178
|
+
if (integers.includes(name) && !Number.isInteger(value))
|
|
179
|
+
return `${name} must be a whole number`;
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
function isObject(value) {
|
|
183
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
184
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export function toMessage(type, item, time) {
|
|
2
|
+
return {
|
|
3
|
+
type,
|
|
4
|
+
uuid: item.uuid,
|
|
5
|
+
time,
|
|
6
|
+
content: isRecord(item.message) ? toBlocks(item.message.content) : [],
|
|
7
|
+
parent: item.parent_tool_use_id,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function contextTokens(message) {
|
|
11
|
+
if (!isRecord(message) || !isRecord(message.usage))
|
|
12
|
+
return null;
|
|
13
|
+
const usage = message.usage;
|
|
14
|
+
return [
|
|
15
|
+
usage.input_tokens,
|
|
16
|
+
usage.cache_creation_input_tokens,
|
|
17
|
+
usage.cache_read_input_tokens,
|
|
18
|
+
usage.output_tokens,
|
|
19
|
+
].reduce((total, value) => total + (typeof value === 'number' ? value : 0), 0);
|
|
20
|
+
}
|
|
21
|
+
export function toContext(usage) {
|
|
22
|
+
const messages = usage.messageBreakdown;
|
|
23
|
+
const sections = [
|
|
24
|
+
{
|
|
25
|
+
title: 'Messages',
|
|
26
|
+
items: messages === undefined
|
|
27
|
+
? []
|
|
28
|
+
: [
|
|
29
|
+
{ name: 'User messages', tokens: messages.userMessageTokens },
|
|
30
|
+
{
|
|
31
|
+
name: 'Assistant messages',
|
|
32
|
+
tokens: messages.assistantMessageTokens,
|
|
33
|
+
},
|
|
34
|
+
{ name: 'Tool calls', tokens: messages.toolCallTokens },
|
|
35
|
+
{ name: 'Tool results', tokens: messages.toolResultTokens },
|
|
36
|
+
{ name: 'Attachments', tokens: messages.attachmentTokens },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Tools used',
|
|
41
|
+
items: (messages?.toolCallsByType ?? []).map((tool) => ({
|
|
42
|
+
name: tool.name,
|
|
43
|
+
tokens: tool.callTokens + tool.resultTokens,
|
|
44
|
+
})),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: 'Memory files',
|
|
48
|
+
items: usage.memoryFiles.map((file) => ({
|
|
49
|
+
name: file.path,
|
|
50
|
+
tokens: file.tokens,
|
|
51
|
+
})),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: 'MCP tools',
|
|
55
|
+
items: usage.mcpTools.map((tool) => ({
|
|
56
|
+
name: `${tool.serverName} · ${tool.name}`,
|
|
57
|
+
tokens: tool.tokens,
|
|
58
|
+
})),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: 'Agents',
|
|
62
|
+
items: usage.agents.map((agent) => ({
|
|
63
|
+
name: agent.agentType,
|
|
64
|
+
tokens: agent.tokens,
|
|
65
|
+
})),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: 'Skills',
|
|
69
|
+
items: (usage.skills?.skillFrontmatter ?? []).map((skill) => ({
|
|
70
|
+
name: skill.name,
|
|
71
|
+
tokens: skill.tokens,
|
|
72
|
+
})),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
title: 'Last response',
|
|
76
|
+
items: usage.apiUsage === null
|
|
77
|
+
? []
|
|
78
|
+
: [
|
|
79
|
+
{ name: 'Input', tokens: usage.apiUsage.input_tokens },
|
|
80
|
+
{
|
|
81
|
+
name: 'Cache read',
|
|
82
|
+
tokens: usage.apiUsage.cache_read_input_tokens,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'Cache write',
|
|
86
|
+
tokens: usage.apiUsage.cache_creation_input_tokens,
|
|
87
|
+
},
|
|
88
|
+
{ name: 'Output', tokens: usage.apiUsage.output_tokens },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
return {
|
|
93
|
+
tokens: usage.totalTokens,
|
|
94
|
+
window: usage.maxTokens,
|
|
95
|
+
model: usage.model,
|
|
96
|
+
categories: usage.categories.flatMap((category) => category.kind === 'deferred'
|
|
97
|
+
? []
|
|
98
|
+
: [
|
|
99
|
+
{
|
|
100
|
+
name: category.name,
|
|
101
|
+
tokens: category.tokens,
|
|
102
|
+
kind: category.kind,
|
|
103
|
+
},
|
|
104
|
+
]),
|
|
105
|
+
sections: sections
|
|
106
|
+
.map((section) => ({
|
|
107
|
+
title: section.title,
|
|
108
|
+
items: section.items.filter((item) => item.tokens > 0),
|
|
109
|
+
}))
|
|
110
|
+
.filter((section) => section.items.length > 0),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function toBlocks(content) {
|
|
114
|
+
if (typeof content === 'string')
|
|
115
|
+
return [{ type: 'text', text: content }];
|
|
116
|
+
if (!Array.isArray(content))
|
|
117
|
+
return [];
|
|
118
|
+
return content.flatMap((block) => {
|
|
119
|
+
if (!isRecord(block))
|
|
120
|
+
return [];
|
|
121
|
+
switch (block.type) {
|
|
122
|
+
case 'text':
|
|
123
|
+
return typeof block.text === 'string' &&
|
|
124
|
+
!block.text.startsWith('<system-reminder>') &&
|
|
125
|
+
!block.text.startsWith('<local-command-caveat>')
|
|
126
|
+
? [{ type: 'text', text: block.text }]
|
|
127
|
+
: [];
|
|
128
|
+
case 'thinking':
|
|
129
|
+
return typeof block.thinking === 'string' && block.thinking !== ''
|
|
130
|
+
? [{ type: 'thinking', thinking: block.thinking }]
|
|
131
|
+
: [];
|
|
132
|
+
case 'image': {
|
|
133
|
+
const source = block.source;
|
|
134
|
+
return isRecord(source) &&
|
|
135
|
+
source.type === 'base64' &&
|
|
136
|
+
typeof source.media_type === 'string' &&
|
|
137
|
+
typeof source.data === 'string'
|
|
138
|
+
? [{ type: 'image', mediaType: source.media_type, data: source.data }]
|
|
139
|
+
: [];
|
|
140
|
+
}
|
|
141
|
+
case 'tool_use':
|
|
142
|
+
return typeof block.id === 'string' &&
|
|
143
|
+
typeof block.name === 'string' &&
|
|
144
|
+
isRecord(block.input)
|
|
145
|
+
? [
|
|
146
|
+
{
|
|
147
|
+
type: 'tool_use',
|
|
148
|
+
id: block.id,
|
|
149
|
+
name: block.name,
|
|
150
|
+
input: block.input,
|
|
151
|
+
},
|
|
152
|
+
]
|
|
153
|
+
: [];
|
|
154
|
+
case 'tool_result':
|
|
155
|
+
return typeof block.tool_use_id === 'string'
|
|
156
|
+
? [
|
|
157
|
+
{
|
|
158
|
+
type: 'tool_result',
|
|
159
|
+
toolUseId: block.tool_use_id,
|
|
160
|
+
content: toBlocks(block.content),
|
|
161
|
+
isError: block.is_error === true,
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
: [];
|
|
165
|
+
default:
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function isRecord(value) {
|
|
171
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
172
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdirSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { git } from './git.js';
|
|
5
|
+
import { home } from './storage.js';
|
|
6
|
+
const FILE_LIMIT = 20_000;
|
|
7
|
+
const skipped = new Set(['node_modules', '.git', 'dist', 'target', '.next']);
|
|
8
|
+
export async function listFiles(cwd) {
|
|
9
|
+
try {
|
|
10
|
+
const { stdout } = await git(cwd, [
|
|
11
|
+
'ls-files',
|
|
12
|
+
'--cached',
|
|
13
|
+
'--others',
|
|
14
|
+
'--exclude-standard',
|
|
15
|
+
]);
|
|
16
|
+
return stdout.split('\n').filter(Boolean).slice(0, FILE_LIMIT);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return walk(cwd);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function saveUpload(name, data) {
|
|
23
|
+
const dir = path.join(home, 'uploads', randomUUID());
|
|
24
|
+
mkdirSync(dir, { recursive: true });
|
|
25
|
+
const file = path.join(dir, path.basename(name));
|
|
26
|
+
writeFileSync(file, data);
|
|
27
|
+
return file;
|
|
28
|
+
}
|
|
29
|
+
function walk(root) {
|
|
30
|
+
const files = [];
|
|
31
|
+
const pending = [''];
|
|
32
|
+
while (pending.length > 0 && files.length < FILE_LIMIT) {
|
|
33
|
+
const dir = pending.pop() ?? '';
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = readdirSync(path.join(root, dir), { withFileTypes: true });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const relative = dir === '' ? entry.name : `${dir}/${entry.name}`;
|
|
43
|
+
if (entry.isDirectory() && !skipped.has(entry.name))
|
|
44
|
+
pending.push(relative);
|
|
45
|
+
if (entry.isFile())
|
|
46
|
+
files.push(relative);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return files;
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { broadcast } from './hub.js';
|
|
2
|
+
import { readJson, writeJson } from './storage.js';
|
|
3
|
+
export function folders() {
|
|
4
|
+
return readJson('folders.json') ?? [];
|
|
5
|
+
}
|
|
6
|
+
export function saveFolders(next) {
|
|
7
|
+
if (!Array.isArray(next) || !next.every((item) => typeof item === 'string'))
|
|
8
|
+
throw new Error('folders must be a list of paths');
|
|
9
|
+
writeJson('folders.json', next);
|
|
10
|
+
broadcast({ type: 'folders', folders: next });
|
|
11
|
+
return next;
|
|
12
|
+
}
|