@pasko70/pibo 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-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 +616 -0
- package/dist/agent-runtimes/omp/auth.js +109 -0
- package/dist/agent-runtimes/omp/client.js +460 -0
- package/dist/agent-runtimes/omp/config.js +188 -0
- package/dist/agent-runtimes/omp/history.js +108 -0
- package/dist/agent-runtimes/omp/host-tools.js +201 -0
- package/dist/agent-runtimes/omp/models.js +86 -0
- package/dist/agent-runtimes/omp/process.js +299 -0
- package/dist/agent-runtimes/omp/protocol-types.js +17 -0
- package/dist/agent-runtimes/omp/resource-delivery.js +228 -0
- package/dist/agent-runtimes/omp/thread.js +141 -0
- package/dist/agent-runtimes/omp/turn.js +325 -0
- 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 +20 -7
- package/dist/apps/chat/chat-files.js +19 -6
- package/dist/apps/chat/chat-request-normalizers.js +13 -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-DxEGebCR.js → chat-ui/assets/dist-BB8loWTa.js} +1 -1
- package/dist/apps/chat-ui/assets/dist-BJ-TIk3N.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CBPDkWd4.js +1 -0
- package/dist/apps/chat-ui/assets/dist-CHInEWhr.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-B7gXtTZC.js → chat-ui/assets/dist-CwS16H7k.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-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/{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/{dist-sZgJkWZb.js → dist-nU3BVpFi.js} +1 -1
- 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-CQuka3bs.js +226 -0
- package/dist/apps/chat-ui/assets/index-DUXboQnI.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-CF1-9PKU.css +2 -0
- package/dist/apps/chat-vscode-web/assets/index-Dp1TzeRL.js +41 -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.0.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 +8 -0
- package/dist/core/sensitive-data-redaction.js +36 -0
- package/dist/core/session-model.js +1 -0
- package/dist/core/session-router.js +219 -29
- package/dist/data/pibo-store.js +5 -1
- package/dist/gateway/server.js +9 -0
- package/dist/index.js +1 -1
- package/dist/plugins/builtin.js +4 -2
- package/dist/plugins/context-files.js +11 -0
- package/dist/plugins/omp.js +57 -0
- package/dist/plugins/registry.js +1 -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/vscode-artifacts/pibo-vscode-ext-2.0.0.vsix +0 -0
- /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
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/** Hard cap on how long a streaming turn may run before we resolve it. */
|
|
2
|
+
const DEFAULT_TURN_STREAM_TIMEOUT_MS = 10 * 60 * 1_000;
|
|
3
|
+
// Test hook: allows the deadline to be set tiny (e.g. 250ms) so unit tests can
|
|
4
|
+
// exercise the timeout path without waiting ten minutes.
|
|
5
|
+
function turnStreamTimeoutMs() {
|
|
6
|
+
if (typeof process !== "undefined" && process.env?.PIBO_OMP_TURN_TIMEOUT_MS) {
|
|
7
|
+
const parsed = Number(process.env.PIBO_OMP_TURN_TIMEOUT_MS);
|
|
8
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
9
|
+
return parsed;
|
|
10
|
+
}
|
|
11
|
+
return DEFAULT_TURN_STREAM_TIMEOUT_MS;
|
|
12
|
+
}
|
|
13
|
+
function deferred() {
|
|
14
|
+
const d = {};
|
|
15
|
+
d.promise = new Promise((resolve, reject) => {
|
|
16
|
+
d.resolve = resolve;
|
|
17
|
+
d.reject = reject;
|
|
18
|
+
});
|
|
19
|
+
return d;
|
|
20
|
+
}
|
|
21
|
+
export class OmpRpcClientProtocolError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "OmpRpcClientProtocolError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function isOmpRpcAgentEvent(frame) {
|
|
28
|
+
return frame.type === "agent_start"
|
|
29
|
+
|| frame.type === "agent_end"
|
|
30
|
+
|| frame.type === "turn_start"
|
|
31
|
+
|| frame.type === "turn_end"
|
|
32
|
+
|| frame.type === "message_start"
|
|
33
|
+
|| frame.type === "message_end"
|
|
34
|
+
|| frame.type === "auto_compaction_start"
|
|
35
|
+
|| frame.type === "auto_compaction_end"
|
|
36
|
+
|| frame.type === "auto_retry_start"
|
|
37
|
+
|| frame.type === "auto_retry_end"
|
|
38
|
+
|| frame.type === "retry_fallback_applied"
|
|
39
|
+
|| frame.type === "retry_fallback_succeeded"
|
|
40
|
+
|| frame.type === "model_changed"
|
|
41
|
+
|| frame.type === "ttsr_triggered"
|
|
42
|
+
|| frame.type === "todo_reminder"
|
|
43
|
+
|| frame.type === "todo_auto_clear"
|
|
44
|
+
|| frame.type === "irc_message"
|
|
45
|
+
|| frame.type === "notice"
|
|
46
|
+
|| frame.type === "thinking_level_changed"
|
|
47
|
+
|| frame.type === "goal_updated";
|
|
48
|
+
}
|
|
49
|
+
function isRecord(value) {
|
|
50
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
51
|
+
}
|
|
52
|
+
function assistantEventText(event) {
|
|
53
|
+
if (event.type === "text_delta")
|
|
54
|
+
return { text: event.delta };
|
|
55
|
+
if (event.type === "text_end")
|
|
56
|
+
return { text: event.content };
|
|
57
|
+
if (event.type === "thinking_delta")
|
|
58
|
+
return { thinking: event.delta };
|
|
59
|
+
if (event.type === "thinking_end")
|
|
60
|
+
return { thinking: event.content };
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
function toolCallFromEvent(event) {
|
|
64
|
+
if (event.type !== "toolcall_end")
|
|
65
|
+
return undefined;
|
|
66
|
+
const toolCall = event.toolCall;
|
|
67
|
+
if (!toolCall)
|
|
68
|
+
return undefined;
|
|
69
|
+
return { id: toolCall.id, name: toolCall.name, args: toolCall.arguments };
|
|
70
|
+
}
|
|
71
|
+
export class OmpRpcTurnController {
|
|
72
|
+
client;
|
|
73
|
+
emit;
|
|
74
|
+
pending;
|
|
75
|
+
disposed = false;
|
|
76
|
+
unsubscribeFrames;
|
|
77
|
+
constructor(client, emit) {
|
|
78
|
+
this.client = client;
|
|
79
|
+
this.emit = emit;
|
|
80
|
+
this.unsubscribeFrames = client.subscribeFrames((frame) => {
|
|
81
|
+
if (this.disposed)
|
|
82
|
+
return;
|
|
83
|
+
try {
|
|
84
|
+
this.handleFrame(frame);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this.handleProtocolFailure(error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
this.client.subscribeDiagnostics((message) => {
|
|
91
|
+
if (this.pending && message)
|
|
92
|
+
this.emitWarning(message);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
get streaming() {
|
|
96
|
+
return this.pending !== undefined;
|
|
97
|
+
}
|
|
98
|
+
emitWarning(message) {
|
|
99
|
+
this.emit({ type: "warning", message });
|
|
100
|
+
}
|
|
101
|
+
handleProtocolFailure(error) {
|
|
102
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
103
|
+
this.emit({ type: "error", message });
|
|
104
|
+
if (this.pending && !this.pending.interrupted) {
|
|
105
|
+
this.pending.turnSettled.reject(new OmpRpcClientProtocolError(`OMP RPC protocol failure while streaming a turn: ${message}`));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Start a prompt turn. Strategy per MUST-FIX #4:
|
|
110
|
+
* - Send `prompt`, wait for the correlated `response`.
|
|
111
|
+
* - If the response reports agentInvoked:false (a local-only slash command or
|
|
112
|
+
* skill that never invokes the model), resolve the turn IMMEDIATELY —
|
|
113
|
+
* there is no agent_start/agent_end stream.
|
|
114
|
+
* - If agentInvoked:true, await the terminal agent_end with isTerminal:true.
|
|
115
|
+
*/
|
|
116
|
+
async prompt(text) {
|
|
117
|
+
this.assertActive();
|
|
118
|
+
if (this.pending)
|
|
119
|
+
throw new Error("An OMP turn is already in progress.");
|
|
120
|
+
// Set pending BEFORE sending so frames emitted in the same stdout chunk
|
|
121
|
+
// (or before the response resolves) are attributed to this turn.
|
|
122
|
+
const turn = {
|
|
123
|
+
agentInvoked: true,
|
|
124
|
+
responseSettled: deferred(),
|
|
125
|
+
turnSettled: deferred(),
|
|
126
|
+
interrupted: false,
|
|
127
|
+
};
|
|
128
|
+
this.pending = turn;
|
|
129
|
+
try {
|
|
130
|
+
await this.executePrompt(turn, text);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (this.pending === turn)
|
|
134
|
+
this.pending = undefined;
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async executePrompt(turn, text) {
|
|
139
|
+
let response;
|
|
140
|
+
try {
|
|
141
|
+
response = await this.client.request({ type: "prompt", message: text }, "prompt");
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
turn.responseSettled.resolve();
|
|
145
|
+
}
|
|
146
|
+
const data = response["data"];
|
|
147
|
+
const invoked = !isRecord(data) || !("agentInvoked" in data) || data.agentInvoked !== false;
|
|
148
|
+
turn.agentInvoked = invoked;
|
|
149
|
+
if (!invoked) {
|
|
150
|
+
// Local-only slash/skill command: no agent stream will come (MUST-FIX #4).
|
|
151
|
+
if (this.pending === turn)
|
|
152
|
+
this.pending = undefined;
|
|
153
|
+
turn.turnSettled.resolve();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// A running agent turn normally ends with a terminal agent_end. Guard
|
|
157
|
+
// against OMP never emitting it: resolve after a hard deadline so
|
|
158
|
+
// prompt() cannot hang forever.
|
|
159
|
+
const deadline = setTimeout(() => {
|
|
160
|
+
if (this.pending === turn)
|
|
161
|
+
this.pending = undefined;
|
|
162
|
+
turn.turnSettled.resolve();
|
|
163
|
+
}, turnStreamTimeoutMs());
|
|
164
|
+
try {
|
|
165
|
+
await turn.turnSettled.promise;
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
clearTimeout(deadline);
|
|
169
|
+
if (this.pending === turn)
|
|
170
|
+
this.pending = undefined;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async steer(text) {
|
|
174
|
+
this.assertActive();
|
|
175
|
+
await this.client.request({ type: "steer", message: text }, "steer");
|
|
176
|
+
}
|
|
177
|
+
async interrupt() {
|
|
178
|
+
this.assertActive();
|
|
179
|
+
if (this.pending)
|
|
180
|
+
this.pending.interrupted = true;
|
|
181
|
+
try {
|
|
182
|
+
await this.client.request({ type: "abort" }, "abort");
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (this.pending && !this.pending.interrupted)
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
dispose() {
|
|
190
|
+
this.disposed = true;
|
|
191
|
+
this.unsubscribeFrames();
|
|
192
|
+
if (this.pending) {
|
|
193
|
+
this.pending.turnSettled.reject(new Error("OMP turn disposed."));
|
|
194
|
+
this.pending = undefined;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
assertActive() {
|
|
198
|
+
if (this.disposed)
|
|
199
|
+
throw new Error("OMP turn controller is disposed.");
|
|
200
|
+
}
|
|
201
|
+
handleFrame(frame) {
|
|
202
|
+
if (this.pending === undefined)
|
|
203
|
+
return;
|
|
204
|
+
if (frame.type === "agent_end") {
|
|
205
|
+
if (frame.isTerminal !== false) {
|
|
206
|
+
const turn = this.pending;
|
|
207
|
+
this.pending = undefined;
|
|
208
|
+
turn.turnSettled.resolve();
|
|
209
|
+
turn.responseSettled.resolve();
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (frame.type === "message_update") {
|
|
214
|
+
const event = frame.assistantMessageEvent;
|
|
215
|
+
if (!event)
|
|
216
|
+
return;
|
|
217
|
+
if (event.type === "text_delta" || event.type === "text_end") {
|
|
218
|
+
this.emit({ type: "assistant_delta", text: event.type === "text_end" ? event.content : event.delta, contentIndex: event.contentIndex });
|
|
219
|
+
}
|
|
220
|
+
else if (event.type === "thinking_delta" || event.type === "thinking_end") {
|
|
221
|
+
this.emit({ type: "reasoning_delta", text: event.type === "thinking_end" ? event.content : event.delta, contentIndex: event.contentIndex });
|
|
222
|
+
}
|
|
223
|
+
else if (event.type === "thinking_start") {
|
|
224
|
+
this.emit({ type: "reasoning_started", contentIndex: event.contentIndex });
|
|
225
|
+
}
|
|
226
|
+
else if (event.type === "toolcall_end") {
|
|
227
|
+
this.emit({
|
|
228
|
+
type: "tool_call",
|
|
229
|
+
toolCallId: event.toolCall.id,
|
|
230
|
+
toolName: event.toolCall.name,
|
|
231
|
+
args: event.toolCall.arguments,
|
|
232
|
+
argsComplete: true,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
else if (event.type === "done") {
|
|
236
|
+
// message done; terminal is signalled by agent_end
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (frame.type === "tool_execution_start") {
|
|
241
|
+
this.emit({
|
|
242
|
+
type: "tool_execution_started",
|
|
243
|
+
toolCallId: frame.toolCallId,
|
|
244
|
+
toolName: frame.toolName,
|
|
245
|
+
args: frame.args,
|
|
246
|
+
});
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (frame.type === "tool_execution_update") {
|
|
250
|
+
this.emit({
|
|
251
|
+
type: "tool_execution_updated",
|
|
252
|
+
toolCallId: frame.toolCallId,
|
|
253
|
+
toolName: frame.toolName,
|
|
254
|
+
args: frame.args,
|
|
255
|
+
partialResult: frame.partialResult,
|
|
256
|
+
});
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (frame.type === "tool_execution_end") {
|
|
260
|
+
this.emit({
|
|
261
|
+
type: "tool_execution_finished",
|
|
262
|
+
toolCallId: frame.toolCallId,
|
|
263
|
+
toolName: frame.toolName,
|
|
264
|
+
result: frame.result,
|
|
265
|
+
isError: frame.isError === true,
|
|
266
|
+
});
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
this.handleSessionEvent(frame);
|
|
270
|
+
}
|
|
271
|
+
handleSessionEvent(frame) {
|
|
272
|
+
if (!isOmpRpcAgentEvent(frame))
|
|
273
|
+
return;
|
|
274
|
+
switch (frame.type) {
|
|
275
|
+
case "turn_start":
|
|
276
|
+
this.emit({ type: "turn_started" });
|
|
277
|
+
break;
|
|
278
|
+
case "turn_end":
|
|
279
|
+
this.emit({ type: "turn_completed", status: "completed" });
|
|
280
|
+
break;
|
|
281
|
+
case "auto_compaction_start":
|
|
282
|
+
this.emit({ type: "compaction_start", reason: frame.reason });
|
|
283
|
+
break;
|
|
284
|
+
case "auto_compaction_end":
|
|
285
|
+
this.emit({
|
|
286
|
+
type: "compaction_end",
|
|
287
|
+
reason: frame.action,
|
|
288
|
+
aborted: frame.aborted,
|
|
289
|
+
errorMessage: frame.errorMessage,
|
|
290
|
+
result: frame.result,
|
|
291
|
+
});
|
|
292
|
+
break;
|
|
293
|
+
case "notice":
|
|
294
|
+
if (frame.level === "error") {
|
|
295
|
+
this.emit({ type: "error", message: frame.message });
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
this.emit({ type: "warning", message: frame.message });
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/** Normalize an OMP AgentMessage usage into Pibo usage, if present. */
|
|
306
|
+
static usageFromMessage(message) {
|
|
307
|
+
if (!isRecord(message))
|
|
308
|
+
return undefined;
|
|
309
|
+
const usage = message.usage;
|
|
310
|
+
if (!isRecord(usage))
|
|
311
|
+
return undefined;
|
|
312
|
+
const record = usage;
|
|
313
|
+
const input = typeof record.inputTokens === "number" ? record.inputTokens : 0;
|
|
314
|
+
const output = typeof record.outputTokens === "number" ? record.outputTokens : 0;
|
|
315
|
+
const total = typeof record.totalTokens === "number" ? record.totalTokens : input + output;
|
|
316
|
+
return {
|
|
317
|
+
inputTokens: input,
|
|
318
|
+
outputTokens: output,
|
|
319
|
+
cacheReadTokens: typeof record.cachedInputTokens === "number" ? record.cachedInputTokens : 0,
|
|
320
|
+
cacheWriteTokens: 0,
|
|
321
|
+
reasoningTokens: typeof record.reasoningTokens === "number" ? record.reasoningTokens : 0,
|
|
322
|
+
totalTokens: total,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -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: [] };
|