import { z } from 'zod';

declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
    active: "active";
    deprecated: "deprecated";
    archived: "archived";
}>;
declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    id: z.ZodString;
    order: z.ZodDefault<z.ZodNumber>;
    systemPath: z.ZodString;
    title: z.ZodOptional<z.ZodString>;
    description: z.ZodOptional<z.ZodString>;
    ownerRoleId: z.ZodOptional<z.ZodString>;
    status: z.ZodEnum<{
        active: "active";
        deprecated: "deprecated";
        archived: "archived";
    }>;
    ontology: z.ZodOptional<z.ZodObject<{
        actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
        primaryAction: z.ZodOptional<z.ZodString>;
        reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
        writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
        usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
        emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
        contract: z.ZodOptional<z.ZodObject<{
            input: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
        path: z.ZodString;
        role: z.ZodEnum<{
            entrypoint: "entrypoint";
            handler: "handler";
            schema: "schema";
            test: "test";
            docs: "docs";
            config: "config";
        }>;
        symbol: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
    kind: z.ZodLiteral<"workflow">;
    emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
        eventKey: z.ZodString;
        label: z.ZodString;
        payloadSchema: z.ZodOptional<z.ZodString>;
        lifecycle: z.ZodOptional<z.ZodEnum<{
            active: "active";
            deprecated: "deprecated";
            draft: "draft";
            beta: "beta";
            archived: "archived";
        }>>;
    }, z.core.$strip>>>;
}, z.core.$strip>, z.ZodObject<{
    id: z.ZodString;
    order: z.ZodDefault<z.ZodNumber>;
    systemPath: z.ZodString;
    title: z.ZodOptional<z.ZodString>;
    description: z.ZodOptional<z.ZodString>;
    ownerRoleId: z.ZodOptional<z.ZodString>;
    status: z.ZodEnum<{
        active: "active";
        deprecated: "deprecated";
        archived: "archived";
    }>;
    ontology: z.ZodOptional<z.ZodObject<{
        actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
        primaryAction: z.ZodOptional<z.ZodString>;
        reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
        writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
        usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
        emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
        contract: z.ZodOptional<z.ZodObject<{
            input: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
        path: z.ZodString;
        role: z.ZodEnum<{
            entrypoint: "entrypoint";
            handler: "handler";
            schema: "schema";
            test: "test";
            docs: "docs";
            config: "config";
        }>;
        symbol: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
    kind: z.ZodLiteral<"agent">;
    agentKind: z.ZodEnum<{
        platform: "platform";
        orchestrator: "orchestrator";
        specialist: "specialist";
        utility: "utility";
    }>;
    actsAsRoleId: z.ZodOptional<z.ZodString>;
    sessionCapable: z.ZodBoolean;
    invocations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        kind: z.ZodLiteral<"slash-command">;
        command: z.ZodString;
        toolFactory: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        kind: z.ZodLiteral<"mcp-tool">;
        server: z.ZodString;
        name: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        kind: z.ZodLiteral<"api-endpoint">;
        method: z.ZodEnum<{
            GET: "GET";
            POST: "POST";
            PATCH: "PATCH";
            DELETE: "DELETE";
        }>;
        path: z.ZodString;
        requestSchema: z.ZodOptional<z.ZodString>;
        responseSchema: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        kind: z.ZodLiteral<"script-execution">;
        resourceId: z.ZodString;
    }, z.core.$strip>], "kind">>>;
    emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
        eventKey: z.ZodString;
        label: z.ZodString;
        payloadSchema: z.ZodOptional<z.ZodString>;
        lifecycle: z.ZodOptional<z.ZodEnum<{
            active: "active";
            deprecated: "deprecated";
            draft: "draft";
            beta: "beta";
            archived: "archived";
        }>>;
    }, z.core.$strip>>>;
}, z.core.$strip>, z.ZodObject<{
    id: z.ZodString;
    order: z.ZodDefault<z.ZodNumber>;
    systemPath: z.ZodString;
    title: z.ZodOptional<z.ZodString>;
    description: z.ZodOptional<z.ZodString>;
    ownerRoleId: z.ZodOptional<z.ZodString>;
    status: z.ZodEnum<{
        active: "active";
        deprecated: "deprecated";
        archived: "archived";
    }>;
    ontology: z.ZodOptional<z.ZodObject<{
        actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
        primaryAction: z.ZodOptional<z.ZodString>;
        reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
        writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
        usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
        emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
        contract: z.ZodOptional<z.ZodObject<{
            input: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
        path: z.ZodString;
        role: z.ZodEnum<{
            entrypoint: "entrypoint";
            handler: "handler";
            schema: "schema";
            test: "test";
            docs: "docs";
            config: "config";
        }>;
        symbol: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
    kind: z.ZodLiteral<"integration">;
    provider: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    id: z.ZodString;
    order: z.ZodDefault<z.ZodNumber>;
    systemPath: z.ZodString;
    title: z.ZodOptional<z.ZodString>;
    description: z.ZodOptional<z.ZodString>;
    ownerRoleId: z.ZodOptional<z.ZodString>;
    status: z.ZodEnum<{
        active: "active";
        deprecated: "deprecated";
        archived: "archived";
    }>;
    ontology: z.ZodOptional<z.ZodObject<{
        actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
        primaryAction: z.ZodOptional<z.ZodString>;
        reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
        writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
        usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
        emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
        contract: z.ZodOptional<z.ZodObject<{
            input: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
    codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
        path: z.ZodString;
        role: z.ZodEnum<{
            entrypoint: "entrypoint";
            handler: "handler";
            schema: "schema";
            test: "test";
            docs: "docs";
            config: "config";
        }>;
        symbol: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
    kind: z.ZodLiteral<"script">;
    language: z.ZodEnum<{
        shell: "shell";
        sql: "sql";
        typescript: "typescript";
        python: "python";
    }>;
    source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
        file: z.ZodString;
    }, z.core.$strip>]>;
}, z.core.$strip>], "kind">;
type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
type ResourceEntry = z.infer<typeof ResourceEntrySchema>;

declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
    objectTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        storage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$loose>>>>;
    linkTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        from: z.ZodString;
        to: z.ZodString;
        cardinality: z.ZodOptional<z.ZodString>;
        via: z.ZodOptional<z.ZodString>;
    }, z.core.$loose>>>>;
    actionTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
        input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
    }, z.core.$loose>>>>;
    catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        kind: z.ZodOptional<z.ZodString>;
        appliesTo: z.ZodOptional<z.ZodString>;
        entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$loose>>>>;
    eventTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$loose>>>>;
    interfaceTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, z.core.$loose>>>>;
    valueTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        primitive: z.ZodOptional<z.ZodString>;
    }, z.core.$loose>>>>;
    sharedProperties: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        valueType: z.ZodOptional<z.ZodString>;
        searchable: z.ZodOptional<z.ZodBoolean>;
        pii: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$loose>>>>;
    groups: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        members: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
    }, z.core.$loose>>>>;
    endpoints: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
        id: z.ZodString;
        label: z.ZodOptional<z.ZodString>;
        description: z.ZodOptional<z.ZodString>;
        ownerSystemId: z.ZodOptional<z.ZodString>;
        aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
        route: z.ZodOptional<z.ZodString>;
    }, z.core.$loose>>>>;
}, z.core.$strip>>;
type OntologyScope = z.infer<typeof OntologyScopeSchema>;

declare const SystemApiInterfaceSchema: z.ZodObject<{
    lifecycle: z.ZodDefault<z.ZodEnum<{
        active: "active";
        deprecated: "deprecated";
        draft: "draft";
        archived: "archived";
        disabled: "disabled";
    }>>;
    readinessProfile: z.ZodOptional<z.ZodEnum<{
        "sales.lead-gen.api": "sales.lead-gen.api";
        "sales.crm.api": "sales.crm.api";
        "sales.lead-gen.crm-handoff": "sales.lead-gen.crm-handoff";
    }>>;
    resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
}, z.core.$strict>;
type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | JsonValue[] | {
    [key: string]: JsonValue;
};
/** Explicit interface needed to annotate the recursive SystemEntrySchema. */
interface SystemEntry {
    id: string;
    label?: string;
    title?: string;
    description?: string;
    kind?: 'product' | 'operational' | 'platform' | 'diagnostic';
    parentSystemId?: string;
    ui?: {
        path: string;
        surfaces: string[];
        icon?: string;
        order?: number;
    };
    lifecycle?: 'draft' | 'beta' | 'active' | 'deprecated' | 'archived';
    responsibleRoleId?: string;
    governedByKnowledge?: string[];
    actions?: {
        actionId: string;
        intent: 'exposes' | 'consumes';
        invocation?: unknown;
    }[];
    policies?: string[];
    drivesGoals?: string[];
    apiInterface?: z.infer<typeof SystemApiInterfaceSchema>;
    /** @deprecated Use lifecycle. Accepted for one publish cycle. */
    status?: 'active' | 'deprecated' | 'archived';
    path?: string;
    icon?: string;
    uiPosition?: 'sidebar-primary' | 'sidebar-bottom';
    enabled?: boolean;
    devOnly?: boolean;
    requiresAdmin?: boolean;
    order: number;
    config?: Record<string, JsonValue>;
    ontology?: OntologyScope;
    systems?: Record<string, SystemEntry>;
    subsystems?: Record<string, SystemEntry>;
}

