@rynx-ai/server 0.1.11-beta.3 → 0.1.11-beta.31
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 +16 -4
- package/dist/control-api.js +713 -83
- 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-BdImnpbu.js +1 -0
- package/dist/control-web/assets/abnfDiagram-VRR7QNED-8c99_3I5.js +1 -0
- package/dist/control-web/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/control-web/assets/ada-bCR0ucgS.js +1 -0
- package/dist/control-web/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/control-web/assets/angular-html-CU67Zn6k.js +1 -0
- package/dist/control-web/assets/angular-ts-BwZT4LLn.js +1 -0
- package/dist/control-web/assets/apache-Pmp26Uib.js +1 -0
- package/dist/control-web/assets/apex-D8_7TLub.js +1 -0
- package/dist/control-web/assets/apl-dKokRX4l.js +1 -0
- package/dist/control-web/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/control-web/assets/ara-BRHolxvo.js +1 -0
- package/dist/control-web/assets/arc-FWW96Tzo.js +1 -0
- package/dist/control-web/assets/architectureDiagram-ZJ3FMSHR-B5FrqoRB.js +36 -0
- package/dist/control-web/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/control-web/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/control-web/assets/astro-CbQHKStN.js +1 -0
- package/dist/control-web/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/control-web/assets/awk-DMzUqQB5.js +1 -0
- package/dist/control-web/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/control-web/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/control-web/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/control-web/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/control-web/assets/bat-BkioyH1T.js +1 -0
- package/dist/control-web/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/control-web/assets/berry-uYugtg8r.js +1 -0
- package/dist/control-web/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/control-web/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/control-web/assets/bird2-DPOp833l.js +1 -0
- package/dist/control-web/assets/blade-D4QpJJKB.js +1 -0
- package/dist/control-web/assets/blockDiagram-677ZJIJ3-DJRwOGMa.js +132 -0
- package/dist/control-web/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/control-web/assets/c-BIGW1oBm.js +1 -0
- package/dist/control-web/assets/c3-eo99z4R2.js +1 -0
- package/dist/control-web/assets/c4Diagram-LMCZKHZV-B8FCUurl.js +10 -0
- package/dist/control-web/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/control-web/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/control-web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/control-web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/control-web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/control-web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/control-web/assets/channel-Bnyhn1Qs.js +1 -0
- package/dist/control-web/assets/chunk-2Q5K7J3B-DC5xexY2.js +1 -0
- package/dist/control-web/assets/chunk-32BRIVSS-DAzT69zb.js +1 -0
- package/dist/control-web/assets/chunk-5VM5RSS4-CXKpL77L.js +15 -0
- package/dist/control-web/assets/chunk-EX3LRPZG-DQKQvoPv.js +231 -0
- package/dist/control-web/assets/chunk-JWPE2WC7-CWMqpJoT.js +1 -0
- package/dist/control-web/assets/chunk-MOJQB5TN-Bd8jn7RZ.js +88 -0
- package/dist/control-web/assets/chunk-RYQCIY6F-DKXEMFO6.js +1 -0
- package/dist/control-web/assets/chunk-V7JOEXUC-BUDLq5nU.js +206 -0
- package/dist/control-web/assets/chunk-VR4S4FIN-C65l7VIz.js +1 -0
- package/dist/control-web/assets/chunk-XXDRQBXY-Y2498HkC.js +1 -0
- package/dist/control-web/assets/clarity-D53aC0YG.js +1 -0
- package/dist/control-web/assets/classDiagram-OUVF2IWQ-CBtXSdwW.js +1 -0
- package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-CBtXSdwW.js +1 -0
- package/dist/control-web/assets/clojure-P80f7IUj.js +1 -0
- package/dist/control-web/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/control-web/assets/cobol-nwyudZeR.js +1 -0
- package/dist/control-web/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/control-web/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/control-web/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/control-web/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/control-web/assets/coq-DkFqJrB1.js +1 -0
- package/dist/control-web/assets/cose-bilkent-JH36ORCC-C9aVXb8E.js +1 -0
- package/dist/control-web/assets/cpp-CofmeUqb.js +1 -0
- package/dist/control-web/assets/crystal-tKQVLTB8.js +1 -0
- package/dist/control-web/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/control-web/assets/css-DPfMkruS.js +1 -0
- package/dist/control-web/assets/csv-fuZLfV_i.js +1 -0
- package/dist/control-web/assets/cue-D82EKSYY.js +1 -0
- package/dist/control-web/assets/cynefin-VYW2F7L2-BsyMhvG0.js +178 -0
- package/dist/control-web/assets/cynefinDiagram-TSTJHNR4-DwY43f3-.js +62 -0
- package/dist/control-web/assets/cypher-COkxafJQ.js +1 -0
- package/dist/control-web/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
- package/dist/control-web/assets/d-85-TOEBH.js +1 -0
- package/dist/control-web/assets/dagre-VKFMJZFB-CP1xk7Ox.js +4 -0
- package/dist/control-web/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/control-web/assets/dart-CF10PKvl.js +1 -0
- package/dist/control-web/assets/dax-CEL-wOlO.js +1 -0
- package/dist/control-web/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/control-web/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/control-web/assets/diagram-FQU43EPY-D_yRnH1b.js +3 -0
- package/dist/control-web/assets/diagram-G47NLZAW-DpTmLmbm.js +24 -0
- package/dist/control-web/assets/diagram-NH7WQ7WH-Wh_P26Dr.js +24 -0
- package/dist/control-web/assets/diagram-OA4YK3LP-BMMaO78f.js +30 -0
- package/dist/control-web/assets/diagram-WEI45ONY-D8smty9F.js +41 -0
- package/dist/control-web/assets/diff-D97Zzqfu.js +1 -0
- package/dist/control-web/assets/docker-BcOcwvcX.js +1 -0
- package/dist/control-web/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/control-web/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/control-web/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/control-web/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/control-web/assets/ebnfDiagram-CCIWWBDH-BqVsmEYh.js +1 -0
- package/dist/control-web/assets/edge-BkV0erSs.js +1 -0
- package/dist/control-web/assets/elixir-CDX3lj18.js +1 -0
- package/dist/control-web/assets/elm-DbKCFpqz.js +1 -0
- package/dist/control-web/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/dist/control-web/assets/erDiagram-Q63AITRT-CxaumIzW.js +85 -0
- package/dist/control-web/assets/erb-B12qg9BL.js +1 -0
- package/dist/control-web/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/control-web/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/control-web/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/control-web/assets/fennel-BYunw83y.js +1 -0
- package/dist/control-web/assets/fish-BvzEVeQv.js +1 -0
- package/dist/control-web/assets/flowDiagram-23GEKE2U-DZhUBne-.js +156 -0
- package/dist/control-web/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/control-web/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/control-web/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/control-web/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/control-web/assets/ganttDiagram-NO4QXBWP-B20dY8SF.js +292 -0
- package/dist/control-web/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/control-web/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/control-web/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/control-web/assets/genie-D0YGMca9.js +1 -0
- package/dist/control-web/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/control-web/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/control-web/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/control-web/assets/gitGraphDiagram-IHSO6WYX-CAlnqFfW.js +106 -0
- package/dist/control-web/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/control-web/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/control-web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/control-web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/control-web/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/control-web/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/control-web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/control-web/assets/gleam-BspZqrRM.js +1 -0
- package/dist/control-web/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/dist/control-web/assets/glimmer-ts-U6CK756n.js +1 -0
- package/dist/control-web/assets/glsl-DplSGwfg.js +1 -0
- package/dist/control-web/assets/gn-n2N0HUVH.js +1 -0
- package/dist/control-web/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/control-web/assets/go-CxLEBnE3.js +1 -0
- package/dist/control-web/assets/graph-C9eacEi8.js +1 -0
- package/dist/control-web/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/control-web/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/control-web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/control-web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/control-web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/control-web/assets/hack-CaT9iCJl.js +1 -0
- package/dist/control-web/assets/haml-B8DHNrY2.js +1 -0
- package/dist/control-web/assets/handlebars-BL8al0AC.js +1 -0
- package/dist/control-web/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/control-web/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/control-web/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/control-web/assets/{highlighted-body-OFNGDK62-DWWsUtHF.js → highlighted-body-OFNGDK62-vBlGjC8F.js} +1 -1
- package/dist/control-web/assets/hjson-D5-asLiD.js +1 -0
- package/dist/control-web/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/control-web/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/control-web/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/dist/control-web/assets/houston-DnULxvSX.js +1 -0
- package/dist/control-web/assets/html-GMplVEZG.js +1 -0
- package/dist/control-web/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/dist/control-web/assets/http-jrhK8wxY.js +1 -0
- package/dist/control-web/assets/hurl-irOxFIW8.js +1 -0
- package/dist/control-web/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/control-web/assets/hy-DFXneXwc.js +1 -0
- package/dist/control-web/assets/imba-DGztddWO.js +1 -0
- package/dist/control-web/assets/index-B3g4Kfko.js +153 -0
- package/dist/control-web/assets/index-BKqZNg1a.js +718 -0
- package/dist/control-web/assets/index-CZrE_F_i.css +32 -0
- package/dist/control-web/assets/infoDiagram-FWYZ7A6U-PaEyeSke.js +2 -0
- package/dist/control-web/assets/ini-BEwlwnbL.js +1 -0
- package/dist/control-web/assets/init-Gi6I4Gst.js +1 -0
- package/dist/control-web/assets/ishikawaDiagram-FXEZZL3T-BwsgPXGC.js +70 -0
- package/dist/control-web/assets/java-CylS5w8V.js +1 -0
- package/dist/control-web/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/control-web/assets/jinja-4LBKfQ-Z.js +1 -0
- package/dist/control-web/assets/jison-wvAkD_A8.js +1 -0
- package/dist/control-web/assets/journeyDiagram-5HDEW3XC-BUEf1NEq.js +139 -0
- package/dist/control-web/assets/json-Cp-IABpG.js +1 -0
- package/dist/control-web/assets/json5-C9tS-k6U.js +1 -0
- package/dist/control-web/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/control-web/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/control-web/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/control-web/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/control-web/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/control-web/assets/julia-CxzCAyBv.js +1 -0
- package/dist/control-web/assets/just-Cw27pwNe.js +1 -0
- package/dist/control-web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/control-web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/control-web/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/control-web/assets/kanban-definition-HUTT4EX6-CiTCwnJ7.js +89 -0
- package/dist/control-web/assets/kdl-DV7GczEv.js +1 -0
- package/dist/control-web/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/control-web/assets/kusto-DZf3V79B.js +1 -0
- package/dist/control-web/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/control-web/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/control-web/assets/layout-DEXfKzaS.js +1 -0
- package/dist/control-web/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/control-web/assets/less-B1dDrJ26.js +1 -0
- package/dist/control-web/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/control-web/assets/linear-Cs4GSPvX.js +1 -0
- package/dist/control-web/assets/liquid-DYVedYrR.js +1 -0
- package/dist/control-web/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/control-web/assets/log-2UxHyX5q.js +1 -0
- package/dist/control-web/assets/logo-BtOb2qkB.js +1 -0
- package/dist/control-web/assets/lua-BaeVxFsk.js +1 -0
- package/dist/control-web/assets/luau-C-HG3fhB.js +1 -0
- package/dist/control-web/assets/make-CHLpvVh8.js +1 -0
- package/dist/control-web/assets/map-Czzmt4hB.js +1 -0
- package/dist/control-web/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/control-web/assets/marko-CnJfTvn9.js +1 -0
- package/dist/control-web/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/control-web/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/control-web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/control-web/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/control-web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/control-web/assets/matlab-D7o27uSR.js +1 -0
- package/dist/control-web/assets/mdc-BMNejdWA.js +1 -0
- package/dist/control-web/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-BYZTj3zW.css +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-C_lUqoOB.js +710 -0
- package/dist/control-web/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/control-web/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/control-web/assets/min-light-CTRr51gU.js +1 -0
- package/dist/control-web/assets/mindmap-definition-LN4V7U3C-B8TkylOR.js +96 -0
- package/dist/control-web/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/control-web/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/control-web/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/control-web/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/control-web/assets/move-IF9eRakj.js +1 -0
- package/dist/control-web/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/control-web/assets/nextflow-Zz6hmt5N.js +1 -0
- package/dist/control-web/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/dist/control-web/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/control-web/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/control-web/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/control-web/assets/nim-CVrawwO9.js +1 -0
- package/dist/control-web/assets/nix-CwoSXNpI.js +1 -0
- package/dist/control-web/assets/nord-Ddv68eIx.js +1 -0
- package/dist/control-web/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/control-web/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/control-web/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/control-web/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/control-web/assets/odin-BBf5iR-q.js +1 -0
- package/dist/control-web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/control-web/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/control-web/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/control-web/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/control-web/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/control-web/assets/pegDiagram-2B236MQR-Bnge_jzz.js +1 -0
- package/dist/control-web/assets/perl-C0TMdlhV.js +1 -0
- package/dist/control-web/assets/php-Dhbhpdrm.js +1 -0
- package/dist/control-web/assets/pieDiagram-ENE6RG2P-DOP7FAKG.js +39 -0
- package/dist/control-web/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/control-web/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/control-web/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/control-web/assets/po-BTJTHyun.js +1 -0
- package/dist/control-web/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/control-web/assets/polar-C0HS_06l.js +1 -0
- package/dist/control-web/assets/postcss-CXtECtnM.js +1 -0
- package/dist/control-web/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/control-web/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/control-web/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/control-web/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/control-web/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/control-web/assets/pug-CGlum2m_.js +1 -0
- package/dist/control-web/assets/puppet-BMWR74SV.js +1 -0
- package/dist/control-web/assets/purescript-CklMAg4u.js +1 -0
- package/dist/control-web/assets/python-B6aJPvgy.js +1 -0
- package/dist/control-web/assets/qml-3beO22l8.js +1 -0
- package/dist/control-web/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/control-web/assets/qss-IeuSbFQv.js +1 -0
- package/dist/control-web/assets/quadrantDiagram-ABIIQ3AL-Cqqu5uu-.js +7 -0
- package/dist/control-web/assets/r-Dspwwk_N.js +1 -0
- package/dist/control-web/assets/racket-BqYA7rlc.js +1 -0
- package/dist/control-web/assets/railroadDiagram-RFXS5EU6-1bk56BMW.js +1 -0
- package/dist/control-web/assets/raku-DXvB9xmW.js +1 -0
- package/dist/control-web/assets/razor-Uh8Bk_45.js +1 -0
- package/dist/control-web/assets/red-bN70gL4F.js +1 -0
- package/dist/control-web/assets/reg-C-SQnVFl.js +1 -0
- package/dist/control-web/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/control-web/assets/rel-C3B-1QV4.js +1 -0
- package/dist/control-web/assets/requirementDiagram-TGXJPOKE-BHVwG79A.js +84 -0
- package/dist/control-web/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/control-web/assets/ron-D8l8udqQ.js +1 -0
- package/dist/control-web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/control-web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/control-web/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/control-web/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/control-web/assets/rst-BrH8l1NY.js +1 -0
- package/dist/control-web/assets/ruby-Dw2BHqvy.js +1 -0
- package/dist/control-web/assets/rust-B1yitclQ.js +1 -0
- package/dist/control-web/assets/sankeyDiagram-HTMAVEWB-ghjBFqfs.js +40 -0
- package/dist/control-web/assets/sas-cz2c8ADy.js +1 -0
- package/dist/control-web/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/control-web/assets/scala-C151Ov-r.js +1 -0
- package/dist/control-web/assets/scheme-C98Dy4si.js +1 -0
- package/dist/control-web/assets/scss-OYdSNvt2.js +1 -0
- package/dist/control-web/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/control-web/assets/sequenceDiagram-DBY2YBRQ-DChtyqq5.js +162 -0
- package/dist/control-web/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/control-web/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/control-web/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/control-web/assets/sizeCapture-X5ZJPWSS-BNp94nCS.js +1 -0
- package/dist/control-web/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/control-web/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/control-web/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/control-web/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/control-web/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/control-web/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/control-web/assets/solidity-rGO070M0.js +1 -0
- package/dist/control-web/assets/soy-Brmx7dQM.js +1 -0
- package/dist/control-web/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/control-web/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/control-web/assets/sql-BLtJtn59.js +1 -0
- package/dist/control-web/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/control-web/assets/stata-BH5u7GGu.js +1 -0
- package/dist/control-web/assets/stateDiagram-2N3HPSRC-CaFYkZZ2.js +1 -0
- package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-CCvEZFYI.js +1 -0
- package/dist/control-web/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/control-web/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/control-web/assets/svelte-C_ipcX3V.js +1 -0
- package/dist/control-web/assets/swift-D82vCrfD.js +1 -0
- package/dist/control-web/assets/swimlanes-5IMT3BWC-CV2YWeYv.js +2 -0
- package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-BFAdJHEB.js +8 -0
- package/dist/control-web/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/control-web/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/control-web/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/control-web/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/control-web/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/control-web/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/control-web/assets/templ-P3uqSqPl.js +1 -0
- package/dist/control-web/assets/terraform-BETggiCN.js +1 -0
- package/dist/control-web/assets/tex-idrVyKtj.js +1 -0
- package/dist/control-web/assets/timeline-definition-FHXFAJF6-Cq32UWLH.js +120 -0
- package/dist/control-web/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/control-web/assets/toml-vGWfd6FD.js +1 -0
- package/dist/control-web/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/dist/control-web/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/control-web/assets/tsx-COt5Ahok.js +1 -0
- package/dist/control-web/assets/turtle-BsS91CYL.js +1 -0
- package/dist/control-web/assets/twig-DNn4PbVi.js +1 -0
- package/dist/control-web/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/control-web/assets/typespec-BGHnOYBU.js +1 -0
- package/dist/control-web/assets/typst-DHCkPAjA.js +1 -0
- package/dist/control-web/assets/v-BcVCzyr7.js +1 -0
- package/dist/control-web/assets/vala-CsfeWuGM.js +1 -0
- package/dist/control-web/assets/vb-D17OF-Vu.js +1 -0
- package/dist/control-web/assets/vennDiagram-L72KCM5P-BgBoqPth.js +34 -0
- package/dist/control-web/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/control-web/assets/vesper-DU1UobuO.js +1 -0
- package/dist/control-web/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/control-web/assets/viml-CJc9bBzg.js +1 -0
- package/dist/control-web/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/control-web/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/control-web/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/control-web/assets/vue-DN_0RTcg.js +1 -0
- package/dist/control-web/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/control-web/assets/vue-vine-CQOfvN7w.js +1 -0
- package/dist/control-web/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/control-web/assets/wardleyDiagram-EHGQE667-VsC2Gfpu.js +78 -0
- package/dist/control-web/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/control-web/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/control-web/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/control-web/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/control-web/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/control-web/assets/wit-5i3qLPDT.js +1 -0
- package/dist/control-web/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/control-web/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/control-web/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/control-web/assets/xychartDiagram-FW5EYKEG-CyFiAunt.js +7 -0
- package/dist/control-web/assets/yaml-Buea-lGh.js +1 -0
- package/dist/control-web/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/control-web/assets/zig-VOosw3JB.js +1 -0
- package/dist/control-web/index.html +2 -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/machine-session-service.d.ts +94 -15
- package/dist/machine-session-service.js +700 -86
- 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 +6 -0
- package/dist/server.d.ts +47 -8
- package/dist/server.js +291 -47
- package/dist/session-browser-service.d.ts +24 -4
- package/dist/session-browser-service.js +127 -1
- package/dist/session-pending-inputs.d.ts +40 -0
- package/dist/session-pending-inputs.js +84 -0
- package/dist/session-portal.d.ts +54 -0
- package/dist/session-portal.js +983 -0
- package/dist/session-runtime-index.d.ts +2 -6
- package/dist/session-runtime-index.js +70 -38
- package/dist/terminal-ws.js +8 -6
- package/package.json +7 -7
- 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,10 @@
|
|
|
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 { SESSION_PROVIDER_IDS, getRuntimeProfile, isSessionProviderId, newSessionId, normalizeSessionTitle, } from "@rynx-ai/core";
|
|
12
14
|
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
15
|
const DEFAULT_LIST_LIMIT = REMOTE_RUNTIME_SESSION_DEFAULT_PAGE_SIZE;
|
|
14
16
|
const MAX_LIST_LIMIT = REMOTE_RUNTIME_SESSION_MAX_PAGE_SIZE;
|
|
@@ -31,10 +33,12 @@ export class MachineSessionServiceInputError extends Error {
|
|
|
31
33
|
export class MachineSessionServiceFailure extends Error {
|
|
32
34
|
code;
|
|
33
35
|
detail;
|
|
34
|
-
|
|
36
|
+
runtimeFailure;
|
|
37
|
+
constructor(code, message, detail, runtimeFailure) {
|
|
35
38
|
super(message);
|
|
36
39
|
this.code = code;
|
|
37
40
|
this.detail = detail;
|
|
41
|
+
this.runtimeFailure = runtimeFailure;
|
|
38
42
|
this.name = "MachineSessionServiceFailure";
|
|
39
43
|
}
|
|
40
44
|
}
|
|
@@ -52,6 +56,7 @@ export class MachineSessionService {
|
|
|
52
56
|
pendingDeliveries = new Map();
|
|
53
57
|
cancelledPendingDeliveries = new Set();
|
|
54
58
|
forkTasks = new Map();
|
|
59
|
+
sessionMutationTails = new Map();
|
|
55
60
|
constructor(ports, options = {}) {
|
|
56
61
|
this.ports = ports;
|
|
57
62
|
this.maxListLimit = boundedInteger(options.maxListLimit ?? MAX_LIST_LIMIT, 1, MAX_LIST_LIMIT, "maxListLimit");
|
|
@@ -110,7 +115,8 @@ export class MachineSessionService {
|
|
|
110
115
|
limit: limit + 1,
|
|
111
116
|
})).slice(0, limit + 1).map((item) => structuredClone(item));
|
|
112
117
|
const runtime = cloneRuntimeSnapshot(this.ports.runtimeState.snapshot(sessionId));
|
|
113
|
-
const
|
|
118
|
+
const pendingInputs = this.ports.pendingInputs?.snapshotFor(sessionId) ?? [];
|
|
119
|
+
const empty = snapshotPage(sessionId, [], pendingInputs, runtime, false);
|
|
114
120
|
const items = [];
|
|
115
121
|
let itemsJsonBytes = 0;
|
|
116
122
|
for (const item of candidates.slice(0, limit)) {
|
|
@@ -118,14 +124,14 @@ export class MachineSessionService {
|
|
|
118
124
|
const nextCount = items.length + 1;
|
|
119
125
|
const hasMore = candidates.length > nextCount;
|
|
120
126
|
if (items.length > 0 &&
|
|
121
|
-
snapshotPageJsonByteLength(sessionId, nextItemsJsonBytes, item.id, runtime, hasMore) > this.snapshotPageMaxBytes) {
|
|
127
|
+
snapshotPageJsonByteLength(sessionId, nextItemsJsonBytes, item.id, pendingInputs, runtime, hasMore) > this.snapshotPageMaxBytes) {
|
|
122
128
|
break;
|
|
123
129
|
}
|
|
124
130
|
items.push(item);
|
|
125
131
|
itemsJsonBytes = nextItemsJsonBytes;
|
|
126
132
|
}
|
|
127
133
|
return items.length > 0
|
|
128
|
-
? snapshotPage(sessionId, items, runtime, candidates.length > items.length)
|
|
134
|
+
? snapshotPage(sessionId, items, pendingInputs, runtime, candidates.length > items.length)
|
|
129
135
|
: empty;
|
|
130
136
|
}
|
|
131
137
|
/**
|
|
@@ -159,11 +165,18 @@ export class MachineSessionService {
|
|
|
159
165
|
const statusCache = new Map();
|
|
160
166
|
const { agents } = await this.agentOptions();
|
|
161
167
|
const [providers, launchAgents] = await Promise.all([
|
|
162
|
-
Promise.all(SESSION_PROVIDER_IDS.map(async (provider) =>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
Promise.all(SESSION_PROVIDER_IDS.map(async (provider) => {
|
|
169
|
+
const execution = this.ports.execution;
|
|
170
|
+
const models = execution?.listModels
|
|
171
|
+
? await execution.listModels(provider).catch(() => [])
|
|
172
|
+
: undefined;
|
|
173
|
+
return {
|
|
174
|
+
id: provider,
|
|
175
|
+
name: getRuntimeProfile(provider).displayName,
|
|
176
|
+
...await this.runtimeReadiness(provider, statusCache),
|
|
177
|
+
...(models === undefined ? {} : { models }),
|
|
178
|
+
};
|
|
179
|
+
})),
|
|
167
180
|
Promise.all(agents.map(async (agent) => {
|
|
168
181
|
const execution = this.ports.execution;
|
|
169
182
|
if (!execution) {
|
|
@@ -192,6 +205,97 @@ export class MachineSessionService {
|
|
|
192
205
|
]);
|
|
193
206
|
return { providers, agents: launchAgents };
|
|
194
207
|
}
|
|
208
|
+
/** Read the effective model defaults used for the next turn. */
|
|
209
|
+
async executionSettings(sessionIdInput) {
|
|
210
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
211
|
+
const meta = this.ports.registry.get(sessionId);
|
|
212
|
+
if (!meta) {
|
|
213
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
214
|
+
}
|
|
215
|
+
return executionSettingsResult(meta.execution);
|
|
216
|
+
}
|
|
217
|
+
/** Replace the defaults for the next new Turn. Codex-lineage Providers keep
|
|
218
|
+
* their live runner: the host applies changed native thread settings under
|
|
219
|
+
* its injection lock immediately before the next `turn/start`. Claude still
|
|
220
|
+
* needs an idle cold resume because its live CLI has no confirmed settings
|
|
221
|
+
* update boundary. Provider CLIs own model availability validation. */
|
|
222
|
+
async updateExecutionSettings(input) {
|
|
223
|
+
const sessionId = validOpaqueToken(input.sessionId, "sessionId", MAX_SESSION_ID_CHARS);
|
|
224
|
+
const modelId = input.model === null ? null : validRequiredText(input.model, "model");
|
|
225
|
+
const reasoningEffort = input.reasoningEffort === null
|
|
226
|
+
? null
|
|
227
|
+
: validRequiredText(input.reasoningEffort, "reasoningEffort");
|
|
228
|
+
return this.withSessionMutation(sessionId, async () => {
|
|
229
|
+
const meta = this.ports.registry.get(sessionId);
|
|
230
|
+
if (!meta) {
|
|
231
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
232
|
+
}
|
|
233
|
+
await this.assertNotForkReserved(sessionId);
|
|
234
|
+
const nextExecution = await this.replaceExecutionSettings(sessionId, meta, { model: modelId, reasoningEffort }, input.collaborationMode);
|
|
235
|
+
return executionSettingsResult(nextExecution);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async replaceExecutionSettings(sessionId, meta, selection, collaborationMode) {
|
|
239
|
+
if (meta.execution.provider === "claude") {
|
|
240
|
+
const runtime = this.ports.runtimeState.snapshot(sessionId);
|
|
241
|
+
const pendingMessage = await this.ports.pendingMessages?.get(sessionId);
|
|
242
|
+
if (runtime.status !== "idle" ||
|
|
243
|
+
runtime.activeResponseIds.length > 0 ||
|
|
244
|
+
runtime.pendingInteractions.length > 0 ||
|
|
245
|
+
pendingMessage) {
|
|
246
|
+
throw new MachineSessionServiceFailure("failed_precondition", "Claude Session must be idle before changing model settings");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const executionPort = this.requireExecution();
|
|
250
|
+
const nextExecution = {
|
|
251
|
+
...structuredClone(meta.execution),
|
|
252
|
+
model: selection.model,
|
|
253
|
+
reasoningEffort: selection.reasoningEffort,
|
|
254
|
+
...(meta.execution.provider !== "claude" && collaborationMode !== undefined
|
|
255
|
+
? { collaborationMode }
|
|
256
|
+
: {}),
|
|
257
|
+
};
|
|
258
|
+
if (meta.execution.provider !== "claude" && collaborationMode !== undefined) {
|
|
259
|
+
const updateMode = executionPort.runner.updateCollaborationMode;
|
|
260
|
+
if (!updateMode) {
|
|
261
|
+
const message = "This Runtime does not support live collaboration-mode updates";
|
|
262
|
+
throw new MachineSessionServiceFailure("failed_precondition", message, message, {
|
|
263
|
+
message,
|
|
264
|
+
code: "collaboration_mode_unavailable",
|
|
265
|
+
statusCode: 409,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
// Native state is authoritative. Do not make a failed
|
|
269
|
+
// toggle survive reload when the loaded thread rejected it.
|
|
270
|
+
try {
|
|
271
|
+
await updateMode.call(executionPort.runner, sessionId, collaborationMode);
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
const failure = liveSessionFailureFrom(error);
|
|
275
|
+
const message = collaborationModeFailureMessage(meta.execution.provider, failure, error instanceof Error ? error.message : "Native collaboration mode update failed");
|
|
276
|
+
throw new MachineSessionServiceFailure("failed_precondition", message, message, failure ? { ...failure, message } : undefined);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
this.ports.registry.setExecution(sessionId, nextExecution);
|
|
280
|
+
if (nextExecution.provider === "claude") {
|
|
281
|
+
executionPort.runner.stopRunner(sessionId);
|
|
282
|
+
}
|
|
283
|
+
return nextExecution;
|
|
284
|
+
}
|
|
285
|
+
/** Persist a mode changed from the native TUI before its reflected event is
|
|
286
|
+
* fanned out to Web clients. Unknown/deleted and Claude Sessions are ignored. */
|
|
287
|
+
recordNativeCollaborationMode(sessionIdInput, mode) {
|
|
288
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
289
|
+
const meta = this.ports.registry.get(sessionId);
|
|
290
|
+
if (!meta || meta.execution.provider === "claude")
|
|
291
|
+
return;
|
|
292
|
+
if (meta.execution.collaborationMode === mode)
|
|
293
|
+
return;
|
|
294
|
+
this.ports.registry.setExecution(sessionId, {
|
|
295
|
+
...structuredClone(meta.execution),
|
|
296
|
+
collaborationMode: mode,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
195
299
|
/** Create target-owned Session identity from one Agent preset or direct Provider. */
|
|
196
300
|
async create(input) {
|
|
197
301
|
return this.withAdmission(() => this.createAdmitted(input));
|
|
@@ -223,6 +327,7 @@ export class MachineSessionService {
|
|
|
223
327
|
...target,
|
|
224
328
|
...(input.model === undefined ? {} : { model: input.model }),
|
|
225
329
|
...(input.reasoningEffort === undefined ? {} : { reasoningEffort: input.reasoningEffort }),
|
|
330
|
+
...(input.permissionPreset === undefined ? {} : { permissionPreset: input.permissionPreset }),
|
|
226
331
|
cwd: workspace.cwd,
|
|
227
332
|
});
|
|
228
333
|
const sessionId = newSessionId();
|
|
@@ -395,8 +500,122 @@ export class MachineSessionService {
|
|
|
395
500
|
async sendMessage(sessionIdInput, messageInput) {
|
|
396
501
|
return this.withAdmission(() => this.sendMessageAdmitted(sessionIdInput, messageInput));
|
|
397
502
|
}
|
|
398
|
-
|
|
503
|
+
/** Start a turn and return only that response's canonical event stream. */
|
|
504
|
+
async startRun(sessionIdInput, messageInput, options = {}) {
|
|
505
|
+
return this.withAdmission(async () => {
|
|
506
|
+
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
507
|
+
const meta = this.ports.registry.get(sessionId);
|
|
508
|
+
if (!meta)
|
|
509
|
+
throw new MachineSessionServiceFailure("not_found", "Session not found");
|
|
510
|
+
const subscription = this.ports.events.subscribe(sessionId)[Symbol.asyncIterator]();
|
|
511
|
+
let unsteer;
|
|
512
|
+
let ownsTurn = false;
|
|
513
|
+
const activateTurn = () => {
|
|
514
|
+
if (ownsTurn)
|
|
515
|
+
return;
|
|
516
|
+
ownsTurn = true;
|
|
517
|
+
if (!options.signal?.aborted) {
|
|
518
|
+
unsteer = options.steer?.subscribe((text) => {
|
|
519
|
+
void this.requireExecution().runner.injectMessage(sessionId, text);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
const interrupt = () => {
|
|
524
|
+
if (ownsTurn)
|
|
525
|
+
void this.ports.interruption.interrupt(sessionId);
|
|
526
|
+
};
|
|
527
|
+
try {
|
|
528
|
+
options.signal?.addEventListener("abort", interrupt, { once: true });
|
|
529
|
+
const result = await this.sendMessageAdmitted(sessionId, messageInput, options.signal, activateTurn, true, options.collaborationMode
|
|
530
|
+
? { collaborationMode: options.collaborationMode }
|
|
531
|
+
: undefined);
|
|
532
|
+
if (!result.responseId) {
|
|
533
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "run was already accepted but its response stream is unavailable");
|
|
534
|
+
}
|
|
535
|
+
const responseId = result.responseId;
|
|
536
|
+
const replayItems = result.replayed
|
|
537
|
+
? (await this.ports.log.snapshot(sessionId)).filter((item) => item.responseId === responseId)
|
|
538
|
+
: [];
|
|
539
|
+
const replayedItemIds = new Set(replayItems.map((item) => item.id));
|
|
540
|
+
const replayWasActive = this.ports.runtimeState
|
|
541
|
+
.snapshot(sessionId)
|
|
542
|
+
.activeResponseIds.includes(responseId);
|
|
543
|
+
if (result.replayed && !replayWasActive) {
|
|
544
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "run was already accepted but its terminal event is no longer available");
|
|
545
|
+
}
|
|
546
|
+
if (result.replayed) {
|
|
547
|
+
activateTurn();
|
|
548
|
+
if (options.signal?.aborted) {
|
|
549
|
+
await this.ports.interruption.interrupt(sessionId).catch(() => false);
|
|
550
|
+
throw abortReason(options.signal);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
const runExecution = result.operationExecution ?? {
|
|
554
|
+
model: meta.execution.model,
|
|
555
|
+
reasoningEffort: meta.execution.reasoningEffort,
|
|
556
|
+
};
|
|
557
|
+
const model = runExecution.model;
|
|
558
|
+
const generator = (async function* () {
|
|
559
|
+
try {
|
|
560
|
+
if (result.replayed) {
|
|
561
|
+
yield {
|
|
562
|
+
type: "response.created",
|
|
563
|
+
sessionId,
|
|
564
|
+
responseId,
|
|
565
|
+
model: model ?? "unknown",
|
|
566
|
+
};
|
|
567
|
+
for (const item of replayItems)
|
|
568
|
+
yield replaySessionItem(item);
|
|
569
|
+
}
|
|
570
|
+
while (true) {
|
|
571
|
+
const next = await subscription.next();
|
|
572
|
+
if (next.done)
|
|
573
|
+
return;
|
|
574
|
+
const event = next.value;
|
|
575
|
+
if (sessionEventResponseId(event) !== responseId)
|
|
576
|
+
continue;
|
|
577
|
+
const itemId = sessionEventItemId(event);
|
|
578
|
+
if (itemId && replayedItemIds.has(itemId))
|
|
579
|
+
continue;
|
|
580
|
+
yield event;
|
|
581
|
+
if (event.type === "response.completed" || event.type === "response.failed")
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
finally {
|
|
586
|
+
options.signal?.removeEventListener("abort", interrupt);
|
|
587
|
+
unsteer?.();
|
|
588
|
+
await subscription.return?.();
|
|
589
|
+
}
|
|
590
|
+
})();
|
|
591
|
+
const provider = meta.execution.provider;
|
|
592
|
+
return {
|
|
593
|
+
responseId,
|
|
594
|
+
provider,
|
|
595
|
+
model: runExecution.model,
|
|
596
|
+
authSource: provider === "traex"
|
|
597
|
+
? "traex_cli"
|
|
598
|
+
: provider === "claude"
|
|
599
|
+
? "claude_cli"
|
|
600
|
+
: "codex_cli",
|
|
601
|
+
generator,
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
catch (error) {
|
|
605
|
+
options.signal?.removeEventListener("abort", interrupt);
|
|
606
|
+
unsteer?.();
|
|
607
|
+
await subscription.return?.();
|
|
608
|
+
throw error;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
async sendMessageAdmitted(sessionIdInput, messageInput, signal, onTurnOwned, includeResponseId = false, turnOptions) {
|
|
399
613
|
const sessionId = validOpaqueToken(sessionIdInput, "sessionId", MAX_SESSION_ID_CHARS);
|
|
614
|
+
return this.withSessionMutation(sessionId, () => this.sendMessageAdmittedSerial(sessionId, messageInput, signal, onTurnOwned, includeResponseId, turnOptions));
|
|
615
|
+
}
|
|
616
|
+
async sendMessageAdmittedSerial(sessionId, messageInput, signal, onTurnOwned, includeResponseId = false, turnOptions) {
|
|
617
|
+
if (signal?.aborted)
|
|
618
|
+
throw abortReason(signal);
|
|
400
619
|
await this.assertNotForkReserved(sessionId);
|
|
401
620
|
const request = typeof messageInput === "string"
|
|
402
621
|
? { message: messageInput }
|
|
@@ -412,7 +631,24 @@ export class MachineSessionService {
|
|
|
412
631
|
if (hasContent && (!Array.isArray(request.content) || request.content.length === 0)) {
|
|
413
632
|
throw new MachineSessionServiceInputError("content must be a non-empty array");
|
|
414
633
|
}
|
|
415
|
-
|
|
634
|
+
let meta = this.ports.registry.get(sessionId);
|
|
635
|
+
const executionSelection = normalizeRunExecutionSelection(request.execution);
|
|
636
|
+
if (executionSelection && !meta) {
|
|
637
|
+
throw new MachineSessionServiceFailure("not_found", "session not found");
|
|
638
|
+
}
|
|
639
|
+
const requestedOperationExecution = executionSelection && meta
|
|
640
|
+
? {
|
|
641
|
+
selection: executionSelection,
|
|
642
|
+
snapshot: {
|
|
643
|
+
model: executionSelection.model !== undefined
|
|
644
|
+
? executionSelection.model
|
|
645
|
+
: meta.execution.model,
|
|
646
|
+
reasoningEffort: executionSelection.reasoningEffort !== undefined
|
|
647
|
+
? executionSelection.reasoningEffort
|
|
648
|
+
: meta.execution.reasoningEffort,
|
|
649
|
+
},
|
|
650
|
+
}
|
|
651
|
+
: undefined;
|
|
416
652
|
const consoleMeta = meta?.source === "console" ? meta : undefined;
|
|
417
653
|
let prepared;
|
|
418
654
|
const needsPreparedOperation = hasContent || request.clientMessageId !== undefined;
|
|
@@ -428,14 +664,29 @@ export class MachineSessionService {
|
|
|
428
664
|
}
|
|
429
665
|
prepared = await resources.prepareInput(sessionId, hasContent
|
|
430
666
|
? request.content
|
|
431
|
-
: [{ type: "input_text", text: request.message }], request.clientMessageId);
|
|
667
|
+
: [{ type: "input_text", text: request.message }], request.clientMessageId, ...(requestedOperationExecution ? [requestedOperationExecution] : []));
|
|
432
668
|
if (prepared.operationState === "injecting" ||
|
|
433
669
|
prepared.operationState === "outcome_unknown") {
|
|
434
670
|
throw new MachineSessionServiceFailure("outcome_unknown", "message delivery outcome is unknown");
|
|
435
671
|
}
|
|
436
672
|
if (prepared.operationState === "injected" ||
|
|
437
673
|
prepared.operationState === "mirrored") {
|
|
438
|
-
|
|
674
|
+
const replayPendingId = prepared.operationState === "injected" && request.clientMessageId
|
|
675
|
+
? this.ports.pendingInputs
|
|
676
|
+
?.findByClientMessageId(sessionId, request.clientMessageId)?.pendingId
|
|
677
|
+
: undefined;
|
|
678
|
+
return {
|
|
679
|
+
ok: true,
|
|
680
|
+
injected: true,
|
|
681
|
+
...(replayPendingId ? { pendingId: replayPendingId } : {}),
|
|
682
|
+
...(includeResponseId && prepared.responseId
|
|
683
|
+
? { responseId: prepared.responseId }
|
|
684
|
+
: {}),
|
|
685
|
+
...(prepared.operationExecution
|
|
686
|
+
? { operationExecution: prepared.operationExecution }
|
|
687
|
+
: {}),
|
|
688
|
+
replayed: true,
|
|
689
|
+
};
|
|
439
690
|
}
|
|
440
691
|
}
|
|
441
692
|
else {
|
|
@@ -449,108 +700,139 @@ export class MachineSessionService {
|
|
|
449
700
|
title: request.message,
|
|
450
701
|
};
|
|
451
702
|
}
|
|
703
|
+
const operationExecution = prepared.operationExecution ?? requestedOperationExecution?.snapshot;
|
|
704
|
+
if (operationExecution &&
|
|
705
|
+
meta &&
|
|
706
|
+
(operationExecution.model !== meta.execution.model ||
|
|
707
|
+
operationExecution.reasoningEffort !== meta.execution.reasoningEffort)) {
|
|
708
|
+
const nextExecution = await this.replaceExecutionSettings(sessionId, meta, operationExecution);
|
|
709
|
+
meta = { ...meta, execution: nextExecution };
|
|
710
|
+
}
|
|
452
711
|
if (consoleMeta && !consoleMeta.title) {
|
|
453
712
|
this.ports.registry.setTitle(sessionId, synthesizeSessionTitle(prepared.title));
|
|
454
713
|
}
|
|
455
714
|
const resources = this.ports.resources;
|
|
715
|
+
if (signal?.aborted) {
|
|
716
|
+
if (request.clientMessageId) {
|
|
717
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, "run was cancelled before injection");
|
|
718
|
+
}
|
|
719
|
+
throw abortReason(signal);
|
|
720
|
+
}
|
|
456
721
|
if (request.clientMessageId) {
|
|
457
722
|
await resources?.markMessageInjecting(sessionId, request.clientMessageId);
|
|
458
723
|
}
|
|
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
724
|
let execution;
|
|
501
725
|
try {
|
|
502
726
|
execution = await this.ensureLiveSession(sessionId, meta);
|
|
503
727
|
}
|
|
504
728
|
catch (error) {
|
|
505
|
-
abandonResponseHandoff?.();
|
|
506
|
-
await clearStartup("idle");
|
|
507
729
|
if (request.clientMessageId) {
|
|
508
730
|
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, error instanceof Error ? error.message : String(error));
|
|
509
731
|
}
|
|
510
732
|
throw error;
|
|
511
733
|
}
|
|
512
|
-
|
|
734
|
+
if (signal?.aborted) {
|
|
735
|
+
if (request.clientMessageId) {
|
|
736
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, "run was cancelled before injection");
|
|
737
|
+
}
|
|
738
|
+
throw abortReason(signal);
|
|
739
|
+
}
|
|
740
|
+
let result;
|
|
741
|
+
const pendingId = this.ports.pendingInputs && request.clientMessageId
|
|
742
|
+
? this.ports.pendingInputs.record(sessionId, {
|
|
743
|
+
clientMessageId: request.clientMessageId,
|
|
744
|
+
content: (hasContent
|
|
745
|
+
? request.content
|
|
746
|
+
: [{ type: "input_text", text: request.message }]).map((part) => ({ ...part })),
|
|
747
|
+
})
|
|
748
|
+
: undefined;
|
|
749
|
+
const rollbackPendingInput = () => {
|
|
750
|
+
if (pendingId)
|
|
751
|
+
this.ports.pendingInputs?.resolve(sessionId, pendingId);
|
|
752
|
+
};
|
|
513
753
|
try {
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
754
|
+
const injectionInput = needsPreparedOperation ? prepared.input : request.message;
|
|
755
|
+
result = turnOptions
|
|
756
|
+
? await execution.runner.injectMessage(sessionId, injectionInput, turnOptions)
|
|
757
|
+
: await execution.runner.injectMessage(sessionId, injectionInput);
|
|
518
758
|
}
|
|
519
759
|
catch (error) {
|
|
520
|
-
|
|
521
|
-
|
|
760
|
+
rollbackPendingInput();
|
|
761
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId)
|
|
762
|
+
?? liveSessionFailureFrom(error);
|
|
763
|
+
const reason = failure?.message
|
|
764
|
+
?? (error instanceof Error ? error.message : String(error));
|
|
522
765
|
if (request.clientMessageId) {
|
|
523
|
-
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId,
|
|
766
|
+
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason)).catch(() => undefined);
|
|
524
767
|
}
|
|
525
|
-
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown");
|
|
768
|
+
throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown", reason, failure);
|
|
526
769
|
}
|
|
770
|
+
const outcome = result.outcome;
|
|
527
771
|
if (outcome === "failed") {
|
|
528
|
-
|
|
529
|
-
|
|
772
|
+
rollbackPendingInput();
|
|
773
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
774
|
+
const reason = failure?.message
|
|
775
|
+
?? execution.runner.lastLiveSessionError?.(sessionId)
|
|
776
|
+
?? `live injection ${outcome}`;
|
|
530
777
|
if (request.clientMessageId) {
|
|
531
|
-
await resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId,
|
|
778
|
+
await resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason);
|
|
532
779
|
}
|
|
533
|
-
throw new MachineSessionServiceFailure("outcome_unknown", `live injection ${outcome}
|
|
780
|
+
throw new MachineSessionServiceFailure("outcome_unknown", `live injection ${outcome}`, reason, failure);
|
|
781
|
+
}
|
|
782
|
+
if (outcome !== "injected" && outcome !== "steered") {
|
|
783
|
+
rollbackPendingInput();
|
|
784
|
+
const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
785
|
+
const reason = failure?.message
|
|
786
|
+
?? execution.runner.lastLiveSessionError?.(sessionId)
|
|
787
|
+
?? `live injection ${outcome}`;
|
|
788
|
+
if (request.clientMessageId) {
|
|
789
|
+
await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, reason);
|
|
790
|
+
}
|
|
791
|
+
throw new MachineSessionServiceFailure("failed_precondition", `live injection ${outcome}`, reason, failure);
|
|
534
792
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
await
|
|
793
|
+
onTurnOwned?.();
|
|
794
|
+
if (signal?.aborted) {
|
|
795
|
+
await this.ports.interruption.interrupt(sessionId).catch(() => false);
|
|
538
796
|
if (request.clientMessageId) {
|
|
539
|
-
await resources?.
|
|
797
|
+
await Promise.resolve(resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined)).catch(() => undefined);
|
|
540
798
|
}
|
|
541
|
-
throw
|
|
799
|
+
throw abortReason(signal);
|
|
542
800
|
}
|
|
543
|
-
await clearStartup("running");
|
|
544
801
|
if (request.clientMessageId) {
|
|
545
802
|
try {
|
|
546
|
-
await resources?.markMessageInjected(sessionId, request.clientMessageId);
|
|
803
|
+
await resources?.markMessageInjected(sessionId, request.clientMessageId, result.responseId ? { responseId: result.responseId } : undefined);
|
|
547
804
|
}
|
|
548
805
|
catch {
|
|
549
806
|
await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, "message state could not be persisted after injection")).catch(() => undefined);
|
|
550
807
|
throw new MachineSessionServiceFailure("outcome_unknown", "message was injected but its delivery state could not be persisted");
|
|
551
808
|
}
|
|
552
809
|
}
|
|
553
|
-
return {
|
|
810
|
+
return {
|
|
811
|
+
ok: true,
|
|
812
|
+
injected: true,
|
|
813
|
+
...(pendingId ? { pendingId } : {}),
|
|
814
|
+
...(includeResponseId && result.responseId ? { responseId: result.responseId } : {}),
|
|
815
|
+
...(operationExecution ? { operationExecution } : {}),
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
async withSessionMutation(sessionId, action) {
|
|
819
|
+
const previous = this.sessionMutationTails.get(sessionId);
|
|
820
|
+
let release;
|
|
821
|
+
const tail = new Promise((resolve) => {
|
|
822
|
+
release = resolve;
|
|
823
|
+
});
|
|
824
|
+
this.sessionMutationTails.set(sessionId, tail);
|
|
825
|
+
if (previous)
|
|
826
|
+
await previous;
|
|
827
|
+
try {
|
|
828
|
+
return await action();
|
|
829
|
+
}
|
|
830
|
+
finally {
|
|
831
|
+
release();
|
|
832
|
+
if (this.sessionMutationTails.get(sessionId) === tail) {
|
|
833
|
+
this.sessionMutationTails.delete(sessionId);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
554
836
|
}
|
|
555
837
|
resourcePolicy(sessionIdInput) {
|
|
556
838
|
const sessionId = this.requireResourceSession(sessionIdInput);
|
|
@@ -580,6 +862,62 @@ export class MachineSessionService {
|
|
|
580
862
|
const sessionId = this.requireResourceSession(input.sessionId);
|
|
581
863
|
return this.requireResources().deleteResource({ ...input, sessionId });
|
|
582
864
|
}
|
|
865
|
+
async resolveResourcePath(sessionIdInput, resourceId) {
|
|
866
|
+
const sessionId = this.requireResourceSession(sessionIdInput);
|
|
867
|
+
const resolve = this.requireResources().resolveCommittedLocalPath;
|
|
868
|
+
if (!resolve) {
|
|
869
|
+
throw new MachineSessionServiceFailure("failed_precondition", "Session resource paths are unavailable");
|
|
870
|
+
}
|
|
871
|
+
return resolve.call(this.requireResources(), sessionId, resourceId);
|
|
872
|
+
}
|
|
873
|
+
async getFile(input) {
|
|
874
|
+
const resolved = await this.resolveSessionItemFile(input);
|
|
875
|
+
return { file: resolved.metadata };
|
|
876
|
+
}
|
|
877
|
+
async readFile(input) {
|
|
878
|
+
const resolved = await this.resolveSessionItemFile(input);
|
|
879
|
+
return this.readResolvedFile(resolved, input);
|
|
880
|
+
}
|
|
881
|
+
async getWorkspaceFile(input) {
|
|
882
|
+
const resolved = await this.resolveSessionWorkspaceFile(input);
|
|
883
|
+
return { file: resolved.metadata };
|
|
884
|
+
}
|
|
885
|
+
async readWorkspaceFile(input) {
|
|
886
|
+
const resolved = await this.resolveSessionWorkspaceFile(input);
|
|
887
|
+
return this.readResolvedFile(resolved, input);
|
|
888
|
+
}
|
|
889
|
+
async readResolvedFile(resolved, input) {
|
|
890
|
+
if (resolved.metadata.version !== input.version) {
|
|
891
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
892
|
+
}
|
|
893
|
+
if (input.offset >= resolved.metadata.byteLength) {
|
|
894
|
+
return { data: "", offset: input.offset, eof: true };
|
|
895
|
+
}
|
|
896
|
+
const length = Math.min(input.length, resolved.metadata.byteLength - input.offset);
|
|
897
|
+
const file = await open(resolved.path, "r");
|
|
898
|
+
try {
|
|
899
|
+
const openedStat = await file.stat();
|
|
900
|
+
if (!openedStat.isFile() ||
|
|
901
|
+
sessionFileVersion(resolved.path, openedStat) !== resolved.metadata.version) {
|
|
902
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
903
|
+
}
|
|
904
|
+
const buffer = Buffer.allocUnsafe(length);
|
|
905
|
+
const { bytesRead } = await file.read(buffer, 0, length, input.offset);
|
|
906
|
+
const completedStat = await file.stat();
|
|
907
|
+
if (sessionFileVersion(resolved.path, completedStat) !== resolved.metadata.version) {
|
|
908
|
+
throw new MachineSessionServiceFailure("conflict", "Session file changed while it was being read");
|
|
909
|
+
}
|
|
910
|
+
const nextOffset = input.offset + bytesRead;
|
|
911
|
+
return {
|
|
912
|
+
data: buffer.subarray(0, bytesRead).toString("base64"),
|
|
913
|
+
offset: nextOffset,
|
|
914
|
+
eof: nextOffset >= resolved.metadata.byteLength,
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
finally {
|
|
918
|
+
await file.close();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
583
921
|
/** Persist the first task while login/onboarding owns the Provider TUI. The
|
|
584
922
|
* delivery worker starts the pane now, waits for a real native thread, then
|
|
585
923
|
* injects exactly once. `failed` is fenced as outcome_unknown and never retried. */
|
|
@@ -627,7 +965,8 @@ export class MachineSessionService {
|
|
|
627
965
|
request.execution.runner.ensureLiveSession.bind(request.execution.runner);
|
|
628
966
|
const started = await start(sessionId, request.options);
|
|
629
967
|
if (!started) {
|
|
630
|
-
|
|
968
|
+
const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
969
|
+
throw new MachineSessionServiceFailure("failed_precondition", `Provider terminal unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
|
|
631
970
|
}
|
|
632
971
|
return { ok: true };
|
|
633
972
|
}
|
|
@@ -635,7 +974,8 @@ export class MachineSessionService {
|
|
|
635
974
|
const request = await this.liveSessionRequest(sessionId, meta);
|
|
636
975
|
const live = await request.execution.runner.ensureLiveSession(sessionId, request.options);
|
|
637
976
|
if (!live) {
|
|
638
|
-
|
|
977
|
+
const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
|
|
978
|
+
throw new MachineSessionServiceFailure("failed_precondition", `live session unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
|
|
639
979
|
}
|
|
640
980
|
return request.execution;
|
|
641
981
|
}
|
|
@@ -669,6 +1009,7 @@ export class MachineSessionService {
|
|
|
669
1009
|
this.ports.execution?.runner.stopRunner(sessionId);
|
|
670
1010
|
this.ports.events.close?.(sessionId);
|
|
671
1011
|
await this.ports.pendingMessages?.delete(sessionId);
|
|
1012
|
+
this.ports.pendingInputs?.deleteSession(sessionId);
|
|
672
1013
|
await this.ports.resources?.deleteSession(sessionId);
|
|
673
1014
|
this.ports.registry.remove(sessionId);
|
|
674
1015
|
await this.ports.log.deleteSession(sessionId);
|
|
@@ -682,6 +1023,101 @@ export class MachineSessionService {
|
|
|
682
1023
|
}
|
|
683
1024
|
return { ok: true };
|
|
684
1025
|
}
|
|
1026
|
+
async resolveSessionItemFile(input) {
|
|
1027
|
+
const sessionId = this.requireResourceSession(input.sessionId);
|
|
1028
|
+
const item = await this.ports.log.get(sessionId, input.itemId);
|
|
1029
|
+
if (!item) {
|
|
1030
|
+
throw new MachineSessionServiceFailure("not_found", "Session item was not found");
|
|
1031
|
+
}
|
|
1032
|
+
let reference;
|
|
1033
|
+
let type;
|
|
1034
|
+
if (item.type === "message" && item.data.role === "user") {
|
|
1035
|
+
const part = item.data.content[input.partIndex];
|
|
1036
|
+
if (!part || (part.type !== "input_image" && part.type !== "input_file")) {
|
|
1037
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1038
|
+
}
|
|
1039
|
+
reference = part;
|
|
1040
|
+
type = part.type;
|
|
1041
|
+
}
|
|
1042
|
+
else if (item.type === "function_call_output" && input.partIndex === 0) {
|
|
1043
|
+
if (!item.data.generatedImage) {
|
|
1044
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1045
|
+
}
|
|
1046
|
+
reference = item.data.generatedImage;
|
|
1047
|
+
type = "generated_image";
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file was not found");
|
|
1051
|
+
}
|
|
1052
|
+
if (!("path" in reference) || !reference.path || !isAbsolute(reference.path)) {
|
|
1053
|
+
throw new MachineSessionServiceFailure("not_found", "Session item is not path-backed");
|
|
1054
|
+
}
|
|
1055
|
+
try {
|
|
1056
|
+
const canonicalPath = await realpath(reference.path);
|
|
1057
|
+
const fileStat = await stat(canonicalPath);
|
|
1058
|
+
if (!fileStat.isFile() || fileStat.size < 1) {
|
|
1059
|
+
throw new MachineSessionServiceFailure("not_found", "Session item path is not a file");
|
|
1060
|
+
}
|
|
1061
|
+
const modifiedAt = Math.max(0, Math.trunc(fileStat.mtimeMs));
|
|
1062
|
+
const version = sessionFileVersion(canonicalPath, fileStat);
|
|
1063
|
+
return {
|
|
1064
|
+
path: canonicalPath,
|
|
1065
|
+
metadata: {
|
|
1066
|
+
itemId: item.id,
|
|
1067
|
+
partIndex: input.partIndex,
|
|
1068
|
+
type,
|
|
1069
|
+
filename: reference.filename || basename(canonicalPath),
|
|
1070
|
+
mediaType: reference.mediaType,
|
|
1071
|
+
byteLength: fileStat.size,
|
|
1072
|
+
modifiedAt,
|
|
1073
|
+
version,
|
|
1074
|
+
},
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
catch (error) {
|
|
1078
|
+
if (error instanceof MachineSessionServiceFailure)
|
|
1079
|
+
throw error;
|
|
1080
|
+
throw new MachineSessionServiceFailure("not_found", "Session item file is unavailable", error instanceof Error ? error.message : String(error));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
async resolveSessionWorkspaceFile(input) {
|
|
1084
|
+
const sessionId = this.requireResourceSession(input.sessionId);
|
|
1085
|
+
const session = this.ports.registry.get(sessionId);
|
|
1086
|
+
try {
|
|
1087
|
+
const workspaceRoot = await realpath(session.workspace.cwd);
|
|
1088
|
+
const requestedPath = isAbsolute(input.path)
|
|
1089
|
+
? input.path
|
|
1090
|
+
: resolve(workspaceRoot, input.path);
|
|
1091
|
+
const canonicalPath = await realpath(requestedPath);
|
|
1092
|
+
const workspaceRelative = relative(workspaceRoot, canonicalPath);
|
|
1093
|
+
if (!workspaceRelative ||
|
|
1094
|
+
workspaceRelative === ".." ||
|
|
1095
|
+
workspaceRelative.startsWith(`..${sep}`) ||
|
|
1096
|
+
isAbsolute(workspaceRelative)) {
|
|
1097
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file was not found");
|
|
1098
|
+
}
|
|
1099
|
+
const fileStat = await stat(canonicalPath);
|
|
1100
|
+
if (!fileStat.isFile()) {
|
|
1101
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace path is not a file");
|
|
1102
|
+
}
|
|
1103
|
+
return {
|
|
1104
|
+
path: canonicalPath,
|
|
1105
|
+
metadata: {
|
|
1106
|
+
path: input.path,
|
|
1107
|
+
filename: basename(canonicalPath),
|
|
1108
|
+
mediaType: workspaceFileMediaType(canonicalPath),
|
|
1109
|
+
byteLength: fileStat.size,
|
|
1110
|
+
modifiedAt: Math.max(0, Math.trunc(fileStat.mtimeMs)),
|
|
1111
|
+
version: sessionFileVersion(canonicalPath, fileStat),
|
|
1112
|
+
},
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
catch (error) {
|
|
1116
|
+
if (error instanceof MachineSessionServiceFailure)
|
|
1117
|
+
throw error;
|
|
1118
|
+
throw new MachineSessionServiceFailure("not_found", "Session workspace file is unavailable", error instanceof Error ? error.message : String(error));
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
685
1121
|
requireAgents() {
|
|
686
1122
|
if (!this.ports.agents) {
|
|
687
1123
|
throw new MachineSessionServiceFailure("failed_precondition", "session agent options are unavailable");
|
|
@@ -770,8 +1206,8 @@ export class MachineSessionService {
|
|
|
770
1206
|
current.message !== pending.message)
|
|
771
1207
|
return;
|
|
772
1208
|
injectionAttempted = true;
|
|
773
|
-
const outcome = await execution.runner.injectMessage(sessionId, pending.message);
|
|
774
|
-
if (outcome === "injected") {
|
|
1209
|
+
const { outcome } = await execution.runner.injectMessage(sessionId, pending.message);
|
|
1210
|
+
if (outcome === "injected" || outcome === "steered") {
|
|
775
1211
|
await Promise.resolve(pendingStore.delete(sessionId)).catch(async () => {
|
|
776
1212
|
await Promise.resolve(pendingStore.markOutcomeUnknown(sessionId)).catch(() => undefined);
|
|
777
1213
|
});
|
|
@@ -959,10 +1395,11 @@ function decodeListCursor(value) {
|
|
|
959
1395
|
throw new MachineSessionServiceInputError("cursor is invalid");
|
|
960
1396
|
}
|
|
961
1397
|
}
|
|
962
|
-
function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
1398
|
+
function snapshotPage(sessionId, items, pendingInputs, runtime, hasMore) {
|
|
963
1399
|
return {
|
|
964
1400
|
sessionId,
|
|
965
1401
|
items,
|
|
1402
|
+
pendingInputs,
|
|
966
1403
|
runtime,
|
|
967
1404
|
hasMore,
|
|
968
1405
|
...(hasMore && items.length > 0 ? { nextAfterId: items.at(-1).id } : {}),
|
|
@@ -970,10 +1407,10 @@ function snapshotPage(sessionId, items, runtime, hasMore) {
|
|
|
970
1407
|
}
|
|
971
1408
|
/** Exact UTF-8 size of {@link snapshotPage} without repeatedly serializing the
|
|
972
1409
|
* complete item array while searching for a page boundary. */
|
|
973
|
-
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, runtime, hasMore) {
|
|
1410
|
+
function snapshotPageJsonByteLength(sessionId, itemsJsonBytes, finalItemId, pendingInputs, runtime, hasMore) {
|
|
974
1411
|
return Buffer.byteLength(`{"sessionId":${JSON.stringify(sessionId)},"items":[`, "utf8")
|
|
975
1412
|
+ itemsJsonBytes
|
|
976
|
-
+ Buffer.byteLength(`],"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
1413
|
+
+ Buffer.byteLength(`],"pendingInputs":${JSON.stringify(pendingInputs)},"runtime":${JSON.stringify(runtime)},"hasMore":${hasMore}${hasMore ? `,"nextAfterId":${JSON.stringify(finalItemId)}` : ""}}`, "utf8");
|
|
977
1414
|
}
|
|
978
1415
|
function sessionSummary(id, meta, log, runtimeState, pendingState) {
|
|
979
1416
|
const createdAt = meta?.createdAt ?? timestampFromEpoch(log?.createdAt, "createdAt");
|
|
@@ -997,6 +1434,14 @@ function sessionSummary(id, meta, log, runtimeState, pendingState) {
|
|
|
997
1434
|
updatedAt: validTimestamp(updatedAt, "updatedAt"),
|
|
998
1435
|
};
|
|
999
1436
|
}
|
|
1437
|
+
function executionSettingsResult(execution) {
|
|
1438
|
+
return {
|
|
1439
|
+
provider: execution.provider,
|
|
1440
|
+
model: execution.model,
|
|
1441
|
+
reasoningEffort: execution.reasoningEffort,
|
|
1442
|
+
collaborationMode: execution.collaborationMode ?? null,
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1000
1445
|
function compareMetaRecency(left, right) {
|
|
1001
1446
|
const leftTime = validTimestamp(left.updatedAt ?? left.createdAt, "updatedAt");
|
|
1002
1447
|
const rightTime = validTimestamp(right.updatedAt ?? right.createdAt, "updatedAt");
|
|
@@ -1066,6 +1511,9 @@ function cancellableWatch(sessionId, iterator, signal) {
|
|
|
1066
1511
|
function cloneRuntimeSnapshot(snapshot) {
|
|
1067
1512
|
return {
|
|
1068
1513
|
status: snapshot.status,
|
|
1514
|
+
...(snapshot.backgroundTaskCount === undefined
|
|
1515
|
+
? {}
|
|
1516
|
+
: { backgroundTaskCount: snapshot.backgroundTaskCount }),
|
|
1069
1517
|
activeResponseIds: [...snapshot.activeResponseIds],
|
|
1070
1518
|
pendingInteractions: snapshot.pendingInteractions.map((pending) => ({
|
|
1071
1519
|
responseId: pending.responseId,
|
|
@@ -1073,6 +1521,115 @@ function cloneRuntimeSnapshot(snapshot) {
|
|
|
1073
1521
|
})),
|
|
1074
1522
|
};
|
|
1075
1523
|
}
|
|
1524
|
+
function sessionEventResponseId(event) {
|
|
1525
|
+
if ("responseId" in event && typeof event.responseId === "string")
|
|
1526
|
+
return event.responseId;
|
|
1527
|
+
if ("item" in event && event.item && typeof event.item.responseId === "string") {
|
|
1528
|
+
return event.item.responseId;
|
|
1529
|
+
}
|
|
1530
|
+
return undefined;
|
|
1531
|
+
}
|
|
1532
|
+
function sessionEventItemId(event) {
|
|
1533
|
+
return "item" in event && event.item && typeof event.item.id === "string"
|
|
1534
|
+
? event.item.id
|
|
1535
|
+
: undefined;
|
|
1536
|
+
}
|
|
1537
|
+
function replaySessionItem(item) {
|
|
1538
|
+
if (item.type === "message" && item.data.role === "user") {
|
|
1539
|
+
return { type: "session.input.consumed", item };
|
|
1540
|
+
}
|
|
1541
|
+
if (item.type === "interaction_request") {
|
|
1542
|
+
return {
|
|
1543
|
+
type: "session.interaction.requested",
|
|
1544
|
+
sessionId: item.sessionId,
|
|
1545
|
+
responseId: item.responseId,
|
|
1546
|
+
interaction: item.data.interaction,
|
|
1547
|
+
item,
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
if (item.type === "interaction_resolution" &&
|
|
1551
|
+
item.data.status === "resolved" &&
|
|
1552
|
+
item.data.resolution) {
|
|
1553
|
+
return {
|
|
1554
|
+
type: "session.interaction.resolved",
|
|
1555
|
+
sessionId: item.sessionId,
|
|
1556
|
+
responseId: item.responseId,
|
|
1557
|
+
interactionId: item.data.interactionId,
|
|
1558
|
+
resolution: item.data.resolution,
|
|
1559
|
+
item,
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
if (item.type === "interaction_resolution" &&
|
|
1563
|
+
(item.data.status === "cancelled" || item.data.status === "expired")) {
|
|
1564
|
+
const reason = item.data.reason ?? (item.data.status === "expired" ? "expired" : undefined);
|
|
1565
|
+
return {
|
|
1566
|
+
type: "session.interaction.cancelled",
|
|
1567
|
+
sessionId: item.sessionId,
|
|
1568
|
+
responseId: item.responseId,
|
|
1569
|
+
interactionId: item.data.interactionId,
|
|
1570
|
+
...(reason ? { reason } : {}),
|
|
1571
|
+
item,
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
return { type: "response.output_item.done", responseId: item.responseId, item };
|
|
1575
|
+
}
|
|
1576
|
+
function normalizeRunExecutionSelection(value) {
|
|
1577
|
+
if (value === undefined)
|
|
1578
|
+
return undefined;
|
|
1579
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1580
|
+
throw new MachineSessionServiceInputError("execution must be an object");
|
|
1581
|
+
}
|
|
1582
|
+
if (Object.keys(value).some((key) => key !== "model" && key !== "reasoningEffort")) {
|
|
1583
|
+
throw new MachineSessionServiceInputError("execution has unknown fields");
|
|
1584
|
+
}
|
|
1585
|
+
const selection = {};
|
|
1586
|
+
if (Object.prototype.hasOwnProperty.call(value, "model")) {
|
|
1587
|
+
selection.model = value.model === null
|
|
1588
|
+
? null
|
|
1589
|
+
: validRequiredText(value.model, "execution.model");
|
|
1590
|
+
}
|
|
1591
|
+
if (Object.prototype.hasOwnProperty.call(value, "reasoningEffort")) {
|
|
1592
|
+
selection.reasoningEffort = value.reasoningEffort === null
|
|
1593
|
+
? null
|
|
1594
|
+
: validRequiredText(value.reasoningEffort, "execution.reasoningEffort");
|
|
1595
|
+
}
|
|
1596
|
+
return selection;
|
|
1597
|
+
}
|
|
1598
|
+
function abortReason(signal) {
|
|
1599
|
+
if (signal.reason instanceof Error)
|
|
1600
|
+
return signal.reason;
|
|
1601
|
+
const error = new Error("run was cancelled");
|
|
1602
|
+
error.name = "AbortError";
|
|
1603
|
+
return error;
|
|
1604
|
+
}
|
|
1605
|
+
function liveSessionFailureFrom(error) {
|
|
1606
|
+
if (!error || typeof error !== "object")
|
|
1607
|
+
return undefined;
|
|
1608
|
+
const candidate = error;
|
|
1609
|
+
if (typeof candidate.message !== "string" ||
|
|
1610
|
+
typeof candidate.code !== "string" ||
|
|
1611
|
+
typeof candidate.statusCode !== "number")
|
|
1612
|
+
return undefined;
|
|
1613
|
+
return {
|
|
1614
|
+
message: candidate.message,
|
|
1615
|
+
code: candidate.code,
|
|
1616
|
+
statusCode: candidate.statusCode,
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
/** Turn structured native mode failures into actionable, Provider-specific
|
|
1620
|
+
* messages before the Direct Runtime adapter crosses the process boundary.
|
|
1621
|
+
* Unstructured failures keep their original text and remain subject to the
|
|
1622
|
+
* adapter's normal redaction policy. */
|
|
1623
|
+
function collaborationModeFailureMessage(provider, failure, fallback) {
|
|
1624
|
+
const providerLabel = provider === "traex" ? "TraeX" : "Codex";
|
|
1625
|
+
if (failure?.code === "native_session_not_live") {
|
|
1626
|
+
return `No live ${providerLabel} runner is available. Reconnect this Session and try again.`;
|
|
1627
|
+
}
|
|
1628
|
+
if (failure?.code === "native_thread_not_ready") {
|
|
1629
|
+
return `${providerLabel} is still loading its native thread. Reconnect this Session and try again.`;
|
|
1630
|
+
}
|
|
1631
|
+
return failure?.message ?? fallback;
|
|
1632
|
+
}
|
|
1076
1633
|
function requestLimit(value, fallback, maximum, field) {
|
|
1077
1634
|
return value === undefined ? Math.min(fallback, maximum) : boundedInteger(value, 1, maximum, field);
|
|
1078
1635
|
}
|
|
@@ -1091,6 +1648,15 @@ function validOpaqueToken(value, field, maximum) {
|
|
|
1091
1648
|
}
|
|
1092
1649
|
return value;
|
|
1093
1650
|
}
|
|
1651
|
+
function validRequiredText(value, field) {
|
|
1652
|
+
if (typeof value !== "string" || value.trim().length === 0 || value.length > 512) {
|
|
1653
|
+
throw new MachineSessionServiceInputError(`${field} must be a non-empty string of at most 512 characters`);
|
|
1654
|
+
}
|
|
1655
|
+
if (/[\u0000-\u001f\u007f]/.test(value)) {
|
|
1656
|
+
throw new MachineSessionServiceInputError(`${field} contains invalid control characters`);
|
|
1657
|
+
}
|
|
1658
|
+
return value.trim();
|
|
1659
|
+
}
|
|
1094
1660
|
function validTimestamp(value, field) {
|
|
1095
1661
|
if (typeof value !== "string" || !Number.isFinite(Date.parse(value))) {
|
|
1096
1662
|
throw new MachineSessionServiceInputError(`${field} must be a valid timestamp`);
|
|
@@ -1103,6 +1669,54 @@ function timestampFromEpoch(value, field) {
|
|
|
1103
1669
|
}
|
|
1104
1670
|
return new Date(value).toISOString();
|
|
1105
1671
|
}
|
|
1672
|
+
function sessionFileVersion(path, fileStat) {
|
|
1673
|
+
return createHash("sha256")
|
|
1674
|
+
.update(`${path}\0${fileStat.dev}\0${fileStat.ino}\0${fileStat.size}\0${fileStat.mtimeMs}\0${fileStat.ctimeMs}`)
|
|
1675
|
+
.digest("hex");
|
|
1676
|
+
}
|
|
1677
|
+
function workspaceFileMediaType(path) {
|
|
1678
|
+
switch (extname(path).toLowerCase()) {
|
|
1679
|
+
case ".png": return "image/png";
|
|
1680
|
+
case ".jpg":
|
|
1681
|
+
case ".jpeg": return "image/jpeg";
|
|
1682
|
+
case ".webp": return "image/webp";
|
|
1683
|
+
case ".gif": return "image/gif";
|
|
1684
|
+
case ".svg": return "image/svg+xml";
|
|
1685
|
+
case ".pdf": return "application/pdf";
|
|
1686
|
+
case ".json": return "application/json";
|
|
1687
|
+
case ".html":
|
|
1688
|
+
case ".htm": return "text/html";
|
|
1689
|
+
case ".css": return "text/css";
|
|
1690
|
+
case ".js":
|
|
1691
|
+
case ".mjs":
|
|
1692
|
+
case ".cjs": return "text/javascript";
|
|
1693
|
+
case ".md":
|
|
1694
|
+
case ".mdx": return "text/markdown";
|
|
1695
|
+
case ".csv": return "text/csv";
|
|
1696
|
+
case ".tsv": return "text/tab-separated-values";
|
|
1697
|
+
case ".txt":
|
|
1698
|
+
case ".log":
|
|
1699
|
+
case ".ts":
|
|
1700
|
+
case ".tsx":
|
|
1701
|
+
case ".jsx":
|
|
1702
|
+
case ".py":
|
|
1703
|
+
case ".go":
|
|
1704
|
+
case ".rs":
|
|
1705
|
+
case ".java":
|
|
1706
|
+
case ".c":
|
|
1707
|
+
case ".cc":
|
|
1708
|
+
case ".cpp":
|
|
1709
|
+
case ".h":
|
|
1710
|
+
case ".hpp":
|
|
1711
|
+
case ".sh":
|
|
1712
|
+
case ".zsh":
|
|
1713
|
+
case ".bash":
|
|
1714
|
+
case ".yaml":
|
|
1715
|
+
case ".yml":
|
|
1716
|
+
case ".toml": return "text/plain";
|
|
1717
|
+
default: return "application/octet-stream";
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1106
1720
|
function jsonByteLength(value) {
|
|
1107
1721
|
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
1108
1722
|
}
|