@reverbia/sdk 1.0.0-next.20260109140427 → 1.0.0-next.20260109150925

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.
@@ -1569,10 +1569,7 @@ function useChat(options) {
1569
1569
  continue;
1570
1570
  }
1571
1571
  if (chunk && typeof chunk === "object") {
1572
- const { content: contentDelta, thinking: thinkingDelta } = strategy.processStreamChunk(
1573
- chunk,
1574
- accumulator
1575
- );
1572
+ const { content: contentDelta, thinking: thinkingDelta } = strategy.processStreamChunk(chunk, accumulator);
1576
1573
  if (contentDelta) {
1577
1574
  if (onData) onData(contentDelta);
1578
1575
  if (globalOnData) globalOnData(contentDelta);
@@ -1605,7 +1602,11 @@ function useChat(options) {
1605
1602
  }
1606
1603
  const response = strategy.buildFinalResponse(accumulator);
1607
1604
  if (accumulator.toolCalls.size > 0) {
1608
- console.log("[Tool Debug] Found", accumulator.toolCalls.size, "tool calls");
1605
+ console.log(
1606
+ "[Tool Debug] Found",
1607
+ accumulator.toolCalls.size,
1608
+ "tool calls"
1609
+ );
1609
1610
  const executorMap = createToolExecutorMap(tools);
1610
1611
  const toolCallsToExecute = [];
1611
1612
  for (const toolCall of accumulator.toolCalls.values()) {
@@ -1615,7 +1616,10 @@ function useChat(options) {
1615
1616
  console.log("[Tool Debug] Will auto-execute:", toolCall.name);
1616
1617
  toolCallsToExecute.push(toolCall);
1617
1618
  } else {
1618
- console.log("[Tool Debug] Emitting onToolCall event for:", toolCall.name);
1619
+ console.log(
1620
+ "[Tool Debug] Emitting onToolCall event for:",
1621
+ toolCall.name
1622
+ );
1619
1623
  if (onToolCall) {
1620
1624
  onToolCall({
1621
1625
  id: toolCall.id,
@@ -1629,7 +1633,11 @@ function useChat(options) {
1629
1633
  }
1630
1634
  }
1631
1635
  if (toolCallsToExecute.length > 0) {
1632
- console.log("[Tool Debug] Executing", toolCallsToExecute.length, "tools");
1636
+ console.log(
1637
+ "[Tool Debug] Executing",
1638
+ toolCallsToExecute.length,
1639
+ "tools"
1640
+ );
1633
1641
  if (onThinking || globalOnThinking) {
1634
1642
  const toolInfo = toolCallsToExecute.map((tc) => {
1635
1643
  try {
@@ -1659,7 +1667,12 @@ Executing tool: ${toolInfo}
1659
1667
  toolCall,
1660
1668
  executorConfig.executor
1661
1669
  );
1662
- console.log("[Tool Debug] Tool execution result for", toolCall.name, ":", { result, error });
1670
+ console.log(
1671
+ "[Tool Debug] Tool execution result for",
1672
+ toolCall.name,
1673
+ ":",
1674
+ { result, error }
1675
+ );
1663
1676
  return {
1664
1677
  id: toolCall.id,
1665
1678
  name: toolCall.name,
@@ -1668,7 +1681,10 @@ Executing tool: ${toolInfo}
1668
1681
  };
1669
1682
  })
1670
1683
  );
1671
- console.log("[Tool Debug] All tools executed, results:", executionResults.length);
1684
+ console.log(
1685
+ "[Tool Debug] All tools executed, results:",
1686
+ executionResults.length
1687
+ );
1672
1688
  if (onThinking || globalOnThinking) {
1673
1689
  const resultsText = executionResults.map((r) => {
1674
1690
  if (r.error) {
@@ -1704,8 +1720,14 @@ Executing tool: ${toolInfo}
1704
1720
  tool_call_id: execResult.id
1705
1721
  });
1706
1722
  }
1707
- const continuationMessages = [...messagesWithContext, ...toolResultMessages];
1708
- console.log("[Tool Debug] Continuation messages:", JSON.stringify(continuationMessages, null, 2));
1723
+ const continuationMessages = [
1724
+ ...messagesWithContext,
1725
+ ...toolResultMessages
1726
+ ];
1727
+ console.log(
1728
+ "[Tool Debug] Continuation messages:",
1729
+ JSON.stringify(continuationMessages, null, 2)
1730
+ );
1709
1731
  const continuationRequestBody = strategy.buildRequestBody({
1710
1732
  messages: continuationMessages,
1711
1733
  model,
@@ -1742,10 +1764,7 @@ Executing tool: ${toolInfo}
1742
1764
  continue;
1743
1765
  }
1744
1766
  if (chunk && typeof chunk === "object") {
1745
- const { content: contentDelta, thinking: thinkingDelta } = strategy.processStreamChunk(
1746
- chunk,
1747
- continuationAccumulator
1748
- );
1767
+ const { content: contentDelta, thinking: thinkingDelta } = strategy.processStreamChunk(chunk, continuationAccumulator);
1749
1768
  if (contentDelta) {
1750
1769
  if (onData) onData(contentDelta);
1751
1770
  if (globalOnData) globalOnData(contentDelta);
@@ -1756,11 +1775,19 @@ Executing tool: ${toolInfo}
1756
1775
  }
1757
1776
  }
1758
1777
  }
1759
- console.log("[Tool Debug] Continuation stream complete - accumulated content:", continuationAccumulator.content);
1760
- console.log("[Tool Debug] Continuation stream complete - accumulated thinking:", continuationAccumulator.thinking);
1778
+ console.log(
1779
+ "[Tool Debug] Continuation stream complete - accumulated content:",
1780
+ continuationAccumulator.content
1781
+ );
1782
+ console.log(
1783
+ "[Tool Debug] Continuation stream complete - accumulated thinking:",
1784
+ continuationAccumulator.thinking
1785
+ );
1761
1786
  } catch (streamErr) {
1762
1787
  if (isAbortError(streamErr) || abortController.signal.aborted) {
1763
- const partialResponse = strategy.buildFinalResponse(continuationAccumulator);
1788
+ const partialResponse = strategy.buildFinalResponse(
1789
+ continuationAccumulator
1790
+ );
1764
1791
  return {
1765
1792
  data: partialResponse,
1766
1793
  error: "Request aborted"
@@ -1769,7 +1796,9 @@ Executing tool: ${toolInfo}
1769
1796
  throw streamErr;
1770
1797
  }
1771
1798
  if (abortController.signal.aborted) {
1772
- const partialResponse = strategy.buildFinalResponse(continuationAccumulator);
1799
+ const partialResponse = strategy.buildFinalResponse(
1800
+ continuationAccumulator
1801
+ );
1773
1802
  return {
1774
1803
  data: partialResponse,
1775
1804
  error: "Request aborted"
@@ -1778,7 +1807,9 @@ Executing tool: ${toolInfo}
1778
1807
  if (sseError) {
1779
1808
  throw sseError;
1780
1809
  }
1781
- const finalResponse = strategy.buildFinalResponse(continuationAccumulator);
1810
+ const finalResponse = strategy.buildFinalResponse(
1811
+ continuationAccumulator
1812
+ );
1782
1813
  if (onFinish) {
1783
1814
  onFinish(finalResponse);
1784
1815
  }
@@ -1811,7 +1842,16 @@ Executing tool: ${toolInfo}
1811
1842
  }
1812
1843
  }
1813
1844
  },
1814
- [getToken, baseUrl, globalOnData, globalOnThinking, onFinish, onError, onToolCall, defaultApiType]
1845
+ [
1846
+ getToken,
1847
+ baseUrl,
1848
+ globalOnData,
1849
+ globalOnThinking,
1850
+ onFinish,
1851
+ onError,
1852
+ onToolCall,
1853
+ defaultApiType
1854
+ ]
1815
1855
  );
1816
1856
  return {
1817
1857
  isLoading,
@@ -6593,11 +6633,17 @@ function DropboxAuthProvider({
6593
6633
  if (!isConfigured) return;
6594
6634
  const handleCallback = async () => {
6595
6635
  if (isDropboxCallback()) {
6596
- const result = await handleDropboxCallback(callbackPath, apiClient, walletAddress);
6636
+ const result = await handleDropboxCallback(
6637
+ callbackPath,
6638
+ apiClient,
6639
+ walletAddress
6640
+ );
6597
6641
  if (result.ok) {
6598
6642
  setAccessToken(result.data);
6599
6643
  } else {
6600
- console.error(`Dropbox OAuth failed: ${result.error.code} - ${result.error.message}`);
6644
+ console.error(
6645
+ `Dropbox OAuth failed: ${result.error.code} - ${result.error.message}`
6646
+ );
6601
6647
  }
6602
6648
  }
6603
6649
  };
@@ -6623,7 +6669,14 @@ function DropboxAuthProvider({
6623
6669
  return storedToken;
6624
6670
  }
6625
6671
  return startDropboxAuth(appKey, callbackPath);
6626
- }, [accessToken, appKey, callbackPath, isConfigured, apiClient, walletAddress]);
6672
+ }, [
6673
+ accessToken,
6674
+ appKey,
6675
+ callbackPath,
6676
+ isConfigured,
6677
+ apiClient,
6678
+ walletAddress
6679
+ ]);
6627
6680
  const logout = (0, import_react10.useCallback)(async () => {
6628
6681
  await revokeDropboxToken(apiClient, walletAddress);
6629
6682
  setAccessToken(null);
@@ -6993,11 +7046,17 @@ function GoogleDriveAuthProvider({
6993
7046
  if (!isConfigured) return;
6994
7047
  const handleCallback = async () => {
6995
7048
  if (isGoogleDriveCallback()) {
6996
- const result = await handleGoogleDriveCallback(callbackPath, apiClient, walletAddress);
7049
+ const result = await handleGoogleDriveCallback(
7050
+ callbackPath,
7051
+ apiClient,
7052
+ walletAddress
7053
+ );
6997
7054
  if (result.ok) {
6998
7055
  setAccessToken(result.data);
6999
7056
  } else {
7000
- console.error(`Google Drive OAuth failed: ${result.error.code} - ${result.error.message}`);
7057
+ console.error(
7058
+ `Google Drive OAuth failed: ${result.error.code} - ${result.error.message}`
7059
+ );
7001
7060
  }
7002
7061
  }
7003
7062
  };
@@ -7017,13 +7076,23 @@ function GoogleDriveAuthProvider({
7017
7076
  if (accessToken) {
7018
7077
  return accessToken;
7019
7078
  }
7020
- const storedToken = await getGoogleDriveAccessToken(apiClient, walletAddress);
7079
+ const storedToken = await getGoogleDriveAccessToken(
7080
+ apiClient,
7081
+ walletAddress
7082
+ );
7021
7083
  if (storedToken) {
7022
7084
  setAccessToken(storedToken);
7023
7085
  return storedToken;
7024
7086
  }
7025
7087
  return startGoogleDriveAuth(clientId, callbackPath);
7026
- }, [accessToken, clientId, callbackPath, isConfigured, apiClient, walletAddress]);
7088
+ }, [
7089
+ accessToken,
7090
+ clientId,
7091
+ callbackPath,
7092
+ isConfigured,
7093
+ apiClient,
7094
+ walletAddress
7095
+ ]);
7027
7096
  const logout = (0, import_react12.useCallback)(async () => {
7028
7097
  await revokeGoogleDriveToken(apiClient, walletAddress);
7029
7098
  setAccessToken(null);
@@ -8095,7 +8164,9 @@ function BackupAuthProvider({
8095
8164
  if (result.ok) {
8096
8165
  setDropboxToken(result.data);
8097
8166
  } else {
8098
- console.error(`Dropbox OAuth failed: ${result.error.code} - ${result.error.message}`);
8167
+ console.error(
8168
+ `Dropbox OAuth failed: ${result.error.code} - ${result.error.message}`
8169
+ );
8099
8170
  }
8100
8171
  }
8101
8172
  };
@@ -8113,7 +8184,9 @@ function BackupAuthProvider({
8113
8184
  if (result.ok) {
8114
8185
  setGoogleToken(result.data);
8115
8186
  } else {
8116
- console.error(`Google Drive OAuth failed: ${result.error.code} - ${result.error.message}`);
8187
+ console.error(
8188
+ `Google Drive OAuth failed: ${result.error.code} - ${result.error.message}`
8189
+ );
8117
8190
  }
8118
8191
  }
8119
8192
  };
@@ -8136,7 +8209,13 @@ function BackupAuthProvider({
8136
8209
  return storedToken;
8137
8210
  }
8138
8211
  return startDropboxAuth(dropboxAppKey, dropboxCallbackPath);
8139
- }, [dropboxAppKey, dropboxCallbackPath, isDropboxConfigured, apiClient, walletAddress]);
8212
+ }, [
8213
+ dropboxAppKey,
8214
+ dropboxCallbackPath,
8215
+ isDropboxConfigured,
8216
+ apiClient,
8217
+ walletAddress
8218
+ ]);
8140
8219
  const logoutDropbox = (0, import_react16.useCallback)(async () => {
8141
8220
  await revokeDropboxToken(apiClient, walletAddress);
8142
8221
  setDropboxToken(null);
@@ -8152,13 +8231,22 @@ function BackupAuthProvider({
8152
8231
  if (!isGoogleConfigured || !googleClientId) {
8153
8232
  throw new Error("Google Drive is not configured");
8154
8233
  }
8155
- const storedToken = await getGoogleDriveAccessToken(apiClient, walletAddress);
8234
+ const storedToken = await getGoogleDriveAccessToken(
8235
+ apiClient,
8236
+ walletAddress
8237
+ );
8156
8238
  if (storedToken) {
8157
8239
  setGoogleToken(storedToken);
8158
8240
  return storedToken;
8159
8241
  }
8160
8242
  return startGoogleDriveAuth(googleClientId, googleCallbackPath);
8161
- }, [googleClientId, googleCallbackPath, isGoogleConfigured, apiClient, walletAddress]);
8243
+ }, [
8244
+ googleClientId,
8245
+ googleCallbackPath,
8246
+ isGoogleConfigured,
8247
+ apiClient,
8248
+ walletAddress
8249
+ ]);
8162
8250
  const logoutGoogle = (0, import_react16.useCallback)(async () => {
8163
8251
  await revokeGoogleDriveToken(apiClient, walletAddress);
8164
8252
  setGoogleToken(null);
@@ -8203,7 +8291,14 @@ function BackupAuthProvider({
8203
8291
  isGoogleConfigured ? logoutGoogle() : Promise.resolve(),
8204
8292
  isIcloudConfigured ? logoutIcloud() : Promise.resolve()
8205
8293
  ]);
8206
- }, [isDropboxConfigured, isGoogleConfigured, isIcloudConfigured, logoutDropbox, logoutGoogle, logoutIcloud]);
8294
+ }, [
8295
+ isDropboxConfigured,
8296
+ isGoogleConfigured,
8297
+ isIcloudConfigured,
8298
+ logoutDropbox,
8299
+ logoutGoogle,
8300
+ logoutIcloud
8301
+ ]);
8207
8302
  const dropboxState = {
8208
8303
  accessToken: dropboxToken,
8209
8304
  isAuthenticated: !!dropboxToken,