| 369 | } |
| 370 | |
| 371 | const loadCatalog = async (): Promise<void> => { |
| 372 | if (footer.isClosed) { |
| 373 | return |
| 374 | } |
| 375 | |
| 376 | const [agents, resources, commands] = await Promise.all([ |
| 377 | ctx.sdk.app |
| 378 | .agents({ directory: ctx.directory }) |
| 379 | .then((x) => x.data ?? []) |
| 380 | .catch(() => []), |
| 381 | ctx.sdk.experimental.resource |
| 382 | .list({ directory: ctx.directory }) |
| 383 | .then((x) => Object.values(x.data ?? {})) |
| 384 | .catch(() => []), |
| 385 | ctx.sdk.command |
| 386 | .list({ directory: ctx.directory }) |
| 387 | .then((x) => x.data ?? []) |
| 388 | .catch(() => []), |
| 389 | ]) |
| 390 | if (footer.isClosed) { |
| 391 | return |
| 392 | } |
| 393 | |
| 394 | footer.event({ |
| 395 | type: "catalog", |
| 396 | agents, |
| 397 | resources, |
| 398 | commands, |
| 399 | }) |
| 400 | } |
| 401 | |
| 402 | void footer |
| 403 | .idle() |