@kuralle-syrinx/server-workers-mastra 4.2.0 → 4.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuralle-syrinx/server-workers-mastra",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "private": false,
5
5
  "description": "Cloudflare Workers voice host template wiring Syrinx to a Mastra reasoner",
6
6
  "keywords": [
@@ -29,15 +29,15 @@
29
29
  "@mastra/cloudflare": "^1.4.1",
30
30
  "@mastra/core": "^1.41.0",
31
31
  "zod": "^4.1.8",
32
- "@kuralle-syrinx/aisdk": "4.2.0",
33
- "@kuralle-syrinx/core": "4.2.0",
34
- "@kuralle-syrinx/mastra": "4.2.0"
32
+ "@kuralle-syrinx/core": "4.3.0",
33
+ "@kuralle-syrinx/mastra": "4.3.0",
34
+ "@kuralle-syrinx/aisdk": "4.3.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@cloudflare/workers-types": "^4.20260601.0",
38
38
  "miniflare": "^4.20260601.0",
39
39
  "typescript": "^5.7.0",
40
- "vitest": "^2.1.0",
40
+ "vitest": "^3.2.6",
41
41
  "wrangler": "^4.19.0"
42
42
  },
43
43
  "scripts": {
@@ -1,146 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
-
3
- import { existsSync } from "node:fs";
4
- import { mkdtemp, rm, stat } from "node:fs/promises";
5
- import { tmpdir } from "node:os";
6
- import { join } from "node:path";
7
- import { fileURLToPath } from "node:url";
8
- import { execFile } from "node:child_process";
9
- import { promisify } from "node:util";
10
- import { unstable_dev, type Unstable_DevWorker } from "wrangler";
11
- import { afterEach, beforeAll, describe, expect, it } from "vitest";
12
-
13
- const execFileAsync = promisify(execFile);
14
- const PACKAGE_ROOT = fileURLToPath(new URL("../", import.meta.url));
15
- const mastraEdgeEnabled = process.env["SYRINX_MASTRA_EDGE_TEST"] === "1";
16
-
17
- type SuspendBody = {
18
- phase: string;
19
- contextId: string;
20
- runId: string | null;
21
- suspended: boolean;
22
- prompt: string | null;
23
- pointer: { runId: string } | null;
24
- mastraTables: string[];
25
- packetKinds: string[];
26
- error?: string;
27
- };
28
-
29
- type ResumeBody = {
30
- phase: string;
31
- contextId: string;
32
- suspended: boolean;
33
- text: string;
34
- pointer: { runId: string } | null;
35
- mastraTables: string[];
36
- packetKinds: string[];
37
- error?: string;
38
- };
39
-
40
- const tempDirs: string[] = [];
41
- let bundleOutdir = "";
42
- let bundleSizeKb = 0;
43
- let bundleLog = "";
44
-
45
- afterEach(async () => {
46
- await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));
47
- });
48
-
49
- describe("voice-server-workers-mastra default suite", () => {
50
- it("gates workerd two-turn test behind SYRINX_MASTRA_EDGE_TEST", () => {
51
- expect(mastraEdgeEnabled || process.env["SYRINX_MASTRA_EDGE_TEST"] !== "1").toBe(true);
52
- });
53
- });
54
-
55
- describe.skipIf(!mastraEdgeEnabled)("mastra edge suspend/resume", () => {
56
- beforeAll(async () => {
57
- const outdir = await mkdtemp(join(tmpdir(), "mastra-edge-bundle-"));
58
- const wranglerBin = join(PACKAGE_ROOT, "node_modules/.bin/wrangler");
59
- const { stdout, stderr } = await execFileAsync(
60
- wranglerBin,
61
- ["deploy", "--dry-run", "--outdir", outdir],
62
- { cwd: PACKAGE_ROOT, env: process.env },
63
- );
64
- bundleLog = `${stdout}\n${stderr}`;
65
- const workerPath = join(outdir, "worker.js");
66
- if (!existsSync(workerPath)) {
67
- throw new Error(`wrangler bundle missing worker.js\n${bundleLog}`);
68
- }
69
- bundleOutdir = outdir;
70
- const bundleStat = await stat(workerPath);
71
- bundleSizeKb = Math.round(bundleStat.size / 1024);
72
- }, 120_000);
73
-
74
- async function startDevWorker(): Promise<Unstable_DevWorker> {
75
- return unstable_dev(join(PACKAGE_ROOT, "src/worker.ts"), {
76
- config: join(PACKAGE_ROOT, "wrangler.toml"),
77
- local: true,
78
- compatibilityDate: "2026-06-01",
79
- compatibilityFlags: ["nodejs_compat"],
80
- experimental: { disableExperimentalWarning: true },
81
- });
82
- }
83
-
84
- it("bundles @mastra/core + @mastra/cloudflare via wrangler (nodejs_compat)", () => {
85
- expect(bundleOutdir).toBeTruthy();
86
- expect(bundleSizeKb).toBeGreaterThan(0);
87
- expect(bundleLog).not.toMatch(/Could not resolve|unresolved|ERROR/i);
88
- }, 10_000);
89
-
90
- it("suspend → fresh DO/same SQL → resume via ReasoningBridge + pointer RunStore", async () => {
91
- const worker = await startDevWorker();
92
- const fsHits: string[] = [];
93
- const originalConsoleError = console.error;
94
- console.error = (...args: unknown[]) => {
95
- const line = args.map(String).join(" ");
96
- if (/ENOENT|readFileSync|existsSync|fs\./i.test(line)) fsHits.push(line);
97
- originalConsoleError(...args);
98
- };
99
-
100
- try {
101
- const health = await worker.fetch("http://localhost/health");
102
- expect(health.status).toBe(200);
103
- expect(await health.text()).toBe("ok");
104
-
105
- const suspendRes = await worker.fetch("http://localhost/suspend");
106
- const suspendBody = await suspendRes.json() as SuspendBody | { error: string };
107
- if ("error" in suspendBody) {
108
- throw new Error(`suspend failed: ${suspendBody.error}`);
109
- }
110
-
111
- expect(suspendRes.status).toBe(200);
112
- expect(suspendBody.phase).toBe("suspend");
113
- expect(suspendBody.suspended).toBe(true);
114
- expect(suspendBody.runId).toBeTruthy();
115
- expect(suspendBody.pointer).toEqual({ runId: suspendBody.runId });
116
- expect(suspendBody.packetKinds).toContain("reasoning.suspended");
117
- expect(suspendBody.packetKinds).toContain("llm.done");
118
- expect(suspendBody.mastraTables.some((name) => name.includes("mastra") || name.includes("workflow"))).toBe(true);
119
-
120
- const resumeRes = await worker.fetch("http://localhost/resume", {
121
- method: "POST",
122
- headers: { "content-type": "application/json" },
123
- body: JSON.stringify({ userText: "yes" }),
124
- });
125
- const resumeBody = await resumeRes.json() as ResumeBody | { error: string };
126
- if ("error" in resumeBody) {
127
- throw new Error(`resume failed: ${resumeBody.error}`);
128
- }
129
-
130
- expect(resumeRes.status).toBe(200);
131
- expect(resumeBody.phase).toBe("resume");
132
- expect(resumeBody.suspended).toBe(false);
133
- expect(resumeBody.text).toContain("Deployed successfully");
134
- expect(resumeBody.packetKinds).toContain("llm.done");
135
- expect(resumeBody.pointer).toBeNull();
136
-
137
- if (fsHits.length > 0) {
138
- // eslint-disable-next-line no-console
139
- console.log("[fs hits]", fsHits);
140
- }
141
- } finally {
142
- console.error = originalConsoleError;
143
- await worker.stop();
144
- }
145
- }, 120_000);
146
- });
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "lib": ["ES2022"],
7
- "types": ["@cloudflare/workers-types"],
8
- "strict": true,
9
- "noUncheckedIndexedAccess": true,
10
- "noImplicitReturns": true,
11
- "declaration": true,
12
- "declarationMap": true,
13
- "sourceMap": true,
14
- "outDir": "./dist",
15
- "rootDir": "./src",
16
- "esModuleInterop": true,
17
- "skipLibCheck": true,
18
- "forceConsistentCasingInFileNames": true
19
- },
20
- "include": ["src/**/*.ts"],
21
- "exclude": ["node_modules", "dist"]
22
- }