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

@codesoul-co/ditto-retrieval

v0.1.0

Published

Optional retrieval Worker and adapters for Ditto.

Readme

Ditto Retrieval

@codesoul-co/ditto-retrieval is the optional retrieval Worker and provider package for @codesoul-co/ditto. It adds RETRIEVAL.SEARCH and adapters for Memory and Context. It does not own your corpus, database connections or RAG application plan.

Install

Requires Node.js 24+, npm 11+ and ESM:

npm init -y
npm pkg set type=module
npm install @codesoul-co/ditto @codesoul-co/ditto-retrieval

The main package is a peer dependency. Importing retrieval does not register a Worker or start a service. The main package works independently when retrieval is not installed.

Run a search

Save as search.mjs and run node search.mjs:

import { createDitto, graph } from "@codesoul-co/ditto";
import {
  createRetrievalWorker,
  createTextSearchProvider,
  RetrievalTargetRegistry,
} from "@codesoul-co/ditto-retrieval";

const documents = [
  { id: "context", content: "Redis stores working context.", source: { ref: "guide.md#context" } },
  { id: "memory", content: "SQLite stores durable memory.", source: { ref: "guide.md#memory" } },
];
const provider = createTextSearchProvider({
  async search(input) {
    const query = String(input.query.content).toLowerCase();
    return {
      target: input.target,
      candidates: documents.filter(doc => doc.content.toLowerCase().includes(query)).slice(0, input.limit ?? 5),
    };
  },
});
const providers = new RetrievalTargetRegistry({
  guide: { defaultStrategy: "keyword", providers: { keyword: provider } },
});
const runtime = createDitto({ workers: [createRetrievalWorker({ providers })] });
const plan = graph("search-guide")
  .node("found", "RETRIEVAL.SEARCH", [], query => ({
    query: { content: query }, target: { name: "guide" }, limit: 5,
  }));
try {
  const { found } = await runtime.run(plan, "Redis");
  if (found.status !== "success" || !found.output) {
    throw new Error(found.error?.message ?? "Retrieval failed");
  }
  console.log(found.output.candidates);
} finally { await runtime.close(); }

Expected result: the context document with its source reference. This is a tiny application-owned keyword corpus, not a vector database. For real data, inject a database/search backend and enforce target, namespace and tenant authorization in the application.

Public entries

| Import | Purpose | | --- | --- | | @codesoul-co/ditto-retrieval | Worker factory, contracts, target registry, text/vector/hybrid/rerank/embedding providers and database adapters | | @codesoul-co/ditto-retrieval/adapters/memory | Memory ↔ retrieval adapters and candidate mapping | | @codesoul-co/ditto-retrieval/adapters/context | Context RAG selection strategy and candidate mapping |

import { RemoteRetrievalSearchProvider } from "@codesoul-co/ditto-retrieval/adapters/memory";
import { createRetrievalContextStrategy } from "@codesoul-co/ditto-retrieval/adapters/context";

Importing the package adds the RETRIEVAL.SEARCH contract to Ditto's open NodeContractMap. A separate Worker registration is still required for Runtime execution. Consumers should use NodeNext module resolution without source aliases. Do not import the old main-package /worker/retrieval subpath or private src/dist files.

Complete guides and applications

RAG is an application Graph/Loop composition. Retrieval supplies search capability; Memory persists approved internal knowledge and task state, while external knowledge databases use separately configured providers. SDK dependencies and connection lifecycle remain application owned.