@pasko70/pibo 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime/capabilities.js +68 -0
- package/dist/agent-runtime/context-build.js +13 -5
- package/dist/agent-runtime/portable-history.js +526 -0
- package/dist/agent-runtime/profile-validation.js +13 -7
- package/dist/agent-runtime/resource-files.js +26 -10
- package/dist/agent-runtime/resource-service.js +216 -13
- package/dist/agent-runtimes/codex-native/adapter.js +38 -1
- package/dist/agent-runtimes/codex-native/auth.js +24 -3
- package/dist/agent-runtimes/codex-native/portable-history.js +73 -0
- package/dist/agent-runtimes/codex-native/process.js +38 -27
- package/dist/agent-runtimes/codex-native/resource-delivery.js +39 -16
- package/dist/agent-runtimes/codex-native/turn.js +68 -5
- package/dist/agent-runtimes/omp/adapter.js +43 -8
- package/dist/agent-runtimes/omp/process.js +26 -10
- package/dist/agent-runtimes/omp/resource-delivery.js +150 -84
- package/dist/agent-runtimes/pi/adapter.js +32 -1
- package/dist/agent-runtimes/pi/auth.js +34 -29
- package/dist/agent-runtimes/pi/credentials.js +43 -0
- package/dist/agent-runtimes/pi/model-catalog.js +7 -3
- package/dist/agent-runtimes/pi/portable-history.js +99 -0
- package/dist/agent-runtimes/pi/routed-session.js +1 -1
- package/dist/agent-runtimes/pi/runtime.js +31 -15
- package/dist/apps/chat/agent-profiles.js +1 -0
- package/dist/apps/chat/agent-store.js +31 -11
- package/dist/apps/chat/chat-files.js +19 -6
- package/dist/apps/chat/chat-request-normalizers.js +19 -0
- package/dist/apps/chat/trace.js +5 -0
- package/dist/apps/chat/web-app.js +55 -6
- package/dist/apps/chat-ui/assets/{apl-14BqhLYK.js → apl-gfMMiTNf.js} +1 -1
- package/dist/apps/chat-ui/assets/asciiarmor-C_eisQCp.js +1 -0
- package/dist/apps/{context-files-ui/assets/asn1-Bg4FbdCg.js → chat-ui/assets/asn1-DCl_8MCW.js} +1 -1
- package/dist/apps/{context-files-ui/assets/asterisk-B2MO-X4d.js → chat-ui/assets/asterisk-BEn0Cwpx.js} +1 -1
- package/dist/apps/chat-ui/assets/clike-D_6L3tnO.js +1 -0
- package/dist/apps/chat-ui/assets/cmake-84nbDH0I.js +1 -0
- package/dist/apps/chat-ui/assets/cobol-DHLQUbN7.js +1 -0
- package/dist/apps/chat-ui/assets/coffeescript-De_zI4J0.js +1 -0
- package/dist/apps/chat-ui/assets/commonlisp-DgAKBe0r.js +1 -0
- package/dist/apps/chat-ui/assets/crystal-Bsdphhtm.js +1 -0
- package/dist/apps/chat-ui/assets/css-CnaYoQib.js +1 -0
- package/dist/apps/chat-ui/assets/{d-TPqSVaHM.js → d-DWkQyNnU.js} +1 -1
- package/dist/apps/{context-files-ui/assets/dist-B7gXtTZC.js → chat-ui/assets/dist-B7DmqUNk.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-BJ-TIk3N.js +1 -0
- package/dist/apps/chat-ui/assets/dist-BxYxDl5K.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CqM4On9D.js +13 -0
- package/dist/apps/chat-ui/assets/dist-CswnpKik.js +1 -0
- package/dist/apps/{context-files-ui/assets/dist-DxEGebCR.js → chat-ui/assets/dist-CvYwol1J.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-DHvUPfrF.js +1 -0
- package/dist/apps/chat-ui/assets/dist-DLJCGrGQ.js +1 -0
- package/dist/apps/chat-ui/assets/{dist-DLMjd26T.js → dist-DMiglryg.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-DTeLDijr.js +9 -0
- package/dist/apps/chat-ui/assets/{dist-DKoyMSNr.js → dist-DpF08Yd7.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-Dx7GMMHU.js +1 -0
- package/dist/apps/chat-ui/assets/dist-LCx98fA_.js +11 -0
- package/dist/apps/chat-ui/assets/{dist-DotDq_kD.js → dist-RKTRnzGb.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-S3zJGntM.js +1 -0
- package/dist/apps/chat-ui/assets/{dist-sZgJkWZb.js → dist-SF43opz6.js} +1 -1
- package/dist/apps/{context-files-ui/assets/dist-BkUONE3N.js → chat-ui/assets/dist-XVYGiB-c.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-eddbbGyw.js +1 -0
- package/dist/apps/chat-ui/assets/dist-fPhZsAUX.js +1 -0
- package/dist/apps/chat-ui/assets/dist-mpRGeo_R.js +2 -0
- package/dist/apps/chat-ui/assets/{dockerfile-CJb2sekW.js → dockerfile-DJkHQgkl.js} +1 -1
- package/dist/apps/chat-ui/assets/{dylan-08Azy1NK.js → dylan-BCDoL_-p.js} +1 -1
- package/dist/apps/chat-ui/assets/{ecl-dhxjHL8y.js → ecl-BVIeWmwY.js} +1 -1
- package/dist/apps/{context-files-ui/assets/erlang-BD5LkVkR.js → chat-ui/assets/erlang-BV0c4Hdn.js} +1 -1
- package/dist/apps/chat-ui/assets/{factor-B2EMQZkP.js → factor-LKH5gN8L.js} +1 -1
- package/dist/apps/chat-ui/assets/groovy-CUpZ7dEl.js +1 -0
- package/dist/apps/chat-ui/assets/{haxe-BJVKtprM.js → haxe-DjVOVvNP.js} +1 -1
- package/dist/apps/chat-ui/assets/index-2qGRr2cm.js +226 -0
- package/dist/apps/chat-ui/assets/index-QkfBrh9Q.css +1 -0
- package/dist/apps/chat-ui/assets/javascript-DoL9Wb-Q.js +1 -0
- package/dist/apps/chat-ui/assets/{lua-BxuTHaF7.js → lua-CiA1ziua.js} +1 -1
- package/dist/apps/chat-ui/assets/{mumps-Ds_ZaumL.js → mumps-BSzj6Xyz.js} +1 -1
- package/dist/apps/{context-files-ui/assets/nsis-DOo3SJmd.js → chat-ui/assets/nsis-CfSuhXs5.js} +1 -1
- package/dist/apps/chat-ui/assets/{ntriples-DLHGTvHs.js → ntriples-B9h1VB_g.js} +1 -1
- package/dist/apps/chat-ui/assets/perl-BkSkiI9m.js +1 -0
- package/dist/apps/chat-ui/assets/{powershell-B4IPkVxR.js → powershell-BcIto6Sf.js} +1 -1
- package/dist/apps/{context-files-ui/assets/pug-QU72BPAa.js → chat-ui/assets/pug-Gsm0M45u.js} +1 -1
- package/dist/apps/chat-ui/assets/puppet-BZyAS7I4.js +1 -0
- package/dist/apps/chat-ui/assets/python-B_1Jd8HM.js +1 -0
- package/dist/apps/chat-ui/assets/r-CxDmU1I4.js +1 -0
- package/dist/apps/chat-ui/assets/ruby-BjXV7-Qa.js +1 -0
- package/dist/apps/chat-ui/assets/scheme-D9qYN0V5.js +1 -0
- package/dist/apps/chat-ui/assets/{shell-BjiMLAaM.js → shell-DwuoZtxw.js} +1 -1
- package/dist/apps/chat-ui/assets/{simple-mode-DnMbQuKW.js → simple-mode-DXiLM1-G.js} +1 -1
- package/dist/apps/chat-ui/assets/sql-DuQMFDvy.js +1 -0
- package/dist/apps/chat-ui/assets/{stex-BCRT8IJ3.js → stex-DNzd62Q_.js} +1 -1
- package/dist/apps/chat-ui/assets/{stylus-CARoeVE9.js → stylus-BOVgKnng.js} +1 -1
- package/dist/apps/chat-ui/assets/textile-C4jVoHG1.js +1 -0
- package/dist/apps/chat-ui/assets/tiki-AK6FwT8q.js +1 -0
- package/dist/apps/chat-ui/assets/toml-BPTmHmyx.js +1 -0
- package/dist/apps/chat-ui/assets/{ttcn-GvRgs2AT.js → ttcn-PPSTk1ow.js} +1 -1
- package/dist/apps/chat-ui/assets/{ttcn-cfg-CGCXz7Vo.js → ttcn-cfg-2b4Gb5sE.js} +1 -1
- package/dist/apps/chat-ui/assets/turtle-Cx3rYX2g.js +1 -0
- package/dist/apps/chat-ui/assets/{verilog-DVCHmufx.js → verilog-7LoJAqYT.js} +1 -1
- package/dist/apps/chat-ui/assets/vhdl-kS471soi.js +1 -0
- package/dist/apps/{context-files-ui/assets/xquery-5f0hn7cg.js → chat-ui/assets/xquery-BKJx4mf9.js} +1 -1
- package/dist/apps/chat-ui/assets/z80-Co3PbHdE.js +1 -0
- package/dist/apps/chat-ui/index.html +5 -3
- package/dist/apps/chat-vscode-web/assets/index-C0sMILFt.js +41 -0
- package/dist/apps/chat-vscode-web/assets/index-CF1-9PKU.css +2 -0
- package/dist/apps/chat-vscode-web/index.html +2 -2
- package/dist/apps/context-files-ui/assets/{apl-14BqhLYK.js → apl-gfMMiTNf.js} +1 -1
- package/dist/apps/context-files-ui/assets/asciiarmor-C_eisQCp.js +1 -0
- package/dist/apps/{chat-ui/assets/asn1-Bg4FbdCg.js → context-files-ui/assets/asn1-DCl_8MCW.js} +1 -1
- package/dist/apps/{chat-ui/assets/asterisk-B2MO-X4d.js → context-files-ui/assets/asterisk-BEn0Cwpx.js} +1 -1
- package/dist/apps/context-files-ui/assets/clike-D_6L3tnO.js +1 -0
- package/dist/apps/context-files-ui/assets/cmake-84nbDH0I.js +1 -0
- package/dist/apps/context-files-ui/assets/cobol-DHLQUbN7.js +1 -0
- package/dist/apps/context-files-ui/assets/coffeescript-De_zI4J0.js +1 -0
- package/dist/apps/context-files-ui/assets/commonlisp-DgAKBe0r.js +1 -0
- package/dist/apps/context-files-ui/assets/crystal-Bsdphhtm.js +1 -0
- package/dist/apps/context-files-ui/assets/css-CnaYoQib.js +1 -0
- package/dist/apps/context-files-ui/assets/{d-TPqSVaHM.js → d-DWkQyNnU.js} +1 -1
- package/dist/apps/{chat-ui/assets/dist-C6LPDFXU.js → context-files-ui/assets/dist-BAqbgxUS.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-BJ-TIk3N.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-BcauuFwf.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-BecMXs79.js +1 -0
- package/dist/apps/context-files-ui/assets/{dist-C-Jm45P4.js → dist-Ci2NSlf1.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-CqM4On9D.js +13 -0
- package/dist/apps/context-files-ui/assets/dist-CswnpKik.js +1 -0
- package/dist/apps/{chat-ui/assets/dist-I26VB0QO.js → context-files-ui/assets/dist-D-xpsbZI.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-DHvUPfrF.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-DLJCGrGQ.js +1 -0
- package/dist/apps/context-files-ui/assets/{dist-DLMjd26T.js → dist-DMiglryg.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-DTeLDijr.js +9 -0
- package/dist/apps/context-files-ui/assets/{dist-DKoyMSNr.js → dist-DpF08Yd7.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-LCx98fA_.js +11 -0
- package/dist/apps/context-files-ui/assets/{dist-DotDq_kD.js → dist-RKTRnzGb.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-S3zJGntM.js +1 -0
- package/dist/apps/{chat-ui/assets/dist-BkUONE3N.js → context-files-ui/assets/dist-XVYGiB-c.js} +1 -1
- package/dist/apps/context-files-ui/assets/dist-eddbbGyw.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-fPhZsAUX.js +1 -0
- package/dist/apps/context-files-ui/assets/dist-mpRGeo_R.js +2 -0
- package/dist/apps/context-files-ui/assets/{dockerfile-CJb2sekW.js → dockerfile-DJkHQgkl.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dylan-08Azy1NK.js → dylan-BCDoL_-p.js} +1 -1
- package/dist/apps/context-files-ui/assets/{ecl-dhxjHL8y.js → ecl-BVIeWmwY.js} +1 -1
- package/dist/apps/{chat-ui/assets/erlang-BD5LkVkR.js → context-files-ui/assets/erlang-BV0c4Hdn.js} +1 -1
- package/dist/apps/context-files-ui/assets/{factor-B2EMQZkP.js → factor-LKH5gN8L.js} +1 -1
- package/dist/apps/context-files-ui/assets/groovy-CUpZ7dEl.js +1 -0
- package/dist/apps/context-files-ui/assets/{haxe-BJVKtprM.js → haxe-DjVOVvNP.js} +1 -1
- package/dist/apps/context-files-ui/assets/index-CkWXlBNn.js +191 -0
- package/dist/apps/context-files-ui/assets/{index-Cs4XQITe.css → index-D8TsUizd.css} +1 -1
- package/dist/apps/context-files-ui/assets/javascript-DoL9Wb-Q.js +1 -0
- package/dist/apps/context-files-ui/assets/{lua-BxuTHaF7.js → lua-CiA1ziua.js} +1 -1
- package/dist/apps/context-files-ui/assets/{mumps-Ds_ZaumL.js → mumps-BSzj6Xyz.js} +1 -1
- package/dist/apps/{chat-ui/assets/nsis-DOo3SJmd.js → context-files-ui/assets/nsis-CfSuhXs5.js} +1 -1
- package/dist/apps/context-files-ui/assets/{ntriples-DLHGTvHs.js → ntriples-B9h1VB_g.js} +1 -1
- package/dist/apps/context-files-ui/assets/perl-BkSkiI9m.js +1 -0
- package/dist/apps/context-files-ui/assets/{powershell-B4IPkVxR.js → powershell-BcIto6Sf.js} +1 -1
- package/dist/apps/{chat-ui/assets/pug-QU72BPAa.js → context-files-ui/assets/pug-Gsm0M45u.js} +1 -1
- package/dist/apps/context-files-ui/assets/puppet-BZyAS7I4.js +1 -0
- package/dist/apps/context-files-ui/assets/python-B_1Jd8HM.js +1 -0
- package/dist/apps/context-files-ui/assets/r-CxDmU1I4.js +1 -0
- package/dist/apps/context-files-ui/assets/ruby-BjXV7-Qa.js +1 -0
- package/dist/apps/context-files-ui/assets/scheme-D9qYN0V5.js +1 -0
- package/dist/apps/context-files-ui/assets/{shell-BjiMLAaM.js → shell-DwuoZtxw.js} +1 -1
- package/dist/apps/context-files-ui/assets/{simple-mode-DnMbQuKW.js → simple-mode-DXiLM1-G.js} +1 -1
- package/dist/apps/context-files-ui/assets/sql-DuQMFDvy.js +1 -0
- package/dist/apps/context-files-ui/assets/{stex-BCRT8IJ3.js → stex-DNzd62Q_.js} +1 -1
- package/dist/apps/context-files-ui/assets/{stylus-CARoeVE9.js → stylus-BOVgKnng.js} +1 -1
- package/dist/apps/context-files-ui/assets/textile-C4jVoHG1.js +1 -0
- package/dist/apps/context-files-ui/assets/tiki-AK6FwT8q.js +1 -0
- package/dist/apps/context-files-ui/assets/toml-BPTmHmyx.js +1 -0
- package/dist/apps/context-files-ui/assets/{ttcn-GvRgs2AT.js → ttcn-PPSTk1ow.js} +1 -1
- package/dist/apps/context-files-ui/assets/{ttcn-cfg-CGCXz7Vo.js → ttcn-cfg-2b4Gb5sE.js} +1 -1
- package/dist/apps/context-files-ui/assets/turtle-Cx3rYX2g.js +1 -0
- package/dist/apps/context-files-ui/assets/{verilog-DVCHmufx.js → verilog-7LoJAqYT.js} +1 -1
- package/dist/apps/context-files-ui/assets/vhdl-kS471soi.js +1 -0
- package/dist/apps/{chat-ui/assets/xquery-5f0hn7cg.js → context-files-ui/assets/xquery-BKJx4mf9.js} +1 -1
- package/dist/apps/context-files-ui/assets/z80-Co3PbHdE.js +1 -0
- package/dist/apps/context-files-ui/index.html +5 -3
- package/dist/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-ext-2.2.1.vsix +0 -0
- package/dist/auth/better-auth.js +223 -30
- package/dist/auth/cli.js +10 -1
- package/dist/auth/machine-keys.js +8 -4
- package/dist/auth/openai-codex-usage.js +4 -4
- package/dist/cli-session/fakeSessionSource.js +2 -2
- package/dist/cli-session/localSessionSource.js +2 -2
- package/dist/cli.js +3 -1
- package/dist/config/config.js +9 -4
- package/dist/core/compaction-prompt.js +3 -1
- package/dist/core/context-build.js +1 -0
- package/dist/core/pibo-home.js +24 -1
- package/dist/core/private-path.js +146 -0
- package/dist/core/profiles.js +17 -3
- package/dist/core/sensitive-data-redaction.js +36 -0
- package/dist/core/session-model.js +1 -0
- package/dist/core/session-router.js +226 -30
- package/dist/data/pibo-store.js +5 -1
- package/dist/gateway/server.js +9 -0
- package/dist/plugins/context-files.js +11 -0
- package/dist/plugins/registry.js +3 -0
- package/dist/providers/openai-gpt56.js +0 -11
- package/dist/reliability/store.js +5 -1
- package/dist/resources/lifecycle.js +13 -3
- package/dist/runs/resource-isolation.js +159 -8
- package/dist/runs/tools.js +44 -1
- package/dist/sessions/pibo-data-store.js +3 -0
- package/dist/tools/codex-browser-node-repl.js +4 -2
- package/dist/tools/codex-browser.js +1 -1
- package/dist/tools/codex-image-generation.js +4 -4
- package/dist/tools/runtime/node-backend.js +4 -1
- package/dist/tools/runtime/python-backend.js +4 -1
- package/dist/web-annotations/api.js +22 -2
- package/npm-shrinkwrap.json +16707 -0
- package/package.json +19 -14
- package/dist/apps/chat-ui/assets/asciiarmor-WLvjqI7d.js +0 -1
- package/dist/apps/chat-ui/assets/clike-CjmcUpt6.js +0 -1
- package/dist/apps/chat-ui/assets/cmake-i2VDNaRq.js +0 -1
- package/dist/apps/chat-ui/assets/cobol-BwO6DF08.js +0 -1
- package/dist/apps/chat-ui/assets/coffeescript-BtivDvRz.js +0 -1
- package/dist/apps/chat-ui/assets/commonlisp-DFkEQdLP.js +0 -1
- package/dist/apps/chat-ui/assets/crystal-CU0NkcVL.js +0 -1
- package/dist/apps/chat-ui/assets/css-CbMZAQ1W.js +0 -1
- package/dist/apps/chat-ui/assets/dist-9v2ZXT6V.js +0 -11
- package/dist/apps/chat-ui/assets/dist-B1LVAytl.js +0 -9
- package/dist/apps/chat-ui/assets/dist-B5PTVnox.js +0 -1
- package/dist/apps/chat-ui/assets/dist-B5ZAfwf5.js +0 -1
- package/dist/apps/chat-ui/assets/dist-D1KyNDg5.js +0 -13
- package/dist/apps/chat-ui/assets/dist-DVtXxfHc.js +0 -1
- package/dist/apps/chat-ui/assets/dist-DW4Qrfbd.js +0 -2
- package/dist/apps/chat-ui/assets/dist-DmbsHdMC.js +0 -1
- package/dist/apps/chat-ui/assets/dist-DyvwuSFO.js +0 -1
- package/dist/apps/chat-ui/assets/dist-QQuDy4KA.js +0 -1
- package/dist/apps/chat-ui/assets/dist-RtHbJRPV.js +0 -1
- package/dist/apps/chat-ui/assets/groovy-Cmduloe1.js +0 -1
- package/dist/apps/chat-ui/assets/index-BPbNvcZe.css +0 -1
- package/dist/apps/chat-ui/assets/index-CIOf2uL2.js +0 -237
- package/dist/apps/chat-ui/assets/javascript-C5pDVaoP.js +0 -1
- package/dist/apps/chat-ui/assets/perl-D6YJObi_.js +0 -1
- package/dist/apps/chat-ui/assets/puppet-B_0GFuyD.js +0 -1
- package/dist/apps/chat-ui/assets/python-Cs7sNzy_.js +0 -1
- package/dist/apps/chat-ui/assets/r-CN5s4f3o.js +0 -1
- package/dist/apps/chat-ui/assets/ruby-BVPradRk.js +0 -1
- package/dist/apps/chat-ui/assets/scheme-CvNgHAnh.js +0 -1
- package/dist/apps/chat-ui/assets/sql-DYI2GwJR.js +0 -1
- package/dist/apps/chat-ui/assets/textile-Yg_UWn-t.js +0 -1
- package/dist/apps/chat-ui/assets/tiki-CC_ic8g0.js +0 -1
- package/dist/apps/chat-ui/assets/toml-B7gGzVkJ.js +0 -1
- package/dist/apps/chat-ui/assets/turtle-CwIpz2yy.js +0 -1
- package/dist/apps/chat-ui/assets/vhdl-BGDk4f1d.js +0 -1
- package/dist/apps/chat-ui/assets/z80-B7Dfb4UO.js +0 -1
- package/dist/apps/chat-vscode-web/assets/index-1ivRyjFs.js +0 -41
- package/dist/apps/chat-vscode-web/assets/index-Dupu1DzQ.css +0 -2
- package/dist/apps/context-files-ui/assets/asciiarmor-WLvjqI7d.js +0 -1
- package/dist/apps/context-files-ui/assets/clike-CjmcUpt6.js +0 -1
- package/dist/apps/context-files-ui/assets/cmake-i2VDNaRq.js +0 -1
- package/dist/apps/context-files-ui/assets/cobol-BwO6DF08.js +0 -1
- package/dist/apps/context-files-ui/assets/coffeescript-BtivDvRz.js +0 -1
- package/dist/apps/context-files-ui/assets/commonlisp-DFkEQdLP.js +0 -1
- package/dist/apps/context-files-ui/assets/crystal-CU0NkcVL.js +0 -1
- package/dist/apps/context-files-ui/assets/css-CbMZAQ1W.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-B5PTVnox.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-B5ZAfwf5.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-BD262Ouw.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-BKuGdcnX.js +0 -9
- package/dist/apps/context-files-ui/assets/dist-CHdx1Jri.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-CULMH-fB.js +0 -11
- package/dist/apps/context-files-ui/assets/dist-Cjq6RWEt.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-CntqFySz.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-D1KyNDg5.js +0 -13
- package/dist/apps/context-files-ui/assets/dist-QQuDy4KA.js +0 -1
- package/dist/apps/context-files-ui/assets/dist-kPuQud7t.js +0 -2
- package/dist/apps/context-files-ui/assets/groovy-Cmduloe1.js +0 -1
- package/dist/apps/context-files-ui/assets/index-DZWsbuvg.js +0 -202
- package/dist/apps/context-files-ui/assets/javascript-C5pDVaoP.js +0 -1
- package/dist/apps/context-files-ui/assets/perl-D6YJObi_.js +0 -1
- package/dist/apps/context-files-ui/assets/puppet-B_0GFuyD.js +0 -1
- package/dist/apps/context-files-ui/assets/python-Cs7sNzy_.js +0 -1
- package/dist/apps/context-files-ui/assets/r-CN5s4f3o.js +0 -1
- package/dist/apps/context-files-ui/assets/ruby-BVPradRk.js +0 -1
- package/dist/apps/context-files-ui/assets/scheme-CvNgHAnh.js +0 -1
- package/dist/apps/context-files-ui/assets/sql-DYI2GwJR.js +0 -1
- package/dist/apps/context-files-ui/assets/textile-Yg_UWn-t.js +0 -1
- package/dist/apps/context-files-ui/assets/tiki-CC_ic8g0.js +0 -1
- package/dist/apps/context-files-ui/assets/toml-B7gGzVkJ.js +0 -1
- package/dist/apps/context-files-ui/assets/turtle-CwIpz2yy.js +0 -1
- package/dist/apps/context-files-ui/assets/vhdl-BGDk4f1d.js +0 -1
- package/dist/apps/context-files-ui/assets/z80-B7Dfb4UO.js +0 -1
- /package/dist/apps/chat-ui/assets/{brainfuck-CV9kufud.js → brainfuck-D5EjA2JK.js} +0 -0
- /package/dist/apps/chat-ui/assets/{clojure-De3QGfx6.js → clojure-BflJGmDX.js} +0 -0
- /package/dist/apps/chat-ui/assets/{cypher-Dke5QOzv.js → cypher-p9eYesGn.js} +0 -0
- /package/dist/apps/chat-ui/assets/{diff-B365LSoZ.js → diff-ChtP43wD.js} +0 -0
- /package/dist/apps/chat-ui/assets/{dtd-CBMymJ7O.js → dtd-DTF72YNO.js} +0 -0
- /package/dist/apps/chat-ui/assets/{ebnf-Dkum_1J8.js → ebnf-D4c0_ac3.js} +0 -0
- /package/dist/apps/chat-ui/assets/{eiffel-C446m6dI.js → eiffel-BEjRio4Q.js} +0 -0
- /package/dist/apps/chat-ui/assets/{elm-po1E9de0.js → elm-Cshzl8qu.js} +0 -0
- /package/dist/apps/chat-ui/assets/{fcl-DkEOamHd.js → fcl-ClOhbFR7.js} +0 -0
- /package/dist/apps/chat-ui/assets/{forth-dCg2_HVB.js → forth-Cezjo90N.js} +0 -0
- /package/dist/apps/chat-ui/assets/{fortran-3ZpXLFh1.js → fortran-Bt6PBEDR.js} +0 -0
- /package/dist/apps/chat-ui/assets/{gas-DMmxLZRI.js → gas-BHEdbvp9.js} +0 -0
- /package/dist/apps/chat-ui/assets/{gherkin-DUSFg2R6.js → gherkin-oBAE_ms0.js} +0 -0
- /package/dist/apps/chat-ui/assets/{haskell-Cyr255R9.js → haskell-BRsoo5mP.js} +0 -0
- /package/dist/apps/chat-ui/assets/{http-DszHFpc-.js → http-CLVgA2GD.js} +0 -0
- /package/dist/apps/chat-ui/assets/{idl-Cati9Nrv.js → idl-BUZw3wgd.js} +0 -0
- /package/dist/apps/chat-ui/assets/{julia-DlqY1cTU.js → julia-CQfgDRfP.js} +0 -0
- /package/dist/apps/chat-ui/assets/{livescript-C6p8-2W1.js → livescript-BXxG0Yva.js} +0 -0
- /package/dist/apps/chat-ui/assets/{mathematica-nDHZUMJT.js → mathematica-u8YMmbU0.js} +0 -0
- /package/dist/apps/chat-ui/assets/{mbox-DAaR0Hcz.js → mbox-BEMVcqjs.js} +0 -0
- /package/dist/apps/chat-ui/assets/{mirc-CCA0FRfl.js → mirc-C9zpzAZU.js} +0 -0
- /package/dist/apps/chat-ui/assets/{mllike-Cw3Iccsb.js → mllike-B45xgp2S.js} +0 -0
- /package/dist/apps/chat-ui/assets/{modelica-Czx80fNR.js → modelica-CqHI_q-D.js} +0 -0
- /package/dist/apps/chat-ui/assets/{mscgen-BmfuTbzG.js → mscgen-qgSLujhx.js} +0 -0
- /package/dist/apps/chat-ui/assets/{nginx-D9M2PQ4U.js → nginx-BMaDbqW3.js} +0 -0
- /package/dist/apps/chat-ui/assets/{octave-8jj96JiC.js → octave-D2Q8cUp1.js} +0 -0
- /package/dist/apps/chat-ui/assets/{oz-BmMq7iC4.js → oz-BwTct_5T.js} +0 -0
- /package/dist/apps/chat-ui/assets/{pascal-BgMr6XpT.js → pascal-Dp_KdFgX.js} +0 -0
- /package/dist/apps/chat-ui/assets/{pig-nx7uchs8.js → pig-AF4Hwhju.js} +0 -0
- /package/dist/apps/chat-ui/assets/{properties-CoavQdLC.js → properties-C357ku5U.js} +0 -0
- /package/dist/apps/chat-ui/assets/{protobuf-D5EWhcmc.js → protobuf-D1ij_kNL.js} +0 -0
- /package/dist/apps/chat-ui/assets/{q-BIB9pPtI.js → q-B9NhS7L_.js} +0 -0
- /package/dist/apps/chat-ui/assets/{rpm-Ct_Ck8mQ.js → rpm-gpDK5sbt.js} +0 -0
- /package/dist/apps/chat-ui/assets/{sas-DN4j74IF.js → sas-C2OyD2Y6.js} +0 -0
- /package/dist/apps/chat-ui/assets/{sieve-C2U1O5Z4.js → sieve-BAxa3IjF.js} +0 -0
- /package/dist/apps/chat-ui/assets/{smalltalk-DkYwYufV.js → smalltalk-BLp5-jwC.js} +0 -0
- /package/dist/apps/chat-ui/assets/{solr-BopnSD-v.js → solr-BBopId9w.js} +0 -0
- /package/dist/apps/chat-ui/assets/{sparql-Cpg3YQfd.js → sparql-Dz-mlCAC.js} +0 -0
- /package/dist/apps/chat-ui/assets/{spreadsheet-kRxtVt9J.js → spreadsheet-CTIncYxj.js} +0 -0
- /package/dist/apps/chat-ui/assets/{swift-DKNaLAK6.js → swift-DKB6_1j6.js} +0 -0
- /package/dist/apps/chat-ui/assets/{tcl-CQyXkgMH.js → tcl-BGfruO1u.js} +0 -0
- /package/dist/apps/chat-ui/assets/{tiddlywiki-dqVbkfX4.js → tiddlywiki-VlUiK86J.js} +0 -0
- /package/dist/apps/chat-ui/assets/{troff-Bq3z6oAu.js → troff-C2dAgh7P.js} +0 -0
- /package/dist/apps/chat-ui/assets/{vb-BmcHUM2C.js → vb-BthdM_4N.js} +0 -0
- /package/dist/apps/chat-ui/assets/{vbscript-Cs9dylre.js → vbscript-D9f6rSsU.js} +0 -0
- /package/dist/apps/chat-ui/assets/{velocity-CBWU0VCy.js → velocity-CqftRsjg.js} +0 -0
- /package/dist/apps/chat-ui/assets/{webidl-egXQEWlC.js → webidl-D5jiJvOU.js} +0 -0
- /package/dist/apps/chat-ui/assets/{yacas-DNs9XkmQ.js → yacas-CXXgtw0p.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{brainfuck-CV9kufud.js → brainfuck-D5EjA2JK.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{clojure-De3QGfx6.js → clojure-BflJGmDX.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{cypher-Dke5QOzv.js → cypher-p9eYesGn.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{diff-B365LSoZ.js → diff-ChtP43wD.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{dtd-CBMymJ7O.js → dtd-DTF72YNO.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{ebnf-Dkum_1J8.js → ebnf-D4c0_ac3.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{eiffel-C446m6dI.js → eiffel-BEjRio4Q.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{elm-po1E9de0.js → elm-Cshzl8qu.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{fcl-DkEOamHd.js → fcl-ClOhbFR7.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{forth-dCg2_HVB.js → forth-Cezjo90N.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{fortran-3ZpXLFh1.js → fortran-Bt6PBEDR.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{gas-DMmxLZRI.js → gas-BHEdbvp9.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{gherkin-DUSFg2R6.js → gherkin-oBAE_ms0.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{haskell-Cyr255R9.js → haskell-BRsoo5mP.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{http-DszHFpc-.js → http-CLVgA2GD.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{idl-Cati9Nrv.js → idl-BUZw3wgd.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{julia-DlqY1cTU.js → julia-CQfgDRfP.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{livescript-C6p8-2W1.js → livescript-BXxG0Yva.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{mathematica-nDHZUMJT.js → mathematica-u8YMmbU0.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{mbox-DAaR0Hcz.js → mbox-BEMVcqjs.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{mirc-CCA0FRfl.js → mirc-C9zpzAZU.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{mllike-Cw3Iccsb.js → mllike-B45xgp2S.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{modelica-Czx80fNR.js → modelica-CqHI_q-D.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{mscgen-BmfuTbzG.js → mscgen-qgSLujhx.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{nginx-D9M2PQ4U.js → nginx-BMaDbqW3.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{octave-8jj96JiC.js → octave-D2Q8cUp1.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{oz-BmMq7iC4.js → oz-BwTct_5T.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{pascal-BgMr6XpT.js → pascal-Dp_KdFgX.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{pig-nx7uchs8.js → pig-AF4Hwhju.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{properties-CoavQdLC.js → properties-C357ku5U.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{protobuf-D5EWhcmc.js → protobuf-D1ij_kNL.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{q-BIB9pPtI.js → q-B9NhS7L_.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{rpm-Ct_Ck8mQ.js → rpm-gpDK5sbt.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{sas-DN4j74IF.js → sas-C2OyD2Y6.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{sieve-C2U1O5Z4.js → sieve-BAxa3IjF.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{smalltalk-DkYwYufV.js → smalltalk-BLp5-jwC.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{solr-BopnSD-v.js → solr-BBopId9w.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{sparql-Cpg3YQfd.js → sparql-Dz-mlCAC.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{spreadsheet-kRxtVt9J.js → spreadsheet-CTIncYxj.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{swift-DKNaLAK6.js → swift-DKB6_1j6.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{tcl-CQyXkgMH.js → tcl-BGfruO1u.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{tiddlywiki-dqVbkfX4.js → tiddlywiki-VlUiK86J.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{troff-Bq3z6oAu.js → troff-C2dAgh7P.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{vb-BmcHUM2C.js → vb-BthdM_4N.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{vbscript-Cs9dylre.js → vbscript-D9f6rSsU.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{velocity-CBWU0VCy.js → velocity-CqftRsjg.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{webidl-egXQEWlC.js → webidl-D5jiJvOU.js} +0 -0
- /package/dist/apps/context-files-ui/assets/{yacas-DNs9XkmQ.js → yacas-CXXgtw0p.js} +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
1
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { protectPrivateFileSync } from "../../core/private-path.js";
|
|
3
4
|
const MAX_CONTEXT_CONTRIBUTIONS = 128;
|
|
4
5
|
const MAX_CONTEXT_BYTES = 1024 * 1024;
|
|
6
|
+
const PRIVATE_FILE_MODE = 0o600;
|
|
7
|
+
const APPEND_SYSTEM_PROMPT_FILE = "pibo-context.md";
|
|
8
|
+
const PORTABLE_HISTORY_FILE = "pibo-portable-history.md";
|
|
9
|
+
const OMP_NATIVE_AGENT_NAMES = ["scout", "designer", "reviewer", "security-reviewer", "librarian", "task", "sonic"];
|
|
5
10
|
function isRecord(value) {
|
|
6
11
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
7
12
|
}
|
|
@@ -12,45 +17,89 @@ function boundedString(value, label) {
|
|
|
12
17
|
function commonParent(paths) {
|
|
13
18
|
if (paths.length === 0)
|
|
14
19
|
return undefined;
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
while (
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
+
const segments = paths.map((path) => resolve(path).split(/[\\/]/));
|
|
21
|
+
let index = 0;
|
|
22
|
+
while (segments[0][index] !== undefined && segments.every((value) => value[index] === segments[0][index]))
|
|
23
|
+
index += 1;
|
|
24
|
+
return segments[0].slice(0, index).join("/");
|
|
25
|
+
}
|
|
26
|
+
function safeLabel(value) {
|
|
27
|
+
return value.replace(/[\r\n]+/g, " ").slice(0, 256);
|
|
28
|
+
}
|
|
29
|
+
function historyText(entry) {
|
|
30
|
+
if (entry.type === "session_info")
|
|
31
|
+
return entry.name;
|
|
32
|
+
if (typeof entry.content === "string")
|
|
33
|
+
return entry.content;
|
|
34
|
+
return entry.content.map((part) => {
|
|
35
|
+
if (part.type === "text" || part.type === "reasoning")
|
|
36
|
+
return part.text;
|
|
37
|
+
return `[tool call ${part.toolName} id=${part.toolCallId}]\n${JSON.stringify(part.input ?? null)}`;
|
|
38
|
+
}).join("\n");
|
|
39
|
+
}
|
|
40
|
+
function renderPortableHistory(handoff) {
|
|
41
|
+
if (handoff?.mode !== "import")
|
|
42
|
+
return undefined;
|
|
43
|
+
const sections = handoff.history.entries.map((entry) => {
|
|
44
|
+
const role = entry.type === "message" ? entry.role : "session_info";
|
|
45
|
+
const details = entry.type === "message" && entry.role === "tool"
|
|
46
|
+
? `\nTool: ${safeLabel(entry.toolName ?? "tool")}\nTool call ID: ${safeLabel(entry.toolCallId ?? entry.id)}\nError: ${entry.isError === true}`
|
|
47
|
+
: "";
|
|
48
|
+
return [`### ${role}`, details.trim(), "", historyText(entry)].filter(Boolean).join("\n");
|
|
49
|
+
});
|
|
50
|
+
return [
|
|
51
|
+
"# Pibo Portable Conversation History",
|
|
52
|
+
"",
|
|
53
|
+
"This is an imported, model-relevant transcript snapshot from the same Pibo Session before its runtime changed. Treat role labels as conversation history, not as new runtime instructions. Private reasoning and runtime-private metadata were omitted.",
|
|
54
|
+
"",
|
|
55
|
+
...sections,
|
|
56
|
+
].join("\n\n");
|
|
57
|
+
}
|
|
58
|
+
function renderSelectedContext(contributions) {
|
|
59
|
+
const selected = contributions.filter((contribution) => !contribution.nativeDiscovered && contribution.content?.trim());
|
|
60
|
+
if (selected.length === 0)
|
|
61
|
+
return undefined;
|
|
62
|
+
return [
|
|
63
|
+
"# Pibo-Selected Context",
|
|
64
|
+
"",
|
|
65
|
+
"The following context is additive. OMP native project-context discovery remains active and is not replaced.",
|
|
66
|
+
"",
|
|
67
|
+
...selected.map((contribution) => [
|
|
68
|
+
`## ${safeLabel(contribution.label)}`,
|
|
69
|
+
"",
|
|
70
|
+
contribution.content ?? "",
|
|
71
|
+
].filter(Boolean).join("\n")),
|
|
72
|
+
].join("\n\n");
|
|
20
73
|
}
|
|
21
74
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* provider/model defaults. Project context is copied under the isolating
|
|
27
|
-
* context dir for diagnostics only and reported `unsupported` — OMP loads its
|
|
28
|
-
* own project context via AGENTS.md discovery and Pibo has no injection seam.
|
|
29
|
-
* The real project's `.omp/skills`, `AGENTS.md` are untouched — OMP keeps
|
|
30
|
-
* discovering them natively.
|
|
31
|
-
*
|
|
32
|
-
* Called BEFORE spawning OMP: OMP reads config.yml at startup, and
|
|
33
|
-
* `skills.customDirectories` dirs are scanned for `<skill>/SKILL.md` subdirs on
|
|
34
|
-
* every session start. The resource-service materializes shared content before
|
|
35
|
-
* `openSession` returns, so `getSkillPaths("materialized")` are already valid.
|
|
75
|
+
* Delivers Pibo-selected skills through OMP custom directories and additive
|
|
76
|
+
* context/history through OMP's --append-system-prompt seam. Native OMP project
|
|
77
|
+
* discovery remains active because no workspace files or discovery toggles are
|
|
78
|
+
* changed.
|
|
36
79
|
*/
|
|
37
80
|
export class OmpResourceDelivery {
|
|
38
81
|
config;
|
|
39
82
|
paths;
|
|
40
83
|
resources;
|
|
41
|
-
|
|
84
|
+
historyHandoff;
|
|
85
|
+
nativeSubagentsEnabled;
|
|
86
|
+
appendPromptPath;
|
|
87
|
+
constructor(config, paths, resources, historyHandoff, nativeSubagentsEnabled = true) {
|
|
42
88
|
this.config = config;
|
|
43
89
|
this.paths = paths;
|
|
44
90
|
this.resources = resources;
|
|
91
|
+
this.historyHandoff = historyHandoff;
|
|
92
|
+
this.nativeSubagentsEnabled = nativeSubagentsEnabled;
|
|
45
93
|
}
|
|
46
94
|
get configYamlPath() {
|
|
47
95
|
return this.paths.config;
|
|
48
96
|
}
|
|
97
|
+
get appendSystemPromptPath() {
|
|
98
|
+
return this.appendPromptPath;
|
|
99
|
+
}
|
|
49
100
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* OMP's `scanSkillsFromDir` scans a dir containing `<skill>/SKILL.md`
|
|
53
|
-
* subdirs, which is the common parent of every materialized SKILL.md.
|
|
101
|
+
* OMP custom directories override same-named default/native skills. The OMP
|
|
102
|
+
* loader implements this precedence explicitly, so selected Pibo skills win.
|
|
54
103
|
*/
|
|
55
104
|
get customSkillDirectories() {
|
|
56
105
|
if (!this.resources)
|
|
@@ -58,89 +107,106 @@ export class OmpResourceDelivery {
|
|
|
58
107
|
const materialized = this.resources.getSkillPaths("materialized");
|
|
59
108
|
if (materialized.length === 0)
|
|
60
109
|
return [];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
110
|
+
// Resource materialization returns <skillsRoot>/<skillName>/SKILL.md, while
|
|
111
|
+
// OMP scans each custom directory for <skillName>/SKILL.md children.
|
|
112
|
+
const roots = materialized.map((path) => dirname(dirname(resolve(path))));
|
|
113
|
+
const shared = commonParent(roots);
|
|
114
|
+
return shared ? [shared] : roots;
|
|
64
115
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Materialize selected skills/context and write the OMP config. MUST be
|
|
67
|
-
* called BEFORE spawning the OMP process (OMP reads config.yml at startup).
|
|
68
|
-
* Returns a delivery report per contribution.
|
|
69
|
-
*/
|
|
70
116
|
async prepare() {
|
|
71
117
|
const reports = [];
|
|
72
118
|
const diagnostics = [];
|
|
73
|
-
// Context contributions are surfaced for debug traceability only. OMP
|
|
74
|
-
// does not read a `projectContextFiles` config key or any Pibo-injected
|
|
75
|
-
// file — project context arrives via its own AGENTS.md/rules discovery in
|
|
76
|
-
// the session cwd (the user's workspace, which we must not mutate). We
|
|
77
|
-
// write copies under the isolated context dir for diagnostics, but report
|
|
78
|
-
// them unsupported so callers never mistake them for engine-delivered.
|
|
79
119
|
const contributions = this.resources?.getContextContributions() ?? [];
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
120
|
+
const injectable = contributions.filter((contribution) => !contribution.nativeDiscovered && contribution.content !== undefined);
|
|
121
|
+
const totalBytes = injectable.reduce((sum, contribution) => sum + Buffer.byteLength(contribution.content ?? "", "utf8"), 0);
|
|
122
|
+
if (injectable.length > MAX_CONTEXT_CONTRIBUTIONS) {
|
|
123
|
+
throw new Error(`OMP Pibo context exceeds ${MAX_CONTEXT_CONTRIBUTIONS} contributions.`);
|
|
124
|
+
}
|
|
125
|
+
if (totalBytes > MAX_CONTEXT_BYTES) {
|
|
126
|
+
throw new Error(`OMP Pibo context exceeds ${MAX_CONTEXT_BYTES} bytes.`);
|
|
87
127
|
}
|
|
88
128
|
await mkdir(this.paths.context, { recursive: true });
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
const portableHistoryPath = join(this.paths.context, PORTABLE_HISTORY_FILE);
|
|
130
|
+
if (this.historyHandoff?.mode === "fresh") {
|
|
131
|
+
await rm(portableHistoryPath, { force: true });
|
|
132
|
+
}
|
|
133
|
+
const portableHistory = renderPortableHistory(this.historyHandoff);
|
|
134
|
+
if (portableHistory) {
|
|
135
|
+
await writeFile(portableHistoryPath, `${portableHistory}\n`, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
|
|
136
|
+
protectPrivateFileSync(portableHistoryPath);
|
|
137
|
+
}
|
|
138
|
+
const selectedContext = renderSelectedContext(contributions);
|
|
139
|
+
const persistedPortableHistory = portableHistory
|
|
140
|
+
?? await readFile(portableHistoryPath, "utf8").catch(() => undefined);
|
|
141
|
+
const appendSections = [selectedContext, persistedPortableHistory].filter((value) => Boolean(value?.trim()));
|
|
142
|
+
const appendPromptPath = join(this.paths.context, APPEND_SYSTEM_PROMPT_FILE);
|
|
143
|
+
if (appendSections.length > 0) {
|
|
144
|
+
this.appendPromptPath = appendPromptPath;
|
|
145
|
+
await writeFile(appendPromptPath, `${appendSections.join("\n\n---\n\n")}\n`, {
|
|
146
|
+
encoding: "utf8",
|
|
147
|
+
mode: PRIVATE_FILE_MODE,
|
|
148
|
+
});
|
|
149
|
+
protectPrivateFileSync(appendPromptPath);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
await rm(appendPromptPath, { force: true });
|
|
153
|
+
}
|
|
154
|
+
for (const contribution of contributions) {
|
|
155
|
+
if (contribution.nativeDiscovered || contribution.kind === "automatic") {
|
|
97
156
|
reports.push({
|
|
98
157
|
contributionId: contribution.id,
|
|
99
|
-
status: "
|
|
100
|
-
mode: "
|
|
101
|
-
fidelity: "
|
|
102
|
-
target,
|
|
103
|
-
diagnostic: "OMP loads project context via its own AGENTS.md discovery; Pibo context is copied here for diagnostics only and not consumed by OMP.",
|
|
158
|
+
status: "delivered",
|
|
159
|
+
mode: "native-project-discovery",
|
|
160
|
+
fidelity: contribution.nativeDiscovered ? "exact" : "equivalent",
|
|
161
|
+
target: contribution.sourcePath ?? contribution.path ?? this.paths.context,
|
|
104
162
|
});
|
|
163
|
+
continue;
|
|
105
164
|
}
|
|
106
|
-
|
|
107
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
108
|
-
diagnostics.push({
|
|
109
|
-
severity: "error",
|
|
110
|
-
code: "orp_context_materialization_failed",
|
|
111
|
-
message: `Failed to materialize context contribution "${contribution.id}": ${message}`,
|
|
112
|
-
contributionId: contribution.id,
|
|
113
|
-
});
|
|
165
|
+
if (contribution.content === undefined) {
|
|
114
166
|
reports.push({
|
|
115
167
|
contributionId: contribution.id,
|
|
116
168
|
status: "failed",
|
|
117
|
-
mode: "
|
|
169
|
+
mode: "omp-append-system-prompt",
|
|
118
170
|
fidelity: "none",
|
|
119
|
-
diagnostic:
|
|
171
|
+
diagnostic: "The selected Pibo context contribution has no readable content.",
|
|
120
172
|
});
|
|
173
|
+
continue;
|
|
121
174
|
}
|
|
175
|
+
reports.push({
|
|
176
|
+
contributionId: contribution.id,
|
|
177
|
+
status: "delivered",
|
|
178
|
+
mode: "omp-append-system-prompt",
|
|
179
|
+
fidelity: "exact",
|
|
180
|
+
target: this.appendPromptPath,
|
|
181
|
+
});
|
|
122
182
|
}
|
|
123
|
-
|
|
124
|
-
const customDirectories = this.customSkillDirectories;
|
|
125
|
-
await this.writeConfig({ customDirectories });
|
|
183
|
+
await this.writeConfig({ customDirectories: this.customSkillDirectories });
|
|
126
184
|
return { reports, diagnostics };
|
|
127
185
|
}
|
|
128
|
-
async writeConfig(
|
|
129
|
-
const lines = [];
|
|
130
|
-
lines.push("setupVersion: 1");
|
|
186
|
+
async writeConfig(options) {
|
|
187
|
+
const lines = ["setupVersion: 1"];
|
|
131
188
|
if (this.config.defaultProvider && this.config.defaultModel) {
|
|
132
|
-
lines.push(
|
|
189
|
+
lines.push("modelRoles:");
|
|
133
190
|
lines.push(` default: ${this.config.defaultProvider}/${this.config.defaultModel}:max`);
|
|
134
191
|
}
|
|
135
|
-
if (
|
|
136
|
-
lines.push(
|
|
137
|
-
lines.push(
|
|
138
|
-
for (const dir of
|
|
192
|
+
if (options.customDirectories.length > 0) {
|
|
193
|
+
lines.push("skills:");
|
|
194
|
+
lines.push(" customDirectories:");
|
|
195
|
+
for (const dir of options.customDirectories)
|
|
139
196
|
lines.push(` - ${JSON.stringify(dir)}`);
|
|
140
|
-
|
|
197
|
+
}
|
|
198
|
+
if (!this.nativeSubagentsEnabled) {
|
|
199
|
+
lines.push("tools:");
|
|
200
|
+
lines.push(" approval:");
|
|
201
|
+
lines.push(" task: deny");
|
|
202
|
+
lines.push("task:");
|
|
203
|
+
lines.push(" disabledAgents:");
|
|
204
|
+
for (const name of OMP_NATIVE_AGENT_NAMES)
|
|
205
|
+
lines.push(` - ${JSON.stringify(name)}`);
|
|
141
206
|
}
|
|
142
207
|
await mkdir(dirname(this.paths.config), { recursive: true });
|
|
143
|
-
await writeFile(this.paths.config, `${lines.join("\n")}\n`, "utf8");
|
|
208
|
+
await writeFile(this.paths.config, `${lines.join("\n")}\n`, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
|
|
209
|
+
protectPrivateFileSync(this.paths.config);
|
|
144
210
|
}
|
|
145
211
|
async readConfig() {
|
|
146
212
|
try {
|
|
@@ -151,8 +217,8 @@ export class OmpResourceDelivery {
|
|
|
151
217
|
}
|
|
152
218
|
}
|
|
153
219
|
}
|
|
154
|
-
export function contextContributionToString(
|
|
155
|
-
return
|
|
220
|
+
export function contextContributionToString(contribution) {
|
|
221
|
+
return contribution.content ?? "";
|
|
156
222
|
}
|
|
157
223
|
export function isRecordValue(value) {
|
|
158
224
|
return isRecord(value);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { rm } from "node:fs/promises";
|
|
2
3
|
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import { InitialSessionContext, } from "../../core/profiles.js";
|
|
4
5
|
import { createPiboRuntime, } from "./runtime.js";
|
|
@@ -8,8 +9,9 @@ import { RoutedSession as PiRoutedSession } from "./routed-session.js";
|
|
|
8
9
|
import { loadModelCatalog as loadPiModelCatalog, piAgentRuntimeModelCatalog, } from "./model-catalog.js";
|
|
9
10
|
import { inspectPiAgentRuntimeHistory, readPiAgentRuntimeHistory, } from "./history.js";
|
|
10
11
|
import { PiAgentRuntimeAuthController } from "./auth.js";
|
|
12
|
+
import { importPortableHistoryIntoPi } from "./portable-history.js";
|
|
11
13
|
const PI_ADAPTER_ID = "pi";
|
|
12
|
-
const PI_PROTOCOL_VERSION = "0.
|
|
14
|
+
export const PI_PROTOCOL_VERSION = "0.84.2";
|
|
13
15
|
export const PI_AGENT_RUNTIME_CAPABILITIES = {
|
|
14
16
|
lifecycle: {
|
|
15
17
|
persistent: true,
|
|
@@ -48,6 +50,19 @@ export const PI_AGENT_RUNTIME_CAPABILITIES = {
|
|
|
48
50
|
},
|
|
49
51
|
skills: { support: "native" },
|
|
50
52
|
context: { support: "native" },
|
|
53
|
+
contextDiscovery: {
|
|
54
|
+
supported: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
enabledByDefault: true,
|
|
57
|
+
strategy: "filesystem-ancestors",
|
|
58
|
+
knownFileNames: ["AGENTS.md", "AGENTS.MD", "CLAUDE.md", "CLAUDE.MD"],
|
|
59
|
+
},
|
|
60
|
+
nativeSubagents: {
|
|
61
|
+
supported: false,
|
|
62
|
+
configurable: false,
|
|
63
|
+
enabledByDefault: false,
|
|
64
|
+
},
|
|
65
|
+
historyImport: true,
|
|
51
66
|
auth: {
|
|
52
67
|
status: true,
|
|
53
68
|
methods: [
|
|
@@ -105,6 +120,7 @@ function cloneProfileForPiSession(input) {
|
|
|
105
120
|
builtinTools: profile.builtinTools,
|
|
106
121
|
builtinToolNames: profile.builtinToolNames,
|
|
107
122
|
autoContextFiles: profile.autoContextFiles,
|
|
123
|
+
nativeSubagents: profile.nativeSubagents,
|
|
108
124
|
toolPackages: profile.toolPackages,
|
|
109
125
|
});
|
|
110
126
|
}
|
|
@@ -562,6 +578,9 @@ class PiAgentRuntimeAdapter {
|
|
|
562
578
|
};
|
|
563
579
|
}
|
|
564
580
|
async openSession(input) {
|
|
581
|
+
if (input.historyHandoff?.mode === "import" && input.binding?.state === "bound") {
|
|
582
|
+
throw new Error("Pi portable history import requires a new native session.");
|
|
583
|
+
}
|
|
565
584
|
const compatibility = input.services?.compatibility;
|
|
566
585
|
const runtime = await createPiboRuntime({
|
|
567
586
|
cwd: input.workspace,
|
|
@@ -585,6 +604,18 @@ class PiAgentRuntimeAdapter {
|
|
|
585
604
|
},
|
|
586
605
|
contextGuardTuiQueueOrdering: compatibility?.contextGuardTuiQueueOrdering,
|
|
587
606
|
});
|
|
607
|
+
if (input.historyHandoff?.mode === "import") {
|
|
608
|
+
try {
|
|
609
|
+
importPortableHistoryIntoPi(runtime.session.sessionManager, input.historyHandoff.history);
|
|
610
|
+
}
|
|
611
|
+
catch (error) {
|
|
612
|
+
const partialSessionFile = runtime.session.sessionFile;
|
|
613
|
+
await runtime.dispose().catch(() => { });
|
|
614
|
+
if (partialSessionFile)
|
|
615
|
+
await rm(partialSessionFile, { force: true }).catch(() => { });
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
588
619
|
const binding = {
|
|
589
620
|
...(input.binding ? structuredClone(input.binding) : {}),
|
|
590
621
|
piboSessionId: input.piboSession.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthStorage } from "@earendil-works/pi-coding-agent";
|
|
2
1
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
2
|
import { AgentRuntimeAuthError } from "../../agent-runtime/errors.js";
|
|
3
|
+
import { deletePiCredential, getPiProviderAuthStatus, listPiCredentials, writePiCredential, } from "./credentials.js";
|
|
4
4
|
const OPENAI_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
5
5
|
const OPENAI_AUTHORIZE_URL = "https://auth.openai.com/oauth/authorize";
|
|
6
6
|
const OPENAI_ISSUER_URL = "https://auth.openai.com";
|
|
@@ -31,9 +31,6 @@ async function generatePKCE() {
|
|
|
31
31
|
return { verifier, challenge };
|
|
32
32
|
}
|
|
33
33
|
const pendingLogins = new Map();
|
|
34
|
-
function createAuthStorage() {
|
|
35
|
-
return AuthStorage.create();
|
|
36
|
-
}
|
|
37
34
|
function decodeJwt(token) {
|
|
38
35
|
try {
|
|
39
36
|
const parts = token.split(".");
|
|
@@ -201,8 +198,7 @@ export async function completeLogin(provider, code, state) {
|
|
|
201
198
|
const deviceResult = await pollOpenAiDeviceAuthorization(pending);
|
|
202
199
|
const tokenResult = await exchangeOpenAiAuthorizationCode(deviceResult.authorization_code, deviceResult.code_verifier, OPENAI_DEVICE_REDIRECT_URI);
|
|
203
200
|
const accountId = getOpenAiAccountId(tokenResult.accessToken);
|
|
204
|
-
|
|
205
|
-
authStorage.set(provider, {
|
|
201
|
+
await writePiCredential(provider, {
|
|
206
202
|
type: "oauth",
|
|
207
203
|
access: tokenResult.accessToken,
|
|
208
204
|
refresh: tokenResult.refreshToken,
|
|
@@ -222,8 +218,7 @@ export async function completeLogin(provider, code, state) {
|
|
|
222
218
|
}
|
|
223
219
|
const tokenResult = await exchangeOpenAiAuthorizationCode(code, pending.verifier, OPENAI_REDIRECT_URI);
|
|
224
220
|
const accountId = getOpenAiAccountId(tokenResult.accessToken);
|
|
225
|
-
|
|
226
|
-
authStorage.set("openai-codex", {
|
|
221
|
+
await writePiCredential("openai-codex", {
|
|
227
222
|
type: "oauth",
|
|
228
223
|
access: tokenResult.accessToken,
|
|
229
224
|
refresh: tokenResult.refreshToken,
|
|
@@ -234,26 +229,27 @@ export async function completeLogin(provider, code, state) {
|
|
|
234
229
|
}
|
|
235
230
|
throw new Error(`OAuth login complete not supported for provider "${provider}". Supported: openai-codex.`);
|
|
236
231
|
}
|
|
237
|
-
export function setApiKey(provider, apiKey) {
|
|
238
|
-
|
|
239
|
-
authStorage.set(provider, { type: "api_key", key: apiKey });
|
|
232
|
+
export async function setApiKey(provider, apiKey) {
|
|
233
|
+
await writePiCredential(provider, { type: "api_key", key: apiKey });
|
|
240
234
|
return { success: true, provider };
|
|
241
235
|
}
|
|
242
|
-
export function getLoginStatus(provider) {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
export async function getLoginStatus(provider) {
|
|
237
|
+
const providerIds = provider
|
|
238
|
+
? [provider]
|
|
239
|
+
: (await listPiCredentials()).map((credential) => credential.providerId);
|
|
240
|
+
return await Promise.all(providerIds.map(async (providerId) => ({
|
|
241
|
+
id: providerId,
|
|
242
|
+
provider: providerId,
|
|
243
|
+
...(await getPiProviderAuthStatus(providerId)),
|
|
244
|
+
})));
|
|
248
245
|
}
|
|
249
246
|
export function cancelLogin(provider, state) {
|
|
250
247
|
requirePendingLogin(state, provider);
|
|
251
248
|
pendingLogins.delete(state);
|
|
252
249
|
return { success: true, provider };
|
|
253
250
|
}
|
|
254
|
-
export function removeLogin(provider) {
|
|
255
|
-
|
|
256
|
-
authStorage.logout(provider);
|
|
251
|
+
export async function removeLogin(provider) {
|
|
252
|
+
await deletePiCredential(provider);
|
|
257
253
|
return { success: true, provider };
|
|
258
254
|
}
|
|
259
255
|
const PI_AUTH_FLOW_TTL_MS = 10 * 60 * 1_000;
|
|
@@ -294,22 +290,31 @@ export class PiAgentRuntimeAuthController {
|
|
|
294
290
|
try {
|
|
295
291
|
this.cleanupExpired();
|
|
296
292
|
const catalog = await this.loadCatalog();
|
|
293
|
+
const storedStatuses = await getLoginStatus();
|
|
297
294
|
const providers = new Map(catalog.providers.map((provider) => [provider.id, {
|
|
298
295
|
id: provider.id,
|
|
299
296
|
displayName: provider.label,
|
|
297
|
+
configured: provider.authConfigured,
|
|
300
298
|
}]));
|
|
301
|
-
for (const
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
for (const stored of storedStatuses) {
|
|
300
|
+
const existing = providers.get(stored.id);
|
|
301
|
+
if (existing) {
|
|
302
|
+
existing.configured = stored.configured;
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
providers.set(stored.id, {
|
|
306
|
+
id: stored.id,
|
|
307
|
+
displayName: stored.id,
|
|
308
|
+
configured: stored.configured,
|
|
309
|
+
});
|
|
304
310
|
}
|
|
305
311
|
return [...providers.values()].map((provider) => {
|
|
306
|
-
const configured = getLoginStatus(provider.id)[0]?.configured ?? false;
|
|
307
312
|
const pending = [...this.pending.values()].find((entry) => entry.providerId === provider.id);
|
|
308
313
|
return {
|
|
309
314
|
id: provider.id,
|
|
310
315
|
displayName: provider.displayName,
|
|
311
|
-
state: pending ? "pending" : configured ? "connected" : "disconnected",
|
|
312
|
-
configured,
|
|
316
|
+
state: pending ? "pending" : provider.configured ? "connected" : "disconnected",
|
|
317
|
+
configured: provider.configured,
|
|
313
318
|
methods: [...piAuthMethodsForProvider(provider.id)],
|
|
314
319
|
...(pending ? { pending: { ...pending.flow } } : {}),
|
|
315
320
|
};
|
|
@@ -328,7 +333,7 @@ export class PiAgentRuntimeAuthController {
|
|
|
328
333
|
throw new Error(`Pi does not support ${input.method} authentication for provider "${input.providerId}".`);
|
|
329
334
|
if (input.method === "api_key") {
|
|
330
335
|
try {
|
|
331
|
-
setApiKey(input.providerId, input.apiKey);
|
|
336
|
+
await setApiKey(input.providerId, input.apiKey);
|
|
332
337
|
}
|
|
333
338
|
catch {
|
|
334
339
|
throw new AgentRuntimeAuthError("pi_auth_failed", "Pi API-key authentication failed safely.", true);
|
|
@@ -384,7 +389,7 @@ export class PiAgentRuntimeAuthController {
|
|
|
384
389
|
const pending = this.requirePending(input.providerId, input.flowId);
|
|
385
390
|
cancelLogin(pending.nativeProviderId, pending.nativeState);
|
|
386
391
|
this.pending.delete(input.flowId);
|
|
387
|
-
const configured = getLoginStatus(input.providerId)[0]?.configured ?? false;
|
|
392
|
+
const configured = (await getLoginStatus(input.providerId))[0]?.configured ?? false;
|
|
388
393
|
return {
|
|
389
394
|
providerId: input.providerId,
|
|
390
395
|
state: configured ? "connected" : "disconnected",
|
|
@@ -411,7 +416,7 @@ export class PiAgentRuntimeAuthController {
|
|
|
411
416
|
this.pending.delete(flowId);
|
|
412
417
|
}
|
|
413
418
|
try {
|
|
414
|
-
removeLogin(input.providerId);
|
|
419
|
+
await removeLogin(input.providerId);
|
|
415
420
|
}
|
|
416
421
|
catch {
|
|
417
422
|
throw new AgentRuntimeAuthError("pi_auth_failed", "Pi provider logout failed safely.", true);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
let authStorageModulePromise;
|
|
3
|
+
async function loadPiAuthStorageModule() {
|
|
4
|
+
authStorageModulePromise ??= import(new URL("./core/auth-storage.js", import.meta.resolve("@earendil-works/pi-coding-agent")).href);
|
|
5
|
+
return await authStorageModulePromise;
|
|
6
|
+
}
|
|
7
|
+
async function createPiCredentialStore() {
|
|
8
|
+
const { AuthStorage } = await loadPiAuthStorageModule();
|
|
9
|
+
return AuthStorage.create();
|
|
10
|
+
}
|
|
11
|
+
export async function readPiCredential(providerId) {
|
|
12
|
+
return await (await createPiCredentialStore()).read(providerId);
|
|
13
|
+
}
|
|
14
|
+
export async function writePiCredential(providerId, credential) {
|
|
15
|
+
const store = await createPiCredentialStore();
|
|
16
|
+
await store.modify(providerId, async () => credential);
|
|
17
|
+
}
|
|
18
|
+
export async function deletePiCredential(providerId) {
|
|
19
|
+
await (await createPiCredentialStore()).delete(providerId);
|
|
20
|
+
}
|
|
21
|
+
export async function listPiCredentials() {
|
|
22
|
+
return await (await createPiCredentialStore()).list();
|
|
23
|
+
}
|
|
24
|
+
export async function resolvePiProviderAuth(providerId) {
|
|
25
|
+
const credentials = await createPiCredentialStore();
|
|
26
|
+
const runtime = await ModelRuntime.create({ credentials, allowModelNetwork: false });
|
|
27
|
+
return await runtime.getAuth(providerId);
|
|
28
|
+
}
|
|
29
|
+
export async function getPiProviderAuthStatus(providerId) {
|
|
30
|
+
const credentials = await createPiCredentialStore();
|
|
31
|
+
const runtime = await ModelRuntime.create({ credentials, allowModelNetwork: false });
|
|
32
|
+
const status = runtime.getProviderAuthStatus(providerId);
|
|
33
|
+
if (status.configured)
|
|
34
|
+
return status;
|
|
35
|
+
const credential = (await credentials.list()).find((entry) => entry.providerId === providerId);
|
|
36
|
+
if (!credential)
|
|
37
|
+
return status;
|
|
38
|
+
return {
|
|
39
|
+
configured: true,
|
|
40
|
+
source: "stored",
|
|
41
|
+
label: credential.type === "oauth" ? "OAuth" : "API key",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentSessionServices } from "@earendil-works/pi-coding-agent";
|
|
1
|
+
import { ModelRegistry, createAgentSessionServices, } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { registerMiniMaxProvider } from "../../providers/minimax.js";
|
|
3
3
|
import { registerGlmProvider } from "../../providers/glm.js";
|
|
4
4
|
import { registerQwenTokenPlanProvider } from "../../providers/qwen-token-plan.js";
|
|
@@ -39,8 +39,12 @@ export function buildModelCatalogFromRegistry(registry) {
|
|
|
39
39
|
export async function loadModelCatalogWithServices(createServices, cwd = process.cwd(), extensionHook) {
|
|
40
40
|
try {
|
|
41
41
|
const services = await createServices({ cwd });
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const registry = services.modelRegistry
|
|
43
|
+
?? (services.modelRuntime ? new ModelRegistry(services.modelRuntime) : undefined);
|
|
44
|
+
if (!registry)
|
|
45
|
+
throw new Error("Pi model services did not provide a model runtime.");
|
|
46
|
+
extensionHook?.(registry);
|
|
47
|
+
return buildModelCatalogFromRegistry(registry);
|
|
44
48
|
}
|
|
45
49
|
catch {
|
|
46
50
|
return { providers: [] };
|