Skip to main content
This page documents the core TypeScript types used throughout Gorkie.

Slack Types

SlackMessageContext

The main context object passed to tools and handlers. Contains the Slack client, event data, and bot metadata.
client
WebClient
required
Slack Web API client instance for making API calls
event
SlackMessageEvent
required
The Slack message event that triggered this interaction
botUserId
string
The bot’s user ID in the workspace
teamId
string
The Slack team/workspace ID
import type { SlackEventMiddlewareArgs } from '@slack/bolt';
import type { WebClient } from '@slack/web-api';
import type { SlackFile } from '~/types/slack/file';

export interface SlackMessageContext {
  botUserId?: string;
  client: WebClient;
  event: SlackMessageEvent;
  teamId?: string;
}

SlackMessageEvent

Represents a Slack message event with all relevant metadata.
channel
string
required
Channel ID where the message was sent
ts
string
required
Message timestamp (unique identifier)
event_ts
string
required
Event timestamp
text
string
Message text content
user
string
User ID who sent the message
thread_ts
string
Thread timestamp if message is in a thread
files
SlackFile[]
Array of uploaded files attached to the message
bot_id
string
Bot ID if message was sent by a bot
subtype
string
Message subtype (e.g., ‘bot_message’, ‘file_share’)
channel_type
string
Type of channel (‘channel’, ‘im’, ‘group’)
export interface SlackMessageEvent {
  assistant_thread?: { action_token?: string };
  bot_id?: string;
  channel: string;
  channel_type?: string;
  event_ts: string;
  files?: SlackFile[];
  subtype?: string;
  text?: string;
  thread_ts?: string;
  ts: string;
  user?: string;
}

SlackApp

The Slack app configuration object.
app
App
required
Slack Bolt App instance
socketMode
boolean
required
Whether the app is running in Socket Mode
receiver
ExpressReceiver
Express receiver for HTTP mode (undefined in Socket Mode)
import type { App, ExpressReceiver } from '@slack/bolt';

export interface SlackApp {
  app: App;
  receiver?: ExpressReceiver;
  socketMode: boolean;
}

Database Types

SandboxSession

Represents a persistent sandbox session tied to a Slack thread.
threadId
string
required
Slack thread ID (primary key)
sandboxId
string
required
E2B sandbox instance ID
sessionId
string
required
Session identifier
status
string
required
Current status: ‘creating’, ‘active’, ‘paused’, ‘destroyed’
pausedAt
Date
Timestamp when sandbox was paused
resumedAt
Date
Timestamp when sandbox was resumed
destroyedAt
Date
Timestamp when sandbox was destroyed
createdAt
Date
required
Creation timestamp
updatedAt
Date
required
Last update timestamp
export type SandboxSession = typeof sandboxSessions.$inferSelect;
export type NewSandboxSession = typeof sandboxSessions.$inferInsert;

ScheduledTask

Represents a recurring cron-scheduled task.
id
string
required
Task ID (primary key)
creatorUserId
string
required
User ID who created the task
destinationType
string
required
Destination type: ‘channel’ or ‘dm’
destinationId
string
required
Channel or user ID where results are sent
threadTs
string
Thread timestamp if task posts to a thread
prompt
string
required
Task prompt/instructions
cronExpression
string
required
Cron expression for scheduling
timezone
string
required
IANA timezone for cron scheduling
enabled
boolean
required
Whether task is enabled (default: true)
nextRunAt
Date
required
Next scheduled run time
runningAt
Date
Timestamp when task started running (null if not running)
lastRunAt
Date
Timestamp of last execution
lastStatus
string
Status of last execution: ‘success’ or ‘error’
lastError
string
Error message from last execution if failed
export type ScheduledTask = typeof scheduledTasks.$inferSelect;
export type NewScheduledTask = typeof scheduledTasks.$inferInsert;

AI Tool Types

Tool Input Types

Types for creating and updating streaming task updates.
export interface CreateTaskInput {
  taskId: string;
  title: string;
  details?: string;
  status?: 'pending' | 'in_progress';
}

export interface UpdateTaskInput {
  taskId: string;
  status: 'in_progress' | 'complete' | 'error' | 'pending';
  title?: string;
  details?: string;
  output?: string;
  sources?: TaskSource[];
}

export interface FinishTaskInput {
  taskId: string;
  status: 'complete' | 'error';
  output?: string;
  sources?: TaskSource[];
}

Sandbox Tool Types

Types for sandbox tool execution tracking.
export interface ToolStartInput {
  toolName: string;
  args: unknown;
  status?: string;
}

export interface ToolEndInput {
  toolName: string;
  result: unknown;
  isError: boolean;
}

Stream Types

Stream

Manages streaming updates to Slack messages.
client
WebClient
required
Slack Web API client
channel
string
required
Channel ID where message is being streamed
ts
string
required
Message timestamp being updated
tasks
Map<string, StreamTask>
required
Map of task IDs to their current state
thought
boolean
required
Whether thinking/processing indicator is shown
noop
boolean
If true, stream operations are no-ops (for testing)
export interface Stream {
  channel: string;
  client: WebClient;
  noop?: true;
  tasks: Map<string, StreamTask>;
  thought: boolean;
  ts: string;
}

export interface StreamTask {
  title?: string;
  details?: string;
  output?: string;
  sources?: TaskSource[];
  status: 'in_progress' | 'complete' | 'error' | 'pending';
}

export interface TaskSource {
  type: 'url';
  url: string;
  text: string;
}

Request Types

Request Hints

Context information passed to AI prompts.
interface BaseHints {
  channel: string;
  server: string;
  time: string;
}

export interface ChatRequestHints extends BaseHints {
  activity: string;
  joined: number;
  status: string;
}

export interface SandboxRequestHints extends BaseHints {}

Build docs developers (and LLMs) love