ompchamber 0.3.0
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/README.md +253 -0
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/icon-192x192.png +0 -0
- package/dist/client/icon-512x512.png +0 -0
- package/dist/client/icon-maskable-512x512.png +0 -0
- package/dist/client/icon.svg +60 -0
- package/dist/client/index.html +41 -0
- package/dist/client/manifest.webmanifest +38 -0
- package/dist/client/static/css/g.f36aa429fa.css +1 -0
- package/dist/client/static/css/index.a0f07455bd.css +2 -0
- package/dist/client/static/css/katex-vendor.ca3a0600e8.css +1 -0
- package/dist/client/static/font/KaTeX_AMS-Regular.1608a09b4a.woff +0 -0
- package/dist/client/static/font/KaTeX_AMS-Regular.4aafdb685c.ttf +0 -0
- package/dist/client/static/font/KaTeX_AMS-Regular.a79f1c3119.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Bold.b67709187b.woff +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Bold.cce5b8ecea.ttf +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Bold.ec17d13264.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Regular.07ef19e7b0.ttf +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Regular.55fac25845.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Caligraphic-Regular.dad44a7fc6.woff +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Bold.9f256b8593.woff +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Bold.b18f59e1d1.ttf +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Bold.d42a5579b0.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Regular.7c1871215e.woff +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Regular.d3c882a649.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Fraktur-Regular.ed38e79f57.ttf +0 -0
- package/dist/client/static/font/KaTeX_Main-Bold.b74a1a8b2c.ttf +0 -0
- package/dist/client/static/font/KaTeX_Main-Bold.c3fb5ac22f.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Main-Bold.d181c4650d.woff +0 -0
- package/dist/client/static/font/KaTeX_Main-BoldItalic.6f2bb1dff2.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Main-BoldItalic.70d8b0a530.ttf +0 -0
- package/dist/client/static/font/KaTeX_Main-BoldItalic.e3f82f9d27.woff +0 -0
- package/dist/client/static/font/KaTeX_Main-Italic.47373d1e51.ttf +0 -0
- package/dist/client/static/font/KaTeX_Main-Italic.8916142bec.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Main-Italic.9024d815ba.woff +0 -0
- package/dist/client/static/font/KaTeX_Main-Regular.0462f03bdf.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Main-Regular.7f51fe0340.woff +0 -0
- package/dist/client/static/font/KaTeX_Main-Regular.b7f8fe9b5f.ttf +0 -0
- package/dist/client/static/font/KaTeX_Math-BoldItalic.572d331f69.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Math-BoldItalic.a879cf8383.ttf +0 -0
- package/dist/client/static/font/KaTeX_Math-BoldItalic.f1035d8d5d.woff +0 -0
- package/dist/client/static/font/KaTeX_Math-Italic.5295ba483a.woff +0 -0
- package/dist/client/static/font/KaTeX_Math-Italic.939bc64440.ttf +0 -0
- package/dist/client/static/font/KaTeX_Math-Italic.f28c23acad.woff2 +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Bold.8c5b5494b6.woff2 +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Bold.94e1e8dc5f.ttf +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Bold.bf59d231c3.woff +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Italic.3b1e59b3ba.woff2 +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Italic.7c9bc82b17.woff +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Italic.b4c20c84d8.ttf +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Regular.740484788f.woff +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Regular.ba21ed5f84.woff2 +0 -0
- package/dist/client/static/font/KaTeX_SansSerif-Regular.d4d7ba4804.ttf +0 -0
- package/dist/client/static/font/KaTeX_Script-Regular.03e9641d6f.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Script-Regular.0750571032.woff +0 -0
- package/dist/client/static/font/KaTeX_Script-Regular.fe9cbbe1a0.ttf +0 -0
- package/dist/client/static/font/KaTeX_Size1-Regular.e1e279cbdd.woff +0 -0
- package/dist/client/static/font/KaTeX_Size1-Regular.eae34984b3.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Size1-Regular.fabc004aab.ttf +0 -0
- package/dist/client/static/font/KaTeX_Size2-Regular.577270225e.woff +0 -0
- package/dist/client/static/font/KaTeX_Size2-Regular.5916a24fa3.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Size2-Regular.d6b476ecd3.ttf +0 -0
- package/dist/client/static/font/KaTeX_Size3-Regular.9acaf01c64.woff +0 -0
- package/dist/client/static/font/KaTeX_Size3-Regular.a144ef5840.ttf +0 -0
- package/dist/client/static/font/KaTeX_Size4-Regular.10d95fd3a2.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Size4-Regular.7a996c9da2.woff +0 -0
- package/dist/client/static/font/KaTeX_Size4-Regular.fbccdabe0a.ttf +0 -0
- package/dist/client/static/font/KaTeX_Typewriter-Regular.6258592bdc.woff +0 -0
- package/dist/client/static/font/KaTeX_Typewriter-Regular.a8709e3622.woff2 +0 -0
- package/dist/client/static/font/KaTeX_Typewriter-Regular.d97aaf4a1e.ttf +0 -0
- package/dist/client/static/font/fira-code-cyrillic-400-normal.5971438a4a.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-400-normal.9bb7bfea9c.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-500-normal.5486265b18.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-500-normal.89f92bfb31.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-600-normal.2805b497e5.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-600-normal.86e0df22a3.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-700-normal.505a88f22a.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-700-normal.76f5e8d2e2.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-400-normal.3c4b15e57d.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-400-normal.61323debaa.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-500-normal.0f34210f2a.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-500-normal.2497cfa1aa.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-600-normal.40fce94af9.woff2 +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-600-normal.6c8774b829.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-700-normal.4b742eb865.woff +0 -0
- package/dist/client/static/font/fira-code-cyrillic-ext-700-normal.e75eb4fccc.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-400-normal.bb900468b6.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-400-normal.be76e699ba.woff +0 -0
- package/dist/client/static/font/fira-code-greek-500-normal.176c9fb001.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-500-normal.d2c596136b.woff +0 -0
- package/dist/client/static/font/fira-code-greek-600-normal.490c3deed7.woff +0 -0
- package/dist/client/static/font/fira-code-greek-600-normal.7df14376d9.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-700-normal.c82b6072fc.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-700-normal.d5f2b2917b.woff +0 -0
- package/dist/client/static/font/fira-code-greek-ext-400-normal.4849a79781.woff +0 -0
- package/dist/client/static/font/fira-code-greek-ext-400-normal.7f5bfc4538.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-ext-500-normal.aaccca4075.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-ext-500-normal.e383181256.woff +0 -0
- package/dist/client/static/font/fira-code-greek-ext-600-normal.78cb4bff8e.woff +0 -0
- package/dist/client/static/font/fira-code-greek-ext-600-normal.d6c93d54f9.woff2 +0 -0
- package/dist/client/static/font/fira-code-greek-ext-700-normal.57ec7c92d9.woff +0 -0
- package/dist/client/static/font/fira-code-greek-ext-700-normal.8fafdae5e8.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-400-normal.2655b10c55.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-400-normal.973295532b.woff +0 -0
- package/dist/client/static/font/fira-code-latin-500-normal.7ae2be8fb8.woff +0 -0
- package/dist/client/static/font/fira-code-latin-500-normal.92a991f204.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-600-normal.1dbbe5bc27.woff +0 -0
- package/dist/client/static/font/fira-code-latin-600-normal.43788eb7f1.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-700-normal.2667215d33.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-700-normal.497a70148b.woff +0 -0
- package/dist/client/static/font/fira-code-latin-ext-400-normal.9dfae29aaf.woff +0 -0
- package/dist/client/static/font/fira-code-latin-ext-400-normal.e534ae46e2.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-ext-500-normal.24c7b781b0.woff +0 -0
- package/dist/client/static/font/fira-code-latin-ext-500-normal.aad44ab072.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-ext-600-normal.7bed0f2f7e.woff +0 -0
- package/dist/client/static/font/fira-code-latin-ext-600-normal.c509a7c9f1.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-ext-700-normal.6c66c8b0a9.woff2 +0 -0
- package/dist/client/static/font/fira-code-latin-ext-700-normal.88f64e2822.woff +0 -0
- package/dist/client/static/font/fira-code-symbols2-400-normal.97d3f4b17c.woff +0 -0
- package/dist/client/static/font/fira-code-symbols2-500-normal.b06f1a06e4.woff +0 -0
- package/dist/client/static/font/fira-code-symbols2-600-normal.304b653b93.woff +0 -0
- package/dist/client/static/font/fira-code-symbols2-700-normal.d8ce0ad586.woff +0 -0
- package/dist/client/static/js/async/0.8e59f2eb5b.js +1 -0
- package/dist/client/static/js/async/0k.5852e6b4fa.js +1 -0
- package/dist/client/static/js/async/0w.9ed36d5860.js +1 -0
- package/dist/client/static/js/async/1.f387c12b63.js +1 -0
- package/dist/client/static/js/async/12.d091f91c99.js +1 -0
- package/dist/client/static/js/async/13.8f810a8a6c.js +1 -0
- package/dist/client/static/js/async/19.6fe909d55a.js +160 -0
- package/dist/client/static/js/async/1b.23f1141a38.js +1 -0
- package/dist/client/static/js/async/1k.544adbf77d.js +2 -0
- package/dist/client/static/js/async/1k.544adbf77d.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/1p.0d5cddda96.js +1 -0
- package/dist/client/static/js/async/2.b589f1733b.js +1 -0
- package/dist/client/static/js/async/2v.96165101de.js +1 -0
- package/dist/client/static/js/async/3.0cacc08423.js +1 -0
- package/dist/client/static/js/async/37.b28b2f61cd.js +1 -0
- package/dist/client/static/js/async/3d.5085fb913f.js +1 -0
- package/dist/client/static/js/async/3j.a2fcea99be.js +2 -0
- package/dist/client/static/js/async/3j.a2fcea99be.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/3p.bcf32a0983.js +1 -0
- package/dist/client/static/js/async/3r.3a69e98ee0.js +64 -0
- package/dist/client/static/js/async/3u.1228460e2a.js +1 -0
- package/dist/client/static/js/async/3y.22075aa079.js +198 -0
- package/dist/client/static/js/async/3y.22075aa079.js.LICENSE.txt +5 -0
- package/dist/client/static/js/async/4.9442eeb472.js +1 -0
- package/dist/client/static/js/async/4e.678285ca55.js +1 -0
- package/dist/client/static/js/async/4k.33a0c7eeb4.js +1 -0
- package/dist/client/static/js/async/4q.aad20dab25.js +1 -0
- package/dist/client/static/js/async/5.ebaf8b89cc.js +36 -0
- package/dist/client/static/js/async/51.1938cec320.js +2 -0
- package/dist/client/static/js/async/51.1938cec320.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/5b.d88304bc13.js +1 -0
- package/dist/client/static/js/async/5j.d6407c4248.js +287 -0
- package/dist/client/static/js/async/5o.88316d4460.js +62 -0
- package/dist/client/static/js/async/6.7929428505.js +1 -0
- package/dist/client/static/js/async/66.5dfa29f957.js +93 -0
- package/dist/client/static/js/async/69.a18a10882f.js +1 -0
- package/dist/client/static/js/async/6o.5b1a06a382.js +1 -0
- package/dist/client/static/js/async/7.e4a9288dd0.js +1 -0
- package/dist/client/static/js/async/73.50280ce58d.js +1 -0
- package/dist/client/static/js/async/7e.a1cc9bfd88.js +1 -0
- package/dist/client/static/js/async/7l.7a6a377ecc.js +1 -0
- package/dist/client/static/js/async/8.5067439d8c.js +1 -0
- package/dist/client/static/js/async/8j.ea110663fb.js +1 -0
- package/dist/client/static/js/async/a.bce4542392.js +1 -0
- package/dist/client/static/js/async/aa.65d3852576.js +1 -0
- package/dist/client/static/js/async/ar.9dc8b1992a.js +2 -0
- package/dist/client/static/js/async/ar.9dc8b1992a.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/az.d656062b0f.js +1 -0
- package/dist/client/static/js/async/b.b4f6f06515.js +1 -0
- package/dist/client/static/js/async/bi.cbfe8eaa8e.js +1 -0
- package/dist/client/static/js/async/bq.586bc738d1.js +1 -0
- package/dist/client/static/js/async/c.cd45b0ac45.js +1 -0
- package/dist/client/static/js/async/c0.0af1e640d3.js +24 -0
- package/dist/client/static/js/async/ca.8a52cfd447.js +1 -0
- package/dist/client/static/js/async/cf.d34fff5d67.js +1 -0
- package/dist/client/static/js/async/ct.38d9da8a5a.js +1 -0
- package/dist/client/static/js/async/cx.ca5feec570.js +226 -0
- package/dist/client/static/js/async/d.a5fc8fe1b3.js +1 -0
- package/dist/client/static/js/async/da.f62c70f6c8.js +1 -0
- package/dist/client/static/js/async/dp.1725d6432c.js +1 -0
- package/dist/client/static/js/async/e.93214d622b.js +79 -0
- package/dist/client/static/js/async/f.ab50467719.js +19 -0
- package/dist/client/static/js/async/f.ab50467719.js.LICENSE.txt +12 -0
- package/dist/client/static/js/async/f8.bbf0dbae70.js +1 -0
- package/dist/client/static/js/async/fw.fb1a08b92d.js +6 -0
- package/dist/client/static/js/async/fw.fb1a08b92d.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/h.4e790471e4.js +27 -0
- package/dist/client/static/js/async/h1.e8d5aa8e80.js +1 -0
- package/dist/client/static/js/async/h3.216e9798ab.js +148 -0
- package/dist/client/static/js/async/hd.0da931b622.js +1 -0
- package/dist/client/static/js/async/hk.ba7fb04d41.js +1 -0
- package/dist/client/static/js/async/hn.7568bdb58b.js +1 -0
- package/dist/client/static/js/async/ho.475a5e1ae4.js +1 -0
- package/dist/client/static/js/async/hp.e9fe2e395a.js +2 -0
- package/dist/client/static/js/async/hp.e9fe2e395a.js.LICENSE.txt +17 -0
- package/dist/client/static/js/async/hs.6d480d0ded.js +41 -0
- package/dist/client/static/js/async/i.7c148e8440.js +1 -0
- package/dist/client/static/js/async/id.573df20f29.js +1 -0
- package/dist/client/static/js/async/j.ab925882d8.js +1 -0
- package/dist/client/static/js/async/jd.63886a1f09.js +1 -0
- package/dist/client/static/js/async/jg.69a4beade8.js +86 -0
- package/dist/client/static/js/async/jl.874d352278.js +1 -0
- package/dist/client/static/js/async/jll.11313b455a.js +1 -0
- package/dist/client/static/js/async/js.67182759ef.js +1 -0
- package/dist/client/static/js/async/jsc.23b70d6f40.js +1 -0
- package/dist/client/static/js/async/jse.334588ff5d.js +1 -0
- package/dist/client/static/js/async/jz.72eb929106.js +77 -0
- package/dist/client/static/js/async/k.e878dd350f.js +217 -0
- package/dist/client/static/js/async/ka.c1990ecaa3.js +115 -0
- package/dist/client/static/js/async/ku.29c8a59d0c.js +1 -0
- package/dist/client/static/js/async/ky.8dab1dade0.js +1 -0
- package/dist/client/static/js/async/l.102a97fce6.js +104 -0
- package/dist/client/static/js/async/l6.45f3b62e15.js +1 -0
- package/dist/client/static/js/async/l9.949710adaf.js +83 -0
- package/dist/client/static/js/async/l9.949710adaf.js.LICENSE.txt +13 -0
- package/dist/client/static/js/async/m.3fc017a055.js +28 -0
- package/dist/client/static/js/async/m.3fc017a055.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/me.8ace414f80.js +23 -0
- package/dist/client/static/js/async/mt.0352e976d8.js +1 -0
- package/dist/client/static/js/async/n.a9f1c51701.js +1 -0
- package/dist/client/static/js/async/na.a36cd532d6.js +1 -0
- package/dist/client/static/js/async/nk.6de011832e.js +1 -0
- package/dist/client/static/js/async/o.36353dfb88.js +1 -0
- package/dist/client/static/js/async/oc.9c060c9779.js +8 -0
- package/dist/client/static/js/async/og.ae7acf03ac.js +193 -0
- package/dist/client/static/js/async/p.48ecfcd14e.js +1 -0
- package/dist/client/static/js/async/px.783b6f91f2.js +1 -0
- package/dist/client/static/js/async/q.0b6fb9bf8d.js +21 -0
- package/dist/client/static/js/async/q.0b6fb9bf8d.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/q5.e683f7c26e.js +286 -0
- package/dist/client/static/js/async/qs.2a9ddb3c72.js +1 -0
- package/dist/client/static/js/async/r.51010ad87c.js +1 -0
- package/dist/client/static/js/async/rd.b77011ab7f.js +2 -0
- package/dist/client/static/js/async/rd.b77011ab7f.js.LICENSE.txt +4 -0
- package/dist/client/static/js/async/rf.cfbde7f744.js +2 -0
- package/dist/client/static/js/async/rf.cfbde7f744.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/s.c7d521a8ae.js +2 -0
- package/dist/client/static/js/async/s.c7d521a8ae.js.LICENSE.txt +6 -0
- package/dist/client/static/js/async/sy.7345abcd67.js +94 -0
- package/dist/client/static/js/async/t.0dcb01dfde.js +1 -0
- package/dist/client/static/js/async/t9.d44f57d518.js +1 -0
- package/dist/client/static/js/async/ta.973534bbec.js +1 -0
- package/dist/client/static/js/async/ty.3d93cf5f5f.js +1 -0
- package/dist/client/static/js/async/u.0871ac5b22.js +1 -0
- package/dist/client/static/js/async/up.ea990da0ff.js +32 -0
- package/dist/client/static/js/async/uw.8890abbabc.js +1 -0
- package/dist/client/static/js/async/v.5c7a4b087b.js +1 -0
- package/dist/client/static/js/async/vn.e98e2f3b61.js +309 -0
- package/dist/client/static/js/async/vp.9b13bf8610.js +1 -0
- package/dist/client/static/js/async/vu.311f1d202c.js +34 -0
- package/dist/client/static/js/async/w.08ac210f60.js +1 -0
- package/dist/client/static/js/async/wt.ad92393a90.js +1 -0
- package/dist/client/static/js/async/x.563f72ca6b.js +1 -0
- package/dist/client/static/js/async/x0.475516418f.js +1 -0
- package/dist/client/static/js/async/x1.da8687159b.js +90 -0
- package/dist/client/static/js/async/xl.a3c562a58c.js +1 -0
- package/dist/client/static/js/async/xn.afecebbbd9.js +2 -0
- package/dist/client/static/js/async/xn.afecebbbd9.js.LICENSE.txt +12 -0
- package/dist/client/static/js/async/y.1a9ed7a5d8.js +1 -0
- package/dist/client/static/js/async/y6.43c57defe4.js +1 -0
- package/dist/client/static/js/async/yb.8c1342401d.js +1 -0
- package/dist/client/static/js/async/ybq.4491f2f2dc.js +1 -0
- package/dist/client/static/js/async/yg.9bd4e09ecb.js +149 -0
- package/dist/client/static/js/async/yq.917ddd7ba2.js +1 -0
- package/dist/client/static/js/async/ys.00687cf82d.js +38 -0
- package/dist/client/static/js/async/yv.593a3f7d54.js +1 -0
- package/dist/client/static/js/async/z.56f61a4374.js +1 -0
- package/dist/client/static/js/async/zi.5fdb07b86a.js +24 -0
- package/dist/client/static/js/async/zj.654f37e8ff.js +1 -0
- package/dist/client/static/js/async/zn.966d6f1cc6.js +1 -0
- package/dist/client/static/js/async/zo.26213b40c0.js +1 -0
- package/dist/client/static/js/async/zx.e9f4105e00.js +1 -0
- package/dist/client/static/js/g.124fba0826.js +139 -0
- package/dist/client/static/js/g.124fba0826.js.LICENSE.txt +8 -0
- package/dist/client/static/js/index.907fd4670e.js +68 -0
- package/dist/client/static/js/index.907fd4670e.js.LICENSE.txt +4 -0
- package/dist/client/static/js/katex-vendor.95e48cf65a.js +1 -0
- package/dist/client/static/js/markdown-vendor.9da142c67b.js +144 -0
- package/dist/client/static/js/shiki-vendor.cb8452ddcd.js +1 -0
- package/dist/client/sw.js +15 -0
- package/package.json +75 -0
- package/src/cli/lib/args.js +233 -0
- package/src/cli/lib/commands/logs.js +108 -0
- package/src/cli/lib/commands/restart.js +28 -0
- package/src/cli/lib/commands/serve.js +109 -0
- package/src/cli/lib/commands/status.js +63 -0
- package/src/cli/lib/commands/stop.js +63 -0
- package/src/cli/lib/commands/update.js +120 -0
- package/src/cli/lib/output.js +136 -0
- package/src/cli/lib/path-utils.js +48 -0
- package/src/cli/lib/path-utils.test.js +71 -0
- package/src/cli/lib/paths.js +60 -0
- package/src/cli/lib/process-lifecycle.js +110 -0
- package/src/cli/lib/runtime.js +280 -0
- package/src/cli/ompchamber.js +56 -0
- package/src/client/App.tsx +95 -0
- package/src/client/bootstrap.d.ts +12 -0
- package/src/client/components/common/ComposerPicker.tsx +116 -0
- package/src/client/components/common/ComposerTextarea.tsx +131 -0
- package/src/client/components/common/CopyButton.tsx +73 -0
- package/src/client/components/common/FolderPicker.tsx +270 -0
- package/src/client/components/common/MarkdownRenderer.tsx +107 -0
- package/src/client/components/common/Modal.tsx +75 -0
- package/src/client/components/common/PWAInstallButton.tsx +113 -0
- package/src/client/components/common/StatCard.tsx +52 -0
- package/src/client/components/common/StreamStatusDot.tsx +28 -0
- package/src/client/components/common/SubagentStatusIcon.tsx +27 -0
- package/src/client/components/common/Toast.tsx +79 -0
- package/src/client/components/common/ToastStack.tsx +18 -0
- package/src/client/components/common/ViewportSelector.tsx +206 -0
- package/src/client/components/common/code-editor/index.tsx +343 -0
- package/src/client/components/common/code-surface/index.tsx +75 -0
- package/src/client/components/common/file-icon/brand-paths.ts +62 -0
- package/src/client/components/common/file-icon/index.tsx +127 -0
- package/src/client/components/common/lazy-panels.tsx +80 -0
- package/src/client/components/common/session-state-provider/index.tsx +55 -0
- package/src/client/components/common/sort-menu/index.tsx +63 -0
- package/src/client/components/common/sort-menu/options.ts +24 -0
- package/src/client/components/common/viewport.ts +21 -0
- package/src/client/components/common/workspace-options-menu/index.tsx +84 -0
- package/src/client/components/layout/RightActivityBar.tsx +95 -0
- package/src/client/components/layout/desktop-layout/ResizeHandle.tsx +10 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +94 -0
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +175 -0
- package/src/client/components/layout/desktop-layout/index.tsx +280 -0
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +344 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +264 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +28 -0
- package/src/client/components/layout/session-sidebar/Header.tsx +29 -0
- package/src/client/components/layout/session-sidebar/Modals.tsx +209 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +145 -0
- package/src/client/components/layout/session-sidebar/SessionList.tsx +52 -0
- package/src/client/components/layout/session-sidebar/Skeleton.tsx +36 -0
- package/src/client/components/layout/session-sidebar/SubagentList.tsx +152 -0
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +123 -0
- package/src/client/components/layout/session-sidebar/about-modal/SocialLinks.tsx +43 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +172 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +63 -0
- package/src/client/components/layout/session-sidebar/index.tsx +174 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +221 -0
- package/src/client/components/mobile/MainView.tsx +68 -0
- package/src/client/components/mobile/RightSidebar.tsx +217 -0
- package/src/client/components/mobile/SessionSidebar.tsx +175 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +264 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +80 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +141 -0
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +121 -0
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +69 -0
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +34 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +168 -0
- package/src/client/components/mobile/mobile-session-sidebar/List.tsx +53 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +99 -0
- package/src/client/components/mobile/mobile-session-sidebar/Skeleton.tsx +36 -0
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +176 -0
- package/src/client/components/settings/LoadingState.tsx +22 -0
- package/src/client/components/settings/Modal.tsx +277 -0
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +142 -0
- package/src/client/components/settings/SettingsSidebarList.tsx +122 -0
- package/src/client/components/settings/Sidebar.tsx +153 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +84 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +50 -0
- package/src/client/components/settings/categories/BehaviorSettings.tsx +73 -0
- package/src/client/components/settings/categories/ChatSettings.tsx +24 -0
- package/src/client/components/settings/categories/CommandSettings.tsx +81 -0
- package/src/client/components/settings/categories/McpSettings.tsx +142 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +97 -0
- package/src/client/components/settings/categories/OmpSettings.tsx +312 -0
- package/src/client/components/settings/categories/OtherSettings.tsx +16 -0
- package/src/client/components/settings/categories/ProjectSettings.tsx +176 -0
- package/src/client/components/settings/categories/ProviderSettings.tsx +146 -0
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +309 -0
- package/src/client/components/settings/categories/SkillSettings.tsx +69 -0
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +264 -0
- package/src/client/components/settings/categories/UsageSettings.tsx +77 -0
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +333 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +42 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +244 -0
- package/src/client/components/settings/categories/chat-settings/FollowUpSection.tsx +120 -0
- package/src/client/components/settings/categories/chat-settings/KeybindingsSection.tsx +107 -0
- package/src/client/components/settings/categories/chat-settings/TransportSection.tsx +101 -0
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +292 -0
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +39 -0
- package/src/client/components/settings/categories/mcp-settings/ConnectionTest.tsx +89 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +311 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +161 -0
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +120 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +243 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +61 -0
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +66 -0
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +337 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +76 -0
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +71 -0
- package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +38 -0
- package/src/client/components/settings/categories/project-settings/IconGrid.tsx +152 -0
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +95 -0
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +26 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -0
- package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +201 -0
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +121 -0
- package/src/client/components/settings/categories/provider-settings/Header.tsx +22 -0
- package/src/client/components/settings/categories/provider-settings/Icons.tsx +35 -0
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +224 -0
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +114 -0
- package/src/client/components/settings/categories/provider-settings/ModelConfigModal.tsx +155 -0
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +191 -0
- package/src/client/components/settings/categories/provider-settings/ReconnectModal.tsx +163 -0
- package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +133 -0
- package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +133 -0
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +210 -0
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +164 -0
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +127 -0
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +74 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +44 -0
- package/src/client/components/settings/categories/usage-settings/DeepSeekCard.tsx +66 -0
- package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +68 -0
- package/src/client/components/settings/categories/usage-settings/ProviderCard.tsx +52 -0
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +39 -0
- package/src/client/components/settings/categories/usage-settings/QuotaSection.tsx +93 -0
- package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +77 -0
- package/src/client/components/settings/categories/usage-settings/UsageTable.tsx +66 -0
- package/src/client/components/settings/categories/usage-settings/format.ts +63 -0
- package/src/client/components/settings/categories/usage-settings/providers.ts +45 -0
- package/src/client/components/workspace/SearchPanel.tsx +259 -0
- package/src/client/components/workspace/browser-panel/ActivityToasts.tsx +46 -0
- package/src/client/components/workspace/browser-panel/AddressBar.tsx +84 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +109 -0
- package/src/client/components/workspace/browser-panel/index.tsx +69 -0
- package/src/client/components/workspace/browser-toolbar/ZoomControls.tsx +48 -0
- package/src/client/components/workspace/browser-toolbar/index.tsx +140 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +250 -0
- package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +119 -0
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +121 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +220 -0
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +94 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +321 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +122 -0
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +47 -0
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +69 -0
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +94 -0
- package/src/client/components/workspace/chat-timeline/SessionSkeleton.tsx +89 -0
- package/src/client/components/workspace/chat-timeline/SubagentView.tsx +148 -0
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +209 -0
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +175 -0
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +130 -0
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +130 -0
- package/src/client/components/workspace/chat-timeline/ToolCallCard.tsx +291 -0
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +96 -0
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +83 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +53 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +63 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +49 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +108 -0
- package/src/client/components/workspace/chat-timeline/chat-input/access-levels.ts +14 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +341 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +290 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Footer.tsx +97 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Header.tsx +52 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Lazy.tsx +24 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/SelectBody.tsx +110 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/index.tsx +321 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +92 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +160 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Ask.tsx +205 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +202 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +223 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +49 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +66 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +91 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +288 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +202 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Github.tsx +91 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +247 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Hub.tsx +273 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +276 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +93 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +93 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +246 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +96 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +132 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +317 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +102 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +240 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +52 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +141 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +118 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +150 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +107 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +79 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolCardShell.tsx +151 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/read-line-meta.ts +95 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +18 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/truncate.ts +18 -0
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +74 -0
- package/src/client/components/workspace/context-panel/LastMessageCard.tsx +34 -0
- package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +94 -0
- package/src/client/components/workspace/context-panel/RawMessagesList.tsx +293 -0
- package/src/client/components/workspace/context-panel/StatsGrid.tsx +64 -0
- package/src/client/components/workspace/context-panel/TokenDistributionBar.tsx +62 -0
- package/src/client/components/workspace/context-panel/WindowCard.tsx +35 -0
- package/src/client/components/workspace/context-panel/index.tsx +142 -0
- package/src/client/components/workspace/context-panel/raw-messages.ts +54 -0
- package/src/client/components/workspace/diff-panel/SplitView.tsx +165 -0
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +177 -0
- package/src/client/components/workspace/diff-panel/UnifiedView.tsx +117 -0
- package/src/client/components/workspace/diff-panel/index.tsx +213 -0
- package/src/client/components/workspace/editor/Tabs.tsx +149 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +90 -0
- package/src/client/components/workspace/editor/index.tsx +189 -0
- package/src/client/components/workspace/file-explorer/GitRepoDropdown.tsx +143 -0
- package/src/client/components/workspace/file-explorer/Modals.tsx +236 -0
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +289 -0
- package/src/client/components/workspace/file-explorer/index.tsx +193 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +188 -0
- package/src/client/components/workspace/git-panel/ChangesList.tsx +168 -0
- package/src/client/components/workspace/git-panel/CommitBox.tsx +48 -0
- package/src/client/components/workspace/git-panel/FileItem.tsx +91 -0
- package/src/client/components/workspace/git-panel/Modals.tsx +97 -0
- package/src/client/components/workspace/git-panel/RepoHeader.tsx +137 -0
- package/src/client/components/workspace/git-panel/TreeItem.tsx +186 -0
- package/src/client/components/workspace/git-panel/TreeView.tsx +36 -0
- package/src/client/components/workspace/git-panel/commit-modal/CommitActions.tsx +97 -0
- package/src/client/components/workspace/git-panel/commit-modal/CommitDiffViewer.tsx +205 -0
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +179 -0
- package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +164 -0
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +127 -0
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +269 -0
- package/src/client/components/workspace/git-panel/index.tsx +326 -0
- package/src/client/components/workspace/model-dropdown/Footer.tsx +21 -0
- package/src/client/components/workspace/model-dropdown/Header.tsx +50 -0
- package/src/client/components/workspace/model-dropdown/Item.tsx +137 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +146 -0
- package/src/client/components/workspace/model-dropdown/Section.tsx +87 -0
- package/src/client/components/workspace/model-dropdown/Skeleton.tsx +39 -0
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +91 -0
- package/src/client/components/workspace/model-dropdown/groups.ts +62 -0
- package/src/client/components/workspace/model-dropdown/index.tsx +245 -0
- package/src/client/components/workspace/model-dropdown/use-catalog.ts +111 -0
- package/src/client/components/workspace/terminal-panel/Header.tsx +50 -0
- package/src/client/components/workspace/terminal-panel/InputBar.tsx +82 -0
- package/src/client/components/workspace/terminal-panel/LogEntry.tsx +70 -0
- package/src/client/components/workspace/terminal-panel/QuickActions.tsx +39 -0
- package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +340 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +110 -0
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +208 -0
- package/src/client/components/workspace/usage-panel/index.tsx +98 -0
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +134 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +72 -0
- package/src/client/components/workspace/user-browser-panel/index.tsx +87 -0
- package/src/client/data/agent-data/builtin.ts +31 -0
- package/src/client/data/agent-data/index.ts +10 -0
- package/src/client/data/agent-data/orchestrator.ts +113 -0
- package/src/client/data/agent-data/specialist.ts +245 -0
- package/src/client/data/context-data/index.test.ts +88 -0
- package/src/client/data/context-data/index.ts +310 -0
- package/src/client/data/context-data/presets.ts +128 -0
- package/src/client/data/mock/chat.ts +236 -0
- package/src/client/data/mock/git-commits.ts +304 -0
- package/src/client/data/mock/subagents.ts +212 -0
- package/src/client/data/mock/token-usage.ts +129 -0
- package/src/client/data/models/catalog.ts +293 -0
- package/src/client/data/samples/dialogue-session.ts +285 -0
- package/src/client/data/samples/sample-subagents/scout-raw.ts +341 -0
- package/src/client/data/samples/sample-subagents/sleeper-raw.ts +294 -0
- package/src/client/data/samples/sample-tools/built-in-part1.ts +265 -0
- package/src/client/data/samples/sample-tools/built-in-part2.ts +180 -0
- package/src/client/data/samples/sample-tools/other.ts +162 -0
- package/src/client/data/samples/subagent-session.ts +99 -0
- package/src/client/data/samples/tools-session.ts +85 -0
- package/src/client/data/samples/virtual-devices-session.ts +333 -0
- package/src/client/data/settings/behavior.ts +12 -0
- package/src/client/data/settings/command.ts +188 -0
- package/src/client/data/settings/mcp.ts +28 -0
- package/src/client/data/settings/omp-schema.json +1 -0
- package/src/client/data/settings/project.ts +58 -0
- package/src/client/data/settings/provider.ts +185 -0
- package/src/client/data/settings/skill.ts +340 -0
- package/src/client/data/theme/terminal.ts +150 -0
- package/src/client/hooks/browser/use-screencast.ts +178 -0
- package/src/client/hooks/browser/use-user-browser.ts +105 -0
- package/src/client/hooks/chat/composer/index.ts +181 -0
- package/src/client/hooks/chat/composer/items.ts +47 -0
- package/src/client/hooks/chat/omp/index.ts +348 -0
- package/src/client/hooks/chat/omp/revalidation-throttle.ts +71 -0
- package/src/client/hooks/chat/omp/session-list.tsx +148 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +249 -0
- package/src/client/hooks/chat/omp/session-statuses.ts +83 -0
- package/src/client/hooks/chat/omp/status.ts +31 -0
- package/src/client/hooks/chat/omp/stream-poll.ts +37 -0
- package/src/client/hooks/chat/omp/stream.ts +108 -0
- package/src/client/hooks/chat/stream.ts +228 -0
- package/src/client/hooks/chat/subagent/index.ts +290 -0
- package/src/client/hooks/chat/timeline/actions.ts +322 -0
- package/src/client/hooks/chat/timeline/auto-scroll.ts +58 -0
- package/src/client/hooks/chat/timeline/browser-context.ts +40 -0
- package/src/client/hooks/chat/timeline/extension-dialog.ts +56 -0
- package/src/client/hooks/chat/timeline/index.ts +333 -0
- package/src/client/hooks/chat/timeline/queue.ts +87 -0
- package/src/client/hooks/chat/timeline/scroll.ts +134 -0
- package/src/client/hooks/chat/timeline/send.ts +348 -0
- package/src/client/hooks/chat/timeline/session-load.ts +334 -0
- package/src/client/hooks/chat/timeline/session-title.ts +40 -0
- package/src/client/hooks/chat/timeline/subagent-view.ts +92 -0
- package/src/client/hooks/chat/timeline/undo-confirmation.ts +29 -0
- package/src/client/hooks/editor/use-file-editor.ts +302 -0
- package/src/client/hooks/models/use-model-names.ts +17 -0
- package/src/client/hooks/models/use-models-catalog.ts +45 -0
- package/src/client/hooks/models/use-provider-names.ts +18 -0
- package/src/client/hooks/settings/crud-list.ts +187 -0
- package/src/client/hooks/settings/instruction-file.ts +91 -0
- package/src/client/hooks/settings/providers.ts +295 -0
- package/src/client/hooks/settings/skill-catalog.ts +37 -0
- package/src/client/hooks/settings/use-chamber-setting.ts +12 -0
- package/src/client/hooks/settings/useUsageReport.ts +41 -0
- package/src/client/hooks/ui/clipboard.ts +33 -0
- package/src/client/hooks/ui/copy-flag.ts +27 -0
- package/src/client/hooks/ui/inline-rename.ts +93 -0
- package/src/client/hooks/ui/notification-sound.ts +108 -0
- package/src/client/hooks/ui/on-click-outside.ts +22 -0
- package/src/client/hooks/ui/open-file.ts +42 -0
- package/src/client/hooks/ui/scrollbar-fade.ts +33 -0
- package/src/client/hooks/ui/show-more.ts +23 -0
- package/src/client/hooks/ui/syntax-ready.ts +17 -0
- package/src/client/hooks/ui/theme.ts +76 -0
- package/src/client/hooks/ui/toasts.ts +22 -0
- package/src/client/hooks/ui/updates.ts +108 -0
- package/src/client/hooks/ui/visibility-refresh.ts +66 -0
- package/src/client/hooks/ui/window-event.ts +52 -0
- package/src/client/hooks/workspace/commit-interactions.ts +111 -0
- package/src/client/hooks/workspace/commit-pagination.ts +106 -0
- package/src/client/hooks/workspace/file-tabs.ts +136 -0
- package/src/client/hooks/workspace/git-status.ts +89 -0
- package/src/client/hooks/workspace/git-tree.ts +146 -0
- package/src/client/hooks/workspace/panel-refresh.ts +72 -0
- package/src/client/hooks/workspace/panel-widths.ts +59 -0
- package/src/client/hooks/workspace/search-stream.ts +76 -0
- package/src/client/hooks/workspace/session-state/context.ts +15 -0
- package/src/client/hooks/workspace/session-state/index.ts +62 -0
- package/src/client/hooks/workspace/terminal-output.ts +66 -0
- package/src/client/hooks/workspace/terminal.ts +283 -0
- package/src/client/hooks/workspace/workspace-folder-actions.ts +110 -0
- package/src/client/lib/router/fetcher.ts +100 -0
- package/src/client/lib/router/search-params.ts +82 -0
- package/src/client/main.tsx +23 -0
- package/src/client/tailwind.css +364 -0
- package/src/server/db.server.ts +338 -0
- package/src/server/index.ts +19 -0
- package/src/server/lib/browser/runtime.test.ts +110 -0
- package/src/server/lib/browser/runtime.ts +160 -0
- package/src/server/lib/chat/session-store.server.ts +61 -0
- package/src/server/lib/db/client.ts +55 -0
- package/src/server/lib/db/settings-store.ts +148 -0
- package/src/server/lib/fs/atomic-write.ts +27 -0
- package/src/server/lib/fs/git-diff.ts +116 -0
- package/src/server/lib/fs/git-log.ts +174 -0
- package/src/server/lib/fs/repo-scope.ts +14 -0
- package/src/server/lib/fs/root.ts +77 -0
- package/src/server/lib/fs/shell.ts +71 -0
- package/src/server/lib/fs/terminal-cwd.ts +49 -0
- package/src/server/lib/models/provider-registry.server.ts +269 -0
- package/src/server/lib/omp/config/agents.ts +162 -0
- package/src/server/lib/omp/config/behavior.ts +113 -0
- package/src/server/lib/omp/config/config-cli.ts +94 -0
- package/src/server/lib/omp/config/disabled-providers.ts +68 -0
- package/src/server/lib/omp/config/extensions.ts +90 -0
- package/src/server/lib/omp/config/instructions.ts +81 -0
- package/src/server/lib/omp/config/mcp-test.ts +346 -0
- package/src/server/lib/omp/config/mcp.ts +258 -0
- package/src/server/lib/omp/config/providers.ts +276 -0
- package/src/server/lib/omp/config/roles.ts +46 -0
- package/src/server/lib/omp/config/skills-catalog.ts +93 -0
- package/src/server/lib/omp/config/skills.ts +118 -0
- package/src/server/lib/omp/config/yaml.ts +48 -0
- package/src/server/lib/omp/core/auth-credentials.ts +87 -0
- package/src/server/lib/omp/core/cli.ts +69 -0
- package/src/server/lib/omp/core/paths.ts +154 -0
- package/src/server/lib/omp/core/registry.ts +140 -0
- package/src/server/lib/omp/core/worktree.ts +106 -0
- package/src/server/lib/omp/rpc/constants.ts +185 -0
- package/src/server/lib/omp/rpc/errors.ts +27 -0
- package/src/server/lib/omp/rpc/kill-tree.ts +49 -0
- package/src/server/lib/omp/rpc/lines.ts +38 -0
- package/src/server/lib/omp/rpc/manager.ts +310 -0
- package/src/server/lib/omp/rpc/pending-ui-dialogs.ts +55 -0
- package/src/server/lib/omp/rpc/process-helpers.ts +82 -0
- package/src/server/lib/omp/rpc/process.ts +319 -0
- package/src/server/lib/omp/rpc/session-commands.ts +218 -0
- package/src/server/lib/omp/rpc/session-registry.ts +300 -0
- package/src/server/lib/omp/rpc/utility.ts +199 -0
- package/src/server/lib/omp/rpc/web-state.ts +94 -0
- package/src/server/lib/omp/session/files.ts +282 -0
- package/src/server/lib/omp/session/locator.ts +60 -0
- package/src/server/lib/omp/session/messages.ts +222 -0
- package/src/server/lib/omp/session/reader.ts +150 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +195 -0
- package/src/server/lib/omp/session/stats.ts +85 -0
- package/src/server/lib/omp/session/subagent-presence.ts +74 -0
- package/src/server/lib/omp/session/telemetry/compute.ts +188 -0
- package/src/server/lib/omp/session/telemetry/format.ts +110 -0
- package/src/server/lib/omp/session/telemetry/index.ts +4 -0
- package/src/server/lib/omp/session/telemetry/scan.ts +21 -0
- package/src/server/lib/omp/session/telemetry-raw.ts +96 -0
- package/src/server/lib/omp/session/telemetry.test.ts +154 -0
- package/src/server/lib/omp/session/title-slot.ts +203 -0
- package/src/server/lib/omp/session/usage.ts +298 -0
- package/src/server/lib/omp/subagent/history/fold.ts +196 -0
- package/src/server/lib/omp/subagent/history/index.ts +110 -0
- package/src/server/lib/omp/subagent/history/paths.ts +29 -0
- package/src/server/lib/omp/subagent/history/transcript.test.ts +87 -0
- package/src/server/lib/omp/subagent/history/transcript.ts +122 -0
- package/src/server/lib/remix-compat.ts +29 -0
- package/src/server/lib/route-adapter.ts +144 -0
- package/src/server/lib/sse.ts +248 -0
- package/src/server/lib/updates/apply.ts +46 -0
- package/src/server/lib/updates/check.ts +41 -0
- package/src/server/lib/updates/github.ts +71 -0
- package/src/server/lib/updates/install-method.ts +73 -0
- package/src/server/lib/updates/install.test.ts +74 -0
- package/src/server/lib/updates/install.ts +294 -0
- package/src/server/lib/updates/omp.ts +86 -0
- package/src/server/lib/usage/deepseek.ts +59 -0
- package/src/server/lib/usage/kenari.ts +251 -0
- package/src/server/lib/usage/provider-key.ts +83 -0
- package/src/server/mock.server.ts +33 -0
- package/src/server/plugins/compress.ts +51 -0
- package/src/server/plugins/dev-assets.ts +49 -0
- package/src/server/plugins/ssr.ts +100 -0
- package/src/server/plugins/static.ts +81 -0
- package/src/server/routes/agent/command.ts +81 -0
- package/src/server/routes/agent/events.ts +56 -0
- package/src/server/routes/agent/index.ts +12 -0
- package/src/server/routes/agent/new.ts +83 -0
- package/src/server/routes/agent/prewarm.ts +27 -0
- package/src/server/routes/agent/ws.ts +168 -0
- package/src/server/routes/browser/index.ts +6 -0
- package/src/server/routes/browser/stream.ts +217 -0
- package/src/server/routes/chat/index.ts +12 -0
- package/src/server/routes/chat/rewind.ts +162 -0
- package/src/server/routes/chat/root.ts +78 -0
- package/src/server/routes/chat/session.ts +339 -0
- package/src/server/routes/chat/stream.ts +111 -0
- package/src/server/routes/files/index.ts +10 -0
- package/src/server/routes/files/root.ts +29 -0
- package/src/server/routes/files/toggle.ts +20 -0
- package/src/server/routes/folders/create.ts +98 -0
- package/src/server/routes/folders/folder.ts +78 -0
- package/src/server/routes/folders/index.ts +16 -0
- package/src/server/routes/fs/action.ts +84 -0
- package/src/server/routes/fs/git.ts +334 -0
- package/src/server/routes/fs/index.ts +19 -0
- package/src/server/routes/fs/read.ts +258 -0
- package/src/server/routes/fs/replace.ts +69 -0
- package/src/server/routes/fs/search.ts +135 -0
- package/src/server/routes/fs/validate.ts +61 -0
- package/src/server/routes/health/index.ts +6 -0
- package/src/server/routes/health/probe.ts +27 -0
- package/src/server/routes/index.ts +38 -0
- package/src/server/routes/models/index.ts +8 -0
- package/src/server/routes/models/roles.ts +31 -0
- package/src/server/routes/models/root.ts +328 -0
- package/src/server/routes/omp/commands.ts +29 -0
- package/src/server/routes/omp/extensions.ts +34 -0
- package/src/server/routes/omp/index.ts +20 -0
- package/src/server/routes/omp/login.ts +112 -0
- package/src/server/routes/omp/plugins.ts +82 -0
- package/src/server/routes/omp/pricing.ts +65 -0
- package/src/server/routes/omp/session-stats.ts +30 -0
- package/src/server/routes/omp/sidebar.ts +40 -0
- package/src/server/routes/omp/state.ts +22 -0
- package/src/server/routes/sessions/folder.ts +16 -0
- package/src/server/routes/sessions/index.ts +25 -0
- package/src/server/routes/sessions/list.ts +23 -0
- package/src/server/routes/sessions/session.ts +331 -0
- package/src/server/routes/sessions/subagents.ts +82 -0
- package/src/server/routes/settings/agents.ts +128 -0
- package/src/server/routes/settings/behavior.ts +125 -0
- package/src/server/routes/settings/commands.ts +89 -0
- package/src/server/routes/settings/index.ts +28 -0
- package/src/server/routes/settings/mcp-test.ts +71 -0
- package/src/server/routes/settings/mcp.ts +261 -0
- package/src/server/routes/settings/omp-config.ts +47 -0
- package/src/server/routes/settings/projects.ts +84 -0
- package/src/server/routes/settings/provider-models.ts +278 -0
- package/src/server/routes/settings/providers.ts +137 -0
- package/src/server/routes/settings/root.ts +40 -0
- package/src/server/routes/settings/skills.ts +175 -0
- package/src/server/routes/settings/usage.ts +81 -0
- package/src/server/routes/telemetry/context.ts +52 -0
- package/src/server/routes/telemetry/index.ts +10 -0
- package/src/server/routes/telemetry/raw-messages.ts +80 -0
- package/src/server/routes/telemetry/tokens.ts +163 -0
- package/src/server/routes/terminal/index.ts +8 -0
- package/src/server/routes/terminal/run.ts +135 -0
- package/src/server/routes/terminal/stream.ts +100 -0
- package/src/server/routes/updates/apply.ts +25 -0
- package/src/server/routes/updates/check.ts +27 -0
- package/src/server/routes/updates/index.ts +8 -0
- package/src/server/routes/well-known/devtools.ts +9 -0
- package/src/server/routes/well-known/index.ts +6 -0
- package/src/shared/lib/browser/activity.ts +115 -0
- package/src/shared/lib/browser/cdp.ts +201 -0
- package/src/shared/lib/browser/connection.ts +81 -0
- package/src/shared/lib/browser/observer.ts +129 -0
- package/src/shared/lib/browser/page-context.ts +20 -0
- package/src/shared/lib/browser/targets.test.ts +45 -0
- package/src/shared/lib/browser/targets.ts +74 -0
- package/src/shared/lib/browser/url.ts +21 -0
- package/src/shared/lib/browser/util.ts +20 -0
- package/src/shared/lib/browser/viewer.ts +303 -0
- package/src/shared/lib/browser/watcher.ts +75 -0
- package/src/shared/lib/chat/attachments.ts +62 -0
- package/src/shared/lib/chat/capitalize.ts +9 -0
- package/src/shared/lib/chat/composer/client.ts +210 -0
- package/src/shared/lib/chat/composer/filter.ts +62 -0
- package/src/shared/lib/chat/composer/translate.ts +103 -0
- package/src/shared/lib/chat/composer/trigger.ts +53 -0
- package/src/shared/lib/chat/detect-format.ts +38 -0
- package/src/shared/lib/chat/duration.ts +82 -0
- package/src/shared/lib/chat/omp/agent-events.test.ts +152 -0
- package/src/shared/lib/chat/omp/agent-events.ts +347 -0
- package/src/shared/lib/chat/omp/file-mutations.ts +42 -0
- package/src/shared/lib/chat/omp/socket.ts +95 -0
- package/src/shared/lib/chat/omp/sse.ts +53 -0
- package/src/shared/lib/chat/omp/status.ts +45 -0
- package/src/shared/lib/chat/omp/transport.ts +50 -0
- package/src/shared/lib/chat/order.ts +40 -0
- package/src/shared/lib/chat/read-sse.ts +99 -0
- package/src/shared/lib/chat/stream-service.ts +273 -0
- package/src/shared/lib/chat/task-result-parser.ts +166 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +293 -0
- package/src/shared/lib/chat/timeline/stream-callbacks.ts +202 -0
- package/src/shared/lib/chat/timeline/stream-raf.ts +59 -0
- package/src/shared/lib/chat/timeline/tool-phrases.ts +224 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +160 -0
- package/src/shared/lib/chat/timeline/turns.ts +30 -0
- package/src/shared/lib/chat/title-case.ts +293 -0
- package/src/shared/lib/chat/todo-parser.ts +257 -0
- package/src/shared/lib/chat/tool-status.ts +20 -0
- package/src/shared/lib/code/ansi.ts +24 -0
- package/src/shared/lib/code/editor-utils.ts +16 -0
- package/src/shared/lib/code/format.ts +17 -0
- package/src/shared/lib/code/highlighter.ts +135 -0
- package/src/shared/lib/code/parser.ts +237 -0
- package/src/shared/lib/code/shiki-langs.ts +93 -0
- package/src/shared/lib/code/shiki-themes.ts +14 -0
- package/src/shared/lib/code/syntax-highlight.test.ts +153 -0
- package/src/shared/lib/code/syntax-highlight.ts +290 -0
- package/src/shared/lib/db/transaction.server.ts +20 -0
- package/src/shared/lib/format/number.ts +69 -0
- package/src/shared/lib/format/time.ts +39 -0
- package/src/shared/lib/fs/diff-parser.ts +135 -0
- package/src/shared/lib/fs/file-tree.ts +26 -0
- package/src/shared/lib/fs/git-graph.ts +184 -0
- package/src/shared/lib/fs/git-status.ts +161 -0
- package/src/shared/lib/markdown/marked.ts +228 -0
- package/src/shared/lib/markdown/mermaid.ts +153 -0
- package/src/shared/lib/markdown/sanitize.ts +138 -0
- package/src/shared/lib/models/catalog.ts +88 -0
- package/src/shared/lib/models/client.ts +51 -0
- package/src/shared/lib/models/identity.ts +21 -0
- package/src/shared/lib/models/provider-cleanup.ts +20 -0
- package/src/shared/lib/models/provider-connection.ts +41 -0
- package/src/shared/lib/models/provider-label.ts +40 -0
- package/src/shared/lib/models/provider-models.ts +97 -0
- package/src/shared/lib/models/provider-presets.ts +29 -0
- package/src/shared/lib/models/remote-list.ts +125 -0
- package/src/shared/lib/models/server-cache.ts +27 -0
- package/src/shared/lib/models/thinking-levels.ts +68 -0
- package/src/shared/lib/omp/config/access-mode.server.ts +27 -0
- package/src/shared/lib/omp/config/access-mode.ts +31 -0
- package/src/shared/lib/omp/config/schema-extras.ts +230 -0
- package/src/shared/lib/omp/config/schema-types.ts +49 -0
- package/src/shared/lib/omp/config/schema.ts +81 -0
- package/src/shared/lib/omp/rpc/frame.ts +134 -0
- package/src/shared/lib/omp/session/default-title.test.ts +50 -0
- package/src/shared/lib/omp/session/default-title.ts +51 -0
- package/src/shared/lib/omp/session/hashline-patch.test.ts +89 -0
- package/src/shared/lib/omp/session/hashline-patch.ts +134 -0
- package/src/shared/lib/omp/session/jsonl.ts +197 -0
- package/src/shared/lib/omp/session/mapper.ts +145 -0
- package/src/shared/lib/omp/session/messages-map.ts +179 -0
- package/src/shared/lib/omp/session/messages-parse.ts +69 -0
- package/src/shared/lib/omp/session/parse-message-blocks.ts +223 -0
- package/src/shared/lib/omp/session/prewarm.ts +41 -0
- package/src/shared/lib/omp/session/sidebar.ts +77 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +106 -0
- package/src/shared/lib/omp/session/telemetry-blocks.ts +60 -0
- package/src/shared/lib/omp/session/timestamps.ts +20 -0
- package/src/shared/lib/omp/session/turn-error.ts +40 -0
- package/src/shared/lib/omp/subagent/history/client.ts +76 -0
- package/src/shared/lib/omp/subagent/history/settlement.ts +113 -0
- package/src/shared/lib/omp/subagent/history/status.ts +40 -0
- package/src/shared/lib/omp/subagent/parse.ts +284 -0
- package/src/shared/lib/omp/subagent/result-details.ts +53 -0
- package/src/shared/lib/omp/subagent/transcript-client.ts +178 -0
- package/src/shared/lib/settings/client.test.ts +62 -0
- package/src/shared/lib/settings/client.ts +96 -0
- package/src/shared/lib/updates/semver.ts +34 -0
- package/src/shared/lib/util/guards.ts +14 -0
- package/src/shared/lib/workspace/active-project.ts +42 -0
- package/src/shared/lib/workspace/panel-widths.test.ts +72 -0
- package/src/shared/lib/workspace/panel-widths.ts +79 -0
- package/src/shared/lib/workspace/project-icon.ts +29 -0
- package/src/shared/lib/workspace/project-settings-migration.ts +62 -0
- package/src/shared/lib/workspace/project-settings.ts +139 -0
- package/src/shared/lib/workspace/refresh-cadence.ts +128 -0
- package/src/shared/lib/workspace/relative-time.ts +25 -0
- package/src/shared/lib/workspace/right-panels.ts +51 -0
- package/src/shared/lib/workspace/schema-migrations.ts +19 -0
- package/src/shared/lib/workspace/session-state/store.ts +267 -0
- package/src/shared/lib/workspace/sidebar-expanded.ts +23 -0
- package/src/shared/lib/workspace/sidebar-sort.test.ts +200 -0
- package/src/shared/lib/workspace/sidebar-sort.ts +131 -0
- package/src/shared/types/browser.ts +58 -0
- package/src/shared/types/chat.ts +289 -0
- package/src/shared/types/context.ts +87 -0
- package/src/shared/types/fs.ts +36 -0
- package/src/shared/types/git.ts +60 -0
- package/src/shared/types/index.ts +22 -0
- package/src/shared/types/omp/agent.ts +109 -0
- package/src/shared/types/omp/instructions.ts +38 -0
- package/src/shared/types/omp/session.ts +153 -0
- package/src/shared/types/omp/subagent.ts +176 -0
- package/src/shared/types/settings/agent.ts +16 -0
- package/src/shared/types/settings/command.ts +12 -0
- package/src/shared/types/settings/mcp.ts +22 -0
- package/src/shared/types/settings/project.ts +18 -0
- package/src/shared/types/settings/provider.ts +42 -0
- package/src/shared/types/settings/skill.ts +35 -0
- package/src/shared/types/settings/state.ts +59 -0
- package/src/shared/types/settings/usage.ts +99 -0
- package/src/shared/types/terminal.ts +19 -0
- package/src/shared/types/tokenUsage.ts +44 -0
- package/src/shared/types/updates.ts +38 -0
- package/src/shared/types/workspace.ts +56 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { resolveDeepSeekApiKey } from '@/server/lib/usage/provider-key';
|
|
2
|
+
import type { DeepSeekBalance, DeepSeekBalanceEntry, DeepSeekUsageReport } from '@/shared/types';
|
|
3
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
4
|
+
|
|
5
|
+
const FETCH_TIMEOUT_MS = 10_000;
|
|
6
|
+
const BALANCE_URL = 'https://api.deepseek.com/user/balance';
|
|
7
|
+
|
|
8
|
+
function toString(value: unknown): string {
|
|
9
|
+
if (typeof value === 'string') return value;
|
|
10
|
+
if (value === null || value === undefined) return '';
|
|
11
|
+
return String(value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function mapBalance(payload: unknown): DeepSeekBalance {
|
|
15
|
+
if (!isRecord(payload)) throw new Error('Unexpected DeepSeek response format');
|
|
16
|
+
const infos = Array.isArray(payload.balance_infos) ? payload.balance_infos : [];
|
|
17
|
+
const entries: DeepSeekBalanceEntry[] = [];
|
|
18
|
+
for (const info of infos) {
|
|
19
|
+
if (!isRecord(info)) continue;
|
|
20
|
+
entries.push({
|
|
21
|
+
currency: typeof info.currency === 'string' ? info.currency : '',
|
|
22
|
+
totalBalance: toString(info.total_balance),
|
|
23
|
+
grantedBalance: toString(info.granted_balance),
|
|
24
|
+
toppedUpBalance: toString(info.topped_up_balance),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return { isAvailable: payload.is_available === true, entries };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// DeepSeek exposes no public usage/quota API — only its web console tracks
|
|
31
|
+
// spend. The Settings → Usage panel states this for the DeepSeek section;
|
|
32
|
+
// here we can only report the prepaid balance.
|
|
33
|
+
async function fetchDeepSeekBalance(apiKey: string): Promise<DeepSeekBalance> {
|
|
34
|
+
const response = await fetch(BALANCE_URL, {
|
|
35
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
36
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
37
|
+
});
|
|
38
|
+
if (response.status === 401) {
|
|
39
|
+
throw new Error('Invalid DeepSeek API key.');
|
|
40
|
+
}
|
|
41
|
+
if (response.status < 200 || response.status >= 300) {
|
|
42
|
+
throw new Error(`HTTP ${response.status}`);
|
|
43
|
+
}
|
|
44
|
+
return mapBalance(await response.json());
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Build the DeepSeek usage report; a missing key yields `configured: false`. */
|
|
48
|
+
export async function buildDeepSeekReport(): Promise<DeepSeekUsageReport> {
|
|
49
|
+
const apiKey = await resolveDeepSeekApiKey();
|
|
50
|
+
if (!apiKey) return { configured: false };
|
|
51
|
+
try {
|
|
52
|
+
return { configured: true, balance: await fetchDeepSeekBalance(apiKey) };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
configured: true,
|
|
56
|
+
error: error instanceof Error ? error.message : 'Failed to load DeepSeek balance',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { resolveKenariApiKey } from '@/server/lib/usage/provider-key';
|
|
2
|
+
import type { KenariBalance, KenariCoupon, KenariQuota, KenariQuotaWindow, KenariUsage, KenariUsageReport, KenariUsageRow } from '@/shared/types';
|
|
3
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
4
|
+
|
|
5
|
+
const FETCH_TIMEOUT_MS = 10_000;
|
|
6
|
+
const QUOTA_URL = 'https://kenari.id/v1/account/quota';
|
|
7
|
+
const MCP_URL = 'https://kenari.id/mcp';
|
|
8
|
+
// Cloudflare blocks the /mcp path with error 1010 when the request carries a
|
|
9
|
+
// default fetch User-Agent; an explicit one is required (verified).
|
|
10
|
+
const USER_AGENT = 'ompchamber/1.0 (+https://kenari.id/docs/agents)';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parse an Indonesian Rupiah amount: "Rp" followed by digits where `.` is the
|
|
14
|
+
* thousands separator and `,` the decimal separator ("Rp 76.514" → 76514,
|
|
15
|
+
* "Rp 1.234,56" → 1234.56). Returns null when no Rupiah amount is present.
|
|
16
|
+
*/
|
|
17
|
+
function parseRupiah(text: string): number | null {
|
|
18
|
+
const match = text.match(/Rp\s*([0-9][0-9.,]*)/i);
|
|
19
|
+
if (!match) return null;
|
|
20
|
+
const raw = match[1];
|
|
21
|
+
const commaIndex = raw.indexOf(',');
|
|
22
|
+
const normalized = commaIndex >= 0
|
|
23
|
+
? raw.slice(0, commaIndex).replace(/\./g, '') + '.' + raw.slice(commaIndex + 1).replace(/\./g, '')
|
|
24
|
+
: raw.replace(/\./g, '');
|
|
25
|
+
const parsed = Number.parseFloat(normalized);
|
|
26
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function toNumber(value: unknown): number {
|
|
30
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
31
|
+
if (typeof value === 'string') {
|
|
32
|
+
const parsed = Number.parseFloat(value.replace(/[^0-9.-]/g, ''));
|
|
33
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const WINDOW_DEFS: Array<{ key: KenariQuotaWindow['key']; label: string; field: string }> = [
|
|
39
|
+
{ key: 'five_hour', label: '5 hours', field: 'five_hour' },
|
|
40
|
+
{ key: 'week', label: 'Weekly', field: 'week' },
|
|
41
|
+
{ key: 'month', label: 'Monthly', field: 'month' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
function mapQuota(payload: unknown): KenariQuota {
|
|
45
|
+
if (!isRecord(payload)) throw new Error('Unexpected quota response format');
|
|
46
|
+
const plan = isRecord(payload.plan) ? payload.plan : null;
|
|
47
|
+
const planName = plan && typeof plan.name === 'string' ? plan.name : null;
|
|
48
|
+
|
|
49
|
+
const windows: KenariQuotaWindow[] = [];
|
|
50
|
+
if (plan && isRecord(plan.windows)) {
|
|
51
|
+
for (const def of WINDOW_DEFS) {
|
|
52
|
+
const window = plan.windows[def.field];
|
|
53
|
+
if (!isRecord(window)) continue;
|
|
54
|
+
windows.push({
|
|
55
|
+
key: def.key,
|
|
56
|
+
label: def.label,
|
|
57
|
+
usedRp: toNumber(window.used_rp),
|
|
58
|
+
remainingRp: toNumber(window.remaining_rp),
|
|
59
|
+
resetsAt: typeof window.resets_at === 'string' ? window.resets_at : '',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let coupon: KenariCoupon | null = null;
|
|
65
|
+
const couponRaw = payload.coupon;
|
|
66
|
+
if (isRecord(couponRaw)) {
|
|
67
|
+
const scopeModels = Array.isArray(couponRaw.scope_models)
|
|
68
|
+
? couponRaw.scope_models.filter((model): model is string => typeof model === 'string')
|
|
69
|
+
: [];
|
|
70
|
+
const remainingRaw = couponRaw.remaining_rp;
|
|
71
|
+
coupon = {
|
|
72
|
+
name: typeof couponRaw.name === 'string' ? couponRaw.name : '',
|
|
73
|
+
usedRp: toNumber(couponRaw.used_rp),
|
|
74
|
+
remainingRp: remainingRaw === null || remainingRaw === undefined ? null : toNumber(remainingRaw),
|
|
75
|
+
expiresAt: typeof couponRaw.expires_at === 'string' ? couponRaw.expires_at : '',
|
|
76
|
+
scopeModels,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { planName, windows, coupon };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function fetchKenariQuota(apiKey: string): Promise<KenariQuota> {
|
|
84
|
+
const response = await fetch(QUOTA_URL, {
|
|
85
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
86
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
87
|
+
});
|
|
88
|
+
if (response.status === 403) {
|
|
89
|
+
const body: unknown = await response.json().catch(() => null);
|
|
90
|
+
if (isRecord(body) && body.code === 'shared_key_not_allowed') {
|
|
91
|
+
throw new Error('This key is a shared key; balance/usage/quota require the account owner key.');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (response.status < 200 || response.status >= 300) {
|
|
95
|
+
throw new Error(`HTTP ${response.status}`);
|
|
96
|
+
}
|
|
97
|
+
return mapQuota(await response.json());
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Extract the first JSON `data:` line from a `text/event-stream` body. */
|
|
101
|
+
function parseSseData(text: string): unknown {
|
|
102
|
+
for (const line of text.split(/\r?\n/)) {
|
|
103
|
+
const trimmed = line.trim();
|
|
104
|
+
if (!trimmed.startsWith('data:')) continue;
|
|
105
|
+
const data = trimmed.slice('data:'.length).trim();
|
|
106
|
+
if (data.length === 0 || data === '[DONE]') continue;
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(data);
|
|
109
|
+
} catch {
|
|
110
|
+
// Malformed data line — keep scanning.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Pull the tool result text from a JSON-RPC `tools/call` response. A JSON-RPC
|
|
118
|
+
* error is surfaced as an Error carrying its `error.message`.
|
|
119
|
+
*/
|
|
120
|
+
function extractToolText(payload: unknown): string {
|
|
121
|
+
if (!isRecord(payload)) throw new Error('Unexpected MCP response format');
|
|
122
|
+
if (isRecord(payload.error)) {
|
|
123
|
+
const message = typeof payload.error.message === 'string'
|
|
124
|
+
? payload.error.message
|
|
125
|
+
: 'MCP tool call failed';
|
|
126
|
+
throw new Error(message);
|
|
127
|
+
}
|
|
128
|
+
const result = payload.result;
|
|
129
|
+
if (!isRecord(result)) throw new Error('Unexpected MCP response format');
|
|
130
|
+
if (!Array.isArray(result.content)) throw new Error('Unexpected MCP response format');
|
|
131
|
+
for (const item of result.content) {
|
|
132
|
+
if (isRecord(item) && typeof item.text === 'string') return item.text;
|
|
133
|
+
}
|
|
134
|
+
throw new Error('Unexpected MCP response format');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Call a stateless Kenari MCP tool. A direct `tools/call` works without an
|
|
139
|
+
* `initialize` handshake (the server is stateless, verified).
|
|
140
|
+
*/
|
|
141
|
+
async function callKenariTool(apiKey: string, toolName: string): Promise<string> {
|
|
142
|
+
const response = await fetch(MCP_URL, {
|
|
143
|
+
method: 'POST',
|
|
144
|
+
headers: {
|
|
145
|
+
Authorization: `Bearer ${apiKey}`,
|
|
146
|
+
'Content-Type': 'application/json',
|
|
147
|
+
Accept: 'application/json, text/event-stream',
|
|
148
|
+
'User-Agent': USER_AGENT,
|
|
149
|
+
},
|
|
150
|
+
body: JSON.stringify({
|
|
151
|
+
jsonrpc: '2.0',
|
|
152
|
+
id: 1,
|
|
153
|
+
method: 'tools/call',
|
|
154
|
+
params: { name: toolName, arguments: {} },
|
|
155
|
+
}),
|
|
156
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
157
|
+
});
|
|
158
|
+
if (response.status < 200 || response.status >= 300) {
|
|
159
|
+
throw new Error(`HTTP ${response.status}`);
|
|
160
|
+
}
|
|
161
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
162
|
+
const payload = contentType.includes('text/event-stream')
|
|
163
|
+
? parseSseData(await response.text())
|
|
164
|
+
: await response.json();
|
|
165
|
+
return extractToolText(payload);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function fetchKenariBalance(apiKey: string): Promise<KenariBalance> {
|
|
169
|
+
const raw = await callKenariTool(apiKey, 'kenari_balance');
|
|
170
|
+
return { amountRp: parseRupiah(raw), raw };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function toInt(value: string): number {
|
|
174
|
+
const parsed = Number.parseInt(value.replace(/[.,]/g, ''), 10);
|
|
175
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Parse the kenari_usage Markdown table + trailing "Total:" line. */
|
|
179
|
+
function parseUsageText(raw: string): KenariUsage {
|
|
180
|
+
const rows: KenariUsageRow[] = [];
|
|
181
|
+
let totalRequests = 0;
|
|
182
|
+
let totalCostRp = 0;
|
|
183
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
184
|
+
const trimmed = line.trim();
|
|
185
|
+
if (trimmed.startsWith('|')) {
|
|
186
|
+
const cells = trimmed.split('|').map((cell) => cell.trim()).filter((cell) => cell.length > 0);
|
|
187
|
+
if (cells.length < 5) continue;
|
|
188
|
+
const model = cells[0];
|
|
189
|
+
if (model === 'model' || /^-+$/.test(model)) continue;
|
|
190
|
+
rows.push({
|
|
191
|
+
model,
|
|
192
|
+
requests: toInt(cells[1]),
|
|
193
|
+
inputTokens: toInt(cells[2]),
|
|
194
|
+
outputTokens: toInt(cells[3]),
|
|
195
|
+
costRp: parseRupiah(cells[4]) ?? 0,
|
|
196
|
+
});
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const totalMatch = trimmed.match(/Total:\s*([0-9][0-9.,]*)\s*request/i);
|
|
200
|
+
if (totalMatch) {
|
|
201
|
+
totalRequests = toInt(totalMatch[1]);
|
|
202
|
+
totalCostRp = parseRupiah(trimmed) ?? 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { rows, totalRequests, totalCostRp, raw };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async function fetchKenariUsage(apiKey: string): Promise<KenariUsage> {
|
|
209
|
+
const raw = await callKenariTool(apiKey, 'kenari_usage');
|
|
210
|
+
return parseUsageText(raw);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function errorMessage(error: unknown, fallback: string): string {
|
|
214
|
+
return error instanceof Error ? error.message : fallback;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Build the Kenari usage report. The three upstream calls (quota REST + two
|
|
219
|
+
* MCP tools) run independently so a failure in one does not lose the others;
|
|
220
|
+
* failures are folded into the report's `error` field.
|
|
221
|
+
*/
|
|
222
|
+
export async function buildKenariReport(): Promise<KenariUsageReport> {
|
|
223
|
+
const apiKey = await resolveKenariApiKey();
|
|
224
|
+
if (!apiKey) return { configured: false };
|
|
225
|
+
|
|
226
|
+
const report: KenariUsageReport = { configured: true };
|
|
227
|
+
const [quota, balance, usage] = await Promise.allSettled([
|
|
228
|
+
fetchKenariQuota(apiKey),
|
|
229
|
+
fetchKenariBalance(apiKey),
|
|
230
|
+
fetchKenariUsage(apiKey),
|
|
231
|
+
]);
|
|
232
|
+
|
|
233
|
+
const errors: string[] = [];
|
|
234
|
+
if (quota.status === 'fulfilled') {
|
|
235
|
+
report.quota = quota.value;
|
|
236
|
+
} else {
|
|
237
|
+
errors.push(errorMessage(quota.reason, 'Failed to load quota'));
|
|
238
|
+
}
|
|
239
|
+
if (balance.status === 'fulfilled') {
|
|
240
|
+
report.balance = balance.value;
|
|
241
|
+
} else {
|
|
242
|
+
errors.push(errorMessage(balance.reason, 'Failed to load balance'));
|
|
243
|
+
}
|
|
244
|
+
if (usage.status === 'fulfilled') {
|
|
245
|
+
report.usage = usage.value;
|
|
246
|
+
} else {
|
|
247
|
+
errors.push(errorMessage(usage.reason, 'Failed to load usage'));
|
|
248
|
+
}
|
|
249
|
+
if (errors.length > 0) report.error = errors.join(' · ');
|
|
250
|
+
return report;
|
|
251
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getDb } from '@/server/db.server';
|
|
2
|
+
import { readOmpProviderApiKey } from '@/server/lib/omp/core/auth-credentials';
|
|
3
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
4
|
+
|
|
5
|
+
const SETTINGS_KEY = 'omp_providers_config';
|
|
6
|
+
const MASKED_KEY_PATTERN = /•{3,}/;
|
|
7
|
+
|
|
8
|
+
interface ProviderEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function toProviderEntry(value: unknown): ProviderEntry | null {
|
|
16
|
+
if (!isRecord(value)) return null;
|
|
17
|
+
return {
|
|
18
|
+
name: typeof value.name === 'string' ? value.name : '',
|
|
19
|
+
slug: typeof value.slug === 'string' ? value.slug : '',
|
|
20
|
+
baseUrl: typeof value.baseUrl === 'string' ? value.baseUrl : '',
|
|
21
|
+
apiKey: typeof value.apiKey === 'string' ? value.apiKey : '',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function loadProviderEntries(): Promise<ProviderEntry[]> {
|
|
26
|
+
const db = await getDb();
|
|
27
|
+
const row = await db.get<{ value?: string }>(
|
|
28
|
+
'SELECT value FROM app_settings WHERE key = ?',
|
|
29
|
+
[SETTINGS_KEY],
|
|
30
|
+
);
|
|
31
|
+
if (!row || typeof row.value !== 'string' || row.value.trim().length === 0) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
let parsed: unknown;
|
|
35
|
+
try {
|
|
36
|
+
parsed = JSON.parse(row.value);
|
|
37
|
+
} catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
if (!Array.isArray(parsed)) return [];
|
|
41
|
+
return parsed
|
|
42
|
+
.map(toProviderEntry)
|
|
43
|
+
.filter((entry): entry is ProviderEntry => entry !== null);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Resolve a provider key: first the app DB (`app_settings.omp_providers_config`,
|
|
48
|
+
* matching via `predicate` and rejecting masked placeholders like "••••••"),
|
|
49
|
+
* then — when the app DB has no usable key — omp's own credential stores
|
|
50
|
+
* (models.yml `providers.<slug>.apiKey`, then agent.db `auth_credentials`).
|
|
51
|
+
* Returns the raw key — callers must never serialize, log, or echo it back.
|
|
52
|
+
*/
|
|
53
|
+
async function resolveApiKey(
|
|
54
|
+
slug: string,
|
|
55
|
+
predicate: (entry: ProviderEntry) => boolean,
|
|
56
|
+
): Promise<string | null> {
|
|
57
|
+
const entries = await loadProviderEntries();
|
|
58
|
+
for (const entry of entries) {
|
|
59
|
+
if (!predicate(entry)) continue;
|
|
60
|
+
const key = entry.apiKey.trim();
|
|
61
|
+
if (key.length === 0 || MASKED_KEY_PATTERN.test(key)) continue;
|
|
62
|
+
return key;
|
|
63
|
+
}
|
|
64
|
+
return readOmpProviderApiKey(slug);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Resolve the Kenari provider key (baseUrl kenari.id, or name/slug "kenari"). */
|
|
68
|
+
export function resolveKenariApiKey(): Promise<string | null> {
|
|
69
|
+
return resolveApiKey('kenari', (entry) =>
|
|
70
|
+
entry.baseUrl.toLowerCase().includes('kenari.id') ||
|
|
71
|
+
entry.name.toLowerCase().includes('kenari') ||
|
|
72
|
+
entry.slug.toLowerCase().includes('kenari'),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Resolve the DeepSeek provider key (baseUrl deepseek.com, or name/slug "deepseek"). */
|
|
77
|
+
export function resolveDeepSeekApiKey(): Promise<string | null> {
|
|
78
|
+
return resolveApiKey('deepseek', (entry) =>
|
|
79
|
+
entry.baseUrl.toLowerCase().includes('deepseek.com') ||
|
|
80
|
+
entry.name.toLowerCase().includes('deepseek') ||
|
|
81
|
+
entry.slug.toLowerCase().includes('deepseek'),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Utility to determine whether the application is running in MOCK mode.
|
|
8
|
+
*
|
|
9
|
+
* - When MOCK=true (or MOCK=1): all data uses mock / simulated presets (demo chat traces, mock token analytics, mock settings presets).
|
|
10
|
+
* - When MOCK=false (or MOCK=0): all data uses real data (real SQLite persistence, real token calculations, real workspace state).
|
|
11
|
+
*/
|
|
12
|
+
export function isMockMode(): boolean {
|
|
13
|
+
const envVal = (Bun.env.MOCK || '').trim().toLowerCase();
|
|
14
|
+
|
|
15
|
+
if (envVal === 'false' || envVal === '0' || envVal === 'off' || envVal === 'no') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (envVal === 'true' || envVal === '1' || envVal === 'on' || envVal === 'yes') {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Default to true for sandbox / preview demo mode if not explicitly set to false
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getMockModeInfo(): { isMock: boolean; rawEnv: string } {
|
|
28
|
+
const isMock = isMockMode();
|
|
29
|
+
return {
|
|
30
|
+
isMock,
|
|
31
|
+
rawEnv: Bun.env.MOCK || (isMock ? 'true (default)' : 'false'),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// node:zlib stays for brotli only — Bun has no brotli API (Bun.brotliCompressSync is undefined).
|
|
2
|
+
import { brotliCompressSync, constants } from 'node:zlib';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compresses a response body, except `text/event-stream`.
|
|
6
|
+
*
|
|
7
|
+
* SSE must never be compressed: zlib holds small frames until its buffer
|
|
8
|
+
* fills, so a compressed event stream delivers nothing until it ends. This
|
|
9
|
+
* mirrors the Express `compression({ filter })` it replaces.
|
|
10
|
+
*
|
|
11
|
+
* The incoming body is buffered and a fresh `Response` is returned, because a
|
|
12
|
+
* `Response` body can only be read once — reading it here would otherwise
|
|
13
|
+
* leave Elysia nothing to send.
|
|
14
|
+
*/
|
|
15
|
+
const MIN_BYTES = 1024;
|
|
16
|
+
|
|
17
|
+
const COMPRESSIBLE = /^(text\/|application\/(json|javascript|xml|wasm|svg))/;
|
|
18
|
+
|
|
19
|
+
function compress(body: Uint8Array<ArrayBuffer>, encoding: 'br' | 'gzip'): Uint8Array {
|
|
20
|
+
return encoding === 'br'
|
|
21
|
+
? brotliCompressSync(body, { params: { [constants.BROTLI_PARAM_QUALITY]: 4 } })
|
|
22
|
+
: Bun.gzipSync(body, { level: 6 });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function maybeCompress(response: Response, acceptEncoding: string | null): Promise<Response> {
|
|
26
|
+
if (!acceptEncoding) return response;
|
|
27
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
28
|
+
if (contentType.includes('text/event-stream')) return response;
|
|
29
|
+
if (!COMPRESSIBLE.test(contentType)) return response;
|
|
30
|
+
if (response.status === 204 || response.status === 304) return response;
|
|
31
|
+
|
|
32
|
+
const encoding = acceptEncoding.includes('br') ? 'br' : acceptEncoding.includes('gzip') ? 'gzip' : null;
|
|
33
|
+
if (!encoding) return response;
|
|
34
|
+
|
|
35
|
+
const buffer = new Uint8Array(await response.arrayBuffer()) as Uint8Array<ArrayBuffer>;
|
|
36
|
+
if (buffer.byteLength < MIN_BYTES) {
|
|
37
|
+
// Body already consumed — hand back a rebuilt Response over the same bytes.
|
|
38
|
+
return rebuild(response, buffer);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const compressed = compress(buffer, encoding);
|
|
42
|
+
const headers = new Headers(response.headers);
|
|
43
|
+
headers.set('content-encoding', encoding);
|
|
44
|
+
headers.set('content-length', String(compressed.byteLength));
|
|
45
|
+
headers.append('vary', 'accept-encoding');
|
|
46
|
+
return new Response(compressed, { status: response.status, headers });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function rebuild(response: Response, buffer: Uint8Array): Response {
|
|
50
|
+
return new Response(buffer, { status: response.status, headers: response.headers });
|
|
51
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-only asset fallback for the rsbuild dev server.
|
|
3
|
+
*
|
|
4
|
+
* `writeToDisk` puts every emitted asset in `dist/client`, so `tryServeStatic`
|
|
5
|
+
* covers normal requests. HMR artifacts do not reach disk: per-update
|
|
6
|
+
* `*.hot-update.*` chunks and manifests are emitted in-memory only, and they
|
|
7
|
+
* are requested on the page origin (port 3000) even though only the rsbuild
|
|
8
|
+
* dev server (port 3100) can answer them. Without this proxy the manifest
|
|
9
|
+
* fetch returns the HTML shell, `response.json()` throws, and the HMR runtime
|
|
10
|
+
* falls back to a full page reload — forever.
|
|
11
|
+
*
|
|
12
|
+
* A 404 from rsbuild is relayed as-is: the runtime treats it as "no update
|
|
13
|
+
* available" and stays idle, which is the correct steady state. This runs
|
|
14
|
+
* after the disk lookup, so a missing rsbuild dev server costs one failed
|
|
15
|
+
* connection per absent asset and nothing else.
|
|
16
|
+
*/
|
|
17
|
+
const DEV_SERVER = Bun.env.OMPCHAMBER_DEV_SERVER ?? 'http://localhost:3100';
|
|
18
|
+
|
|
19
|
+
const isDev = Bun.env.NODE_ENV !== 'production';
|
|
20
|
+
|
|
21
|
+
const isHmrArtifact = (pathname: string) => pathname.endsWith('.hot-update.json') || pathname.endsWith('.hot-update.js');
|
|
22
|
+
|
|
23
|
+
/** Streamed dev asset for `pathname`, or null when the app should handle it. */
|
|
24
|
+
export async function tryProxyDevAsset(request: Request, pathname: string): Promise<Response | null> {
|
|
25
|
+
const proxied = isDev && (isHmrArtifact(pathname) || pathname.startsWith('/static/'));
|
|
26
|
+
if (!proxied) return null;
|
|
27
|
+
|
|
28
|
+
const { search } = new URL(request.url);
|
|
29
|
+
let upstream: Response;
|
|
30
|
+
try {
|
|
31
|
+
upstream = await fetch(`${DEV_SERVER}${pathname}${search}`, {
|
|
32
|
+
method: request.method,
|
|
33
|
+
headers: { accept: request.headers.get('accept') ?? '*/*' },
|
|
34
|
+
});
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (!upstream.body) return null;
|
|
39
|
+
|
|
40
|
+
// Relay the upstream status: rsbuild's 404 for a stale manifest is the HMR
|
|
41
|
+
// runtime's "no update" signal and must not become a 200 HTML shell.
|
|
42
|
+
return new Response(upstream.body, {
|
|
43
|
+
status: upstream.status,
|
|
44
|
+
headers: {
|
|
45
|
+
'content-type': upstream.headers.get('content-type') ?? 'application/octet-stream',
|
|
46
|
+
'cache-control': 'no-store',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { getDb } from '@/server/db.server';
|
|
4
|
+
import { tryServeStatic } from '@/server/plugins/static';
|
|
5
|
+
import { tryProxyDevAsset } from '@/server/plugins/dev-assets';
|
|
6
|
+
|
|
7
|
+
const CLIENT_INDEX = join(process.cwd(), 'dist/client/index.html');
|
|
8
|
+
|
|
9
|
+
let cachedTemplate: string | null = null;
|
|
10
|
+
let cachedMtimeMs = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Cached, but invalidated on mtime so `rsbuild build --watch` (the dev loop)
|
|
14
|
+
* picks up a new asset manifest without restarting the server.
|
|
15
|
+
*/
|
|
16
|
+
async function readTemplate(): Promise<string> {
|
|
17
|
+
const file = Bun.file(CLIENT_INDEX);
|
|
18
|
+
if (!(await file.exists())) {
|
|
19
|
+
throw new Error(`Client build not found at ${CLIENT_INDEX}. Run \`bun run build\` first.`);
|
|
20
|
+
}
|
|
21
|
+
const { mtimeMs } = await file.stat();
|
|
22
|
+
if (cachedTemplate !== null && mtimeMs === cachedMtimeMs) return cachedTemplate;
|
|
23
|
+
cachedTemplate = await file.text();
|
|
24
|
+
cachedMtimeMs = mtimeMs;
|
|
25
|
+
return cachedTemplate;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Actionable message instead of a bare 500 when the client build is absent. */
|
|
29
|
+
function missingBuildResponse(): Response {
|
|
30
|
+
return new Response(
|
|
31
|
+
`<!doctype html><meta charset="utf-8"><title>OMPChamber</title>
|
|
32
|
+
<body style="font:14px/1.6 ui-monospace,monospace;padding:2rem">
|
|
33
|
+
<h1 style="font-size:1.1rem">Client build not found</h1>
|
|
34
|
+
<p>The server needs <code>dist/client</code> before it can render pages.</p>
|
|
35
|
+
<pre style="background:#f4f1ea;padding:1rem;border-radius:6px">bun run build</pre>
|
|
36
|
+
<p>For a rebuild-on-change loop while developing:</p>
|
|
37
|
+
<pre style="background:#f4f1ea;padding:1rem;border-radius:6px">bunx rsbuild build --watch</pre>
|
|
38
|
+
</body>`,
|
|
39
|
+
{ status: 503, headers: { 'content-type': 'text/html; charset=utf-8' } },
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function readSettings(): Promise<Record<string, unknown>> {
|
|
44
|
+
try {
|
|
45
|
+
const db = await getDb();
|
|
46
|
+
const rows = await db.all<{ key: string; value: string }>('SELECT * FROM app_settings');
|
|
47
|
+
const settings: Record<string, unknown> = {};
|
|
48
|
+
for (const row of rows) {
|
|
49
|
+
try {
|
|
50
|
+
settings[row.key] = JSON.parse(row.value);
|
|
51
|
+
} catch {
|
|
52
|
+
settings[row.key] = row.value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return settings;
|
|
56
|
+
} catch {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function themeColor(theme: string): string {
|
|
62
|
+
return theme === 'one-dark-pro-soft' ? '#282c34' : '#faf8f3';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const MOBILE_UA = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i;
|
|
66
|
+
|
|
67
|
+
export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }) => {
|
|
68
|
+
const pathname = new URL(request.url).pathname;
|
|
69
|
+
|
|
70
|
+
if (pathname.startsWith('/api/')) {
|
|
71
|
+
return new Response(JSON.stringify({ error: 'Not found' }), {
|
|
72
|
+
status: 404,
|
|
73
|
+
headers: { 'content-type': 'application/json; charset=utf-8' },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const asset = await tryServeStatic(pathname);
|
|
78
|
+
if (asset) return asset;
|
|
79
|
+
|
|
80
|
+
const devAsset = await tryProxyDevAsset(request, pathname);
|
|
81
|
+
if (devAsset) return devAsset;
|
|
82
|
+
|
|
83
|
+
if (!(await Bun.file(CLIENT_INDEX).exists())) return missingBuildResponse();
|
|
84
|
+
|
|
85
|
+
const settings = await readSettings();
|
|
86
|
+
const chamberSettings = (settings.omp_chamber_settings ?? {}) as { theme?: string };
|
|
87
|
+
const theme = chamberSettings.theme ?? 'paper';
|
|
88
|
+
const initialIsMobile = MOBILE_UA.test(request.headers.get('user-agent') ?? '');
|
|
89
|
+
|
|
90
|
+
const template = await readTemplate();
|
|
91
|
+
const bootstrap = JSON.stringify({ initialIsMobile, appSettings: settings }).replace(/</g, '\\u003c');
|
|
92
|
+
|
|
93
|
+
return new Response(
|
|
94
|
+
template
|
|
95
|
+
.replace('data-theme="paper"', `data-theme="${theme}"`)
|
|
96
|
+
.replace('<!--app-head-->', `<meta name="theme-color" content="${themeColor(theme)}">`)
|
|
97
|
+
.replace('<!--app-bootstrap-->', `<script>window.__OMP_BOOTSTRAP__=${bootstrap}</script>`),
|
|
98
|
+
{ headers: { 'content-type': 'text/html; charset=utf-8' } },
|
|
99
|
+
);
|
|
100
|
+
});
|