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

@aikdna/kdna-react

v0.4.0

Published

React components and hooks for building KDNA-integrated web applications — file dropzone, load-plan gate, password unlock, license activation, and asset inspector.

Readme

@aikdna/kdna-react

React components and hooks for KDNA-integrated web applications.

Status: Experimental published React integration at its exact package coordinate. Component availability is not a complete Host-experience or production-readiness claim.

Drop in <KDNAFileDropzone> to let users select a .kdna file. Use <KDNALoadPlanGate> to render content only when the asset is loaded. Wrap <KDNAPasswordUnlockDialog> around any encrypted asset.

Networking, bounded response parsing, public-field projection, and Runtime Capsule validation come from the exact @aikdna/[email protected] runtime dependency. Pair the components with @aikdna/[email protected] or a compatible server. Password and license inputs exist briefly in the browser form state, are cleared before and after each request, and are never persisted by this package. Decryption remains server-side.

New to KDNA? → KDNA Core

Need browser utilities without React? → @aikdna/kdna-web-client

Need the server-side adapter? → @aikdna/kdna-web-server

npm License


Install

npm install @aikdna/kdna-react

Node.js 20 or later is required for SSR, testing, and build tooling. React 18 or 19 is supported as a peer dependency. npm installs the exact Web Client runtime automatically. The components call the KDNA server through the endpoint props you provide.


Quick start

import {
  KDNAFileDropzone,
  KDNALoadPlanGate,
  KDNAPasswordUnlockDialog,
  KDNAAssetInspector,
} from '@aikdna/kdna-react'
import { useState } from 'react'

function UploadedKDNAViewer({ fileId, inspect }) {
  const [unlockedContent, setUnlockedContent] = useState(null)

  if (unlockedContent) {
    return <pre>{JSON.stringify(unlockedContent, null, 2)}</pre>
  }

  return (
    <KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna">
      {({ status, content }) =>
        status === 'locked' ? (
          <KDNAPasswordUnlockDialog
            fileId={fileId}
            endpoint="/api/kdna"
            onUnlock={(result) => setUnlockedContent(result.content)}
          />
        ) : status === 'loaded' ? (
          <pre>{JSON.stringify(content, null, 2)}</pre>
        ) : (
          <KDNAAssetInspector inspect={inspect} />
        )
      }
    </KDNALoadPlanGate>
  )
}

export function KDNAViewer() {
  return (
    <KDNAFileDropzone endpoint="/api/kdna">
      {({ fileId, inspect }) => fileId
        ? <UploadedKDNAViewer key={fileId} fileId={fileId} inspect={inspect} />
        : <p>Select a .kdna file to begin.</p>}
    </KDNAFileDropzone>
  )
}

File selection is explicit authority for this operation. Applications that persist an attachment must show exact identity, digest, scope, and reason and provide disable/switch/rollback controls. These components do not infer authorization from uploaded-file presence.


Components

<KDNAFileDropzone>

A drag-and-drop and click-to-browse file selector for .kdna files. Calls /api/kdna/inspect on selection and provides the result to children via render props.

<KDNAFileDropzone endpoint="/api/kdna">
  {({ inspect, loading, error }) => (
    <p>{error ? `Upload failed (${error.code || 'KDNA_UPLOAD_FAILED'}).`
      : loading ? 'Uploading…' : inspect?.domain}</p>
  )}
</KDNAFileDropzone>

| Prop | Type | Default | Description | |------|------|---------|-------------| | endpoint | string | required | Base URL of the KDNA server adapter | | onError | (err: Error) => void | — | Called when upload or inspect fails | | maxSizeBytes | number | 10485760 | Reject files larger than this | | disabled | boolean | false | Disable browse and drop interactions | | className | string | — | Added to the root element | | label | string | 'Choose a KDNA file' | Accessible label for the hidden file input | | children | render prop | required | Receives { file, fileId, inspect, loading, error, reset } |

→ Full reference


<KDNALoadPlanGate>

Evaluates the LoadPlan and manages the full state machine: idle → checking → ready | locked | error, then auto-loads ready assets and exposes loaded content when available.

<KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna" profile="compact">
  {({ status, content, missing, loading, load }) => { /* ... */ }}
