(input: {
ids: string[]
store: Store<State>
setStore: SetStoreFunction<State>
sdk: OpencodeClient
})
| 159 | } |
| 160 | |
| 161 | function warmSessions(input: { |
| 162 | ids: string[] |
| 163 | store: Store<State> |
| 164 | setStore: SetStoreFunction<State> |
| 165 | sdk: OpencodeClient |
| 166 | }) { |
| 167 | const known = new Set(input.store.session.map((item) => item.id)) |
| 168 | const ids = [...new Set(input.ids)].filter((id) => !!id && !known.has(id)) |
| 169 | if (ids.length === 0) return Promise.resolve() |
| 170 | return Promise.all( |
| 171 | ids.map((sessionID) => |
| 172 | retry(() => input.sdk.session.get({ sessionID })).then((x) => { |
| 173 | const session = x.data |
| 174 | if (!session?.id) return |
| 175 | mergeSession(input.setStore, session) |
| 176 | }), |
| 177 | ), |
| 178 | ).then(() => undefined) |
| 179 | } |
| 180 | |
| 181 | export const loadProvidersQuery = (scope: ServerScope, directory: string | null, sdk: OpencodeClient) => |
| 182 | queryOptions({ |
no test coverage detected