@skybridge/test 2.0.0-beta.78ceed1 → 2.0.0-beta.dba0bc8
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.
|
@@ -35,14 +35,13 @@ interface StartOptions {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Opens a fresh MCP session and conversation against the app under test. The
|
|
38
|
-
* app is served in-process
|
|
38
|
+
* app is served in-process by a handler built on `app.createServerInstance`
|
|
39
|
+
* for this conversation alone, and both are closed when the current test
|
|
39
40
|
* finishes, so scenarios never leak sessions and never write teardown, and
|
|
40
41
|
* tests that run concurrently cannot close each other's sessions.
|
|
41
42
|
*
|
|
42
43
|
* The assertions are inferred from the app value itself, so `expect.chat` gets
|
|
43
|
-
* the project's tool names and argument shapes with no type parameter.
|
|
44
|
-
* session talks to an in-process handler built on `app.createServerInstance`,
|
|
45
|
-
* which never closes: it is memoized per app and shared by every test.
|
|
44
|
+
* the project's tool names and argument shapes with no type parameter.
|
|
46
45
|
*
|
|
47
46
|
* `authInfo` claims an identity for the session: the app's per-tool scheme and
|
|
48
47
|
* scope enforcement runs against it for real, only token verification is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-registry.d.ts","sourceRoot":"","sources":["../src/session-registry.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"session-registry.d.ts","sourceRoot":"","sources":["../src/session-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,UAAU,YAAY;IACpB,uDAAuD;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,KAAK,CAAC,GAAG,SAAS,OAAO,EAC7C,OAAO,EAAE,YAAY,GAAG;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;CAAE,GAC5D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAwBpB"}
|
package/dist/session-registry.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { createMcpHandler
|
|
1
|
+
import { createMcpHandler } from "@modelcontextprotocol/server";
|
|
2
2
|
import { inject, onTestFinished } from "vitest";
|
|
3
3
|
import { Chat } from "./chat.js";
|
|
4
|
-
const handlers = new WeakMap();
|
|
5
|
-
function getHandler(app) {
|
|
6
|
-
let handler = handlers.get(app);
|
|
7
|
-
if (!handler) {
|
|
8
|
-
handler = createMcpHandler(() => app.createServerInstance());
|
|
9
|
-
handlers.set(app, handler);
|
|
10
|
-
}
|
|
11
|
-
return handler;
|
|
12
|
-
}
|
|
13
4
|
function sharedDefaults() {
|
|
14
5
|
try {
|
|
15
6
|
return inject("skybridgeEvals");
|
|
@@ -20,14 +11,13 @@ function sharedDefaults() {
|
|
|
20
11
|
}
|
|
21
12
|
/**
|
|
22
13
|
* Opens a fresh MCP session and conversation against the app under test. The
|
|
23
|
-
* app is served in-process
|
|
14
|
+
* app is served in-process by a handler built on `app.createServerInstance`
|
|
15
|
+
* for this conversation alone, and both are closed when the current test
|
|
24
16
|
* finishes, so scenarios never leak sessions and never write teardown, and
|
|
25
17
|
* tests that run concurrently cannot close each other's sessions.
|
|
26
18
|
*
|
|
27
19
|
* The assertions are inferred from the app value itself, so `expect.chat` gets
|
|
28
|
-
* the project's tool names and argument shapes with no type parameter.
|
|
29
|
-
* session talks to an in-process handler built on `app.createServerInstance`,
|
|
30
|
-
* which never closes: it is memoized per app and shared by every test.
|
|
20
|
+
* the project's tool names and argument shapes with no type parameter.
|
|
31
21
|
*
|
|
32
22
|
* `authInfo` claims an identity for the session: the app's per-tool scheme and
|
|
33
23
|
* scope enforcement runs against it for real, only token verification is
|
|
@@ -36,13 +26,17 @@ function sharedDefaults() {
|
|
|
36
26
|
export async function start(options) {
|
|
37
27
|
const config = sharedDefaults();
|
|
38
28
|
const { app, authInfo } = options;
|
|
29
|
+
const handler = createMcpHandler(() => app.createServerInstance());
|
|
39
30
|
const chat = await Chat.open({
|
|
40
31
|
model: options.model,
|
|
41
32
|
temperature: options.temperature ?? config?.temperature,
|
|
42
33
|
systemPrompt: options.systemPrompt ?? config?.systemPrompt,
|
|
43
34
|
maxSteps: options.maxSteps ?? config?.maxSteps,
|
|
44
|
-
}, (url, init) =>
|
|
45
|
-
onTestFinished(() =>
|
|
35
|
+
}, (url, init) => handler.fetch(new Request(url, init), authInfo === undefined ? undefined : { authInfo }));
|
|
36
|
+
onTestFinished(async () => {
|
|
37
|
+
await chat.close();
|
|
38
|
+
await handler.close();
|
|
39
|
+
});
|
|
46
40
|
return chat;
|
|
47
41
|
}
|
|
48
42
|
//# sourceMappingURL=session-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-registry.js","sourceRoot":"","sources":["../src/session-registry.ts"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E;QACxB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skybridge/test",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.dba0bc8",
|
|
4
4
|
"description": "Eval runner for Skybridge MCP apps: does a prompt reach the right tool with the right arguments",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"typescript": "^5.9.3",
|
|
34
34
|
"vitest": "^4.1.10",
|
|
35
35
|
"zod": "^4.4.3",
|
|
36
|
-
"@skybridge/vite-plugin": "2.0.0-beta.
|
|
37
|
-
"skybridge": "2.0.0-beta.
|
|
36
|
+
"@skybridge/vite-plugin": "2.0.0-beta.dba0bc8",
|
|
37
|
+
"skybridge": "2.0.0-beta.dba0bc8"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=22.23.1"
|