From ca184461e7cd811dd44cf3da8315cf070a1330b5 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 17 Oct 2025 12:08:00 -0700 Subject: [PATCH] fix: type errors --- core/control-plane/client.ts | 49 ++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 124128681..068434c08 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -55,6 +55,39 @@ export interface RemoteSessionMetadata extends BaseSessionMetadata { remoteId: string; } +export interface AgentSessionMetadata { + createdBy: string; + github_repo: string; + organizationId?: string; + idempotencyKey?: string; + source?: string; + continueApiKeyId?: string; + s3Url?: string; + prompt?: string | null; + createdBySlug?: string; +} + +export interface AgentSessionView { + id: string; + devboxId: string | null; + name: string | null; + icon: string | null; + status: string; + agentStatus: string | null; + unread: boolean; + state: string; + metadata: AgentSessionMetadata; + repoUrl: string; + branch: string | null; + pullRequestUrl: string | null; + pullRequestStatus: string | null; + tunnelUrl: string | null; + createdAt: string; + updatedAt: string; + create_time_ms: string; + end_time_ms: string; +} + export class ControlPlaneClient { constructor( readonly sessionInfoPromise: Promise, @@ -546,23 +579,19 @@ export class ControlPlaneClient { }); const result = (await resp.json()) as { - agents: any[]; + agents: AgentSessionView[]; totalCount: number; }; return { - agents: result.agents.map((agent: any) => ({ + agents: result.agents.map((agent) => ({ id: agent.id, - name: agent.name || agent.metadata?.name || null, + name: agent.name, status: agent.status, - repoUrl: agent.metadata?.repo_url || agent.repo_url || "", - createdAt: - agent.created_at || agent.create_time_ms - ? new Date(agent.created_at || agent.create_time_ms).toISOString() - : new Date().toISOString(), + repoUrl: agent.repoUrl, + createdAt: agent.createdAt, metadata: { - github_repo: - agent.metadata?.github_repo || agent.metadata?.repo_url, + github_repo: agent.metadata.github_repo, }, })), totalCount: result.totalCount,