Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions ui/goose2/src/shared/api/acpApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
NewSessionResponse,
LoadSessionResponse,
PromptResponse,
SessionInfo,
} from "@agentclientprotocol/sdk";
import { getClient } from "./acpConnection";
import { perfLog } from "@/shared/lib/perfLog";
Expand Down Expand Up @@ -34,24 +35,13 @@ export async function listProviders(): Promise<AcpProvider[]> {

export async function listSessions(): Promise<AcpSessionInfo[]> {
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<string, unknown>;
}) => ({
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<string> {
Expand Down
5 changes: 0 additions & 5 deletions ui/goose2/src/test/mocks/goose-sdk.ts

This file was deleted.

1 change: 0 additions & 1 deletion ui/goose2/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default defineConfig({
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"@aaif/goose-sdk": resolve(__dirname, "./src/test/mocks/goose-sdk.ts"),
},
},
test: {
Expand Down
19 changes: 5 additions & 14 deletions ui/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ui/sdk/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -43,7 +43,7 @@
"zod": "^3.25.76"
},
"peerDependencies": {
"@agentclientprotocol/sdk": "*"
"@agentclientprotocol/sdk": "^0.19.0"
},
"optionalDependencies": {
"@aaif/goose-binary-darwin-arm64": "workspace:*",
Expand All @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions ui/sdk/src/goose-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ export class GooseClient {
return this.conn.unstable_forkSession(params);
}

unstable_listSessions(
params: ListSessionsRequest,
): Promise<ListSessionsResponse> {
return this.conn.unstable_listSessions(params);
listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse> {
return this.conn.listSessions(params);
}

unstable_resumeSession(
Expand Down
4 changes: 2 additions & 2 deletions ui/text/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 12 additions & 9 deletions ui/text/src/configure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ const ModelSelector = React.memo(function ModelSelector({
try {
setLoading(true);
setError(null);
const resp = await client.goose.GooseProvidersModels({
providerName: provider.name,
});
const knownModels = provider.knownModels?.map((model) => model.name) ?? [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Load models from provider inventory, not details metadata

This now builds the model picker from provider.knownModels, but that field comes from _goose/providers/details static metadata (crates/goose-acp/src/server.rs on_get_provider_details, lines 2839–2846) rather than the runtime inventory/refresh path (_goose/providers/inventory). As a result, providers that discover models dynamically can show an incomplete list here, so valid models may disappear from the picker unless users manually type them. Querying provider inventory for the selected provider (and optionally triggering refresh) would preserve the previous behavior of showing current model options.

Useful? React with 👍 / 👎.

if (!cancelled) {
setModels(resp.models);
const defaultIdx = resp.models.findIndex((m) => m === provider.defaultModel);
setModels(knownModels);
const defaultIdx = knownModels.findIndex((m) => m === provider.defaultModel);
setSelectedIdx(defaultIdx >= 0 ? defaultIdx : 0);
setLoading(false);
clearTimeout(timeoutId);
Expand All @@ -96,7 +94,7 @@ const ModelSelector = React.memo(function ModelSelector({
cancelled = true;
clearTimeout(timeoutId);
};
}, [client, provider.name, provider.defaultModel]);
}, [provider.knownModels, provider.defaultModel]);

const filtered = (() => {
if (!searchQuery) return models;
Expand Down Expand Up @@ -432,10 +430,15 @@ export default function ConfigureScreen({
}
await client.goose.GooseConfigUpsert({ key: "GOOSE_PROVIDER", value: provider.name });
await client.goose.GooseConfigUpsert({ key: "GOOSE_MODEL", value: model });
await client.goose.GooseSessionProviderUpdate({
await client.setSessionConfigOption({
sessionId,
configId: "provider",
value: provider.name,
});
Comment on lines +411 to +415

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update provider and model atomically for sessions

Splitting session updates into two setSessionConfigOption calls creates a partial-failure path: this first call updates provider without a model, and the server’s update_provider path uses ACP_CURRENT_MODEL when switching providers without an explicit model (crates/goose-acp/src/server.rs, around update_provider fallback logic at lines 2389-2394). If the subsequent model update fails (for example, manual model entry typo or stale model list), the UI reports an error after the provider has already been changed, leaving the session in an unintended intermediate model state.

Useful? React with 👍 / 👎.

await client.setSessionConfigOption({
sessionId,
provider: provider.name,
model,
configId: "model",
value: model,
});
onComplete();
} catch (e: unknown) {
Expand Down
6 changes: 3 additions & 3 deletions ui/text/src/tui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
ToolCall,
ToolCallUpdate,
} from "@agentclientprotocol/sdk";
import { ndJsonStream } from "@agentclientprotocol/sdk";
import { PROTOCOL_VERSION, ndJsonStream } from "@agentclientprotocol/sdk";
import { GooseClient } from "@aaif/goose-sdk";
import { resolveGooseBinary } from "@aaif/goose-sdk/node";
import Onboarding from "./onboarding.js";
Expand Down Expand Up @@ -841,7 +841,7 @@ function App({

setStatus("handshaking…");
await client.initialize({
protocolVersion: 0,
protocolVersion: PROTOCOL_VERSION,
clientInfo: { name: "goose-text", version: "0.1.0" },
clientCapabilities: {},
});
Expand Down Expand Up @@ -1255,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: {},
});
Expand Down
Loading