@anuma/sdk 7.0.5 → 7.0.6

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.
@@ -27782,11 +27782,15 @@ function useChatStorage(options) {
27782
27782
  const retirementStopRequestedRef = (0, import_react5.useRef)(false);
27783
27783
  const createConversation = (0, import_react5.useCallback)(
27784
27784
  async (opts) => {
27785
+ const conversationOpts = {
27786
+ ...opts,
27787
+ conversationId: opts?.conversationId || generateConversationId()
27788
+ };
27785
27789
  const { result, queued } = await writeOrQueue(
27786
27790
  "createConversation",
27787
- { conversationId: opts?.conversationId, title: opts?.title, projectId: opts?.projectId },
27788
- () => createConversationOp(storageCtx, opts, defaultConversationTitle),
27789
- () => makeSyntheticStoredConversation(opts, defaultConversationTitle)
27791
+ conversationOpts,
27792
+ () => createConversationOp(storageCtx, conversationOpts, defaultConversationTitle),
27793
+ () => makeSyntheticStoredConversation(conversationOpts, defaultConversationTitle)
27790
27794
  );
27791
27795
  if (queued) {
27792
27796
  syntheticConvIdsRef.current.add(result.conversationId);
@@ -28492,6 +28496,7 @@ function useChatStorage(options) {
28492
28496
  url: file.url && !file.url.startsWith("data:") ? file.url : void 0
28493
28497
  }));
28494
28498
  const userMsgOpts = {
28499
+ uniqueId: `msg_${(0, import_uuid7.v7)()}`,
28495
28500
  conversationId: convId,
28496
28501
  role: "user",
28497
28502
  content: contentForStorage,
@@ -28846,7 +28851,7 @@ function useChatStorage(options) {
28846
28851
  thinking: thinkingContent,
28847
28852
  parentMessageId: storedUserMessage.uniqueId,
28848
28853
  toolCallEvents: currentTurnToolCallEvents && currentTurnToolCallEvents.length > 0 ? currentTurnToolCallEvents : void 0,
28849
- uniqueId: effectiveAssistantUniqueId
28854
+ uniqueId: effectiveAssistantUniqueId || `msg_${(0, import_uuid7.v7)()}`
28850
28855
  };
28851
28856
  let storedAssistantMessage;
28852
28857
  let assistantMsgQueueId;
@@ -28874,6 +28879,7 @@ function useChatStorage(options) {
28874
28879
  let storedToolResultsMessage;
28875
28880
  if (autoToolResults && autoToolResults.length > 0) {
28876
28881
  const toolResultsOpts = {
28882
+ uniqueId: `msg_${(0, import_uuid7.v7)()}`,
28877
28883
  conversationId: convId,
28878
28884
  role: "user",
28879
28885
  content: buildToolResultContent(autoToolResults),
@@ -26117,11 +26117,15 @@ function useChatStorage(options) {
26117
26117
  const retirementStopRequestedRef = useRef4(false);
26118
26118
  const createConversation = useCallback4(
26119
26119
  async (opts) => {
26120
+ const conversationOpts = {
26121
+ ...opts,
26122
+ conversationId: opts?.conversationId || generateConversationId()
26123
+ };
26120
26124
  const { result, queued } = await writeOrQueue(
26121
26125
  "createConversation",
26122
- { conversationId: opts?.conversationId, title: opts?.title, projectId: opts?.projectId },
26123
- () => createConversationOp(storageCtx, opts, defaultConversationTitle),
26124
- () => makeSyntheticStoredConversation(opts, defaultConversationTitle)
26126
+ conversationOpts,
26127
+ () => createConversationOp(storageCtx, conversationOpts, defaultConversationTitle),
26128
+ () => makeSyntheticStoredConversation(conversationOpts, defaultConversationTitle)
26125
26129
  );
26126
26130
  if (queued) {
26127
26131
  syntheticConvIdsRef.current.add(result.conversationId);
@@ -26827,6 +26831,7 @@ function useChatStorage(options) {
26827
26831
  url: file.url && !file.url.startsWith("data:") ? file.url : void 0
26828
26832
  }));
26829
26833
  const userMsgOpts = {
26834
+ uniqueId: `msg_${uuidv77()}`,
26830
26835
  conversationId: convId,
26831
26836
  role: "user",
26832
26837
  content: contentForStorage,
@@ -27181,7 +27186,7 @@ function useChatStorage(options) {
27181
27186
  thinking: thinkingContent,
27182
27187
  parentMessageId: storedUserMessage.uniqueId,
27183
27188
  toolCallEvents: currentTurnToolCallEvents && currentTurnToolCallEvents.length > 0 ? currentTurnToolCallEvents : void 0,
27184
- uniqueId: effectiveAssistantUniqueId
27189
+ uniqueId: effectiveAssistantUniqueId || `msg_${uuidv77()}`
27185
27190
  };
27186
27191
  let storedAssistantMessage;
27187
27192
  let assistantMsgQueueId;
@@ -27209,6 +27214,7 @@ function useChatStorage(options) {
27209
27214
  let storedToolResultsMessage;
27210
27215
  if (autoToolResults && autoToolResults.length > 0) {
27211
27216
  const toolResultsOpts = {
27217
+ uniqueId: `msg_${uuidv77()}`,
27212
27218
  conversationId: convId,
27213
27219
  role: "user",
27214
27220
  content: buildToolResultContent(autoToolResults),
@@ -31368,6 +31368,7 @@ function useChat(options) {
31368
31368
 
31369
31369
  // src/react/useChatStorage.ts
31370
31370
  var import_react6 = require("react");
31371
+ var import_uuid7 = require("uuid");
31371
31372
  init_clientConfig();
31372
31373
 
31373
31374
  // src/lib/chat/assembleMessages.ts
@@ -33133,11 +33134,15 @@ function useChatStorage(options) {
33133
33134
  });
33134
33135
  const createConversation = (0, import_react6.useCallback)(
33135
33136
  async (opts) => {
33137
+ const conversationOpts = {
33138
+ ...opts,
33139
+ conversationId: opts?.conversationId || generateConversationId()
33140
+ };
33136
33141
  const { result, queued, queueId } = await writeOrQueue(
33137
33142
  "createConversation",
33138
- { conversationId: opts?.conversationId, title: opts?.title, projectId: opts?.projectId },
33139
- () => createConversationOp(storageCtx, opts, defaultConversationTitle),
33140
- () => makeSyntheticStoredConversation(opts, defaultConversationTitle)
33143
+ conversationOpts,
33144
+ () => createConversationOp(storageCtx, conversationOpts, defaultConversationTitle),
33145
+ () => makeSyntheticStoredConversation(conversationOpts, defaultConversationTitle)
33141
33146
  );
33142
33147
  if (queued) {
33143
33148
  syntheticConvIdsRef.current.add(result.conversationId);
@@ -33825,6 +33830,7 @@ function useChatStorage(options) {
33825
33830
  );
33826
33831
  }
33827
33832
  const userMsgOpts = {
33833
+ uniqueId: `msg_${(0, import_uuid7.v7)()}`,
33828
33834
  conversationId: convId,
33829
33835
  role: "user",
33830
33836
  content: contentForStorage,
@@ -34152,7 +34158,7 @@ function useChatStorage(options) {
34152
34158
  thinking: thinkingContent,
34153
34159
  parentMessageId: storedUserMessage.uniqueId,
34154
34160
  toolCallEvents: currentTurnToolCallEvents && currentTurnToolCallEvents.length > 0 ? currentTurnToolCallEvents : void 0,
34155
- uniqueId: assistantUniqueId
34161
+ uniqueId: assistantUniqueId || `msg_${(0, import_uuid7.v7)()}`
34156
34162
  };
34157
34163
  let storedAssistantMessage;
34158
34164
  let assistantMsgQueueId;
@@ -34199,6 +34205,7 @@ function useChatStorage(options) {
34199
34205
  let storedToolResultsMessage;
34200
34206
  if (autoToolResults && autoToolResults.length > 0) {
34201
34207
  const toolResultsOpts = {
34208
+ uniqueId: `msg_${(0, import_uuid7.v7)()}`,
34202
34209
  conversationId: convId,
34203
34210
  role: "user",
34204
34211
  content: buildToolResultContent(autoToolResults),
@@ -29519,6 +29519,7 @@ function useChat(options) {
29519
29519
 
29520
29520
  // src/react/useChatStorage.ts
29521
29521
  import { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef4, useState as useState5 } from "react";
29522
+ import { v7 as uuidv77 } from "uuid";
29522
29523
 
29523
29524
  // src/lib/chat/assembleMessages.ts
29524
29525
  function assembleMessagesWithHistory(historyMessages, callerMessages, summarySystemMessage) {
@@ -31274,11 +31275,15 @@ function useChatStorage(options) {
31274
31275
  });
31275
31276
  const createConversation = useCallback5(
31276
31277
  async (opts) => {
31278
+ const conversationOpts = {
31279
+ ...opts,
31280
+ conversationId: opts?.conversationId || generateConversationId()
31281
+ };
31277
31282
  const { result, queued, queueId } = await writeOrQueue(
31278
31283
  "createConversation",
31279
- { conversationId: opts?.conversationId, title: opts?.title, projectId: opts?.projectId },
31280
- () => createConversationOp(storageCtx, opts, defaultConversationTitle),
31281
- () => makeSyntheticStoredConversation(opts, defaultConversationTitle)
31284
+ conversationOpts,
31285
+ () => createConversationOp(storageCtx, conversationOpts, defaultConversationTitle),
31286
+ () => makeSyntheticStoredConversation(conversationOpts, defaultConversationTitle)
31282
31287
  );
31283
31288
  if (queued) {
31284
31289
  syntheticConvIdsRef.current.add(result.conversationId);
@@ -31966,6 +31971,7 @@ function useChatStorage(options) {
31966
31971
  );
31967
31972
  }
31968
31973
  const userMsgOpts = {
31974
+ uniqueId: `msg_${uuidv77()}`,
31969
31975
  conversationId: convId,
31970
31976
  role: "user",
31971
31977
  content: contentForStorage,
@@ -32293,7 +32299,7 @@ function useChatStorage(options) {
32293
32299
  thinking: thinkingContent,
32294
32300
  parentMessageId: storedUserMessage.uniqueId,
32295
32301
  toolCallEvents: currentTurnToolCallEvents && currentTurnToolCallEvents.length > 0 ? currentTurnToolCallEvents : void 0,
32296
- uniqueId: assistantUniqueId
32302
+ uniqueId: assistantUniqueId || `msg_${uuidv77()}`
32297
32303
  };
32298
32304
  let storedAssistantMessage;
32299
32305
  let assistantMsgQueueId;
@@ -32340,6 +32346,7 @@ function useChatStorage(options) {
32340
32346
  let storedToolResultsMessage;
32341
32347
  if (autoToolResults && autoToolResults.length > 0) {
32342
32348
  const toolResultsOpts = {
32349
+ uniqueId: `msg_${uuidv77()}`,
32343
32350
  conversationId: convId,
32344
32351
  role: "user",
32345
32352
  content: buildToolResultContent(autoToolResults),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",