diff --git a/ui/desktop/src/components/apps/AppsView.tsx b/ui/desktop/src/components/apps/AppsView.tsx index e2453c5aea..80a0f24a02 100644 --- a/ui/desktop/src/components/apps/AppsView.tsx +++ b/ui/desktop/src/components/apps/AppsView.tsx @@ -313,7 +313,9 @@ export default function AppsView() { )} {app.mcpServers && app.mcpServers.length > 0 && ( - {isCustomApp ? intl.formatMessage(i18n.customApp) : app.mcpServers.join(', ')} + {isCustomApp + ? intl.formatMessage(i18n.customApp) + : app.mcpServers.join(', ')} )} diff --git a/ui/goose2/src/shared/api/acpApi.ts b/ui/goose2/src/shared/api/acpApi.ts index 4ae88d5669..bc029318ba 100644 --- a/ui/goose2/src/shared/api/acpApi.ts +++ b/ui/goose2/src/shared/api/acpApi.ts @@ -3,6 +3,7 @@ import type { NewSessionResponse, LoadSessionResponse, PromptResponse, + SessionInfo, } from "@agentclientprotocol/sdk"; import { getClient } from "./acpConnection"; import { perfLog } from "@/shared/lib/perfLog"; @@ -43,24 +44,13 @@ export async function listProviders(): Promise { export async function listSessions(): Promise { const client = await getClient(); - // GooseClient.unstable_listSessions doesn't work with SDK 0.19 (renamed to listSessions). - // Bypass GooseClient and call the connection directly. Fix when ui/acp is updated. - // biome-ignore lint/suspicious/noExplicitAny: SDK doesn't expose conn property - const conn = (client as any).conn; - const response = await conn.listSessions({}); - return response.sessions.map( - (info: { - sessionId: string; - title?: string; - updatedAt?: string; - _meta?: Record; - }) => ({ - sessionId: info.sessionId, - title: info.title ?? null, - updatedAt: info.updatedAt ?? null, - messageCount: (info._meta?.messageCount as number) ?? 0, - }), - ); + const response = await client.listSessions({}); + return response.sessions.map((info: SessionInfo) => ({ + sessionId: info.sessionId, + title: info.title ?? null, + updatedAt: info.updatedAt ?? null, + messageCount: (info._meta?.messageCount as number) ?? 0, + })); } export async function exportSession(sessionId: string): Promise { diff --git a/ui/goose2/src/test/mocks/goose-sdk.ts b/ui/goose2/src/test/mocks/goose-sdk.ts deleted file mode 100644 index 4dbdbaacb4..0000000000 --- a/ui/goose2/src/test/mocks/goose-sdk.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class GooseClient { - closed = Promise.resolve(); - - async initialize(..._args: unknown[]): Promise {} -} diff --git a/ui/goose2/vitest.config.ts b/ui/goose2/vitest.config.ts index 158d7a49f2..6f66312cda 100644 --- a/ui/goose2/vitest.config.ts +++ b/ui/goose2/vitest.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ resolve: { alias: { "@": resolve(__dirname, "./src"), - "@aaif/goose-sdk": resolve(__dirname, "./src/test/mocks/goose-sdk.ts"), }, }, test: { diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml index 73351962ed..231b3dd8f9 100644 --- a/ui/pnpm-lock.yaml +++ b/ui/pnpm-lock.yaml @@ -653,8 +653,8 @@ importers: version: 3.25.76 devDependencies: '@agentclientprotocol/sdk': - specifier: ^0.14.1 - version: 0.14.1(zod@3.25.76) + specifier: ^0.19.0 + version: 0.19.0(zod@3.25.76) '@hey-api/openapi-ts': specifier: ^0.92.3 version: 0.92.4(magicast@0.5.2)(typescript@5.9.3) @@ -693,8 +693,8 @@ importers: specifier: workspace:* version: link:../sdk '@agentclientprotocol/sdk': - specifier: ^0.14.1 - version: 0.14.1(zod@4.3.6) + specifier: ^0.19.0 + version: 0.19.0(zod@4.3.6) '@inkjs/ui': specifier: ^2.0.0 version: 2.0.0(ink@6.8.0(@types/react@19.2.14)(react@19.2.4)) @@ -744,11 +744,6 @@ packages: '@adobe/css-tools@4.4.4': resolution: {integrity: sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg==} - '@agentclientprotocol/sdk@0.14.1': - resolution: {integrity: sha512-b6r3PS3Nly+Wyw9U+0nOr47bV8tfS476EgyEMhoKvJCZLbgqoDFN7DJwkxL88RR0aiOqOYV1ZnESHqb+RmdH8w==} - peerDependencies: - zod: ^3.25.0 || ^4.0.0 - '@agentclientprotocol/sdk@0.19.0': resolution: {integrity: sha512-U9I8ws9WTOk6jCBAWpXefGSDgVXn14/kV6HFzwWGcstQ02mOQgClMAROHmoIn9GqZbDBDEOkdIbP4P4TEMQdug==} peerDependencies: @@ -8859,14 +8854,10 @@ snapshots: '@adobe/css-tools@4.4.4': {} - '@agentclientprotocol/sdk@0.14.1(zod@3.25.76)': + '@agentclientprotocol/sdk@0.19.0(zod@3.25.76)': dependencies: zod: 3.25.76 - '@agentclientprotocol/sdk@0.14.1(zod@4.3.6)': - dependencies: - zod: 4.3.6 - '@agentclientprotocol/sdk@0.19.0(zod@4.3.6)': dependencies: zod: 4.3.6 diff --git a/ui/sdk/package.json b/ui/sdk/package.json index d13dd63b77..21a6ae7f74 100644 --- a/ui/sdk/package.json +++ b/ui/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@aaif/goose-sdk", - "version": "0.17.0", + "version": "0.18.0", "description": "Agent Client Protocol (ACP) SDK for Goose AI agent", "license": "Apache-2.0", "repository": { @@ -43,7 +43,7 @@ "zod": "^3.25.76" }, "peerDependencies": { - "@agentclientprotocol/sdk": "*" + "@agentclientprotocol/sdk": "^0.19.0" }, "optionalDependencies": { "@aaif/goose-binary-darwin-arm64": "workspace:*", @@ -53,7 +53,7 @@ "@aaif/goose-binary-win32-x64": "workspace:*" }, "devDependencies": { - "@agentclientprotocol/sdk": "^0.14.1", + "@agentclientprotocol/sdk": "^0.19.0", "@hey-api/openapi-ts": "^0.92.3", "@types/node": "^20.0.0", "prettier": "^3.8.1", diff --git a/ui/sdk/src/goose-client.ts b/ui/sdk/src/goose-client.ts index 306632838c..c697dfccad 100644 --- a/ui/sdk/src/goose-client.ts +++ b/ui/sdk/src/goose-client.ts @@ -92,10 +92,8 @@ export class GooseClient { return this.conn.unstable_forkSession(params); } - unstable_listSessions( - params: ListSessionsRequest, - ): Promise { - return this.conn.unstable_listSessions(params); + listSessions(params: ListSessionsRequest): Promise { + return this.conn.listSessions(params); } unstable_resumeSession( diff --git a/ui/text/package.json b/ui/text/package.json index 6051330fb8..db13215244 100644 --- a/ui/text/package.json +++ b/ui/text/package.json @@ -1,6 +1,6 @@ { "name": "@aaif/goose", - "version": "0.17.0", + "version": "0.18.0", "description": "Goose - an open-source AI agent", "license": "Apache-2.0", "repository": { @@ -28,7 +28,7 @@ }, "dependencies": { "@aaif/goose-sdk": "workspace:*", - "@agentclientprotocol/sdk": "^0.14.1", + "@agentclientprotocol/sdk": "^0.19.0", "@inkjs/ui": "^2.0.0", "ink": "^6.8.0", "ink-multiline-input": "^0.1.0", diff --git a/ui/text/src/configure.tsx b/ui/text/src/configure.tsx index 2312ee3696..07a4bd8536 100644 --- a/ui/text/src/configure.tsx +++ b/ui/text/src/configure.tsx @@ -37,7 +37,6 @@ interface ConfigureProps { } interface ModelSelectorProps { - client: GooseClient; provider: ProviderInventoryEntryDto; height: number; onSelect: (model: string) => void; @@ -45,7 +44,6 @@ interface ModelSelectorProps { } const ModelSelector = React.memo(function ModelSelector({ - client, provider, height, onSelect, @@ -53,7 +51,6 @@ const ModelSelector = React.memo(function ModelSelector({ }: ModelSelectorProps) { const [loading, setLoading] = useState(true); const [models, setModels] = useState([]); - const [error, setError] = useState(null); const [selectedIdx, setSelectedIdx] = useState(0); const [searchQuery, setSearchQuery] = useState(""); const [manualEntry, setManualEntry] = useState(false); @@ -61,42 +58,12 @@ const ModelSelector = React.memo(function ModelSelector({ const columns = stdout?.columns ?? 80; useEffect(() => { - let cancelled = false; - const timeoutId = setTimeout(() => { - if (!cancelled) { - setError("Request timed out. The provider may be slow to respond."); - setLoading(false); - } - }, LOAD_MODELS_TIMEOUT_MS); - - (async () => { - try { - setLoading(true); - setError(null); - const resp = await client.goose.GooseProvidersModels({ - providerName: provider.providerId, - }); - if (!cancelled) { - setModels(resp.models); - const defaultIdx = resp.models.findIndex((m) => m === provider.defaultModel); - setSelectedIdx(defaultIdx >= 0 ? defaultIdx : 0); - setLoading(false); - clearTimeout(timeoutId); - } - } catch (e: unknown) { - if (!cancelled) { - setError(e instanceof Error ? e.message : String(e)); - setLoading(false); - clearTimeout(timeoutId); - } - } - })(); - - return () => { - cancelled = true; - clearTimeout(timeoutId); - }; - }, [client, provider.providerId, provider.defaultModel]); + const availableModels = provider.models.map((model) => model.id); + setModels(availableModels); + const defaultIdx = availableModels.findIndex((model) => model === provider.defaultModel); + setSelectedIdx(defaultIdx >= 0 ? defaultIdx : 0); + setLoading(false); + }, [provider.models, provider.defaultModel]); const filtered = (() => { if (!searchQuery) return models; @@ -199,7 +166,7 @@ const ModelSelector = React.memo(function ModelSelector({ ); } - if (error) { + if (models.length === 0) { return ( @@ -207,11 +174,13 @@ const ModelSelector = React.memo(function ModelSelector({ ◆ Select model ◆ - ⚠ Failed to load models + ⚠ No models available - {error} + + This provider does not currently expose any models in inventory. + @@ -439,10 +408,15 @@ export default function ConfigureScreen({ value: provider.providerId, }); await client.goose.GooseConfigUpsert({ key: "GOOSE_MODEL", value: model }); - await client.goose.GooseSessionProviderUpdate({ + await client.setSessionConfigOption({ sessionId, - provider: provider.providerId, - model, + configId: "provider", + value: provider.providerId, + }); + await client.setSessionConfigOption({ + sessionId, + configId: "model", + value: model, }); onComplete(); } catch (e: unknown) { @@ -544,7 +518,6 @@ export default function ConfigureScreen({ if (phase === "select_model" && selectedProvider) { return ( ({ + requestPermission: async ( + params: RequestPermissionRequest, + ): Promise => { + const optionId = params.options?.[0]?.optionId ?? "approve"; + return { + outcome: { + outcome: "selected", + optionId, + }, + }; + }, sessionUpdate: async (params: SessionNotification) => { const update = params.update; if (update.sessionUpdate === "agent_message_chunk") { @@ -763,7 +776,7 @@ function App({ setStatus("handshaking…"); await client.initialize({ - protocolVersion: 0, + protocolVersion: PROTOCOL_VERSION, clientInfo: { name: "goose-text", version: "0.1.0" }, clientCapabilities: {}, }); @@ -1218,6 +1231,17 @@ async function runTextMode(serverConnection: Stream | string, prompt: string) { try { const client = new GooseClient( () => ({ + requestPermission: async ( + params: RequestPermissionRequest, + ): Promise => { + const optionId = params.options?.[0]?.optionId ?? "approve"; + return { + outcome: { + outcome: "selected", + optionId, + }, + }; + }, sessionUpdate: async (params: SessionNotification) => { const update = params.update; if (update.sessionUpdate === "agent_message_chunk") { @@ -1231,7 +1255,7 @@ async function runTextMode(serverConnection: Stream | string, prompt: string) { ); await client.initialize({ - protocolVersion: 0, + protocolVersion: PROTOCOL_VERSION, clientInfo: { name: "goose-text", version: "0.1.0" }, clientCapabilities: {}, });