| 292 | }; |
| 293 | |
| 294 | export const watchWorkspaceAgentLogs = ( |
| 295 | agentId: string, |
| 296 | params?: WatchWorkspaceAgentLogsParams, |
| 297 | ) => { |
| 298 | const searchParams = new URLSearchParams({ |
| 299 | follow: "true", |
| 300 | after: params?.after?.toString() ?? "", |
| 301 | }); |
| 302 | |
| 303 | /** |
| 304 | * WebSocket compression in Safari (confirmed in 16.5) is broken when |
| 305 | * the server sends large messages. The following error is seen: |
| 306 | * WebSocket connection to 'wss://...' failed: The operation couldn't be completed. |
| 307 | */ |
| 308 | if (userAgentParser(navigator.userAgent).browser.name === "Safari") { |
| 309 | searchParams.set("no_compression", ""); |
| 310 | } |
| 311 | |
| 312 | return new OneWayWebSocket<TypesGen.WorkspaceAgentLog[]>({ |
| 313 | apiRoute: `/api/v2/workspaceagents/${agentId}/logs`, |
| 314 | searchParams, |
| 315 | }); |
| 316 | }; |
| 317 | |
| 318 | type WatchWorkspaceAgentLogsParams = { |
| 319 | after?: number; |