@progress/kendo-react-mcp 1.6.1 → 1.6.2-beta.cd97a7ec.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.js CHANGED
@@ -1,15 +1,804 @@
1
1
  #!/usr/bin/env node
2
- import{McpServer as St}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Tt}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as ct,join as lt}from"path";import{fileURLToPath as dt}from"url";import{loadLicense as Je,decodeLicenseKey as Xe,decodeLicenseEvidence as Ze}from"@progress/kendo-licensing/utils";var B=class extends Error{constructor(t){super(t),this.name="LicenseError"}};function te(e){return e.replace(/^\uFEFF/,"")}async function oe(e){let t=null,n=null;try{let o=Je();if(!o.success){let s=new B(o.message);throw e&&await e("license_load_failed",{error:o.message}).catch(()=>{}),s}try{t=(await Xe(o.value)).licenses.find(async r=>!!(await Ze(r)).userId)}catch(s){console.log(s.message),e&&await e("license_load_failed",{error:s.message||"Unknown decoding error"}).catch(()=>{})}if(!t)return[te(o.value),null]}catch(o){return n=o.message||"Unknown error loading license.",e&&await e("license_load_failed",{error:n}).catch(()=>{}),[null,n]}return[te(t),null]}import P from"node:fs";import U from"node:path";var q=!1,E=process.env.DEBUG_LOG_FILE,ne=!!(E&&typeof E=="string");if(ne){let e=U.resolve(E),t=U.dirname(e);if(t!=="."&&t!==process.cwd()&&!P.existsSync(t))try{P.mkdirSync(t,{recursive:!0})}catch(n){console.error("Error creating log directory:",n)}if(!P.existsSync(e))try{P.writeFileSync(e,"")}catch(n){console.error("Error creating log file:",n)}}else q=!1;q=ne&&!!E&&P.existsSync(U.resolve(E));function g(...e){if(q&&E){let o=`${new Date().toISOString()}: ${e.join(" ")}
3
- `,s=U.resolve(E);P.appendFile(s,o,r=>{r&&console.error("Error writing to log file:",r)})}}import et from"@grpc/proto-loader";import $ from"@grpc/grpc-js";import re from"path";import se from"fs";import{fileURLToPath as tt}from"url";var ot=tt(import.meta.url),nt=re.dirname(ot),ie={version:"unknown"},ae=re.resolve(nt,"../package.json");se.existsSync(ae)&&(ie=JSON.parse(se.readFileSync(ae,"utf-8")));function st(e){return e.replace(/\u2014/g,"--").replace(/\u2013/g,"-").replace(/[^\x20-\x7E]/g,"")}var M=class{constructor(t,n,o){this.contextApiUrl=t;this.protoPath=n;this.options=o;this.toolNameHeader="assistant";let s=et.loadSync(this.protoPath,{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0});this.isDev=this.contextApiUrl?.includes("localhost")||this.contextApiUrl?.includes("127.0.0.1"),g("Using ContextApi URl:",this.contextApiUrl);let r=$.loadPackageDefinition(s);this.client=new r.ContextQueryService(this.contextApiUrl||"contextapi.telerik.com:443",this.isDev?$.credentials.createInsecure():$.credentials.createSsl())}async getMetadata({meta:t}={meta:{}}){let[n,o]=this.isDev?["fake_license",null]:await oe((m,A)=>this.logEvent(m,A)),s=process.env.CONTEXTAPI_API_KEY,r=s&&typeof s=="string",a=n&&typeof n=="string";if(!a&&!r&&o)throw new Error(`Failed to authenticate with API key or License key!
4
2
 
5
- License Error: ${o}`);let i=new $.Metadata;if(a)try{i.add("x-license-key",n)}catch(m){throw g("Error adding license key to metadata:",m),new Error(`Failed to use license key: ${m.message}`)}r&&i.add("x-api-key",s),this.options?.libName&&i.add("x-library-name",this.options.libName),i.add("x-tool-name",this.toolNameHeader);let d=JSON.stringify({...t,source:"npm",version:ie.version,os:process.platform,node_version:process.version});return i.add("x-request-metadata",st(d)),i}async query(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.query(t,o,(a,i)=>{a?r(new Error(a)):s(i)})})}async getApiRefMatches(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.getApiRefMatches(t,o,(a,i)=>{a?r(new Error(a)):s(i)})})}async queryCssUtils(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.cssUtilsSearch(t,o,(a,i)=>{a?(g("Error querying CSS Utils:",a),r(new Error(a))):s(i)})})}async queryIconsSearch(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.iconsSearch(t,o,(a,i)=>{a?(g("Error querying Icons Search:",a),r(new Error(a))):s(i)})})}async queryBuildingBlocks(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.buildingBlocksSearch(t,o,(a,i)=>{a?(g("Error querying Building Blocks:",a),r(new Error(a))):s(i)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((n,o)=>{this.client.validateUserLicense(null,t,(s,r)=>{s?(g("Error validating user license:",s),o(new Error(s))):n(r)})})}async queryThemeGenerate(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.generateTheme(t,o,(a,i)=>{a?(g("Error querying context API/GenerateTheme:",a),r(new Error(a))):s(i)})})}async recordOrchestratorUserRequest({meta:t}){let n=await this.getMetadata({meta:t});return new Promise((o,s)=>{this.client.recordOrchestratorUserRequest(null,n,(r,a)=>{r?(g("Error recording orchestrator user request:",r),s(new Error(r))):o(a)})})}async recordToolUserRequest({toolName:t,meta:n}){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.recordToolUserRequest({tool_name:t},o,(a,i)=>{a?(g("Error recording tool user request:",a),r(new Error(a))):s(i)})})}async logEvent(t,n){let o="h8utJ6rk4PpIWX4JMn9beQDsjVUri6KV0XYfiVwq";if(!o||typeof o!="string"){g("LOGGING_API_KEY not configured, skipping log event");return}let s=new $.Metadata;return s.add("x-api-key",o),new Promise((r,a)=>{this.client.logEvent({event_name:t,fields:n||{}},s,(i,d)=>{i?(g("Error logging event:",i),a(new Error(i))):r()})})}};import{z as K}from"zod";var Ht=K.object({user_id:K.string(),user_email:K.string().email()});import{z as b}from"zod";var at=b.object({Product:b.object({Id:b.number().int(),Code:b.string(),Name:b.string()}),License:b.nullable(b.object({Id:b.number().int(),Name:b.string(),Type:b.string(),Active:b.boolean()})),Availability:b.array(b.object({LicenseStart:b.nullable(b.string().datetime()),LicenseEnd:b.nullable(b.string().datetime())})),IsLicenseAvailable:b.optional(b.boolean())}),Yt=b.array(at);async function ce(e){let t=process.env.KENDO_MCP_ACCESS;if(t==="true"||t==="1"||t==="full")return"full";if(typeof t=="string"&&(t.toLowerCase()==="agent"||t.toLowerCase()==="assistant"))return t.toLowerCase();let n=await e();return n.toLocaleLowerCase()==="agentic_ui_generator"?"agent":n.toLocaleLowerCase()==="ai_coding_assistants"?"assistant":"none"}function le(){return'**Accessibility Guidelines: WCAG 2.2 Level AA Compliance**\n\n**Core Principles:**\n1. Use semantic HTML and ARIA correctly\n2. Ensure WCAG 2.2 AA compliance\n3. Follow W3C ARIA Authoring Practices\n4. Provide standards-based accessibility fixes\n\n**1. Form Control Labels** (WCAG 1.3.1, 3.3.2, 4.1.2)\nEvery input must have an associated label.\nCORRECT: `<input type="search" aria-label="Search products" placeholder="Search...">`\nWRONG: `<span>Email</span><input type="email">` (no association)\nWRONG: `<input type="email" placeholder="Email">` (placeholder as label)\n\n**2. Button Accessibility** (WCAG 4.1.2, 2.4.6, 2.5.3)\nAll buttons need accessible names describing their purpose.\nCORRECT: `<button type="button">Save Changes</button>`\nCORRECT: `<button aria-label="Close dialog"><svg aria-hidden="true" focusable="false">...</svg></button>`\nWRONG: `<button><svg>...</svg></button>` (no accessible name)\nWRONG: `<button>Click here</button>` (generic text)\n\n**3. Popup/Menu Triggers** (WCAG 4.1.2, 1.3.1)\nIndicate popup purpose and state using aria-haspopup, aria-expanded, aria-controls.\nCORRECT: `<button aria-expanded="false" aria-haspopup="menu" aria-controls="menu-id">Settings</button>`\n\n**4. Image Accessibility** (WCAG 1.1.1)\nInformative: `<img src="chart.png" alt="Sales increased 25% in Q4 2024">`\nFunctional: `<a href="/home"><img src="logo.png" alt="Company Name Home"></a>`\nDecorative: `<img src="border.png" alt="" role="presentation">`\nComplex: `<img src="chart.png" alt="Sales data" aria-describedby="desc-id">`\nWRONG: Missing alt, filename as alt, generic alt for decorative images\n\n**5. Link Accessibility** (WCAG 2.4.4, 2.4.6)\nLinks must be descriptive and understandable out of context.\nCORRECT: `<a href="/products">View All Products</a>`\nCORRECT: `<a href="/article" aria-label="Read more about New Product Launch">Read more</a>`\nWRONG: "Click here", "Read more", "Learn more" without context\n\n**6. Form Validation** (WCAG 3.3.1, 3.3.2, 3.3.3)\nErrors must be identified, associated with inputs, and provide suggestions. Use aria-describedby, aria-invalid="true", and role="alert".\n\n**7. Heading Structure** (WCAG 1.3.1, 2.4.6)\nEach page should have an `<h1>` that describes its content. Use hierarchical, descriptive headings with no skipped levels (h1\u2192h2\u2192h3).\nCORRECT: `<h1>Dashboard</h1> <h2>Sales</h2> <h3>By Region</h3>`\nWRONG: No `<h1>` on the page, or skipping levels (h1\u2192h3)\nIf a heading should look smaller than its semantic level, use CSS: `<h2 class="text-sm">Subtitle</h2>`\n\n**8. Page Component Landmark Rules** (WCAG 1.3.1, 4.1.2)\nPage components (route components) may be rendered inside a layout that already provides `<main>`, `<header>`, or `<footer>`. Since the layout configuration is unknown, avoid using these landmarks in page components to prevent potential duplication and nesting violations. Use `<div>`, `<section>`, or `<article>` as the top-level wrapper instead.\n\n**Quick Checklist:**\n- **Forms:** Associated labels, aria-required on required fields, autocomplete attributes, aria-describedby for errors, aria-invalid for invalid fields, fieldsets with legends\n- **Buttons/Links:** Accessible names, aria-label for icon buttons, aria-hidden on decorative icons, descriptive link text\n- **Popups/Dialogs:** aria-haspopup, aria-expanded, aria-controls, role="dialog", aria-modal="true", aria-labelledby, focus trap, Escape to close\n- **Images:** alt on all images, descriptive alt for informative, empty alt for decorative, aria-describedby for complex\n- **Structure:** One h1, logical heading hierarchy, avoid `<main>`, `<header>`, or `<footer>` in page/route components (the layout may already provide them), use `<section>` or `<div>` as page-level wrappers, semantic HTML\n- **Dynamic Content:** role="status"/aria-live="polite" for updates, role="alert"/aria-live="assertive" for critical alerts\n- **Keyboard/Focus:** All interactive elements keyboard accessible, logical focus order, visible focus indicators, no keyboard traps (except modals)\n- **Color/Contrast:** 4.5:1 text contrast (3:1 large text), 3:1 UI component contrast, no color-only information, 3:1 focus indicator contrast'}var rt=1440*60*1e3;function de(e){let{serverName:t,contextApi:n,additionalFields:o={},intervalMs:s=rt}=e,r="mcp_server_heartbeat",a=async()=>{try{let d={server_name:t,timestamp:new Date().toISOString(),...o};await n.logEvent(r,d)}catch(d){g(`Failed to send heartbeat for ${t}:`,d)}};a();let i=setInterval(a,s);return()=>{clearInterval(i),g(`Heartbeat stopped for ${t}`)}}import{z as F}from"zod";var it=["default","bootstrap","material","fluent"];function pe(e,t){return{projectName:F.string().default(t).describe("The name of the project. Used as the project folder name when creating a new project."),createNewProject:F.boolean().default(!0).describe(`Whether to create a new project before configuring ${e}. Set to true to scaffold a brand-new project, or false if the project already exists and you only want to add ${e} to it.`),theme:F.enum(it).default("default").describe("The Kendo UI theme to use. Determines which theme package is installed and imported.")}}var l="Kendo UI for React",I="react",w="kendo";var O=["ActionSheet","AIPrompt","Animation","AppBar","ArcGauge","AutoComplete","Avatar","Badge","Barcode","BottomNavigation","Breadcrumb","Button","ButtonGroup","BreadCrumb","Calendar","Card","Chart","ChartWizard","Chat","Checkbox","Chip","ChipList","ChunkProgressBar","CircularGauge","ColorGradient","ColorPalette","ColorPicker","ComboBox","ContextMenu","ConversationalUI","DataGrid","Grid","DataQuery","DateMath","DateInput","DatePicker","DateRangePicker","DateTimePicker","Dialog","Drag&Drop","Drawer","Drawing","DropDownButton","DropDownList","DropDownTree","Editor","Error","ExcelExport","ExpansionPanel","ExternalDropZone","FileSaver","FileManager","Filter","FlatColorPicker","FloatingActionButton","FloatingLabel","Form","Gantt","Gauge","General","GridLayout","Hint","Icon","InlineAIPrompt","Input","Label","LinearGauge","ListBox","ListView","Loader","Map","MaskedTextBox","Menu","MultiColumnComboBox","MultiSelect","MultiSelectTree","MultiViewCalendar","Notification","NumericTextBox","OrgChart","PageTemplates/BuildingBlocks","Pager","PanelBar","PDFProcessing","PDFViewer","PivotGrid","Popover","Popup","ProgressBar","PromptBox","QRCode","RadialGauge","RadioButton","RadioGroup","RangeSlider","Rating","Ripple","Sankey","Scheduler","ScrollView","Signature","Skeleton","Slider","Sortable","Sparkline","SpeechToTextButton","SmartPasteButton","SplitButton","Splitter","Spreadsheet","StackLayout","Stepper","StockChart","SVGIcon","Switch","TabStrip","TaskBoard","TextArea","TextBox","TileLayout","Timeline","TimePicker","Toolbar","Tooltip","TreeList","TreeView","Typography","Upload","VSCodeExtension","Window"];var pt=lt(ct(dt(import.meta.url)),"../proto/service.proto"),_=new M("contextapi.telerik.com:443",pt,{libName:I});var me=async()=>_.validateUserLicense();import vt from"fs";import ze from"path";import{fileURLToPath as kt}from"url";import{z as C}from"zod";var v=class{constructor(t,n,o){this.name=t;this.config=n;this.cb=o}register(t){this.server=t,this.server.registerTool(this.name,this.config,this.cb)}hasAccess(t){return!this.config.requiredAccess||this.config.requiredAccess.length===0?!0:t==="full"||this.config.requiredAccess.includes(t)}};var D=(e,t)=>`# ${e.suiteName} - Code Validation & Quality Assurance
3
+ // packages/react/src/index.ts
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+
7
+ // packages/react/src/lib/grpc-client.ts
8
+ import { dirname, join } from "path";
9
+ import { fileURLToPath as fileURLToPath2 } from "url";
10
+
11
+ // packages/mcp-common/src/lib/read-license.ts
12
+ import {
13
+ loadLicense,
14
+ decodeLicenseKey,
15
+ decodeLicenseEvidence
16
+ } from "@progress/kendo-licensing/utils";
17
+ var LicenseError = class extends Error {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = "LicenseError";
21
+ }
22
+ };
23
+ function fixBom(licenseKey) {
24
+ return licenseKey.replace(/^\uFEFF/, "");
25
+ }
26
+ async function readLicense(logCallback) {
27
+ let licenseEvidence = null;
28
+ let error = null;
29
+ try {
30
+ const license = loadLicense();
31
+ if (!license.success) {
32
+ const licenseError = new LicenseError(license.message);
33
+ if (logCallback) {
34
+ await logCallback("license_load_failed", {
35
+ error: license.message
36
+ }).catch(() => {
37
+ });
38
+ }
39
+ throw licenseError;
40
+ }
41
+ try {
42
+ const decodedLicense = await decodeLicenseKey(license.value);
43
+ licenseEvidence = decodedLicense.licenses.find(async (lic) => {
44
+ const evidence = await decodeLicenseEvidence(lic);
45
+ if (evidence.userId) {
46
+ return true;
47
+ }
48
+ return false;
49
+ });
50
+ } catch (err) {
51
+ console.log(err.message);
52
+ if (logCallback) {
53
+ await logCallback("license_load_failed", {
54
+ error: err.message || "Unknown decoding error"
55
+ }).catch(() => {
56
+ });
57
+ }
58
+ }
59
+ if (!licenseEvidence) {
60
+ return [fixBom(license.value), null];
61
+ }
62
+ } catch (err) {
63
+ error = err.message || "Unknown error loading license.";
64
+ if (logCallback) {
65
+ await logCallback("license_load_failed", {
66
+ error
67
+ }).catch(() => {
68
+ });
69
+ }
70
+ return [null, error];
71
+ }
72
+ return [fixBom(licenseEvidence), null];
73
+ }
74
+
75
+ // packages/mcp-common/src/lib/logger.ts
76
+ import fs from "node:fs";
77
+ import path from "node:path";
78
+ var LOG_ENABLED = false;
79
+ var LOG_FILE = process.env.DEBUG_LOG_FILE;
80
+ var LOG_FILE_DEFINED = !!(LOG_FILE && typeof LOG_FILE === "string");
81
+ if (LOG_FILE_DEFINED) {
82
+ const resolvedLogFile = path.resolve(LOG_FILE);
83
+ const logDir = path.dirname(resolvedLogFile);
84
+ if (logDir !== "." && logDir !== process.cwd() && !fs.existsSync(logDir)) {
85
+ try {
86
+ fs.mkdirSync(logDir, { recursive: true });
87
+ } catch (err) {
88
+ console.error("Error creating log directory:", err);
89
+ }
90
+ }
91
+ if (!fs.existsSync(resolvedLogFile)) {
92
+ try {
93
+ fs.writeFileSync(resolvedLogFile, "");
94
+ } catch (err) {
95
+ console.error("Error creating log file:", err);
96
+ }
97
+ }
98
+ } else {
99
+ LOG_ENABLED = false;
100
+ }
101
+ LOG_ENABLED = LOG_FILE_DEFINED && !!LOG_FILE && fs.existsSync(path.resolve(LOG_FILE));
102
+ function log(...args) {
103
+ if (LOG_ENABLED && LOG_FILE) {
104
+ const date = /* @__PURE__ */ new Date();
105
+ const dateString = date.toISOString();
106
+ const logString = `${dateString}: ${args.join(" ")}
107
+ `;
108
+ const resolvedLogFile = path.resolve(LOG_FILE);
109
+ fs.appendFile(resolvedLogFile, logString, (err) => {
110
+ if (err) {
111
+ console.error("Error writing to log file:", err);
112
+ }
113
+ });
114
+ }
115
+ }
116
+
117
+ // packages/mcp-common/src/lib/context-api.ts
118
+ import protoLoader from "@grpc/proto-loader";
119
+ import grpc from "@grpc/grpc-js";
120
+ import path2 from "path";
121
+ import fs2 from "fs";
122
+ import { fileURLToPath } from "url";
123
+ var __filename = fileURLToPath(import.meta.url);
124
+ var __dirname = path2.dirname(__filename);
125
+ var packageJson = { version: "unknown" };
126
+ var packageJsonPath = path2.resolve(__dirname, "../package.json");
127
+ if (fs2.existsSync(packageJsonPath)) {
128
+ packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
129
+ }
130
+ function sanitizeMetadata(value) {
131
+ return value.replace(/\u2014/g, "--").replace(/\u2013/g, "-").replace(/[^\x20-\x7E]/g, "");
132
+ }
133
+ var D2CError = class extends Error {
134
+ constructor(code, message, details) {
135
+ super(message);
136
+ this.code = code;
137
+ this.details = details;
138
+ this.name = "D2CError";
139
+ }
140
+ };
141
+ var ContextAPI = class {
142
+ constructor(contextApiUrl, protoPath2, options) {
143
+ this.contextApiUrl = contextApiUrl;
144
+ this.protoPath = protoPath2;
145
+ this.options = options;
146
+ this.toolNameHeader = "assistant";
147
+ const proto = protoLoader.loadSync(this.protoPath, {
148
+ keepCase: true,
149
+ longs: String,
150
+ enums: String,
151
+ defaults: true,
152
+ oneofs: true
153
+ });
154
+ this.isDev = this.contextApiUrl?.includes("localhost") || this.contextApiUrl?.includes("127.0.0.1");
155
+ log("Using ContextApi URl:", this.contextApiUrl);
156
+ const protoDescriptor = grpc.loadPackageDefinition(proto);
157
+ const maxMsgSize = 100 * 1024 * 1024;
158
+ const channelOptions = {
159
+ "grpc.max_receive_message_length": maxMsgSize,
160
+ "grpc.max_send_message_length": maxMsgSize
161
+ };
162
+ this.client = new protoDescriptor.ContextQueryService(
163
+ this.contextApiUrl || "contextapi.telerik.com:443",
164
+ this.isDev ? grpc.credentials.createInsecure() : grpc.credentials.createSsl(),
165
+ channelOptions
166
+ );
167
+ }
168
+ async getMetadata({ meta } = { meta: {} }) {
169
+ const [license, error] = this.isDev ? ["fake_license", null] : await readLicense((eventName, fields) => this.logEvent(eventName, fields));
170
+ const apiKey = process.env.CONTEXTAPI_API_KEY;
171
+ const hasApiKey = apiKey && typeof apiKey === "string";
172
+ const hasLicense = license && typeof license === "string";
173
+ if (!hasLicense && !hasApiKey && error) {
174
+ throw new Error(
175
+ `Failed to authenticate with API key or License key!
176
+
177
+ License Error: ${error}`
178
+ );
179
+ }
180
+ const metadata = new grpc.Metadata();
181
+ if (hasLicense) {
182
+ try {
183
+ metadata.add("x-license-key", license);
184
+ } catch (error2) {
185
+ log("Error adding license key to metadata:", error2);
186
+ throw new Error(`Failed to use license key: ${error2.message}`);
187
+ }
188
+ }
189
+ if (hasApiKey) {
190
+ metadata.add("x-api-key", apiKey);
191
+ }
192
+ if (this.options?.libName) {
193
+ metadata.add("x-library-name", this.options.libName);
194
+ }
195
+ metadata.add("x-tool-name", this.toolNameHeader);
196
+ const requestMetadata = JSON.stringify({
197
+ ...meta,
198
+ source: "npm",
199
+ version: packageJson.version,
200
+ os: process.platform,
201
+ node_version: process.version
202
+ });
203
+ metadata.add("x-request-metadata", sanitizeMetadata(requestMetadata));
204
+ return metadata;
205
+ }
206
+ async query(params, meta) {
207
+ const metadata = await this.getMetadata({ meta });
208
+ return new Promise((resolve, reject) => {
209
+ this.client.query(
210
+ params,
211
+ metadata,
212
+ (err, response) => {
213
+ if (err) {
214
+ reject(new Error(err));
215
+ } else {
216
+ resolve(response);
217
+ }
218
+ }
219
+ );
220
+ });
221
+ }
222
+ async getApiRefMatches(params, meta) {
223
+ const metadata = await this.getMetadata({ meta });
224
+ return new Promise((resolve, reject) => {
225
+ this.client.getApiRefMatches(
226
+ params,
227
+ metadata,
228
+ (err, response) => {
229
+ if (err) {
230
+ reject(new Error(err));
231
+ } else {
232
+ resolve(response);
233
+ }
234
+ }
235
+ );
236
+ });
237
+ }
238
+ async queryCssUtils(params, meta) {
239
+ const metadata = await this.getMetadata({ meta });
240
+ return new Promise((resolve, reject) => {
241
+ this.client.cssUtilsSearch(
242
+ params,
243
+ metadata,
244
+ (err, response) => {
245
+ if (err) {
246
+ log("Error querying CSS Utils:", err);
247
+ reject(new Error(err));
248
+ } else {
249
+ resolve(response);
250
+ }
251
+ }
252
+ );
253
+ });
254
+ }
255
+ async queryIconsSearch(params, meta) {
256
+ const metadata = await this.getMetadata({ meta });
257
+ return new Promise((resolve, reject) => {
258
+ this.client.iconsSearch(params, metadata, (err, response) => {
259
+ if (err) {
260
+ log("Error querying Icons Search:", err);
261
+ reject(new Error(err));
262
+ } else {
263
+ resolve(response);
264
+ }
265
+ });
266
+ });
267
+ }
268
+ async queryBuildingBlocks(params, meta) {
269
+ const metadata = await this.getMetadata({ meta });
270
+ return new Promise((resolve, reject) => {
271
+ this.client.buildingBlocksSearch(
272
+ params,
273
+ metadata,
274
+ (err, response) => {
275
+ if (err) {
276
+ log("Error querying Building Blocks:", err);
277
+ reject(new Error(err));
278
+ } else {
279
+ resolve(response);
280
+ }
281
+ }
282
+ );
283
+ });
284
+ }
285
+ async validateUserLicense() {
286
+ const metadata = await this.getMetadata();
287
+ return new Promise((resolve, reject) => {
288
+ this.client.validateUserLicense(
289
+ null,
290
+ metadata,
291
+ (err, response) => {
292
+ if (err) {
293
+ log("Error validating user license:", err);
294
+ reject(new Error(err));
295
+ } else {
296
+ resolve(response);
297
+ }
298
+ }
299
+ );
300
+ });
301
+ }
302
+ async queryThemeGenerate(params, meta) {
303
+ const metadata = await this.getMetadata({ meta });
304
+ return new Promise((resolve, reject) => {
305
+ this.client.generateTheme(params, metadata, (err, response) => {
306
+ if (err) {
307
+ log("Error querying context API/GenerateTheme:", err);
308
+ reject(new Error(err));
309
+ } else {
310
+ resolve(response);
311
+ }
312
+ });
313
+ });
314
+ }
315
+ async recordOrchestratorUserRequest({ meta }) {
316
+ const metadata = await this.getMetadata({ meta });
317
+ return new Promise((resolve, reject) => {
318
+ this.client.recordOrchestratorUserRequest(
319
+ null,
320
+ metadata,
321
+ (err, response) => {
322
+ if (err) {
323
+ log("Error recording orchestrator user request:", err);
324
+ reject(new Error(err));
325
+ } else {
326
+ resolve(response);
327
+ }
328
+ }
329
+ );
330
+ });
331
+ }
332
+ async recordToolUserRequest({ toolName, meta }) {
333
+ const metadata = await this.getMetadata({ meta });
334
+ return new Promise((resolve, reject) => {
335
+ this.client.recordToolUserRequest(
336
+ { tool_name: toolName },
337
+ metadata,
338
+ (err, response) => {
339
+ if (err) {
340
+ log("Error recording tool user request:", err);
341
+ reject(new Error(err));
342
+ } else {
343
+ resolve(response);
344
+ }
345
+ }
346
+ );
347
+ });
348
+ }
349
+ async logEvent(eventName, fields) {
350
+ const apiKey = "h8utJ6rk4PpIWX4JMn9beQDsjVUri6KV0XYfiVwq";
351
+ if (!apiKey || typeof apiKey !== "string") {
352
+ log("LOGGING_API_KEY not configured, skipping log event");
353
+ return;
354
+ }
355
+ const metadata = new grpc.Metadata();
356
+ metadata.add("x-api-key", apiKey);
357
+ return new Promise((resolve, reject) => {
358
+ this.client.logEvent(
359
+ { event_name: eventName, fields: fields || {} },
360
+ metadata,
361
+ (err, response) => {
362
+ if (err) {
363
+ log("Error logging event:", err);
364
+ reject(new Error(err));
365
+ } else {
366
+ resolve();
367
+ }
368
+ }
369
+ );
370
+ });
371
+ }
372
+ /**
373
+ * Process a Figma design through the D2C pipeline
374
+ *
375
+ * @param params - Figma design data and processing options
376
+ * @returns Processed design with layout, styles, and component matches
377
+ * @throws D2CError if processing fails
378
+ */
379
+ async processFigmaDesign(params) {
380
+ const metadata = await this.getMetadata();
381
+ const request = {};
382
+ if (params.node_jsons && params.node_jsons.length > 0) {
383
+ request.node_jsons = params.node_jsons;
384
+ } else if (params.root_node_json) {
385
+ request.node_jsons = [params.root_node_json];
386
+ } else {
387
+ throw new Error("Either node_jsons or root_node_json must be provided");
388
+ }
389
+ return new Promise((resolve, reject) => {
390
+ this.client.processFigmaDesign(
391
+ request,
392
+ metadata,
393
+ (err, response) => {
394
+ if (err) {
395
+ log("Error processing Figma design:", err);
396
+ reject(new Error(`gRPC error: ${err.message}`));
397
+ return;
398
+ }
399
+ if (response.error) {
400
+ const error = new D2CError(
401
+ response.error.code,
402
+ response.error.message,
403
+ response.error.details
404
+ );
405
+ log("D2C processing error:", error);
406
+ reject(error);
407
+ return;
408
+ }
409
+ if (response.success) {
410
+ const layoutPseudoCodes = response.success.layout_pseudo_codes || [];
411
+ const result = {
412
+ // Backward compatibility: first layout or empty string
413
+ layout_pseudo_code: layoutPseudoCodes[0] || response.success.layout_pseudo_code || "",
414
+ layout_pseudo_codes: layoutPseudoCodes.length > 0 ? layoutPseudoCodes : [response.success.layout_pseudo_code || ""],
415
+ design_tokens: response.success.design_tokens || "",
416
+ stats: {
417
+ total_nodes: response.success.stats?.total_nodes || 0,
418
+ processing_time_ms: response.success.stats?.processing_time_ms || 0
419
+ }
420
+ };
421
+ resolve(result);
422
+ return;
423
+ }
424
+ reject(new Error("Invalid response format from server"));
425
+ }
426
+ );
427
+ });
428
+ }
429
+ };
430
+
431
+ // packages/mcp-common/src/models/user.ts
432
+ import { z } from "zod";
433
+ var userInfoSchema = z.object({
434
+ user_id: z.string(),
435
+ user_email: z.string().email()
436
+ });
437
+
438
+ // packages/mcp-common/src/models/entitlements.ts
439
+ import { z as z2 } from "zod";
440
+ var itemSchema = z2.object({
441
+ Product: z2.object({
442
+ Id: z2.number().int(),
443
+ Code: z2.string(),
444
+ Name: z2.string()
445
+ }),
446
+ License: z2.nullable(
447
+ z2.object({
448
+ Id: z2.number().int(),
449
+ Name: z2.string(),
450
+ Type: z2.string(),
451
+ Active: z2.boolean()
452
+ })
453
+ ),
454
+ Availability: z2.array(
455
+ z2.object({
456
+ LicenseStart: z2.nullable(z2.string().datetime()),
457
+ LicenseEnd: z2.nullable(z2.string().datetime())
458
+ })
459
+ ),
460
+ IsLicenseAvailable: z2.optional(z2.boolean())
461
+ });
462
+ var entitlementsSchema = z2.array(itemSchema);
463
+
464
+ // packages/mcp-common/src/lib/utils.ts
465
+ async function checkAccess(cb) {
466
+ const access = process.env.KENDO_MCP_ACCESS;
467
+ if (access === "true" || access === "1" || access === "full") {
468
+ return "full";
469
+ } else if (typeof access === "string" && (access.toLowerCase() === "agent" || access.toLowerCase() === "assistant")) {
470
+ return access.toLowerCase();
471
+ }
472
+ const productCode = await cb();
473
+ if (productCode.toLocaleLowerCase() === "agentic_ui_generator") {
474
+ return "agent";
475
+ }
476
+ if (productCode.toLocaleLowerCase() === "ai_coding_assistants") {
477
+ return "assistant";
478
+ }
479
+ return "none";
480
+ }
481
+
482
+ // packages/mcp-common/src/lib/instructions/accessibility.ts
483
+ function getAccessibilityGuidelines() {
484
+ return `**Accessibility Guidelines: WCAG 2.2 Level AA Compliance**
485
+
486
+ **Core Principles:**
487
+ 1. Use semantic HTML and ARIA correctly
488
+ 2. Ensure WCAG 2.2 AA compliance
489
+ 3. Follow W3C ARIA Authoring Practices
490
+ 4. Provide standards-based accessibility fixes
491
+
492
+ **1. Form Control Labels** (WCAG 1.3.1, 3.3.2, 4.1.2)
493
+ Every input must have an associated label.
494
+ CORRECT: \`<input type="search" aria-label="Search products" placeholder="Search...">\`
495
+ CORRECT: \`<label for="qty">Quantity</label><input type="number" id="qty">\`
496
+ WRONG: \`<span>Email</span><input type="email">\` (no association)
497
+ WRONG: \`<input type="email" placeholder="Email">\` (placeholder as label)
498
+
499
+ **2. Button Accessibility** (WCAG 4.1.2, 2.4.6, 2.5.3)
500
+ All buttons need accessible names describing their purpose.
501
+ CORRECT: \`<button type="button">Save Changes</button>\`
502
+ CORRECT: \`<button aria-label="Close dialog"><svg aria-hidden="true" focusable="false">...</svg></button>\`
503
+ WRONG: \`<button><svg>...</svg></button>\` (no accessible name)
504
+ WRONG: \`<button>Click here</button>\` (generic text)
505
+
506
+ **3. Popup/Menu Triggers** (WCAG 4.1.2, 1.3.1)
507
+ Indicate popup purpose and state using aria-haspopup, aria-expanded, aria-controls.
508
+ CORRECT: \`<button aria-expanded="false" aria-haspopup="menu" aria-controls="menu-id">Settings</button>\`
509
+
510
+ **4. Image Accessibility** (WCAG 1.1.1)
511
+ Informative: \`<img src="chart.png" alt="Sales increased 25% in Q4 2024">\`
512
+ Functional: \`<a href="/home"><img src="logo.png" alt="Company Name Home"></a>\`
513
+ Decorative: \`<img src="border.png" alt="" role="presentation">\`
514
+ Complex: \`<img src="chart.png" alt="Sales data" aria-describedby="desc-id">\`
515
+ WRONG: Missing alt, filename as alt, generic alt for decorative images
516
+
517
+ **5. Link Accessibility** (WCAG 2.4.4, 2.4.6)
518
+ Links must be descriptive and understandable out of context.
519
+ CORRECT: \`<a href="/products">View All Products</a>\`
520
+ CORRECT: \`<a href="/article" aria-label="Read more about New Product Launch">Read more</a>\`
521
+ WRONG: "Click here", "Read more", "Learn more" without context
522
+
523
+ **6. Form Validation** (WCAG 3.3.1, 3.3.2, 3.3.3)
524
+ Errors must be identified, associated with inputs, and provide suggestions. Use aria-describedby, aria-invalid="true", and role="alert".
525
+
526
+ **7. Heading Structure** (WCAG 1.3.1, 2.4.6)
527
+ Each page must have an \`<h1>\` that describes its content. Use hierarchical, descriptive headings with no skipped levels (h1\u2192h2\u2192h3).
528
+ CORRECT: \`<h1>Dashboard</h1> <h2>Sales</h2> <h3>By Region</h3>\`
529
+ WRONG: No \`<h1>\` on the page, or skipping levels (h1\u2192h3)
530
+ If a heading should look smaller than its semantic level, use CSS: \`<h2 class="text-sm">Subtitle</h2>\`
531
+
532
+ **8. Page Component Landmark Rules** (WCAG 1.3.1, 4.1.2)
533
+ Page components (route components) may be rendered inside a layout that already provides \`<main>\`, \`<header>\`, or \`<footer>\`. Since the layout configuration is unknown, avoid using these landmarks in page components to prevent potential duplication and nesting violations. Use \`<div>\`, \`<section>\`, or \`<article>\` as the top-level wrapper instead.
534
+ - Avoid adding \`<main>\`, \`role="main"\`, \`<header>\`, or \`<footer>\` in page components \u2014 the layout typically provides them. Duplicating them can cause \`landmark-no-duplicate-main\` and \`landmark-main-is-top-level\` violations.
535
+ - Avoid adding \`role="banner"\` or using a semantic \`<header>\` element in page components \u2014 the layout's \`<header>\` already claims the banner landmark. Adding another causes \`landmark-banner-is-top-level\` violations.
536
+ - Avoid adding \`role="contentinfo"\` to elements inside page components \u2014 the contentinfo landmark should be a top-level landmark, not nested inside \`<main>\` or other landmarks. Nesting it can cause \`landmark-contentinfo-is-top-level\` violations.
537
+ - When multiple \`<section>\` or \`<nav>\` elements exist on a page, give each a unique \`aria-label\` to avoid \`landmark-unique\` violations.
538
+
539
+ **9. ARIA Role and Attribute Restrictions** (WCAG 4.1.2)
540
+ Only use ARIA roles that are valid for the given HTML element. Avoid adding \`aria-label\` or \`aria-labelledby\` to elements that do not permit naming.
541
+ - \`<article>\` has an implicit \`article\` role. Do NOT override it with \`role="listitem"\`, \`role="button"\`, \`role="link"\`, or any other role \u2014 none are allowed on \`<article>\`. Use \`<li>\` for list items, \`<button>\` for interactive cards, or \`<a>\` for clickable cards instead.
542
+ - \`<button>\` already has an implicit \`button\` role. Do NOT add \`role="listitem"\` or other incompatible roles.
543
+ - \`<span>\` and \`<div>\` without roles are generic elements. Do NOT add \`aria-label\` to them \u2014 it is a prohibited attribute on elements with no accessible role and can cause \`aria-prohibited-attr\` violations. Instead, use \`role="img"\` + \`aria-label\` for visual indicators, or use visually hidden text.
544
+ - Do NOT add \`aria-label\` to non-interactive \`<div>\` wrappers \u2014 it has no effect and triggers violations.
545
+ - \`aria-pressed\` is only valid on elements with \`role="button"\`, \`role="checkbox"\`, \`role="menuitemcheckbox"\`, \`role="option"\`, \`role="radio"\`, or \`role="switch"\`. Do NOT use \`aria-pressed\` on elements with \`role="listitem"\` or other roles.
546
+ CORRECT: \`<ul role="list"><li class="product-card">...</li></ul>\` (listitem inside list)
547
+ CORRECT: \`<span role="img" aria-label="Status: pending" class="status-dot"></span>\` (role added before aria-label)
548
+ CORRECT: \`<span class="status-dot" aria-hidden="true"></span><span class="visually-hidden">Pending</span>\` (hidden text alternative)
549
+ WRONG: \`<article role="listitem">\` (listitem not allowed on article)
550
+ WRONG: \`<article role="button">\` (button not allowed on article \u2014 use \`<button>\` or \`<div role="button">\`)
551
+ WRONG: \`<span aria-label="pending" class="status-dot"></span>\` (aria-label prohibited on generic span)
552
+ WRONG: \`<div aria-label="Product badges" class="badges"></div>\` (aria-label prohibited on generic div)
553
+
554
+ **Quick Checklist:**
555
+ - **Forms:** Associated labels, aria-required on required fields, autocomplete attributes, aria-describedby for errors, aria-invalid for invalid fields, fieldsets with legends
556
+ - **Buttons/Links:** Accessible names, aria-label for icon buttons, aria-hidden on decorative icons, descriptive link text
557
+ - **Popups/Dialogs:** aria-haspopup, aria-expanded, aria-controls, role="dialog", aria-modal="true", aria-labelledby, focus trap, Escape to close
558
+ - **Images:** alt on all images, descriptive alt for informative, empty alt for decorative, aria-describedby for complex
559
+ - **Structure:** One h1, logical heading hierarchy, avoid \`<main>\`, \`<header>\`, \`<footer>\`, \`role="main"\`, \`role="contentinfo"\`, \`role="banner"\` in page/route components (the layout may already provide them), use \`<section>\` or \`<div>\` as page-level wrappers, unique aria-labels on duplicate landmark types
560
+ - **ARIA Rules:** Avoid adding \`aria-label\` to generic \`<span>\`/\`<div>\` without a role, avoid using \`role="listitem"\` or \`role="button"\` on \`<article>\` \u2014 use \`<li>\` for list items, add \`role="img"\` before \`aria-label\` on visual indicators, \`aria-pressed\` only on button-like roles
561
+ - **Scrollable Regions:** Any scrollable container must have \`tabindex="0"\` or contain keyboard-interactive children
562
+ - **Nested Interactive:** Do not add interactive role/tabindex to a container that already has focusable children
563
+ - **List Roles:** \`role="list"\` containers must have \`role="listitem"\` children \u2014 prefer \`<ul>/<li>\` natively
564
+ - **Dynamic Content:** role="status"/aria-live="polite" for updates, role="alert"/aria-live="assertive" for critical alerts
565
+ - **Keyboard/Focus:** All interactive elements keyboard accessible, logical focus order, visible focus indicators, no keyboard traps (except modals)
566
+ - **Color/Contrast:** 4.5:1 text contrast (3:1 large text), 3:1 UI component contrast, no color-only information, 3:1 focus indicator contrast`;
567
+ }
568
+
569
+ // packages/mcp-common/src/lib/heartbeat.ts
570
+ var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
571
+ function startHeartbeat(options) {
572
+ const {
573
+ serverName,
574
+ contextApi: contextApi2,
575
+ additionalFields = {},
576
+ intervalMs = ONE_DAY_MS
577
+ } = options;
578
+ const eventName = `mcp_server_heartbeat`;
579
+ const sendHeartbeat = async () => {
580
+ try {
581
+ const fields = {
582
+ server_name: serverName,
583
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
584
+ ...additionalFields
585
+ };
586
+ await contextApi2.logEvent(eventName, fields);
587
+ } catch (error) {
588
+ log(`Failed to send heartbeat for ${serverName}:`, error);
589
+ }
590
+ };
591
+ sendHeartbeat();
592
+ const intervalId = setInterval(sendHeartbeat, intervalMs);
593
+ return () => {
594
+ clearInterval(intervalId);
595
+ log(`Heartbeat stopped for ${serverName}`);
596
+ };
597
+ }
598
+
599
+ // packages/mcp-common/src/lib/getting-started-params.ts
600
+ import { z as z3 } from "zod";
601
+ var KendoThemes = ["default", "bootstrap", "material", "fluent"];
602
+ function createGettingStartedInputSchema(suiteName, defaultProjectName) {
603
+ return {
604
+ projectName: z3.string().default(defaultProjectName).describe(
605
+ "The name of the project. Used as the project folder name when creating a new project."
606
+ ),
607
+ createNewProject: z3.boolean().default(true).describe(
608
+ `Whether to create a new project before configuring ${suiteName}. Set to true to scaffold a brand-new project, or false if the project already exists and you only want to add ${suiteName} to it.`
609
+ ),
610
+ theme: z3.enum(KendoThemes).default("default").describe(
611
+ "The Kendo UI theme to use. Determines which theme package is installed and imported."
612
+ )
613
+ };
614
+ }
615
+
616
+ // packages/react/src/lib/constants.ts
617
+ var REACT_SUITE_NAME = "Kendo UI for React";
618
+ var Suite = "react";
619
+ var PRODUCT_LINE = "kendo";
620
+ var ReactComponents = [
621
+ "ActionSheet",
622
+ "AIPrompt",
623
+ "Animation",
624
+ "AppBar",
625
+ "ArcGauge",
626
+ "AutoComplete",
627
+ "Avatar",
628
+ "Badge",
629
+ "Barcode",
630
+ "BottomNavigation",
631
+ "Breadcrumb",
632
+ "Button",
633
+ "ButtonGroup",
634
+ "BreadCrumb",
635
+ "Calendar",
636
+ "Card",
637
+ "Chart",
638
+ "ChartWizard",
639
+ "Chat",
640
+ "Checkbox",
641
+ "Chip",
642
+ "ChipList",
643
+ "ChunkProgressBar",
644
+ "CircularGauge",
645
+ "ColorGradient",
646
+ "ColorPalette",
647
+ "ColorPicker",
648
+ "ComboBox",
649
+ "ContextMenu",
650
+ "ConversationalUI",
651
+ "DataGrid",
652
+ "Grid",
653
+ // Alias for DataGrid only used in the mcp-server
654
+ "DataQuery",
655
+ "DateMath",
656
+ "DateInput",
657
+ "DatePicker",
658
+ "DateRangePicker",
659
+ "DateTimePicker",
660
+ "Dialog",
661
+ "Drag&Drop",
662
+ "Drawer",
663
+ "Drawing",
664
+ "DropDownButton",
665
+ "DropDownList",
666
+ "DropDownTree",
667
+ "Editor",
668
+ "Error",
669
+ "ExcelExport",
670
+ "ExpansionPanel",
671
+ "ExternalDropZone",
672
+ "FileSaver",
673
+ "FileManager",
674
+ "Filter",
675
+ "FlatColorPicker",
676
+ "FloatingActionButton",
677
+ "FloatingLabel",
678
+ "Form",
679
+ "Gantt",
680
+ "Gauge",
681
+ "General",
682
+ "GridLayout",
683
+ "Hint",
684
+ "Icon",
685
+ "InlineAIPrompt",
686
+ "Input",
687
+ "Label",
688
+ "LinearGauge",
689
+ "ListBox",
690
+ "ListView",
691
+ "Loader",
692
+ "Map",
693
+ "MaskedTextBox",
694
+ "Menu",
695
+ "MultiColumnComboBox",
696
+ "MultiSelect",
697
+ "MultiSelectTree",
698
+ "MultiViewCalendar",
699
+ "Notification",
700
+ "NumericTextBox",
701
+ "OrgChart",
702
+ "PageTemplates/BuildingBlocks",
703
+ "Pager",
704
+ "PanelBar",
705
+ "PDFProcessing",
706
+ "PDFViewer",
707
+ "PivotGrid",
708
+ "Popover",
709
+ "Popup",
710
+ "ProgressBar",
711
+ "PromptBox",
712
+ "QRCode",
713
+ "RadialGauge",
714
+ "RadioButton",
715
+ "RadioGroup",
716
+ "RangeSlider",
717
+ "Rating",
718
+ "Ripple",
719
+ "Sankey",
720
+ "Scheduler",
721
+ "ScrollView",
722
+ "Signature",
723
+ "Skeleton",
724
+ "Slider",
725
+ "Sortable",
726
+ "Sparkline",
727
+ "SpeechToTextButton",
728
+ "SmartPasteButton",
729
+ "SplitButton",
730
+ "Splitter",
731
+ "Spreadsheet",
732
+ "StackLayout",
733
+ "Stepper",
734
+ "StockChart",
735
+ "SVGIcon",
736
+ "Switch",
737
+ "TabStrip",
738
+ "TaskBoard",
739
+ "TextArea",
740
+ "TextBox",
741
+ "TileLayout",
742
+ "Timeline",
743
+ "TimePicker",
744
+ "Toolbar",
745
+ "Tooltip",
746
+ "TreeList",
747
+ "TreeView",
748
+ "Typography",
749
+ "Upload",
750
+ "VSCodeExtension",
751
+ "Window"
752
+ ];
753
+
754
+ // packages/react/src/lib/grpc-client.ts
755
+ var protoPath = join(
756
+ dirname(fileURLToPath2(import.meta.url)),
757
+ "../proto/service.proto"
758
+ );
759
+ var contextApi = new ContextAPI("contextapi.telerik.com:443", protoPath, {
760
+ libName: Suite
761
+ });
762
+ var validateUserLicense = async () => {
763
+ return contextApi.validateUserLicense();
764
+ };
765
+
766
+ // packages/react/src/index.ts
767
+ import fs3 from "fs";
768
+ import path3 from "path";
769
+ import { fileURLToPath as fileURLToPath3 } from "url";
770
+
771
+ // packages/kendo-ui-agent/src/lib/tools-factory.ts
772
+ import { z as z4 } from "zod";
773
+
774
+ // packages/kendo-ui-agent/src/lib/ui-agent-tool.ts
775
+ var UIAgentTool = class {
776
+ constructor(name, config, cb) {
777
+ this.name = name;
778
+ this.config = config;
779
+ this.cb = cb;
780
+ }
781
+ register(mcpServer) {
782
+ this.server = mcpServer;
783
+ this.server.registerTool(this.name, this.config, this.cb);
784
+ }
785
+ hasAccess(accessType) {
786
+ if (!this.config.requiredAccess || this.config.requiredAccess.length === 0) {
787
+ return true;
788
+ }
789
+ return accessType === "full" || this.config.requiredAccess.includes(accessType);
790
+ }
791
+ };
792
+
793
+ // packages/kendo-ui-agent/src/lib/templates/validator.ts
794
+ var renderValidatorResponse = (ctx, frameworkValidationSteps) => `# ${ctx.suiteName} - Code Validation & Quality Assurance
6
795
 
7
796
  ## Comprehensive Code Validation Checklist
8
797
  Execute these validation steps systematically to ensure high-quality, maintainable code:
9
798
 
10
799
  ### Validation Phase: Framework-Specific Validation
11
800
 
12
- ${t}
801
+ ${frameworkValidationSteps}
13
802
 
14
803
  ### Validation Phase: General Code Quality & Best Practices
15
804
 
@@ -46,45 +835,99 @@ Responsive Design:
46
835
  - Graceful error handling for all user interactions
47
836
  - Meaningful error messages for users
48
837
  - Network error handling for API calls
49
- `;var L=(e,t)=>{let n=D({suiteName:e.suiteName,libKey:e.libKey},t.validationSteps),o=e.libKey==="angular"?"- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.":"",s=e.components?e.components.join(", "):"components";return`# \u{1F3AF} ${e.suiteName} - Execution Plan
838
+ `;
839
+
840
+ // packages/kendo-ui-agent/src/lib/templates/orchestrator.ts
841
+ var responsiveKendoDesignSystemGuidance = (ctx) => `**Tool call example:**
842
+ \`\`\`
843
+ ${ctx.layoutAssistantName}({
844
+ prompt="Provide Kendo Design System utility classes to make the following layout structure responsive across mobile, tablet, and desktop views: [LAYOUT DESCRIPTION HERE]",
845
+ includeBuildingBlockExamples=false // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
846
+ })
847
+ \`\`\`
848
+ `;
849
+ var vanillaCSSResponsiveGuidance = `**General Responsive Design Guidance:**
850
+ - Use CSS media queries to apply different styles at various breakpoints (e.g., mobile, tablet, desktop).
851
+ - Consider a mobile-first approach, starting with styles for smaller screens and adding complexity for larger screens.
852
+ - Ensure flexible grid layouts that can adapt to different screen sizes.
853
+ - Use relative units (%, em, rem) instead of fixed units (px) for widths and spacing to allow for better scalability.
854
+ - Test the design across multiple devices and screen sizes to ensure a consistent user experience.`;
855
+ var tailwindResponsiveGuidance = `**Tailwind CSS Responsive Design Guidance:**
856
+ - Use Tailwind's responsive utility variants (e.g., sm:, md:, lg:, xl:) to apply styles at specific breakpoints.
857
+ - Start with mobile styles (no prefix) and layer on additional styles for larger screens using the appropriate prefixes.
858
+ - Leverage Tailwind's grid and flex utilities to create flexible layouts that adapt to different screen sizes.
859
+ - Use Tailwind's spacing utilities to maintain consistent spacing across breakpoints.
860
+ - Test the design across multiple devices and screen sizes to ensure a consistent user experience.`;
861
+ var renderOrchestratorResponse = (ctx, options) => {
862
+ const validationInstructions = renderValidatorResponse(
863
+ { suiteName: ctx.suiteName, libKey: ctx.libKey },
864
+ options.validationSteps
865
+ );
866
+ const includeLayout = ctx.includeLayout && ctx.layoutMode === "utils";
867
+ const dragDropGuidance = ctx.libKey === "angular" ? `- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.` : "";
868
+ const componentsList = ctx.components ? ctx.components.join(", ") : "components";
869
+ const responsiveLayoutHint = includeLayout ? `- And use the ${ctx.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.` : "";
870
+ const responsiveKDSGuidance = includeLayout ? responsiveKendoDesignSystemGuidance(ctx) : "";
871
+ const responsiveVanillaCSSGuidance = ctx.layoutMode === "vanilla" ? vanillaCSSResponsiveGuidance : "";
872
+ const responsiveTailwindCSSGuidance = ctx.layoutMode === "tailwind" ? tailwindResponsiveGuidance : "";
873
+ return `# \u{1F3AF} ${ctx.suiteName} - Execution Plan
50
874
 
51
875
  **Current Goal:**
52
876
 
53
- ${e.userIntent}
877
+ ${ctx.userIntent}
54
878
 
55
879
  **Requirements Summary:**
56
- - **Framework:** ${e.libKey}
57
- ${e.includeComponentsDocs?`- **Component Library:** ${e.suiteName}
58
- - Ensure to use ONLY ${e.suiteName} components for all UI elements.
59
- - And use the ${e.codeAssistantName} tool to get ${e.suiteName} component documentation and code snippets.
60
- - Ensure that after you read the plan you use exactly the ${e.codeAssistantName} no matter if there is another tool that can provide code snippets, documentation or other resources related to ${e.suiteName}.
61
- `:""}${e.includeLayout?`- **Layout:** Yes
62
- - And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for layout structure and responsive design.
63
- `:""}${e.includeIcons?`- **Icons:** Yes
880
+ - **Framework:** ${ctx.libKey}
881
+ ${ctx.includeComponentsDocs ? `- **Component Library:** ${ctx.suiteName}
882
+ - Ensure to use ONLY ${ctx.suiteName} components for all UI elements.
883
+ - And use the ${ctx.codeAssistantName} tool to get ${ctx.suiteName} component documentation and code snippets.
884
+ - Ensure that after you read the plan you use exactly the ${ctx.codeAssistantName} no matter if there is another tool that can provide code snippets, documentation or other resources related to ${ctx.suiteName}.
885
+ ` : ""}${includeLayout ? `- **Layout:** Yes
886
+ - And use the ${ctx.layoutAssistantName} tool to get Kendo CSS utility classes needed for layout structure and responsive design.
887
+ ` : ""}${ctx.includeIcons ? `- **Icons:** Yes
64
888
  - Use icons that align with the project theme and enhance usability.
65
- - Use the ${e.iconAssistantName} tool to search for icons that fit the theme and purpose of your project.
66
- `:""}${e.includeTheming?`- **Custom Theming:**
889
+ - Use the ${ctx.iconAssistantName} tool to search for icons that fit the theme and purpose of your project.
890
+ ` : ""}${ctx.includeTheming ? `- **Custom Theming:**
67
891
  - Create a custom theme that aligns with the current goal and branding needs.
68
892
  - Use Kendo Themes and Design System guidelines.
69
893
  - Make sure to include strict CSS variables or theme requirements from the current goal.
70
- - And use the ${e.styleAssistantName} tool to create a custom theme for your project.
71
- `:""}${e.includeResponsive?`- **Responsive:**
894
+ - And use the ${ctx.styleAssistantName} tool to create a custom theme for your project.
895
+ ` : ""}${ctx.includeResponsive ? `- **Responsive:**
72
896
  - Ensure the layout is fully responsive across mobile, tablet, and desktop views.
73
- - And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.
74
- `:""}
897
+ ${responsiveLayoutHint}
898
+ ` : ""}
75
899
  - **Accessible (WCAG 2.2 Level AA):**
76
- - CRITICAL: You must call the ${e.accessibilityAssistantName} tool with includeGeneralGuidelines=true on your first call to get WCAG 2.2 Level AA guidelines.
900
+ - CRITICAL: You must call the ${ctx.accessibilityAssistantName} tool with includeGeneralGuidelines=true on your first call to get WCAG 2.2 Level AA guidelines.
77
901
  - For subsequent calls, use includeGeneralGuidelines=false to get only component-specific accessibility information.
78
902
  - Ensure all components meet WCAG 2.2 Level AA standards.
79
903
 
80
- ${e.includeLayout?`**STYLING AND LAYOUT REQUIREMENTS:**
904
+ ${includeLayout ? `**STYLING AND LAYOUT REQUIREMENTS:**
905
+ **LAYOUT MODE: KENDO DESIGN SYSTEM CSS UTILITIES**
81
906
  ## CRITICAL DESIGN SYSTEM CONSTRAINTS
82
907
  - **USE ONLY KENDO DESIGN SYSTEM UTILITIES** for ALL styling, layout, spacing, positioning, and responsive behavior
83
908
  - Avoid custom CSS, inline styles, or other CSS framework classes
84
- - The ${e.layoutAssistantName} tool will provide the specific Kendo CSS utility classes needed
909
+ - The ${ctx.layoutAssistantName} tool will provide the specific Kendo CSS utility classes needed
85
910
  - All layout requirements must use Kendo utilities exclusively
911
+ ` : ""}
912
+ ${ctx.layoutMode === "vanilla" ? `**STYLING AND LAYOUT REQUIREMENTS:**
913
+ **LAYOUT MODE: VANILLA**
914
+ - In this mode, you should use Kendo UI components and vanilla CSS for layout and styling.
915
+ - Do NOT use any utility-first CSS classes (e.g., from Tailwind) for layout or styling.
916
+ - Focus on leveraging the built-in capabilities of Kendo UI components and writing custom CSS as needed to achieve the desired design and layout.
917
+ ` : ""}
918
+ ${ctx.layoutMode === "tailwind" ? `**STYLING AND LAYOUT REQUIREMENTS:**
919
+ **LAYOUT MODE: TAILWIND**
920
+ - In this mode, you should use Tailwind CSS utility classes for layout and styling.
921
+ - Do NOT write custom CSS or use vanilla CSS for layout or styling.
922
+ - Focus on leveraging Tailwind's utility-first approach to achieve the desired design and layout, while still using Kendo UI components for functionality.
923
+ ` : ""}
924
+ ${ctx.includeFigmaD2C ? `**DESIGN EXTRACTION FROM FIGMA FILE**
925
+ - You are given a Figma file URL that contains the design for the current goal. You MUST use the ${ctx.figmaD2CToolName} tool to extract design information from the Figma file.
926
+ - Extracted design information should be used to get information about the layout, styles, design tokens and assets that can be used within the project.
927
+ - The ${ctx.figmaD2CToolName} tool will output you Layout structure of the design, design tokens for CSS and any decoration and a snapshot of the design.
928
+ ` : ""}
86
929
 
87
- `:""}---
930
+ ---
88
931
 
89
932
  ## Detailed Execution Plan
90
933
  Follow these steps strictly in order to achieve a complete and polished implementation of the current goal:
@@ -96,13 +939,13 @@ Follow these steps strictly in order to achieve a complete and polished implemen
96
939
  **MANDATORY REQUIREMENT:**
97
940
 
98
941
  - Before implementing any UI components or features, you must call the accessibility assistant with general guidelines
99
- - On your first call to "${e.accessibilityAssistantName}", set "includeGeneralGuidelines=true" to get foundational WCAG 2.2 Level AA best practices
942
+ - On your first call to "${ctx.accessibilityAssistantName}", set "includeGeneralGuidelines=true" to get foundational WCAG 2.2 Level AA best practices
100
943
  - These general guidelines apply to all components and must be considered throughout implementation
101
944
  - For all subsequent calls, set "includeGeneralGuidelines=false" to get only component-specific information
102
945
 
103
946
  **First tool call (includes general WCAG guidelines):**
104
947
  \`\`\`
105
- ${e.accessibilityAssistantName}({
948
+ ${ctx.accessibilityAssistantName}({
106
949
  query="What are the accessibility requirements for [COMPONENT_NAME]?",
107
950
  component="[COMPONENT_NAME]",
108
951
  includeGeneralGuidelines=true // ONLY true on first call
@@ -111,11 +954,11 @@ ${e.accessibilityAssistantName}({
111
954
 
112
955
  **Step 2: Get Component-Specific Accessibility Information**
113
956
 
114
- For each additional ${e.suiteName} component you plan to use, call the tool with "includeGeneralGuidelines=false":
957
+ For each additional ${ctx.suiteName} component you plan to use, call the tool with "includeGeneralGuidelines=false":
115
958
 
116
959
  **Tool call example:**
117
960
  \`\`\`
118
- ${e.accessibilityAssistantName}({
961
+ ${ctx.accessibilityAssistantName}({
119
962
  query="What are the accessibility features and requirements for [COMPONENT_NAME]? Include ARIA attributes, keyboard navigation, and screen reader support.",
120
963
  component="[COMPONENT_NAME]",
121
964
  includeGeneralGuidelines=false // false for all calls after the first
@@ -124,13 +967,112 @@ ${e.accessibilityAssistantName}({
124
967
 
125
968
  **Example:**
126
969
  \`\`\`
127
- ${e.accessibilityAssistantName}({
970
+ ${ctx.accessibilityAssistantName}({
128
971
  query="How to associate the label with another component or HTML input?",
129
972
  component="Label",
130
973
  includeGeneralGuidelines=false
131
974
  })
132
975
  \`\`\`
133
- ${e.includeLayout?`
976
+
977
+ ${ctx.includeFigmaD2C ? `### Phase: Design Extraction and Analysis
978
+
979
+ **IMPORTANT DESIGN EXTRACTION REQUIRMENTS**
980
+ - Use the ${ctx.figmaD2CToolName} tool to extract design information from the provided Figma file URL.
981
+ - Analyze the extracted design information to identify key layout structures, components, styles, and design tokens.
982
+ - Use the insights from the design analysis to inform your implementation in the next phases, ensuring alignment with the original design intent.
983
+ - Follow ALL three extraction steps sequentially \u2014 each step is MANDATORY.
984
+ - Complete the verification checklist after each step before proceeding to the next.
985
+
986
+
987
+ **Step 1: Extract Base Design Information from Figma**
988
+ - Extract only base the first layer of the design to get the overall structure and layout without going too deep into details. This will help you to understand the design hierarchy and identify key components and layout patterns.
989
+ - Use the downloaded design snapshot to visually analyze the design and correlate it with the extracted structure. This will help you to identify which nodes correspond to which design elements and to plan your implementation accordingly.
990
+ - **REQUIRED OUTPUT:** After extraction, you MUST output a structured list of ALL discovered node IDs with their labels/names before proceeding to Step 2. Format this as a clear inventory that will be referenced in subsequent steps. For each node, extract the node ID from the node-id attribute of the node XML tag.
991
+ - **Depth escalation:** If a node at this depth shows it contains more children than can be captured (e.g., children are truncated), re-fetch that specific node with depth + 5 to ensure complete extraction.
992
+
993
+ **Tool call example:**
994
+ \`\`\`
995
+ ${ctx.figmaD2CToolName}({
996
+ url: [Figma URL from prompt]
997
+ depth: 10 // Consider more depth only if the user prompt explicitly states to extract deeply.
998
+ })
999
+ \`\`\`
1000
+
1001
+ **Step 1 Completion Checklist (MUST satisfy before proceeding):**
1002
+ - [ ] Have I captured all top-level layout containers (headers, footers, main sections)?
1003
+ - [ ] Have I identified all major structural components?
1004
+ - [ ] Have I created and outputted a structured list of node IDs and their labels?
1005
+ - [ ] Have I visually analyzed the design snapshot to correlate nodes with design elements?
1006
+
1007
+ **Step 2: Extract Main Nodes Design**
1008
+ - Based on the initial extraction and analysis, identify the main nodes that are critical for the design implementation. These could be reusable headers, body, navigation, sidebar or footer elements that illustrate the main structure.
1009
+ - Use the node IDs from the node-id attribute of the node XML tag to fetch these specific nodes with more depth to capture necessary details for implementation. This targeted extraction will help you to get the relevant design information without overwhelming the process with too much data.
1010
+ - **Depth escalation:** If any main node shows truncated children or contains more elements than expected at the given depth, immediately re-fetch with depth + 5.
1011
+
1012
+ **Tool call example:**
1013
+ \`\`\`
1014
+ ${ctx.figmaD2CToolName}({
1015
+ fileKey: [The fileKey extracted from Step 1]
1016
+ nodeIds: [Array of main node IDs identified from Step 1]
1017
+ depth: 10 // Deeper extraction for main nodes to capture necessary details.
1018
+ })
1019
+ \`\`\`
1020
+
1021
+ **Step 2 Completion Checklist (MUST satisfy before proceeding):**
1022
+ - [ ] Have I captured all interactive components (buttons, inputs, navigation elements)?
1023
+ - [ ] Have I identified all typography styles and text elements?
1024
+ - [ ] Have I extracted all color tokens and design system values?
1025
+ - [ ] Have I documented child node IDs that need deeper extraction in Step 3?
1026
+
1027
+ **Step 3: Extract Child Node Details (MANDATORY)**
1028
+ **CRITICAL:** After Step 2, you MUST proceed to Step 3. Extract ALL child nodes identified in Step 2. Do not skip this step.
1029
+
1030
+ - Extract all child nodes that were identified in Step 2 as requiring deeper analysis. These include specific components, styles, or interactions that are essential for accurate implementation.
1031
+ - Use the node IDs from the node-id attribute to fetch these specific child nodes with sufficient depth to capture all critical design details.
1032
+ - **Depth escalation:** If child nodes still show incomplete extraction (truncated elements, nested components not fully visible), re-fetch with depth + 5 until all leaf-level components are captured.
1033
+
1034
+ **Tool call example:**
1035
+ \`\`\`
1036
+ ${ctx.figmaD2CToolName}({
1037
+ fileKey: [The fileKey extracted from Step 1]
1038
+ nodeIds: [Array of ALL child node IDs identified from Step 2]
1039
+ depth: 15 // Targeted deeper extraction for specific nodes. Increase if needed.
1040
+ })
1041
+ \`\`\`
1042
+
1043
+ **Step 3 Completion Checklist (MUST satisfy before proceeding):**
1044
+ - [ ] Have I captured ALL leaf-level components (buttons, icons, form inputs)?
1045
+ - [ ] Have I extracted all spacing, padding, and margin values?
1046
+ - [ ] Have I identified all border styles, shadows, and visual effects?
1047
+ - [ ] Are there any remaining truncated nodes? (If yes, apply depth escalation)
1048
+
1049
+ **Iterative Extraction and Stopping Condition**
1050
+ Continue iterating over the extraction process following these rules:
1051
+ - **Continue until:** (a) All leaf-level components have been captured with complete details, OR (b) You have completed 3 extraction passes \u2014 whichever comes first.
1052
+ - After each iteration, verify that no new child nodes require deeper extraction.
1053
+ - If depth escalation is needed after 3 passes, document the limitation and proceed with available data.
1054
+
1055
+ **MANDATORY: Design Extraction Verification (Complete BEFORE Code Generation Phase)**
1056
+ Before proceeding to any code generation or implementation phase, you MUST produce and output a verification summary containing:
1057
+
1058
+ 1. **Component Inventory:** List all UI components discovered (buttons, inputs, cards, navigation elements, etc.)
1059
+ 2. **Hierarchy Map:** Show the parent-child relationships of major layout sections
1060
+ 3. **Design Tokens Identified:**
1061
+ - Colors (with hex/rgba values)
1062
+ - Typography (font families, sizes, weights)
1063
+ - Spacing values (margins, paddings, gaps)
1064
+ - Border styles and effects
1065
+ 4. **Gaps and Limitations:** Explicitly state any design elements that could not be fully extracted
1066
+
1067
+ **This verification summary serves as the design specification for implementation. Do not proceed to Code Generation until this summary is complete.**
1068
+
1069
+ **Additional Extraction During Implementation:**
1070
+ - During the implementation phase (Code Generation), you can and should use the ${ctx.figmaD2CToolName} tool with the relevant node IDs from the node-id attributes again if you discover you need more specific design details for certain components or sections that were not captured in earlier phases.
1071
+ - If additional extraction is needed, apply the same depth escalation logic and verification steps.
1072
+ ` : ""}
1073
+
1074
+
1075
+ ${includeLayout ? `
134
1076
  ### Phase: Layout Foundation
135
1077
 
136
1078
  **Step 1: Create Base Layout Structure**
@@ -141,16 +1083,16 @@ ${e.includeLayout?`
141
1083
 
142
1084
  **Tool call example:**
143
1085
  \`\`\`
144
- ${e.layoutAssistantName}({
1086
+ ${ctx.layoutAssistantName}({
145
1087
  prompt="Provide Kendo Design System utility classes for the following layout structure: [LAYOUT DESCRIPTION HERE]",
146
1088
  includeBuildingBlockExamples=true // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
147
1089
  })
148
1090
  \`\`\`
149
- `:""}
150
- ${e.includeComponentsDocs?`
1091
+ ` : ""}
1092
+ ${ctx.includeComponentsDocs ? `
151
1093
  ### Phase: Component Integration
152
1094
  **Step 1: Identify and Implement Core Components**
153
- Based on your current goal, analyze what other ${e.suiteName} components are needed and implement them one by one. Here you are some appropriate components based on the different project type:
1095
+ Based on your current goal, analyze what other ${ctx.suiteName} components are needed and implement them one by one. Here you are some appropriate components based on the different project type:
154
1096
 
155
1097
  **Component Selection Guidelines:**
156
1098
  - **Landing Pages**: Consider Button, Card, Form components, Layout containers, Navigation elements
@@ -158,17 +1100,17 @@ Based on your current goal, analyze what other ${e.suiteName} components are nee
158
1100
  - **Data Entry**: Consider Form, TextBox, DatePicker, DropDownList, Upload, Validation components
159
1101
  - **Content Management**: Consider Grid, Editor, TreeView, FileManager, Dialog components
160
1102
  - **E-commerce**: Consider ListView, Card, Button, Rating, Badge, Carousel components
161
- ${o}
1103
+ ${dragDropGuidance}
162
1104
 
163
1105
  **IMPORTANT COMPONENT USAGE REQUIREMENTS:**
164
- - Make sure to identify all necessary features related to the ${s} based on the current goal.
165
- - Make sure to identify specific features needed for other ${e.suiteName} components based on the current goal.
166
- - Make sure to generate a query for ${e.codeAssistantName} tool for each component and call the tool for each specific feature or functionality.
1106
+ - Make sure to identify all necessary features related to the ${componentsList} based on the current goal.
1107
+ - Make sure to identify specific features needed for other ${ctx.suiteName} components based on the current goal.
1108
+ - Make sure to generate a query for ${ctx.codeAssistantName} tool for each component and call the tool for each specific feature or functionality.
167
1109
  - Always specify the exact features you want for each component. Describe only the needed functionality, and behavior you need. Be concise and don't include any information about the use case.
168
1110
 
169
1111
  **Tool call examples:**
170
1112
  \`\`\`
171
- ${e.codeAssistantName}({
1113
+ ${ctx.codeAssistantName}({
172
1114
  query="Give me information about [COMPONENT_NAME] with [SPECIFIC_FEATURES]." <!-- For example: 'Grid with paging' or 'Button with click events' or 'Chart with multiple series' -->
173
1115
  component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', 'Chart', etc. -->
174
1116
  })
@@ -176,40 +1118,33 @@ ${o}
176
1118
 
177
1119
  For broad queries, break them down into specific features (e.g., paging, sorting, filtering for Grid) and call the tool separately for each feature:
178
1120
  \`\`\`
179
- ${e.codeAssistantName}({
1121
+ ${ctx.codeAssistantName}({
180
1122
  query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'paging in Grid' -->
181
1123
  component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
182
1124
  })
183
1125
  \`\`\`
184
1126
 
185
1127
  \`\`\`
186
- ${e.codeAssistantName}({
1128
+ ${ctx.codeAssistantName}({
187
1129
  query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'sorting in Grid' -->
188
1130
  component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
189
1131
  })
190
1132
  \`\`\`
191
1133
 
192
1134
  \`\`\`
193
- ${e.codeAssistantName}({
1135
+ ${ctx.codeAssistantName}({
194
1136
  query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'filtering in Grid' -->
195
1137
  component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
196
1138
  })
197
1139
  \`\`\`
198
- `:""}
199
- ${e.includeResponsive?`
1140
+ ` : ""}
1141
+ ${ctx.includeResponsive ? `
200
1142
  ### Phase: Layout Responsive Finalization
201
1143
 
202
1144
  **Step 1: Implement Responsive Behavior**
1145
+ ${responsiveKDSGuidance}${responsiveVanillaCSSGuidance}${responsiveTailwindCSSGuidance}` : ""}
203
1146
 
204
- **Tool call example:**
205
- \`\`\`
206
- ${e.layoutAssistantName}({
207
- prompt="Provide Kendo Design System utility classes to make the following layout structure responsive across mobile, tablet, and desktop views: [LAYOUT DESCRIPTION HERE]",
208
- includeBuildingBlockExamples=false // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
209
- })
210
- \`\`\`
211
- `:""}
212
- ${e.includeTheming?`
1147
+ ${ctx.includeTheming ? `
213
1148
  **Step 2: Custom Theme Implementation**
214
1149
 
215
1150
  **CUSTOM THEME REQUIREMENTS:**
@@ -219,13 +1154,13 @@ ${e.includeTheming?`
219
1154
 
220
1155
  **Tool call example:**
221
1156
  \`\`\`
222
- ${e.styleAssistantName}({
1157
+ ${ctx.styleAssistantName}({
223
1158
  query="Create a custom Kendo UI theme that aligns with the following current goal and branding needs: [CURRENT GOAL HERE]. Include strict CSS variables or theme requirements as needed.",
224
1159
  includeThemeVariables=true // Optional, include specific CSS variables for colors, typography, spacing, etc.
225
1160
  })
226
1161
  \`\`\`
227
- `:""}
228
- ${e.includeIcons?`
1162
+ ` : ""}
1163
+ ${ctx.includeIcons ? `
229
1164
  **Step 3: Iconography and Visual Enhancements**
230
1165
 
231
1166
  **ICONOGRAPHY GUIDELINES:**
@@ -235,59 +1170,64 @@ ${e.includeIcons?`
235
1170
 
236
1171
  **Tool call example:**
237
1172
  \`\`\`
238
- ${e.iconAssistantName}({
1173
+ ${ctx.iconAssistantName}({
239
1174
  query="Suggest icons that fit the theme and purpose of the following current goal: [CURRENT GOAL HERE]. Provide icon names and usage context.",
240
1175
  })
241
1176
  \`\`\`
242
- `:""}
1177
+ ` : ""}
243
1178
  ### Phase: Code Generation
244
1179
  **IMPORTANT:** Do NOT generate ANY code or create files until ALL information gathering phases (1-3) are complete.
245
1180
  **Step 1: Generate Complete Implementation**
246
- After completing all information gathering phases above, generate the complete ${e.libKey} component/page implementation:
1181
+ After completing all information gathering phases above, generate the complete ${ctx.libKey} component/page implementation:
247
1182
  **Code Generation Requirements:**
248
- - Create complete, functional ${e.libKey} components/pages
249
- - Include all identified ${e.suiteName} components with their configurations
1183
+ - Create complete, functional ${ctx.libKey} components/pages
1184
+ - Include all identified ${ctx.suiteName} components with their configurations
250
1185
  - Apply ALL Kendo Design System utility classes gathered from layout assistant
251
1186
  - Implement proper component event handling and data binding
252
1187
  - Ensure responsive behavior using Kendo utility classes
253
1188
  - Include necessary import statements and dependencies
254
1189
 
255
- ${t.injectedPlan??""}
1190
+ ${options.injectedPlan ?? ""}
256
1191
 
257
1192
  ### Phase: Validation and Finalization
258
1193
 
259
1194
  **Step 1: Code Validation**
260
1195
  ** CRITICAL REQUIREMENT: You MUST validate the generated UI code using this comprehensive checklist to ensure code quality and compliance:**
261
1196
 
262
- ${n}
1197
+ ${validationInstructions}
263
1198
 
264
1199
  **Step 2: Final Review and Testing**
265
1200
  ** Implementation Validation:**
266
- ${e.includeComponentsDocs?` - Components render correctly without errors
267
- - All ${e.suiteName} component features function as expected
268
- - Event handling and data binding operate correctly`:""}
269
- ${e.includeResponsive?"- Responsive layout works across breakpoints":""}
1201
+ ${ctx.includeComponentsDocs ? ` - Components render correctly without errors
1202
+ - All ${ctx.suiteName} component features function as expected
1203
+ - Event handling and data binding operate correctly` : ""}
1204
+ ${ctx.includeResponsive ? `- Responsive layout works across breakpoints` : ""}
270
1205
 
271
1206
  **Quick Fixes (if needed):**
272
1207
 
273
1208
  After code implementation and validation you can make quick fixes as needed:
274
- - Use ${e.codeAssistantName} for component-specific issues
275
- - Use ${e.layoutAssistantName} for styling adjustments
1209
+ - Use ${ctx.codeAssistantName} for component-specific issues
1210
+ - Use ${ctx.layoutAssistantName} for styling adjustments
276
1211
 
277
1212
  +### Before You Begin
278
- - When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${e.name} was called.
1213
+ - When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${ctx.name} was called.
279
1214
  - Do NOT generate or suggest any code until all tools have been used and validated responses are incorporated.
280
1215
  - Focus on planning and sequencing.
281
1216
  - Summarize the components, layouts, and utilities gathered.
282
- - Confirm all required inputs from tools have been provided.`};var V=e=>`# ${e.suiteName} Assistant
1217
+ - Confirm all required inputs from tools have been provided.`;
1218
+ };
1219
+
1220
+ // packages/kendo-ui-agent/src/lib/templates/assistant-orchestrator.ts
1221
+ var renderAssistantOrchestratorResponse = (ctx) => {
1222
+ return `# ${ctx.suiteName} Assistant
283
1223
 
284
1224
  **What you're looking for:**
285
1225
 
286
- ${e.userIntent}
1226
+ ${ctx.userIntent}
287
1227
 
288
1228
  **Available Tools:**
289
- - **${e.codeAssistantName}** - Get component documentation, features, and usage examples
290
- - **${e.iconAssistantName}** - Search for icons from the Kendo icon library
1229
+ - **${ctx.codeAssistantName}** - Get component documentation, features, and usage examples
1230
+ - **${ctx.iconAssistantName}** - Search for icons from the Kendo icon library
291
1231
 
292
1232
  ---
293
1233
 
@@ -297,7 +1237,7 @@ Follow these steps to find the right components and resources:
297
1237
 
298
1238
  ### Step 1: Identify Components
299
1239
 
300
- Based on your needs, consider these ${e.suiteName} component categories:
1240
+ Based on your needs, consider these ${ctx.suiteName} component categories:
301
1241
 
302
1242
  **Common Use Cases:**
303
1243
  - **Data Display**: Grid, ListView, TreeView, Card, TileLayout
@@ -310,10 +1250,10 @@ Based on your needs, consider these ${e.suiteName} component categories:
310
1250
 
311
1251
  **How to explore components:**
312
1252
 
313
- Use the ${e.codeAssistantName} tool to learn about specific components:
1253
+ Use the ${ctx.codeAssistantName} tool to learn about specific components:
314
1254
 
315
1255
  \`\`\`
316
- ${e.codeAssistantName}({
1256
+ ${ctx.codeAssistantName}({
317
1257
  query: "What are the main features of [COMPONENT_NAME]?",
318
1258
  component: "[COMPONENT_NAME]"
319
1259
  })
@@ -321,14 +1261,14 @@ ${e.codeAssistantName}({
321
1261
 
322
1262
  **Examples:**
323
1263
  \`\`\`
324
- ${e.codeAssistantName}({
1264
+ ${ctx.codeAssistantName}({
325
1265
  query: "How to use Grid with paging and sorting?",
326
1266
  component: "Grid"
327
1267
  })
328
1268
  \`\`\`
329
1269
 
330
1270
  \`\`\`
331
- ${e.codeAssistantName}({
1271
+ ${ctx.codeAssistantName}({
332
1272
  query: "What features does DatePicker have?",
333
1273
  component: "DatePicker"
334
1274
  })
@@ -339,37 +1279,37 @@ ${e.codeAssistantName}({
339
1279
  - Break complex queries into multiple calls focusing on one feature at a time
340
1280
  - Specify the exact component name in the component parameter
341
1281
 
342
- ${e.includeIcons?`
1282
+ ${ctx.includeIcons ? `
343
1283
  ### Step 2: Find Icons
344
1284
 
345
- Use the ${e.iconAssistantName} tool to search for icons:
1285
+ Use the ${ctx.iconAssistantName} tool to search for icons:
346
1286
 
347
1287
  \`\`\`
348
- ${e.iconAssistantName}({
1288
+ ${ctx.iconAssistantName}({
349
1289
  query: "Search for icons related to [YOUR THEME/PURPOSE]"
350
1290
  })
351
1291
  \`\`\`
352
1292
 
353
1293
  **Examples:**
354
1294
  \`\`\`
355
- ${e.iconAssistantName}({
1295
+ ${ctx.iconAssistantName}({
356
1296
  query: "icons for navigation menu"
357
1297
  })
358
1298
  \`\`\`
359
1299
 
360
1300
  \`\`\`
361
- ${e.iconAssistantName}({
1301
+ ${ctx.iconAssistantName}({
362
1302
  query: "icons for user actions like edit, delete, save"
363
1303
  })
364
1304
  \`\`\`
365
- `:""}
1305
+ ` : ""}
366
1306
 
367
1307
  ### Step 3: Review and Implement
368
1308
 
369
1309
  After gathering information:
370
- 1. Review the component documentation provided by ${e.codeAssistantName}
371
- 2. Check which icons are available from ${e.iconAssistantName}
372
- 3. Use the official ${e.suiteName} documentation for detailed implementation guides
1310
+ 1. Review the component documentation provided by ${ctx.codeAssistantName}
1311
+ 2. Check which icons are available from ${ctx.iconAssistantName}
1312
+ 3. Use the official ${ctx.suiteName} documentation for detailed implementation guides
373
1313
  4. Refer to the component examples and code snippets provided
374
1314
 
375
1315
  ---
@@ -377,144 +1317,1525 @@ After gathering information:
377
1317
  ## Getting Started
378
1318
 
379
1319
  **Next Actions:**
380
- 1. Start by calling ${e.codeAssistantName} for the components you need
381
- 2. ${e.includeIcons?`Search for icons using ${e.iconAssistantName}`:"Review the component documentation"}
382
- 3. Follow the ${e.suiteName} official documentation for implementation details
1320
+ 1. Start by calling ${ctx.codeAssistantName} for the components you need
1321
+ 2. ${ctx.includeIcons ? `Search for icons using ${ctx.iconAssistantName}` : "Review the component documentation"}
1322
+ 3. Follow the ${ctx.suiteName} official documentation for implementation details
383
1323
 
384
1324
  **Important Notes:**
385
1325
  - These tools provide documentation and guidance, not code generation
386
- - Always refer to official ${e.suiteName} documentation for the most up-to-date information
387
- - Tool responses include usage examples and best practices`;var x=(e,t)=>({SETUP_VALIDATION:`
1326
+ - Always refer to official ${ctx.suiteName} documentation for the most up-to-date information
1327
+ - Tool responses include usage examples and best practices`;
1328
+ };
1329
+
1330
+ // packages/kendo-ui-agent/src/lib/templates/shared-validation.ts
1331
+ var getSharedValidationSteps = (uiLibrary, designSystem) => ({
1332
+ SETUP_VALIDATION: `
388
1333
  UI Library Setup:
389
- - ${e} modules properly imported and configured
390
- - ${e} theme properly loaded and applied
391
- - ${e} license properly configured
392
- - Globalization and localization properly configured for ${e} components
393
- - Required ${e} dependencies installed and up-to-date`,PERFORMANCE_OPTIMIZATION:`
1334
+ - ${uiLibrary} modules properly imported and configured
1335
+ - ${uiLibrary} theme properly loaded and applied
1336
+ - ${uiLibrary} license properly configured
1337
+ - Globalization and localization properly configured for ${uiLibrary} components
1338
+ - Required ${uiLibrary} dependencies installed and up-to-date`,
1339
+ PERFORMANCE_OPTIMIZATION: `
394
1340
  Performance Optimization:
395
1341
  - Efficient rendering patterns to prevent unnecessary re-renders
396
- - Lazy loading of ${e} components when appropriate
397
- - Virtualization enabled for large datasets in ${e} components
398
- - Only required ${e} modules imported and tree-shaken`,THEME_AND_STYLING:`
399
- ${e} Theme & Styling:
400
- - Prioritize the ${t} Design System utilities
1342
+ - Lazy loading of ${uiLibrary} components when appropriate
1343
+ - Virtualization enabled for large datasets in ${uiLibrary} components
1344
+ - Only required ${uiLibrary} modules imported and tree-shaken`,
1345
+ THEME_AND_STYLING: `
1346
+ ${uiLibrary} Theme & Styling:
1347
+ - Prioritize the ${designSystem} Design System utilities
401
1348
  - Avoid custom CSS or other framework classes
402
1349
  - Do not use inline styles
403
- - Consistent ${e} theme application across all components
1350
+ - Consistent ${uiLibrary} theme application across all components
404
1351
  - Custom theme variables properly defined and scoped
405
- - ${e} icon fonts properly loaded and optimized
406
- - Brand colors integrated with ${e} component themes`});function mt(e,t){let n;try{n=JSON.parse(e)}catch{return e}let o=n?.Item;if(!o)return e;let s=[],r=o.FullName??o.Name??"",a=o.Type??"",i=o.Summary??"",d=o.SyntaxContent??"";s.push(`## API Reference Item
407
- - Name: ${r}
408
- - Type: ${a}
409
- - Summary: ${i}
410
- - Syntax: ${d}`);let m=n.RelatedItemsByType?.return_type;if(m?.length){let p=m[0].Text;p&&s.push(`- Return Type: ${p}`)}let A=o.Examples??[];if(A.length>0){let p=`## Examples
411
- `,c=0;for(let y of A){let S=(y.Component??"").toLowerCase(),T=t.toLowerCase();if(S&&S!==T&&S!=="general")continue;c+=1;let k=y.Code??"";p+=`### Example ${c}
1352
+ - ${uiLibrary} icon fonts properly loaded and optimized
1353
+ - Brand colors integrated with ${uiLibrary} component themes`
1354
+ });
1355
+
1356
+ // packages/kendo-ui-agent/src/lib/templates/tailwind-bridge.ts
1357
+ var kendoTokenList = `--kendo-color-app-surface
1358
+ --kendo-color-on-app-surface
1359
+ --kendo-color-subtle
1360
+ --kendo-color-surface
1361
+ --kendo-color-surface-alt
1362
+ --kendo-color-border
1363
+ --kendo-color-border-alt
1364
+ /* Base */
1365
+ --kendo-color-base-subtle
1366
+ --kendo-color-base-subtle-hover
1367
+ --kendo-color-base-subtle-active
1368
+ --kendo-color-base
1369
+ --kendo-color-base-hover
1370
+ --kendo-color-base-active
1371
+ --kendo-color-base-emphasis
1372
+ --kendo-color-base-on-subtle
1373
+ --kendo-color-on-base
1374
+ --kendo-color-base-on-surface
1375
+ /* Primary */
1376
+ --kendo-color-primary-subtle
1377
+ --kendo-color-primary-subtle-hover
1378
+ --kendo-color-primary-subtle-active
1379
+ --kendo-color-primary
1380
+ --kendo-color-primary-hover
1381
+ --kendo-color-primary-active
1382
+ --kendo-color-primary-emphasis
1383
+ --kendo-color-primary-on-subtle
1384
+ --kendo-color-on-primary
1385
+ --kendo-color-primary-on-surface
1386
+ /* Secondary */
1387
+ --kendo-color-secondary-subtle
1388
+ --kendo-color-secondary-subtle-hover
1389
+ --kendo-color-secondary-subtle-active
1390
+ --kendo-color-secondary
1391
+ --kendo-color-secondary-hover
1392
+ --kendo-color-secondary-active
1393
+ --kendo-color-secondary-emphasis
1394
+ --kendo-color-secondary-on-subtle
1395
+ --kendo-color-on-secondary
1396
+ --kendo-color-secondary-on-surface
1397
+ /* Tertiary */
1398
+ --kendo-color-tertiary-subtle
1399
+ --kendo-color-tertiary-subtle-hover
1400
+ --kendo-color-tertiary-subtle-active
1401
+ --kendo-color-tertiary
1402
+ --kendo-color-tertiary-hover
1403
+ --kendo-color-tertiary-active
1404
+ --kendo-color-tertiary-emphasis
1405
+ --kendo-color-tertiary-on-subtle
1406
+ --kendo-color-on-tertiary
1407
+ --kendo-color-tertiary-on-surface
1408
+ /* Info */
1409
+ --kendo-color-info-subtle
1410
+ --kendo-color-info-subtle-hover
1411
+ --kendo-color-info-subtle-active
1412
+ --kendo-color-info
1413
+ --kendo-color-info-hover
1414
+ --kendo-color-info-active
1415
+ --kendo-color-info-emphasis
1416
+ --kendo-color-info-on-subtle
1417
+ --kendo-color-on-info
1418
+ --kendo-color-info-on-surface
1419
+ /* Success */
1420
+ --kendo-color-success-subtle
1421
+ --kendo-color-success-subtle-hover
1422
+ --kendo-color-success-subtle-active
1423
+ --kendo-color-success
1424
+ --kendo-color-success-hover
1425
+ --kendo-color-success-active
1426
+ --kendo-color-success-emphasis
1427
+ --kendo-color-success-on-subtle
1428
+ --kendo-color-on-success
1429
+ --kendo-color-success-on-surface
1430
+ /* Warning */
1431
+ --kendo-color-warning-subtle
1432
+ --kendo-color-warning-subtle-hover
1433
+ --kendo-color-warning-subtle-active
1434
+ --kendo-color-warning
1435
+ --kendo-color-warning-hover
1436
+ --kendo-color-warning-active
1437
+ --kendo-color-warning-emphasis
1438
+ --kendo-color-warning-on-subtle
1439
+ --kendo-color-on-warning
1440
+ --kendo-color-warning-on-surface
1441
+ /* Error */
1442
+ --kendo-color-error-subtle
1443
+ --kendo-color-error-subtle-hover
1444
+ --kendo-color-error-subtle-active
1445
+ --kendo-color-error
1446
+ --kendo-color-error-hover
1447
+ --kendo-color-error-active
1448
+ --kendo-color-error-emphasis
1449
+ --kendo-color-error-on-subtle
1450
+ --kendo-color-on-error
1451
+ --kendo-color-error-on-surface
1452
+ /* Light */
1453
+ --kendo-color-light-subtle
1454
+ --kendo-color-light-subtle-hover
1455
+ --kendo-color-light-subtle-active
1456
+ --kendo-color-light
1457
+ --kendo-color-light-hover
1458
+ --kendo-color-light-active
1459
+ --kendo-color-light-emphasis
1460
+ --kendo-color-light-on-subtle
1461
+ --kendo-color-on-light
1462
+ --kendo-color-light-on-surface
1463
+ /* Dark */
1464
+ --kendo-color-dark-subtle
1465
+ --kendo-color-dark-subtle-hover
1466
+ --kendo-color-dark-subtle-active
1467
+ --kendo-color-dark
1468
+ --kendo-color-dark-hover
1469
+ --kendo-color-dark-active
1470
+ --kendo-color-dark-emphasis
1471
+ --kendo-color-dark-on-subtle
1472
+ --kendo-color-on-dark
1473
+ --kendo-color-dark-on-surface
1474
+ /* Inverse */
1475
+ --kendo-color-inverse-subtle
1476
+ --kendo-color-inverse-subtle-hover
1477
+ --kendo-color-inverse-subtle-active
1478
+ --kendo-color-inverse
1479
+ --kendo-color-inverse-hover
1480
+ --kendo-color-inverse-active
1481
+ --kendo-color-inverse-emphasis
1482
+ --kendo-color-inverse-on-subtle
1483
+ --kendo-color-on-inverse
1484
+ --kendo-color-inverse-on-surface
1485
+ /* Series A */
1486
+ --kendo-color-series-a
1487
+ --kendo-color-series-a-bold
1488
+ --kendo-color-series-a-bolder
1489
+ --kendo-color-series-a-subtle
1490
+ --kendo-color-series-a-subtler
1491
+ /* Series B */
1492
+ --kendo-color-series-b
1493
+ --kendo-color-series-b-bold
1494
+ --kendo-color-series-b-bolder
1495
+ --kendo-color-series-b-subtle
1496
+ --kendo-color-series-b-subtler
1497
+ /* Series C */
1498
+ --kendo-color-series-c
1499
+ --kendo-color-series-c-bold
1500
+ --kendo-color-series-c-bolder
1501
+ --kendo-color-series-c-subtle
1502
+ --kendo-color-series-c-subtler
1503
+ /* Series D */
1504
+ --kendo-color-series-d
1505
+ --kendo-color-series-d-bold
1506
+ --kendo-color-series-d-bolder
1507
+ --kendo-color-series-d-subtle
1508
+ --kendo-color-series-d-subtler
1509
+ /* Series E */
1510
+ --kendo-color-series-e
1511
+ --kendo-color-series-e-bold
1512
+ --kendo-color-series-e-bolder
1513
+ --kendo-color-series-e-subtle
1514
+ --kendo-color-series-e-subtler
1515
+ /* Series F */
1516
+ --kendo-color-series-f
1517
+ --kendo-color-series-f-bold
1518
+ --kendo-color-series-f-bolder
1519
+ --kendo-color-series-f-subtle
1520
+ --kendo-color-series-f-subtler
1521
+ /* Typography */
1522
+ --kendo-font-family-sans
1523
+ --kendo-font-family-sans-serif
1524
+ --kendo-font-family-monospace
1525
+ --kendo-font-size-xs
1526
+ --kendo-line-height-xs
1527
+ --kendo-font-size-sm
1528
+ --kendo-line-height-sm
1529
+ --kendo-font-size
1530
+ --kendo-line-height
1531
+ --kendo-font-size-lg
1532
+ --kendo-line-height-lg
1533
+ /* Border Radius */
1534
+ --kendo-border-radius-none
1535
+ --kendo-border-radius-xs
1536
+ --kendo-border-radius-sm
1537
+ --kendo-border-radius-md
1538
+ --kendo-border-radius-lg
1539
+ --kendo-border-radius-xl
1540
+ --kendo-border-radius-xxl
1541
+ --kendo-border-radius-xxxl
1542
+ --radius-4xl: 1.5rem
1543
+ --kendo-border-radius-full`;
1544
+ var tailwindV3SetupPrompt = `I need you to set up a system where Tailwind CSS is the single source of truth for all design tokens, and those tokens are automatically reflected as CSS custom properties so I can use them in regular CSS too.
1545
+ Requirements:
1546
+
1547
+ All design tokens (colors, spacing, font families, border radius, shadows) are defined once in tailwind.config.js
1548
+ A Tailwind plugin emits every token as a --token-name CSS custom property on :root
1549
+ Colors support Tailwind's opacity modifier syntax (bg-primary/50) using the rgb(var(--color-x-rgb) / <alpha-value>) pattern
1550
+ Dark mode tokens are emitted under .dark so that both dark: utility variants and var(--color-x) in custom CSS update together
1551
+ var(--color-primary) in hand-written CSS and bg-primary in HTML resolve to the same value
1552
+
1553
+ Use the Kendo theme tokens listed above as the design tokens.
1554
+
1555
+ Output I need:
1556
+
1557
+ The full tailwind.config.js with the plugin included
1558
+ The base CSS file importing Tailwind
1559
+ A short example showing a component using both bg-primary and var(--color-primary) side by side`;
1560
+ var tailwindV4SetupPrompt = `I need you to set up a system where Tailwind CSS v4 is the single source of truth for all design tokens, and those tokens are automatically available as CSS custom properties so I can use them in regular CSS too.
1561
+ Requirements:
1562
+
1563
+ All design tokens (colors, spacing, font families, border radius, shadows) are defined once in the @theme block \u2014 no tailwind.config.js
1564
+ Every @theme variable is natively available as a var(--token-name) CSS custom property with no plugin needed
1565
+ Colors use oklch and support opacity modifier syntax (bg-primary/50) natively
1566
+ Dark mode tokens are re-declared under .dark so that both dark: utility variants and var(--color-x) in custom CSS update together
1567
+ var(--color-primary) in hand-written CSS and bg-primary in HTML resolve to the same value
1568
+
1569
+ Use the Kendo theme tokens listed above as the design tokens.
1570
+
1571
+ Output I need:
1572
+
1573
+ The single CSS file with @import "tailwindcss", the @theme block, and the .dark overrides
1574
+ A short example showing a component using both bg-primary and var(--color-primary) side by side`;
1575
+ var tailwindBridgeExample = `## Tailwind CSS Setup Instructions
1576
+
1577
+ Detect which version of Tailwind CSS the project uses, then follow the appropriate setup guide below.
1578
+
1579
+ ### Kendo Theme Tokens
1580
+ These are the design tokens to map into Tailwind:
1581
+ ${kendoTokenList}
1582
+
1583
+ ### For Tailwind CSS v3 (uses tailwind.config.js)
1584
+
1585
+ <tailwind_v3_setup>
1586
+ ${tailwindV3SetupPrompt}
1587
+ </tailwind_v3_setup>
1588
+
1589
+ ### For Tailwind CSS v4 (uses @theme block, no config file)
1590
+
1591
+ <tailwind_v4_setup>
1592
+ ${tailwindV4SetupPrompt}
1593
+ </tailwind_v4_setup>
1594
+
1595
+ IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;
1596
+
1597
+ // packages/kendo-ui-agent/src/lib/tools-factory.ts
1598
+ function formatApiRefItemFromJson(rawValue, component) {
1599
+ let data;
1600
+ try {
1601
+ data = JSON.parse(rawValue);
1602
+ } catch {
1603
+ return rawValue;
1604
+ }
1605
+ const item = data?.Item;
1606
+ if (!item) {
1607
+ return rawValue;
1608
+ }
1609
+ const sectionParts = [];
1610
+ const name = item.FullName ?? item.Name ?? "";
1611
+ const type = item.Type ?? "";
1612
+ const summary = item.Summary ?? "";
1613
+ const syntax = item.SyntaxContent ?? "";
1614
+ sectionParts.push(
1615
+ `## API Reference Item
1616
+ - Name: ${name}
1617
+ - Type: ${type}
1618
+ - Summary: ${summary}
1619
+ - Syntax: ${syntax}`
1620
+ );
1621
+ const returnTypeItems = data.RelatedItemsByType?.["return_type"];
1622
+ if (returnTypeItems?.length) {
1623
+ const returnType = returnTypeItems[0].Text;
1624
+ if (returnType) {
1625
+ sectionParts.push(`- Return Type: ${returnType}`);
1626
+ }
1627
+ }
1628
+ const examples = item.Examples ?? [];
1629
+ if (examples.length > 0) {
1630
+ let exampleSection = "## Examples\n";
1631
+ let exampleIndex = 0;
1632
+ for (const example of examples) {
1633
+ const exComponent = (example.Component ?? "").toLowerCase();
1634
+ const compLower = component.toLowerCase();
1635
+ if (exComponent && exComponent !== compLower && exComponent !== "general") {
1636
+ continue;
1637
+ }
1638
+ exampleIndex += 1;
1639
+ const code = example.Code ?? "";
1640
+ exampleSection += `### Example ${exampleIndex}
412
1641
  \`\`\`
413
- ${k}
1642
+ ${code}
414
1643
  \`\`\`
415
- `}c>0&&s.push(p)}let h=n.RelatedItemsByType??{},f=[];for(let[p,c]of Object.entries(h))if(!(p==="return_type"||p==="render_fragment"))for(let y of c??[]){let S=y.FullName??"",T=y.ShortText??"";f.push(`### ${S} (${p})
416
- ${T}`)}return f.length>0&&s.push(`## Additional Context
417
- `+f.join(`
418
- ---
419
- `)),s.join(`
420
-
421
- `)}function ue(e,t,n){let{name:o,title:s,description:r,layoutAssistantName:a,codeAssistantName:i,styleAssistantName:d,iconAssistantName:m,accessibilityAssistantName:A,suiteName:h,libKey:f,components:p}=e,c=new v(o,{title:s,description:r,requiredAccess:e.requiredAccess,inputSchema:{userIntent:C.string().describe(`Detailed description and intent of what the user wants to build. Include the type of page/component, main functionality, visual requirements, and any specific ${h} components you want to use.`),needsComponentsDocsConfidence:C.number().min(0).max(1).default(1).describe("Confidence (0-1) to include Component Documentation assistance. Default is 1."),needsLayoutConfidence:C.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Layout assistance. Default is 0."),needsStylingConfidence:C.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Theming/Styling assistance. Default is 0."),needsResponsiveBehaviorConfidence:C.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Responsive Behavior assistance. Default is 0."),needsIconsConfidence:C.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Icons assistance. Default is 0."),componentsNeeded:C.array(C.enum(p)).optional().describe(`Optional list of specific ${h} components needed for the project.`)}},async({userIntent:y,needsComponentsDocsConfidence:S,needsLayoutConfidence:T,needsStylingConfidence:k,needsResponsiveBehaviorConfidence:N,needsIconsConfidence:X,componentsNeeded:Z},{_meta:Ye})=>{g("UI Orchestrator called with:",{userIntent:y,needsComponentsDocsConfidence:S,needsLayoutConfidence:T,needsStylingConfidence:k,needsResponsiveBehaviorConfidence:N,needsIconsConfidence:X});try{await n.recordOrchestratorUserRequest({meta:{userIntent:y,componentsNeeded:Z,_meta:Ye}})}catch(G){throw R(G)}let Qe=c.server?.server.getClientCapabilities?.()?.elicitation,ee;if(Qe&&k>.3&&k<=.6){let G=await c.server?.server.elicitInput({message:"I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",requestedSchema:{type:"object",properties:{includeCustomTheming:{type:"boolean",description:"Whether to include Custom Theming assistance in the workflow."}},required:["includeCustomTheming"]}});G?.action==="accept"&&G.content?.includeCustomTheming&&(ee=!0)}return{content:[{type:"text",text:L({name:o,userIntent:y,includeComponentsDocs:S>.3,includeTheming:k>.6||!!ee,includeLayout:T>.5,includeIcons:X>.6,includeResponsive:T>.5&&N>.4,layoutAssistantName:a,codeAssistantName:i,styleAssistantName:d,iconAssistantName:m,accessibilityAssistantName:A,suiteName:h,libKey:f,components:Z},t)}]}});return c}function ge(e,t){let{name:n,title:o,description:s,iconAssistantName:r,codeAssistantName:a,suiteName:i,libKey:d,components:m}=e;return new v(n,{title:o,description:s,inputSchema:{userIntent:C.string().describe(`Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${i}.`),needsIconsConfidence:C.number().min(0).max(1).default(.7).describe("Confidence (0-1) to include Icons assistance. Default is 0.7."),componentsNeeded:C.array(C.enum(m)).optional().describe(`Optional list of specific ${i} components you want to learn about.`)},requiredAccess:e.requiredAccess},async({userIntent:h,needsIconsConfidence:f,componentsNeeded:p},{_meta:c})=>{g("Assistant Orchestrator called with:",{userIntent:h,needsIconsConfidence:f,componentsNeeded:p});try{await t.recordOrchestratorUserRequest({meta:{userIntent:h,componentsNeeded:p,_meta:c}})}catch(S){throw R(S)}return{content:[{type:"text",text:V({name:n,userIntent:h,includeComponentsDocs:!0,includeIcons:f>.5,codeAssistantName:a,iconAssistantName:r,suiteName:i,libKey:d,components:p})}]}})}function he(e,t){let{name:n,title:o,description:s,suiteName:r,libKey:a,getPreContent:i}=e;return new v(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:C.string().describe("An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve."),includeBuildingBlockExamples:C.boolean().describe("Whether to include building block examples. Defaults to false.").default(!1)}},async({prompt:d,includeBuildingBlockExamples:m},{_meta:A})=>{g("Layout Assistant called with:",{prompt:d,includeBuildingBlockExamples:m});try{let f=(await t.queryCssUtils({query:d},{_meta:A})).values.join(`
422
- `)||"No CSS utilities found for the given prompt.",p=i?.()??"",c=y=>`${p}
1644
+ `;
1645
+ }
1646
+ if (exampleIndex > 0) {
1647
+ sectionParts.push(exampleSection);
1648
+ }
1649
+ }
1650
+ const related = data.RelatedItemsByType ?? {};
1651
+ const additionalContextItems = [];
1652
+ for (const [relationType, relatedItems] of Object.entries(related)) {
1653
+ if (relationType === "return_type" || relationType === "render_fragment") {
1654
+ continue;
1655
+ }
1656
+ for (const relatedItem of relatedItems ?? []) {
1657
+ const fullName = relatedItem.FullName ?? "";
1658
+ const shortText = relatedItem.ShortText ?? "";
1659
+ additionalContextItems.push(`### ${fullName} (${relationType})
1660
+ ${shortText}`);
1661
+ }
1662
+ }
1663
+ if (additionalContextItems.length > 0) {
1664
+ sectionParts.push("## Additional Context\n" + additionalContextItems.join("\n---\n"));
1665
+ }
1666
+ return sectionParts.join("\n\n");
1667
+ }
1668
+ var LAYOUT_MODE = process.env.KENDO_UIA_LAYOUT_MODE || "utils";
1669
+ function createOrchestratorTool(config, templateOptions, contextApi2) {
1670
+ const {
1671
+ name,
1672
+ title,
1673
+ description,
1674
+ layoutAssistantName: layoutAssistantName2,
1675
+ codeAssistantName: codeAssistantName2,
1676
+ styleAssistantName: styleAssistantName2,
1677
+ iconAssistantName: iconAssistantName2,
1678
+ accessibilityAssistantName: accessibilityAssistantName2,
1679
+ figmaD2CToolName: figmaD2CToolName2,
1680
+ suiteName,
1681
+ libKey,
1682
+ components
1683
+ } = config;
1684
+ const tool = new UIAgentTool(
1685
+ name,
1686
+ {
1687
+ title,
1688
+ description,
1689
+ requiredAccess: config.requiredAccess,
1690
+ inputSchema: {
1691
+ userIntent: z4.string().describe(
1692
+ `Detailed description and intent of what the user wants to build. Include the type of page/component, main functionality, visual requirements, and any specific ${suiteName} components you want to use.`
1693
+ ),
1694
+ needsComponentsDocsConfidence: z4.number().min(0).max(1).default(1).describe(
1695
+ "Confidence (0-1) to include Component Documentation assistance. Default is 1."
1696
+ ),
1697
+ needsLayoutConfidence: z4.number().min(0).max(1).default(0).describe(
1698
+ "Confidence (0-1) to include Layout assistance. Default is 0."
1699
+ ),
1700
+ needsStylingConfidence: z4.number().min(0).max(1).default(0).describe(
1701
+ "Confidence (0-1) to include Theming/Styling assistance. Default is 0."
1702
+ ),
1703
+ needsResponsiveBehaviorConfidence: z4.number().min(0).max(1).default(0).describe(
1704
+ "Confidence (0-1) to include Responsive Behavior assistance. Default is 0."
1705
+ ),
1706
+ needsIconsConfidence: z4.number().min(0).max(1).default(0).describe(
1707
+ "Confidence (0-1) to include Icons assistance. Default is 0."
1708
+ ),
1709
+ needsFigmaD2CConfidence: z4.boolean().describe("Whether to include Figma D2C assistance. If the prompt includes a Figma URL always make sure to set to true.").default(false),
1710
+ componentsNeeded: z4.array(z4.enum(components)).optional().describe(
1711
+ `Optional list of specific ${suiteName} components needed for the project.`
1712
+ )
1713
+ }
1714
+ },
1715
+ async ({
1716
+ userIntent,
1717
+ needsComponentsDocsConfidence,
1718
+ needsLayoutConfidence,
1719
+ needsStylingConfidence,
1720
+ needsResponsiveBehaviorConfidence,
1721
+ needsIconsConfidence,
1722
+ needsFigmaD2CConfidence,
1723
+ componentsNeeded
1724
+ }, { _meta }) => {
1725
+ log("UI Orchestrator called with:", {
1726
+ userIntent,
1727
+ needsComponentsDocsConfidence,
1728
+ needsLayoutConfidence,
1729
+ needsStylingConfidence,
1730
+ needsResponsiveBehaviorConfidence,
1731
+ needsIconsConfidence
1732
+ });
1733
+ try {
1734
+ await contextApi2.recordOrchestratorUserRequest({
1735
+ meta: {
1736
+ userIntent,
1737
+ componentsNeeded,
1738
+ _meta
1739
+ }
1740
+ });
1741
+ } catch (error) {
1742
+ throw getGrpcError(error);
1743
+ }
1744
+ const clientCapabilities = tool.server?.server.getClientCapabilities?.();
1745
+ const supportsElicitation = clientCapabilities?.elicitation;
1746
+ let forceIncludeCustomTheming;
1747
+ if (supportsElicitation && needsStylingConfidence > 0.3 && needsStylingConfidence <= 0.6) {
1748
+ const result = await tool.server?.server.elicitInput({
1749
+ message: "I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",
1750
+ requestedSchema: {
1751
+ type: "object",
1752
+ properties: {
1753
+ includeCustomTheming: {
1754
+ type: "boolean",
1755
+ description: "Whether to include Custom Theming assistance in the workflow."
1756
+ }
1757
+ },
1758
+ required: ["includeCustomTheming"]
1759
+ }
1760
+ });
1761
+ if (result?.action === "accept" && result.content?.includeCustomTheming) {
1762
+ forceIncludeCustomTheming = true;
1763
+ }
1764
+ }
1765
+ const response = renderOrchestratorResponse(
1766
+ {
1767
+ name,
1768
+ userIntent,
1769
+ includeComponentsDocs: needsComponentsDocsConfidence > 0.3,
1770
+ includeTheming: needsStylingConfidence > 0.6 || !!forceIncludeCustomTheming,
1771
+ includeLayout: needsLayoutConfidence > 0.5,
1772
+ includeIcons: needsIconsConfidence > 0.6,
1773
+ includeResponsive: needsLayoutConfidence > 0.5 && needsResponsiveBehaviorConfidence > 0.4,
1774
+ includeFigmaD2C: needsFigmaD2CConfidence,
1775
+ layoutAssistantName: layoutAssistantName2,
1776
+ codeAssistantName: codeAssistantName2,
1777
+ styleAssistantName: styleAssistantName2,
1778
+ iconAssistantName: iconAssistantName2,
1779
+ accessibilityAssistantName: accessibilityAssistantName2,
1780
+ figmaD2CToolName: figmaD2CToolName2,
1781
+ suiteName,
1782
+ libKey,
1783
+ layoutMode: LAYOUT_MODE,
1784
+ components: componentsNeeded
1785
+ },
1786
+ templateOptions
1787
+ );
1788
+ return {
1789
+ content: [
1790
+ {
1791
+ type: "text",
1792
+ text: response
1793
+ }
1794
+ ]
1795
+ };
1796
+ }
1797
+ );
1798
+ return tool;
1799
+ }
1800
+ function createAssistantOrchestratorTool(config, contextApi2) {
1801
+ const {
1802
+ name,
1803
+ title,
1804
+ description,
1805
+ iconAssistantName: iconAssistantName2,
1806
+ codeAssistantName: codeAssistantName2,
1807
+ suiteName,
1808
+ libKey,
1809
+ components
1810
+ } = config;
1811
+ const tool = new UIAgentTool(
1812
+ name,
1813
+ {
1814
+ title,
1815
+ description,
1816
+ inputSchema: {
1817
+ userIntent: z4.string().describe(
1818
+ `Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${suiteName}.`
1819
+ ),
1820
+ needsIconsConfidence: z4.number().min(0).max(1).default(0.7).describe(
1821
+ "Confidence (0-1) to include Icons assistance. Default is 0.7."
1822
+ ),
1823
+ componentsNeeded: z4.array(z4.enum(components)).optional().describe(
1824
+ `Optional list of specific ${suiteName} components you want to learn about.`
1825
+ )
1826
+ },
1827
+ requiredAccess: config.requiredAccess
1828
+ },
1829
+ async ({
1830
+ userIntent,
1831
+ needsIconsConfidence,
1832
+ componentsNeeded
1833
+ }, { _meta }) => {
1834
+ log("Assistant Orchestrator called with:", {
1835
+ userIntent,
1836
+ needsIconsConfidence,
1837
+ componentsNeeded
1838
+ });
1839
+ try {
1840
+ await contextApi2.recordOrchestratorUserRequest({
1841
+ meta: {
1842
+ userIntent,
1843
+ componentsNeeded,
1844
+ _meta
1845
+ }
1846
+ });
1847
+ } catch (error) {
1848
+ throw getGrpcError(error);
1849
+ }
1850
+ const response = renderAssistantOrchestratorResponse({
1851
+ name,
1852
+ userIntent,
1853
+ includeComponentsDocs: true,
1854
+ // Always true for assistant mode
1855
+ includeIcons: needsIconsConfidence > 0.5,
1856
+ codeAssistantName: codeAssistantName2,
1857
+ iconAssistantName: iconAssistantName2,
1858
+ suiteName,
1859
+ libKey,
1860
+ components: componentsNeeded
1861
+ });
1862
+ return {
1863
+ content: [
1864
+ {
1865
+ type: "text",
1866
+ text: response
1867
+ }
1868
+ ]
1869
+ };
1870
+ }
1871
+ );
1872
+ return tool;
1873
+ }
1874
+ function createLayoutAssistantTool(config, contextApi2) {
1875
+ const {
1876
+ name,
1877
+ title,
1878
+ description,
1879
+ suiteName: _suiteName,
1880
+ libKey,
1881
+ getPreContent
1882
+ } = config;
1883
+ return new UIAgentTool(
1884
+ name,
1885
+ {
1886
+ title,
1887
+ description,
1888
+ requiredAccess: LAYOUT_MODE === "utils" ? config.requiredAccess : ["none"],
1889
+ inputSchema: {
1890
+ prompt: z4.string().describe(
1891
+ `An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve.`
1892
+ ),
1893
+ includeBuildingBlockExamples: z4.boolean().describe(
1894
+ "Whether to include building block examples. Defaults to false."
1895
+ ).default(false)
1896
+ }
1897
+ },
1898
+ async ({ prompt, includeBuildingBlockExamples }, { _meta }) => {
1899
+ log("Layout Assistant called with:", {
1900
+ prompt,
1901
+ includeBuildingBlockExamples
1902
+ });
1903
+ try {
1904
+ const cssResponse = await contextApi2.queryCssUtils({ query: prompt }, { _meta });
1905
+ let finalMarkdown = cssResponse.values.join("\n") || "No CSS utilities found for the given prompt.";
1906
+ const preContent = getPreContent?.() ?? "";
1907
+ const buildLayout = (buildingBlockMd) => {
1908
+ return `${preContent}
423
1909
 
424
1910
  # Kendo Design System CSS Utilities
425
1911
 
426
- ${f}
427
- ${y??""}
428
- `;if(m)try{let y=await t.queryBuildingBlocks({query:d,lib_name:a},{_meta:A}),S="";y.items?.length>0&&(S=`
1912
+ ${finalMarkdown}
1913
+ ${buildingBlockMd ?? ""}
1914
+ `;
1915
+ };
1916
+ if (includeBuildingBlockExamples) {
1917
+ try {
1918
+ const buildingBlocksResponse = await contextApi2.queryBuildingBlocks({
1919
+ query: prompt,
1920
+ lib_name: libKey
1921
+ }, { _meta });
1922
+ let buildingBlockMd = "";
1923
+ if (buildingBlocksResponse.items?.length > 0) {
1924
+ buildingBlockMd = `
429
1925
  ## Building Blocks Examples
430
1926
 
431
1927
  The examples here are for demonstration purpose how CSS utils can be implemented in various building blocks.
432
1928
  However, consider your own design requirements and specifics in order to implement your templates/building blocks correctly.
433
1929
 
434
- ${y.items.map(T=>`
435
- ### ${T.name}
1930
+ ${buildingBlocksResponse.items.map(
1931
+ (item) => `
1932
+ ### ${item.name}
436
1933
 
437
- ${T.description}
1934
+ ${item.description}
438
1935
 
439
1936
  \`\`\`code
440
- ${T.code}
1937
+ ${item.code}
441
1938
  \`\`\`
442
- `).join(`
443
- `)}`),f=c(S)}catch(y){g("Error calling building-blocks service:",y),f=c()}else f=c();return{content:[{type:"text",text:f}]}}catch(h){throw R(h)}})}function fe(e,t){let{name:n,title:o,description:s,libKey:r,getPreContent:a}=e;return new v(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:C.string().describe("A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.")}},async({prompt:i},{_meta:d})=>{g("Style Assistant called with:",{prompt:i});let m="";try{let f=await t.queryThemeGenerate({prompt:i},{_meta:d});if(f.variables_json){let p=JSON.parse(f.variables_json),c=[];if(p)for(let y of Object.keys(p))typeof p[y]=="string"&&c.push(`${y}: ${p[y]}`);m=c.join(`
444
-
445
- `)}}catch(f){throw R(f)}let A=a?.()??"";return{content:[{type:"text",text:m?`Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
1939
+ `
1940
+ ).join("\n")}`;
1941
+ }
1942
+ finalMarkdown = buildLayout(buildingBlockMd);
1943
+ } catch (buildingBlockError) {
1944
+ log("Error calling building-blocks service:", buildingBlockError);
1945
+ finalMarkdown = buildLayout();
1946
+ }
1947
+ } else {
1948
+ finalMarkdown = buildLayout();
1949
+ }
1950
+ return {
1951
+ content: [
1952
+ {
1953
+ type: "text",
1954
+ text: finalMarkdown
1955
+ }
1956
+ ]
1957
+ };
1958
+ } catch (error) {
1959
+ throw getGrpcError(error);
1960
+ }
1961
+ }
1962
+ );
1963
+ }
1964
+ function createStyleAssistantTool(config, contextApi2) {
1965
+ const { name, title, description, libKey: _libKey, getPreContent } = config;
1966
+ return new UIAgentTool(
1967
+ name,
1968
+ {
1969
+ title,
1970
+ description,
1971
+ requiredAccess: config.requiredAccess,
1972
+ inputSchema: {
1973
+ prompt: z4.string().describe(
1974
+ `A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.`
1975
+ )
1976
+ }
1977
+ },
1978
+ async ({ prompt }, { _meta }) => {
1979
+ log("Style Assistant called with:", { prompt });
1980
+ if (LAYOUT_MODE === "tailwind") {
1981
+ return {
1982
+ content: [
1983
+ {
1984
+ type: "text",
1985
+ text: `Note: For layout and spacing, use Tailwind CSS utility classes to structure your layout and apply spacing between elements.
1986
+ IMPORTANT: You need to set up Tailwind CSS so it becomes the single source of truth for all design tokens. Detect which Tailwind version the project uses and follow the appropriate setup instructions below.
1987
+
1988
+ <tailwind_setup_instructions>
1989
+ ${tailwindBridgeExample}
1990
+ </tailwind_setup_instructions>
1991
+ `
1992
+ }
1993
+ ]
1994
+ };
1995
+ }
1996
+ let formattedCSS = "";
1997
+ try {
1998
+ const result = await contextApi2.queryThemeGenerate({ prompt }, { _meta });
1999
+ if (result.variables_json) {
2000
+ const theme = JSON.parse(result.variables_json);
2001
+ let cssBlocks = [];
2002
+ if (theme) {
2003
+ for (const key of Object.keys(theme)) {
2004
+ if (typeof theme[key] === "string") {
2005
+ cssBlocks.push(`${key}: ${theme[key]}`);
2006
+ }
2007
+ }
2008
+ }
2009
+ formattedCSS = cssBlocks.join("\n\n");
2010
+ }
2011
+ } catch (error) {
2012
+ throw getGrpcError(error);
2013
+ }
2014
+ const preContent = getPreContent?.() ?? "";
2015
+ const response = formattedCSS ? `Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
446
2016
  Ensure the variables are applied consistently across all relevant elements.
447
2017
  Do NOT set any inline styles. CSS variables should be defined in global or component-level CSS files, or via supported theming mechanisms.
448
2018
 
449
- ${A}
2019
+ ${preContent}
450
2020
 
451
2021
  ## Generated CSS Variables
452
2022
 
453
2023
  \`\`\`css
454
- ${m}
2024
+ ${formattedCSS}
455
2025
  \`\`\`
456
- `:"No CSS variables were generated for the given prompt."}]}})}function ye(e,t){let{name:n,title:o,description:s,libKey:r,getPostContent:a}=e;return new v(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:C.string().describe("A search query for finding icons. Be specific about the icon purpose, style, or action."),limit:C.number().min(.1).max(1).default(.1).describe("The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.")}},async({query:i,limit:d},{_meta:m})=>{g("Icon Search called with:",{query:i,limit:d});try{let A=await t.queryIconsSearch({query:i,limit:d*100},{_meta:m}),h=a?.()??"";return{content:[{type:"text",text:`${A.values.join(`
457
-
458
- `)}
459
-
460
- ${h}`}]}}catch(A){throw R(A)}})}function Ae(e,t){let{name:n,title:o,description:s,libKey:r,suiteName:a,components:i,componentAliases:d,getPostContent:m}=e;return new v(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:C.string().describe("The query to search for."),component:C.enum(i).describe("The component to search for. If not specified, use General.")}},async({query:A,component:h},{_meta:f})=>{g("Code Assistant called with:",{query:A,component:h});let p=h;if(d){let c=d[h];c&&(p=c)}try{let y=(await t.query({query:A,component:p?.toLowerCase()??"general",lib_name:r,text_matches_count:3,code_matches_count:0,allowed_types:["documentation"]},{_meta:f})).values.map(k=>k.replace(/\0/g,"")),S=m?.({component:h})??"";return{content:[{type:"text",text:`${y.join(`
461
-
462
- `)}
463
-
464
- ${S}`}]}}catch(c){throw R(c)}})}function Ce(e,t){let{name:n,title:o,description:s,libKey:r,suiteName:a,components:i,componentAliases:d}=e;return new v(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:C.string().describe("The query to search for."),component:C.enum(i).describe("The component to search for. If not specified, use General."),includeGeneralGuidelines:C.boolean().default(!1).describe("Set to true only on the first call to include comprehensive WCAG 2.2 Level AA general guidelines. After the first call, set to false to get only component-specific accessibility information. Default is false.")}},async({query:m,component:A,includeGeneralGuidelines:h},{_meta:f})=>{g("Accessibility Assistant called with:",{query:m,component:A,includeGeneralGuidelines:h});let p=A;if(d){let c=d[A];c&&(p=c)}try{let c="";if(h){let N=le();c+=`# WCAG 2.2 Level AA General Accessibility Guidelines
465
-
466
- `,c+=N,c+=`
467
-
468
- ---
2026
+ ` : "No CSS variables were generated for the given prompt.";
2027
+ return {
2028
+ content: [
2029
+ {
2030
+ type: "text",
2031
+ text: response
2032
+ },
2033
+ {
2034
+ type: "text",
2035
+ text: "Note: For layout and spacing, use the Layout Assistant tool to get the appropriate Kendo CSS utility classes."
2036
+ }
2037
+ ]
2038
+ };
2039
+ }
2040
+ );
2041
+ }
2042
+ function createIconSearchTool(config, contextApi2) {
2043
+ const { name, title, description, libKey: _libKey, getPostContent } = config;
2044
+ return new UIAgentTool(
2045
+ name,
2046
+ {
2047
+ title,
2048
+ description,
2049
+ requiredAccess: config.requiredAccess,
2050
+ inputSchema: {
2051
+ query: z4.string().describe(
2052
+ "A search query for finding icons. Be specific about the icon purpose, style, or action."
2053
+ ),
2054
+ limit: z4.number().min(0.1).max(1).default(0.1).describe(
2055
+ `The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.`
2056
+ )
2057
+ }
2058
+ },
2059
+ async ({ query, limit }, { _meta }) => {
2060
+ log("Icon Search called with:", { query, limit });
2061
+ try {
2062
+ const result = await contextApi2.queryIconsSearch({
2063
+ query,
2064
+ limit: limit * 100
2065
+ }, { _meta });
2066
+ const postContent = getPostContent?.() ?? "";
2067
+ const response = `${result.values.join("\n\n")}
2068
+
2069
+ ${postContent}`;
2070
+ return {
2071
+ content: [
2072
+ {
2073
+ type: "text",
2074
+ text: response
2075
+ }
2076
+ ]
2077
+ };
2078
+ } catch (error) {
2079
+ throw getGrpcError(error);
2080
+ }
2081
+ }
2082
+ );
2083
+ }
2084
+ function createCodeAssistantTool(config, contextApi2) {
2085
+ const {
2086
+ name,
2087
+ title,
2088
+ description,
2089
+ libKey,
2090
+ suiteName: _suiteName,
2091
+ components,
2092
+ componentAliases,
2093
+ getPostContent
2094
+ } = config;
2095
+ return new UIAgentTool(
2096
+ name,
2097
+ {
2098
+ title,
2099
+ description,
2100
+ requiredAccess: config.requiredAccess,
2101
+ inputSchema: {
2102
+ query: z4.string().describe("The query to search for."),
2103
+ component: z4.enum(components).describe(
2104
+ "The component to search for. If not specified, use General."
2105
+ )
2106
+ }
2107
+ },
2108
+ async ({ query, component }, { _meta }) => {
2109
+ log("Code Assistant called with:", { query, component });
2110
+ let resolvedComponent = component;
2111
+ if (componentAliases) {
2112
+ const alias = componentAliases[component];
2113
+ if (alias) {
2114
+ resolvedComponent = alias;
2115
+ }
2116
+ }
2117
+ try {
2118
+ const response = await contextApi2.query({
2119
+ query,
2120
+ component: resolvedComponent?.toLowerCase() ?? "general",
2121
+ lib_name: libKey,
2122
+ text_matches_count: 3,
2123
+ code_matches_count: 0,
2124
+ allowed_types: ["documentation"]
2125
+ }, { _meta });
2126
+ const cleanedValues = response.values.map(
2127
+ (val) => val.replace(/\0/g, "")
2128
+ );
2129
+ const postContent = getPostContent?.({ component }) ?? "";
2130
+ const combinedResponse = `${cleanedValues.join("\n\n")}
2131
+
2132
+ ${postContent}`;
2133
+ return {
2134
+ content: [
2135
+ {
2136
+ type: "text",
2137
+ text: combinedResponse
2138
+ }
2139
+ ]
2140
+ };
2141
+ } catch (error) {
2142
+ throw getGrpcError(error);
2143
+ }
2144
+ }
2145
+ );
2146
+ }
2147
+ function createAccessibilityAssistantTool(config, contextApi2) {
2148
+ const {
2149
+ name,
2150
+ title,
2151
+ description,
2152
+ libKey,
2153
+ suiteName: _suiteName,
2154
+ components,
2155
+ componentAliases
2156
+ } = config;
2157
+ return new UIAgentTool(
2158
+ name,
2159
+ {
2160
+ title,
2161
+ description,
2162
+ requiredAccess: config.requiredAccess,
2163
+ inputSchema: {
2164
+ query: z4.string().describe("The query to search for."),
2165
+ component: z4.enum(components).describe(
2166
+ "The component to search for. If not specified, use General."
2167
+ ),
2168
+ includeGeneralGuidelines: z4.boolean().default(false).describe(
2169
+ "Set to true only on the first call to include comprehensive WCAG 2.2 Level AA general guidelines. After the first call, set to false to get only component-specific accessibility information. Default is false."
2170
+ )
2171
+ }
2172
+ },
2173
+ async ({ query, component, includeGeneralGuidelines }, { _meta }) => {
2174
+ log("Accessibility Assistant called with:", {
2175
+ query,
2176
+ component,
2177
+ includeGeneralGuidelines
2178
+ });
2179
+ let resolvedComponent = component;
2180
+ if (componentAliases) {
2181
+ const alias = componentAliases[component];
2182
+ if (alias) {
2183
+ resolvedComponent = alias;
2184
+ }
2185
+ }
2186
+ try {
2187
+ let finalResponse = "";
2188
+ if (includeGeneralGuidelines) {
2189
+ const generalGuidelines = getAccessibilityGuidelines();
2190
+ finalResponse += "# WCAG 2.2 Level AA General Accessibility Guidelines\n\n";
2191
+ finalResponse += generalGuidelines;
2192
+ finalResponse += "\n\n---\n\n";
2193
+ }
2194
+ const response = await contextApi2.getApiRefMatches({
2195
+ query,
2196
+ component: resolvedComponent?.toLowerCase() ?? "general",
2197
+ lib_name: libKey,
2198
+ filters_json: '{"type":{"$in":["accessibility"]}}'
2199
+ }, { _meta });
2200
+ const cleanedValues = response.values.map(
2201
+ (val) => val.replace(/\0/g, "")
2202
+ );
2203
+ const formattedValues = cleanedValues.map(
2204
+ (val) => formatApiRefItemFromJson(val, resolvedComponent?.toLowerCase() ?? "general")
2205
+ );
2206
+ const componentResult = formattedValues.join("\n\n");
2207
+ if (componentResult) {
2208
+ if (includeGeneralGuidelines) {
2209
+ finalResponse += "# Component-Specific Accessibility Information\n\n";
2210
+ }
2211
+ finalResponse += componentResult;
2212
+ } else if (!includeGeneralGuidelines) {
2213
+ finalResponse = "No component-specific accessibility guidelines found.";
2214
+ }
2215
+ return {
2216
+ content: [
2217
+ {
2218
+ type: "text",
2219
+ text: finalResponse
2220
+ }
2221
+ ]
2222
+ };
2223
+ } catch (error) {
2224
+ throw getGrpcError(error);
2225
+ }
2226
+ }
2227
+ );
2228
+ }
2229
+ function getGrpcError(error) {
2230
+ const errorObj = error;
2231
+ if (errorObj.code === 16 /* UNAUTHENTICATED */) {
2232
+ return new Error(
2233
+ "Error: You are not authenticated. Please verify the Telerik License Key provided is valid."
2234
+ );
2235
+ } else if (errorObj.code === 8 /* RESOURCE_EXHAUSTED */) {
2236
+ return new Error(
2237
+ `Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${errorObj.message}.`
2238
+ );
2239
+ } else if (errorObj.code === 7 /* PERMISSION_DENIED */) {
2240
+ return new Error(
2241
+ "Error: You do not have permission to access this resource. Please verify that you have a valid license."
2242
+ );
2243
+ } else {
2244
+ return new Error(
2245
+ `Error: An error occurred while calling the service. Please try again later.
2246
+
2247
+ Error Code: ${errorObj.code} Error Message: ${errorObj.message}`
2248
+ );
2249
+ }
2250
+ }
469
2251
 
