@stigmer/react 3.0.8-dev.20260612122433 → 3.0.8-dev.20260613051837
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/execution/ExecutionProgress.d.ts.map +1 -1
- package/execution/ExecutionProgress.js +5 -1
- package/execution/ExecutionProgress.js.map +1 -1
- package/execution/MessageThread.d.ts +32 -3
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +59 -10
- package/execution/MessageThread.js.map +1 -1
- package/execution/useExecutionStream.d.ts +76 -5
- package/execution/useExecutionStream.d.ts.map +1 -1
- package/execution/useExecutionStream.js +166 -23
- package/execution/useExecutionStream.js.map +1 -1
- package/internal/VirtualizedThread.d.ts +3 -1
- package/internal/VirtualizedThread.d.ts.map +1 -1
- package/internal/VirtualizedThread.js +4 -2
- package/internal/VirtualizedThread.js.map +1 -1
- package/internal/backoff.d.ts +61 -0
- package/internal/backoff.d.ts.map +1 -0
- package/internal/backoff.js +79 -0
- package/internal/backoff.js.map +1 -0
- package/internal/store/conversation-store.d.ts +34 -0
- package/internal/store/conversation-store.d.ts.map +1 -1
- package/internal/store/conversation-store.js +50 -2
- package/internal/store/conversation-store.js.map +1 -1
- package/internal/store/workflow-execution-event-store.d.ts +12 -0
- package/internal/store/workflow-execution-event-store.d.ts.map +1 -1
- package/internal/store/workflow-execution-event-store.js +7 -0
- package/internal/store/workflow-execution-event-store.js.map +1 -1
- package/internal/stream-controller.d.ts +57 -21
- package/internal/stream-controller.d.ts.map +1 -1
- package/internal/stream-controller.js +117 -3
- package/internal/stream-controller.js.map +1 -1
- package/internal/useFetch.d.ts +7 -0
- package/internal/useFetch.d.ts.map +1 -1
- package/internal/useFetch.js +21 -0
- package/internal/useFetch.js.map +1 -1
- package/package.json +4 -4
- package/session/SessionViewer.js +26 -1
- package/session/SessionViewer.js.map +1 -1
- package/session/useSessionConversation.d.ts +41 -4
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +74 -10
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionExecutions.d.ts +17 -1
- package/session/useSessionExecutions.d.ts.map +1 -1
- package/session/useSessionExecutions.js +6 -2
- package/session/useSessionExecutions.js.map +1 -1
- package/src/execution/ExecutionProgress.tsx +12 -0
- package/src/execution/MessageThread.tsx +174 -5
- package/src/execution/__tests__/MessageThread.test.tsx +64 -0
- package/src/execution/__tests__/useExecutionStream.test.tsx +279 -0
- package/src/execution/useExecutionStream.ts +254 -34
- package/src/internal/VirtualizedThread.tsx +7 -1
- package/src/internal/__tests__/backoff.test.ts +99 -0
- package/src/internal/__tests__/stream-controller.test.ts +165 -10
- package/src/internal/__tests__/useFetch.test.tsx +59 -0
- package/src/internal/backoff.ts +100 -0
- package/src/internal/store/__tests__/conversation-store.test.ts +61 -0
- package/src/internal/store/conversation-store.ts +68 -3
- package/src/internal/store/workflow-execution-event-store.ts +22 -0
- package/src/internal/stream-controller.ts +151 -26
- package/src/internal/useFetch.ts +26 -0
- package/src/session/SessionViewer.tsx +89 -0
- package/src/session/__tests__/useSessionConversation.test.tsx +53 -0
- package/src/session/useSessionConversation.ts +121 -15
- package/src/session/useSessionExecutions.ts +23 -1
- package/src/workflow/WorkflowExecutionHeader.tsx +4 -1
- package/src/workflow/WorkflowExecutionTimeline.tsx +2 -1
- package/src/workflow/__tests__/useWorkflowExecutionEventStream.test.tsx +117 -1
- package/src/workflow/execution/useWaterfallEntries.ts +2 -1
- package/src/workflow/useWorkflowExecutionEventStream.ts +122 -41
- package/src/workflow/waterfall/WaterfallTimeline.tsx +2 -1
- package/styles.css +1 -1
- package/workflow/WorkflowExecutionHeader.d.ts.map +1 -1
- package/workflow/WorkflowExecutionHeader.js +3 -1
- package/workflow/WorkflowExecutionHeader.js.map +1 -1
- package/workflow/WorkflowExecutionTimeline.d.ts.map +1 -1
- package/workflow/WorkflowExecutionTimeline.js +1 -1
- package/workflow/WorkflowExecutionTimeline.js.map +1 -1
- package/workflow/execution/useWaterfallEntries.d.ts.map +1 -1
- package/workflow/execution/useWaterfallEntries.js +1 -1
- package/workflow/execution/useWaterfallEntries.js.map +1 -1
- package/workflow/useWorkflowExecutionEventStream.d.ts +32 -4
- package/workflow/useWorkflowExecutionEventStream.d.ts.map +1 -1
- package/workflow/useWorkflowExecutionEventStream.js +75 -32
- package/workflow/useWorkflowExecutionEventStream.js.map +1 -1
- package/workflow/waterfall/WaterfallTimeline.d.ts.map +1 -1
- package/workflow/waterfall/WaterfallTimeline.js +1 -1
- package/workflow/waterfall/WaterfallTimeline.js.map +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { startTransition, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
|
|
3
3
|
import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
4
|
+
import { isTransientStreamError } from "@stigmer/sdk";
|
|
4
5
|
import { useStigmer } from "../hooks";
|
|
5
6
|
import { toError } from "../internal/toError";
|
|
6
7
|
import { useStreamRate } from "../internal/dev";
|
|
7
|
-
import { StreamController, } from "../internal/stream-controller";
|
|
8
|
+
import { StreamController, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_SLOW_THRESHOLD_MS, } from "../internal/stream-controller";
|
|
9
|
+
import { computeBackoffDelay, sleep, DEFAULT_RECONNECT_MAX_ATTEMPTS, } from "../internal/backoff";
|
|
8
10
|
import { ConversationStore } from "../internal/store";
|
|
9
11
|
import { isTerminalPhase } from "./execution-phases";
|
|
10
12
|
/**
|
|
@@ -13,7 +15,18 @@ import { isTerminalPhase } from "./execution-phases";
|
|
|
13
15
|
*
|
|
14
16
|
* Manages the full subscription lifecycle through a finite state
|
|
15
17
|
* machine: connection establishment, rAF-coalesced snapshot streaming,
|
|
16
|
-
* terminal-phase detection,
|
|
18
|
+
* terminal-phase detection, automatic reconnection with exponential
|
|
19
|
+
* backoff on transient drops, and manual reconnection as the fallback.
|
|
20
|
+
*
|
|
21
|
+
* **Resilience:** a non-terminal stream drop — whether a thrown transport
|
|
22
|
+
* error (WebKit "Load failed", `fetch failed`, `Unavailable`) or a graceful
|
|
23
|
+
* server close mid-run (idle timeout, load-balancer recycle) — is retried
|
|
24
|
+
* automatically with backoff. The last snapshot stays visible
|
|
25
|
+
* (`isReconnecting`), the access token is re-read on each attempt via the
|
|
26
|
+
* per-request interceptor, and `error` is surfaced only once attempts are
|
|
27
|
+
* exhausted. Completion is decided by the terminal phase, never by the
|
|
28
|
+
* stream merely ending (a graceful close of a running execution reconnects
|
|
29
|
+
* rather than falsely reporting "complete"). Opt out via `autoReconnect: false`.
|
|
17
30
|
*
|
|
18
31
|
* **Performance characteristics:**
|
|
19
32
|
* - Non-terminal snapshots are coalesced via `requestAnimationFrame`
|
|
@@ -57,6 +70,15 @@ export function useExecutionStream(executionId, options) {
|
|
|
57
70
|
internalStoreRef.current = new ConversationStore();
|
|
58
71
|
}
|
|
59
72
|
const store = options?.store ?? internalStoreRef.current;
|
|
73
|
+
// -- Reconnect ------------------------------------------------------------
|
|
74
|
+
const [connectKey, setConnectKey] = useState(0);
|
|
75
|
+
// Self-heal-once guard for the connect-timeout watchdog. A ref so it survives
|
|
76
|
+
// the reconnect that the watchdog itself triggers (the controller is reset on
|
|
77
|
+
// every teardown and therefore cannot hold it). Reset only on a genuinely
|
|
78
|
+
// fresh start — a new execution, a healthy snapshot, or a manual reconnect —
|
|
79
|
+
// never on the watchdog's own self-heal hop, so the policy is exactly:
|
|
80
|
+
// first silent timeout → reconnect once; second → surface.
|
|
81
|
+
const connectAutoRetriedRef = useRef(false);
|
|
60
82
|
// -- Controller setup -----------------------------------------------------
|
|
61
83
|
const controllerRef = useRef(null);
|
|
62
84
|
if (!controllerRef.current) {
|
|
@@ -71,19 +93,49 @@ export function useExecutionStream(executionId, options) {
|
|
|
71
93
|
store.setStreamState(state);
|
|
72
94
|
});
|
|
73
95
|
},
|
|
96
|
+
onConnectTimeout() {
|
|
97
|
+
if (connectAutoRetriedRef.current) {
|
|
98
|
+
// Already self-healed once and still silent — surface an actionable
|
|
99
|
+
// signal. The store dedupes, so this never causes a render storm.
|
|
100
|
+
store.setConnectTimedOut(true);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// First silent timeout: re-establish the subscription once. Most
|
|
104
|
+
// transient hangs (buffering proxy, cold start) clear on the retry.
|
|
105
|
+
connectAutoRetriedRef.current = true;
|
|
106
|
+
setConnectKey((k) => k + 1);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
setSlow(value) {
|
|
110
|
+
store.setSlow(value);
|
|
111
|
+
},
|
|
74
112
|
};
|
|
75
|
-
controllerRef.current = new StreamController(sink
|
|
113
|
+
controllerRef.current = new StreamController(sink, undefined, undefined, {
|
|
114
|
+
connectTimeoutMs: options?.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS,
|
|
115
|
+
slowThresholdMs: options?.slowThresholdMs ?? DEFAULT_SLOW_THRESHOLD_MS,
|
|
116
|
+
});
|
|
76
117
|
}
|
|
77
118
|
const controller = controllerRef.current;
|
|
78
|
-
// -- Reconnect ------------------------------------------------------------
|
|
79
|
-
const [connectKey, setConnectKey] = useState(0);
|
|
80
119
|
const reconnect = useCallback(() => {
|
|
120
|
+
// A manual retry gives a fresh self-heal budget and clears the surfaced
|
|
121
|
+
// timeout so the affordance disappears the instant the user acts.
|
|
122
|
+
connectAutoRetriedRef.current = false;
|
|
123
|
+
store.setConnectTimedOut(false);
|
|
81
124
|
setConnectKey((k) => k + 1);
|
|
82
|
-
}, []);
|
|
125
|
+
}, [store]);
|
|
83
126
|
// -- Stream rate instrumentation ------------------------------------------
|
|
84
127
|
const streamRate = useStreamRate();
|
|
85
128
|
const streamRateRef = useRef(streamRate);
|
|
86
129
|
streamRateRef.current = streamRate;
|
|
130
|
+
// -- Reconnect config (ref-backed so option identity churn never resubscribes)
|
|
131
|
+
const autoReconnect = options?.autoReconnect ?? true;
|
|
132
|
+
const reconnectOptions = options?.reconnectOptions;
|
|
133
|
+
const configRef = useRef({ autoReconnect, reconnectOptions });
|
|
134
|
+
configRef.current = { autoReconnect, reconnectOptions };
|
|
135
|
+
// Tracks the execution the store currently holds, so we reset the store on
|
|
136
|
+
// a genuine identity change (A → B) but preserve it across reconnects of the
|
|
137
|
+
// SAME execution. Mirrors useWorkflowExecutionEventStream / useFetch.
|
|
138
|
+
const prevExecutionIdRef = useRef(null);
|
|
87
139
|
// -- Subscription effect --------------------------------------------------
|
|
88
140
|
// Note: controller, store, and streamRate are ref-backed stable objects —
|
|
89
141
|
// they MUST NOT appear in the deps array. Including them would cause
|
|
@@ -92,47 +144,138 @@ export function useExecutionStream(executionId, options) {
|
|
|
92
144
|
if (!executionId) {
|
|
93
145
|
controller.reset();
|
|
94
146
|
store.reset();
|
|
147
|
+
prevExecutionIdRef.current = null;
|
|
148
|
+
connectAutoRetriedRef.current = false;
|
|
95
149
|
return;
|
|
96
150
|
}
|
|
151
|
+
// Reset only when switching to a different execution. Crucially we do NOT
|
|
152
|
+
// reset the store on reconnect (connectKey bump) or on cleanup — that
|
|
153
|
+
// would wipe the conversation to an empty "Connecting…" on every retry.
|
|
154
|
+
// The full-snapshot subscribe re-delivers the entire state on reconnect,
|
|
155
|
+
// so keeping the last-known-good snapshot is both correct and seamless.
|
|
156
|
+
if (prevExecutionIdRef.current !== null &&
|
|
157
|
+
prevExecutionIdRef.current !== executionId) {
|
|
158
|
+
store.reset();
|
|
159
|
+
// A genuinely different execution earns a fresh self-heal budget; the
|
|
160
|
+
// bump that re-runs this effect on reconnect must NOT reset the guard.
|
|
161
|
+
connectAutoRetriedRef.current = false;
|
|
162
|
+
}
|
|
163
|
+
prevExecutionIdRef.current = executionId;
|
|
97
164
|
const abortController = new AbortController();
|
|
165
|
+
const signal = abortController.signal;
|
|
98
166
|
controller.start(executionId);
|
|
99
167
|
(async () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
168
|
+
const { autoReconnect: auto, reconnectOptions: backoff } = configRef.current;
|
|
169
|
+
const maxAttempts = backoff?.maxAttempts ?? DEFAULT_RECONNECT_MAX_ATTEMPTS;
|
|
170
|
+
// 1-based count of consecutive failed attempts. Reset to 0 by any
|
|
171
|
+
// successful snapshot, so each healthy stretch gets a fresh backoff
|
|
172
|
+
// budget rather than inheriting the previous outage's attempt count.
|
|
173
|
+
let attempt = 0;
|
|
174
|
+
// Schedule the next retry after `error`, or stop. Returns `true` when
|
|
175
|
+
// the loop should continue (a retry was scheduled), `false` when it
|
|
176
|
+
// should exit (opted out, exhausted, or aborted). Shared by the
|
|
177
|
+
// thrown-error and premature-end paths so both converge on one policy.
|
|
178
|
+
const scheduleRetry = async (error) => {
|
|
179
|
+
if (!auto || attempt >= maxAttempts) {
|
|
180
|
+
controller.handleError(error);
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
attempt += 1;
|
|
184
|
+
controller.handleReconnecting(attempt, error);
|
|
185
|
+
try {
|
|
186
|
+
await sleep(computeBackoffDelay(attempt, backoff), signal);
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return false; // aborted mid-backoff
|
|
190
|
+
}
|
|
191
|
+
return !signal.aborted;
|
|
192
|
+
};
|
|
193
|
+
while (!signal.aborted) {
|
|
194
|
+
let sawTerminal = false;
|
|
195
|
+
try {
|
|
196
|
+
for await (const snapshot of stigmer.agentExecution.subscribe(executionId, signal)) {
|
|
197
|
+
if (signal.aborted)
|
|
198
|
+
return;
|
|
199
|
+
attempt = 0; // a snapshot proves the connection is healthy
|
|
200
|
+
// The first snapshot also resolves the connect watchdog: clear any
|
|
201
|
+
// surfaced timeout and refresh the self-heal budget for any future
|
|
202
|
+
// silent stretch on this same execution.
|
|
203
|
+
connectAutoRetriedRef.current = false;
|
|
204
|
+
store.setConnectTimedOut(false);
|
|
205
|
+
controller.handleSnapshot(snapshot);
|
|
206
|
+
streamRateRef.current.tick(snapshot.status?.messages?.length ?? 0);
|
|
207
|
+
const phase = snapshot.status?.phase ??
|
|
208
|
+
ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED;
|
|
209
|
+
if (isTerminalPhase(phase)) {
|
|
210
|
+
sawTerminal = true;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
if (signal.aborted)
|
|
103
217
|
return;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
|
|
218
|
+
const error = toError(err);
|
|
219
|
+
// Only known-transient transport noise is retried. A non-transient
|
|
220
|
+
// error (not-found, invalid-argument, …) is deterministic — the
|
|
221
|
+
// same request would fail identically, so surface it immediately.
|
|
222
|
+
if (!auto || !isTransientStreamError(error)) {
|
|
223
|
+
controller.handleError(error);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (await scheduleRetry(error))
|
|
227
|
+
continue;
|
|
228
|
+
return;
|
|
110
229
|
}
|
|
111
|
-
if (
|
|
230
|
+
if (signal.aborted)
|
|
231
|
+
return;
|
|
232
|
+
if (sawTerminal) {
|
|
233
|
+
// handleSnapshot already transitioned to `complete`; flush any
|
|
234
|
+
// buffered frame and finish. Completion is decided by the terminal
|
|
235
|
+
// phase, never by the stream merely ending.
|
|
112
236
|
controller.handleStreamEnd();
|
|
113
237
|
streamRateRef.current.summary();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
if (abortController.signal.aborted)
|
|
118
238
|
return;
|
|
119
|
-
|
|
239
|
+
}
|
|
240
|
+
// The iterator finished without a terminal phase: the server closed a
|
|
241
|
+
// still-running stream (idle timeout, load-balancer recycle, pod
|
|
242
|
+
// restart). This is transient by definition — reconnect and the next
|
|
243
|
+
// full snapshot reconciles whatever changed (including, if it ended
|
|
244
|
+
// meanwhile, the terminal state we missed).
|
|
245
|
+
if (await scheduleRetry(new Error("The connection was interrupted."))) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
return;
|
|
120
249
|
}
|
|
121
250
|
})();
|
|
122
251
|
return () => {
|
|
123
252
|
abortController.abort();
|
|
124
253
|
controller.reset();
|
|
125
|
-
store.reset();
|
|
126
254
|
};
|
|
127
255
|
}, [executionId, stigmer, connectKey]);
|
|
128
256
|
// -- Read from store via useSyncExternalStore ------------------------------
|
|
129
257
|
const execution = useSyncExternalStore(store.subscribe, store.getExecution);
|
|
130
258
|
const streamState = useSyncExternalStore(store.subscribe, store.getStreamState);
|
|
259
|
+
const connectTimedOut = useSyncExternalStore(store.subscribe, store.getConnectTimedOut);
|
|
260
|
+
const isSlow = useSyncExternalStore(store.subscribe, store.getSlow);
|
|
131
261
|
// -- Derive public return values ------------------------------------------
|
|
132
262
|
const phase = useMemo(() => execution?.status?.phase ?? ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED, [execution]);
|
|
133
263
|
const isStreaming = streamState.stage === "streaming";
|
|
134
264
|
const isConnecting = streamState.stage === "connecting";
|
|
265
|
+
const isReconnecting = streamState.stage === "reconnecting";
|
|
266
|
+
const reconnectAttempt = streamState.stage === "reconnecting" ? streamState.attempt : 0;
|
|
135
267
|
const error = streamState.stage === "error" ? streamState.error : null;
|
|
136
|
-
return {
|
|
268
|
+
return {
|
|
269
|
+
execution,
|
|
270
|
+
phase,
|
|
271
|
+
isStreaming,
|
|
272
|
+
isConnecting,
|
|
273
|
+
isReconnecting,
|
|
274
|
+
reconnectAttempt,
|
|
275
|
+
error,
|
|
276
|
+
connectTimedOut,
|
|
277
|
+
isSlow,
|
|
278
|
+
reconnect,
|
|
279
|
+
};
|
|
137
280
|
}
|
|
138
281
|
//# sourceMappingURL=useExecutionStream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecutionStream.js","sourceRoot":"","sources":["../../src/execution/useExecutionStream.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EACL,eAAe,EACf,WAAW,EACX,SAAS,EACT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,GAAG,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5E,MAAM,WAAW,GAAG,oBAAoB,CACtC,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,cAAc,CACrB,CAAC;IACF,MAAM,eAAe,GAAG,oBAAoB,CAC1C,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,kBAAkB,CACzB,CAAC;IACF,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEpE,4EAA4E;IAC5E,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CACH,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,cAAc,CAAC,2BAA2B,EACxE,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,KAAK,WAAW,CAAC;IACtD,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,KAAK,YAAY,CAAC;IACxD,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,KAAK,cAAc,CAAC;IAC5D,MAAM,gBAAgB,GACpB,WAAW,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvE,OAAO;QACL,SAAS;QACT,KAAK;QACL,WAAW;QACX,YAAY;QACZ,cAAc;QACd,gBAAgB;QAChB,KAAK;QACL,eAAe;QACf,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -14,6 +14,8 @@ export interface VirtualizedThreadProps {
|
|
|
14
14
|
readonly org?: string;
|
|
15
15
|
readonly planActionsDisabled?: boolean;
|
|
16
16
|
readonly centerContent?: boolean;
|
|
17
|
+
readonly onRetrySend?: () => void;
|
|
18
|
+
readonly onRetryExecution?: (message: string) => void;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Internal component that renders a `MessageThread` item list via
|
|
@@ -25,5 +27,5 @@ export interface VirtualizedThreadProps {
|
|
|
25
27
|
*
|
|
26
28
|
* @internal
|
|
27
29
|
*/
|
|
28
|
-
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
29
31
|
//# sourceMappingURL=VirtualizedThread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.d.ts","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AASvF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,KAAK,MAAM,CAAC;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAC1B,UAAU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AAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAuCD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,eAAe,EACf,GAAG,EACH,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,EAAE,sBAAsB,2CAuExB"}
|
|
@@ -33,7 +33,7 @@ const NEAR_BOTTOM_THRESHOLD_PX = 80;
|
|
|
33
33
|
*
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
36
|
-
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, }) {
|
|
36
|
+
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, }) {
|
|
37
37
|
const virtuosoRef = useRef(null);
|
|
38
38
|
const scrollerRef = useRef(null);
|
|
39
39
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
@@ -55,7 +55,9 @@ export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubm
|
|
|
55
55
|
onBuildFromPlan,
|
|
56
56
|
org,
|
|
57
57
|
planActionsDisabled,
|
|
58
|
-
|
|
58
|
+
onRetrySend,
|
|
59
|
+
onRetryExecution,
|
|
60
|
+
}), [formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, onBuildFromPlan, org, planActionsDisabled, onRetrySend, onRetryExecution]);
|
|
59
61
|
return (_jsxs(_Fragment, { children: [_jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: _jsx(DevProfiler, { id: "MessageThread:virtualized", children: _jsx(Virtuoso, { ref: virtuosoRef, data: items, alignToBottom: true, followOutput: handleFollowOutput, atBottomStateChange: setIsAtBottom, atBottomThreshold: NEAR_BOTTOM_THRESHOLD_PX, computeItemKey: (_index, item) => item.key, increaseViewportBy: { top: 200, bottom: 200 }, scrollerRef: handleScrollerRef, className: "h-full", components: { Scroller: ScrollerWithA11y }, itemContent: (index, item) => (_jsx("div", { className: cn("pb-4 pt-0 first:pt-6", centerContent && "mx-auto w-full max-w-3xl px-4"), children: _jsx(ThreadItemWrapper, { animate: index >= items.length - 2, children: _jsx(ThreadItemRenderer, { item: item, ...renderProps }) }) })) }) }) }) }), _jsx(JumpToLatestButton, { onClick: jumpToLatest, visible: !isAtBottom })] }));
|
|
60
62
|
}
|
|
61
63
|
//# sourceMappingURL=VirtualizedThread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.js","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAA6B,MAA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,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,UAAU,GAAI,IAClE,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exponential-backoff scheduling for resilient stream reconnection.
|
|
3
|
+
*
|
|
4
|
+
* Pure and framework-agnostic — the timing math is a plain function and the
|
|
5
|
+
* wait is a cancelable promise, so both are exhaustively unit-testable
|
|
6
|
+
* without React or fake DOM (mirrors the codebase's extract-the-pure-core
|
|
7
|
+
* convention, e.g. `computeFollowCenter` / `isRecoveryTransition`).
|
|
8
|
+
*
|
|
9
|
+
* @internal Not part of the public `@stigmer/react` API.
|
|
10
|
+
*/
|
|
11
|
+
/** Tunable backoff schedule. All fields optional — sensible defaults apply. */
|
|
12
|
+
export interface BackoffOptions {
|
|
13
|
+
/** Delay before the first retry, in milliseconds. */
|
|
14
|
+
readonly baseDelayMs?: number;
|
|
15
|
+
/** Upper bound on any single delay, in milliseconds. */
|
|
16
|
+
readonly maxDelayMs?: number;
|
|
17
|
+
/** Multiplier applied per attempt (`base * factor^(attempt-1)`). */
|
|
18
|
+
readonly factor?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Delay before the first reconnect attempt. */
|
|
21
|
+
export declare const DEFAULT_RECONNECT_BASE_DELAY_MS = 1000;
|
|
22
|
+
/** Ceiling for any single reconnect delay. */
|
|
23
|
+
export declare const DEFAULT_RECONNECT_MAX_DELAY_MS = 30000;
|
|
24
|
+
/** Per-attempt growth multiplier. */
|
|
25
|
+
export declare const DEFAULT_RECONNECT_FACTOR = 2;
|
|
26
|
+
/**
|
|
27
|
+
* Attempts before giving up and surfacing a terminal error. With the
|
|
28
|
+
* defaults above this is ≈ several minutes of outage before the user sees
|
|
29
|
+
* an error banner — long enough to ride out sleep/wake and network blips,
|
|
30
|
+
* bounded enough to avoid an unbounded background loop against a stream
|
|
31
|
+
* that will never recover (e.g. a deleted execution).
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_RECONNECT_MAX_ATTEMPTS = 10;
|
|
34
|
+
/**
|
|
35
|
+
* Compute the backoff delay (ms) for a 1-based reconnect attempt.
|
|
36
|
+
*
|
|
37
|
+
* Exponential growth (`base * factor^(attempt-1)`) capped at `maxDelayMs`,
|
|
38
|
+
* then **full jitter** — a uniform random point in `[0, capped]`. Full
|
|
39
|
+
* jitter (AWS, "Exponential Backoff And Jitter") de-synchronizes a fleet of
|
|
40
|
+
* clients that all dropped at the same instant, preventing a reconnect
|
|
41
|
+
* thundering herd against a recovering server.
|
|
42
|
+
*
|
|
43
|
+
* `random` is injectable purely so tests can assert exact values; callers
|
|
44
|
+
* should omit it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeBackoffDelay(attempt: number, opts?: BackoffOptions, random?: () => number): number;
|
|
47
|
+
/** Rejection reason for an aborted {@link sleep}, distinguishable by name. */
|
|
48
|
+
export declare class AbortError extends Error {
|
|
49
|
+
constructor();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Promise-based delay that settles after `ms`, or rejects immediately with
|
|
53
|
+
* {@link AbortError} if `signal` is (or becomes) aborted.
|
|
54
|
+
*
|
|
55
|
+
* The timer is cleared and the abort listener removed on every exit path, so
|
|
56
|
+
* a reconnect wait leaves nothing pending when a component unmounts or the
|
|
57
|
+
* subscription is torn down mid-backoff — no leaked timer, no resubscribe
|
|
58
|
+
* after teardown.
|
|
59
|
+
*/
|
|
60
|
+
export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
61
|
+
//# sourceMappingURL=backoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../src/internal/backoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gDAAgD;AAChD,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AACrD,8CAA8C;AAC9C,eAAO,MAAM,8BAA8B,QAAS,CAAC;AACrD,qCAAqC;AACrC,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,cAAc,EACrB,MAAM,GAAE,MAAM,MAAoB,GACjC,MAAM,CASR;AAED,8EAA8E;AAC9E,qBAAa,UAAW,SAAQ,KAAK;;CAKpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBrE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exponential-backoff scheduling for resilient stream reconnection.
|
|
3
|
+
*
|
|
4
|
+
* Pure and framework-agnostic — the timing math is a plain function and the
|
|
5
|
+
* wait is a cancelable promise, so both are exhaustively unit-testable
|
|
6
|
+
* without React or fake DOM (mirrors the codebase's extract-the-pure-core
|
|
7
|
+
* convention, e.g. `computeFollowCenter` / `isRecoveryTransition`).
|
|
8
|
+
*
|
|
9
|
+
* @internal Not part of the public `@stigmer/react` API.
|
|
10
|
+
*/
|
|
11
|
+
/** Delay before the first reconnect attempt. */
|
|
12
|
+
export const DEFAULT_RECONNECT_BASE_DELAY_MS = 1_000;
|
|
13
|
+
/** Ceiling for any single reconnect delay. */
|
|
14
|
+
export const DEFAULT_RECONNECT_MAX_DELAY_MS = 30_000;
|
|
15
|
+
/** Per-attempt growth multiplier. */
|
|
16
|
+
export const DEFAULT_RECONNECT_FACTOR = 2;
|
|
17
|
+
/**
|
|
18
|
+
* Attempts before giving up and surfacing a terminal error. With the
|
|
19
|
+
* defaults above this is ≈ several minutes of outage before the user sees
|
|
20
|
+
* an error banner — long enough to ride out sleep/wake and network blips,
|
|
21
|
+
* bounded enough to avoid an unbounded background loop against a stream
|
|
22
|
+
* that will never recover (e.g. a deleted execution).
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_RECONNECT_MAX_ATTEMPTS = 10;
|
|
25
|
+
/**
|
|
26
|
+
* Compute the backoff delay (ms) for a 1-based reconnect attempt.
|
|
27
|
+
*
|
|
28
|
+
* Exponential growth (`base * factor^(attempt-1)`) capped at `maxDelayMs`,
|
|
29
|
+
* then **full jitter** — a uniform random point in `[0, capped]`. Full
|
|
30
|
+
* jitter (AWS, "Exponential Backoff And Jitter") de-synchronizes a fleet of
|
|
31
|
+
* clients that all dropped at the same instant, preventing a reconnect
|
|
32
|
+
* thundering herd against a recovering server.
|
|
33
|
+
*
|
|
34
|
+
* `random` is injectable purely so tests can assert exact values; callers
|
|
35
|
+
* should omit it.
|
|
36
|
+
*/
|
|
37
|
+
export function computeBackoffDelay(attempt, opts, random = Math.random) {
|
|
38
|
+
const base = opts?.baseDelayMs ?? DEFAULT_RECONNECT_BASE_DELAY_MS;
|
|
39
|
+
const max = opts?.maxDelayMs ?? DEFAULT_RECONNECT_MAX_DELAY_MS;
|
|
40
|
+
const factor = opts?.factor ?? DEFAULT_RECONNECT_FACTOR;
|
|
41
|
+
const safeAttempt = Math.max(1, Math.floor(attempt));
|
|
42
|
+
const exponential = base * factor ** (safeAttempt - 1);
|
|
43
|
+
const capped = Math.min(exponential, max);
|
|
44
|
+
return Math.round(random() * capped);
|
|
45
|
+
}
|
|
46
|
+
/** Rejection reason for an aborted {@link sleep}, distinguishable by name. */
|
|
47
|
+
export class AbortError extends Error {
|
|
48
|
+
constructor() {
|
|
49
|
+
super("The operation was aborted.");
|
|
50
|
+
this.name = "AbortError";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Promise-based delay that settles after `ms`, or rejects immediately with
|
|
55
|
+
* {@link AbortError} if `signal` is (or becomes) aborted.
|
|
56
|
+
*
|
|
57
|
+
* The timer is cleared and the abort listener removed on every exit path, so
|
|
58
|
+
* a reconnect wait leaves nothing pending when a component unmounts or the
|
|
59
|
+
* subscription is torn down mid-backoff — no leaked timer, no resubscribe
|
|
60
|
+
* after teardown.
|
|
61
|
+
*/
|
|
62
|
+
export function sleep(ms, signal) {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
if (signal?.aborted) {
|
|
65
|
+
reject(new AbortError());
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const onAbort = () => {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
reject(new AbortError());
|
|
71
|
+
};
|
|
72
|
+
const timer = setTimeout(() => {
|
|
73
|
+
signal?.removeEventListener("abort", onAbort);
|
|
74
|
+
resolve();
|
|
75
|
+
}, ms);
|
|
76
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=backoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../src/internal/backoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,gDAAgD;AAChD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;AACrD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AACrD,qCAAqC;AACrC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,IAAqB,EACrB,S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AO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -7,6 +7,18 @@ export type StreamState = {
|
|
|
7
7
|
} | {
|
|
8
8
|
readonly stage: "streaming";
|
|
9
9
|
readonly executionId: string;
|
|
10
|
+
} | {
|
|
11
|
+
/**
|
|
12
|
+
* A non-terminal stream drop is being retried in the background. The
|
|
13
|
+
* last-known-good snapshot stays visible and no error is surfaced —
|
|
14
|
+
* the public `error` only appears once retries are exhausted. `attempt`
|
|
15
|
+
* is the 1-based retry count; `error` is the transient cause, retained
|
|
16
|
+
* for diagnostics (it is not shown to the user while reconnecting).
|
|
17
|
+
*/
|
|
18
|
+
readonly stage: "reconnecting";
|
|
19
|
+
readonly executionId: string;
|
|
20
|
+
readonly attempt: number;
|
|
21
|
+
readonly error: Error;
|
|
10
22
|
} | {
|
|
11
23
|
readonly stage: "complete";
|
|
12
24
|
readonly executionId: string;
|
|
@@ -30,6 +42,8 @@ type Listener = () => void;
|
|
|
30
42
|
export declare class ConversationStore {
|
|
31
43
|
private _execution;
|
|
32
44
|
private _streamState;
|
|
45
|
+
private _connectTimedOut;
|
|
46
|
+
private _isSlow;
|
|
33
47
|
private _listeners;
|
|
34
48
|
/**
|
|
35
49
|
* Ingest a new execution snapshot. Applies structural sharing
|
|
@@ -42,6 +56,22 @@ export declare class ConversationStore {
|
|
|
42
56
|
* when the stage or executionId actually changes.
|
|
43
57
|
*/
|
|
44
58
|
setStreamState(state: StreamState): void;
|
|
59
|
+
/**
|
|
60
|
+
* Set the hard connect-timeout signal — the stream opened but no first
|
|
61
|
+
* snapshot arrived within the watchdog window even after a silent retry.
|
|
62
|
+
*
|
|
63
|
+
* Orthogonal to {@link setStreamState}: the stream may still be live, so
|
|
64
|
+
* this is **not** a lifecycle stage and deliberately does not touch the
|
|
65
|
+
* `error` stage (that is auto-reconnect's domain). Booleans are stable by
|
|
66
|
+
* value, so no snapshot caching is needed; listeners fire only on change.
|
|
67
|
+
*/
|
|
68
|
+
setConnectTimedOut(value: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* Set the soft slow-stall hint — the stream is non-terminal but has gone
|
|
71
|
+
* silent past the watchdog window. Purely informational ("still working,
|
|
72
|
+
* taking longer than usual"); cleared by the next snapshot. Never aborts.
|
|
73
|
+
*/
|
|
74
|
+
setSlow(value: boolean): void;
|
|
45
75
|
/**
|
|
46
76
|
* Reset to initial state. Used when the session identity changes
|
|
47
77
|
* or the hook unmounts.
|
|
@@ -56,6 +86,10 @@ export declare class ConversationStore {
|
|
|
56
86
|
getExecution: () => AgentExecution | null;
|
|
57
87
|
/** Stable snapshot selector for the stream lifecycle state. */
|
|
58
88
|
getStreamState: () => StreamState;
|
|
89
|
+
/** Stable snapshot selector for the hard connect-timeout signal. */
|
|
90
|
+
getConnectTimedOut: () => boolean;
|
|
91
|
+
/** Stable snapshot selector for the soft slow-stall hint. */
|
|
92
|
+
getSlow: () => boolean;
|
|
59
93
|
private _notify;
|
|
60
94
|
}
|
|
61
95
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/conversation-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAOlG,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,QAAQ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