import { type ProfileClient } from "./profile-client.js"; import type { ResolvedSkillProfile, ResolvedSkillSelection } from "../types/skill-selection.js"; import type { SkillBundleEntry } from "./skill-bundle.js"; import { type CachedSelectionProfile, type SelectionCacheOptions, type SkillSessionParentBinding, type SkillSessionProjectLock, type SkillSessionReceipt } from "./selection-cache.js"; export interface SelectionResolverOptions extends SelectionCacheOptions { client?: ProfileClient; cached?: boolean; /** Read the verified cache while it can serve a load, and the service after that. */ cacheFirst?: boolean; /** Explicit cached authority binding, checked even when no credential is read. */ authority?: string; workspaceId?: string; maxAgeMs?: number; projectDir?: string; sessionId?: string; /** A newly spawned subagent inherits the parent's pinned snapshot, never its dedup state. */ parentSessionId?: string; nativeParentSessionId?: string | null; } export interface SyncSelectionProfileOptions extends SelectionCacheOptions { client?: ProfileClient; projectDir?: string; stationId?: string; check?: boolean; /** * The SHA-256 of the cached profile bytes the caller preserved, or null when * it expects no cached profile. Sync then refuses with * SELECTION_PROFILE_CHANGED, before any download, unless the profile it reads * is exactly that state; activation itself refuses any later change. */ expectedProfileSha256?: string | null; } export declare function syncSelectionProfile(profileId: string, options?: SyncSelectionProfileOptions): Promise<{ profile: ResolvedSkillProfile; receipt: CachedSelectionProfile | null; changed: boolean; downloaded: number; stationReported: boolean; }>; export interface ResolvedSelectionContext { receipt: CachedSelectionProfile; session: SkillSessionReceipt | null; sessionSnapshot: SkillSessionParentBinding | null; parentSnapshot?: SkillSessionParentBinding; inheritedLoaded?: string[]; client?: ProfileClient; /** Set when a new session's pin comes from the project lock; the session receipt records it. */ projectLock?: SkillSessionProjectLock; } export declare function resolveSelectionContext(profileId: string, options?: SelectionResolverOptions): Promise; export declare function readSelectedEntries(selection: ResolvedSkillSelection, context: ResolvedSelectionContext, options?: SelectionResolverOptions): Promise; export declare function exactProfileSelection(spec: string, profile: ResolvedSkillProfile): ResolvedSkillSelection; /** Refusals that mean the verified cache can't serve a read, not that the read is wrong. Identity and integrity failures never fall back. */ export declare const RECOVERABLE_CACHE_ERRORS: ReadonlySet; /** * Load one selected skill. With cacheFirst it reads the verified cache while that * can serve this load, which works with no network, and the Skills service after * that, as the managed hook does. A subagent inherits its parent's verifiedAt and * gets no renewal of its own, so a pointer it holds outlives the cache's limit. */ export declare function loadSelectedSkill(spec: string, profileId: string, options?: SelectionResolverOptions & { file?: string; }): Promise<{ sessionRecorded?: boolean | undefined; content: string; selection: ResolvedSkillSelection; receipt: { file: string; source: string; verifiedAt: string; authorizationEpoch?: string; authority: string; workspaceId: string; profileRevision: string; slug: string; version: string; bundleDigest: string; aliases?: string[]; triggers?: { keywords?: string[]; paths?: string[]; always?: boolean; }; }; }>; /** A session store that this process can't write: a sandbox, or a full disk or quota. */ export declare function isUnwritableStore(error: unknown): boolean; /** Pin the resolved profile metadata without copying a definition into the project. */ export declare function pinSelectedSkillVersion(spec: string, profileId: string, options: SelectionResolverOptions & { projectDir: string; }): Promise<{ selection: ResolvedSkillSelection; path: string; }>; export declare function selectedSkillRequirements(spec: string, profileId: string, options?: SelectionResolverOptions): Promise<{ selection: ResolvedSkillSelection; envVars: string[]; systemDeps: string[]; cliCommand: string | null; dependencies: Record; }>;