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

@personaai/devtools

v0.1.2

Published

Devtools for the Persona SDK — inspect runtime, threads, chat and logs. Framework-agnostic core + React panel + Next.js helper. OFF by default, dev-only.

Readme

@personaai/devtools

Devtools for the Persona SDK — inspect threads, chat, workspace and logs when using @personaai/nextjs (which re-exports @personaai/react on sdk/adapters/nextjs/src/client.ts:15 and wraps @personaai/runtime on sdk/adapters/nextjs/src/server.ts:177).

v0.1.0 — dev-only, zero runtime changes. No new route is required. The panel is a pure client component that reads the hooks you already use. It never bundles into production unless you import it.

Single package, three subpaths (your approved sdk/devtools/{core,react,nextjs} layout):

  • @personaai/devtools/core — framework-agnostic snapshot utilities + in-memory ring buffer (no React)
  • @personaai/devtools/react — floating <PersonaDevtools /> panel (TanStack Query style)
  • @personaai/devtools/nextjs — same panel with 'use client' boundary for app/layout.tsx

Install

npm install -D @personaai/devtools
# or: pnpm add -D @personaai/devtools

Peer react >=18 is optional — core works on Express/NestJS servers with no React installed. The panel itself requires React.

Quickstart — Next.js (no adapter/runtime change)

@personaai/nextjs already re-exports every React hook, so one install covers everything the panel inspects (useChat, useThreads, useAgents, useFiles, useMemory, useConnection, useMcpConnections from sdk/react/src/index.ts:1 and streaming types from sdk/react/src/types.ts:1).

// app/layout.tsx
import { PersonaProvider } from '@personaai/nextjs'; // client.ts:15 re-export
import { PersonaDevtools } from '@personaai/devtools/react'; // or '@personaai/devtools/nextjs' inside app/
import { useChat, useThreads } from '@personaai/nextjs';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <PersonaProvider baseUrl="/api/persona" getAuthToken={...} defaultAgentId="...">
          {children}
          {process.env.NODE_ENV === 'development' && <Devtools />}
        </PersonaProvider>
      </body>
    </html>
  );
}

// Tiny wrapper that feeds live hook state into the panel — no server fetch needed
'use client';
import { useChat } from '@personaai/nextjs';
import { useThreads } from '@personaai/nextjs';

function Devtools() {
  const { threads } = useThreads();
  const { messages, files, todos } = useChat({ agentId: 'my-agent' });
  return <PersonaDevtools clientState={{ threads, messages, files, todos }} />;
}

Without clientState the panel still renders but shows empty placeholders — pass whatever hooks you use.

Optional: poll a server snapshot

If you later mount a snapshot endpoint yourself (no runtime change required — just add a custom route), the panel can poll it:

// app/api/persona/__persona/devtools/route.ts  (you create this, no SDK change)
import {
  createDevtoolsStore,
  createDevtoolsHandler,
} from "@personaai/devtools/core";
const store = createDevtoolsStore();
const handler = createDevtoolsHandler({
  store,
  getSnapshot: () => ({
    runtime: {
      mode: "development",
      mountPath: "/api/persona",
      capabilities: {},
      routeCount: 0,
      runCount: 0,
      heartbeatIntervalMs: 15000,
    },
    routes: [],
    runs: [],
  }),
});
export async function GET() {
  const r = await handler.handle();
  return new Response(r.body, { status: r.status, headers: r.headers });
}

Then:

<PersonaDevtools
  baseUrl="/api/persona"
  clientState={{ threads, messages, files, todos }}
/>

baseUrl on, intervalMs:3000 polls baseUrl/__persona/devtools. Omit baseUrl for client-only mode (default).

Tabs

| Tab | Source | Shows | | ------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | | Chat | useChat() sdk/react/src/hooks/useChat.ts:156 | messages, isStreaming, interrupt (hitl/clarification), last 3 messages preview | | Threads | useThreads() sdk/react/src/hooks/useThreads.ts:7 | list, count, active threadId | | Workspace | useChat() files/todos/presentedFile (from STATE_SNAPSHOT) | file count, todo count, file tree preview | | Runtime | GET __persona/devtools if baseUrl set | mode, mountPath, capabilities sdk/runtime/src/types/options.ts:27, routeCount, runCount, full route table | | Logs | core store ring buffer + fetchWithAuth history | last 50 requests (redacted Authorization) + last 100 logs |

API

import { createDevtoolsStore, createDevtoolsHandler } from '@personaai/devtools/core';
import { PersonaDevtools, useDevtoolsSnapshot } from '@personaai/devtools/react';
import { PersonaDevtools as PersonaDevtoolsNext } from '@personaai/devtools/nextjs';

<PersonaDevtools
  baseUrl?: string            // poll server snapshot — omit for client-only
  clientState?: { threads?, messages?, files?, todos? }
  defaultOpen?: boolean        // default false
  pollIntervalMs?: number      // default 3000, 0 = manual only
/>

Production safety

  • OFF by default — no panel, no fetch, no logs unless you import <PersonaDevtools />.
  • Panel not re-exported from @personaai/react sdk/react/src/index.ts:1, so tree-shaken when not imported.
  • Even if imported, hidden in production unless window.__PERSONA_DEVTOOLS_FORCE__ = true — see src/react/DevtoolsPanel.tsx.
  • Never logs secrets — callers must redact before logging (same rule as @personaai/logger sdk/logger/src/logger.ts:1).

No runtime republish needed

This package has no dependency on @personaai/runtime (sdk/devtools/package.json:33 only logger + optional react). It composes the runtime via the existing PersonaContext and optional fetch(__persona/devtools) — zero lines changed in sdk/runtime.