@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.cjs CHANGED
@@ -24599,37 +24599,42 @@ const useAthenaRuntime = (config2) => {
24599
24599
  hasResumedRef.current = true;
24600
24600
  (async () => {
24601
24601
  var _a2;
24602
+ const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
24602
24603
  try {
24603
- const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
24604
24604
  const state = await getThreadState(backendUrl, auth, threadId);
24605
24605
  runtime.thread.importExternalState({
24606
24606
  messages: state.messages
24607
24607
  });
24608
- try {
24609
- const statusRes = await fetch(resolvedStatusApiUrl, {
24610
- method: "POST",
24611
- headers: { "Content-Type": "application/json" },
24612
- body: JSON.stringify({ threadId })
24613
- });
24614
- if (statusRes.ok) {
24615
- const status = await statusRes.json();
24616
- if (status.isRunning) {
24608
+ } catch (err) {
24609
+ if (IS_DEV) {
24610
+ console.warn(
24611
+ "[AthenaSDK] Failed to load thread state (may be a new streaming thread):",
24612
+ err
24613
+ );
24614
+ }
24615
+ }
24616
+ try {
24617
+ const statusRes = await fetch(resolvedStatusApiUrl, {
24618
+ method: "POST",
24619
+ headers: { "Content-Type": "application/json" },
24620
+ body: JSON.stringify({ threadId })
24621
+ });
24622
+ if (statusRes.ok) {
24623
+ const status = await statusRes.json();
24624
+ if (status.isRunning) {
24625
+ try {
24617
24626
  const lastMessageId = ((_a2 = runtime.thread.getState().messages.at(-1)) == null ? void 0 : _a2.id) ?? null;
24618
24627
  runtime.thread.unstable_resumeRun({ parentId: lastMessageId });
24628
+ } catch (resumeErr) {
24629
+ if (IS_DEV) {
24630
+ console.error("[AthenaSDK] Failed to resume running thread:", resumeErr);
24631
+ }
24619
24632
  }
24620
24633
  }
24621
- } catch (statusErr) {
24622
- if (IS_DEV) {
24623
- console.warn("[AthenaSDK] Sync server status check failed:", statusErr);
24624
- }
24625
24634
  }
24626
- } catch (err) {
24635
+ } catch (statusErr) {
24627
24636
  if (IS_DEV) {
24628
- console.error("[AthenaSDK] Failed to load thread state:", err);
24629
- }
24630
- try {
24631
- runtime.thread.unstable_resumeRun({ parentId: null });
24632
- } catch {
24637
+ console.warn("[AthenaSDK] Sync server status check failed:", statusErr);
24633
24638
  }
24634
24639
  }
24635
24640
  })();