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

@eightstate/agent-client

v0.3.1

Published

Framework-neutral client for Eight State agent workload capabilities

Readme

@eightstate/agent-client

Framework-neutral ESM client for trusted Eight State Gate capabilities used by agent workloads. It uses only standard Web APIs and requires an explicit Gate origin, a per-request workload-token provider, and optionally an injected fetch implementation.

Gate binds protocol to the stored workload token. Existing tokens remain v1; new coding-worker tokens are v2 and enforce immutable source-event, workload-token, agent-revision, and human-revision run bindings. The optional X-Eightstate-Agent-Protocol header is an optional 1 or 2 assertion and cannot downgrade a v2 token.

import {createAgentClient} from '@eightstate/agent-client'

const client = createAgentClient({
  origin: 'https://gate.example',
  token: async ({signal}) => acquireWorkloadToken(signal),
})

const search = await client.research.search('Eight State release process', {
  signal: AbortSignal.timeout(20_000),
  context: {
    runId: 'run-123',
    taskId: 'task-456',
    humanIdentityRevisionId: 73,
  },
})

The package does not read environment variables or files, launch processes, manage Git repositories, or depend on an agent framework. Callers own policy, retry scheduling, persistence, and credential acquisition. AgentClientError reports retrySafe and commitUncertain; the client never retries writes.

Durable share creation requires an explicit idempotency key. Gate returns a server-verified receipt, and client.shares.verify(content, response) checks that receipt against the exact input bytes before callers clean up local work. Safe PNG, JPEG, and WebP bytes can be shared with kind: 'image'; other binary artifacts use kind: 'bytes'.

GitHub host operations

client.github exposes the trusted-host GitHub boundary:

  • repositories() requires github:read.
  • gitCredential(repository) requires github:git. Gate verifies the pinned human's access, then returns a display-once GitHub App installation token narrowed to that repository. The human's broad OAuth token is never returned.
  • createPullRequest(input) requires github:pr and a stable idempotencyKey.
  • verifyPullRequest(input) re-verifies the persisted publication receipt.
  • advancePullRequestHead(input) idempotently records and verifies a later pushed branch head for the same pull request.

Linear events identify their immutable source and human attribution with source_event_key, human_identity_revision_id, and linear_user_id. Pass the same human revision as context.humanIdentityRevisionId on subsequent calls so Gate can reject stale or mismatched authority. Pull-request receipts expose the agent revision, immutable original human revision, and the human revision that last advanced the head. Research search/fetch, Linear read/write, share create/verify, and GitHub operations require a stored runId plus sourceEventId; the optional human revision header is only an assertion against Gate's stored run binding. Identity, readiness, and Linear event register/poll/ack operations remain pre-run.

For compatibility, receipt.identity_revision_id remains the agent identity revision. agent_identity_revision_id is the explicit equivalent; human_identity_revision_id identifies the original PR human.

Coordinated rollout

  1. Deploy the Agents v2 code with the coding worker disabled and no v2 token.
  2. Merge and deploy Gate, which applies additive migration 0015 while legacy v1 tokens and old Gate SQL tables continue to work.
  3. Issue a new coding-worker token. Gate stores it as protocol version 2.
  4. Configure Agents v2 with that token and enable the coding worker.

Do not issue the v2 coding token before the Agents runtime can persist event source keys and pass run context to every GitHub operation. Existing tokens remain protocol version 1 throughout the staged rollout.

The exact paths, required scopes, risk classifications, and idempotency rules are exported as GITHUB_AGENT_CONTRACTS.