Skip to content

Commit 782cd10

Browse files
committed
feat(providers): rename v2 setting and profile listing
1 parent 9f863b3 commit 782cd10

8 files changed

Lines changed: 64 additions & 47 deletions

File tree

architecture/gateway-settings.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The `REGISTERED_SETTINGS` static array defines the allowed setting keys and thei
3030

3131
```rust
3232
pub const REGISTERED_SETTINGS: &[RegisteredSetting] = &[
33-
RegisteredSetting { key: "use_providers_v2", kind: SettingValueKind::Bool },
33+
RegisteredSetting { key: "providers_v2_enabled", kind: SettingValueKind::Bool },
3434
RegisteredSetting { key: "ocsf_json_enabled", kind: SettingValueKind::Bool },
3535
];
3636
```
@@ -375,11 +375,11 @@ Set a single setting key at sandbox or global scope.
375375
openshell settings set my-sandbox --key ocsf_json_enabled --value true
376376

377377
# Global (requires confirmation)
378-
openshell settings set --global --key use_providers_v2 --value true
378+
openshell settings set --global --key providers_v2_enabled --value true
379379
openshell settings set --global --key ocsf_json_enabled --value true
380380

381381
# Skip confirmation
382-
openshell settings set --global --key use_providers_v2 --value true --yes
382+
openshell settings set --global --key providers_v2_enabled --value true --yes
383383
```
384384

385385
Value parsing is type-aware: bool keys accept `true/false/yes/no/1/0/on/off` via `parse_bool_like()`. Int keys parse as base-10 `i64`. String keys accept any value.
@@ -390,7 +390,7 @@ Delete a setting key from the specified scope.
390390

391391
```bash
392392
# Global delete (unlocks sandbox control)
393-
openshell settings delete --global --key use_providers_v2 --yes
393+
openshell settings delete --global --key providers_v2_enabled --yes
394394
```
395395

396396
### `policy set --global --policy FILE [--yes]`
@@ -500,17 +500,17 @@ Settings are refreshed on each 2-second polling tick alongside the sandbox list
500500

501501
## Data Flow: Setting a Global Key
502502

503-
End-to-end trace for `openshell settings set --global --key use_providers_v2 --value true --yes`:
503+
End-to-end trace for `openshell settings set --global --key providers_v2_enabled --value true --yes`:
504504

505505
1. **CLI** (`crates/openshell-cli/src/run.rs` -- `gateway_setting_set()`):
506-
- `parse_cli_setting_value("use_providers_v2", "true")` -- looks up `SettingValueKind::Bool` in the registry, wraps as `SettingValue { bool_value: true }`
506+
- `parse_cli_setting_value("providers_v2_enabled", "true")` -- looks up `SettingValueKind::Bool` in the registry, wraps as `SettingValue { bool_value: true }`
507507
- `confirm_global_setting_takeover()` -- skipped because `--yes`
508-
- Sends `UpdateSettingsRequest { setting_key: "use_providers_v2", setting_value: Some(...), global: true }`
508+
- Sends `UpdateSettingsRequest { setting_key: "providers_v2_enabled", setting_value: Some(...), global: true }`
509509

510510
2. **Gateway** (`crates/openshell-server/src/grpc.rs` -- `update_settings()`):
511511
- Acquires `settings_mutex` for the duration of the operation
512512
- Detects `global=true`, `has_setting=true`
513-
- `validate_registered_setting_key("use_providers_v2")` -- passes (key is in registry)
513+
- `validate_registered_setting_key("providers_v2_enabled")` -- passes (key is in registry)
514514
- `load_global_settings()` -- reads `gateway_settings` record from store
515515
- `proto_setting_to_stored()` -- converts proto value to `StoredSettingValue::Bool(true)`
516516
- `upsert_setting_value()` -- inserts into `BTreeMap`, returns `true` (changed)
@@ -519,7 +519,7 @@ End-to-end trace for `openshell settings set --global --key use_providers_v2 --v
519519

520520
3. **Sandbox** (next poll tick in `run_policy_poll_loop()`):
521521
- `poll_settings(sandbox_id)` returns new `config_revision`
522-
- `log_setting_changes()` logs: `Setting changed key="use_providers_v2" old="<unset>" new="true"`
522+
- `log_setting_changes()` logs: `Setting changed key="providers_v2_enabled" old="<unset>" new="true"`
523523
- `policy_hash` unchanged -- no OPA reload
524524
- Updates tracked `current_config_revision` and `current_settings`
525525

