import {
  registry
} from "./chunk-7346CKTF.js";
import {
  ENGINE_NAMES
} from "./chunk-4GUD6MFS.js";

// src/openapi/schemas.ts
import { z } from "zod";
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
var ENGINE_ENUM = [...ENGINE_NAMES, "anthropic"];
extendZodWithOpenApi(z);
var UlidId = z.string().openapi({ example: "agent_01J0ABCDE..." });
var IsoTimestamp = z.string().datetime().openapi({ example: "2026-04-09T11:30:00.000Z" });
var ErrorEnvelopeSchema = registry.register(
  "Error",
  z.object({
    type: z.literal("error"),
    error: z.object({
      type: z.enum([
        "invalid_request_error",
        "authentication_error",
        "permission_error",
        "not_found_error",
        "rate_limit_error",
        "server_busy",
        "server_error"
      ]),
      message: z.string()
    })
  }).openapi({
    description: "Error envelope returned from every `/v1/*` endpoint on failure. Status code is reflected by the `error.type` field."
  })
);
var AgentToolsetTool = z.object({
  type: z.literal("agent_toolset_20260401"),
  configs: z.array(z.object({ name: z.string(), enabled: z.boolean().optional() })).optional(),
  default_config: z.object({ enabled: z.boolean().optional() }).optional()
}).openapi({
  description: "Enables claude's built-in tool surface. Use `configs[]` to toggle individual tools and `default_config.enabled=false` to invert the default (start empty and whitelist)."
});
var CustomTool = z.object({
  type: z.literal("custom"),
  name: z.string().min(1),
  description: z.string(),
  input_schema: z.record(z.unknown())
}).openapi({
  description: "Custom tool defined by the client. v1 accepts these in the agent record but does not yet bridge them to claude's tool-use loop \u2014 clients that can drive tool_use events directly can round-trip them via the user.custom_tool_result event."
});
var ToolConfigSchema = registry.register(
  "ToolConfig",
  z.union([AgentToolsetTool, CustomTool])
);
var McpServerConfigSchema = registry.register(
  "McpServerConfig",
  z.object({
    type: z.enum(["stdio", "http", "sse"]).optional(),
    url: z.string().optional(),
    command: z.union([z.string(), z.array(z.string())]).optional(),
    args: z.array(z.string()).optional(),
    headers: z.record(z.string()).optional(),
    env: z.record(z.string()).optional()
  })
);
var AgentSkillSchema = registry.register(
  "AgentSkill",
  z.object({
    name: z.string().openapi({ description: "Unique skill name used as directory name." }),
    source: z.string().openapi({ description: "Source identifier for the skill (e.g. a registry URL or package name)." }),
    content: z.string().openapi({ description: "Markdown content of the skill, written as SKILL.md into the container." }),
    installed_at: z.string().openapi({ description: "ISO timestamp when the skill was installed." })
  })
);
var ModelConfigSchema = registry.register(
  "ModelConfig",
  z.object({
    speed: z.enum(["standard", "fast"]).optional().openapi({
      description: "Model speed. 'fast' enables fast mode on Claude. Only affects claude engine."
    })
  })
);
var AgentSchema = registry.register(
  "Agent",
  z.object({
    type: z.literal("agent"),
    id: UlidId,
    version: z.number().int().positive(),
    name: z.string(),
    description: z.string().openapi({ description: "Human-readable description of the agent." }),
    model: z.object({
      id: z.string(),
      speed: z.enum(["standard", "fast"]).optional()
    }).openapi({ description: "Model configuration. `id` is the canonical model identifier." }),
    system: z.string().nullable(),
    tools: z.array(ToolConfigSchema),
    mcp_servers: z.array(z.object({
      name: z.string(),
      type: z.string(),
      url: z.string().optional()
    }).catchall(z.unknown())).openapi({
      description: "MCP servers configured for this agent. Each entry has a name, type, and optional url."
    }),
    metadata: z.record(z.string()).openapi({
      description: "Key-value metadata attached to the agent. Values must be strings."
    }),
    engine: z.enum(ENGINE_ENUM).openapi({
      description: "Which agent harness powers this agent. `claude` drives `claude -p`; `opencode` drives sst/opencode-ai's `opencode run`; `gemini` drives Google's `gemini -p`; `factory` drives Factory's `droid exec`; `pi` drives the pi.dev coding agent (`pi --mode json`). Immutable after agent creation."
    }),
    webhook_url: z.string().nullable().openapi({
      description: "URL to POST webhook notifications to. Best-effort delivery with 5s timeout."
    }),
    webhook_events: z.array(z.string()).openapi({
      description: "Event types that trigger webhook delivery. Defaults to status + error events."
    }),
    webhook_signing_enabled: z.boolean().openapi({
      description: "Whether a webhook shared secret is configured. The secret itself is never returned."
    }),
    threads_enabled: z.boolean().openapi({
      description: "Whether this agent can spawn sub-agents via the spawn_agent tool."
    }),
    confirmation_mode: z.boolean().openapi({
      description: "Whether this agent requires tool confirmation via user.tool_confirmation events. When true, claude runs with --permission-mode default and a PermissionRequest hook bridges tool approvals to the MA API."
    }),
    callable_agents: z.array(z.object({
      type: z.literal("agent"),
      id: z.string(),
      version: z.number().int().optional()
    })).openapi({
      description: "Agents that can be called by this agent via the spawn_agent tool."
    }),
    skills: z.array(AgentSkillSchema).openapi({
      description: "Skills injected into the container at session start. For Claude backend, written to .claude/skills/<name>/SKILL.md. For all backends, also written to .agents/skills/<name>/SKILL.md. Non-Claude backends also receive skills prepended to the system prompt."
    }),
    permission_policy: z.object({
      always_allow: z.array(z.string()).optional(),
      always_ask: z.array(z.string()).optional()
    }).nullable().optional().openapi({ description: "Per-tool permission control." }),
    model_config: ModelConfigSchema.openapi({
      description: "Model configuration options. 'fast' speed enables fast mode on Claude (claude engine only)."
    }),
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  })
);
var CreateAgentRequestSchema = registry.register(
  "CreateAgentRequest",
  z.object({
    name: z.string().min(1).openapi({ example: "my-agent" }),
    model: z.union([
      z.string().openapi({ example: "claude-sonnet-4-6" }),
      z.object({ id: z.string().min(1), speed: z.enum(["standard", "fast"]).optional() }).openapi({ example: { id: "claude-sonnet-4-6" } })
    ]).openapi({ description: 'Model identifier \u2014 either a bare string (`"claude-sonnet-4-6"`) or an object (`{id, speed?}`). Do not include provider prefixes.' }),
    description: z.string().max(2048).optional().openapi({
      description: "Human-readable description of the agent."
    }),
    metadata: z.record(z.string(), z.string().max(512)).optional().openapi({
      description: "Key-value metadata. Max 16 keys, values max 512 chars."
    }),
    system: z.string().nullish().openapi({ example: "You are a helpful assistant." }),
    tools: z.array(ToolConfigSchema).optional(),
    mcp_servers: z.array(z.object({
      name: z.string(),
      type: z.string().optional(),
      url: z.string().optional()
    }).catchall(z.unknown())).optional().openapi({
      description: "MCP servers as an array of objects with name, type, and optional url."
    }),
    engine: z.enum(ENGINE_ENUM).optional().openapi({
      description: "Agent harness. Auto-inferred from model prefix if omitted: `gemini-*` \u2192 gemini, `gpt-*`/`o1-*` \u2192 codex, `claude-*` \u2192 claude. Always use bare model IDs (`gemini-2.5-flash`, not `google/gemini-2.5-flash`) \u2014 provider prefixes are added internally where needed. Non-claude engines must NOT declare `tools` (they manage tool permissions internally). Required vault keys: claude \u2192 ANTHROPIC_API_KEY, gemini \u2192 GEMINI_API_KEY, codex \u2192 OPENAI_API_KEY, pi \u2192 any of the three.",
      example: "claude"
    }),
    webhook_url: z.string().url().optional().openapi({
      description: "URL to POST webhook notifications to."
    }),
    webhook_events: z.array(z.string()).optional().openapi({
      description: 'Event types to deliver via webhook. Defaults to ["session.status_idle","session.status_running","session.error"].'
    }),
    threads_enabled: z.boolean().optional().openapi({
      description: "Enable multi-agent threads. When true, spawn_agent tool is available."
    }),
    confirmation_mode: z.boolean().optional().openapi({
      description: "Enable tool confirmation mode. When true, claude requires explicit user approval for tool calls via user.tool_confirmation events."
    }),
    skills: z.array(AgentSkillSchema).max(20).optional().openapi({
      description: "Skills to inject into the container at session start. Maximum 20 skills, 256KB per skill, 1MB total. For Claude: written to .claude/skills/<name>/SKILL.md. All backends: also written to .agents/skills/<name>/SKILL.md."
    }),
    model_config: ModelConfigSchema.optional().openapi({
      description: "Model configuration options. 'fast' speed enables fast mode on Claude (claude engine only)."
    })
  }).openapi({
    example: {
      name: "my-agent",
      model: { id: "claude-sonnet-4-6" },
      system: "You are a helpful assistant.",
      tools: [{ type: "agent_toolset_20260401" }]
    }
  })
);
var UpdateAgentRequestSchema = registry.register(
  "UpdateAgentRequest",
  z.object({
    version: z.number().int().min(1).openapi({
      description: "Current agent version for optimistic concurrency. Must match the agent's current version."
    }),
    name: z.string().min(1).optional(),
    model: z.object({ id: z.string().min(1), speed: z.enum(["standard", "fast"]).optional() }).optional().openapi({
      description: "Model configuration. `id` is the canonical model identifier."
    }),
    description: z.string().max(2048).optional().openapi({
      description: "Human-readable description of the agent."
    }),
    metadata: z.record(z.string(), z.string().max(512)).optional().openapi({
      description: "Key-value metadata. Max 16 keys, values max 512 chars."
    }),
    system: z.string().nullish(),
    tools: z.array(ToolConfigSchema).optional(),
    mcp_servers: z.array(z.object({
      name: z.string(),
      type: z.string().optional(),
      url: z.string().optional()
    }).catchall(z.unknown())).optional().openapi({
      description: "MCP servers as an array of objects with name, type, and optional url."
    }),
    skills: z.array(AgentSkillSchema).max(20).optional().openapi({
      description: "Updated skills list. Replaces the existing skills entirely."
    }),
    model_config: ModelConfigSchema.optional().openapi({
      description: "Model configuration options. 'fast' speed enables fast mode on Claude (claude engine only)."
    })
  })
);
var EnvironmentPackages = z.object({
  apt: z.array(z.string()).optional(),
  cargo: z.array(z.string()).optional(),
  gem: z.array(z.string()).optional(),
  go: z.array(z.string()).optional(),
  npm: z.array(z.string()).optional(),
  pip: z.array(z.string()).optional()
}).openapi({
  description: "Package lists installed into the sandbox during environment setup. All are optional."
});
var EnvironmentNetworking = z.union([
  z.object({ type: z.literal("unrestricted") }),
  z.object({
    type: z.literal("limited"),
    allowed_hosts: z.array(z.string()).optional(),
    allow_mcp_servers: z.boolean().optional(),
    allow_package_managers: z.boolean().optional()
  })
]);
var EnvironmentConfigSchema = registry.register(
  "EnvironmentConfig",
  z.object({
    type: z.literal("cloud"),
    provider: z.enum(["sprites", "docker", "apple-container", "apple-firecracker", "podman", "e2b", "vercel", "daytona", "fly", "modal", "mvm"]).optional().openapi({
      description: "Container provider for this environment. `sprites` uses sprites.dev cloud containers (default); `docker` uses local Docker containers; `apple-container` uses Apple Containers on macOS 26+ (Apple Silicon only); `apple-firecracker` uses AgentStep Firecracker microVMs (macOS, M3+ Apple Silicon); `podman` uses Podman containers; `e2b` uses E2B cloud sandboxes; `vercel` uses Vercel Sandboxes; `daytona` uses Daytona workspaces; `fly` uses Fly.io Machines; `modal` uses Modal sandboxes."
    }),
    packages: EnvironmentPackages.optional(),
    networking: EnvironmentNetworking.optional()
  })
);
var EnvironmentSchema = registry.register(
  "Environment",
  z.object({
    type: z.literal("environment"),
    id: UlidId,
    name: z.string(),
    description: z.string().nullable().openapi({
      description: "Optional human-readable description of the environment."
    }),
    config: EnvironmentConfigSchema,
    metadata: z.record(z.string()).openapi({
      description: "Key-value metadata attached to the environment. Values must be strings."
    }),
    state: z.enum(["preparing", "ready", "failed"]),
    state_message: z.string().nullable(),
    created_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  })
);
var CreateEnvironmentRequestSchema = registry.register(
  "CreateEnvironmentRequest",
  z.object({
    name: z.string().min(1).openapi({ example: "my-env" }),
    config: EnvironmentConfigSchema,
    description: z.string().optional().nullable().openapi({
      description: "Optional human-readable description of the environment."
    }),
    metadata: z.record(z.string()).optional().openapi({
      description: "Key-value metadata to attach to the environment. Values must be strings."
    })
  }).openapi({
    example: {
      name: "my-env",
      config: { type: "cloud", networking: { type: "unrestricted" } }
    }
  })
);
var UpdateEnvironmentRequestSchema = registry.register(
  "UpdateEnvironmentRequest",
  z.object({
    name: z.string().min(1).optional().openapi({ example: "my-env-renamed" }),
    description: z.string().optional().nullable().openapi({
      description: "Update the description. Pass null to clear."
    }),
    metadata: z.record(z.string()).optional().openapi({
      description: "Replaces the metadata entirely. Values must be strings."
    }),
    config: EnvironmentConfigSchema.optional()
  })
);
var SessionStatsSchema = z.object({
  turn_count: z.number().int().nonnegative(),
  tool_calls_count: z.number().int().nonnegative(),
  active_seconds: z.number().nonnegative(),
  duration_seconds: z.number().nonnegative()
});
var SessionUsageSchema = z.object({
  input_tokens: z.number().int().nonnegative(),
  output_tokens: z.number().int().nonnegative(),
  cache_read_input_tokens: z.number().int().nonnegative(),
  cache_creation: z.object({
    ephemeral_5m_input_tokens: z.number().int().nonnegative(),
    ephemeral_1h_input_tokens: z.number().int().nonnegative()
  }),
  cost_usd: z.number().nonnegative()
});
var SessionStatusSchema = registry.register(
  "SessionStatus",
  z.enum(["idle", "running", "rescheduling", "terminated"])
);
var SessionSchema = registry.register(
  "Session",
  z.object({
    id: UlidId,
    agent: z.object({
      type: z.literal("agent"),
      id: UlidId,
      version: z.number().int().positive(),
      name: z.string(),
      description: z.string(),
      model: z.object({ id: z.string(), speed: z.enum(["standard", "fast"]).optional() }),
      system: z.string().nullable(),
      tools: z.array(z.record(z.unknown())),
      mcp_servers: z.array(z.record(z.unknown())),
      skills: z.array(z.record(z.unknown()))
    }),
    environment_id: UlidId,
    status: SessionStatusSchema,
    stop_reason: z.union([
      z.object({
        type: z.string().openapi({ description: "Stop reason type, e.g. 'end_turn', 'error', 'interrupted', 'requires_action'." }),
        event_ids: z.array(z.string()).optional().openapi({ description: "Event IDs associated with this stop reason (e.g. custom_tool_use events for requires_action)." })
      }),
      z.null()
    ]).openapi({ description: "Structured stop reason for the session's last turn, or null if no turn has completed." }),
    title: z.string().nullable(),
    metadata: z.record(z.unknown()),
    max_budget_usd: z.number().nullable().openapi({
      description: "Maximum spend for this session in USD. Turn start is rejected once cumulative usage_cost_usd reaches this cap."
    }),
    outcome: z.record(z.unknown()).nullable().openapi({
      description: "Outcome criteria set via user.define_outcome event."
    }),
    resources: z.array(z.object({
      type: z.enum(["uri", "text"]),
      uri: z.string().optional(),
      content: z.string().optional()
    })).nullable().openapi({
      description: "Resources attached to the session, downloaded into the container at /tmp/resources/."
    }),
    vault_ids: z.array(z.string()).nullable().openapi({
      description: "Vault IDs whose entries are injected as environment variables."
    }),
    user_profile_id: z.string().nullable().optional().openapi({ description: "User profile ID for credential scoping." }),
    parent_session_id: z.string().nullable().openapi({
      description: "Parent session ID if this is a child thread session."
    }),
    thread_depth: z.number().int().nonnegative().openapi({
      description: "Thread nesting depth. 0 for top-level sessions."
    }),
    stats: SessionStatsSchema,
    usage: SessionUsageSchema,
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  })
);
var CreateSessionRequestSchema = registry.register(
  "CreateSessionRequest",
  z.object({
    agent: z.union([
      UlidId,
      z.object({
        id: UlidId,
        version: z.number().int(),
        type: z.literal("agent").optional()
      })
    ]),
    environment_id: UlidId,
    title: z.string().nullish(),
    metadata: z.record(z.unknown()).optional(),
    max_budget_usd: z.number().positive().optional().openapi({
      description: "Maximum spend for this session in USD. Once exceeded, turns are rejected with a budget_exceeded error."
    }),
    resources: z.array(z.object({
      type: z.enum(["uri", "text"]),
      uri: z.string().optional(),
      content: z.string().optional()
    })).optional(),
    vault_ids: z.array(z.string()).optional(),
    user_profile_id: z.string().optional().openapi({ description: "Links session to a user profile for per-user credential scoping." }),
    outcomes: z.object({
      description: z.string(),
      rubric: z.array(z.object({
        name: z.string(),
        description: z.string(),
        weight: z.number().optional()
      })).optional(),
      max_iterations: z.number().int().optional()
    }).optional().openapi({ description: "Success criteria with optional rubric for self-evaluation." })
  }).openapi({
    example: {
      agent: "agent_01ABCDEFG...",
      environment_id: "env_01ABCDEFG..."
    }
  })
);
var UpdateSessionRequestSchema = registry.register(
  "UpdateSessionRequest",
  z.object({
    title: z.string().nullish(),
    metadata: z.record(z.unknown()).optional(),
    vault_ids: z.array(z.string()).optional()
  })
);
var TextBlock = z.object({ type: z.literal("text"), text: z.string() });
var UserMessageEvent = z.object({
  type: z.literal("user.message"),
  content: z.array(TextBlock).min(1)
}).openapi({
  description: "Append a user message to the session. Triggers a new turn."
});
var UserInterruptEvent = z.object({
  type: z.literal("user.interrupt")
}).openapi({
  description: "Interrupt the currently-running turn. No-op if session is idle. Mid-batch follow-up user.message events are executed after the interrupt."
});
var UserCustomToolResultEvent = z.object({
  type: z.literal("user.custom_tool_result"),
  custom_tool_use_id: z.string(),
  content: z.array(z.unknown())
}).openapi({
  description: "Client-provided result for a custom tool call. Only meaningful after an agent.custom_tool_use event with matching id."
});
var UserToolConfirmationEvent = z.object({
  type: z.literal("user.tool_confirmation"),
  tool_use_id: z.string().optional().openapi({
    description: "ID of the tool use to confirm. Optional \u2014 if omitted, applies to the current pending confirmation."
  }),
  result: z.enum(["allow", "deny"]).optional().openapi({
    description: "Whether to allow or deny the tool use. Defaults to 'allow'."
  }),
  deny_message: z.string().optional().openapi({
    description: "Optional message explaining why the tool use was denied."
  })
}).openapi({
  description: "Confirm or deny a pending tool use. Only meaningful for agents with confirmation_mode enabled, after an agent.tool_confirmation_request event."
});
var UserDefineOutcomeEvent = z.object({
  type: z.literal("user.define_outcome"),
  description: z.string().min(1).openapi({
    description: "Description of the desired outcome for the agent to achieve."
  }),
  rubric: z.string().optional().openapi({
    description: "Markdown rubric used by the grader to evaluate the agent's output."
  }),
  max_iterations: z.number().int().min(1).max(20).optional().openapi({
    description: "Maximum grading iterations before giving up. Defaults to 3."
  })
}).openapi({
  description: "Define an outcome for the agent to work toward. A grader evaluates the agent's output against the rubric after each turn, cycling until satisfied or max_iterations reached."
});
var UserEventSchema = registry.register(
  "UserEvent",
  z.union([UserMessageEvent, UserInterruptEvent, UserCustomToolResultEvent, UserToolConfirmationEvent, UserDefineOutcomeEvent])
);
var UserEventBatchRequestSchema = registry.register(
  "UserEventBatchRequest",
  z.object({
    events: z.array(UserEventSchema).min(1)
  }).openapi({
    example: {
      events: [
        {
          type: "user.message",
          content: [{ type: "text", text: "hello" }]
        }
      ]
    }
  })
);
var ManagedEventSchema = registry.register(
  "ManagedEvent",
  z.object({
    id: UlidId,
    seq: z.number().int().positive(),
    session_id: UlidId,
    type: z.string(),
    processed_at: IsoTimestamp.nullable()
  }).catchall(z.unknown()).openapi({
    description: "Envelope for any Managed Agents event. Event-specific fields are mixed into the top level alongside id/seq/type \u2014 refer to the managed-agents-2026-04-01 spec for per-type shapes."
  })
);
var VaultSchema = registry.register(
  "Vault",
  z.object({
    type: z.literal("vault"),
    id: UlidId,
    agent_id: UlidId.nullable().openapi({ description: "Owning agent ID. Null for unscoped vaults." }),
    name: z.string(),
    display_name: z.string().openapi({ description: "Anthropic-compatible alias for `name`." }),
    metadata: z.record(z.string()).openapi({
      description: "Key-value metadata attached to the vault. Values must be strings."
    }),
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  })
);
var VaultEntrySchema = registry.register(
  "VaultEntry",
  z.object({
    key: z.string(),
    value: z.string()
  })
);
var CreateVaultRequestSchema = registry.register(
  "CreateVaultRequest",
  z.object({
    agent_id: UlidId.optional().openapi({ example: "agent_01ABCDEFG...", description: "Owning agent ID. Optional for unscoped vaults." }),
    name: z.string().min(1).openapi({ example: "my-vault" })
  })
);
var UpdateVaultRequestSchema = registry.register(
  "UpdateVaultRequest",
  z.object({
    display_name: z.string().min(1).max(255).optional().openapi({
      description: "Update the vault display name."
    }),
    metadata: z.record(z.string().max(512)).optional().openapi({
      description: "Replaces the metadata entirely. Max 16 key-value pairs."
    })
  })
);
var SetVaultEntryRequestSchema = registry.register(
  "SetVaultEntryRequest",
  z.object({
    value: z.string().openapi({ example: "some value" })
  })
);
var VaultDeletedResponseSchema = registry.register(
  "VaultDeletedResponse",
  z.object({ id: UlidId, type: z.literal("vault_deleted") })
);
var VaultEntryDeletedResponseSchema = registry.register(
  "VaultEntryDeletedResponse",
  z.object({ key: z.string(), type: z.literal("entry_deleted") })
);
var BatchOperationSchema = registry.register(
  "BatchOperation",
  z.object({
    method: z.string().openapi({ example: "POST" }),
    path: z.string().openapi({ example: "/anthropic/v1/agents" }),
    body: z.record(z.unknown()).optional()
  })
);
var BatchRequestSchema = registry.register(
  "BatchRequest",
  z.object({
    operations: z.array(z.object({
      method: z.string(),
      path: z.string(),
      body: z.record(z.unknown()).optional()
    })).min(1).max(50)
  })
);
var BatchResultSchema = registry.register(
  "BatchResult",
  z.object({
    status: z.number().int(),
    body: z.unknown()
  })
);
var BatchResponseSchema = registry.register(
  "BatchResponse",
  z.object({
    results: z.array(z.object({
      status: z.number().int(),
      body: z.unknown()
    }))
  })
);
function listEnvelope(name, item) {
  const schema = z.object({
    data: z.array(item),
    has_more: z.boolean(),
    first_id: z.string().nullable(),
    last_id: z.string().nullable()
  });
  return registry.register(name, schema);
}
var AgentListResponseSchema = listEnvelope("AgentListResponse", AgentSchema);
var EnvironmentListResponseSchema = listEnvelope(
  "EnvironmentListResponse",
  EnvironmentSchema
);
var SessionListResponseSchema = listEnvelope("SessionListResponse", SessionSchema);
var EventListResponseSchema = listEnvelope("EventListResponse", ManagedEventSchema);
var VaultListResponseSchema = registry.register(
  "VaultListResponse",
  z.object({ data: z.array(VaultSchema) })
);
var VaultEntryListResponseSchema = registry.register(
  "VaultEntryListResponse",
  z.object({ data: z.array(VaultEntrySchema) })
);
var TrustGrantSchema = registry.register("TrustGrant", z.object({
  type: z.literal("vault_credential"),
  vault_id: z.string(),
  credential_id: z.string()
}));
var UserProfileSchema = registry.register("UserProfile", z.object({
  type: z.literal("user_profile"),
  id: z.string(),
  external_id: z.string().nullable(),
  display_name: z.string().nullable(),
  trust_grants: z.array(TrustGrantSchema),
  created_at: z.string(),
  updated_at: z.string()
}));
var UserProfileCreateSchema = registry.register("UserProfileCreate", z.object({
  external_id: z.string().optional(),
  display_name: z.string().optional(),
  trust_grants: z.array(TrustGrantSchema).optional()
}));
var UserProfileUpdateSchema = registry.register("UserProfileUpdate", z.object({
  external_id: z.string().nullish(),
  display_name: z.string().nullish(),
  trust_grants: z.array(TrustGrantSchema).optional()
}));
var UserProfileListSchema = listEnvelope("UserProfileList", UserProfileSchema);
var EnrollmentUrlRequestSchema = registry.register("EnrollmentUrlRequest", z.object({
  vault_id: z.string(),
  credential_id: z.string().optional(),
  display_name: z.string().optional(),
  authorize_url: z.string(),
  token_endpoint: z.string(),
  client_id: z.string(),
  client_secret: z.string().optional(),
  scope: z.string().optional(),
  redirect_uri: z.string().optional()
}));
var EnrollmentUrlResponseSchema = registry.register("EnrollmentUrlResponse", z.object({
  type: z.literal("enrollment_url"),
  url: z.string(),
  state: z.string(),
  redirect_uri: z.string(),
  expires_in: z.number()
}));
var AgentDeletedResponseSchema = registry.register(
  "AgentDeletedResponse",
  z.object({ id: UlidId, type: z.literal("agent_deleted") })
);
var SessionDeletedResponseSchema = registry.register(
  "SessionDeletedResponse",
  z.object({ id: UlidId, type: z.literal("session_deleted") })
);
var EnvironmentDeletedResponseSchema = registry.register(
  "EnvironmentDeletedResponse",
  z.object({ id: UlidId, type: z.literal("environment_deleted") })
);
var UserEventAppendResponseSchema = registry.register(
  "UserEventAppendResponse",
  z.object({ data: z.array(ManagedEventSchema) })
);
var FileScopeSchema = z.object({
  type: z.enum(["session"]).openapi({ description: "Scope type. Currently only 'session' is supported." }),
  id: z.string().openapi({ description: "ID of the owning session." })
});
var FileRecordSchema = registry.register(
  "FileRecord",
  z.object({
    id: UlidId,
    type: z.literal("file").openapi({ description: "Object type discriminator." }),
    filename: z.string(),
    mime_type: z.string().openapi({ description: "MIME type of the file." }),
    size_bytes: z.number().int().nonnegative().openapi({ description: "File size in bytes." }),
    downloadable: z.boolean().openapi({ description: "Whether the file content can be downloaded." }),
    scope: FileScopeSchema.nullable().openapi({
      description: "Scope the file is attached to. Null for legacy unscoped files (global-admin only)."
    }),
    created_at: IsoTimestamp
  })
);
var FileListResponseSchema = registry.register(
  "FileListResponse",
  z.object({
    data: z.array(FileRecordSchema),
    has_more: z.boolean().openapi({ description: "Whether more results exist beyond this page." }),
    first_id: z.string().nullable().openapi({ description: "ID of the first item in this page." }),
    last_id: z.string().nullable().openapi({ description: "ID of the last item in this page. Pass as after_id for the next page." })
  })
);
var FileDeletedResponseSchema = registry.register(
  "FileDeletedResponse",
  z.object({ id: UlidId, type: z.literal("file_deleted") })
);
var VaultCredentialSchema = registry.register(
  "VaultCredential",
  z.object({
    type: z.literal("vault_credential"),
    id: UlidId,
    vault_id: UlidId,
    display_name: z.string(),
    auth: z.object({
      type: z.enum(["static_bearer"]).openapi({ description: "Auth type. Currently only `static_bearer` is supported." }),
      mcp_server_url: z.string().nullable().openapi({ description: "MCP server URL this credential authenticates with. Null for plain API keys." })
    }),
    metadata: z.record(z.string()).optional().openapi({ description: "Arbitrary key-value metadata." }),
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  }).openapi({ description: "Vault credential. Secret fields (token) are write-only \u2014 never returned in responses." })
);
var CreateCredentialRequestSchema = registry.register(
  "CreateCredentialRequest",
  z.object({
    display_name: z.string().min(1).max(200).openapi({ description: "Human-readable name for this credential.", example: "Linear API key" }),
    auth: z.object({
      type: z.enum(["static_bearer"]).openapi({ description: "Auth type." }),
      mcp_server_url: z.string().url().optional().openapi({ description: "MCP server URL this credential authenticates with. Optional for plain API keys.", example: "https://mcp.linear.app/mcp" }),
      token: z.string().min(1).openapi({ description: "Secret token. Stored encrypted at rest; never returned in responses.", example: "lin_api_xxxxx" })
    }),
    metadata: z.record(z.string()).optional().openapi({ description: "Arbitrary key-value metadata." })
  })
);
var UpdateCredentialRequestSchema = registry.register(
  "UpdateCredentialRequest",
  z.object({
    display_name: z.string().min(1).max(200).optional(),
    auth: z.object({
      type: z.enum(["static_bearer"]).optional(),
      token: z.string().min(1).optional().openapi({ description: "New token value. Write-only." }),
      mcp_server_url: z.string().url().nullish()
    }).optional(),
    metadata: z.record(z.string().nullable()).optional().openapi({ description: "Patch semantics: set key to string to upsert, null to delete, omit to preserve." })
  })
);
var CredentialListResponseSchema = registry.register(
  "CredentialListResponse",
  z.object({ data: z.array(VaultCredentialSchema) })
);
var CredentialDeletedResponseSchema = registry.register(
  "CredentialDeletedResponse",
  z.object({ id: UlidId, type: z.literal("vault_credential_deleted") })
);
var MemoryStoreSchema = registry.register(
  "MemoryStore",
  z.object({
    id: UlidId,
    name: z.string(),
    description: z.string().nullable(),
    agent_id: z.string().nullable().openapi({ description: "Owning agent ID. Null for legacy global stores." }),
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp
  })
);
var CreateMemoryStoreRequestSchema = registry.register(
  "CreateMemoryStoreRequest",
  z.object({
    name: z.string().min(1),
    description: z.string().optional(),
    agent_id: z.string().min(1).openapi({ description: "Agent to attach this store to." })
  })
);
var MemoryStoreListResponseSchema = registry.register(
  "MemoryStoreListResponse",
  z.object({ data: z.array(MemoryStoreSchema) })
);
var MemoryStoreDeletedResponseSchema = registry.register(
  "MemoryStoreDeletedResponse",
  z.object({ id: UlidId, type: z.literal("memory_store_deleted") })
);
var MemorySchema = registry.register(
  "Memory",
  z.object({
    id: UlidId,
    store_id: UlidId,
    path: z.string(),
    content: z.string(),
    content_sha256: z.string().openapi({ description: "SHA-256 hash of the content. Used for optimistic concurrency in PATCH." }),
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp
  })
);
var CreateMemoryRequestSchema = registry.register(
  "CreateMemoryRequest",
  z.object({
    path: z.string().min(1),
    content: z.string()
  })
);
var UpdateMemoryRequestSchema = registry.register(
  "UpdateMemoryRequest",
  z.object({
    content: z.string(),
    content_sha256: z.string().optional().openapi({
      description: "Optimistic concurrency check. If provided and does not match the current hash, returns 409."
    })
  })
);
var MemoryListResponseSchema = registry.register(
  "MemoryListResponse",
  z.object({ data: z.array(MemorySchema) })
);
var MemoryDeletedResponseSchema = registry.register(
  "MemoryDeletedResponse",
  z.object({ id: UlidId, type: z.literal("memory_deleted") })
);
var SessionResourceSchema = registry.register(
  "SessionResource",
  z.object({
    id: z.string().openapi({ description: "Resource ID with sesrsc_ prefix." }),
    type: z.enum(["uri", "text", "file", "github_repository"]),
    file_id: z.string().optional().openapi({ description: "File ID for file-type resources." }),
    mount_path: z.string().optional().openapi({ description: "Mount path inside the container." }),
    url: z.string().optional().openapi({ description: "URL for URI/github_repository resources." }),
    checkout: z.object({
      type: z.string().openapi({ description: "Checkout type, e.g. 'branch' or 'commit'." }),
      name: z.string().openapi({ description: "Branch name or commit hash." })
    }).optional().openapi({ description: "Checkout configuration for github_repository resources." }),
    session_id: UlidId,
    created_at: IsoTimestamp,
    updated_at: IsoTimestamp
  })
);
var AddResourceRequestSchema = registry.register(
  "AddResourceRequest",
  z.object({
    type: z.enum(["uri", "text", "file", "github_repository"]),
    uri: z.string().optional(),
    content: z.string().optional(),
    file_id: z.string().optional(),
    mount_path: z.string().optional(),
    url: z.string().optional(),
    repository_url: z.string().optional(),
    branch: z.string().optional(),
    commit: z.string().optional(),
    checkout: z.object({
      type: z.string(),
      name: z.string()
    }).optional()
  })
);
var ResourceListResponseSchema = registry.register(
  "ResourceListResponse",
  z.object({ data: z.array(SessionResourceSchema) })
);
var ResourceDeletedResponseSchema = registry.register(
  "ResourceDeletedResponse",
  z.object({ id: z.string(), type: z.literal("session_resource_deleted") })
);
var KeyScopeSchema = z.object({
  agents: z.array(z.string()),
  environments: z.array(z.string()),
  vaults: z.array(z.string())
});
var KeyPermissionsSchema = z.object({
  admin: z.boolean().openapi({ description: "Whether this key has admin privileges." }),
  scope: KeyScopeSchema.nullable().openapi({ description: "Resource scope restrictions. Null = unrestricted within tenancy." })
});
var ApiKeySchema = registry.register(
  "ApiKey",
  z.object({
    id: UlidId,
    name: z.string(),
    prefix: z.string().openapi({ description: "First characters of the key, for identification." }),
    permissions: KeyPermissionsSchema,
    tenant_id: z.string().nullable(),
    created_at: z.number().openapi({ description: "Unix timestamp in milliseconds." })
  })
);
var ApiKeyCreatedSchema = registry.register(
  "ApiKeyCreated",
  z.object({
    id: UlidId,
    name: z.string(),
    key: z.string().openapi({ description: "The full API key. Returned ONCE at creation time \u2014 store it securely." }),
    permissions: KeyPermissionsSchema,
    tenant_id: z.string().nullable()
  })
);
var CreateApiKeyRequestSchema = registry.register(
  "CreateApiKeyRequest",
  z.object({
    name: z.string().min(1).max(200),
    permissions: KeyPermissionsSchema.optional(),
    tenant_id: z.string().optional()
  })
);
var PatchApiKeyRequestSchema = registry.register(
  "PatchApiKeyRequest",
  z.object({
    permissions: KeyPermissionsSchema
  })
);
var ApiKeyListResponseSchema = registry.register(
  "ApiKeyListResponse",
  z.object({ data: z.array(ApiKeySchema) })
);
var ApiKeyRevokedResponseSchema = registry.register(
  "ApiKeyRevokedResponse",
  z.object({ ok: z.literal(true), id: UlidId })
);
var ApiKeyActivityResponseSchema = registry.register(
  "ApiKeyActivityResponse",
  z.object({
    id: UlidId,
    name: z.string(),
    sessions: z.array(SessionSchema),
    totals: z.object({
      session_count: z.number().int().nonnegative(),
      cost_usd: z.number().nonnegative(),
      turn_count: z.number().int().nonnegative(),
      error_count: z.number().int().nonnegative()
    })
  })
);
var UpstreamKeySchema = registry.register(
  "UpstreamKey",
  z.object({
    id: UlidId,
    provider: z.string().openapi({ description: "Provider name, e.g. 'anthropic', 'openai', 'gemini'." }),
    prefix: z.string().openapi({ description: "First 10 characters of the key, for identification." }),
    weight: z.number().int().positive(),
    disabled_at: z.number().nullable().openapi({ description: "Unix ms timestamp when key was disabled, or null if active." }),
    last_used_at: z.number().nullable().openapi({ description: "Unix ms timestamp of last use." }),
    created_at: z.number().openapi({ description: "Unix ms timestamp." })
  })
);
var AddUpstreamKeyRequestSchema = registry.register(
  "AddUpstreamKeyRequest",
  z.object({
    provider: z.enum(["anthropic", "openai", "gemini"]),
    value: z.string().min(20).max(500).openapi({ description: "The raw API key value. Stored encrypted; never returned." }),
    weight: z.number().int().positive().optional()
  })
);
var PatchUpstreamKeyRequestSchema = registry.register(
  "PatchUpstreamKeyRequest",
  z.object({
    disabled: z.boolean().openapi({ description: "Set to true to disable, false to re-enable." })
  })
);
var UpstreamKeyListResponseSchema = registry.register(
  "UpstreamKeyListResponse",
  z.object({ data: z.array(UpstreamKeySchema) })
);
var UpstreamKeyDeletedResponseSchema = registry.register(
  "UpstreamKeyDeletedResponse",
  z.object({ ok: z.literal(true), id: UlidId })
);
var TenantSchema = registry.register(
  "Tenant",
  z.object({
    id: z.string().openapi({ example: "tenant_default" }),
    name: z.string(),
    created_at: IsoTimestamp,
    archived_at: IsoTimestamp.nullable()
  })
);
var CreateTenantRequestSchema = registry.register(
  "CreateTenantRequest",
  z.object({
    name: z.string().min(1).max(200),
    id: z.string().regex(/^tenant_[a-z0-9_-]+$/i).optional().openapi({
      description: "Custom tenant ID. Must start with 'tenant_'. Auto-generated if omitted."
    })
  })
);
var PatchTenantRequestSchema = registry.register(
  "PatchTenantRequest",
  z.object({
    name: z.string().min(1).max(200).optional()
  })
);
var TenantListResponseSchema = registry.register(
  "TenantListResponse",
  z.object({ data: z.array(TenantSchema) })
);
var TenantArchivedResponseSchema = registry.register(
  "TenantArchivedResponse",
  z.object({ ok: z.literal(true), id: z.string() })
);
var AuditEntrySchema = registry.register(
  "AuditEntry",
  z.object({
    id: UlidId,
    created_at: IsoTimestamp,
    actor_key_id: z.string().nullable().openapi({ description: "API key ID of the actor, or null for system-initiated." }),
    actor_name: z.string().nullable().openapi({ description: "Friendly name of the actor at log time." }),
    tenant_id: z.string().nullable(),
    action: z.string().openapi({ description: "Dotted verb, e.g. 'tenants.create', 'api_keys.revoke'." }),
    resource_type: z.string().nullable().openapi({ description: "Resource type: 'agent', 'tenant', 'api_key', 'upstream_key', etc." }),
    resource_id: z.string().nullable(),
    outcome: z.enum(["success", "denied", "failure"]),
    metadata: z.record(z.unknown()).nullable().openapi({ description: "Action-specific context." })
  })
);
var AuditListResponseSchema = registry.register(
  "AuditListResponse",
  z.object({
    data: z.array(AuditEntrySchema),
    has_more: z.boolean(),
    first_id: z.string().nullable(),
    last_id: z.string().nullable()
  })
);
var TraceListItemSchema = registry.register(
  "TraceListItem",
  z.object({
    trace_id: z.string(),
    start_ms: z.number(),
    end_ms: z.number(),
    duration_ms: z.number().nonnegative(),
    event_count: z.number().int().nonnegative(),
    session_count: z.number().int().nonnegative(),
    first_session_id: z.string()
  })
);
var TraceListResponseSchema = registry.register(
  "TraceListResponse",
  z.object({ data: z.array(TraceListItemSchema) })
);
var SpanNodeSchema = z.lazy(
  () => z.object({
    span_id: z.string(),
    parent_span_id: z.string().nullable(),
    session_id: z.string(),
    name: z.string(),
    start_ms: z.number(),
    end_ms: z.number().nullable(),
    duration_ms: z.number().nullable(),
    status: z.enum(["ok", "error", "interrupted", "unclosed"]),
    attributes: z.record(z.unknown()),
    children: z.array(SpanNodeSchema)
  })
);
var TraceDetailSchema = registry.register(
  "TraceDetail",
  z.object({
    trace_id: z.string(),
    span_count: z.number().int().nonnegative(),
    session_ids: z.array(z.string()),
    start_ms: z.number(),
    end_ms: z.number(),
    duration_ms: z.number().nonnegative(),
    turn_count: z.number().int().nonnegative(),
    tool_call_count: z.number().int().nonnegative(),
    error_count: z.number().int().nonnegative(),
    input_tokens: z.number().int().nonnegative(),
    output_tokens: z.number().int().nonnegative(),
    cache_read_input_tokens: z.number().int().nonnegative(),
    cache_creation_input_tokens: z.number().int().nonnegative(),
    cost_usd: z.number().nonnegative(),
    spans: z.array(z.record(z.unknown())).openapi({ description: "Span tree with nested children." }),
    events: z.array(ManagedEventSchema)
  })
);
var TraceExportResponseSchema = registry.register(
  "TraceExportResponse",
  z.object({
    ok: z.boolean()
  }).catchall(z.unknown())
);
var SkillsCatalogResponseSchema = registry.register(
  "SkillsCatalogResponse",
  z.object({
    skills: z.array(z.record(z.unknown())),
    total: z.number().int().nonnegative()
  })
);
var SkillsSearchResponseSchema = registry.register(
  "SkillsSearchResponse",
  z.object({
    skills: z.array(z.record(z.unknown())),
    total: z.number().int().nonnegative(),
    limit: z.number().int().nonnegative(),
    offset: z.number().int().nonnegative()
  })
);
var SkillSchema = registry.register(
  "Skill",
  z.object({
    type: z.literal("skill"),
    id: UlidId,
    name: z.string(),
    description: z.string().nullable(),
    current_version: z.string().nullable().openapi({
      description: "Semver-ish version string of the active skill version, e.g. '1.0.0'."
    }),
    created_at: z.string().datetime(),
    updated_at: z.string().datetime(),
    archived_at: z.string().datetime().nullable()
  })
);
var SkillVersionSchema = registry.register(
  "SkillVersion",
  z.object({
    type: z.literal("skill_version"),
    id: UlidId,
    skill_id: UlidId,
    version: z.string(),
    content: z.string().openapi({
      description: "The SKILL.md content (or main markdown body for multi-file skills)."
    }),
    created_at: z.string().datetime()
  })
);
var SkillListResponseSchema = listEnvelope("SkillListResponse", SkillSchema);
var SkillVersionListResponseSchema = listEnvelope(
  "SkillVersionListResponse",
  SkillVersionSchema
);
var SkillDeletedResponseSchema = registry.register(
  "SkillDeletedResponse",
  z.object({ id: UlidId, type: z.literal("skill_deleted") })
);
var SkillVersionDeletedResponseSchema = registry.register(
  "SkillVersionDeletedResponse",
  z.object({
    skill_id: UlidId,
    version: z.string(),
    type: z.literal("skill_version_deleted")
  })
);
var CreateSkillVersionRequestSchema = registry.register(
  "CreateSkillVersionRequest",
  z.object({
    content: z.string().openapi({ description: "Skill content (SKILL.md body)." }),
    version: z.string().optional().openapi({
      description: "Explicit version label. Auto-incremented from current_version if omitted."
    })
  })
);
var SkillsStatsResponseSchema = registry.register(
  "SkillsStatsResponse",
  z.record(z.unknown()).openapi({ description: "Aggregated skill statistics." })
);
var SkillsSourcesResponseSchema = registry.register(
  "SkillsSourcesResponse",
  z.object({
    data: z.array(z.record(z.unknown())),
    total: z.number().int().nonnegative()
  })
);
var MetricsTotalsSchema = z.object({
  session_count: z.number().int().nonnegative(),
  turn_count: z.number().int().nonnegative(),
  tool_call_count: z.number().int().nonnegative(),
  error_count: z.number().int().nonnegative(),
  active_seconds: z.number().nonnegative(),
  input_tokens: z.number().int().nonnegative(),
  output_tokens: z.number().int().nonnegative(),
  cache_read_input_tokens: z.number().int().nonnegative(),
  cache_creation_input_tokens: z.number().int().nonnegative(),
  cost_usd: z.number().nonnegative()
});
var MetricsResponseSchema = registry.register(
  "MetricsResponse",
  z.object({
    window: z.object({ from: z.number(), to: z.number() }),
    group_by: z.string(),
    totals: MetricsTotalsSchema,
    groups: z.array(MetricsTotalsSchema.extend({ key: z.string() })),
    stop_reasons: z.record(z.number()),
    tool_latency_p50_ms: z.number().nullable(),
    tool_latency_p95_ms: z.number().nullable(),
    tool_latency_p99_ms: z.number().nullable(),
    tool_call_sample_count: z.number().int().nonnegative()
  })
);
var ApiMetricsResponseSchema = registry.register(
  "ApiMetricsResponse",
  z.object({
    window_ms: z.number(),
    window_minutes: z.number(),
    now_ms: z.number(),
    totals: z.object({
      count: z.number().int().nonnegative(),
      rps: z.number().nonnegative(),
      p50_ms: z.number().nullable(),
      p95_ms: z.number().nullable(),
      p99_ms: z.number().nullable(),
      status_2xx: z.number().int().nonnegative(),
      status_3xx: z.number().int().nonnegative(),
      status_4xx: z.number().int().nonnegative(),
      status_5xx: z.number().int().nonnegative(),
      error_rate: z.number().nonnegative()
    }),
    routes: z.array(z.record(z.unknown())),
    timeline: z.array(z.record(z.unknown()))
  })
);
var PutSettingRequestSchema = registry.register(
  "PutSettingRequest",
  z.object({
    key: z.string().openapi({ description: "Setting key to update." }),
    value: z.string().openapi({ description: "New value for the setting." })
  })
);
var SettingResponseSchema = registry.register(
  "SettingResponse",
  z.object({
    key: z.string(),
    value: z.string().nullable(),
    configured: z.boolean(),
    masked: z.boolean().optional().openapi({ description: "True when the value is a masked secret." })
  })
);
var ProviderStatusResponseSchema = registry.register(
  "ProviderStatusResponse",
  z.object({
    data: z.record(z.object({
      available: z.boolean(),
      message: z.string().optional()
    })).openapi({ description: "Per-provider availability status." })
  })
);
var ModelEntrySchema = registry.register(
  "ModelEntry",
  z.object({
    id: z.string().openapi({ description: "Canonical model identifier.", example: "claude-sonnet-4-6" }),
    provider: z.string().openapi({ description: "Source provider: anthropic, openai, google, ollama, openrouter." }),
    engines: z.record(z.string()).openapi({
      description: "Engine name to engine-specific model ID mapping.",
      example: { claude: "claude-sonnet-4-6", opencode: "anthropic/claude-sonnet-4-6" }
    }),
    context_window: z.number().int().optional().openapi({ description: "Context window size in tokens, if known." }),
    local: z.boolean().optional().openapi({ description: "True for locally-running models (e.g. Ollama)." })
  })
);
var ModelListResponseSchema = registry.register(
  "ModelListResponse",
  z.object({
    data: z.array(ModelEntrySchema)
  })
);
var WhoamiResponseSchema = registry.register(
  "WhoamiResponse",
  z.object({
    name: z.string(),
    tenant_id: z.string().nullable(),
    is_global_admin: z.boolean(),
    permissions: KeyPermissionsSchema
  })
);
var LicenseResponseSchema = registry.register(
  "LicenseResponse",
  z.object({
    plan: z.enum(["community", "enterprise"]),
    features: z.array(z.string()),
    limits: z.object({
      maxKeys: z.number().int(),
      auditRetentionMs: z.number().int()
    }).nullable().openapi({ description: "Community-tier limits. Null for enterprise." })
  })
);

