diff --git a/.changeset/expose-sandbox-controls.md b/.changeset/expose-sandbox-controls.md new file mode 100644 index 000000000000..b08efed482a8 --- /dev/null +++ b/.changeset/expose-sandbox-controls.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Show experimental sandbox controls by default for non-Windows users. diff --git a/packages/kilo-vscode/src/features.ts b/packages/kilo-vscode/src/features.ts index 618eaa79bf10..0b0b7275282e 100644 --- a/packages/kilo-vscode/src/features.ts +++ b/packages/kilo-vscode/src/features.ts @@ -1,5 +1,4 @@ import { hasIndexingPlugin } from "@kilocode/kilo-indexing/detect" -import * as vscode from "vscode" type PluginSpec = string | [string, Record] @@ -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", } } diff --git a/packages/kilo-vscode/tests/unit/prompt-input-connection-guard.test.ts b/packages/kilo-vscode/tests/unit/prompt-input-connection-guard.test.ts index 4fab1cf5a3dd..1de6cdd760e8 100644 --- a/packages/kilo-vscode/tests/unit/prompt-input-connection-guard.test.ts +++ b/packages/kilo-vscode/tests/unit/prompt-input-connection-guard.test.ts @@ -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("") expect(src).toContain('message.type === "sandboxStatus"') expect(src).toContain("message.sessionID !== sandboxID() && !matching") diff --git a/packages/kilo-vscode/tests/unit/sandboxing-settings.test.ts b/packages/kilo-vscode/tests/unit/sandboxing-settings.test.ts index 08ce002d0ec5..d75037a0b374 100644 --- a/packages/kilo-vscode/tests/unit/sandboxing-settings.test.ts +++ b/packages/kilo-vscode/tests/unit/sandboxing-settings.test.ts @@ -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) + }) }) diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx index 51daa8f97763..da3c6a8647b7 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx @@ -162,7 +162,7 @@ export const PromptInput: Component = (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()