import { PlanManager } from '../../manager/plan/lifecycle.js';
import { RunPersistence } from '../../manager/run/persistence.js';
import { type FilesystemMigrationResult, type FilesystemMigrationSink, type FilesystemMigrator } from '../../session/migration/index.js';
import { type PathBuilder } from '../../session/workspace/path-builder.js';
import { ActivityStore } from '../../store/activity/memory.js';
import { type ActivityTrackingConfig } from '../../types/activity/index.js';
import type { RunId, SessionId, TenantId } from '../../types/ids/index.js';
import type { Message } from '../../types/message/index.js';
import type { PermissionMode } from '../../types/permission/index.js';
import type { LLMProvider } from '../../types/provider/index.js';
import type { AgentRunConfig } from '../../types/run/index.js';
import type { ProjectId, ThreadId } from '../../types/session/ids.js';
import type { ModelPricing } from '../../utils/cost.js';
import { type Logger } from '../../utils/logger.js';
/**
 * Config accepted by {@link RunContextFactory.build}. `sessionId`,
 * `threadId`, `projectId`, and `tenantId` are required — runs carry the full
 * five-layer scope (Tenant → Project → Thread → Session → Run) per
 * Convention #17.
 *
 * `pathBuilder` is optional; when absent a {@link DefaultPathBuilder} is
 * constructed against `{workingDirectory}/.namzu`.
 *
 * `filesystemMigrator` + `migrationSink` are optional; when absent a
 * {@link DefaultFilesystemMigrator} wired to the
 * {@link NOOP_FILESYSTEM_MIGRATION_SINK} is used. Migration runs once per
 * process via {@link RunContextFactory.ensureMigrated}; the static `build`
 * method stays synchronous so existing call sites are not broken — async
 * callers (e.g. `query()`) invoke `ensureMigrated` themselves before build.
 */
export interface RunContextConfig {
    agentId: string;
    agentName: string;
    runConfig: AgentRunConfig;
    provider: LLMProvider;
    workingDirectory?: string;
    pricing?: ModelPricing;
    enableActivityTracking?: boolean;
    messages: Message[];
    signal?: AbortSignal;
    sessionId: SessionId;
    threadId: ThreadId;
    projectId: ProjectId;
    tenantId: TenantId;
    pathBuilder?: PathBuilder;
    /**
     * Optional injected migrator — tests pass a stub; production code relies
     * on the {@link DefaultFilesystemMigrator}. See session-hierarchy.md
     * §13.4.1.
     */
    filesystemMigrator?: FilesystemMigrator;
    /** Optional sink for `filesystem.migrated` events. Defaults to no-op. */
    migrationSink?: FilesystemMigrationSink;
    runId?: RunId;
    parentRunId?: RunId;
    depth?: number;
}
/** Result of {@link RunContextFactory.build}. */
export interface RunContext {
    runId: RunId;
    sessionId: SessionId;
    threadId: ThreadId;
    projectId: ProjectId;
    tenantId: TenantId;
    runMgr: RunPersistence;
    activityStore: ActivityStore;
    planManager: PlanManager;
    abortController: AbortController;
    cwd: string;
    outputDir: string;
    permissionMode: PermissionMode;
    log: Logger;
    trackingConfig: ActivityTrackingConfig;
}
export declare class RunContextFactory {
    /**
     * Run the boot-time filesystem migration for `rootDir` at most once per
     * process. Safe to `await` from any async entry point; concurrent callers
     * for the same root share a single migration promise (no duplicate work,
     * no race with the on-disk `.tmp` lock).
     */
    static ensureMigrated(rootDir: string, migrator?: FilesystemMigrator): Promise<FilesystemMigrationResult>;
    static build(config: RunContextConfig): RunContext;
}
//# sourceMappingURL=context.d.ts.map