fix: handle array slot value in warning message and fix format
This commit is contained in:
parent
344f5abcb5
commit
4641d1874c
1
.gitignore
vendored
1
.gitignore
vendored
@ -71,3 +71,4 @@ USER.md
|
||||
|
||||
# local tooling
|
||||
.serena/
|
||||
package-lock.json
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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}".`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user