Secure, Fast, and Extensible Sandbox runtime for AI agents.
chore: trim comment verbosity to repo terseness
高然242f24868c7a
diff --git a/sdks/sandbox/go/types.go b/sdks/sandbox/go/types.goindex 5ae98a32a..ae39905b0 100644--- a/sdks/sandbox/go/types.go+++ b/sdks/sandbox/go/types.go@@ -653,29 +653,23 @@ type CredentialSourceType stringconst (// CredentialSourceInline carries write-only inline credential material.CredentialSourceInline CredentialSourceType = "inline"- // CredentialSourceExchange resolves header sets per request from a- // header-resolver endpoint (OSEP-0025); no local material travels.+ // CredentialSourceExchange resolves headers per request from a resolver endpoint; no local material.CredentialSourceExchange CredentialSourceType = "exchange")-// CredentialSource is a sandbox-local Credential Vault credential source.-// Exactly one kind is set, selected by Type: inline material via Value, or a-// header-resolver endpoint via Endpoint. The egress rejects sources that set-// both or neither.+// CredentialSource is a Credential Vault credential source: inline material+// (Value) or a resolver endpoint (Endpoint), never both.type CredentialSource struct {Type CredentialSourceType `json:"type,omitempty"`Value string `json:"value,omitempty"`Endpoint string `json:"endpoint,omitempty"`}-// InlineCredentialSource is an alias kept for inline-only callers; it is the-// same flat CredentialSource model.+// InlineCredentialSource is an alias of CredentialSource for inline-only callers.type InlineCredentialSource = CredentialSource-// MarshalJSON defaults the source type so callers can use the natural-// zero-value forms CredentialSource{Value: secret} (inline) and-// CredentialSource{Endpoint: resolver} (exchange); an empty Type with both-// or neither field set stays inline and is rejected downstream.+// MarshalJSON defaults the type for the zero-value forms: Value only →+// inline, Endpoint only → exchange.func (s CredentialSource) MarshalJSON() ([]byte, error) {type credentialSource CredentialSourcesource := credentialSource(s)@@ -750,11 +744,8 @@ const (CredentialAuthPassthrough CredentialAuthType = "passthrough")-// CredentialAuth configures how a binding injects credential material into-// matching outbound requests. The five static kinds set Type; the typeless-// exchange form (OSEP-0025) omits Type entirely and sets only Credential, a-// reference to an exchange-sourced credential. The egress rejects shapes-// mixing the two (for example a typeless auth with Headers or Substitutions).+// CredentialAuth configures how a binding injects credential material.+// Static kinds set Type; the typeless exchange form sets only Credential.type CredentialAuth struct {Type CredentialAuthType `json:"type,omitempty"`Credential string `json:"credential,omitempty"`@@ -811,19 +802,16 @@ type CredentialMetadata struct {Revision int `json:"revision"`}-// CredentialAuthMetadata is sanitized auth metadata returned by Credential-// Vault. It intentionally does not include credential material. Static kinds-// carry Type (plus Name for apiKey); the typeless exchange form carries only-// Credential, a credential reference.+// CredentialAuthMetadata is sanitized auth metadata. Static kinds carry+// Type (Name for apiKey); the typeless form carries only Credential.type CredentialAuthMetadata struct {Type string `json:"type,omitempty"`Name string `json:"name,omitempty"`Credential string `json:"credential,omitempty"`}-// MarshalJSON enforces the sanitized wire shape symmetrically: static kinds-// carry type (plus name for apiKey) while the typeless exchange form carries-// only the credential reference.+// MarshalJSON enforces the sanitized shape symmetrically: credential only+// when typeless, name only when typed.func (m CredentialAuthMetadata) MarshalJSON() ([]byte, error) {type credentialAuthMetadata CredentialAuthMetadataout := credentialAuthMetadata(m)diff --git a/sdks/sandbox/javascript/src/adapters/egressAdapter.ts b/sdks/sandbox/javascript/src/adapters/egressAdapter.tsindex d3ff982e4..67d8823f6 100644--- a/sdks/sandbox/javascript/src/adapters/egressAdapter.ts+++ b/sdks/sandbox/javascript/src/adapters/egressAdapter.ts@@ -145,7 +145,7 @@ function sanitizeCredentialAuthMetadata(}return auth;}- // Typeless exchange form: only the credential reference rides the wire.+ // Typeless exchange form: credential reference only.if (raw.credential != null) {return {credential: expectString(raw.credential, `${context}.credential`),diff --git a/sdks/sandbox/javascript/src/models/sandboxes.ts b/sdks/sandbox/javascript/src/models/sandboxes.tsindex 2bfe1ded8..64db38ac8 100644--- a/sdks/sandbox/javascript/src/models/sandboxes.ts+++ b/sdks/sandbox/javascript/src/models/sandboxes.ts@@ -103,13 +103,9 @@ export interface InlineCredentialSource extends Record<string, unknown> {}export interface ExchangeCredentialSource extends Record<string, unknown> {- /**- * Marks the credential as exchange-sourced.- */type: "exchange";/**- * Header-resolver endpoint (`unix:///path` or `https://host[:port]`). The- * egress validates the endpoint form; no inline material travels with it.+ * Header-resolver endpoint (`unix:///path` or `https://host[:port]`).*/endpoint: string;}@@ -207,11 +203,8 @@ export type CredentialAuth =type: "passthrough";} & CredentialAuthSubstitutions)/**- * Typeless exchange form: only a credential reference whose source must be- * exchange-sourced. The egress resolves the header set per request; static- * fields (name/headers/substitutions) are not allowed on this form. The- * `type?: never` constraint keeps typo'd static kinds compile errors- * instead of silently matching this member.+ * Typeless exchange form: only a credential reference (exchange-sourced).+ * `type?: never` keeps typo'd static kinds compile errors.*/| ({ credential: string } & { type?: never });@@ -233,8 +226,7 @@ export interface CredentialBinding extends Record<string, unknown> {export interface CredentialMetadata {name: string;/**- * Source type only (`inline` or `exchange`); plaintext source material is- * never returned.+ * Source type only (`inline` or `exchange`); never source material.*/sourceType: string;revision: number;@@ -242,7 +234,7 @@ export interface CredentialMetadata {export interface CredentialAuthMetadata {/**- * Static auth kind; omitted entirely for the typeless exchange form.+ * Static auth kind; omitted for the typeless exchange form.*/type?: string;/**@@ -250,7 +242,7 @@ export interface CredentialAuthMetadata {*/name?: string;/**- * Exchange-sourced credential reference, present only on the typeless form.+ * Exchange-sourced credential reference, typeless form only.*/credential?: string;}diff --git a/sdks/sandbox/python/src/opensandbox/models/sandboxes.py b/sdks/sandbox/python/src/opensandbox/models/sandboxes.pyindex f8a1bac23..b8be4684e 100644--- a/sdks/sandbox/python/src/opensandbox/models/sandboxes.py+++ b/sdks/sandbox/python/src/opensandbox/models/sandboxes.py@@ -463,10 +463,8 @@ class InlineCredentialSource(BaseModel):class ExchangeCredentialSource(BaseModel):"""- Exchange credential source (OSEP-0025): no local material.-- The egress resolves header sets per request from the header-resolver- endpoint; ``endpoint`` is configuration, not secret material.+ Exchange credential source (OSEP-0025): no local material; ``endpoint``+ is configuration, not secret material."""model_config = ConfigDict(extra="forbid")@@ -548,12 +546,9 @@ class CredentialSubstitution(BaseModel):class CredentialAuth(BaseModel):- """Credential Vault auth rule.-- ``type`` selects one of the five static kinds. Leaving it unset (None)- selects the typeless exchange form (OSEP-0025), which sets only- ``credential`` — a reference to an exchange-sourced credential.- """+ """Credential Vault auth rule: ``type`` selects one of the five static+ kinds; leaving it unset selects the typeless exchange form (OSEP-0025),+ which sets only ``credential``."""type: Literal["bearer", "basic", "apiKey", "customHeaders", "passthrough"] | None = (None@@ -617,12 +612,8 @@ class CredentialMetadata(BaseModel):class CredentialAuthMetadata(BaseModel):- """Sanitized auth metadata returned for a Credential Vault binding.-- Static kinds carry ``type`` (plus ``name`` for apiKey); the typeless- exchange form carries only ``credential`` (a credential reference, never- material).- """+ """Sanitized auth metadata: static kinds carry ``type`` (``name`` for+ apiKey); the typeless form carries only ``credential``."""type: str | None = Nonename: str | None = Nonediff --git a/server/opensandbox_server/api/schema.py b/server/opensandbox_server/api/schema.pyindex bdd9995e7..434feceaf 100644--- a/server/opensandbox_server/api/schema.py+++ b/server/opensandbox_server/api/schema.py@@ -235,12 +235,7 @@ class InlineCredentialSource(BaseModel):class ExchangeCredentialSource(BaseModel):- """Exchange credential source (OSEP-0025): no local material.-- The egress owns endpoint semantics (unix:///path or https://host) and the- inline/exchange cross-lock validation authoritatively; the server only- checks the wire shape here.- """+ """Exchange source (OSEP-0025); endpoint semantics stay with the egress."""type: Literal["exchange"] = Field(..., description="Credential source type.")endpoint: str = Field(@@ -355,12 +350,7 @@ class PassthroughCredentialAuth(BaseModel):class ExchangeCredentialAuth(BaseModel):- """Typeless exchange auth (OSEP-0025): only a credential reference.-- The referenced credential must be exchange-sourced; that cross-lock and- the rejection of any other field here is enforced authoritatively by the- egress (extra="forbid" already pins the server-side wire shape).- """+ """Typeless exchange auth (OSEP-0025); the cross-lock is egress-owned."""credential: str = Field(...,@@ -373,9 +363,8 @@ class ExchangeCredentialAuth(BaseModel):extra = "forbid"-# No discriminator: the exchange variant carries no `type` key at all, so the-# Literal-tagged static variants and the typeless variant are mutually-# exclusive by shape and the smart union resolves without ambiguity.+# No discriminator: the typeless variant carries no `type` key, so union+# members are mutually exclusive by shape.CredentialAuth = (BearerCredentialAuth| BasicCredentialAuth@@ -483,11 +472,10 @@ class CredentialVaultMutationRequest(BaseModel):class CredentialAuthMetadata(BaseModel):- """Sanitized auth shape — `type` (plus `name` for `apiKey`) for static- kinds; `credential` only for the typeless exchange form."""+ """Sanitized auth shape; the typeless form carries `credential` only."""type: Optional[str] = Field(- default=None, description="Injected credential shape type (static kinds)."+ default=None, description="Injected credential shape type.")name: Optional[str] = Field(default=None, description="Header name, for the apiKey shape only."diff --git a/server/opensandbox_server/services/fast_sandbox/vault.py b/server/opensandbox_server/services/fast_sandbox/vault.pyindex 58cacc27c..2f24354ab 100644--- a/server/opensandbox_server/services/fast_sandbox/vault.py+++ b/server/opensandbox_server/services/fast_sandbox/vault.py@@ -78,11 +78,8 @@ def vault_relay_error(status_code: int, message: str) -> HTTPException:def _sanitize_auth(auth: Optional[dict]) -> Optional[dict]:- """Mirror the egress sanitizeAuth: type always, name for apiKey only.-- Typeless exchange auth keeps only its credential reference and must never- serialize a ``"type": null`` key.- """+ """Mirror the egress sanitizeAuth: type (name for apiKey) for static+ kinds; the typeless exchange form keeps only the credential reference."""if not isinstance(auth, dict):return Noneauth_type = auth.get("type")