@paymanai/payman-ask-sdk 1.2.5 → 1.2.7

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
@@ -224,7 +224,7 @@ function ThinkingBlock({ text }) {
224
224
  {
225
225
  type: "button",
226
226
  onClick: () => setIsOpen((prev) => !prev),
227
- className: "inline-flex items-center gap-1 text-[10px] text-muted-foreground/50 hover:text-muted-foreground/80 transition-colors",
227
+ className: "inline-flex items-center gap-1 text-[10px] payman-agent-thinking-toggle transition-colors",
228
228
  "aria-expanded": isOpen,
229
229
  "aria-label": isOpen ? "Collapse thought process" : "Expand thought process",
230
230
  children: [
@@ -249,7 +249,7 @@ function ThinkingBlock({ text }) {
249
249
  exit: { height: 0, opacity: 0 },
250
250
  transition: { duration: 0.2, ease: "easeInOut" },
251
251
  className: "overflow-hidden",
252
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 bg-muted/50 rounded-md p-2 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed", children: text }) })
252
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 payman-agent-thinking-block rounded-md p-2 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-xs payman-agent-thinking-block-text whitespace-pre-wrap leading-relaxed", children: text }) })
253
253
  }
254
254
  ) })
255
255
  ] });
@@ -349,19 +349,19 @@ function AgentMessage({
349
349
  className: cn(
350
350
  "text-xs leading-relaxed min-w-0 break-words",
351
351
  isCurrentlyExecuting && "shimmer-text font-medium",
352
- !isCurrentlyExecuting && step.status === "error" && "text-destructive payman-agent-step-text--error",
353
- !isCurrentlyExecuting && step.eventType === "USER_ACTION_SUCCESS" && "text-emerald-600 payman-agent-step-text--success",
354
- !isCurrentlyExecuting && step.status === "completed" && "text-muted-foreground payman-agent-step-text--completed",
355
- !isCurrentlyExecuting && step.status === "pending" && "text-muted-foreground/40 payman-agent-step-text--pending",
356
- !isCurrentlyExecuting && step.status === "in_progress" && "text-muted-foreground/60 payman-agent-step-text--in-progress"
352
+ !isCurrentlyExecuting && step.status === "error" && "payman-agent-step-text--error",
353
+ !isCurrentlyExecuting && step.eventType === "USER_ACTION_SUCCESS" && "payman-agent-step-text--success",
354
+ !isCurrentlyExecuting && step.status === "completed" && "payman-agent-step-text--completed",
355
+ !isCurrentlyExecuting && step.status === "pending" && "payman-agent-step-text--pending",
356
+ !isCurrentlyExecuting && step.status === "in_progress" && "payman-agent-step-text--in-progress"
357
357
  ),
358
358
  children: step.message
359
359
  }
360
360
  )
361
361
  ] }),
362
- hasTime && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-[22px] mt-1", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-muted border border-border/40 leading-none payman-agent-step-time", children: [
363
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-2.5 w-2.5 text-muted-foreground/60 shrink-0 payman-agent-step-time-icon" }),
364
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-mono text-muted-foreground/60", children: formatElapsedTime(step.elapsedMs) })
362
+ hasTime && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-[22px] mt-1", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md payman-agent-step-time leading-none", children: [
363
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-2.5 w-2.5 shrink-0 payman-agent-step-time-icon" }),
364
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-mono payman-agent-step-time-text", children: formatElapsedTime(step.elapsedMs) })
365
365
  ] }) })
366
366
  ] }, step.id);
367
367
  }) })
