Skip to content

Commit f3767f8

Browse files
committed
D3 demo WIP
1 parent 2a6d825 commit f3767f8

32 files changed

+831
-151
lines changed

pnpm-lock.yaml

Lines changed: 123 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

references/agent-loop/src/trigger/schemas.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

references/agent-loop/trigger.config.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "references-agent-loop",
2+
"name": "references-d3-demo",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
@@ -8,10 +8,18 @@
88
"start": "next start",
99
"lint": "next lint",
1010
"dev:trigger": "trigger dev",
11-
"deploy": "trigger deploy"
11+
"deploy": "pnpm run python:compile-requirements && trigger deploy",
12+
"python:install-requirements": "uv pip sync requirements.txt",
13+
"python:compile-requirements": "uv pip compile requirements.in -o requirements.txt",
14+
"python:install": "pnpm run python:compile-requirements && pnpm run python:install-requirements",
15+
"python:create-env": "uv venv .venv"
1216
},
1317
"dependencies": {
1418
"@ai-sdk/openai": "1.3.3",
19+
"@trigger.dev/react-hooks": "workspace:*",
20+
"@trigger.dev/sdk": "workspace:*",
21+
"@trigger.dev/python": "workspace:*",
22+
"ai": "4.2.5",
1523
"class-variance-authority": "^0.7.1",
1624
"clsx": "^2.1.1",
1725
"lucide-react": "^0.484.0",
@@ -20,18 +28,17 @@
2028
"react-dom": "^19.0.0",
2129
"tailwind-merge": "^3.0.2",
2230
"tw-animate-css": "^1.2.4",
23-
"@trigger.dev/react-hooks": "workspace:*",
24-
"@trigger.dev/sdk": "workspace:*",
25-
"ai": "4.2.5",
26-
"zod": "3.23.8"
31+
"zod": "3.23.8",
32+
"zod-to-json-schema": "^3.24.5"
2733
},
2834
"devDependencies": {
2935
"@tailwindcss/postcss": "^4",
3036
"@types/node": "^20",
3137
"@types/react": "^19",
3238
"@types/react-dom": "^19",
3339
"tailwindcss": "^4.0.17",
34-
"typescript": "^5",
35-
"trigger.dev": "workspace:*"
40+
"trigger.dev": "workspace:*",
41+
"@trigger.dev/build": "workspace:*",
42+
"typescript": "^5"
3643
}
3744
}

references/d3-demo/requirements.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
crawl4ai
2+
playwright
3+
openai-agents
4+
urllib3<2.0.0

