/** Per-scope read-only workspace model factory and configuration. */ import * as Brand from "effect/Brand"; import * as ServiceMap from "effect/Context"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Option from "effect/Option"; import * as Path from "effect/Path"; import { type Handle } from "../../extensions/handle.js"; import type { SourceHostConfig } from "../../settings/schema.js"; import { type AbsolutePath } from "../../utils/path-types.js"; import { AgentRootResolver } from "./agent-root-resolver.js"; import { type ScopedAgentsApi } from "./agents/index.js"; import { type Warning } from "./diagnostics.js"; import { WorkspaceRootEscape, type LockfileIoError, type SettingsIoError, type SettingsReadError } from "./errors.js"; import { type HookExtensionsApi, type KnowledgeExtensionsApi, type McpServerExtensionsApi, type PackExtensionsApi, type RuleExtensionsApi, type SkillExtensionsApi, type SubagentExtensionsApi } from "./extensions/index.js"; import { type CanonicalExtensionOccurrence } from "./scanners/index.js"; import { type RawSourceBytes, type ScopedStateLoaders } from "./state.js"; import type { Scope } from "./types.js"; export type { RawSourceBytes } from "./state.js"; /** Scoped state cells; `raw(source)` reads cached bytes (absent → `Option.none`). */ export interface ScopedStateApi { readonly settings: ScopedStateLoaders["settings"]; readonly lockfile: ScopedStateLoaders["lockfile"]; readonly raw: (source: "settings" | "lockfile") => Effect.Effect, SettingsIoError | LockfileIoError>; } /** Scoped source-host views over the cached settings loader. */ export interface ScopedSourceHostsApi { readonly declared: Effect.Effect, SettingsReadError>; readonly effective: Effect.Effect, SettingsReadError>; readonly registryHosts: Effect.Effect>, SettingsReadError>; readonly byName: (name: string) => Effect.Effect, SettingsReadError>; } /** Scoped owner view over the cached settings loader (declared owner; no fallback). */ export type ScopedOwnerApi = Effect.Effect, SettingsReadError>; /** * Workspace read model for a single scope (project or user). * * Returned by {@link makeWorkspaceReadModel}. Each invocation builds its own * scoped cells; cells cache for the lifetime of the returned value. */ export interface WorkspaceReadModel { readonly scope: Scope; readonly skills: SkillExtensionsApi; readonly mcpServers: McpServerExtensionsApi; readonly subagents: SubagentExtensionsApi; readonly rules: RuleExtensionsApi; readonly hooks: HookExtensionsApi; readonly knowledge: KnowledgeExtensionsApi; readonly packs: PackExtensionsApi; readonly agents: ScopedAgentsApi; readonly state: ScopedStateApi; readonly sourceHosts: ScopedSourceHostsApi; readonly owner: ScopedOwnerApi; readonly diagnostics: Effect.Effect>; readonly canonicalExtensions: Effect.Effect>; } /** * The read-model family that carries each catalog extension type, or `null` * where no family exists yet. * * Total by construction: a new extension type fails compile here until its * read-model coverage is decided. The parity conformance suite reads this map * to check the read-model obligation, and every `null` must be matched by a * ledger row. * * @experimental This API is unstable and may change without notice. */ export declare const READ_MODEL_EXTENSION_FAMILY_BY_TYPE: { readonly skill: "skills"; readonly "mcp-server": "mcpServers"; readonly subagent: "subagents"; readonly rule: "rules"; readonly hook: "hooks"; readonly knowledge: "knowledge"; }; /** Configuration the factory requires beyond `FileSystem` and `Path`. */ export interface WorkspaceReadModelConfigService { readonly projectRoot: AbsolutePath; readonly userHome: AbsolutePath; readonly allowedRoot: AbsolutePath; } declare const WorkspaceReadModelConfig_base: ServiceMap.ServiceClass; /** Service tag for the {@link WorkspaceReadModelConfigService} the factory requires. */ export declare class WorkspaceReadModelConfig extends WorkspaceReadModelConfig_base { } /** Workspace root that has been validated against `allowedRoot`. */ export type ResolvedWorkspaceRoot = string & Brand.Brand<"ResolvedWorkspaceRoot">; /** * Build a {@link WorkspaceReadModel} for the requested scope. * * Each invocation produces a fresh instance with its own cached cells; call * once at the command boundary and pass the value inward. Callers that need * both scopes invoke the factory twice. * * Cross-scope state (the agent-root resolver and its collision warnings) is * supplied by {@link AgentRootResolver}, which must be provided in the * environment so the same warnings flow into every scope built against the * same layer. */ export declare const makeWorkspaceReadModel: (scope: Scope) => Effect.Effect; //# sourceMappingURL=service.d.ts.map