internal
type AIChunk = 
  | {type: "text", text: string, }
  | {type: "file", file: AIOutputFile, }
  | {type: "tool", id: string, name: string, arguments: AIJsonObject, }
  | {type: "done", reason: "completed" | "tool" | "cancelled", }
  | {type: "done", reason: "error", error: string, }