@mastra/server-adapters-test-suite 0.1.4-alpha.0 → 0.1.4-alpha.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @mastra/server-adapters-test-suite
2
2
 
3
+ ## 0.1.4-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#28417](https://github.com/mastra-ai/mastra/pull/28417))
8
+ - Updated dependency [`@types/node@22.19.15` ↗︎](https://www.npmjs.com/package/@types/node/v/22.19.15) (from `22.20.5`, in `devDependencies`)
9
+ - Updated dependencies [[`ce5d473`](https://github.com/mastra-ai/mastra/commit/ce5d4731eeeb44779748852618b95c5cb6485bed), [`ce5d473`](https://github.com/mastra-ai/mastra/commit/ce5d4731eeeb44779748852618b95c5cb6485bed), [`ce5d473`](https://github.com/mastra-ai/mastra/commit/ce5d4731eeeb44779748852618b95c5cb6485bed), [`0a913e0`](https://github.com/mastra-ai/mastra/commit/0a913e096cb569aea396fa3d9f286cc874179ce8), [`3dfe2eb`](https://github.com/mastra-ai/mastra/commit/3dfe2eb8c3ef3b18d2395a3618b6214488963d05), [`152e380`](https://github.com/mastra-ai/mastra/commit/152e380aca6fcf74f598a158c710c0e755ceb325), [`99e4867`](https://github.com/mastra-ai/mastra/commit/99e486723d3f0063ae70a39c9840daf92a98fa23), [`929a728`](https://github.com/mastra-ai/mastra/commit/929a7281d411ac515e0befb53a5383741b06d484), [`52db47c`](https://github.com/mastra-ai/mastra/commit/52db47cd0d66f891d41a2dbfa36e55b640a30a37), [`7adffbb`](https://github.com/mastra-ai/mastra/commit/7adffbb3df2f734b59648dcf8d461e7af8d1f914), [`f51a29e`](https://github.com/mastra-ai/mastra/commit/f51a29e82b6e2371b5c6aed46141ce20f099c9a9), [`5c0a994`](https://github.com/mastra-ai/mastra/commit/5c0a99438ef82cf5584218f250a023371bab3373), [`7adffbb`](https://github.com/mastra-ai/mastra/commit/7adffbb3df2f734b59648dcf8d461e7af8d1f914), [`823a389`](https://github.com/mastra-ai/mastra/commit/823a3890deb5cf14484fd655c8360df4c41c4aed), [`ff35b8c`](https://github.com/mastra-ai/mastra/commit/ff35b8c3d86136509d31b87fed7f789a572dc1af), [`501b207`](https://github.com/mastra-ai/mastra/commit/501b207b1b6300af44b5b8f40ff33adfe7a9d195), [`d9245dd`](https://github.com/mastra-ai/mastra/commit/d9245dd486349163bfc6468ab45e5600abc6a59e), [`358c711`](https://github.com/mastra-ai/mastra/commit/358c71145d677394ce03a019156bc464afe6cc76), [`dbdfaee`](https://github.com/mastra-ai/mastra/commit/dbdfaee279dab2a5dca31134ca1967eb582e639c), [`fdd2201`](https://github.com/mastra-ai/mastra/commit/fdd22014f6fbfa115eba53cff42063544af2ff41), [`4303017`](https://github.com/mastra-ai/mastra/commit/4303017f393b9c09f692837d8e9e7a19f6539cf4)]:
10
+ - @mastra/core@1.80.0-alpha.4
11
+ - @mastra/mcp@2.6.0-alpha.1
12
+ - @mastra/server@1.80.0-alpha.4
13
+
14
+ ## 0.1.4-alpha.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Add a reusable real-HTTP disconnect suite covering durable and evented stream starts, resumes, tool approvals, observer replay, and explicit cancellation, with ordinary agents as the cancellation control. ([#28162](https://github.com/mastra-ai/mastra/pull/28162))
19
+
20
+ - Skipped the run-scoped abort route (`POST /agents/:agentId/runs/:runId/abort`) in the generic adapter route suite, since it returns 501 for the suite's non-durable agent by design. Adapter suites no longer fail on this route. ([#28301](https://github.com/mastra-ai/mastra/pull/28301))
21
+
22
+ - Updated dependencies [[`f396b43`](https://github.com/mastra-ai/mastra/commit/f396b435c72042fc6d9e82c361fa047675995812), [`f396b43`](https://github.com/mastra-ai/mastra/commit/f396b435c72042fc6d9e82c361fa047675995812), [`0d7d5cb`](https://github.com/mastra-ai/mastra/commit/0d7d5cbdccacc0b03697b3400579ea520e382061), [`0d7d5cb`](https://github.com/mastra-ai/mastra/commit/0d7d5cbdccacc0b03697b3400579ea520e382061), [`f5ebbf3`](https://github.com/mastra-ai/mastra/commit/f5ebbf3b2dc935b8fc068996b4db478815f05bd5), [`11c83d5`](https://github.com/mastra-ai/mastra/commit/11c83d53331588e06623d5d4a35baa606bbaa424), [`703b0a1`](https://github.com/mastra-ai/mastra/commit/703b0a1cb342d3a6fce72b5b07685fbb31695674), [`1283717`](https://github.com/mastra-ai/mastra/commit/1283717ecfc652da293aafe6ff582afa07ca84a5), [`3be96ae`](https://github.com/mastra-ai/mastra/commit/3be96ae2f65a2ff3b2189fb79fd03b7eedee3dbe)]:
23
+ - @mastra/core@1.80.0-alpha.1
24
+ - @mastra/server@1.80.0-alpha.1
25
+ - @mastra/mcp@2.6.0-alpha.0
26
+
3
27
  ## 0.1.4-alpha.0
4
28
 
5
29
  ### Patch Changes
@@ -0,0 +1,23 @@
1
+ import { Agent } from '@mastra/core/agent';
2
+ import { Mastra } from '@mastra/core/mastra';
3
+ export interface DurableDisconnectTestConfig {
4
+ setupModel: () => Promise<{
5
+ model: ConstructorParameters<typeof Agent>[0]['model'];
6
+ addResponse: (sequenceIndex: number, response: {
7
+ content?: string;
8
+ toolCalls?: {
9
+ id: string;
10
+ name: string;
11
+ arguments: Record<string, unknown>;
12
+ }[];
13
+ }) => void;
14
+ getRequestCount: () => number;
15
+ close: () => Promise<void>;
16
+ }>;
17
+ startServer: (mastra: Mastra, onDisconnect: (path: string) => void) => Promise<{
18
+ baseUrl: string;
19
+ close: () => Promise<void>;
20
+ }>;
21
+ }
22
+ export declare function createDurableDisconnectTestSuite(config: DurableDisconnectTestConfig): void;
23
+ //# sourceMappingURL=durable-disconnect-test-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-disconnect-test-suite.d.ts","sourceRoot":"","sources":["../src/durable-disconnect-test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO7C,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,OAAO,CAAC;QACxB,KAAK,EAAE,qBAAqB,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvD,WAAW,EAAE,CACX,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE;YACR,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,SAAS,CAAC,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;aAAE,EAAE,CAAC;SAChF,KACE,IAAI,CAAC;QACV,eAAe,EAAE,MAAM,MAAM,CAAC;QAC9B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;IACH,WAAW,EAAE,CACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KACjC,OAAO,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;CACJ;AAWD,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,2BAA2B,QAmPnF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { createRouteAdapterTestSuite } from './route-adapter-test-suite.js';
2
+ export { createDurableDisconnectTestSuite, type DurableDisconnectTestConfig } from './durable-disconnect-test-suite.js';
2
3
  export type { AdapterTestSuiteConfig, AdapterTestContext, AdapterSetupOptions, HttpRequest, HttpResponse, } from './test-helpers.js';
3
4
  export { createMCPRouteTestSuite } from './mcp-route-test-suite.js';
4
5
  export { createMCPTransportTestSuite, type MCPTransportTestConfig } from './mcp-transport-test-suite.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,KAAK,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAElH,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACrH,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,KAAK,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAElH,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -25,13 +25,14 @@ import { CompositeVoice } from "@mastra/core/voice";
25
25
  import { createStep, createWorkflow } from "@mastra/core/workflows";
26
26
  import { LocalFilesystem, Workspace } from "@mastra/core/workspace";
27
27
  import { MCPClient, MCPServer, defineEvent } from "@mastra/mcp";
28
+ import { createDurableAgent, createEventedAgent } from "@mastra/core/agent/durable";
28
29
  import { Mastra as Mastra$1 } from "@mastra/core/mastra";
29
30
  import http from "http";
30
31
  import { MCPServerBase } from "@mastra/core/mcp";
31
32
  import { RequestContext } from "@mastra/core/request-context";
32
33
  import { standardSchemaToJSONSchema } from "@mastra/core/schema";
33
34
  import { z as z$2 } from "zod/v4";
34
- //#region src/route-test-utils.ts
35
+ // src/route-test-utils.ts
35
36
  /**
36
37
  * Normalizes a route path to ensure consistent formatting.
37
38
  * - Removes leading/trailing whitespace
@@ -419,8 +420,7 @@ function validateRouteMetadata(route, expected) {
419
420
  if (hasOpenAPI !== expected.hasOpenAPI) throw new Error(`Expected openapi to be ${expected.hasOpenAPI ? "defined" : "undefined"} but got ${hasOpenAPI ? "defined" : "undefined"}`);
420
421
  }
421
422
  }
422
- //#endregion
423
- //#region src/route-test-suite.ts
423
+ // src/route-test-suite.ts
424
424
  /**
425
425
  * Creates a standardized test suite for server adapter routes
426
426
  * Similar to stores/_test-utils pattern
@@ -497,8 +497,7 @@ function createRouteTestSuite(config) {
497
497
  });
498
498
  });
499
499
  }
500
- //#endregion
501
- //#region src/test-helpers.ts
500
+ // src/test-helpers.ts
502
501
  if (process.env.VITEST) {
503
502
  vi.mock("@mastra/core/vector");
504
503
  vi.mock("zod", async (importOriginal) => {
@@ -1773,8 +1772,7 @@ async function consumeSSEStream(stream) {
1773
1772
  }
1774
1773
  return chunks;
1775
1774
  }
1776
- //#endregion
1777
- //#region src/route-adapter-test-suite.ts
1775
+ // src/route-adapter-test-suite.ts
1778
1776
  /**
1779
1777
  * Creates a standardized integration test suite for server adapters (Express/Hono)
1780
1778
  *
@@ -2171,6 +2169,7 @@ function createRouteAdapterTestSuite(config) {
2171
2169
  "/agents/:agentId/observe",
2172
2170
  "/mcp/:serverId/events/:eventName/stream",
2173
2171
  "/agents/:agentId/recover",
2172
+ "/agents/:agentId/runs/:runId/abort",
2174
2173
  "/agents/:agentId/plans/file",
2175
2174
  "/tool-providers/:providerId/connections/:connectionId",
2176
2175
  "/tool-providers/:providerId/connections/:connectionId/usage",
@@ -3011,8 +3010,278 @@ function createRouteAdapterTestSuite(config) {
3011
3010
  });
3012
3011
  });
3013
3012
  }
3014
- //#endregion
3015
- //#region src/mcp-route-test-suite.ts
3013
+ // src/durable-disconnect-test-suite.ts
3014
+ function deferred() {
3015
+ let resolve;
3016
+ return {
3017
+ promise: new Promise((r) => {
3018
+ resolve = r;
3019
+ }),
3020
+ resolve
3021
+ };
3022
+ }
3023
+ function createDurableDisconnectTestSuite(config) {
3024
+ describe.each([
3025
+ "plain",
3026
+ "durable",
3027
+ "evented"
3028
+ ])("HTTP observer disconnect: %s (COR-1489)", (kind) => {
3029
+ let server;
3030
+ let fixture;
3031
+ let mastra;
3032
+ afterEach(async () => {
3033
+ if (mastra) await mastra.shutdown();
3034
+ if (server) await server.close();
3035
+ if (fixture) await fixture.close();
3036
+ server = void 0;
3037
+ mastra = void 0;
3038
+ fixture = void 0;
3039
+ });
3040
+ for (const route of [
3041
+ "stream",
3042
+ "stream-alias",
3043
+ "stream-until-idle",
3044
+ "resume-stream",
3045
+ "resume-alias",
3046
+ "resume-stream-until-idle",
3047
+ "approve-tool-call",
3048
+ "decline-tool-call"
3049
+ ]) for (const explicitAbort of [
3050
+ false,
3051
+ true,
3052
+ "run",
3053
+ "threadless"
3054
+ ]) {
3055
+ if (typeof explicitAbort === "string" && (kind === "plain" || !["stream", "stream-alias"].includes(route))) continue;
3056
+ const threadless = explicitAbort === "threadless";
3057
+ it(`${route}: disconnect ${explicitAbort ? `then explicit ${explicitAbort === true ? "thread" : explicitAbort} abort stops execution` : "preserves durable execution and replay"}`, async () => {
3058
+ fixture = await config.setupModel();
3059
+ const entered = deferred();
3060
+ const gate = deferred();
3061
+ const disconnected = deferred();
3062
+ const calls = [];
3063
+ let toolSignal;
3064
+ const storage = new InMemoryStore();
3065
+ const memory = new MockMemory({ storage });
3066
+ const slow = createTool({
3067
+ id: "slow",
3068
+ description: "Execute a numbered step",
3069
+ inputSchema: z.object({ n: z.number() }),
3070
+ execute: async ({ n }, context) => {
3071
+ calls.push(n);
3072
+ if (n === 1) {
3073
+ toolSignal = context?.abortSignal;
3074
+ entered.resolve();
3075
+ await Promise.race([gate.promise, new Promise((resolve) => {
3076
+ if (toolSignal?.aborted) return resolve();
3077
+ toolSignal?.addEventListener("abort", () => resolve(), { once: true });
3078
+ })]);
3079
+ }
3080
+ return { n };
3081
+ }
3082
+ });
3083
+ const research = createTool({
3084
+ id: "research",
3085
+ description: "Background research",
3086
+ inputSchema: z.object({}),
3087
+ background: { enabled: true },
3088
+ execute: async () => ({ done: true })
3089
+ });
3090
+ let authorizations = 0;
3091
+ const authorize = createTool({
3092
+ id: "authorize",
3093
+ description: "Authorize the steps",
3094
+ inputSchema: z.object({}),
3095
+ requireApproval: true,
3096
+ execute: async () => {
3097
+ authorizations++;
3098
+ return { approved: true };
3099
+ }
3100
+ });
3101
+ const resumed = route.startsWith("resume") || route.endsWith("tool-call");
3102
+ const offset = resumed ? 1 : 0;
3103
+ const inner = new Agent({
3104
+ id: "disconnect-agent",
3105
+ name: "Disconnect agent",
3106
+ instructions: "Execute three steps.",
3107
+ model: fixture.model,
3108
+ ...threadless ? {} : { memory },
3109
+ tools: {
3110
+ slow,
3111
+ research,
3112
+ authorize
3113
+ },
3114
+ backgroundTasks: { tools: { research: true } }
3115
+ });
3116
+ const agent = kind === "durable" ? createDurableAgent({ agent: inner }) : kind === "evented" ? createEventedAgent({ agent: inner }) : inner;
3117
+ const otherAgent = createDurableAgent({ agent: new Agent({
3118
+ id: "other-agent",
3119
+ name: "Other agent",
3120
+ instructions: "Do not run.",
3121
+ model: fixture.model
3122
+ }) });
3123
+ mastra = new Mastra$1({
3124
+ agents: {
3125
+ agent,
3126
+ otherAgent
3127
+ },
3128
+ storage,
3129
+ logger: false,
3130
+ backgroundTasks: {
3131
+ enabled: true,
3132
+ globalConcurrency: 5,
3133
+ perAgentConcurrency: 3
3134
+ }
3135
+ });
3136
+ server = await config.startServer(mastra, (path) => {
3137
+ if (!resumed || !path.endsWith("/stream")) disconnected.resolve();
3138
+ });
3139
+ const base = `${server.baseUrl}/api/agents/agent`;
3140
+ if (resumed) fixture.addResponse(0, { toolCalls: [{
3141
+ id: "authorize-1",
3142
+ name: "authorize",
3143
+ arguments: {}
3144
+ }] });
3145
+ for (let n = 1; n <= 3; n++) fixture.addResponse(offset + n - 1, { toolCalls: [{
3146
+ id: `slow-${n}`,
3147
+ name: "slow",
3148
+ arguments: { n }
3149
+ }] });
3150
+ fixture.addResponse(offset + 3, { content: "done: 3 results" });
3151
+ const runId = `disconnect-${kind}-${route}-${explicitAbort}`;
3152
+ const thread = {
3153
+ thread: runId,
3154
+ resource: "disconnect-user"
3155
+ };
3156
+ if (resumed) {
3157
+ const parked = await fetch(`${base}/stream`, {
3158
+ method: "POST",
3159
+ headers: { "content-type": "application/json" },
3160
+ body: JSON.stringify({
3161
+ messages: "Start",
3162
+ runId,
3163
+ memory: thread,
3164
+ maxSteps: 6
3165
+ })
3166
+ });
3167
+ expect(parked.status).toBe(200);
3168
+ const reader = parked.body.getReader();
3169
+ let received = "";
3170
+ while (!received.includes("tool-call-approval")) {
3171
+ const { done, value } = await reader.read();
3172
+ expect(done).toBe(false);
3173
+ received += new TextDecoder().decode(value);
3174
+ }
3175
+ await reader.cancel();
3176
+ }
3177
+ const client = new AbortController();
3178
+ const request = fetch(`${base}/${route === "stream-alias" ? "stream" : route === "resume-alias" ? "resume-stream" : route}`, {
3179
+ method: "POST",
3180
+ headers: { "content-type": "application/json" },
3181
+ signal: client.signal,
3182
+ body: JSON.stringify({
3183
+ ...resumed ? {
3184
+ resumeData: { approved: true },
3185
+ toolCallId: "authorize-1"
3186
+ } : { messages: "Start" },
3187
+ runId,
3188
+ ...threadless ? {} : { memory: thread },
3189
+ maxSteps: 6,
3190
+ ...["stream-alias", "resume-alias"].includes(route) ? { untilIdle: true } : {}
3191
+ })
3192
+ }).then(async (response) => {
3193
+ expect(response.status).toBe(200);
3194
+ await response.text();
3195
+ }).catch((error) => {
3196
+ if (error.name !== "AbortError") throw error;
3197
+ });
3198
+ try {
3199
+ await entered.promise;
3200
+ client.abort();
3201
+ await disconnected.promise;
3202
+ await request;
3203
+ if (kind !== "plain" && explicitAbort) {
3204
+ const runScoped = typeof explicitAbort === "string";
3205
+ if (runScoped) {
3206
+ const denied = await fetch(`${server.baseUrl}/api/agents/otherAgent/runs/${runId}/abort`, { method: "POST" });
3207
+ expect(denied.status).toBe(403);
3208
+ expect(toolSignal?.aborted).toBe(false);
3209
+ }
3210
+ const response = await fetch(`${base}/${runScoped ? `runs/${runId}/abort` : "threads/abort"}`, {
3211
+ method: "POST",
3212
+ headers: { "content-type": "application/json" },
3213
+ ...runScoped ? {} : { body: JSON.stringify({
3214
+ threadId: runId,
3215
+ resourceId: thread.resource,
3216
+ expectedRunId: runId
3217
+ }) }
3218
+ });
3219
+ const result = await response.json();
3220
+ expect(response.status).toBe(200);
3221
+ expect(result).toEqual({ aborted: true });
3222
+ }
3223
+ const completes = kind !== "plain" && !explicitAbort;
3224
+ if (!completes) await vi.waitFor(() => expect(toolSignal?.aborted).toBe(true));
3225
+ else expect(toolSignal?.aborted).toBe(false);
3226
+ const observing = kind === "plain" ? void 0 : fetch(`${base}/observe`, {
3227
+ method: "POST",
3228
+ headers: { "content-type": "application/json" },
3229
+ body: JSON.stringify({ runId })
3230
+ });
3231
+ gate.resolve();
3232
+ if (observing) {
3233
+ const response = await observing;
3234
+ expect(response.status).toBe(200);
3235
+ const replay = await response.text();
3236
+ expect(replay).toContain("finish");
3237
+ if (completes) expect(replay).toContain("done: 3 results");
3238
+ else expect(replay).toContain("abort");
3239
+ }
3240
+ await vi.waitFor(() => expect(calls).toEqual(completes ? [
3241
+ 1,
3242
+ 2,
3243
+ 3
3244
+ ] : [1]));
3245
+ expect(fixture.getRequestCount()).toBe(offset + (completes ? 4 : 1));
3246
+ if (resumed) expect(authorizations).toBe(route === "decline-tool-call" ? 0 : 1);
3247
+ if (kind !== "plain") {
3248
+ const workflows = await storage.getStore("workflows");
3249
+ await vi.waitFor(async () => {
3250
+ for (const workflowName of ["durable-agentic-loop", "durable-agentic-execution"]) expect(await workflows.loadWorkflowSnapshot({
3251
+ workflowName,
3252
+ runId
3253
+ })).toBeFalsy();
3254
+ });
3255
+ }
3256
+ if (completes) {
3257
+ await vi.waitFor(async () => {
3258
+ const { messages } = await memory.recall({
3259
+ threadId: runId,
3260
+ resourceId: thread.resource
3261
+ });
3262
+ expect(messages.flatMap((m) => m.content.parts ?? []).some((p) => p.type === "text" && p.text === "done: 3 results")).toBe(true);
3263
+ });
3264
+ const replay = await fetch(`${base}/observe`, {
3265
+ method: "POST",
3266
+ headers: { "content-type": "application/json" },
3267
+ body: JSON.stringify({ runId })
3268
+ }).then((response) => response.text());
3269
+ expect(replay).toContain("done: 3 results");
3270
+ expect(replay).toContain("finish");
3271
+ const lateAbort = await fetch(`${base}/runs/${runId}/abort`, { method: "POST" });
3272
+ expect(lateAbort.status).toBe(200);
3273
+ expect(await lateAbort.json()).toEqual({ aborted: false });
3274
+ expect(fixture.getRequestCount()).toBe(offset + 4);
3275
+ }
3276
+ } finally {
3277
+ gate.resolve();
3278
+ client.abort();
3279
+ }
3280
+ }, 3e4);
3281
+ }
3282
+ });
3283
+ }
3284
+ // src/mcp-route-test-suite.ts
3016
3285
  /**
3017
3286
  * Creates a standardized integration test suite for MCP registry routes
3018
3287
  *
@@ -3264,8 +3533,7 @@ function createMCPRouteTestSuite(config) {
3264
3533
  });
3265
3534
  });
3266
3535
  }
3267
- //#endregion
3268
- //#region src/native-mcp-fixture.ts
3536
+ // src/native-mcp-fixture.ts
3269
3537
  const unavailable = (feature) => async () => {
3270
3538
  throw new Error(`${feature} is not available on a 2026-07-28 server`);
3271
3539
  };
@@ -3417,8 +3685,7 @@ var NativeMCPFixture = class extends MCPServerBase {
3417
3685
  return { resources: [] };
3418
3686
  }
3419
3687
  };
3420
- //#endregion
3421
- //#region src/mcp-transport-test-suite.ts
3688
+ // src/mcp-transport-test-suite.ts
3422
3689
  /**
3423
3690
  * Creates a standardized integration test suite for MCP transport routes
3424
3691
  *
@@ -3868,8 +4135,7 @@ function createMCPTransportTestSuite(config) {
3868
4135
  });
3869
4136
  });
3870
4137
  }
3871
- //#endregion
3872
- //#region src/multipart-test-suite.ts
4138
+ // src/multipart-test-suite.ts
3873
4139
  /**
3874
4140
  * Creates a standardized test suite for multipart/form-data handling in server adapters.
3875
4141
  *
@@ -4192,8 +4458,7 @@ function createMultipartTestSuite(config) {
4192
4458
  });
4193
4459
  });
4194
4460
  }
4195
- //#endregion
4196
- //#region src/http-logging-test-suite.ts
4461
+ // src/http-logging-test-suite.ts
4197
4462
  /**
4198
4463
  * Creates a standardized test suite for HTTP logging across all server adapters.
4199
4464
  *
@@ -4381,8 +4646,7 @@ function createHttpLoggingTestSuite(config) {
4381
4646
  });
4382
4647
  });
4383
4648
  }
4384
- //#endregion
4385
- //#region src/body-limit-test-suite.ts
4649
+ // src/body-limit-test-suite.ts
4386
4650
  /**
4387
4651
  * Creates a standardized body-limit test suite for server adapters.
4388
4652
  *
@@ -4582,8 +4846,7 @@ function createBodyLimitTestSuite(config) {
4582
4846
  });
4583
4847
  });
4584
4848
  }
4585
- //#endregion
4586
- //#region src/custom-route-fga-test-suite.ts
4849
+ // src/custom-route-fga-test-suite.ts
4587
4850
  /**
4588
4851
  * Custom `registerApiRoute()` handlers read path params from the URL. FGA must
4589
4852
  * authorize that same resource, so a query or body field named like a path
@@ -4673,7 +4936,6 @@ function createCustomRouteFGATestSuite(config) {
4673
4936
  });
4674
4937
  });
4675
4938
  }
4676
- //#endregion
4677
- export { consumeSSEStream, createBodyLimitTestSuite, createCustomRouteFGATestSuite, createDefaultTestContext, createHttpLoggingTestSuite, createMCPRouteTestSuite, createMCPTransportTestSuite, createMultipartTestSuite, createRouteAdapterTestSuite, createStreamWithSensitiveData, createStreamWithUnserializableChunk, expectSerializedStreamChunks };
4939
+ export { consumeSSEStream, createBodyLimitTestSuite, createCustomRouteFGATestSuite, createDefaultTestContext, createDurableDisconnectTestSuite, createHttpLoggingTestSuite, createMCPRouteTestSuite, createMCPTransportTestSuite, createMultipartTestSuite, createRouteAdapterTestSuite, createStreamWithSensitiveData, createStreamWithUnserializableChunk, expectSerializedStreamChunks };
4678
4940
 
4679
4941
  //# sourceMappingURL=index.js.map