MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / updateSessionStatus

Method updateSessionStatus

server/src/db/si-db.ts:220–244  ·  view source on GitHub ↗
(
    sessionId: string,
    status: SiSession["status"],
    terminationReason?: string,
    handoffData?: Record<string, unknown>
  )

Source from the content-addressed store, hash-verified

218 }
219
220 async updateSessionStatus(
221 sessionId: string,
222 status: SiSession["status"],
223 terminationReason?: string,
224 handoffData?: Record<string, unknown>
225 ): Promise<SiSession | null> {
226 const result = await query(
227 `UPDATE si_sessions
228 SET status = $2,
229 termination_reason = $3,
230 handoff_data = $4,
231 terminated_at = CASE WHEN $2::VARCHAR IN ('complete', 'timeout', 'error') THEN NOW() ELSE NULL END
232 WHERE session_id = $1
233 RETURNING *`,
234 [
235 sessionId,
236 status,
237 terminationReason || null,
238 handoffData ? JSON.stringify(handoffData) : null,
239 ]
240 );
241
242 if (result.rows.length === 0) return null;
243 return this.deserializeSession(result.rows[0]);
244 }
245
246 async getActiveSessions(hostIdentifier?: string): Promise<SiSession[]> {
247 let sql = "SELECT * FROM si_sessions WHERE status = 'active'";

Callers 4

sendMessageMethod · 0.80
sendMessageStreamMethod · 0.80
terminateSessionMethod · 0.80
createSiHostToolHandlersFunction · 0.80

Calls 2

deserializeSessionMethod · 0.95
queryFunction · 0.85

Tested by

no test coverage detected