@athenaintel/react 0.10.18 → 0.10.19

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/dist/index.js CHANGED
@@ -24560,37 +24560,42 @@ const useAthenaRuntime = (config2) => {
24560
24560
  hasResumedRef.current = true;
24561
24561
  (async () => {
24562
24562
  var _a2;
24563
+ const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
24563
24564
  try {
24564
- const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
24565
24565
  const state = await getThreadState(backendUrl, auth, threadId);
24566
24566
  runtime.thread.importExternalState({
24567
24567
  messages: state.messages
24568
24568
  });
24569
- try {
24570
- const statusRes = await fetch(resolvedStatusApiUrl, {
24571
- method: "POST",
24572
- headers: { "Content-Type": "application/json" },
24573
- body: JSON.stringify({ threadId })
24574
- });
24575
- if (statusRes.ok) {
24576
- const status = await statusRes.json();
24577
- if (status.isRunning) {
24569
+ } catch (err) {
24570
+ if (IS_DEV) {
24571
+ console.warn(
24572
+ "[AthenaSDK] Failed to load thread state (may be a new streaming thread):",
24573
+ err
24574
+ );
24575
+ }
24576
+ }
24577
+ try {
24578
+ const statusRes = await fetch(resolvedStatusApiUrl, {
24579
+ method: "POST",
24580
+ headers: { "Content-Type": "application/json" },
24581
+ body: JSON.stringify({ threadId })
24582
+ });
24583
+ if (statusRes.ok) {
24584
+ const status = await statusRes.json();
24585
+ if (status.isRunning) {
24586
+ try {
24578
24587
  const lastMessageId = ((_a2 = runtime.thread.getState().messages.at(-1)) == null ? void 0 : _a2.id) ?? null;
24579
24588
  runtime.thread.unstable_resumeRun({ parentId: lastMessageId });
24589
+ } catch (resumeErr) {
24590
+ if (IS_DEV) {
24591
+ console.error("[AthenaSDK] Failed to resume running thread:", resumeErr);
24592
+ }
24580
24593
  }
24581
24594
  }
24582
- } catch (statusErr) {
24583
- if (IS_DEV) {
24584
- console.warn("[AthenaSDK] Sync server status check failed:", statusErr);
24585
- }
24586
24595
  }
24587
- } catch (err) {
24596
+ } catch (statusErr) {
24588
24597
  if (IS_DEV) {
24589
- console.error("[AthenaSDK] Failed to load thread state:", err);
24590
- }
24591
- try {
24592
- runtime.thread.unstable_resumeRun({ parentId: null });
24593
- } catch {
24598
+ console.warn("[AthenaSDK] Sync server status check failed:", statusErr);
24594
24599
  }
24595
24600
  }
24596
24601
  })();