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

@provenancekit/eaa-types

v0.1.4

Published

Pure provenance primitives for Human-AI collaborative works. Entity • Action • Attribution (EAA) type definitions with extensible architecture.

Readme

@provenancekit/eaa-types

Pure provenance primitives for Human-AI collaborative works

Version License TypeScript

Entity-Action-Attribution (EAA) type definitions and Zod schemas for tracking provenance of AI-generated and human-created content.


Features

Pure Provenance - Base types focus only on traceability (who, what, when) 🔌 Extensible - Domain-specific functionality via extensions 🛡️ Type-Safe - Full TypeScript + Zod validation 🌐 W3C PROV Compatible - Maps cleanly to established standards 📦 Content-Addressed - IPFS CIDs for immutable references 🎯 Zero Opinions - No built-in payments, weights, or domain logic


Installation

npm install @provenancekit/eaa-types
# or
pnpm add @provenancekit/eaa-types
# or
yarn add @provenancekit/eaa-types

Quick Start

import {
  Entity,
  Resource,
  Action,
  Attribution,
  ProvenanceBundle
} from "@provenancekit/eaa-types";

// 1. Define entities (who)
const human: Entity = {
  id: "did:key:alice123",
  name: "Alice",
  role: "human",
};

const ai: Entity = {
  id: "did:key:gpt4",
  name: "GPT-4",
  role: "ai",
};

// 2. Define an action (what happened)
const action: Action = {
  id: "action-001",
  type: "create",
  performedBy: human.id,
  timestamp: "2025-01-13T10:00:00Z",
  inputs: [],
  outputs: ["bafy...123"],
};

// 3. Define the resource (output)
const resource: Resource = {
  address: {
    cid: "bafy...123",
    size: 1024,
    algorithm: "sha256"
  },
  type: "text",
  locations: [{
    uri: "ipfs://bafy...123",
    provider: "pinata"
  }],
  createdAt: "2025-01-13T10:00:00Z",
  createdBy: human.id,
  rootAction: action.id,
};

// 4. Define attributions (who gets credit)
const attributions: Attribution[] = [
  {
    resourceCid: resource.address.cid,
    entityId: human.id,
    role: "creator",
    note: "Wrote the initial prompt",
  },
  {
    resourceCid: resource.address.cid,
    entityId: ai.id,
    role: "contributor",
    note: "Generated the content",
  },
];

// 5. Bundle it all together
const bundle: ProvenanceBundle = {
  context: "https://provenancekit.com/context/v1",
  entities: [human, ai],
  resources: [resource],
  actions: [action],
  attributions: attributions,
};

Core Types

Entity (Who)

An agent that performs actions - human, AI, or organization.

const entity: Entity = {
  id: string,           // Unique identifier (DID, wallet, UUID)
  name?: string,        // Human-readable name
  role: EntityRole,     // "human" | "ai" | "organization" | "ext:custom"
  publicKey?: string,   // For signature verification
  metadata?: object,    // Arbitrary metadata
  extensions?: object,  // Extension data
};

Resource (What)

A content-addressed artifact with provenance.

const resource: Resource = {
  address: {
    cid: string,        // IPFS CID
    size: number,       // Bytes
    algorithm: string,  // "sha256" | "blake3"
  },
  type: ResourceType,   // "text" | "image" | "audio" | etc.
  locations: [          // Where to access
    { uri: string, provider?: string }
  ],
  createdAt: string,    // ISO 8601 timestamp
  createdBy: string,    // Entity.id
  rootAction: string,   // Action.id
  extensions?: object,  // Extension data
};

Action (What Happened)

An activity that transforms inputs into outputs.

const action: Action = {
  id: string,           // Unique identifier
  type: ActionType,     // "create" | "derive" | "aggregate" | "verify"
  performedBy: string,  // Entity.id
  timestamp: string,    // ISO 8601
  inputs: string[],     // Input CIDs
  outputs: string[],    // Output CIDs
  proof?: string,       // Signature or tx hash
  extensions?: object,  // Extension data
};

Attribution (Who Gets Credit)

Links an entity to a resource they helped create.

const attribution: Attribution = {
  resourceCid: string,  // Resource CID
  entityId: string,     // Entity.id
  role: string,         // "creator" | "contributor" | "source"
  note?: string,        // Explanation
  extensions?: object,  // Extension data (weights, payments, etc.)
};

Extension System

Base types are minimal. Add domain-specific functionality via extensions.

Using Extensions

import {
  Entity,
  setExtension,
  getExtension,
  hasExtension
} from "@provenancekit/eaa-types";

const entity: Entity = {
  id: "alice",
  name: "Alice",
  role: "human",
};

// Set extension data
setExtension(entity, "ext:[email protected]", {
  wallet: "0x...",
  network: "base",
});

// Get extension data
const payment = getExtension(entity, "ext:[email protected]");

// Check if extension exists
if (hasExtension(entity, "ext:[email protected]")) {
  // ...
}

Creating Extensions

import { z } from "zod";
import { ExtensionDefinition, registry } from "@provenancekit/eaa-types";

// 1. Define extension schema
const PaymentExtension: ExtensionDefinition = {
  key: "ext:[email protected]",
  name: "x402 Payment",
  extends: "Entity",
  schema: z.object({
    wallet: z.string(),
    network: z.string(),
  }),
  description: "Payment destination for entities",
  url: "https://docs.x402.org",
};

