@optilogic/chat 1.3.4 → 1.3.5
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.cjs +49 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -1
- package/dist/index.d.ts +90 -1
- package/dist/index.js +49 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/agent-response/AgentResponse.tsx +63 -1
- package/src/components/agent-response/components/ActionBar.tsx +15 -0
- package/src/components/agent-response/components/ActivityIndicators.tsx +27 -1
- package/src/components/agent-response/components/MetadataRow.tsx +20 -0
- package/src/components/agent-response/index.ts +5 -1
- package/src/components/user-prompt-input/UserPromptInput.tsx +3 -0
- package/src/components/user-prompt-input/types.ts +13 -0
- package/src/index.ts +2 -0
package/dist/index.d.cts
CHANGED
|
@@ -332,6 +332,41 @@ interface AgentResponseClassNames {
|
|
|
332
332
|
/** Classes for the response content section (background, padding) */
|
|
333
333
|
response?: string;
|
|
334
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Tour anchors (`data-tour` attribute values) to attach to specific elements
|
|
337
|
+
* inside an AgentResponse so a tour or test harness can target them.
|
|
338
|
+
*
|
|
339
|
+
* Each value, when provided, is rendered as `data-tour={value}` on the
|
|
340
|
+
* corresponding element. Omit a field to skip stamping the attribute on that
|
|
341
|
+
* element. Pair with the matching CSS selector form:
|
|
342
|
+
*
|
|
343
|
+
* <AgentResponse anchors={{ copyAction: "chat-action-copy" }} />
|
|
344
|
+
* // selector: '[data-tour="chat-action-copy"]'
|
|
345
|
+
*
|
|
346
|
+
* This is the standard convention in the @optilogic component library for
|
|
347
|
+
* threading tour IDs into elements that are rendered by internal
|
|
348
|
+
* sub-components and not otherwise reachable from the caller.
|
|
349
|
+
*/
|
|
350
|
+
interface AgentResponseAnchors {
|
|
351
|
+
/** Status updates popover trigger in the metadata row (live status indicator). */
|
|
352
|
+
statusUpdate?: string;
|
|
353
|
+
/** Thinking expand/collapse toggle button in the metadata row. */
|
|
354
|
+
thinkingToggle?: string;
|
|
355
|
+
/** Thinking section content panel (when expanded). */
|
|
356
|
+
thinkingSection?: string;
|
|
357
|
+
/** Tool calls popover trigger in the metadata row. */
|
|
358
|
+
toolCalls?: string;
|
|
359
|
+
/** Knowledge popover trigger in the metadata row. */
|
|
360
|
+
knowledge?: string;
|
|
361
|
+
/** Memory popover trigger in the metadata row. */
|
|
362
|
+
memory?: string;
|
|
363
|
+
/** Copy button in the action bar. */
|
|
364
|
+
copyAction?: string;
|
|
365
|
+
/** Thumbs up button in the action bar. */
|
|
366
|
+
thumbsUp?: string;
|
|
367
|
+
/** Thumbs down button in the action bar. */
|
|
368
|
+
thumbsDown?: string;
|
|
369
|
+
}
|
|
335
370
|
interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
336
371
|
/** The response state to render */
|
|
337
372
|
state: AgentResponseState;
|
|
@@ -418,6 +453,21 @@ interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
418
453
|
* />
|
|
419
454
|
*/
|
|
420
455
|
classNames?: AgentResponseClassNames;
|
|
456
|
+
/**
|
|
457
|
+
* Tour anchors threaded into internal sub-components. See
|
|
458
|
+
* {@link AgentResponseAnchors} for the available element keys.
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* <AgentResponse
|
|
462
|
+
* state={state}
|
|
463
|
+
* anchors={{
|
|
464
|
+
* copyAction: "chat-action-copy",
|
|
465
|
+
* thumbsUp: "chat-action-thumbs-up",
|
|
466
|
+
* thumbsDown: "chat-action-thumbs-down",
|
|
467
|
+
* }}
|
|
468
|
+
* />
|
|
469
|
+
*/
|
|
470
|
+
anchors?: AgentResponseAnchors;
|
|
421
471
|
}
|
|
422
472
|
/**
|
|
423
473
|
* AgentResponse Component
|
|
@@ -468,6 +518,14 @@ interface ActivityIndicatorsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
468
518
|
memory: MemoryItem[];
|
|
469
519
|
/** Status updates to display */
|
|
470
520
|
statusUpdates?: StatusItem[];
|
|
521
|
+
/** Tour anchor (`data-tour`) on the status updates popover trigger. */
|
|
522
|
+
statusUpdateAnchor?: string;
|
|
523
|
+
/** Tour anchor (`data-tour`) on the tool calls popover trigger. */
|
|
524
|
+
toolCallsAnchor?: string;
|
|
525
|
+
/** Tour anchor (`data-tour`) on the knowledge popover trigger. */
|
|
526
|
+
knowledgeAnchor?: string;
|
|
527
|
+
/** Tour anchor (`data-tour`) on the memory popover trigger. */
|
|
528
|
+
memoryAnchor?: string;
|
|
471
529
|
}
|
|
472
530
|
/**
|
|
473
531
|
* ActivityIndicators Component
|
|
@@ -511,6 +569,16 @@ interface MetadataRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
511
569
|
status: AgentResponseStatus;
|
|
512
570
|
/** Elapsed time in seconds */
|
|
513
571
|
elapsedTime: number;
|
|
572
|
+
/** Tour anchor (`data-tour`) on the thinking expand/collapse toggle button. */
|
|
573
|
+
thinkingToggleAnchor?: string;
|
|
574
|
+
/** Tour anchor forwarded to the status updates popover trigger inside ActivityIndicators. */
|
|
575
|
+
statusUpdateAnchor?: string;
|
|
576
|
+
/** Tour anchor forwarded to the tool calls popover trigger inside ActivityIndicators. */
|
|
577
|
+
toolCallsAnchor?: string;
|
|
578
|
+
/** Tour anchor forwarded to the knowledge popover trigger inside ActivityIndicators. */
|
|
579
|
+
knowledgeAnchor?: string;
|
|
580
|
+
/** Tour anchor forwarded to the memory popover trigger inside ActivityIndicators. */
|
|
581
|
+
memoryAnchor?: string;
|
|
514
582
|
}
|
|
515
583
|
/**
|
|
516
584
|
* MetadataRow Component
|
|
@@ -591,6 +659,15 @@ interface ActionBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
591
659
|
onFeedbackChange?: (feedback: FeedbackValue) => void;
|
|
592
660
|
/** Callback when response is copied */
|
|
593
661
|
onResponseCopy?: (response: string) => void;
|
|
662
|
+
/**
|
|
663
|
+
* Tour anchor (rendered as `data-tour`) on the copy button.
|
|
664
|
+
* Use with the `data-tour` convention to target this button from a tour step.
|
|
665
|
+
*/
|
|
666
|
+
copyAnchor?: string;
|
|
667
|
+
/** Tour anchor (`data-tour`) on the thumbs up button. */
|
|
668
|
+
thumbsUpAnchor?: string;
|
|
669
|
+
/** Tour anchor (`data-tour`) on the thumbs down button. */
|
|
670
|
+
thumbsDownAnchor?: string;
|
|
594
671
|
}
|
|
595
672
|
/**
|
|
596
673
|
* ActionBar Component
|
|
@@ -873,6 +950,18 @@ interface UserPromptInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
873
950
|
onTagCreate?: (tag: string) => void;
|
|
874
951
|
/** Callback when a tag is deleted */
|
|
875
952
|
onTagDelete?: (tag: string) => void;
|
|
953
|
+
/** Tour anchors threaded onto internal sub-elements. */
|
|
954
|
+
anchors?: UserPromptInputAnchors;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Tour anchors (`data-tour` attribute values) for elements inside the
|
|
958
|
+
* UserPromptInput that the caller cannot otherwise reach.
|
|
959
|
+
*/
|
|
960
|
+
interface UserPromptInputAnchors {
|
|
961
|
+
/** Send button (rendered when not submitting). */
|
|
962
|
+
sendButton?: string;
|
|
963
|
+
/** Stop button (rendered while submitting if `onStop` is provided). */
|
|
964
|
+
stopButton?: string;
|
|
876
965
|
}
|
|
877
966
|
interface UserPromptInputRef {
|
|
878
967
|
/** Focus the editor */
|
|
@@ -979,4 +1068,4 @@ declare function parseResponseSegments(text: string): ResponseSegment[];
|
|
|
979
1068
|
*/
|
|
980
1069
|
declare const INLINE_ACTION_PROMPT = "\n<inline_actions>\nWhen your response should include interactive components (like query viewers,\ndata tables, or executable actions), embed them as fenced code blocks using\nthe `json:action` language tag:\n\n```json:action\n{\n \"type\": \"action-type-here\",\n ...action-specific fields\n}\n```\n\nRules:\n- Each block must contain valid JSON with a \"type\" field.\n- The \"type\" must match a registered action component on the frontend.\n- Multiple action blocks per response are allowed.\n- Surround action blocks with normal markdown text for user context.\n- The action block is rendered as an interactive component in the chat UI.\n- SQL strings inside JSON must be properly escaped (newlines as \\n, quotes as \\\").\n\nAvailable action types:\n\n- \"optimap-query\": Displays SQL queries with a button to execute them and\n update the 3D globe map.\n Required fields:\n - type: \"optimap-query\"\n - locations_sql: string (the validated locations SQL query)\n - routes_sql: string (the validated routes SQL query)\n - database_name: string (the target database name)\n</inline_actions>\n";
|
|
981
1070
|
|
|
982
|
-
export { ActionBar, type ActionBarProps, type ActionComponentRegistry, ActionMarkdownRenderer, type ActionMarkdownRendererProps, type ActionSegment, ActivityIndicators, type ActivityIndicatorsProps, type AgentMessage, AgentResponse, type AgentResponseProps, type AgentResponseState, type AgentResponseStatus, type AgentRun, AgentTimeline, type DisplayEntry, type FeedbackValue, type GenericWebSocketMessage, type HITLInteraction, HITLInteractionRecord, type HITLInteractionRecordProps, type HITLQuestion, HITLQuestionPanel, type HITLQuestionPanelProps, type HITLResponseData, HITLSection, type HITLSectionProps, INLINE_ACTION_PROMPT, type InlineActionProps, type KnowledgeItem, type MarkdownSegment, type MemoryItem, MetadataRow, type MetadataRowProps, type PotentialResponse, type ResponseSegment, type StatusItem, type ThinkingContent, ThinkingSection, type ThinkingSectionProps, type ThinkingStep, type TimelineEntry, type TimelineEntryType, type TimelineUIState, type ToolCall, TruncatedMessage, type TruncatedMessageProps, type UseAgentResponseAccumulatorOptions, type UseAgentResponseAccumulatorReturn, type UseThinkingTimerOptions, UserPrompt, UserPromptInput, type UserPromptInputProps, type UserPromptInputRef, type UserPromptProps, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, reduceAgentMessage, useAgentResponseAccumulator, useThinkingTimer };
|
|
1071
|
+
export { ActionBar, type ActionBarProps, type ActionComponentRegistry, ActionMarkdownRenderer, type ActionMarkdownRendererProps, type ActionSegment, ActivityIndicators, type ActivityIndicatorsProps, type AgentMessage, AgentResponse, type AgentResponseAnchors, type AgentResponseClassNames, type AgentResponseProps, type AgentResponseState, type AgentResponseStatus, type AgentRun, AgentTimeline, type DisplayEntry, type FeedbackValue, type GenericWebSocketMessage, type HITLInteraction, HITLInteractionRecord, type HITLInteractionRecordProps, type HITLQuestion, HITLQuestionPanel, type HITLQuestionPanelProps, type HITLResponseData, HITLSection, type HITLSectionProps, INLINE_ACTION_PROMPT, type InlineActionProps, type KnowledgeItem, type MarkdownSegment, type MemoryItem, MetadataRow, type MetadataRowProps, type PotentialResponse, type ResponseSegment, type StatusItem, type ThinkingContent, ThinkingSection, type ThinkingSectionProps, type ThinkingStep, type TimelineEntry, type TimelineEntryType, type TimelineUIState, type ToolCall, TruncatedMessage, type TruncatedMessageProps, type UseAgentResponseAccumulatorOptions, type UseAgentResponseAccumulatorReturn, type UseThinkingTimerOptions, UserPrompt, UserPromptInput, type UserPromptInputProps, type UserPromptInputRef, type UserPromptProps, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, reduceAgentMessage, useAgentResponseAccumulator, useThinkingTimer };
|
package/dist/index.d.ts
CHANGED
|
@@ -332,6 +332,41 @@ interface AgentResponseClassNames {
|
|
|
332
332
|
/** Classes for the response content section (background, padding) */
|
|
333
333
|
response?: string;
|
|
334
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Tour anchors (`data-tour` attribute values) to attach to specific elements
|
|
337
|
+
* inside an AgentResponse so a tour or test harness can target them.
|
|
338
|
+
*
|
|
339
|
+
* Each value, when provided, is rendered as `data-tour={value}` on the
|
|
340
|
+
* corresponding element. Omit a field to skip stamping the attribute on that
|
|
341
|
+
* element. Pair with the matching CSS selector form:
|
|
342
|
+
*
|
|
343
|
+
* <AgentResponse anchors={{ copyAction: "chat-action-copy" }} />
|
|
344
|
+
* // selector: '[data-tour="chat-action-copy"]'
|
|
345
|
+
*
|
|
346
|
+
* This is the standard convention in the @optilogic component library for
|
|
347
|
+
* threading tour IDs into elements that are rendered by internal
|
|
348
|
+
* sub-components and not otherwise reachable from the caller.
|
|
349
|
+
*/
|
|
350
|
+
interface AgentResponseAnchors {
|
|
351
|
+
/** Status updates popover trigger in the metadata row (live status indicator). */
|
|
352
|
+
statusUpdate?: string;
|
|
353
|
+
/** Thinking expand/collapse toggle button in the metadata row. */
|
|
354
|
+
thinkingToggle?: string;
|
|
355
|
+
/** Thinking section content panel (when expanded). */
|
|
356
|
+
thinkingSection?: string;
|
|
357
|
+
/** Tool calls popover trigger in the metadata row. */
|
|
358
|
+
toolCalls?: string;
|
|
359
|
+
/** Knowledge popover trigger in the metadata row. */
|
|
360
|
+
knowledge?: string;
|
|
361
|
+
/** Memory popover trigger in the metadata row. */
|
|
362
|
+
memory?: string;
|
|
363
|
+
/** Copy button in the action bar. */
|
|
364
|
+
copyAction?: string;
|
|
365
|
+
/** Thumbs up button in the action bar. */
|
|
366
|
+
thumbsUp?: string;
|
|
367
|
+
/** Thumbs down button in the action bar. */
|
|
368
|
+
thumbsDown?: string;
|
|
369
|
+
}
|
|
335
370
|
interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
336
371
|
/** The response state to render */
|
|
337
372
|
state: AgentResponseState;
|
|
@@ -418,6 +453,21 @@ interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
418
453
|
* />
|
|
419
454
|
*/
|
|
420
455
|
classNames?: AgentResponseClassNames;
|
|
456
|
+
/**
|
|
457
|
+
* Tour anchors threaded into internal sub-components. See
|
|
458
|
+
* {@link AgentResponseAnchors} for the available element keys.
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* <AgentResponse
|
|
462
|
+
* state={state}
|
|
463
|
+
* anchors={{
|
|
464
|
+
* copyAction: "chat-action-copy",
|
|
465
|
+
* thumbsUp: "chat-action-thumbs-up",
|
|
466
|
+
* thumbsDown: "chat-action-thumbs-down",
|
|
467
|
+
* }}
|
|
468
|
+
* />
|
|
469
|
+
*/
|
|
470
|
+
anchors?: AgentResponseAnchors;
|
|
421
471
|
}
|
|
422
472
|
/**
|
|
423
473
|
* AgentResponse Component
|
|
@@ -468,6 +518,14 @@ interface ActivityIndicatorsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
468
518
|
memory: MemoryItem[];
|
|
469
519
|
/** Status updates to display */
|
|
470
520
|
statusUpdates?: StatusItem[];
|
|
521
|
+
/** Tour anchor (`data-tour`) on the status updates popover trigger. */
|
|
522
|
+
statusUpdateAnchor?: string;
|
|
523
|
+
/** Tour anchor (`data-tour`) on the tool calls popover trigger. */
|
|
524
|
+
toolCallsAnchor?: string;
|
|
525
|
+
/** Tour anchor (`data-tour`) on the knowledge popover trigger. */
|
|
526
|
+
knowledgeAnchor?: string;
|
|
527
|
+
/** Tour anchor (`data-tour`) on the memory popover trigger. */
|
|
528
|
+
memoryAnchor?: string;
|
|
471
529
|
}
|
|
472
530
|
/**
|
|
473
531
|
* ActivityIndicators Component
|
|
@@ -511,6 +569,16 @@ interface MetadataRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
511
569
|
status: AgentResponseStatus;
|
|
512
570
|
/** Elapsed time in seconds */
|
|
513
571
|
elapsedTime: number;
|
|
572
|
+
/** Tour anchor (`data-tour`) on the thinking expand/collapse toggle button. */
|
|
573
|
+
thinkingToggleAnchor?: string;
|
|
574
|
+
/** Tour anchor forwarded to the status updates popover trigger inside ActivityIndicators. */
|
|
575
|
+
statusUpdateAnchor?: string;
|
|
576
|
+
/** Tour anchor forwarded to the tool calls popover trigger inside ActivityIndicators. */
|
|
577
|
+
toolCallsAnchor?: string;
|
|
578
|
+
/** Tour anchor forwarded to the knowledge popover trigger inside ActivityIndicators. */
|
|
579
|
+
knowledgeAnchor?: string;
|
|
580
|
+
/** Tour anchor forwarded to the memory popover trigger inside ActivityIndicators. */
|
|
581
|
+
memoryAnchor?: string;
|
|
514
582
|
}
|
|
515
583
|
/**
|
|
516
584
|
* MetadataRow Component
|
|
@@ -591,6 +659,15 @@ interface ActionBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
591
659
|
onFeedbackChange?: (feedback: FeedbackValue) => void;
|
|
592
660
|
/** Callback when response is copied */
|
|
593
661
|
onResponseCopy?: (response: string) => void;
|
|
662
|
+
/**
|
|
663
|
+
* Tour anchor (rendered as `data-tour`) on the copy button.
|
|
664
|
+
* Use with the `data-tour` convention to target this button from a tour step.
|
|
665
|
+
*/
|
|
666
|
+
copyAnchor?: string;
|
|
667
|
+
/** Tour anchor (`data-tour`) on the thumbs up button. */
|
|
668
|
+
thumbsUpAnchor?: string;
|
|
669
|
+
/** Tour anchor (`data-tour`) on the thumbs down button. */
|
|
670
|
+
thumbsDownAnchor?: string;
|
|
594
671
|
}
|
|
595
672
|
/**
|
|
596
673
|
* ActionBar Component
|
|
@@ -873,6 +950,18 @@ interface UserPromptInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
873
950
|
onTagCreate?: (tag: string) => void;
|
|
874
951
|
/** Callback when a tag is deleted */
|
|
875
952
|
onTagDelete?: (tag: string) => void;
|
|
953
|
+
/** Tour anchors threaded onto internal sub-elements. */
|
|
954
|
+
anchors?: UserPromptInputAnchors;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Tour anchors (`data-tour` attribute values) for elements inside the
|
|
958
|
+
* UserPromptInput that the caller cannot otherwise reach.
|
|
959
|
+
*/
|
|
960
|
+
interface UserPromptInputAnchors {
|
|
961
|
+
/** Send button (rendered when not submitting). */
|
|
962
|
+
sendButton?: string;
|
|
963
|
+
/** Stop button (rendered while submitting if `onStop` is provided). */
|
|
964
|
+
stopButton?: string;
|
|
876
965
|
}
|
|
877
966
|
interface UserPromptInputRef {
|
|
878
967
|
/** Focus the editor */
|
|
@@ -979,4 +1068,4 @@ declare function parseResponseSegments(text: string): ResponseSegment[];
|
|
|
979
1068
|
*/
|
|
980
1069
|
declare const INLINE_ACTION_PROMPT = "\n<inline_actions>\nWhen your response should include interactive components (like query viewers,\ndata tables, or executable actions), embed them as fenced code blocks using\nthe `json:action` language tag:\n\n```json:action\n{\n \"type\": \"action-type-here\",\n ...action-specific fields\n}\n```\n\nRules:\n- Each block must contain valid JSON with a \"type\" field.\n- The \"type\" must match a registered action component on the frontend.\n- Multiple action blocks per response are allowed.\n- Surround action blocks with normal markdown text for user context.\n- The action block is rendered as an interactive component in the chat UI.\n- SQL strings inside JSON must be properly escaped (newlines as \\n, quotes as \\\").\n\nAvailable action types:\n\n- \"optimap-query\": Displays SQL queries with a button to execute them and\n update the 3D globe map.\n Required fields:\n - type: \"optimap-query\"\n - locations_sql: string (the validated locations SQL query)\n - routes_sql: string (the validated routes SQL query)\n - database_name: string (the target database name)\n</inline_actions>\n";
|
|
981
1070
|
|
|
982
|
-
export { ActionBar, type ActionBarProps, type ActionComponentRegistry, ActionMarkdownRenderer, type ActionMarkdownRendererProps, type ActionSegment, ActivityIndicators, type ActivityIndicatorsProps, type AgentMessage, AgentResponse, type AgentResponseProps, type AgentResponseState, type AgentResponseStatus, type AgentRun, AgentTimeline, type DisplayEntry, type FeedbackValue, type GenericWebSocketMessage, type HITLInteraction, HITLInteractionRecord, type HITLInteractionRecordProps, type HITLQuestion, HITLQuestionPanel, type HITLQuestionPanelProps, type HITLResponseData, HITLSection, type HITLSectionProps, INLINE_ACTION_PROMPT, type InlineActionProps, type KnowledgeItem, type MarkdownSegment, type MemoryItem, MetadataRow, type MetadataRowProps, type PotentialResponse, type ResponseSegment, type StatusItem, type ThinkingContent, ThinkingSection, type ThinkingSectionProps, type ThinkingStep, type TimelineEntry, type TimelineEntryType, type TimelineUIState, type ToolCall, TruncatedMessage, type TruncatedMessageProps, type UseAgentResponseAccumulatorOptions, type UseAgentResponseAccumulatorReturn, type UseThinkingTimerOptions, UserPrompt, UserPromptInput, type UserPromptInputProps, type UserPromptInputRef, type UserPromptProps, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, reduceAgentMessage, useAgentResponseAccumulator, useThinkingTimer };
|
|
1071
|
+
export { ActionBar, type ActionBarProps, type ActionComponentRegistry, ActionMarkdownRenderer, type ActionMarkdownRendererProps, type ActionSegment, ActivityIndicators, type ActivityIndicatorsProps, type AgentMessage, AgentResponse, type AgentResponseAnchors, type AgentResponseClassNames, type AgentResponseProps, type AgentResponseState, type AgentResponseStatus, type AgentRun, AgentTimeline, type DisplayEntry, type FeedbackValue, type GenericWebSocketMessage, type HITLInteraction, HITLInteractionRecord, type HITLInteractionRecordProps, type HITLQuestion, HITLQuestionPanel, type HITLQuestionPanelProps, type HITLResponseData, HITLSection, type HITLSectionProps, INLINE_ACTION_PROMPT, type InlineActionProps, type KnowledgeItem, type MarkdownSegment, type MemoryItem, MetadataRow, type MetadataRowProps, type PotentialResponse, type ResponseSegment, type StatusItem, type ThinkingContent, ThinkingSection, type ThinkingSectionProps, type ThinkingStep, type TimelineEntry, type TimelineEntryType, type TimelineUIState, type ToolCall, TruncatedMessage, type TruncatedMessageProps, type UseAgentResponseAccumulatorOptions, type UseAgentResponseAccumulatorReturn, type UseThinkingTimerOptions, UserPrompt, UserPromptInput, type UserPromptInputProps, type UserPromptInputRef, type UserPromptProps, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, reduceAgentMessage, useAgentResponseAccumulator, useThinkingTimer };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,18 @@ import { SlateEditor, Text } from '@optilogic/editor';
|
|
|
7
7
|
|
|
8
8
|
// src/components/agent-response/AgentResponse.tsx
|
|
9
9
|
var ActivityIndicators = React11.forwardRef(
|
|
10
|
-
({
|
|
10
|
+
({
|
|
11
|
+
toolCalls,
|
|
12
|
+
knowledge,
|
|
13
|
+
memory,
|
|
14
|
+
statusUpdates = [],
|
|
15
|
+
statusUpdateAnchor,
|
|
16
|
+
toolCallsAnchor,
|
|
17
|
+
knowledgeAnchor,
|
|
18
|
+
memoryAnchor,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
11
22
|
const hasAnyActivity = toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0 || statusUpdates.length > 0;
|
|
12
23
|
if (!hasAnyActivity) return null;
|
|
13
24
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("flex items-center gap-2", className), ...props, children: [
|
|
@@ -15,6 +26,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
15
26
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
16
27
|
"button",
|
|
17
28
|
{
|
|
29
|
+
"data-tour": statusUpdateAnchor,
|
|
18
30
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
19
31
|
onClick: (e) => e.stopPropagation(),
|
|
20
32
|
children: [
|
|
@@ -35,6 +47,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
35
47
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
36
48
|
"button",
|
|
37
49
|
{
|
|
50
|
+
"data-tour": toolCallsAnchor,
|
|
38
51
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
39
52
|
onClick: (e) => e.stopPropagation(),
|
|
40
53
|
children: [
|
|
@@ -55,6 +68,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
55
68
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
56
69
|
"button",
|
|
57
70
|
{
|
|
71
|
+
"data-tour": knowledgeAnchor,
|
|
58
72
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
59
73
|
onClick: (e) => e.stopPropagation(),
|
|
60
74
|
children: [
|
|
@@ -75,6 +89,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
75
89
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
76
90
|
"button",
|
|
77
91
|
{
|
|
92
|
+
"data-tour": memoryAnchor,
|
|
78
93
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
79
94
|
onClick: (e) => e.stopPropagation(),
|
|
80
95
|
children: [
|
|
@@ -137,6 +152,11 @@ var MetadataRow = React11.forwardRef(
|
|
|
137
152
|
statusContent,
|
|
138
153
|
status,
|
|
139
154
|
elapsedTime,
|
|
155
|
+
thinkingToggleAnchor,
|
|
156
|
+
statusUpdateAnchor,
|
|
157
|
+
toolCallsAnchor,
|
|
158
|
+
knowledgeAnchor,
|
|
159
|
+
memoryAnchor,
|
|
140
160
|
className,
|
|
141
161
|
...props
|
|
142
162
|
}, ref) => {
|
|
@@ -172,6 +192,7 @@ var MetadataRow = React11.forwardRef(
|
|
|
172
192
|
hasThinking ? /* @__PURE__ */ jsx(
|
|
173
193
|
"button",
|
|
174
194
|
{
|
|
195
|
+
"data-tour": thinkingToggleAnchor,
|
|
175
196
|
onClick: onToggle,
|
|
176
197
|
className: "flex items-center gap-1.5 hover:bg-muted/50 -ml-1.5 pl-1.5 pr-2 py-0.5 rounded transition-colors shrink-0",
|
|
177
198
|
children: leftContent
|
|
@@ -184,7 +205,11 @@ var MetadataRow = React11.forwardRef(
|
|
|
184
205
|
toolCalls,
|
|
185
206
|
knowledge,
|
|
186
207
|
memory,
|
|
187
|
-
statusUpdates
|
|
208
|
+
statusUpdates,
|
|
209
|
+
statusUpdateAnchor,
|
|
210
|
+
toolCallsAnchor,
|
|
211
|
+
knowledgeAnchor,
|
|
212
|
+
memoryAnchor
|
|
188
213
|
}
|
|
189
214
|
)
|
|
190
215
|
]
|
|
@@ -255,6 +280,9 @@ var ActionBar = React11.forwardRef(
|
|
|
255
280
|
feedback,
|
|
256
281
|
onFeedbackChange,
|
|
257
282
|
onResponseCopy,
|
|
283
|
+
copyAnchor,
|
|
284
|
+
thumbsUpAnchor,
|
|
285
|
+
thumbsDownAnchor,
|
|
258
286
|
className,
|
|
259
287
|
...props
|
|
260
288
|
}, ref) => {
|
|
@@ -295,6 +323,7 @@ var ActionBar = React11.forwardRef(
|
|
|
295
323
|
/* @__PURE__ */ jsx(
|
|
296
324
|
"button",
|
|
297
325
|
{
|
|
326
|
+
"data-tour": copyAnchor,
|
|
298
327
|
onClick: handleCopy,
|
|
299
328
|
className: "p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",
|
|
300
329
|
title: copied ? "Copied!" : "Copy response",
|
|
@@ -304,6 +333,7 @@ var ActionBar = React11.forwardRef(
|
|
|
304
333
|
/* @__PURE__ */ jsx(
|
|
305
334
|
"button",
|
|
306
335
|
{
|
|
336
|
+
"data-tour": thumbsUpAnchor,
|
|
307
337
|
onClick: handleThumbsUp,
|
|
308
338
|
className: cn(
|
|
309
339
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -316,6 +346,7 @@ var ActionBar = React11.forwardRef(
|
|
|
316
346
|
/* @__PURE__ */ jsx(
|
|
317
347
|
"button",
|
|
318
348
|
{
|
|
349
|
+
"data-tour": thumbsDownAnchor,
|
|
319
350
|
onClick: handleThumbsDown,
|
|
320
351
|
className: cn(
|
|
321
352
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -1329,6 +1360,7 @@ var AgentResponse = React11.forwardRef(
|
|
|
1329
1360
|
renderThinkingMarkdown,
|
|
1330
1361
|
timelineMaxHeight,
|
|
1331
1362
|
classNames,
|
|
1363
|
+
anchors,
|
|
1332
1364
|
className,
|
|
1333
1365
|
...props
|
|
1334
1366
|
}, ref) => {
|
|
@@ -1387,10 +1419,15 @@ var AgentResponse = React11.forwardRef(
|
|
|
1387
1419
|
statusUpdates: state.statusUpdates,
|
|
1388
1420
|
statusContent,
|
|
1389
1421
|
status: state.status,
|
|
1390
|
-
elapsedTime
|
|
1422
|
+
elapsedTime,
|
|
1423
|
+
thinkingToggleAnchor: anchors?.thinkingToggle,
|
|
1424
|
+
statusUpdateAnchor: anchors?.statusUpdate,
|
|
1425
|
+
toolCallsAnchor: anchors?.toolCalls,
|
|
1426
|
+
knowledgeAnchor: anchors?.knowledge,
|
|
1427
|
+
memoryAnchor: anchors?.memory
|
|
1391
1428
|
}
|
|
1392
1429
|
),
|
|
1393
|
-
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsx("div", { className: "pb-3 border-t border-border", children: /* @__PURE__ */ jsx(
|
|
1430
|
+
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsx("div", { className: "pb-3 border-t border-border", "data-tour": anchors?.thinkingSection, children: /* @__PURE__ */ jsx(
|
|
1394
1431
|
AgentTimeline,
|
|
1395
1432
|
{
|
|
1396
1433
|
entries: state.timelineEntries,
|
|
@@ -1401,6 +1438,7 @@ var AgentResponse = React11.forwardRef(
|
|
|
1401
1438
|
) }) : /* @__PURE__ */ jsx(
|
|
1402
1439
|
ThinkingSection,
|
|
1403
1440
|
{
|
|
1441
|
+
"data-tour": anchors?.thinkingSection,
|
|
1404
1442
|
content: state.thinkingSteps && state.thinkingSteps.length > 0 ? state.thinkingSteps : state.thinking,
|
|
1405
1443
|
isExpanded: thinkingExpanded,
|
|
1406
1444
|
renderMarkdown: renderThinkingMarkdown
|
|
@@ -1434,7 +1472,10 @@ var AgentResponse = React11.forwardRef(
|
|
|
1434
1472
|
totalTimeSeconds,
|
|
1435
1473
|
feedback,
|
|
1436
1474
|
onFeedbackChange,
|
|
1437
|
-
onResponseCopy
|
|
1475
|
+
onResponseCopy,
|
|
1476
|
+
copyAnchor: anchors?.copyAction,
|
|
1477
|
+
thumbsUpAnchor: anchors?.thumbsUp,
|
|
1478
|
+
thumbsDownAnchor: anchors?.thumbsDown
|
|
1438
1479
|
}
|
|
1439
1480
|
)
|
|
1440
1481
|
]
|
|
@@ -1564,6 +1605,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1564
1605
|
enableTags = false,
|
|
1565
1606
|
onTagCreate,
|
|
1566
1607
|
onTagDelete,
|
|
1608
|
+
anchors,
|
|
1567
1609
|
className,
|
|
1568
1610
|
...props
|
|
1569
1611
|
}, ref) => {
|
|
@@ -1683,6 +1725,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1683
1725
|
isSubmitting && onStop ? /* @__PURE__ */ jsx(Tooltip, { content: stopTooltip, disabled: !stopTooltip, children: /* @__PURE__ */ jsx(
|
|
1684
1726
|
IconButton,
|
|
1685
1727
|
{
|
|
1728
|
+
"data-tour": anchors?.stopButton,
|
|
1686
1729
|
icon: /* @__PURE__ */ jsx(Square, {}),
|
|
1687
1730
|
variant: "filled",
|
|
1688
1731
|
size: "sm",
|
|
@@ -1693,6 +1736,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1693
1736
|
) }) : /* @__PURE__ */ jsx(
|
|
1694
1737
|
IconButton,
|
|
1695
1738
|
{
|
|
1739
|
+
"data-tour": anchors?.sendButton,
|
|
1696
1740
|
icon: isSubmitting ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Send, {}),
|
|
1697
1741
|
variant: "filled",
|
|
1698
1742
|
size: "sm",
|