@hotmeshio/hotmesh
Version:
Permanent-Memory Workflows & AI Agents
30 lines (29 loc) • 1.1 kB
TypeScript
/**
* Sends a signal payload to any paused workflow thread awaiting this signal.
* This method is commonly used to coordinate between workflows, hook functions,
* and external events.
*
* @example
* // Basic usage - send a simple signal with data
* await MemFlow.workflow.signal('signal-id', { name: 'WarmMash' });
*
* @example
* // Hook function signaling completion
* export async function exampleHook(name: string): Promise<void> {
* const result = await processData(name);
* await MemFlow.workflow.signal('hook-complete', { data: result });
* }
*
* @example
* // Signal with complex data structure
* await MemFlow.workflow.signal('process-complete', {
* status: 'success',
* data: { id: 123, name: 'test' },
* timestamp: new Date().toISOString()
* });
*
* @param {string} signalId - Unique signal identifier that matches a waitFor() call.
* @param {Record<any, any>} data - The payload to send with the signal.
* @returns {Promise<string>} The resulting hook/stream ID.
*/
export declare function signal(signalId: string, data: Record<any, any>): Promise<string>;