refactor(auth): remove agent user header

This commit is contained in:
2026-06-12 10:18:41 +08:00
parent 877b79ada8
commit bb7311589c
8 changed files with 30 additions and 51 deletions
+14 -7
View File
@@ -84,6 +84,12 @@ export type StreamEvent =
detail?: string;
totalDurationMs?: number;
}
| {
type: "auth_required";
sessionId?: string;
reason?: string;
message: string;
}
| {
type: "tool_call";
sessionId: string;
@@ -303,6 +309,7 @@ const emitParsedStreamEvent = (
rejected?: boolean;
message_id?: string;
todos?: unknown;
reason?: string;
};
if (event === "state") {
onEvent({
@@ -352,6 +359,13 @@ const emitParsedStreamEvent = (
detail: parsed.detail,
totalDurationMs: parsed.total_duration_ms,
});
} else if (event === "auth_required") {
onEvent({
type: "auth_required",
sessionId: parsed.session_id,
reason: parsed.reason,
message: parsed.message ?? "登录态已过期,请刷新登录后重试",
});
} else if (event === "tool_call") {
onEvent({
type: "tool_call",
@@ -478,7 +492,6 @@ export const streamAgentChat = async ({
approval_mode: approvalMode,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
},
);
@@ -530,7 +543,6 @@ export const resumeAgentChatStream = async ({
Accept: "text/event-stream",
},
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
},
);
@@ -573,7 +585,6 @@ export const abortAgentChat = async (sessionId?: string) => {
session_id: sessionId,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
});
@@ -600,7 +611,6 @@ export const replyAgentPermission = async (
reply,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
},
);
@@ -628,7 +638,6 @@ export const replyAgentQuestion = async (
answers,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
},
);
@@ -654,7 +663,6 @@ export const rejectAgentQuestion = async (
session_id: sessionId,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
},
);
@@ -676,7 +684,6 @@ export const forkAgentChat = async (sessionId: string | undefined, keepMessageCo
keep_message_count: keepMessageCount,
}),
projectHeaderMode: "include",
userHeaderMode: "include",
skipAuthRedirect: true,
});