diff --git a/src/auto-reply/dispatch-dispatcher.ts b/src/auto-reply/dispatch-dispatcher.ts index ea9ffbda4a2..0a642b8a34a 100644 --- a/src/auto-reply/dispatch-dispatcher.ts +++ b/src/auto-reply/dispatch-dispatcher.ts @@ -1,4 +1,4 @@ -import type { ReplyDispatcher } from "./reply/reply-dispatcher.js"; +import type { ReplyDispatcher } from "./reply/reply-dispatcher.types.js"; export async function withReplyDispatcher(params: { dispatcher: ReplyDispatcher; diff --git a/src/auto-reply/dispatch.ts b/src/auto-reply/dispatch.ts index a3c520a415e..bfec4555706 100644 --- a/src/auto-reply/dispatch.ts +++ b/src/auto-reply/dispatch.ts @@ -7,10 +7,10 @@ import { finalizeInboundContext } from "./reply/inbound-context.js"; import { createReplyDispatcher, createReplyDispatcherWithTyping, - type ReplyDispatcher, type ReplyDispatcherOptions, type ReplyDispatcherWithTypingOptions, } from "./reply/reply-dispatcher.js"; +import type { ReplyDispatcher } from "./reply/reply-dispatcher.types.js"; import type { FinalizedMsgContext, MsgContext } from "./templating.js"; import type { GetReplyOptions } from "./types.js"; diff --git a/src/auto-reply/reply/acp-projector.ts b/src/auto-reply/reply/acp-projector.ts index 4dbf4e6997e..4fe91184bdf 100644 --- a/src/auto-reply/reply/acp-projector.ts +++ b/src/auto-reply/reply/acp-projector.ts @@ -15,7 +15,7 @@ import { resolveAcpStreamingConfig, } from "./acp-stream-settings.js"; import { createBlockReplyPipeline } from "./block-reply-pipeline.js"; -import type { ReplyDispatchKind } from "./reply-dispatcher.js"; +import type { ReplyDispatchKind } from "./reply-dispatcher.types.js"; const ACP_BLOCK_REPLY_TIMEOUT_MS = 15_000; const ACP_LIVE_IDLE_FLUSH_FLOOR_MS = 750; diff --git a/src/auto-reply/reply/dispatch-acp-delivery.ts b/src/auto-reply/reply/dispatch-acp-delivery.ts index 61a72b07129..d3bed6fad39 100644 --- a/src/auto-reply/reply/dispatch-acp-delivery.ts +++ b/src/auto-reply/reply/dispatch-acp-delivery.ts @@ -11,7 +11,7 @@ import { resolveStatusTtsSnapshot } from "../../tts/status-config.js"; import { resolveConfiguredTtsMode } from "../../tts/tts-config.js"; import type { FinalizedMsgContext } from "../templating.js"; import type { ReplyPayload } from "../types.js"; -import type { ReplyDispatcher, ReplyDispatchKind } from "./reply-dispatcher.js"; +import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js"; let routeReplyRuntimePromise: Promise | null = null; let dispatchAcpTtsRuntimePromise: Promise | null = diff --git a/src/auto-reply/reply/dispatch-acp.ts b/src/auto-reply/reply/dispatch-acp.ts index f79afd74827..b33d6d87293 100644 --- a/src/auto-reply/reply/dispatch-acp.ts +++ b/src/auto-reply/reply/dispatch-acp.ts @@ -28,7 +28,7 @@ import { createAcpDispatchDeliveryCoordinator, type AcpDispatchDeliveryCoordinator, } from "./dispatch-acp-delivery.js"; -import type { ReplyDispatcher, ReplyDispatchKind } from "./reply-dispatcher.js"; +import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js"; let dispatchAcpManagerRuntimePromise: Promise< typeof import("./dispatch-acp-manager.runtime.js") diff --git a/src/auto-reply/reply/dispatch-from-config.types.ts b/src/auto-reply/reply/dispatch-from-config.types.ts index ec4ee25016e..03b3ac0341f 100644 --- a/src/auto-reply/reply/dispatch-from-config.types.ts +++ b/src/auto-reply/reply/dispatch-from-config.types.ts @@ -1,7 +1,7 @@ import type { OpenClawConfig } from "../../config/types.openclaw.js"; import type { FinalizedMsgContext } from "../templating.js"; import type { GetReplyOptions } from "../types.js"; -import type { ReplyDispatcher, ReplyDispatchKind } from "./reply-dispatcher.js"; +import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js"; export type DispatchFromConfigResult = { queuedFinal: boolean; diff --git a/src/auto-reply/reply/normalize-reply.ts b/src/auto-reply/reply/normalize-reply.ts index 96152b9662a..d84819f4a65 100644 --- a/src/auto-reply/reply/normalize-reply.ts +++ b/src/auto-reply/reply/normalize-reply.ts @@ -1,4 +1,4 @@ -import { sanitizeUserFacingText } from "../../agents/pi-embedded-helpers.js"; +import { sanitizeUserFacingText } from "../../agents/pi-embedded-helpers/errors.js"; import { hasReplyPayloadContent } from "../../interactive/payload.js"; import { normalizeOptionalString } from "../../shared/string-coerce.js"; import { stripHeartbeatToken } from "../heartbeat.js"; diff --git a/src/auto-reply/reply/reply-dispatcher.ts b/src/auto-reply/reply/reply-dispatcher.ts index 07ebc5512aa..616f0ca4560 100644 --- a/src/auto-reply/reply/reply-dispatcher.ts +++ b/src/auto-reply/reply/reply-dispatcher.ts @@ -5,10 +5,11 @@ import { sleep } from "../../utils.js"; import type { GetReplyOptions, ReplyPayload } from "../types.js"; import { registerDispatcher } from "./dispatcher-registry.js"; import { normalizeReplyPayload, type NormalizeReplySkipReason } from "./normalize-reply.js"; +import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js"; import type { ResponsePrefixContext } from "./response-prefix-template.js"; import type { TypingController } from "./typing.js"; -export type ReplyDispatchKind = "tool" | "block" | "final"; +export type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js"; type ReplyDispatchErrorHandler = (err: unknown, info: { kind: ReplyDispatchKind }) => void; @@ -75,16 +76,6 @@ type ReplyDispatcherWithTypingResult = { markRunComplete: () => void; }; -export type ReplyDispatcher = { - sendToolResult: (payload: ReplyPayload) => boolean; - sendBlockReply: (payload: ReplyPayload) => boolean; - sendFinalReply: (payload: ReplyPayload) => boolean; - waitForIdle: () => Promise; - getQueuedCounts: () => Record; - getFailedCounts: () => Record; - markComplete: () => void; -}; - type NormalizeReplyPayloadInternalOptions = Pick< ReplyDispatcherOptions, | "responsePrefix" diff --git a/src/auto-reply/reply/reply-dispatcher.types.ts b/src/auto-reply/reply/reply-dispatcher.types.ts new file mode 100644 index 00000000000..7a4a9766f19 --- /dev/null +++ b/src/auto-reply/reply/reply-dispatcher.types.ts @@ -0,0 +1,13 @@ +import type { ReplyPayload } from "../types.js"; + +export type ReplyDispatchKind = "tool" | "block" | "final"; + +export type ReplyDispatcher = { + sendToolResult: (payload: ReplyPayload) => boolean; + sendBlockReply: (payload: ReplyPayload) => boolean; + sendFinalReply: (payload: ReplyPayload) => boolean; + waitForIdle: () => Promise; + getQueuedCounts: () => Record; + getFailedCounts: () => Record; + markComplete: () => void; +}; diff --git a/src/plugin-sdk/inbound-reply-dispatch.ts b/src/plugin-sdk/inbound-reply-dispatch.ts index d9bd0444d27..29d31d177ff 100644 --- a/src/plugin-sdk/inbound-reply-dispatch.ts +++ b/src/plugin-sdk/inbound-reply-dispatch.ts @@ -3,7 +3,7 @@ import { dispatchReplyFromConfig, type DispatchFromConfigResult, } from "../auto-reply/reply/dispatch-from-config.js"; -import type { ReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.js"; +import type { ReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.types.js"; import type { FinalizedMsgContext } from "../auto-reply/templating.js"; import type { GetReplyOptions } from "../auto-reply/types.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; diff --git a/src/plugin-sdk/reply-runtime.ts b/src/plugin-sdk/reply-runtime.ts index fda01e3c7f2..1497872fa02 100644 --- a/src/plugin-sdk/reply-runtime.ts +++ b/src/plugin-sdk/reply-runtime.ts @@ -47,6 +47,8 @@ export { export type { ReplyDispatchKind, ReplyDispatcher, +} from "../auto-reply/reply/reply-dispatcher.types.js"; +export type { ReplyDispatcherOptions, ReplyDispatcherWithTypingOptions, } from "../auto-reply/reply/reply-dispatcher.js"; diff --git a/src/plugins/types.ts b/src/plugins/types.ts index aa727db855f..555309f5329 100644 --- a/src/plugins/types.ts +++ b/src/plugins/types.ts @@ -17,7 +17,10 @@ import type { ModelProviderRequestTransportOverrides } from "../agents/provider- import type { ProviderSystemPromptContribution } from "../agents/system-prompt-contribution.js"; import type { PromptMode } from "../agents/system-prompt.types.js"; import type { AnyAgentTool } from "../agents/tools/common.js"; -import type { ReplyDispatchKind, ReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.js"; +import type { + ReplyDispatchKind, + ReplyDispatcher, +} from "../auto-reply/reply/reply-dispatcher.types.js"; import type { FinalizedMsgContext } from "../auto-reply/templating.js"; import type { ThinkLevel } from "../auto-reply/thinking.shared.js"; import type { ReplyPayload } from "../auto-reply/types.js";