fix(webui): move the live stream to /api/stream so reloading /events serves the page
This commit is contained in:
1 parent
9de96c1d42
commit
36e69724a4
10 files changed
+43
-19
No files matched your search
@@ -190,7 +190,7 @@
|
||||
"url": "/dev/prds/dashboard-live-state/",
|
||||
"title": "Dashboard live state",
|
||||
"section": "PRDs",
|
||||
"body": "# Dashboard live state\n\n**Status:** Approved\n\n## Decision\n\nThe dashboard must not require passive **Refresh** buttons. One app-wide Pinia\nstore owns the existing `/events` EventSource and translates backend events\ninto resource revision counters. Pages load their authoritative HTTP projection\non entry and re-read it when the relevant revision changes. Event payloads are\ninvalidation signals, not substitute read models.\n\nSSE remains the transport. Dashboard updates are server-to-client only, and the\nexisting stream already provides replay, reconnect, and persisted ordering; a\nWebSocket would add a second transport without adding a capability.\n\nThe first slice covers resources for which the backend already emits a truthful\nsignal:\n\n- task events invalidate the dashboard, task board, workflow statistics, and\n the matching task-run page;\n- capture events invalidate the capture list;\n- curator events invalidate curator status, and curator actions also invalidate\n the skill catalogue;\n- update reports invalidate System status;\n- opening a page always loads its resource, and reopening the SSE stream\n invalidates mounted projections after a connection loss.\n\nLogs retain their dedicated SSE tail. Local mutations continue to re-read their\nown resource after success. Configuration, channels, and catalogues that have no\nbackend change event load on route entry; future write contracts must emit an\nowner-specific event rather than introduce polling or restore a button.\n\n## Boundaries\n\nThe Pinia store owns browser connection state and invalidation only. It does not\nbecome an alternate backend cache or copy domain state into a generic global\nobject. Existing feature modules continue to own their DTOs and API reads.\n\nOperational commands are not refresh controls. Channel **Reload** remains an\nexplicit adapter lifecycle action. Authentication recovery is also not a data\nrefresh: a 401 moves the application into shared authentication state; reloading\nthe same URL cannot restore Archie's missing or rotated token and must not be\noffered as a fix.\n\n## Verification\n\n- No passive page action renders the label **Refresh** or **Retry** for a read.\n- Only one shared `/events` EventSource is opened by the application.\n- Resource classification tests distinguish task, capture, curator, skill, and\n update invalidations.\n- UI tests, type checking, generated asset freshness, and `task check` pass.\n"
|
||||
"body": "# Dashboard live state\n\n**Status:** Approved\n\n## Decision\n\nThe dashboard must not require passive **Refresh** buttons. One app-wide Pinia\nstore owns the existing `/api/stream` EventSource and translates backend events\ninto resource revision counters. Pages load their authoritative HTTP projection\non entry and re-read it when the relevant revision changes. Event payloads are\ninvalidation signals, not substitute read models.\n\nSSE remains the transport. Dashboard updates are server-to-client only, and the\nexisting stream already provides replay, reconnect, and persisted ordering; a\nWebSocket would add a second transport without adding a capability.\n\nThe first slice covers resources for which the backend already emits a truthful\nsignal:\n\n- task events invalidate the dashboard, task board, workflow statistics, and\n the matching task-run page;\n- capture events invalidate the capture list;\n- curator events invalidate curator status, and curator actions also invalidate\n the skill catalogue;\n- update reports invalidate System status;\n- opening a page always loads its resource, and reopening the SSE stream\n invalidates mounted projections after a connection loss.\n\nLogs retain their dedicated SSE tail. Local mutations continue to re-read their\nown resource after success. Configuration, channels, and catalogues that have no\nbackend change event load on route entry; future write contracts must emit an\nowner-specific event rather than introduce polling or restore a button.\n\n## Boundaries\n\nThe Pinia store owns browser connection state and invalidation only. It does not\nbecome an alternate backend cache or copy domain state into a generic global\nobject. Existing feature modules continue to own their DTOs and API reads.\n\nOperational commands are not refresh controls. Channel **Reload** remains an\nexplicit adapter lifecycle action. Authentication recovery is also not a data\nrefresh: a 401 moves the application into shared authentication state; reloading\nthe same URL cannot restore Archie's missing or rotated token and must not be\noffered as a fix.\n\n## Verification\n\n- No passive page action renders the label **Refresh** or **Retry** for a read.\n- Only one shared `/api/stream` EventSource is opened by the application.\n- Resource classification tests distinguish task, capture, curator, skill, and\n update invalidations.\n- UI tests, type checking, generated asset freshness, and `task check` pass.\n"
|
||||
},
|
||||
{
|
||||
"url": "/dev/prds/dashboard-navigation-groups/",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
## Decision
|
||||
|
||||
The dashboard must not require passive **Refresh** buttons. One app-wide Pinia
|
||||
store owns the existing `/events` EventSource and translates backend events
|
||||
store owns the existing `/api/stream` EventSource and translates backend events
|
||||
into resource revision counters. Pages load their authoritative HTTP projection
|
||||
on entry and re-read it when the relevant revision changes. Event payloads are
|
||||
invalidation signals, not substitute read models.
|
||||
@@ -46,7 +46,7 @@ offered as a fix.
|
||||
## Verification
|
||||
|
||||
- No passive page action renders the label **Refresh** or **Retry** for a read.
|
||||
- Only one shared `/events` EventSource is opened by the application.
|
||||
- Only one shared `/api/stream` EventSource is opened by the application.
|
||||
- Resource classification tests distinguish task, capture, curator, skill, and
|
||||
update invalidations.
|
||||
- UI tests, type checking, generated asset freshness, and `task check` pass.
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
//
|
||||
// This handler is transport only: parsing the log format belongs to the
|
||||
// logging package, which owns it. Live output reaches the dashboard over the
|
||||
// existing /events stream; this endpoint exists so the view has history from
|
||||
// existing /api/stream stream; this endpoint exists so the view has history from
|
||||
// before the browser connected, which is the whole reason file logging landed
|
||||
// first.
|
||||
func (s *Server) handleLogs(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -85,7 +85,7 @@ func TestEventPumpKeepsItsWatermarkAcrossAStoreFailure(t *testing.T) {
|
||||
}
|
||||
|
||||
// The bead's headline claim: an event written to the State Store by another
|
||||
// process reaches a browser hanging on /events, with no in-process bus.
|
||||
// process reaches a browser hanging on /api/stream, with no in-process bus.
|
||||
func TestEventPumpReachesALiveSSEClient(t *testing.T) {
|
||||
srv := newRemoteTestServer(t)
|
||||
pump := newTestPump(t, srv)
|
||||
@@ -123,7 +123,7 @@ func TestEventPumpReachesALiveSSEClient(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// newSSETestServer serves the dashboard's real route set, so /events goes
|
||||
// newSSETestServer serves the dashboard's real route set, so /api/stream goes
|
||||
// through requireToken and the mux exactly as a browser reaches it.
|
||||
func newSSETestServer(t *testing.T, srv *Server) *httptest.Server {
|
||||
t.Helper()
|
||||
@@ -132,25 +132,25 @@ func newSSETestServer(t *testing.T, srv *Server) *httptest.Server {
|
||||
return ts
|
||||
}
|
||||
|
||||
// openSSEStream connects to /events and relays each response line on a
|
||||
// openSSEStream connects to /api/stream and relays each response line on a
|
||||
// channel. The request context ends the handler, which is what lets the
|
||||
// test server close.
|
||||
func openSSEStream(t *testing.T, ctx context.Context, ts *httptest.Server) <-chan string {
|
||||
t.Helper()
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events", nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/api/stream", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("sse request: %v", err)
|
||||
}
|
||||
resp, err := ts.Client().Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("GET /events: %v", err)
|
||||
t.Fatalf("GET /api/stream: %v", err)
|
||||
}
|
||||
// Closed at cleanup rather than by the reader goroutine: the body is the
|
||||
// live stream and must outlive this function, but it still has exactly
|
||||
// one owner and one close.
|
||||
t.Cleanup(func() { _ = resp.Body.Close() })
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Fatalf("GET /events = %d, want 200", resp.StatusCode)
|
||||
t.Fatalf("GET /api/stream = %d, want 200", resp.StatusCode)
|
||||
}
|
||||
lines := make(chan string, 64)
|
||||
go func() {
|
||||
@@ -243,3 +243,28 @@ func TestPumpPriming(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// A dashboard route reloaded in the browser must get the app shell. The live
|
||||
// stream once sat at /events, the same path as the Events page, so a reload
|
||||
// there rendered the raw event stream instead of the page.
|
||||
func TestDashboardRoutesServeTheAppShell(t *testing.T) {
|
||||
ts := newSSETestServer(t, &Server{})
|
||||
for _, path := range []string{"/events", "/events?tab=inspector"} {
|
||||
t.Run(path, func(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second)
|
||||
defer cancel()
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+path, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("GET %s: %v", path, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if ct := resp.Header.Get("Content-Type"); strings.HasPrefix(ct, "text/event-stream") {
|
||||
t.Fatalf("GET %s served the event stream, want the app shell", path)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ func (s *Server) Handler() http.Handler {
|
||||
s.registerChatRoutes(mux)
|
||||
|
||||
mux.HandleFunc("GET /health/detailed", s.handleHealthDetailed)
|
||||
mux.HandleFunc("GET /events", s.handleSSE)
|
||||
mux.HandleFunc("GET /api/stream", s.handleSSE)
|
||||
mux.Handle("GET /", s.assets())
|
||||
|
||||
top := http.NewServeMux()
|
||||
|
||||
@@ -252,7 +252,7 @@ func TestSSESinceDegradesUnparseableCursorToBeginning(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/events", nil)
|
||||
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/api/stream", nil)
|
||||
if tt.since != "" {
|
||||
q := req.URL.Query()
|
||||
q.Set("since", tt.since)
|
||||
|
||||
@@ -316,7 +316,7 @@ func TestHandleSSEEventsSinceError(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second)
|
||||
defer cancel()
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events?since=0", nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/api/stream?since=0", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -362,7 +362,7 @@ func TestHandleSSEUsesLastEventIDForCatchUp(t *testing.T) {
|
||||
|
||||
ts := httptest.NewServer(srv.Handler())
|
||||
t.Cleanup(ts.Close)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events", nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/api/stream", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -407,7 +407,7 @@ func TestHandleSSEBacklogAndLive(t *testing.T) {
|
||||
|
||||
// The request carries t.Context() so the SSE stream is torn down when
|
||||
// the test ends rather than leaking the connection and its goroutine.
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events", nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/api/stream", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -454,7 +454,7 @@ func TestHandleSSEFiltersTurnCompletedFromLiveBroadcast(t *testing.T) {
|
||||
ts := httptest.NewServer(srv.Handler())
|
||||
t.Cleanup(ts.Close)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events", nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/api/stream", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
||||
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
|
||||
`)&&(ki(e,0)||yi(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||c(a)&&!re(a)||a[0]===`.`||t&&!re(a)||u&&u.includes(a)){if(Ei(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&cn(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&Ns(x,n,t),h&&wr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&ls(()=>{x&&Ns(x,n,t),l&&g.enter(e),h&&wr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=As(d[t]),g=h.type===fs;e?(g&&!u&&t+1<p&&As(d[t+1]).type===fs&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,ki(r,1)||yi()),n(null,h,r,null,o,s,Si(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&Ci(f)&&f.data===`]`?a(t.anchor=f):(yi(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,c,l)=>{if(ji(e,t)||yi(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)s(n);else break}}let u=a(e),d=o(e);return s(e),n(null,t,d,u,r,i,Si(d),c),r&&(r.vnode.el=t.el,So(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&Ci(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var Ti=new Set([`src`,`srcset`,`href`,`poster`]);function Ei(e,t,n){return Ti.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var Di=`data-allow-mismatch`,Oi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function ki(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Di);)e=e.parentElement;return Ai(e&&e.getAttribute(Di),t)}function Ai(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(Oi[t])}}function ji(e,t){return ki(e.parentElement,1)||Mi(e)||Ni(t)}function Mi(e){return e.nodeType===1&&Ai(e.getAttribute(Di),1)}function Ni({props:e}){let t=e&&e[Di];return typeof t==`string`&&Ai(t,1)}var Pi=ge().requestIdleCallback||(e=>setTimeout(e,1)),Fi=ge().cancelIdleCallback||(e=>clearTimeout(e)),Ii=(e=1e4)=>t=>{let n=Pi(t,{timeout:e});return()=>Fi(n)};function Li(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Ri=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(Li(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},zi=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Bi=(e=[])=>(t,n)=>{b(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Vi(e,t){if(Ci(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Ci(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Hi=e=>!!e.type.__asyncLoader;function Ui(e){y(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return N({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Vi(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=Ls;if(fi(e),u)return()=>Wi(u,e);let t=t=>{l=null,Xn(t,e,13,!r)};if(s&&e.suspense||Ws)return p().then(t=>()=>Wi(t,e)).catch(e=>(t(e),()=>r?V(r,{error:e}):null));let a=k(!1),c=k(),d=k(!!i),f,m;return sa(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&Gi(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Wi(u,e);if(c.value&&r)return V(r,{error:c.value});if(n&&
Line truncated
|
||||
`))),e[Gl]=Hl(i);let a=r||i.props&&i.props.type===`number`;ll(e,t?`change`:`input`,t=>{t.target.composing||e[Gl](ql(e.value,n,a))}),(n||a)&&ll(e,`change`,()=>{e.value=ql(e.value,n,a)}),t||(ll(e,`compositionstart`,Ul),ll(e,`compositionend`,Wl),ll(e,`change`,Wl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Kl];delete e[Kl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Gl](ql(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Gl]=Hl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?pe(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Yl={deep:!0,created(e,t,n){e[Gl]=Hl(n),ll(e,`change`,()=>{let t=e._modelValue,n=tu(e),r=e.checked,i=e[Gl];if(m(t)){let e=Me(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(g(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(nu(e,r))})},mounted:Xl,beforeUpdate(e,t,n){e[Gl]=Hl(n),Xl(e,t,n)}};function Xl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(m(t))i=Me(t,r.props.value)>-1;else if(g(t))i=t.has(r.props.value);else{if(t===n)return;i=je(t,nu(e,!0))}e.checked!==i&&(e.checked=i)}var Zl={created(e,{value:t},n){e.checked=je(t,n.props.value),e[Gl]=Hl(n),ll(e,`change`,()=>{e[Gl](tu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Gl]=Hl(r),t!==n&&(e.checked=je(t,r.props.value))}},Ql={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,ll(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pe(tu(e)):tu(e)),r=e.multiple,i=r?g(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?m(i)?t.slice():t:i];try{e[Gl](i)}finally{ar(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Gl]=Hl(r)},mounted(e,{value:t}){eu(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Gl]=Hl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!$l(t,n[1],n[0]))&&eu(e,t)}};function $l(e,t,n){if(!n||m(e))return je(e,t);if(g(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function eu(e,t){let n=e.multiple,r=m(t);if(!n||r||g(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=tu(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Me(t,o)>-1}else a.selected=t.has(o)}else if(je(tu(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function tu(e){return`_value`in e?e._value:e.value}function nu(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var ru={created(e,t,n){au(e,t,n,null,`created`)},mounted(e,t,n){au(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){au(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){au(e,t,n,r,`updated`)}};function iu(e,t){switch(e){case`SELECT`:return Ql;case`TEXTAREA`:return Jl;default:switch(t){case`checkbox`:return Yl;case`radio`:return Zl;default:return Jl}}}function au(e,t,n,r,i){let a=iu(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function ou(){Jl.getSSRProps=({value:e})=>({value:e}),Zl.getSSRProps=({value:e},t)=>{if(t.props&&je(t.props.value,e))return{checked:!0}},Yl.getSSRProps=({value:e},t)=>{if(m(e)){if(t.props&&Me(e,t.props.value)>-1)return{checked:!0}}else if(g(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},ru.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=iu(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var su=[`ctrl`,`shift`,`alt`,`meta`],cu={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>su.some(n=>e[`${n}Key`]&&!t.includes(n))},lu=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=cu[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},uu={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},du=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ce(n.key);if(t.some(e=>e===r||uu[e]===r))return e(n)}))},fu=u({patchProp:xl},xc),pu,mu=!1;function hu(){return pu||=Ho(fu)}function gu(){return pu=mu?pu:Uo(fu),mu=!0,pu}var _u=((...e)=>{hu().render(...e)}),vu=((...e)=>{gu().hydrate(...e)}),yu=((...e)=>{let t=hu().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Su(e);if(!r)return;let i=t._component;!y(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,xu(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),bu=((
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Op;function kp(e){Op=e}var Ap=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function jp(e){let t=e instanceof Ap?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Mp(e,t){let n=await fetch(e,t);if(Op?.(n.status===401),!n.ok)throw new Ap(await Dp(n),n.status);return n}async function Np(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Tp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Mp(e,s);return a?await c.json():void 0}var Y={health:()=>Np(`/health/detailed`),summary:()=>Np(`/api/summary`),tasks:()=>Np(`/api/tasks`),taskMeta:()=>Np(`/api/task-meta`),task:e=>Np(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Np(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/changes`+Ep(t)),taskDebug:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/debug`+Ep(t)),taskAction:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t}}),setup:()=>Np(`/api/setup`),capabilities:()=>Np(`/api/capabilities`),workflows:()=>Np(`/api/workflows`),workRequest:e=>Np(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Np(`/api/skills`),channels:()=>Np(`/api/channels`),curators:()=>Np(`/api/curators`),channelReload:e=>Np(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Np(`/api/config`),logs:e=>Np(`/api/logs`+Ep(e)),taskLogs:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/logs`+Ep(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Np(`/api/version`),updateSnapshot:()=>Np(`/api/chat/update`),updateInstall:e=>Np(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Np(`/api/captures`+Ep({limit:e})),mappings:()=>Np(`/api/mappings`),mappingCreate:e=>Np(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Np(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Np(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Np(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Np(`/api/bindings`),bindingCreate:e=>Np(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Np(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Np(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Np(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),chatSessions:()=>Np(`/api/chat/sessions`),chatMessages:e=>Np(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Np(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Np(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Np(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:wp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Np(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Np(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Np(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Np(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Mp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Pp(e,t){let n=new EventSource(`/events`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(`reconnecting`),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}function Fp(e,t){let n=new EventSource(`/api/logs/stream`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(Cp(n.readyState)),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}var Ip=`archie.web.chat.channel`;function Lp(){let e=localStorage.getItem(Ip);return e||(e=wp(),localStorage.setItem(Ip,e)),e}var Rp=/(?:^|\s)\/([^\s]*)$/,zp=/(?:^|\s)\/[^\s]*$/,Bp=8;function Vp(e,t,n){let r=t.slice(0,n).match(Rp);if(!r)return[];let i=r[1].toLowerCase();return e.filter(e=>`${e.command} ${e.description??``}`.toLowerCase().includes(i)).slice(0,Bp)}function Hp(e,t,n){let r=e.slice(0,t),i=e.slice(t),a=r.search(zp),o=a<0?r.length:a+ +(r[a]===` `);return{text:`${r.slice(0,o)}${n} ${i}`,cursor:o+n.length+1}}function Up(e,t){let n=t.trim();return e.some(e=>e.command===n)}function Wp(e){return{text:e,sourceID:wp()}}function Gp(e){return{...e}}function Kp(e,t){let n=!!(e&&typeof e==`object`&&e.turn&&typeof e.turn.text==`string`),r=n?e.turn.text:t.trim();
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Op;function kp(e){Op=e}var Ap=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function jp(e){let t=e instanceof Ap?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Mp(e,t){let n=await fetch(e,t);if(Op?.(n.status===401),!n.ok)throw new Ap(await Dp(n),n.status);return n}async function Np(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Tp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Mp(e,s);return a?await c.json():void 0}var Y={health:()=>Np(`/health/detailed`),summary:()=>Np(`/api/summary`),tasks:()=>Np(`/api/tasks`),taskMeta:()=>Np(`/api/task-meta`),task:e=>Np(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Np(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/changes`+Ep(t)),taskDebug:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/debug`+Ep(t)),taskAction:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t}}),setup:()=>Np(`/api/setup`),capabilities:()=>Np(`/api/capabilities`),workflows:()=>Np(`/api/workflows`),workRequest:e=>Np(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Np(`/api/skills`),channels:()=>Np(`/api/channels`),curators:()=>Np(`/api/curators`),channelReload:e=>Np(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Np(`/api/config`),logs:e=>Np(`/api/logs`+Ep(e)),taskLogs:(e,t)=>Np(`/api/tasks/${encodeURIComponent(e)}/logs`+Ep(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Np(`/api/version`),updateSnapshot:()=>Np(`/api/chat/update`),updateInstall:e=>Np(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Np(`/api/captures`+Ep({limit:e})),mappings:()=>Np(`/api/mappings`),mappingCreate:e=>Np(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Np(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Np(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Np(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Np(`/api/bindings`),bindingCreate:e=>Np(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Np(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Np(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Np(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),chatSessions:()=>Np(`/api/chat/sessions`),chatMessages:e=>Np(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Np(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Np(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Np(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:wp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Np(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Np(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Np(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Np(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Mp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Pp(e,t){let n=new EventSource(`/api/stream`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(`reconnecting`),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}function Fp(e,t){let n=new EventSource(`/api/logs/stream`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(Cp(n.readyState)),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}var Ip=`archie.web.chat.channel`;function Lp(){let e=localStorage.getItem(Ip);return e||(e=wp(),localStorage.setItem(Ip,e)),e}var Rp=/(?:^|\s)\/([^\s]*)$/,zp=/(?:^|\s)\/[^\s]*$/,Bp=8;function Vp(e,t,n){let r=t.slice(0,n).match(Rp);if(!r)return[];let i=r[1].toLowerCase();return e.filter(e=>`${e.command} ${e.description??``}`.toLowerCase().includes(i)).slice(0,Bp)}function Hp(e,t,n){let r=e.slice(0,t),i=e.slice(t),a=r.search(zp),o=a<0?r.length:a+ +(r[a]===` `);return{text:`${r.slice(0,o)}${n} ${i}`,cursor:o+n.length+1}}function Up(e,t){let n=t.trim();return e.some(e=>e.command===n)}function Wp(e){return{text:e,sourceID:wp()}}function Gp(e){return{...e}}function Kp(e,t){let n=!!(e&&typeof e==`object`&&e.turn&&typeof e.turn.text==`string`),r=n?e.turn.text:t.tri
Line truncated
|
||||
|
||||
`);u=r.pop()||``;for(let e of r){let t=e.split(`
|
||||
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Xp.value=n.session_id),n.type===`delta`&&(o+=n.text,tm.value=tm.value?{...tm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],tm.value=tm.value?{...tm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Zp.value=[...Zp.value,{from:`assistant`,text:o,tool_calls:a}],tm.value=null,$p.value=`Ready`,await gm()}catch(e){let t=e;t.name===`AbortError`&&!c?(tm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},$p.value=`Stopped`):(tm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Gp(r):void 0,isRetry:i},$p.value=`Error — retry available`)}finally{clearTimeout(l),mm=null,em.value=!1}}function km(){$p.value=`Stopping…`,Xp.value&&Y.chatCancel(Xp.value).catch(()=>{}),hm()}function Am(){ra(()=>{gm().catch(e=>{$p.value=e.message||`Chat unavailable`})}),sa(()=>{hm()})}var jm=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Mm=N({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(L(),R(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full bg-linear-to-br from-primary to-[var(--brand-alt)] text-primary-foreground shadow-[var(--shadow-md)] transition-[transform,box-shadow] duration-[140ms] hover:-translate-y-px hover:shadow-[0_12px_34px_var(--primary-soft)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":A(qp),onClick:i[0]||=e=>n(`toggle`)},[B(`span`,{"aria-hidden":`true`,class:D(r(!e.open))},[V(A(jd),{size:22})],2),B(`span`,{"aria-hidden":`true`,class:D(r(e.open))},[V(A(qd),{size:22})],2)],8,jm))}});function Nm(e){return typeof e==`string`?`'${e}'`:new Lm().serialize(e)}var Pm=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Fm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Pm.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Im(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Fm[n]?Fm[n]:n+128,s=a<128&&Fm[a]?Fm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Lm=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Im(e,t):n===`number`&&r===`number`?e-t:Im(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Im),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`InLine truncated
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ export function subscribeEvents(
|
||||
onEvent: (event: unknown) => void,
|
||||
onStateChange?: (state: StreamState) => void,
|
||||
): () => void {
|
||||
const src = new EventSource("/events");
|
||||
const src = new EventSource("/api/stream");
|
||||
src.onopen = () => onStateChange?.("live");
|
||||
src.onerror = () => onStateChange?.("reconnecting");
|
||||
src.onmessage = (e) => {
|
||||
|
||||
@@ -27,7 +27,6 @@ export default defineConfig({
|
||||
proxy: {
|
||||
"/api": "http://127.0.0.1:8484",
|
||||
"/health": "http://127.0.0.1:8484",
|
||||
"/events": { target: "http://127.0.0.1:8484", ws: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user