@gram-ai/elements 1.0.5 → 1.0.6

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 CHANGED
@@ -1,3 +1,4 @@
1
1
  export { ElementsProvider as GramElementsProvider } from './contexts/ElementsProvider';
2
2
  export { useElements as useGramElements } from './contexts/ElementsProvider';
3
3
  export { Chat as GramChat } from './components/Chat';
4
+ export type { ElementsConfig, ComposerConfig, ModalConfig, ToolsConfig, ModelConfig, WelcomeConfig, Suggestion, GramRuntimeApi, CustomRuntimeApi, } from './types';
@@ -1,5 +1,5 @@
1
1
  import { ChatModelAdapter } from '@assistant-ui/react';
2
- import { ReactNode } from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
  export interface ElementsProviderProps {
4
4
  /**
5
5
  * The children to render.
@@ -20,10 +20,102 @@ export interface ElementsConfig {
20
20
  * Whether to render the chat window inside of an expandable modal or a standalone chat window.
21
21
  */
22
22
  variant?: 'modal' | 'standalone';
23
+ /**
24
+ * LLM model configuration.
25
+ *
26
+ * @example
27
+ * const config: ElementsConfig = {
28
+ * model: {
29
+ * availableModels: ['gpt-4o-mini', 'gpt-4o'],
30
+ * showModelPicker: true,
31
+ * },
32
+ * }
33
+ */
34
+ model?: ModelConfig;
35
+ /**
36
+ * The theme to use for the Elements library.
37
+ */
38
+ theme?: 'light' | 'dark' | 'system';
39
+ /**
40
+ * The configuration for the welcome message and initial suggestions.
41
+ */
42
+ welcome: WelcomeConfig;
23
43
  /**
24
44
  * The configuration for the composer.
25
45
  */
26
46
  composer?: ComposerConfig;
47
+ /**
48
+ * The configuration for the modal window.
49
+ * Does not apply if variant is 'standalone'.
50
+ */
51
+ modal?: ModalConfig;
52
+ /**
53
+ * The configuration for the tools.
54
+ */
55
+ tools?: ToolsConfig;
56
+ }
57
+ export interface ModelConfig {
58
+ /**
59
+ * The models available to the user.
60
+ * TODO: Update type
61
+ */
62
+ availableModels: string[];
63
+ /**
64
+ * Whether to show the model picker in the composer.
65
+ */
66
+ showModelPicker?: boolean;
67
+ }
68
+ export interface ToolsConfig {
69
+ /**
70
+ * `components` can be used to override the default components used by the
71
+ * Elements library for a given tool result.
72
+ *
73
+ * Please ensure that the tool name directly matches the tool name in your Gram toolset.
74
+ *
75
+ * @example
76
+ * const config: ElementsConfig = {
77
+ * tools: {
78
+ * components: {
79
+ * "get_current_weather": WeatherComponent,
80
+ * },
81
+ * },
82
+ * }
83
+ */
84
+ components?: Record<string, ComponentType>;
85
+ }
86
+ export interface WelcomeConfig {
87
+ /**
88
+ * The welcome message to display when the thread is empty.
89
+ */
90
+ title: string;
91
+ /**
92
+ * The subtitle to display when the thread is empty.
93
+ */
94
+ subtitle: string;
95
+ /**
96
+ * The suggestions to display when the thread is empty.
97
+ */
98
+ suggestions: Suggestion[];
99
+ }
100
+ export interface Suggestion {
101
+ title: string;
102
+ label: string;
103
+ action: string;
104
+ }
105
+ export interface ModalConfig {
106
+ /**
107
+ * Whether to open the modal window by default.
108
+ */
109
+ defaultOpen?: boolean;
110
+ /**
111
+ * The icon to use for the modal window.
112
+ * Receives the current state of the modal window.
113
+ */
114
+ icon?: (state: 'open' | 'closed' | undefined) => ReactNode;
115
+ /**
116
+ * A class name to apply to the modal window.
117
+ */
118
+ className?: string;
27
119
  }
28
120
  export interface ComposerConfig {
29
121
  /**
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.0.5",
5
+ "version": "1.0.6",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
8
8
  ".": {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "scripts": {
25
25
  "build": "vite build",
26
- "lint": "eslint . && tsc -b --noEmit",
26
+ "lint": "eslint .",
27
27
  "analyze": "pnpm dlx vite-bundle-visualizer",
28
28
  "storybook": "storybook dev -p 6006",
29
29
  "build-storybook": "storybook build",