From e6d5cd82ebdb6c1072e50f1034b94ca7dc24266a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 26 Mar 2026 00:24:16 -0400 Subject: [PATCH] feat(02-01): create skill type definitions and constants - SkillSourceType union with 5 source kinds (github, local_path, url, skills_sh, managed) - TrustLevel union with 3 levels (markdown_only, assets, scripts_executables) - FileInventoryEntry with 6 kind classifications - SkillRecord interface matching company_skills table columns - TOKEN_BUDGETS constant with per-adapter token caps - RuntimeSkillEntry, ManagedSkillRef, SkillAssignment, SkillUpdateStatus interfaces --- src/main/skill-types.ts | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/main/skill-types.ts diff --git a/src/main/skill-types.ts b/src/main/skill-types.ts new file mode 100644 index 00000000..43cfe4f1 --- /dev/null +++ b/src/main/skill-types.ts @@ -0,0 +1,114 @@ +// --------------------------------------------------------------------------- +// Skill system type definitions and constants +// --------------------------------------------------------------------------- + +/** + * Source type for a skill -- matches the company_skills.source_type column. + */ +export type SkillSourceType = + | "github" + | "local_path" + | "url" + | "skills_sh" + | "managed"; + +/** + * Trust level derived from the file inventory of a skill package. + * Determines what content is injected and how cautiously. + */ +export type TrustLevel = + | "markdown_only" + | "assets" + | "scripts_executables"; + +/** + * A single file entry within a skill package inventory. + */ +export interface FileInventoryEntry { + path: string; + kind: "skill" | "reference" | "script" | "asset" | "markdown" | "other"; +} + +/** + * Full row interface matching the company_skills table. + * Property names use camelCase (JS convention) even though DB columns are snake_case. + */ +export interface SkillRecord { + id: string; + companyId: string; + key: string; + slug: string; + name: string; + description: string | null; + markdown: string; + sourceType: SkillSourceType; + sourceLocator: string | null; + sourceRef: string | null; + trustLevel: TrustLevel; + compatibility: string; + fileInventory: FileInventoryEntry[]; + metadata: Record | null; + createdAt: string; + updatedAt: string; +} + +/** + * Result returned after importing or updating a skill. + */ +export interface SkillImportResult { + skillId: string; + key: string; + name: string; + isUpdate: boolean; +} + +/** + * Runtime representation of a skill entry for adapter injection. + */ +export interface RuntimeSkillEntry { + runtimeName: string; + sourcePath: string; + name: string; + tokenEstimate: number; +} + +/** + * Minimal skill reference passed to worker threads. + * Subset of RuntimeSkillEntry to minimize serialization overhead. + */ +export interface ManagedSkillRef { + runtimeName: string; + sourcePath: string; +} + +/** + * Skill-to-agent assignment record. + */ +export interface SkillAssignment { + agentId: string; + skillId: string; +} + +/** + * Update status for a skill -- used to check if a newer version is available. + */ +export interface SkillUpdateStatus { + skillId: string; + key: string; + currentRef: string | null; + latestRef: string | null; + hasUpdate: boolean; +} + +/** + * Per-adapter token budgets for skill content injection. + * Values represent the maximum token count of skill content that can be + * included in a single prompt for each adapter type. + */ +export const TOKEN_BUDGETS: Readonly> = { + claude_local: 50000, + codex_local: 30000, + gemini_local: 50000, + opencode_local: 30000, + kimi_local: 20000, +};