teodor-new-chat-ui 4.3.398 → 4.3.399
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 +1 -1
- 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/{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/hooks/index.d.ts +2 -0
- package/dist/features/core/index.d.ts +6 -0
- package/dist/{types → features/core/types}/context.d.ts +3 -3
- package/dist/features/core/types/index.d.ts +7 -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/{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 +109 -0
- package/dist/{hooks → features/thread/hooks}/useThreadHistoryState.d.ts +4 -4
- package/dist/{hooks → features/thread/hooks}/useThreadsState.d.ts +2 -2
- package/dist/features/thread/index.d.ts +2 -0
- package/dist/{hooks → features/ui/hooks}/use-toast.d.ts +3 -3
- 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/marked.d.ts +11 -0
- package/dist/types/models.d.ts +80 -104
- package/dist/types/requests.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/chat/message-components/artifacts/ResearchTaskArtifact.d.ts +0 -20
- package/dist/components/settings/ChatSettings.d.ts +0 -30
- package/dist/components/ui/accordion.d.ts +0 -7
- package/dist/components/ui/alert-dialog.d.ts +0 -20
- package/dist/components/ui/alert.d.ts +0 -8
- package/dist/components/ui/aspect-ratio.d.ts +0 -3
- package/dist/components/ui/avatar.d.ts +0 -6
- package/dist/components/ui/breadcrumb.d.ts +0 -19
- package/dist/components/ui/calendar.d.ts +0 -8
- package/dist/components/ui/carousel.d.ts +0 -18
- package/dist/components/ui/chart.d.ts +0 -62
- package/dist/components/ui/checkbox.d.ts +0 -4
- package/dist/components/ui/collapsible.d.ts +0 -5
- package/dist/components/ui/context-menu.d.ts +0 -27
- package/dist/components/ui/drawer.d.ts +0 -22
- package/dist/components/ui/form.d.ts +0 -23
- package/dist/components/ui/hover-card.d.ts +0 -6
- package/dist/components/ui/input-otp.d.ts +0 -34
- package/dist/components/ui/menubar.d.ts +0 -28
- package/dist/components/ui/navigation-menu.d.ts +0 -12
- package/dist/components/ui/pagination.d.ts +0 -28
- package/dist/components/ui/popover.d.ts +0 -6
- package/dist/components/ui/progress.d.ts +0 -4
- package/dist/components/ui/radio-group.d.ts +0 -5
- package/dist/components/ui/resizable.d.ts +0 -23
- package/dist/components/ui/sidebar.d.ts +0 -66
- package/dist/components/ui/skeleton.d.ts +0 -2
- package/dist/components/ui/slider.d.ts +0 -4
- package/dist/components/ui/table.d.ts +0 -10
- package/dist/components/ui/tabs.d.ts +0 -7
- package/dist/components/ui/toggle-group.d.ts +0 -12
- package/dist/components/ui/toggle.d.ts +0 -12
- 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/hooks/use-mobile.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}/messagePreviews.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}/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/{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/badge.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/button.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/card.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/command.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/dialog.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/dropdown-menu.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/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/sonner.d.ts +0 -0
- /package/dist/{components → features/ui/components}/ui/switch.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/tooltip.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.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* msg3 appears in multiple checkpoints = multiple attempts/versions
|
|
12
12
|
*/
|
|
13
13
|
import type { HydratedCheckpointSnapshot } from "@/types/models";
|
|
14
|
-
import type { CheckpointAttemptInfo } from "
|
|
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,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,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, ThreadSummary } from "@/types";
|
|
2
|
+
import type { MessageStreamEvent, StreamCommand, StreamEvent, SystemStreamEvent, ThreadStreamEvent, ToolStreamEvent } from "@/features/streaming";
|
|
3
3
|
export interface ApiConfig {
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
apiKey?: string;
|
|
@@ -22,7 +22,7 @@ export interface ApiContextValue {
|
|
|
22
22
|
token: string | null;
|
|
23
23
|
setToken: (token: string | null) => void;
|
|
24
24
|
baseUrl: string;
|
|
25
|
-
api: import("@/
|
|
25
|
+
api: import("@/features/core").ChatApi;
|
|
26
26
|
}
|
|
27
27
|
export interface ThreadsContextValue {
|
|
28
28
|
threads: ThreadSummary[];
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { MessagePart, HistoryPayload } from "@/types";
|
|
2
|
+
export type StreamCommand = {
|
|
3
|
+
kind: "resume";
|
|
4
|
+
value: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "goto";
|
|
7
|
+
node: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
};
|
|
10
|
+
type ToolEventIdentity = {
|
|
11
|
+
id: string;
|
|
12
|
+
call_id?: string;
|
|
13
|
+
} | {
|
|
14
|
+
call_id: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ToolStartEvent = {
|
|
18
|
+
type: "tool.start";
|
|
19
|
+
args: Record<string, unknown>;
|
|
20
|
+
name?: string;
|
|
21
|
+
tool?: string;
|
|
22
|
+
seq?: number;
|
|
23
|
+
} & ToolEventIdentity;
|
|
24
|
+
export type ToolEndEvent = {
|
|
25
|
+
type: "tool.end";
|
|
26
|
+
output: unknown;
|
|
27
|
+
artifact?: unknown;
|
|
28
|
+
error?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
tool?: string;
|
|
31
|
+
seq?: number;
|
|
32
|
+
} & ToolEventIdentity;
|
|
33
|
+
export type ToolProgressEvent = {
|
|
34
|
+
type: "tool.progress";
|
|
35
|
+
content?: string;
|
|
36
|
+
seq?: number;
|
|
37
|
+
};
|
|
38
|
+
export type ToolStreamEvent = ToolStartEvent | ToolEndEvent;
|
|
39
|
+
export type MessageStreamEvent = {
|
|
40
|
+
type: "message.start";
|
|
41
|
+
role: "assistant";
|
|
42
|
+
id: string;
|
|
43
|
+
model?: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: "message.delta";
|
|
46
|
+
delta: MessagePart[];
|
|
47
|
+
} | {
|
|
48
|
+
type: "message.end";
|
|
49
|
+
} | ToolProgressEvent;
|
|
50
|
+
export type ThreadStreamEvent = {
|
|
51
|
+
type: "thread_info";
|
|
52
|
+
threadId: string;
|
|
53
|
+
title: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
messageCount: number;
|
|
57
|
+
lastMessage?: string | null;
|
|
58
|
+
created?: boolean | null;
|
|
59
|
+
ready?: boolean | null;
|
|
60
|
+
seq?: number | null;
|
|
61
|
+
} | {
|
|
62
|
+
type: "checkpoint";
|
|
63
|
+
checkpointId: string;
|
|
64
|
+
checkpointNs?: string | null;
|
|
65
|
+
};
|
|
66
|
+
export type SystemStreamEvent = {
|
|
67
|
+
type: "error";
|
|
68
|
+
message: string;
|
|
69
|
+
error_type?: string;
|
|
70
|
+
code?: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: "interrupt";
|
|
73
|
+
id: string;
|
|
74
|
+
value: any;
|
|
75
|
+
seq: number;
|
|
76
|
+
} | {
|
|
77
|
+
type: "heartbeat";
|
|
78
|
+
timestamp: number;
|
|
79
|
+
seq: number;
|
|
80
|
+
} | {
|
|
81
|
+
type: "cancelled";
|
|
82
|
+
reason?: string;
|
|
83
|
+
seq?: number;
|
|
84
|
+
} | ({
|
|
85
|
+
type: "state_history";
|
|
86
|
+
seq?: number;
|
|
87
|
+
} & HistoryPayload);
|
|
88
|
+
export type ThreadInfoEvent = Extract<ThreadStreamEvent, {
|
|
89
|
+
type: "thread_info";
|
|
90
|
+
}>;
|
|
91
|
+
export type HeartbeatEvent = Extract<SystemStreamEvent, {
|
|
92
|
+
type: "heartbeat";
|
|
93
|
+
}>;
|
|
94
|
+
export type StateHistoryEvent = Extract<SystemStreamEvent, {
|
|
95
|
+
type: "state_history";
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Complete LangGraph streaming event union type.
|
|
99
|
+
* All SSE messages from backend must be one of these types.
|
|
100
|
+
*/
|
|
101
|
+
export type StreamEvent = MessageStreamEvent | ToolStreamEvent | ThreadStreamEvent | SystemStreamEvent;
|
|
102
|
+
export declare function isStreamEvent(obj: any): obj is StreamEvent;
|
|
103
|
+
export declare function isToolEvent(obj: any): obj is ToolStreamEvent;
|
|
104
|
+
export declare function isToolStartEvent(obj: any): obj is ToolStartEvent;
|
|
105
|
+
export declare function isToolEndEvent(obj: any): obj is ToolEndEvent;
|
|
106
|
+
export declare function isMessageStreamEvent(obj: any): obj is MessageStreamEvent;
|
|
107
|
+
export declare function isThreadStreamEvent(obj: any): obj is ThreadStreamEvent;
|
|
108
|
+
export declare function isSystemStreamEvent(obj: any): obj is SystemStreamEvent;
|
|
109
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ChatApi } from "@/
|
|
2
|
-
import type { StateHistoryEvent } from "@/
|
|
1
|
+
import type { ChatApi } from "@/features/core";
|
|
2
|
+
import type { StateHistoryEvent } from "@/features/streaming";
|
|
3
3
|
import type { ChatMessage, HydratedCheckpointSnapshot } from "@/types";
|
|
4
|
-
import type { TimelineCheckpoint } from "@/types
|
|
4
|
+
import type { TimelineCheckpoint } from "@/features/checkpoint/types";
|
|
5
5
|
import type { PendingInterrupt } from "@/types/models";
|
|
6
|
-
import type { CheckpointIndex } from "@/
|
|
6
|
+
import type { CheckpointIndex } from "@/features/checkpoint/utils/checkpointIndex";
|
|
7
7
|
interface UseThreadHistoryStateOptions {
|
|
8
8
|
api: ChatApi;
|
|
9
9
|
seed: (messages: ChatMessage[], opts?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MutableRefObject } from 'react';
|
|
2
|
-
import type { ChatApi } from
|
|
3
|
-
import type { ThreadInfoEvent } from '@/
|
|
2
|
+
import type { ChatApi } from "@/features/core";
|
|
3
|
+
import type { ThreadInfoEvent } from '@/features/streaming';
|
|
4
4
|
import type { SharedThreadSummary, ThreadSummary } from '@/types';
|
|
5
5
|
interface ThreadActions {
|
|
6
6
|
createThread: (title?: string) => Promise<string | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type ToastActionElement, type ToastProps } from "../components/ui/toast";
|
|
3
3
|
type ToasterToast = ToastProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
title?: React.ReactNode;
|
|
@@ -36,9 +36,9 @@ declare function toast({ ...props }: Toast): {
|
|
|
36
36
|
dismiss: () => void;
|
|
37
37
|
update: (props: ToasterToast) => void;
|
|
38
38
|
};
|
|
39
|
-
declare function useToast(): {
|
|
39
|
+
export declare function useToast(): {
|
|
40
40
|
toast: typeof toast;
|
|
41
41
|
dismiss: (toastId?: string) => void;
|
|
42
42
|
toasts: ToasterToast[];
|
|
43
43
|
};
|
|
44
|
-
export {
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { Button } from "./components/ui/button";
|
|
2
|
+
export { Badge } from "./components/ui/badge";
|
|
3
|
+
export { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./components/ui/card";
|
|
4
|
+
export { Dialog, DialogContent, DialogHeader, DialogTitle } from "./components/ui/dialog";
|
|
5
|
+
export { Input } from "./components/ui/input";
|
|
6
|
+
export { Textarea } from "./components/ui/textarea";
|
|
7
|
+
export { Label } from "./components/ui/label";
|
|
8
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./components/ui/select";
|
|
9
|
+
export { Separator } from "./components/ui/separator";
|
|
10
|
+
export { Switch } from "./components/ui/switch";
|
|
11
|
+
export { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "./components/ui/sheet";
|
|
12
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip";
|
|
13
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./components/ui/dropdown-menu";
|
|
14
|
+
export { ScrollArea } from "./components/ui/scroll-area";
|
|
15
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "./components/ui/command";
|
|
16
|
+
export { Toaster } from "./components/ui/toaster";
|
|
17
|
+
export { Toaster as Sonner } from "./components/ui/sonner";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cn } from "./cn";
|