ACP v2 TypeScript SDK — EXPERIMENTAL DRAFT - v1.3.0
    Preparing search index...

    Variable SessionUpdateExperimental

    SessionUpdate: {
        isUserMessageChunk(
            value: SessionUpdate,
        ): value is ContentChunk & { sessionUpdate: "user_message_chunk" };
        isUserMessage(
            value: SessionUpdate,
        ): value is UserMessage & { sessionUpdate: "user_message" };
        isAgentMessageChunk(
            value: SessionUpdate,
        ): value is ContentChunk & { sessionUpdate: "agent_message_chunk" };
        isAgentMessage(
            value: SessionUpdate,
        ): value is AgentMessage & { sessionUpdate: "agent_message" };
        isAgentThoughtChunk(
            value: SessionUpdate,
        ): value is ContentChunk & { sessionUpdate: "agent_thought_chunk" };
        isAgentThought(
            value: SessionUpdate,
        ): value is AgentThought & { sessionUpdate: "agent_thought" };
        isStateUpdate(
            value: SessionUpdate,
        ): value is StateUpdate & { sessionUpdate: "state_update" };
        isToolCallContentChunk(
            value: SessionUpdate,
        ): value is ToolCallContentChunk & {
            sessionUpdate: "tool_call_content_chunk";
        };
        isToolCallUpdate(
            value: SessionUpdate,
        ): value is ToolCallUpdate & { sessionUpdate: "tool_call_update" };
        isTerminalUpdate(
            value: SessionUpdate,
        ): value is TerminalUpdate & { sessionUpdate: "terminal_update" };
        isTerminalOutputChunk(
            value: SessionUpdate,
        ): value is TerminalOutputChunk & {
            sessionUpdate: "terminal_output_chunk";
        };
        isPlanUpdate(
            value: SessionUpdate,
        ): value is PlanUpdate & { sessionUpdate: "plan_update" };
        isPlanRemoved(
            value: SessionUpdate,
        ): value is PlanRemoved & { sessionUpdate: "plan_removed" };
        isAvailableCommandsUpdate(
            value: SessionUpdate,
        ): value is AvailableCommandsUpdate & {
            sessionUpdate: "available_commands_update";
        };
        isConfigOptionUpdate(
            value: SessionUpdate,
        ): value is ConfigOptionUpdate & { sessionUpdate: "config_option_update" };
        isSessionInfoUpdate(
            value: SessionUpdate,
        ): value is SessionInfoUpdate & { sessionUpdate: "session_info_update" };
        isUsageUpdate(
            value: SessionUpdate,
        ): value is UsageUpdate & { sessionUpdate: "usage_update" };
        isCustom(
            value: SessionUpdate,
        ): value is { sessionUpdate: string; [key: string]: unknown };
    }

    Validated type guards for SessionUpdate's known variants.

    Each guard validates the variant's payload, not just its discriminant tag: a malformed known variant (right tag, wrong payload) matches no guard — mirroring wire validation, which rejects such values instead of classifying them as custom.

    Guards check the value as given: fields that wire deserialization salvages to a default (e.g. a malformed _meta) are only normalized by parsing, and for ambiguous raw shapes (a known tag combined with another variant's payload) guards are conservative where wire parsing may still accept the value — narrow wire-parsed values when exact parity matters.

    Type Declaration

    • isUserMessageChunk: function
      • Narrow to the user_message_chunk variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ContentChunk & { sessionUpdate: "user_message_chunk" }

    • isUserMessage: function
      • Narrow to the user_message variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is UserMessage & { sessionUpdate: "user_message" }

    • isAgentMessageChunk: function
      • Narrow to the agent_message_chunk variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ContentChunk & { sessionUpdate: "agent_message_chunk" }

    • isAgentMessage: function
      • Narrow to the agent_message variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is AgentMessage & { sessionUpdate: "agent_message" }

    • isAgentThoughtChunk: function
      • Narrow to the agent_thought_chunk variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ContentChunk & { sessionUpdate: "agent_thought_chunk" }

    • isAgentThought: function
      • Narrow to the agent_thought variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is AgentThought & { sessionUpdate: "agent_thought" }

    • isStateUpdate: function
      • Narrow to the state_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is StateUpdate & { sessionUpdate: "state_update" }

    • isToolCallContentChunk: function
      • Narrow to the tool_call_content_chunk variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ToolCallContentChunk & { sessionUpdate: "tool_call_content_chunk" }

    • isToolCallUpdate: function
      • Narrow to the tool_call_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ToolCallUpdate & { sessionUpdate: "tool_call_update" }

    • isTerminalUpdate: function
      • Narrow to the terminal_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is TerminalUpdate & { sessionUpdate: "terminal_update" }

    • isTerminalOutputChunk: function
      • Narrow to the terminal_output_chunk variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is TerminalOutputChunk & { sessionUpdate: "terminal_output_chunk" }

    • isPlanUpdate: function
      • Narrow to the plan_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is PlanUpdate & { sessionUpdate: "plan_update" }

    • isPlanRemoved: function
      • Narrow to the plan_removed variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is PlanRemoved & { sessionUpdate: "plan_removed" }

    • isAvailableCommandsUpdate: function
      • Narrow to the available_commands_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is AvailableCommandsUpdate & {
            sessionUpdate: "available_commands_update";
        }

    • isConfigOptionUpdate: function
      • Narrow to the config_option_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is ConfigOptionUpdate & { sessionUpdate: "config_option_update" }

    • isSessionInfoUpdate: function
      • Narrow to the session_info_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is SessionInfoUpdate & { sessionUpdate: "session_info_update" }

    • isUsageUpdate: function
      • Narrow to the usage_update variant, validating its payload.

        Parameters

        • value: SessionUpdate

        Returns value is UsageUpdate & { sessionUpdate: "usage_update" }

    • isCustom: function
      • Narrow to a custom or future variant: the sessionUpdate tag matches no known variant.

        TypeScript keeps the known variants in the narrowed union (they are structural subtypes of the catch-all), so read vendor payload keys via a widening cast: (value as Record<string, unknown>).someKey.

        Parameters

        • value: SessionUpdate

        Returns value is { sessionUpdate: string; [key: string]: unknown }