@@ -415,42 +415,20 @@ function AgentMessage({
415
415
  layout === "centered" ? "max-w-[85%]" : showAvatar ? "max-w-[85%]" : "max-w-[80%]"
416
416
  ),
417
417
  children: [
418
- message.userActionResult && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: message.userActionResult === "approved" ? /* @__PURE__ */ jsxRuntime.jsxs(
419
- "span",
420
- {
421
- className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-semibold rounded-full payman-agent-approved shrink-0",
422
- style: {
423
- background: "var(--payman-agent-approved-bg, var(--payman-success-light, #ecfdf5))",
424
- color: "var(--payman-agent-approved-text, var(--payman-success-dark, #047857))",
425
- border: "1px solid var(--payman-agent-approved-border, var(--payman-success, #059669))"
426
- },
427
- children: [
428
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 shrink-0", strokeWidth: 2.5 }),
429
- "Verified"
430
- ]
431
- }
432
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
433
- "span",
434
- {
435
- className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-semibold rounded-full payman-agent-rejected shrink-0",
436
- style: {
437
- background: "var(--payman-agent-rejected-bg, var(--payman-error-light, #fef2f2))",
438
- color: "var(--payman-agent-rejected-text, var(--payman-error-dark, #b91c1c))",
439
- border: "1px solid var(--payman-agent-rejected-border, var(--payman-destructive, #dc2626))"
440
- },
441
- children: [
442
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3.5 h-3.5 shrink-0", strokeWidth: 2.5 }),
443
- "Rejected"
444
- ]
445
- }
446
- ) }),
418
+ message.userActionResult && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: message.userActionResult === "approved" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-semibold rounded-full payman-agent-approved shrink-0", children: [
419
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 shrink-0", strokeWidth: 2.5 }),
420
+ "Verified"
421
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-semibold rounded-full payman-agent-rejected shrink-0", children: [
422
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3.5 h-3.5 shrink-0", strokeWidth: 2.5 }),
423
+ "Rejected"
424
+ ] }) }),
447
425
  /* @__PURE__ */ jsxRuntime.jsxs(
448
426
  "div",
449
427
  {
450
428
  className: cn(
451
429
  "overflow-hidden w-full min-w-0 px-4 py-3 rounded-2xl rounded-tl-md transition-all duration-200",
452
430
  layout === "centered" ? cn(
453
- "payman-agent-bubble payman-agent-bubble--centered border shadow-sm",
431
+ "payman-agent-bubble payman-agent-bubble--centered",
454
432
  isStreaming && "streaming",
455
433
  isError && "error"
456
434
  ) : cn(
@@ -463,7 +441,7 @@ function AgentMessage({
463
441
  "p",
464
442
  {
465
443
  className: cn(
466
- "text-sm font-semibold mb-1 leading-none text-muted-foreground/70 payman-agent-name",
444
+ "text-sm font-semibold mb-1 leading-none payman-agent-name",
467
445
  isStreaming && !content && "animate-pulse"
468
446
  ),
469
447
  children: isStreaming && !content ? "Thought Process" : agentName
@@ -477,23 +455,23 @@ function AgentMessage({
477
455
  showAgentName && "mt-1"
478
456
  ),
479
457
  children: isStreaming && !content ? (
480
- // One active item at a time, by event order: thinking stream OR current step with loading (same bullet UI as dropdown)
481
- activeThinkingText ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1.5 items-start", children: [
482
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-px", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 text-primary animate-spin payman-agent-thinking-spinner" }) }) }),
483
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm leading-relaxed min-w-0 break-words text-muted-foreground whitespace-pre-wrap flex-1 payman-agent-thinking-text", children: [
458
+ // Streaming without content show thinking/step indicator
459
+ activeThinkingText ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-start", children: [
460
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mt-0.5 payman-agent-thinking-spinner animate-spin shrink-0" }),
461
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm leading-relaxed min-w-0 break-words payman-agent-thinking-text whitespace-pre-wrap flex-1", children: [
484
462
  activeThinkingText,
485
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-3.5 bg-muted-foreground/50 animate-pulse ml-0.5 align-text-bottom" })
463
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-3.5 payman-agent-thinking-cursor animate-pulse ml-0.5 align-text-bottom" })
486
464
  ] })
487
465
  ] }) : currentStep ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1.5 items-start", children: [
