This commit is contained in:
ZacharyZhang-NY committed 2026-03-18 17:49:10 -04:00
1 parent 48daca9ba0
commit 53e0f03c0c
13 files changed
+509 -125

No files matched your search

+17
View File
@@ -2,6 +2,7 @@ import { createServer, type IncomingMessage, type ServerResponse } from "node:ht
import log from "electron-log/main.js";
import { z } from "zod";
import { agentMessageInputSchema, approvalInputSchema, goalInputSchema, hireRequestSchema, projectInputSchema, taskInputSchema } from "@shared/contracts";
import { getConnectorExecutionReadinessIssue } from "@shared/connector-policy";
import { validateAgentToken, type TokenPayload } from "./agent-auth";
import { canAssignTask, canControlAgent, canManageGoal, canManageOrganization, canManageProject, canUpdateTask } from "./agent-permissions";
import { resolveApprovalDecision, shouldAutoApproveApproval } from "./approval-policy";
@@ -756,6 +757,22 @@ export class AgentApiServer {
])) {
return;
}
const connectorRecord = (() => {
try {
return this.db.getConnector(input.connectorId);
} catch {
return null;
}
})();
if (!connectorRecord) {
this.json(res, 422, { error: "The selected connector does not exist." });
return;
}
const connectorIssue = getConnectorExecutionReadinessIssue(connectorRecord);
if (connectorIssue) {
this.json(res, 422, { error: connectorIssue });
return;
}
const managerLabel = input.reportsTo
? (() => {