Bot
Classes
Classes
GatewayServer
Gateway server for FlowState Bot
Constructor
constructor(config?: FlowStateBotConfig | undefined)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | FlowStateBotConfig | undefined | No |
Methods
getState
Get current state
getState(): GatewayState
Returns:
GatewayState -
setMessageHandler
Set message handler
setMessageHandler(handler: MessageHandler): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
handler | MessageHandler | Yes |
start
Start the gateway
start(): Promise<void>
Returns:
Promise<void> -
stop
Stop the gateway
stop(): Promise<void>
Returns:
Promise<void> -
reload
Reload configuration
reload(): Promise<void>
Returns:
Promise<void> -
sendMessage
Send a message
sendMessage(message: OutboundMessage): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | OutboundMessage | Yes |
Returns:
Promise<void> -
AgentHandler
Agent for handling messages and generating responses
Constructor
constructor(config?: AgentConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | AgentConfig | No |
Methods
handleMessage
Handle an incoming message and generate a response
handleMessage(message: InboundMessage): Promise<OutboundMessage | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | InboundMessage | Yes |
Returns:
Promise<OutboundMessage \| null> -
clearContext
Clear context for a conversation
clearContext(channel: string, identifier: string): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | Yes | |
identifier | string | Yes |
FlowStateCLIWrapper
FlowState CLI wrapper class
Constructor
constructor(options?: { cwd?: string; env?: Record<string, string>; })
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | { cwd?: string; env?: Record<string, string>; } | No |
Methods
init
Initialize a new FlowState project
init(projectPath?: string | undefined): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectPath | string | undefined | No |
Returns:
Promise<CLICommandResult> -
doctor
Run the doctor command
doctor(): Promise<CLICommandResult>
Returns:
Promise<CLICommandResult> -
serverStart
Start the server
serverStart(): Promise<CLICommandResult>
Returns:
Promise<CLICommandResult> -
serverStop
Stop the server
serverStop(): Promise<CLICommandResult>
Returns:
Promise<CLICommandResult> -
serverStatus
Get server status
serverStatus(): Promise<CLICommandResult>
Returns:
Promise<CLICommandResult> -
scanTodos
Scan for TODOs in codebase
scanTodos(path?: string | undefined): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | undefined | No |
Returns:
Promise<CLICommandResult> -
link
Link a project
link(projectPath?: string | undefined): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectPath | string | undefined | No |
Returns:
Promise<CLICommandResult> -
auth
Authenticate
auth(provider?: string | undefined): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
provider | string | undefined | No |
Returns:
Promise<CLICommandResult> -
obs
Run observability commands
obs(subcommand: string, args?: string[]): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
subcommand | string | Yes | |
args | string[] | No |
Returns:
Promise<CLICommandResult> -
createApp
Create an app
createApp(name: string, template?: string | undefined): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
template | string | undefined | No |
Returns:
Promise<CLICommandResult> -
run
Run any arbitrary flowstate command
run(args: string[]): Promise<CLICommandResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
args | string[] | Yes |
Returns:
Promise<CLICommandResult> -
LLMClient
Client for communicating with Anthropic Claude API
Constructor
constructor(config?: LLMClientConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | LLMClientConfig | No |
Methods
isConfigured
Check if API key is configured
isConfigured(): boolean
Returns:
boolean -
setSystemPrompt
Set system prompt
setSystemPrompt(prompt: string): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes |
chat
Chat with the model
chat(messages: Message[], options?: { systemPrompt?: string; maxTokens?: number; temperature?: number; }): Promise<LLMResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
messages | Message[] | Yes | |
options | { systemPrompt?: string; maxTokens?: number; temperature?: number; } | No |
Returns:
Promise<LLMResponse> -
complete
Simple single-turn completion
complete(prompt: string, options?: { systemPrompt?: string; maxTokens?: number; }): Promise<LLMResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | |
options | { systemPrompt?: string; maxTokens?: number; } | No |
Returns:
Promise<LLMResponse> -
MCPClient
Client for communicating with the FlowState MCP HTTP server
Constructor
constructor(config?: MCPClientConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | MCPClientConfig | No |
Methods
isAvailable
Check if MCP server is available
isAvailable(): Promise<boolean>
Returns:
Promise<boolean> -
listTools
List available tools
listTools(): Promise<string[]>
Returns:
Promise<string[]> -
callTool
Call a tool
callTool(name: string, args: Record<string, unknown>): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
args | Record<string, unknown> | Yes |
Returns:
Promise<MCPToolResult> -
executeWorkflow
Execute a workflow
executeWorkflow(workflowId: string, inputs?: Record<string, unknown> | undefined): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
workflowId | string | Yes | |
inputs | Record<string, unknown> | undefined | No |
Returns:
Promise<MCPToolResult> -
getTaskStatus
Get task status
getTaskStatus(taskId: string): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
taskId | string | Yes |
Returns:
Promise<MCPToolResult> -
listWorkspaces
List workspaces
listWorkspaces(): Promise<MCPToolResult>
Returns:
Promise<MCPToolResult> -
createWorkspace
Create a workspace
createWorkspace(name: string, description?: string | undefined): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
description | string | undefined | No |
Returns:
Promise<MCPToolResult> -
listProjects
List projects
listProjects(workspaceId?: string | undefined): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | undefined | No |
Returns:
Promise<MCPToolResult> -
createTask
Create a task
createTask(params: { title: string; description?: string; projectId?: string; priority?: string; status?: string; }): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { title: string; description?: string; projectId?: string; priority?: string; status?: string; } | Yes |
Returns:
Promise<MCPToolResult> -
searchTasks
Search tasks
searchTasks(query: string): Promise<MCPToolResult>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes |
Returns:
Promise<MCPToolResult> -
MemoryManager
Constructor
constructor(config: MemoryManagerConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | MemoryManagerConfig | Yes |
Methods
index
Index all configured sources
index(): Promise<{ files: number; chunks: number; }>
Returns:
Promise<{ files: number; chunks: number; }> -
search
Search memory using hybrid approach
search(query: string): Promise<SearchResult[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes |
Returns:
Promise<SearchResult[]> -
getChunk
Get content for a specific chunk
getChunk(id: string): Chunk | null
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Returns:
Chunk \| null -
getStats
Get index statistics
getStats(): IndexStats
Returns:
IndexStats -
needsReindex
Check if index needs rebuilding
needsReindex(): Promise<boolean>
Returns:
Promise<boolean> -
close
Close the manager and release resources
close(): void
SessionStore
Constructor
constructor(baseDir: string)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
baseDir | string | Yes |
Methods
appendEntry
Append an entry to a session
appendEntry(sessionKey: string, entry: SessionEntry): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionKey | string | Yes | |
entry | SessionEntry | Yes |
Returns:
Promise<void> -
loadSession
Load all entries for a session
loadSession(sessionKey: string): Promise<SessionEntry[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionKey | string | Yes |
Returns:
Promise<SessionEntry[]> -
getRecentEntries
Get recent entries from a session
getRecentEntries(sessionKey: string, limit: number): Promise<SessionEntry[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionKey | string | Yes | |
limit | number | Yes |
Returns:
Promise<SessionEntry[]> -
listSessions
List all sessions
listSessions(): Promise<SessionMetadata[]>
Returns:
Promise<SessionMetadata[]> -
getSessionMetadata
Get session metadata
getSessionMetadata(sessionKey: string): Promise<SessionMetadata | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionKey | string | Yes |
Returns:
Promise<SessionMetadata \| null> -
toMessages
Convert session entries to LLM message format
toMessages(entries: SessionEntry[]): { role: "user" | "assistant"; content: string; }[]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
entries | SessionEntry[] | Yes |
Returns:
{ role: "user" \| "assistant"; content: string; }[] -
DiscordAgentManager
Constructor
constructor(config: DiscordAgentConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | DiscordAgentConfig | Yes |
Methods
initialize
initialize(): Promise<void>
Returns:
Promise<void> -
handleMessage
Handle an incoming Discord message
handleMessage(message: DiscordInboundMessage): Promise<string | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | DiscordInboundMessage | Yes |
Returns:
Promise<string \| null> -
sendResponse
Send a response to a Discord channel
sendResponse(message: DiscordInboundMessage, response: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | DiscordInboundMessage | Yes | |
response | string | Yes |
Returns:
Promise<void> -
getSession
Get session info for a channel
getSession(channelId: string, threadId?: string | undefined): DiscordSession | undefined
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
threadId | string | undefined | No |
Returns:
DiscordSession \| undefined -
listSessions
List all active sessions
listSessions(): DiscordSession[]
Returns:
DiscordSession[] -
clearSession
Clear session history
clearSession(channelId: string, threadId?: string | undefined): Promise<boolean>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
threadId | string | undefined | No |
Returns:
Promise<boolean> -
getHistory
Get chat history for a session
getHistory(channelId: string, threadId?: string | undefined, limit?: number | undefined): Promise<DiscordMessage[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
threadId | string | undefined | No | |
limit | number | undefined | No |
Returns:
Promise<DiscordMessage[]> -
close
Close and cleanup
close(): void
DiscordClient
Constructor
constructor(config: DiscordConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | DiscordConfig | Yes |
Methods
connect
connect(): Promise<void>
Returns:
Promise<void> -
disconnect
disconnect(): Promise<void>
Returns:
Promise<void> -
getState
getState(): DiscordClientState
Returns:
DiscordClientState -
sendMessage
sendMessage(options: DiscordSendOptions): Promise<Message<boolean>>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | DiscordSendOptions | Yes |
Returns:
Promise<Message<boolean>> -
editMessage
editMessage(channelId: string, messageId: string, content: string): Promise<Message<boolean>>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
messageId | string | Yes | |
content | string | Yes |
Returns:
Promise<Message<boolean>> -
deleteMessage
deleteMessage(channelId: string, messageId: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
messageId | string | Yes |
Returns:
Promise<void> -
addReaction
addReaction(channelId: string, messageId: string, emoji: string): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
messageId | string | Yes | |
emoji | string | Yes |
Returns:
Promise<void> -
removeReaction
removeReaction(channelId: string, messageId: string, emoji: string, userId?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
messageId | string | Yes | |
emoji | string | Yes | |
userId | string | undefined | No |
Returns:
Promise<void> -
getGuild
getGuild(guildId: string): Promise<GuildInfo | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes |
Returns:
Promise<GuildInfo \| null> -
listGuilds
listGuilds(): Promise<GuildInfo[]>
Returns:
Promise<GuildInfo[]> -
getChannels
getChannels(guildId: string): Promise<ChannelInfo[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes |
Returns:
Promise<ChannelInfo[]> -
getRoles
getRoles(guildId: string): Promise<RoleInfo[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes |
Returns:
Promise<RoleInfo[]> -
getMember
getMember(guildId: string, userId: string): Promise<MemberInfo | null>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
userId | string | Yes |
Returns:
Promise<MemberInfo \| null> -
getMembers
getMembers(guildId: string, options?: { limit?: number; } | undefined): Promise<MemberInfo[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
options | { limit?: number; } | undefined | No |
Returns:
Promise<MemberInfo[]> -
createChannel
createChannel(options: CreateChannelOptions): Promise<ChannelInfo>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | CreateChannelOptions | Yes |
Returns:
Promise<ChannelInfo> -
deleteChannel
deleteChannel(channelId: string, reason?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
reason | string | undefined | No |
Returns:
Promise<void> -
updateChannel
updateChannel(channelId: string, options: Partial<{ name: string; topic: string; position: number; parentId: string | null; }>): Promise<ChannelInfo>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
options | Partial<{ name: string; topic: string; position: number; parentId: string | null; }> | Yes |
Returns:
Promise<ChannelInfo> -
createRole
createRole(options: CreateRoleOptions): Promise<RoleInfo>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | CreateRoleOptions | Yes |
Returns:
Promise<RoleInfo> -
deleteRole
deleteRole(guildId: string, roleId: string, reason?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
roleId | string | Yes | |
reason | string | undefined | No |
Returns:
Promise<void> -
updateRole
updateRole(guildId: string, roleId: string, options: Partial<{ name: string; color: number; permissions: bigint; hoist: boolean; mentionable: boolean; }>): Promise<RoleInfo>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
roleId | string | Yes | |
options | Partial<{ name: string; color: number; permissions: bigint; hoist: boolean; mentionable: boolean; }> | Yes |
Returns:
Promise<RoleInfo> -
modifyMember
modifyMember(options: ModifyMemberOptions): Promise<MemberInfo>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | ModifyMemberOptions | Yes |
Returns:
Promise<MemberInfo> -
kickMember
kickMember(guildId: string, userId: string, reason?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
userId | string | Yes | |
reason | string | undefined | No |
Returns:
Promise<void> -
banMember
banMember(guildId: string, userId: string, options?: { reason?: string; deleteMessageDays?: number; } | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
userId | string | Yes | |
options | { reason?: string; deleteMessageDays?: number; } | undefined | No |
Returns:
Promise<void> -
unbanMember
unbanMember(guildId: string, userId: string, reason?: string | undefined): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
guildId | string | Yes | |
userId | string | Yes | |
reason | string | undefined | No |
Returns:
Promise<void> -
on
on(event: DiscordEventType, handler: (event: DiscordEvent) => void): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
event | DiscordEventType | Yes | |
handler | (event: DiscordEvent) => void | Yes |
off
off(event: DiscordEventType, handler: (event: DiscordEvent) => void): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
event | DiscordEventType | Yes | |
handler | (event: DiscordEvent) => void | Yes |
DiscordGateway
Constructor
constructor(config: DiscordGatewayConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | DiscordGatewayConfig | Yes |
Methods
start
Start the Discord gateway
start(): Promise<void>
Returns:
Promise<void> -
stop
Stop the Discord gateway
stop(): Promise<void>
Returns:
Promise<void> -
getState
Get gateway state
getState(): DiscordGatewayState
Returns:
DiscordGatewayState -
listSessions
List active sessions
listSessions(): import("/Users/sthornock/code/epic/epic-flowstate/packages/flowstate-bot/src/channels/discord/agent-integration").DiscordSession[]
Returns:
import("/Users/sthornock/code/epic/epic-flowstate/packages/flowstate-bot/src/channels/discord/agent-integration").DiscordSession[] -
getSessionHistory
Get session history
getSessionHistory(channelId: string, threadId?: string | undefined, limit?: number | undefined): Promise<import("/Users/sthornock/code/epic/epic-flowstate/packages/flowstate-bot/src/channels/discord/agent-integration").DiscordMessage[] | never[]>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
threadId | string | undefined | No | |
limit | number | undefined | No |
Returns:
Promise<import("/Users/sthornock/code/epic/epic-flowstate/packages/flowstate-bot/src/channels/discord/agent-integration").DiscordMessage[] \| never[]> -
clearSession
Clear a session
clearSession(channelId: string, threadId?: string | undefined): Promise<boolean>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | |
threadId | string | undefined | No |
Returns:
Promise<boolean> -
DiscordMonitor
Constructor
constructor(options: DiscordMonitorConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | DiscordMonitorConfig | Yes |
Methods
start
start(): void
stop
stop(): void
isRunning
isRunning(): boolean
Returns:
boolean -
SignalClient
Signal client class for managing connections
Constructor
constructor(options: SignalClientOptions)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | SignalClientOptions | Yes |
Methods
rpc
Make an RPC request
rpc(method: string, params?: Record<string, unknown> | undefined): Promise<T>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
method | string | Yes | |
params | Record<string, unknown> | undefined | No |
Returns:
Promise<T> -
check
Check if signal-cli is running
check(): Promise<{ ok: boolean; error?: string | null; }>
Returns:
Promise<{ ok: boolean; error?: string \| null; }> -
listAccounts
Get registered accounts
listAccounts(): Promise<string[]>
Returns:
Promise<string[]> -
send
Send a message
send(params: { account: string; recipients?: string[]; groupId?: string; message: string; attachments?: string[]; quoteTimestamp?: number; quoteAuthor?: string; mentions?: Array<{ start: number; length: number; uuid: string; }>; }): Promise<{ timestamp: number; }>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { account: string; recipients?: string[]; groupId?: string; message: string; attachments?: string[]; quoteTimestamp?: number; quoteAuthor?: string; mentions?: Array<{ start: number; length: number; uuid: string; }>; } | Yes |
Returns:
Promise<{ timestamp: number; }> -
sendReaction
Send a reaction
sendReaction(params: { account: string; recipient?: string; groupId?: string; emoji: string; targetAuthor: string; targetTimestamp: number; remove?: boolean; }): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { account: string; recipient?: string; groupId?: string; emoji: string; targetAuthor: string; targetTimestamp: number; remove?: boolean; } | Yes |
Returns:
Promise<void> -
sendTyping
Send typing indicator
sendTyping(params: { account: string; recipient?: string; groupId?: string; stop?: boolean; }): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { account: string; recipient?: string; groupId?: string; stop?: boolean; } | Yes |
Returns:
Promise<void> -
sendReceipt
Send read receipt
sendReceipt(params: { account: string; recipient: string; targetTimestamps: number[]; type?: "read" | "viewed"; }): Promise<void>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
params | { account: string; recipient: string; targetTimestamps: number[]; type?: "read" | "viewed"; } | Yes |
Returns:
Promise<void> -
SignalDaemon
Signal daemon process wrapper
Constructor
constructor(options: SignalDaemonOptions)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | SignalDaemonOptions | Yes |
Methods
getBaseUrl
Get the HTTP base URL
getBaseUrl(): string
Returns:
string -
isRunning
Check if daemon is running
isRunning(): Promise<boolean>
Returns:
Promise<boolean> -
start
Start the signal-cli daemon
start(): Promise<void>
Returns:
Promise<void> -
stop
Stop the daemon
stop(): Promise<void>
Returns:
Promise<void> -
SignalMonitor
Signal monitor for handling incoming events
Constructor
constructor(options: SignalMonitorOptions)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
options | SignalMonitorOptions | Yes |
Methods
start
Start monitoring Signal events
start(): Promise<void>
Returns:
Promise<void> -
stop
Stop monitoring
stop(): Promise<void>
Returns:
Promise<void> -
getClient
Get the Signal client
getClient(): SignalClient | null
Returns:
SignalClient \| null -
SqliteStorage
Constructor
constructor(config: SqliteStorageConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | SqliteStorageConfig | Yes |
Methods
upsertChunk
Insert or update a chunk
upsertChunk(chunk: Chunk): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
chunk | Chunk | Yes |
upsertChunks
Batch insert chunks
upsertChunks(chunks: Chunk[]): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
chunks | Chunk[] | Yes |
getChunk
Get chunk by ID
getChunk(id: string): Chunk | null
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Returns:
Chunk \| null -
getChunksByPath
Get all chunks for a path
getChunksByPath(path: string): Chunk[]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes |
Returns:
Chunk[] -
deleteChunksByPath
Delete chunks for a path
deleteChunksByPath(path: string): number
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes |
Returns:
number -
keywordSearch
Keyword search using FTS5
keywordSearch(query: string, limit?: number): { id: string; path: string; startLine: number; endLine: number; snippet: string; score: number; }[]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | |
limit | number | No |
Returns:
{ id: string; path: string; startLine: number; endLine: number; snippet: string; score: number; }[] -
vectorSearch
Vector similarity search Note: For production, use sqlite-vec extension This is a fallback using in-memory computation
vectorSearch(queryEmbedding: number[], limit?: number): { id: string; path: string; startLine: number; endLine: number; snippet: string; score: number; }[]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
queryEmbedding | number[] | Yes | |
limit | number | No |
Returns:
{ id: string; path: string; startLine: number; endLine: number; snippet: string; score: number; }[] -
cacheEmbedding
Cache an embedding
cacheEmbedding(contentHash: string, embedding: number[], provider: string, model: string): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
contentHash | string | Yes | |
embedding | number[] | Yes | |
provider | string | Yes | |
model | string | Yes |
getCachedEmbedding
Get cached embedding
getCachedEmbedding(contentHash: string): number[] | null
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
contentHash | string | Yes |
Returns:
number[] \| null -
getStats
Get index statistics
getStats(): IndexStats
Returns:
IndexStats -
setLastIndexed
Set last indexed timestamp
setLastIndexed(date?: Date): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
date | Date | No |
close
Close database connection
close(): void