export {
  ErrorEnvelopeSchema,
  ToolConfigSchema,
  McpServerConfigSchema,
  AgentSkillSchema,
  ModelConfigSchema,
  AgentSchema,
  CreateAgentRequestSchema,
  UpdateAgentRequestSchema,
  EnvironmentConfigSchema,
  EnvironmentSchema,
  CreateEnvironmentRequestSchema,
  UpdateEnvironmentRequestSchema,
  SessionStatusSchema,
  SessionSchema,
  CreateSessionRequestSchema,
  UpdateSessionRequestSchema,
  UserEventSchema,
  UserEventBatchRequestSchema,
  ManagedEventSchema,
  VaultSchema,
  VaultEntrySchema,
  CreateVaultRequestSchema,
  UpdateVaultRequestSchema,
  SetVaultEntryRequestSchema,
  VaultDeletedResponseSchema,
  VaultEntryDeletedResponseSchema,
  BatchOperationSchema,
  BatchRequestSchema,
  BatchResultSchema,
  BatchResponseSchema,
  AgentListResponseSchema,
  EnvironmentListResponseSchema,
  SessionListResponseSchema,
  EventListResponseSchema,
  VaultListResponseSchema,
  VaultEntryListResponseSchema,
  TrustGrantSchema,
  UserProfileSchema,
  UserProfileCreateSchema,
  UserProfileUpdateSchema,
  UserProfileListSchema,
  EnrollmentUrlRequestSchema,
  EnrollmentUrlResponseSchema,
  AgentDeletedResponseSchema,
  SessionDeletedResponseSchema,
  EnvironmentDeletedResponseSchema,
  UserEventAppendResponseSchema,
  FileRecordSchema,
  FileListResponseSchema,
  FileDeletedResponseSchema,
  VaultCredentialSchema,
  CreateCredentialRequestSchema,
  UpdateCredentialRequestSchema,
  CredentialListResponseSchema,
  CredentialDeletedResponseSchema,
  MemoryStoreSchema,
  CreateMemoryStoreRequestSchema,
  MemoryStoreListResponseSchema,
  MemoryStoreDeletedResponseSchema,
  MemorySchema,
  CreateMemoryRequestSchema,
  UpdateMemoryRequestSchema,
  MemoryListResponseSchema,
  MemoryDeletedResponseSchema,
  SessionResourceSchema,
  AddResourceRequestSchema,
  ResourceListResponseSchema,
  ResourceDeletedResponseSchema,
  ApiKeySchema,
  ApiKeyCreatedSchema,
  CreateApiKeyRequestSchema,
  PatchApiKeyRequestSchema,
  ApiKeyListResponseSchema,
  ApiKeyRevokedResponseSchema,
  ApiKeyActivityResponseSchema,
  UpstreamKeySchema,
  AddUpstreamKeyRequestSchema,
  PatchUpstreamKeyRequestSchema,
  UpstreamKeyListResponseSchema,
  UpstreamKeyDeletedResponseSchema,
  TenantSchema,
  CreateTenantRequestSchema,
  PatchTenantRequestSchema,
  TenantListResponseSchema,
  TenantArchivedResponseSchema,
  AuditEntrySchema,
  AuditListResponseSchema,
  TraceListItemSchema,
  TraceListResponseSchema,
  TraceDetailSchema,
  TraceExportResponseSchema,
  SkillsCatalogResponseSchema,
  SkillsSearchResponseSchema,
  SkillSchema,
  SkillVersionSchema,
  SkillListResponseSchema,
  SkillVersionListResponseSchema,
  SkillDeletedResponseSchema,
  SkillVersionDeletedResponseSchema,
  CreateSkillVersionRequestSchema,
  SkillsStatsResponseSchema,
  SkillsSourcesResponseSchema,
  MetricsResponseSchema,
  ApiMetricsResponseSchema,
  PutSettingRequestSchema,
  SettingResponseSchema,
  ProviderStatusResponseSchema,
  ModelEntrySchema,
  ModelListResponseSchema,
  WhoamiResponseSchema,
  LicenseResponseSchema
};
