/** Algorithm tag prefixed to every checksum so the format is self-describing. */ export declare const CHECKSUM_ALGO: "sha256"; /** * Owner-qualified provenance. `@genius-team/genius-dev` → { owner:'genius-team', * slug:'genius-dev' }. First-party skills carry the canonical GT owner; any * other owner is third-party and crosses the INSTALL frontier (GUARD-POLICY §4). */ export interface SkillProvenance { /** The `@owner` segment, without the leading `@`. */ owner: string; /** The skill slug (its directory name / frontmatter `name`). */ slug: string; /** Canonical `@owner/slug` string. */ qualified: string; } /** * A referenced file bundled with a skill (e.g. references/*.md, scripts/*.sh). * Its content participates in the checksum so a skill cannot be tampered with * by editing a reference the SKILL.md points at. */ export interface SkillReference { /** Path relative to the skill directory, POSIX-normalised. */ name: string; /** Raw file content. */ content: string; } export interface SkillCard { /** Owner-qualified provenance. */ provenance: SkillProvenance; /** Declared least-privilege permissions (see PERMISSION_SCOPES). */ permissions: string[]; /** `sha256:` over SKILL.md + sorted references. */ checksum: string; /** Number of reference files folded into the checksum (SKILL.md excluded). */ referenceCount: number; /** True when the owner is the canonical first-party Genius Team owner. */ firstParty: boolean; } /** * The canonical first-party owner. Skills resolved from the trusted GT source * (resolveGTSource) carry this owner unless a CARD.json overrides it. Anything * else is third-party and subject to the blocking INSTALL frontier. */ export declare const FIRST_PARTY_OWNER = "genius-team"; /** * The permission scopes a Skill Card may declare. Kept deliberately small and * coarse — the lint layer flags a card that declares scopes it does not need or * the broad `all`/`*` wildcard (over-broad permissions, veille P0 ClawHub). */ export declare const PERMISSION_SCOPES: readonly ["read-files", "write-files", "run-commands", "network", "secrets"]; export type PermissionScope = (typeof PERMISSION_SCOPES)[number]; /** * Parse an owner-qualified reference `@owner/slug` into its parts. Returns null * when the string is not owner-qualified (e.g. a bare `genius-dev`), so callers * can fall back to a default owner explicitly rather than guessing. */ export declare function parseOwnerQualified(ref: string): { owner: string; slug: string; } | null; /** Build the canonical `@owner/slug` string. */ export declare function formatOwnerQualified(owner: string, slug: string): string; /** * The manifest half of a Skill Card that MUST be integrity-bound to the content: * the declared permissions and the owner-qualified provenance. Folding these into * the checksum means a CARD.json cannot be edited to escalate permissions * (→ `['*']`) or flip the owner (→ a first-party `@genius-team/*`) while leaving * the checksum — and therefore `cortex doctor`'s verdict — unchanged. */ export interface SkillManifest { /** Declared permissions (normalised: de-duped + lower-cased + sorted). */ permissions: string[]; /** Owner-qualified provenance string `@owner/slug`. */ provenance: string; } /** * Compute the integrity checksum over a SKILL.md body, its referenced files, and * (when supplied) the Skill Card manifest — the declared permissions + provenance. * * Canonicalisation (so the hash is stable and order-independent): * - references are sorted by name; * - each part is framed as `:\n\n` to avoid ambiguity * between e.g. two references whose contents would otherwise concatenate * into the same byte stream (length-prefixing defeats splice attacks). * - the manifest, when present, is framed LAST under a reserved sentinel name * (`\x00CARD`) that no on-disk reference file can collide with, so permission * escalation / owner-flip in CARD.json changes the checksum. * * Returns `sha256:`. */ export declare function computeSkillChecksum(skillMd: string, references?: SkillReference[], manifest?: SkillManifest): string; /** * Resolve the provenance of a skill. Priority: * 1. An explicit owner-qualified `declaredRef` (`@owner/slug`, e.g. from a * CARD.json shipped with the skill). * 2. Otherwise the `defaultOwner` (the canonical GT owner for the trusted * source), with the skill's directory name as slug. */ export declare function resolveProvenance(slug: string, declaredRef?: string | null, defaultOwner?: string): SkillProvenance; export interface BuildSkillCardInput { /** Skill slug (directory name / frontmatter name). */ slug: string; /** Raw SKILL.md content. */ content: string; /** Referenced files bundled with the skill (optional). */ references?: SkillReference[]; /** Declared permissions (optional; defaults to empty = least privilege). */ permissions?: string[]; /** Owner-qualified ref declared by the skill (optional). */ declaredRef?: string | null; /** Owner to attribute when no owner-qualified ref is declared. */ defaultOwner?: string; } /** * Build a Skill Card from a skill's content. This is the function the Store * calls at resolution/serve time to compute-and-expose the checksum (P5-01a). */ export declare function buildSkillCard(input: BuildSkillCardInput): SkillCard; /** De-duplicate and lower-case declared permissions for stable comparison. */ export declare function normalizePermissions(permissions: string[]): string[];