/** * Rule subject module: declared/resolved/actual payloads, scanner composition, * and projections via the shared helper. * * Rules have no `axm.json` entry shape and no `axm-lock.yaml` entry * shape in v1. Actual occurrences come from the canonical-extensions * scanner (`type === "rule"`); the agent-dir scanner emits no rule * occurrences in the v1 `AgentRegistry`, but the subject module accepts an * agent-dir scanner input so future agents can register rule directories * without further changes here. */ import * as Effect from "effect/Effect"; import * as Option from "effect/Option"; import type { AgentId } from "../../../agents/types.js"; import { type ExtensionName } from "../../../extensions/common.js"; import type { Lockfile, RuleLockEntry } from "../../../lockfile/schema.js"; import type { RuleEntry, Settings } from "../../../settings/schema.js"; import type { Diagnostics } from "../diagnostics.js"; import type { LockfileReadError, SettingsReadError } from "../errors.js"; import type { CanonicalExtensionOccurrence } from "../scanners/types.js"; import type { ActivationState, ExtensionKey, InstallationOrigin, InstalledPackRef, Scope } from "../types.js"; export type RuleDetectionOrigin = { readonly _tag: "canonical-axm-rule"; } | { readonly _tag: "external-axm-rule"; } | { readonly _tag: "agent-rule-dir"; readonly agentId: AgentId; }; export interface DeclaredRule { readonly name: ExtensionName; readonly entry: RuleEntry; } export type DeclaredRules = ReadonlyArray; export interface ResolvedRule { readonly name: ExtensionName; readonly lockEntry: RuleLockEntry; } export type ResolvedRules = ReadonlyArray; export interface ActualRule { readonly key: ExtensionKey<"rule">; readonly origin: RuleDetectionOrigin; readonly contentRoot: string; readonly packageRoot: string | null; } export type ActualRules = ReadonlyArray; export interface RulePackMember { readonly name: ExtensionName; readonly providingPack: InstalledPackRef; } export interface InstalledRule { readonly key: ExtensionKey<"rule">; readonly installationOrigin: InstallationOrigin; readonly activation: ActivationState; readonly resolved: Option.Option; readonly actual: ReadonlyArray; readonly providingPacks: ReadonlyArray; } export interface UnmanagedRule { readonly key: ExtensionKey<"rule">; readonly actual: ActualRule; } /** * Rule scanners. v1 ships a canonical scanner only; the v1 `AgentRegistry` * does not register rule directories, so there is no agent-dir rule input. * If a future agent registers a rule directory, this scanner record gains an * `agentDir` field and the subject module wires through `agent-rule-dir` * origins. */ export interface RuleScanners { readonly canonical: Effect.Effect>; } export interface RuleScopedLoaders { readonly settings: Effect.Effect, SettingsReadError>; readonly lockfile: Effect.Effect, LockfileReadError>; } export interface InstalledPackForRules { readonly ref: InstalledPackRef; readonly rules: ReadonlyArray; } export interface RuleExtensionsApiDeps { readonly scope: Scope; readonly loaders: RuleScopedLoaders; readonly scanners: RuleScanners; readonly installedPacks: Effect.Effect, SettingsReadError | LockfileReadError>; readonly diagnostics: Diagnostics; } export interface RuleExtensionsApi { readonly declared: Effect.Effect, SettingsReadError>; readonly resolved: Effect.Effect, LockfileReadError>; readonly actual: Effect.Effect; readonly installed: Effect.Effect, SettingsReadError | LockfileReadError>; readonly byName: (name: string) => Effect.Effect, SettingsReadError | LockfileReadError>; readonly declaredByName: (name: string) => Effect.Effect, SettingsReadError>; readonly active: Effect.Effect, SettingsReadError | LockfileReadError>; readonly unmanaged: Effect.Effect, SettingsReadError | LockfileReadError>; } /** * Build the rule subject API. Returns an `Effect` because the projection * cell is wrapped in `Effect.cached` so the four derived cells share one * in-flight execution per scope, mirroring `state.ts`. */ export declare const makeRuleExtensionsApi: (deps: RuleExtensionsApiDeps) => Effect.Effect; //# sourceMappingURL=rule.d.ts.map