@yeaft/webchat-agent 0.1.1032 → 0.1.1033

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/yeaft/engine.js +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.1032",
3
+ "version": "0.1.1033",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/yeaft/engine.js CHANGED
@@ -2051,6 +2051,20 @@ export class Engine {
2051
2051
  signal,
2052
2052
  onRawExchange: captureRawExchange,
2053
2053
  })) {
2054
+ // task-325a (abort-stop fix): per-event abort short-circuit.
2055
+ // The adapter is expected to throw AbortError when fetch's
2056
+ // signal fires, but in practice undici/HTTP-2/proxy layers
2057
+ // can hand us a batch of SSE chunks that were already buffered
2058
+ // when abort was requested. Those chunks would otherwise be
2059
+ // forwarded to the caller (web-bridge → WS → browser) for
2060
+ // 1–2s after the user pressed Stop, producing the exact
2061
+ // symptom "Stop button doesn't stop the turn". Drop every
2062
+ // post-abort event by throwing into the outer catch, which
2063
+ // converges on the same `aborted` + `turn_end` terminal pair
2064
+ // as the adapter-throws-AbortError path.
2065
+ if (signal?.aborted) {
2066
+ throw new LLMAbortError();
2067
+ }
2054
2068
  switch (event.type) {
2055
2069
  case 'text_delta':
2056
2070
  if (ttfbMs === null) ttfbMs = Date.now() - startTime;