Files
OpenShell/proto/README.md
Drew Newberry 77929d9c14 feat(sandbox): publish and activate sandbox backend protocol (#3898)
* feat(isolation): publish backend protocol contracts independently of runtime

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* feat(isolation): expose trusted launch and registry data contracts

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(isolation): name the required capability sandbox

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(sandbox): align protocol and compute capability names

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(sandbox): finalize public protocol contract names

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* feat(isolation)!: activate backend contracts in sandbox runtime and driver selection

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(sandbox): simplify runtime and fix backend example

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(examples): organize WASI backend in Rust

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(sandbox): defer protocol conformance fixtures

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* feat(examples): add supervised V8 backend demo

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(examples): stream V8 guest output with default policy

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(examples): handle V8 rejections and roll back failed launches

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(examples): align V8 crypto dependencies with CI AWS-LC

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* feat(sandbox): represent Sandbox Protocol operations in protobuf

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(isolation): replace backend traits with RPC clients

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(proto): remove legacy isolation protocol reservations

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(proto): clarify Sandbox Protocol names

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* docs(isolation): clarify authentication bootstrap and supervisor APIs

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(isolation): simplify policy enforcement confirmation

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(sandbox): rotate launch generations and stabilize retry sessions

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(sandbox): remove redundant backend adapters and TCP flags

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(sandbox): repair Docker restarts and macOS lint

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* refactor(isolation): simplify RPC contracts and backend registration

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

* fix(sandbox): deliver TCP denials before closing the RPC

Signed-off-by: Drew Newberry <anewberry@nvidia.com>

---------

Signed-off-by: Drew Newberry <anewberry@nvidia.com>
2026-10-16 19:18:44 +00:00

98 lines
4.2 KiB
Markdown

<!--
SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->
# Protobuf API conventions
This directory defines OpenShell's gRPC contracts. These conventions are the
source of truth for public protobuf API design. Apply them to new APIs and when
changing existing APIs; generated SDK naming follows from these definitions.
## Entity references
- Use `name` for the primary resource targeted by an RPC.
- Use the resource's role for a related resource reference, such as `sandbox`,
`provider`, `service`, or `rule`.
- Do not append `_name` to a canonical entity reference. Its value is already
the canonical name. Descriptive values, local map keys, implementation
labels, and configured registration names that are not entity references may
retain the suffix. Examples include `display_name`, `file_name`,
`driver_name`, `runtime_class_name`, `rule_name`, and `middleware_name`.
- Public callers reference entities by canonical name. Keep immutable IDs at
authentication, persistence, compute-driver, and other internal boundaries.
For example:
```proto
message GetSandboxRequest {
openshell.datamodel.v1.WorkspaceSelector workspace_scope = 2;
string name = 1;
}
message ExposeServiceRequest {
openshell.datamodel.v1.WorkspaceSelector workspace_scope = 5;
string sandbox = 1;
string name = 2;
}
```
`GetSandboxRequest.name` identifies the RPC's primary resource.
`ExposeServiceRequest.sandbox` identifies a related sandbox while `name`
identifies the service being exposed.
## Workspace scope
- Public workspace-scoped requests declare `workspace_scope` before every
other field. Existing wire field numbers do not need to follow declaration
order.
- Type `workspace_scope` as
`openshell.datamodel.v1.WorkspaceSelector`.
- Requests operating in one workspace require a non-empty canonical
`WorkspaceSelector.workspace`. The `default` workspace is an explicit name,
not an omitted-value fallback.
- Accept `WorkspaceSelector.all_workspaces` only on collection-list RPCs that
explicitly document and authorize cross-workspace access. The supported
public collections are sandboxes, sandbox templates, providers, and
services.
- Requests whose primary resource is a workspace use `name`, not
`workspace_scope`.
- Document every request that permits an omitted selector. Current exceptions
are platform provider-profile scope and authenticated sandbox bootstrap.
## Field and message design
- Prefer a dedicated request and response message for each RPC, including
requests that are currently empty.
- Use `google.protobuf.Timestamp` for absolute time and
`google.protobuf.Duration` for elapsed time.
- Use optional presence when omitted and explicitly empty values have different
meanings. Do not infer presence from a protobuf scalar's default value.
- Keep public request fields in semantic reading order. Field numbers preserve
wire identity and may therefore differ from declaration order.
- Document authorization-sensitive selector variants and omission semantics on
the containing request.
## Schema evolution
- Treat field numbers and fully qualified message names as durable wire
identities.
- When removing or renaming a field, reserve its old number and source name. Do
not reuse either for a different meaning.
- Review changes against both the public descriptor closure and durable stored
protobuf closure. The `public_and_durable_schema_inventories_are_complete`
test in `openshell-server` owns both inventories.
- Regenerate Rust, Python, Go, and TypeScript bindings after contract changes.
Run `mise run pre-commit`, the affected SDK checks, and relevant server tests
before submitting the change.
## Isolation backend protocol
[`isolation_backend.proto`](isolation_backend.proto) defines backend discovery,
boundary binding, and optional suspend/resume RPCs.
[`sandbox_protocol.proto`](sandbox_protocol.proto) defines typed workload
control, process I/O, and network mediation over the bound boundary. Both are
supervisor-to-backend contracts, not gateway RPCs. Backend authors can generate bindings independently
from these definitions. The negotiated Sandbox Protocol version covers the gRPC
services, typed messages, streaming, and lifecycle semantics.