openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
51 lines (50 loc) • 2.53 kB
TypeScript
import { ic as CurrentInboundPromptContext, lc as OPENCLAW_RUNTIME_CONTEXT_CUSTOM_TYPE } from "../../../types-C0dQmare.js";
//#region src/agents/embedded-agent-runner/run/runtime-context-prompt.d.ts
type RuntimeContextPromptParts = {
prompt: string;
modelPrompt?: string;
runtimeContext?: string;
runtimeOnly?: boolean;
runtimeSystemContext?: string;
};
/** Hidden custom transcript message that carries runtime context into model conversion. */
type RuntimeContextCustomMessage = {
role: "custom";
customType: string;
content: string;
display: false;
details: {
source: "openclaw-runtime-context";
};
timestamp: number;
};
type EmptyTranscriptMode = "model-prompt" | "runtime-event";
/** Returns the visible or resumable inbound prompt prefix used before the user prompt. */
declare function buildCurrentInboundPromptContextPrefix(context: CurrentInboundPromptContext | undefined, options?: {
preferResumableText?: boolean;
}): string;
/** Combines inbound context and the current prompt using the channel-provided joiner. */
declare function buildCurrentInboundPrompt(params: {
context: CurrentInboundPromptContext | undefined;
prompt: string;
preferResumableText?: boolean;
}): string;
/**
* Separates user-authored prompt text from hidden runtime context. Transcript
* prompt stays user-visible; model prompt may carry runtime-only additions that
* should be delivered as hidden context instead of persisted as user text.
*/
declare function resolveRuntimeContextPromptParts(params: {
effectivePrompt: string;
transcriptPrompt?: string;
modelPrompt?: string;
emptyTranscriptMode?: EmptyTranscriptMode;
}): RuntimeContextPromptParts;
/** Builds the hidden next-turn system context payload for model conversion. */
declare function buildRuntimeContextSystemContext(runtimeContext: string): string;
/** Builds the hidden runtime-event system context payload for empty runtime-only turns. */
declare function buildRuntimeEventSystemContext(runtimeContext: string): string;
/** Creates a non-displayed custom transcript message for runtime context, if any exists. */
declare function buildRuntimeContextCustomMessage(runtimeContext: string | undefined): RuntimeContextCustomMessage | undefined;
//#endregion
export { OPENCLAW_RUNTIME_CONTEXT_CUSTOM_TYPE, RuntimeContextCustomMessage, buildCurrentInboundPrompt, buildCurrentInboundPromptContextPrefix, buildRuntimeContextCustomMessage, buildRuntimeContextSystemContext, buildRuntimeEventSystemContext, resolveRuntimeContextPromptParts };