1f2eb2e8184c94d1f0a7df9632cd9735e673b75d
iter-2 revision of Plan 04-08 (video-file MediaStream methodology reframe)
addressing the 2 BLOCKERs + 5 WARNINGs + 3 advisories from plan-checker
iter-1 (commit 051813e, .planning/phases/04-harden-clean-up-optional/04-08-CHECKER-iter-1.md).
BLOCKER 1 (Vite ?url asset emission for >=1 MB WebM): pre-decide the
bundling strategy. The 1.9 MB WebM is three orders of magnitude above
Vite's assetsInlineLimit (4096); it follows the extracted-asset path
(dist-test/assets/<hash>.webm), not the data-URI-inline path the
Plan 01-10 SVG precedent uses. The @crxjs/vite-plugin auto-WAR
behavior for extracted media assets in offscreen-document context is
empirically untested in this codebase. Resolution: add an explicit
web_accessible_resources entry for assets/*.webm in manifest.json
alongside the existing src/welcome/welcome.html entry. Production
dist/ has zero *.webm assets so the entry is inert; test dist-test/
has the hashed asset and the entry authorizes chrome-extension://<id>/
assets/<hash>.webm URL access from the offscreen document context.
No executor improvisation; the bundling strategy is locked-in BEFORE
Task 1 begins.
BLOCKER 2 (installFakeDisplayMedia async conversion breaks eager-install
contract): preserve the SYNCHRONOUS function signature. The existing
eager call at src/test-hooks/offscreen-hooks.ts:528-537 + the top-
level await at src/offscreen/recorder.ts:46-48 establish a contract
that navigator.mediaDevices.getDisplayMedia is monkey-patched BEFORE
recorder.bootstrap runs. Converting installFakeDisplayMedia() to
async would create a race window where recorder.startRecording calls
the REAL getDisplayMedia (Chrome screen-share picker hangs in
headless). Resolution: SYNC install (videoEl creation + DOM append +
monkey-patch assignment) + LAZY first-frame closure (await readyState
HAVE_FUTURE_DATA + .play() deferred INTO fakeGetDisplayMedia body).
First getDisplayMedia call may block ~50-500ms while video decodes;
subsequent calls observe the resolved readiness Promise + proceed
immediately. Bridge handler + eager-install try/catch remain sync.
WARNING 1 (autoplay reliability): explicit error class identifier
('autoplay-blocked or codec-unsupported in headless context') in the
.play() reject path; spike surface root cause instead of mysterious
0-frames.
WARNING 2 (patchDisplaySurface compatibility): new sub-gate in Task 1
verify that mints a stream + asserts track.getSettings().displaySurface
=== 'monitor'. Optional executor implementation as a --check-display-
surface-only mode on the spike script; spike re-run is the fallback
high-latency catch.
WARNING 3 (spike probe-value asserts): surfaced as explicit grep gates
in Task 2 verify block. POST-PRIME=0, PRE-KILL>=3, POST-KILL>=3 per
debug session-2 baseline.
WARNING 4 (ROADMAP.md edit): pre-specified exact pre-edit string +
replacement + grep gate (CLOSED via Plan 04-08 must appear; STATUS
2026-05-21: OPEN must disappear).
WARNING 5 (synthetic-display-source filename leak): new Tier-2 sub-
invariant in tests/background/no-test-hooks-in-prod-bundle.test.ts;
catches accidental test-hook inlining into production chunk. Tier-1
inventory at 12 entries unchanged.
advisory 1: commit message corrected to reference Task 1 + Task 2
only (not Task 3, which doesn't exist).
advisory 2: src/offscreen/recorder.ts:91 segments invariant added as
grep gate in Task 1 verify block.
advisory 3: dual-location fixture note added to Task 1 Step 1 (the
original tests/fixtures/last_30sec.webm remains in place; the new
tests/uat/fixtures/synthetic-display-source.webm is a SECOND copy
under the UAT subtree).
Plan validates via gsd-sdk frontmatter.validate --schema plan (valid:
true, no missing fields) AND gsd-sdk verify.plan-structure (valid:
true, 0 errors, 0 warnings, 2 tasks with full 4-element shapes).
files_modified updated to include tests/background/no-test-hooks-in-
prod-bundle.test.ts (Tier-2 gate location).
Iter-2 architectural thesis unchanged: HTMLVideoElement.captureStream
bypasses the canvas-throttling root cause per debug session-2 verdict.
The revision is methodology-tightening, not re-architecture.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mokosh — Session Capture
Chrome MV3 extension that records operator sessions for bug reports.
Фаза 1 — Локальная запись + экспорт архива
Установка и запуск
Разработка
# Установка зависимостей
npm install
# Сборка для разработки с HMR
npm run dev
# Сборка для продакшена
npm run build
Установка расширения в Chrome
-
Соберите проект:
npm run build -
Откройте Chrome и перейдите по адресу:
chrome://extensions/ -
Включите "Режим разработчика" (Developer mode) в правом верхнем углу
-
Нажмите кнопку "Загрузить распакованное расширение" (Load unpacked)
-
Выберите папку
distв корне проекта -
Расширение установлено!
Использование
-
При первом открытии popup расширение запросит разрешение на запись экрана
-
Разрешение обязательно для работы расширения
-
Расширение автоматически начнет запись:
- Видео: последние 30 секунд (кольцевой буфер)
- DOM-события через rrweb: последние 10 минут
- Лог действий пользователя: последние 10 минут
-
Для сохранения отчета об ошибке:
- Нажмите на иконку расширения
- Нажмите кнопку "Сохранить отчёт об ошибке"
- Архив автоматически загрузится в папку "Загрузки"
Структура архива
Архив session_report_YYYY-MM-DD_HH-MM-SS.zip содержит:
session_report_2025-05-15_14-32-10.zip
├── video/
│ └── last_30sec.webm # склеенные чанки видеобуфера
├── rrweb/
│ └── session.json # массив DOM-событий rrweb
├── logs/
│ └── events.json # лог действий пользователя
├── screenshot.png # скриншот в момент сохранения
└── meta.json # метаданные сессии
Технический стек
- Тип расширения: Chrome Extension, Manifest V3
- Service Worker: Background script (Manifest V3)
- Захват экрана:
chrome.tabCaptureAPI - Захват DOM:
rrweb(npm: rrweb) - Лог событий: Content Script
- Упаковка архива:
JSZip(npm: jszip) - Сохранение файла:
chrome.downloadsAPI - Хранение буфера: In-memory (Service Worker + Content Script)
- Build: Vite + crxjs + TypeScript
Особенности
Маскирование чувствительных данных
- Пароли (
input[type=password]) маскируются автоматически в rrweb и логах - Поля с атрибутом
data-sensitive="true"также маскируются в rrweb
Записываемые события
Пользовательские события
- click — клик по любому элементу
- input — изменение значения поля (без паролей)
- navigation — переходы по страницам (popstate, hashchange, History API)
- js_error — JavaScript ошибки (window.onerror, unhandledrejection)
- network_error — сетевые ошибки (fetch/XHR с кодом ответа >= 400)
Кольцевой буфер
- Видео: 30 секунд, первый чанк (WebM заголовок) хранится всегда
- rrweb события: 10 минут, максимум 5000 событий
- Пользовательские события: 10 минут
Память
- Ожидаемое потребление: ~5-10 МБ в фоновом режиме
Критерии приёмки Фазы 1
- ✅ Расширение устанавливается в Chrome без ошибок
- ✅ Видеобуфер непрерывно работает на любой вкладке
- ✅ В буфере всегда есть не более 30 секунд видео
- ✅ rrweb пишет DOM-события без ошибок на типовых страницах
- ✅ Лог событий фиксирует клики, навигацию и сетевые ошибки
- ✅ При нажатии кнопки архив скачивается в "Загрузки" за < 5 секунд
- ✅ Архив открывается,
last_30sec.webmвоспроизводится в браузере - ✅ Пароли не попадают в лог и rrweb-снимки
- ✅ RAM-потребление расширения не превышает 50 МБ в фоне
Отладка
Console Logs
Расширение пишет подробные логи в консоль:
- Service Worker: Chrome DevTools → Extensions → Service Worker → Console
- Content Script: Chrome DevTools на любой странице → Console
- Popup: Правый клик по popup → Проверить
Структура проекта
ai-call-extension/
├── src/
│ ├── background/ # Service Worker
│ │ └── index.ts
│ ├── content/ # Content Script
│ │ └── index.ts
│ ├── popup/ # Popup UI
│ │ ├── index.html
│ │ ├── index.ts
│ │ └── style.css
│ └── shared/ # Общие типы и утилиты
│ ├── types.ts
│ └── logger.ts
├── icons/ # Иконки расширения
├── dist/ # Собранные файлы
├── manifest.json # Manifest расширения
├── vite.config.ts # Конфигурация Vite
├── tsconfig.json # Конфигурация TypeScript
└── package.json
Лицензия
MIT
Контакты
Для вопросов и предложений обращайтесь в support.
Description
Languages
TypeScript
91%
HTML
3.4%
CSS
2.8%
Shell
2%
JavaScript
0.8%