@docyrus/ui-pro-ai-assistant 0.5.7 → 0.6.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.
@@ -0,0 +1,39 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ClientTool, type ClientToolExecuteContext } from '../types';
3
+ export type ClientToolMap = Map<string, ClientTool>;
4
+ export declare function ClientToolsProvider({ tools, children }: {
5
+ tools: ClientToolMap;
6
+ children: ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ /** Returns the full registered client-tool map. */
9
+ export declare function useClientToolMap(): ClientToolMap;
10
+ /** Builds a name → tool lookup, ignoring duplicates (first wins). */
11
+ export declare function buildClientToolMap(tools?: ClientTool[]): ClientToolMap;
12
+ /** Serializable tool definitions sent to the chat endpoint as `clientTools`. */
13
+ export declare function serializeClientTools(tools?: ClientTool[]): {
14
+ name: string;
15
+ description: string;
16
+ parameters: Record<string, unknown>;
17
+ }[];
18
+ export type ClientToolResult = {
19
+ success: true;
20
+ result: unknown;
21
+ } | {
22
+ success: false;
23
+ error: string;
24
+ };
25
+ /** Executes a client tool, normalizing the outcome into a result envelope. */
26
+ export declare function runClientTool(tool: ClientTool, input: unknown, context: ClientToolExecuteContext): Promise<ClientToolResult>;
27
+ interface ClientToolCallProps {
28
+ tool: ClientTool;
29
+ part: {
30
+ state?: string;
31
+ input?: any;
32
+ output?: any;
33
+ errorText?: string;
34
+ toolCallId: string;
35
+ };
36
+ }
37
+ /** Compact card rendered for a client-tool call, driven by host-provided copy. */
38
+ export declare function ClientToolCall({ tool, part }: ClientToolCallProps): import("react/jsx-runtime").JSX.Element;
39
+ export {};
package/dist/styles.css CHANGED
@@ -2471,6 +2471,12 @@
2471
2471
  border-color: color-mix(in oklab, var(--destructive) 20%, transparent);
2472
2472
  }
2473
2473
  }
