1use std::io::Write;
2use std::path::PathBuf;
3
4use nils_common::provider_runtime;
5
6use crate::provider_profile::CODEX_PROVIDER_PROFILE;
7
8pub use nils_common::provider_runtime::{
9 CoreError, CoreErrorCategory, ProviderCategoryHint, auth, json, jwt,
10};
11
12pub fn config_snapshot() -> provider_runtime::config::RuntimeConfig {
13 provider_runtime::config::snapshot(&CODEX_PROVIDER_PROFILE)
14}
15
16pub fn resolve_secret_dir() -> Option<PathBuf> {
17 provider_runtime::paths::resolve_secret_dir(&CODEX_PROVIDER_PROFILE)
18}
19
20pub fn resolve_auth_file() -> Option<PathBuf> {
21 provider_runtime::paths::resolve_auth_file(&CODEX_PROVIDER_PROFILE)
22}
23
24pub fn resolve_secret_cache_dir() -> Option<PathBuf> {
25 provider_runtime::paths::resolve_secret_cache_dir(&CODEX_PROVIDER_PROFILE)
26}
27
28pub fn resolve_feature_dir() -> Option<PathBuf> {
29 provider_runtime::paths::resolve_feature_dir(&CODEX_PROVIDER_PROFILE)
30}
31
32pub fn resolve_script_dir() -> Option<PathBuf> {
33 provider_runtime::paths::resolve_script_dir()
34}
35
36pub fn resolve_zdotdir() -> Option<PathBuf> {
37 provider_runtime::paths::resolve_zdotdir()
38}
39
40pub fn require_allow_dangerous(caller: Option<&str>, stderr: &mut impl Write) -> bool {
41 provider_runtime::exec::require_allow_dangerous(&CODEX_PROVIDER_PROFILE, caller, stderr)
42}
43
44pub fn allow_dangerous_status(caller: Option<&str>) -> (bool, Option<String>) {
45 provider_runtime::exec::allow_dangerous_status(&CODEX_PROVIDER_PROFILE, caller)
46}
47
48pub fn check_allow_dangerous(caller: Option<&str>) -> Result<(), CoreError> {
49 provider_runtime::exec::check_allow_dangerous(&CODEX_PROVIDER_PROFILE, caller)
50}
51
52pub fn exec_dangerous(prompt: &str, caller: &str, stderr: &mut impl Write) -> i32 {
53 provider_runtime::exec::exec_dangerous(&CODEX_PROVIDER_PROFILE, prompt, caller, stderr)
54}