feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -547,6 +547,28 @@ describe("streamPromptResponse", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("streams native tool identity and sanitized full inputs with progress", async () => {
|
||||
const address = "完整地址".repeat(70);
|
||||
const runtime = {
|
||||
subscribeEvents: async () => createEventStream([
|
||||
{ type: "message.part.updated", properties: { sessionID: "runtime-session-1", part: {
|
||||
id: "tool-part", sessionID: "runtime-session-1", messageID: "message-1", type: "tool",
|
||||
callID: "native-call", tool: "mcp_tjwater_geocode", state: {
|
||||
status: "completed", input: { address, api_key: "private-value" }, output: "done", time: { start: Date.now(), end: Date.now() }
|
||||
}
|
||||
} } },
|
||||
{ type: "session.idle", properties: { sessionID: "runtime-session-1" } }
|
||||
]),
|
||||
prompt: async () => undefined,
|
||||
messages: async () => []
|
||||
} as unknown as OpencodeRuntimeAdapter;
|
||||
const events: Array<{ event: string; data: Record<string, unknown> }> = [];
|
||||
await streamPromptResponse({ runtime, sessionId: "runtime-session-1", clientSessionId: "client-session-1", message: "定位", write: (event, data) => events.push({ event, data }) });
|
||||
const progress = events.find((item) => item.event === "progress" && item.data.id === "tool-part");
|
||||
expect(progress?.data.tool).toEqual({ name: "mcp_tjwater_geocode", call_id: "native-call", input: { address, api_key: "[redacted]" } });
|
||||
expect(progress?.data.detail).not.toContain("private-value");
|
||||
});
|
||||
|
||||
it("converts question tool parts into question request SSE payloads", async () => {
|
||||
const runtime = {
|
||||
subscribeEvents: async () =>
|
||||
|
||||
Reference in New Issue
Block a user