ACP v2 (Preview) TypeScript SDK — UNSTABLE - v2.12.1
    Preparing search index...

    Variable CursorAnchorExperimental

    CursorAnchor: {
        isUserMessage(
            value: CursorAnchor,
        ): value is CursorMessageAnchor & { type: "user_message" };
        isAgentMessage(
            value: CursorAnchor,
        ): value is CursorMessageAnchor & { type: "agent_message" };
        isAgentThought(
            value: CursorAnchor,
        ): value is CursorMessageAnchor & { type: "agent_thought" };
        isSessionMessage(
            value: CursorAnchor,
        ): value is CursorMessageAnchor & { type: "session_message" };
        isToolCall(
            value: CursorAnchor,
        ): value is CursorToolCallAnchor & { type: "tool_call" };
        isCompaction(
            value: CursorAnchor,
        ): value is CursorCompactionAnchor & { type: "compaction" };
        isCustom(
            value: CursorAnchor,
        ): value is
            | { type: `_${string}`; [key: string]: unknown }
            | UnknownVariant<{ type: string; [key: string]: unknown }>;
    }

    Validated type guards for CursorAnchor'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

    • isUserMessage: function
    • isAgentMessage: function
    • isAgentThought: function
    • isSessionMessage: function
    • isToolCall: function
    • isCompaction: function
    • isCustom: function
      • Narrow to a custom or future variant: the type 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: CursorAnchor

        Returns value is
            | { type: `_${string}`; [key: string]: unknown }
            | UnknownVariant<{ type: string; [key: string]: unknown }>