Skip to content
8 min read · 1,689 words

Variable: defaultBuildChatCompletionsHistory

ts
const defaultBuildChatCompletionsHistory: (input: {
  bucketOrder: ChatCompletionsBucketOrder;
  filterThoughts: (thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[];
  memories: Iterable<Memory>;
  messages: Iterable<Message>;
  renderChatCompletionsSystemPrompt: (input: {
     bucketOrder: ChatCompletionsBucketOrder;
     memories: Iterable<Memory>;
     renderCtx?: unknown;
     renderFirstPartyRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string) => Promise<string>;
     renderMemories: (items: Iterable<{
        attrs: MemoryAttrs;
        memory: Memory;
     }>) => string;
     renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string;
     renderRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, deps: {
        renderFirstPartyRetrievables: (items: Iterable<{
           attrs: RetrievableAttrs;
           retrievable: Retrievable;
         }>, renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: ... | ...;
           estimatedTokens?: ... | ...;
           lineCount: number;
        }) => string) => Promise<string>;
        renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: string;
           estimatedTokens?: number;
           lineCount: number;
        }) => string;
        renderRetrievableSafetyDirective: () => string;
        renderThirdPartyPrivateRetrievables: (items: Iterable<{
           attrs: RetrievableAttrs;
           retrievable: Retrievable;
         }>, deps: {
           renderRetrievableHandleBody?: (input: {
              artifact: ...;
              byteLength: ...;
              callId: ...;
              encoding?: ...;
              estimatedTokens?: ...;
              lineCount: ...;
           }) => string;
           renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
        }) => Promise<string>;
        renderThirdPartyPublicRetrievables: (items: Iterable<{
           attrs: RetrievableAttrs;
           retrievable: Retrievable;
         }>, deps: {
           renderRetrievableHandleBody?: (input: {
              artifact: ...;
              byteLength: ...;
              callId: ...;
              encoding?: ...;
              estimatedTokens?: ...;
              lineCount: ...;
           }) => string;
           renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
        }) => Promise<string>;
        renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     }) => Promise<string>;
     renderRetrievableSafetyDirective: () => string;
     renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string;
     renderThirdPartyPrivateRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, deps: {
        renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: string;
           estimatedTokens?: number;
           lineCount: number;
        }) => string;
        renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     }) => Promise<string>;
     renderThirdPartyPublicRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, deps: {
        renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: string;
           estimatedTokens?: number;
           lineCount: number;
        }) => string;
        renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     }) => Promise<string>;
     renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     retrievables: Iterable<Retrievable>;
     standingInstructions: Iterable<Tokenizable>;
     systemPrompt: Tokenizable;
  }) => Promise<string>;
  renderChatCompletionsToolCallResult: (input: {
     renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
     renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     results:   | Tokenizable
        | SpooledArtifact
        | Media
        | Media[]
        | SpooledArtifact[];
     tool:   | Tool<SpooledArtifact>
        | ArtifactTool
        | undefined;
     toolCall: ToolCall;
     unsupportedMediaPolicy: UnsupportedMediaPolicy;
     warn?: (msg: string) => void;
   }) => Promise<
     | string
    | ChatCompletionsContentBlock[]>;
  renderedToolCallResults: Map<string,
     | string
    | ChatCompletionsContentBlock[]>;
  renderFirstPartyRetrievables: (items: Iterable<{
     attrs: RetrievableAttrs;
     retrievable: Retrievable;
   }>, renderRetrievableHandleBody?: (input: {
     artifact: unknown;
     byteLength: number;
     callId: string;
     encoding?: string;
     estimatedTokens?: number;
     lineCount: number;
  }) => string) => Promise<string>;
  renderMemories: (items: Iterable<{
     attrs: MemoryAttrs;
     memory: Memory;
  }>) => string;
  renderRetrievableHandleBody?: (input: {
     artifact: unknown;
     byteLength: number;
     callId: string;
     encoding?: string;
     estimatedTokens?: number;
     lineCount: number;
  }) => string;
  renderRetrievables: (items: Iterable<{
     attrs: RetrievableAttrs;
     retrievable: Retrievable;
   }>, deps: {
     renderFirstPartyRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string) => Promise<string>;
     renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string;
     renderRetrievableSafetyDirective: () => string;
     renderThirdPartyPrivateRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, deps: {
        renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: string;
           estimatedTokens?: number;
           lineCount: number;
        }) => string;
        renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     }) => Promise<string>;
     renderThirdPartyPublicRetrievables: (items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>, deps: {
        renderRetrievableHandleBody?: (input: {
           artifact: unknown;
           byteLength: number;
           callId: string;
           encoding?: string;
           estimatedTokens?: number;
           lineCount: number;
        }) => string;
        renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
     }) => Promise<string>;
     renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
  }) => Promise<string>;
  renderRetrievableSafetyDirective: () => string;
  renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string;
  renderThirdPartyPrivateRetrievables: (items: Iterable<{
     attrs: RetrievableAttrs;
     retrievable: Retrievable;
   }>, deps: {
     renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string;
     renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
  }) => Promise<string>;
  renderThirdPartyPublicRetrievables: (items: Iterable<{
     attrs: RetrievableAttrs;
     retrievable: Retrievable;
   }>, deps: {
     renderRetrievableHandleBody?: (input: {
        artifact: unknown;
        byteLength: number;
        callId: string;
        encoding?: string;
        estimatedTokens?: number;
        lineCount: number;
     }) => string;
     renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
  }) => Promise<string>;
  renderThought: (content: string, attrs: ThoughtAttrs, payload?: unknown) => string;
  renderTimelineMessage: (input: {
     message: Message;
     selfIdentity: string;
     unsupportedMediaPolicy: UnsupportedMediaPolicy;
     warn?: (msg: string) => void;
  }) => Promise<ChatCompletionsMessage>;
  renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
  renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string;
  replayCompatibility: readonly string[];
  retrievables: Iterable<Retrievable>;
  selfIdentity: string;
  standingInstructions: Iterable<Tokenizable>;
  systemPrompt: Tokenizable;
  thoughts: Iterable<Thought>;
  thoughtSurfacing: "all-self" | "latest-self" | "all";
  toolCalls: Iterable<ToolCall>;
  tools: ToolRegistry;
  unsupportedMediaPolicy: UnsupportedMediaPolicy;
  warn?: (msg: string) => void;
}) => Promise<{
  messages: ChatCompletionsMessage[];
  reasoningPayloads: {
     id: string;
     payload: unknown;
     replayCompatibility: string;
  }[];
}> = buildChatCompletionsHistory;

