/* tslint:disable */
/* eslint-disable */
export function load_harmony_encoding(name: string, base_url?: string | null): Promise<JsHarmonyEncoding>;
export function get_tool_namespace_config(tool: string): any;
export enum StreamState {
  ExpectStart = 0,
  Header = 1,
  Content = 2,
}
/**
 * The `ReadableStreamType` enum.
 *
 * *This API requires the following crate features to be activated: `ReadableStreamType`*
 */
type ReadableStreamType = "bytes";
export interface RenderConversationConfig {
    auto_drop_analysis: boolean;
}

/**
 * Content specific to developer messages, includes developer identity and its instructions
 */
export interface DeveloperContent {
    instructions: string | null;
    tools: Record<string, ToolNamespaceConfig> | null;
}

export interface Conversation {
    messages: Message[];
}

export interface ToolDescription {
    name: string;
    description: string;
    parameters: Value | null;
}

/**
 * Content specific to system messages, includes model identity and its instructions
 */
export interface SystemContent {
    model_identity: string | null;
    reasoning_effort: ReasoningEffort | null;
    tools: Record<string, ToolNamespaceConfig> | null;
    /**
     * Date/Time at which the conversation is taking place.
     * Must be an isoformat date for portability to javascript.
     */
    conversation_start_date: string | null;
    /**
     * The date at which the model\'s training data ends.
     */
    knowledge_cutoff: string | null;
    /**
     * Channel configuration for the system message.
     */
    channel_config: ChannelConfig | null;
}

export interface ToolNamespaceConfig {
    name: string;
    description: string | null;
    tools: ToolDescription[];
}

export interface ChannelConfig {
    /**
     * List of valid channels to instruct the model it can generate.
     *
     * If empty, this part of the system message will not be rendered.
     */
    valid_channels: string[];
    /**
     * If True, every assistant\'s message must have channel value set.
     */
    channel_required: boolean;
}

export type ReasoningEffort = "Low" | "Medium" | "High";

export interface TextContent {
    text: string;
}

export interface Message extends Author {
    /**
     * The intended recipient of the message. If not set, the message is
     * is intend for all (this is the default). Can also be set to specific
     * identifiers (e.g., \'user\', \'assistant\', etc.) In the case of a tool call,
     * the recipient is the name of the tool.
     */
    recipient?: string;
    /**
     * The main content of the message. This can be of various types
     * (e.g., text, code) and structures, depending on the type of `MessageContent` used.
     */
    content: Content[];
    /**
     * Specifies the target channel (context) for the message, allowing
     * models to annotate their responses and e.g. control message visibility.
     * By default, messages do not have channel set (None) and it\'s not rendered.
     * When set and render_channel=True, the channel is rendered in message header as
     * <|channel|>CHANNEL_VALUE (usually, \"<|meta_sep|>CHANNEL_VALUE\"). To not render
     * channels, use `formatter.render_channel = False`. (note: parsing will raise an error
     * if render_channel=False, but a channel was sampled).
     */
    channel?: string;
    /**
     * Content type of the message. This is typically only set by the model, you probably don\'t need to set this.
     */
    content_type?: string;
}

export type Content = ({ type: "text" } & TextContent) | ({ type: "system_content" } & SystemContent) | ({ type: "developer_content" } & DeveloperContent);

export type Role = "user" | "assistant" | "system" | "developer" | "tool";

export interface Author {
    role: Role;
    name?: string;
}

export class IntoUnderlyingByteSource {
  private constructor();
  free(): void;
  start(controller: ReadableByteStreamController): void;
  pull(controller: ReadableByteStreamController): Promise<any>;
  cancel(): void;
  readonly type: ReadableStreamType;
  readonly autoAllocateChunkSize: number;
}
export class IntoUnderlyingSink {
  private constructor();
  free(): void;
  write(chunk: any): Promise<any>;
  close(): Promise<any>;
  abort(reason: any): Promise<any>;
}
export class IntoUnderlyingSource {
  private constructor();
  free(): void;
  pull(controller: ReadableStreamDefaultController): Promise<any>;
  cancel(): void;
}
export class JsHarmonyEncoding {
  private constructor();
  free(): void;
  renderConversationForCompletion(conversation: Conversation, next_turn_role: string, config: RenderConversationConfig): Uint32Array;
  renderConversation(conversation: Conversation, config: RenderConversationConfig): Uint32Array;
  render(message: Message, render_options: RenderOptions): Uint32Array;
  parseMessagesFromCompletionTokens(tokens: Uint32Array, role?: string | null): string;
  decodeUtf8(tokens: Uint32Array): string;
  decodeBytes(tokens: Uint32Array): Uint8Array;
  encode(text: string, allowed_special: any): Uint32Array;
  specialTokens(): string[];
  isSpecialToken(token: number): boolean;
  stopTokens(): Uint32Array;
  stopTokensForAssistantActions(): Uint32Array;
  readonly name: string;
}
export class JsStreamableParser {
  free(): void;
  constructor(encoding: JsHarmonyEncoding, role: string);
  process(token: number): void;
  readonly currentContent: string;
  readonly currentRole: string;
  readonly currentContentType: string;
  readonly lastContentDelta: string;
  readonly messages: string;
  readonly tokens: Uint32Array;
  readonly state: string;
  readonly currentRecipient: string;
  readonly currentChannel: string;
}