/** * Event claiming system for multi-agent coordination. * * When multiple agent sessions run concurrently (e.g., different claude-rig * setups), they all receive the same plugin notifications. Notifications are * fine — but when a plugin's autonomy level says "act", only ONE agent should * act. Claims prevent duplicate work. * * Design: * ~/.cache/agent-awareness/claims//.json * Each claim file contains: { holder, pid, claimedAt, expiresAt } * Claim access is serialized per event via lock directories: * .json.lock (atomic mkdir + stale-lock cleanup) * Expired or dead-PID claims are auto-cleaned on access * * Plugins call context.claims.tryClaimEvent(key) before rendering "act"-level * directives. If claimed by another session, downgrade to "notify". */ export interface ClaimInfo { /** Identifier: hostname:pid */ holder: string; pid: number; claimedAt: string; expiresAt: string; } export interface ClaimResult { claimed: boolean; /** If not claimed, who holds it. */ holder?: string; } /** * Claims context scoped to a plugin. * Passed to plugins via GatherContext so they can coordinate across sessions. */ export interface ClaimContext { /** * Try to claim an event. Returns true if this session now owns it. * If another live session holds the claim, returns false. * Expired or dead-PID claims are automatically reclaimed. * * @param eventKey — unique event identifier (e.g., "vercel/next.js#4521:checks_failed") * @param ttlMinutes — how long the claim lives (default: 30) */ tryClaim(eventKey: string, ttlMinutes?: number): Promise; /** * Check if an event is claimed by another session. * Does NOT create a claim. */ isClaimedByOther(eventKey: string): Promise; /** * Release a claim held by this session. */ release(eventKey: string): Promise; } /** * Create a ClaimContext scoped to a specific plugin. */ export declare function createClaimContext(pluginName: string): ClaimContext; /** * Clean up all expired or dead-holder claims. * Called periodically (e.g., at session start). */ export declare function pruneExpiredClaims(): Promise;