@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.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +28 -1
- package/dist/index.native.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -357,6 +357,11 @@ declare function streamWorkflowEvents(url: string, body: Record<string, unknown>
|
|
|
357
357
|
*/
|
|
358
358
|
declare function buildFormattedThinking(steps: StreamingStep[] | undefined, allThinkingText: string): string;
|
|
359
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Orchestrator completion often includes "Identified N task(s) to execute", which is redundant in the UI.
|
|
362
|
+
*/
|
|
363
|
+
declare function workingPhaseDetailForDisplay(raw: string): string;
|
|
364
|
+
|
|
360
365
|
type V2EventProcessorState = {
|
|
361
366
|
formattedThinkingText: string;
|
|
362
367
|
finalResponse: string;
|
|
@@ -394,4 +399,4 @@ declare function cancelUserAction(config: ChatConfig, userActionId: string): Pro
|
|
|
394
399
|
*/
|
|
395
400
|
declare function resendUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
396
401
|
|
|
397
|
-
export { type APIConfig, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type MessageDisplay, type MessageRole, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatReturn, type UseChatV2Return, type UseVoiceReturn, type UserActionRequest, type UserActionResult, type UserActionState, type UserActionType, type V2EventProcessorState, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, type WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice };
|
|
402
|
+
export { type APIConfig, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type MessageDisplay, type MessageRole, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatReturn, type UseChatV2Return, type UseVoiceReturn, type UserActionRequest, type UserActionResult, type UserActionState, type UserActionType, type V2EventProcessorState, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, type WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice, workingPhaseDetailForDisplay };
|
package/dist/index.d.ts
CHANGED
|
@@ -357,6 +357,11 @@ declare function streamWorkflowEvents(url: string, body: Record<string, unknown>
|
|
|
357
357
|
*/
|
|
358
358
|
declare function buildFormattedThinking(steps: StreamingStep[] | undefined, allThinkingText: string): string;
|
|
359
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Orchestrator completion often includes "Identified N task(s) to execute", which is redundant in the UI.
|
|
362
|
+
*/
|
|
363
|
+
declare function workingPhaseDetailForDisplay(raw: string): string;
|
|
364
|
+
|
|
360
365
|
type V2EventProcessorState = {
|
|
361
366
|
formattedThinkingText: string;
|
|
362
367
|
finalResponse: string;
|
|
@@ -394,4 +399,4 @@ declare function cancelUserAction(config: ChatConfig, userActionId: string): Pro
|
|
|
394
399
|
*/
|
|
395
400
|
declare function resendUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
396
401
|
|
|
397
|
-
export { type APIConfig, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type MessageDisplay, type MessageRole, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatReturn, type UseChatV2Return, type UseVoiceReturn, type UserActionRequest, type UserActionResult, type UserActionState, type UserActionType, type V2EventProcessorState, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, type WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice };
|
|
402
|
+
export { type APIConfig, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type MessageDisplay, type MessageRole, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatReturn, type UseChatV2Return, type UseVoiceReturn, type UserActionRequest, type UserActionResult, type UserActionState, type UserActionType, type V2EventProcessorState, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, type WorkflowStage, buildFormattedThinking, cancelUserAction, createInitialV2State, generateId, processStreamEventV2, resendUserAction, streamWorkflowEvents, submitUserAction, useChat, useChatV2, useVoice, workingPhaseDetailForDisplay };
|
package/dist/index.js
CHANGED
|
@@ -168,6 +168,14 @@ function getEventMessage(event) {
|
|
|
168
168
|
return eventType;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
function workingPhaseDetailForDisplay(raw) {
|
|
172
|
+
const t = raw.trim();
|
|
173
|
+
if (!t) return "";
|
|
174
|
+
if (/^Identified\s+\d+\s+tasks?\s+to\s+execute\.?$/i.test(t)) {
|
|
175
|
+
return "";
|
|
176
|
+
}
|
|
177
|
+
return t;
|
|
178
|
+
}
|
|
171
179
|
function extractResponseContent(response) {
|
|
172
180
|
if (typeof response === "string") {
|
|
173
181
|
return response;
|
|
@@ -503,6 +511,12 @@ function buildFormattedThinking(steps, allThinkingText) {
|
|
|
503
511
|
parts.push("**Planning**");
|
|
504
512
|
if (step.message) parts.push(step.message);
|
|
505
513
|
break;
|
|
514
|
+
case "WORKING": {
|
|
515
|
+
const detail = workingPhaseDetailForDisplay(step.message || "");
|
|
516
|
+
parts.push("**Working**");
|
|
517
|
+
if (detail) parts.push(detail);
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
506
520
|
case "INTENT_STARTED": {
|
|
507
521
|
let label = step.message || "Processing";
|
|
508
522
|
const started = label.match(/^(.+?)\s+started$/i);
|
|
@@ -1493,7 +1507,19 @@ function processStreamEventV2(event, state) {
|
|
|
1493
1507
|
break;
|
|
1494
1508
|
}
|
|
1495
1509
|
case "ORCHESTRATOR_COMPLETED": {
|
|
1496
|
-
|
|
1510
|
+
const workingDetail = workingPhaseDetailForDisplay(message);
|
|
1511
|
+
if (workingDetail) {
|
|
1512
|
+
addThinkingLine(state, "**Working**", workingDetail);
|
|
1513
|
+
} else {
|
|
1514
|
+
addThinkingHeader(state, "**Working**");
|
|
1515
|
+
}
|
|
1516
|
+
state.steps.push({
|
|
1517
|
+
id: `step-${state.stepCounter++}`,
|
|
1518
|
+
eventType: "WORKING",
|
|
1519
|
+
message: workingDetail,
|
|
1520
|
+
status: "completed",
|
|
1521
|
+
timestamp: Date.now()
|
|
1522
|
+
});
|
|
1497
1523
|
const step = state.steps.find((s) => s.eventType === "ORCHESTRATOR_THINKING" && s.status === "in_progress");
|
|
1498
1524
|
if (step) {
|
|
1499
1525
|
step.status = "completed";
|
|
@@ -2504,5 +2530,6 @@ exports.submitUserAction = submitUserAction;
|
|
|
2504
2530
|
exports.useChat = useChat;
|
|
2505
2531
|
exports.useChatV2 = useChatV2;
|
|
2506
2532
|
exports.useVoice = useVoice;
|
|
2533
|
+
exports.workingPhaseDetailForDisplay = workingPhaseDetailForDisplay;
|
|
2507
2534
|
//# sourceMappingURL=index.js.map
|
|
2508
2535
|
//# sourceMappingURL=index.js.map
|