On this page
Overview
Fans out provider refresh/send operations and aggregates normalized threads/messages.
- Artifact
CommunicationHub.js· esm - Classification
public first party - Availability
Cross-host with injected providers - Normalization
Normalized aggregates; refresh contains per-provider failures.
Import and lifecycle
import * as module from '/arcane/modules/CommunicationHub.js';
refresh fans out provider reads and emits an aggregate event; messages reads one provider and send performs one provider write.
Application-facing behavior: Event/state/reason/error constants; default CommunicationHub; provider enablement, refresh(), messages(), send(), state-free EventTarget/on compatibility, and dispose().
Protocol and host implementation
Injected provider contract + per-realm globalThis.arcaneEvents authority This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
COMMUNICATION_HUB_EVENTS | variable · value | variable COMMUNICATION_HUB_EVENTS | — |
COMMUNICATION_HUB_REFRESH_STATES | variable · value | variable COMMUNICATION_HUB_REFRESH_STATES | — |
COMMUNICATION_HUB_REFRESH_REASONS | variable · value | variable COMMUNICATION_HUB_REFRESH_REASONS | — |
COMMUNICATION_HUB_ERROR_CODES | variable · value | variable COMMUNICATION_HUB_ERROR_CODES | — |
default | default · class | class CommunicationHub extends EventTarget | — |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
CommunicationHub.refresh | public-member | async refresh(options={}) | options={} |
CommunicationHub.messages | public-member | async messages(thread) | thread |
CommunicationHub.send | public-member | async send({providerId,threadId,channel,body,subject='',recipients=[]}={}) | {providerId,threadId,channel,body,subject='',recipients=[]}={} |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
CommunicationHub.constructor | constructor | constructor({providers=[],enabledProviderIds=[]}={}) | {providers=[],enabledProviderIds=[]}={} |
CommunicationHub.addEventListener | method | addEventListener(type,listener,options) | type,listener,options |
CommunicationHub.removeEventListener | method | removeEventListener(type,listener,options) | type,listener,options |
CommunicationHub.on | method | on(type,listener,options) | type,listener,options |
CommunicationHub.dispatchEvent | method | dispatchEvent(value) | value |
CommunicationHub.setEnabled | method | setEnabled(ids=[]) | ids=[] |
CommunicationHub.enabledProviders | method | enabledProviders() | — |
CommunicationHub.refresh | async method | async refresh(options={}) | options={} |
CommunicationHub.messages | async method | async messages(thread) | thread |
CommunicationHub.send | async method | async send({providerId,threadId,channel,body,subject='',recipients=[]}={}) | {providerId,threadId,channel,body,subject='',recipients=[]}={} |
CommunicationHub.dispose | method | dispose() | — |
CommunicationHub.destroy | method | destroy() | — |
Parameter meanings and results
Construct with {providers, enabledProviderIds}. refresh returns {threads, errors}; messages(thread) returns timestamp-sorted CommunicationMessages; send(options) returns the provider result.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- communications-refresh-started
- communications-refresh-completed
- communications-refresh-partially-completed
- communications-refresh-failed
- communications-refresh-cancelled
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- TypeError for an empty body
- registry, entity, and provider errors propagate
- refresh captures per-provider failures in errors
Availability and capabilities
Cross-host with injected providers. Normalized aggregates; refresh contains per-provider failures.
Normalizes injected providers and partial failure without requiring Core.
Contract example
import CommunicationHub from '/arcane/modules/CommunicationHub.js';
const provider={
id:'demo',
label:'Demo',
channels:['other'],
listThreads:async()=>[],
getMessages:async()=>[],
send:async input=>input
};
const hub=new CommunicationHub({providers:[provider],enabledProviderIds:['demo']});
console.log(await hub.refresh());
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.