Load bundled auth plugins shipped with the Rust runtime.
(&self, context: &PluginContext)
| 154 | |
| 155 | /// Load bundled auth plugins shipped with the Rust runtime. |
| 156 | pub async fn load_builtins(&self, context: &PluginContext) -> Result<(), PluginLoaderError> { |
| 157 | let cache_dir = dirs::cache_dir() |
| 158 | .unwrap_or_else(|| PathBuf::from("/tmp")) |
| 159 | .join("opencode") |
| 160 | .join("plugins") |
| 161 | .join("builtin"); |
| 162 | std::fs::create_dir_all(&cache_dir)?; |
| 163 | |
| 164 | let codex_path = cache_dir.join("builtin-codex-auth.ts"); |
| 165 | std::fs::write(&codex_path, BUILTIN_CODEX_AUTH)?; |
| 166 | |
| 167 | let copilot_path = cache_dir.join("builtin-copilot-auth.ts"); |
| 168 | std::fs::write(&copilot_path, BUILTIN_COPILOT_AUTH)?; |
| 169 | |
| 170 | let specs = vec![ |
| 171 | format!("file://{}", codex_path.display()), |
| 172 | format!("file://{}", copilot_path.display()), |
| 173 | ]; |
| 174 | self.load_all(&specs, context).await |
| 175 | } |
| 176 | |
| 177 | /// Get all loaded plugin clients. |
| 178 | pub async fn clients(&self) -> Vec<Arc<PluginSubprocess>> { |
no test coverage detected