Skip to main content

Installation

The @knowledgepulse/sdk package provides TypeScript/JavaScript types, validation schemas, knowledge capture, retrieval, scoring, and SKILL.md utilities for the KnowledgePulse protocol.

  • Version: 0.1.0
  • License: Apache-2.0

Install

bun add @knowledgepulse/sdk

Module Formats

The SDK ships as a dual-format package with full TypeScript declarations. Both ESM and CommonJS are supported out of the box.

import {
KPCapture,
KPRetrieval,
evaluateValue,
parseSkillMd,
KnowledgeUnitSchema,
} from "@knowledgepulse/sdk";

CommonJS

const {
KPCapture,
KPRetrieval,
evaluateValue,
parseSkillMd,
KnowledgeUnitSchema,
} = require("@knowledgepulse/sdk");

Export Map

The package exposes a single entry point (.) with conditional exports:

{
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
}
PathFormatFile
typesTypeScript declarationsdist/index.d.ts
importESMdist/index.js
requireCommonJSdist/index.cjs

Dependencies

PackageVersionPurpose
zod^3.23.0Runtime validation schemas for all knowledge unit types
yaml^2.4.0SKILL.md YAML frontmatter parsing and generation

Optional Dependency

PackageVersionSizePurpose
@huggingface/transformers^3.0.0~80 MBEmbedding model for novelty scoring (Xenova/all-MiniLM-L6-v2)

The @huggingface/transformers package is listed as an optional dependency. It is only used by the novelty dimension of the evaluateValue() scoring function. If it is not installed, the novelty score falls back to a default value of 0.5.

To install it explicitly:

bun add @huggingface/transformers

TypeScript

Full type declarations are included in the package at dist/index.d.ts. No additional @types/* package is required.

The SDK requires TypeScript 5.0 or later and targets ES2020. If you use moduleResolution: "bundler" or "node16" in your tsconfig.json, the export map will be resolved automatically.

// tsconfig.json (recommended settings)
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2020",
"strict": true
}
}

Verify Installation

Run a quick check to confirm the package is installed correctly:

import { KnowledgeUnitSchema, generateTraceId } from "@knowledgepulse/sdk";

console.log(generateTraceId());
// kp:trace:550e8400-e29b-41d4-a716-446655440000

console.log(typeof KnowledgeUnitSchema.parse);
// "function"

Next Steps

  • Types -- Explore all knowledge unit types and Zod schemas
  • SKILL.md -- Parse, generate, and validate SKILL.md files
  • Scoring -- Understand the value scoring algorithm
  • Utilities -- ID generators, hashing, sanitization, capture, and retrieval