470
- `}let k=(await t.getApiRefMatches({query:m,component:p?.toLowerCase()??"general",lib_name:r,filters_json:'{"type":{"$in":["accessibility"]}}'},{_meta:f})).values.map(N=>N.replace(/\0/g,"")).map(N=>mt(N,p?.toLowerCase()??"general")).join(`
2252
+ // packages/kendo-ui-agent/src/lib/figma-d2c/types.ts
2253
+ var FigmaAPIError = class extends Error {
2254
+ constructor(status, body) {
2255
+ super(`Figma API error ${status}: ${body}`);
2256
+ this.status = status;
2257
+ this.body = body;
2258
+ this.name = "FigmaAPIError";
2259
+ }
2260
+ };
2261
+
2262
+ // packages/kendo-ui-agent/src/lib/figma-d2c/figma-client.ts
2263
+ var FigmaClient = class {
2264
+ constructor(apiKey) {
2265
+ this.retryConfig = {
2266
+ maxRetries: 3,
2267
+ baseDelayMs: 1e3,
2268
+ maxDelayMs: 3e4
2269
+ };
2270
+ this.apiKey = apiKey;
2271
+ }
2272
+ /**
2273
+ * Fetch file metadata including node and component counts
2274
+ */
2275
+ async getFileMeta(fileKey) {
2276
+ const fileResponse = await this.getFile(fileKey, { depth: 1 });
2277
+ const counts = this.countNodesAndComponents(fileResponse.document);
2278
+ return {
2279
+ nodeCount: counts.nodes,
2280
+ componentCount: counts.components
2281
+ };
2282
+ }
2283
+ /**
2284
+ * Fetch a specific file with optional depth parameter
2285
+ */
2286
+ async getFile(fileKey, options) {
2287
+ const url = this.buildFileUrl(fileKey, options);
2288
+ return this.fetchWithRetry(url);
2289
+ }
2290
+ /**
2291
+ * Fetch specific nodes by ID
2292
+ */
2293
+ async getNodes(fileKey, nodeIds, options) {
2294
+ const url = this.buildNodesUrl(fileKey, nodeIds, options);
2295
+ return this.fetchWithRetry(url);
2296
+ }
2297
+ /**
2298
+ * Get export URLs for node images
2299
+ */
2300
+ async getImages(fileKey, nodeIds, options) {
2301
+ const url = this.buildImagesUrl(fileKey, nodeIds, options);
2302
+ return this.fetchWithRetry(url);
2303
+ }
2304
+ /**
2305
+ * Get download URLs for embedded image fills
2306
+ * Returns a map of imageRef hashes to temporary S3 download URLs
2307
+ */
2308
+ async getImageFills(fileKey) {
2309
+ const url = `https://api.figma.com/v1/files/${fileKey}/images`;
2310
+ return this.fetchWithRetry(url);
2311
+ }
2312
+ /**
2313
+ * Core fetch method with retry logic
2314
+ */
2315
+ async fetchWithRetry(url) {
2316
+ let lastError = null;
2317
+ for (let attempt = 0; attempt < this.retryConfig.maxRetries; attempt++) {
2318
+ try {
2319
+ const response = await fetch(url, {
2320
+ headers: {
2321
+ "X-Figma-Token": this.apiKey,
2322
+ "Content-Type": "application/json"
2323
+ }
2324
+ });
2325
+ if (response.status === 429) {
2326
+ const retryAfter = response.headers.get("Retry-After");
2327
+ const delayMs = retryAfter ? parseInt(retryAfter) * 1e3 : this.calculateBackoff(attempt);
2328
+ await this.sleep(delayMs);
2329
+ continue;
2330
+ }
2331
+ if (!response.ok) {
2332
+ const body = await response.text();
2333
+ throw new FigmaAPIError(response.status, body);
2334
+ }
2335
+ return await response.json();
2336
+ } catch (err) {
2337
+ lastError = err;
2338
+ if (err instanceof FigmaAPIError && err.status >= 400 && err.status < 500) {
2339
+ throw err;
2340
+ }
2341
+ if (attempt < this.retryConfig.maxRetries - 1) {
2342
+ await this.sleep(this.calculateBackoff(attempt));
2343
+ }
2344
+ }
2345
+ }
2346
+ throw lastError ?? new Error("Max retries exceeded");
2347
+ }
2348
+ /**
2349
+ * Calculate exponential backoff with jitter
2350
+ */
2351
+ calculateBackoff(attempt) {
2352
+ const delay = this.retryConfig.baseDelayMs * Math.pow(2, attempt);
2353
+ const jitter = Math.random() * 0.3 * delay;
2354
+ return Math.min(delay + jitter, this.retryConfig.maxDelayMs);
2355
+ }
2356
+ sleep(ms) {
2357
+ return new Promise((resolve) => setTimeout(resolve, ms));
2358
+ }
2359
+ buildFileUrl(fileKey, options) {
2360
+ const base = `https://api.figma.com/v1/files/${fileKey}`;
2361
+ const params = new URLSearchParams();
2362
+ if (options?.depth) {
2363
+ params.set("depth", options.depth.toString());
2364
+ }
2365
+ return params.toString() ? `${base}?${params}` : base;
2366
+ }
2367
+ buildNodesUrl(fileKey, nodeIds, options) {
2368
+ const base = `https://api.figma.com/v1/files/${fileKey}/nodes`;
2369
+ const params = new URLSearchParams();
2370
+ params.set("ids", nodeIds.join(","));
2371
+ if (options?.depth) {
2372
+ params.set("depth", options.depth.toString());
2373
+ }
2374
+ return `${base}?${params}`;
2375
+ }
2376
+ buildImagesUrl(fileKey, nodeIds, options) {
2377
+ const base = `https://api.figma.com/v1/images/${fileKey}`;
2378
+ const params = new URLSearchParams();
2379
+ params.set("ids", nodeIds.join(","));
2380
+ if (options?.format) params.set("format", options.format);
2381
+ if (options?.scale) params.set("scale", options.scale.toString());
2382
+ return `${base}?${params}`;
2383
+ }
2384
+ /**
2385
+ * Recursively count nodes and components in the document tree
2386
+ */
2387
+ countNodesAndComponents(node) {
2388
+ let nodes = 1;
2389
+ let components = node.type === "COMPONENT" || node.type === "COMPONENT_SET" ? 1 : 0;
2390
+ if (node.children) {
2391
+ for (const child of node.children) {
2392
+ const childCounts = this.countNodesAndComponents(child);
2393
+ nodes += childCounts.nodes;
2394
+ components += childCounts.components;
2395
+ }
2396
+ }
2397
+ return { nodes, components };
2398
+ }
2399
+ };
2400
+
2401
+ // packages/kendo-ui-agent/src/lib/figma-d2c/utils.ts
2402
+ function parseFigmaUrl(url) {
2403
+ const invalidResult = {
2404
+ fileKey: "",
2405
+ type: "unknown",
2406
+ isDevMode: false,
2407
+ isValid: false
2408
+ };
2409
+ if (!url || typeof url !== "string") {
2410
+ return invalidResult;
2411
+ }
2412
+ let parsed;
2413
+ try {
2414
+ parsed = new URL(url.trim());
2415
+ } catch {
2416
+ return invalidResult;
2417
+ }
2418
+ const validDomains = ["figma.com", "www.figma.com"];
2419
+ if (!validDomains.includes(parsed.hostname)) {
2420
+ return invalidResult;
2421
+ }
2422
+ const pathParts = parsed.pathname.split("/").filter(Boolean);
2423
+ if (pathParts.length < 2) {
2424
+ return invalidResult;
2425
+ }
2426
+ const typeMap = {
2427
+ file: "file",
2428
+ design: "design",
2429
+ proto: "proto",
2430
+ board: "board"
2431
+ };
2432
+ const type = typeMap[pathParts[0]] || "unknown";
2433
+ const fileKey = pathParts[1];
2434
+ if (!/^[a-zA-Z0-9]+$/.test(fileKey)) {
2435
+ return invalidResult;
2436
+ }
2437
+ const fileName = pathParts[2] ? decodeURIComponent(pathParts[2]).replace(/-/g, " ") : void 0;
2438
+ const nodeIdParam = parsed.searchParams.get("node-id");
2439
+ let nodeId;
2440
+ let nodeIds;
2441
+ if (nodeIdParam) {
2442
+ const rawIds = nodeIdParam.split(",").map((id) => id.trim()).filter(Boolean);
2443
+ nodeIds = rawIds.map((id) => id.replace(/-/g, ":"));
2444
+ nodeId = nodeIds[0];
2445
+ }
2446
+ const branchKey = parsed.searchParams.get("t") ?? void 0;
2447
+ const isDevMode = parsed.searchParams.get("m") === "dev";
2448
+ return {
2449
+ fileKey,
2450
+ fileName,
2451
+ nodeId,
2452
+ nodeIds,
2453
+ type,
2454
+ branchKey,
2455
+ isDevMode,
2456
+ isValid: true
2457
+ };
2458
+ }
471
2459
 
