@rynx-ai/server 0.1.11-beta.4 → 0.1.11-beta.41
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/control-api.d.ts +17 -4
- package/dist/control-api.js +722 -84
- package/dist/control-web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/control-web/assets/abap-CLvhMVsD.js +1 -0
- package/dist/control-web/assets/abnfDiagram-VRR7QNED-D_NL89dn.js +1 -0
- package/dist/control-web/assets/actionscript-3--17pq3dv.js +1 -0
- package/dist/control-web/assets/ada-C5qYipkI.js +1 -0
- package/dist/control-web/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/control-web/assets/angular-html-DlZBZkSp.js +1 -0
- package/dist/control-web/assets/angular-ts-BVPGOT0K.js +1 -0
- package/dist/control-web/assets/apache-U0d_L8uA.js +1 -0
- package/dist/control-web/assets/apex-CGTLDQj6.js +1 -0
- package/dist/control-web/assets/apl-cDmXqmZ-.js +1 -0
- package/dist/control-web/assets/applescript-CCn79oCD.js +1 -0
- package/dist/control-web/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/control-web/assets/arc-Pry-7G1_.js +1 -0
- package/dist/control-web/assets/architecture-TIHT7OUA-C9wU1KtW.js +1 -0
- package/dist/control-web/assets/architectureDiagram-ZJ3FMSHR-CV0rxVH6.js +36 -0
- package/dist/control-web/assets/array-BifhSqXX.js +1 -0
- package/dist/control-web/assets/asciidoc-DE70LPWp.js +1 -0
- package/dist/control-web/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/control-web/assets/astro-B1Q6BwBx.js +1 -0
- package/dist/control-web/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/control-web/assets/awk-BWXHIvNe.js +1 -0
- package/dist/control-web/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/control-web/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/control-web/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/control-web/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/control-web/assets/bat-Bo4NYOV-.js +1 -0
- package/dist/control-web/assets/beancount-D-usSTwE.js +1 -0
- package/dist/control-web/assets/berry-DKpUyyne.js +1 -0
- package/dist/control-web/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/control-web/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/control-web/assets/bird2-C2hNVINV.js +1 -0
- package/dist/control-web/assets/blade-Xpu-LGTm.js +1 -0
- package/dist/control-web/assets/blockDiagram-677ZJIJ3-Cc7nrkZh.js +132 -0
- package/dist/control-web/assets/bsl-BkkzgIyY.js +1 -0
- package/dist/control-web/assets/c-iCihek07.js +1 -0
- package/dist/control-web/assets/c3-CnJL0r0V.js +1 -0
- package/dist/control-web/assets/c4Diagram-LMCZKHZV-BPRU9m-F.js +10 -0
- package/dist/control-web/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/control-web/assets/cairo-DLTphjLi.js +1 -0
- package/dist/control-web/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
- package/dist/control-web/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
- package/dist/control-web/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
- package/dist/control-web/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
- package/dist/control-web/assets/channel-BFm2_j8K.js +1 -0
- package/dist/control-web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/control-web/assets/chunk-32BRIVSS-Bbq3O54m.js +1 -0
- package/dist/control-web/assets/chunk-52WLFC77-sD4al-Ob.js +10 -0
- package/dist/control-web/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/control-web/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/dist/control-web/assets/chunk-C7G6YPKG-DqHaDS1O.js +1 -0
- package/dist/control-web/assets/chunk-EX3LRPZG-36GNQ5wp.js +231 -0
- package/dist/control-web/assets/chunk-HOUHSVGY-DeZ63q1j.js +1 -0
- package/dist/control-web/assets/chunk-ICXQ74PX-D2yF6lD_.js +2 -0
- package/dist/control-web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/control-web/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
- package/dist/control-web/assets/chunk-MOJQB5TN-CdaKyBz5.js +88 -0
- package/dist/control-web/assets/chunk-OGEWGWER-eOXC7kiH.js +1 -0
- package/dist/control-web/assets/chunk-PUDLZKDR-6w0LILL_.js +156 -0
- package/dist/control-web/assets/chunk-Q4XR5HBZ-CXgD5TGL.js +70 -0
- package/dist/control-web/assets/chunk-RYQCIY6F-BsoV8yK2.js +1 -0
- package/dist/control-web/assets/chunk-V7JOEXUC-BfoZ78b6.js +206 -0
- package/dist/control-web/assets/chunk-VR4S4FIN-BW2gCEMQ.js +1 -0
- package/dist/control-web/assets/chunk-WYO6CB5R-CHn7hulw.js +128 -0
- package/dist/control-web/assets/chunk-XXDRQBXY-DqAYeljN.js +1 -0
- package/dist/control-web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/control-web/assets/chunk-ZGVPDNZ5-CmFP0-fr.js +62 -0
- package/dist/control-web/assets/clarity-SemFz856.js +1 -0
- package/dist/control-web/assets/classDiagram-OUVF2IWQ-CUe_bETB.js +1 -0
- package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-CUe_bETB.js +1 -0
- package/dist/control-web/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/control-web/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/control-web/assets/cobol-BsV-839J.js +1 -0
- package/dist/control-web/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/control-web/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/control-web/assets/coffee-CiiSLhB6.js +1 -0
- package/dist/control-web/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/control-web/assets/coq-BrsZFFmf.js +1 -0
- package/dist/control-web/assets/cose-bilkent-JH36ORCC-lJEhNiw_.js +1 -0
- package/dist/control-web/assets/cpp-DjoE5qBx.js +1 -0
- package/dist/control-web/assets/crystal-DDxHDkHz.js +1 -0
- package/dist/control-web/assets/csharp-Ct8U2NOr.js +1 -0
- package/dist/control-web/assets/css-LjpOdHib.js +1 -0
- package/dist/control-web/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/control-web/assets/cue-CE9AQfxI.js +1 -0
- package/dist/control-web/assets/cynefin-VYW2F7L2-NaLr7Qlq.js +1 -0
- package/dist/control-web/assets/cynefinDiagram-TSTJHNR4-C90wpjAI.js +62 -0
- package/dist/control-web/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/control-web/assets/cytoscape.esm-B-NFISlW.js +321 -0
- package/dist/control-web/assets/d-qD-0Kul2.js +1 -0
- package/dist/control-web/assets/dagre-Buvkdvvj.js +1 -0
- package/dist/control-web/assets/dagre-VKFMJZFB-BxrPFWTb.js +4 -0
- package/dist/control-web/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/control-web/assets/dart-DkHntEIa.js +1 -0
- package/dist/control-web/assets/dax-BkyTk9wS.js +1 -0
- package/dist/control-web/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/control-web/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/control-web/assets/diagram-FQU43EPY-VIQINsvz.js +3 -0
- package/dist/control-web/assets/diagram-G47NLZAW-DFeAfYXn.js +24 -0
- package/dist/control-web/assets/diagram-NH7WQ7WH-ATzdppDd.js +24 -0
- package/dist/control-web/assets/diagram-OA4YK3LP-DJZpWmbl.js +30 -0
- package/dist/control-web/assets/diagram-WEI45ONY-CqDHcW3g.js +41 -0
- package/dist/control-web/assets/diff-woXpYk--.js +1 -0
- package/dist/control-web/assets/dist-Dx9YWgcW.js +153 -0
- package/dist/control-web/assets/dist-v5Q1xZ2K.js +1 -0
- package/dist/control-web/assets/docker-IyjqRm3v.js +1 -0
- package/dist/control-web/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/control-web/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/control-web/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/control-web/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/control-web/assets/ebnfDiagram-CCIWWBDH-DnP6dHND.js +1 -0
- package/dist/control-web/assets/edge-8z7Jp9dO.js +1 -0
- package/dist/control-web/assets/elixir-CUV54ev5.js +1 -0
- package/dist/control-web/assets/elm-o4NJxfws.js +1 -0
- package/dist/control-web/assets/emacs-lisp-C9PiwqqW.js +1 -0
- package/dist/control-web/assets/erDiagram-Q63AITRT-Bo8bFqrZ.js +85 -0
- package/dist/control-web/assets/erb-CIsHcwm1.js +1 -0
- package/dist/control-web/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/control-web/assets/eventmodeling-45OFAUF4-DTN8wqsu.js +1 -0
- package/dist/control-web/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/control-web/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/control-web/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/control-web/assets/fish-BJitypiv.js +1 -0
- package/dist/control-web/assets/flowDiagram-23GEKE2U-BwjqRyvd.js +1 -0
- package/dist/control-web/assets/fluent-C03EYrpw.js +1 -0
- package/dist/control-web/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/control-web/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/control-web/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/control-web/assets/ganttDiagram-NO4QXBWP-kxQaBTzd.js +292 -0
- package/dist/control-web/assets/gdresource-C0sCabJj.js +1 -0
- package/dist/control-web/assets/gdscript-Cp2uCuqX.js +1 -0
- package/dist/control-web/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/control-web/assets/genie-CV2tkWYe.js +1 -0
- package/dist/control-web/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/control-web/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/control-web/assets/git-rebase-BDPpS8w6.js +1 -0
- package/dist/control-web/assets/gitGraph-TEB2WS4Q-a646NnuJ.js +1 -0
- package/dist/control-web/assets/gitGraphDiagram-IHSO6WYX-BBe0q0At.js +106 -0
- package/dist/control-web/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/control-web/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/control-web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/control-web/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/control-web/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/control-web/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/control-web/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/control-web/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/control-web/assets/glimmer-js-OEO36pDk.js +1 -0
- package/dist/control-web/assets/glimmer-ts-BnAPyISE.js +1 -0
- package/dist/control-web/assets/glsl-D5MA2a_X.js +1 -0
- package/dist/control-web/assets/gn-ilITqXS6.js +1 -0
- package/dist/control-web/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/control-web/assets/go-BJwz_mda.js +1 -0
- package/dist/control-web/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/control-web/assets/graphql-Ctjuxyvl.js +1 -0
- package/dist/control-web/assets/groovy-CacY0gHj.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/control-web/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/control-web/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/control-web/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/control-web/assets/hack-D_mkkoLd.js +1 -0
- package/dist/control-web/assets/haml-mpgecWZ6.js +1 -0
- package/dist/control-web/assets/handlebars-CAx_777f.js +1 -0
- package/dist/control-web/assets/haskell-D8IpX4py.js +1 -0
- package/dist/control-web/assets/haxe-OTjmBuCE.js +1 -0
- package/dist/control-web/assets/hcl-Dh228itO.js +1 -0
- package/dist/control-web/assets/highlighted-body-OFNGDK62-DVCHy9oI.js +1 -0
- package/dist/control-web/assets/hjson-CxZEssPk.js +1 -0
- package/dist/control-web/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/control-web/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/control-web/assets/horizon-bright-Br1oVSNq.js +1 -0
- package/dist/control-web/assets/houston-CsvMBhTu.js +1 -0
- package/dist/control-web/assets/html-B2lrdnWr.js +1 -0
- package/dist/control-web/assets/html-derivative-CDfZYcul.js +1 -0
- package/dist/control-web/assets/http-kmH8AyfE.js +1 -0
- package/dist/control-web/assets/hurl-DCZHXKU4.js +1 -0
- package/dist/control-web/assets/hxml-B0Qn7Nwc.js +1 -0
- package/dist/control-web/assets/hy-CZbG8q4J.js +1 -0
- package/dist/control-web/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/control-web/assets/index-D7URT6K_.js +140 -0
- package/dist/control-web/assets/index-uEpvRMX9.css +1 -0
- package/dist/control-web/assets/info-DKCQHKI2-Cp_JrY-b.js +1 -0
- package/dist/control-web/assets/infoDiagram-FWYZ7A6U-CAm-h4F_.js +2 -0
- package/dist/control-web/assets/ini-B5eOa1yu.js +1 -0
- package/dist/control-web/assets/init-C-OQMol4.js +1 -0
- package/dist/control-web/assets/ishikawaDiagram-FXEZZL3T-O17pqcWr.js +70 -0
- package/dist/control-web/assets/java-DdHNQ9hk.js +1 -0
- package/dist/control-web/assets/javascript-obGGvMPs.js +1 -0
- package/dist/control-web/assets/jinja-BMiPVedm.js +1 -0
- package/dist/control-web/assets/jison-CBjhYtSs.js +1 -0
- package/dist/control-web/assets/journeyDiagram-5HDEW3XC-DQ-JuSoR.js +139 -0
- package/dist/control-web/assets/json-DAgxKhMr.js +1 -0
- package/dist/control-web/assets/json5-BR5RXkoi.js +1 -0
- package/dist/control-web/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/control-web/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/control-web/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/control-web/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/control-web/assets/jsx-gTgmArGx.js +1 -0
- package/dist/control-web/assets/julia-CjHxn3vf.js +1 -0
- package/dist/control-web/assets/just-DMArCiVH.js +1 -0
- package/dist/control-web/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
- package/dist/control-web/assets/kanagawa-lotus-BN08jTvb.js +1 -0
- package/dist/control-web/assets/kanagawa-wave-CTweb8Dz.js +1 -0
- package/dist/control-web/assets/kanban-definition-HUTT4EX6-Cgv3kPbm.js +89 -0
- package/dist/control-web/assets/katex-CyHG4N6b.js +1 -0
- package/dist/control-web/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/control-web/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/control-web/assets/kusto-BUv0MjJC.js +1 -0
- package/dist/control-web/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/control-web/assets/latex-D9bvcAJr.js +1 -0
- package/dist/control-web/assets/lean-CewbzKMR.js +1 -0
- package/dist/control-web/assets/less-DVTAwKKz.js +1 -0
- package/dist/control-web/assets/lib-BZ_F5vVH.js +1 -0
- package/dist/control-web/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/control-web/assets/line-DUsXzGJZ.js +1 -0
- package/dist/control-web/assets/linear-DmucvK78.js +1 -0
- package/dist/control-web/assets/liquid-CCX5qouA.js +1 -0
- package/dist/control-web/assets/llvm-Cm23YOpf.js +1 -0
- package/dist/control-web/assets/log-BNLmms1o.js +1 -0
- package/dist/control-web/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/control-web/assets/lua-FONpmTUP.js +1 -0
- package/dist/control-web/assets/luau-CNKltnaQ.js +1 -0
- package/dist/control-web/assets/make-Dixweg8N.js +1 -0
- package/dist/control-web/assets/map-BaFkSB1l.js +1 -0
- package/dist/control-web/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/control-web/assets/markdown-streamdown-4N4AcNp5.js +433 -0
- package/dist/control-web/assets/markdown-streamdown-DEcVZfaU.css +1 -0
- package/dist/control-web/assets/marko-oPGh3KfH.js +1 -0
- package/dist/control-web/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/control-web/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/control-web/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/control-web/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/control-web/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/control-web/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/control-web/assets/mdc-B_uQHOlt.js +1 -0
- package/dist/control-web/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/control-web/assets/mermaid-Bk4SNUv9.js +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-BElZGKGd.js +1 -0
- package/dist/control-web/assets/mermaid-parser.core-VMln12Kd.js +7 -0
- package/dist/control-web/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/control-web/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/control-web/assets/mindmap-definition-LN4V7U3C-Bn0lH-UM.js +96 -0
- package/dist/control-web/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/control-web/assets/mojo-BgCJLMeH.js +1 -0
- package/dist/control-web/assets/monokai-CdkpiU2Y.js +1 -0
- package/dist/control-web/assets/moonbit-CaWjb8XO.js +1 -0
- package/dist/control-web/assets/move-B1IS1UjX.js +1 -0
- package/dist/control-web/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/control-web/assets/nextflow-Bbiyy34d.js +1 -0
- package/dist/control-web/assets/nextflow-groovy-Dc_ddanL.js +1 -0
- package/dist/control-web/assets/nginx-BTMw9COX.js +1 -0
- package/dist/control-web/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/control-web/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/control-web/assets/nim-8PQFL6ZB.js +1 -0
- package/dist/control-web/assets/nix-IvuFDN5E.js +1 -0
- package/dist/control-web/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/control-web/assets/nushell-DcLAeLz5.js +1 -0
- package/dist/control-web/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/control-web/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/control-web/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/control-web/assets/odin-B1RWQWA5.js +1 -0
- package/dist/control-web/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/control-web/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/control-web/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/control-web/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/control-web/assets/packet-7NZHBO7P-Zw8iJ8lo.js +1 -0
- package/dist/control-web/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/control-web/assets/path-fybaL0A-.js +1 -0
- package/dist/control-web/assets/pegDiagram-2B236MQR-CtF7vVs_.js +1 -0
- package/dist/control-web/assets/perl-Vf0i0hAx.js +1 -0
- package/dist/control-web/assets/php-am1OsKhm.js +1 -0
- package/dist/control-web/assets/pie-RZYD4A2V-su_3QGU2.js +1 -0
- package/dist/control-web/assets/pieDiagram-ENE6RG2P-BkMUBLE1.js +39 -0
- package/dist/control-web/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/control-web/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/control-web/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/control-web/assets/po-BiJDBrnU.js +1 -0
- package/dist/control-web/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/control-web/assets/polar-C7UOKdEL.js +1 -0
- package/dist/control-web/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/control-web/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/control-web/assets/powershell-DshXNtvi.js +1 -0
- package/dist/control-web/assets/prisma-BsRQq5mF.js +1 -0
- package/dist/control-web/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/control-web/assets/proto-DB4EqR-F.js +1 -0
- package/dist/control-web/assets/pug-DO6yvBr3.js +1 -0
- package/dist/control-web/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/control-web/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/control-web/assets/python-gzcpVVnB.js +1 -0
- package/dist/control-web/assets/qml-_a-QhfPD.js +1 -0
- package/dist/control-web/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/control-web/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/control-web/assets/quadrantDiagram-ABIIQ3AL-ba-VaqMe.js +7 -0
- package/dist/control-web/assets/r-D6UWEOL2.js +1 -0
- package/dist/control-web/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/control-web/assets/radar-I7S5WNFK-Dat0rqem.js +1 -0
- package/dist/control-web/assets/railroad-3IZDKUUU-Dh2-s8r8.js +1 -0
- package/dist/control-web/assets/railroad-abnf-AHOZXSZD-CNUwq0JR.js +1 -0
- package/dist/control-web/assets/railroad-ebnf-EBAXGLYW-RHr0duea.js +1 -0
- package/dist/control-web/assets/railroad-peg-LSFZ7HO6-CVBWS2eU.js +1 -0
- package/dist/control-web/assets/railroadDiagram-RFXS5EU6-BiJX3SY-.js +1 -0
- package/dist/control-web/assets/raku-B3gFvitq.js +1 -0
- package/dist/control-web/assets/razor-CMVBVp3T.js +1 -0
- package/dist/control-web/assets/red-CJ3rzSJv.js +1 -0
- package/dist/control-web/assets/reg-CRGYupPL.js +1 -0
- package/dist/control-web/assets/regexp-DR20uMnK.js +1 -0
- package/dist/control-web/assets/rel-BtDbiS_P.js +1 -0
- package/dist/control-web/assets/requirementDiagram-TGXJPOKE-CFfakCzs.js +84 -0
- package/dist/control-web/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/control-web/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/control-web/assets/ron-VUp2lXgN.js +1 -0
- package/dist/control-web/assets/rose-pine-BthvhNj6.js +1 -0
- package/dist/control-web/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
- package/dist/control-web/assets/rose-pine-moon-hon4tzzS.js +1 -0
- package/dist/control-web/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/control-web/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/control-web/assets/rst-CgIrbW_q.js +1 -0
- package/dist/control-web/assets/ruby-Dp6Zud9H.js +1 -0
- package/dist/control-web/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/control-web/assets/sankeyDiagram-HTMAVEWB-jgDi0God.js +40 -0
- package/dist/control-web/assets/sas-B6p8-ynO.js +1 -0
- package/dist/control-web/assets/sass-DXrisJhu.js +1 -0
- package/dist/control-web/assets/scala-DKOlJaKm.js +1 -0
- package/dist/control-web/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/control-web/assets/scss-DcoSS-ti.js +1 -0
- package/dist/control-web/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/control-web/assets/sequenceDiagram-DBY2YBRQ-DBfyyb0N.js +162 -0
- package/dist/control-web/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/control-web/assets/shellscript-Da78Ox-3.js +1 -0
- package/dist/control-web/assets/shellsession-CVsQGYfZ.js +1 -0
- package/dist/control-web/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/dist/control-web/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/control-web/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/control-web/assets/smalltalk-B16xEiuN.js +1 -0
- package/dist/control-web/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/control-web/assets/solarized-dark-DV17i1UV.js +1 -0
- package/dist/control-web/assets/solarized-light-DSh2HLQt.js +1 -0
- package/dist/control-web/assets/solidity-CKzVLygQ.js +1 -0
- package/dist/control-web/assets/soy-B5n_eHSp.js +1 -0
- package/dist/control-web/assets/sparql-D_iOobhT.js +1 -0
- package/dist/control-web/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/control-web/assets/sql-ClgswhA6.js +1 -0
- package/dist/control-web/assets/src-B6xuSHsQ.js +1 -0
- package/dist/control-web/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/control-web/assets/stata-RoaAgbqU.js +1 -0
- package/dist/control-web/assets/stateDiagram-2N3HPSRC-Dwb_ncVi.js +1 -0
- package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-DI0opaA1.js +1 -0
- package/dist/control-web/assets/stylus-B6D30XZt.js +1 -0
- package/dist/control-web/assets/surrealql-DIn4NJsS.js +1 -0
- package/dist/control-web/assets/svelte-CIt8Fl9I.js +1 -0
- package/dist/control-web/assets/swift-DonLKvLd.js +1 -0
- package/dist/control-web/assets/swimlanes-5IMT3BWC-DW0LuiIV.js +2 -0
- package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-DDTVjcOR.js +8 -0
- package/dist/control-web/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/control-web/assets/system-verilog-DJ5XKQeo.js +1 -0
- package/dist/control-web/assets/systemd-BxMlprV5.js +1 -0
- package/dist/control-web/assets/talonscript-CohzipZa.js +1 -0
- package/dist/control-web/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/control-web/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/control-web/assets/templ-BREsJpNc.js +1 -0
- package/dist/control-web/assets/terraform-DswuEJGm.js +1 -0
- package/dist/control-web/assets/tex-0w6-Dtgt.js +1 -0
- package/dist/control-web/assets/timeline-definition-FHXFAJF6-DeX4B_B8.js +120 -0
- package/dist/control-web/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/control-web/assets/toml-CcmNWLt0.js +1 -0
- package/dist/control-web/assets/treeView-QDETBFTQ-D1UXtICj.js +1 -0
- package/dist/control-web/assets/treemap-6X3UGDF4-CrppzjZH.js +1 -0
- package/dist/control-web/assets/ts-tags-q3pptdMi.js +1 -0
- package/dist/control-web/assets/tsv-sltzmVWM.js +1 -0
- package/dist/control-web/assets/tsx-CUOciP0b.js +1 -0
- package/dist/control-web/assets/turtle-ByJddavk.js +1 -0
- package/dist/control-web/assets/twig-LIeLXgf5.js +1 -0
- package/dist/control-web/assets/typescript-BydbNFcO.js +1 -0
- package/dist/control-web/assets/typespec-B88KGewJ.js +1 -0
- package/dist/control-web/assets/typst-DI99ib-x.js +1 -0
- package/dist/control-web/assets/v-DETTlOr0.js +1 -0
- package/dist/control-web/assets/vala-zf12oZj6.js +1 -0
- package/dist/control-web/assets/vb-Djn5o6TS.js +1 -0
- package/dist/control-web/assets/vennDiagram-L72KCM5P-BYpf-7VR.js +34 -0
- package/dist/control-web/assets/verilog-CiiDBU1e.js +1 -0
- package/dist/control-web/assets/vesper-D5bVUKB1.js +1 -0
- package/dist/control-web/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/control-web/assets/viml-DvXPmvsu.js +1 -0
- package/dist/control-web/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/control-web/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/control-web/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/control-web/assets/vue-DVSfBueU.js +1 -0
- package/dist/control-web/assets/vue-html-DkKkQnZL.js +1 -0
- package/dist/control-web/assets/vue-vine-pWqEcBkW.js +1 -0
- package/dist/control-web/assets/vyper-CgoNMtux.js +1 -0
- package/dist/control-web/assets/wardley-OPB4EBWU-B9rA0UsV.js +1 -0
- package/dist/control-web/assets/wardleyDiagram-EHGQE667-BdvAUa5F.js +78 -0
- package/dist/control-web/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/control-web/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/control-web/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/control-web/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/control-web/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/control-web/assets/wit-DdvCle-K.js +1 -0
- package/dist/control-web/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/control-web/assets/xml-BlnrEAEy.js +1 -0
- package/dist/control-web/assets/xsl-BOPS8gLt.js +1 -0
- package/dist/control-web/assets/xychartDiagram-FW5EYKEG-BaEV3pGm.js +7 -0
- package/dist/control-web/assets/yaml-Du_6cdrH.js +1 -0
- package/dist/control-web/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/control-web/assets/zig-CMLA9XwU.js +1 -0
- package/dist/control-web/index.html +3 -2
- package/dist/control-web-dist.d.ts +1 -1
- package/dist/control-web-dist.js +4 -2
- package/dist/desktop-browser-host.d.ts +3 -1
- package/dist/desktop-browser-host.js +39 -4
- package/dist/direct-runtime-server.js +187 -153
- package/dist/machine-session-service.d.ts +105 -15
- package/dist/machine-session-service.js +781 -87
- package/dist/remote-runtime-dispatcher.d.ts +2 -2
- package/dist/remote-runtime-dispatcher.js +42 -2
- package/dist/remote-runtime-session-projection.d.ts +1 -0
- package/dist/remote-runtime-session-projection.js +12 -0
- package/dist/server.d.ts +64 -11
- package/dist/server.js +422 -55
- package/dist/session-browser-service.d.ts +24 -4
- package/dist/session-browser-service.js +127 -1
- package/dist/session-pending-inputs.d.ts +42 -0
- package/dist/session-pending-inputs.js +87 -0
- package/dist/session-portal.d.ts +54 -0
- package/dist/session-portal.js +997 -0
- package/dist/session-runtime-index.d.ts +3 -6
- package/dist/session-runtime-index.js +96 -38
- package/dist/session-terminal-host.d.ts +22 -2
- package/dist/session-terminal-host.js +66 -83
- package/dist/terminal-ws.d.ts +4 -1
- package/dist/terminal-ws.js +93 -27
- package/package.json +7 -7
- package/dist/control-web/assets/highlighted-body-OFNGDK62-DWWsUtHF.js +0 -1
- package/dist/control-web/assets/index-BnX7NWJX.js +0 -689
- package/dist/control-web/assets/index-CUoWRX2i.css +0 -32
- package/dist/control-web/assets/mermaid-GHXKKRXX-C1fxAgiw.js +0 -131
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* Direct adapters can therefore expose the same behavior without copying state
|
|
8
8
|
* into a Control Plane database.
|
|
9
9
|
*/
|
|
10
|
-
import { createHash
|
|
11
|
-
import {
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { open, realpath, stat } from "node:fs/promises";
|
|
12
|
+
import { basename, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
13
|
+
import { isDeepStrictEqual } from "node:util";
|
|
14
|
+
import { SESSION_PROVIDER_IDS, getRuntimeProfile, isSessionProviderId, newSessionId, normalizeSessionTitle, } from "@rynx-ai/core";
|
|
12
15
|
import { REMOTE_RUNTIME_SESSION_DEFAULT_PAGE_SIZE, REMOTE_RUNTIME_SESSION_MAX_CURSOR_CHARS, REMOTE_RUNTIME_SESSION_MAX_ID_CHARS, REMOTE_RUNTIME_SESSION_MAX_PAGE_SIZE, } from "@rynx-ai/protocol/remote-runtime-rpc";
|
|
13
16
|
const DEFAULT_LIST_LIMIT = REMOTE_RUNTIME_SESSION_DEFAULT_PAGE_SIZE;
|
|
14
17
|
const MAX_LIST_LIMIT = REMOTE_RUNTIME_SESSION_MAX_PAGE_SIZE;
|
|
@@ -31,10 +34,17 @@ export class MachineSessionServiceInputError extends Error {
|
|
|
31
34
|
export class MachineSessionServiceFailure extends Error {
|
|
32
35
|
code;
|
|
33
36
|
detail;
|
|
34
|
-
|
|
37
|
+
runtimeFailure;
|
|
38
|
+
retryable;
|
|
39
|
+
constructor(code, message, detail, runtimeFailure,
|
|
40
|
+
/** True only when retrying the same operation can succeed without changing
|
|
41
|
+
* its payload. Used by durable mirror delivery to preserve transient data. */
|
|
42
|
+
retryable = false) {
|
|
35
43
|
super(message);
|
|
36
44
|
this.code = code;
|
|
37
45
|
this.detail = detail;
|
|
46
|
+
this.runtimeFailure = runtimeFailure;
|
|
47
|
+
this.retryable = retryable;
|
|
38
48
|
this.name = "MachineSessionServiceFailure";
|
|
39
49
|
}
|
|
40
50
|
}
|
|
@@ -52,6 +62,7 @@ export class MachineSessionService {
|
|
|
52
62
|
pendingDeliveries = new Map();
|
|
53
63
|
cancelledPendingDeliveries = new Set();
|
|
54
64
|
forkTasks = new Map();
|
|
65
|
+
sessionMutationTails = new Map();
|
|
55
66
|
constructor(ports, options = {}) {
|
|
56
67
|
this.ports = ports;
|
|
57
68
|
this.maxListLimit = boundedInteger(options.maxListLimit ?? MAX_LIST_LIMIT, 1, MAX_LIST_LIMIT, "maxListLimit");
|
|
@@ -110,7 +121,8 @@ export class MachineSessionService {
|
|
|
110
121
|
limit: limit + 1,
|
|
111
122
|
})).slice(0, limit + 1).map((item) => structuredClone(item));
|
|
112
123
|
const runtime = cloneRuntimeSnapshot(this.ports.runtimeState.snapshot(sessionId));
|
|
113
|
-
const
|
|
124
|
+
const pendingInputs = this.ports.pendingInputs?.snapshotFor(sessionId) ?? [];
|
|
125
|
+
const empty = snapshotPage(sessionId, [], pendingInputs, runtime, false);
|
|
114
126
|
const items = [];
|
|
115
127
|
let itemsJsonBytes = 0;
|
|
116
128
|
for (const item of candidates.slice(0, limit)) {
|
|
@@ -118,14 +130,14 @@ export class MachineSessionService {
|
|
|
118
130
|
const nextCount = items.length + 1;
|
|
119
131
|
const hasMore = candidates.length > nextCount;
|
|
120
132
|
if (items.length > 0 &&
|
|
121
|
-
snapshotPageJsonByteLength(sessionId, nextItemsJsonBytes, item.id, runtime, hasMore) > this.snapshotPageMaxBytes) {
|
|
133
|
+
snapshotPageJsonByteLength(sessionId, nextItemsJsonBytes, item.id, pendingInputs, runtime, hasMore) > this.snapshotPageMaxBytes) {
|
|
122
134
|
break;
|
|
123
135
|
}
|
|
124
136
|
items.push(item);
|
|
125
137
|
itemsJsonBytes = nextItemsJsonBytes;
|
|
126
138
|
}
|
|
127
139
|
return items.length > 0
|
|
128
|
-
? snapshotPage(sessionId, items, runtime, candidates.length > items.length)
|
|
140
|
+
? snapshotPage(sessionId, items, pendingInputs, runtime, candidates.length > items.length)
|
|
129
141
|
: empty;
|
|
130
142
|
}
|
|
131
143
|
/**
|
|
@@ -159,11 +171,18 @@ export class MachineSessionService {
|
|
|
159
171
|
const statusCache = new Map();
|
|
160
172
|
const { agents } = await this.agentOptions();
|
|
161
173
|
const [providers, launchAgents] = await Promise.all([
|
|
162
|
-
Promise.all(SESSION_PROVIDER_IDS.map(async (provider) =>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
Promise.all(SESSION_PROVIDER_IDS.map(async (provider) => {
|
|
175
|
+
const execution = this.ports.execution;
|
|
176
|
+
const models = execution?.listModels
|
|
177
|
+
? await execution.listModels(provider).catch(() => [])
|
|
178
|
+
: undefined;
|
|
179
|
+
return {
|
|
180
|
+
id: provider,
|
|
181
|
+
name: getRuntimeProfile(provider).displayName,
|
|
182
|
+
...await this.runtimeReadiness(provider, statusCache),
|
|
183
|
+
...(models === undefined ? {} : { models }),
|
|
184
|
+
};
|
|
185
|
+
})),
|
|
167
186
|
Promise.all(agents.map(async (agent) => {
|
|
168
187
|
const execution = this.ports.execution;
|
|
169
188
|
if (!execution) {
|
|
@@ -192,6 +211,97 @@ export class MachineSessionService {
|
|
|
192
211
|
]);
|
|
193
212
|
return { providers, agents: launchAgents };
|
|
194
213
|
}
|
|
214
|
+
/** Read the effective model defaults used for the next turn. */
|
|
215
|
+
async executionSettings(sessionIdInput) {
|
|
216
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
217
|
+
const meta = this.ports.registry.get(sessionId);
|
|
218
|
+
if (!meta) {
|
|
219
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
220
|
+
}
|
|
221
|
+
return executionSettingsResult(meta.execution);
|
|
222
|
+
}
|
|
223
|
+
/** Replace the defaults for the next new Turn. Codex-lineage Providers keep
|
|
224
|
+
* their live runner: the host applies changed native thread settings under
|
|
225
|
+
* its injection lock immediately before the next `turn/start`. Claude still
|
|
226
|
+
* needs an idle cold resume because its live CLI has no confirmed settings
|
|
227
|
+
* update boundary. Provider CLIs own model availability validation. */
|
|
228
|
+
async updateExecutionSettings(input) {
|
|
229
|
+
const sessionId = validOpaqueToken(input.sessionId, "sessionId", MAX_SESSION_ID_CHARS);
|
|
230
|
+
const modelId = input.model === null ? null : validRequiredText(input.model, "model");
|
|
231
|
+
const reasoningEffort = input.reasoningEffort === null
|
|
232
|
+
? null
|
|
233
|
+
: validRequiredText(input.reasoningEffort, "reasoningEffort");
|
|
234
|
+
return this.withSessionMutation(sessionId, async () => {
|
|
235
|
+
const meta = this.ports.registry.get(sessionId);
|
|
236
|
+
if (!meta) {
|
|
237
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
238
|
+
}
|
|
239
|
+
await this.assertNotForkReserved(sessionId);
|
|
240
|
+
const nextExecution = await this.replaceExecutionSettings(sessionId, meta, { model: modelId, reasoningEffort }, input.collaborationMode);
|
|
241
|
+
return executionSettingsResult(nextExecution);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async replaceExecutionSettings(sessionId, meta, selection, collaborationMode) {
|
|
245
|
+
if (meta.execution.provider === "claude") {
|
|
246
|
+
const runtime = this.ports.runtimeState.snapshot(sessionId);
|
|
247
|
+
const pendingMessage = await this.ports.pendingMessages?.get(sessionId);
|
|
248
|
+
if (runtime.status !== "idle" ||
|
|
249
|
+
runtime.activeResponseIds.length > 0 ||
|
|
250
|
+
runtime.pendingInteractions.length > 0 ||
|
|
251
|
+
pendingMessage) {
|
|
252
|
+
throw new MachineSessionServiceFailure("failed_precondition", "Claude Session must be idle before changing model settings");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const executionPort = this.requireExecution();
|
|
256
|
+
const nextExecution = {
|
|
257
|
+
...structuredClone(meta.execution),
|
|
258
|
+
model: selection.model,
|
|
259
|
+
reasoningEffort: selection.reasoningEffort,
|
|
260
|
+
...(meta.execution.provider !== "claude" && collaborationMode !== undefined
|
|
261
|
+
? { collaborationMode }
|
|
262
|
+
: {}),
|
|
263
|
+
};
|
|
264
|
+
if (meta.execution.provider !== "claude" && collaborationMode !== undefined) {
|
|
265
|
+
const updateMode = executionPort.runner.updateCollaborationMode;
|
|
266
|
+
if (!updateMode) {
|
|
267
|
+
const message = "This Runtime does not support live collaboration-mode updates";
|
|
268
|
+
throw new MachineSessionServiceFailure("failed_precondition", message, message, {
|
|
269
|
+
message,
|
|
270
|
+
code: "collaboration_mode_unavailable",
|
|
271
|
+
statusCode: 409,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
// Native state is authoritative. Do not make a failed
|
|
275
|
+
// toggle survive reload when the loaded thread rejected it.
|
|
276
|
+
try {
|
|
277
|
+
await updateMode.call(executionPort.runner, sessionId, collaborationMode);
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
const failure = liveSessionFailureFrom(error);
|
|
281
|
+
const message = collaborationModeFailureMessage(meta.execution.provider, failure, error instanceof Error ? error.message : "Native collaboration mode update failed");
|
|
282
|
+
throw new MachineSessionServiceFailure("failed_precondition", message, message, failure ? { ...failure, message } : undefined);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
this.ports.registry.setExecution(sessionId, nextExecution);
|
|
286
|
+
if (nextExecution.provider === "claude") {
|
|
287
|
+
executionPort.runner.stopRunner(sessionId);
|
|
288
|
+
}
|
|
289
|
+
return nextExecution;
|
|
290
|
+
}
|
|
291
|
+
/** Persist a mode changed from the native TUI before its reflected event is
|
|
292
|
+
* fanned out to Web clients. Unknown/deleted and Claude Sessions are ignored. */
|
|
293
|
+
recordNativeCollaborationMode(sessionIdInput, mode) {
|
|
294
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
295
|
+
const meta = this.ports.registry.get(sessionId);
|
|
296
|
+
if (!meta || meta.execution.provider === "claude")
|
|
297
|
+
return;
|
|
298
|
+
if (meta.execution.collaborationMode === mode)
|
|
299
|
+
return;
|
|
300
|
+
this.ports.registry.setExecution(sessionId, {
|
|
301
|
+
...structuredClone(meta.execution),
|
|
302
|
+
collaborationMode: mode,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
195
305
|
/** Create target-owned Session identity from one Agent preset or direct Provider. */
|
|
196
306
|
async create(input) {
|
|
197
307
|
return this.withAdmission(() => this.createAdmitted(input));
|
|
@@ -223,6 +333,7 @@ export class MachineSessionService {
|
|
|
223
333
|
...target,
|
|
224
334
|
...(input.model === undefined ? {} : { model: input.model }),
|
|
225
335
|
...(input.reasoningEffort === undefined ? {} : { reasoningEffort: input.reasoningEffort }),
|
|
336
|
+
...(input.permissionPreset === undefined ? {} : { permissionPreset: input.permissionPreset }),
|
|
226
337
|
cwd: workspace.cwd,
|
|
227
338
|
});
|
|
228
339
|
const sessionId = newSessionId();
|
|
@@ -302,6 +413,11 @@ export class MachineSessionService {
|
|
|
302
413
|
if (input.kind === "fork" &&
|
|
303
414
|
existing.forkedFromSessionId === sourceSessionId)
|
|
304
415
|
return;
|
|
416
|
+
if (input.kind === "clear" &&
|
|
417
|
+
existing.source === "clear" &&
|
|
418
|
+
isDeepStrictEqual(existing.workspace, source.workspace) &&
|
|
419
|
+
isDeepStrictEqual(existing.execution, source.execution))
|
|
420
|
+
return;
|
|
305
421
|
throw new MachineSessionServiceFailure("conflict", "target Session already exists");
|
|
306
422
|
}
|
|
307
423
|
const workspace = structuredClone(source.workspace);
|
|
@@ -395,8 +511,169 @@ export class MachineSessionService {
|
|
|
395
511
|
async sendMessage(sessionIdInput, messageInput) {
|
|
396
512
|
return this.withAdmission(() => this.sendMessageAdmitted(sessionIdInput, messageInput));
|
|
397
513
|
}
|
|
398
|
-
|
|
514
|
+
/** Start a turn and return only that response's canonical event stream. */
|
|
515
|
+
async startRun(sessionIdInput, messageInput, options = {}) {
|
|
516
|
+
return this.withAdmission(async () => {
|
|
517
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
518
|
+
const meta = this.ports.registry.get(sessionId);
|
|
519
|
+
if (!meta)
|
|
520
|
+
throw new MachineSessionServiceFailure("not_found", "Session not found");
|
|
521
|
+
const subscription = this.ports.events.subscribe(sessionId)[Symbol.asyncIterator]();
|
|
522
|
+
let unsteer;
|
|
523
|
+
let ownsTurn = false;
|
|
524
|
+
const activateTurn = () => {
|
|
525
|
+
if (ownsTurn)
|
|
526
|
+
return;
|
|
527
|
+
ownsTurn = true;
|
|
528
|
+
if (!options.signal?.aborted) {
|
|
529
|
+
unsteer = options.steer?.subscribe((text) => {
|
|
530
|
+
void this.requireExecution().runner.injectMessage(sessionId, text);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
const interrupt = () => {
|
|
535
|
+
if (ownsTurn)
|
|
536
|
+
void this.ports.interruption.interrupt(sessionId);
|
|
537
|
+
};
|
|
538
|
+
try {
|
|
539
|
+
options.signal?.addEventListener("abort", interrupt, { once: true });
|
|
540
|
+
const result = await this.sendMessageAdmitted(sessionId, messageInput, options.signal, activateTurn, true, options.collaborationMode
|
|
541
|
+
? { collaborationMode: options.collaborationMode }
|
|
542
|
+
: undefined);
|
|
543
|
+
const initialResponseId = result.responseId;
|
|
544
|
+
const pendingId = result.pendingId;
|
|
545
|
+
const replayItems = result.replayed && initialResponseId
|
|
546
|
+
? (await this.ports.log.snapshot(sessionId)).filter((item) => item.responseId === initialResponseId)
|
|
547
|
+
: [];
|
|
548
|
+
const replayedItemIds = new Set(replayItems.map((item) => item.id));
|
|
549
|
+
const replayWasActive = initialResponseId
|
|
550
|
+
? this.ports.runtimeState.snapshot(sessionId).activeResponseIds.includes(initialResponseId)
|
|
551
|
+
: false;
|
|
552
|
+
if (result.replayed && initialResponseId && !replayWasActive) {
|
|
553
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "run was already accepted but its terminal event is no longer available");
|
|
554
|
+
}
|
|
555
|
+
if (result.replayed && (initialResponseId || pendingId)) {
|
|
556
|
+
activateTurn();
|
|
557
|
+
if (options.signal?.aborted) {
|
|
558
|
+
await this.ports.interruption.interrupt(sessionId).catch(() => false);
|
|
559
|
+
throw abortReason(options.signal);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const runExecution = result.operationExecution ?? {
|
|
563
|
+
model: meta.execution.model,
|
|
564
|
+
reasoningEffort: meta.execution.reasoningEffort,
|
|
565
|
+
};
|
|
566
|
+
const model = runExecution.model;
|
|
567
|
+
// After a daemon restart an already-injected transcript-backed
|
|
568
|
+
// operation has neither a process-live pending id nor a replayable
|
|
569
|
+
// response id. Its delivery is still successful and must never be
|
|
570
|
+
// repeated. End this caller's projection without claiming a different
|
|
571
|
+
// future Turn; the transcript remains independently visible on the
|
|
572
|
+
// Session stream.
|
|
573
|
+
if (result.replayed && !initialResponseId && !pendingId) {
|
|
574
|
+
options.signal?.removeEventListener("abort", interrupt);
|
|
575
|
+
await subscription.return?.();
|
|
576
|
+
const provider = meta.execution.provider;
|
|
577
|
+
return {
|
|
578
|
+
provider,
|
|
579
|
+
model: runExecution.model,
|
|
580
|
+
authSource: provider === "traex"
|
|
581
|
+
? "traex_cli"
|
|
582
|
+
: provider === "claude"
|
|
583
|
+
? "claude_cli"
|
|
584
|
+
: "codex_cli",
|
|
585
|
+
generator: (async function* () { })(),
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
const generator = (async function* () {
|
|
589
|
+
let responseId = initialResponseId;
|
|
590
|
+
const beforeIdentity = new Map();
|
|
591
|
+
try {
|
|
592
|
+
if (result.replayed && responseId) {
|
|
593
|
+
yield {
|
|
594
|
+
type: "response.created",
|
|
595
|
+
sessionId,
|
|
596
|
+
responseId,
|
|
597
|
+
model: model ?? "unknown",
|
|
598
|
+
};
|
|
599
|
+
for (const item of replayItems)
|
|
600
|
+
yield replaySessionItem(item);
|
|
601
|
+
}
|
|
602
|
+
while (true) {
|
|
603
|
+
const next = await subscription.next();
|
|
604
|
+
if (next.done)
|
|
605
|
+
return;
|
|
606
|
+
const event = next.value;
|
|
607
|
+
if (!responseId) {
|
|
608
|
+
const eventResponseId = sessionEventResponseId(event);
|
|
609
|
+
if (eventResponseId) {
|
|
610
|
+
const buffered = beforeIdentity.get(eventResponseId) ?? [];
|
|
611
|
+
buffered.push(event);
|
|
612
|
+
beforeIdentity.set(eventResponseId, buffered);
|
|
613
|
+
}
|
|
614
|
+
const lateResponseId = pendingId
|
|
615
|
+
? responseIdForClearedPending(event, pendingId)
|
|
616
|
+
: event.type === "response.created"
|
|
617
|
+
? event.responseId
|
|
618
|
+
: undefined;
|
|
619
|
+
if (!lateResponseId)
|
|
620
|
+
continue;
|
|
621
|
+
responseId = lateResponseId;
|
|
622
|
+
for (const buffered of beforeIdentity.get(responseId) ?? []) {
|
|
623
|
+
const itemId = sessionEventItemId(buffered);
|
|
624
|
+
if (itemId && replayedItemIds.has(itemId))
|
|
625
|
+
continue;
|
|
626
|
+
yield buffered;
|
|
627
|
+
if (isTerminalResponseEvent(buffered))
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
beforeIdentity.clear();
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
if (sessionEventResponseId(event) !== responseId)
|
|
634
|
+
continue;
|
|
635
|
+
const itemId = sessionEventItemId(event);
|
|
636
|
+
if (itemId && replayedItemIds.has(itemId))
|
|
637
|
+
continue;
|
|
638
|
+
yield event;
|
|
639
|
+
if (isTerminalResponseEvent(event))
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
finally {
|
|
644
|
+
options.signal?.removeEventListener("abort", interrupt);
|
|
645
|
+
unsteer?.();
|
|
646
|
+
await subscription.return?.();
|
|
647
|
+
}
|
|
648
|
+
})();
|
|
649
|
+
const provider = meta.execution.provider;
|
|
650
|
+
return {
|
|
651
|
+
...(initialResponseId ? { responseId: initialResponseId } : {}),
|
|
652
|
+
provider,
|
|
653
|
+
model: runExecution.model,
|
|
654
|
+
authSource: provider === "traex"
|
|
655
|
+
? "traex_cli"
|
|
656
|
+
: provider === "claude"
|
|
657
|
+
? "claude_cli"
|
|
658
|
+
: "codex_cli",
|
|
659
|
+
generator,
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
options.signal?.removeEventListener("abort", interrupt);
|
|
664
|
+
unsteer?.();
|
|
665
|
+
await subscription.return?.();
|
|
666
|
+
throw error;
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
async sendMessageAdmitted(sessionIdInput, messageInput, signal, onTurnOwned, includeResponseId = false, turnOptions) {
|
|
399
671
|
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
672
|
+
return this.withSessionMutation(sessionId, () => this.sendMessageAdmittedSerial(sessionId, messageInput, signal, onTurnOwned, includeResponseId, turnOptions));
|
|
673
|
+
}
|
|
674
|
+
async sendMessageAdmittedSerial(sessionId, messageInput, signal, onTurnOwned, includeResponseId = false, turnOptions) {
|
|
675
|
+
if (signal?.aborted)
|
|
676
|
+
throw abortReason(signal);
|
|
400
677
|
await this.assertNotForkReserved(sessionId);
|
|
401
678
|
const request = typeof messageInput === "string"
|
|
402
679
|
? { message: messageInput }
|
|
@@ -412,7 +689,24 @@ export class MachineSessionService {
|
|
|
412
689
|
if (hasContent && (!Array.isArray(request.content) || request.content.length === 0)) {
|
|
413
690
|
throw new MachineSessionServiceInputError("content must be a non-empty array");
|
|
414
691
|
}
|
|
415
|
-
|
|
692
|
+
let meta = this.ports.registry.get(sessionId);
|
|
693
|
+
const executionSelection = normalizeRunExecutionSelection(request.execution);
|
|
694
|
+
if (executionSelection && !meta) {
|
|
695
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
696
|
+
}
|
|
697
|
+
const requestedOperationExecution = executionSelection && meta
|
|
698
|
+
? {
|
|
699
|
+
selection: executionSelection,
|
|
700
|
+
snapshot: {
|
|
701
|
+
model: executionSelection.model !== undefined
|
|
702
|
+
? executionSelection.model
|
|
703
|
+
: meta.execution.model,
|
|
704
|
+
reasoningEffort: executionSelection.reasoningEffort !== undefined
|
|
705
|
+
? executionSelection.reasoningEffort
|
|
706
|
+
: meta.execution.reasoningEffort,
|
|
707
|
+
},
|
|
708
|
+
}
|
|
709
|
+
: undefined;
|
|
416
710
|
const consoleMeta = meta?.source === "console" ? meta : undefined;
|
|
417
711
|
let prepared;
|
|
418
712
|
const needsPreparedOperation = hasContent || request.clientMessageId !== undefined;
|
|
@@ -428,14 +722,29 @@ export class MachineSessionService {
|
|
|
428
722
|
}
|
|
429
723
|
prepared = await resources.prepareInput(sessionId, hasContent
|
|
430
724
|
? request.content
|
|
431
|
-
: [{ type: "input_text", text: request.message }], request.clientMessageId);
|
|
725
|
+
: [{ type: "input_text", text: request.message }], request.clientMessageId, ...(requestedOperationExecution ? [requestedOperationExecution] : []));
|
|
432
726
|
if (prepared.operationState === "injecting" ||
|
|
433
727
|
prepared.operationState === "outcome_unknown") {
|
|
434
728
|
throw new MachineSessionServiceFailure("outcome_unknown", "message delivery outcome is unknown");
|
|
435
729
|
}
|
|
436
730
|
if (prepared.operationState === "injected" ||
|
|
437
731
|
prepared.operationState === "mirrored") {
|
|
438
|
-
|
|
732
|
+
const replayPendingId = prepared.operationState === "injected" && request.clientMessageId
|
|
733
|
+
? this.ports.pendingInputs
|
|
734
|
+
?.findByClientMessageId(sessionId, request.clientMessageId)?.pendingId
|
|
735
|
+
: undefined;
|
|
736
|
+
return {
|
|
737
|
+
ok: true,
|
|
738
|
+
injected: true,
|
|
739
|
+
...(replayPendingId ? { pendingId: replayPendingId } : {}),
|
|
740
|
+
...(includeResponseId && prepared.responseId
|
|
741
|
+
? { responseId: prepared.responseId }
|
|
742
|
+
: {}),
|
|
743
|
+
...(prepared.operationExecution
|
|
744
|
+
? { operationExecution: prepared.operationExecution }
|
|
745
|
+
: {}),
|
|
746
|
+
replayed: true,
|
|
747
|
+
};
|
|
439
748
|
}
|
|
440
749
|
}
|
|
441
750
|
else {
|
|
@@ -449,108 +758,139 @@ export class MachineSessionService {
|
|
|
449
758
|
title: request.message,
|
|
450
759
|
};
|
|
451
760
|
}
|
|
761
|
+
const operationExecution = prepared.operationExecution ?? requestedOperationExecution?.snapshot;
|
|
762
|
+
if (operationExecution &&
|
|
763
|
+
meta &&
|
|
764
|
+
(operationExecution.model !== meta.execution.model ||
|
|
765
|
+
operationExecution.reasoningEffort !== meta.execution.reasoningEffort)) {
|
|
766
|
+
const nextExecution = await this.replaceExecutionSettings(sessionId, meta, operationExecution);
|
|
767
|
+
meta = { ...meta, execution: nextExecution };
|
|
768
|
+
}
|
|
452
769
|
if (consoleMeta && !consoleMeta.title) {
|
|
453
770
|
this.ports.registry.setTitle(sessionId, synthesizeSessionTitle(prepared.title));
|
|
454
771
|
}
|
|
455
772
|
const resources = this.ports.resources;
|
|
773
|
+
if (signal?.aborted) {
|
|
774
|
+
if (request.clientMessageId) {
|
|
775
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, "run was cancelled before injection");
|
|
776
|
+
}
|
|
777
|
+
throw abortReason(signal);
|
|
778
|
+
}
|
|
456
779
|
if (request.clientMessageId) {
|
|
457
780
|
await resources?.markMessageInjecting(sessionId, request.clientMessageId);
|
|
458
781
|
}
|
|
459
|
-
const responseId = this.ports.publishEvent ? `resp_${randomUUID()}` : undefined;
|
|
460
|
-
if (responseId) {
|
|
461
|
-
await this.ports.publishEvent(sessionId, {
|
|
462
|
-
type: "session.input.consumed",
|
|
463
|
-
item: {
|
|
464
|
-
id: newSessionItemId("message"),
|
|
465
|
-
sessionId,
|
|
466
|
-
position: 0,
|
|
467
|
-
responseId,
|
|
468
|
-
status: "completed",
|
|
469
|
-
createdAt: Date.now(),
|
|
470
|
-
type: "message",
|
|
471
|
-
data: {
|
|
472
|
-
role: "user",
|
|
473
|
-
content: prepared.input.content.map((part) => part.type === "text"
|
|
474
|
-
? { type: "input_text", text: part.text }
|
|
475
|
-
: { ...part.resource }),
|
|
476
|
-
},
|
|
477
|
-
},
|
|
478
|
-
});
|
|
479
|
-
await this.ports.publishEvent(sessionId, {
|
|
480
|
-
type: "session.status",
|
|
481
|
-
sessionId,
|
|
482
|
-
responseId,
|
|
483
|
-
status: "running",
|
|
484
|
-
statusKind: "startup",
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
const abandonResponseHandoff = responseId
|
|
488
|
-
? this.ports.runtimeState.beginResponseHandoff?.(sessionId, responseId)
|
|
489
|
-
: undefined;
|
|
490
|
-
const clearStartup = async (status) => {
|
|
491
|
-
if (!responseId)
|
|
492
|
-
return;
|
|
493
|
-
await this.ports.publishEvent(sessionId, {
|
|
494
|
-
type: "session.status",
|
|
495
|
-
sessionId,
|
|
496
|
-
responseId,
|
|
497
|
-
status,
|
|
498
|
-
});
|
|
499
|
-
};
|
|
500
782
|
let execution;
|
|
501
783
|
try {
|
|
502
784
|
execution = await this.ensureLiveSession(sessionId, meta);
|
|
503
785
|
}
|
|
504
786
|
catch (error) {
|
|
505
|
-
abandonResponseHandoff?.();
|
|
506
|
-
await clearStartup("idle");
|
|
507
787
|
if (request.clientMessageId) {
|
|
508
788
|
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, error instanceof Error ? error.message : String(error));
|
|
509
789
|
}
|
|
510
790
|
throw error;
|
|
511
791
|
}
|
|
512
|
-
|
|
792
|
+
if (signal?.aborted) {
|
|
793
|
+
if (request.clientMessageId) {
|
|
794
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, "run was cancelled before injection");
|
|
795
|
+
}
|
|
796
|
+
throw abortReason(signal);
|
|
797
|
+
}
|
|
798
|
+
let result;
|
|
799
|
+
const pendingId = this.ports.pendingInputs && request.clientMessageId
|
|
800
|
+
? this.ports.pendingInputs.record(sessionId, {
|
|
801
|
+
clientMessageId: request.clientMessageId,
|
|
802
|
+
content: (hasContent
|
|
803
|
+
? request.content
|
|
804
|
+
: [{ type: "input_text", text: request.message }]).map((part) => ({ ...part })),
|
|
805
|
+
})
|
|
806
|
+
: undefined;
|
|
807
|
+
const rollbackPendingInput = () => {
|
|
808
|
+
if (pendingId)
|
|
809
|
+
this.ports.pendingInputs?.resolve(sessionId, pendingId);
|
|
810
|
+
};
|
|
513
811
|
try {
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
812
|
+
const injectionInput = needsPreparedOperation ? prepared.input : request.message;
|
|
813
|
+
result = turnOptions
|
|
814
|
+
? await execution.runner.injectMessage(sessionId, injectionInput, turnOptions)
|
|
815
|
+
: await execution.runner.injectMessage(sessionId, injectionInput);
|
|
518
816
|
}
|
|
519
817
|
catch (error) {
|
|
520
|
-
|
|
521
|
-
|
|
818
|
+
rollbackPendingInput();
|
|
819
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId)
|
|
820
|
+
?? liveSessionFailureFrom(error);
|
|
821
|
+
const reason = failure?.message
|
|
822
|
+
?? (error instanceof Error ? error.message : String(error));
|
|
522
823
|
if (request.clientMessageId) {
|
|
523
|
-
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId,
|
|
824
|
+
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason)).catch(() => undefined);
|
|
524
825
|
}
|
|
525
|
-
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown");
|
|
826
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown", reason, failure);
|
|
526
827
|
}
|
|
828
|
+
const outcome = result.outcome;
|
|
527
829
|
if (outcome === "failed") {
|
|
528
|
-
|
|
529
|
-
|
|
830
|
+
rollbackPendingInput();
|
|
831
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
832
|
+
const reason = failure?.message
|
|
833
|
+
?? execution.runner.lastLiveSessionError?.(sessionId)
|
|
834
|
+
?? `live injection ${outcome}`;
|
|
835
|
+
if (request.clientMessageId) {
|
|
836
|
+
await resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason);
|
|
837
|
+
}
|
|
838
|
+
throw new MachineSessionServiceFailure("outcome_unknown", `live injection ${outcome}`, reason, failure);
|
|
839
|
+
}
|
|
840
|
+
if (outcome !== "injected" && outcome !== "steered") {
|
|
841
|
+
rollbackPendingInput();
|
|
842
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
843
|
+
const reason = failure?.message
|
|
844
|
+
?? execution.runner.lastLiveSessionError?.(sessionId)
|
|
845
|
+
?? `live injection ${outcome}`;
|
|
530
846
|
if (request.clientMessageId) {
|
|
531
|
-
await resources?.
|
|
847
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, reason);
|
|
532
848
|
}
|
|
533
|
-
throw new MachineSessionServiceFailure("
|
|
849
|
+
throw new MachineSessionServiceFailure("failed_precondition", `live injection ${outcome}`, reason, failure);
|
|
534
850
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
await
|
|
851
|
+
onTurnOwned?.();
|
|
852
|
+
if (signal?.aborted) {
|
|
853
|
+
await this.ports.interruption.interrupt(sessionId).catch(() => false);
|
|
538
854
|
if (request.clientMessageId) {
|
|
539
|
-
await resources?.
|
|
855
|
+
await Promise.resolve(resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined)).catch(() => undefined);
|
|
540
856
|
}
|
|
541
|
-
throw
|
|
857
|
+
throw abortReason(signal);
|
|
542
858
|
}
|
|
543
|
-
await clearStartup("running");
|
|
544
859
|
if (request.clientMessageId) {
|
|
545
860
|
try {
|
|
546
|
-
await resources?.markMessageInjected(sessionId, request.clientMessageId);
|
|
861
|
+
await resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined);
|
|
547
862
|
}
|
|
548
863
|
catch {
|
|
549
864
|
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, "message state could not be persisted after injection")).catch(() => undefined);
|
|
550
865
|
throw new MachineSessionServiceFailure("outcome_unknown", "message was injected but its delivery state could not be persisted");
|
|
551
866
|
}
|
|
552
867
|
}
|
|
553
|
-
return {
|
|
868
|
+
return {
|
|
869
|
+
ok: true,
|
|
870
|
+
injected: true,
|
|
871
|
+
...(pendingId ? { pendingId } : {}),
|
|
872
|
+
...(includeResponseId && result.responseId ? { responseId: result.responseId } : {}),
|
|
873
|
+
...(operationExecution ? { operationExecution } : {}),
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
async withSessionMutation(sessionId, action) {
|
|
877
|
+
const previous = this.sessionMutationTails.get(sessionId);
|
|
878
|
+
let release;
|
|
879
|
+
const tail = new Promise((resolve) => {
|
|
880
|
+
release = resolve;
|
|
881
|
+
});
|
|
882
|
+
this.sessionMutationTails.set(sessionId, tail);
|
|
883
|
+
if (previous)
|
|
884
|
+
await previous;
|
|
885
|
+
try {
|
|
886
|
+
return await action();
|
|
887
|
+
}
|
|
888
|
+
finally {
|
|
889
|
+
release();
|
|
890
|
+
if (this.sessionMutationTails.get(sessionId) === tail) {
|
|
891
|
+
this.sessionMutationTails.delete(sessionId);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
554
894
|
}
|
|
555
895
|
resourcePolicy(sessionIdInput) {
|
|
556
896
|
const sessionId = this.requireResourceSession(sessionIdInput);
|
|
@@ -580,6 +920,62 @@ export class MachineSessionService {
|
|
|
580
920
|
const sessionId = this.requireResourceSession(input.sessionId);
|
|
581
921
|
return this.requireResources().deleteResource({ ...input, sessionId });
|
|
582
922
|
}
|
|
923
|
+
async resolveResourcePath(sessionIdInput, resourceId) {
|
|
924
|
+
const sessionId = this.requireResourceSession(sessionIdInput);
|
|
925
|
+
const resolve = this.requireResources().resolveCommittedLocalPath;
|
|
926
|
+
if (!resolve) {
|
|
927
|
+
throw new MachineSessionServiceFailure("failed_precondition", "Session resource paths are unavailable");
|
|
928
|
+
}
|
|
929
|
+
return resolve.call(this.requireResources(), sessionId, resourceId);
|
|
930
|
+
}
|
|
931
|
+
async getFile(input) {
|
|
932
|
+
const resolved = await this.resolveSessionItemFile(input);
|
|
933
|
+
return { file: resolved.metadata };
|
|
934
|
+
}
|
|
935
|
+
async readFile(input) {
|
|
936
|
+
const resolved = await this.resolveSessionItemFile(input);
|
|
937
|
+
return this.readResolvedFile(resolved, input);
|
|
938
|
+
}
|
|
939
|
+
async getWorkspaceFile(input) {
|
|
940
|
+
const resolved = await this.resolveSessionWorkspaceFile(input);
|
|
941
|
+
return { file: resolved.metadata };
|
|
942
|
+
}
|
|
943
|
+
async readWorkspaceFile(input) {
|
|
944
|
+
const resolved = await this.resolveSessionWorkspaceFile(input);
|
|
945
|
+
return this.readResolvedFile(resolved, input);
|
|
946
|
+
}
|
|
947
|
+
async readResolvedFile(resolved, input) {
|
|
948
|
+
if (resolved.metadata.version !== input.version) {
|
|
949
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
950
|
+
}
|
|
951
|
+
if (input.offset >= resolved.metadata.byteLength) {
|
|
952
|
+
return { data: "", offset: input.offset, eof: true };
|
|
953
|
+
}
|
|
954
|
+
const length = Math.min(input.length, resolved.metadata.byteLength - input.offset);
|
|
955
|
+
const file = await open(resolved.path, "r");
|
|
956
|
+
try {
|
|
957
|
+
const openedStat = await file.stat();
|
|
958
|
+
if (!openedStat.isFile() ||
|
|
959
|
+
sessionFileVersion(resolved.path, openedStat) !== resolved.metadata.version) {
|
|
960
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
961
|
+
}
|
|
962
|
+
const buffer = Buffer.allocUnsafe(length);
|
|
963
|
+
const { bytesRead } = await file.read(buffer, 0, length, input.offset);
|
|
964
|
+
const completedStat = await file.stat();
|
|
965
|
+
if (sessionFileVersion(resolved.path, completedStat) !== resolved.metadata.version) {
|
|
966
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
967
|
+
}
|
|
968
|
+
const nextOffset = input.offset + bytesRead;
|
|
969
|
+
return {
|
|
970
|
+
data: buffer.subarray(0, bytesRead).toString("base64"),
|
|
971
|
+
offset: nextOffset,
|
|
972
|
+
eof: nextOffset >= resolved.metadata.byteLength,
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
finally {
|
|
976
|
+
await file.close();
|
|
977
|
+
}
|
|
978
|
+
}
|
|
583
979
|
/** Persist the first task while login/onboarding owns the Provider TUI. The
|
|
584
980
|
* delivery worker starts the pane now, waits for a real native thread, then
|
|
585
981
|
* injects exactly once. `failed` is fenced as outcome_unknown and never retried. */
|
|
@@ -627,7 +1023,8 @@ export class MachineSessionService {
|
|
|
627
1023
|
request.execution.runner.ensureLiveSession.bind(request.execution.runner);
|
|
628
1024
|
const started = await start(sessionId, request.options);
|
|
629
1025
|
if (!started) {
|
|
630
|
-
|
|
1026
|
+
const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
1027
|
+
throw new MachineSessionServiceFailure("failed_precondition", `Provider terminal unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
|
|
631
1028
|
}
|
|
632
1029
|
return { ok: true };
|
|
633
1030
|
}
|
|
@@ -635,7 +1032,8 @@ export class MachineSessionService {
|
|
|
635
1032
|
const request = await this.liveSessionRequest(sessionId, meta);
|
|
636
1033
|
const live = await request.execution.runner.ensureLiveSession(sessionId, request.options);
|
|
637
1034
|
if (!live) {
|
|
638
|
-
|
|
1035
|
+
const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
1036
|
+
throw new MachineSessionServiceFailure("failed_precondition", `live session unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
|
|
639
1037
|
}
|
|
640
1038
|
return request.execution;
|
|
641
1039
|
}
|
|
@@ -666,9 +1064,22 @@ export class MachineSessionService {
|
|
|
666
1064
|
throw new MachineSessionServiceFailure("failed_precondition", "Session-owned resources could not be fenced before deletion", error instanceof Error ? error.message : String(error));
|
|
667
1065
|
}
|
|
668
1066
|
this.cancelledPendingDeliveries.add(sessionId);
|
|
669
|
-
this.ports.execution?.runner
|
|
1067
|
+
const runner = this.ports.execution?.runner;
|
|
1068
|
+
if (runner?.terminateLiveSession) {
|
|
1069
|
+
try {
|
|
1070
|
+
await runner.terminateLiveSession(sessionId);
|
|
1071
|
+
}
|
|
1072
|
+
catch (error) {
|
|
1073
|
+
console.warn(`[machine-session] session=${sessionId} live teardown failed during deletion; continuing best-effort: ${error instanceof Error ? error.message : String(error)}`);
|
|
1074
|
+
runner.stopRunner(sessionId);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
else {
|
|
1078
|
+
runner?.stopRunner(sessionId);
|
|
1079
|
+
}
|
|
670
1080
|
this.ports.events.close?.(sessionId);
|
|
671
1081
|
await this.ports.pendingMessages?.delete(sessionId);
|
|
1082
|
+
this.ports.pendingInputs?.deleteSession(sessionId);
|
|
672
1083
|
await this.ports.resources?.deleteSession(sessionId);
|
|
673
1084
|
this.ports.registry.remove(sessionId);
|
|
674
1085
|
await this.ports.log.deleteSession(sessionId);
|
|
@@ -682,6 +1093,101 @@ export class MachineSessionService {
|
|
|
682
1093
|
}
|
|
683
1094
|
return { ok: true };
|
|
684
1095
|
}
|
|
1096
|
+
async resolveSessionItemFile(input) {
|
|
1097
|
+
const sessionId = this.requireResourceSession(input.sessionId);
|
|
1098
|
+
const item = await this.ports.log.get(sessionId, input.itemId);
|
|
1099
|
+
if (!item) {
|
|
1100
|
+
throw new MachineSessionServiceFailure("not_found", "Session item was not found");
|
|
1101
|
+
}
|
|
1102
|
+
let reference;
|
|
1103
|
+
let type;
|
|
1104
|
+
if (item.type === "message" && item.data.role === "user") {
|
|
1105
|
+
const part = item.data.content[input.partIndex];
|
|
1106
|
+
if (!part || (part.type !== "input_image" && part.type !== "input_file")) {
|
|
1107
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1108
|
+
}
|
|
1109
|
+
reference = part;
|
|
1110
|
+
type = part.type;
|
|
1111
|
+
}
|
|
1112
|
+
else if (item.type === "function_call_output" && input.partIndex === 0) {
|
|
1113
|
+
if (!item.data.generatedImage) {
|
|
1114
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1115
|
+
}
|
|
1116
|
+
reference = item.data.generatedImage;
|
|
1117
|
+
type = "generated_image";
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1121
|
+
}
|
|
1122
|
+
if (!("path" in reference) || !reference.path || !isAbsolute(reference.path)) {
|
|
1123
|
+
throw new MachineSessionServiceFailure("not_found", "Session item is not path-backed");
|
|
1124
|
+
}
|
|
1125
|
+
try {
|
|
1126
|
+
const canonicalPath = await realpath(reference.path);
|
|
1127
|
+
const fileStat = await stat(canonicalPath);
|
|
1128
|
+
if (!fileStat.isFile() || fileStat.size < 1) {
|
|
1129
|
+
throw new MachineSessionServiceFailure("not_found", "Session item path is not a file");
|
|
1130
|
+
}
|
|
1131
|
+
const modifiedAt = Math.max(0, Math.trunc(fileStat.mtimeMs));
|
|
1132
|
+
const version = sessionFileVersion(canonicalPath, fileStat);
|
|
1133
|
+
return {
|
|
1134
|
+
path: canonicalPath,
|
|
1135
|
+
metadata: {
|
|
1136
|
+
itemId: item.id,
|
|
1137
|
+
partIndex: input.partIndex,
|
|
1138
|
+
type,
|
|
1139
|
+
filename: reference.filename || basename(canonicalPath),
|
|
1140
|
+
mediaType: reference.mediaType,
|
|
1141
|
+
byteLength: fileStat.size,
|
|
1142
|
+
modifiedAt,
|
|
1143
|
+
version,
|
|
1144
|
+
},
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
catch (error) {
|
|
1148
|
+
if (error instanceof MachineSessionServiceFailure)
|
|
1149
|
+
throw error;
|
|
1150
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file is unavailable", error instanceof Error ? error.message : String(error));
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
async resolveSessionWorkspaceFile(input) {
|
|
1154
|
+
const sessionId = this.requireResourceSession(input.sessionId);
|
|
1155
|
+
const session = this.ports.registry.get(sessionId);
|
|
1156
|
+
try {
|
|
1157
|
+
const workspaceRoot = await realpath(session.workspace.cwd);
|
|
1158
|
+
const requestedPath = isAbsolute(input.path)
|
|
1159
|
+
? input.path
|
|
1160
|
+
: resolve(workspaceRoot, input.path);
|
|
1161
|
+
const canonicalPath = await realpath(requestedPath);
|
|
1162
|
+
const workspaceRelative = relative(workspaceRoot, canonicalPath);
|
|
1163
|
+
if (!workspaceRelative ||
|
|
1164
|
+
workspaceRelative === ".." ||
|
|
1165
|
+
workspaceRelative.startsWith(`..${sep}`) ||
|
|
1166
|
+
isAbsolute(workspaceRelative)) {
|
|
1167
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file was not found");
|
|
1168
|
+
}
|
|
1169
|
+
const fileStat = await stat(canonicalPath);
|
|
1170
|
+
if (!fileStat.isFile()) {
|
|
1171
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace path is not a file");
|
|
1172
|
+
}
|
|
1173
|
+
return {
|
|
1174
|
+
path: canonicalPath,
|
|
1175
|
+
metadata: {
|
|
1176
|
+
path: input.path,
|
|
1177
|
+
filename: basename(canonicalPath),
|
|
1178
|
+
mediaType: workspaceFileMediaType(canonicalPath),
|
|
1179
|
+
byteLength: fileStat.size,
|
|
1180
|
+
modifiedAt: Math.max(0, Math.trunc(fileStat.mtimeMs)),
|
|
1181
|
+
version: sessionFileVersion(canonicalPath, fileStat),
|
|
1182
|
+
},
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
catch (error) {
|
|
1186
|
+
if (error instanceof MachineSessionServiceFailure)
|
|
1187
|
+
throw error;
|
|
1188
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file is unavailable", error instanceof Error ? error.message : String(error));
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
685
1191
|
requireAgents() {
|
|
686
1192
|
if (!this.ports.agents) {
|
|
687
1193
|
throw new MachineSessionServiceFailure("failed_precondition", "session agent options are unavailable");
|
|
@@ -770,8 +1276,8 @@ export class MachineSessionService {
|
|
|
770
1276
|
current.message !== pending.message)
|
|
771
1277
|
return;
|
|
772
1278
|
injectionAttempted = true;
|
|
773
|
-
const outcome = await execution.runner.injectMessage(sessionId, pending.message);
|
|
774
|
-
if (outcome === "injected") {
|
|
1279
|
+
const { outcome } = await execution.runner.injectMessage(sessionId, pending.message);
|
|
1280
|
+
if (outcome === "injected" || outcome === "steered") {
|
|
775
1281
|
await Promise.resolve(pendingStore.delete(sessionId)).catch(async () => {
|
|
776
1282
|
await Promise.resolve(pendingStore.markOutcomeUnknown(sessionId)).catch(() => undefined);
|
|
777
1283
|
});
|
|
@@ -959,10 +1465,11 @@ function decodeListCursor(value) {
|
|
|
959
1465
|
throw new MachineSessionServiceInputError("cursor is invalid");
|
|
960
1466
|
}
|
|
961
1467
|
}
|
|
962
|
-
function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
1468
|
+
function snapshotPage(sessionId, items, pendingInputs, runtime, hasMore) {
|
|
963
1469
|
return {
|
|
964
1470
|
sessionId,
|
|
965
1471
|
items,
|
|
1472
|
+
pendingInputs,
|
|
966
1473
|
runtime,
|
|
967
1474
|
hasMore,
|
|
968
1475
|
...(hasMore && items.length > 0 ? { nextAfterId: items.at(-1).id } : {}),
|
|
@@ -970,10 +1477,10 @@ function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
|
970
1477
|
}
|
|
971
1478
|
/** Exact UTF-8 size of {@link snapshotPage} without repeatedly serializing the
|
|
972
1479
|
* complete item array while searching for a page boundary. */
|
|
973
|
-
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, runtime, hasMore) {
|
|
1480
|
+
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, pendingInputs, runtime, hasMore) {
|
|
974
1481
|
return Buffer.byteLength(`{"sessionId":${JSON.stringify(sessionId)},"items":[`, "utf8")
|
|
975
1482
|
+ itemsJsonBytes
|
|
976
|
-
+ Buffer.byteLength(`],"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
1483
|
+
+ Buffer.byteLength(`],"pendingInputs":${JSON.stringify(pendingInputs)},"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
977
1484
|
}
|
|
978
1485
|
function sessionSummary(id, meta, log, runtimeState, pendingState) {
|
|
979
1486
|
const createdAt = meta?.createdAt ?? timestampFromEpoch(log?.createdAt, "createdAt");
|
|
@@ -997,6 +1504,14 @@ function sessionSummary(id, meta, log, runtimeState, pendingState) {
|
|
|
997
1504
|
updatedAt: validTimestamp(updatedAt, "updatedAt"),
|
|
998
1505
|
};
|
|
999
1506
|
}
|
|
1507
|
+
function executionSettingsResult(execution) {
|
|
1508
|
+
return {
|
|
1509
|
+
provider: execution.provider,
|
|
1510
|
+
model: execution.model,
|
|
1511
|
+
reasoningEffort: execution.reasoningEffort,
|
|
1512
|
+
collaborationMode: execution.collaborationMode ?? null,
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1000
1515
|
function compareMetaRecency(left, right) {
|
|
1001
1516
|
const leftTime = validTimestamp(left.updatedAt ?? left.createdAt, "updatedAt");
|
|
1002
1517
|
const rightTime = validTimestamp(right.updatedAt ?? right.createdAt, "updatedAt");
|
|
@@ -1066,6 +1581,9 @@ function cancellableWatch(sessionId, iterator, signal) {
|
|
|
1066
1581
|
function cloneRuntimeSnapshot(snapshot) {
|
|
1067
1582
|
return {
|
|
1068
1583
|
status: snapshot.status,
|
|
1584
|
+
...(snapshot.backgroundTaskCount === undefined
|
|
1585
|
+
? {}
|
|
1586
|
+
: { backgroundTaskCount: snapshot.backgroundTaskCount }),
|
|
1069
1587
|
activeResponseIds: [...snapshot.activeResponseIds],
|
|
1070
1588
|
pendingInteractions: snapshot.pendingInteractions.map((pending) => ({
|
|
1071
1589
|
responseId: pending.responseId,
|
|
@@ -1073,6 +1591,125 @@ function cloneRuntimeSnapshot(snapshot) {
|
|
|
1073
1591
|
})),
|
|
1074
1592
|
};
|
|
1075
1593
|
}
|
|
1594
|
+
function sessionEventResponseId(event) {
|
|
1595
|
+
if ("responseId" in event && typeof event.responseId === "string")
|
|
1596
|
+
return event.responseId;
|
|
1597
|
+
if ("item" in event && event.item && typeof event.item.responseId === "string") {
|
|
1598
|
+
return event.item.responseId;
|
|
1599
|
+
}
|
|
1600
|
+
return undefined;
|
|
1601
|
+
}
|
|
1602
|
+
function sessionEventItemId(event) {
|
|
1603
|
+
return "item" in event && event.item && typeof event.item.id === "string"
|
|
1604
|
+
? event.item.id
|
|
1605
|
+
: undefined;
|
|
1606
|
+
}
|
|
1607
|
+
function responseIdForClearedPending(event, pendingId) {
|
|
1608
|
+
return event.type === "session.input.consumed" && event.clearedPendingId === pendingId
|
|
1609
|
+
? event.item.responseId
|
|
1610
|
+
: undefined;
|
|
1611
|
+
}
|
|
1612
|
+
function isTerminalResponseEvent(event) {
|
|
1613
|
+
return event.type === "response.completed" ||
|
|
1614
|
+
event.type === "response.failed" ||
|
|
1615
|
+
event.type === "session.interrupted";
|
|
1616
|
+
}
|
|
1617
|
+
function replaySessionItem(item) {
|
|
1618
|
+
if (item.type === "message" && item.data.role === "user") {
|
|
1619
|
+
return { type: "session.input.consumed", item };
|
|
1620
|
+
}
|
|
1621
|
+
if (item.type === "interaction_request") {
|
|
1622
|
+
return {
|
|
1623
|
+
type: "session.interaction.requested",
|
|
1624
|
+
sessionId: item.sessionId,
|
|
1625
|
+
responseId: item.responseId,
|
|
1626
|
+
interaction: item.data.interaction,
|
|
1627
|
+
item,
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
if (item.type === "interaction_resolution" &&
|
|
1631
|
+
item.data.status === "resolved" &&
|
|
1632
|
+
item.data.resolution) {
|
|
1633
|
+
return {
|
|
1634
|
+
type: "session.interaction.resolved",
|
|
1635
|
+
sessionId: item.sessionId,
|
|
1636
|
+
responseId: item.responseId,
|
|
1637
|
+
interactionId: item.data.interactionId,
|
|
1638
|
+
resolution: item.data.resolution,
|
|
1639
|
+
item,
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
if (item.type === "interaction_resolution" &&
|
|
1643
|
+
(item.data.status === "cancelled" || item.data.status === "expired")) {
|
|
1644
|
+
const reason = item.data.reason ?? (item.data.status === "expired" ? "expired" : undefined);
|
|
1645
|
+
return {
|
|
1646
|
+
type: "session.interaction.cancelled",
|
|
1647
|
+
sessionId: item.sessionId,
|
|
1648
|
+
responseId: item.responseId,
|
|
1649
|
+
interactionId: item.data.interactionId,
|
|
1650
|
+
...(reason ? { reason } : {}),
|
|
1651
|
+
item,
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
return { type: "response.output_item.done", responseId: item.responseId, item };
|
|
1655
|
+
}
|
|
1656
|
+
function normalizeRunExecutionSelection(value) {
|
|
1657
|
+
if (value === undefined)
|
|
1658
|
+
return undefined;
|
|
1659
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1660
|
+
throw new MachineSessionServiceInputError("execution must be an object");
|
|
1661
|
+
}
|
|
1662
|
+
if (Object.keys(value).some((key) => key !== "model" && key !== "reasoningEffort")) {
|
|
1663
|
+
throw new MachineSessionServiceInputError("execution has unknown fields");
|
|
1664
|
+
}
|
|
1665
|
+
const selection = {};
|
|
1666
|
+
if (Object.prototype.hasOwnProperty.call(value, "model")) {
|
|
1667
|
+
selection.model = value.model === null
|
|
1668
|
+
? null
|
|
1669
|
+
: validRequiredText(value.model, "execution.model");
|
|
1670
|
+
}
|
|
1671
|
+
if (Object.prototype.hasOwnProperty.call(value, "reasoningEffort")) {
|
|
1672
|
+
selection.reasoningEffort = value.reasoningEffort === null
|
|
1673
|
+
? null
|
|
1674
|
+
: validRequiredText(value.reasoningEffort, "execution.reasoningEffort");
|
|
1675
|
+
}
|
|
1676
|
+
return selection;
|
|
1677
|
+
}
|
|
1678
|
+
function abortReason(signal) {
|
|
1679
|
+
if (signal.reason instanceof Error)
|
|
1680
|
+
return signal.reason;
|
|
1681
|
+
const error = new Error("run was cancelled");
|
|
1682
|
+
error.name = "AbortError";
|
|
1683
|
+
return error;
|
|
1684
|
+
}
|
|
1685
|
+
function liveSessionFailureFrom(error) {
|
|
1686
|
+
if (!error || typeof error !== "object")
|
|
1687
|
+
return undefined;
|
|
1688
|
+
const candidate = error;
|
|
1689
|
+
if (typeof candidate.message !== "string" ||
|
|
1690
|
+
typeof candidate.code !== "string" ||
|
|
1691
|
+
typeof candidate.statusCode !== "number")
|
|
1692
|
+
return undefined;
|
|
1693
|
+
return {
|
|
1694
|
+
message: candidate.message,
|
|
1695
|
+
code: candidate.code,
|
|
1696
|
+
statusCode: candidate.statusCode,
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
/** Turn structured native mode failures into actionable, Provider-specific
|
|
1700
|
+
* messages before the Direct Runtime adapter crosses the process boundary.
|
|
1701
|
+
* Unstructured failures keep their original text and remain subject to the
|
|
1702
|
+
* adapter's normal redaction policy. */
|
|
1703
|
+
function collaborationModeFailureMessage(provider, failure, fallback) {
|
|
1704
|
+
const providerLabel = provider === "traex" ? "TraeX" : "Codex";
|
|
1705
|
+
if (failure?.code === "native_session_not_live") {
|
|
1706
|
+
return `No live ${providerLabel} runner is available. Reconnect this Session and try again.`;
|
|
1707
|
+
}
|
|
1708
|
+
if (failure?.code === "native_thread_not_ready") {
|
|
1709
|
+
return `${providerLabel} is still loading its native thread. Reconnect this Session and try again.`;
|
|
1710
|
+
}
|
|
1711
|
+
return failure?.message ?? fallback;
|
|
1712
|
+
}
|
|
1076
1713
|
function requestLimit(value, fallback, maximum, field) {
|
|
1077
1714
|
return value === undefined ? Math.min(fallback, maximum) : boundedInteger(value, 1, maximum, field);
|
|
1078
1715
|
}
|
|
@@ -1091,6 +1728,15 @@ function validOpaqueToken(value, field, maximum) {
|
|
|
1091
1728
|
}
|
|
1092
1729
|
return value;
|
|
1093
1730
|
}
|
|
1731
|
+
function validRequiredText(value, field) {
|
|
1732
|
+
if (typeof value !== "string" || value.trim().length === 0 || value.length > 512) {
|
|
1733
|
+
throw new MachineSessionServiceInputError(`${field} must be a non-empty string of at most 512 characters`);
|
|
1734
|
+
}
|
|
1735
|
+
if (/[\u0000-\u001f\u007f]/.test(value)) {
|
|
1736
|
+
throw new MachineSessionServiceInputError(`${field} contains invalid control characters`);
|
|
1737
|
+
}
|
|
1738
|
+
return value.trim();
|
|
1739
|
+
}
|
|
1094
1740
|
function validTimestamp(value, field) {
|
|
1095
1741
|
if (typeof value !== "string" || !Number.isFinite(Date.parse(value))) {
|
|
1096
1742
|
throw new MachineSessionServiceInputError(`${field} must be a valid timestamp`);
|
|
@@ -1103,6 +1749,54 @@ function timestampFromEpoch(value, field) {
|
|
|
1103
1749
|
}
|
|
1104
1750
|
return new Date(value).toISOString();
|
|
1105
1751
|
}
|
|
1752
|
+
function sessionFileVersion(path, fileStat) {
|
|
1753
|
+
return createHash("sha256")
|
|
1754
|
+
.update(`${path}\0${fileStat.dev}\0${fileStat.ino}\0${fileStat.size}\0${fileStat.mtimeMs}\0${fileStat.ctimeMs}`)
|
|
1755
|
+
.digest("hex");
|
|
1756
|
+
}
|
|
1757
|
+
function workspaceFileMediaType(path) {
|
|
1758
|
+
switch (extname(path).toLowerCase()) {
|
|
1759
|
+
case ".png": return "image/png";
|
|
1760
|
+
case ".jpg":
|
|
1761
|
+
case ".jpeg": return "image/jpeg";
|
|
1762
|
+
case ".webp": return "image/webp";
|
|
1763
|
+
case ".gif": return "image/gif";
|
|
1764
|
+
case ".svg": return "image/svg+xml";
|
|
1765
|
+
case ".pdf": return "application/pdf";
|
|
1766
|
+
case ".json": return "application/json";
|
|
1767
|
+
case ".html":
|
|
1768
|
+
case ".htm": return "text/html";
|
|
1769
|
+
case ".css": return "text/css";
|
|
1770
|
+
case ".js":
|
|
1771
|
+
case ".mjs":
|
|
1772
|
+
case ".cjs": return "text/javascript";
|
|
1773
|
+
case ".md":
|
|
1774
|
+
case ".mdx": return "text/markdown";
|
|
1775
|
+
case ".csv": return "text/csv";
|
|
1776
|
+
case ".tsv": return "text/tab-separated-values";
|
|
1777
|
+
case ".txt":
|
|
1778
|
+
case ".log":
|
|
1779
|
+
case ".ts":
|
|
1780
|
+
case ".tsx":
|
|
1781
|
+
case ".jsx":
|
|
1782
|
+
case ".py":
|
|
1783
|
+
case ".go":
|
|
1784
|
+
case ".rs":
|
|
1785
|
+
case ".java":
|
|
1786
|
+
case ".c":
|
|
1787
|
+
case ".cc":
|
|
1788
|
+
case ".cpp":
|
|
1789
|
+
case ".h":
|
|
1790
|
+
case ".hpp":
|
|
1791
|
+
case ".sh":
|
|
1792
|
+
case ".zsh":
|
|
1793
|
+
case ".bash":
|
|
1794
|
+
case ".yaml":
|
|
1795
|
+
case ".yml":
|
|
1796
|
+
case ".toml": return "text/plain";
|
|
1797
|
+
default: return "application/octet-stream";
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1106
1800
|
function jsonByteLength(value) {
|
|
1107
1801
|
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
1108
1802
|
}
|