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
- npm
- Yarn
- pnpm
bun add @knowledgepulse/sdk
npm install @knowledgepulse/sdk
yarn add @knowledgepulse/sdk
pnpm 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.
ESM (recommended)
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"
}
}
}
| Path | Format | File |
|---|---|---|
types | TypeScript declarations | dist/index.d.ts |
import | ESM | dist/index.js |
require | CommonJS | dist/index.cjs |
Dependencies
| Package | Version | Purpose |
|---|---|---|
zod | ^3.23.0 | Runtime validation schemas for all knowledge unit types |
yaml | ^2.4.0 | SKILL.md YAML frontmatter parsing and generation |
Optional Dependency
| Package | Version | Size | Purpose |
|---|---|---|---|
@huggingface/transformers | ^3.0.0 | ~80 MB | Embedding 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"