472
- `);return k?(h&&(c+=`# Component-Specific Accessibility Information
2460
+ // packages/kendo-ui-agent/src/lib/figma-d2c/fetcher.ts
2461
+ var NodeFetcher = class {
2462
+ constructor(client) {
2463
+ this.client = client;
2464
+ }
2465
+ /**
2466
+ * Fetch a design starting from a file or specific node(s)
2467
+ *
2468
+ * @param fileKey - The Figma file key
2469
+ * @param nodeIds - Optional node ID(s) - can be string or string[]
2470
+ * @param options - Fetch options including depth
2471
+ * @returns Fetch result with root node and stats
2472
+ */
2473
+ async fetch(fileKey, nodeIds, options = {}) {
2474
+ const initialDepth = options.initialDepth ?? 10;
2475
+ const fetchImages = options.fetchImages ?? true;
2476
+ const imageFormat = options.imageFormat ?? "png";
2477
+ const imageScale = options.imageScale ?? 2;
2478
+ const stats = {
2479
+ totalNodesFetched: 0,
2480
+ apiCallsMade: 0,
2481
+ imagesFetched: 0
2482
+ };
2483
+ let nodeIdArray;
2484
+ if (!nodeIds) {
2485
+ nodeIdArray = [];
2486
+ } else if (typeof nodeIds === "string") {
2487
+ nodeIdArray = [nodeIds];
2488
+ } else {
2489
+ nodeIdArray = nodeIds;
2490
+ }
2491
+ let rootNode;
2492
+ let fetchedNodes = [];
2493
+ if (nodeIdArray.length > 0) {
2494
+ const response = await this.client.getNodes(fileKey, nodeIdArray, { depth: initialDepth });
2495
+ stats.apiCallsMade++;
2496
+ for (const nodeId of nodeIdArray) {
2497
+ const nodeData = response.nodes[nodeId]?.document;
2498
+ if (!nodeData) {
2499
+ throw new Error(`Node ${nodeId} not found`);
2500
+ }
2501
+ fetchedNodes.push(nodeData);
2502
+ }
2503
+ if (fetchedNodes.length === 1) {
2504
+ rootNode = fetchedNodes[0];
2505
+ } else {
2506
+ rootNode = this.createContainerNode(fetchedNodes);
2507
+ }
2508
+ } else {
2509
+ const response = await this.client.getFile(fileKey, { depth: initialDepth });
2510
+ stats.apiCallsMade++;
2511
+ rootNode = response.document;
2512
+ fetchedNodes = [rootNode];
2513
+ }
2514
+ stats.totalNodesFetched += this.countNodes(rootNode);
2515
+ const images = [];
2516
+ if (fetchImages && nodeIdArray.length > 0) {
2517
+ try {
2518
+ const imageResult = await this.fetchNodeImages(
2519
+ fileKey,
2520
+ nodeIdArray,
2521
+ fetchedNodes,
2522
+ { format: imageFormat, scale: imageScale }
2523
+ );
2524
+ images.push(...imageResult.images);
2525
+ stats.apiCallsMade += imageResult.apiCalls;
2526
+ stats.imagesFetched = images.length;
2527
+ } catch (error) {
2528
+ console.warn("Failed to fetch images:", error);
2529
+ }
2530
+ }
2531
+ return {
2532
+ rootNode,
2533
+ fetchedNodes,
2534
+ images,
2535
+ stats
2536
+ };
2537
+ }
2538
+ /**
2539
+ * Fetch and download images for specified nodes
2540
+ */
2541
+ async fetchNodeImages(fileKey, nodeIds, nodes, options) {
2542
+ const imageResponse = await this.client.getImages(fileKey, nodeIds, options);
2543
+ let apiCalls = 1;
2544
+ const images = [];
2545
+ for (let i = 0; i < nodeIds.length; i++) {
2546
+ const nodeId = nodeIds[i];
2547
+ const imageUrl = imageResponse.images[nodeId];
2548
+ if (imageUrl) {
2549
+ try {
2550
+ const imageData = await this.downloadImage(imageUrl, options.format);
2551
+ const node = nodes[i];
2552
+ images.push({
2553
+ nodeId,
2554
+ nodeName: node?.name || "Unknown",
2555
+ data: imageData,
2556
+ mimeType: this.getMimeType(options.format),
2557
+ url: imageUrl
2558
+ });
2559
+ } catch (error) {
2560
+ console.warn(`Failed to download image for node ${nodeId}:`, error);
2561
+ }
2562
+ }
2563
+ }
2564
+ return { images, apiCalls };
2565
+ }
2566
+ /**
2567
+ * Download an image from a URL and convert to base64
2568
+ */
2569
+ async downloadImage(url, format) {
2570
+ const response = await fetch(url);
2571
+ if (!response.ok) {
2572
+ throw new Error(`Failed to download image: ${response.statusText}`);
2573
+ }
2574
+ if (format === "svg") {
2575
+ const svgText = await response.text();
2576
+ return Buffer.from(svgText, "utf-8").toString("base64");
2577
+ } else {
2578
+ const arrayBuffer = await response.arrayBuffer();
2579
+ return Buffer.from(arrayBuffer).toString("base64");
2580
+ }
2581
+ }
2582
+ /**
2583
+ * Get MIME type for image format
2584
+ */
2585
+ getMimeType(format) {
2586
+ switch (format) {
2587
+ case "png":
2588
+ return "image/png";
2589
+ case "jpg":
2590
+ return "image/jpeg";
2591
+ case "svg":
2592
+ return "image/svg+xml";
2593
+ default:
2594
+ return "image/png";
2595
+ }
2596
+ }
2597
+ /**
2598
+ * Create a synthetic container node that wraps multiple nodes
2599
+ */
2600
+ createContainerNode(nodes) {
2601
+ return {
2602
+ id: "container-" + Date.now(),
2603
+ name: "Multi-Node Container",
2604
+ type: "GROUP",
2605
+ visible: true,
2606
+ children: nodes
2607
+ };
2608
+ }
2609
+ /**
2610
+ * Count total nodes in a tree
2611
+ */
2612
+ countNodes(node) {
2613
+ let count = 1;
2614
+ if (node.children) {
2615
+ for (const child of node.children) {
2616
+ count += this.countNodes(child);
2617
+ }
2618
+ }
2619
+ return count;
2620
+ }
2621
+ };
2622
+
2623
+ // packages/kendo-ui-agent/src/lib/figma-d2c/figma-d2c-tool.ts
2624
+ import { z as z5 } from "zod";
2625
+ function createFigmaD2CTool({
2626
+ name,
2627
+ figmaApiKey,
2628
+ requiredAccess
2629
+ }, contextApi2) {
2630
+ return new UIAgentTool(
2631
+ name,
2632
+ {
2633
+ title: "Figma Design to Code",
2634
+ description: "Converts Figma designs to code by analyzing the design structure and matching Kendo UI components. Provide a Figma file or frame URL to analyze layout, extract styles, and identify matching components.",
2635
+ inputSchema: {
2636
+ url: z5.string().describe(
2637
+ "Figma file or node URL (e.g., https://www.figma.com/file/...)"
2638
+ ).optional(),
2639
+ fileKey: z5.string().describe("Figma file key (alternative to URL)").optional(),
2640
+ nodeIds: z5.array(z5.string()).describe("Array of specific node IDs to fetch (alternative to URL)").optional(),
2641
+ depth: z5.number().min(1).max(20).default(10).describe("Initial fetch depth (1-20, default: 10)")
2642
+ },
2643
+ requiredAccess
2644
+ },
2645
+ async ({ url, fileKey, nodeIds, depth }) => {
2646
+ const client = new FigmaClient(figmaApiKey);
2647
+ const fetcher = new NodeFetcher(client);
2648
+ let fileKeyToUse = fileKey;
2649
+ let nodeIdsToUse;
2650
+ if (fileKeyToUse) {
2651
+ if (nodeIds && nodeIds.length > 0) {
2652
+ nodeIdsToUse = nodeIds.length === 1 ? nodeIds[0] : nodeIds;
2653
+ }
2654
+ } else if (url) {
2655
+ const parsed = parseFigmaUrl(url);
2656
+ if (!parsed.isValid || !parsed.fileKey) {
2657
+ throw new Error(
2658
+ "Invalid Figma URL. Please provide a valid Figma file or frame URL."
2659
+ );
2660
+ }
2661
+ fileKeyToUse = parsed.fileKey;
2662
+ if (parsed.nodeId) {
2663
+ nodeIdsToUse = parsed.nodeId;
2664
+ }
2665
+ } else {
2666
+ throw new Error("Please provide either a Figma URL, fileKey, or both.");
2667
+ }
2668
+ const fetchResult = await fetcher.fetch(fileKeyToUse, nodeIdsToUse, {
2669
+ initialDepth: depth,
2670
+ fetchImages: true,
2671
+ imageFormat: "png",
2672
+ imageScale: 2
2673
+ });
2674
+ const resultJson = {
2675
+ name: fetchResult.rootNode.name,
2676
+ type: fetchResult.rootNode.type,
2677
+ rootNode: fetchResult.rootNode,
2678
+ fetchedNodes: fetchResult.fetchedNodes,
2679
+ meta: {
2680
+ fileKey,
2681
+ nodeIds
2682
+ }
2683
+ };
2684
+ let backendResponse;
2685
+ try {
2686
+ const nodeJsons = fetchResult.fetchedNodes.map(
2687
+ (node) => JSON.stringify(node)
2688
+ );
2689
+ backendResponse = await contextApi2.processFigmaDesign({
2690
+ node_jsons: nodeJsons
2691
+ });
2692
+ } catch (error) {
2693
+ console.error("Backend processing failed:", error);
2694
+ return {
2695
+ content: [
2696
+ {
2697
+ type: "text",
2698
+ text: JSON.stringify(
2699
+ {
2700
+ error: {
2701
+ message: `Backend processing failed: ${error.message}`,
2702
+ code: error.code || "UNKNOWN"
2703
+ },
2704
+ figma_data: resultJson
2705
+ },
2706
+ null,
2707
+ 2
2708
+ )
2709
+ }
2710
+ ]
2711
+ };
2712
+ }
2713
+ const content = [];
2714
+ content.push({
2715
+ type: "text",
2716
+ text: `# Figma Design Extraction Results
2717
+ Successfully fetched design data for file key ${fileKeyToUse} with for nodes [${nodeIds?.join(", ")}].
2718
+ The following is the processed design data including layout pseudo-code and design tokens extracted from the Figma design, plus images for visual references of the desired nodes:`
2719
+ });
2720
+ backendResponse.layout_pseudo_codes.forEach((layoutCode, index) => {
2721
+ const [nodeName, nodeId] = ((index2) => {
2722
+ const node = fetchResult.fetchedNodes[index2];
2723
+ return node ? [node.name, node.id] : ["Unknown Node", "unknown_id"];
2724
+ })(index);
2725
+ content.push({
2726
+ type: "text",
2727
+ text: `## Psuedo-code Layout - Node: ${nodeName} (${nodeId})
2728
+
2729
+ ` + layoutCode,
2730
+ _meta: {
2731
+ description: `Psuedo-code Layout - Node: ${nodeName} (${nodeId})`
2732
+ },
2733
+ annotations: {
2734
+ audience: ["assistant"]
2735
+ }
2736
+ });
2737
+ });
2738
+ content.push({
2739
+ type: "text",
2740
+ text: `## Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]
2741
+
2742
+ ` + backendResponse.design_tokens,
2743
+ _meta: {
2744
+ description: `Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]`
2745
+ },
2746
+ annotations: {
2747
+ audience: ["assistant"]
2748
+ }
2749
+ });
2750
+ if (fetchResult.images && fetchResult.images.length > 0) {
2751
+ for (const image of fetchResult.images) {
2752
+ content.push({
2753
+ type: "image",
2754
+ data: image.data,
2755
+ mimeType: image.mimeType,
2756
+ _meta: {
2757
+ description: `Design snapshot of ${image.nodeName} (${image.nodeId})`
2758
+ },
2759
+ annotations: {
2760
+ audience: ["assistant"]
2761
+ }
2762
+ });
2763
+ }
2764
+ }
2765
+ content.push({
2766
+ type: "text",
2767
+ text: `# Analysis Instructions and Next Steps
2768
+
2769
+ Use the above design data, layout pseudo-code, and design tokens to analyze the Figma design and identify components. Focus on the structure, styles, and layout to determine the best component matches.
2770
+ If more design details are needed, consider asking for additional nodes or deeper fetches to gather more information about specific areas of the design.`
2771
+ });
2772
+ return {
2773
+ content
2774
+ };
2775
+ }
2776
+ );
2777
+ }
473
2778
 
