@paymanai/payman-typescript-ask-sdk 4.0.3 → 4.0.5

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.
@@ -971,11 +971,16 @@ function createCancelledMessageUpdate(steps, currentMessage) {
971
971
  var DEFAULT_STREAM_ENDPOINT = "/api/playground/ask/stream";
972
972
  function buildRequestBody(config, userMessage, sessionId, options) {
973
973
  const sessionOwner = config.sessionParams;
974
+ const sessionOwnerId = sessionOwner?.id?.trim();
975
+ if (!sessionOwnerId) {
976
+ throw new Error("ChatConfig.sessionParams.id is required to send ask requests.");
977
+ }
974
978
  const sessionAttributes = sessionOwner?.attributes && Object.keys(sessionOwner.attributes).length > 0 ? sessionOwner.attributes : void 0;
975
979
  return {
976
980
  agentId: config.agentId,
977
981
  userInput: userMessage,
978
982
  sessionId,
983
+ sessionOwnerId,
979
984
  sessionOwnerLabel: sessionOwner?.name || void 0,
980
985
  sessionAttributes,
981
986
  analysisMode: options?.analysisMode
@@ -1197,16 +1202,16 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
1197
1202
  )
1198
1203
  );
1199
1204
  };
1200
- const currentConfig = configRef.current;
1201
- const requestBody = buildRequestBody(
1202
- currentConfig,
1203
- userMessage,
1204
- sessionId,
1205
- options
1206
- );
1207
- const url = buildStreamingUrl(currentConfig);
1208
- const headers = buildRequestHeaders(currentConfig);
1209
1205
  try {
1206
+ const currentConfig = configRef.current;
1207
+ const requestBody = buildRequestBody(
1208
+ currentConfig,
1209
+ userMessage,
1210
+ sessionId,
1211
+ options
1212
+ );
1213
+ const url = buildStreamingUrl(currentConfig);
1214
+ const headers = buildRequestHeaders(currentConfig);
1210
1215
  await streamWorkflowEvents(url, requestBody, headers, {
1211
1216
  signal: abortController.signal,
1212
1217
  onEvent: (event) => {