Skip to content

Commit 4bbb75d

Browse files
committed
docs(showcase): clean noise from sibling snippets across all frameworks
Sweep across all `.snippet.*` files (existing + new in this branch) to remove non-teaching content that distracts from the docs-page render. Changes: - 6 files (5 hitl + 1 tool-rendering): replace `(props: any)` + `eslint-disable-next-line @typescript-eslint/no-explicit-any` with proper structural prop types. Reads identical to the eye but no lint suppression in the rendered snippet. - 1 file (state-streaming-middleware.snippet.py): drop 2 `# type: ignore[name-defined]` markers. The stand-in identifiers (`write_document`, `AgentState`) already read as docs-only references. - 1 file (delegation-log-frontend.snippet.tsx, BIA): rewrite the in-region JSDoc to be framework-agnostic. The file was ported from ag2 and still named `AG2 sub-agent` + referenced `ReplyResult` / `ContextVariables` in the BIA copy. Also drop a historical bug-fix note ("Per-status color map…") that is irrelevant outside ag2's commit history. - 2 files (use-rendered-messages.snippet.tsx, google-adk + llamaindex): strip brittle internal-path references (`packages/react-core/src/v2/.../ CopilotChatMessageView.tsx:542-612`, `react-core/v2/components/chat/ CopilotChatToolCallsView.tsx`) that would rot within months. Replaced with conceptual references to the public component name only. No region markers changed; audit still reports B-docs-gap: 0.
1 parent 6ba139f commit 4bbb75d

10 files changed

Lines changed: 54 additions & 38 deletions

File tree

showcase/integrations/agno/src/app/demos/hitl-in-chat/hitl-hook-and-time-slots.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ declare const TimePickerCard: React.ComponentType<{
2323
onSubmit: (result: unknown) => void;
2424
}>;
2525

