Skip to content

Commit 076d2a6

Browse files
committed
fixed style check
1 parent 94a91db commit 076d2a6

9 files changed

Lines changed: 98 additions & 150 deletions

File tree

ui/goose2/src-tauri/Cargo.lock

Lines changed: 0 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/goose2/src-tauri/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ uuid = { version = "1", features = ["v4", "serde"] }
3232
chrono = { version = "0.4", features = ["serde"] }
3333
serde_yaml = "0.9"
3434
etcetera = "0.8"
35-
futures = "0.3"
36-
tokio-tungstenite = "0.21.0"
3735
doctor = { git = "https://github.com/block/builderbot", rev = "8e1c3ec145edc0df5f04b4427cfd758378036862" }
3836
ignore = "0.4.25"
3937
base64 = "0.22"

ui/goose2/src-tauri/src/services/acp/goose_serve.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ async fn wait_for_server_ready(port: u16, child: &mut Child) -> Result<(), Strin
128128
}
129129

130130
if Instant::now() >= deadline {
131-
return Err(format!(
132-
"Timed out waiting for goose serve on port {port}"
133-
));
131+
return Err(format!("Timed out waiting for goose serve on port {port}"));
134132
}
135133

136134
tokio::time::sleep(GOOSE_SERVE_CONNECT_RETRY_DELAY).await;
@@ -177,7 +175,10 @@ pub(crate) fn resolve_goose_binary() -> Result<PathBuf, String> {
177175
));
178176
}
179177

180-
log::info!("Resolved goose binary via local discovery: {}", path.display());
178+
log::info!(
179+
"Resolved goose binary via local discovery: {}",
180+
path.display()
181+
);
181182
path
182183
};
183184

ui/goose2/src/features/sidebar/ui/Sidebar.tsx

Lines changed: 62 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -491,73 +491,70 @@ export function Sidebar({
491491
})}
492492
</div>
493493

