diffact 0.1.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/dist/agent-manager.d.ts +32 -0
- package/dist/agent-manager.js +502 -0
- package/dist/app-server-client.d.ts +38 -0
- package/dist/app-server-client.js +249 -0
- package/dist/capabilities.d.ts +2 -0
- package/dist/capabilities.js +27 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +13 -0
- package/dist/command-runner.d.ts +83 -0
- package/dist/command-runner.js +427 -0
- package/dist/editors.d.ts +26 -0
- package/dist/editors.js +144 -0
- package/dist/gh.d.ts +61 -0
- package/dist/gh.js +185 -0
- package/dist/git.d.ts +57 -0
- package/dist/git.js +482 -0
- package/dist/http.d.ts +7 -0
- package/dist/http.js +98 -0
- package/dist/index-node.d.ts +5 -0
- package/dist/index-node.js +51 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1011 -0
- package/dist/list-directories.d.ts +8 -0
- package/dist/list-directories.js +32 -0
- package/dist/log.d.ts +2 -0
- package/dist/log.js +2 -0
- package/dist/open-browser.d.ts +5 -0
- package/dist/open-browser.js +23 -0
- package/dist/project-commands.d.ts +17 -0
- package/dist/project-commands.js +152 -0
- package/dist/project-path.d.ts +5 -0
- package/dist/project-path.js +33 -0
- package/dist/runtime.d.ts +65 -0
- package/dist/runtime.js +235 -0
- package/dist/static.d.ts +10 -0
- package/dist/static.js +127 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +26 -0
- package/dist/ws-hub.d.ts +20 -0
- package/dist/ws-hub.js +123 -0
- package/package.json +61 -0
- package/web/dist/assets/abap-BdImnpbu.js +1 -0
- package/web/dist/assets/actionscript-3-CfeIJUat.js +1 -0
- package/web/dist/assets/ada-bCR0ucgS.js +1 -0
- package/web/dist/assets/andromeeda-C-Jbm3Hp.js +1 -0
- package/web/dist/assets/angular-html-CU67Zn6k.js +1 -0
- package/web/dist/assets/angular-ts-BwZT4LLn.js +1 -0
- package/web/dist/assets/apache-Pmp26Uib.js +1 -0
- package/web/dist/assets/apex-DDbsPZ6N.js +1 -0
- package/web/dist/assets/apl-dKokRX4l.js +1 -0
- package/web/dist/assets/applescript-Co6uUVPk.js +1 -0
- package/web/dist/assets/ara-BRHolxvo.js +1 -0
- package/web/dist/assets/asciidoc-Dv7Oe6Be.js +1 -0
- package/web/dist/assets/asm-D_Q5rh1f.js +1 -0
- package/web/dist/assets/astro-CbQHKStN.js +1 -0
- package/web/dist/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/web/dist/assets/awk-DMzUqQB5.js +1 -0
- package/web/dist/assets/ayu-dark-Cv9koXgw.js +1 -0
- package/web/dist/assets/ballerina-BFfxhgS-.js +1 -0
- package/web/dist/assets/bat-BkioyH1T.js +1 -0
- package/web/dist/assets/beancount-k_qm7-4y.js +1 -0
- package/web/dist/assets/berry-uYugtg8r.js +1 -0
- package/web/dist/assets/bibtex-CHM0blh-.js +1 -0
- package/web/dist/assets/bicep-Bmn6On1c.js +1 -0
- package/web/dist/assets/blade-DVc8C-J4.js +1 -0
- package/web/dist/assets/bsl-BO_Y6i37.js +1 -0
- package/web/dist/assets/c-BIGW1oBm.js +1 -0
- package/web/dist/assets/cadence-Bv_4Rxtq.js +1 -0
- package/web/dist/assets/cairo-KRGpt6FW.js +1 -0
- package/web/dist/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/web/dist/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/web/dist/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/web/dist/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/web/dist/assets/clarity-D53aC0YG.js +1 -0
- package/web/dist/assets/clojure-P80f7IUj.js +1 -0
- package/web/dist/assets/cmake-D1j8_8rp.js +1 -0
- package/web/dist/assets/cobol-nwyudZeR.js +1 -0
- package/web/dist/assets/code-block-37QAKDTI-C97XC0lL.js +2 -0
- package/web/dist/assets/codeowners-Bp6g37R7.js +1 -0
- package/web/dist/assets/codeql-DsOJ9woJ.js +1 -0
- package/web/dist/assets/coffee-Ch7k5sss.js +1 -0
- package/web/dist/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/web/dist/assets/coq-DkFqJrB1.js +1 -0
- package/web/dist/assets/cpp-CofmeUqb.js +1 -0
- package/web/dist/assets/crystal-tKQVLTB8.js +1 -0
- package/web/dist/assets/csharp-K5feNrxe.js +1 -0
- package/web/dist/assets/css-DPfMkruS.js +1 -0
- package/web/dist/assets/csv-fuZLfV_i.js +1 -0
- package/web/dist/assets/cue-D82EKSYY.js +1 -0
- package/web/dist/assets/cypher-COkxafJQ.js +1 -0
- package/web/dist/assets/d-85-TOEBH.js +1 -0
- package/web/dist/assets/dark-plus-C3mMm8J8.js +1 -0
- package/web/dist/assets/dart-CF10PKvl.js +1 -0
- package/web/dist/assets/dax-CEL-wOlO.js +1 -0
- package/web/dist/assets/desktop-BmXAJ9_W.js +1 -0
- package/web/dist/assets/diff-D97Zzqfu.js +1 -0
- package/web/dist/assets/docker-BcOcwvcX.js +1 -0
- package/web/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/web/dist/assets/dracula-BzJJZx-M.js +1 -0
- package/web/dist/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/web/dist/assets/dream-maker-BtqSS_iP.js +1 -0
- package/web/dist/assets/edge-BkV0erSs.js +1 -0
- package/web/dist/assets/elixir-CDX3lj18.js +1 -0
- package/web/dist/assets/elm-DbKCFpqz.js +1 -0
- package/web/dist/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/web/dist/assets/erb-BOJIQeun.js +1 -0
- package/web/dist/assets/erlang-DsQrWhSR.js +1 -0
- package/web/dist/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/web/dist/assets/everforest-light-C8M2exoo.js +1 -0
- package/web/dist/assets/fennel-BYunw83y.js +1 -0
- package/web/dist/assets/fish-BvzEVeQv.js +1 -0
- package/web/dist/assets/fluent-C4IJs8-o.js +1 -0
- package/web/dist/assets/fortran-fixed-form-BZjJHVRy.js +1 -0
- package/web/dist/assets/fortran-free-form-D22FLkUw.js +1 -0
- package/web/dist/assets/fsharp-CXgrBDvD.js +1 -0
- package/web/dist/assets/gdresource-B7Tvp0Sc.js +1 -0
- package/web/dist/assets/gdscript-DTMYz4Jt.js +1 -0
- package/web/dist/assets/gdshader-DkwncUOv.js +1 -0
- package/web/dist/assets/genie-D0YGMca9.js +1 -0
- package/web/dist/assets/gherkin-DyxjwDmM.js +1 -0
- package/web/dist/assets/git-commit-F4YmCXRG.js +1 -0
- package/web/dist/assets/git-rebase-r7XF79zn.js +1 -0
- package/web/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/web/dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/web/dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/web/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/web/dist/assets/github-light-DAi9KRSo.js +1 -0
- package/web/dist/assets/github-light-default-D7oLnXFd.js +1 -0
- package/web/dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/web/dist/assets/gleam-BspZqrRM.js +1 -0
- package/web/dist/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/web/dist/assets/glimmer-ts-U6CK756n.js +1 -0
- package/web/dist/assets/glsl-DplSGwfg.js +1 -0
- package/web/dist/assets/gnuplot-DdkO51Og.js +1 -0
- package/web/dist/assets/go-Dn2_MT6a.js +1 -0
- package/web/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/web/dist/assets/groovy-gcz8RCvz.js +1 -0
- package/web/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/web/dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/web/dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/web/dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/web/dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/web/dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/web/dist/assets/hack-CaT9iCJl.js +1 -0
- package/web/dist/assets/haml-B8DHNrY2.js +1 -0
- package/web/dist/assets/handlebars-BL8al0AC.js +1 -0
- package/web/dist/assets/haskell-Df6bDoY_.js +1 -0
- package/web/dist/assets/haxe-CzTSHFRz.js +1 -0
- package/web/dist/assets/hcl-BWvSN4gD.js +1 -0
- package/web/dist/assets/hjson-D5-asLiD.js +1 -0
- package/web/dist/assets/hlsl-D3lLCCz7.js +1 -0
- package/web/dist/assets/houston-DnULxvSX.js +1 -0
- package/web/dist/assets/html-GMplVEZG.js +1 -0
- package/web/dist/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/web/dist/assets/http-jrhK8wxY.js +1 -0
- package/web/dist/assets/hurl-irOxFIW8.js +1 -0
- package/web/dist/assets/hxml-Bvhsp5Yf.js +1 -0
- package/web/dist/assets/hy-DFXneXwc.js +1 -0
- package/web/dist/assets/imba-DGztddWO.js +1 -0
- package/web/dist/assets/index-CRDz04kv.css +1 -0
- package/web/dist/assets/index-DWCfDth4.js +1497 -0
- package/web/dist/assets/ini-BEwlwnbL.js +1 -0
- package/web/dist/assets/java-CylS5w8V.js +1 -0
- package/web/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/web/dist/assets/jinja-4LBKfQ-Z.js +1 -0
- package/web/dist/assets/jison-wvAkD_A8.js +1 -0
- package/web/dist/assets/json-Cp-IABpG.js +1 -0
- package/web/dist/assets/json5-C9tS-k6U.js +1 -0
- package/web/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/web/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/web/dist/assets/jsonnet-DFQXde-d.js +1 -0
- package/web/dist/assets/jssm-C2t-YnRu.js +1 -0
- package/web/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/web/dist/assets/julia-C8NyazO9.js +1 -0
- package/web/dist/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/web/dist/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/web/dist/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/web/dist/assets/kdl-DV7GczEv.js +1 -0
- package/web/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/web/dist/assets/kusto-BvAqAH-y.js +1 -0
- package/web/dist/assets/laserwave-DUszq2jm.js +1 -0
- package/web/dist/assets/latex-BdAV_C_H.js +1 -0
- package/web/dist/assets/lean-Bc6EcWN3.js +1 -0
- package/web/dist/assets/less-B1dDrJ26.js +1 -0
- package/web/dist/assets/light-plus-B7mTdjB0.js +1 -0
- package/web/dist/assets/liquid-DYVedYrR.js +1 -0
- package/web/dist/assets/llvm-BtvRca6l.js +1 -0
- package/web/dist/assets/log-2UxHyX5q.js +1 -0
- package/web/dist/assets/logo-BtOb2qkB.js +1 -0
- package/web/dist/assets/lua-BbnMAYS6.js +1 -0
- package/web/dist/assets/luau-CXu1NL6O.js +1 -0
- package/web/dist/assets/make-CHLpvVh8.js +1 -0
- package/web/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/web/dist/assets/marko-CPi9NSCl.js +1 -0
- package/web/dist/assets/material-theme-D5KoaKCx.js +1 -0
- package/web/dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/web/dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/web/dist/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/web/dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/web/dist/assets/matlab-D7o27uSR.js +1 -0
- package/web/dist/assets/mdc-DUICxH0z.js +1 -0
- package/web/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/web/dist/assets/mermaid-DKYwYmdq.js +1 -0
- package/web/dist/assets/min-dark-CafNBF8u.js +1 -0
- package/web/dist/assets/min-light-CTRr51gU.js +1 -0
- package/web/dist/assets/mipsasm-CKIfxQSi.js +1 -0
- package/web/dist/assets/mojo-1DNp92w6.js +1 -0
- package/web/dist/assets/monokai-D4h5O-jR.js +1 -0
- package/web/dist/assets/move-Bu9oaDYs.js +1 -0
- package/web/dist/assets/narrat-DRg8JJMk.js +1 -0
- package/web/dist/assets/nextflow-BrzmwbiE.js +1 -0
- package/web/dist/assets/nginx-DknmC5AR.js +1 -0
- package/web/dist/assets/night-owl-C39BiMTA.js +1 -0
- package/web/dist/assets/nim-CVrawwO9.js +1 -0
- package/web/dist/assets/nix-c8nO5XWb.js +1 -0
- package/web/dist/assets/nord-Ddv68eIx.js +1 -0
- package/web/dist/assets/nushell-C-sUppwS.js +1 -0
- package/web/dist/assets/objective-c-DXmwc3jG.js +1 -0
- package/web/dist/assets/objective-cpp-CLxacb5B.js +1 -0
- package/web/dist/assets/ocaml-C0hk2d4L.js +1 -0
- package/web/dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/web/dist/assets/one-light-PoHY5YXO.js +1 -0
- package/web/dist/assets/openscad-C4EeE6gA.js +1 -0
- package/web/dist/assets/pascal-D93ZcfNL.js +1 -0
- package/web/dist/assets/perl-C0TMdlhV.js +1 -0
- package/web/dist/assets/php-CDn_0X-4.js +1 -0
- package/web/dist/assets/pierre-dark-BXuwtOqb.js +1 -0
- package/web/dist/assets/pierre-light-dckrK0oj.js +1 -0
- package/web/dist/assets/pkl-u5AG7uiY.js +1 -0
- package/web/dist/assets/plastic-3e1v2bzS.js +1 -0
- package/web/dist/assets/plsql-ChMvpjG-.js +1 -0
- package/web/dist/assets/po-BTJTHyun.js +1 -0
- package/web/dist/assets/poimandres-CS3Unz2-.js +1 -0
- package/web/dist/assets/polar-C0HS_06l.js +1 -0
- package/web/dist/assets/postcss-CXtECtnM.js +1 -0
- package/web/dist/assets/powerquery-CEu0bR-o.js +1 -0
- package/web/dist/assets/powershell-Dpen1YoG.js +1 -0
- package/web/dist/assets/prisma-Dd19v3D-.js +1 -0
- package/web/dist/assets/prolog-CbFg5uaA.js +1 -0
- package/web/dist/assets/proto-DyJlTyXw.js +1 -0
- package/web/dist/assets/pug-CGlum2m_.js +1 -0
- package/web/dist/assets/puppet-BMWR74SV.js +1 -0
- package/web/dist/assets/purescript-CklMAg4u.js +1 -0
- package/web/dist/assets/python-B6aJPvgy.js +1 -0
- package/web/dist/assets/qml-3beO22l8.js +1 -0
- package/web/dist/assets/qmldir-C8lEn-DE.js +1 -0
- package/web/dist/assets/qss-IeuSbFQv.js +1 -0
- package/web/dist/assets/r-DiinP2Uv.js +1 -0
- package/web/dist/assets/racket-BqYA7rlc.js +1 -0
- package/web/dist/assets/raku-DXvB9xmW.js +1 -0
- package/web/dist/assets/razor-CE9lU5zL.js +1 -0
- package/web/dist/assets/red-bN70gL4F.js +1 -0
- package/web/dist/assets/reg-C-SQnVFl.js +1 -0
- package/web/dist/assets/regexp-CDVJQ6XC.js +1 -0
- package/web/dist/assets/rel-C3B-1QV4.js +1 -0
- package/web/dist/assets/riscv-BM1_JUlF.js +1 -0
- package/web/dist/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/web/dist/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/web/dist/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/web/dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/web/dist/assets/rst-B0xPkSld.js +1 -0
- package/web/dist/assets/ruby-BvKwtOVI.js +1 -0
- package/web/dist/assets/rust-B1yitclQ.js +1 -0
- package/web/dist/assets/sas-cz2c8ADy.js +1 -0
- package/web/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/web/dist/assets/scala-C151Ov-r.js +1 -0
- package/web/dist/assets/scheme-C98Dy4si.js +1 -0
- package/web/dist/assets/scss-OYdSNvt2.js +1 -0
- package/web/dist/assets/sdbl-DVxCFoDh.js +1 -0
- package/web/dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/web/dist/assets/shellscript-Yzrsuije.js +1 -0
- package/web/dist/assets/shellsession-BADoaaVG.js +1 -0
- package/web/dist/assets/slack-dark-BthQWCQV.js +1 -0
- package/web/dist/assets/slack-ochin-DqwNpetd.js +1 -0
- package/web/dist/assets/smalltalk-BERRCDM3.js +1 -0
- package/web/dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/web/dist/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/web/dist/assets/solarized-light-L9t79GZl.js +1 -0
- package/web/dist/assets/solidity-rGO070M0.js +1 -0
- package/web/dist/assets/soy-Brmx7dQM.js +1 -0
- package/web/dist/assets/sparql-rVzFXLq3.js +1 -0
- package/web/dist/assets/splunk-BtCnVYZw.js +1 -0
- package/web/dist/assets/sql-BLtJtn59.js +1 -0
- package/web/dist/assets/ssh-config-_ykCGR6B.js +1 -0
- package/web/dist/assets/stata-BH5u7GGu.js +1 -0
- package/web/dist/assets/stylus-BEDo0Tqx.js +1 -0
- package/web/dist/assets/svelte-3Dk4HxPD.js +1 -0
- package/web/dist/assets/swift-Dg5xB15N.js +1 -0
- package/web/dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/web/dist/assets/system-verilog-CnnmHF94.js +1 -0
- package/web/dist/assets/systemd-4A_iFExJ.js +1 -0
- package/web/dist/assets/talonscript-CkByrt1z.js +1 -0
- package/web/dist/assets/tasl-QIJgUcNo.js +1 -0
- package/web/dist/assets/tcl-dwOrl1Do.js +1 -0
- package/web/dist/assets/templ-W15q3VgB.js +1 -0
- package/web/dist/assets/terraform-BETggiCN.js +1 -0
- package/web/dist/assets/tex-CxkMU7Pf.js +1 -0
- package/web/dist/assets/tokyo-night-hegEt444.js +1 -0
- package/web/dist/assets/toml-vGWfd6FD.js +1 -0
- package/web/dist/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/web/dist/assets/tsv-B_m7g4N7.js +1 -0
- package/web/dist/assets/tsx-COt5Ahok.js +1 -0
- package/web/dist/assets/turtle-BsS91CYL.js +1 -0
- package/web/dist/assets/twig-CO9l9SDP.js +1 -0
- package/web/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/web/dist/assets/typespec-BGHnOYBU.js +1 -0
- package/web/dist/assets/typst-DHCkPAjA.js +1 -0
- package/web/dist/assets/v-BcVCzyr7.js +1 -0
- package/web/dist/assets/vala-CsfeWuGM.js +1 -0
- package/web/dist/assets/vb-D17OF-Vu.js +1 -0
- package/web/dist/assets/verilog-BQ8w6xss.js +1 -0
- package/web/dist/assets/vesper-DU1UobuO.js +1 -0
- package/web/dist/assets/vhdl-CeAyd5Ju.js +1 -0
- package/web/dist/assets/viml-CJc9bBzg.js +1 -0
- package/web/dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/web/dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/web/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/web/dist/assets/vue-DnHKYNfI.js +1 -0
- package/web/dist/assets/vue-html-CChd_i61.js +1 -0
- package/web/dist/assets/vue-vine-8moa0y9V.js +1 -0
- package/web/dist/assets/vyper-CDx5xZoG.js +1 -0
- package/web/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/web/dist/assets/wasm-MzD3tlZU.js +1 -0
- package/web/dist/assets/wenyan-BV7otONQ.js +1 -0
- package/web/dist/assets/wgsl-Dx-B1_4e.js +1 -0
- package/web/dist/assets/wikitext-BhOHFoWU.js +1 -0
- package/web/dist/assets/wit-5i3qLPDT.js +1 -0
- package/web/dist/assets/wolfram-lXgVvXCa.js +1 -0
- package/web/dist/assets/worker-C3lkbYoB.js +153 -0
- package/web/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/web/dist/assets/xsl-CtQFsRM5.js +1 -0
- package/web/dist/assets/yaml-Buea-lGh.js +1 -0
- package/web/dist/assets/zenscript-DVFEvuxE.js +1 -0
- package/web/dist/assets/zig-VOosw3JB.js +1 -0
- package/web/dist/index.html +19 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AgentInfo } from "./types.js";
|
|
2
|
+
import type { WsHub } from "./ws-hub.js";
|
|
3
|
+
export declare class AgentManager {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(params: {
|
|
6
|
+
hub: WsHub;
|
|
7
|
+
});
|
|
8
|
+
listAgents(): AgentInfo[];
|
|
9
|
+
listThreads(params: {
|
|
10
|
+
cursor?: string | null;
|
|
11
|
+
limit?: number | null;
|
|
12
|
+
projectPath?: string | null;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
getAgent(id: string): AgentInfo | null;
|
|
15
|
+
resumeThread(params: {
|
|
16
|
+
threadId: string;
|
|
17
|
+
projectPath: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
}): Promise<AgentInfo>;
|
|
20
|
+
startAgent(params: {
|
|
21
|
+
label?: string;
|
|
22
|
+
projectPath: string;
|
|
23
|
+
prompt: string;
|
|
24
|
+
}): Promise<AgentInfo>;
|
|
25
|
+
startThread(params: {
|
|
26
|
+
label?: string;
|
|
27
|
+
projectPath: string;
|
|
28
|
+
}): Promise<AgentInfo>;
|
|
29
|
+
stopAgent(id: string): boolean;
|
|
30
|
+
stopThread(threadId: string): boolean;
|
|
31
|
+
sendMessage(id: string, message: string): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { AppServerClient } from "./app-server-client.js";
|
|
2
|
+
import { resolveProjectRoot } from "./project-path.js";
|
|
3
|
+
import { createId } from "./utils.js";
|
|
4
|
+
const getApprovalPolicy = () => process.env.CODEX_APPROVAL_POLICY?.trim() || "on-request";
|
|
5
|
+
const getSandboxMode = () => process.env.CODEX_SANDBOX_MODE?.trim() || "workspace-write";
|
|
6
|
+
const parseTurnId = (params) => {
|
|
7
|
+
if (!params || typeof params !== "object") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const record = params;
|
|
11
|
+
const turn = record.turn;
|
|
12
|
+
if (turn && typeof turn === "object" && "id" in turn) {
|
|
13
|
+
const id = turn.id;
|
|
14
|
+
return typeof id === "string" ? id : null;
|
|
15
|
+
}
|
|
16
|
+
if ("turnId" in record) {
|
|
17
|
+
const id = record.turnId;
|
|
18
|
+
return typeof id === "string" ? id : null;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
const parseThreadId = (params) => {
|
|
23
|
+
if (!params || typeof params !== "object") {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const record = params;
|
|
27
|
+
if ("threadId" in record) {
|
|
28
|
+
const id = record.threadId;
|
|
29
|
+
return typeof id === "string" ? id : null;
|
|
30
|
+
}
|
|
31
|
+
const thread = record.thread;
|
|
32
|
+
if (thread && typeof thread === "object" && "id" in thread) {
|
|
33
|
+
const id = thread.id;
|
|
34
|
+
return typeof id === "string" ? id : null;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
38
|
+
const parseTurnError = (params) => {
|
|
39
|
+
if (!params || typeof params !== "object") {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const record = params;
|
|
43
|
+
const error = record.error;
|
|
44
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
45
|
+
const message = error.message;
|
|
46
|
+
return typeof message === "string" ? message : null;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
const FILTERED_THREAD_CURSOR_PREFIX = "project:";
|
|
51
|
+
const parseThreadListResponse = (value) => {
|
|
52
|
+
if (!value || typeof value !== "object") {
|
|
53
|
+
return { data: [], nextCursor: null };
|
|
54
|
+
}
|
|
55
|
+
const record = value;
|
|
56
|
+
const data = Array.isArray(record.data)
|
|
57
|
+
? record.data.filter((item) => Boolean(item) && typeof item === "object")
|
|
58
|
+
: [];
|
|
59
|
+
const nextCursor = typeof record.nextCursor === "string" ? record.nextCursor : null;
|
|
60
|
+
return { data, nextCursor };
|
|
61
|
+
};
|
|
62
|
+
const parseThreadListCursor = (cursor) => {
|
|
63
|
+
if (!cursor || !cursor.startsWith(FILTERED_THREAD_CURSOR_PREFIX)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const payload = cursor.slice(FILTERED_THREAD_CURSOR_PREFIX.length);
|
|
67
|
+
try {
|
|
68
|
+
const decoded = Buffer.from(payload, "base64").toString("utf8");
|
|
69
|
+
const parsed = JSON.parse(decoded);
|
|
70
|
+
if (!parsed || typeof parsed !== "object") {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const record = parsed;
|
|
74
|
+
const upstreamCursor = typeof record.upstreamCursor === "string" ? record.upstreamCursor : null;
|
|
75
|
+
const buffered = Array.isArray(record.buffered)
|
|
76
|
+
? record.buffered.filter((item) => Boolean(item) && typeof item === "object")
|
|
77
|
+
: [];
|
|
78
|
+
return { upstreamCursor, buffered };
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const serializeThreadListCursor = (state) => {
|
|
85
|
+
const payload = Buffer.from(JSON.stringify(state)).toString("base64");
|
|
86
|
+
return `${FILTERED_THREAD_CURSOR_PREFIX}${payload}`;
|
|
87
|
+
};
|
|
88
|
+
export class AgentManager {
|
|
89
|
+
#hub;
|
|
90
|
+
#agents = new Map();
|
|
91
|
+
#agentsByThread = new Map();
|
|
92
|
+
#client;
|
|
93
|
+
constructor(params) {
|
|
94
|
+
this.#hub = params.hub;
|
|
95
|
+
this.#client = new AppServerClient({
|
|
96
|
+
onNotification: (notification) => {
|
|
97
|
+
this.#routeNotification(notification);
|
|
98
|
+
},
|
|
99
|
+
onRequest: async (request) => this.#handleRequest(request),
|
|
100
|
+
onClose: (error) => {
|
|
101
|
+
this.#handleAppServerClose(error);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
listAgents() {
|
|
106
|
+
return Array.from(this.#agents.values()).map((agent) => this.#toAgentInfo(agent));
|
|
107
|
+
}
|
|
108
|
+
async listThreads(params) {
|
|
109
|
+
await this.#client.initialize({
|
|
110
|
+
name: "diffact",
|
|
111
|
+
title: "diffact",
|
|
112
|
+
version: "0.1.0",
|
|
113
|
+
});
|
|
114
|
+
if (!params.projectPath) {
|
|
115
|
+
return this.#client.request("thread/list", {
|
|
116
|
+
cursor: params.cursor ?? null,
|
|
117
|
+
limit: params.limit ?? null,
|
|
118
|
+
modelProviders: null,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const limit = params.limit ?? null;
|
|
122
|
+
const parsedCursor = parseThreadListCursor(params.cursor ?? null);
|
|
123
|
+
let upstreamCursor = parsedCursor?.upstreamCursor ?? params.cursor ?? null;
|
|
124
|
+
const buffered = (parsedCursor?.buffered ?? []).filter((item) => item.cwd === params.projectPath);
|
|
125
|
+
if (limit !== null && limit <= 0) {
|
|
126
|
+
return { data: [], nextCursor: null };
|
|
127
|
+
}
|
|
128
|
+
if (limit === null) {
|
|
129
|
+
const response = await this.#client.request("thread/list", {
|
|
130
|
+
cursor: upstreamCursor,
|
|
131
|
+
limit: null,
|
|
132
|
+
modelProviders: null,
|
|
133
|
+
});
|
|
134
|
+
const page = parseThreadListResponse(response);
|
|
135
|
+
return {
|
|
136
|
+
data: page.data.filter((item) => item.cwd === params.projectPath),
|
|
137
|
+
nextCursor: page.nextCursor,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (buffered.length >= limit) {
|
|
141
|
+
const remainder = buffered.slice(limit);
|
|
142
|
+
return {
|
|
143
|
+
data: buffered.slice(0, limit),
|
|
144
|
+
nextCursor: remainder.length
|
|
145
|
+
? serializeThreadListCursor({
|
|
146
|
+
upstreamCursor,
|
|
147
|
+
buffered: remainder,
|
|
148
|
+
})
|
|
149
|
+
: upstreamCursor,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const collected = buffered.slice();
|
|
153
|
+
const seen = new Set();
|
|
154
|
+
while (true) {
|
|
155
|
+
const response = await this.#client.request("thread/list", {
|
|
156
|
+
cursor: upstreamCursor,
|
|
157
|
+
limit,
|
|
158
|
+
modelProviders: null,
|
|
159
|
+
});
|
|
160
|
+
const page = parseThreadListResponse(response);
|
|
161
|
+
collected.push(...page.data.filter((item) => item.cwd === params.projectPath));
|
|
162
|
+
if (collected.length >= limit) {
|
|
163
|
+
const remainder = collected.slice(limit);
|
|
164
|
+
return {
|
|
165
|
+
data: collected.slice(0, limit),
|
|
166
|
+
nextCursor: remainder.length
|
|
167
|
+
? serializeThreadListCursor({
|
|
168
|
+
upstreamCursor: page.nextCursor ?? null,
|
|
169
|
+
buffered: remainder,
|
|
170
|
+
})
|
|
171
|
+
: (page.nextCursor ?? null),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (!page.nextCursor) {
|
|
175
|
+
return { data: collected, nextCursor: null };
|
|
176
|
+
}
|
|
177
|
+
if (seen.has(page.nextCursor)) {
|
|
178
|
+
return { data: collected, nextCursor: page.nextCursor };
|
|
179
|
+
}
|
|
180
|
+
seen.add(page.nextCursor);
|
|
181
|
+
upstreamCursor = page.nextCursor;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
getAgent(id) {
|
|
185
|
+
const agent = this.#agents.get(id);
|
|
186
|
+
return agent ? this.#toAgentInfo(agent) : null;
|
|
187
|
+
}
|
|
188
|
+
async resumeThread(params) {
|
|
189
|
+
const existing = this.#agentsByThread.get(params.threadId);
|
|
190
|
+
if (existing) {
|
|
191
|
+
return this.#toAgentInfo(existing);
|
|
192
|
+
}
|
|
193
|
+
const id = createId();
|
|
194
|
+
const now = new Date().toISOString();
|
|
195
|
+
const runtime = {
|
|
196
|
+
id,
|
|
197
|
+
label: params.label || `thread-${params.threadId.slice(0, 6)}`,
|
|
198
|
+
status: "completed",
|
|
199
|
+
createdAt: now,
|
|
200
|
+
projectPath: params.projectPath,
|
|
201
|
+
threadId: params.threadId,
|
|
202
|
+
lastError: undefined,
|
|
203
|
+
exitCode: null,
|
|
204
|
+
signal: null,
|
|
205
|
+
stoppedByUser: false,
|
|
206
|
+
activeTurnId: null,
|
|
207
|
+
};
|
|
208
|
+
this.#agents.set(id, runtime);
|
|
209
|
+
this.#agentsByThread.set(params.threadId, runtime);
|
|
210
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
211
|
+
try {
|
|
212
|
+
await this.#client.initialize({
|
|
213
|
+
name: "diffact",
|
|
214
|
+
title: "diffact",
|
|
215
|
+
version: "0.1.0",
|
|
216
|
+
});
|
|
217
|
+
const threadResponse = await this.#client.request("thread/resume", {
|
|
218
|
+
threadId: params.threadId,
|
|
219
|
+
});
|
|
220
|
+
const threadId = parseThreadId(threadResponse);
|
|
221
|
+
if (threadId && threadId !== params.threadId) {
|
|
222
|
+
runtime.threadId = threadId;
|
|
223
|
+
this.#agentsByThread.set(threadId, runtime);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
runtime.status = "error";
|
|
228
|
+
runtime.lastError =
|
|
229
|
+
error instanceof Error ? error.message : "app_server_error";
|
|
230
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
231
|
+
}
|
|
232
|
+
return this.#toAgentInfo(runtime);
|
|
233
|
+
}
|
|
234
|
+
async startAgent(params) {
|
|
235
|
+
const project = await resolveProjectRoot(params.projectPath);
|
|
236
|
+
const id = createId();
|
|
237
|
+
const now = new Date().toISOString();
|
|
238
|
+
const runtime = {
|
|
239
|
+
id,
|
|
240
|
+
label: params.label || `agent-${id.slice(0, 6)}`,
|
|
241
|
+
status: "starting",
|
|
242
|
+
createdAt: now,
|
|
243
|
+
projectPath: project.rootPath,
|
|
244
|
+
threadId: null,
|
|
245
|
+
lastError: undefined,
|
|
246
|
+
exitCode: null,
|
|
247
|
+
signal: null,
|
|
248
|
+
stoppedByUser: false,
|
|
249
|
+
activeTurnId: null,
|
|
250
|
+
};
|
|
251
|
+
this.#agents.set(id, runtime);
|
|
252
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
253
|
+
try {
|
|
254
|
+
await this.#client.initialize({
|
|
255
|
+
name: "diffact",
|
|
256
|
+
title: "diffact",
|
|
257
|
+
version: "0.1.0",
|
|
258
|
+
});
|
|
259
|
+
const threadResponse = await this.#client.request("thread/start", {
|
|
260
|
+
model: null,
|
|
261
|
+
modelProvider: null,
|
|
262
|
+
cwd: project.rootPath,
|
|
263
|
+
approvalPolicy: getApprovalPolicy(),
|
|
264
|
+
sandbox: getSandboxMode(),
|
|
265
|
+
config: null,
|
|
266
|
+
baseInstructions: null,
|
|
267
|
+
developerInstructions: null,
|
|
268
|
+
experimentalRawEvents: false,
|
|
269
|
+
});
|
|
270
|
+
const threadId = parseThreadId(threadResponse);
|
|
271
|
+
if (!threadId) {
|
|
272
|
+
throw new Error("app_server_thread_start_failed");
|
|
273
|
+
}
|
|
274
|
+
runtime.threadId = threadId;
|
|
275
|
+
this.#agentsByThread.set(threadId, runtime);
|
|
276
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
277
|
+
await this.#client.request("turn/start", {
|
|
278
|
+
threadId: runtime.threadId,
|
|
279
|
+
input: [{ type: "text", text: params.prompt }],
|
|
280
|
+
cwd: null,
|
|
281
|
+
approvalPolicy: null,
|
|
282
|
+
sandboxPolicy: null,
|
|
283
|
+
model: null,
|
|
284
|
+
effort: null,
|
|
285
|
+
summary: null,
|
|
286
|
+
outputSchema: null,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
runtime.status = "error";
|
|
291
|
+
runtime.lastError =
|
|
292
|
+
error instanceof Error ? error.message : "app_server_error";
|
|
293
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
294
|
+
}
|
|
295
|
+
return this.#toAgentInfo(runtime);
|
|
296
|
+
}
|
|
297
|
+
async startThread(params) {
|
|
298
|
+
const project = await resolveProjectRoot(params.projectPath);
|
|
299
|
+
const id = createId();
|
|
300
|
+
const now = new Date().toISOString();
|
|
301
|
+
const runtime = {
|
|
302
|
+
id,
|
|
303
|
+
label: params.label || `thread-${id.slice(0, 6)}`,
|
|
304
|
+
status: "starting",
|
|
305
|
+
createdAt: now,
|
|
306
|
+
projectPath: project.rootPath,
|
|
307
|
+
threadId: null,
|
|
308
|
+
lastError: undefined,
|
|
309
|
+
exitCode: null,
|
|
310
|
+
signal: null,
|
|
311
|
+
stoppedByUser: false,
|
|
312
|
+
activeTurnId: null,
|
|
313
|
+
};
|
|
314
|
+
this.#agents.set(id, runtime);
|
|
315
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
316
|
+
try {
|
|
317
|
+
await this.#client.initialize({
|
|
318
|
+
name: "diffact",
|
|
319
|
+
title: "diffact",
|
|
320
|
+
version: "0.1.0",
|
|
321
|
+
});
|
|
322
|
+
const threadResponse = await this.#client.request("thread/start", {
|
|
323
|
+
model: null,
|
|
324
|
+
modelProvider: null,
|
|
325
|
+
cwd: project.rootPath,
|
|
326
|
+
approvalPolicy: getApprovalPolicy(),
|
|
327
|
+
sandbox: getSandboxMode(),
|
|
328
|
+
config: null,
|
|
329
|
+
baseInstructions: null,
|
|
330
|
+
developerInstructions: null,
|
|
331
|
+
experimentalRawEvents: false,
|
|
332
|
+
});
|
|
333
|
+
const threadId = parseThreadId(threadResponse);
|
|
334
|
+
if (!threadId) {
|
|
335
|
+
throw new Error("app_server_thread_start_failed");
|
|
336
|
+
}
|
|
337
|
+
runtime.threadId = threadId;
|
|
338
|
+
runtime.status = "completed";
|
|
339
|
+
this.#agentsByThread.set(threadId, runtime);
|
|
340
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
runtime.status = "error";
|
|
344
|
+
runtime.lastError =
|
|
345
|
+
error instanceof Error ? error.message : "app_server_error";
|
|
346
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
347
|
+
}
|
|
348
|
+
return this.#toAgentInfo(runtime);
|
|
349
|
+
}
|
|
350
|
+
stopAgent(id) {
|
|
351
|
+
const agent = this.#agents.get(id);
|
|
352
|
+
if (!agent) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
agent.stoppedByUser = true;
|
|
356
|
+
agent.status = "stopped";
|
|
357
|
+
if (agent.threadId && agent.activeTurnId) {
|
|
358
|
+
this.#client
|
|
359
|
+
.request("turn/interrupt", {
|
|
360
|
+
threadId: agent.threadId,
|
|
361
|
+
turnId: agent.activeTurnId,
|
|
362
|
+
})
|
|
363
|
+
.catch(() => { });
|
|
364
|
+
}
|
|
365
|
+
if (agent.threadId) {
|
|
366
|
+
this.#agentsByThread.delete(agent.threadId);
|
|
367
|
+
}
|
|
368
|
+
this.#hub.send("agent_status", this.#toAgentInfo(agent));
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
stopThread(threadId) {
|
|
372
|
+
const runtime = this.#agentsByThread.get(threadId);
|
|
373
|
+
if (!runtime) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
return this.stopAgent(runtime.id);
|
|
377
|
+
}
|
|
378
|
+
async sendMessage(id, message) {
|
|
379
|
+
const agent = this.#agents.get(id);
|
|
380
|
+
if (!agent || !agent.threadId) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
agent.status = "running";
|
|
384
|
+
agent.lastError = undefined;
|
|
385
|
+
this.#hub.send("agent_status", this.#toAgentInfo(agent));
|
|
386
|
+
try {
|
|
387
|
+
await this.#client.initialize({
|
|
388
|
+
name: "diffact",
|
|
389
|
+
title: "diffact",
|
|
390
|
+
version: "0.1.0",
|
|
391
|
+
});
|
|
392
|
+
await this.#client.request("turn/start", {
|
|
393
|
+
threadId: agent.threadId,
|
|
394
|
+
input: [{ type: "text", text: message }],
|
|
395
|
+
cwd: null,
|
|
396
|
+
approvalPolicy: null,
|
|
397
|
+
sandboxPolicy: null,
|
|
398
|
+
model: null,
|
|
399
|
+
effort: null,
|
|
400
|
+
summary: null,
|
|
401
|
+
outputSchema: null,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
agent.status = "error";
|
|
406
|
+
agent.lastError =
|
|
407
|
+
error instanceof Error ? error.message : "app_server_error";
|
|
408
|
+
this.#hub.send("agent_status", this.#toAgentInfo(agent));
|
|
409
|
+
}
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
#routeNotification(notification) {
|
|
413
|
+
const threadId = parseThreadId(notification.params);
|
|
414
|
+
if (threadId) {
|
|
415
|
+
const runtime = this.#agentsByThread.get(threadId);
|
|
416
|
+
if (runtime && !runtime.stoppedByUser) {
|
|
417
|
+
this.#handleNotification(runtime, notification);
|
|
418
|
+
}
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
for (const runtime of this.#agents.values()) {
|
|
422
|
+
if (runtime.stoppedByUser) {
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
this.#handleNotification(runtime, notification);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
#handleNotification(runtime, notification) {
|
|
429
|
+
let statusChanged = false;
|
|
430
|
+
if (notification.method === "thread/started") {
|
|
431
|
+
const threadId = parseThreadId(notification.params);
|
|
432
|
+
if (threadId) {
|
|
433
|
+
runtime.threadId = threadId;
|
|
434
|
+
this.#agentsByThread.set(threadId, runtime);
|
|
435
|
+
statusChanged = true;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (notification.method === "turn/started") {
|
|
439
|
+
runtime.status = "running";
|
|
440
|
+
runtime.activeTurnId = parseTurnId(notification.params);
|
|
441
|
+
statusChanged = true;
|
|
442
|
+
}
|
|
443
|
+
if (notification.method === "turn/completed") {
|
|
444
|
+
runtime.status = "completed";
|
|
445
|
+
runtime.activeTurnId = null;
|
|
446
|
+
statusChanged = true;
|
|
447
|
+
}
|
|
448
|
+
if (notification.method === "error") {
|
|
449
|
+
runtime.status = "error";
|
|
450
|
+
runtime.lastError = parseTurnError(notification.params) || "turn_error";
|
|
451
|
+
statusChanged = true;
|
|
452
|
+
}
|
|
453
|
+
if (statusChanged) {
|
|
454
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
455
|
+
}
|
|
456
|
+
this.#hub.send("agent_event", {
|
|
457
|
+
projectPath: runtime.projectPath,
|
|
458
|
+
threadId: runtime.threadId,
|
|
459
|
+
event: notification,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
#handleAppServerClose(error) {
|
|
463
|
+
this.#agentsByThread.clear();
|
|
464
|
+
for (const runtime of this.#agents.values()) {
|
|
465
|
+
if (runtime.stoppedByUser) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
runtime.status = "error";
|
|
469
|
+
runtime.lastError = error?.message || "app_server_closed";
|
|
470
|
+
runtime.activeTurnId = null;
|
|
471
|
+
this.#hub.send("agent_status", this.#toAgentInfo(runtime));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
async #handleRequest(request) {
|
|
475
|
+
if (request.method === "item/commandExecution/requestApproval") {
|
|
476
|
+
return { decision: "accept" };
|
|
477
|
+
}
|
|
478
|
+
if (request.method === "item/fileChange/requestApproval") {
|
|
479
|
+
return { decision: "accept" };
|
|
480
|
+
}
|
|
481
|
+
if (request.method === "applyPatchApproval") {
|
|
482
|
+
return { decision: "approved" };
|
|
483
|
+
}
|
|
484
|
+
if (request.method === "execCommandApproval") {
|
|
485
|
+
return { decision: "approved" };
|
|
486
|
+
}
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
489
|
+
#toAgentInfo(agent) {
|
|
490
|
+
return {
|
|
491
|
+
id: agent.id,
|
|
492
|
+
label: agent.label,
|
|
493
|
+
status: agent.status,
|
|
494
|
+
createdAt: agent.createdAt,
|
|
495
|
+
projectPath: agent.projectPath,
|
|
496
|
+
threadId: agent.threadId ?? null,
|
|
497
|
+
lastError: agent.lastError,
|
|
498
|
+
exitCode: agent.exitCode ?? null,
|
|
499
|
+
signal: agent.signal ?? null,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type RequestId = string | number;
|
|
2
|
+
export type AppServerMessage = {
|
|
3
|
+
id?: RequestId;
|
|
4
|
+
method?: string;
|
|
5
|
+
params?: unknown;
|
|
6
|
+
result?: unknown;
|
|
7
|
+
error?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type AppServerNotification = {
|
|
10
|
+
method: string;
|
|
11
|
+
params?: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type AppServerRequest = {
|
|
14
|
+
id: RequestId;
|
|
15
|
+
method: string;
|
|
16
|
+
params?: unknown;
|
|
17
|
+
};
|
|
18
|
+
type AppServerClientOptions = {
|
|
19
|
+
command?: string;
|
|
20
|
+
args?: string[];
|
|
21
|
+
onNotification?: (notification: AppServerNotification) => void;
|
|
22
|
+
onRequest?: (request: AppServerRequest) => Promise<unknown> | unknown;
|
|
23
|
+
onClose?: (error?: Error) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare class AppServerClient {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(options: AppServerClientOptions);
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
initialize(params: {
|
|
30
|
+
name: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
version: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
request(method: string, params?: unknown): Promise<unknown>;
|
|
35
|
+
notify(method: string, params?: unknown): void;
|
|
36
|
+
close(): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|