references/d3-demo/requirements.txt

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements.in -o requirements.txt
3+
aiofiles==24.1.0
4+
# via crawl4ai
5+
aiohappyeyeballs==2.6.1
6+
# via aiohttp
7+
aiohttp==3.11.14
8+
# via
9+
# crawl4ai
10+
# litellm
11+
aiosignal==1.3.2
12+
# via aiohttp
13+
aiosqlite==0.21.0
14+
# via crawl4ai
15+
annotated-types==0.7.0
16+
# via pydantic
17+
anyio==4.9.0
18+
# via
19+
# httpx
20+
# mcp
21+
# openai
22+
# sse-starlette
23+
# starlette
24+
attrs==25.3.0
25+
# via
26+
# aiohttp
27+
# jsonschema
28+
# referencing
29+
beautifulsoup4==4.13.3
30+
# via crawl4ai
31+
certifi==2025.1.31
32+
# via
33+
# httpcore
34+
# httpx
35+
# requests
36+
cffi==1.17.1
37+
# via cryptography
38+
charset-normalizer==3.4.1
39+
# via requests
40+
click==8.1.8
41+
# via
42+
# crawl4ai
43+
# litellm
44+
# nltk
45+
# uvicorn
46+
colorama==0.4.6
47+
# via
48+
# crawl4ai
49+
# griffe
50+
crawl4ai==0.5.0.post8
51+
# via -r requirements.in
52+
cryptography==44.0.2
53+
# via pyopenssl
54+
cssselect==1.3.0
55+
# via crawl4ai
56+
distro==1.9.0
57+
# via openai
58+
fake-http-header==0.3.5
59+
# via tf-playwright-stealth
60+
fake-useragent==2.1.0
61+
# via crawl4ai
62+
faust-cchardet==2.1.19
63+
# via crawl4ai
64+
filelock==3.18.0
65+
# via huggingface-hub
66+
frozenlist==1.5.0
67+
# via
68+
# aiohttp
69+
# aiosignal
70+
fsspec==2025.3.0
71+
# via huggingface-hub
72+
greenlet==3.1.1
73+
# via playwright
74+
griffe==1.6.3
75+
# via openai-agents
76+
h11==0.14.0
77+
# via
78+
# httpcore
79+
# uvicorn
80+
httpcore==1.0.7
81+
# via httpx
82+
httpx==0.28.1
83+
# via
84+
# crawl4ai
85+
# litellm
86+
# mcp
87+
# openai
88+
httpx-sse==0.4.0
89+
# via mcp
90+
huggingface-hub==0.29.3
91+
# via tokenizers
92+
humanize==4.12.2
93+
# via crawl4ai
94+
idna==3.10
95+
# via
96+
# anyio
97+
# httpx
98+
# requests
99+
# yarl
100+
importlib-metadata==8.6.1
101+
# via litellm
102+
jinja2==3.1.6
103+
# via litellm
104+
jiter==0.9.0
105+
# via openai
106+
joblib==1.4.2
107+
# via nltk
108+
jsonschema==4.23.0
109+
# via litellm
110+
jsonschema-specifications==2024.10.1
111+
# via jsonschema
112+
litellm==1.64.1
113+
# via crawl4ai
114+
lxml==5.3.1
115+
# via crawl4ai
116+
markdown-it-py==3.0.0
117+
# via rich
118+
markupsafe==3.0.2
119+
# via jinja2
120+
mcp==1.5.0
121+
# via openai-agents
122+
mdurl==0.1.2
123+
# via markdown-it-py
124+
multidict==6.2.0
125+
# via
126+
# aiohttp
127+
# yarl
128+
nltk==3.9.1
129+
# via crawl4ai
130+
numpy==2.2.4
131+
# via
132+
# crawl4ai
133+
# rank-bm25
134+
openai==1.68.2
135+
# via
136+
# litellm
137+
# openai-agents
138+
openai-agents==0.0.7
139+
# via -r requirements.in
140+
packaging==24.2
141+
# via huggingface-hub
142+
pillow==10.4.0
143+
# via crawl4ai
144+
playwright==1.51.0
145+
# via
146+
# -r requirements.in
147+
# crawl4ai
148+
# tf-playwright-stealth
149+
propcache==0.3.1
150+
# via
151+
# aiohttp
152+
# yarl
153+
psutil==7.0.0
154+
# via crawl4ai
155+
pycparser==2.22
156+
# via cffi
157+
pydantic==2.10.6
158+
# via
159+
# crawl4ai
160+
# litellm
161+
# mcp
162+
# openai
163+
# openai-agents
164+
# pydantic-settings
165+
pydantic-core==2.27.2
166+
# via pydantic
167+
pydantic-settings==2.8.1
168+
# via mcp
169+
pyee==12.1.1
170+
# via playwright
171+
pygments==2.19.1
172+
# via rich
173+
pyopenssl==25.0.0
174+
# via crawl4ai
175+
pyperclip==1.9.0
176+
# via crawl4ai
177+
python-dotenv==1.1.0
178+
# via
179+
# crawl4ai
180+
# litellm
181+
# pydantic-settings
182+
pyyaml==6.0.2
183+
# via huggingface-hub
184+
rank-bm25==0.2.2
185+
# via crawl4ai
186+
referencing==0.36.2
187+
# via
188+
# jsonschema
189+
# jsonschema-specifications
190+
regex==2024.11.6
191+
# via
192+
# nltk
193+
# tiktoken
194+
requests==2.32.3
195+
# via
196+
# crawl4ai
197+
# huggingface-hub
198+
# openai-agents
199+
# tiktoken
200+
rich==13.9.4
201+
# via crawl4ai
202+
rpds-py==0.24.0
203+
# via
204+
# jsonschema
205+
# referencing
206+
sniffio==1.3.1
207+
# via
208+
# anyio
209+
# openai
210+
snowballstemmer==2.2.0
211+
# via crawl4ai
212+
soupsieve==2.6
213+
# via beautifulsoup4
214+
sse-starlette==2.2.1
215+
# via mcp
216+
starlette==0.46.1
217+
# via
218+
# mcp
219+
# sse-starlette
220+
tf-playwright-stealth==1.1.2
221+
# via crawl4ai
222+
tiktoken==0.9.0
223+
# via litellm
224+
tokenizers==0.21.1
225+
# via litellm
226+
tqdm==4.67.1
227+
# via
228+
# huggingface-hub
229+
# nltk
230+
# openai
231+
types-requests==2.31.0.6
232+
# via openai-agents
233+
types-urllib3==1.26.25.14
234+
# via types-requests
235+
typing-extensions==4.13.0
236+
# via
237+
# aiosqlite
238+
# beautifulsoup4
239+
# huggingface-hub
240+
# openai
241+
# openai-agents
242+
# pydantic
243+
# pydantic-core
244+
# pyee
245+
urllib3==1.26.20
246+
# via
247+
# -r requirements.in
248+
# requests
249+
uvicorn==0.34.0
250+
# via mcp
251+
xxhash==3.5.0
252+
# via crawl4ai
253+
yarl==1.18.3
254+
# via aiohttp
255+
zipp==3.21.0
256+
# via importlib-metadata

