Commit Graph
3 Commits
Author SHA1 Message Date
ZacharyZhang-NYandClaude Opus 4.6 5271f7ee5d feat(06-02): wire token usage tracking, session accumulation, and rotation into worker pipeline
- Add inputTokens/outputTokens fields to worker run-finished messages and workerMessageSchema
- Wire sessionService into WorkerServiceDependencies and ServiceGraph lazy slot
- Add token accumulation and rotation evaluation in run-finished handler
- Add 7 wiring integration tests verifying accumulation, rotation, and guard paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 23:03:23 -04:00
ZacharyZhang-NYandClaude Opus 4.6 e54c632fd6 feat(06-01): add session management service with rotation, thresholds, and delta tracking
- Create createSessionManagementService factory with accumulateTokenUsage,
  evaluateRotation (configurable thresholds per D-01), generateHandoff,
  rotateSession, getHandoffContext, snapshotUsage, getUsageDelta
- Export DEFAULT_THRESHOLDS (maxRuns: 20, maxTokens: 500k, maxAgeHours: 72) and RotationThresholds type
- Adapter nativeContextManagement exemption skips rotation for Claude/Codex (D-04)
- Handoff markdown capped at 2000 chars with structured sections (D-06)
- Add 14 unit tests for service: rotation thresholds, adapter exemption, configurable
  thresholds, token accumulation, handoff generation, session rotation, usage delta

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:56:18 -04:00
ZacharyZhang-NYandClaude Opus 4.6 2c671d0011 feat(06-01): add task_sessions CRUD, nativeContextManagement flag, TaskSessionRecord type
- Add getActiveTaskSession, incrementSessionUsage, archiveSession, createNewSession,
  getRecentRunsForTask, getRecentActivityForTask methods to AppDatabase
- Add nativeContextManagement optional boolean to ServerAdapterModule interface
- Set nativeContextManagement: true for claude_local and codex_local, false for gemini_local
- Add TaskSessionRecord interface to shared types
- Add unit tests for task_sessions CRUD and adapter exemption flags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:53:39 -04:00