


























@@ -1000,44 +1000,6 @@ describe("chat view", () => {
10001000expect(container.textContent).not.toContain("Opened page");
10011001});
100210021003-it("auto-expands new tool cards inline when the preference is enabled", () => {
1004-const container = document.createElement("div");
1005-render(
1006-renderChat(
1007-createProps({
1008-autoExpandToolCalls: true,
1009-messages: [
1010-{
1011-id: "assistant-2",
1012-role: "assistant",
1013-toolCallId: "call-2",
1014-content: [
1015-{
1016-type: "toolcall",
1017-id: "call-2",
1018-name: "browser.open",
1019-arguments: { url: "https://example.com" },
1020-},
1021-{
1022-type: "toolresult",
1023-id: "call-2",
1024-name: "browser.open",
1025-text: "Opened page",
1026-},
1027-],
1028-timestamp: Date.now(),
1029-},
1030-],
1031-}),
1032-),
1033-container,
1034-);
1035-1036-expect(container.textContent).toContain("Tool input");
1037-expect(container.textContent).toContain("Tool output");
1038-expect(container.textContent).toContain("https://example.com");
1039-});
1040-10411003it("expands already-visible tool cards when auto-expand is turned on", () => {
10421004const container = document.createElement("div");
10431005const baseProps = createProps({
@@ -1073,84 +1035,6 @@ describe("chat view", () => {
10731035expect(container.textContent).toContain("Tool output");
10741036});
107510371076-it("lets an auto-expanded tool call collapse again from the summary row", async () => {
1077-const container = document.createElement("div");
1078-const props = createProps({
1079-autoExpandToolCalls: true,
1080-messages: [
1081-{
1082-id: "assistant-3b",
1083-role: "assistant",
1084-toolCallId: "call-3b",
1085-content: [
1086-{
1087-type: "toolcall",
1088-id: "call-3b",
1089-name: "browser.open",
1090-arguments: { url: "https://example.com" },
1091-},
1092-{
1093-type: "toolresult",
1094-id: "call-3b",
1095-name: "browser.open",
1096-text: "Opened page",
1097-},
1098-],
1099-timestamp: Date.now(),
1100-},
1101-],
1102-});
1103-1104-const rerender = () => {
1105-render(renderChat({ ...props, onRequestUpdate: rerender }), container);
1106-};
1107-rerender();
1108-1109-expect(container.textContent).toContain("Tool input");
1110-expect(container.textContent).toContain("Opened page");
1111-1112-container
1113-.querySelector<HTMLElement>(".chat-tool-msg-summary")
1114-?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
1115-await flushTasks();
1116-1117-expect(container.textContent).not.toContain("Tool input");
1118-expect(container.textContent).not.toContain("Opened page");
1119-});
1120-1121-it("keeps expanded input-only tool calls from rendering a redundant output block", () => {
1122-const container = document.createElement("div");
1123-render(
1124-renderChat(
1125-createProps({
1126-autoExpandToolCalls: true,
1127-messages: [
1128-{
1129-id: "assistant-4",
1130-role: "assistant",
1131-toolCallId: "call-4",
1132-content: [
1133-{
1134-type: "toolcall",
1135-id: "call-4",
1136-name: "sessions_spawn",
1137-arguments: { mode: "session", thread: true },
1138-},
1139-],
1140-timestamp: Date.now(),
1141-},
1142-],
1143-}),
1144-),
1145-container,
1146-);
1147-1148-expect(container.textContent).toContain("Tool input");
1149-expect(container.textContent).toContain('"thread": true');
1150-expect(container.textContent).not.toContain("Tool output");
1151-expect(container.textContent).not.toContain("No output");
1152-});
1153-11541038it("routes standalone tool-call rows through the same top-level disclosure as tool output", async () => {
11551039const container = document.createElement("div");
11561040const props = createProps({
@@ -1244,42 +1128,6 @@ describe("chat view", () => {
12441128expect(container.textContent).toContain('"childSessionKey": "agent:test:subagent:abc123"');
12451129});
124611301247-it("does not render tool-row canvas previews", () => {
1248-const container = document.createElement("div");
1249-render(
1250-renderChat(
1251-createProps({
1252-autoExpandToolCalls: true,
1253-messages: [
1254-{
1255-id: "tool-anki-1",
1256-role: "tool",
1257-toolCallId: "call-anki-1",
1258-toolName: "canvas_render",
1259-content: JSON.stringify({
1260-kind: "canvas",
1261-source: {
1262-type: "html",
1263-content: "<div>Front card</div>",
1264-},
1265-presentation: {
1266-target: "tool_card",
1267-title: "Status view",
1268-},
1269-}),
1270-timestamp: Date.now(),
1271-},
1272-],
1273-}),
1274-),
1275-container,
1276-);
1277-1278-expect(container.querySelector(".chat-tool-card__preview-frame")).toBeNull();
1279-expect(container.textContent).toContain("Status view");
1280-expect(container.textContent).toContain("Tool output");
1281-});
1282-12831131it("renders [embed] shortcodes inside the assistant bubble", () => {
12841132const container = document.createElement("div");
12851133render(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。