Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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/prevent-task-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": minor
---

Prevent automatic system sleep while agent tasks run, with localized settings, crash- and reconnect-safe native helpers, input-aware pausing, and a configurable active-time limit.
4 changes: 4 additions & 0 deletions packages/kilo-ui/src/components/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const icons: Record<string, { path: string; viewBox: string }> = {
viewBox: "0 0 20 20",
path: `<rect x="2.5" y="3.5" width="15" height="10" rx="1" stroke="currentColor"/><path d="M6 16.5H14" stroke="currentColor" stroke-linecap="square"/><path d="M10 13.5V16.5" stroke="currentColor"/>`,
},
battery: {
viewBox: "0 0 24 24",
path: `<rect x="3" y="7" width="17" height="10" rx="2" stroke="currentColor" stroke-width="2"/><path d="M21 10v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M6 10h7v4H6z" fill="currentColor"/>`,
},
}

type Name = keyof typeof icons
Expand Down
5 changes: 5 additions & 0 deletions packages/kilo-vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- **Code Generation:** Kilo can generate code using natural language.
- **Inline Autocomplete:** Get intelligent code completions as you type, powered by AI.
- **Task Automation:** Kilo can automate repetitive coding tasks to save time..
- **System Sleep Prevention:** Kilo keeps the computer awake while agent tasks run without preventing display sleep or screen locking.
- **Automated Refactoring:** Kilo can refactor and improve existing code efficiently.
- **MCP Server Marketplace**: Kilo can easily find, and use MCP servers to extend the agent capabilities.
- **Multi Mode**: Plan with Architect, Code with Coder, and Debug with Debugger, and make your own custom modes.
Expand All @@ -54,6 +55,10 @@

<a href="https://youtu.be/pqGfYXgrhig"><img src="https://img.youtube.com/vi/pqGfYXgrhig/maxresdefault.jpg" alt="Watch the video" width="640" height="360"></a>

### System sleep prevention

System sleep prevention is disabled by default. Enable it with `kilo-code.new.preventSleepDuringTasks`. Each task releases its sleep lock after 30 minutes of active execution by default; time waiting for user input does not count. Change this limit with `kilo-code.new.preventSleepDuringTasksTimeoutMinutes`. Set it to `0` for no extension-imposed limit. Operating-system power rules still apply.

## Developer Setup

