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

@atoms-agent/agent-runtime

v1.0.0

Published

Agent product layer: session DAG, profiles, durable compaction, command bus and host adapters

Readme

@atoms-agent/agent-runtime

atoms_agent v1.0 产品编排层。它把现有 Core Agent Loop、Session DAG、Extensions、Coding Toolkit、 Skills 和 MCP 组合为可恢复的 Coding/General Agent;不实现第二套 Loop。

Install

npm install @atoms-agent/[email protected] @atoms-agent/[email protected] @atoms-agent/[email protected]

Node.js >=22.13,ESM only。只从包根导入。

General Runtime

import { slidingWindow } from "@atoms-agent/core";
import type { ModelAdapter } from "@atoms-agent/llm";
import {
  createAgentRuntime,
  createGeneralProfile,
  createLocalSessionBackend,
  createSessionManager,
} from "@atoms-agent/agent-runtime";

export async function openGeneralRuntime(model: ModelAdapter, sessionRoot: string) {
  const backend = createLocalSessionBackend({ root: sessionRoot });
  const manager = createSessionManager({
    backend,
    profile: { id: "atoms.general", revision: "1" },
  });
  await manager.create({ sessionId: "demo" });

  const generalProfile = createGeneralProfile({
    systemPrompt: "Be concise.",
    context: {
      ref: "window",
      fingerprint: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      strategy: slidingWindow({ maxTokens: 16_000 }),
    },
  });
  const runtime = createAgentRuntime({
    profile: generalProfile,
    model: { ref: "main", adapter: model },
    session: { manager },
  });
  await runtime.start();

  const run = runtime.run("Continue the task");
  for await (const event of run) {
    void event;
  }
  await run.result;
  return runtime;
}

Coding Profile

createCodingProfile() is asynchronous because the Toolkit verifies the explicit Workspace Root. The default Toolkit preset is read-only; Shell, Process, Git writes and filesystem writes require explicit selection and an explicit authorize policy.

import { slidingWindow as codingWindow, type AuthorizeFn } from "@atoms-agent/core";
import { createCodingProfile } from "@atoms-agent/agent-runtime";

export async function buildCodingProfile(workspaceRoot: string, authorize: AuthorizeFn) {
  return createCodingProfile({
    systemPrompt: "Inspect and edit only after authorization.",
    context: {
      ref: "coding-window",
      fingerprint: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
      strategy: codingWindow({ maxTokens: 16_000 }),
    },
    authorize,
    toolkit: {
      root: workspaceRoot,
      preset: "read-only",
    },
  });
}

Session Contract

  • createLocalSessionBackend() stores immutable Header + strict append-only JSONL Records.
  • All writes require expected Revision; stale writers fail with SESSION_CONFLICT.
  • SessionManager exposes create/resume/branch/switch/fork/clone and versioned Custom Entry append.
  • fork copies one root-to-entry path; clone copies the complete DAG. Sources remain unchanged.
  • v0.8 FileSessionStore can only be imported through importFileStoreSnapshot() into a create-only v1 Session. It is not a SessionBackend.
  • Truncated JSONL, bad UTF-8/JSON, duplicate keys, unknown fields/versions, broken Revision chains and invalid DAG/Tool pairing fail closed.

Runtime Behavior

  • Default auto save is { mode: "after_run", saveOn: "all_terminal" }; one Run is one append batch.
  • Manual mode holds one bounded dirty journal. A second Run/command is rejected until save() succeeds.
  • Durable Compaction Entries are validated projection hints. Complete Canonical history is always restored into Core; summaries remain fixed-marker untrusted User content.
  • Extension state remains ephemeral unless a Host binds an extension-scoped Custom Entry handler.
  • JSON, JSON-RPC and CLI adapters only call the Runtime command bus; they never write Session files.

Reliability Boundary

The Local Backend provides instance-local FIFO and atomic visibility at complete Record write + file sync. It does not promise power-loss durability, cross-process CAS, network filesystem semantics, side-effect reconciliation, encryption, a Secret scanner, OS sandboxing or background jobs. Session files are plaintext; the Host owns filesystem permissions, retention and backups.

The frozen wire/runtime contract is in docs/V10-AGENT-RUNTIME.md in the repository.

License

MIT