refactor(observer): v7 step-aware AG Native DOM parser with data-testid/data-step-index based content extraction

- Replace CSS class-based scanning with [data-testid='conversation-view'] + [data-step-index] traversal
- New extractCleanStepText(): clone-and-strip buttons/SVG/icons before text extraction
- New extractStepContext(): step-container-aware context with header + code block
- NOISE_RE: block Material icon names, button labels, UI artifacts
- Auto DOM structure dump on first conversation-view detection
- Enhanced deep-inspect with step element + button inventory
- known-issues: document AG Native SDK API incompatibility
This commit is contained in:
Variet Worker
2026-04-12 06:14:46 +09:00
parent 70dc301dca
commit a4d7286bce
7 changed files with 766 additions and 472 deletions

View File

@@ -39,7 +39,7 @@ let responseWatcher: fs.FSWatcher | null = null;
let brainWatcher: BrainWatcher | null = null;
let activeTrajectoryId = '';
const recentPendingSteps = new Map<string, number>();
const PENDING_MEMORY_TTL_MS = 60_000;
const PENDING_MEMORY_TTL_MS = 30_000;
// generateApprovalObserverScript → extracted to ./observer-script.ts
const lastSnapshotText = new Map<string, string>();
@@ -589,6 +589,7 @@ function setupMonitor() {
// lastModifiedTime is still changing = AI is thinking, NOT approval
consecutiveIdleCount = 0; // Reset!
ctx.stallProbed = false;
ctx.sessionStalled = false; // FIX: also reset stalled flag on modTime change
if (pollCount <= 10 || pollCount % 12 === 0) {
ctx.logToFile(`[THINK] step=${currentCount} modTime changing → not stall`);
}