Skip to content

@lastshotlabs/slingshot-interactions

npm install @lastshotlabs/slingshot-interactions

Button component schema.

Source: packages/slingshot-interactions/src/components/schema.ts

Compile declarative handler templates into runtime dispatchers.

function compileHandlers(handlers: Record<string, HandlerTemplate>, deps: { app: Hono<AppEnv>; bus: SlingshotEventBus },): CompiledHandlerTable

Source: packages/slingshot-interactions/src/handlers/compile.ts

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): SlingshotPackageDefinition

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

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

Validate an arbitrary value as a component tree.

function validateComponentTree(input: unknown): ComponentTree

Source: packages/slingshot-interactions/src/components/validate.ts

Verify a webhook signature and timestamp to prevent replay attacks.

function verifyWebhookSignature(body: string, signature: string, timestamp: string, secret: string, toleranceMs = TIMESTAMP_TOLERANCE_MS,): boolean

Source: packages/slingshot-interactions/src/handlers/dispatchers/webhook.ts

Action-row schema.

Source: packages/slingshot-interactions/src/components/schema.ts

Component-tree schema attached to a message.

Source: packages/slingshot-interactions/src/components/schema.ts

Request schema for the bespoke interactions dispatch route.

Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts

Dispatcher response schema shared by all handler kinds.

Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts

Declarative handler template used by the interactions package config.

Source: packages/slingshot-interactions/src/handlers/template.ts

Entity definition for persisted interaction-dispatch audit rows.

Source: packages/slingshot-interactions/src/entities/interactionEvent.ts

Store-type keyed factories for the InteractionEvent audit entity.

Source: packages/slingshot-interactions/src/entities/factories.ts

Generated query operations for interaction audit reads.

Source: packages/slingshot-interactions/src/entities/interactionEvent.ts

Provider-owned package contract for slingshot-interactions.

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

Stable plugin-state key used in ctx.pluginState.

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

Config schema for createInteractionsPackage().

Source: packages/slingshot-interactions/src/config/schema.ts

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

Modal payload schema returned by handlers.

Source: packages/slingshot-interactions/src/components/schema.ts

Select-menu component schema.

Source: packages/slingshot-interactions/src/components/schema.ts

Modal text-input schema.

Source: packages/slingshot-interactions/src/components/schema.ts

Horizontal layout row containing one or more interactive children.

Source: packages/slingshot-interactions/src/components/types.ts

Clickable button component embedded in a message.

Source: packages/slingshot-interactions/src/components/types.ts

Chat peer implementation contract.

Source: packages/slingshot-interactions/src/peers/types.ts

Community peer implementation contract.

Source: packages/slingshot-interactions/src/peers/types.ts

Runtime table used to resolve action IDs by longest matching prefix.

Source: packages/slingshot-interactions/src/handlers/contracts.ts

Dispatcher contract implemented by webhook, route, and queue handlers.

Source: packages/slingshot-interactions/src/handlers/contracts.ts

Structured dispatch outcome returned to the route layer and audit writer.

Source: packages/slingshot-interactions/src/handlers/dispatch.ts

Peer contract implemented by chat/community owners of component trees.

Source: packages/slingshot-interactions/src/peers/types.ts

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

Select-menu component embedded in a message.

Source: packages/slingshot-interactions/src/components/types.ts

Text input used inside modal submissions.

Source: packages/slingshot-interactions/src/components/types.ts

Button presentation styles supported by the component schema.

Source: packages/slingshot-interactions/src/components/types.ts

Full component tree attached to a message.

Source: packages/slingshot-interactions/src/components/types.ts

Parsed dispatch request payload.

Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts

Parsed dispatch response payload.

Source: packages/slingshot-interactions/src/routes/dispatchRoute.schema.ts

Union of all declarative handler kinds.

Source: packages/slingshot-interactions/src/handlers/template.ts

Semantic statuses recorded in the interaction audit trail.

Source: packages/slingshot-interactions/src/entities/interactionEvent.ts

Parsed interactions plugin config with defaults applied.

Source: packages/slingshot-interactions/src/config/types.ts

Message kinds that can own an interactive component tree.

Source: packages/slingshot-interactions/src/components/types.ts

Event-bus queue handler configuration.

Source: packages/slingshot-interactions/src/handlers/template.ts

Internal route handler configuration.

Source: packages/slingshot-interactions/src/handlers/template.ts

Select-menu variants supported in v1.

Source: packages/slingshot-interactions/src/components/types.ts

Remote webhook handler configuration.

Source: packages/slingshot-interactions/src/handlers/template.ts