From bd0295b5e242fa0d7363d996b6e97f98dc48d2f6 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 11:08:59 +0000 Subject: [PATCH 1/7] feat(vscode): add calculated permissions display to agent details Show the resolved permission ruleset for each agent in the Agent Behaviour settings tab. The section is collapsed by default and expands to show an effective-action summary plus the full ordered rule table (last match wins). Changes: - Forward all agents (including subagents) with their CLI-calculated permission rulesets to the webview via a new allAgents field - Add collapsible PermissionRuleset component in ModeEditView - Show subagents in the Agent Behaviour agent list with a badge - Add PermissionRuleItem type mirroring the backend PermissionNext.Rule Ref: https://github.com/Kilo-Org/kilocode/issues/8331 --- packages/kilo-vscode/src/KiloProvider.ts | 22 ++- .../components/settings/AgentBehaviourTab.tsx | 19 +- .../src/components/settings/ModeEditView.tsx | 187 +++++++++++++++++- .../webview-ui/src/context/session.tsx | 4 + .../kilo-vscode/webview-ui/src/i18n/en.ts | 9 + .../webview-ui/src/types/messages.ts | 9 + 6 files changed, 235 insertions(+), 15 deletions(-) diff --git a/packages/kilo-vscode/src/KiloProvider.ts b/packages/kilo-vscode/src/KiloProvider.ts index 6888caf5d19..9a25e3e1b38 100644 --- a/packages/kilo-vscode/src/KiloProvider.ts +++ b/packages/kilo-vscode/src/KiloProvider.ts @@ -1623,17 +1623,21 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper const { visible, defaultAgent } = filterVisibleAgents(agents) + const mapAgent = (a: (typeof agents)[number]) => ({ + name: a.name, + displayName: a.displayName, + description: a.description, + mode: a.mode, + native: a.native, + color: a.color, + deprecated: a.deprecated, + permission: a.permission, + }) + const message = { type: "agentsLoaded", - agents: visible.map((a) => ({ - name: a.name, - displayName: a.displayName, - description: a.description, - mode: a.mode, - native: a.native, - color: a.color, - deprecated: a.deprecated, - })), + agents: visible.map(mapAgent), + allAgents: agents.map(mapAgent), defaultAgent, } this.cachedAgentsMessage = message diff --git a/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx b/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx index 5349789bae3..722021f8007 100644 --- a/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx @@ -82,7 +82,7 @@ const AgentBehaviourTab: Component = () => { }) const agentNames = createMemo(() => { - const names = session.agents().map((a) => a.name) + const names = session.allAgents().map((a) => a.name) // Also include any agents from config that might not be in the agent list const agents = Object.keys(config().agent ?? {}) for (const name of agents) { @@ -185,7 +185,7 @@ const AgentBehaviourTab: Component = () => { )) } - const removableModes = createMemo(() => session.agents().filter((a) => !a.native)) + const removableModes = createMemo(() => session.allAgents().filter((a) => !a.native)) const confirmRemoveMode = (agent: AgentInfo) => { dialog.show(() => ( @@ -354,7 +354,7 @@ const AgentBehaviourTab: Component = () => { {(name, index) => { - const agent = () => session.agents().find((a) => a.name === name) + const agent = () => session.allAgents().find((a) => a.name === name) const isCustom = () => !agent()?.native const agentCfg = () => config().agent?.[name] ?? {} const disabled = () => agentCfg().disable ?? false @@ -396,6 +396,19 @@ const AgentBehaviourTab: Component = () => { custom + + + {language.t("settings.agentBehaviour.badge.subagent")} + + = (props) => { // agent() may be undefined for modes that only exist in the config draft (just // created, not yet saved). This is fine — native defaults to false (correct for // custom modes) and all fields read from cfg() which comes from config context. - const agent = () => session.agents().find((a) => a.name === props.name) + const agent = () => session.allAgents().find((a) => a.name === props.name) const native = () => agent()?.native ?? false + const [expanded, setExpanded] = createSignal(false) const cfg = createMemo(() => config().agent?.[props.name] ?? {}) @@ -230,6 +231,11 @@ const ModeEditView: Component = (props) => { + {/* Calculated permissions (read-only, collapsible) */} + + setExpanded((v) => !v)} /> + +