@itechchoice/prime-chatkit 0.1.0-alpha.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.
Files changed (45) hide show
  1. package/dist/index.js +10017 -0
  2. package/dist/style.css +1 -0
  3. package/dist/types/adapters/bff/client.d.ts +189 -0
  4. package/dist/types/adapters/bff/controller.d.ts +70 -0
  5. package/dist/types/components/ui/agent-trail-clean.d.ts +63 -0
  6. package/dist/types/components/ui/ai-answer-clean.d.ts +76 -0
  7. package/dist/types/components/ui/approval-card-clean.d.ts +54 -0
  8. package/dist/types/components/ui/button-clean.d.ts +13 -0
  9. package/dist/types/components/ui/chat-composer-clean.d.ts +115 -0
  10. package/dist/types/components/ui/collaboration-stream-clean.d.ts +98 -0
  11. package/dist/types/components/ui/command-menu-clean.d.ts +57 -0
  12. package/dist/types/components/ui/decision-card-clean.d.ts +87 -0
  13. package/dist/types/components/ui/dropzone-clean.d.ts +70 -0
  14. package/dist/types/components/ui/tool-call-card-clean.d.ts +76 -0
  15. package/dist/types/core/history.d.ts +3 -0
  16. package/dist/types/core/run.d.ts +34 -0
  17. package/dist/types/core/scope.d.ts +16 -0
  18. package/dist/types/core/sse.d.ts +12 -0
  19. package/dist/types/core/suspension.d.ts +83 -0
  20. package/dist/types/core/tools.d.ts +15 -0
  21. package/dist/types/core/types.d.ts +152 -0
  22. package/dist/types/index.d.ts +6 -0
  23. package/dist/types/layout/DockShell.d.ts +19 -0
  24. package/dist/types/layout/constants.d.ts +22 -0
  25. package/dist/types/layout/index.d.ts +3 -0
  26. package/dist/types/layout/useLayout.d.ts +52 -0
  27. package/dist/types/provider/PrimeViaChat.d.ts +2 -0
  28. package/dist/types/provider/PrimeViaChatProvider.d.ts +2 -0
  29. package/dist/types/provider/PrimeViaChatShell.d.ts +5 -0
  30. package/dist/types/provider/config.d.ts +92 -0
  31. package/dist/types/provider/context.d.ts +53 -0
  32. package/dist/types/provider/hooks.d.ts +82 -0
  33. package/dist/types/ui/HistoryPanel.d.ts +11 -0
  34. package/dist/types/ui/blocks/BlocksPanel.d.ts +70 -0
  35. package/dist/types/ui/blocks/Process.d.ts +7 -0
  36. package/dist/types/ui/blocks/Questions.d.ts +25 -0
  37. package/dist/types/ui/blocks/SentAttachments.d.ts +11 -0
  38. package/dist/types/ui/blocks/useAttachmentDownload.d.ts +9 -0
  39. package/dist/types/ui/blocks/useAttachments.d.ts +15 -0
  40. package/dist/types/ui/blocks/useFollowLatest.d.ts +20 -0
  41. package/dist/types/ui/history.d.ts +10 -0
  42. package/dist/types/ui/i18n.d.ts +203 -0
  43. package/dist/types/ui/start-icons.d.ts +2 -0
  44. package/dist/types/ui/thread.d.ts +71 -0
  45. package/package.json +52 -0
