@primeuicom/mcp 1.2.2 → 1.2.3
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/service.js +364 -8
- package/dist/service.js.map +1 -1
- package/package.json +12 -13
package/dist/service.js
CHANGED
|
@@ -229,6 +229,7 @@ function buildProjectRootHint() {
|
|
|
229
229
|
var primeUiProjectConfigSchema = z2.object({
|
|
230
230
|
projectId: z2.string().trim().min(1),
|
|
231
231
|
apiKey: z2.string().trim().min(1),
|
|
232
|
+
apiBaseUrl: z2.string().trim().url().optional(),
|
|
232
233
|
targetProjectPath: z2.string().trim().regex(/^\.\/.*$/).optional()
|
|
233
234
|
}).passthrough();
|
|
234
235
|
var primeUiProjectConfigWithTargetPathSchema = primeUiProjectConfigSchema.superRefine((value, ctx) => {
|
|
@@ -519,6 +520,23 @@ async function resolvePrimeUiApiKey(options) {
|
|
|
519
520
|
hint: "Set PRIMEUI_API_KEY or ensure apiKey is present in .primeui/project.json."
|
|
520
521
|
});
|
|
521
522
|
}
|
|
523
|
+
function resolvePrimeUiApiBaseUrlDetails(options) {
|
|
524
|
+
const envBaseUrl = options.baseUrlFromEnv?.trim();
|
|
525
|
+
const configBaseUrl = options.projectConfig?.apiBaseUrl?.trim();
|
|
526
|
+
const envProvided = Boolean(envBaseUrl);
|
|
527
|
+
const configProvided = Boolean(configBaseUrl);
|
|
528
|
+
const resolvedBaseUrl = envBaseUrl || configBaseUrl;
|
|
529
|
+
return {
|
|
530
|
+
baseUrl: resolvedBaseUrl,
|
|
531
|
+
source: envProvided ? "env" : configProvided ? "config" : "default",
|
|
532
|
+
envProvided,
|
|
533
|
+
configProvided,
|
|
534
|
+
valuesMatch: envProvided && configProvided ? envBaseUrl === configBaseUrl : void 0
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function resolvePrimeUiApiBaseUrl(options) {
|
|
538
|
+
return resolvePrimeUiApiBaseUrlDetails(options).baseUrl;
|
|
539
|
+
}
|
|
522
540
|
|
|
523
541
|
// src/sources/api-provider.ts
|
|
524
542
|
import { createWriteStream } from "fs";
|
|
@@ -529,6 +547,9 @@ import { pipeline } from "stream/promises";
|
|
|
529
547
|
|
|
530
548
|
// src/lib/api-v1-contract.ts
|
|
531
549
|
import { z as z3 } from "zod";
|
|
550
|
+
var primeUiPageSlugInputSchema = z3.string().refine((value) => value.trim().length > 0, {
|
|
551
|
+
message: "pageSlug must be a non-empty string"
|
|
552
|
+
});
|
|
532
553
|
var primeUiExportStatusSchema = z3.enum(
|
|
533
554
|
["in_progress", "completed", "failed"]
|
|
534
555
|
);
|
|
@@ -639,6 +660,105 @@ var primeUiPageGenerationTypeSchema = z3.enum([
|
|
|
639
660
|
"docs",
|
|
640
661
|
"legal"
|
|
641
662
|
]);
|
|
663
|
+
var primeUiComponentCandidateOperationSchema = z3.discriminatedUnion("type", [
|
|
664
|
+
z3.object({
|
|
665
|
+
type: z3.literal("append")
|
|
666
|
+
}),
|
|
667
|
+
z3.object({
|
|
668
|
+
type: z3.literal("insert"),
|
|
669
|
+
index: z3.number().int()
|
|
670
|
+
}),
|
|
671
|
+
z3.object({
|
|
672
|
+
type: z3.literal("replace"),
|
|
673
|
+
index: z3.number().int()
|
|
674
|
+
})
|
|
675
|
+
]);
|
|
676
|
+
var primeUiComponentCandidateConstraintsSchema = z3.object({
|
|
677
|
+
spreadDegree: z3.enum(["any-group", "same-group", "same-family"]).optional(),
|
|
678
|
+
allowedGroups: z3.array(z3.string()).optional(),
|
|
679
|
+
excludedGroups: z3.array(z3.string()).optional(),
|
|
680
|
+
excludeComponentIds: z3.array(z3.string()).optional()
|
|
681
|
+
});
|
|
682
|
+
var primeUiComponentCandidatesInputSchema = z3.object({
|
|
683
|
+
pageSlug: primeUiPageSlugInputSchema,
|
|
684
|
+
pageType: primeUiPageGenerationTypeSchema,
|
|
685
|
+
blocks: z3.array(
|
|
686
|
+
z3.object({
|
|
687
|
+
componentId: z3.string()
|
|
688
|
+
})
|
|
689
|
+
),
|
|
690
|
+
operation: primeUiComponentCandidateOperationSchema,
|
|
691
|
+
count: z3.number().int().positive().optional(),
|
|
692
|
+
constraints: primeUiComponentCandidateConstraintsSchema.optional()
|
|
693
|
+
});
|
|
694
|
+
var primeUiComponentCandidateRequestEchoSchema = z3.object({
|
|
695
|
+
pageSlug: z3.string(),
|
|
696
|
+
pageType: z3.string(),
|
|
697
|
+
operation: primeUiComponentCandidateOperationSchema,
|
|
698
|
+
count: z3.number()
|
|
699
|
+
});
|
|
700
|
+
var requiredUnknownSchema = z3.custom((value) => value !== void 0);
|
|
701
|
+
var primeUiComponentCandidateLayoutObjectSchema = z3.object({
|
|
702
|
+
container: requiredUnknownSchema,
|
|
703
|
+
textAlignment: requiredUnknownSchema,
|
|
704
|
+
bottomWeight: requiredUnknownSchema,
|
|
705
|
+
entryWidth: requiredUnknownSchema,
|
|
706
|
+
exitWidth: requiredUnknownSchema,
|
|
707
|
+
orientation: requiredUnknownSchema,
|
|
708
|
+
structure: requiredUnknownSchema
|
|
709
|
+
});
|
|
710
|
+
var primeUiComponentCandidateLayoutSchema = z3.custom(
|
|
711
|
+
(value) => primeUiComponentCandidateLayoutObjectSchema.safeParse(value).success
|
|
712
|
+
);
|
|
713
|
+
var primeUiComponentCandidateObjectSchema = z3.object({
|
|
714
|
+
componentId: z3.string(),
|
|
715
|
+
name: z3.string(),
|
|
716
|
+
group: z3.string(),
|
|
717
|
+
familyId: z3.string(),
|
|
718
|
+
uxScore: z3.number(),
|
|
719
|
+
insertionScore: z3.number(),
|
|
720
|
+
followingScore: z3.number(),
|
|
721
|
+
layout: primeUiComponentCandidateLayoutSchema,
|
|
722
|
+
defaultProps: requiredUnknownSchema,
|
|
723
|
+
exportReady: z3.boolean(),
|
|
724
|
+
copyHints: z3.object({
|
|
725
|
+
deliveryToolchain: z3.array(z3.string())
|
|
726
|
+
}),
|
|
727
|
+
description: z3.string().nullable().optional(),
|
|
728
|
+
functionality: z3.string().nullable().optional(),
|
|
729
|
+
impression: z3.string().nullable().optional(),
|
|
730
|
+
visualStyle: z3.unknown().optional(),
|
|
731
|
+
compactSchema: z3.string().nullable().optional(),
|
|
732
|
+
jsonSchema: z3.record(z3.unknown()).nullable().optional()
|
|
733
|
+
});
|
|
734
|
+
var primeUiComponentCandidateSchema = z3.custom(
|
|
735
|
+
(value) => primeUiComponentCandidateObjectSchema.safeParse(value).success
|
|
736
|
+
);
|
|
737
|
+
var primeUiComponentCandidatesResponseSchema = z3.object({
|
|
738
|
+
request: primeUiComponentCandidateRequestEchoSchema,
|
|
739
|
+
candidates: z3.array(primeUiComponentCandidateSchema)
|
|
740
|
+
});
|
|
741
|
+
var primeUiComponentPropsValidateInputSchema = z3.object({
|
|
742
|
+
pageSlug: primeUiPageSlugInputSchema,
|
|
743
|
+
componentId: z3.string(),
|
|
744
|
+
props: z3.record(z3.unknown())
|
|
745
|
+
});
|
|
746
|
+
var primeUiComponentPropsValidationErrorSchema = z3.object({
|
|
747
|
+
path: z3.string(),
|
|
748
|
+
message: z3.string()
|
|
749
|
+
});
|
|
750
|
+
var primeUiComponentPropsRenderCheckSchema = z3.object({
|
|
751
|
+
attempted: z3.boolean(),
|
|
752
|
+
passed: z3.boolean(),
|
|
753
|
+
message: z3.string()
|
|
754
|
+
});
|
|
755
|
+
var primeUiComponentPropsValidateResponseSchema = z3.object({
|
|
756
|
+
valid: z3.boolean(),
|
|
757
|
+
normalizedProps: z3.record(z3.unknown()).nullable(),
|
|
758
|
+
errors: z3.array(primeUiComponentPropsValidationErrorSchema),
|
|
759
|
+
hints: z3.array(z3.string()),
|
|
760
|
+
renderCheck: primeUiComponentPropsRenderCheckSchema
|
|
761
|
+
});
|
|
642
762
|
var primeUiProjectApiWireframeStatusSchema = z3.enum(["pending", "generating", "ready", "error"]);
|
|
643
763
|
var primeUiProjectApiVariantSummarySchema = z3.object({
|
|
644
764
|
id: z3.string(),
|
|
@@ -1145,6 +1265,20 @@ var ApiProjectDataProvider = class {
|
|
|
1145
1265
|
primeUiProjectPageDetailsSchema
|
|
1146
1266
|
);
|
|
1147
1267
|
}
|
|
1268
|
+
async getComponentCandidates(input) {
|
|
1269
|
+
return this.requestJson(
|
|
1270
|
+
"component-planning/candidates",
|
|
1271
|
+
primeUiComponentCandidatesResponseSchema,
|
|
1272
|
+
this.buildJsonRequestInit(input)
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
async validateComponentProps(input) {
|
|
1276
|
+
return this.requestJson(
|
|
1277
|
+
"component-planning/props/validate",
|
|
1278
|
+
primeUiComponentPropsValidateResponseSchema,
|
|
1279
|
+
this.buildJsonRequestInit(input)
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1148
1282
|
async listExports() {
|
|
1149
1283
|
const response = await this.requestJson(
|
|
1150
1284
|
"project/exports",
|
|
@@ -1856,19 +1990,23 @@ async function runHealthCheck(options) {
|
|
|
1856
1990
|
apiKeyFromEnv: env.PRIMEUI_API_KEY
|
|
1857
1991
|
});
|
|
1858
1992
|
const configApiKeyState = resolvedProjectConfig ? "set" : configStatus === "missing" || configStatus === "unresolved" ? "missing" : "unknown";
|
|
1859
|
-
const
|
|
1993
|
+
const apiBaseUrlDetails = resolvePrimeUiApiBaseUrlDetails({
|
|
1994
|
+
projectConfig: resolvedProjectConfig?.projectConfig,
|
|
1995
|
+
baseUrlFromEnv: env.PRIMEUI_API_BASE_URL
|
|
1996
|
+
});
|
|
1997
|
+
const apiBaseUrlSource = apiBaseUrlDetails.source;
|
|
1860
1998
|
const defaultApiRoot = normalizePrimeUiApiRoot(DEFAULT_API_BASE_URL);
|
|
1861
1999
|
let apiRoot;
|
|
1862
2000
|
let projectInfoUrl;
|
|
1863
2001
|
let apiCheck;
|
|
1864
2002
|
try {
|
|
1865
|
-
apiRoot = normalizePrimeUiApiRoot(
|
|
2003
|
+
apiRoot = normalizePrimeUiApiRoot(apiBaseUrlDetails.baseUrl);
|
|
1866
2004
|
projectInfoUrl = buildPrimeUiApiUrl(apiRoot, "project");
|
|
1867
2005
|
} catch (error) {
|
|
1868
2006
|
apiCheck = {
|
|
1869
2007
|
status: "skipped",
|
|
1870
2008
|
apiBaseUrlSource,
|
|
1871
|
-
nonStandardBaseUrl: Boolean(
|
|
2009
|
+
nonStandardBaseUrl: Boolean(apiBaseUrlDetails.baseUrl?.trim()),
|
|
1872
2010
|
message: error instanceof Error ? error.message : String(error),
|
|
1873
2011
|
errorKind: "configuration"
|
|
1874
2012
|
};
|
|
@@ -1886,10 +2024,10 @@ async function runHealthCheck(options) {
|
|
|
1886
2024
|
} else {
|
|
1887
2025
|
const provider = options.createProvider?.({
|
|
1888
2026
|
apiKey: apiKeyDetails.apiKey,
|
|
1889
|
-
baseUrl:
|
|
2027
|
+
baseUrl: apiBaseUrlDetails.baseUrl
|
|
1890
2028
|
}) ?? new ApiProjectDataProvider({
|
|
1891
2029
|
apiKey: apiKeyDetails.apiKey,
|
|
1892
|
-
baseUrl:
|
|
2030
|
+
baseUrl: apiBaseUrlDetails.baseUrl
|
|
1893
2031
|
});
|
|
1894
2032
|
try {
|
|
1895
2033
|
await provider.getProjectInfo();
|
|
@@ -4160,7 +4298,9 @@ async function copyRegistryComponentFromExport(input) {
|
|
|
4160
4298
|
graphInternalFiles,
|
|
4161
4299
|
referencedPublicFiles
|
|
4162
4300
|
});
|
|
4163
|
-
const copyableSourceFiles = fileTransfers.map(
|
|
4301
|
+
const copyableSourceFiles = fileTransfers.map(
|
|
4302
|
+
(transfer) => transfer.sourcePath
|
|
4303
|
+
);
|
|
4164
4304
|
const copyableFiles = fileTransfers.map((transfer) => transfer.targetPath);
|
|
4165
4305
|
const transferBySourcePath = new Map(
|
|
4166
4306
|
fileTransfers.map((transfer) => [transfer.sourcePath, transfer])
|
|
@@ -4510,6 +4650,12 @@ var ProjectSyncService = class {
|
|
|
4510
4650
|
notes: guidanceNotes
|
|
4511
4651
|
};
|
|
4512
4652
|
}
|
|
4653
|
+
async getComponentCandidates(input, _context) {
|
|
4654
|
+
return this.provider.getComponentCandidates(input);
|
|
4655
|
+
}
|
|
4656
|
+
async validateComponentProps(input, _context) {
|
|
4657
|
+
return this.provider.validateComponentProps(input);
|
|
4658
|
+
}
|
|
4513
4659
|
async listExports(_context) {
|
|
4514
4660
|
await this.ensureTempLayout();
|
|
4515
4661
|
return this.provider.listExports();
|
|
@@ -4768,10 +4914,14 @@ var LazyProjectSyncSource = class {
|
|
|
4768
4914
|
projectConfig: resolvedProjectConfig.projectConfig,
|
|
4769
4915
|
apiKeyFromEnv: this.env.PRIMEUI_API_KEY
|
|
4770
4916
|
});
|
|
4917
|
+
const baseUrl = resolvePrimeUiApiBaseUrl({
|
|
4918
|
+
projectConfig: resolvedProjectConfig.projectConfig,
|
|
4919
|
+
baseUrlFromEnv: this.env.PRIMEUI_API_BASE_URL
|
|
4920
|
+
});
|
|
4771
4921
|
this.stickyProjectRoot = projectRoot;
|
|
4772
4922
|
const provider = this.createProvider({
|
|
4773
4923
|
apiKey,
|
|
4774
|
-
baseUrl
|
|
4924
|
+
baseUrl
|
|
4775
4925
|
});
|
|
4776
4926
|
return new ProjectSyncService({
|
|
4777
4927
|
projectRoot,
|
|
@@ -4954,6 +5104,24 @@ var LazyProjectSyncSource = class {
|
|
|
4954
5104
|
(service) => service.syncSearchEnvironment(environmentSlug, context)
|
|
4955
5105
|
);
|
|
4956
5106
|
}
|
|
5107
|
+
async getComponentCandidates(input, context) {
|
|
5108
|
+
return this.withService(
|
|
5109
|
+
context,
|
|
5110
|
+
(service) => service.getComponentCandidates(input, context),
|
|
5111
|
+
{
|
|
5112
|
+
requireTargetProjectRoot: false
|
|
5113
|
+
}
|
|
5114
|
+
);
|
|
5115
|
+
}
|
|
5116
|
+
async validateComponentProps(input, context) {
|
|
5117
|
+
return this.withService(
|
|
5118
|
+
context,
|
|
5119
|
+
(service) => service.validateComponentProps(input, context),
|
|
5120
|
+
{
|
|
5121
|
+
requireTargetProjectRoot: false
|
|
5122
|
+
}
|
|
5123
|
+
);
|
|
5124
|
+
}
|
|
4957
5125
|
async listExports(context) {
|
|
4958
5126
|
return this.withService(context, (service) => service.listExports(context));
|
|
4959
5127
|
}
|
|
@@ -5248,7 +5416,8 @@ ${WORKFLOW_SUMMARY}
|
|
|
5248
5416
|
|
|
5249
5417
|
ADDITIONAL CAPABILITIES:
|
|
5250
5418
|
- PrimeUI MCP also exposes atomic external API tools for project description, project pages, page variants, active-variant selection, and issue reports.
|
|
5251
|
-
-
|
|
5419
|
+
- PrimeUI MCP also exposes component planning tools such as component_candidates_get and component_props_validate for exported-project page building.
|
|
5420
|
+
- These additional tools are OPTIONAL capabilities for extended scenarios.
|
|
5252
5421
|
- They are NOT part of the primary import/export workflow above.
|
|
5253
5422
|
- Do not replace get_project_info/create_export/download_export/copy_* with the additional API tools when the user wants the standard page import/export flow.
|
|
5254
5423
|
|
|
@@ -6042,6 +6211,122 @@ var pageGenerationTypeSchema = z4.enum([
|
|
|
6042
6211
|
]).describe(
|
|
6043
6212
|
"Supported PrimeUI page type. Must match the external API page type enum."
|
|
6044
6213
|
);
|
|
6214
|
+
var componentCandidateOperationSchema = z4.discriminatedUnion("type", [
|
|
6215
|
+
z4.object({
|
|
6216
|
+
type: z4.literal("append")
|
|
6217
|
+
}),
|
|
6218
|
+
z4.object({
|
|
6219
|
+
type: z4.literal("insert"),
|
|
6220
|
+
index: z4.number().int().describe("Zero-based insertion index in the ordered blocks list.")
|
|
6221
|
+
}),
|
|
6222
|
+
z4.object({
|
|
6223
|
+
type: z4.literal("replace"),
|
|
6224
|
+
index: z4.number().int().describe("Zero-based index of the block being replaced.")
|
|
6225
|
+
})
|
|
6226
|
+
]);
|
|
6227
|
+
var componentCandidatesGetInputSchema = z4.object({
|
|
6228
|
+
projectRoot: projectRootInputSchema,
|
|
6229
|
+
pageSlug: z4.string().refine((value) => value.trim().length > 0, {
|
|
6230
|
+
message: "pageSlug must be a non-empty string"
|
|
6231
|
+
}).describe(
|
|
6232
|
+
"Stable PrimeUI page slug used for candidate scoring and automatic diagnostics, for example '/pricing'."
|
|
6233
|
+
),
|
|
6234
|
+
pageType: pageGenerationTypeSchema,
|
|
6235
|
+
blocks: z4.array(
|
|
6236
|
+
z4.object({
|
|
6237
|
+
componentId: z4.string().describe("PrimeUI component id already present in page order.")
|
|
6238
|
+
})
|
|
6239
|
+
).describe(
|
|
6240
|
+
"Current ordered page composition before applying the requested operation."
|
|
6241
|
+
),
|
|
6242
|
+
operation: componentCandidateOperationSchema.optional().default({ type: "append" }).describe(
|
|
6243
|
+
"Candidate placement operation. Omit for the normal append flow."
|
|
6244
|
+
),
|
|
6245
|
+
count: z4.number().int().positive().optional().describe("Optional maximum candidate count. Studio defaults to 8."),
|
|
6246
|
+
constraints: z4.object({
|
|
6247
|
+
spreadDegree: z4.enum(["any-group", "same-group", "same-family"]).optional().describe("Optional UX scoring spread override."),
|
|
6248
|
+
allowedGroups: z4.array(z4.string()).optional().describe("Optional allow-list of candidate groups."),
|
|
6249
|
+
excludedGroups: z4.array(z4.string()).optional().describe("Optional deny-list of candidate groups."),
|
|
6250
|
+
excludeComponentIds: z4.array(z4.string()).optional().describe("Optional component ids to remove from the candidate pool.")
|
|
6251
|
+
}).optional().describe("Optional advanced candidate pool and spread constraints.")
|
|
6252
|
+
});
|
|
6253
|
+
var componentCandidatesGetValidationSchema = componentCandidatesGetInputSchema;
|
|
6254
|
+
var componentPropsValidateInputSchema = z4.object({
|
|
6255
|
+
projectRoot: projectRootInputSchema,
|
|
6256
|
+
pageSlug: z4.string().refine((value) => value.trim().length > 0, {
|
|
6257
|
+
message: "pageSlug must be a non-empty string"
|
|
6258
|
+
}).describe(
|
|
6259
|
+
"Stable PrimeUI page slug used for validation diagnostics, for example '/pricing'. Use the same pageSlug as candidate retrieval."
|
|
6260
|
+
),
|
|
6261
|
+
componentId: z4.string().describe("PrimeUI component registry identifier selected by the agent."),
|
|
6262
|
+
props: z4.record(z4.unknown()).describe(
|
|
6263
|
+
"Agent-authored props payload to validate against PrimeUI's registry schema."
|
|
6264
|
+
)
|
|
6265
|
+
});
|
|
6266
|
+
var componentPropsValidateValidationSchema = componentPropsValidateInputSchema;
|
|
6267
|
+
var componentCandidateLayoutSchema = z4.object({
|
|
6268
|
+
container: z4.unknown().describe("Layout container metadata."),
|
|
6269
|
+
textAlignment: z4.unknown().describe("Text alignment metadata."),
|
|
6270
|
+
bottomWeight: z4.unknown().describe("Bottom visual weight metadata."),
|
|
6271
|
+
entryWidth: z4.unknown().describe("Incoming width rhythm metadata."),
|
|
6272
|
+
exitWidth: z4.unknown().describe("Outgoing width rhythm metadata."),
|
|
6273
|
+
orientation: z4.unknown().describe("Optional orientation metadata."),
|
|
6274
|
+
structure: z4.unknown().describe("Optional structure metadata.")
|
|
6275
|
+
});
|
|
6276
|
+
var componentCandidateSchema = z4.object({
|
|
6277
|
+
componentId: z4.string().describe("PrimeUI component registry identifier to choose or export."),
|
|
6278
|
+
name: z4.string().describe("Human-readable component name."),
|
|
6279
|
+
group: z4.string().describe("Component group used by candidate scoring."),
|
|
6280
|
+
familyId: z4.string().describe("Component family identifier from catalog."),
|
|
6281
|
+
uxScore: z4.number().describe("Total UX score used for ranking."),
|
|
6282
|
+
insertionScore: z4.number().describe("Score for inserting this candidate at the requested position."),
|
|
6283
|
+
followingScore: z4.number().describe("Neighbor compatibility score with the following block."),
|
|
6284
|
+
layout: componentCandidateLayoutSchema.describe(
|
|
6285
|
+
"Layout metadata useful for choosing visual rhythm."
|
|
6286
|
+
),
|
|
6287
|
+
defaultProps: z4.unknown().describe("Registry default props, when available from PrimeUI."),
|
|
6288
|
+
exportReady: z4.boolean().describe("True when the component is expected to be exportable."),
|
|
6289
|
+
copyHints: z4.object({
|
|
6290
|
+
deliveryToolchain: z4.array(z4.string()).describe(
|
|
6291
|
+
"Recommended tool sequence for delivering this registry component locally."
|
|
6292
|
+
)
|
|
6293
|
+
}).describe("Machine-readable delivery hints for the selected candidate."),
|
|
6294
|
+
description: z4.string().nullable().optional(),
|
|
6295
|
+
functionality: z4.string().nullable().optional(),
|
|
6296
|
+
impression: z4.string().nullable().optional(),
|
|
6297
|
+
visualStyle: z4.unknown().optional(),
|
|
6298
|
+
compactSchema: z4.string().nullable().optional(),
|
|
6299
|
+
jsonSchema: z4.record(z4.unknown()).nullable().optional()
|
|
6300
|
+
});
|
|
6301
|
+
var componentCandidatesGetOutputSchema = z4.object({
|
|
6302
|
+
request: z4.object({
|
|
6303
|
+
pageSlug: z4.string(),
|
|
6304
|
+
pageType: z4.string(),
|
|
6305
|
+
operation: componentCandidateOperationSchema,
|
|
6306
|
+
count: z4.number()
|
|
6307
|
+
}).describe("Normalized request echo returned by PrimeUI."),
|
|
6308
|
+
candidates: z4.array(componentCandidateSchema).describe("Ranked rich candidate shortlist returned by PrimeUI.")
|
|
6309
|
+
});
|
|
6310
|
+
var componentPropsValidationErrorSchema = z4.object({
|
|
6311
|
+
path: z4.string().describe("JSON path or root path for the invalid props location."),
|
|
6312
|
+
message: z4.string().describe("Actionable validation message returned by PrimeUI.")
|
|
6313
|
+
});
|
|
6314
|
+
var componentPropsRenderCheckSchema = z4.object({
|
|
6315
|
+
attempted: z4.boolean().describe("True when PrimeUI attempted a render smoke check."),
|
|
6316
|
+
passed: z4.boolean().describe("True when the render smoke check passed."),
|
|
6317
|
+
message: z4.string().describe("Human-readable render check status or skip reason.")
|
|
6318
|
+
});
|
|
6319
|
+
var componentPropsValidateOutputSchema = z4.object({
|
|
6320
|
+
valid: z4.boolean().describe("True when props passed schema validation."),
|
|
6321
|
+
normalizedProps: z4.record(z4.unknown()).nullable().describe(
|
|
6322
|
+
"Props normalized by PrimeUI when valid; null when validation failed."
|
|
6323
|
+
),
|
|
6324
|
+
errors: z4.array(componentPropsValidationErrorSchema).describe("Structured validation errors for invalid props."),
|
|
6325
|
+
hints: z4.array(z4.string()).describe("Agent-facing guidance for correcting invalid props."),
|
|
6326
|
+
renderCheck: componentPropsRenderCheckSchema.describe(
|
|
6327
|
+
"Optional render-smoke status returned by PrimeUI."
|
|
6328
|
+
)
|
|
6329
|
+
});
|
|
6045
6330
|
var projectApiPageResourceSchema = z4.object({
|
|
6046
6331
|
id: z4.string().describe("Stable PrimeUI page identifier."),
|
|
6047
6332
|
title: z4.string().describe("Human-readable page title."),
|
|
@@ -6475,6 +6760,51 @@ WHEN TO USE:
|
|
|
6475
6760
|
openWorldHint: true
|
|
6476
6761
|
}
|
|
6477
6762
|
};
|
|
6763
|
+
var toolComponentCandidatesGet = {
|
|
6764
|
+
title: "PrimeUI Component Candidates Get",
|
|
6765
|
+
description: `External planning helper. Returns a ranked rich candidate shortlist for adding, inserting, or replacing one PrimeUI component in an exported-project page composition.
|
|
6766
|
+
|
|
6767
|
+
WHEN TO USE:
|
|
6768
|
+
- Use this when building or editing a local exported-project page and you need PrimeUI scoring guidance for which componentId to choose next.
|
|
6769
|
+
- The normal flow is append: pass the current ordered blocks and omit operation, which defaults to { "type": "append" }.
|
|
6770
|
+
- Use insert or replace only when the caller is intentionally editing a specific position in the ordered blocks list.
|
|
6771
|
+
- Use the returned copyHints.deliveryToolchain when the chosen candidate must be delivered locally: create_component_export, download_component_export, then copy_registry_component.
|
|
6772
|
+
|
|
6773
|
+
AFTER CALLING:
|
|
6774
|
+
- Choose from candidates using uxScore, insertionScore, followingScore, group/family/layout rhythm, descriptions, defaults, and schemas.
|
|
6775
|
+
- Do not mutate Prime page state from this tool result. This is planning guidance only.
|
|
6776
|
+
- Keep the same pageSlug across later planning and validation calls so PrimeUI diagnostics stay correlated.`,
|
|
6777
|
+
inputSchema: componentCandidatesGetInputSchema,
|
|
6778
|
+
outputSchema: componentCandidatesGetOutputSchema,
|
|
6779
|
+
annotations: {
|
|
6780
|
+
readOnlyHint: true,
|
|
6781
|
+
destructiveHint: false,
|
|
6782
|
+
idempotentHint: true,
|
|
6783
|
+
openWorldHint: true
|
|
6784
|
+
}
|
|
6785
|
+
};
|
|
6786
|
+
var toolComponentPropsValidate = {
|
|
6787
|
+
title: "PrimeUI Component Props Validate",
|
|
6788
|
+
description: `External planning helper. Validates agent-authored props for one selected PrimeUI component before editing local exported-project files.
|
|
6789
|
+
|
|
6790
|
+
WHEN TO USE:
|
|
6791
|
+
- Use this after choosing a component candidate and drafting props from the user's brief, candidate metadata, defaultProps, compactSchema, or jsonSchema.
|
|
6792
|
+
- Keep pageSlug stable across candidate retrieval and validation so PrimeUI diagnostics stay correlated.
|
|
6793
|
+
- Treat valid: false as actionable feedback, not a transport failure. Fix the props from errors and hints, then call this tool again.
|
|
6794
|
+
|
|
6795
|
+
AFTER CALLING:
|
|
6796
|
+
- If valid is true, use normalizedProps for local page edits.
|
|
6797
|
+
- If valid is false, correct props using errors[].path, errors[].message, and hints before editing local files.
|
|
6798
|
+
- Do not mutate Prime page state from this tool result. This is validation guidance only.`,
|
|
6799
|
+
inputSchema: componentPropsValidateInputSchema,
|
|
6800
|
+
outputSchema: componentPropsValidateOutputSchema,
|
|
6801
|
+
annotations: {
|
|
6802
|
+
readOnlyHint: true,
|
|
6803
|
+
destructiveHint: false,
|
|
6804
|
+
idempotentHint: true,
|
|
6805
|
+
openWorldHint: true
|
|
6806
|
+
}
|
|
6807
|
+
};
|
|
6478
6808
|
var toolProjectIssueReportSubmit = {
|
|
6479
6809
|
title: "PrimeUI Project Issue Report Submit",
|
|
6480
6810
|
description: `Atomic external API helper. Submits an issue report for the scoped PrimeUI project.
|
|
@@ -6885,6 +7215,32 @@ function createPrimeUiMcpServer(source) {
|
|
|
6885
7215
|
}
|
|
6886
7216
|
}
|
|
6887
7217
|
);
|
|
7218
|
+
server.registerTool(
|
|
7219
|
+
"component_candidates_get",
|
|
7220
|
+
toolComponentCandidatesGet,
|
|
7221
|
+
async (args) => {
|
|
7222
|
+
try {
|
|
7223
|
+
const { projectRoot, ...input } = componentCandidatesGetValidationSchema.parse(args);
|
|
7224
|
+
const result = await source.getComponentCandidates(input, { projectRoot });
|
|
7225
|
+
return okResult("component_candidates_get", result);
|
|
7226
|
+
} catch (error) {
|
|
7227
|
+
return errorResult(error);
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7230
|
+
);
|
|
7231
|
+
server.registerTool(
|
|
7232
|
+
"component_props_validate",
|
|
7233
|
+
toolComponentPropsValidate,
|
|
7234
|
+
async (args) => {
|
|
7235
|
+
try {
|
|
7236
|
+
const { projectRoot, ...input } = componentPropsValidateValidationSchema.parse(args);
|
|
7237
|
+
const result = await source.validateComponentProps(input, { projectRoot });
|
|
7238
|
+
return okResult("component_props_validate", result);
|
|
7239
|
+
} catch (error) {
|
|
7240
|
+
return errorResult(error);
|
|
7241
|
+
}
|
|
7242
|
+
}
|
|
7243
|
+
);
|
|
6888
7244
|
server.registerTool(
|
|
6889
7245
|
"list_exports",
|
|
6890
7246
|
toolListExports,
|