import type { ProtocolDefinition, ProtocolRuleSet } from '@enbox/dwn-sdk-js';
/**
 * Navigates a protocol definition's structure to find the rule set at a given protocol path.
 * @param protocolDefinition - The protocol definition to search
 * @param protocolPath - The dot-separated protocol path (e.g. 'thread/message')
 * @returns The rule set at the given path, or undefined if the path doesn't exist
 */
export declare function getRuleSetAtPath(protocolDefinition: ProtocolDefinition, protocolPath: string): ProtocolRuleSet | undefined;
/**
 * Extracts the root context ID from a contextId or parentContextId.
 * e.g. 'abc/def/ghi' -> 'abc', 'abc' -> 'abc'
 * @param contextId - The context ID to extract the root from
 * @returns The root context ID
 */
export declare function getRootContextId(contextId: string): string;
/**
 * Checks if a protocol path represents a multi-party context.
 * Returns true if the root path's subtree contains $role descendants
 * or relational who/of $actions rules that grant read access.
 *
 * @param protocolDefinition - The full protocol definition
 * @param rootProtocolPath - The root protocol path to check
 * @returns true if the protocol path represents a multi-party context
 */
export declare function isMultiPartyContext(protocolDefinition: ProtocolDefinition, rootProtocolPath: string): boolean;
/**
 * Checks whether any relational who/of rule in the protocol grants
 * read access for a given actor type and ancestor path.
 *
 * Walks the *entire* protocol structure looking for any $actions rule that:
 *   - Has `who` equal to `actorType` ('recipient' or 'author'), or any actor
 *     type if `actorType` is `undefined`
 *   - Has `of` equal to `ofPath`
 *   - Has `can` including 'read'
 *
 * @param actorType  - 'author' | 'recipient', or undefined for any
 * @param ofPath     - The protocol path to check (e.g. 'thread', 'email')
 * @param protocolDefinition - The full protocol definition
 * @returns true if a matching relational read rule exists
 */
export declare function hasRelationalReadAccess(actorType: 'author' | 'recipient' | undefined, ofPath: string, protocolDefinition: ProtocolDefinition): boolean;
/**
 * Analyses a record write to determine which DIDs need context key delivery.
 *
 * Returns a set of participant DIDs that should receive `contextKey` records.
 * The DWN owner (tenantDid) is always excluded — they have ProtocolPath access.
 *
 * Cases handled:
 *   1. `$role` record with a recipient -> recipient is a participant
 *   2. Record has a recipient and a relational read rule grants access
 *      via `{ who: 'recipient', of: '<path>', can: ['read'] }`
 *   3. Record is authored by an external party -> if `{ who: 'author', of:
 *      '<path>', can: ['read'] }` rules grant read access, the author needs
 *      a context key.
 *
 * @param params.protocolDefinition - The installed protocol definition
 * @param params.protocolPath       - The written record's protocol path
 * @param params.recipient          - Recipient DID from the record, if any
 * @param params.tenantDid          - The DWN owner's DID (excluded from results)
 * @param params.authorDid          - Author DID if externally authored, undefined otherwise
 * @returns Set of DIDs that need context key delivery
 */
export declare function detectNewParticipants({ protocolDefinition, protocolPath, recipient, tenantDid, authorDid }: {
    protocolDefinition: ProtocolDefinition;
    protocolPath: string;
    recipient?: string;
    tenantDid: string;
    authorDid?: string;
}): Set<string>;
//# sourceMappingURL=protocol-utils.d.ts.map