trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
30 lines • 1.34 kB
TypeScript
/**
* Content-addressed blob HTTP handler for the realtime relay.
*
* Factoring lives here so both {@link createRealtimeRelay} and
* {@link attachRealtimeRelay} (plus any embedder) can mount the same routes.
*
* @module trellis/server
*/
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { BlobStore } from '../vcs/blob-store.js';
export declare const BLOB_CORS: {
readonly 'Access-Control-Allow-Origin': "*";
readonly 'Access-Control-Allow-Methods': "GET, HEAD, PUT, OPTIONS";
readonly 'Access-Control-Allow-Headers': "Content-Type, If-None-Match, X-Trellis-Filename";
};
export interface BlobRequestHandlerOptions {
/** Reject PUT bodies larger than this. Default 64 MiB → 413. */
maxBlobBytes?: number;
/**
* Gate writes. Return false → 401. Default: allow all (local/dev).
* Production embedders should pass a real check.
*/
authorizeBlobWrite?: (req: IncomingMessage) => boolean | Promise<boolean>;
}
/**
* Build a request handler for `/blob` and `/blob/:sha256`.
* Returns `true` when the request was claimed (response written or in flight).
*/
export declare function createBlobRequestHandler(store: BlobStore, opts?: BlobRequestHandlerOptions): (req: IncomingMessage, res: ServerResponse) => boolean;
//# sourceMappingURL=blob-handler.d.ts.map