Cotal TypeScript packages
    Preparing search index...

    Interface AdmittedChatSession

    One admitted opening. An adapter implements this over the existing participant engine; the CLI front ends (TUI, --stdio) consume it and nothing else.

    interface AdmittedChatSession {
        anycast(role: string, text: string): Promise<PublishResult>;
        channelInfo(channel: string): Promise<Result<ChannelInfo>>;
        close(): Promise<CloseReport>;
        connection(): Promise<Result<ConnectionReport>>;
        dm(to: DmTarget, text: string, replyTo?: string): Promise<PublishResult>;
        history(channel: string, limit: number): Promise<Result<HistoryPage>>;
        identity(): SessionIdentity;
        inbox(peek: boolean): Promise<Result<readonly SessionMessage[]>>;
        invoke(
            endpoint: string,
            command: string,
            args: Readonly<Record<string, unknown>> | undefined,
            timeoutMs: number,
        ): Promise<Result<unknown>>;
        join(
            channel: string,
        ): Promise<
            Result<
                {
                    backfilled: number;
                    durable: boolean;
                    joined: boolean;
                    reason?: string;
                },
            >,
        >;
        leave(channel: string): Promise<Result<{ left: boolean }>>;
        reconnect(): Promise<Result<{ message: string; reconnected: boolean }>>;
        resolveDm(to: DmTarget): Promise<Result<{ id: string; name: string }>>;
        roster(): Promise<Result<RosterView>>;
        send(
            text: string,
            channel: string,
            mentions: readonly string[],
            replyTo?: string,
        ): Promise<PublishResult>;
        setAttention(mode: AttentionMode): Promise<Result<void>>;
        setChannelMode(
            channel: string,
            mode: ChannelMode | "normal",
        ): Promise<Result<void>>;
        setStatus(
            status: "waiting" | "idle" | "working",
            activity?: string,
        ): Promise<Result<void>>;
        subscribe(listener: (event: SessionEvent) => void): () => void;
        surfaced(deliveryKeys: readonly string[]): void;
    }

    Implemented by

    Index
    • Endpoint invoke within the session's own grants. A seat-only or unbound command refuses natively.

      Parameters

      • endpoint: string
      • command: string
      • args: Readonly<Record<string, unknown>> | undefined
      • timeoutMs: number

      Returns Promise<Result<unknown>>

    • Parameters

      • channel: string

      Returns Promise<
          Result<
              {
                  backfilled: number;
                  durable: boolean;
                  joined: boolean;
                  reason?: string;
              },
          >,
      >

    • Reconnect THIS opening only. Never creates a new identity; refuses when it cannot keep this one.

      Returns Promise<Result<{ message: string; reconnected: boolean }>>

    • Post text on channel. replyTo names the message it answers.

      Parameters

      • text: string
      • channel: string
      • mentions: readonly string[]
      • OptionalreplyTo: string

      Returns Promise<PublishResult>

    • Acknowledge deliveries after they were written or shown. Unacknowledged ones redeliver.

      Parameters

      • deliveryKeys: readonly string[]

      Returns void