Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
507 changes: 507 additions & 0 deletions .ai/http-observability-rfc.md

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ bun --cwd backend run db:studio # View data
```

## Rules
- TypeScript, 2-space indent
- Conventional commits with DCO: `git commit -s -m "feat: ..."`
- Tests alongside code in `__tests__/` folders
1. TypeScript, 2-space indent
2. Conventional commits with DCO: `git commit -s -m "feat: ..."`
3. Tests alongside code in `__tests__/` folders
4. **E2E Tests**: Mandatory for significant features. Place in `e2e-tests/` folder.
5. **GitHub CLI**: Use `gh` for all GitHub operations (issues, PRs, actions, releases). Never use browser automation for GitHub tasks.

---

Expand Down
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@nestjs/testing": "^10.4.0",
"@types/bcryptjs": "^3.0.0",
"@types/express-serve-static-core": "^4.19.6",
"@types/har-format": "^1.2.16",
"@types/multer": "^2.0.0",
"@types/node": "^20.16.11",
"@types/pg": "^8.15.5",
Expand Down
8 changes: 7 additions & 1 deletion backend/src/trace/trace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export class TraceService {
return 'AWAITING_INPUT';
case 'NODE_SKIPPED':
return 'SKIPPED';
case 'HTTP_REQUEST_SENT':
return 'HTTP_REQUEST_SENT';
case 'HTTP_RESPONSE_RECEIVED':
return 'HTTP_RESPONSE_RECEIVED';
case 'HTTP_REQUEST_ERROR':
return 'HTTP_REQUEST_ERROR';
case 'NODE_PROGRESS':
default:
return 'PROGRESS';
Expand All @@ -114,7 +120,7 @@ export class TraceService {
if (storedLevel === 'error' || storedLevel === 'warn' || storedLevel === 'debug') {
return storedLevel;
}
if (type === 'FAILED') {
if (type === 'FAILED' || type === 'HTTP_REQUEST_ERROR') {
return 'error';
}
return 'info';
Expand Down
40 changes: 38 additions & 2 deletions backend/src/trace/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import type { Entry as HarEntry, Request as HarRequest } from 'har-format';

export type TraceEventType =
| 'NODE_STARTED'
| 'NODE_COMPLETED'
| 'NODE_FAILED'
| 'NODE_PROGRESS'
| 'AWAITING_INPUT'
| 'NODE_SKIPPED';
| 'NODE_SKIPPED'
| 'HTTP_REQUEST_SENT'
| 'HTTP_RESPONSE_RECEIVED'
| 'HTTP_REQUEST_ERROR';

export interface TraceEventBase {
runId: string;
Expand Down Expand Up @@ -46,10 +51,41 @@ export interface NodeSkippedEvent extends TraceEventBase {
type: 'NODE_SKIPPED';
}

export interface HttpRequestSentEvent extends TraceEventBase {
type: 'HTTP_REQUEST_SENT';
data: {
correlationId: string;
request: HarRequest;
};
}

export interface HttpResponseReceivedEvent extends TraceEventBase {
type: 'HTTP_RESPONSE_RECEIVED';
data: {
correlationId: string;
har: HarEntry;
};
}

export interface HttpRequestErrorEvent extends TraceEventBase {
type: 'HTTP_REQUEST_ERROR';
data: {
correlationId: string;
request: HarRequest;
error: {
message: string;
name?: string;
};
};
}

export type TraceEvent =
| NodeStartedEvent
| NodeCompletedEvent
| NodeFailedEvent
| NodeProgressEvent
| AwaitingInputEvent
| NodeSkippedEvent;
| NodeSkippedEvent
| HttpRequestSentEvent
| HttpResponseReceivedEvent
| HttpRequestErrorEvent;
172 changes: 87 additions & 85 deletions bun.lock

Large diffs are not rendered by default.

Loading