2474
+ .border-destructive\/40 {
2475
+ border-color: var(--destructive);
2476
+ @supports (color: color-mix(in lab, red, red)) {
2477
+ border-color: color-mix(in oklab, var(--destructive) 40%, transparent);
2478
+ }
2479
+ }
2474
2480
  .border-destructive\/50 {
2475
2481
  border-color: var(--destructive);
2476
2482
  @supports (color: color-mix(in lab, red, red)) {
@@ -2690,6 +2696,12 @@
2690
2696
  .bg-destructive {
2691
2697
  background-color: var(--destructive);
2692
2698
  }
2699
+ .bg-destructive\/5 {
2700
+ background-color: var(--destructive);
2701
+ @supports (color: color-mix(in lab, red, red)) {
2702
+ background-color: color-mix(in oklab, var(--destructive) 5%, transparent);
2703
+ }
2704
+ }
2693
2705
  .bg-destructive\/10 {
2694
2706
  background-color: var(--destructive);
2695
2707
  @supports (color: color-mix(in lab, red, red)) {
@@ -10122,6 +10134,11 @@
10122
10134
  color: var(--color-blue-400);
10123
10135
  }
10124
10136
  }
10137
+ .dark\:text-emerald-500 {
10138
+ @media (prefers-color-scheme: dark) {
10139
+ color: var(--color-emerald-500);
10140
+ }
10141
+ }
10125
10142
  .dark\:text-gray-400 {
10126
10143
  @media (prefers-color-scheme: dark) {
10127
10144
  color: var(--color-gray-400);
@@ -1,9 +1,44 @@
1
+ import { type ReactNode } from 'react';
1
2
  export interface ToolActionEvent {
2
3
  tool: string;
3
4
  toolCallId: string;
4
5
  decision: string;
5
6
  input: any;
6
7
  }
8
+ export interface ClientToolExecuteContext {
9
+ /** The id of the tool call being fulfilled. */
10
+ toolCallId: string;
11
+ }
12
+ /**
13
+ * A host-provided tool the agent can call and have executed client-side.
14
+ *
15
+ * The serializable parts (`name`, `description`, `parameters`) are forwarded
16
+ * to the chat endpoint as `clientTools` so the backend can expose them to the
17
+ * agent. When the agent calls one, `execute` runs in the browser and its
18
+ * resolved value is sent back to the agent as the tool result.
19
+ */
20
+ export interface ClientTool<TInput = any, TOutput = any> {
21
+ /** Unique tool name. Must match the name the agent uses to call it. */
22
+ name: string;
23
+ /** Natural-language description the agent uses to decide when to call it. */
24
+ description: string;
25
+ /** JSON Schema (draft-07) describing the tool input. Forwarded to the backend. */
26
+ parameters?: Record<string, unknown>;
27
+ /**
28
+ * Runs client-side when the agent calls this tool. The resolved value is
29
+ * serialized and sent back to the agent as the tool result. Throwing (or
30
+ * rejecting) reports the error back to the agent.
31
+ */
32
+ execute: (input: TInput, context: ClientToolExecuteContext) => TOutput | Promise<TOutput>;
33
+ /** Icon rendered in the tool-call card. */
34
+ icon?: ReactNode;
35
+ /** Message shown while the tool is executing. */
36
+ progressMessage?: string;
37
+ /** Message shown when the tool resolves successfully. */
38
+ successMessage?: string;
39
+ /** Message shown when the tool throws or rejects. */
40
+ failMessage?: string;
41
+ }
7
42
  export interface ApiResponse<T = unknown> {
8
43
  success: boolean;
9
44
  data?: T;
@@ -315,4 +350,11 @@ export interface DocyAssistantProps {
315
350
  * Common values: 'web' | 'desktop' | 'chrome' | 'word' | 'excel' | 'powerpoint' | 'outlook'.
316
351
  */
317
352
  hostEnvironment?: string;
353
+ /**
354
+ * Host-provided tools the agent can call and have executed client-side.
355
+ * Their definitions are forwarded to the chat endpoint as `clientTools`;
356
+ * when the agent calls one, its `execute` runs in the browser and the
357
+ * result is sent back to the agent automatically.
358
+ */
359
+ clientTools?: ClientTool[];
318
360
  }
@@ -58,6 +58,7 @@ export interface ChatPanelProps {
58
58
  threadId?: string;
59
59
  initialModelId?: string;
60
60
  initialFeatures?: InitialFeatureFlags;
61
+ onManageMemories?: () => void;
61
62
  /**
62
63
  * Combined list of subagents reachable from the active orchestrator —
63
64
  * direct children (`deployment.agent.agents`) plus connected subagents
@@ -68,4 +69,4 @@ export interface ChatPanelProps {
68
69
  */
69
70
  subagents?: Array<Record<string, any>>;
70
71
  }
71
- export declare function ChatPanel({ messages, isLoading, input, onInputChange, onSendMessage, onStop, logo, userPhoto, userDisplayName, description, title, welcomeMessage, isLoadingAgent, placeholder, footerText, supportFiles, supportWebSearch, supportDocumentSearch, supportDeepResearch, supportThinking, supportWorkCanvas, supportMultiModels, deploymentId, tenantAiAgentId, enableMicrophone, enableVoice, isRecording, recognition, onMicrophoneClick, onToolAction, openCanvasView, onSendSpreadsheetCommands: _onSendSpreadsheetCommands, onEditPrompt, renderThreadHeader, messagesClassName, compactToolbar, showWelcome, recentSessions, onSessionClick, threadId, initialModelId, initialFeatures, subagents }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
72
+ export declare function ChatPanel({ messages, isLoading, input, onInputChange, onSendMessage, onStop, logo, userPhoto, userDisplayName, description, title, welcomeMessage, isLoadingAgent, placeholder, footerText, supportFiles, supportWebSearch, supportDocumentSearch, supportDeepResearch, supportThinking, supportWorkCanvas, supportMultiModels, deploymentId, tenantAiAgentId, enableMicrophone, enableVoice, isRecording, recognition, onMicrophoneClick, onToolAction, openCanvasView, onSendSpreadsheetCommands: _onSendSpreadsheetCommands, onEditPrompt, renderThreadHeader, messagesClassName, compactToolbar, showWelcome, recentSessions, onSessionClick, threadId, initialModelId, initialFeatures, subagents, onManageMemories }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docyrus/ui-pro-ai-assistant",
3
- "version": "0.5.7",
3
+ "version": "0.6.0",
4
4
  "description": "Docyrus AI Assistant component — full-featured chat UI with canvas, projects, and i18n support.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,13 +28,18 @@
28
28
  "files": [
29
29
  "dist"
30
30
  ],
31
+ "scripts": {
32
+ "build": "tsup && (tsc -p tsconfig.dts.json || true) && tailwindcss -i src/styles.css -o dist/styles.css",
33
+ "dev": "tsup --watch",
34
+ "typecheck": "tsc --noEmit",
35
+ "lint": "eslint src/"
36
+ },
31
37
  "dependencies": {
32
38
  "@ai-sdk/react": "^3.0.161",
33
- "@tanstack/react-form": "^1.28.4",
34
39
  "@ariakit/react": "0.4.21",
35
- "@codesandbox/sandpack-react": "2.20.0",
40
+ "@codesandbox/sandpack-react": "catalog:",
36
41
  "@emoji-mart/data": "1.2.1",
37
- "@lottiefiles/dotlottie-react": "0.18.3",
42
+ "@lottiefiles/dotlottie-react": "catalog:",
38
43
  "@platejs/ai": "52.3.1",
39
44
  "@platejs/autoformat": "52.0.11",
40
45
  "@platejs/basic-nodes": "52.0.11",
@@ -67,6 +72,7 @@
67
72
  "@platejs/table": "52.0.11",
68
73
  "@platejs/toc": "52.0.11",
69
74
  "@platejs/toggle": "52.0.11",
75
+ "@tanstack/react-form": "^1.28.4",
70
76
  "@univerjs/core": "0.16.1",
71
77
  "@univerjs/design": "0.16.1",
72
78
  "@univerjs/docs": "0.16.1",
@@ -102,9 +108,9 @@
102
108
  "@univerjs/thread-comment-ui": "0.16.1",
103
109
  "@univerjs/ui": "0.16.1",
104
110
  "@univerjs/watermark": "0.16.1",
105
- "@visactor/vchart": "2.0.17",
106
- "@visactor/vtable": "1.23.2",
107
- "@visactor/vtable-plugins": "1.23.2",
111
+ "@visactor/vchart": "catalog:",
112
+ "@visactor/vtable": "catalog:",
113
+ "@visactor/vtable-plugins": "catalog:",
108
114
  "ai": "^6.0.158",
109
115
  "class-variance-authority": "0.7.1",
110
116
  "cmdk": "1.1.1",
@@ -112,8 +118,8 @@
112
118
  "html2canvas-pro": "1.6.7",
113
119
  "jotai-x": "2.3.3",
114
120
  "lowlight": "3.3.0",
115
- "lucide-react": "0.576.0",
116
- "mermaid": "11.12.3",
121
+ "lucide-react": "catalog:",
122
+ "mermaid": "catalog:",
117
123
  "pdf-lib": "1.17.1",
118
124
  "platejs": "^52.3.2",
119
125
  "radix-ui": "1.4.3",
@@ -122,31 +128,31 @@
122
128
  "react-dnd-html5-backend": "16.0.1",
123
129
  "react-lite-youtube-embed": "3.5.1",
124
130
  "react-player": "3.4.0",
125
- "recharts": "2.15.4",
131
+ "recharts": "catalog:",
126
132
  "remark-gfm": "4.0.1",
127
133
  "remark-math": "6.0.0",
128
134
  "scroll-into-view-if-needed": "3.1.0",
129
- "sonner": "2.0.7",
135
+ "sonner": "catalog:",
130
136
  "use-file-picker": "2.1.4",
131
137
  "use-stick-to-bottom": "1.1.3",
132
138
  "vaul": "1.1.2",
133
139
  "xlsx": "0.18.5"
134
140
  },
135
141
  "devDependencies": {
142
+ "@docyrus/ui-pro-shared": "workspace:*",
136
143
  "@tailwindcss/cli": "^4.2.1",
137
144
  "@types/node": "25.3.3",
138
- "@types/react": "19.2.14",
139
- "@types/react-dom": "19.2.3",
140
- "tailwindcss": "4.2.1",
141
- "tsup": "8.5.1",
142
- "typescript": "5.9.3",
143
- "@docyrus/ui-pro-shared": "0.0.5"
145
+ "@types/react": "catalog:",
146
+ "@types/react-dom": "catalog:",
147
+ "tailwindcss": "catalog:",
148
+ "tsup": "catalog:",
149
+ "typescript": "catalog:"
144
150
  },
145
151
  "peerDependencies": {
146
152
  "@docyrus/api-client": ">=0.1.0",
147
153
  "@docyrus/ui-pro-shared": ">=0.0.5",
148
- "react": "19.2.4",
149
- "react-dom": "19.2.4",
154
+ "react": "catalog:",
155
+ "react-dom": "catalog:",
150
156
  "vite": ">=5.0.0"
151
157
  },
152
158
  "peerDependenciesMeta": {
@@ -157,11 +163,5 @@
157
163
  "publishConfig": {
158
164
  "access": "public"
159
165
  },
160
- "license": "MIT",
161
- "scripts": {
162
- "build": "tsup && (tsc -p tsconfig.dts.json || true) && tailwindcss -i src/styles.css -o dist/styles.css",
163
- "dev": "tsup --watch",
164
- "typecheck": "tsc --noEmit",
165
- "lint": "eslint src/"
166
- }
167
- }
166
+ "license": "MIT"
167
+ }