'use strict'; var chunkDIG2K5CV_cjs = require('./chunk-DIG2K5CV.cjs'); var v4 = require('zod/v4'); var storedSkillIdPathParams = v4.z.object({ storedSkillId: v4.z.string().describe("Unique identifier for the stored skill") }); var storageOrderBySchema = v4.z.object({ field: v4.z.enum(["createdAt", "updatedAt"]).optional(), direction: v4.z.enum(["ASC", "DESC"]).optional() }); var listStoredSkillsQuerySchema = chunkDIG2K5CV_cjs.createPagePaginationSchema(100).extend({ orderBy: storageOrderBySchema.optional(), status: v4.z.enum(["draft", "published", "archived"]).optional().describe("Filter skills by status"), authorId: v4.z.string().optional().describe("Filter skills by author identifier"), visibility: v4.z.enum(["public"]).optional().describe("Filter to only public skills"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Filter skills by metadata key-value pairs"), favoritedOnly: v4.z.stringbool().optional().describe("When true, return only skills favorited by the caller (requires the `favorites` EE feature)"), pinFavoritedFor: v4.z.string().optional().describe( "When set, treat the given subject (user/role) as the favoriting principal for `favoritedOnly` instead of the caller" ) }); var sourceSchema = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("external"), packagePath: v4.z.string().describe("Package path for external source") }), v4.z.object({ type: v4.z.literal("local"), projectPath: v4.z.string().describe("Project path for local source") }), v4.z.object({ type: v4.z.literal("managed"), mastraPath: v4.z.string().describe("Mastra path for managed source") }) ]); var fileNodeSchema = v4.z.object({ id: v4.z.string().optional(), name: v4.z.string(), type: v4.z.enum(["file", "folder"]), content: v4.z.string().optional(), children: v4.z.lazy(() => v4.z.array(fileNodeSchema)).optional() }); var skillOriginSchema = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("skills-sh"), owner: v4.z.string().describe("Repository owner on skills.sh"), repo: v4.z.string().describe("Repository name on skills.sh"), skillName: v4.z.string().describe("Original skill name on skills.sh"), installedAt: v4.z.string().describe("ISO-8601 timestamp of the install") }), v4.z.object({ type: v4.z.literal("library-copy"), sourceSkillId: v4.z.string().describe("ID of the public Library skill this was copied from"), sourceSkillName: v4.z.string().describe("Name of the source skill at copy time"), sourceAuthorId: v4.z.string().optional().describe("Author of the source skill at copy time, when known"), copiedAt: v4.z.string().describe("ISO-8601 timestamp of the copy") }) ]); var SKILL_ORIGIN_METADATA_KEY = "origin"; function readSkillOrigin(metadata) { if (!metadata) return null; const raw = metadata[SKILL_ORIGIN_METADATA_KEY]; if (!raw) return null; const parsed = skillOriginSchema.safeParse(raw); return parsed.success ? parsed.data : null; } function buildOriginMetadata(origin) { return { [SKILL_ORIGIN_METADATA_KEY]: origin }; } var snapshotConfigSchema = v4.z.object({ name: v4.z.string().describe("Name of the skill"), description: v4.z.string().describe("Description of what the skill does and when to use it"), instructions: v4.z.string().describe("Markdown instructions for the skill"), license: v4.z.string().optional().describe("License identifier for the skill"), compatibility: v4.z.unknown().optional().describe("Compatibility requirements"), source: sourceSchema.optional().describe("Source location of the skill"), references: v4.z.array(v4.z.string()).optional().describe("List of reference file paths"), scripts: v4.z.array(v4.z.string()).optional().describe("List of script file paths"), assets: v4.z.array(v4.z.string()).optional().describe("List of asset file paths"), files: v4.z.array(fileNodeSchema).optional().describe("Full file tree structure for the skill"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Additional metadata for the skill") }); var createStoredSkillBodySchema = v4.z.object({ id: v4.z.string().optional().describe("Unique identifier. If not provided, derived from name."), authorId: v4.z.string().optional().describe("Author identifier for multi-tenant filtering"), visibility: v4.z.enum(["private", "public"]).optional().describe("Skill visibility: private (owner/admin only) or public (any reader)") }).merge(snapshotConfigSchema); var updateStoredSkillBodySchema = v4.z.object({ authorId: v4.z.string().optional(), visibility: v4.z.enum(["private", "public"]).optional().describe("Skill visibility: private (owner/admin only) or public (any reader)") }).partial().merge(snapshotConfigSchema.partial()); var storedSkillSchema = v4.z.object({ id: v4.z.string(), status: v4.z.string().describe("Skill status: draft, published, or archived"), activeVersionId: v4.z.string().optional(), authorId: v4.z.string().optional(), visibility: v4.z.enum(["private", "public"]).optional(), favoriteCount: v4.z.number().int().nonnegative().optional().describe("Number of users who have favorited this skill"), isFavorited: v4.z.boolean().optional().describe("Whether the requesting user has favorited this skill"), createdAt: v4.z.coerce.date(), updatedAt: v4.z.coerce.date(), name: v4.z.string().describe("Name of the skill"), description: v4.z.string().describe("Description of what the skill does and when to use it"), instructions: v4.z.string().describe("Markdown instructions for the skill"), license: v4.z.string().optional().describe("License identifier for the skill"), compatibility: v4.z.unknown().optional().describe("Compatibility requirements"), source: sourceSchema.optional().describe("Source location of the skill"), references: v4.z.array(v4.z.string()).optional().describe("List of reference file paths"), scripts: v4.z.array(v4.z.string()).optional().describe("List of script file paths"), assets: v4.z.array(v4.z.string()).optional().describe("List of asset file paths"), files: v4.z.array(fileNodeSchema).optional().describe("Full file tree structure for the skill"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Additional metadata for the skill") }); var listStoredSkillsResponseSchema = chunkDIG2K5CV_cjs.paginationInfoSchema.extend({ skills: v4.z.array(storedSkillSchema) }); var getStoredSkillResponseSchema = storedSkillSchema; var createStoredSkillResponseSchema = storedSkillSchema; var updateStoredSkillResponseSchema = v4.z.union([ v4.z.object({ id: v4.z.string(), status: v4.z.string(), activeVersionId: v4.z.string().optional(), authorId: v4.z.string().optional(), visibility: v4.z.enum(["private", "public"]).optional(), createdAt: v4.z.coerce.date(), updatedAt: v4.z.coerce.date() }), storedSkillSchema ]); var deleteStoredSkillResponseSchema = v4.z.object({ success: v4.z.boolean(), message: v4.z.string() }); var publishStoredSkillBodySchema = v4.z.object({ skillPath: v4.z.string().describe("Path to the skill directory on the server filesystem (containing SKILL.md)") }); var publishStoredSkillResponseSchema = storedSkillSchema; exports.SKILL_ORIGIN_METADATA_KEY = SKILL_ORIGIN_METADATA_KEY; exports.buildOriginMetadata = buildOriginMetadata; exports.createStoredSkillBodySchema = createStoredSkillBodySchema; exports.createStoredSkillResponseSchema = createStoredSkillResponseSchema; exports.deleteStoredSkillResponseSchema = deleteStoredSkillResponseSchema; exports.getStoredSkillResponseSchema = getStoredSkillResponseSchema; exports.listStoredSkillsQuerySchema = listStoredSkillsQuerySchema; exports.listStoredSkillsResponseSchema = listStoredSkillsResponseSchema; exports.publishStoredSkillBodySchema = publishStoredSkillBodySchema; exports.publishStoredSkillResponseSchema = publishStoredSkillResponseSchema; exports.readSkillOrigin = readSkillOrigin; exports.skillOriginSchema = skillOriginSchema; exports.storedSkillIdPathParams = storedSkillIdPathParams; exports.storedSkillSchema = storedSkillSchema; exports.updateStoredSkillBodySchema = updateStoredSkillBodySchema; exports.updateStoredSkillResponseSchema = updateStoredSkillResponseSchema; //# sourceMappingURL=chunk-T3C54LPX.cjs.map //# sourceMappingURL=chunk-T3C54LPX.cjs.map