import { type GovernanceStore } from "../sdk/governance-store.js"; import { ArtifactStorage } from "./artifact-storage.js"; import { type RuntimeService } from "./runtime-api.js"; import { type SkillsServerConfig } from "./config.js"; import { type MemorySkillsStore } from "./store.js"; import { type SkillsProductStore } from "./types.js"; export interface SkillsServerOptions { /** Overrides the artifact storage (tests inject an in-memory S3 stand-in). */ artifactStorage?: ArtifactStorage; config?: Partial; store?: SkillsProductStore; /** Lifecycle ledger and ceiling reads for governance surfaces (cancellation). Defaults to the store's database. */ governanceStore?: GovernanceStore; /** Inject a configured cloud runtime, or null to explicitly disable cloud execution. */ runtime?: RuntimeService | null; } export type SkillsFetchHandler = ((request: Request) => Promise) & { close(): Promise; }; /** * Refuse to serve traffic from storage that will not survive a restart. * * /health answering `ok: true` from a process backed by a Map is worse than a crash: it * satisfies every load balancer, container orchestrator, and smoke test we have, right * up until the process restarts and every run, log, and artifact is gone. Failing at * startup puts the problem where an operator will see it. * * A store that declares no backend is assumed durable - see StoreBackendInfo. This * guard's job is to make our own defaults safe, not to audit somebody else's store. */ export declare function assertDurableStore(store: SkillsProductStore, config: Pick): void; /** The same refusal, expressed against a resolved target so it can run before anything opens. */ export declare function assertDurableTarget(target: { durable: boolean; label: string; }, config: Pick): void; export declare function createSkillsFetchHandler(options?: SkillsServerOptions): Promise; export declare function startSkillsServer(options?: SkillsServerOptions): Promise>; /** * Socket-level body ceiling, derived from the same setting the publish route enforces. * * Without this the configured bundle limit was only ever advisory: Bun.serve defaults to * 128 MB, a chunked request sends no Content-Length for the early check to read, and * `request.formData()` materialises the whole body before any per-part check can run. So * a 25 MB configured cap admitted 128 MB of buffered request per connection. This refuses * it at the socket, before any of that is allocated. * * Exported so an embedder calling Bun.serve() with our fetch handler gets the same * ceiling instead of silently inheriting the default. */ export declare function skillsServeLimits(config: Pick): { maxRequestBodySize: number; }; export type { MemorySkillsStore };