@paymanai/payman-typescript-ask-sdk 1.2.5 → 1.2.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.
package/dist/index.js CHANGED
@@ -162,6 +162,8 @@ function getEventMessage(event) {
162
162
  return event.workerName ? `${event.workerName} thinking...` : "Thinking...";
163
163
  case "INTENT_THINKING_CONT":
164
164
  return event.message || "";
165
+ case "KEEP_ALIVE":
166
+ return "";
165
167
  default:
166
168
  return eventType;
167
169
  }
@@ -198,6 +200,9 @@ function completeLastInProgressStep(steps) {
198
200
  }
199
201
  function processStreamEvent(event, state) {
200
202
  const eventType = event.eventType;
203
+ if (typeof eventType === "string" && eventType.toUpperCase() === "KEEP_ALIVE") {
204
+ return state;
205
+ }
201
206
  const message = getEventMessage(event);
202
207
  if (eventType !== "INTENT_THINKING" && eventType !== "INTENT_THINKING_CONT") {
203
208
  if (state.currentThinkingStepId) {
@@ -780,6 +785,11 @@ function useStreamManager(config, callbacks, setMessages, setIsWaitingForRespons
780
785
  if (abortController.signal.aborted) {
781
786
  return;
782
787
  }
788
+ if (typeof event.eventType === "string" && event.eventType.toUpperCase() === "KEEP_ALIVE") {
789
+ if (event.executionId) state.executionId = event.executionId;
790
+ if (event.sessionId) state.currentSessionId = event.sessionId;
791
+ return;
792
+ }
783
793
  if (event.executionId) state.executionId = event.executionId;
784
794
  if (event.sessionId) state.currentSessionId = event.sessionId;
785
795
  const activeThinkingLengthBeforeProcess = state.activeThinkingText?.length ?? 0;