@hef2024/llmasaservice-ui 0.24.6 → 0.25.0
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.css +115 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +144 -21
- package/dist/index.mjs +144 -21
- package/index.ts +3 -0
- package/package.json +1 -1
- package/src/AIAgentPanel.tsx +12 -5
- package/src/AIChatPanel.css +128 -0
- package/src/AIChatPanel.tsx +189 -21
package/dist/index.css
CHANGED
|
@@ -3026,6 +3026,21 @@ button[data-pending=true]::after {
|
|
|
3026
3026
|
text-overflow: ellipsis;
|
|
3027
3027
|
font-weight: 500;
|
|
3028
3028
|
}
|
|
3029
|
+
.ai-chat-tool-status-row__label--shimmer {
|
|
3030
|
+
background:
|
|
3031
|
+
linear-gradient(
|
|
3032
|
+
90deg,
|
|
3033
|
+
var(--tool-row-text) 0%,
|
|
3034
|
+
var(--tool-row-text) 40%,
|
|
3035
|
+
var(--tool-row-accent) 50%,
|
|
3036
|
+
var(--tool-row-text) 60%,
|
|
3037
|
+
var(--tool-row-text) 100%);
|
|
3038
|
+
background-size: 200% 100%;
|
|
3039
|
+
-webkit-background-clip: text;
|
|
3040
|
+
background-clip: text;
|
|
3041
|
+
-webkit-text-fill-color: transparent;
|
|
3042
|
+
animation: titleShimmer 2s ease-in-out infinite;
|
|
3043
|
+
}
|
|
3029
3044
|
.ai-chat-tool-status-row__call-id {
|
|
3030
3045
|
font-family:
|
|
3031
3046
|
"SF Mono",
|
|
@@ -3349,6 +3364,8 @@ button[data-pending=true]::after {
|
|
|
3349
3364
|
}
|
|
3350
3365
|
}
|
|
3351
3366
|
.ai-chat-panel__input-container {
|
|
3367
|
+
position: relative;
|
|
3368
|
+
overflow: visible;
|
|
3352
3369
|
margin: 12px 16px;
|
|
3353
3370
|
border: 1px solid var(--ai-chat-input-border);
|
|
3354
3371
|
border-radius: var(--ai-chat-input-radius);
|
|
@@ -3377,6 +3394,104 @@ button[data-pending=true]::after {
|
|
|
3377
3394
|
border-color: transparent;
|
|
3378
3395
|
box-shadow: none;
|
|
3379
3396
|
}
|
|
3397
|
+
.ai-chat-queued-prompts {
|
|
3398
|
+
display: flex;
|
|
3399
|
+
flex-direction: column;
|
|
3400
|
+
gap: 4px;
|
|
3401
|
+
padding: 6px 8px 0 8px;
|
|
3402
|
+
max-height: 92px;
|
|
3403
|
+
overflow-y: auto;
|
|
3404
|
+
}
|
|
3405
|
+
.ai-chat-queued-prompt {
|
|
3406
|
+
display: flex;
|
|
3407
|
+
align-items: center;
|
|
3408
|
+
gap: 6px;
|
|
3409
|
+
min-width: 0;
|
|
3410
|
+
padding: 5px 6px 5px 8px;
|
|
3411
|
+
border-radius: 10px;
|
|
3412
|
+
border: 1px solid rgba(59, 130, 246, 0.18);
|
|
3413
|
+
background: rgba(59, 130, 246, 0.05);
|
|
3414
|
+
}
|
|
3415
|
+
.ai-chat-queued-prompt__content {
|
|
3416
|
+
min-width: 0;
|
|
3417
|
+
flex: 1;
|
|
3418
|
+
display: flex;
|
|
3419
|
+
flex-direction: column;
|
|
3420
|
+
gap: 1px;
|
|
3421
|
+
}
|
|
3422
|
+
.dark-theme .ai-chat-queued-prompt__content {
|
|
3423
|
+
background: none;
|
|
3424
|
+
border-color: transparent;
|
|
3425
|
+
}
|
|
3426
|
+
.ai-chat-queued-prompt__label {
|
|
3427
|
+
font-size: 9px;
|
|
3428
|
+
font-weight: 600;
|
|
3429
|
+
line-height: 1.2;
|
|
3430
|
+
letter-spacing: 0.06em;
|
|
3431
|
+
text-transform: uppercase;
|
|
3432
|
+
color: var(--ai-chat-input-placeholder);
|
|
3433
|
+
}
|
|
3434
|
+
.ai-chat-queued-prompt__text {
|
|
3435
|
+
min-width: 0;
|
|
3436
|
+
font-size: 11px;
|
|
3437
|
+
line-height: 1.3;
|
|
3438
|
+
color: var(--ai-chat-input-text);
|
|
3439
|
+
white-space: nowrap;
|
|
3440
|
+
overflow: hidden;
|
|
3441
|
+
text-overflow: ellipsis;
|
|
3442
|
+
}
|
|
3443
|
+
.ai-chat-queued-prompt__actions {
|
|
3444
|
+
display: flex;
|
|
3445
|
+
align-items: center;
|
|
3446
|
+
gap: 4px;
|
|
3447
|
+
flex-shrink: 0;
|
|
3448
|
+
}
|
|
3449
|
+
.ai-chat-queued-prompt__button,
|
|
3450
|
+
.ai-chat-queued-prompt__icon-button {
|
|
3451
|
+
display: inline-flex;
|
|
3452
|
+
align-items: center;
|
|
3453
|
+
justify-content: center;
|
|
3454
|
+
height: 22px;
|
|
3455
|
+
border: 1px solid rgba(59, 130, 246, 0.14);
|
|
3456
|
+
background: transparent;
|
|
3457
|
+
color: var(--ai-chat-input-placeholder);
|
|
3458
|
+
border-radius: 999px;
|
|
3459
|
+
cursor: pointer;
|
|
3460
|
+
transition:
|
|
3461
|
+
background-color 0.15s,
|
|
3462
|
+
border-color 0.15s,
|
|
3463
|
+
opacity 0.15s;
|
|
3464
|
+
}
|
|
3465
|
+
.ai-chat-queued-prompt__button {
|
|
3466
|
+
padding: 0 8px;
|
|
3467
|
+
font-size: 10px;
|
|
3468
|
+
font-weight: 600;
|
|
3469
|
+
}
|
|
3470
|
+
.ai-chat-queued-prompt__icon-button {
|
|
3471
|
+
width: 22px;
|
|
3472
|
+
padding: 0;
|
|
3473
|
+
}
|
|
3474
|
+
.ai-chat-queued-prompt__button:hover,
|
|
3475
|
+
.ai-chat-queued-prompt__icon-button:hover {
|
|
3476
|
+
background: rgba(59, 130, 246, 0.08);
|
|
3477
|
+
border-color: rgba(59, 130, 246, 0.24);
|
|
3478
|
+
}
|
|
3479
|
+
.ai-chat-queued-prompt__icon-button svg {
|
|
3480
|
+
width: 10px;
|
|
3481
|
+
height: 10px;
|
|
3482
|
+
}
|
|
3483
|
+
.dark-theme .ai-chat-queued-prompt {
|
|
3484
|
+
border-color: rgba(96, 165, 250, 0.22);
|
|
3485
|
+
background: rgba(96, 165, 250, 0.08);
|
|
3486
|
+
}
|
|
3487
|
+
.dark-theme .ai-chat-queued-prompt__button,
|
|
3488
|
+
.dark-theme .ai-chat-queued-prompt__icon-button {
|
|
3489
|
+
border-color: rgba(96, 165, 250, 0.18);
|
|
3490
|
+
background: transparent;
|
|
3491
|
+
}
|
|
3492
|
+
.ai-chat-panel__input-container:focus-within .ai-chat-queued-prompt {
|
|
3493
|
+
border-color: rgba(96, 165, 250, 0.32);
|
|
3494
|
+
}
|
|
3380
3495
|
.ai-chat-panel__input-footer {
|
|
3381
3496
|
display: flex;
|
|
3382
3497
|
align-items: center;
|
package/dist/index.d.mts
CHANGED
|
@@ -181,6 +181,15 @@ interface LocalToolExecutorContext {
|
|
|
181
181
|
mcpTool: Record<string, unknown> | null;
|
|
182
182
|
}
|
|
183
183
|
type LocalToolExecutor = (args: Record<string, unknown>, context: LocalToolExecutorContext) => Promise<unknown> | unknown;
|
|
184
|
+
type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error';
|
|
185
|
+
interface ToolStatusLabelFormatterInput {
|
|
186
|
+
toolName: string;
|
|
187
|
+
callId: string;
|
|
188
|
+
status: ToolCallStatus;
|
|
189
|
+
args?: Record<string, unknown>;
|
|
190
|
+
defaultLabel: string;
|
|
191
|
+
}
|
|
192
|
+
type ToolStatusLabelFormatter = (input: ToolStatusLabelFormatterInput) => string | null | undefined;
|
|
184
193
|
type ArtifactBlockType = 'thinking' | 'reasoning' | 'searching' | 'planning';
|
|
185
194
|
type PlanningStepStatus = 'todo' | 'doing' | 'done';
|
|
186
195
|
interface PlanningStep {
|
|
@@ -278,6 +287,7 @@ interface AIChatPanelProps {
|
|
|
278
287
|
callToActionEmailSubject?: string;
|
|
279
288
|
customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
|
|
280
289
|
customerEmailCapturePlaceholder?: string;
|
|
290
|
+
toolStatusLabelFormatter?: ToolStatusLabelFormatter;
|
|
281
291
|
}
|
|
282
292
|
/**
|
|
283
293
|
* Context section for the context viewer
|
|
@@ -424,6 +434,7 @@ interface AIAgentPanelProps {
|
|
|
424
434
|
localToolExecutors?: Record<string, LocalToolExecutor>;
|
|
425
435
|
traceContextMode?: TraceContextMode;
|
|
426
436
|
autoApproveTools?: boolean | string[];
|
|
437
|
+
toolStatusLabelFormatter?: ToolStatusLabelFormatter;
|
|
427
438
|
}
|
|
428
439
|
declare const AIAgentPanel: React__default.ForwardRefExoticComponent<AIAgentPanelProps & React__default.RefAttributes<AIAgentPanelHandle>>;
|
|
429
440
|
|
|
@@ -672,4 +683,4 @@ interface ThinkingBlockProps {
|
|
|
672
683
|
*/
|
|
673
684
|
declare const ThinkingBlock: React__default.FC<ThinkingBlockProps>;
|
|
674
685
|
|
|
675
|
-
export { AIAgentPanel, type AIAgentPanelProps, type AIChatHistoryEntry, _default as AIChatPanel, type AIChatPanelProps, type APIConversationSummary, type AgentContext, type AgentMetadata, AgentPanel, type AgentPanelProps, type AgentProfile, type ArtifactBlockType, Button, type ButtonProps, ChatPanel, type ChatPanelProps, type ContextDataFormat, type ContextSection, type Conversation, type ConversationGroup, Dialog, DialogFooter, type DialogFooterProps, type DialogProps, Input, type InputProps, type MCPAuthHeaderResolver, type MCPAuthHeaderResolverInput, type MCPAuthPhase, type MCPServer, type ObjectContextSection, type PlanningStep, type PlanningStepStatus, type RawContextSection, type ResponseArtifactBlock, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, ThinkingBlock, type ThinkingBlockProps, type ThinkingBlockType, Tooltip, type TooltipProps, WordFadeIn, type WordFadeInProps, useAgentRegistry, useConversationStore };
|
|
686
|
+
export { AIAgentPanel, type AIAgentPanelProps, type AIChatHistoryEntry, _default as AIChatPanel, type AIChatPanelProps, type APIConversationSummary, type AgentContext, type AgentMetadata, AgentPanel, type AgentPanelProps, type AgentProfile, type ArtifactBlockType, Button, type ButtonProps, ChatPanel, type ChatPanelProps, type ContextDataFormat, type ContextSection, type Conversation, type ConversationGroup, Dialog, DialogFooter, type DialogFooterProps, type DialogProps, Input, type InputProps, type MCPAuthHeaderResolver, type MCPAuthHeaderResolverInput, type MCPAuthPhase, type MCPServer, type ObjectContextSection, type PlanningStep, type PlanningStepStatus, type RawContextSection, type ResponseArtifactBlock, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, ThinkingBlock, type ThinkingBlockProps, type ThinkingBlockType, type ToolCallStatus, type ToolStatusLabelFormatter, type ToolStatusLabelFormatterInput, Tooltip, type TooltipProps, WordFadeIn, type WordFadeInProps, useAgentRegistry, useConversationStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,15 @@ interface LocalToolExecutorContext {
|
|
|
181
181
|
mcpTool: Record<string, unknown> | null;
|
|
182
182
|
}
|
|
183
183
|
type LocalToolExecutor = (args: Record<string, unknown>, context: LocalToolExecutorContext) => Promise<unknown> | unknown;
|
|
184
|
+
type ToolCallStatus = 'pending' | 'running' | 'completed' | 'error';
|
|
185
|
+
interface ToolStatusLabelFormatterInput {
|
|
186
|
+
toolName: string;
|
|
187
|
+
callId: string;
|
|
188
|
+
status: ToolCallStatus;
|
|
189
|
+
args?: Record<string, unknown>;
|
|
190
|
+
defaultLabel: string;
|
|
191
|
+
}
|
|
192
|
+
type ToolStatusLabelFormatter = (input: ToolStatusLabelFormatterInput) => string | null | undefined;
|
|
184
193
|
type ArtifactBlockType = 'thinking' | 'reasoning' | 'searching' | 'planning';
|
|
185
194
|
type PlanningStepStatus = 'todo' | 'doing' | 'done';
|
|
186
195
|
interface PlanningStep {
|
|
@@ -278,6 +287,7 @@ interface AIChatPanelProps {
|
|
|
278
287
|
callToActionEmailSubject?: string;
|
|
279
288
|
customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
|
|
280
289
|
customerEmailCapturePlaceholder?: string;
|
|
290
|
+
toolStatusLabelFormatter?: ToolStatusLabelFormatter;
|
|
281
291
|
}
|
|
282
292
|
/**
|
|
283
293
|
* Context section for the context viewer
|
|
@@ -424,6 +434,7 @@ interface AIAgentPanelProps {
|
|
|
424
434
|
localToolExecutors?: Record<string, LocalToolExecutor>;
|
|
425
435
|
traceContextMode?: TraceContextMode;
|
|
426
436
|
autoApproveTools?: boolean | string[];
|
|
437
|
+
toolStatusLabelFormatter?: ToolStatusLabelFormatter;
|
|
427
438
|
}
|
|
428
439
|
declare const AIAgentPanel: React__default.ForwardRefExoticComponent<AIAgentPanelProps & React__default.RefAttributes<AIAgentPanelHandle>>;
|
|
429
440
|
|
|
@@ -672,4 +683,4 @@ interface ThinkingBlockProps {
|
|
|
672
683
|
*/
|
|
673
684
|
declare const ThinkingBlock: React__default.FC<ThinkingBlockProps>;
|
|
674
685
|
|
|
675
|
-
export { AIAgentPanel, type AIAgentPanelProps, type AIChatHistoryEntry, _default as AIChatPanel, type AIChatPanelProps, type APIConversationSummary, type AgentContext, type AgentMetadata, AgentPanel, type AgentPanelProps, type AgentProfile, type ArtifactBlockType, Button, type ButtonProps, ChatPanel, type ChatPanelProps, type ContextDataFormat, type ContextSection, type Conversation, type ConversationGroup, Dialog, DialogFooter, type DialogFooterProps, type DialogProps, Input, type InputProps, type MCPAuthHeaderResolver, type MCPAuthHeaderResolverInput, type MCPAuthPhase, type MCPServer, type ObjectContextSection, type PlanningStep, type PlanningStepStatus, type RawContextSection, type ResponseArtifactBlock, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, ThinkingBlock, type ThinkingBlockProps, type ThinkingBlockType, Tooltip, type TooltipProps, WordFadeIn, type WordFadeInProps, useAgentRegistry, useConversationStore };
|
|
686
|
+
export { AIAgentPanel, type AIAgentPanelProps, type AIChatHistoryEntry, _default as AIChatPanel, type AIChatPanelProps, type APIConversationSummary, type AgentContext, type AgentMetadata, AgentPanel, type AgentPanelProps, type AgentProfile, type ArtifactBlockType, Button, type ButtonProps, ChatPanel, type ChatPanelProps, type ContextDataFormat, type ContextSection, type Conversation, type ConversationGroup, Dialog, DialogFooter, type DialogFooterProps, type DialogProps, Input, type InputProps, type MCPAuthHeaderResolver, type MCPAuthHeaderResolverInput, type MCPAuthPhase, type MCPServer, type ObjectContextSection, type PlanningStep, type PlanningStepStatus, type RawContextSection, type ResponseArtifactBlock, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, ThinkingBlock, type ThinkingBlockProps, type ThinkingBlockType, type ToolCallStatus, type ToolStatusLabelFormatter, type ToolStatusLabelFormatterInput, Tooltip, type TooltipProps, WordFadeIn, type WordFadeInProps, useAgentRegistry, useConversationStore };
|
package/dist/index.js
CHANGED
|
@@ -4995,7 +4995,10 @@ var ChatInput = import_react14.default.memo(({
|
|
|
4995
4995
|
placeholder,
|
|
4996
4996
|
isBusy,
|
|
4997
4997
|
onSubmit,
|
|
4998
|
+
onQueueSubmit,
|
|
4998
4999
|
onStop,
|
|
5000
|
+
queuedPrompts = [],
|
|
5001
|
+
onClearQueuedPrompt,
|
|
4999
5002
|
agentOptions,
|
|
5000
5003
|
currentAgentId,
|
|
5001
5004
|
onAgentChange,
|
|
@@ -5026,14 +5029,29 @@ var ChatInput = import_react14.default.memo(({
|
|
|
5026
5029
|
}, []);
|
|
5027
5030
|
const handleSubmit = (0, import_react14.useCallback)(() => {
|
|
5028
5031
|
const trimmed = inputValue.trim();
|
|
5029
|
-
if (trimmed
|
|
5032
|
+
if (!trimmed) return;
|
|
5033
|
+
const hasQueuedPrompts2 = queuedPrompts.some((prompt) => String(prompt || "").trim().length > 0);
|
|
5034
|
+
if (isBusy || hasQueuedPrompts2) {
|
|
5035
|
+
onQueueSubmit(trimmed);
|
|
5036
|
+
} else {
|
|
5030
5037
|
onSubmit(trimmed);
|
|
5031
|
-
setInputValue("");
|
|
5032
|
-
if (textareaRef.current) {
|
|
5033
|
-
textareaRef.current.style.height = "auto";
|
|
5034
|
-
}
|
|
5035
5038
|
}
|
|
5036
|
-
|
|
5039
|
+
setInputValue("");
|
|
5040
|
+
if (textareaRef.current) {
|
|
5041
|
+
textareaRef.current.style.height = "auto";
|
|
5042
|
+
}
|
|
5043
|
+
}, [inputValue, isBusy, onQueueSubmit, onSubmit, queuedPrompts]);
|
|
5044
|
+
const handleEditQueuedPrompt = (0, import_react14.useCallback)((index) => {
|
|
5045
|
+
const normalizedQueuedPrompt = String(queuedPrompts[index] || "").trim();
|
|
5046
|
+
if (!normalizedQueuedPrompt) return;
|
|
5047
|
+
setInputValue(normalizedQueuedPrompt);
|
|
5048
|
+
onClearQueuedPrompt(index);
|
|
5049
|
+
setTimeout(() => {
|
|
5050
|
+
var _a;
|
|
5051
|
+
autoResize();
|
|
5052
|
+
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
5053
|
+
}, 0);
|
|
5054
|
+
}, [autoResize, onClearQueuedPrompt, queuedPrompts]);
|
|
5037
5055
|
(0, import_react14.useEffect)(() => {
|
|
5038
5056
|
const handleClickOutside = (event) => {
|
|
5039
5057
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
@@ -5083,12 +5101,35 @@ var ChatInput = import_react14.default.memo(({
|
|
|
5083
5101
|
var _a;
|
|
5084
5102
|
return JSON.stringify((_a = section.data) != null ? _a : {}, null, 2);
|
|
5085
5103
|
};
|
|
5104
|
+
const normalizedQueuedPrompts = queuedPrompts.map((prompt) => String(prompt || "").trim()).filter((prompt) => prompt.length > 0);
|
|
5105
|
+
const hasDraft = inputValue.trim().length > 0;
|
|
5106
|
+
const hasQueuedPrompts = normalizedQueuedPrompts.length > 0;
|
|
5107
|
+
const shouldQueueSubmission = isBusy || hasQueuedPrompts;
|
|
5108
|
+
const showStopAction = isBusy && !hasDraft;
|
|
5086
5109
|
return /* @__PURE__ */ import_react14.default.createElement(
|
|
5087
5110
|
"div",
|
|
5088
5111
|
{
|
|
5089
5112
|
className: `ai-chat-panel__input-container ${dropdownOpen ? "ai-chat-panel__input-container--dropdown-open" : ""}`,
|
|
5090
5113
|
ref: containerRef
|
|
5091
5114
|
},
|
|
5115
|
+
hasQueuedPrompts && /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-queued-prompts" }, normalizedQueuedPrompts.map((queuedPrompt, index) => /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-queued-prompt", title: queuedPrompt, key: `${index}-${queuedPrompt}` }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-queued-prompt__content" }, /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-queued-prompt__label" }, index === 0 ? "Queued next" : `Queued ${index + 1}`), /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-queued-prompt__text" }, queuedPrompt)), /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-queued-prompt__actions" }, /* @__PURE__ */ import_react14.default.createElement(
|
|
5116
|
+
"button",
|
|
5117
|
+
{
|
|
5118
|
+
className: "ai-chat-queued-prompt__button",
|
|
5119
|
+
onClick: () => handleEditQueuedPrompt(index),
|
|
5120
|
+
type: "button"
|
|
5121
|
+
},
|
|
5122
|
+
"Edit"
|
|
5123
|
+
), /* @__PURE__ */ import_react14.default.createElement(
|
|
5124
|
+
"button",
|
|
5125
|
+
{
|
|
5126
|
+
className: "ai-chat-queued-prompt__icon-button",
|
|
5127
|
+
onClick: () => onClearQueuedPrompt(index),
|
|
5128
|
+
type: "button",
|
|
5129
|
+
"aria-label": `Remove queued prompt ${index + 1}`
|
|
5130
|
+
},
|
|
5131
|
+
/* @__PURE__ */ import_react14.default.createElement(CloseIcon, null)
|
|
5132
|
+
))))),
|
|
5092
5133
|
/* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-panel__input" }, /* @__PURE__ */ import_react14.default.createElement(
|
|
5093
5134
|
"textarea",
|
|
5094
5135
|
{
|
|
@@ -5264,11 +5305,12 @@ var ChatInput = import_react14.default.memo(({
|
|
|
5264
5305
|
)), /* @__PURE__ */ import_react14.default.createElement(
|
|
5265
5306
|
"button",
|
|
5266
5307
|
{
|
|
5267
|
-
className: `ai-chat-send-button ${!
|
|
5268
|
-
onClick: () =>
|
|
5269
|
-
disabled: !
|
|
5308
|
+
className: `ai-chat-send-button ${!showStopAction && !hasDraft ? "ai-chat-send-button--disabled" : ""} ${showStopAction ? "ai-chat-send-button--stop" : ""}`,
|
|
5309
|
+
onClick: () => showStopAction ? onStop() : handleSubmit(),
|
|
5310
|
+
disabled: !showStopAction && !hasDraft,
|
|
5311
|
+
title: showStopAction ? "Stop response" : shouldQueueSubmission ? "Queue prompt" : "Send prompt"
|
|
5270
5312
|
},
|
|
5271
|
-
|
|
5313
|
+
showStopAction ? /* @__PURE__ */ import_react14.default.createElement(StopIcon, null) : /* @__PURE__ */ import_react14.default.createElement(ArrowUpIcon, null)
|
|
5272
5314
|
)),
|
|
5273
5315
|
agentOptions.length > 0 && dropdownOpen && /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-agent-selector__dropdown-inside" }, agentOptions.map((option) => /* @__PURE__ */ import_react14.default.createElement(
|
|
5274
5316
|
"button",
|
|
@@ -5361,7 +5403,8 @@ var AIChatPanel = ({
|
|
|
5361
5403
|
callToActionEmailSubject = "Agent CTA submitted",
|
|
5362
5404
|
// Customer Email Capture Props
|
|
5363
5405
|
customerEmailCaptureMode = "HIDE",
|
|
5364
|
-
customerEmailCapturePlaceholder = "Please enter your email..."
|
|
5406
|
+
customerEmailCapturePlaceholder = "Please enter your email...",
|
|
5407
|
+
toolStatusLabelFormatter
|
|
5365
5408
|
}) => {
|
|
5366
5409
|
var _a;
|
|
5367
5410
|
const publicAPIUrl = "https://api.llmasaservice.io";
|
|
@@ -5369,6 +5412,7 @@ var AIChatPanel = ({
|
|
|
5369
5412
|
const [lastMessages, setLastMessages] = (0, import_react14.useState)([]);
|
|
5370
5413
|
const [history, setHistory] = (0, import_react14.useState)(initialHistory);
|
|
5371
5414
|
const [isLoading, setIsLoading] = (0, import_react14.useState)(false);
|
|
5415
|
+
const [queuedPrompts, setQueuedPrompts] = (0, import_react14.useState)([]);
|
|
5372
5416
|
const [lastPrompt, setLastPrompt] = (0, import_react14.useState)(null);
|
|
5373
5417
|
const [lastKey, setLastKey] = (0, import_react14.useState)(null);
|
|
5374
5418
|
const [currentConversation, setCurrentConversation] = (0, import_react14.useState)(conversation);
|
|
@@ -5480,6 +5524,7 @@ var AIChatPanel = ({
|
|
|
5480
5524
|
const latestHistoryRef = (0, import_react14.useRef)(initialHistory);
|
|
5481
5525
|
const initialPromptSentRef = (0, import_react14.useRef)(false);
|
|
5482
5526
|
const lastFollowOnPromptRef = (0, import_react14.useRef)("");
|
|
5527
|
+
const queuedPromptsRef = (0, import_react14.useRef)([]);
|
|
5483
5528
|
const handledToolCallSignaturesRef = (0, import_react14.useRef)(/* @__PURE__ */ new Set());
|
|
5484
5529
|
const inFlightToolCallSignaturesRef = (0, import_react14.useRef)(/* @__PURE__ */ new Set());
|
|
5485
5530
|
const toolContinuationCountRef = (0, import_react14.useRef)(0);
|
|
@@ -6186,7 +6231,8 @@ ${traceSummary}` : traceSummary;
|
|
|
6186
6231
|
setActiveToolCalls(
|
|
6187
6232
|
callsToRun.map((toolCall) => ({
|
|
6188
6233
|
toolName: toolCall.toolName,
|
|
6189
|
-
callId: toolCall.callId
|
|
6234
|
+
callId: toolCall.callId,
|
|
6235
|
+
args: toolCall.args
|
|
6190
6236
|
}))
|
|
6191
6237
|
);
|
|
6192
6238
|
const finalToolCalls = callsToRun.map((toolCall) => ({
|
|
@@ -7060,12 +7106,36 @@ ${traceSummary}` : traceSummary;
|
|
|
7060
7106
|
getThinkingBlockRenderKey,
|
|
7061
7107
|
setResponse
|
|
7062
7108
|
]);
|
|
7109
|
+
const handleQueuePrompt = (0, import_react14.useCallback)((promptText) => {
|
|
7110
|
+
const normalizedPrompt = String(promptText || "").trim();
|
|
7111
|
+
if (!normalizedPrompt) return;
|
|
7112
|
+
const nextQueuedPrompts = [...queuedPromptsRef.current, normalizedPrompt];
|
|
7113
|
+
queuedPromptsRef.current = nextQueuedPrompts;
|
|
7114
|
+
setQueuedPrompts(nextQueuedPrompts);
|
|
7115
|
+
}, []);
|
|
7116
|
+
const handleClearQueuedPrompt = (0, import_react14.useCallback)((index) => {
|
|
7117
|
+
const nextQueuedPrompts = queuedPromptsRef.current.filter((_, queueIndex) => queueIndex !== index);
|
|
7118
|
+
queuedPromptsRef.current = nextQueuedPrompts;
|
|
7119
|
+
setQueuedPrompts(nextQueuedPrompts);
|
|
7120
|
+
}, []);
|
|
7063
7121
|
const handleSuggestionClick = (0, import_react14.useCallback)((question) => {
|
|
7064
7122
|
continueChat(question);
|
|
7065
7123
|
}, [continueChat]);
|
|
7066
7124
|
const handleStop = (0, import_react14.useCallback)(() => {
|
|
7067
7125
|
stop(lastController);
|
|
7068
7126
|
}, [stop, lastController]);
|
|
7127
|
+
(0, import_react14.useEffect)(() => {
|
|
7128
|
+
const nextQueuedPrompt = String(queuedPromptsRef.current[0] || "").trim();
|
|
7129
|
+
if (!nextQueuedPrompt) return;
|
|
7130
|
+
if (!idle || isLoading) return;
|
|
7131
|
+
if (pendingToolRequests.length > 0 || activeToolCalls.length > 0) return;
|
|
7132
|
+
if (toolRequestProcessingRef.current) return;
|
|
7133
|
+
if ((queuedToolRequestsRef.current || []).length > 0) return;
|
|
7134
|
+
const remainingQueuedPrompts = queuedPromptsRef.current.slice(1);
|
|
7135
|
+
queuedPromptsRef.current = remainingQueuedPrompts;
|
|
7136
|
+
setQueuedPrompts(remainingQueuedPrompts);
|
|
7137
|
+
continueChat(nextQueuedPrompt);
|
|
7138
|
+
}, [activeToolCalls.length, continueChat, idle, isLoading, pendingToolRequests.length, queuedPrompts.length]);
|
|
7069
7139
|
const handleNewConversation = (0, import_react14.useCallback)(() => {
|
|
7070
7140
|
if (!newConversationConfirm) {
|
|
7071
7141
|
setNewConversationConfirm(true);
|
|
@@ -7080,6 +7150,8 @@ ${traceSummary}` : traceSummary;
|
|
|
7080
7150
|
setHistory({});
|
|
7081
7151
|
latestHistoryRef.current = {};
|
|
7082
7152
|
hasNotifiedCompletionRef.current = true;
|
|
7153
|
+
queuedPromptsRef.current = [];
|
|
7154
|
+
setQueuedPrompts([]);
|
|
7083
7155
|
setLastMessages([]);
|
|
7084
7156
|
setLastPrompt(null);
|
|
7085
7157
|
setLastKey(null);
|
|
@@ -7561,6 +7633,28 @@ ${traceSummary}` : traceSummary;
|
|
|
7561
7633
|
if (normalized.length <= 22) return normalized;
|
|
7562
7634
|
return `${normalized.slice(0, 10)}...${normalized.slice(-8)}`;
|
|
7563
7635
|
};
|
|
7636
|
+
const resolveToolStatusLabel = (0, import_react14.useCallback)(
|
|
7637
|
+
(toolStatusRow) => {
|
|
7638
|
+
if (typeof toolStatusLabelFormatter !== "function") {
|
|
7639
|
+
return toolStatusRow.statusLabel;
|
|
7640
|
+
}
|
|
7641
|
+
try {
|
|
7642
|
+
const formatted = toolStatusLabelFormatter({
|
|
7643
|
+
toolName: toolStatusRow.toolName,
|
|
7644
|
+
callId: toolStatusRow.callId,
|
|
7645
|
+
status: toolStatusRow.status,
|
|
7646
|
+
args: toolStatusRow.args,
|
|
7647
|
+
defaultLabel: toolStatusRow.statusLabel
|
|
7648
|
+
});
|
|
7649
|
+
if (typeof formatted === "string" && formatted.trim().length > 0) {
|
|
7650
|
+
return formatted.trim();
|
|
7651
|
+
}
|
|
7652
|
+
} catch (_error) {
|
|
7653
|
+
}
|
|
7654
|
+
return toolStatusRow.statusLabel;
|
|
7655
|
+
},
|
|
7656
|
+
[toolStatusLabelFormatter]
|
|
7657
|
+
);
|
|
7564
7658
|
const renderMarkdownContent = (content, key) => {
|
|
7565
7659
|
if (!content || !content.trim()) return null;
|
|
7566
7660
|
if (markdownClass) {
|
|
@@ -7591,7 +7685,21 @@ ${traceSummary}` : traceSummary;
|
|
|
7591
7685
|
key,
|
|
7592
7686
|
className: `ai-chat-tool-status-row ai-chat-tool-status-row--${toolStatusRow.status}`
|
|
7593
7687
|
},
|
|
7594
|
-
/* @__PURE__ */ import_react14.default.createElement(
|
|
7688
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
7689
|
+
Tooltip,
|
|
7690
|
+
{
|
|
7691
|
+
content: /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement("div", null, toolStatusRow.toolName), /* @__PURE__ */ import_react14.default.createElement("div", null, formatToolCallId(toolStatusRow.callId))),
|
|
7692
|
+
side: "top",
|
|
7693
|
+
delay: 150
|
|
7694
|
+
},
|
|
7695
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-tool-status-row__main", title: `${toolStatusRow.toolName} ${toolStatusRow.callId}` }, /* @__PURE__ */ import_react14.default.createElement(ToolIcon, null), /* @__PURE__ */ import_react14.default.createElement(
|
|
7696
|
+
"span",
|
|
7697
|
+
{
|
|
7698
|
+
className: `ai-chat-tool-status-row__label ${toolStatusRow.status === "pending" || toolStatusRow.status === "running" ? "ai-chat-tool-status-row__label--shimmer" : ""}`
|
|
7699
|
+
},
|
|
7700
|
+
resolveToolStatusLabel(toolStatusRow)
|
|
7701
|
+
))
|
|
7702
|
+
),
|
|
7595
7703
|
toolStatusRow.status === "pending" && /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-tool-status-row__actions" }, /* @__PURE__ */ import_react14.default.createElement(
|
|
7596
7704
|
Button,
|
|
7597
7705
|
{
|
|
@@ -7685,7 +7793,8 @@ ${traceSummary}` : traceSummary;
|
|
|
7685
7793
|
toolName: marker.toolName,
|
|
7686
7794
|
callId: marker.callId,
|
|
7687
7795
|
status: "running",
|
|
7688
|
-
statusLabel: `tool call ${marker.toolName} running
|
|
7796
|
+
statusLabel: `tool call ${marker.toolName} running`,
|
|
7797
|
+
args: void 0
|
|
7689
7798
|
};
|
|
7690
7799
|
if (matchedRow) {
|
|
7691
7800
|
pendingBySignature.delete(matchedRow.signature);
|
|
@@ -7775,6 +7884,7 @@ ${traceSummary}` : traceSummary;
|
|
|
7775
7884
|
const entryToolCalls = Array.isArray(entry.toolCalls) ? entry.toolCalls : [];
|
|
7776
7885
|
const entryToolResponses = Array.isArray(entry.toolResponses) ? entry.toolResponses : [];
|
|
7777
7886
|
entryToolCalls.forEach((toolCall, toolIndex) => {
|
|
7887
|
+
var _a2, _b, _c;
|
|
7778
7888
|
const toolName = String((toolCall == null ? void 0 : toolCall.name) || "").trim() || "tool";
|
|
7779
7889
|
const callId = String((toolCall == null ? void 0 : toolCall.id) || "").trim() || `${toolName}-${toolIndex + 1}`;
|
|
7780
7890
|
const signature = getToolCallSignature(toolName, callId) || `completed-${prompt}-${toolIndex}-${toolName}-${callId}`;
|
|
@@ -7785,11 +7895,15 @@ ${traceSummary}` : traceSummary;
|
|
|
7785
7895
|
toolName,
|
|
7786
7896
|
callId,
|
|
7787
7897
|
status: isError ? "error" : "completed",
|
|
7788
|
-
statusLabel: isError ? `tool call ${toolName} errored` : `tool call ${toolName} completed
|
|
7898
|
+
statusLabel: isError ? `tool call ${toolName} errored` : `tool call ${toolName} completed`,
|
|
7899
|
+
args: parseToolArguments(
|
|
7900
|
+
(_c = (_b = (_a2 = toolCall == null ? void 0 : toolCall.input) != null ? _a2 : toolCall == null ? void 0 : toolCall.args) != null ? _b : toolCall == null ? void 0 : toolCall.arguments) != null ? _c : {}
|
|
7901
|
+
) || void 0
|
|
7789
7902
|
});
|
|
7790
7903
|
});
|
|
7791
7904
|
if (isLastEntry && !justReset) {
|
|
7792
7905
|
pendingToolRequests.forEach((request, requestIndex) => {
|
|
7906
|
+
var _a2, _b;
|
|
7793
7907
|
const toolName = String((request == null ? void 0 : request.toolName) || "").trim() || "tool";
|
|
7794
7908
|
const callId = String((request == null ? void 0 : request.callId) || "").trim() || `${toolName}-pending-${requestIndex + 1}`;
|
|
7795
7909
|
const signature = getToolCallSignature(toolName, callId) || `pending-${prompt}-${requestIndex}-${toolName}-${callId}`;
|
|
@@ -7798,7 +7912,8 @@ ${traceSummary}` : traceSummary;
|
|
|
7798
7912
|
toolName,
|
|
7799
7913
|
callId,
|
|
7800
7914
|
status: "pending",
|
|
7801
|
-
statusLabel: `tool call ${toolName} awaiting approval
|
|
7915
|
+
statusLabel: `tool call ${toolName} awaiting approval`,
|
|
7916
|
+
args: parseToolArguments((_b = (_a2 = request == null ? void 0 : request.groups) == null ? void 0 : _a2[2]) != null ? _b : "{}") || void 0
|
|
7802
7917
|
});
|
|
7803
7918
|
});
|
|
7804
7919
|
activeToolCalls.forEach((activeToolCall, activeIndex) => {
|
|
@@ -7810,7 +7925,8 @@ ${traceSummary}` : traceSummary;
|
|
|
7810
7925
|
toolName,
|
|
7811
7926
|
callId,
|
|
7812
7927
|
status: "running",
|
|
7813
|
-
statusLabel: `tool call ${toolName} running
|
|
7928
|
+
statusLabel: `tool call ${toolName} running`,
|
|
7929
|
+
args: activeToolCall == null ? void 0 : activeToolCall.args
|
|
7814
7930
|
});
|
|
7815
7931
|
});
|
|
7816
7932
|
}
|
|
@@ -8054,7 +8170,10 @@ ${traceSummary}` : traceSummary;
|
|
|
8054
8170
|
placeholder,
|
|
8055
8171
|
isBusy: isLoading || !idle,
|
|
8056
8172
|
onSubmit: continueChat,
|
|
8173
|
+
onQueueSubmit: handleQueuePrompt,
|
|
8057
8174
|
onStop: handleStop,
|
|
8175
|
+
queuedPrompts,
|
|
8176
|
+
onClearQueuedPrompt: handleClearQueuedPrompt,
|
|
8058
8177
|
agentOptions,
|
|
8059
8178
|
currentAgentId,
|
|
8060
8179
|
onAgentChange,
|
|
@@ -8753,7 +8872,8 @@ var ChatPanelWrapper = ({
|
|
|
8753
8872
|
resolveMcpAuthHeaders,
|
|
8754
8873
|
localToolExecutors,
|
|
8755
8874
|
traceContextMode,
|
|
8756
|
-
autoApproveTools
|
|
8875
|
+
autoApproveTools,
|
|
8876
|
+
toolStatusLabelFormatter
|
|
8757
8877
|
}) => {
|
|
8758
8878
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
8759
8879
|
const convAgentProfile = getAgent(activeConv.agentId);
|
|
@@ -8869,7 +8989,8 @@ var ChatPanelWrapper = ({
|
|
|
8869
8989
|
resolveMcpAuthHeaders,
|
|
8870
8990
|
localToolExecutors,
|
|
8871
8991
|
traceContextMode,
|
|
8872
|
-
autoApproveTools
|
|
8992
|
+
autoApproveTools,
|
|
8993
|
+
toolStatusLabelFormatter
|
|
8873
8994
|
}
|
|
8874
8995
|
)
|
|
8875
8996
|
);
|
|
@@ -8956,7 +9077,8 @@ var AIAgentPanel = import_react16.default.forwardRef(({
|
|
|
8956
9077
|
resolveMcpAuthHeaders,
|
|
8957
9078
|
localToolExecutors,
|
|
8958
9079
|
traceContextMode = "standard",
|
|
8959
|
-
autoApproveTools
|
|
9080
|
+
autoApproveTools,
|
|
9081
|
+
toolStatusLabelFormatter
|
|
8960
9082
|
}, ref) => {
|
|
8961
9083
|
var _a, _b, _c, _d;
|
|
8962
9084
|
(0, import_react16.useEffect)(() => {
|
|
@@ -10287,7 +10409,8 @@ var AIAgentPanel = import_react16.default.forwardRef(({
|
|
|
10287
10409
|
resolveMcpAuthHeaders,
|
|
10288
10410
|
localToolExecutors,
|
|
10289
10411
|
traceContextMode,
|
|
10290
|
-
autoApproveTools
|
|
10412
|
+
autoApproveTools,
|
|
10413
|
+
toolStatusLabelFormatter
|
|
10291
10414
|
}
|
|
10292
10415
|
)), loadingConversationId && /* @__PURE__ */ import_react16.default.createElement("div", { className: "ai-agent-panel__conversation-loading-overlay" }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ import_react16.default.createElement("p", null, "Loading conversation...")), currentAgentMetadata && activeConversationsList.length === 0 && !loadingConversationId && /* @__PURE__ */ import_react16.default.createElement("div", { className: "ai-agent-panel__empty-chat" }, /* @__PURE__ */ import_react16.default.createElement(MessageIcon, null), /* @__PURE__ */ import_react16.default.createElement("p", null, "Select a conversation or start a new one"), /* @__PURE__ */ import_react16.default.createElement(Button, { variant: "default", size: "sm", onClick: handleNewConversation }, "New Conversation")), agentsLoading && !currentAgentMetadata && /* @__PURE__ */ import_react16.default.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ import_react16.default.createElement("p", null, "Loading agent..."))),
|
|
10293
10416
|
/* @__PURE__ */ import_react16.default.createElement(
|