Skip to content

@briefcase-ai/controls

Terminal window
npm install @briefcase-ai/controls@4.4.0

Gateway

import { MemoryQuotaStore, createGateway } from '@briefcase-ai/controls';
const gateway = createGateway({
quotaStore: new MemoryQuotaStore(),
buckets: { calls: { capacity: 20, refillSecondsPerToken: 3 } },
});

gateway.invoke({ tenantId, bucket, fn, ctx?, deadlineMs? }) returns GatewayOutcome<T>. Failures name hard_capped, quota_exhausted, throttled, or internal.

Public surfaces

  • Ports: QuotaStore, EntitlementsHook, CacheStore, UsageSink, TraceExporter
  • Quota: MemoryQuotaStore, including optional refunds for cancelled streams
  • Provider handling: classifyProviderError, retry helpers, capped backoff
  • Pipeline: runSuggestionPipeline, sha256Fingerprint
  • Records and exporters: shared 10-field decision schema, console, memory, JSONL
  • Semantic conventions: gateway, quota, cache, and throttle attributes

Bedrock subpath

Import model ID resolution, capability probes, pricing, and the memoized AWS credential provider from @briefcase-ai/controls/bedrock. The AWS and Vercel AI SDK peer dependencies are optional until those adapters are used.

See Invocation Controls for behavior and limits.