Skip to content

Commit b9aac8a

Browse files
committed
feat(providers): make profiles authoritative
Closes #1988 Signed-off-by: John Myers <[email protected]>
1 parent 5c541e1 commit b9aac8a

53 files changed

Lines changed: 911 additions & 1754 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/openshell-cli/SKILL.md‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ The `--from-existing` flag discovers credentials from local state (e.g., `gh aut
121121
### Create a provider with explicit credentials
122122

123123
```bash
124-
openshell provider create --name my-api --type generic \
125-
--credential API_KEY \
126-
--config base_url=https://api.example.com
124+
openshell provider create --name my-openai --type openai \
125+
--credential OPENAI_API_KEY
127126
```
128127

129128
Bare `KEY` reads the value from the environment variable of that name and avoids placing the secret in shell history. Use `KEY=VALUE` only when the user explicitly accepts that exposure.
@@ -143,14 +142,9 @@ must match. For a tunnel to `api.example.com:8443`, send
143142
port and is rejected. An absolute-form request target must use the same
144143
authority.
145144

146-
Profile-backed provider policy composition is controlled by the gateway-global
147-
`providers_v2_enabled` setting. Static credential endpoint binding remains
148-
active even when policy composition is disabled:
149-
150-
```bash
151-
openshell settings get --global
152-
openshell settings set --global --key providers_v2_enabled --value true
153-
```
145+
Profile-backed providers always contribute policy unless a gateway-global
146+
policy is active. Static credential endpoint binding remains independently
147+
enforced.
154148

155149
### Inspect and manage provider profiles
156150

@@ -177,13 +171,13 @@ openshell provider delete my-github
177171
Use refresh commands only when the provider profile and gateway support refreshable credentials:
178172

179173
```bash
180-
openshell provider refresh status my-outlook
181-
openshell provider refresh configure my-outlook \
174+
openshell provider refresh status my-provider
175+
openshell provider refresh configure my-provider \
182176
--credential-key MS_GRAPH_ACCESS_TOKEN \
183177
--strategy oauth2-refresh-token \
184178
--secret-material-env REFRESH_TOKEN=MS_GRAPH_REFRESH_TOKEN \
185179
--credential-expires-at 2026-07-16T00:00:00Z
186-
openshell provider refresh rotate my-outlook --credential-key MS_GRAPH_ACCESS_TOKEN
180+
openshell provider refresh rotate my-provider --credential-key ACCESS_TOKEN
187181
```
188182

189183
Prefer `--secret-material-env KEY[=ENVVAR]` for secret refresh material. `--material KEY=VALUE` is for non-secret material; `--secret-material-key` marks supplied material keys as secret.
@@ -712,7 +706,7 @@ openshell settings set work-session --key ocsf_json_enabled --value true
712706
openshell settings delete work-session --key ocsf_json_enabled
713707

714708
openshell settings get --global --json
715-
openshell settings set --global --key providers_v2_enabled --value true
709+
openshell settings set --global --key ocsf_json_enabled --value true
716710
```
717711
718712
Global mutations prompt for confirmation. Use `--yes` only in reviewed automation.

‎.agents/skills/tui-development/SKILL.md‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Gateway (discovered via openshell_bootstrap::list_gateways())
4343

4444
- **Gateways** are discovered from on-disk config via `openshell_bootstrap::list_gateways()`. Each gateway has a name, endpoint, local/remote flag, and source label.
4545
- **Workspaces** are fetched via `ListWorkspaces`. The user cycles through workspaces with `[w]`, or views all workspaces at once. The current workspace scopes provider and sandbox lists.
46-
- **Provider Profiles** are fetched per-workspace via `ListProviderProfiles` when `providers_v2_enabled` is true. Profiles are cached in a `ProviderProfileCache` keyed by `(workspace, profile_id)` and matched to providers by type. They provide category, credential metadata, endpoint/binary counts, and inference capability.
47-
- **Providers** are fetched via `ListProviders` scoped to the current workspace. Each `ProviderListEntry` pairs a provider with its optional cached profile. When `providers_v2_enabled` is true, CRUD operations are read-only in the TUI; when false, the TUI supports create/update/delete.
46+
- **Provider Profiles** are fetched per-workspace via `ListProviderProfiles`. Profiles are cached in a `ProviderProfileCache` keyed by `(workspace, profile_id)` and matched to providers by type. They provide category, credential metadata, endpoint/binary counts, and inference capability.
47+
- **Providers** are fetched via `ListProviders` scoped to the current workspace. Each `ProviderListEntry` pairs a provider with its optional cached profile. The TUI supports profile-backed create, update, and delete operations.
4848
- **Global Settings** are fetched via `GetGatewayConfig` and displayed in a tabbed pane alongside providers on the dashboard. Each setting is a registered key with a typed value (bool/int/string). Platform-admin access is required; `PermissionDenied` disables the pane.
4949
- **Sandboxes** belong to the active gateway and workspace. Fetched via `ListSandboxes` with a periodic tick refresh.
5050
- **Sandbox Settings** are effective settings returned by `GetSandboxConfig`, each with a scope (sandbox, global, or unset). Globally-managed settings are blocked from sandbox-level edits.
@@ -170,7 +170,7 @@ Phase 2: WatchSandbox(follow_logs: true) → live tail → send via Event::L
170170

171171
**Sandboxes**: Fetched via `ListSandboxes` on a 2-second tick, scoped to the current workspace (or all workspaces).
172172

173-
**Providers**: Fetched via `ListProviders` on each tick. When `providers_v2_enabled` is true, provider profiles are also fetched per-workspace via `ListProviderProfiles` and cached in a `ProviderProfileCache` keyed by `(workspace, profile_id)`.
173+
**Providers**: Fetched via `ListProviders` on each tick. Provider profiles are fetched per-workspace via `ListProviderProfiles` and cached in a `ProviderProfileCache` keyed by `(workspace, profile_id)`.
174174

175175
**Settings**: Global settings are fetched via `GetGatewayConfig` on each tick. Sandbox settings are fetched alongside the sandbox policy via `GetSandboxConfig` and refreshed on each tick when viewing a sandbox.
176176

@@ -321,7 +321,7 @@ TUI actions should parallel `openshell` CLI commands so users have familiar ment
321321
| `openshell sandbox connect` | `[s]` on sandbox policy view to launch SSH shell |
322322
| `openshell logs <name>` | `[l]` on sandbox detail to open log viewer |
323323
| `openshell provider list` | Provider table on Dashboard (middle pane) |
324-
| `openshell provider create` | `[c]` on provider panel (when not providers_v2) |
324+
| `openshell provider create` | `[c]` on provider panel |
325325
| `openshell status` | Status in title bar + gateway list |
326326

327327
When adding new TUI features, check what the CLI offers and maintain consistency.
@@ -383,10 +383,7 @@ All actions are accessible via keyboard shortcuts displayed in the nav bar. The
383383
**Dashboard (Gateways focus):**
384384
`[Tab] Switch Panel [Enter] Select [j/k] Navigate │ [:] Command [q] Quit`
385385

386-
**Dashboard (Providers focus, providers_v2):**
387-
`[Tab] Switch Panel [h/l] Switch Tab [j/k] Navigate [Enter] Detail read-only │ [:] Command [q] Quit`
388-
389-
**Dashboard (Providers focus, legacy):**
386+
**Dashboard (Providers focus):**
390387
`[Tab] Switch Panel [h/l] Switch Tab [j/k] Navigate [Enter] Detail [c] Create [u] Update [d] Delete │ [:] Command [q] Quit`
391388

392389
**Dashboard (Global Settings focus):**
@@ -412,7 +409,7 @@ All actions are accessible via keyboard shortcuts displayed in the nav bar. The
412409
| File | Purpose |
413410
| --- | --- |
414411
| `crates/openshell-tui/Cargo.toml` | Crate manifest — dependencies on `openshell-core`, `openshell-bootstrap`, `ratatui`, `crossterm`, `tonic`, `tokio` |
415-
| `crates/openshell-tui/src/lib.rs` | Entry point. Event loop, gRPC calls (`refresh_data`, `refresh_providers`, `refresh_global_settings`, `refresh_workspaces`, `refresh_sandboxes`, `spawn_log_stream`, `handle_sandbox_delete`, `fetch_providers_v2_setting`), gateway switching, mTLS channel building, provider CRUD spawners, settings CRUD spawners, draft approval spawners |
412+
| `crates/openshell-tui/src/lib.rs` | Entry point. Event loop, gRPC calls (`refresh_data`, `refresh_providers`, `refresh_global_settings`, `refresh_workspaces`, `refresh_sandboxes`, `spawn_log_stream`, `handle_sandbox_delete`), gateway switching, mTLS channel building, provider CRUD spawners, settings CRUD spawners, draft approval spawners |
416413
| `crates/openshell-tui/src/app.rs` | `App` state struct, `Screen`/`Focus`/`InputMode`/`LogSourceFilter`/`MiddlePaneTab`/`SandboxPolicyTab` enums, `LogLine`/`GatewayEntry`/`GlobalSettingEntry`/`SandboxSettingEntry`/`ProviderListEntry`/`ProviderDetailView` structs, create sandbox/provider form state, all key handling logic |
417414
| `crates/openshell-tui/src/event.rs` | `Event` enum (`Key`, `Mouse`, `Tick`, `Redraw`, `Resize`, `LogLines`, `CreateResult`, `ProviderCreateResult`, `ProviderDetailFetched`, `ProviderUpdateResult`, `ProviderDeleteResult`, `DraftActionResult`, `GlobalSettingsFetched`, `GlobalSettingSetResult`, `GlobalSettingDeleteResult`, `SandboxSettingSetResult`, `SandboxSettingDeleteResult`, `ForwardWarnings`), `EventHandler` with mpsc channels and crossterm polling |
418415
| `crates/openshell-tui/src/theme.rs` | `colors` module (NVIDIA_GREEN, EVERGLADE, BG, FG) and `styles` module (all `Style` constants) |
@@ -526,17 +523,15 @@ The connect timeout for gateway switching is 10 seconds with HTTP/2 keepalive at
526523
4. On success:
527524
- `app.client` is replaced with a new intercepted client
528525
- `reset_sandbox_state()` clears all sandbox/log/draft/policy data
529-
- `fetch_providers_v2_setting()` probes the new gateway's `GetGatewayConfig` to determine whether providers_v2 mode is enabled, so provider CRUD controls render correctly
530526
- `refresh_data()` runs the full capability refresh sequence: `refresh_health` → `refresh_global_settings` → `refresh_workspaces` → `refresh_providers` → `refresh_sandboxes`
531527
5. On failure: `status_text` shows the error
532528

533529
### Initial startup lifecycle
534530

535531
On launch, before the event loop starts:
536532

537-
1. `fetch_providers_v2_setting()` — probe gateway capability
538-
2. `refresh_gateway_list()` — discover gateways from disk
539-
3. `refresh_data()` — full refresh (health, global settings, workspaces, providers, sandboxes)
533+
1. `refresh_gateway_list()` — discover gateways from disk
534+
2. `refresh_data()` — full refresh (health, global settings, workspaces, providers, sandboxes)
540535

541536
### Workspace switching lifecycle
542537

‎architecture/google-vertex-ai-provider.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ The `discovery` section lists `[service_account_token, gcloud_adc_token]` as the
375375
credential sources the gateway will scan during `--from-existing`.
376376

377377
The `endpoints` section enumerates all Vertex AI API hosts that sandbox network
378-
policies must permit when `providers_v2_enabled=true`:
378+
policies permit through provider profile composition:
379379

380380
- `*-aiplatform.googleapis.com:443` (regional endpoints)
381381
- `aiplatform.googleapis.com:443` (global endpoint)

‎crates/openshell-cli/src/main.rs‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,9 @@ const POLICY_EXAMPLES: &str = "\x1b[1mALIAS\x1b[0m
368368
const SETTINGS_EXAMPLES: &str = "\x1b[1mEXAMPLES\x1b[0m
369369
$ openshell settings get my-sandbox
370370
$ openshell settings get --global
371-
$ openshell settings set --global --key providers_v2_enabled --value true
372371
$ openshell settings set my-sandbox --key ocsf_json_enabled --value true
373372
$ openshell settings set --global --key ocsf_json_enabled --value true
374-
$ openshell settings delete --global --key providers_v2_enabled
373+
$ openshell settings delete --global --key ocsf_json_enabled
375374
";
376375

377376
const PROVIDER_EXAMPLES: &str = "\x1b[1mEXAMPLES\x1b[0m
@@ -811,7 +810,7 @@ impl From<CliEditor> for openshell_cli::ssh::Editor {
811810
#[derive(Subcommand, Debug)]
812811
enum ProviderCommands {
813812
/// Create a provider config.
814-
#[command(group = clap::ArgGroup::new("cred_source").required(true).multiple(true).args(["from_existing", "credentials", "from_gcloud_adc", "runtime_credentials", "from_oidc_token"]), help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
813+
#[command(group = clap::ArgGroup::new("cred_source").required(false).multiple(true).args(["from_existing", "credentials", "from_gcloud_adc", "runtime_credentials", "from_oidc_token"]), help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
815814
Create {
816815
/// Provider name.
817816
#[arg(long)]
@@ -4733,8 +4732,8 @@ mod tests {
47334732
}
47344733

47354734
#[test]
4736-
fn provider_create_requires_credential_source() {
4737-
let err = Cli::try_parse_from([
4735+
fn provider_create_accepts_no_credential_source() {
4736+
let cli = Cli::try_parse_from([
47384737
"openshell",
47394738
"provider",
47404739
"create",
@@ -4743,9 +4742,21 @@ mod tests {
47434742
"--type",
47444743
"spiffe-token-demo",
47454744
])
4746-
.expect_err("provider create should require a credential source");
4745+
.expect("provider create should allow profiles without static credentials");
47474746

4748-
assert!(err.to_string().contains("--runtime-credentials"));
4747+
assert!(matches!(
4748+
cli.command,
4749+
Some(Commands::Provider {
4750+
command: Some(ProviderCommands::Create {
4751+
from_existing: false,
4752+
credentials,
4753+
from_gcloud_adc: false,
4754+
from_oidc_token: false,
4755+
runtime_credentials: false,
4756+
..
4757+
})
4758+
}) if credentials.is_empty()
4759+
));
47494760
}
47504761

47514762
#[test]

0 commit comments

Comments
 (0)