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

@myceliumhq/semanticd

v1.2.0

Published

Library for running a semantic search sidecar over any source that ships a SourceAdapter -- sync, query, and HTTP server, generic over the adapter.

Readme

semanticd

CI License: MIT

A library for running a semantic search sidecar over any source that ships a SourceAdapter -- semanticd itself has no knowledge of any particular source (not Trilium, not paperless-ngx, not anything else). It has no executable of its own: the package that owns an adapter (e.g. @myceliumhq/tri, @myceliumhq/ppl) imports runSemanticd(), passes its own adapter in directly, and ships its own thin binary and container image (tri-semanticd, ppl-semanticd) -- the adapter is wired in as real, compile-time-checked TypeScript, not resolved by a runtime module specifier.

One sidecar process wraps exactly one source -- run it next to the service it indexes (a Trilium instance, a paperless-ngx instance, ...), each with its own port and index file, rather than one central process that has to know about every source type.

Use

import { runSemanticd } from "@myceliumhq/semanticd";
import { createAdapter } from "./my-source-adapter.js";

const handle = await runSemanticd(createAdapter());
// handle.close() stops the sync timer, stops accepting new HTTP connections
// (letting in-flight ones finish), and closes the index file. Wired to
// SIGTERM/SIGINT automatically -- pass { handleSignals: false } to opt out
// and call close() yourself instead.

runSemanticd's config (port, index path, sync interval, embedding provider) is read from env vars by default (loadSemanticdConfig(), exported separately if you want to inspect or override it before calling runSemanticd) -- see .env.example for the full list.

Bring your own source

Any package can be a source -- it just needs a factory returning a SourceAdapter:

import type { SourceAdapter } from "@myceliumhq/index";

export function createAdapter(): SourceAdapter<string | number> {
  // Read your own connection config from env vars/files here -- semanticd
  // never sees it, only the adapter this function returns.
  return {
    name: "my-source",
    async *listChanged(since) {
      // yield { id, contentHash, modifiedAt } for everything changed since `since`
    },
    async fetchContent(id) {
      // return the full text content for `id`
    },
  };
}

Then build a thin binary around it with runSemanticd(createAdapter()), the same way @myceliumhq/tri and @myceliumhq/ppl each do.

Querying a deployed sidecar

Anything that wants to query a running sidecar (rather than run one itself) uses createSemanticdClient instead of hand-rolling the fetch() calls:

import { createSemanticdClient } from "@myceliumhq/semanticd";

const client = createSemanticdClient("http://tri-semanticd:4499");
const matches = await client.query("book recommendations", 5);
const health = await client.health();
await client.reindex();

This is how tri's and ppl's own standalone MCP servers talk to their tri-semanticd/ ppl-semanticd sidecars (TRILIUM_SEMANTICD_URL/PAPERLESS_SEMANTICD_URL) instead of running a second, redundant embedding/index engine in-process.

HTTP API

| Endpoint | What it does | | --- | --- | | GET /health | This sidecar's index size and last-sync status -- { ok, sourceCount, syncing, lastSyncAt, lastError } | | GET /query?q=<text>&limit=<n> | Ranked semantic matches -- { query, matches: [{ sourceId, snippet, score, startLine, endLine }] } | | POST /reindex | Trigger an out-of-schedule sync pass (fire-and-forget, 202 Accepted) |

Config

| Env var | Required | Notes | | --- | --- | --- | | SEMANTICD_PORT | no | Default 4499 | | SEMANTICD_INDEX_PATH | no | Default ./semanticd.db | | SEMANTICD_SYNC_INTERVAL_MS | no | Default 900000 (15 min) | | EMBEDDING_PROVIDER | no | openai-compatible (default) or local (zero-API-key CPU model) | | EMBEDDING_BASE_URL / EMBEDDING_API_KEY / EMBEDDING_MODEL / EMBEDDING_DIMENSIONS | for openai-compatible | Any OpenAI-compatible /v1/embeddings endpoint -- OpenAI, OpenRouter, Ollama, vLLM, LM Studio, ... |

Graceful shutdown on SIGTERM/SIGINT: stops accepting new connections, lets in-flight requests finish, then closes the index file cleanly -- safe to redeploy in a container.

Development

See CONTRIBUTING.md for dev setup and commit conventions.