import { IntegrationToolDefinition } from './catalog.js';
import { IntegrationRegistryEntry, IntegrationRegistry } from './registry.js';
import { I as IntegrationActor, a as IssuedIntegrationCapability, b as IntegrationConnector, c as IntegrationConnection } from './core-types-CjWifQOf.js';
import './types-Bxg-wJkW.js';

type IntegrationRequirementMode = 'read' | 'write' | 'trigger';
type IntegrationRequirementStatus = 'ready' | 'missing_connection' | 'not_executable' | 'unknown_connector';
interface IntegrationRequirement {
    id: string;
    connectorId: string;
    reason: string;
    mode: IntegrationRequirementMode;
    requiredActions?: string[];
    requiredTriggers?: string[];
    requiredScopes?: string[];
    optional?: boolean;
}
interface IntegrationManifest {
    id: string;
    title?: string;
    owner?: IntegrationActor;
    requirements: IntegrationRequirement[];
    metadata?: Record<string, unknown>;
}
interface IntegrationRequirementResolution {
    requirement: IntegrationRequirement;
    status: IntegrationRequirementStatus;
    connector?: IntegrationConnector;
    registryEntry?: IntegrationRegistryEntry;
    connection?: IntegrationConnection;
    missingScopes: string[];
    missingActions: string[];
    missingTriggers: string[];
    message: string;
}
interface IntegrationManifestResolution {
    manifest: IntegrationManifest;
    owner: IntegrationActor;
    ready: IntegrationRequirementResolution[];
    missing: IntegrationRequirementResolution[];
    optionalMissing: IntegrationRequirementResolution[];
}
interface IntegrationGrant {
    id: string;
    manifestId: string;
    requirementId: string;
    owner: IntegrationActor;
    grantee: IntegrationActor;
    connectionId: string;
    connectorId: string;
    scopes: string[];
    allowedActions: string[];
    allowedTriggers: string[];
    status: 'active' | 'revoked';
    createdAt: string;
    updatedAt: string;
    metadata?: Record<string, unknown>;
}
interface IntegrationGrantStore {
    get(grantId: string): Promise<IntegrationGrant | undefined> | IntegrationGrant | undefined;
    put(grant: IntegrationGrant): Promise<void> | void;
    listByManifest(manifestId: string, grantee?: IntegrationActor): Promise<IntegrationGrant[]> | IntegrationGrant[];
    listByGrantee(grantee: IntegrationActor): Promise<IntegrationGrant[]> | IntegrationGrant[];
    listByIds?(grantIds: string[]): Promise<IntegrationGrant[]> | IntegrationGrant[];
    delete?(grantId: string): Promise<void> | void;
}
interface IntegrationCapabilityBinding {
    requirementId: string;
    connectorId: string;
    connectionId: string;
    grantId: string;
    scopes: string[];
    allowedActions: string[];
    allowedTriggers: string[];
    capability: IssuedIntegrationCapability;
}
interface IntegrationSandboxBundle {
    manifestId: string;
    subject: IntegrationActor;
    capabilities: IntegrationCapabilityBinding[];
    connectors: IntegrationConnector[];
    tools: IntegrationToolDefinition[];
    expiresAt: string;
}
interface IntegrationRuntimeHub {
    listRegistry(): Promise<IntegrationRegistry> | IntegrationRegistry;
    listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]> | IntegrationConnection[];
    getConnection(connectionId: string): Promise<IntegrationConnection | undefined> | IntegrationConnection | undefined;
    issueCapability(input: {
        subject: IntegrationActor;
        connectionId: string;
        scopes: string[];
        allowedActions: string[];
        ttlMs: number;
        metadata?: Record<string, unknown>;
    }): Promise<IssuedIntegrationCapability> | IssuedIntegrationCapability;
}
interface IntegrationRuntimeOptions {
    hub: IntegrationRuntimeHub;
    grants?: IntegrationGrantStore;
    now?: () => Date;
}
declare class InMemoryIntegrationGrantStore implements IntegrationGrantStore {
    private readonly grants;
    get(grantId: string): IntegrationGrant | undefined;
    put(grant: IntegrationGrant): void;
    listByManifest(manifestId: string, grantee?: IntegrationActor): IntegrationGrant[];
    listByGrantee(grantee: IntegrationActor): IntegrationGrant[];
    listByIds(grantIds: string[]): IntegrationGrant[];
    delete(grantId: string): void;
}
declare class IntegrationRuntime {
    private readonly hub;
    private readonly grants;
    private readonly now;
    constructor(options: IntegrationRuntimeOptions);
    registry(): Promise<IntegrationRegistry>;
    resolveManifest(manifest: IntegrationManifest, owner: IntegrationActor): Promise<IntegrationManifestResolution>;
    createGrants(input: {
        manifest: IntegrationManifest;
        owner: IntegrationActor;
        grantee: IntegrationActor;
        metadata?: Record<string, unknown>;
    }): Promise<IntegrationGrant[]>;
    buildSandboxBundle(input: {
        manifestId?: string;
        grantIds?: string[];
        owner: IntegrationActor;
        subject: IntegrationActor;
        ttlMs: number;
        grantee?: IntegrationActor;
    }): Promise<IntegrationSandboxBundle>;
    private resolveBundleGrants;
}
declare function createIntegrationRuntime(options: IntegrationRuntimeOptions): IntegrationRuntime;

export { InMemoryIntegrationGrantStore, type IntegrationCapabilityBinding, type IntegrationGrant, type IntegrationGrantStore, type IntegrationManifest, type IntegrationManifestResolution, type IntegrationRequirement, type IntegrationRequirementMode, type IntegrationRequirementResolution, type IntegrationRequirementStatus, IntegrationRuntime, type IntegrationRuntimeHub, type IntegrationRuntimeOptions, type IntegrationSandboxBundle, createIntegrationRuntime };
