open-index/open-npm huggingface dataset:
npm package: @origintrail-official/dkg-adapter-elizaos
Description: ElizaOS plugin adapter — turns any ElizaOS agent into a DKG V9 node
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-adapter-elizaos

[ElizaOS](https://elizaos.ai) plugin adapter for DKG V9. Turns any ElizaOS agent into a DKG node with knowledge publishing, querying, agent discovery, and skill invocation capabilities.

## Features

- **dkgPlugin** — drop-in ElizaOS plugin that registers all DKG actions, providers, and the node service
- **dkgService** — manages the DKG node lifecycle within ElizaOS's service system (start/stop with the agent)
- **Actions** — `dkgPublish`, `dkgQuery`, `dkgFindAgents`, `dkgSendMessage`, `dkgInvokeSkill`
- **dkgKnowledgeProvider** — injects DKG knowledge graph context into the agent's memory/reasoning

## Usage

```typescript
import { dkgPlugin } from '@origintrail-official/dkg-adapter-elizaos';

const agent = new ElizaAgent({
  plugins: [dkgPlugin],
  // ... other config
});
```

Once the plugin is loaded, the agent can:

- Publish data to DKG paranets via natural language commands
- Query the knowledge graph for context during conversations
- Discover and communicate with other DKG agents
- Invoke remote agent skills

## Internal Dependencies

- `@origintrail-official/dkg-agent` — DKG agent runtime
- `@origintrail-official/dkg-core` — P2P node, configuration
- `@origintrail-official/dkg-storage` — triple store for local data
npm package: @origintrail-official/dkg-agent
Description: Agent runtime for DKG V9. Provides the `DKGAgent` class — the primary entry point for building agents that participate in the decentralized knowledge network.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-agent

Agent runtime for DKG V9. Provides the `DKGAgent` class — the primary entry point for building agents that participate in the decentralized knowledge network.

## Features

- **DKGAgent** — unified agent class that wires together a DKG node, storage, publishing, querying, and chain interaction
- **Wallet management** — `DKGAgentWallet` for Ed25519 (P2P identity) and ECDSA (on-chain signing) key pairs, with persistent key storage and operational wallet support
- **Agent profiles** — `ProfileManager` for publishing and updating agent skill profiles to the agent registry paranet
- **Discovery** — `DiscoveryClient` for finding other agents by name, skill keywords, or semantic search over published profiles
- **Encrypted messaging** — Ed25519-to-X25519 key conversion, ECDH shared secrets, and encrypted P2P message channels
- **Skill invocation** — `MessageHandler` for receiving and responding to skill requests; `SkillHandler` and `ChatHandler` for registering custom capabilities

## Usage

```typescript
import { DKGAgent } from '@origintrail-official/dkg-agent';

const agent = new DKGAgent({
  storagePath: './data',
  network: 'testnet',
  chainConfig: { rpcUrl: '...', privateKey: '...' },
});

await agent.start();
await agent.publish({ paranetId: '...', nquads: myData });

const agents = await agent.discover({ skill: 'sentiment-analysis' });
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — P2P node, crypto, event bus
- `@origintrail-official/dkg-chain` — blockchain interaction
- `@origintrail-official/dkg-publisher` — publishing Knowledge Assets
- `@origintrail-official/dkg-query` — querying the knowledge graph
- `@origintrail-official/dkg-storage` — local triple store
npm package: @origintrail-official/dkg-app-origin-trail-game
Description: OriginTrail Game — a multiplayer game on the DKG. Installable DKG app.
Latest version: 0.1.0-dev.1774254893.acaccb6

# @origintrail-official/dkg-app-origin-trail-game

OriginTrail Game — a multiplayer game on the [DKG](https://github.com/OriginTrail/dkg-v9). Installable DKG app.

## How it works

- **1 wagon = 1 game.** Minimum 3 players.
- Players vote each turn (travel, hunt, rest, ford, ferry).
- The game master proposes the next state; at least floor(2/3 × N) nodes must sign to advance the game on-chain (via DKG context graph).
- The game grows a context graph over time; the game master cannot cheat without consensus.

## Install into your DKG node

Add this package as a dependency of `dkg-v9`:

```bash
# In the dkg-v9 repo root:
pnpm add @origintrail-official/dkg-app-origin-trail-game@github:yourorg/oregon-trail-dkg
```

The daemon's app loader discovers it (via `dkgApp` in `package.json`) and serves it at `/apps/origin-trail-game/`.

## Development

```bash
pnpm install
pnpm build        # Build API handler + UI
pnpm dev:ui       # Dev server for UI (with proxy to local node at :9200)
```

## Package structure

```
├── src/              # Backend: game types, engine, wagon-train, API handler
│   ├── game/         # Types (GameState, Action, etc.)
│   ├── engine/       # Game engine (reducer) + wagon train (multiplayer)
│   ├── world/        # World data (locations along the trail)
│   ├── api/          # API handler (DKG app contract)
│   └── index.ts      # Package exports
├── ui/               # Frontend: React/Vite app
│   ├── src/
│   └── index.html
├── dist/             # Built backend (tsc)
├── dist-ui/          # Built frontend (vite build)
└── package.json      # dkgApp manifest
```
npm package: @origintrail-official/dkg-chain
Description: Blockchain abstraction layer for DKG V9. Provides a `ChainAdapter` interface with implementations for EVM chains and testing.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-chain

Blockchain abstraction layer for DKG V9. Provides a `ChainAdapter` interface with implementations for EVM chains and testing.

## Features

- **ChainAdapter interface** — unified API for on-chain operations (KC creation, paranet management, staking, token transfers)
- **EVMChainAdapter** — production adapter using ethers.js to interact with deployed DKG smart contracts on EVM chains (Base Sepolia, etc.)
- **MockChainAdapter** — in-memory mock for unit and integration testing without a blockchain
- **NoChainAdapter** — no-op adapter for workspace/feeless publishing mode where chain interaction is not needed

## Usage

```typescript
import { EVMChainAdapter } from '@origintrail-official/dkg-chain';

const chain = new EVMChainAdapter({
  rpcUrl: 'https://sepolia.base.org',
  privateKey: process.env.PRIVATE_KEY,
  hubAddress: '0x...',
});

const tx = await chain.createKnowledgeCollection(merkleRoot, size, epochs);
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — configuration types, logging
- `@origintrail-official/dkg-evm-module` — contract ABIs for DKG smart contracts
npm package: @origintrail-official/dkg-core
Description: Foundation package for DKG V9. Provides P2P networking, protocol messaging, cryptographic primitives, and shared utilities used by every other package in the stack.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-core

Foundation package for DKG V9. Provides P2P networking, protocol messaging, cryptographic primitives, and shared utilities used by every other package in the stack.

## Features

- **libp2p node** — full P2P networking: TCP + WebSocket transports, Noise encryption, Yamux multiplexing, AutoNAT, circuit relay, DCUtR hole-punching
- **GossipSub** — pub/sub message broadcast across the network, with per-topic subscription management
- **Protocol router** — request/response protocol streams over libp2p with handler registration
- **Peer discovery** — mDNS for local networks, Kademlia DHT + bootstrap peers for global discovery
- **Ed25519 crypto** — peer identity generation, signing, and verification
- **Protobuf messages** — efficient serialization for all DKG protocol messages
- **Event bus** — centralized internal event system (`DKGEvent`) for decoupled component communication
- **Logger** — structured logging with operation context tracking
- **Genesis ontology** — built-in DKG ontology quads and system paranet definitions
- **Constants** — network IDs, protocol paths, topic naming conventions

## Usage

```typescript
import { DKGNode, EventBus, Logger, DKG_ONTOLOGY } from '@origintrail-official/dkg-core';

const node = new DKGNode(config);
await node.start();

EventBus.on('PEER_DISCOVERED', (peer) => {
  console.log('Found peer:', peer.id);
});
```

## Internal Dependencies

None — this is the base package. All other `@origintrail-official/dkg-*` packages depend on it.
npm package: @origintrail-official/dkg-mcp-server
Description: [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for DKG V9. Exposes DKG node capabilities as MCP tools, allowing AI assistants (Cursor, Claude Desktop, etc.) to publish, query, and explore the knowledge graph.
Latest version: 9.0.0-beta.6-dev.1774254893.acaccb6

# @origintrail-official/dkg-mcp-server

[Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for DKG V9. Exposes DKG node capabilities as MCP tools, allowing AI assistants (Cursor, Claude Desktop, etc.) to publish, query, and explore the knowledge graph.

## Features

- **MCP stdio transport** — runs as a subprocess, communicating via stdin/stdout per the MCP spec
- **DkgClient** — connects to a running DKG node's HTTP API with authentication
- **Code graph tools** — find modules, functions, classes, and packages from indexed repositories
- **Knowledge graph tools** — SPARQL queries and data publishing
- **File summaries** — retrieve summaries of indexed source files

## Available Tools

| Tool | Description |
|------|-------------|
| `dkg_find_modules` | Find modules/files in the indexed code graph |
| `dkg_find_functions` | Search for functions by name or signature |
| `dkg_find_classes` | Search for classes in the code graph |
| `dkg_find_packages` | List indexed packages |
| `dkg_file_summary` | Get a structured summary of a source file |
| `dkg_query` | Execute a SPARQL query against the knowledge graph |
| `dkg_publish` | Publish RDF data to a paranet |

## Setup

```json
{
  "mcpServers": {
    "dkg": {
      "command": "npx",
      "args": ["@origintrail-official/dkg-mcp-server"],
      "env": {
        "DKG_NODE_URL": "http://localhost:9200",
        "DKG_API_TOKEN": "your-token-here"
      }
    }
  }
}
```

## Usage

The MCP server requires a running DKG node. It connects to the node's HTTP API using the `DKG_NODE_URL` and `DKG_API_TOKEN` environment variables.

```bash
# Run directly (usually configured in your AI assistant instead)
DKG_NODE_URL=http://localhost:9200 DKG_API_TOKEN=xxx dkg-mcp
```

## Internal Dependencies

None — communicates with the DKG node over HTTP. Uses `@modelcontextprotocol/sdk` and `zod` for MCP protocol handling.
npm package: @origintrail-official/dkg-node-ui
Description: Web dashboard for DKG V9 nodes. Provides a browser-based UI for monitoring node health, exploring the knowledge graph, running SPARQL queries, and chatting with agents.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-node-ui

Web dashboard for DKG V9 nodes. Provides a browser-based UI for monitoring node health, exploring the knowledge graph, running SPARQL queries, and chatting with agents.

## Features

- **Dashboard** — real-time node metrics (peers, KAs published, queries served, uptime)
- **Knowledge Explorer** — browse and search Knowledge Assets with interactive graph visualization (powered by `@origintrail-official/dkg-graph-viz`)
- **SPARQL editor** — write and execute SPARQL queries with syntax highlighting and result tables
- **Chat interface** — send messages and invoke skills on remote agents
- **Metrics & telemetry** — `DashboardDB` (SQLite) for persistent metric snapshots, `MetricsCollector` for gauges and counters, `OperationTracker` for request tracing
- **Structured logging** — `StructuredLogger` with operation context, log levels, and JSON output
- **Chat assistant** — `ChatAssistant` with configurable LLM backend for in-dashboard AI help

## Architecture

The package has two sides:

1. **Server-side** (exported as a library) — `handleNodeUIRequest()` serves the built UI assets and API endpoints; `DashboardDB`, `MetricsCollector`, and `OperationTracker` provide telemetry infrastructure
2. **Client-side** (Vite/React app) — the dashboard UI, built separately via `pnpm build:ui`

## Usage

```typescript
import { handleNodeUIRequest, initTelemetry } from '@origintrail-official/dkg-node-ui';

// In the daemon's HTTP server
if (url.startsWith('/ui')) {
  return handleNodeUIRequest(req, res);
}
```

## Development

```bash
# Start the UI dev server (hot reload)
pnpm dev:ui

# Build the production UI bundle
pnpm build:ui

# Build the full package (server + UI)
pnpm build
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — configuration types, event bus integration
- `@origintrail-official/dkg-graph-viz` — interactive RDF graph visualization component
npm package: @origintrail-official/dkg-publisher
Description: Publishing protocol for DKG V9. Handles the complete lifecycle of getting Knowledge Assets from a node into the network — from RDF processing through Merkle tree construction to on-chain finalization.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-publisher

Publishing protocol for DKG V9. Handles the complete lifecycle of getting Knowledge Assets from a node into the network — from RDF processing through Merkle tree construction to on-chain finalization.

## Features

- **DKGPublisher** — high-level publishing API: submit RDF, get back a finalized Knowledge Collection UAL
- **PublishHandler** — P2P protocol handler that processes incoming publish requests from other nodes, validates data, stores triples, and returns signed ACKs
- **WorkspaceHandler** — feeless "workspace mode" publishing for local-only or staging workflows
- **Context Graphs** — `createContextGraph` and `publishToContextGraph` for M/N signature-gated subgraphs within paranets
- **Context Oracle** — `ContextOracle` class providing verifiable read operations on Context Graphs: `queryWithProofs` (SPARQL with Merkle inclusion proofs), `entityWithProofs` (entity lookup with proofs), and `proveTriple` (single triple existence proof). Provenance triples are scoped to subjects discovered in the query results for efficiency.
- **Merkle trees** — per-KA triple hashing, public/private sub-roots, and collection-level Merkle root computation
- **Skolemization** — blank node to skolemized URI conversion for deterministic RDF processing
- **Auto-partitioning** — splits a batch of RDF triples into individual Knowledge Assets by root entity
- **KC metadata** — generates on-chain metadata (merkle root, byte sizes, entity count) for Knowledge Collection creation
- **ChainEventPoller** — monitors on-chain events for KC finalization confirmations
- **Access control** — `AccessHandler` for serving private triple access requests; `AccessClient` for requesting them

## Usage

```typescript
import { DKGPublisher } from '@origintrail-official/dkg-publisher';

const publisher = new DKGPublisher(agent);

const result = await publisher.publish({
  paranetId: 'urn:paranet:example',
  nquads: myTriples,
  private: ['urn:entity:secret'],
  epochs: 2,
});

console.log('Published KC:', result.ual);
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — P2P networking, protocol streams, crypto
- `@origintrail-official/dkg-chain` — on-chain KC creation and finalization
- `@origintrail-official/dkg-query` — entity resolution during publishing
- `@origintrail-official/dkg-storage` — triple persistence
npm package: @origintrail-official/dkg-query
Description: SPARQL query engine for DKG V9. Provides paranet-scoped querying, Knowledge Asset resolution by UAL, and read-only query validation.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-query

SPARQL query engine for DKG V9. Provides paranet-scoped querying, Knowledge Asset resolution by UAL, and read-only query validation.

## Features

- **DKGQueryEngine** — execute SPARQL SELECT, CONSTRUCT, ASK, and DESCRIBE queries against local triple stores
- **Paranet scoping** — queries are automatically scoped to the correct named graphs for a given paranet
- **KA resolution** — resolve a UAL to its constituent triples, metadata, and provenance
- **QueryHandler** — P2P protocol handler for serving remote SPARQL queries from other nodes
- **SPARQL guard** — `validateReadOnlySparql()` ensures incoming queries are read-only (no INSERT, DELETE, LOAD, etc.)

## Usage

```typescript
import { DKGQueryEngine } from '@origintrail-official/dkg-query';

const engine = new DKGQueryEngine(store);

const results = await engine.query({
  sparql: 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10',
  paranetId: 'urn:paranet:example',
});
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — configuration, logging, protocol streams
- `@origintrail-official/dkg-storage` — triple store access for query execution
npm package: @origintrail-official/dkg-storage
Description: Triple store abstraction layer for DKG V9. Provides a unified API over multiple RDF storage backends with named graph management and private content storage.
Latest version: 0.0.1-dev.1774254893.acaccb6

# @origintrail-official/dkg-storage

Triple store abstraction layer for DKG V9. Provides a unified API over multiple RDF storage backends with named graph management and private content storage.

## Features

- **Backend adapters** — pluggable triple store implementations:
  - `OxigraphStore` — embedded WASM/native store, no external dependencies
  - `OxigraphWorkerStore` — worker-thread variant for non-blocking operations
  - `BlazegraphStore` — connects to a running Blazegraph SPARQL endpoint
  - `SparqlHttpStore` — generic adapter for any SPARQL 1.1 compliant endpoint
- **Graph manager** — named graph lifecycle (create, drop, list) with paranet-scoped data and metadata graphs
- **Private content store** — encrypted triple storage for private KA triples, separate from the public graph
- **Custom adapters** — `registerTripleStoreAdapter()` to plug in any storage backend

## Usage

```typescript
import { createTripleStore, GraphManager } from '@origintrail-official/dkg-storage';

const store = createTripleStore({ backend: 'oxigraph', path: './data' });
const graphs = new GraphManager(store);

await store.insert(quads, { graph: 'urn:paranet:example:data' });
const result = await store.query('SELECT * WHERE { ?s ?p ?o } LIMIT 10');
```

## Internal Dependencies

- `@origintrail-official/dkg-core` — configuration types, logging, constants