refactor(channels): privatize approval channel list (#106447)

This commit is contained in:
Vincent Koc
2026-07-13 22:35:26 +08:00
committed by GitHub
parent 0e96fc7e10
commit 1b43d71440
3 changed files with 18 additions and 9 deletions
-1
View File
@@ -2226,7 +2226,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
"src/tui/tui-plugin-approvals.ts: parseTuiPluginApproval",
"src/tui/tui-task-suggestions.ts: parseTuiTaskSuggestion",
"src/tui/tui-waiting.ts: pickWaitingPhrase",
"src/utils/message-channel-constants.ts: NATIVE_APPROVAL_CHANNELS",
"src/video-generation/runtime-types.ts: ListRuntimeVideoGenerationProvidersParams",
"src/video-generation/runtime-types.ts: RuntimeVideoGenerationProvider",
"src/web-search/runtime-types.ts: ListWebSearchProvidersParams",
+5 -5
View File
@@ -29,11 +29,11 @@ export function isInternalNonDeliveryChannel(
// in place and the agent can wait inline for the result instead of falling
// back to a fire-and-forget followup that loses the agent's session.
//
// Keep this list aligned with bundled extensions that publish
// `approval-handler.runtime` and a `resolveApproveCommandBehavior` capability;
// adding an extension without the runtime, or listing one without the runtime,
// re-introduces the "approval loop" the inline path was added to avoid.
export const NATIVE_APPROVAL_CHANNELS = [
// Keep this list aligned with bundled channels whose
// `approvalCapability.nativeRuntime` handles exec approvals; webchat is
// core-owned. Listing a channel without that runtime re-introduces the
// "approval loop" the inline path was added to avoid.
const NATIVE_APPROVAL_CHANNELS = [
"webchat",
"discord",
"googlechat",
+13 -3
View File
@@ -4,7 +4,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelPlugin } from "../channels/plugins/types.public.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";
import { NATIVE_APPROVAL_CHANNELS } from "./message-channel-constants.js";
import {
isEphemeralGatewayClient,
isInternalNonDeliveryChannel,
@@ -93,10 +92,21 @@ describe("message-channel", () => {
});
it("lists native chat exec approval channels", () => {
for (const channel of NATIVE_APPROVAL_CHANNELS) {
for (const channel of [
"webchat",
"discord",
"googlechat",
"imessage",
"matrix",
"qqbot",
"signal",
"slack",
"telegram",
"whatsapp",
]) {
expect(isNativeApprovalChannel(channel)).toBe(true);
}
// Channels without a bundled approval-handler.runtime must not claim native approval.
// Channels without a bundled exec-capable native approval runtime must not claim it.
expect(isNativeApprovalChannel("feishu")).toBe(false);
expect(isNativeApprovalChannel("msteams")).toBe(false);
expect(isNativeApprovalChannel("line")).toBe(false);