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

@openmaxai/openmax-agent-sdk

v1.0.3

Published

CWS agent runtime SDK — cws-comm protocol layer (WS/auth/heartbeat/reconnect, sync, message codec, tm/kb/as/comm/core/conn service clients) extracted from zylos-openmax; consumed by runtime adapters.

Readme

@openmaxai/openmax-agent-sdk

CWS agent runtime SDK — the cws-comm protocol layer extracted from zylos-openmax, so a Node.js agent runtime (Claude Code, Codex, OpenClaw) can connect to COCO Workspace without depending on Zylos internals.

Scope of this package. This is a Node.js / ESM SDK. It serves Node runtimes and their thin Node adapters — it is not the cross-language protocol contract. A non-Node runtime (e.g. a Python/Hermes SDK) does not consume this package; it re-implements the same wire protocol against the canonical, language-neutral contract in schemas/v1/ + fixtures/v1/ (see CONTRACT.md). Treat the JS types/shapes here as one conformant implementation, not as the source of truth for other languages.

Design: 协议归协议、runtime 归 runtime. This package is Layer 1 (shared protocol) for Node. Runtime-specific bridging lives in thin Layer 2 adapter repos (*-openmax) that import this SDK. Mirrors the @coco-xyz/hxa-connect-sdk + adapter precedent.

Installation

npm i @openmaxai/openmax-agent-sdk

1.0.0 is the first stable release. A bare npm i @openmaxai/openmax-agent-sdk resolves it via the latest dist-tag. Pre-1.0 alphas remain available under the alpha dist-tag for history.

Cutting a new version? See RELEASING.md for the exact files to bump and the release flow.

In the SDK (generic CWS + agent-level concerns):

  • transport/WsClient (auth, heartbeat, client keepalive-ping + frame-watchdog, exponential-backoff reconnect, 4001–4006 close-code handling), HTTP client (native fetch + auth), CF-Access headers, token/identity management.
  • protocol/ — frame dispatch, message codec (CWS message ↔ neutral shape), access policy, system-message handling.
  • sync/SyncEngine (/sync gap catch-up) + inbox-ledger (dedup + contiguous ack).
  • services/tm / kb / as / comm / core / conn service clients over the cws-core REST API.
  • reporters/ — agent-level online-report + runtime metrics (+ cgroup resources, billing status). (No channel-liveness — that is Zylos-specific, see below.)
  • identity/ — agent-domain resolution, self-name hydration.
  • orchestrator.js — a single instantiable class that wires the above (the protocol orchestration currently inlined in comm-bridge.js).
  • providers.js — injection interfaces so the SDK never touches a runtime's filesystem/process manager directly.

NOT in the SDK (Zylos/openmax adapter-only, owner decision 2026-07-17):

  • channel-liveness — enumerating the 13 IM-channel components' pm2 status. Not done here at all.
  • the 13 IM channels — install / management / connection (channel-connector), which are coupled to pm2 + the zylos CLI.

These stay entirely inside the zylos-openmax adapter.

Providers (dependency injection)

The SDK is environment-agnostic. A runtime adapter supplies:

  • StorageProvider — read/write config + cached credentials (no hard-coded ~/zylos paths).
  • RuntimeStateProvider — runtime metrics/state for the online + metrics reporters.
  • InboundDelivery — the core translation point: deliver an inbound CWS message into the runtime's context (Cat.A native channel, or Cat.B /wake).
  • Logger — structured logging sink.

Each provider has a safe no-op/degraded default.

Orchestrator — the integration surface

CwsAgentBridge (src/orchestrator.js) is the one class an adapter instantiates. It composes every module above into a working agent: per-org WS lifecycle (open → first-connect initSyncSeq or reconnect catch-up → seed inbox-ledger → arm reporters → self-name hydration barrier), the protocol-generic inbound pipeline (dedupe → fetch detail → normalize → access-policy decideInboundInboundDelivery.deliver), frame dispatch, ledger↔sync-engine wiring, and protocol-generic system-frame handling.

