New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

opencode-multi-account-core

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-multi-account-core

Shared core for multi-account OpenCode plugins

latest
Source
npmnpm
Version
0.2.14
Version published
Weekly downloads
362
7.1%
Maintainers
1
Weekly downloads
 
Created
Source

multi-account-core

Shared core logic for multi-account OpenCode plugins. This package contains ~70% of the logic used by both anthropic-multi-account and codex-multi-account.

What's inside

ModuleWhat it does
AccountStoreSingle write path. Serializes all disk mutations through file locking.
AccountManagerIn-memory account cache and selection strategies (sticky, round-robin, hybrid). Created via createAccountManagerForProvider.
ExecutorRetry loop with account rotation on auth and rate-limit failures. Created via createExecutorForProvider.
ClaimsCross-process coordination via claim files with zombie detection.
StorageAtomic file read/write with proper-lockfile.
RateLimitPer-account rate-limit tracking with configurable backoff. Created via createRateLimitTrackerForProvider.
ProactiveRefreshQueueBackground token refresh before expiry. Created via createProactiveRefreshForProvider.
ConfigPlugin configuration loading and validation with valibot. Created via createConfigLoaderForProvider.
AuthMigrationOne-time import of existing single-account OAuth creds from OpenCode's auth.json.
AdaptersProvider-specific OAuth adapter definitions (endpoints, client IDs, plan labels).
UITerminal UI primitives (ANSI formatting, confirm dialogs, select menus).
UtilsConfig directory resolution, formatting helpers.

Usage

This package is not intended to be used directly. It is a dependency of the provider-specific plugin packages. Each module exposes a factory function that accepts provider-specific config (endpoints, client IDs, plan labels) and returns a ready-to-use instance.

import { createAccountManagerForProvider } from "opencode-multi-account-core";

export const AccountManager = createAccountManagerForProvider({
  refreshTokenFn: myRefreshToken,
  isTokenExpiredFn: myIsTokenExpired,
});

Architecture

┌─────────────────────────────────────────────────┐
│  anthropic-multi-account / codex-multi-account  │
│  (provider-specific: auth, usage, transforms)   │
├─────────────────────────────────────────────────┤
│          multi-account-core  ← you are here     │
│  AccountStore . AccountManager . Executor        │
│  Claims . Storage . RateLimit . ProactiveRefresh │
│  AuthMigration . Config . Utils . UI . Adapters  │
│  (endpoints, client IDs, plan labels)            │
└─────────────────────────────────────────────────┘

Safety guarantees

  • All disk mutations go through AccountStore with file locking
  • Atomic writes via temp-file-then-rename
  • Concurrent token refresh requests for the same account are deduplicated
  • Circuit breaker: an account is only auto-disabled when at least one other remains usable
  • Dead process claims are automatically released

Keywords

opencode

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts