feat(agent): 完善权限与结果引用安全
This commit is contained in:
@@ -129,4 +129,31 @@ describe("OpencodeRuntimeAdapter.warmup", () => {
|
||||
"session.delete:warmup-session",
|
||||
]);
|
||||
});
|
||||
|
||||
it("submits question answers through the stable question API", async () => {
|
||||
const calls: unknown[] = [];
|
||||
const client = {
|
||||
question: {
|
||||
reply: async (input: unknown) => {
|
||||
calls.push(input);
|
||||
return { data: { ok: true } };
|
||||
},
|
||||
},
|
||||
} as unknown as OpencodeClient;
|
||||
const runtime = Object.assign(Object.create(OpencodeRuntimeAdapter.prototype), {
|
||||
clientPromise: null,
|
||||
closeServer: null,
|
||||
ensureClient: async () => client,
|
||||
}) as OpencodeRuntimeAdapter;
|
||||
|
||||
await runtime.replyQuestion({
|
||||
requestId: "question-1",
|
||||
sessionId: "session-1",
|
||||
answers: [["继续"]],
|
||||
});
|
||||
|
||||
expect(calls).toEqual([
|
||||
{ requestID: "question-1", answers: [["继续"]] },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user