@yuktishaalaa/yuktai 5.3.9 → 5.3.11
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/README.md +70 -982
- package/dist/agent-SZENB4QE.mjs +18 -0
- package/dist/agentic/a11yCopilot.d.ts +32 -0
- package/dist/agentic/contextIndex.d.ts +58 -0
- package/dist/agentic/designReview.d.ts +26 -0
- package/dist/agentic/dom.d.ts +42 -0
- package/dist/agentic/formReview.d.ts +38 -0
- package/dist/agentic/gridQuery.d.ts +64 -0
- package/dist/agentic/index.d.ts +13 -0
- package/dist/agentic/insights.d.ts +62 -0
- package/dist/agentic/pageInsights.d.ts +47 -0
- package/dist/agentic/qaAudit.d.ts +59 -0
- package/dist/agentic/react.d.ts +52 -0
- package/dist/agentic/rust/ragCoreWasm.d.ts +3 -0
- package/dist/agentic/rust/ragEngine.d.ts +32 -0
- package/dist/agentic/taskRunner.d.ts +34 -0
- package/dist/agentic/voiceA11yCommands.d.ts +74 -0
- package/dist/chunk-K2IBRN5C.mjs +1 -0
- package/dist/chunk-M2OKTFX3.mjs +11 -0
- package/dist/chunk-N2HHE7YH.mjs +1 -0
- package/dist/core/a11yEngine.d.ts +5 -0
- package/dist/core/ai/agent.d.ts +21 -0
- package/dist/core/ai/labeller.d.ts +12 -0
- package/dist/core/ai/promptOptions.d.ts +16 -0
- package/dist/core/ai/rag.d.ts +7 -0
- package/dist/core/ai/rewriter.d.ts +13 -0
- package/dist/core/ai/summarizer.d.ts +8 -0
- package/dist/core/ai/transformers-rag.d.ts +9 -0
- package/dist/core/ai/translator.d.ts +14 -0
- package/dist/core/ai/voice.d.ts +33 -0
- package/dist/core/codegen/page-templates.d.ts +32 -0
- package/dist/core/codegen/requirement-parser.d.ts +12 -0
- package/dist/core/codegen/zip-generator.d.ts +2 -0
- package/dist/core/generateUI.d.ts +4 -0
- package/dist/core/renderer.d.ts +72 -0
- package/dist/grid/YuktaiGrid.d.ts +4 -0
- package/dist/grid/YuktaiGridAI.d.ts +46 -0
- package/dist/grid/YuktaiGridAgent.d.ts +81 -0
- package/dist/grid/YuktaiGridWebMCP.d.ts +54 -0
- package/dist/grid/gridTools.d.ts +111 -0
- package/dist/grid/rust/engine.d.ts +55 -0
- package/dist/grid/rust/gridCoreWasm.d.ts +3 -0
- package/dist/grid/rust/useGridCore.d.ts +2 -0
- package/dist/grid/types.d.ts +245 -0
- package/dist/grid/useGrid.d.ts +57 -0
- package/dist/grid/yuktaiGridRows.d.ts +35 -0
- package/dist/icons/CheckIcon.d.ts +2 -0
- package/dist/icons/ChevronLeftIcon.d.ts +2 -0
- package/dist/icons/ChevronRightIcon.d.ts +2 -0
- package/dist/icons/CloseIcon.d.ts +2 -0
- package/dist/icons/IconBase.d.ts +25 -0
- package/dist/icons/SearchIcon.d.ts +2 -0
- package/dist/icons/SortDownIcon.d.ts +2 -0
- package/dist/icons/SortUpIcon.d.ts +2 -0
- package/dist/icons/YuktaiIcon.d.ts +320 -0
- package/dist/icons/index.d.ts +16 -0
- package/dist/icons/paths.d.ts +167 -0
- package/dist/icons/variant.d.ts +42 -0
- package/dist/icons.d.mts +1 -567
- package/dist/icons.d.ts +1 -567
- package/dist/icons.js +1 -1
- package/dist/icons.mjs +1 -1
- package/dist/index.d.mts +2 -1336
- package/dist/index.d.ts +36 -1314
- package/dist/index.js +69 -76
- package/dist/index.mjs +42 -49
- package/dist/next/YuktAIWrapper.d.ts +2 -0
- package/dist/plugins/ai.d.ts +4 -0
- package/dist/plugins/voice.d.ts +4 -0
- package/dist/plugins/wcag.d.ts +98 -0
- package/dist/rag-O3FDQPTX.mjs +1 -0
- package/dist/react/CodeGenPanel.d.ts +7 -0
- package/dist/react/WidgetPanel.d.ts +38 -0
- package/dist/react/YuktAIWrapper.d.ts +35 -0
- package/dist/renderer.global.js +23 -30
- package/dist/runtime/runtime.d.ts +18 -0
- package/package.json +11 -8
- package/vanilla/index.js +77 -42
- package/vanilla/index.min.js +45 -52
- package/dist/agent-G67IA7MY.mjs +0 -18
- package/dist/chunk-7BGINZ5U.mjs +0 -1
- package/dist/chunk-P2PBML6K.mjs +0 -11
- package/dist/rag-Q3LUXSSD.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,1336 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { AbcIcon, AccessibilityIcon, AdminIcon, AlertIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, ApiIcon, ArchitectureIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, BarChartIcon, BoldIcon, BookIcon, BookmarkIcon, BrainIcon, BugReportIcon, BulbIcon, CakeIcon, CalendarIcon, CardsIcon, ChatIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsIcon, CleaningIcon, ClockIcon, CloseIcon, CloudIcon, CodeIcon, ComputerIcon, ContrastIcon, CopyIcon, DashboardIcon, DataObjectIcon, DeleteIcon, DocumentScannerIcon, DownloadIcon, DragHandleIcon, ExploreIcon, ExternalIcon, EyeIcon, EyeOffIcon, FactCheckIcon, FileIcon, FilterIcon, FirstIcon, FontIcon, FormIcon, FullscreenExitIcon, FullscreenIcon, GavelIcon, GiftIcon, GlobeIcon, GridIcon, HeadphonesIcon, HeartFilledIcon, HeartIcon, HelpIcon, HomeIcon, HubIcon, ICON_MIN_CONTRAST, ICON_NAMES, ICON_PATHS, IconBase, IconName, IconProps, IconShape, IconSvgOptions, IconVariant, ImageIcon, ImageSearchIcon, InfoIcon, InsightsIcon, InstallIcon, IntegrationIcon, ItalicIcon, JoinIcon, KeyIcon, KeyboardIcon, LabelIcon, LampIcon, LastIcon, LayoutIcon, LinkIcon, LoaderIcon, LockIcon, LoginIcon, LogoutIcon, MapIcon, MeditateIcon, MenuIcon, MergeIcon, MicIcon, MinusIcon, MoonIcon, MotionIcon, MovieIcon, MusicIcon, MusicOffIcon, MusicVideoIcon, NamaskarIcon, PageBreakIcon, PaletteIcon, PauseIcon, PenIcon, PersonIcon, PhoneIcon, PinIcon, PlayIcon, PlugIcon, PlusIcon, QuoteIcon, RadioCheckedIcon, RadioIcon, ReadingIcon, RedoIcon, RepeatIcon, ResetIcon, RobotIcon, SaveIcon, SchoolIcon, SearchIcon, SearchOffIcon, SendIcon, SentimentSadIcon, ShareIcon, ShieldCheckIcon, ShuffleIcon, SkipIcon, SlideshowIcon, SortDownIcon, SortIcon, SortUpIcon, SparkIcon, SpeakerIcon, SpeedIcon, SpellcheckIcon, StarIcon, StopIcon, StorageIcon, StyleIcon, SunIcon, SunriseIcon, SunsetIcon, SwapIcon, TargetIcon, TempleIcon, TextIcon, TitleIcon, ToolsIcon, TouchIcon, TrendingDownIcon, TrendingUpIcon, TrophyIcon, UnderlineIcon, UndoIcon, UnlockIcon, UploadIcon, UsersIcon, VolumeOffIcon, VolunteerIcon, WalletIcon, WandIcon, WifiIcon, WifiOffIcon, YuktaiIcon, YuktaiIconProps, ZoomInIcon, ZoomOutIcon, iconContrast, iconSvg, pickGlyphColor } from './icons.mjs';
|
|
4
|
-
|
|
5
|
-
interface Plugin {
|
|
6
|
-
name: string;
|
|
7
|
-
execute(input: any): any | Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
declare class Runtime {
|
|
10
|
-
private plugins;
|
|
11
|
-
register(name: string, plugin: Plugin): void;
|
|
12
|
-
/**
|
|
13
|
-
* 🔹 Direct Plugin Access
|
|
14
|
-
* This is what YuktAI.use(name) calls.
|
|
15
|
-
*/
|
|
16
|
-
use(name: string): Plugin | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* 🔹 Run task
|
|
19
|
-
*/
|
|
20
|
-
run(task: string, input: unknown): Promise<unknown>;
|
|
21
|
-
getPlugins(): string[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type ColorBlindMode = "none" | "deuteranopia" | "protanopia" | "tritanopia" | "achromatopsia";
|
|
25
|
-
type Severity = "critical" | "serious" | "moderate" | "minor";
|
|
26
|
-
type AlertType = "success" | "error" | "info" | "warning";
|
|
27
|
-
interface A11yConfig {
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
highContrast?: boolean;
|
|
30
|
-
darkMode?: boolean;
|
|
31
|
-
reduceMotion?: boolean;
|
|
32
|
-
autoFix?: boolean;
|
|
33
|
-
fontSizeMultiplier?: number;
|
|
34
|
-
colorBlindMode?: ColorBlindMode;
|
|
35
|
-
keyboardHints?: boolean;
|
|
36
|
-
speechEnabled?: boolean;
|
|
37
|
-
showPreferencePanel?: boolean;
|
|
38
|
-
showAuditBadge?: boolean;
|
|
39
|
-
showSkipLinks?: boolean;
|
|
40
|
-
largeTargets?: boolean;
|
|
41
|
-
timeoutWarning?: number;
|
|
42
|
-
dyslexiaFont?: boolean;
|
|
43
|
-
localFont?: string;
|
|
44
|
-
plainEnglish?: boolean;
|
|
45
|
-
summarisePage?: boolean;
|
|
46
|
-
translateLanguage?: string;
|
|
47
|
-
voiceControl?: boolean;
|
|
48
|
-
smartLabels?: boolean;
|
|
49
|
-
}
|
|
50
|
-
interface A11yFix {
|
|
51
|
-
tag: string;
|
|
52
|
-
fix: string;
|
|
53
|
-
severity: Severity;
|
|
54
|
-
element: string;
|
|
55
|
-
}
|
|
56
|
-
interface A11yReport {
|
|
57
|
-
fixed: number;
|
|
58
|
-
scanned: number;
|
|
59
|
-
renderTime: number;
|
|
60
|
-
score: number;
|
|
61
|
-
details: A11yFix[];
|
|
62
|
-
}
|
|
63
|
-
declare function speak(text: string, priority?: "polite" | "assertive"): void;
|
|
64
|
-
declare function showVisualAlert(message: string, type?: AlertType): void;
|
|
65
|
-
declare function announce(message: string, type?: AlertType, useSpeech?: boolean): void;
|
|
66
|
-
declare function trapFocus(modal: HTMLElement): void;
|
|
67
|
-
declare function handlePlainEnglish(enabled: boolean): Promise<void>;
|
|
68
|
-
declare function handleSummarisePage(enabled: boolean): Promise<void>;
|
|
69
|
-
declare function handleTranslate(language: string): Promise<void>;
|
|
70
|
-
declare function handleVoiceControl(enabled: boolean): Promise<void>;
|
|
71
|
-
declare function handleSmartLabels(enabled: boolean): Promise<void>;
|
|
72
|
-
declare const wcagPlugin: {
|
|
73
|
-
name: string;
|
|
74
|
-
version: string;
|
|
75
|
-
observer: MutationObserver | null;
|
|
76
|
-
execute(config: A11yConfig): Promise<string>;
|
|
77
|
-
applyFixes(config: A11yConfig): A11yReport;
|
|
78
|
-
scan(): A11yReport;
|
|
79
|
-
startObserver(config: A11yConfig): void;
|
|
80
|
-
stopObserver(): void;
|
|
81
|
-
announce: typeof announce;
|
|
82
|
-
speak: typeof speak;
|
|
83
|
-
showVisualAlert: typeof showVisualAlert;
|
|
84
|
-
trapFocus: typeof trapFocus;
|
|
85
|
-
handlePlainEnglish: typeof handlePlainEnglish;
|
|
86
|
-
handleSummarisePage: typeof handleSummarisePage;
|
|
87
|
-
handleTranslate: typeof handleTranslate;
|
|
88
|
-
handleVoiceControl: typeof handleVoiceControl;
|
|
89
|
-
handleSmartLabels: typeof handleSmartLabels;
|
|
90
|
-
SUPPORTED_LANGUAGES: {
|
|
91
|
-
code: string;
|
|
92
|
-
label: string;
|
|
93
|
-
}[];
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/** Which engine sorts and searches the grid. */
|
|
97
|
-
type GridEngine = "ts" | "rust" | "auto";
|
|
98
|
-
/** `engine: "auto"` switches to Rust from this many rows. */
|
|
99
|
-
declare const RUST_AUTO_MIN_ROWS = 10000;
|
|
100
|
-
declare function wantsRustEngine(engine: GridEngine | undefined, rowCount: number): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Compiles the Rust engine once per page. Resolves `null` when WebAssembly is
|
|
103
|
-
* not available; the grid then simply keeps using TypeScript.
|
|
104
|
-
*/
|
|
105
|
-
declare function loadGridCore(): Promise<WebAssembly.Module | null>;
|
|
106
|
-
/**
|
|
107
|
-
* One engine per grid. Holds that grid's search text inside the WebAssembly
|
|
108
|
-
* memory, so each keystroke only sends the query.
|
|
109
|
-
*/
|
|
110
|
-
declare class GridCore {
|
|
111
|
-
private readonly x;
|
|
112
|
-
private readonly base;
|
|
113
|
-
private readonly encoder;
|
|
114
|
-
private offsetsPtr;
|
|
115
|
-
private textPtr;
|
|
116
|
-
private textLen;
|
|
117
|
-
private rows;
|
|
118
|
-
private hasIndex;
|
|
119
|
-
private freePtr;
|
|
120
|
-
private constructor();
|
|
121
|
-
/** Creates an engine from a compiled module (default: the one already loaded). */
|
|
122
|
-
static create(mod?: WebAssembly.Module | null): GridCore | null;
|
|
123
|
-
private ensure;
|
|
124
|
-
/**
|
|
125
|
-
* Stores one search text per row (the grid joins its columns with
|
|
126
|
-
* SEARCH_SEPARATOR). Returns false when Rust can't match TypeScript
|
|
127
|
-
* exactly for this data; the grid then searches in TypeScript.
|
|
128
|
-
*/
|
|
129
|
-
setSearchTexts(texts: string[]): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Positions (in the array given to setSearchTexts) of the rows whose text
|
|
132
|
-
* contains `query`, in original order. Null means "use TypeScript".
|
|
133
|
-
*/
|
|
134
|
-
search(query: string): Uint32Array | null;
|
|
135
|
-
/**
|
|
136
|
-
* Row positions sorted by `keys` (NaN = empty, always last; equal keys keep
|
|
137
|
-
* their order). Null means "use TypeScript".
|
|
138
|
-
*/
|
|
139
|
-
sortByKeys(keys: Float64Array, desc: boolean): Uint32Array | null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
interface YuktAIWrapperProps {
|
|
143
|
-
position?: "left" | "right";
|
|
144
|
-
children: ReactNode;
|
|
145
|
-
config?: Partial<A11yConfig>;
|
|
146
|
-
showRag?: boolean;
|
|
147
|
-
showAgent?: boolean;
|
|
148
|
-
/** v5.3.9 — show ♿ Accessibility. Setting this (or showVibeCoder/launcher) switches every button to opt-in. */
|
|
149
|
-
showAccessibility?: boolean;
|
|
150
|
-
/** v5.3.9 — show ⚡ Vibe Coder (a developer tool; in legacy mode it follows showAgent). */
|
|
151
|
-
showVibeCoder?: boolean;
|
|
152
|
-
/** v5.3.9 — one ✨ button that shows/hides the others; remembers the choice; Esc closes. */
|
|
153
|
-
launcher?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* v5.3.9 — 💬 Ask page finds passages first with the page RAG ("rust",
|
|
156
|
-
* "auto" or "ts"), shows them at once, then lets Gemini Nano /
|
|
157
|
-
* Transformers.js write the answer from only those passages.
|
|
158
|
-
* Not set: 💬 works exactly as before.
|
|
159
|
-
*/
|
|
160
|
-
engine?: GridEngine;
|
|
161
|
-
}
|
|
162
|
-
declare function YuktAIWrapper({ position, children, config: configOverrides, showRag, showAgent, showAccessibility, showVibeCoder, launcher, engine, }: YuktAIWrapperProps): react__default.JSX.Element;
|
|
163
|
-
|
|
164
|
-
declare const aiPlugin: {
|
|
165
|
-
name: string;
|
|
166
|
-
execute(input: string): Promise<string>;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
declare const voicePlugin: {
|
|
170
|
-
name: string;
|
|
171
|
-
execute(input: string): Promise<string>;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/** One search/sort run: what was searched, how long it took, which engine answered. */
|
|
175
|
-
interface GridSearchTime {
|
|
176
|
-
/** The search text ("" when only sorting) */
|
|
177
|
-
query: string;
|
|
178
|
-
/** Milliseconds for search + filters + sort */
|
|
179
|
-
ms: number;
|
|
180
|
-
/** Rows after search and filters */
|
|
181
|
-
rows: number;
|
|
182
|
-
engine: "rust" | "ts";
|
|
183
|
-
}
|
|
184
|
-
interface GridColumn<T = Record<string, unknown>> {
|
|
185
|
-
key: keyof T & string;
|
|
186
|
-
label: string;
|
|
187
|
-
sortable?: boolean;
|
|
188
|
-
filterable?: boolean;
|
|
189
|
-
hiddenOnMobile?: boolean;
|
|
190
|
-
pinned?: boolean;
|
|
191
|
-
width?: number | string;
|
|
192
|
-
render?: (value: T[keyof T], row: T, index: number) => ReactNode;
|
|
193
|
-
align?: "left" | "center" | "right";
|
|
194
|
-
type?: "text" | "number" | "date" | "boolean" | "badge";
|
|
195
|
-
}
|
|
196
|
-
type SortDirection = "asc" | "desc" | null;
|
|
197
|
-
interface SortConfig {
|
|
198
|
-
key: string;
|
|
199
|
-
direction: SortDirection;
|
|
200
|
-
}
|
|
201
|
-
type FilterOperator = "contains" | "equals" | "startsWith" | "endsWith" | "greaterThan" | "lessThan" | "between";
|
|
202
|
-
interface FilterConfig {
|
|
203
|
-
key: string;
|
|
204
|
-
operator: FilterOperator;
|
|
205
|
-
value: string | number | [number, number];
|
|
206
|
-
}
|
|
207
|
-
type ViewMode = "table" | "card" | "auto";
|
|
208
|
-
type GridTheme = "default" | "high-contrast" | "dark" | "color-blind" | "dyslexia";
|
|
209
|
-
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";
|
|
210
|
-
type GridLocale = "en-IN" | "en-US" | IndicLanguageLocale;
|
|
211
|
-
type GridInputLanguage = GridLocale;
|
|
212
|
-
interface AIFeatures {
|
|
213
|
-
search?: boolean;
|
|
214
|
-
summary?: boolean;
|
|
215
|
-
anomaly?: boolean;
|
|
216
|
-
suggest?: boolean;
|
|
217
|
-
}
|
|
218
|
-
interface VoiceFeatures {
|
|
219
|
-
control?: boolean;
|
|
220
|
-
speakOnFocus?: boolean;
|
|
221
|
-
speakSummary?: boolean;
|
|
222
|
-
language?: string;
|
|
223
|
-
}
|
|
224
|
-
interface PaginationConfig {
|
|
225
|
-
pageSize?: number;
|
|
226
|
-
showSizeChanger?: boolean;
|
|
227
|
-
sizeOptions?: number[];
|
|
228
|
-
}
|
|
229
|
-
interface GridTranslations {
|
|
230
|
-
search: string;
|
|
231
|
-
noData: string;
|
|
232
|
-
loading: string;
|
|
233
|
-
rowsSelected: string;
|
|
234
|
-
page: string;
|
|
235
|
-
of: string;
|
|
236
|
-
showing: string;
|
|
237
|
-
to: string;
|
|
238
|
-
results: string;
|
|
239
|
-
sort: string;
|
|
240
|
-
filter: string;
|
|
241
|
-
export: string;
|
|
242
|
-
voice: string;
|
|
243
|
-
ask: string;
|
|
244
|
-
}
|
|
245
|
-
interface YuktaiGridRuleContext<T = Record<string, unknown>> {
|
|
246
|
-
/**
|
|
247
|
-
* Original user input.
|
|
248
|
-
*/
|
|
249
|
-
input: string;
|
|
250
|
-
/**
|
|
251
|
-
* Current grid data.
|
|
252
|
-
*/
|
|
253
|
-
data: T[];
|
|
254
|
-
/**
|
|
255
|
-
* Available grid columns.
|
|
256
|
-
*/
|
|
257
|
-
columns: {
|
|
258
|
-
key: string;
|
|
259
|
-
label: string;
|
|
260
|
-
}[];
|
|
261
|
-
/**
|
|
262
|
-
* Execute one of the generic Grid tools.
|
|
263
|
-
*
|
|
264
|
-
* Example:
|
|
265
|
-
*
|
|
266
|
-
* executeTool("count")
|
|
267
|
-
*
|
|
268
|
-
* executeTool("filter", {
|
|
269
|
-
* key: "lines",
|
|
270
|
-
* operator: "greaterThan",
|
|
271
|
-
* value: 6
|
|
272
|
-
* })
|
|
273
|
-
*/
|
|
274
|
-
executeTool: (name: string, input?: Record<string, unknown>) => Promise<{
|
|
275
|
-
success: boolean;
|
|
276
|
-
message: string;
|
|
277
|
-
data?: unknown;
|
|
278
|
-
error?: {
|
|
279
|
-
code: string;
|
|
280
|
-
};
|
|
281
|
-
tool?: string;
|
|
282
|
-
}>;
|
|
283
|
-
}
|
|
284
|
-
interface YuktaiGridRule<T = Record<string, unknown>> {
|
|
285
|
-
/**
|
|
286
|
-
* Application-defined rule name.
|
|
287
|
-
*/
|
|
288
|
-
name: string;
|
|
289
|
-
/**
|
|
290
|
-
* User phrases that activate this rule.
|
|
291
|
-
*/
|
|
292
|
-
phrases: string[];
|
|
293
|
-
/**
|
|
294
|
-
* Optional description for documentation/debugging.
|
|
295
|
-
*/
|
|
296
|
-
description?: string;
|
|
297
|
-
/**
|
|
298
|
-
* Application-specific execution logic.
|
|
299
|
-
*
|
|
300
|
-
* The package does NOT contain application-specific rules.
|
|
301
|
-
*/
|
|
302
|
-
execute: (context: YuktaiGridRuleContext<T>) => Promise<string> | string;
|
|
303
|
-
}
|
|
304
|
-
interface YuktaiGridProps<T = Record<string, unknown>> {
|
|
305
|
-
data: T[];
|
|
306
|
-
columns: GridColumn<T>[];
|
|
307
|
-
view?: ViewMode;
|
|
308
|
-
mobileBreakpoint?: number;
|
|
309
|
-
theme?: GridTheme;
|
|
310
|
-
locale?: GridLocale;
|
|
311
|
-
ai?: boolean | AIFeatures;
|
|
312
|
-
voice?: boolean | VoiceFeatures;
|
|
313
|
-
pagination?: boolean | PaginationConfig;
|
|
314
|
-
search?: boolean;
|
|
315
|
-
selectable?: boolean;
|
|
316
|
-
selectedKeys?: string[];
|
|
317
|
-
rowKey?: keyof T & string;
|
|
318
|
-
loading?: boolean;
|
|
319
|
-
empty?: ReactNode;
|
|
320
|
-
highlightIds?: (string | number)[];
|
|
321
|
-
highlightColor?: string;
|
|
322
|
-
autoScrollToHighlight?: boolean;
|
|
323
|
-
onSelectionChange?: (keys: string[]) => void;
|
|
324
|
-
onRowClick?: (row: T, index: number) => void;
|
|
325
|
-
onSortChange?: (sort: SortConfig | null) => void;
|
|
326
|
-
className?: string;
|
|
327
|
-
/**
|
|
328
|
-
* Voice/input language of the embedded assistant.
|
|
329
|
-
*
|
|
330
|
-
* Supports English and the 22 Indian Scheduled Languages.
|
|
331
|
-
*/
|
|
332
|
-
inputLanguage?: "en-IN" | "en-US" | IndicLanguageLocale;
|
|
333
|
-
/**
|
|
334
|
-
* Prefix for WebMCP / Agent tool names.
|
|
335
|
-
*
|
|
336
|
-
* Example:
|
|
337
|
-
*
|
|
338
|
-
* "ratnalabala_poems"
|
|
339
|
-
*
|
|
340
|
-
* produces:
|
|
341
|
-
*
|
|
342
|
-
* ratnalabala_poems_search
|
|
343
|
-
* ratnalabala_poems_filter
|
|
344
|
-
* ratnalabala_poems_sort
|
|
345
|
-
*/
|
|
346
|
-
toolName?: string;
|
|
347
|
-
/**
|
|
348
|
-
* Agent-facing tool descriptions.
|
|
349
|
-
*/
|
|
350
|
-
toolDescriptions?: Partial<Record<"search" | "count" | "columns" | "get_row" | "highlight" | "select" | "open" | "filter" | "clear_filters" | "sort" | "clear_sort", string>>;
|
|
351
|
-
/**
|
|
352
|
-
* Expose Grid tools to AI agents through WebMCP.
|
|
353
|
-
*/
|
|
354
|
-
webmcp?: boolean;
|
|
355
|
-
/**
|
|
356
|
-
* Real WebMCP registration status.
|
|
357
|
-
*/
|
|
358
|
-
onWebMCPStatusChange?: (status: {
|
|
359
|
-
state: "unsupported" | "registering" | "ready" | "partial" | "error";
|
|
360
|
-
registered: string[];
|
|
361
|
-
errors: {
|
|
362
|
-
tool: string;
|
|
363
|
-
message: string;
|
|
364
|
-
}[];
|
|
365
|
-
}) => void;
|
|
366
|
-
/**
|
|
367
|
-
* Application-specific Agent rules.
|
|
368
|
-
*
|
|
369
|
-
* Example:
|
|
370
|
-
*
|
|
371
|
-
* customRules={[
|
|
372
|
-
* {
|
|
373
|
-
* name: "show-long-poems",
|
|
374
|
-
* phrases: ["పెద్ద పద్యాలు"],
|
|
375
|
-
* execute: async ({ executeTool }) => {
|
|
376
|
-
* const result = await executeTool("filter", {
|
|
377
|
-
* key: "lines",
|
|
378
|
-
* operator: "greaterThan",
|
|
379
|
-
* value: 6,
|
|
380
|
-
* })
|
|
381
|
-
*
|
|
382
|
-
* return result.message
|
|
383
|
-
* },
|
|
384
|
-
* },
|
|
385
|
-
* ]}
|
|
386
|
-
*/
|
|
387
|
-
customRules?: YuktaiGridRule<T>[];
|
|
388
|
-
/**
|
|
389
|
-
* Search and sort engine.
|
|
390
|
-
*
|
|
391
|
-
* - "ts" (default): TypeScript, as before
|
|
392
|
-
* - "rust": the Rust (WebAssembly) engine, about 13 KB, embedded
|
|
393
|
-
* - "auto": Rust from 10,000 rows, TypeScript below
|
|
394
|
-
*
|
|
395
|
-
* Results are identical. Rust handles search and number/date sorting;
|
|
396
|
-
* text sorting always uses TypeScript (browser locale rules for Telugu).
|
|
397
|
-
*/
|
|
398
|
-
engine?: GridEngine;
|
|
399
|
-
/**
|
|
400
|
-
* Show how long the last search/sort took and which engine answered,
|
|
401
|
-
* next to the row count, e.g. "12 rows · 0.9 ms · Rust". Default: false.
|
|
402
|
-
*/
|
|
403
|
-
showSearchTime?: boolean;
|
|
404
|
-
/** Called after every search or sort with its time and engine. */
|
|
405
|
-
onSearchTime?: (info: GridSearchTime) => void;
|
|
406
|
-
/**
|
|
407
|
-
* Every result from the Agent.
|
|
408
|
-
*/
|
|
409
|
-
onAgentResult?: (result: {
|
|
410
|
-
success: boolean;
|
|
411
|
-
message: string;
|
|
412
|
-
tool?: string;
|
|
413
|
-
}) => void;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
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, engine, showSearchTime, onSearchTime, }: YuktaiGridProps<T>): react__default.JSX.Element;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* gridTools — the ONE place where YuktaiGrid tools are defined.
|
|
420
|
-
*
|
|
421
|
-
* Both the in-page Agent (useYuktaiGridAgent) and WebMCP (YuktaiGridWebMCP)
|
|
422
|
-
* should get their tools from `createGridTools()`, so the list an agent sees
|
|
423
|
-
* can never drift from the list the UI shows.
|
|
424
|
-
*
|
|
425
|
-
* Rules every tool follows:
|
|
426
|
-
* 1. One row-ID strategy: `getRowId(row, context.rowKey)` everywhere.
|
|
427
|
-
* `rowKey` must match YuktaiGrid's `rowKey` prop (default "id").
|
|
428
|
-
* 2. One result shape: { success, message, data?, error?: { code } }.
|
|
429
|
-
* 3. Never claim success for something that didn't happen:
|
|
430
|
-
* missing callback → NOT_SUPPORTED, unknown row → NOT_FOUND.
|
|
431
|
-
* 4. Never throw: tool execution is wrapped, errors become INTERNAL results.
|
|
432
|
-
*
|
|
433
|
-
* Backward compatible with 4.6.x: the existing exports keep their names and
|
|
434
|
-
* parameters; results only gain an optional `error` field.
|
|
435
|
-
*/
|
|
436
|
-
type GridToolColumn = {
|
|
437
|
-
key: string;
|
|
438
|
-
label: string;
|
|
439
|
-
type?: "text" | "number" | "date";
|
|
440
|
-
};
|
|
441
|
-
type GridToolErrorCode = "NOT_FOUND" | "NOT_SUPPORTED" | "INVALID_INPUT" | "INTERNAL";
|
|
442
|
-
type GridToolFilterOperator = "contains" | "equals" | "startsWith" | "endsWith" | "greaterThan" | "lessThan" | "between";
|
|
443
|
-
type GridToolFilter = {
|
|
444
|
-
key: string;
|
|
445
|
-
operator: GridToolFilterOperator;
|
|
446
|
-
value: string | number | [number, number];
|
|
447
|
-
};
|
|
448
|
-
type GridToolSort = {
|
|
449
|
-
key: string;
|
|
450
|
-
direction: "asc" | "desc";
|
|
451
|
-
};
|
|
452
|
-
/** Language of `message` (shown to people). Agent descriptions stay English. */
|
|
453
|
-
type GridToolLocale = "en" | "te";
|
|
454
|
-
type GridToolContext<T> = {
|
|
455
|
-
data: T[];
|
|
456
|
-
columns: GridToolColumn[];
|
|
457
|
-
/** Field used as the row ID by every tool (default "id"). Match YuktaiGrid's rowKey. */
|
|
458
|
-
rowKey?: string;
|
|
459
|
-
/** Language for result messages (default "en"). */
|
|
460
|
-
locale?: GridToolLocale;
|
|
461
|
-
/** Filters currently applied, so a new filter can be merged in. */
|
|
462
|
-
filters?: GridToolFilter[];
|
|
463
|
-
onSelectRow?: (id: string) => void;
|
|
464
|
-
onHighlightRows?: (ids: string[]) => void;
|
|
465
|
-
onOpenRow?: (id: string) => void;
|
|
466
|
-
onFiltersChange?: (filters: GridToolFilter[]) => void;
|
|
467
|
-
onSortChange?: (sort: GridToolSort | null) => void;
|
|
468
|
-
};
|
|
469
|
-
type GridToolResult<T = unknown> = {
|
|
470
|
-
success: boolean;
|
|
471
|
-
message: string;
|
|
472
|
-
data?: T;
|
|
473
|
-
error?: {
|
|
474
|
-
code: GridToolErrorCode;
|
|
475
|
-
};
|
|
476
|
-
};
|
|
477
|
-
/** A tool ready for the Agent and for WebMCP `registerTool`. */
|
|
478
|
-
type GridTool = {
|
|
479
|
-
name: string;
|
|
480
|
-
title: string;
|
|
481
|
-
/** For AI agents (English works best for tool selection). Never shown in the UI. */
|
|
482
|
-
description: string;
|
|
483
|
-
/** Short label for the UI, in the grid's locale. */
|
|
484
|
-
label: string;
|
|
485
|
-
inputSchema: Record<string, unknown>;
|
|
486
|
-
execute: (input: Record<string, unknown>) => Promise<GridToolResult>;
|
|
487
|
-
};
|
|
488
|
-
type CreateGridToolsOptions = {
|
|
489
|
-
/** Tool name prefix, e.g. "ratnalabala_poems" → "ratnalabala_poems_search". */
|
|
490
|
-
name?: string;
|
|
491
|
-
/** Override agent descriptions per tool, keyed by the short tool id ("search", "open", …). */
|
|
492
|
-
descriptions?: Partial<Record<GridToolId, string>>;
|
|
493
|
-
};
|
|
494
|
-
type GridToolId = "search" | "count" | "columns" | "get_row" | "highlight" | "select" | "open" | "filter" | "clear_filters" | "sort" | "clear_sort";
|
|
495
|
-
/** The single row-ID rule used by every tool. */
|
|
496
|
-
declare function getRowId(row: unknown, rowKey?: string): string;
|
|
497
|
-
/**
|
|
498
|
-
* Applies filters to rows — exported so YuktaiGrid filters its rows with
|
|
499
|
-
* exactly the same rules the filter tool uses to count matches.
|
|
500
|
-
*/
|
|
501
|
-
declare function applyGridFilters<T>(data: T[], columns: GridToolColumn[], filters: GridToolFilter[]): T[];
|
|
502
|
-
/** Maps grid columns (any type) to tool columns (text / number / date). */
|
|
503
|
-
declare function toGridToolColumns(columns: {
|
|
504
|
-
key: string;
|
|
505
|
-
label: string;
|
|
506
|
-
type?: string;
|
|
507
|
-
}[]): GridToolColumn[];
|
|
508
|
-
declare function searchGrid<T extends Record<string, unknown>>(context: GridToolContext<T>, query: string): GridToolResult<T[]>;
|
|
509
|
-
declare function countGrid<T>(context: GridToolContext<T>): GridToolResult<number>;
|
|
510
|
-
declare function getColumns<T>(context: GridToolContext<T>): GridToolResult<GridToolColumn[]>;
|
|
511
|
-
declare function getRow<T extends Record<string, unknown>>(context: GridToolContext<T>, id: string): GridToolResult<T>;
|
|
512
|
-
declare function highlightRows<T extends Record<string, unknown>>(context: GridToolContext<T>, ids: string[]): GridToolResult<string[]>;
|
|
513
|
-
declare function selectRow<T extends Record<string, unknown>>(context: GridToolContext<T>, id: string): GridToolResult<string>;
|
|
514
|
-
declare function openRow<T extends Record<string, unknown>>(context: GridToolContext<T>, id: string): GridToolResult<string>;
|
|
515
|
-
declare function filterGrid<T extends Record<string, unknown>>(context: GridToolContext<T>, filter: GridToolFilter): GridToolResult<{
|
|
516
|
-
filters: GridToolFilter[];
|
|
517
|
-
count: number;
|
|
518
|
-
}>;
|
|
519
|
-
declare function clearFilters<T>(context: GridToolContext<T>): GridToolResult<GridToolFilter[]>;
|
|
520
|
-
declare function sortGrid<T>(context: GridToolContext<T>, key: string, direction?: "asc" | "desc"): GridToolResult<GridToolSort>;
|
|
521
|
-
declare function clearSort<T>(context: GridToolContext<T>): GridToolResult<null>;
|
|
522
|
-
/**
|
|
523
|
-
* Builds the tool list used by BOTH the Agent and WebMCP.
|
|
524
|
-
* Only tools the grid can actually perform are included — e.g. "open" is
|
|
525
|
-
* left out when no onOpenRow callback is given — so agents never see a tool
|
|
526
|
-
* that would just return NOT_SUPPORTED.
|
|
527
|
-
*/
|
|
528
|
-
declare function createGridTools<T extends Record<string, unknown>>(context: GridToolContext<T>, options?: CreateGridToolsOptions): GridTool[];
|
|
529
|
-
|
|
530
|
-
interface UseGridOptions<T> {
|
|
531
|
-
data: T[];
|
|
532
|
-
columns: GridColumn<T>[];
|
|
533
|
-
pagination?: boolean | PaginationConfig;
|
|
534
|
-
mobileBreakpoint?: number;
|
|
535
|
-
/** Locale for text sorting, e.g. "te-IN" (default: browser locale) */
|
|
536
|
-
locale?: string;
|
|
537
|
-
/** Starting filters (optional) */
|
|
538
|
-
initialFilters?: GridToolFilter[];
|
|
539
|
-
/**
|
|
540
|
-
* Search and sort engine: "ts" (default), "rust" (always) or "auto" (Rust
|
|
541
|
-
* from 10,000 rows). Same results either way; Rust is faster on big data.
|
|
542
|
-
*/
|
|
543
|
-
engine?: GridEngine;
|
|
544
|
-
}
|
|
545
|
-
interface UseGridReturn<T> {
|
|
546
|
-
displayedData: T[];
|
|
547
|
-
/** All matching rows (search + filters + sort), before pagination */
|
|
548
|
-
rows: T[];
|
|
549
|
-
totalCount: number;
|
|
550
|
-
filteredCount: number;
|
|
551
|
-
sort: SortConfig | null;
|
|
552
|
-
toggleSort: (key: string) => void;
|
|
553
|
-
/** Set sort directly (null clears it) */
|
|
554
|
-
setSort: (sort: SortConfig | null) => void;
|
|
555
|
-
clearSort: () => void;
|
|
556
|
-
searchQuery: string;
|
|
557
|
-
setSearchQuery: (q: string) => void;
|
|
558
|
-
filters: GridToolFilter[];
|
|
559
|
-
setFilters: (filters: GridToolFilter[]) => void;
|
|
560
|
-
/** Add or replace the filter for one column */
|
|
561
|
-
setFilter: (filter: GridToolFilter) => void;
|
|
562
|
-
/** Remove the filter for one column */
|
|
563
|
-
removeFilter: (key: string) => void;
|
|
564
|
-
clearFilters: () => void;
|
|
565
|
-
page: number;
|
|
566
|
-
pageSize: number;
|
|
567
|
-
totalPages: number;
|
|
568
|
-
setPage: (p: number) => void;
|
|
569
|
-
setPageSize: (s: number) => void;
|
|
570
|
-
isMobile: boolean;
|
|
571
|
-
reset: () => void;
|
|
572
|
-
/** Last search/sort: time in ms and which engine answered (null when neither ran) */
|
|
573
|
-
searchTime: GridSearchTime | null;
|
|
574
|
-
}
|
|
575
|
-
declare function useGrid<T extends Record<string, unknown>>(options: UseGridOptions<T>): UseGridReturn<T>;
|
|
576
|
-
|
|
577
|
-
type UILanguage = "en-US" | "te-IN";
|
|
578
|
-
type InputLanguage = GridInputLanguage;
|
|
579
|
-
interface YuktaiGridAIProps<T> {
|
|
580
|
-
data: T[];
|
|
581
|
-
columns: {
|
|
582
|
-
key: string;
|
|
583
|
-
label: string;
|
|
584
|
-
type?: "number" | "text" | "date";
|
|
585
|
-
}[];
|
|
586
|
-
onSearch?: (query: string) => void;
|
|
587
|
-
onSort?: (key: string, dir: "asc" | "desc") => void;
|
|
588
|
-
theme?: "light" | "dark";
|
|
589
|
-
/**
|
|
590
|
-
* Language of AI UI and AI responses.
|
|
591
|
-
* Default: English.
|
|
592
|
-
*/
|
|
593
|
-
language?: UILanguage;
|
|
594
|
-
/**
|
|
595
|
-
* Language used by browser voice recognition.
|
|
596
|
-
* Default: English.
|
|
597
|
-
*/
|
|
598
|
-
inputLanguage?: InputLanguage;
|
|
599
|
-
/**
|
|
600
|
-
* When true, AI is rendered inside the grid.
|
|
601
|
-
* When false, AI uses the floating assistant UI.
|
|
602
|
-
*/
|
|
603
|
-
embedded?: boolean;
|
|
604
|
-
/**
|
|
605
|
-
* The grid Agent.
|
|
606
|
-
*/
|
|
607
|
-
agent?: {
|
|
608
|
-
ask: (text: string) => Promise<{
|
|
609
|
-
success: boolean;
|
|
610
|
-
message: string;
|
|
611
|
-
}>;
|
|
612
|
-
loading?: boolean;
|
|
613
|
-
};
|
|
614
|
-
/**
|
|
615
|
-
* Called when the person switches the voice input language.
|
|
616
|
-
*/
|
|
617
|
-
onInputLanguageChange?: (language: InputLanguage) => void;
|
|
618
|
-
}
|
|
619
|
-
declare function YuktaiGridAI<T extends Record<string, unknown>>({ data, columns, onSearch, onSort, theme, language, inputLanguage, embedded, agent, onInputLanguageChange, }: YuktaiGridAIProps<T>): react__default.JSX.Element;
|
|
620
|
-
|
|
621
|
-
type ModelContextTool = {
|
|
622
|
-
name: string;
|
|
623
|
-
title: string;
|
|
624
|
-
description: string;
|
|
625
|
-
inputSchema: Record<string, unknown>;
|
|
626
|
-
execute: (input: any) => Promise<unknown> | unknown;
|
|
627
|
-
};
|
|
628
|
-
declare global {
|
|
629
|
-
interface Document {
|
|
630
|
-
modelContext?: {
|
|
631
|
-
registerTool: (tool: ModelContextTool, options?: {
|
|
632
|
-
signal?: AbortSignal;
|
|
633
|
-
}) => Promise<void>;
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
type WebMCPState = "unsupported" | "registering" | "ready" | "partial" | "error";
|
|
638
|
-
type WebMCPStatus = {
|
|
639
|
-
state: WebMCPState;
|
|
640
|
-
/** Tools that the browser actually accepted */
|
|
641
|
-
registered: string[];
|
|
642
|
-
errors: {
|
|
643
|
-
tool: string;
|
|
644
|
-
message: string;
|
|
645
|
-
}[];
|
|
646
|
-
};
|
|
647
|
-
type WebMCPColumn = {
|
|
648
|
-
key: string;
|
|
649
|
-
label: string;
|
|
650
|
-
type?: "text" | "number" | "date";
|
|
651
|
-
};
|
|
652
|
-
type YuktaiGridWebMCPProps<T> = {
|
|
653
|
-
/**
|
|
654
|
-
* Ready-made tools (YuktaiGrid passes its own list here). When given,
|
|
655
|
-
* data/columns/callbacks below are not needed.
|
|
656
|
-
*/
|
|
657
|
-
tools?: GridTool[];
|
|
658
|
-
data?: T[];
|
|
659
|
-
columns?: WebMCPColumn[];
|
|
660
|
-
rowKey?: string;
|
|
661
|
-
locale?: GridToolLocale;
|
|
662
|
-
onSelectRow?: (id: string) => void;
|
|
663
|
-
onHighlightRows?: (ids: string[]) => void;
|
|
664
|
-
onOpenRow?: (id: string) => void;
|
|
665
|
-
/** Tool name prefix (default "yuktai_grid") */
|
|
666
|
-
name?: string;
|
|
667
|
-
/** Agent-facing descriptions per tool, e.g. { search: "Search Telugu poems…" } */
|
|
668
|
-
descriptions?: CreateGridToolsOptions["descriptions"];
|
|
669
|
-
/** Called whenever the registration status changes */
|
|
670
|
-
onStatusChange?: (status: WebMCPStatus) => void;
|
|
671
|
-
};
|
|
672
|
-
declare function YuktaiGridWebMCP<T extends Record<string, unknown>>({ tools: toolsProp, data, columns, rowKey, locale, onSelectRow, onHighlightRows, onOpenRow, name, descriptions, onStatusChange, }: YuktaiGridWebMCPProps<T>): null;
|
|
673
|
-
|
|
674
|
-
type GridAgentTool = {
|
|
675
|
-
name: string;
|
|
676
|
-
description: string;
|
|
677
|
-
/** Optional UI label (e.g. Telugu). createGridTools() provides it. */
|
|
678
|
-
label?: string;
|
|
679
|
-
/** Optional JSON schema; its `required` list is checked before running. */
|
|
680
|
-
inputSchema?: Record<string, unknown>;
|
|
681
|
-
execute: (input: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
682
|
-
};
|
|
683
|
-
type GridAgentErrorCode = GridToolErrorCode | "NOT_UNDERSTOOD";
|
|
684
|
-
type GridAgentResult<T = unknown> = Omit<GridToolResult<T>, "error"> & {
|
|
685
|
-
error?: {
|
|
686
|
-
code: GridAgentErrorCode;
|
|
687
|
-
};
|
|
688
|
-
/** Full name of the tool that produced this result */
|
|
689
|
-
tool?: string;
|
|
690
|
-
};
|
|
691
|
-
type GridAgentStep = {
|
|
692
|
-
id: number;
|
|
693
|
-
tool: string;
|
|
694
|
-
input: Record<string, unknown>;
|
|
695
|
-
result: GridAgentResult;
|
|
696
|
-
source: "tool" | "ask";
|
|
697
|
-
at: number;
|
|
698
|
-
};
|
|
699
|
-
type GridIntent = {
|
|
700
|
-
kind: "tool";
|
|
701
|
-
tool: string;
|
|
702
|
-
input: Record<string, unknown>;
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* "open <something>": search for it, then open the first match
|
|
706
|
-
*/
|
|
707
|
-
| {
|
|
708
|
-
kind: "open";
|
|
709
|
-
text: string;
|
|
710
|
-
};
|
|
711
|
-
type GridIntentContext = {
|
|
712
|
-
columns: {
|
|
713
|
-
key: string;
|
|
714
|
-
label: string;
|
|
715
|
-
}[];
|
|
716
|
-
locale: GridToolLocale;
|
|
717
|
-
};
|
|
718
|
-
type YuktaiGridAgentProps<T = Record<string, unknown>> = {
|
|
719
|
-
tools: GridAgentTool[];
|
|
720
|
-
/** Current grid data available to application-defined rules. */
|
|
721
|
-
data?: T[];
|
|
722
|
-
onResult?: (result: GridAgentResult) => void;
|
|
723
|
-
onError?: (error: Error) => void;
|
|
724
|
-
/** Language of the agent's own messages (default "en"). */
|
|
725
|
-
locale?: GridToolLocale;
|
|
726
|
-
/** Columns, so ask() can understand "sort by <column>". */
|
|
727
|
-
columns?: {
|
|
728
|
-
key: string;
|
|
729
|
-
label: string;
|
|
730
|
-
}[];
|
|
731
|
-
/** Row ID field — must match the grid's rowKey (default "id"). */
|
|
732
|
-
rowKey?: string;
|
|
733
|
-
/** Replace the built-in regex intent parser. */
|
|
734
|
-
parseIntent?: (text: string, context: GridIntentContext) => GridIntent | null;
|
|
735
|
-
/** Application-defined content rules executed before the generic intent parser. */
|
|
736
|
-
customRules?: YuktaiGridRule<T>[];
|
|
737
|
-
/** How many steps to keep in history (default 20). */
|
|
738
|
-
historyLimit?: number;
|
|
739
|
-
};
|
|
740
|
-
/** Built-in parser: exported so it can be tested and reused. */
|
|
741
|
-
declare function parseGridIntent(text: string, context: GridIntentContext): GridIntent | null;
|
|
742
|
-
declare function useYuktaiGridAgent<T = Record<string, unknown>>({ tools, data, onResult, onError, locale, columns, rowKey, parseIntent: customParseIntent, customRules, historyLimit, }: YuktaiGridAgentProps<T>): {
|
|
743
|
-
loading: boolean;
|
|
744
|
-
tools: GridAgentTool[];
|
|
745
|
-
executeTool: (name: string, input?: Record<string, unknown>) => Promise<GridAgentResult<unknown>>;
|
|
746
|
-
ask: (text: string) => Promise<GridAgentResult>;
|
|
747
|
-
lastResult: GridAgentResult<unknown> | null;
|
|
748
|
-
lastError: Error | null;
|
|
749
|
-
history: GridAgentStep[];
|
|
750
|
-
clearHistory: () => void;
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
type AuditRoot = Document | Element;
|
|
754
|
-
/** The label a screen reader would most likely announce for this element. */
|
|
755
|
-
declare function accessibleName(el: Element): string;
|
|
756
|
-
type RGBA = {
|
|
757
|
-
r: number;
|
|
758
|
-
g: number;
|
|
759
|
-
b: number;
|
|
760
|
-
a: number;
|
|
761
|
-
};
|
|
762
|
-
declare function parseColor(value: string | null | undefined): RGBA | null;
|
|
763
|
-
declare function relativeLuminance(c: RGBA): number;
|
|
764
|
-
declare function contrastRatio(fg: RGBA, bg: RGBA): number;
|
|
765
|
-
|
|
766
|
-
type AuditSeverity = "critical" | "serious" | "moderate" | "minor";
|
|
767
|
-
type AuditRuleId = "html-lang" | "page-title" | "image-alt" | "heading-order" | "single-h1" | "landmark-main" | "form-label" | "button-name" | "link-name" | "color-contrast" | "positive-tabindex" | "keyboard-access" | "duplicate-id" | "form-error" | "target-size";
|
|
768
|
-
interface AuditIssue {
|
|
769
|
-
/** Stable within one report, e.g. "image-alt-3". */
|
|
770
|
-
id: string;
|
|
771
|
-
rule: AuditRuleId;
|
|
772
|
-
severity: AuditSeverity;
|
|
773
|
-
/** WCAG success criterion, e.g. "1.1.1", or "best practice". */
|
|
774
|
-
wcag: string;
|
|
775
|
-
message: string;
|
|
776
|
-
/** Why it matters, in plain English. */
|
|
777
|
-
why: string;
|
|
778
|
-
/** What to change. */
|
|
779
|
-
fix: string;
|
|
780
|
-
selector: string;
|
|
781
|
-
snippet: string;
|
|
782
|
-
/** True when the copilot can apply a safe fix in the browser. */
|
|
783
|
-
autoFixable: boolean;
|
|
784
|
-
element?: Element;
|
|
785
|
-
}
|
|
786
|
-
interface AuditCheck {
|
|
787
|
-
rule: AuditRuleId;
|
|
788
|
-
title: string;
|
|
789
|
-
passed: boolean;
|
|
790
|
-
issueCount: number;
|
|
791
|
-
}
|
|
792
|
-
interface AuditReport {
|
|
793
|
-
url: string;
|
|
794
|
-
title: string;
|
|
795
|
-
generatedAt: string;
|
|
796
|
-
score: number;
|
|
797
|
-
passed: boolean;
|
|
798
|
-
checks: AuditCheck[];
|
|
799
|
-
issues: AuditIssue[];
|
|
800
|
-
summary: string;
|
|
801
|
-
}
|
|
802
|
-
interface AuditOptions {
|
|
803
|
-
root?: AuditRoot;
|
|
804
|
-
/** Skip rules you don't need. */
|
|
805
|
-
skip?: AuditRuleId[];
|
|
806
|
-
/** Cap contrast checks on very large pages (default 600 elements). */
|
|
807
|
-
maxContrastChecks?: number;
|
|
808
|
-
/** Minimum interactive target size in CSS px (WCAG 2.5.8 uses 24). */
|
|
809
|
-
minTargetSize?: number;
|
|
810
|
-
}
|
|
811
|
-
interface RuleInfo {
|
|
812
|
-
title: string;
|
|
813
|
-
wcag: string;
|
|
814
|
-
severity: AuditSeverity;
|
|
815
|
-
why: string;
|
|
816
|
-
}
|
|
817
|
-
declare const AUDIT_RULES: Record<AuditRuleId, RuleInfo>;
|
|
818
|
-
declare function runQaAudit(options?: AuditOptions): AuditReport;
|
|
819
|
-
/** Markdown report you can download, paste into a ticket or attach to a PR. */
|
|
820
|
-
declare function auditToMarkdown(report: AuditReport): string;
|
|
821
|
-
/** JSON without DOM references, safe to store or send to a server. */
|
|
822
|
-
declare function auditToJSON(report: AuditReport): string;
|
|
823
|
-
|
|
824
|
-
interface CopilotFixResult {
|
|
825
|
-
issueId: string;
|
|
826
|
-
applied: boolean;
|
|
827
|
-
message: string;
|
|
828
|
-
}
|
|
829
|
-
interface CopilotState {
|
|
830
|
-
report: AuditReport | null;
|
|
831
|
-
watching: boolean;
|
|
832
|
-
appliedFixes: number;
|
|
833
|
-
}
|
|
834
|
-
interface A11yCopilotOptions extends AuditOptions {
|
|
835
|
-
/** Called after every scan (initial, manual or caused by DOM changes). */
|
|
836
|
-
onUpdate?: (state: CopilotState) => void;
|
|
837
|
-
/** Wait this long after DOM changes before rescanning (default 600ms). */
|
|
838
|
-
debounceMs?: number;
|
|
839
|
-
/** Apply every safe fix automatically after each scan (default false). */
|
|
840
|
-
autoApply?: boolean;
|
|
841
|
-
/** Language used when the page has no lang attribute (default: browser language). */
|
|
842
|
-
defaultLang?: string;
|
|
843
|
-
}
|
|
844
|
-
interface A11yCopilot {
|
|
845
|
-
start(): void;
|
|
846
|
-
stop(): void;
|
|
847
|
-
scan(): AuditReport;
|
|
848
|
-
explain(issueId: string): string;
|
|
849
|
-
applyFix(issueId: string): CopilotFixResult;
|
|
850
|
-
applyAllFixes(): CopilotFixResult[];
|
|
851
|
-
undoAll(): number;
|
|
852
|
-
getState(): CopilotState;
|
|
853
|
-
}
|
|
854
|
-
declare function createA11yCopilot(options?: A11yCopilotOptions): A11yCopilot;
|
|
855
|
-
|
|
856
|
-
interface PageOutline {
|
|
857
|
-
title: string;
|
|
858
|
-
description: string;
|
|
859
|
-
language: string;
|
|
860
|
-
headings: Array<{
|
|
861
|
-
level: number;
|
|
862
|
-
text: string;
|
|
863
|
-
}>;
|
|
864
|
-
landmarks: Record<string, number>;
|
|
865
|
-
counts: {
|
|
866
|
-
links: number;
|
|
867
|
-
buttons: number;
|
|
868
|
-
images: number;
|
|
869
|
-
forms: number;
|
|
870
|
-
tables: number;
|
|
871
|
-
fields: number;
|
|
872
|
-
};
|
|
873
|
-
unlabeledFields: Array<{
|
|
874
|
-
type: string;
|
|
875
|
-
hint: string;
|
|
876
|
-
selector: string;
|
|
877
|
-
}>;
|
|
878
|
-
imagesWithoutAlt: Array<{
|
|
879
|
-
src: string;
|
|
880
|
-
selector: string;
|
|
881
|
-
}>;
|
|
882
|
-
purpose: string;
|
|
883
|
-
}
|
|
884
|
-
interface PageAnswer {
|
|
885
|
-
intent: PageIntent;
|
|
886
|
-
answer: string;
|
|
887
|
-
/** Elements the answer refers to, so the UI can highlight them. */
|
|
888
|
-
targets: string[];
|
|
889
|
-
suggestions: string[];
|
|
890
|
-
}
|
|
891
|
-
type PageIntent = "purpose" | "missing-labels" | "images" | "structure" | "forms" | "links" | "counts" | "unknown";
|
|
892
|
-
declare function analyzePage(root?: AuditRoot): PageOutline;
|
|
893
|
-
declare function detectPageIntent(question: string): PageIntent;
|
|
894
|
-
/**
|
|
895
|
-
* Answers a question about the current page.
|
|
896
|
-
* @param summarize Optional hook (e.g. Gemini Nano or your own model) used for "purpose" questions.
|
|
897
|
-
*/
|
|
898
|
-
declare function askAboutPage(question: string, options?: {
|
|
899
|
-
root?: AuditRoot;
|
|
900
|
-
summarize?: (pageText: string) => Promise<string>;
|
|
901
|
-
}): Promise<PageAnswer>;
|
|
902
|
-
|
|
903
|
-
interface ParsedGridQuery {
|
|
904
|
-
filters: GridToolFilter[];
|
|
905
|
-
/** Free-text terms that didn't map to a column; matched across all columns. */
|
|
906
|
-
search: string[];
|
|
907
|
-
sort: GridToolSort | null;
|
|
908
|
-
limit: number | null;
|
|
909
|
-
/** Assumptions the parser made (shown to the user so they can correct it). */
|
|
910
|
-
notes: string[];
|
|
911
|
-
/** Plain-English reading of the query. */
|
|
912
|
-
explanation: string;
|
|
913
|
-
}
|
|
914
|
-
interface GridQueryResult<T> {
|
|
915
|
-
rows: T[];
|
|
916
|
-
ids: string[];
|
|
917
|
-
parsed: ParsedGridQuery;
|
|
918
|
-
message: string;
|
|
919
|
-
}
|
|
920
|
-
type Row = Record<string, unknown>;
|
|
921
|
-
/** "₹10,000" → 10000, "1.5 lakh" → 150000, "2cr" → 20000000, "10k" → 10000. */
|
|
922
|
-
declare function parseAmount(text: string): number | null;
|
|
923
|
-
/** The column mentioned in `text` (longest name wins), or undefined. */
|
|
924
|
-
declare function findMentionedColumn(text: string, columns: GridToolColumn[], kind?: GridToolColumn["type"]): GridToolColumn | undefined;
|
|
925
|
-
interface ParseOptions<T = Row> {
|
|
926
|
-
/** Rows let the parser recognise values like "overdue" in a Status column. */
|
|
927
|
-
data?: T[];
|
|
928
|
-
}
|
|
929
|
-
declare function parseGridQuery<T = Row>(query: string, columns: GridToolColumn[], options?: ParseOptions<T>): ParsedGridQuery;
|
|
930
|
-
/** Runs a parsed query over rows without touching any UI. */
|
|
931
|
-
declare function executeGridQuery<T>(data: T[], columns: GridToolColumn[], parsed: ParsedGridQuery): T[];
|
|
932
|
-
/**
|
|
933
|
-
* Parses and runs a natural-language query, then pushes the result into the
|
|
934
|
-
* grid through the context callbacks (filters, sort, highlight).
|
|
935
|
-
*/
|
|
936
|
-
declare function runGridQuery<T>(query: string, context: GridToolContext<T>, options?: {
|
|
937
|
-
apply?: boolean;
|
|
938
|
-
}): GridQueryResult<T>;
|
|
939
|
-
interface GridAnomaly {
|
|
940
|
-
rowId: string;
|
|
941
|
-
column: string;
|
|
942
|
-
label: string;
|
|
943
|
-
value: unknown;
|
|
944
|
-
kind: "high" | "low" | "duplicate";
|
|
945
|
-
reason: string;
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Finds unusual rows: numeric values far outside the typical range
|
|
949
|
-
* (interquartile-range rule) and rows that duplicate another row.
|
|
950
|
-
*/
|
|
951
|
-
declare function detectAnomalies<T>(data: T[], columns: GridToolColumn[], options?: {
|
|
952
|
-
rowKey?: string;
|
|
953
|
-
factor?: number;
|
|
954
|
-
columns?: string[];
|
|
955
|
-
}): GridAnomaly[];
|
|
956
|
-
declare function summarizeRows<T>(rows: T[], columns: GridToolColumn[]): string;
|
|
957
|
-
interface GridAnswer<T> {
|
|
958
|
-
kind: "query" | "anomalies" | "summary";
|
|
959
|
-
message: string;
|
|
960
|
-
ids: string[];
|
|
961
|
-
rows: T[];
|
|
962
|
-
anomalies?: GridAnomaly[];
|
|
963
|
-
}
|
|
964
|
-
declare function answerGridQuestion<T>(question: string, context: GridToolContext<T>): GridAnswer<T>;
|
|
965
|
-
|
|
966
|
-
type GridNavAction = "next-row" | "previous-row" | "first-row" | "last-row" | "open-row";
|
|
967
|
-
type VoiceA11yCommand = {
|
|
968
|
-
type: "setting";
|
|
969
|
-
patch: Partial<A11yConfig>;
|
|
970
|
-
say: string;
|
|
971
|
-
} | {
|
|
972
|
-
type: "reset";
|
|
973
|
-
say: string;
|
|
974
|
-
} | {
|
|
975
|
-
type: "grid";
|
|
976
|
-
action: GridNavAction;
|
|
977
|
-
say: string;
|
|
978
|
-
};
|
|
979
|
-
declare const FONT_STEP = 0.1;
|
|
980
|
-
declare const FONT_MIN = 0.8;
|
|
981
|
-
declare const FONT_MAX = 1.3;
|
|
982
|
-
/**
|
|
983
|
-
* Parses a transcript into a command. `current` is needed for relative
|
|
984
|
-
* changes such as "bigger text". Returns null when nothing matched, so you
|
|
985
|
-
* can pass the transcript on to other handlers (e.g. core/ai/voice.ts).
|
|
986
|
-
*/
|
|
987
|
-
declare function parseVoiceA11yCommand(transcript: string, current?: Partial<A11yConfig>): VoiceA11yCommand | null;
|
|
988
|
-
declare const DEFAULT_A11Y_SETTINGS: Partial<A11yConfig>;
|
|
989
|
-
declare function moveGridRowFocus(action: GridNavAction, options?: {
|
|
990
|
-
root?: ParentNode;
|
|
991
|
-
rowSelector?: string;
|
|
992
|
-
}): HTMLElement | null;
|
|
993
|
-
interface VoiceA11yControllerOptions {
|
|
994
|
-
/** Current settings; the controller keeps its own copy after each change. */
|
|
995
|
-
initial?: Partial<A11yConfig>;
|
|
996
|
-
/**
|
|
997
|
-
* Apply new settings. Default: yuktai's wcagPlugin.execute.
|
|
998
|
-
* Pass your own to sync with WidgetPanel state or a settings store.
|
|
999
|
-
*/
|
|
1000
|
-
apply?: (config: A11yConfig) => unknown;
|
|
1001
|
-
/** Speech recognition language, e.g. "en-IN" or "te-IN" (default "en-IN"). */
|
|
1002
|
-
lang?: string;
|
|
1003
|
-
/** Speak a confirmation after each command (default true). */
|
|
1004
|
-
speak?: boolean;
|
|
1005
|
-
/** Called for every recognised transcript, matched or not. */
|
|
1006
|
-
onTranscript?: (text: string, command: VoiceA11yCommand | null) => void;
|
|
1007
|
-
gridRoot?: ParentNode;
|
|
1008
|
-
}
|
|
1009
|
-
declare function createVoiceA11yController(options?: VoiceA11yControllerOptions): {
|
|
1010
|
-
start: () => boolean;
|
|
1011
|
-
stop: () => void;
|
|
1012
|
-
/** Run a command from text (also handy for typed commands and tests). */
|
|
1013
|
-
handle: (transcript: string) => Promise<VoiceA11yCommand | null>;
|
|
1014
|
-
isListening: () => boolean;
|
|
1015
|
-
getConfig: () => {
|
|
1016
|
-
enabled: boolean;
|
|
1017
|
-
highContrast?: boolean;
|
|
1018
|
-
darkMode?: boolean;
|
|
1019
|
-
reduceMotion?: boolean;
|
|
1020
|
-
autoFix?: boolean;
|
|
1021
|
-
fontSizeMultiplier?: number;
|
|
1022
|
-
colorBlindMode?: ColorBlindMode;
|
|
1023
|
-
keyboardHints?: boolean;
|
|
1024
|
-
speechEnabled?: boolean;
|
|
1025
|
-
showPreferencePanel?: boolean;
|
|
1026
|
-
showAuditBadge?: boolean;
|
|
1027
|
-
showSkipLinks?: boolean;
|
|
1028
|
-
largeTargets?: boolean;
|
|
1029
|
-
timeoutWarning?: number;
|
|
1030
|
-
dyslexiaFont?: boolean;
|
|
1031
|
-
localFont?: string;
|
|
1032
|
-
plainEnglish?: boolean;
|
|
1033
|
-
summarisePage?: boolean;
|
|
1034
|
-
translateLanguage?: string;
|
|
1035
|
-
voiceControl?: boolean;
|
|
1036
|
-
smartLabels?: boolean;
|
|
1037
|
-
};
|
|
1038
|
-
};
|
|
1039
|
-
|
|
1040
|
-
type FormFindingLevel = "problem" | "improvement";
|
|
1041
|
-
interface FormField {
|
|
1042
|
-
label: string;
|
|
1043
|
-
type: string;
|
|
1044
|
-
name: string;
|
|
1045
|
-
required: boolean;
|
|
1046
|
-
hasVisibleLabel: boolean;
|
|
1047
|
-
selector: string;
|
|
1048
|
-
element: Element;
|
|
1049
|
-
}
|
|
1050
|
-
interface FormFinding {
|
|
1051
|
-
level: FormFindingLevel;
|
|
1052
|
-
message: string;
|
|
1053
|
-
suggestion: string;
|
|
1054
|
-
field?: string;
|
|
1055
|
-
selector?: string;
|
|
1056
|
-
}
|
|
1057
|
-
interface FormReview {
|
|
1058
|
-
name: string;
|
|
1059
|
-
selector: string;
|
|
1060
|
-
fields: FormField[];
|
|
1061
|
-
findings: FormFinding[];
|
|
1062
|
-
/** 0–100, higher is easier to complete. */
|
|
1063
|
-
score: number;
|
|
1064
|
-
summary: string;
|
|
1065
|
-
}
|
|
1066
|
-
interface FormReviewOptions {
|
|
1067
|
-
root?: AuditRoot;
|
|
1068
|
-
/** Extra checks for older users: font size, field count, vague buttons (default true). */
|
|
1069
|
-
seniorFriendly?: boolean;
|
|
1070
|
-
/** Forms with more fields than this get a "split into steps" suggestion (default 8). */
|
|
1071
|
-
maxFieldsPerStep?: number;
|
|
1072
|
-
}
|
|
1073
|
-
declare function readFormFields(form: Element): FormField[];
|
|
1074
|
-
declare function reviewForm(form: Element, options?: FormReviewOptions): FormReview;
|
|
1075
|
-
/** Reviews every <form> (and every role="form") on the page. */
|
|
1076
|
-
declare function reviewForms(options?: FormReviewOptions): FormReview[];
|
|
1077
|
-
|
|
1078
|
-
interface ContextPassage {
|
|
1079
|
-
id: string;
|
|
1080
|
-
source: "page" | "grid" | "custom";
|
|
1081
|
-
text: string;
|
|
1082
|
-
/** Grid row id or page section heading. */
|
|
1083
|
-
ref?: string;
|
|
1084
|
-
}
|
|
1085
|
-
interface ContextHit extends ContextPassage {
|
|
1086
|
-
score: number;
|
|
1087
|
-
}
|
|
1088
|
-
interface ContextAnswer {
|
|
1089
|
-
answer: string;
|
|
1090
|
-
hits: ContextHit[];
|
|
1091
|
-
/** True when `generate` produced the answer; false for extractive answers. */
|
|
1092
|
-
generated: boolean;
|
|
1093
|
-
}
|
|
1094
|
-
/** Unicode-aware tokens: keeps Telugu/Devanagari combining marks together. */
|
|
1095
|
-
declare function tokenize(text: string): string[];
|
|
1096
|
-
declare function pagePassages(root?: AuditRoot, maxChars?: number): ContextPassage[];
|
|
1097
|
-
declare function gridPassages<T>(data: T[], columns: GridToolColumn[], rowKey?: string): ContextPassage[];
|
|
1098
|
-
interface ContextIndexOptions<T = Record<string, unknown>> {
|
|
1099
|
-
/** Index the visible page text (default true). */
|
|
1100
|
-
includePage?: boolean;
|
|
1101
|
-
root?: AuditRoot;
|
|
1102
|
-
rows?: T[];
|
|
1103
|
-
columns?: GridToolColumn[];
|
|
1104
|
-
rowKey?: string;
|
|
1105
|
-
/** Extra documents, e.g. FAQ text or help articles. */
|
|
1106
|
-
documents?: Array<{
|
|
1107
|
-
id: string;
|
|
1108
|
-
text: string;
|
|
1109
|
-
}>;
|
|
1110
|
-
/**
|
|
1111
|
-
* Search engine: "ts" (default), "rust" (always) or "auto" (Rust from 1,000
|
|
1112
|
-
* passages). Same passages, same scores, same order; Rust is faster on long
|
|
1113
|
-
* pages and big grids. Works offline (the engine is embedded).
|
|
1114
|
-
*/
|
|
1115
|
-
engine?: GridEngine;
|
|
1116
|
-
}
|
|
1117
|
-
declare function createContextIndex<T>(options?: ContextIndexOptions<T>): {
|
|
1118
|
-
search: (question: string, k?: number) => ContextHit[];
|
|
1119
|
-
ask: (question: string, opts?: {
|
|
1120
|
-
k?: number;
|
|
1121
|
-
generate?: (question: string, context: string) => Promise<string>;
|
|
1122
|
-
}) => Promise<ContextAnswer>;
|
|
1123
|
-
/** Call after the page or data changes. */
|
|
1124
|
-
rebuild: () => void;
|
|
1125
|
-
update(next: Partial<ContextIndexOptions<T>>): void;
|
|
1126
|
-
size: () => number;
|
|
1127
|
-
/** "rust" when the Rust engine answers searches for this index, else "ts". */
|
|
1128
|
-
readonly engine: "rust" | "ts";
|
|
1129
|
-
/** Resolves "rust" or "ts" once the engine is loaded (or not wanted). */
|
|
1130
|
-
whenEngineReady: () => Promise<"ts" | "rust">;
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
type TaskAction = "filter" | "highlight" | "sort" | "clear" | "count" | "summarize" | "anomalies" | "open" | "select";
|
|
1134
|
-
interface PlannedStep {
|
|
1135
|
-
action: TaskAction;
|
|
1136
|
-
/** The part of the instruction this step came from. */
|
|
1137
|
-
text: string;
|
|
1138
|
-
}
|
|
1139
|
-
interface StepResult extends PlannedStep {
|
|
1140
|
-
success: boolean;
|
|
1141
|
-
message: string;
|
|
1142
|
-
ids?: string[];
|
|
1143
|
-
}
|
|
1144
|
-
interface TaskRunResult {
|
|
1145
|
-
steps: StepResult[];
|
|
1146
|
-
before: {
|
|
1147
|
-
rows: number;
|
|
1148
|
-
filters: GridToolFilter[];
|
|
1149
|
-
};
|
|
1150
|
-
after: {
|
|
1151
|
-
rows: number;
|
|
1152
|
-
filters: GridToolFilter[];
|
|
1153
|
-
sort: GridToolSort | null;
|
|
1154
|
-
highlighted: string[];
|
|
1155
|
-
};
|
|
1156
|
-
/** "What changed", in plain English. */
|
|
1157
|
-
summary: string;
|
|
1158
|
-
}
|
|
1159
|
-
/** Splits an instruction into ordered steps. No model needed. */
|
|
1160
|
-
declare function planTasks(instruction: string): PlannedStep[];
|
|
1161
|
-
interface RunTasksOptions {
|
|
1162
|
-
/** Called after each step, so the UI can show progress. */
|
|
1163
|
-
onStep?: (result: StepResult, index: number, total: number) => void;
|
|
1164
|
-
}
|
|
1165
|
-
declare function runTasks<T extends Record<string, unknown>>(instruction: string, context: GridToolContext<T>, options?: RunTasksOptions): Promise<TaskRunResult>;
|
|
1166
|
-
|
|
1167
|
-
type Aggregation = "sum" | "avg" | "count" | "min" | "max";
|
|
1168
|
-
type Period = "day" | "week" | "month" | "quarter" | "year";
|
|
1169
|
-
interface GroupResult {
|
|
1170
|
-
group: string;
|
|
1171
|
-
value: number;
|
|
1172
|
-
count: number;
|
|
1173
|
-
}
|
|
1174
|
-
interface PeriodChange {
|
|
1175
|
-
group: string;
|
|
1176
|
-
current: number;
|
|
1177
|
-
previous: number;
|
|
1178
|
-
change: number;
|
|
1179
|
-
/** null when the previous value was 0 */
|
|
1180
|
-
changePct: number | null;
|
|
1181
|
-
}
|
|
1182
|
-
interface PeriodComparison {
|
|
1183
|
-
period: Period;
|
|
1184
|
-
current: {
|
|
1185
|
-
from: Date;
|
|
1186
|
-
to: Date;
|
|
1187
|
-
};
|
|
1188
|
-
previous: {
|
|
1189
|
-
from: Date;
|
|
1190
|
-
to: Date;
|
|
1191
|
-
};
|
|
1192
|
-
rows: PeriodChange[];
|
|
1193
|
-
}
|
|
1194
|
-
declare function aggregate(values: number[], agg: Aggregation): number;
|
|
1195
|
-
/** Groups rows by a column and aggregates a metric (or counts rows). Sorted high → low. */
|
|
1196
|
-
declare function groupBy<T>(data: T[], groupKey: string, metricKey: string | null, agg?: Aggregation): GroupResult[];
|
|
1197
|
-
declare function startOfPeriod(date: Date, period: Period, weekStartsOn?: number): Date;
|
|
1198
|
-
declare function addPeriods(date: Date, period: Period, n: number): Date;
|
|
1199
|
-
interface ComparePeriodsOptions {
|
|
1200
|
-
dateKey: string;
|
|
1201
|
-
metricKey: string;
|
|
1202
|
-
groupKey?: string;
|
|
1203
|
-
agg?: Aggregation;
|
|
1204
|
-
period: Period;
|
|
1205
|
-
/** "Now" for the comparison (default: today). */
|
|
1206
|
-
referenceDate?: Date | string;
|
|
1207
|
-
/**
|
|
1208
|
-
* true (default): compare the same elapsed time — e.g. Mon–Wed this week
|
|
1209
|
-
* vs Mon–Wed last week — so a half-finished week doesn't look like a drop.
|
|
1210
|
-
*/
|
|
1211
|
-
toDate?: boolean;
|
|
1212
|
-
weekStartsOn?: number;
|
|
1213
|
-
}
|
|
1214
|
-
declare function comparePeriods<T>(data: T[], o: ComparePeriodsOptions): PeriodComparison;
|
|
1215
|
-
/** Time series: one aggregated value per period, oldest first. */
|
|
1216
|
-
declare function trend<T>(data: T[], dateKey: string, metricKey: string, period: Period, agg?: Aggregation): Array<{
|
|
1217
|
-
start: Date;
|
|
1218
|
-
value: number;
|
|
1219
|
-
}>;
|
|
1220
|
-
interface InsightAnswer {
|
|
1221
|
-
kind: "period-change" | "group" | "trend" | "total" | "unknown";
|
|
1222
|
-
answer: string;
|
|
1223
|
-
table: Array<Record<string, string | number>>;
|
|
1224
|
-
}
|
|
1225
|
-
declare function askInsight<T>(question: string, data: T[], columns: GridToolColumn[], options?: {
|
|
1226
|
-
referenceDate?: Date | string;
|
|
1227
|
-
}): InsightAnswer;
|
|
1228
|
-
|
|
1229
|
-
type DesignCategory = "hierarchy" | "readability" | "interaction" | "clutter" | "consistency";
|
|
1230
|
-
interface DesignFinding {
|
|
1231
|
-
category: DesignCategory;
|
|
1232
|
-
severity: "high" | "medium" | "low";
|
|
1233
|
-
message: string;
|
|
1234
|
-
suggestion: string;
|
|
1235
|
-
selector?: string;
|
|
1236
|
-
}
|
|
1237
|
-
interface DesignReview {
|
|
1238
|
-
score: number;
|
|
1239
|
-
categories: Record<DesignCategory, {
|
|
1240
|
-
score: number;
|
|
1241
|
-
findings: number;
|
|
1242
|
-
}>;
|
|
1243
|
-
findings: DesignFinding[];
|
|
1244
|
-
summary: string;
|
|
1245
|
-
}
|
|
1246
|
-
interface DesignReviewOptions {
|
|
1247
|
-
root?: AuditRoot;
|
|
1248
|
-
/** Minimum body text size in px (default 14; 16 recommended for seniors). */
|
|
1249
|
-
minFontSize?: number;
|
|
1250
|
-
/** Maximum comfortable line length in characters (default 90). */
|
|
1251
|
-
maxLineLength?: number;
|
|
1252
|
-
}
|
|
1253
|
-
declare function reviewDesign(options?: DesignReviewOptions): DesignReview;
|
|
1254
|
-
|
|
1255
|
-
interface UseAgenticGridOptions<T> {
|
|
1256
|
-
data: T[];
|
|
1257
|
-
columns: Array<{
|
|
1258
|
-
key: string;
|
|
1259
|
-
label: string;
|
|
1260
|
-
type?: string;
|
|
1261
|
-
}>;
|
|
1262
|
-
rowKey?: string;
|
|
1263
|
-
/** "Now" for questions like "this week" (default: today). */
|
|
1264
|
-
referenceDate?: Date | string;
|
|
1265
|
-
onOpenRow?: (id: string) => void;
|
|
1266
|
-
}
|
|
1267
|
-
type AgenticAnswerKind = "query" | "anomalies" | "summary" | "insight" | "tasks";
|
|
1268
|
-
declare function useAgenticGrid<T extends Record<string, unknown>>(options: UseAgenticGridOptions<T>): {
|
|
1269
|
-
/** Pass to <YuktaiGrid data={…}> */
|
|
1270
|
-
gridData: T[];
|
|
1271
|
-
/** Pass to <YuktaiGrid highlightIds={…}> */
|
|
1272
|
-
highlightIds: string[];
|
|
1273
|
-
filters: GridToolFilter[];
|
|
1274
|
-
sort: GridToolSort | null;
|
|
1275
|
-
ask: (question: string) => Promise<void>;
|
|
1276
|
-
reset: () => void;
|
|
1277
|
-
answer: string;
|
|
1278
|
-
kind: AgenticAnswerKind | null;
|
|
1279
|
-
table: Record<string, string | number>[];
|
|
1280
|
-
steps: StepResult[];
|
|
1281
|
-
busy: boolean;
|
|
1282
|
-
visibleIds: string[];
|
|
1283
|
-
};
|
|
1284
|
-
declare function AgenticGridBar({ grid, placeholder, examples, style, }: {
|
|
1285
|
-
grid: ReturnType<typeof useAgenticGrid<any>>;
|
|
1286
|
-
placeholder?: string;
|
|
1287
|
-
examples?: string[];
|
|
1288
|
-
style?: CSSProperties;
|
|
1289
|
-
}): react.JSX.Element;
|
|
1290
|
-
type Tab = "copilot" | "qa" | "forms" | "design" | "ask" | "voice";
|
|
1291
|
-
interface AgenticPanelProps {
|
|
1292
|
-
defaultTab?: Tab;
|
|
1293
|
-
/** Speech recognition language for the Voice tab (default "en-IN"). */
|
|
1294
|
-
voiceLang?: string;
|
|
1295
|
-
/** Optional model hook for Ask page, e.g. Gemini Nano or your own API. */
|
|
1296
|
-
generate?: (question: string, context: string) => Promise<string>;
|
|
1297
|
-
/** Ask page search engine: "ts" (default), "rust" or "auto". Same answers; Rust is faster on long pages. */
|
|
1298
|
-
engine?: GridEngine;
|
|
1299
|
-
style?: CSSProperties;
|
|
1300
|
-
}
|
|
1301
|
-
declare function AgenticPanel({ defaultTab, voiceLang, generate, engine, style }: AgenticPanelProps): react.JSX.Element;
|
|
1302
|
-
|
|
1303
|
-
declare global {
|
|
1304
|
-
var __yuktai_runtime__: Runtime | undefined;
|
|
1305
|
-
}
|
|
1306
|
-
declare const YuktAI: {
|
|
1307
|
-
wcagPlugin: {
|
|
1308
|
-
name: string;
|
|
1309
|
-
version: string;
|
|
1310
|
-
observer: MutationObserver | null;
|
|
1311
|
-
execute(config: A11yConfig): Promise<string>;
|
|
1312
|
-
applyFixes(config: A11yConfig): A11yReport;
|
|
1313
|
-
scan(): A11yReport;
|
|
1314
|
-
startObserver(config: A11yConfig): void;
|
|
1315
|
-
stopObserver(): void;
|
|
1316
|
-
announce: (message: string, type?: AlertType, useSpeech?: boolean) => void;
|
|
1317
|
-
speak: (text: string, priority?: "polite" | "assertive") => void;
|
|
1318
|
-
showVisualAlert: (message: string, type?: AlertType) => void;
|
|
1319
|
-
trapFocus: (modal: HTMLElement) => void;
|
|
1320
|
-
handlePlainEnglish: (enabled: boolean) => Promise<void>;
|
|
1321
|
-
handleSummarisePage: (enabled: boolean) => Promise<void>;
|
|
1322
|
-
handleTranslate: (language: string) => Promise<void>;
|
|
1323
|
-
handleVoiceControl: (enabled: boolean) => Promise<void>;
|
|
1324
|
-
handleSmartLabels: (enabled: boolean) => Promise<void>;
|
|
1325
|
-
SUPPORTED_LANGUAGES: {
|
|
1326
|
-
code: string;
|
|
1327
|
-
label: string;
|
|
1328
|
-
}[];
|
|
1329
|
-
};
|
|
1330
|
-
list(): string[];
|
|
1331
|
-
use(name: string): Plugin | undefined;
|
|
1332
|
-
fix(config?: Partial<A11yConfig>): A11yReport;
|
|
1333
|
-
scan(): A11yReport;
|
|
1334
|
-
};
|
|
1335
|
-
|
|
1336
|
-
export { type A11yConfig, type A11yCopilot, type A11yCopilotOptions, type A11yFix, type A11yReport, type AIFeatures, AUDIT_RULES, type AgenticAnswerKind, AgenticGridBar, AgenticPanel, type AgenticPanelProps, type Aggregation, type AuditCheck, type AuditIssue, type AuditOptions, type AuditReport, type AuditRoot, type AuditRuleId, type AuditSeverity, type ColorBlindMode, type ComparePeriodsOptions, type ContextAnswer, type ContextHit, type ContextIndexOptions, type ContextPassage, type CopilotFixResult, type CopilotState, type CreateGridToolsOptions, DEFAULT_A11Y_SETTINGS, type DesignCategory, type DesignFinding, type DesignReview, type DesignReviewOptions, FONT_MAX, FONT_MIN, FONT_STEP, type FilterConfig, type FilterOperator, type FormField, type FormFinding, type FormFindingLevel, type FormReview, type FormReviewOptions, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridAnomaly, type GridAnswer, type GridColumn, GridCore, type GridEngine, type GridInputLanguage, type GridIntent, type GridIntentContext, type GridLocale, type GridNavAction, type GridQueryResult, type GridSearchTime, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, type GroupResult, type IndicLanguageLocale, type InsightAnswer, type PageAnswer, type PageIntent, type PageOutline, type PaginationConfig, type ParseOptions, type ParsedGridQuery, type Period, type PeriodChange, type PeriodComparison, type PlannedStep, type RGBA, RUST_AUTO_MIN_ROWS, type RunTasksOptions, Runtime, type Severity, type SortConfig, type SortDirection, type StepResult, type TaskAction, type TaskRunResult, type UseAgenticGridOptions, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceA11yCommand, type VoiceA11yControllerOptions, 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, accessibleName, addPeriods, aggregate, aiPlugin, analyzePage, answerGridQuestion, applyGridFilters, askAboutPage, askInsight, auditToJSON, auditToMarkdown, clearFilters, clearSort, comparePeriods, contrastRatio, countGrid, createA11yCopilot, createContextIndex, createGridTools, createVoiceA11yController, YuktAIWrapper as default, detectAnomalies, detectPageIntent, executeGridQuery, filterGrid, findMentionedColumn, getColumns, getRow, getRowId, gridPassages, groupBy, highlightRows, loadGridCore, moveGridRowFocus, openRow, pagePassages, parseAmount, parseColor, parseGridIntent, parseGridQuery, parseVoiceA11yCommand, planTasks, readFormFields, relativeLuminance, reviewDesign, reviewForm, reviewForms, runGridQuery, runQaAudit, runTasks, searchGrid, selectRow, sortGrid, startOfPeriod, summarizeRows, toGridToolColumns, tokenize, trend, useAgenticGrid, useGrid, useYuktaiGridAgent, voicePlugin, wantsRustEngine, wcagPlugin as wcag, wcagPlugin };
|
|
1
|
+
export * from "./index";
|
|
2
|
+
export { default } from "./index";
|