mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 00:00:44 +00:00
Expose first-class hook correlation fields for plugin message and run lifecycle hooks, including frozen diagnostic trace copies for plugin-facing events.
95 lines
2.2 KiB
TypeScript
95 lines
2.2 KiB
TypeScript
import type { DiagnosticTraceContext } from "../infra/diagnostic-trace-context.js";
|
|
import type { PluginConversationBinding } from "./conversation-binding.types.js";
|
|
|
|
export type PluginHookMessageContext = {
|
|
channelId: string;
|
|
accountId?: string;
|
|
conversationId?: string;
|
|
sessionKey?: string;
|
|
runId?: string;
|
|
messageId?: string;
|
|
senderId?: string;
|
|
trace?: DiagnosticTraceContext;
|
|
traceId?: string;
|
|
spanId?: string;
|
|
parentSpanId?: string;
|
|
callDepth?: number;
|
|
};
|
|
|
|
export type PluginHookInboundClaimContext = PluginHookMessageContext & {
|
|
parentConversationId?: string;
|
|
senderId?: string;
|
|
messageId?: string;
|
|
pluginBinding?: PluginConversationBinding;
|
|
};
|
|
|
|
export type PluginHookInboundClaimEvent = {
|
|
content: string;
|
|
body?: string;
|
|
bodyForAgent?: string;
|
|
transcript?: string;
|
|
timestamp?: number;
|
|
channel: string;
|
|
accountId?: string;
|
|
conversationId?: string;
|
|
parentConversationId?: string;
|
|
senderId?: string;
|
|
senderName?: string;
|
|
senderUsername?: string;
|
|
threadId?: string | number;
|
|
messageId?: string;
|
|
sessionKey?: string;
|
|
runId?: string;
|
|
trace?: DiagnosticTraceContext;
|
|
traceId?: string;
|
|
spanId?: string;
|
|
parentSpanId?: string;
|
|
isGroup: boolean;
|
|
commandAuthorized?: boolean;
|
|
wasMentioned?: boolean;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type PluginHookMessageReceivedEvent = {
|
|
from: string;
|
|
content: string;
|
|
timestamp?: number;
|
|
threadId?: string | number;
|
|
messageId?: string;
|
|
senderId?: string;
|
|
sessionKey?: string;
|
|
runId?: string;
|
|
trace?: DiagnosticTraceContext;
|
|
traceId?: string;
|
|
spanId?: string;
|
|
parentSpanId?: string;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type PluginHookMessageSendingEvent = {
|
|
to: string;
|
|
content: string;
|
|
replyToId?: string | number;
|
|
threadId?: string | number;
|
|
metadata?: Record<string, unknown>;
|
|
};
|
|
|
|
export type PluginHookMessageSendingResult = {
|
|
content?: string;
|
|
cancel?: boolean;
|
|
};
|
|
|
|
export type PluginHookMessageSentEvent = {
|
|
to: string;
|
|
content: string;
|
|
success: boolean;
|
|
messageId?: string;
|
|
sessionKey?: string;
|
|
runId?: string;
|
|
trace?: DiagnosticTraceContext;
|
|
traceId?: string;
|
|
spanId?: string;
|
|
parentSpanId?: string;
|
|
error?: string;
|
|
};
|