@jdsl/router 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jdsl/router",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "author": "Machar Kook",
6
6
  "license": "Apache-2.0",
@@ -16,12 +16,13 @@
16
16
  "@effect/platform": "^0.96.2",
17
17
  "@effect/platform-bun": "^0.90.0",
18
18
  "@effect/platform-node": "^0.107.0",
19
+ "ai": "^7.0.4",
19
20
  "effect": "3.21.0"
20
21
  },
21
22
  "exports": {
22
23
  ".": "./src/index.ts",
23
24
  "./config": "./src/config.ts",
24
- "./error": "./src/types",
25
+ "./error": "./src/types.ts",
25
26
  "./models-dev": "./src/models/models-dev.ts"
26
27
  }
27
28
  }
package/src/config.ts CHANGED
@@ -3,7 +3,6 @@ import { dirname } from "path";
3
3
 
4
4
  import { Either, Effect, Schema } from "effect";
5
5
  import { FileSystem, Path } from "@effect/platform";
6
- import { AiProvider } from "../../provider/src/providers.ts";
7
6
  import { LoadAPIKeyError } from "./types.ts";
8
7
 
9
8
  export const ProvidersList = Schema.Literal("anthropic", "deepseek", "google", "nvidia", "openai", "recon", "zhipuai", "zai", "zai-coding-plan", "zhipuai-coding-plan");
@@ -34,7 +33,6 @@ export class AiModelConfig extends Effect.Service<AiModelConfig>()(
34
33
  effect: Effect.gen(function* () {
35
34
  const fs = yield* FileSystem.FileSystem;
36
35
  const path = yield* Path.Path;
37
- const provider = yield* AiProvider;
38
36
 
39
37
  let config: Config;
40
38
 
@@ -72,10 +70,9 @@ export class AiModelConfig extends Effect.Service<AiModelConfig>()(
72
70
  yield* fs.writeFileString(configPath, jsonString,);
73
71
  })
74
72
 
75
- const getConfig = () => Effect.gen(function* () {
76
- const currentProvider = yield* provider.getProvider();
77
- const cfg = config[currentProvider];
78
- return cfg ? cfg : yield* new LoadAPIKeyError({name: "config", msg: `${currentProvider} apiKey/auth is missing`, isRetryable: false})
73
+ const getConfig = (provider: Providers) => Effect.gen(function* () {
74
+ const cfg = config[provider];
75
+ return cfg ? cfg : yield* new LoadAPIKeyError({name: "config", msg: `${provider} apiKey/auth is missing`, isRetryable: false})
79
76
  })
80
77
 
81
78
  const listConfig = () => Effect.gen(function* () {
@@ -6,6 +6,7 @@ import { FileSystem, Path } from "@effect/platform";
6
6
  import { type ModelProviders, type Provider, ModelsDevSchema } from "./modelSchema.ts";
7
7
  import type { Providers } from "../config.ts";
8
8
  import { NoSuchModelError } from "../types.ts";
9
+ export { type Model } from "./modelSchema.ts";
9
10
 
10
11
  export class FetchError extends Data.TaggedError("FetchError")<{ name: string, msg: string, isRetryable: boolean }> { }
11
12
  export class CacheError extends Data.TaggedError("CacheError")<{ msg: string }> { }