@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
|
@@ -55,17 +55,23 @@ export function validateAgentRuntimeProfileCapabilities(profile, capabilities) {
|
|
|
55
55
|
if (enabledSkills.length > 0) {
|
|
56
56
|
pushUnsupportedDeliveryDiagnostic(diagnostics, capabilities.skills, "runtime_skills_unsupported", "skills", `Profile "${profile.profileName}" selects skills`);
|
|
57
57
|
}
|
|
58
|
-
if (enabledContextFiles.length > 0
|
|
58
|
+
if (enabledContextFiles.length > 0) {
|
|
59
59
|
pushUnsupportedDeliveryDiagnostic(diagnostics, capabilities.context, "runtime_context_unsupported", "contextFiles", `Profile "${profile.profileName}" selects managed or automatic context`);
|
|
60
60
|
}
|
|
61
|
-
if (profile.
|
|
62
|
-
&& capabilities.context.support === "materialized"
|
|
63
|
-
&& !capabilities.context.modes.includes("native-project-discovery")) {
|
|
61
|
+
if (profile.nativeSubagents !== undefined && typeof profile.nativeSubagents !== "boolean") {
|
|
64
62
|
diagnostics.push({
|
|
65
63
|
severity: "error",
|
|
66
|
-
code: "
|
|
67
|
-
message: `
|
|
68
|
-
path: "
|
|
64
|
+
code: "runtime_native_subagents_invalid",
|
|
65
|
+
message: `Profile "${profile.profileName}" must set nativeSubagents to a boolean when provided.`,
|
|
66
|
+
path: "nativeSubagents",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else if (profile.nativeSubagents !== undefined && !capabilities.nativeSubagents.configurable) {
|
|
70
|
+
diagnostics.push({
|
|
71
|
+
severity: "error",
|
|
72
|
+
code: "runtime_native_subagents_not_configurable",
|
|
73
|
+
message: `Runtime "${profile.runtimeInstanceId}" does not allow profiles to override native subagents.`,
|
|
74
|
+
path: "nativeSubagents",
|
|
69
75
|
});
|
|
70
76
|
}
|
|
71
77
|
const reasoningValues = [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { chmod, copyFile, lstat, mkdir, readdir, realpath, } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
4
|
+
import { protectPrivatePathsSync } from "../core/private-path.js";
|
|
4
5
|
function safeSegment(value) {
|
|
5
6
|
const normalized = value.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 96) || "resource";
|
|
6
7
|
const hash = createHash("sha256").update(value).digest("hex").slice(0, 10);
|
|
@@ -10,9 +11,10 @@ function isInside(root, candidate) {
|
|
|
10
11
|
const child = relative(root, candidate);
|
|
11
12
|
return child === "" || (!child.startsWith(`..${sep}`) && child !== ".." && !isAbsolute(child));
|
|
12
13
|
}
|
|
13
|
-
async function
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
async function ensurePrivateDirectories(paths) {
|
|
15
|
+
for (const path of paths)
|
|
16
|
+
await mkdir(path, { recursive: true, mode: 0o700 });
|
|
17
|
+
protectPrivatePathsSync(paths.map((path) => ({ path, kind: "directory" })));
|
|
16
18
|
}
|
|
17
19
|
export async function createAgentRuntimeResourcePaths(rootDir, input) {
|
|
18
20
|
const root = join(rootDir, safeSegment(input.runtimeInstanceId), safeSegment(input.piboSessionId), safeSegment(input.sessionGeneration));
|
|
@@ -24,8 +26,7 @@ export async function createAgentRuntimeResourcePaths(rootDir, input) {
|
|
|
24
26
|
config: join(root, "config"),
|
|
25
27
|
protocol: join(root, "protocol"),
|
|
26
28
|
};
|
|
27
|
-
|
|
28
|
-
await ensurePrivateDirectory(path);
|
|
29
|
+
await ensurePrivateDirectories(Object.values(paths));
|
|
29
30
|
return paths;
|
|
30
31
|
}
|
|
31
32
|
async function copySkillEntry(source, destination, sourceRoot, budget) {
|
|
@@ -44,6 +45,10 @@ async function copySkillEntry(source, destination, sourceRoot, budget) {
|
|
|
44
45
|
budget.activeDirectories.add(canonical);
|
|
45
46
|
try {
|
|
46
47
|
await mkdir(destination, { recursive: true, mode: metadata.mode & 0o777 });
|
|
48
|
+
if (process.platform === "win32")
|
|
49
|
+
budget.privateWindowsPaths.push({ path: destination, kind: "directory" });
|
|
50
|
+
else
|
|
51
|
+
await chmod(destination, 0o700);
|
|
47
52
|
for (const entry of await readdir(source)) {
|
|
48
53
|
await copySkillEntry(join(source, entry), join(destination, entry), sourceRoot, budget);
|
|
49
54
|
}
|
|
@@ -63,7 +68,13 @@ async function copySkillEntry(source, destination, sourceRoot, budget) {
|
|
|
63
68
|
throw new Error(`Skill exceeds the ${budget.maxBytes}-byte materialization limit.`);
|
|
64
69
|
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
65
70
|
await copyFile(source, destination);
|
|
66
|
-
|
|
71
|
+
if (process.platform === "win32") {
|
|
72
|
+
budget.privateWindowsPaths.push({ path: dirname(destination), kind: "directory" }, { path: destination, kind: "file" });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
await chmod(dirname(destination), 0o700);
|
|
76
|
+
await chmod(destination, metadata.mode & 0o777);
|
|
77
|
+
}
|
|
67
78
|
}
|
|
68
79
|
export async function copyAgentRuntimeSkillDirectory(skill, destinationRoot, limits) {
|
|
69
80
|
const sourceFile = await realpath(skill.sourcePath);
|
|
@@ -75,13 +86,18 @@ export async function copyAgentRuntimeSkillDirectory(skill, destinationRoot, lim
|
|
|
75
86
|
maxFiles: limits.maxFiles,
|
|
76
87
|
maxBytes: limits.maxBytes,
|
|
77
88
|
activeDirectories: new Set(),
|
|
89
|
+
privateWindowsPaths: [],
|
|
78
90
|
};
|
|
91
|
+
let target;
|
|
79
92
|
if (basename(sourceFile).toUpperCase() === "SKILL.MD") {
|
|
80
93
|
await copySkillEntry(sourceRoot, destination, sourceRoot, budget);
|
|
81
|
-
|
|
94
|
+
target = join(destination, relative(sourceRoot, sourceFile));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
target = join(destination, "SKILL.md");
|
|
98
|
+
await copySkillEntry(sourceFile, target, sourceRoot, budget);
|
|
82
99
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
await copySkillEntry(sourceFile, target, sourceRoot, budget);
|
|
100
|
+
if (process.platform === "win32")
|
|
101
|
+
protectPrivatePathsSync(budget.privateWindowsPaths);
|
|
86
102
|
return target;
|
|
87
103
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { readFile, readlink, realpath, rm, stat, writeFile, } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
3
4
|
import { PIBO_APP_CONTEXT } from "../app-context.js";
|
|
4
5
|
import { piboHomePath } from "../core/pibo-home.js";
|
|
6
|
+
import { protectPrivatePathsSync } from "../core/private-path.js";
|
|
5
7
|
import { DEFAULT_USER_TIMEZONE } from "../core/user-settings.js";
|
|
6
8
|
import { isHttpServer, loadConfigUnresolved, } from "../mcp/config.js";
|
|
7
9
|
import { redactMcpRuntimeError as redactResourceError, scopePiboMcpServerConfig, verifyPiboMcpServer, } from "../mcp/runtime-session.js";
|
|
@@ -39,6 +41,170 @@ function slug(value) {
|
|
|
39
41
|
function resolveProfilePath(cwd, path) {
|
|
40
42
|
return isAbsolute(path) ? path : resolve(cwd, path);
|
|
41
43
|
}
|
|
44
|
+
function comparablePath(path) {
|
|
45
|
+
const normalized = resolve(path);
|
|
46
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
47
|
+
}
|
|
48
|
+
function comparableFileName(path) {
|
|
49
|
+
const name = basename(path);
|
|
50
|
+
return process.platform === "win32" ? name.toLowerCase() : name;
|
|
51
|
+
}
|
|
52
|
+
function samePath(left, right) {
|
|
53
|
+
return comparablePath(left) === comparablePath(right);
|
|
54
|
+
}
|
|
55
|
+
function isWithin(parent, child) {
|
|
56
|
+
const selected = relative(comparablePath(parent), comparablePath(child));
|
|
57
|
+
return selected === "" || (!selected.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)
|
|
58
|
+
&& selected !== ".."
|
|
59
|
+
&& !isAbsolute(selected));
|
|
60
|
+
}
|
|
61
|
+
async function linkedAncestorPath(path) {
|
|
62
|
+
const suffix = [];
|
|
63
|
+
let current = resolve(path);
|
|
64
|
+
while (true) {
|
|
65
|
+
const target = await readlink(current).catch(() => undefined);
|
|
66
|
+
if (target) {
|
|
67
|
+
const targetPath = isAbsolute(target) ? target : resolve(dirname(current), target);
|
|
68
|
+
return resolve(targetPath, ...suffix);
|
|
69
|
+
}
|
|
70
|
+
const parent = dirname(current);
|
|
71
|
+
if (parent === current)
|
|
72
|
+
return undefined;
|
|
73
|
+
suffix.unshift(basename(current));
|
|
74
|
+
current = parent;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function canonicalPath(path) {
|
|
78
|
+
const resolved = resolve(path);
|
|
79
|
+
const canonical = await realpath(resolved).catch(() => undefined);
|
|
80
|
+
if (canonical)
|
|
81
|
+
return canonical;
|
|
82
|
+
const linked = await linkedAncestorPath(resolved);
|
|
83
|
+
return linked ? await realpath(linked).catch(() => linked) : resolved;
|
|
84
|
+
}
|
|
85
|
+
function ancestorDirectories(cwd, boundary, includeBoundary = true) {
|
|
86
|
+
const directories = [];
|
|
87
|
+
let current = cwd;
|
|
88
|
+
while (true) {
|
|
89
|
+
const atBoundary = boundary !== undefined && samePath(current, boundary);
|
|
90
|
+
if (!atBoundary || includeBoundary)
|
|
91
|
+
directories.push(current);
|
|
92
|
+
if (atBoundary)
|
|
93
|
+
break;
|
|
94
|
+
const parent = dirname(current);
|
|
95
|
+
if (parent === current)
|
|
96
|
+
break;
|
|
97
|
+
current = parent;
|
|
98
|
+
}
|
|
99
|
+
return directories;
|
|
100
|
+
}
|
|
101
|
+
async function findNearestGitRoot(cwd) {
|
|
102
|
+
for (const directory of ancestorDirectories(cwd)) {
|
|
103
|
+
const marker = join(directory, ".git");
|
|
104
|
+
const markerStat = await stat(marker).catch(() => undefined);
|
|
105
|
+
if (markerStat)
|
|
106
|
+
return directory;
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
async function contextFileAncestorDirectories(cwd, strategy) {
|
|
111
|
+
if (strategy === "codex-project") {
|
|
112
|
+
const projectRoot = await findNearestGitRoot(cwd);
|
|
113
|
+
return projectRoot ? ancestorDirectories(cwd, projectRoot) : [cwd];
|
|
114
|
+
}
|
|
115
|
+
if (strategy === "omp-project") {
|
|
116
|
+
const home = resolve(homedir());
|
|
117
|
+
const projectRoot = await findNearestGitRoot(cwd);
|
|
118
|
+
const cwdUnderHome = isWithin(home, cwd);
|
|
119
|
+
const projectUnderHome = projectRoot !== undefined && isWithin(home, projectRoot);
|
|
120
|
+
if (projectRoot && !(cwdUnderHome && projectUnderHome))
|
|
121
|
+
return ancestorDirectories(cwd, projectRoot);
|
|
122
|
+
if (cwdUnderHome)
|
|
123
|
+
return ancestorDirectories(cwd, home, false);
|
|
124
|
+
return ancestorDirectories(cwd);
|
|
125
|
+
}
|
|
126
|
+
return ancestorDirectories(cwd);
|
|
127
|
+
}
|
|
128
|
+
async function nearestRelativeAncestorDirectories(cwd, strategy) {
|
|
129
|
+
if (strategy !== "omp-project")
|
|
130
|
+
return ancestorDirectories(cwd);
|
|
131
|
+
const projectRoot = await findNearestGitRoot(cwd);
|
|
132
|
+
return projectRoot ? ancestorDirectories(cwd, projectRoot) : ancestorDirectories(cwd);
|
|
133
|
+
}
|
|
134
|
+
async function everyRelativeAncestorDirectories(cwd, strategy) {
|
|
135
|
+
if (strategy !== "omp-project")
|
|
136
|
+
return ancestorDirectories(cwd);
|
|
137
|
+
const projectRoot = await findNearestGitRoot(cwd);
|
|
138
|
+
if (projectRoot)
|
|
139
|
+
return ancestorDirectories(cwd, projectRoot);
|
|
140
|
+
const home = resolve(homedir());
|
|
141
|
+
return isWithin(home, cwd) ? ancestorDirectories(cwd, home, false) : ancestorDirectories(cwd);
|
|
142
|
+
}
|
|
143
|
+
async function realFilePath(path) {
|
|
144
|
+
const candidate = await realpath(path).catch(() => undefined);
|
|
145
|
+
if (!candidate)
|
|
146
|
+
return undefined;
|
|
147
|
+
const metadata = await stat(candidate).catch(() => undefined);
|
|
148
|
+
return metadata?.isFile() ? candidate : undefined;
|
|
149
|
+
}
|
|
150
|
+
async function firstExistingPath(directories, relativePath) {
|
|
151
|
+
for (const directory of directories) {
|
|
152
|
+
const candidate = await realFilePath(join(directory, relativePath));
|
|
153
|
+
if (candidate)
|
|
154
|
+
return candidate;
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
async function isKnownNativeDiscoveredContextFile(sourcePath, cwdInput, strategy, knownFileNames, knownUserRelativePaths, knownCwdRelativePaths, knownRelativePaths, knownAncestorRelativePaths) {
|
|
159
|
+
const cwd = await canonicalPath(cwdInput);
|
|
160
|
+
const sourceRealPath = await canonicalPath(sourcePath);
|
|
161
|
+
for (const relativePath of knownUserRelativePaths) {
|
|
162
|
+
const candidate = await realFilePath(join(homedir(), relativePath));
|
|
163
|
+
if (candidate && samePath(candidate, sourceRealPath))
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
for (const relativePath of knownCwdRelativePaths) {
|
|
167
|
+
const candidate = await realFilePath(join(cwd, relativePath));
|
|
168
|
+
if (candidate && samePath(candidate, sourceRealPath))
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
const nearestDirectories = await nearestRelativeAncestorDirectories(cwd, strategy);
|
|
172
|
+
for (const relativePath of knownRelativePaths) {
|
|
173
|
+
const candidate = await firstExistingPath(nearestDirectories, relativePath);
|
|
174
|
+
if (candidate && samePath(candidate, sourceRealPath))
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
const everyDirectories = await everyRelativeAncestorDirectories(cwd, strategy);
|
|
178
|
+
for (const relativePath of knownAncestorRelativePaths) {
|
|
179
|
+
for (const directory of everyDirectories) {
|
|
180
|
+
const candidate = await realFilePath(join(directory, relativePath));
|
|
181
|
+
if (candidate && samePath(candidate, sourceRealPath))
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (strategy === "omp-project") {
|
|
185
|
+
const userCandidate = await realFilePath(join(homedir(), relativePath));
|
|
186
|
+
if (userCandidate && samePath(userCandidate, sourceRealPath))
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const sourceName = comparableFileName(sourceRealPath);
|
|
191
|
+
if (!knownFileNames.some((name) => comparableFileName(name) === sourceName))
|
|
192
|
+
return false;
|
|
193
|
+
const sourceDirectory = dirname(sourceRealPath);
|
|
194
|
+
for (const directory of await contextFileAncestorDirectories(cwd, strategy)) {
|
|
195
|
+
if (!samePath(directory, sourceDirectory))
|
|
196
|
+
continue;
|
|
197
|
+
if (strategy === "omp-project" && basename(directory).startsWith("."))
|
|
198
|
+
return false;
|
|
199
|
+
for (const fileName of knownFileNames) {
|
|
200
|
+
const candidate = await realFilePath(join(directory, fileName));
|
|
201
|
+
if (candidate)
|
|
202
|
+
return samePath(candidate, sourceRealPath);
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
42
208
|
function deliveryMode(delivery) {
|
|
43
209
|
if (delivery.support === "mcp")
|
|
44
210
|
return `mcp:${delivery.transports.join(",")}`;
|
|
@@ -196,6 +362,23 @@ class RuntimeResourceSession {
|
|
|
196
362
|
this.assertActive();
|
|
197
363
|
return structuredClone(this.resolvedMcpConfigs);
|
|
198
364
|
}
|
|
365
|
+
recordAdapterDelivery(reports, diagnostics = []) {
|
|
366
|
+
this.assertActive();
|
|
367
|
+
const replacements = new Map();
|
|
368
|
+
for (const report of reports) {
|
|
369
|
+
if (replacements.has(report.contributionId)) {
|
|
370
|
+
throw new Error(`Adapter reported runtime resource contribution "${report.contributionId}" more than once.`);
|
|
371
|
+
}
|
|
372
|
+
replacements.set(report.contributionId, { ...report });
|
|
373
|
+
}
|
|
374
|
+
this.delivery = this.delivery.map((report) => replacements.get(report.contributionId) ?? report);
|
|
375
|
+
const known = new Set(this.delivery.map((report) => report.contributionId));
|
|
376
|
+
for (const report of replacements.values()) {
|
|
377
|
+
if (!known.has(report.contributionId))
|
|
378
|
+
this.delivery.push(report);
|
|
379
|
+
}
|
|
380
|
+
this.diagnostics.push(...diagnostics.map((diagnostic) => ({ ...diagnostic })));
|
|
381
|
+
}
|
|
199
382
|
getInspection() {
|
|
200
383
|
this.assertActive();
|
|
201
384
|
return {
|
|
@@ -309,7 +492,12 @@ class RuntimeResourceSession {
|
|
|
309
492
|
this.diagnostics.push({ severity: "error", code: "runtime_mcp_configuration_failed", message, contributionId });
|
|
310
493
|
}
|
|
311
494
|
async prepareContext() {
|
|
312
|
-
|
|
495
|
+
const contextCwd = await canonicalPath(this.input.cwd);
|
|
496
|
+
const automaticContextEnabled = this.input.capabilities.contextDiscovery.supported
|
|
497
|
+
&& (this.input.capabilities.contextDiscovery.configurable
|
|
498
|
+
? this.input.profile.autoContextFiles
|
|
499
|
+
: this.input.capabilities.contextDiscovery.enabledByDefault);
|
|
500
|
+
if (automaticContextEnabled) {
|
|
313
501
|
this.requiredContributionIds.add("context:automatic-project-files");
|
|
314
502
|
this.context.push({
|
|
315
503
|
id: "context:automatic-project-files",
|
|
@@ -327,9 +515,11 @@ class RuntimeResourceSession {
|
|
|
327
515
|
continue;
|
|
328
516
|
const id = `context:${file.key ?? file.path}`;
|
|
329
517
|
this.requiredContributionIds.add(id);
|
|
330
|
-
const sourcePath = resolveProfilePath(
|
|
518
|
+
const sourcePath = resolveProfilePath(contextCwd, file.path);
|
|
331
519
|
try {
|
|
332
520
|
const content = await readFile(sourcePath, "utf8");
|
|
521
|
+
const nativeDiscovered = automaticContextEnabled
|
|
522
|
+
&& await isKnownNativeDiscoveredContextFile(sourcePath, contextCwd, this.input.capabilities.contextDiscovery.strategy, this.input.capabilities.contextDiscovery.knownFileNames ?? [], this.input.capabilities.contextDiscovery.knownUserRelativePaths ?? [], this.input.capabilities.contextDiscovery.knownCwdRelativePaths ?? [], this.input.capabilities.contextDiscovery.knownRelativePaths ?? [], this.input.capabilities.contextDiscovery.knownAncestorRelativePaths ?? []);
|
|
333
523
|
this.context.push({
|
|
334
524
|
id,
|
|
335
525
|
kind: "context-file",
|
|
@@ -341,6 +531,7 @@ class RuntimeResourceSession {
|
|
|
341
531
|
path: sourcePath,
|
|
342
532
|
sourcePath,
|
|
343
533
|
content,
|
|
534
|
+
...(nativeDiscovered ? { nativeDiscovered: true } : {}),
|
|
344
535
|
});
|
|
345
536
|
}
|
|
346
537
|
catch (error) {
|
|
@@ -406,8 +597,9 @@ class RuntimeResourceSession {
|
|
|
406
597
|
}
|
|
407
598
|
}
|
|
408
599
|
async materialize() {
|
|
600
|
+
const privateFiles = [];
|
|
409
601
|
const materializeSkills = this.input.capabilities.skills.support === "materialized" && this.skills.length > 0;
|
|
410
|
-
const materializeContext = this.input.capabilities.context.support === "materialized" && this.context.some((item) => item.content !== undefined);
|
|
602
|
+
const materializeContext = this.input.capabilities.context.support === "materialized" && this.context.some((item) => item.content !== undefined && !item.nativeDiscovered);
|
|
411
603
|
const materializeMcp = this.mcpServers.some((server) => server.scoped !== undefined);
|
|
412
604
|
if (!materializeSkills && !materializeContext && !materializeMcp)
|
|
413
605
|
return;
|
|
@@ -431,12 +623,12 @@ class RuntimeResourceSession {
|
|
|
431
623
|
if (materializeContext) {
|
|
432
624
|
let materializedIndex = 0;
|
|
433
625
|
for (const contribution of this.context) {
|
|
434
|
-
if (contribution.content === undefined)
|
|
626
|
+
if (contribution.content === undefined || contribution.nativeDiscovered)
|
|
435
627
|
continue;
|
|
436
628
|
const target = join(this.paths.context, `${String(materializedIndex++).padStart(3, "0")}-${slug(contribution.label)}.md`);
|
|
437
629
|
try {
|
|
438
630
|
await writeFile(target, contribution.content, { encoding: "utf8", mode: 0o600 });
|
|
439
|
-
|
|
631
|
+
privateFiles.push(target);
|
|
440
632
|
contribution.materializedPath = target;
|
|
441
633
|
}
|
|
442
634
|
catch (error) {
|
|
@@ -456,12 +648,13 @@ class RuntimeResourceSession {
|
|
|
456
648
|
}
|
|
457
649
|
const configPath = join(this.paths.config, MCP_CONFIG_FILE);
|
|
458
650
|
await writeFile(configPath, `${JSON.stringify({ mcpServers: materializedConfigs }, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
459
|
-
|
|
651
|
+
privateFiles.push(configPath);
|
|
460
652
|
this.adapterEnvironment.MCP_CONFIG_PATH = configPath;
|
|
461
653
|
this.adapterEnvironment.MCP_NO_DAEMON = "1";
|
|
462
654
|
this.adapterEnvironment.MCP_STRICT_ENV = "true";
|
|
463
655
|
this.adapterEnvironment.PIBO_MCP_ISOLATED_ENV = "1";
|
|
464
656
|
}
|
|
657
|
+
protectPrivatePathsSync(privateFiles.map((path) => ({ path, kind: "file" })));
|
|
465
658
|
}
|
|
466
659
|
async verifyMcpServers() {
|
|
467
660
|
const shouldVerify = this.input.verifyMcp !== false;
|
|
@@ -504,6 +697,17 @@ class RuntimeResourceSession {
|
|
|
504
697
|
}
|
|
505
698
|
for (const contribution of this.context) {
|
|
506
699
|
const failure = this.diagnosticFor(contribution.id);
|
|
700
|
+
if (contribution.nativeDiscovered) {
|
|
701
|
+
this.delivery.push({
|
|
702
|
+
contributionId: contribution.id,
|
|
703
|
+
status: failure ? "failed" : "delivered",
|
|
704
|
+
mode: "native-project-discovery",
|
|
705
|
+
fidelity: failure ? "none" : "exact",
|
|
706
|
+
target: contribution.sourcePath ?? contribution.path,
|
|
707
|
+
...(failure ? { diagnostic: failure } : {}),
|
|
708
|
+
});
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
507
711
|
if (contribution.id === ENABLED_MCP_CONTEXT_ID
|
|
508
712
|
&& this.input.capabilities.mcp.externalServers.support === "mcp") {
|
|
509
713
|
this.delivery.push({
|
|
@@ -516,8 +720,8 @@ class RuntimeResourceSession {
|
|
|
516
720
|
});
|
|
517
721
|
continue;
|
|
518
722
|
}
|
|
519
|
-
if (contribution.kind === "automatic"
|
|
520
|
-
const supportsNativeDiscovery = this.input.capabilities.
|
|
723
|
+
if (contribution.kind === "automatic") {
|
|
724
|
+
const supportsNativeDiscovery = this.input.capabilities.contextDiscovery.supported;
|
|
521
725
|
this.delivery.push(supportsNativeDiscovery
|
|
522
726
|
? {
|
|
523
727
|
contributionId: contribution.id,
|
|
@@ -531,7 +735,7 @@ class RuntimeResourceSession {
|
|
|
531
735
|
status: "unsupported",
|
|
532
736
|
mode: "unsupported:auto-context-discovery",
|
|
533
737
|
fidelity: "none",
|
|
534
|
-
diagnostic: "This runtime
|
|
738
|
+
diagnostic: "This runtime does not declare automatic native project-context discovery.",
|
|
535
739
|
});
|
|
536
740
|
continue;
|
|
537
741
|
}
|
|
@@ -542,8 +746,7 @@ class RuntimeResourceSession {
|
|
|
542
746
|
? contribution.materializedPath
|
|
543
747
|
: contribution.path ?? contribution.sourcePath ?? this.input.cwd,
|
|
544
748
|
failure,
|
|
545
|
-
fidelity:
|
|
546
|
-
modeOverride: contribution.kind === "automatic" ? "native-discovery" : undefined,
|
|
749
|
+
fidelity: "exact",
|
|
547
750
|
}));
|
|
548
751
|
}
|
|
549
752
|
for (const server of this.mcpServers) {
|
|
@@ -12,6 +12,7 @@ import { CodexNativeRequestController } from "./requests.js";
|
|
|
12
12
|
import { CodexNativeResourceDelivery } from "./resource-delivery.js";
|
|
13
13
|
import { CODEX_NATIVE_MODEL_OPTIONS_SCHEMA, CODEX_NATIVE_MODEL_PROVIDER_ID, CODEX_NATIVE_REASONING_VALUES, CodexNativeSessionSettingsController, parseCodexNativeProfileOptions, readCodexNativeModelCatalog, readCodexNativePersistedSettings, toAgentRuntimeModelCatalog, } from "./models.js";
|
|
14
14
|
import { CodexNativeAuthController } from "./auth.js";
|
|
15
|
+
import { injectPortableHistoryIntoCodex } from "./portable-history.js";
|
|
15
16
|
export { CODEX_NATIVE_ADAPTER_ID } from "./thread.js";
|
|
16
17
|
export const CODEX_NATIVE_ADAPTER_VERSION = "1.0.0";
|
|
17
18
|
function codexNativeCapabilities(structuredUserInput) {
|
|
@@ -57,6 +58,19 @@ function codexNativeCapabilities(structuredUserInput) {
|
|
|
57
58
|
},
|
|
58
59
|
skills: { support: "materialized", modes: ["codex-extra-roots"] },
|
|
59
60
|
context: { support: "materialized", modes: ["native-project-discovery", "codex-developer-instructions"] },
|
|
61
|
+
contextDiscovery: {
|
|
62
|
+
supported: true,
|
|
63
|
+
configurable: false,
|
|
64
|
+
enabledByDefault: true,
|
|
65
|
+
strategy: "codex-project",
|
|
66
|
+
knownFileNames: ["AGENTS.override.md", "AGENTS.md"],
|
|
67
|
+
},
|
|
68
|
+
nativeSubagents: {
|
|
69
|
+
supported: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
enabledByDefault: true,
|
|
72
|
+
},
|
|
73
|
+
historyImport: true,
|
|
60
74
|
auth: {
|
|
61
75
|
status: true,
|
|
62
76
|
methods: [
|
|
@@ -81,7 +95,7 @@ function codexNativeCapabilities(structuredUserInput) {
|
|
|
81
95
|
structuredUserInput,
|
|
82
96
|
},
|
|
83
97
|
maintenance: {
|
|
84
|
-
compaction:
|
|
98
|
+
compaction: true,
|
|
85
99
|
contextUsage: true,
|
|
86
100
|
history: true,
|
|
87
101
|
health: true,
|
|
@@ -228,6 +242,22 @@ export class CodexNativeThreadSession {
|
|
|
228
242
|
this.assertIdle();
|
|
229
243
|
return this.settings.setModel(model);
|
|
230
244
|
},
|
|
245
|
+
compact: async (customInstructions) => await this.runIdleOperation(async () => {
|
|
246
|
+
const customInstructionsRequested = Boolean(customInstructions?.trim());
|
|
247
|
+
if (customInstructionsRequested) {
|
|
248
|
+
this.emit({
|
|
249
|
+
type: "warning",
|
|
250
|
+
message: "Native Codex compaction owns its summary and cannot apply custom Pibo compaction instructions; the native compaction is continuing without them.",
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
await this.turns.compact();
|
|
254
|
+
this.updateBindingFromCurrentThread();
|
|
255
|
+
return {
|
|
256
|
+
native: true,
|
|
257
|
+
method: "thread/compact/start",
|
|
258
|
+
customInstructionsApplied: !customInstructionsRequested,
|
|
259
|
+
};
|
|
260
|
+
}),
|
|
231
261
|
respondToApproval: (requestId, decision) => this.requests.respondToApproval(requestId, decision),
|
|
232
262
|
respondToUserInput: (requestId, answers) => this.requests.respondToUserInput(requestId, answers),
|
|
233
263
|
};
|
|
@@ -696,6 +726,7 @@ export class CodexNativeAgentRuntimeAdapter {
|
|
|
696
726
|
workspace: input.workspace,
|
|
697
727
|
portableTools: input.services?.portableTools,
|
|
698
728
|
resources: input.services?.resources,
|
|
729
|
+
nativeSubagentsEnabled: input.profile.nativeSubagents,
|
|
699
730
|
};
|
|
700
731
|
const startProcessBundle = async (processGeneration) => {
|
|
701
732
|
let delivery;
|
|
@@ -774,6 +805,12 @@ export class CodexNativeAgentRuntimeAdapter {
|
|
|
774
805
|
throw error;
|
|
775
806
|
throw new Error("Codex could not initialize every selected MCP server.");
|
|
776
807
|
}
|
|
808
|
+
if (input.historyHandoff?.mode === "import") {
|
|
809
|
+
if (binding.state === "bound") {
|
|
810
|
+
throw new Error("Native Codex portable history import requires a new thread.");
|
|
811
|
+
}
|
|
812
|
+
await injectPortableHistoryIntoCodex(process.client, threads.thread.id, input.historyHandoff.history);
|
|
813
|
+
}
|
|
777
814
|
settings.attachThread(threads.thread.id, threads.configuration);
|
|
778
815
|
await resourceDelivery.verifyThread(process.client, threads.thread.id);
|
|
779
816
|
return new CodexNativeThreadSession(this.instanceId, process, threads, settings, resourceDelivery, bindingForThread({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { AgentRuntimeAuthError } from "../../agent-runtime/errors.js";
|
|
3
|
+
import { protectPrivateTreeSync } from "../../core/private-path.js";
|
|
3
4
|
export const CODEX_NATIVE_AUTH_PROVIDER_ID = "openai-codex";
|
|
4
5
|
export const CODEX_NATIVE_AUTH_PROVIDER_DISPLAY_NAME = "OpenAI for native Codex";
|
|
5
6
|
const CODEX_DEVICE_METHOD = { id: "device_code", completion: "notification" };
|
|
@@ -298,7 +299,7 @@ export class CodexNativeAuthController {
|
|
|
298
299
|
if (flow.timer)
|
|
299
300
|
clearTimeout(flow.timer);
|
|
300
301
|
flow.unsubscribe?.();
|
|
301
|
-
await flow.process
|
|
302
|
+
await this.closeProcess(flow.process);
|
|
302
303
|
flow.process = undefined;
|
|
303
304
|
}));
|
|
304
305
|
}
|
|
@@ -378,7 +379,7 @@ export class CodexNativeAuthController {
|
|
|
378
379
|
}
|
|
379
380
|
catch (error) {
|
|
380
381
|
unsubscribe?.();
|
|
381
|
-
await process
|
|
382
|
+
await this.closeProcess(process).catch(() => { });
|
|
382
383
|
if (error instanceof AgentRuntimeAuthError)
|
|
383
384
|
throw error;
|
|
384
385
|
throw operationFailure("device login start");
|
|
@@ -428,7 +429,17 @@ export class CodexNativeAuthController {
|
|
|
428
429
|
flow.timer = undefined;
|
|
429
430
|
flow.unsubscribe?.();
|
|
430
431
|
flow.unsubscribe = undefined;
|
|
431
|
-
|
|
432
|
+
try {
|
|
433
|
+
await this.closeProcess(flow.process);
|
|
434
|
+
}
|
|
435
|
+
catch {
|
|
436
|
+
flow.terminal = {
|
|
437
|
+
providerId: flow.providerId,
|
|
438
|
+
state: "failed",
|
|
439
|
+
configured: false,
|
|
440
|
+
message: "Native Codex login state could not be secured. Start a new login.",
|
|
441
|
+
};
|
|
442
|
+
}
|
|
432
443
|
flow.process = undefined;
|
|
433
444
|
})();
|
|
434
445
|
}
|
|
@@ -456,8 +467,18 @@ export class CodexNativeAuthController {
|
|
|
456
467
|
return await operation(process);
|
|
457
468
|
}
|
|
458
469
|
finally {
|
|
470
|
+
await this.closeProcess(process);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async closeProcess(process) {
|
|
474
|
+
if (!process)
|
|
475
|
+
return;
|
|
476
|
+
try {
|
|
459
477
|
await process.close();
|
|
460
478
|
}
|
|
479
|
+
finally {
|
|
480
|
+
protectPrivateTreeSync(process.paths.codexHome);
|
|
481
|
+
}
|
|
461
482
|
}
|
|
462
483
|
latestFlow() {
|
|
463
484
|
return [...this.flows.values()].at(-1);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function jsonString(value) {
|
|
2
|
+
try {
|
|
3
|
+
return JSON.stringify(value ?? null);
|
|
4
|
+
}
|
|
5
|
+
catch {
|
|
6
|
+
return JSON.stringify({ portableFallback: "History value was not JSON serializable." });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function textFromEntry(entry) {
|
|
10
|
+
if (entry.type === "session_info")
|
|
11
|
+
return entry.name;
|
|
12
|
+
if (typeof entry.content === "string")
|
|
13
|
+
return entry.content;
|
|
14
|
+
return entry.content.flatMap((part) => {
|
|
15
|
+
if (part.type === "text" || part.type === "reasoning")
|
|
16
|
+
return [part.text];
|
|
17
|
+
return [];
|
|
18
|
+
}).join("\n");
|
|
19
|
+
}
|
|
20
|
+
function responseItems(entry) {
|
|
21
|
+
if (entry.type === "session_info") {
|
|
22
|
+
return [{
|
|
23
|
+
type: "message",
|
|
24
|
+
role: "developer",
|
|
25
|
+
content: [{ type: "input_text", text: `[Pibo portable session information]\n${entry.name}` }],
|
|
26
|
+
}];
|
|
27
|
+
}
|
|
28
|
+
if (entry.role === "tool") {
|
|
29
|
+
return [{
|
|
30
|
+
type: "function_call_output",
|
|
31
|
+
call_id: entry.toolCallId ?? entry.id,
|
|
32
|
+
output: typeof entry.content === "string" ? entry.content : jsonString(entry.result),
|
|
33
|
+
}];
|
|
34
|
+
}
|
|
35
|
+
if (entry.role === "assistant") {
|
|
36
|
+
const items = [];
|
|
37
|
+
const text = textFromEntry(entry);
|
|
38
|
+
if (text) {
|
|
39
|
+
items.push({
|
|
40
|
+
type: "message",
|
|
41
|
+
role: "assistant",
|
|
42
|
+
content: [{ type: "output_text", text }],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(entry.content)) {
|
|
46
|
+
for (const part of entry.content) {
|
|
47
|
+
if (part.type !== "tool_call")
|
|
48
|
+
continue;
|
|
49
|
+
items.push({
|
|
50
|
+
type: "function_call",
|
|
51
|
+
name: part.toolName,
|
|
52
|
+
arguments: jsonString(part.input),
|
|
53
|
+
call_id: part.toolCallId,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return items;
|
|
58
|
+
}
|
|
59
|
+
const text = textFromEntry(entry);
|
|
60
|
+
if (!text)
|
|
61
|
+
return [];
|
|
62
|
+
return [{
|
|
63
|
+
type: "message",
|
|
64
|
+
role: entry.role === "system" ? "developer" : "user",
|
|
65
|
+
content: [{ type: "input_text", text }],
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
export async function injectPortableHistoryIntoCodex(client, threadId, history) {
|
|
69
|
+
const items = history.entries.flatMap(responseItems);
|
|
70
|
+
if (items.length === 0)
|
|
71
|
+
return;
|
|
72
|
+
await client.request("thread/inject_items", { threadId, items });
|
|
73
|
+
}
|