fix: handle array slot value in warning message and fix format

This commit is contained in:
Tejesh Priyatham 2026-01-26 17:40:58 +00:00 committed by Neo
parent 344f5abcb5
commit 4641d1874c
3 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@ -71,3 +71,4 @@ USER.md
# local tooling
.serena/
package-lock.json

View File

@ -4,7 +4,7 @@ export type PluginEntryConfig = {
};
export type PluginSlotsConfig = {
/**
/**
* Select which plugin(s) own the memory slot.
* - Single string: "memory-lancedb" - one plugin active
* - Array: ["memory-core", "memory-lancedb"] - multiple plugins active (stackable)

View File

@ -52,9 +52,15 @@ export function applyExclusiveSlotSelection(params: {
};
const inferredPrevSlot = prevSlot ?? defaultSlotIdForKey(slotKey);
// Format slot value for display (handles both string and array)
const formatSlotValue = (v: string | string[] | null | undefined): string => {
if (v === null || v === undefined) return "none";
if (Array.isArray(v)) return `[${v.join(", ")}]`;
return v;
};
if (inferredPrevSlot && inferredPrevSlot !== params.selectedId) {
warnings.push(
`Exclusive slot "${slotKey}" switched from "${inferredPrevSlot}" to "${params.selectedId}".`,
`Exclusive slot "${slotKey}" switched from "${formatSlotValue(inferredPrevSlot)}" to "${params.selectedId}".`,
);
}