From 6c3740255f3a5ab253927ebbbf243a1e553a5ae1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 27 May 2026 11:37:10 +0100 Subject: [PATCH] refactor: remove channel turn runtime aliases --- docs/concepts/message-lifecycle-refactor.md | 4 ++-- docs/plugins/sdk-channel-inbound.md | 18 ++++++--------- docs/plugins/sdk-channel-turn.md | 6 ++--- docs/plugins/sdk-subpaths.md | 2 +- src/channels/turn/kernel.ts | 20 ---------------- src/channels/turn/types.ts | 15 ------------ .../test-helpers/plugin-runtime-mock.test.ts | 18 +++++++-------- .../test-helpers/plugin-runtime-mock.ts | 23 ------------------- src/plugins/runtime/runtime-channel.ts | 9 -------- src/plugins/runtime/types-channel.ts | 11 --------- 10 files changed, 20 insertions(+), 106 deletions(-) diff --git a/docs/concepts/message-lifecycle-refactor.md b/docs/concepts/message-lifecycle-refactor.md index 7338a8bf7260..cb3330041e7f 100644 --- a/docs/concepts/message-lifecycle-refactor.md +++ b/docs/concepts/message-lifecycle-refactor.md @@ -694,8 +694,8 @@ channel-owned dispatcher -> messages.send for final delivery ``` -The old `channel.turn` runtime surface remains a deprecated alias only. New code -uses inbound/message nouns. +The old `channel.turn` runtime surface was removed. Runtime callers use +`channel.inbound.*`; channel docs and SDK subpaths use inbound/message nouns. ## Compatibility guardrails diff --git a/docs/plugins/sdk-channel-inbound.md b/docs/plugins/sdk-channel-inbound.md index 4821e1b13227..d6a43a0e92db 100644 --- a/docs/plugins/sdk-channel-inbound.md +++ b/docs/plugins/sdk-channel-inbound.md @@ -57,18 +57,14 @@ prefer message adapters and durable message helpers. ## Migration -- `runtime.channel.turn.run(...)` -> `runtime.channel.inbound.run(...)` -- `runtime.channel.turn.runPrepared(...)` -> - `runtime.channel.inbound.runPreparedReply(...)` -- `runtime.channel.turn.runAssembled(...)` -> - `runtime.channel.inbound.dispatchReply(...)` -- `runtime.channel.turn.buildContext(...)` -> - `runtime.channel.inbound.buildContext(...)` +The old `runtime.channel.turn.*` runtime aliases were removed. Use: + +- `runtime.channel.inbound.run(...)` for raw inbound events. +- `runtime.channel.inbound.dispatchReply(...)` for assembled reply contexts. +- `runtime.channel.inbound.buildContext(...)` for inbound context payloads. +- `runtime.channel.inbound.runPreparedReply(...)` only for channel-owned prepared + dispatch paths that already assemble their own dispatch closure. New plugin code should not introduce `turn`-named channel APIs. Keep model or agent turn vocabulary inside agent/provider code; channel plugins use inbound, message, delivery, and reply terms. - -The `runtime.channel.turn.*` aliases remain only as deprecated compatibility -for already published plugins. They can be removed in the next major SDK cleanup -after external plugins have had a migration window. diff --git a/docs/plugins/sdk-channel-turn.md b/docs/plugins/sdk-channel-turn.md index 2ebf8dea782a..4036bca70d02 100644 --- a/docs/plugins/sdk-channel-turn.md +++ b/docs/plugins/sdk-channel-turn.md @@ -5,7 +5,5 @@ title: "Channel turn" This page moved to [Channel inbound API](/plugins/sdk-channel-inbound). -The old channel-turn runtime names remain deprecated compatibility only. New -plugin code should use `runtime.channel.inbound.*`, `channel-inbound`, and -`channel-outbound`; the aliases can be removed in the next major SDK cleanup -after external plugin migration. +The old channel-turn runtime aliases were removed. Plugin code should use +`runtime.channel.inbound.*`, `channel-inbound`, and `channel-outbound`. diff --git a/docs/plugins/sdk-subpaths.md b/docs/plugins/sdk-subpaths.md index caa6d8c5be35..1c00f7dbe951 100644 --- a/docs/plugins/sdk-subpaths.md +++ b/docs/plugins/sdk-subpaths.md @@ -132,7 +132,7 @@ migration window, keep repo/bundled plugins on `channel-inbound` and `channel-outbound`, then remove the compatibility subpaths in the next major SDK cleanup. This applies to the old channel message/runtime, channel streaming, direct-DM access, inbound helper splinter, reply-options, -pairing-path, and runtime `channel.turn.*` families. +and pairing-path families. | Subpath | Key exports | diff --git a/src/channels/turn/kernel.ts b/src/channels/turn/kernel.ts index 8590a93e06ba..4b4ff311cc32 100644 --- a/src/channels/turn/kernel.ts +++ b/src/channels/turn/kernel.ts @@ -51,7 +51,6 @@ import type { PreparedChannelTurn, PreflightFacts, RunChannelTurnParams, - RunResolvedChannelTurnParams, } from "./types.js"; export { createChannelDeliveryResultFromReceipt } from "./delivery-result.js"; export { @@ -88,7 +87,6 @@ export type { ReplyPlanFacts, RouteFacts, RunChannelTurnParams, - RunResolvedChannelTurnParams, SenderFacts, SupplementalContextFacts, } from "./types.js"; @@ -764,21 +762,3 @@ export async function runChannelTurn< } export const runChannelInboundEvent = runChannelTurn; - -export async function runResolvedChannelTurn< - TRaw, - TDispatchResult = DispatchedChannelTurnResult["dispatchResult"], ->( - params: RunResolvedChannelTurnParams, -): Promise> { - return await runChannelTurn({ - channel: params.channel, - accountId: params.accountId, - raw: params.raw, - log: params.log, - adapter: { - ingest: (raw) => (typeof params.input === "function" ? params.input(raw) : params.input), - resolveTurn: params.resolveTurn, - }, - }); -} diff --git a/src/channels/turn/types.ts b/src/channels/turn/types.ts index 455f1a6b358c..97a000b06cf3 100644 --- a/src/channels/turn/types.ts +++ b/src/channels/turn/types.ts @@ -457,18 +457,3 @@ export type RunChannelTurnParams; log?: (event: ChannelTurnLogEvent) => void; }; - -export type RunResolvedChannelTurnParams = { - channel: string; - accountId?: string; - raw: TRaw; - input: - | NormalizedTurnInput - | ((raw: TRaw) => Promise | NormalizedTurnInput | null); - resolveTurn: ( - input: NormalizedTurnInput, - eventClass: ChannelEventClass, - preflight: PreflightFacts, - ) => Promise> | ChannelTurnResolved; - log?: (event: ChannelTurnLogEvent) => void; -}; diff --git a/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts b/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts index 8bec80a64788..c91ad9478476 100644 --- a/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts +++ b/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts @@ -14,15 +14,11 @@ describe("createPluginRuntimeMock", () => { expect(vi.isMockFunction(debouncer.cancelKey)).toBe(true); }); - it("keeps deprecated turn runtime aliases aligned with inbound mocks", async () => { + it("exposes channel inbound helpers without the removed turn aliases", async () => { const runtime = createPluginRuntimeMock(); const channel = "test"; - expect(runtime.channel.turn.run).toBe(runtime.channel.inbound.run); - expect(runtime.channel.turn.runAssembled).toBe(runtime.channel.inbound.dispatchReply); - expect(runtime.channel.turn.buildContext).toBe(runtime.channel.inbound.buildContext); - expect(runtime.channel.turn.runPrepared).toBe(runtime.channel.inbound.runPreparedReply); - expect(runtime.channel.turn.dispatchAssembled).toBe(runtime.channel.inbound.dispatchReply); + expect("turn" in runtime.channel).toBe(false); const input = vi.fn((raw: { id: string }) => ({ id: raw.id, @@ -45,11 +41,13 @@ describe("createPluginRuntimeMock", () => { runDispatch, })); - const result = await runtime.channel.turn.runResolved({ + const result = await runtime.channel.inbound.run({ channel, raw: { id: "m1" }, - input, - resolveTurn, + adapter: { + ingest: input, + resolveTurn, + }, }); expect(input).toHaveBeenCalledWith({ id: "m1" }); @@ -76,7 +74,7 @@ describe("createPluginRuntimeMock", () => { it("routes untrusted group prompt facts into untrusted structured context", () => { const runtime = createPluginRuntimeMock(); - const ctx = runtime.channel.turn.buildContext({ + const ctx = runtime.channel.inbound.buildContext({ channel: "test", from: "test:user:u1", sender: { id: "u1" }, diff --git a/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts b/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts index a4e9e4707c7f..8aad3ae383bb 100644 --- a/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts +++ b/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts @@ -727,29 +727,6 @@ export function createPluginRuntimeMock(overrides: DeepPartial = buildContext: buildChannelInboundEventContextMock, runPreparedReply: runPreparedChannelTurnMock, }, - turn: { - run: runChannelTurnMock, - runAssembled: - dispatchAssembledChannelTurnMock as unknown as PluginRuntime["channel"]["turn"]["runAssembled"], - runResolved: vi.fn( - async (params: Parameters[0]) => - await runChannelTurnMock({ - channel: params.channel, - accountId: params.accountId, - raw: params.raw, - log: params.log, - adapter: { - ingest: (raw) => - typeof params.input === "function" ? params.input(raw) : params.input, - resolveTurn: params.resolveTurn, - }, - }), - ) as unknown as PluginRuntime["channel"]["turn"]["runResolved"], - buildContext: buildChannelInboundEventContextMock, - runPrepared: runPreparedChannelTurnMock, - dispatchAssembled: - dispatchAssembledChannelTurnMock as unknown as PluginRuntime["channel"]["turn"]["dispatchAssembled"], - }, threadBindings: { setIdleTimeoutBySessionKey: vi.fn() as unknown as PluginRuntime["channel"]["threadBindings"]["setIdleTimeoutBySessionKey"], diff --git a/src/plugins/runtime/runtime-channel.ts b/src/plugins/runtime/runtime-channel.ts index 82d50093983e..910d645a0bc9 100644 --- a/src/plugins/runtime/runtime-channel.ts +++ b/src/plugins/runtime/runtime-channel.ts @@ -55,7 +55,6 @@ import { dispatchChannelInboundReply, runChannelInboundEvent, runPreparedInboundReply, - runResolvedChannelTurn, } from "../../channels/turn/kernel.js"; import { resolveChannelGroupPolicy, @@ -186,14 +185,6 @@ export function createRuntimeChannel(): PluginRuntime["channel"] { runPreparedReply: runPreparedInboundReply, dispatchReply: dispatchChannelInboundReply, }, - turn: { - run: runChannelInboundEvent, - runAssembled: dispatchChannelInboundReply, - runResolved: runResolvedChannelTurn, - buildContext: buildChannelInboundEventContext, - runPrepared: runPreparedInboundReply, - dispatchAssembled: dispatchChannelInboundReply, - }, threadBindings: { setIdleTimeoutBySessionKey: ({ channelId, targetSessionKey, accountId, idleTimeoutMs }) => setChannelConversationBindingIdleTimeoutBySessionKey({ diff --git a/src/plugins/runtime/types-channel.ts b/src/plugins/runtime/types-channel.ts index 207c7c2b990b..f6f6bf291802 100644 --- a/src/plugins/runtime/types-channel.ts +++ b/src/plugins/runtime/types-channel.ts @@ -184,17 +184,6 @@ export type PluginRuntimeChannel = { runPreparedReply: typeof import("../../channels/turn/kernel.js").runPreparedInboundReply; dispatchReply: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; }; - /** @deprecated Use `inbound`. */ - turn: { - run: typeof import("../../channels/turn/kernel.js").runChannelInboundEvent; - runAssembled: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; - /** @deprecated Prefer `inbound.run(...)`. */ - runResolved: typeof import("../../channels/turn/kernel.js").runResolvedChannelTurn; - buildContext: typeof import("../../channels/inbound-event/context.js").buildChannelInboundEventContext; - runPrepared: typeof import("../../channels/turn/kernel.js").runPreparedInboundReply; - /** @deprecated Prefer `inbound.dispatchReply(...)`. */ - dispatchAssembled: typeof import("../../channels/turn/kernel.js").dispatchChannelInboundReply; - }; threadBindings: { setIdleTimeoutBySessionKey: (params: { channelId: string;