@prismshadow/penguin-server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +45 -0
- package/dist/api/types.d.ts +958 -0
- package/dist/api/types.js +1 -0
- package/dist/api/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6867 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
- package/web-dist/assets/abap-BdImnpbu.js +1 -0
- package/web-dist/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/web-dist/assets/ada-bCR0ucgS.js +1 -0
- package/web-dist/assets/andromeeda-C4gqWexZ.js +1 -0
- package/web-dist/assets/angular-html-DA-rfuFy.js +1 -0
- package/web-dist/assets/angular-ts-BrjP3tb8.js +1 -0
- package/web-dist/assets/apache-Pmp26Uib.js +1 -0
- package/web-dist/assets/apex-Dqspr-GT.js +1 -0
- package/web-dist/assets/apl-CORt7UWP.js +1 -0
- package/web-dist/assets/applescript-Co6uUVPk.js +1 -0
- package/web-dist/assets/ara-BRHolxvo.js +1 -0
- package/web-dist/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/web-dist/assets/asm-D_Q5rh1f.js +1 -0
- package/web-dist/assets/astro-HNnZUWAn.js +1 -0
- package/web-dist/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/web-dist/assets/awk-DMzUqQB5.js +1 -0
- package/web-dist/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/web-dist/assets/ayu-light-BA47KaF1.js +1 -0
- package/web-dist/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/web-dist/assets/ballerina-BFfxhgS-.js +1 -0
- package/web-dist/assets/bat-BkioyH1T.js +1 -0
- package/web-dist/assets/beancount-k_qm7-4y.js +1 -0
- package/web-dist/assets/berry-uYugtg8r.js +1 -0
- package/web-dist/assets/bibtex-CHM0blh-.js +1 -0
- package/web-dist/assets/bicep-Bmn6On1c.js +1 -0
- package/web-dist/assets/bird2-BIv1doCn.js +1 -0
- package/web-dist/assets/blade-2xfisSek.js +1 -0
- package/web-dist/assets/bsl-BO_Y6i37.js +1 -0
- package/web-dist/assets/c-BIGW1oBm.js +1 -0
- package/web-dist/assets/c3-MRO5bC_T.js +1 -0
- package/web-dist/assets/cadence-Bv_4Rxtq.js +1 -0
- package/web-dist/assets/cairo-KRGpt6FW.js +1 -0
- package/web-dist/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/web-dist/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/web-dist/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/web-dist/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/web-dist/assets/clarity-D53aC0YG.js +1 -0
- package/web-dist/assets/clojure-P80f7IUj.js +1 -0
- package/web-dist/assets/cmake-D1j8_8rp.js +1 -0
- package/web-dist/assets/cobol-nBiQ_Alo.js +1 -0
- package/web-dist/assets/codeowners-Bp6g37R7.js +1 -0
- package/web-dist/assets/codeql-DsOJ9woJ.js +1 -0
- package/web-dist/assets/coffee-Ch7k5sss.js +1 -0
- package/web-dist/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/web-dist/assets/coq-DkFqJrB1.js +1 -0
- package/web-dist/assets/cpp-UfJy6YNI.js +1 -0
- package/web-dist/assets/crystal-DGywbUpC.js +1 -0
- package/web-dist/assets/csharp-DSvCPggb.js +1 -0
- package/web-dist/assets/css-CLj8gQPS.js +1 -0
- package/web-dist/assets/csv-fuZLfV_i.js +1 -0
- package/web-dist/assets/cue-D82EKSYY.js +1 -0
- package/web-dist/assets/cypher-COkxafJQ.js +1 -0
- package/web-dist/assets/d-85-TOEBH.js +1 -0
- package/web-dist/assets/dark-plus-C3mMm8J8.js +1 -0
- package/web-dist/assets/dart-bE4Kk8sk.js +1 -0
- package/web-dist/assets/dax-CEL-wOlO.js +1 -0
- package/web-dist/assets/desktop-BmXAJ9_W.js +1 -0
- package/web-dist/assets/diff-D97Zzqfu.js +1 -0
- package/web-dist/assets/docker-BcOcwvcX.js +1 -0
- package/web-dist/assets/dotenv-Da5cRb03.js +1 -0
- package/web-dist/assets/dracula-BzJJZx-M.js +1 -0
- package/web-dist/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/web-dist/assets/dream-maker-BtqSS_iP.js +1 -0
- package/web-dist/assets/edge-FbVlp4U3.js +1 -0
- package/web-dist/assets/elixir-CkH2-t6x.js +1 -0
- package/web-dist/assets/elm-DbKCFpqz.js +1 -0
- package/web-dist/assets/emacs-lisp-CXvaQtF9.js +1 -0
- package/web-dist/assets/erb-Dm6A9KJ5.js +1 -0
- package/web-dist/assets/erlang-DsQrWhSR.js +1 -0
- package/web-dist/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/web-dist/assets/everforest-light-C8M2exoo.js +1 -0
- package/web-dist/assets/fennel-BYunw83y.js +1 -0
- package/web-dist/assets/fish-BvzEVeQv.js +1 -0
- package/web-dist/assets/fluent-C4IJs8-o.js +1 -0
- package/web-dist/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/web-dist/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/web-dist/assets/fsharp-CXgrBDvD.js +1 -0
- package/web-dist/assets/gdresource-BOOCDP_w.js +1 -0
- package/web-dist/assets/gdscript-C5YyOfLZ.js +1 -0
- package/web-dist/assets/gdshader-DkwncUOv.js +1 -0
- package/web-dist/assets/genie-D0YGMca9.js +1 -0
- package/web-dist/assets/gherkin-DyxjwDmM.js +1 -0
- package/web-dist/assets/git-commit-F4YmCXRG.js +1 -0
- package/web-dist/assets/git-rebase-r7XF79zn.js +1 -0
- package/web-dist/assets/github-dark-DHJKELXO.js +1 -0
- package/web-dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/web-dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/web-dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/web-dist/assets/github-light-DAi9KRSo.js +1 -0
- package/web-dist/assets/github-light-default-D7oLnXFd.js +1 -0
- package/web-dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/web-dist/assets/gleam-BspZqrRM.js +1 -0
- package/web-dist/assets/glimmer-js-ByusRIyA.js +1 -0
- package/web-dist/assets/glimmer-ts-BfAWNZQY.js +1 -0
- package/web-dist/assets/glsl-DplSGwfg.js +1 -0
- package/web-dist/assets/gn-n2N0HUVH.js +1 -0
- package/web-dist/assets/gnuplot-DdkO51Og.js +1 -0
- package/web-dist/assets/go-C27-OAKa.js +1 -0
- package/web-dist/assets/graphql-ChdNCCLP.js +1 -0
- package/web-dist/assets/groovy-gcz8RCvz.js +1 -0
- package/web-dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/web-dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/web-dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/web-dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/web-dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/web-dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/web-dist/assets/hack-DbPARsA_.js +1 -0
- package/web-dist/assets/haml-D5jkg6IW.js +1 -0
- package/web-dist/assets/handlebars-BpdQsYii.js +1 -0
- package/web-dist/assets/haskell-Df6bDoY_.js +1 -0
- package/web-dist/assets/haxe-CzTSHFRz.js +1 -0
- package/web-dist/assets/hcl-BWvSN4gD.js +1 -0
- package/web-dist/assets/hjson-D5-asLiD.js +1 -0
- package/web-dist/assets/hlsl-D3lLCCz7.js +1 -0
- package/web-dist/assets/horizon-BUw7H-hv.js +1 -0
- package/web-dist/assets/horizon-bright-CUuTKBJd.js +1 -0
- package/web-dist/assets/houston-DnULxvSX.js +1 -0
- package/web-dist/assets/html-derivative-DlHx6ybY.js +1 -0
- package/web-dist/assets/html-pp8916En.js +1 -0
- package/web-dist/assets/http-jrhK8wxY.js +1 -0
- package/web-dist/assets/hurl-irOxFIW8.js +1 -0
- package/web-dist/assets/hxml-Bvhsp5Yf.js +1 -0
- package/web-dist/assets/hy-DFXneXwc.js +1 -0
- package/web-dist/assets/imba-DGztddWO.js +1 -0
- package/web-dist/assets/index-7oqK2MPp.js +153 -0
- package/web-dist/assets/index-DGY2Myoq.js +51 -0
- package/web-dist/assets/index-SaWO9NKB.css +1 -0
- package/web-dist/assets/ini-BEwlwnbL.js +1 -0
- package/web-dist/assets/java-CylS5w8V.js +1 -0
- package/web-dist/assets/javascript-wDzz0qaB.js +1 -0
- package/web-dist/assets/jinja-f2NsQr07.js +1 -0
- package/web-dist/assets/jison-wvAkD_A8.js +1 -0
- package/web-dist/assets/json-Cp-IABpG.js +1 -0
- package/web-dist/assets/json5-C9tS-k6U.js +1 -0
- package/web-dist/assets/jsonc-Des-eS-w.js +1 -0
- package/web-dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/web-dist/assets/jsonnet-DFQXde-d.js +1 -0
- package/web-dist/assets/jssm-C2t-YnRu.js +1 -0
- package/web-dist/assets/jsx-g9-lgVsj.js +1 -0
- package/web-dist/assets/julia-D7OTSIA_.js +1 -0
- package/web-dist/assets/just-CUsbIsdP.js +1 -0
- package/web-dist/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/web-dist/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/web-dist/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/web-dist/assets/kdl-DV7GczEv.js +1 -0
- package/web-dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/web-dist/assets/kusto-wEQ09or8.js +1 -0
- package/web-dist/assets/laserwave-DUszq2jm.js +1 -0
- package/web-dist/assets/latex-CaSxy8MP.js +1 -0
- package/web-dist/assets/lean-BZvkOJ9d.js +1 -0
- package/web-dist/assets/less-B1dDrJ26.js +1 -0
- package/web-dist/assets/light-plus-B7mTdjB0.js +1 -0
- package/web-dist/assets/liquid-C0sCDyMI.js +1 -0
- package/web-dist/assets/llvm-DjAJT7YJ.js +1 -0
- package/web-dist/assets/log-2UxHyX5q.js +1 -0
- package/web-dist/assets/logo-BtOb2qkB.js +1 -0
- package/web-dist/assets/lua-BaeVxFsk.js +1 -0
- package/web-dist/assets/luau-KW6xsasC.js +1 -0
- package/web-dist/assets/make-CHLpvVh8.js +1 -0
- package/web-dist/assets/markdown-Cvjx9yec.js +1 -0
- package/web-dist/assets/marko-DjSrsDqO.js +1 -0
- package/web-dist/assets/material-theme-D5KoaKCx.js +1 -0
- package/web-dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/web-dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/web-dist/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/web-dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/web-dist/assets/matlab-D7o27uSR.js +1 -0
- package/web-dist/assets/mdc-DTYItulj.js +1 -0
- package/web-dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/web-dist/assets/mermaid-mWjccvbQ.js +1 -0
- package/web-dist/assets/min-dark-CafNBF8u.js +1 -0
- package/web-dist/assets/min-light-CTRr51gU.js +1 -0
- package/web-dist/assets/mipsasm-CKIfxQSi.js +1 -0
- package/web-dist/assets/mojo-rZm6bMo-.js +1 -0
- package/web-dist/assets/monokai-D4h5O-jR.js +1 -0
- package/web-dist/assets/moonbit-_H4v1dQx.js +1 -0
- package/web-dist/assets/move-IF9eRakj.js +1 -0
- package/web-dist/assets/narrat-DRg8JJMk.js +1 -0
- package/web-dist/assets/nextflow-C-mBbutL.js +1 -0
- package/web-dist/assets/nextflow-groovy-vE_lwT2v.js +1 -0
- package/web-dist/assets/nginx-BpAMiNFr.js +1 -0
- package/web-dist/assets/night-owl-C39BiMTA.js +1 -0
- package/web-dist/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/web-dist/assets/nim-BIad80T-.js +1 -0
- package/web-dist/assets/nix-CwoSXNpI.js +1 -0
- package/web-dist/assets/nord-Ddv68eIx.js +1 -0
- package/web-dist/assets/nushell-Cz2AlsmD.js +1 -0
- package/web-dist/assets/objective-c-DXmwc3jG.js +1 -0
- package/web-dist/assets/objective-cpp-CLxacb5B.js +1 -0
- package/web-dist/assets/ocaml-C0hk2d4L.js +1 -0
- package/web-dist/assets/odin-BBf5iR-q.js +1 -0
- package/web-dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/web-dist/assets/one-light-C3Wv6jpd.js +1 -0
- package/web-dist/assets/openscad-C4EeE6gA.js +1 -0
- package/web-dist/assets/pascal-D93ZcfNL.js +1 -0
- package/web-dist/assets/perl-B9cMNwum.js +1 -0
- package/web-dist/assets/php-Csjmro_R.js +1 -0
- package/web-dist/assets/pkl-u5AG7uiY.js +1 -0
- package/web-dist/assets/plastic-3e1v2bzS.js +1 -0
- package/web-dist/assets/plsql-ChMvpjG-.js +1 -0
- package/web-dist/assets/po-BTJTHyun.js +1 -0
- package/web-dist/assets/poimandres-CS3Unz2-.js +1 -0
- package/web-dist/assets/polar-C0HS_06l.js +1 -0
- package/web-dist/assets/postcss-CXtECtnM.js +1 -0
- package/web-dist/assets/powerquery-CEu0bR-o.js +1 -0
- package/web-dist/assets/powershell-Dpen1YoG.js +1 -0
- package/web-dist/assets/prisma-Dd19v3D-.js +1 -0
- package/web-dist/assets/prolog-CbFg5uaA.js +1 -0
- package/web-dist/assets/proto-C7zT0LnQ.js +1 -0
- package/web-dist/assets/pug-DKIMFp6K.js +1 -0
- package/web-dist/assets/puppet-BMWR74SV.js +1 -0
- package/web-dist/assets/purescript-CklMAg4u.js +1 -0
- package/web-dist/assets/python-B6aJPvgy.js +1 -0
- package/web-dist/assets/qml-3beO22l8.js +1 -0
- package/web-dist/assets/qmldir-C8lEn-DE.js +1 -0
- package/web-dist/assets/qss-IeuSbFQv.js +1 -0
- package/web-dist/assets/r-Dspwwk_N.js +1 -0
- package/web-dist/assets/racket-BqYA7rlc.js +1 -0
- package/web-dist/assets/raku-DXvB9xmW.js +1 -0
- package/web-dist/assets/razor-BjBPvh-w.js +1 -0
- package/web-dist/assets/red-bN70gL4F.js +1 -0
- package/web-dist/assets/reg-C-SQnVFl.js +1 -0
- package/web-dist/assets/regexp-CDVJQ6XC.js +1 -0
- package/web-dist/assets/rel-C3B-1QV4.js +1 -0
- package/web-dist/assets/riscv-BM1_JUlF.js +1 -0
- package/web-dist/assets/ron-D8l8udqQ.js +1 -0
- package/web-dist/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/web-dist/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/web-dist/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/web-dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/web-dist/assets/rst-CpCqk9r5.js +1 -0
- package/web-dist/assets/ruby-DyJCeAvU.js +1 -0
- package/web-dist/assets/rust-B1yitclQ.js +1 -0
- package/web-dist/assets/sas-DEy46yEz.js +1 -0
- package/web-dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/web-dist/assets/scala-C151Ov-r.js +1 -0
- package/web-dist/assets/scheme-C98Dy4si.js +1 -0
- package/web-dist/assets/scss-D5BDwBP9.js +1 -0
- package/web-dist/assets/sdbl-DVxCFoDh.js +1 -0
- package/web-dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/web-dist/assets/shellscript-Yzrsuije.js +1 -0
- package/web-dist/assets/shellsession-BADoaaVG.js +1 -0
- package/web-dist/assets/slack-dark-BthQWCQV.js +1 -0
- package/web-dist/assets/slack-ochin-DqwNpetd.js +1 -0
- package/web-dist/assets/smalltalk-BERRCDM3.js +1 -0
- package/web-dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/web-dist/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/web-dist/assets/solarized-light-L9t79GZl.js +1 -0
- package/web-dist/assets/solidity-rGO070M0.js +1 -0
- package/web-dist/assets/soy-8wufbnw4.js +1 -0
- package/web-dist/assets/sparql-rVzFXLq3.js +1 -0
- package/web-dist/assets/splunk-BtCnVYZw.js +1 -0
- package/web-dist/assets/sql-CRqJ_cUM.js +1 -0
- package/web-dist/assets/ssh-config-_ykCGR6B.js +1 -0
- package/web-dist/assets/stata-DI20mbqo.js +1 -0
- package/web-dist/assets/stylus-BEDo0Tqx.js +1 -0
- package/web-dist/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/web-dist/assets/svelte-Cy7k_4gC.js +1 -0
- package/web-dist/assets/swift-D82vCrfD.js +1 -0
- package/web-dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/web-dist/assets/system-verilog-CnnmHF94.js +1 -0
- package/web-dist/assets/systemd-4A_iFExJ.js +1 -0
- package/web-dist/assets/talonscript-CkByrt1z.js +1 -0
- package/web-dist/assets/tasl-QIJgUcNo.js +1 -0
- package/web-dist/assets/tcl-dwOrl1Do.js +1 -0
- package/web-dist/assets/templ-DhtptRzy.js +1 -0
- package/web-dist/assets/terraform-BETggiCN.js +1 -0
- package/web-dist/assets/tex-idrVyKtj.js +1 -0
- package/web-dist/assets/tokyo-night-hegEt444.js +1 -0
- package/web-dist/assets/toml-vGWfd6FD.js +1 -0
- package/web-dist/assets/ts-tags-D351s5mN.js +1 -0
- package/web-dist/assets/tsv-B_m7g4N7.js +1 -0
- package/web-dist/assets/tsx-COt5Ahok.js +1 -0
- package/web-dist/assets/turtle-BsS91CYL.js +1 -0
- package/web-dist/assets/twig-CW1WmMYd.js +1 -0
- package/web-dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/web-dist/assets/typespec-CAFt9gP4.js +1 -0
- package/web-dist/assets/typst-DHCkPAjA.js +1 -0
- package/web-dist/assets/v-BcVCzyr7.js +1 -0
- package/web-dist/assets/vala-CsfeWuGM.js +1 -0
- package/web-dist/assets/vb-D17OF-Vu.js +1 -0
- package/web-dist/assets/verilog-BQ8w6xss.js +1 -0
- package/web-dist/assets/vesper-DRje8inN.js +1 -0
- package/web-dist/assets/vhdl-CeAyd5Ju.js +1 -0
- package/web-dist/assets/viml-CJc9bBzg.js +1 -0
- package/web-dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/web-dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/web-dist/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/web-dist/assets/vue-D2xRrEX4.js +1 -0
- package/web-dist/assets/vue-html-AaS7Mt5G.js +1 -0
- package/web-dist/assets/vue-vine-BoDAl6tE.js +1 -0
- package/web-dist/assets/vyper-CDx5xZoG.js +1 -0
- package/web-dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/web-dist/assets/wasm-MzD3tlZU.js +1 -0
- package/web-dist/assets/wenyan-BV7otONQ.js +1 -0
- package/web-dist/assets/wgsl-Dx-B1_4e.js +1 -0
- package/web-dist/assets/wikitext-BhOHFoWU.js +1 -0
- package/web-dist/assets/wit-5i3qLPDT.js +1 -0
- package/web-dist/assets/wolfram-lXgVvXCa.js +1 -0
- package/web-dist/assets/xml-sdJ4AIDG.js +1 -0
- package/web-dist/assets/xsl-CtQFsRM5.js +1 -0
- package/web-dist/assets/yaml-Buea-lGh.js +1 -0
- package/web-dist/assets/zenscript-DVFEvuxE.js +1 -0
- package/web-dist/assets/zig-VOosw3JB.js +1 -0
- package/web-dist/index.html +16 -0
- package/web-dist/penguin-logo.svg +1 -0
|
@@ -0,0 +1,958 @@
|
|
|
1
|
+
import { OmniMessage, ToolCallPayload } from '@prismshadow/penguin-core/omnimessage';
|
|
2
|
+
import { ThinkingLevelName, ToolDefinitionConfig, MCPServerConfig } from '@prismshadow/penguin-core/interfaces';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Web API DTO contract — request/response types shared between server routes and the
|
|
6
|
+
* frontend SPA (single source of truth).
|
|
7
|
+
*
|
|
8
|
+
* These field definitions are authoritative for the Web API contract. Conventions:
|
|
9
|
+
* - DTO fields use camelCase; OmniMessage keeps the core protocol as-is (snake_case shell),
|
|
10
|
+
* no conversion;
|
|
11
|
+
* - This file holds only types, no implementation; exposed to the frontend via package
|
|
12
|
+
* exports `"./api"` for type-only import;
|
|
13
|
+
* - Types are taken only from core's pure subpaths (omnimessage / interfaces), so the
|
|
14
|
+
* frontend can safely reference them.
|
|
15
|
+
*
|
|
16
|
+
* Docs: packages/docs/content/server-api.{zh,en}.md (site path /docs/server-api) is the
|
|
17
|
+
* public route/SSE reference for this contract — keep it in sync when changing DTOs.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Unified error response body; `code` is a machine-readable error code, `message` is a Chinese user-facing message. */
|
|
21
|
+
interface ErrorBody {
|
|
22
|
+
error: {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Session approval mode (reuses the CLI enum). */
|
|
28
|
+
type ApprovalMode = "allow-all" | "deny-all" | "read-only" | "always-ask";
|
|
29
|
+
/** Session run status: idle / Task in progress / compacting. */
|
|
30
|
+
type SessionStatus = "idle" | "running" | "compacting";
|
|
31
|
+
/** Session source marker (default = user-created): triggered by Schedule / registered as a subagent session. */
|
|
32
|
+
type SessionSource = "schedule" | "subagent";
|
|
33
|
+
interface UserInfo {
|
|
34
|
+
/** Semantic id, i.e. login name: `^[a-z][a-z0-9_-]{1,31}$`, immutable after creation. */
|
|
35
|
+
userId: string;
|
|
36
|
+
/** Built-in admin (seeded at startup). */
|
|
37
|
+
isAdmin: boolean;
|
|
38
|
+
/** Still using the initial password (seeded/set by admin): frontend prompts the user to change it soon. */
|
|
39
|
+
passwordIsInitial: boolean;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
}
|
|
42
|
+
interface AuthLoginRequest {
|
|
43
|
+
userId: string;
|
|
44
|
+
password: string;
|
|
45
|
+
}
|
|
46
|
+
interface AuthResponse {
|
|
47
|
+
user: UserInfo;
|
|
48
|
+
}
|
|
49
|
+
interface MeResponse {
|
|
50
|
+
user: UserInfo;
|
|
51
|
+
}
|
|
52
|
+
interface PasswordChangeRequest {
|
|
53
|
+
oldPassword: string;
|
|
54
|
+
/** At least 8 characters. */
|
|
55
|
+
newPassword: string;
|
|
56
|
+
}
|
|
57
|
+
interface AdminUsersResponse {
|
|
58
|
+
users: UserInfo[];
|
|
59
|
+
}
|
|
60
|
+
interface AdminUserCreateRequest {
|
|
61
|
+
/** Username, i.e. user_id: `^[a-z][a-z0-9_-]{1,31}$`. */
|
|
62
|
+
userId: string;
|
|
63
|
+
/** Initial password (at least 8 characters), flagged as an initial password. */
|
|
64
|
+
password: string;
|
|
65
|
+
}
|
|
66
|
+
interface AdminUserCreateResponse {
|
|
67
|
+
user: UserInfo;
|
|
68
|
+
}
|
|
69
|
+
interface AdminPasswordResetRequest {
|
|
70
|
+
/** New initial password (at least 8 characters); resets invalidate all of the user's sessions. */
|
|
71
|
+
password: string;
|
|
72
|
+
}
|
|
73
|
+
/** User UI preferences (SQLite ui_prefs, free-form JSON; known keys declared here). */
|
|
74
|
+
interface UiPrefs {
|
|
75
|
+
theme?: "light" | "dark";
|
|
76
|
+
lastProjectId?: string;
|
|
77
|
+
/** Whether the "no API key configured" guide has already been shown: once ever (on first visit to the chat page). */
|
|
78
|
+
credentialGuideSeen?: boolean;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
interface PrefsResponse {
|
|
82
|
+
prefs: UiPrefs;
|
|
83
|
+
}
|
|
84
|
+
type ProjectRole = "owner" | "member";
|
|
85
|
+
interface ProjectSummary {
|
|
86
|
+
projectId: string;
|
|
87
|
+
/** Display name (the `name` in project_config.toml); frontend falls back to projectId when unset. */
|
|
88
|
+
name?: string;
|
|
89
|
+
/** Current user's role in this Project. */
|
|
90
|
+
role: ProjectRole;
|
|
91
|
+
ownerUserId: string;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
}
|
|
94
|
+
interface ProjectsResponse {
|
|
95
|
+
projects: ProjectSummary[];
|
|
96
|
+
}
|
|
97
|
+
interface ProjectCreateRequest {
|
|
98
|
+
/**
|
|
99
|
+
* Semantic id, specified by the creator: `^[a-z][a-z0-9_-]{1,63}$`, immutable after creation.
|
|
100
|
+
* Non-admins must prefix it with `<username>-` (the web input locks the prefix segment);
|
|
101
|
+
* admins are unrestricted.
|
|
102
|
+
*/
|
|
103
|
+
projectId: string;
|
|
104
|
+
/** Display name; defaults to projectId. */
|
|
105
|
+
name?: string;
|
|
106
|
+
}
|
|
107
|
+
interface ProjectCreateResponse {
|
|
108
|
+
project: ProjectSummary;
|
|
109
|
+
}
|
|
110
|
+
interface MemberInfo {
|
|
111
|
+
userId: string;
|
|
112
|
+
role: ProjectRole;
|
|
113
|
+
createdAt: string;
|
|
114
|
+
}
|
|
115
|
+
interface MembersResponse {
|
|
116
|
+
members: MemberInfo[];
|
|
117
|
+
}
|
|
118
|
+
interface MemberAddRequest {
|
|
119
|
+
/** Username of the user being granted access (owner invites by username). */
|
|
120
|
+
userId: string;
|
|
121
|
+
}
|
|
122
|
+
interface MemberAddResponse {
|
|
123
|
+
member: MemberInfo;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Model reference DTO: `(provider, modelId)` pair.
|
|
127
|
+
* `modelId` is the upstream request id, sent to AgentHub as-is — `<provider>/<id>` string
|
|
128
|
+
* concatenation is forbidden throughout the pipeline.
|
|
129
|
+
*/
|
|
130
|
+
interface ModelRefDto {
|
|
131
|
+
provider: string;
|
|
132
|
+
modelId: string;
|
|
133
|
+
}
|
|
134
|
+
/** Three pricing buckets, in USD per million tokens (unit is fixed at usd_per_mtok; not carried in the DTO). */
|
|
135
|
+
interface ModelPricingDto {
|
|
136
|
+
cacheRead: number;
|
|
137
|
+
cacheWrite: number;
|
|
138
|
+
output: number;
|
|
139
|
+
}
|
|
140
|
+
/** Read-only credential display: masked key and creation time; plaintext is never sent. */
|
|
141
|
+
interface CredentialInfo {
|
|
142
|
+
apiKeyMasked?: string;
|
|
143
|
+
baseUrl?: string;
|
|
144
|
+
createdAt?: string;
|
|
145
|
+
}
|
|
146
|
+
interface ModelInfo {
|
|
147
|
+
/** Provider group id (anthropic / openai / …, see core's MODEL_PROVIDERS; custom models use `custom`). */
|
|
148
|
+
provider: string;
|
|
149
|
+
/** Upstream model id (the request id actually sent to AgentHub); paired with `provider` forms the entry's unique key. */
|
|
150
|
+
modelId: string;
|
|
151
|
+
/** Display name: explicit TOML field (user-edited) takes priority, then the built-in catalog; falls back to unset (frontend shows modelId). */
|
|
152
|
+
displayName?: string;
|
|
153
|
+
contextWindow?: number;
|
|
154
|
+
/** AgentHub client protocol (`openai`, etc.); defaults to AgentHub inferring it from modelId. */
|
|
155
|
+
clientType?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Whether image input (vision/multimodal) is supported: the TOML `vision` annotation takes
|
|
158
|
+
* priority, falling back to the built-in catalog annotation; if neither exists, defaults to
|
|
159
|
+
* unset (= treated as supported).
|
|
160
|
+
*/
|
|
161
|
+
vision?: boolean;
|
|
162
|
+
pricing?: ModelPricingDto;
|
|
163
|
+
/** Environment variable name to fall back to when api_key is empty (e.g. ANTHROPIC_API_KEY); unset if no known fallback. */
|
|
164
|
+
envKey?: string;
|
|
165
|
+
credential?: CredentialInfo;
|
|
166
|
+
isDefault: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ModelsResponse {
|
|
169
|
+
/** Paired reference to the default Model. */
|
|
170
|
+
defaultModel?: ModelRefDto;
|
|
171
|
+
/** Vision model used as a proxy reader for read_image (describes images when the session model has vision=false). */
|
|
172
|
+
visionModel?: ModelRefDto;
|
|
173
|
+
models: ModelInfo[];
|
|
174
|
+
}
|
|
175
|
+
/** PUT full-table replace semantics: models not present are deleted; omitting apiKey = keep existing value. Key = (provider, modelId). */
|
|
176
|
+
interface ModelUpdateEntry {
|
|
177
|
+
/** Provider group (an independent entry field, always submitted with the request). */
|
|
178
|
+
provider: string;
|
|
179
|
+
/** Upstream model id (sent to AgentHub as-is). */
|
|
180
|
+
modelId: string;
|
|
181
|
+
/** Display name; the server does not persist it when it matches the built-in catalog (keeps the config file clean). */
|
|
182
|
+
displayName?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The pair reference this entry was renamed from (provided when either the group or the
|
|
185
|
+
* upstream id changes): the server uses this to migrate the original entry's credential
|
|
186
|
+
* and unknown fields to the new key — otherwise a full-table replace would delete the
|
|
187
|
+
* original entry along with its credential.
|
|
188
|
+
*/
|
|
189
|
+
renamedFrom?: ModelRefDto;
|
|
190
|
+
contextWindow?: number;
|
|
191
|
+
/** Empty string/omitted = unspecified (AgentHub infers it from modelId). */
|
|
192
|
+
clientType?: string;
|
|
193
|
+
/** Whether image input (vision/multimodal) is supported; omitted = supported (not persisted). */
|
|
194
|
+
vision?: boolean;
|
|
195
|
+
pricing?: ModelPricingDto;
|
|
196
|
+
/** Providing it overwrites and updates createdAt; omitting it keeps the existing value. */
|
|
197
|
+
apiKey?: string;
|
|
198
|
+
/** When true, clears the stored api_key. */
|
|
199
|
+
clearApiKey?: boolean;
|
|
200
|
+
/** null clears it; omitted keeps the existing value. */
|
|
201
|
+
baseUrl?: string | null;
|
|
202
|
+
}
|
|
203
|
+
interface ModelsUpdateRequest {
|
|
204
|
+
/** Must be included in models (matched by paired reference). */
|
|
205
|
+
defaultModel?: ModelRefDto;
|
|
206
|
+
/** Vision model used as a proxy reader for read_image: must be included in models and not annotated vision=false; omitted keeps the existing value. */
|
|
207
|
+
visionModel?: ModelRefDto;
|
|
208
|
+
models: ModelUpdateEntry[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Connectivity test (POST /api/projects/:p/models/test): the model reference is submitted as
|
|
212
|
+
* a pair in the request body; the rest are optional overrides (for trying out an unsaved
|
|
213
|
+
* config). When the model isn't in the config yet (adding a custom model — test-before-save),
|
|
214
|
+
* all parameters come from this request body.
|
|
215
|
+
*/
|
|
216
|
+
interface ModelTestRequest {
|
|
217
|
+
/** Provider group of the model under test (paired with modelId). */
|
|
218
|
+
provider: string;
|
|
219
|
+
/** Upstream id of the model under test (sent to AgentHub as-is). */
|
|
220
|
+
modelId: string;
|
|
221
|
+
/** Newly entered API key (plaintext); used for the test if provided. */
|
|
222
|
+
apiKey?: string;
|
|
223
|
+
/** "Clear saved API key" is checked: the test does **not** fall back to the stored key (tests against the current draft). */
|
|
224
|
+
clearApiKey?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* base URL (not secret; the frontend always sends the form's current value): a string
|
|
227
|
+
* means use it, `null` means explicitly clear it (no fallback to the stored value),
|
|
228
|
+
* `undefined` means fall back to the stored value only when not provided.
|
|
229
|
+
*/
|
|
230
|
+
baseUrl?: string | null;
|
|
231
|
+
/** AgentHub client protocol; required for unsaved custom models (otherwise the id can't be auto-routed). */
|
|
232
|
+
clientType?: string;
|
|
233
|
+
}
|
|
234
|
+
/** Connectivity test result: carries round-trip latency when ok, and a reason on failure (truncated raw provider error). */
|
|
235
|
+
interface ModelTestResponse {
|
|
236
|
+
ok: boolean;
|
|
237
|
+
latencyMs?: number;
|
|
238
|
+
message?: string;
|
|
239
|
+
}
|
|
240
|
+
/** Read-only vault entry display: key name + masked value; plaintext is never sent. */
|
|
241
|
+
interface VaultEntryInfo {
|
|
242
|
+
key: string;
|
|
243
|
+
valueMasked: string;
|
|
244
|
+
}
|
|
245
|
+
interface VaultResponse {
|
|
246
|
+
entries: VaultEntryInfo[];
|
|
247
|
+
}
|
|
248
|
+
/** A single entry under PUT full-table replace semantics: omitting value = keep the existing value (required for new keys). */
|
|
249
|
+
interface VaultEntryUpdate {
|
|
250
|
+
/** Shell environment variable name rule: starts with a letter or underscore, followed by letters/digits/underscores only. */
|
|
251
|
+
key: string;
|
|
252
|
+
/** Non-empty string; omitted keeps the existing value. */
|
|
253
|
+
value?: string;
|
|
254
|
+
}
|
|
255
|
+
/** PUT full-table replace semantics (same as models): keys not present in the body are deleted. */
|
|
256
|
+
interface VaultUpdateRequest {
|
|
257
|
+
entries: VaultEntryUpdate[];
|
|
258
|
+
}
|
|
259
|
+
interface AgentSummary {
|
|
260
|
+
agentId: string;
|
|
261
|
+
name?: string;
|
|
262
|
+
description?: string;
|
|
263
|
+
createdAt?: string;
|
|
264
|
+
/** Last config modification time: the larger mtime of system_config.yaml / AGENTS.md (unset if stat fails). */
|
|
265
|
+
updatedAt?: string;
|
|
266
|
+
/** Number of this Agent's Sessions currently running / compacting. */
|
|
267
|
+
activeSessionCount: number;
|
|
268
|
+
/** Total Session count (DB index ∪ Trace directory discovery, including archived). */
|
|
269
|
+
sessionCount: number;
|
|
270
|
+
/** Daily active Session count for the last 30 days (index 0 = earliest, last = today; active = created that day or has a Trace record that day). */
|
|
271
|
+
sessionActivity: number[];
|
|
272
|
+
/** Tool count: number of tools.builtin + tools.mcpServers config entries (MCP counted per server). */
|
|
273
|
+
toolCount: number;
|
|
274
|
+
/** Agent State version number (the `version` in system_config.yaml; treated as 1 if missing). */
|
|
275
|
+
version: number;
|
|
276
|
+
/** Vault key count (number of keys in agent_state/.vault.toml). */
|
|
277
|
+
vaultKeyCount: number;
|
|
278
|
+
/** Schedule count (number of .toml files under agent_state/schedule/, including invalid ones). */
|
|
279
|
+
scheduleCount: number;
|
|
280
|
+
}
|
|
281
|
+
interface AgentsResponse {
|
|
282
|
+
agents: AgentSummary[];
|
|
283
|
+
}
|
|
284
|
+
interface AgentCreateRequest {
|
|
285
|
+
/** Semantic id, specified by the creator: `^[a-z][a-z0-9_-]{1,63}$`, unique within the Project, immutable after creation. */
|
|
286
|
+
agentId: string;
|
|
287
|
+
/** Display name; defaults to agentId. */
|
|
288
|
+
name?: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
}
|
|
291
|
+
interface AgentCreateResponse {
|
|
292
|
+
agent: AgentSummary;
|
|
293
|
+
}
|
|
294
|
+
interface AgentModelConfigDto {
|
|
295
|
+
maxTokens?: number;
|
|
296
|
+
thinkingLevel?: ThinkingLevelName;
|
|
297
|
+
timeoutMs?: number;
|
|
298
|
+
}
|
|
299
|
+
interface AgentCompactionConfigDto {
|
|
300
|
+
maxContextLength?: number;
|
|
301
|
+
maxSessionTurns?: number;
|
|
302
|
+
mode?: "summarize" | "discard";
|
|
303
|
+
prompt?: string;
|
|
304
|
+
}
|
|
305
|
+
/** Structured view of system_config.yaml (for the edit form). */
|
|
306
|
+
interface AgentConfigDto {
|
|
307
|
+
name?: string;
|
|
308
|
+
description?: string;
|
|
309
|
+
/** Agent State version number (treated as 1 if missing; shown in the settings page overview). */
|
|
310
|
+
version: number;
|
|
311
|
+
systemPrompt: string;
|
|
312
|
+
maxTurns?: number;
|
|
313
|
+
model?: AgentModelConfigDto;
|
|
314
|
+
compaction?: AgentCompactionConfigDto;
|
|
315
|
+
toolsBuiltin: ToolDefinitionConfig[];
|
|
316
|
+
mcpServers: MCPServerConfig[];
|
|
317
|
+
}
|
|
318
|
+
interface AgentConfigResponse {
|
|
319
|
+
agentsMd: string;
|
|
320
|
+
/** Raw system_config.yaml text (read-only display / diagnostics). */
|
|
321
|
+
systemConfigYaml: string;
|
|
322
|
+
config: AgentConfigDto;
|
|
323
|
+
/** Agent State absolute path. */
|
|
324
|
+
stateDir: string;
|
|
325
|
+
activeSessionCount: number;
|
|
326
|
+
}
|
|
327
|
+
/** PUT any subset: only provided keys are updated (remaining YAML content and comments preserved); agentsMd overwrites the whole file. */
|
|
328
|
+
interface AgentConfigUpdateRequest {
|
|
329
|
+
agentsMd?: string;
|
|
330
|
+
config?: {
|
|
331
|
+
name?: string;
|
|
332
|
+
description?: string;
|
|
333
|
+
systemPrompt?: string;
|
|
334
|
+
maxTurns?: number;
|
|
335
|
+
model?: AgentModelConfigDto;
|
|
336
|
+
compaction?: AgentCompactionConfigDto;
|
|
337
|
+
toolsBuiltin?: ToolDefinitionConfig[];
|
|
338
|
+
mcpServers?: MCPServerConfig[];
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
interface SessionInfo {
|
|
342
|
+
sessionId: string;
|
|
343
|
+
projectId: string;
|
|
344
|
+
agentId: string;
|
|
345
|
+
/** Provider group of the session's model (paired with `modelId` to form a model reference). */
|
|
346
|
+
provider: string;
|
|
347
|
+
/** Upstream model_id of the session's model (the request id sent to AgentHub). */
|
|
348
|
+
modelId: string;
|
|
349
|
+
workspace: string;
|
|
350
|
+
approvalMode: ApprovalMode;
|
|
351
|
+
/** Short title auto-generated by the model after the first turn; unset until generated (frontend shows "New Chat"). */
|
|
352
|
+
title?: string;
|
|
353
|
+
/** Session source (for list badges); unset for user-created sessions. */
|
|
354
|
+
source?: SessionSource;
|
|
355
|
+
createdAt: string;
|
|
356
|
+
status: SessionStatus;
|
|
357
|
+
/** Number of approvals awaiting human decision (a persisted count outside server events, for list badges). */
|
|
358
|
+
pendingApprovalCount: number;
|
|
359
|
+
/** Whether a Trace record exists (a Task has been started). */
|
|
360
|
+
hasTrace: boolean;
|
|
361
|
+
/** Whether archived (hidden from the default list, grouped under "Archived"). */
|
|
362
|
+
archived: boolean;
|
|
363
|
+
}
|
|
364
|
+
interface SessionsResponse {
|
|
365
|
+
sessions: SessionInfo[];
|
|
366
|
+
}
|
|
367
|
+
/** Server directory browsing (advanced new-Workspace picker): starts from the home directory by default, can navigate up to the root. */
|
|
368
|
+
interface DirEntryInfo {
|
|
369
|
+
name: string;
|
|
370
|
+
/** Absolute path of this subdirectory (can be submitted directly as a Workspace). */
|
|
371
|
+
path: string;
|
|
372
|
+
}
|
|
373
|
+
interface DirListResponse {
|
|
374
|
+
/** Absolute path of the current directory (realpath). */
|
|
375
|
+
path: string;
|
|
376
|
+
/** Absolute path of the parent directory; null when already at the root. */
|
|
377
|
+
parent: string | null;
|
|
378
|
+
/** Subdirectory list (sorted by name, files excluded). */
|
|
379
|
+
entries: DirEntryInfo[];
|
|
380
|
+
}
|
|
381
|
+
interface SessionCreateRequest {
|
|
382
|
+
/** Upstream id of the session's model (paired with provider); defaults to the Project's default Model. */
|
|
383
|
+
modelId?: string;
|
|
384
|
+
/**
|
|
385
|
+
* Provider group for `modelId`; when omitted, resolved via resolveModelRef semantics —
|
|
386
|
+
* modelId can only be resolved if it's globally unique by exact match in the config;
|
|
387
|
+
* 0 or multiple matches return 400.
|
|
388
|
+
*/
|
|
389
|
+
provider?: string;
|
|
390
|
+
/** Any existing directory on the server; defaults to auto-creating a temporary Workspace. */
|
|
391
|
+
workspace?: string;
|
|
392
|
+
/** Defaults to allow-all. */
|
|
393
|
+
approvalMode?: ApprovalMode;
|
|
394
|
+
}
|
|
395
|
+
interface SessionCreateResponse {
|
|
396
|
+
session: SessionInfo;
|
|
397
|
+
}
|
|
398
|
+
interface SessionResponse {
|
|
399
|
+
session: SessionInfo;
|
|
400
|
+
}
|
|
401
|
+
interface SessionPatchRequest {
|
|
402
|
+
approvalMode?: ApprovalMode;
|
|
403
|
+
/** Archive / unarchive (default list hides archived). */
|
|
404
|
+
archived?: boolean;
|
|
405
|
+
/** Manual rename; non-empty string, overrides the auto-generated title. */
|
|
406
|
+
title?: string;
|
|
407
|
+
}
|
|
408
|
+
/** Message history: the full messages and events from concatenating all of this Session's Trace files in order (excludes partial_*). */
|
|
409
|
+
interface MessagesResponse {
|
|
410
|
+
messages: OmniMessage[];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* A single Prompt's input parts: text or image (data: / http(s) URL).
|
|
414
|
+
* Docs: /docs/server-api § "Session-Level Endpoints".
|
|
415
|
+
*/
|
|
416
|
+
type TaskInputPart = {
|
|
417
|
+
type: "text";
|
|
418
|
+
text: string;
|
|
419
|
+
} | {
|
|
420
|
+
type: "image_url";
|
|
421
|
+
imageUrl: string;
|
|
422
|
+
};
|
|
423
|
+
interface TaskCreateRequest {
|
|
424
|
+
input: TaskInputPart[];
|
|
425
|
+
}
|
|
426
|
+
interface TaskCreateResponse {
|
|
427
|
+
/** Current actual session_id: a Trace-less invalid Session self-heals and returns a new id; the frontend updates its route accordingly. */
|
|
428
|
+
sessionId: string;
|
|
429
|
+
}
|
|
430
|
+
interface ApprovalDecisionRequest {
|
|
431
|
+
decision: "allow" | "deny";
|
|
432
|
+
}
|
|
433
|
+
/** Docs: /docs/server-api § "Streaming (SSE)". */
|
|
434
|
+
type ServerEvent =
|
|
435
|
+
/**
|
|
436
|
+
* Approval request escalated to a human: every call under always-ask, plus rw/unknown-permission
|
|
437
|
+
* calls under read-only (see runtime/approvals.ts); pending approvals are resent on reconnect.
|
|
438
|
+
*/
|
|
439
|
+
{
|
|
440
|
+
type: "approval_request";
|
|
441
|
+
toolCall: OmniMessage<ToolCallPayload>;
|
|
442
|
+
origin?: string[];
|
|
443
|
+
}
|
|
444
|
+
/** Session run status flip (for toggling the input area and list). */
|
|
445
|
+
| {
|
|
446
|
+
type: "task_state";
|
|
447
|
+
state: SessionStatus;
|
|
448
|
+
}
|
|
449
|
+
/** The model-generated title after the first turn has been persisted (for in-place list updates). */
|
|
450
|
+
| {
|
|
451
|
+
type: "session_title";
|
|
452
|
+
sessionId: string;
|
|
453
|
+
title: string;
|
|
454
|
+
}
|
|
455
|
+
/** Last-Event-ID has been evicted from the buffer: the frontend should re-fetch the history endpoint before continuing to consume this connection. */
|
|
456
|
+
| {
|
|
457
|
+
type: "resync_required";
|
|
458
|
+
}
|
|
459
|
+
/** Placeholder handshake on the user channel (reserved for automated task notifications). */
|
|
460
|
+
| {
|
|
461
|
+
type: "hello";
|
|
462
|
+
}
|
|
463
|
+
/** New session registered (pushed over the parent session's channel for subagent sessions): frontend refreshes the list in place. */
|
|
464
|
+
| {
|
|
465
|
+
type: "session_created";
|
|
466
|
+
projectId: string;
|
|
467
|
+
agentId: string;
|
|
468
|
+
sessionId: string;
|
|
469
|
+
source: SessionSource;
|
|
470
|
+
} | ScheduleServerEvent;
|
|
471
|
+
/** Schedule notification (user-level event stream; firing and delivery are notified via /api/events). */
|
|
472
|
+
type ScheduleServerEvent =
|
|
473
|
+
/** Fired and sent (sessionId is the session that received the Prompt; a new session under new-Session mode). */
|
|
474
|
+
{
|
|
475
|
+
type: "schedule_fired";
|
|
476
|
+
projectId: string;
|
|
477
|
+
agentId: string;
|
|
478
|
+
name: string;
|
|
479
|
+
sessionId: string;
|
|
480
|
+
}
|
|
481
|
+
/** Target Session is running; this firing is queued and will be sent once it's idle. */
|
|
482
|
+
| {
|
|
483
|
+
type: "schedule_queued";
|
|
484
|
+
projectId: string;
|
|
485
|
+
agentId: string;
|
|
486
|
+
name: string;
|
|
487
|
+
sessionId: string;
|
|
488
|
+
};
|
|
489
|
+
interface TraceFileInfo {
|
|
490
|
+
/** Trace file index (one file corresponds to one complete model context). */
|
|
491
|
+
index: number;
|
|
492
|
+
/** Date subdirectory it belongs to (yyyy-mm-dd). */
|
|
493
|
+
date: string;
|
|
494
|
+
sizeBytes: number;
|
|
495
|
+
mtime: string;
|
|
496
|
+
}
|
|
497
|
+
interface SessionTracesResponse {
|
|
498
|
+
files: TraceFileInfo[];
|
|
499
|
+
}
|
|
500
|
+
interface TraceEventsResponse {
|
|
501
|
+
events: OmniMessage[];
|
|
502
|
+
offset: number;
|
|
503
|
+
limit: number;
|
|
504
|
+
/** Total line count of the file (basis for pagination). */
|
|
505
|
+
total: number;
|
|
506
|
+
}
|
|
507
|
+
/** Duration span of a single LLM Request (request_begin/request_end paired by proximity). */
|
|
508
|
+
interface RequestSpan {
|
|
509
|
+
beginTs: string;
|
|
510
|
+
endTs?: string;
|
|
511
|
+
durationMs?: number;
|
|
512
|
+
status?: string;
|
|
513
|
+
/** The Task it belongs to (same convention as modelSegments/toolSpans). */
|
|
514
|
+
taskIndex: number;
|
|
515
|
+
/** Compaction request (falls between compaction_begin and compaction_end): excluded from TPS, see TraceTaskStats. */
|
|
516
|
+
compaction?: boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Total human approval wait time within this Request. core does `await approve(tc)` inside
|
|
519
|
+
* the streaming loop — if approval doesn't return, the next chunk isn't consumed and
|
|
520
|
+
* `request_end` can't be emitted either, so the entire human wait falls inside the span
|
|
521
|
+
* (see context-engine's runTurn). Tool **execution** is not included (`void executeOne`,
|
|
522
|
+
* doesn't block the loop).
|
|
523
|
+
*/
|
|
524
|
+
approvalWaitMs?: number;
|
|
525
|
+
/** LLM generation duration = durationMs − approvalWaitMs (≥ 0): only this can be used as the TPS denominator, not durationMs. */
|
|
526
|
+
activeMs?: number;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Per-Task Token / duration figures (aggregated server-side over the **entire** Trace file,
|
|
530
|
+
* aligned with the Chat page's task-stats).
|
|
531
|
+
*
|
|
532
|
+
* Provided separately instead of letting the frontend aggregate `requests` + events itself:
|
|
533
|
+
* the frontend's events are paginated (only the first N), so self-aggregation would mismatch
|
|
534
|
+
* a numerator covering only the first N against a denominator covering the whole file.
|
|
535
|
+
*/
|
|
536
|
+
interface TraceTaskStats {
|
|
537
|
+
taskIndex: number;
|
|
538
|
+
/**
|
|
539
|
+
* This turn is a **compaction turn** (compaction forms its own turn); the UI marks it with
|
|
540
|
+
* a "Compaction" badge accordingly. It's treated the same as a user turn: it has Token /
|
|
541
|
+
* cost / duration / TPS, and **counts normally toward global stats** — the global totals are
|
|
542
|
+
* just the sum of the per-turn cards below, the two scopes match, so adding up the per-turn
|
|
543
|
+
* numbers must equal the total.
|
|
544
|
+
*/
|
|
545
|
+
compaction?: boolean;
|
|
546
|
+
/**
|
|
547
|
+
* This turn's message index range within the **entire file** (inclusive). A single
|
|
548
|
+
* sequential scan on the server tells which turn each message belongs to; the frontend
|
|
549
|
+
* attributes messages by this, **no longer guessing by timestamp** — the same millisecond
|
|
550
|
+
* can pack "previous turn's last reply + compaction start + compaction prompt + next turn's
|
|
551
|
+
* request_begin", which time boundaries can't separate, misattributing this turn's reply to
|
|
552
|
+
* the next turn.
|
|
553
|
+
*/
|
|
554
|
+
messageFrom: number;
|
|
555
|
+
messageTo: number;
|
|
556
|
+
/**
|
|
557
|
+
* This turn's duration span: `startTs` = the moment of this turn's **first `request_begin`**
|
|
558
|
+
* — duration only looks at LLM requests, not the timestamp of user text like the user
|
|
559
|
+
* Prompt / compaction summary (`<context_summary>` is created during compaction but only
|
|
560
|
+
* persisted on the next run; resuming the next day would inflate the first turn by a whole
|
|
561
|
+
* day for no reason); `endTs` = the moment of the last non-session_meta message in the
|
|
562
|
+
* range. For a degenerate turn with no Request at all (interrupted right after sending),
|
|
563
|
+
* `startTs` is an empty string and duration counts as 0.
|
|
564
|
+
*/
|
|
565
|
+
startTs: string;
|
|
566
|
+
endTs: string;
|
|
567
|
+
/**
|
|
568
|
+
* Context usage at the end of this Task = the three-bucket Token snapshot of the last
|
|
569
|
+
* **non-compaction** Request (same convention as the Chat page's `contextNow`). Note this
|
|
570
|
+
* must not be the sum of this Task's Requests — each Request's input carries the full
|
|
571
|
+
* history again, so summing double-counts the context, and a few rounds of tool calls
|
|
572
|
+
* would blow past the context window. A pure-compaction Task (no non-compaction Request)
|
|
573
|
+
* has no value here.
|
|
574
|
+
*/
|
|
575
|
+
context?: {
|
|
576
|
+
cacheRead: number;
|
|
577
|
+
cacheWrite: number;
|
|
578
|
+
output: number;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* This turn's **cumulative** usage (the sum of the three buckets over every Request in this
|
|
582
|
+
* Task), for Token stats and cost conversion. Two different figures from `context`: that one
|
|
583
|
+
* is a snapshot (how much is occupied right now), this one is a ledger (how much this turn
|
|
584
|
+
* spent in total). Includes compaction requests — compaction tokens are real money spent and
|
|
585
|
+
* must be counted; consistent with the Chat page's tokensByBucket.
|
|
586
|
+
*/
|
|
587
|
+
tokens: {
|
|
588
|
+
cacheRead: number;
|
|
589
|
+
cacheWrite: number;
|
|
590
|
+
output: number;
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Total LLM generation duration for this turn (the denominator for output TPS; human
|
|
594
|
+
* approval wait already deducted). The numerator is simply `tokens.output`: since
|
|
595
|
+
* compaction forms its own turn, each turn's output tokens are just its own Requests'
|
|
596
|
+
* output — there's no second figure to reconcile.
|
|
597
|
+
*/
|
|
598
|
+
llmMs: number;
|
|
599
|
+
}
|
|
600
|
+
/** Duration span of a single tool call (complete tool_call message → paired tool_call_output). */
|
|
601
|
+
interface ToolCallSpan {
|
|
602
|
+
toolCallId: string;
|
|
603
|
+
name: string;
|
|
604
|
+
startTs: string;
|
|
605
|
+
endTs?: string;
|
|
606
|
+
durationMs?: number;
|
|
607
|
+
stopReason?: string;
|
|
608
|
+
}
|
|
609
|
+
/** Workspace file entry (Files tab). */
|
|
610
|
+
interface WorkspaceFileEntry {
|
|
611
|
+
name: string;
|
|
612
|
+
kind: "dir" | "file";
|
|
613
|
+
sizeBytes: number;
|
|
614
|
+
mtime: string;
|
|
615
|
+
}
|
|
616
|
+
interface WorkspaceFilesResponse {
|
|
617
|
+
/** Requested relative path ("" = Workspace root). */
|
|
618
|
+
path: string;
|
|
619
|
+
entries: WorkspaceFileEntry[];
|
|
620
|
+
}
|
|
621
|
+
/** Batch file existence check (message file cards only list files that actually exist). */
|
|
622
|
+
interface FilesStatRequest {
|
|
623
|
+
/** Paths relative to the Workspace root (≤100 items, each ≤512 characters). */
|
|
624
|
+
paths: string[];
|
|
625
|
+
}
|
|
626
|
+
interface FilesStatResponse {
|
|
627
|
+
/** Confirmed existing paths (regular files within bounds), preserving request order and deduplicated; out-of-bounds and resolution failures count as non-existent. */
|
|
628
|
+
existing: string[];
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Model serial segments (autoregressive decoding): Trace records completion times, so each
|
|
632
|
+
* segment's duration = its own time − the previous event's time (the request's first segment
|
|
633
|
+
* is based on request_begin; user input is treated as sent instantaneously and takes no
|
|
634
|
+
* segment).
|
|
635
|
+
*/
|
|
636
|
+
interface TraceModelSegment {
|
|
637
|
+
kind: "thinking" | "text" | "tool_call";
|
|
638
|
+
startTs: string;
|
|
639
|
+
endTs: string;
|
|
640
|
+
/** Given when kind=tool_call. */
|
|
641
|
+
toolCallId?: string;
|
|
642
|
+
name?: string;
|
|
643
|
+
/** The Task it belongs to (a single user turn can contain multiple Requests): the frontend groups by this, each Task on its own independent timeline. */
|
|
644
|
+
taskIndex: number;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Tool full lifecycle (parallel to model decoding): initiated (callTs) → approved
|
|
648
|
+
* (approvalTs) → output (outputTs). Unclosed fields are unset (approval pending / executing /
|
|
649
|
+
* file truncated).
|
|
650
|
+
*/
|
|
651
|
+
interface TraceToolSpan {
|
|
652
|
+
toolCallId: string;
|
|
653
|
+
name: string;
|
|
654
|
+
callTs: string;
|
|
655
|
+
approvalTs?: string;
|
|
656
|
+
decision?: string;
|
|
657
|
+
outputTs?: string;
|
|
658
|
+
stopReason?: string;
|
|
659
|
+
/** The Task that initiated this tool (grouped with its tool_call segment): async output belongs to this Task even if it arrives after request_end. */
|
|
660
|
+
taskIndex: number;
|
|
661
|
+
}
|
|
662
|
+
interface UsageTrendPointInTrace {
|
|
663
|
+
ts: string;
|
|
664
|
+
requestTotal: number;
|
|
665
|
+
sessionTotal: number;
|
|
666
|
+
}
|
|
667
|
+
interface TraceAnalysisResponse {
|
|
668
|
+
/**
|
|
669
|
+
* Sum of all turns' durations (**including compaction turns**, same scope as `tasks` — the
|
|
670
|
+
* global figure is just the sum of the per-turn figures below; gaps between turns where the
|
|
671
|
+
* user is thinking or away are not counted). Computed server-side over the entire file: the
|
|
672
|
+
* frontend's events are paginated, so self-aggregation would undercount.
|
|
673
|
+
*/
|
|
674
|
+
elapsedMs: number;
|
|
675
|
+
requests: RequestSpan[];
|
|
676
|
+
/** Token / duration aggregated per Task (used directly by the Trace page's context ring and per-turn TPS). */
|
|
677
|
+
tasks: TraceTaskStats[];
|
|
678
|
+
toolCalls: ToolCallSpan[];
|
|
679
|
+
/** Execution timeline: model serial segments (LLM lane). */
|
|
680
|
+
modelSegments: TraceModelSegment[];
|
|
681
|
+
/** Execution timeline: each tool's approval/execution phases (independent lane, can overlap with model decoding). */
|
|
682
|
+
toolSpans: TraceToolSpan[];
|
|
683
|
+
/** Number of request_end events with status ∈ {timeout, malformed}. */
|
|
684
|
+
reconnectCount: number;
|
|
685
|
+
/** Number of compaction_begin events. */
|
|
686
|
+
compactionCount: number;
|
|
687
|
+
usageTrend: UsageTrendPointInTrace[];
|
|
688
|
+
}
|
|
689
|
+
interface AgentTraceFileRef {
|
|
690
|
+
index: number;
|
|
691
|
+
sizeBytes: number;
|
|
692
|
+
}
|
|
693
|
+
interface AgentTraceSessionGroup {
|
|
694
|
+
sessionId: string;
|
|
695
|
+
files: AgentTraceFileRef[];
|
|
696
|
+
}
|
|
697
|
+
interface AgentTraceDateGroup {
|
|
698
|
+
date: string;
|
|
699
|
+
sessions: AgentTraceSessionGroup[];
|
|
700
|
+
}
|
|
701
|
+
/** Agent → date → Session → Trace file drill-down browsing structure (reverse chronological). */
|
|
702
|
+
interface AgentTracesResponse {
|
|
703
|
+
dates: AgentTraceDateGroup[];
|
|
704
|
+
}
|
|
705
|
+
type UsageGroupBy = "date" | "agent" | "model" | "session";
|
|
706
|
+
interface UsageBucket {
|
|
707
|
+
total: number;
|
|
708
|
+
requests: number;
|
|
709
|
+
/** Cost converted using current pricing at query time (USD); a partial sum when uncosted Models are included, null if none has pricing. */
|
|
710
|
+
cost: number | null;
|
|
711
|
+
/** Whether any Model has no pricing (its usage isn't included in cost; counted once pricing is added later). */
|
|
712
|
+
hasUncosted: boolean;
|
|
713
|
+
}
|
|
714
|
+
interface UsageGroupRow {
|
|
715
|
+
/** Group key: date / agentId / modelId / sessionId. */
|
|
716
|
+
key: string;
|
|
717
|
+
/** Provider group when groupBy=model (rows are broken down by (provider, modelId); unset for other dimensions). */
|
|
718
|
+
provider?: string;
|
|
719
|
+
cacheRead: number;
|
|
720
|
+
cacheWrite: number;
|
|
721
|
+
output: number;
|
|
722
|
+
total: number;
|
|
723
|
+
requests: number;
|
|
724
|
+
cost: number | null;
|
|
725
|
+
hasUncosted: boolean;
|
|
726
|
+
}
|
|
727
|
+
interface UsageTrendPoint {
|
|
728
|
+
date: string;
|
|
729
|
+
total: number;
|
|
730
|
+
cost: number | null;
|
|
731
|
+
/** Daily Token buckets (for the cost center's "Token Changes" stacked chart: cacheRead/cacheWrite/output). */
|
|
732
|
+
cacheRead: number;
|
|
733
|
+
cacheWrite: number;
|
|
734
|
+
output: number;
|
|
735
|
+
}
|
|
736
|
+
/** Invocation count per Agent (for the cost center's "Agent Invocation Count" chart). */
|
|
737
|
+
interface UsageAgentCount {
|
|
738
|
+
agentId: string;
|
|
739
|
+
requests: number;
|
|
740
|
+
total: number;
|
|
741
|
+
}
|
|
742
|
+
/** Request success rate per Model (for the cost center's "Model Success Rate" chart; rows broken down by (provider, modelId)). */
|
|
743
|
+
interface UsageSuccessRate {
|
|
744
|
+
provider: string;
|
|
745
|
+
modelId: string;
|
|
746
|
+
/** Number of successful requests. */
|
|
747
|
+
completed: number;
|
|
748
|
+
/** Success rate denominator = all requests − aborted (user-initiated interruption isn't a model failure and shouldn't lower the success rate). */
|
|
749
|
+
total: number;
|
|
750
|
+
/** Count of user interruptions (excluded from success rate, shown separately). */
|
|
751
|
+
aborted: number;
|
|
752
|
+
/** Failure breakdown (shown on hover; unknown statuses count toward total but not these three). */
|
|
753
|
+
failed: number;
|
|
754
|
+
timeout: number;
|
|
755
|
+
malformed: number;
|
|
756
|
+
}
|
|
757
|
+
/** Occurrence count of an error for a given source · code (the "most common" metric in the stats center's error panel). */
|
|
758
|
+
interface UsageErrorCount {
|
|
759
|
+
source: string;
|
|
760
|
+
code: string;
|
|
761
|
+
kind: string;
|
|
762
|
+
count: number;
|
|
763
|
+
}
|
|
764
|
+
/** A single error summary (one row in the stats center's error panel table). */
|
|
765
|
+
interface UsageErrorItem {
|
|
766
|
+
ts: string;
|
|
767
|
+
source: string;
|
|
768
|
+
code: string;
|
|
769
|
+
kind: string;
|
|
770
|
+
message: string;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Server-side error capture stats: not affected by the model
|
|
774
|
+
* filter (HTTP / process errors have no Model dimension), but affected by date and agent
|
|
775
|
+
* filters. Errors with no Project attribution (login, process-level) are counted in every
|
|
776
|
+
* Project's view. The stats center presents this as "summary stats + detail table" with no
|
|
777
|
+
* chart, so it only has a total count, the most common error code, and the most recent N
|
|
778
|
+
* items.
|
|
779
|
+
*/
|
|
780
|
+
interface UsageErrors {
|
|
781
|
+
total: number;
|
|
782
|
+
/** Count of unexpected ones (500 / runtime exceptions) among them — the part the frontend highlights. */
|
|
783
|
+
unexpected: number;
|
|
784
|
+
/** The most frequent source · code (null when there are no errors). */
|
|
785
|
+
topCode: UsageErrorCount | null;
|
|
786
|
+
/** Most recent N items (reverse chronological). */
|
|
787
|
+
recent: UsageErrorItem[];
|
|
788
|
+
}
|
|
789
|
+
interface UsageResponse {
|
|
790
|
+
summary: {
|
|
791
|
+
today: UsageBucket;
|
|
792
|
+
last7d: UsageBucket;
|
|
793
|
+
total: UsageBucket;
|
|
794
|
+
};
|
|
795
|
+
groupBy: UsageGroupBy;
|
|
796
|
+
groups: UsageGroupRow[];
|
|
797
|
+
/** Daily trend for the last 30 days (includes Token buckets and cost; affected by agent/model filters). */
|
|
798
|
+
trend: UsageTrendPoint[];
|
|
799
|
+
/** Invocation count per Agent (affected by date/model filters). */
|
|
800
|
+
byAgent: UsageAgentCount[];
|
|
801
|
+
/** Raw success rate counts per Model (affected by date/agent filters). */
|
|
802
|
+
success: UsageSuccessRate[];
|
|
803
|
+
/** Server-side error capture stats (affected by date/agent filters; unaffected by model filter). */
|
|
804
|
+
errors: UsageErrors;
|
|
805
|
+
/** List of Agent ids that have appeared in this Project (for the filter dropdown; unaffected by current filters). */
|
|
806
|
+
agentIds: string[];
|
|
807
|
+
/** List of Model paired references that have appeared in this Project (for the filter dropdown). */
|
|
808
|
+
models: ModelRefDto[];
|
|
809
|
+
}
|
|
810
|
+
/** Display-facing schedule status: the file's `enabled` only expresses intent; the rest is derived from runtime state. */
|
|
811
|
+
type ScheduleStatus = "active" | "disabled" | "expired" | "done" | "missed" | "invalid";
|
|
812
|
+
interface ScheduleItem {
|
|
813
|
+
/** Filename (without .toml) is the identifier. */
|
|
814
|
+
name: string;
|
|
815
|
+
prompt: string;
|
|
816
|
+
enabled: boolean;
|
|
817
|
+
/** ISO 8601. */
|
|
818
|
+
startAt: string;
|
|
819
|
+
/** Raw fixed interval (e.g. `30m`); unset means a one-off task. */
|
|
820
|
+
period?: string;
|
|
821
|
+
endAt?: string;
|
|
822
|
+
/** Bound target Session; defaults to creating a new Session each time. */
|
|
823
|
+
sessionId?: string;
|
|
824
|
+
workspace?: string;
|
|
825
|
+
/** Model for new-Session mode (upstream id, paired with provider); defaults to the Project's default reference. */
|
|
826
|
+
modelId?: string;
|
|
827
|
+
/** Provider group for `modelId`; when omitted, resolved via resolveModelRef semantics (resolvable only on a unique match). */
|
|
828
|
+
provider?: string;
|
|
829
|
+
status: ScheduleStatus;
|
|
830
|
+
invalidReason?: string;
|
|
831
|
+
/** Next scheduled fire time (ISO 8601); unset when done/missed/invalid/disabled. */
|
|
832
|
+
nextFireAt?: string;
|
|
833
|
+
/** Most recent actual fire time (ISO 8601). */
|
|
834
|
+
lastFiredAt?: string;
|
|
835
|
+
/** Queued, waiting for the target Session to become idle. */
|
|
836
|
+
queued: boolean;
|
|
837
|
+
creatorUserId?: string;
|
|
838
|
+
}
|
|
839
|
+
interface SchedulesResponse {
|
|
840
|
+
schedules: ScheduleItem[];
|
|
841
|
+
/** Files that failed to parse (skipped from scheduling and logged as errors). */
|
|
842
|
+
invalidFiles: Array<{
|
|
843
|
+
name: string;
|
|
844
|
+
error: string;
|
|
845
|
+
}>;
|
|
846
|
+
}
|
|
847
|
+
interface ScheduleUpsertRequest {
|
|
848
|
+
prompt: string;
|
|
849
|
+
enabled: boolean;
|
|
850
|
+
startAt: string;
|
|
851
|
+
period?: string;
|
|
852
|
+
endAt?: string;
|
|
853
|
+
sessionId?: string;
|
|
854
|
+
workspace?: string;
|
|
855
|
+
/** Model for new-Session mode (upstream id); defaults to the Project's default reference. */
|
|
856
|
+
modelId?: string;
|
|
857
|
+
/** Provider group for `modelId`; when omitted, validated as uniquely resolvable via resolveModelRef semantics at save/reconciliation time. */
|
|
858
|
+
provider?: string;
|
|
859
|
+
}
|
|
860
|
+
interface AgentImportRequest {
|
|
861
|
+
/** Base64 of the snapshot package (tar.gz). */
|
|
862
|
+
dataBase64: string;
|
|
863
|
+
/** Explicit confirmation is required when the package version is equal to or lower than the current version, otherwise 409. */
|
|
864
|
+
confirm?: boolean;
|
|
865
|
+
}
|
|
866
|
+
interface AgentImportResponse {
|
|
867
|
+
/** Agent State version number after import (taken from the package's value). */
|
|
868
|
+
version: number;
|
|
869
|
+
}
|
|
870
|
+
/** Raw result of a single run (a scoreboard per-case runs[] entry). */
|
|
871
|
+
interface BenchmarkRunScore {
|
|
872
|
+
score: number;
|
|
873
|
+
cost?: number;
|
|
874
|
+
durationMs?: number;
|
|
875
|
+
/** Id of the Session under test in this run (links to Trace). */
|
|
876
|
+
sessionId?: string;
|
|
877
|
+
}
|
|
878
|
+
interface BenchmarkCaseScore {
|
|
879
|
+
case: string;
|
|
880
|
+
/** Per-case score = average of runs (equals that single run's score under the legacy single-run format). */
|
|
881
|
+
score: number;
|
|
882
|
+
cost?: number;
|
|
883
|
+
durationMs?: number;
|
|
884
|
+
/** For legacy format compatibility: per-case single Session id (new format keeps it inside runs[]). */
|
|
885
|
+
sessionId?: string;
|
|
886
|
+
/** Raw results per run; unset under the legacy format (the server backfills one entry when parsing as a single run). */
|
|
887
|
+
runs?: BenchmarkRunScore[];
|
|
888
|
+
}
|
|
889
|
+
interface BenchmarkEvaluation {
|
|
890
|
+
/** Evaluation timestamp (ISO 8601). */
|
|
891
|
+
time: string;
|
|
892
|
+
/** Evaluation summary title (a one-line conclusion; shown separately from the body summary; required when generating, tolerated as unset when displaying). */
|
|
893
|
+
summaryTitle?: string;
|
|
894
|
+
/** Evaluation summary body: how the score was derived, what optimizations were made to the Agent this round (required when generating, tolerated as unset when displaying). */
|
|
895
|
+
summary?: string;
|
|
896
|
+
/** Model actually used for this evaluation round (upstream id, paired with provider; the chart series is split by model). */
|
|
897
|
+
modelId?: string;
|
|
898
|
+
/** Provider group for `modelId`. */
|
|
899
|
+
provider?: string;
|
|
900
|
+
/** Agent State version number under test. */
|
|
901
|
+
version?: number;
|
|
902
|
+
/** Total score (sum of per-case scores; max score defined by the scoring rubric). */
|
|
903
|
+
score: number;
|
|
904
|
+
cost?: number;
|
|
905
|
+
durationMs?: number;
|
|
906
|
+
cases: BenchmarkCaseScore[];
|
|
907
|
+
}
|
|
908
|
+
interface BenchmarkSummary {
|
|
909
|
+
/** Directory name is the identifier (semantic naming, e.g. swe-bench-v1). */
|
|
910
|
+
id: string;
|
|
911
|
+
/** Title from benchmark_config.toml; falls back to the directory name if unset. */
|
|
912
|
+
title: string;
|
|
913
|
+
description?: string;
|
|
914
|
+
/** Number of runs per case (the `runs` field in benchmark_config.toml, ≥1; defaults to 1). */
|
|
915
|
+
runs?: number;
|
|
916
|
+
/** Case count (number of case subfolders). */
|
|
917
|
+
caseCount: number;
|
|
918
|
+
/** Time-ordered evaluation records (the evaluations[] in scoreboard.yaml). */
|
|
919
|
+
evaluations: BenchmarkEvaluation[];
|
|
920
|
+
}
|
|
921
|
+
interface BenchmarksResponse {
|
|
922
|
+
benchmarks: BenchmarkSummary[];
|
|
923
|
+
}
|
|
924
|
+
interface SkillMetadataItem {
|
|
925
|
+
/** Skill directory name (the identity key for install / uninstall / Prompt addressing). */
|
|
926
|
+
name: string;
|
|
927
|
+
description: string;
|
|
928
|
+
/** Short description for frontend display (frontmatter short_description, optional; falls back to description if missing). */
|
|
929
|
+
shortDescription?: string;
|
|
930
|
+
shortDescriptionZh?: string;
|
|
931
|
+
/** Custom icon (raw icon.svg text from the skill directory, optional; frontend falls back to a default book icon if missing). */
|
|
932
|
+
icon?: string;
|
|
933
|
+
/** Version number (natural number, frontmatter version; falls back to 1 if invalid). */
|
|
934
|
+
version: number;
|
|
935
|
+
/** Update date (YYYY-MM-DD, frontmatter updated; defaults to an empty string). */
|
|
936
|
+
updated: string;
|
|
937
|
+
}
|
|
938
|
+
interface SkillGroupItem {
|
|
939
|
+
id: string;
|
|
940
|
+
title: string;
|
|
941
|
+
/** Chinese group title (optional; the UI displays it per language). */
|
|
942
|
+
titleZh?: string;
|
|
943
|
+
skills: SkillMetadataItem[];
|
|
944
|
+
}
|
|
945
|
+
/** GET /api/skills: library groups and metadata (excludes body content). */
|
|
946
|
+
interface SkillLibraryResponse {
|
|
947
|
+
groups: SkillGroupItem[];
|
|
948
|
+
}
|
|
949
|
+
/** GET|POST /api/projects/:p/agents/:a/skills: Skills installed on this Agent. */
|
|
950
|
+
interface AgentSkillsResponse {
|
|
951
|
+
skills: SkillMetadataItem[];
|
|
952
|
+
}
|
|
953
|
+
/** POST install request: all names must exist in the library; already-installed ones are overwritten with library content (i.e. updated). */
|
|
954
|
+
interface SkillInstallRequest {
|
|
955
|
+
names: string[];
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
export type { AdminPasswordResetRequest, AdminUserCreateRequest, AdminUserCreateResponse, AdminUsersResponse, AgentCompactionConfigDto, AgentConfigDto, AgentConfigResponse, AgentConfigUpdateRequest, AgentCreateRequest, AgentCreateResponse, AgentImportRequest, AgentImportResponse, AgentModelConfigDto, AgentSkillsResponse, AgentSummary, AgentTraceDateGroup, AgentTraceFileRef, AgentTraceSessionGroup, AgentTracesResponse, AgentsResponse, ApprovalDecisionRequest, ApprovalMode, AuthLoginRequest, AuthResponse, BenchmarkCaseScore, BenchmarkEvaluation, BenchmarkRunScore, BenchmarkSummary, BenchmarksResponse, CredentialInfo, DirEntryInfo, DirListResponse, ErrorBody, FilesStatRequest, FilesStatResponse, MeResponse, MemberAddRequest, MemberAddResponse, MemberInfo, MembersResponse, MessagesResponse, ModelInfo, ModelPricingDto, ModelRefDto, ModelTestRequest, ModelTestResponse, ModelUpdateEntry, ModelsResponse, ModelsUpdateRequest, PasswordChangeRequest, PrefsResponse, ProjectCreateRequest, ProjectCreateResponse, ProjectRole, ProjectSummary, ProjectsResponse, RequestSpan, ScheduleItem, ScheduleServerEvent, ScheduleStatus, ScheduleUpsertRequest, SchedulesResponse, ServerEvent, SessionCreateRequest, SessionCreateResponse, SessionInfo, SessionPatchRequest, SessionResponse, SessionSource, SessionStatus, SessionTracesResponse, SessionsResponse, SkillGroupItem, SkillInstallRequest, SkillLibraryResponse, SkillMetadataItem, TaskCreateRequest, TaskCreateResponse, TaskInputPart, ToolCallSpan, TraceAnalysisResponse, TraceEventsResponse, TraceFileInfo, TraceModelSegment, TraceTaskStats, TraceToolSpan, UiPrefs, UsageAgentCount, UsageBucket, UsageErrorCount, UsageErrorItem, UsageErrors, UsageGroupBy, UsageGroupRow, UsageResponse, UsageSuccessRate, UsageTrendPoint, UsageTrendPointInTrace, UserInfo, VaultEntryInfo, VaultEntryUpdate, VaultResponse, VaultUpdateRequest, WorkspaceFileEntry, WorkspaceFilesResponse };
|