Interface: ClaudeCodeCliHelpers
Defined in: src/batteries/llm/claude_code_cli/types.ts:89
Full translation-helper contract for the Claude Code CLI battery. Extends the wire-shape- agnostic ChatHelpersCommon (shared with every other Chat-family battery) and adds the battery-specific members: a plain-text-only timeline-message renderer (a -p prompt string has no native image side-channel, unlike Ollama's images[]), a plain-text-only tool-call-result renderer for the inbound history direction, and the top-level history-to-prompt assembler.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
buildClaudeCodeCliPrompt | (input: { bucketOrder: ChatCompletionsBucketOrder; filterThoughts: (thoughts: Iterable<Thought>, mode: "all" | "all-self" | "latest-self", 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>; renderClaudeCodeCliTimelineMessage: (input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<string>; renderClaudeCodeCliToolCallResult: (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>; renderCtx?: unknown; renderedToolCallResults: Map<ToolCall, string>; 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; 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" | "all-self" | "latest-self"; toolCalls: Iterable<ToolCall>; tools: ToolRegistry; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<{ prompt: string; reasoningPayloads: { id: string; payload: unknown; replayCompatibility: string; }[]; }> | Assembles the full history into a single joined prompt string: the leading system-prompt block, the timestamp-sorted timeline (messages/thoughts/tool-calls), and any trailing buckets after 'timeline' in bucketOrder — a direct structural port of buildOllamaHistory's ordering, with the target shape collapsed from a message array to one string (this wire has one -p positional argument, not a message array). | - | src/batteries/llm/claude_code_cli/types.ts:124 |
descriptionToChatCompletionsJsonSchema | (d: DescriptionLike) => JsonSchema | Converts a validator describe() envelope into the Chat-Completions JSON-Schema subset. | ChatHelpersCommon.descriptionToChatCompletionsJsonSchema | src/batteries/llm/chat_common/types.ts:511 |
filterThoughts | (thoughts: Iterable<Thought>, mode: "all" | "all-self" | "latest-self", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[] | Selects which thoughts to surface, by surfacing mode, self identity, and replay compatibility. | ChatHelpersCommon.filterThoughts | src/batteries/llm/chat_common/types.ts:599 |
renderArtifactHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Renders the directions-bearing "handle" body for a non-inlined @nhtio/adk!SpooledArtifact tool result: metadata (callId/kind/byteLength/lineCount) plus the forged artifact_* tools the model should call to read it incrementally. Remarks Optional override seam. When omitted the battery uses the shared defaultRenderArtifactHandleBody. A consumer overrides it to change WHICH reader the model is steered toward first — e.g. promoting the JSON content-readers (artifact_json_get / artifact_json_keys) ahead of the metadata-only artifact_json_type for a small model that grabs the first listed tool. The tool list itself comes from the artifact's constructor.toolMethods; an override typically reorders or re-annotates that list before delegating to the default renderer. | ChatHelpersCommon.renderArtifactHandleBody | src/batteries/llm/chat_common/types.ts:571 |
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?: 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>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string> | Assembles the system-prompt message from its constituent buckets in ChatCompletionsBucketOrder. | ChatHelpersCommon.renderChatCompletionsSystemPrompt | src/batteries/llm/chat_common/types.ts:611 |
renderClaudeCodeCliTimelineMessage | (input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<string> | Renders a single timeline @nhtio/adk!Message into plain text for the -p prompt string. Structurally identical to renderOllamaTimelineMessage's trust-envelope/identity logic, except every attachment (image or otherwise) routes through unsupportedMediaPolicy and renders as text, since there is no native image channel to push into. | - | src/batteries/llm/claude_code_cli/types.ts:96 |
renderClaudeCodeCliToolCallResult | (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> | Renders a completed @nhtio/adk!ToolCall's result into plain text for the inbound history direction (i.e. how a past tool call reads back into a subsequent dispatch's rendered prompt) — the counterpart to the outbound MCP CallToolResult rendering the adapter performs directly when a tool call happens mid-turn (see wire.ts's WrapperToolCallResponseCommand). | - | src/batteries/llm/claude_code_cli/types.ts:108 |
renderFirstPartyRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string> | Renders first-party (trusted) retrievables into a single prompt block. | ChatHelpersCommon.renderFirstPartyRetrievables | src/batteries/llm/chat_common/types.ts:526 |
renderMemories | (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string | Renders memories (each with its attribute bag) into a single prompt block. | ChatHelpersCommon.renderMemories | src/batteries/llm/chat_common/types.ts:522 |
renderRetrievableHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Renders the directions-bearing "handle" body for a non-inlined @nhtio/adk!Retrievable whose content is a @nhtio/adk!SpooledArtifact: metadata (callId/kind/byteLength/lineCount) plus the forged artifact_* tools the model should call to read it incrementally. Remarks Optional override seam, the retrievable-side counterpart to renderArtifactHandleBody. When omitted the battery uses the shared defaultRenderRetrievableHandleBody. | ChatHelpersCommon.renderRetrievableHandleBody | src/batteries/llm/chat_common/types.ts:588 |
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> | Assembles the full retrievables block: safety directive plus the trust-tiered sub-renderers. | ChatHelpersCommon.renderRetrievables | src/batteries/llm/chat_common/types.ts:547 |
renderRetrievableSafetyDirective | () => string | Renders the safety directive that precedes any retrievable content. | ChatHelpersCommon.renderRetrievableSafetyDirective | src/batteries/llm/chat_common/types.ts:524 |
renderStandingInstructions | (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string | Renders standing instructions into a single prompt block. | ChatHelpersCommon.renderStandingInstructions | src/batteries/llm/chat_common/types.ts:517 |
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> | Renders third-party private retrievables, wrapping each in the untrusted-content envelope. | ChatHelpersCommon.renderThirdPartyPrivateRetrievables | src/batteries/llm/chat_common/types.ts:539 |
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> | Renders third-party public retrievables, wrapping each in the untrusted-content envelope. | ChatHelpersCommon.renderThirdPartyPublicRetrievables | src/batteries/llm/chat_common/types.ts:531 |
renderThought | (content: string, attrs: ThoughtAttrs, payload?: unknown) => string | Renders a single thought into its prompt block, optionally carrying an opaque replay payload. | ChatHelpersCommon.renderThought | src/batteries/llm/chat_common/types.ts:597 |
renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string | Wraps trusted (first-party) text in the trusted-content trust envelope. | ChatHelpersCommon.renderTrustedContent | src/batteries/llm/chat_common/types.ts:515 |
renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string | Wraps untrusted (third-party) text in the untrusted-content trust envelope. | ChatHelpersCommon.renderUntrustedContent | src/batteries/llm/chat_common/types.ts:513 |
toolsToChatCompletionsTools | (tools: readonly ( | Tool<SpooledArtifact> | ArtifactTool)[], deps: { descriptionToChatCompletionsJsonSchema: (d: DescriptionLike) => JsonSchema; }) => ChatCompletionsTool[] | Translates the tool registry into the function-tool wire array advertised to the model. | ChatHelpersCommon.toolsToChatCompletionsTools | src/batteries/llm/chat_common/types.ts:606 |