-
-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathsession-status.ts
More file actions
38 lines (33 loc) · 1.04 KB
/
session-status.ts
File metadata and controls
38 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Session Status Resource Plugin
*
* Provides read-only runtime session state for log capture and debugging.
*/
import { log } from '../../utils/logging/index.ts';
import { getSessionRuntimeStatusSnapshot } from '../../utils/session-status.ts';
export async function sessionStatusResourceLogic(): Promise<{ contents: Array<{ text: string }> }> {
try {
log('info', 'Processing session status resource request');
const status = await getSessionRuntimeStatusSnapshot();
return {
contents: [
{
text: JSON.stringify(status, null, 2),
},
],
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
log('error', `Error in session status resource handler: ${errorMessage}`);
return {
contents: [
{
text: `Error retrieving session status: ${errorMessage}`,
},
],
};
}
}
export async function handler(_uri: URL): Promise<{ contents: Array<{ text: string }> }> {
return sessionStatusResourceLogic();
}