teodor-new-chat-ui 4.3.398 → 4.3.400
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/features/checkpoint/components/TimelineColumn.d.ts +12 -0
- package/dist/features/checkpoint/components/index.d.ts +1 -0
- package/dist/{hooks/checkpoints → features/checkpoint/hooks}/index.d.ts +0 -1
- package/dist/{hooks/checkpoints → features/checkpoint/hooks}/useCheckpointIndex.d.ts +1 -1
- package/dist/{hooks/checkpoints → features/checkpoint/hooks}/useMessageMetadata.d.ts +2 -2
- package/dist/features/checkpoint/index.d.ts +4 -0
- package/dist/{types/checkpoints.d.ts → features/checkpoint/types.d.ts} +1 -0
- package/dist/{lib → features/checkpoint/utils}/attemptDetection.d.ts +2 -2
- package/dist/{lib → features/checkpoint/utils}/checkpointIndex.d.ts +1 -1
- package/dist/features/checkpoint/utils/index.d.ts +7 -0
- package/dist/{lib → features/checkpoint/utils}/messageMetadataResolver.d.ts +2 -2
- package/dist/{lib → features/checkpoint/utils}/messagePreviews.d.ts +1 -1
- package/dist/{api/chat-api.d.ts → features/core/api/clients/chatClient.d.ts} +2 -3
- package/dist/features/core/api/clients/index.d.ts +2 -0
- package/dist/features/core/api/index.d.ts +2 -0
- package/dist/features/core/api/utils/index.d.ts +1 -0
- package/dist/{config → features/core/constants}/env.d.ts +1 -1
- package/dist/features/core/constants/index.d.ts +1 -0
- package/dist/{context → features/core/contexts}/ChatProviders.d.ts +2 -3
- package/dist/features/core/contexts/index.d.ts +6 -0
- package/dist/{context → features/core/contexts}/providers/ApiProvider.d.ts +1 -1
- package/dist/features/core/contexts/providers/ChatSessionProvider.d.ts +1 -0
- package/dist/features/core/contexts/providers/index.d.ts +2 -0
- package/dist/features/core/hooks/index.d.ts +2 -0
- package/dist/features/core/index.d.ts +6 -0
- package/dist/{types → features/core/types}/context.d.ts +4 -3
- package/dist/features/core/types/index.d.ts +8 -0
- package/dist/features/core/types/models.d.ts +202 -0
- package/dist/features/core/types/requests.d.ts +22 -0
- package/dist/features/core/utils/index.d.ts +1 -0
- package/dist/{components → features/messaging/components}/chat/ChatApp.d.ts +1 -2
- package/dist/{components → features/messaging/components}/chat/MessageComponent.d.ts +1 -1
- package/dist/{components → features/messaging/components}/chat/MessageList.d.ts +2 -2
- package/dist/{components → features/messaging/components}/chat/MessageRow.d.ts +2 -2
- package/dist/features/messaging/index.d.ts +12 -0
- package/dist/features/messaging/utils/markdown.worker.d.ts +1 -0
- package/dist/{context/providers/ChatSessionProvider.d.ts → features/streaming/contexts/StreamingProvider.d.ts} +9 -9
- package/dist/features/streaming/contexts/index.d.ts +3 -0
- package/dist/{context → features/streaming/contexts}/services/use-streaming-service.d.ts +3 -12
- package/dist/features/streaming/index.d.ts +3 -0
- package/dist/features/streaming/utils/index.d.ts +1 -0
- package/dist/features/streaming/utils/types.d.ts +101 -0
- package/dist/{hooks → features/thread/hooks}/useThreadHistoryState.d.ts +5 -5
- package/dist/{hooks → features/thread/hooks}/useThreadsState.d.ts +2 -2
- package/dist/features/thread/index.d.ts +2 -0
- package/dist/{components → features/ui/components}/ui/carousel.d.ts +2 -2
- package/dist/{components → features/ui/components}/ui/pagination.d.ts +1 -1
- package/dist/features/ui/components/ui/resizable.d.ts +23 -0
- package/dist/{components → features/ui/components}/ui/sidebar.d.ts +2 -2
- package/dist/features/ui/components/ui/use-toast.d.ts +2 -0
- package/dist/features/ui/hooks/index.d.ts +2 -0
- package/dist/{hooks → features/ui/hooks}/use-toast.d.ts +4 -4
- package/dist/features/ui/index.d.ts +17 -0
- package/dist/features/ui/utils/index.d.ts +1 -0
- package/dist/index.esm.js +13985 -12997
- package/dist/index.umd.js +49 -48
- package/dist/lib/index.d.ts +8 -27
- package/dist/types/events.d.ts +1 -90
- package/dist/types/index.d.ts +1 -3
- package/dist/types/models.d.ts +1 -226
- package/dist/types/requests.d.ts +1 -15
- package/package.json +1 -1
- package/dist/components/ui/resizable.d.ts +0 -23
- package/dist/components/ui/use-toast.d.ts +0 -2
- package/dist/context/index.d.ts +0 -14
- package/dist/context/types.d.ts +0 -1
- package/dist/hooks/checkpoints/types.d.ts +0 -1
- package/dist/lib/markdown.d.ts +0 -46
- package/dist/types/toolStream.d.ts +0 -11
- package/dist/utils/env.d.ts +0 -12
- /package/dist/{lib → features/checkpoint/utils}/historyUtils.d.ts +0 -0
- /package/dist/{lib → features/checkpoint/utils}/schemaUtils.d.ts +0 -0
- /package/dist/{api/file-api.d.ts → features/core/api/clients/fileClient.d.ts} +0 -0
- /package/dist/{api/utils.d.ts → features/core/api/utils/http.d.ts} +0 -0
- /package/dist/{lib → features/core/utils}/chatUtils.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/ChatInput.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/ChatInterface.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/FileViewerModal.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/MarkdownContent.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/ThreadManager.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/ArtifactRenderer.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/InterruptPartRenderer.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/ResearchTaskArtifact.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/SimpleJsonView.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/StreamProgress.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/ToolComponent.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/UserTextContent.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/artifacts/PlotArtifact.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/artifacts/ResearchTaskArtifact.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/index.d.ts +0 -0
- /package/dist/{components/chat/message-components → features/messaging/components/chat/message}/useFilePreview.d.ts +0 -0
- /package/dist/{components → features/messaging/components}/chat/threads/ThreadListItem.d.ts +0 -0
- /package/dist/{lib → features/messaging/utils}/messageHelpers.d.ts +0 -0
- /package/dist/{lib → features/messaging/utils}/messageUtils.d.ts +0 -0
- /package/dist/{components/settings → features/settings/components}/ChatSettings.d.ts +0 -0
- /package/dist/{context → features/streaming/contexts}/reducers/MessageReducer.d.ts +0 -0
- /package/dist/{context → features/streaming/contexts}/reducers/utils/reducerUtils.d.ts +0 -0
- /package/dist/{hooks → features/streaming/hooks}/use-stream.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/accordion.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/alert-dialog.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/alert.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/aspect-ratio.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/avatar.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/badge.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/breadcrumb.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/button.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/calendar.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/card.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/chart.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/checkbox.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/collapsible.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/command.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/context-menu.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/dialog.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/drawer.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/dropdown-menu.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/form.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/hover-card.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/input-otp.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/input.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/label.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/menubar.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/navigation-menu.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/popover.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/progress.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/radio-group.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/scroll-area.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/select.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/separator.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/sheet.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/skeleton.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/slider.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/sonner.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/switch.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/table.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/tabs.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/textarea.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/toast.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/toaster.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/toggle-group.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/toggle.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/tooltip.d.ts +0 -0
- /package/dist/{hooks → features/ui/hooks}/use-mobile.d.ts +0 -0
- /package/dist/{lib/utils.d.ts → features/ui/utils/cn.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TimelineCheckpoint } from "../types";
|
|
2
|
+
export interface TimelineColumnProps {
|
|
3
|
+
timelineEntries: TimelineCheckpoint[];
|
|
4
|
+
activeCheckpointId?: string | null;
|
|
5
|
+
onSelectCheckpoint?: (checkpointId: string | null) => Promise<void> | void;
|
|
6
|
+
messagePreviews?: Map<string, string>;
|
|
7
|
+
className?: string;
|
|
8
|
+
onHoverStart?: () => void;
|
|
9
|
+
onHoverEnd?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const TimelineColumn: ({ timelineEntries, activeCheckpointId, onSelectCheckpoint, messagePreviews, className, onHoverStart, onHoverEnd, }: TimelineColumnProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export default TimelineColumn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TimelineColumn } from "./TimelineColumn";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { HydratedCheckpointSnapshot } from "@/types";
|
|
2
|
-
export declare function useCheckpointIndex(checkpoints: HydratedCheckpointSnapshot[]): import("
|
|
2
|
+
export declare function useCheckpointIndex(checkpoints: HydratedCheckpointSnapshot[]): import("../utils/checkpointIndex").CheckpointIndex;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @returns Memoized resolved metadata
|
|
9
9
|
*/
|
|
10
10
|
import type { ChatMessage, DefaultMessage } from "@/types";
|
|
11
|
-
import type { CheckpointIndex } from "
|
|
12
|
-
import { type ResolvedMessageMetadata } from "
|
|
11
|
+
import type { CheckpointIndex } from "../utils/checkpointIndex";
|
|
12
|
+
import { type ResolvedMessageMetadata } from "../utils/messageMetadataResolver";
|
|
13
13
|
/**
|
|
14
14
|
* Hook to resolve and memoize metadata for a single message.
|
|
15
15
|
* Uses the pure resolver function and adds React memoization.
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* msg3 appears in multiple checkpoints = multiple attempts/versions
|
|
12
12
|
*/
|
|
13
|
-
import type { HydratedCheckpointSnapshot } from "@/types
|
|
14
|
-
import type { CheckpointAttemptInfo } from "
|
|
13
|
+
import type { HydratedCheckpointSnapshot } from "@/features/core/types";
|
|
14
|
+
import type { CheckpointAttemptInfo } from "../types";
|
|
15
15
|
export interface AttemptMetadata {
|
|
16
16
|
attemptIndex: number;
|
|
17
17
|
attemptCount: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HydratedCheckpointSnapshot } from "@/types";
|
|
2
|
-
import type { CheckpointAttemptInfo, CheckpointMeta, CheckpointMetaWithAttempts, TimelineCheckpoint } from "
|
|
2
|
+
import type { CheckpointAttemptInfo, CheckpointMeta, CheckpointMetaWithAttempts, TimelineCheckpoint } from "../types";
|
|
3
3
|
export interface CheckpointIndex {
|
|
4
4
|
checkpoints: HydratedCheckpointSnapshot[];
|
|
5
5
|
checkpointMetaById: Map<string, CheckpointMeta>;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - Clear separation of heuristics from memoization
|
|
9
9
|
*/
|
|
10
10
|
import type { ChatMessage, DefaultMessage } from "@/types";
|
|
11
|
-
import type { CheckpointIndex } from "
|
|
12
|
-
import type { CheckpointMeta } from "
|
|
11
|
+
import type { CheckpointIndex } from "./checkpointIndex";
|
|
12
|
+
import type { CheckpointMeta } from "../types";
|
|
13
13
|
export interface ResolvedMessageMetadata {
|
|
14
14
|
checkpointCandidates: CheckpointMeta[];
|
|
15
15
|
defaultCheckpointId: string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage } from '@/types';
|
|
2
|
-
import type { HydratedCheckpointSnapshot } from '@/types
|
|
2
|
+
import type { HydratedCheckpointSnapshot } from '@/features/core/types';
|
|
3
3
|
export declare function getPreviewForMessage(message: ChatMessage): string;
|
|
4
4
|
/**
|
|
5
5
|
* Legacy function: builds a map of message ID -> preview text.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { AgentDetail, AgentSchemaInfo, AgentSummary, HistoryPayload, SharedThreadSummary, StateSnapshot, ThreadInfo, ThreadShareResponse, ThreadSummary } from "@/types";
|
|
2
|
-
import
|
|
3
|
-
import { getChatToken, onChatTokenChanged, setChatToken } from "./utils";
|
|
1
|
+
import type { AgentDetail, AgentSchemaInfo, AgentSummary, HistoryPayload, SharedThreadSummary, StateSnapshot, ThreadInfo, ThreadShareResponse, ThreadSummary, TokenListener } from "@/types";
|
|
2
|
+
import { getChatToken, onChatTokenChanged, setChatToken } from "../utils";
|
|
4
3
|
export declare class ChatApi {
|
|
5
4
|
get baseUrl(): string;
|
|
6
5
|
updateConfig(config: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./http";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./env";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* ApiProvider (auth token & API client)
|
|
6
6
|
* └─ ChatSessionProvider (threads, messages, and streaming state)
|
|
7
7
|
*/
|
|
8
|
-
import type { ApiConfig } from '@/types';
|
|
9
|
-
import type { ToolEndEvent } from '@/
|
|
8
|
+
import type { ApiConfig } from '@/features/core/types';
|
|
9
|
+
import type { ToolEndEvent } from '@/features/streaming';
|
|
10
10
|
import { type ReactNode } from 'react';
|
|
11
11
|
export interface ChatProvidersProps {
|
|
12
12
|
children: ReactNode;
|
|
@@ -24,4 +24,3 @@ export interface ChatProvidersProps {
|
|
|
24
24
|
export declare function ChatProviders({ children, apiConfig, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onConnectionError, onError, onAuthError, onThreadChange, onToolEnd, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
export { useApi } from './providers/ApiProvider';
|
|
26
26
|
export { useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
|
|
27
|
-
export type { ApiContextValue, SendOptions, StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API entry point for shared contexts.
|
|
3
|
+
*/
|
|
4
|
+
export { ChatProviders, type ChatProvidersProps } from './ChatProviders';
|
|
5
|
+
export { useApi } from './providers/ApiProvider';
|
|
6
|
+
export { useThreadState, useStream, useThreads, useHasChatSession, } from './providers/ChatSessionProvider';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ApiProvider - Lowest level context providing API client and auth token
|
|
3
3
|
*/
|
|
4
|
-
import type { ApiConfig, ApiContextValue } from '@/types';
|
|
4
|
+
import type { ApiConfig, ApiContextValue } from '@/features/core/types';
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
6
|
export interface ApiProviderProps {
|
|
7
7
|
children: ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreamingProvider as ChatSessionProvider, useStream, useThreads, useThreadState, useHasChatSession, } from "@/features/streaming/contexts";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, ThreadSummary } from "@/types";
|
|
2
|
+
import type { MessageStreamEvent, StreamEvent, SystemStreamEvent, ThreadStreamEvent, ToolStreamEvent } from "@/features/streaming";
|
|
3
|
+
import type { StreamCommand } from "./requests";
|
|
3
4
|
export interface ApiConfig {
|
|
4
5
|
baseUrl?: string;
|
|
5
6
|
apiKey?: string;
|
|
@@ -22,7 +23,7 @@ export interface ApiContextValue {
|
|
|
22
23
|
token: string | null;
|
|
23
24
|
setToken: (token: string | null) => void;
|
|
24
25
|
baseUrl: string;
|
|
25
|
-
api: import("@/
|
|
26
|
+
api: import("@/features/core").ChatApi;
|
|
26
27
|
}
|
|
27
28
|
export interface ThreadsContextValue {
|
|
28
29
|
threads: ThreadSummary[];
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export type Role = "system" | "user" | "assistant" | "tool";
|
|
2
|
+
export type TextPart = {
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
export type ImagePart = {
|
|
7
|
+
type: "image_url";
|
|
8
|
+
url: string;
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
};
|
|
12
|
+
export type FilePart = {
|
|
13
|
+
type: "file";
|
|
14
|
+
url: string;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
sourceType?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ToolCallPart = {
|
|
21
|
+
type: "tool_call";
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
args: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
export type InterruptPart = {
|
|
27
|
+
type: "interrupt";
|
|
28
|
+
value?: any;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
export type MessagePart = TextPart | ImagePart | FilePart | ToolCallPart | InterruptPart;
|
|
32
|
+
export type PlotData = {
|
|
33
|
+
format?: string;
|
|
34
|
+
content_base64?: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
mimeType?: string;
|
|
37
|
+
mime_type?: string;
|
|
38
|
+
plotId?: string;
|
|
39
|
+
artifactId?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
export interface MessageArtifact {
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
export type ArtifactPreview = {
|
|
46
|
+
src: string;
|
|
47
|
+
alt: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
};
|
|
50
|
+
export interface ChatMessage {
|
|
51
|
+
id: string;
|
|
52
|
+
threadId?: string;
|
|
53
|
+
role: Role;
|
|
54
|
+
content: MessagePart[];
|
|
55
|
+
createdAt: string;
|
|
56
|
+
artifacts?: MessageArtifact[];
|
|
57
|
+
artifactPreviews?: Record<string, ArtifactPreview>;
|
|
58
|
+
edited?: boolean;
|
|
59
|
+
checkpointId?: string | null;
|
|
60
|
+
checkpointNs?: string | null;
|
|
61
|
+
branchLabel?: string;
|
|
62
|
+
toolCalls?: Array<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
args: Record<string, unknown>;
|
|
66
|
+
}>;
|
|
67
|
+
artifact?: MessageArtifact;
|
|
68
|
+
name?: string;
|
|
69
|
+
model?: string;
|
|
70
|
+
additionalKwargs?: Record<string, unknown>;
|
|
71
|
+
responseMetadata?: Record<string, unknown>;
|
|
72
|
+
__syntheticStreaming?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface DefaultMessage {
|
|
75
|
+
type?: "default_message";
|
|
76
|
+
id?: string;
|
|
77
|
+
threadId?: string;
|
|
78
|
+
role: Role;
|
|
79
|
+
content: string;
|
|
80
|
+
createdAt?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface PregelTask {
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
export type PendingInterrupt = {
|
|
86
|
+
id: string;
|
|
87
|
+
value: unknown;
|
|
88
|
+
} | null;
|
|
89
|
+
export interface StateSnapshot {
|
|
90
|
+
values: Record<string, unknown>;
|
|
91
|
+
next?: string[];
|
|
92
|
+
config?: Record<string, unknown>;
|
|
93
|
+
metadata?: {
|
|
94
|
+
source?: string;
|
|
95
|
+
step?: number;
|
|
96
|
+
writes?: Record<string, unknown>;
|
|
97
|
+
execution_time?: number;
|
|
98
|
+
};
|
|
99
|
+
tasks?: PregelTask[];
|
|
100
|
+
created_at?: string;
|
|
101
|
+
createdAt?: string;
|
|
102
|
+
parentConfig?: Record<string, unknown>;
|
|
103
|
+
parent_config?: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
export interface HydratedCheckpointSnapshot {
|
|
106
|
+
checkpointId: string | null;
|
|
107
|
+
checkpointNs: string | null;
|
|
108
|
+
parentId: string | null;
|
|
109
|
+
createdAt: string;
|
|
110
|
+
messages: ChatMessage[];
|
|
111
|
+
nextCursor: string | null;
|
|
112
|
+
nextCursorNs: string | null;
|
|
113
|
+
interrupt: PendingInterrupt;
|
|
114
|
+
metadata: {
|
|
115
|
+
step: number;
|
|
116
|
+
source: string | null;
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
};
|
|
119
|
+
config: Record<string, unknown> | null;
|
|
120
|
+
parentConfig: Record<string, unknown> | null;
|
|
121
|
+
next: string[] | null;
|
|
122
|
+
tasks: Record<string, unknown>[] | null;
|
|
123
|
+
}
|
|
124
|
+
export interface HistoryPayload {
|
|
125
|
+
version: string;
|
|
126
|
+
threadId: string;
|
|
127
|
+
checkpoints: StateSnapshot[];
|
|
128
|
+
}
|
|
129
|
+
export interface CheckpointList {
|
|
130
|
+
checkpoints: Array<{
|
|
131
|
+
checkpoint_id: string;
|
|
132
|
+
checkpoint_ns: string | null;
|
|
133
|
+
checkpoint_config: Record<string, unknown> | null;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
136
|
+
export interface StatePayload {
|
|
137
|
+
[key: string]: unknown;
|
|
138
|
+
}
|
|
139
|
+
export interface Envelope<T = unknown> {
|
|
140
|
+
type?: string;
|
|
141
|
+
data?: T;
|
|
142
|
+
error?: string;
|
|
143
|
+
metadata?: Record<string, unknown>;
|
|
144
|
+
}
|
|
145
|
+
export interface ThreadSummary {
|
|
146
|
+
threadId: string;
|
|
147
|
+
title: string;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
messageCount: number;
|
|
151
|
+
lastMessage?: string | null;
|
|
152
|
+
created?: boolean | null;
|
|
153
|
+
ready?: boolean | null;
|
|
154
|
+
}
|
|
155
|
+
export interface SharedThreadSummary extends ThreadSummary {
|
|
156
|
+
sharedAt: string;
|
|
157
|
+
sharedBy?: string;
|
|
158
|
+
sharedByUserId?: string;
|
|
159
|
+
}
|
|
160
|
+
export interface ThreadShareResponse {
|
|
161
|
+
success: boolean;
|
|
162
|
+
threadId: string;
|
|
163
|
+
shareUrl?: string;
|
|
164
|
+
message?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface ThreadShareTarget {
|
|
167
|
+
type: "email" | "link" | "user";
|
|
168
|
+
value: string;
|
|
169
|
+
id?: string;
|
|
170
|
+
label?: string;
|
|
171
|
+
secondaryLabel?: string;
|
|
172
|
+
sharedByUserId?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface ThreadInfo extends ThreadSummary {
|
|
175
|
+
description?: string;
|
|
176
|
+
isArchived?: boolean;
|
|
177
|
+
tags?: string[];
|
|
178
|
+
}
|
|
179
|
+
export interface AgentSummary {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
createdAt: string;
|
|
183
|
+
updatedAt: string;
|
|
184
|
+
}
|
|
185
|
+
export interface AgentDetail extends AgentSummary {
|
|
186
|
+
description?: string;
|
|
187
|
+
schema?: Record<string, unknown>;
|
|
188
|
+
uiDefaultMessage?: string;
|
|
189
|
+
[key: string]: unknown;
|
|
190
|
+
}
|
|
191
|
+
export interface AgentList {
|
|
192
|
+
items?: AgentDetail[];
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
export interface AgentSchemaInfo {
|
|
196
|
+
schema?: Record<string, unknown>;
|
|
197
|
+
[key: string]: unknown;
|
|
198
|
+
}
|
|
199
|
+
export type TokenListener = (token: string | null) => void;
|
|
200
|
+
export interface ExcelUploadResponse {
|
|
201
|
+
[key: string]: unknown;
|
|
202
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type StreamCommand = {
|
|
2
|
+
kind: "resume";
|
|
3
|
+
value: unknown;
|
|
4
|
+
} | {
|
|
5
|
+
kind: "goto";
|
|
6
|
+
node: string;
|
|
7
|
+
value?: unknown;
|
|
8
|
+
};
|
|
9
|
+
import type { TimelineCheckpoint } from "@/features/checkpoint/types";
|
|
10
|
+
export interface ChatRequest {
|
|
11
|
+
threadId?: string | null;
|
|
12
|
+
payload?: Record<string, unknown>;
|
|
13
|
+
checkpointId?: string | null;
|
|
14
|
+
checkpointNs?: string | null;
|
|
15
|
+
nodeFilter?: string | string[] | null;
|
|
16
|
+
config?: Record<string, unknown>;
|
|
17
|
+
edit?: boolean;
|
|
18
|
+
branchLabel?: string;
|
|
19
|
+
active_agent?: string;
|
|
20
|
+
command?: StreamCommand | null;
|
|
21
|
+
timelineCheckpoints?: TimelineCheckpoint[];
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chatUtils";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Chat App - Complete chat application with sidebar layout
|
|
3
3
|
* Combines all chat components into a ready-to-use chat interface
|
|
4
4
|
*/
|
|
5
|
-
import { type ChatProvidersProps } from
|
|
5
|
+
import { type ChatProvidersProps } from "@/features/core";
|
|
6
6
|
export interface ChatAppProps extends Omit<ChatProvidersProps, 'children'> {
|
|
7
7
|
layout?: 'sidebar' | 'fullscreen' | 'tabs';
|
|
8
8
|
layoutSize?: 'phone' | 'tablet' | 'desktop' | 'half-screen';
|
|
@@ -21,7 +21,6 @@ export interface SimpleChatProps {
|
|
|
21
21
|
onError?: (error: string) => void;
|
|
22
22
|
}
|
|
23
23
|
export declare function SimpleChat({ apiConfig, className, onError }: SimpleChatProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export * from '@/context';
|
|
25
24
|
export * from './ChatInterface';
|
|
26
25
|
export * from './ThreadManager';
|
|
27
26
|
export * from './MessageComponent';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Message Component - With truncatable tool messages and responsive design
|
|
3
3
|
*/
|
|
4
4
|
import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
|
|
5
|
-
import type { CheckpointMeta, EditMeta } from "@/
|
|
5
|
+
import type { CheckpointMeta, EditMeta } from "@/features/checkpoint/types";
|
|
6
6
|
export interface MessageComponentProps {
|
|
7
7
|
message: ChatMessage | DefaultMessage;
|
|
8
8
|
messageIndex: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
|
|
2
|
-
import type { EditMeta, TimelineCheckpoint } from "@/
|
|
3
|
-
import type { CheckpointIndex } from "@/
|
|
2
|
+
import type { EditMeta, TimelineCheckpoint } from "@/features/checkpoint/types";
|
|
3
|
+
import type { CheckpointIndex } from "@/features/checkpoint/utils/checkpointIndex";
|
|
4
4
|
import React from "react";
|
|
5
5
|
export interface MessageListProps {
|
|
6
6
|
messages: (ChatMessage | DefaultMessage)[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
|
|
2
|
-
import type { EditMeta } from "@/
|
|
3
|
-
import type { CheckpointIndex } from "@/
|
|
2
|
+
import type { EditMeta } from "@/features/checkpoint/types";
|
|
3
|
+
import type { CheckpointIndex } from "@/features/checkpoint/utils/checkpointIndex";
|
|
4
4
|
import React from "react";
|
|
5
5
|
export declare const getMessageDomKey: (message: ChatMessage | DefaultMessage | undefined, index: number) => string;
|
|
6
6
|
export interface MessageRowProps {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./components/chat/ChatApp";
|
|
2
|
+
export { ChatInput } from "./components/chat/ChatInput";
|
|
3
|
+
export type { ChatInputProps } from "./components/chat/ChatInput";
|
|
4
|
+
export { ChatInterface } from "./components/chat/ChatInterface";
|
|
5
|
+
export type { ChatInterfaceProps } from "./components/chat/ChatInterface";
|
|
6
|
+
export { MessageComponent } from "./components/chat/MessageComponent";
|
|
7
|
+
export type { MessageComponentProps } from "./components/chat/MessageComponent";
|
|
8
|
+
export { MessageList } from "./components/chat/MessageList";
|
|
9
|
+
export type { MessageListProps } from "./components/chat/MessageList";
|
|
10
|
+
export { MarkdownContent } from "./components/chat/MarkdownContent";
|
|
11
|
+
export { FileViewerModal } from "./components/chat/FileViewerModal";
|
|
12
|
+
export { ThreadManager } from "./components/chat/ThreadManager";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DEMO-SIMPLIFIED
|
|
2
|
+
* DEMO-SIMPLIFIED StreamingProvider
|
|
3
3
|
*
|
|
4
4
|
* This is a reduced version optimized for demo/development with ~50% fewer lines.
|
|
5
5
|
*
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
*
|
|
32
32
|
* RESULT: Much easier to debug, faster development, no stale cache issues
|
|
33
33
|
*/
|
|
34
|
-
import type { CheckpointIndex } from
|
|
35
|
-
import type {
|
|
36
|
-
import type {
|
|
37
|
-
import type { ThreadStateMetadata } from '@/types
|
|
38
|
-
import type { ToolEndEvent } from
|
|
34
|
+
import type { CheckpointIndex } from "@/features/checkpoint/utils/checkpointIndex";
|
|
35
|
+
import type { TimelineCheckpoint } from "@/features/checkpoint/types";
|
|
36
|
+
import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, SharedThreadSummary, ThreadSummary } from '@/types';
|
|
37
|
+
import type { StreamContextValue, ThreadStateMetadata } from '@/features/core/types';
|
|
38
|
+
import type { ToolEndEvent } from "@/features/streaming";
|
|
39
39
|
import { type ReactNode } from 'react';
|
|
40
40
|
interface ThreadsContextValue {
|
|
41
41
|
threads: ThreadSummary[];
|
|
@@ -87,7 +87,7 @@ interface ThreadStateContextValue {
|
|
|
87
87
|
respondToInterrupt: (interruptId: string, approved: boolean, value?: unknown) => Promise<void>;
|
|
88
88
|
messagePreviews: Map<string, string>;
|
|
89
89
|
}
|
|
90
|
-
interface
|
|
90
|
+
interface StreamingProviderProps {
|
|
91
91
|
children: ReactNode;
|
|
92
92
|
initialThreadId?: string | null;
|
|
93
93
|
initialCheckpointId?: string | null;
|
|
@@ -99,9 +99,9 @@ interface ChatSessionProviderProps {
|
|
|
99
99
|
onConnectionError?: (error: string) => void;
|
|
100
100
|
onToolEnd?: (event: ToolEndEvent) => void;
|
|
101
101
|
}
|
|
102
|
-
export declare function
|
|
102
|
+
export declare function StreamingProvider({ children, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onError, onAuthError, onThreadChange, onConnectionError, onToolEnd, }: StreamingProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
103
103
|
/**
|
|
104
|
-
|
|
104
|
+
* Hook to check if the current component is within a StreamingProvider
|
|
105
105
|
*/
|
|
106
106
|
export declare function useHasChatSession(): boolean;
|
|
107
107
|
export declare function useThreads(): ThreadsContextValue;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import type { ChatRequest, HistoryPayload
|
|
2
|
-
|
|
3
|
-
type: 'thread_info';
|
|
4
|
-
}>;
|
|
5
|
-
type HeartbeatEvent = Extract<StreamEvent, {
|
|
6
|
-
type: 'heartbeat';
|
|
7
|
-
}>;
|
|
8
|
-
export type StateHistoryEvent = HistoryPayload & {
|
|
9
|
-
type: 'state_history';
|
|
10
|
-
seq?: number;
|
|
11
|
-
};
|
|
1
|
+
import type { ChatRequest, HistoryPayload } from '@/types';
|
|
2
|
+
import { type HeartbeatEvent, type StateHistoryEvent, type StreamEvent, type ThreadInfoEvent } from "@/features/streaming";
|
|
12
3
|
export interface StreamClosedInfo {
|
|
13
4
|
reason: 'complete' | 'aborted' | 'error';
|
|
14
5
|
lastSeq: number;
|
|
@@ -55,7 +46,7 @@ interface StartStreamCallbacks {
|
|
|
55
46
|
}
|
|
56
47
|
/**
|
|
57
48
|
* Thin integration layer that adapts the public `useStream` hook to the
|
|
58
|
-
* coordination callbacks expected by `
|
|
49
|
+
* coordination callbacks expected by `StreamingProvider`. Keeping this logic
|
|
59
50
|
* here means we continue to rely on the well-tested streaming hook for all SSE
|
|
60
51
|
* behaviour while the provider focuses purely on state updates.
|
|
61
52
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|