68 lines
1.6 KiB
Markdown
68 lines
1.6 KiB
Markdown
|
|
# Task ID: 104
|
||
|
|
|
||
|
|
**Title:** Extend Traffic Events for ProxyModel Processing
|
||
|
|
|
||
|
|
**Status:** cancelled
|
||
|
|
|
||
|
|
**Dependencies:** 80 ✓
|
||
|
|
|
||
|
|
**Priority:** medium
|
||
|
|
|
||
|
|
**Description:** Add new traffic event types for proxymodel processing: content_original, content_transformed, stage timing, cache hits/misses.
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
Modify `src/mcplocal/src/http/traffic.ts`:
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
export type TrafficEventType =
|
||
|
|
| 'client_request'
|
||
|
|
| 'client_response'
|
||
|
|
| 'upstream_request'
|
||
|
|
| 'upstream_response'
|
||
|
|
| 'client_notification'
|
||
|
|
// New proxymodel events:
|
||
|
|
| 'content_original'
|
||
|
|
| 'content_transformed'
|
||
|
|
| 'stage_executed'
|
||
|
|
| 'stage_cache_hit'
|
||
|
|
| 'stage_cache_miss';
|
||
|
|
|
||
|
|
export interface ContentOriginalEvent {
|
||
|
|
eventType: 'content_original';
|
||
|
|
sessionId: string;
|
||
|
|
contentType: 'prompt' | 'toolResult';
|
||
|
|
sourceName: string;
|
||
|
|
content: string;
|
||
|
|
charCount: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ContentTransformedEvent {
|
||
|
|
eventType: 'content_transformed';
|
||
|
|
sessionId: string;
|
||
|
|
contentType: 'prompt' | 'toolResult';
|
||
|
|
sourceName: string;
|
||
|
|
content: string;
|
||
|
|
charCount: number;
|
||
|
|
proxyModel: string;
|
||
|
|
stages: string[];
|
||
|
|
durationMs: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface StageExecutedEvent {
|
||
|
|
eventType: 'stage_executed';
|
||
|
|
sessionId: string;
|
||
|
|
stageName: string;
|
||
|
|
inputChars: number;
|
||
|
|
outputChars: number;
|
||
|
|
durationMs: number;
|
||
|
|
cacheHit: boolean;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
Emit these events from the pipeline executor.
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
Unit tests: events emitted at correct points in pipeline execution, event payloads contain correct data, cache hit/miss events distinguish correctly. Integration test with inspector showing new events.
|