import type { TenantAuthContext } from "../lib/auth/tenant-auth.js"; import type { LoopStorageContract } from "../lib/storage/contract.js"; import { BundleArtifactStorage } from "../lib/bundle/artifact-storage.js"; /** The scope that gates every surface able to materialise an agent prompt. */ export declare const BUNDLE_SCOPE = "loops:bundle"; /** Default cap for the multipart upload body. Separate from the JSON body limit. */ export declare const DEFAULT_BUNDLE_LIMIT_BYTES: number; /** * HTTP status for each integrity/conflict code the bundle paths raise. * * Kept as data rather than as throw sites so `errorResponse` in api/index.ts * can map a code that crossed a dist bundle boundary (where `instanceof` is * useless) without duplicating the table. */ export declare const BUNDLE_ERROR_STATUS: Readonly>; /** The slice of the v1 request context the bundle routes need. */ export interface BundleRequestContext { request: Request; url: URL; storage?: LoopStorageContract; auth: TenantAuthContext; bodyLimitBytes: number; bundleLimitBytes?: number; now: () => Date; /** Injected by tests; production builds one from the environment. */ artifacts?: BundleArtifactStorage; } /** * Project a stored `loop.json` for a JSON response. * * Without `loops:bundle` the agent branch loses `prompt` and `promptSource`, * matching what `publicTarget()` does everywhere else. The stripped shape is * still a valid definition to READ; it is simply not a runnable one, which is * exactly why the download route exists and why it is scoped. */ export declare function publicRevisionLoop(loopJson: Record, includePrompt: boolean): Record; /** * `/v1/loops/{id}/…` bundle sub-routes. Returns `undefined` when the path is * not one of ours, so the caller can fall through to its own 404. */ export declare function handleLoopBundleRequest(ctx: BundleRequestContext, loopId: string, segments: string[]): Promise; /** `GET /v1/bundles` — the tenant-wide index `loops bundle sync` reads. */ export declare function handleBundlesIndexRequest(ctx: BundleRequestContext): Promise;