mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 00:43:18 +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
58
openclaw/scripts/test-force.ts
Normal file
58
openclaw/scripts/test-force.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env -S node --import tsx
|
||||
import { spawnSync } from "node:child_process";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { forceFreePort, type PortProcess } from "../src/cli/ports.js";
|
||||
import { resolveGatewayPort } from "../src/config/config.js";
|
||||
|
||||
function killGatewayListeners(port: number): PortProcess[] {
|
||||
try {
|
||||
const killed = forceFreePort(port);
|
||||
if (killed.length > 0) {
|
||||
console.log(
|
||||
`freed port ${port}; terminated: ${killed
|
||||
.map((p) => `${p.command} (pid ${p.pid})`)
|
||||
.join(", ")}`,
|
||||
);
|
||||
} else {
|
||||
console.log(`port ${port} already free`);
|
||||
}
|
||||
return killed;
|
||||
} catch (err) {
|
||||
console.error(`failed to free port ${port}: ${String(err)}`);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
const isolatedLock =
|
||||
process.env.OPENCLAW_GATEWAY_LOCK ??
|
||||
path.join(os.tmpdir(), `openclaw-gateway.lock.test.${Date.now()}`);
|
||||
const result = spawnSync(process.execPath, ["scripts/test-projects.mjs"], {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCLAW_GATEWAY_LOCK: isolatedLock,
|
||||
},
|
||||
});
|
||||
if (result.error) {
|
||||
console.error(`test runner failed to start: ${String(result.error)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
|
||||
function main() {
|
||||
const port = resolveGatewayPort(undefined, process.env);
|
||||
|
||||
console.log(`🧹 test:force - clearing gateway on port ${port}`);
|
||||
const killed = killGatewayListeners(port);
|
||||
if (killed.length === 0) {
|
||||
console.log("no listeners to kill");
|
||||
}
|
||||
|
||||
console.log("running pnpm test…");
|
||||
runTests();
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue