import type * as lark from '@larksuiteoapi/node-sdk'; /** * Feishu COT (chain-of-thought) message HTTP operations. * * This module is a thin, stateless wrapper over the three official endpoints, * their request envelope, and their response validation. It knows nothing about * Teams, channel origins, reply/react, presentation lifecycle, or AG-UI * semantics — the caller hands over an event type plus an already-built content * object and this module owns turning that into the official wire event. * * The wire event is built in exactly one private place, so a caller can never * mistake the inner AG-UI *content object* for the outer * `{event_type, content, timestamp}` envelope Feishu actually accepts. */ /** Per the official contract, one append carries 1..50 COT events. */ export declare const FEISHU_COT_APPEND_MAX_EVENTS = 50; /** Terminal reasons the complete endpoint accepts. */ export type FeishuCotCompleteReason = 'done' | 'error' | 'timeout'; /** * A COT call the platform rejected, carrying Feishu's own business `code` so a * caller can log a precise error *category* without ever logging a free-form * message, which could echo a host path or payload. `code` is `null` when the * call succeeded at the HTTP level but the response was unusable. */ export declare class FeishuCotApiError extends Error { readonly code: number | null; constructor(code: number | null, message: string); } /** * One COT event as the caller supplies it: the official `event_type` plus the * structured content object for that type. Serialization and timestamping are * this module's job, never the caller's. */ export interface FeishuCotEventInput { readonly eventType: string; readonly content: Record; } export interface FeishuCotCreateInput { /** The chat the COT is created in (`receive_id_type=chat_id`). */ chatId: string; /** Source message the COT is anchored to. */ originMessageId?: string; /** Let Feishu place the COT in the source message's thread. */ replyInThread?: boolean; /** Official display switches; all default to `false`. */ cotHidden?: boolean; enableBadge?: boolean; updateFeedRank?: boolean; } export interface FeishuCotCreateResult { cotId: string; messageId: string; } export interface FeishuCotAppendInput { /** `cot_id` from the create response. */ cotId: string; /** `message_id` from the create response; the append endpoint requires it. */ messageId: string; /** 1..50 events for this batch, wrapped and serialized by this module. */ events: readonly FeishuCotEventInput[]; } export interface FeishuCotCompleteInput { /** `cot_id` from the create response; it is a path segment. */ cotId: string; /** `message_id` from the create response; the endpoint requires it. */ messageId: string; reason: FeishuCotCompleteReason; } /** * The COT capability surface. Optional on a transport/bot so an older or * externally supplied implementation simply has no COT and callers degrade to * no presentation rather than failing. */ export interface FeishuCotClient { createCot(input: FeishuCotCreateInput): Promise; appendCot(input: FeishuCotAppendInput): Promise; completeCot(input: FeishuCotCompleteInput): Promise; } export interface FeishuCotClientOptions { /** Millisecond clock for event timestamps. Injectable for deterministic tests. */ now?: () => number; } type FeishuRequestClient = Pick; export declare function createFeishuCotClient(client: FeishuRequestClient, options?: FeishuCotClientOptions): FeishuCotClient; export {}; //# sourceMappingURL=cot.d.ts.map