Переглянути джерело

fix(core): restore catalog status schema export

Dax Raad 1 місяць тому
батько
коміт
0ac8f91ed6

+ 3 - 2
packages/core/src/models-dev.ts

@@ -1,5 +1,5 @@
 import path from "path"
-import { Context, Duration, Effect, Layer, Option, Schedule } from "effect"
+import { Context, Duration, Effect, Layer, Option, Schedule, Schema } from "effect"
 import { HttpClient, HttpClientRequest } from "effect/unstable/http"
 import { ModelsDev } from "@opencode-ai/schema/models-dev"
 import { Money } from "@opencode-ai/schema/money"
@@ -15,7 +15,8 @@ import { httpClient } from "./effect/app-node-platform"
 import { ModelV2 } from "./model"
 import { ProviderV2 } from "./provider"
 
-export type CatalogModelStatus = "alpha" | "beta" | "deprecated"
+export const CatalogModelStatus = Schema.Literals(["alpha", "beta", "deprecated"])
+export type CatalogModelStatus = typeof CatalogModelStatus.Type
 
 const USER_AGENT = `opencode/${InstallationChannel}/${InstallationVersion}/${Flag.OPENCODE_CLIENT}`
 

+ 0 - 1
packages/opencode/src/provider/model-status.ts

@@ -1,6 +1,5 @@
 import { Schema } from "effect"
 
-// @ts-expect-error dead V1 retains the former value-style ModelsDev status re-export.
 export { CatalogModelStatus } from "@opencode-ai/core/models-dev"
 
 export const ModelStatus = Schema.Literals(["alpha", "beta", "deprecated", "active"])

+ 0 - 3
packages/opencode/test/provider/model-status.test.ts

@@ -1,16 +1,13 @@
 import { describe, expect, test } from "bun:test"
 import { Schema } from "effect"
 import { ConfigProviderV1 } from "@opencode-ai/core/v1/config/provider"
-// @ts-expect-error dead V1 test retains the former value-style ModelsDev status import.
 import { CatalogModelStatus, ModelStatus } from "@/provider/model-status"
 import { ModelsDev } from "@opencode-ai/core/models-dev"
 import { Provider } from "@/provider/provider"
 
 describe("provider model status schemas", () => {
   test("keeps catalog status separate from normalized provider status", () => {
-    // @ts-expect-error dead V1 test treats the normalized catalog status type as a schema value.
     expect(Schema.decodeUnknownSync(CatalogModelStatus)("deprecated")).toBe("deprecated")
-    // @ts-expect-error dead V1 test treats the normalized catalog status type as a schema value.
     expect(() => Schema.decodeUnknownSync(CatalogModelStatus)("active")).toThrow()
     expect(Schema.decodeUnknownSync(ModelStatus)("active")).toBe("active")
   })