Developers / Client
Governance-safe client
The Elevated Context client
Limited — TypeScript@elevatedcontext/client is a thin, misuse-resistant wrapper over the
governed request protocol. It is built so the wrong call does not compile: there is no way
to set a tenant, a principal, a role, a recipient class, or a server decision, and no way
to pass a raw prompt. The server remains the sole authority; the client carries none.
Design in one line
You express a request with three things — a controlled purpose, an optional narrow scope, and a recipient — and you get back a typed governance outcome. Authority is never a parameter.
Make a request
The public surface is createClient(...) plus branded value objects. A
request to a human principal needs no signer; an application recipient requires one at the
type level (the call will not compile without it).
import {
createClient,
createWebCookieTransport,
purpose,
Scope,
Recipient,
isAllowed,
isPendingConsent,
} from "@elevatedcontext/client";
const ec = createClient({
transport: createWebCookieTransport({ origin: "https://api.elevatedcontext.com" }),
audience: "https://api.elevatedcontext.com",
});
const result = await ec.context.request({
purpose: purpose("GENERAL_QA"), // a controlled id, never free text
scope: Scope.sensitivityCeiling("INTERNAL"), // narrow-only; never widens
recipient: Recipient.humanPrincipal(), // no signer required for a person
});
if (isAllowed(result)) {
// result carries references to governed context + a receipt — never widened authority
} else if (isPendingConsent(result)) {
// the person must approve in the app under App Permissions, then retry
}
Exact value-object constructors are versioned with the package; your access build ships the authoritative type definitions.
Typed outcomes
Every request resolves to one typed outcome, each with a type guard:
Allowed, Withheld, Denied,
PendingConsent, StepUpRequired, ReauthRequired,
RecipientInvalid, RecipientReplay, Unavailable,
UnsupportedProtocol, and UnknownOutcome. A governance denial is a
normal resolved result, not a thrown error.
What the client will not let you do
- Set your own authority (no tenant / principal / role / recipient-class / decision setters exist).
- Send a raw prompt or task text.
- Hold a private signing key for an application recipient — you provide a signer boundary; the key never enters the client.
- Blindly retry after an ambiguous transport failure (that could duplicate a disclosure).
Relationship to MCP
The Elevated Context MCP tool is built on this client. If your AI assistant speaks MCP, start there — you get the same governance without writing client code.