mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 16:30:47 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
85
openclaw/test/scripts/bundle-a2ui.test.ts
Normal file
85
openclaw/test/scripts/bundle-a2ui.test.ts
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
compareNormalizedPaths,
|
||||
getBundleHashInputPaths,
|
||||
getBundleHashRepoInputPaths,
|
||||
getLocalRolldownCliCandidates,
|
||||
getResolvedBundleDependencyPackageJsonPaths,
|
||||
isBundleHashInputPath,
|
||||
} from "../../scripts/bundle-a2ui.mjs";
|
||||
|
||||
describe("scripts/bundle-a2ui.mjs", () => {
|
||||
it("keeps generated renderer output out of bundle hash inputs", () => {
|
||||
const repoRoot = path.resolve("repo-root");
|
||||
|
||||
expect(
|
||||
isBundleHashInputPath(
|
||||
path.join(repoRoot, "vendor", "a2ui", "renderers", "lit", "src", "index.ts"),
|
||||
repoRoot,
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isBundleHashInputPath(
|
||||
path.join(repoRoot, "vendor", "a2ui", "renderers", "lit", "dist"),
|
||||
repoRoot,
|
||||
),
|
||||
).toBe(false);
|
||||
expect(
|
||||
isBundleHashInputPath(
|
||||
path.join(repoRoot, "vendor", "a2ui", "renderers", "lit", "dist", "src", "index.js"),
|
||||
repoRoot,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("prefers the installed rolldown CLI over a network dlx fallback", () => {
|
||||
const repoRoot = path.resolve("repo-root");
|
||||
|
||||
expect(getLocalRolldownCliCandidates(repoRoot)[0]).toBe(
|
||||
path.join(repoRoot, "node_modules", "rolldown", "bin", "cli.mjs"),
|
||||
);
|
||||
});
|
||||
|
||||
it("sorts hash inputs without locale-dependent collation", () => {
|
||||
const paths = ["repo/Z.ts", "repo/a.ts", "repo/ä.ts", "repo/A.ts"];
|
||||
|
||||
expect([...paths].toSorted(compareNormalizedPaths)).toEqual([
|
||||
"repo/A.ts",
|
||||
"repo/Z.ts",
|
||||
"repo/a.ts",
|
||||
"repo/ä.ts",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps repo-root package churn out of bundle hash inputs", () => {
|
||||
const repoRoot = path.resolve("repo-root");
|
||||
const inputPaths = getBundleHashRepoInputPaths(repoRoot);
|
||||
|
||||
expect(inputPaths).toContain(path.join(repoRoot, "ui", "package.json"));
|
||||
expect(inputPaths).not.toContain(path.join(repoRoot, "package.json"));
|
||||
expect(inputPaths).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
});
|
||||
|
||||
it("tracks only the resolved bundle dependency manifests from node_modules", () => {
|
||||
const repoRoot = process.cwd();
|
||||
const dependencyPaths = getResolvedBundleDependencyPackageJsonPaths(repoRoot);
|
||||
const relativeDependencyPaths = dependencyPaths.map((dependencyPath) =>
|
||||
path.relative(repoRoot, dependencyPath).replaceAll(path.sep, "/"),
|
||||
);
|
||||
|
||||
expect(
|
||||
relativeDependencyPaths.map((relativePath) => relativePath.replace(/^ui\//u, "")),
|
||||
).toEqual([
|
||||
path.posix.join("node_modules", "lit", "package.json"),
|
||||
path.posix.join("node_modules", "@lit/context", "package.json"),
|
||||
path.posix.join("node_modules", "@lit-labs/signals", "package.json"),
|
||||
path.posix.join("node_modules", "signal-utils", "package.json"),
|
||||
]);
|
||||
expect(
|
||||
relativeDependencyPaths.every((relativePath) => /^(ui\/)?node_modules\//u.test(relativePath)),
|
||||
).toBe(true);
|
||||
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "package.json"));
|
||||
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue