001/*
002 * Copyright 2022-2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.soklet;
018
019/**
020 * Bounded reasons for MCP request-stream and subscription termination.
021 *
022 * <p>
023 * This type may gain reviewed constants in Soklet 4.x; use a forward-compatible default when switching over its values.
024 *
025 * @author <a href="https://www.revetkn.com">Mark Allen</a>
026 */
027public enum McpStreamTerminationReason {
028        /** The stream completed normally. */
029        COMPLETED,
030        /** The client disconnected. */
031        CLIENT_DISCONNECTED,
032        /** The request was canceled. */
033        REQUEST_CANCELED,
034        /** The verified MCP session exceeded its idle or absolute lifetime. */
035        SESSION_EXPIRED,
036        /** The verified MCP session was explicitly closed. */
037        SESSION_CLOSED,
038        /** The request deadline elapsed. */
039        DEADLINE_EXCEEDED,
040        /** Stream output could not be written, including expiry of the write-idle timeout. */
041        WRITE_FAILED,
042        /** A bounded server transport or protocol-output queue was exhausted. */
043        BACKPRESSURE,
044        /** The MCP server is stopping. */
045        SERVER_STOPPING,
046        /** The simulator's pending stream-item capacity was exhausted. */
047        SIMULATOR_CAPTURE_ITEM_LIMIT_EXCEEDED,
048        /** The simulator's cumulative captured-byte capacity was exhausted. */
049        SIMULATOR_CAPTURE_BYTE_LIMIT_EXCEEDED,
050        /** The subscription authorizer denied continued access. */
051        SUBSCRIPTION_AUTHORIZATION_DENIED,
052        /** The subscription authorization lease expired. */
053        SUBSCRIPTION_AUTHORIZATION_EXPIRED,
054        /** A required subscription authorization check failed. */
055        SUBSCRIPTION_AUTHORIZATION_CHECK_FAILED,
056        /** Reconciliation failed to check fresh authorization; an explicit denial uses SUBSCRIPTION_AUTHORIZATION_DENIED. */
057        SUBSCRIPTION_RECONCILIATION_FAILED,
058        /** Soklet contained an unexpected stream failure. */
059        INTERNAL_ERROR
060}