@hazeljs/cli 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ # Docker
2
+ Dockerfile
3
+ docker-compose.yml
4
+ .dockerignore
5
+
6
+ # Environment
7
+ .env
8
+ .env.local
9
+ .env.production
10
+
11
+ # Logs
12
+ logs/
13
+ *.log
14
+
15
+ # Node modules
16
+ node_modules/
17
+
18
+ # Build artifacts
19
+ dist/
20
+ *.tsbuildinfo
21
+
22
+ # OS
23
+ .DS_Store
24
+ Thumbs.db
25
+
26
+ # IDE
27
+ .vscode/
28
+ .idea/
29
+ *.swp
30
+ *.swo
31
+
32
+ # Git
33
+ .git/
34
+ .gitignore
35
+
36
+ # Coverage
37
+ coverage/
38
+ *.lcov
39
+
40
+ # Temporary files
41
+ *.tmp
42
+ *.temp
@@ -0,0 +1,16 @@
1
+ # Server Configuration
2
+ PORT=3000
3
+ NODE_ENV=development
4
+
5
+ # AI Configuration
6
+ OPENAI_API_KEY=your_openai_api_key_here
7
+
8
+ # Logging
9
+ LOG_LEVEL=info
10
+
11
+ # Database (matches docker-compose.yml)
12
+ DATABASE_URL=postgresql://hazeljs:hazeljs123@localhost:5432/hazeljs
13
+
14
+ # Redis (optional)
15
+ REDIS_HOST=localhost
16
+ REDIS_PORT=6379
@@ -0,0 +1,30 @@
1
+ # Use Node.js 24 Alpine as base image
2
+ FROM node:24-alpine
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Copy package files
8
+ COPY package*.json ./
9
+
10
+ # Install dependencies
11
+ RUN npm ci --only=production
12
+
13
+ # Copy source code
14
+ COPY . .
15
+
16
+ # Create logs directory
17
+ RUN mkdir -p logs
18
+
19
+ # Build the application
20
+ RUN npm run build
21
+
22
+ # Expose port
23
+ EXPOSE 3000
24
+
25
+ # Health check
26
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
27
+ CMD curl -f http://localhost:3000/health || exit 1
28
+
29
+ # Run the application
30
+ CMD ["npm", "start"]
@@ -0,0 +1,481 @@
1
+ {
2
+ "info": {
3
+ "_postman_id": "hazeljs-ai-native-template",
4
+ "name": "HazelJS AI-Native API",
5
+ "description": "Postman collection for HazelJS AI-Native application with AI chat, agents, and RAG endpoints",
6
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
7
+ },
8
+ "item": [
9
+ {
10
+ "name": "Health & Status",
11
+ "item": [
12
+ {
13
+ "name": "Health Check",
14
+ "request": {
15
+ "method": "GET",
16
+ "header": [],
17
+ "url": {
18
+ "raw": "{{baseUrl}}/health",
19
+ "host": ["{{baseUrl}}"],
20
+ "path": ["health"]
21
+ }
22
+ },
23
+ "response": []
24
+ },
25
+ {
26
+ "name": "App Root",
27
+ "request": {
28
+ "method": "GET",
29
+ "header": [],
30
+ "url": {
31
+ "raw": "{{baseUrl}}/",
32
+ "host": ["{{baseUrl}}"],
33
+ "path": [""]
34
+ }
35
+ },
36
+ "response": []
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "name": "AI Chat",
42
+ "item": [
43
+ {
44
+ "name": "Send Chat Message",
45
+ "request": {
46
+ "method": "POST",
47
+ "header": [
48
+ {
49
+ "key": "Content-Type",
50
+ "value": "application/json"
51
+ }
52
+ ],
53
+ "body": {
54
+ "mode": "raw",
55
+ "raw": "{\n \"message\": \"What is HazelJS and how does it work?\"\n}"
56
+ },
57
+ "url": {
58
+ "raw": "{{baseUrl}}/chat",
59
+ "host": ["{{baseUrl}}"],
60
+ "path": ["chat"]
61
+ }
62
+ },
63
+ "response": []
64
+ },
65
+ {
66
+ "name": "Chat with System Prompt",
67
+ "request": {
68
+ "method": "POST",
69
+ "header": [
70
+ {
71
+ "key": "Content-Type",
72
+ "value": "application/json"
73
+ }
74
+ ],
75
+ "body": {
76
+ "mode": "raw",
77
+ "raw": "{\n \"message\": \"Explain TypeScript decorators in simple terms\",\n \"system\": \"You are a TypeScript expert who explains concepts clearly to beginners.\"\n}"
78
+ },
79
+ "url": {
80
+ "raw": "{{baseUrl}}/chat",
81
+ "host": ["{{baseUrl}}"],
82
+ "path": ["chat"]
83
+ }
84
+ },
85
+ "response": []
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ "name": "AI Agent",
91
+ "description": "WeatherAgent with 3 tools: getWeather, getForecast, convertTemperature. The agent autonomously picks the right tool(s) at runtime based on the request.",
92
+ "item": [
93
+ {
94
+ "name": "Get Current Weather (getWeather)",
95
+ "request": {
96
+ "method": "POST",
97
+ "header": [
98
+ {
99
+ "key": "Content-Type",
100
+ "value": "application/json"
101
+ }
102
+ ],
103
+ "body": {
104
+ "mode": "raw",
105
+ "raw": "{\n \"message\": \"What's the weather like in Tokyo?\"\n}"
106
+ },
107
+ "url": {
108
+ "raw": "{{baseUrl}}/agent",
109
+ "host": ["{{baseUrl}}"],
110
+ "path": ["agent"]
111
+ }
112
+ },
113
+ "response": []
114
+ },
115
+ {
116
+ "name": "Get Multi-Day Forecast (getForecast)",
117
+ "request": {
118
+ "method": "POST",
119
+ "header": [
120
+ {
121
+ "key": "Content-Type",
122
+ "value": "application/json"
123
+ }
124
+ ],
125
+ "body": {
126
+ "mode": "raw",
127
+ "raw": "{\n \"message\": \"What's the 5-day forecast for London?\"\n}"
128
+ },
129
+ "url": {
130
+ "raw": "{{baseUrl}}/agent",
131
+ "host": ["{{baseUrl}}"],
132
+ "path": ["agent"]
133
+ }
134
+ },
135
+ "response": []
136
+ },
137
+ {
138
+ "name": "Convert Temperature (convertTemperature)",
139
+ "request": {
140
+ "method": "POST",
141
+ "header": [
142
+ {
143
+ "key": "Content-Type",
144
+ "value": "application/json"
145
+ }
146
+ ],
147
+ "body": {
148
+ "mode": "raw",
149
+ "raw": "{\n \"message\": \"Convert 100°F to Celsius\"\n}"
150
+ },
151
+ "url": {
152
+ "raw": "{{baseUrl}}/agent",
153
+ "host": ["{{baseUrl}}"],
154
+ "path": ["agent"]
155
+ }
156
+ },
157
+ "response": []
158
+ },
159
+ {
160
+ "name": "Weather + Convert Temperature (multi-tool)",
161
+ "request": {
162
+ "method": "POST",
163
+ "header": [
164
+ {
165
+ "key": "Content-Type",
166
+ "value": "application/json"
167
+ }
168
+ ],
169
+ "body": {
170
+ "mode": "raw",
171
+ "raw": "{\n \"message\": \"What's the weather in Paris and convert the temperature to Celsius?\"\n}"
172
+ },
173
+ "url": {
174
+ "raw": "{{baseUrl}}/agent",
175
+ "host": ["{{baseUrl}}"],
176
+ "path": ["agent"]
177
+ }
178
+ },
179
+ "response": []
180
+ },
181
+ {
182
+ "name": "Multiple Cities (parallel tool calls)",
183
+ "request": {
184
+ "method": "POST",
185
+ "header": [
186
+ {
187
+ "key": "Content-Type",
188
+ "value": "application/json"
189
+ }
190
+ ],
191
+ "body": {
192
+ "mode": "raw",
193
+ "raw": "{\n \"message\": \"What's the weather in New York, London, and Tokyo?\"\n}"
194
+ },
195
+ "url": {
196
+ "raw": "{{baseUrl}}/agent",
197
+ "host": ["{{baseUrl}}"],
198
+ "path": ["agent"]
199
+ }
200
+ },
201
+ "response": []
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ "name": "AI Agent - Execution Trace",
207
+ "description": "POST /agent/trace — Returns the full reasoning trace: every step, which tool was called, with what input, what it returned, and timing. Great for understanding agent reasoning.",
208
+ "item": [
209
+ {
210
+ "name": "Single Tool Trace",
211
+ "request": {
212
+ "method": "POST",
213
+ "header": [{"key": "Content-Type", "value": "application/json"}],
214
+ "body": {
215
+ "mode": "raw",
216
+ "raw": "{\n \"message\": \"What's the weather in New York?\"\n}"
217
+ },
218
+ "url": {"raw": "{{baseUrl}}/agent/trace", "host": ["{{baseUrl}}"], "path": ["agent", "trace"]}
219
+ },
220
+ "response": []
221
+ },
222
+ {
223
+ "name": "Multi-Tool Trace",
224
+ "request": {
225
+ "method": "POST",
226
+ "header": [{"key": "Content-Type", "value": "application/json"}],
227
+ "body": {
228
+ "mode": "raw",
229
+ "raw": "{\n \"message\": \"What's the weather in Tokyo and convert it to Celsius?\"\n}"
230
+ },
231
+ "url": {"raw": "{{baseUrl}}/agent/trace", "host": ["{{baseUrl}}"], "path": ["agent", "trace"]}
232
+ },
233
+ "response": []
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "name": "AI Agent - Streaming (SSE)",
239
+ "description": "POST /agent/stream — Token-by-token SSE stream. Set 'Accept: text/event-stream' in your client. Each event is a JSON object with type='token'|'step'|'done'.",
240
+ "item": [
241
+ {
242
+ "name": "Stream Weather Response",
243
+ "request": {
244
+ "method": "POST",
245
+ "header": [
246
+ {"key": "Content-Type", "value": "application/json"},
247
+ {"key": "Accept", "value": "text/event-stream"}
248
+ ],
249
+ "body": {
250
+ "mode": "raw",
251
+ "raw": "{\n \"message\": \"What's the weather forecast for London this week?\"\n}"
252
+ },
253
+ "url": {"raw": "{{baseUrl}}/agent/stream", "host": ["{{baseUrl}}"], "path": ["agent", "stream"]}
254
+ },
255
+ "response": []
256
+ }
257
+ ]
258
+ },
259
+ {
260
+ "name": "Travel Agent (@Delegate)",
261
+ "description": "POST /travel — TravelAgent delegates to WeatherAgent (via @Delegate) for weather and to FactsAgent for city facts. Agent-to-agent calls are transparent to the LLM.",
262
+ "item": [
263
+ {
264
+ "name": "Plan a Trip (delegates to both agents)",
265
+ "request": {
266
+ "method": "POST",
267
+ "header": [{"key": "Content-Type", "value": "application/json"}],
268
+ "body": {
269
+ "mode": "raw",
270
+ "raw": "{\n \"message\": \"Plan a trip to Tokyo. Get the current weather there and also tell me some interesting facts about Tokyo.\"\n}"
271
+ },
272
+ "url": {"raw": "{{baseUrl}}/travel", "host": ["{{baseUrl}}"], "path": ["travel"]}
273
+ },
274
+ "response": []
275
+ },
276
+ {
277
+ "name": "Weather-focused Trip (delegates to WeatherAgent)",
278
+ "request": {
279
+ "method": "POST",
280
+ "header": [{"key": "Content-Type", "value": "application/json"}],
281
+ "body": {
282
+ "mode": "raw",
283
+ "raw": "{\n \"message\": \"Is the weather in Paris good for sightseeing this week?\"\n}"
284
+ },
285
+ "url": {"raw": "{{baseUrl}}/travel", "host": ["{{baseUrl}}"], "path": ["travel"]}
286
+ },
287
+ "response": []
288
+ },
289
+ {
290
+ "name": "Facts-focused Trip (delegates to FactsAgent)",
291
+ "request": {
292
+ "method": "POST",
293
+ "header": [{"key": "Content-Type", "value": "application/json"}],
294
+ "body": {
295
+ "mode": "raw",
296
+ "raw": "{\n \"message\": \"Tell me interesting facts and travel tips for London.\"\n}"
297
+ },
298
+ "url": {"raw": "{{baseUrl}}/travel", "host": ["{{baseUrl}}"], "path": ["travel"]}
299
+ },
300
+ "response": []
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ "name": "Supervisor Multi-Agent",
306
+ "description": "POST /travel/supervisor — An LLM supervisor routes requests to WeatherAgent or FactsAgent based on what's most relevant, then synthesises a combined answer.",
307
+ "item": [
308
+ {
309
+ "name": "What to Pack (routes to both agents)",
310
+ "request": {
311
+ "method": "POST",
312
+ "header": [{"key": "Content-Type", "value": "application/json"}],
313
+ "body": {
314
+ "mode": "raw",
315
+ "raw": "{\n \"message\": \"What should I pack for a trip to Paris? Tell me about the weather and the local culture.\"\n}"
316
+ },
317
+ "url": {"raw": "{{baseUrl}}/travel/supervisor", "host": ["{{baseUrl}}"], "path": ["travel", "supervisor"]}
318
+ },
319
+ "response": []
320
+ },
321
+ {
322
+ "name": "Weather Query (routes to WeatherAgent)",
323
+ "request": {
324
+ "method": "POST",
325
+ "header": [{"key": "Content-Type", "value": "application/json"}],
326
+ "body": {
327
+ "mode": "raw",
328
+ "raw": "{\n \"message\": \"What is the 3-day weather forecast for Tokyo?\"\n}"
329
+ },
330
+ "url": {"raw": "{{baseUrl}}/travel/supervisor", "host": ["{{baseUrl}}"], "path": ["travel", "supervisor"]}
331
+ },
332
+ "response": []
333
+ },
334
+ {
335
+ "name": "City Facts Query (routes to FactsAgent)",
336
+ "request": {
337
+ "method": "POST",
338
+ "header": [{"key": "Content-Type", "value": "application/json"}],
339
+ "body": {
340
+ "mode": "raw",
341
+ "raw": "{\n \"message\": \"Tell me interesting things to do and see in New York City.\"\n}"
342
+ },
343
+ "url": {"raw": "{{baseUrl}}/travel/supervisor", "host": ["{{baseUrl}}"], "path": ["travel", "supervisor"]}
344
+ },
345
+ "response": []
346
+ }
347
+ ]
348
+ },
349
+ {
350
+ "name": "RAG (Document Search)",
351
+ "item": [
352
+ {
353
+ "name": "Get RAG Status",
354
+ "request": {
355
+ "method": "GET",
356
+ "header": [],
357
+ "url": {
358
+ "raw": "{{baseUrl}}/rag/documents",
359
+ "host": ["{{baseUrl}}"],
360
+ "path": ["rag", "documents"]
361
+ }
362
+ },
363
+ "response": []
364
+ },
365
+ {
366
+ "name": "Ingest Document",
367
+ "request": {
368
+ "method": "POST",
369
+ "header": [
370
+ {
371
+ "key": "Content-Type",
372
+ "value": "application/json"
373
+ }
374
+ ],
375
+ "body": {
376
+ "mode": "raw",
377
+ "raw": "{\n \"content\": \"HazelJS is a TypeScript framework for building AI-native backend applications. It provides built-in support for AI agents, RAG (Retrieval-Augmented Generation), and seamless integration with LLM providers like OpenAI, Anthropic, and Ollama.\",\n \"metadata\": {\n \"source\": \"documentation\",\n \"type\": \"introduction\"\n }\n}"
378
+ },
379
+ "url": {
380
+ "raw": "{{baseUrl}}/rag/ingest",
381
+ "host": ["{{baseUrl}}"],
382
+ "path": ["rag", "ingest"]
383
+ }
384
+ },
385
+ "response": []
386
+ },
387
+ {
388
+ "name": "Ingest Multiple Documents",
389
+ "request": {
390
+ "method": "POST",
391
+ "header": [
392
+ {
393
+ "key": "Content-Type",
394
+ "value": "application/json"
395
+ }
396
+ ],
397
+ "body": {
398
+ "mode": "raw",
399
+ "raw": "{\n \"content\": \"TypeScript decorators provide a way to add metadata and modify the behavior of classes, methods, and properties. In HazelJS, decorators like @Controller, @Get, @Post, @Service, and @Agent are used to define the application structure and routing.\",\n \"metadata\": {\n \"source\": \"typescript-guide\",\n \"type\": \"tutorial\"\n }\n}"
400
+ },
401
+ "url": {
402
+ "raw": "{{baseUrl}}/rag/ingest",
403
+ "host": ["{{baseUrl}}"],
404
+ "path": ["rag", "ingest"]
405
+ }
406
+ },
407
+ "response": []
408
+ },
409
+ {
410
+ "name": "Search Documents",
411
+ "request": {
412
+ "method": "POST",
413
+ "header": [
414
+ {
415
+ "key": "Content-Type",
416
+ "value": "application/json"
417
+ }
418
+ ],
419
+ "body": {
420
+ "mode": "raw",
421
+ "raw": "{\n \"query\": \"What is HazelJS?\"\n}"
422
+ },
423
+ "url": {
424
+ "raw": "{{baseUrl}}/rag/search",
425
+ "host": ["{{baseUrl}}"],
426
+ "path": ["rag", "search"]
427
+ }
428
+ },
429
+ "response": []
430
+ },
431
+ {
432
+ "name": "Search for TypeScript Info",
433
+ "request": {
434
+ "method": "POST",
435
+ "header": [
436
+ {
437
+ "key": "Content-Type",
438
+ "value": "application/json"
439
+ }
440
+ ],
441
+ "body": {
442
+ "mode": "raw",
443
+ "raw": "{\n \"query\": \"TypeScript decorators in HazelJS\"\n}"
444
+ },
445
+ "url": {
446
+ "raw": "{{baseUrl}}/rag/search",
447
+ "host": ["{{baseUrl}}"],
448
+ "path": ["rag", "search"]
449
+ }
450
+ },
451
+ "response": []
452
+ }
453
+ ]
454
+ },
455
+ {
456
+ "name": "Development Tools",
457
+ "item": [
458
+ {
459
+ "name": "Inspector Dashboard",
460
+ "request": {
461
+ "method": "GET",
462
+ "header": [],
463
+ "url": {
464
+ "raw": "{{baseUrl}}/__hazel",
465
+ "host": ["{{baseUrl}}"],
466
+ "path": ["__hazel"]
467
+ }
468
+ },
469
+ "response": []
470
+ }
471
+ ]
472
+ }
473
+ ],
474
+ "variable": [
475
+ {
476
+ "key": "baseUrl",
477
+ "value": "http://localhost:3000",
478
+ "type": "string"
479
+ }
480
+ ]
481
+ }