Skip to content

feat(sdk): TypeScript client — @engram/client npm package#29

Open
JamesJi79 wants to merge 1 commit into
Dipraise1:mainfrom
JamesJi79:feat/typescript-sdk
Open

feat(sdk): TypeScript client — @engram/client npm package#29
JamesJi79 wants to merge 1 commit into
Dipraise1:mainfrom
JamesJi79:feat/typescript-sdk

Conversation

@JamesJi79

Copy link
Copy Markdown

TypeScript SDK — @engram/client

This PR implements a complete TypeScript SDK mirroring the Python engram.sdk package, as requested in #22.

What's Included

Feature Status Python Equivalent
EngramClient (ingest, query, get, delete, list, health) EngramClient
Private namespaces (X25519 ECDH + HKDF + AES-256-GCM) HybridEncryption
Password-based encryption (legacy) NamespaceEncryption
sr25519 request signing via @polkadot/util-crypto sign_request()
CID parsing and validation parse_cid()
Error hierarchy EngramError, MinerOfflineError, etc.
Batch ingest (JSONL) batch_ingest_file()
Conversation ingest ingest_conversation()
URL fetch + ingest ingest_url()
Query by text or vector query(), query_by_vector()
Health check + isOnline health(), is_online()
Auto-discovery from subnet 🔜 from_subnet()

Package Structure

packages/engram-client/
├── package.json
├── tsconfig.json
├── README.md
├── src/
│   ├── index.ts        # entry point
│   ├── client.ts       # EngramClient (core)
│   ├── types.ts        # TypeScript type definitions
│   ├── errors.ts       # Error hierarchy
│   ├── encryption.ts   # X25519 + AES-256-GCM encryption
│   ├── namespace.ts    # sr25519 auth + signing
│   ├── cid.ts          # CID parsing/validation
│   └── utils.ts        # HTTP client helpers
└── tests/
    └── client.test.ts  # 18 unit tests

Tests

All 18 tests pass:

✓ CID parsing (4)
✓ Error classes (4)
✓ Encryption (3)
✓ Namespace auth (2)
✓ EngramClient (5)

Dependencies

  • Runtime: @polkadot/util-crypto (sr25519 signing)
  • Dev: typescript, vitest
  • Zero runtime deps for core client — uses Node.js 18+ stdlib (fetch, crypto)

Integration Notes

  • Uses crypto.diffieHellman() for X25519 ECDH (Node.js 18+)
  • Fetch API for HTTP (Node.js 18+)
  • To use sr25519 signing: npm install @polkadot/util-crypto (optional dep)
  • Can be published to npm as @engram/client

Closes #22

Implements the TypeScript SDK mirroring the Python SDK (engram/sdk/).

## Features
- EngramClient with ingest, query, get, delete, list, health methods
- Private namespace support with X25519 hybrid encryption (ECDH + HKDF + AES-256-GCM)
- Password-based NamespaceEncryption (legacy compat)
- sr25519 request signing via @polkadot/util-crypto integration
- CID parsing and validation
- Full error hierarchy matching Python SDK exceptions
- Batch ingest, conversation ingest, URL ingest
- Query by text or by pre-computed vector
- 18 unit tests (all passing)

## Structure
- packages/engram-client/ — the npm package
- Full TypeScript types matching Python SDK interfaces
- Uses only Node.js 18+ stdlib (fetch, crypto) + @polkadot/util-crypto
- Zero external runtime deps for core client

Closes Dipraise1#22
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

@JamesJi79 is attempting to deploy a commit to the praise's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sdk] TypeScript SDK — @engram/client mirroring the Python SDK

1 participant