import type { GitRepoIdentity } from '../../git/git-types.js';
import type { MedFamilyHandler } from './types.js';
/**
 * Decision for syncing a freshly-cloned worktree's `oss` submodule to its clone
 * source node, applying resolveWorktreeBaseStartPoint's origin-tip-priority
 * policy to the submodule.
 *
 * On clone, `submodule update --init` checks the worktree's `oss` out at the
 * gitlink recorded in the FRESH root base — which the root base-stale fix
 * branches from origin/main, so it is the up-to-date origin tip. The clone
 * source node's *working* `oss` SHA can lag that tip. The original sync blindly
 * checked out the source SHA whenever it merely differed, which REWINDS the
 * submodule back onto the stale source and re-introduces staleness.
 *
 * Guard policy (never rewind, mirror the base-start-point resolver):
 *   - source SHA == worktree SHA            → `noop`
 *   - source SHA is an ancestor of worktree → `skip_rewind`  (source is behind; keep fresh tip)
 *   - worktree SHA is an ancestor of source → `advance`      (source strictly newer; safe fast-forward)
 *   - neither is an ancestor (diverged)     → `skip_diverged` (keep fresh tip; coordinator reconciles)
 *
 * Both SHAs must already be resolvable in `ossCtx` (the caller fetches the
 * source SHA first). A non-1 git exit (unresolvable SHA / real failure) is
 * rethrown so the caller can fall back to keeping the fresh worktree HEAD.
 */
export type OssCloneSyncAction = 'noop' | 'advance' | 'skip_rewind' | 'skip_diverged';
export declare function decideOssCloneSync(ossCtx: GitRepoIdentity, worktreeOssSha: string, sourceSha: string, rg: (ctx: GitRepoIdentity, argv: string[], opts?: {
    timeoutMs?: number;
}) => Promise<unknown>): Promise<OssCloneSyncAction>;
/**
 * Sync every registered submodule of a freshly-cloned worktree to its clone source
 * node's working submodule HEAD, applying decideOssCloneSync's origin-tip-priority
 * rewind guard per submodule.
 *
 * Generic over the submodule set: the paths come from `.gitmodules` via
 * getRegisteredSubmodulePaths, so this operates identically over EVERY registered
 * submodule (oss, adhdev-providers, …) instead of a hardcoded 'oss' literal. In a
 * repo whose only synced submodule is `oss` the emitted git commands are byte-identical
 * to the original oss-only path.
 *
 * Best-effort by design: a failure on one submodule is logged and skipped; it never
 * blocks the other submodules or the clone. A submodule is only ever advanced to a
 * STRICTLY-NEWER source SHA — the fresh (origin/main-derived) worktree tip is never
 * rewound onto a behind/diverged source.
 */
export declare function syncClonedWorktreeSubmodules(worktreePath: string, sourceWorkspace: string, rg: (ctx: GitRepoIdentity, argv: string[], opts?: {
    timeoutMs?: number;
}) => Promise<unknown>): Promise<void>;
export declare const meshCrudHandlers: Record<string, MedFamilyHandler>;
