Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
chore(agent): remove the unimplemented [skills] inject key
thinhlpg7168ae5b163d
diff --git a/docs/src/pages/docs/agent/project-config.mdx b/docs/src/pages/docs/agent/project-config.mdxindex cbf74d55d..2670a1786 100644--- a/docs/src/pages/docs/agent/project-config.mdx+++ b/docs/src/pages/docs/agent/project-config.mdx@@ -110,7 +110,6 @@ allow_write = [][skills]enabled = []-inject = "always"```### `[agent]`diff --git a/src-tauri/src/core/agent/project.rs b/src-tauri/src/core/agent/project.rsindex 3ea571687..cb84cb2ea 100644--- a/src-tauri/src/core/agent/project.rs+++ b/src-tauri/src/core/agent/project.rs@@ -108,6 +108,12 @@ pub(crate) struct ProviderSection {pub(crate) struct SkillsSection {#[serde(default)]pub enabled: Vec<String>,+ /// Retired `inject = "always" | "relevance"`: it was scaffolded and+ /// documented but never read, so it is no longer part of the config.+ /// Still accepted (any value) so an older agent.toml keeps parsing; its+ /// presence only earns a one-time log warning.+ #[serde(default)]+ pub inject: Option<toml::Value>,}/// `[budget]` — the only cap on how long a run may go. The agent takes as many@@ -301,8 +307,6 @@ allow_write = [][skills]enabled = []-# always | relevance-inject = "always"# Where each contributor to the system prompt may sit, deny-wins like [tools].# Above the cache line ("prefix") a contributor must be constant for the whole@@ -449,6 +453,9 @@ pub(crate) fn run_settings(project_root: &Path) -> RunSettings {let Ok(cfg) = load_agent_config(project_root) else {return RunSettings::default();};+ if cfg.skills.inject.is_some() {+ warn_retired_inject();+ }RunSettings {enabled_skills: cfg.skills.enabled,allow_network: cfg.tools.allow_network,@@ -462,6 +469,16 @@ pub(crate) fn run_settings(project_root: &Path) -> RunSettings {}}+/// Log once per process that `[skills].inject` is ignored.+fn warn_retired_inject() {+ static WARNED: std::sync::Once = std::sync::Once::new();+ WARNED.call_once(|| {+ log::warn!(+ "agent.toml: [skills].inject is no longer used and is ignored; every enabled skill's name and description is listed in the prompt. Remove the key to silence this warning."+ );+ });+}+pub(crate) fn enabled_skills(project_root: &Path) -> Vec<String> {run_settings(project_root).enabled_skills}@@ -693,6 +710,21 @@ mod tests {let _ = std::fs::remove_dir_all(&bare);}+ /// `[skills].inject` was scaffolded but never read (janhq/jan-internal#394);+ /// it is gone from the template, and an agent.toml that still has it keeps+ /// parsing with the whitelist intact.+ #[test]+ fn retired_skills_inject_is_dropped_from_the_template_but_still_parses() {+ assert!(!AGENT_TOML_TEMPLATE.contains("inject ="));+ for value in ["\"always\"", "\"relevance\"", "true"] {+ let cfg: AgentToml =+ toml::from_str(&format!("[skills]\nenabled = [\"a\"]\ninject = {value}\n"))+ .expect("a legacy inject key still parses");+ assert_eq!(cfg.skills.enabled, vec!["a".to_string()]);+ assert!(cfg.skills.inject.is_some());+ }+ }+/// The scaffold documents the key, so it has to stay parseable as written.#[test]fn scaffold_template_parses_with_allow_network_documented() {diff --git a/src-tauri/src/core/cli/tui.rs b/src-tauri/src/core/cli/tui.rsindex ba66a2ee6..6bde589e2 100644--- a/src-tauri/src/core/cli/tui.rs+++ b/src-tauri/src/core/cli/tui.rs@@ -12989,16 +12989,6 @@ const AGENT_SETTINGS: &[AgentSettingDef] = &[},scope: SettingScope::Project,},- AgentSettingDef {- key: "skills.inject",- label: "skills.inject",- desc: "when project skills are injected into the prompt",- kind: AgentSettingKind::Enum {- options: &["always", "relevance"],- default: "always",- },- scope: SettingScope::Project,- },AgentSettingDef {key: "show_reasoning",label: "show_reasoning",