@gram-ai/elements 1.16.3 → 1.16.5
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/contexts/ElementsProvider.d.ts +1 -1
- package/dist/elements.cjs +120 -33
- package/dist/elements.css +1 -1
- package/dist/elements.js +28646 -8262
- package/dist/hooks/useMCPTools.d.ts +11 -0
- package/dist/hooks/useSession.d.ts +13 -0
- package/dist/{index-SAJg5Cz7.js → index-Bjdy_BPv.js} +378 -385
- package/dist/{index-C6vUoNWt.cjs → index-CqzaiyM-.cjs} +2 -2
- package/dist/lib/tools.d.ts +6 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/server.cjs +1 -29
- package/dist/server.d.ts +32 -4
- package/dist/server.js +21 -4069
- package/dist/types/index.d.ts +23 -11
- package/package.json +3 -1
- package/dist/index-BqoFmyxX.cjs +0 -60
- package/dist/index-CVZt-xeH.js +0 -14913
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { MODELS } from '../lib/models';
|
|
|
2
2
|
import { AssistantTool, ImageMessagePartComponent, ReasoningGroupComponent, ReasoningMessagePartComponent, TextMessagePartComponent, ToolCallMessagePartComponent } from '@assistant-ui/react';
|
|
3
3
|
import { ComponentType, Dispatch, PropsWithChildren, SetStateAction, ReactNode } from 'react';
|
|
4
4
|
import { Plugin } from './plugins';
|
|
5
|
+
/**
|
|
6
|
+
* Function to retrieve the session token from the backend endpoint.
|
|
7
|
+
* Override this if you have mounted your session endpoint at a different path.
|
|
8
|
+
*/
|
|
9
|
+
export type GetSessionFn = () => Promise<string>;
|
|
5
10
|
export interface ElementsProviderProps {
|
|
6
11
|
/**
|
|
7
12
|
* The children to render.
|
|
@@ -11,6 +16,19 @@ export interface ElementsProviderProps {
|
|
|
11
16
|
* Configuration object for the Elements library.
|
|
12
17
|
*/
|
|
13
18
|
config: ElementsConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Function to retrieve the session token from the backend endpoint.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const config: ElementsConfig = {
|
|
24
|
+
* getSession: async () => {
|
|
25
|
+
* return fetch('/chat/session').then(res => res.json()).then(data => data.client_token)
|
|
26
|
+
* },
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* @default Use this default if you are using the Elements server handlers, and have mounted the session handler at /chat/session.
|
|
30
|
+
*/
|
|
31
|
+
getSession?: GetSessionFn;
|
|
14
32
|
}
|
|
15
33
|
type ServerUrl = string;
|
|
16
34
|
export declare const VARIANTS: readonly ["widget", "sidecar", "standalone"];
|
|
@@ -85,17 +103,6 @@ export interface ElementsConfig {
|
|
|
85
103
|
* }
|
|
86
104
|
*/
|
|
87
105
|
mcp: ServerUrl;
|
|
88
|
-
/**
|
|
89
|
-
* The path of your backend's chat endpoint.
|
|
90
|
-
*
|
|
91
|
-
* @default '/chat/completions'
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* const config: ElementsConfig = {
|
|
95
|
-
* chatEndpoint: '/my-custom-chat-endpoint',
|
|
96
|
-
* }
|
|
97
|
-
*/
|
|
98
|
-
chatEndpoint?: string;
|
|
99
106
|
/**
|
|
100
107
|
* Custom environment variable overrides for the Elements library.
|
|
101
108
|
* Will be used to override the environment variables for the MCP server.
|
|
@@ -571,5 +578,10 @@ export type ElementsContextType = {
|
|
|
571
578
|
isOpen: boolean;
|
|
572
579
|
setIsOpen: (isOpen: boolean) => void;
|
|
573
580
|
plugins: Plugin[];
|
|
581
|
+
/**
|
|
582
|
+
* Indicates if the process of discovering MCP tools is still ongoing.
|
|
583
|
+
* TODO: failure state
|
|
584
|
+
*/
|
|
585
|
+
isLoadingMCPTools: boolean;
|
|
574
586
|
};
|
|
575
587
|
export {};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gram-ai/elements",
|
|
3
3
|
"description": "Gram Elements is a library of UI primitives for building chat-like experiences for MCP Servers.",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.16.
|
|
5
|
+
"version": "1.16.5",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@ai-sdk/mcp": "^0.0.11",
|
|
88
|
+
"@ai-sdk/react": "^2.0.118",
|
|
88
89
|
"@openrouter/ai-sdk-provider": "^1.4.1",
|
|
89
90
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
90
91
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
"@radix-ui/react-popover": "^1.1.15",
|
|
93
94
|
"@radix-ui/react-slot": "^1.2.3",
|
|
94
95
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
96
|
+
"@tanstack/react-query": "5.90.10",
|
|
95
97
|
"ai": "5.0.90",
|
|
96
98
|
"assistant-stream": "^0.2.42",
|
|
97
99
|
"class-variance-authority": "^0.7.1",
|