Keep provider diagnostics and model lists in sync (#1660)
* fix(server): align provider catalog diagnostics * fix(server): preserve catalog profile models * refactor: unify provider catalog discovery under AgentClient.fetchCatalog Remove listModels/listModes from AgentClient and fetchModels/fetchModes from ProviderDefinition. All provider runtime discovery now flows through a single fetchCatalog(options) => ProviderCatalog API. ProviderSnapshotManager.listModels/listModes remain as cached snapshot conveniences only. Provider implementations (acp, codex, opencode, pi, claude, mock) updated accordingly; agent-manager default model resolution now calls fetchCatalog. Reshape step toward issue pi-model-list-empty. * refactor: remove remaining provider listModels/listModes runtime API residue Migrate remaining AgentClient/provider-client implementations and tests to fetchCatalog. Remove obsolete ListModelsOptions/ListModesOptions interfaces. Update ProviderSnapshotManager.getProviderDiagnostic to materialize clients via ensureClient(provider, definition) so diagnostics self-heal the settings sheet instead of failing when providerClients[provider] is absent. Allowed to remain: ProviderSnapshotManager.listModels/listModes as cached snapshot readers; protocol/client legacy list_provider_models names; unrelated local helper in create-agent-mode. * test(server): repair test clients after fetchCatalog refactor - Restore TestAgentClient.fetchCatalog with proper model list and resumeSession. - Restore NativeArchiveRecordingClient and EnvProbeAgentClient removed during refactor. - Fix ResumeCaptureClient.fetchCatalog and resumeSession. - Fix stream-coalescing TestAgentClient.fetchCatalog shape and isAvailable. - Mock accessible OpenCode provider in full-access mode tests so fetchCatalog does not throw. * refactor(app): update stable discovered models ref directly during render
This commit is contained in:
+4
-5
@@ -34,7 +34,7 @@ OpenCode owns user message IDs. Do not pass Paseo-generated IDs to OpenCode prom
|
||||
|
||||
Every provider adapter owns its canonical user-message timeline rows. When a foreground prompt is accepted, the adapter must emit exactly one `user_message` timeline item for that submitted prompt, using the same message ID it gives to or receives from the provider runtime. Optimistic client messages are UI-only and provider transcript echoes are optional; neither is allowed to be the only source of truth. If the provider later echoes the same submitted user message, dedupe by provider-visible message ID, not by text.
|
||||
|
||||
Draft metadata lookups should avoid creating provider sessions when the upstream provider has top-level APIs for that metadata. Prefer `AgentClient.listModels`, `listModes`, `listCommands`, or `listFeatures` over creating a scratch `AgentSession`; scratch sessions can show up as empty native sessions in provider import/history UIs.
|
||||
Draft metadata lookups should avoid creating provider sessions when the upstream provider has top-level APIs for that metadata. Prefer `AgentClient.fetchCatalog`, `listCommands`, or `listFeatures` over creating a scratch `AgentSession`; scratch sessions can show up as empty native sessions in provider import/history UIs. `fetchCatalog` is the single discovery API for models and modes — provider implementations may use one process, separate upstream calls, or static data internally, but callers outside the provider do not get separate runtime model/mode probes.
|
||||
|
||||
Provider session import has its own contract. The picker calls `listImportableSessions` and receives rows only: provider handle, cwd, title, prompt previews, and last activity. Import calls `importSession({ providerHandleId, cwd })` for the selected row and must not call listing again. The provider returns the resumed session, storage config, persistence handle, and hydrated timeline for that one native session; `AgentManager.importProviderSession` seeds the daemon timeline and publishes the Paseo agent only after it is ready.
|
||||
|
||||
@@ -336,14 +336,13 @@ interface AgentClient {
|
||||
overrides?: Partial<AgentSessionConfig>,
|
||||
launchContext?: AgentLaunchContext,
|
||||
): Promise<AgentSession>;
|
||||
listModels(options: ListModelsOptions): Promise<AgentModelDefinition[]>;
|
||||
fetchCatalog(options: FetchCatalogOptions): Promise<ProviderCatalog>;
|
||||
isAvailable(): Promise<boolean>;
|
||||
// Optional:
|
||||
listModes?(options: ListModesOptions): Promise<AgentMode[]>;
|
||||
listImportableSessions?(
|
||||
listImportableSessions(
|
||||
options?: ListImportableSessionsOptions,
|
||||
): Promise<ImportableProviderSession[]>;
|
||||
importSession?(
|
||||
importSession(
|
||||
input: ImportProviderSessionInput,
|
||||
context: ImportProviderSessionContext,
|
||||
): Promise<ImportedProviderSession>;
|
||||
|
||||
Reference in New Issue
Block a user