feat: 适配 kimi-code 0.40.1 —— flag 清单/优先级语义/危险命令守卫
- flag 清单 9→10:新增 file_history、search_worker;secondary-model 0.40.1 起默认开启(defaultEnabled) - env 探测补齐为 12 项元组(10 flag + master + legacy),修正此前 tower/subagent_fork/wait_for/auto_session_title 四项漏探 - 优先级语义跟随上游 flagService:单 flag env > [experimental] 显式值 > master env(仅强制开)> 默认。master env 不再锁定 UI;setExperimentalFlag 增加 explicitFalse 路径,关闭默认开/master 强开的 flag 时写字面 false - 权限设置新增 dangerous_command_guard 开关(默认开,写 [permission] 蛇形键;env KIMI_CODE_DANGEROUS_COMMAND_GUARD 运行时覆盖 config) - 新增 11 个测试(注册表/写语义/守卫读写)
This commit is contained in:
1 parent
6a7c8f5393
commit
86a128efea
10 files changed
+339
-47
No files matched your search
+28
-12
@@ -1339,26 +1339,42 @@ pub async fn kimi_oauth_poll(
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Read the Kimi Code environment variables that are currently set (non-empty)
|
||||
/// in this process's environment. The experimental-feature vars are used by the
|
||||
/// frontend to mark config.toml `[experimental]` toggles as locked: env vars
|
||||
/// outrank the config file in Kimi Code's flag resolution. `KIMI_CODE_LEGACY_FLAG`
|
||||
/// is probed too — the AgentSettingsPanel uses it to decide whether to
|
||||
/// in this process's environment. Every `[experimental]` feature env var is
|
||||
/// probed — the frontend uses a per-feature env var to mark the matching
|
||||
/// config.toml `[experimental]` toggle as locked, since a single-feature env
|
||||
/// var outranks the config file in Kimi Code's flag resolution. The master
|
||||
/// `KIMI_CODE_EXPERIMENTAL_FLAG` (0.40.1+: only force-ONs flags without an
|
||||
/// explicit config entry; never locks a toggle) and `KIMI_CODE_LEGACY_FLAG`
|
||||
/// are probed too — the latter lets AgentSettingsPanel decide whether to
|
||||
/// dual-write the v1 engine's loop_control keys.
|
||||
///
|
||||
/// The flag id → env var mapping mirrors `EXPERIMENTAL_FLAGS` in
|
||||
/// src/lib/subagent-settings.ts; keep both lists in sync.
|
||||
///
|
||||
/// Truthy values per the CLI: `1` / `true` / `yes` / `on` (case-insensitive);
|
||||
/// the raw values are returned and the truthy check happens on the frontend.
|
||||
#[tauri::command]
|
||||
pub fn get_experimental_env_status() -> HashMap<String, String> {
|
||||
const VARS: [&str; 6] = [
|
||||
"KIMI_CODE_EXPERIMENTAL_FLAG",
|
||||
"KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL",
|
||||
"KIMI_CODE_EXPERIMENTAL_TOOL_SELECT",
|
||||
"KIMI_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL",
|
||||
"KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL",
|
||||
"KIMI_CODE_LEGACY_FLAG",
|
||||
const VARS: [(&str, &str); 12] = [
|
||||
("secondary-model", "KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL"),
|
||||
("tool-select", "KIMI_CODE_EXPERIMENTAL_TOOL_SELECT"),
|
||||
(
|
||||
"persistence_minidb_readmodel",
|
||||
"KIMI_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL",
|
||||
),
|
||||
("tower", "KIMI_CODE_EXPERIMENTAL_TOWER"),
|
||||
("subagent_fork", "KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK"),
|
||||
("wait_for", "KIMI_CODE_EXPERIMENTAL_WAIT_FOR"),
|
||||
("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"),
|
||||
];
|
||||
let mut out = HashMap::new();
|
||||
for name in VARS {
|
||||
for (_, name) in VARS {
|
||||
if let Ok(value) = std::env::var(name) {
|
||||
if !value.trim().is_empty() {
|
||||
out.insert(name.to_string(), value);
|
||||
|
||||
Reference in new issue
Block a user