import type { TwinAuthStrategy } from './executor.js'; import type { TwinAction } from './actions.js'; import type { PerformAction } from './head.js'; import type { RemoteExecute } from './remote-execute.js'; import type { TwinResource } from './serve.js'; export type DeployPolicy = 'auto' | 'gated' | 'hold'; /** A twin's root: the vendor's real account. Key-free; the credential is sealed elsewhere. */ export type RootConfig = { /** the vendor's API, or the one resource the account is (`https://api.github.com/repos/o/r`) */ url: string; deploy: DeployPolicy; /** the world's override of the pack's refresh posture: an interval, and the least time between on-demand refreshes */ refresh?: { every?: string; webhook?: boolean; atMost?: string; }; /** the one resource the account is, under `url` — `repos/acme/web` for GitHub — when the vendor's * adapters need it named; the adapters see `url/scope` as their origin */ scope?: string; /** every pull through this root is pseudonymized (architecture, "A real account's data"), with the key sealed in the * root's credential (its `pseudonymKey`); a pull is refused while the credential holds none */ pseudonymize?: true; }; export declare function rootPath(service: string, root?: string): string; export declare function readRoot(service: string, root?: string): RootConfig | null; export declare function writeRoot(service: string, config: RootConfig, root?: string): void; export declare function clearRoot(service: string, root?: string): void; /** The pack's half of the real state system. `perform` applies one entry against the vendor; * `refresh` observes the vendor into the parent log (it folds through the kernel — a pack never * writes a root log by hand); `ingest` folds one signed webhook. All over the kernel executor. */ export type StateSystemAdapters = { perform?: PerformAction; refresh?: (execute: RemoteExecute, opts: { root?: string; origin?: string; credential?: string; scope?: string; }) => Promise; ingest?: (request: Request, ctx: { root?: string; secret?: string; }) => Response | Promise; /** Why a recorded write is the World's own and sent nowhere, or undefined when perform sends it: a unit of the pack that * declares `vendorBacked.none` beside lanes that are vendor-backed (PlanetScale's SQL wire beside its API lane). */ unsent?: (input: Record | undefined) => string | undefined; }; /** Register a twin's adapters (the mounting host does this from the pack's descriptor or its * anchored exports). Replaces any earlier registration for the service. */ export declare function registerStateSystem(service: string, a: StateSystemAdapters): void; export declare function stateSystemFor(service: string): StateSystemAdapters | undefined; export declare function clearStateSystems(): void; export declare function registerAuthStrategy(service: string, a: TwinAuthStrategy): void; export declare function authStrategyFor(service: string): TwinAuthStrategy | undefined; /** A check: deterministic, sees the entry and the tree, answers pass or fail with a reason. */ /** A check may answer at once or later: a hosted World runs its checks in an isolate of their own, * reached over RPC. */ export type CheckResult = { ok: true; } | { ok: false; reason: string; }; export type Check = { name: string; run: (entry: TwinAction, tree: TwinResource[]) => CheckResult | Promise; }; export type CheckVerdict = { name: string; reason: string; } | null; /** Run every check over one entry; the first failure is the verdict. */ export declare function runChecks(checks: Check[], entry: TwinAction, tree: TwinResource[]): Promise; /** The one check every world ships: no credential-shaped string leaves for a vendor. Looks at * every string field of the entry (and its projection), so a token in a message body, a title or * a description is caught wherever the vendor would have put it. */ export declare const NO_SECRETS_CHECK: Check;