openclaw / src /plugins /agent-tool-result-middleware-types.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
25d91a4 verified
Raw History Blame Contribute Delete
1.34 kB
// Defines plugin middleware contracts for agent tool results.
import type { AgentToolResult } from "../../packages/agent-core/src/types.js";
import type { PluginToolMatcher } from "./hook-types.js";
export type OpenClawAgentToolResult<TResult = unknown> = AgentToolResult<TResult>;
export type AgentToolResultMiddlewareRuntime = "openclaw" | "codex";
export type AgentToolResultMiddlewareEvent = {
threadId?: string;
turnId?: string;
toolCallId: string;
toolName: string;
args: Record<string, unknown>;
cwd?: string;
isError?: boolean;
result: OpenClawAgentToolResult;
};
export type AgentToolResultMiddlewareContext = {
runtime: AgentToolResultMiddlewareRuntime;
agentId?: string;
sessionId?: string;
sessionKey?: string;
runId?: string;
};
export type AgentToolResultMiddlewareResult = {
result: OpenClawAgentToolResult;
};
export type AgentToolResultMiddleware = (
event: AgentToolResultMiddlewareEvent,
ctx: AgentToolResultMiddlewareContext,
) => Promise<AgentToolResultMiddlewareResult | void> | AgentToolResultMiddlewareResult | void;
export type AgentToolResultMiddlewareOptions = {
matcher?: PluginToolMatcher;
runtimes?: AgentToolResultMiddlewareRuntime[];
};
export type AgentToolResultMiddlewareScope = {
matcher?: PluginToolMatcher;
runtimes: AgentToolResultMiddlewareRuntime[];
};