@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
package/dist/cli.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { DEFAULT_PIBO_CONFIG_PATH, PIBO_CONFIG_KEYS, deletePiboConfigValue, getDisplayPiboConfigValue, loadPiboConfig, redactPiboConfig, savePiboConfig, setPiboConfigValue, } from "./config/config.js";
|
|
3
|
+
import { parsePiboThinkingLevel } from "./core/thinking.js";
|
|
4
|
+
async function createCliProfile(profileName) {
|
|
5
|
+
const { createDefaultPiboPluginRegistry, createGatewayProducerPiboProfile } = await import("./plugins/builtin.js");
|
|
6
|
+
if (profileName === "gateway-producer" || profileName === "pibo-gateway-producer") {
|
|
7
|
+
return createGatewayProducerPiboProfile();
|
|
8
|
+
}
|
|
9
|
+
return createDefaultPiboPluginRegistry().createProfile(profileName ?? "pibo-minimal");
|
|
10
|
+
}
|
|
11
|
+
function printJson(value) {
|
|
12
|
+
console.log(JSON.stringify(value, null, 2));
|
|
13
|
+
}
|
|
14
|
+
function printConfigKeys() {
|
|
15
|
+
for (const definition of PIBO_CONFIG_KEYS) {
|
|
16
|
+
const visibility = definition.secret === true ? "secret" : "public";
|
|
17
|
+
console.log(`${definition.key}\t${definition.type}\t${visibility}\t${definition.description}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function printRootDiscovery() {
|
|
21
|
+
console.log(printRootDiscoveryText());
|
|
22
|
+
}
|
|
23
|
+
function printConfigDiscovery() {
|
|
24
|
+
console.log(printConfigDiscoveryText());
|
|
25
|
+
}
|
|
26
|
+
function parsePort(value) {
|
|
27
|
+
const port = Number(value);
|
|
28
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
29
|
+
throw new Error("Port must be an integer between 1 and 65535");
|
|
30
|
+
}
|
|
31
|
+
return port;
|
|
32
|
+
}
|
|
33
|
+
export async function runPiboCli(argv = process.argv) {
|
|
34
|
+
if (argv[2] === "--help" || argv[2] === "-h") {
|
|
35
|
+
printRootDiscovery();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (argv[2] === "mcp") {
|
|
39
|
+
const { runMcpCli } = await import("./mcp/index.js");
|
|
40
|
+
await runMcpCli([argv[0] ?? "node", "pibo mcp", ...argv.slice(3)]);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (argv[2] === "tools") {
|
|
44
|
+
const { runToolsCli } = await import("./tools/index.js");
|
|
45
|
+
await runToolsCli([argv[0] ?? "node", "pibo tools", ...argv.slice(3)]);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (argv[2] === "pi-packages") {
|
|
49
|
+
const { runPiPackagesCli } = await import("./pi-packages/cli.js");
|
|
50
|
+
await runPiPackagesCli([argv[0] ?? "node", "pibo pi-packages", ...argv.slice(3)]);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (argv[2] === "debug") {
|
|
54
|
+
const { runDebugCli } = await import("./debug/index.js");
|
|
55
|
+
await runDebugCli([argv[0] ?? "node", "pibo debug", ...argv.slice(3)]);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (argv[2] === "config" && (argv[3] === "--help" || argv[3] === "-h" || argv.length === 3)) {
|
|
59
|
+
printConfigDiscovery();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const program = new Command();
|
|
63
|
+
program.name("pibo").description("Agent-oriented CLI for Pibo").helpOption(false).showHelpAfterError();
|
|
64
|
+
program
|
|
65
|
+
.command("mcp")
|
|
66
|
+
.description("Interact with configured MCP servers")
|
|
67
|
+
.helpOption(false)
|
|
68
|
+
.allowUnknownOption(true)
|
|
69
|
+
.allowExcessArguments(true)
|
|
70
|
+
.argument("[args...]")
|
|
71
|
+
.action(async (args) => {
|
|
72
|
+
const { runMcpCli } = await import("./mcp/index.js");
|
|
73
|
+
await runMcpCli([argv[0] ?? "node", "pibo mcp", ...args]);
|
|
74
|
+
});
|
|
75
|
+
program
|
|
76
|
+
.command("tools")
|
|
77
|
+
.description("Install and inspect curated external CLI tools")
|
|
78
|
+
.helpOption(false)
|
|
79
|
+
.allowUnknownOption(true)
|
|
80
|
+
.allowExcessArguments(true)
|
|
81
|
+
.argument("[args...]")
|
|
82
|
+
.action(async (args) => {
|
|
83
|
+
const { runToolsCli } = await import("./tools/index.js");
|
|
84
|
+
await runToolsCli([argv[0] ?? "node", "pibo tools", ...args]);
|
|
85
|
+
});
|
|
86
|
+
program
|
|
87
|
+
.command("pi-packages")
|
|
88
|
+
.description("Register Pi Coding Agent packages")
|
|
89
|
+
.helpOption(false)
|
|
90
|
+
.allowUnknownOption(true)
|
|
91
|
+
.allowExcessArguments(true)
|
|
92
|
+
.argument("[args...]")
|
|
93
|
+
.action(async (args) => {
|
|
94
|
+
const { runPiPackagesCli } = await import("./pi-packages/cli.js");
|
|
95
|
+
await runPiPackagesCli([argv[0] ?? "node", "pibo pi-packages", ...args]);
|
|
96
|
+
});
|
|
97
|
+
program
|
|
98
|
+
.command("debug")
|
|
99
|
+
.description("Inspect local Pibo data")
|
|
100
|
+
.helpOption(false)
|
|
101
|
+
.allowUnknownOption(true)
|
|
102
|
+
.allowExcessArguments(true)
|
|
103
|
+
.argument("[args...]")
|
|
104
|
+
.action(async (args) => {
|
|
105
|
+
const { runDebugCli } = await import("./debug/index.js");
|
|
106
|
+
await runDebugCli([argv[0] ?? "node", "pibo debug", ...args]);
|
|
107
|
+
});
|
|
108
|
+
const config = program.command("config").description(`Manage pibo config at ${DEFAULT_PIBO_CONFIG_PATH}`).helpOption(false);
|
|
109
|
+
config.action(() => {
|
|
110
|
+
printConfigDiscovery();
|
|
111
|
+
});
|
|
112
|
+
config
|
|
113
|
+
.command("set")
|
|
114
|
+
.argument("<key>")
|
|
115
|
+
.argument("<value>")
|
|
116
|
+
.description("Set a config value")
|
|
117
|
+
.action((key, value) => {
|
|
118
|
+
const nextConfig = setPiboConfigValue(loadPiboConfig(), key, value);
|
|
119
|
+
savePiboConfig(nextConfig);
|
|
120
|
+
console.log(`Set ${key}`);
|
|
121
|
+
});
|
|
122
|
+
config
|
|
123
|
+
.command("get")
|
|
124
|
+
.argument("<key>")
|
|
125
|
+
.description("Print a config value")
|
|
126
|
+
.action((key) => {
|
|
127
|
+
const value = getDisplayPiboConfigValue(loadPiboConfig(), key);
|
|
128
|
+
if (value === undefined) {
|
|
129
|
+
process.exitCode = 1;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (typeof value === "string")
|
|
133
|
+
console.log(value);
|
|
134
|
+
else
|
|
135
|
+
printJson(value);
|
|
136
|
+
});
|
|
137
|
+
config
|
|
138
|
+
.command("del")
|
|
139
|
+
.argument("<key>")
|
|
140
|
+
.description("Delete a config value")
|
|
141
|
+
.action((key) => {
|
|
142
|
+
savePiboConfig(deletePiboConfigValue(loadPiboConfig(), key));
|
|
143
|
+
console.log(`Deleted ${key}`);
|
|
144
|
+
});
|
|
145
|
+
config.command("keys").description("List supported config keys").action(printConfigKeys);
|
|
146
|
+
config
|
|
147
|
+
.command("show")
|
|
148
|
+
.description("Print the complete config")
|
|
149
|
+
.action(() => {
|
|
150
|
+
printJson(redactPiboConfig(loadPiboConfig()));
|
|
151
|
+
});
|
|
152
|
+
program
|
|
153
|
+
.command("profile")
|
|
154
|
+
.argument("[profile]")
|
|
155
|
+
.description("Inspect a pibo profile")
|
|
156
|
+
.action(async (profile) => {
|
|
157
|
+
const { inspectPiboProfile } = await import("./core/runtime.js");
|
|
158
|
+
printJson(await inspectPiboProfile({ profile: await createCliProfile(profile) }));
|
|
159
|
+
});
|
|
160
|
+
program
|
|
161
|
+
.command("tui")
|
|
162
|
+
.argument("[profile]")
|
|
163
|
+
.description("Start the Pi TUI through pibo")
|
|
164
|
+
.action(async (profile) => {
|
|
165
|
+
const { runPiboTui } = await import("./core/runtime.js");
|
|
166
|
+
await runPiboTui({ profile: await createCliProfile(profile) });
|
|
167
|
+
});
|
|
168
|
+
program
|
|
169
|
+
.command("tui:routed")
|
|
170
|
+
.option("--show-thinking", "Show routed thinking deltas in the local TUI")
|
|
171
|
+
.option("--thinking <level>", "Set routed thinking level: off, minimal, low, medium, high, xhigh", parsePiboThinkingLevel)
|
|
172
|
+
.argument("[profile]")
|
|
173
|
+
.description("Start the local routed Pibo TUI")
|
|
174
|
+
.action(async (profile, options) => {
|
|
175
|
+
const { runLocalRoutedTui } = await import("./local/tui.js");
|
|
176
|
+
await runLocalRoutedTui({
|
|
177
|
+
profile,
|
|
178
|
+
showThinking: options.showThinking === true,
|
|
179
|
+
thinkingLevel: options.thinking,
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
program
|
|
183
|
+
.command("router")
|
|
184
|
+
.argument("[piboSessionId]", "Pibo session id", "demo")
|
|
185
|
+
.description("Emit a demo router status event")
|
|
186
|
+
.action(async (piboSessionId) => {
|
|
187
|
+
const { PiboSessionRouter } = await import("./core/session-router.js");
|
|
188
|
+
const router = new PiboSessionRouter({ persistSession: false });
|
|
189
|
+
const event = await router.emit({
|
|
190
|
+
type: "execution",
|
|
191
|
+
piboSessionId,
|
|
192
|
+
action: "status",
|
|
193
|
+
});
|
|
194
|
+
printJson(event);
|
|
195
|
+
await router.disposeAll();
|
|
196
|
+
});
|
|
197
|
+
program
|
|
198
|
+
.command("gateway")
|
|
199
|
+
.description("Start the local pibo gateway daemon")
|
|
200
|
+
.action(async () => {
|
|
201
|
+
const { runGatewayServer } = await import("./gateway/server.js");
|
|
202
|
+
await runGatewayServer();
|
|
203
|
+
});
|
|
204
|
+
program
|
|
205
|
+
.command("gateway:web")
|
|
206
|
+
.description("Start the authenticated web gateway")
|
|
207
|
+
.option("--web-host <host>", "Bind the HTTP web host, for example 0.0.0.0 for LAN access")
|
|
208
|
+
.option("--web-port <port>", "Bind the HTTP web host port", parsePort)
|
|
209
|
+
.action(async (options) => {
|
|
210
|
+
const { runWebGatewayServer } = await import("./gateway/web.js");
|
|
211
|
+
await runWebGatewayServer({
|
|
212
|
+
web: {
|
|
213
|
+
host: options.webHost,
|
|
214
|
+
port: options.webPort,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
program
|
|
219
|
+
.command("client")
|
|
220
|
+
.argument("[piboSessionId]", "Pibo session id", "default")
|
|
221
|
+
.description("Start a console gateway client")
|
|
222
|
+
.action(async (piboSessionId) => {
|
|
223
|
+
const { runGatewayClient } = await import("./gateway/client.js");
|
|
224
|
+
await runGatewayClient({ piboSessionId });
|
|
225
|
+
});
|
|
226
|
+
if (argv.length <= 2) {
|
|
227
|
+
printRootDiscovery();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
await program.parseAsync(argv);
|
|
231
|
+
}
|
|
232
|
+
function printRootDiscoveryText() {
|
|
233
|
+
return `pibo - agent-oriented CLI
|
|
234
|
+
|
|
235
|
+
Commands:
|
|
236
|
+
config Manage local pibo config
|
|
237
|
+
mcp Discover and call configured MCP servers
|
|
238
|
+
tools Install and inspect curated external CLI tools
|
|
239
|
+
pi-packages Register Pi Coding Agent packages
|
|
240
|
+
debug Inspect local Pibo data
|
|
241
|
+
profile Inspect a pibo profile
|
|
242
|
+
tui Start the direct Pi TUI
|
|
243
|
+
tui:routed Start the local routed Pibo TUI
|
|
244
|
+
gateway Start the local gateway daemon
|
|
245
|
+
gateway:web Start the authenticated web gateway
|
|
246
|
+
|
|
247
|
+
Next:
|
|
248
|
+
pibo <command> --help
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
function printConfigDiscoveryText() {
|
|
252
|
+
return `pibo config - local config at ${DEFAULT_PIBO_CONFIG_PATH}
|
|
253
|
+
|
|
254
|
+
Commands:
|
|
255
|
+
keys List supported config keys
|
|
256
|
+
show Print redacted config JSON
|
|
257
|
+
get <key> Print one redacted config value
|
|
258
|
+
set <key> <value> Set one config value
|
|
259
|
+
del <key> Delete one config value
|
|
260
|
+
|
|
261
|
+
Next:
|
|
262
|
+
pibo config keys
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
export const DEFAULT_PIBO_CONFIG_PATH = ".pibo/config.json";
|
|
4
|
+
export const PIBO_CONFIG_KEYS = [
|
|
5
|
+
{
|
|
6
|
+
key: "auth.baseURL",
|
|
7
|
+
type: "string",
|
|
8
|
+
description: "Better Auth base URL, for example http://localhost:4788.",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "auth.secret",
|
|
12
|
+
type: "string",
|
|
13
|
+
secret: true,
|
|
14
|
+
description: "Better Auth secret. Must be at least 32 characters.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: "auth.googleClientId",
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Google OAuth client id.",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "auth.googleClientSecret",
|
|
23
|
+
type: "string",
|
|
24
|
+
secret: true,
|
|
25
|
+
description: "Google OAuth client secret.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "auth.allowedEmails",
|
|
29
|
+
type: "string[]",
|
|
30
|
+
description: "Allowed Google account emails. Use comma-separated values.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "auth.trustedOrigins",
|
|
34
|
+
type: "string[]",
|
|
35
|
+
description: "Additional trusted Better Auth origins. Use comma-separated values.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "auth.databasePath",
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "SQLite path for Better Auth data.",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
function getKeyDefinition(key) {
|
|
44
|
+
const definition = PIBO_CONFIG_KEYS.find((candidate) => candidate.key === key);
|
|
45
|
+
if (!definition)
|
|
46
|
+
throw new Error(`Unknown config key "${key}"`);
|
|
47
|
+
return definition;
|
|
48
|
+
}
|
|
49
|
+
function findKeyDefinition(key) {
|
|
50
|
+
return PIBO_CONFIG_KEYS.find((candidate) => candidate.key === key);
|
|
51
|
+
}
|
|
52
|
+
function maskSecretValue(value) {
|
|
53
|
+
if (value.length <= 8)
|
|
54
|
+
return "********";
|
|
55
|
+
return `${value.slice(0, 4)}...${value.slice(-4)}`;
|
|
56
|
+
}
|
|
57
|
+
function parseListValue(value) {
|
|
58
|
+
const trimmed = value.trim();
|
|
59
|
+
if (trimmed.startsWith("[")) {
|
|
60
|
+
const parsed = JSON.parse(trimmed);
|
|
61
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
62
|
+
throw new Error("Expected a JSON string array");
|
|
63
|
+
}
|
|
64
|
+
return parsed.map((item) => item.trim()).filter(Boolean);
|
|
65
|
+
}
|
|
66
|
+
return trimmed
|
|
67
|
+
.split(",")
|
|
68
|
+
.map((item) => item.trim())
|
|
69
|
+
.filter(Boolean);
|
|
70
|
+
}
|
|
71
|
+
function parseConfigValue(definition, value) {
|
|
72
|
+
if (definition.type === "string[]")
|
|
73
|
+
return parseListValue(value);
|
|
74
|
+
if (definition.key === "auth.secret" && value.length < 32) {
|
|
75
|
+
throw new Error("auth.secret must be at least 32 characters");
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function assertObject(value) {
|
|
80
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
81
|
+
throw new Error("Pibo config must be a JSON object");
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
export function loadPiboConfig(path = DEFAULT_PIBO_CONFIG_PATH) {
|
|
86
|
+
const resolvedPath = resolve(path);
|
|
87
|
+
if (!existsSync(resolvedPath))
|
|
88
|
+
return {};
|
|
89
|
+
const parsed = JSON.parse(readFileSync(resolvedPath, "utf-8"));
|
|
90
|
+
return assertObject(parsed);
|
|
91
|
+
}
|
|
92
|
+
export function savePiboConfig(config, path = DEFAULT_PIBO_CONFIG_PATH) {
|
|
93
|
+
const resolvedPath = resolve(path);
|
|
94
|
+
mkdirSync(dirname(resolvedPath), { recursive: true });
|
|
95
|
+
writeFileSync(resolvedPath, `${JSON.stringify(config, null, 2)}\n`);
|
|
96
|
+
}
|
|
97
|
+
export function getPiboConfigValue(config, key) {
|
|
98
|
+
getKeyDefinition(key);
|
|
99
|
+
const segments = key.split(".");
|
|
100
|
+
let current = config;
|
|
101
|
+
for (const segment of segments) {
|
|
102
|
+
if (!current || typeof current !== "object" || Array.isArray(current))
|
|
103
|
+
return undefined;
|
|
104
|
+
current = current[segment];
|
|
105
|
+
}
|
|
106
|
+
return current;
|
|
107
|
+
}
|
|
108
|
+
export function getDisplayPiboConfigValue(config, key) {
|
|
109
|
+
const definition = getKeyDefinition(key);
|
|
110
|
+
const value = getPiboConfigValue(config, key);
|
|
111
|
+
if (definition.secret && typeof value === "string")
|
|
112
|
+
return maskSecretValue(value);
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
export function redactPiboConfig(config) {
|
|
116
|
+
const redacted = structuredClone(config);
|
|
117
|
+
for (const definition of PIBO_CONFIG_KEYS) {
|
|
118
|
+
if (!definition.secret)
|
|
119
|
+
continue;
|
|
120
|
+
const value = getPiboConfigValue(config, definition.key);
|
|
121
|
+
if (typeof value !== "string")
|
|
122
|
+
continue;
|
|
123
|
+
const segments = definition.key.split(".");
|
|
124
|
+
let current = redacted;
|
|
125
|
+
for (const segment of segments.slice(0, -1)) {
|
|
126
|
+
const next = current[segment];
|
|
127
|
+
if (!next || typeof next !== "object" || Array.isArray(next)) {
|
|
128
|
+
current = {};
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
current = next;
|
|
132
|
+
}
|
|
133
|
+
current[segments[segments.length - 1]] = maskSecretValue(value);
|
|
134
|
+
}
|
|
135
|
+
return redacted;
|
|
136
|
+
}
|
|
137
|
+
export function setPiboConfigValue(config, key, rawValue) {
|
|
138
|
+
const definition = getKeyDefinition(key);
|
|
139
|
+
const value = parseConfigValue(definition, rawValue);
|
|
140
|
+
const [section, name] = key.split(".");
|
|
141
|
+
if (section !== "auth" || !name)
|
|
142
|
+
throw new Error(`Unsupported config key "${key}"`);
|
|
143
|
+
return {
|
|
144
|
+
...config,
|
|
145
|
+
auth: {
|
|
146
|
+
...config.auth,
|
|
147
|
+
[name]: value,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export function isPiboConfigKeySecret(key) {
|
|
152
|
+
return findKeyDefinition(key)?.secret === true;
|
|
153
|
+
}
|
|
154
|
+
export function deletePiboConfigValue(config, key) {
|
|
155
|
+
getKeyDefinition(key);
|
|
156
|
+
const [section, name] = key.split(".");
|
|
157
|
+
if (section !== "auth" || !name)
|
|
158
|
+
throw new Error(`Unsupported config key "${key}"`);
|
|
159
|
+
if (!config.auth || !(name in config.auth))
|
|
160
|
+
return config;
|
|
161
|
+
const auth = { ...config.auth };
|
|
162
|
+
delete auth[name];
|
|
163
|
+
return {
|
|
164
|
+
...config,
|
|
165
|
+
auth: Object.keys(auth).length > 0 ? auth : undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const PROJECT_ROOT = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
6
|
+
export const PIBO_LIBRARY_BASE_PROMPT_PATH = resolve(PROJECT_ROOT, "context/pibo-system-prompt.md");
|
|
7
|
+
function getBasePromptStatePath(cwd) {
|
|
8
|
+
return resolve(cwd, ".pibo/base-prompt.json");
|
|
9
|
+
}
|
|
10
|
+
function getCustomBasePromptPath(cwd) {
|
|
11
|
+
return resolve(cwd, ".pibo/base-prompt.md");
|
|
12
|
+
}
|
|
13
|
+
function normalizeMode(value) {
|
|
14
|
+
return value === "custom" ? "custom" : "library";
|
|
15
|
+
}
|
|
16
|
+
function readBasePromptState(cwd) {
|
|
17
|
+
const path = getBasePromptStatePath(cwd);
|
|
18
|
+
if (!existsSync(path))
|
|
19
|
+
return { mode: "library" };
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
22
|
+
return {
|
|
23
|
+
mode: normalizeMode(parsed.mode),
|
|
24
|
+
updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : undefined,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return { mode: "library" };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function writeBasePromptState(cwd, state) {
|
|
32
|
+
const path = getBasePromptStatePath(cwd);
|
|
33
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
34
|
+
writeFileSync(path, `${JSON.stringify(state, null, 2)}\n`);
|
|
35
|
+
}
|
|
36
|
+
export function getActivePiboBasePromptPath(cwd = process.cwd()) {
|
|
37
|
+
const legacyOverridePath = resolve(cwd, ".pibo/SYSTEM.md");
|
|
38
|
+
if (existsSync(legacyOverridePath))
|
|
39
|
+
return undefined;
|
|
40
|
+
const customPath = getCustomBasePromptPath(cwd);
|
|
41
|
+
const state = readBasePromptState(cwd);
|
|
42
|
+
if (state.mode === "custom" && existsSync(customPath))
|
|
43
|
+
return customPath;
|
|
44
|
+
return existsSync(PIBO_LIBRARY_BASE_PROMPT_PATH) ? PIBO_LIBRARY_BASE_PROMPT_PATH : undefined;
|
|
45
|
+
}
|
|
46
|
+
export async function readPiboBasePrompt(cwd = process.cwd()) {
|
|
47
|
+
const state = readBasePromptState(cwd);
|
|
48
|
+
const customPath = getCustomBasePromptPath(cwd);
|
|
49
|
+
const customExists = existsSync(customPath);
|
|
50
|
+
const [libraryMarkdown, customMarkdown] = await Promise.all([
|
|
51
|
+
readFile(PIBO_LIBRARY_BASE_PROMPT_PATH, "utf-8"),
|
|
52
|
+
customExists ? readFile(customPath, "utf-8") : Promise.resolve(""),
|
|
53
|
+
]);
|
|
54
|
+
return {
|
|
55
|
+
mode: state.mode,
|
|
56
|
+
effectiveMode: state.mode === "custom" && customExists ? "custom" : "library",
|
|
57
|
+
library: {
|
|
58
|
+
path: PIBO_LIBRARY_BASE_PROMPT_PATH,
|
|
59
|
+
markdown: libraryMarkdown,
|
|
60
|
+
},
|
|
61
|
+
custom: {
|
|
62
|
+
path: customPath,
|
|
63
|
+
markdown: customMarkdown,
|
|
64
|
+
exists: customExists,
|
|
65
|
+
updatedAt: customExists ? state.updatedAt : undefined,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export async function savePiboCustomBasePrompt(markdown, cwd = process.cwd()) {
|
|
70
|
+
const path = getCustomBasePromptPath(cwd);
|
|
71
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
72
|
+
const updatedAt = new Date().toISOString();
|
|
73
|
+
await writeFile(path, markdown);
|
|
74
|
+
writeBasePromptState(cwd, { mode: "custom", updatedAt });
|
|
75
|
+
return readPiboBasePrompt(cwd);
|
|
76
|
+
}
|
|
77
|
+
export function setPiboBasePromptMode(mode, cwd = process.cwd()) {
|
|
78
|
+
const existing = readBasePromptState(cwd);
|
|
79
|
+
const customPath = getCustomBasePromptPath(cwd);
|
|
80
|
+
if (mode === "custom" && !existsSync(customPath)) {
|
|
81
|
+
mkdirSync(dirname(customPath), { recursive: true });
|
|
82
|
+
writeFileSync(customPath, readFileSync(PIBO_LIBRARY_BASE_PROMPT_PATH, "utf-8"));
|
|
83
|
+
}
|
|
84
|
+
writeBasePromptState(cwd, {
|
|
85
|
+
mode,
|
|
86
|
+
updatedAt: mode === "custom" ? existing.updatedAt ?? new Date().toISOString() : existing.updatedAt,
|
|
87
|
+
});
|
|
88
|
+
const state = readBasePromptState(cwd);
|
|
89
|
+
const customExists = existsSync(customPath);
|
|
90
|
+
return {
|
|
91
|
+
mode: state.mode,
|
|
92
|
+
effectiveMode: state.mode === "custom" && customExists ? "custom" : "library",
|
|
93
|
+
library: {
|
|
94
|
+
path: PIBO_LIBRARY_BASE_PROMPT_PATH,
|
|
95
|
+
markdown: readFileSync(PIBO_LIBRARY_BASE_PROMPT_PATH, "utf-8"),
|
|
96
|
+
},
|
|
97
|
+
custom: {
|
|
98
|
+
path: customPath,
|
|
99
|
+
markdown: customExists ? readFileSync(customPath, "utf-8") : "",
|
|
100
|
+
exists: customExists,
|
|
101
|
+
updatedAt: customExists ? state.updatedAt : undefined,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const CODEX_COMPAT_SUBAGENTS = ["default", "explorer", "worker"];
|
|
2
|
+
function currentDate() {
|
|
3
|
+
return new Date().toISOString().slice(0, 10);
|
|
4
|
+
}
|
|
5
|
+
function currentTimezone() {
|
|
6
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
7
|
+
}
|
|
8
|
+
export function buildCodexCompatSystemPrompt(options) {
|
|
9
|
+
const childInstructions = options.isChildSession
|
|
10
|
+
? [
|
|
11
|
+
"## Delegated Child Agent",
|
|
12
|
+
"You are a child agent working as part of a team. Complete the delegated task, continue the thread when the parent sends more input, and return a concise final result for the parent agent.",
|
|
13
|
+
].join("\n")
|
|
14
|
+
: "";
|
|
15
|
+
const compatibilityInstructions = [
|
|
16
|
+
"# Codex-Compatible Runtime",
|
|
17
|
+
"You are running in Pibo through the codex-compat profile. Match Codex-style tool use where the exposed Pibo tools support it, while staying truthful about implemented behavior.",
|
|
18
|
+
"Use Pibo's pibo_run_* tools and generated pibo_subagent_* tools for parallel work, yielded runs, and child-agent lifecycle management.",
|
|
19
|
+
"Use direct execution for normal coding tasks. If a structured planning or user-input tool is not present, ask concise questions in normal chat.",
|
|
20
|
+
"When web_search is selected by the profile, use it for current or externally sourced information.",
|
|
21
|
+
childInstructions,
|
|
22
|
+
"<environment_context>",
|
|
23
|
+
` <cwd>${options.cwd}</cwd>`,
|
|
24
|
+
` <shell>${options.shell}</shell>`,
|
|
25
|
+
` <current_date>${options.currentDate ?? currentDate()}</current_date>`,
|
|
26
|
+
` <timezone>${options.timezone ?? currentTimezone()}</timezone>`,
|
|
27
|
+
` <subagents>${CODEX_COMPAT_SUBAGENTS.join(", ")}</subagents>`,
|
|
28
|
+
"</environment_context>",
|
|
29
|
+
options.baseSystemPrompt,
|
|
30
|
+
];
|
|
31
|
+
return compatibilityInstructions.filter((section) => section.trim().length > 0).join("\n\n");
|
|
32
|
+
}
|
|
33
|
+
export function createCodexCompatExtension(options = {}) {
|
|
34
|
+
return (pi) => {
|
|
35
|
+
pi.on("before_agent_start", (event, ctx) => ({
|
|
36
|
+
systemPrompt: buildCodexCompatSystemPrompt({
|
|
37
|
+
baseSystemPrompt: event.systemPrompt,
|
|
38
|
+
cwd: ctx.cwd,
|
|
39
|
+
shell: options.shell ?? process.env.SHELL ?? "bash",
|
|
40
|
+
isChildSession: options.isChildSession,
|
|
41
|
+
}),
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
}
|