Buckets:
| import { Catalog } from "@opencode-ai/core/catalog" | |
| import { PluginBoot } from "@opencode-ai/core/plugin/boot" | |
| import { ProviderV2 } from "@opencode-ai/core/provider" | |
| import { Effect } from "effect" | |
| import { HttpApiBuilder } from "effect/unstable/httpapi" | |
| import { Api } from "../api" | |
| import { ProviderNotFoundError, ServiceUnavailableError } from "../errors" | |
| import { response } from "../groups/location" | |
| const catalogUnavailable = new ServiceUnavailableError({ | |
| message: "Provider catalog is unavailable", | |
| service: "catalog", | |
| }) | |
| export const ProviderHandler = HttpApiBuilder.group(Api, "server.provider", (handlers) => | |
| Effect.gen(function* () { | |
| return handlers | |
| .handle( | |
| "provider.list", | |
| Effect.fn(function* () { | |
| const catalog = yield* Catalog.Service | |
| const pluginBoot = yield* PluginBoot.Service | |
| yield* pluginBoot.wait().pipe(Effect.catchDefect(() => Effect.fail(catalogUnavailable))) | |
| return yield* response(catalog.provider.available()) | |
| }), | |
| ) | |
| .handle( | |
| "provider.get", | |
| Effect.fn(function* (ctx) { | |
| const catalog = yield* Catalog.Service | |
| const pluginBoot = yield* PluginBoot.Service | |
| yield* pluginBoot.wait().pipe(Effect.catchDefect(() => Effect.fail(catalogUnavailable))) | |
| return yield* response(catalog.provider.get(ctx.params.providerID)).pipe( | |
| Effect.catchTag("CatalogV2.ProviderNotFound", (error) => | |
| Effect.fail( | |
| new ProviderNotFoundError({ | |
| providerID: error.providerID, | |
| message: `Provider not found: ${error.providerID}`, | |
| }), | |
| ), | |
| ), | |
| ) | |
| }), | |
| ) | |
| }), | |
| ) | |
Xet Storage Details
- Size:
- 1.75 kB
- Xet hash:
- 427a18e318f6c804992fa0da504adcdfa0f7a37cb8674c4046ae6b37864bebb7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.