mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-21 01:51:39 -06:00
68dbf92281
* fix(plugins): scope Codex relay matchers Co-authored-by: Masato Naka <masatonaka1989@gmail.com> * fix(plugins): reject sparse tool hook matchers * test(plugins): cover mixed relay matcher scopes * fix(plugins): fail closed on invalid policy matchers * test(plugins): prove composed relay policy scope * fix(plugins): keep matcher scope internal * fix(plugins): satisfy matcher static checks * fix(plugins): enforce canonical tool hook matchers * fix(codex): project native hook matcher aliases * fix(plugins): scope Codex relay with tool matchers * chore: keep release changelog maintainer-owned --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
// Defines plugin middleware contracts for agent tool results.
|
|
import type { AgentToolResult } from "../agents/runtime/index.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[];
|
|
};
|