refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries
This commit is contained in:
1 parent
3f1c6d02f6
commit
27c0f27434
268 files changed
+7468
-7852
No files matched your search
@@ -14,7 +14,7 @@ import { createE2E, type E2E, pgAvailable, runEvents, runRow, waitFor } from "./
|
||||
// 运行(凭证只经环境变量传入,不写进代码与报告):
|
||||
// UMT_EVAL_REAL=1 UMT_EVAL_API_KEY=… UMT_EVAL_PROVIDER=opencode-go UMT_EVAL_MODEL=deepseek-v4.1-flash \
|
||||
// UMT_EVAL_LEGACY_PROMPT=/tmp/legacy-system-prompt.ts UMT_EVAL_CASES=health,acquire,why UMT_EVAL_OUT=/tmp/eval.json \
|
||||
// DATABASE_URL=… deno run -A npm:vitest run test/e2e/agent-prompt-eval.real.test.ts
|
||||
// DATABASE_URL=… bun --bun x vitest run test/e2e/agent-prompt-eval.real.test.ts
|
||||
// UMT_EVAL_LEGACY_PROMPT 用 `git show main:packages/agent/src/system-prompt.ts > /tmp/legacy-system-prompt.ts` 生成;
|
||||
// UMT_EVAL_PROMPTS=legacy,layered 控制跑哪几组(缺省两组都跑)。
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ describe.skipIf(!hasPg)("E4 崩溃恢复(worker 子进程 kill -9)", () => {
|
||||
const children: ChildProcess[] = [];
|
||||
|
||||
const spawnWorker = (): Promise<ChildProcess> => {
|
||||
const child = spawn(process.execPath, ["run", "-A", WORKER], {
|
||||
const child = spawn(process.execPath, [WORKER], {
|
||||
cwd: SERVER_DIR,
|
||||
env: {
|
||||
...process.env,
|
||||
|
||||
@@ -11,17 +11,17 @@ import { startWorker } from "../../../src/worker/index.ts";
|
||||
import { buildModules } from "./modules.ts";
|
||||
import { crashScript } from "./scripts.ts";
|
||||
|
||||
const url = Deno.env.get("DATABASE_URL") ?? "postgres://umt:umt@localhost:55433/umt";
|
||||
const biz = Deno.env.get("BIZ_SCHEMA")!;
|
||||
const ow = Deno.env.get("OW_SCHEMA")!;
|
||||
const sessionDir = Deno.env.get("SESSION_DIR")!;
|
||||
const url = process.env.DATABASE_URL ?? "postgres://umt:umt@localhost:55433/umt";
|
||||
const biz = process.env.BIZ_SCHEMA!;
|
||||
const ow = process.env.OW_SCHEMA!;
|
||||
const sessionDir = process.env.SESSION_DIR!;
|
||||
await import("@umt/db"); // 注册 int8 解析器
|
||||
const db = new Kysely<DB>({
|
||||
dialect: new PostgresDialect({
|
||||
pool: new pg.Pool({ connectionString: url, max: 8, options: `-c search_path=${biz},public` }),
|
||||
}),
|
||||
});
|
||||
const logger = createLogger({ level: Deno.env.get("E2E_LOG_LEVEL") === "debug" ? "debug" : "warn" });
|
||||
const logger = createLogger({ level: process.env.E2E_LOG_LEVEL === "debug" ? "debug" : "warn" });
|
||||
const config = ConfigSchema.parse({
|
||||
DATABASE_URL: url,
|
||||
SECRET_MASTER_KEY: "e2e-master-key-0123456789",
|
||||
@@ -43,10 +43,10 @@ const worker = await startWorker({
|
||||
agentConcurrency: 2,
|
||||
},
|
||||
});
|
||||
console.log(`worker ready pid=${Deno.pid}`);
|
||||
Deno.addSignalListener("SIGTERM", async () => {
|
||||
console.log(`worker ready pid=${process.pid}`);
|
||||
process.on("SIGTERM", async () => {
|
||||
await worker.stop().catch(() => {});
|
||||
await booted.engine.stop().catch(() => {});
|
||||
await db.destroy().catch(() => {});
|
||||
Deno.exit(0);
|
||||
process.exit(0);
|
||||
});
|
||||
@@ -52,7 +52,7 @@ const mockFetch = (async (input: string | URL | Request, init?: RequestInit) =>
|
||||
if (url.href === NOTICE_URL)
|
||||
return new Response(NOTICE_HTML, { headers: { "content-type": "text/html; charset=utf-8" } });
|
||||
return new Response("not found", { status: 404 });
|
||||
}) as typeof fetch;
|
||||
}) as (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
||||
|
||||
const resolveHost = async (host: string) => (host.endsWith("example.org") ? ["93.184.216.34"] : ["203.0.114.10"]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user