fix: harden production chat runtime

This commit is contained in:
kris
2026-03-31 20:20:07 +08:00
parent ec7081f6cc
commit 02fcc56332
12 changed files with 310 additions and 11 deletions

View File

@@ -316,6 +316,15 @@ export interface DispatchExecution {
completedByDeviceId?: string;
}
function buildCollaborationGate(project: Pick<Project, "isGroup" | "collaborationMode" | "approvalState">) {
return {
isGroup: project.isGroup,
collaborationMode: project.collaborationMode,
requiresMasterAgentApproval: project.isGroup && project.collaborationMode === "approval_required",
approvalState: project.approvalState,
};
}
export interface ProjectAgentControls {
modelOverride?: string;
reasoningEffortOverride?: ReasoningEffort;
@@ -4395,6 +4404,7 @@ export async function rejectDispatchPlan(input: {
return {
plan: { ...plan },
notice: notice ? { ...notice } : null,
collaborationGate: buildCollaborationGate(groupProject),
};
});
@@ -4659,6 +4669,7 @@ export async function confirmDispatchPlanAndCreateExecutions(input: {
plan: { ...plan },
executions: executions.map((execution) => ({ ...execution })),
notice: createdNotice ? { ...createdNotice } : null,
collaborationGate: buildCollaborationGate(groupProject),
};
});