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-superagent

v1.1.0

Published

Respan instrumentation plugin for the Superagent safety-agent TypeScript SDK

Readme

Respan instrumentation for Superagent

Trace the native Superagent safety-agent TypeScript SDK through Respan's shared OpenTelemetry pipeline. Verified with stable 0.1.7 and minimum 0.1.6.

Install

npm install @respan/respan @respan/instrumentation-superagent safety-agent

Usage

import { Respan } from "@respan/respan";
import { SuperagentInstrumentor } from "@respan/instrumentation-superagent";
import * as safetyAgentModule from "safety-agent";

const respan = new Respan({
  apiKey: process.env.RESPAN_API_KEY,
  instrumentations: [new SuperagentInstrumentor({ safetyAgentModule })],
});
await respan.initialize();
try {
  const client = safetyAgentModule.createClient({
    apiKey: process.env.SUPERAGENT_API_KEY,
  });
  const result = await client.guard({
    input: "Check this message",
    model: "openai/gpt-4o-mini",
    chunkSize: 0,
  });
  console.log(result.classification);
} finally {
  await respan.shutdown();
}

Captured behavior

guard() emits a guardrail operation; redact() and scan() emit tool operations. The native provider's public request and response transformations produce one chat span per native provider transformation. Chunked guard calls therefore produce multiple model spans, and 0.1.7 fallback calls preserve separate attempts. Scan executes remotely through Daytona and exposes only a scan result, so it emits no invented model child.

Model spans preserve native messages, multimodal parts, response schemas, complete request metadata and completions, observed provider/model identity, and native usage including explicit zeros. Missing totals and HTTP statuses are not inferred. Failed requests retain their native error and have no fabricated output. The plugin preserves returned promise/result/error identity, native chunks, and provider callbacks.

Content controls and lifecycle

SuperagentInstrumentor accepts traceContent, recordInputs, recordOutputs, metadata, an optional methods subset, and the native safetyAgentModule. Constructor restrictions, RESPAN_TRACE_CONTENT=false, canonical Traceloop context, suppression, observed ancestor vetoes, and late span vetoes are ceilings; later opt-in cannot restore denied content. Sampling runs before request/response copying. Dropped and unsampled recording spans add no payload work. Actual span attributes, events, and status are guarded against late content writes.

Await activate() for standalone use and call deactivate() to restore owned patches. Multiple owners, pending activation cancellation, in-flight draining, and foreign patches are handled without replacing unrelated wrappers. Respan's released public transformer API observes ancestor policy; a standalone OTel provider still applies sampling and owned-span content guards.

Operation parents carry common fields and canonical JSON metadata; model fields stay on actual model children. Respan's shared exporter applies semantic naming and removes internal naming hints. Auto-emitted operations do not set traceloop.span.kind.

The standalone controlled examples cover guard/redact/workflow/scan, chunking, fallback, privacy, errors, and large native payloads. The explicit fallbackModel option is absent from minimum 0.1.6; its native regression is skipped only in that profile.

The SDK may retry a timed-out HTTP request with a reused transformed body. Such transport retries do not expose another provider transformation, so this adapter cannot distinguish them as separate model spans. Explicit fallbackModel calls do expose distinct transformations and are covered.