const bridge = new CwsAgentBridge({
  http,                       // CwsHttpClient
  tokenManager,               // TokenManager (mints ws-tickets; optional in tests)
  ws: { baseUrl, reconnectMaxMs, heartbeatIntervalMs, pingIntervalMs, deviceId, clientVersion },
  orgConfigs,                 // [{ org_id, self, owner, access }] — orgs are keyed by org_id
  providers: { storage, runtimeState, inbound, logger },   // inbound is the required seam
  callbacks: { /* adapter seams, all optional — see below */ },
  reporters: { metrics, metricsIntervalMs, version },
});
await bridge.start();         // bootstrap tokens + self-name, open WS pool, arm reporters
await bridge.send(endpoint, content, { orgId, replyTo });   // outbound reply → cws-core
await bridge.stop();          // disarm all timers, close every WS + ledger, no leaks

Required: providers.inbound.deliver(msg, endpoint, priority) — the SDK hands it a normalized InboundMessage after access policy; the adapter does the actual runtime bridging (Cat.A native channel / Cat.B POST /wake). INVARIANT: resolve {ok:true} only once the message genuinely entered the runtime context (a false ack loses the message — the ledger//sync retry stops).

Adapter callbacks (seams the SDK never implements): loadSession/saveSession (sync cursor), loadConfig/syncSelf (self-name hydration inputs), fetchMemberOwner (sibling-agent DM exemption), onOwnerBind/onOwnerNameHint (owner hints → config), onConfigEvent (agent.config.*adapter persists, SDK does not), onSystemNotice (policy-gated recall/edit → adapter formats + delivers), onConnectionEvent/onChannelEvent (connection/channel frames → adapter), onOrgTerminated/onAllOrgsTerminated.

Still adapter-owned (behind InboundDelivery / callbacks): C4 forwarding + formatInboundForC4 + work-reference formatting, media download, group-history/context assembly, quoted-message expansion, receive-reactions/typing, config.json persistence, pm2 channel install/liveness, auto-upgrade, the argv CLI shells, and dashboard/api-key provisioning. The orchestrator.js header block enumerates the full contract.

Protocol contract (canonical, language-neutral)

The source of truth for the wire protocol is not this JS code — it is the versioned, language-neutral contract that ships alongside it:

  • schemas/v1/ — JSON Schema (draft 2020-12) for each protocol surface: frame, inbound-message, wake-request, wake-result, failure-class, plus the auth-lifecycle.md state machine. Each schema is $id- and version-tagged.
  • fixtures/v1/ — shared golden {input, expected} fixtures (frame/system-event classification, normalized inbound messages, wake req/result). Passing this corpus is the definition of "protocol-conformant" in any language.

This JS SDK is one conformant implementation. test/contract.test.js feeds the fixtures through the real SDK (classifyFrame / classifySystemEvent / the full CwsAgentBridge inbound pipeline) and validates the output against the schemas — so any drift between the code and the contract fails the build. A future Python/Hermes SDK runs the identical fixtures against the identical schemas. See CONTRACT.md for the full contract and its flagged looseness.

Language

Plain JavaScript / ESM, no build step (matches zylos-openmax; owner decision 2026-07-17 — TS and JS are runtime-identical). Optional hand-written types/*.d.ts may be added later for consumer type hints without adopting a TS build.

This package targets Node.js only (see engines.node >= 20). It is not published for, nor consumable by, other language runtimes — those bind to the wire protocol directly. The plan for a shared, language-neutral contract is in CONTRACT.md.

Status

1.0.0first stable release. Phase A extraction complete: transport, protocol, sync, services (tm/kb/as/comm/core/conn), reporters (agent-level), identity, and the CwsAgentBridge orchestrator, plus the canonical schemas/v1/ + fixtures/v1/ protocol contract with a self-verifying conformance test — full suite green via node --test, 0 coupling to Zylos internals. Next: Phase B — refactor zylos-openmax to consume this SDK, then int→prod parity verification (WS keepalive/watchdog focus). See the design doc for the full module map, cut line, wake contract, and migration phasing.