@m6d/cortex-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +70 -0
- package/dist/index.js +3 -0
- package/dist/styles.css +2652 -0
- package/dist/theme.css +69 -0
- package/index.ts +17 -0
- package/package.json +67 -0
- package/src/chat-session.tsx +379 -0
- package/src/components/AttachmentQueue.tsx +75 -0
- package/src/components/ChatComposer.tsx +211 -0
- package/src/components/CopyButton.tsx +73 -0
- package/src/components/CortexChatWidget.tsx +538 -0
- package/src/components/JsonTree.tsx +111 -0
- package/src/components/LlmUsageBreakdown.tsx +42 -0
- package/src/components/LlmUsageChips.tsx +37 -0
- package/src/components/Message.tsx +81 -0
- package/src/components/MessageAbortedFlag.tsx +29 -0
- package/src/components/MessageAttachments.tsx +55 -0
- package/src/components/MessageList.tsx +102 -0
- package/src/components/MessageLlmInspector.tsx +184 -0
- package/src/components/MessagePart.tsx +54 -0
- package/src/components/MessageReasoningAnimated.tsx +12 -0
- package/src/components/MessageReasoningPart.tsx +76 -0
- package/src/components/MessageTextPart.tsx +78 -0
- package/src/components/MessageTokenUsage.tsx +145 -0
- package/src/components/MessageToolCallAnimated.tsx +86 -0
- package/src/components/MessageToolCallOutcome.tsx +95 -0
- package/src/components/MessageToolCallPart.tsx +95 -0
- package/src/components/MessageToolCallStatus.tsx +35 -0
- package/src/components/SubtleActivity.tsx +74 -0
- package/src/components/ThreadList.tsx +219 -0
- package/src/components/ToolAnimation.tsx +22 -0
- package/src/components/ToolExecuteCodeAnimated.tsx +8 -0
- package/src/components/ToolQueryGraphAnimated.tsx +8 -0
- package/src/config.ts +14 -0
- package/src/context.ts +48 -0
- package/src/cx.ts +4 -0
- package/src/format.ts +4 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import { ToolCallPart, UIMessage } from '@tanstack/ai';
|
|
4
|
+
import { ComponentType } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ThreadSummary = {
|
|
7
|
+
id: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
isRunning: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type CortexHeaders = Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* How the widget reaches its cortex server. `baseUrl` may be a thunk so a host
|
|
16
|
+
* with a reactive origin (an Angular Signal is itself a `() => string`) is read
|
|
17
|
+
* at the moment of each request rather than captured once.
|
|
18
|
+
*/
|
|
19
|
+
export type CortexTransport = {
|
|
20
|
+
baseUrl: string | (() => string);
|
|
21
|
+
getHeaders: () => CortexHeaders | Promise<CortexHeaders>;
|
|
22
|
+
};
|
|
23
|
+
export type CortexViewMode = "helper" | "full";
|
|
24
|
+
export type CortexTheme = "light" | "dark" | "system";
|
|
25
|
+
export type CortexToolCallContext = {
|
|
26
|
+
threadId: string;
|
|
27
|
+
};
|
|
28
|
+
/** A tool the server left for the client to answer. */
|
|
29
|
+
export type CortexToolCall = {
|
|
30
|
+
toolCallId: string;
|
|
31
|
+
toolName: string;
|
|
32
|
+
input: unknown;
|
|
33
|
+
};
|
|
34
|
+
export type CortexHooks = {
|
|
35
|
+
onToolCall?: (toolCall: CortexToolCall, context: CortexToolCallContext) => unknown;
|
|
36
|
+
onThreadSelected?: (thread: ThreadSummary) => Promise<void> | void;
|
|
37
|
+
onThreadDeselected?: (thread: ThreadSummary) => Promise<void> | void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The framework-neutral part of the widget's configuration. Each SDK extends it
|
|
41
|
+
* with its own `toolComponents` slot, which is the one field whose type is
|
|
42
|
+
* inherently framework-bound.
|
|
43
|
+
*/
|
|
44
|
+
export type CortexConfig = {
|
|
45
|
+
/** `'en' | 'ar'`, defaults to `'en'`. */
|
|
46
|
+
locale?: string;
|
|
47
|
+
transport: CortexTransport;
|
|
48
|
+
wsUrl?: string;
|
|
49
|
+
viewMode?: CortexViewMode;
|
|
50
|
+
/** Color scheme; `'system'` follows the OS preference. Defaults to `'light'`. */
|
|
51
|
+
theme?: CortexTheme;
|
|
52
|
+
showDebugButton?: boolean;
|
|
53
|
+
hooks?: CortexHooks;
|
|
54
|
+
};
|
|
55
|
+
/** The props a consumer-supplied tool component receives from the widget. */
|
|
56
|
+
export type CortexToolComponentProps = {
|
|
57
|
+
toolCallPart: ToolCallPart;
|
|
58
|
+
message: UIMessage;
|
|
59
|
+
setOutput: (output: unknown) => void;
|
|
60
|
+
};
|
|
61
|
+
export type CortexReactConfig = CortexConfig & {
|
|
62
|
+
toolComponents?: Record<string, ComponentType<CortexToolComponentProps>>;
|
|
63
|
+
};
|
|
64
|
+
export declare function CortexChatWidget({ config, className, }: {
|
|
65
|
+
config: CortexReactConfig;
|
|
66
|
+
/** Sizing classes for the host, like the classes on Angular's widget element. */
|
|
67
|
+
className?: string;
|
|
68
|
+
}): import("react").JSX.Element;
|
|
69
|
+
|
|
70
|
+
export {};
|
package/dist/index.js
ADDED