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

@promte/app-library

v0.1.7

Published

Docs for using the app DB API in embedded apps.

Readme

@promte/app-library

Docs for using the app DB API in embedded apps.

What "DB" means here

In this library, DB access is exposed as:

const client = usePromteClient();
const db = client.data(); // default scope: "private"

Scopes

  • private (default): data is scoped per user.
  • public: shared for the whole workspace.
    • Reads are allowed for users with workspace access.
    • Writes (set, update, remove, push) require workspace admin/owner.
const privateDb = client.data(); // same as client.data("private")
const publicDb = client.data("public");

Paths and refs

Use slash-separated paths:

const settingsRef = client.data("public").ref("translator/settings");

Path normalization trims spaces and removes extra slashes, so " /a//b/ " becomes "a/b".

Core operations

// Read
const settings = await client.data("public").ref("translator/settings").get();

// Set/replace value at path
await client.data("public").ref("translator/settings").set({
  temperature: 0.2,
});

// Update multiple child paths relative to current ref
await client.data("public").ref("translator").update({
  "settings/temperature": 0.3,
  "features/context": true,
});

// Remove path
await client.data("public").ref("translator/features").remove();

// Push into array at path (creates array if missing/not array)
await client.data().ref("sessions/session-1/events").push({
  type: "message",
  at: Date.now(),
});

Models/capabilities

You can fetch configured models/capabilities from backend:

const client = usePromteClient();
const allModels = await client.models();
const llmsOnly = await client.models({ type: "llm", configuredOnly: true });
const embeddingsOnly = await client.models({
  type: "embedding",
  configuredOnly: true,
});

Or use the built-in hook:

const { models, loading, error, reload } = usePromteModels({
  type: "llm",
  configuredOnly: true,
});

Each model includes id, label, type (llm | embedding | image | stt | tts) and configured.

Embeddings

Embeddings use the same app token/auth flow as LLM requests. Fetch an available embedding model, then create embeddings:

const client = usePromteClient();
const [model] = await client.models({
  type: "embedding",
  configuredOnly: true,
});

const response = await client.embeddings.create({
  model: model.id,
  input: ["First text", "Second text"],
});

const vectors = response.data.map((item) => item.embedding);

Knowledge search

Apps can search an assistant/workspace knowledge base directly:

const client = usePromteClient();

const response = await client.knowledge.search({
  workspaceId: "assistant-workspace-id",
  query: "Hvad gælder for carporte i BR18?",
  maxResults: 8,
  generateSearchQuery: true,
});

for (const result of response.results) {
  console.log(result.title, result.text, result.sourceUrl);
}

If workspaceId is omitted, the search uses the current app workspace. Searching another workspace requires that the current user has access to that workspace. Public app tokens can only search their own workspace.

Return behavior

  • get() returns the value at the current path, or null if missing.
  • Mutations (set, update, remove, push) return the updated scope object.

Common patterns

// Save one record by id
await client.data().ref(`sessions/${sessionId}`).set(session);

// List records under a collection-like object
const sessionsObj = await client.data().ref("sessions").get();
const sessions = sessionsObj ? Object.values(sessionsObj) : [];

Errors to expect

  • Promte settings not received yet / Promte token not received yet: provider handshake not ready.
  • Admin only: trying to write to public scope without admin rights.
  • update requires an object: ref.update(...) got a non-object input.
  • push requires a path: attempted client.data().push(...) without a ref path.