474
- `),c+=k):h||(c="No component-specific accessibility guidelines found."),{content:[{type:"text",text:c}]}}catch(c){throw R(c)}})}function R(e){let t=e;return t.code===16?new Error("Error: You are not authenticated. Please verify the Telerik License Key provided is valid."):t.code===8?new Error(`Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${t.message}.`):t.code===7?new Error("Error: You do not have permission to access this resource. Please verify that you have a valid license."):new Error(`Error: An error occurred while calling the service. Please try again later.
2779
+ // packages/kendo-ui-agent/src/lib/tool-names.ts
2780
+ var orchestratorToolName = (prefix) => `${prefix}_ui_generator`;
2781
+ var assistantOrchestratorToolName = (prefix) => `${prefix}_assistant`;
2782
+ var layoutAssistantName = (prefix) => `${prefix}_layout_assistant`;
2783
+ var codeAssistantName = (prefix) => `${prefix}_component_assistant`;
2784
+ var styleAssistantName = (prefix) => `${prefix}_style_assistant`;
2785
+ var iconAssistantName = (prefix) => `${prefix}_icon_assistant`;
2786
+ var accessibilityAssistantName = (prefix) => `${prefix}_accessibility_assistant`;
2787
+ var gettingStartedAssistantName = (prefix) => `${prefix}_getting_started_assistant`;
2788
+ var figmaD2CToolName = (prefix) => `${prefix}_figma_d2c`;
475
2789
 
