@paymanai/payman-typescript-ask-sdk 1.2.10 → 1.2.11

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
@@ -166,6 +166,14 @@ function getEventMessage(event) {
166
166
  return eventType;
167
167
  }
168
168
  }
169
+ function workingPhaseDetailForDisplay(raw) {
170
+ const t = raw.trim();
171
+ if (!t) return "";
172
+ if (/^Identified\s+\d+\s+tasks?\s+to\s+execute\.?$/i.test(t)) {
173
+ return "";
174
+ }
175
+ return t;
176
+ }
169
177
  function extractResponseContent(response) {
170
178
  if (typeof response === "string") {
171
179
  return response;
@@ -501,6 +509,12 @@ function buildFormattedThinking(steps, allThinkingText) {
501
509
  parts.push("**Planning**");
502
510
  if (step.message) parts.push(step.message);
503
511
  break;
512
+ case "WORKING": {
513
+ const detail = workingPhaseDetailForDisplay(step.message || "");
514
+ parts.push("**Working**");
515
+ if (detail) parts.push(detail);
516
+ break;
517
+ }
504
518
  case "INTENT_STARTED": {
505
519
  let label = step.message || "Processing";
506
520
  const started = label.match(/^(.+?)\s+started$/i);
@@ -1491,7 +1505,19 @@ function processStreamEventV2(event, state) {
1491
1505
  break;
1492
1506
  }
1493
1507
  case "ORCHESTRATOR_COMPLETED": {
1494
- appendThinkingText(state, "\n" + (event.message || "Planning complete"));
1508
+ const workingDetail = workingPhaseDetailForDisplay(message);
1509
+ if (workingDetail) {
1510
+ addThinkingLine(state, "**Working**", workingDetail);
1511
+ } else {
1512
+ addThinkingHeader(state, "**Working**");
1513
+ }
1514
+ state.steps.push({
1515
+ id: `step-${state.stepCounter++}`,
1516
+ eventType: "WORKING",
1517
+ message: workingDetail,
1518
+ status: "completed",
1519
+ timestamp: Date.now()
1520
+ });
1495
1521
  const step = state.steps.find((s) => s.eventType === "ORCHESTRATOR_THINKING" && s.status === "in_progress");
1496
1522
  if (step) {
1497
1523
  step.status = "completed";
@@ -2491,6 +2517,6 @@ function useVoice(config = {}, callbacks = {}) {
2491
2517
  };
2492
2518
  }
2493
2519
 
2494
- export { buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice };
2520
+ export { buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice, workingPhaseDetailForDisplay };
2495
2521
  //# sourceMappingURL=index.mjs.map
2496
2522
  //# sourceMappingURL=index.mjs.map