/** * Create a fresh session for the negotiated protocol version. Called * from the HTTP handler after a successful `initialize`. The session ID * is generated server-side; never trust a client-supplied value. * * `identitySubject` is the JWT subject the gateway resolved at * `initialize` time (or `null` if the caller was anonymous). It binds * the session to a specific user so DELETE can verify the teardown * caller matches the creator. */ export declare const createSession: import("convex/server").RegisteredMutation<"public", { identitySubject: string | null; protocolVersion: string; sessionId: string; }, Promise>>; /** * Look up a session by its public id. Returns null if unknown or * already terminated; the HTTP handler responds with 404 in that case * so the client knows to start a new session per MCP 2025-06-18. */ export declare const getSession: import("convex/server").RegisteredQuery<"public", { sessionId: string; }, Promise<{ _id: import("convex/values").GenericId<"sessions">; _creationTime: number; identitySubject?: string | null | undefined; protocolVersion: string; sessionId: string; createdAt: number; lastSeenAt: number; } | null>>; /** * Mark the session as recently seen so a future timeout-based pruner * can distinguish active from idle sessions. Best-effort: failures are * non-fatal and the HTTP handler swallows them. */ export declare const touchSession: import("convex/server").RegisteredMutation<"public", { sessionId: string; }, Promise>; /** * Terminate a session if the calling identity matches what was bound * at create time. The HTTP DELETE handler calls this; the * spec-required follow-up is HTTP 404 (no such session) or 403 * (mismatch). Pre-binding session rows (no `identitySubject` field) * fall back to the legacy "delete anything you know the id of" * behaviour for forward-compat; new rows always have the field and * always check. */ export declare const deleteSession: import("convex/server").RegisteredMutation<"public", { sessionId: string; callerIdentitySubject: string | null; }, Promise<"forbidden" | "deleted" | "not_found">>; export declare const pruneSessions: import("convex/server").RegisteredMutation<"public", { olderThanMs: number; }, Promise>; /** * Record a `resources/subscribe` for (session, uri). Idempotent: a repeat * subscribe for the same pair returns `"exists"` without inserting a * duplicate. Returns `"limit_exceeded"` once the session holds * `SUBSCRIPTION_CAP` distinct subscriptions. The caller (HTTP handler) has * already validated the session and the caller's identity. */ export declare const subscribeResource: import("convex/server").RegisteredMutation<"public", { uri: string; sessionId: string; }, Promise<"subscribed" | "exists" | "limit_exceeded">>; /** * Remove a `resources/subscribe` for (session, uri). Returns `true` when a * row was deleted, `false` when the pair was not subscribed. */ export declare const unsubscribeResource: import("convex/server").RegisteredMutation<"public", { uri: string; sessionId: string; }, Promise>; /** * List the session IDs currently subscribed to `uri`. The host reads this * to decide whom to deliver a `notifications/resources/updated` to over its * own (push-capable) transport. Rows may reference sessions that have since * been idle-pruned; the host treats unknown sessions as no-ops and runs * `pruneOrphanResourceSubscriptions` to clean them. */ export declare const listResourceSubscribers: import("convex/server").RegisteredQuery<"public", { uri: string; }, Promise>; /** * Drop subscription rows whose session no longer exists (e.g. sessions * dropped by `pruneSessions`, which does not cascade). Orphans are a * *sparse* predicate (they can sit anywhere in the table behind live rows) * so this scans a fixed window per call ordered by creation time and reports * a `cursor` to resume from. Returning "0 deleted" does NOT mean "done" * (the window may have held only live rows); drain by following `cursor` * until it is `null`. `gateway.pruneResourceSubscriptions` does that loop. */ export declare const pruneOrphanResourceSubscriptions: import("convex/server").RegisteredMutation<"public", { cursorCreationTime?: number | undefined; }, Promise<{ deleted: number; cursor: number | null; }>>; //# sourceMappingURL=sessions.d.ts.map