forked from superset-sh/superset
-
Notifications
You must be signed in to change notification settings - Fork 1
upstream merge 2026-05-08 PR 11: agents API + onboarding #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ffd2386
feat(host-service): host agent configs (v2 PR 1, argv-array shape) (#…
Kitenite 0d6e5f7
feat(desktop): v2 agents at startup + in v2 new workspace modal (#4052)
Kitenite 8b037ae
feat(desktop): setup/teardown scripts editor for v2 projects (#4090)
Kitenite f9fee5b
feat(desktop): v2 onboarding setup flow (#4080)
AviPeltz 9414461
feat(desktop): allow skipping every onboarding step and the whole flo…
Kitenite 3d083e7
feat(mcp-v2): add agent spawn tools (agents_run + agents in workspace…
saddlepaddle 75dcf2d
feat(agents): launch Superset Chat sessions from desktop / CLI / SDK …
saddlepaddle ffb3b1d
fix: drop v2 task UI components that depend on later upstream PRs
MocA-Love fa03a49
fix(cli): drop agents/run command that references missing fork-foreig…
MocA-Love File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
606 changes: 606 additions & 0 deletions
606
apps/desktop/plans/done/20260504-1200-v2-onboarding-flow.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { execFile } from "node:child_process"; | ||
| import { promisify } from "node:util"; | ||
| import { publicProcedure, router } from ".."; | ||
|
|
||
| const execFileAsync = promisify(execFile); | ||
|
|
||
| const KNOWN_GH_PATHS = [ | ||
| "/opt/homebrew/bin/gh", | ||
| "/usr/local/bin/gh", | ||
| "/usr/bin/gh", | ||
| "/bin/gh", | ||
| ]; | ||
|
|
||
| interface GhDetectResult { | ||
| installed: boolean; | ||
| version: string | null; | ||
| path: string | null; | ||
| } | ||
|
|
||
| async function tryGh(path: string): Promise<GhDetectResult | null> { | ||
| try { | ||
| const { stdout } = await execFileAsync(path, ["--version"], { | ||
| timeout: 3000, | ||
| }); | ||
| const firstLine = stdout.split("\n")[0]?.trim() ?? ""; | ||
| const match = firstLine.match(/gh version (\S+)/); | ||
| const version = match?.[1] ?? null; | ||
| return { installed: true, version, path }; | ||
| } catch { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| async function detectGhCli(): Promise<GhDetectResult> { | ||
| for (const path of KNOWN_GH_PATHS) { | ||
| const result = await tryGh(path); | ||
| if (result) return result; | ||
| } | ||
| const result = await tryGh("gh"); | ||
| if (result) return result; | ||
| return { installed: false, version: null, path: null }; | ||
| } | ||
|
|
||
| export const createSystemRouter = () => { | ||
| return router({ | ||
| detectGhCli: publicProcedure.query(detectGhCli), | ||
| }); | ||
| }; | ||
|
|
||
| export type SystemRouter = ReturnType<typeof createSystemRouter>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export { AgentSelect } from "./AgentSelect"; | ||
| export { AgentSelect, type AgentSelectAgent } from "./AgentSelect"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { useV2AgentChoices } from "./useV2AgentChoices"; |
35 changes: 35 additions & 0 deletions
35
apps/desktop/src/renderer/hooks/useV2AgentChoices/useV2AgentChoices.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { useMemo } from "react"; | ||
| import type { AgentSelectAgent } from "renderer/components/AgentSelect"; | ||
| import { useV2AgentConfigs } from "renderer/hooks/useV2AgentConfigs"; | ||
|
|
||
| interface UseV2AgentChoicesResult { | ||
| agents: AgentSelectAgent[]; | ||
| isFetched: boolean; | ||
| } | ||
|
|
||
| const SUPERSET_AGENT: AgentSelectAgent = { | ||
| id: "superset", | ||
| label: "Superset", | ||
| iconId: "superset", | ||
| }; | ||
|
|
||
| // Superset chat isn't in the host's `host_agent_configs` table — it's | ||
| // routed by id inside `runAgentInWorkspace`. Append after the host's | ||
| // terminal rows so the user's preferred terminal agents stay on top. | ||
| export function useV2AgentChoices( | ||
| hostUrl: string | null, | ||
| ): UseV2AgentChoicesResult { | ||
| const query = useV2AgentConfigs(hostUrl); | ||
| const agents = useMemo<AgentSelectAgent[]>(() => { | ||
| const terminalAgents: AgentSelectAgent[] = (query.data ?? []).map( | ||
| (config) => ({ | ||
| id: config.id, | ||
| label: config.label, | ||
| iconId: config.presetId, | ||
| }), | ||
| ); | ||
| return [...terminalAgents, SUPERSET_AGENT]; | ||
| }, [query.data]); | ||
|
|
||
| return { agents, isFetched: query.isFetched }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export { | ||
| useV2AgentConfigs, | ||
| V2_AGENT_CONFIGS_QUERY_KEY, | ||
| } from "./useV2AgentConfigs"; |
27 changes: 27 additions & 0 deletions
27
apps/desktop/src/renderer/hooks/useV2AgentConfigs/useV2AgentConfigs.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { HostAgentConfigDto } from "@superset/host-service/settings"; | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { getHostServiceClientByUrl } from "renderer/lib/host-service-client"; | ||
|
|
||
| export const V2_AGENT_CONFIGS_QUERY_KEY = ["host-agent-configs"] as const; | ||
|
|
||
| /** | ||
| * Caller passes the host URL explicitly so this hook works for any host the | ||
| * user is targeting (local, remote-via-relay, or whatever the new-workspace | ||
| * modal has resolved). Cache is keyed on URL so distinct hosts don't share | ||
| * entries. Configs only change via Settings → Agents mutations that invalidate | ||
| * this key — `staleTime: Infinity` keeps the startup prefetch warm across | ||
| * navigation instead of every consumer refetching on mount. | ||
| */ | ||
| export function useV2AgentConfigs(hostUrl: string | null) { | ||
| return useQuery({ | ||
| queryKey: [...V2_AGENT_CONFIGS_QUERY_KEY, hostUrl] as const, | ||
| enabled: !!hostUrl, | ||
| queryFn: () => { | ||
| if (!hostUrl) return [] as HostAgentConfigDto[]; | ||
| return getHostServiceClientByUrl( | ||
| hostUrl, | ||
| ).settings.agentConfigs.list.query(); | ||
| }, | ||
| staleTime: Number.POSITIVE_INFINITY, | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
..._dashboard/components/DashboardSidebar/components/V2SetupScriptCard/V2SetupScriptCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { SidebarCard } from "@superset/ui/sidebar-card"; | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { useNavigate } from "@tanstack/react-router"; | ||
| import { AnimatePresence, motion } from "framer-motion"; | ||
| import { getHostServiceClientByUrl } from "renderer/lib/host-service-client"; | ||
| import { useV2SetupCardDismissalsStore } from "renderer/stores/v2-setup-card-dismissals"; | ||
|
|
||
| interface V2SetupScriptCardProps { | ||
| hostUrl: string; | ||
| projectId: string; | ||
| projectName: string; | ||
| isCollapsed?: boolean; | ||
| } | ||
|
|
||
| export function V2SetupScriptCard({ | ||
| hostUrl, | ||
| projectId, | ||
| projectName, | ||
| isCollapsed, | ||
| }: V2SetupScriptCardProps) { | ||
| const navigate = useNavigate(); | ||
| const isDismissed = useV2SetupCardDismissalsStore((s) => | ||
| s.isDismissed(projectId), | ||
| ); | ||
| const dismiss = useV2SetupCardDismissalsStore((s) => s.dismiss); | ||
|
|
||
| const { data: shouldShow } = useQuery({ | ||
| queryKey: ["host-config", "shouldShowSetupCard", hostUrl, projectId], | ||
| queryFn: () => | ||
| getHostServiceClientByUrl(hostUrl).config.shouldShowSetupCard.query({ | ||
| projectId, | ||
| }), | ||
| refetchOnWindowFocus: true, | ||
| }); | ||
|
|
||
| if (isCollapsed || isDismissed || !shouldShow) return null; | ||
|
|
||
| return ( | ||
| <AnimatePresence> | ||
| <motion.div | ||
| key={projectId} | ||
| initial={{ opacity: 0, y: 10 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| exit={{ opacity: 0, y: 10 }} | ||
| transition={{ duration: 0.2 }} | ||
| className="px-3 pb-2" | ||
| > | ||
| <SidebarCard | ||
| badge="Setup" | ||
| title="Setup scripts" | ||
| description={`Automate workspace setup for ${projectName}`} | ||
| actionLabel="Configure" | ||
| onAction={() => | ||
| navigate({ | ||
| to: "/settings/projects/$projectId", | ||
| params: { projectId }, | ||
| }) | ||
| } | ||
| onDismiss={() => dismiss(projectId)} | ||
| /> | ||
| </motion.div> | ||
| </AnimatePresence> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
...uthenticated/_dashboard/components/DashboardSidebar/components/V2SetupScriptCard/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { V2SetupScriptCard } from "./V2SetupScriptCard"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch introduces
SUPERSET_RESERVED_PORTSandport_base_is_safe, but the allocator loop still advances candidates only by checking whether the base is already used, never whether the[base, base+range)window contains reserved ports. As a result, allocations can still land on ranges containing 5000/5060/etc., so the new reserved-port logic is effectively dead code and the startup failures it targets remain possible.Useful? React with 👍 / 👎.