Integrate master agent runtime orchestration updates

This commit is contained in:
kris
2026-04-16 04:41:46 +08:00
parent e0c0ea1814
commit 39be49630f
81 changed files with 9283 additions and 448 deletions

View File

@@ -15,6 +15,8 @@ let completeMasterTaskRoute: (typeof import("../src/app/api/v1/master-agent/task
let applyImportDraftRoute: (typeof import("../src/app/api/v1/devices/[deviceId]/import-draft/apply/route"))["POST"];
let createAuthSession: (typeof import("../src/lib/boss-data"))["createAuthSession"];
let readState: (typeof import("../src/lib/boss-data"))["readState"];
let saveAiAccount: (typeof import("../src/lib/boss-data"))["saveAiAccount"];
let updateProjectAgentControls: (typeof import("../src/lib/boss-data"))["updateProjectAgentControls"];
let AUTH_SESSION_COOKIE = "";
async function setup() {
@@ -46,6 +48,8 @@ async function setup() {
applyImportDraftRoute = applyModule.POST;
createAuthSession = data.createAuthSession;
readState = data.readState;
saveAiAccount = data.saveAiAccount;
updateProjectAgentControls = data.updateProjectAgentControls;
AUTH_SESSION_COOKIE = auth.AUTH_SESSION_COOKIE;
}
@@ -85,6 +89,25 @@ async function createAuthedRequestFor(
test("device import draft review queues only the resolution task, then completion writes back a ready resolution and apply still works", async () => {
await setup();
await saveAiAccount({
accountId: "master-codex-device-import-policy",
label: "主 GPT",
role: "primary",
provider: "master_codex_node",
displayName: "Mac 上的 Master Codex Node",
nodeId: "local-codex-node",
nodeLabel: "本机 Codex",
model: "gpt-5.4-mini",
enabled: true,
setActive: true,
loginStatusNote: "用于设备导入深度任务模型策略测试。",
});
await updateProjectAgentControls("master-agent", {
fastModelOverride: "gpt-5.4-mini",
fastReasoningEffortOverride: "low",
smartModelOverride: "gpt-5.4",
smartReasoningEffortOverride: "high",
});
const enrollmentResponse = await createEnrollmentRoute(
await createAuthedRequest("http://127.0.0.1:3000/api/v1/devices/enrollments", "POST", {
@@ -200,6 +223,8 @@ test("device import draft review queues only the resolution task, then completio
task.status === "queued",
);
assert.ok(resolutionTask, "expected import review to leave a queued master-agent task trace");
assert.equal(resolutionTask?.executionModel, "gpt-5.4");
assert.equal(resolutionTask?.executionReasoningEffort, "high");
const understandingTask = reviewedState.masterAgentTasks.find(
(task) =>
task.taskType === "conversation_reply" &&