Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
103bef3
feat(vscode): add agent autonomy presets
marius-kilocode Apr 30, 2026
5d9ed1c
Merge branch 'main' into feat-hitl-onboarding-preferences
imanolmzd-svg Jun 9, 2026
d13041d
feat(work-style): simplify onboarding state to use config-only persis…
imanolmzd-svg Jun 9, 2026
97d5deb
chore: update kilo-vscode visual regression baselines
github-actions[bot] Jun 9, 2026
cfc597d
feat(work-style): refine onboarding preferences
imanolmzd-svg Jun 11, 2026
6058ac5
feat(webview): re-request work style on extensionDataReady if still l…
imanolmzd-svg Jun 11, 2026
105e406
Merge branch 'main' into feat-hitl-onboarding-preferences
imanolmzd-svg Jun 11, 2026
1629daf
chore: update kilo-vscode visual regression baselines
github-actions[bot] Jun 11, 2026
ec7a5ff
feat(work-style): improve onboarding flow
imanolmzd-svg Jun 11, 2026
414fb28
chore: update kilo-vscode visual regression baselines
github-actions[bot] Jun 11, 2026
e9f101a
refactor(onboarding): extract work style display logic into pure stat…
imanolmzd-svg Jun 11, 2026
a165a83
style(welcome): widen responsive breakpoint for work-style empty state
imanolmzd-svg Jun 11, 2026
670777e
fix(vscode): make work style onboarding updates reliable
imanolmzd-svg Jun 12, 2026
80a45bf
Merge branch 'main' into feat-hitl-onboarding-preferences
imanolmzd-svg Jun 12, 2026
740155a
fix(work-style): remove duplicate payload post after apply handler
imanolmzd-svg Jun 12, 2026
5004060
refactor(onboarding): relocate settings access from toast into picker…
imanolmzd-svg Jun 12, 2026
a99c498
chore: update kilo-vscode visual regression baselines
github-actions[bot] Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hitl-onboarding-preferences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": minor
---

Support choosing an agent autonomy preset during VS Code onboarding.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions packages/kilo-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,24 @@
"default": true,
"description": "Show the task timeline graph in the chat header"
},
"kilo-code.new.agentWorkStyle": {
"type": "string",
"scope": "application",
"default": "unset",
"enum": [
"unset",
"human",
"autonomous",
"skipped"
],
"enumDescriptions": [
"Show work style onboarding so you can choose again",
Comment thread
imanolmzd-svg marked this conversation as resolved.
Resolved
"Human in the Loop: review agent actions as they happen",
"High autonomy: let Kilo take most actions with fewer interruptions",
"Onboarding was skipped without changing work style settings"
],
"description": "Preferred agent work style. Set to Unset to show the onboarding flow again."
},
"kilo-code.new.diff.renderMarkdown": {
"type": "boolean",
"default": false,
Expand Down
23 changes: 22 additions & 1 deletion packages/kilo-vscode/src/KiloProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
sessionToWebview,
indexProvidersById,
filterVisibleAgents,
buildSettingPath,
mapSSEEventToWebviewMessage,
getErrorMessage,
getConfigErrorDetails,
Expand All @@ -41,6 +40,7 @@ import {
resolveWorkspaceDirectory,
sameDirectory,
SessionStreamScheduler,
buildSettingPath,
type SessionRefreshContext,
} from "./kilo-provider-utils"
import { GitOps } from "./agent-manager/GitOps"
Expand Down Expand Up @@ -78,6 +78,12 @@ import { routeEarlyMessage } from "./kilo-provider/early-message"
import * as ModelState from "./kilo-provider/model-state"
import { handleForkSession } from "./kilo-provider/fork-session"
import { openConfig } from "./kilo-provider/open-config"
import {
getWorkStylePayload,
handleWorkStyleMessage,
isWorkStyleSetting,
watchWorkStyleConfig,
} from "./kilo-provider/work-style"
import * as McpOAuth from "./kilo-provider/mcp-oauth"
import { retryable, backoff, MAX_RETRIES } from "./util/retry"
import { hasGit } from "./kilo-provider/git-status"
Expand Down Expand Up @@ -659,6 +665,14 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
return
}
if (this.handleEditorOpenMessage(message)) return
if (
await handleWorkStyleMessage({
message,
connection: this.connectionService,
post: (msg) => this.postMessage(msg),
})
)
return
if (
await handleSidebarWorktreeMessage(message, {
post: (msg) => this.postMessage(msg),
Expand Down Expand Up @@ -1117,6 +1131,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
}
})
this.webviewMessageDisposable = watchFontSizeConfig((msg) => this.postMessage(msg), this.webviewMessageDisposable)
this.webviewMessageDisposable = watchWorkStyleConfig((msg) => this.postMessage(msg), this.webviewMessageDisposable)
}