// 2. Register extension
registry.register(PaymentExtension);

// 3. Use it
const entity: Entity = { /* ... */ };
setExtension(entity, "ext:[email protected]", {
  wallet: "0x...",
  network: "base",
});

Built-in Extensions

| Extension | Purpose | Package | |-----------|---------|---------| | ext:[email protected] | Payment distribution | @provenancekit/extension-x402 | | ext:[email protected] | Contribution weights | @provenancekit/extension-contrib | | ext:[email protected] | License terms | @provenancekit/extension-licensing | | ext:[email protected] | Time precision | @provenancekit/extension-temporal | | ext:[email protected] | Tool tracking | @provenancekit/extension-tool | | ext:[email protected] | Review workflow | @provenancekit/extension-review |


W3C PROV Compatibility

EAA types map directly to W3C PROV:

| EAA | W3C PROV | Purpose | |-----|----------|---------| | Entity | Agent | Who performs actions | | Resource | Entity | What gets created | | Action | Activity | What happened | | Attribution | Attribution | Who gets credit |


Examples

Example 1: AI Image Generation

import { Entity, Resource, Action, Attribution } from "@provenancekit/eaa-types";

// Human provides prompt
const human: Entity = {
  id: "alice",
  name: "Alice",
  role: "human",
};

// AI generates image
const ai: Entity = {
  id: "dall-e-3",
  name: "DALL-E 3",
  role: "ai",
};

// Action: create image
const action: Action = {
  id: "gen-001",
  type: "create",
  performedBy: human.id,
  timestamp: new Date().toISOString(),
  inputs: [],
  outputs: ["bafy...image"],
};

// Resource: the image
const image: Resource = {
  address: { cid: "bafy...image", size: 524288, algorithm: "sha256" },
  type: "image",
  locations: [{ uri: "ipfs://bafy...image", provider: "pinata" }],
  createdAt: action.timestamp,
  createdBy: human.id,
  rootAction: action.id,
};

// Attributions
const attrs: Attribution[] = [
  { resourceCid: image.address.cid, entityId: human.id, role: "creator" },
  { resourceCid: image.address.cid, entityId: ai.id, role: "contributor" },
];

Example 2: Dataset Transformation

// Load dataset
const loadAction: Action = {
  id: "load-001",
  type: "create",
  performedBy: "alice",
  timestamp: new Date().toISOString(),
  inputs: [],
  outputs: ["bafy...raw"],
};

// Clean dataset
const cleanAction: Action = {
  id: "clean-001",
  type: "derive",
  performedBy: "alice",
  timestamp: new Date().toISOString(),
  inputs: ["bafy...raw"],
  outputs: ["bafy...clean"],
};

// Split dataset
const splitAction: Action = {
  id: "split-001",
  type: "aggregate",
  performedBy: "alice",
  timestamp: new Date().toISOString(),
  inputs: ["bafy...clean"],
  outputs: ["bafy...train", "bafy...test"],
};

API Reference

Extension Helpers

// Get extension data
function getExtension<T>(obj: Extensible, key: string): T | undefined;

// Set extension data
function setExtension<T>(obj: Extensible, key: string, data: T): void;

// Check if extension exists
function hasExtension(obj: Extensible, key: string): boolean;

// Remove extension
function removeExtension(obj: Extensible, key: string): boolean;

// Get all extension keys
function getExtensionKeys(obj: Extensible): string[];

// Validate extensions
function validateExtensions(obj: Extensible): Array<{ key: string; error: z.ZodError }>;

Extension Registry

// Register extension
registry.register(def: ExtensionDefinition): void;

// Get extension definition
registry.get(key: string): ExtensionDefinition | undefined;

// Get all extensions for a type
registry.forType(type: "Entity" | "Resource" | "Action" | "Attribution"): ExtensionDefinition[];

// Validate data against schema
registry.validate(key: string, data: unknown): boolean;

// Get latest version
registry.latest(namespace: string): ExtensionDefinition | undefined;

Migration from v1

See MIGRATION.md for detailed upgrade guide.

Key Changes:


TypeScript

Full TypeScript support with strict type checking.

import type {
  Entity,
  EntityRole,
  Resource,
  ResourceType,
  Action,
  ActionType,
  Attribution,
  ProvenanceBundle
} from "@provenancekit/eaa-types";

Zod Validation

All types include Zod schemas for runtime validation.

import { Entity, Resource, Action } from "@provenancekit/eaa-types";

// Validate at runtime
const result = Entity.safeParse(data);
if (result.success) {
  const entity = result.data;
} else {
  console.error(result.error);
}

Related Packages


Philosophy

Base types = Pure provenance

Everything else = Extensions

ProvenanceKit provides minimal, opinion-free primitives for tracking provenance. Domain-specific concerns (payments, weights, licensing) are handled by extensions, keeping the core clean and universal.


License

MIT © ProvenanceKit


Links

  • Documentation: https://docs.provenancekit.com
  • GitHub: https://github.com/provenancekit/provenancekit
  • Discord: https://discord.gg/provenancekit
  • Website: https://provenancekit.com