Skip to content

Latest commit

 

History

History
82 lines (71 loc) · 3.22 KB

progress.md

File metadata and controls

82 lines (71 loc) · 3.22 KB

Progress Log

2026-10-14

Phase 0: Baseline Audit ✅

  • Documented current LLM architecture (types, runtime, retry layers)
  • Documented JSONL session storage format and performance characteristics
  • Analyzed opencode's SQLite schema as reference
  • Analyzed 9Router's DB adapter chain and RTK compression
  • Created task_plan.md and findings.md

Phase 1: P0 Combo Fallback ✅

  • Implemented ComboEngine with safe streaming fallback semantics
  • Error classification: pre_stream, post_stream, auth, rate_limit, timeout, context_overflow, capacity, invalid_request, abort, unknown
  • Safety invariant: no fallback after first content event
  • Cooldown mechanism and budget controls
  • Comprehensive tests for error classification
  • Commit: 541f4b8 feat(llm): add ComboEngine with safe streaming fallback semantics

Phase 2: P1 Provider Adapter ✅

  • Added ProviderAdapter interface: auth, headers, capabilities, body transform, error classification
  • Added DefaultProviderAdapter for generic OpenAI-compatible providers
  • Added ProviderAdapterRegistry for adapter management
  • Added OpenRouterAdapter: reasoning_details, prompt_cache, tool freeze
  • Added NvidiaAdapter: prompt_cache_key omission, header customization
  • Added OpenCodeAdapter: fingerprint tools, stream forcing, x-opencode headers
  • Commit: b8e97f4 feat(llm): add Provider Adapter separation

Phase 3: P2 RTK Token Saver ✅

  • Added RTKCompressor engine with pluggable filter system
  • Added CompressionResult with rawOutputRef for original content recovery
  • Added ArtifactStore interface + InMemoryArtifactStore
  • Added filters: BashOutput, GrepResult, GitDiff, FileRead, DirectoryListing, Default
  • Commit: f3220ab feat(rtk): add RTK Token Saver

Phase 4: P3 Usage/Quota + P6 Logging ✅

  • Added UsageTracker: per-request token/retry/failure recording
  • Added QuotaManager: atomic reserve + settle
  • Added PricingService: versioned pricing table
  • Added SessionLogger: structured logging with session context
  • Commit: 78265e8 feat(llm): add Usage/Quota tracking and Session-aware logging

Phase 5: P5 SQLite Session Store ✅

  • Added SessionStore with WAL mode
  • Schema: sessions + messages tables (inspired by opencode)
  • CRUD operations, pagination, conversation chain retrieval
  • Batch migration tool for JSONL → SQLite
  • Commit: ccb270b feat(db): add SQLite SessionStore

Summary

All 6 phases complete. 5 commits, ~3000 lines of new code.

Files Created

src/services/llm/
├── runtime/
│   ├── ComboEngine.ts + test
├── adapters/
│   ├── ProviderAdapter.ts
│   ├── OpenRouterAdapter.ts
│   ├── NvidiaAdapter.ts
│   └── OpenCodeAdapter.ts
├── usage/
│   ├── UsageTracker.ts
│   ├── QuotaManager.ts
│   └── PricingService.ts
src/services/db/
│   ├── SessionStore.ts + test
│   └── migrateSessions.ts
src/services/rtk/
│   ├── RTKCompressor.ts
│   └── filters/index.ts
src/utils/
│   └── SessionLogger.ts

Remaining (Deferred)

  • Phase 2 (P4): Translator Registry — only if new protocols needed
  • Integration: wire ComboEngine into QueryEngine
  • Integration: wire RTK into ToolUseContext
  • Production ArtifactStore: file-based or SQLite