fix: make workspace export runtime-safe

This commit is contained in:
2026-03-28 16:41:55 +08:00
parent ca5aa0020a
commit 709d997e59
4 changed files with 26 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
export declare const AGENT_RUNTIME_PACKAGE = "agent-runtime";
+1
View File
@@ -0,0 +1 @@
export const AGENT_RUNTIME_PACKAGE = "agent-runtime";
+4 -1
View File
@@ -4,6 +4,9 @@
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts"
".": {
"types": "./index.d.ts",
"default": "./index.js"
}
}
}
+20
View File
@@ -1,8 +1,28 @@
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { describe, expect, it } from "vitest";
import { AGENT_RUNTIME_PACKAGE } from "@aiquant/agent-runtime";
const execFileAsync = promisify(execFile);
describe("workspace smoke test", () => {
it("resolves cross-workspace package exports", () => {
expect(AGENT_RUNTIME_PACKAGE).toBe("agent-runtime");
});
it("allows plain node to import the workspace package", async () => {
const { stdout } = await execFileAsync(
process.execPath,
[
"--input-type=module",
"--eval",
"import('@aiquant/agent-runtime').then((mod) => console.log(mod.AGENT_RUNTIME_PACKAGE));",
],
{
cwd: new URL("..", import.meta.url),
},
);
expect(stdout.trim()).toBe("agent-runtime");
});
});