Skip to content

Commit 29be068

Browse files
marthakellyclaude
andcommitted
chore(example): wire langgraph-python-threads into the pnpm workspace
The intelligence-backed example was a standalone npm-managed monorepo pinned to published @copilotkit/runtime 1.56.3, so iterating on the runtime against an Intelligence platform required publishing a release or hand-linking. Pulling its two JS apps into the pnpm workspace lets them resolve workspace:* and use whatever the local packages currently build to. Specific changes: - Adds the example's app and bff to pnpm-workspace.yaml. - Switches their @copilotkit/* deps to workspace:*; adds @copilotkit/web-inspector as a workspace dep on the frontend so the inspector can mount alongside the chat. - Adds a small <Inspector /> React component that side-effect-imports @copilotkit/web-inspector to register the custom element and assigns the CopilotKit core via a ref (Lit elements expect properties, not attributes, for complex values). - Bumps the docker-compose image to the rc.16 composite, which is the earliest published tag containing CopilotKit/Intelligence#144's /api/_inspect/threads/:id/{events,state} endpoints. - Drops the example's package-lock.json so npm and pnpm don't fight over lockfiles in the workspace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 762eb79 commit 29be068

8 files changed

Lines changed: 566 additions & 16148 deletions

File tree

examples/integrations/langgraph-python-threads/apps/app/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
},
1010
"dependencies": {
1111
"@ag-ui/client": "0.0.52",
12-
"@copilotkit/a2ui-renderer": "1.56.3",
13-
"@copilotkit/react-core": "1.56.3",
14-
"@copilotkit/react-ui": "1.56.3",
12+
"@copilotkit/a2ui-renderer": "workspace:*",
13+
"@copilotkit/react-core": "workspace:*",
14+
"@copilotkit/react-ui": "workspace:*",
15+
"@copilotkit/web-inspector": "workspace:*",
1516
"@hono/node-server": "^1.19.14",
1617
"@radix-ui/react-checkbox": "^1.3.3",
1718
"@radix-ui/react-label": "^2.1.8",

examples/integrations/langgraph-python-threads/apps/app/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import { ExampleLayout } from "@/components/example-layout";
88
import { ExampleCanvas } from "@/components/example-canvas";
99
import { ThreadsDrawer } from "@/components/threads-drawer";
10+
import { Inspector } from "@/components/inspector";
1011
import { ThemeProvider } from "@/hooks/use-theme";
1112
import { useExampleSuggestions, useGenerativeUIExamples } from "@/hooks";
1213
import { demonstrationCatalog } from "@/declarative-generative-ui/renderers";
@@ -62,6 +63,7 @@ export default function App() {
6263
useSingleEndpoint={false}
6364
>
6465
<HomePage />
66+
<Inspector />
6567
</CopilotKitProvider>
6668
</ThemeProvider>
6769
);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useEffect, useRef } from "react";
2+
import { useCopilotKit } from "@copilotkit/react-core/v2";
3+
// Side-effect import: registers the `cpk-web-inspector` custom element.
4+
import "@copilotkit/web-inspector";
5+
6+
/**
7+
* Mounts the CopilotKit web inspector as a Lit-based custom element overlay.
8+
*
9+
* The inspector subscribes to the same `CopilotKitCore` instance the rest of
10+
* the app uses, so its Threads / AG-UI Events / Agent State views stay in
11+
* sync with whatever agent the chat is currently running. We assign `.core`
12+
* via a ref because Lit elements expect properties (not attributes) for
13+
* complex values, and React's standard prop pipeline would stringify them.
14+
*/
15+
export function Inspector() {
16+
const { copilotkit } = useCopilotKit();
17+
const ref = useRef<HTMLElement | null>(null);
18+
19+
useEffect(() => {
20+
const el = ref.current as (HTMLElement & { core?: unknown }) | null;
21+
if (!el) return;
22+
el.core = copilotkit;
23+
}, [copilotkit]);
24+
25+
// `cpk-web-inspector` isn't in React's intrinsic JSX namespace. Casting the
26+
// tag avoids polluting global JSX type augmentations for a single example.
27+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
28+
const Tag = "cpk-web-inspector" as unknown as any;
29+
return <Tag ref={ref} />;
30+
}

examples/integrations/langgraph-python-threads/apps/bff/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "node dist/server.js"
1010
},
1111
"dependencies": {
12-
"@copilotkit/runtime": "1.56.3",
12+
"@copilotkit/runtime": "workspace:*",
1313
"@hono/node-server": "^1.13.6",
1414
"hono": "^4.7.11",
1515
"zod": "^3.23.8"

examples/integrations/langgraph-python-threads/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ services:
5858
# ---------------------------------------------------------------------------
5959

6060
intelligence:
61-
image: ghcr.io/copilotkit/intelligence/composite:0.0.0-ghcr.20260422.1
61+
image: ghcr.io/copilotkit/intelligence/composite:0.1.0-rc.16
6262
ports:
6363
- "${APP_API_HOST_PORT:-4201}:4201"
6464
- "${REALTIME_GATEWAY_HOST_PORT:-4401}:4401"

0 commit comments

Comments
 (0)