import type { SharedWorkspaceWatchBrokerLike } from "./workspace-watch-broker.js"; import { AgentProjectScanBudget } from "./agent-project-discovery.js"; export declare const WORKFLOW_SOURCE_OBSERVATION_MAX_PROBES = 10000; /** * Fingerprint of the set of workflow-marker directories under `root` (sorted, * bounded by depth AND by directories visited, ignored subtrees skipped), plus * opaque sentinels for subtrees that are temporarily unreadable or that the * node budget kept the walk out of. Changes when a workflow is added, removed, * renamed, or crosses one of those boundaries — not when unrelated readable * files are edited. Exported for direct testing. * * The synchronous form remains for the session watcher, whose constructor * requires an immediate baseline. Project-graph watchers use the async form * for startup, native-event checks, and polling so a wide Project never walks * synchronously on the server loop. * * `budget` is injectable so a benchmark can read the directories visited off * the same object the walk spends, and so a test can force truncation. Pass the * SAME limits to both forms: the two produce identical fingerprints on one tree * only when their bounds match, and SessionWorkspaceWatcher compares a sync * baseline against an async poll result. */ export declare function snapshotWorkspaceWorkflows(root: string, budget?: AgentProjectScanBudget): string; /** * Async variant for graph watcher baselines/event checks and polling * fallbacks — yields between directories so a wide workspace cannot stutter * the event loop. Produces the same fingerprint as the sync version. Exported * for direct testing. */ export declare function snapshotWorkspaceWorkflowsAsync(root: string, budget?: AgentProjectScanBudget): Promise; export interface WorkflowSourceObservation { candidateRoot: string; workspaceRoot: string; paths: readonly string[]; } export interface WorkflowSourceSnapshotOptions { /** Test seam; production uses one fixed per-workspace observation budget. */ maxObservationProbes?: number; onObservationProbe?: (path: string) => void; /** Counts bounded path candidates considered before confinement/deduping. */ onObservationCandidate?: (path: string) => void; } /** * Select observation envelopes admitted by a containing watcher scope. * A parent watcher needs direct-child observations for rows retained behind a * repository/ignore/stop boundary, while a narrow child must never inherit a * broader parent's sibling probes. */ export declare function sourceObservationsWithinScope(scopeRoot: string, observations: readonly WorkflowSourceObservation[]): WorkflowSourceObservation[]; /** * Bounded metadata snapshots for registered marker roots plus exactly the * module candidates the accepted syntax analyzer observed (including absent * resolution targets). This deliberately does not invent a second recursive * TypeScript traversal policy. */ export declare function snapshotWorkflowSourceRootsAsync(sourceRoots: readonly string[], sourceObservations?: readonly WorkflowSourceObservation[], options?: WorkflowSourceSnapshotOptions): Promise>; export interface WorkspaceWatcherManagerDeps { /** Debounced per-session notification that the workspace's workflow set may * have changed — the integrator re-scans that session's cwd and broadcasts * `workflows.changed` if the list actually changed. */ onChange(harnessSessionId: string, sourceRoots: readonly string[] | null): void | Promise; /** Immediate raw-event fail-close hook; never waits for debounce/fingerprint. */ onPotentialChange?(harnessSessionId: string): void; /** Registered roots are sampled even when a discovered parent stops BFS. */ listSourceRoots?(harnessSessionId: string, cwd: string): readonly string[]; listSourceObservations?(harnessSessionId: string, cwd: string): readonly WorkflowSourceObservation[]; /** Test/debug lifecycle signal; fires only for a newly armed root lease. */ onWatcherStarted?(harnessSessionId: string, cwd: string): void; /** Process-wide lease shared with graph watchers in production. */ sharedWatchBroker?: SharedWorkspaceWatchBrokerLike; } /** Registry of one SessionWorkspaceWatcher per active harness session. */ export declare class WorkspaceWatcherManager { private readonly deps; private readonly watchers; private readonly sharedSubscriptions; constructor(deps: WorkspaceWatcherManagerDeps); /** Idempotent for repeated running/binding frames at the same session root. */ start(harnessSessionId: string, cwd: string): void; stop(harnessSessionId: string): void; stopAll(): void; /** Test/debug helper — how many sessions currently have an active watcher. */ get size(): number; } //# sourceMappingURL=workspace-watcher.d.ts.map