mirror of
https://github.com/block/goose.git
synced 2026-10-19 01:27:15 +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);
|
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', () => {
|
it('detects local inference support from Goose metadata', () => {
|
||||||
expect(
|
expect(
|
||||||
hasLocalInferenceCapability(
|
hasLocalInferenceCapability(
|
||||||
|
|
|
||||||
|
|
@ -67,5 +67,5 @@ export function hasEmptyExtensionSelectionCapability(
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
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