declare const LinkSchema: z.ZodObject<{
    nodeId: z.ZodString;
    kind: z.ZodEnum<{
        affects: "affects";
        actions: "actions";
        effects: "effects";
        links: "links";
        reads: "reads";
        writes: "writes";
        emits: "emits";
        triggers: "triggers";
        uses: "uses";
        approval: "approval";
        contains: "contains";
        references: "references";
        maps_to: "maps_to";
        governs: "governs";
        originates_from: "originates_from";
        applies_to: "applies_to";
        uses_catalog: "uses_catalog";
    }>;
}, z.core.$strip>;
type Link = z.infer<typeof LinkSchema>;

/**
 * Supported integration types
 *
 * These represent the available integration adapters that can be used with tools.
 * Each integration type corresponds to an adapter implementation.
 *
 * Note: Concrete adapter implementations are deferred until needed.
 * This type provides compile-time safety and auto-completion for tool definitions.
 */
type IntegrationType = 'gmail' | 'google-sheets' | 'slack' | 'github' | 'linear' | 'attio' | 'airtable' | 'salesforce' | 'hubspot' | 'stripe' | 'twilio' | 'sendgrid' | 'mailgun' | 'zapier' | 'webhook' | 'apify' | 'instantly' | 'resend' | 'signature-api' | 'dropbox' | 'anymailfinder' | 'tomba' | 'millionverifier';

/**
 * Resource Registry type definitions
 */

/**
 * Environment/deployment status for resources
 */
type ResourceStatus = 'dev' | 'prod';
/**
 * All resource types in the platform
 * Used as the discriminator field in ResourceDefinition
 */
type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human';
type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'description' | 'kind' | 'lifecycle'>;
/**
 * Base interface for ALL platform resources
 * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
 */
