mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge branch 'main' into tui-usage-info
This commit is contained in:
@@ -23,6 +23,16 @@ Approvals are enforced locally on the execution host and sit on top of tool poli
|
||||
| `allowlist` | Allow only commands matching the allowlist |
|
||||
| `full` | Allow everything (equivalent to elevated mode) |
|
||||
|
||||
## Allow Everything from Settings
|
||||
|
||||
If you want to skip per-command approvals entirely, you can set the security policy to **Allow Everything** directly from the [KiloClaw Settings dashboard](https://app.kilo.ai/claw/settings). This applies the `full` policy globally, allowing your agent to execute any host command without prompts — equivalent to elevated mode.
|
||||
|
||||
{% callout type="warning" %}
|
||||
Enabling **Allow Everything** removes all exec safety checks. Only use this in trusted environments where you are comfortable with your agent running arbitrary commands.
|
||||
{% /callout %}
|
||||
|
||||
{% image src="/docs/img/kiloclaw/allow-everything-settings.png" alt="Allow Everything setting in KiloClaw Settings Dashboard" width="800" caption="The Allow Everything toggle in KiloClaw Settings" /%}
|
||||
|
||||
## Ask Behavior
|
||||
|
||||
The `ask` setting controls when the user is prompted for approval:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b57a543bd799f92b35d2c6037a4ffc932a37f59790213006a021bebef9e94b38
|
||||
size 6897
|
||||
@@ -196,7 +196,7 @@ export const VscodeSessionTurn: Component<VscodeSessionTurnProps> = (props) => {
|
||||
<Collapsible.Trigger>
|
||||
<div data-component="session-turn-diffs-trigger">
|
||||
<div data-slot="session-turn-diffs-title">
|
||||
<span data-slot="session-turn-diffs-label">{i18n.t("ui.sessionReview.change.modified")}</span>
|
||||
<span data-slot="session-turn-diffs-label">{i18n.t("ui.sessionReview.change.modified")}</span>{" "}
|
||||
<span data-slot="session-turn-diffs-count">
|
||||
{diffs().length} {i18n.t(diffs().length === 1 ? "ui.common.file.one" : "ui.common.file.other")}
|
||||
</span>
|
||||
|
||||
@@ -11,10 +11,12 @@ import type { Meta, StoryObj } from "storybook-solidjs-vite"
|
||||
import type { AssistantMessage as SDKAssistantMessage, TextPart, ToolPart } from "@kilocode/sdk/v2"
|
||||
import { StoryProviders, defaultMockData, mockSessionValue } from "./StoryProviders"
|
||||
import { AssistantMessage } from "../components/chat/AssistantMessage"
|
||||
import { VscodeSessionTurn } from "../components/chat/VscodeSessionTurn"
|
||||
import { ChatView } from "../components/chat/ChatView"
|
||||
import { Part } from "@kilocode/kilo-ui/message-part"
|
||||
import { registerVscodeToolOverrides } from "../components/chat/VscodeToolOverrides"
|
||||
import { SessionContext } from "../context/session"
|
||||
import { ServerContext } from "../context/server"
|
||||
import type { PermissionRequest, QuestionRequest } from "../types/messages"
|
||||
|
||||
// Register VS Code tool overrides (bash expanded by default, etc.)
|
||||
@@ -977,3 +979,72 @@ export const McpToolExpanded: Story = {
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 19. Diff summary — "Modified N files" collapsed header
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const USER_MSG_ID = "user-msg-diff-001"
|
||||
|
||||
const mockDiffs = [
|
||||
{ file: "src/components/App.tsx", before: "", after: "", additions: 12, deletions: 3, status: "modified" as const },
|
||||
{ file: "src/utils/helpers.ts", before: "", after: "", additions: 5, deletions: 8, status: "modified" as const },
|
||||
{ file: "src/styles/main.css", before: "", after: "", additions: 20, deletions: 0, status: "added" as const },
|
||||
]
|
||||
|
||||
export const DiffSummaryCollapsed: Story = {
|
||||
name: "Diff Summary — Modified N files (collapsed)",
|
||||
render: () => {
|
||||
const data = {
|
||||
...defaultMockData,
|
||||
message: {
|
||||
[SESSION_ID]: [
|
||||
{
|
||||
id: USER_MSG_ID,
|
||||
sessionID: SESSION_ID,
|
||||
role: "user",
|
||||
time: { created: now - 10000 },
|
||||
summary: { diffs: mockDiffs },
|
||||
},
|
||||
{ ...baseAssistantMessage, parentID: USER_MSG_ID },
|
||||
],
|
||||
},
|
||||
part: {
|
||||
[USER_MSG_ID]: [
|
||||
{ id: "part-user-text", sessionID: SESSION_ID, messageID: USER_MSG_ID, type: "text", text: "Fix the bug" },
|
||||
],
|
||||
[ASST_MSG_ID]: [textPart],
|
||||
},
|
||||
}
|
||||
const session = {
|
||||
...mockSessionValue({ id: SESSION_ID, status: "idle" }),
|
||||
messages: () => data.message[SESSION_ID],
|
||||
}
|
||||
const server = {
|
||||
connectionState: () => "connected" as const,
|
||||
serverInfo: () => undefined,
|
||||
extensionVersion: () => "1.0.0",
|
||||
errorMessage: () => undefined,
|
||||
errorDetails: () => undefined,
|
||||
isConnected: () => true,
|
||||
profileData: () => null,
|
||||
deviceAuth: () => ({ status: "idle" as const }),
|
||||
startLogin: () => {},
|
||||
vscodeLanguage: () => "en",
|
||||
languageOverride: () => undefined,
|
||||
workspaceDirectory: () => "/project",
|
||||
gitInstalled: () => true,
|
||||
}
|
||||
return (
|
||||
<StoryProviders data={data} sessionID={SESSION_ID} status="idle" noPadding>
|
||||
<ServerContext.Provider value={server as any}>
|
||||
<SessionContext.Provider value={session as any}>
|
||||
<div style={{ width: "380px", padding: "12px" }}>
|
||||
<VscodeSessionTurn sessionID={SESSION_ID} messageID={USER_MSG_ID} />
|
||||
</div>
|
||||
</SessionContext.Provider>
|
||||
</ServerContext.Provider>
|
||||
</StoryProviders>
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -176,3 +176,9 @@
|
||||
.vscode-session-turn-diffs {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.vscode-session-turn-diffs [data-slot="session-turn-diffs-title"] {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import { TuiConfigProvider, useTuiConfig } from "./context/tui-config"
|
||||
import { TuiConfig } from "@/config/tui"
|
||||
import { createTuiApi, TuiPluginRuntime, type RouteMap } from "./plugin"
|
||||
import { FormatError, FormatUnknownError } from "@/cli/error"
|
||||
import { resetTerminalState } from "@tui/util/terminal" // kilocode_change
|
||||
|
||||
async function getTerminalBackgroundColor(): Promise<"dark" | "light"> {
|
||||
// can't set raw mode if not a TTY
|
||||
@@ -197,6 +198,9 @@ export function tui(input: {
|
||||
await TuiPluginRuntime.dispose()
|
||||
}
|
||||
|
||||
// kilocode_change - safety net: ensure mouse tracking is disabled regardless of exit path
|
||||
process.on("exit", resetTerminalState) // kilocode_change
|
||||
|
||||
const renderer = await createCliRenderer(rendererConfig(input.config))
|
||||
|
||||
await render(() => {
|
||||
@@ -1010,6 +1014,8 @@ function ErrorComponent(props: {
|
||||
renderer?.setTerminalTitle("")
|
||||
renderer?.destroy()
|
||||
win32FlushInputBuffer()
|
||||
// kilocode_change - reset terminal state to disable mouse tracking on exit
|
||||
resetTerminalState()
|
||||
await props.onExit()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useRenderer } from "@opentui/solid"
|
||||
import { createSimpleContext } from "./helper"
|
||||
import { FormatError, FormatUnknownError } from "@/cli/error"
|
||||
import { win32FlushInputBuffer } from "../win32"
|
||||
import { resetTerminalState } from "@tui/util/terminal" // kilocode_change
|
||||
type Exit = ((reason?: unknown) => Promise<void>) & {
|
||||
message: {
|
||||
set: (value?: string) => () => void
|
||||
@@ -38,6 +39,7 @@ export const { use: useExit, provider: ExitProvider } = createSimpleContext({
|
||||
renderer.setTerminalTitle("")
|
||||
renderer.destroy()
|
||||
win32FlushInputBuffer()
|
||||
resetTerminalState() // kilocode_change
|
||||
if (reason) {
|
||||
const formatted = FormatError(reason) ?? FormatUnknownError(reason)
|
||||
if (formatted) {
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
import { RGBA } from "@opentui/core"
|
||||
|
||||
// kilocode_change start
|
||||
/**
|
||||
* Write escape sequences to disable all mouse tracking modes and reset terminal state.
|
||||
* This is a safety net to ensure the terminal is clean after exit, even if the renderer's
|
||||
* cleanup didn't flush properly (e.g. on Windows).
|
||||
*/
|
||||
export function resetTerminalState() {
|
||||
const sequences = [
|
||||
"\x1b[?1000l", // disable normal mouse tracking
|
||||
"\x1b[?1002l", // disable button-event mouse tracking
|
||||
"\x1b[?1003l", // disable any-event mouse tracking (all movement)
|
||||
"\x1b[?1006l", // disable SGR extended mouse mode
|
||||
"\x1b[?1015l", // disable RXVT mouse mode
|
||||
"\x1b[<u", // pop/disable Kitty keyboard protocol
|
||||
"\x1b[0m", // reset text attributes
|
||||
]
|
||||
try {
|
||||
process.stdout.write(sequences.join(""))
|
||||
} catch (err) {
|
||||
console.error("resetTerminalState failed", err)
|
||||
}
|
||||
}
|
||||
// kilocode_change end
|
||||
|
||||
export namespace Terminal {
|
||||
export type Colors = Awaited<ReturnType<typeof colors>>
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user