Skip to main content

client/firewall

packages/client/src/firewall

Purpose

Personal firewall composition for code and English policies.

Public surface

CheckedGuidance

TypeAlias
The guidance of one checked text: a message, a request, an answer, a question or a send.

CheckInputError

Class
Invalid construction or evidence is a typed failure, never permission.

DecisionProvider

Interface
Entirely code-based chains have no dependency on this optional capability.

DecisionProviderError

Class
The adapter scrubs credentials before retaining optional private diagnostics.

DecisionRequest

Interface
Provider input contains explicit questions and state, never execution authority.

DecisionResponse

Interface
Raw distributions and provider confidence survive routing unchanged.

EnglishPolicySettings

Interface
Bytes bound allocation, not tokenizer capacity; probability is a routing setting.

EnglishRule

Interface
Text is interpreted by the provider; it is never compiled into executable code.

Firewall

Interface
Checking returns data; Client separately owns fresh, atomic send/delivery admission.

FirewallPolicyError

Class
A failed edit never replaces the active installation or retained editable document.

FirewallSendError

Class
A refusal is returned only before an application invocation creates any intent. Its opaque check reference survives hosts that retain only the error message.

FirewallSettings

Interface
Sequential execution is bounded per entry and across the whole attempt.

LocalGuidance

TypeAlias
Local advice accompanies the envelope and never changes a certified item.

makeEnglishPolicy

Variable
Freezes English documents and provider settings for repeated checks in either direction. Question semantics and documents determine the recorded revision. fixedRuleIds names the rules composition fixed against owner edits; it is recorded in the provenance only, so a retained check keeps which of its rules were fixed, and never changes checking.

makeFirewall

Variable
Runs every installed check in order within the budget. Refusals accumulate; only Client can apply the result to an exact candidate with fresh evidence. Cancellation propagates, so an interrupted check never returns permission.

makeJevDecisionProvider

Function
Uses the fixed TypeSafe origin and an explicitly pinned model. No retry, environment lookup or credential serialization occurs here. The evaluator owns timeouts; the Effect is interruptible through response-body consumption.

Message

Interface
Attribution is supplied by Client, never inferred from names in the body. operation is absent for a plain message.

MessageContext

Interface
Trusted composition supplies authorized earlier evidence and candidate-specific approval. Agent identity and principal identity have different meanings. The first live composition supplies absent approval.

MessageMiddleware

Interface
Code and English policies have the same contract. Registered code is trusted; it receives no messaging/store capability and must not retain conversation state or perform messaging side effects.

MiddlewareError

Class
Operational failures carry closed reasons, never arbitrary exception text.

MiddlewareInput

Interface
Each invocation gets immutable evidence and previously validated observations.

MiddlewareResult

Interface
A result is atomic: interrupted middleware has no returned partial findings.

RuleDescription

Interface
Runtime advice can only select templates registered by trusted composition.

Files

  • english.ts
  • index.ts
  • jev.ts
  • runtime.ts
  • values.ts