Skip to main content

DummyConnector

Local mock connector for development and tests. No network, no backend required. Implements every IConnector capability — including history pagination, GenUI streaming, multi-conversation, file upload, message status, and survey — so the sandbox can demo each feature in isolation.

import { DummyConnector } from "@chativa/connector-dummy";
import { ConnectorRegistry, chatStore } from "@chativa/core";

ConnectorRegistry.register(
new DummyConnector({ replyDelay: 500, connectDelay: 2000 })
);
chatStore.getState().setConnector("dummy");

Options

Schema: schemas/connectors/dummy.schema.json.

FieldDefaultDescription
name"dummy"Override the connector identifier (lets you register multiple dummies side by side).
replyDelay500Milliseconds before the echo reply is returned after a message is sent.
connectDelay2000Milliseconds to wait before connect() resolves — simulates a real handshake. Set to 0 in tests.

Demo helpers

DummyConnector exposes a few non-IConnector helpers for sandbox demos:

MethodPurpose
injectMessage(msg)Push a bot message directly into the UI without going through the extension pipeline.
triggerGenUI(name)Fire one of the demo streams: weather, form, alert, quick-replies, list, table, rating, progress, date-picker, chart, steps, image-gallery, typewriter.

Built-in slash commands recognised by the connector

InputEffect
/disconnectCalls disconnect() — useful for testing reconnect flows.
/genuiTriggers the multi-component demo stream (text + card + form + event).
/genui-weatherStreams a custom weather GenUI component (registered in the sandbox).
/genui-formStreams an appointment form.