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

@hostfunc/sdk

v0.2.0

Published

Runtime SDK for hostfunc functions

Readme

Version License

🔐 Authentication

When executing @hostfunc/sdk locally or from an external npm environment (outside the natively hosted runtime), you must provide authentication details via environment variables:

  • HOSTFUNC_API_KEY — Your API token (create this in Dashboard -> Settings -> Tokens)
  • HOSTFUNC_CONTROL_PLANE_URL — The URL of your Hostfunc web dashboard (e.g., http://localhost:3000)
  • HOSTFUNC_RUNTIME_URL — (Optional) Your Hostfunc runtime execution URL (defaults to the control plane URL if omitted)
  • HOSTFUNC_FN_ID — The current Function ID. Required when calling secret.get(...) externally.

✨ Magic Out of the Box: If you are using the Monaco editor within the Hostfunc dashboard, you don't need to configure these! The workspace SDK key is auto-provisioned and injected securely for you.

📦 Modules

The SDK is broken down into purpose-built modules to keep your imported bundles tiny:

  • @hostfunc/sdk — Core function execution APIs (e.g., executeFunction, secret)
  • @hostfunc/sdk/ai — Native AI chat and LLM generation (askAi, streamAi, createEmbedding)
  • @hostfunc/sdk/agent — Agentic workflows and orchestration (createAgent, runAgent)
  • @hostfunc/sdk/vector — Vector DB operations (upsert, query, deleteVectors, getNamespace)

🚀 Core Usage

Call other functions seamlessly and retrieve encrypted secrets dynamically natively from inside your function:

import fn, { secret } from "@hostfunc/sdk";

export async function main(input: { customerId: string }) {
  // 1. Fetch a securely injected secret
  const apiKey = await secret.getRequired("CLAUDE_API_KEY");
  
  // 2. Compose workflows by calling another hostfunc!
  const report = await fn.executeFunction("org/generate-report", {
    customerId: input.customerId,
    apiKey,
  });
  
  return { ok: true, report };
}

🧠 AI Usage

Generate LLM responses with simple, direct primitives:

import { askAi } from "@hostfunc/sdk/ai";

export async function main(logData: string) {
  const summary = await askAi(`Summarize this execution log: ${logData}`);
  return { summary };
}

🤖 Agent Usage

Leverage autonomous agents to fulfill goals and execute tools on your behalf:

import { runAgent } from "@hostfunc/sdk/agent";

export async function main(incident: any) {
  const run = await runAgent({
    name: "triage-alerts",
    goal: "Classify incident events and call escalation functions appropriately.",
  });
  return run.result;
}

📐 Vector Usage

Manage embeddings directly for RAG workflows:

import { createEmbedding } from "@hostfunc/sdk/ai";
import { upsert, query } from "@hostfunc/sdk/vector";

export async function main(profileText: string) {
  // 1. Generate text embeddings via AI
  const { embedding } = await createEmbedding(profileText);
  
  // 2. Upsert into your Vector namespace
  await upsert("profiles", [{ id: "cus_123", values: embedding }]);
  
  // 3. Query closest matches using cosine similarity
  const hits = await query("profiles", embedding, { topK: 5 });
  
  return hits;
}