@yuktishaalaa/yuktai 4.6.5 → 5.0.1
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.mts +134 -28
- package/dist/index.d.ts +134 -28
- package/dist/index.js +54 -53
- package/dist/index.mjs +17 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -136,7 +136,9 @@ interface FilterConfig {
|
|
|
136
136
|
}
|
|
137
137
|
type ViewMode = "table" | "card" | "auto";
|
|
138
138
|
type GridTheme = "default" | "high-contrast" | "dark" | "color-blind" | "dyslexia";
|
|
139
|
-
type
|
|
139
|
+
type IndicLanguageLocale = "as-IN" | "bn-IN" | "brx-IN" | "doi-IN" | "gu-IN" | "hi-IN" | "kn-IN" | "ks-IN" | "kok-IN" | "mai-IN" | "ml-IN" | "mni-IN" | "mr-IN" | "ne-IN" | "or-IN" | "pa-IN" | "sa-IN" | "sat-IN" | "sd-IN" | "ta-IN" | "te-IN" | "ur-IN";
|
|
140
|
+
type GridLocale = "en-IN" | "en-US" | IndicLanguageLocale;
|
|
141
|
+
type GridInputLanguage = GridLocale;
|
|
140
142
|
interface AIFeatures {
|
|
141
143
|
search?: boolean;
|
|
142
144
|
summary?: boolean;
|
|
@@ -170,6 +172,65 @@ interface GridTranslations {
|
|
|
170
172
|
voice: string;
|
|
171
173
|
ask: string;
|
|
172
174
|
}
|
|
175
|
+
interface YuktaiGridRuleContext<T = Record<string, unknown>> {
|
|
176
|
+
/**
|
|
177
|
+
* Original user input.
|
|
178
|
+
*/
|
|
179
|
+
input: string;
|
|
180
|
+
/**
|
|
181
|
+
* Current grid data.
|
|
182
|
+
*/
|
|
183
|
+
data: T[];
|
|
184
|
+
/**
|
|
185
|
+
* Available grid columns.
|
|
186
|
+
*/
|
|
187
|
+
columns: {
|
|
188
|
+
key: string;
|
|
189
|
+
label: string;
|
|
190
|
+
}[];
|
|
191
|
+
/**
|
|
192
|
+
* Execute one of the generic Grid tools.
|
|
193
|
+
*
|
|
194
|
+
* Example:
|
|
195
|
+
*
|
|
196
|
+
* executeTool("count")
|
|
197
|
+
*
|
|
198
|
+
* executeTool("filter", {
|
|
199
|
+
* key: "lines",
|
|
200
|
+
* operator: "greaterThan",
|
|
201
|
+
* value: 6
|
|
202
|
+
* })
|
|
203
|
+
*/
|
|
204
|
+
executeTool: (name: string, input?: Record<string, unknown>) => Promise<{
|
|
205
|
+
success: boolean;
|
|
206
|
+
message: string;
|
|
207
|
+
data?: unknown;
|
|
208
|
+
error?: {
|
|
209
|
+
code: string;
|
|
210
|
+
};
|
|
211
|
+
tool?: string;
|
|
212
|
+
}>;
|
|
213
|
+
}
|
|
214
|
+
interface YuktaiGridRule<T = Record<string, unknown>> {
|
|
215
|
+
/**
|
|
216
|
+
* Application-defined rule name.
|
|
217
|
+
*/
|
|
218
|
+
name: string;
|
|
219
|
+
/**
|
|
220
|
+
* User phrases that activate this rule.
|
|
221
|
+
*/
|
|
222
|
+
phrases: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Optional description for documentation/debugging.
|
|
225
|
+
*/
|
|
226
|
+
description?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Application-specific execution logic.
|
|
229
|
+
*
|
|
230
|
+
* The package does NOT contain application-specific rules.
|
|
231
|
+
*/
|
|
232
|
+
execute: (context: YuktaiGridRuleContext<T>) => Promise<string> | string;
|
|
233
|
+
}
|
|
173
234
|
interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
174
235
|
data: T[];
|
|
175
236
|
columns: GridColumn<T>[];
|
|
@@ -193,18 +254,37 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
193
254
|
onRowClick?: (row: T, index: number) => void;
|
|
194
255
|
onSortChange?: (sort: SortConfig | null) => void;
|
|
195
256
|
className?: string;
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Voice/input language of the embedded assistant.
|
|
259
|
+
*
|
|
260
|
+
* Supports English and the 22 Indian Scheduled Languages.
|
|
261
|
+
*/
|
|
262
|
+
inputLanguage?: "en-IN" | "en-US" | IndicLanguageLocale;
|
|
263
|
+
/**
|
|
264
|
+
* Prefix for WebMCP / Agent tool names.
|
|
265
|
+
*
|
|
266
|
+
* Example:
|
|
267
|
+
*
|
|
268
|
+
* "ratnalabala_poems"
|
|
269
|
+
*
|
|
270
|
+
* produces:
|
|
271
|
+
*
|
|
272
|
+
* ratnalabala_poems_search
|
|
273
|
+
* ratnalabala_poems_filter
|
|
274
|
+
* ratnalabala_poems_sort
|
|
275
|
+
*/
|
|
199
276
|
toolName?: string;
|
|
200
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* Agent-facing tool descriptions.
|
|
279
|
+
*/
|
|
201
280
|
toolDescriptions?: Partial<Record<"search" | "count" | "columns" | "get_row" | "highlight" | "select" | "open" | "filter" | "clear_filters" | "sort" | "clear_sort", string>>;
|
|
202
281
|
/**
|
|
203
|
-
* Expose
|
|
204
|
-
* Uses exactly the same tools as the embedded assistant.
|
|
282
|
+
* Expose Grid tools to AI agents through WebMCP.
|
|
205
283
|
*/
|
|
206
284
|
webmcp?: boolean;
|
|
207
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Real WebMCP registration status.
|
|
287
|
+
*/
|
|
208
288
|
onWebMCPStatusChange?: (status: {
|
|
209
289
|
state: "unsupported" | "registering" | "ready" | "partial" | "error";
|
|
210
290
|
registered: string[];
|
|
@@ -213,7 +293,31 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
213
293
|
message: string;
|
|
214
294
|
}[];
|
|
215
295
|
}) => void;
|
|
216
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* Application-specific Agent rules.
|
|
298
|
+
*
|
|
299
|
+
* Example:
|
|
300
|
+
*
|
|
301
|
+
* customRules={[
|
|
302
|
+
* {
|
|
303
|
+
* name: "show-long-poems",
|
|
304
|
+
* phrases: ["పెద్ద పద్యాలు"],
|
|
305
|
+
* execute: async ({ executeTool }) => {
|
|
306
|
+
* const result = await executeTool("filter", {
|
|
307
|
+
* key: "lines",
|
|
308
|
+
* operator: "greaterThan",
|
|
309
|
+
* value: 6,
|
|
310
|
+
* })
|
|
311
|
+
*
|
|
312
|
+
* return result.message
|
|
313
|
+
* },
|
|
314
|
+
* },
|
|
315
|
+
* ]}
|
|
316
|
+
*/
|
|
317
|
+
customRules?: YuktaiGridRule<T>[];
|
|
318
|
+
/**
|
|
319
|
+
* Every result from the Agent.
|
|
320
|
+
*/
|
|
217
321
|
onAgentResult?: (result: {
|
|
218
322
|
success: boolean;
|
|
219
323
|
message: string;
|
|
@@ -221,7 +325,7 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
221
325
|
}) => void;
|
|
222
326
|
}
|
|
223
327
|
|
|
224
|
-
declare function YuktaiGrid<T extends Record<string, unknown>>({ data, columns, rowKey, view, mobileBreakpoint, theme, locale, ai, search, selectable, selectedKeys, onSelectionChange, pagination, loading, highlightIds, highlightColor, autoScrollToHighlight, onRowClick, onSortChange, empty, className, inputLanguage, toolName, toolDescriptions, webmcp, onWebMCPStatusChange, onAgentResult, }: YuktaiGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
328
|
+
declare function YuktaiGrid<T extends Record<string, unknown>>({ data, columns, rowKey, view, mobileBreakpoint, theme, locale, ai, search, selectable, selectedKeys, onSelectionChange, pagination, loading, highlightIds, highlightColor, autoScrollToHighlight, onRowClick, onSortChange, empty, className, inputLanguage, toolName, toolDescriptions, webmcp, onWebMCPStatusChange, onAgentResult, customRules, }: YuktaiGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
329
|
|
|
226
330
|
/**
|
|
227
331
|
* gridTools — the ONE place where YuktaiGrid tools are defined.
|
|
@@ -375,7 +479,8 @@ interface UseGridReturn<T> {
|
|
|
375
479
|
}
|
|
376
480
|
declare function useGrid<T extends Record<string, unknown>>(options: UseGridOptions<T>): UseGridReturn<T>;
|
|
377
481
|
|
|
378
|
-
type
|
|
482
|
+
type UILanguage = "en-US" | "te-IN";
|
|
483
|
+
type InputLanguage = GridInputLanguage;
|
|
379
484
|
interface YuktaiGridAIProps<T> {
|
|
380
485
|
data: T[];
|
|
381
486
|
columns: {
|
|
@@ -383,10 +488,6 @@ interface YuktaiGridAIProps<T> {
|
|
|
383
488
|
label: string;
|
|
384
489
|
type?: "number" | "text" | "date";
|
|
385
490
|
}[];
|
|
386
|
-
/**
|
|
387
|
-
* Used only when no `agent` is given (4.6.x behaviour).
|
|
388
|
-
* With an agent, every action goes through agent.ask() instead.
|
|
389
|
-
*/
|
|
390
491
|
onSearch?: (query: string) => void;
|
|
391
492
|
onSort?: (key: string, dir: "asc" | "desc") => void;
|
|
392
493
|
theme?: "light" | "dark";
|
|
@@ -394,22 +495,19 @@ interface YuktaiGridAIProps<T> {
|
|
|
394
495
|
* Language of AI UI and AI responses.
|
|
395
496
|
* Default: English.
|
|
396
497
|
*/
|
|
397
|
-
language?:
|
|
498
|
+
language?: UILanguage;
|
|
398
499
|
/**
|
|
399
500
|
* Language used by browser voice recognition.
|
|
400
501
|
* Default: English.
|
|
401
502
|
*/
|
|
402
|
-
inputLanguage?:
|
|
503
|
+
inputLanguage?: InputLanguage;
|
|
403
504
|
/**
|
|
404
505
|
* When true, AI is rendered inside the grid.
|
|
405
506
|
* When false, AI uses the floating assistant UI.
|
|
406
507
|
*/
|
|
407
508
|
embedded?: boolean;
|
|
408
509
|
/**
|
|
409
|
-
* The grid Agent
|
|
410
|
-
* filter / open / clear requests are sent to agent.ask() — the same
|
|
411
|
-
* pipeline WebMCP uses — and the Agent's result message is shown.
|
|
412
|
-
* Questions like "highest / average / total" are still answered here.
|
|
510
|
+
* The grid Agent.
|
|
413
511
|
*/
|
|
414
512
|
agent?: {
|
|
415
513
|
ask: (text: string) => Promise<{
|
|
@@ -418,8 +516,10 @@ interface YuktaiGridAIProps<T> {
|
|
|
418
516
|
}>;
|
|
419
517
|
loading?: boolean;
|
|
420
518
|
};
|
|
421
|
-
/**
|
|
422
|
-
|
|
519
|
+
/**
|
|
520
|
+
* Called when the person switches the voice input language.
|
|
521
|
+
*/
|
|
522
|
+
onInputLanguageChange?: (language: InputLanguage) => void;
|
|
423
523
|
}
|
|
424
524
|
declare function YuktaiGridAI<T extends Record<string, unknown>>({ data, columns, onSearch, onSort, theme, language, inputLanguage, embedded, agent, onInputLanguageChange, }: YuktaiGridAIProps<T>): react_jsx_runtime.JSX.Element;
|
|
425
525
|
|
|
@@ -506,7 +606,9 @@ type GridIntent = {
|
|
|
506
606
|
tool: string;
|
|
507
607
|
input: Record<string, unknown>;
|
|
508
608
|
}
|
|
509
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* "open <something>": search for it, then open the first match
|
|
611
|
+
*/
|
|
510
612
|
| {
|
|
511
613
|
kind: "open";
|
|
512
614
|
text: string;
|
|
@@ -518,8 +620,10 @@ type GridIntentContext = {
|
|
|
518
620
|
}[];
|
|
519
621
|
locale: GridToolLocale;
|
|
520
622
|
};
|
|
521
|
-
type YuktaiGridAgentProps = {
|
|
623
|
+
type YuktaiGridAgentProps<T = Record<string, unknown>> = {
|
|
522
624
|
tools: GridAgentTool[];
|
|
625
|
+
/** Current grid data available to application-defined rules. */
|
|
626
|
+
data?: T[];
|
|
523
627
|
onResult?: (result: GridAgentResult) => void;
|
|
524
628
|
onError?: (error: Error) => void;
|
|
525
629
|
/** Language of the agent's own messages (default "en"). */
|
|
@@ -531,14 +635,16 @@ type YuktaiGridAgentProps = {
|
|
|
531
635
|
}[];
|
|
532
636
|
/** Row ID field — must match the grid's rowKey (default "id"). */
|
|
533
637
|
rowKey?: string;
|
|
534
|
-
/** Replace the built-in regex intent parser
|
|
638
|
+
/** Replace the built-in regex intent parser. */
|
|
535
639
|
parseIntent?: (text: string, context: GridIntentContext) => GridIntent | null;
|
|
640
|
+
/** Application-defined content rules executed before the generic intent parser. */
|
|
641
|
+
customRules?: YuktaiGridRule<T>[];
|
|
536
642
|
/** How many steps to keep in history (default 20). */
|
|
537
643
|
historyLimit?: number;
|
|
538
644
|
};
|
|
539
645
|
/** Built-in parser: exported so it can be tested and reused. */
|
|
540
646
|
declare function parseGridIntent(text: string, context: GridIntentContext): GridIntent | null;
|
|
541
|
-
declare function useYuktaiGridAgent({ tools, onResult, onError, locale, columns, rowKey, parseIntent, historyLimit, }: YuktaiGridAgentProps): {
|
|
647
|
+
declare function useYuktaiGridAgent<T = Record<string, unknown>>({ tools, data, onResult, onError, locale, columns, rowKey, parseIntent: customParseIntent, customRules, historyLimit, }: YuktaiGridAgentProps<T>): {
|
|
542
648
|
loading: boolean;
|
|
543
649
|
tools: GridAgentTool[];
|
|
544
650
|
executeTool: (name: string, input?: Record<string, unknown>) => Promise<GridAgentResult<unknown>>;
|
|
@@ -614,4 +720,4 @@ declare const YuktAI: {
|
|
|
614
720
|
scan(): A11yReport;
|
|
615
721
|
};
|
|
616
722
|
|
|
617
|
-
export { type A11yConfig, type A11yFix, type A11yReport, type AIFeatures, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type CreateGridToolsOptions, type FilterConfig, type FilterOperator, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridColumn, type GridIntent, type GridIntentContext, type GridLocale, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, IconBase, type IconProps, type PaginationConfig, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, aiPlugin, applyGridFilters, clearFilters, clearSort, countGrid, createGridTools, YuktAIWrapper as default, filterGrid, getColumns, getRow, getRowId, highlightRows, openRow, parseGridIntent, searchGrid, selectRow, sortGrid, toGridToolColumns, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
|
723
|
+
export { type A11yConfig, type A11yFix, type A11yReport, type AIFeatures, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type CreateGridToolsOptions, type FilterConfig, type FilterOperator, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridColumn, type GridInputLanguage, type GridIntent, type GridIntentContext, type GridLocale, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, IconBase, type IconProps, type IndicLanguageLocale, type PaginationConfig, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, type YuktaiGridRule, type YuktaiGridRuleContext, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, aiPlugin, applyGridFilters, clearFilters, clearSort, countGrid, createGridTools, YuktAIWrapper as default, filterGrid, getColumns, getRow, getRowId, highlightRows, openRow, parseGridIntent, searchGrid, selectRow, sortGrid, toGridToolColumns, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,7 +136,9 @@ interface FilterConfig {
|
|
|
136
136
|
}
|
|
137
137
|
type ViewMode = "table" | "card" | "auto";
|
|
138
138
|
type GridTheme = "default" | "high-contrast" | "dark" | "color-blind" | "dyslexia";
|
|
139
|
-
type
|
|
139
|
+
type IndicLanguageLocale = "as-IN" | "bn-IN" | "brx-IN" | "doi-IN" | "gu-IN" | "hi-IN" | "kn-IN" | "ks-IN" | "kok-IN" | "mai-IN" | "ml-IN" | "mni-IN" | "mr-IN" | "ne-IN" | "or-IN" | "pa-IN" | "sa-IN" | "sat-IN" | "sd-IN" | "ta-IN" | "te-IN" | "ur-IN";
|
|
140
|
+
type GridLocale = "en-IN" | "en-US" | IndicLanguageLocale;
|
|
141
|
+
type GridInputLanguage = GridLocale;
|
|
140
142
|
interface AIFeatures {
|
|
141
143
|
search?: boolean;
|
|
142
144
|
summary?: boolean;
|
|
@@ -170,6 +172,65 @@ interface GridTranslations {
|
|
|
170
172
|
voice: string;
|
|
171
173
|
ask: string;
|
|
172
174
|
}
|
|
175
|
+
interface YuktaiGridRuleContext<T = Record<string, unknown>> {
|
|
176
|
+
/**
|
|
177
|
+
* Original user input.
|
|
178
|
+
*/
|
|
179
|
+
input: string;
|
|
180
|
+
/**
|
|
181
|
+
* Current grid data.
|
|
182
|
+
*/
|
|
183
|
+
data: T[];
|
|
184
|
+
/**
|
|
185
|
+
* Available grid columns.
|
|
186
|
+
*/
|
|
187
|
+
columns: {
|
|
188
|
+
key: string;
|
|
189
|
+
label: string;
|
|
190
|
+
}[];
|
|
191
|
+
/**
|
|
192
|
+
* Execute one of the generic Grid tools.
|
|
193
|
+
*
|
|
194
|
+
* Example:
|
|
195
|
+
*
|
|
196
|
+
* executeTool("count")
|
|
197
|
+
*
|
|
198
|
+
* executeTool("filter", {
|
|
199
|
+
* key: "lines",
|
|
200
|
+
* operator: "greaterThan",
|
|
201
|
+
* value: 6
|
|
202
|
+
* })
|
|
203
|
+
*/
|
|
204
|
+
executeTool: (name: string, input?: Record<string, unknown>) => Promise<{
|
|
205
|
+
success: boolean;
|
|
206
|
+
message: string;
|
|
207
|
+
data?: unknown;
|
|
208
|
+
error?: {
|
|
209
|
+
code: string;
|
|
210
|
+
};
|
|
211
|
+
tool?: string;
|
|
212
|
+
}>;
|
|
213
|
+
}
|
|
214
|
+
interface YuktaiGridRule<T = Record<string, unknown>> {
|
|
215
|
+
/**
|
|
216
|
+
* Application-defined rule name.
|
|
217
|
+
*/
|
|
218
|
+
name: string;
|
|
219
|
+
/**
|
|
220
|
+
* User phrases that activate this rule.
|
|
221
|
+
*/
|
|
222
|
+
phrases: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Optional description for documentation/debugging.
|
|
225
|
+
*/
|
|
226
|
+
description?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Application-specific execution logic.
|
|
229
|
+
*
|
|
230
|
+
* The package does NOT contain application-specific rules.
|
|
231
|
+
*/
|
|
232
|
+
execute: (context: YuktaiGridRuleContext<T>) => Promise<string> | string;
|
|
233
|
+
}
|
|
173
234
|
interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
174
235
|
data: T[];
|
|
175
236
|
columns: GridColumn<T>[];
|
|
@@ -193,18 +254,37 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
193
254
|
onRowClick?: (row: T, index: number) => void;
|
|
194
255
|
onSortChange?: (sort: SortConfig | null) => void;
|
|
195
256
|
className?: string;
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Voice/input language of the embedded assistant.
|
|
259
|
+
*
|
|
260
|
+
* Supports English and the 22 Indian Scheduled Languages.
|
|
261
|
+
*/
|
|
262
|
+
inputLanguage?: "en-IN" | "en-US" | IndicLanguageLocale;
|
|
263
|
+
/**
|
|
264
|
+
* Prefix for WebMCP / Agent tool names.
|
|
265
|
+
*
|
|
266
|
+
* Example:
|
|
267
|
+
*
|
|
268
|
+
* "ratnalabala_poems"
|
|
269
|
+
*
|
|
270
|
+
* produces:
|
|
271
|
+
*
|
|
272
|
+
* ratnalabala_poems_search
|
|
273
|
+
* ratnalabala_poems_filter
|
|
274
|
+
* ratnalabala_poems_sort
|
|
275
|
+
*/
|
|
199
276
|
toolName?: string;
|
|
200
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* Agent-facing tool descriptions.
|
|
279
|
+
*/
|
|
201
280
|
toolDescriptions?: Partial<Record<"search" | "count" | "columns" | "get_row" | "highlight" | "select" | "open" | "filter" | "clear_filters" | "sort" | "clear_sort", string>>;
|
|
202
281
|
/**
|
|
203
|
-
* Expose
|
|
204
|
-
* Uses exactly the same tools as the embedded assistant.
|
|
282
|
+
* Expose Grid tools to AI agents through WebMCP.
|
|
205
283
|
*/
|
|
206
284
|
webmcp?: boolean;
|
|
207
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Real WebMCP registration status.
|
|
287
|
+
*/
|
|
208
288
|
onWebMCPStatusChange?: (status: {
|
|
209
289
|
state: "unsupported" | "registering" | "ready" | "partial" | "error";
|
|
210
290
|
registered: string[];
|
|
@@ -213,7 +293,31 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
213
293
|
message: string;
|
|
214
294
|
}[];
|
|
215
295
|
}) => void;
|
|
216
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* Application-specific Agent rules.
|
|
298
|
+
*
|
|
299
|
+
* Example:
|
|
300
|
+
*
|
|
301
|
+
* customRules={[
|
|
302
|
+
* {
|
|
303
|
+
* name: "show-long-poems",
|
|
304
|
+
* phrases: ["పెద్ద పద్యాలు"],
|
|
305
|
+
* execute: async ({ executeTool }) => {
|
|
306
|
+
* const result = await executeTool("filter", {
|
|
307
|
+
* key: "lines",
|
|
308
|
+
* operator: "greaterThan",
|
|
309
|
+
* value: 6,
|
|
310
|
+
* })
|
|
311
|
+
*
|
|
312
|
+
* return result.message
|
|
313
|
+
* },
|
|
314
|
+
* },
|
|
315
|
+
* ]}
|
|
316
|
+
*/
|
|
317
|
+
customRules?: YuktaiGridRule<T>[];
|
|
318
|
+
/**
|
|
319
|
+
* Every result from the Agent.
|
|
320
|
+
*/
|
|
217
321
|
onAgentResult?: (result: {
|
|
218
322
|
success: boolean;
|
|
219
323
|
message: string;
|
|
@@ -221,7 +325,7 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
221
325
|
}) => void;
|
|
222
326
|
}
|
|
223
327
|
|
|
224
|
-
declare function YuktaiGrid<T extends Record<string, unknown>>({ data, columns, rowKey, view, mobileBreakpoint, theme, locale, ai, search, selectable, selectedKeys, onSelectionChange, pagination, loading, highlightIds, highlightColor, autoScrollToHighlight, onRowClick, onSortChange, empty, className, inputLanguage, toolName, toolDescriptions, webmcp, onWebMCPStatusChange, onAgentResult, }: YuktaiGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
328
|
+
declare function YuktaiGrid<T extends Record<string, unknown>>({ data, columns, rowKey, view, mobileBreakpoint, theme, locale, ai, search, selectable, selectedKeys, onSelectionChange, pagination, loading, highlightIds, highlightColor, autoScrollToHighlight, onRowClick, onSortChange, empty, className, inputLanguage, toolName, toolDescriptions, webmcp, onWebMCPStatusChange, onAgentResult, customRules, }: YuktaiGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
329
|
|
|
226
330
|
/**
|
|
227
331
|
* gridTools — the ONE place where YuktaiGrid tools are defined.
|
|
@@ -375,7 +479,8 @@ interface UseGridReturn<T> {
|
|
|
375
479
|
}
|
|
376
480
|
declare function useGrid<T extends Record<string, unknown>>(options: UseGridOptions<T>): UseGridReturn<T>;
|
|
377
481
|
|
|
378
|
-
type
|
|
482
|
+
type UILanguage = "en-US" | "te-IN";
|
|
483
|
+
type InputLanguage = GridInputLanguage;
|
|
379
484
|
interface YuktaiGridAIProps<T> {
|
|
380
485
|
data: T[];
|
|
381
486
|
columns: {
|
|
@@ -383,10 +488,6 @@ interface YuktaiGridAIProps<T> {
|
|
|
383
488
|
label: string;
|
|
384
489
|
type?: "number" | "text" | "date";
|
|
385
490
|
}[];
|
|
386
|
-
/**
|
|
387
|
-
* Used only when no `agent` is given (4.6.x behaviour).
|
|
388
|
-
* With an agent, every action goes through agent.ask() instead.
|
|
389
|
-
*/
|
|
390
491
|
onSearch?: (query: string) => void;
|
|
391
492
|
onSort?: (key: string, dir: "asc" | "desc") => void;
|
|
392
493
|
theme?: "light" | "dark";
|
|
@@ -394,22 +495,19 @@ interface YuktaiGridAIProps<T> {
|
|
|
394
495
|
* Language of AI UI and AI responses.
|
|
395
496
|
* Default: English.
|
|
396
497
|
*/
|
|
397
|
-
language?:
|
|
498
|
+
language?: UILanguage;
|
|
398
499
|
/**
|
|
399
500
|
* Language used by browser voice recognition.
|
|
400
501
|
* Default: English.
|
|
401
502
|
*/
|
|
402
|
-
inputLanguage?:
|
|
503
|
+
inputLanguage?: InputLanguage;
|
|
403
504
|
/**
|
|
404
505
|
* When true, AI is rendered inside the grid.
|
|
405
506
|
* When false, AI uses the floating assistant UI.
|
|
406
507
|
*/
|
|
407
508
|
embedded?: boolean;
|
|
408
509
|
/**
|
|
409
|
-
* The grid Agent
|
|
410
|
-
* filter / open / clear requests are sent to agent.ask() — the same
|
|
411
|
-
* pipeline WebMCP uses — and the Agent's result message is shown.
|
|
412
|
-
* Questions like "highest / average / total" are still answered here.
|
|
510
|
+
* The grid Agent.
|
|
413
511
|
*/
|
|
414
512
|
agent?: {
|
|
415
513
|
ask: (text: string) => Promise<{
|
|
@@ -418,8 +516,10 @@ interface YuktaiGridAIProps<T> {
|
|
|
418
516
|
}>;
|
|
419
517
|
loading?: boolean;
|
|
420
518
|
};
|
|
421
|
-
/**
|
|
422
|
-
|
|
519
|
+
/**
|
|
520
|
+
* Called when the person switches the voice input language.
|
|
521
|
+
*/
|
|
522
|
+
onInputLanguageChange?: (language: InputLanguage) => void;
|
|
423
523
|
}
|
|
424
524
|
declare function YuktaiGridAI<T extends Record<string, unknown>>({ data, columns, onSearch, onSort, theme, language, inputLanguage, embedded, agent, onInputLanguageChange, }: YuktaiGridAIProps<T>): react_jsx_runtime.JSX.Element;
|
|
425
525
|
|
|
@@ -506,7 +606,9 @@ type GridIntent = {
|
|
|
506
606
|
tool: string;
|
|
507
607
|
input: Record<string, unknown>;
|
|
508
608
|
}
|
|
509
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* "open <something>": search for it, then open the first match
|
|
611
|
+
*/
|
|
510
612
|
| {
|
|
511
613
|
kind: "open";
|
|
512
614
|
text: string;
|
|
@@ -518,8 +620,10 @@ type GridIntentContext = {
|
|
|
518
620
|
}[];
|
|
519
621
|
locale: GridToolLocale;
|
|
520
622
|
};
|
|
521
|
-
type YuktaiGridAgentProps = {
|
|
623
|
+
type YuktaiGridAgentProps<T = Record<string, unknown>> = {
|
|
522
624
|
tools: GridAgentTool[];
|
|
625
|
+
/** Current grid data available to application-defined rules. */
|
|
626
|
+
data?: T[];
|
|
523
627
|
onResult?: (result: GridAgentResult) => void;
|
|
524
628
|
onError?: (error: Error) => void;
|
|
525
629
|
/** Language of the agent's own messages (default "en"). */
|
|
@@ -531,14 +635,16 @@ type YuktaiGridAgentProps = {
|
|
|
531
635
|
}[];
|
|
532
636
|
/** Row ID field — must match the grid's rowKey (default "id"). */
|
|
533
637
|
rowKey?: string;
|
|
534
|
-
/** Replace the built-in regex intent parser
|
|
638
|
+
/** Replace the built-in regex intent parser. */
|
|
535
639
|
parseIntent?: (text: string, context: GridIntentContext) => GridIntent | null;
|
|
640
|
+
/** Application-defined content rules executed before the generic intent parser. */
|
|
641
|
+
customRules?: YuktaiGridRule<T>[];
|
|
536
642
|
/** How many steps to keep in history (default 20). */
|
|
537
643
|
historyLimit?: number;
|
|
538
644
|
};
|
|
539
645
|
/** Built-in parser: exported so it can be tested and reused. */
|
|
540
646
|
declare function parseGridIntent(text: string, context: GridIntentContext): GridIntent | null;
|
|
541
|
-
declare function useYuktaiGridAgent({ tools, onResult, onError, locale, columns, rowKey, parseIntent, historyLimit, }: YuktaiGridAgentProps): {
|
|
647
|
+
declare function useYuktaiGridAgent<T = Record<string, unknown>>({ tools, data, onResult, onError, locale, columns, rowKey, parseIntent: customParseIntent, customRules, historyLimit, }: YuktaiGridAgentProps<T>): {
|
|
542
648
|
loading: boolean;
|
|
543
649
|
tools: GridAgentTool[];
|
|
544
650
|
executeTool: (name: string, input?: Record<string, unknown>) => Promise<GridAgentResult<unknown>>;
|
|
@@ -614,4 +720,4 @@ declare const YuktAI: {
|
|
|
614
720
|
scan(): A11yReport;
|
|
615
721
|
};
|
|
616
722
|
|
|
617
|
-
export { type A11yConfig, type A11yFix, type A11yReport, type AIFeatures, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type CreateGridToolsOptions, type FilterConfig, type FilterOperator, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridColumn, type GridIntent, type GridIntentContext, type GridLocale, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, IconBase, type IconProps, type PaginationConfig, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, aiPlugin, applyGridFilters, clearFilters, clearSort, countGrid, createGridTools, YuktAIWrapper as default, filterGrid, getColumns, getRow, getRowId, highlightRows, openRow, parseGridIntent, searchGrid, selectRow, sortGrid, toGridToolColumns, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
|
723
|
+
export { type A11yConfig, type A11yFix, type A11yReport, type AIFeatures, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type CreateGridToolsOptions, type FilterConfig, type FilterOperator, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridColumn, type GridInputLanguage, type GridIntent, type GridIntentContext, type GridLocale, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, IconBase, type IconProps, type IndicLanguageLocale, type PaginationConfig, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, type YuktaiGridRule, type YuktaiGridRuleContext, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, aiPlugin, applyGridFilters, clearFilters, clearSort, countGrid, createGridTools, YuktAIWrapper as default, filterGrid, getColumns, getRow, getRowId, highlightRows, openRow, parseGridIntent, searchGrid, selectRow, sortGrid, toGridToolColumns, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|