@pasko70/pibo 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/.codex/skills/pi-agent-harness/SKILL.md +319 -0
- package/.codex/skills/pi-agent-harness/agents/openai.yaml +4 -0
- package/README.md +318 -0
- package/context/codex-base-prompt.md +144 -0
- package/context/pibo-compaction-prompt.md +100 -0
- package/context/pibo-system-prompt.md +17 -0
- package/dist/apps/chat/agent-profiles.js +26 -0
- package/dist/apps/chat/agent-store.js +336 -0
- package/dist/apps/chat/event-log.js +307 -0
- package/dist/apps/chat/read-model.js +218 -0
- package/dist/apps/chat/rooms.js +321 -0
- package/dist/apps/chat/session-metadata.js +14 -0
- package/dist/apps/chat/stream.js +122 -0
- package/dist/apps/chat/trace.js +1182 -0
- package/dist/apps/chat/web-app.js +2569 -0
- package/dist/apps/chat-ui/assets/apl-BxEMbctQ.js +1 -0
- package/dist/apps/chat-ui/assets/asciiarmor-eFjeGRuZ.js +1 -0
- package/dist/apps/chat-ui/assets/asn1-Cfx-0pt9.js +1 -0
- package/dist/apps/chat-ui/assets/asterisk-B5BHTsBr.js +1 -0
- package/dist/apps/chat-ui/assets/brainfuck-CAA2xofr.js +1 -0
- package/dist/apps/chat-ui/assets/clike-BoDCOLzN.js +1 -0
- package/dist/apps/chat-ui/assets/clojure-kVFSWX0o.js +1 -0
- package/dist/apps/chat-ui/assets/cmake-BUPAhezI.js +1 -0
- package/dist/apps/chat-ui/assets/cobol-BfgHZgup.js +1 -0
- package/dist/apps/chat-ui/assets/coffeescript-G1Pe_1AZ.js +1 -0
- package/dist/apps/chat-ui/assets/commonlisp-B3N0CjHn.js +1 -0
- package/dist/apps/chat-ui/assets/crystal-C15ndaGM.js +1 -0
- package/dist/apps/chat-ui/assets/css-BqOeyZOV.js +1 -0
- package/dist/apps/chat-ui/assets/cypher-KjIKv-wW.js +1 -0
- package/dist/apps/chat-ui/assets/d-BlT5AEC-.js +1 -0
- package/dist/apps/chat-ui/assets/diff-oF98tbqj.js +1 -0
- package/dist/apps/chat-ui/assets/dist--55mTWk3.js +1 -0
- package/dist/apps/chat-ui/assets/dist-B5rcjVCj.js +1 -0
- package/dist/apps/chat-ui/assets/dist-BPv5MdlL.js +1 -0
- package/dist/apps/chat-ui/assets/dist-BZ39rB1W.js +1 -0
- package/dist/apps/chat-ui/assets/dist-BsedZGJo.js +1 -0
- package/dist/apps/chat-ui/assets/dist-BvO6SpaM.js +9 -0
- package/dist/apps/chat-ui/assets/dist-C5YJOwhH.js +1 -0
- package/dist/apps/chat-ui/assets/dist-C5oXtFSP.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CG_gRSwv.js +23 -0
- package/dist/apps/chat-ui/assets/dist-CKM5j-iy.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CUp9us2q.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CZ9T4Cly.js +1 -0
- package/dist/apps/chat-ui/assets/dist-D4HhiFWB.js +6 -0
- package/dist/apps/chat-ui/assets/dist-DHE-yBLH.js +1 -0
- package/dist/apps/chat-ui/assets/dist-DSKQpPaz.js +1 -0
- package/dist/apps/chat-ui/assets/dist-L1B-KWZO.js +1 -0
- package/dist/apps/chat-ui/assets/dist-SVPsM5Oi.js +13 -0
- package/dist/apps/chat-ui/assets/dist-Zqt9kNG9.js +1 -0
- package/dist/apps/chat-ui/assets/dist-_DPv0-QF.js +1 -0
- package/dist/apps/chat-ui/assets/dist-_oM7g0eh.js +11 -0
- package/dist/apps/chat-ui/assets/dist-laadbMWg.js +1 -0
- package/dist/apps/chat-ui/assets/dist-nFui3f-r.js +2 -0
- package/dist/apps/chat-ui/assets/dist-tGfufz3b.js +1 -0
- package/dist/apps/chat-ui/assets/dockerfile-CUaqzcqp.js +1 -0
- package/dist/apps/chat-ui/assets/dtd-VCA9yr61.js +1 -0
- package/dist/apps/chat-ui/assets/dylan-O-V5Dw5W.js +1 -0
- package/dist/apps/chat-ui/assets/ebnf-SPmdBkvT.js +1 -0
- package/dist/apps/chat-ui/assets/ecl-ChfCttfI.js +1 -0
- package/dist/apps/chat-ui/assets/eiffel-cB9EbjeN.js +1 -0
- package/dist/apps/chat-ui/assets/elm-BTiVflBU.js +1 -0
- package/dist/apps/chat-ui/assets/erlang-egf0TXFm.js +1 -0
- package/dist/apps/chat-ui/assets/factor-C2tAxNob.js +1 -0
- package/dist/apps/chat-ui/assets/fcl-BiCjh1tj.js +1 -0
- package/dist/apps/chat-ui/assets/forth-C4kDGW6u.js +1 -0
- package/dist/apps/chat-ui/assets/fortran-DzkLaPnd.js +1 -0
- package/dist/apps/chat-ui/assets/gas-DMOxskQF.js +1 -0
- package/dist/apps/chat-ui/assets/gherkin-BPxBpp-k.js +1 -0
- package/dist/apps/chat-ui/assets/groovy-CkEnc0ZY.js +1 -0
- package/dist/apps/chat-ui/assets/haskell-Dadpo9-w.js +1 -0
- package/dist/apps/chat-ui/assets/haxe-CDNZL9MW.js +1 -0
- package/dist/apps/chat-ui/assets/http-jy9Zxxt3.js +1 -0
- package/dist/apps/chat-ui/assets/idl-CGSB6iiy.js +1 -0
- package/dist/apps/chat-ui/assets/index-BdcqTugD.js +151 -0
- package/dist/apps/chat-ui/assets/index-Dk-opWl3.css +1 -0
- package/dist/apps/chat-ui/assets/javascript-DSlzRUd8.js +1 -0
- package/dist/apps/chat-ui/assets/julia-DTiF9v6R.js +1 -0
- package/dist/apps/chat-ui/assets/livescript-Ci8Xxna6.js +1 -0
- package/dist/apps/chat-ui/assets/lua-eVxIrt9t.js +1 -0
- package/dist/apps/chat-ui/assets/mathematica-Da3grj36.js +1 -0
- package/dist/apps/chat-ui/assets/mbox-BWBMSafM.js +1 -0
- package/dist/apps/chat-ui/assets/mirc-CtHu9S1B.js +1 -0
- package/dist/apps/chat-ui/assets/mllike-wTFlPWXS.js +1 -0
- package/dist/apps/chat-ui/assets/modelica-cKbQ0UXu.js +1 -0
- package/dist/apps/chat-ui/assets/mscgen-C5pXQCMK.js +1 -0
- package/dist/apps/chat-ui/assets/mumps-CKBHkOQq.js +1 -0
- package/dist/apps/chat-ui/assets/nginx-B00AiQel.js +1 -0
- package/dist/apps/chat-ui/assets/nsis-SMDwKltR.js +1 -0
- package/dist/apps/chat-ui/assets/ntriples-B_36EBV0.js +1 -0
- package/dist/apps/chat-ui/assets/octave-BXPjzAif.js +1 -0
- package/dist/apps/chat-ui/assets/oz-Dedpat1M.js +1 -0
- package/dist/apps/chat-ui/assets/pascal-CMcUg72K.js +1 -0
- package/dist/apps/chat-ui/assets/perl-DoVTbnzt.js +1 -0
- package/dist/apps/chat-ui/assets/pig-CULXT1YV.js +1 -0
- package/dist/apps/chat-ui/assets/powershell-Cv5Uhf6b.js +1 -0
- package/dist/apps/chat-ui/assets/properties-CQ1C2P-M.js +1 -0
- package/dist/apps/chat-ui/assets/protobuf-SRlvzrl6.js +1 -0
- package/dist/apps/chat-ui/assets/pug-Bo3wfL-f.js +1 -0
- package/dist/apps/chat-ui/assets/puppet-ClSqCGj6.js +1 -0
- package/dist/apps/chat-ui/assets/python-C2_X1GpX.js +1 -0
- package/dist/apps/chat-ui/assets/q-B_6Gdyzl.js +1 -0
- package/dist/apps/chat-ui/assets/r-BD07NGED.js +1 -0
- package/dist/apps/chat-ui/assets/rolldown-runtime-S-ySWqyJ.js +1 -0
- package/dist/apps/chat-ui/assets/rpm-CRu5Z2Jl.js +1 -0
- package/dist/apps/chat-ui/assets/ruby-dZPnOz8h.js +1 -0
- package/dist/apps/chat-ui/assets/sas-S2t8_sDI.js +1 -0
- package/dist/apps/chat-ui/assets/scheme-WcyFWLW2.js +1 -0
- package/dist/apps/chat-ui/assets/shell-DUelnYSh.js +1 -0
- package/dist/apps/chat-ui/assets/sieve-jDjlVhNh.js +1 -0
- package/dist/apps/chat-ui/assets/simple-mode-CL04yRVp.js +1 -0
- package/dist/apps/chat-ui/assets/smalltalk-ddWDYy10.js +1 -0
- package/dist/apps/chat-ui/assets/solr-C7rQhLuW.js +1 -0
- package/dist/apps/chat-ui/assets/sparql--fPCCgVd.js +1 -0
- package/dist/apps/chat-ui/assets/spreadsheet-DjthqD5G.js +1 -0
- package/dist/apps/chat-ui/assets/sql-D_dieYbr.js +1 -0
- package/dist/apps/chat-ui/assets/stex-rHcFYcA0.js +1 -0
- package/dist/apps/chat-ui/assets/stylus-DxF70RNr.js +1 -0
- package/dist/apps/chat-ui/assets/swift-T0hDoOb-.js +1 -0
- package/dist/apps/chat-ui/assets/tcl-Dlzy1mPk.js +1 -0
- package/dist/apps/chat-ui/assets/textile-Dy5rFZe5.js +1 -0
- package/dist/apps/chat-ui/assets/tiddlywiki-DQP1OymS.js +1 -0
- package/dist/apps/chat-ui/assets/tiki-0vOj3DB2.js +1 -0
- package/dist/apps/chat-ui/assets/toml-DEltN0lI.js +1 -0
- package/dist/apps/chat-ui/assets/troff-CRbBpEqY.js +1 -0
- package/dist/apps/chat-ui/assets/ttcn-M5q1nLKg.js +1 -0
- package/dist/apps/chat-ui/assets/ttcn-cfg-Rmw9NWq9.js +1 -0
- package/dist/apps/chat-ui/assets/turtle-BCDWhJK0.js +1 -0
- package/dist/apps/chat-ui/assets/vb-QQ7LGlOz.js +1 -0
- package/dist/apps/chat-ui/assets/vbscript-BiSEdUzz.js +1 -0
- package/dist/apps/chat-ui/assets/velocity-CzMg5_6w.js +1 -0
- package/dist/apps/chat-ui/assets/verilog-BJOO83gk.js +1 -0
- package/dist/apps/chat-ui/assets/vhdl-ed4zAZAA.js +1 -0
- package/dist/apps/chat-ui/assets/webidl-Ddy6hbV6.js +1 -0
- package/dist/apps/chat-ui/assets/xquery-Bw1zwhh6.js +1 -0
- package/dist/apps/chat-ui/assets/yacas-DZdTXy3s.js +1 -0
- package/dist/apps/chat-ui/assets/z80-DMG02_YV.js +1 -0
- package/dist/apps/chat-ui/index.html +15 -0
- package/dist/apps/context-files-ui/assets/apl-14BqhLYK.js +1 -0
- package/dist/apps/context-files-ui/assets/asciiarmor-WLvjqI7d.js +1 -0
- package/dist/apps/context-files-ui/assets/asn1-Bg4FbdCg.js +1 -0
- package/dist/apps/context-files-ui/assets/asterisk-B2MO-X4d.js +1 -0
- package/dist/apps/context-files-ui/assets/brainfuck-CV9kufud.js +1 -0
- package/dist/apps/context-files-ui/assets/clike-CjmcUpt6.js +1 -0
- package/dist/apps/context-files-ui/assets/clojure-De3QGfx6.js +1 -0
- package/dist/apps/context-files-ui/assets/cmake-i2VDNaRq.js +1 -0
- package/dist/apps/context-files-ui/assets/cobol-BwO6DF08.js +1 -0
- package/dist/apps/context-files-ui/assets/coffeescript-BtivDvRz.js +1 -0
- package/dist/apps/context-files-ui/assets/commonlisp-DFkEQdLP.js +1 -0
- package/dist/apps/context-files-ui/assets/crystal-CU0NkcVL.js +1 -0
- package/dist/apps/context-files-ui/assets/css-CbMZAQ1W.js +1 -0
- package/dist/apps/context-files-ui/assets/cypher-Dke5QOzv.js +1 -0
- package/dist/apps/context-files-ui/assets/d-TPqSVaHM.js +1 -0
- package/dist/apps/context-files-ui/assets/diff-B365LSoZ.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-B5PTVnox.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-B5ZAfwf5.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-BJW3917N.js +11 -0
- package/dist/apps/context-files-ui/assets/dist-BkUONE3N.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-CKQF1zEu.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-CwbH_3RN.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-CxRLRmMx.js +2 -0
- package/dist/apps/context-files-ui/assets/dist-D1KyNDg5.js +13 -0
- package/dist/apps/context-files-ui/assets/dist-DFi2YGux.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DKoyMSNr.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DLMjd26T.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DQXzt2Ng.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DotDq_kD.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DyfSeBMu.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-MyZgX9K2.js +9 -0
- package/dist/apps/context-files-ui/assets/dist-QQuDy4KA.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-YwR9dpb-.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-dTBsFYAl.js +1 -0
- package/dist/apps/context-files-ui/assets/dockerfile-CJb2sekW.js +1 -0
- package/dist/apps/context-files-ui/assets/dtd-CBMymJ7O.js +1 -0
- package/dist/apps/context-files-ui/assets/dylan-08Azy1NK.js +1 -0
- package/dist/apps/context-files-ui/assets/ebnf-Dkum_1J8.js +1 -0
- package/dist/apps/context-files-ui/assets/ecl-dhxjHL8y.js +1 -0
- package/dist/apps/context-files-ui/assets/eiffel-C446m6dI.js +1 -0
- package/dist/apps/context-files-ui/assets/elm-po1E9de0.js +1 -0
- package/dist/apps/context-files-ui/assets/erlang-BD5LkVkR.js +1 -0
- package/dist/apps/context-files-ui/assets/factor-B2EMQZkP.js +1 -0
- package/dist/apps/context-files-ui/assets/fcl-DkEOamHd.js +1 -0
- package/dist/apps/context-files-ui/assets/forth-dCg2_HVB.js +1 -0
- package/dist/apps/context-files-ui/assets/fortran-3ZpXLFh1.js +1 -0
- package/dist/apps/context-files-ui/assets/gas-DMmxLZRI.js +1 -0
- package/dist/apps/context-files-ui/assets/gherkin-DUSFg2R6.js +1 -0
- package/dist/apps/context-files-ui/assets/groovy-Cmduloe1.js +1 -0
- package/dist/apps/context-files-ui/assets/haskell-Cyr255R9.js +1 -0
- package/dist/apps/context-files-ui/assets/haxe-BJVKtprM.js +1 -0
- package/dist/apps/context-files-ui/assets/http-DszHFpc-.js +1 -0
- package/dist/apps/context-files-ui/assets/idl-Cati9Nrv.js +1 -0
- package/dist/apps/context-files-ui/assets/index-BwRDoHMC.css +1 -0
- package/dist/apps/context-files-ui/assets/index-GwvjXytt.js +202 -0
- package/dist/apps/context-files-ui/assets/javascript-C5pDVaoP.js +1 -0
- package/dist/apps/context-files-ui/assets/julia-DlqY1cTU.js +1 -0
- package/dist/apps/context-files-ui/assets/livescript-C6p8-2W1.js +1 -0
- package/dist/apps/context-files-ui/assets/lua-BxuTHaF7.js +1 -0
- package/dist/apps/context-files-ui/assets/mathematica-nDHZUMJT.js +1 -0
- package/dist/apps/context-files-ui/assets/mbox-DAaR0Hcz.js +1 -0
- package/dist/apps/context-files-ui/assets/mirc-CCA0FRfl.js +1 -0
- package/dist/apps/context-files-ui/assets/mllike-Cw3Iccsb.js +1 -0
- package/dist/apps/context-files-ui/assets/modelica-Czx80fNR.js +1 -0
- package/dist/apps/context-files-ui/assets/mscgen-BmfuTbzG.js +1 -0
- package/dist/apps/context-files-ui/assets/mumps-Ds_ZaumL.js +1 -0
- package/dist/apps/context-files-ui/assets/nginx-D9M2PQ4U.js +1 -0
- package/dist/apps/context-files-ui/assets/nsis-DOo3SJmd.js +1 -0
- package/dist/apps/context-files-ui/assets/ntriples-DLHGTvHs.js +1 -0
- package/dist/apps/context-files-ui/assets/octave-8jj96JiC.js +1 -0
- package/dist/apps/context-files-ui/assets/oz-BmMq7iC4.js +1 -0
- package/dist/apps/context-files-ui/assets/pascal-BgMr6XpT.js +1 -0
- package/dist/apps/context-files-ui/assets/perl-D6YJObi_.js +1 -0
- package/dist/apps/context-files-ui/assets/pig-nx7uchs8.js +1 -0
- package/dist/apps/context-files-ui/assets/powershell-B4IPkVxR.js +1 -0
- package/dist/apps/context-files-ui/assets/properties-CoavQdLC.js +1 -0
- package/dist/apps/context-files-ui/assets/protobuf-D5EWhcmc.js +1 -0
- package/dist/apps/context-files-ui/assets/pug-QU72BPAa.js +1 -0
- package/dist/apps/context-files-ui/assets/puppet-B_0GFuyD.js +1 -0
- package/dist/apps/context-files-ui/assets/python-Cs7sNzy_.js +1 -0
- package/dist/apps/context-files-ui/assets/q-BIB9pPtI.js +1 -0
- package/dist/apps/context-files-ui/assets/r-CN5s4f3o.js +1 -0
- package/dist/apps/context-files-ui/assets/rpm-Ct_Ck8mQ.js +1 -0
- package/dist/apps/context-files-ui/assets/ruby-BVPradRk.js +1 -0
- package/dist/apps/context-files-ui/assets/sas-DN4j74IF.js +1 -0
- package/dist/apps/context-files-ui/assets/scheme-CvNgHAnh.js +1 -0
- package/dist/apps/context-files-ui/assets/shell-BjiMLAaM.js +1 -0
- package/dist/apps/context-files-ui/assets/sieve-C2U1O5Z4.js +1 -0
- package/dist/apps/context-files-ui/assets/simple-mode-DnMbQuKW.js +1 -0
- package/dist/apps/context-files-ui/assets/smalltalk-DkYwYufV.js +1 -0
- package/dist/apps/context-files-ui/assets/solr-BopnSD-v.js +1 -0
- package/dist/apps/context-files-ui/assets/sparql-Cpg3YQfd.js +1 -0
- package/dist/apps/context-files-ui/assets/spreadsheet-kRxtVt9J.js +1 -0
- package/dist/apps/context-files-ui/assets/sql-DYI2GwJR.js +1 -0
- package/dist/apps/context-files-ui/assets/stex-BCRT8IJ3.js +1 -0
- package/dist/apps/context-files-ui/assets/stylus-CARoeVE9.js +1 -0
- package/dist/apps/context-files-ui/assets/swift-DKNaLAK6.js +1 -0
- package/dist/apps/context-files-ui/assets/tcl-CQyXkgMH.js +1 -0
- package/dist/apps/context-files-ui/assets/textile-Yg_UWn-t.js +1 -0
- package/dist/apps/context-files-ui/assets/tiddlywiki-dqVbkfX4.js +1 -0
- package/dist/apps/context-files-ui/assets/tiki-CC_ic8g0.js +1 -0
- package/dist/apps/context-files-ui/assets/toml-B7gGzVkJ.js +1 -0
- package/dist/apps/context-files-ui/assets/troff-Bq3z6oAu.js +1 -0
- package/dist/apps/context-files-ui/assets/ttcn-GvRgs2AT.js +1 -0
- package/dist/apps/context-files-ui/assets/ttcn-cfg-CGCXz7Vo.js +1 -0
- package/dist/apps/context-files-ui/assets/turtle-CwIpz2yy.js +1 -0
- package/dist/apps/context-files-ui/assets/vb-BmcHUM2C.js +1 -0
- package/dist/apps/context-files-ui/assets/vbscript-Cs9dylre.js +1 -0
- package/dist/apps/context-files-ui/assets/velocity-CBWU0VCy.js +1 -0
- package/dist/apps/context-files-ui/assets/verilog-DVCHmufx.js +1 -0
- package/dist/apps/context-files-ui/assets/vhdl-BGDk4f1d.js +1 -0
- package/dist/apps/context-files-ui/assets/webidl-egXQEWlC.js +1 -0
- package/dist/apps/context-files-ui/assets/xquery-5f0hn7cg.js +1 -0
- package/dist/apps/context-files-ui/assets/yacas-DNs9XkmQ.js +1 -0
- package/dist/apps/context-files-ui/assets/z80-B7Dfb4UO.js +1 -0
- package/dist/apps/context-files-ui/index.html +14 -0
- package/dist/auth/better-auth.js +129 -0
- package/dist/auth/types.js +14 -0
- package/dist/bin/pibo.js +3 -0
- package/dist/channels/types.js +1 -0
- package/dist/cli-errors.js +18 -0
- package/dist/cli.js +264 -0
- package/dist/config/config.js +167 -0
- package/dist/core/base-prompt.js +104 -0
- package/dist/core/codex-compat.js +44 -0
- package/dist/core/compaction-prompt.js +258 -0
- package/dist/core/events.js +1 -0
- package/dist/core/profiles.js +138 -0
- package/dist/core/routed-session.js +538 -0
- package/dist/core/runtime.js +323 -0
- package/dist/core/session-router.js +437 -0
- package/dist/core/system-prompt-template.js +56 -0
- package/dist/core/thinking.js +9 -0
- package/dist/core/workspace.js +5 -0
- package/dist/debug/events.js +92 -0
- package/dist/debug/index.js +631 -0
- package/dist/debug/session.js +200 -0
- package/dist/debug/sql.js +238 -0
- package/dist/debug/stores.js +49 -0
- package/dist/debug/trace.js +245 -0
- package/dist/env.js +32 -0
- package/dist/gateway/client.js +200 -0
- package/dist/gateway/protocol.js +46 -0
- package/dist/gateway/request.js +146 -0
- package/dist/gateway/server.js +221 -0
- package/dist/gateway/tool.js +69 -0
- package/dist/gateway/web.js +80 -0
- package/dist/index.js +23 -0
- package/dist/local/client.js +77 -0
- package/dist/local/extension.js +548 -0
- package/dist/local/tui.js +25 -0
- package/dist/mcp/agent-context.js +123 -0
- package/dist/mcp/client.js +332 -0
- package/dist/mcp/commands/call.js +146 -0
- package/dist/mcp/commands/grep.js +145 -0
- package/dist/mcp/commands/info.js +71 -0
- package/dist/mcp/commands/list.js +94 -0
- package/dist/mcp/config-command.js +217 -0
- package/dist/mcp/config.js +440 -0
- package/dist/mcp/daemon-client.js +266 -0
- package/dist/mcp/daemon.js +327 -0
- package/dist/mcp/errors.js +287 -0
- package/dist/mcp/index.js +431 -0
- package/dist/mcp/output.js +171 -0
- package/dist/mcp/python-runtime.js +131 -0
- package/dist/mcp/registry.js +116 -0
- package/dist/mcp/version.js +5 -0
- package/dist/pi-packages/cli.js +92 -0
- package/dist/pi-packages/installer.js +70 -0
- package/dist/pi-packages/metadata.js +231 -0
- package/dist/pi-packages/runtime.js +61 -0
- package/dist/pi-packages/store.js +175 -0
- package/dist/pi-packages/types.js +1 -0
- package/dist/plugins/better-auth.js +11 -0
- package/dist/plugins/builtin.js +249 -0
- package/dist/plugins/chat-web.js +11 -0
- package/dist/plugins/codex-compat.js +72 -0
- package/dist/plugins/context-files-store.js +354 -0
- package/dist/plugins/context-files.js +999 -0
- package/dist/plugins/core-tools.js +94 -0
- package/dist/plugins/example.js +67 -0
- package/dist/plugins/registry.js +368 -0
- package/dist/plugins/remote-agent.js +9 -0
- package/dist/plugins/types.js +1 -0
- package/dist/plugins/web.js +11 -0
- package/dist/reliability/store.js +759 -0
- package/dist/remote/channel.js +176 -0
- package/dist/remote/client.js +92 -0
- package/dist/remote/examples/tui-controller.js +263 -0
- package/dist/remote/protocol.js +55 -0
- package/dist/remote/session-client.js +189 -0
- package/dist/runs/registry.js +323 -0
- package/dist/runs/tools.js +185 -0
- package/dist/sessions/bindings.js +41 -0
- package/dist/sessions/sqlite-store.js +154 -0
- package/dist/sessions/store.js +125 -0
- package/dist/shared/trace-order.js +83 -0
- package/dist/subagents/tool.js +63 -0
- package/dist/tools/browser-use-cdp.js +207 -0
- package/dist/tools/browser-use-leases.js +338 -0
- package/dist/tools/browser-use-wrapper.js +338 -0
- package/dist/tools/codex-compat.js +85 -0
- package/dist/tools/desktop-env.js +90 -0
- package/dist/tools/guides.js +276 -0
- package/dist/tools/index.js +366 -0
- package/dist/tools/python-runtime.js +154 -0
- package/dist/tools/registry.js +107 -0
- package/dist/tools/web-search.js +137 -0
- package/dist/web/auth.js +10 -0
- package/dist/web/channel.js +151 -0
- package/dist/web/http.js +110 -0
- package/dist/web/types.js +1 -0
- package/package.json +74 -0
- package/src/mcp/LICENSE.mcp-cli +21 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { createServer } from "node:net";
|
|
2
|
+
import { createDefaultPiboPluginRegistry } from "../plugins/builtin.js";
|
|
3
|
+
import { PiboSessionRouter } from "../core/session-router.js";
|
|
4
|
+
import { DEFAULT_GATEWAY_HOST, DEFAULT_GATEWAY_PORT, encodeFrame, errorResponse, isGatewayRequestFrame, } from "./protocol.js";
|
|
5
|
+
function parseJsonLine(line) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(line);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
throw new Error("Invalid JSON frame");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function createConnection(socket) {
|
|
14
|
+
return {
|
|
15
|
+
socket,
|
|
16
|
+
send(frame) {
|
|
17
|
+
if (socket.destroyed)
|
|
18
|
+
return;
|
|
19
|
+
socket.write(encodeFrame(frame));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function createGatewaySessionStore(options) {
|
|
24
|
+
const { createDefaultPiboSessionStore, SqlitePiboSessionStore } = await import("../sessions/sqlite-store.js");
|
|
25
|
+
return options.sessionDbPath
|
|
26
|
+
? new SqlitePiboSessionStore(options.sessionDbPath)
|
|
27
|
+
: createDefaultPiboSessionStore();
|
|
28
|
+
}
|
|
29
|
+
export class PiboGatewayServer {
|
|
30
|
+
options;
|
|
31
|
+
pluginRegistry;
|
|
32
|
+
sessionStore;
|
|
33
|
+
ownsSessionStore = false;
|
|
34
|
+
router;
|
|
35
|
+
startedChannels = [];
|
|
36
|
+
connections = new Set();
|
|
37
|
+
server;
|
|
38
|
+
unsubscribe;
|
|
39
|
+
constructor(options = {}) {
|
|
40
|
+
this.options = options;
|
|
41
|
+
this.pluginRegistry = options.pluginRegistry ?? createDefaultPiboPluginRegistry();
|
|
42
|
+
}
|
|
43
|
+
async start() {
|
|
44
|
+
if (this.server)
|
|
45
|
+
return;
|
|
46
|
+
this.validateChannels();
|
|
47
|
+
this.sessionStore = this.options.sessionStore ?? (await createGatewaySessionStore(this.options));
|
|
48
|
+
this.ownsSessionStore = !this.options.sessionStore;
|
|
49
|
+
this.router = new PiboSessionRouter({
|
|
50
|
+
persistSession: this.options.persistSession,
|
|
51
|
+
pluginRegistry: this.pluginRegistry,
|
|
52
|
+
sessionStore: this.sessionStore,
|
|
53
|
+
});
|
|
54
|
+
this.unsubscribe = this.router.subscribe((event) => this.broadcastRouterEvent(event));
|
|
55
|
+
this.server = createServer((socket) => this.handleSocket(socket));
|
|
56
|
+
await this.pluginRegistry.getAuthService()?.start?.();
|
|
57
|
+
await new Promise((resolve, reject) => {
|
|
58
|
+
this.server.once("error", reject);
|
|
59
|
+
this.server.listen(this.options.port ?? DEFAULT_GATEWAY_PORT, this.options.host ?? DEFAULT_GATEWAY_HOST, () => {
|
|
60
|
+
this.server.off("error", reject);
|
|
61
|
+
resolve();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
if (this.options.startChannels !== false) {
|
|
65
|
+
await this.startChannels();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async stop() {
|
|
69
|
+
await this.stopChannels();
|
|
70
|
+
await this.pluginRegistry.getAuthService()?.stop?.();
|
|
71
|
+
this.unsubscribe?.();
|
|
72
|
+
this.unsubscribe = undefined;
|
|
73
|
+
for (const connection of this.connections) {
|
|
74
|
+
connection.socket.destroy();
|
|
75
|
+
}
|
|
76
|
+
this.connections.clear();
|
|
77
|
+
if (this.server) {
|
|
78
|
+
await new Promise((resolve, reject) => {
|
|
79
|
+
this.server.close((error) => (error ? reject(error) : resolve()));
|
|
80
|
+
});
|
|
81
|
+
this.server = undefined;
|
|
82
|
+
}
|
|
83
|
+
await this.router?.disposeAll();
|
|
84
|
+
this.router = undefined;
|
|
85
|
+
if (this.ownsSessionStore) {
|
|
86
|
+
this.sessionStore?.close?.();
|
|
87
|
+
}
|
|
88
|
+
this.sessionStore = undefined;
|
|
89
|
+
this.ownsSessionStore = false;
|
|
90
|
+
}
|
|
91
|
+
handleSocket(socket) {
|
|
92
|
+
const connection = createConnection(socket);
|
|
93
|
+
this.connections.add(connection);
|
|
94
|
+
let buffer = "";
|
|
95
|
+
socket.setEncoding("utf-8");
|
|
96
|
+
socket.on("data", (chunk) => {
|
|
97
|
+
buffer += chunk;
|
|
98
|
+
let newlineIndex = buffer.indexOf("\n");
|
|
99
|
+
while (newlineIndex !== -1) {
|
|
100
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
101
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
102
|
+
if (line) {
|
|
103
|
+
void this.handleLine(connection, line);
|
|
104
|
+
}
|
|
105
|
+
newlineIndex = buffer.indexOf("\n");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
socket.once("close", () => {
|
|
109
|
+
this.connections.delete(connection);
|
|
110
|
+
});
|
|
111
|
+
socket.once("error", () => {
|
|
112
|
+
this.connections.delete(connection);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async handleLine(connection, line) {
|
|
116
|
+
let frame;
|
|
117
|
+
try {
|
|
118
|
+
frame = parseJsonLine(line);
|
|
119
|
+
if (!isGatewayRequestFrame(frame)) {
|
|
120
|
+
throw new Error("Invalid request frame");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
connection.send(errorResponse("invalid", error));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
const output = await this.requireRouter().emit(frame.event);
|
|
129
|
+
const response = {
|
|
130
|
+
type: "res",
|
|
131
|
+
id: frame.id,
|
|
132
|
+
ok: true,
|
|
133
|
+
payload: output,
|
|
134
|
+
};
|
|
135
|
+
connection.send(response);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
connection.send(errorResponse(frame.id, error));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
broadcastRouterEvent(event) {
|
|
142
|
+
for (const connection of this.connections) {
|
|
143
|
+
connection.send({ type: "event", event: "router", payload: event });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async startChannels() {
|
|
147
|
+
const context = this.createChannelContext();
|
|
148
|
+
for (const channel of this.pluginRegistry.getChannels()) {
|
|
149
|
+
if (channel.auth.mode === "none") {
|
|
150
|
+
console.error(`Warning: channel "${channel.name}" starts without auth`);
|
|
151
|
+
}
|
|
152
|
+
await channel.start(context);
|
|
153
|
+
this.startedChannels.push(channel);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
validateChannels() {
|
|
157
|
+
for (const channel of this.pluginRegistry.getChannels()) {
|
|
158
|
+
if (channel.auth.mode === "required" && !this.pluginRegistry.getAuthService()) {
|
|
159
|
+
throw new Error(`Channel "${channel.name}" requires auth, but no auth service is registered`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async stopChannels() {
|
|
164
|
+
while (this.startedChannels.length > 0) {
|
|
165
|
+
const channel = this.startedChannels.pop();
|
|
166
|
+
await channel.stop?.();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
createChannelContext() {
|
|
170
|
+
return {
|
|
171
|
+
emit: (event) => this.requireRouter().emit(event),
|
|
172
|
+
subscribe: (listener) => this.requireRouter().subscribe(listener),
|
|
173
|
+
getSession: (id) => this.requireSessionStore().get(id),
|
|
174
|
+
createSession: (input) => {
|
|
175
|
+
const profile = this.pluginRegistry.resolveProfileName(input.profile);
|
|
176
|
+
return this.requireSessionStore().create({ ...input, profile });
|
|
177
|
+
},
|
|
178
|
+
updateSession: (id, input) => this.requireSessionStore().update(id, input),
|
|
179
|
+
deleteSession: (id) => this.requireSessionStore().delete?.(id) ?? false,
|
|
180
|
+
findSessions: (input) => this.requireSessionStore().find(input),
|
|
181
|
+
listSessions: () => this.requireSessionStore().list?.() ?? [],
|
|
182
|
+
getGatewayActions: () => this.pluginRegistry.getGatewayActionInfos(),
|
|
183
|
+
getProfiles: () => this.pluginRegistry.getProfileInfos(),
|
|
184
|
+
getCapabilityCatalog: () => this.pluginRegistry.getCapabilityCatalog(),
|
|
185
|
+
upsertProfile: (profile) => this.pluginRegistry.upsertProfile(profile),
|
|
186
|
+
removeProfile: (name) => this.pluginRegistry.removeProfile(name),
|
|
187
|
+
upsertContextFile: (contextFile) => this.pluginRegistry.upsertContextFile(contextFile),
|
|
188
|
+
removeContextFile: (key) => this.pluginRegistry.removeContextFile(key),
|
|
189
|
+
emitProductEvent: (event) => this.pluginRegistry.emitProductEvent(event),
|
|
190
|
+
subscribeProductEvents: (listener) => this.pluginRegistry.onProductEvent(listener),
|
|
191
|
+
auth: this.pluginRegistry.getAuthService(),
|
|
192
|
+
getWebApps: () => this.pluginRegistry.getWebApps(),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
requireRouter() {
|
|
196
|
+
if (!this.router)
|
|
197
|
+
throw new Error("Gateway router is not started");
|
|
198
|
+
return this.router;
|
|
199
|
+
}
|
|
200
|
+
requireSessionStore() {
|
|
201
|
+
if (!this.sessionStore)
|
|
202
|
+
throw new Error("Gateway session store is not started");
|
|
203
|
+
return this.sessionStore;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
export async function runGatewayServer(options = {}) {
|
|
207
|
+
const server = new PiboGatewayServer(options);
|
|
208
|
+
await server.start();
|
|
209
|
+
const host = options.host ?? DEFAULT_GATEWAY_HOST;
|
|
210
|
+
const port = options.port ?? DEFAULT_GATEWAY_PORT;
|
|
211
|
+
console.error(`pibo gateway listening on ${host}:${port}`);
|
|
212
|
+
const stop = async () => {
|
|
213
|
+
await server.stop();
|
|
214
|
+
};
|
|
215
|
+
process.once("SIGINT", () => {
|
|
216
|
+
void stop().finally(() => process.exit(0));
|
|
217
|
+
});
|
|
218
|
+
process.once("SIGTERM", () => {
|
|
219
|
+
void stop().finally(() => process.exit(0));
|
|
220
|
+
});
|
|
221
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Type } from "@mariozechner/pi-ai";
|
|
2
|
+
import { defineTool } from "@mariozechner/pi-coding-agent";
|
|
3
|
+
import { sendGatewayMessageAndWaitForReply } from "./request.js";
|
|
4
|
+
const piboGatewaySendTool = defineTool({
|
|
5
|
+
name: "pibo_gateway_send",
|
|
6
|
+
label: "Pibo Gateway Send",
|
|
7
|
+
description: "Send a message through the local pibo gateway to a target session and return the target assistant reply.",
|
|
8
|
+
promptSnippet: "Send a message through the local pibo gateway to a target session and return the final assistant reply from that session.",
|
|
9
|
+
parameters: Type.Object({
|
|
10
|
+
piboSessionId: Type.String({ description: "Target Pibo gateway session id" }),
|
|
11
|
+
message: Type.String({ description: "Message to enqueue for the target session" }),
|
|
12
|
+
}),
|
|
13
|
+
async execute(_toolCallId, params) {
|
|
14
|
+
let result;
|
|
15
|
+
let response;
|
|
16
|
+
try {
|
|
17
|
+
result = await sendGatewayMessageAndWaitForReply({
|
|
18
|
+
type: "message",
|
|
19
|
+
piboSessionId: params.piboSessionId,
|
|
20
|
+
text: params.message,
|
|
21
|
+
source: "actor",
|
|
22
|
+
});
|
|
23
|
+
response = result.response;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
response = {
|
|
27
|
+
type: "res",
|
|
28
|
+
id: "",
|
|
29
|
+
ok: false,
|
|
30
|
+
error: { message: error instanceof Error ? error.message : String(error) },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const message = response.error?.message ?? "Gateway rejected the message";
|
|
35
|
+
const details = { ok: false, piboSessionId: params.piboSessionId, error: message };
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: `Gateway error: ${message}` }],
|
|
38
|
+
details,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const details = {
|
|
42
|
+
ok: true,
|
|
43
|
+
piboSessionId: params.piboSessionId,
|
|
44
|
+
gatewayPayload: response.payload,
|
|
45
|
+
reply: result?.reply.text,
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: result?.reply
|
|
52
|
+
? result.reply.text
|
|
53
|
+
: `Queued message for pibo gateway session "${params.piboSessionId}", but no assistant reply was returned.`,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
details,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
export function createPiboGatewayToolProfiles() {
|
|
61
|
+
return [createToolProfile(piboGatewaySendTool)];
|
|
62
|
+
}
|
|
63
|
+
function createToolProfile(definition) {
|
|
64
|
+
return {
|
|
65
|
+
name: definition.name,
|
|
66
|
+
description: definition.description,
|
|
67
|
+
definition,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createDefaultPiboPlugins } from "../plugins/builtin.js";
|
|
2
|
+
import { createPiboBetterAuthPlugin } from "../plugins/better-auth.js";
|
|
3
|
+
import { createPiboChatWebPlugin } from "../plugins/chat-web.js";
|
|
4
|
+
import { createPiboContextFilesPlugin } from "../plugins/context-files.js";
|
|
5
|
+
import { PiboPluginRegistry } from "../plugins/registry.js";
|
|
6
|
+
import { createPiboWebHostPlugin } from "../plugins/web.js";
|
|
7
|
+
import { DEFAULT_WEB_CHANNEL_HOST, DEFAULT_WEB_CHANNEL_PORT } from "../web/channel.js";
|
|
8
|
+
import { loadPiboConfig } from "../config/config.js";
|
|
9
|
+
import { PiboGatewayServer } from "./server.js";
|
|
10
|
+
const PUBLIC_WEB_CHANNEL_HOST = "0.0.0.0";
|
|
11
|
+
const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
12
|
+
function authBaseURL(options) {
|
|
13
|
+
return options.auth?.baseURL ?? loadPiboConfig().auth?.baseURL;
|
|
14
|
+
}
|
|
15
|
+
function defaultWebHost(baseURL) {
|
|
16
|
+
if (!baseURL)
|
|
17
|
+
return DEFAULT_WEB_CHANNEL_HOST;
|
|
18
|
+
try {
|
|
19
|
+
const hostname = new URL(baseURL).hostname;
|
|
20
|
+
return LOOPBACK_HOSTS.has(hostname) ? DEFAULT_WEB_CHANNEL_HOST : PUBLIC_WEB_CHANNEL_HOST;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return DEFAULT_WEB_CHANNEL_HOST;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function resolveWebGatewayServerOptions(options = {}) {
|
|
27
|
+
const baseURL = authBaseURL(options);
|
|
28
|
+
return {
|
|
29
|
+
...options,
|
|
30
|
+
web: {
|
|
31
|
+
...options.web,
|
|
32
|
+
host: options.web?.host ?? defaultWebHost(baseURL),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function createWebPiboPluginRegistry(options = {}) {
|
|
37
|
+
const resolvedOptions = resolveWebGatewayServerOptions(options);
|
|
38
|
+
return PiboPluginRegistry.create({
|
|
39
|
+
plugins: [
|
|
40
|
+
...createDefaultPiboPlugins(),
|
|
41
|
+
createPiboBetterAuthPlugin(resolvedOptions.auth),
|
|
42
|
+
createPiboWebHostPlugin({ announce: false, canonicalBaseURL: authBaseURL(resolvedOptions), ...resolvedOptions.web }),
|
|
43
|
+
createPiboContextFilesPlugin(resolvedOptions.contextFiles),
|
|
44
|
+
createPiboChatWebPlugin(resolvedOptions.chat),
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function createChatAppURL(options, host, port) {
|
|
49
|
+
const baseURL = options.auth?.baseURL ?? loadPiboConfig().auth?.baseURL;
|
|
50
|
+
if (baseURL) {
|
|
51
|
+
try {
|
|
52
|
+
return new URL("/apps/chat", baseURL).toString();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Fall through to the bound address below.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return `http://${host}:${port}/apps/chat`;
|
|
59
|
+
}
|
|
60
|
+
export async function runWebGatewayServer(options = {}) {
|
|
61
|
+
const resolvedOptions = resolveWebGatewayServerOptions(options);
|
|
62
|
+
const pluginRegistry = resolvedOptions.pluginRegistry ?? createWebPiboPluginRegistry(resolvedOptions);
|
|
63
|
+
const server = new PiboGatewayServer({
|
|
64
|
+
...resolvedOptions,
|
|
65
|
+
pluginRegistry,
|
|
66
|
+
});
|
|
67
|
+
await server.start();
|
|
68
|
+
const host = resolvedOptions.web?.host ?? DEFAULT_WEB_CHANNEL_HOST;
|
|
69
|
+
const port = resolvedOptions.web?.port ?? DEFAULT_WEB_CHANNEL_PORT;
|
|
70
|
+
console.error(`pibo chat app available at ${createChatAppURL(resolvedOptions, host, port)}`);
|
|
71
|
+
const stop = async () => {
|
|
72
|
+
await server.stop();
|
|
73
|
+
};
|
|
74
|
+
process.once("SIGINT", () => {
|
|
75
|
+
void stop().finally(() => process.exit(0));
|
|
76
|
+
});
|
|
77
|
+
process.once("SIGTERM", () => {
|
|
78
|
+
void stop().finally(() => process.exit(0));
|
|
79
|
+
});
|
|
80
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { createDefaultPiboProfile, createDefaultPiboPluginRegistry, createDefaultPiboPlugins, createGatewayProducerPiboPluginRegistry, createGatewayProducerPiboProfile, piboCorePlugin, piboGatewayProducerPlugin, } from "./plugins/builtin.js";
|
|
2
|
+
export { createPiboBetterAuthPlugin } from "./plugins/better-auth.js";
|
|
3
|
+
export { createPiboChatWebPlugin } from "./plugins/chat-web.js";
|
|
4
|
+
export { createPiboContextFilesPlugin } from "./plugins/context-files.js";
|
|
5
|
+
export { createPiboWebHostPlugin } from "./plugins/web.js";
|
|
6
|
+
export { createChatWebApp } from "./apps/chat/web-app.js";
|
|
7
|
+
export { createBetterAuthService } from "./auth/better-auth.js";
|
|
8
|
+
export { InitialSessionContext, InitialSessionContextBuilder, } from "./core/profiles.js";
|
|
9
|
+
export { definePiboPlugin, PiboPluginRegistry } from "./plugins/registry.js";
|
|
10
|
+
export { createPiboGatewayToolProfiles } from "./gateway/tool.js";
|
|
11
|
+
export { createPiboRuntime, inspectPiboProfile, runPiboTui } from "./core/runtime.js";
|
|
12
|
+
export { PiboSessionRouter } from "./core/session-router.js";
|
|
13
|
+
export { PiboReliabilityStore, createDefaultPiboReliabilityStore } from "./reliability/store.js";
|
|
14
|
+
export { PiboGatewayServer, runGatewayServer } from "./gateway/server.js";
|
|
15
|
+
export { createWebPiboPluginRegistry, resolveWebGatewayServerOptions, runWebGatewayServer } from "./gateway/web.js";
|
|
16
|
+
export { runGatewayClient } from "./gateway/client.js";
|
|
17
|
+
export { LOCAL_TUI_CHANNEL_NAME, LocalRoutedTuiClient, createLocalRoutedTuiClient, createLocalRoutedTuiExtension, runLocalRoutedTui, } from "./local/tui.js";
|
|
18
|
+
export { createWebHostChannel, DEFAULT_WEB_CHANNEL_HOST, DEFAULT_WEB_CHANNEL_PORT, WEB_CHANNEL_NAME } from "./web/channel.js";
|
|
19
|
+
export { sendGatewayEvent, sendGatewayMessageAndWaitForReply } from "./gateway/request.js";
|
|
20
|
+
export { createSubagentToolDefinitions, createSubagentToolName, } from "./subagents/tool.js";
|
|
21
|
+
export { InMemoryPiboSessionStore, createPiSessionId, createPiboSessionId, createPiboSession, } from "./sessions/store.js";
|
|
22
|
+
export { runPiboCli } from "./cli.js";
|
|
23
|
+
export { DEFAULT_PIBO_CONFIG_PATH, PIBO_CONFIG_KEYS, deletePiboConfigValue, getDisplayPiboConfigValue, getPiboConfigValue, isPiboConfigKeySecret, loadPiboConfig, redactPiboConfig, savePiboConfig, setPiboConfigValue, } from "./config/config.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { PiboSessionRouter } from "../core/session-router.js";
|
|
3
|
+
import { createDefaultPiboPluginRegistry } from "../plugins/builtin.js";
|
|
4
|
+
import { getDefaultPiboWorkspace } from "../core/workspace.js";
|
|
5
|
+
import { InMemoryPiboSessionStore, } from "../sessions/store.js";
|
|
6
|
+
export const LOCAL_TUI_CHANNEL_NAME = "local-tui";
|
|
7
|
+
export class LocalRoutedTuiClient {
|
|
8
|
+
router;
|
|
9
|
+
piboSession;
|
|
10
|
+
capabilities;
|
|
11
|
+
unsubscribe;
|
|
12
|
+
eventListeners = new Set();
|
|
13
|
+
closed = false;
|
|
14
|
+
constructor(router, piboSession, capabilities) {
|
|
15
|
+
this.router = router;
|
|
16
|
+
this.piboSession = piboSession;
|
|
17
|
+
this.capabilities = capabilities;
|
|
18
|
+
this.unsubscribe = router.subscribe((event) => {
|
|
19
|
+
if (event.piboSessionId !== this.piboSession.id)
|
|
20
|
+
return;
|
|
21
|
+
for (const listener of this.eventListeners) {
|
|
22
|
+
listener(event);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
onEvent(listener) {
|
|
27
|
+
this.eventListeners.add(listener);
|
|
28
|
+
return () => this.eventListeners.delete(listener);
|
|
29
|
+
}
|
|
30
|
+
sendMessage(text) {
|
|
31
|
+
return this.router.emit({
|
|
32
|
+
type: "message",
|
|
33
|
+
piboSessionId: this.piboSession.id,
|
|
34
|
+
id: randomUUID(),
|
|
35
|
+
text,
|
|
36
|
+
source: "ui",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
sendExecution(action, params) {
|
|
40
|
+
const event = params === undefined
|
|
41
|
+
? { type: "execution", piboSessionId: this.piboSession.id, id: randomUUID(), action }
|
|
42
|
+
: { type: "execution", piboSessionId: this.piboSession.id, id: randomUUID(), action, params };
|
|
43
|
+
return this.router.emit(event);
|
|
44
|
+
}
|
|
45
|
+
async close() {
|
|
46
|
+
if (this.closed)
|
|
47
|
+
return;
|
|
48
|
+
this.closed = true;
|
|
49
|
+
this.unsubscribe();
|
|
50
|
+
this.eventListeners.clear();
|
|
51
|
+
await this.router.disposeAll();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function createLocalRoutedTuiClient(options = {}) {
|
|
55
|
+
const registry = options.pluginRegistry ?? createDefaultPiboPluginRegistry();
|
|
56
|
+
const profileName = registry.resolveProfileName(options.profile ?? "pibo-minimal");
|
|
57
|
+
const profile = registry.createProfile(profileName);
|
|
58
|
+
const sessionName = options.sessionName ?? "default";
|
|
59
|
+
const workspace = options.cwd ?? getDefaultPiboWorkspace();
|
|
60
|
+
const sessionStore = new InMemoryPiboSessionStore();
|
|
61
|
+
const piboSession = sessionStore.create({
|
|
62
|
+
channel: LOCAL_TUI_CHANNEL_NAME,
|
|
63
|
+
kind: "local",
|
|
64
|
+
profile: profileName,
|
|
65
|
+
title: sessionName,
|
|
66
|
+
workspace,
|
|
67
|
+
});
|
|
68
|
+
const router = new PiboSessionRouter({
|
|
69
|
+
cwd: workspace,
|
|
70
|
+
persistSession: options.persistSession,
|
|
71
|
+
thinkingLevel: options.thinkingLevel,
|
|
72
|
+
pluginRegistry: registry,
|
|
73
|
+
profile,
|
|
74
|
+
sessionStore,
|
|
75
|
+
});
|
|
76
|
+
return new LocalRoutedTuiClient(router, piboSession, { actions: registry.getGatewayActionInfos() });
|
|
77
|
+
}
|