import { RedisKVMarker } from "./keys.js"; import { Transport } from "./proxy.js"; import { Registry } from "./registry.js"; import { PassportRules } from "./passport.js"; import { Metrics } from "./metrics.js"; import { Passport } from "@assistant-ui/passport"; //#region src/server.d.ts /** A resolution older than this at send time is re-resolved, bounding the * forward's resolve-to-send flight segment on this node's monotonic clock. */ declare const FORWARD_STALENESS_MS = 5000; /** Metrics collectors reuse one fleet overview for this long. */ declare const OVERVIEW_SNAPSHOT_TTL_MS = 5000; declare namespace createPinboard { type SetOptions = { pxMs?: number; nx?: boolean; }; type RedisKV = { readonly [RedisKVMarker]: true; get(key: string): Promise; set(key: string, value: string, opts?: SetOptions): Promise<"OK" | null>; del(key: string): Promise; pexpire(key: string, ms: number): Promise; hget(key: string, field: string): Promise; hset(key: string, field: string, value: string): Promise; hsetnx(key: string, field: string, value: string): Promise; hdel(key: string, field: string): Promise; hgetall(key: string): Promise>; hscan(key: string, cursor: string, count: number): Promise<{ cursor: string; entries: [string, string][]; }>; rpush(key: string, value: string): Promise; lrange(key: string, start: number, stop: number): Promise; lrem(key: string, count: number, value: string): Promise; scriptLoad(script: string): Promise; evalsha(sha: string, keys: string[], argv: string[]): Promise; quit(): Promise; }; type FleetHealth = { resolutions: Record; connections: number; quarantineMs: number; uptimeMs: number; rssBytes?: number; }; type DurabilityStore = { /** Pages the marked tray-index rows; null cursor starts a pass, a * null returned cursor ends it (the next call starts over). */ listMarked(cursor: string | null, limit: number): Promise<{ entries: { env: string; hostname: string; ns: string; id: string; }[]; cursor: string | null; }>; }; type DurabilityOptions = { /** Activities index enabling resurrection; absent, the sweep prunes only. */ store?: DurabilityStore | undefined; sweepIntervalMs?: number | undefined; sweepLimit?: number | undefined; /** Max overwritten entries woken per sweep pass, default 25. */ wakeLimit?: number | undefined; /** Concurrent wakes within a pass, default 4. */ wakeConcurrency?: number | undefined; /** Per-wake request timeout and the activating re-check delay, default 15000ms. */ wakeTimeoutMs?: number | undefined; /** Parked entries older than this are deleted, default 3600000ms. */ parkedTtlMs?: number | undefined; /** Backoff-jitter rng in [0, 1), default Math.random. */ random?: (() => number) | undefined; backoff?: { baseDelayMs?: number | undefined; maxDelayMs?: number | undefined; parkAfterFailures?: number | undefined; } | undefined; }; type ForwardOptions = { /** Concurrent forwards per worker awaiting response headers; exceeding answers 503, default 1024. */ maxInflight?: number | undefined; /** Cap on a forward's wait for response headers; exceeding answers 504, default 30000ms. */ timeoutMs?: number | undefined; }; type OutlierOptions = { /** Consecutive activation failures that eject a worker from placement, default 5. */ ejectAfterFailures?: number | undefined; /** Base ejection cooldown, doubled per consecutive ejection, default 30000ms. */ baseEjectionMs?: number | undefined; /** Ejection cooldown ceiling, default 10 base windows. */ maxEjectionMs?: number | undefined; /** Fraction of live workers ejectable at once (0, 1], default 0.5; one worker always remains placeable. */ maxEjectionRatio?: number | undefined; }; type Client = { /** Peer IP as observed by the serving transport; feeds affinity and X-Forwarded-For. */ address?: string | undefined; }; type Options = { redis: RedisKV; /** Registry and optional data-plane identity. */ passport: Passport.Instance; /** Data-plane access rules: exact namespace keys plus "*"; unlisted namespaces are denied. */ namespaces?: Record | undefined; /** Sweep tuning; a store turns the always-on prune sweep into resurrection. */ durability?: DurabilityOptions | undefined; /** Outlier-ejection tuning for placement. */ outlier?: OutlierOptions | undefined; /** Per-worker forward caps. */ forwards?: ForwardOptions | undefined; /** First-placement affinity: bounded-load factor (> 1, default 1.25) and * the client-IP source. Unset trustedProxies keys on the observed peer * only when no X-Forwarded-For rides the request; "*" trusts XFF * outright; a list of proxy IPs/CIDRs takes the rightmost XFF hop not * from a trusted proxy. */ affinity?: { balanceFactor?: number | undefined; trustedProxies?: string[] | "*" | undefined; } | undefined; /** Mount prefix (e.g. "/v2") stripped from incoming URLs; unprefixed requests get 404. */ basePath?: string | undefined; leaseTtlMs?: number | undefined; /** Challenge-probe timeout for register and heartbeat verification, default 2500ms. */ verifyTimeoutMs?: number | undefined; /** Redis key prefix, default "pinboard:". Non-empty, no whitespace. */ keyPrefix?: string | undefined; /** Shard count S this node serves, default 1; the {0}:config license gates which S serves. */ shards?: number | undefined; /** Hostname-aware mode: workers register a hostname/env, requests route * by Host. Fenced by the {0}:config license like shards. */ hostnameAware?: boolean | undefined; /** Fleet epoch (integer >= 0, default 0): a higher-epoch fleet displaces * the license of a lower-epoch one instead of waiting it out. */ epoch?: number | undefined; /** Fires once when a higher-epoch fleet takes the license; absent, this * node keeps running but refuses to serve. */ onDisplaced?: (() => void) | undefined; /** Maps a register-body hostname to a bounded pool label on registration metrics; unset labels pool "". */ pool?: ((hostname: string) => string) | undefined; /** Clock override for tests; defaults to Date.now. */ now?: (() => number) | undefined; /** Placement randomness override for tests; defaults to Math.random. */ random?: (() => number) | undefined; /** Outbound client override; defaults to the global fetch (Workers-ready). */ transport?: Transport.Options | undefined; metrics?: Metrics.Instance | undefined; }; type Instance = { registry: Registry; /** WinterTC entry: data plane, registry, upgrades (via the transport seam). */ fetch(req: Request, client?: Client): Promise; /** One maintenance pass: license refresh plus, under the sweeper lease, * a durability sweep. For cron-driven runtimes. */ sweep(): Promise; /** Starts the background license/durability loops; long-lived runtimes only. */ start(): void; close(): Promise; }; } declare const createPinboard: (options: createPinboard.Options) => createPinboard.Instance; //#endregion export { FORWARD_STALENESS_MS, OVERVIEW_SNAPSHOT_TTL_MS, createPinboard }; //# sourceMappingURL=server.d.ts.map