references/agent-loop/src/app/page.tsx renamed to references/d3-demo/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MainApp from "@/components/main-app";
22
import { auth } from "@trigger.dev/sdk";
33

44
export default async function Home() {
5-
const publicAccessToken = await auth.createTriggerPublicToken("agent-loop-example");
5+
const publicAccessToken = await auth.createTriggerPublicToken("chat-example");
66

77
return <MainApp publicAccessToken={publicAccessToken} />;
88
}

references/agent-loop/src/components/main-app.tsx renamed to references/d3-demo/src/components/main-app.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Send } from "lucide-react";
77
import ChatInterface from "@/components/chat-interface";
88
import InitialPrompt from "@/components/initial-prompt";
99
import { useRealtimeTaskTriggerWithStreams, useWaitToken } from "@trigger.dev/react-hooks";
10-
import type { agentLoopExample } from "@/trigger/agent";
10+
import type { chatExample } from "@/trigger/chat";
1111
import { AgentLoopMetadata } from "@/trigger/schemas";
1212
import type { TextStreamPart } from "ai";
1313

@@ -17,14 +17,14 @@ type ResponseStreams = {
1717
[K in `responses.${number | string}`]: TextStreamPart<{}>;
1818
};
1919

20-
export function useAgentLoop({ publicAccessToken }: { publicAccessToken: string }) {
21-
const triggerInstance = useRealtimeTaskTriggerWithStreams<
22-
typeof agentLoopExample,
23-
ResponseStreams
24-
>("agent-loop-example", {
25-
accessToken: publicAccessToken,
26-
baseURL: process.env.NEXT_PUBLIC_TRIGGER_API_URL,
27-
});
20+
export function useChat({ publicAccessToken }: { publicAccessToken: string }) {
21+
const triggerInstance = useRealtimeTaskTriggerWithStreams<typeof chatExample, ResponseStreams>(
22+
"chat-example",
23+
{
24+
accessToken: publicAccessToken,
25+
baseURL: process.env.NEXT_PUBLIC_TRIGGER_API_URL,
26+
}
27+
);
2828
const [conversation, setConversation] = useState<ChatConversation>([]);
2929
const [isLoading, setIsLoading] = useState(false);
3030
const [waitToken, setWaitToken] = useState<AgentLoopMetadata | null>(null);
@@ -86,7 +86,7 @@ export function useAgentLoop({ publicAccessToken }: { publicAccessToken: string
8686
}
8787

8888
export default function MainApp({ publicAccessToken }: { publicAccessToken: string }) {
89-
const { continueConversation, conversation, isLoading } = useAgentLoop({ publicAccessToken });
89+
const { continueConversation, conversation, isLoading } = useChat({ publicAccessToken });
9090
const [input, setInput] = useState("");
9191

9292
const handleSubmit = (e: React.FormEvent) => {

0 commit comments

Comments
 (0)