Skip to main content

Crate soma_domain

Crate soma_domain 

Source
Expand description

Soma’s product-domain invariants (plan section 6.2): the action catalog, error taxonomy, scope/token-budget policy, and CLI provider-validation rules shared identically across REST, CLI, and MCP dispatch.

Split out of soma-contracts in PR 13 rather than soma-application because soma-service (a dependency of soma-application during the PR 12 strangler migration) also builds its static-Rust provider catalog directly from these types; every consumer (application, service, api, cli, mcp, integrations, runtime, apps/soma) can already depend on soma-domain without creating a cycle. See the per-module “module-placement rationale” notes (e.g. the bottom of actions.rs) for the full reasoning.

Modules§

actions
Soma’s own action catalog: the invariant action-spec table below and request-parsing shared identically across REST, CLI, and MCP dispatch.
authz
Provider-dispatch authorization: safety-class → scope affinity, caller trust discipline, and structured security decisions.
errors
Structured tool/service error DTO shared by REST and MCP error rendering.
provider_validation
Soma policy layered over provider-core’s transport-neutral validation.
scopes
Canonical Soma authorization scope constants.
token_limit
Response size cap — prevents context-window exhaustion in MCP clients.

Structs§

Principal
An authenticated caller identity and the scopes it holds.
RequestId
A validated request identifier: non-empty, bounded in length, and free of control characters.
ScopeSet
A deduplicated, order-stable set of scope strings.
TraceContext
W3C Trace Context propagation fields carried with a request.

Enums§

AuthorizationMode
How the request’s authorization was established.
Confirmation
Whether a destructive operation has been explicitly confirmed by the caller.
RequestIdError
Reasons a RequestId can fail validation.
Surface
The entry point through which a request reached the service.