mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: sdk subagent support
This commit is contained in:
@@ -54,13 +54,13 @@ export class SystemController extends BaseController {
|
||||
private async handleInitialize(
|
||||
payload: CLIControlInitializeRequest,
|
||||
): Promise<Record<string, unknown>> {
|
||||
// Register SDK MCP servers if provided
|
||||
this.context.config.setSdkMode(true);
|
||||
|
||||
if (payload.sdkMcpServers && typeof payload.sdkMcpServers === 'object') {
|
||||
for (const serverName of Object.keys(payload.sdkMcpServers)) {
|
||||
this.context.sdkMcpServers.add(serverName);
|
||||
}
|
||||
|
||||
// Add SDK MCP servers to config
|
||||
try {
|
||||
this.context.config.addMcpServers(payload.sdkMcpServers);
|
||||
if (this.context.debugMode) {
|
||||
@@ -78,7 +78,6 @@ export class SystemController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// Add MCP servers to config if provided
|
||||
if (payload.mcpServers && typeof payload.mcpServers === 'object') {
|
||||
try {
|
||||
this.context.config.addMcpServers(payload.mcpServers);
|
||||
@@ -94,10 +93,9 @@ export class SystemController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// Add session subagents to config if provided
|
||||
if (payload.agents && Array.isArray(payload.agents)) {
|
||||
try {
|
||||
this.context.config.addSessionSubagents(payload.agents);
|
||||
this.context.config.setSessionSubagents(payload.agents);
|
||||
|
||||
if (this.context.debugMode) {
|
||||
console.error(
|
||||
@@ -114,9 +112,6 @@ export class SystemController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// Set SDK mode to true after handling initialize
|
||||
this.context.config.setSdkMode(true);
|
||||
|
||||
// Build capabilities for response
|
||||
const capabilities = this.buildControlCapabilities();
|
||||
|
||||
|
||||
@@ -69,7 +69,10 @@ export function EditOptionsStep({
|
||||
if (selectedValue === 'editor') {
|
||||
// Launch editor directly
|
||||
try {
|
||||
await launchEditor(selectedAgent?.filePath);
|
||||
if (!selectedAgent.filePath) {
|
||||
throw new Error('Agent has no file path');
|
||||
}
|
||||
await launchEditor(selectedAgent.filePath);
|
||||
} catch (err) {
|
||||
setError(
|
||||
t('Failed to launch editor: {{error}}', {
|
||||
|
||||
@@ -267,7 +267,7 @@ export const AgentSelectionStep = ({
|
||||
<Box flexDirection="column" marginBottom={1}>
|
||||
<Text color={theme.text.primary} bold>
|
||||
{t('Project Level ({{path}})', {
|
||||
path: projectAgents[0].filePath.replace(/\/[^/]+$/, ''),
|
||||
path: projectAgents[0].filePath?.replace(/\/[^/]+$/, '') || '',
|
||||
})}
|
||||
</Text>
|
||||
<Box marginTop={1} flexDirection="column">
|
||||
@@ -289,7 +289,7 @@ export const AgentSelectionStep = ({
|
||||
>
|
||||
<Text color={theme.text.primary} bold>
|
||||
{t('User Level ({{path}})', {
|
||||
path: userAgents[0].filePath.replace(/\/[^/]+$/, ''),
|
||||
path: userAgents[0].filePath?.replace(/\/[^/]+$/, '') || '',
|
||||
})}
|
||||
</Text>
|
||||
<Box marginTop={1} flexDirection="column">
|
||||
|
||||
Reference in New Issue
Block a user