architecture/sandbox-providers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ inference-capable when their tool talks to an inference API.
6464
Profiles are additive to provider records. A provider record with only `type`,
6565
`credentials`, and `config` can be matched to built-in profile metadata by
6666
`provider.type`. Profile-generated policy is still opt-in: the gateway composes provider
67-
profile rules only when the gateway-global `use_providers_v2` setting is true.
67+
profile rules only when the gateway-global `providers_v2_enabled` setting is true.
6868

6969
This keeps the compatibility boundary at the gateway. A gateway without
70-
`use_providers_v2=true` keeps the existing credential-only provider behavior, while a
70+
`providers_v2_enabled=true` keeps the existing credential-only provider behavior, while a
7171
gateway with the flag enabled routes all attached known provider types through the
7272
profile-backed policy path.
7373

@@ -92,7 +92,7 @@ host/port endpoints across policy and provider rules are valid; OPA evaluates al
9292
rules, so allow decisions are the union of matching allows and deny rules continue to
9393
win globally.
9494

95-
Gateway-global policy still overrides sandbox-authored policy. When `use_providers_v2`
95+
Gateway-global policy still overrides sandbox-authored policy. When `providers_v2_enabled`
9696
is true, provider layers compose JIT onto the effective policy source, whether that
9797
source is sandbox-scoped or global. The composed payload is derived data and is not
9898
persisted as a policy revision.
@@ -228,7 +228,7 @@ Also supported:
228228

229229
- `openshell provider get <name>`
230230
- `openshell provider list`
231-
- `openshell provider list-types`
231+
- `openshell provider list-profiles`
232232
- `openshell provider update <name> ...`
233233
- `openshell provider delete <name> [<name>...]`
234234

crates/openshell-cli/src/main.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ const POLICY_EXAMPLES: &str = "\x1b[1mALIAS\x1b[0m
299299
const SETTINGS_EXAMPLES: &str = "\x1b[1mEXAMPLES\x1b[0m
300300
$ openshell settings get my-sandbox
301301
$ openshell settings get --global
302-
$ openshell settings set --global --key use_providers_v2 --value true
302+
$ openshell settings set --global --key providers_v2_enabled --value true
303303
$ openshell settings set my-sandbox --key ocsf_json_enabled --value true
304304
$ openshell settings set --global --key ocsf_json_enabled --value true
305-
$ openshell settings delete --global --key use_providers_v2
305+
$ openshell settings delete --global --key providers_v2_enabled
306306
";
307307

308308
const PROVIDER_EXAMPLES: &str = "\x1b[1mEXAMPLES\x1b[0m
@@ -734,9 +734,9 @@ enum ProviderCommands {
734734
names: bool,
735735
},
736736

737-
/// List available provider types.
737+
/// List available provider profiles.
738738
#[command(help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
739-
ListTypes,
739+
ListProfiles,
740740

