/** * IAssetIndex — single-interface contract for the asset cache layer. * * Two implementations: * - LocalIndex (SQLite at ~/.skaile/index.db, Phase 1) * - PlatformIndex (Postgres, Phase 3) * * @docLink packages/library/concepts#i-asset-index */ /** * All known asset kinds shipped with the framework (9 core + 2 initial * extensions). Third-party providers can register any string as a kind at * runtime via the AssetKindRegistry. * * @docLink packages/library/concepts#asset-kind */ export declare const KNOWN_ASSET_KINDS: readonly ["skill", "agent", "connector", "mount", "flow", "contract", "prompt", "mcp-server", "knowledge", "persona", "ruleset"]; /** Known asset kind (for type narrowing where the old enum was used). */ export type KnownAssetKind = (typeof KNOWN_ASSET_KINDS)[number]; /** * Asset kind — any string. Pluggable kinds are registered at runtime via * `IAssetKindRegistry`. Use `KNOWN_ASSET_KINDS` for the built-in set. * * @docLink packages/library/concepts#asset-kind */ export type AssetKind = string; /** * Tuple of all allowed version-pin policy values. * * Used to derive the `PinPolicy` type and the `PinPolicySchema` zod enum in * `workspace-config.ts`. * * @docLink packages/library/concepts#pin-policy */ export declare const PIN_POLICIES: readonly ["exact", "minor-track", "latest"]; /** * Version-pin strategy for an Instance or Assignment. * * - `exact` — pins to the exact version in `defRef`; never auto-upgrades. * - `minor-track` — allows compatible minor/patch updates (>=X.Y, /@`). * * @docLink packages/library/concepts#asset-definition */ export interface AssetDefinition { /** Canonical ref: `/@` */ id: string; /** Asset kind (skill, agent, connector, etc.). */ kind: AssetKind; /** Publisher identifier (namespace owner). */ publisher: string; /** Asset name within the publisher namespace. */ name: string; /** Semantic version string. */ version: string; /** SHA-256 content hash for integrity verification. */ sha256?: string; /** Human-readable asset description from the manifest. */ description?: string; /** SPDX license identifier from the manifest. */ license?: string; /** Category tag from the manifest. */ category?: string; /** Full parsed manifest as JSON-safe object. */ manifest: Record; /** Library that provided this definition (null when library was removed). */ libraryId?: string; /** * Canonical refs (`@/@`) of this asset's body-link * soft dependencies — cross-asset references found in the asset body, not in * its typed manifest. Report-only: never auto-installed by the resolver. */ softDeps?: string[]; /** * Version of the IAssetKindProvider that produced this cached entry. * Independent of the asset's own version — tracks schema/logic evolution. * Mismatch between stored and current provider version is informational * WARN, not blocking (design decision A6). */ kindProviderVersion?: string; /** Timestamp when the definition was first cached. */ cachedAt: Date; /** Timestamp of the last cache update. */ updatedAt: Date; } /** * Filter options for {@link IAssetIndex.listAssetDefs}. * * @docLink packages/library/concepts#asset-definition */ export interface AssetFilter { /** Filter to a specific asset kind. */ kind?: AssetKind; /** Filter to a specific publisher namespace. */ publisher?: string; /** Prefix match on the full `/` ref. */ prefix?: string; /** Filter to assets from a specific library. */ libraryId?: string; /** Maximum number of results to return. */ limit?: number; /** Number of results to skip (for pagination). */ offset?: number; } /** * A configured asset Instance — an `AssetDefinition` bound with user config and * an optional opaque credential reference. * * Instances are workspace-agnostic; workspaces link to them via `Assignment`. * * @docLink packages/library/concepts#instance */ export interface Instance { /** UUID primary key. */ id: string; /** Asset definition ref (may include version range: `@skaile/gmail@^1.4`). */ defRef: string; /** Version-pin strategy for this instance. */ defPin: PinPolicy; /** Instance-specific configuration merged with the asset defaults at runtime. */ config: Record; /** Opaque handle to SecretsRouter -- never a secret value. */ credentialRef?: string; /** Timestamp when the instance was created. */ createdAt: Date; /** Timestamp of the last config update. */ updatedAt: Date; /** Identity that created the instance (e.g. `preset:`). */ createdBy?: string; /** * Immutable upstream git commit SHA the asset bytes were installed from * (pointer-only install path). Absent for instances created via * {@link IAssetIndex.createInstance} or preset apply. */ sourceCommitSha?: string; } /** * Input shape for {@link IAssetIndex.createInstance}. * * @docLink packages/library/concepts#instance */ export interface CreateInstanceInput { /** Canonical asset definition ref. */ defRef: string; /** Version-pin policy; defaults to `minor-track`. */ defPin?: PinPolicy; /** Initial configuration for the instance. */ config?: Record; /** Opaque credential reference from the SecretsRouter. */ credentialRef?: string; /** Optional creator identity for audit trail. */ createdBy?: string; } /** * Partial update shape for {@link IAssetIndex.updateInstance}. * * @docLink packages/library/concepts#instance */ export interface UpdateInstanceInput { /** New configuration (replaces existing config). */ config?: Record; /** Updated credential reference. */ credentialRef?: string; /** Updated pin policy. */ defPin?: PinPolicy; } /** * Filter options for {@link IAssetIndex.listInstances}. * * @docLink packages/library/concepts#instance */ export interface InstanceFilter { /** Filter to a specific asset kind. */ kind?: AssetKind; /** Filter by asset definition ref. */ defRef?: string; /** Filter by pin policy. */ defPin?: PinPolicy; /** Maximum number of results to return. */ limit?: number; /** Number of results to skip (for pagination). */ offset?: number; } /** * An Assignment links a workspace to an Instance, recording its pin policy. * * The unique constraint is `(workspaceId, instanceId)` — a workspace can only * assign a given Instance once. * * @docLink packages/library/concepts#assignment */ export interface Assignment { /** UUID primary key. */ id: string; /** Workspace path or identifier. */ workspaceId: string; /** The Instance this assignment refers to. */ instanceId: string; /** Pin policy recorded at assignment time. */ pinPolicy: PinPolicy; /** Timestamp when the assignment was created. */ assignedAt: Date; } /** * Base error class for all Library-layer errors. * * All subclasses carry a machine-readable `code` string that callers can * switch on without parsing the message. * * @docLink packages/library/concepts#errors */ export declare class LibraryError extends Error { readonly code: string; constructor(message: string, code: string); } /** * Thrown when a referenced library ID does not exist (e.g. by * {@link IAssetIndex.removeSource} / {@link IAssetIndex.syncSource}). * * @docLink packages/library/concepts#errors */ export declare class SourceNotFoundError extends LibraryError { constructor(id: string); } /** * Thrown by {@link IAssetIndex.getInstance}, {@link IAssetIndex.updateInstance}, * and {@link IAssetIndex.deleteInstance} when the given instance ID does not exist. * * @docLink packages/library/concepts#errors */ export declare class InstanceNotFoundError extends LibraryError { constructor(id: string); } /** * Thrown by {@link IAssetIndex.unassign} when the given assignment ID does not exist. * * @docLink packages/library/concepts#errors */ export declare class AssignmentNotFoundError extends LibraryError { constructor(id: string); } /** * Thrown by {@link IAssetIndex.assign} when the workspace already has an active * assignment to the same Instance. * * @docLink packages/library/concepts#errors */ export declare class DuplicateAssignmentError extends LibraryError { constructor(workspaceId: string, instanceId: string); } /** * Thrown by {@link IAssetIndex.deleteInstance} when the Instance has active * assignments and `{ cascade: true }` was not passed. * * @docLink packages/library/concepts#errors */ export declare class InstanceHasConsumersError extends LibraryError { constructor(instanceId: string, count: number); } /** * Single-interface contract for the asset cache layer. * * @docLink packages/library/concepts#i-asset-index */ export interface IAssetIndex { /** Look up a cached AssetDefinition by its canonical ref. */ getAssetDef(ref: string): Promise; /** List cached AssetDefinitions, optionally filtered. */ listAssetDefs(filter?: AssetFilter): Promise; createInstance(input: CreateInstanceInput): Promise; getInstance(id: string): Promise; listInstances(filter?: InstanceFilter): Promise; updateInstance(id: string, patch: UpdateInstanceInput): Promise; deleteInstance(id: string, opts?: { cascade?: boolean; }): Promise; assign(workspaceId: string, instanceId: string, pin: PinPolicy): Promise; unassign(assignmentId: string): Promise; listAssignments(workspaceId: string): Promise; getConsumptionGraph(instanceId: string): Promise; } //# sourceMappingURL=library.d.ts.map