From 9ea081c5fa5364cfb4a8168e3f5e72f60fa70d8f Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 16:14:17 +0800 Subject: [PATCH 1/3] feat(build): add runConfigurationTypes 1 for model-generated declared run configurations --- rust/crates/build/src/commands.rs | 6 +- rust/crates/build/src/detect.rs | 9 +- rust/crates/build/src/manifest.rs | 8 +- rust/crates/build/src/manifest/run.rs | 198 ++++++++++ rust/crates/build/src/outputs.rs | 5 +- rust/crates/build/src/plans.rs | 89 ++++- .../crates/core/src/tests/plugin_run_types.rs | 371 ++++++++++++++++++ .../execution/src/configuration/form.rs | 61 ++- .../execution/src/configuration/merge.rs | 6 + rust/crates/execution/src/provider_runs.rs | 213 +++++++--- rust/crates/plugin-manifest/src/validation.rs | 14 + rust/crates/plugin-model/src/capabilities.rs | 6 +- shared/plugins/contract/v1/README.md | 34 ++ .../contract/v1/plugin-manifest.schema.json | 24 +- .../reference/capabilities-and-versions.md | 2 + .../reference/domains/build-systems.md | 4 +- .../plugins/reference/protocol-changelog.md | 5 + 17 files changed, 975 insertions(+), 80 deletions(-) diff --git a/rust/crates/build/src/commands.rs b/rust/crates/build/src/commands.rs index 67bd0705..283bc9e7 100644 --- a/rust/crates/build/src/commands.rs +++ b/rust/crates/build/src/commands.rs @@ -410,11 +410,13 @@ pub fn build_dependency_plan_command(payload: Value) -> Result /// `build.decodeModel`: the normalized model and its run entries. pub fn build_decode_model_command(payload: Value) -> Result { - with_build_system::( + with_manifest::( payload, "build.decodeModel", "model", - |build_system, request: &DecodeModelRequest| outputs::decode_model(build_system, request), + |build_system, request: &DecodeModelRequest, manifest| { + outputs::decode_model(manifest.id(), build_system, request) + }, ) } diff --git a/rust/crates/build/src/detect.rs b/rust/crates/build/src/detect.rs index 53fd733c..68340cd8 100644 --- a/rust/crates/build/src/detect.rs +++ b/rust/crates/build/src/detect.rs @@ -124,7 +124,14 @@ fn instance( if matches!(declaration.model, Some(ModelSource::Static { .. })) { let source = source_marker(declaration, workspace, root); match read_model(declaration, workspace, root, None, None, None).and_then(|model| { - let value = model_value(declaration, &model, root, stored, source.as_deref())?; + let value = model_value( + owner.plugin_id, + declaration, + &model, + root, + stored, + source.as_deref(), + )?; Ok((model, value)) }) { Ok((model, value)) => { diff --git a/rust/crates/build/src/manifest.rs b/rust/crates/build/src/manifest.rs index 617616fe..9cf6c705 100644 --- a/rust/crates/build/src/manifest.rs +++ b/rust/crates/build/src/manifest.rs @@ -189,6 +189,12 @@ pub fn validate_declarations( } impl BuildSystemDeclaration { + /// Whether a run targets a declared `runConfigurationTypes` kind from the + /// build model, which `runConfigurationTypes` 1 introduced. + pub fn has_generated_run_configuration_types(&self) -> bool { + self.run.iter().any(|run| run.configuration_type.is_some()) + } + /// Whether a run starts entrypoints the provider finds in files, which /// `buildProviders` 1 introduced. pub fn has_run_entrypoints(&self) -> bool { @@ -238,8 +244,8 @@ impl BuildSystemDeclaration { self.validate_invocation(field, &option_ids, context)?; let model_templates = self.validate_tasks(field, &option_ids)?; self.validate_model(field, &option_ids)?; - self.validate_run(field, &option_ids, &model_templates)?; self.validate_run_types(field, &option_ids)?; + self.validate_run(field, &option_ids, &model_templates)?; self.validate_test(field, &option_ids)?; self.validate_diagnostics(field)?; self.validate_dependencies(field, &option_ids)?; diff --git a/rust/crates/build/src/manifest/run.rs b/rust/crates/build/src/manifest/run.rs index 6c6e1032..e54d7ca1 100644 --- a/rust/crates/build/src/manifest/run.rs +++ b/rust/crates/build/src/manifest/run.rs @@ -35,6 +35,17 @@ pub(crate) struct RunDeclaration { /// project. It applies to no target and is never listed per target. #[serde(default, skip_serializing_if = "std::ops::Not::not")] pub(crate) entrypoints: bool, + /// `runConfigurationTypes` 1: ID of a `runConfigurationTypes` entry in + /// this build system. Each matching target materializes a generated + /// configuration of that declared kind instead of a raw command or + /// provider run, sharing the kind's icon, group and editor form. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub(crate) configuration_type: Option, + /// `runConfigurationTypes` 1: initial field values for `configurationType`, + /// keyed by declared field ID. String values and `arguments` list items + /// may reference target and project template variables. + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub(crate) values: BTreeMap, } /// Native launch binds a local adapter; connection attach names a public registry type. @@ -107,6 +118,71 @@ impl BuildSystemDeclaration { "Run IDs are unique identifiers that start with a letter.", )); } + if !run.values.is_empty() && run.configuration_type.is_none() { + return Err(invalid( + format!("{field}.values"), + "Run field values require configurationType.", + )); + } + if let Some(type_id) = run.configuration_type.as_deref() { + if run.source == TaskSource::Provider + || run.debug.is_some() + || run.entrypoints + || run.from_tasks.is_some() + || !run.arguments.is_empty() + || !run.extension.is_empty() + || run.execution.is_some() + { + return Err(invalid( + &field, + "A run entry with configurationType uses target tags, field values, and the declared type's command line.", + )); + } + let Some(targets) = &mut run.from_targets else { + return Err(invalid( + format!("{field}.fromTargets"), + "A run entry with configurationType requires fromTargets.", + )); + }; + if targets.tags.is_empty() + || targets.tags.len() > MAX_LIST + || targets.tags.iter().any(|tag| !is_tag(tag)) + { + return Err(invalid( + format!("{field}.fromTargets.tags"), + "fromTargets needs one or more tag identifiers.", + )); + } + targets.tags = sorted_unique(std::mem::take(&mut targets.tags)); + let Some(run_type) = self + .run_configuration_types + .iter() + .find(|declared| declared.id == type_id) + else { + return Err(invalid( + format!("{field}.configurationType"), + format!( + "configurationType {type_id} is not declared in runConfigurationTypes." + ), + )); + }; + let allowed = Allowed { + root: true, + project: Availability::Always, + target: Availability::Always, + ..Allowed::none() + }; + if let Some(name) = &run.name { + template::validate_text(name, &allowed, &format!("{field}.name"))?; + } + validate_run_type_values( + run_type, + &run.values, + &allowed, + &format!("{field}.values"), + )?; + continue; + } if run.debug.is_some() && run.source != TaskSource::Provider { return Err(invalid( &field, @@ -259,3 +335,125 @@ impl BuildSystemDeclaration { Ok(()) } } + +/// Checks `values` of a `buildSystems[].run[]` entry that targets `run_type`. +fn validate_run_type_values( + run_type: &RunTypeDeclaration, + values: &BTreeMap, + allowed: &Allowed<'_>, + field: &str, +) -> Validation<()> { + for (id, value) in values { + let value_field = format!("{field}.{id}"); + let Some(declared) = run_type.fields.iter().find(|entry| entry.id == *id) else { + return Err(invalid( + value_field, + format!( + "{id} is not a field of runConfigurationType {}.", + run_type.id + ), + )); + }; + match (declared.kind, value) { + ( + RunFieldKind::Text + | RunFieldKind::Choice + | RunFieldKind::File + | RunFieldKind::Directory, + Value::String(text), + ) => { + if text.len() > MAX_TEXT || text.contains('\0') { + return Err(invalid(value_field, "Field value is invalid.")); + } + template::validate_text(text, allowed, &value_field)?; + if declared.kind == RunFieldKind::Choice + && !text.contains("${") + && !declared.choices.iter().any(|choice| choice.value == *text) + { + return Err(invalid( + value_field, + "Choice field value must match one of the declared choices.", + )); + } + } + (RunFieldKind::Checkbox, Value::Bool(_)) => {} + (RunFieldKind::Arguments, Value::Array(items)) => { + if items.len() > 64 { + return Err(invalid(value_field, "Too many arguments in field value.")); + } + for (item_index, item) in items.iter().enumerate() { + let Some(text) = item.as_str() else { + return Err(invalid( + format!("{value_field}[{item_index}]"), + "Arguments field values must be strings.", + )); + }; + if text.len() > MAX_TEXT || text.contains('\0') { + return Err(invalid( + format!("{value_field}[{item_index}]"), + "Field value is invalid.", + )); + } + template::validate_text( + text, + allowed, + &format!("{value_field}[{item_index}]"), + )?; + } + } + _ => { + return Err(invalid( + value_field, + "Field value does not match the declared field kind.", + )); + } + } + } + + // Ensure every visible required field without a default is supplied. + let mut effective: BTreeMap<&str, Value> = BTreeMap::new(); + for declared in &run_type.fields { + let visible = declared.visible_when.as_ref().is_none_or(|condition| { + effective + .get(condition.field.as_str()) + .is_some_and(|actual| *actual == condition.equals) + }); + if !visible { + continue; + } + let chosen = values + .get(&declared.id) + .cloned() + .or_else(|| declared.default.clone()) + .or_else(|| { + (declared.kind == RunFieldKind::Choice) + .then(|| { + declared + .choices + .first() + .map(|choice| Value::String(choice.value.clone())) + }) + .flatten() + }) + .or_else(|| (declared.kind == RunFieldKind::Checkbox).then_some(Value::Bool(false))); + let empty = match &chosen { + None => true, + Some(Value::String(text)) => text.trim().is_empty(), + Some(Value::Array(items)) => items.is_empty(), + Some(_) => false, + }; + if declared.required && empty { + return Err(invalid( + format!("{field}.{}", declared.id), + format!( + "Required field {} of runConfigurationType {} must have a value or default.", + declared.id, run_type.id + ), + )); + } + if let Some(chosen) = chosen { + effective.insert(&declared.id, chosen); + } + } + Ok(()) +} diff --git a/rust/crates/build/src/outputs.rs b/rust/crates/build/src/outputs.rs index 5e5bf8f7..864aef9c 100644 --- a/rust/crates/build/src/outputs.rs +++ b/rust/crates/build/src/outputs.rs @@ -178,13 +178,14 @@ pub(crate) fn source_marker( /// The model with the run entries derived from it. pub(crate) fn model_value( + plugin_id: &str, build_system: &BuildSystemDeclaration, model: &BuildModel, root: &str, options: &BTreeMap, source: Option<&str>, ) -> Validation { - let run = plans::run_entries(build_system, model, root, options, source)?; + let run = plans::run_entries(plugin_id, build_system, model, root, options, source)?; let mut value = serde_json::to_value(model).map_err(|error| decode::invalid_output(error.to_string()))?; value["run"] = json!(run); @@ -200,6 +201,7 @@ pub(crate) fn model_value( /// `build.decodeModel`. pub(crate) fn decode_model( + plugin_id: &str, build_system: &BuildSystemDeclaration, request: &DecodeModelRequest, ) -> Validation { @@ -215,6 +217,7 @@ pub(crate) fn decode_model( )?; let source = source_marker(build_system, &workspace, &root); model_value( + plugin_id, build_system, &model, &root, diff --git a/rust/crates/build/src/plans.rs b/rust/crates/build/src/plans.rs index 05bffe7e..197b3f44 100644 --- a/rust/crates/build/src/plans.rs +++ b/rust/crates/build/src/plans.rs @@ -11,8 +11,8 @@ use super::decode::{self, join_relative}; use super::manifest::{ BuildExecution, BuildSystemDeclaration, DependenciesSource, ExecutableCandidate, ModelSource, - OutputChannel, ProviderDeclaration, RunDeclaration, Scope, TaskSource, TestDeclaration, - TestFilter, TestResultsSource, WorkingDirectory, + OutputChannel, ProviderDeclaration, RunDeclaration, RunTypeRole, Scope, TaskSource, + TestDeclaration, TestFilter, TestResultsSource, WorkingDirectory, }; use super::model::{entry_id, BuildModel, ModelProject}; use super::options::{self, OptionContribution}; @@ -1113,12 +1113,14 @@ struct EntryParts<'a> { arguments: Vec, execution: BuildExecution, extension: Map, + run_type: Option, binding: (&'static str, String), } /// Run entries at the given options, from every run declaration. Entries /// whose templates need a value the model did not record are left out. pub(crate) fn run_entries( + plugin_id: &str, build_system: &BuildSystemDeclaration, model: &BuildModel, root: &str, @@ -1185,6 +1187,21 @@ pub(crate) fn run_entries( let mut values = context.values(&[]); values.project = Some(project_selection.selected()); values.target = Some(target_selection.selected()); + if let Some(type_id) = run.configuration_type.as_deref() { + if let Some(entry) = run_type_entry_parts( + plugin_id, + build_system, + run, + type_id, + project, + &values, + &target.name, + ("targetID", target.id.clone()), + ) { + parts.push(entry); + } + continue; + } if let Some(entry) = entry_parts( &context, run, @@ -1251,8 +1268,13 @@ pub(crate) fn run_entries( WorkingDirectory::Project => part.project.path.clone(), WorkingDirectory::Root => context.root.clone(), }; - let provider = format!("{}.{}", build_system.id, part.run.id); - let id = entry_id(&provider, &cwd, &part.name); + let id_namespace = format!("{}.{}", build_system.id, part.run.id); + let provider = if part.run_type.is_some() { + lithe_execution::RUN_TYPE_PROVIDER.to_string() + } else { + id_namespace.clone() + }; + let id = entry_id(&id_namespace, &cwd, &part.name); if !seen.insert(id.clone()) { continue; } @@ -1261,10 +1283,10 @@ pub(crate) fn run_entries( "name": part.name, "provider": provider, "execution": part.execution, - "command": command, + "command": if part.run_type.is_some() { None } else { command }, "args": part.arguments, "cwd": cwd, - "env": context.contribution.environment, + "env": if part.run_type.is_some() { json!({}) } else { json!(context.contribution.environment) }, "source": source, "buildSystem": { "id": build_system.id, @@ -1274,6 +1296,9 @@ pub(crate) fn run_entries( "optionFingerprint": context.fingerprint, }, }); + if let Some(run_type) = part.run_type { + entry["runType"] = run_type; + } if !part.extension.is_empty() { entry["extensions"] = json!({ build_system.id.clone(): part.extension }); } @@ -1283,6 +1308,57 @@ pub(crate) fn run_entries( Ok(entries.into_iter().map(|(_, _, _, entry)| entry).collect()) } +#[allow(clippy::too_many_arguments)] +fn run_type_entry_parts<'a>( + plugin_id: &str, + build_system: &BuildSystemDeclaration, + run: &'a RunDeclaration, + type_id: &str, + project: &'a ModelProject, + values: &Values<'_>, + default_name: &str, + binding: (&'static str, String), +) -> Option> { + let declared = build_system.run_type(RunTypeRole::Configuration, type_id)?; + let name = match &run.name { + Some(name) => template::expand_text(name, values).ok()?, + None => default_name.to_string(), + }; + let mut expanded_values = Map::new(); + for (field_id, raw) in &run.values { + let expanded = match raw { + Value::String(text) => Value::String(template::expand_text(text, values).ok()?), + Value::Bool(flag) => Value::Bool(*flag), + Value::Array(items) => { + let mut out = Vec::with_capacity(items.len()); + for item in items { + let text = item.as_str()?; + out.push(Value::String(template::expand_text(text, values).ok()?)); + } + Value::Array(out) + } + _ => return None, + }; + expanded_values.insert(field_id.clone(), expanded); + } + let run_type = json!({ + "pluginID": plugin_id, + "buildSystemID": build_system.id, + "type": type_id, + "values": expanded_values, + }); + Some(EntryParts { + run, + project, + name, + arguments: Vec::new(), + execution: declared.execution.unwrap_or(BuildExecution::Application), + extension: Map::new(), + run_type: Some(run_type), + binding, + }) +} + #[allow(clippy::too_many_arguments)] fn entry_parts<'a>( context: &PlanContext<'_>, @@ -1315,6 +1391,7 @@ fn entry_parts<'a>( arguments: argv, execution, extension, + run_type: None, binding, }) } diff --git a/rust/crates/core/src/tests/plugin_run_types.rs b/rust/crates/core/src/tests/plugin_run_types.rs index 8f7bf01f..f92fc61d 100644 --- a/rust/crates/core/src/tests/plugin_run_types.rs +++ b/rust/crates/core/src/tests/plugin_run_types.rs @@ -834,3 +834,374 @@ fn set(manifest: &mut Value, pointer: &str, value: Value) { _ => panic!("{parent} is not a container"), } } + +fn generated_run_type_manifest() -> Value { + json!({ + "schemaVersion": 0, + "id": "dev.lithe.test.generated-run-types", + "displayName": "Synthetic Task Tool", + "version": "1.0.0", + "pluginAPIVersion": 0, + "requires": { + "buildSystems": 0, + "runConfigurationTypes": 1 + }, + "vendor": { + "id": "dev.lithe.test", + "displayName": "Synthetic", + "signatureRequirement": "publisherPackage" + }, + "permissions": ["process.build"], + "activationEvents": ["onBuildSystem:tasker"], + "buildSystems": [{ + "id": "tasker", + "displayName": "Tasker", + "detection": { "markers": ["Taskfile"] }, + "invocation": { + "executables": [{ "kind": "command", "command": "tasker" }] + }, + "model": { + "source": "command", + "arguments": ["--dump"], + "output": "stdout", + "decoder": "litheBuildModel", + "executesProjectCode": false, + "mayUseNetwork": false + }, + "runConfigurationTypes": [{ + "id": "target", + "displayName": "Tasker Target", + "execution": "task", + "fields": [ + { + "id": "targets", + "title": "Targets", + "kind": "arguments", + "required": true + }, + { + "id": "profile", + "title": "Profile", + "kind": "choice", + "choices": [ + { "value": "default", "title": "Default" }, + { "value": "release", "title": "Release" } + ], + "arguments": ["--profile", "${value}"] + }, + { + "id": "flags", + "title": "Flags", + "kind": "text", + "arguments": ["--flag", "${value}"] + } + ], + "arguments": ["${field:profile}", "${field:flags}", "${field:targets}", "${userArguments}"] + }], + "run": [{ + "id": "target", + "fromTargets": { "tags": ["target"] }, + "configurationType": "target", + "values": { + "targets": ["${target.name}"], + "profile": "release", + "flags": "${target.property:defaultFlag}" + } + }] + }] + }) +} + +#[test] +fn run_configuration_types_v1_validates_run_declarations() { + let validate = |manifest: Value| { + call( + "plugins.declarative.validate", + json!({ "manifest": manifest }), + )["data"] + .clone() + }; + + let valid = validate(generated_run_type_manifest()); + assert_eq!(valid["status"], "ok", "{valid}"); + + // Version 0 refuses configurationType on buildSystems[].run[]. + let mut requires_v0 = generated_run_type_manifest(); + requires_v0["requires"]["runConfigurationTypes"] = json!(0); + let outcome = validate(requires_v0); + assert_eq!(outcome["status"], "rejected", "{outcome}"); + assert_eq!(outcome["error"]["code"], "plugin.manifest.invalid"); + + // Unknown configurationType, invalid field/type/choice, missing required, forbidden combos. + let cases = [ + ( + "unknown configurationType", + "/buildSystems/0/run/0/configurationType", + json!("missing"), + ), + ( + "unknown field in values", + "/buildSystems/0/run/0/values/unknown", + json!("x"), + ), + ( + "mismatched type for arguments field", + "/buildSystems/0/run/0/values/targets", + json!("build"), + ), + ( + "unknown choice literal", + "/buildSystems/0/run/0/values/profile", + json!("nightly"), + ), + ( + "missing required field value", + "/buildSystems/0/run/0/values", + json!({ "profile": "default" }), + ), + ( + "forbidden provider source", + "/buildSystems/0/run/0/source", + json!("provider"), + ), + ( + "forbidden execution override", + "/buildSystems/0/run/0/execution", + json!("application"), + ), + ( + "forbidden raw arguments", + "/buildSystems/0/run/0/arguments", + json!(["run"]), + ), + ]; + for (name, pointer, value) in cases { + let mut bad = generated_run_type_manifest(); + set(&mut bad, pointer, value); + let outcome = validate(bad); + assert_eq!(outcome["status"], "rejected", "{name}: {outcome}"); + assert_eq!( + outcome["error"]["code"], "plugin.manifest.invalid", + "{name}: {outcome}" + ); + } + + // `values` without `configurationType` is rejected. + let mut values_without_type = generated_run_type_manifest(); + let run = values_without_type["buildSystems"][0]["run"][0] + .as_object_mut() + .unwrap(); + run.remove("configurationType"); + run.insert("arguments".into(), json!(["${target.name}"])); + let outcome = validate(values_without_type); + assert_eq!(outcome["status"], "rejected", "{outcome}"); + assert_eq!(outcome["error"]["code"], "plugin.manifest.invalid"); +} + +#[test] +fn generated_run_type_decodes_generates_edits_launches_and_copies() { + let root = temporary_root("generated-run-type-flow"); + let _cleanup = Cleanup(root.clone()); + fs::create_dir_all(root.join("sub")).unwrap(); + fs::write(root.join("sub/Taskfile"), "build:\n\techo hi\n").unwrap(); + + let manifest = generated_run_type_manifest(); + let run_type_plugins = json!({ "plugins": [{ "manifest": manifest }] }); + + // 1. Decode model: Core expands templates into `model.run[].runType`. + let raw_model = json!({ + "format": "litheBuildModel", + "version": 0, + "projects": [{ + "id": "sub", + "name": "sub", + "path": "." + }], + "targets": [{ + "id": "sub:build", + "projectID": "sub", + "name": "build", + "path": ".", + "tags": ["target"], + "properties": { "defaultFlag": "fast" } + }] + }) + .to_string(); + let decoded = call( + "build.decodeModel", + json!({ + "manifest": manifest, + "buildSystemID": "tasker", + "request": { + "workspaceRoot": root, + "root": "sub", + "output": raw_model, + }, + }), + ); + assert_eq!(decoded["ok"], true, "{decoded}"); + let run_entries = decoded["data"]["model"]["run"].as_array().unwrap(); + assert_eq!(run_entries.len(), 1, "{decoded}"); + let entry = &run_entries[0]; + assert_eq!(entry["provider"], "build.run-type"); + assert_eq!(entry["name"], "build"); + assert_eq!(entry["cwd"], "sub"); + assert_eq!(entry["execution"], "task"); + assert_eq!( + entry["runType"], + json!({ + "pluginID": "dev.lithe.test.generated-run-types", + "buildSystemID": "tasker", + "type": "target", + "values": { + "targets": ["build"], + "profile": "release", + "flags": "fast" + } + }) + ); + + // 2. Generate and resolve: materializes a `generated:run-type:*` configuration. + let snapshot = json!([{ + "projectPath": "sub", + "name": entry["name"], + "cwd": entry["cwd"], + "execution": entry["execution"], + "selector": entry["id"], + "runType": entry["runType"], + }]); + let generated = call( + "runConfig.generate", + json!({ "root": root, "providerRuns": snapshot }), + ); + assert_eq!(generated["ok"], true, "{generated}"); + let gen_id = generated["data"]["generated"]["configurations"][0]["id"] + .as_str() + .unwrap() + .to_string(); + assert!(gen_id.starts_with("generated:run-type:"), "{gen_id}"); + + let resolved = call("runConfig.resolve", json!({ "root": root })); + assert_eq!(resolved["ok"], true, "{resolved}"); + let config = resolved["data"]["configurations"] + .as_array() + .unwrap() + .iter() + .find(|item| item["id"] == gen_id) + .expect("generated run-type configuration resolves"); + assert_eq!(config["provider"], "build.run-type"); + assert_eq!(config["cwd"], "sub"); + assert_eq!(config["plugin"]["id"], "dev.lithe.test.generated-run-types"); + assert!(config["availability"].is_null()); + + // 3. Plan launch directly from the generated configuration. + let initial_plan = call( + "build.runConfigurationPlan", + json!({ + "manifest": manifest, + "buildSystemID": "tasker", + "workspaceRoot": root, + "request": super::support::trusted(json!({ + "configurationId": gen_id, + "instances": [{ "root": "sub" }], + })), + }), + ); + assert_eq!(initial_plan["ok"], true, "{initial_plan}"); + assert_eq!(initial_plan["data"]["status"], "ok", "{initial_plan}"); + assert_eq!( + initial_plan["data"]["plan"]["arguments"], + json!(["--profile", "release", "--flag", "fast", "build"]) + ); + assert_eq!(initial_plan["data"]["plan"]["workingDirectory"], "sub"); + + // 4. Open editor form on the generated entry, clear optional `flags`, and + // reset `workingDirectory` from `sub` back to `.` — neither generated value + // may leak back after merge. + let form = call( + "runConfig.editorForm", + json!({ + "root": root, + "configurationId": gen_id, + "runTypePlugins": run_type_plugins, + }), + ); + assert_eq!(form["ok"], true, "{form}"); + assert_eq!(form["data"]["values"]["field:targets"], "build"); + assert_eq!(form["data"]["values"]["field:flags"], "fast"); + assert_eq!(form["data"]["values"]["workingDirectory"], "sub"); + + let saved = call( + "runConfig.saveConfiguration", + json!({ + "root": root, + "provider": "build.run-type", + "runType": { + "pluginID": "dev.lithe.test.generated-run-types", + "buildSystemID": "tasker", + "type": "target" + }, + "configurationId": gen_id, + "runTypePlugins": run_type_plugins, + "values": { + "name": "build-custom", + "workingDirectory": ".", + "field:targets": "build test", + "field:profile": "default", + "field:flags": "", + "programArguments": "--verbose", + }, + }), + ); + assert_eq!(saved["data"]["status"], "saved", "{saved}"); + assert_eq!(saved["data"]["id"], gen_id); + assert_eq!( + changed_run_paths(&saved["data"]), + vec![".lithe/run/plugin/dev.lithe.test.generated-run-types.local.toml"] + ); + apply_run_changes(&root, &saved["data"]); + + let edited_plan = call( + "build.runConfigurationPlan", + json!({ + "manifest": manifest, + "buildSystemID": "tasker", + "workspaceRoot": root, + "request": super::support::trusted(json!({ + "configurationId": gen_id, + "instances": [{ "root": "sub" }], + })), + }), + ); + assert_eq!(edited_plan["ok"], true, "{edited_plan}"); + assert_eq!(edited_plan["data"]["status"], "ok", "{edited_plan}"); + assert_eq!( + edited_plan["data"]["plan"]["arguments"], + json!(["--profile", "default", "build", "test", "--verbose"]) + ); + assert_eq!(edited_plan["data"]["plan"]["workingDirectory"], "."); + + // 5. Copy the generated configuration into a standalone user configuration. + let copied = call( + "runConfig.copyConfiguration", + json!({ + "root": root, + "configurationId": gen_id, + "name": "My Build Copy", + }), + ); + assert_eq!(copied["ok"], true, "{copied}"); + let copy_id = copied["data"]["id"].as_str().unwrap(); + assert!(copy_id.starts_with("user:"), "{copy_id}"); + apply_run_changes(&root, &copied["data"]); + + let after_copy = call("runConfig.resolve", json!({ "root": root })); + let ids: Vec<&str> = after_copy["data"]["configurations"] + .as_array() + .unwrap() + .iter() + .filter_map(|item| item["id"].as_str()) + .collect(); + assert!(ids.contains(&gen_id.as_str()), "{ids:?}"); + assert!(ids.contains(©_id), "{ids:?}"); +} diff --git a/rust/crates/execution/src/configuration/form.rs b/rust/crates/execution/src/configuration/form.rs index d82bf284..be8b1a5d 100644 --- a/rust/crates/execution/src/configuration/form.rs +++ b/rust/crates/execution/src/configuration/form.rs @@ -93,7 +93,7 @@ pub fn editor_form(request: EditorFormRequest) -> Result { let run_types = &request.run_types; let (editor, mut values) = match request.configuration_id.as_deref() { Some(id) => { - let saved = SavedEntry::find(&layers, id)?; + let saved = SavedEntry::find(&root, &layers, id)?; let editor = saved.editor(run_types)?; if request.provider.is_some() && !Editor::new( @@ -186,7 +186,7 @@ pub fn save_configuration(request: SaveConfigurationRequest) -> Result { - let saved = SavedEntry::find(&layers, id)?; + let saved = SavedEntry::find(&root, &layers, id)?; if !saved.editor(run_types)?.same(editor) { return Err(different_provider()); } @@ -264,10 +264,14 @@ pub fn save_configuration(request: SaveConfigurationRequest) -> Result, key: &str, value: } } -/// A saved configuration as both layers hold it. +/// A configuration as the generated, project and local layers hold it. struct SavedEntry { id: String, - /// The project entry with the local entry merged over it. + /// The generated entry (if any) with the project and local entries merged over it. merged: Value, /// Whether the project layer holds it. in_project: bool, + /// Working directory of the underlying generated entry, so overriding it + /// back to `.` writes `"cwd": "."` instead of dropping the key. + generated_cwd: Option, } impl SavedEntry { - fn find(layers: &Layers, id: &str) -> Result { + fn find(root: &Path, layers: &Layers, id: &str) -> Result { let item = |document: &Value| { document["configurations"] .as_array() .and_then(|items| items.iter().find(|item| item["id"] == id)) .cloned() }; + let generated = generated_layer::get(root).and_then(|document| { + document + .configurations + .iter() + .find(|configuration| configuration.id == id) + .map(|configuration| { + ( + configuration.cwd.clone(), + serde_json::to_value(configuration).expect("run configuration encodes"), + ) + }) + }); + let (generated_cwd, generated_entry) = match generated { + Some((cwd, entry)) => (Some(cwd), Some(entry)), + None => (None, None), + }; let project = item(&layers.project.document); let local = item(&layers.local.document); - let merged = match (project.clone(), local) { - (Some(mut merged), Some(local)) => { - merge_configuration_value(&mut merged, &local)?; - merged - } - (Some(entry), None) | (None, Some(entry)) => entry, - (None, None) => { - return Err(CoreError::new( - ErrorCode::InvalidRequest, - "Run configuration was not found", - )) + let mut merged: Option = None; + for entry in [generated_entry, project.clone(), local] + .into_iter() + .flatten() + { + match &mut merged { + Some(current) => merge_configuration_value(current, &entry)?, + None => merged = Some(entry), } + } + let Some(merged) = merged else { + return Err(CoreError::new( + ErrorCode::InvalidRequest, + "Run configuration was not found", + )); }; Ok(Self { id: id.to_string(), merged, in_project: project.is_some(), + generated_cwd, }) } diff --git a/rust/crates/execution/src/configuration/merge.rs b/rust/crates/execution/src/configuration/merge.rs index e7bba4f9..f0278bed 100644 --- a/rust/crates/execution/src/configuration/merge.rs +++ b/rust/crates/execution/src/configuration/merge.rs @@ -198,6 +198,12 @@ pub(crate) fn merge_extensions( .entry(namespace.clone()) .or_insert_with(|| json!({})); match (slot.as_object_mut(), value.as_object()) { + (Some(_), Some(incoming)) if namespace == "build" && incoming.contains_key("type") => { + // A saved `build.run-type` reference is a complete set of field + // values; replacing it wholesale ensures cleared optional fields + // do not leak back from an underlying generated entry. + *slot = value.clone(); + } (Some(existing), Some(incoming)) => { for (key, item) in incoming { if namespace == "build-run" && key == "tools" { diff --git a/rust/crates/execution/src/provider_runs.rs b/rust/crates/execution/src/provider_runs.rs index e652372a..7754dd4b 100644 --- a/rust/crates/execution/src/provider_runs.rs +++ b/rust/crates/execution/src/provider_runs.rs @@ -1,24 +1,85 @@ -//! Validates and materializes opaque provider run selectors from current model snapshots. -//! Tool, framework, runtime and configuration semantics remain with the selected provider. +//! Validates and materializes generated run snapshots from current build models. +//! Tool, framework, runtime and configuration semantics remain with the selected plugin. -use super::configuration::{BuildProviderRunReference, RunConfiguration}; -use super::types::{Confidence, RunCategory}; +use super::configuration::{ + BuildProviderRunReference, RunConfiguration, RunTypeReference, RUN_TYPE_PROVIDER, +}; +use super::types::{Confidence, Execution, RunCategory}; use lithe_platform::paths::invalid_portable_relative_path; use lithe_protocol::{CoreError, ErrorCode}; use serde::{Deserialize, Serialize}; -use serde_json::Value; +use serde_json::{json, Value}; use std::collections::{BTreeMap, BTreeSet}; -/// One declared provider run applied to an upstream target, independent of language imports. +/// One generated run entry derived from a loaded build model, independent of +/// language imports. +#[derive(Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum ProviderRunConfiguration { + /// Opaque build provider run selector (`build.provider`). + Provider(ProviderRunSelector), + /// Generated entry of a plugin-declared `runConfigurationTypes` kind (`build.run-type`). + RunType(GeneratedRunTypeConfiguration), +} + +/// One declared provider run applied to an upstream target (`build.provider`). #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProviderRunConfiguration { +pub struct ProviderRunSelector { /// Workspace-relative current model project; never inferred from a descriptor. pub project_path: String, pub name: String, pub reference: BuildProviderRunReference, } +/// One generated entry of a plugin-declared `runConfigurationTypes` kind (`build.run-type`). +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct GeneratedRunTypeConfiguration { + /// Workspace-relative current model project. + pub project_path: String, + pub name: String, + /// Workspace-relative working directory (`.` for the workspace root). + pub cwd: String, + /// Execution mode declared by the target `runConfigurationTypes` kind. + #[serde(default)] + pub execution: Execution, + /// Stable model selector identity (for example the model run entry id). + pub selector: String, + /// Declared kind and template-expanded field values. + pub run_type: RunTypeReference, +} + +impl ProviderRunConfiguration { + /// Deterministic generated configuration ID for this snapshot entry. + pub(crate) fn generated_id(&self) -> String { + match self { + Self::Provider(run) => run.reference.generated_id(), + Self::RunType(run) => generated_run_type_id(&run.run_type, &run.cwd, &run.selector), + } + } +} + +fn generated_run_type_id(run_type: &RunTypeReference, cwd: &str, selector: &str) -> String { + use sha2::{Digest, Sha256}; + let digest = Sha256::digest( + serde_json::to_vec(&json!({ + "pluginID": run_type.plugin_id, + "buildSystemID": run_type.build_system_id, + "type": run_type.type_id, + "cwd": cwd, + "selector": selector, + })) + .expect("validated run-type identity encodes"), + ); + let mut hex = String::with_capacity(16); + for byte in &digest[..8] { + use std::fmt::Write; + let _ = write!(&mut hex, "{byte:02x}"); + } + format!("generated:run-type:{hex}") +} + fn contains(root: &str, path: &str) -> bool { root == "." || root == path || path.starts_with(&(root.to_string() + "/")) } @@ -31,17 +92,44 @@ pub(super) fn validate(runs: &[ProviderRunConfiguration]) -> Result<(), CoreErro } let mut identities = BTreeSet::new(); for run in runs { - run.reference.validate()?; - if run.name.trim().is_empty() - || run.name.len() > 4096 - || run.name.chars().any(char::is_control) - || invalid_portable_relative_path(&run.project_path) - || run.project_path.len() > 4096 - || !contains(&run.reference.root, &run.project_path) - || !run.reference.user_arguments.is_empty() - || !identities.insert(run.reference.generated_id()) - { - return Err(invalid()); + match run { + ProviderRunConfiguration::Provider(run) => { + run.reference.validate()?; + if run.name.trim().is_empty() + || run.name.len() > 4096 + || run.name.chars().any(char::is_control) + || invalid_portable_relative_path(&run.project_path) + || run.project_path.len() > 4096 + || !contains(&run.reference.root, &run.project_path) + || !run.reference.user_arguments.is_empty() + || !identities.insert(run.reference.generated_id()) + { + return Err(invalid()); + } + } + ProviderRunConfiguration::RunType(run) => { + run.run_type.validate()?; + if run.name.trim().is_empty() + || run.name.len() > 4096 + || run.name.chars().any(char::is_control) + || invalid_portable_relative_path(&run.project_path) + || run.project_path.len() > 4096 + || invalid_portable_relative_path(&run.cwd) + || run.cwd.len() > 4096 + || !contains(&run.cwd, &run.project_path) + || run.selector.trim().is_empty() + || run.selector.len() > 4096 + || run.selector.chars().any(char::is_control) + || matches!(run.execution, Execution::Service | Execution::Group) + || !identities.insert(generated_run_type_id( + &run.run_type, + &run.cwd, + &run.selector, + )) + { + return Err(invalid()); + } + } } } Ok(()) @@ -50,36 +138,67 @@ pub(super) fn validate(runs: &[ProviderRunConfiguration]) -> Result<(), CoreErro /// Materializes selectors without inventing commands, toolchains or adapter identities. pub(super) fn configurations(runs: &[ProviderRunConfiguration]) -> Vec { let mut ordered = runs.iter().collect::>(); - ordered.sort_by_key(|run| run.reference.generated_id()); + ordered.sort_by_key(|run| run.generated_id()); ordered .into_iter() - .map(|run| RunConfiguration { - id: run.reference.generated_id(), - name: run.name.clone(), - folder: None, - provider: "build.provider".to_string(), - execution: run.reference.execution.unwrap_or_default(), - category: RunCategory::Project, - command: None, - args: Vec::new(), - cwd: run.reference.root.clone(), - env: BTreeMap::new(), - confidence: Confidence::Declared, - toolchains: BTreeMap::new(), - debug: None, - members: Vec::new(), - extensions: [( - "build".to_string(), - serde_json::to_value(&run.reference).expect("validated reference encodes"), - )] - .into_iter() - .collect(), - before_launch: Vec::new(), - disabled: false, - allow_multiple_instances: false, - source: None, - plugin: None, - availability: None, + .map(|run| match run { + ProviderRunConfiguration::Provider(run) => RunConfiguration { + id: run.reference.generated_id(), + name: run.name.clone(), + folder: None, + provider: "build.provider".to_string(), + execution: run.reference.execution.unwrap_or_default(), + category: RunCategory::Project, + command: None, + args: Vec::new(), + cwd: run.reference.root.clone(), + env: BTreeMap::new(), + confidence: Confidence::Declared, + toolchains: BTreeMap::new(), + debug: None, + members: Vec::new(), + extensions: [( + "build".to_string(), + serde_json::to_value(&run.reference).expect("validated reference encodes"), + )] + .into_iter() + .collect(), + before_launch: Vec::new(), + disabled: false, + allow_multiple_instances: false, + source: None, + plugin: None, + availability: None, + }, + ProviderRunConfiguration::RunType(run) => RunConfiguration { + id: generated_run_type_id(&run.run_type, &run.cwd, &run.selector), + name: run.name.clone(), + folder: None, + provider: RUN_TYPE_PROVIDER.to_string(), + execution: run.execution, + category: RunCategory::Project, + command: None, + args: Vec::new(), + cwd: run.cwd.clone(), + env: BTreeMap::new(), + confidence: Confidence::Declared, + toolchains: BTreeMap::new(), + debug: None, + members: Vec::new(), + extensions: [( + "build".to_string(), + serde_json::to_value(&run.run_type) + .expect("validated run type reference encodes"), + )] + .into_iter() + .collect(), + before_launch: Vec::new(), + disabled: false, + allow_multiple_instances: false, + source: None, + plugin: None, + availability: None, + }, }) .collect() } @@ -88,7 +207,7 @@ pub(super) fn configurations(runs: &[ProviderRunConfiguration]) -> Vec String { use sha2::{Digest, Sha256}; let mut ordered = runs.iter().collect::>(); - ordered.sort_by_key(|run| run.reference.generated_id()); + ordered.sort_by_key(|run| run.generated_id()); let bytes = serde_json::to_vec(&ordered).expect("validated run snapshot encodes"); format!("sha256:{:x}", Sha256::digest(bytes)) } diff --git a/rust/crates/plugin-manifest/src/validation.rs b/rust/crates/plugin-manifest/src/validation.rs index 5d43a1be..5872d0fc 100644 --- a/rust/crates/plugin-manifest/src/validation.rs +++ b/rust/crates/plugin-manifest/src/validation.rs @@ -127,6 +127,20 @@ impl DeclarativePluginManifest { "executesProjectCode needs languageServers 1.", )); } + if self + .build_systems + .iter() + .any(|system| system.has_generated_run_configuration_types()) + && self + .requires + .get(capabilities::RUN_CONFIGURATION_TYPES) + .is_none_or(|version| *version < 1) + { + return Err(invalid( + "requires.runConfigurationTypes", + "Run entries targeting a runConfigurationType need runConfigurationTypes 1.", + )); + } if self .build_systems .iter() diff --git a/rust/crates/plugin-model/src/capabilities.rs b/rust/crates/plugin-model/src/capabilities.rs index 3837d910..efa583f6 100644 --- a/rust/crates/plugin-model/src/capabilities.rs +++ b/rust/crates/plugin-model/src/capabilities.rs @@ -75,7 +75,9 @@ pub const BUILD_PROVIDERS: &str = "buildProviders"; /// Optional public model snapshots between enabled build providers. pub const BUILD_MODEL_INPUTS: &str = "buildModelInputs"; /// `buildSystems[].runConfigurationTypes`: kinds of run configuration whose -/// editor fields and command line the plugin declares. +/// editor fields and command line the plugin declares. Version 1 lets a +/// `buildSystems[].run[]` entry target one of those kinds with +/// `configurationType` and field `values` expanded from the build model. pub const RUN_CONFIGURATION_TYPES: &str = "runConfigurationTypes"; /// `buildSystems[].beforeLaunchTasks`: kinds of before-launch step whose /// fields and command line the plugin declares, offered in a configuration's @@ -147,7 +149,7 @@ pub const SUPPORTED_CAPABILITIES: &[(&str, &[u32])] = &[ (PACKAGE_TRUST, &[0]), (PLUGIN_FUNCTIONS, &[0]), (PROJECT_GENERATORS, &[0]), - (RUN_CONFIGURATION_TYPES, &[0]), + (RUN_CONFIGURATION_TYPES, &[0, 1]), (SETTINGS, &[0]), (SOURCE_SETTINGS, &[0, 1]), (TOOL_DEFINITIONS, &[0, 1]), diff --git a/shared/plugins/contract/v1/README.md b/shared/plugins/contract/v1/README.md index ee62bf5b..b47a60c9 100644 --- a/shared/plugins/contract/v1/README.md +++ b/shared/plugins/contract/v1/README.md @@ -3078,6 +3078,40 @@ The type's text is translated in the package's `l10n/.json` under [Translations](#translations). A file that does not fit is refused whole with `plugin.build.invalidLocalization`, and the manifest's text is shown. +#### Auto-discovered run configurations (`runConfigurationTypes: 1`) + +With `runConfigurationTypes: 1`, a `buildSystems[].run[]` declaration may set +`configurationType` (naming one `runConfigurationTypes[].id` of the same build +system) and optional `values` (a map from declared field ID to initial value). +Each model target matching `fromTargets.tags` then materializes a generated +`build.run-type` configuration instead of a separate `build.provider` or raw +command entry, so discovered targets and user-created configurations share the +same group, icon, editor form, and `build.runConfigurationPlan` launch flow: + +```json +"run": [{ + "id": "target", + "fromTargets": { "tags": ["target"] }, + "configurationType": "target", + "values": { "targets": ["${target.name}"] } +}] +``` + +- Requires `fromTargets` and `requires.runConfigurationTypes: 1`; `source: "provider"`, + `debug`, `entrypoints`, `fromTasks`, `arguments`, `extension`, and `execution` + are refused (execution comes from the target `runConfigurationTypes` entry). +- Each key of `values` must name a declared field of `configurationType` with a + matching JSON type (`string` for `text`/`choice`/`file`/`directory`, `boolean` + for `checkbox`, array of strings for `arguments`). String values, `arguments` + items, and optional `name` may use `${root}`, `${project.*}`, and + `${target.*}` template variables. Every visible `required` field without a + default must be supplied. +- Core expands `values` when decoding the model (`model.run[].runType`) and + materializes deterministic `generated:run-type:` configurations in + `runConfig.generate`. Opening one in `runConfig.editorForm` and saving with + `runConfig.saveConfiguration` writes user overrides under that ID to the + plugin's run document (`.lithe/run/plugin/.local.toml` or `.toml`). + ### Before-launch tasks `beforeLaunchTasks` adds kinds of step to the *Before launch* list every run diff --git a/shared/plugins/contract/v1/plugin-manifest.schema.json b/shared/plugins/contract/v1/plugin-manifest.schema.json index 42c846f1..85671e55 100644 --- a/shared/plugins/contract/v1/plugin-manifest.schema.json +++ b/shared/plugins/contract/v1/plugin-manifest.schema.json @@ -10,6 +10,7 @@ {"if": {"required": ["outputLinkMatchers"]}, "then": {"properties": {"requires": {"required": ["outputLinkMatchers"]}}}}, {"if": {"required": ["toolDefinitions"]}, "then": {"properties": {"requires": {"required": ["toolDefinitions"]}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["runConfigurationTypes"]}}}}, "then": {"properties": {"requires": {"required": ["runConfigurationTypes"]}}}}, + {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["run"], "properties": {"run": {"contains": {"required": ["configurationType"]}}}}}}}, "then": {"properties": {"requires": {"required": ["runConfigurationTypes"], "properties": {"runConfigurationTypes": {"const": 1}}}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["beforeLaunchTasks"]}}}}, "then": {"properties": {"requires": {"required": ["beforeLaunchTasks"]}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["test"], "properties": {"test": {"required": ["discoveryCommand"]}}}}}}, "then": {"properties": {"requires": {"required": ["buildSystems"], "properties": {"buildSystems": {"const": 1}}}}}}, {"if": {"required": ["commandInstallers"]}, "then": {"required": ["permissions"], "properties": {"requires": {"required": ["commandInstallers"]}, "permissions": {"contains": {"const": "commands.install"}}}}}, @@ -47,7 +48,7 @@ "outputLinkMatchers": { "description": "Required exactly when outputLinkMatchers is non-empty.", "enum": [0] }, "packageTrust": { "description": "Required exactly when vendor.bundledSignatureRequirement is present.", "enum": [0] }, "projectGenerators": { "description": "Entries of the New Project window: fields, requirements, and steps, with tool fields that pick tool installations.", "enum": [0] }, - "runConfigurationTypes": { "description": "Required exactly when any buildSystems[].runConfigurationTypes is non-empty: kinds of run configuration the user creates in the Run/Debug Configurations dialog, drawn from declared fields and run through a declared command line. Needs buildSystems.", "enum": [0] }, + "runConfigurationTypes": { "description": "Required exactly when any buildSystems[].runConfigurationTypes is non-empty: kinds of run configuration the user creates in the Run/Debug Configurations dialog, drawn from declared fields and run through a declared command line. Version 1 adds buildSystems[].run[].configurationType and values so auto-discovered model targets materialize entries of a declared run configuration type. Needs buildSystems.", "enum": [0, 1] }, "settings": { "description": "Required exactly when settings, settingActions or settingRegions is non-empty. Covers integer, enum, boolean, multiSelect, text, file, and directory options, scope, effect, page, section, settingActions, and settingRegions.", "enum": [0] }, "sourceSettings": { "description": "Required exactly when a setting action declares sourceEditor. Native-source settings projection, compiler placement, confirmed staging and read-back. Version 1 adds sidebar groups, nested sources, field sections and entry lists.", "enum": [0, 1] }, "toolDefinitions": { "description": "Required exactly when toolDefinitions is present. Version 1 adds the display-only category and audience of a definition.", "enum": [0, 1] }, @@ -3498,6 +3499,27 @@ "entrypoints": { "description": "buildProviders 1: a provider application that starts an entrypoint lithe/build/runEntrypoints names in a source file, in its project and without a target. Requires source provider; refuses fromTargets, fromTasks, arguments, extension, native debug and a service or task execution. Registry connection debugging requires buildSystems 2.", "type": "boolean" + }, + "configurationType": { + "description": "runConfigurationTypes 1: ID of a buildSystems[].runConfigurationTypes entry in the same build system. Each matching target materializes a generated build.run-type configuration sharing that kind's group, icon, editor form, and command-line launch plan. Requires fromTargets and refuses source provider, debug, entrypoints, fromTasks, arguments, extension, and execution.", + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$", + "maxLength": 64 + }, + "values": { + "description": "runConfigurationTypes 1: initial field values for configurationType, keyed by declared field ID. String values and arguments list items may reference ${root}, ${project.*}, and ${target.*} template variables.", + "type": "object", + "additionalProperties": { + "oneOf": [ + { "type": "string", "maxLength": 1024 }, + { "type": "boolean" }, + { + "type": "array", + "maxItems": 64, + "items": { "type": "string", "maxLength": 1024 } + } + ] + } } }, "if": { "required": ["entrypoints"], "properties": { "entrypoints": { "const": true } } }, diff --git a/shared/plugins/reference/capabilities-and-versions.md b/shared/plugins/reference/capabilities-and-versions.md index 33e85b3d..5acedeb8 100644 --- a/shared/plugins/reference/capabilities-and-versions.md +++ b/shared/plugins/reference/capabilities-and-versions.md @@ -57,6 +57,7 @@ Core 列以本仓库 `main` 上的 Core 源码为准([`capabilities.rs`](https | `buildProviders` `1` | 在 `0` 之上加:运行声明 `entrypoints: true`(入口运行,不需要目标),提供者用 `lithe/build/runEntrypoints` 回答一个源文件里可运行的入口,宿主把它保存为运行配置并按入口启动 | ✅ | ✅ | [Run entrypoints](../contract/v1/README.md#run-entrypoints-buildproviders-1) | | `buildModelInputs` `0` | `buildSystems[].modelSharing` 与 `modelInputs`:[已启用工作区插件之间共享的只读模型输入](../contract/v1/README.md#optional-read-only-model-inputs)(可选) | ✅ | 未声明 | [构建提供者](domains/build-providers.md) | | `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`:插件声明的运行配置类型(如 Go Build、Go Test),宿主按声明的字段画编辑器,Core 用 `build.runConfigurationPlan` 把保存的配置展开成命令行;所有运行配置共用“允许多个实例”开关 | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | +| `runConfigurationTypes` `1` | 在 `0` 之上加:`buildSystems[].run[]` 可声明 `configurationType` 和 `values`,把模型发现的目标物化为同一声明类型的自动生成配置(`build.run-type`),与手动新建配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划 | ✅ | 配套宿主接入后声明 | [Auto-discovered run configurations](../contract/v1/README.md#auto-discovered-run-configurations-runconfigurationtypes-1) | | `beforeLaunchTasks` `0` | `buildSystems[].beforeLaunchTasks`:插件声明的启动前任务(如“运行 Go 命令”),列在运行配置“启动前”的“添加新任务”菜单里;宿主按声明的字段画任务表单,Core 用 `runConfig.checkBeforeLaunchTask` 校验值、`build.beforeLaunchTaskPlan` 在拥有这个步骤列表的配置的工作目录里展开命令行 | ✅ | ✅ | [Before-launch tasks](../contract/v1/README.md#before-launch-tasks) | | `vcsProviders` `0` | [`vcsProviders[]`](../contract/v1/README.md#vcs-providers);说 `litheVcs` | ✅ | ✅¹ | [版本控制提供者](domains/vcs.md) | | `debugAdapters` `0` | [`debugAdapters[]`](../contract/v1/README.md#debug-adapters):独立适配器、语言服务器内的适配器、[远程附加](../contract/v1/README.md#remote-attach)、参数和环境变量、[`features` 与 `defaults`](../contract/v1/README.md#adapter-features-and-defaults) | ✅ | ✅ | [调试适配器](domains/debug-adapters.md) | @@ -177,6 +178,7 @@ Each row is one capability. `requires` lists **exactly** the capabilities a mani | `buildProviders` `1` | Adds to `0`: run declarations with `entrypoints: true` (entrypoint runs, without a target); the provider answers `lithe/build/runEntrypoints` with the runnable entrypoints of one source file, which the host saves as run configurations and starts | ✅ | ✅ | [Run entrypoints](../contract/v1/README.md#run-entrypoints-buildproviders-1) | | `buildModelInputs` `0` | `buildSystems[].modelSharing` and `modelInputs`: [optional read-only model inputs](../contract/v1/README.md#optional-read-only-model-inputs) shared between enabled workspace plugins | ✅ | Not declared | [Build providers](domains/build-providers.md) | | `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`: run configuration types a plugin declares (such as Go Build and Go Test); the host draws the editor from the declared fields and Core expands a saved configuration into a command line with `build.runConfigurationPlan`; every run configuration shares the Allow multiple instances switch | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | +| `runConfigurationTypes` `1` | Extends `0` with `buildSystems[].run[].configurationType` and `values`: targets matched by `fromTargets` materialize generated `build.run-type` configurations that share the declared type's group, icon, editor form, and `build.runConfigurationPlan` launch flow | ✅ | Declared with companion host integration | [Auto-discovered run configurations](../contract/v1/README.md#auto-discovered-run-configurations-runconfigurationtypes-1) | | `beforeLaunchTasks` `0` | `buildSystems[].beforeLaunchTasks`: before-launch tasks a plugin declares (such as Run Go Command), listed in the Add New Task menu of a run configuration's Before Launch list; the host draws the task's form from the declared fields, Core checks the values with `runConfig.checkBeforeLaunchTask` and expands the command line with `build.beforeLaunchTaskPlan` in the working directory of the configuration whose list names the step | ✅ | ✅ | [Before-launch tasks](../contract/v1/README.md#before-launch-tasks) | | `vcsProviders` `0` | [`vcsProviders[]`](../contract/v1/README.md#vcs-providers); they speak `litheVcs` | ✅ | ✅¹ | [VCS providers](domains/vcs.md) | | `debugAdapters` `0` | [`debugAdapters[]`](../contract/v1/README.md#debug-adapters): standalone adapters, adapters inside a language server, [remote attach](../contract/v1/README.md#remote-attach), arguments and environment, [`features` and `defaults`](../contract/v1/README.md#adapter-features-and-defaults) | ✅ | ✅ | [Debug adapters](domains/debug-adapters.md) | diff --git a/shared/plugins/reference/domains/build-systems.md b/shared/plugins/reference/domains/build-systems.md index b093a93e..e6dbb8e5 100644 --- a/shared/plugins/reference/domains/build-systems.md +++ b/shared/plugins/reference/domains/build-systems.md @@ -14,7 +14,7 @@ | 项目 | 内容 | | --- | --- | | 清单字段 | `buildSystems[]`:`id`、`displayName`、`icon`、`detection`、`invocation`、`options`、`model`、`provider`、`tasks`、`run`、`test`、`diagnostics`、`dependencies`、`sync`、`layout`、`hostIntegration`,以及可选的 `modelSharing`、`modelInputs`(见下文)和 `configuration`(原生配置,见[构建提供者](build-providers.md)) | -| 能力版本 | `buildSystems` `0`。不带 `provider` 的构建系统只需要它;带 `provider` 还要 `buildProviders: 0`;`modelSharing`、`modelInputs` 另需 `buildModelInputs: 0`(消费者还需要 `buildProviders: 0`);`runConfigurationTypes` 另需 `runConfigurationTypes: 0`;`beforeLaunchTasks` 另需 `beforeLaunchTasks: 0`;可执行文件候选用 `setting` 来源时还要 `settings: 0`(见 `build-tool-path`)。可执行文件解析本身是基础契约,不是能力,不需要在 `requires` 里声明。`requires` 必须恰好列出清单用到的能力,见[版本对照](../capabilities-and-versions.md#能力版本requires) | +| 能力版本 | `buildSystems` `0`。不带 `provider` 的构建系统只需要它;带 `provider` 还要 `buildProviders: 0`;`modelSharing`、`modelInputs` 另需 `buildModelInputs: 0`(消费者还需要 `buildProviders: 0`);`runConfigurationTypes` 另需 `runConfigurationTypes: 0`(在 `run[]` 里用 `configurationType`/`values` 把发现目标物化为声明类型时需 `runConfigurationTypes: 1`);`beforeLaunchTasks` 另需 `beforeLaunchTasks: 0`;可执行文件候选用 `setting` 来源时还要 `settings: 0`(见 `build-tool-path`)。可执行文件解析本身是基础契约,不是能力,不需要在 `requires` 里声明。`requires` 必须恰好列出清单用到的能力,见[版本对照](../capabilities-and-versions.md#能力版本requires) | | 协议 | 没有进程协议;`model.source: "provider"` 时走 [`litheBuild`](build-providers.md) | | API 编号 | [API-29](../api-catalog.md#现在能用的-api):构建、任务、测试、运行准备 | | 权限 | `process.build` | @@ -116,7 +116,7 @@ | Item | Value | | --- | --- | | Manifest fields | `buildSystems[]`: `id`, `displayName`, `icon`, `detection`, `invocation`, `options`, `model`, `provider`, `tasks`, `run`, `test`, `diagnostics`, `dependencies`, `sync`, `layout`, `hostIntegration`, plus the optional `modelSharing`, `modelInputs` (below) and `configuration` (native configuration, see [Build providers](build-providers.md)) | -| Capability versions | `buildSystems` `0`. A build system without `provider` needs only it; with `provider` it also needs `buildProviders: 0`; `modelSharing` and `modelInputs` also need `buildModelInputs: 0` (a consumer also needs `buildProviders: 0`); `runConfigurationTypes` also needs `runConfigurationTypes: 0`; `beforeLaunchTasks` also needs `beforeLaunchTasks: 0`; a `setting` executable source also needs `settings: 0` (see `build-tool-path`). Executable resolution itself is base contract, not a capability, and is not declared in `requires`. `requires` must list exactly the capabilities the manifest uses; see [versions](../capabilities-and-versions.md#capability-versions-requires) | +| Capability versions | `buildSystems` `0`. A build system without `provider` needs only it; with `provider` it also needs `buildProviders: 0`; `modelSharing` and `modelInputs` also need `buildModelInputs: 0` (a consumer also needs `buildProviders: 0`); `runConfigurationTypes` also needs `runConfigurationTypes: 0` (or `1` when `run[]` uses `configurationType`/`values` to materialize discovered targets as a declared type); `beforeLaunchTasks` also needs `beforeLaunchTasks: 0`; a `setting` executable source also needs `settings: 0` (see `build-tool-path`). Executable resolution itself is base contract, not a capability, and is not declared in `requires`. `requires` must list exactly the capabilities the manifest uses; see [versions](../capabilities-and-versions.md#capability-versions-requires) | | Protocols | No process protocol; `model.source: "provider"` uses [`litheBuild`](build-providers.md) | | API IDs | [API-29](../api-catalog.md#apis-usable-now): build, tasks, tests, run preparation | | Permissions | `process.build` | diff --git a/shared/plugins/reference/protocol-changelog.md b/shared/plugins/reference/protocol-changelog.md index b27ee48b..71658bc5 100644 --- a/shared/plugins/reference/protocol-changelog.md +++ b/shared/plugins/reference/protocol-changelog.md @@ -14,8 +14,12 @@ ## 待合入 +- 待补 PR 号(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),**`runConfigurationTypes` 1**(API-29):`buildSystems[].run[]` 新增可选字段 `configurationType`(引用同一构建系统的 `runConfigurationTypes[].id`)和 `values`(按字段 ID 填写初始值,字符串与 `arguments` 列表项支持 `${root}`、`${project.*}`、`${target.*}` 模板展开),必须配合 `fromTargets` 使用,与 `source: "provider"`、`debug`、`entrypoints`、`fromTasks`、`arguments`、`extension`、`execution` 互斥;使用它们的清单需声明 `requires.runConfigurationTypes: 1`。`build.decodeModel` 展开模板并在 `model.run[]` 中输出 `provider: "build.run-type"` 与 `runType: {pluginID, buildSystemID, type, values}`;`runConfig.generate` 的 `providerRuns` 快照支持物化为确定性 ID(`generated:run-type:`)的 `build.run-type` 生成层配置,与手动创建的同类型配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划;`runConfig.editorForm` 和 `runConfig.saveConfiguration` 支持直接读取并覆盖生成层的 `build.run-type` 配置,且在层合并时整体替换 `extensions.build` 以免被清空的可选字段回渗。没有新增宿主方法、通知或 SDK 版本。 + - [#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194)(待合入),[@xiaoyumuxi](https://github.com/xiaoyumuxi),`pluginAPIVersion` 0 / `litheFunctions` 0 内修正(API-03、API-16):`plugins.workflow` 在原生副作用前校验状态项引用的命令属于调用会话清单、Markdown/HTML 资源扩展名及浏览器资源的 `unsaved` 默认值;预览省略 `presentation` 时仍为 `editorAndPreview`,浏览器省略 `unsaved` 时仍为 `requireSaved`。补齐内核命令总表遗漏的 `plugins.workflow`,修正 Rust SDK 测试模块位置,并在四种官方 SDK 验证进度取消、结束与订阅释放。没有新增方法、通知、权限、错误码或协议版本。 +- [#193](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/193)(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),`pluginAPIVersion` 0 / `litheFunctions` 0 内补充(API-03/12/13/16/17/18/22/38):新增 19 个独立授权方法,补齐输入、内联只读预览、文本对比、视图刷新、输出、可取消进度、状态项、剪贴板、文件管理器和有界 HTTP;已有 HTML 预览新增内联来源,浏览器资源形式补齐已保存/拒绝未保存语义。树新增 `hasChildren`、`cursor` 和 `expand`、`loadMore`、`refresh` 事件;后端保留完整已加载范围,分页无进展停止,失败显式重试。共享 `plugins.workflow` 负责严格参数、默认值、限额、搜索、排序、分页和输出增量,四种官方 SDK 同步包装与事件。没有新协议版本;宿主可用方法仍由 `getCapabilities` 发现。 + - [#191](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/191),[@xiaoyumuxi](https://github.com/xiaoyumuxi)(—,贡献规则与版本说明):新增插件 API PR 提交指南,明确 API-01–44 是可扩展领域、特有需求不得提升任何系统 API 版本,公共变化也须先证明兼容扩展不足;保留已有 1、2 等版本并按实际用法选最低值。要求统一日志具备可定位语义并集中脱敏、错误码全契约查重、Rust/Go/Node/Java 四个 SDK 在同一 PR 补齐,example 可后补。Core AI 入口及中英导航、契约和版本页同步纠正机械升版与全部填 0 的旧表述。没有新增运行时字段、方法、通知、错误码或版本;合入日期在合并时补齐。 - [#190](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/190),[@xiaoyumuxi](https://github.com/xiaoyumuxi)(API-07/08,`pluginAPIVersion` 0 内补充):Core 新增 `workspace.watchPlan`、`workspace.watchEvents`、`workspace.findFiles`、`workspace.findText`,宿主方法保持原名和权限。路由前严格校验监听与搜索参数,复用文件匹配、编码和隐藏/索引规则,以 no-follow 句柄处理实时磁盘;搜索分页有查询绑定游标、200 条总上限、取消和 30 秒预算,监听投影有排序去重、隐藏过滤和溢出重扫。桌面使用 Viva 原生事件,订阅受插件/会话/上下文约束,注册后先发重扫,释放前停止通知;无空闲轮询。macOS 原生事件与资源释放已验证,Windows 原生验证本轮未执行。没有新增协议版本、宿主方法或通知;合入日期在合并时补齐。 @@ -81,6 +85,7 @@ | `managedRuntimes` | 0 | 2026-11-18 | [#96](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/96) | | `managedRuntimes` | 1 | 2026-11-19 | [#108](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/108) | | `runConfigurationTypes` | 0 | 2026-11-18 | [#94](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/94) | +| `runConfigurationTypes` | 1 | 待合入 | 待补 PR 号 | | `sourceSettings` | 0 | 2026-11-15 | [#57](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/57) | | `sourceSettings` | 1 | 2026-11-17 | [#79](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/79) | | `settings` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) | From b07514aac0a112b2fd9c7c56e71ad26eefc319d5 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 16:17:33 +0800 Subject: [PATCH 2/3] docs(plugins): record PR #196 in protocol changelog --- shared/plugins/reference/protocol-changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/plugins/reference/protocol-changelog.md b/shared/plugins/reference/protocol-changelog.md index 71658bc5..1a12f9b3 100644 --- a/shared/plugins/reference/protocol-changelog.md +++ b/shared/plugins/reference/protocol-changelog.md @@ -14,7 +14,7 @@ ## 待合入 -- 待补 PR 号(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),**`runConfigurationTypes` 1**(API-29):`buildSystems[].run[]` 新增可选字段 `configurationType`(引用同一构建系统的 `runConfigurationTypes[].id`)和 `values`(按字段 ID 填写初始值,字符串与 `arguments` 列表项支持 `${root}`、`${project.*}`、`${target.*}` 模板展开),必须配合 `fromTargets` 使用,与 `source: "provider"`、`debug`、`entrypoints`、`fromTasks`、`arguments`、`extension`、`execution` 互斥;使用它们的清单需声明 `requires.runConfigurationTypes: 1`。`build.decodeModel` 展开模板并在 `model.run[]` 中输出 `provider: "build.run-type"` 与 `runType: {pluginID, buildSystemID, type, values}`;`runConfig.generate` 的 `providerRuns` 快照支持物化为确定性 ID(`generated:run-type:`)的 `build.run-type` 生成层配置,与手动创建的同类型配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划;`runConfig.editorForm` 和 `runConfig.saveConfiguration` 支持直接读取并覆盖生成层的 `build.run-type` 配置,且在层合并时整体替换 `extensions.build` 以免被清空的可选字段回渗。没有新增宿主方法、通知或 SDK 版本。 +- [#196](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/196)(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),**`runConfigurationTypes` 1**(API-29):`buildSystems[].run[]` 新增可选字段 `configurationType`(引用同一构建系统的 `runConfigurationTypes[].id`)和 `values`(按字段 ID 填写初始值,字符串与 `arguments` 列表项支持 `${root}`、`${project.*}`、`${target.*}` 模板展开),必须配合 `fromTargets` 使用,与 `source: "provider"`、`debug`、`entrypoints`、`fromTasks`、`arguments`、`extension`、`execution` 互斥;使用它们的清单需声明 `requires.runConfigurationTypes: 1`。`build.decodeModel` 展开模板并在 `model.run[]` 中输出 `provider: "build.run-type"` 与 `runType: {pluginID, buildSystemID, type, values}`;`runConfig.generate` 的 `providerRuns` 快照支持物化为确定性 ID(`generated:run-type:`)的 `build.run-type` 生成层配置,与手动创建的同类型配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划;`runConfig.editorForm` 和 `runConfig.saveConfiguration` 支持直接读取并覆盖生成层的 `build.run-type` 配置,且在层合并时整体替换 `extensions.build` 以免被清空的可选字段回渗。没有新增宿主方法、通知或 SDK 版本。 - [#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194)(待合入),[@xiaoyumuxi](https://github.com/xiaoyumuxi),`pluginAPIVersion` 0 / `litheFunctions` 0 内修正(API-03、API-16):`plugins.workflow` 在原生副作用前校验状态项引用的命令属于调用会话清单、Markdown/HTML 资源扩展名及浏览器资源的 `unsaved` 默认值;预览省略 `presentation` 时仍为 `editorAndPreview`,浏览器省略 `unsaved` 时仍为 `requireSaved`。补齐内核命令总表遗漏的 `plugins.workflow`,修正 Rust SDK 测试模块位置,并在四种官方 SDK 验证进度取消、结束与订阅释放。没有新增方法、通知、权限、错误码或协议版本。 @@ -85,7 +85,7 @@ | `managedRuntimes` | 0 | 2026-11-18 | [#96](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/96) | | `managedRuntimes` | 1 | 2026-11-19 | [#108](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/108) | | `runConfigurationTypes` | 0 | 2026-11-18 | [#94](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/94) | -| `runConfigurationTypes` | 1 | 待合入 | 待补 PR 号 | +| `runConfigurationTypes` | 1 | 待合入 | [#196](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/196) | | `sourceSettings` | 0 | 2026-11-15 | [#57](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/57) | | `sourceSettings` | 1 | 2026-11-17 | [#79](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/79) | | `settings` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) | From 8775e60f5995233b9b8c0e832e03973747e40dc6 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 16:28:02 +0800 Subject: [PATCH 3/3] refactor(build): keep runConfigurationTypes at version 0 for compatible extension --- rust/crates/build/src/manifest.rs | 6 ------ rust/crates/build/src/manifest/run.rs | 14 +++++++------- rust/crates/core/src/tests/plugin_run_types.rs | 15 +++++++++------ rust/crates/plugin-manifest/src/validation.rs | 14 -------------- rust/crates/plugin-model/src/capabilities.rs | 8 ++++---- shared/plugins/contract/v1/README.md | 8 +++++--- .../contract/v1/plugin-manifest.schema.json | 7 +++---- .../reference/capabilities-and-versions.md | 6 ++---- shared/plugins/reference/domains/build-systems.md | 4 ++-- shared/plugins/reference/protocol-changelog.md | 3 +-- 10 files changed, 33 insertions(+), 52 deletions(-) diff --git a/rust/crates/build/src/manifest.rs b/rust/crates/build/src/manifest.rs index 9cf6c705..69caad2e 100644 --- a/rust/crates/build/src/manifest.rs +++ b/rust/crates/build/src/manifest.rs @@ -189,12 +189,6 @@ pub fn validate_declarations( } impl BuildSystemDeclaration { - /// Whether a run targets a declared `runConfigurationTypes` kind from the - /// build model, which `runConfigurationTypes` 1 introduced. - pub fn has_generated_run_configuration_types(&self) -> bool { - self.run.iter().any(|run| run.configuration_type.is_some()) - } - /// Whether a run starts entrypoints the provider finds in files, which /// `buildProviders` 1 introduced. pub fn has_run_entrypoints(&self) -> bool { diff --git a/rust/crates/build/src/manifest/run.rs b/rust/crates/build/src/manifest/run.rs index e54d7ca1..7f05aeac 100644 --- a/rust/crates/build/src/manifest/run.rs +++ b/rust/crates/build/src/manifest/run.rs @@ -35,15 +35,15 @@ pub(crate) struct RunDeclaration { /// project. It applies to no target and is never listed per target. #[serde(default, skip_serializing_if = "std::ops::Not::not")] pub(crate) entrypoints: bool, - /// `runConfigurationTypes` 1: ID of a `runConfigurationTypes` entry in - /// this build system. Each matching target materializes a generated - /// configuration of that declared kind instead of a raw command or - /// provider run, sharing the kind's icon, group and editor form. + /// ID of a `runConfigurationTypes` entry in this build system. Each + /// matching target materializes a generated configuration of that declared + /// kind instead of a raw command or provider run, sharing the kind's icon, + /// group and editor form. #[serde(default, skip_serializing_if = "Option::is_none")] pub(crate) configuration_type: Option, - /// `runConfigurationTypes` 1: initial field values for `configurationType`, - /// keyed by declared field ID. String values and `arguments` list items - /// may reference target and project template variables. + /// Initial field values for `configurationType`, keyed by declared field + /// ID. String values and `arguments` list items may reference target and + /// project template variables. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub(crate) values: BTreeMap, } diff --git a/rust/crates/core/src/tests/plugin_run_types.rs b/rust/crates/core/src/tests/plugin_run_types.rs index f92fc61d..13560e4a 100644 --- a/rust/crates/core/src/tests/plugin_run_types.rs +++ b/rust/crates/core/src/tests/plugin_run_types.rs @@ -844,7 +844,7 @@ fn generated_run_type_manifest() -> Value { "pluginAPIVersion": 0, "requires": { "buildSystems": 0, - "runConfigurationTypes": 1 + "runConfigurationTypes": 0 }, "vendor": { "id": "dev.lithe.test", @@ -913,7 +913,7 @@ fn generated_run_type_manifest() -> Value { } #[test] -fn run_configuration_types_v1_validates_run_declarations() { +fn run_configuration_types_generated_runs_are_validated() { let validate = |manifest: Value| { call( "plugins.declarative.validate", @@ -925,10 +925,13 @@ fn run_configuration_types_v1_validates_run_declarations() { let valid = validate(generated_run_type_manifest()); assert_eq!(valid["status"], "ok", "{valid}"); - // Version 0 refuses configurationType on buildSystems[].run[]. - let mut requires_v0 = generated_run_type_manifest(); - requires_v0["requires"]["runConfigurationTypes"] = json!(0); - let outcome = validate(requires_v0); + // Omitting requires.runConfigurationTypes is rejected. + let mut missing_cap = generated_run_type_manifest(); + missing_cap["requires"] + .as_object_mut() + .unwrap() + .remove("runConfigurationTypes"); + let outcome = validate(missing_cap); assert_eq!(outcome["status"], "rejected", "{outcome}"); assert_eq!(outcome["error"]["code"], "plugin.manifest.invalid"); diff --git a/rust/crates/plugin-manifest/src/validation.rs b/rust/crates/plugin-manifest/src/validation.rs index 5872d0fc..5d43a1be 100644 --- a/rust/crates/plugin-manifest/src/validation.rs +++ b/rust/crates/plugin-manifest/src/validation.rs @@ -127,20 +127,6 @@ impl DeclarativePluginManifest { "executesProjectCode needs languageServers 1.", )); } - if self - .build_systems - .iter() - .any(|system| system.has_generated_run_configuration_types()) - && self - .requires - .get(capabilities::RUN_CONFIGURATION_TYPES) - .is_none_or(|version| *version < 1) - { - return Err(invalid( - "requires.runConfigurationTypes", - "Run entries targeting a runConfigurationType need runConfigurationTypes 1.", - )); - } if self .build_systems .iter() diff --git a/rust/crates/plugin-model/src/capabilities.rs b/rust/crates/plugin-model/src/capabilities.rs index efa583f6..81ba20c2 100644 --- a/rust/crates/plugin-model/src/capabilities.rs +++ b/rust/crates/plugin-model/src/capabilities.rs @@ -75,9 +75,9 @@ pub const BUILD_PROVIDERS: &str = "buildProviders"; /// Optional public model snapshots between enabled build providers. pub const BUILD_MODEL_INPUTS: &str = "buildModelInputs"; /// `buildSystems[].runConfigurationTypes`: kinds of run configuration whose -/// editor fields and command line the plugin declares. Version 1 lets a -/// `buildSystems[].run[]` entry target one of those kinds with -/// `configurationType` and field `values` expanded from the build model. +/// editor fields and command line the plugin declares, including model-derived +/// `buildSystems[].run[]` entries targeting one of those kinds via +/// `configurationType` and `values`. pub const RUN_CONFIGURATION_TYPES: &str = "runConfigurationTypes"; /// `buildSystems[].beforeLaunchTasks`: kinds of before-launch step whose /// fields and command line the plugin declares, offered in a configuration's @@ -149,7 +149,7 @@ pub const SUPPORTED_CAPABILITIES: &[(&str, &[u32])] = &[ (PACKAGE_TRUST, &[0]), (PLUGIN_FUNCTIONS, &[0]), (PROJECT_GENERATORS, &[0]), - (RUN_CONFIGURATION_TYPES, &[0, 1]), + (RUN_CONFIGURATION_TYPES, &[0]), (SETTINGS, &[0]), (SOURCE_SETTINGS, &[0, 1]), (TOOL_DEFINITIONS, &[0, 1]), diff --git a/shared/plugins/contract/v1/README.md b/shared/plugins/contract/v1/README.md index b47a60c9..ce573986 100644 --- a/shared/plugins/contract/v1/README.md +++ b/shared/plugins/contract/v1/README.md @@ -3078,9 +3078,9 @@ The type's text is translated in the package's `l10n/.json` under [Translations](#translations). A file that does not fit is refused whole with `plugin.build.invalidLocalization`, and the manifest's text is shown. -#### Auto-discovered run configurations (`runConfigurationTypes: 1`) +#### Auto-discovered run configurations -With `runConfigurationTypes: 1`, a `buildSystems[].run[]` declaration may set +Within `runConfigurationTypes: 0`, a `buildSystems[].run[]` declaration may set `configurationType` (naming one `runConfigurationTypes[].id` of the same build system) and optional `values` (a map from declared field ID to initial value). Each model target matching `fromTargets.tags` then materializes a generated @@ -3097,9 +3097,11 @@ same group, icon, editor form, and `build.runConfigurationPlan` launch flow: }] ``` -- Requires `fromTargets` and `requires.runConfigurationTypes: 1`; `source: "provider"`, +- Requires `fromTargets` and `requires.runConfigurationTypes: 0`; `source: "provider"`, `debug`, `entrypoints`, `fromTasks`, `arguments`, `extension`, and `execution` are refused (execution comes from the target `runConfigurationTypes` entry). + Older hosts that predate these fields refuse the manifest with + `plugin.manifest.invalid`. - Each key of `values` must name a declared field of `configurationType` with a matching JSON type (`string` for `text`/`choice`/`file`/`directory`, `boolean` for `checkbox`, array of strings for `arguments`). String values, `arguments` diff --git a/shared/plugins/contract/v1/plugin-manifest.schema.json b/shared/plugins/contract/v1/plugin-manifest.schema.json index 85671e55..59fca3bf 100644 --- a/shared/plugins/contract/v1/plugin-manifest.schema.json +++ b/shared/plugins/contract/v1/plugin-manifest.schema.json @@ -10,7 +10,6 @@ {"if": {"required": ["outputLinkMatchers"]}, "then": {"properties": {"requires": {"required": ["outputLinkMatchers"]}}}}, {"if": {"required": ["toolDefinitions"]}, "then": {"properties": {"requires": {"required": ["toolDefinitions"]}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["runConfigurationTypes"]}}}}, "then": {"properties": {"requires": {"required": ["runConfigurationTypes"]}}}}, - {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["run"], "properties": {"run": {"contains": {"required": ["configurationType"]}}}}}}}, "then": {"properties": {"requires": {"required": ["runConfigurationTypes"], "properties": {"runConfigurationTypes": {"const": 1}}}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["beforeLaunchTasks"]}}}}, "then": {"properties": {"requires": {"required": ["beforeLaunchTasks"]}}}}, {"if": {"required": ["buildSystems"], "properties": {"buildSystems": {"contains": {"required": ["test"], "properties": {"test": {"required": ["discoveryCommand"]}}}}}}, "then": {"properties": {"requires": {"required": ["buildSystems"], "properties": {"buildSystems": {"const": 1}}}}}}, {"if": {"required": ["commandInstallers"]}, "then": {"required": ["permissions"], "properties": {"requires": {"required": ["commandInstallers"]}, "permissions": {"contains": {"const": "commands.install"}}}}}, @@ -48,7 +47,7 @@ "outputLinkMatchers": { "description": "Required exactly when outputLinkMatchers is non-empty.", "enum": [0] }, "packageTrust": { "description": "Required exactly when vendor.bundledSignatureRequirement is present.", "enum": [0] }, "projectGenerators": { "description": "Entries of the New Project window: fields, requirements, and steps, with tool fields that pick tool installations.", "enum": [0] }, - "runConfigurationTypes": { "description": "Required exactly when any buildSystems[].runConfigurationTypes is non-empty: kinds of run configuration the user creates in the Run/Debug Configurations dialog, drawn from declared fields and run through a declared command line. Version 1 adds buildSystems[].run[].configurationType and values so auto-discovered model targets materialize entries of a declared run configuration type. Needs buildSystems.", "enum": [0, 1] }, + "runConfigurationTypes": { "description": "Required exactly when any buildSystems[].runConfigurationTypes is non-empty: kinds of run configuration the user creates in the Run/Debug Configurations dialog, drawn from declared fields and run through a declared command line, and optional buildSystems[].run[].configurationType/values entries that materialize discovered model targets as one of those kinds. Needs buildSystems.", "enum": [0] }, "settings": { "description": "Required exactly when settings, settingActions or settingRegions is non-empty. Covers integer, enum, boolean, multiSelect, text, file, and directory options, scope, effect, page, section, settingActions, and settingRegions.", "enum": [0] }, "sourceSettings": { "description": "Required exactly when a setting action declares sourceEditor. Native-source settings projection, compiler placement, confirmed staging and read-back. Version 1 adds sidebar groups, nested sources, field sections and entry lists.", "enum": [0, 1] }, "toolDefinitions": { "description": "Required exactly when toolDefinitions is present. Version 1 adds the display-only category and audience of a definition.", "enum": [0, 1] }, @@ -3501,13 +3500,13 @@ "type": "boolean" }, "configurationType": { - "description": "runConfigurationTypes 1: ID of a buildSystems[].runConfigurationTypes entry in the same build system. Each matching target materializes a generated build.run-type configuration sharing that kind's group, icon, editor form, and command-line launch plan. Requires fromTargets and refuses source provider, debug, entrypoints, fromTasks, arguments, extension, and execution.", + "description": "ID of a buildSystems[].runConfigurationTypes entry in the same build system. Each matching target materializes a generated build.run-type configuration sharing that kind's group, icon, editor form, and command-line launch plan. Requires fromTargets and refuses source provider, debug, entrypoints, fromTasks, arguments, extension, and execution.", "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "maxLength": 64 }, "values": { - "description": "runConfigurationTypes 1: initial field values for configurationType, keyed by declared field ID. String values and arguments list items may reference ${root}, ${project.*}, and ${target.*} template variables.", + "description": "Initial field values for configurationType, keyed by declared field ID. String values and arguments list items may reference ${root}, ${project.*}, and ${target.*} template variables.", "type": "object", "additionalProperties": { "oneOf": [ diff --git a/shared/plugins/reference/capabilities-and-versions.md b/shared/plugins/reference/capabilities-and-versions.md index 5acedeb8..eaece6e4 100644 --- a/shared/plugins/reference/capabilities-and-versions.md +++ b/shared/plugins/reference/capabilities-and-versions.md @@ -56,8 +56,7 @@ Core 列以本仓库 `main` 上的 Core 源码为准([`capabilities.rs`](https | `buildProviders` `0` | `buildSystems[].provider`:[构建提供者](../contract/v1/README.md#build-providers),可以是自有进程或共享语言服务器;说 `litheBuild`,包含任务执行、测试执行与发现、运行准备、原生调试准备、原生配置、内联测试报告、语义测试选择器、类型化运行选项和注册表连接调试 | ✅ | ✅¹ | [构建提供者](domains/build-providers.md) | | `buildProviders` `1` | 在 `0` 之上加:运行声明 `entrypoints: true`(入口运行,不需要目标),提供者用 `lithe/build/runEntrypoints` 回答一个源文件里可运行的入口,宿主把它保存为运行配置并按入口启动 | ✅ | ✅ | [Run entrypoints](../contract/v1/README.md#run-entrypoints-buildproviders-1) | | `buildModelInputs` `0` | `buildSystems[].modelSharing` 与 `modelInputs`:[已启用工作区插件之间共享的只读模型输入](../contract/v1/README.md#optional-read-only-model-inputs)(可选) | ✅ | 未声明 | [构建提供者](domains/build-providers.md) | -| `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`:插件声明的运行配置类型(如 Go Build、Go Test),宿主按声明的字段画编辑器,Core 用 `build.runConfigurationPlan` 把保存的配置展开成命令行;所有运行配置共用“允许多个实例”开关 | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | -| `runConfigurationTypes` `1` | 在 `0` 之上加:`buildSystems[].run[]` 可声明 `configurationType` 和 `values`,把模型发现的目标物化为同一声明类型的自动生成配置(`build.run-type`),与手动新建配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划 | ✅ | 配套宿主接入后声明 | [Auto-discovered run configurations](../contract/v1/README.md#auto-discovered-run-configurations-runconfigurationtypes-1) | +| `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`:插件声明的运行配置类型(如 Go Build、Go Test),宿主按声明的字段画编辑器,Core 用 `build.runConfigurationPlan` 把保存的配置展开成命令行;`buildSystems[].run[]` 也可通过 `configurationType` 与 `values` 把模型发现的目标物化为同一声明类型的生成配置(共用分组、图标、表单与启动计划);所有运行配置共用“允许多个实例”开关 | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | | `beforeLaunchTasks` `0` | `buildSystems[].beforeLaunchTasks`:插件声明的启动前任务(如“运行 Go 命令”),列在运行配置“启动前”的“添加新任务”菜单里;宿主按声明的字段画任务表单,Core 用 `runConfig.checkBeforeLaunchTask` 校验值、`build.beforeLaunchTaskPlan` 在拥有这个步骤列表的配置的工作目录里展开命令行 | ✅ | ✅ | [Before-launch tasks](../contract/v1/README.md#before-launch-tasks) | | `vcsProviders` `0` | [`vcsProviders[]`](../contract/v1/README.md#vcs-providers);说 `litheVcs` | ✅ | ✅¹ | [版本控制提供者](domains/vcs.md) | | `debugAdapters` `0` | [`debugAdapters[]`](../contract/v1/README.md#debug-adapters):独立适配器、语言服务器内的适配器、[远程附加](../contract/v1/README.md#remote-attach)、参数和环境变量、[`features` 与 `defaults`](../contract/v1/README.md#adapter-features-and-defaults) | ✅ | ✅ | [调试适配器](domains/debug-adapters.md) | @@ -177,8 +176,7 @@ Each row is one capability. `requires` lists **exactly** the capabilities a mani | `buildProviders` `0` | `buildSystems[].provider`: [build providers](../contract/v1/README.md#build-providers), in their own process or a shared language server; they speak `litheBuild`, which covers task execution, test execution and discovery, run preparation, native debug preparation, native configuration, inline test reports, semantic test selectors, typed run options, and registry connection debugging | ✅ | ✅¹ | [Build providers](domains/build-providers.md) | | `buildProviders` `1` | Adds to `0`: run declarations with `entrypoints: true` (entrypoint runs, without a target); the provider answers `lithe/build/runEntrypoints` with the runnable entrypoints of one source file, which the host saves as run configurations and starts | ✅ | ✅ | [Run entrypoints](../contract/v1/README.md#run-entrypoints-buildproviders-1) | | `buildModelInputs` `0` | `buildSystems[].modelSharing` and `modelInputs`: [optional read-only model inputs](../contract/v1/README.md#optional-read-only-model-inputs) shared between enabled workspace plugins | ✅ | Not declared | [Build providers](domains/build-providers.md) | -| `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`: run configuration types a plugin declares (such as Go Build and Go Test); the host draws the editor from the declared fields and Core expands a saved configuration into a command line with `build.runConfigurationPlan`; every run configuration shares the Allow multiple instances switch | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | -| `runConfigurationTypes` `1` | Extends `0` with `buildSystems[].run[].configurationType` and `values`: targets matched by `fromTargets` materialize generated `build.run-type` configurations that share the declared type's group, icon, editor form, and `build.runConfigurationPlan` launch flow | ✅ | Declared with companion host integration | [Auto-discovered run configurations](../contract/v1/README.md#auto-discovered-run-configurations-runconfigurationtypes-1) | +| `runConfigurationTypes` `0` | `buildSystems[].runConfigurationTypes`: run configuration types a plugin declares (such as Go Build and Go Test); the host draws the editor from the declared fields and Core expands a saved configuration into a command line with `build.runConfigurationPlan`; `buildSystems[].run[]` may also specify `configurationType` and `values` so discovered targets materialize generated configurations of a declared type; every run configuration shares the Allow multiple instances switch | ✅ | ✅¹ | [Run configuration types](../contract/v1/README.md#run-configuration-types) | | `beforeLaunchTasks` `0` | `buildSystems[].beforeLaunchTasks`: before-launch tasks a plugin declares (such as Run Go Command), listed in the Add New Task menu of a run configuration's Before Launch list; the host draws the task's form from the declared fields, Core checks the values with `runConfig.checkBeforeLaunchTask` and expands the command line with `build.beforeLaunchTaskPlan` in the working directory of the configuration whose list names the step | ✅ | ✅ | [Before-launch tasks](../contract/v1/README.md#before-launch-tasks) | | `vcsProviders` `0` | [`vcsProviders[]`](../contract/v1/README.md#vcs-providers); they speak `litheVcs` | ✅ | ✅¹ | [VCS providers](domains/vcs.md) | | `debugAdapters` `0` | [`debugAdapters[]`](../contract/v1/README.md#debug-adapters): standalone adapters, adapters inside a language server, [remote attach](../contract/v1/README.md#remote-attach), arguments and environment, [`features` and `defaults`](../contract/v1/README.md#adapter-features-and-defaults) | ✅ | ✅ | [Debug adapters](domains/debug-adapters.md) | diff --git a/shared/plugins/reference/domains/build-systems.md b/shared/plugins/reference/domains/build-systems.md index e6dbb8e5..6e8f7b28 100644 --- a/shared/plugins/reference/domains/build-systems.md +++ b/shared/plugins/reference/domains/build-systems.md @@ -14,7 +14,7 @@ | 项目 | 内容 | | --- | --- | | 清单字段 | `buildSystems[]`:`id`、`displayName`、`icon`、`detection`、`invocation`、`options`、`model`、`provider`、`tasks`、`run`、`test`、`diagnostics`、`dependencies`、`sync`、`layout`、`hostIntegration`,以及可选的 `modelSharing`、`modelInputs`(见下文)和 `configuration`(原生配置,见[构建提供者](build-providers.md)) | -| 能力版本 | `buildSystems` `0`。不带 `provider` 的构建系统只需要它;带 `provider` 还要 `buildProviders: 0`;`modelSharing`、`modelInputs` 另需 `buildModelInputs: 0`(消费者还需要 `buildProviders: 0`);`runConfigurationTypes` 另需 `runConfigurationTypes: 0`(在 `run[]` 里用 `configurationType`/`values` 把发现目标物化为声明类型时需 `runConfigurationTypes: 1`);`beforeLaunchTasks` 另需 `beforeLaunchTasks: 0`;可执行文件候选用 `setting` 来源时还要 `settings: 0`(见 `build-tool-path`)。可执行文件解析本身是基础契约,不是能力,不需要在 `requires` 里声明。`requires` 必须恰好列出清单用到的能力,见[版本对照](../capabilities-and-versions.md#能力版本requires) | +| 能力版本 | `buildSystems` `0`。不带 `provider` 的构建系统只需要它;带 `provider` 还要 `buildProviders: 0`;`modelSharing`、`modelInputs` 另需 `buildModelInputs: 0`(消费者还需要 `buildProviders: 0`);`runConfigurationTypes` 另需 `runConfigurationTypes: 0`(含在 `run[]` 中使用 `configurationType`/`values` 把发现目标物化为声明类型);`beforeLaunchTasks` 另需 `beforeLaunchTasks: 0`;可执行文件候选用 `setting` 来源时还要 `settings: 0`(见 `build-tool-path`)。可执行文件解析本身是基础契约,不是能力,不需要在 `requires` 里声明。`requires` 必须恰好列出清单用到的能力,见[版本对照](../capabilities-and-versions.md#能力版本requires) | | 协议 | 没有进程协议;`model.source: "provider"` 时走 [`litheBuild`](build-providers.md) | | API 编号 | [API-29](../api-catalog.md#现在能用的-api):构建、任务、测试、运行准备 | | 权限 | `process.build` | @@ -116,7 +116,7 @@ | Item | Value | | --- | --- | | Manifest fields | `buildSystems[]`: `id`, `displayName`, `icon`, `detection`, `invocation`, `options`, `model`, `provider`, `tasks`, `run`, `test`, `diagnostics`, `dependencies`, `sync`, `layout`, `hostIntegration`, plus the optional `modelSharing`, `modelInputs` (below) and `configuration` (native configuration, see [Build providers](build-providers.md)) | -| Capability versions | `buildSystems` `0`. A build system without `provider` needs only it; with `provider` it also needs `buildProviders: 0`; `modelSharing` and `modelInputs` also need `buildModelInputs: 0` (a consumer also needs `buildProviders: 0`); `runConfigurationTypes` also needs `runConfigurationTypes: 0` (or `1` when `run[]` uses `configurationType`/`values` to materialize discovered targets as a declared type); `beforeLaunchTasks` also needs `beforeLaunchTasks: 0`; a `setting` executable source also needs `settings: 0` (see `build-tool-path`). Executable resolution itself is base contract, not a capability, and is not declared in `requires`. `requires` must list exactly the capabilities the manifest uses; see [versions](../capabilities-and-versions.md#capability-versions-requires) | +| Capability versions | `buildSystems` `0`. A build system without `provider` needs only it; with `provider` it also needs `buildProviders: 0`; `modelSharing` and `modelInputs` also need `buildModelInputs: 0` (a consumer also needs `buildProviders: 0`); `runConfigurationTypes` also needs `runConfigurationTypes: 0` (including using `configurationType`/`values` in `run[]` to materialize discovered targets as a declared type); `beforeLaunchTasks` also needs `beforeLaunchTasks: 0`; a `setting` executable source also needs `settings: 0` (see `build-tool-path`). Executable resolution itself is base contract, not a capability, and is not declared in `requires`. `requires` must list exactly the capabilities the manifest uses; see [versions](../capabilities-and-versions.md#capability-versions-requires) | | Protocols | No process protocol; `model.source: "provider"` uses [`litheBuild`](build-providers.md) | | API IDs | [API-29](../api-catalog.md#apis-usable-now): build, tasks, tests, run preparation | | Permissions | `process.build` | diff --git a/shared/plugins/reference/protocol-changelog.md b/shared/plugins/reference/protocol-changelog.md index 1a12f9b3..347b3b22 100644 --- a/shared/plugins/reference/protocol-changelog.md +++ b/shared/plugins/reference/protocol-changelog.md @@ -14,7 +14,7 @@ ## 待合入 -- [#196](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/196)(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),**`runConfigurationTypes` 1**(API-29):`buildSystems[].run[]` 新增可选字段 `configurationType`(引用同一构建系统的 `runConfigurationTypes[].id`)和 `values`(按字段 ID 填写初始值,字符串与 `arguments` 列表项支持 `${root}`、`${project.*}`、`${target.*}` 模板展开),必须配合 `fromTargets` 使用,与 `source: "provider"`、`debug`、`entrypoints`、`fromTasks`、`arguments`、`extension`、`execution` 互斥;使用它们的清单需声明 `requires.runConfigurationTypes: 1`。`build.decodeModel` 展开模板并在 `model.run[]` 中输出 `provider: "build.run-type"` 与 `runType: {pluginID, buildSystemID, type, values}`;`runConfig.generate` 的 `providerRuns` 快照支持物化为确定性 ID(`generated:run-type:`)的 `build.run-type` 生成层配置,与手动创建的同类型配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划;`runConfig.editorForm` 和 `runConfig.saveConfiguration` 支持直接读取并覆盖生成层的 `build.run-type` 配置,且在层合并时整体替换 `extensions.build` 以免被清空的可选字段回渗。没有新增宿主方法、通知或 SDK 版本。 +- [#196](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/196)(合入日期待合并时填写),[@xiaoyumuxi](https://github.com/xiaoyumuxi),`runConfigurationTypes` 0 内的补充(API-29):`buildSystems[].run[]` 新增可选字段 `configurationType`(引用同一构建系统的 `runConfigurationTypes[].id`)和 `values`(按字段 ID 填写初始值,字符串与 `arguments` 列表项支持 `${root}`、`${project.*}`、`${target.*}` 模板展开),必须配合 `fromTargets` 使用,与 `source: "provider"`、`debug`、`entrypoints`、`fromTasks`、`arguments`、`extension`、`execution` 互斥;清单继续写 `requires.runConfigurationTypes: 0`(旧宿主 Core 因 `deny_unknown_fields` 会直接以 `plugin.manifest.invalid` 拒绝,不会静默忽略)。`build.decodeModel` 展开模板并在 `model.run[]` 中输出 `provider: "build.run-type"` 与 `runType: {pluginID, buildSystemID, type, values}`;`runConfig.generate` 的 `providerRuns` 快照支持物化为确定性 ID(`generated:run-type:`)的 `build.run-type` 生成层配置,与手动创建的同类型配置共用分组、图标、编辑器表单和 `build.runConfigurationPlan` 启动计划;`runConfig.editorForm` 和 `runConfig.saveConfiguration` 支持直接读取并覆盖生成层的 `build.run-type` 配置,且在层合并时整体替换 `extensions.build` 以免被清空的可选字段回渗。没有新增能力版本、宿主方法、通知或 SDK 版本。 - [#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194)(待合入),[@xiaoyumuxi](https://github.com/xiaoyumuxi),`pluginAPIVersion` 0 / `litheFunctions` 0 内修正(API-03、API-16):`plugins.workflow` 在原生副作用前校验状态项引用的命令属于调用会话清单、Markdown/HTML 资源扩展名及浏览器资源的 `unsaved` 默认值;预览省略 `presentation` 时仍为 `editorAndPreview`,浏览器省略 `unsaved` 时仍为 `requireSaved`。补齐内核命令总表遗漏的 `plugins.workflow`,修正 Rust SDK 测试模块位置,并在四种官方 SDK 验证进度取消、结束与订阅释放。没有新增方法、通知、权限、错误码或协议版本。 @@ -85,7 +85,6 @@ | `managedRuntimes` | 0 | 2026-11-18 | [#96](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/96) | | `managedRuntimes` | 1 | 2026-11-19 | [#108](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/108) | | `runConfigurationTypes` | 0 | 2026-11-18 | [#94](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/94) | -| `runConfigurationTypes` | 1 | 待合入 | [#196](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/196) | | `sourceSettings` | 0 | 2026-11-15 | [#57](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/57) | | `sourceSettings` | 1 | 2026-11-17 | [#79](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/79) | | `settings` | 0 | 2026-11-11 | [#17](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/17) |