Skip to content
Merged
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/expose-sandbox-controls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Show experimental sandbox controls by default for non-Windows users.
3 changes: 1 addition & 2 deletions packages/kilo-vscode/src/features.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { hasIndexingPlugin } from "@kilocode/kilo-indexing/detect"
import * as vscode from "vscode"

type PluginSpec = string | [string, Record<string, unknown>]

Expand All @@ -15,6 +14,6 @@ export type Features = {
export function configFeatures(config?: ConfigLike | null): Features {
return {
indexing: hasIndexingPlugin(config?.plugin ?? []),
sandboxControls: vscode.workspace.getConfiguration("kilo-code.new.internal").get("sandboxControls", false),
sandboxControls: process.platform !== "win32",
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ describe("PromptInput sandbox toggle", () => {
expect(move).toBeGreaterThan(save)
})

it("uses the internal flag for visibility and effective runtime state for the button", () => {
expect(src).toContain("features().sandboxControls")
it("requires the enabled experiment for visibility and uses effective runtime state for the button", () => {
expect(src).toContain(
'return features().sandboxControls && config().experimental?.sandbox === true && !id?.startsWith("cloud:")',
)
expect(src).toContain("<Show when={sandboxVisible()}>")
expect(src).toContain('message.type === "sandboxStatus"')
expect(src).toContain("message.sessionID !== sandboxID() && !matching")
Expand Down
27 changes: 25 additions & 2 deletions packages/kilo-vscode/tests/unit/sandboxing-settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import { describe, expect, test } from "bun:test"
import { afterEach, describe, expect, test } from "bun:test"
import { configFeatures } from "../../src/features"
import { visible } from "../../webview-ui/src/components/settings/sandboxing"

const features = { indexing: false, sandboxControls: false }
const platform = Object.getOwnPropertyDescriptor(process, "platform")

function setPlatform(value: string) {
Object.defineProperty(process, "platform", { value, configurable: true })
}

afterEach(() => {
if (platform) Object.defineProperty(process, "platform", platform)
})

describe("Sandboxing settings visibility", () => {
test("requires both the internal feature flag and sandbox experiment", () => {
test("requires both sandbox control availability and the sandbox experiment", () => {
expect(visible(features, {})).toBe(false)
expect(visible({ ...features, sandboxControls: true }, {})).toBe(false)
expect(visible(features, { experimental: { sandbox: true } })).toBe(false)
expect(visible({ ...features, sandboxControls: true }, { experimental: { sandbox: false } })).toBe(false)
expect(visible({ ...features, sandboxControls: true }, { experimental: { sandbox: true } })).toBe(true)
})

test("enables sandbox controls by default outside Windows", () => {
setPlatform("darwin")
expect(configFeatures().sandboxControls).toBe(true)

setPlatform("linux")
expect(configFeatures().sandboxControls).toBe(true)
})

test("hides sandbox controls on Windows", () => {
setPlatform("win32")
expect(configFeatures().sandboxControls).toBe(false)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
}
const sandboxVisible = () => {
const id = session.currentSessionID()
return features().sandboxControls && !id?.startsWith("cloud:")
return features().sandboxControls && config().experimental?.sandbox === true && !id?.startsWith("cloud:")
}
const sandbox = () => {
const state = sandboxState()
Expand Down
Loading