@rynx-ai/server 0.1.11-beta.5 → 0.1.11-beta.51
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 +11 -5
- package/dist/control-api.js +699 -95
- 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 +12 -1
- package/dist/desktop-browser-host.js +110 -13
- package/dist/direct-runtime-server.js +187 -153
- package/dist/machine-session-service.d.ts +96 -15
- package/dist/machine-session-service.js +745 -115
- package/dist/remote-runtime-dispatcher.d.ts +2 -2
- package/dist/remote-runtime-dispatcher.js +39 -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 +67 -16
- package/dist/server.js +422 -55
- package/dist/session-browser-service.d.ts +50 -4
- package/dist/session-browser-service.js +232 -11
- package/dist/session-browser-surface-coordinator.d.ts +2 -0
- package/dist/session-browser-surface-coordinator.js +15 -0
- 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-B4mcMjmm.js +0 -1
- package/dist/control-web/assets/index-5n6D-i-c.css +0 -32
- package/dist/control-web/assets/index-D56JQ9oi.js +0 -709
- package/dist/control-web/assets/mermaid-GHXKKRXX-DnL0iDTi.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
|
/**
|
|
@@ -208,49 +220,87 @@ export class MachineSessionService {
|
|
|
208
220
|
}
|
|
209
221
|
return executionSettingsResult(meta.execution);
|
|
210
222
|
}
|
|
211
|
-
/** Replace
|
|
212
|
-
*
|
|
213
|
-
* next turn
|
|
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. */
|
|
214
228
|
async updateExecutionSettings(input) {
|
|
215
229
|
const sessionId = validOpaqueToken(input.sessionId, "sessionId", MAX_SESSION_ID_CHARS);
|
|
216
|
-
const modelId = validRequiredText(input.model, "model");
|
|
217
|
-
const meta = this.ports.registry.get(sessionId);
|
|
218
|
-
if (!meta) {
|
|
219
|
-
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
220
|
-
}
|
|
221
|
-
await this.assertNotForkReserved(sessionId);
|
|
222
|
-
const runtime = this.ports.runtimeState.snapshot(sessionId);
|
|
223
|
-
const pendingMessage = await this.ports.pendingMessages?.get(sessionId);
|
|
224
|
-
if (runtime.status !== "idle" ||
|
|
225
|
-
runtime.activeResponseIds.length > 0 ||
|
|
226
|
-
runtime.pendingInteractions.length > 0 ||
|
|
227
|
-
pendingMessage) {
|
|
228
|
-
throw new MachineSessionServiceFailure("failed_precondition", "Session must be idle before changing model settings");
|
|
229
|
-
}
|
|
230
|
-
const executionPort = this.requireExecution();
|
|
231
|
-
if (!executionPort.listModels) {
|
|
232
|
-
throw new MachineSessionServiceFailure("failed_precondition", "Runtime model catalog is unavailable");
|
|
233
|
-
}
|
|
234
|
-
const models = await executionPort.listModels(meta.execution.provider);
|
|
235
|
-
const model = models.find((candidate) => candidate.id === modelId);
|
|
236
|
-
if (!model) {
|
|
237
|
-
throw new MachineSessionServiceInputError(`model is not available for ${meta.execution.provider}`);
|
|
238
|
-
}
|
|
230
|
+
const modelId = input.model === null ? null : validRequiredText(input.model, "model");
|
|
239
231
|
const reasoningEffort = input.reasoningEffort === null
|
|
240
232
|
? null
|
|
241
233
|
: validRequiredText(input.reasoningEffort, "reasoningEffort");
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
+
}
|
|
245
254
|
}
|
|
255
|
+
const executionPort = this.requireExecution();
|
|
246
256
|
const nextExecution = {
|
|
247
257
|
...structuredClone(meta.execution),
|
|
248
|
-
model: model
|
|
249
|
-
reasoningEffort,
|
|
258
|
+
model: selection.model,
|
|
259
|
+
reasoningEffort: selection.reasoningEffort,
|
|
260
|
+
...(meta.execution.provider !== "claude" && collaborationMode !== undefined
|
|
261
|
+
? { collaborationMode }
|
|
262
|
+
: {}),
|
|
250
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
|
+
}
|
|
251
285
|
this.ports.registry.setExecution(sessionId, nextExecution);
|
|
252
|
-
|
|
253
|
-
|
|
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
|
+
});
|
|
254
304
|
}
|
|
255
305
|
/** Create target-owned Session identity from one Agent preset or direct Provider. */
|
|
256
306
|
async create(input) {
|
|
@@ -363,6 +413,11 @@ export class MachineSessionService {
|
|
|
363
413
|
if (input.kind === "fork" &&
|
|
364
414
|
existing.forkedFromSessionId === sourceSessionId)
|
|
365
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;
|
|
366
421
|
throw new MachineSessionServiceFailure("conflict", "target Session already exists");
|
|
367
422
|
}
|
|
368
423
|
const workspace = structuredClone(source.workspace);
|
|
@@ -456,8 +511,169 @@ export class MachineSessionService {
|
|
|
456
511
|
async sendMessage(sessionIdInput, messageInput) {
|
|
457
512
|
return this.withAdmission(() => this.sendMessageAdmitted(sessionIdInput, messageInput));
|
|
458
513
|
}
|
|
459
|
-
|
|
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) {
|
|
460
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);
|
|
461
677
|
await this.assertNotForkReserved(sessionId);
|
|
462
678
|
const request = typeof messageInput === "string"
|
|
463
679
|
? { message: messageInput }
|
|
@@ -473,7 +689,24 @@ export class MachineSessionService {
|
|
|
473
689
|
if (hasContent && (!Array.isArray(request.content) || request.content.length === 0)) {
|
|
474
690
|
throw new MachineSessionServiceInputError("content must be a non-empty array");
|
|
475
691
|
}
|
|
476
|
-
|
|
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;
|
|
477
710
|
const consoleMeta = meta?.source === "console" ? meta : undefined;
|
|
478
711
|
let prepared;
|
|
479
712
|
const needsPreparedOperation = hasContent || request.clientMessageId !== undefined;
|
|
@@ -489,14 +722,29 @@ export class MachineSessionService {
|
|
|
489
722
|
}
|
|
490
723
|
prepared = await resources.prepareInput(sessionId, hasContent
|
|
491
724
|
? request.content
|
|
492
|
-
: [{ type: "input_text", text: request.message }], request.clientMessageId);
|
|
725
|
+
: [{ type: "input_text", text: request.message }], request.clientMessageId, ...(requestedOperationExecution ? [requestedOperationExecution] : []));
|
|
493
726
|
if (prepared.operationState === "injecting" ||
|
|
494
727
|
prepared.operationState === "outcome_unknown") {
|
|
495
728
|
throw new MachineSessionServiceFailure("outcome_unknown", "message delivery outcome is unknown");
|
|
496
729
|
}
|
|
497
730
|
if (prepared.operationState === "injected" ||
|
|
498
731
|
prepared.operationState === "mirrored") {
|
|
499
|
-
|
|
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
|
+
};
|
|
500
748
|
}
|
|
501
749
|
}
|
|
502
750
|
else {
|
|
@@ -510,108 +758,139 @@ export class MachineSessionService {
|
|
|
510
758
|
title: request.message,
|
|
511
759
|
};
|
|
512
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
|
+
}
|
|
513
769
|
if (consoleMeta && !consoleMeta.title) {
|
|
514
770
|
this.ports.registry.setTitle(sessionId, synthesizeSessionTitle(prepared.title));
|
|
515
771
|
}
|
|
516
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
|
+
}
|
|
517
779
|
if (request.clientMessageId) {
|
|
518
780
|
await resources?.markMessageInjecting(sessionId, request.clientMessageId);
|
|
519
781
|
}
|
|
520
|
-
const responseId = this.ports.publishEvent ? `resp_${randomUUID()}` : undefined;
|
|
521
|
-
if (responseId) {
|
|
522
|
-
await this.ports.publishEvent(sessionId, {
|
|
523
|
-
type: "session.input.consumed",
|
|
524
|
-
item: {
|
|
525
|
-
id: newSessionItemId("message"),
|
|
526
|
-
sessionId,
|
|
527
|
-
position: 0,
|
|
528
|
-
responseId,
|
|
529
|
-
status: "completed",
|
|
530
|
-
createdAt: Date.now(),
|
|
531
|
-
type: "message",
|
|
532
|
-
data: {
|
|
533
|
-
role: "user",
|
|
534
|
-
content: prepared.input.content.map((part) => part.type === "text"
|
|
535
|
-
? { type: "input_text", text: part.text }
|
|
536
|
-
: { ...part.resource }),
|
|
537
|
-
},
|
|
538
|
-
},
|
|
539
|
-
});
|
|
540
|
-
await this.ports.publishEvent(sessionId, {
|
|
541
|
-
type: "session.status",
|
|
542
|
-
sessionId,
|
|
543
|
-
responseId,
|
|
544
|
-
status: "running",
|
|
545
|
-
statusKind: "startup",
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
const abandonResponseHandoff = responseId
|
|
549
|
-
? this.ports.runtimeState.beginResponseHandoff?.(sessionId, responseId)
|
|
550
|
-
: undefined;
|
|
551
|
-
const clearStartup = async (status) => {
|
|
552
|
-
if (!responseId)
|
|
553
|
-
return;
|
|
554
|
-
await this.ports.publishEvent(sessionId, {
|
|
555
|
-
type: "session.status",
|
|
556
|
-
sessionId,
|
|
557
|
-
responseId,
|
|
558
|
-
status,
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
782
|
let execution;
|
|
562
783
|
try {
|
|
563
784
|
execution = await this.ensureLiveSession(sessionId, meta);
|
|
564
785
|
}
|
|
565
786
|
catch (error) {
|
|
566
|
-
abandonResponseHandoff?.();
|
|
567
|
-
await clearStartup("idle");
|
|
568
787
|
if (request.clientMessageId) {
|
|
569
788
|
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, error instanceof Error ? error.message : String(error));
|
|
570
789
|
}
|
|
571
790
|
throw error;
|
|
572
791
|
}
|
|
573
|
-
|
|
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
|
+
};
|
|
574
811
|
try {
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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);
|
|
579
816
|
}
|
|
580
817
|
catch (error) {
|
|
581
|
-
|
|
582
|
-
|
|
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));
|
|
583
823
|
if (request.clientMessageId) {
|
|
584
|
-
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId,
|
|
824
|
+
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason)).catch(() => undefined);
|
|
585
825
|
}
|
|
586
|
-
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown");
|
|
826
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown", reason, failure);
|
|
587
827
|
}
|
|
828
|
+
const outcome = result.outcome;
|
|
588
829
|
if (outcome === "failed") {
|
|
589
|
-
|
|
590
|
-
|
|
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}`;
|
|
591
846
|
if (request.clientMessageId) {
|
|
592
|
-
await resources?.
|
|
847
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, reason);
|
|
593
848
|
}
|
|
594
|
-
throw new MachineSessionServiceFailure("
|
|
849
|
+
throw new MachineSessionServiceFailure("failed_precondition", `live injection ${outcome}`, reason, failure);
|
|
595
850
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
await
|
|
851
|
+
onTurnOwned?.();
|
|
852
|
+
if (signal?.aborted) {
|
|
853
|
+
await this.ports.interruption.interrupt(sessionId).catch(() => false);
|
|
599
854
|
if (request.clientMessageId) {
|
|
600
|
-
await resources?.
|
|
855
|
+
await Promise.resolve(resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined)).catch(() => undefined);
|
|
601
856
|
}
|
|
602
|
-
throw
|
|
857
|
+
throw abortReason(signal);
|
|
603
858
|
}
|
|
604
|
-
await clearStartup("running");
|
|
605
859
|
if (request.clientMessageId) {
|
|
606
860
|
try {
|
|
607
|
-
await resources?.markMessageInjected(sessionId, request.clientMessageId);
|
|
861
|
+
await resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined);
|
|
608
862
|
}
|
|
609
863
|
catch {
|
|
610
864
|
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, "message state could not be persisted after injection")).catch(() => undefined);
|
|
611
865
|
throw new MachineSessionServiceFailure("outcome_unknown", "message was injected but its delivery state could not be persisted");
|
|
612
866
|
}
|
|
613
867
|
}
|
|
614
|
-
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
|
+
}
|
|
615
894
|
}
|
|
616
895
|
resourcePolicy(sessionIdInput) {
|
|
617
896
|
const sessionId = this.requireResourceSession(sessionIdInput);
|
|
@@ -641,6 +920,62 @@ export class MachineSessionService {
|
|
|
641
920
|
const sessionId = this.requireResourceSession(input.sessionId);
|
|
642
921
|
return this.requireResources().deleteResource({ ...input, sessionId });
|
|
643
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
|
+
}
|
|
644
979
|
/** Persist the first task while login/onboarding owns the Provider TUI. The
|
|
645
980
|
* delivery worker starts the pane now, waits for a real native thread, then
|
|
646
981
|
* injects exactly once. `failed` is fenced as outcome_unknown and never retried. */
|
|
@@ -688,7 +1023,8 @@ export class MachineSessionService {
|
|
|
688
1023
|
request.execution.runner.ensureLiveSession.bind(request.execution.runner);
|
|
689
1024
|
const started = await start(sessionId, request.options);
|
|
690
1025
|
if (!started) {
|
|
691
|
-
|
|
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);
|
|
692
1028
|
}
|
|
693
1029
|
return { ok: true };
|
|
694
1030
|
}
|
|
@@ -696,7 +1032,8 @@ export class MachineSessionService {
|
|
|
696
1032
|
const request = await this.liveSessionRequest(sessionId, meta);
|
|
697
1033
|
const live = await request.execution.runner.ensureLiveSession(sessionId, request.options);
|
|
698
1034
|
if (!live) {
|
|
699
|
-
|
|
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);
|
|
700
1037
|
}
|
|
701
1038
|
return request.execution;
|
|
702
1039
|
}
|
|
@@ -727,9 +1064,22 @@ export class MachineSessionService {
|
|
|
727
1064
|
throw new MachineSessionServiceFailure("failed_precondition", "Session-owned resources could not be fenced before deletion", error instanceof Error ? error.message : String(error));
|
|
728
1065
|
}
|
|
729
1066
|
this.cancelledPendingDeliveries.add(sessionId);
|
|
730
|
-
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
|
+
}
|
|
731
1080
|
this.ports.events.close?.(sessionId);
|
|
732
1081
|
await this.ports.pendingMessages?.delete(sessionId);
|
|
1082
|
+
this.ports.pendingInputs?.deleteSession(sessionId);
|
|
733
1083
|
await this.ports.resources?.deleteSession(sessionId);
|
|
734
1084
|
this.ports.registry.remove(sessionId);
|
|
735
1085
|
await this.ports.log.deleteSession(sessionId);
|
|
@@ -743,6 +1093,114 @@ export class MachineSessionService {
|
|
|
743
1093
|
}
|
|
744
1094
|
return { ok: true };
|
|
745
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).catch(() => undefined);
|
|
1158
|
+
const requestedPath = isAbsolute(input.path)
|
|
1159
|
+
? input.path
|
|
1160
|
+
: resolve(workspaceRoot ?? session.workspace.cwd, input.path);
|
|
1161
|
+
const canonicalPath = await realpath(requestedPath);
|
|
1162
|
+
let allowed = false;
|
|
1163
|
+
for (const directory of new Set([session.workspace.cwd, ...session.workspace.allowedDirs])) {
|
|
1164
|
+
// An unavailable root, including cwd, must not hide files in other roots.
|
|
1165
|
+
const root = directory === session.workspace.cwd
|
|
1166
|
+
? workspaceRoot
|
|
1167
|
+
: await realpath(directory).catch(() => undefined);
|
|
1168
|
+
if (!root)
|
|
1169
|
+
continue;
|
|
1170
|
+
const workspaceRelative = relative(root, canonicalPath);
|
|
1171
|
+
if (workspaceRelative &&
|
|
1172
|
+
workspaceRelative !== ".." &&
|
|
1173
|
+
!workspaceRelative.startsWith(`..${sep}`) &&
|
|
1174
|
+
!isAbsolute(workspaceRelative)) {
|
|
1175
|
+
allowed = true;
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
if (!allowed) {
|
|
1180
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file was not found");
|
|
1181
|
+
}
|
|
1182
|
+
const fileStat = await stat(canonicalPath);
|
|
1183
|
+
if (!fileStat.isFile()) {
|
|
1184
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace path is not a file");
|
|
1185
|
+
}
|
|
1186
|
+
return {
|
|
1187
|
+
path: canonicalPath,
|
|
1188
|
+
metadata: {
|
|
1189
|
+
path: input.path,
|
|
1190
|
+
filename: basename(canonicalPath),
|
|
1191
|
+
mediaType: workspaceFileMediaType(canonicalPath),
|
|
1192
|
+
byteLength: fileStat.size,
|
|
1193
|
+
modifiedAt: Math.max(0, Math.trunc(fileStat.mtimeMs)),
|
|
1194
|
+
version: sessionFileVersion(canonicalPath, fileStat),
|
|
1195
|
+
},
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
catch (error) {
|
|
1199
|
+
if (error instanceof MachineSessionServiceFailure)
|
|
1200
|
+
throw error;
|
|
1201
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file is unavailable", error instanceof Error ? error.message : String(error));
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
746
1204
|
requireAgents() {
|
|
747
1205
|
if (!this.ports.agents) {
|
|
748
1206
|
throw new MachineSessionServiceFailure("failed_precondition", "session agent options are unavailable");
|
|
@@ -831,8 +1289,8 @@ export class MachineSessionService {
|
|
|
831
1289
|
current.message !== pending.message)
|
|
832
1290
|
return;
|
|
833
1291
|
injectionAttempted = true;
|
|
834
|
-
const outcome = await execution.runner.injectMessage(sessionId, pending.message);
|
|
835
|
-
if (outcome === "injected") {
|
|
1292
|
+
const { outcome } = await execution.runner.injectMessage(sessionId, pending.message);
|
|
1293
|
+
if (outcome === "injected" || outcome === "steered") {
|
|
836
1294
|
await Promise.resolve(pendingStore.delete(sessionId)).catch(async () => {
|
|
837
1295
|
await Promise.resolve(pendingStore.markOutcomeUnknown(sessionId)).catch(() => undefined);
|
|
838
1296
|
});
|
|
@@ -1020,10 +1478,11 @@ function decodeListCursor(value) {
|
|
|
1020
1478
|
throw new MachineSessionServiceInputError("cursor is invalid");
|
|
1021
1479
|
}
|
|
1022
1480
|
}
|
|
1023
|
-
function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
1481
|
+
function snapshotPage(sessionId, items, pendingInputs, runtime, hasMore) {
|
|
1024
1482
|
return {
|
|
1025
1483
|
sessionId,
|
|
1026
1484
|
items,
|
|
1485
|
+
pendingInputs,
|
|
1027
1486
|
runtime,
|
|
1028
1487
|
hasMore,
|
|
1029
1488
|
...(hasMore && items.length > 0 ? { nextAfterId: items.at(-1).id } : {}),
|
|
@@ -1031,10 +1490,10 @@ function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
|
1031
1490
|
}
|
|
1032
1491
|
/** Exact UTF-8 size of {@link snapshotPage} without repeatedly serializing the
|
|
1033
1492
|
* complete item array while searching for a page boundary. */
|
|
1034
|
-
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, runtime, hasMore) {
|
|
1493
|
+
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, pendingInputs, runtime, hasMore) {
|
|
1035
1494
|
return Buffer.byteLength(`{"sessionId":${JSON.stringify(sessionId)},"items":[`, "utf8")
|
|
1036
1495
|
+ itemsJsonBytes
|
|
1037
|
-
+ Buffer.byteLength(`],"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
1496
|
+
+ Buffer.byteLength(`],"pendingInputs":${JSON.stringify(pendingInputs)},"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
1038
1497
|
}
|
|
1039
1498
|
function sessionSummary(id, meta, log, runtimeState, pendingState) {
|
|
1040
1499
|
const createdAt = meta?.createdAt ?? timestampFromEpoch(log?.createdAt, "createdAt");
|
|
@@ -1063,6 +1522,7 @@ function executionSettingsResult(execution) {
|
|
|
1063
1522
|
provider: execution.provider,
|
|
1064
1523
|
model: execution.model,
|
|
1065
1524
|
reasoningEffort: execution.reasoningEffort,
|
|
1525
|
+
collaborationMode: execution.collaborationMode ?? null,
|
|
1066
1526
|
};
|
|
1067
1527
|
}
|
|
1068
1528
|
function compareMetaRecency(left, right) {
|
|
@@ -1134,6 +1594,9 @@ function cancellableWatch(sessionId, iterator, signal) {
|
|
|
1134
1594
|
function cloneRuntimeSnapshot(snapshot) {
|
|
1135
1595
|
return {
|
|
1136
1596
|
status: snapshot.status,
|
|
1597
|
+
...(snapshot.backgroundTaskCount === undefined
|
|
1598
|
+
? {}
|
|
1599
|
+
: { backgroundTaskCount: snapshot.backgroundTaskCount }),
|
|
1137
1600
|
activeResponseIds: [...snapshot.activeResponseIds],
|
|
1138
1601
|
pendingInteractions: snapshot.pendingInteractions.map((pending) => ({
|
|
1139
1602
|
responseId: pending.responseId,
|
|
@@ -1141,6 +1604,125 @@ function cloneRuntimeSnapshot(snapshot) {
|
|
|
1141
1604
|
})),
|
|
1142
1605
|
};
|
|
1143
1606
|
}
|
|
1607
|
+
function sessionEventResponseId(event) {
|
|
1608
|
+
if ("responseId" in event && typeof event.responseId === "string")
|
|
1609
|
+
return event.responseId;
|
|
1610
|
+
if ("item" in event && event.item && typeof event.item.responseId === "string") {
|
|
1611
|
+
return event.item.responseId;
|
|
1612
|
+
}
|
|
1613
|
+
return undefined;
|
|
1614
|
+
}
|
|
1615
|
+
function sessionEventItemId(event) {
|
|
1616
|
+
return "item" in event && event.item && typeof event.item.id === "string"
|
|
1617
|
+
? event.item.id
|
|
1618
|
+
: undefined;
|
|
1619
|
+
}
|
|
1620
|
+
function responseIdForClearedPending(event, pendingId) {
|
|
1621
|
+
return event.type === "session.input.consumed" && event.clearedPendingId === pendingId
|
|
1622
|
+
? event.item.responseId
|
|
1623
|
+
: undefined;
|
|
1624
|
+
}
|
|
1625
|
+
function isTerminalResponseEvent(event) {
|
|
1626
|
+
return event.type === "response.completed" ||
|
|
1627
|
+
event.type === "response.failed" ||
|
|
1628
|
+
event.type === "session.interrupted";
|
|
1629
|
+
}
|
|
1630
|
+
function replaySessionItem(item) {
|
|
1631
|
+
if (item.type === "message" && item.data.role === "user") {
|
|
1632
|
+
return { type: "session.input.consumed", item };
|
|
1633
|
+
}
|
|
1634
|
+
if (item.type === "interaction_request") {
|
|
1635
|
+
return {
|
|
1636
|
+
type: "session.interaction.requested",
|
|
1637
|
+
sessionId: item.sessionId,
|
|
1638
|
+
responseId: item.responseId,
|
|
1639
|
+
interaction: item.data.interaction,
|
|
1640
|
+
item,
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
if (item.type === "interaction_resolution" &&
|
|
1644
|
+
item.data.status === "resolved" &&
|
|
1645
|
+
item.data.resolution) {
|
|
1646
|
+
return {
|
|
1647
|
+
type: "session.interaction.resolved",
|
|
1648
|
+
sessionId: item.sessionId,
|
|
1649
|
+
responseId: item.responseId,
|
|
1650
|
+
interactionId: item.data.interactionId,
|
|
1651
|
+
resolution: item.data.resolution,
|
|
1652
|
+
item,
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
if (item.type === "interaction_resolution" &&
|
|
1656
|
+
(item.data.status === "cancelled" || item.data.status === "expired")) {
|
|
1657
|
+
const reason = item.data.reason ?? (item.data.status === "expired" ? "expired" : undefined);
|
|
1658
|
+
return {
|
|
1659
|
+
type: "session.interaction.cancelled",
|
|
1660
|
+
sessionId: item.sessionId,
|
|
1661
|
+
responseId: item.responseId,
|
|
1662
|
+
interactionId: item.data.interactionId,
|
|
1663
|
+
...(reason ? { reason } : {}),
|
|
1664
|
+
item,
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
return { type: "response.output_item.done", responseId: item.responseId, item };
|
|
1668
|
+
}
|
|
1669
|
+
function normalizeRunExecutionSelection(value) {
|
|
1670
|
+
if (value === undefined)
|
|
1671
|
+
return undefined;
|
|
1672
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1673
|
+
throw new MachineSessionServiceInputError("execution must be an object");
|
|
1674
|
+
}
|
|
1675
|
+
if (Object.keys(value).some((key) => key !== "model" && key !== "reasoningEffort")) {
|
|
1676
|
+
throw new MachineSessionServiceInputError("execution has unknown fields");
|
|
1677
|
+
}
|
|
1678
|
+
const selection = {};
|
|
1679
|
+
if (Object.prototype.hasOwnProperty.call(value, "model")) {
|
|
1680
|
+
selection.model = value.model === null
|
|
1681
|
+
? null
|
|
1682
|
+
: validRequiredText(value.model, "execution.model");
|
|
1683
|
+
}
|
|
1684
|
+
if (Object.prototype.hasOwnProperty.call(value, "reasoningEffort")) {
|
|
1685
|
+
selection.reasoningEffort = value.reasoningEffort === null
|
|
1686
|
+
? null
|
|
1687
|
+
: validRequiredText(value.reasoningEffort, "execution.reasoningEffort");
|
|
1688
|
+
}
|
|
1689
|
+
return selection;
|
|
1690
|
+
}
|
|
1691
|
+
function abortReason(signal) {
|
|
1692
|
+
if (signal.reason instanceof Error)
|
|
1693
|
+
return signal.reason;
|
|
1694
|
+
const error = new Error("run was cancelled");
|
|
1695
|
+
error.name = "AbortError";
|
|
1696
|
+
return error;
|
|
1697
|
+
}
|
|
1698
|
+
function liveSessionFailureFrom(error) {
|
|
1699
|
+
if (!error || typeof error !== "object")
|
|
1700
|
+
return undefined;
|
|
1701
|
+
const candidate = error;
|
|
1702
|
+
if (typeof candidate.message !== "string" ||
|
|
1703
|
+
typeof candidate.code !== "string" ||
|
|
1704
|
+
typeof candidate.statusCode !== "number")
|
|
1705
|
+
return undefined;
|
|
1706
|
+
return {
|
|
1707
|
+
message: candidate.message,
|
|
1708
|
+
code: candidate.code,
|
|
1709
|
+
statusCode: candidate.statusCode,
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
/** Turn structured native mode failures into actionable, Provider-specific
|
|
1713
|
+
* messages before the Direct Runtime adapter crosses the process boundary.
|
|
1714
|
+
* Unstructured failures keep their original text and remain subject to the
|
|
1715
|
+
* adapter's normal redaction policy. */
|
|
1716
|
+
function collaborationModeFailureMessage(provider, failure, fallback) {
|
|
1717
|
+
const providerLabel = provider === "traex" ? "TraeX" : "Codex";
|
|
1718
|
+
if (failure?.code === "native_session_not_live") {
|
|
1719
|
+
return `No live ${providerLabel} runner is available. Reconnect this Session and try again.`;
|
|
1720
|
+
}
|
|
1721
|
+
if (failure?.code === "native_thread_not_ready") {
|
|
1722
|
+
return `${providerLabel} is still loading its native thread. Reconnect this Session and try again.`;
|
|
1723
|
+
}
|
|
1724
|
+
return failure?.message ?? fallback;
|
|
1725
|
+
}
|
|
1144
1726
|
function requestLimit(value, fallback, maximum, field) {
|
|
1145
1727
|
return value === undefined ? Math.min(fallback, maximum) : boundedInteger(value, 1, maximum, field);
|
|
1146
1728
|
}
|
|
@@ -1180,6 +1762,54 @@ function timestampFromEpoch(value, field) {
|
|
|
1180
1762
|
}
|
|
1181
1763
|
return new Date(value).toISOString();
|
|
1182
1764
|
}
|
|
1765
|
+
function sessionFileVersion(path, fileStat) {
|
|
1766
|
+
return createHash("sha256")
|
|
1767
|
+
.update(`${path}\0${fileStat.dev}\0${fileStat.ino}\0${fileStat.size}\0${fileStat.mtimeMs}\0${fileStat.ctimeMs}`)
|
|
1768
|
+
.digest("hex");
|
|
1769
|
+
}
|
|
1770
|
+
function workspaceFileMediaType(path) {
|
|
1771
|
+
switch (extname(path).toLowerCase()) {
|
|
1772
|
+
case ".png": return "image/png";
|
|
1773
|
+
case ".jpg":
|
|
1774
|
+
case ".jpeg": return "image/jpeg";
|
|
1775
|
+
case ".webp": return "image/webp";
|
|
1776
|
+
case ".gif": return "image/gif";
|
|
1777
|
+
case ".svg": return "image/svg+xml";
|
|
1778
|
+
case ".pdf": return "application/pdf";
|
|
1779
|
+
case ".json": return "application/json";
|
|
1780
|
+
case ".html":
|
|
1781
|
+
case ".htm": return "text/html";
|
|
1782
|
+
case ".css": return "text/css";
|
|
1783
|
+
case ".js":
|
|
1784
|
+
case ".mjs":
|
|
1785
|
+
case ".cjs": return "text/javascript";
|
|
1786
|
+
case ".md":
|
|
1787
|
+
case ".mdx": return "text/markdown";
|
|
1788
|
+
case ".csv": return "text/csv";
|
|
1789
|
+
case ".tsv": return "text/tab-separated-values";
|
|
1790
|
+
case ".txt":
|
|
1791
|
+
case ".log":
|
|
1792
|
+
case ".ts":
|
|
1793
|
+
case ".tsx":
|
|
1794
|
+
case ".jsx":
|
|
1795
|
+
case ".py":
|
|
1796
|
+
case ".go":
|
|
1797
|
+
case ".rs":
|
|
1798
|
+
case ".java":
|
|
1799
|
+
case ".c":
|
|
1800
|
+
case ".cc":
|
|
1801
|
+
case ".cpp":
|
|
1802
|
+
case ".h":
|
|
1803
|
+
case ".hpp":
|
|
1804
|
+
case ".sh":
|
|
1805
|
+
case ".zsh":
|
|
1806
|
+
case ".bash":
|
|
1807
|
+
case ".yaml":
|
|
1808
|
+
case ".yml":
|
|
1809
|
+
case ".toml": return "text/plain";
|
|
1810
|
+
default: return "application/octet-stream";
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1183
1813
|
function jsonByteLength(value) {
|
|
1184
1814
|
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
1185
1815
|
}
|