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

v0.2.0

Published

Respan instrumentation plugin for Writer TypeScript SDK

Readme

Respan Writer Instrumentation

Trace the official writer-sdk TypeScript SDK with canonical Respan chat and text spans. Requires @respan/tracing 1.3.2 or later. Supports Writer SDK 2.0.0 through 3.x; chat.parse and the event streaming helper are available only in SDK versions that provide them (2.3.2 and 3.0.0 are tested).

import Writer from "writer-sdk";
import { Respan } from "@respan/respan";
import { WriterInstrumentor } from "@respan/instrumentation-writer";

const instrumentor = new WriterInstrumentor();
const respan = new Respan({
  apiKey: process.env.RESPAN_API_KEY,
  instrumentations: [instrumentor],
});
await respan.initialize();
const client = new Writer({ apiKey: process.env.WRITER_API_KEY });
const completion = await client.chat.chat({
  model: "palmyra-x5",
  messages: [{ role: "user", content: "Write a one-line product update." }],
});
await respan.shutdown();

The instrumentor observes chat.chat, chat.parse, chat.stream, and completions.create, including native SSE streams, early return, cancellation, tee(), asResponse(), and withResponse(). It preserves native promises, parsed results, responses, stream controllers, iterators, chunks and errors. Raw-response-only calls emit request metadata and HTTP status without parsing or consuming the response body.

Prompt history, structured content, tool definitions, schemas, response tool calls, parsed output and provider usage retain their native values. Historical tool messages do not create execution spans. Wrap application tool execution with respan.withTool to trace that work explicitly. Response IDs and response models come from actual SDK responses; missing totals and HTTP statuses are omitted.

traceContent: false withholds both input and output. recordInputs: false and recordOutputs: false control each direction. The canonical Traceloop CONTEXT_KEY_ALLOW_TRACE_CONTENT, observed ancestor allow_trace_content: false, and RESPAN_TRACE_CONTENT=false / TRACELOOP_TRACE_CONTENT=false are upper bounds. A denial remains effective through completion and later readable-span processing. Unsampled calls, OTel general suppression and the historical local language-model suppression context do not emit Writer spans. Content conversion reads data properties only and never calls customer getters, proxies, toJSON, toString or custom iterators.

When an application resolves a separate SDK copy, pass its module:

import { WriterInstrumentor } from "@respan/instrumentation-writer";

const writerModule = await import("writer-sdk");
const instrumentor = new WriterInstrumentor({ sdkModule: writerModule });
await instrumentor.activate();
// Use writerModule.default for application clients.
instrumentor.deactivate();

Overlapping instrumentor instances share owned patches. Deactivation preserves foreign overrides and lets existing calls finish. Existing mapping and stream-state helper exports remain available.