import type { StreamDelta } from "../shared/types.js"; export declare function encodeModelChoice(provider: string | undefined, model: string): string; export declare function splitModelChoice(choiceId: string): { provider?: string; model: string; }; export declare function rpcRequest(id: number, method: string, params: object): string; export declare function rpcNotification(method: string, params: object): string; export interface HermesUpdate { deltas: StreamDelta[]; contextTokens?: number; commands?: string[]; } export declare function mapSessionUpdate(update: Record): HermesUpdate; export type HermesTextOp = "append" | "replace" | "drop"; /** * Fold one streamed answer-text chunk into the accumulated reply. * * Hermes delivers answer text as incremental `agent_message_chunk` frames while * streaming, then may emit a FINAL `agent_message_chunk` carrying the ENTIRE * reply (the acp server's `update_agent_message_text` path — fired when a * `transform_llm_output` plugin rewrote the output, or when token streaming was * skipped). Both share the same wire kind, so a naive `acc += chunk` doubles the * reply, and content alone cannot tell an increment from the final full frame: * a transform can REPLACE the reply with shorter/unrelated text (a redaction — * whose prefix does NOT match the streamed text), and a legitimately repeated * chunk ("ha","ha") looks like a re-send. A content heuristic gets both wrong. * * So the regime is EXPLICIT on the wire. hermes-agent >= 0.17.1 tags the final * frame with `_meta.hermes.final` (see {@link isFinalMessageUpdate}): * - `final` (marked) → REPLACE unconditionally — even if shorter/unrelated, * so a redaction wins and the streamed text never survives. * - otherwise → APPEND — legitimate repeats are never swallowed. * * `legacyDedupe` is the compatibility fallback for OLD hermes binaries that * don't send the marker (the caller enables it only when the initialize * capability is absent — see {@link initAdvertisesFinalMarker}): an unmarked * frame that exactly equals everything accumulated so far is the re-sent full * reply and is DROPPED, keeping the original doubling bug fixed. A pre-marker * binary whose transform REPLACED the reply with new text (rare) cannot be * distinguished and will append — accepted; the marker fixes it going forward. */ export declare function reduceAgentText(acc: string, chunk: string, opts: { final: boolean; legacyDedupe: boolean; }): { text: string; op: HermesTextOp; }; /** True when an ACP `session/update` carries the hermes final-full-reply marker. */ export declare function isFinalMessageUpdate(update: Record | null | undefined): boolean; /** * True when the `initialize` result advertises that this hermes build tags its * final full-reply frame (`agentCapabilities._meta.hermes.finalMessageMarker`). * When false (older binary), the caller falls back to exact-equality dedupe. */ export declare function initAdvertisesFinalMarker(initResult: unknown): boolean; export declare function extractPromptText(prompt: string): { type: "text"; text: string; }[]; //# sourceMappingURL=hermes-protocol.d.ts.map