@yuktishaalaa/yuktai 4.6.5 → 5.0.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.
- package/dist/index.d.mts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +54 -54
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -170,6 +170,24 @@ interface GridTranslations {
|
|
|
170
170
|
voice: string;
|
|
171
171
|
ask: string;
|
|
172
172
|
}
|
|
173
|
+
interface YuktaiGridRuleContext<T = Record<string, unknown>> {
|
|
174
|
+
input: string;
|
|
175
|
+
data: T[];
|
|
176
|
+
columns: {
|
|
177
|
+
key: string;
|
|
178
|
+
label: string;
|
|
179
|
+
}[];
|
|
180
|
+
}
|
|
181
|
+
interface YuktaiGridRule<T = Record<string, unknown>> {
|
|
182
|
+
/** Application-defined rule name. */
|
|
183
|
+
name: string;
|
|
184
|
+
/** Phrases that activate this rule. */
|
|
185
|
+
phrases: string[];
|
|
186
|
+
/** Optional description for documentation/debugging. */
|
|
187
|
+
description?: string;
|
|
188
|
+
/** Application-specific execution logic. */
|
|
189
|
+
execute: (context: YuktaiGridRuleContext<T>) => Promise<string> | string;
|
|
190
|
+
}
|
|
173
191
|
interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
174
192
|
data: T[];
|
|
175
193
|
columns: GridColumn<T>[];
|
|
@@ -213,6 +231,8 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
213
231
|
message: string;
|
|
214
232
|
}[];
|
|
215
233
|
}) => void;
|
|
234
|
+
/** Application-defined content rules executed before generic Grid intent parsing. */
|
|
235
|
+
customRules?: YuktaiGridRule<T>[];
|
|
216
236
|
/** Every result from the Agent (assistant or WebMCP), e.g. for logging. */
|
|
217
237
|
onAgentResult?: (result: {
|
|
218
238
|
success: boolean;
|
|
@@ -221,7 +241,7 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
221
241
|
}) => void;
|
|
222
242
|
}
|
|
223
243
|
|
|
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;
|
|
244
|
+
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
245
|
|
|
226
246
|
/**
|
|
227
247
|
* gridTools — the ONE place where YuktaiGrid tools are defined.
|
|
@@ -518,8 +538,10 @@ type GridIntentContext = {
|
|
|
518
538
|
}[];
|
|
519
539
|
locale: GridToolLocale;
|
|
520
540
|
};
|
|
521
|
-
type YuktaiGridAgentProps = {
|
|
541
|
+
type YuktaiGridAgentProps<T = Record<string, unknown>> = {
|
|
522
542
|
tools: GridAgentTool[];
|
|
543
|
+
/** Current grid data available to application-defined rules. */
|
|
544
|
+
data?: T[];
|
|
523
545
|
onResult?: (result: GridAgentResult) => void;
|
|
524
546
|
onError?: (error: Error) => void;
|
|
525
547
|
/** Language of the agent's own messages (default "en"). */
|
|
@@ -533,12 +555,14 @@ type YuktaiGridAgentProps = {
|
|
|
533
555
|
rowKey?: string;
|
|
534
556
|
/** Replace the built-in regex intent parser (e.g. with an on-device LLM). */
|
|
535
557
|
parseIntent?: (text: string, context: GridIntentContext) => GridIntent | null;
|
|
558
|
+
/** Application-defined content rules executed before the generic intent parser. */
|
|
559
|
+
customRules?: YuktaiGridRule<T>[];
|
|
536
560
|
/** How many steps to keep in history (default 20). */
|
|
537
561
|
historyLimit?: number;
|
|
538
562
|
};
|
|
539
563
|
/** Built-in parser: exported so it can be tested and reused. */
|
|
540
564
|
declare function parseGridIntent(text: string, context: GridIntentContext): GridIntent | null;
|
|
541
|
-
declare function useYuktaiGridAgent({ tools, onResult, onError, locale, columns, rowKey, parseIntent, historyLimit, }: YuktaiGridAgentProps): {
|
|
565
|
+
declare function useYuktaiGridAgent<T = Record<string, unknown>>({ tools, data, onResult, onError, locale, columns, rowKey, parseIntent, customRules, historyLimit, }: YuktaiGridAgentProps<T>): {
|
|
542
566
|
loading: boolean;
|
|
543
567
|
tools: GridAgentTool[];
|
|
544
568
|
executeTool: (name: string, input?: Record<string, unknown>) => Promise<GridAgentResult<unknown>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -170,6 +170,24 @@ interface GridTranslations {
|
|
|
170
170
|
voice: string;
|
|
171
171
|
ask: string;
|
|
172
172
|
}
|
|
173
|
+
interface YuktaiGridRuleContext<T = Record<string, unknown>> {
|
|
174
|
+
input: string;
|
|
175
|
+
data: T[];
|
|
176
|
+
columns: {
|
|
177
|
+
key: string;
|
|
178
|
+
label: string;
|
|
179
|
+
}[];
|
|
180
|
+
}
|
|
181
|
+
interface YuktaiGridRule<T = Record<string, unknown>> {
|
|
182
|
+
/** Application-defined rule name. */
|
|
183
|
+
name: string;
|
|
184
|
+
/** Phrases that activate this rule. */
|
|
185
|
+
phrases: string[];
|
|
186
|
+
/** Optional description for documentation/debugging. */
|
|
187
|
+
description?: string;
|
|
188
|
+
/** Application-specific execution logic. */
|
|
189
|
+
execute: (context: YuktaiGridRuleContext<T>) => Promise<string> | string;
|
|
190
|
+
}
|
|
173
191
|
interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
174
192
|
data: T[];
|
|
175
193
|
columns: GridColumn<T>[];
|
|
@@ -213,6 +231,8 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
213
231
|
message: string;
|
|
214
232
|
}[];
|
|
215
233
|
}) => void;
|
|
234
|
+
/** Application-defined content rules executed before generic Grid intent parsing. */
|
|
235
|
+
customRules?: YuktaiGridRule<T>[];
|
|
216
236
|
/** Every result from the Agent (assistant or WebMCP), e.g. for logging. */
|
|
217
237
|
onAgentResult?: (result: {
|
|
218
238
|
success: boolean;
|
|
@@ -221,7 +241,7 @@ interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
|
221
241
|
}) => void;
|
|
222
242
|
}
|
|
223
243
|
|
|
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;
|
|
244
|
+
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
245
|
|
|
226
246
|
/**
|
|
227
247
|
* gridTools — the ONE place where YuktaiGrid tools are defined.
|
|
@@ -518,8 +538,10 @@ type GridIntentContext = {
|
|
|
518
538
|
}[];
|
|
519
539
|
locale: GridToolLocale;
|
|
520
540
|
};
|
|
521
|
-
type YuktaiGridAgentProps = {
|
|
541
|
+
type YuktaiGridAgentProps<T = Record<string, unknown>> = {
|
|
522
542
|
tools: GridAgentTool[];
|
|
543
|
+
/** Current grid data available to application-defined rules. */
|
|
544
|
+
data?: T[];
|
|
523
545
|
onResult?: (result: GridAgentResult) => void;
|
|
524
546
|
onError?: (error: Error) => void;
|
|
525
547
|
/** Language of the agent's own messages (default "en"). */
|
|
@@ -533,12 +555,14 @@ type YuktaiGridAgentProps = {
|
|
|
533
555
|
rowKey?: string;
|
|
534
556
|
/** Replace the built-in regex intent parser (e.g. with an on-device LLM). */
|
|
535
557
|
parseIntent?: (text: string, context: GridIntentContext) => GridIntent | null;
|
|
558
|
+
/** Application-defined content rules executed before the generic intent parser. */
|
|
559
|
+
customRules?: YuktaiGridRule<T>[];
|
|
536
560
|
/** How many steps to keep in history (default 20). */
|
|
537
561
|
historyLimit?: number;
|
|
538
562
|
};
|
|
539
563
|
/** Built-in parser: exported so it can be tested and reused. */
|
|
540
564
|
declare function parseGridIntent(text: string, context: GridIntentContext): GridIntent | null;
|
|
541
|
-
declare function useYuktaiGridAgent({ tools, onResult, onError, locale, columns, rowKey, parseIntent, historyLimit, }: YuktaiGridAgentProps): {
|
|
565
|
+
declare function useYuktaiGridAgent<T = Record<string, unknown>>({ tools, data, onResult, onError, locale, columns, rowKey, parseIntent, customRules, historyLimit, }: YuktaiGridAgentProps<T>): {
|
|
542
566
|
loading: boolean;
|
|
543
567
|
tools: GridAgentTool[];
|
|
544
568
|
executeTool: (name: string, input?: Record<string, unknown>) => Promise<GridAgentResult<unknown>>;
|