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

@agent-dashboard/protocol

v0.1.4

Published

The Generic Agent Protocol — a runtime-agnostic TypeScript contract that any agent runtime can implement to plug into the Agent Dashboard.

Readme

@agent-dashboard/protocol

The Generic Agent Protocol — a runtime-agnostic TypeScript contract that any agent runtime can implement to plug into the Agent Dashboard.

This package has zero runtime dependencies. Adapters import the type contract, implement it, and emit a closed set of events; the orchestrator does the rest.

What's in here

  • AgentAdapter — the interface every runtime adapter implements.
  • TaskContext, TaskHandle — request/response shapes for startTask.
  • AgentEventType, AgentEventPayloadMap — typed event taxonomy with payload shapes per event. See events.md.
  • validateAdapter, validateEventPayload — pure runtime guards used by the orchestrator's dynamic loader and the event ingest path.
  • PROTOCOL_VERSION — semver string. Bump policy is documented in src/version.ts.

Implementing an adapter

Below is a minimal "echo" adapter that emits a started event, a single tool call, and then a completed event. It demonstrates the full lifecycle.

import type {
  AgentAdapter,
  AgentEventPayloadMap,
  AgentEventType,
  TaskContext,
  TaskHandle,
} from '@agent-dashboard/protocol';

type Listeners = {
  [E in AgentEventType]?: Set<(p: AgentEventPayloadMap[E]) => void>;
};

export const echoAdapter = (): AgentAdapter => {
  const listeners: Listeners = {};

  const emit = <E extends AgentEventType>(event: E, payload: AgentEventPayloadMap[E]): void => {
    listeners[event]?.forEach((fn) => fn(payload));
  };

  return {
    runtime: 'echo',

    startTask: async (ctx: TaskContext): Promise<TaskHandle> => {
      const handle: TaskHandle = {
        agentId: ctx.agentId,
        runtime: 'echo',
        pid: null,
        startedAt: new Date().toISOString(),
      };
      const base = { timestamp: handle.startedAt, agentId: ctx.agentId, storyId: ctx.storyId };
      emit('agent.started', { ...base, runtime: 'echo', pid: null });
      emit('agent.tool_called', { ...base, tool: 'Echo', arg: ctx.story.title });
      emit('agent.completed', { ...base, exitCode: 0, summary: 'echoed' });
      return handle;
    },

    kill: async () => undefined,

    on: (event, listener) => {
      const set = (listeners[event] ??= new Set()) as Set<typeof listener>;
      set.add(listener);
      return () => set.delete(listener);
    },

    dispose: async () => undefined,
  };
};

Soft-pause (optional)

AgentAdapter exposes an optional pause(handle) method (Story 7.1). It's a best-effort soft signal — the agent should land at its next safe checkpoint without losing in-flight work. Adapters that don't have a runtime pause primitive may omit this method entirely or implement it as a no-op; the orchestrator won't hang waiting on it.

pause is not a hard kill. The CLI's agent-dashboard kill command (separate story) is the destructive path.

Architecture references

  • AD-11 (Generic Agent Protocol) — this contract.
  • AD-12 (Adapter loader) — orchestrator dynamically imports adapters and calls validateAdapter() before use.
  • AD-20 (Single-writer) — adapters never write state files; they emit events. The orchestrator (Story 4.3) is the lone state writer.

For payload-by-payload details, see events.md.