npm install @decide-fyi/sdk
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.
@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.
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.
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.
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
Verify portable proof
Validate a Decision Packet with its records, receipts, hashes, and verification hints.
npx @decide-fyi/sdk verify-packet packet.json --summary
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.
| Item | Current contract | Operator note |
|---|---|---|
| Published package | @decide-fyi/sdk@0.1.19 | npm metadata |
| Canonical source | Public sdk/ directory | Inspect source |
| Inspectable artifact | Versioned npm tarball | Open tarball |
| Support | Public issue tracker | Report an SDK issue |
| License | Apache-2.0 | Read 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.