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

@love-moon/ai-manager

v0.2.42

Published

Manage local AI CLI tools (codex, claude, kimi, copilot): install/network health, quota, and codex account switching

Downloads

952

Readme

@love-moon/ai-manager

Manage local AI CLI tools (codex, claude, kimi, copilot) for conductor. Runs inside the daemon process so it can read local credential files, query the Keychain, and make outbound requests over the host's network/VPN.

Features

  • Install status — detect whether codex, claude, and kimi are on PATH, and whether the bundled Copilot SDK is available
  • Network reachability — probe chatgpt.com, api.anthropic.com, api.kimi.com, api.githubcopilot.com (VPN sanity check)
  • Quota — pull usage for all tools via authenticated probes against each provider's own rate-limit channel; results are cached on disk with a TTL
  • Codex account switching — list configured ~/.codex/auth.json profiles and atomically swap between them

Config

Reads from ~/.conductor/config.yaml:

ai_manager:
  codex:
    auth_json:
      - /abs/path/auth_accountA.json
      - /abs/path/auth_accountB.json

The codex.auth_json list controls account switching. Quota and install detection require nothing in the conductor config.

How quota is fetched

Each provider exposes usage on a different surface. There is no stable local command, so we hit the same channel the official CLI uses.

| Tool | Source | Auth | | ------ | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | codex | POST chatgpt.com/backend-api/codex/responses rate-limit headers | tokens.access_token from ~/.codex/auth.json; model resolved from ~/.codex/config.toml | | claude | POST api.anthropic.com/v1/messages rate-limit headers | ANTHROPIC_API_KEY env, then macOS Keychain entry Claude Code-credentials, then ~/.claude/.credentials.json | | kimi | GET api.kimi.com/coding/v1/usages | ~/.kimi/credentials/kimi-code.json; expired access tokens are refreshed automatically and persisted back | | copilot | @github/copilot-sdk RPC account.getQuota | SDK logged-in auth discovery: stored Copilot login or gh auth; explicit tokens are only used when passed through API options |

For codex the body stream is aborted as soon as headers arrive, so the probe costs at most one token of quota. Quota responses are cached at ~/.conductor/cache/ai-manager/quota-<tool>-<fp>.json with a 60s TTL by default; pass forceRefresh: true to bypass.

API

import { AiManager } from "@love-moon/ai-manager";

const m = new AiManager();

// 1) install
await m.checkInstall("codex");
await m.checkInstallAll(); // { codex, claude, kimi, copilot }

// 2) network
await m.checkNetwork("kimi");
await m.checkNetworkAll();

// 3) quota
await m.getCodexQuota();
await m.getClaudeQuota();
await m.getKimiQuota();
await m.getCopilotQuota();
//   { fiveHour, weekly, source: 'fresh'|'cached'|'stale'|'unknown', ... }

// 4) codex accounts
await m.listCodexAccounts();          // [{ name, email, planType, isCurrent }, ...]
await m.getCurrentCodexAccount();
await m.switchCodexAccount("accountB"); // atomic rename + 0o600, backs up to auth.json.bak

Lower-level functions (checkInstall, getKimiQuota, loadAiManagerConfig, parseAuthFile, …) are exported individually if you want to bypass the aggregator.

Identity / safety

  • Codex account identity is email|account_id from the JWT, not a token prefix — OpenAI access tokens share a long header prefix and would otherwise collide.
  • switchCodexAccount writes to auth.json.tmp and renames over ~/.codex/auth.json so partial writes can never produce a corrupt file. The previous content is copied to auth.json.bak first.
  • A switch does not affect codex processes that are already running; they hold the old token in memory until they restart.
  • Quota probes never log raw bearer tokens.

Testing

pnpm install
pnpm test       # node --test, ~14 unit tests
pnpm typecheck
pnpm build