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

@arlopass/adapter-runtime

v0.1.0

Published

Load, host, sandbox, and health-check Arlopass provider adapters. Manages the full lifecycle from manifest validation through sandboxed execution.

Readme

@arlopass/adapter-runtime

Load, host, sandbox, and health-check Arlopass provider adapters. Manages the full lifecycle from manifest validation through sandboxed execution.

import { loadAdapter, AdapterHost } from "@arlopass/adapter-runtime";

const loaded = await loadAdapter(manifestJson, () => new OllamaAdapter(), {
  requireSignatureVerification: false,
});

const host = new AdapterHost();
await host.start();
await host.registerAdapter(loaded);

const health = host.getAdapterHealth("ollama");
console.log(health.state); // "running"

const response = await host.callAdapter("ollama", async (adapter, sandbox) => {
  return adapter.contract.sendMessage("session-1", "Hello");
});

await host.shutdown();

API Reference

AdapterContract

Interface every adapter must implement:

interface AdapterContract {
  readonly manifest: AdapterManifest;
  describeCapabilities(): readonly ProtocolCapability[];
  listModels(): Promise<readonly string[]>;
  createSession(options?: Record<string, unknown>): Promise<string>;
  sendMessage(sessionId: string, message: string): Promise<string>;
  streamMessage(sessionId: string, message: string, onChunk: (chunk: string) => void): Promise<void>;
  healthCheck(): Promise<boolean>;
  shutdown(): Promise<void>;
}

CloudAdapterContractV2

Extended contract for cloud providers with connection lifecycle:

interface CloudAdapterContractV2 extends AdapterContract {
  listConnectionMethods(): readonly ConnectionMethodDescriptor[];
  beginConnect(input: BeginConnectInput): Promise<BeginConnectResult>;
  completeConnect(input: CompleteConnectInput): Promise<CompleteConnectResult>;
  validateCredentialRef(input: ValidateCredentialRefInput): Promise<ValidationResult>;
  revokeCredentialRef(input: RevokeCredentialRefInput): Promise<void>;
  discoverModels(ctx: CloudConnectionContext): Promise<readonly ModelDescriptor[]>;
  discoverCapabilities(ctx: CloudConnectionContext): Promise<CapabilityDescriptor>;
}

isCloudAdapterContractV2(candidate: unknown): boolean — Type guard.


AdapterManifest

Declarative manifest every adapter ships:

type AdapterManifest = {
  schemaVersion: string;                              // "1.0.0"
  providerId: string;
  version: string;
  displayName: string;
  authType: "none" | "api_key" | "oauth2" | "local";
  capabilities: readonly ProtocolCapability[];
  requiredPermissions: readonly string[];
  egressRules: readonly AdapterEgressRule[];
  riskLevel: "low" | "medium" | "high";
  signingKeyId: string;
  connectionMethods?: readonly ConnectionMethodDescriptor[];
  metadata?: Record<string, string>;
}

type AdapterEgressRule = { host: string; port?: number; protocol: "https" | "http" | "tcp" }

| Function | Description | |----------|-------------| | parseAdapterManifest(input: unknown): AdapterManifest | Parse and validate, throws ManifestValidationError | | safeParseAdapterManifest(input: unknown): SafeParseResult<AdapterManifest> | Non-throwing variant | | isAdapterManifest(input: unknown): boolean | Type guard | | parseConnectionMethods(input: unknown, options?): readonly ConnectionMethodDescriptor[] | Parse connection method descriptors |


AdapterHost

Manages running adapters with health checks, restart logic, and sandbox enforcement.

const host = new AdapterHost(options?: AdapterHostOptions);

| Method | Returns | Description | |--------|---------|-------------| | start() | Promise<void> | Start the host runtime | | registerAdapter(loaded) | Promise<void> | Register a loaded adapter | | deregisterAdapter(providerId) | Promise<void> | Remove an adapter | | getAdapterHealth(providerId) | AdapterHealthStatus | Get adapter health | | listAdapterHealth() | readonly AdapterHealthStatus[] | Health of all adapters | | getManifest(providerId) | AdapterManifest | Get adapter manifest | | getSandboxContext(providerId) | SandboxContext | Get sandbox context | | callAdapter(providerId, fn) | Promise<T> | Execute within adapter sandbox | | shutdown() | Promise<void> | Stop all adapters | | isStarted | boolean | Whether host is running |

type AdapterState = "pending" | "starting" | "running" | "degraded" | "stopped" | "failed"

type AdapterHealthStatus = {
  state: AdapterState;
  providerId: string;
  lastHealthCheck?: string;
  restartCount: number;
  error?: string;
}

loadAdapter(manifestInput, factory, options?): Promise<LoadedAdapter>

Load and validate an adapter from its manifest and factory function.

Strict cloud-contract enforcement is opt-in via manifest:

  • If connectionMethods contains one or more descriptors, the contract must satisfy CloudAdapterContractV2, and listConnectionMethods() must match the manifest descriptors exactly.
  • If connectionMethods is omitted (or present but empty), runtime preserves legacy compatibility and only requires AdapterContract.
type LoadedAdapter = {
  providerId: string;
  manifest: AdapterManifest;
  contract: AdapterContract;
}

Artifact Signing

Sign and verify adapter artifacts with Ed25519:

| Function | Description | |----------|-------------| | signArtifact(payload, options): SignedArtifact | Sign an adapter artifact | | verifyArtifactSignature(artifact, options): ArtifactVerificationResult | Verify signature against key resolver | | computeArtifactDigest(content): string | Compute content digest | | parseArtifactSignature(input): ArtifactSignature | Parse a raw signature | | canonicalizeArtifactPayload(artifact): string | Canonical form for signing |

type SignedArtifact = {
  providerId: string;
  version: string;
  digest: string;
  signature: ArtifactSignature;
}

type ArtifactSignature = {
  algorithm: "ed25519";
  keyId: string;
  signedAt: string;
  digest: string;
  value: string;
}

interface ArtifactKeyResolver {
  resolvePublicKey(keyId: string): string | undefined;
}

Error Classes

| Class | Description | |-------|-------------| | RuntimeError | Base class (has code, details) | | ManifestValidationError | Invalid manifest (has field) | | SignatureVerificationError | Artifact signature check failed | | SandboxViolationError | Adapter violated sandbox constraints | | AdapterLoaderError | Failed to load adapter | | AdapterHostError | Host runtime failure |

Error codes are defined in RUNTIME_ERROR_CODES (30+ codes covering manifest, signature, sandbox, loader, and host errors).


Constants

| Constant | Value | |----------|-------| | MANIFEST_SCHEMA_VERSION | "1.0.0" | | ARTIFACT_SIGNATURE_ALGORITHM | "ed25519" | | ADAPTER_AUTH_TYPES | { NONE, API_KEY, OAUTH2, LOCAL } | | ADAPTER_RISK_LEVELS | { LOW, MEDIUM, HIGH } | | ADAPTER_STATE | { PENDING, STARTING, RUNNING, DEGRADED, STOPPED, FAILED } |


Dependencies

  • @arlopass/protocol — Capability model, error taxonomy
  • @arlopass/policy — Permission and egress validation
  • @arlopass/telemetry — Health and performance metrics