Bluestep JS Documentation
    Preparing search index...

    Interface AiCallResult

    Result of B.ai.call().

    interface AiCallResult {
        denialCode: string;
        denialMessage: string;
        exchanges: number;
        inputTokens: number;
        iterations: number;
        mounts: { alias: string; pinnedSha: string; requestedRef: string }[];
        outputTokens: number;
        stopReason: string;
        text: string;
        toolCalls: {
            arguments: object;
            isError: boolean;
            name: string;
            result: string;
        }[];
    }
    Index
    denialCode: string

    Usage gate denial code. Populated only when stopReason == "ai_denied"; null on every turn the gate allowed.

    denialMessage: string

    User-facing usage gate denial message. Populated only when stopReason == "ai_denied"; null on every turn the gate allowed.

    exchanges: number

    Number of times the onTurn continuation callback was invoked. Always 0 when no callback was provided.

    inputTokens: number

    Total input tokens consumed across all iterations of this call.

    iterations: number

    Number of provider round-trips performed (each tool_use cycle counts as one).

    mounts: { alias: string; pinnedSha: string; requestedRef: string }[]

    The git repositories this call read, as {alias, pinnedSha, requestedRef}. Record these alongside the answer: a mount pins its ref to a commit once, so the pinned sha is what makes the answer reproducible, and without it the reproducibility claim cannot be checked from the caller's side. Empty when no repository was mounted.

    outputTokens: number

    Total output tokens consumed across all iterations of this call.

    stopReason: string

    Reason the model stopped emitting. Provider-native when the model itself stopped — Anthropic emits "end_turn" / "max_tokens" / "tool_use"; OpenAI-compatible providers (OpenAI, Groq, Together, Mistral, …) emit "stop" / "length" / "tool_calls". Synthetic values added by the BSJS orchestration layer: "ai_denied", "budget_exceeded", "iteration_limit", "max_iterations", "on_turn_exchange_limit", "on_turn_returned_invalid". Realtime audio turns (B.ai.streamingAgent) emit "completed" on a normal end of turn, and return partial output under "timeout" (wall-clock budget hit), "incomplete", or "cancelled" (provider ended the response early). Provider/transport failures (rate limits, circuit breaker, realtime error events or failed responses, interruption, etc.) are thrown as exceptions to the script rather than returned in this field. Null when the turn ended without any stop reason being set. Scripts that need to branch on "normal end of turn" should match "end_turn", "stop", and "completed" rather than hard-coding a single provider's vocabulary.

    text: string

    Final assistant text response. Empty string when the turn produced no text — a tool-use-only response carries none, and a turn refused by the usage gate never reaches the model.

    toolCalls: { arguments: object; isError: boolean; name: string; result: string }[]

    Summary of tool calls executed during this call. On the chat/tool path result is what the tool returned, kept at greater length than the model was shown — but still bounded across the whole call, so a run with very many tool calls records a trailing … tool result clipped line in place of later output. On the realtime audio path it is the model's own copy. In agent stub mode (AiAgent.sendMessage(message, false)) every entry has result: "action queued" and isError: false — no executor was invoked.