494-
{!collapsed && (
495-
<>
496-
{sidebarSearch.submittedQuery ? (
497-
<div className="relative z-10 space-y-2">
498-
{sidebarSearch.error && (
499-
<p className="px-1 text-xs text-danger">
500-
{t("search.error")}
501-
</p>
502-
)}
503-
504-
{sidebarSearch.isSearching &&
505-
sidebarSearch.results.length === 0 && (
506-
<div className="rounded-lg border border-dashed border-border px-3 py-6 text-center text-xs text-muted-foreground">
507-
{t("search.searching")}
508-
</div>
509-
)}
494+
{!collapsed &&
495+
(sidebarSearch.submittedQuery ? (
496+
<div className="relative z-10 space-y-2">
497+
{sidebarSearch.error && (
498+
<p className="px-1 text-xs text-danger">
499+
{t("search.error")}
500+
</p>
501+
)}
510502

511-
{(!sidebarSearch.isSearching ||
512-
sidebarSearch.results.length > 0) && (
513-
<SidebarSearchResults
514-
results={sidebarSearch.results}
515-
activeSessionId={activeSessionId}
516-
onSelectResult={(sessionId, messageId) => {
517-
if (messageId) {
518-
onSelectSearchResult?.(
519-
sessionId,
520-
messageId,
521-
sidebarSearch.submittedQuery,
522-
);
523-
return;
524-
}
525-
onSelectSession?.(sessionId);
526-
}}
527-
getPersonaName={sidebarResolvers.getPersonaName}
528-
getProjectName={sidebarResolvers.getProjectName}
529-
/>
503+
{sidebarSearch.isSearching &&
504+
sidebarSearch.results.length === 0 && (
505+
<div className="rounded-lg border border-dashed border-border px-3 py-6 text-center text-xs text-muted-foreground">
506+
{t("search.searching")}
507+
</div>
530508
)}
531-
</div>
532-
) : (
533-
<SidebarProjectsSection
534-
projects={projects}
535-
projectSessions={projectSessions}
536-
expandedProjects={expandedProjects}
537-
toggleProject={toggleProject}
538-
collapsed={collapsed}
539-
labelTransition={labelTransition}
540-
labelVisible={labelVisible}
541-
activeSessionId={activeSessionId}
542-
activeProjectId={activeProjectId}
543-
onNavigate={onNavigate}
544-
onSelectSession={onSelectSession}
545-
onNewChatInProject={onNewChatInProject}
546-
onNewChat={onNewChat}
547-
onCreateProject={onCreateProject}
548-
onEditProject={onEditProject}
549-
onArchiveProject={onArchiveProject}
550-
onArchiveChat={onArchiveChat}
551-
onRenameChat={onRenameChat}
552-
onMoveToProject={onMoveToProject}
553-
onReorderProject={onReorderProject}
554-
onItemMouseEnter={onItemMouseEnter}
555-
activeSessionRefCallback={activeSessionRefCallback}
556-
activeProjectRefCallback={activeProjectRefCallback}
557-
/>
558-
)}
559-
</>
560-
)}
509+
510+
{(!sidebarSearch.isSearching ||
511+
sidebarSearch.results.length > 0) && (
512+
<SidebarSearchResults
513+
results={sidebarSearch.results}
514+
activeSessionId={activeSessionId}
515+
onSelectResult={(sessionId, messageId) => {
516+
if (messageId) {
517+
onSelectSearchResult?.(
518+
sessionId,
519+
messageId,
520+
sidebarSearch.submittedQuery,
521+
);
522+
return;
523+
}
524+
onSelectSession?.(sessionId);
525+
}}
526+
getPersonaName={sidebarResolvers.getPersonaName}
527+
getProjectName={sidebarResolvers.getProjectName}
528+
/>
529+
)}
530+
</div>
531+
) : (
532+
<SidebarProjectsSection
533+
projects={projects}
534+
projectSessions={projectSessions}
535+
expandedProjects={expandedProjects}
536+
toggleProject={toggleProject}
537+
collapsed={collapsed}
538+
labelTransition={labelTransition}
539+
labelVisible={labelVisible}
540+
activeSessionId={activeSessionId}
541+
activeProjectId={activeProjectId}
542+
onNavigate={onNavigate}
543+
onSelectSession={onSelectSession}
544+
onNewChatInProject={onNewChatInProject}
545+
onNewChat={onNewChat}
546+
onCreateProject={onCreateProject}
547+
onEditProject={onEditProject}
548+
onArchiveProject={onArchiveProject}
549+
onArchiveChat={onArchiveChat}
550+
onRenameChat={onRenameChat}
551+
onMoveToProject={onMoveToProject}
552+
onReorderProject={onReorderProject}
553+
onItemMouseEnter={onItemMouseEnter}
554+
activeSessionRefCallback={activeSessionRefCallback}
555+
activeProjectRefCallback={activeProjectRefCallback}
556+
/>
557+
))}
561558
</nav>
562559
</div>
563560
</div>

ui/goose2/src/shared/api/acp.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ContentBlock } from "@agentclientprotocol/sdk";
12
import * as directAcp from "./acpApi";
23
import * as sessionTracker from "./acpSessionTracker";
34
import {
@@ -37,10 +38,7 @@ export async function acpSendMessage(
3738
): Promise<void> {
3839
const { systemPrompt, personaId, images } = options;
3940

40-
const gooseSessionId = sessionTracker.getGooseSessionId(
41-
sessionId,
42-
personaId,
43-
);
41+
const gooseSessionId = sessionTracker.getGooseSessionId(sessionId, personaId);
4442
if (!gooseSessionId) {
4543
throw new Error("Session not prepared. Call acpPrepareSession first.");
4644
}
@@ -50,12 +48,10 @@ export async function acpSendMessage(
5048
? `<persona-instructions>\n${systemPrompt}\n</persona-instructions>\n\n<user-message>\n${prompt}\n</user-message>`
5149
: prompt;
5250

53-
const content: import("@agentclientprotocol/sdk").ContentBlock[] = [
54-
{ type: "text", text: effectivePrompt },
55-
];
51+
const content: ContentBlock[] = [{ type: "text", text: effectivePrompt }];
5652
if (images) {
5753
for (const [data, mimeType] of images) {
58-
content.push({ type: "image", data, mimeType } as any);
54+
content.push({ type: "image", data, mimeType } as ContentBlock);
5955
}
6056
}
6157

@@ -163,10 +159,7 @@ export async function acpCancelSession(
163159
sessionId: string,
164160
personaId?: string,
165161
): Promise<boolean> {
166-
const gooseSessionId = sessionTracker.getGooseSessionId(
167-
sessionId,
168-
personaId,
169-
);
162+
const gooseSessionId = sessionTracker.getGooseSessionId(sessionId, personaId);
170163
await directAcp.cancelSession(gooseSessionId ?? sessionId);
171164
return true;
172165
}

ui/goose2/src/shared/api/acpApi.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,40 @@ const DEPRECATED_PROVIDER_IDS = new Set(["claude-code", "codex", "gemini-cli"]);
2323
export async function listProviders(): Promise<AcpProvider[]> {
2424
const client = await getClient();
2525
const result = await client.goose.GooseProvidersList({});
26+
// biome-ignore lint/suspicious/noExplicitAny: ACP SDK types don't expose providers field
2627
return (result as any).providers
27-
.filter((p: any) => !DEPRECATED_PROVIDER_IDS.has(p.id))
28-
.map((p: any) => ({ id: p.id, label: p.label }));
28+
.filter(
29+
(p: { id: string; label: string }) => !DEPRECATED_PROVIDER_IDS.has(p.id),
30+
)
31+
.map((p: { id: string; label: string }) => ({ id: p.id, label: p.label }));
2932
}
3033

3134
export async function listSessions(): Promise<AcpSessionInfo[]> {
3235
const client = await getClient();
3336
// GooseClient.unstable_listSessions doesn't work with SDK 0.19 (renamed to listSessions).
3437
// Bypass GooseClient and call the connection directly. Fix when ui/acp is updated.
38+
// biome-ignore lint/suspicious/noExplicitAny: SDK doesn't expose conn property
3539
const conn = (client as any).conn;
3640
const response = await conn.listSessions({});
37-
return response.sessions.map((info: any) => ({
38-
sessionId: info.sessionId,
39-
title: info.title ?? null,
40-
updatedAt: info.updatedAt ?? null,
41-
messageCount: (info._meta?.messageCount as number) ?? 0,
42-
}));
41+
return response.sessions.map(
42+
(info: {
43+
sessionId: string;
44+
title?: string;
45+
updatedAt?: string;
46+
_meta?: Record<string, unknown>;
47+
}) => ({
48+
sessionId: info.sessionId,
49+
title: info.title ?? null,
50+
updatedAt: info.updatedAt ?? null,
51+
messageCount: (info._meta?.messageCount as number) ?? 0,
52+
}),
53+
);
4354
}
4455

4556
export async function exportSession(sessionId: string): Promise<string> {
4657
const client = await getClient();
4758
const result = await client.goose.GooseSessionExport({ sessionId });
59+
// biome-ignore lint/suspicious/noExplicitAny: SDK doesn't expose data field on export result
4860
return (result as any).data;
4961
}
5062

ui/goose2/src/shared/api/acpNotificationHandler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ function handleLive(
235235
...msg,
236236
content: msg.content.map((c) =>
237237
c.type === "toolRequest" && c.id === update.toolCallId
238-
? { ...c, name: update.title! }
238+
? { ...c, name: update.title ?? "" }
239239
: c,
240240
),
241241
}));
@@ -310,7 +310,8 @@ function handleShared(sessionId: string, update: SessionUpdate): void {
310310
};
311311
if ("options" in configUpdate && Array.isArray(configUpdate.options)) {
312312
const modelOption = configUpdate.options.find(
313-
(opt: any) => opt.category === "model",
313+
(opt: { category?: string; kind?: Record<string, unknown> }) =>
314+
opt.category === "model",
314315
);
315316
if (modelOption?.kind?.type === "select") {
316317
const select = modelOption.kind;
@@ -391,6 +392,7 @@ function findMessageWithToolCall(
391392
}
392393

393394
function extractToolResultText(update: {
395+
// biome-ignore lint/suspicious/noExplicitAny: ACP SDK ToolCallContent type is complex
394396
content?: Array<any> | null;
395397
rawOutput?: unknown;
396398
}): string {

0 commit comments

Comments
 (0)