@open-matrix/core (0.1.6)

Published 2026-07-03 19:39:04 +00:00 by hivecast-admin

Installation

@open-matrix:registry=
npm install @open-matrix/core@0.1.6
"@open-matrix/core": "0.1.6"

About this package

@open-matrix/core

Matrix runtime SDK — actors, Web Components, transports, serialization, and LISP-on-Protocol.

Install

npm install @open-matrix/core

Usage

Headless Actor (daemon-side)

import { MatrixActor } from '@open-matrix/core';

class PingActor extends MatrixActor {
  static accepts = {
    ping: { message: 'string' },
  };
  static emits = {
    pong: { echo: 'string', ts: 'number' },
  };

  onPing(payload: { message: string }) {
    this.emit('pong', { echo: payload.message, ts: Date.now() });
  }
}

Browser Web Component

import { MatrixActorHtmlElement } from '@open-matrix/core';

class StatusPanel extends MatrixActorHtmlElement {
  static accepts = { showStatus: { text: 'string' } };
  static template = `<div id="status"></div>`;
  static styles = `#status { font-family: monospace; padding: 8px; }`;

  onShowStatus(payload: { text: string }) {
    this.shadowRoot!.querySelector('#status')!.textContent = payload.text;
  }
}

customElements.define('status-panel', StatusPanel);

Programmatic Runtime

import { InMemoryBroker, InMemoryTransport, MatrixRuntime } from '@open-matrix/core';

const broker = new InMemoryBroker();
const transport = new InMemoryTransport(broker, { name: 'demo' });
const runtime = new MatrixRuntime({ transport });

What's Included

Category Key Exports
Core MatrixActor, Supervisor, HeadlessComponentRegistry
Framework MatrixActorHtmlElement, MxContract, MxInterface, MxProxy
Runtime MatrixRuntime, HeadlessHost, ConsoleLogger
Transports InMemoryBroker, NatsTransport, FederationTransportAdapter
Messaging TopicRouter, SubscriptionBag, RequestReply
LISP Interpreter, EvalContext, parseSExpr
Serialization serialize, parse, 5-format parity
Flow FlowBuilder, FlowEngine, FlowContext

135 named exports total. Full type declarations included.

Requirements

  • Node.js >= 20
  • TypeScript >= 5.0 (for type checking)

License

MIT

Dependencies

Dependencies

ID Version
@nats-io/nats-core ^3.3.1
@open-matrix/contracts 0.1.5
@open-matrix/federation 0.2.5
@open-matrix/omega-core 0.1.5
morphdom ^2.7.8
nats.ws ^1.30.3

Development Dependencies

ID Version
@types/node ^20.0.0
tsx ^4.15.6
typescript ^5.7.0

Keywords

matrix actors web-components nats runtime sdk
Details
npm
2026-07-03 19:39:04 +00:00
100
MIT
833 KiB
Assets (1)
core-0.1.6.tgz 833 KiB
Versions (10) View all
0.1.10 2026-07-08
0.1.9 2026-07-08
0.1.8 2026-07-08
0.1.7 2026-07-04
0.1.6 2026-07-03