Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1000 B
Raw Blame
/** Native reasoning text, or an empty delta for opaque reasoning activity. */
export function readKiroReasoningText(
  eventType: string,
  payload: Record<string, unknown> | undefined
): string | undefined {
  const reasoningText = payload?.reasoningText;
  let text = "";
  if (reasoningText && typeof reasoningText === "object") {
    const value = reasoningText as { text?: unknown; Text?: unknown };
    text =
      typeof value.text === "string"
        ? value.text
        : typeof value.Text === "string"
          ? value.Text
          : "";
  } else if (typeof reasoningText === "string") {
    text = reasoningText;
  } else if (typeof payload?.text === "string") {
    text = payload.text;
  }
  if (text) return text;
  // Preserve liveness without exposing signatures or claiming visible content.
  if (
    eventType === "reasoningContentEvent" &&
    typeof payload?.signature === "string" &&
    payload.signature.trim().length > 0
  ) {
    return "";
  }
  return undefined;
}