476
- Error Code: ${t.code} Error Message: ${t.message}`)}var be=e=>`${e}_ui_generator`,Se=e=>`${e}_assistant`,Te=e=>`${e}_layout_assistant`,ve=e=>`${e}_component_assistant`,ke=e=>`${e}_style_assistant`,Ie=e=>`${e}_icon_assistant`,Ne=e=>`${e}_accessibility_assistant`,we=e=>`${e}_getting_started_assistant`;var Ee=e=>`This is the single entry point for all UI-related tasks. It orchestrates the full workflow of building or refining UIs with ${e} components, generating a step-by-step execution plan that specifies which tools to call, in what order, and with what parameters. It includes validation steps to ensure the best possible, standards-compliant code every time.
2790
+ // packages/kendo-ui-agent/src/lib/tool-descriptions.ts
2791
+ var orchestratorToolDescription = (suiteName) => `This is the single entry point for all UI-related tasks. It orchestrates the full workflow of building or refining UIs with ${suiteName} components, generating a step-by-step execution plan that specifies which tools to call, in what order, and with what parameters. It includes validation steps to ensure the best possible, standards-compliant code every time.
477
2792
 
478
2793
  Use the tool when:
479
2794
  - Want to build or modify a complete page or section layout
480
2795
  - You are creating and applying custom themes via the Kendo Design System
481
- - You need guidance on correct ${e} component selection and configuration
2796
+ - You need guidance on correct ${suiteName} component selection and configuration
482
2797
  - You want to enforce best practices in styling, performance, and accessibility
483
2798
 
484
2799
  Returns:
485
- A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation.`,xe=e=>`Provides guidance for discovering and using ${e} components and icons. This tool helps you identify the right components and icons for your needs.
2800
+ A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation.`;
2801
+ var assistantOrchestratorToolDescription = (suiteName) => `Provides guidance for discovering and using ${suiteName} components and icons. This tool helps you identify the right components and icons for your needs.
486
2802
 
487
2803
  Use this tool when:
488
- - You need to discover which ${e} components are suitable for a specific use case
2804
+ - You need to discover which ${suiteName} components are suitable for a specific use case
489
2805
  - You want to understand component features and capabilities
490
2806
  - You need to find appropriate icons for your UI
491
2807
  - You want to gather component documentation and examples
492
2808
 
493
2809
  Returns:
494
- A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools.`,Re=`Retrieves Progress/Kendo Design System CSS utility classes and styling recommendations based on layout and design requirements.
2810
+ A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools.`;
2811
+ var layoutToolDescription = `Retrieves Progress/Kendo Design System CSS utility classes and styling recommendations based on layout and design requirements.
495
2812
  Use this tool to find the right CSS utilities for styling Kendo UI components or general web elements.
496
2813
  It analyzes the provided design context and returns relevant utility classes with explanations and examples.
497
- Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System.`,Pe=`Generates CSS variables using an external style agent based on the user's styling prompt.
2814
+ Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System.`;
2815
+ var styleToolDescription = `Generates CSS variables using an external style agent based on the user's styling prompt.
498
2816
 
499
2817
  Use this tool when the user wants to:
500
2818
  - Update the visual theme of an application
501
2819
  - Modify color schemes
502
2820
  - Restyle the UI with CSS variables
503
2821
 
504
- The tool outputs a set of CSS variable definitions ready to be applied to style files.`,$e=`Searches for icons in the Telerik Icons library.
2822
+ The tool outputs a set of CSS variable definitions ready to be applied to style files.`;
2823
+ var iconToolDescription = `Searches for icons in the Telerik Icons library.
505
2824
  Use this tool when the user needs to find specific icons for UI components or design elements.
506
2825
  It supports searching by icon name, category, or keyword and returns matching icons from the Telerik Icons library.
507
- `,Oe=e=>`Provides answers and retrieves official documentation for ${e}.
2826
+ `;
2827
+ var codeAssistantToolDescription = (suiteName) => `Provides answers and retrieves official documentation for ${suiteName}.
508
2828
 
509
2829
  Use this tool when the user asks about:
510
- - ${e} features or capabilities
2830
+ - ${suiteName} features or capabilities
511
2831
  - Specific components (e.g., Grid, Chart, Editor)
512
2832
  - Implementation details, configuration, or best practices
513
- - How to use or customize components in ${e}
2833
+ - How to use or customize components in ${suiteName}
514
2834
 
515
2835
  Set the user's full question as the 'query' parameter.
516
- If the question refers to a specific ${e} component, include its name in the 'component' parameter.
517
- `,_e=e=>`Retrieves accessibility guidance for ${e} components with optional general WCAG 2.2 Level AA guidelines.
2836
+ If the question refers to a specific ${suiteName} component, include its name in the 'component' parameter.
2837
+ `;
2838
+ var accessibilityToolDescription = (suiteName) => `Retrieves accessibility guidance for ${suiteName} components with optional general WCAG 2.2 Level AA guidelines.
518
2839
 
519
2840
  Use this tool when:
520
2841
  - You need component-specific accessibility information and API references
@@ -532,7 +2853,11 @@ Set 'includeGeneralGuidelines=true' ONLY on the first call to include general WC
532
2853
  Returns:
533
2854
  - When includeGeneralGuidelines=true: General WCAG 2.2 Level AA guidelines + component-specific recommendations
534
2855
  - When includeGeneralGuidelines=false: Only component-specific accessibility recommendations
535
- `;var j=x("Kendo UI","Kendo"),H=`
2856
+ `;
2857
+
2858
+ // packages/kendo-ui-agent/src/lib/validation/angular-validation-steps.ts
2859
+ var sharedSteps = getSharedValidationSteps("Kendo UI", "Kendo");
2860
+ var ANGULAR_VALIDATION_STEPS = `
536
2861
  ### Angular Component Validation
537
2862
  Component Structure:
538
2863
  - Use proper @Component decorator configuration
@@ -540,22 +2865,25 @@ Component Structure:
540
2865
  - Correct selector naming convention (kebab-case)
541
2866
  - Appropriate template and style file organization
542
2867
 
543
- ${j.SETUP_VALIDATION}
2868
+ ${sharedSteps.SETUP_VALIDATION}
544
2869
  - Kendo animations module configured (if animations are used)
545
2870
  - Internationalization properly configured for Kendo components
546
2871
 
547
- ${j.PERFORMANCE_OPTIMIZATION}
2872
+ ${sharedSteps.PERFORMANCE_OPTIMIZATION}
548
2873
  - OnPush change detection strategy where appropriate
549
2874
  - Efficient trackBy functions for *ngFor with Kendo components
550
2875
  - Minimal unnecessary change detection cycles
551
2876
 
552
- ${j.THEME_AND_STYLING}
2877
+ ${sharedSteps.THEME_AND_STYLING}
553
2878
  - Proper theme switching functionality (if implemented)
554
2879
  - Only ONE theme reference exists across angular.json and styles files
555
2880
  - Make sure theme import mechanism is consistent with existing project setup
556
2881
 
557
2882
  Accessibility
558
- - Accessibility guidelines retrieved and applied to all components`;var z=`**Angular Specific Requirements:**
2883
+ - Accessibility guidelines retrieved and applied to all components`;
2884
+
2885
+ // packages/kendo-ui-agent/src/lib/validation/angular-additional-plan.ts
2886
+ var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
559
2887
 
