@@ -53,6 +53,7 @@ import {
|
53 | 53 | type PluginManifestToolMetadata, |
54 | 54 | type PluginPackageChannel, |
55 | 55 | type PluginPackageInstall, |
| 56 | +normalizeManifestChannelCommandDefaults, |
56 | 57 | } from "./manifest.js"; |
57 | 58 | import { checkMinHostVersion } from "./min-host-version.js"; |
58 | 59 | import { |
@@ -295,29 +296,6 @@ function normalizePreferredPluginIds(raw: unknown): string[] | undefined {
|
295 | 296 | return normalizeOptionalTrimmedStringList(raw); |
296 | 297 | } |
297 | 298 | |
298 | | -function normalizePackageChannelCommands( |
299 | | -commands: unknown, |
300 | | -): PluginManifestChannelCommandDefaults | undefined { |
301 | | -if (!commands || typeof commands !== "object" || Array.isArray(commands)) { |
302 | | -return undefined; |
303 | | -} |
304 | | -const record = commands as Record<string, unknown>; |
305 | | -const nativeCommandsAutoEnabled = |
306 | | -typeof record.nativeCommandsAutoEnabled === "boolean" |
307 | | - ? record.nativeCommandsAutoEnabled |
308 | | - : undefined; |
309 | | -const nativeSkillsAutoEnabled = |
310 | | -typeof record.nativeSkillsAutoEnabled === "boolean" |
311 | | - ? record.nativeSkillsAutoEnabled |
312 | | - : undefined; |
313 | | -return nativeCommandsAutoEnabled !== undefined || nativeSkillsAutoEnabled !== undefined |
314 | | - ? { |
315 | | - ...(nativeCommandsAutoEnabled !== undefined ? { nativeCommandsAutoEnabled } : {}), |
316 | | - ...(nativeSkillsAutoEnabled !== undefined ? { nativeSkillsAutoEnabled } : {}), |
317 | | -} |
318 | | - : undefined; |
319 | | -} |
320 | | - |
321 | 299 | function mergePackageChannelMetaIntoChannelConfigs(params: { |
322 | 300 | channelConfigs?: Record<string, PluginManifestChannelConfig>; |
323 | 301 | packageChannel?: OpenClawPackageManifest["channel"]; |
@@ -342,7 +320,7 @@ function mergePackageChannelMetaIntoChannelConfigs(params: {
|
342 | 320 | const preferOver = |
343 | 321 | existing.preferOver ?? normalizePreferredPluginIds(params.packageChannel?.preferOver); |
344 | 322 | const commands = |
345 | | -existing.commands ?? normalizePackageChannelCommands(params.packageChannel?.commands); |
| 323 | +existing.commands ?? normalizeManifestChannelCommandDefaults(params.packageChannel?.commands); |
346 | 324 | |
347 | 325 | const merged: Record<string, PluginManifestChannelConfig> = Object.create(null); |
348 | 326 | for (const [key, value] of Object.entries(params.channelConfigs)) { |
@@ -501,7 +479,7 @@ function buildRecord(params: {
|
501 | 479 | }), |
502 | 480 | packageChannel: params.candidate.packageManifest?.channel, |
503 | 481 | }); |
504 | | -const packageChannelCommands = normalizePackageChannelCommands( |
| 482 | +const packageChannelCommands = normalizeManifestChannelCommandDefaults( |
505 | 483 | params.candidate.packageManifest?.channel?.commands, |
506 | 484 | ); |
507 | 485 | return { |
|