/**
 * Markers that indicate the current runtime is a Codex workspace.
 * Detection precedence: .openai/ directory > env vars > workspace metadata.
 */
export interface CodexWorkspaceMarker {
    /** Absolute path to the .openai/ config directory, if it exists. */
    configDir?: string;
    /** True when OPENAI_WORKSPACE_ID env var is set. */
    hasWorkspaceEnv: boolean;
    /** True when CODEX_ENV or CODEX_AGENT_ID env var is set. */
    hasCodexEnv: boolean;
    /** True when the workspace is an enterprise tenant (OPENAI_ENTERPRISE_TENANT set). */
    isEnterprise: boolean;
    /** Raw workspace ID from env, used for per-user scoping. */
    workspaceId?: string;
}
/**
 * Normalized tool contract exposed to Codex.
 * Codex uses the same MCP protocol as Claude Code, so this mirrors
 * the standard MCP tool schema with Codex-specific annotations.
 */
export interface CodexToolContract {
    /** MCP tool name (snake_case). */
    name: string;
    /** Human-readable description — Codex surfaces this in tool selection. */
    description: string;
    /** JSON Schema object for input validation. */
    inputSchema: Record<string, unknown>;
    /** Minimum role required to invoke this tool. Empty = any authenticated user. */
    requiredRole?: CodexRole;
    /** True if this tool has no Codex-native equivalent (subagents, Agent Teams). */
    needsFallback?: boolean;
}
/**
 * SAML/OIDC identity passed through from the Codex enterprise SSO layer.
 * Codex forwards identity claims via HTTP headers or workspace context;
 * this type captures the subset Planu needs for role-based gating.
 */
export interface CodexSsoIdentity {
    /** Unique user identifier from the IdP (sub claim or SAML nameId). */
    userId: string;
    /** Display email — informational only, NOT used for auth decisions. */
    email?: string;
    /** Roles granted to this user by the enterprise IdP or workspace admin. */
    roles: CodexRole[];
    /** Workspace tenant ID — used to scope project paths. */
    tenantId: string;
}
/**
 * Role-based access gate evaluated at tool invocation time.
 * Decision outcome and identity are always logged to audit_log_export.
 */
export interface CodexRoleGate {
    /** Tool name being gated. */
    toolName: string;
    /** Identity of the caller (from SSO passthrough). */
    identity: CodexSsoIdentity;
    /** Required role for access. */
    requiredRole: CodexRole;
    /** Outcome of the gate evaluation. */
    decision: 'allow' | 'deny';
    /** ISO-8601 timestamp of the decision. */
    decidedAt: string;
    /** Reason for deny, if applicable. */
    denyReason?: string;
}
/**
 * Per-user project path scope.
 * Prevents cross-workspace spec leakage in list_specs, search_specs,
 * and resource enumeration by restricting visible paths per user.
 */
export interface CodexMultiUserScope {
    /** The authenticated user's unique ID. */
    userId: string;
    /** The workspace tenant ID — top-level isolation boundary. */
    tenantId: string;
    /**
     * Resolved absolute path for this user within the shared workspace.
     * Format: <workspaceRoot>/<tenantId>/<userId>
     * No path outside this prefix is accessible to the user.
     */
    scopedProjectPath: string;
    /** Original requested path before scoping was applied. */
    requestedPath: string;
    /** True if requestedPath was outside the allowed scope and was rewritten. */
    pathWasRewritten: boolean;
}
/**
 * Roles defined for Codex enterprise RBAC.
 * Maps to workspace roles from OpenAI enterprise admin console.
 */
export type CodexRole = 'owner' | 'admin' | 'member' | 'viewer';
/**
 * Result of activating the Codex adapter on an MCP server instance.
 */
export interface CodexAdapterActivationResult {
    /** True if detection succeeded and adapter is active. */
    active: boolean;
    /** Workspace markers found during detection. */
    markers: CodexWorkspaceMarker;
    /** Number of tools registered with Codex-compatible contracts. */
    toolsRegistered: number;
    /** Tools that required fallback (no Codex-native equivalent). */
    fallbackTools: string[];
    /** ISO-8601 timestamp of activation. */
    activatedAt: string;
}
//# sourceMappingURL=codex.d.ts.map