fix(api): require api server callbacks

This commit is contained in:
ZacharyZhang-NY committed 2026-04-22 14:27:49 -04:00
1 parent 529bb109db
commit 5155136937
9 files changed
+103 -59

No files matched your search

@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from "vitest";
import { createAgentToken, initializeAgentTokenSigningKey } from "../../src/main/agent-auth";
import { createApiServer } from "../../src/main/api-server";
import { AppDatabase } from "../../src/main/database";
import { createTestApiServerCallbacks } from "../support/api-server-callbacks";
const tempDirs: string[] = [];
@@ -83,7 +84,7 @@ async function createHarness() {
});
const run = db.runs.createRun({ companyId, taskId, agentId: ctoId, workspaceId, connectorId: "openai-codex" });
const token = createAgentToken(ctoId, companyId, run.id);
const server = createApiServer(db, () => {}, () => null);
const server = createApiServer(db, createTestApiServerCallbacks());
const port = await server.start();
return {
+2 -1
View File
@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from "vitest";
import { createAgentToken, initializeAgentTokenSigningKey } from "../../src/main/agent-auth";
import { createApiServer } from "../../src/main/api-server";
import { AppDatabase } from "../../src/main/database";
import { createTestApiServerCallbacks } from "../support/api-server-callbacks";
const tempDirs: string[] = [];
@@ -57,7 +58,7 @@ async function createHarness() {
});
const run = db.runs.createRun({ companyId, taskId, agentId, workspaceId, connectorId: "openai-codex" });
const token = createAgentToken(agentId, companyId, run.id);
const server = createApiServer(db, () => {}, () => null);
const server = createApiServer(db, createTestApiServerCallbacks());
const port = await server.start();
return {
@@ -7,6 +7,7 @@ import { createApiServer } from "../../src/main/api-server";
import { AppDatabase } from "../../src/main/database";
import { processRunCompletion } from "../../src/main/automation/automation-run-completion";
import { createDocumentWithLifecycle } from "../../src/main/document-lifecycle";
import { createTestApiServerCallbacks } from "../support/api-server-callbacks";
const tempDirs: string[] = [];
@@ -92,7 +93,7 @@ async function createHarness() {
const token = createAgentToken(agentId, companyId, run.id);
const silentLogger = { warn: () => {}, error: () => {} };
const noopLifecycleProcessor = { drainForDocument: () => {} };
const server = createApiServer(db, () => {}, () => null, {
const server = createApiServer(db, createTestApiServerCallbacks({
createDocument: (input) =>
createDocumentWithLifecycle(
{
@@ -107,7 +108,7 @@ async function createHarness() {
},
input,
),
});
}));
const port = await server.start();
return {