feat(core): subagent local execution and tool isolation (#22718)

This commit is contained in:
AK
2026-03-17 19:34:44 -07:00
committed by GitHub
parent bd34a42ec3
commit 7bfe6ac418
7 changed files with 222 additions and 56 deletions
@@ -7,6 +7,8 @@
import type { GeminiClient } from '../core/client.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import type { ToolRegistry } from '../tools/tool-registry.js';
import type { PromptRegistry } from '../prompts/prompt-registry.js';
import type { ResourceRegistry } from '../resources/resource-registry.js';
import type { SandboxManager } from '../services/sandboxManager.js';
import type { Config } from './config.js';
@@ -24,6 +26,12 @@ export interface AgentLoopContext {
/** The registry of tools available to the agent in this context. */
readonly toolRegistry: ToolRegistry;
/** The registry of prompts available to the agent in this context. */
readonly promptRegistry: PromptRegistry;
/** The registry of resources available to the agent in this context. */
readonly resourceRegistry: ResourceRegistry;
/** The bus for user confirmations and messages in this context. */
readonly messageBus: MessageBus;
+22 -6
View File
@@ -660,8 +660,8 @@ export class Config implements McpContext, AgentLoopContext {
private allowedEnvironmentVariables: string[];
private blockedEnvironmentVariables: string[];
private readonly enableEnvironmentVariableRedaction: boolean;
private promptRegistry!: PromptRegistry;
private resourceRegistry!: ResourceRegistry;
private _promptRegistry!: PromptRegistry;
private _resourceRegistry!: ResourceRegistry;
private agentRegistry!: AgentRegistry;
private readonly acknowledgedAgentsService: AcknowledgedAgentsService;
private skillManager!: SkillManager;
@@ -1245,8 +1245,8 @@ export class Config implements McpContext, AgentLoopContext {
if (this.getCheckpointingEnabled()) {
await this.getGitService();
}
this.promptRegistry = new PromptRegistry();
this.resourceRegistry = new ResourceRegistry();
this._promptRegistry = new PromptRegistry();
this._resourceRegistry = new ResourceRegistry();
this.agentRegistry = new AgentRegistry(this);
await this.agentRegistry.initialize();
@@ -1482,6 +1482,22 @@ export class Config implements McpContext, AgentLoopContext {
return this._toolRegistry;
}
/**
* @deprecated Do not access directly on Config.
* Use the injected AgentLoopContext instead.
*/
get promptRegistry(): PromptRegistry {
return this._promptRegistry;
}
/**
* @deprecated Do not access directly on Config.
* Use the injected AgentLoopContext instead.
*/
get resourceRegistry(): ResourceRegistry {
return this._resourceRegistry;
}
/**
* @deprecated Do not access directly on Config.
* Use the injected AgentLoopContext instead.
@@ -1794,7 +1810,7 @@ export class Config implements McpContext, AgentLoopContext {
}
getPromptRegistry(): PromptRegistry {
return this.promptRegistry;
return this._promptRegistry;
}
getSkillManager(): SkillManager {
@@ -1802,7 +1818,7 @@ export class Config implements McpContext, AgentLoopContext {
}
getResourceRegistry(): ResourceRegistry {
return this.resourceRegistry;
return this._resourceRegistry;
}
getDebugMode(): boolean {