/** * Cross-environment executor adapter for AWS Bedrock's native Converse API. * * @module @nhtio/adk/batteries/llm/bedrock_converse/adapter * * @remarks * Targets `POST {baseURL}/model/{modelId}/converse` (and `/converse-stream` when `stream` is set) * over plain HTTPS with a Bedrock API key (`Authorization: Bearer ABSK…`). Deliberately NO AWS SDK * and no SigV4 signer: the battery must stay cross-environment and dependency-light, and a bearer * key removes the only reason to pull in a signer. * * Why a native battery rather than pointing `openai_chat_completions` at a Converse-backed gateway: * Converse is a content-BLOCK protocol with strict role alternation, a required `toolConfig` * whenever tool blocks appear, and tool results carried on `user` turns. A gateway must repair all * of that on your behalf — most notably by MERGING consecutive same-role turns — and that repair is * invisible in the response. For ordinary use it is fine; for anything that needs to know what the * VENDOR received it is fatal, because a gateway's fix is indistinguishable from vendor tolerance. * See the validation battery's "Which API surface a rule applies to" guide, and * {@link BedrockConverseAdapterOptions.alternationPolicy} for the `'reject'` escape hatch that lets * Converse's own error surface. * * Options layer as in every other battery: constructor baseline → `executor()` overrides → * per-iteration `ctx.stash.bedrockConverse`, re-validated each iteration. */ import type { DispatchExecutorFn } from "../../../types"; import type { BedrockConverseAdapterOptions } from "./types"; /** * Native Bedrock Converse executor adapter. * * @example * ```ts * const adapter = new BedrockConverseAdapter({ * model: 'us.amazon.nova-2-lite-v1:0', * apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK, * region: 'us-east-1', * }) * const runner = new TurnRunner({ executorCallback: adapter.executor(), ... }) * ``` */ export declare class BedrockConverseAdapter { #private; /** Per-iteration override key on `ctx.stash`. */ static readonly STASH_KEY: "bedrockConverse"; /** * @param options - Constructor-baseline options, re-validated each iteration after overrides merge. * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when `options` is invalid. */ constructor(options: unknown); /** Narrowing guard for cross-realm instances. */ static isBedrockConverseAdapter(value: unknown): value is BedrockConverseAdapter; /** * Build a {@link DispatchExecutorFn} bound to the baseline plus optional executor-scope overrides. * * @param overrides - Higher precedence than the baseline, lower than `ctx.stash`. */ executor(overrides?: Partial): DispatchExecutorFn; }