MCPcopy Create free account
hub / github.com/Noumena-Network/code / archiveBridgeSession

Function archiveBridgeSession

src/bridge/createSession.ts:263–302  ·  view source on GitHub ↗
(
  sessionId: string,
  opts?: {
    baseUrl?: string
    getAccessToken?: () => string | undefined
    timeoutMs?: number
  },
)

Source from the content-addressed store, hash-verified

261 * cleanup; call sites wrap with .catch().
262 */
263export async function archiveBridgeSession(
264 sessionId: string,
265 opts?: {
266 baseUrl?: string
267 getAccessToken?: () => string | undefined
268 timeoutMs?: number
269 },
270): Promise<void> {
271 const { default: axios } = await import('axios')
272
273 const headers = await resolveBridgeSessionHeaders({
274 accessTokenOverride: opts?.getAccessToken?.(),
275 operation: 'session archive',
276 })
277 if (!headers) {
278 return
279 }
280
281 const url = `${opts?.baseUrl ?? getNoumenaPlatformBaseUrl()}/v1/sessions/${sessionId}/archive`
282 logForDebugging(`[bridge] Archiving session ${sessionId}`)
283
284 const response = await axios.post(
285 url,
286 {},
287 {
288 headers,
289 timeout: opts?.timeoutMs ?? 10_000,
290 validateStatus: s => s < 500,
291 },
292 )
293
294 if (response.status === 200) {
295 logForDebugging(`[bridge] Session ${sessionId} archived successfully`)
296 } else {
297 const detail = extractErrorDetail(response.data)
298 logForDebugging(
299 `[bridge] Session archive failed with status ${response.status}${detail ? `: ${detail}` : ''}`,
300 )
301 }
302}
303
304/**
305 * Update the title of a bridge session via PATCH /v1/sessions/{id}.

Callers 2

initReplBridgeFunction · 0.85

Calls 4

extractErrorDetailFunction · 0.85
logForDebuggingFunction · 0.50

Tested by

no test coverage detected