COPSPA-489#15
Draft
Bullitt300 wants to merge 29 commits intomainfrom
Draft
Conversation
- Entfernen: TitleGenerator, DescriptionGenerator, CsvWriter, WebhookSender, ProviderAdapter, MessageExtractor - Hinzufügen: SessionDataMapper für Konvertierung zu Lib-Interface - Hinzufügen: OpenCodeSessionManager in Lib (generisch, wiederverwendbar) - Refactor: EventHook nutzt TimeTrackingFacade mit Lazy Loading (Marketplace-Pattern) - Refactor: SessionManager wird zu Wrapper um Lib's OpenCodeSessionManager - Result: ~870 Zeilen Duplikation eliminiert, Single Source of Truth Implementiert: - Workspace Dependency: @techdivision/lib-ts-time-tracking - Inline ConversationContextProvider mit SDK Integration - Graceful Degradation für Fehlerbehandlung - Activity-Summary Fallback wenn LLM fehlschlägt - Unit Tests für SessionDataMapper und SessionManager - Integration Tests für EventHook mit TimeTrackingFacade Fixes COPSPA-489
Use GitHub repository directly with prepare script for automatic build. Commit: 3ee597d (chore: Use prepare script instead of postinstall)
Document the GitHub dependency and provide troubleshooting steps for manual build if needed.
For development and testing in .opencode directories, use local file path instead of GitHub URL to avoid network issues and ensure consistent builds.
- Delete CsvFormatter.ts (84 lines): Functionality now in lib-ts-time-tracking - Delete WriterService.ts (54 lines): Replaced by lib's WriteResultInterface - Delete TitleGenerationConfig.ts (96 lines): Title generation now in lib - Remove title_generation field from TimeTrackingConfig.ts - Update EventHook.ts to use lib's WriteResultInterface - Remove unused writers parameter from createEventHook() - Update track-time.ts tool to use lib's WriteResultInterface - Update CsvEntryData.ts comment to remove WriterService reference Total cleanup: 234 lines removed TypeScript compilation: ✅ No errors
…tion - Add SessionSummaryConfigInterface import to TimeTrackingConfig.ts - Add 'summary' field (new, preferred) to TimeTrackingJsonConfig - Keep 'title_generation' field (deprecated, for backward compatibility) - Create ConfigMigration.ts utility with resolveSummaryConfig() - Update EventHook.ts to use resolveSummaryConfig() for config migration - Priority: summary > title_generation > undefined - Both old and new configs work seamlessly Migration strategy: - Old configs with 'title_generation' continue to work - New configs can use 'summary' field - If both present, 'summary' takes precedence - No breaking changes for existing users TypeScript compilation: ✅ No errors
- Add .npmrc configuration for GitHub Packages registry - Update package.json: file:../lib-ts-time-tracking → ^4.2.0 - Add .npmrc.example for developer reference - Update .gitignore to exclude .npmrc (but keep .npmrc.example) - Update GitHub Actions workflow to install dependencies with GitHub token - Add scope: @techdivision to setup-node action This enables: - ✅ Production-ready dependency management - ✅ CI/CD compatibility - ✅ Multi-developer support - ✅ Automatic updates when lib is published Developers need to: 1. Generate GitHub token with read:packages scope 2. Configure npm with: npm login --scope=@techdivision --registry=https://npm.pkg.github.com 3. Run: npm install TypeScript compilation: ✅ No errors
…ption Problem: - CSV entries showed 'Ticket unbekannt:' in description even though issue_key was correct - Root cause: resolved ticket was not passed to SessionDataMapper - LLM couldn't see the ticket and generated 'Ticket unbekannt:' when ticket wasn't in conversation Solution: - Pass resolved.ticket from TicketResolver to SessionDataMapper.build() - Update SessionDataMapper to accept ticket parameter - Use config.ticket as priority over session.ticket Impact: - CSV descriptions now always include correct ticket key - 'Ticket unbekannt:' only appears if ticket is truly unknown - LLM has explicit ticket info for summary generation Example: Before: 'Ticket unbekannt: Überprüfung des Installationsstatus...' After: 'COPSPA-489: Überprüfung des Installationsstatus...' TypeScript compilation: ✅ No errors
1. ConfigMigration.ts: Enhanced resolveSummaryConfig() - Add enabled-check: return undefined if enabled: false - Add validation: require model and api_url for LLM - Add logging: warn if config incomplete - Prevents invalid LLM calls with incomplete config 2. EventHook.ts: Use pricing from opencode-project.json - Read pricing from config instead of hardcoding - Keep defaults as fallback if not configured - Allows users to customize pricing per environment 3. EventHook.ts: Add null-checks for totalTokens - Use ?? 0 for input, output, reasoning fields - Prevents NaN in toast message if fields missing - Handles Claude 3.5 reasoning token field gracefully 4. Remove deprecated tools/track-time.ts - Tool was deprecated and had dead code - CsvEntryData built but never used - WriteResultInterface only for error message - No equivalent in lib-ts-time-tracking - Users should use automatic time tracking plugin instead Impact: - Summary generation now validates config properly - Pricing can be customized per environment - Toast messages always show valid token counts - Cleaner codebase without deprecated tool TypeScript compilation: ✅ No errors
Updated to use the local lib-ts-time-tracking which includes the fix for returning actual summary generator availability status instead of hardcoded false. This resolves the 'title generation NOT available' toast message issue.
Add EnvResolver utility to resolve {env:VAR_NAME} placeholders in config values.
This ensures that environment variables like TT_AGENT_API_KEY are properly
resolved before being passed to the TimeTrackingFacade.
Changes:
- Create EnvResolver.ts with resolveEnvVar() and resolveEnvVarsInObject()
- Update ConfigLoader to resolve env vars in loaded config
- Recursively resolves nested objects and arrays
This fixes the issue where api_key was still {env:TT_AGENT_API_KEY} instead
of the actual API key value, causing LLM summary generation to fail.
This reverts commit 9503105.
Synchronize local ConfigMigration.ts with node_modules version to ensure consistent behavior. The simpler ?? (nullish coalescing) operator is more reliable than hasOwnProperty checks. This ensures 'summary' field is properly resolved just like 'title_generation'.
Add console logs to show: - Which config keys are present - Whether 'summary' field is found - Whether 'title_generation' field is found - Whether summaryConfig was resolved This helps verify that 'summary' field is being properly resolved.
…o lib
Add EnvResolver utility to resolve {env:VAR_NAME} placeholders in config values.
This ensures that environment variables like TT_AGENT_API_KEY are properly
resolved before being passed to the TimeTrackingFacade.
Changes:
- Create EnvResolver.ts with resolveEnvVar() and resolveEnvVarsInObject()
- Update EventHook to resolve env vars in summaryConfig after migration
- Add debug logging to show before/after env resolution
This fixes the issue where api_key was still {env:TT_AGENT_API_KEY} instead
of the actual API key value, causing LLM summary generation to fail.
…assing to lib" This reverts commit 85a4c31.
Remove the plugin's resolveSummaryConfig() call and instead pass both 'summary' and 'title_generation' fields to the lib. The lib's ConfigMapper will handle the migration and normalization. Changes: - Remove resolveSummaryConfig() call from EventHook - Pass both config.summary and config.title_generation to lib - Let lib handle the mapping via ConfigMapper This ensures the lib's mapping logic is used instead of duplicating the migration logic in the plugin.
Add EnvResolver utility to resolve {env:VAR_NAME} placeholders in config values.
This ensures that environment variables like TT_AGENT_API_KEY are properly
resolved before being passed to the TimeTrackingFacade.
Changes:
- Create EnvResolver.ts with resolveEnvVar() and resolveEnvVarsInObject()
- EventHook: Resolve env vars in summary and title_generation config
- Recursively resolves nested objects and arrays
This fixes the issue where api_key was still {env:TT_AGENT_API_KEY} instead
of the actual API key value, causing LLM summary generation to fail.
Add console logs to show: - libConfig.summary and libConfig.title_generation (after env resolution) - trackResult.summary (what the lib returns) This helps debug the flow and identify where the issue is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.