Files
OpenShell/crates/openshell-sdk/src/raw.rs
Max Dubrinsky 5d5cfe9a0d feat(sdk): extract openshell-sdk crate
Per RFC 0005, lift the gRPC client, TLS, OIDC, edge-tunnel, and refresh
plumbing out of openshell-cli into a new openshell-sdk crate. CLI and
TUI now consume the SDK; openshell-cli/src/{tls.rs,oidc_auth.rs} shrink
to thin wrappers over the SDK's transport and OIDC modules.

- New crate openshell-sdk exposes a typed gRPC client, TLS resolver,
  OidcRefresher with single-flight semantics, edge-tunnel dialer, and a
  Sandbox-API surface that mirrors the existing CLI behavior.
- crates/openshell-core/src/auth.rs moves into the SDK as auth.rs.
- crates/openshell-cli/src/edge_tunnel.rs moves into the SDK as
  edge_tunnel.rs.

Tests: 3 unit + 10 mock-gateway integration tests in openshell-sdk.
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
2026-06-26 12:42:11 -04:00

46 lines
1.8 KiB
Rust

// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//! Escape hatch — direct access to the generated tonic clients and protobuf
//! types.
//!
//! Use this module when the curated high-level surface in
//! [`crate::client::OpenShellClient`] doesn't expose the RPC or field you
//! need. The high-level surface is sandbox-focused for MVP; inference,
//! providers, policy, logs, settings, SSH, and forwarding all live here.
//!
//! ```ignore
//! use openshell_sdk::{ClientConfig, OpenShellClient};
//! use openshell_sdk::raw::ListProvidersRequest;
//!
//! let client = OpenShellClient::connect(ClientConfig::new("http://127.0.0.1:8080")).await?;
//! let mut grpc = client.raw_grpc();
//! let providers = grpc.list_providers(ListProvidersRequest::default()).await?;
//! ```
pub use openshell_core::proto;
pub use openshell_core::proto::inference_client::InferenceClient;
pub use openshell_core::proto::open_shell_client::OpenShellClient as GrpcClient;
pub use openshell_core::proto::{
CreateSandboxRequest, DeleteSandboxRequest, ExecSandboxRequest, GetSandboxRequest,
HealthRequest, ListProvidersRequest, ListSandboxesRequest, Sandbox,
SandboxPhase as ProtoSandboxPhase, SandboxSpec as ProtoSandboxSpec, SandboxTemplate,
ServiceStatus as ProtoServiceStatus,
};
/// Type alias for the gRPC client wrapped in the SDK's auth interceptor.
pub type AuthedGrpcClient = GrpcClient<
tonic::service::interceptor::InterceptedService<
tonic::transport::Channel,
crate::EdgeAuthInterceptor,
>,
>;
/// Type alias for the inference client wrapped in the SDK's auth interceptor.
pub type AuthedInferenceClient = InferenceClient<
tonic::service::interceptor::InterceptedService<
tonic::transport::Channel,
crate::EdgeAuthInterceptor,
>,
>;