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