import { ILogger } from '../logger'; import { StoreService } from '../store'; import { ActivityDetail, DependencyExport, ExportOptions, JobActionExport, JobExport, StreamHistoryEntry } from '../../types/exporter'; import { ProviderClient, ProviderTransaction } from '../../types/provider'; import { StringAnyType, StringStringType, Symbols } from '../../types/serializer'; /** * System-level exporter for HotMesh job data. Decodes the flat, symbolized * hash stored in Redis/Postgres into a human-readable {@link JobExport} * with three sections: * * - **process** — a nested object reflecting the activity execution tree. * Each activity's input, output, and metadata are organized by their * dimensional path (e.g., `0/0/worker/output/data`). * - **dependencies** — list of dependent jobs (child workflows, hooks, signals) * spawned during execution. * - **status** — the raw semaphore value from the job hash. * * Optionally, set `enrich_inputs: true` to produce a flat `activities` array * ({@link ActivityDetail}[]) that merges stream message history (inputs, timing, * retries) with process outputs — useful for dashboards and debugging views. * * @remarks * This is the lower-level exporter used by the HotMesh engine directly. * For durable workflow exports, use the `ExporterService` in `services/durable/exporter` * which produces structured timeline and execution history formats. */ declare class ExporterService { appId: string; logger: ILogger; /** @hidden */ store: StoreService; symbols: Promise | Symbols; /** @hidden */ constructor(appId: string, store: StoreService, logger: ILogger); /** * Export a job as a structured {@link JobExport}. * * Reads the raw job hash from the store, inflates symbolized keys into * readable paths, and organizes data into `process`, `dependencies`, * and `status` sections. * * When `enrich_inputs` is true, also fetches stream message history and * produces a flat `activities` array with per-activity input/output, * timing, retry attempts, and cycle iteration info. * * @param jobId - the job ID to export * @param options - controls enrichment behavior */ export(jobId: string, options?: ExportOptions): Promise; /** * Resolve a 3-character symbol key to its full path (e.g., `aBC` → `worker/output/data`). * Returns the key unchanged if no symbol mapping exists. */ inflateKey(key: string): string; /** * Decode a raw job hash into a structured {@link JobExport}. * * Walks every key in the flat hash and classifies it: * - **3-char + dimension** (`aBC,0,0`) — activity process state, organized into * a nested hierarchy by dimension path and symbolized key * - **3-char only** (`aBC`) — top-level job state (done, response, error, etc.) * * The `process` result is a nested tree where dimensions are path segments * (e.g., `{ "0": { "0": { "worker": { "output": { "data": ... } } } } }`). * * @param jobHash - the raw key-value hash from the store * @param dependencyList - raw dependency strings from the store * @returns structured export with process tree, dependencies, and status */ inflate(jobHash: StringStringType, dependencyList: string[]): JobExport; /** * Build structured activity details by correlating stream messages * (inputs, timing, retries) with the process hierarchy (outputs). * * Stream messages carry the raw data that flowed through each activity: * - `data` contains the activity input arguments * - `dad` (dimensional address) reveals cycle iterations (e.g., ,0,1,0 = 2nd cycle) * - `created_at` / `expired_at` give precise timing * - `retry_attempt` tracks retries * * The process hierarchy carries activity outputs organized by dimension. * This method merges both into a flat, dashboard-friendly list. */ buildActivities(process: StringAnyType, streamHistory: StreamHistoryEntry[]): ActivityDetail[]; /** * Parse raw dependency strings into structured {@link DependencyExport} entries. * * Each dependency string encodes the action type, topic, group ID, and job ID * of a spawned sub-job (child workflow, hook, or signal cleanup). The job ID * suffix reveals whether it originated from a hook (dimensional address + counter) * or the main flow (counter only). * * @param data - raw dependency strings from the store * @param actions - accumulator for action tracking (hooks vs main flow) * @returns structured dependency list */ inflateDependencyData(data: string[], actions: JobActionExport): DependencyExport[]; } export { ExporterService };