Skip to content

Commit 127b781

Browse files
authored
refactor(auto-reply): split config dispatch pipeline (#113154)
* refactor(auto-reply): split config dispatch pipeline * refactor(auto-reply): keep phase result types private
1 parent 081b3eb commit 127b781

12 files changed

Lines changed: 3813 additions & 3006 deletions

‎config/max-lines-baseline.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ src/auto-reply/reply/dispatch-from-config.progress.test-utils.ts
585585
src/auto-reply/reply/dispatch-from-config.routing.test-utils.ts
586586
src/auto-reply/reply/dispatch-from-config.send-policy-routing.test-utils.ts
587587
src/auto-reply/reply/dispatch-from-config.shared.test-harness.ts
588-
src/auto-reply/reply/dispatch-from-config.ts
589588
src/auto-reply/reply/followup-runner.test.ts
590589
src/auto-reply/reply/followup-runner.ts
591590
src/auto-reply/reply/get-reply-inline-actions.skip-when-config-empty.test.ts

‎src/auto-reply/reply/dispatch-from-config.choose-route.ts‎

Lines changed: 541 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { PluginHookReplyDispatchEvent } from "../../plugins/hook-types.js";
2+
import type { CommandSessionMetadataChange } from "./command-session-metadata.js";
3+
import type { ReplySessionBinding } from "./get-reply.types.js";
4+
5+
export type InternalReplyResolverOptions = {
6+
onSessionMetadataChanges?: (changes: CommandSessionMetadataChange[]) => void;
7+
onSessionPrepared?: (binding: ReplySessionBinding) => void;
8+
};
9+
10+
export type PluginBindingTranscriptOwner = {
11+
agentId: string;
12+
expectedSessionId?: string;
13+
sessionKey: string;
14+
transcriptWriteBlocked?: true;
15+
};
16+
17+
export function createReplyDispatchEvent(
18+
params: Omit<PluginHookReplyDispatchEvent, "shouldSendToolSummaries"> & {
19+
shouldSendToolSummaries: () => boolean;
20+
},
21+
): PluginHookReplyDispatchEvent {
22+
const { shouldSendToolSummaries, ...event } = params;
23+
return Object.defineProperty(event, "shouldSendToolSummaries", {
24+
enumerable: true,
25+
get: shouldSendToolSummaries,
26+
}) as PluginHookReplyDispatchEvent;
27+
}
28+
29+
if (process.env.VITEST || process.env.NODE_ENV === "test") {
30+
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw.dispatchFromConfigTestApi")] = {
31+
createReplyDispatchEvent,
32+
};
33+
}

0 commit comments

Comments
 (0)