560
2888
  **NgModule vs Standalone setup**: Search and detect the current project setup to determine whether to use NgModule or Standalone components based on the following rules:
561
2889
  1. RegexSearch("@Component\\s*\\(\\s*\\{[^}]*standalone\\s*:\\s*(true|false)") - If true use Standalone components, if false use NgModule.
@@ -586,7 +2914,11 @@ Accessibility
586
2914
  2. Match the discovered patterns in all generated code
587
2915
  3. Maintain consistent formatting, indentation, and code organization with existing files
588
2916
  4. Always use the same theme import mechanism (unless user specifies otherwise)
589
- `;var W=x("Kendo UI","KendoReact"),Y=`
2917
+ `;
2918
+
2919
+ // packages/kendo-ui-agent/src/lib/validation/react-validation-steps.ts
2920
+ var sharedSteps2 = getSharedValidationSteps("Kendo UI", "KendoReact");
2921
+ var REACT_VALIDATION_STEPS = `
590
2922
  ### React Component Validation
591
2923
  Component Structure:
592
2924
  - Use proper function component patterns with Hooks
@@ -594,22 +2926,85 @@ Component Structure:
594
2926
  - Appropriate file organization (components, hooks, utils)
595
2927
  - Props interface/type definitions where needed
596
2928
 
