@talk2view/sdk 0.3.3 → 0.5.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/event-emitter.d.ts +7 -0
- package/dist/event-emitter.d.ts.map +1 -0
- package/dist/event-emitter.js +23 -0
- package/dist/event-emitter.js.map +1 -0
- package/dist/index.d.ts +76 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -1
- package/dist/index.js.map +1 -1
- package/dist/react/T2VProvider.js +1 -1
- package/dist/react/T2VProvider.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/useT2VChat.d.ts +6 -22
- package/dist/react/useT2VChat.d.ts.map +1 -1
- package/dist/react/useT2VChat.js +34 -218
- package/dist/react/useT2VChat.js.map +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/sessions.js +3 -0
- package/dist/sessions.js.map +1 -1
- package/dist/tools.d.ts +5 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +16 -2
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/components/ApprovalCard.d.ts +10 -0
- package/dist/ui/components/ApprovalCard.d.ts.map +1 -0
- package/dist/ui/components/ApprovalCard.js +60 -0
- package/dist/ui/components/ApprovalCard.js.map +1 -0
- package/dist/ui/components/{T2VChatHeader.d.ts → ChatHeader.d.ts} +4 -4
- package/dist/ui/components/ChatHeader.d.ts.map +1 -0
- package/dist/ui/components/ChatHeader.js +126 -0
- package/dist/ui/components/ChatHeader.js.map +1 -0
- package/dist/ui/components/ChatPanel.d.ts +9 -0
- package/dist/ui/components/ChatPanel.d.ts.map +1 -0
- package/dist/ui/components/ChatPanel.js +37 -0
- package/dist/ui/components/ChatPanel.js.map +1 -0
- package/dist/ui/components/ChatWidget.d.ts +5 -0
- package/dist/ui/components/ChatWidget.d.ts.map +1 -0
- package/dist/ui/components/ChatWidget.js +27 -0
- package/dist/ui/components/ChatWidget.js.map +1 -0
- package/dist/ui/components/CodeBlock.d.ts +6 -0
- package/dist/ui/components/CodeBlock.d.ts.map +1 -0
- package/dist/ui/components/CodeBlock.js +79 -0
- package/dist/ui/components/CodeBlock.js.map +1 -0
- package/dist/ui/components/Composer.d.ts +14 -0
- package/dist/ui/components/Composer.d.ts.map +1 -0
- package/dist/ui/components/Composer.js +172 -0
- package/dist/ui/components/Composer.js.map +1 -0
- package/dist/ui/components/LoginForm.d.ts +5 -0
- package/dist/ui/components/LoginForm.d.ts.map +1 -0
- package/dist/ui/components/LoginForm.js +37 -0
- package/dist/ui/components/LoginForm.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +5 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +28 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/MessageActions.d.ts +6 -0
- package/dist/ui/components/MessageActions.d.ts.map +1 -0
- package/dist/ui/components/MessageActions.js +43 -0
- package/dist/ui/components/MessageActions.js.map +1 -0
- package/dist/ui/components/MessageBubble.d.ts +16 -0
- package/dist/ui/components/MessageBubble.d.ts.map +1 -0
- package/dist/ui/components/MessageBubble.js +71 -0
- package/dist/ui/components/MessageBubble.js.map +1 -0
- package/dist/ui/components/MessageList.d.ts +10 -0
- package/dist/ui/components/MessageList.d.ts.map +1 -0
- package/dist/ui/components/MessageList.js +69 -0
- package/dist/ui/components/MessageList.js.map +1 -0
- package/dist/ui/components/SettingsPanel.d.ts +11 -0
- package/dist/ui/components/SettingsPanel.d.ts.map +1 -0
- package/dist/ui/components/{SettingsView.js → SettingsPanel.js} +27 -27
- package/dist/ui/components/SettingsPanel.js.map +1 -0
- package/dist/ui/components/Shimmer.d.ts +2 -0
- package/dist/ui/components/Shimmer.d.ts.map +1 -0
- package/dist/ui/components/Shimmer.js +10 -0
- package/dist/ui/components/Shimmer.js.map +1 -0
- package/dist/ui/components/Talk2View.d.ts +21 -0
- package/dist/ui/components/Talk2View.d.ts.map +1 -0
- package/dist/ui/components/Talk2View.js +79 -0
- package/dist/ui/components/Talk2View.js.map +1 -0
- package/dist/ui/components/ThinkingBlock.d.ts +7 -0
- package/dist/ui/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/ui/components/ThinkingBlock.js +64 -0
- package/dist/ui/components/ThinkingBlock.js.map +1 -0
- package/dist/ui/components/ToolDisplay.d.ts +28 -0
- package/dist/ui/components/ToolDisplay.d.ts.map +1 -0
- package/dist/ui/components/ToolDisplay.js +123 -0
- package/dist/ui/components/ToolDisplay.js.map +1 -0
- package/dist/ui/components/WelcomeScreen.d.ts +6 -0
- package/dist/ui/components/WelcomeScreen.d.ts.map +1 -0
- package/dist/ui/components/WelcomeScreen.js +18 -0
- package/dist/ui/components/WelcomeScreen.js.map +1 -0
- package/dist/ui/context.d.ts +29 -0
- package/dist/ui/context.d.ts.map +1 -0
- package/dist/ui/context.js +16 -0
- package/dist/ui/context.js.map +1 -0
- package/dist/ui/index.d.ts +24 -37
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +23 -35
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/styles.d.ts +2 -0
- package/dist/ui/styles.d.ts.map +1 -0
- package/dist/ui/styles.js +91 -0
- package/dist/ui/styles.js.map +1 -0
- package/dist/ui/theme.d.ts +11 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +70 -0
- package/dist/ui/theme.js.map +1 -0
- package/package.json +3 -10
- package/dist/ui/components/LoginModal.d.ts +0 -10
- package/dist/ui/components/LoginModal.d.ts.map +0 -1
- package/dist/ui/components/LoginModal.js +0 -138
- package/dist/ui/components/LoginModal.js.map +0 -1
- package/dist/ui/components/SettingsView.d.ts +0 -11
- package/dist/ui/components/SettingsView.d.ts.map +0 -1
- package/dist/ui/components/SettingsView.js.map +0 -1
- package/dist/ui/components/T2VAssistantModal.d.ts +0 -31
- package/dist/ui/components/T2VAssistantModal.d.ts.map +0 -1
- package/dist/ui/components/T2VAssistantModal.js +0 -151
- package/dist/ui/components/T2VAssistantModal.js.map +0 -1
- package/dist/ui/components/T2VAssistantProvider.d.ts +0 -42
- package/dist/ui/components/T2VAssistantProvider.d.ts.map +0 -1
- package/dist/ui/components/T2VAssistantProvider.js +0 -66
- package/dist/ui/components/T2VAssistantProvider.js.map +0 -1
- package/dist/ui/components/T2VChatHeader.d.ts.map +0 -1
- package/dist/ui/components/T2VChatHeader.js +0 -112
- package/dist/ui/components/T2VChatHeader.js.map +0 -1
- package/dist/ui/components/T2VComposer.d.ts +0 -11
- package/dist/ui/components/T2VComposer.d.ts.map +0 -1
- package/dist/ui/components/T2VComposer.js +0 -124
- package/dist/ui/components/T2VComposer.js.map +0 -1
- package/dist/ui/components/T2VDictationAdapter.d.ts +0 -18
- package/dist/ui/components/T2VDictationAdapter.d.ts.map +0 -1
- package/dist/ui/components/T2VDictationAdapter.js +0 -126
- package/dist/ui/components/T2VDictationAdapter.js.map +0 -1
- package/dist/ui/components/T2VLoginGate.d.ts +0 -23
- package/dist/ui/components/T2VLoginGate.d.ts.map +0 -1
- package/dist/ui/components/T2VLoginGate.js +0 -11
- package/dist/ui/components/T2VLoginGate.js.map +0 -1
- package/dist/ui/components/T2VThread.d.ts +0 -25
- package/dist/ui/components/T2VThread.d.ts.map +0 -1
- package/dist/ui/components/T2VThread.js +0 -66
- package/dist/ui/components/T2VThread.js.map +0 -1
- package/dist/ui/components/T2VToolFallback.d.ts +0 -11
- package/dist/ui/components/T2VToolFallback.d.ts.map +0 -1
- package/dist/ui/components/T2VToolFallback.js +0 -209
- package/dist/ui/components/T2VToolFallback.js.map +0 -1
- package/dist/ui/runtime/convertMessage.d.ts +0 -17
- package/dist/ui/runtime/convertMessage.d.ts.map +0 -1
- package/dist/ui/runtime/convertMessage.js +0 -77
- package/dist/ui/runtime/convertMessage.js.map +0 -1
- package/dist/ui/runtime/useT2VRuntime.d.ts +0 -42
- package/dist/ui/runtime/useT2VRuntime.d.ts.map +0 -1
- package/dist/ui/runtime/useT2VRuntime.js +0 -62
- package/dist/ui/runtime/useT2VRuntime.js.map +0 -1
- package/dist/ui/themes/tailwind-preset.d.ts +0 -43
- package/dist/ui/themes/tailwind-preset.d.ts.map +0 -1
- package/dist/ui/themes/tailwind-preset.js +0 -43
- package/dist/ui/themes/tailwind-preset.js.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
+
import { T2VProvider, useT2V } from '../../react/T2VProvider';
|
|
4
|
+
import { useUserPreferences } from '../../react/useUserPreferences';
|
|
5
|
+
import { usePartnerConfig } from '../../react/usePartnerConfig';
|
|
6
|
+
import { Talk2ViewContext, ChatContext } from '../context';
|
|
7
|
+
import { injectTheme, injectFonts } from '../theme';
|
|
8
|
+
import { injectComponentStyles } from '../styles';
|
|
9
|
+
/**
|
|
10
|
+
* Root provider for Talk2View UI components.
|
|
11
|
+
*
|
|
12
|
+
* Wraps the internal T2VProvider (so hooks like usePartnerConfig, useUserPreferences work)
|
|
13
|
+
* and adds the new Talk2ViewContext + ChatContext for the rebuilt UI layer.
|
|
14
|
+
*/
|
|
15
|
+
export function Talk2View({ partnerKey, baseUrl, model, systemPrompt, tools, theme, debug, children }) {
|
|
16
|
+
return (_jsx(T2VProvider, { partnerKey: partnerKey, baseUrl: baseUrl, model: model, debug: debug, children: _jsx(InnerProvider, { systemPrompt: systemPrompt, tools: tools, theme: theme, children: children }) }));
|
|
17
|
+
}
|
|
18
|
+
function InnerProvider({ systemPrompt, tools, theme, children, }) {
|
|
19
|
+
// Get the t2v instance from T2VProvider (single source of truth)
|
|
20
|
+
const { t2v, user, isAuthenticated } = useT2V();
|
|
21
|
+
const { preferences } = useUserPreferences();
|
|
22
|
+
const { config: partnerConfig } = usePartnerConfig();
|
|
23
|
+
// Resolve model: user preference > Talk2View prop > partner config default
|
|
24
|
+
const resolvedModel = preferences.model || t2v.config.model || partnerConfig?.default_llm_model || undefined;
|
|
25
|
+
// Inject theme + fonts + component styles
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
injectTheme(theme ?? {});
|
|
28
|
+
injectFonts();
|
|
29
|
+
injectComponentStyles();
|
|
30
|
+
}, [theme]);
|
|
31
|
+
// Register tools
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!tools || tools.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
const schemas = tools.map((tool) => {
|
|
36
|
+
const { execute: _execute, ...schema } = tool;
|
|
37
|
+
return schema;
|
|
38
|
+
});
|
|
39
|
+
t2v.tools.register(schemas).catch(() => { });
|
|
40
|
+
for (const tool of tools) {
|
|
41
|
+
if ('execute' in tool && tool.execute) {
|
|
42
|
+
t2v.tools.handle(tool.name, tool.execute);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [t2v, tools]);
|
|
46
|
+
// Chat state synced from Talk2View events
|
|
47
|
+
const [messages, setMessages] = useState(t2v.messages);
|
|
48
|
+
const [isLoading, setIsLoading] = useState(t2v.isLoading);
|
|
49
|
+
const [error, setError] = useState(t2v.error);
|
|
50
|
+
const [pendingApproval, setPendingApproval] = useState(t2v.pendingApproval);
|
|
51
|
+
const [agentStatus, setAgentStatus] = useState(null);
|
|
52
|
+
const [threadId, setThreadId] = useState(t2v.threadId);
|
|
53
|
+
const [alwaysAllowedTools, setAlwaysAllowedTools] = useState(t2v.alwaysAllowedTools);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const unsubs = [
|
|
56
|
+
t2v.on('messagesChange', setMessages),
|
|
57
|
+
t2v.on('loadingChange', setIsLoading),
|
|
58
|
+
t2v.on('errorChange', setError),
|
|
59
|
+
t2v.on('approvalChange', setPendingApproval),
|
|
60
|
+
t2v.on('statusChange', (s) => setAgentStatus(s ? { status: s.type, message: s.message } : null)),
|
|
61
|
+
t2v.on('threadIdChange', setThreadId),
|
|
62
|
+
t2v.on('alwaysAllowedChange', setAlwaysAllowedTools),
|
|
63
|
+
];
|
|
64
|
+
return () => unsubs.forEach((u) => u());
|
|
65
|
+
}, [t2v]);
|
|
66
|
+
const sendMessage = useCallback((content) => t2v.sendMessage(content, { systemPrompt, model: resolvedModel }), [t2v, systemPrompt, resolvedModel]);
|
|
67
|
+
const approveToolCall = useCallback((d) => t2v.approveToolCall(d), [t2v]);
|
|
68
|
+
const retryLastMessage = useCallback(() => t2v.retryLastMessage(), [t2v]);
|
|
69
|
+
const clearMessages = useCallback(() => t2v.clearMessages(), [t2v]);
|
|
70
|
+
const clearError = useCallback(() => t2v.clearError(), [t2v]);
|
|
71
|
+
const t2vValue = useMemo(() => ({ t2v, user, isAuthenticated }), [t2v, user, isAuthenticated]);
|
|
72
|
+
const chatValue = useMemo(() => ({
|
|
73
|
+
messages, isLoading, error, pendingApproval, agentStatus, threadId, alwaysAllowedTools,
|
|
74
|
+
sendMessage, approveToolCall, retryLastMessage, clearMessages, clearError,
|
|
75
|
+
}), [messages, isLoading, error, pendingApproval, agentStatus, threadId, alwaysAllowedTools,
|
|
76
|
+
sendMessage, approveToolCall, retryLastMessage, clearMessages, clearError]);
|
|
77
|
+
return (_jsx(Talk2ViewContext.Provider, { value: t2vValue, children: _jsx(ChatContext.Provider, { value: chatValue, children: _jsx("div", { "data-talk2view": "", style: { fontFamily: 'var(--t2v-font)', color: 'var(--t2v-foreground)' }, children: children }) }) }));
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=Talk2View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Talk2View.js","sourceRoot":"","sources":["../../../src/ui/components/Talk2View.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAA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EAAE,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,uBAAuB,EAAE,YAC5F,QAAQ,GACL,GACe,GACG,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ThinkingBlockProps {
|
|
2
|
+
content: string;
|
|
3
|
+
isStreaming?: boolean;
|
|
4
|
+
startTime?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function ThinkingBlock({ content, isStreaming, startTime }: ThinkingBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ThinkingBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThinkingBlock.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ThinkingBlock.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CA2EpF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { Brain, ChevronDown } from 'lucide-react';
|
|
4
|
+
import { Shimmer } from './Shimmer';
|
|
5
|
+
import { MarkdownRenderer } from './MarkdownRenderer';
|
|
6
|
+
export function ThinkingBlock({ content, isStreaming, startTime }) {
|
|
7
|
+
const [expanded, setExpanded] = useState(true);
|
|
8
|
+
const [duration, setDuration] = useState(null);
|
|
9
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
10
|
+
const intervalRef = useRef(null);
|
|
11
|
+
const contentRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (isStreaming && startTime) {
|
|
14
|
+
intervalRef.current = setInterval(() => {
|
|
15
|
+
setDuration(Math.round((Date.now() - startTime) / 1000));
|
|
16
|
+
}, 1000);
|
|
17
|
+
return () => { if (intervalRef.current)
|
|
18
|
+
clearInterval(intervalRef.current); };
|
|
19
|
+
}
|
|
20
|
+
else if (!isStreaming && startTime) {
|
|
21
|
+
if (intervalRef.current)
|
|
22
|
+
clearInterval(intervalRef.current);
|
|
23
|
+
setDuration(Math.round((Date.now() - startTime) / 1000));
|
|
24
|
+
}
|
|
25
|
+
}, [isStreaming, startTime]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!isStreaming && content) {
|
|
28
|
+
const timer = setTimeout(() => setExpanded(false), 500);
|
|
29
|
+
return () => clearTimeout(timer);
|
|
30
|
+
}
|
|
31
|
+
}, [isStreaming, content]);
|
|
32
|
+
// ResizeObserver to track inner content height for smooth max-height transition
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const el = contentRef.current;
|
|
35
|
+
if (!el)
|
|
36
|
+
return;
|
|
37
|
+
const ro = new ResizeObserver((entries) => {
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
setContentHeight(entry.contentRect.height);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
ro.observe(el);
|
|
43
|
+
return () => ro.disconnect();
|
|
44
|
+
}, []);
|
|
45
|
+
const durationText = duration !== null ? `${duration}s` : '';
|
|
46
|
+
return (_jsxs("div", { style: {
|
|
47
|
+
border: '1px solid var(--t2v-border)', borderRadius: 'calc(var(--t2v-radius) * 0.5px)',
|
|
48
|
+
overflow: 'hidden', margin: '6px 0', fontFamily: 'var(--t2v-font)',
|
|
49
|
+
}, children: [_jsxs("button", { onClick: () => setExpanded(!expanded), className: "t2v-btn-ghost", style: {
|
|
50
|
+
width: '100%', display: 'flex', alignItems: 'center', gap: '8px',
|
|
51
|
+
padding: '8px 12px', border: 'none', background: 'var(--t2v-surface)',
|
|
52
|
+
cursor: 'pointer', fontFamily: 'var(--t2v-font)', fontSize: '12px',
|
|
53
|
+
color: 'var(--t2v-muted)', fontWeight: 500,
|
|
54
|
+
}, children: [_jsx(Brain, { size: 14 }), _jsx("span", { style: { flex: 1, textAlign: 'left' }, children: isStreaming ? 'Thinking...' : `Thought for ${durationText}` }), _jsx("span", { style: { display: 'inline-flex', transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)', transition: 'transform 0.2s' }, children: _jsx(ChevronDown, { size: 12 }) })] }), _jsx("div", { style: {
|
|
55
|
+
maxHeight: expanded ? `${contentHeight}px` : '0px',
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
transition: 'max-height 0.2s ease-out',
|
|
58
|
+
}, children: _jsx("div", { ref: contentRef, style: {
|
|
59
|
+
padding: '8px 12px', fontSize: '13px', lineHeight: 1.5,
|
|
60
|
+
color: 'var(--t2v-muted)', borderTop: '1px solid var(--t2v-border)',
|
|
61
|
+
maxHeight: '200px', overflowY: 'auto',
|
|
62
|
+
}, children: isStreaming && !content ? _jsx(Shimmer, {}) : _jsx(MarkdownRenderer, { content: content }) }) })] }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=ThinkingBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThinkingBlock.js","sourceRoot":"","sources":["../../../src/ui/components/ThinkingBlock.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQtD,MAAM,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAsB;IACnF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAA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8
|
+
* ToolDisplay — compact single-line tool step, expandable to show args/result.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ToolDisplay({ name, status, args, result }: ToolDisplayProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export interface ToolStepGroupProps {
|
|
12
|
+
steps: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
status: 'used' | 'denied' | 'running';
|
|
15
|
+
args?: Record<string, unknown>;
|
|
16
|
+
result?: string;
|
|
17
|
+
}>;
|
|
18
|
+
isStreaming?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* ToolStepGroup — wraps multiple tool steps into a collapsible group.
|
|
22
|
+
*
|
|
23
|
+
* While streaming or any tool is running → expanded (shows individual items).
|
|
24
|
+
* After all tools complete → auto-collapses to summary line.
|
|
25
|
+
* Single completed step → renders as standalone ToolDisplay.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ToolStepGroup({ steps, isStreaming }: ToolStepGroupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
28
|
+
//# sourceMappingURL=ToolDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolDisplay.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ToolDisplay.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAkD3E;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,kBAAkB,kDAgFvE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* ToolDisplay — compact single-line tool step, expandable to show args/result.
|
|
5
|
+
*/
|
|
6
|
+
export function ToolDisplay({ name, status, args, result }) {
|
|
7
|
+
const [expanded, setExpanded] = useState(false);
|
|
8
|
+
const hasDetails = (args && Object.keys(args).length > 0) || result;
|
|
9
|
+
return (_jsxs("div", { style: { fontSize: 12 }, children: [_jsxs("button", { onClick: () => hasDetails && setExpanded(!expanded), style: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: 6,
|
|
13
|
+
width: '100%',
|
|
14
|
+
background: 'none',
|
|
15
|
+
border: 'none',
|
|
16
|
+
padding: '3px 0',
|
|
17
|
+
cursor: hasDetails ? 'pointer' : 'default',
|
|
18
|
+
fontFamily: 'var(--t2v-font-mono, monospace)',
|
|
19
|
+
fontSize: 12,
|
|
20
|
+
color: 'var(--t2v-muted, #9F9AA4)',
|
|
21
|
+
textAlign: 'left',
|
|
22
|
+
}, "aria-expanded": hasDetails ? expanded : undefined, children: [_jsx(StatusIcon, { status: status }), _jsx("span", { style: { flex: 1 }, children: name }), hasDetails && _jsx(ChevronIcon, { rotated: expanded })] }), expanded && hasDetails && (_jsxs("div", { style: {
|
|
23
|
+
marginLeft: 20,
|
|
24
|
+
paddingLeft: 8,
|
|
25
|
+
borderLeft: '2px solid var(--t2v-border, #E5E7EB)',
|
|
26
|
+
fontSize: 11,
|
|
27
|
+
fontFamily: 'var(--t2v-font-mono, monospace)',
|
|
28
|
+
color: 'var(--t2v-muted, #9F9AA4)',
|
|
29
|
+
}, children: [args && Object.keys(args).length > 0 && (_jsx(DetailSection, { label: "PARAMS", content: formatJson(args) })), result && (_jsx(DetailSection, { label: "RESULT", content: formatResult(result) }))] }))] }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ToolStepGroup — wraps multiple tool steps into a collapsible group.
|
|
33
|
+
*
|
|
34
|
+
* While streaming or any tool is running → expanded (shows individual items).
|
|
35
|
+
* After all tools complete → auto-collapses to summary line.
|
|
36
|
+
* Single completed step → renders as standalone ToolDisplay.
|
|
37
|
+
*/
|
|
38
|
+
export function ToolStepGroup({ steps, isStreaming }) {
|
|
39
|
+
const hasRunning = steps.some((s) => s.status === 'running');
|
|
40
|
+
const autoExpanded = hasRunning || !!isStreaming;
|
|
41
|
+
const [userToggle, setUserToggle] = React.useState(null);
|
|
42
|
+
const prevAutoRef = React.useRef(autoExpanded);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
if (prevAutoRef.current && !autoExpanded) {
|
|
45
|
+
setUserToggle(null);
|
|
46
|
+
}
|
|
47
|
+
prevAutoRef.current = autoExpanded;
|
|
48
|
+
}, [autoExpanded]);
|
|
49
|
+
if (steps.length === 0)
|
|
50
|
+
return null;
|
|
51
|
+
if (steps.length === 1 && !hasRunning) {
|
|
52
|
+
const s = steps[0];
|
|
53
|
+
return (_jsx("div", { style: { padding: '2px 0' }, children: _jsx(ToolDisplay, { name: s.name, status: s.status, args: s.args, result: s.result }) }));
|
|
54
|
+
}
|
|
55
|
+
const expanded = userToggle !== null ? userToggle : autoExpanded;
|
|
56
|
+
const completedCount = steps.filter((s) => s.status === 'used').length;
|
|
57
|
+
const deniedCount = steps.filter((s) => s.status === 'denied').length;
|
|
58
|
+
const runningStep = steps.find((s) => s.status === 'running');
|
|
59
|
+
let summaryText;
|
|
60
|
+
if (runningStep) {
|
|
61
|
+
summaryText = `Running ${runningStep.name}...`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const parts = [];
|
|
65
|
+
if (completedCount > 0)
|
|
66
|
+
parts.push(`${completedCount} completed`);
|
|
67
|
+
if (deniedCount > 0)
|
|
68
|
+
parts.push(`${deniedCount} denied`);
|
|
69
|
+
summaryText = `${steps.length} tool calls — ${parts.join(', ')}`;
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs("div", { style: { padding: '2px 0' }, children: [_jsxs("button", { onClick: () => setUserToggle(expanded ? false : true), style: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
gap: 6,
|
|
75
|
+
width: '100%',
|
|
76
|
+
background: 'none',
|
|
77
|
+
border: 'none',
|
|
78
|
+
padding: '4px 0',
|
|
79
|
+
cursor: 'pointer',
|
|
80
|
+
fontSize: 12,
|
|
81
|
+
fontFamily: 'var(--t2v-font-mono, monospace)',
|
|
82
|
+
color: 'var(--t2v-muted, #9F9AA4)',
|
|
83
|
+
textAlign: 'left',
|
|
84
|
+
}, "aria-expanded": expanded, children: [_jsx(StatusIcon, { status: runningStep ? 'running' : 'used' }), _jsx("span", { style: { flex: 1 }, children: summaryText }), _jsx(ChevronIcon, { rotated: expanded })] }), expanded && (_jsx("div", { style: {
|
|
85
|
+
marginLeft: 6,
|
|
86
|
+
paddingLeft: 8,
|
|
87
|
+
borderLeft: '2px solid var(--t2v-border, #E5E7EB)',
|
|
88
|
+
}, children: steps.map((step, i) => (_jsx(ToolDisplay, { name: step.name, status: step.status, args: step.args, result: step.result }, i))) }))] }));
|
|
89
|
+
}
|
|
90
|
+
// ── Shared sub-components ──
|
|
91
|
+
function StatusIcon({ status }) {
|
|
92
|
+
const size = 14;
|
|
93
|
+
if (status === 'running') {
|
|
94
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "var(--t2v-accent, #40D4B6)", strokeWidth: 2.5, strokeLinecap: "round", style: { animation: 't2v-spin 1s linear infinite', flexShrink: 0 }, children: _jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }));
|
|
95
|
+
}
|
|
96
|
+
if (status === 'denied') {
|
|
97
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "var(--t2v-error, #DC2626)", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
|
|
98
|
+
}
|
|
99
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "var(--t2v-accent, #40D4B6)", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }));
|
|
100
|
+
}
|
|
101
|
+
function ChevronIcon({ rotated }) {
|
|
102
|
+
return (_jsx("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", style: { transition: 'transform 150ms ease', transform: rotated ? 'rotate(180deg)' : 'rotate(0deg)' }, children: _jsx("polyline", { points: "6 9 12 15 18 9" }) }));
|
|
103
|
+
}
|
|
104
|
+
function DetailSection({ label, content }) {
|
|
105
|
+
return (_jsxs("div", { style: { marginBottom: 4 }, children: [_jsx("div", { style: { fontWeight: 600, marginBottom: 2 }, children: label }), _jsx("pre", { style: { margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word', maxHeight: 150, overflow: 'auto' }, children: content })] }));
|
|
106
|
+
}
|
|
107
|
+
function formatJson(obj) {
|
|
108
|
+
try {
|
|
109
|
+
return JSON.stringify(obj, null, 2);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return String(obj);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function formatResult(result) {
|
|
116
|
+
try {
|
|
117
|
+
return JSON.stringify(JSON.parse(result), null, 2);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=ToolDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolDisplay.js","sourceRoot":"","sources":["../../../src/ui/components/ToolDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAW,MAAM,OAAO,CAAC;AASjD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAoB;IAC1E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC;IAEpE,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,aAC1B,kBACE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,IAAI,WAAW,CAAC,CAAC,QAAQ,CAAC,EACnD,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;oBACpB,GAAG,EAAE,CAAC;oBACN,KAAK,EAAE,MAAM;oBACb,UAAU,EAAE,MAAM;oBAClB,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,OAAO;oBAChB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;oBAC1C,UAAU,EAAE,iCAAiC;oBAC7C,QAAQ,EAAE,EAAE;oBACZ,KAAK,EAAE,2BAA2B;oBAClC,SAAS,EAAE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AY,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,YACzG,OAAO,GACJ,IACF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,GAA4B;IAC9C,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAAC,CAAC;IAC5C,MAAM,CAAC;QAAC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAAC,CAAC;AAC/B,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAAC,CAAC;IAC3D,MAAM,CAAC;QAAC,OAAO,MAAM,CAAC;IAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeScreen.d.ts","sourceRoot":"","sources":["../../../src/ui/components/WelcomeScreen.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,kBAAkB,2CA2BzE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChat } from '../context';
|
|
3
|
+
import { LOGOS } from '../theme';
|
|
4
|
+
export function WelcomeScreen({ heading, suggestions }) {
|
|
5
|
+
const { sendMessage } = useChat();
|
|
6
|
+
return (_jsxs("div", { style: {
|
|
7
|
+
flex: 1, display: 'flex', flexDirection: 'column',
|
|
8
|
+
alignItems: 'center', justifyContent: 'center',
|
|
9
|
+
padding: '24px 20px', gap: '20px', textAlign: 'center',
|
|
10
|
+
}, children: [_jsx("img", { src: LOGOS.icon, alt: "", style: { width: 40, height: 40, opacity: 0.7 } }), _jsx("h2", { style: { fontSize: '16px', fontWeight: 600, color: 'var(--t2v-foreground)', margin: 0, fontFamily: 'var(--t2v-font)' }, children: heading ?? 'How can I help you?' }), suggestions && suggestions.length > 0 && (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px', width: '100%', maxWidth: '280px' }, children: suggestions.map((s, i) => (_jsx("button", { onClick: () => { sendMessage(s).catch(() => { }); }, className: "t2v-btn-ghost", style: {
|
|
11
|
+
padding: '10px 14px', borderRadius: 'calc(var(--t2v-radius) * 0.75px)',
|
|
12
|
+
border: '1px solid var(--t2v-border)', background: 'var(--t2v-bg)',
|
|
13
|
+
cursor: 'pointer', fontFamily: 'var(--t2v-font)', fontSize: '13px',
|
|
14
|
+
color: 'var(--t2v-foreground)', textAlign: 'left', lineHeight: 1.4,
|
|
15
|
+
transition: 'border-color 0.15s',
|
|
16
|
+
}, children: s }, i))) }))] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=WelcomeScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeScreen.js","sourceRoot":"","sources":["../../../src/ui/components/WelcomeScreen.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAOjC,MAAM,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAsB;IACxE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;IAClC,OAAO,CACL,eAAK,KAAK,EAAE;YACV,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ;YACjD,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ;YAC9C,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE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@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Talk2View as Talk2ViewClass } from '../index';
|
|
2
|
+
import type { User, DisplayMessage, PendingApproval, HumanDecision } from '../types';
|
|
3
|
+
export interface Talk2ViewContextValue {
|
|
4
|
+
t2v: Talk2ViewClass;
|
|
5
|
+
user: User | null;
|
|
6
|
+
isAuthenticated: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ChatContextValue {
|
|
9
|
+
messages: DisplayMessage[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
error: string | null;
|
|
12
|
+
pendingApproval: PendingApproval | null;
|
|
13
|
+
agentStatus: {
|
|
14
|
+
status: string;
|
|
15
|
+
message: string;
|
|
16
|
+
} | null;
|
|
17
|
+
threadId: string | null;
|
|
18
|
+
alwaysAllowedTools: ReadonlySet<string>;
|
|
19
|
+
sendMessage: (content: string) => Promise<void>;
|
|
20
|
+
approveToolCall: (decision: HumanDecision) => Promise<void>;
|
|
21
|
+
retryLastMessage: () => Promise<void>;
|
|
22
|
+
clearMessages: () => void;
|
|
23
|
+
clearError: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const Talk2ViewContext: import("react").Context<Talk2ViewContextValue | null>;
|
|
26
|
+
export declare const ChatContext: import("react").Context<ChatContextValue | null>;
|
|
27
|
+
export declare function useTalk2View(): Talk2ViewContextValue;
|
|
28
|
+
export declare function useChat(): ChatContextValue;
|
|
29
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/ui/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAErF,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,eAAe,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,uDAAoD,CAAC;AAClF,eAAO,MAAM,WAAW,kDAA+C,CAAC;AAExE,wBAAgB,YAAY,IAAI,qBAAqB,CAIpD;AAED,wBAAgB,OAAO,IAAI,gBAAgB,CAI1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const Talk2ViewContext = createContext(null);
|
|
3
|
+
export const ChatContext = createContext(null);
|
|
4
|
+
export function useTalk2View() {
|
|
5
|
+
const ctx = useContext(Talk2ViewContext);
|
|
6
|
+
if (!ctx)
|
|
7
|
+
throw new Error('useTalk2View must be used within <Talk2View>');
|
|
8
|
+
return ctx;
|
|
9
|
+
}
|
|
10
|
+
export function useChat() {
|
|
11
|
+
const ctx = useContext(ChatContext);
|
|
12
|
+
if (!ctx)
|
|
13
|
+
throw new Error('useChat must be used within <Talk2View>');
|
|
14
|
+
return ctx;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/ui/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAyBlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAA0B,IAAI,CAAC,CAAC;AAExE,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACzC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC1E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACrE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export { T2VToolFallback } from './components/T2VToolFallback';
|
|
26
|
-
export { T2VComposer } from './components/T2VComposer';
|
|
27
|
-
export { T2VChatHeader } from './components/T2VChatHeader';
|
|
28
|
-
export { useT2VRuntime } from './runtime/useT2VRuntime';
|
|
29
|
-
export { T2VDictationAdapter } from './components/T2VDictationAdapter';
|
|
30
|
-
export { convertDisplayMessage } from './runtime/convertMessage';
|
|
31
|
-
export { t2vPreset } from './themes/tailwind-preset';
|
|
32
|
-
export type { T2VAssistantProviderProps } from './components/T2VAssistantProvider';
|
|
33
|
-
export type { T2VThreadProps } from './components/T2VThread';
|
|
34
|
-
export type { T2VAssistantModalProps } from './components/T2VAssistantModal';
|
|
35
|
-
export type { T2VLoginGateProps } from './components/T2VLoginGate';
|
|
36
|
-
export type { T2VChatHeaderProps } from './components/T2VChatHeader';
|
|
37
|
-
export type { UseT2VRuntimeOptions } from './runtime/useT2VRuntime';
|
|
1
|
+
export { Talk2View } from './components/Talk2View';
|
|
2
|
+
export type { Talk2ViewProps } from './components/Talk2View';
|
|
3
|
+
export { ChatPanel } from './components/ChatPanel';
|
|
4
|
+
export type { ChatPanelProps } from './components/ChatPanel';
|
|
5
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
6
|
+
export type { ChatWidgetProps } from './components/ChatWidget';
|
|
7
|
+
export { useChat, useTalk2View } from './context';
|
|
8
|
+
export type { ChatContextValue, Talk2ViewContextValue } from './context';
|
|
9
|
+
export { MessageList } from './components/MessageList';
|
|
10
|
+
export { MessageBubble } from './components/MessageBubble';
|
|
11
|
+
export { Composer } from './components/Composer';
|
|
12
|
+
export { WelcomeScreen } from './components/WelcomeScreen';
|
|
13
|
+
export { LoginForm } from './components/LoginForm';
|
|
14
|
+
export { ChatHeader } from './components/ChatHeader';
|
|
15
|
+
export { SettingsPanel } from './components/SettingsPanel';
|
|
16
|
+
export { ApprovalCard } from './components/ApprovalCard';
|
|
17
|
+
export { ToolDisplay, ToolStepGroup } from './components/ToolDisplay';
|
|
18
|
+
export type { ToolDisplayProps, ToolStepGroupProps } from './components/ToolDisplay';
|
|
19
|
+
export { MarkdownRenderer } from './components/MarkdownRenderer';
|
|
20
|
+
export { CodeBlock } from './components/CodeBlock';
|
|
21
|
+
export { ThinkingBlock } from './components/ThinkingBlock';
|
|
22
|
+
export { MessageActions } from './components/MessageActions';
|
|
23
|
+
export { Shimmer } from './components/Shimmer';
|
|
24
|
+
export { THEME_DEFAULTS, LOGOS } from './theme';
|
|
38
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
export { T2VAssistantModal } from './components/T2VAssistantModal';
|
|
25
|
-
export { T2VLoginGate } from './components/T2VLoginGate';
|
|
26
|
-
export { T2VToolFallback } from './components/T2VToolFallback';
|
|
27
|
-
export { T2VComposer } from './components/T2VComposer';
|
|
28
|
-
export { T2VChatHeader } from './components/T2VChatHeader';
|
|
29
|
-
// ── Hooks ──
|
|
30
|
-
export { useT2VRuntime } from './runtime/useT2VRuntime';
|
|
31
|
-
// ── Adapters ──
|
|
32
|
-
export { T2VDictationAdapter } from './components/T2VDictationAdapter';
|
|
33
|
-
// ── Utilities ──
|
|
34
|
-
export { convertDisplayMessage } from './runtime/convertMessage';
|
|
35
|
-
export { t2vPreset } from './themes/tailwind-preset';
|
|
1
|
+
// Components
|
|
2
|
+
export { Talk2View } from './components/Talk2View';
|
|
3
|
+
export { ChatPanel } from './components/ChatPanel';
|
|
4
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
5
|
+
// Context hooks (for advanced custom UI)
|
|
6
|
+
export { useChat, useTalk2View } from './context';
|
|
7
|
+
// Individual components (for composition)
|
|
8
|
+
export { MessageList } from './components/MessageList';
|
|
9
|
+
export { MessageBubble } from './components/MessageBubble';
|
|
10
|
+
export { Composer } from './components/Composer';
|
|
11
|
+
export { WelcomeScreen } from './components/WelcomeScreen';
|
|
12
|
+
export { LoginForm } from './components/LoginForm';
|
|
13
|
+
export { ChatHeader } from './components/ChatHeader';
|
|
14
|
+
export { SettingsPanel } from './components/SettingsPanel';
|
|
15
|
+
export { ApprovalCard } from './components/ApprovalCard';
|
|
16
|
+
export { ToolDisplay, ToolStepGroup } from './components/ToolDisplay';
|
|
17
|
+
export { MarkdownRenderer } from './components/MarkdownRenderer';
|
|
18
|
+
export { CodeBlock } from './components/CodeBlock';
|
|
19
|
+
export { ThinkingBlock } from './components/ThinkingBlock';
|
|
20
|
+
export { MessageActions } from './components/MessageActions';
|
|
21
|
+
export { Shimmer } from './components/Shimmer';
|
|
22
|
+
// Theme
|
|
23
|
+
export { THEME_DEFAULTS, LOGOS } from './theme';
|
|
36
24
|
//# sourceMappingURL=index.js.map
|
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC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