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

@xshieldai/flow

v0.1.3

Published

One agentic flow, end to end: GTP flow identity for tool calls, subagents and events (flow, turn, parent, mandate, session), narrowing that only shrinks (child = parent & requested), refusal of a missing parent, and a mapper from Claude Code hook input. P

Readme

@xshieldai/flow

One agentic flow, end to end. Part of the xShieldAI Posture Suite.

Every agent needs control, rails and scoping, and the xShieldAI packages provide them as separate parts: a mandate check, a cross-organisation handshake, gates before an action, kernel containment, a check on claims afterwards. This package is what lets them be read as one flow: it gives every action a flow, a turn and a parent, and it narrows authority at every hop so it can only shrink.

It follows section 19 of the Governed Turn Protocol (rules GTP-017 to GTP-026).

npm install @xshieldai/flow

What it does (0.1.3)

| Function | Rule | What it does | |---|---|---| | fromClaudeHook(input) | GTP-018 | Flow fields for one Claude Code hook call: the session is the flow, the tool call is the turn, and the parent is the subagent that made the call or, for the main agent, the prompt it answers. No session id gives no flow, never a made-up id. | | stamp(event, flow) | GTP-024 | Adds the five optional flow fields (flow_id, turn_id, parent_turn_id, mandate_id, session_ref) to an event. It only adds: a field the event already has is never overwritten. | | narrow(parent, requested) | GTP-020 | parent & requested. Every hop narrows; masks must be 32-bit unsigned integers or it refuses. | | narrowFromParent(id, parent, requested) | GTP-021 | Refuses when the named parent cannot be found. Missing lineage is never treated as a root. | | isWithin(child, parent) | KAV-065 | True when the child holds no bit the parent lacks. | | mandateStatus(mandate, { revoked }) | GTP-017, GTP-022 | valid, expired, revoked, missing or malformed. A flow's root holds only while its mandate is valid. | | effectiveCeiling({ mandate, envelope, session, parent }) | GTP-019 | The ceiling of a turn, computed: the mandate's mask AND every narrower layer present. No mandate is refused, never read as "everything". |

A refusal is a FlowRefusal carrying the rule it enforces (.rule).

import { fromClaudeHook, stamp, narrowFromParent } from "@xshieldai/flow";

const flow = fromClaudeHook(hookInput);      // { flow_id: "cc:<session>", turn_id: "tool:<id>", parent_turn_id: "agent:<id>" }
const event = stamp({ receipt_id, primitive: "aegis", event_type: "gate.decided" }, flow);
const mask = narrowFromParent(parentId, store.get(parentId), requested);   // throws GTP-021 if the parent is unknown

What it does not do

  • It enforces nothing on its own. It is pure functions with no I/O; the packages that hold the gates call it.
  • It does not issue or sign a mandate (aegis does that at session start) or keep the revocation list; it judges the mandate it is given. It does not yet carry an envelope across a subprocess or MCP call, or check a flow's required proof at the end. Those are later phases of the same section.

Runs under Bun and under plain Node 18+.

License

AGPL-3.0-only. See LICENSE.