import * as smoltalk from "smoltalk"; import { type ThreadInfoTS } from "../runtime/agency.js"; /** Coerce a `smoltalk` message's `content` to a flat string. Multimodal * part arrays render text parts verbatim and attachment parts as * placeholders ("[image attachment]" / "[file attachment: name]") so * base64 payloads never reach the summarizer prompt or the Agency * thread reader. Other non-string content (tool-call / structured) is * JSON-stringified; nullish content (common on tool-call assistant * messages where the LLM emitted tool calls but no text) maps to `""` * instead of the literal JSON-encoded `'""'`. Shared by `_getThread` * (the Agency-facing reader) and `_buildSummaryTranscript` (the eager * summarizer prompt) so both surfaces agree on the same coercion * rule. Exported for tests. */ export declare function _contentToString(content: smoltalk.MessageJSON["content"]): string; /** Pass-through to `agency.threads.list()`. */ export declare function _listThreadsRaw(): ThreadInfoTS[]; /** Read a slice of a thread's messages, coerced to the * `{ role: string, content: string }` shape Agency's * `ThreadMessage` declares. Non-string `content` values * (tool-call / structured) are JSON-stringified at the boundary so * the Agency caller's `m.content` field is always a string — the * TS-internal `agency.threads.get` returns the raw * `smoltalk.MessageJSON` shape for callers that need full structure. */ export declare function _getThread(id: string, offset?: number, limit?: number): Array<{ role: string; content: string; }>; /** Slug form of the active thread, or `""` (Agency has no undefined). */ export declare function _currentThreadId(): string; /** Stash a freshly-computed summary on the underlying `MessageThread` * so subsequent `listThreads()` calls read it back without * re-prompting. Called by the Agency-side `summaryFor()` helper after * the lazy summarize round-trip. No-op when the id is unknown or * there is no active store (e.g. called from non-Agency code). */ export declare function _setThreadSummary(id: string, summary: string): void; /** Best-effort summarize at thread close. Mirrors the Agency-side * `summarize()` prompt + structured-output shape so eager and lazy * paths produce comparable summaries. Uses an ephemeral standalone * `MessageThread` (NOT registered with the active `ThreadStore`) * for the LLM call so the summarizer prompt doesn't pollute the * agent's main conversation and doesn't show up in `listThreads()`. * Mirrors what `thread(hidden: true) { llm(...) }` would do in * Agency-land. * * Errors never propagate to the caller — eager summarize is a * performance optimization, not a correctness path. If the call * fails (no LLM client, network error, missing API key), the next * `listThreads()` falls back to the lazy summarize path which * surfaces a clean error path through `try _listThreadsRaw()`. * Failures are still recorded via `logger.debug` and the * `threadEndHookError` statelog event so they're observable. */ export declare function _eagerSummarizeIfNeeded(evt: { threadId: string; eagerSummarize: boolean; messages: smoltalk.MessageJSON[]; }): Promise;