import { type McpServer } from "../mcp/servers.js"; import { ECC_HOOK_PROFILES, type EccHookControlCatalogEntry } from "./ecc-hook-controls.js"; import { type EccMcpCatalogEntry } from "./ecc-mcp-catalog.js"; import { type HookRegistration, hookOverlaps, hookSpawnProjection } from "./hook-registrar.js"; export interface AihPolicyControl { id: string; kind: "mcp" | "hook"; source: { type: "mcp"; server: string; subject: string; } | { type: "hook"; handler: "usage-metering"; scriptDigest: string; }; targets: ("claude" | "codex" | "kiro")[]; projector: "mcp-managed-settings" | "usage-hook"; lifecycle: "supported"; } /** * Every namespace the pinned baseline catalogs use as a component-id prefix. * This is the inventory's own vocabulary. It is deliberately not the three-kind * `governance.externalCuration` grammar in `schema.ts`: that one is a policy * document format, this one describes what a framework actually contains. */ export declare const POLICY_AUTHORING_ASSET_KINDS: readonly ["agent", "baseline", "capability", "framework", "lang", "mcp", "module", "runtime", "skill"]; export type PolicyAuthoringAssetKind = (typeof POLICY_AUTHORING_ASSET_KINDS)[number]; export interface PolicyAuthoringAsset { kind: PolicyAuthoringAssetKind; id: string; /** * Set only when the asset is expressible as an external-curation item, and * carrying that schema's kind rather than this one's. Absent means the item * stays visible as inventory but cannot be authored into `externalCuration`. */ curationKind?: "agent" | "skill" | "command"; /** * Components this one pulls in with it, from ECC's own declaration riders. * Present only where the pinned catalog actually carries every rider, so the * surface never names a component the inventory denies. */ riders?: string[]; source: { repository: string; commit: string; path: string; }; /** * The verdict AIH's own analyzers reached for this component at the pinned * commit. Absent only when the shipped evidence was produced against a * different pin, because showing a verdict from another commit would launder a * stale result into a current claim. */ vet?: PolicyAuthoringVet; } /** One blocking observation, reduced to what an administrator can act on. */ export interface PolicyAuthoringVetFinding { code: string; /** Occurrence count where the analyzer reported one; never invented when absent. */ count?: number; detail: string; } /** * A vetted component's evidence. `blocked` here means an AIH-owned gate actually * failed — the one thing that word is reserved for. It is never a statement * about provenance, and it never means aih withheld a third-party component. */ export interface PolicyAuthoringVet { verdict: "pass" | "blocked"; /** Content identity of the scanned tree, distinct from the source commit. */ treeSha256: string; /** Who reached the verdict, and at exactly what version. */ analyzers: Array<{ name: string; version: string; }>; /** Empty for `pass`; the lock schema guarantees `blocked` carries at least one. */ findings: PolicyAuthoringVetFinding[]; } export interface PolicyAuthoringFramework { id: "ecc" | "superpowers"; repository: string; commit: string; assets: PolicyAuthoringAsset[]; } /** * What an AIH-owned hook does at event time. Hooks are AIH-owned and custom * hooks are unsupported, so the administrator's only lever here is knowing * exactly what runs — disclosure is the whole affordance. */ export interface AihHookBehaviour { /** The CLI event that fires it. */ trigger: string; records: string; /** The repo-relative artifact it writes. */ artifact: string; failureMode: string; } /** An AIH control already narrowed to its hook identity, so a disclosure can * read the pinned script digest without re-proving which variant it holds. */ export type AihHookControl = AihPolicyControl & { source: Extract; }; export interface PolicyAuthoringHook { id: string; description: string; behaviour: AihHookBehaviour; control: AihHookControl; } export interface PolicyAuthoringCompositionPart { id: string; label: string; /** The exact product constructor this part is derived from, stated for review. */ rule: string; /** * Whether choosing the posture selects this part, or offers it as a choice * the administrator makes. The acceptance contract has Enterprise expose "ECC * Core and additive choices", and its journey has the administrator select * languages and add security — which only works if the posture leaves those * parts unselected. */ selection: "composed" | "additive"; componentIds: string[]; } /** * What a posture composes out of a framework's inventory. Composed parts become * requested intent when the posture is chosen; additive parts are named so the * administrator can add them. Recording either is not enforcement — ECC installs * and runs these components. */ export interface PolicyAuthoringComposition { framework: "ecc"; parts: PolicyAuthoringCompositionPart[]; } /** * Every AI CLI this build knows, and whether an org policy can project onto it. * AIH's registry carries eleven; `PolicyTargetSchema` carries three. Stating that * asymmetry is the point: an administrator who sees only Claude, Codex, and Kiro has * no way to tell whether the others are unknown or merely unprojectable. */ export interface PolicyAuthoringHost { id: string; label: string; /** True when an org-policy activation can name this host as a target. */ policyTarget: boolean; mcpSupport: string; } export declare function policyAuthoringHosts(): PolicyAuthoringHost[]; /** * One row of the hook registrar's inventory. AIH-owned handlers and third-party * hooks appear here together: AIH registers every entry, so an administrator who * cannot see both halves cannot see what the destination will contain. */ export interface PolicyAuthoringHookRegistryEntry { id: string; owner: "aih" | "third-party"; /** * The TRUE owner as the workbench ticker names it ("AIH", "ECC", * "Superpowers"). Every registrar-related row files under this label; a row * under the wrong owner or missing from the tally is a product failure. */ ownerLabel: string; /** Where the behaviour comes from — repository@commit path, or AIH itself. */ source: string; description: string; /** * Whether an AIH-owned gate actually governs this item at run time. A * third-party hook is `not-aih-enforced` because ECC installs and runs it — * that is a LABEL, never a statement that AIH withheld or blocked it. */ enforcement: "aih-enforced" | "not-aih-enforced"; /** Always true: absence of AIH enforcement never disables authoring. */ selectable: true; } /** * A gating control a third-party source declares for its own hooks. AIH records * that it exists and never implements, mirrors, or overrides it. */ export interface PolicyAuthoringHookControl { name: string; owner: string; enforcedByAih: false; detail: string; } export interface PolicyAuthoringHookRegistry { entries: PolicyAuthoringHookRegistryEntry[]; declaredControls: PolicyAuthoringHookControl[]; /** The registrations this artifact can price — AIH's own, plus any authored. */ registrations: HookRegistration[]; overlaps: ReturnType; /** Usage metering, never a cost model: entries and process spawns per event. */ spawnProjection: ReturnType; } export interface PolicyAuthoringCatalog { mcp: Array<{ id: string; description: string; server: McpServer; control: AihPolicyControl; }>; externalMcp: readonly EccMcpCatalogEntry[]; /** Digest paired with externalMcp when authoring an exact declarative ECC approval. */ eccMcpApproval: { sourceContentSha256: string; }; eccHookControls: { sourceContentSha256: string; profiles: typeof ECC_HOOK_PROFILES; hooks: readonly EccHookControlCatalogEntry[]; disabledHooks: { availability: "supported"; detail: string; eligibleIds: readonly string[]; }; }; hooks: PolicyAuthoringHook[]; hookRegistry: PolicyAuthoringHookRegistry; frameworks: PolicyAuthoringFramework[]; enterpriseComposition: PolicyAuthoringComposition; hosts: PolicyAuthoringHost[]; } export declare function policyAuthoringMcpCatalog(): Record; /** Shared, runtime-independent AIH control identities for the engine and Studio. */ export declare function aihPolicyControls(catalog?: Record): AihPolicyControl[]; /** * Serializable, source-controlled authoring data. It is derived directly from * the existing pinned MCP and baseline catalog constructors, never copied. */ export declare function policyAuthoringCatalog(): PolicyAuthoringCatalog;