Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
refactor(linear): keep workspace API types inside channel
chengyongru2dac0d330ca4
diff --git a/nanobot/channels/linear/webui/LinearPanel.tsx b/nanobot/channels/linear/webui/LinearPanel.tsxindex 15b66c53e..a9f4a8171 100644--- a/nanobot/channels/linear/webui/LinearPanel.tsx+++ b/nanobot/channels/linear/webui/LinearPanel.tsx@@ -29,11 +29,12 @@ import {} from "@/components/ui/alert-dialog";import { channelValidationStatusClass } from "@/components/settings/channels/ChannelValidationProgress";import { useAutoSave } from "@/components/settings/shared/useAutoSave";-import { configureChannel, disableNanobotFeature, startChannelConnect } from "@/lib/api";-import type { ChannelInstallationSummary } from "@/lib/types";+import { configureChannel, disableNanobotFeature } from "@/lib/api";import { cn } from "@/lib/utils";import { useClient } from "@/providers/ClientProvider";+import { manageLinearWorkspace } from "./api";+import type { LinearInstallationSummary } from "./types";import { LinearConnectFlow } from "./LinearConnectFlow";import { linearManifestUrl } from "./manifest";@@ -75,7 +76,7 @@ export function LinearPanel({const [notice, setNotice] = useState<string | null>(null);const [saved, setSaved] = useState(false);const [publicUrlPromptOpen, setPublicUrlPromptOpen] = useState(false);- const [installations, setInstallations] = useState<ChannelInstallationSummary[]>([]);+ const [installations, setInstallations] = useState<LinearInstallationSummary[]>([]);const [loadingInstallations, setLoadingInstallations] = useState(false);const [disconnectingId, setDisconnectingId] = useState<string | null>(null);const [disconnectConfirmId, setDisconnectConfirmId] = useState<string | null>(null);@@ -122,7 +123,7 @@ export function LinearPanel({setWorkspaceNotice(null);setWorkspaceError(null);try {- const payload = await startChannelConnect(client, "linear", { operation: "inspect" });+ const payload = await manageLinearWorkspace(client, { operation: "inspect" });setInstallations(payload.installations ?? []);} catch (err) {setWorkspaceError((err as Error).message);@@ -135,12 +136,12 @@ export function LinearPanel({if (feature.runtime_status === "running") void loadInstallations();}, [feature.runtime_status, loadInstallations]);- const disconnectWorkspace = async (installation: ChannelInstallationSummary) => {+ const disconnectWorkspace = async (installation: LinearInstallationSummary) => {setDisconnectingId(installation.organization_id);setWorkspaceNotice(null);setWorkspaceError(null);try {- const payload = await startChannelConnect(client, "linear", {+ const payload = await manageLinearWorkspace(client, {operation: "disconnect",organization_id: installation.organization_id,});diff --git a/nanobot/channels/linear/webui/api.ts b/nanobot/channels/linear/webui/api.tsnew file mode 100644index 000000000..c448cfe42--- /dev/null+++ b/nanobot/channels/linear/webui/api.ts@@ -0,0 +1,10 @@+import { startChannelConnect, type WebUIMutationTransport } from "@/lib/api";++import type { LinearWorkspacePayload } from "./types";++export function manageLinearWorkspace(+ transport: WebUIMutationTransport,+ params: { operation: "inspect" } | { operation: "disconnect"; organization_id: string },+): Promise<LinearWorkspacePayload> {+ return startChannelConnect<LinearWorkspacePayload>(transport, "linear", params);+}diff --git a/nanobot/channels/linear/webui/types.ts b/nanobot/channels/linear/webui/types.tsnew file mode 100644index 000000000..492bb9ad6--- /dev/null+++ b/nanobot/channels/linear/webui/types.ts@@ -0,0 +1,17 @@+export interface LinearInstallationSummary {+ organization_id: string;+ organization_name?: string;+ scopes?: string[];+ authorization_status?: "authorized" | "refresh_required" | "missing_scopes";+ missing_scopes?: string[];+}++export interface LinearWorkspacePayload {+ session_id: string;+ status: "inspected" | "disconnected";+ message?: string;+ organization_id?: string;+ installations: LinearInstallationSummary[];+ webhook_url?: string;+ redirect_uri?: string;+}diff --git a/webui/src/lib/api.ts b/webui/src/lib/api.tsindex 6f136900e..eedb201f8 100644--- a/webui/src/lib/api.ts+++ b/webui/src/lib/api.ts@@ -815,12 +815,12 @@ export async function runPairingAction(return mutation<PairingPayload>(transport, `settings.pairing.${action}`, { code });}-export async function startChannelConnect(+export async function startChannelConnect<T = ChannelConnectPayload>(transport: WebUIMutationTransport,channel: string,params: Readonly<Record<string, string | boolean>> = {},-): Promise<ChannelConnectPayload> {- return mutation<ChannelConnectPayload>(+): Promise<T> {+ return mutation<T>(transport,"settings.channel.connect.start",{diff --git a/webui/src/lib/types.ts b/webui/src/lib/types.tsindex 7266c126d..912f2725e 100644--- a/webui/src/lib/types.ts+++ b/webui/src/lib/types.ts@@ -1212,22 +1212,7 @@ export interface McpPresetsPayload {};}-type ChannelConnectStatus =- | "pending"- | "succeeded"- | "expired"- | "cancelled"- | "failed"- | "inspected"- | "disconnected";--export interface ChannelInstallationSummary {- organization_id: string;- organization_name?: string;- scopes?: string[];- authorization_status?: "authorized" | "refresh_required" | "missing_scopes";- missing_scopes?: string[];-}+type ChannelConnectStatus = "pending" | "succeeded" | "expired" | "cancelled" | "failed";export interface ChannelConnectPayload {session_id: string;@@ -1237,11 +1222,6 @@ export interface ChannelConnectPayload {qr_url?: string;interval_ms?: number;expires_at_ms?: number;- organization_id?: string;- organization_name?: string;- installations?: ChannelInstallationSummary[];- webhook_url?: string;- redirect_uri?: string;nanobot_features?: NanobotFeaturesPayload;}