@paymanai/payman-typescript-ask-sdk 4.0.4 → 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.
package/dist/index.mjs CHANGED
@@ -952,11 +952,16 @@ function createCancelledMessageUpdate(steps, currentMessage) {
952
952
  var DEFAULT_STREAM_ENDPOINT = "/api/playground/ask/stream";
953
953
  function buildRequestBody(config, userMessage, sessionId, options) {
954
954
  const sessionOwner = config.sessionParams;
955
+ const sessionOwnerId = sessionOwner?.id?.trim();
956
+ if (!sessionOwnerId) {
957
+ throw new Error("ChatConfig.sessionParams.id is required to send ask requests.");
958
+ }
955
959
  const sessionAttributes = sessionOwner?.attributes && Object.keys(sessionOwner.attributes).length > 0 ? sessionOwner.attributes : void 0;
956
960
  return {
957
961
  agentId: config.agentId,
958
962
  userInput: userMessage,
959
963
  sessionId,
964
+ sessionOwnerId,
960
965
  sessionOwnerLabel: sessionOwner?.name || void 0,
961
966
  sessionAttributes,
962
967
  analysisMode: options?.analysisMode
@@ -1174,16 +1179,16 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
1174
1179
  )
1175
1180
  );
1176
1181
  };
1177
- const currentConfig = configRef.current;
1178
- const requestBody = buildRequestBody(
1179
- currentConfig,
1180
- userMessage,
1181
- sessionId,
1182
- options
1183
- );
1184
- const url = buildStreamingUrl(currentConfig);
1185
- const headers = buildRequestHeaders(currentConfig);
1186
1182
  try {
1183
+ const currentConfig = configRef.current;
1184
+ const requestBody = buildRequestBody(
1185
+ currentConfig,
1186
+ userMessage,
1187
+ sessionId,
1188
+ options
1189
+ );
1190
+ const url = buildStreamingUrl(currentConfig);
1191
+ const headers = buildRequestHeaders(currentConfig);
1187
1192
  await streamWorkflowEvents(url, requestBody, headers, {
1188
1193
  signal: abortController.signal,
1189
1194
  onEvent: (event) => {