Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(web): show the raw tool call only where a card has nothing else

Ethanfe508fc0fae4
diff --git a/apps/web/src/features/rooms/cards/decision-card.test.tsx b/apps/web/src/features/rooms/cards/decision-card.test.tsx
index 79f436b8..61fcd4f8 100644
--- a/apps/web/src/features/rooms/cards/decision-card.test.tsx
+++ b/apps/web/src/features/rooms/cards/decision-card.test.tsx
@@ -1,4 +1,10 @@
-import { fireEvent, render, screen, within } from "@testing-library/react";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ within,
+} from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { DecisionCard, type DecisionMessageCard } from "./decision-card";
@@ -368,19 +374,41 @@ describe("DecisionCard", () => {
expect(values).toHaveClass("font-mono", "whitespace-pre-wrap");
});
- it("shows the tool and full input under Details", () => {
+ it("leaves the raw tool call out when the message or fields show the write", () => {
renderCard(connectorCard());
openSummary();
- fireEvent.click(screen.getByRole("button", { name: "Details" }));
expect(
- screen.getByText("Full call · GMAIL_SEND_EMAIL"),
- ).toBeInTheDocument();
+ screen.queryByRole("button", { name: "Details" }),
+ ).not.toBeInTheDocument();
+ expect(screen.queryByText(/Full call/)).not.toBeInTheDocument();
+
+ cleanup();
+ renderCard(connectorCard(changeDetail));
+ openSummary();
+ expect(screen.queryByText(/Full call/)).not.toBeInTheDocument();
+ });
+
+ it("shows the full call at once for a tool without its own layout", () => {
+ renderCard(
+ connectorCard({
+ account: "octo",
+ app: "github",
+ input: '{\n "owner": "linger",\n "repo": "app"\n}',
+ kind: "change",
+ title: "Run GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
+ tool: "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
+ }),
+ );
+ openSummary();
expect(
- screen.getByText(/"recipient_email": "[email protected]"/),
+ screen.getByText(
+ "Full call · GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
+ ),
).toBeInTheDocument();
+ expect(screen.getByText(/"repo": "app"/)).toBeInTheDocument();
expect(
- screen.getByRole("button", { name: "Hide details" }),
- ).toHaveAttribute("aria-expanded", "true");
+ screen.queryByRole("button", { name: "Details" }),
+ ).not.toBeInTheDocument();
});
it("shows a new Agent's name, description, and collapsed instructions", () => {
diff --git a/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx b/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
index fb9d67af..41c28e21 100644
--- a/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
@@ -1,5 +1,5 @@
import DOMPurify from "dompurify";
-import { ArrowDown01Icon, Attachment01Icon } from "@hugeicons/core-free-icons";
+import { Attachment01Icon } from "@hugeicons/core-free-icons";
import { Fragment, useMemo, useState } from "react";
import { Icon } from "@/components/ui/icon";
@@ -14,34 +14,22 @@ type ConnectorWriteMessage = NonNullable<ConnectorWriteView["message"]>;
type ConnectorWriteField = NonNullable<ConnectorWriteView["fields"]>[number];
/**
- * The full view of one connected app write that TeamHub holds: what will be
- * sent or changed, and the full call under Details. The app and account it
- * acts as read in the card's summary row.
+ * The full view of one connected app write that TeamHub holds: the message or
+ * changed fields for a tool with its own layout, and otherwise the full call,
+ * which is then all there is to see. The app and account it acts as read in
+ * the card's summary row.
*/
export function ConnectorWriteDecisionView({
view,
}: {
view: ConnectorWriteView;
}) {
- const [detailsOpen, setDetailsOpen] = useState(false);
+ const fields = view.fields?.length ? view.fields : undefined;
return (
<>
{view.message ? <MessagePreview message={view.message} /> : null}
- {view.fields?.length ? <ChangeFields fields={view.fields} /> : null}
- <button
- aria-expanded={detailsOpen}
- className="typed-card-tone inline-flex items-center gap-1 self-start text-xs font-medium [border-radius:var(--app-control-radius)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-app-focus"
- onClick={() => setDetailsOpen((open) => !open)}
- type="button"
- >
- <Icon
- className={`transition-transform duration-[var(--app-floating-duration)] motion-reduce:transition-none ${detailsOpen ? "rotate-180" : ""}`}
- icon={ArrowDown01Icon}
- size={14}
- />
- {detailsOpen ? "Hide details" : "Details"}
- </button>
- {detailsOpen ? (
+ {fields ? <ChangeFields fields={fields} /> : null}
+ {!view.message && !fields ? (
<FullCallBlock input={view.input} tool={view.tool} />
) : null}
</>