testdriverai 7.2.65 → 7.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mcp-server/dist/codegen.d.ts +9 -0
- package/mcp-server/dist/codegen.js +165 -0
- package/mcp-server/dist/mcp-app.html +114 -0
- package/mcp-server/dist/provision-types.d.ts +290 -0
- package/mcp-server/dist/provision-types.js +174 -0
- package/mcp-server/dist/server.d.ts +6 -0
- package/mcp-server/dist/server.js +1441 -0
- package/mcp-server/dist/session.d.ts +85 -0
- package/mcp-server/dist/session.js +152 -0
- package/package.json +3 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session state management for TestDriver MCP Server
|
|
3
|
+
* Tracks sandbox sessions for MCP server
|
|
4
|
+
*/
|
|
5
|
+
export interface SessionState {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
sandboxId: string | null;
|
|
8
|
+
status: "initializing" | "active" | "expired" | "error";
|
|
9
|
+
os: "linux" | "windows";
|
|
10
|
+
resolution: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
expiresAt: number;
|
|
13
|
+
keepAlive: number;
|
|
14
|
+
testFile: string | null;
|
|
15
|
+
lastScreenshot: string | null;
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Session Manager - handles session state for MCP server
|
|
20
|
+
*/
|
|
21
|
+
export declare class SessionManager {
|
|
22
|
+
private sessions;
|
|
23
|
+
private currentSessionId;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new session
|
|
26
|
+
*/
|
|
27
|
+
createSession(options: {
|
|
28
|
+
sandboxId?: string;
|
|
29
|
+
os?: "linux" | "windows";
|
|
30
|
+
resolution?: string;
|
|
31
|
+
keepAlive?: number;
|
|
32
|
+
testFile?: string;
|
|
33
|
+
}): SessionState;
|
|
34
|
+
/**
|
|
35
|
+
* Get the current active session
|
|
36
|
+
*/
|
|
37
|
+
getCurrentSession(): SessionState | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get a session by ID
|
|
40
|
+
*/
|
|
41
|
+
getSession(sessionId: string): SessionState | null;
|
|
42
|
+
/**
|
|
43
|
+
* Update session state
|
|
44
|
+
*/
|
|
45
|
+
updateSession(sessionId: string, updates: Partial<SessionState>): SessionState | null;
|
|
46
|
+
/**
|
|
47
|
+
* Mark session as active with sandbox ID
|
|
48
|
+
*/
|
|
49
|
+
activateSession(sessionId: string, sandboxId: string): SessionState | null;
|
|
50
|
+
/**
|
|
51
|
+
* Extend session expiry time by adding additional milliseconds
|
|
52
|
+
*/
|
|
53
|
+
extendSession(sessionId: string, additionalMs: number): SessionState | null;
|
|
54
|
+
/**
|
|
55
|
+
* Refresh session expiry to reset the keepAlive timer from now
|
|
56
|
+
* Called on each command to keep session alive during active use
|
|
57
|
+
*/
|
|
58
|
+
refreshSession(sessionId: string): SessionState | null;
|
|
59
|
+
/**
|
|
60
|
+
* Check if session is still valid
|
|
61
|
+
*/
|
|
62
|
+
isSessionValid(sessionId: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get time remaining until session expires
|
|
65
|
+
*/
|
|
66
|
+
getTimeRemaining(sessionId: string): number;
|
|
67
|
+
/**
|
|
68
|
+
* Mark session as expired/ended
|
|
69
|
+
*/
|
|
70
|
+
endSession(sessionId: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Delete a session
|
|
73
|
+
*/
|
|
74
|
+
deleteSession(sessionId: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Get session summary for status reporting
|
|
77
|
+
*/
|
|
78
|
+
getSessionSummary(sessionId: string): {
|
|
79
|
+
sessionId: string;
|
|
80
|
+
status: string;
|
|
81
|
+
sandboxId: string | null;
|
|
82
|
+
timeRemaining: number;
|
|
83
|
+
} | null;
|
|
84
|
+
}
|
|
85
|
+
export declare const sessionManager: SessionManager;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session state management for TestDriver MCP Server
|
|
3
|
+
* Tracks sandbox sessions for MCP server
|
|
4
|
+
*/
|
|
5
|
+
// Generate unique session ID
|
|
6
|
+
function generateSessionId() {
|
|
7
|
+
return `td-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Session Manager - handles session state for MCP server
|
|
11
|
+
*/
|
|
12
|
+
export class SessionManager {
|
|
13
|
+
sessions = new Map();
|
|
14
|
+
currentSessionId = null;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new session
|
|
17
|
+
*/
|
|
18
|
+
createSession(options) {
|
|
19
|
+
const sessionId = generateSessionId();
|
|
20
|
+
const keepAlive = options.keepAlive ?? 300000; // Default 5 minutes
|
|
21
|
+
const session = {
|
|
22
|
+
sessionId,
|
|
23
|
+
sandboxId: options.sandboxId ?? null,
|
|
24
|
+
status: "initializing",
|
|
25
|
+
os: options.os ?? "linux",
|
|
26
|
+
resolution: options.resolution ?? "1366x768",
|
|
27
|
+
createdAt: Date.now(),
|
|
28
|
+
expiresAt: Date.now() + keepAlive,
|
|
29
|
+
keepAlive,
|
|
30
|
+
testFile: options.testFile ?? null,
|
|
31
|
+
lastScreenshot: null,
|
|
32
|
+
};
|
|
33
|
+
this.sessions.set(sessionId, session);
|
|
34
|
+
this.currentSessionId = sessionId;
|
|
35
|
+
return session;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get the current active session
|
|
39
|
+
*/
|
|
40
|
+
getCurrentSession() {
|
|
41
|
+
if (!this.currentSessionId)
|
|
42
|
+
return null;
|
|
43
|
+
return this.sessions.get(this.currentSessionId) ?? null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a session by ID
|
|
47
|
+
*/
|
|
48
|
+
getSession(sessionId) {
|
|
49
|
+
return this.sessions.get(sessionId) ?? null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Update session state
|
|
53
|
+
*/
|
|
54
|
+
updateSession(sessionId, updates) {
|
|
55
|
+
const session = this.sessions.get(sessionId);
|
|
56
|
+
if (!session)
|
|
57
|
+
return null;
|
|
58
|
+
const updated = { ...session, ...updates };
|
|
59
|
+
this.sessions.set(sessionId, updated);
|
|
60
|
+
return updated;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Mark session as active with sandbox ID
|
|
64
|
+
*/
|
|
65
|
+
activateSession(sessionId, sandboxId) {
|
|
66
|
+
return this.updateSession(sessionId, {
|
|
67
|
+
sandboxId,
|
|
68
|
+
status: "active",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Extend session expiry time by adding additional milliseconds
|
|
73
|
+
*/
|
|
74
|
+
extendSession(sessionId, additionalMs) {
|
|
75
|
+
const session = this.sessions.get(sessionId);
|
|
76
|
+
if (!session)
|
|
77
|
+
return null;
|
|
78
|
+
return this.updateSession(sessionId, {
|
|
79
|
+
expiresAt: session.expiresAt + additionalMs,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Refresh session expiry to reset the keepAlive timer from now
|
|
84
|
+
* Called on each command to keep session alive during active use
|
|
85
|
+
*/
|
|
86
|
+
refreshSession(sessionId) {
|
|
87
|
+
const session = this.sessions.get(sessionId);
|
|
88
|
+
if (!session)
|
|
89
|
+
return null;
|
|
90
|
+
return this.updateSession(sessionId, {
|
|
91
|
+
expiresAt: Date.now() + session.keepAlive,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if session is still valid
|
|
96
|
+
*/
|
|
97
|
+
isSessionValid(sessionId) {
|
|
98
|
+
const session = this.sessions.get(sessionId);
|
|
99
|
+
if (!session)
|
|
100
|
+
return false;
|
|
101
|
+
if (session.status === "expired" || session.status === "error")
|
|
102
|
+
return false;
|
|
103
|
+
if (Date.now() > session.expiresAt) {
|
|
104
|
+
this.updateSession(sessionId, { status: "expired" });
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get time remaining until session expires
|
|
111
|
+
*/
|
|
112
|
+
getTimeRemaining(sessionId) {
|
|
113
|
+
const session = this.sessions.get(sessionId);
|
|
114
|
+
if (!session)
|
|
115
|
+
return 0;
|
|
116
|
+
return Math.max(0, session.expiresAt - Date.now());
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Mark session as expired/ended
|
|
120
|
+
*/
|
|
121
|
+
endSession(sessionId) {
|
|
122
|
+
this.updateSession(sessionId, { status: "expired" });
|
|
123
|
+
if (this.currentSessionId === sessionId) {
|
|
124
|
+
this.currentSessionId = null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Delete a session
|
|
129
|
+
*/
|
|
130
|
+
deleteSession(sessionId) {
|
|
131
|
+
if (this.currentSessionId === sessionId) {
|
|
132
|
+
this.currentSessionId = null;
|
|
133
|
+
}
|
|
134
|
+
return this.sessions.delete(sessionId);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get session summary for status reporting
|
|
138
|
+
*/
|
|
139
|
+
getSessionSummary(sessionId) {
|
|
140
|
+
const session = this.sessions.get(sessionId);
|
|
141
|
+
if (!session)
|
|
142
|
+
return null;
|
|
143
|
+
return {
|
|
144
|
+
sessionId: session.sessionId,
|
|
145
|
+
status: session.status,
|
|
146
|
+
sandboxId: session.sandboxId,
|
|
147
|
+
timeRemaining: this.getTimeRemaining(sessionId),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Singleton instance
|
|
152
|
+
export const sessionManager = new SessionManager();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testdriverai",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.69",
|
|
4
4
|
"description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
|
|
5
5
|
"main": "sdk.js",
|
|
6
6
|
"types": "sdk.d.ts",
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"generate-report": "junit-viewer --results=out.xml --save=report.html",
|
|
62
62
|
"serve-report": "npx http-server . -p 8080 -o report.html",
|
|
63
63
|
"report": "npm run generate-report && npm run serve-report",
|
|
64
|
-
"generate:skills": "node scripts/generate-skills.js"
|
|
64
|
+
"generate:skills": "node scripts/generate-skills.js",
|
|
65
|
+
"prepack": "cd mcp-server && npm ci && npm run build"
|
|
65
66
|
},
|
|
66
67
|
"author": "",
|
|
67
68
|
"license": "ISC",
|