@paymanai/payman-ask-sdk 4.0.25 → 4.0.26
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 +396 -268
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +25 -4
- package/dist/index.native.js.map +1 -1
- package/dist/styles.css +30 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.native.js
CHANGED
|
@@ -295,6 +295,8 @@ function getEventMessage(event) {
|
|
|
295
295
|
}
|
|
296
296
|
case "RUN_IN_PROGRESS":
|
|
297
297
|
return event.partialText || "Thinking...";
|
|
298
|
+
case "LLM_CALL_STARTED":
|
|
299
|
+
return event.description || "";
|
|
298
300
|
case "RUN_COMPLETED":
|
|
299
301
|
return "Agent run completed";
|
|
300
302
|
case "RUN_FAILED":
|
|
@@ -432,7 +434,8 @@ function createInitialV2State() {
|
|
|
432
434
|
finalData: void 0,
|
|
433
435
|
steps: [],
|
|
434
436
|
stepCounter: 0,
|
|
435
|
-
currentExecutingStepId: void 0
|
|
437
|
+
currentExecutingStepId: void 0,
|
|
438
|
+
trailingActivity: false
|
|
436
439
|
};
|
|
437
440
|
}
|
|
438
441
|
function upsertUserAction(state, req) {
|
|
@@ -454,6 +457,7 @@ function processStreamEventV2(rawEvent, state) {
|
|
|
454
457
|
if (typeof eventType === "string" && eventType.toUpperCase() === "KEEP_ALIVE") {
|
|
455
458
|
if (event.executionId) state.executionId = event.executionId;
|
|
456
459
|
if (event.sessionId) state.sessionId = event.sessionId;
|
|
460
|
+
if (state.finalResponse) state.trailingActivity = true;
|
|
457
461
|
const description = typeof event.description === "string" ? event.description : "";
|
|
458
462
|
if (description) {
|
|
459
463
|
for (let i = state.steps.length - 1; i >= 0; i--) {
|
|
@@ -488,7 +492,12 @@ function processStreamEventV2(rawEvent, state) {
|
|
|
488
492
|
state.lastEventType = eventType;
|
|
489
493
|
break;
|
|
490
494
|
}
|
|
495
|
+
case "LLM_CALL_STARTED":
|
|
496
|
+
if (state.finalResponse) state.trailingActivity = true;
|
|
497
|
+
state.lastEventType = eventType;
|
|
498
|
+
break;
|
|
491
499
|
case "INTENT_STARTED": {
|
|
500
|
+
if (state.finalResponse) state.trailingActivity = true;
|
|
492
501
|
const stepId = `step-${state.stepCounter++}`;
|
|
493
502
|
state.steps.push({
|
|
494
503
|
id: stepId,
|
|
@@ -504,6 +513,7 @@ function processStreamEventV2(rawEvent, state) {
|
|
|
504
513
|
break;
|
|
505
514
|
}
|
|
506
515
|
case "INTENT_COMPLETED": {
|
|
516
|
+
if (state.finalResponse) state.trailingActivity = true;
|
|
507
517
|
const intentStep = state.steps.find((s2) => s2.eventType === "INTENT_STARTED" && s2.status === "in_progress");
|
|
508
518
|
if (intentStep) {
|
|
509
519
|
intentStep.status = "completed";
|
|
@@ -535,6 +545,7 @@ function processStreamEventV2(rawEvent, state) {
|
|
|
535
545
|
step2.status = "completed";
|
|
536
546
|
}
|
|
537
547
|
});
|
|
548
|
+
state.trailingActivity = false;
|
|
538
549
|
state.lastEventType = eventType;
|
|
539
550
|
break;
|
|
540
551
|
}
|
|
@@ -606,6 +617,7 @@ function processStreamEventV2(rawEvent, state) {
|
|
|
606
617
|
case "WORKFLOW_ERROR":
|
|
607
618
|
state.hasError = true;
|
|
608
619
|
state.errorMessage = event.errorMessage || event.message || "Workflow error";
|
|
620
|
+
state.trailingActivity = false;
|
|
609
621
|
state.lastEventType = eventType;
|
|
610
622
|
break;
|
|
611
623
|
// ---- K2 pipeline stage lifecycle events ----
|
|
@@ -894,7 +906,9 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
|
|
|
894
906
|
const latestUsefulStep = [...state.steps].reverse().find(
|
|
895
907
|
(s2) => s2.message && !isBlandStatus(s2.message)
|
|
896
908
|
);
|
|
897
|
-
const
|
|
909
|
+
const eventTypeUpper = typeof event.eventType === "string" ? event.eventType.toUpperCase() : "";
|
|
910
|
+
const liveEventLabel = eventTypeUpper === "KEEP_ALIVE" || eventTypeUpper === "LLM_CALL_STARTED" ? useful(getEventMessage(event)) : void 0;
|
|
911
|
+
const currentMessage = useful(activeStep?.message) ?? useful(lastInProgressStep?.message) ?? liveEventLabel ?? latestUsefulStep?.message ?? useful(getEventMessage(event)) ?? // Last-resort: every candidate is bland (very first event,
|
|
898
912
|
// nothing useful seen yet). Render the bland label so the
|
|
899
913
|
// bubble isn't blank.
|
|
900
914
|
activeStep?.message ?? lastInProgressStep?.message ?? getEventMessage(event);
|
|
@@ -919,6 +933,7 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
|
|
|
919
933
|
streamingContent: state.finalResponse,
|
|
920
934
|
content: "",
|
|
921
935
|
currentMessage,
|
|
936
|
+
hasTrailingActivity: state.trailingActivity,
|
|
922
937
|
streamProgress: "processing",
|
|
923
938
|
isError: false,
|
|
924
939
|
steps: [...state.steps],
|
|
@@ -2636,6 +2651,7 @@ function VerificationBody({
|
|
|
2636
2651
|
expired,
|
|
2637
2652
|
pal,
|
|
2638
2653
|
accent,
|
|
2654
|
+
isDark,
|
|
2639
2655
|
onSubmit,
|
|
2640
2656
|
onCancel,
|
|
2641
2657
|
onResend
|
|
@@ -2698,7 +2714,11 @@ function VerificationBody({
|
|
|
2698
2714
|
} catch {
|
|
2699
2715
|
}
|
|
2700
2716
|
}, [locked, onResend, prompt.userActionId, resendSec]);
|
|
2701
|
-
const
|
|
2717
|
+
const promptMessage = prompt.message?.trim();
|
|
2718
|
+
const description = promptMessage || (isNumeric ? `Enter the ${codeLen}-digit code to continue` : "Enter the verification code to continue");
|
|
2719
|
+
const renderMarkdown = !!promptMessage && prompt.metadata?.["payman/messageFormat"] === "markdown";
|
|
2720
|
+
const mdStyles = isDark ? MD_STYLES_DARK : MD_STYLES_LIGHT;
|
|
2721
|
+
const mdRules = react.useMemo(() => makeMdRules(isDark, accent), [isDark, accent]);
|
|
2702
2722
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: ub.bodyWrap, children: [
|
|
2703
2723
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2704
2724
|
reactNative.ScrollView,
|
|
@@ -2708,7 +2728,7 @@ function VerificationBody({
|
|
|
2708
2728
|
keyboardShouldPersistTaps: "handled",
|
|
2709
2729
|
showsVerticalScrollIndicator: false,
|
|
2710
2730
|
children: [
|
|
2711
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [ub.desc, { color: pal.muted }], children: description }),
|
|
2731
|
+
renderMarkdown ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: ub.messageBlock, children: /* @__PURE__ */ jsxRuntime.jsx(Markdown__default.default, { style: mdStyles, rules: mdRules, children: description.replace(/\\n/g, "\n") }) }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [ub.desc, { color: pal.muted }], children: description }),
|
|
2712
2732
|
isNumeric ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2713
2733
|
CodeInput,
|
|
2714
2734
|
{
|
|
@@ -3047,6 +3067,7 @@ function UserActionSheet({
|
|
|
3047
3067
|
expired,
|
|
3048
3068
|
pal,
|
|
3049
3069
|
accent,
|
|
3070
|
+
isDark,
|
|
3050
3071
|
onSubmit,
|
|
3051
3072
|
onCancel,
|
|
3052
3073
|
onResend
|