import type { FileSystem } from '../infra/filesystem.js';
import { type DomainError } from '../shared/errors.js';
import { type Result } from '../shared/result.js';
export interface LogLine {
    readonly ts: string | null;
    readonly worker: number | null;
    readonly level: 'debug' | 'info' | 'warn' | 'error' | 'trace';
    readonly msg: string;
    readonly raw: string;
    readonly project?: string;
}
export interface LogQueryOpts {
    project: string;
    worker?: number;
    limit?: number;
    /** ISO datetime string —— 只返时间 >= since 的行 */
    since?: string;
}
export interface LogQueryResult {
    readonly data: LogLine[];
    readonly file: string | null;
    readonly files: string[];
}
export interface AggregateOpts {
    worker?: number;
    limit?: number;
    since?: string;
}
export interface AggregateResult {
    readonly data: LogLine[];
    readonly files: string[];
}
export interface WorkerLogLine {
    readonly ts: string | null;
    readonly level: string;
    readonly msg: string;
}
export interface AcpSessionLine {
    readonly ts: string | null;
    readonly kind: string;
    readonly text: string;
}
export interface LogServiceDeps {
    readonly fs: FileSystem;
}
export declare class LogService {
    private readonly deps;
    constructor(deps: LogServiceDeps);
    /** 单项目 tail。 */
    tail(opts: LogQueryOpts): Promise<Result<LogQueryResult, DomainError>>;
    /** 跨项目聚合 tail。 */
    aggregate(opts?: AggregateOpts): Promise<Result<AggregateResult, DomainError>>;
    /**
     * v0.50.17：Worker 详情面板专用 tail——读 pipeline-<date>.log 里带 [worker-N] 标签
     * 的行，结构化出来。原来在 `routes/workers.ts:readWorkerLogTail`，违反层级，搬到这。
     */
    tailWorkerSupervisorLog(project: string, slot: number, limit?: number): Promise<WorkerLogLine[]>;
    /**
     * v0.50.17：Claude 实际输出 tail——读 `sps-acp-<project>-worker-<N>-acp-<ts>.log`
     * 里 SessionUpdateAccumulator.appendLog 写的结构化行。原来在 `routes/workers.ts:
     * readAcpSessionLogTail`，搬到这。
     */
    tailAcpSession(project: string, slot: number, limit?: number): Promise<AcpSessionLine[]>;
    /**
     * v0.50.17：聚合页单条 "lastLogLine"——找最近一条带 [worker-N] 标签的日志。
     * 比 tailWorkerSupervisorLog 轻量，只要 1 条，扫描 512KB 尾部就够。
     */
    latestWorkerLogLine(project: string, slot: number): Promise<{
        ts: string | null;
        msg: string;
    } | null>;
    private findLogFiles;
}
export declare function parseLogLine(raw: string): LogLine;
export declare function parseSupervisorLogLine(raw: string): WorkerLogLine;
export declare function parseAcpSessionLine(raw: string): AcpSessionLine;
//# sourceMappingURL=LogService.d.ts.map