Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
guardrails-llm-filter-extproc
command
|
|
|
rulesgen
command
|
|
|
examples
|
|
|
quickstart/mock-llm
command
Command mock-llm is a tiny OpenAI-compatible echo server for the quickstart demo.
|
Command mock-llm is a tiny OpenAI-compatible echo server for the quickstart demo. |
|
internal
|
|
|
config
Package config holds the env-driven service configuration.
|
Package config holds the env-driven service configuration. |
|
controller/api
Package api is the gRPC implementation of the management API (GuardrailsApi): custom rule CRUD, global settings, data-type discovery and dry-run masking checks.
|
Package api is the gRPC implementation of the management API (GuardrailsApi): custom rule CRUD, global settings, data-type discovery and dry-run masking checks. |
|
logging
Package logging configures the process-wide slog default logger and provides thin context-aware helpers used across the service.
|
Package logging configures the process-wide slog default logger and provides thin context-aware helpers used across the service. |
|
repository
Package repository defines the persistence abstraction shared by masking state, custom rules, global settings and the masking audit trail.
|
Package repository defines the persistence abstraction shared by masking state, custom rules, global settings and the masking audit trail. |
|
repository/factory
Package factory builds the configured repository.Store backend.
|
Package factory builds the configured repository.Store backend. |
|
repository/memory
Package memory implements repository.Store in process memory.
|
Package memory implements repository.Store in process memory. |
|
repository/postgres
Package postgres implements repository.Store on top of PostgreSQL (pgx).
|
Package postgres implements repository.Store on top of PostgreSQL (pgx). |
|
repository/redis
Package redis implements repository.Store on top of a Redis server.
|
Package redis implements repository.Store on top of a Redis server. |
|
repository/repositorytest
Package repositorytest provides a conformance suite that every repository.Store implementation must pass.
|
Package repositorytest provides a conformance suite that every repository.Store implementation must pass. |
|
repository/statecodec
Package statecodec serializes models.MaskingState for external store backends, optionally encrypting it at rest with AES-256-GCM.
|
Package statecodec serializes models.MaskingState for external store backends, optionally encrypting it at rest with AES-256-GCM. |
|
service/audit
Package audit records per-request masking audit entries.
|
Package audit records per-request masking audit entries. |
|
service/rulesreload
Package rulesreload rebuilds the compiled rule registry from the built-in rules plus the custom/disabled sets persisted in the store, and atomically swaps the snapshot so the data path always reads a complete rule set.
|
Package rulesreload rebuilds the compiled rule registry from the built-in rules plus the custom/disabled sets persisted in the store, and atomically swaps the snapshot so the data path always reads a complete rule set. |
|
service/settings
Package settings resolves the global guardrails settings and the per-request narrow-only header override.
|
Package settings resolves the global guardrails settings and the per-request narrow-only header override. |
|
sseproc
Package sseproc is the top-level facade for SSE response demasking.
|
Package sseproc is the top-level facade for SSE response demasking. |
|
sseproc/chatcompletions
Package sseproc implements SSE stream processing for LLM response demasking.
|
Package sseproc implements SSE stream processing for LLM response demasking. |
|
sseproc/messages
Package messages implements SSE stream processing for the Anthropic Messages API (/v1/messages) response demasking.
|
Package messages implements SSE stream processing for the Anthropic Messages API (/v1/messages) response demasking. |
|
sseproc/responses
Package responses implements SSE stream processing for OpenAI Responses API (/v1/responses) response demasking.
|
Package responses implements SSE stream processing for OpenAI Responses API (/v1/responses) response demasking. |
|
usecases/guardrails/scan
Package scan runs a dry-run guardrails scan outside the data path: it reuses the production compile + scan + mask pipeline to report what a sample text would trigger, without persisting MaskingState or calling any upstream.
|
Package scan runs a dry-run guardrails scan outside the data path: it reuses the production compile + scan + mask pipeline to report what a sample text would trigger, without persisting MaskingState or calling any upstream. |
|
usecases/rules
Package rules coordinates the rule-management use cases exposed by the configuration API: create/update/delete a custom rule, enable/disable any rule, and read/list built-in and custom rules.
|
Package rules coordinates the rule-management use cases exposed by the configuration API: create/update/delete a custom rule, enable/disable any rule, and read/list built-in and custom rules. |
|
usecases/rules/builtins
Package builtins provides an immutable index over the built-in rules loaded from the YAML files at startup.
|
Package builtins provides an immutable index over the built-in rules loaded from the YAML files at startup. |
|
usecases/rules/create
Package create implements the "create a custom rule" use case: validate the rule, reject IDs that collide with a built-in or an existing custom rule, persist it, then reload the registry snapshot.
|
Package create implements the "create a custom rule" use case: validate the rule, reject IDs that collide with a built-in or an existing custom rule, persist it, then reload the registry snapshot. |
|
usecases/rules/delete
Package delete implements the "remove a custom rule" use case: reject built-in IDs, delete the custom rule, clear any lingering disabled flag, then reload the registry snapshot.
|
Package delete implements the "remove a custom rule" use case: reject built-in IDs, delete the custom rule, clear any lingering disabled flag, then reload the registry snapshot. |
|
usecases/rules/errors
Package errors holds the domain sentinel errors shared by every rule use case.
|
Package errors holds the domain sentinel errors shared by every rule use case. |
|
usecases/rules/get
Package get implements the "read one rule" use case, resolving whether the ID is built-in or custom and its current enabled state.
|
Package get implements the "read one rule" use case, resolving whether the ID is built-in or custom and its current enabled state. |
|
usecases/rules/list
Package list implements the "list rules" use case, returning built-in and/or custom rules (sorted, custom by ID) each annotated with its source and enabled state.
|
Package list implements the "list rules" use case, returning built-in and/or custom rules (sorted, custom by ID) each annotated with its source and enabled state. |
|
usecases/rules/setenabled
Package setenabled implements the "enable or disable a rule" use case.
|
Package setenabled implements the "enable or disable a rule" use case. |
|
usecases/rules/update
Package update implements the "replace an existing custom rule" use case: reject built-in IDs, validate the new content, require the custom rule to exist, persist it, then reload the registry snapshot.
|
Package update implements the "replace an existing custom rule" use case: reject built-in IDs, validate the new content, require the custom rule to exist, persist it, then reload the registry snapshot. |
|
usecases/rules/validation
Package validation holds the shared rule-content validation used by the create and update use cases.
|
Package validation holds the shared rule-content validation used by the create and update use cases. |
|
version
Package version holds the build identity of the binary.
|
Package version holds the build identity of the binary. |
|
pkg
|
|
|
api/proto/cloudru/guardrails/v1/service
Package servicev1 is a reverse proxy.
|
Package servicev1 is a reverse proxy. |
|
llmutils
Package llmutils holds the shared extraction contract consumed by its format-specific subpackages (chatcompletions, messages, responses): the ContentField addressing type and the ErrUnsupportedBodySchema sentinel.
|
Package llmutils holds the shared extraction contract consumed by its format-specific subpackages (chatcompletions, messages, responses): the ContentField addressing type and the ErrUnsupportedBodySchema sentinel. |
|
llmutils/chatcompletions
Package chatcompletions models the OpenAI /v1/chat/completions wire format (non-streaming and SSE) and extracts the scannable/demaskable text fields from its request and response bodies.
|
Package chatcompletions models the OpenAI /v1/chat/completions wire format (non-streaming and SSE) and extracts the scannable/demaskable text fields from its request and response bodies. |
|
llmutils/messages
Package messages extracts the scannable/demaskable text fields from Anthropic Messages API (/v1/messages) request and response bodies.
|
Package messages extracts the scannable/demaskable text fields from Anthropic Messages API (/v1/messages) request and response bodies. |
|
llmutils/responses
Package responses extracts the scannable/demaskable text fields from OpenAI Responses API (/v1/responses) request and response bodies.
|
Package responses extracts the scannable/demaskable text fields from OpenAI Responses API (/v1/responses) request and response bodies. |
|
tests
|
|
|
testutil
Package testutil holds helpers shared across the tests/ tree.
|
Package testutil holds helpers shared across the tests/ tree. |
Click to show internal directories.
Click to hide internal directories.