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

@swift-agents/core

v0.1.0

Published

Transport, session, validation, retry, and instruction primitives for SwiftAgents React Native agents.

Readme

@swift-agents/core

React Native Core for SwiftAgents. Core owns session metadata, payload validation, HTTP ingest, retry delivery, diagnostics, and the optional server instruction channel.

Install

npm install @swift-agents/core

The published entry is src/index.ts, resolved through the main, module, react-native, and types package fields. Test files and backend sources are not part of the package allowlist. Select a project license before publishing; this repository intentionally marks the unpublished artifact UNLICENSED.

Agents must depend on Core and must not call fetch, open WebSockets, or implement their own retry queues.

Initialization

import { SwiftAgentsCore } from "@swift-agents/core";

await SwiftAgentsCore.init({
  apiKey: "publishable-sdk-key",
  userId: "user-123",
  baseUrl: "https://api.example.invalid",
});

await SwiftAgentsCore.dispatch({
  type: "event",
  data: { name: "app_opened" },
});

Every dispatched envelope receives the current sessionId, userId, appId, timestamp, and platform "rn". Runtime Platform.OS is never used as the payload platform.

Backend boundary

With baseUrl, the default HttpCoreTransport calls the shared backend contract:

  • POST /api/v1/sdk/core/init with X-API-Key;
  • POST /api/v1/sdk/core/ingest with Authorization: Bearer <sessionToken>;
  • POST /api/v1/sdk/navigation/query with the same bearer session;
  • GET /api/v1/sdk/core/instructions as the canonical SSE channel; and
  • POST /api/v1/sdk/core/instructions/{instructionId}/status for lifecycle acknowledgements.

The session token is kept private by Core and is never included in an ingest envelope or returned by getSession(). A 401 marks the session expired and is not sent through the ingest retry queue; destroy the expired Core instance and initialize it again to create a new session. A custom CoreTransport, or ingestUrl plus an authentication callback, remains available for tests and custom deployments.

Server instructions use one canonical envelope. Agent-007 consumes the same shape Core receives:

{
  instructionId: "instruction-id",
  type: "navigation",
  sessionId: "session-id",
  appId: "app-id",
  correlationId: "query-id",
  expiresAt: "2026-09-24T12:00:00.000Z",
  data: {
    action: "stroll",
    destination: { nodeId: "settings", routeId: "settings" },
    reason: "route_gap",
  },
}

Use core.onInstruction(listener) (or subscribeInstructions) for direct consumers. core.queryNavigation(...) and core.acknowledgeInstruction(...) are the Core-level server boundaries.

Retry

Transient ingest failures use an in-memory bounded queue with delays of 1s, 2s, and 4s after the initial attempt. After three retries the payload is dropped and the local diagnostic/error callback is invoked. Permanent authentication, validation, and non-retryable HTTP failures are not retried.

The queue is not durable across process death. Call destroy during host shutdown to cancel pending delivery and prevent stale retries.

Package boundary

This package contains no navigation observation, graph construction, BFS, semantic matching, UI scraping, or presentation logic.