-
Notifications
You must be signed in to change notification settings - Fork 960
feat(agents): add agents list and demote presets to UI configuration #4097
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
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
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
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,36 @@ | ||
| import { boolean, CLIError, string, table } from "@superset/cli-framework"; | ||
| import { command } from "../../../lib/command"; | ||
| import { requireHostTarget, resolveHostTarget } from "../../../lib/host-target"; | ||
|
|
||
| export default command({ | ||
| description: "List agents configured on a host", | ||
| options: { | ||
| host: string().desc("Target host machineId"), | ||
| local: boolean().desc("Target this machine"), | ||
| }, | ||
| display: (data) => | ||
| table( | ||
| (data ?? []) as Record<string, unknown>[], | ||
| ["label", "presetId", "command", "id"], | ||
| ["LABEL", "PRESET", "COMMAND", "ID"], | ||
| ), | ||
| run: async ({ ctx, options }) => { | ||
| const organizationId = ctx.config.organizationId; | ||
| if (!organizationId) { | ||
| throw new CLIError("No active organization", "Run: superset auth login"); | ||
| } | ||
|
|
||
| const hostId = requireHostTarget({ | ||
| host: options.host ?? undefined, | ||
| local: options.local ?? undefined, | ||
| }); | ||
|
|
||
| const target = resolveHostTarget({ | ||
| requestedHostId: hostId, | ||
| organizationId, | ||
| userJwt: ctx.bearer, | ||
| }); | ||
|
|
||
| return target.client.settings.agentConfigs.list.query(); | ||
| }, | ||
| }); | ||
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,3 +1,3 @@ | ||
| export default { | ||
| description: "Run agents inside workspaces", | ||
| description: "Manage and run agents", | ||
| }; |
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.
--presets/listPresetsflag is absent — contradicts the PR objective.The PR description explicitly specifies that
superset agents list --presetsshould switch tosettings.agentConfigs.listPresetswith columnsLABEL | PRESET | COMMAND(noIDcolumn). The current implementation only exposessettings.agentConfigs.listand has no--presetsoption at all.The previous commit included a
--presetsflag but contained a bug where preset mode was inferred fromrows[0], which broke on empty results. The current commit resolves the bug by removing the feature entirely. If--presetsis intentionally deferred, please note it in the PR; otherwise the flag needs to be reinstated with the mode flag propagated explicitly fromruntodisplay.💡 Proposed fix to reinstate
--presetswith explicit mode propagationexport default command({ description: "List agents configured on a host", options: { host: string().desc("Target host machineId"), local: boolean().desc("Target this machine"), + presets: boolean().desc("List available agent presets"), }, - display: (data) => - table( - (data ?? []) as Record<string, unknown>[], - ["label", "presetId", "command", "id"], - ["LABEL", "PRESET", "COMMAND", "ID"], - ), + display: (data) => { + const payload = (data ?? { rows: [], isPresetMode: false }) as { + rows: Record<string, unknown>[]; + isPresetMode: boolean; + }; + return payload.isPresetMode + ? table(payload.rows, ["label", "presetId", "command"], ["LABEL", "PRESET", "COMMAND"]) + : table(payload.rows, ["label", "presetId", "command", "id"], ["LABEL", "PRESET", "COMMAND", "ID"]); + }, run: async ({ ctx, options }) => { // ... existing organizationId guard and host resolution ... - return target.client.settings.agentConfigs.list.query(); + if (options.presets) { + const rows = await target.client.settings.agentConfigs.listPresets.query(); + return { rows, isPresetMode: true }; + } + const rows = await target.client.settings.agentConfigs.list.query(); + return { rows, isPresetMode: false }; }, });📝 Committable suggestion
🤖 Prompt for AI Agents