interface ResourceDefinition {
    /** Unique resource identifier */
    resourceId: string;
    /** Display name */
    name: string;
    /** Purpose and functionality description */
    description: string;
    /** Version for change tracking and evolution */
    version: string;
    /** Resource type discriminator */
    type: ResourceType;
    /** Environment/deployment status */
    status: ResourceStatus;
    /** Graph links to Organization Model nodes */
    links?: ResourceLink[];
    /** Infrastructure category for filtering */
    category?: ResourceCategory;
    /** Whether the agent supports multi-turn sessions (agents only) */
    sessionCapable?: boolean;
    /** Whether the resource is local (monorepo) or remote (externally deployed) */
    origin?: 'local' | 'remote';
    /** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
    systemPath?: string;
    /** Display metadata for the owning OM System */
    system?: ResourceSystemSummary;
    /** Governance lifecycle status from the OM Resource descriptor */
    governanceStatus?: ResourceGovernanceStatus;
    /** Whether this resource is archived and should be excluded from registration and deployment */
    archived?: boolean;
}
/** Webhook provider identifiers */
type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test';
/** Webhook trigger configuration */
interface WebhookTriggerConfig {
    /** Provider identifier */
    provider: WebhookProviderType;
    /** Event type for documentation (not used for matching - workflow handles routing) */
    event?: string;
    /** Optional filtering (e.g., specific form ID for Fillout) */
    filter?: Record<string, string>;
    /** References credential in credentials table for per-org webhook secrets */
    credentialName?: string;
}
/** Schedule trigger configuration */
interface ScheduleTriggerConfig {
    /** Cron expression (e.g., '0 6 * * *') */
    cron: string;
    /** Optional timezone (default: UTC) */
    timezone?: string;
}
/** Event trigger configuration */
interface EventTriggerConfig {
    /** Internal event type */
    eventType: string;
    /** Event source */
    source?: string;
}
/** Union of all trigger configs */
type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig;
/**
 * Trigger metadata - entry points that initiate resource execution
 *
 * Triggers represent how executions start: webhooks from external services,
 * scheduled cron jobs, platform events, or manual user actions.
 *
 * BREAKING CHANGES (2025-11-30):
 * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
 * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
 * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
 * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
 * - triggers object now includes `externalResources` option
 *
 * @example
 * // TriggerDefinition - metadata only
 * {
 *   resourceId: 'trigger-new-order',
 *   type: 'trigger',
 *   triggerType: 'webhook',
 *   name: 'New Order',
 *   description: 'Webhook from Shopify on new orders',
 *   version: '1.0.0',
 *   status: 'prod',
 *   webhookPath: '/webhooks/shopify/orders'
 * }
 *
 * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
 * // relationships: {
 * //   'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
 * // }
 */
interface TriggerDefinition extends ResourceDefinition {
    /** Resource type discriminator (narrowed from base union) */
    type: 'trigger';
    /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
    triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
    /** Type-specific configuration */
    config?: TriggerConfig;
    /** For webhook triggers: path like '/webhooks/shopify/orders' */
    webhookPath?: string;
    /** For schedule triggers: cron expression like '0 6 * * *' */
    schedule?: string;
    /** For event triggers: event type like 'low-stock-alert' */
    eventType?: string;
}
/**
 * Integration metadata - external service connections
 *
 * References credentials table for actual connection. No connection status
 * stored here (queried at runtime from credentials table).
 *
 * BREAKING CHANGES (2025-11-30):
 * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
 * - Field renames: `id` -> `resourceId` (inherited)
 * - New required field: `status` (inherited) - organizations must add status to all integrations
 * - New required field: `version` (inherited) - organizations must add version to all integrations
 * - New required field: `type: 'integration'` (inherited) - resource type discriminator
 *
 * @example
 * {
 *   resourceId: 'integration-shopify-prod',
 *   type: 'integration',
 *   provider: 'shopify',
 *   credentialName: 'shopify-prod',
 *   name: 'Shopify Production',
 *   description: 'E-commerce platform',
 *   version: '1.0.0',
 *   status: 'prod'
 * }
 */
interface IntegrationDefinition extends ResourceDefinition {
    /** Resource type discriminator (narrowed from base union) */
    type: 'integration';
    /** OM descriptor that owns canonical identity and governance metadata. */
    resource?: Extract<ResourceEntry, {
        kind: 'integration';
    }>;
    /** Integration provider type */
    provider: IntegrationType;
    /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
    credentialName: string;
}
/**
 * External platform type
 * Supported third-party automation platforms
 */
type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other';
/**
 * External automation resource metadata
 *
 * Represents workflows/automations running on third-party platforms
 * (n8n, Make, Zapier, etc.) for visualization in Command View.
 *
 * NOTE: This is metadata ONLY for visualization. No execution logic,
 * no API integration with external platforms, no status syncing.
 *
 * BREAKING CHANGES (2025-11-30):
 * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
 * - Field renames: `id` -> `resourceId` (inherited)
 * - New required field: `version` (inherited) - organizations must add version to all external resources
 * - New required field: `type: 'external'` (inherited) - resource type discriminator
 * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
 *
 * @example
 * {
 *   resourceId: 'external-n8n-order-sync',
 *   type: 'external',
 *   version: '1.0.0',
 *   platform: 'n8n',
 *   name: 'Shopify Order Sync',
 *   description: 'Legacy n8n workflow for syncing Shopify orders',
 *   status: 'prod',
 *   platformUrl: 'https://n8n.client.com/workflow/123',
 *   triggers: { workflows: ['order-fulfillment-workflow'] },
 *   uses: { integrations: ['integration-shopify-prod'] }
 * }
 */
