mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-06 19:58:43 +02:00
fix: use runtime tools for approval auto-approval
- load runtime tools dynamically from Copilot CLI capabilities via tools.list - merge runtime tools with configured MCP and LSP tools in the approval catalog - keep a fallback builtin runtime tool list when capabilities are unavailable - move approval-tool pruning to the app service so dynamic tools are not dropped on load - update approval UI and docs to use the corrected runtime-tool model Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -275,6 +275,7 @@ export default function App() {
|
||||
lspProfiles={workspace.settings.tooling.lspProfiles}
|
||||
mcpServers={workspace.settings.tooling.mcpServers}
|
||||
toolingSettings={workspace.settings.tooling}
|
||||
runtimeTools={sidecarCapabilities?.runtimeTools}
|
||||
onJumpToMessage={jumpToMessage}
|
||||
onUpdateSessionTooling={(selection) => {
|
||||
void api.updateSessionTooling({
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import type {
|
||||
LspProfileDefinition,
|
||||
McpServerDefinition,
|
||||
RuntimeToolDefinition,
|
||||
SessionToolingSelection,
|
||||
WorkspaceToolingSettings,
|
||||
} from '@shared/domain/tooling';
|
||||
@@ -163,6 +164,7 @@ interface ActivityPanelProps {
|
||||
lspProfiles: LspProfileDefinition[];
|
||||
mcpServers: McpServerDefinition[];
|
||||
toolingSettings: WorkspaceToolingSettings;
|
||||
runtimeTools?: ReadonlyArray<RuntimeToolDefinition>;
|
||||
onJumpToMessage?: (messageId: string) => void;
|
||||
onUpdateSessionTooling: (selection: SessionToolingSelection) => void;
|
||||
onUpdateSessionApprovalSettings: (settings: { autoApprovedToolNames?: string[] }) => void;
|
||||
@@ -176,6 +178,7 @@ export function ActivityPanel({
|
||||
lspProfiles,
|
||||
mcpServers,
|
||||
toolingSettings,
|
||||
runtimeTools,
|
||||
onJumpToMessage,
|
||||
onUpdateSessionTooling,
|
||||
onUpdateSessionApprovalSettings,
|
||||
@@ -188,7 +191,10 @@ export function ActivityPanel({
|
||||
[activity, pattern.agents],
|
||||
);
|
||||
const selection = useMemo(() => resolveSessionToolingSelection(session), [session]);
|
||||
const approvalTools = useMemo(() => listApprovalToolDefinitions(toolingSettings), [toolingSettings]);
|
||||
const approvalTools = useMemo(
|
||||
() => listApprovalToolDefinitions(toolingSettings, runtimeTools),
|
||||
[runtimeTools, toolingSettings],
|
||||
);
|
||||
|
||||
const isOverridden = session.approvalSettings !== undefined;
|
||||
const effectiveAutoApproved = new Set(
|
||||
@@ -353,7 +359,7 @@ export function ActivityPanel({
|
||||
</p>
|
||||
) : approvalTools.length === 0 ? (
|
||||
<p className="text-[11px] leading-relaxed text-zinc-600">
|
||||
Add MCP servers or LSP profiles in Settings to configure tool auto-approvals.
|
||||
No approval-capable runtime tools are currently available.
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
@@ -478,7 +484,13 @@ function ApprovalOverrideRow({
|
||||
disabled: boolean;
|
||||
onToggle: () => void;
|
||||
}) {
|
||||
const kindBadge = tool.kind === 'lsp' ? 'LSP' : tool.kind === 'mcp' ? 'MCP' : 'Mixed';
|
||||
const kindBadge = tool.kind === 'builtin'
|
||||
? 'Built-in'
|
||||
: tool.kind === 'lsp'
|
||||
? 'LSP'
|
||||
: tool.kind === 'mcp'
|
||||
? 'MCP'
|
||||
: 'Mixed';
|
||||
return (
|
||||
<button
|
||||
className={`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition ${
|
||||
@@ -496,6 +508,11 @@ function ApprovalOverrideRow({
|
||||
{kindBadge}
|
||||
</span>
|
||||
</div>
|
||||
{(tool.description || tool.providerNames.length > 0) && (
|
||||
<div className="truncate text-[10px] text-zinc-600">
|
||||
{tool.description ?? tool.providerNames.join(', ')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<ToggleSwitch enabled={enabled} />
|
||||
</button>
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
import {
|
||||
listApprovalToolDefinitions,
|
||||
type ApprovalToolDefinition,
|
||||
type RuntimeToolDefinition,
|
||||
type WorkspaceToolingSettings,
|
||||
} from '@shared/domain/tooling';
|
||||
|
||||
@@ -42,6 +43,7 @@ interface PatternEditorProps {
|
||||
pattern: PatternDefinition;
|
||||
isBuiltin: boolean;
|
||||
toolingSettings: WorkspaceToolingSettings;
|
||||
runtimeTools?: ReadonlyArray<RuntimeToolDefinition>;
|
||||
onChange: (pattern: PatternDefinition) => void;
|
||||
onDelete?: () => void;
|
||||
onSave: () => void;
|
||||
@@ -209,6 +211,7 @@ export function PatternEditor({
|
||||
pattern,
|
||||
isBuiltin,
|
||||
toolingSettings,
|
||||
runtimeTools,
|
||||
onChange,
|
||||
onDelete,
|
||||
onSave,
|
||||
@@ -262,7 +265,7 @@ export function PatternEditor({
|
||||
});
|
||||
}
|
||||
|
||||
const approvalTools = listApprovalToolDefinitions(toolingSettings);
|
||||
const approvalTools = listApprovalToolDefinitions(toolingSettings, runtimeTools);
|
||||
const autoApprovedSet = new Set(pattern.approvalPolicy?.autoApprovedToolNames ?? []);
|
||||
|
||||
function toggleToolAutoApproval(toolId: string) {
|
||||
@@ -568,7 +571,7 @@ export function PatternEditor({
|
||||
<div className="rounded-xl border border-zinc-800 bg-zinc-900/50 px-4 py-3">
|
||||
{approvalTools.length === 0 ? (
|
||||
<p className="py-2 text-center text-[11px] text-zinc-600">
|
||||
No tools available. Add MCP servers or LSP profiles in Settings to configure auto-approvals.
|
||||
No approval-capable runtime tools are currently available.
|
||||
</p>
|
||||
) : (
|
||||
<div className="space-y-0.5">
|
||||
@@ -719,7 +722,13 @@ function ToolApprovalToggleRow({
|
||||
enabled: boolean;
|
||||
onToggle: () => void;
|
||||
}) {
|
||||
const kindBadge = tool.kind === 'lsp' ? 'LSP' : tool.kind === 'mcp' ? 'MCP' : 'Mixed';
|
||||
const kindBadge = tool.kind === 'builtin'
|
||||
? 'Built-in'
|
||||
: tool.kind === 'lsp'
|
||||
? 'LSP'
|
||||
: tool.kind === 'mcp'
|
||||
? 'MCP'
|
||||
: 'Mixed';
|
||||
return (
|
||||
<button
|
||||
className="flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition hover:bg-zinc-800/60"
|
||||
@@ -733,11 +742,13 @@ function ToolApprovalToggleRow({
|
||||
{kindBadge}
|
||||
</span>
|
||||
</div>
|
||||
{tool.providerNames.length > 0 && (
|
||||
<div className="truncate text-[10px] text-zinc-600">{tool.providerNames.join(', ')}</div>
|
||||
{(tool.description || tool.providerNames.length > 0) && (
|
||||
<div className="truncate text-[10px] text-zinc-600">
|
||||
{tool.description ?? tool.providerNames.join(', ')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<ToggleSwitch enabled={enabled} onToggle={onToggle} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ export function SettingsPanel({
|
||||
setEditingPattern(null);
|
||||
}}
|
||||
pattern={editingPattern}
|
||||
runtimeTools={sidecarCapabilities?.runtimeTools}
|
||||
toolingSettings={toolingSettings}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user