Defined in: src/batteries/llm/openai_chat_completions/helpers.ts:919

Default history assembler; alias of buildChatCompletionsHistory.

Assembles the complete OpenAI Chat Completions message history for a dispatch — system prompt and content buckets, the interleaved timeline of messages/thoughts/tool calls (with synthetic assistant.tool_calls and tool.tool_call_id shaping), and the collected opaque reasoning payloads — by delegating to the injected sub-renderers.

Parameters

ParameterType
input{ bucketOrder: ChatCompletionsBucketOrder; filterThoughts: (thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[]; memories: Iterable<Memory>; messages: Iterable<Message>; renderChatCompletionsSystemPrompt: (input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderCtx?: unknown; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: ... | ...; estimatedTokens?: ... | ...; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string>; renderChatCompletionsToolCallResult: (input: { renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; results: | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[]; tool: | Tool<SpooledArtifact> | ArtifactTool | undefined; toolCall: ToolCall; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise< | string | ChatCompletionsContentBlock[]>; renderedToolCallResults: Map<string, | string | ChatCompletionsContentBlock[]>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThought: (content: string, attrs: ThoughtAttrs, payload?: unknown) => string; renderTimelineMessage: (input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ChatCompletionsMessage>; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; replayCompatibility: readonly string[]; retrievables: Iterable<Retrievable>; selfIdentity: string; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; thoughts: Iterable<Thought>; thoughtSurfacing: "all-self" | "latest-self" | "all"; toolCalls: Iterable<ToolCall>; tools: ToolRegistry; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }
input.bucketOrderChatCompletionsBucketOrder
input.filterThoughts(thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[]
input.memoriesIterable<Memory>
input.messagesIterable<Message>
input.renderChatCompletionsSystemPrompt(input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderCtx?: unknown; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: ... | ...; estimatedTokens?: ... | ...; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string>
input.renderChatCompletionsToolCallResult(input: { renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; results: | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[]; tool: | Tool<SpooledArtifact> | ArtifactTool | undefined; toolCall: ToolCall; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise< | string | ChatCompletionsContentBlock[]>
input.renderedToolCallResultsMap<string, | string | ChatCompletionsContentBlock[]>
input.renderFirstPartyRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>
input.renderMemories(items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string
input.renderRetrievableHandleBody?(input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string
input.renderRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderRetrievableSafetyDirective() => string
input.renderStandingInstructions(items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string
input.renderThirdPartyPrivateRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderThirdPartyPublicRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderThought(content: string, attrs: ThoughtAttrs, payload?: unknown) => string
input.renderTimelineMessage(input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ChatCompletionsMessage>
input.renderTrustedContent(content: string, attrs: TrustedContentAttrs) => string
input.renderUntrustedContent(content: string, attrs: UntrustedContentAttrs) => string
input.replayCompatibilityreadonly string[]
input.retrievablesIterable<Retrievable>
input.selfIdentitystring
input.standingInstructionsIterable<Tokenizable>
input.systemPromptTokenizable
input.thoughtsIterable<Thought>
input.thoughtSurfacing"all-self" | "latest-self" | "all"
input.toolCallsIterable<ToolCall>
input.toolsToolRegistry
input.unsupportedMediaPolicyUnsupportedMediaPolicy
input.warn?(msg: string) => void

Returns

Promise<{ messages: ChatCompletionsMessage[]; reasoningPayloads: { id: string; payload: unknown; replayCompatibility: string; }[]; }>