interface ExternalResourceDefinition extends ResourceDefinition {
    /** Resource type discriminator (narrowed from base union) */
    type: 'external';
    /** Platform type */
    platform: ExternalPlatform;
    /** Link to external platform (e.g., n8n workflow editor URL) */
    platformUrl?: string;
    /** Platform's internal ID/reference */
    externalId?: string;
    /** What this external resource triggers (external -> internal) */
    triggers?: {
        /** Elevasis workflow resourceIds this external automation triggers */
        workflows?: string[];
        /** Elevasis agent resourceIds this external automation triggers */
        agents?: string[];
    };
    /** Integrations this external resource uses (shared credentials) */
    uses?: {
        /** Integration IDs this external automation uses */
        integrations?: string[];
    };
}
/**
 * Human Checkpoint definition - human decision points in automation
 *
 * Represents where human judgment is deployed in the automation landscape.
 * Tasks with matching command_queue_group are routed to this checkpoint.
 *
 * BREAKING CHANGES (2025-11-30):
 * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
 * - Field renames: `id` -> `resourceId` (inherited)
 * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
 * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
 * - New required field: `type: 'human'` (inherited) - resource type discriminator
 *
 * @example
 * {
 *   resourceId: 'sales-approval',
 *   type: 'human',
 *   name: 'Sales Approval Queue',
 *   description: 'High-value order approvals for sales team',
 *   version: '1.0.0',
 *   status: 'prod',
 *   requestedBy: { agents: ['order-processor-agent'] },
 *   routesTo: { agents: ['order-fulfillment-agent'] }
 * }
 */
interface HumanCheckpointDefinition extends ResourceDefinition {
    /** Resource type discriminator (narrowed from base union) */
    type: 'human';
    /** Resources that create tasks for this checkpoint */
    requestedBy?: {
        /** Agent resourceIds that request approval here */
        agents?: string[];
        /** Workflow resourceIds that request approval here */
        workflows?: string[];
    };
    /** Resources that receive approved decisions */
    routesTo?: {
        /** Agent resourceIds that handle approved tasks */
        agents?: string[];
        /** Workflow resourceIds that handle approved tasks */
        workflows?: string[];
    };
}

/**
 * Command View Types
 *
 * Unified type definitions for the Command View graph visualization.
 * These types are used by both backend serialization and frontend rendering.
 *
 * Command View shows the resource graph: agents, workflows, triggers, integrations,
 * external resources, and human checkpoints with their relationships.
 */

/**
 * Extended agent metadata for Command View
 * Includes model and capability information for graph display
 */
interface CommandViewAgent extends ResourceDefinition {
    type: 'agent';
    modelProvider: string;
    modelId: string;
    toolCount: number;
    hasKnowledgeMap: boolean;
    hasMemory: boolean;
    sessionCapable: boolean;
}
/**
 * Extended workflow metadata for Command View
 * Includes step information for graph display
 */
interface CommandViewWorkflow extends ResourceDefinition {
    type: 'workflow';
    stepCount: number;
    entryPoint: string;
}
/**
 * Relationship types between resources
 *
 * - triggers: Resource initiates/starts another resource (orange)
 * - uses: Resource uses an integration (teal)
 * - approval: Resource requires human approval (yellow)
 */
type RelationshipType$1 = 'triggers' | 'uses' | 'approval';
/**
 * Command View edge (relationship between resources)
 */
interface CommandViewEdge$1 {
    id: string;
    source: string;
    target: string;
    relationship: RelationshipType$1;
    label?: string;
}
/**
 * Command View data structure
 * Complete graph data for visualization
 *
 * Backend serializes this once at startup and serves it via /command-view endpoint.
 * Frontend consumes this directly for graph rendering.
 */
