diff options
| author | Adam Malczewski <[email protected]> | 2026-06-05 21:19:45 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-05 21:19:45 +0900 |
| commit | 4283d1f8a0bc3953e65962a2364c903d0015f047 (patch) | |
| tree | 4de5d2d2c1114301f03236b6dfc98a638a7c61c0 /packages/kernel/src/contracts/provider.ts | |
| parent | 368be032ef57638b558db659d70bfac00cb95cdd (diff) | |
| download | dispatch-4283d1f8a0bc3953e65962a2364c903d0015f047.tar.gz dispatch-4283d1f8a0bc3953e65962a2364c903d0015f047.zip | |
feat(kernel): listModels/ModelInfo + per-turn cwd contracts; add transport-contract wire package
Diffstat (limited to 'packages/kernel/src/contracts/provider.ts')
| -rw-r--r-- | packages/kernel/src/contracts/provider.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/kernel/src/contracts/provider.ts b/packages/kernel/src/contracts/provider.ts index 62dc8e9..ee58c1d 100644 --- a/packages/kernel/src/contracts/provider.ts +++ b/packages/kernel/src/contracts/provider.ts @@ -104,6 +104,17 @@ export interface ProviderStreamOptions { } /** + * Metadata describing a single model a provider can serve. Returned by + * `listModels` so a catalog (e.g. the credential-store) can enumerate the + * `<credentialName>/<model>` choices a client may select. Kept minimal — `id` + * is the wire model identifier; `displayName` is an optional human label. + */ +export interface ModelInfo { + readonly id: string; + readonly displayName?: string; +} + +/** * What a provider extension registers with the kernel. The kernel calls * `stream` and consumes the async iterable of events — it never knows which * concrete LLM API is behind it. @@ -122,4 +133,13 @@ export interface ProviderContract { tools: readonly ToolContract[], opts?: ProviderStreamOptions, ) => AsyncIterable<ProviderEvent>; + + /** + * Enumerate the models this provider can serve, each in its own way (e.g. an + * OpenAI-compatible provider GETs `/v1/models`). Optional: a provider that + * cannot (or chooses not to) enumerate omits it, and a catalog simply lists + * none for it. A future multi-credential design may pass per-credential + * credentials in; today the provider uses the key it resolved at activate. + */ + readonly listModels?: () => Promise<readonly ModelInfo[]>; } |
