@sunshinelife83/hearth 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/LICENSE +21 -0
- package/README.md +323 -0
- package/bin/hearth-agentd.js +4 -0
- package/bin/hearth.js +4 -0
- package/bin/run-entrypoint.js +20 -0
- package/dist/agent-tools.js +738 -0
- package/dist/app-version.js +16 -0
- package/dist/apply-patch.js +402 -0
- package/dist/artifact-error.js +8 -0
- package/dist/artifact-tools.js +377 -0
- package/dist/cli-workspace.js +36 -0
- package/dist/cli.js +1086 -0
- package/dist/config-migration.js +82 -0
- package/dist/config-schema.js +136 -0
- package/dist/config.js +115 -0
- package/dist/context/context-tools.js +150 -0
- package/dist/context/repo-map.js +102 -0
- package/dist/dashboard/app.js +226 -0
- package/dist/dashboard/index.html +45 -0
- package/dist/dashboard/landing.html +57 -0
- package/dist/dashboard/styles.css +23 -0
- package/dist/dashboard.js +271 -0
- package/dist/db/client.js +29 -0
- package/dist/db/migrations.js +262 -0
- package/dist/db/schema.js +85 -0
- package/dist/device-tokens.js +61 -0
- package/dist/git-worktrees.js +134 -0
- package/dist/git.js +41 -0
- package/dist/incoming-artifacts.js +378 -0
- package/dist/local-agent-acp.js +768 -0
- package/dist/local-agent-adapters.js +20 -0
- package/dist/local-agent-availability.js +92 -0
- package/dist/local-agent-catalog.js +51 -0
- package/dist/local-agent-claude.js +334 -0
- package/dist/local-agent-client.js +519 -0
- package/dist/local-agent-codex.js +532 -0
- package/dist/local-agent-config.js +34 -0
- package/dist/local-agent-daemon-lifecycle.js +195 -0
- package/dist/local-agent-daemon-main.js +86 -0
- package/dist/local-agent-daemon-protocol.js +302 -0
- package/dist/local-agent-daemon.js +407 -0
- package/dist/local-agent-errors.js +378 -0
- package/dist/local-agent-grok.js +202 -0
- package/dist/local-agent-manager.js +715 -0
- package/dist/local-agent-opencode.js +463 -0
- package/dist/local-agent-path.js +24 -0
- package/dist/local-agent-pi-sandbox.js +472 -0
- package/dist/local-agent-pi.js +298 -0
- package/dist/local-agent-presentation.js +104 -0
- package/dist/local-agent-profiles.js +127 -0
- package/dist/local-agent-runtime-pool.js +481 -0
- package/dist/local-agent-runtime.js +1 -0
- package/dist/local-agent-store.js +193 -0
- package/dist/local-agent-targets.js +97 -0
- package/dist/logger.js +97 -0
- package/dist/machine-id.js +35 -0
- package/dist/mcp-modern-server.js +65 -0
- package/dist/oauth-provider.js +331 -0
- package/dist/oauth-store.js +144 -0
- package/dist/onboarding.js +35 -0
- package/dist/orchestration/brief.js +70 -0
- package/dist/orchestration/lanes.js +145 -0
- package/dist/orchestration/result.js +46 -0
- package/dist/orchestration/scope.js +61 -0
- package/dist/pi-tools.js +58 -0
- package/dist/policy/command-policy.js +104 -0
- package/dist/policy/env-allowlist.js +96 -0
- package/dist/policy/sandbox.js +68 -0
- package/dist/policy/workspace-profiles.js +47 -0
- package/dist/process-journal.js +116 -0
- package/dist/process-platform.js +49 -0
- package/dist/process-sessions.js +388 -0
- package/dist/rate-limit.js +77 -0
- package/dist/request-meta.js +9 -0
- package/dist/review-checkpoints.js +349 -0
- package/dist/roots.js +37 -0
- package/dist/server-shutdown.js +12 -0
- package/dist/server.js +980 -0
- package/dist/skills.js +84 -0
- package/dist/snapshot-manager.js +123 -0
- package/dist/stdio-server.js +80 -0
- package/dist/task-store.js +203 -0
- package/dist/task-tools.js +455 -0
- package/dist/tool-surfaces/claude.js +220 -0
- package/dist/tool-surfaces/codex.js +255 -0
- package/dist/tool-surfaces/index.js +15 -0
- package/dist/tool-surfaces/shared.js +228 -0
- package/dist/tool-surfaces/types.js +27 -0
- package/dist/ui/.vite/manifest.json +2544 -0
- package/dist/ui/assets/abap-CLvhMVsD.js +1 -0
- package/dist/ui/assets/actionscript-3--17pq3dv.js +1 -0
- package/dist/ui/assets/ada-C5qYipkI.js +1 -0
- package/dist/ui/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/ui/assets/angular-html-DrbO3_Xe.js +1 -0
- package/dist/ui/assets/angular-ts-CmTVzHJx.js +1 -0
- package/dist/ui/assets/apache-U0d_L8uA.js +1 -0
- package/dist/ui/assets/apex-CGTLDQj6.js +1 -0
- package/dist/ui/assets/apl-BOpCpqXf.js +1 -0
- package/dist/ui/assets/applescript-CCn79oCD.js +1 -0
- package/dist/ui/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/ui/assets/asciidoc-DE70LPWp.js +1 -0
- package/dist/ui/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/ui/assets/astro-CxPeBwei.js +1 -0
- package/dist/ui/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/ui/assets/awk-BWXHIvNe.js +1 -0
- package/dist/ui/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/ui/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/ui/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/ui/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/ui/assets/bat-Bo4NYOV-.js +1 -0
- package/dist/ui/assets/beancount-D-usSTwE.js +1 -0
- package/dist/ui/assets/berry-DKpUyyne.js +1 -0
- package/dist/ui/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/ui/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/ui/assets/bird2-C2hNVINV.js +1 -0
- package/dist/ui/assets/blade-DtsAAG4P.js +1 -0
- package/dist/ui/assets/bsl-BkkzgIyY.js +1 -0
- package/dist/ui/assets/c-D9hLjNUM.js +1 -0
- package/dist/ui/assets/c3-CnJL0r0V.js +1 -0
- package/dist/ui/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/ui/assets/cairo-DLTphjLi.js +1 -0
- package/dist/ui/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
- package/dist/ui/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
- package/dist/ui/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
- package/dist/ui/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
- package/dist/ui/assets/clarity-SemFz856.js +1 -0
- package/dist/ui/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/ui/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/ui/assets/cobol-C1SWlvZm.js +1 -0
- package/dist/ui/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/ui/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/ui/assets/coffee-B71R3v2U.js +1 -0
- package/dist/ui/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/ui/assets/coq-BrsZFFmf.js +1 -0
- package/dist/ui/assets/cpp--5a4c3v4.js +1 -0
- package/dist/ui/assets/crystal-AtqWYtE0.js +1 -0
- package/dist/ui/assets/csharp-Ct8U2NOr.js +1 -0
- package/dist/ui/assets/css-CbqKSHI-.js +1 -0
- package/dist/ui/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/ui/assets/cue-CE9AQfxI.js +1 -0
- package/dist/ui/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/ui/assets/d-qD-0Kul2.js +1 -0
- package/dist/ui/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/ui/assets/dart-DkHntEIa.js +1 -0
- package/dist/ui/assets/dax-BkyTk9wS.js +1 -0
- package/dist/ui/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/ui/assets/diff-woXpYk--.js +1 -0
- package/dist/ui/assets/docker-IyjqRm3v.js +1 -0
- package/dist/ui/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/ui/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/ui/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/ui/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/ui/assets/edge-BPwY_RrJ.js +1 -0
- package/dist/ui/assets/elixir-DVH2yLJf.js +1 -0
- package/dist/ui/assets/elm-BrleA6gS.js +1 -0
- package/dist/ui/assets/emacs-lisp-C9PiwqqW.js +1 -0
- package/dist/ui/assets/erb-2SHiYe30.js +1 -0
- package/dist/ui/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/ui/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/ui/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/ui/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/ui/assets/fish-BJitypiv.js +1 -0
- package/dist/ui/assets/fluent-C03EYrpw.js +1 -0
- package/dist/ui/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/ui/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/ui/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/ui/assets/gdresource-C0sCabJj.js +1 -0
- package/dist/ui/assets/gdscript-Cp2uCuqX.js +1 -0
- package/dist/ui/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/ui/assets/genie-CV2tkWYe.js +1 -0
- package/dist/ui/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/ui/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/ui/assets/git-rebase-Bc7atMaV.js +1 -0
- package/dist/ui/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/ui/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/ui/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/ui/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/ui/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/ui/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/ui/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/ui/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/ui/assets/glimmer-js-DXeTDPtW.js +1 -0
- package/dist/ui/assets/glimmer-ts-CEOoXHU4.js +1 -0
- package/dist/ui/assets/glsl-5-43-Gsg.js +1 -0
- package/dist/ui/assets/gn-ilITqXS6.js +1 -0
- package/dist/ui/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/ui/assets/go-BJwz_mda.js +1 -0
- package/dist/ui/assets/graphql-Bk7Ah1KA.js +1 -0
- package/dist/ui/assets/groovy-CacY0gHj.js +1 -0
- package/dist/ui/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/ui/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/ui/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/ui/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/ui/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/ui/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/ui/assets/hack-DUHz4rCJ.js +1 -0
- package/dist/ui/assets/haml-BPCuuTPR.js +1 -0
- package/dist/ui/assets/handlebars-CHxmUsnU.js +1 -0
- package/dist/ui/assets/haskell-D8IpX4py.js +1 -0
- package/dist/ui/assets/haxe-OTjmBuCE.js +1 -0
- package/dist/ui/assets/hcl-Dh228itO.js +1 -0
- package/dist/ui/assets/hjson-CxZEssPk.js +1 -0
- package/dist/ui/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/ui/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/ui/assets/horizon-bright-Br1oVSNq.js +1 -0
- package/dist/ui/assets/houston-CsvMBhTu.js +1 -0
- package/dist/ui/assets/html-BBJqizz0.js +1 -0
- package/dist/ui/assets/html-derivative-ShTPCcKN.js +1 -0
- package/dist/ui/assets/http-VFTyziwA.js +1 -0
- package/dist/ui/assets/hurl-B8yxTa4r.js +1 -0
- package/dist/ui/assets/hxml-B0Qn7Nwc.js +1 -0
- package/dist/ui/assets/hy-CZbG8q4J.js +1 -0
- package/dist/ui/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/ui/assets/ini-B5eOa1yu.js +1 -0
- package/dist/ui/assets/java-BZ5DAgJZ.js +1 -0
- package/dist/ui/assets/javascript-C_zuIEaC.js +1 -0
- package/dist/ui/assets/jinja-DWd6xfNr.js +1 -0
- package/dist/ui/assets/jison-BbY63d1V.js +1 -0
- package/dist/ui/assets/json-C4DnajZs.js +1 -0
- package/dist/ui/assets/json5-BR5RXkoi.js +1 -0
- package/dist/ui/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/ui/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/ui/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/ui/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/ui/assets/jsx-C4AACieZ.js +1 -0
- package/dist/ui/assets/julia-sRu7EFMW.js +1 -0
- package/dist/ui/assets/just-DpZ9Sx1v.js +1 -0
- package/dist/ui/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
- package/dist/ui/assets/kanagawa-lotus-BN08jTvb.js +1 -0
- package/dist/ui/assets/kanagawa-wave-CTweb8Dz.js +1 -0
- package/dist/ui/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/ui/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/ui/assets/kusto-BUv0MjJC.js +1 -0
- package/dist/ui/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/ui/assets/latex-B6a_uum7.js +1 -0
- package/dist/ui/assets/lean-CewbzKMR.js +1 -0
- package/dist/ui/assets/less-DVTAwKKz.js +1 -0
- package/dist/ui/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/ui/assets/liquid-B2sVpjjr.js +1 -0
- package/dist/ui/assets/llvm-Cm23YOpf.js +1 -0
- package/dist/ui/assets/log-BNLmms1o.js +1 -0
- package/dist/ui/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/ui/assets/lua-DxJJll61.js +1 -0
- package/dist/ui/assets/luau-CNKltnaQ.js +1 -0
- package/dist/ui/assets/make-Dixweg8N.js +1 -0
- package/dist/ui/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/ui/assets/marko-Dx8mw-Wx.js +1 -0
- package/dist/ui/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/ui/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/ui/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/ui/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/ui/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/ui/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/ui/assets/mdc-vNKeXEwR.js +1 -0
- package/dist/ui/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/ui/assets/mermaid-Bk4SNUv9.js +1 -0
- package/dist/ui/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/ui/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/ui/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/ui/assets/mojo-BgCJLMeH.js +1 -0
- package/dist/ui/assets/monokai-CdkpiU2Y.js +1 -0
- package/dist/ui/assets/moonbit-CaWjb8XO.js +1 -0
- package/dist/ui/assets/move-B1IS1UjX.js +1 -0
- package/dist/ui/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/ui/assets/nextflow-Bbiyy34d.js +1 -0
- package/dist/ui/assets/nextflow-groovy-Dc_ddanL.js +1 -0
- package/dist/ui/assets/nginx-DScQAGLT.js +1 -0
- package/dist/ui/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/ui/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/ui/assets/nim-lAJch9uT.js +1 -0
- package/dist/ui/assets/nix-IvuFDN5E.js +1 -0
- package/dist/ui/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/ui/assets/nushell-DcLAeLz5.js +1 -0
- package/dist/ui/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/ui/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/ui/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/ui/assets/odin-B1RWQWA5.js +1 -0
- package/dist/ui/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/ui/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/ui/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/ui/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/ui/assets/perl-C_GkVo_E.js +1 -0
- package/dist/ui/assets/php-DziV3K6J.js +1 -0
- package/dist/ui/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/ui/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/ui/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/ui/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/ui/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/ui/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/ui/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/ui/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/ui/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/ui/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/ui/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/ui/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/ui/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/ui/assets/po-BiJDBrnU.js +1 -0
- package/dist/ui/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/ui/assets/polar-C7UOKdEL.js +1 -0
- package/dist/ui/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/ui/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/ui/assets/powershell-DshXNtvi.js +1 -0
- package/dist/ui/assets/prisma-BsRQq5mF.js +1 -0
- package/dist/ui/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/ui/assets/proto-DB4EqR-F.js +1 -0
- package/dist/ui/assets/pug-z75UIWVK.js +1 -0
- package/dist/ui/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/ui/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/ui/assets/python-gzcpVVnB.js +1 -0
- package/dist/ui/assets/qml-Cmm4coz1.js +1 -0
- package/dist/ui/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/ui/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/ui/assets/r-Brd0axBE.js +1 -0
- package/dist/ui/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/ui/assets/raku-B3gFvitq.js +1 -0
- package/dist/ui/assets/razor-DSbwmoiu.js +1 -0
- package/dist/ui/assets/red-CJ3rzSJv.js +1 -0
- package/dist/ui/assets/reg-CRGYupPL.js +1 -0
- package/dist/ui/assets/regexp-Bs3Uk-pY.js +1 -0
- package/dist/ui/assets/rel-BtDbiS_P.js +1 -0
- package/dist/ui/assets/review-payload-CbwCBKB1.js +1580 -0
- package/dist/ui/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/ui/assets/ron-VUp2lXgN.js +1 -0
- package/dist/ui/assets/rose-pine-BthvhNj6.js +1 -0
- package/dist/ui/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
- package/dist/ui/assets/rose-pine-moon-hon4tzzS.js +1 -0
- package/dist/ui/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/ui/assets/rst-ChIyKpUC.js +1 -0
- package/dist/ui/assets/ruby-BdAmvOMO.js +1 -0
- package/dist/ui/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/ui/assets/sas-DpXn8hc5.js +1 -0
- package/dist/ui/assets/sass-DXrisJhu.js +1 -0
- package/dist/ui/assets/scala-DKOlJaKm.js +1 -0
- package/dist/ui/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/ui/assets/scss-atX1Uuef.js +1 -0
- package/dist/ui/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/ui/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/ui/assets/shellscript-BqgcAeMK.js +1 -0
- package/dist/ui/assets/shellsession-DfQSMRN5.js +1 -0
- package/dist/ui/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/ui/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/ui/assets/smalltalk-B16xEiuN.js +1 -0
- package/dist/ui/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/ui/assets/solarized-dark-DV17i1UV.js +1 -0
- package/dist/ui/assets/solarized-light-DSh2HLQt.js +1 -0
- package/dist/ui/assets/solidity-CKzVLygQ.js +1 -0
- package/dist/ui/assets/soy-DzP7zZTB.js +1 -0
- package/dist/ui/assets/sparql-D_iOobhT.js +1 -0
- package/dist/ui/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/ui/assets/sql-gmaLk66z.js +1 -0
- package/dist/ui/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/ui/assets/stata-CJ0YTMcV.js +1 -0
- package/dist/ui/assets/stylus-B6D30XZt.js +1 -0
- package/dist/ui/assets/surrealql-LH7FciQz.js +1 -0
- package/dist/ui/assets/svelte-BME2PU6V.js +1 -0
- package/dist/ui/assets/swift-DonLKvLd.js +1 -0
- package/dist/ui/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/ui/assets/system-verilog-DJ5XKQeo.js +1 -0
- package/dist/ui/assets/systemd-BxMlprV5.js +1 -0
- package/dist/ui/assets/talonscript-CohzipZa.js +1 -0
- package/dist/ui/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/ui/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/ui/assets/templ-DHBNIfYW.js +1 -0
- package/dist/ui/assets/terraform-DswuEJGm.js +1 -0
- package/dist/ui/assets/tex-C8-kPEzO.js +1 -0
- package/dist/ui/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/ui/assets/toml-CcmNWLt0.js +1 -0
- package/dist/ui/assets/ts-tags-CiewV0vR.js +1 -0
- package/dist/ui/assets/tsv-sltzmVWM.js +1 -0
- package/dist/ui/assets/tsx-CUYPqmnq.js +1 -0
- package/dist/ui/assets/turtle-ByJddavk.js +1 -0
- package/dist/ui/assets/twig-BTkvsl0b.js +1 -0
- package/dist/ui/assets/typescript-DDQMaPwj.js +1 -0
- package/dist/ui/assets/typespec-B88KGewJ.js +1 -0
- package/dist/ui/assets/typst-DI99ib-x.js +1 -0
- package/dist/ui/assets/v-DETTlOr0.js +1 -0
- package/dist/ui/assets/vala-zf12oZj6.js +1 -0
- package/dist/ui/assets/vb-Djn5o6TS.js +1 -0
- package/dist/ui/assets/verilog-CiiDBU1e.js +1 -0
- package/dist/ui/assets/vesper-D5bVUKB1.js +1 -0
- package/dist/ui/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/ui/assets/viml-DvXPmvsu.js +1 -0
- package/dist/ui/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/ui/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/ui/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/ui/assets/vue-BH5SEWRH.js +1 -0
- package/dist/ui/assets/vue-html-BT7yeYez.js +1 -0
- package/dist/ui/assets/vue-vine-Cs5IN2rs.js +1 -0
- package/dist/ui/assets/vyper-CgoNMtux.js +1 -0
- package/dist/ui/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/ui/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/ui/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/ui/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/ui/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/ui/assets/wit-DdvCle-K.js +1 -0
- package/dist/ui/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/ui/assets/workspace-app-B_BnSEHO.css +1 -0
- package/dist/ui/assets/workspace-app-DSFpnrIC.js +115 -0
- package/dist/ui/assets/xml-D3_1BEcO.js +1 -0
- package/dist/ui/assets/xsl-BBOCDn4Y.js +1 -0
- package/dist/ui/assets/yaml-lThBDT45.js +1 -0
- package/dist/ui/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/ui/assets/zig-CMLA9XwU.js +1 -0
- package/dist/ui/workspace-app.html +15 -0
- package/dist/user-config.js +228 -0
- package/dist/verification.js +74 -0
- package/dist/workspace-store.js +133 -0
- package/dist/workspaces.js +433 -0
- package/docs/adr/devspace-x-implementation-adrs.md +159 -0
- package/docs/agent-profile-schema.md +203 -0
- package/docs/artifact-exchange.md +44 -0
- package/docs/assets/devspace-logo-light.png +0 -0
- package/docs/assets/devspace-screenshot.png +0 -0
- package/docs/assets/v11-review-ui-after.png +0 -0
- package/docs/assets/v11-review-ui-before.png +0 -0
- package/docs/chatgpt-coding-workflow.md +215 -0
- package/docs/configuration.md +217 -0
- package/docs/gotchas.md +294 -0
- package/docs/local-agent-daemon.md +101 -0
- package/docs/security.md +197 -0
- package/docs/setup.md +174 -0
- package/examples/agents/claude-implementer.md +30 -0
- package/examples/agents/codex-explorer.md +27 -0
- package/examples/agents/codex-qa-tester.md +29 -0
- package/examples/agents/codex-worker.md +25 -0
- package/examples/agents/copilot-reviewer.md +25 -0
- package/examples/agents/cursor-agent-worker.md +26 -0
- package/examples/agents/grok-builder.md +10 -0
- package/examples/agents/opencode-explorer.md +27 -0
- package/examples/agents/pi-reviewer.md +27 -0
- package/package.json +102 -0
- package/schema/v1/hearth.schema.json +529 -0
- package/scripts/copy-dashboard.mjs +9 -0
- package/scripts/fix-node-pty-permissions.mjs +22 -0
- package/scripts/generate-config-schema.ts +9 -0
- package/skills/subagents/SKILL.md +57 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { logEvent } from "../logger.js";
|
|
2
|
+
/**
|
|
3
|
+
* Environment filtering for model-invoked shell tools.
|
|
4
|
+
*
|
|
5
|
+
* Model-run commands must not inherit arbitrary user-environment variables:
|
|
6
|
+
* the environment commonly holds cloud/API credentials, and any command the
|
|
7
|
+
* model executes could read and exfiltrate them. Commands are instead given a
|
|
8
|
+
* conservative allowlist plus the Hearth workspace markers they legitimately
|
|
9
|
+
* need. Individual values can still be provided inline per command
|
|
10
|
+
* (`API_KEY=x cmd`) when the user chooses to.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_ENV_ALLOWLIST = [
|
|
13
|
+
// Identity and basics
|
|
14
|
+
"PATH",
|
|
15
|
+
"HOME",
|
|
16
|
+
"SHELL",
|
|
17
|
+
"USER",
|
|
18
|
+
"LOGNAME",
|
|
19
|
+
"LANG",
|
|
20
|
+
"LC_ALL",
|
|
21
|
+
"LC_CTYPE",
|
|
22
|
+
"TZ",
|
|
23
|
+
"TMPDIR",
|
|
24
|
+
"TEMP",
|
|
25
|
+
"TMP",
|
|
26
|
+
// Terminal/display conventions (Hearth also sets some of these explicitly)
|
|
27
|
+
"TERM",
|
|
28
|
+
"COLORTERM",
|
|
29
|
+
// XDG conventions used by many CLIs for config/cache locations
|
|
30
|
+
"XDG_CONFIG_HOME",
|
|
31
|
+
"XDG_CACHE_HOME",
|
|
32
|
+
"XDG_DATA_HOME",
|
|
33
|
+
"XDG_STATE_HOME",
|
|
34
|
+
// Proxy settings: required for network operations behind proxies
|
|
35
|
+
"HTTP_PROXY",
|
|
36
|
+
"HTTPS_PROXY",
|
|
37
|
+
"NO_PROXY",
|
|
38
|
+
"http_proxy",
|
|
39
|
+
"https_proxy",
|
|
40
|
+
"no_proxy",
|
|
41
|
+
// Windows essentials
|
|
42
|
+
"SystemRoot",
|
|
43
|
+
"windir",
|
|
44
|
+
"COMSPEC",
|
|
45
|
+
"PATHEXT",
|
|
46
|
+
"APPDATA",
|
|
47
|
+
"LOCALAPPDATA",
|
|
48
|
+
"PROGRAMFILES",
|
|
49
|
+
"ProgramFiles",
|
|
50
|
+
"USERPROFILE",
|
|
51
|
+
"HOMEDRIVE",
|
|
52
|
+
"HOMEPATH",
|
|
53
|
+
];
|
|
54
|
+
export function filterChildEnvironment(parentEnv, filter, context) {
|
|
55
|
+
const source = Object.fromEntries(Object.entries(parentEnv).filter((entry) => entry[1] !== undefined));
|
|
56
|
+
if (filter.allowAll) {
|
|
57
|
+
logEvent(context?.logging ?? silentLogging(), "debug", "env_filter_bypassed", {
|
|
58
|
+
allowAll: true,
|
|
59
|
+
workspaceId: context?.workspaceId,
|
|
60
|
+
});
|
|
61
|
+
return source;
|
|
62
|
+
}
|
|
63
|
+
const allowlist = new Set([...DEFAULT_ENV_ALLOWLIST, ...(filter.extraAllowlist ?? [])]);
|
|
64
|
+
if (context?.workspaceId) {
|
|
65
|
+
// Hearth's own non-secret workspace markers are always passed so CLI
|
|
66
|
+
// helpers invoked from tool shells can scope themselves.
|
|
67
|
+
allowlist.add("HEARTH_WORKSPACE_ID");
|
|
68
|
+
allowlist.add("HEARTH_WORKSPACE_ROOT");
|
|
69
|
+
}
|
|
70
|
+
allowlist.add("HEARTH_ORIGIN");
|
|
71
|
+
const result = {};
|
|
72
|
+
for (const [key, value] of Object.entries(source)) {
|
|
73
|
+
if (allowlist.has(key))
|
|
74
|
+
result[key] = value;
|
|
75
|
+
}
|
|
76
|
+
if (context?.logging) {
|
|
77
|
+
const dropped = Object.keys(source).length - Object.keys(result).length;
|
|
78
|
+
logEvent(context.logging, "debug", "env_filter_applied", {
|
|
79
|
+
kept: Object.keys(result).length,
|
|
80
|
+
dropped,
|
|
81
|
+
workspaceId: context.workspaceId,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
function silentLogging() {
|
|
87
|
+
return {
|
|
88
|
+
level: "silent",
|
|
89
|
+
format: "json",
|
|
90
|
+
requests: false,
|
|
91
|
+
assets: false,
|
|
92
|
+
toolCalls: false,
|
|
93
|
+
shellCommands: false,
|
|
94
|
+
trustProxy: false,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
let cachedAdapter;
|
|
3
|
+
export function resetSandboxProbeCache() {
|
|
4
|
+
cachedAdapter = undefined;
|
|
5
|
+
}
|
|
6
|
+
/** Probe (once per process) which sandbox adapter is usable. */
|
|
7
|
+
export function probeSandboxAdapter(platform = process.platform) {
|
|
8
|
+
if (cachedAdapter)
|
|
9
|
+
return cachedAdapter;
|
|
10
|
+
cachedAdapter = probe(platform);
|
|
11
|
+
return cachedAdapter;
|
|
12
|
+
}
|
|
13
|
+
function probe(platform) {
|
|
14
|
+
if (platform === "linux") {
|
|
15
|
+
return commandWorks("bwrap", ["--version"]) ? "bwrap" : "none";
|
|
16
|
+
}
|
|
17
|
+
if (platform === "darwin") {
|
|
18
|
+
return commandWorks("sandbox-exec", ["-h"]) ? "seatbelt" : "none";
|
|
19
|
+
}
|
|
20
|
+
return "none";
|
|
21
|
+
}
|
|
22
|
+
function commandWorks(command, args) {
|
|
23
|
+
try {
|
|
24
|
+
execFileSync(command, args, { stdio: "ignore", timeout: 5_000 });
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a resolved shell command so it runs inside the sandbox. The original
|
|
33
|
+
* shell invocation becomes the sandboxed child verbatim.
|
|
34
|
+
*/
|
|
35
|
+
export function wrapCommandWithSandbox(shell, adapter, options) {
|
|
36
|
+
if (adapter === "none")
|
|
37
|
+
return shell;
|
|
38
|
+
if (adapter === "bwrap") {
|
|
39
|
+
const args = [
|
|
40
|
+
"--ro-bind", "/", "/",
|
|
41
|
+
"--dev-bind", "/dev", "/dev",
|
|
42
|
+
"--proc", "/proc",
|
|
43
|
+
"--bind", options.workspaceRoot, options.workspaceRoot,
|
|
44
|
+
"--tmpfs", "/tmp",
|
|
45
|
+
"--tmpfs", "/run",
|
|
46
|
+
"--die-with-parent",
|
|
47
|
+
"--new-session",
|
|
48
|
+
...(options.allowNetwork ? [] : ["--unshare-net"]),
|
|
49
|
+
// "--" stops bwrap option parsing; without it a shell like
|
|
50
|
+
// `zsh -lc cmd` makes bwrap consume `-lc` as its own options.
|
|
51
|
+
"--",
|
|
52
|
+
shell.executable,
|
|
53
|
+
...shell.args,
|
|
54
|
+
];
|
|
55
|
+
return { executable: "bwrap", args };
|
|
56
|
+
}
|
|
57
|
+
// seatbelt: profile denies writes outside the workspace/temp, allows the rest.
|
|
58
|
+
const profile = [
|
|
59
|
+
"(version 1)",
|
|
60
|
+
"(allow default)",
|
|
61
|
+
"(deny file-write*)",
|
|
62
|
+
`(allow file-write* (subpath "${options.workspaceRoot}") (subpath "/private/tmp") (subpath "/tmp") (literal "/dev/null") (subpath "/dev/stdout") (subpath "/dev/stderr"))`,
|
|
63
|
+
].join(" ");
|
|
64
|
+
return {
|
|
65
|
+
executable: "sandbox-exec",
|
|
66
|
+
args: ["-p", profile, shell.executable, ...shell.args],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isPathInsideRoot } from "../roots.js";
|
|
2
|
+
export function resolveExecutionForWorkspace(config, workspaceRoot) {
|
|
3
|
+
let best;
|
|
4
|
+
for (const profile of config.workspaceProfiles) {
|
|
5
|
+
if (!isPathInsideRoot(workspaceRoot, profile.path))
|
|
6
|
+
continue;
|
|
7
|
+
if (!best || profile.path.length > best.path.length)
|
|
8
|
+
best = profile;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
mode: best?.mode ?? config.execution.mode,
|
|
12
|
+
sandbox: best?.sandbox,
|
|
13
|
+
sandboxNetwork: best?.sandboxNetwork,
|
|
14
|
+
requireSandboxForAutonomous: best?.requireSandboxForAutonomous ?? config.execution.requireSandboxForAutonomous,
|
|
15
|
+
commandAllow: best?.commandAllow ?? [],
|
|
16
|
+
commandDeny: best?.commandDeny ?? [],
|
|
17
|
+
agentsAllowed: best?.agentsAllowed ?? true,
|
|
18
|
+
...(best ? { profilePath: best.path } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Regex allow/deny command lists from the matched profile. */
|
|
22
|
+
export function commandListVerdict(resolved, command) {
|
|
23
|
+
for (const pattern of resolved.commandDeny) {
|
|
24
|
+
try {
|
|
25
|
+
if (new RegExp(pattern).test(command)) {
|
|
26
|
+
return { allowed: false, rule: `workspace commandDeny: /${pattern}/` };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Invalid user regex: skip rather than fail open silently? Fail closed.
|
|
31
|
+
return { allowed: false, rule: `workspace commandDeny has invalid regex: /${pattern}/` };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (resolved.commandAllow.length > 0) {
|
|
35
|
+
for (const pattern of resolved.commandAllow) {
|
|
36
|
+
try {
|
|
37
|
+
if (new RegExp(pattern).test(command))
|
|
38
|
+
return { allowed: true };
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return { allowed: false, rule: `workspace commandAllow has invalid regex: /${pattern}/` };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { allowed: false, rule: "command not in workspace commandAllow list" };
|
|
45
|
+
}
|
|
46
|
+
return { allowed: true };
|
|
47
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { readdir, readFile, rm, writeFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
const entryFile = (dir, pid) => join(dir, `proc-${pid}.json`);
|
|
6
|
+
export async function recordProcessJournal(dir, entry) {
|
|
7
|
+
await mkdir(dir, { recursive: true });
|
|
8
|
+
await writeFile(entryFile(dir, entry.pid), JSON.stringify(entry), { mode: 0o600 });
|
|
9
|
+
}
|
|
10
|
+
export async function removeProcessJournal(dir, pid) {
|
|
11
|
+
await rm(entryFile(dir, pid), { force: true });
|
|
12
|
+
}
|
|
13
|
+
export async function listProcessJournal(dir) {
|
|
14
|
+
let files;
|
|
15
|
+
try {
|
|
16
|
+
files = await readdir(dir);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const entries = [];
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
if (!file.startsWith("proc-") || !file.endsWith(".json"))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
const raw = await readFile(join(dir, file), "utf8");
|
|
27
|
+
const parsed = JSON.parse(raw);
|
|
28
|
+
if (typeof parsed.pid === "number" && parsed.pid > 1)
|
|
29
|
+
entries.push(parsed);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Corrupt entry: drop it on reap.
|
|
33
|
+
entries.push({ pid: -1, workspaceId: "", workspaceRoot: "", commandPreview: "", startedAt: "" });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return entries;
|
|
37
|
+
}
|
|
38
|
+
function procCmdline(pid) {
|
|
39
|
+
try {
|
|
40
|
+
if (process.platform === "linux" && existsSync(`/proc/${pid}/cmdline`)) {
|
|
41
|
+
const raw = execFileSync("cat", [`/proc/${pid}/cmdline`], { timeout: 3_000 });
|
|
42
|
+
return raw.toString("utf8").replaceAll("\0", " ");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const out = execFileSync("ps", ["-o", "command=", "-p", String(pid)], { timeout: 5_000 });
|
|
50
|
+
const text = out.toString("utf8").trim();
|
|
51
|
+
return text ? text : undefined;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function matchesEntry(cmdline, entry) {
|
|
58
|
+
if (entry.workspaceRoot && cmdline.includes(entry.workspaceRoot))
|
|
59
|
+
return true;
|
|
60
|
+
if (entry.commandPreview && entry.commandPreview.length >= 8 && cmdline.includes(entry.commandPreview.slice(0, 64))) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/** Reap stale journal entries. Never throws; reports per-entry outcomes. */
|
|
66
|
+
export async function reapProcessJournal(dir, audit = () => undefined) {
|
|
67
|
+
const report = { reaped: 0, skipped: 0, errors: [], details: [] };
|
|
68
|
+
const entries = await listProcessJournal(dir);
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
if (entry.pid <= 1) {
|
|
71
|
+
report.skipped += 1;
|
|
72
|
+
report.details.push(`dropped corrupt journal entry`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const cmdline = procCmdline(entry.pid);
|
|
76
|
+
if (cmdline === undefined) {
|
|
77
|
+
// No such process (or no way to confirm): drop the stale entry.
|
|
78
|
+
await removeProcessJournal(dir, entry.pid);
|
|
79
|
+
audit("orphan_reap_stale", { pid: entry.pid, workspaceId: entry.workspaceId });
|
|
80
|
+
report.skipped += 1;
|
|
81
|
+
report.details.push(`pid ${entry.pid}: not running, entry dropped`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!matchesEntry(cmdline, entry)) {
|
|
85
|
+
// PID reused by an unrelated process: never kill, just drop.
|
|
86
|
+
await removeProcessJournal(dir, entry.pid);
|
|
87
|
+
audit("orphan_reap_pid_reused", { pid: entry.pid, workspaceId: entry.workspaceId });
|
|
88
|
+
report.skipped += 1;
|
|
89
|
+
report.details.push(`pid ${entry.pid}: cmdline no longer matches, left alone`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
if (entry.pgid && entry.pgid > 1 && entry.pgid !== process.pid) {
|
|
94
|
+
try {
|
|
95
|
+
process.kill(-entry.pgid, "SIGTERM");
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
process.kill(entry.pid, "SIGTERM");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
process.kill(entry.pid, "SIGTERM");
|
|
103
|
+
}
|
|
104
|
+
await removeProcessJournal(dir, entry.pid);
|
|
105
|
+
audit("orphan_reaped", { pid: entry.pid, workspaceId: entry.workspaceId });
|
|
106
|
+
report.reaped += 1;
|
|
107
|
+
report.details.push(`pid ${entry.pid}: terminated`);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
111
|
+
report.errors.push(`pid ${entry.pid}: ${message}`);
|
|
112
|
+
report.details.push(`pid ${entry.pid}: kill failed (${message})`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return report;
|
|
116
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
const defaultProcessTreeRuntime = {
|
|
4
|
+
platform: process.platform,
|
|
5
|
+
killGroup: (pid, signal) => process.kill(-pid, signal),
|
|
6
|
+
killWindowsTree: (pid) => {
|
|
7
|
+
const result = spawnSync("taskkill.exe", ["/pid", String(pid), "/T", "/F"], {
|
|
8
|
+
stdio: "ignore",
|
|
9
|
+
windowsHide: true,
|
|
10
|
+
});
|
|
11
|
+
return !result.error && result.status === 0;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const LOGIN_SHELLS = new Set(["bash", "ksh", "zsh"]);
|
|
15
|
+
const POSIX_SHELLS = new Set(["ash", "dash", "sh"]);
|
|
16
|
+
export function resolveShellCommand(command, platform = process.platform, environment = process.env) {
|
|
17
|
+
if (platform === "win32") {
|
|
18
|
+
return {
|
|
19
|
+
executable: environment.ComSpec ?? environment.COMSPEC ?? "cmd.exe",
|
|
20
|
+
args: ["/d", "/s", "/c", command],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const configuredShell = environment.SHELL;
|
|
24
|
+
const shellName = configuredShell ? basename(configuredShell) : "";
|
|
25
|
+
if (configuredShell && LOGIN_SHELLS.has(shellName)) {
|
|
26
|
+
return { executable: configuredShell, args: ["-lc", command] };
|
|
27
|
+
}
|
|
28
|
+
if (configuredShell && POSIX_SHELLS.has(shellName)) {
|
|
29
|
+
return { executable: configuredShell, args: ["-c", command] };
|
|
30
|
+
}
|
|
31
|
+
return { executable: "/bin/sh", args: ["-c", command] };
|
|
32
|
+
}
|
|
33
|
+
export function terminateProcessTree(child, signal, detached, runtime = defaultProcessTreeRuntime) {
|
|
34
|
+
if (runtime.platform === "win32" && child.pid) {
|
|
35
|
+
if (runtime.killWindowsTree(child.pid))
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
else if (detached && child.pid) {
|
|
39
|
+
try {
|
|
40
|
+
runtime.killGroup(child.pid, signal);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error.code === "ESRCH")
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
child.kill(signal);
|
|
49
|
+
}
|