import { type RunContext } from "./core/index.js"; import { type PolicyRule } from "./guard/index.js"; import { type VendoStore } from "./store/index.js"; /** Build contract §9.10 — where an org's policy lives. Owner derivation is a * pure function of the path (§9.7): `/orgs//**` is owned by the org * itself, which is why the file is read as the org rather than as any member. * The admin-only WRITE rule on this path is the workspace's, not this seam's: * nothing here can write. */ export declare const orgPolicyPath: (orgId: string) => string; /** The orgs the caller asserted for this request or fire (§9.1). Memberships * ride the ctx and are never stored, so this is the only place to read them; * a ctx without them (today's default, and every unkeyed deployment) simply * has no orgs. */ export declare const assertedOrgs: (ctx: RunContext) => string[]; /** The workspace-backed source of policy bodies, TTL-cached per org. * * Resolved LAZILY: `workspaceStore` wants a SQL handle, which a hosted store * has not got (harness-turn makes the same allowance). * * A deployment with no workspace is NOT the same thing as an org with no * policy file, and it used to be treated as one — memoized as a permanent * silent `null`. That is the deployment org policy is SOLD for: org policy is * a Cloud feature, and a keyed deployment with no explicit store selects the * hosted store. Every org resolved to no rules, forever, with nothing anywhere * to tell an admin their policy was never in force. So it is reported — once * per deployment, through the same `onFailure` channel a broken read uses * (warning + audit row at the composition seam), and then it goes quiet: an * operator must not be drowned in one unfixable fact on every guarded call. * * Reporting it never LOOSENS anything: org rules only tighten, so their * absence leaves the pipeline's own verdict standing. */ export declare function workspacePolicySource(store: VendoStore): (orgId: string) => Promise; /** Build contract §9.10's guard seam: the union of every asserted org's rules. * * Failures are PER ORG. A file that cannot be read or cannot be understood * applies none of ITS rules — never partially, because a policy this layer only * half-understands is not the policy the admin wrote — while every other org's * rules still bind. One broken file used to disarm the whole layer for everyone * in the request, which is the opposite of a tightening layer's job. * * Every failure goes to `onFailure`, which the composition seam wires to the * audit trail: the admin whose file is broken can see that their policy is not * in force. Nothing is ever LOOSENED by a bad file — org rules only tighten, so * their absence is the pipeline's own verdict, unchanged. */ export declare function orgPolicyResolver(source: (orgId: string) => Promise, onFailure?: (orgId: string, reason: string) => void | Promise): (ctx: RunContext) => Promise;