refactor: remove channel turn runtime aliases · openclaw/openclaw@6c37402
steipete
·
2026-05-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -694,8 +694,8 @@ channel-owned dispatcher
|
694 | 694 | -> messages.send for final delivery |
695 | 695 | ``` |
696 | 696 | |
697 | | -The old `channel.turn` runtime surface remains a deprecated alias only. New code |
698 | | -uses inbound/message nouns. |
| 697 | +The old `channel.turn` runtime surface was removed. Runtime callers use |
| 698 | +`channel.inbound.*`; channel docs and SDK subpaths use inbound/message nouns. |
699 | 699 | |
700 | 700 | ## Compatibility guardrails |
701 | 701 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -57,18 +57,14 @@ prefer message adapters and durable message helpers.
|
57 | 57 | |
58 | 58 | ## Migration |
59 | 59 | |
60 | | -- `runtime.channel.turn.run(...)` -> `runtime.channel.inbound.run(...)` |
61 | | -- `runtime.channel.turn.runPrepared(...)` -> |
62 | | - `runtime.channel.inbound.runPreparedReply(...)` |
63 | | -- `runtime.channel.turn.runAssembled(...)` -> |
64 | | - `runtime.channel.inbound.dispatchReply(...)` |
65 | | -- `runtime.channel.turn.buildContext(...)` -> |
66 | | -`runtime.channel.inbound.buildContext(...)` |
| 60 | +The old `runtime.channel.turn.*` runtime aliases were removed. Use: |
| 61 | + |
| 62 | +- `runtime.channel.inbound.run(...)` for raw inbound events. |
| 63 | +- `runtime.channel.inbound.dispatchReply(...)` for assembled reply contexts. |
| 64 | +- `runtime.channel.inbound.buildContext(...)` for inbound context payloads. |
| 65 | +- `runtime.channel.inbound.runPreparedReply(...)` only for channel-owned prepared |
| 66 | +dispatch paths that already assemble their own dispatch closure. |
67 | 67 | |
68 | 68 | New plugin code should not introduce `turn`-named channel APIs. Keep model or |
69 | 69 | agent turn vocabulary inside agent/provider code; channel plugins use inbound, |
70 | 70 | message, delivery, and reply terms. |
71 | | - |
72 | | -The `runtime.channel.turn.*` aliases remain only as deprecated compatibility |
73 | | -for already published plugins. They can be removed in the next major SDK cleanup |
74 | | -after external plugins have had a migration window. |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,5 @@ title: "Channel turn"
|
5 | 5 | |
6 | 6 | This page moved to [Channel inbound API](/plugins/sdk-channel-inbound). |
7 | 7 | |
8 | | -The old channel-turn runtime names remain deprecated compatibility only. New |
9 | | -plugin code should use `runtime.channel.inbound.*`, `channel-inbound`, and |
10 | | -`channel-outbound`; the aliases can be removed in the next major SDK cleanup |
11 | | -after external plugin migration. |
| 8 | +The old channel-turn runtime aliases were removed. Plugin code should use |
| 9 | +`runtime.channel.inbound.*`, `channel-inbound`, and `channel-outbound`. |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -132,7 +132,7 @@ migration window, keep repo/bundled plugins on `channel-inbound` and
|
132 | 132 | `channel-outbound`, then remove the compatibility subpaths in the next major |
133 | 133 | SDK cleanup. This applies to the old channel message/runtime, channel |
134 | 134 | streaming, direct-DM access, inbound helper splinter, reply-options, |
135 | | -pairing-path, and runtime `channel.turn.*` families. |
| 135 | +and pairing-path families. |
136 | 136 | |
137 | 137 | <Accordion title="Provider subpaths"> |
138 | 138 | | Subpath | Key exports | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,6 @@ import type {
|
51 | 51 | PreparedChannelTurn, |
52 | 52 | PreflightFacts, |
53 | 53 | RunChannelTurnParams, |
54 | | -RunResolvedChannelTurnParams, |
55 | 54 | } from "./types.js"; |
56 | 55 | export { createChannelDeliveryResultFromReceipt } from "./delivery-result.js"; |
57 | 56 | export { |
@@ -88,7 +87,6 @@ export type {
|
88 | 87 | ReplyPlanFacts, |
89 | 88 | RouteFacts, |
90 | 89 | RunChannelTurnParams, |
91 | | -RunResolvedChannelTurnParams, |
92 | 90 | SenderFacts, |
93 | 91 | SupplementalContextFacts, |
94 | 92 | } from "./types.js"; |
@@ -764,21 +762,3 @@ export async function runChannelTurn<
|
764 | 762 | } |
765 | 763 | |
766 | 764 | export const runChannelInboundEvent = runChannelTurn; |
767 | | - |
768 | | -export async function runResolvedChannelTurn< |
769 | | -TRaw, |
770 | | -TDispatchResult = DispatchedChannelTurnResult["dispatchResult"], |
771 | | ->( |
772 | | -params: RunResolvedChannelTurnParams<TRaw, TDispatchResult>, |
773 | | -): Promise<ChannelTurnResult<TDispatchResult>> { |
774 | | -return await runChannelTurn({ |
775 | | -channel: params.channel, |
776 | | -accountId: params.accountId, |
777 | | -raw: params.raw, |
778 | | -log: params.log, |
779 | | -adapter: { |
780 | | -ingest: (raw) => (typeof params.input === "function" ? params.input(raw) : params.input), |
781 | | -resolveTurn: params.resolveTurn, |
782 | | -}, |
783 | | -}); |
784 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -457,18 +457,3 @@ export type RunChannelTurnParams<TRaw, TDispatchResult = DispatchFromConfigResul
|
457 | 457 | adapter: ChannelTurnAdapter<TRaw, TDispatchResult>; |
458 | 458 | log?: (event: ChannelTurnLogEvent) => void; |
459 | 459 | }; |
460 | | - |
461 | | -export type RunResolvedChannelTurnParams<TRaw, TDispatchResult = DispatchFromConfigResult> = { |
462 | | -channel: string; |
463 | | -accountId?: string; |
464 | | -raw: TRaw; |
465 | | -input: |
466 | | -| NormalizedTurnInput |
467 | | -| ((raw: TRaw) => Promise<NormalizedTurnInput | null> | NormalizedTurnInput | null); |
468 | | -resolveTurn: ( |
469 | | -input: NormalizedTurnInput, |
470 | | -eventClass: ChannelEventClass, |
471 | | -preflight: PreflightFacts, |
472 | | -) => Promise<ChannelTurnResolved<TDispatchResult>> | ChannelTurnResolved<TDispatchResult>; |
473 | | -log?: (event: ChannelTurnLogEvent) => void; |
474 | | -}; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,15 +14,11 @@ describe("createPluginRuntimeMock", () => {
|
14 | 14 | expect(vi.isMockFunction(debouncer.cancelKey)).toBe(true); |
15 | 15 | }); |
16 | 16 | |
17 | | -it("keeps deprecated turn runtime aliases aligned with inbound mocks", async () => { |
| 17 | +it("exposes channel inbound helpers without the removed turn aliases", async () => { |
18 | 18 | const runtime = createPluginRuntimeMock(); |
19 | 19 | const channel = "test"; |
20 | 20 | |
21 | | -expect(runtime.channel.turn.run).toBe(runtime.channel.inbound.run); |
22 | | -expect(runtime.channel.turn.runAssembled).toBe(runtime.channel.inbound.dispatchReply); |
23 | | -expect(runtime.channel.turn.buildContext).toBe(runtime.channel.inbound.buildContext); |
24 | | -expect(runtime.channel.turn.runPrepared).toBe(runtime.channel.inbound.runPreparedReply); |
25 | | -expect(runtime.channel.turn.dispatchAssembled).toBe(runtime.channel.inbound.dispatchReply); |
| 21 | +expect("turn" in runtime.channel).toBe(false); |
26 | 22 | |
27 | 23 | const input = vi.fn((raw: { id: string }) => ({ |
28 | 24 | id: raw.id, |
@@ -45,11 +41,13 @@ describe("createPluginRuntimeMock", () => {
|
45 | 41 | runDispatch, |
46 | 42 | })); |
47 | 43 | |
48 | | -const result = await runtime.channel.turn.runResolved({ |
| 44 | +const result = await runtime.channel.inbound.run({ |
49 | 45 | channel, |
50 | 46 | raw: { id: "m1" }, |
51 | | - input, |
52 | | - resolveTurn, |
| 47 | +adapter: { |
| 48 | +ingest: input, |
| 49 | + resolveTurn, |
| 50 | +}, |
53 | 51 | }); |
54 | 52 | |
55 | 53 | expect(input).toHaveBeenCalledWith({ id: "m1" }); |
@@ -76,7 +74,7 @@ describe("createPluginRuntimeMock", () => {
|
76 | 74 | it("routes untrusted group prompt facts into untrusted structured context", () => { |
77 | 75 | const runtime = createPluginRuntimeMock(); |
78 | 76 | |
79 | | -const ctx = runtime.channel.turn.buildContext({ |
| 77 | +const ctx = runtime.channel.inbound.buildContext({ |
80 | 78 | channel: "test", |
81 | 79 | from: "test:user:u1", |
82 | 80 | sender: { id: "u1" }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -727,29 +727,6 @@ export function createPluginRuntimeMock(overrides: DeepPartial<PluginRuntime> =
|
727 | 727 | buildContext: buildChannelInboundEventContextMock, |
728 | 728 | runPreparedReply: runPreparedChannelTurnMock, |
729 | 729 | }, |
730 | | -turn: { |
731 | | -run: runChannelTurnMock, |
732 | | -runAssembled: |
733 | | -dispatchAssembledChannelTurnMock as unknown as PluginRuntime["channel"]["turn"]["runAssembled"], |
734 | | -runResolved: vi.fn( |
735 | | -async (params: Parameters<PluginRuntime["channel"]["turn"]["runResolved"]>[0]) => |
736 | | -await runChannelTurnMock({ |
737 | | -channel: params.channel, |
738 | | -accountId: params.accountId, |
739 | | -raw: params.raw, |
740 | | -log: params.log, |
741 | | -adapter: { |
742 | | -ingest: (raw) => |
743 | | -typeof params.input === "function" ? params.input(raw) : params.input, |
744 | | -resolveTurn: params.resolveTurn, |
745 | | -}, |
746 | | -}), |
747 | | -) as unknown as PluginRuntime["channel"]["turn"]["runResolved"], |
748 | | -buildContext: buildChannelInboundEventContextMock, |
749 | | -runPrepared: runPreparedChannelTurnMock, |
750 | | -dispatchAssembled: |
751 | | -dispatchAssembledChannelTurnMock as unknown as PluginRuntime["channel"]["turn"]["dispatchAssembled"], |
752 | | -}, |
753 | 730 | threadBindings: { |
754 | 731 | setIdleTimeoutBySessionKey: |
755 | 732 | vi.fn() as unknown as PluginRuntime["channel"]["threadBindings"]["setIdleTimeoutBySessionKey"], |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -55,7 +55,6 @@ import {
|
55 | 55 | dispatchChannelInboundReply, |
56 | 56 | runChannelInboundEvent, |
57 | 57 | runPreparedInboundReply, |
58 | | -runResolvedChannelTurn, |
59 | 58 | } from "../../channels/turn/kernel.js"; |
60 | 59 | import { |
61 | 60 | resolveChannelGroupPolicy, |
@@ -186,14 +185,6 @@ export function createRuntimeChannel(): PluginRuntime["channel"] {
|
186 | 185 | runPreparedReply: runPreparedInboundReply, |
187 | 186 | dispatchReply: dispatchChannelInboundReply, |
188 | 187 | }, |
189 | | -turn: { |
190 | | -run: runChannelInboundEvent, |
191 | | -runAssembled: dispatchChannelInboundReply, |
192 | | -runResolved: runResolvedChannelTurn, |
193 | | -buildContext: buildChannelInboundEventContext, |
194 | | -runPrepared: runPreparedInboundReply, |
195 | | -dispatchAssembled: dispatchChannelInboundReply, |
196 | | -}, |
197 | 188 | threadBindings: { |
198 | 189 | setIdleTimeoutBySessionKey: ({ channelId, targetSessionKey, accountId, idleTimeoutMs }) => |
199 | 190 | setChannelConversationBindingIdleTimeoutBySessionKey({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -184,17 +184,6 @@ export type PluginRuntimeChannel = {
|
184 | 184 | runPreparedReply: typeof import("../../channels/turn/kernel.js").runPreparedInboundReply; |
185 | 185 | dispatchReply: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; |
186 | 186 | }; |
187 | | -/** @deprecated Use `inbound`. */ |
188 | | -turn: { |
189 | | -run: typeof import("../../channels/turn/kernel.js").runChannelInboundEvent; |
190 | | -runAssembled: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; |
191 | | -/** @deprecated Prefer `inbound.run(...)`. */ |
192 | | -runResolved: typeof import("../../channels/turn/kernel.js").runResolvedChannelTurn; |
193 | | -buildContext: typeof import("../../channels/inbound-event/context.js").buildChannelInboundEventContext; |
194 | | -runPrepared: typeof import("../../channels/turn/kernel.js").runPreparedInboundReply; |
195 | | -/** @deprecated Prefer `inbound.dispatchReply(...)`. */ |
196 | | -dispatchAssembled: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; |
197 | | -}; |
198 | 187 | threadBindings: { |
199 | 188 | setIdleTimeoutBySessionKey: (params: { |
200 | 189 | channelId: string; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。