fix minimax use (#44)

* Fix provider API key storage to match OpenCode schema

Backend was writing credentials with type 'apiKey' and field 'apiKey',
but OpenCode expects type 'api' and field 'key'. This caused UI-set
credentials to be silently ignored while environment variables worked.

- Update AuthEntrySchema to use 'api' type and 'key' field
- Update AuthService.set() to write new format
- Add migration to convert existing entries on read

Fixes #40

* Add auth service tests to validate schema fix and migration

Tests verify:
- Migration from old 'apiKey' format to 'api' format
- New credentials are written in correct format
- getAll, set, delete, list, and has methods work correctly

---------

Co-authored-by: Chris Scott <chris@cstech.dev>
This commit is contained in:
Chris ScottandChris Scott authored and GitHub committed 2025-12-31 19:33:35 -05:00
1 parent f1a7d36433
commit c267bce42e
3 files changed
+391 -6

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
import { z } from "zod";
export const AuthEntrySchema = z.object({
type: z.enum(["apiKey", "oauth"]),
apiKey: z.string().optional(),
type: z.enum(["api", "oauth"]),
key: z.string().optional(),
refresh: z.string().optional(),
access: z.string().optional(),
expires: z.number().optional(),