JavaScript SDK

Install the client. Keep the verdict verifiable.

@decide-fyi/sdk is the public JavaScript client for Decision API calls, lifecycle records, offline verification, and Rulebook v1 conformance.

Open on npm JavaScript examples API reference Developer hub
@decide-fyi/sdk@0.1.19 Node 18+ CommonJS + TypeScript types Apache-2.0 public source

Install and create a client

Keep the production key server-side. The client defaults to https://www.decide.fyi.

Install
npm install @decide-fyi/sdk
Create client
const { createDecideClient } = require('@decide-fyi/sdk');

const decide = createDecideClient({
  apiKey: process.env.DECIDE_API_KEY
});

One boundary, one stored record

Use a versioned Rulebook v1 payload, provide an operation-specific idempotency key, and store the full response beside the downstream action.

Decision call
const record = await decide.decide(
  {
    mode: 'rulebook',
    rulebook: pricingExceptionRulebook,
    context: {
      workflow: 'pricing_exception',
      source_record_id: 'deal_1042',
      requested_action: 'approve_discount',
      inputs: {
        discount_percent: 15,
        margin_floor_passed: true
      }
    }
  },
  {
    idempotencyKey: 'deal_1042_discount_15',
    responseView: 'full'
  }
);

const verified = await decide.verifyRecord({ record });
if (!verified.verified) throw new Error('Decision Record verification failed');

Shipped CLI commands

These are the commands in the current package. The catalog does not advertise unshipped scaffolding, doctor, status, or sandbox commands.

Record

Verify a Decision Record

Check integrity and, with pinned trust material or the public key registry, receipt authenticity.

npx @decide-fyi/sdk verify record.json --summary
Packet

Verify portable proof

Validate a Decision Packet with its records, receipts, hashes, and verification hints.

npx @decide-fyi/sdk verify-packet packet.json --summary
Protocol

Run Rulebook conformance

Exercise a compatible endpoint against the public Rulebook v1 conformance index.

npx @decide-fyi/sdk rulebook-conformance --summary

Package provenance and terms

The npm tarball maps to the canonical public SDK source. The package, Apache-2.0 license, source-provenance record, and public support route are all inspectable.

ItemCurrent contractOperator note
Published package@decide-fyi/sdk@0.1.19npm metadata
Canonical sourcePublic sdk/ directoryInspect source
Inspectable artifactVersioned npm tarballOpen tarball
SupportPublic issue trackerReport an SDK issue
LicenseApache-2.0Read license

Versioned source boundary

Public SDK releases beginning with 0.1.18 map to the canonical sdk/ directory. Read the source-provenance record; npm provenance is claimed only when the registry reports it.