diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 59f09da..b66c434 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -690,8 +690,8 @@ pub async fn query_provider_usage( let base_url = resolve_base_url(provider); - // NewAPI template: query the gateway's own /api/user/self with the - // web-console access token, bypassing usage_kinds entirely. + // NewAPI template: query the gateway's own usage endpoints with its + // dedicated credentials, bypassing usage_kinds entirely. if let Some(cfg) = &provider.usage_config { if cfg.template_type == UsageConfig::TEMPLATE_NEWAPI { // Err = transient (network) → propagate for retry, same semantics @@ -1355,7 +1355,7 @@ pub async fn kimi_oauth_poll( /// the raw values are returned and the truthy check happens on the frontend. #[tauri::command] pub fn get_experimental_env_status() -> HashMap { - const VARS: [(&str, &str); 12] = [ + const VARS: [(&str, &str); 11] = [ ("secondary-model", "KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL"), ("tool-select", "KIMI_CODE_EXPERIMENTAL_TOOL_SELECT"), ( @@ -1368,7 +1368,6 @@ pub fn get_experimental_env_status() -> HashMap { ("auto_session_title", "KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE"), ("remote-control", "KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL"), ("search_worker", "KIMI_CODE_EXPERIMENTAL_SEARCH_WORKER"), - ("file_history", "KIMI_CODE_EXPERIMENTAL_FILE_HISTORY"), // Non-flag probes consumed by the frontend: ("master", "KIMI_CODE_EXPERIMENTAL_FLAG"), ("legacy", "KIMI_CODE_LEGACY_FLAG"), diff --git a/src/components/AgentSettingsPanel.tsx b/src/components/AgentSettingsPanel.tsx index d5f2363..38911b0 100644 --- a/src/components/AgentSettingsPanel.tsx +++ b/src/components/AgentSettingsPanel.tsx @@ -157,10 +157,13 @@ export function AgentSettingsPanel({ rawOther, onChange }: AgentSettingsPanelPro - {/* kimi-code 0.40.1 `[permission] dangerous_command_guard`. The env + {/* kimi-code `[permission] dangerous_command_guard`. The env var KIMI_CODE_DANGEROUS_COMMAND_GUARD (literal "true"/"false") outranks this config at runtime; no env-lock UI here (deliberate - minimal scope). Absent key = upstream default on. */} + minimal scope). Absent key = upstream default on. Since + kimi-code 0.41.0 the guard only gates Manual/YOLO modes — + Auto (never-ask) mode no longer intercepts dangerous + commands. */} = { permissionAsk: "Ask", permissionDangerousGuard: "Dangerous Command Guard", permissionDangerousGuardDesc: - "When on (default): Auto mode refuses dangerous commands (rm -rf, shutdown, dd of=, ...) and other modes always prompt; turning it off restores the previous behavior. Env KIMI_CODE_DANGEROUS_COMMAND_GUARD overrides this config", + "When on (default): Manual/YOLO modes force a prompt for dangerous commands (rm -rf, shutdown, dd of=, ...) and commands that cannot be statically analyzed; Auto (never-ask) mode no longer intercepts them since kimi-code 0.41.0. Turning it off restores the previous behavior. Env KIMI_CODE_DANGEROUS_COMMAND_GUARD overrides this config", addRule: "+ Add rule", addCommonRules: "Add common rules", hooks: "Lifecycle Hooks", @@ -482,9 +482,6 @@ export const enTranslations: Record = { flagRemoteControlDesc: "Enable the experimental remote control feature", flagSearchWorker: "Search Worker", flagSearchWorkerDesc: "Run the kap-server global search backend in a background worker host", - flagFileHistory: "File History", - flagFileHistoryDesc: - "Snapshot edited files before/after each turn (last 5 turns across 30 sessions, stored in the session data dir) for real whole-file diffs", flagDefaultOn: "On by default", lockedByEnv: "Locked by env var", masterEnvOnHint: diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index 351cbab..c17fe83 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -151,7 +151,7 @@ export const zhTranslations = { permissionAsk: "询问", permissionDangerousGuard: "危险命令防护", permissionDangerousGuardDesc: - "开启(默认)时:Auto 模式直接拒绝危险命令(rm -rf、shutdown、dd of= 等),其它模式强制询问;关闭后回归旧行为。环境变量 KIMI_CODE_DANGEROUS_COMMAND_GUARD 会覆盖本配置", + "开启(默认)时:Manual/YOLO 模式下,危险命令(rm -rf、shutdown、dd of= 等)和无法静态分析的命令会强制询问;自动(永不询问)模式自 kimi-code 0.41.0 起不再拦截。关闭后回归旧行为。环境变量 KIMI_CODE_DANGEROUS_COMMAND_GUARD 会覆盖本配置", addRule: "+ 添加规则", addCommonRules: "添加常用规则", hooks: "生命周期钩子", @@ -477,9 +477,6 @@ export const zhTranslations = { flagRemoteControlDesc: "启用实验性远程控制功能", flagSearchWorker: "搜索 Worker", flagSearchWorkerDesc: "kap-server 全局搜索的后台 worker 宿主服务", - flagFileHistory: "文件历史", - flagFileHistoryDesc: - "记录每轮编辑文件的前后快照(最近 30 个会话×最近 5 轮,存于会话数据目录),用于真实的整文件 diff", flagDefaultOn: "默认开启", lockedByEnv: "被环境变量锁定", masterEnvOnHint: diff --git a/src/lib/subagent-settings.test.ts b/src/lib/subagent-settings.test.ts index 8beb40b..1c09ef8 100644 --- a/src/lib/subagent-settings.test.ts +++ b/src/lib/subagent-settings.test.ts @@ -455,11 +455,11 @@ describe("validateSubagentPool", () => { }); // --------------------------------------------------------------------------- -// [experimental] — flag registry (kimi-code 0.40.1) + write semantics +// [experimental] — flag registry (kimi-code 0.41.0) + write semantics // --------------------------------------------------------------------------- describe("experimental flag registry", () => { - it("mirrors the 0.40.1 v2 registry (10 flags incl. file_history)", () => { + it("mirrors the 0.41.0 v2 registry (9 flags, file_history removed)", () => { expect(EXPERIMENTAL_FLAGS.map((f) => f.id)).toEqual([ "secondary-model", "tool-select", @@ -470,11 +470,10 @@ describe("experimental flag registry", () => { "auto_session_title", "remote-control", "search_worker", - "file_history", ]); - const fh = EXPERIMENTAL_FLAGS.find((f) => f.id === "file_history"); - expect(fh?.envVar).toBe("KIMI_CODE_EXPERIMENTAL_FILE_HISTORY"); - expect(fh?.defaultEnabled).toBeUndefined(); + // Upstream removed the flag in 0.41.0 (turn-level file history is + // always on), so the adapter must not mirror it either. + expect(EXPERIMENTAL_FLAGS.some((f) => f.id === "file_history")).toBe(false); }); it("secondary-model is on by default since 0.40.1", () => { diff --git a/src/lib/subagent-settings.ts b/src/lib/subagent-settings.ts index 7406262..d4be5e1 100644 --- a/src/lib/subagent-settings.ts +++ b/src/lib/subagent-settings.ts @@ -37,8 +37,9 @@ export interface ExperimentalFlagDef { * (the per-feature flag.ts files under packages/agent-core-v2/src: * secondary-model, tool-select, persistence_minidb_readmodel, tower, * subagent_fork, wait_for, auto_session_title, remote-control, - * search_worker, file_history). `acp-v2` was removed upstream and is - * dropped here. Keep the env-var list in sync with + * search_worker). `acp-v2` was removed upstream and is dropped here; + * `file_history` was removed in kimi-code 0.41.0 (turn-level file + * history is always on, no flag). Keep the env-var list in sync with * `get_experimental_env_status` in src-tauri/src/commands.rs. */ export const EXPERIMENTAL_FLAGS: ExperimentalFlagDef[] = [ { @@ -69,7 +70,6 @@ export const EXPERIMENTAL_FLAGS: ExperimentalFlagDef[] = [ envVar: "KIMI_CODE_EXPERIMENTAL_SEARCH_WORKER", defaultEnabled: true, }, - { id: "file_history", envVar: "KIMI_CODE_EXPERIMENTAL_FILE_HISTORY" }, ]; export const EXPERIMENTAL_MASTER_ENV = "KIMI_CODE_EXPERIMENTAL_FLAG"; diff --git a/src/types/index.ts b/src/types/index.ts index 844ca0f..208e00f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -151,9 +151,11 @@ export interface AgentSettings { background?: BackgroundConfig; permission?: { rules?: PermissionRule[]; - /** kimi-code 0.40.1 `[permission]` key. Default true when the key is - * absent: Auto mode refuses dangerous commands (rm -rf, shutdown, - * dd of=, …) and other modes always prompt; false restores the + /** kimi-code `[permission]` key. Default true when the key is + * absent: since 0.41.0 the guard only gates Manual/YOLO modes — + * dangerous commands (rm -rf, shutdown, dd of=, …) and commands + * that cannot be statically analyzed force a prompt, while Auto + * (never-ask) mode no longer intercepts them; false restores the * previous behavior. Env KIMI_CODE_DANGEROUS_COMMAND_GUARD (literal * "true"/"false" only) outranks this config. */ dangerous_command_guard?: boolean;