741741
/// Update an existing provider's credentials or config.
742742
#[command(help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
@@ -2767,8 +2767,8 @@ async fn main() -> Result<()> {
27672767
} => {
27682768
run::provider_list(endpoint, limit, offset, names, &tls).await?;
27692769
}
2770-
ProviderCommands::ListTypes => {
2771-
run::provider_list_types(endpoint, &tls).await?;
2770+
ProviderCommands::ListProfiles => {
2771+
run::provider_list_profiles(endpoint, &tls).await?;
27722772
}
27732773
ProviderCommands::Update {
27742774
name,
@@ -3460,6 +3460,19 @@ mod tests {
34603460
}
34613461
}
34623462

3463+
#[test]
3464+
fn provider_list_profiles_parses() {
3465+
let cli = Cli::try_parse_from(["openshell", "provider", "list-profiles"])
3466+
.expect("provider list-profiles should parse");
3467+
3468+
assert!(matches!(
3469+
cli.command,
3470+
Some(Commands::Provider {
3471+
command: Some(ProviderCommands::ListProfiles)
3472+
})
3473+
));
3474+
}
3475+
34633476
#[test]
34643477
fn settings_set_global_parses_yes_flag() {
34653478
let cli = Cli::try_parse_from([

crates/openshell-cli/src/run.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3980,7 +3980,7 @@ pub async fn provider_list(
39803980
Ok(())
39813981
}
39823982

3983-
pub async fn provider_list_types(server: &str, tls: &TlsOptions) -> Result<()> {
3983+
pub async fn provider_list_profiles(server: &str, tls: &TlsOptions) -> Result<()> {
39843984
let mut client = grpc_client(server, tls).await?;
39853985
let response = client
39863986
.list_provider_profiles(ListProviderProfilesRequest {
@@ -3997,11 +3997,11 @@ pub async fn provider_list_types(server: &str, tls: &TlsOptions) -> Result<()> {
39973997
});
39983998

39993999
if profiles.is_empty() {
4000-
println!("No provider types found.");
4000+
println!("No provider profiles found.");
40014001
return Ok(());
40024002
}
40034003

4004-
println!("{}", "Available Provider Types:".cyan().bold());
4004+
println!("{}", "Available Provider Profiles:".cyan().bold());
40054005
let mut current_category = i32::MIN;
40064006
for profile in profiles {
40074007
if profile.category != current_category {

crates/openshell-cli/tests/provider_commands_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,12 @@ async fn provider_cli_run_functions_support_full_crud_flow() {
551551
}
552552

553553
#[tokio::test]
554-
async fn provider_list_types_cli_uses_profile_browsing_rpc() {
554+
async fn provider_list_profiles_cli_uses_profile_browsing_rpc() {
555555
let ts = run_server().await;
556556

557-
run::provider_list_types(&ts.endpoint, &ts.tls)
557+
run::provider_list_profiles(&ts.endpoint, &ts.tls)
558558
.await
559-
.expect("provider list-types");
559+
.expect("provider list-profiles");
560560
}
561561

562562
#[tokio::test]

crates/openshell-core/src/settings.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ pub struct RegisteredSetting {
4848
/// settable via `settings set`. The server validates that only registered
4949
/// keys are accepted.
5050
/// 5. Add a unit test in this module's `tests` section to cover the new key.
51-
pub const USE_PROVIDERS_V2_KEY: &str = "use_providers_v2";
51+
pub const PROVIDERS_V2_ENABLED_KEY: &str = "providers_v2_enabled";
5252

5353
pub const REGISTERED_SETTINGS: &[RegisteredSetting] = &[
5454
// Gateway-level opt-in for provider profile policy composition. Defaults
5555
// to false when unset.
5656
RegisteredSetting {
57-
key: USE_PROVIDERS_V2_KEY,
57+
key: PROVIDERS_V2_ENABLED_KEY,
5858
kind: SettingValueKind::Bool,
5959
},
6060
// When true the sandbox writes OCSF v1.7.0 JSONL records to
@@ -107,7 +107,7 @@ pub fn parse_bool_like(raw: &str) -> Option<bool> {
107107
#[cfg(test)]
108108
mod tests {
109109
use super::{
110-
REGISTERED_SETTINGS, RegisteredSetting, SettingValueKind, USE_PROVIDERS_V2_KEY,
110+
PROVIDERS_V2_ENABLED_KEY, REGISTERED_SETTINGS, RegisteredSetting, SettingValueKind,
111111
parse_bool_like, registered_keys_csv, setting_for_key,
112112
};
113113

@@ -132,9 +132,9 @@ mod tests {
132132
}
133133

134134
#[test]
135-
fn setting_for_key_returns_use_providers_v2() {
136-
let setting =
137-
setting_for_key(USE_PROVIDERS_V2_KEY).expect("use_providers_v2 should be registered");
135+
fn setting_for_key_returns_providers_v2_enabled() {
136+
let setting = setting_for_key(PROVIDERS_V2_ENABLED_KEY)
137+
.expect("providers_v2_enabled should be registered");
138138
assert_eq!(setting.kind, SettingValueKind::Bool);
139139
}
140140

crates/openshell-server/src/grpc/policy.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ pub(super) async fn handle_get_sandbox_config(
436436
let global_settings = load_global_settings(state.store.as_ref()).await?;
437437
let sandbox_settings =
438438
load_sandbox_settings(state.store.as_ref(), sandbox.object_name()).await?;
439-
let use_providers_v2 = bool_setting_enabled(&global_settings, settings::USE_PROVIDERS_V2_KEY)?;
439+
let providers_v2_enabled =
440+
bool_setting_enabled(&global_settings, settings::PROVIDERS_V2_ENABLED_KEY)?;
440441

441442
let mut global_policy_version: u32 = 0;
442443

@@ -456,7 +457,7 @@ pub(super) async fn handle_get_sandbox_config(
456457
}
457458
}
458459

459-
if use_providers_v2
460+
if providers_v2_enabled
460461
&& !matches!(policy_source, PolicySource::Global)
461462
&& let Some(source_policy) = policy.as_ref()
462463
{
@@ -2828,7 +2829,7 @@ mod tests {
28282829
let global_settings = StoredSettings {
28292830
revision: 1,
28302831
settings: std::iter::once((
2831-
settings::USE_PROVIDERS_V2_KEY.to_string(),
2832+
settings::PROVIDERS_V2_ENABLED_KEY.to_string(),
28322833
StoredSettingValue::Bool(true),
28332834
))
28342835
.collect(),
@@ -2892,22 +2893,25 @@ mod tests {
28922893
}
28932894

28942895
#[test]
2895-
fn use_providers_v2_defaults_false_when_unset() {
2896+
fn providers_v2_enabled_defaults_false_when_unset() {
28962897
assert!(
2897-
!bool_setting_enabled(&StoredSettings::default(), settings::USE_PROVIDERS_V2_KEY)
2898-
.unwrap()
2898+
!bool_setting_enabled(
2899+
&StoredSettings::default(),
2900+
settings::PROVIDERS_V2_ENABLED_KEY
2901+
)
2902+
.unwrap()
28992903
);
29002904
}
29012905

29022906
#[test]
2903-
fn use_providers_v2_reads_global_bool_setting() {
2907+
fn providers_v2_enabled_reads_global_bool_setting() {
29042908
let mut settings = StoredSettings::default();
29052909
settings.settings.insert(
2906-
settings::USE_PROVIDERS_V2_KEY.to_string(),
2910+
settings::PROVIDERS_V2_ENABLED_KEY.to_string(),
29072911
StoredSettingValue::Bool(true),
29082912
);
29092913

2910-
assert!(bool_setting_enabled(&settings, settings::USE_PROVIDERS_V2_KEY).unwrap());
2914+
assert!(bool_setting_enabled(&settings, settings::PROVIDERS_V2_ENABLED_KEY).unwrap());
29112915
}
29122916

29132917
#[tokio::test]
@@ -3226,7 +3230,7 @@ mod tests {
32263230
revision: 1,
32273231
settings: [
32283232
(
3229-
settings::USE_PROVIDERS_V2_KEY.to_string(),
3233+
settings::PROVIDERS_V2_ENABLED_KEY.to_string(),
32303234
StoredSettingValue::Bool(true),
32313235
),
32323236
(

docs/sandboxes/manage-providers.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ AI agents typically need credentials to access external services: an API key for
1212

1313
Create and manage providers that supply credentials to sandboxes.
1414

15-
Provider types include profile metadata for known endpoints and binaries. View
16-
the available provider types before creating a provider:
15+
Provider profiles include metadata for known endpoints and binaries. View
16+
the available profiles before creating a provider:
1717

1818
```shell
19-
openshell provider list-types
19+
openshell provider list-profiles
2020
```
2121

2222
## Create a Provider
@@ -58,10 +58,10 @@ Provider profile metadata is available for known provider types. Provider profil
5858
network policy is gateway opt-in:
5959

6060
```shell
61-
openshell settings set --global --key use_providers_v2 --value true
61+
openshell settings set --global --key providers_v2_enabled --value true
6262
```
6363

64-
Without `use_providers_v2=true`, provider behavior remains credential-only.
64+
Without `providers_v2_enabled=true`, provider behavior remains credential-only.
6565

6666
## Manage Providers
6767

@@ -102,7 +102,7 @@ openshell sandbox create --provider my-claude --provider my-github -- claude
102102
Each `--provider` flag attaches one provider. The sandbox receives all
103103
credentials from every attached provider at runtime. Profile-managed providers
104104
also contribute provider-generated network policy entries when
105-
`use_providers_v2` is enabled at the gateway. When the setting is disabled,
105+
`providers_v2_enabled` is enabled at the gateway. When the setting is disabled,
106106
providers keep the previous behavior and only provide credentials.
107107

108108
<Warning>

0 commit comments

Comments
 (0)