mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 08:30:34 +00:00
refactor: consolidate throwIfAborted + fix isCompactionFailureError (#12463)
* refactor: consolidate throwIfAborted in outbound module - Create abort.ts with shared throwIfAborted helper - Update deliver.ts, message-action-runner.ts, outbound-send-service.ts * fix: handle context overflow in isCompactionFailureError without requiring colon
This commit is contained in:
@@ -6,6 +6,7 @@ import type { OutboundSendDeps } from "./deliver.js";
|
||||
import type { MessagePollResult, MessageSendResult } from "./message.js";
|
||||
import { dispatchChannelMessageAction } from "../../channels/plugins/message-actions.js";
|
||||
import { appendAssistantMessageToSessionTranscript } from "../../config/sessions.js";
|
||||
import { throwIfAborted } from "./abort.js";
|
||||
import { sendMessage, sendPoll } from "./message.js";
|
||||
|
||||
export type OutboundGatewayContext = {
|
||||
@@ -59,14 +60,6 @@ function extractToolPayload(result: AgentToolResult<unknown>): unknown {
|
||||
return result.content ?? result;
|
||||
}
|
||||
|
||||
function throwIfAborted(abortSignal?: AbortSignal): void {
|
||||
if (abortSignal?.aborted) {
|
||||
const err = new Error("Message send aborted");
|
||||
err.name = "AbortError";
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function executeSendAction(params: {
|
||||
ctx: OutboundSendContext;
|
||||
to: string;
|
||||
|
||||
Reference in New Issue
Block a user