@graphorin/skills 0.5.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +169 -0
  4. package/anthropic-spec-snapshot.json +114 -0
  5. package/dist/activation/index.d.ts +30 -0
  6. package/dist/activation/index.d.ts.map +1 -0
  7. package/dist/activation/index.js +71 -0
  8. package/dist/activation/index.js.map +1 -0
  9. package/dist/errors/index.d.ts +110 -0
  10. package/dist/errors/index.d.ts.map +1 -0
  11. package/dist/errors/index.js +126 -0
  12. package/dist/errors/index.js.map +1 -0
  13. package/dist/frontmatter/index.d.ts +120 -0
  14. package/dist/frontmatter/index.d.ts.map +1 -0
  15. package/dist/frontmatter/index.js +451 -0
  16. package/dist/frontmatter/index.js.map +1 -0
  17. package/dist/index.d.ts +52 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +51 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/loader/index.d.ts +55 -0
  22. package/dist/loader/index.d.ts.map +1 -0
  23. package/dist/loader/index.js +463 -0
  24. package/dist/loader/index.js.map +1 -0
  25. package/dist/migration/index.d.ts +62 -0
  26. package/dist/migration/index.d.ts.map +1 -0
  27. package/dist/migration/index.js +131 -0
  28. package/dist/migration/index.js.map +1 -0
  29. package/dist/registry/bridge.d.ts +47 -0
  30. package/dist/registry/bridge.d.ts.map +1 -0
  31. package/dist/registry/bridge.js +91 -0
  32. package/dist/registry/bridge.js.map +1 -0
  33. package/dist/registry/index.d.ts +140 -0
  34. package/dist/registry/index.d.ts.map +1 -0
  35. package/dist/registry/index.js +193 -0
  36. package/dist/registry/index.js.map +1 -0
  37. package/dist/spec/index.d.ts +92 -0
  38. package/dist/spec/index.d.ts.map +1 -0
  39. package/dist/spec/index.js +105 -0
  40. package/dist/spec/index.js.map +1 -0
  41. package/dist/types/index.d.ts +305 -0
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/package.json +104 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["parsed: unknown","parseYaml","conflictingSources: string[]","conflictPolicy: FrontmatterValidatorPolicy","unknownFieldPolicy: UnknownFieldPolicy","diagnostics: FrontmatterDiagnostic[]","severity: 'warn' | 'error'","steps: HandoffInputFilterStep[]","out: SkillToolDeclaration[]","declaration: Mutable<SkillToolDeclaration>","target"],"sources":["../../src/frontmatter/index.ts"],"sourcesContent":["/**\n * Frontmatter validator for `SKILL.md` files.\n *\n * Implements the field-resolution algorithm from ADR-043:\n *\n * 1. Anthropic-base (top-level, no prefix) — highest priority.\n * 2. `metadata.graphorin.<field>` bucket per upstream `metadata`\n * convention.\n * 3. `graphorin-<field>` legacy top-level prefix.\n * 4. caller-supplied fallback.\n *\n * The validator surfaces every diagnostic through the typed\n * {@link FrontmatterDiagnostic} contract so callers can decide whether\n * to log, fail, or escalate without re-parsing human strings.\n *\n * @packageDocumentation\n */\n\nimport { parse as parseYaml } from 'yaml';\n\nimport { SkillManifestParseError } from '../errors/index.js';\nimport {\n compareAuthorSpecHint,\n getGraphorinMapping,\n getKnownField,\n getSpecSnapshot,\n} from '../spec/index.js';\nimport type {\n FieldResolution,\n FrontmatterDiagnostic,\n FrontmatterValidatorPolicy,\n HandoffInputFilterDeclaration,\n HandoffInputFilterStep,\n SkillToolDeclaration,\n UnknownFieldPolicy,\n} from '../types/index.js';\n\n/** Result of {@link splitSkillMd}. */\nexport interface SplitSkillMd {\n readonly frontmatter: string;\n readonly body: string;\n}\n\n/**\n * Split a raw SKILL.md string into the YAML frontmatter and the\n * markdown body. The frontmatter delimiter is the canonical\n * `---\\n…\\n---\\n` pair.\n *\n * @stable\n */\nexport function splitSkillMd(skillMd: string): SplitSkillMd {\n const normalized = skillMd.replace(/^\\uFEFF/u, '').replace(/\\r\\n/g, '\\n');\n const match = /^---\\n([\\s\\S]*?)\\n---\\n?([\\s\\S]*)$/u.exec(normalized);\n if (match === null) {\n throw new SkillManifestParseError(\n 'SKILL.md must begin with a YAML frontmatter block delimited by `---` lines.',\n );\n }\n return { frontmatter: match[1] ?? '', body: match[2] ?? '' };\n}\n\n/**\n * Parse the YAML frontmatter into a record. Returns `{}` for an empty\n * block.\n *\n * @stable\n */\nexport function parseFrontmatterYaml(frontmatter: string): Record<string, unknown> {\n if (frontmatter.trim().length === 0) return {};\n let parsed: unknown;\n try {\n parsed = parseYaml(frontmatter);\n } catch (err) {\n throw new SkillManifestParseError('SKILL.md frontmatter is not valid YAML.', { cause: err });\n }\n if (parsed === null || parsed === undefined) return {};\n if (typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new SkillManifestParseError(\n `Top-level SKILL.md frontmatter must be an object; got '${Array.isArray(parsed) ? 'array' : typeof parsed}'.`,\n );\n }\n return parsed as Record<string, unknown>;\n}\n\n/**\n * Resolve a single field across the four field-resolution tiers.\n * Returns the resolved value plus the source tier the value came from\n * AND the list of conflicting source names so the validator can\n * surface a structured diagnostic.\n *\n * @stable\n */\nexport function resolveSkillField<T = unknown>(\n frontmatter: Record<string, unknown>,\n field: string,\n fallback?: T,\n): FieldResolution<T> {\n const conflictingSources: string[] = [];\n const presentInBase = field in frontmatter;\n const meta = frontmatter.metadata;\n const presentInMeta =\n meta !== undefined &&\n meta !== null &&\n typeof meta === 'object' &&\n !Array.isArray(meta) &&\n `graphorin.${field}` in (meta as Record<string, unknown>);\n const presentInPrefix = `graphorin-${field}` in frontmatter;\n if (presentInBase) conflictingSources.push(field);\n if (presentInMeta) conflictingSources.push(`metadata.graphorin.${field}`);\n if (presentInPrefix) conflictingSources.push(`graphorin-${field}`);\n const conflicting = conflictingSources.length > 1;\n\n if (presentInBase) {\n return Object.freeze({\n value: frontmatter[field] as T,\n source: 'anthropic-base' as const,\n conflicting,\n conflictingSources,\n });\n }\n if (presentInMeta) {\n return Object.freeze({\n value: (meta as Record<string, unknown>)[`graphorin.${field}`] as T,\n source: 'metadata-graphorin' as const,\n conflicting,\n conflictingSources,\n });\n }\n if (presentInPrefix) {\n return Object.freeze({\n value: frontmatter[`graphorin-${field}`] as T,\n source: 'graphorin-prefix' as const,\n conflicting,\n conflictingSources,\n });\n }\n return Object.freeze({\n value: fallback,\n source: 'fallback' as const,\n conflicting: false,\n conflictingSources: [],\n });\n}\n\n/**\n * Options accepted by {@link validateFrontmatter}.\n *\n * @stable\n */\nexport interface ValidateFrontmatterOptions {\n /** Policy for direct collisions (Anthropic-base + `graphorin-*`). */\n readonly conflictPolicy?: FrontmatterValidatorPolicy;\n /** Policy for fields not part of the bundled snapshot or `graphorin-*` catalogue. */\n readonly unknownFieldPolicy?: UnknownFieldPolicy;\n /**\n * Installed Graphorin runtime version. Used to validate\n * `graphorin-runtime-compat` declarations against the running\n * framework.\n */\n readonly runtimeVersion?: string;\n}\n\n/** Successful return of {@link validateFrontmatter}. */\nexport interface ValidatedFrontmatter {\n readonly raw: Readonly<Record<string, unknown>>;\n readonly diagnostics: ReadonlyArray<FrontmatterDiagnostic>;\n readonly resolved: {\n readonly name: FieldResolution<unknown>;\n readonly description: FieldResolution<unknown>;\n readonly license: FieldResolution<unknown>;\n readonly compatibility: FieldResolution<unknown>;\n readonly metadata: FieldResolution<unknown>;\n readonly allowedTools: FieldResolution<unknown>;\n readonly disableModelInvocation: FieldResolution<unknown>;\n readonly trustLevel: FieldResolution<unknown>;\n readonly runtimeCompat: FieldResolution<unknown>;\n readonly sensitivity: FieldResolution<unknown>;\n readonly sensitivityDefaults: FieldResolution<unknown>;\n readonly sandbox: FieldResolution<unknown>;\n readonly handoffInputFilter: FieldResolution<unknown>;\n readonly anthropicSpec: FieldResolution<unknown>;\n readonly version: FieldResolution<unknown>;\n readonly tools: FieldResolution<unknown>;\n };\n}\n\n/**\n * Validate a parsed frontmatter against the bundled spec snapshot and\n * the `graphorin-*` extension catalogue.\n *\n * @stable\n */\nexport function validateFrontmatter(\n frontmatter: Record<string, unknown>,\n options: ValidateFrontmatterOptions = {},\n): ValidatedFrontmatter {\n const conflictPolicy: FrontmatterValidatorPolicy = options.conflictPolicy ?? 'warn';\n const unknownFieldPolicy: UnknownFieldPolicy = options.unknownFieldPolicy ?? 'preserve';\n const diagnostics: FrontmatterDiagnostic[] = [];\n\n const resolveAndDiag = <T = unknown>(field: string, fallback?: T): FieldResolution<T> => {\n const resolution = resolveSkillField<T>(frontmatter, field, fallback);\n if (resolution.conflicting) {\n const message =\n `Both '${resolution.conflictingSources.join(\"' and '\")}' are set for '${field}'. ` +\n `The Anthropic-base / metadata.graphorin.* tier wins; remove the lower-priority field to silence this diagnostic.`;\n const hint = `Keep the highest-priority entry: '${resolution.source === 'anthropic-base' ? field : resolution.source === 'metadata-graphorin' ? `metadata.graphorin.${field}` : `graphorin-${field}`}'.`;\n const severity: 'warn' | 'error' = conflictPolicy === 'error' ? 'error' : 'warn';\n if (conflictPolicy !== 'silent') {\n diagnostics.push(\n Object.freeze({\n kind: 'conflict',\n field,\n severity,\n message,\n hint,\n }),\n );\n }\n }\n return resolution;\n };\n\n const name = resolveAndDiag<string>('name');\n const description = resolveAndDiag<string>('description');\n const license = resolveAndDiag<string>('license');\n const compatibility = resolveAndDiag<string>('compatibility');\n const metadata = resolveAndDiag<Record<string, unknown>>('metadata');\n const allowedTools = resolveAndDiag<unknown>('allowed-tools');\n const disableModelInvocation = resolveAndDiag<boolean>('disable-model-invocation', false);\n const trustLevel = resolveAndDiag<string>('trust-level');\n const runtimeCompat = resolveAndDiag<string>('runtime-compat');\n // The graphorin-only `version` field carries runtime-compat semantics; the\n // Anthropic-base `metadata.version` is the skill's own version. We honour\n // both — the loader uses `runtimeCompat` for compat, `version` for\n // graphorin-runtime-compat-as-version aliasing.\n const version = resolveAndDiag<string>('version');\n const sensitivity = resolveAndDiag<string>('sensitivity');\n const sensitivityDefaults = resolveAndDiag<Record<string, string>>('sensitivity-defaults');\n const sandbox = resolveAndDiag<Record<string, unknown>>('sandbox');\n const handoffInputFilter = resolveAndDiag<unknown>('handoff-input-filter');\n const anthropicSpec = resolveAndDiag<string>('anthropic-spec');\n const tools = resolveAndDiag<unknown>('tools');\n\n if (typeof name.value !== 'string' || name.value.trim().length === 0) {\n diagnostics.push(\n Object.freeze({\n kind: 'missing-required-field',\n field: 'name',\n severity: 'error',\n message: \"Required field 'name' is missing or empty.\",\n hint: \"Add a unique 'name' (kebab-case is conventional) to the SKILL.md frontmatter.\",\n }),\n );\n }\n if (typeof description.value !== 'string' || description.value.trim().length === 0) {\n diagnostics.push(\n Object.freeze({\n kind: 'missing-required-field',\n field: 'description',\n severity: 'error',\n message: \"Required field 'description' is missing or empty.\",\n hint: 'Add a description that explains when the model should activate the skill.',\n }),\n );\n }\n if (allowedTools.value !== undefined) {\n const list = parseAllowedToolsValue(allowedTools.value);\n if (list === null) {\n diagnostics.push(\n Object.freeze({\n kind: 'invalid-field-type',\n field: 'allowed-tools',\n severity: 'warn',\n message:\n \"'allowed-tools' must be a string ('read_file write_file') or an array (['read_file', 'write_file']).\",\n hint: 'Switch to one of the two supported shapes; entries are split on whitespace for the string form.',\n }),\n );\n }\n }\n if (\n allowedTools.value !== undefined &&\n getKnownField('allowed-tools')?.stability === 'experimental'\n ) {\n diagnostics.push(\n Object.freeze({\n kind: 'experimental-field',\n field: 'allowed-tools',\n severity: 'info',\n message:\n \"'allowed-tools' is marked experimental in the bundled spec snapshot; behaviour may evolve.\",\n }),\n );\n }\n if (anthropicSpec.value !== undefined && typeof anthropicSpec.value === 'string') {\n const compare = compareAuthorSpecHint(anthropicSpec.value);\n if (compare === 'newer') {\n diagnostics.push(\n Object.freeze({\n kind: 'spec-newer-than-loader',\n field: 'anthropic-spec',\n severity: 'warn',\n message: `Skill targets spec snapshot '${anthropicSpec.value}', newer than the bundled '${getSpecSnapshot().snapshotDate}'. Unknown fields will be preserved leniently.`,\n }),\n );\n } else if (compare === 'older') {\n diagnostics.push(\n Object.freeze({\n kind: 'spec-older-than-loader',\n field: 'anthropic-spec',\n severity: 'info',\n message: `Skill targets spec snapshot '${anthropicSpec.value}', older than the bundled '${getSpecSnapshot().snapshotDate}'.`,\n }),\n );\n } else if (compare === 'unparseable') {\n diagnostics.push(\n Object.freeze({\n kind: 'invalid-field-type',\n field: 'anthropic-spec',\n severity: 'warn',\n message: `'anthropic-spec' must be an ISO-8601 date string (YYYY-MM-DD); got '${String(anthropicSpec.value)}'.`,\n }),\n );\n }\n }\n if (\n runtimeCompat.value !== undefined &&\n typeof runtimeCompat.value === 'string' &&\n options.runtimeVersion !== undefined\n ) {\n if (!isRuntimeCompatSatisfied(runtimeCompat.value, options.runtimeVersion)) {\n diagnostics.push(\n Object.freeze({\n kind: 'invalid-runtime-compat',\n field: 'runtime-compat',\n severity: 'error',\n message: `Skill declares runtime-compat '${runtimeCompat.value}' which does not match installed Graphorin '${options.runtimeVersion}'.`,\n hint: 'Adjust the skill or upgrade Graphorin so the declared range covers the installed version.',\n }),\n );\n }\n }\n for (const key of Object.keys(frontmatter)) {\n if (isRecognisedField(key)) continue;\n if (key.startsWith('graphorin-')) {\n // `graphorin-*` fields not in the mapping table are tolerated as\n // opaque metadata per Phase 08 § Frontmatter validator. Emit a\n // single info-level diagnostic so loaders can surface them.\n if (unknownFieldPolicy === 'reject') {\n diagnostics.push(\n Object.freeze({\n kind: 'unknown-field',\n field: key,\n severity: 'error',\n message: `Unknown 'graphorin-*' field '${key}' rejected by unknownFieldPolicy='reject'.`,\n }),\n );\n } else if (unknownFieldPolicy === 'warn') {\n diagnostics.push(\n Object.freeze({\n kind: 'unknown-field',\n field: key,\n severity: 'warn',\n message: `Unknown 'graphorin-*' field '${key}'. Will be preserved as opaque metadata.`,\n }),\n );\n }\n continue;\n }\n if (unknownFieldPolicy === 'reject') {\n diagnostics.push(\n Object.freeze({\n kind: 'unknown-field',\n field: key,\n severity: 'error',\n message: `Unknown frontmatter field '${key}' rejected by unknownFieldPolicy='reject'.`,\n }),\n );\n } else if (unknownFieldPolicy === 'warn') {\n diagnostics.push(\n Object.freeze({\n kind: 'unknown-field',\n field: key,\n severity: 'warn',\n message: `Unknown frontmatter field '${key}'. Will be preserved as opaque metadata.`,\n }),\n );\n }\n }\n\n return Object.freeze({\n raw: Object.freeze({ ...frontmatter }),\n diagnostics: Object.freeze(diagnostics),\n resolved: Object.freeze({\n name,\n description,\n license,\n compatibility,\n metadata,\n allowedTools,\n disableModelInvocation,\n trustLevel,\n runtimeCompat,\n sensitivity,\n sensitivityDefaults,\n sandbox,\n handoffInputFilter,\n anthropicSpec,\n version,\n tools,\n }),\n });\n}\n\n/**\n * Parse the `allowed-tools` field. Accepts either a string (with\n * whitespace-separated entries) or a string array. Returns `null` for\n * unsupported shapes so the validator can attach a typed diagnostic.\n *\n * @stable\n */\nexport function parseAllowedToolsValue(value: unknown): ReadonlyArray<string> | null {\n if (Array.isArray(value)) {\n if (!value.every((entry) => typeof entry === 'string' && entry.trim().length > 0)) {\n return null;\n }\n return Object.freeze(value.map((entry) => entry.trim()) as string[]);\n }\n if (typeof value === 'string') {\n const tokens = value\n .split(/\\s+/u)\n .map((tok) => tok.trim())\n .filter((tok) => tok.length > 0);\n if (tokens.length === 0) return null;\n return Object.freeze(tokens);\n }\n return null;\n}\n\n/**\n * Parse the `handoff-input-filter` field into a structured\n * declaration. Returns `null` for unsupported shapes; callers should\n * attach a diagnostic when the return value is `null` and the source\n * value was non-undefined.\n *\n * @stable\n */\nexport function parseHandoffInputFilter(value: unknown): HandoffInputFilterDeclaration | null {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed === 'lastUser') return Object.freeze({ kind: 'lastUser' });\n if (trimmed === 'summary') return Object.freeze({ kind: 'summary' });\n if (trimmed === 'full') return Object.freeze({ kind: 'full' });\n const lastN = /^lastN-(\\d+)$/u.exec(trimmed);\n if (lastN !== null) {\n const n = Number.parseInt(lastN[1] ?? '0', 10);\n if (Number.isFinite(n) && n > 0) return Object.freeze({ kind: 'lastN', n });\n }\n return null;\n }\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n const obj = value as Record<string, unknown>;\n if (Array.isArray(obj.compose)) {\n const steps: HandoffInputFilterStep[] = [];\n for (const raw of obj.compose) {\n const step = parseHandoffInputFilterStep(raw);\n if (step === null) return null;\n steps.push(step);\n }\n return Object.freeze({ kind: 'compose', steps: Object.freeze(steps) });\n }\n }\n return null;\n}\n\nfunction parseHandoffInputFilterStep(raw: unknown): HandoffInputFilterStep | null {\n if (typeof raw === 'string') {\n if (raw === 'lastUser') return Object.freeze({ kind: 'lastUser' });\n if (raw === 'summary') return Object.freeze({ kind: 'summary' });\n if (raw === 'stripReasoning') return Object.freeze({ kind: 'stripReasoning' });\n return null;\n }\n if (raw !== null && typeof raw === 'object' && !Array.isArray(raw)) {\n const obj = raw as Record<string, unknown>;\n if (typeof obj.lastN === 'number' && Number.isFinite(obj.lastN) && obj.lastN > 0) {\n return Object.freeze({ kind: 'lastN', n: obj.lastN });\n }\n if (\n obj.stripSensitiveOutputs !== undefined &&\n typeof obj.stripSensitiveOutputs === 'object' &&\n obj.stripSensitiveOutputs !== null\n ) {\n const inner = obj.stripSensitiveOutputs as Record<string, unknown>;\n const keepTier = typeof inner.keepTier === 'string' ? inner.keepTier : undefined;\n return Object.freeze({\n kind: 'stripSensitiveOutputs',\n ...(keepTier === undefined ? {} : { keepTier }),\n });\n }\n if (typeof obj.lastUser === 'boolean') return Object.freeze({ kind: 'lastUser' });\n if (typeof obj.summary === 'boolean') return Object.freeze({ kind: 'summary' });\n if (typeof obj.stripReasoning === 'boolean') return Object.freeze({ kind: 'stripReasoning' });\n }\n return null;\n}\n\n/**\n * Parse the `tools` field. Accepts either an array of strings (tool\n * names — the loader resolves modules through naming convention) or\n * an array of objects with `name`, `module`, `description`, `tags`.\n * Returns `null` for unsupported shapes.\n *\n * @stable\n */\nexport function parseToolsField(value: unknown): ReadonlyArray<SkillToolDeclaration> | null {\n if (!Array.isArray(value)) return null;\n const out: SkillToolDeclaration[] = [];\n for (const entry of value) {\n if (typeof entry === 'string') {\n if (entry.trim().length === 0) return null;\n out.push(Object.freeze({ name: entry.trim() }));\n continue;\n }\n if (entry !== null && typeof entry === 'object' && !Array.isArray(entry)) {\n const obj = entry as Record<string, unknown>;\n if (typeof obj.name !== 'string' || obj.name.trim().length === 0) return null;\n const declaration: Mutable<SkillToolDeclaration> = { name: obj.name.trim() };\n if (typeof obj.module === 'string' && obj.module.trim().length > 0)\n declaration.module = obj.module.trim();\n if (typeof obj.description === 'string') declaration.description = obj.description;\n if (Array.isArray(obj.tags) && obj.tags.every((t) => typeof t === 'string')) {\n declaration.tags = Object.freeze([...(obj.tags as string[])]);\n }\n out.push(Object.freeze(declaration as SkillToolDeclaration));\n continue;\n }\n return null;\n }\n return Object.freeze(out);\n}\n\n/**\n * Best-effort semver-range satisfaction check. Supports the patterns\n * the framework actually emits (`^x.y.z`, `~x.y.z`, `>=x.y.z`,\n * `>x.y.z`, `<=x.y.z`, `<x.y.z`, plain `x.y.z`, the AND combinator\n * with whitespace) without pulling a runtime dependency on `semver`.\n * Unrecognised inputs return `false` so the validator emits a typed\n * diagnostic.\n *\n * @stable\n */\nexport function isRuntimeCompatSatisfied(range: string, version: string): boolean {\n const versionTuple = parseSemver(version);\n if (versionTuple === null) return false;\n const expressions = range.split(/\\s+/u).filter((seg) => seg.length > 0);\n for (const expression of expressions) {\n if (!evaluateSemverExpression(expression, versionTuple)) return false;\n }\n return true;\n}\n\nfunction evaluateSemverExpression(\n expression: string,\n version: readonly [number, number, number],\n): boolean {\n if (expression.startsWith('^')) {\n const target = parseSemver(expression.slice(1));\n if (target === null) return false;\n if (target[0] === 0 && target[1] === 0) {\n return version[0] === 0 && version[1] === 0 && version[2] === target[2];\n }\n if (target[0] === 0) {\n return version[0] === 0 && version[1] === target[1] && cmpTuple(version, target) >= 0;\n }\n return version[0] === target[0] && cmpTuple(version, target) >= 0;\n }\n if (expression.startsWith('~')) {\n const target = parseSemver(expression.slice(1));\n if (target === null) return false;\n return version[0] === target[0] && version[1] === target[1] && cmpTuple(version, target) >= 0;\n }\n if (expression.startsWith('>=')) {\n const target = parseSemver(expression.slice(2));\n return target !== null && cmpTuple(version, target) >= 0;\n }\n if (expression.startsWith('>')) {\n const target = parseSemver(expression.slice(1));\n return target !== null && cmpTuple(version, target) > 0;\n }\n if (expression.startsWith('<=')) {\n const target = parseSemver(expression.slice(2));\n return target !== null && cmpTuple(version, target) <= 0;\n }\n if (expression.startsWith('<')) {\n const target = parseSemver(expression.slice(1));\n return target !== null && cmpTuple(version, target) < 0;\n }\n if (expression === '*') return true;\n const target = parseSemver(expression);\n return target !== null && cmpTuple(version, target) === 0;\n}\n\nfunction parseSemver(value: string): [number, number, number] | null {\n const trimmed = value.trim();\n // Strip optional `v` prefix and any pre-release / build metadata —\n // we only care about the canonical `MAJOR.MINOR.PATCH` triple.\n const stripped = trimmed.replace(/^v/u, '').split(/[-+]/u, 1)[0] ?? '';\n const parts = stripped.split('.');\n if (parts.length < 1 || parts.length > 3) return null;\n const [major, minor, patch] = [parts[0] ?? '0', parts[1] ?? '0', parts[2] ?? '0'];\n if (!/^\\d+$/u.test(major) || !/^\\d+$/u.test(minor) || !/^\\d+$/u.test(patch)) return null;\n return [Number.parseInt(major, 10), Number.parseInt(minor, 10), Number.parseInt(patch, 10)];\n}\n\nfunction cmpTuple(\n a: readonly [number, number, number],\n b: readonly [number, number, number],\n): number {\n if (a[0] !== b[0]) return a[0] - b[0];\n if (a[1] !== b[1]) return a[1] - b[1];\n return a[2] - b[2];\n}\n\nfunction isRecognisedField(field: string): boolean {\n if (getKnownField(field) !== undefined) return true;\n if (getGraphorinMapping(field) !== undefined) return true;\n if (field === 'metadata') return true;\n return false;\n}\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,aAAa,SAA+B;CAC1D,MAAM,aAAa,QAAQ,QAAQ,YAAY,GAAG,CAAC,QAAQ,SAAS,KAAK;CACzE,MAAM,QAAQ,sCAAsC,KAAK,WAAW;AACpE,KAAI,UAAU,KACZ,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KAAK,MAAM,SAAS,EAAG,QAAO;CACjD,MAAM,CAAC,OAAO,OAAO,SAAS;EAAC,MAAM,MAAM;EAAK,MAAM,MAAM;EAAK,MAAM,MAAM;EAAI;AACjF,KAAI,CAAC,SAAS,KAAK,MAAM,IAAI,CAAC,SAAS,KAAK,MAAM,IAAI,CAAC,SAAS,KAAK,MAAM,CAAE,QAAO;AACpF,QAAO;EAAC,OAAO,SAAS,OAAO,GAAG;EAAE,OAAO,SAAS,OAAO,GAAG;EAAE,OAAO,SAAS,OAAO,GAAG;EAAC;;AAG7F,SAAS,SACP,GACA,GACQ;AACR,KAAI,EAAE,OAAO,EAAE,GAAI,QAAO,EAAE,KAAK,EAAE;AACnC,KAAI,EAAE,OAAO,EAAE,GAAI,QAAO,EAAE,KAAK,EAAE;AACnC,QAAO,EAAE,KAAK,EAAE;;AAGlB,SAAS,kBAAkB,OAAwB;AACjD,KAAI,cAAc,MAAM,KAAK,OAAW,QAAO;AAC/C,KAAI,oBAAoB,MAAM,KAAK,OAAW,QAAO;AACrD,KAAI,UAAU,WAAY,QAAO;AACjC,QAAO"}
@@ -0,0 +1,52 @@
1
+ import { ActivatedSkill, FieldResolution, FrontmatterDiagnostic, FrontmatterValidatorPolicy, HandoffInputFilterDeclaration, HandoffInputFilterStep, InlineSkill, InlineSkillTool, ResolvedSkillTrustPolicy, Skill, SkillMetadata, SkillResource, SkillSignatureVerificationResult, SkillSource, SkillToolDeclaration, SkillTrustLevel, SkillTrustLevelValue, SkillsTrustLevel, SlashCommandActivation, SupplyChainSkillSource, UnknownFieldPolicy } from "./types/index.js";
2
+ import { isSlashCommand, parseSlashCommand } from "./activation/index.js";
3
+ import { GraphorinSkillsError, GraphorinSkillsErrorKind, InputFilterRequiredError, SkillFrontmatterConflictError, SkillLoadError, SkillManifestParseError, SkillNameCollisionError, SkillRequiredFieldMissingError, SkillRuntimeCompatError, SlashCommandParseError } from "./errors/index.js";
4
+ import { SplitSkillMd, ValidateFrontmatterOptions, ValidatedFrontmatter, isRuntimeCompatSatisfied, parseAllowedToolsValue, parseFrontmatterYaml, parseHandoffInputFilter, parseToolsField, resolveSkillField, splitSkillMd, validateFrontmatter } from "./frontmatter/index.js";
5
+ import { LoadSkillOptions, LoadSkillsOptions, loadSkillFromSource, loadSkills, requireHandoffInputFilter } from "./loader/index.js";
6
+ import { MigrateFrontmatterOptions, MigrationResult, MigrationRewrite, migrateFrontmatter, sortKeysAnthropicFirst } from "./migration/index.js";
7
+ import { StampedSkillTool, stampSkillTool, stampSkillToolFromMetadata } from "./registry/bridge.js";
8
+ import { ActivationRequest, ParsedActivationTrigger, RegisteredToolDeclaration, SkillRegistry, SkillRegistryOptions, SkillToolStamper, createSkillRegistry, parseActivationTrigger } from "./registry/index.js";
9
+ import { FieldStability, GraphorinFieldPolicy, GraphorinMappingEntry, KnownFieldEntry, SpecSnapshot, _setSpecSnapshotForTesting, compareAuthorSpecHint, getGraphorinMapping, getKnownField, getSpecSnapshot } from "./spec/index.js";
10
+
11
+ //#region src/index.d.ts
12
+
13
+ /**
14
+ * `@graphorin/skills` — skills surface for the Graphorin framework.
15
+ *
16
+ * The package owns:
17
+ *
18
+ * - `SKILL.md` loader with three-tier progressive disclosure
19
+ * (metadata always available; body and resources lazy-loaded).
20
+ * - Frontmatter validator implementing the field-resolution
21
+ * algorithm and conflict policy from ADR-043.
22
+ * - Bundled snapshot of the publicly published `SKILL.md` packaging-
23
+ * format specification + the framework-specific extension
24
+ * catalogue.
25
+ * - Slash-command parser (`/skill:<name>`) + auto-activation
26
+ * metadata generator.
27
+ * - `SkillRegistry` with name-collision detection, activation
28
+ * resolution, and a typed tool-declaration surface the agent
29
+ * runtime bridges into the `@graphorin/tools` registry.
30
+ * - Idempotent `migrateFrontmatter` library that rewrites legacy
31
+ * `graphorin-*` fields onto their upstream equivalents per the
32
+ * bundled mapping table.
33
+ *
34
+ * Stable sub-paths:
35
+ *
36
+ * ```ts
37
+ * import { loadSkills, loadSkillFromSource } from '@graphorin/skills/loader';
38
+ * import { createSkillRegistry } from '@graphorin/skills/registry';
39
+ * import { validateFrontmatter, resolveSkillField } from '@graphorin/skills/frontmatter';
40
+ * import { migrateFrontmatter } from '@graphorin/skills/migration';
41
+ * import { parseSlashCommand } from '@graphorin/skills/activation';
42
+ * import { getSpecSnapshot, getKnownField } from '@graphorin/skills/spec';
43
+ * import { SkillFrontmatterConflictError } from '@graphorin/skills/errors';
44
+ * ```
45
+ *
46
+ * @packageDocumentation
47
+ */
48
+ /** Canonical version constant. Mirrors the `package.json` version. */
49
+ declare const VERSION = "0.5.0";
50
+ //#endregion
51
+ export { ActivatedSkill, ActivationRequest, FieldResolution, FieldStability, FrontmatterDiagnostic, FrontmatterValidatorPolicy, GraphorinFieldPolicy, GraphorinMappingEntry, GraphorinSkillsError, GraphorinSkillsErrorKind, HandoffInputFilterDeclaration, HandoffInputFilterStep, InlineSkill, InlineSkillTool, InputFilterRequiredError, KnownFieldEntry, LoadSkillOptions, LoadSkillsOptions, MigrateFrontmatterOptions, MigrationResult, MigrationRewrite, ParsedActivationTrigger, RegisteredToolDeclaration, ResolvedSkillTrustPolicy, Skill, SkillFrontmatterConflictError, SkillLoadError, SkillManifestParseError, SkillMetadata, SkillNameCollisionError, SkillRegistry, SkillRegistryOptions, SkillRequiredFieldMissingError, SkillResource, SkillRuntimeCompatError, SkillSignatureVerificationResult, SkillSource, SkillToolDeclaration, SkillToolStamper, SkillTrustLevel, SkillTrustLevelValue, SkillsTrustLevel, SlashCommandActivation, SlashCommandParseError, SpecSnapshot, SplitSkillMd, StampedSkillTool, SupplyChainSkillSource, UnknownFieldPolicy, VERSION, ValidateFrontmatterOptions, ValidatedFrontmatter, _setSpecSnapshotForTesting, compareAuthorSpecHint, createSkillRegistry, getGraphorinMapping, getKnownField, getSpecSnapshot, isRuntimeCompatSatisfied, isSlashCommand, loadSkillFromSource, loadSkills, migrateFrontmatter, parseActivationTrigger, parseAllowedToolsValue, parseFrontmatterYaml, parseHandoffInputFilter, parseSlashCommand, parseToolsField, requireHandoffInputFilter, resolveSkillField, sortKeysAnthropicFirst, splitSkillMd, stampSkillTool, stampSkillToolFromMetadata, validateFrontmatter };
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqCA;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import { GraphorinSkillsError, InputFilterRequiredError, SkillFrontmatterConflictError, SkillLoadError, SkillManifestParseError, SkillNameCollisionError, SkillRequiredFieldMissingError, SkillRuntimeCompatError, SlashCommandParseError } from "./errors/index.js";
2
+ import { isSlashCommand, parseSlashCommand } from "./activation/index.js";
3
+ import { _setSpecSnapshotForTesting, compareAuthorSpecHint, getGraphorinMapping, getKnownField, getSpecSnapshot } from "./spec/index.js";
4
+ import { isRuntimeCompatSatisfied, parseAllowedToolsValue, parseFrontmatterYaml, parseHandoffInputFilter, parseToolsField, resolveSkillField, splitSkillMd, validateFrontmatter } from "./frontmatter/index.js";
5
+ import { loadSkillFromSource, loadSkills, requireHandoffInputFilter } from "./loader/index.js";
6
+ import { migrateFrontmatter, sortKeysAnthropicFirst } from "./migration/index.js";
7
+ import { stampSkillTool, stampSkillToolFromMetadata } from "./registry/bridge.js";
8
+ import { createSkillRegistry, parseActivationTrigger } from "./registry/index.js";
9
+
10
+ //#region src/index.ts
11
+ /**
12
+ * `@graphorin/skills` — skills surface for the Graphorin framework.
13
+ *
14
+ * The package owns:
15
+ *
16
+ * - `SKILL.md` loader with three-tier progressive disclosure
17
+ * (metadata always available; body and resources lazy-loaded).
18
+ * - Frontmatter validator implementing the field-resolution
19
+ * algorithm and conflict policy from ADR-043.
20
+ * - Bundled snapshot of the publicly published `SKILL.md` packaging-
21
+ * format specification + the framework-specific extension
22
+ * catalogue.
23
+ * - Slash-command parser (`/skill:<name>`) + auto-activation
24
+ * metadata generator.
25
+ * - `SkillRegistry` with name-collision detection, activation
26
+ * resolution, and a typed tool-declaration surface the agent
27
+ * runtime bridges into the `@graphorin/tools` registry.
28
+ * - Idempotent `migrateFrontmatter` library that rewrites legacy
29
+ * `graphorin-*` fields onto their upstream equivalents per the
30
+ * bundled mapping table.
31
+ *
32
+ * Stable sub-paths:
33
+ *
34
+ * ```ts
35
+ * import { loadSkills, loadSkillFromSource } from '@graphorin/skills/loader';
36
+ * import { createSkillRegistry } from '@graphorin/skills/registry';
37
+ * import { validateFrontmatter, resolveSkillField } from '@graphorin/skills/frontmatter';
38
+ * import { migrateFrontmatter } from '@graphorin/skills/migration';
39
+ * import { parseSlashCommand } from '@graphorin/skills/activation';
40
+ * import { getSpecSnapshot, getKnownField } from '@graphorin/skills/spec';
41
+ * import { SkillFrontmatterConflictError } from '@graphorin/skills/errors';
42
+ * ```
43
+ *
44
+ * @packageDocumentation
45
+ */
46
+ /** Canonical version constant. Mirrors the `package.json` version. */
47
+ const VERSION = "0.5.0";
48
+
49
+ //#endregion
50
+ export { GraphorinSkillsError, InputFilterRequiredError, SkillFrontmatterConflictError, SkillLoadError, SkillManifestParseError, SkillNameCollisionError, SkillRequiredFieldMissingError, SkillRuntimeCompatError, SlashCommandParseError, VERSION, _setSpecSnapshotForTesting, compareAuthorSpecHint, createSkillRegistry, getGraphorinMapping, getKnownField, getSpecSnapshot, isRuntimeCompatSatisfied, isSlashCommand, loadSkillFromSource, loadSkills, migrateFrontmatter, parseActivationTrigger, parseAllowedToolsValue, parseFrontmatterYaml, parseHandoffInputFilter, parseSlashCommand, parseToolsField, requireHandoffInputFilter, resolveSkillField, sortKeysAnthropicFirst, splitSkillMd, stampSkillTool, stampSkillToolFromMetadata, validateFrontmatter };
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@graphorin/skills` — skills surface for the Graphorin framework.\n *\n * The package owns:\n *\n * - `SKILL.md` loader with three-tier progressive disclosure\n * (metadata always available; body and resources lazy-loaded).\n * - Frontmatter validator implementing the field-resolution\n * algorithm and conflict policy from ADR-043.\n * - Bundled snapshot of the publicly published `SKILL.md` packaging-\n * format specification + the framework-specific extension\n * catalogue.\n * - Slash-command parser (`/skill:<name>`) + auto-activation\n * metadata generator.\n * - `SkillRegistry` with name-collision detection, activation\n * resolution, and a typed tool-declaration surface the agent\n * runtime bridges into the `@graphorin/tools` registry.\n * - Idempotent `migrateFrontmatter` library that rewrites legacy\n * `graphorin-*` fields onto their upstream equivalents per the\n * bundled mapping table.\n *\n * Stable sub-paths:\n *\n * ```ts\n * import { loadSkills, loadSkillFromSource } from '@graphorin/skills/loader';\n * import { createSkillRegistry } from '@graphorin/skills/registry';\n * import { validateFrontmatter, resolveSkillField } from '@graphorin/skills/frontmatter';\n * import { migrateFrontmatter } from '@graphorin/skills/migration';\n * import { parseSlashCommand } from '@graphorin/skills/activation';\n * import { getSpecSnapshot, getKnownField } from '@graphorin/skills/spec';\n * import { SkillFrontmatterConflictError } from '@graphorin/skills/errors';\n * ```\n *\n * @packageDocumentation\n */\n\n/** Canonical version constant. Mirrors the `package.json` version. */\nexport const VERSION = '0.5.0';\n\nexport * from './activation/index.js';\nexport * from './errors/index.js';\nexport * from './frontmatter/index.js';\nexport * from './loader/index.js';\nexport * from './migration/index.js';\nexport * from './registry/index.js';\nexport * from './spec/index.js';\nexport * from './types/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,UAAU"}
@@ -0,0 +1,55 @@
1
+ import { FrontmatterValidatorPolicy, HandoffInputFilterDeclaration, Skill, SkillMetadata, SkillSource, UnknownFieldPolicy } from "../types/index.js";
2
+ import { SupplyChainPolicy } from "@graphorin/security/supply-chain";
3
+
4
+ //#region src/loader/index.d.ts
5
+
6
+ /** Options forwarded to {@link loadSkillFromSource}. */
7
+ interface LoadSkillOptions {
8
+ readonly conflictPolicy?: FrontmatterValidatorPolicy;
9
+ readonly unknownFieldPolicy?: UnknownFieldPolicy;
10
+ readonly runtimeVersion?: string;
11
+ readonly supplyChainPolicy?: SupplyChainPolicy;
12
+ readonly signal?: AbortSignal;
13
+ /** Override the bundled MIME-type guesser for resource files. */
14
+ readonly mediaTypeFor?: (path: string) => string | undefined;
15
+ }
16
+ /** Aggregate options accepted by {@link loadSkills}. */
17
+ interface LoadSkillsOptions extends LoadSkillOptions {
18
+ /**
19
+ * Fail fast if any source produces a {@link SkillLoadError}. When
20
+ * `false` (default) the loader logs the source path on the
21
+ * diagnostic and continues with the next source.
22
+ */
23
+ readonly throwOnSourceError?: boolean;
24
+ }
25
+ /**
26
+ * Load a single skill from any supported source. The loader runs the
27
+ * full frontmatter validator and resolves the supply-chain trust
28
+ * policy so the returned {@link Skill} is ready to be inserted into a
29
+ * `SkillRegistry`.
30
+ *
31
+ * @stable
32
+ */
33
+ declare function loadSkillFromSource(source: SkillSource, options?: LoadSkillOptions): Promise<Skill>;
34
+ /**
35
+ * Load multiple skills concurrently. The sources are loaded in parallel and
36
+ * the returned array preserves input order. When `throwOnSourceError === false`
37
+ * (default) a failing source is logged and skipped; otherwise the first
38
+ * rejection propagates out unchanged.
39
+ *
40
+ * @stable
41
+ */
42
+ declare function loadSkills(sources: ReadonlyArray<SkillSource>, options?: LoadSkillsOptions): Promise<ReadonlyArray<Skill>>;
43
+ /**
44
+ * Required handoff-filter declaration helper. Returns the typed
45
+ * declaration the loader parsed from frontmatter; throws
46
+ * {@link InputFilterRequiredError} when the skill is untrusted and the
47
+ * field is missing. Used by the agent runtime in Phase 12 right
48
+ * before instantiating an untrusted skill's sub-agent.
49
+ *
50
+ * @stable
51
+ */
52
+ declare function requireHandoffInputFilter(metadata: SkillMetadata): HandoffInputFilterDeclaration;
53
+ //#endregion
54
+ export { LoadSkillOptions, LoadSkillsOptions, loadSkillFromSource, loadSkills, requireHandoffInputFilter };
55
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/loader/index.ts"],"sourcesContent":[],"mappings":";;;;;;UAyEiB,gBAAA;4BACW;gCACI;;+BAED;oBACX;;;;;UAMH,iBAAA,SAA0B;;;;;;;;;;;;;;;;iBAwCrB,mBAAA,SACZ,uBACC,mBACR,QAAQ;;;;;;;;;iBAmEW,UAAA,UACX,cAAc,wBACd,oBACR,QAAQ,cAAc;;;;;;;;;;iBA6kBT,yBAAA,WAAoC,gBAAgB"}