Merge pull request #413 from chriswritescode-dev/fix/model-catalog-refresh

fix(models): reload the model catalog on reconnect and broadcast its events
This commit is contained in:
Chris Scott authored and GitHub committed 2026-10-09 11:44:24 -04:00
commit 458f3a4b05
4 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ type ReplayEventType = 'permission.asked' | 'form.created' | 'session.status'
const { RECONNECT_DELAY_MS, MAX_RECONNECT_DELAY_MS } = DEFAULTS.SSE
const MULTILINE_PATTERN = /[\r\n]/
const LOCATION_CATALOG_EVENT_TYPES = new Set(['command.updated', 'agent.updated', 'skill.updated'])
const LOCATION_CATALOG_EVENT_TYPES = new Set(['command.updated', 'agent.updated', 'skill.updated', 'model.updated', 'provider.updated', 'integration.updated'])
function serializeEnvelope(directory: string | null, payloadJson: string): string {
return '{"directory":' + JSON.stringify(directory) + ',"payload":' + payloadJson + '}'
+1 -1
View File
@@ -805,7 +805,7 @@ describe('SSEAggregator location-scoped catalog event broadcast', () => {
sseAggregator.setScheduledSessionsResolver(() => [])
})
it.each(['command.updated', 'agent.updated', 'skill.updated'])(
it.each(['command.updated', 'agent.updated', 'skill.updated', 'model.updated', 'provider.updated', 'integration.updated'])(
'broadcasts a location-scoped %s catalog event to every client without leaking other location-scoped events',
(type) => {
const subscribed = createCapturingClient()
@@ -856,6 +856,7 @@ describe('EventProvider permissions and forms', () => {
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'commands'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'agents'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'skills'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'providers'] })
})
})
@@ -880,6 +881,7 @@ describe('EventProvider permissions and forms', () => {
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'commands'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'agents'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'skills'] })
expect(invalidateQueries).toHaveBeenCalledWith({ queryKey: ['opencode', 'providers'] })
})
})
+1
View File
@@ -33,6 +33,7 @@ const LOCATION_CATALOG_QUERY_KEYS = [
['opencode', 'commands'],
['opencode', 'agents'],
['opencode', 'skills'],
['opencode', 'providers'],
] as const
type PermissionsBySession = Record<string, PermissionRequest[]>