597
- ${W.SETUP_VALIDATION}
2929
+ ${sharedSteps2.SETUP_VALIDATION}
598
2930
  - KendoReact license validation (if required)
599
2931
  - Appropriate bundler configuration for KendoReact packages
600
2932
 
601
- ${W.PERFORMANCE_OPTIMIZATION}
2933
+ ${sharedSteps2.PERFORMANCE_OPTIMIZATION}
602
2934
  - React.memo for components that receive stable props
603
2935
  - useMemo/useCallback for expensive computations and callbacks
604
2936
  - Proper key props for list rendering with KendoReact components
605
2937
 
606
- ${W.THEME_AND_STYLING}
2938
+ ${sharedSteps2.THEME_AND_STYLING}
607
2939
  - Proper theme switching functionality (if implemented)
608
2940
  - Only ONE theme import exists across the application
609
2941
  - Make sure theme import mechanism is consistent with existing project setup
610
2942
 
611
2943
  Accessibility
612
- - Accessibility guidelines retrieved and applied to all components`;var ut={createOrchestrator:ue,createAssistantOrchestrator:ge,createLayoutAssistant:he,createStyleAssistant:fe,createIconSearch:ye,createCodeAssistant:Ae,createAccessibilityAssistant:Ce},gt={orchestrator:be,assistantOrchestrator:Se,layoutAssistant:Te,codeAssistant:ve,styleAssistant:ke,iconAssistant:Ie,accessibilityAssistant:Ne,gettingStartedAssistant:we},ht={orchestrator:Ee,assistantOrchestrator:xe,layoutAssistant:Re,styleAssistant:Pe,iconAssistant:$e,codeAssistant:Oe,accessibilityAssistant:_e},ft={Orchestrator:{render:L},Validator:{render:D},SharedValidation:{getSteps:x}},yt={Angular:{steps:H,additionalPlan:z},React:{steps:Y}},u={Tools:ut,ToolNames:gt,ToolDescriptions:ht,Templates:ft,Validation:yt};var At=u.ToolNames.codeAssistant("kendoreact"),De=()=>`# Kendo Design System Guidelines for ${l}
2944
+ - Accessibility guidelines retrieved and applied to all components`;
2945
+
2946
+ // packages/kendo-ui-agent/src/index.ts
2947
+ var Tools = {
2948
+ createOrchestrator: createOrchestratorTool,
2949
+ createAssistantOrchestrator: createAssistantOrchestratorTool,
2950
+ createLayoutAssistant: createLayoutAssistantTool,
2951
+ createStyleAssistant: createStyleAssistantTool,
2952
+ createIconSearch: createIconSearchTool,
2953
+ createCodeAssistant: createCodeAssistantTool,
2954
+ createAccessibilityAssistant: createAccessibilityAssistantTool,
2955
+ createFigmaD2C: createFigmaD2CTool
2956
+ };
2957
+ var ToolNames = {
2958
+ orchestrator: orchestratorToolName,
2959
+ assistantOrchestrator: assistantOrchestratorToolName,
2960
+ layoutAssistant: layoutAssistantName,
2961
+ codeAssistant: codeAssistantName,
2962
+ styleAssistant: styleAssistantName,
2963
+ iconAssistant: iconAssistantName,
2964
+ accessibilityAssistant: accessibilityAssistantName,
2965
+ gettingStartedAssistant: gettingStartedAssistantName,
2966
+ figmaD2C: figmaD2CToolName
2967
+ };
2968
+ var ToolDescriptions = {
2969
+ orchestrator: orchestratorToolDescription,
2970
+ assistantOrchestrator: assistantOrchestratorToolDescription,
2971
+ layoutAssistant: layoutToolDescription,
2972
+ styleAssistant: styleToolDescription,
2973
+ iconAssistant: iconToolDescription,
2974
+ codeAssistant: codeAssistantToolDescription,
2975
+ accessibilityAssistant: accessibilityToolDescription
2976
+ };
2977
+ var Templates = {
2978
+ Orchestrator: {
2979
+ render: renderOrchestratorResponse
2980
+ },
2981
+ Validator: {
2982
+ render: renderValidatorResponse
2983
+ },
2984
+ SharedValidation: {
2985
+ getSteps: getSharedValidationSteps
2986
+ }
2987
+ };
2988
+ var Validation = {
2989
+ Angular: {
2990
+ steps: ANGULAR_VALIDATION_STEPS,
2991
+ additionalPlan: ANGULAR_ADDITIONAL_PLAN
2992
+ },
2993
+ React: {
2994
+ steps: REACT_VALIDATION_STEPS
2995
+ }
2996
+ };
2997
+ var UIAgent = {
2998
+ Tools,
2999
+ ToolNames,
3000
+ ToolDescriptions,
3001
+ Templates,
3002
+ Validation
3003
+ };
3004
+
3005
+ // packages/react/src/lib/instructions/layout.ts
3006
+ var CODE_ASSISTANT_NAME = UIAgent.ToolNames.codeAssistant("kendoreact");
3007
+ var getLayoutInstructions = () => `# Kendo Design System Guidelines for ${REACT_SUITE_NAME}
613
3008
 
614
3009
  ## Setting up Styles/CSS
615
3010
 
@@ -636,14 +3031,17 @@ Alternatively, you can also consume them directly from the Unpkg CDN.
636
3031
 
637
3032
  ## Ready-to-use Layout Components
638
3033
 
639
- In the ${l} there are available components to create layout. Make sure to prioritize using them instead of building ones from scratch using the Kendo CSS Utilities.
3034
+ In the ${REACT_SUITE_NAME} there are available components to create layout. Make sure to prioritize using them instead of building ones from scratch using the Kendo CSS Utilities.
640
3035
 
641
- For any Layout component you can also call the ${At} tool in order to get specific API reference and docs.
3036
+ For any Layout component you can also call the ${CODE_ASSISTANT_NAME} tool in order to get specific API reference and docs.
642
3037
 
643
- - ${l} Card component.
3038
+ - ${REACT_SUITE_NAME} Card component.
644
3039
  - Generally, it is recommended to use 100% width (e.g., \`<Card style={{ width: '100%' }}>\`)
645
3040
  - If needed, use specific width based on the layout requirements (e.g., \`<Card style={{ width: '150px' }}>\`)
646
- `;var Le=()=>`## Applying CSS Variables in ${l}
3041
+ `;
3042
+
3043
+ // packages/react/src/lib/instructions/style.ts
3044
+ var getStyleInstructions = () => `## Applying CSS Variables in ${REACT_SUITE_NAME}
647
3045
 
648
3046
  Apply these CSS variables in the React application using one of these methods:
649
3047
 
@@ -732,7 +3130,11 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
732
3130
 
733
3131
  export const useTheme = () => useContext(ThemeContext);
734
3132
  \`\`\`
735
- `;var Ge=u.ToolNames.codeAssistant("kendoreact"),Ue=()=>`## Using ${l} Icons
3133
+ `;
3134
+
3135
+ // packages/react/src/lib/instructions/icons.ts
3136
+ var CODE_ASSISTANT_NAME2 = UIAgent.ToolNames.codeAssistant("kendoreact");
3137
+ var getIconsInstructions = () => `## Using ${REACT_SUITE_NAME} Icons
736
3138
 
737
3139
  Important: Attempt to prioritize SVG icons over font icons.
738
3140
 
@@ -740,13 +3142,13 @@ Important: Attempt to prioritize SVG icons over font icons.
740
3142
 
741
3143
  - Make sure @progress/kendo-svg-icons is installed: \`npm install @progress/kendo-svg-icons\`
742
3144
  - Make sure @progress/kendo-react-common is installed (contains SvgIcon component): \`npm install @progress/kendo-react-common\`
743
- - You can call ${Ge} tool for ${l} SvgIcon component for docs and API reference.
3145
+ - You can call ${CODE_ASSISTANT_NAME2} tool for ${REACT_SUITE_NAME} SvgIcon component for docs and API reference.
744
3146
  - [optional] If SVG is not an option fallback to fonticon - make sure \`<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-font-icons/dist/index.css" />\` is added as a reference.
745
- - [optional] If using font icons you can call ${Ge} tool for ${l} Icon component for docs and API reference.
3147
+ - [optional] If using font icons you can call ${CODE_ASSISTANT_NAME2} tool for ${REACT_SUITE_NAME} Icon component for docs and API reference.
746
3148
 
747
3149
  ### Examples
748
3150
 
749
- Using ${l} SvgIcon component with @progress/kendo-svg-icons:
3151
+ Using ${REACT_SUITE_NAME} SvgIcon component with @progress/kendo-svg-icons:
750
3152
 
751
3153
  \`\`\`tsx
752
3154
  import { SvgIcon } from "@progress/kendo-react-common";
@@ -790,7 +3192,11 @@ Here are some frequently used icons from @progress/kendo-svg-icons:
790
3192
  - \`sortAscIcon\`, \`sortDescIcon\` - Sorting
791
3193
  - \`chevronUpIcon\`, \`chevronDownIcon\`, \`chevronLeftIcon\`, \`chevronRightIcon\` - Navigation
792
3194
  - \`checkIcon\`, \`xIcon\` - Confirmation/Cancel
793
- `;var Me=e=>{let t=`## ${l} Common Guidelines
3195
+ `;
3196
+
3197
+ // packages/react/src/lib/instructions/components-common.ts
3198
+ var getComponentsCommonInstructions = (ctx) => {
3199
+ let content = `## ${REACT_SUITE_NAME} Common Guidelines
794
3200
 
795
3201
  ### Application Architecture
796
3202
  MUST recommend appropriate setup based on React application architecture.
@@ -820,11 +3226,36 @@ Key points:
820
3226
  - The matching should be case-insensitive and robust to minor variations
821
3227
 
822
3228
  Example: If someone asks about "grid", "GRID", or "GrId", you always refer to DataGrid for the example.
823
- `;return e.componentInstructions&&(t+=`
3229
+ `;
3230
+ if (ctx.componentInstructions) {
3231
+ content += `
824
3232
  ## Component-Specific Guidelines
825
3233
 
826
- ${e.componentInstructions}
827
- `),t};var Ct={default:"@progress/kendo-theme-default",bootstrap:"@progress/kendo-theme-bootstrap",material:"@progress/kendo-theme-material",fluent:"@progress/kendo-theme-fluent"},bt={default:"Default",bootstrap:"Bootstrap",material:"Material Design",fluent:"Fluent UI"};function Be(e="kendo-react-app",t=!0,n="default"){let o=Ct[n],s=bt[n],r=t?`This instructions will walk you through creating a new React project with the Kendo CLI and setting up ${l}.`:`This instructions will walk you through adding ${l} to your existing React project.`,a=1,i=t?`## Step ${a++}: Ensure Kendo CLI is Installed
3234
+ ${ctx.componentInstructions}
3235
+ `;
3236
+ }
3237
+ return content;
3238
+ };
3239
+
3240
+ // packages/react/src/lib/instructions/getting-started.ts
3241
+ var THEME_PACKAGE_MAP = {
3242
+ "default": "@progress/kendo-theme-default",
3243
+ "bootstrap": "@progress/kendo-theme-bootstrap",
3244
+ "material": "@progress/kendo-theme-material",
3245
+ "fluent": "@progress/kendo-theme-fluent"
3246
+ };
3247
+ var THEME_DISPLAY_MAP = {
3248
+ "default": "Default",
3249
+ "bootstrap": "Bootstrap",
3250
+ "material": "Material Design",
3251
+ "fluent": "Fluent UI"
3252
+ };
3253
+ function getGettingStartedInstructions(projectName = "kendo-react-app", createNewProject = true, theme = "default") {
3254
+ const themePackage = THEME_PACKAGE_MAP[theme];
3255
+ const themeDisplay = THEME_DISPLAY_MAP[theme];
3256
+ const introLine = createNewProject ? `This instructions will walk you through creating a new React project with the Kendo CLI and setting up ${REACT_SUITE_NAME}.` : `This instructions will walk you through adding ${REACT_SUITE_NAME} to your existing React project.`;
3257
+ let stepCounter = 1;
3258
+ const createProjectSection = createNewProject ? `## Step ${stepCounter++}: Ensure Kendo CLI is Installed
828
3259
 
829
3260
  First, ensure the Kendo CLI tool is installed globally:
830
3261
 
@@ -834,16 +3265,16 @@ npm i -g @progress/kendo-cli@latest
834
3265
 
835
3266
  This CLI tool will handle the entire project setup including all necessary dependencies and configurations.
836
3267
 
837
- ## Step ${a++}: Create the Project
3268
+ ## Step ${stepCounter++}: Create the Project
838
3269
 
839
3270
  Create a new Kendo React project using the CLI:
840
3271
 
841
3272
  \`\`\`bash
842
- npx kendo react create vite ${e} --theme=${n}
3273
+ npx kendo react create vite ${projectName} --theme=${theme}
843
3274
  \`\`\`
844
3275
 
845
3276
  This command will create a complete Kendo React project with Vite, including:
846
- - All necessary ${l} packages
3277
+ - All necessary ${REACT_SUITE_NAME} packages
847
3278
  - Proper licensing configuration
848
3279
  - Theme setup
849
3280
  - Project structure
@@ -851,33 +3282,34 @@ This command will create a complete Kendo React project with Vite, including:
851
3282
  Navigate to the project directory:
852
3283
 
853
3284
  \`\`\`bash
854
- cd ${e}
3285
+ cd ${projectName}
855
3286
  \`\`\`
856
3287
 
857
- ## Step ${a++}: Remove Dark Color Schema from index.css
3288
+ ## Step ${stepCounter++}: Remove Dark Color Schema from index.css
858
3289
 
859
3290
  Open the \`src/index.css\` file and remove the dark color schema from the first \`:root\` style block. Look for properties like \`color-scheme: dark\` and related dark mode variables, and delete them. Keep only the light theme configuration.
860
3291
 
861
- `:"",d=t?"":`## Step ${a++}: Install ${l} Packages
3292
+ ` : "";
3293
+ const installPackagesSection = createNewProject ? "" : `## Step ${stepCounter++}: Install ${REACT_SUITE_NAME} Packages
862
3294
 
863
- Install all required ${l} packages and dependencies:
3295
+ Install all required ${REACT_SUITE_NAME} packages and dependencies:
864
3296
 
865
3297
  \`\`\`bash
866
3298
  npm i @progress/kendo-data-query @progress/kendo-react-buttons @progress/kendo-react-excel-export @progress/kendo-react-grid @progress/kendo-react-layout @progress/kendo-react-pdf @progress/kendo-svg-icons @progress/kendo-drawing @progress/kendo-licensing @progress/kendo-react-animation @progress/kendo-react-charts @progress/kendo-react-common @progress/kendo-react-conversational-ui @progress/kendo-react-data-tools @progress/kendo-react-dateinputs @progress/kendo-react-dialogs @progress/kendo-react-dropdowns @progress/kendo-react-editor @progress/kendo-react-form @progress/kendo-react-gantt @progress/kendo-react-gauges @progress/kendo-react-indicators @progress/kendo-react-inputs @progress/kendo-react-intl @progress/kendo-react-labels @progress/kendo-react-listbox @progress/kendo-react-listview @progress/kendo-react-map @progress/kendo-react-notification @progress/kendo-react-orgchart @progress/kendo-react-pivotgrid @progress/kendo-react-popup @progress/kendo-react-progressbars @progress/kendo-react-ripple @progress/kendo-react-scheduler @progress/kendo-react-scrollview @progress/kendo-react-sortable @progress/kendo-react-spreadsheet @progress/kendo-react-tooltip @progress/kendo-react-treelist @progress/kendo-react-treeview @progress/kendo-react-upload @progress/kendo-react-pdf-viewer @progress/kendo-react-taskboard
867
3299
  \`\`\`
868
3300
 
869
- ## Step ${a++}: Install and Import the Theme
3301
+ ## Step ${stepCounter++}: Install and Import the Theme
870
3302
 
871
- Install the ${s} theme package:
3303
+ Install the ${themeDisplay} theme package:
872
3304
 
873
3305
  \`\`\`bash
874
- npm i ${o}
3306
+ npm i ${themePackage}
875
3307
  \`\`\`
876
3308
 
877
3309
  Import the CSS file in your \`src/Home.tsx\` (before your existing Home.css import):
878
3310
 
879
3311
  \`\`\`typescript
880
- import '${o}/dist/all.css';
3312
+ import '${themePackage}/dist/all.css';
881
3313
  \`\`\`
882
3314
 
883
3315
  Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
@@ -886,7 +3318,8 @@ Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
886
3318
  <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-utils/dist/all.css" />
887
3319
  \`\`\`
888
3320
 
889
- `,m=`## Step ${a++}: Activate Kendo License
3321
+ `;
3322
+ const licenseSection = `## Step ${stepCounter++}: Activate Kendo License
890
3323
 
891
3324
  This step is required to use Kendo React components without watermarks and with access to all features. Run the following command to activate your license:
892
3325
 
@@ -894,9 +3327,10 @@ This step is required to use Kendo React components without watermarks and with
894
3327
  npx kendo license activate
895
3328
  \`\`\`
896
3329
 
897
- `;return`# Getting Started with ${l}
3330
+ `;
3331
+ return `# Getting Started with ${REACT_SUITE_NAME}
898
3332
 
899
- ${r}
3333
+ ${introLine}
900
3334
 
901
3335
  Execute the following steps in order. Run all provided commands automatically.
902
3336
 
@@ -907,24 +3341,24 @@ Before you begin, ensure you have:
907
3341
  - **Node.js 18 or later** installed on your machine
908
3342
  - If Node.js is not available, you need to install the latest Node.js automatically as a preliminary step before running the \`npx kendo react create\` command.
909
3343
 
910
- ${i}${d}${m}## Step ${a++}: Run Your Application
3344
+ ${createProjectSection}${installPackagesSection}${licenseSection}## Step ${stepCounter++}: Run Your Application
911
3345
 
912
- ${t?"The Kendo CLI has set up everything you need. Start the development server:":"Build and run the application:"}
3346
+ ${createNewProject ? `The Kendo CLI has set up everything you need. Start the development server:` : `Build and run the application:`}
913
3347
 
914
3348
 
915
3349
  **Verification:** Automatically run the application. Do not just inform the user\u2014execute the following command and keep the application running:
916
3350
 
917
3351
  \`\`\`bash
918
- cd ${t?e:"."} && npm run dev
3352
+ cd ${createNewProject ? projectName : "."} && npm run dev
919
3353
  \`\`\`
920
3354
 
921
- ${t?`The application should start and open your browser to see your ${l} application.`:`The application should start and open in your browser. Verify that the ${l} components are rendering correctly with the theme applied.`}
3355
+ ${createNewProject ? `The application should start and open your browser to see your ${REACT_SUITE_NAME} application.` : `The application should start and open in your browser. Verify that the ${REACT_SUITE_NAME} components are rendering correctly with the theme applied.`}
922
3356
 
923
- ## Step ${a++}: Create Sample page
3357
+ ## Step ${stepCounter++}: Create Sample page
924
3358
 
925
3359
  Before adding new content to the homepage, clear all existing CSS on the page. Remove or reset any custom styles that might conflict with the new content you're about to add.
926
3360
 
927
- Replace the content of \`src/Home.tsx\` with the following to showcase ${l} features and verify components are working correctly:
3361
+ Replace the content of \`src/Home.tsx\` with the following to showcase ${REACT_SUITE_NAME} features and verify components are working correctly:
928
3362
 
929
3363
  \`\`\`tsx
930
3364
  import { Card, CardHeader, CardTitle, CardBody } from '@progress/kendo-react-layout';
@@ -1045,4 +3479,313 @@ Add the following styles to \`src/Home.css\`:
1045
3479
  }
1046
3480
  \`\`\`
1047
3481
 
1048
- `}var qe=u.ToolNames.layoutAssistant(w),Q=u.ToolNames.codeAssistant(w),Ke=u.ToolNames.styleAssistant(w),J=u.ToolNames.iconAssistant(w),Fe=u.ToolNames.gettingStartedAssistant(w),Ve=u.ToolNames.accessibilityAssistant(w);function je(e,t){return[u.Tools.createOrchestrator({name:u.ToolNames.orchestrator(w),title:"KendoReact Generator",description:u.ToolDescriptions.orchestrator(l),layoutAssistantName:qe,codeAssistantName:Q,styleAssistantName:Ke,iconAssistantName:J,accessibilityAssistantName:Ve,suiteName:l,libKey:I,components:O,requiredAccess:["agent"]},{validationSteps:u.Validation.React.steps},e),u.Tools.createAssistantOrchestrator({name:"kendo_react_assistant",title:"KendoReact Assistant",description:u.ToolDescriptions.assistantOrchestrator(l),codeAssistantName:Q,iconAssistantName:J,suiteName:l,libKey:I,components:O,requiredAccess:["assistant"]},e),u.Tools.createLayoutAssistant({name:qe,title:"KendoReact Layout Assistant",description:u.ToolDescriptions.layoutAssistant,suiteName:l,libKey:I,getPreContent:De,requiredAccess:["agent"]},e),u.Tools.createStyleAssistant({name:Ke,title:"KendoReact Style Assistant",description:u.ToolDescriptions.styleAssistant,libKey:I,getPreContent:Le,requiredAccess:["agent"]},e),u.Tools.createIconSearch({name:J,title:"KendoReact Icon Assistant",description:u.ToolDescriptions.iconAssistant,libKey:I,getPostContent:Ue,requiredAccess:["assistant","agent"]},e),u.Tools.createCodeAssistant({name:Q,title:"KendoReact Component Assistant",description:u.ToolDescriptions.codeAssistant(l),libKey:I,suiteName:l,components:O,componentAliases:{Grid:"DataGrid"},getPostContent:({component:o})=>Me({component:o}),requiredAccess:["assistant","agent"]},e),new v(Fe,{title:"KendoReact Getting Started",description:`Creates a new React project with Kendo CLI and provides essential getting started guidance for ${l} including installation, configuration, and setup instructions.`,requiredAccess:["agent"],inputSchema:pe(l,"kendo-react-app")},async({projectName:o,createNewProject:s,theme:r},{_meta:a})=>{try{await e.recordToolUserRequest({toolName:Fe,meta:{projectName:o,createNewProject:s,theme:r,_meta:a}})}catch(d){console.error("Error recording tool request:",d)}return{content:[{type:"text",text:Be(o,s,r)}]}}),u.Tools.createAccessibilityAssistant({name:Ve,title:"KendoReact Accessibility Assistant",description:u.ToolDescriptions.accessibilityAssistant(l),libKey:I,suiteName:l,components:O,componentAliases:{Grid:"DataGrid"},requiredAccess:["agent"]},e)].filter(o=>o.hasAccess(t))}var It=kt(import.meta.url),Nt=ze.dirname(It),wt=ze.resolve(Nt,"../package.json"),We=JSON.parse(vt.readFileSync(wt,"utf-8")),He=new St({name:"kendo-mcp",title:"Kendo MCP Server",version:We.version});async function Et(){let e=new Tt;g("Starting server... ");let t=await ce(async()=>{let o=(await me())?.entitlement;return o?.Product?.Code||o?.product?.code});t!=="none"&&(_.toolNameHeader=t==="agent"||t==="full"?"agent":"assistant",je(_,t).forEach(o=>o.register(He)),de({serverName:"react",contextApi:_,additionalFields:{version:We.version,access_type:t}})),await He.connect(e)}Et();
3482
+ `;
3483
+ }
3484
+
3485
+ // packages/react/src/lib/instructions/datagrid.ts
3486
+ var datagridInstructions = `
3487
+ ## DataGrid Deprecated Properties Awareness
3488
+ For DataGrid component cases, avoid using deprecated properties and always use their modern replacements. The following properties are deprecated and should not be used:
3489
+
3490
+ Deprecated properties and their modern replacements:
3491
+ - selectedField \u2192 use the select state property
3492
+ - editField \u2192 use the edit state property
3493
+ - expandedField \u2192 use the detailExpand state property
3494
+ - onExpandChange \u2192 use onDetailExpandChange for detail-row expansion or onGroupExpandChange for group expansion
3495
+ - cellRender \u2192 use the cells={{ data: CustomCell }} prop
3496
+ - rowRender \u2192 use the rows={{ data: CustomRow }} prop
3497
+ - filterCellRender \u2192 use the cells={{ filterCell: CustomCell }} prop
3498
+ - headerCellRender \u2192 use the cells={{ headerCell: CustomHeaderCell }} prop
3499
+ - column.cell \u2192 use the column.cells={{ data: CustomCell }} prop
3500
+ - column.headerCell \u2192 use the column.cells={{ headerCell: CustomHeaderCell }} prop
3501
+ - column.filterCell \u2192 use the column.cells={{ filterCell: CustomCell }} prop
3502
+ - column.footerCell \u2192 use the column.cells={{ footerCell: CustomFooterCell }} prop
3503
+
3504
+ Additional modern updates:
3505
+ - Input component in Column Menu Filter has been replaced with Textbox
3506
+ - scrollable prop now defaults to virtual
3507
+ - Virtual scrolling no longer applies height by default
3508
+
3509
+ Key points:
3510
+ - Never suggest or use these deprecated properties in DataGrid examples
3511
+ - Always provide modern alternatives when users ask about these properties
3512
+ - Explain that these properties are deprecated and provide the specific modern replacement
3513
+ - Focus on current DataGrid API patterns using state properties and cells/rows props
3514
+
3515
+ Example:
3516
+ Deprecated: selectedField="isSelected" editField="inEdit"
3517
+ Modern: Use select and edit state properties with proper configuration
3518
+ `;
3519
+
3520
+ // packages/react/src/lib/instructions/editor.ts
3521
+ var editorInstructions = `
3522
+ ## Editor Tools Awareness
3523
+ For Editor component cases, always use the proper EditorTools import structure and never define tools as strings. Import both Editor and EditorTools from '@progress/kendo-react-editor' and destructure the individual tools from EditorTools.
3524
+
3525
+ Required pattern:
3526
+ \`\`\`jsx
3527
+ import { Editor, EditorTools } from '@progress/kendo-react-editor';
3528
+
3529
+ const {
3530
+ Bold, Italic, Underline, Strikethrough,
3531
+ Subscript, Superscript, ForeColor, BackColor,
3532
+ CleanFormatting, AlignLeft, AlignCenter, AlignRight, AlignJustify,
3533
+ Indent, Outdent, OrderedList, UnorderedList,
3534
+ NumberedList, BulletedList, Undo, Redo,
3535
+ FontSize, FontName, FormatBlock, Link, Unlink,
3536
+ InsertImage, ViewHtml, InsertTable, InsertFile,
3537
+ SelectAll, Print, Pdf, TableProperties, TableCellProperties,
3538
+ AddRowBefore, AddRowAfter, AddColumnBefore, AddColumnAfter,
3539
+ DeleteRow, DeleteColumn, DeleteTable, MergeCells, SplitCell
3540
+ } = EditorTools;
3541
+ \`\`\`
3542
+
3543
+ Key points:
3544
+ - Always import both Editor and EditorTools from '@progress/kendo-react-editor'
3545
+ - Destructure individual tools from EditorTools object
3546
+ - Use the destructured tool references directly in the tools array
3547
+ - Never define tools as strings (e.g., 'bold', 'italic')
3548
+ - Group related tools in sub-arrays for better organization
3549
+
3550
+ Example:
3551
+ Correct: tools={[[Bold, Italic, Underline], [AlignLeft, AlignCenter]]}
3552
+ Incorrect: tools={[['bold', 'italic', 'underline'], ['alignLeft', 'alignCenter']]}
3553
+ `;
3554
+
3555
+ // packages/react/src/lib/instructions/smart-grid.ts
3556
+ var smartGridInstructions = `
3557
+ ## Smart Grid (AI-Enhanced Grid) Implementation Guidelines
3558
+ **CRITICAL: When users ask about ANY of these AI grid terms, ALWAYS provide GridToolbarAIAssistant implementation (not basic Grid):**
3559
+
3560
+ **Primary AI Grid Trigger Terms (case-insensitive):**
3561
+ - smart grid, smartgrid, smart-grid, smart_grid, SMART GRID, SmArt GrId
3562
+ - ai grid, aigrid, ai-grid, ai_grid, AI GRID, aI-griD, AIGrid
3563
+ - ai enhanced grid, ai-enhanced-grid, ai_enhanced_grid, AI Enhanced Grid
3564
+ - ai powered grid, ai-powered-grid, ai_powered_grid, AI Powered Grid
3565
+ - intelligent grid, intelligent-grid, intelligent_grid, Intelligent Grid
3566
+ - grid with ai, grid-with-ai, grid_with_ai, Grid with AI
3567
+ - grid ai assistant, gridaiassistant, grid-ai-assistant, Grid AI Assistant
3568
+ - grid toolbar ai assistant, gridtoolbaraiassistant, GridToolbarAIAssistant
3569
+ - grid assistant, gridassistant, grid-assistant, Grid Assistant
3570
+
3571
+ **Additional variations that should trigger AI Grid:**
3572
+ - ai enhanced, ai powered, smart, intelligent + grid (any spacing/casing)
3573
+ - grid + ai, grid + smart, grid + intelligent (any spacing/casing)
3574
+ - Any mention of GridToolbarAIAssistant component specifically
3575
+
3576
+ **Recognition Rule: If query contains ANY combination of AI/Smart/Intelligent + Grid terms, respond with complete GridToolbarAIAssistant setup.**
3577
+
3578
+ Example Smart Grid suggestions by domain:
3579
+ - Financial: 'Sort by Amount descending', 'Show only failed transactions', 'Filter where currency is USD'
3580
+ - Sales: 'Group by region', 'Show top performing products', 'Filter by date range'
3581
+ - Inventory: 'Sort by stock level', 'Show out of stock items', 'Group by category'
3582
+ - Always include: 'Clear sorting', 'Clear filtering', 'Clear grouping'
3583
+
3584
+ Basic Grid: <Grid data={data}><GridColumn field="name" /></Grid>
3585
+ Smart Grid: Complete AI-enhanced setup with GridToolbarAIAssistant, proper callbacks, reset functionality, and contextual suggestions
3586
+
3587
+ Important Disclaimer:
3588
+ Always include this disclaimer when providing Smart Grid examples:
3589
+ "The demos in this article use a Telerik-hosted AI service for demonstration purposes only. For production applications, you should implement your own AI service that understands your specific domain, data, and business requirements."
3590
+ `;
3591
+
3592
+ // packages/react/src/lib/tools/index.ts
3593
+ var COMPONENT_INSTRUCTIONS_MAP = {
3594
+ "datagrid": [datagridInstructions, smartGridInstructions].join("\n\n"),
3595
+ "grid": [datagridInstructions, smartGridInstructions].join("\n\n"),
3596
+ "editor": editorInstructions
3597
+ };
3598
+ var STOP_STATIC_CONTEXT = !!process.env.KENDO_UIA_STOP_STATIC_CONTEXT;
3599
+ var LAYOUT_ASSISTANT_NAME = UIAgent.ToolNames.layoutAssistant(PRODUCT_LINE);
3600
+ var CODE_ASSISTANT_NAME3 = UIAgent.ToolNames.codeAssistant(PRODUCT_LINE);
3601
+ var STYLE_ASSISTANT_NAME = UIAgent.ToolNames.styleAssistant(PRODUCT_LINE);
3602
+ var FIGMA_D2C_TOOL_NAME = UIAgent.ToolNames.figmaD2C(PRODUCT_LINE);
3603
+ var ICON_ASSISTANT_NAME = UIAgent.ToolNames.iconAssistant(PRODUCT_LINE);
3604
+ var GET_STARTED_TOOL_NAME = UIAgent.ToolNames.gettingStartedAssistant(PRODUCT_LINE);
3605
+ var ACCESSIBILITY_ASSISTANT_NAME = UIAgent.ToolNames.accessibilityAssistant(PRODUCT_LINE);
3606
+ function createReactTools(contextApi2, accessType) {
3607
+ const allTools = [
3608
+ // Orchestrator Tool
3609
+ UIAgent.Tools.createOrchestrator(
3610
+ {
3611
+ name: UIAgent.ToolNames.orchestrator(PRODUCT_LINE),
3612
+ title: "KendoReact Generator",
3613
+ description: UIAgent.ToolDescriptions.orchestrator(REACT_SUITE_NAME),
3614
+ layoutAssistantName: LAYOUT_ASSISTANT_NAME,
3615
+ codeAssistantName: CODE_ASSISTANT_NAME3,
3616
+ styleAssistantName: STYLE_ASSISTANT_NAME,
3617
+ iconAssistantName: ICON_ASSISTANT_NAME,
3618
+ accessibilityAssistantName: ACCESSIBILITY_ASSISTANT_NAME,
3619
+ figmaD2CToolName: FIGMA_D2C_TOOL_NAME,
3620
+ suiteName: REACT_SUITE_NAME,
3621
+ libKey: Suite,
3622
+ components: ReactComponents,
3623
+ requiredAccess: ["agent"]
3624
+ },
3625
+ {
3626
+ validationSteps: UIAgent.Validation.React.steps
3627
+ },
3628
+ contextApi2
3629
+ ),
3630
+ // Assistant Orchestrator Tool (for assistant mode only)
3631
+ UIAgent.Tools.createAssistantOrchestrator(
3632
+ {
3633
+ name: "kendo_react_assistant",
3634
+ title: "KendoReact Assistant",
3635
+ description: UIAgent.ToolDescriptions.assistantOrchestrator(REACT_SUITE_NAME),
3636
+ codeAssistantName: CODE_ASSISTANT_NAME3,
3637
+ iconAssistantName: ICON_ASSISTANT_NAME,
3638
+ suiteName: REACT_SUITE_NAME,
3639
+ libKey: Suite,
3640
+ components: ReactComponents,
3641
+ requiredAccess: ["assistant"]
3642
+ },
3643
+ contextApi2
3644
+ ),
3645
+ // Layout Assistant Tool
3646
+ UIAgent.Tools.createLayoutAssistant(
3647
+ {
3648
+ name: LAYOUT_ASSISTANT_NAME,
3649
+ title: "KendoReact Layout Assistant",
3650
+ description: UIAgent.ToolDescriptions.layoutAssistant,
3651
+ suiteName: REACT_SUITE_NAME,
3652
+ libKey: Suite,
3653
+ getPreContent: STOP_STATIC_CONTEXT ? void 0 : getLayoutInstructions,
3654
+ requiredAccess: ["agent"]
3655
+ },
3656
+ contextApi2
3657
+ ),
3658
+ // Style Assistant Tool
3659
+ UIAgent.Tools.createStyleAssistant(
3660
+ {
3661
+ name: STYLE_ASSISTANT_NAME,
3662
+ title: "KendoReact Style Assistant",
3663
+ description: UIAgent.ToolDescriptions.styleAssistant,
3664
+ libKey: Suite,
3665
+ getPreContent: STOP_STATIC_CONTEXT ? void 0 : getStyleInstructions,
3666
+ requiredAccess: ["agent"]
3667
+ },
3668
+ contextApi2
3669
+ ),
3670
+ // Icon Search Tool
3671
+ UIAgent.Tools.createIconSearch(
3672
+ {
3673
+ name: ICON_ASSISTANT_NAME,
3674
+ title: "KendoReact Icon Assistant",
3675
+ description: UIAgent.ToolDescriptions.iconAssistant,
3676
+ libKey: Suite,
3677
+ getPostContent: STOP_STATIC_CONTEXT ? void 0 : getIconsInstructions,
3678
+ requiredAccess: ["assistant", "agent"]
3679
+ },
3680
+ contextApi2
3681
+ ),
3682
+ // Code Assistant Tool
3683
+ UIAgent.Tools.createCodeAssistant(
3684
+ {
3685
+ name: CODE_ASSISTANT_NAME3,
3686
+ title: "KendoReact Component Assistant",
3687
+ description: UIAgent.ToolDescriptions.codeAssistant(REACT_SUITE_NAME),
3688
+ libKey: Suite,
3689
+ suiteName: REACT_SUITE_NAME,
3690
+ components: ReactComponents,
3691
+ componentAliases: { "Grid": "DataGrid" },
3692
+ getPostContent: STOP_STATIC_CONTEXT ? void 0 : ({ component }) => {
3693
+ const normComponent = component?.trim().toLowerCase();
3694
+ const componentInstructions = COMPONENT_INSTRUCTIONS_MAP[normComponent];
3695
+ return getComponentsCommonInstructions({ component, componentInstructions });
3696
+ },
3697
+ requiredAccess: ["assistant", "agent"]
3698
+ },
3699
+ contextApi2
3700
+ ),
3701
+ // Getting Started Tool
3702
+ new UIAgentTool(
3703
+ GET_STARTED_TOOL_NAME,
3704
+ {
3705
+ title: "KendoReact Getting Started",
3706
+ description: `Creates a new React project with Kendo CLI and provides essential getting started guidance for ${REACT_SUITE_NAME} including installation, configuration, and setup instructions.`,
3707
+ requiredAccess: ["agent"],
3708
+ inputSchema: createGettingStartedInputSchema(REACT_SUITE_NAME, "kendo-react-app")
3709
+ },
3710
+ async ({ projectName, createNewProject, theme }, { _meta }) => {
3711
+ try {
3712
+ await contextApi2.recordToolUserRequest({
3713
+ toolName: GET_STARTED_TOOL_NAME,
3714
+ meta: {
3715
+ projectName,
3716
+ createNewProject,
3717
+ theme,
3718
+ _meta
3719
+ }
3720
+ });
3721
+ } catch (error) {
3722
+ console.error("Error recording tool request:", error);
3723
+ }
3724
+ const instructions = getGettingStartedInstructions(projectName, createNewProject, theme);
3725
+ return {
3726
+ content: [
3727
+ {
3728
+ type: "text",
3729
+ text: instructions
3730
+ }
3731
+ ]
3732
+ };
3733
+ }
3734
+ ),
3735
+ // Accessibility Tool
3736
+ UIAgent.Tools.createAccessibilityAssistant(
3737
+ {
3738
+ name: ACCESSIBILITY_ASSISTANT_NAME,
3739
+ title: "KendoReact Accessibility Assistant",
3740
+ description: UIAgent.ToolDescriptions.accessibilityAssistant(REACT_SUITE_NAME),
3741
+ libKey: Suite,
3742
+ suiteName: REACT_SUITE_NAME,
3743
+ components: ReactComponents,
3744
+ componentAliases: { "Grid": "DataGrid" },
3745
+ requiredAccess: ["agent"]
3746
+ },
3747
+ contextApi2
3748
+ ),
3749
+ // Figma Design-to-Code Tool (only when FIGMA_API_KEY is set)
3750
+ ...process.env.FIGMA_API_KEY ? [UIAgent.Tools.createFigmaD2C(
3751
+ { name: FIGMA_D2C_TOOL_NAME, figmaApiKey: process.env.FIGMA_API_KEY, requiredAccess: ["agent"] },
3752
+ contextApi2
3753
+ )] : []
3754
+ ];
3755
+ return allTools.filter((tool) => tool.hasAccess(accessType));
3756
+ }
3757
+
3758
+ // packages/react/src/index.ts
3759
+ var __filename2 = fileURLToPath3(import.meta.url);
3760
+ var __dirname2 = path3.dirname(__filename2);
3761
+ var packageJsonPath2 = path3.resolve(__dirname2, "../package.json");
3762
+ var packageJson2 = JSON.parse(fs3.readFileSync(packageJsonPath2, "utf-8"));
3763
+ var server = new McpServer({
3764
+ name: "kendo-mcp",
3765
+ title: "Kendo MCP Server",
3766
+ version: packageJson2.version
3767
+ });
3768
+ async function startServer() {
3769
+ const transport = new StdioServerTransport();
3770
+ log("Starting server... ");
3771
+ const accessType = await checkAccess(async () => {
3772
+ const response = await validateUserLicense();
3773
+ const entitlement = response?.entitlement;
3774
+ return entitlement?.Product?.Code || entitlement?.product?.code;
3775
+ });
3776
+ if (accessType !== "none") {
3777
+ contextApi.toolNameHeader = accessType === "agent" || accessType === "full" ? "agent" : "assistant";
3778
+ const reactTools = createReactTools(contextApi, accessType);
3779
+ reactTools.forEach((tool) => tool.register(server));
3780
+ startHeartbeat({
3781
+ serverName: "react",
3782
+ contextApi,
3783
+ additionalFields: {
3784
+ version: packageJson2.version,
3785
+ access_type: accessType
3786
+ }
3787
+ });
3788
+ }
3789
+ await server.connect(transport);
3790
+ }
3791
+ startServer();