/** * Shareable metadata transmission for the ForgeOS Trust Ledger. * * Controls exactly what leaves the developer's machine. * * Design is fail-closed: any privacy violation raises rather than returning * a partial payload. New fields added to the ledger schema are automatically * excluded until explicitly added to TRANSMITTABLE_FIELDS. * * Binary-compatible with the Python transmission.py implementation: * - Same TRANSMITTABLE_FIELDS allowlist * - Same sensitive pattern regexes (adapted for JavaScript RegExp) * - Same transmission payload structure * - Same manifest format (both box-drawing and plain-text versions) * * Privacy model (architecture §7.1): * - LOCAL_ONLY_FIELDS (signature, source_tree_hash) are NEVER transmitted. * - TRANSMITTABLE_FIELDS is the explicit allowlist. Any field not in this * list is stripped. New fields are automatically excluded. * - The privacy filter validates before transmission and raises * PrivacyViolationError on any sensitive pattern match. * * Transmission log: * Every attempt (approved or rejected) is appended to * .forgeos/transmissions.log as a JSON line. */ import type { LedgerEntry } from './ledger.js'; /** * Explicit allowlist: only these top-level fields may appear in a * transmitted payload. Matches Python's TRANSMITTABLE_FIELDS exactly. */ export declare const TRANSMITTABLE_FIELDS: Set; /** * Fields that are local-only and must be stripped before transmission. * Matches Python's LOCAL_ONLY_FIELDS. */ export declare const LOCAL_ONLY_FIELDS: Set; export declare class TransmissionError extends Error { constructor(message: string); } export declare class PrivacyViolationError extends TransmissionError { constructor(message: string); } export interface TransmissionPayload { schema_version: string; transmitted_at: string; entry_count: number; entries: Record[]; } export interface TransmissionResult { status: 'sent' | 'cancelled' | 'error'; http_status: number | null; response_body: Record | null; payload_hash: string; } /** * Build a transmission payload from a list of ledger entries. * * Strips all LOCAL_ONLY_FIELDS and any fields not in TRANSMITTABLE_FIELDS. * Runs a paranoia check for sensitive patterns in the resulting payload. * * Matches Python's prepare_transmission() exactly. * * @param entries - List of ledger entry dicts. * @param fieldsToShare - Optional additional field names beyond TRANSMITTABLE_FIELDS. * @returns Filtered payload dict suitable for transmission. * @throws PrivacyViolationError if any value matches a sensitive pattern. */ export declare function prepareTransmission(entries: LedgerEntry[], fieldsToShare?: string[]): TransmissionPayload; /** * Detect sensitive content in a string. Returns matching pattern sources. * * Convenience function for callers that want to pre-screen values. */ export declare function detectSensitiveContent(text: string): string[]; /** * Generate a box-drawing manifest of what will be transmitted. * * Matches Python's generate_manifest() box-drawing format exactly. * * @param transmissionData - Filtered payload from prepareTransmission(). * @param destination - Target URL the data will be sent to. * @returns Multiline string suitable for printing to a terminal. */ export declare function generateManifest(transmissionData: TransmissionPayload, destination: string): string; /** * Generate a plain-text (no box-drawing) manifest for non-TTY output. * * Matches Python's generate_plain_manifest() exactly. */ export declare function generatePlainManifest(transmissionData: TransmissionPayload, destination: string): string; export interface TransmissionLogRecord { timestamp: string; approved: boolean; auto_confirmed: boolean; payload_hash: string; destination: string; http_status: number | null; error: string | null; } /** * Append a transmission record to .forgeos/transmissions.log. * * Append-only log — every attempt is recorded whether approved, * rejected, or errored. Matches Python's _log_transmission(). */ export declare function logTransmission(projectPath: string, approved: boolean, autoConfirmed: boolean, payloadHash: string, destination: string, httpStatus?: number | null, error?: string | null): void; /** * Load allowed endpoints from .forgeos/config.toml. * * Falls back to DEFAULT_ALLOWED_ENDPOINTS if the config file is missing * or unreadable. Uses simple regex parsing (no TOML library dependency). */ export declare function loadAllowedEndpoints(projectPath: string): string[]; /** * Send a transmission payload to a ForgeOS Trust API endpoint. * * Checks the URL against the allowed endpoints list. * Returns a TransmissionResult; all errors are caught and returned as status='error'. * * @param url - Target endpoint URL (must be HTTPS). * @param data - Filtered payload from prepareTransmission(). * @param projectPath - Project root for config and logging. * @param noConfirm - Skip interactive confirmation. * @returns TransmissionResult. * @throws TransmissionError if the URL is not in the allowed list. */ export declare function sendTransmission(url: string, data: TransmissionPayload, projectPath: string, noConfirm?: boolean): Promise; //# sourceMappingURL=transmission.d.ts.map