|
1 | 1 | import { verifyChannelMessageAdapterCapabilityProofs } from "openclaw/plugin-sdk/channel-message"; |
2 | | -import { createStartAccountContext } from "openclaw/plugin-sdk/channel-test-helpers"; |
| 2 | +import { |
| 3 | + createPluginRuntimeMock, |
| 4 | + createStartAccountContext, |
| 5 | +} from "openclaw/plugin-sdk/channel-test-helpers"; |
3 | 6 | import type { PluginRuntime } from "openclaw/plugin-sdk/core"; |
4 | 7 | import { |
5 | 8 | createTestRegistry, |
@@ -33,7 +36,7 @@ function createMockQaRuntime(params?: { |
33 | 36 | onDispatch?: (ctx: Record<string, unknown>) => void; |
34 | 37 | }): PluginRuntime { |
35 | 38 | const sessionUpdatedAt = new Map<string, number>(); |
36 | | - return { |
| 39 | + return createPluginRuntimeMock({ |
37 | 40 | channel: { |
38 | 41 | mentions: { |
39 | 42 | buildMentionRegexes() { |
@@ -96,8 +99,28 @@ function createMockQaRuntime(params?: { |
96 | 99 | }); |
97 | 100 | }, |
98 | 101 | }, |
| 102 | + turn: { |
| 103 | + async runPrepared(turn) { |
| 104 | + await turn.recordInboundSession({ |
| 105 | + storePath: turn.storePath, |
| 106 | + sessionKey: |
| 107 | + typeof turn.ctxPayload.SessionKey === "string" |
| 108 | + ? turn.ctxPayload.SessionKey |
| 109 | + : turn.routeSessionKey, |
| 110 | + ctx: turn.ctxPayload, |
| 111 | + onRecordError: turn.record?.onRecordError ?? (() => undefined), |
| 112 | + }); |
| 113 | + return { |
| 114 | + admission: turn.admission ?? { kind: "dispatch" as const }, |
| 115 | + dispatched: true, |
| 116 | + ctxPayload: turn.ctxPayload, |
| 117 | + routeSessionKey: turn.routeSessionKey, |
| 118 | + dispatchResult: await turn.runDispatch(), |
| 119 | + }; |
| 120 | + }, |
| 121 | + }, |
99 | 122 | }, |
100 | | - } as unknown as PluginRuntime; |
| 123 | + } as unknown as PluginRuntime); |
101 | 124 | } |
102 | 125 |
|
103 | 126 | function createQaChannelConfig(params: { baseUrl: string; allowFrom?: string[] }) { |
|
0 commit comments