@gguf/claw
Version:
Multi-channel AI gateway with extensible messaging integrations
93 lines (92 loc) • 3.64 kB
TypeScript
import type { ExecToolDefaults } from "../../agents/bash-tools.js";
import type { ModelAliasIndex } from "../../agents/model-selection.js";
import type { SkillCommandSpec } from "../../agents/skills.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { MsgContext, TemplateContext } from "../templating.js";
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
import type { GetReplyOptions, ReplyPayload } from "../types.js";
import { buildCommandContext } from "./commands.js";
import { type InlineDirectives } from "./directive-handling.js";
import { applyInlineDirectiveOverrides } from "./get-reply-directives-apply.js";
import { defaultGroupActivation, resolveGroupRequireMention } from "./groups.js";
import { createModelSelectionState } from "./model-selection.js";
import type { TypingController } from "./typing.js";
type AgentDefaults = NonNullable<OpenClawConfig["agents"]>["defaults"];
type ExecOverrides = Pick<ExecToolDefaults, "host" | "security" | "ask" | "node">;
export type ReplyDirectiveContinuation = {
commandSource: string;
command: ReturnType<typeof buildCommandContext>;
allowTextCommands: boolean;
skillCommands?: SkillCommandSpec[];
directives: InlineDirectives;
cleanedBody: string;
messageProviderKey: string;
elevatedEnabled: boolean;
elevatedAllowed: boolean;
elevatedFailures: Array<{
gate: string;
key: string;
}>;
defaultActivation: ReturnType<typeof defaultGroupActivation>;
resolvedThinkLevel: ThinkLevel | undefined;
resolvedVerboseLevel: VerboseLevel | undefined;
resolvedReasoningLevel: ReasoningLevel;
resolvedElevatedLevel: ElevatedLevel;
execOverrides?: ExecOverrides;
blockStreamingEnabled: boolean;
blockReplyChunking?: {
minChars: number;
maxChars: number;
breakPreference: "paragraph" | "newline" | "sentence";
flushOnParagraph?: boolean;
};
resolvedBlockStreamingBreak: "text_end" | "message_end";
provider: string;
model: string;
modelState: Awaited<ReturnType<typeof createModelSelectionState>>;
contextTokens: number;
inlineStatusRequested: boolean;
directiveAck?: ReplyPayload;
perMessageQueueMode?: InlineDirectives["queueMode"];
perMessageQueueOptions?: {
debounceMs?: number;
cap?: number;
dropPolicy?: InlineDirectives["dropPolicy"];
};
};
export type ReplyDirectiveResult = {
kind: "reply";
reply: ReplyPayload | ReplyPayload[] | undefined;
} | {
kind: "continue";
result: ReplyDirectiveContinuation;
};
export declare function resolveReplyDirectives(params: {
ctx: MsgContext;
cfg: OpenClawConfig;
agentId: string;
agentDir: string;
workspaceDir: string;
agentCfg: AgentDefaults;
sessionCtx: TemplateContext;
sessionEntry: SessionEntry;
sessionStore: Record<string, SessionEntry>;
sessionKey: string;
storePath?: string;
sessionScope: Parameters<typeof applyInlineDirectiveOverrides>[0]["sessionScope"];
groupResolution: Parameters<typeof resolveGroupRequireMention>[0]["groupResolution"];
isGroup: boolean;
triggerBodyNormalized: string;
commandAuthorized: boolean;
defaultProvider: string;
defaultModel: string;
aliasIndex: ModelAliasIndex;
provider: string;
model: string;
hasResolvedHeartbeatModelOverride: boolean;
typing: TypingController;
opts?: GetReplyOptions;
skillFilter?: string[];
}): Promise<ReplyDirectiveResult>;
export {};