488
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-px", children: renderStepIcon(currentStep, true) }),
489
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm leading-relaxed min-w-0 break-words shimmer-text font-medium", children: currentStep.message })
490
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
491
- !showAvatar && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 text-primary/70 animate-spin flex-shrink-0 payman-agent-thinking-spinner" }),
492
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground whitespace-nowrap payman-agent-thinking-text", children: currentMessage || "Thinking..." })
466
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 shrink-0", children: renderStepIcon(currentStep, true) }),
467
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm leading-relaxed min-w-0 break-words shimmer-text font-medium flex-1", children: currentStep.message })
468
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2.5 items-start", children: [
469
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 mt-0.5 payman-agent-thinking-spinner animate-spin shrink-0" }),
470
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm payman-agent-thinking-text flex-1", children: currentMessage || "Thinking..." })
493
471
  ] })
494
- ) : isCancelled && !content ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
495
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4 payman-agent-cancelled-icon flex-shrink-0" }),
496
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm payman-agent-cancelled-text italic", children: currentMessage || "Request was stopped." })
472
+ ) : isCancelled && !content ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2.5 items-start", children: [
473
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4 mt-0.5 payman-agent-cancelled-icon shrink-0" }),
474
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm payman-agent-cancelled-text italic flex-1", children: currentMessage || "Request was stopped." })
497
475
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
498
476
  "div",
499
477
  {
@@ -562,7 +540,7 @@ function markdownComponents(_isError) {
562
540
  p: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-3 last:mb-0 text-sm leading-relaxed", children }),
563
541
  code: ({ className: codeClassName, children }) => {
564
542
  const isInline = !codeClassName;
565
- return isInline ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "px-1.5 py-0.5 rounded-md text-xs font-mono break-all", children }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block p-3 rounded-lg text-xs font-mono overflow-x-auto my-2 whitespace-pre", children });
543
+ return isInline ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "px-1.5 py-0.5 rounded-md text-xs font-mono break-all payman-agent-code-inline", children }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block p-3 rounded-lg text-xs font-mono overflow-x-auto my-2 whitespace-pre payman-agent-code-block", children });
566
544
  },
567
545
  pre: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "my-2 overflow-x-auto max-w-full rounded-lg", children }),
568
546
  ul: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc ml-4 mb-3 space-y-1 text-sm", children }),
@@ -573,22 +551,22 @@ function markdownComponents(_isError) {
573
551
  h3: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold mb-1 mt-2 first:mt-0", children }),
574
552
  strong: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold", children }),
575
553
  em: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("em", { className: "italic", children }),
576
- blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "pl-4 my-2 italic", children }),
577
- hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-4" }),
554
+ blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "pl-4 my-2 italic payman-agent-blockquote", children }),
555
+ hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-4 payman-agent-hr" }),
578
556
  a: ({ href, children }) => /* @__PURE__ */ jsxRuntime.jsx(
579
557
  "a",
580
558
  {
581
559
  href,
582
560
  target: "_blank",
583
561
  rel: "noopener noreferrer",
584
- className: "underline underline-offset-2 decoration-1",
562
+ className: "underline underline-offset-2 decoration-1 payman-agent-link",
585
563
  children
586
564
  }
587
565
  ),
588
- table: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-x-auto my-4 -mx-1", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "min-w-full caption-bottom text-sm border rounded-lg overflow-hidden", children }) }),
589
- thead: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "[&_tr]:border-b", children }),
566
+ table: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-x-auto my-4 -mx-1", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "min-w-full caption-bottom text-sm rounded-lg overflow-hidden payman-agent-table", children }) }),
567
+ thead: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "[&_tr]:border-b payman-agent-thead", children }),
590
568
  tbody: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "[&_tr:last-child]:border-0", children }),
591
- tr: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b transition-colors", children }),
569
+ tr: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b transition-colors payman-agent-tr", children }),
592
570
  th: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "h-10 px-3 text-left align-middle font-medium whitespace-nowrap text-xs", children }),
593
571
  td: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 align-middle text-sm", children })
594
572
  };