Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

refactor(web): import types from @alook/shared directly, remove aliases

Gener7a0471af81de
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/chat/page.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/chat/page.tsx
index afc3d4d32..c61e632ff 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/chat/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/chat/page.tsx
@@ -12,8 +12,7 @@ import {
getTask,
getTaskMessages,
} from "@/lib/api";
-import type { Conversation, Message, TaskMessage } from "@alook/shared";
-import type { Task } from "@/lib/api";
+import type { Conversation, Message, TaskApi as Task, TaskMessage } from "@alook/shared";
import { toast } from "sonner";
import { cn } from "@/lib/utils";
import { Skeleton } from "@/components/ui/skeleton";
diff --git a/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx b/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
index 06e5058d9..8a02eca9a 100644
--- a/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
@@ -24,7 +24,7 @@ import { ConfirmDialog } from "@/components/ui/confirm-dialog";
import { toast } from "sonner";
import { Skeleton } from "@/components/ui/skeleton";
import { Monitor, Plus } from "lucide-react";
-import type { Runtime } from "@/lib/api";
+import type { AgentRuntime as Runtime } from "@alook/shared";
import { CLI_CMD } from "@/lib/utils";
function ConnectMachineSteps({
diff --git a/src/web/src/components/agent-edit-form.tsx b/src/web/src/components/agent-edit-form.tsx
index 2308f5212..84452c577 100644
--- a/src/web/src/components/agent-edit-form.tsx
+++ b/src/web/src/components/agent-edit-form.tsx
@@ -8,7 +8,7 @@ import { Textarea } from "@/components/ui/textarea";
import { RuntimeSelect } from "@/components/runtime-select";
import type { Agent } from "@alook/shared";
import { isValidHandle } from "@alook/shared";
-import type { Runtime } from "@/lib/api";
+import type { AgentRuntime as Runtime } from "@alook/shared";
import { cn } from "@/lib/utils";
function nameToHandle(name: string): string {
diff --git a/src/web/src/components/dashboard-navbar.tsx b/src/web/src/components/dashboard-navbar.tsx
index 6318bca92..3bc7b3dcb 100644
--- a/src/web/src/components/dashboard-navbar.tsx
+++ b/src/web/src/components/dashboard-navbar.tsx
@@ -21,7 +21,7 @@ import {
import { ConfirmDialog } from "@/components/ui/confirm-dialog";
import { Logo } from "@/components/logo";
import { toast } from "sonner";
-import type { Runtime } from "@/lib/api";
+import type { AgentRuntime as Runtime } from "@alook/shared";
import { signOut } from "@/lib/auth-client";
import { CLI_CMD } from "@/lib/utils";
diff --git a/src/web/src/components/runtime-select.tsx b/src/web/src/components/runtime-select.tsx
index ce5027f47..75f271e35 100644
--- a/src/web/src/components/runtime-select.tsx
+++ b/src/web/src/components/runtime-select.tsx
@@ -1,6 +1,6 @@
"use client";
-import type { Runtime } from "@/lib/api";
+import type { AgentRuntime as Runtime } from "@alook/shared";
import {
Select,
SelectTrigger,
diff --git a/src/web/src/components/task-stream.tsx b/src/web/src/components/task-stream.tsx
index 052f64456..b07c27907 100644
--- a/src/web/src/components/task-stream.tsx
+++ b/src/web/src/components/task-stream.tsx
@@ -4,7 +4,7 @@ import { useMemo, useRef, useEffect } from "react";
import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils";
import type { TaskMessage } from "@alook/shared";
-import type { Task } from "@/lib/api";
+import type { TaskApi as Task } from "@alook/shared";
import {
ChevronRight,
Brain,
diff --git a/src/web/src/contexts/agent-context.tsx b/src/web/src/contexts/agent-context.tsx
index 64fb0474f..af0fcc8bc 100644
--- a/src/web/src/contexts/agent-context.tsx
+++ b/src/web/src/contexts/agent-context.tsx
@@ -17,8 +17,8 @@ import {
deleteAgent,
createMachineToken,
deleteMachine,
- type Runtime,
} from "@/lib/api";
+import type { AgentRuntime as Runtime } from "@alook/shared";
import { toast } from "sonner";
import type {
Agent,
diff --git a/src/web/src/lib/api.ts b/src/web/src/lib/api.ts
index f42a19fcb..76bd5490c 100644
--- a/src/web/src/lib/api.ts
+++ b/src/web/src/lib/api.ts
@@ -14,10 +14,6 @@ import type {
} from "@alook/shared";
import { ApiError } from "@/lib/errors";
-// Re-export AgentRuntime as Runtime for convenience
-export type Runtime = AgentRuntime;
-export type Task = TaskApi;
-
const API_BASE = "";
async function apiFetch<T>(path: string, options?: RequestInit): Promise<T> {
@@ -118,7 +114,7 @@ export const deleteAgent = (id: string, workspaceId: string) =>
// Runtimes
export const listRuntimes = (workspaceId: string) =>
- apiFetch<Runtime[]>(`/api/runtimes${wsQuery(workspaceId)}`);
+ apiFetch<AgentRuntime[]>(`/api/runtimes${wsQuery(workspaceId)}`);
export const deleteMachine = (daemonId: string, workspaceId: string) =>
apiFetch<void>(
@@ -165,7 +161,7 @@ export const listMessages = (
};
export const sendMessage = (conversationId: string, content: string, workspaceId: string) =>
- apiFetch<{ message: Message; task: Task }>(
+ apiFetch<{ message: Message; task: TaskApi }>(
`/api/conversations/${conversationId}/messages${wsQuery(workspaceId)}`,
{
method: "POST",
@@ -185,7 +181,7 @@ export const createMachineToken = (name?: string, workspaceId?: string) =>
// Tasks (polling)
export const getTask = (id: string, workspaceId: string) =>
- apiFetch<Task>(`/api/tasks/${id}${wsQuery(workspaceId)}`);
+ apiFetch<TaskApi>(`/api/tasks/${id}${wsQuery(workspaceId)}`);
export const getTaskMessages = (id: string, workspaceId: string, since?: number) =>
apiFetch<TaskMessage[]>(