UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

115 lines 5.11 kB
/** * Operation Policies * * Default permission levels are derived from the operation's endpoint routing: * - READ → AUTO_APPROVE (read-only, no side effects) * - CREATE → CONFIRM_SESSION (additive state changes, safe once approved) * - UPDATE → CONFIRM_SINGLE_USE (modifying existing data, each instance reviewed) * - DELETE → CONFIRM_SINGLE_USE (destructive, each instance reviewed) * - EXECUTE → CONFIRM_SINGLE_USE (unpredictable side effects) * * OPERATION_POLICY_OVERRIDES contains only operations that deviate from their * endpoint default — e.g., operations that need stricter policies, special * canBeElevated flags, or looser defaults than their endpoint implies. * * Resolution hierarchy: * 1. Element policy (Layer 2 — active element allow/confirm/deny lists) * 2. Explicit override in OPERATION_POLICY_OVERRIDES * 3. Endpoint default (derived from OperationRouter) * 4. Secure fallback: CONFIRM_SINGLE_USE for unknown operations * * Examples: * * activate_element → READ endpoint → AUTO_APPROVE (no override needed) * Routing to READ is sufficient. No entry in OPERATION_POLICY_OVERRIDES. * * create_element → CREATE endpoint → CONFIRM_SESSION (no override needed) * Endpoint default handles it. First create confirms, rest of session is smooth. * * verify_challenge → CREATE endpoint → overridden to AUTO_APPROVE * On CREATE (default CONFIRM_SESSION) but must be frictionless to avoid * requiring confirmation to complete a verification flow. * * delete_element → DELETE endpoint → CONFIRM_SINGLE_USE + canBeElevated: false * Matches endpoint default level, but override locks canBeElevated so no * element policy can silently auto-approve deletions. * * record_execution_step → CREATE endpoint → CONFIRM_SESSION (no override needed) * Moved from EXECUTE to CREATE so it inherits CONFIRM_SESSION, matching * the polling loop's need for session-level frictionless approval. * * A persona with gatekeeper: { confirm: ['create_element'] } → CONFIRM_SESSION * Element policy (Layer 2) can tighten or loosen within what the operation allows. * This is a runtime override via element activation, not a code change. */ import { PermissionLevel, type OperationPolicy } from '../GatekeeperTypes.js'; import { type CRUDEndpoint } from '../OperationRouter.js'; /** * Get the default permission level for a CRUDE endpoint. * * @param endpoint - The CRUDE endpoint * @returns The default permission level for that endpoint */ export declare function getEndpointDefaultLevel(endpoint: CRUDEndpoint): PermissionLevel; /** * Explicit policy overrides for operations that deviate from their endpoint default. * * Only add entries here when an operation needs: * - A different permission level than its endpoint implies * - A canBeElevated: false restriction * - A specific rationale that differs from the endpoint's general rationale * * Operations NOT listed here inherit their permission level from their endpoint. */ export declare const OPERATION_POLICY_OVERRIDES: Record<string, OperationPolicy>; /** * @deprecated Use OPERATION_POLICY_OVERRIDES instead. * Kept as an alias for backward compatibility with code that imports OPERATION_POLICIES. */ export declare const OPERATION_POLICIES: Record<string, OperationPolicy>; /** * Get the explicit policy override for an operation, if one exists. * * @param operation - The operation name * @returns The override policy, or undefined if no override exists */ export declare function getOperationPolicy(operation: string): OperationPolicy | undefined; /** * Get the default permission level for an operation. * * Resolution order: * 1. Explicit override in OPERATION_POLICY_OVERRIDES * 2. Endpoint default from OperationRouter * 3. CONFIRM_SINGLE_USE for unknown operations (secure fallback) * * @param operation - The operation name * @returns The effective default permission level */ export declare function getDefaultPermissionLevel(operation: string): PermissionLevel; /** * Check if an operation can have its permission level elevated. * Some destructive operations cannot be elevated to AUTO_APPROVE. * * @param operation - The operation name * @returns true if the operation can be elevated */ export declare function canOperationBeElevated(operation: string): boolean; /** * Get all operations at a specific effective permission level. * Considers both explicit overrides and endpoint-derived defaults. * * @param level - The permission level to filter by * @returns Array of operation names at that level */ export declare function getOperationsAtLevel(level: PermissionLevel): string[]; /** * Get all auto-approved operations. * These are safe to execute without any confirmation. */ export declare function getAutoApprovedOperations(): string[]; /** * Get all operations requiring confirmation. * These need user approval before execution. */ export declare function getConfirmationRequiredOperations(): string[]; //# sourceMappingURL=OperationPolicies.d.ts.map