interface CommandViewData {
    workflows: CommandViewWorkflow[];
    agents: CommandViewAgent[];
    triggers: TriggerDefinition[];
    integrations: IntegrationDefinition[];
    externalResources: ExternalResourceDefinition[];
    humanCheckpoints: HumanCheckpointDefinition[];
    edges: CommandViewEdge$1[];
}

declare const ResourceCategorySchema: z.ZodEnum<{
    diagnostic: "diagnostic";
    production: "production";
    internal: "internal";
    testing: "testing";
}>;
type ResourceCategory = z.infer<typeof ResourceCategorySchema>;
type ResourceLink = Link;

/**
 * Command View Types
 *
 * Frontend graph types for React Flow rendering.
 *
 * Backend API returns CommandViewData with separate arrays (workflows[], agents[], etc.)
 * Frontend transforms this to CommandViewGraph with unified nodes[] array.
 *
 * @see transformCommandViewData for the mapping logic
 * @see CommandViewData from @repo/core for backend type
 */

/**
 * Base resource node - common fields for all resources
 */
interface BaseResourceNode {
    id: string;
    name: string;
    description: string;
    status: ResourceStatus;
    stats?: {
        totalRuns: number;
        successCount: number;
        failureCount: number;
        warningCount: number;
        lastRunAt: string | null;
    } | null;
}
/**
 * Agent node - autonomous AI agents
 */
interface AgentNode extends BaseResourceNode {
    type: 'agent';
    modelProvider: string;
    modelId: string;
    toolCount: number;
    hasKnowledgeMap: boolean;
    hasMemory: boolean;
}
/**
 * Workflow node - multi-step orchestrations
 */
interface WorkflowNode extends BaseResourceNode {
    type: 'workflow';
    stepCount: number;
    entryPoint: string;
}
/**
 * Integration node - external service connections
 */
interface IntegrationNode extends BaseResourceNode {
    type: 'integration';
    provider: string;
    connectionStatus: 'connected' | 'disconnected' | 'error';
    credentialName?: string;
}
/**
 * Trigger node - what initiates executions
 */
interface TriggerNode extends BaseResourceNode {
    type: 'trigger';
    triggerType: 'webhook' | 'schedule' | 'manual' | 'event';
    schedule?: string;
    webhookPath?: string;
}
/**
 * External resource node - third-party automation platforms
 */
interface ExternalResourceNode extends BaseResourceNode {
    type: 'external';
    platform: 'n8n' | 'make' | 'zapier' | 'other';
    platformUrl?: string;
    externalId?: string;
}
/**
 * Human node - approval points requiring human decisions
 */
interface HumanNode extends Omit<BaseResourceNode, 'stats'> {
    type: 'human';
    stats?: {
        pendingCount: number;
        completedCount: number;
        expiredCount: number;
        lastDecisionAt: string | null;
    } | null;
}
/**
 * Union type for all node types
 */
type CommandViewNode = AgentNode | WorkflowNode | IntegrationNode | TriggerNode | ExternalResourceNode | HumanNode;
/**
 * Relationship types between resources
 */
type RelationshipType = 'triggers' | 'uses' | 'approval';
/**
 * Edge representing a relationship
 */
interface CommandViewEdge {
    id: string;
    source: string;
    target: string;
    relationship: RelationshipType;
    label?: string;
}
/**
 * Complete graph data for visualization
 */
interface CommandViewGraph {
    nodes: CommandViewNode[];
    edges: CommandViewEdge[];
}

/**
 * Transform backend CommandViewData to frontend CommandViewGraph
 *
 * Backend returns separate arrays (workflows[], agents[], triggers[], integrations[])
 * Frontend needs unified nodes[] array with consistent id field.
 *
 * Key mappings:
 * - Agent/Workflow: resourceId -> id
 * - Trigger/Integration/External/Human: resourceId -> id (updated to use resourceId after base interface refactor)
 * - connectionStatus: defaulted to 'connected' (runtime status not yet available)
 */
declare function transformCommandViewData(data: CommandViewData): CommandViewGraph;

export { transformCommandViewData };
