Skip to content

@lastshotlabs/slingshot-chat

npm install @lastshotlabs/slingshot-chat

Chat package factory.

Creates a SlingshotPackageDefinition that mounts the 10 chat entities (Room, RoomMember, Message, ReadReceipt, MessageReaction, Pin, Block, FavoriteRoom, RoomInvite, Reminder), wires adapter-dependent middleware (archiveGuard, broadcastGuard, dmRoomGuard, roomCreatorGrant, memberGrant, messagePostCreate, messageNotify, memberInviteNotify, replyCountUpdate, replyCountDecrement), publishes the ChatInteractionsPeerCap capability, registers push formatters, opportunistically integrates with slingshot-embeds, and starts the two 30-second schedulers (reminders + scheduled messages) plus the WebSocket incoming-event dispatch.

Every adapter ref, middleware closure, scheduler timer, and lazy notification-builder reference is owned by the factory’s closure (Rule 3) — multiple package instances in the same process do not share state.

function createChatPackage(rawConfig: ChatPluginConfig): SlingshotPackageDefinition

Source: packages/slingshot-chat/src/plugin.ts

Source: packages/slingshot-chat/src/public.ts

Plugin state key for slingshot-chat.

Single-sourced constant — no magic string 'slingshot-chat' anywhere in cross-package contracts (cold-start invariant #7).

Source: packages/slingshot-chat/src/state.ts

Public contract for slingshot-chat.

Two layers:

  • ChatEntities — the canonical adapter surface. Each ref names a read-only slice of an entity adapter (Room.getById, Message.list, etc.). Consumers resolve these via requireEntityAdapter(carrier, ref) from @lastshotlabs/slingshot-core. The adapters are published into pluginState by the framework’s package compiler during the package’s setupRoutes phase, so consumers must read in setupPost or per-request handlers.

  • ChatInteractionsPeerCap — the cross-package peer capability used by slingshot-interactions for component-tree resolution and updates. Resolved via ctx.capabilities.require(ChatInteractionsPeerCap).

Source: packages/slingshot-chat/src/public.ts

Source: packages/slingshot-chat/src/public.ts

Source: packages/slingshot-chat/src/public.ts

Thrown when a repository backend operation has not been implemented yet. Replace with actual implementation — do not catch and ignore.

Source: packages/slingshot-chat/src/factories/errors.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

Public contract for slingshot-chat.

Two layers:

  • ChatEntities — the canonical adapter surface. Each ref names a read-only slice of an entity adapter (Room.getById, Message.list, etc.). Consumers resolve these via requireEntityAdapter(carrier, ref) from @lastshotlabs/slingshot-core. The adapters are published into pluginState by the framework’s package compiler during the package’s setupRoutes phase, so consumers must read in setupPost or per-request handlers.

  • ChatInteractionsPeerCap — the cross-package peer capability used by slingshot-interactions for component-tree resolution and updates. Resolved via ctx.capabilities.require(ChatInteractionsPeerCap).

Source: packages/slingshot-chat/src/public.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

Public contract for slingshot-chat.

Two layers:

  • ChatEntities — the canonical adapter surface. Each ref names a read-only slice of an entity adapter (Room.getById, Message.list, etc.). Consumers resolve these via requireEntityAdapter(carrier, ref) from @lastshotlabs/slingshot-core. The adapters are published into pluginState by the framework’s package compiler during the package’s setupRoutes phase, so consumers must read in setupPost or per-request handlers.

  • ChatInteractionsPeerCap — the cross-package peer capability used by slingshot-interactions for component-tree resolution and updates. Resolved via ctx.capabilities.require(ChatInteractionsPeerCap).

Source: packages/slingshot-chat/src/public.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

Source: packages/slingshot-chat/src/encryption/stub.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts

A chat room.

Source: packages/slingshot-chat/src/types.ts