summaryrefslogtreecommitdiffhomepage
path: root/packages/core/src/config
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-20 20:40:35 +0900
committerAdam Malczewski <[email protected]>2026-05-20 20:40:35 +0900
commit8151447758e6826a578363758a755c6cebd1c05f (patch)
tree6afa780c28ca6e4622c1ab30238665caaad4371e /packages/core/src/config
parentf05099d450748cc7508f8cbde4e6539db2105f6d (diff)
downloaddispatch-8151447758e6826a578363758a755c6cebd1c05f.tar.gz
dispatch-8151447758e6826a578363758a755c6cebd1c05f.zip
feat: claude max oauth support with multi-account switching, reasoning effort, and dynamic model listing
Diffstat (limited to 'packages/core/src/config')
-rw-r--r--packages/core/src/config/schema.ts32
1 files changed, 27 insertions, 5 deletions
diff --git a/packages/core/src/config/schema.ts b/packages/core/src/config/schema.ts
index d3eea98..57d0b7b 100644
--- a/packages/core/src/config/schema.ts
+++ b/packages/core/src/config/schema.ts
@@ -126,11 +126,33 @@ function validateKey(raw: unknown, path: string, errors: ConfigError[]): KeyDefi
errors.push({ path, message: "must be an object" });
return null;
}
- for (const field of ["id", "provider", "env", "base_url"] as const) {
- if (typeof raw[field] !== "string") {
- errors.push({ path: `${path}.${field}`, message: "must be a string" });
- return null;
- }
+ if (typeof raw["id"] !== "string") {
+ errors.push({ path: `${path}.id`, message: "must be a string" });
+ return null;
+ }
+ if (typeof raw["provider"] !== "string") {
+ errors.push({ path: `${path}.provider`, message: "must be a string" });
+ return null;
+ }
+ if (typeof raw["base_url"] !== "string") {
+ errors.push({ path: `${path}.base_url`, message: "must be a string" });
+ return null;
+ }
+
+ // "anthropic" provider uses credentials_file instead of env
+ if (raw["provider"] === "anthropic") {
+ return {
+ id: raw["id"] as string,
+ provider: raw["provider"] as string,
+ base_url: raw["base_url"] as string,
+ ...(typeof raw["credentials_file"] === "string" ? { credentials_file: raw["credentials_file"] } as Pick<KeyDefinition, "credentials_file"> : {}),
+ };
+ }
+
+ // Other providers require env
+ if (typeof raw["env"] !== "string") {
+ errors.push({ path: `${path}.env`, message: "must be a string" });
+ return null;
}
return {
id: raw["id"] as string,