feat(agent): Agent 生成审批 - 支持改模型参数、忽略位置漂移并取消 8 轮硬限制

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ddCat
2026-09-16 22:59:38 +08:00
parent f394cd7385
commit fc5548836f
21 changed files with 930 additions and 66 deletions

View File

@@ -65,6 +65,14 @@ function observe(options: { timeoutMs?: number; after?: number } = {}) {
}
describe("Agent SSE recovery", () => {
it("sends the user's final image settings with the approval and keeps cancellation", async () => {
const requests: unknown[][] = [];
transport.http.post = async (...args: unknown[]) => { requests.push(args); return { accepted: true }; };
const signal = new AbortController().signal;
const mediaSettings = { logicalModelId: "chosen-image", size: "1536x1024", quality: "high" };
await api.decideAgentApproval("run/id", "approval/id", "approve", "", signal, mediaSettings);
expect(requests).toEqual([["/agent/runs/run%2Fid/approvals/approval%2Fid/decision", { decision: "approve", reason: undefined, mediaSettings }, { signal }]]);
});
it.each([401, 403, 404, 422])("stops immediately on definitive %s", async (status) => {
let requests = 0;
globalThis.fetch = (async () => { requests++; return new Response("", { status }); }) as typeof fetch;