mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 03:10:38 +09:00
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
|
|
import { z } from "zod";
|
||
|
|
|
||
|
|
export const companySkillSourceTypeSchema = z.enum(["local_path", "github", "url", "catalog"]);
|
||
|
|
export const companySkillTrustLevelSchema = z.enum(["markdown_only", "assets", "scripts_executables"]);
|
||
|
|
export const companySkillCompatibilitySchema = z.enum(["compatible", "unknown", "invalid"]);
|
||
|
|
|
||
|
|
export const companySkillFileInventoryEntrySchema = z.object({
|
||
|
|
path: z.string().min(1),
|
||
|
|
kind: z.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const companySkillSchema = z.object({
|
||
|
|
id: z.string().uuid(),
|
||
|
|
companyId: z.string().uuid(),
|
||
|
|
slug: z.string().min(1),
|
||
|
|
name: z.string().min(1),
|
||
|
|
description: z.string().nullable(),
|
||
|
|
markdown: z.string(),
|
||
|
|
sourceType: companySkillSourceTypeSchema,
|
||
|
|
sourceLocator: z.string().nullable(),
|
||
|
|
sourceRef: z.string().nullable(),
|
||
|
|
trustLevel: companySkillTrustLevelSchema,
|
||
|
|
compatibility: companySkillCompatibilitySchema,
|
||
|
|
fileInventory: z.array(companySkillFileInventoryEntrySchema).default([]),
|
||
|
|
metadata: z.record(z.unknown()).nullable(),
|
||
|
|
createdAt: z.coerce.date(),
|
||
|
|
updatedAt: z.coerce.date(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const companySkillListItemSchema = companySkillSchema.extend({
|
||
|
|
attachedAgentCount: z.number().int().nonnegative(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const companySkillUsageAgentSchema = z.object({
|
||
|
|
id: z.string().uuid(),
|
||
|
|
name: z.string().min(1),
|
||
|
|
urlKey: z.string().min(1),
|
||
|
|
adapterType: z.string().min(1),
|
||
|
|
desired: z.boolean(),
|
||
|
|
actualState: z.string().nullable(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const companySkillDetailSchema = companySkillSchema.extend({
|
||
|
|
attachedAgentCount: z.number().int().nonnegative(),
|
||
|
|
usedByAgents: z.array(companySkillUsageAgentSchema).default([]),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const companySkillImportSchema = z.object({
|
||
|
|
source: z.string().min(1),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type CompanySkillImport = z.infer<typeof companySkillImportSchema>;
|