mirror of
https://github.com/block/goose.git
synced 2026-10-14 03:42:43 +00:00
fix(desktop): reject array capability metadata
Signed-off-by: Jasper Hugo <jasper@spiral.xyz>
This commit is contained in:
parent
f2210b009e
commit
75447d86b0
2 changed files with 21 additions and 1 deletions
|
|
@ -34,6 +34,26 @@ describe('ACP capabilities', () => {
|
|||
expect(hasEmptyExtensionSelectionCapability(initializeResponseWithMeta(meta))).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('accepts empty-selection capability objects with fields', () => {
|
||||
expect(
|
||||
hasEmptyExtensionSelectionCapability(
|
||||
initializeResponseWithMeta({
|
||||
goose: { emptyExtensionSelection: { version: 1 } },
|
||||
})
|
||||
)
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[],
|
||||
{ goose: [] },
|
||||
{ goose: { emptyExtensionSelection: [] } },
|
||||
{ goose: { emptyExtensionSelection: ['supported'] } },
|
||||
])('rejects array capability metadata: %j', (meta) => {
|
||||
expect(hasEmptyExtensionSelectionCapability(initializeResponseWithMeta(meta))).toBe(false);
|
||||
});
|
||||
|
||||
it('detects local inference support from Goose metadata', () => {
|
||||
expect(
|
||||
hasLocalInferenceCapability(
|
||||
|
|
|
|||
|
|
@ -67,5 +67,5 @@ export function hasEmptyExtensionSelectionCapability(
|
|||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null;
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue