mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
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:
4 files changed
+5
-2
No files matched your search
@@ -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 + '}'
|
||||
|
||||
@@ -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'] })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ const LOCATION_CATALOG_QUERY_KEYS = [
|
||||
['opencode', 'commands'],
|
||||
['opencode', 'agents'],
|
||||
['opencode', 'skills'],
|
||||
['opencode', 'providers'],
|
||||
] as const
|
||||
|
||||
type PermissionsBySession = Record<string, PermissionRequest[]>
|
||||
|
||||
Reference in new issue
Block a user