26+
type BookCallRenderProps = {
27+
args?: { topic?: string; attendee?: string };
28+
status: string;
29+
respond?: (result: unknown) => void;
30+
};
31+
2632
// @region[time-slots]
2733
const DEFAULT_SLOTS: TimeSlot[] = [
2834
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
@@ -46,8 +52,7 @@ export function HitlBookingHook() {
4652
.string()
4753
.describe("Who the call is with (e.g. 'Alice from Sales')"),
4854
}),
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
render: ({ args, status, respond }: any) => (
55+
render: ({ args, status, respond }: BookCallRenderProps) => (
5156
<TimePickerCard
5257
topic={args?.topic ?? "a call"}
5358
attendee={args?.attendee}

showcase/integrations/built-in-agent/src/app/demos/hitl/hitl-hook-and-time-slots.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ declare const TimePickerCard: React.ComponentType<{
2323
onSubmit: (result: unknown) => void;
2424
}>;
2525

26+
type BookCallRenderProps = {
27+
args?: { topic?: string; attendee?: string };
28+
status: string;
29+
respond?: (result: unknown) => void;
30+
};
31+
2632
// @region[time-slots]
2733
const DEFAULT_SLOTS: TimeSlot[] = [
2834
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
@@ -46,8 +52,7 @@ export function HitlBookingHook() {
4652
.string()
4753
.describe("Who the call is with (e.g. 'Alice from Sales')"),
4854
}),
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
render: ({ args, status, respond }: any) => (
55+
render: ({ args, status, respond }: BookCallRenderProps) => (
5156
<TimePickerCard
5257
topic={args?.topic ?? "a call"}
5358
attendee={args?.attendee}

showcase/integrations/built-in-agent/src/app/demos/shared-state-streaming/state-streaming-middleware.snippet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# @region[state-streaming-middleware]
1717
graph = create_agent(
1818
model=ChatOpenAI(model="gpt-4o-mini"),
19-
tools=[write_document], # type: ignore[name-defined]
19+
tools=[write_document],
2020
middleware=[
2121
CopilotKitMiddleware(),
2222
# Forward every token of write_document's `content` argument
@@ -31,7 +31,7 @@
3131
)
3232
),
3333
],
34-
state_schema=AgentState, # type: ignore[name-defined]
34+
state_schema=AgentState,
3535
system_prompt=(
3636
"You are a collaborative writing assistant. Whenever the user asks "
3737
"you to write, draft, or revise any piece of text, ALWAYS call the "

showcase/integrations/built-in-agent/src/app/demos/subagents/delegation-log-frontend.snippet.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ const SUB_AGENT_STYLE: Record<
5151
},
5252
};
5353

54-
// Per-status color map. A `failed` delegation must be visually distinct
55-
// from `completed` — rendering "failed" in green (the prior behaviour)
56-
// made errors silently look successful.
5754
const STATUS_BADGE: Record<Delegation["status"], string> = {
5855
running: "text-[#5B5BD6]",
5956
completed: "text-[#189370]",
@@ -64,11 +61,10 @@ const STATUS_BADGE: Record<Delegation["status"], string> = {
6461
/**
6562
* Live delegation log — renders the `delegations` slot of agent state.
6663
*
67-
* Each entry corresponds to one invocation of an AG2 sub-agent. The list
68-
* grows in real time as the supervisor fans work out to its children;
69-
* each delegation is appended via the supervisor's tool returning a
70-
* ReplyResult with updated ContextVariables, which AG-UI surfaces to
71-
* the UI through agent state.
64+
* Each entry corresponds to one sub-agent invocation. The list grows in
65+
* real time as the supervisor fans work out to its children; each
66+
* delegation is appended through agent state, and the UI re-renders
67+
* via the standard shared-state subscription.
7268
*/
7369
export function DelegationLog({ delegations, isRunning }: DelegationLogProps) {
7470
return (

showcase/integrations/built-in-agent/src/app/demos/tool-rendering/render-flight-tool.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ declare const FlightListCard: React.ComponentType<{
1717
flights: unknown[];
1818
}>;
1919

20+
type FlightToolProps = {
21+
status: string;
22+
args?: { origin?: string; destination?: string };
23+
result?: { origin?: string; destination?: string; flights?: unknown[] };
24+
};
25+
2026
export function FlightToolRenderer() {
2127
// @region[render-flight-tool]
2228
// Per-tool renderer: search_flights → branded FlightListCard.
2329
useComponent({
2430
name: "search_flights",
25-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
26-
render: (props: any) => {
31+
render: (props: FlightToolProps) => {
2732
const { status, args, result } = props;
2833
const loading = status !== "complete";
2934
return (

showcase/integrations/google-adk/src/app/demos/headless-complete/use-rendered-messages.snippet.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ import {
2727
/**
2828
* Manual per-message composition for the TRULY headless chat cell.
2929
*
30-
* This hook mirrors — line-for-line in spirit — the role-dispatch that happens
31-
* inside `renderMessageBlock` in the canonical primitive:
32-
*
33-
* packages/react-core/src/v2/components/chat/CopilotChatMessageView.tsx:542-612
30+
* This hook mirrors — line-for-line in spirit — the role-dispatch that
31+
* the canonical `<CopilotChatMessageView>` does internally.
3432
*
3533
* The point of this cell is to demonstrate that the FULL generative-UI weave
3634
* (assistant text + tool-call renders + reasoning + activity + custom before /
@@ -108,9 +106,7 @@ function renderMessageContent(args: {
108106

109107
// Tool-role messages carry a tool-call RESULT whose UI lives inline inside
110108
// the PRECEDING assistant message's `toolCalls[i]` render (keyed by
111-
// toolCallId). We return null here so the list skips them, mirroring the
112-
// fact that CopilotChatMessageView's `renderMessageBlock` has no
113-
// `message.role === "tool"` branch.
109+
// toolCallId). We return null here so the list skips them.
114110
if (message.role === "tool") {
115111
return null;
116112
}
@@ -174,7 +170,6 @@ function renderAssistantBody(args: {
174170
{hasText && <div className="whitespace-pre-wrap break-words">{text}</div>}
175171
{toolCalls.map((toolCall) => {
176172
// Tool result lives on a sibling `tool`-role message keyed by toolCallId.
177-
// Mirrors CopilotChatToolCallsView (react-core/v2/components/chat/CopilotChatToolCallsView.tsx).
178173
const toolMessage = messages.find(
179174
(m) => m.role === "tool" && m.toolCallId === toolCall.id,
180175
) as ToolMessage | undefined;

showcase/integrations/langroid/src/app/demos/hitl-in-chat/hitl-hook-and-time-slots.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ declare const TimePickerCard: React.ComponentType<{
2323
onSubmit: (result: unknown) => void;
2424
}>;
2525

26+
type BookCallRenderProps = {
27+
args?: { topic?: string; attendee?: string };
28+
status: string;
29+
respond?: (result: unknown) => void;
30+
};
31+
2632
// @region[time-slots]
2733
const DEFAULT_SLOTS: TimeSlot[] = [
2834
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
@@ -46,8 +52,7 @@ export function HitlBookingHook() {
4652
.string()
4753
.describe("Who the call is with (e.g. 'Alice from Sales')"),
4854
}),
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
render: ({ args, status, respond }: any) => (
55+
render: ({ args, status, respond }: BookCallRenderProps) => (
5156
<TimePickerCard
5257
topic={args?.topic ?? "a call"}
5358
attendee={args?.attendee}

showcase/integrations/llamaindex/src/app/demos/headless-complete/use-rendered-messages.snippet.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ import {
2727
/**
2828
* Manual per-message composition for the TRULY headless chat cell.
2929
*
30-
* This hook mirrors — line-for-line in spirit — the role-dispatch that happens
31-
* inside `renderMessageBlock` in the canonical primitive:
32-
*
33-
* packages/react-core/src/v2/components/chat/CopilotChatMessageView.tsx:542-612
30+
* This hook mirrors — line-for-line in spirit — the role-dispatch that
31+
* the canonical `<CopilotChatMessageView>` does internally.
3432
*
3533
* The point of this cell is to demonstrate that the FULL generative-UI weave
3634
* (assistant text + tool-call renders + reasoning + activity + custom before /
@@ -108,9 +106,7 @@ function renderMessageContent(args: {
108106

109107
// Tool-role messages carry a tool-call RESULT whose UI lives inline inside
110108
// the PRECEDING assistant message's `toolCalls[i]` render (keyed by
111-
// toolCallId). We return null here so the list skips them, mirroring the
112-
// fact that CopilotChatMessageView's `renderMessageBlock` has no
113-
// `message.role === "tool"` branch.
109+
// toolCallId). We return null here so the list skips them.
114110
if (message.role === "tool") {
115111
return null;
116112
}
@@ -174,7 +170,6 @@ function renderAssistantBody(args: {
174170
{hasText && <div className="whitespace-pre-wrap break-words">{text}</div>}
175171
{toolCalls.map((toolCall) => {
176172
// Tool result lives on a sibling `tool`-role message keyed by toolCallId.
177-
// Mirrors CopilotChatToolCallsView (react-core/v2/components/chat/CopilotChatToolCallsView.tsx).
178173
const toolMessage = messages.find(
179174
(m) => m.role === "tool" && m.toolCallId === toolCall.id,
180175
) as ToolMessage | undefined;

showcase/integrations/llamaindex/src/app/demos/hitl-in-chat/hitl-hook-and-time-slots.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ declare const TimePickerCard: React.ComponentType<{
2323
onSubmit: (result: unknown) => void;
2424
}>;
2525

26+
type BookCallRenderProps = {
27+
args?: { topic?: string; attendee?: string };
28+
status: string;
29+
respond?: (result: unknown) => void;
30+
};
31+
2632
// @region[time-slots]
2733
const DEFAULT_SLOTS: TimeSlot[] = [
2834
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
@@ -46,8 +52,7 @@ export function HitlBookingHook() {
4652
.string()
4753
.describe("Who the call is with (e.g. 'Alice from Sales')"),
4854
}),
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
render: ({ args, status, respond }: any) => (
55+
render: ({ args, status, respond }: BookCallRenderProps) => (
5156
<TimePickerCard
5257
topic={args?.topic ?? "a call"}
5358
attendee={args?.attendee}

showcase/integrations/spring-ai/src/app/demos/hitl-in-chat/hitl-hook-and-time-slots.snippet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ declare const TimePickerCard: React.ComponentType<{
2323
onSubmit: (result: unknown) => void;
2424
}>;
2525

26+
type BookCallRenderProps = {
27+
args?: { topic?: string; attendee?: string };
28+
status: string;
29+
respond?: (result: unknown) => void;
30+
};
31+
2632
// @region[time-slots]
2733
const DEFAULT_SLOTS: TimeSlot[] = [
2834
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
@@ -46,8 +52,7 @@ export function HitlBookingHook() {
4652
.string()
4753
.describe("Who the call is with (e.g. 'Alice from Sales')"),
4854
}),
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
render: ({ args, status, respond }: any) => (
55+
render: ({ args, status, respond }: BookCallRenderProps) => (
5156
<TimePickerCard
5257
topic={args?.topic ?? "a call"}
5358
attendee={args?.attendee}

0 commit comments

Comments
 (0)