@complior/sdk accepts a MiddlewareConfig object at initialization. Every field is optional — sensible defaults are applied.
Core
| Field | Type | Default | Description |
|---|---|---|---|
jurisdictions | ('EU' | 'US' | 'UK' | 'CA' | 'AU' | 'GLOBAL')[] | undefined | Active jurisdictions for compliance checks |
role | 'provider' | 'deployer' | 'both' | undefined | EU AI Act role classification |
domain | Domain | Domain[] | undefined | Activates domain-specific hooks (hr, finance, healthcare, education, legal, content) |
logging | boolean | false | Enable request/response logging |
strict | boolean | false | Throw on any compliance violation (vs. warn) |
PII / Sanitize
| Field | Type | Default | Description |
|---|---|---|---|
sanitizeMode | 'replace' | 'block' | 'warn' | 'replace' | How to handle detected PII |
replace— redacts PII with labels like[PII:SSN],[PII:EMAIL],[PII:IBAN]block— throwsPIIDetectedErroron first PII matchwarn— passes through unmodified, addspiiDetectedto metadata
See PII Detection for the full list of 50+ detectable types and checksum validators.
Disclosure
| Field | Type | Default | Description |
|---|---|---|---|
disclosureInjection | boolean | false | Inject “I am AI” disclosure into system messages |
disclosureText | string | Built-in per language | Custom disclosure text |
disclosurePosition | 'prepend' | 'append' | 'header' | 'prepend' | Where to inject disclosure |
disclosureFrequency | 'every' | 'session-start' | 'every' | Injection frequency |
disclosureLanguages | ('EN' | 'DE' | 'FR' | 'ES')[] | ['EN'] | Languages for disclosure verification |
disclosureMode | 'warn-only' | 'block' | 'warn-only' | Action when disclosure is missing from response |
customDisclosurePhrases | RegExp[] | undefined | Additional patterns to accept as valid disclosure |
Bias Detection
| Field | Type | Default | Description |
|---|---|---|---|
biasThreshold | number (0–1) | 0.3 (general), 0.15 (HR) | Aggregate score threshold — findings above this trigger action |
biasAction | 'warn' | 'block' | 'warn' | Throw BiasDetectedError (block) or add to metadata (warn) |
domain profile. See Bias Detection for domain-specific weights.
Safety Filter
| Field | Type | Default | Description |
|---|---|---|---|
safetyFilter | boolean | false | Enable safety pattern scanning on responses |
safetyMode | 'block' | 'warn' | 'log' | 'block' | Action on safety violation |
safetyThreshold | number (0–1) | 0.5 | Aggregate score threshold |
Human-in-the-Loop Gate
| Field | Type | Default | Description |
|---|---|---|---|
hitlGate | boolean | false | Enable HITL gate for critical actions |
hitlGateTimeoutMs | number | 300000 (5 min) | Timeout before auto-deny |
hitlGateRules | GateRule[] | 4 built-in rules | Custom gate trigger rules |
onGateTriggered | (req: GateRequest) => Promise<GateDecision> | undefined | Approval callback — if absent, auto-deny (fail-safe) |
Interaction Logging
| Field | Type | Default | Description |
|---|---|---|---|
interactionLogger | boolean | false | Enable structured JSONL logging |
interactionLogPath | string | .complior/logs/interactions.jsonl | Log file path |
Runtime
| Field | Type | Default | Description |
|---|---|---|---|
configPath | string | false | .complior/proxy.toml | TOML config file path, or false to disable hot-reload |
retry | RetryConfig | See below | Retry configuration for transient errors |
RetryConfig
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable automatic retries |
maxRetries | number | 3 | Maximum retry attempts |
baseDelayMs | number | 1000 | Base delay (exponential backoff) |
maxDelayMs | number | 30000 | Maximum delay cap |
429, 500–504 and network errors (ECONNREFUSED, ECONNRESET, ETIMEDOUT, EPIPE, EAI_AGAIN). Compliance errors (MiddlewareError subclasses) are never retried.
TOML File Configuration
Create.complior/proxy.toml for file-based configuration with hot-reload (100ms debounce):
AgentConfig
AgentConfig extends MiddlewareConfig with passport enforcement fields. See Agent Mode for the full reference.
| Field | Type | Description |
|---|---|---|
passport | Record<string, unknown> | Agent Passport JSON (loaded from .complior/agents/) |
budgetLimitUsd | number | Session budget cap |
onBudgetExceeded | 'warn' | 'block' | Action when budget exceeded |
onPermissionDenied | 'warn' | 'block' | Action on denied method |
toolCallAction | ToolCallAction | How to handle denied tool calls |
onToolCallDenied | (denied: DeniedToolCall[]) => void | Callback for denied tools |
onAction | (entry: ActionLogEntry) => void | Audit callback for each LLM call |
circuitBreaker | CircuitBreakerConfig | Circuit breaker settings |
Agent Mode
Passport enforcement, budget, rate limits.
Advanced Features
Hot-reload, retry, streaming, logging.