private handleEditorOpenMessage(message: Parameters<typeof handleEditorAction>[0]): boolean {
Expand Down Expand Up @@ -2234,6 +2249,10 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
})
}

private sendWorkStyle(): void {
this.postMessage(getWorkStylePayload())
}

/** Returns the number of sessions currently in "busy" state. */
private getBusySessionCount(): number {
return getBusySessionCount(this.sessionStatusMap)
Expand Down Expand Up @@ -2775,6 +2794,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
// lets the runtime fall back to the resolved default.
const next = value === null ? undefined : value
await config.update(leaf, next, vscode.ConfigurationTarget.Global)
if (isWorkStyleSetting(key)) this.sendWorkStyle()
}

/**
Expand Down Expand Up @@ -2817,6 +2837,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
this.sendBrowserSettings()
this.sendNotificationSettings()
this.sendTimelineSetting()
this.sendWorkStyle()
await ModelState.reset(this.client, (msg) => this.postMessage(msg))

// Re-send globalState items to the webview
Expand Down
98 changes: 98 additions & 0 deletions packages/kilo-vscode/src/kilo-provider/work-style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import * as vscode from "vscode"
import type { KiloConnectionService } from "../services/cli-backend/connection-service"
import { getInitialWorkStyle, type WorkStyleSettings, type WorkStyleState } from "../shared/work-style-presets"

export const WORK_STYLE_SETTING_KEYS = ["showTaskTimeline"] as const

function getConfig() {
return vscode.workspace.getConfiguration("kilo-code.new")
}

function isWorkStyleConfigured(): boolean {
return getConfig().inspect<WorkStyleState>("agentWorkStyle")?.globalValue !== undefined
}

export function getWorkStylePayload() {
const config = getConfig()
const inspect = (key: (typeof WORK_STYLE_SETTING_KEYS)[number]) => config.inspect(key)
const defaults = Object.fromEntries(
WORK_STYLE_SETTING_KEYS.map((key) => {
const info = inspect(key)
const customized =
info?.globalValue !== undefined ||
info?.workspaceValue !== undefined ||
info?.workspaceFolderValue !== undefined
return [key, !customized]
}),
) as Record<keyof WorkStyleSettings, boolean>

return {
type: "workStyleLoaded" as const,
style: config.get<WorkStyleState>("agentWorkStyle", "unset"),
defaults,
}
}

export function isWorkStyleSetting(key: string): boolean {
return WORK_STYLE_SETTING_KEYS.includes(key as (typeof WORK_STYLE_SETTING_KEYS)[number]) || key === "agentWorkStyle"
}

export function watchWorkStyleConfig(post: (message: unknown) => void, next?: vscode.Disposable) {
const keys = ["agentWorkStyle", ...WORK_STYLE_SETTING_KEYS]
const watcher = vscode.workspace.onDidChangeConfiguration((event) => {
if (keys.some((key) => event.affectsConfiguration(`kilo-code.new.${key}`))) post(getWorkStylePayload())
})
return next ? vscode.Disposable.from(watcher, next) : watcher
}

export async function setWorkStyle(style: WorkStyleState) {
await getConfig().update("agentWorkStyle", style, vscode.ConfigurationTarget.Global)
}

async function hasAnySession(connection: KiloConnectionService): Promise<boolean> {
const client = await connection.getClientAsync()
const { data } = await client.experimental.session.list(
{
roots: true,
limit: 1,
archived: true,
},
{ throwOnError: true },
)
return data.length > 0
}

async function initializeWorkStyle(connection: KiloConnectionService): Promise<void> {
if (isWorkStyleConfigured()) return

const hasSessions = await hasAnySession(connection)

if (isWorkStyleConfigured()) return
await setWorkStyle(getInitialWorkStyle(hasSessions))
}

export async function handleWorkStyleMessage(input: {
message: { type?: string; style?: WorkStyleState }
connection: KiloConnectionService
post: (message: unknown) => void
}): Promise<boolean> {
if (input.message.type === "requestWorkStyle") {
const initialized = await initializeWorkStyle(input.connection)
.then(() => true)
.catch((err: unknown) => {
console.error("[Kilo New] Failed to initialize work style:", err)
return false
})
const payload = getWorkStylePayload()
input.post(initialized ? payload : { ...payload, style: "skipped" })
return true
}
if (input.message.type !== "setWorkStyle") return false
if (!input.message.style) {
console.error("[Kilo New] Missing style in setWorkStyle message")
return true
}
await setWorkStyle(input.message.style)
input.post(getWorkStylePayload())
return true
}
160 changes: 160 additions & 0 deletions packages/kilo-vscode/src/shared/work-style-presets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
type PermissionLevel = "allow" | "ask" | "deny"
type PermissionRule = PermissionLevel | null | Record<string, PermissionLevel | null>
type PermissionConfig = Partial<Record<string, PermissionRule>>

export interface WorkStyleConfig {
permission?: PermissionConfig
terminal_command_display?: "expanded" | "collapsed"
auto_collapse_reasoning?: boolean
}

export type WorkStyle = "human" | "autonomous"
export type WorkStyleState = WorkStyle | "skipped" | "unset"

export interface WorkStyleSettings {
showTaskTimeline: boolean
}

export interface WorkStylePreset {
style: WorkStyle
config: WorkStyleConfig
settings: WorkStyleSettings
}

export interface WorkStyleApplyPlan {
config: WorkStyleConfig
settings: Partial<WorkStyleSettings>
}

const BASH: Record<string, PermissionLevel> = {
"*": "ask",
"cat *": "allow",
"head *": "allow",
"tail *": "allow",
"less *": "allow",
"ls *": "allow",
"tree *": "allow",
"pwd *": "allow",
"echo *": "allow",
"wc *": "allow",
"which *": "allow",
"type *": "allow",
"file *": "allow",
"diff *": "allow",
"du *": "allow",
"df *": "allow",
"date *": "allow",
"uname *": "allow",
"whoami *": "allow",
"printenv *": "allow",
"man *": "allow",
"grep *": "allow",
"rg *": "allow",
"ag *": "allow",
"uniq *": "allow",
"cut *": "allow",
"tr *": "allow",
"jq *": "allow",
"*>*": "ask",
}

export const WORK_STYLE_CHOICES: WorkStyle[] = ["human", "autonomous"]
Comment thread
imanolmzd-svg marked this conversation as resolved.
Resolved

export const WORK_STYLE_PRESETS: Record<WorkStyle, WorkStylePreset> = {
human: {
style: "human",
config: {
terminal_command_display: "expanded",
auto_collapse_reasoning: false,
permission: {
"*": "ask",
read: {
"*": "allow",
"*.env": "ask",
"*.env.*": "ask",
"*.env.example": "allow",
},
grep: "allow",
glob: "allow",
list: "allow",
question: "allow",
webfetch: "allow",
websearch: "allow",
codesearch: "allow",
external_directory: "ask",
edit: "ask",
bash: BASH,
doom_loop: "ask",
},
},
settings: {
showTaskTimeline: true,
},
},
autonomous: {
style: "autonomous",
config: {
terminal_command_display: "collapsed",
auto_collapse_reasoning: true,
},
settings: {
showTaskTimeline: false,
},
},
}

export function getWorkStylePreset(style: WorkStyle): WorkStylePreset {
return WORK_STYLE_PRESETS[style]
}

export function getInitialWorkStyle(hasSessions: boolean): WorkStyleState {
return hasSessions ? "skipped" : "unset"
}

export function hasPermissionConfig(config: WorkStyleConfig): boolean {
return Object.keys(config.permission ?? {}).length > 0
}

function stripPermission(config: PermissionConfig): PermissionConfig {
const result: PermissionConfig = {}
for (const [key, rule] of Object.entries(config)) {
if (rule === null || rule === undefined) continue
if (typeof rule === "string") {
result[key] = rule
continue
}
const next: Record<string, PermissionLevel | null> = {}
for (const [pattern, action] of Object.entries(rule)) {
if (action !== null && action !== undefined) next[pattern] = action
}
if (Object.keys(next).length > 0) result[key] = next as PermissionRule
}
return result
}

export function buildWorkStyleApplyPlan(input: {
style: WorkStyle
config: WorkStyleConfig
settingDefault?: (key: keyof WorkStyleSettings) => boolean
}): WorkStyleApplyPlan {
const preset = getWorkStylePreset(input.style)
const next: WorkStyleConfig = {}

if (preset.config.permission && !hasPermissionConfig(input.config)) {
next.permission = stripPermission(preset.config.permission)
}
if (input.config.terminal_command_display === undefined) {
next.terminal_command_display = preset.config.terminal_command_display
}
if (input.config.auto_collapse_reasoning === undefined) {
next.auto_collapse_reasoning = preset.config.auto_collapse_reasoning
}

const settingDefault = input.settingDefault ?? (() => true)
return {
config: next,
settings: {
...(settingDefault("showTaskTimeline") ? { showTaskTimeline: preset.settings.showTaskTimeline } : {}),
},
}
}
Loading