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

@demo-0416/pi-trace

v0.1.4

Published

pi extension: deepseek-harness-style trajectory view — timeline gantt, turn-grouped ledger, rich detail panel, live SSE streaming

Readme

pi-trace

Pi extension that renders a deepseek-harness-style trajectory view for every pi session — timeline gantt chart, turn-grouped ledger, rich detail panel, live SSE streaming.

Install

pi install npm:@demo-0416/pi-trace

Or try without installing:

pi -e npm:@demo-0416/pi-trace

Usage

Once installed, the extension auto-activates on every pi session:

  • TUI widget — a stats line appears below the editor: ✻ 3 轮 · LLM 21.7s · 42.9 tok/s · 缓存 96.6% · $0.03
  • /trace — open the current session's trajectory in the browser
  • /trace pick — pick a historical session from a list

The web UI runs on http://127.0.0.1:<port> (port auto-increments from 43110; written to ~/.pi/agent/traces/.port).

Features

Timeline (Gantt)

  • 3 lanes: Input / Model / Tools, with 4 projection modes (sequence, duration, time, actual)
  • Scroll to zoom (cursor-anchored), right-drag to pan, drag-select to focus
  • TTFT gradient ticks on model spans, turn boundary markers
  • Hover crosshair + tooltip, click to focus record

Ledger (Table)

  • Turn → group (Message / Step N) → cell hierarchy
  • Colored kind tags (USER / ASSISTANT / TOOL / SYSTEM)
  • Inline tool result previews, LLM request boundaries with cumulative usage
  • Turn + assistant folding, live full-text search

Detail Panel

  • User / Assistant: Summary / Preview / Raw / Source tabs — markdown rendering with syntax highlighting, token breakdown, TTFT/generation/throughput timing
  • Tool: Summary / Payload / Result / Schema / Timing tabs — JSON tree, tool schema from request
  • System: System Prompt / Tools tabs — full prompt snapshot, tool catalog

Data

  • Rich collection: thinking blocks, tool calls, request config (temperature/thinking/stop), prompt snapshots, tool schemas, call IDs, input source, reasoning tokens
  • Read-only session data: live timing stays in memory; only the server port is written to ~/.pi/agent/traces/.port
  • Historical session reconstruction from pi's own session JSONL
  • SSE live streaming (partial assistant messages + running tool calls)

Architecture

src/
├── index.ts           # extension entry (activate, widget, /trace commands)
├── collector.ts       # pi event stream → TraceRecord
├── server.ts          # node:http + SSE, serves web UI
├── store.ts           # paths and field truncation
├── model.ts           # TraceSession / TraceRecord types
├── stats.ts           # stats computation
├── session-loader.ts  # historical session reconstruction
└── web/
    ├── dist/          # pre-built React bundle (self-contained)
    ├── vendor/        # dsh ui-trajectory source (MIT, vendored)
    ├── primitives/    # dsh ui-primitives subset (MIT, vendored)
    ├── adapter.ts     # pi session JSON → dsh layout input
    ├── host.tsx       # React app: state, SSE, session picker
    ├── build.mjs      # esbuild + CSS modules plugin
    └── theme.css      # dsh design tokens (light theme)

The frontend vendors deepseek-harness's ui-trajectory package (MIT) — the same layout engine, timeline, table, and detail panel components, adapted to pi's data model via a thin adapter layer. The backend is pure TypeScript with zero runtime dependencies (pi bundles @earendil-works/pi-tui).

Development

# Backend smoke test (collector, store, server, stats)
npm test

# Frontend e2e test (install Chromium once)
(cd src/web && npm ci && npx playwright install chromium)
npm run test:e2e

# Rebuild frontend after modifying vendor/ or host.tsx
npm run build:web

Release

master is the release source of truth. Bump pi-trace/package.json, update CHANGELOG.md, rebuild the browser bundle, and merge the tested PR before publishing @demo-0416/pi-trace. Do not publish from an unmerged branch. npm publish rebuilds and runs the isolated regression/smoke tests. Run the browser e2e tests separately before release. For a custom Chromium installation, set PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.

License

MIT. See LICENSE. Vendored dsh code retains its original MIT license — see src/web/NOTICE.md.