@lastshotlabs/slingshot-interactions
npm install @lastshotlabs/slingshot-interactions
Functions
Section titled “Functions”buttonSchema
Section titled “buttonSchema”Button component schema.
Source: packages/slingshot-interactions/src/components/schema.ts
compileHandlers
Section titled “compileHandlers”Compile declarative handler templates into runtime dispatchers.
function compileHandlers(handlers: Record<string, HandlerTemplate>, deps: { app: Hono<AppEnv>; bus: SlingshotEventBus },): CompiledHandlerTableSource: packages/slingshot-interactions/src/handlers/compile.ts
createInteractionsPackage
Section titled “createInteractionsPackage”Create the interactions package.
Validates rawConfig via interactionsPluginConfigSchema, compiles all
declarative handler templates into dispatchers, and exposes:
POST {mountPath}/dispatch— the bespoke interaction dispatch endpoint.GET /interactionEvents/GET /interactionEvents/:id— entity-generated read routes for the user-scoped audit log (provided by the entity module).
function createInteractionsPackage(rawConfig: unknown): SlingshotPackageDefinitionSource: packages/slingshot-interactions/src/plugin.ts
dispatchInteraction
Section titled “dispatchInteraction”Dispatch a user interaction against the owning message peer.
async function dispatchInteraction(deps: DispatchDeps, request: DispatchRequest, userId: string, requestTenantId: string | null,): Promise<DispatchOutcome>Source: packages/slingshot-interactions/src/handlers/dispatch.ts
validateComponentTree
Section titled “validateComponentTree”Validate an arbitrary value as a component tree.
function validateComponentTree(input: unknown): ComponentTreeSource: packages/slingshot-interactions/src/components/validate.ts
verifyWebhookSignature
Section titled “verifyWebhookSignature”Verify a webhook signature and timestamp to prevent replay attacks.
function verifyWebhookSignature(body: string, signature: string, timestamp: string, secret: string, toleranceMs = TIMESTAMP_TOLERANCE_MS,): booleanSource: packages/slingshot-interactions/src/handlers/dispatchers/webhook.ts
Constants
Section titled “Constants”actionRowSchema
Section titled “actionRowSchema”Action-row schema.
Source: packages/slingshot-interactions/src/components/schema.ts
componentTreeSchema
Section titled “componentTreeSchema”Component-tree schema attached to a message.
Source: packages/slingshot-interactions/src/components/schema.ts
dispatchRequestSchema
Section titled “dispatchRequestSchema”Request schema for the bespoke interactions dispatch route.
Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts
dispatchResultSchema
Section titled “dispatchResultSchema”Dispatcher response schema shared by all handler kinds.
Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts
handlerTemplateSchema
Section titled “handlerTemplateSchema”Declarative handler template used by the interactions package config.
Source: packages/slingshot-interactions/src/handlers/template.ts
InteractionEvent
Section titled “InteractionEvent”Entity definition for persisted interaction-dispatch audit rows.
Source: packages/slingshot-interactions/src/entities/interactionEvent.ts
interactionEventFactories
Section titled “interactionEventFactories”Store-type keyed factories for the InteractionEvent audit entity.
Source: packages/slingshot-interactions/src/entities/factories.ts
interactionEventOperations
Section titled “interactionEventOperations”Generated query operations for interaction audit reads.
Source: packages/slingshot-interactions/src/entities/interactionEvent.ts
Interactions
Section titled “Interactions”Provider-owned package contract for slingshot-interactions.
Source: packages/slingshot-interactions/src/public.ts
INTERACTIONS_PLUGIN_STATE_KEY
Section titled “INTERACTIONS_PLUGIN_STATE_KEY”Stable plugin-state key used in ctx.pluginState.
Source: packages/slingshot-interactions/src/state.ts
interactionsPluginConfigSchema
Section titled “interactionsPluginConfigSchema”Config schema for createInteractionsPackage().
Source: packages/slingshot-interactions/src/config/schema.ts
InteractionsRuntimeCap
Section titled “InteractionsRuntimeCap”Capability handle for the interactions runtime state.
Cross-package consumers resolve it via
ctx.capabilities.require(InteractionsRuntimeCap). The legacy
INTERACTIONS_PLUGIN_STATE_KEY plugin-state slot is still published in
parallel during the bridge period; new consumers should prefer the cap.
Source: packages/slingshot-interactions/src/public.ts
modalSchema
Section titled “modalSchema”Modal payload schema returned by handlers.
Source: packages/slingshot-interactions/src/components/schema.ts
selectMenuSchema
Section titled “selectMenuSchema”Select-menu component schema.
Source: packages/slingshot-interactions/src/components/schema.ts
textInputSchema
Section titled “textInputSchema”Modal text-input schema.
Source: packages/slingshot-interactions/src/components/schema.ts
Interfaces
Section titled “Interfaces”ActionRow
Section titled “ActionRow”Horizontal layout row containing one or more interactive children.
Source: packages/slingshot-interactions/src/components/types.ts
Button
Section titled “Button”Clickable button component embedded in a message.
Source: packages/slingshot-interactions/src/components/types.ts
ChatInteractionsPeer
Section titled “ChatInteractionsPeer”Chat peer implementation contract.
Source: packages/slingshot-interactions/src/peers/types.ts
CommunityInteractionsPeer
Section titled “CommunityInteractionsPeer”Community peer implementation contract.
Source: packages/slingshot-interactions/src/peers/types.ts
CompiledHandlerTable
Section titled “CompiledHandlerTable”Runtime table used to resolve action IDs by longest matching prefix.
Source: packages/slingshot-interactions/src/handlers/contracts.ts
Dispatcher
Section titled “Dispatcher”Dispatcher contract implemented by webhook, route, and queue handlers.
Source: packages/slingshot-interactions/src/handlers/contracts.ts
DispatchOutcome
Section titled “DispatchOutcome”Structured dispatch outcome returned to the route layer and audit writer.
Source: packages/slingshot-interactions/src/handlers/dispatch.ts
InteractionsPeer
Section titled “InteractionsPeer”Peer contract implemented by chat/community owners of component trees.
Source: packages/slingshot-interactions/src/peers/types.ts
InteractionsPluginState
Section titled “InteractionsPluginState”Runtime state published by createInteractionsPackage().
Source: packages/slingshot-interactions/src/state.ts
Modal payload returned by a handler.
Source: packages/slingshot-interactions/src/components/types.ts
SelectMenu
Section titled “SelectMenu”Select-menu component embedded in a message.
Source: packages/slingshot-interactions/src/components/types.ts
TextInput
Section titled “TextInput”Text input used inside modal submissions.
Source: packages/slingshot-interactions/src/components/types.ts
ButtonStyle
Section titled “ButtonStyle”Button presentation styles supported by the component schema.
Source: packages/slingshot-interactions/src/components/types.ts
ComponentTree
Section titled “ComponentTree”Full component tree attached to a message.
Source: packages/slingshot-interactions/src/components/types.ts
DispatchRequest
Section titled “DispatchRequest”Parsed dispatch request payload.
Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts
DispatchResult
Section titled “DispatchResult”Parsed dispatch response payload.
Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts
HandlerTemplate
Section titled “HandlerTemplate”Union of all declarative handler kinds.
Source: packages/slingshot-interactions/src/handlers/template.ts
InteractionResponseStatus
Section titled “InteractionResponseStatus”Semantic statuses recorded in the interaction audit trail.
Source: packages/slingshot-interactions/src/entities/interactionEvent.ts
InteractionsPluginConfig
Section titled “InteractionsPluginConfig”Parsed interactions plugin config with defaults applied.
Source: packages/slingshot-interactions/src/config/types.ts
MessageKind
Section titled “MessageKind”Message kinds that can own an interactive component tree.
Source: packages/slingshot-interactions/src/components/types.ts
QueueHandlerTemplate
Section titled “QueueHandlerTemplate”Event-bus queue handler configuration.
Source: packages/slingshot-interactions/src/handlers/template.ts
RouteHandlerTemplate
Section titled “RouteHandlerTemplate”Internal route handler configuration.
Source: packages/slingshot-interactions/src/handlers/template.ts
SelectMenuKind
Section titled “SelectMenuKind”Select-menu variants supported in v1.
Source: packages/slingshot-interactions/src/components/types.ts
WebhookHandlerTemplate
Section titled “WebhookHandlerTemplate”Remote webhook handler configuration.
Source: packages/slingshot-interactions/src/handlers/template.ts