mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-11-06 00:04:38 +08:00
fix(vscode): restrict export to custom modes and validate mode field on import
Hide export button for native/built-in agents since their full definition is not available from config overrides alone. Validate the mode field on import against the allowed values (subagent, primary, all) instead of blindly casting.
This commit is contained in:
@@ -248,7 +248,8 @@ const AgentBehaviourTab: Component = () => {
|
||||
if (typeof data.description === "string") partial.description = data.description
|
||||
if (typeof data.prompt === "string") partial.prompt = data.prompt
|
||||
if (typeof data.model === "string") partial.model = data.model
|
||||
if (typeof data.mode === "string") partial.mode = data.mode as AgentConfig["mode"]
|
||||
const modes = ["subagent", "primary", "all"] as const
|
||||
if (typeof data.mode === "string" && modes.includes(data.mode)) partial.mode = data.mode
|
||||
if (typeof data.temperature === "number") partial.temperature = data.temperature
|
||||
if (typeof data.top_p === "number") partial.top_p = data.top_p
|
||||
if (typeof data.steps === "number") partial.steps = data.steps
|
||||
|
||||
@@ -68,15 +68,15 @@ const ModeEditView: Component<Props> = (props) => {
|
||||
{language.t("settings.agentBehaviour.editMode")} — {props.name}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: "flex", gap: "4px" }}>
|
||||
<IconButton
|
||||
size="small"
|
||||
variant="ghost"
|
||||
icon="download"
|
||||
title={language.t("settings.agentBehaviour.exportMode")}
|
||||
onClick={exportMode}
|
||||
/>
|
||||
<Show when={!native()}>
|
||||
<Show when={!native()}>
|
||||
<div style={{ display: "flex", gap: "4px" }}>
|
||||
<IconButton
|
||||
size="small"
|
||||
variant="ghost"
|
||||
icon="download"
|
||||
title={language.t("settings.agentBehaviour.exportMode")}
|
||||
onClick={exportMode}
|
||||
/>
|
||||
<IconButton
|
||||
size="small"
|
||||
variant="ghost"
|
||||
@@ -86,8 +86,8 @@ const ModeEditView: Component<Props> = (props) => {
|
||||
if (a) props.onRemove(a)
|
||||
}}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
|
||||
<Show when={native()}>
|
||||
|
||||
Reference in New Issue
Block a user