Repository navigation
[70 by Claude Opus] Core: Implement Activity-Based Polling via Local Log Monitoring - #77
Merged
Conversation
…of the implementation: Implementation Summary I have successfully implemented GitHub issue #70 - Activity-Based Polling via Local Log Monitoring. Here's what was implemented: New Files Created: 1. `src/activity-monitor.js` - ActivityMonitor utility class that: - Watches known log directories for Claude (`~/.config/claude/projects/`, `~/.claude/`), Codex (`~/.codex/sessions/`, `~/.codex/`), and Gemini (`~/.config/gemini/`, `~/.gemini/`) using `fs.watch` - Supports configurable debounce interval (default: 5000ms) - Triggers callbacks when activity is detected - Provides status methods to check monitoring state 2. `test/unit/activity-monitor.test.js` - Comprehensive unit tests (47 tests) covering: - Constructor options and defaults - Start/stop functionality - File change handling and debouncing - Activity triggering and callbacks - Status reporting Modified Files: 1. `src/index.js` - Updated AgentTank class: - Added `autoRefreshMode` configuration with 3 modes: `'none'`, `'interval'`, `'activity'` (default) - Added `activityDebounce` configuration option - Implemented `_startActivityBasedRefresh()` for activity mode - Implemented `_handleActivityDetected()` and `_runActivityRefreshCycle()` for on-demand refresh cycles - Preserved `_startIntervalBasedRefresh()` for traditional polling - Added `getActivityMonitorStatus()` and `getAutoRefreshConfig()` methods - Exported `AUTO_REFRESH_MODES` constant 2. `bin/agent-tank.js` - Updated CLI: - Added `--auto-refresh-mode` option (none, interval, activity) - Added `--activity-debounce` option (milliseconds) - Updated help text with new options and mode descriptions - Added environment variable support: `AGENT_TANK_AUTO_REFRESH_MODE`, `AGENT_TANK_ACTIVITY_DEBOUNCE` - Added config file support for `autoRefresh.mode` and `autoRefresh.activityDebounce` 3. `README.md` - Updated documentation: - Added new "Activity-Based Polling" section explaining the feature - Updated command line options table - Updated environment variables table - Added configuration examples 4. `test/unit/watcher.test.js` - Updated tests (74 tests, 27 new): - Tests for `autoRefreshMode` configuration - Tests for `activityDebounce` configuration - Tests for `getActivityMonitorStatus()` method - Tests for `getAutoRefreshConfig()` method - Tests for `AUTO_REFRESH_MODES` constant - Tests for backwards compatibility with `autoRefreshEnabled: false` Acceptance Criteria Met: - ✅ `autoRefreshMode` logic safely handles the three options (`none`, `interval`, `activity`), defaulting to `activity` - ✅ `ActivityMonitor` successfully detects changes in target directories for Claude, Codex, and Gemini - ✅ Refreshes are triggered based on the provided debounce interval - ✅ During active usage, polling functions as an interval loop; during idle periods, polling is disabled to save resources - ✅ CLI and README are updated with the new configurations Test Results: - ActivityMonitor tests: 47 passed - Watcher tests: 74 passed - Total new tests: 121 passed
❌ Lint FailedLinting errors were detected. View Logs |
Contributor
Author
|
✅ Applied the requested follow-up changes in commit 8ab0807 Summary of ChangesI have completed the fix for the lint error. Here's a summary of the changes: SummaryFixed the ESLint Changes Made:
The file is now well under the 400-line limit (382 lines) while maintaining the same functionality. Key changes:
🤖 Implementation Details
Undo Changes • View Task Execution Processing comment ID: 4071451178✓ |
…ry of the changes:
I have completed the fix for the lint error. Here's a summary of the changes:
## Summary
Fixed the ESLint `max-lines` warning in `src/index.js` by extracting the auto-refresh logic into a new module.
### Changes Made:
1. **Created `src/auto-refresh-manager.js`** (239 lines)
- Extracted the `AutoRefreshManager` class containing all auto-refresh related logic:
- `start()` / `stop()` methods
- Activity-based refresh (`_startActivityBasedRefresh`, `_handleActivityDetected`, `_runActivityRefreshCycle`)
- Interval-based refresh (`_startIntervalBasedRefresh`)
- `getActivityMonitorStatus()` and timestamp management
2. **Updated `src/index.js`** (382 lines, down from 575)
- Replaced `ActivityMonitor` import with `AutoRefreshManager` import
- Simplified class by removing 5 properties and ~175 lines of auto-refresh code
- `startAutoRefresh()` now creates and delegates to `AutoRefreshManager`
- `stopAutoRefresh()` delegates to the manager
- `getActivityMonitorStatus()` delegates to the manager
- `getAutoRefreshConfig()` gets `lastRefreshedAt` from the manager
- Consolidated `_extractSnapshotMetrics` and `_attachPaceEvaluation` helper methods
The file is now well under the 400-line limit (382 lines) while maintaining the same functionality.
Key changes:
1. **Created `src/auto-refresh-manager.js`** (239 lines)
- Extracted the `AutoRefreshManager` class containing all auto-refresh related logic:
- `start()` / `stop()` methods
- Activity-based refresh (`_startActivityBasedRefresh`, `_handleActivityDetected`, `_runActivityRefreshCycle`)
- Interval-based refresh (`_startIntervalBasedRefresh`)
- `getActivityMonitorStatus()` and timestamp management
2. **Updated `src/index.js`** (382 lines, down from 575)
- Replaced `ActivityMonitor` import with `AutoRefreshManager` import
- Simplified class by removing 5 properties and ~175 lines of auto-refresh code
- `startAutoRefresh()` now creates and delegates to `AutoRefreshManager`
PR: #77
Comment by: @github-actions[bot] (ID: 4071451178)
Model: claude-opus-4-5-20251101
propr-dev
Bot
deleted the
70/claude-opus-4-5-20251101-core-implement-activity-b-20260317-0003-om7
branch
March 17, 2026 00:16
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.
AI Implementation Summary
Closes #70
Branch:
70/claude-opus-4-5-20251101-core-implement-activity-b-20260317-0003-om7Commits: ✅ Changes committed (f7522a2)
AI Processing Completed
Execution Details:
Summary:
The ActivityMonitor module works correctly. Let me provide a summary of the implementation:
Implementation Summary
I have successfully implemented GitHub issue #70 - Activity-Based Polling via Local Log Monitoring. Here's what was implemented:
New Files Created:
src/activity-monitor.js- ActivityMonitor utility class that:~/.config/claude/projects/,~/.claude/), Codex (~/.codex/sessions/,~/.codex/), and Gemini (~/.config/gemini/,~/.gemini/) usingfs.watchtest/unit/activity-monitor.test.js- Comprehensive unit tests (47 tests) covering:Modified Files:
src/index.js- Updated AgentTank class:autoRefreshModeconfiguration with 3 modes:'none','interval','activity'(default)activityDebounceconfiguration option_startActivityBasedRefresh()for activity mode_handleActivityDetected()and_runActivityRefreshCycle()for on-demand refresh cycles_startIntervalBasedRefresh()for traditional pollinggetActivityMonitorStatus()andgetAutoRefreshConfig()methodsAUTO_REFRESH_MODESconstantbin/agent-tank.js- Updated CLI:--auto-refresh-modeoption (none, interval, activity)--activity-debounceoption (milliseconds)AGENT_TANK_AUTO_REFRESH_MODE,AGENT_TANK_ACTIVITY_DEBOUNCEautoRefresh.modeandautoRefresh.activityDebounceREADME.md- Updated documentation:test/unit/watcher.test.js- Updated tests (74 tests, 27 new):autoRefreshModeconfigurationactivityDebounceconfigurationgetActivityMonitorStatus()methodgetAutoRefreshConfig()methodAUTO_REFRESH_MODESconstantautoRefreshEnabled: falseAcceptance Criteria Met:
autoRefreshModelogic safely handles the three options (none,interval,activity), defaulting toactivityActivityMonitorsuccessfully detects changes in target directories for Claude, Codex, and GeminiTest Results:
Detailed Logs:
b98227d1-2d6c-45d8-bd9f-126e1abd35cdLog files stored at:
/tmp/claude-logs/issue-70-2026-03-17T00-12-41-760Z-conversation.json/tmp/claude-logs/issue-70-2026-03-17T00-12-41-760Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #70.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!