</KDNALoadPlanGate>

| Prop | Type | Default | Description | |------|------|---------|-------------| | fileId | string | required | File ID from <KDNAFileDropzone> or uploadKDNA | | endpoint | string | required | Base URL of the KDNA server adapter | | profile | string | 'compact' | Load profile to request | | children | render prop | required | Receives state object |

→ Full reference


<KDNAPasswordUnlockDialog>

A modal dialog that prompts the user for a password, submits it to /load, and calls onUnlock with the result.

<KDNAPasswordUnlockDialog
  fileId={fileId}
  endpoint="/api/kdna"
  onUnlock={(result) => setContent(result.content)}
  onCancel={() => setShowDialog(false)}
/>

| Prop | Type | Default | Description | |------|------|---------|-------------| | fileId | string | required | | | endpoint | string | required | | | profile | string | 'compact' | | | onUnlock | (result) => void | — | Called on successful load | | onCancel | () => void | — | Called when dialog is dismissed | | onError | (err: Error) => void | — | Called when unlock fails | | hint | string \| null | — | Password hint text | | title | string | 'Unlock asset' | Dialog title |

→ Full reference


<KDNALicenseActivationForm>

Accepts a license key, calls /activate, and provides a structurally bounded entitlement record containing the server-provided signature on success. The input is password-masked and cleared before and after the request. The browser checks response shape, active state, lease, expiry, and binding. The optional client is a caller-declared label, not authorization authority; allowlist enforcement and signature verification remain authoritative server/runtime responsibility.

<KDNALicenseActivationForm
  domain="kdna:creator:asset"
  endpoint="/api/kdna"
  machineFingerprint={sha256DeviceFingerprint}
  client="my-kdna-app"
  onActivated={(entitlement) => setEntitlement(entitlement)}
/>

Supply machineFingerprint only when your application has an issuer-approved, canonical 64-character lowercase SHA-256 device fingerprint. The component does not invent hardware identity. Omit it for an unbound license.

→ Full reference


<KDNAAssetInspector>

Read-only display of the bounded public /inspect projection. Shows domain, version, title, description, current LoadPlan state/action, default and available profiles, and encryption status.

<KDNAAssetInspector inspect={inspect} />

→ Full reference


Hooks

useKDNA(options?)

Manage load-plan state and explicit /load calls for a file that has already been uploaded to the server.

const { content, status, error, load } = useKDNA({
  fileId,
  profile: 'compact',
  endpoint: '/api/kdna',
})

if (status === 'ready') await load()

→ Full reference


useKDNALoadPlan(options?)

Manage the load-plan state machine for a file that has already been uploaded.

const { status, missing, refresh, plan } = useKDNALoadPlan({
  fileId,
  endpoint: '/api/kdna',
})

→ Full reference


Styling

Components are intentionally unstyled. Bring your own CSS, or wrap the render-prop state in your app's design system.

Consumption traces

Applications that use the KDNA consumption runtime can render a trace alongside their own UI. Every public trace helper, viewer, and useTrace projection validates the complete JudgmentTrace schema closure pinned to an audited KDNA Core commit and fails closed on unknown or inconsistent nested evidence. They keep Capsule delivery, Host execution, semantic consumption, and conformance as separate evidence layers. A correlated response proves delivery and execution; it does not prove that a model semantically consumed the judgment or that the result conforms to it.

The viewer exposes the primary asset identity, budget comparison, result digest, and provenance without rendering free-form warning or error messages; it shows only warning counts and bounded issue codes/phases. useTrace returns the validated trace evidence to application code, which must still treat producer-supplied strings as untrusted and avoid logging them. Browser validation proves schema conformance only; authoritative cryptographic and semantic conformance checks remain server-side KDNA Core responsibilities. The package exports matching TypeScript declarations for the complete public JavaScript surface.


Related packages

| Package | Role | |---------|------| | @aikdna/kdna-core | KDNA format and runtime | | @aikdna/kdna-web-server | Server-side adapter | | @aikdna/kdna-web-client | Browser utilities (no React) | | create-kdna-web-app | Project scaffolding CLI |


License

Apache 2.0 — see LICENSE.