TrigGuard Node decision client (@trigguard/decision)
Official thin client for the TrigGuard decision endpoint: a single authorize() call. No policy logic in this package — the remote service decides.
Output contract (/decide): PERMIT | DENY only — see decision-output.md. The client uses fetch with a 5s default timeout, optional AbortSignal, limited retries on transient errors, and typed errors (TrigGuardNetworkError, TrigGuardTimeoutError, TrigGuardDecisionServiceError).
Install
Published name (npm scope):
npm install @trigguard/decision
The unscoped name trigguard on the public registry is not this package (different artifact / owner). Use @trigguard/decision for this HTTP client.
Monorepo / path install:
npm install file:./sdk/node
Usage
const { authorize } = require("@trigguard/decision");
const decision = await authorize(
{
surface: "spendCommit",
signals: {
riskScore: 0.8,
},
context: {
amount: 1200,
},
},
{
}
);
if (decision.decision !== "PERMIT") {
throw new Error("Action blocked by TrigGuard");
}
Environment
TRIGGUARD_ENDPOINT | Decision URL (default: https://decision.trigguard.ai/decide) |
TRIGGUARD_TOKEN | Bearer token when not passed in options.token |
Publish (maintainers)
cd sdk/node && npm login && npm publish --access public
See docs/distribution/PUBLISH_DECISION_CLIENT.md for npm pack verification and registry notes.
Note: The monorepo also ships a broader unified workspace package packages/trigguard-sdk (npm name trigguard when published from that tree). Keep the two packages distinct: @trigguard/decision = HTTP decide only.
See also