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

@respan/instrumentation-dify

v0.1.0

Published

Respan instrumentation plugin for the official Dify Node.js SDK

Readme

Respan Dify instrumentation

Trace the official dify-client Node.js SDK with Respan.

This package supports Dify 3.1.x on Node.js 18 or newer. It patches the SDK's exported HttpClient, so Chat, Completion, Workflow, Knowledge Base, Workspace, file, feedback, conversation, and generic Service API operations are covered without maintaining a fragile list of high-level methods. Blocking calls emit when their promise resolves. SSE and binary spans remain open until the returned stream is exhausted, closed early, or fails.

Install

npm install @respan/respan @respan/instrumentation-dify dify-client

Usage

import { ChatClient } from "dify-client";
import { Respan } from "@respan/respan";
import { DifyInstrumentor } from "@respan/instrumentation-dify";

const respan = new Respan({
  apiKey: process.env.RESPAN_API_KEY,
  instrumentations: [new DifyInstrumentor()],
});
await respan.initialize();

const client = new ChatClient({
  apiKey: process.env.DIFY_CHAT_API_KEY!,
  baseUrl: process.env.DIFY_BASE_URL,
});
const response = await client.createChatMessage({
  inputs: {},
  query: "Reply with one concise sentence about tracing.",
  user: "respan-example-user",
  response_mode: "blocking",
});
console.log(response.data.answer);

await respan.shutdown();

For streaming calls, consume the documented AsyncIterable (or call toText()). The instrumentation preserves data, status, headers, requestId, toReadable(), and toText() on the original Dify stream.

Pass includeContent: false to omit request/response bodies and prompt/completion content while retaining operation, status, correlation, and token-usage attributes:

new DifyInstrumentor({ includeContent: false })

Credential-like fields are always recursively redacted from captured requests and echoed responses.

When multiple instrumentor instances overlap, the first active instance's content policy remains in effect until the last instance is deactivated; conflicting instances log a warning instead of changing it. Deactivation restores only wrappers still owned by this instrumentor, so a later patch from another library is left intact.

The integration is explicit-only because Dify is an application/workflow service rather than a leaf model provider.