Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(startup): correct autoRefreshDaemon import alias (@/ -> @omniroute/open-sse) (#3292) (#3335)

Diego Rodrigues de Sa e Souza9535fa52a6ac
diff --git a/src/instrumentation-node.ts b/src/instrumentation-node.ts
index 965b857a8c..cc3bfa9ea4 100755
--- a/src/instrumentation-node.ts
+++ b/src/instrumentation-node.ts
@@ -239,7 +239,9 @@ export async function registerNodejs(): Promise<void> {
}
try {
- const { autoRefreshDaemon } = await import("@/open-sse/services/autoRefreshDaemon");
+ const { autoRefreshDaemon } = await import(
+ "@omniroute/open-sse/services/autoRefreshDaemon"
+ );
autoRefreshDaemon.start();
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
diff --git a/tests/unit/no-src-open-sse-alias.test.ts b/tests/unit/no-src-open-sse-alias.test.ts
new file mode 100644
index 0000000000..28fae19298
--- /dev/null
+++ b/tests/unit/no-src-open-sse-alias.test.ts
@@ -0,0 +1,51 @@
+/**
+ * Regression guard (#3292 / v3.8.13 Electron release fragment).
+ *
+ * `@/*` maps to `src/*`, but the streaming engine lives in the `open-sse/`
+ * workspace (alias `@omniroute/open-sse/*`). So an import of `@/open-sse/...`
+ * resolves to the non-existent `src/open-sse/...` and throws
+ * "Cannot find module '@/open-sse/...'" at runtime in the built standalone.
+ *
+ * This bit the #3292 auto-refresh daemon: `instrumentation-node.ts` did
+ * `await import("@/open-sse/services/autoRefreshDaemon")`. It was caught by a
+ * try/catch (non-fatal), so typecheck and the dev server stayed green, but the
+ * packaged Electron app's strict startup-log smoke test failed on the
+ * "Cannot find module" line. This test fails fast on any such alias.
+ */
+
+import test from "node:test";
+import assert from "node:assert/strict";
+import { readdirSync, readFileSync, statSync } from "node:fs";
+import { join } from "node:path";
+
+const srcRoot = join(import.meta.dirname, "../../src");
+
+function walk(dir: string): string[] {
+ const out: string[] = [];
+ for (const entry of readdirSync(dir)) {
+ const full = join(dir, entry);
+ if (statSync(full).isDirectory()) {
+ out.push(...walk(full));
+ } else if (/\.(ts|tsx|js|mjs)$/.test(entry)) {
+ out.push(full);
+ }
+ }
+ return out;
+}
+
+test("src/ never imports the open-sse workspace via the @/ alias (use @omniroute/open-sse)", () => {
+ const offenders: string[] = [];
+ for (const file of walk(srcRoot)) {
+ const src = readFileSync(file, "utf8");
+ // matches from "@/open-sse/... and import("@/open-sse/...
+ if (/["'`]@\/open-sse\//.test(src)) {
+ const line = src.split("\n").findIndex((l) => /["'`]@\/open-sse\//.test(l)) + 1;
+ offenders.push(`${file.replace(srcRoot, "src")}:${line}`);
+ }
+ }
+ assert.deepEqual(
+ offenders,
+ [],
+ `@/open-sse/* resolves to the non-existent src/open-sse/* and throws "Cannot find module" at runtime. Use @omniroute/open-sse/* instead. Offenders:\n${offenders.join("\n")}`
+ );
+});