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

@holokai/moku-sdk

v1.4.5

Published

TypeScript SDK for the Moku API

Readme

@holokai/moku-sdk

TypeScript SDK for the Moku API. Provides a typed client with namespace-based access to all Moku endpoints.

Installation

npm install @holokai/moku-sdk @holokai/moku-types

Quick Start

import {MokuClient} from '@holokai/moku-sdk';

const client = new MokuClient({
    baseUrl: 'https://your-moku-instance.com',
    token: 'your-api-token',
});

const threads = await client.threads.list({page: 0, size: 10});
console.log(threads.content);

Configuration

interface MokuClientOptions {
    baseUrl: string;
    token?: string | (() => string | Promise<string>);
    fetch?: typeof globalThis.fetch;
    timeout?: number; // default: 10000ms
}

Dynamic Token

Pass a function to resolve the token at request time (useful for OAuth refresh flows):

const client = new MokuClient({
    baseUrl: 'https://your-moku-instance.com',
    token: async () => {
        const session = await getSession();
        return session.accessToken;
    },
});

Namespaces

All API endpoints are organized into namespaces on the client:

| Namespace | Description | |-----------------|------------------------------------------------------------| | auth | Authentication, user identity, OAuth providers | | applications | Application CRUD, history, filters | | providers | LLM provider configuration, connectivity tests, model sync | | models | AI model management | | organizations | Organization management, BYOK, segments | | teams | Team hierarchy, user assignment, tree navigation | | users | User accounts, roles, status | | credentials | API credentials, vault secrets | | prompts | Prompt templates, versioning, tag filtering | | projects | Project management, members, roles | | pricing | Pricing plans, sheets, per-model costs | | plugins | Plugin discovery and metadata | | datasets | Evaluation datasets, samples | | evaluations | Evaluation plans, sessions, results, analytics | | dashboards | Dashboard CRUD, generation, settings | | analytics | Query execution, widget generation | | servers | Server status and proxy info | | monitoring | Request monitoring, RabbitMQ metrics, health | | audit | Change history, user revisions | | schemas | JSON schema management, versioning, migrations | | threads | Conversation threads, messages | | agents | AI agent configuration | | ref | Reference data (teams, roles, providers, models) |

Common Patterns

Paged Responses

List endpoints return PagedResponse<T> with standard pagination metadata:

const result = await client.applications.list({page: 0, size: 20, search: 'my-app'});
console.log(result.content);        // T[]
console.log(result.totalElements);   // total count
console.log(result.totalPages);      // total pages

CRUD Convention

Most namespaces follow a standard pattern:

// List
const items = await client.projects.list({page: 0, size: 10});

// Get by ID
const project = await client.projects.getById('uuid');

// Create
const created = await client.projects.create({name: 'New Project'});

// Update (PATCH where applicable)
const updated = await client.projects.update('uuid', {name: 'Renamed'});

// Delete
await client.projects.remove('uuid');

Thread Management

const thread = await client.threads.create({title: 'My Thread'});

// Update uses PATCH semantics — only send changed fields
await client.threads.update(thread.id!, {title: 'Renamed'});

// Filter by type
const personal = await client.threads.list({type: 'personal'});

// Get messages
const messages = await client.threads.getMessages(thread.id!, {page: 0, size: 50});

await client.threads.remove(thread.id!);

Schema Versioning

const schemas = await client.schemas.list({search: 'user-profile'});

const detail = await client.schemas.getById('schema-uuid');
const versions = await client.schemas.getVersions('schema-uuid');

// Get a version directly by ID
const version = await client.schemas.getVersionById('version-uuid');

// Suggest next version number
const suggestion = await client.schemas.suggestNextVersion({schemaId: 'uuid'});

// Create version with migration
const result = await client.schemas.createVersionWithMigration('schema-uuid', {
    version: '2.0.0',
    content: {/* schema JSON */},
    changeSummary: 'Added email field',
    migrationStrategy: 'AUTO',
});

Error Handling

import {MokuApiError, MokuTimeoutError} from '@holokai/moku-sdk';

try {
    await client.applications.getById('nonexistent');
} catch (err) {
    if (err instanceof MokuApiError) {
        console.error(`HTTP ${err.status}:`, err.body);
    } else if (err instanceof MokuTimeoutError) {
        console.error(`Timed out after ${err.timeoutMs}ms`);
    }
}

License

MIT