@@ -0,0 +1,152 @@
1
+ /**
2
+ * View model of PrimeChatKit. Backend-agnostic: adapters turn their wire format into these shapes,
3
+ * the UI only reads these shapes.
4
+ */
5
+ export type RunStatus = "running" | "waiting" | "completed" | "failed" | "cancelled";
6
+ export type ToolStatus = "running" | "success" | "error";
7
+ export type ToolCall = {
8
+ /** Stable id: occurrenceId, else callId */
9
+ id: string;
10
+ callId?: string;
11
+ /** Raw capability name, e.g. "mcp:thaleonmcp:uta_get_portfolio_xray" or "artifact_search" */
12
+ capability: string;
13
+ /** Short tool name shown in mono, e.g. "uta_get_portfolio_xray" */
14
+ name: string;
15
+ /** MCP server code, e.g. "thaleonmcp"; undefined for built-in tools */
16
+ server?: string;
17
+ kind: "mcp" | "tool" | "agent" | "other";
18
+ /** One-line human summary, from the tool definition or its arguments */
19
+ summary?: string;
20
+ status: ToolStatus;
21
+ /** ms since epoch, client clock */
22
+ startedAt: number;
23
+ durationMs?: number;
24
+ args?: unknown;
25
+ result?: unknown;
26
+ error?: string;
27
+ };
28
+ export type ModelCall = {
29
+ model?: string;
30
+ status: "running" | "done";
31
+ startedAt: number;
32
+ durationMs?: number;
33
+ tokens?: number;
34
+ promptTokens?: number;
35
+ completionTokens?: number;
36
+ cachedPromptTokens?: number;
37
+ stopReason?: string;
38
+ };
39
+ /** One model iteration: what the model said and the tools it called in that turn */
40
+ export type Turn = {
41
+ iteration: number;
42
+ outputId?: string;
43
+ model?: ModelCall;
44
+ /** Public text streamed in this turn (ASSISTANT_MESSAGE_DELTA) */
45
+ text: string;
46
+ /** Reasoning text, when the provider streams it */
47
+ thinking: string;
48
+ tools: ToolCall[];
49
+ };
50
+ export type PrepareInfo = {
51
+ status: "running" | "done";
52
+ agent?: {
53
+ name: string;
54
+ model?: string;
55
+ description?: string;
56
+ };
57
+ capabilities?: {
58
+ tools?: number;
59
+ mcpTools?: number;
60
+ mcpServers?: number;
61
+ agents?: number;
62
+ skills?: number;
63
+ };
64
+ context?: {
65
+ windowTokens?: number;
66
+ toolsTokens?: number;
67
+ historyBudget?: number;
68
+ memoryRows?: number;
69
+ };
70
+ discovery?: {
71
+ total?: number;
72
+ visible?: number;
73
+ promoted: string[];
74
+ durationMs?: number;
75
+ };
76
+ };
77
+ /** A clarifying question the agent wants answered, with quick options */
78
+ export type Ask = {
79
+ id: string;
80
+ question: string;
81
+ header?: string;
82
+ options: {
83
+ id: string;
84
+ label: string;
85
+ description?: string;
86
+ }[];
87
+ allowCustom?: boolean;
88
+ };
89
+ export type RunSummary = {
90
+ durationMs?: number;
91
+ steps?: number;
92
+ tokens?: number;
93
+ promptTokens?: number;
94
+ completionTokens?: number;
95
+ costUsd?: number;
96
+ };
97
+ export type Run = {
98
+ taskId: string;
99
+ status: RunStatus;
100
+ startedAt: number;
101
+ endedAt?: number;
102
+ prepare: PrepareInfo;
103
+ turns: Turn[];
104
+ answer: {
105
+ text: string;
106
+ /** outputId the answer was taken from */
107
+ outputId?: string;
108
+ /** true once FINAL_MESSAGE_COMPLETED (or history) confirmed it */
109
+ final: boolean;
110
+ /** FINAL_MESSAGE_DELTA text collected until FINAL_MESSAGE_COMPLETED swaps it in */
111
+ finalBuffer?: string;
112
+ };
113
+ summary?: RunSummary;
114
+ asks: Ask[];
115
+ followUps: {
116
+ id: string;
117
+ label: string;
118
+ message: string;
119
+ }[];
120
+ /** Waiting on the user (HITL); details come from the task endpoint */
121
+ suspension?: {
122
+ id?: string;
123
+ reason?: string;
124
+ gateType?: string;
125
+ };
126
+ error?: string;
127
+ /** Highest event id applied, as a decimal string (ids are snowflakes) */
128
+ lastEventId?: string;
129
+ };
130
+ export type Attachment = {
131
+ id: string;
132
+ name: string;
133
+ mimeType?: string;
134
+ size?: number;
135
+ };
136
+ export type ChatMessage = {
137
+ id: string;
138
+ role: "user";
139
+ text: string;
140
+ createdAt: number;
141
+ attachments?: Attachment[];
142
+ } | {
143
+ id: string;
144
+ role: "assistant";
145
+ createdAt: number;
146
+ run: Run;
147
+ };
148
+ export type StreamEvent = {
149
+ id?: string;
150
+ event: string;
151
+ data: Record<string, unknown>;
152
+ };
@@ -0,0 +1,6 @@
1
+ export { default } from "./provider/PrimeViaChat";
2
+ export { PrimeViaChatProvider } from "./provider/PrimeViaChatProvider";
3
+ export { PrimeViaChatShell } from "./provider/PrimeViaChatShell";
4
+ export { usePrimeViaChat, usePrimeViaConfig, useProvisioning, usePanelState, useChatScope, useChatLocale, useAvailability, useProcessView, } from "./provider/hooks";
5
+ export { CHAT_SCOPE_TYPE, scopeKeyOf } from "./core/scope";
6
+ export type { PrimeViaHttpConfig, PrimeViaAvailability, PrimeViaScopeType, PrimeViaScope, PrimeViaCreditBalance, PrimeViaStartPrompt, PrimeViaPanelState, PrimeViaProcessView, PrimeViaChatProviderProps, } from "./provider/config";
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type LayoutApi, type PanelMode } from './useLayout';
3
+ import './dock.css';
4
+ export interface DockShellProps {
5
+ enabled: boolean;
6
+ panelVisible: boolean;
7
+ panelMode?: string;
8
+ onPanelModeChange: (mode: PanelMode) => void;
9
+ onRestore: () => void;
10
+ labels: {
11
+ resizeHandle: string;
12
+ resizeCorner: string;
13
+ restore: string;
14
+ restoreText: string;
15
+ };
16
+ children: (layout: LayoutApi) => ReactNode;
17
+ className?: string;
18
+ }
19
+ export declare function DockShell({ enabled, panelVisible, panelMode, onPanelModeChange, onRestore, labels, children, className, }: DockShellProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * dock/split 布局常量。
3
+ * 从 prime-via/src/layout/constants.js 原样移植数值与解析规则。
4
+ *
5
+ * 复制自 src/components/ChatKit/constants/config.js —— ChatKit 的常量文件里还混着
6
+ * traceId、鉴权、主题等与布局无关的东西,整份引进来会把宿主依赖一起拖进包里,
7
+ * 所以这里只挑布局用得上的数值。ChatKit 下线后原文件可直接删。
8
+ */
9
+ export declare const SPLIT_BREAKPOINT = 1440;
10
+ export declare const MIN_SPLIT_WIDTH = 1280;
11
+ export declare const DOCK_INTERACTIVE_BREAKPOINT = 768;
12
+ export declare const MIN_SPLIT_CONTENT_WIDTH = 620;
13
+ export declare const HEADER_HEIGHT_FALLBACK = 64;
14
+ export declare const DOCK_EDGE_GAP = 12;
15
+ export declare const DOCK_DEFAULT_WIDTH = 720;
16
+ export declare const DOCK_DEFAULT_HEIGHT = 760;
17
+ export declare const DOCK_MIN_WIDTH = 420;
18
+ export declare const DOCK_MIN_HEIGHT = 620;
19
+ export declare const DOCK_MAX_WIDTH = 960;
20
+ export declare const DOCK_GEOMETRY_STORAGE_KEY = "abcPrimeDockGeometry:v1";
21
+ /** 解析 CSS 像素值(逐行对齐原 @/utils/widthGovernance.parseCssPixel 的行为) */
22
+ export declare const parseCssPixel: (rawValue: unknown, fallback?: number) => number;
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export { clampDockGeometry, getDefaultDockGeometry, readDockGeometry, persistDockGeometry, useLayout, type DockGeometry, type PanelMode, type LayoutApi, } from './useLayout';
3
+ export { DockShell, type DockShellProps } from './DockShell';
@@ -0,0 +1,52 @@
1
+ /**
2
+ * dock/split 布局管理 Hook。
3
+ *
4
+ * 移植自 prime-via/src/layout/useLayout.js,保留调用方注入的 setPanelMode。
5
+ * 除 TypeScript 类型外,唯一行为差异是 WO-M3.1-2 裁决授权的分屏拖宽卸载清理。
6
+ */
7
+ import { type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
8
+ export interface DockGeometry {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ }
14
+ export type PanelMode = 'auto' | 'dock' | 'split';
15
+ export type LayoutApi = ReturnType<typeof useLayout>;
16
+ type DockViewport = {
17
+ viewportWidth: number;
18
+ viewportHeight: number;
19
+ headerHeight: number;
20
+ };
21
+ type DockStorage = Partial<Pick<Storage, 'getItem' | 'setItem'>>;
22
+ type LayoutStyle = CSSProperties & {
23
+ [name: `--${string}`]: string | number | undefined;
24
+ };
25
+ export declare const clampDockGeometry: (geometry: DockGeometry | null, { viewportWidth, viewportHeight, headerHeight }: DockViewport) => DockGeometry | null;
26
+ export declare const getDefaultDockGeometry: ({ viewportWidth, viewportHeight, headerHeight }: DockViewport) => DockGeometry | null;
27
+ export declare const readDockGeometry: (storageLike?: DockStorage | undefined) => DockGeometry | null;
28
+ export declare const persistDockGeometry: (geometry: DockGeometry | null, storageLike?: DockStorage | undefined) => void;
29
+ /**
30
+ * 管理 ChatKit 面板的布局状态
31
+ * @param {boolean} isPanelVisible - 面板是否可见
32
+ * @param {string} panelMode - 面板模式 ('auto' | 'split' | 'dock')
33
+ * @returns {Object} 布局状态和方法
34
+ */
35
+ export declare const useLayout: (isPanelVisible: boolean, panelMode: string | undefined, setPanelMode: (mode: PanelMode) => void) => {
36
+ isSplitLayout: boolean;
37
+ isSplitActive: boolean;
38
+ isResizeReady: boolean;
39
+ isResizing: boolean;
40
+ isDockInteractive: boolean;
41
+ isDockDragging: boolean;
42
+ isDockResizing: boolean;
43
+ shellRef: import("react").RefObject<HTMLDivElement | null>;
44
+ shellStyle: LayoutStyle;
45
+ toggleLayout: () => void;
46
+ handleResizeStart: (event: ReactPointerEvent<HTMLElement>) => void;
47
+ handleResizeEnter: () => void;
48
+ handleResizeLeave: () => void;
49
+ handleDockDragStart: (event: ReactPointerEvent<HTMLElement>) => void;
50
+ handleDockResizeStart: (event: ReactPointerEvent<HTMLElement>) => void;
51
+ };
52
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const PrimeViaChat: import("react").NamedExoticComponent<object>;
2
+ export default PrimeViaChat;
@@ -0,0 +1,2 @@
1
+ import { type PrimeViaChatProviderProps } from "./config";
2
+ export declare function PrimeViaChatProvider(props: PrimeViaChatProviderProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare function PrimeViaChatShell({ enabled, panelMode, panelVisible }: {
2
+ enabled: boolean;
3
+ panelMode?: string;
4
+ panelVisible: boolean;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,92 @@
1
+ import type { ReactNode } from "react";
2
+ import type { BffHttp } from "../adapters/bff/client";
3
+ import type { ChatScope, ChatScopeType } from "../core/scope";
4
+ export type PrimeViaHttpConfig = BffHttp;
5
+ export type PrimeViaScope = ChatScope;
6
+ export type PrimeViaScopeType = ChatScopeType;
7
+ export interface PrimeViaAvailability {
8
+ available?: boolean;
9
+ message?: string;
10
+ }
11
+ export interface PrimeViaCreditBalance {
12
+ plan?: {
13
+ allowance: number;
14
+ used: number;
15
+ remaining: number;
16
+ };
17
+ available: number;
18
+ }
19
+ export interface PrimeViaStartPrompt {
20
+ icon?: string;
21
+ label: string;
22
+ prompt: string;
23
+ }
24
+ export interface PrimeViaPanelState {
25
+ enabled: boolean;
26
+ visible: boolean;
27
+ mode?: string;
28
+ }
29
+ export type PrimeViaProcessView = "replies" | "full";
30
+ export interface PrimeViaChatProviderProps {
31
+ http: PrimeViaHttpConfig;
32
+ locale?: string;
33
+ getTraceId?: () => string;
34
+ availability?: PrimeViaAvailability;
35
+ scope?: PrimeViaScope;
36
+ credit?: PrimeViaCreditBalance | null;
37
+ startScreen?: {
38
+ greeting?: string;
39
+ prompts?: PrimeViaStartPrompt[];
40
+ };
41
+ branding?: {
42
+ title?: string;
43
+ logo?: string | null;
44
+ };
45
+ onNavigate?: (target: string | {
46
+ path: string;
47
+ }) => void;
48
+ panel?: PrimeViaPanelState | null;
49
+ onPanelChange?: (next: Partial<PrimeViaPanelState>) => void;
50
+ processView?: PrimeViaProcessView;
51
+ children?: ReactNode;
52
+ }
53
+ export declare function normalizeConfig(props?: Omit<PrimeViaChatProviderProps, "http" | "children">): {
54
+ locale: string;
55
+ getTraceId: () => string;
56
+ onNavigate: (target: string | {
57
+ path: string;
58
+ }) => void;
59
+ availability: {
60
+ available: boolean;
61
+ message: string;
62
+ };
63
+ scope: {
64
+ scopeType: ChatScopeType;
65
+ scopeId: string;
66
+ pending: boolean;
67
+ };
68
+ credit: {
69
+ plan?: {
70
+ allowance: number;
71
+ used: number;
72
+ remaining: number;
73
+ } | undefined;
74
+ available: number;
75
+ } | null;
76
+ startScreen: {
77
+ greeting: string;
78
+ prompts: PrimeViaStartPrompt[];
79
+ };
80
+ branding: {
81
+ title: string;
82
+ logo: string | null;
83
+ };
84
+ panel: {
85
+ enabled: boolean;
86
+ visible: boolean;
87
+ mode: string | undefined;
88
+ } | null;
89
+ onPanelChange: (next: Partial<PrimeViaPanelState>) => void;
90
+ processView: "replies" | "full";
91
+ };
92
+ export type PrimeViaConfig = ReturnType<typeof normalizeConfig>;
@@ -0,0 +1,53 @@
1
+ import type { BffClient } from "../adapters/bff/client";
2
+ import type { createChatController } from "../adapters/bff/controller";
3
+ import type { PrimeViaPanelState } from "./config";
4
+ export type ChatRuntime = {
5
+ client: BffClient;
6
+ controller: ReturnType<typeof createChatController>;
7
+ };
8
+ export declare const ConfigContext: import("react").Context<{
9
+ locale: string;
10
+ getTraceId: () => string;
11
+ onNavigate: (target: string | {
12
+ path: string;
13
+ }) => void;
14
+ availability: {
15
+ available: boolean;
16
+ message: string;
17
+ };
18
+ scope: {
19
+ scopeType: import("../core/scope").ChatScopeType;
20
+ scopeId: string;
21
+ pending: boolean;
22
+ };
23
+ credit: {
24
+ plan?: {
25
+ allowance: number;
26
+ used: number;
27
+ remaining: number;
28
+ } | undefined;
29
+ available: number;
30
+ } | null;
31
+ startScreen: {
32
+ greeting: string;
33
+ prompts: import("./config").PrimeViaStartPrompt[];
34
+ };
35
+ branding: {
36
+ title: string;
37
+ logo: string | null;
38
+ };
39
+ panel: {
40
+ enabled: boolean;
41
+ visible: boolean;
42
+ mode: string | undefined;
43
+ } | null;
44
+ onPanelChange: (next: Partial<PrimeViaPanelState>) => void;
45
+ processView: "replies" | "full";
46
+ } | null>;
47
+ export declare const RuntimeContext: import("react").Context<ChatRuntime | null>;
48
+ export declare const PanelContext: import("react").Context<{
49
+ panel: PrimeViaPanelState;
50
+ patch: (next: Partial<PrimeViaPanelState>) => void;
51
+ } | null>;
52
+ export declare function useRequiredContext<T>(context: React.Context<T | null>): T;
53
+ export declare const useChatRuntime: () => ChatRuntime;
@@ -0,0 +1,82 @@
1
+ import type { PrimeViaPanelState } from "./config";
2
+ export declare const usePrimeViaConfig: () => {
3
+ locale: string;
4
+ getTraceId: () => string;
5
+ onNavigate: (target: string | {
6
+ path: string;
7
+ }) => void;
8
+ availability: {
9
+ available: boolean;
10
+ message: string;
11
+ };
12
+ scope: {
13
+ scopeType: import("../core/scope").ChatScopeType;
14
+ scopeId: string;
15
+ pending: boolean;
16
+ };
17
+ credit: {
18
+ plan?: {
19
+ allowance: number;
20
+ used: number;
21
+ remaining: number;
22
+ } | undefined;
23
+ available: number;
24
+ } | null;
25
+ startScreen: {
26
+ greeting: string;
27
+ prompts: import("./config").PrimeViaStartPrompt[];
28
+ };
29
+ branding: {
30
+ title: string;
31
+ logo: string | null;
32
+ };
33
+ panel: {
34
+ enabled: boolean;
35
+ visible: boolean;
36
+ mode: string | undefined;
37
+ } | null;
38
+ onPanelChange: (next: Partial<PrimeViaPanelState>) => void;
39
+ processView: "replies" | "full";
40
+ };
41
+ export declare const useChatScope: () => {
42
+ scopeType: import("../core/scope").ChatScopeType;
43
+ scopeId: string;
44
+ pending: boolean;
45
+ };
46
+ export declare const useAvailability: () => {
47
+ available: boolean;
48
+ message: string;
49
+ };
50
+ export declare const useChatLocale: () => string;
51
+ export declare const useProcessView: () => "replies" | "full";
52
+ export declare function usePrimeViaChat(): {
53
+ state: import("../adapters/bff/controller").ControllerState;
54
+ send: (text: string, opts?: {
55
+ attachments?: import("../adapters/bff/client").UploadedAttachment[];
56
+ requestMetadata?: Omit<import("../adapters/bff/client").TaskRequestMetadata, "attachments">;
57
+ }) => Promise<void>;
58
+ stop: () => Promise<void>;
59
+ newChat: () => void;
60
+ openSession: (sessionId: string) => Promise<void>;
61
+ answer: (a: import("../core/suspension").SuspensionAnswer) => Promise<void>;
62
+ cancelSuspension: () => Promise<void>;
63
+ upload: (file: Blob & {
64
+ name?: string;
65
+ }, onProgress?: (p: number) => void, signal?: AbortSignal) => Promise<import("../adapters/bff/client").UploadedAttachment>;
66
+ };
67
+ export declare function useProvisioning(): {
68
+ checked: boolean;
69
+ ready: boolean;
70
+ overallStatus: string | null;
71
+ lastFailedReason: string | null;
72
+ triggering: boolean;
73
+ provision: () => Promise<void>;
74
+ };
75
+ export declare function usePanelState(): {
76
+ enabled: boolean;
77
+ visible: boolean;
78
+ mode: string;
79
+ setPanelMode: (mode: string) => void;
80
+ hidePanel: () => void;
81
+ showPanel: () => void;
82
+ };
@@ -0,0 +1,11 @@
1
+ import type { ControllerState } from "../adapters/bff/controller";
2
+ export type HistoryPanelProps = {
3
+ sessions?: ControllerState["sessions"];
4
+ currentId?: string;
5
+ locale?: string;
6
+ onOpen: (id: string) => void;
7
+ onRename: (id: string, title: string) => void;
8
+ onDelete: (id: string) => void;
9
+ onClose: () => void;
10
+ };
11
+ export declare function HistoryPanel({ sessions, currentId, locale, onOpen, onRename, onDelete, onClose }: HistoryPanelProps): import("react").JSX.Element;
@@ -0,0 +1,70 @@
1
+ import { type PointerEvent } from "react";
2
+ import type { UploadedAttachment } from "../../adapters/bff/client";
3
+ import type { ControllerState } from "../../adapters/bff/controller";
4
+ import type { ChatMessage } from "../../core/types";
5
+ import type { Suspension, SuspensionAnswer } from "../../core/suspension";
6
+ import { type OlderMessages } from "./useFollowLatest";
7
+ import { type GetAttachmentUrls } from "./useAttachmentDownload";
8
+ export type BlocksPanelProps = {
9
+ messages: ChatMessage[];
10
+ history?: {
11
+ sessions?: ControllerState["sessions"];
12
+ currentId?: string;
13
+ onLoad: () => void;
14
+ onOpen: (id: string) => void;
15
+ onRename: (id: string, title: string) => void;
16
+ onDelete: (id: string) => void;
17
+ };
18
+ start?: {
19
+ greeting?: string;
20
+ prompts?: {
21
+ icon?: string;
22
+ label: string;
23
+ prompt: string;
24
+ }[];
25
+ };
26
+ availability?: {
27
+ available?: boolean;
28
+ message?: string;
29
+ };
30
+ onNavigate?: (path: string) => void;
31
+ provisioning?: {
32
+ checked: boolean;
33
+ ready: boolean;
34
+ triggering: boolean;
35
+ lastFailedReason: string | null;
36
+ onProvision: () => void;
37
+ };
38
+ suspension?: Suspension;
39
+ onAnswerSuspension?: (a: SuspensionAnswer) => void;
40
+ onCancelSuspension?: () => void;
41
+ error?: {
42
+ code: string;
43
+ status?: number;
44
+ };
45
+ locale?: string;
46
+ credits?: number;
47
+ branding?: {
48
+ title?: string;
49
+ avatar?: string;
50
+ };
51
+ onSend: (text: string, attachments: UploadedAttachment[]) => void;
52
+ onStop?: () => void;
53
+ onNewChat?: () => void;
54
+ onToggleLayout?: () => void;
55
+ onClose?: () => void;
56
+ onCreditsClick?: () => void;
57
+ onRegenerate?: (messageId: string) => void;
58
+ onFeedback?: (messageId: string, kind: "up" | "down" | null, reason?: string) => void;
59
+ upload?: (file: File, progress: (p: number) => void, signal: AbortSignal) => Promise<UploadedAttachment>;
60
+ onHeaderPointerDown?: (event: PointerEvent<HTMLElement>) => void;
61
+ processView?: "full" | "replies";
62
+ className?: string;
63
+ older?: OlderMessages;
64
+ attachmentLimits?: {
65
+ allowedExtensions: string[];
66
+ maxSizeBytes?: number;
67
+ };
68
+ getAttachmentUrls?: GetAttachmentUrls;
69
+ };
70
+ export declare function BlocksPanel({ messages, history, start, availability, provisioning, older, suspension, onAnswerSuspension, onCancelSuspension, error, locale, credits, branding, onSend, onStop, onNewChat, onToggleLayout, onClose, onCreditsClick, onHeaderPointerDown, processView, onRegenerate, onFeedback, onNavigate, upload, attachmentLimits, getAttachmentUrls, className }: BlocksPanelProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { ThreadTool } from "../thread";
2
+ import type { Run } from "../../core/types";
3
+ export declare function Process({ tools, run, locale }: {
4
+ tools: ThreadTool[];
5
+ run: Run;
6
+ locale: string;
7
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,25 @@
1
+ import type { ThreadDecision } from "../thread";
2
+ import { type Decision, type DecisionAnswer } from "../../components/ui/decision-card-clean";
3
+ import type { Suspension, SuspensionAnswer } from "../../core/suspension";
4
+ type QuestionDraft = {
5
+ values: Record<string, string | string[]>;
6
+ custom: Record<string, string>;
7
+ };
8
+ export declare function cardDecisions(decisions: ThreadDecision[]): Decision[];
9
+ /** Accumulate one answer per schema field; only the final draft is submitted. */
10
+ export declare function nextQuestionDraft(s: Extract<Suspension, {
11
+ kind: "questions";
12
+ }>, draft: QuestionDraft, id: string, answer: DecisionAnswer): QuestionDraft | undefined;
13
+ type QuestionsProps = {
14
+ suspension: Suspension;
15
+ locale: string;
16
+ onAnswer?: (answer: SuspensionAnswer) => void | Promise<unknown>;
17
+ error?: {
18
+ code: string;
19
+ status?: number;
20
+ };
21
+ onCancel?: () => void;
22
+ onNavigate?: (path: string) => void;
23
+ };
24
+ export declare function Questions(props: QuestionsProps): import("react").JSX.Element;
25
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Attachment } from "../../core/types";
2
+ import type { BlocksCopy } from "../i18n";
3
+ import type { GetAttachmentUrls } from "./useAttachmentDownload";
4
+ type SentAttachmentsProps = {
5
+ files: Attachment[];
6
+ getAttachmentUrls?: GetAttachmentUrls;
7
+ onDownload: (id: string) => Promise<void>;
8
+ copy: BlocksCopy["attachments"];
9
+ };
10
+ export declare function SentAttachments({ files, getAttachmentUrls, onDownload, copy }: SentAttachmentsProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ export type GetAttachmentUrls = (id: string) => Promise<{
2
+ url?: string;
3
+ originalUrl?: string;
4
+ }>;
5
+ /** Keep navigation inside an invisible frame, with a fresh signed URL per click. */
6
+ export declare function useAttachmentDownload(getUrls?: GetAttachmentUrls): {
7
+ download: (id: string) => Promise<void>;
8
+ failed: boolean;
9
+ };
@@ -0,0 +1,15 @@
1
+ import type { UploadedAttachment } from "../../adapters/bff/client";
2
+ import type { UploadItem } from "../../components/ui/dropzone-clean";
3
+ import type { BlocksPanelProps } from "./BlocksPanel";
4
+ /** Dropzone owns the queue; this hook associates each row with its cancellable upload. */
5
+ export declare function useAttachments(upload: BlocksPanelProps["upload"], uploadFailed: string): {
6
+ open: boolean;
7
+ setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
+ generation: number;
9
+ onUpload: (file: File, onProgress: (progress: number) => void) => Promise<void>;
10
+ onChange: (next: UploadItem[]) => void;
11
+ reset: () => void;
12
+ completed: () => UploadedAttachment[];
13
+ uploading: boolean;
14
+ failed: boolean;
15
+ };