feat(agent): 完善权限与结果引用安全
This commit is contained in:
@@ -61,6 +61,34 @@ describe("Agent REST OpenAPI", () => {
|
||||
expect(document.paths["/api/v1/agent/chat/stream"]).toBeUndefined();
|
||||
});
|
||||
|
||||
test("separates automatic approval from persistent permission grants", () => {
|
||||
const document = generateAgentOpenApi();
|
||||
const runRequest = document.paths["/api/v1/agent/sessions/{session_id}/runs"]
|
||||
?.post?.requestBody;
|
||||
const permissionRequest = document.paths[
|
||||
"/api/v1/agent/sessions/{session_id}/permission-responses"
|
||||
]?.post?.requestBody;
|
||||
|
||||
expect(
|
||||
runRequest && !("$ref" in runRequest)
|
||||
? runRequest.content["application/json"]?.schema
|
||||
: undefined,
|
||||
).toMatchObject({
|
||||
properties: {
|
||||
approval_mode: { enum: ["request", "auto", "always"] },
|
||||
},
|
||||
});
|
||||
expect(
|
||||
permissionRequest && !("$ref" in permissionRequest)
|
||||
? permissionRequest.content["application/json"]?.schema
|
||||
: undefined,
|
||||
).toMatchObject({
|
||||
properties: {
|
||||
reply: { enum: ["once", "always", "reject"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("matches the public session runtime response shapes", () => {
|
||||
const document = generateAgentOpenApi();
|
||||
const schemas = document.components?.schemas ?? {};
|
||||
|
||||
Reference in New Issue
Block a user