Support portable Agent Plugins throughout installation (#36544)

## Why

Agent Plugins use a schema-declared root `plugin.json` and can have dotted names or versions that do not fit Codex's directory-safe version format. The packaging and installation paths still assumed the legacy manifest layout and identifier rules.

## What changed

- Recognize valid root Agent Plugin manifests when discovering, packing, and installing plugins, while leaving unrelated root manifests on the legacy path.
- Accept safe dotted plugin names, default missing Agent Plugin versions to `1.0.0`, and derive stable directory-safe versions when necessary without rewriting the portable manifest.
- Skip legacy command migration for Agent Plugins and reject symlinks or other unsupported file types while copying plugin sources.

## Testing

Add coverage for portable bundle round trips, manifest discovery, dotted names, version handling, command preservation, and symlink rejection.

GitOrigin-RevId: 61476c4c4100495842253d8b429c0b896490962d
This commit is contained in:
jacobzhou-oai authored and copyberry committed 2026-08-02 02:29:45 +00:00
1 parent 5825699981
commit 2b5bdcf675
13 files changed
+399 -39

No files matched your search

@@ -313,6 +313,33 @@ async fn standalone_capability_root_is_not_a_plugin() {
assert_eq!(resolved, None);
}
#[tokio::test]
async fn root_agent_plugin_manifest_is_not_an_executor_plugin() {
let temp_dir = tempdir().expect("tempdir");
let plugin_root = temp_dir.path().join("agent-plugin");
write_manifest(
&plugin_root,
"plugin.json",
r#"{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "agent-plugin",
"version": "1.0.0"
}"#,
);
let provider = ExecutorPluginProvider::new(Arc::new(EnvironmentManager::default_for_tests()));
let resolved = provider
.resolve(&selected_root(
"agent-plugin",
LOCAL_ENVIRONMENT_ID,
&plugin_root,
))
.await
.expect("resolve selected root");
assert_eq!(resolved, None);
}
#[tokio::test]
async fn unavailable_environment_does_not_fall_back_to_host_filesystem() {
let temp_dir = tempdir().expect("tempdir");