If you want to contribute or modify the extension locally, see the [DEVELOPMENT.md](/DEVELOPMENT.md) file for build and setup instructions.
Expand Down
17 changes: 17 additions & 0 deletions packages/kilo-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"title": "Show Project Memory",
"category": "Kilo Code"
},
{
"command": "kilo-code.new.allowSystemSleep",
"title": "Allow System Sleep",
"category": "Kilo Code"
},
{
"command": "kilo-code.new.toggleMemory",
"title": "Toggle Project Memory",
Expand Down Expand Up @@ -1124,6 +1129,18 @@
"default": true,
"description": "Use system-installed Google Chrome. Disable only when a compatible Playwright Chromium browser is already installed."
},
"kilo-code.new.preventSleepDuringTasks": {
"type": "boolean",
"default": false,
"description": "Prevent automatic system sleep while Kilo Code tasks run. Screen locking and display sleep are not affected."
},
"kilo-code.new.preventSleepDuringTasksTimeoutMinutes": {
"type": "number",
"default": 30,
"minimum": 0,
"maximum": 1440,
"description": "Release system sleep prevention after this much active execution time per task. Time waiting for user input is excluded. Set to 0 for no extension-imposed limit; operating-system power rules still apply."
},
"kilo-code.new.attention.enabled": {
"type": "boolean",
"default": false,
Expand Down
3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ensureBackendForAutocomplete } from "./services/autocomplete/ensure-bac
import { AutocompleteServiceManager } from "./services/autocomplete/AutocompleteServiceManager"
import { AttentionService } from "./services/attention"
import { BrowserBroker } from "./services/browser-automation"
import { SleepInhibitorService } from "./services/sleep-inhibitor"
import { TelemetryEventName, TelemetryProxy } from "./services/telemetry"
import { registerCommitMessageService } from "./services/commit-message"
import { registerCodeActions, registerTerminalActions, KiloCodeActionProvider } from "./services/code-actions"
Expand Down Expand Up @@ -215,6 +216,7 @@ export async function activate(context: vscode.ExtensionContext) {
const attention = new AttentionService(connectionService, {
approve: (event, directory) => autoApprove.approve(event, directory),
})
const sleep = new SleepInhibitorService(connectionService)

// Prewarm only after all global event consumers are ready.
ensureBackendForAutocomplete(connectionService)
Expand Down Expand Up @@ -638,6 +640,7 @@ export async function activate(context: vscode.ExtensionContext) {
dispose: () => {
shuttingDown = true
unsubscribeStateChange()
sleep.dispose()
attention.dispose()
browserBroker.dispose()
provider.dispose()
Expand Down
34 changes: 22 additions & 12 deletions packages/kilo-vscode/src/kilo-provider/early-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { SuggestionContext } from "./handlers/suggestion"
import type { KiloClient } from "@kilocode/sdk/v2/client"
import { buildChatSettingsMessage } from "./chat-settings"
import { buildThroughputSettingMessage } from "./throughput-settings"
import { buildSleepSettingsMessage } from "./sleep-settings"
import { buildAutoApprovalReasonSettingMessage } from "./auto-approval-reason-settings"
import { handleModelUsageMessage, type ModelUsageMessage } from "./model-usage"

Expand Down Expand Up @@ -67,6 +68,26 @@ function isResume(input: { sessionID?: unknown; messageID?: unknown; requestID?:
)
}

function routeSettingsMessage(message: { type: string }, ctx: Ctx): boolean | undefined {
if (message.type === "requestChatSettings") {
ctx.post(buildChatSettingsMessage())
return true
}
if (message.type === "requestThroughputSetting") {
ctx.post(buildThroughputSettingMessage())
return true
}
if (message.type === "requestSleepSettings") {
ctx.post(buildSleepSettingsMessage())
return true
}
if (message.type === "requestAutoApprovalReasonSetting") {
ctx.post(buildAutoApprovalReasonSettingMessage())
return true
}
return undefined
}

export async function routeEarlyMessage(
message: { type: string; id?: unknown; text?: unknown; state?: unknown },
ctx: Ctx,
Expand Down Expand Up @@ -119,18 +140,7 @@ export async function routeEarlyMessage(
ctx.openSessions(ids)
return true
}
if (message.type === "requestChatSettings") {
ctx.post(buildChatSettingsMessage())
return true
}
if (message.type === "requestThroughputSetting") {
ctx.post(buildThroughputSettingMessage())
return true
}
if (message.type === "requestAutoApprovalReasonSetting") {
ctx.post(buildAutoApprovalReasonSettingMessage())
return true
}
if (routeSettingsMessage(message, ctx)) return true
if (message.type === "requestSpeechToTextModels") {
await ctx.speechToTextModels()
return true
Expand Down
10 changes: 10 additions & 0 deletions packages/kilo-vscode/src/kilo-provider/sleep-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as vscode from "vscode"

export function buildSleepSettingsMessage() {
const config = vscode.workspace.getConfiguration("kilo-code.new")
return {
type: "sleepSettingsLoaded" as const,
enabled: config.get<boolean>("preventSleepDuringTasks", false),
timeout: config.get<number>("preventSleepDuringTasksTimeoutMinutes", 30),
}
}
3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/ar.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/br.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/bs.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/da.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ export { autocompleteDict }

export const dict = {
...autocompleteDict,
"kilocode:sleep.reason": 'Aufgabe "{{title}}" wird ausgeführt',
"kilocode:sleep.statusBar.tooltip":
"Während Aufgaben ausgeführt werden, wird der Systemruhezustand verhindert. Bildschirmsperre und Display-Ruhezustand bleiben unverändert. Klicken, um den Systemruhezustand zuzulassen.",
} as const
3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ export { autocompleteDict }

export const dict = {
...autocompleteDict,
"kilocode:sleep.reason": 'Task "{{title}}" is running',
"kilocode:sleep.statusBar.tooltip":
"System sleep is prevented while tasks run. Screen locking and display sleep remain unchanged. Click to allow system sleep.",
} as const
3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/es.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/fa.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/fr.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/it.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/ja.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/ko.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/nl.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/no.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/pl.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/ru.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/th.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/tr.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/kilo-vscode/src/services/i18n/uk.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/kilo-vscode/src/services/i18n/zh.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/kilo-vscode/src/services/i18n/zht.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading