fix(ci): handle missing native command capabilities

This commit is contained in:
Vincent Koc
2026-03-31 10:15:55 +09:00
parent 5d8ca42c7d
commit 1f6a964e57
2 changed files with 7 additions and 3 deletions

View File

@@ -9,6 +9,10 @@ import type { ChatCommandDefinition } from "./commands-registry.types.js";
type ChannelPlugin = ReturnType<typeof listChannelPlugins>[number];
function supportsNativeCommands(plugin: ChannelPlugin): boolean {
return plugin.capabilities?.nativeCommands === true;
}
function defineDockCommand(plugin: ChannelPlugin): ChatCommandDefinition {
return defineChatCommand({
key: `dock:${plugin.id}`,
@@ -28,7 +32,7 @@ function buildChatCommands(): ChatCommandDefinition[] {
const commands: ChatCommandDefinition[] = [
...buildBuiltinChatCommands(),
...listChannelPlugins()
.filter((plugin) => plugin.capabilities.nativeCommands)
.filter(supportsNativeCommands)
.map((plugin) => defineDockCommand(plugin)),
];
@@ -55,7 +59,7 @@ export function getNativeCommandSurfaces(): Set<string> {
}
cachedNativeCommandSurfaces = new Set(
listChannelPlugins()
.filter((plugin) => plugin.capabilities.nativeCommands)
.filter(supportsNativeCommands)
.map((plugin) => plugin.id),
);
cachedNativeRegistry = registry;

View File

@@ -14,7 +14,7 @@ export function isNativeCommandSurface(surface?: string): boolean {
if (!cachedNativeCommandSurfaces || cachedNativeCommandSurfacesVersion !== registryVersion) {
cachedNativeCommandSurfaces = new Set(
listChannelPlugins()
.filter((plugin) => plugin.capabilities.nativeCommands)
.filter((plugin) => plugin.capabilities?.nativeCommands === true)
.map((plugin) => plugin.id),
);
cachedNativeCommandSurfacesVersion = registryVersion;