({ sessionId, toNodeId, msgType, payload } = {})
| 55 | } |
| 56 | |
| 57 | sendMessage({ sessionId, toNodeId, msgType, payload } = {}) { |
| 58 | if (!sessionId) throw new Error('sessionId is required'); |
| 59 | |
| 60 | const safePayload = payload && typeof payload === 'object' ? payload : {}; |
| 61 | const serialized = JSON.stringify(safePayload); |
| 62 | if (serialized.length > 16000) throw new Error('payload too large (max 16KB)'); |
| 63 | |
| 64 | return this.store.send({ |
| 65 | type: 'session_message', |
| 66 | payload: { |
| 67 | session_id: sessionId, |
| 68 | to_node_id: toNodeId || null, |
| 69 | msg_type: msgType || 'context_update', |
| 70 | payload: safePayload, |
| 71 | sent_at: new Date().toISOString(), |
| 72 | }, |
| 73 | priority: 'normal', |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | delegateSubtask({ sessionId, toNodeId, title, description, role } = {}) { |
| 78 | if (!sessionId) throw new Error('sessionId is required'); |
no test coverage detected