npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jsonfirst/sdk

v1.4.2

Published

Official JavaScript/Node.js SDK for the JSONFIRST Protocol — Universal Intent Protocol for AI governance

Downloads

598

Readme

@jsonfirst/sdk

Stop writing brittle prompts. JSONFIRST turns any user input into a structured, validated JSON intent your agent can execute reliably.

npm install @jsonfirst/sdk

⭐ If this saves you time, star the repo: github.com/jsonfirst/sdk


The problem it solves

Without JSONFIRST — your agent gets this:

"create an order for john, 2 units of product A, ship it fast"

Your code parses free text. Edge cases break it. You write regex. It still breaks.

With JSONFIRST — your agent gets this:

{
  "spec": "JSONFIRST",
  "version": "2.0",
  "jdons": [{
    "action": { "normalized": "create" },
    "object": { "type": "order", "customer": "john", "quantity": 2, "product": "product_A" },
    "constraints": { "shipping": "express" },
    "execution": { "parsable": true, "executable": true }
  }]
}

Structured. Validated. Executable. Every time.


Quick Start

Step 1 — Get your API key at jsonfirst.com/developers

Step 2 — Install and parse

const JsonFirst = require('@jsonfirst/sdk');

const client = new JsonFirst({ apiKey: 'YOUR_API_KEY' });

const result = await client.parse('Create an order for John, 2 units of product A');
console.log(result.jdons[0].action.normalized); // "create"
console.log(result.jdons[0].object);            // { type: "order", ... }

Methods

| Method | Description | |--------|-------------| | parse(text, options?) | Convert natural language to a validated JSONFIRST JSON | | validate(json) | Validate a JSON against the JSONFIRST v2 spec | | validateIntent(intent, options?) | Validate a single JDON intent (confidence, params, executability) | | pull(schemaId) | Fetch a publicly shared schema | | share(outputJson, title?) | Share a schema and get a public link | | usage() | Get your account usage and remaining intents | | modes() | List all 22 governance modes with metadata | | modeIds() | List all 22 mode IDs as an array |


Recoverable Agents — Full Pipeline

JSONFIRST closes the full loop: intent → validation → snapshot → execution → receipt → rollback

1. Snapshot (before execution)

const snap = await client.snapshot({
  jdon_id: 'jdon_abc123',
  description: 'before delete user 1234',
  state: { user_id: '1234', status: 'active', balance: 500 },
  rollback_webhook: 'https://yourapp.com/webhooks/rollback' // optional
});
// → { snapshot_id: 'uuid', status: 'AVAILABLE' }

2. Receipt (after execution — verify intent match)

const receipt = await client.receipt({
  jdon_id: 'jdon_abc123',
  output_summary: 'User 1234 deleted from production database',
  mode: 'PRODUCTION_LOCK',
  original_intent: result  // the JSONFIRST parse output
});
// → { intent_match_score: 0.95, verification_status: 'VERIFIED', drift_detected: false }
// or → { verification_status: 'INTENT_MISMATCH', flags: ['ROLLBACK_SUGGESTED'] }

3. Rollback (if drift detected)

if (receipt.receipt.flags.includes('ROLLBACK_SUGGESTED')) {
  const rb = await client.rollback({
    snapshot_id: snap.snapshot_id,
    reason: 'INTENT_MISMATCH_DETECTED'
  });
  // → { status: 'ROLLED_BACK', restored_state: { user_id: '1234', ... } }
  // Webhook fired automatically if configured
}

Governance Modes

22 modes ship with this SDK. Pass execution_mode to parse() to activate.

const result = await client.parse('Delete user 1234', {
  execution_mode: 'GUARDIAN_MODE' // blocks risky actions until confirmed
});

console.log(JsonFirst.MODE_IDS); // all 22 mode IDs

| Mode | Plan | Category | |------|------|----------| | ANTI_CREDIT_WASTE_V2 | free+ | efficiency | | EXPRESS_ROUTE | explorer+ | speed | | STRICT_PROTOCOL | explorer+ | compliance | | PERFORMANCE_MAX | explorer+ | performance | | GUARDIAN_MODE | explorer+ | safety | | FINANCE_ALGO | explorer+ | finance | | ETHICAL_LOCK | explorer+ | ethics | | SCOPE_LIMITER | pro+ | governance | | SAFE_DEPLOY | pro+ | deployment | | STANDARD_DEPLOY | pro+ | deployment | | FAST_BUILD | pro+ | build | | PRODUCTION_LOCK | pro+ | deployment | | MEDICAL_EXPERT | business+ | domain_lock | | LEGAL_EXPERT | business+ | domain_lock | | FINANCE_EXPERT | business+ | domain_lock | | CYBERSECURITY_EXPERT | business+ | domain_lock | | SOFTWARE_ENGINEERING_EXPERT | business+ | domain_lock | | AI_RESEARCH_EXPERT | business+ | domain_lock | | NEWS_ANALYSIS_EXPERT | business+ | domain_lock | | SCIENTIFIC_RESEARCH_EXPERT | business+ | domain_lock | | BUSINESS_STRATEGY_EXPERT | business+ | domain_lock | | DATA_SCIENCE_EXPERT | business+ | domain_lock |


Works with

  • LangChain — use JSONFIRST to parse user inputs before passing structured intents to your chains
  • LlamaIndex — feed validated JDON objects as structured queries to your indexes and agents
  • CrewAI — turn natural language tasks into executable JDONs your crew agents can act on reliably
  • Any LLM — framework-agnostic, works with OpenAI, Anthropic, Gemini, Mistral, and any model

Links

License

MIT